From c07f5e83398651cf8d0dccb036705b9eb69d8646 Mon Sep 17 00:00:00 2001 From: Karl Hammond Date: Wed, 19 Oct 2022 10:29:18 -0500 Subject: [PATCH 001/396] Temporary(?) fix for highlighting overflow in labelmap.rst --- doc/src/labelmap.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/src/labelmap.rst b/doc/src/labelmap.rst index 57e4926611..a11ab653f8 100644 --- a/doc/src/labelmap.rst +++ b/doc/src/labelmap.rst @@ -25,7 +25,7 @@ Examples .. code-block:: LAMMPS labelmap atom 3 carbon 4 'c3"' 5 "c1'" 6 "c#" - labelmap bond 1 carbonyl 2 nitrile 3 """ c1'-c2" """ + labelmap bond 1 carbonyl 2 nitrile 3 """ c1'-c2" """ #" labelmap atom $(label2type(atom,carbon)) C # change type label from 'carbon' to 'C' labelmap clear labelmap write mymap.include From 56ca901cdbd65fe2351b33e93dd90c07eaa5bc34 Mon Sep 17 00:00:00 2001 From: Ian Bogle Date: Tue, 24 Jan 2023 09:36:18 -0600 Subject: [PATCH 002/396] Implement a "caching in LDS" approach for EAM to improve performance on HIP - Use a TeamPolicy rather than a RangePolicy to expose scratch - Team cooperates to load row-zero of spline into LDS - At runtime, decide whether value can be 'cached' in LDS, and conditionally load from LDS based on this Should be easily extendable / tunable for other architectures if ever required. Change-Id: Ie4254c8db1a7b14abafffe2b581014c5137bf7ed --- src/KOKKOS/pair_eam_kokkos.cpp | 302 +++++++++++++++++++++++++++++++-- src/KOKKOS/pair_eam_kokkos.h | 16 ++ 2 files changed, 302 insertions(+), 16 deletions(-) diff --git a/src/KOKKOS/pair_eam_kokkos.cpp b/src/KOKKOS/pair_eam_kokkos.cpp index 6e1cd1feea..6837992f8b 100644 --- a/src/KOKKOS/pair_eam_kokkos.cpp +++ b/src/KOKKOS/pair_eam_kokkos.cpp @@ -31,9 +31,25 @@ #include "pair_kokkos.h" #include - using namespace LAMMPS_NS; +#define MAX_CACHE_ROWS 500 +#define MAX_CACHE_COLS 7 + +/* ---------------------------------------------------------------------- */ +template +auto policyInstance(int inum){ + #ifdef KOKKOS_ENABLE_HIP + auto policy = Kokkos::TeamPolicy((inum+1023)/1024, 1024) + .set_scratch_size(0, + Kokkos::PerTeam(MAX_CACHE_ROWS*MAX_CACHE_COLS*sizeof(double))); + return policy; + #else + auto policy = Kokkos::RangePolicy(0,inum); + return policy; + #endif +} + /* ---------------------------------------------------------------------- */ template @@ -182,9 +198,13 @@ void PairEAMKokkos::compute(int eflag_in, int vflag_in) // compute kernel AB if (eflag) - Kokkos::parallel_reduce(Kokkos::RangePolicy >(0,inum),*this,ev); + Kokkos::parallel_reduce( + policyInstance>(inum), + *this,ev); else - Kokkos::parallel_for(Kokkos::RangePolicy >(0,inum),*this); + Kokkos::parallel_for( + policyInstance>(inum), + *this); } if (eflag) { @@ -203,41 +223,65 @@ void PairEAMKokkos::compute(int eflag_in, int vflag_in) if (evflag) { if (neighflag == HALF) { if (newton_pair) { - Kokkos::parallel_reduce(Kokkos::RangePolicy >(0,inum),*this,ev); + Kokkos::parallel_reduce( + policyInstance>(inum), + *this,ev); } else { - Kokkos::parallel_reduce(Kokkos::RangePolicy >(0,inum),*this,ev); + Kokkos::parallel_reduce( + policyInstance>(inum), + *this,ev); } } else if (neighflag == HALFTHREAD) { if (newton_pair) { - Kokkos::parallel_reduce(Kokkos::RangePolicy >(0,inum),*this,ev); + Kokkos::parallel_reduce( + policyInstance>(inum), + *this,ev); } else { - Kokkos::parallel_reduce(Kokkos::RangePolicy >(0,inum),*this,ev); + Kokkos::parallel_reduce( + policyInstance>(inum), + *this,ev); } } else if (neighflag == FULL) { if (newton_pair) { - Kokkos::parallel_reduce(Kokkos::RangePolicy >(0,inum),*this,ev); + Kokkos::parallel_reduce( + policyInstance>(inum), + *this,ev); } else { - Kokkos::parallel_reduce(Kokkos::RangePolicy >(0,inum),*this,ev); + Kokkos::parallel_reduce( + policyInstance>(inum), + *this,ev); } } } else { if (neighflag == HALF) { if (newton_pair) { - Kokkos::parallel_for(Kokkos::RangePolicy >(0,inum),*this); + Kokkos::parallel_for( + policyInstance>(inum), + *this); } else { - Kokkos::parallel_for(Kokkos::RangePolicy >(0,inum),*this); + Kokkos::parallel_for( + policyInstance>(inum), + *this); } } else if (neighflag == HALFTHREAD) { if (newton_pair) { - Kokkos::parallel_for(Kokkos::RangePolicy >(0,inum),*this); + Kokkos::parallel_for( + policyInstance>(inum), + *this); } else { - Kokkos::parallel_for(Kokkos::RangePolicy >(0,inum),*this); + Kokkos::parallel_for( + policyInstance>(inum), + *this); } } else if (neighflag == FULL) { if (newton_pair) { - Kokkos::parallel_for(Kokkos::RangePolicy >(0,inum),*this); + Kokkos::parallel_for( + policyInstance>(inum), + *this); } else { - Kokkos::parallel_for(Kokkos::RangePolicy >(0,inum),*this); + Kokkos::parallel_for( + policyInstance>(inum), + *this); } } } @@ -614,7 +658,7 @@ void PairEAMKokkos::operator()(TagPairEAMKernelB, const int & EV_FLOAT ev; this->template operator()(TagPairEAMKernelB(), ii, ev); } - +/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */ ////Specialisation for Neighborlist types Half, HalfThread, Full @@ -799,6 +843,232 @@ void PairEAMKokkos::operator()(TagPairEAMKernelCtemplate operator()(TagPairEAMKernelC(), ii, ev); } +/* ---------------------------------------------------------------------- */ + +////Specialisation for Neighborlist types Half, HalfThread, Full +template +template +KOKKOS_INLINE_FUNCTION +void PairEAMKokkos::operator()(TagPairEAMKernelAB, + const typename Kokkos::TeamPolicy::member_type& team_member, + EV_FLOAT& ev) const { + int ii = team_member.league_rank()*team_member.team_size() + team_member.team_rank(); + // rho = density at each atom + // loop over neighbors of my atoms + const int m_max = d_rhor_spline.extent_int(1); + const int j_max = d_rhor_spline.extent_int(2); + const int d_rhor_spline_cached = (m_max > MAX_CACHE_ROWS || j_max > MAX_CACHE_COLS) ? 0 : 1; + Kokkos::View> A(team_member.team_scratch(0), MAX_CACHE_ROWS); + + if(d_rhor_spline_cached){ + for(int i = team_member.team_rank(); i < m_max*j_max; i+= team_member.team_size()){ + int j = i%j_max; + int m = i/j_max; + A(m,j) = d_rhor_spline(0,m,j); + } + team_member.team_barrier(); + } + + const int i = d_ilist[ii]; + const X_FLOAT xtmp = x(i,0); + const X_FLOAT ytmp = x(i,1); + const X_FLOAT ztmp = x(i,2); + const int itype = type(i); + + const int jnum = d_numneigh[i]; + + F_FLOAT rhotmp = 0.0; + + for (int jj = 0; jj < jnum; jj++) { + int j = d_neighbors(i,jj); + j &= NEIGHMASK; + + const X_FLOAT delx = xtmp - x(j,0); + const X_FLOAT dely = ytmp - x(j,1); + const X_FLOAT delz = ztmp - x(j,2); + const int jtype = type(j); + const F_FLOAT rsq = delx*delx + dely*dely + delz*delz; + + if (rsq < cutforcesq) { + F_FLOAT p = sqrt(rsq)*rdr + 1.0; + int m = static_cast (p); + m = MIN(m,nr-1); + p -= m; + p = MIN(p,1.0); + const int d_type2rhor_ji = d_type2rhor(jtype,itype); + if(d_type2rhor_ji == 0 && d_rhor_spline_cached == 1) { + rhotmp += ((A(m,3)*p + A(m,4))*p + + A(m,5))*p + A(m,6); + } else + rhotmp += ((d_rhor_spline(d_type2rhor_ji,m,3)*p + d_rhor_spline(d_type2rhor_ji,m,4))*p + + d_rhor_spline(d_type2rhor_ji,m,5))*p + d_rhor_spline(d_type2rhor_ji,m,6); + } + + } + d_rho[i] += rhotmp; + + // fp = derivative of embedding energy at each atom + // phi = embedding energy at each atom + // if rho > rhomax (e.g. due to close approach of two atoms), + // will exceed table, so add linear term to conserve energy + + F_FLOAT p = d_rho[i]*rdrho + 1.0; + int m = static_cast (p); + m = MAX(1,MIN(m,nrho-1)); + p -= m; + p = MIN(p,1.0); + const int d_type2frho_i = d_type2frho[itype]; + d_fp[i] = (d_frho_spline(d_type2frho_i,m,0)*p + d_frho_spline(d_type2frho_i,m,1))*p + d_frho_spline(d_type2frho_i,m,2); + if (EFLAG) { + F_FLOAT phi = ((d_frho_spline(d_type2frho_i,m,3)*p + d_frho_spline(d_type2frho_i,m,4))*p + + d_frho_spline(d_type2frho_i,m,5))*p + d_frho_spline(d_type2frho_i,m,6); + if (d_rho[i] > rhomax) phi += d_fp[i] * (d_rho[i]-rhomax); + if (eflag_global) ev.evdwl += phi; + if (eflag_atom) d_eatom[i] += phi; + } + +} + +template +template +KOKKOS_INLINE_FUNCTION +void PairEAMKokkos::operator()(TagPairEAMKernelAB, + const typename Kokkos::TeamPolicy::member_type& team_member) const { + EV_FLOAT ev; + this->template operator()(TagPairEAMKernelAB(), team_member, ev); +} + +/* ---------------------------------------------------------------------- */ + +////Specialisation for Neighborlist types Half, HalfThread, Full +template +template +KOKKOS_INLINE_FUNCTION +void PairEAMKokkos::operator()(TagPairEAMKernelC, + const typename Kokkos::TeamPolicy::member_type& team_member, + EV_FLOAT& ev) const { + + // The f array is duplicated for OpenMP, atomic for CUDA, and neither for Serial + int ii = team_member.league_rank()*team_member.team_size() + team_member.team_rank(); + + auto v_f = ScatterViewHelper,decltype(dup_f),decltype(ndup_f)>::get(dup_f,ndup_f); + auto a_f = v_f.template access>(); + + const int m_max = d_z2r_spline.extent_int(1); + const int j_max = d_z2r_spline.extent_int(2); + const int d_z2r_spline_cached = (m_max > MAX_CACHE_ROWS || j_max > MAX_CACHE_COLS) ? 0 : 1; + Kokkos::View> A(team_member.team_scratch(0), MAX_CACHE_ROWS); + + if(d_z2r_spline_cached){ + for(int i = team_member.team_rank(); i < m_max*j_max; i+= team_member.team_size()){ + int j = i%j_max; + int m = i/j_max; + A(m,j) = d_z2r_spline(0,m,j); + } + team_member.team_barrier(); + } + + const int i = d_ilist[ii]; + const X_FLOAT xtmp = x(i,0); + const X_FLOAT ytmp = x(i,1); + const X_FLOAT ztmp = x(i,2); + const int itype = type(i); + + const int jnum = d_numneigh[i]; + + F_FLOAT fxtmp = 0.0; + F_FLOAT fytmp = 0.0; + F_FLOAT fztmp = 0.0; + + for (int jj = 0; jj < jnum; jj++) { + int j = d_neighbors(i,jj); + j &= NEIGHMASK; + const X_FLOAT delx = xtmp - x(j,0); + const X_FLOAT dely = ytmp - x(j,1); + const X_FLOAT delz = ztmp - x(j,2); + const int jtype = type(j); + const F_FLOAT rsq = delx*delx + dely*dely + delz*delz; + + if (rsq < cutforcesq) { + const F_FLOAT r = sqrt(rsq); + F_FLOAT p = r*rdr + 1.0; + int m = static_cast (p); + m = MIN(m,nr-1); + p -= m; + p = MIN(p,1.0); + + // rhoip = derivative of (density at atom j due to atom i) + // rhojp = derivative of (density at atom i due to atom j) + // phi = pair potential energy + // phip = phi' + // z2 = phi * r + // z2p = (phi * r)' = (phi' r) + phi + // psip needs both fp[i] and fp[j] terms since r_ij appears in two + // terms of embed eng: Fi(sum rho_ij) and Fj(sum rho_ji) + // hence embed' = Fi(sum rho_ij) rhojp + Fj(sum rho_ji) rhoip + + const int d_type2rhor_ij = d_type2rhor(itype,jtype); + const F_FLOAT rhoip = (d_rhor_spline(d_type2rhor_ij,m,0)*p + d_rhor_spline(d_type2rhor_ij,m,1))*p + + d_rhor_spline(d_type2rhor_ij,m,2); + const int d_type2rhor_ji = d_type2rhor(jtype,itype); + const F_FLOAT rhojp = (d_rhor_spline(d_type2rhor_ji,m,0)*p + d_rhor_spline(d_type2rhor_ji,m,1))*p + + d_rhor_spline(d_type2rhor_ji,m,2); + const int d_type2z2r_ij = d_type2z2r(itype,jtype); + + const auto have_cache = (d_z2r_spline_cached == 1) && (0 == d_type2z2r_ij); + const auto z2r_spline_3 = (have_cache) ? A(m,3) : d_z2r_spline(d_type2z2r_ij,m,3); + const auto z2r_spline_4 = (have_cache) ? A(m,4) : d_z2r_spline(d_type2z2r_ij,m,4); + const auto z2r_spline_5 = (have_cache) ? A(m,5) : d_z2r_spline(d_type2z2r_ij,m,5); + const auto z2r_spline_6 = (have_cache) ? A(m,6) : d_z2r_spline(d_type2z2r_ij,m,6); + + const F_FLOAT z2p = (3.0*rdr*z2r_spline_3*p + 2.0*rdr*z2r_spline_4)*p + + rdr*z2r_spline_5; // the rdr and the factors of 3.0 and 2.0 come out of the interpolate function + const F_FLOAT z2 = ((z2r_spline_3*p + z2r_spline_4)*p + + z2r_spline_5)*p + z2r_spline_6; + + const F_FLOAT recip = 1.0/r; + const F_FLOAT phi = z2*recip; + const F_FLOAT phip = z2p*recip - phi*recip; + const F_FLOAT psip = d_fp[i]*rhojp + d_fp[j]*rhoip + phip; + const F_FLOAT fpair = -psip*recip; + + fxtmp += delx*fpair; + fytmp += dely*fpair; + fztmp += delz*fpair; + + if ((NEIGHFLAG==HALF || NEIGHFLAG==HALFTHREAD) && (NEWTON_PAIR || j < nlocal)) { + a_f(j,0) -= delx*fpair; + a_f(j,1) -= dely*fpair; + a_f(j,2) -= delz*fpair; + } + + if (EVFLAG) { + if (eflag) { + ev.evdwl += (((NEIGHFLAG==HALF || NEIGHFLAG==HALFTHREAD)&&(NEWTON_PAIR||(jtemplate ev_tally(ev,i,j,phi,fpair,delx,dely,delz); + } + + } + } + + a_f(i,0) += fxtmp; + a_f(i,1) += fytmp; + a_f(i,2) += fztmp; +} + +template +template +KOKKOS_INLINE_FUNCTION +void PairEAMKokkos::operator()(TagPairEAMKernelC, + /*const int &ii*/ + const typename Kokkos::TeamPolicy::member_type& team_member) const { + EV_FLOAT ev; + this->template operator()(TagPairEAMKernelC(), team_member, ev); +} /* ---------------------------------------------------------------------- */ diff --git a/src/KOKKOS/pair_eam_kokkos.h b/src/KOKKOS/pair_eam_kokkos.h index 006dceb1f2..21cf188cd6 100644 --- a/src/KOKKOS/pair_eam_kokkos.h +++ b/src/KOKKOS/pair_eam_kokkos.h @@ -89,6 +89,14 @@ class PairEAMKokkos : public PairEAM, public KokkosBase { KOKKOS_INLINE_FUNCTION void operator()(TagPairEAMKernelAB, const int&) const; + template + KOKKOS_INLINE_FUNCTION + void operator()(TagPairEAMKernelAB, const typename Kokkos::TeamPolicy::member_type&, EV_FLOAT&) const; + + template + KOKKOS_INLINE_FUNCTION + void operator()(TagPairEAMKernelAB, const typename Kokkos::TeamPolicy::member_type&) const; + template KOKKOS_INLINE_FUNCTION void operator()(TagPairEAMKernelC, const int&, EV_FLOAT&) const; @@ -97,6 +105,14 @@ class PairEAMKokkos : public PairEAM, public KokkosBase { KOKKOS_INLINE_FUNCTION void operator()(TagPairEAMKernelC, const int&) const; + template + KOKKOS_INLINE_FUNCTION + void operator()(TagPairEAMKernelC, const typename Kokkos::TeamPolicy::member_type&, EV_FLOAT&) const; + + template + KOKKOS_INLINE_FUNCTION + void operator()(TagPairEAMKernelC, const typename Kokkos::TeamPolicy::member_type&) const; + template KOKKOS_INLINE_FUNCTION void ev_tally(EV_FLOAT &ev, const int &i, const int &j, From 55f454db2d2eef62d9551047be26086361f89b7d Mon Sep 17 00:00:00 2001 From: Ian Bogle Date: Fri, 3 Feb 2023 13:35:38 -0600 Subject: [PATCH 003/396] Addressed feedback from LAMMPS developers: - moved policyInstance into the EAM class - eliminated MAX_CACHE_COLS define, in favor of the static_extent of the spline view type - made inum a protected member var that allows range checking inside TeamPolicy kernels - added range checking after initializing the cached table in TeamPolicy kernels - correctness and perf checks pass Change-Id: Iaaf34f7560c37e0a2a34e980761246d3ef42be99 --- src/KOKKOS/pair_eam_kokkos.cpp | 294 +++++++++++++++++---------------- src/KOKKOS/pair_eam_kokkos.h | 7 +- 2 files changed, 155 insertions(+), 146 deletions(-) diff --git a/src/KOKKOS/pair_eam_kokkos.cpp b/src/KOKKOS/pair_eam_kokkos.cpp index 6837992f8b..cc3b606b17 100644 --- a/src/KOKKOS/pair_eam_kokkos.cpp +++ b/src/KOKKOS/pair_eam_kokkos.cpp @@ -34,15 +34,18 @@ using namespace LAMMPS_NS; #define MAX_CACHE_ROWS 500 -#define MAX_CACHE_COLS 7 /* ---------------------------------------------------------------------- */ -template -auto policyInstance(int inum){ +template +template +auto PairEAMKokkos::policyInstance(int inum){ #ifdef KOKKOS_ENABLE_HIP + static_assert(t_ffloat_2d_n7::static_extent(2) == 7, + "Breaking assumption of spline dim for KernelAB and KernelC scratch caching"); + auto policy = Kokkos::TeamPolicy((inum+1023)/1024, 1024) .set_scratch_size(0, - Kokkos::PerTeam(MAX_CACHE_ROWS*MAX_CACHE_COLS*sizeof(double))); + Kokkos::PerTeam(MAX_CACHE_ROWS*t_ffloat_2d_n7::static_extent(2)*sizeof(double))); return policy; #else auto policy = Kokkos::RangePolicy(0,inum); @@ -129,7 +132,7 @@ void PairEAMKokkos::compute(int eflag_in, int vflag_in) d_numneigh = k_list->d_numneigh; d_neighbors = k_list->d_neighbors; d_ilist = k_list->d_ilist; - int inum = list->inum; + inum = list->inum; need_dup = lmp->kokkos->need_dup(); if (need_dup) { @@ -199,11 +202,11 @@ void PairEAMKokkos::compute(int eflag_in, int vflag_in) if (eflag) Kokkos::parallel_reduce( - policyInstance>(inum), + policyInstance>(inum), *this,ev); else Kokkos::parallel_for( - policyInstance>(inum), + policyInstance>(inum), *this); } @@ -224,31 +227,31 @@ void PairEAMKokkos::compute(int eflag_in, int vflag_in) if (neighflag == HALF) { if (newton_pair) { Kokkos::parallel_reduce( - policyInstance>(inum), + policyInstance>(inum), *this,ev); } else { Kokkos::parallel_reduce( - policyInstance>(inum), + policyInstance>(inum), *this,ev); } } else if (neighflag == HALFTHREAD) { if (newton_pair) { Kokkos::parallel_reduce( - policyInstance>(inum), + policyInstance>(inum), *this,ev); } else { Kokkos::parallel_reduce( - policyInstance>(inum), + policyInstance>(inum), *this,ev); } } else if (neighflag == FULL) { if (newton_pair) { Kokkos::parallel_reduce( - policyInstance>(inum), + policyInstance>(inum), *this,ev); } else { Kokkos::parallel_reduce( - policyInstance>(inum), + policyInstance>(inum), *this,ev); } } @@ -256,31 +259,31 @@ void PairEAMKokkos::compute(int eflag_in, int vflag_in) if (neighflag == HALF) { if (newton_pair) { Kokkos::parallel_for( - policyInstance>(inum), + policyInstance>(inum), *this); } else { Kokkos::parallel_for( - policyInstance>(inum), + policyInstance>(inum), *this); } } else if (neighflag == HALFTHREAD) { if (newton_pair) { Kokkos::parallel_for( - policyInstance>(inum), + policyInstance>(inum), *this); } else { Kokkos::parallel_for( - policyInstance>(inum), + policyInstance>(inum), *this); } } else if (neighflag == FULL) { if (newton_pair) { Kokkos::parallel_for( - policyInstance>(inum), + policyInstance>(inum), *this); } else { Kokkos::parallel_for( - policyInstance>(inum), + policyInstance>(inum), *this); } } @@ -857,8 +860,8 @@ void PairEAMKokkos::operator()(TagPairEAMKernelAB, // loop over neighbors of my atoms const int m_max = d_rhor_spline.extent_int(1); const int j_max = d_rhor_spline.extent_int(2); - const int d_rhor_spline_cached = (m_max > MAX_CACHE_ROWS || j_max > MAX_CACHE_COLS) ? 0 : 1; - Kokkos::View MAX_CACHE_ROWS || j_max > t_ffloat_2d_n7::static_extent(2)) ? 0 : 1; + Kokkos::View> A(team_member.team_scratch(0), MAX_CACHE_ROWS); if(d_rhor_spline_cached){ @@ -869,65 +872,65 @@ void PairEAMKokkos::operator()(TagPairEAMKernelAB, } team_member.team_barrier(); } + if (ii < inum){ + const int i = d_ilist[ii]; + const X_FLOAT xtmp = x(i,0); + const X_FLOAT ytmp = x(i,1); + const X_FLOAT ztmp = x(i,2); + const int itype = type(i); - const int i = d_ilist[ii]; - const X_FLOAT xtmp = x(i,0); - const X_FLOAT ytmp = x(i,1); - const X_FLOAT ztmp = x(i,2); - const int itype = type(i); + const int jnum = d_numneigh[i]; - const int jnum = d_numneigh[i]; + F_FLOAT rhotmp = 0.0; - F_FLOAT rhotmp = 0.0; + for (int jj = 0; jj < jnum; jj++) { + int j = d_neighbors(i,jj); + j &= NEIGHMASK; - for (int jj = 0; jj < jnum; jj++) { - int j = d_neighbors(i,jj); - j &= NEIGHMASK; + const X_FLOAT delx = xtmp - x(j,0); + const X_FLOAT dely = ytmp - x(j,1); + const X_FLOAT delz = ztmp - x(j,2); + const int jtype = type(j); + const F_FLOAT rsq = delx*delx + dely*dely + delz*delz; - const X_FLOAT delx = xtmp - x(j,0); - const X_FLOAT dely = ytmp - x(j,1); - const X_FLOAT delz = ztmp - x(j,2); - const int jtype = type(j); - const F_FLOAT rsq = delx*delx + dely*dely + delz*delz; + if (rsq < cutforcesq) { + F_FLOAT p = sqrt(rsq)*rdr + 1.0; + int m = static_cast (p); + m = MIN(m,nr-1); + p -= m; + p = MIN(p,1.0); + const int d_type2rhor_ji = d_type2rhor(jtype,itype); + if(d_type2rhor_ji == 0 && d_rhor_spline_cached == 1) { + rhotmp += ((A(m,3)*p + A(m,4))*p + + A(m,5))*p + A(m,6); + } else + rhotmp += ((d_rhor_spline(d_type2rhor_ji,m,3)*p + d_rhor_spline(d_type2rhor_ji,m,4))*p + + d_rhor_spline(d_type2rhor_ji,m,5))*p + d_rhor_spline(d_type2rhor_ji,m,6); + } - if (rsq < cutforcesq) { - F_FLOAT p = sqrt(rsq)*rdr + 1.0; - int m = static_cast (p); - m = MIN(m,nr-1); - p -= m; - p = MIN(p,1.0); - const int d_type2rhor_ji = d_type2rhor(jtype,itype); - if(d_type2rhor_ji == 0 && d_rhor_spline_cached == 1) { - rhotmp += ((A(m,3)*p + A(m,4))*p + - A(m,5))*p + A(m,6); - } else - rhotmp += ((d_rhor_spline(d_type2rhor_ji,m,3)*p + d_rhor_spline(d_type2rhor_ji,m,4))*p + - d_rhor_spline(d_type2rhor_ji,m,5))*p + d_rhor_spline(d_type2rhor_ji,m,6); } + d_rho[i] += rhotmp; + // fp = derivative of embedding energy at each atom + // phi = embedding energy at each atom + // if rho > rhomax (e.g. due to close approach of two atoms), + // will exceed table, so add linear term to conserve energy + + F_FLOAT p = d_rho[i]*rdrho + 1.0; + int m = static_cast (p); + m = MAX(1,MIN(m,nrho-1)); + p -= m; + p = MIN(p,1.0); + const int d_type2frho_i = d_type2frho[itype]; + d_fp[i] = (d_frho_spline(d_type2frho_i,m,0)*p + d_frho_spline(d_type2frho_i,m,1))*p + d_frho_spline(d_type2frho_i,m,2); + if (EFLAG) { + F_FLOAT phi = ((d_frho_spline(d_type2frho_i,m,3)*p + d_frho_spline(d_type2frho_i,m,4))*p + + d_frho_spline(d_type2frho_i,m,5))*p + d_frho_spline(d_type2frho_i,m,6); + if (d_rho[i] > rhomax) phi += d_fp[i] * (d_rho[i]-rhomax); + if (eflag_global) ev.evdwl += phi; + if (eflag_atom) d_eatom[i] += phi; + } } - d_rho[i] += rhotmp; - - // fp = derivative of embedding energy at each atom - // phi = embedding energy at each atom - // if rho > rhomax (e.g. due to close approach of two atoms), - // will exceed table, so add linear term to conserve energy - - F_FLOAT p = d_rho[i]*rdrho + 1.0; - int m = static_cast (p); - m = MAX(1,MIN(m,nrho-1)); - p -= m; - p = MIN(p,1.0); - const int d_type2frho_i = d_type2frho[itype]; - d_fp[i] = (d_frho_spline(d_type2frho_i,m,0)*p + d_frho_spline(d_type2frho_i,m,1))*p + d_frho_spline(d_type2frho_i,m,2); - if (EFLAG) { - F_FLOAT phi = ((d_frho_spline(d_type2frho_i,m,3)*p + d_frho_spline(d_type2frho_i,m,4))*p + - d_frho_spline(d_type2frho_i,m,5))*p + d_frho_spline(d_type2frho_i,m,6); - if (d_rho[i] > rhomax) phi += d_fp[i] * (d_rho[i]-rhomax); - if (eflag_global) ev.evdwl += phi; - if (eflag_atom) d_eatom[i] += phi; - } - } template @@ -957,8 +960,8 @@ void PairEAMKokkos::operator()(TagPairEAMKernelC MAX_CACHE_ROWS || j_max > MAX_CACHE_COLS) ? 0 : 1; - Kokkos::View MAX_CACHE_ROWS || j_max > t_ffloat_2d_n7::static_extent(2)) ? 0 : 1; + Kokkos::View> A(team_member.team_scratch(0), MAX_CACHE_ROWS); if(d_z2r_spline_cached){ @@ -969,95 +972,96 @@ void PairEAMKokkos::operator()(TagPairEAMKernelC (p); + m = MIN(m,nr-1); + p -= m; + p = MIN(p,1.0); - if (rsq < cutforcesq) { - const F_FLOAT r = sqrt(rsq); - F_FLOAT p = r*rdr + 1.0; - int m = static_cast (p); - m = MIN(m,nr-1); - p -= m; - p = MIN(p,1.0); + // rhoip = derivative of (density at atom j due to atom i) + // rhojp = derivative of (density at atom i due to atom j) + // phi = pair potential energy + // phip = phi' + // z2 = phi * r + // z2p = (phi * r)' = (phi' r) + phi + // psip needs both fp[i] and fp[j] terms since r_ij appears in two + // terms of embed eng: Fi(sum rho_ij) and Fj(sum rho_ji) + // hence embed' = Fi(sum rho_ij) rhojp + Fj(sum rho_ji) rhoip - // rhoip = derivative of (density at atom j due to atom i) - // rhojp = derivative of (density at atom i due to atom j) - // phi = pair potential energy - // phip = phi' - // z2 = phi * r - // z2p = (phi * r)' = (phi' r) + phi - // psip needs both fp[i] and fp[j] terms since r_ij appears in two - // terms of embed eng: Fi(sum rho_ij) and Fj(sum rho_ji) - // hence embed' = Fi(sum rho_ij) rhojp + Fj(sum rho_ji) rhoip - - const int d_type2rhor_ij = d_type2rhor(itype,jtype); - const F_FLOAT rhoip = (d_rhor_spline(d_type2rhor_ij,m,0)*p + d_rhor_spline(d_type2rhor_ij,m,1))*p + + const int d_type2rhor_ij = d_type2rhor(itype,jtype); + const F_FLOAT rhoip = (d_rhor_spline(d_type2rhor_ij,m,0)*p + d_rhor_spline(d_type2rhor_ij,m,1))*p + d_rhor_spline(d_type2rhor_ij,m,2); - const int d_type2rhor_ji = d_type2rhor(jtype,itype); - const F_FLOAT rhojp = (d_rhor_spline(d_type2rhor_ji,m,0)*p + d_rhor_spline(d_type2rhor_ji,m,1))*p + - d_rhor_spline(d_type2rhor_ji,m,2); - const int d_type2z2r_ij = d_type2z2r(itype,jtype); + const int d_type2rhor_ji = d_type2rhor(jtype,itype); + const F_FLOAT rhojp = (d_rhor_spline(d_type2rhor_ji,m,0)*p + d_rhor_spline(d_type2rhor_ji,m,1))*p + + d_rhor_spline(d_type2rhor_ji,m,2); + const int d_type2z2r_ij = d_type2z2r(itype,jtype); - const auto have_cache = (d_z2r_spline_cached == 1) && (0 == d_type2z2r_ij); - const auto z2r_spline_3 = (have_cache) ? A(m,3) : d_z2r_spline(d_type2z2r_ij,m,3); - const auto z2r_spline_4 = (have_cache) ? A(m,4) : d_z2r_spline(d_type2z2r_ij,m,4); - const auto z2r_spline_5 = (have_cache) ? A(m,5) : d_z2r_spline(d_type2z2r_ij,m,5); - const auto z2r_spline_6 = (have_cache) ? A(m,6) : d_z2r_spline(d_type2z2r_ij,m,6); + const auto have_cache = (d_z2r_spline_cached == 1) && (0 == d_type2z2r_ij); + const auto z2r_spline_3 = (have_cache) ? A(m,3) : d_z2r_spline(d_type2z2r_ij,m,3); + const auto z2r_spline_4 = (have_cache) ? A(m,4) : d_z2r_spline(d_type2z2r_ij,m,4); + const auto z2r_spline_5 = (have_cache) ? A(m,5) : d_z2r_spline(d_type2z2r_ij,m,5); + const auto z2r_spline_6 = (have_cache) ? A(m,6) : d_z2r_spline(d_type2z2r_ij,m,6); - const F_FLOAT z2p = (3.0*rdr*z2r_spline_3*p + 2.0*rdr*z2r_spline_4)*p + - rdr*z2r_spline_5; // the rdr and the factors of 3.0 and 2.0 come out of the interpolate function - const F_FLOAT z2 = ((z2r_spline_3*p + z2r_spline_4)*p + - z2r_spline_5)*p + z2r_spline_6; + const F_FLOAT z2p = (3.0*rdr*z2r_spline_3*p + 2.0*rdr*z2r_spline_4)*p + + rdr*z2r_spline_5; // the rdr and the factors of 3.0 and 2.0 come out of the interpolate function + const F_FLOAT z2 = ((z2r_spline_3*p + z2r_spline_4)*p + + z2r_spline_5)*p + z2r_spline_6; - const F_FLOAT recip = 1.0/r; - const F_FLOAT phi = z2*recip; - const F_FLOAT phip = z2p*recip - phi*recip; - const F_FLOAT psip = d_fp[i]*rhojp + d_fp[j]*rhoip + phip; - const F_FLOAT fpair = -psip*recip; + const F_FLOAT recip = 1.0/r; + const F_FLOAT phi = z2*recip; + const F_FLOAT phip = z2p*recip - phi*recip; + const F_FLOAT psip = d_fp[i]*rhojp + d_fp[j]*rhoip + phip; + const F_FLOAT fpair = -psip*recip; - fxtmp += delx*fpair; - fytmp += dely*fpair; - fztmp += delz*fpair; + fxtmp += delx*fpair; + fytmp += dely*fpair; + fztmp += delz*fpair; - if ((NEIGHFLAG==HALF || NEIGHFLAG==HALFTHREAD) && (NEWTON_PAIR || j < nlocal)) { - a_f(j,0) -= delx*fpair; - a_f(j,1) -= dely*fpair; - a_f(j,2) -= delz*fpair; - } - - if (EVFLAG) { - if (eflag) { - ev.evdwl += (((NEIGHFLAG==HALF || NEIGHFLAG==HALFTHREAD)&&(NEWTON_PAIR||(jtemplate ev_tally(ev,i,j,phi,fpair,delx,dely,delz); } - if (vflag_either || eflag_atom) this->template ev_tally(ev,i,j,phi,fpair,delx,dely,delz); } - } - } - a_f(i,0) += fxtmp; - a_f(i,1) += fytmp; - a_f(i,2) += fztmp; + a_f(i,0) += fxtmp; + a_f(i,1) += fytmp; + a_f(i,2) += fztmp; + } } template diff --git a/src/KOKKOS/pair_eam_kokkos.h b/src/KOKKOS/pair_eam_kokkos.h index 21cf188cd6..a42f1efef6 100644 --- a/src/KOKKOS/pair_eam_kokkos.h +++ b/src/KOKKOS/pair_eam_kokkos.h @@ -55,10 +55,14 @@ class PairEAMKokkos : public PairEAM, public KokkosBase { typedef ArrayTypes AT; typedef EV_FLOAT value_type; + template + auto policyInstance(int inum); + PairEAMKokkos(class LAMMPS *); ~PairEAMKokkos() override; void compute(int, int) override; void init_style() override; + KOKKOS_INLINE_FUNCTION void operator()(TagPairEAMPackForwardComm, const int&) const; @@ -138,7 +142,8 @@ class PairEAMKokkos : public PairEAM, public KokkosBase { typename AT::t_virial_array d_vatom; int need_dup; - + int inum; + using KKDeviceType = typename KKDevice::value; template From 1c77ffc28894c94007ea5a47e86ea596420424ae Mon Sep 17 00:00:00 2001 From: Nick Curtis Date: Fri, 3 Feb 2023 14:57:56 -0500 Subject: [PATCH 004/396] catch missing static extents Change-Id: I456282b172053a3566b1ce9a36bc33d377bd801a --- src/KOKKOS/pair_eam_kokkos.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/KOKKOS/pair_eam_kokkos.cpp b/src/KOKKOS/pair_eam_kokkos.cpp index cc3b606b17..5d441df6a9 100644 --- a/src/KOKKOS/pair_eam_kokkos.cpp +++ b/src/KOKKOS/pair_eam_kokkos.cpp @@ -859,8 +859,8 @@ void PairEAMKokkos::operator()(TagPairEAMKernelAB, // rho = density at each atom // loop over neighbors of my atoms const int m_max = d_rhor_spline.extent_int(1); - const int j_max = d_rhor_spline.extent_int(2); - const int d_rhor_spline_cached = (m_max > MAX_CACHE_ROWS || j_max > t_ffloat_2d_n7::static_extent(2)) ? 0 : 1; + const int j_max = t_ffloat_2d_n7::static_extent(2); + const int d_rhor_spline_cached = (m_max > MAX_CACHE_ROWS) ? 0 : 1; Kokkos::View> A(team_member.team_scratch(0), MAX_CACHE_ROWS); @@ -959,8 +959,8 @@ void PairEAMKokkos::operator()(TagPairEAMKernelC>(); const int m_max = d_z2r_spline.extent_int(1); - const int j_max = d_z2r_spline.extent_int(2); - const int d_z2r_spline_cached = (m_max > MAX_CACHE_ROWS || j_max > t_ffloat_2d_n7::static_extent(2)) ? 0 : 1; + const int j_max = t_ffloat_2d_n7::static_extent(2); + const int d_z2r_spline_cached = (m_max > MAX_CACHE_ROWS) ? 0 : 1; Kokkos::View> A(team_member.team_scratch(0), MAX_CACHE_ROWS); From 19bcf6b43cf25062743f2aae15f465c548180de6 Mon Sep 17 00:00:00 2001 From: Nick Curtis Date: Wed, 8 Feb 2023 13:43:47 -0500 Subject: [PATCH 005/396] revert to simple ParReduce policy for reductions Change-Id: Ib3018e85f7bc6c97ce9c0320d0ea43c743addacf --- src/KOKKOS/pair_eam_kokkos.cpp | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/KOKKOS/pair_eam_kokkos.cpp b/src/KOKKOS/pair_eam_kokkos.cpp index 5d441df6a9..0f5bfdec39 100644 --- a/src/KOKKOS/pair_eam_kokkos.cpp +++ b/src/KOKKOS/pair_eam_kokkos.cpp @@ -202,7 +202,7 @@ void PairEAMKokkos::compute(int eflag_in, int vflag_in) if (eflag) Kokkos::parallel_reduce( - policyInstance>(inum), + Kokkos::RangePolicy>(0,inum), *this,ev); else Kokkos::parallel_for( @@ -227,31 +227,31 @@ void PairEAMKokkos::compute(int eflag_in, int vflag_in) if (neighflag == HALF) { if (newton_pair) { Kokkos::parallel_reduce( - policyInstance>(inum), + Kokkos::RangePolicy>(0,inum), *this,ev); } else { Kokkos::parallel_reduce( - policyInstance>(inum), + Kokkos::RangePolicy>(0,inum), *this,ev); } } else if (neighflag == HALFTHREAD) { if (newton_pair) { Kokkos::parallel_reduce( - policyInstance>(inum), + Kokkos::RangePolicy>(0,inum), *this,ev); } else { Kokkos::parallel_reduce( - policyInstance>(inum), + Kokkos::RangePolicy>(0,inum), *this,ev); } } else if (neighflag == FULL) { if (newton_pair) { Kokkos::parallel_reduce( - policyInstance>(inum), + Kokkos::RangePolicy>(0,inum), *this,ev); } else { Kokkos::parallel_reduce( - policyInstance>(inum), + Kokkos::RangePolicy>(0,inum), *this,ev); } } From 23bfc1666cb48a48b32920662784e1fd7daedc16 Mon Sep 17 00:00:00 2001 From: Stan Gerald Moore Date: Fri, 10 Feb 2023 09:24:18 -0700 Subject: [PATCH 006/396] Use range_policy if running on host, small cleanup --- src/KOKKOS/pair_eam_kokkos.cpp | 61 +++++++++++++++++++--------------- src/KOKKOS/pair_eam_kokkos.h | 6 ++-- 2 files changed, 38 insertions(+), 29 deletions(-) diff --git a/src/KOKKOS/pair_eam_kokkos.cpp b/src/KOKKOS/pair_eam_kokkos.cpp index 0f5bfdec39..2317f2d367 100644 --- a/src/KOKKOS/pair_eam_kokkos.cpp +++ b/src/KOKKOS/pair_eam_kokkos.cpp @@ -35,24 +35,6 @@ using namespace LAMMPS_NS; #define MAX_CACHE_ROWS 500 -/* ---------------------------------------------------------------------- */ -template -template -auto PairEAMKokkos::policyInstance(int inum){ - #ifdef KOKKOS_ENABLE_HIP - static_assert(t_ffloat_2d_n7::static_extent(2) == 7, - "Breaking assumption of spline dim for KernelAB and KernelC scratch caching"); - - auto policy = Kokkos::TeamPolicy((inum+1023)/1024, 1024) - .set_scratch_size(0, - Kokkos::PerTeam(MAX_CACHE_ROWS*t_ffloat_2d_n7::static_extent(2)*sizeof(double))); - return policy; - #else - auto policy = Kokkos::RangePolicy(0,inum); - return policy; - #endif -} - /* ---------------------------------------------------------------------- */ template @@ -864,15 +846,15 @@ void PairEAMKokkos::operator()(TagPairEAMKernelAB, Kokkos::View> A(team_member.team_scratch(0), MAX_CACHE_ROWS); - if(d_rhor_spline_cached){ - for(int i = team_member.team_rank(); i < m_max*j_max; i+= team_member.team_size()){ + if (d_rhor_spline_cached) { + for(int i = team_member.team_rank(); i < m_max*j_max; i+= team_member.team_size()) { int j = i%j_max; int m = i/j_max; A(m,j) = d_rhor_spline(0,m,j); } team_member.team_barrier(); } - if (ii < inum){ + if (ii < inum) { const int i = d_ilist[ii]; const X_FLOAT xtmp = x(i,0); const X_FLOAT ytmp = x(i,1); @@ -900,7 +882,7 @@ void PairEAMKokkos::operator()(TagPairEAMKernelAB, p -= m; p = MIN(p,1.0); const int d_type2rhor_ji = d_type2rhor(jtype,itype); - if(d_type2rhor_ji == 0 && d_rhor_spline_cached == 1) { + if (d_type2rhor_ji == 0 && d_rhor_spline_cached == 1) { rhotmp += ((A(m,3)*p + A(m,4))*p + A(m,5))*p + A(m,6); } else @@ -952,9 +934,10 @@ void PairEAMKokkos::operator()(TagPairEAMKernelC::member_type& team_member, EV_FLOAT& ev) const { - // The f array is duplicated for OpenMP, atomic for CUDA, and neither for Serial int ii = team_member.league_rank()*team_member.team_size() + team_member.team_rank(); + // The f array is duplicated for OpenMP, atomic for CUDA, and neither for Serial + auto v_f = ScatterViewHelper,decltype(dup_f),decltype(ndup_f)>::get(dup_f,ndup_f); auto a_f = v_f.template access>(); @@ -964,15 +947,15 @@ void PairEAMKokkos::operator()(TagPairEAMKernelC> A(team_member.team_scratch(0), MAX_CACHE_ROWS); - if(d_z2r_spline_cached){ - for(int i = team_member.team_rank(); i < m_max*j_max; i+= team_member.team_size()){ + if (d_z2r_spline_cached) { + for(int i = team_member.team_rank(); i < m_max*j_max; i+= team_member.team_size()) { int j = i%j_max; int m = i/j_max; A(m,j) = d_z2r_spline(0,m,j); } team_member.team_barrier(); } - if (ii < inum){ + if (ii < inum) { const int i = d_ilist[ii]; const X_FLOAT xtmp = x(i,0); const X_FLOAT ytmp = x(i,1); @@ -1172,6 +1155,32 @@ void PairEAMKokkos::ev_tally(EV_FLOAT &ev, const int &i, const int & } } +/* ---------------------------------------------------------------------- */ + +template +template +auto PairEAMKokkos::policyInstance(int inum) { + #ifdef KOKKOS_ENABLE_HIP + if (execution_space != Host) { + static_assert(t_ffloat_2d_n7::static_extent(2) == 7, + "Breaking assumption of spline dim for KernelAB and KernelC scratch caching"); + + auto policy = Kokkos::TeamPolicy((inum+1023)/1024, 1024) + .set_scratch_size(0, + Kokkos::PerTeam(MAX_CACHE_ROWS*t_ffloat_2d_n7::static_extent(2)*sizeof(double))); + return policy; + } else { + auto policy = Kokkos::RangePolicy(0,inum); + return policy; + } + #else + auto policy = Kokkos::RangePolicy(0,inum); + return policy; + #endif +} + +/* ---------------------------------------------------------------------- */ + namespace LAMMPS_NS { template class PairEAMKokkos; #ifdef LMP_KOKKOS_GPU diff --git a/src/KOKKOS/pair_eam_kokkos.h b/src/KOKKOS/pair_eam_kokkos.h index a42f1efef6..7f4ec67f6f 100644 --- a/src/KOKKOS/pair_eam_kokkos.h +++ b/src/KOKKOS/pair_eam_kokkos.h @@ -55,9 +55,6 @@ class PairEAMKokkos : public PairEAM, public KokkosBase { typedef ArrayTypes AT; typedef EV_FLOAT value_type; - template - auto policyInstance(int inum); - PairEAMKokkos(class LAMMPS *); ~PairEAMKokkos() override; void compute(int, int) override; @@ -183,6 +180,9 @@ class PairEAMKokkos : public PairEAM, public KokkosBase { void file2array() override; void array2spline() override; + template + auto policyInstance(int inum); + typename AT::t_neighbors_2d d_neighbors; typename AT::t_int_1d d_ilist; typename AT::t_int_1d d_numneigh; From d0c6c310d95af99482f5e41e8cffdc2eaa1d758a Mon Sep 17 00:00:00 2001 From: Stan Gerald Moore Date: Fri, 10 Feb 2023 10:50:36 -0700 Subject: [PATCH 007/396] Port changes to other EAM flavors --- src/KOKKOS/pair_eam_alloy_kokkos.cpp | 348 +++++++++++++++++++++++--- src/KOKKOS/pair_eam_alloy_kokkos.h | 28 ++- src/KOKKOS/pair_eam_fs_kokkos.cpp | 349 ++++++++++++++++++++++++--- src/KOKKOS/pair_eam_fs_kokkos.h | 27 ++- src/KOKKOS/pair_eam_kokkos.cpp | 94 ++++---- src/KOKKOS/pair_eam_kokkos.h | 5 +- 6 files changed, 724 insertions(+), 127 deletions(-) diff --git a/src/KOKKOS/pair_eam_alloy_kokkos.cpp b/src/KOKKOS/pair_eam_alloy_kokkos.cpp index e14b78a36f..477220b65e 100644 --- a/src/KOKKOS/pair_eam_alloy_kokkos.cpp +++ b/src/KOKKOS/pair_eam_alloy_kokkos.cpp @@ -32,10 +32,10 @@ #include "potential_file_reader.h" #include -#include - using namespace LAMMPS_NS; +#define MAX_CACHE_ROWS 500 + // Cannot use virtual inheritance on the GPU, so must duplicate code /* ---------------------------------------------------------------------- */ @@ -46,6 +46,7 @@ PairEAMAlloyKokkos::PairEAMAlloyKokkos(LAMMPS *lmp) : PairEAM(lmp) respa_enable = 0; single_enable = 0; one_coeff = 1; + manybody_flag = 1; kokkosable = 1; atomKK = (AtomKokkos *) atom; @@ -59,10 +60,10 @@ PairEAMAlloyKokkos::PairEAMAlloyKokkos(LAMMPS *lmp) : PairEAM(lmp) template PairEAMAlloyKokkos::~PairEAMAlloyKokkos() { - if (!copymode) { - memoryKK->destroy_kokkos(k_eatom,eatom); - memoryKK->destroy_kokkos(k_vatom,vatom); - } + if (copymode) return; + + memoryKK->destroy_kokkos(k_eatom,eatom); + memoryKK->destroy_kokkos(k_vatom,vatom); } /* ---------------------------------------------------------------------- */ @@ -118,7 +119,7 @@ void PairEAMAlloyKokkos::compute(int eflag_in, int vflag_in) d_numneigh = k_list->d_numneigh; d_neighbors = k_list->d_neighbors; d_ilist = k_list->d_ilist; - int inum = list->inum; + inum = list->inum; need_dup = lmp->kokkos->need_dup(); if (need_dup) { @@ -138,9 +139,9 @@ void PairEAMAlloyKokkos::compute(int eflag_in, int vflag_in) // zero out density if (newton_pair) - Kokkos::parallel_for(Kokkos::RangePolicy(0,nall),*this); + Kokkos::parallel_for(Kokkos::RangePolicy(0,nall),*this); else - Kokkos::parallel_for(Kokkos::RangePolicy(0,nlocal),*this); + Kokkos::parallel_for(Kokkos::RangePolicy(0,nlocal),*this); // loop over neighbors of my atoms @@ -152,15 +153,15 @@ void PairEAMAlloyKokkos::compute(int eflag_in, int vflag_in) if (neighflag == HALF) { if (newton_pair) { - Kokkos::parallel_for(Kokkos::RangePolicy >(0,inum),*this); + Kokkos::parallel_for(Kokkos::RangePolicy>(0,inum),*this); } else { - Kokkos::parallel_for(Kokkos::RangePolicy >(0,inum),*this); + Kokkos::parallel_for(Kokkos::RangePolicy>(0,inum),*this); } } else if (neighflag == HALFTHREAD) { if (newton_pair) { - Kokkos::parallel_for(Kokkos::RangePolicy >(0,inum),*this); + Kokkos::parallel_for(Kokkos::RangePolicy>(0,inum),*this); } else { - Kokkos::parallel_for(Kokkos::RangePolicy >(0,inum),*this); + Kokkos::parallel_for(Kokkos::RangePolicy>(0,inum),*this); } } @@ -178,18 +179,22 @@ void PairEAMAlloyKokkos::compute(int eflag_in, int vflag_in) // compute kernel B if (eflag) - Kokkos::parallel_reduce(Kokkos::RangePolicy >(0,inum),*this,ev); + Kokkos::parallel_reduce(Kokkos::RangePolicy>(0,inum),*this,ev); else - Kokkos::parallel_for(Kokkos::RangePolicy >(0,inum),*this); + Kokkos::parallel_for(Kokkos::RangePolicy>(0,inum),*this); } else if (neighflag == FULL) { // compute kernel AB if (eflag) - Kokkos::parallel_reduce(Kokkos::RangePolicy >(0,inum),*this,ev); + Kokkos::parallel_reduce( + Kokkos::RangePolicy>(0,inum), + *this,ev); else - Kokkos::parallel_for(Kokkos::RangePolicy >(0,inum),*this); + Kokkos::parallel_for( + policyInstance>(inum), + *this); } if (eflag) { @@ -208,41 +213,65 @@ void PairEAMAlloyKokkos::compute(int eflag_in, int vflag_in) if (evflag) { if (neighflag == HALF) { if (newton_pair) { - Kokkos::parallel_reduce(Kokkos::RangePolicy >(0,inum),*this,ev); + Kokkos::parallel_reduce( + Kokkos::RangePolicy>(0,inum), + *this,ev); } else { - Kokkos::parallel_reduce(Kokkos::RangePolicy >(0,inum),*this,ev); + Kokkos::parallel_reduce( + Kokkos::RangePolicy>(0,inum), + *this,ev); } } else if (neighflag == HALFTHREAD) { if (newton_pair) { - Kokkos::parallel_reduce(Kokkos::RangePolicy >(0,inum),*this,ev); + Kokkos::parallel_reduce( + Kokkos::RangePolicy>(0,inum), + *this,ev); } else { - Kokkos::parallel_reduce(Kokkos::RangePolicy >(0,inum),*this,ev); + Kokkos::parallel_reduce( + Kokkos::RangePolicy>(0,inum), + *this,ev); } } else if (neighflag == FULL) { if (newton_pair) { - Kokkos::parallel_reduce(Kokkos::RangePolicy >(0,inum),*this,ev); + Kokkos::parallel_reduce( + Kokkos::RangePolicy>(0,inum), + *this,ev); } else { - Kokkos::parallel_reduce(Kokkos::RangePolicy >(0,inum),*this,ev); + Kokkos::parallel_reduce( + Kokkos::RangePolicy>(0,inum), + *this,ev); } } } else { if (neighflag == HALF) { if (newton_pair) { - Kokkos::parallel_for(Kokkos::RangePolicy >(0,inum),*this); + Kokkos::parallel_for( + policyInstance>(inum), + *this); } else { - Kokkos::parallel_for(Kokkos::RangePolicy >(0,inum),*this); + Kokkos::parallel_for( + policyInstance>(inum), + *this); } } else if (neighflag == HALFTHREAD) { if (newton_pair) { - Kokkos::parallel_for(Kokkos::RangePolicy >(0,inum),*this); + Kokkos::parallel_for( + policyInstance>(inum), + *this); } else { - Kokkos::parallel_for(Kokkos::RangePolicy >(0,inum),*this); + Kokkos::parallel_for( + policyInstance>(inum), + *this); } } else if (neighflag == FULL) { if (newton_pair) { - Kokkos::parallel_for(Kokkos::RangePolicy >(0,inum),*this); + Kokkos::parallel_for( + policyInstance>(inum), + *this); } else { - Kokkos::parallel_for(Kokkos::RangePolicy >(0,inum),*this); + Kokkos::parallel_for( + policyInstance>(inum), + *this); } } } @@ -427,7 +456,7 @@ int PairEAMAlloyKokkos::pack_forward_comm_kokkos(int n, DAT::tdual_i d_sendlist = k_sendlist.view(); iswap = iswap_in; v_buf = buf.view(); - Kokkos::parallel_for(Kokkos::RangePolicy(0,n),*this); + Kokkos::parallel_for(Kokkos::RangePolicy(0,n),*this); return n; } @@ -445,7 +474,7 @@ void PairEAMAlloyKokkos::unpack_forward_comm_kokkos(int n, int first { first = first_in; v_buf = buf.view(); - Kokkos::parallel_for(Kokkos::RangePolicy(0,n),*this); + Kokkos::parallel_for(Kokkos::RangePolicy(0,n),*this); } template @@ -588,6 +617,7 @@ template template KOKKOS_INLINE_FUNCTION void PairEAMAlloyKokkos::operator()(TagPairEAMAlloyKernelB, const int &ii, EV_FLOAT& ev) const { + // fp = derivative of embedding energy at each atom // phi = embedding energy at each atom // if rho > rhomax (e.g. due to close approach of two atoms), @@ -625,7 +655,7 @@ void PairEAMAlloyKokkos::operator()(TagPairEAMAlloyKernelB, c ////Specialisation for Neighborlist types Half, HalfThread, Full template template -KOKKOS_INLINE_FUNCTION + void PairEAMAlloyKokkos::operator()(TagPairEAMAlloyKernelAB, const int &ii, EV_FLOAT& ev) const { // rho = density at each atom @@ -644,6 +674,7 @@ void PairEAMAlloyKokkos::operator()(TagPairEAMAlloyKernelAB, for (int jj = 0; jj < jnum; jj++) { int j = d_neighbors(i,jj); j &= NEIGHMASK; + const X_FLOAT delx = xtmp - x(j,0); const X_FLOAT dely = ytmp - x(j,1); const X_FLOAT delz = ztmp - x(j,2); @@ -806,6 +837,235 @@ void PairEAMAlloyKokkos::operator()(TagPairEAMAlloyKernelC +template +KOKKOS_INLINE_FUNCTION +void PairEAMAlloyKokkos::operator()(TagPairEAMAlloyKernelAB, + const typename Kokkos::TeamPolicy::member_type& team_member, + EV_FLOAT& ev) const { + int ii = team_member.league_rank()*team_member.team_size() + team_member.team_rank(); + // rho = density at each atom + // loop over neighbors of my atoms + const int m_max = d_rhor_spline.extent_int(1); + const int j_max = t_ffloat_2d_n7::static_extent(2); + const int d_rhor_spline_cached = (m_max > MAX_CACHE_ROWS) ? 0 : 1; + Kokkos::View> A(team_member.team_scratch(0), MAX_CACHE_ROWS); + + if (d_rhor_spline_cached) { + for(int i = team_member.team_rank(); i < m_max*j_max; i+= team_member.team_size()) { + int j = i%j_max; + int m = i/j_max; + A(m,j) = d_rhor_spline(0,m,j); + } + team_member.team_barrier(); + } + if (ii < inum) { + const int i = d_ilist[ii]; + const X_FLOAT xtmp = x(i,0); + const X_FLOAT ytmp = x(i,1); + const X_FLOAT ztmp = x(i,2); + const int itype = type(i); + + const int jnum = d_numneigh[i]; + + F_FLOAT rhotmp = 0.0; + + for (int jj = 0; jj < jnum; jj++) { + int j = d_neighbors(i,jj); + j &= NEIGHMASK; + + const X_FLOAT delx = xtmp - x(j,0); + const X_FLOAT dely = ytmp - x(j,1); + const X_FLOAT delz = ztmp - x(j,2); + const int jtype = type(j); + const F_FLOAT rsq = delx*delx + dely*dely + delz*delz; + + if (rsq < cutforcesq) { + F_FLOAT p = sqrt(rsq)*rdr + 1.0; + int m = static_cast (p); + m = MIN(m,nr-1); + p -= m; + p = MIN(p,1.0); + const int d_type2rhor_ji = d_type2rhor(jtype,itype); + if (d_type2rhor_ji == 0 && d_rhor_spline_cached == 1) { + rhotmp += ((A(m,3)*p + A(m,4))*p + + A(m,5))*p + A(m,6); + } else + rhotmp += ((d_rhor_spline(d_type2rhor_ji,m,3)*p + d_rhor_spline(d_type2rhor_ji,m,4))*p + + d_rhor_spline(d_type2rhor_ji,m,5))*p + d_rhor_spline(d_type2rhor_ji,m,6); + } + + } + d_rho[i] += rhotmp; + + // fp = derivative of embedding energy at each atom + // phi = embedding energy at each atom + // if rho > rhomax (e.g. due to close approach of two atoms), + // will exceed table, so add linear term to conserve energy + + F_FLOAT p = d_rho[i]*rdrho + 1.0; + int m = static_cast (p); + m = MAX(1,MIN(m,nrho-1)); + p -= m; + p = MIN(p,1.0); + const int d_type2frho_i = d_type2frho[itype]; + d_fp[i] = (d_frho_spline(d_type2frho_i,m,0)*p + d_frho_spline(d_type2frho_i,m,1))*p + d_frho_spline(d_type2frho_i,m,2); + if (EFLAG) { + F_FLOAT phi = ((d_frho_spline(d_type2frho_i,m,3)*p + d_frho_spline(d_type2frho_i,m,4))*p + + d_frho_spline(d_type2frho_i,m,5))*p + d_frho_spline(d_type2frho_i,m,6); + if (d_rho[i] > rhomax) phi += d_fp[i] * (d_rho[i]-rhomax); + if (eflag_global) ev.evdwl += phi; + if (eflag_atom) d_eatom[i] += phi; + } + } +} + +template +template +KOKKOS_INLINE_FUNCTION +void PairEAMAlloyKokkos::operator()(TagPairEAMAlloyKernelAB, + const typename Kokkos::TeamPolicy::member_type& team_member) const { + EV_FLOAT ev; + this->template operator()(TagPairEAMAlloyKernelAB(), team_member, ev); +} + +/* ---------------------------------------------------------------------- */ + +////Specialisation for Neighborlist types Half, HalfThread, Full +template +template +KOKKOS_INLINE_FUNCTION +void PairEAMAlloyKokkos::operator()(TagPairEAMAlloyKernelC, + const typename Kokkos::TeamPolicy::member_type& team_member, + EV_FLOAT& ev) const { + + int ii = team_member.league_rank()*team_member.team_size() + team_member.team_rank(); + + // The f array is duplicated for OpenMP, atomic for CUDA, and neither for Serial + + auto v_f = ScatterViewHelper,decltype(dup_f),decltype(ndup_f)>::get(dup_f,ndup_f); + auto a_f = v_f.template access>(); + + const int m_max = d_z2r_spline.extent_int(1); + const int j_max = t_ffloat_2d_n7::static_extent(2); + const int d_z2r_spline_cached = (m_max > MAX_CACHE_ROWS) ? 0 : 1; + Kokkos::View> A(team_member.team_scratch(0), MAX_CACHE_ROWS); + + if (d_z2r_spline_cached) { + for(int i = team_member.team_rank(); i < m_max*j_max; i+= team_member.team_size()) { + int j = i%j_max; + int m = i/j_max; + A(m,j) = d_z2r_spline(0,m,j); + } + team_member.team_barrier(); + } + if (ii < inum) { + const int i = d_ilist[ii]; + const X_FLOAT xtmp = x(i,0); + const X_FLOAT ytmp = x(i,1); + const X_FLOAT ztmp = x(i,2); + const int itype = type(i); + + const int jnum = d_numneigh[i]; + + F_FLOAT fxtmp = 0.0; + F_FLOAT fytmp = 0.0; + F_FLOAT fztmp = 0.0; + + for (int jj = 0; jj < jnum; jj++) { + int j = d_neighbors(i,jj); + j &= NEIGHMASK; + const X_FLOAT delx = xtmp - x(j,0); + const X_FLOAT dely = ytmp - x(j,1); + const X_FLOAT delz = ztmp - x(j,2); + const int jtype = type(j); + const F_FLOAT rsq = delx*delx + dely*dely + delz*delz; + + if (rsq < cutforcesq) { + const F_FLOAT r = sqrt(rsq); + F_FLOAT p = r*rdr + 1.0; + int m = static_cast (p); + m = MIN(m,nr-1); + p -= m; + p = MIN(p,1.0); + + // rhoip = derivative of (density at atom j due to atom i) + // rhojp = derivative of (density at atom i due to atom j) + // phi = pair potential energy + // phip = phi' + // z2 = phi * r + // z2p = (phi * r)' = (phi' r) + phi + // psip needs both fp[i] and fp[j] terms since r_ij appears in two + // terms of embed eng: Fi(sum rho_ij) and Fj(sum rho_ji) + // hence embed' = Fi(sum rho_ij) rhojp + Fj(sum rho_ji) rhoip + + const int d_type2rhor_ij = d_type2rhor(itype,jtype); + const F_FLOAT rhoip = (d_rhor_spline(d_type2rhor_ij,m,0)*p + d_rhor_spline(d_type2rhor_ij,m,1))*p + + d_rhor_spline(d_type2rhor_ij,m,2); + const int d_type2rhor_ji = d_type2rhor(jtype,itype); + const F_FLOAT rhojp = (d_rhor_spline(d_type2rhor_ji,m,0)*p + d_rhor_spline(d_type2rhor_ji,m,1))*p + + d_rhor_spline(d_type2rhor_ji,m,2); + const int d_type2z2r_ij = d_type2z2r(itype,jtype); + + const auto have_cache = (d_z2r_spline_cached == 1) && (0 == d_type2z2r_ij); + const auto z2r_spline_3 = (have_cache) ? A(m,3) : d_z2r_spline(d_type2z2r_ij,m,3); + const auto z2r_spline_4 = (have_cache) ? A(m,4) : d_z2r_spline(d_type2z2r_ij,m,4); + const auto z2r_spline_5 = (have_cache) ? A(m,5) : d_z2r_spline(d_type2z2r_ij,m,5); + const auto z2r_spline_6 = (have_cache) ? A(m,6) : d_z2r_spline(d_type2z2r_ij,m,6); + + const F_FLOAT z2p = (3.0*rdr*z2r_spline_3*p + 2.0*rdr*z2r_spline_4)*p + + rdr*z2r_spline_5; // the rdr and the factors of 3.0 and 2.0 come out of the interpolate function + const F_FLOAT z2 = ((z2r_spline_3*p + z2r_spline_4)*p + + z2r_spline_5)*p + z2r_spline_6; + + const F_FLOAT recip = 1.0/r; + const F_FLOAT phi = z2*recip; + const F_FLOAT phip = z2p*recip - phi*recip; + const F_FLOAT psip = d_fp[i]*rhojp + d_fp[j]*rhoip + phip; + const F_FLOAT fpair = -psip*recip; + + fxtmp += delx*fpair; + fytmp += dely*fpair; + fztmp += delz*fpair; + + if ((NEIGHFLAG==HALF || NEIGHFLAG==HALFTHREAD) && (NEWTON_PAIR || j < nlocal)) { + a_f(j,0) -= delx*fpair; + a_f(j,1) -= dely*fpair; + a_f(j,2) -= delz*fpair; + } + + if (EVFLAG) { + if (eflag) { + ev.evdwl += (((NEIGHFLAG==HALF || NEIGHFLAG==HALFTHREAD)&&(NEWTON_PAIR||(jtemplate ev_tally(ev,i,j,phi,fpair,delx,dely,delz); + } + + } + } + + a_f(i,0) += fxtmp; + a_f(i,1) += fytmp; + a_f(i,2) += fztmp; + } +} + +template +template +KOKKOS_INLINE_FUNCTION +void PairEAMAlloyKokkos::operator()(TagPairEAMAlloyKernelC, + /*const int &ii*/ + const typename Kokkos::TeamPolicy::member_type& team_member) const { + EV_FLOAT ev; + this->template operator()(TagPairEAMAlloyKernelC(), team_member, ev); +} + +/* ---------------------------------------------------------------------- */ + template template KOKKOS_INLINE_FUNCTION @@ -1219,6 +1479,30 @@ void PairEAMAlloyKokkos::file2array_alloy() /* ---------------------------------------------------------------------- */ +template +template +auto PairEAMAlloyKokkos::policyInstance(int inum) { + #ifdef KOKKOS_ENABLE_HIP + if (execution_space != Host) { + static_assert(t_ffloat_2d_n7::static_extent(2) == 7, + "Breaking assumption of spline dim for KernelAB and KernelC scratch caching"); + + auto policy = Kokkos::TeamPolicy((inum+1023)/1024, 1024) + .set_scratch_size(0, + Kokkos::PerTeam(MAX_CACHE_ROWS*t_ffloat_2d_n7::static_extent(2)*sizeof(double))); + return policy; + } else { + auto policy = Kokkos::RangePolicy(0,inum); + return policy; + } + #else + auto policy = Kokkos::RangePolicy(0,inum); + return policy; + #endif +} + +/* ---------------------------------------------------------------------- */ + namespace LAMMPS_NS { template class PairEAMAlloyKokkos; #ifdef LMP_KOKKOS_GPU diff --git a/src/KOKKOS/pair_eam_alloy_kokkos.h b/src/KOKKOS/pair_eam_alloy_kokkos.h index c6cb73ca5d..f9703ef473 100644 --- a/src/KOKKOS/pair_eam_alloy_kokkos.h +++ b/src/KOKKOS/pair_eam_alloy_kokkos.h @@ -61,7 +61,6 @@ class PairEAMAlloyKokkos : public PairEAM, public KokkosBase { ~PairEAMAlloyKokkos() override; void compute(int, int) override; void init_style() override; - void *extract(const char *, int &) override { return nullptr; } void coeff(int, char **) override; KOKKOS_INLINE_FUNCTION @@ -93,6 +92,14 @@ class PairEAMAlloyKokkos : public PairEAM, public KokkosBase { KOKKOS_INLINE_FUNCTION void operator()(TagPairEAMAlloyKernelAB, const int&) const; + template + KOKKOS_INLINE_FUNCTION + void operator()(TagPairEAMAlloyKernelAB, const typename Kokkos::TeamPolicy::member_type&, EV_FLOAT&) const; + + template + KOKKOS_INLINE_FUNCTION + void operator()(TagPairEAMAlloyKernelAB, const typename Kokkos::TeamPolicy::member_type&) const; + template KOKKOS_INLINE_FUNCTION void operator()(TagPairEAMAlloyKernelC, const int&, EV_FLOAT&) const; @@ -101,6 +108,14 @@ class PairEAMAlloyKokkos : public PairEAM, public KokkosBase { KOKKOS_INLINE_FUNCTION void operator()(TagPairEAMAlloyKernelC, const int&) const; + template + KOKKOS_INLINE_FUNCTION + void operator()(TagPairEAMAlloyKernelC, const typename Kokkos::TeamPolicy::member_type&, EV_FLOAT&) const; + + template + KOKKOS_INLINE_FUNCTION + void operator()(TagPairEAMAlloyKernelC, const typename Kokkos::TeamPolicy::member_type&) const; + template KOKKOS_INLINE_FUNCTION void ev_tally(EV_FLOAT &ev, const int &i, const int &j, @@ -125,7 +140,7 @@ class PairEAMAlloyKokkos : public PairEAM, public KokkosBase { typename AT::t_efloat_1d d_eatom; typename AT::t_virial_array d_vatom; - int need_dup; + int need_dup,inum; using KKDeviceType = typename KKDevice::value; @@ -139,7 +154,6 @@ class PairEAMAlloyKokkos : public PairEAM, public KokkosBase { DupScatterView dup_f; DupScatterView dup_eatom; DupScatterView dup_vatom; - NonDupScatterView ndup_rho; NonDupScatterView ndup_f; NonDupScatterView ndup_eatom; @@ -163,17 +177,18 @@ class PairEAMAlloyKokkos : public PairEAM, public KokkosBase { t_ffloat_2d_n7 d_frho_spline; t_ffloat_2d_n7 d_rhor_spline; t_ffloat_2d_n7 d_z2r_spline; - + void interpolate(int, double, double *, t_host_ffloat_2d_n7, int); void file2array() override; void file2array_alloy(); void array2spline() override; - void interpolate(int, double, double *, t_host_ffloat_2d_n7, int); void read_file(char *) override; + template + auto policyInstance(int inum); + typename AT::t_neighbors_2d d_neighbors; typename AT::t_int_1d d_ilist; typename AT::t_int_1d d_numneigh; - //NeighListKokkos k_list; int iswap; int first; @@ -187,7 +202,6 @@ class PairEAMAlloyKokkos : public PairEAM, public KokkosBase { }; } - #endif #endif diff --git a/src/KOKKOS/pair_eam_fs_kokkos.cpp b/src/KOKKOS/pair_eam_fs_kokkos.cpp index 811b80e3a0..4a1258f18c 100644 --- a/src/KOKKOS/pair_eam_fs_kokkos.cpp +++ b/src/KOKKOS/pair_eam_fs_kokkos.cpp @@ -32,10 +32,10 @@ #include "potential_file_reader.h" #include -#include - using namespace LAMMPS_NS; +#define MAX_CACHE_ROWS 500 + // Cannot use virtual inheritance on the GPU, so must duplicate code /* ---------------------------------------------------------------------- */ @@ -46,6 +46,7 @@ PairEAMFSKokkos::PairEAMFSKokkos(LAMMPS *lmp) : PairEAM(lmp) respa_enable = 0; single_enable = 0; one_coeff = 1; + manybody_flag = 1; kokkosable = 1; atomKK = (AtomKokkos *) atom; @@ -59,10 +60,10 @@ PairEAMFSKokkos::PairEAMFSKokkos(LAMMPS *lmp) : PairEAM(lmp) template PairEAMFSKokkos::~PairEAMFSKokkos() { - if (!copymode) { - memoryKK->destroy_kokkos(k_eatom,eatom); - memoryKK->destroy_kokkos(k_vatom,vatom); - } + if (copymode) return; + + memoryKK->destroy_kokkos(k_eatom,eatom); + memoryKK->destroy_kokkos(k_vatom,vatom); } /* ---------------------------------------------------------------------- */ @@ -118,7 +119,7 @@ void PairEAMFSKokkos::compute(int eflag_in, int vflag_in) d_numneigh = k_list->d_numneigh; d_neighbors = k_list->d_neighbors; d_ilist = k_list->d_ilist; - int inum = list->inum; + inum = list->inum; need_dup = lmp->kokkos->need_dup(); if (need_dup) { @@ -138,9 +139,9 @@ void PairEAMFSKokkos::compute(int eflag_in, int vflag_in) // zero out density if (newton_pair) - Kokkos::parallel_for(Kokkos::RangePolicy(0,nall),*this); + Kokkos::parallel_for(Kokkos::RangePolicy(0,nall),*this); else - Kokkos::parallel_for(Kokkos::RangePolicy(0,nlocal),*this); + Kokkos::parallel_for(Kokkos::RangePolicy(0,nlocal),*this); // loop over neighbors of my atoms @@ -152,15 +153,15 @@ void PairEAMFSKokkos::compute(int eflag_in, int vflag_in) if (neighflag == HALF) { if (newton_pair) { - Kokkos::parallel_for(Kokkos::RangePolicy >(0,inum),*this); + Kokkos::parallel_for(Kokkos::RangePolicy>(0,inum),*this); } else { - Kokkos::parallel_for(Kokkos::RangePolicy >(0,inum),*this); + Kokkos::parallel_for(Kokkos::RangePolicy>(0,inum),*this); } } else if (neighflag == HALFTHREAD) { if (newton_pair) { - Kokkos::parallel_for(Kokkos::RangePolicy >(0,inum),*this); + Kokkos::parallel_for(Kokkos::RangePolicy>(0,inum),*this); } else { - Kokkos::parallel_for(Kokkos::RangePolicy >(0,inum),*this); + Kokkos::parallel_for(Kokkos::RangePolicy>(0,inum),*this); } } @@ -178,18 +179,22 @@ void PairEAMFSKokkos::compute(int eflag_in, int vflag_in) // compute kernel B if (eflag) - Kokkos::parallel_reduce(Kokkos::RangePolicy >(0,inum),*this,ev); + Kokkos::parallel_reduce(Kokkos::RangePolicy>(0,inum),*this,ev); else - Kokkos::parallel_for(Kokkos::RangePolicy >(0,inum),*this); + Kokkos::parallel_for(Kokkos::RangePolicy>(0,inum),*this); } else if (neighflag == FULL) { // compute kernel AB if (eflag) - Kokkos::parallel_reduce(Kokkos::RangePolicy >(0,inum),*this,ev); + Kokkos::parallel_reduce( + Kokkos::RangePolicy>(0,inum), + *this,ev); else - Kokkos::parallel_for(Kokkos::RangePolicy >(0,inum),*this); + Kokkos::parallel_for( + policyInstance>(inum), + *this); } if (eflag) { @@ -197,7 +202,7 @@ void PairEAMFSKokkos::compute(int eflag_in, int vflag_in) ev.evdwl = 0.0; } - // communicate derivative of embedding function (on the device) + // communicate derivative of embedding function k_fp.template modify(); comm->forward_comm(this); @@ -208,41 +213,65 @@ void PairEAMFSKokkos::compute(int eflag_in, int vflag_in) if (evflag) { if (neighflag == HALF) { if (newton_pair) { - Kokkos::parallel_reduce(Kokkos::RangePolicy >(0,inum),*this,ev); + Kokkos::parallel_reduce( + Kokkos::RangePolicy>(0,inum), + *this,ev); } else { - Kokkos::parallel_reduce(Kokkos::RangePolicy >(0,inum),*this,ev); + Kokkos::parallel_reduce( + Kokkos::RangePolicy>(0,inum), + *this,ev); } } else if (neighflag == HALFTHREAD) { if (newton_pair) { - Kokkos::parallel_reduce(Kokkos::RangePolicy >(0,inum),*this,ev); + Kokkos::parallel_reduce( + Kokkos::RangePolicy>(0,inum), + *this,ev); } else { - Kokkos::parallel_reduce(Kokkos::RangePolicy >(0,inum),*this,ev); + Kokkos::parallel_reduce( + Kokkos::RangePolicy>(0,inum), + *this,ev); } } else if (neighflag == FULL) { if (newton_pair) { - Kokkos::parallel_reduce(Kokkos::RangePolicy >(0,inum),*this,ev); + Kokkos::parallel_reduce( + Kokkos::RangePolicy>(0,inum), + *this,ev); } else { - Kokkos::parallel_reduce(Kokkos::RangePolicy >(0,inum),*this,ev); + Kokkos::parallel_reduce( + Kokkos::RangePolicy>(0,inum), + *this,ev); } } } else { if (neighflag == HALF) { if (newton_pair) { - Kokkos::parallel_for(Kokkos::RangePolicy >(0,inum),*this); + Kokkos::parallel_for( + policyInstance>(inum), + *this); } else { - Kokkos::parallel_for(Kokkos::RangePolicy >(0,inum),*this); + Kokkos::parallel_for( + policyInstance>(inum), + *this); } } else if (neighflag == HALFTHREAD) { if (newton_pair) { - Kokkos::parallel_for(Kokkos::RangePolicy >(0,inum),*this); + Kokkos::parallel_for( + policyInstance>(inum), + *this); } else { - Kokkos::parallel_for(Kokkos::RangePolicy >(0,inum),*this); + Kokkos::parallel_for( + policyInstance>(inum), + *this); } } else if (neighflag == FULL) { if (newton_pair) { - Kokkos::parallel_for(Kokkos::RangePolicy >(0,inum),*this); + Kokkos::parallel_for( + policyInstance>(inum), + *this); } else { - Kokkos::parallel_for(Kokkos::RangePolicy >(0,inum),*this); + Kokkos::parallel_for( + policyInstance>(inum), + *this); } } } @@ -427,7 +456,7 @@ int PairEAMFSKokkos::pack_forward_comm_kokkos(int n, DAT::tdual_int_ d_sendlist = k_sendlist.view(); iswap = iswap_in; v_buf = buf.view(); - Kokkos::parallel_for(Kokkos::RangePolicy(0,n),*this); + Kokkos::parallel_for(Kokkos::RangePolicy(0,n),*this); return n; } @@ -445,7 +474,7 @@ void PairEAMFSKokkos::unpack_forward_comm_kokkos(int n, int first_in { first = first_in; v_buf = buf.view(); - Kokkos::parallel_for(Kokkos::RangePolicy(0,n),*this); + Kokkos::parallel_for(Kokkos::RangePolicy(0,n),*this); } template @@ -645,6 +674,7 @@ void PairEAMFSKokkos::operator()(TagPairEAMFSKernelAB, const for (int jj = 0; jj < jnum; jj++) { int j = d_neighbors(i,jj); j &= NEIGHMASK; + const X_FLOAT delx = xtmp - x(j,0); const X_FLOAT dely = ytmp - x(j,1); const X_FLOAT delz = ztmp - x(j,2); @@ -691,7 +721,7 @@ template template KOKKOS_INLINE_FUNCTION void PairEAMFSKokkos::operator()(TagPairEAMFSKernelAB, const int &ii) const { - EV_FLOAT ev; + EV_FLOAT ev; this->template operator()(TagPairEAMFSKernelAB(), ii, ev); this->template operator()(TagPairEAMFSKernelAB(), ii, ev); } @@ -807,6 +837,235 @@ void PairEAMFSKokkos::operator()(TagPairEAMFSKernelC +template +KOKKOS_INLINE_FUNCTION +void PairEAMFSKokkos::operator()(TagPairEAMFSKernelAB, + const typename Kokkos::TeamPolicy::member_type& team_member, + EV_FLOAT& ev) const { + int ii = team_member.league_rank()*team_member.team_size() + team_member.team_rank(); + // rho = density at each atom + // loop over neighbors of my atoms + const int m_max = d_rhor_spline.extent_int(1); + const int j_max = t_ffloat_2d_n7::static_extent(2); + const int d_rhor_spline_cached = (m_max > MAX_CACHE_ROWS) ? 0 : 1; + Kokkos::View> A(team_member.team_scratch(0), MAX_CACHE_ROWS); + + if (d_rhor_spline_cached) { + for(int i = team_member.team_rank(); i < m_max*j_max; i+= team_member.team_size()) { + int j = i%j_max; + int m = i/j_max; + A(m,j) = d_rhor_spline(0,m,j); + } + team_member.team_barrier(); + } + if (ii < inum) { + const int i = d_ilist[ii]; + const X_FLOAT xtmp = x(i,0); + const X_FLOAT ytmp = x(i,1); + const X_FLOAT ztmp = x(i,2); + const int itype = type(i); + + const int jnum = d_numneigh[i]; + + F_FLOAT rhotmp = 0.0; + + for (int jj = 0; jj < jnum; jj++) { + int j = d_neighbors(i,jj); + j &= NEIGHMASK; + + const X_FLOAT delx = xtmp - x(j,0); + const X_FLOAT dely = ytmp - x(j,1); + const X_FLOAT delz = ztmp - x(j,2); + const int jtype = type(j); + const F_FLOAT rsq = delx*delx + dely*dely + delz*delz; + + if (rsq < cutforcesq) { + F_FLOAT p = sqrt(rsq)*rdr + 1.0; + int m = static_cast (p); + m = MIN(m,nr-1); + p -= m; + p = MIN(p,1.0); + const int d_type2rhor_ji = d_type2rhor(jtype,itype); + if (d_type2rhor_ji == 0 && d_rhor_spline_cached == 1) { + rhotmp += ((A(m,3)*p + A(m,4))*p + + A(m,5))*p + A(m,6); + } else + rhotmp += ((d_rhor_spline(d_type2rhor_ji,m,3)*p + d_rhor_spline(d_type2rhor_ji,m,4))*p + + d_rhor_spline(d_type2rhor_ji,m,5))*p + d_rhor_spline(d_type2rhor_ji,m,6); + } + + } + d_rho[i] += rhotmp; + + // fp = derivative of embedding energy at each atom + // phi = embedding energy at each atom + // if rho > rhomax (e.g. due to close approach of two atoms), + // will exceed table, so add linear term to conserve energy + + F_FLOAT p = d_rho[i]*rdrho + 1.0; + int m = static_cast (p); + m = MAX(1,MIN(m,nrho-1)); + p -= m; + p = MIN(p,1.0); + const int d_type2frho_i = d_type2frho[itype]; + d_fp[i] = (d_frho_spline(d_type2frho_i,m,0)*p + d_frho_spline(d_type2frho_i,m,1))*p + d_frho_spline(d_type2frho_i,m,2); + if (EFLAG) { + F_FLOAT phi = ((d_frho_spline(d_type2frho_i,m,3)*p + d_frho_spline(d_type2frho_i,m,4))*p + + d_frho_spline(d_type2frho_i,m,5))*p + d_frho_spline(d_type2frho_i,m,6); + if (d_rho[i] > rhomax) phi += d_fp[i] * (d_rho[i]-rhomax); + if (eflag_global) ev.evdwl += phi; + if (eflag_atom) d_eatom[i] += phi; + } + } +} + +template +template +KOKKOS_INLINE_FUNCTION +void PairEAMFSKokkos::operator()(TagPairEAMFSKernelAB, + const typename Kokkos::TeamPolicy::member_type& team_member) const { + EV_FLOAT ev; + this->template operator()(TagPairEAMFSKernelAB(), team_member, ev); +} + +/* ---------------------------------------------------------------------- */ + +////Specialisation for Neighborlist types Half, HalfThread, Full +template +template +KOKKOS_INLINE_FUNCTION +void PairEAMFSKokkos::operator()(TagPairEAMFSKernelC, + const typename Kokkos::TeamPolicy::member_type& team_member, + EV_FLOAT& ev) const { + + int ii = team_member.league_rank()*team_member.team_size() + team_member.team_rank(); + + // The f array is duplicated for OpenMP, atomic for CUDA, and neither for Serial + + auto v_f = ScatterViewHelper,decltype(dup_f),decltype(ndup_f)>::get(dup_f,ndup_f); + auto a_f = v_f.template access>(); + + const int m_max = d_z2r_spline.extent_int(1); + const int j_max = t_ffloat_2d_n7::static_extent(2); + const int d_z2r_spline_cached = (m_max > MAX_CACHE_ROWS) ? 0 : 1; + Kokkos::View> A(team_member.team_scratch(0), MAX_CACHE_ROWS); + + if (d_z2r_spline_cached) { + for(int i = team_member.team_rank(); i < m_max*j_max; i+= team_member.team_size()) { + int j = i%j_max; + int m = i/j_max; + A(m,j) = d_z2r_spline(0,m,j); + } + team_member.team_barrier(); + } + if (ii < inum) { + const int i = d_ilist[ii]; + const X_FLOAT xtmp = x(i,0); + const X_FLOAT ytmp = x(i,1); + const X_FLOAT ztmp = x(i,2); + const int itype = type(i); + + const int jnum = d_numneigh[i]; + + F_FLOAT fxtmp = 0.0; + F_FLOAT fytmp = 0.0; + F_FLOAT fztmp = 0.0; + + for (int jj = 0; jj < jnum; jj++) { + int j = d_neighbors(i,jj); + j &= NEIGHMASK; + const X_FLOAT delx = xtmp - x(j,0); + const X_FLOAT dely = ytmp - x(j,1); + const X_FLOAT delz = ztmp - x(j,2); + const int jtype = type(j); + const F_FLOAT rsq = delx*delx + dely*dely + delz*delz; + + if (rsq < cutforcesq) { + const F_FLOAT r = sqrt(rsq); + F_FLOAT p = r*rdr + 1.0; + int m = static_cast (p); + m = MIN(m,nr-1); + p -= m; + p = MIN(p,1.0); + + // rhoip = derivative of (density at atom j due to atom i) + // rhojp = derivative of (density at atom i due to atom j) + // phi = pair potential energy + // phip = phi' + // z2 = phi * r + // z2p = (phi * r)' = (phi' r) + phi + // psip needs both fp[i] and fp[j] terms since r_ij appears in two + // terms of embed eng: Fi(sum rho_ij) and Fj(sum rho_ji) + // hence embed' = Fi(sum rho_ij) rhojp + Fj(sum rho_ji) rhoip + + const int d_type2rhor_ij = d_type2rhor(itype,jtype); + const F_FLOAT rhoip = (d_rhor_spline(d_type2rhor_ij,m,0)*p + d_rhor_spline(d_type2rhor_ij,m,1))*p + + d_rhor_spline(d_type2rhor_ij,m,2); + const int d_type2rhor_ji = d_type2rhor(jtype,itype); + const F_FLOAT rhojp = (d_rhor_spline(d_type2rhor_ji,m,0)*p + d_rhor_spline(d_type2rhor_ji,m,1))*p + + d_rhor_spline(d_type2rhor_ji,m,2); + const int d_type2z2r_ij = d_type2z2r(itype,jtype); + + const auto have_cache = (d_z2r_spline_cached == 1) && (0 == d_type2z2r_ij); + const auto z2r_spline_3 = (have_cache) ? A(m,3) : d_z2r_spline(d_type2z2r_ij,m,3); + const auto z2r_spline_4 = (have_cache) ? A(m,4) : d_z2r_spline(d_type2z2r_ij,m,4); + const auto z2r_spline_5 = (have_cache) ? A(m,5) : d_z2r_spline(d_type2z2r_ij,m,5); + const auto z2r_spline_6 = (have_cache) ? A(m,6) : d_z2r_spline(d_type2z2r_ij,m,6); + + const F_FLOAT z2p = (3.0*rdr*z2r_spline_3*p + 2.0*rdr*z2r_spline_4)*p + + rdr*z2r_spline_5; // the rdr and the factors of 3.0 and 2.0 come out of the interpolate function + const F_FLOAT z2 = ((z2r_spline_3*p + z2r_spline_4)*p + + z2r_spline_5)*p + z2r_spline_6; + + const F_FLOAT recip = 1.0/r; + const F_FLOAT phi = z2*recip; + const F_FLOAT phip = z2p*recip - phi*recip; + const F_FLOAT psip = d_fp[i]*rhojp + d_fp[j]*rhoip + phip; + const F_FLOAT fpair = -psip*recip; + + fxtmp += delx*fpair; + fytmp += dely*fpair; + fztmp += delz*fpair; + + if ((NEIGHFLAG==HALF || NEIGHFLAG==HALFTHREAD) && (NEWTON_PAIR || j < nlocal)) { + a_f(j,0) -= delx*fpair; + a_f(j,1) -= dely*fpair; + a_f(j,2) -= delz*fpair; + } + + if (EVFLAG) { + if (eflag) { + ev.evdwl += (((NEIGHFLAG==HALF || NEIGHFLAG==HALFTHREAD)&&(NEWTON_PAIR||(jtemplate ev_tally(ev,i,j,phi,fpair,delx,dely,delz); + } + + } + } + + a_f(i,0) += fxtmp; + a_f(i,1) += fytmp; + a_f(i,2) += fztmp; + } +} + +template +template +KOKKOS_INLINE_FUNCTION +void PairEAMFSKokkos::operator()(TagPairEAMFSKernelC, + /*const int &ii*/ + const typename Kokkos::TeamPolicy::member_type& team_member) const { + EV_FLOAT ev; + this->template operator()(TagPairEAMFSKernelC(), team_member, ev); +} + +/* ---------------------------------------------------------------------- */ + template template KOKKOS_INLINE_FUNCTION @@ -1230,6 +1489,30 @@ void PairEAMFSKokkos::file2array_fs() /* ---------------------------------------------------------------------- */ +template +template +auto PairEAMFSKokkos::policyInstance(int inum) { + #ifdef KOKKOS_ENABLE_HIP + if (execution_space != Host) { + static_assert(t_ffloat_2d_n7::static_extent(2) == 7, + "Breaking assumption of spline dim for KernelAB and KernelC scratch caching"); + + auto policy = Kokkos::TeamPolicy((inum+1023)/1024, 1024) + .set_scratch_size(0, + Kokkos::PerTeam(MAX_CACHE_ROWS*t_ffloat_2d_n7::static_extent(2)*sizeof(double))); + return policy; + } else { + auto policy = Kokkos::RangePolicy(0,inum); + return policy; + } + #else + auto policy = Kokkos::RangePolicy(0,inum); + return policy; + #endif +} + +/* ---------------------------------------------------------------------- */ + namespace LAMMPS_NS { template class PairEAMFSKokkos; #ifdef LMP_KOKKOS_GPU diff --git a/src/KOKKOS/pair_eam_fs_kokkos.h b/src/KOKKOS/pair_eam_fs_kokkos.h index 06a395cba7..f7513b3008 100644 --- a/src/KOKKOS/pair_eam_fs_kokkos.h +++ b/src/KOKKOS/pair_eam_fs_kokkos.h @@ -61,7 +61,6 @@ class PairEAMFSKokkos : public PairEAM, public KokkosBase { ~PairEAMFSKokkos() override; void compute(int, int) override; void init_style() override; - void *extract(const char *, int &) override { return nullptr; } void coeff(int, char **) override; KOKKOS_INLINE_FUNCTION @@ -93,6 +92,14 @@ class PairEAMFSKokkos : public PairEAM, public KokkosBase { KOKKOS_INLINE_FUNCTION void operator()(TagPairEAMFSKernelAB, const int&) const; + template + KOKKOS_INLINE_FUNCTION + void operator()(TagPairEAMFSKernelAB, const typename Kokkos::TeamPolicy::member_type&, EV_FLOAT&) const; + + template + KOKKOS_INLINE_FUNCTION + void operator()(TagPairEAMFSKernelAB, const typename Kokkos::TeamPolicy::member_type&) const; + template KOKKOS_INLINE_FUNCTION void operator()(TagPairEAMFSKernelC, const int&, EV_FLOAT&) const; @@ -101,6 +108,14 @@ class PairEAMFSKokkos : public PairEAM, public KokkosBase { KOKKOS_INLINE_FUNCTION void operator()(TagPairEAMFSKernelC, const int&) const; + template + KOKKOS_INLINE_FUNCTION + void operator()(TagPairEAMFSKernelC, const typename Kokkos::TeamPolicy::member_type&, EV_FLOAT&) const; + + template + KOKKOS_INLINE_FUNCTION + void operator()(TagPairEAMFSKernelC, const typename Kokkos::TeamPolicy::member_type&) const; + template KOKKOS_INLINE_FUNCTION void ev_tally(EV_FLOAT &ev, const int &i, const int &j, @@ -125,7 +140,7 @@ class PairEAMFSKokkos : public PairEAM, public KokkosBase { typename AT::t_efloat_1d d_eatom; typename AT::t_virial_array d_vatom; - int need_dup; + int need_dup,inum; using KKDeviceType = typename KKDevice::value; @@ -139,7 +154,6 @@ class PairEAMFSKokkos : public PairEAM, public KokkosBase { DupScatterView dup_f; DupScatterView dup_eatom; DupScatterView dup_vatom; - NonDupScatterView ndup_rho; NonDupScatterView ndup_f; NonDupScatterView ndup_eatom; @@ -163,13 +177,15 @@ class PairEAMFSKokkos : public PairEAM, public KokkosBase { t_ffloat_2d_n7 d_frho_spline; t_ffloat_2d_n7 d_rhor_spline; t_ffloat_2d_n7 d_z2r_spline; - + void interpolate(int, double, double *, t_host_ffloat_2d_n7, int); void file2array() override; void file2array_fs(); void array2spline() override; - void interpolate(int, double, double *, t_host_ffloat_2d_n7, int); void read_file(char *) override; + template + auto policyInstance(int inum); + typename AT::t_neighbors_2d d_neighbors; typename AT::t_int_1d d_ilist; typename AT::t_int_1d d_numneigh; @@ -186,7 +202,6 @@ class PairEAMFSKokkos : public PairEAM, public KokkosBase { }; } - #endif #endif diff --git a/src/KOKKOS/pair_eam_kokkos.cpp b/src/KOKKOS/pair_eam_kokkos.cpp index 2317f2d367..5e2ea4357f 100644 --- a/src/KOKKOS/pair_eam_kokkos.cpp +++ b/src/KOKKOS/pair_eam_kokkos.cpp @@ -148,15 +148,15 @@ void PairEAMKokkos::compute(int eflag_in, int vflag_in) if (neighflag == HALF) { if (newton_pair) { - Kokkos::parallel_for(Kokkos::RangePolicy >(0,inum),*this); + Kokkos::parallel_for(Kokkos::RangePolicy>(0,inum),*this); } else { - Kokkos::parallel_for(Kokkos::RangePolicy >(0,inum),*this); + Kokkos::parallel_for(Kokkos::RangePolicy>(0,inum),*this); } } else if (neighflag == HALFTHREAD) { if (newton_pair) { - Kokkos::parallel_for(Kokkos::RangePolicy >(0,inum),*this); + Kokkos::parallel_for(Kokkos::RangePolicy>(0,inum),*this); } else { - Kokkos::parallel_for(Kokkos::RangePolicy >(0,inum),*this); + Kokkos::parallel_for(Kokkos::RangePolicy>(0,inum),*this); } } @@ -174,9 +174,9 @@ void PairEAMKokkos::compute(int eflag_in, int vflag_in) // compute kernel B if (eflag) - Kokkos::parallel_reduce(Kokkos::RangePolicy >(0,inum),*this,ev); + Kokkos::parallel_reduce(Kokkos::RangePolicy>(0,inum),*this,ev); else - Kokkos::parallel_for(Kokkos::RangePolicy >(0,inum),*this); + Kokkos::parallel_for(Kokkos::RangePolicy>(0,inum),*this); } else if (neighflag == FULL) { @@ -184,12 +184,12 @@ void PairEAMKokkos::compute(int eflag_in, int vflag_in) if (eflag) Kokkos::parallel_reduce( - Kokkos::RangePolicy>(0,inum), - *this,ev); + Kokkos::RangePolicy>(0,inum), + *this,ev); else Kokkos::parallel_for( - policyInstance>(inum), - *this); + policyInstance>(inum), + *this); } if (eflag) { @@ -209,64 +209,64 @@ void PairEAMKokkos::compute(int eflag_in, int vflag_in) if (neighflag == HALF) { if (newton_pair) { Kokkos::parallel_reduce( - Kokkos::RangePolicy>(0,inum), - *this,ev); + Kokkos::RangePolicy>(0,inum), + *this,ev); } else { Kokkos::parallel_reduce( - Kokkos::RangePolicy>(0,inum), - *this,ev); + Kokkos::RangePolicy>(0,inum), + *this,ev); } } else if (neighflag == HALFTHREAD) { if (newton_pair) { Kokkos::parallel_reduce( - Kokkos::RangePolicy>(0,inum), - *this,ev); + Kokkos::RangePolicy>(0,inum), + *this,ev); } else { Kokkos::parallel_reduce( Kokkos::RangePolicy>(0,inum), - *this,ev); + *this,ev); } } else if (neighflag == FULL) { if (newton_pair) { Kokkos::parallel_reduce( - Kokkos::RangePolicy>(0,inum), - *this,ev); + Kokkos::RangePolicy>(0,inum), + *this,ev); } else { Kokkos::parallel_reduce( - Kokkos::RangePolicy>(0,inum), - *this,ev); + Kokkos::RangePolicy>(0,inum), + *this,ev); } } } else { if (neighflag == HALF) { if (newton_pair) { Kokkos::parallel_for( - policyInstance>(inum), - *this); + policyInstance>(inum), + *this); } else { Kokkos::parallel_for( - policyInstance>(inum), - *this); + policyInstance>(inum), + *this); } } else if (neighflag == HALFTHREAD) { if (newton_pair) { Kokkos::parallel_for( - policyInstance>(inum), - *this); + policyInstance>(inum), + *this); } else { Kokkos::parallel_for( - policyInstance>(inum), - *this); + policyInstance>(inum), + *this); } } else if (neighflag == FULL) { if (newton_pair) { Kokkos::parallel_for( - policyInstance>(inum), - *this); + policyInstance>(inum), + *this); } else { Kokkos::parallel_for( - policyInstance>(inum), - *this); + policyInstance>(inum), + *this); } } } @@ -612,6 +612,7 @@ template template KOKKOS_INLINE_FUNCTION void PairEAMKokkos::operator()(TagPairEAMKernelB, const int &ii, EV_FLOAT& ev) const { + // fp = derivative of embedding energy at each atom // phi = embedding energy at each atom // if rho > rhomax (e.g. due to close approach of two atoms), @@ -643,7 +644,7 @@ void PairEAMKokkos::operator()(TagPairEAMKernelB, const int & EV_FLOAT ev; this->template operator()(TagPairEAMKernelB(), ii, ev); } -/* ---------------------------------------------------------------------- */ + /* ---------------------------------------------------------------------- */ ////Specialisation for Neighborlist types Half, HalfThread, Full @@ -828,6 +829,7 @@ void PairEAMKokkos::operator()(TagPairEAMKernelCtemplate operator()(TagPairEAMKernelC(), ii, ev); } + /* ---------------------------------------------------------------------- */ ////Specialisation for Neighborlist types Half, HalfThread, Full @@ -835,8 +837,8 @@ template template KOKKOS_INLINE_FUNCTION void PairEAMKokkos::operator()(TagPairEAMKernelAB, - const typename Kokkos::TeamPolicy::member_type& team_member, - EV_FLOAT& ev) const { + const typename Kokkos::TeamPolicy::member_type& team_member, + EV_FLOAT& ev) const { int ii = team_member.league_rank()*team_member.team_size() + team_member.team_rank(); // rho = density at each atom // loop over neighbors of my atoms @@ -844,7 +846,7 @@ void PairEAMKokkos::operator()(TagPairEAMKernelAB, const int j_max = t_ffloat_2d_n7::static_extent(2); const int d_rhor_spline_cached = (m_max > MAX_CACHE_ROWS) ? 0 : 1; Kokkos::View> A(team_member.team_scratch(0), MAX_CACHE_ROWS); + Kokkos::MemoryTraits> A(team_member.team_scratch(0), MAX_CACHE_ROWS); if (d_rhor_spline_cached) { for(int i = team_member.team_rank(); i < m_max*j_max; i+= team_member.team_size()) { @@ -884,7 +886,7 @@ void PairEAMKokkos::operator()(TagPairEAMKernelAB, const int d_type2rhor_ji = d_type2rhor(jtype,itype); if (d_type2rhor_ji == 0 && d_rhor_spline_cached == 1) { rhotmp += ((A(m,3)*p + A(m,4))*p + - A(m,5))*p + A(m,6); + A(m,5))*p + A(m,6); } else rhotmp += ((d_rhor_spline(d_type2rhor_ji,m,3)*p + d_rhor_spline(d_type2rhor_ji,m,4))*p + d_rhor_spline(d_type2rhor_ji,m,5))*p + d_rhor_spline(d_type2rhor_ji,m,6); @@ -919,7 +921,7 @@ template template KOKKOS_INLINE_FUNCTION void PairEAMKokkos::operator()(TagPairEAMKernelAB, - const typename Kokkos::TeamPolicy::member_type& team_member) const { + const typename Kokkos::TeamPolicy::member_type& team_member) const { EV_FLOAT ev; this->template operator()(TagPairEAMKernelAB(), team_member, ev); } @@ -931,7 +933,7 @@ template template KOKKOS_INLINE_FUNCTION void PairEAMKokkos::operator()(TagPairEAMKernelC, - const typename Kokkos::TeamPolicy::member_type& team_member, + const typename Kokkos::TeamPolicy::member_type& team_member, EV_FLOAT& ev) const { int ii = team_member.league_rank()*team_member.team_size() + team_member.team_rank(); @@ -945,7 +947,7 @@ void PairEAMKokkos::operator()(TagPairEAMKernelC MAX_CACHE_ROWS) ? 0 : 1; Kokkos::View> A(team_member.team_scratch(0), MAX_CACHE_ROWS); + Kokkos::MemoryTraits> A(team_member.team_scratch(0), MAX_CACHE_ROWS); if (d_z2r_spline_cached) { for(int i = team_member.team_rank(); i < m_max*j_max; i+= team_member.team_size()) { @@ -1051,8 +1053,8 @@ template template KOKKOS_INLINE_FUNCTION void PairEAMKokkos::operator()(TagPairEAMKernelC, - /*const int &ii*/ - const typename Kokkos::TeamPolicy::member_type& team_member) const { + /*const int &ii*/ + const typename Kokkos::TeamPolicy::member_type& team_member) const { EV_FLOAT ev; this->template operator()(TagPairEAMKernelC(), team_member, ev); } @@ -1163,11 +1165,11 @@ auto PairEAMKokkos::policyInstance(int inum) { #ifdef KOKKOS_ENABLE_HIP if (execution_space != Host) { static_assert(t_ffloat_2d_n7::static_extent(2) == 7, - "Breaking assumption of spline dim for KernelAB and KernelC scratch caching"); + "Breaking assumption of spline dim for KernelAB and KernelC scratch caching"); auto policy = Kokkos::TeamPolicy((inum+1023)/1024, 1024) - .set_scratch_size(0, - Kokkos::PerTeam(MAX_CACHE_ROWS*t_ffloat_2d_n7::static_extent(2)*sizeof(double))); + .set_scratch_size(0, + Kokkos::PerTeam(MAX_CACHE_ROWS*t_ffloat_2d_n7::static_extent(2)*sizeof(double))); return policy; } else { auto policy = Kokkos::RangePolicy(0,inum); diff --git a/src/KOKKOS/pair_eam_kokkos.h b/src/KOKKOS/pair_eam_kokkos.h index 7f4ec67f6f..41e02e68cc 100644 --- a/src/KOKKOS/pair_eam_kokkos.h +++ b/src/KOKKOS/pair_eam_kokkos.h @@ -138,9 +138,8 @@ class PairEAMKokkos : public PairEAM, public KokkosBase { typename AT::t_efloat_1d d_eatom; typename AT::t_virial_array d_vatom; - int need_dup; - int inum; - + int need_dup,inum; + using KKDeviceType = typename KKDevice::value; template From 4d78d987c6d512b6d379b70ce9ef9c386f41b418 Mon Sep 17 00:00:00 2001 From: Yifan Li Date: Fri, 24 Feb 2023 07:34:58 -0500 Subject: [PATCH 008/396] add unmap_inv function --- src/domain.cpp | 23 +++++++++++++++++++++++ src/domain.h | 1 + 2 files changed, 24 insertions(+) diff --git a/src/domain.cpp b/src/domain.cpp index e1a508ac51..dcad723b9f 100644 --- a/src/domain.cpp +++ b/src/domain.cpp @@ -1500,6 +1500,29 @@ void Domain::remap_near(double *xnew, double *xold) if (triclinic) lamda2x(coordnew,xnew); } +/* ---------------------------------------------------------------------- + remap the point to specific image flags + x overwritten with result, reset image flag + for triclinic, use h[] to add in tilt factors in other dims as needed +------------------------------------------------------------------------- */ + +void Domain::unmap_inv(double *x, imageint image) +{ + int xbox = (image & IMGMASK) - IMGMAX; + int ybox = (image >> IMGBITS & IMGMASK) - IMGMAX; + int zbox = (image >> IMG2BITS) - IMGMAX; + + if (triclinic == 0) { + x[0] -= xbox*xprd; + x[1] -= ybox*yprd; + x[2] -= zbox*zprd; + } else { + x[0] -= h[0]*xbox + h[5]*ybox + h[4]*zbox; + x[1] -= h[1]*ybox + h[3]*zbox; + x[2] -= h[2]*zbox; + } +} + /* ---------------------------------------------------------------------- unmap the point via image flags x overwritten with result, don't reset image flag diff --git a/src/domain.h b/src/domain.h index 1e9e9caae1..738dc8a2a3 100644 --- a/src/domain.h +++ b/src/domain.h @@ -126,6 +126,7 @@ class Domain : protected Pointers { void remap(double *, imageint &); void remap(double *); void remap_near(double *, double *); + void unmap_inv(double *x, imageint); void unmap(double *, imageint); void unmap(const double *, imageint, double *); void image_flip(int, int, int); From b0b14bd1d166c78d7357e76a733c56ca8d73970d Mon Sep 17 00:00:00 2001 From: Yifan Li Date: Fri, 24 Feb 2023 07:48:34 -0500 Subject: [PATCH 009/396] add fix pimd/langevin --- src/REPLICA/fix_pimd_langevin.cpp | 1751 +++++++++++++++++++++++++++++ src/REPLICA/fix_pimd_langevin.h | 198 ++++ 2 files changed, 1949 insertions(+) create mode 100644 src/REPLICA/fix_pimd_langevin.cpp create mode 100644 src/REPLICA/fix_pimd_langevin.h diff --git a/src/REPLICA/fix_pimd_langevin.cpp b/src/REPLICA/fix_pimd_langevin.cpp new file mode 100644 index 0000000000..9ac8fc3b17 --- /dev/null +++ b/src/REPLICA/fix_pimd_langevin.cpp @@ -0,0 +1,1751 @@ +/* ---------------------------------------------------------------------- + LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator + https://www.lammps.org/, Sandia National Laboratories + LAMMPS development team: developers@lammps.org + + 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. +------------------------------------------------------------------------- */ + +/* ---------------------------------------------------------------------- + Package FixPIMDLangevin + Purpose Quantum Path Integral Algorithm for Quantum Chemistry + Copyright Voth Group @ University of Chicago + Authors Chris Knight & Yuxing Peng (yuxing at uchicago.edu) + + Updated Oct-01-2011 + Version 1.0 + + Updated Jun-07-2022 + Yifan Li @ Princeton University (yifanl0716@gmail.com) + Added components: + - Multi-processor parallelism for each bead + - White-noise Langevin thermostat + - Bussi-Zykova-Parrinello barostat (isotropic and anisotropic) + - Several quantum estimators + Futher plans: + - Triclinic barostat +------------------------------------------------------------------------- */ + +#include "fix_pimd_langevin.h" + +#include "atom.h" +#include "comm.h" +#include "compute.h" +#include "domain.h" +#include "error.h" +#include "force.h" +#include "group.h" +#include "math_const.h" +#include "memory.h" +#include "modify.h" +#include "random_mars.h" +#include "universe.h" +#include "utils.h" +#include "update.h" + +#include +#include + +using namespace LAMMPS_NS; +using namespace FixConst; +using namespace MathConst; + +enum { PIMD, NMPIMD, CMD }; +enum { physical, normal }; +enum { baoab, obabo }; +enum { ISO, ANISO, TRICLINIC }; +enum { PILE_L }; +enum { MTTK, BZP }; +// char* Barostats[] = {"MTTK", "BZP"}; +std::map Barostats {{MTTK, "MTTK"}, {BZP, "BZP"}}; +enum { nve, nvt, nph, npt }; +enum{SINGLE_PROC, MULTI_PROC}; + +/* ---------------------------------------------------------------------- */ + +FixPIMDLangevin::FixPIMDLangevin(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg), random(nullptr), c_pe(nullptr), c_press(nullptr) { + time_integrate = 1; + tagsend = tagrecv = nullptr; + bufsend = bufrecv = nullptr; + bufsendall = bufrecvall = nullptr; + bufsorted = bufsortedall = nullptr; + outsorted = buftransall = nullptr; + + ntotal = 0; + maxlocal = maxunwrap = maxxc = 0; + bufbeads = nullptr; + x_unwrap = xc = nullptr; + xcall = nullptr; + // x_unwrap = x_unwrapsort = x_unwrapall = nullptr; + // tag_init = tag_initall = nullptr; + counts = nullptr; + + sizeplan = 0; + plansend = planrecv = nullptr; + + M_x2xp = M_xp2x = M_f2fp = M_fp2f = nullptr; + lam = nullptr; + modeindex = nullptr; + + mass = nullptr; + + method = PIMD; + ensemble = nvt; + integrator = obabo; + thermostat = PILE_L; + barostat = BZP; + fmass = 1.0; + sp = 1.0; + temp = 298.15; + Lan_temp = 298.15; + tau = 1.0; + tau_p = 1.0; + Pext = 1.0; + tstat_flag = 1; + pstat_flag = 0; + mapflag = 1; + removecomflag = 1; + fmmode = physical; + pstyle = ISO; + for (int i=0; i<6; i++) p_flag[i] = 0; + + for (int i = 3; i < narg - 1; i += 2) { + if (strcmp(arg[i], "method") == 0) { + if (strcmp(arg[i + 1], "pimd") == 0) + method = PIMD; + else if (strcmp(arg[i + 1], "nmpimd") == 0) + method = NMPIMD; + else if (strcmp(arg[i + 1], "cmd") == 0) + method = CMD; + else + error->universe_all(FLERR, "Unknown method parameter for fix pimd"); + } + else if(strcmp(arg[i], "integrator")==0) + + { + if(strcmp(arg[i+1], "obabo")==0) integrator=obabo; + else if(strcmp(arg[i+1], "baoab")==0) integrator=baoab; + else error->universe_all(FLERR, "Unknown integrator parameter for fix pimd. Only obabo and baoab integrators are supported!"); + } + + else if(strcmp(arg[i], "ensemble")==0) + { + if(strcmp(arg[i+1], "nve")==0) { ensemble = nve; tstat_flag = 0; pstat_flag = 0; } + else if(strcmp(arg[i+1], "nvt")==0) { ensemble = nvt; tstat_flag = 1; pstat_flag = 0; } + else if(strcmp(arg[i+1], "nph")==0) { ensemble = nph; tstat_flag = 0; pstat_flag = 1; } + else if(strcmp(arg[i+1], "npt")==0) { ensemble = npt; tstat_flag = 1; pstat_flag = 1; } + else error->universe_all(FLERR, "Unknown ensemble parameter for fix pimd. Only nve and nvt ensembles are supported!"); + } + + else if (strcmp(arg[i], "fmass") == 0) { + fmass = utils::numeric(FLERR, arg[i + 1], false, lmp); + if (fmass < 0.0 || fmass > 1.0) + error->universe_all(FLERR, "Invalid fmass value for fix pimd"); + } + + else if(strcmp(arg[i], "fmmode")==0) + { + if(strcmp(arg[i+1], "physical")==0) fmmode=physical; + else if(strcmp(arg[i+1], "normal")==0) fmmode=normal; + else error->universe_all(FLERR, "Unknown fictitious mass mode for fix pimd. Only physical mass and normal mode mass are supported!"); + } + + else if(strcmp(arg[i],"scale")==0) + { + pilescale = atof(arg[i+1]); + if(pilescale<0.0) error->universe_all(FLERR,"Invalid pile scale value for fix pimd"); + } + + else if (strcmp(arg[i], "temp") == 0) { + temp = utils::numeric(FLERR, arg[i + 1], false, lmp); + if (temp < 0.0) error->universe_all(FLERR, "Invalid temp value for fix pimd"); + } + + else if (strcmp(arg[i], "lj") == 0) { + lj_epsilon = utils::numeric(FLERR, arg[i+1], false, lmp); + lj_sigma = utils::numeric(FLERR, arg[i+2], false, lmp); + lj_mass = utils::numeric(FLERR, arg[i+3], false, lmp); + other_planck = utils::numeric(FLERR, arg[i+4], false, lmp); + i++; + i++; + i++; + } + + else if(strcmp(arg[i], "thermostat")==0) + { + if(strcmp(arg[i+1],"PILE_L")==0) + { + thermostat = PILE_L; + seed = atoi(arg[i+2]); + i++; + } + } + + else if(strcmp(arg[i], "tau")==0) + { + tau = atof(arg[i+1]); + } + + else if(strcmp(arg[i], "press")==0) + { + Pext = atof(arg[i+1]); + if(Pext<0.0) error->universe_all(FLERR,"Invalid press value for fix pimd"); + } + + else if(strcmp(arg[i], "barostat")==0) + { + if(strcmp(arg[i+1],"MTTK")==0) + { + barostat = MTTK; + } + else if(strcmp(arg[i+1],"BZP")==0) + { + barostat = BZP; + } + else error->universe_all(FLERR,"Unknown barostat parameter for fix pimd"); + } + + else if(strcmp(arg[i], "iso")==0) + { + pstyle = ISO; + i--; + } + + else if(strcmp(arg[i], "aniso")==0) + { + pstyle = ANISO; + i--; + } + + else if(strcmp(arg[i], "taup")==0) + { + tau_p = atof(arg[i+1]); + if(tau_p<=0.0) error->universe_all(FLERR, "Invalid tau_p value for fix pimd"); + } + else if(strcmp(arg[i], "fixcom")==0) + { + if(strcmp(arg[i+1], "yes")==0) removecomflag = 1; + else if(strcmp(arg[i+1], "no")==0) removecomflag = 0; + } + + else if(strcmp(arg[i], "map")==0) + { + if(strcmp(arg[i+1], "yes")==0) mapflag = 1; + else if(strcmp(arg[i+1], "no")==0) mapflag = 0; + } + + else error->universe_all(FLERR, fmt::format("Unknown keyword {} for fix pimd", arg[i])); + } + + /* Initiation */ + + int nlocal = atom->nlocal; + // xc = new double[nlocal*3]; + // x_unwrap = new double[nlocal*3]; + + global_freq = 1; + vector_flag = 1; + size_vector = 11; + // if(pstyle==ISO) {size_vector = 15;} + // else if(pstyle==ANISO) {size_vector = 23;} + extvector = 1; + // comm_forward = 1; + + // some initilizations + + id_pe = new char[8]; + strcpy(id_pe, "pimd_pe"); + char **newarg = new char*[3]; + newarg[0] = id_pe; + newarg[1] = (char *) "all"; + newarg[2] = (char *) "pe"; + modify->add_compute(3,newarg); + delete [] newarg; + + + id_press = new char[12]; + strcpy(id_press, "pimd_press"); + newarg = new char*[5]; + newarg[0] = id_press; + newarg[1] = (char*) "all"; + newarg[2] = (char*) "pressure"; + newarg[3] = (char*) "thermo_temp"; + newarg[4] = (char*) "virial"; + modify->add_compute(5, newarg); + delete [] newarg; + + vol0 = domain->xprd * domain->yprd * domain->zprd; + + fixedpoint[0] = 0.5*(domain->boxlo[0]+domain->boxhi[0]); + fixedpoint[1] = 0.5*(domain->boxlo[1]+domain->boxhi[1]); + fixedpoint[2] = 0.5*(domain->boxlo[2]+domain->boxhi[2]); + + // initialize Marsaglia RNG with processor-unique seed + + if(integrator==baoab || integrator==obabo) + { + Lan_temp = temp; + random = new RanMars(lmp, seed + universe->me); + } + + me = comm->me; + nprocs = comm->nprocs; + if(nprocs == 1) cmode = SINGLE_PROC; + else cmode = MULTI_PROC; + + nprocs_universe = universe->nprocs; + nreplica = universe->nworlds; + ireplica = universe->iworld; + + int *iroots = new int[nreplica]; + MPI_Group uworldgroup,rootgroup; + + for (int i=0; iroot_proc[i]; + MPI_Comm_group(universe->uworld, &uworldgroup); + MPI_Group_incl(uworldgroup, nreplica, iroots, &rootgroup); + MPI_Comm_create(universe->uworld, rootgroup, &rootworld); + if (rootgroup != MPI_GROUP_NULL) MPI_Group_free(&rootgroup); + if (uworldgroup != MPI_GROUP_NULL) MPI_Group_free(&uworldgroup); + delete [] iroots; + + ntotal = atom->natoms; + if(atom->nmax > maxlocal) reallocate(); + if(atom->nmax > maxunwrap) reallocate_x_unwrap(); + if(atom->nmax > maxxc) reallocate_xc(); + memory->create(xcall, ntotal*3, "FixPIMDLangevin:xcall"); + // init_x_unwrap(); + + if (cmode == SINGLE_PROC) + { + memory->create(bufsorted, ntotal, 3, "FixPIMDLangevin:bufsorted"); + memory->create(outsorted, ntotal, 3, "FixPIMDLangevin:outsorted"); + memory->create(bufsortedall, nreplica*ntotal, 3, "FixPIMDLangevin:bufsortedall"); + memory->create(buftransall, nreplica*ntotal, 3, "FixPIMDLangevin:buftransall"); + memory->create(counts, nreplica, "FixPIMDLangevin:counts"); + memory->create(displacements, nreplica, "FixPIMDLangevin:displacements"); + } + + if ((cmode == MULTI_PROC) && (counts == nullptr)) { + // printf("me = %d, creating bufrecvall\n", universe->me); + memory->create(bufsendall,ntotal,3,"FixPIMDLangevin:bufsendall"); + memory->create(bufrecvall,ntotal,3,"FixPIMDLangevin:bufrecvall"); + // printf("me = %d, bufrecvall[0][0] = %.4f\n", universe->me, bufrecvall[0][0]); + memory->create(tagsendall,ntotal,"FixPIMDLangevin:tagsendall"); + memory->create(tagrecvall,ntotal,"FixPIMDLangevin:tagrecvall"); + // printf("me = %d, tagrecvall[0] = %d\n", universe->me, tagrecvall[0]); + memory->create(counts,nprocs,"FixPIMDLangevin:counts"); + memory->create(displacements,nprocs,"FixPIMDLangevin:displacements"); + // memory->create(x_unwrapall, ntotal, 3, "FixPIMDLangevin:x_unwrapall"); + // memory->create(tag_initall, ntotal, "FixPIMDLangevin:tag_initall"); + // printf("me = %d, tag_initall[0] = %d\n", universe->me, tag_initall[0]); + } + + // printf("me = %d constructing finished\n", universe->me); +} + +/* ---------------------------------------------------------------------- */ + +FixPIMDLangevin::~FixPIMDLangevin() +{ + +} + +/* ---------------------------------------------------------------------- */ + +int FixPIMDLangevin::setmask() +{ + int mask = 0; + mask |= POST_FORCE; + mask |= INITIAL_INTEGRATE; + // mask |= POST_NEIGHBOR; + mask |= FINAL_INTEGRATE; + mask |= END_OF_STEP; + return mask; +} + +/* ---------------------------------------------------------------------- */ + +void FixPIMDLangevin::init() +{ + if (atom->map_style == Atom::MAP_NONE) + error->all(FLERR, "Fix pimd requires an atom map, see atom_modify"); + + if (universe->me == 0 && universe->uscreen) + fprintf(universe->uscreen, "Fix pimd initializing Path-Integral ...\n"); + + // prepare the constants + + masstotal = group->mass(igroup); + np = universe->nworlds; + inverse_np = 1.0 / np; + + const double Boltzmann = force->boltz; + if (strcmp(update->unit_style,"lj") == 0) { + double planck_star = sqrt(lj_epsilon)*sqrt(atom->mass[0])*lj_sigma; + planck = other_planck / planck_star; + } + else planck = force->hplanck; + const double Planck = planck; + printf("planck = %.6e\n", planck); + + // if(force->boltz == 1.0) { hbar = Planck; } + // else { hbar = Planck / (2.0 * MY_PI); } + hbar = Planck / (2.0 * MY_PI); + // hbar = Planck; + kBT = force->boltz * temp; + double beta = 1.0 / (Boltzmann * temp); + double _fbond = 1.0 * np * np / (beta * beta * hbar * hbar); + + omega_np = np / (hbar * beta) * sqrt(force->mvv2e); + beta_np = 1.0 / force->boltz / temp / np; + fbond = _fbond * force->mvv2e; + // printf("_fbond = %.16e\nfbond = %.16e\n", _fbond, fbond); + + if (universe->me == 0) + printf("Fix pimd -P/(beta^2 * hbar^2) = %20.7lE (kcal/mol/A^2)\n\n", fbond); + + if(integrator==obabo) + { + dtf = 0.5 * update->dt * force->ftm2v; + dtv = 0.5 * update->dt; + dtv2 = dtv * dtv; + dtv3 = 1./3 * dtv2 * dtv * force->ftm2v; + } + else if(integrator==baoab) + { + dtf = 0.5 * update->dt * force->ftm2v; + dtv = 0.5 * update->dt; + dtv2 = dtv * dtv; + dtv3 = 1./3 * dtv2 * dtv * force->ftm2v; + } + else + { + error->universe_all(FLERR,"Unknown integrator parameter for fix pimd"); + } + + comm_init(); + + mass = new double[atom->ntypes + 1]; + + nmpimd_init(); + + Langevin_init(); + if (pstat_flag) baro_init(); + + int ipe = modify->find_compute(id_pe); + c_pe = modify->compute[ipe]; + + int ipress = modify->find_compute(id_press); + c_press = modify->compute[ipress]; + + t_prim = t_vir = t_cv = p_prim = p_vir = p_cv = p_md = 0.0; + + if(universe->me==0) fprintf(screen, "Fix pimd successfully initialized!\n"); +} + +/* ---------------------------------------------------------------------- */ + +void FixPIMDLangevin::setup(int vflag) +{ + if(universe->me==0) printf("Setting up Path-Integral ...\n"); + int nlocal = atom->nlocal; + tagint *tag = atom->tag; + double **x = atom->x; + double **v = atom->v; + imageint *image = atom->image; + // nlocal_init = nlocal; + if(mapflag){ + for(int i=0; iunmap(x[i], image[i]); + } + } + // printf("me = %d after unmapping x_unwrap\n", universe->me); + + // printf("setup already here\n"); + if(method==NMPIMD) + { + inter_replica_comm(x); + // printf("me = %d after inter\n", universe->me); + // printf("%.4f %.4f %.4f\n", bufbeads[0][0], bufbeads[0][1], bufbeads[0][2]); + if(cmode == SINGLE_PROC) nmpimd_transform(bufsortedall, x, M_x2xp[universe->iworld]); + else if(cmode == MULTI_PROC) nmpimd_transform(bufbeads, x, M_x2xp[universe->iworld]); + } + collect_xc(); + // printf("me = %d setup x2xp done\n", universe->me); + compute_spring_energy(); + if(method==NMPIMD) + { + inter_replica_comm(x); + if(cmode == SINGLE_PROC) nmpimd_transform(bufsortedall, x, M_xp2x[universe->iworld]); + else if(cmode == MULTI_PROC) nmpimd_transform(bufbeads, x, M_xp2x[universe->iworld]); + // nmpimd_transform(bufbeads, x, M_xp2x[universe->iworld]); + } + // printf("me = %d setup xp2x done\n", universe->me); + if(mapflag){ + for(int i=0; iunmap_inv(x[i], image[i]); + } + } + + if(method==NMPIMD) + { + inter_replica_comm(v); + if(cmode == SINGLE_PROC) nmpimd_transform(bufsortedall, v, M_x2xp[universe->iworld]); + else if(cmode == MULTI_PROC) nmpimd_transform(bufbeads, v, M_x2xp[universe->iworld]); + // nmpimd_transform(bufbeads, atom->v, M_x2xp[universe->iworld]); + } + // printf("me = %d setup v2vp done\n", universe->me); + // compute_xc(); + // update_x_unwrap(); + // printf("setting up %d\n", vflag); + if(universe->me==0 && screen) fprintf(screen,"Setting up Path-Integral ...\n"); + if(universe->me==0) printf("Setting up Path-Integral ...\n"); + // printf("setting up, m = %.4e\n", mass[1]); + post_force(vflag); + // int idx = atom->map(1); + // printf("irplica = %d, x[1] = %.6f %.6f %.6f xu[1] = %.6f %.6f %.6f xc[1] = %.6f %.6f %.6f\n", ireplica, x[idx][0], x[idx][1], x[idx][2], x_unwrap[idx][0], x_unwrap[idx][1], x_unwrap[idx][2], xc[idx][0], xc[idx][1], xc[idx][2]); + // printf("after post_force, m = %.4e\n", mass[1]); + // printf("me = %d after post_force\n", universe->me); + compute_totke(); + // compute_pote(); + // if(pstyle==ANISO) compute_stress_tensor(); + end_of_step(); + c_pe->addstep(update->ntimestep+1); + c_press->addstep(update->ntimestep+1); + // printf("setup ending: \ncell = %.16e %.16e %.16e\nvol = %.16e\n", domain->xprd, domain->yprd, domain->zprd, domain->xprd * domain->yprd * domain->zprd); + // printf("me = %d, setup finished\n", universe->me); +} + +/* ---------------------------------------------------------------------- */ + +void FixPIMDLangevin::initial_integrate(int /*vflag*/) +{ + // printf("step = %d start initial_integrate\ncell = %.16e %.16e %.16e\nvol = %.16e\n", update->ntimestep, domain->xprd, domain->yprd, domain->zprd, domain->xprd * domain->yprd * domain->zprd); + // printf("me = %d, step %d initial_integrate starts!\n", universe->me, update->ntimestep); + // printf("me = %d, step %d if starts!\n", universe->me, update->ntimestep); + int nlocal = atom->nlocal; + tagint *tag = atom->tag; + double **x = atom->x; + imageint *image = atom->image; + if(mapflag){ + for(int i=0; iunmap(x[i], image[i]); + } + } + if(integrator==obabo) + { + // printf("me = %d, step %d obabo starts!\n", universe->me, update->ntimestep); + if(tstat_flag) + { + o_step(); + // if(removecomflag) remove_com_motion(); + if(pstat_flag) press_o_step(); + } + if(pstat_flag) + { + compute_totke(); + // printf("me = %d, step %d after totke!\n", universe->me, update->ntimestep); + compute_p_cv(); + press_v_step(); + } + /* + if(pstat_flag) + { + } + */ + // printf("me = %d, step %d before b_step 1!\n", universe->me, update->ntimestep); + b_step(); + // printf("me = %d, step %d after b_step 1!\n", universe->me, update->ntimestep); + // if(removecomflag) remove_com_motion(); + if(method==NMPIMD) + { + inter_replica_comm(x); + if(cmode == SINGLE_PROC) nmpimd_transform(bufsortedall, x, M_x2xp[universe->iworld]); + else if(cmode == MULTI_PROC) nmpimd_transform(bufbeads, x, M_x2xp[universe->iworld]); + // nmpimd_transform(bufbeads, x, M_x2xp[universe->iworld]); + } + qc_step(); + a_step(); + qc_step(); + a_step(); + // printf("me = %d, step %d after 2 a_step's!\n", universe->me, update->ntimestep); + } + else if(integrator==baoab) + { + if(pstat_flag) + { + compute_totke(); + compute_p_cv(); + press_v_step(); + } + b_step(); + // if(removecomflag) remove_com_motion(); + if(method==NMPIMD) + { + inter_replica_comm(x); + if(cmode == SINGLE_PROC) nmpimd_transform(bufsortedall, x, M_x2xp[universe->iworld]); + else if(cmode == MULTI_PROC) nmpimd_transform(bufbeads, x, M_x2xp[universe->iworld]); + // nmpimd_transform(bufbeads, x, M_x2xp[universe->iworld]); + } + qc_step(); + a_step(); + if(tstat_flag) + { + o_step(); + // if(removecomflag) remove_com_motion(); + if(pstat_flag) press_o_step(); + } + qc_step(); + a_step(); + } + else + { + error->universe_all(FLERR,"Unknown integrator parameter for fix pimd"); + } + collect_xc(); + compute_spring_energy(); + + if(method==NMPIMD) + { + inter_replica_comm(x); + if(cmode == SINGLE_PROC) nmpimd_transform(bufsortedall, x, M_xp2x[universe->iworld]); + else if(cmode == MULTI_PROC) nmpimd_transform(bufbeads, x, M_xp2x[universe->iworld]); + // nmpimd_transform(bufbeads, x, M_xp2x[universe->iworld]); + } + + + if(mapflag){ + for(int i=0; iunmap_inv(x[i], image[i]); + } + } + // printf("step = %d\ncell = %.16e %.16e %.16e\nvol = %.16e\n", update->ntimestep, domain->xprd, domain->yprd, domain->zprd, domain->xprd * domain->yprd * domain->zprd); + // printf("me = %d, step %d initial_integrate ends!\n", universe->me, update->ntimestep); +} + +/* ---------------------------------------------------------------------- */ + +void FixPIMDLangevin::final_integrate() +{ + if(pstat_flag) + { + compute_totke(); + compute_p_cv(); + press_v_step(); + } + b_step(); + // if(removecomflag) remove_com_motion(); + if(integrator==obabo) + { + if(tstat_flag) + { + o_step(); + // if(removecomflag) remove_com_motion(); + if(pstat_flag) press_o_step(); + } + } + else if(integrator==baoab) + { + + } + else + { + error->universe_all(FLERR,"Unknown integrator parameter for fix pimd"); + } +} + +/* ---------------------------------------------------------------------- */ + +void FixPIMDLangevin::post_force(int /*flag*/) +{ + // printf("step = %d\ncell = %.16e %.16e %.16e\nvol = %.16e\n", update->ntimestep, domain->xprd, domain->yprd, domain->zprd, domain->xprd * domain->yprd * domain->zprd); + if(atom->nmax > maxunwrap) reallocate_x_unwrap(); + if(atom->nmax > maxxc) reallocate_xc(); + // printf("me = %d, step %d post_force starts!\n", universe->me, update->ntimestep); + int nlocal = atom->nlocal; + double **x = atom->x; + double **f = atom->f; + imageint *image = atom->image; + tagint *tag = atom->tag; + for(int i=0; iunmap(x_unwrap[i], image[i]); + } + } + for(int i=0; imap(1); + // printf("in post_force, x_unwrap: %.6f %.6f %.6f xcall: %.6f %.6f %.6f xc: %.6f %.6f %.6f\n", x_unwrap[idx][0], x_unwrap[idx][1], x_unwrap[idx][2], xcall[0], xcall[1], xcall[2], xc[idx][0], xc[idx][1], xc[idx][2]); + // MPI_Barrier(universe->uworld); + // update_x_unwrap(); + // MPI_Barrier(universe->uworld); + // compute_xc(); + // MPI_Barrier(universe->uworld); + // if(mapflag) + // { + // for(int i=0; iunmap_inv(x[i], image[i]); + // } + // } + compute_vir(); + compute_vir_(); + // compute_t_prim(); + // compute_t_vir(); + compute_pote(); + if(method==NMPIMD) + { + inter_replica_comm(f); + if(cmode == SINGLE_PROC) nmpimd_transform(bufsortedall, f, M_x2xp[universe->iworld]); + else if(cmode == MULTI_PROC) nmpimd_transform(bufbeads, f, M_x2xp[universe->iworld]); + // nmpimd_transform(bufbeads, f, M_x2xp[universe->iworld]); + } + c_pe->addstep(update->ntimestep+1); + c_press->addstep(update->ntimestep+1); + // printf("me = %d, step %d post_force ends!\n", universe->me, update->ntimestep); +} + +/* ---------------------------------------------------------------------- */ + +void FixPIMDLangevin::end_of_step() +{ + compute_totke(); + // inv_volume = 1.0 / (domain->xprd * domain->yprd * domain->zprd); + // compute_p_prim(); + compute_p_cv(); + compute_tote(); + if(pstat_flag) compute_totenthalpy(); + + if(update->ntimestep % 10000 == 0) + { + if(universe->me==0) printf("This is the end of step %ld.\n", update->ntimestep); + } + // if(universe->me==0) printf("me = %d This is the end of step %ld.\n", universe->me, update->ntimestep); + // printf("me = %d This is the end of step %ld.\n\n", universe->me, update->ntimestep); +} + +void FixPIMDLangevin::collect_xc() +{ + int nlocal = atom->nlocal; + double **x = atom->x; + tagint *tag = atom->tag; + if(ireplica == 0) + { + if(cmode == SINGLE_PROC) + { + for(int i=0; imap(1); + // printf("in init_int, x: %.6f %.6f %.6f xcall: %.6f %.6f %.6f\n", x[idx][0], x[idx][1], x[idx][2], xcall[0], xcall[1], xcall[2]); + + if(cmode == MULTI_PROC) + { + // printf("trying to add\n"); + // MPI_Reduce(MPI_IN_PLACE, xcall, ntotal*3, MPI_DOUBLE, MPI_SUM, 0, world); + MPI_Allreduce(MPI_IN_PLACE, xcall, ntotal*3, MPI_DOUBLE, MPI_SUM, world); + // printf("added\n"); + } + } + MPI_Bcast(xcall, ntotal*3, MPI_DOUBLE, 0, universe->uworld); +} + +/* ---------------------------------------------------------------------- */ +/* +void FixPIMDLangevin::update_x_unwrap() +{ + // MPI_Barrier(universe->uworld); + // printf("me = %d, starting update_xu\n", universe->me); + int nlocal = atom->nlocal; + double **x = atom->x; + // delete x_unwrap; + // memory->sfree(x_unwrap); + // printf("me = %d, before deleting xu\n", universe->me); + delete [] x_unwrap; + x_unwrap = nullptr; + x_unwrap = (double*) memory->srealloc(x_unwrap, sizeof(double)*(nlocal+200)*3, "FixDPPimd::x_unwrap"); + // printf("me = %d, before newing xu\n", universe->me); + // x_unwrap = new double[nlocal*3]; + // printf("me = %d, doing xu\n", universe->me); + for(int i=0; ime); + // MPI_Barrier(universe->uworld); +} +*/ +/* ---------------------------------------------------------------------- */ +/* +void FixPIMDLangevin::compute_xc() +{ + int natoms = atom->natoms; + MPI_Barrier(universe->uworld); + comm_exec(atom->x); + MPI_Barrier(universe->uworld); + int nlocal = atom->nlocal; + delete [] xc; + xc = nullptr; + xc = (double*) memory->srealloc(xc, sizeof(double) * nlocal * 3, "FixDPPimd:xc"); + for(int i=0; inlocal; + int *type = atom->type; + double **v = atom->v; + double **f = atom->f; + + for(int i=0; inlocal; + double **x = atom->x; + double **v = atom->v; + tagint *tag = atom->tag; + double oldlo, oldhi; + if(!pstat_flag) { + if(universe->iworld == 0) + { + for(int i=0; intimestep, domain->xprd, domain->yprd, domain->zprd, domain->xprd * domain->yprd * domain->zprd); + if(universe->iworld == 0) + { + double expp[3], expq[3]; + // printf("pstyle = %d vw[0] = %.8e\n", pstyle, vw[0]); + if(pstyle == ISO) {vw[1] = vw[0]; vw[2] = vw[0];} + for(int j=0; j<3; j++) + { + expq[j] = exp(dtv * vw[j]); + expp[j] = exp(-dtv * vw[j]); + } + if(barostat == BZP) + { + for(int i=0; iboxlo[0]; + oldhi = domain->boxhi[0]; + + domain->boxlo[0] = (oldlo-fixedpoint[0])*expq[0] + fixedpoint[0]; + domain->boxhi[0] = (oldhi-fixedpoint[0])*expq[0] + fixedpoint[0]; + + oldlo = domain->boxlo[1]; + oldhi = domain->boxhi[1]; + domain->boxlo[1] = (oldlo-fixedpoint[1])*expq[1] + fixedpoint[1]; + domain->boxhi[1] = (oldhi-fixedpoint[1])*expq[1] + fixedpoint[1]; + + oldlo = domain->boxlo[2]; + oldhi = domain->boxhi[2]; + domain->boxlo[2] = (oldlo-fixedpoint[2])*expq[2] + fixedpoint[2]; + domain->boxhi[2] = (oldhi-fixedpoint[2])*expq[2] + fixedpoint[2]; + } + } + MPI_Barrier(universe->uworld); + MPI_Bcast(&domain->boxlo[0], 3, MPI_DOUBLE, 0, universe->uworld); + MPI_Bcast(&domain->boxhi[0], 3, MPI_DOUBLE, 0, universe->uworld); + domain->set_global_box(); + domain->set_local_box(); + } + volume = domain->xprd * domain->yprd * domain->zprd; + // printf("step = %d end qc_step\ncell = %.16e %.16e %.16e\nvol = %.16e\n", update->ntimestep, domain->xprd, domain->yprd, domain->zprd, domain->xprd * domain->yprd * domain->zprd); +} + +/* ---------------------------------------------------------------------- */ + +void FixPIMDLangevin::a_step(){ + int n = atom->nlocal; + double **x = atom->x; + double **v = atom->v; + double x0, x1, x2, v0, v1, v2; // three components of x[i] and v[i] + + if(universe->iworld != 0) + { + // printf("iworld = %d c = %.4e s = %.4e w = %.4e\n", universe->iworld, Lan_c[universe->iworld], Lan_s[universe->iworld], _omega_k[universe->iworld]); + for(int i=0; iiworld] * x0 + 1./_omega_k[universe->iworld] * Lan_s[universe->iworld] * v0; + x[i][1] = Lan_c[universe->iworld] * x1 + 1./_omega_k[universe->iworld] * Lan_s[universe->iworld] * v1; + x[i][2] = Lan_c[universe->iworld] * x2 + 1./_omega_k[universe->iworld] * Lan_s[universe->iworld] * v2; + v[i][0] = -1.*_omega_k[universe->iworld] * Lan_s[universe->iworld] * x0 + Lan_c[universe->iworld] * v0; + v[i][1] = -1.*_omega_k[universe->iworld] * Lan_s[universe->iworld] * x1 + Lan_c[universe->iworld] * v1; + v[i][2] = -1.*_omega_k[universe->iworld] * Lan_s[universe->iworld] * x2 + Lan_c[universe->iworld] * v2; + } + } +} + +/* ---------------------------------------------------------------------- */ +/* +void FixPIMDLangevin::remove_com_motion(){ + if(universe->iworld == 0) + { + // double **x = atom->x; + double **v = atom->v; + int *mask = atom->mask; + int nlocal = atom->nlocal; + if (dynamic) masstotal = group->mass(igroup); + double vcm[3]; + group->vcm(igroup,masstotal,vcm); + for (int i = 0; i < nlocal; i++) { + if (mask[i] & groupbit) { + v[i][0] -= vcm[0]; + v[i][1] -= vcm[1]; + v[i][2] -= vcm[2]; + } + } + } +} +*/ +/* ---------------------------------------------------------------------- */ + +void FixPIMDLangevin::baro_init() +{ + vw[0] = vw[1] = vw[2] = vw[3] = vw[4] = vw[5] = 0.0; + if(pstyle == ISO) {W = 3 * (atom->natoms) * tau_p * tau_p * np * kBT;} // consistent with the definition in i-Pi + // printf("tau_p = %.6e np = %.6e kBT = %.6e W = %.6e\n", tau_p, np, kBT, W);} + else if(pstyle == ANISO) {W = atom->natoms * tau_p * tau_p * np * kBT;} + Vcoeff = 1.0; + std::string out = fmt::format("\nInitializing PIMD {:s} barostat...\n", Barostats[barostat]); + out += fmt::format("The barostat mass is W = {:.16e}\n", W); + utils::logmesg(lmp, out); +} + +/* ---------------------------------------------------------------------- */ + +void FixPIMDLangevin::press_v_step() +{ + int nlocal = atom->nlocal; + double **f = atom->f; + double **v = atom->v; + int *type = atom->type; + volume = domain->xprd * domain->yprd * domain->zprd; + + if(pstyle == ISO) + { + if(barostat == BZP) + { + // printf("me = %d step = %d start press_v_step, baro.p = %.30e p_cv = %.30e\n", universe->me, update->ntimestep, W*vw[0], np*p_cv); + vw[0] += dtv * 3 * (volume * np * (p_cv - Pext) / force->nktv2p + Vcoeff / beta_np) / W; + // printf("me = %d step = %d add p-Pext, baro.p = %.30e\n", universe->me, update->ntimestep, W*vw[0]); + if(universe->iworld==0) + { + double dvw_proc = 0.0, dvw = 0.0; + for(int i = 0; i < nlocal; i++) + { + for(int j = 0; j < 3; j++) + { + dvw_proc += dtv2 * f[i][j] * v[i][j] / W + dtv3 * f[i][j] * f[i][j] / mass[type[i]] / W; + } + } + MPI_Allreduce(&dvw_proc, &dvw, 1, MPI_DOUBLE, MPI_SUM, world); + vw[0] += dvw; + } + MPI_Barrier(universe->uworld); + MPI_Bcast(&vw[0], 1, MPI_DOUBLE, 0, universe->uworld); + // printf("me = %d step = %d end press_v_step, baro.p = %.30e\n\n", universe->me, update->ntimestep, W*vw[0]); + } + else if(barostat == MTTK) + { + mtk_term1 = 2. / atom->natoms * totke / 3; + f_omega = (volume * np * (p_md - Pext) + mtk_term1) / W; + vw[0] += 0.5 * dtv * f_omega; + } + } + else if(pstyle == ANISO) + { + compute_stress_tensor(); + for(int ii=0; ii<3; ii++) + { + vw[ii] += dtv * (volume * np * (stress_tensor[ii] - Pext) / force->nktv2p + Vcoeff / beta_np) / W; + if(universe->iworld==0) + { + double dvw_proc = 0.0, dvw = 0.0; + for(int i = 0; i < nlocal; i++) + { + dvw_proc += dtv2 * f[i][ii] * v[i][ii] / W + dtv3 * f[i][ii] * f[i][ii] / mass[type[i]] / W; + } + MPI_Allreduce(&dvw_proc, &dvw, 1, MPI_DOUBLE, MPI_SUM, world); + vw[ii] += dvw; + } + } + } +} + +/* ---------------------------------------------------------------------- */ + +void FixPIMDLangevin::press_o_step() +{ + if(pstyle==ISO) + { + if(universe->me==0) + { + r1 = random->gaussian(); + vw[0] = c1 * vw[0] + c2 * sqrt(1. / W / beta_np) * r1; + } + MPI_Barrier(universe->uworld); + MPI_Bcast(&vw[0], 1, MPI_DOUBLE, 0, universe->uworld); + } + else if(pstyle==ANISO) + { + if(universe->me==0) + { + r1 = random->gaussian(); + r2 = random->gaussian(); + r3 = random->gaussian(); + vw[0] = c1 * vw[0] + c2 * sqrt(1. / W / beta_np) * r1; + vw[1] = c1 * vw[1] + c2 * sqrt(1. / W / beta_np) * r2; + vw[2] = c1 * vw[2] + c2 * sqrt(1. / W / beta_np) * r3; + } + MPI_Barrier(universe->uworld); + MPI_Bcast(&vw, 3, MPI_DOUBLE, 0, universe->uworld); + } +} + +/* ---------------------------------------------------------------------- */ + +void FixPIMDLangevin::Langevin_init() +{ + // printf("in Langevin_init\n"); + double beta = 1.0 / kBT; + _omega_np = np / beta / hbar; + double _omega_np_dt_half = _omega_np * update->dt * 0.5; + // printf("omega_np = %.4e wdt = %.4e\n", _omega_np, _omega_np_dt_half); + + _omega_k = new double[np]; + Lan_c = new double[np]; + Lan_s = new double[np]; + if(fmmode==physical){ + for (int i=0; i 0) gamma = 1.0 / tau; + else gamma = np / beta / hbar; + + if(integrator==obabo) c1 = exp(-gamma * 0.5 * update->dt); // tau is the damping time of the centroid mode. + else if(integrator==baoab) c1 = exp(-gamma * update->dt); + else error->universe_all(FLERR, "Unknown integrator parameter for fix pimd. Only obabo and baoab integrators is supported!"); + + c2 = sqrt(1.0 - c1 * c1); // note that c1 and c2 here only works for the centroid mode. + + if( thermostat == PILE_L ) + { + std::string out = "\nInitializing PI Langevin equation thermostat...\n"; + out += "Bead ID | omega | tau | c1 | c2\n"; + tau_k = new double[np]; + c1_k = new double[np]; + c2_k = new double[np]; + tau_k[0] = tau; c1_k[0] = c1; c2_k[0] = c2; + for(int i=1; idt / tau_k[i]); + else if(integrator==baoab) c1_k[i] = exp(-1.0 * update->dt / tau_k[i]); + else error->universe_all(FLERR, "Unknown integrator parameter for fix pimd. Only obabo and baoab integrators is supported!"); + c2_k[i] = sqrt(1.0 - c1_k[i] * c1_k[i]); + } + for(int i=0; inlocal; + int *type = atom->type; + double beta_np = 1.0 / force->boltz / Lan_temp / np * force->mvv2e; + if(thermostat == PILE_L) + { + for(int i=0; igaussian(); + r2 = random->gaussian(); + r3 = random->gaussian(); + atom->v[i][0] = c1_k[universe->iworld] * atom->v[i][0] + c2_k[universe->iworld] * sqrt(1.0 / mass[type[i]] / beta_np) * r1; + atom->v[i][1] = c1_k[universe->iworld] * atom->v[i][1] + c2_k[universe->iworld] * sqrt(1.0 / mass[type[i]] / beta_np) * r2; + atom->v[i][2] = c1_k[universe->iworld] * atom->v[i][2] + c2_k[universe->iworld] * sqrt(1.0 / mass[type[i]] / beta_np) * r3; + } + } +} + +/* ---------------------------------------------------------------------- + Normal Mode PIMD +------------------------------------------------------------------------- */ + +void FixPIMDLangevin::nmpimd_init() +{ + memory->create(M_x2xp, np, np, "fix_feynman:M_x2xp"); + memory->create(M_xp2x, np, np, "fix_feynman:M_xp2x"); + + lam = (double*) memory->smalloc(sizeof(double)*np, "FixPIMDLangevin::lam"); + + // Set up eigenvalues + for(int i=0; iiworld; + for(int i=1; i<=atom->ntypes; i++) + { + mass[i] = atom->mass[i]; + if(iworld) + { + if(fmmode==physical) { mass[i] *= 1.0; } + else if(fmmode==normal) { mass[i] *= lam[iworld]; } + mass[i] *= fmass; + } + } +} + +/* ---------------------------------------------------------------------- */ + +void FixPIMDLangevin::nmpimd_transform(double **src, double **des, double *vector) +{ + if(cmode == SINGLE_PROC) + { + for(int i=0; itag[i]; + for(int d=0; d<3; d++) + { + des[i][d] = bufsorted[tagtmp-1][d]; + } + } + } + else if(cmode == MULTI_PROC) + { + int n = atom->nlocal; + int m = 0; + + for (int i = 0; i < n; i++) + for (int d = 0; d < 3; d++) { + des[i][d] = 0.0; + for (int j = 0; j < np; j++) { des[i][d] += (src[j][m] * vector[j]); } + m++; + } + } +} + +/* ---------------------------------------------------------------------- + Comm operations +------------------------------------------------------------------------- */ + +void FixPIMDLangevin::comm_init() +{ + // if(me == 0){ + if (sizeplan) { + delete [] plansend; + delete [] planrecv; + } + + sizeplan = np - 1; + plansend = new int[sizeplan]; + planrecv = new int[sizeplan]; + modeindex = new int[sizeplan]; + for (int i = 0; i < sizeplan; i++) { + int isend, irecv; + isend = ireplica + i + 1; + if (isend >= nreplica) isend -= nreplica; + irecv = ireplica - (i + 1); + if (irecv < 0) irecv += nreplica; + plansend[i] = universe->root_proc[isend]; + planrecv[i] = universe->root_proc[irecv]; + modeindex[i] = irecv; + } + // } +} + +/* ---------------------------------------------------------------------- */ +/* +void FixPIMDLangevin::init_x_unwrap() +{ + maxunwrap = atom->nmax; + memory->destroy(x_unwrap); + memory->destroy(tag_init); + memory->destroy(image_init); + memory->destroy(x_unwrapsort); + memory->create(x_unwrap, maxunwrap, 3, "FixPIMDLangevin:x_unwrap"); + memory->create(tag_init, maxunwrap, "FixPIMDLangevin:tag_init"); + memory->create(image_init, maxunwrap, "FixPIMDLangevin:image_init"); + memory->create(x_unwrapsort, ntotal, 3, "FixPIMDLangevin:x_unwrapsort"); +} +*/ +/* ---------------------------------------------------------------------- */ + +void FixPIMDLangevin::reallocate_xc() +{ + maxxc = atom->nmax; + memory->destroy(xc); + memory->create(xc, maxxc, 3, "FixPIMDLangevin:xc"); +} + +/* ---------------------------------------------------------------------- */ + +void FixPIMDLangevin::reallocate_x_unwrap() +{ + maxunwrap = atom->nmax; + memory->destroy(x_unwrap); + memory->create(x_unwrap, maxunwrap, 3, "FixPIMDLangevin:x_unwrap"); +} + +/* ---------------------------------------------------------------------- */ + +void FixPIMDLangevin::reallocate() +{ + maxlocal = atom->nmax; + memory->destroy(bufsend); + memory->destroy(bufrecv); + memory->destroy(tagsend); + memory->destroy(tagrecv); + memory->destroy(bufbeads); + memory->create(bufsend, maxlocal, 3, "FixPIMDLangevin:bufsend"); + memory->create(bufrecv, maxlocal, 3, "FixPIMDLangevin:bufrecv"); + memory->create(tagsend, maxlocal, "FixPIMDLangevin:tagsend"); + memory->create(tagrecv, maxlocal, "FixPIMDLangevin:tagrecv"); + memory->create(bufbeads, nreplica, maxlocal*3, "FixPIMDLangevin:bufrecv"); +} + +/* ---------------------------------------------------------------------- */ + +void FixPIMDLangevin::inter_replica_comm(double **ptr) +{ + MPI_Request requests[2]; + MPI_Status statuses[2]; + if (atom->nmax > maxlocal) reallocate(); + int nlocal = atom->nlocal; + // printf("me = %d starting inter_comm, nlocal = %d ntotal = %d\n", universe->me, nlocal, ntotal); + tagint *tag = atom->tag; + int i, m; + + // copy local values + for(i=0; itag[i]; + bufsorted[tagtmp-1][0] = ptr[i][0]; + bufsorted[tagtmp-1][1] = ptr[i][1]; + bufsorted[tagtmp-1][2] = ptr[i][2]; + m++; + } + MPI_Allgather(&m, 1, MPI_INT, counts, 1, MPI_INT, universe->uworld); + for (i = 0; i < nreplica; i++) { counts[i] *= 3; } + displacements[0] = 0; + for (i = 0; i < nreplica-1; i++) { displacements[i+1] = displacements[i] + counts[i]; } + MPI_Allgatherv(bufsorted[0], 3*m, MPI_DOUBLE, bufsortedall[0], counts, displacements, MPI_DOUBLE, universe->uworld); + // printf("me = %d bufsortedall[0] = %.8f %.8f %.8f bufsortedall[ntotal] = %.8f %.8f %.8f\n", universe->iworld, bufsortedall[0][0], bufsortedall[0][1], bufsortedall[0][2], bufsortedall[ntotal][0], bufsortedall[ntotal][1], bufsortedall[ntotal][2]); + /* + m = 0; + for(i=0; ime, nlocal, ntotal, m, sizeplan); + for(int iplan=0; iplanuworld, &requests[0]); + MPI_Irecv(tagrecv, ntotal, MPI_LMP_TAGINT, planrecv[iplan], 0, universe->uworld, &requests[1]); + // printf("me = %d iplan = %d irecv finished, plansend = %d, planrecv = %d, modeindex = %d\n", universe->me, iplan, plansend[iplan], planrecv[iplan], modeindex[iplan]); + // printf("bufsend[0]: %.4f %.4f %.4f\ntagsend[0]: %d\n", bufsend[0][0], bufsend[0][1], bufsend[0][2], tagsend[0]); + // printf("bufsend[255]: %.4f %.4f %.4f\ntagsend[255]: %d\n", bufsend[255][0], bufsend[255][1], bufsend[255][2], tagsend[255]); + MPI_Send(bufsend[0], 3*ntotal, MPI_DOUBLE, plansend[iplan], 0, universe->uworld); + MPI_Send(tagsend, ntotal, MPI_LMP_TAGINT, plansend[iplan], 0, universe->uworld); + // printf("me = %d MPI_Send done\n", universe->me); + MPI_Waitall(2, requests, statuses); + // printf("me = %d iplan = %d send recv finished\n", iplan, universe->me); + for(i=0; imap(tagrecv[i]); + bufbeads[modeindex[iplan]][3*m+0] = bufrecv[i][0]; + bufbeads[modeindex[iplan]][3*m+1] = bufrecv[i][1]; + bufbeads[modeindex[iplan]][3*m+2] = bufrecv[i][2]; + } + } + */ + // printf("me = %d finishing inter_comm\n", universe->me); + } + else if(cmode == MULTI_PROC) + { + m = 0; + // printf("me = %d trying to copy bufsend\n", universe->me); + for(i=0; ime, m); + // if(me==0) {for(i=0; ime, i, counts[i]);}} + // printf("me = %d") + MPI_Gather(&m, 1, MPI_INT, counts, 1, MPI_INT, 0, world); + // printf("me = %d counts gathered\n", universe->me); + // if(me==0) {for(i=0; ime, i, counts[i]);}} + displacements[0] = 0; + // printf("me = %d displacements[0] = %d\n", universe->me, displacements[0]); + for (i = 0; i < nprocs-1; i++) { displacements[i+1] = displacements[i] + counts[i]; } + // printf("me = %d displacements done\n", universe->me); + // if(me==0) {for(i=0; ime, i, displacements[i]);}} + MPI_Gatherv(tagsend, m, MPI_LMP_TAGINT, tagsendall, counts, displacements, MPI_LMP_TAGINT, 0, world); + // printf("me = %d tags gathered\n", universe->me); + for (i = 0; i < nprocs; i++) { counts[i] *= 3; } + for (i = 0; i < nprocs-1; i++) { displacements[i+1] = displacements[i] + counts[i]; } + MPI_Gatherv(bufsend[0], 3*m, MPI_DOUBLE, bufsendall[0], counts, displacements, MPI_DOUBLE, 0, world); + // printf("me = %d bufsend gathered\n", universe->me); + // printf("me = %d, tagrecvall[0] = %d bufrecvall[0][0] = %.4f\n", universe->me, tagrecvall[0], bufrecvall[0][0]); + + // printf("universe->me = %d comm->me = %d sizeplan = %d\n", universe->me, comm->me, sizeplan); + for(int iplan=0; iplanuworld, &requests[0]); + MPI_Irecv(tagrecvall, ntotal, MPI_LMP_TAGINT, planrecv[iplan], 0, universe->uworld, &requests[1]); + MPI_Send(bufsendall[0], 3*ntotal, MPI_DOUBLE, plansend[iplan], 0, universe->uworld); + MPI_Send(tagsendall, ntotal, MPI_LMP_TAGINT, plansend[iplan], 0, universe->uworld); + MPI_Waitall(2,requests,statuses); + } + // else{ + // printf("me = %d not sendrecceving\n", universe->me); + // } + + // printf("me = %d sendrecv finished\n", universe->me); + // printf("me = %d to be bcasted: tag[0] = %d bufrecvall[0][0] = %.4f\n", universe->me, tagrecvall[0], bufrecvall[0][0]); + MPI_Bcast(tagrecvall, ntotal, MPI_LMP_TAGINT, 0, world); + MPI_Bcast(bufrecvall[0], 3*ntotal, MPI_DOUBLE, 0, world); + // printf("me = %d broadcasted\n", universe->me); + for(i=0; imap(tagrecvall[i]); + if (m < 0 || m >= nlocal) continue; + bufbeads[modeindex[iplan]][3*m+0] = bufrecvall[i][0]; + bufbeads[modeindex[iplan]][3*m+1] = bufrecvall[i][1]; + bufbeads[modeindex[iplan]][3*m+2] = bufrecvall[i][2]; + } + } + // printf("me = %d, tag[0] = %d bufrecvall[0][0] = %.4f bufbeads[0][0] = %.4f bufbeads[1][0] = %.4f bufbeads done\n", universe->me, tag[0], bufrecvall[0][0], bufbeads[0][0], bufbeads[1][0]); + } +} + +/* ---------------------------------------------------------------------- */ +/* ---------------------------------------------------------------------- */ + +void FixPIMDLangevin::compute_vir_() +{ + int nlocal = atom->nlocal; + xf = vir_ = xcf = centroid_vir = 0.0; + int idx = atom->map(1); + // printf("in post_force, x_unwrap: %.6f %.6f %.6f xcall: %.6f %.6f %.6f\n", x_unwrap[idx][0], x_unwrap[idx][1], x_unwrap[idx][2], xcall[0], xcall[1], xcall[2]); + // printf("in compute_vir, xu = %.6f %.6f %.6f xc = %.6f %.6f %.6f\n", x_unwrap[idx][0], x_unwrap[idx][1], x_unwrap[idx][2], xc[idx][0], xc[idx][1], xc[idx][2]); + for(int i=0; if[i][j]; + xcf += (x_unwrap[i][j] - xc[i][j]) * atom->f[i][j]; + } + // int idx = atom->map(i+1); + // printf("me = %d step = %d tag = %d idx = %d xu = %.6f %.6f %.6f xc = %.6f %.6f %.6f f = %.6f %.6f %.6f\n", universe->me, update->ntimestep, i+1, idx, x_unwrap[idx][0], x_unwrap[idx][1], x_unwrap[idx][2], xc[idx][0], xc[idx][1], xc[idx][2], atom->f[idx][0], atom->f[idx][1], atom->f[idx][2]); + } + MPI_Allreduce(&xf, &vir_, 1, MPI_DOUBLE, MPI_SUM, universe->uworld); + MPI_Allreduce(&xcf, ¢roid_vir, 1, MPI_DOUBLE, MPI_SUM, universe->uworld); + if(pstyle == ANISO){ + for(int i=0; i<6; i++) c_vir_tensor[i] = 0.0; + for(int i=0; if[i][0]; + c_vir_tensor[1] += (x_unwrap[i][1] - xc[i][1]) * atom->f[i][1]; + c_vir_tensor[2] += (x_unwrap[i][2] - xc[i][2]) * atom->f[i][2]; + c_vir_tensor[3] += (x_unwrap[i][0] - xc[i][0]) * atom->f[i][1]; + c_vir_tensor[4] += (x_unwrap[i][0] - xc[i][0]) * atom->f[i][2]; + c_vir_tensor[5] += (x_unwrap[i][1] - xc[i][1]) * atom->f[i][2]; + } + MPI_Allreduce(MPI_IN_PLACE, &c_vir_tensor, 6, MPI_DOUBLE, MPI_SUM, universe->uworld); + } +} + +/* ---------------------------------------------------------------------- */ + +void FixPIMDLangevin::compute_vir() +{ + volume = domain->xprd * domain->yprd * domain->zprd; + c_press->compute_vector(); + virial[0] = c_press->vector[0]*volume; + virial[1] = c_press->vector[1]*volume; + virial[2] = c_press->vector[2]*volume; + virial[3] = c_press->vector[3]*volume; + virial[4] = c_press->vector[4]*volume; + virial[5] = c_press->vector[5]*volume; + for(int i=0; i<6; i++) virial[i] /= universe->procs_per_world[universe->iworld]; + double vir_bead=(virial[0]+virial[1]+virial[2]); + MPI_Allreduce(&vir_bead, &vir, 1, MPI_DOUBLE, MPI_SUM, universe->uworld); + MPI_Allreduce(MPI_IN_PLACE, &virial[0], 6, MPI_DOUBLE, MPI_SUM, universe->uworld); + // printf("me = %d step = %d vir = %.30e\n", universe->me, update->ntimestep, vir); +} + +/* ---------------------------------------------------------------------- */ + +void FixPIMDLangevin::compute_stress_tensor() +{ + int nlocal = atom->nlocal; + int *type = atom->type; + if(universe->iworld == 0){ + inv_volume = 1.0 / (domain->xprd * domain->yprd * domain->zprd); + for(int i=0; i<6; i++) ke_tensor[i] = 0.0; + for(int i=0; iv[i][0] * atom->v[i][0] * force->mvv2e; + ke_tensor[1] += 0.5 * mass[type[i]] * atom->v[i][1] * atom->v[i][1] * force->mvv2e; + ke_tensor[2] += 0.5 * mass[type[i]] * atom->v[i][2] * atom->v[i][2] * force->mvv2e; + ke_tensor[3] += 0.5 * mass[type[i]] * atom->v[i][0] * atom->v[i][1] * force->mvv2e; + ke_tensor[4] += 0.5 * mass[type[i]] * atom->v[i][0] * atom->v[i][2] * force->mvv2e; + ke_tensor[5] += 0.5 * mass[type[i]] * atom->v[i][1] * atom->v[i][2] * force->mvv2e; + } + // MPI_Allreduce(&ke_tensor, &ke_tensor, 6, MPI_DOUBLE, MPI_SUM, world); + MPI_Allreduce(MPI_IN_PLACE, &ke_tensor, 6, MPI_DOUBLE, MPI_SUM, world); + for(int i=0; i<6; i++) + { + stress_tensor[i] = inv_volume * ((2*ke_tensor[i] - c_vir_tensor[i]) * force->nktv2p + virial[i]) / np; + // printf("i = %d, c_vir = %.6f, virial = %.6f stress = %.6f\n", i, c_vir_tensor[i], virial[i], stress_tensor[i]); + } + } + MPI_Bcast(&stress_tensor, 6, MPI_DOUBLE, 0, universe->uworld); +} + +/* ---------------------------------------------------------------------- */ + +void FixPIMDLangevin::compute_totke() +{ + kine = 0.0; + totke = ke_bead = 0.0; + int nlocal = atom->nlocal; + int *type = atom->type; + for(int i=0; iv[i][j] * atom->v[i][j]; + } + } + kine *= force->mvv2e; + // printf("me = %d, kine = %.6e\n", universe->me, kine); + MPI_Allreduce(&kine, &ke_bead, 1, MPI_DOUBLE, MPI_SUM, world); + // MPI_Allreduce(&kine, &totke, 1, MPI_DOUBLE, MPI_SUM, universe->uworld); + // totke *= force->mvv2e / np; + + // c_press->compute_scalar(); +} + +/* ---------------------------------------------------------------------- */ + +void FixPIMDLangevin::compute_spring_energy() +{ + spring_energy = 0.0; + total_spring_energy = se_bead = 0.0; + + double **x = atom->x; + double* _mass = atom->mass; + int* type = atom->type; + int nlocal = atom->nlocal; + // printf("iworld = %d, fbond = %.4e lam = %.4e\n", universe->iworld, fbond, lam[universe->iworld]); + + for(int i=0; iiworld] * (x[i][0]*x[i][0] + x[i][1]*x[i][1] + x[i][2]*x[i][2]); + } + MPI_Allreduce(&spring_energy, &se_bead, 1, MPI_DOUBLE, MPI_SUM, world); + // MPI_Allreduce(&spring_energy, &total_spring_energy, 1, MPI_DOUBLE, MPI_SUM, universe->uworld); + // total_spring_energy /= np; +} + +/* ---------------------------------------------------------------------- */ + +void FixPIMDLangevin::compute_pote() +{ + pe_bead = 0.0; + pot_energy_partition = 0.0; + pote = 0.0; + c_pe->compute_scalar(); + pe_bead = c_pe->scalar; + pot_energy_partition = pe_bead / universe->procs_per_world[universe->iworld]; + // MPI_Allreduce(&pot_energy_partition, &pote, 1, MPI_DOUBLE, MPI_SUM, universe->uworld); + // pote /= np; +} + +/* ---------------------------------------------------------------------- */ + +void FixPIMDLangevin::compute_tote() +{ + tote = totke + pote + total_spring_energy; +} + +/* ---------------------------------------------------------------------- */ +/* +void FixPIMDLangevin::compute_t_prim() +{ + t_prim = 1.5 * atom->natoms * np * force->boltz * temp - total_spring_energy; +} +*/ +/* ---------------------------------------------------------------------- */ +/* +void FixPIMDLangevin::compute_t_vir() +{ + t_vir = -0.5 / np * vir_; + t_cv = 1.5 * atom->natoms * force->boltz * temp - 0.5 / np * centroid_vir; +} +*/ +/* ---------------------------------------------------------------------- */ +/* +void FixPIMDLangevin::compute_p_prim() +{ + p_prim = atom->natoms * np * force->boltz * temp * inv_volume - 1.0 / 1.5 * inv_volume * total_spring_energy; + p_prim *= force->nktv2p; +} +*/ +/* ---------------------------------------------------------------------- */ + +void FixPIMDLangevin::compute_p_cv() +{ + inv_volume = 1.0 / (domain->xprd * domain->yprd * domain->zprd); + // p_md = 2. / 3 * inv_volume * ((totke - total_spring_energy) * force->nktv2p + 0.5 * vir / np) ; + // printf("inv_V = %.30e ke = %.30e cv = %.30e vir = %.30e\n", inv_volume, ke_bead, centroid_vir, vir); + if(universe->iworld == 0) + { + p_cv = 1. / 3. * inv_volume * ((2. * ke_bead - 1. * centroid_vir) * force->nktv2p + 1. * vir) / np; + } + MPI_Bcast(&p_cv, 1, MPI_DOUBLE, 0, universe->uworld); +} + +/* ---------------------------------------------------------------------- */ + +void FixPIMDLangevin::compute_totenthalpy() +{ + volume = domain->xprd * domain->yprd * domain->zprd; + if(barostat == BZP) + { + if(pstyle == ISO) + { + totenthalpy = tote + 0.5*W*vw[0]*vw[0]/np + Pext * volume / force->nktv2p - Vcoeff * kBT * log(volume); + } + else if(pstyle == ANISO) + { + totenthalpy = tote + 0.5*W*vw[0]*vw[0]/np + 0.5*W*vw[1]*vw[1]/np + 0.5*W*vw[2]*vw[2]/np + Pext * volume / force->nktv2p - Vcoeff * kBT * log(volume); + } + } + else if(barostat == MTTK) totenthalpy = tote + 1.5*W*vw[0]*vw[0]/np + Pext * (volume - vol0); +} + +/* ---------------------------------------------------------------------- */ + +double FixPIMDLangevin::compute_vector(int n) +{ + if(n==0) { return ke_bead; } + if(n==1) { return se_bead; } + if(n==2) { return pe_bead; } + if(n==3) { return tote; } + // if(n==3) { return W*vw[0]; } + if(!pstat_flag) + { + if(n==4) { return t_prim; } + if(n==5) { return t_vir; } + if(n==6) { return t_cv; } + } + else if(pstat_flag) + { + if(pstyle == ISO) + { + if(barostat == BZP) + { + if(n==4) { return 0.5*W*vw[0]*vw[0]; } + } + else if(barostat == MTTK) + { + if(n==4) { return 1.5*W*vw[0]*vw[0]; } + } + if(n==5) { volume = domain->xprd * domain->yprd * domain->zprd; return np * Pext * volume / force->nktv2p; } + if(n==6) { volume = domain->xprd * domain->yprd * domain->zprd; return - Vcoeff * np * kBT * log(volume); } + if(n==7) { return totenthalpy; } + if(n==8) { return p_cv; } + if(n==9) { return total_spring_energy; } + } + else if(pstyle == ANISO) + { + + } + } + /* + + if(n==7) { return p_prim; } + if(n==8) { return p_md; } + if(n==9) { return p_cv; } + if(n==10) {return totenthalpy; + if(pstyle == ISO){ + if(n==11) { return vw[0]; } + if(n==12) { + if(barostat == BZP) { return 0.5*W*vw[0]*vw[0]; } + else if(barostat == MTTK) { return 1.5*W*vw[0]*vw[0]; } + } + if(n==13) { volume = domain->xprd * domain->yprd * domain->zprd; return np * Pext * volume / force->nktv2p; } + if(n==14) { volume = domain->xprd * domain->yprd * domain->zprd; + // printf("Vcoeff = %.6e np = %d kBT = %.6e logV = %.6e\n", Vcoeff, np, kBT, log(volume)); + return - Vcoeff * np * kBT * log(volume); } + } + else if(pstyle==ANISO){ + if(n>10 && n<=13) return vw[n-11]; + if(n==14) return 0.5*W*vw[0]*vw[0]+0.5*W*vw[1]*vw[1]+0.5*W*vw[2]*vw[2]; + if(n>14 && n<21) return stress_tensor[n-15]; + if(n==21) { volume = domain->xprd * domain->yprd * domain->zprd; return np * Pext * volume / force->nktv2p; } + if(n==22) { volume = domain->xprd * domain->yprd * domain->zprd; return - Vcoeff * np * kBT * log(volume); } + } + return 0.0; + */ +} diff --git a/src/REPLICA/fix_pimd_langevin.h b/src/REPLICA/fix_pimd_langevin.h new file mode 100644 index 0000000000..02e78935aa --- /dev/null +++ b/src/REPLICA/fix_pimd_langevin.h @@ -0,0 +1,198 @@ +/* -*- c++ -*- ---------------------------------------------------------- + LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator + https://www.lammps.org/, Sandia National Laboratories + LAMMPS development team: developers@lammps.org + + 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. +------------------------------------------------------------------------- */ + +#ifdef FIX_CLASS +// clang-format off +FixStyle(pimd/langevin,FixPIMDLangevin); +// clang-format on +#else + +#ifndef FIX_PIMD_LANGEVIN_H +#define FIX_PIMD_LANGEVIN_H + +#include "fix.h" + +namespace LAMMPS_NS { + +class FixPIMDLangevin : public Fix { + public: + FixPIMDLangevin(class LAMMPS *, int, char **); + ~FixPIMDLangevin() override; + + int setmask() override; + + void init() override; + void setup(int) override; +// void post_neighbor() override; + void post_force(int) override; + void initial_integrate(int) override; + void final_integrate() override; + void end_of_step() override; + + double compute_vector(int) override; + + /* System setting variables */ + int method; // PIMD or NMPIMD or CMD + int fmmode; // physical or normal + int np; // number of beads + double inverse_np; // 1.0/np + double temp; // temperature + double planck, hbar; // Planck's constant + double lj_epsilon, lj_sigma, lj_mass; // LJ unit energy, length, and mass scales + double other_planck; + double kBT; // k_B * temp + double beta, beta_np; // beta = 1./kBT beta_np = 1./kBT/np + int thermostat; // NHC or PILE_L + int barostat; // BZP + int integrator; // obabo or baoab + int ensemble; // nve or nvt or nph or npt + int mapflag; // should be 1 if number of beads > 1 + int removecomflag; + double masstotal; + + // void remove_com_motion(); + + double fixedpoint[3]; // location of dilation fixed-point + /* ring-polymer model */ + + double omega_np, fbond, spring_energy, sp; + + /* fictitious mass */ + + double fmass, *mass; + + /* inter-partition communication */ + + MPI_Comm rootworld; + int me, nprocs, ireplica, nreplica, nprocs_universe; + int ntotal, maxlocal; + + int cmode; + int sizeplan; + int *plansend, *planrecv; + + tagint *tagsend, *tagrecv; + double **bufsend, **bufrecv, **bufbeads; + double **bufsorted, **bufsortedall; + double **outsorted, **buftransall; + + tagint *tagsendall, *tagrecvall; + double **bufsendall, **bufrecvall; + + int *counts, *displacements; + + void comm_init(); + void inter_replica_comm(double **ptr); + + /* normal-mode operations */ + + double *lam, **M_x2xp, **M_xp2x, **M_f2fp, **M_fp2f; + int *modeindex; + + void reallocate(); + void nmpimd_init(); + void nmpimd_transform(double **src, double **des, double **mat); + void nmpimd_transform(double **, double **, double *); + + /* Langevin integration */ + + double dtv, dtf, dtv2, dtv3; + double gamma, c1, c2, tau; + double *tau_k, *c1_k, *c2_k; + double pilescale=1.0; + double Lan_temp; + double r1, r2, r3; + double _omega_np, *_omega_k, *Lan_s, *Lan_c; // sin(omega_k*dt*0.5), cos(omega_k*dt*0.5) + + class RanMars *random; + int seed=975481; + FILE *frand; + + int tstat_flag; // tstat_flat = 1 if thermostat if used + void Langevin_init(); + void b_step(); // integrate for dt/2 according to B part (v <- v + f * dt/2) + void a_step(); // integrate for dt/2 according to A part (non-centroid mode, harmonic force between replicas) + void qc_step(); // integrate for dt/2 for the centroid mode (x <- x + v * dt/2) + void o_step(); // integrate for dt according to O part (O-U process, for thermostating) + + /* Bussi-Zykova-Parrinello barostat */ + + double f_omega, mtk_term1; + int pstat_flag; // pstat_flag = 1 if barostat is used + int pstyle; // pstyle = ISO or ANISO (will support TRICLINIC in the future) + double W, tau_p, Pext, totenthalpy = 0.0, Vcoeff; + int p_flag[6]; + double vw[6]; // barostat velocity + double ke_tensor[6]; // kinetic energy tensor + double c_vir_tensor[6]; // centroid-virial tensor + double stress_tensor[6]; // path integral centroid-virial stress tensor + + void baro_init(); + void press_v_step(); + void press_o_step(); + + /* centroid-virial estimator computation */ + double vol0 = 0.0; + double inv_volume = 0.0; + // double inv_volume = 0.0, vol_ = 0.0, vol0 = 0.0; + double volume = 0.0; + double **xc, *xcall; + int maxxc; + // int n_unwrap; + int maxunwrap; + // int maxunwrap, nlocal_init; +// tagint *tag_init, *tag_initall; +// imageint *image_init, *image_initall; + double **x_unwrap; +// double **x_unwrap, **x_unwrapsort; +// double **x_unwrapall; +// void init_x_unwrap(); + void reallocate_x_unwrap(); + void reallocate_xc(); + void collect_xc(); + // void compute_xc(); + // void compute_fc(); + double xf, vir, vir_, xcf, centroid_vir; + double t_vir, t_cv, p_prim, p_vir, p_cv, p_cv_, p_md; + // double vir_, xcf, vir2; + + /* Computes */ + double kine, pote, tote, totke; + double ke_bead, se_bead, pe_bead, pot_energy_partition; + double total_spring_energy; + double t_prim; + // double p_prim; + char *id_pe; + char *id_press; + class Compute *c_pe; + class Compute *c_press; + + void compute_totke(); // 1: kinetic energy + void compute_spring_energy(); // 2: spring elastic energy + void compute_pote(); // 3: potential energy + void compute_tote(); // 4: total energy: 1+2+3 for all the beads + // void compute_t_prim(); // 5: primitive kinetic energy estimator + // void compute_p_prim(); // primitive pressure estimator + void compute_stress_tensor(); + // void compute_t_vir(); // centroid-virial kinetic energy estimator + void compute_p_cv(); // centroid-virial pressure estimator + // void compute_p_vir(); // centroid-virial pressure estimator + void compute_vir(); + void compute_vir_(); + void compute_totenthalpy(); +}; + +} // namespace LAMMPS_NS + +#endif +#endif From c351b63919f8646cb7943742e6cffed32aa52d79 Mon Sep 17 00:00:00 2001 From: Yifan Li Date: Fri, 24 Feb 2023 11:48:28 -0500 Subject: [PATCH 010/396] fix pimd/langevin put properties and functions below protected --- src/REPLICA/fix_pimd_langevin.h | 1 + 1 file changed, 1 insertion(+) diff --git a/src/REPLICA/fix_pimd_langevin.h b/src/REPLICA/fix_pimd_langevin.h index 02e78935aa..4f0390c700 100644 --- a/src/REPLICA/fix_pimd_langevin.h +++ b/src/REPLICA/fix_pimd_langevin.h @@ -41,6 +41,7 @@ class FixPIMDLangevin : public Fix { double compute_vector(int) override; + protected: /* System setting variables */ int method; // PIMD or NMPIMD or CMD int fmmode; // physical or normal From 3737b5f774b99ed5d8a34b10de6057817afbb875 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Sat, 25 Feb 2023 16:22:27 -0500 Subject: [PATCH 011/396] whitespace fixes and clang-format on the header --- src/REPLICA/fix_pimd_langevin.cpp | 90 +++++++++++++++---------------- src/REPLICA/fix_pimd_langevin.h | 86 ++++++++++++++--------------- 2 files changed, 86 insertions(+), 90 deletions(-) diff --git a/src/REPLICA/fix_pimd_langevin.cpp b/src/REPLICA/fix_pimd_langevin.cpp index 9ac8fc3b17..1b2e734922 100644 --- a/src/REPLICA/fix_pimd_langevin.cpp +++ b/src/REPLICA/fix_pimd_langevin.cpp @@ -146,7 +146,7 @@ FixPIMDLangevin::FixPIMDLangevin(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, n fmass = utils::numeric(FLERR, arg[i + 1], false, lmp); if (fmass < 0.0 || fmass > 1.0) error->universe_all(FLERR, "Invalid fmass value for fix pimd"); - } + } else if(strcmp(arg[i], "fmmode")==0) { @@ -164,7 +164,7 @@ FixPIMDLangevin::FixPIMDLangevin(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, n else if (strcmp(arg[i], "temp") == 0) { temp = utils::numeric(FLERR, arg[i + 1], false, lmp); if (temp < 0.0) error->universe_all(FLERR, "Invalid temp value for fix pimd"); - } + } else if (strcmp(arg[i], "lj") == 0) { lj_epsilon = utils::numeric(FLERR, arg[i+1], false, lmp); @@ -178,7 +178,7 @@ FixPIMDLangevin::FixPIMDLangevin(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, n else if(strcmp(arg[i], "thermostat")==0) { - if(strcmp(arg[i+1],"PILE_L")==0) + if(strcmp(arg[i+1],"PILE_L")==0) { thermostat = PILE_L; seed = atoi(arg[i+2]); @@ -190,7 +190,7 @@ FixPIMDLangevin::FixPIMDLangevin(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, n { tau = atof(arg[i+1]); } - + else if(strcmp(arg[i], "press")==0) { Pext = atof(arg[i+1]); @@ -199,7 +199,7 @@ FixPIMDLangevin::FixPIMDLangevin(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, n else if(strcmp(arg[i], "barostat")==0) { - if(strcmp(arg[i+1],"MTTK")==0) + if(strcmp(arg[i+1],"MTTK")==0) { barostat = MTTK; } @@ -292,7 +292,7 @@ FixPIMDLangevin::FixPIMDLangevin(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, n Lan_temp = temp; random = new RanMars(lmp, seed + universe->me); } - + me = comm->me; nprocs = comm->nprocs; if(nprocs == 1) cmode = SINGLE_PROC; @@ -385,7 +385,7 @@ void FixPIMDLangevin::init() inverse_np = 1.0 / np; const double Boltzmann = force->boltz; - if (strcmp(update->unit_style,"lj") == 0) { + if (strcmp(update->unit_style,"lj") == 0) { double planck_star = sqrt(lj_epsilon)*sqrt(atom->mass[0])*lj_sigma; planck = other_planck / planck_star; } @@ -517,10 +517,10 @@ void FixPIMDLangevin::setup(int vflag) // compute_pote(); // if(pstyle==ANISO) compute_stress_tensor(); end_of_step(); - c_pe->addstep(update->ntimestep+1); + c_pe->addstep(update->ntimestep+1); c_press->addstep(update->ntimestep+1); // printf("setup ending: \ncell = %.16e %.16e %.16e\nvol = %.16e\n", domain->xprd, domain->yprd, domain->zprd, domain->xprd * domain->yprd * domain->zprd); - // printf("me = %d, setup finished\n", universe->me); + // printf("me = %d, setup finished\n", universe->me); } /* ---------------------------------------------------------------------- */ @@ -557,7 +557,7 @@ void FixPIMDLangevin::initial_integrate(int /*vflag*/) press_v_step(); } /* - if(pstat_flag) + if(pstat_flag) { } */ @@ -580,7 +580,7 @@ void FixPIMDLangevin::initial_integrate(int /*vflag*/) } else if(integrator==baoab) { - if(pstat_flag) + if(pstat_flag) { compute_totke(); compute_p_cv(); @@ -604,7 +604,7 @@ void FixPIMDLangevin::initial_integrate(int /*vflag*/) if(pstat_flag) press_o_step(); } qc_step(); - a_step(); + a_step(); } else { @@ -612,7 +612,7 @@ void FixPIMDLangevin::initial_integrate(int /*vflag*/) } collect_xc(); compute_spring_energy(); - + if(method==NMPIMD) { inter_replica_comm(x); @@ -636,7 +636,7 @@ void FixPIMDLangevin::initial_integrate(int /*vflag*/) void FixPIMDLangevin::final_integrate() { - if(pstat_flag) + if(pstat_flag) { compute_totke(); compute_p_cv(); @@ -655,7 +655,7 @@ void FixPIMDLangevin::final_integrate() } else if(integrator==baoab) { - + } else { @@ -720,8 +720,8 @@ void FixPIMDLangevin::post_force(int /*flag*/) else if(cmode == MULTI_PROC) nmpimd_transform(bufbeads, f, M_x2xp[universe->iworld]); // nmpimd_transform(bufbeads, f, M_x2xp[universe->iworld]); } - c_pe->addstep(update->ntimestep+1); - c_press->addstep(update->ntimestep+1); + c_pe->addstep(update->ntimestep+1); + c_press->addstep(update->ntimestep+1); // printf("me = %d, step %d post_force ends!\n", universe->me, update->ntimestep); } @@ -804,7 +804,7 @@ void FixPIMDLangevin::update_x_unwrap() // x_unwrap = new double[nlocal*3]; // printf("me = %d, doing xu\n", universe->me); for(int i=0; iboxlo[0]; oldhi = domain->boxhi[0]; - + domain->boxlo[0] = (oldlo-fixedpoint[0])*expq[0] + fixedpoint[0]; domain->boxhi[0] = (oldhi-fixedpoint[0])*expq[0] + fixedpoint[0]; @@ -912,13 +912,13 @@ void FixPIMDLangevin::qc_step(){ oldhi = domain->boxhi[1]; domain->boxlo[1] = (oldlo-fixedpoint[1])*expq[1] + fixedpoint[1]; domain->boxhi[1] = (oldhi-fixedpoint[1])*expq[1] + fixedpoint[1]; - + oldlo = domain->boxlo[2]; oldhi = domain->boxhi[2]; domain->boxlo[2] = (oldlo-fixedpoint[2])*expq[2] + fixedpoint[2]; domain->boxhi[2] = (oldhi-fixedpoint[2])*expq[2] + fixedpoint[2]; } - } + } MPI_Barrier(universe->uworld); MPI_Bcast(&domain->boxlo[0], 3, MPI_DOUBLE, 0, universe->uworld); MPI_Bcast(&domain->boxhi[0], 3, MPI_DOUBLE, 0, universe->uworld); @@ -942,8 +942,8 @@ void FixPIMDLangevin::a_step(){ // printf("iworld = %d c = %.4e s = %.4e w = %.4e\n", universe->iworld, Lan_c[universe->iworld], Lan_s[universe->iworld], _omega_k[universe->iworld]); for(int i=0; iiworld] * x0 + 1./_omega_k[universe->iworld] * Lan_s[universe->iworld] * v0; @@ -967,7 +967,7 @@ void FixPIMDLangevin::remove_com_motion(){ int nlocal = atom->nlocal; if (dynamic) masstotal = group->mass(igroup); double vcm[3]; - group->vcm(igroup,masstotal,vcm); + group->vcm(igroup,masstotal,vcm); for (int i = 0; i < nlocal; i++) { if (mask[i] & groupbit) { v[i][0] -= vcm[0]; @@ -999,7 +999,7 @@ void FixPIMDLangevin::press_v_step() int nlocal = atom->nlocal; double **f = atom->f; double **v = atom->v; - int *type = atom->type; + int *type = atom->type; volume = domain->xprd * domain->yprd * domain->zprd; if(pstyle == ISO) @@ -1079,7 +1079,7 @@ void FixPIMDLangevin::press_o_step() vw[2] = c1 * vw[2] + c2 * sqrt(1. / W / beta_np) * r3; } MPI_Barrier(universe->uworld); - MPI_Bcast(&vw, 3, MPI_DOUBLE, 0, universe->uworld); + MPI_Bcast(&vw, 3, MPI_DOUBLE, 0, universe->uworld); } } @@ -1099,7 +1099,7 @@ void FixPIMDLangevin::Langevin_init() if(fmmode==physical){ for (int i=0; i 0) gamma = 1.0 / tau; else gamma = np / beta / hbar; - + if(integrator==obabo) c1 = exp(-gamma * 0.5 * update->dt); // tau is the damping time of the centroid mode. - else if(integrator==baoab) c1 = exp(-gamma * update->dt); + else if(integrator==baoab) c1 = exp(-gamma * update->dt); else error->universe_all(FLERR, "Unknown integrator parameter for fix pimd. Only obabo and baoab integrators is supported!"); c2 = sqrt(1.0 - c1 * c1); // note that c1 and c2 here only works for the centroid mode. @@ -1125,7 +1125,7 @@ void FixPIMDLangevin::Langevin_init() if( thermostat == PILE_L ) { std::string out = "\nInitializing PI Langevin equation thermostat...\n"; - out += "Bead ID | omega | tau | c1 | c2\n"; + out += "Bead ID | omega | tau | c1 | c2\n"; tau_k = new double[np]; c1_k = new double[np]; c2_k = new double[np]; @@ -1162,7 +1162,7 @@ void FixPIMDLangevin::o_step() r1 = random->gaussian(); r2 = random->gaussian(); r3 = random->gaussian(); - atom->v[i][0] = c1_k[universe->iworld] * atom->v[i][0] + c2_k[universe->iworld] * sqrt(1.0 / mass[type[i]] / beta_np) * r1; + atom->v[i][0] = c1_k[universe->iworld] * atom->v[i][0] + c2_k[universe->iworld] * sqrt(1.0 / mass[type[i]] / beta_np) * r1; atom->v[i][1] = c1_k[universe->iworld] * atom->v[i][1] + c2_k[universe->iworld] * sqrt(1.0 / mass[type[i]] / beta_np) * r2; atom->v[i][2] = c1_k[universe->iworld] * atom->v[i][2] + c2_k[universe->iworld] * sqrt(1.0 / mass[type[i]] / beta_np) * r3; } @@ -1188,7 +1188,7 @@ void FixPIMDLangevin::nmpimd_init() // Set up eigenvectors for degenerated modes for(int j=0; jdestroy(tag_init); memory->destroy(image_init); memory->destroy(x_unwrapsort); - memory->create(x_unwrap, maxunwrap, 3, "FixPIMDLangevin:x_unwrap"); + memory->create(x_unwrap, maxunwrap, 3, "FixPIMDLangevin:x_unwrap"); memory->create(tag_init, maxunwrap, "FixPIMDLangevin:tag_init"); memory->create(image_init, maxunwrap, "FixPIMDLangevin:image_init"); memory->create(x_unwrapsort, ntotal, 3, "FixPIMDLangevin:x_unwrapsort"); @@ -1552,7 +1552,7 @@ void FixPIMDLangevin::compute_stress_tensor() } // MPI_Allreduce(&ke_tensor, &ke_tensor, 6, MPI_DOUBLE, MPI_SUM, world); MPI_Allreduce(MPI_IN_PLACE, &ke_tensor, 6, MPI_DOUBLE, MPI_SUM, world); - for(int i=0; i<6; i++) + for(int i=0; i<6; i++) { stress_tensor[i] = inv_volume * ((2*ke_tensor[i] - c_vir_tensor[i]) * force->nktv2p + virial[i]) / np; // printf("i = %d, c_vir = %.6f, virial = %.6f stress = %.6f\n", i, c_vir_tensor[i], virial[i], stress_tensor[i]); @@ -1600,7 +1600,7 @@ void FixPIMDLangevin::compute_spring_energy() for(int i=0; iiworld] * (x[i][0]*x[i][0] + x[i][1]*x[i][1] + x[i][2]*x[i][2]); + spring_energy += 0.5 * _mass[type[i]] * fbond * lam[universe->iworld] * (x[i][0]*x[i][0] + x[i][1]*x[i][1] + x[i][2]*x[i][2]); } MPI_Allreduce(&spring_energy, &se_bead, 1, MPI_DOUBLE, MPI_SUM, world); // MPI_Allreduce(&spring_energy, &total_spring_energy, 1, MPI_DOUBLE, MPI_SUM, universe->uworld); @@ -1660,7 +1660,7 @@ void FixPIMDLangevin::compute_p_cv() // printf("inv_V = %.30e ke = %.30e cv = %.30e vir = %.30e\n", inv_volume, ke_bead, centroid_vir, vir); if(universe->iworld == 0) { - p_cv = 1. / 3. * inv_volume * ((2. * ke_bead - 1. * centroid_vir) * force->nktv2p + 1. * vir) / np; + p_cv = 1. / 3. * inv_volume * ((2. * ke_bead - 1. * centroid_vir) * force->nktv2p + 1. * vir) / np; } MPI_Bcast(&p_cv, 1, MPI_DOUBLE, 0, universe->uworld); } @@ -1670,7 +1670,7 @@ void FixPIMDLangevin::compute_p_cv() void FixPIMDLangevin::compute_totenthalpy() { volume = domain->xprd * domain->yprd * domain->zprd; - if(barostat == BZP) + if(barostat == BZP) { if(pstyle == ISO) { @@ -1719,23 +1719,23 @@ double FixPIMDLangevin::compute_vector(int n) } else if(pstyle == ANISO) { - + } } /* - + if(n==7) { return p_prim; } if(n==8) { return p_md; } if(n==9) { return p_cv; } if(n==10) {return totenthalpy; if(pstyle == ISO){ if(n==11) { return vw[0]; } - if(n==12) { + if(n==12) { if(barostat == BZP) { return 0.5*W*vw[0]*vw[0]; } else if(barostat == MTTK) { return 1.5*W*vw[0]*vw[0]; } } if(n==13) { volume = domain->xprd * domain->yprd * domain->zprd; return np * Pext * volume / force->nktv2p; } - if(n==14) { volume = domain->xprd * domain->yprd * domain->zprd; + if(n==14) { volume = domain->xprd * domain->yprd * domain->zprd; // printf("Vcoeff = %.6e np = %d kBT = %.6e logV = %.6e\n", Vcoeff, np, kBT, log(volume)); return - Vcoeff * np * kBT * log(volume); } } diff --git a/src/REPLICA/fix_pimd_langevin.h b/src/REPLICA/fix_pimd_langevin.h index 4f0390c700..cf2d63b91c 100644 --- a/src/REPLICA/fix_pimd_langevin.h +++ b/src/REPLICA/fix_pimd_langevin.h @@ -33,7 +33,6 @@ class FixPIMDLangevin : public Fix { void init() override; void setup(int) override; -// void post_neighbor() override; void post_force(int) override; void initial_integrate(int) override; void final_integrate() override; @@ -43,26 +42,24 @@ class FixPIMDLangevin : public Fix { protected: /* System setting variables */ - int method; // PIMD or NMPIMD or CMD - int fmmode; // physical or normal - int np; // number of beads - double inverse_np; // 1.0/np - double temp; // temperature - double planck, hbar; // Planck's constant - double lj_epsilon, lj_sigma, lj_mass; // LJ unit energy, length, and mass scales + int method; // PIMD or NMPIMD or CMD + int fmmode; // physical or normal + int np; // number of beads + double inverse_np; // 1.0/np + double temp; // temperature + double planck, hbar; // Planck's constant + double lj_epsilon, lj_sigma, lj_mass; // LJ unit energy, length, and mass scales double other_planck; - double kBT; // k_B * temp - double beta, beta_np; // beta = 1./kBT beta_np = 1./kBT/np - int thermostat; // NHC or PILE_L - int barostat; // BZP - int integrator; // obabo or baoab - int ensemble; // nve or nvt or nph or npt - int mapflag; // should be 1 if number of beads > 1 + double kBT; // k_B * temp + double beta, beta_np; // beta = 1./kBT beta_np = 1./kBT/np + int thermostat; // NHC or PILE_L + int barostat; // BZP + int integrator; // obabo or baoab + int ensemble; // nve or nvt or nph or npt + int mapflag; // should be 1 if number of beads > 1 int removecomflag; double masstotal; - // void remove_com_motion(); - double fixedpoint[3]; // location of dilation fixed-point /* ring-polymer model */ @@ -82,7 +79,7 @@ class FixPIMDLangevin : public Fix { int sizeplan; int *plansend, *planrecv; - tagint *tagsend, *tagrecv; + tagint *tagsend, *tagrecv; double **bufsend, **bufrecv, **bufbeads; double **bufsorted, **bufsortedall; double **outsorted, **buftransall; @@ -110,33 +107,34 @@ class FixPIMDLangevin : public Fix { double dtv, dtf, dtv2, dtv3; double gamma, c1, c2, tau; double *tau_k, *c1_k, *c2_k; - double pilescale=1.0; + double pilescale = 1.0; double Lan_temp; double r1, r2, r3; - double _omega_np, *_omega_k, *Lan_s, *Lan_c; // sin(omega_k*dt*0.5), cos(omega_k*dt*0.5) + double _omega_np, *_omega_k, *Lan_s, *Lan_c; // sin(omega_k*dt*0.5), cos(omega_k*dt*0.5) class RanMars *random; - int seed=975481; + int seed = 975481; FILE *frand; - int tstat_flag; // tstat_flat = 1 if thermostat if used + int tstat_flag; // tstat_flat = 1 if thermostat if used void Langevin_init(); - void b_step(); // integrate for dt/2 according to B part (v <- v + f * dt/2) - void a_step(); // integrate for dt/2 according to A part (non-centroid mode, harmonic force between replicas) - void qc_step(); // integrate for dt/2 for the centroid mode (x <- x + v * dt/2) - void o_step(); // integrate for dt according to O part (O-U process, for thermostating) - + void b_step(); // integrate for dt/2 according to B part (v <- v + f * dt/2) + void + a_step(); // integrate for dt/2 according to A part (non-centroid mode, harmonic force between replicas) + void qc_step(); // integrate for dt/2 for the centroid mode (x <- x + v * dt/2) + void o_step(); // integrate for dt according to O part (O-U process, for thermostating) + /* Bussi-Zykova-Parrinello barostat */ double f_omega, mtk_term1; - int pstat_flag; // pstat_flag = 1 if barostat is used - int pstyle; // pstyle = ISO or ANISO (will support TRICLINIC in the future) + int pstat_flag; // pstat_flag = 1 if barostat is used + int pstyle; // pstyle = ISO or ANISO (will support TRICLINIC in the future) double W, tau_p, Pext, totenthalpy = 0.0, Vcoeff; int p_flag[6]; - double vw[6]; // barostat velocity - double ke_tensor[6]; // kinetic energy tensor - double c_vir_tensor[6]; // centroid-virial tensor - double stress_tensor[6]; // path integral centroid-virial stress tensor + double vw[6]; // barostat velocity + double ke_tensor[6]; // kinetic energy tensor + double c_vir_tensor[6]; // centroid-virial tensor + double stress_tensor[6]; // path integral centroid-virial stress tensor void baro_init(); void press_v_step(); @@ -152,12 +150,12 @@ class FixPIMDLangevin : public Fix { // int n_unwrap; int maxunwrap; // int maxunwrap, nlocal_init; -// tagint *tag_init, *tag_initall; -// imageint *image_init, *image_initall; + // tagint *tag_init, *tag_initall; + // imageint *image_init, *image_initall; double **x_unwrap; -// double **x_unwrap, **x_unwrapsort; -// double **x_unwrapall; -// void init_x_unwrap(); + // double **x_unwrap, **x_unwrapsort; + // double **x_unwrapall; + // void init_x_unwrap(); void reallocate_x_unwrap(); void reallocate_xc(); void collect_xc(); @@ -178,22 +176,20 @@ class FixPIMDLangevin : public Fix { class Compute *c_pe; class Compute *c_press; - void compute_totke(); // 1: kinetic energy - void compute_spring_energy(); // 2: spring elastic energy - void compute_pote(); // 3: potential energy - void compute_tote(); // 4: total energy: 1+2+3 for all the beads + void compute_totke(); // 1: kinetic energy + void compute_spring_energy(); // 2: spring elastic energy + void compute_pote(); // 3: potential energy + void compute_tote(); // 4: total energy: 1+2+3 for all the beads // void compute_t_prim(); // 5: primitive kinetic energy estimator // void compute_p_prim(); // primitive pressure estimator void compute_stress_tensor(); // void compute_t_vir(); // centroid-virial kinetic energy estimator - void compute_p_cv(); // centroid-virial pressure estimator + void compute_p_cv(); // centroid-virial pressure estimator // void compute_p_vir(); // centroid-virial pressure estimator void compute_vir(); void compute_vir_(); void compute_totenthalpy(); }; - } // namespace LAMMPS_NS - #endif #endif From 0911565660831d554272900e6d140c5a3f46c170 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Sat, 25 Feb 2023 16:36:01 -0500 Subject: [PATCH 012/396] prepare for inclusion of fix pimd/langevin --- doc/src/Commands_fix.rst | 1 + doc/src/fix.rst | 3 +- doc/src/fix_pimd.rst | 70 ++++++++++++++++++++++------------------ src/.gitignore | 2 ++ 4 files changed, 44 insertions(+), 32 deletions(-) diff --git a/doc/src/Commands_fix.rst b/doc/src/Commands_fix.rst index d275b33eba..9c5b0d4a0f 100644 --- a/doc/src/Commands_fix.rst +++ b/doc/src/Commands_fix.rst @@ -168,6 +168,7 @@ OPT. * :doc:`pafi ` * :doc:`pair ` * :doc:`phonon ` + * :doc:`pimd/langevin ` * :doc:`pimd/nvt ` * :doc:`planeforce ` * :doc:`plumed ` diff --git a/doc/src/fix.rst b/doc/src/fix.rst index 2dfe97a3ec..6f9f29db25 100644 --- a/doc/src/fix.rst +++ b/doc/src/fix.rst @@ -320,7 +320,8 @@ accelerated styles exist. * :doc:`pafi ` - constrained force averages on hyper-planes to compute free energies (PAFI) * :doc:`pair ` - access per-atom info from pair styles * :doc:`phonon ` - calculate dynamical matrix from MD simulations -* :doc:`pimd/nvt ` - Feynman path integral molecular dynamics with Nose-Hoover thermostat +* :doc:`pimd/langevin ` - Feynman path-integral molecular dynamics with stochastic thermostat +* :doc:`pimd/nvt ` - Feynman path-integral molecular dynamics with Nose-Hoover thermostat * :doc:`planeforce ` - constrain atoms to move in a plane * :doc:`plumed ` - wrapper on PLUMED free energy library * :doc:`poems ` - constrain clusters of atoms to move as coupled rigid bodies diff --git a/doc/src/fix_pimd.rst b/doc/src/fix_pimd.rst index 0a4f9a38fb..342530e6a9 100644 --- a/doc/src/fix_pimd.rst +++ b/doc/src/fix_pimd.rst @@ -1,17 +1,21 @@ +.. index:: fix pimd/langevin .. index:: fix pimd/nvt +fix pimd/langevin command +========================= + fix pimd/nvt command -================ +==================== Syntax """""" .. parsed-literal:: - fix ID group-ID pimd/nvt keyword value ... + fix ID group-ID style keyword value ... * ID, group-ID are documented in :doc:`fix ` command -* pimd/nvt = style name of this fix command +* style = *pimd/langevin* or *pimd/nvt* = style name of this fix command * zero or more keyword/value pairs may be appended * keyword = *method* or *fmass* or *sp* or *temp* or *nhc* @@ -35,14 +39,15 @@ Description .. versionchanged:: TBD -Fix pimd was renamed to fix pimd/nvt. +Fix pimd was renamed to fix *pimd/nvt* and fix *pimd/langevin* was added. -This command performs quantum molecular dynamics simulations based on -the Feynman path integral to include effects of tunneling and +These fix commands perform quantum molecular dynamics simulations based +on the Feynman path-integral to include effects of tunneling and zero-point motion. In this formalism, the isomorphism of a quantum partition function for the original system to a classical partition function for a ring-polymer system is exploited, to efficiently sample configurations from the canonical ensemble :ref:`(Feynman) `. + The classical partition function and its components are given by the following equations: @@ -53,27 +58,28 @@ by the following equations: V_{eff} = & \sum_{i=1}^P \bigg[ \frac{mP}{2\beta^2 \hbar^2} (q_i - q_{i+1})^2 + \frac{1}{P} V(q_i)\bigg] The interested user is referred to any of the numerous references on -this methodology, but briefly, each quantum particle in a path -integral simulation is represented by a ring-polymer of P quasi-beads, -labeled from 1 to P. During the simulation, each quasi-bead interacts -with beads on the other ring-polymers with the same imaginary time -index (the second term in the effective potential above). The -quasi-beads also interact with the two neighboring quasi-beads through -the spring potential in imaginary-time space (first term in effective -potential). To sample the canonical ensemble, a Nose-Hoover massive -chain thermostat is applied :ref:`(Tuckerman) `. With the -massive chain algorithm, a chain of NH thermostats is coupled to each -degree of freedom for each quasi-bead. The keyword *temp* sets the -target temperature for the system and the keyword *nhc* sets the -number *Nc* of thermostats in each chain. For example, for a -simulation of N particles with P beads in each ring-polymer, the total -number of NH thermostats would be 3 x N x P x Nc. +this methodology, but briefly, each quantum particle in a path integral +simulation is represented by a ring-polymer of P quasi-beads, labeled +from 1 to P. During the simulation, each quasi-bead interacts with +beads on the other ring-polymers with the same imaginary time index (the +second term in the effective potential above). The quasi-beads also +interact with the two neighboring quasi-beads through the spring +potential in imaginary-time space (first term in effective potential). +To sample the canonical ensemble, a Nose-Hoover massive chain thermostat +is applied :ref:`(Tuckerman) `. With the massive chain +algorithm, a chain of NH thermostats is coupled to each degree of +freedom for each quasi-bead. The keyword *temp* sets the target +temperature for the system and the keyword *nhc* sets the number *Nc* of +thermostats in each chain. For example, for a simulation of N particles +with P beads in each ring-polymer, the total number of NH thermostats +would be 3 x N x P x Nc. .. note:: - Fix pimd/nvt implements a complete velocity-verlet integrator + Fix *pimd/nvt* implements a complete velocity-verlet integrator combined with NH massive chain thermostat, so no other time integration fix should be used. + Similarly fix *pimd/langeving* implements ... The *method* keyword determines what style of PIMD is performed. A value of *pimd* is standard PIMD. A value of *nmpimd* is for @@ -158,16 +164,18 @@ related tasks for each of the partitions, e.g. Restart, fix_modify, output, run start/stop, minimize info """"""""""""""""""""""""""""""""""""""""""""""""""""""""""" -Fix pimd/nvt writes the state of the Nose/Hoover thermostat over all +Fix *pimd/nvt* writes the state of the Nose/Hoover thermostat over all quasi-beads to :doc:`binary restart files `. See the :doc:`read_restart ` command for info on how to re-specify a fix in an input script that reads a restart file, so that the operation of the fix continues in an uninterrupted fashion. +Fix *pimd/langevin* ... + None of the :doc:`fix_modify ` options are relevant to fix pimd/nvt. -Fix pimd/nvt computes a global 3-vector, which can be accessed by +Fix *pimd/nvt* computes a global 3-vector, which can be accessed by various :doc:`output commands `. The three quantities in the global vector are: @@ -176,21 +184,21 @@ the global vector are: #. the current value of the scalar virial estimator for the kinetic energy of the quantum system :ref:`(Herman) `. -The vector values calculated by fix pimd/nvt are "extensive", except for the +The vector values calculated by fix *pimd/nvt* are "extensive", except for the temperature, which is "intensive". -No parameter of fix pimd/nvt can be used with the *start/stop* keywords -of the :doc:`run ` command. Fix pimd/nvt is not invoked during +No parameter of fix *pimd/nvt* can be used with the *start/stop* keywords +of the :doc:`run ` command. Fix *pimd/nvt* is not invoked during :doc:`energy minimization `. Restrictions """""""""""" -This fix is part of the REPLICA package. It is only enabled if LAMMPS -was built with that package. See the :doc:`Build package +These fixes are part of the REPLICA package. They are only enabled if +LAMMPS was built with that package. See the :doc:`Build package ` page for more info. -Fix pimd/nvt cannot be used with :doc:`lj units `. +Fix *pimd/nvt* cannot be used with :doc:`lj units `. A PIMD simulation can be initialized with a single data file read via the :doc:`read_data ` command. However, this means all @@ -207,7 +215,7 @@ variable, e.g. Default """"""" -The keyword defaults for fix pimd/nvt are method = pimd, fmass = 1.0, sp +The keyword defaults for fix *pimd/nvt* are method = pimd, fmass = 1.0, sp = 1.0, temp = 300.0, and nhc = 2. ---------- diff --git a/src/.gitignore b/src/.gitignore index 8f0f577a45..cbe9e76216 100644 --- a/src/.gitignore +++ b/src/.gitignore @@ -1533,6 +1533,8 @@ /fix_mol_swap.h /fix_pimd.cpp /fix_pimd.h +/fix_pimd_langevin.cpp +/fix_pimd_langevin.h /fix_pimd_nvt.cpp /fix_pimd_nvt.h /fix_qbmsst.cpp From 00a5930d4c93bafe8f2cd8978ab5c5ddfc290ef2 Mon Sep 17 00:00:00 2001 From: Yifan Li Date: Sat, 25 Feb 2023 18:58:56 -0500 Subject: [PATCH 013/396] delete default seed --- src/REPLICA/fix_pimd_langevin.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/REPLICA/fix_pimd_langevin.h b/src/REPLICA/fix_pimd_langevin.h index cf2d63b91c..3af036caf9 100644 --- a/src/REPLICA/fix_pimd_langevin.h +++ b/src/REPLICA/fix_pimd_langevin.h @@ -113,7 +113,7 @@ class FixPIMDLangevin : public Fix { double _omega_np, *_omega_k, *Lan_s, *Lan_c; // sin(omega_k*dt*0.5), cos(omega_k*dt*0.5) class RanMars *random; - int seed = 975481; + int seed; FILE *frand; int tstat_flag; // tstat_flat = 1 if thermostat if used From c950df2ede6bc519ed5f63691bac9579855af715 Mon Sep 17 00:00:00 2001 From: Yifan Li Date: Sat, 25 Feb 2023 19:53:19 -0500 Subject: [PATCH 014/396] delete commented-out code --- src/REPLICA/fix_pimd_langevin.cpp | 271 ------------------------------ 1 file changed, 271 deletions(-) diff --git a/src/REPLICA/fix_pimd_langevin.cpp b/src/REPLICA/fix_pimd_langevin.cpp index 1b2e734922..d4e8648504 100644 --- a/src/REPLICA/fix_pimd_langevin.cpp +++ b/src/REPLICA/fix_pimd_langevin.cpp @@ -81,8 +81,6 @@ FixPIMDLangevin::FixPIMDLangevin(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, n bufbeads = nullptr; x_unwrap = xc = nullptr; xcall = nullptr; - // x_unwrap = x_unwrapsort = x_unwrapall = nullptr; - // tag_init = tag_initall = nullptr; counts = nullptr; sizeplan = 0; @@ -245,16 +243,11 @@ FixPIMDLangevin::FixPIMDLangevin(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, n /* Initiation */ int nlocal = atom->nlocal; - // xc = new double[nlocal*3]; - // x_unwrap = new double[nlocal*3]; global_freq = 1; vector_flag = 1; size_vector = 11; - // if(pstyle==ISO) {size_vector = 15;} - // else if(pstyle==ANISO) {size_vector = 23;} extvector = 1; - // comm_forward = 1; // some initilizations @@ -318,7 +311,6 @@ FixPIMDLangevin::FixPIMDLangevin(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, n if(atom->nmax > maxunwrap) reallocate_x_unwrap(); if(atom->nmax > maxxc) reallocate_xc(); memory->create(xcall, ntotal*3, "FixPIMDLangevin:xcall"); - // init_x_unwrap(); if (cmode == SINGLE_PROC) { @@ -331,21 +323,14 @@ FixPIMDLangevin::FixPIMDLangevin(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, n } if ((cmode == MULTI_PROC) && (counts == nullptr)) { - // printf("me = %d, creating bufrecvall\n", universe->me); memory->create(bufsendall,ntotal,3,"FixPIMDLangevin:bufsendall"); memory->create(bufrecvall,ntotal,3,"FixPIMDLangevin:bufrecvall"); - // printf("me = %d, bufrecvall[0][0] = %.4f\n", universe->me, bufrecvall[0][0]); memory->create(tagsendall,ntotal,"FixPIMDLangevin:tagsendall"); memory->create(tagrecvall,ntotal,"FixPIMDLangevin:tagrecvall"); - // printf("me = %d, tagrecvall[0] = %d\n", universe->me, tagrecvall[0]); memory->create(counts,nprocs,"FixPIMDLangevin:counts"); memory->create(displacements,nprocs,"FixPIMDLangevin:displacements"); - // memory->create(x_unwrapall, ntotal, 3, "FixPIMDLangevin:x_unwrapall"); - // memory->create(tag_initall, ntotal, "FixPIMDLangevin:tag_initall"); - // printf("me = %d, tag_initall[0] = %d\n", universe->me, tag_initall[0]); } - // printf("me = %d constructing finished\n", universe->me); } /* ---------------------------------------------------------------------- */ @@ -391,12 +376,8 @@ void FixPIMDLangevin::init() } else planck = force->hplanck; const double Planck = planck; - printf("planck = %.6e\n", planck); - // if(force->boltz == 1.0) { hbar = Planck; } - // else { hbar = Planck / (2.0 * MY_PI); } hbar = Planck / (2.0 * MY_PI); - // hbar = Planck; kBT = force->boltz * temp; double beta = 1.0 / (Boltzmann * temp); double _fbond = 1.0 * np * np / (beta * beta * hbar * hbar); @@ -404,7 +385,6 @@ void FixPIMDLangevin::init() omega_np = np / (hbar * beta) * sqrt(force->mvv2e); beta_np = 1.0 / force->boltz / temp / np; fbond = _fbond * force->mvv2e; - // printf("_fbond = %.16e\nfbond = %.16e\n", _fbond, fbond); if (universe->me == 0) printf("Fix pimd -P/(beta^2 * hbar^2) = %20.7lE (kcal/mol/A^2)\n\n", fbond); @@ -458,35 +438,27 @@ void FixPIMDLangevin::setup(int vflag) double **x = atom->x; double **v = atom->v; imageint *image = atom->image; - // nlocal_init = nlocal; if(mapflag){ for(int i=0; iunmap(x[i], image[i]); } } - // printf("me = %d after unmapping x_unwrap\n", universe->me); - // printf("setup already here\n"); if(method==NMPIMD) { inter_replica_comm(x); - // printf("me = %d after inter\n", universe->me); - // printf("%.4f %.4f %.4f\n", bufbeads[0][0], bufbeads[0][1], bufbeads[0][2]); if(cmode == SINGLE_PROC) nmpimd_transform(bufsortedall, x, M_x2xp[universe->iworld]); else if(cmode == MULTI_PROC) nmpimd_transform(bufbeads, x, M_x2xp[universe->iworld]); } collect_xc(); - // printf("me = %d setup x2xp done\n", universe->me); compute_spring_energy(); if(method==NMPIMD) { inter_replica_comm(x); if(cmode == SINGLE_PROC) nmpimd_transform(bufsortedall, x, M_xp2x[universe->iworld]); else if(cmode == MULTI_PROC) nmpimd_transform(bufbeads, x, M_xp2x[universe->iworld]); - // nmpimd_transform(bufbeads, x, M_xp2x[universe->iworld]); } - // printf("me = %d setup xp2x done\n", universe->me); if(mapflag){ for(int i=0; iiworld]); else if(cmode == MULTI_PROC) nmpimd_transform(bufbeads, v, M_x2xp[universe->iworld]); - // nmpimd_transform(bufbeads, atom->v, M_x2xp[universe->iworld]); } - // printf("me = %d setup v2vp done\n", universe->me); - // compute_xc(); - // update_x_unwrap(); - // printf("setting up %d\n", vflag); if(universe->me==0 && screen) fprintf(screen,"Setting up Path-Integral ...\n"); if(universe->me==0) printf("Setting up Path-Integral ...\n"); - // printf("setting up, m = %.4e\n", mass[1]); post_force(vflag); - // int idx = atom->map(1); - // printf("irplica = %d, x[1] = %.6f %.6f %.6f xu[1] = %.6f %.6f %.6f xc[1] = %.6f %.6f %.6f\n", ireplica, x[idx][0], x[idx][1], x[idx][2], x_unwrap[idx][0], x_unwrap[idx][1], x_unwrap[idx][2], xc[idx][0], xc[idx][1], xc[idx][2]); - // printf("after post_force, m = %.4e\n", mass[1]); - // printf("me = %d after post_force\n", universe->me); compute_totke(); - // compute_pote(); - // if(pstyle==ANISO) compute_stress_tensor(); end_of_step(); c_pe->addstep(update->ntimestep+1); c_press->addstep(update->ntimestep+1); - // printf("setup ending: \ncell = %.16e %.16e %.16e\nvol = %.16e\n", domain->xprd, domain->yprd, domain->zprd, domain->xprd * domain->yprd * domain->zprd); - // printf("me = %d, setup finished\n", universe->me); } /* ---------------------------------------------------------------------- */ void FixPIMDLangevin::initial_integrate(int /*vflag*/) { - // printf("step = %d start initial_integrate\ncell = %.16e %.16e %.16e\nvol = %.16e\n", update->ntimestep, domain->xprd, domain->yprd, domain->zprd, domain->xprd * domain->yprd * domain->zprd); - // printf("me = %d, step %d initial_integrate starts!\n", universe->me, update->ntimestep); - // printf("me = %d, step %d if starts!\n", universe->me, update->ntimestep); int nlocal = atom->nlocal; tagint *tag = atom->tag; double **x = atom->x; @@ -542,41 +497,28 @@ void FixPIMDLangevin::initial_integrate(int /*vflag*/) } if(integrator==obabo) { - // printf("me = %d, step %d obabo starts!\n", universe->me, update->ntimestep); if(tstat_flag) { o_step(); - // if(removecomflag) remove_com_motion(); if(pstat_flag) press_o_step(); } if(pstat_flag) { compute_totke(); - // printf("me = %d, step %d after totke!\n", universe->me, update->ntimestep); compute_p_cv(); press_v_step(); } - /* - if(pstat_flag) - { - } - */ - // printf("me = %d, step %d before b_step 1!\n", universe->me, update->ntimestep); b_step(); - // printf("me = %d, step %d after b_step 1!\n", universe->me, update->ntimestep); - // if(removecomflag) remove_com_motion(); if(method==NMPIMD) { inter_replica_comm(x); if(cmode == SINGLE_PROC) nmpimd_transform(bufsortedall, x, M_x2xp[universe->iworld]); else if(cmode == MULTI_PROC) nmpimd_transform(bufbeads, x, M_x2xp[universe->iworld]); - // nmpimd_transform(bufbeads, x, M_x2xp[universe->iworld]); } qc_step(); a_step(); qc_step(); a_step(); - // printf("me = %d, step %d after 2 a_step's!\n", universe->me, update->ntimestep); } else if(integrator==baoab) { @@ -587,20 +529,17 @@ void FixPIMDLangevin::initial_integrate(int /*vflag*/) press_v_step(); } b_step(); - // if(removecomflag) remove_com_motion(); if(method==NMPIMD) { inter_replica_comm(x); if(cmode == SINGLE_PROC) nmpimd_transform(bufsortedall, x, M_x2xp[universe->iworld]); else if(cmode == MULTI_PROC) nmpimd_transform(bufbeads, x, M_x2xp[universe->iworld]); - // nmpimd_transform(bufbeads, x, M_x2xp[universe->iworld]); } qc_step(); a_step(); if(tstat_flag) { o_step(); - // if(removecomflag) remove_com_motion(); if(pstat_flag) press_o_step(); } qc_step(); @@ -618,7 +557,6 @@ void FixPIMDLangevin::initial_integrate(int /*vflag*/) inter_replica_comm(x); if(cmode == SINGLE_PROC) nmpimd_transform(bufsortedall, x, M_xp2x[universe->iworld]); else if(cmode == MULTI_PROC) nmpimd_transform(bufbeads, x, M_xp2x[universe->iworld]); - // nmpimd_transform(bufbeads, x, M_xp2x[universe->iworld]); } @@ -628,8 +566,6 @@ void FixPIMDLangevin::initial_integrate(int /*vflag*/) domain->unmap_inv(x[i], image[i]); } } - // printf("step = %d\ncell = %.16e %.16e %.16e\nvol = %.16e\n", update->ntimestep, domain->xprd, domain->yprd, domain->zprd, domain->xprd * domain->yprd * domain->zprd); - // printf("me = %d, step %d initial_integrate ends!\n", universe->me, update->ntimestep); } /* ---------------------------------------------------------------------- */ @@ -643,13 +579,11 @@ void FixPIMDLangevin::final_integrate() press_v_step(); } b_step(); - // if(removecomflag) remove_com_motion(); if(integrator==obabo) { if(tstat_flag) { o_step(); - // if(removecomflag) remove_com_motion(); if(pstat_flag) press_o_step(); } } @@ -667,10 +601,8 @@ void FixPIMDLangevin::final_integrate() void FixPIMDLangevin::post_force(int /*flag*/) { - // printf("step = %d\ncell = %.16e %.16e %.16e\nvol = %.16e\n", update->ntimestep, domain->xprd, domain->yprd, domain->zprd, domain->xprd * domain->yprd * domain->zprd); if(atom->nmax > maxunwrap) reallocate_x_unwrap(); if(atom->nmax > maxxc) reallocate_xc(); - // printf("me = %d, step %d post_force starts!\n", universe->me, update->ntimestep); int nlocal = atom->nlocal; double **x = atom->x; double **f = atom->f; @@ -695,34 +627,17 @@ void FixPIMDLangevin::post_force(int /*flag*/) xc[i][2] = xcall[3*(tag[i]-1)+2]; } int idx = atom->map(1); - // printf("in post_force, x_unwrap: %.6f %.6f %.6f xcall: %.6f %.6f %.6f xc: %.6f %.6f %.6f\n", x_unwrap[idx][0], x_unwrap[idx][1], x_unwrap[idx][2], xcall[0], xcall[1], xcall[2], xc[idx][0], xc[idx][1], xc[idx][2]); - // MPI_Barrier(universe->uworld); - // update_x_unwrap(); - // MPI_Barrier(universe->uworld); - // compute_xc(); - // MPI_Barrier(universe->uworld); - // if(mapflag) - // { - // for(int i=0; iunmap_inv(x[i], image[i]); - // } - // } compute_vir(); compute_vir_(); - // compute_t_prim(); - // compute_t_vir(); compute_pote(); if(method==NMPIMD) { inter_replica_comm(f); if(cmode == SINGLE_PROC) nmpimd_transform(bufsortedall, f, M_x2xp[universe->iworld]); else if(cmode == MULTI_PROC) nmpimd_transform(bufbeads, f, M_x2xp[universe->iworld]); - // nmpimd_transform(bufbeads, f, M_x2xp[universe->iworld]); } c_pe->addstep(update->ntimestep+1); c_press->addstep(update->ntimestep+1); - // printf("me = %d, step %d post_force ends!\n", universe->me, update->ntimestep); } /* ---------------------------------------------------------------------- */ @@ -730,8 +645,6 @@ void FixPIMDLangevin::post_force(int /*flag*/) void FixPIMDLangevin::end_of_step() { compute_totke(); - // inv_volume = 1.0 / (domain->xprd * domain->yprd * domain->zprd); - // compute_p_prim(); compute_p_cv(); compute_tote(); if(pstat_flag) compute_totenthalpy(); @@ -740,8 +653,6 @@ void FixPIMDLangevin::end_of_step() { if(universe->me==0) printf("This is the end of step %ld.\n", update->ntimestep); } - // if(universe->me==0) printf("me = %d This is the end of step %ld.\n", universe->me, update->ntimestep); - // printf("me = %d This is the end of step %ld.\n\n", universe->me, update->ntimestep); } void FixPIMDLangevin::collect_xc() @@ -773,74 +684,15 @@ void FixPIMDLangevin::collect_xc() xcall[3*(tag[i]-1)+2] = x[i][2] / sqrt(np); } int idx = atom->map(1); - // printf("in init_int, x: %.6f %.6f %.6f xcall: %.6f %.6f %.6f\n", x[idx][0], x[idx][1], x[idx][2], xcall[0], xcall[1], xcall[2]); if(cmode == MULTI_PROC) { - // printf("trying to add\n"); - // MPI_Reduce(MPI_IN_PLACE, xcall, ntotal*3, MPI_DOUBLE, MPI_SUM, 0, world); MPI_Allreduce(MPI_IN_PLACE, xcall, ntotal*3, MPI_DOUBLE, MPI_SUM, world); - // printf("added\n"); } } MPI_Bcast(xcall, ntotal*3, MPI_DOUBLE, 0, universe->uworld); } -/* ---------------------------------------------------------------------- */ -/* -void FixPIMDLangevin::update_x_unwrap() -{ - // MPI_Barrier(universe->uworld); - // printf("me = %d, starting update_xu\n", universe->me); - int nlocal = atom->nlocal; - double **x = atom->x; - // delete x_unwrap; - // memory->sfree(x_unwrap); - // printf("me = %d, before deleting xu\n", universe->me); - delete [] x_unwrap; - x_unwrap = nullptr; - x_unwrap = (double*) memory->srealloc(x_unwrap, sizeof(double)*(nlocal+200)*3, "FixDPPimd::x_unwrap"); - // printf("me = %d, before newing xu\n", universe->me); - // x_unwrap = new double[nlocal*3]; - // printf("me = %d, doing xu\n", universe->me); - for(int i=0; ime); - // MPI_Barrier(universe->uworld); -} -*/ -/* ---------------------------------------------------------------------- */ -/* -void FixPIMDLangevin::compute_xc() -{ - int natoms = atom->natoms; - MPI_Barrier(universe->uworld); - comm_exec(atom->x); - MPI_Barrier(universe->uworld); - int nlocal = atom->nlocal; - delete [] xc; - xc = nullptr; - xc = (double*) memory->srealloc(xc, sizeof(double) * nlocal * 3, "FixDPPimd:xc"); - for(int i=0; intimestep, domain->xprd, domain->yprd, domain->zprd, domain->xprd * domain->yprd * domain->zprd); if(universe->iworld == 0) { double expp[3], expq[3]; - // printf("pstyle = %d vw[0] = %.8e\n", pstyle, vw[0]); if(pstyle == ISO) {vw[1] = vw[0]; vw[2] = vw[0];} for(int j=0; j<3; j++) { @@ -926,7 +776,6 @@ void FixPIMDLangevin::qc_step(){ domain->set_local_box(); } volume = domain->xprd * domain->yprd * domain->zprd; - // printf("step = %d end qc_step\ncell = %.16e %.16e %.16e\nvol = %.16e\n", update->ntimestep, domain->xprd, domain->yprd, domain->zprd, domain->xprd * domain->yprd * domain->zprd); } /* ---------------------------------------------------------------------- */ @@ -939,7 +788,6 @@ void FixPIMDLangevin::a_step(){ if(universe->iworld != 0) { - // printf("iworld = %d c = %.4e s = %.4e w = %.4e\n", universe->iworld, Lan_c[universe->iworld], Lan_s[universe->iworld], _omega_k[universe->iworld]); for(int i=0; iiworld == 0) - { - // double **x = atom->x; - double **v = atom->v; - int *mask = atom->mask; - int nlocal = atom->nlocal; - if (dynamic) masstotal = group->mass(igroup); - double vcm[3]; - group->vcm(igroup,masstotal,vcm); - for (int i = 0; i < nlocal; i++) { - if (mask[i] & groupbit) { - v[i][0] -= vcm[0]; - v[i][1] -= vcm[1]; - v[i][2] -= vcm[2]; - } - } - } -} -*/ /* ---------------------------------------------------------------------- */ void FixPIMDLangevin::baro_init() { vw[0] = vw[1] = vw[2] = vw[3] = vw[4] = vw[5] = 0.0; if(pstyle == ISO) {W = 3 * (atom->natoms) * tau_p * tau_p * np * kBT;} // consistent with the definition in i-Pi - // printf("tau_p = %.6e np = %.6e kBT = %.6e W = %.6e\n", tau_p, np, kBT, W);} else if(pstyle == ANISO) {W = atom->natoms * tau_p * tau_p * np * kBT;} Vcoeff = 1.0; std::string out = fmt::format("\nInitializing PIMD {:s} barostat...\n", Barostats[barostat]); @@ -1006,9 +831,7 @@ void FixPIMDLangevin::press_v_step() { if(barostat == BZP) { - // printf("me = %d step = %d start press_v_step, baro.p = %.30e p_cv = %.30e\n", universe->me, update->ntimestep, W*vw[0], np*p_cv); vw[0] += dtv * 3 * (volume * np * (p_cv - Pext) / force->nktv2p + Vcoeff / beta_np) / W; - // printf("me = %d step = %d add p-Pext, baro.p = %.30e\n", universe->me, update->ntimestep, W*vw[0]); if(universe->iworld==0) { double dvw_proc = 0.0, dvw = 0.0; @@ -1024,7 +847,6 @@ void FixPIMDLangevin::press_v_step() } MPI_Barrier(universe->uworld); MPI_Bcast(&vw[0], 1, MPI_DOUBLE, 0, universe->uworld); - // printf("me = %d step = %d end press_v_step, baro.p = %.30e\n\n", universe->me, update->ntimestep, W*vw[0]); } else if(barostat == MTTK) { @@ -1087,11 +909,9 @@ void FixPIMDLangevin::press_o_step() void FixPIMDLangevin::Langevin_init() { - // printf("in Langevin_init\n"); double beta = 1.0 / kBT; _omega_np = np / beta / hbar; double _omega_np_dt_half = _omega_np * update->dt * 0.5; - // printf("omega_np = %.4e wdt = %.4e\n", _omega_np, _omega_np_dt_half); _omega_k = new double[np]; Lan_c = new double[np]; @@ -1102,7 +922,6 @@ void FixPIMDLangevin::Langevin_init() _omega_k[i] = _omega_np * sqrt(lam[i]); Lan_c[i] = cos(sqrt(lam[i])*_omega_np_dt_half); Lan_s[i] = sin(sqrt(lam[i])*_omega_np_dt_half); - // printf("lam = %.4e s = %.4e c = %.4e w = %.4e\n", lam[i], Lan_s[i], Lan_c[i], _omega_k[i]); } } else if(fmmode==normal){ @@ -1292,24 +1111,8 @@ void FixPIMDLangevin::comm_init() planrecv[i] = universe->root_proc[irecv]; modeindex[i] = irecv; } - // } } -/* ---------------------------------------------------------------------- */ -/* -void FixPIMDLangevin::init_x_unwrap() -{ - maxunwrap = atom->nmax; - memory->destroy(x_unwrap); - memory->destroy(tag_init); - memory->destroy(image_init); - memory->destroy(x_unwrapsort); - memory->create(x_unwrap, maxunwrap, 3, "FixPIMDLangevin:x_unwrap"); - memory->create(tag_init, maxunwrap, "FixPIMDLangevin:tag_init"); - memory->create(image_init, maxunwrap, "FixPIMDLangevin:image_init"); - memory->create(x_unwrapsort, ntotal, 3, "FixPIMDLangevin:x_unwrapsort"); -} -*/ /* ---------------------------------------------------------------------- */ void FixPIMDLangevin::reallocate_xc() @@ -1353,7 +1156,6 @@ void FixPIMDLangevin::inter_replica_comm(double **ptr) MPI_Status statuses[2]; if (atom->nmax > maxlocal) reallocate(); int nlocal = atom->nlocal; - // printf("me = %d starting inter_comm, nlocal = %d ntotal = %d\n", universe->me, nlocal, ntotal); tagint *tag = atom->tag; int i, m; @@ -1382,43 +1184,10 @@ void FixPIMDLangevin::inter_replica_comm(double **ptr) displacements[0] = 0; for (i = 0; i < nreplica-1; i++) { displacements[i+1] = displacements[i] + counts[i]; } MPI_Allgatherv(bufsorted[0], 3*m, MPI_DOUBLE, bufsortedall[0], counts, displacements, MPI_DOUBLE, universe->uworld); - // printf("me = %d bufsortedall[0] = %.8f %.8f %.8f bufsortedall[ntotal] = %.8f %.8f %.8f\n", universe->iworld, bufsortedall[0][0], bufsortedall[0][1], bufsortedall[0][2], bufsortedall[ntotal][0], bufsortedall[ntotal][1], bufsortedall[ntotal][2]); - /* - m = 0; - for(i=0; ime, nlocal, ntotal, m, sizeplan); - for(int iplan=0; iplanuworld, &requests[0]); - MPI_Irecv(tagrecv, ntotal, MPI_LMP_TAGINT, planrecv[iplan], 0, universe->uworld, &requests[1]); - // printf("me = %d iplan = %d irecv finished, plansend = %d, planrecv = %d, modeindex = %d\n", universe->me, iplan, plansend[iplan], planrecv[iplan], modeindex[iplan]); - // printf("bufsend[0]: %.4f %.4f %.4f\ntagsend[0]: %d\n", bufsend[0][0], bufsend[0][1], bufsend[0][2], tagsend[0]); - // printf("bufsend[255]: %.4f %.4f %.4f\ntagsend[255]: %d\n", bufsend[255][0], bufsend[255][1], bufsend[255][2], tagsend[255]); - MPI_Send(bufsend[0], 3*ntotal, MPI_DOUBLE, plansend[iplan], 0, universe->uworld); - MPI_Send(tagsend, ntotal, MPI_LMP_TAGINT, plansend[iplan], 0, universe->uworld); - // printf("me = %d MPI_Send done\n", universe->me); - MPI_Waitall(2, requests, statuses); - // printf("me = %d iplan = %d send recv finished\n", iplan, universe->me); - for(i=0; imap(tagrecv[i]); - bufbeads[modeindex[iplan]][3*m+0] = bufrecv[i][0]; - bufbeads[modeindex[iplan]][3*m+1] = bufrecv[i][1]; - bufbeads[modeindex[iplan]][3*m+2] = bufrecv[i][2]; - } - } - */ - // printf("me = %d finishing inter_comm\n", universe->me); } else if(cmode == MULTI_PROC) { m = 0; - // printf("me = %d trying to copy bufsend\n", universe->me); for(i=0; ime, m); - // if(me==0) {for(i=0; ime, i, counts[i]);}} - // printf("me = %d") MPI_Gather(&m, 1, MPI_INT, counts, 1, MPI_INT, 0, world); - // printf("me = %d counts gathered\n", universe->me); - // if(me==0) {for(i=0; ime, i, counts[i]);}} displacements[0] = 0; - // printf("me = %d displacements[0] = %d\n", universe->me, displacements[0]); for (i = 0; i < nprocs-1; i++) { displacements[i+1] = displacements[i] + counts[i]; } - // printf("me = %d displacements done\n", universe->me); - // if(me==0) {for(i=0; ime, i, displacements[i]);}} MPI_Gatherv(tagsend, m, MPI_LMP_TAGINT, tagsendall, counts, displacements, MPI_LMP_TAGINT, 0, world); - // printf("me = %d tags gathered\n", universe->me); for (i = 0; i < nprocs; i++) { counts[i] *= 3; } for (i = 0; i < nprocs-1; i++) { displacements[i+1] = displacements[i] + counts[i]; } MPI_Gatherv(bufsend[0], 3*m, MPI_DOUBLE, bufsendall[0], counts, displacements, MPI_DOUBLE, 0, world); - // printf("me = %d bufsend gathered\n", universe->me); - // printf("me = %d, tagrecvall[0] = %d bufrecvall[0][0] = %.4f\n", universe->me, tagrecvall[0], bufrecvall[0][0]); - - // printf("universe->me = %d comm->me = %d sizeplan = %d\n", universe->me, comm->me, sizeplan); for(int iplan=0; iplanuworld); MPI_Waitall(2,requests,statuses); } - // else{ - // printf("me = %d not sendrecceving\n", universe->me); - // } - - // printf("me = %d sendrecv finished\n", universe->me); - // printf("me = %d to be bcasted: tag[0] = %d bufrecvall[0][0] = %.4f\n", universe->me, tagrecvall[0], bufrecvall[0][0]); MPI_Bcast(tagrecvall, ntotal, MPI_LMP_TAGINT, 0, world); MPI_Bcast(bufrecvall[0], 3*ntotal, MPI_DOUBLE, 0, world); - // printf("me = %d broadcasted\n", universe->me); for(i=0; imap(tagrecvall[i]); @@ -1474,7 +1223,6 @@ void FixPIMDLangevin::inter_replica_comm(double **ptr) bufbeads[modeindex[iplan]][3*m+2] = bufrecvall[i][2]; } } - // printf("me = %d, tag[0] = %d bufrecvall[0][0] = %.4f bufbeads[0][0] = %.4f bufbeads[1][0] = %.4f bufbeads done\n", universe->me, tag[0], bufrecvall[0][0], bufbeads[0][0], bufbeads[1][0]); } } @@ -1486,8 +1234,6 @@ void FixPIMDLangevin::compute_vir_() int nlocal = atom->nlocal; xf = vir_ = xcf = centroid_vir = 0.0; int idx = atom->map(1); - // printf("in post_force, x_unwrap: %.6f %.6f %.6f xcall: %.6f %.6f %.6f\n", x_unwrap[idx][0], x_unwrap[idx][1], x_unwrap[idx][2], xcall[0], xcall[1], xcall[2]); - // printf("in compute_vir, xu = %.6f %.6f %.6f xc = %.6f %.6f %.6f\n", x_unwrap[idx][0], x_unwrap[idx][1], x_unwrap[idx][2], xc[idx][0], xc[idx][1], xc[idx][2]); for(int i=0; if[i][j]; xcf += (x_unwrap[i][j] - xc[i][j]) * atom->f[i][j]; } - // int idx = atom->map(i+1); - // printf("me = %d step = %d tag = %d idx = %d xu = %.6f %.6f %.6f xc = %.6f %.6f %.6f f = %.6f %.6f %.6f\n", universe->me, update->ntimestep, i+1, idx, x_unwrap[idx][0], x_unwrap[idx][1], x_unwrap[idx][2], xc[idx][0], xc[idx][1], xc[idx][2], atom->f[idx][0], atom->f[idx][1], atom->f[idx][2]); } MPI_Allreduce(&xf, &vir_, 1, MPI_DOUBLE, MPI_SUM, universe->uworld); MPI_Allreduce(&xcf, ¢roid_vir, 1, MPI_DOUBLE, MPI_SUM, universe->uworld); @@ -1530,7 +1274,6 @@ void FixPIMDLangevin::compute_vir() double vir_bead=(virial[0]+virial[1]+virial[2]); MPI_Allreduce(&vir_bead, &vir, 1, MPI_DOUBLE, MPI_SUM, universe->uworld); MPI_Allreduce(MPI_IN_PLACE, &virial[0], 6, MPI_DOUBLE, MPI_SUM, universe->uworld); - // printf("me = %d step = %d vir = %.30e\n", universe->me, update->ntimestep, vir); } /* ---------------------------------------------------------------------- */ @@ -1550,12 +1293,10 @@ void FixPIMDLangevin::compute_stress_tensor() ke_tensor[4] += 0.5 * mass[type[i]] * atom->v[i][0] * atom->v[i][2] * force->mvv2e; ke_tensor[5] += 0.5 * mass[type[i]] * atom->v[i][1] * atom->v[i][2] * force->mvv2e; } - // MPI_Allreduce(&ke_tensor, &ke_tensor, 6, MPI_DOUBLE, MPI_SUM, world); MPI_Allreduce(MPI_IN_PLACE, &ke_tensor, 6, MPI_DOUBLE, MPI_SUM, world); for(int i=0; i<6; i++) { stress_tensor[i] = inv_volume * ((2*ke_tensor[i] - c_vir_tensor[i]) * force->nktv2p + virial[i]) / np; - // printf("i = %d, c_vir = %.6f, virial = %.6f stress = %.6f\n", i, c_vir_tensor[i], virial[i], stress_tensor[i]); } } MPI_Bcast(&stress_tensor, 6, MPI_DOUBLE, 0, universe->uworld); @@ -1577,12 +1318,7 @@ void FixPIMDLangevin::compute_totke() } } kine *= force->mvv2e; - // printf("me = %d, kine = %.6e\n", universe->me, kine); MPI_Allreduce(&kine, &ke_bead, 1, MPI_DOUBLE, MPI_SUM, world); - // MPI_Allreduce(&kine, &totke, 1, MPI_DOUBLE, MPI_SUM, universe->uworld); - // totke *= force->mvv2e / np; - - // c_press->compute_scalar(); } /* ---------------------------------------------------------------------- */ @@ -1596,15 +1332,12 @@ void FixPIMDLangevin::compute_spring_energy() double* _mass = atom->mass; int* type = atom->type; int nlocal = atom->nlocal; - // printf("iworld = %d, fbond = %.4e lam = %.4e\n", universe->iworld, fbond, lam[universe->iworld]); for(int i=0; iiworld] * (x[i][0]*x[i][0] + x[i][1]*x[i][1] + x[i][2]*x[i][2]); } MPI_Allreduce(&spring_energy, &se_bead, 1, MPI_DOUBLE, MPI_SUM, world); - // MPI_Allreduce(&spring_energy, &total_spring_energy, 1, MPI_DOUBLE, MPI_SUM, universe->uworld); - // total_spring_energy /= np; } /* ---------------------------------------------------------------------- */ @@ -1617,8 +1350,6 @@ void FixPIMDLangevin::compute_pote() c_pe->compute_scalar(); pe_bead = c_pe->scalar; pot_energy_partition = pe_bead / universe->procs_per_world[universe->iworld]; - // MPI_Allreduce(&pot_energy_partition, &pote, 1, MPI_DOUBLE, MPI_SUM, universe->uworld); - // pote /= np; } /* ---------------------------------------------------------------------- */ @@ -1656,8 +1387,6 @@ void FixPIMDLangevin::compute_p_prim() void FixPIMDLangevin::compute_p_cv() { inv_volume = 1.0 / (domain->xprd * domain->yprd * domain->zprd); - // p_md = 2. / 3 * inv_volume * ((totke - total_spring_energy) * force->nktv2p + 0.5 * vir / np) ; - // printf("inv_V = %.30e ke = %.30e cv = %.30e vir = %.30e\n", inv_volume, ke_bead, centroid_vir, vir); if(universe->iworld == 0) { p_cv = 1. / 3. * inv_volume * ((2. * ke_bead - 1. * centroid_vir) * force->nktv2p + 1. * vir) / np; From f84765f29e5f3f5236db7b583532fb1a5f4ac916 Mon Sep 17 00:00:00 2001 From: Yifan Li Date: Sat, 25 Feb 2023 20:34:10 -0500 Subject: [PATCH 015/396] update document for fix pimd/langevin --- doc/src/fix_pimd.rst | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/doc/src/fix_pimd.rst b/doc/src/fix_pimd.rst index 342530e6a9..4d08497928 100644 --- a/doc/src/fix_pimd.rst +++ b/doc/src/fix_pimd.rst @@ -17,16 +17,29 @@ Syntax * ID, group-ID are documented in :doc:`fix ` command * style = *pimd/langevin* or *pimd/nvt* = style name of this fix command * zero or more keyword/value pairs may be appended -* keyword = *method* or *fmass* or *sp* or *temp* or *nhc* +* keywords for style *pimd/nvt* .. parsed-literal:: - + *keywords* = *method* or *fmass* or *sp* or *temp* or *nhc* *method* value = *pimd* or *nmpimd* or *cmd* *fmass* value = scaling factor on mass *sp* value = scaling factor on Planck constant *temp* value = temperature (temperarate units) *nhc* value = Nc = number of chains in Nose-Hoover thermostat +* keywords for style *pimd/langevin* + + .. parsed-literal:: + *keywords* = *method* or *integrator* or *ensemble* or *fmass* or *fmmode* or *scale* or *lj* or *temp* or *thermostat* or *tau* or *press* or *barostat* or *taup* or *iso* or *aniso* + *method* value = *nmpimd* + *fmass* value = scaling factor on mass + *sp* value = scaling factor on Planck constant + *temp* value = target temperature (temperarate units) + *thermostat* values = PILE_L *seed* + *seed* = random number seed + *tau* value = thermostat damping parameter (time unit) + *press* value = target pressure (pressure units) + Examples """""""" From 25a1996ece081752364cfca146ac0a74d8b9a699 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Sat, 25 Feb 2023 22:40:30 -0500 Subject: [PATCH 016/396] some formatting and programming style updates --- src/REPLICA/fix_pimd_langevin.cpp | 1209 ++++++++++++++--------------- src/REPLICA/fix_pimd_langevin.h | 5 +- 2 files changed, 569 insertions(+), 645 deletions(-) diff --git a/src/REPLICA/fix_pimd_langevin.cpp b/src/REPLICA/fix_pimd_langevin.cpp index d4e8648504..22bed54c3b 100644 --- a/src/REPLICA/fix_pimd_langevin.cpp +++ b/src/REPLICA/fix_pimd_langevin.cpp @@ -14,13 +14,7 @@ /* ---------------------------------------------------------------------- Package FixPIMDLangevin Purpose Quantum Path Integral Algorithm for Quantum Chemistry - Copyright Voth Group @ University of Chicago - Authors Chris Knight & Yuxing Peng (yuxing at uchicago.edu) - Updated Oct-01-2011 - Version 1.0 - - Updated Jun-07-2022 Yifan Li @ Princeton University (yifanl0716@gmail.com) Added components: - Multi-processor parallelism for each bead @@ -45,8 +39,8 @@ #include "modify.h" #include "random_mars.h" #include "universe.h" -#include "utils.h" #include "update.h" +#include "utils.h" #include #include @@ -56,19 +50,22 @@ using namespace FixConst; using namespace MathConst; enum { PIMD, NMPIMD, CMD }; -enum { physical, normal }; -enum { baoab, obabo }; +enum { PHYSICAL, NORMAL }; +enum { BAOAB, OBABO }; enum { ISO, ANISO, TRICLINIC }; enum { PILE_L }; enum { MTTK, BZP }; // char* Barostats[] = {"MTTK", "BZP"}; -std::map Barostats {{MTTK, "MTTK"}, {BZP, "BZP"}}; -enum { nve, nvt, nph, npt }; -enum{SINGLE_PROC, MULTI_PROC}; + +static std::map Barostats{{MTTK, "MTTK"}, {BZP, "BZP"}}; +enum { NVE, NVT, NPH, NPT }; +enum { SINGLE_PROC, MULTI_PROC }; /* ---------------------------------------------------------------------- */ -FixPIMDLangevin::FixPIMDLangevin(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg), random(nullptr), c_pe(nullptr), c_press(nullptr) { +FixPIMDLangevin::FixPIMDLangevin(LAMMPS *lmp, int narg, char **arg) : + Fix(lmp, narg, arg), random(nullptr), c_pe(nullptr), c_press(nullptr) +{ time_integrate = 1; tagsend = tagrecv = nullptr; bufsend = bufrecv = nullptr; @@ -93,24 +90,24 @@ FixPIMDLangevin::FixPIMDLangevin(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, n mass = nullptr; method = PIMD; - ensemble = nvt; - integrator = obabo; + ensemble = NVT; + integrator = OBABO; thermostat = PILE_L; barostat = BZP; fmass = 1.0; sp = 1.0; - temp = 298.15; - Lan_temp = 298.15; - tau = 1.0; - tau_p = 1.0; - Pext = 1.0; - tstat_flag = 1; - pstat_flag = 0; - mapflag = 1; + temp = 298.15; + Lan_temp = 298.15; + tau = 1.0; + tau_p = 1.0; + Pext = 1.0; + tstat_flag = 1; + pstat_flag = 0; + mapflag = 1; removecomflag = 1; - fmmode = physical; - pstyle = ISO; - for (int i=0; i<6; i++) p_flag[i] = 0; + fmmode = PHYSICAL; + pstyle = ISO; + for (int i = 0; i < 6; i++) p_flag[i] = 0; for (int i = 3; i < narg - 1; i += 2) { if (strcmp(arg[i], "method") == 0) { @@ -121,129 +118,138 @@ FixPIMDLangevin::FixPIMDLangevin(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, n else if (strcmp(arg[i + 1], "cmd") == 0) method = CMD; else - error->universe_all(FLERR, "Unknown method parameter for fix pimd"); - } - else if(strcmp(arg[i], "integrator")==0) + error->universe_all(FLERR, "Unknown method parameter for fix pimd/langevin"); + } else if (strcmp(arg[i], "integrator") == 0) { - if(strcmp(arg[i+1], "obabo")==0) integrator=obabo; - else if(strcmp(arg[i+1], "baoab")==0) integrator=baoab; - else error->universe_all(FLERR, "Unknown integrator parameter for fix pimd. Only obabo and baoab integrators are supported!"); + if (strcmp(arg[i + 1], "obabo") == 0) + integrator = OBABO; + else if (strcmp(arg[i + 1], "baoab") == 0) + integrator = BAOAB; + else + error->universe_all(FLERR, + "Unknown integrator parameter for fix pimd/langevin. Only obabo and baoab " + "integrators are supported!"); } - else if(strcmp(arg[i], "ensemble")==0) - { - if(strcmp(arg[i+1], "nve")==0) { ensemble = nve; tstat_flag = 0; pstat_flag = 0; } - else if(strcmp(arg[i+1], "nvt")==0) { ensemble = nvt; tstat_flag = 1; pstat_flag = 0; } - else if(strcmp(arg[i+1], "nph")==0) { ensemble = nph; tstat_flag = 0; pstat_flag = 1; } - else if(strcmp(arg[i+1], "npt")==0) { ensemble = npt; tstat_flag = 1; pstat_flag = 1; } - else error->universe_all(FLERR, "Unknown ensemble parameter for fix pimd. Only nve and nvt ensembles are supported!"); + else if (strcmp(arg[i], "ensemble") == 0) { + if (strcmp(arg[i + 1], "nve") == 0) { + ensemble = NVE; + tstat_flag = 0; + pstat_flag = 0; + } else if (strcmp(arg[i + 1], "nvt") == 0) { + ensemble = NVT; + tstat_flag = 1; + pstat_flag = 0; + } else if (strcmp(arg[i + 1], "nph") == 0) { + ensemble = NPH; + tstat_flag = 0; + pstat_flag = 1; + } else if (strcmp(arg[i + 1], "npt") == 0) { + ensemble = NPT; + tstat_flag = 1; + pstat_flag = 1; + } else + error->universe_all( + FLERR, + "Unknown ensemble parameter for fix pimd/langevin. Only nve and nvt ensembles are supported!"); } - else if (strcmp(arg[i], "fmass") == 0) { + else if (strcmp(arg[i], "fmass") == 0) { fmass = utils::numeric(FLERR, arg[i + 1], false, lmp); if (fmass < 0.0 || fmass > 1.0) - error->universe_all(FLERR, "Invalid fmass value for fix pimd"); + error->universe_all(FLERR, "Invalid fmass value for fix pimd/langevin"); } - else if(strcmp(arg[i], "fmmode")==0) - { - if(strcmp(arg[i+1], "physical")==0) fmmode=physical; - else if(strcmp(arg[i+1], "normal")==0) fmmode=normal; - else error->universe_all(FLERR, "Unknown fictitious mass mode for fix pimd. Only physical mass and normal mode mass are supported!"); + else if (strcmp(arg[i], "fmmode") == 0) { + if (strcmp(arg[i + 1], "physical") == 0) + fmmode = PHYSICAL; + else if (strcmp(arg[i + 1], "normal") == 0) + fmmode = NORMAL; + else + error->universe_all(FLERR, + "Unknown fictitious mass mode for fix pimd/langevin. Only physical mass and " + "normal mode mass are supported!"); } - else if(strcmp(arg[i],"scale")==0) - { - pilescale = atof(arg[i+1]); - if(pilescale<0.0) error->universe_all(FLERR,"Invalid pile scale value for fix pimd"); + else if (strcmp(arg[i], "scale") == 0) { + pilescale = atof(arg[i + 1]); + if (pilescale < 0.0) error->universe_all(FLERR, "Invalid pile scale value for fix pimd/langevin"); } else if (strcmp(arg[i], "temp") == 0) { temp = utils::numeric(FLERR, arg[i + 1], false, lmp); - if (temp < 0.0) error->universe_all(FLERR, "Invalid temp value for fix pimd"); + if (temp < 0.0) error->universe_all(FLERR, "Invalid temp value for fix pimd/langevin"); } else if (strcmp(arg[i], "lj") == 0) { - lj_epsilon = utils::numeric(FLERR, arg[i+1], false, lmp); - lj_sigma = utils::numeric(FLERR, arg[i+2], false, lmp); - lj_mass = utils::numeric(FLERR, arg[i+3], false, lmp); - other_planck = utils::numeric(FLERR, arg[i+4], false, lmp); + lj_epsilon = utils::numeric(FLERR, arg[i + 1], false, lmp); + lj_sigma = utils::numeric(FLERR, arg[i + 2], false, lmp); + lj_mass = utils::numeric(FLERR, arg[i + 3], false, lmp); + other_planck = utils::numeric(FLERR, arg[i + 4], false, lmp); i++; i++; i++; } - else if(strcmp(arg[i], "thermostat")==0) - { - if(strcmp(arg[i+1],"PILE_L")==0) - { + else if (strcmp(arg[i], "thermostat") == 0) { + if (strcmp(arg[i + 1], "PILE_L") == 0) { thermostat = PILE_L; - seed = atoi(arg[i+2]); + seed = atoi(arg[i + 2]); i++; } } - else if(strcmp(arg[i], "tau")==0) - { - tau = atof(arg[i+1]); + else if (strcmp(arg[i], "tau") == 0) { + tau = atof(arg[i + 1]); } - else if(strcmp(arg[i], "press")==0) - { - Pext = atof(arg[i+1]); - if(Pext<0.0) error->universe_all(FLERR,"Invalid press value for fix pimd"); + else if (strcmp(arg[i], "press") == 0) { + Pext = atof(arg[i + 1]); + if (Pext < 0.0) error->universe_all(FLERR, "Invalid press value for fix pimd/langevin"); } - else if(strcmp(arg[i], "barostat")==0) - { - if(strcmp(arg[i+1],"MTTK")==0) - { + else if (strcmp(arg[i], "barostat") == 0) { + if (strcmp(arg[i + 1], "MTTK") == 0) { barostat = MTTK; - } - else if(strcmp(arg[i+1],"BZP")==0) - { + } else if (strcmp(arg[i + 1], "BZP") == 0) { barostat = BZP; - } - else error->universe_all(FLERR,"Unknown barostat parameter for fix pimd"); + } else + error->universe_all(FLERR, "Unknown barostat parameter for fix pimd/langevin"); } - else if(strcmp(arg[i], "iso")==0) - { + else if (strcmp(arg[i], "iso") == 0) { pstyle = ISO; i--; } - else if(strcmp(arg[i], "aniso")==0) - { + else if (strcmp(arg[i], "aniso") == 0) { pstyle = ANISO; i--; } - else if(strcmp(arg[i], "taup")==0) - { - tau_p = atof(arg[i+1]); - if(tau_p<=0.0) error->universe_all(FLERR, "Invalid tau_p value for fix pimd"); - } - else if(strcmp(arg[i], "fixcom")==0) - { - if(strcmp(arg[i+1], "yes")==0) removecomflag = 1; - else if(strcmp(arg[i+1], "no")==0) removecomflag = 0; + else if (strcmp(arg[i], "taup") == 0) { + tau_p = atof(arg[i + 1]); + if (tau_p <= 0.0) error->universe_all(FLERR, "Invalid tau_p value for fix pimd/langevin"); + } else if (strcmp(arg[i], "fixcom") == 0) { + if (strcmp(arg[i + 1], "yes") == 0) + removecomflag = 1; + else if (strcmp(arg[i + 1], "no") == 0) + removecomflag = 0; } - else if(strcmp(arg[i], "map")==0) - { - if(strcmp(arg[i+1], "yes")==0) mapflag = 1; - else if(strcmp(arg[i+1], "no")==0) mapflag = 0; + else if (strcmp(arg[i], "map") == 0) { + if (strcmp(arg[i + 1], "yes") == 0) + mapflag = 1; + else if (strcmp(arg[i + 1], "no") == 0) + mapflag = 0; + } else { + error->universe_all(FLERR, fmt::format("Unknown keyword {} for fix {}", arg[i], style)); } - - else error->universe_all(FLERR, fmt::format("Unknown keyword {} for fix pimd", arg[i])); } /* Initiation */ - int nlocal = atom->nlocal; - global_freq = 1; vector_flag = 1; size_vector = 11; @@ -253,92 +259,87 @@ FixPIMDLangevin::FixPIMDLangevin(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, n id_pe = new char[8]; strcpy(id_pe, "pimd_pe"); - char **newarg = new char*[3]; + char **newarg = new char *[3]; newarg[0] = id_pe; newarg[1] = (char *) "all"; newarg[2] = (char *) "pe"; - modify->add_compute(3,newarg); - delete [] newarg; - + modify->add_compute(3, newarg); + delete[] newarg; id_press = new char[12]; strcpy(id_press, "pimd_press"); - newarg = new char*[5]; + newarg = new char *[5]; newarg[0] = id_press; - newarg[1] = (char*) "all"; - newarg[2] = (char*) "pressure"; - newarg[3] = (char*) "thermo_temp"; - newarg[4] = (char*) "virial"; + newarg[1] = (char *) "all"; + newarg[2] = (char *) "pressure"; + newarg[3] = (char *) "thermo_temp"; + newarg[4] = (char *) "virial"; modify->add_compute(5, newarg); - delete [] newarg; + delete[] newarg; vol0 = domain->xprd * domain->yprd * domain->zprd; - fixedpoint[0] = 0.5*(domain->boxlo[0]+domain->boxhi[0]); - fixedpoint[1] = 0.5*(domain->boxlo[1]+domain->boxhi[1]); - fixedpoint[2] = 0.5*(domain->boxlo[2]+domain->boxhi[2]); + fixedpoint[0] = 0.5 * (domain->boxlo[0] + domain->boxhi[0]); + fixedpoint[1] = 0.5 * (domain->boxlo[1] + domain->boxhi[1]); + fixedpoint[2] = 0.5 * (domain->boxlo[2] + domain->boxhi[2]); // initialize Marsaglia RNG with processor-unique seed - if(integrator==baoab || integrator==obabo) - { + if (integrator == BAOAB || integrator == OBABO) { Lan_temp = temp; random = new RanMars(lmp, seed + universe->me); } me = comm->me; nprocs = comm->nprocs; - if(nprocs == 1) cmode = SINGLE_PROC; - else cmode = MULTI_PROC; + if (nprocs == 1) + cmode = SINGLE_PROC; + else + cmode = MULTI_PROC; nprocs_universe = universe->nprocs; nreplica = universe->nworlds; ireplica = universe->iworld; int *iroots = new int[nreplica]; - MPI_Group uworldgroup,rootgroup; + MPI_Group uworldgroup, rootgroup; - for (int i=0; iroot_proc[i]; + for (int i = 0; i < nreplica; i++) iroots[i] = universe->root_proc[i]; MPI_Comm_group(universe->uworld, &uworldgroup); MPI_Group_incl(uworldgroup, nreplica, iroots, &rootgroup); MPI_Comm_create(universe->uworld, rootgroup, &rootworld); if (rootgroup != MPI_GROUP_NULL) MPI_Group_free(&rootgroup); if (uworldgroup != MPI_GROUP_NULL) MPI_Group_free(&uworldgroup); - delete [] iroots; + delete[] iroots; ntotal = atom->natoms; - if(atom->nmax > maxlocal) reallocate(); - if(atom->nmax > maxunwrap) reallocate_x_unwrap(); - if(atom->nmax > maxxc) reallocate_xc(); - memory->create(xcall, ntotal*3, "FixPIMDLangevin:xcall"); + if (atom->nmax > maxlocal) reallocate(); + if (atom->nmax > maxunwrap) reallocate_x_unwrap(); + if (atom->nmax > maxxc) reallocate_xc(); + memory->create(xcall, ntotal * 3, "FixPIMDLangevin:xcall"); - if (cmode == SINGLE_PROC) - { + if (cmode == SINGLE_PROC) { memory->create(bufsorted, ntotal, 3, "FixPIMDLangevin:bufsorted"); memory->create(outsorted, ntotal, 3, "FixPIMDLangevin:outsorted"); - memory->create(bufsortedall, nreplica*ntotal, 3, "FixPIMDLangevin:bufsortedall"); - memory->create(buftransall, nreplica*ntotal, 3, "FixPIMDLangevin:buftransall"); + memory->create(bufsortedall, nreplica * ntotal, 3, "FixPIMDLangevin:bufsortedall"); + memory->create(buftransall, nreplica * ntotal, 3, "FixPIMDLangevin:buftransall"); memory->create(counts, nreplica, "FixPIMDLangevin:counts"); memory->create(displacements, nreplica, "FixPIMDLangevin:displacements"); } if ((cmode == MULTI_PROC) && (counts == nullptr)) { - memory->create(bufsendall,ntotal,3,"FixPIMDLangevin:bufsendall"); - memory->create(bufrecvall,ntotal,3,"FixPIMDLangevin:bufrecvall"); - memory->create(tagsendall,ntotal,"FixPIMDLangevin:tagsendall"); - memory->create(tagrecvall,ntotal,"FixPIMDLangevin:tagrecvall"); - memory->create(counts,nprocs,"FixPIMDLangevin:counts"); - memory->create(displacements,nprocs,"FixPIMDLangevin:displacements"); + memory->create(bufsendall, ntotal, 3, "FixPIMDLangevin:bufsendall"); + memory->create(bufrecvall, ntotal, 3, "FixPIMDLangevin:bufrecvall"); + memory->create(tagsendall, ntotal, "FixPIMDLangevin:tagsendall"); + memory->create(tagrecvall, ntotal, "FixPIMDLangevin:tagrecvall"); + memory->create(counts, nprocs, "FixPIMDLangevin:counts"); + memory->create(displacements, nprocs, "FixPIMDLangevin:displacements"); } - } /* ---------------------------------------------------------------------- */ -FixPIMDLangevin::~FixPIMDLangevin() -{ - -} +FixPIMDLangevin::~FixPIMDLangevin() {} /* ---------------------------------------------------------------------- */ @@ -358,10 +359,10 @@ int FixPIMDLangevin::setmask() void FixPIMDLangevin::init() { if (atom->map_style == Atom::MAP_NONE) - error->all(FLERR, "Fix pimd requires an atom map, see atom_modify"); + error->all(FLERR, "fix pimd/langevin requires an atom map, see atom_modify"); if (universe->me == 0 && universe->uscreen) - fprintf(universe->uscreen, "Fix pimd initializing Path-Integral ...\n"); + fprintf(universe->uscreen, "fix pimd/langevin initializing Path-Integral ...\n"); // prepare the constants @@ -369,43 +370,38 @@ void FixPIMDLangevin::init() np = universe->nworlds; inverse_np = 1.0 / np; - const double Boltzmann = force->boltz; - if (strcmp(update->unit_style,"lj") == 0) { - double planck_star = sqrt(lj_epsilon)*sqrt(atom->mass[0])*lj_sigma; + double planck; + if (strcmp(update->unit_style, "lj") == 0) { + double planck_star = sqrt(lj_epsilon) * sqrt(atom->mass[0]) * lj_sigma; planck = other_planck / planck_star; + } else { + planck = force->hplanck; } - else planck = force->hplanck; - const double Planck = planck; - hbar = Planck / (2.0 * MY_PI); + hbar = planck / (2.0 * MY_PI); kBT = force->boltz * temp; - double beta = 1.0 / (Boltzmann * temp); + double beta = 1.0 / (force->boltz * temp); double _fbond = 1.0 * np * np / (beta * beta * hbar * hbar); omega_np = np / (hbar * beta) * sqrt(force->mvv2e); - beta_np = 1.0 / force->boltz / temp / np; + beta_np = 1.0 / force->boltz / temp * inverse_np; fbond = _fbond * force->mvv2e; if (universe->me == 0) - printf("Fix pimd -P/(beta^2 * hbar^2) = %20.7lE (kcal/mol/A^2)\n\n", fbond); + printf("fix pimd/langevin -P/(beta^2 * hbar^2) = %20.7lE (kcal/mol/A^2)\n\n", fbond); - if(integrator==obabo) - { + if (integrator == OBABO) { dtf = 0.5 * update->dt * force->ftm2v; dtv = 0.5 * update->dt; dtv2 = dtv * dtv; - dtv3 = 1./3 * dtv2 * dtv * force->ftm2v; - } - else if(integrator==baoab) - { + dtv3 = THIRD * dtv2 * dtv * force->ftm2v; + } else if (integrator == BAOAB) { dtf = 0.5 * update->dt * force->ftm2v; dtv = 0.5 * update->dt; dtv2 = dtv * dtv; - dtv3 = 1./3 * dtv2 * dtv * force->ftm2v; - } - else - { - error->universe_all(FLERR,"Unknown integrator parameter for fix pimd"); + dtv3 = THIRD * dtv2 * dtv * force->ftm2v; + } else { + error->universe_all(FLERR, "Unknown integrator parameter for fix pimd/langevin"); } comm_init(); @@ -425,60 +421,56 @@ void FixPIMDLangevin::init() t_prim = t_vir = t_cv = p_prim = p_vir = p_cv = p_md = 0.0; - if(universe->me==0) fprintf(screen, "Fix pimd successfully initialized!\n"); + if (universe->me == 0) fprintf(screen, "fix pimd/langevin successfully initialized!\n"); } /* ---------------------------------------------------------------------- */ void FixPIMDLangevin::setup(int vflag) { - if(universe->me==0) printf("Setting up Path-Integral ...\n"); + if (universe->me == 0) printf("Setting up Path-Integral ...\n"); int nlocal = atom->nlocal; - tagint *tag = atom->tag; double **x = atom->x; double **v = atom->v; imageint *image = atom->image; - if(mapflag){ - for(int i=0; iunmap(x[i], image[i]); - } + if (mapflag) { + for (int i = 0; i < nlocal; i++) domain->unmap(x[i], image[i]); } - if(method==NMPIMD) - { + if (method == NMPIMD) { inter_replica_comm(x); - if(cmode == SINGLE_PROC) nmpimd_transform(bufsortedall, x, M_x2xp[universe->iworld]); - else if(cmode == MULTI_PROC) nmpimd_transform(bufbeads, x, M_x2xp[universe->iworld]); + if (cmode == SINGLE_PROC) + nmpimd_transform(bufsortedall, x, M_x2xp[universe->iworld]); + else if (cmode == MULTI_PROC) + nmpimd_transform(bufbeads, x, M_x2xp[universe->iworld]); } collect_xc(); compute_spring_energy(); - if(method==NMPIMD) - { + if (method == NMPIMD) { inter_replica_comm(x); - if(cmode == SINGLE_PROC) nmpimd_transform(bufsortedall, x, M_xp2x[universe->iworld]); - else if(cmode == MULTI_PROC) nmpimd_transform(bufbeads, x, M_xp2x[universe->iworld]); + if (cmode == SINGLE_PROC) + nmpimd_transform(bufsortedall, x, M_xp2x[universe->iworld]); + else if (cmode == MULTI_PROC) + nmpimd_transform(bufbeads, x, M_xp2x[universe->iworld]); } - if(mapflag){ - for(int i=0; iunmap_inv(x[i], image[i]); - } + if (mapflag) { + for (int i = 0; i < nlocal; i++) domain->unmap_inv(x[i], image[i]); } - if(method==NMPIMD) - { + if (method == NMPIMD) { inter_replica_comm(v); - if(cmode == SINGLE_PROC) nmpimd_transform(bufsortedall, v, M_x2xp[universe->iworld]); - else if(cmode == MULTI_PROC) nmpimd_transform(bufbeads, v, M_x2xp[universe->iworld]); + if (cmode == SINGLE_PROC) + nmpimd_transform(bufsortedall, v, M_x2xp[universe->iworld]); + else if (cmode == MULTI_PROC) + nmpimd_transform(bufbeads, v, M_x2xp[universe->iworld]); } - if(universe->me==0 && screen) fprintf(screen,"Setting up Path-Integral ...\n"); - if(universe->me==0) printf("Setting up Path-Integral ...\n"); + if (universe->me == 0 && screen) fprintf(screen, "Setting up Path-Integral ...\n"); + if (universe->me == 0) printf("Setting up Path-Integral ...\n"); post_force(vflag); compute_totke(); end_of_step(); - c_pe->addstep(update->ntimestep+1); - c_press->addstep(update->ntimestep+1); + c_pe->addstep(update->ntimestep + 1); + c_press->addstep(update->ntimestep + 1); } /* ---------------------------------------------------------------------- */ @@ -486,158 +478,133 @@ void FixPIMDLangevin::setup(int vflag) void FixPIMDLangevin::initial_integrate(int /*vflag*/) { int nlocal = atom->nlocal; - tagint *tag = atom->tag; double **x = atom->x; imageint *image = atom->image; - if(mapflag){ - for(int i=0; iunmap(x[i], image[i]); - } + if (mapflag) { + for (int i = 0; i < nlocal; i++) domain->unmap(x[i], image[i]); } - if(integrator==obabo) - { - if(tstat_flag) - { + if (integrator == OBABO) { + if (tstat_flag) { o_step(); - if(pstat_flag) press_o_step(); + if (pstat_flag) press_o_step(); } - if(pstat_flag) - { + if (pstat_flag) { compute_totke(); compute_p_cv(); press_v_step(); } - b_step(); - if(method==NMPIMD) - { + b_step(); + if (method == NMPIMD) { inter_replica_comm(x); - if(cmode == SINGLE_PROC) nmpimd_transform(bufsortedall, x, M_x2xp[universe->iworld]); - else if(cmode == MULTI_PROC) nmpimd_transform(bufbeads, x, M_x2xp[universe->iworld]); + if (cmode == SINGLE_PROC) + nmpimd_transform(bufsortedall, x, M_x2xp[universe->iworld]); + else if (cmode == MULTI_PROC) + nmpimd_transform(bufbeads, x, M_x2xp[universe->iworld]); } - qc_step(); - a_step(); - qc_step(); - a_step(); + qc_step(); + a_step(); + qc_step(); + a_step(); + } else if (integrator == BAOAB) { + if (pstat_flag) { + compute_totke(); + compute_p_cv(); + press_v_step(); } - else if(integrator==baoab) - { - if(pstat_flag) - { - compute_totke(); - compute_p_cv(); - press_v_step(); - } - b_step(); - if(method==NMPIMD) - { - inter_replica_comm(x); - if(cmode == SINGLE_PROC) nmpimd_transform(bufsortedall, x, M_x2xp[universe->iworld]); - else if(cmode == MULTI_PROC) nmpimd_transform(bufbeads, x, M_x2xp[universe->iworld]); - } - qc_step(); - a_step(); - if(tstat_flag) - { - o_step(); - if(pstat_flag) press_o_step(); - } - qc_step(); - a_step(); - } - else - { - error->universe_all(FLERR,"Unknown integrator parameter for fix pimd"); - } - collect_xc(); - compute_spring_energy(); - - if(method==NMPIMD) - { + b_step(); + if (method == NMPIMD) { inter_replica_comm(x); - if(cmode == SINGLE_PROC) nmpimd_transform(bufsortedall, x, M_xp2x[universe->iworld]); - else if(cmode == MULTI_PROC) nmpimd_transform(bufbeads, x, M_xp2x[universe->iworld]); + if (cmode == SINGLE_PROC) + nmpimd_transform(bufsortedall, x, M_x2xp[universe->iworld]); + else if (cmode == MULTI_PROC) + nmpimd_transform(bufbeads, x, M_x2xp[universe->iworld]); } - - - if(mapflag){ - for(int i=0; iunmap_inv(x[i], image[i]); - } + qc_step(); + a_step(); + if (tstat_flag) { + o_step(); + if (pstat_flag) press_o_step(); } + qc_step(); + a_step(); + } else { + error->universe_all(FLERR, "Unknown integrator parameter for fix pimd/langevin"); + } + collect_xc(); + compute_spring_energy(); + + if (method == NMPIMD) { + inter_replica_comm(x); + if (cmode == SINGLE_PROC) + nmpimd_transform(bufsortedall, x, M_xp2x[universe->iworld]); + else if (cmode == MULTI_PROC) + nmpimd_transform(bufbeads, x, M_xp2x[universe->iworld]); + } + + if (mapflag) { + for (int i = 0; i < nlocal; i++) { domain->unmap_inv(x[i], image[i]); } + } } /* ---------------------------------------------------------------------- */ void FixPIMDLangevin::final_integrate() { - if(pstat_flag) - { - compute_totke(); - compute_p_cv(); - press_v_step(); + if (pstat_flag) { + compute_totke(); + compute_p_cv(); + press_v_step(); + } + b_step(); + if (integrator == OBABO) { + if (tstat_flag) { + o_step(); + if (pstat_flag) press_o_step(); } - b_step(); - if(integrator==obabo) - { - if(tstat_flag) - { - o_step(); - if(pstat_flag) press_o_step(); - } - } - else if(integrator==baoab) - { + } else if (integrator == BAOAB) { - } - else - { - error->universe_all(FLERR,"Unknown integrator parameter for fix pimd"); - } + } else { + error->universe_all(FLERR, "Unknown integrator parameter for fix pimd/langevin"); + } } /* ---------------------------------------------------------------------- */ void FixPIMDLangevin::post_force(int /*flag*/) { - if(atom->nmax > maxunwrap) reallocate_x_unwrap(); - if(atom->nmax > maxxc) reallocate_xc(); + if (atom->nmax > maxunwrap) reallocate_x_unwrap(); + if (atom->nmax > maxxc) reallocate_xc(); int nlocal = atom->nlocal; double **x = atom->x; double **f = atom->f; imageint *image = atom->image; tagint *tag = atom->tag; - for(int i=0; iunmap(x_unwrap[i], image[i]); - } + if (mapflag) { + for (int i = 0; i < nlocal; i++) { domain->unmap(x_unwrap[i], image[i]); } } - for(int i=0; imap(1); + compute_vir(); compute_vir_(); compute_pote(); - if(method==NMPIMD) - { + if (method == NMPIMD) { inter_replica_comm(f); - if(cmode == SINGLE_PROC) nmpimd_transform(bufsortedall, f, M_x2xp[universe->iworld]); - else if(cmode == MULTI_PROC) nmpimd_transform(bufbeads, f, M_x2xp[universe->iworld]); + if (cmode == SINGLE_PROC) + nmpimd_transform(bufsortedall, f, M_x2xp[universe->iworld]); + else if (cmode == MULTI_PROC) + nmpimd_transform(bufbeads, f, M_x2xp[universe->iworld]); } - c_pe->addstep(update->ntimestep+1); - c_press->addstep(update->ntimestep+1); + c_pe->addstep(update->ntimestep + 1); + c_press->addstep(update->ntimestep + 1); } /* ---------------------------------------------------------------------- */ @@ -647,11 +614,10 @@ void FixPIMDLangevin::end_of_step() compute_totke(); compute_p_cv(); compute_tote(); - if(pstat_flag) compute_totenthalpy(); + if (pstat_flag) compute_totenthalpy(); - if(update->ntimestep % 10000 == 0) - { - if(universe->me==0) printf("This is the end of step %ld.\n", update->ntimestep); + if (update->ntimestep % 10000 == 0) { + if (universe->me == 0) printf("This is the end of step %ld.\n", update->ntimestep); } } @@ -660,37 +626,28 @@ void FixPIMDLangevin::collect_xc() int nlocal = atom->nlocal; double **x = atom->x; tagint *tag = atom->tag; - if(ireplica == 0) - { - if(cmode == SINGLE_PROC) - { - for(int i=0; imap(1); - if(cmode == MULTI_PROC) - { - MPI_Allreduce(MPI_IN_PLACE, xcall, ntotal*3, MPI_DOUBLE, MPI_SUM, world); + if (cmode == MULTI_PROC) { + MPI_Allreduce(MPI_IN_PLACE, xcall, ntotal * 3, MPI_DOUBLE, MPI_SUM, world); } } - MPI_Bcast(xcall, ntotal*3, MPI_DOUBLE, 0, universe->uworld); + MPI_Bcast(xcall, ntotal * 3, MPI_DOUBLE, 0, universe->uworld); } /* ---------------------------------------------------------------------- */ @@ -703,51 +660,45 @@ void FixPIMDLangevin::b_step() double **v = atom->v; double **f = atom->f; - for(int i=0; inlocal; double **x = atom->x; double **v = atom->v; - tagint *tag = atom->tag; double oldlo, oldhi; - if(!pstat_flag) { - if(universe->iworld == 0) - { - for(int i=0; iiworld == 0) { + for (int i = 0; i < nlocal; i++) { x[i][0] += dtv * v[i][0]; x[i][1] += dtv * v[i][1]; x[i][2] += dtv * v[i][2]; } } - } - else{ - if(universe->iworld == 0) - { + } else { + if (universe->iworld == 0) { double expp[3], expq[3]; - if(pstyle == ISO) {vw[1] = vw[0]; vw[2] = vw[0];} - for(int j=0; j<3; j++) - { + if (pstyle == ISO) { + vw[1] = vw[0]; + vw[2] = vw[0]; + } + for (int j = 0; j < 3; j++) { expq[j] = exp(dtv * vw[j]); expp[j] = exp(-dtv * vw[j]); } - if(barostat == BZP) - { - for(int i=0; iboxlo[0]; oldhi = domain->boxhi[0]; - domain->boxlo[0] = (oldlo-fixedpoint[0])*expq[0] + fixedpoint[0]; - domain->boxhi[0] = (oldhi-fixedpoint[0])*expq[0] + fixedpoint[0]; + domain->boxlo[0] = (oldlo - fixedpoint[0]) * expq[0] + fixedpoint[0]; + domain->boxhi[0] = (oldhi - fixedpoint[0]) * expq[0] + fixedpoint[0]; oldlo = domain->boxlo[1]; oldhi = domain->boxhi[1]; - domain->boxlo[1] = (oldlo-fixedpoint[1])*expq[1] + fixedpoint[1]; - domain->boxhi[1] = (oldhi-fixedpoint[1])*expq[1] + fixedpoint[1]; + domain->boxlo[1] = (oldlo - fixedpoint[1]) * expq[1] + fixedpoint[1]; + domain->boxhi[1] = (oldhi - fixedpoint[1]) * expq[1] + fixedpoint[1]; oldlo = domain->boxlo[2]; oldhi = domain->boxhi[2]; - domain->boxlo[2] = (oldlo-fixedpoint[2])*expq[2] + fixedpoint[2]; - domain->boxhi[2] = (oldhi-fixedpoint[2])*expq[2] + fixedpoint[2]; + domain->boxlo[2] = (oldlo - fixedpoint[2]) * expq[2] + fixedpoint[2]; + domain->boxhi[2] = (oldhi - fixedpoint[2]) * expq[2] + fixedpoint[2]; } } MPI_Barrier(universe->uworld); @@ -780,26 +731,33 @@ void FixPIMDLangevin::qc_step(){ /* ---------------------------------------------------------------------- */ -void FixPIMDLangevin::a_step(){ +void FixPIMDLangevin::a_step() +{ int n = atom->nlocal; double **x = atom->x; double **v = atom->v; - double x0, x1, x2, v0, v1, v2; // three components of x[i] and v[i] + double x0, x1, x2, v0, v1, v2; // three components of x[i] and v[i] - if(universe->iworld != 0) - { - for(int i=0; iiworld != 0) { + for (int i = 0; i < n; i++) { x0 = x[i][0]; x1 = x[i][1]; x2 = x[i][2]; - v0 = v[i][0]; v1 = v[i][1]; v2 = v[i][2]; - x[i][0] = Lan_c[universe->iworld] * x0 + 1./_omega_k[universe->iworld] * Lan_s[universe->iworld] * v0; - x[i][1] = Lan_c[universe->iworld] * x1 + 1./_omega_k[universe->iworld] * Lan_s[universe->iworld] * v1; - x[i][2] = Lan_c[universe->iworld] * x2 + 1./_omega_k[universe->iworld] * Lan_s[universe->iworld] * v2; - v[i][0] = -1.*_omega_k[universe->iworld] * Lan_s[universe->iworld] * x0 + Lan_c[universe->iworld] * v0; - v[i][1] = -1.*_omega_k[universe->iworld] * Lan_s[universe->iworld] * x1 + Lan_c[universe->iworld] * v1; - v[i][2] = -1.*_omega_k[universe->iworld] * Lan_s[universe->iworld] * x2 + Lan_c[universe->iworld] * v2; + v0 = v[i][0]; + v1 = v[i][1]; + v2 = v[i][2]; + x[i][0] = Lan_c[universe->iworld] * x0 + + 1.0 / _omega_k[universe->iworld] * Lan_s[universe->iworld] * v0; + x[i][1] = Lan_c[universe->iworld] * x1 + + 1.0 / _omega_k[universe->iworld] * Lan_s[universe->iworld] * v1; + x[i][2] = Lan_c[universe->iworld] * x2 + + 1.0 / _omega_k[universe->iworld] * Lan_s[universe->iworld] * v2; + v[i][0] = -1.0 * _omega_k[universe->iworld] * Lan_s[universe->iworld] * x0 + + Lan_c[universe->iworld] * v0; + v[i][1] = -1.0 * _omega_k[universe->iworld] * Lan_s[universe->iworld] * x1 + + Lan_c[universe->iworld] * v1; + v[i][2] = -1.0 * _omega_k[universe->iworld] * Lan_s[universe->iworld] * x2 + + Lan_c[universe->iworld] * v2; } } } @@ -809,8 +767,12 @@ void FixPIMDLangevin::a_step(){ void FixPIMDLangevin::baro_init() { vw[0] = vw[1] = vw[2] = vw[3] = vw[4] = vw[5] = 0.0; - if(pstyle == ISO) {W = 3 * (atom->natoms) * tau_p * tau_p * np * kBT;} // consistent with the definition in i-Pi - else if(pstyle == ANISO) {W = atom->natoms * tau_p * tau_p * np * kBT;} + if (pstyle == ISO) { + W = 3 * (atom->natoms) * tau_p * tau_p * np * kBT; + } // consistent with the definition in i-Pi + else if (pstyle == ANISO) { + W = atom->natoms * tau_p * tau_p * np * kBT; + } Vcoeff = 1.0; std::string out = fmt::format("\nInitializing PIMD {:s} barostat...\n", Barostats[barostat]); out += fmt::format("The barostat mass is W = {:.16e}\n", W); @@ -827,18 +789,13 @@ void FixPIMDLangevin::press_v_step() int *type = atom->type; volume = domain->xprd * domain->yprd * domain->zprd; - if(pstyle == ISO) - { - if(barostat == BZP) - { + if (pstyle == ISO) { + if (barostat == BZP) { vw[0] += dtv * 3 * (volume * np * (p_cv - Pext) / force->nktv2p + Vcoeff / beta_np) / W; - if(universe->iworld==0) - { + if (universe->iworld == 0) { double dvw_proc = 0.0, dvw = 0.0; - for(int i = 0; i < nlocal; i++) - { - for(int j = 0; j < 3; j++) - { + for (int i = 0; i < nlocal; i++) { + for (int j = 0; j < 3; j++) { dvw_proc += dtv2 * f[i][j] * v[i][j] / W + dtv3 * f[i][j] * f[i][j] / mass[type[i]] / W; } } @@ -847,26 +804,21 @@ void FixPIMDLangevin::press_v_step() } MPI_Barrier(universe->uworld); MPI_Bcast(&vw[0], 1, MPI_DOUBLE, 0, universe->uworld); + } else if (barostat == MTTK) { + mtk_term1 = 2. / atom->natoms * totke / 3; + f_omega = (volume * np * (p_md - Pext) + mtk_term1) / W; + vw[0] += 0.5 * dtv * f_omega; } - else if(barostat == MTTK) - { - mtk_term1 = 2. / atom->natoms * totke / 3; - f_omega = (volume * np * (p_md - Pext) + mtk_term1) / W; - vw[0] += 0.5 * dtv * f_omega; - } - } - else if(pstyle == ANISO) - { + } else if (pstyle == ANISO) { compute_stress_tensor(); - for(int ii=0; ii<3; ii++) - { - vw[ii] += dtv * (volume * np * (stress_tensor[ii] - Pext) / force->nktv2p + Vcoeff / beta_np) / W; - if(universe->iworld==0) - { + for (int ii = 0; ii < 3; ii++) { + vw[ii] += + dtv * (volume * np * (stress_tensor[ii] - Pext) / force->nktv2p + Vcoeff / beta_np) / W; + if (universe->iworld == 0) { double dvw_proc = 0.0, dvw = 0.0; - for(int i = 0; i < nlocal; i++) - { - dvw_proc += dtv2 * f[i][ii] * v[i][ii] / W + dtv3 * f[i][ii] * f[i][ii] / mass[type[i]] / W; + for (int i = 0; i < nlocal; i++) { + dvw_proc += + dtv2 * f[i][ii] * v[i][ii] / W + dtv3 * f[i][ii] * f[i][ii] / mass[type[i]] / W; } MPI_Allreduce(&dvw_proc, &dvw, 1, MPI_DOUBLE, MPI_SUM, world); vw[ii] += dvw; @@ -879,26 +831,21 @@ void FixPIMDLangevin::press_v_step() void FixPIMDLangevin::press_o_step() { - if(pstyle==ISO) - { - if(universe->me==0) - { + if (pstyle == ISO) { + if (universe->me == 0) { r1 = random->gaussian(); - vw[0] = c1 * vw[0] + c2 * sqrt(1. / W / beta_np) * r1; + vw[0] = c1 * vw[0] + c2 * sqrt(1.0 / W / beta_np) * r1; } MPI_Barrier(universe->uworld); MPI_Bcast(&vw[0], 1, MPI_DOUBLE, 0, universe->uworld); - } - else if(pstyle==ANISO) - { - if(universe->me==0) - { + } else if (pstyle == ANISO) { + if (universe->me == 0) { r1 = random->gaussian(); r2 = random->gaussian(); r3 = random->gaussian(); - vw[0] = c1 * vw[0] + c2 * sqrt(1. / W / beta_np) * r1; - vw[1] = c1 * vw[1] + c2 * sqrt(1. / W / beta_np) * r2; - vw[2] = c1 * vw[2] + c2 * sqrt(1. / W / beta_np) * r3; + vw[0] = c1 * vw[0] + c2 * sqrt(1.0 / W / beta_np) * r1; + vw[1] = c1 * vw[1] + c2 * sqrt(1.0 / W / beta_np) * r2; + vw[2] = c1 * vw[2] + c2 * sqrt(1.0 / W / beta_np) * r3; } MPI_Barrier(universe->uworld); MPI_Bcast(&vw, 3, MPI_DOUBLE, 0, universe->uworld); @@ -916,52 +863,61 @@ void FixPIMDLangevin::Langevin_init() _omega_k = new double[np]; Lan_c = new double[np]; Lan_s = new double[np]; - if(fmmode==physical){ - for (int i=0; i 0) gamma = 1.0 / tau; - else gamma = np / beta / hbar; + if (tau > 0) + gamma = 1.0 / tau; + else + gamma = np / beta / hbar; - if(integrator==obabo) c1 = exp(-gamma * 0.5 * update->dt); // tau is the damping time of the centroid mode. - else if(integrator==baoab) c1 = exp(-gamma * update->dt); - else error->universe_all(FLERR, "Unknown integrator parameter for fix pimd. Only obabo and baoab integrators is supported!"); + if (integrator == OBABO) + c1 = exp(-gamma * 0.5 * update->dt); // tau is the damping time of the centroid mode. + else if (integrator == BAOAB) + c1 = exp(-gamma * update->dt); + else + error->universe_all(FLERR, + "Unknown integrator parameter for fix pimd/langevin. Only obabo and " + "baoab integrators are supported!"); - c2 = sqrt(1.0 - c1 * c1); // note that c1 and c2 here only works for the centroid mode. + c2 = sqrt(1.0 - c1 * c1); // note that c1 and c2 here only works for the centroid mode. - if( thermostat == PILE_L ) - { + if (thermostat == PILE_L) { std::string out = "\nInitializing PI Langevin equation thermostat...\n"; out += "Bead ID | omega | tau | c1 | c2\n"; tau_k = new double[np]; c1_k = new double[np]; c2_k = new double[np]; - tau_k[0] = tau; c1_k[0] = c1; c2_k[0] = c2; - for(int i=1; idt / tau_k[i]); - else if(integrator==baoab) c1_k[i] = exp(-1.0 * update->dt / tau_k[i]); - else error->universe_all(FLERR, "Unknown integrator parameter for fix pimd. Only obabo and baoab integrators is supported!"); + if (integrator == OBABO) + c1_k[i] = exp(-0.5 * update->dt / tau_k[i]); + else if (integrator == BAOAB) + c1_k[i] = exp(-1.0 * update->dt / tau_k[i]); + else + error->universe_all(FLERR, + "Unknown integrator parameter for fix pimd/langevin. Only obabo and " + "baoab integrators are supported!"); c2_k[i] = sqrt(1.0 - c1_k[i] * c1_k[i]); } - for(int i=0; inlocal; int *type = atom->type; - double beta_np = 1.0 / force->boltz / Lan_temp / np * force->mvv2e; - if(thermostat == PILE_L) - { - for(int i=0; iboltz / Lan_temp * inverse_np * force->mvv2e; + if (thermostat == PILE_L) { + for (int i = 0; i < nlocal; i++) { r1 = random->gaussian(); r2 = random->gaussian(); r3 = random->gaussian(); - atom->v[i][0] = c1_k[universe->iworld] * atom->v[i][0] + c2_k[universe->iworld] * sqrt(1.0 / mass[type[i]] / beta_np) * r1; - atom->v[i][1] = c1_k[universe->iworld] * atom->v[i][1] + c2_k[universe->iworld] * sqrt(1.0 / mass[type[i]] / beta_np) * r2; - atom->v[i][2] = c1_k[universe->iworld] * atom->v[i][2] + c2_k[universe->iworld] * sqrt(1.0 / mass[type[i]] / beta_np) * r3; + atom->v[i][0] = c1_k[universe->iworld] * atom->v[i][0] + + c2_k[universe->iworld] * sqrt(1.0 / mass[type[i]] / beta_np) * r1; + atom->v[i][1] = c1_k[universe->iworld] * atom->v[i][1] + + c2_k[universe->iworld] * sqrt(1.0 / mass[type[i]] / beta_np) * r2; + atom->v[i][2] = c1_k[universe->iworld] * atom->v[i][2] + + c2_k[universe->iworld] * sqrt(1.0 / mass[type[i]] / beta_np) * r3; } } } @@ -994,94 +951,79 @@ void FixPIMDLangevin::o_step() void FixPIMDLangevin::nmpimd_init() { - memory->create(M_x2xp, np, np, "fix_feynman:M_x2xp"); - memory->create(M_xp2x, np, np, "fix_feynman:M_xp2x"); + memory->create(M_x2xp, np, np, "fix_feynman:M_x2xp"); + memory->create(M_xp2x, np, np, "fix_feynman:M_xp2x"); - lam = (double*) memory->smalloc(sizeof(double)*np, "FixPIMDLangevin::lam"); + lam = (double *) memory->smalloc(sizeof(double) * np, "FixPIMDLangevin::lam"); - // Set up eigenvalues - for(int i=0; iiworld; - for(int i=1; i<=atom->ntypes; i++) - { - mass[i] = atom->mass[i]; - if(iworld) - { - if(fmmode==physical) { mass[i] *= 1.0; } - else if(fmmode==normal) { mass[i] *= lam[iworld]; } - mass[i] *= fmass; + // Set up Ut + for (int i = 0; i < np; i++) + for (int j = 0; j < np; j++) { M_xp2x[i][j] = M_x2xp[j][i]; } + + // Set up masses + int iworld = universe->iworld; + for (int i = 1; i <= atom->ntypes; i++) { + mass[i] = atom->mass[i]; + if (iworld) { + if (fmmode == PHYSICAL) { + mass[i] *= 1.0; + } else if (fmmode == NORMAL) { + mass[i] *= lam[iworld]; } + mass[i] *= fmass; } + } } /* ---------------------------------------------------------------------- */ void FixPIMDLangevin::nmpimd_transform(double **src, double **des, double *vector) { - if(cmode == SINGLE_PROC) - { - for(int i=0; itag[i]; - for(int d=0; d<3; d++) - { - des[i][d] = bufsorted[tagtmp-1][d]; - } + for (int d = 0; d < 3; d++) { des[i][d] = bufsorted[tagtmp - 1][d]; } } - } - else if(cmode == MULTI_PROC) - { - int n = atom->nlocal; - int m = 0; + } else if (cmode == MULTI_PROC) { + int n = atom->nlocal; + int m = 0; - for (int i = 0; i < n; i++) - for (int d = 0; d < 3; d++) { - des[i][d] = 0.0; - for (int j = 0; j < np; j++) { des[i][d] += (src[j][m] * vector[j]); } - m++; - } + for (int i = 0; i < n; i++) + for (int d = 0; d < 3; d++) { + des[i][d] = 0.0; + for (int j = 0; j < np; j++) { des[i][d] += (src[j][m] * vector[j]); } + m++; + } } } @@ -1092,25 +1034,25 @@ void FixPIMDLangevin::nmpimd_transform(double **src, double **des, double *vecto void FixPIMDLangevin::comm_init() { // if(me == 0){ - if (sizeplan) { - delete [] plansend; - delete [] planrecv; - } + if (sizeplan) { + delete[] plansend; + delete[] planrecv; + } - sizeplan = np - 1; - plansend = new int[sizeplan]; - planrecv = new int[sizeplan]; - modeindex = new int[sizeplan]; - for (int i = 0; i < sizeplan; i++) { - int isend, irecv; - isend = ireplica + i + 1; - if (isend >= nreplica) isend -= nreplica; - irecv = ireplica - (i + 1); - if (irecv < 0) irecv += nreplica; - plansend[i] = universe->root_proc[isend]; - planrecv[i] = universe->root_proc[irecv]; - modeindex[i] = irecv; - } + sizeplan = np - 1; + plansend = new int[sizeplan]; + planrecv = new int[sizeplan]; + modeindex = new int[sizeplan]; + for (int i = 0; i < sizeplan; i++) { + int isend, irecv; + isend = ireplica + i + 1; + if (isend >= nreplica) isend -= nreplica; + irecv = ireplica - (i + 1); + if (irecv < 0) irecv += nreplica; + plansend[i] = universe->root_proc[isend]; + planrecv[i] = universe->root_proc[irecv]; + modeindex[i] = irecv; + } } /* ---------------------------------------------------------------------- */ @@ -1145,7 +1087,7 @@ void FixPIMDLangevin::reallocate() memory->create(bufrecv, maxlocal, 3, "FixPIMDLangevin:bufrecv"); memory->create(tagsend, maxlocal, "FixPIMDLangevin:tagsend"); memory->create(tagrecv, maxlocal, "FixPIMDLangevin:tagrecv"); - memory->create(bufbeads, nreplica, maxlocal*3, "FixPIMDLangevin:bufrecv"); + memory->create(bufbeads, nreplica, maxlocal * 3, "FixPIMDLangevin:bufrecv"); } /* ---------------------------------------------------------------------- */ @@ -1160,36 +1102,31 @@ void FixPIMDLangevin::inter_replica_comm(double **ptr) int i, m; // copy local values - for(i=0; itag[i]; - bufsorted[tagtmp-1][0] = ptr[i][0]; - bufsorted[tagtmp-1][1] = ptr[i][1]; - bufsorted[tagtmp-1][2] = ptr[i][2]; + bufsorted[tagtmp - 1][0] = ptr[i][0]; + bufsorted[tagtmp - 1][1] = ptr[i][1]; + bufsorted[tagtmp - 1][2] = ptr[i][2]; m++; } MPI_Allgather(&m, 1, MPI_INT, counts, 1, MPI_INT, universe->uworld); for (i = 0; i < nreplica; i++) { counts[i] *= 3; } displacements[0] = 0; - for (i = 0; i < nreplica-1; i++) { displacements[i+1] = displacements[i] + counts[i]; } - MPI_Allgatherv(bufsorted[0], 3*m, MPI_DOUBLE, bufsortedall[0], counts, displacements, MPI_DOUBLE, universe->uworld); - } - else if(cmode == MULTI_PROC) - { + for (i = 0; i < nreplica - 1; i++) { displacements[i + 1] = displacements[i] + counts[i]; } + MPI_Allgatherv(bufsorted[0], 3 * m, MPI_DOUBLE, bufsortedall[0], counts, displacements, + MPI_DOUBLE, universe->uworld); + } else if (cmode == MULTI_PROC) { m = 0; - for(i=0; iuworld, &requests[0]); - MPI_Irecv(tagrecvall, ntotal, MPI_LMP_TAGINT, planrecv[iplan], 0, universe->uworld, &requests[1]); - MPI_Send(bufsendall[0], 3*ntotal, MPI_DOUBLE, plansend[iplan], 0, universe->uworld); + for (i = 0; i < nprocs - 1; i++) { displacements[i + 1] = displacements[i] + counts[i]; } + MPI_Gatherv(bufsend[0], 3 * m, MPI_DOUBLE, bufsendall[0], counts, displacements, MPI_DOUBLE, 0, + world); + for (int iplan = 0; iplan < sizeplan; iplan++) { + if (me == 0) { + MPI_Irecv(bufrecvall[0], 3 * ntotal, MPI_DOUBLE, planrecv[iplan], 0, universe->uworld, + &requests[0]); + MPI_Irecv(tagrecvall, ntotal, MPI_LMP_TAGINT, planrecv[iplan], 0, universe->uworld, + &requests[1]); + MPI_Send(bufsendall[0], 3 * ntotal, MPI_DOUBLE, plansend[iplan], 0, universe->uworld); MPI_Send(tagsendall, ntotal, MPI_LMP_TAGINT, plansend[iplan], 0, universe->uworld); - MPI_Waitall(2,requests,statuses); + MPI_Waitall(2, requests, statuses); } MPI_Bcast(tagrecvall, ntotal, MPI_LMP_TAGINT, 0, world); - MPI_Bcast(bufrecvall[0], 3*ntotal, MPI_DOUBLE, 0, world); - for(i=0; imap(tagrecvall[i]); if (m < 0 || m >= nlocal) continue; - bufbeads[modeindex[iplan]][3*m+0] = bufrecvall[i][0]; - bufbeads[modeindex[iplan]][3*m+1] = bufrecvall[i][1]; - bufbeads[modeindex[iplan]][3*m+2] = bufrecvall[i][2]; + bufbeads[modeindex[iplan]][3 * m + 0] = bufrecvall[i][0]; + bufbeads[modeindex[iplan]][3 * m + 1] = bufrecvall[i][1]; + bufbeads[modeindex[iplan]][3 * m + 2] = bufrecvall[i][2]; } } } @@ -1233,20 +1172,17 @@ void FixPIMDLangevin::compute_vir_() { int nlocal = atom->nlocal; xf = vir_ = xcf = centroid_vir = 0.0; - int idx = atom->map(1); - for(int i=0; if[i][j]; xcf += (x_unwrap[i][j] - xc[i][j]) * atom->f[i][j]; } } MPI_Allreduce(&xf, &vir_, 1, MPI_DOUBLE, MPI_SUM, universe->uworld); MPI_Allreduce(&xcf, ¢roid_vir, 1, MPI_DOUBLE, MPI_SUM, universe->uworld); - if(pstyle == ANISO){ - for(int i=0; i<6; i++) c_vir_tensor[i] = 0.0; - for(int i=0; if[i][0]; c_vir_tensor[1] += (x_unwrap[i][1] - xc[i][1]) * atom->f[i][1]; c_vir_tensor[2] += (x_unwrap[i][2] - xc[i][2]) * atom->f[i][2]; @@ -1264,14 +1200,14 @@ void FixPIMDLangevin::compute_vir() { volume = domain->xprd * domain->yprd * domain->zprd; c_press->compute_vector(); - virial[0] = c_press->vector[0]*volume; - virial[1] = c_press->vector[1]*volume; - virial[2] = c_press->vector[2]*volume; - virial[3] = c_press->vector[3]*volume; - virial[4] = c_press->vector[4]*volume; - virial[5] = c_press->vector[5]*volume; - for(int i=0; i<6; i++) virial[i] /= universe->procs_per_world[universe->iworld]; - double vir_bead=(virial[0]+virial[1]+virial[2]); + virial[0] = c_press->vector[0] * volume; + virial[1] = c_press->vector[1] * volume; + virial[2] = c_press->vector[2] * volume; + virial[3] = c_press->vector[3] * volume; + virial[4] = c_press->vector[4] * volume; + virial[5] = c_press->vector[5] * volume; + for (int i = 0; i < 6; i++) virial[i] /= universe->procs_per_world[universe->iworld]; + double vir_bead = (virial[0] + virial[1] + virial[2]); MPI_Allreduce(&vir_bead, &vir, 1, MPI_DOUBLE, MPI_SUM, universe->uworld); MPI_Allreduce(MPI_IN_PLACE, &virial[0], 6, MPI_DOUBLE, MPI_SUM, universe->uworld); } @@ -1282,10 +1218,10 @@ void FixPIMDLangevin::compute_stress_tensor() { int nlocal = atom->nlocal; int *type = atom->type; - if(universe->iworld == 0){ + if (universe->iworld == 0) { inv_volume = 1.0 / (domain->xprd * domain->yprd * domain->zprd); - for(int i=0; i<6; i++) ke_tensor[i] = 0.0; - for(int i=0; iv[i][0] * atom->v[i][0] * force->mvv2e; ke_tensor[1] += 0.5 * mass[type[i]] * atom->v[i][1] * atom->v[i][1] * force->mvv2e; ke_tensor[2] += 0.5 * mass[type[i]] * atom->v[i][2] * atom->v[i][2] * force->mvv2e; @@ -1294,9 +1230,9 @@ void FixPIMDLangevin::compute_stress_tensor() ke_tensor[5] += 0.5 * mass[type[i]] * atom->v[i][1] * atom->v[i][2] * force->mvv2e; } MPI_Allreduce(MPI_IN_PLACE, &ke_tensor, 6, MPI_DOUBLE, MPI_SUM, world); - for(int i=0; i<6; i++) - { - stress_tensor[i] = inv_volume * ((2*ke_tensor[i] - c_vir_tensor[i]) * force->nktv2p + virial[i]) / np; + for (int i = 0; i < 6; i++) { + stress_tensor[i] = + inv_volume * ((2 * ke_tensor[i] - c_vir_tensor[i]) * force->nktv2p + virial[i]) / np; } } MPI_Bcast(&stress_tensor, 6, MPI_DOUBLE, 0, universe->uworld); @@ -1310,12 +1246,8 @@ void FixPIMDLangevin::compute_totke() totke = ke_bead = 0.0; int nlocal = atom->nlocal; int *type = atom->type; - for(int i=0; iv[i][j] * atom->v[i][j]; - } + for (int i = 0; i < nlocal; i++) { + for (int j = 0; j < 3; j++) { kine += 0.5 * mass[type[i]] * atom->v[i][j] * atom->v[i][j]; } } kine *= force->mvv2e; MPI_Allreduce(&kine, &ke_bead, 1, MPI_DOUBLE, MPI_SUM, world); @@ -1329,13 +1261,13 @@ void FixPIMDLangevin::compute_spring_energy() total_spring_energy = se_bead = 0.0; double **x = atom->x; - double* _mass = atom->mass; - int* type = atom->type; + double *_mass = atom->mass; + int *type = atom->type; int nlocal = atom->nlocal; - for(int i=0; iiworld] * (x[i][0]*x[i][0] + x[i][1]*x[i][1] + x[i][2]*x[i][2]); + for (int i = 0; i < nlocal; i++) { + spring_energy += 0.5 * _mass[type[i]] * fbond * lam[universe->iworld] * + (x[i][0] * x[i][0] + x[i][1] * x[i][1] + x[i][2] * x[i][2]); } MPI_Allreduce(&spring_energy, &se_bead, 1, MPI_DOUBLE, MPI_SUM, world); } @@ -1370,8 +1302,8 @@ void FixPIMDLangevin::compute_t_prim() /* void FixPIMDLangevin::compute_t_vir() { - t_vir = -0.5 / np * vir_; - t_cv = 1.5 * atom->natoms * force->boltz * temp - 0.5 / np * centroid_vir; + t_vir = -0.5 * inverse_np * vir_; + t_cv = 1.5 * atom->natoms * force->boltz * temp - 0.5 * inverse_np * centroid_vir; } */ /* ---------------------------------------------------------------------- */ @@ -1387,9 +1319,8 @@ void FixPIMDLangevin::compute_p_prim() void FixPIMDLangevin::compute_p_cv() { inv_volume = 1.0 / (domain->xprd * domain->yprd * domain->zprd); - if(universe->iworld == 0) - { - p_cv = 1. / 3. * inv_volume * ((2. * ke_bead - 1. * centroid_vir) * force->nktv2p + 1. * vir) / np; + if (universe->iworld == 0) { + p_cv = THIRD * inv_volume * ((2.0 * ke_bead - centroid_vir) * force->nktv2p + vir) / np; } MPI_Bcast(&p_cv, 1, MPI_DOUBLE, 0, universe->uworld); } @@ -1399,58 +1330,53 @@ void FixPIMDLangevin::compute_p_cv() void FixPIMDLangevin::compute_totenthalpy() { volume = domain->xprd * domain->yprd * domain->zprd; - if(barostat == BZP) - { - if(pstyle == ISO) - { - totenthalpy = tote + 0.5*W*vw[0]*vw[0]/np + Pext * volume / force->nktv2p - Vcoeff * kBT * log(volume); + if (barostat == BZP) { + if (pstyle == ISO) { + totenthalpy = tote + 0.5 * W * vw[0] * vw[0] * inverse_np + Pext * volume / force->nktv2p - + Vcoeff * kBT * log(volume); + } else if (pstyle == ANISO) { + totenthalpy = tote + 0.5 * W * vw[0] * vw[0] * inverse_np + 0.5 * W * vw[1] * vw[1] * inverse_np + + 0.5 * W * vw[2] * vw[2] * inverse_np + Pext * volume / force->nktv2p - Vcoeff * kBT * log(volume); } - else if(pstyle == ANISO) - { - totenthalpy = tote + 0.5*W*vw[0]*vw[0]/np + 0.5*W*vw[1]*vw[1]/np + 0.5*W*vw[2]*vw[2]/np + Pext * volume / force->nktv2p - Vcoeff * kBT * log(volume); - } - } - else if(barostat == MTTK) totenthalpy = tote + 1.5*W*vw[0]*vw[0]/np + Pext * (volume - vol0); + } else if (barostat == MTTK) + totenthalpy = tote + 1.5 * W * vw[0] * vw[0] * inverse_np + Pext * (volume - vol0); } /* ---------------------------------------------------------------------- */ double FixPIMDLangevin::compute_vector(int n) { - if(n==0) { return ke_bead; } - if(n==1) { return se_bead; } - if(n==2) { return pe_bead; } - if(n==3) { return tote; } + if (n == 0) return ke_bead; + if (n == 1) return se_bead; + if (n == 2) return pe_bead; + if (n == 3) return tote; // if(n==3) { return W*vw[0]; } - if(!pstat_flag) - { - if(n==4) { return t_prim; } - if(n==5) { return t_vir; } - if(n==6) { return t_cv; } - } - else if(pstat_flag) - { - if(pstyle == ISO) - { - if(barostat == BZP) - { - if(n==4) { return 0.5*W*vw[0]*vw[0]; } + if (!pstat_flag) { + if (n == 4) return t_prim; + if (n == 5) return t_vir; + if (n == 6) return t_cv; + } else if (pstat_flag) { + if (pstyle == ISO) { + if (barostat == BZP) { + if (n == 4) return 0.5 * W * vw[0] * vw[0]; + } else if (barostat == MTTK) { + if (n == 4) return 1.5 * W * vw[0] * vw[0]; } - else if(barostat == MTTK) - { - if(n==4) { return 1.5*W*vw[0]*vw[0]; } + if (n == 5) { + volume = domain->xprd * domain->yprd * domain->zprd; + return np * Pext * volume / force->nktv2p; } - if(n==5) { volume = domain->xprd * domain->yprd * domain->zprd; return np * Pext * volume / force->nktv2p; } - if(n==6) { volume = domain->xprd * domain->yprd * domain->zprd; return - Vcoeff * np * kBT * log(volume); } - if(n==7) { return totenthalpy; } - if(n==8) { return p_cv; } - if(n==9) { return total_spring_energy; } - } - else if(pstyle == ANISO) - { - + if (n == 6) { + volume = domain->xprd * domain->yprd * domain->zprd; + return -Vcoeff * np * kBT * log(volume); + } + if (n == 7) return totenthalpy; + if (n == 8) return p_cv; + if (n == 9) return total_spring_energy; + } else if (pstyle == ANISO) { } } + /* if(n==7) { return p_prim; } @@ -1474,7 +1400,6 @@ double FixPIMDLangevin::compute_vector(int n) if(n>14 && n<21) return stress_tensor[n-15]; if(n==21) { volume = domain->xprd * domain->yprd * domain->zprd; return np * Pext * volume / force->nktv2p; } if(n==22) { volume = domain->xprd * domain->yprd * domain->zprd; return - Vcoeff * np * kBT * log(volume); } - } + } */ return 0.0; - */ } diff --git a/src/REPLICA/fix_pimd_langevin.h b/src/REPLICA/fix_pimd_langevin.h index 3af036caf9..93f4670808 100644 --- a/src/REPLICA/fix_pimd_langevin.h +++ b/src/REPLICA/fix_pimd_langevin.h @@ -47,7 +47,7 @@ class FixPIMDLangevin : public Fix { int np; // number of beads double inverse_np; // 1.0/np double temp; // temperature - double planck, hbar; // Planck's constant + double hbar; // Planck's constant double lj_epsilon, lj_sigma, lj_mass; // LJ unit energy, length, and mass scales double other_planck; double kBT; // k_B * temp @@ -119,8 +119,7 @@ class FixPIMDLangevin : public Fix { int tstat_flag; // tstat_flat = 1 if thermostat if used void Langevin_init(); void b_step(); // integrate for dt/2 according to B part (v <- v + f * dt/2) - void - a_step(); // integrate for dt/2 according to A part (non-centroid mode, harmonic force between replicas) + void a_step(); // integrate for dt/2 according to A part (non-centroid mode, harmonic force between replicas) void qc_step(); // integrate for dt/2 for the centroid mode (x <- x + v * dt/2) void o_step(); // integrate for dt according to O part (O-U process, for thermostating) From 6b1cad1e3d1624b947a2798dca3c80bb63161cd0 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Sat, 25 Feb 2023 23:16:51 -0500 Subject: [PATCH 017/396] programming style updates --- src/REPLICA/fix_pimd_langevin.cpp | 155 ++++++++++++------------------ src/REPLICA/fix_pimd_langevin.h | 6 +- 2 files changed, 62 insertions(+), 99 deletions(-) diff --git a/src/REPLICA/fix_pimd_langevin.cpp b/src/REPLICA/fix_pimd_langevin.cpp index 22bed54c3b..24b677b141 100644 --- a/src/REPLICA/fix_pimd_langevin.cpp +++ b/src/REPLICA/fix_pimd_langevin.cpp @@ -64,7 +64,7 @@ enum { SINGLE_PROC, MULTI_PROC }; /* ---------------------------------------------------------------------- */ FixPIMDLangevin::FixPIMDLangevin(LAMMPS *lmp, int narg, char **arg) : - Fix(lmp, narg, arg), random(nullptr), c_pe(nullptr), c_press(nullptr) + Fix(lmp, narg, arg), random(nullptr), c_pe(nullptr), c_press(nullptr) { time_integrate = 1; tagsend = tagrecv = nullptr; @@ -101,12 +101,17 @@ FixPIMDLangevin::FixPIMDLangevin(LAMMPS *lmp, int narg, char **arg) : tau = 1.0; tau_p = 1.0; Pext = 1.0; + pilescale = 1.0; tstat_flag = 1; pstat_flag = 0; mapflag = 1; removecomflag = 1; fmmode = PHYSICAL; pstyle = ISO; + totenthalpy = 0.0; + + int seed = -1; + for (int i = 0; i < 6; i++) p_flag[i] = 0; for (int i = 3; i < narg - 1; i += 2) { @@ -119,20 +124,17 @@ FixPIMDLangevin::FixPIMDLangevin(LAMMPS *lmp, int narg, char **arg) : method = CMD; else error->universe_all(FLERR, "Unknown method parameter for fix pimd/langevin"); - } else if (strcmp(arg[i], "integrator") == 0) - - { + } else if (strcmp(arg[i], "integrator") == 0) { if (strcmp(arg[i + 1], "obabo") == 0) integrator = OBABO; else if (strcmp(arg[i + 1], "baoab") == 0) integrator = BAOAB; else - error->universe_all(FLERR, - "Unknown integrator parameter for fix pimd/langevin. Only obabo and baoab " - "integrators are supported!"); - } - - else if (strcmp(arg[i], "ensemble") == 0) { + error->universe_all( + FLERR, + "Unknown integrator parameter for fix pimd/langevin. Only obabo and baoab " + "integrators are supported!"); + } else if (strcmp(arg[i], "ensemble") == 0) { if (strcmp(arg[i + 1], "nve") == 0) { ensemble = NVE; tstat_flag = 0; @@ -150,95 +152,69 @@ FixPIMDLangevin::FixPIMDLangevin(LAMMPS *lmp, int narg, char **arg) : tstat_flag = 1; pstat_flag = 1; } else - error->universe_all( - FLERR, - "Unknown ensemble parameter for fix pimd/langevin. Only nve and nvt ensembles are supported!"); - } - - else if (strcmp(arg[i], "fmass") == 0) { + error->universe_all(FLERR, + "Unknown ensemble parameter for fix pimd/langevin. Only nve and nvt " + "ensembles are supported!"); + } else if (strcmp(arg[i], "fmass") == 0) { fmass = utils::numeric(FLERR, arg[i + 1], false, lmp); if (fmass < 0.0 || fmass > 1.0) error->universe_all(FLERR, "Invalid fmass value for fix pimd/langevin"); - } - - else if (strcmp(arg[i], "fmmode") == 0) { + } else if (strcmp(arg[i], "fmmode") == 0) { if (strcmp(arg[i + 1], "physical") == 0) fmmode = PHYSICAL; else if (strcmp(arg[i + 1], "normal") == 0) fmmode = NORMAL; else - error->universe_all(FLERR, - "Unknown fictitious mass mode for fix pimd/langevin. Only physical mass and " - "normal mode mass are supported!"); - } - - else if (strcmp(arg[i], "scale") == 0) { - pilescale = atof(arg[i + 1]); - if (pilescale < 0.0) error->universe_all(FLERR, "Invalid pile scale value for fix pimd/langevin"); - } - - else if (strcmp(arg[i], "temp") == 0) { + error->universe_all( + FLERR, + "Unknown fictitious mass mode for fix pimd/langevin. Only physical mass and " + "normal mode mass are supported!"); + } else if (strcmp(arg[i], "scale") == 0) { + pilescale = utils::numeric(FLERR, arg[i + 1], false, lmp); + if (pilescale < 0.0) + error->universe_all(FLERR, "Invalid pile scale value for fix pimd/langevin"); + } else if (strcmp(arg[i], "temp") == 0) { temp = utils::numeric(FLERR, arg[i + 1], false, lmp); if (temp < 0.0) error->universe_all(FLERR, "Invalid temp value for fix pimd/langevin"); - } - - else if (strcmp(arg[i], "lj") == 0) { + } else if (strcmp(arg[i], "lj") == 0) { lj_epsilon = utils::numeric(FLERR, arg[i + 1], false, lmp); lj_sigma = utils::numeric(FLERR, arg[i + 2], false, lmp); lj_mass = utils::numeric(FLERR, arg[i + 3], false, lmp); other_planck = utils::numeric(FLERR, arg[i + 4], false, lmp); - i++; - i++; - i++; - } - - else if (strcmp(arg[i], "thermostat") == 0) { + i += 3; + } else if (strcmp(arg[i], "thermostat") == 0) { if (strcmp(arg[i + 1], "PILE_L") == 0) { thermostat = PILE_L; - seed = atoi(arg[i + 2]); + seed = utils::inumeric(FLERR, arg[i + 2], false, lmp); i++; } - } - - else if (strcmp(arg[i], "tau") == 0) { - tau = atof(arg[i + 1]); - } - - else if (strcmp(arg[i], "press") == 0) { - Pext = atof(arg[i + 1]); + } else if (strcmp(arg[i], "tau") == 0) { + tau = utils::numeric(FLERR, arg[i + 1], false, lmp); + } else if (strcmp(arg[i], "press") == 0) { + Pext = utils::numeric(FLERR, arg[i + 1], false, lmp); if (Pext < 0.0) error->universe_all(FLERR, "Invalid press value for fix pimd/langevin"); - } - - else if (strcmp(arg[i], "barostat") == 0) { + } else if (strcmp(arg[i], "barostat") == 0) { if (strcmp(arg[i + 1], "MTTK") == 0) { barostat = MTTK; } else if (strcmp(arg[i + 1], "BZP") == 0) { barostat = BZP; } else error->universe_all(FLERR, "Unknown barostat parameter for fix pimd/langevin"); - } - - else if (strcmp(arg[i], "iso") == 0) { + } else if (strcmp(arg[i], "iso") == 0) { pstyle = ISO; i--; - } - - else if (strcmp(arg[i], "aniso") == 0) { + } else if (strcmp(arg[i], "aniso") == 0) { pstyle = ANISO; i--; - } - - else if (strcmp(arg[i], "taup") == 0) { - tau_p = atof(arg[i + 1]); + } else if (strcmp(arg[i], "taup") == 0) { + tau_p = utils::numeric(FLERR, arg[i + 1], false, lmp); if (tau_p <= 0.0) error->universe_all(FLERR, "Invalid tau_p value for fix pimd/langevin"); } else if (strcmp(arg[i], "fixcom") == 0) { if (strcmp(arg[i + 1], "yes") == 0) removecomflag = 1; else if (strcmp(arg[i + 1], "no") == 0) removecomflag = 0; - } - - else if (strcmp(arg[i], "map") == 0) { + } else if (strcmp(arg[i], "map") == 0) { if (strcmp(arg[i + 1], "yes") == 0) mapflag = 1; else if (strcmp(arg[i + 1], "no") == 0) @@ -257,25 +233,11 @@ FixPIMDLangevin::FixPIMDLangevin(LAMMPS *lmp, int narg, char **arg) : // some initilizations - id_pe = new char[8]; - strcpy(id_pe, "pimd_pe"); - char **newarg = new char *[3]; - newarg[0] = id_pe; - newarg[1] = (char *) "all"; - newarg[2] = (char *) "pe"; - modify->add_compute(3, newarg); - delete[] newarg; + id_pe = utils::strdup(std::string(id) + "_pimd_pe"); + modify->add_compute(std::string(id_pe) + " all pe"); - id_press = new char[12]; - strcpy(id_press, "pimd_press"); - newarg = new char *[5]; - newarg[0] = id_press; - newarg[1] = (char *) "all"; - newarg[2] = (char *) "pressure"; - newarg[3] = (char *) "thermo_temp"; - newarg[4] = (char *) "virial"; - modify->add_compute(5, newarg); - delete[] newarg; + id_press = utils::strdup(std::string(id) + "_pimd_press"); + modify->add_compute(std::string(id_press) + " all pressure thermo_temp virial"); vol0 = domain->xprd * domain->yprd * domain->zprd; @@ -339,7 +301,14 @@ FixPIMDLangevin::FixPIMDLangevin(LAMMPS *lmp, int narg, char **arg) : /* ---------------------------------------------------------------------- */ -FixPIMDLangevin::~FixPIMDLangevin() {} +FixPIMDLangevin::~FixPIMDLangevin() +{ + modify->delete_compute(id_pe); + modify->delete_compute(id_press); + delete[] id_pe; + delete[] id_press; + delete random; +} /* ---------------------------------------------------------------------- */ @@ -387,8 +356,8 @@ void FixPIMDLangevin::init() beta_np = 1.0 / force->boltz / temp * inverse_np; fbond = _fbond * force->mvv2e; - if (universe->me == 0) - printf("fix pimd/langevin -P/(beta^2 * hbar^2) = %20.7lE (kcal/mol/A^2)\n\n", fbond); + if ((universe->me == 0) && (universe->uscreen)) + fprintf(universe->uscreen, "fix pimd/langevin -P/(beta^2 * hbar^2) = %20.7lE (kcal/mol/A^2)\n\n", fbond); if (integrator == OBABO) { dtf = 0.5 * update->dt * force->ftm2v; @@ -413,15 +382,10 @@ void FixPIMDLangevin::init() Langevin_init(); if (pstat_flag) baro_init(); - int ipe = modify->find_compute(id_pe); - c_pe = modify->compute[ipe]; - - int ipress = modify->find_compute(id_press); - c_press = modify->compute[ipress]; + c_pe = modify->get_compute_by_id(id_pe); + c_press = modify->get_compute_by_id(id_press); t_prim = t_vir = t_cv = p_prim = p_vir = p_cv = p_md = 0.0; - - if (universe->me == 0) fprintf(screen, "fix pimd/langevin successfully initialized!\n"); } /* ---------------------------------------------------------------------- */ @@ -1335,8 +1299,9 @@ void FixPIMDLangevin::compute_totenthalpy() totenthalpy = tote + 0.5 * W * vw[0] * vw[0] * inverse_np + Pext * volume / force->nktv2p - Vcoeff * kBT * log(volume); } else if (pstyle == ANISO) { - totenthalpy = tote + 0.5 * W * vw[0] * vw[0] * inverse_np + 0.5 * W * vw[1] * vw[1] * inverse_np + - 0.5 * W * vw[2] * vw[2] * inverse_np + Pext * volume / force->nktv2p - Vcoeff * kBT * log(volume); + totenthalpy = tote + 0.5 * W * vw[0] * vw[0] * inverse_np + + 0.5 * W * vw[1] * vw[1] * inverse_np + 0.5 * W * vw[2] * vw[2] * inverse_np + + Pext * volume / force->nktv2p - Vcoeff * kBT * log(volume); } } else if (barostat == MTTK) totenthalpy = tote + 1.5 * W * vw[0] * vw[0] * inverse_np + Pext * (volume - vol0); @@ -1376,7 +1341,7 @@ double FixPIMDLangevin::compute_vector(int n) } else if (pstyle == ANISO) { } } - + /* if(n==7) { return p_prim; } diff --git a/src/REPLICA/fix_pimd_langevin.h b/src/REPLICA/fix_pimd_langevin.h index 93f4670808..e68f326ae6 100644 --- a/src/REPLICA/fix_pimd_langevin.h +++ b/src/REPLICA/fix_pimd_langevin.h @@ -107,14 +107,12 @@ class FixPIMDLangevin : public Fix { double dtv, dtf, dtv2, dtv3; double gamma, c1, c2, tau; double *tau_k, *c1_k, *c2_k; - double pilescale = 1.0; + double pilescale; double Lan_temp; double r1, r2, r3; double _omega_np, *_omega_k, *Lan_s, *Lan_c; // sin(omega_k*dt*0.5), cos(omega_k*dt*0.5) class RanMars *random; - int seed; - FILE *frand; int tstat_flag; // tstat_flat = 1 if thermostat if used void Langevin_init(); @@ -128,7 +126,7 @@ class FixPIMDLangevin : public Fix { double f_omega, mtk_term1; int pstat_flag; // pstat_flag = 1 if barostat is used int pstyle; // pstyle = ISO or ANISO (will support TRICLINIC in the future) - double W, tau_p, Pext, totenthalpy = 0.0, Vcoeff; + double W, tau_p, Pext, totenthalpy, Vcoeff; int p_flag[6]; double vw[6]; // barostat velocity double ke_tensor[6]; // kinetic energy tensor From 5a593f06f6f48b6bc5220a139fecc704b4193a49 Mon Sep 17 00:00:00 2001 From: Yifan Li Date: Fri, 10 Mar 2023 02:00:18 -0500 Subject: [PATCH 018/396] apply make fix-whitespace --- doc/src/fix_deposit.rst | 6 +++--- doc/src/fix_pimd.rst | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/doc/src/fix_deposit.rst b/doc/src/fix_deposit.rst index 0199ae98ce..7d19e93148 100644 --- a/doc/src/fix_deposit.rst +++ b/doc/src/fix_deposit.rst @@ -221,9 +221,9 @@ options choose a z-coordinate for insertion independently. The vx, vy, and vz components of velocity for the inserted particle are set by sampling a uniform distribution between the bounds set by -the values specified for the *vx*, *vy*, and *vz* keywords. Note that -normally, new particles should be a assigned a negative vertical -velocity so that they move towards the surface. For molecules, the +the values specified for the *vx*, *vy*, and *vz* keywords. Note that +normally, new particles should be a assigned a negative vertical +velocity so that they move towards the surface. For molecules, the same velocity is given to every particle (no rotation or bond vibration). If the *target* option is used, the velocity vector of the inserted diff --git a/doc/src/fix_pimd.rst b/doc/src/fix_pimd.rst index 4d08497928..b774a7c8df 100644 --- a/doc/src/fix_pimd.rst +++ b/doc/src/fix_pimd.rst @@ -17,7 +17,7 @@ Syntax * ID, group-ID are documented in :doc:`fix ` command * style = *pimd/langevin* or *pimd/nvt* = style name of this fix command * zero or more keyword/value pairs may be appended -* keywords for style *pimd/nvt* +* keywords for style *pimd/nvt* .. parsed-literal:: *keywords* = *method* or *fmass* or *sp* or *temp* or *nhc* @@ -27,7 +27,7 @@ Syntax *temp* value = temperature (temperarate units) *nhc* value = Nc = number of chains in Nose-Hoover thermostat -* keywords for style *pimd/langevin* +* keywords for style *pimd/langevin* .. parsed-literal:: *keywords* = *method* or *integrator* or *ensemble* or *fmass* or *fmmode* or *scale* or *lj* or *temp* or *thermostat* or *tau* or *press* or *barostat* or *taup* or *iso* or *aniso* @@ -183,7 +183,7 @@ quasi-beads to :doc:`binary restart files `. See the a fix in an input script that reads a restart file, so that the operation of the fix continues in an uninterrupted fashion. -Fix *pimd/langevin* ... +Fix *pimd/langevin* ... None of the :doc:`fix_modify ` options are relevant to fix pimd/nvt. From da6d3de48ea6e5b13571339a9a40eec2d1a2574a Mon Sep 17 00:00:00 2001 From: Yifan Li Date: Fri, 10 Mar 2023 02:06:40 -0500 Subject: [PATCH 019/396] correct planck's constant for lj units --- src/REPLICA/fix_pimd_langevin.cpp | 8 +++----- src/REPLICA/fix_pimd_langevin.h | 1 + 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/src/REPLICA/fix_pimd_langevin.cpp b/src/REPLICA/fix_pimd_langevin.cpp index 24b677b141..879c546326 100644 --- a/src/REPLICA/fix_pimd_langevin.cpp +++ b/src/REPLICA/fix_pimd_langevin.cpp @@ -55,7 +55,6 @@ enum { BAOAB, OBABO }; enum { ISO, ANISO, TRICLINIC }; enum { PILE_L }; enum { MTTK, BZP }; -// char* Barostats[] = {"MTTK", "BZP"}; static std::map Barostats{{MTTK, "MTTK"}, {BZP, "BZP"}}; enum { NVE, NVT, NPH, NPT }; @@ -181,7 +180,8 @@ FixPIMDLangevin::FixPIMDLangevin(LAMMPS *lmp, int narg, char **arg) : lj_sigma = utils::numeric(FLERR, arg[i + 2], false, lmp); lj_mass = utils::numeric(FLERR, arg[i + 3], false, lmp); other_planck = utils::numeric(FLERR, arg[i + 4], false, lmp); - i += 3; + other_mvv2e = utils::numeric(FLERR, arg[i + 5], false, lmp); + i += 4; } else if (strcmp(arg[i], "thermostat") == 0) { if (strcmp(arg[i + 1], "PILE_L") == 0) { thermostat = PILE_L; @@ -317,7 +317,6 @@ int FixPIMDLangevin::setmask() int mask = 0; mask |= POST_FORCE; mask |= INITIAL_INTEGRATE; - // mask |= POST_NEIGHBOR; mask |= FINAL_INTEGRATE; mask |= END_OF_STEP; return mask; @@ -341,7 +340,7 @@ void FixPIMDLangevin::init() double planck; if (strcmp(update->unit_style, "lj") == 0) { - double planck_star = sqrt(lj_epsilon) * sqrt(atom->mass[0]) * lj_sigma; + double planck_star = sqrt(lj_epsilon) * sqrt(lj_mass) * lj_sigma * sqrt(other_mvv2e); planck = other_planck / planck_star; } else { planck = force->hplanck; @@ -997,7 +996,6 @@ void FixPIMDLangevin::nmpimd_transform(double **src, double **des, double *vecto void FixPIMDLangevin::comm_init() { - // if(me == 0){ if (sizeplan) { delete[] plansend; delete[] planrecv; diff --git a/src/REPLICA/fix_pimd_langevin.h b/src/REPLICA/fix_pimd_langevin.h index e68f326ae6..6c450210e9 100644 --- a/src/REPLICA/fix_pimd_langevin.h +++ b/src/REPLICA/fix_pimd_langevin.h @@ -50,6 +50,7 @@ class FixPIMDLangevin : public Fix { double hbar; // Planck's constant double lj_epsilon, lj_sigma, lj_mass; // LJ unit energy, length, and mass scales double other_planck; + double other_mvv2e; double kBT; // k_B * temp double beta, beta_np; // beta = 1./kBT beta_np = 1./kBT/np int thermostat; // NHC or PILE_L From f301c00406f6699d94f8632dc3ee6e598e89b40d Mon Sep 17 00:00:00 2001 From: Yifan Li Date: Fri, 10 Mar 2023 02:37:15 -0500 Subject: [PATCH 020/396] delete unused nmpimd_transform --- src/REPLICA/fix_pimd_langevin.h | 1 - 1 file changed, 1 deletion(-) diff --git a/src/REPLICA/fix_pimd_langevin.h b/src/REPLICA/fix_pimd_langevin.h index 6c450210e9..b491179403 100644 --- a/src/REPLICA/fix_pimd_langevin.h +++ b/src/REPLICA/fix_pimd_langevin.h @@ -100,7 +100,6 @@ class FixPIMDLangevin : public Fix { void reallocate(); void nmpimd_init(); - void nmpimd_transform(double **src, double **des, double **mat); void nmpimd_transform(double **, double **, double *); /* Langevin integration */ From 45da03340ab23ecb62941aad47b5f61bbd0f98d9 Mon Sep 17 00:00:00 2001 From: Yifan Li Date: Fri, 10 Mar 2023 02:56:44 -0500 Subject: [PATCH 021/396] update package info; delete unused code --- src/REPLICA/fix_pimd_langevin.cpp | 9 ++++----- src/REPLICA/fix_pimd_langevin.h | 6 +----- 2 files changed, 5 insertions(+), 10 deletions(-) diff --git a/src/REPLICA/fix_pimd_langevin.cpp b/src/REPLICA/fix_pimd_langevin.cpp index 879c546326..1552690a08 100644 --- a/src/REPLICA/fix_pimd_langevin.cpp +++ b/src/REPLICA/fix_pimd_langevin.cpp @@ -13,10 +13,10 @@ /* ---------------------------------------------------------------------- Package FixPIMDLangevin - Purpose Quantum Path Integral Algorithm for Quantum Chemistry + Purpose Path Integral Molecular Dynamics with Langevin Thermostat Yifan Li @ Princeton University (yifanl0716@gmail.com) - Added components: + Current Features: - Multi-processor parallelism for each bead - White-noise Langevin thermostat - Bussi-Zykova-Parrinello barostat (isotropic and anisotropic) @@ -557,7 +557,7 @@ void FixPIMDLangevin::post_force(int /*flag*/) } compute_vir(); - compute_vir_(); + compute_cvir(); compute_pote(); if (method == NMPIMD) { inter_replica_comm(f); @@ -1127,10 +1127,9 @@ void FixPIMDLangevin::inter_replica_comm(double **ptr) } } -/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */ -void FixPIMDLangevin::compute_vir_() +void FixPIMDLangevin::compute_cvir() { int nlocal = atom->nlocal; xf = vir_ = xcf = centroid_vir = 0.0; diff --git a/src/REPLICA/fix_pimd_langevin.h b/src/REPLICA/fix_pimd_langevin.h index b491179403..60eca51907 100644 --- a/src/REPLICA/fix_pimd_langevin.h +++ b/src/REPLICA/fix_pimd_langevin.h @@ -177,14 +177,10 @@ class FixPIMDLangevin : public Fix { void compute_spring_energy(); // 2: spring elastic energy void compute_pote(); // 3: potential energy void compute_tote(); // 4: total energy: 1+2+3 for all the beads - // void compute_t_prim(); // 5: primitive kinetic energy estimator - // void compute_p_prim(); // primitive pressure estimator void compute_stress_tensor(); - // void compute_t_vir(); // centroid-virial kinetic energy estimator void compute_p_cv(); // centroid-virial pressure estimator - // void compute_p_vir(); // centroid-virial pressure estimator void compute_vir(); - void compute_vir_(); + void compute_cvir(); void compute_totenthalpy(); }; } // namespace LAMMPS_NS From 266f8fb67e7167d0865a53caf8fe7780f55fa34f Mon Sep 17 00:00:00 2001 From: Yifan Li Date: Mon, 13 Mar 2023 23:42:25 -0400 Subject: [PATCH 022/396] clean up fix pimd/langevin --- src/REPLICA/fix_pimd_langevin.cpp | 94 ++++++++++++++++++------------- src/REPLICA/fix_pimd_langevin.h | 19 ++----- 2 files changed, 60 insertions(+), 53 deletions(-) diff --git a/src/REPLICA/fix_pimd_langevin.cpp b/src/REPLICA/fix_pimd_langevin.cpp index 1552690a08..4436878ba4 100644 --- a/src/REPLICA/fix_pimd_langevin.cpp +++ b/src/REPLICA/fix_pimd_langevin.cpp @@ -49,7 +49,7 @@ using namespace LAMMPS_NS; using namespace FixConst; using namespace MathConst; -enum { PIMD, NMPIMD, CMD }; +enum { NMPIMD }; enum { PHYSICAL, NORMAL }; enum { BAOAB, OBABO }; enum { ISO, ANISO, TRICLINIC }; @@ -88,7 +88,7 @@ FixPIMDLangevin::FixPIMDLangevin(LAMMPS *lmp, int narg, char **arg) : mass = nullptr; - method = PIMD; + method = NMPIMD; ensemble = NVT; integrator = OBABO; thermostat = PILE_L; @@ -115,15 +115,10 @@ FixPIMDLangevin::FixPIMDLangevin(LAMMPS *lmp, int narg, char **arg) : for (int i = 3; i < narg - 1; i += 2) { if (strcmp(arg[i], "method") == 0) { - if (strcmp(arg[i + 1], "pimd") == 0) - method = PIMD; - else if (strcmp(arg[i + 1], "nmpimd") == 0) - method = NMPIMD; - else if (strcmp(arg[i + 1], "cmd") == 0) - method = CMD; - else - error->universe_all(FLERR, "Unknown method parameter for fix pimd/langevin"); - } else if (strcmp(arg[i], "integrator") == 0) { + if (strcmp(arg[i + 1], "nmpimd") == 0)method = NMPIMD; + else error->universe_all(FLERR, "Unknown method parameter for fix pimd/langevin"); + } + else if (strcmp(arg[i], "integrator") == 0) { if (strcmp(arg[i + 1], "obabo") == 0) integrator = OBABO; else if (strcmp(arg[i + 1], "baoab") == 0) @@ -228,7 +223,15 @@ FixPIMDLangevin::FixPIMDLangevin(LAMMPS *lmp, int narg, char **arg) : global_freq = 1; vector_flag = 1; - size_vector = 11; + if (!pstat_flag) size_vector = 10; + else if (pstat_flag) { + if (pstyle == ISO){ + size_vector = 15; + } + else if (pstyle == ANISO){ + size_vector = 17; + } + } extvector = 1; // some initilizations @@ -391,7 +394,6 @@ void FixPIMDLangevin::init() void FixPIMDLangevin::setup(int vflag) { - if (universe->me == 0) printf("Setting up Path-Integral ...\n"); int nlocal = atom->nlocal; double **x = atom->x; double **v = atom->v; @@ -427,8 +429,6 @@ void FixPIMDLangevin::setup(int vflag) else if (cmode == MULTI_PROC) nmpimd_transform(bufbeads, v, M_x2xp[universe->iworld]); } - if (universe->me == 0 && screen) fprintf(screen, "Setting up Path-Integral ...\n"); - if (universe->me == 0) printf("Setting up Path-Integral ...\n"); post_force(vflag); compute_totke(); end_of_step(); @@ -558,6 +558,7 @@ void FixPIMDLangevin::post_force(int /*flag*/) compute_vir(); compute_cvir(); + compute_t_vir(); compute_pote(); if (method == NMPIMD) { inter_replica_comm(f); @@ -1231,6 +1232,8 @@ void FixPIMDLangevin::compute_spring_energy() (x[i][0] * x[i][0] + x[i][1] * x[i][1] + x[i][2] * x[i][2]); } MPI_Allreduce(&spring_energy, &se_bead, 1, MPI_DOUBLE, MPI_SUM, world); + se_bead /= universe->procs_per_world[universe->iworld]; + MPI_Allreduce(&se_bead, &total_spring_energy, 1, MPI_DOUBLE, MPI_SUM, universe->uworld); } /* ---------------------------------------------------------------------- */ @@ -1243,6 +1246,7 @@ void FixPIMDLangevin::compute_pote() c_pe->compute_scalar(); pe_bead = c_pe->scalar; pot_energy_partition = pe_bead / universe->procs_per_world[universe->iworld]; + MPI_Allreduce(&pot_energy_partition, &pote, 1, MPI_DOUBLE, MPI_SUM, universe->uworld); } /* ---------------------------------------------------------------------- */ @@ -1253,28 +1257,28 @@ void FixPIMDLangevin::compute_tote() } /* ---------------------------------------------------------------------- */ -/* + void FixPIMDLangevin::compute_t_prim() { t_prim = 1.5 * atom->natoms * np * force->boltz * temp - total_spring_energy; } -*/ + /* ---------------------------------------------------------------------- */ -/* + void FixPIMDLangevin::compute_t_vir() { t_vir = -0.5 * inverse_np * vir_; t_cv = 1.5 * atom->natoms * force->boltz * temp - 0.5 * inverse_np * centroid_vir; } -*/ + /* ---------------------------------------------------------------------- */ -/* + void FixPIMDLangevin::compute_p_prim() { p_prim = atom->natoms * np * force->boltz * temp * inv_volume - 1.0 / 1.5 * inv_volume * total_spring_energy; p_prim *= force->nktv2p; } -*/ + /* ---------------------------------------------------------------------- */ void FixPIMDLangevin::compute_p_cv() @@ -1312,30 +1316,42 @@ double FixPIMDLangevin::compute_vector(int n) if (n == 1) return se_bead; if (n == 2) return pe_bead; if (n == 3) return tote; - // if(n==3) { return W*vw[0]; } - if (!pstat_flag) { - if (n == 4) return t_prim; - if (n == 5) return t_vir; - if (n == 6) return t_cv; - } else if (pstat_flag) { - if (pstyle == ISO) { - if (barostat == BZP) { - if (n == 4) return 0.5 * W * vw[0] * vw[0]; - } else if (barostat == MTTK) { - if (n == 4) return 1.5 * W * vw[0] * vw[0]; - } - if (n == 5) { + if (n == 4) return t_prim; + if (n == 5) return t_vir; + if (n == 6) return t_cv; + if (n == 7) return p_prim; + if (n == 8) return p_md; + if (n == 9) return p_cv; + + if (pstat_flag) { volume = domain->xprd * domain->yprd * domain->zprd; + if (pstyle == ISO) { + if (n == 10) return vw[0]; + if (barostat == BZP) { + if (n == 11) return 0.5 * W * vw[0] * vw[0]; + } else if (barostat == MTTK) { + if (n == 11) return 1.5 * W * vw[0] * vw[0]; + } + if (n == 12) { return np * Pext * volume / force->nktv2p; } - if (n == 6) { + if (n == 13) { + return -Vcoeff * np * kBT * log(volume); + } + if (n == 14) return totenthalpy; + } else if (pstyle == ANISO) { + if (n == 10) return vw[0]; + if (n == 11) return vw[1]; + if (n == 12) return vw[2]; + if (n == 13) return 0.5 * W * (vw[0] * vw[0] + vw[1] * vw[1] + vw[2] * vw[2]); + if (n == 14) { + return np * Pext * volume / force->nktv2p; + } + if (n == 15) { volume = domain->xprd * domain->yprd * domain->zprd; return -Vcoeff * np * kBT * log(volume); } - if (n == 7) return totenthalpy; - if (n == 8) return p_cv; - if (n == 9) return total_spring_energy; - } else if (pstyle == ANISO) { + if (n == 16) return totenthalpy; } } diff --git a/src/REPLICA/fix_pimd_langevin.h b/src/REPLICA/fix_pimd_langevin.h index 60eca51907..87481b2770 100644 --- a/src/REPLICA/fix_pimd_langevin.h +++ b/src/REPLICA/fix_pimd_langevin.h @@ -140,34 +140,21 @@ class FixPIMDLangevin : public Fix { /* centroid-virial estimator computation */ double vol0 = 0.0; double inv_volume = 0.0; - // double inv_volume = 0.0, vol_ = 0.0, vol0 = 0.0; double volume = 0.0; double **xc, *xcall; int maxxc; - // int n_unwrap; int maxunwrap; - // int maxunwrap, nlocal_init; - // tagint *tag_init, *tag_initall; - // imageint *image_init, *image_initall; double **x_unwrap; - // double **x_unwrap, **x_unwrapsort; - // double **x_unwrapall; - // void init_x_unwrap(); void reallocate_x_unwrap(); void reallocate_xc(); void collect_xc(); - // void compute_xc(); - // void compute_fc(); double xf, vir, vir_, xcf, centroid_vir; - double t_vir, t_cv, p_prim, p_vir, p_cv, p_cv_, p_md; - // double vir_, xcf, vir2; + double t_prim, t_vir, t_cv, p_prim, p_vir, p_cv, p_md; /* Computes */ double kine, pote, tote, totke; double ke_bead, se_bead, pe_bead, pot_energy_partition; double total_spring_energy; - double t_prim; - // double p_prim; char *id_pe; char *id_press; class Compute *c_pe; @@ -178,6 +165,10 @@ class FixPIMDLangevin : public Fix { void compute_pote(); // 3: potential energy void compute_tote(); // 4: total energy: 1+2+3 for all the beads void compute_stress_tensor(); + void compute_t_prim(); + void compute_t_vir(); + void compute_t_cv(); + void compute_p_prim(); void compute_p_cv(); // centroid-virial pressure estimator void compute_vir(); void compute_cvir(); From b4dc074638080e8964708c7ac2aaab4381d8e1b6 Mon Sep 17 00:00:00 2001 From: Yifan Li Date: Tue, 14 Mar 2023 02:46:31 -0400 Subject: [PATCH 023/396] delete global variable inv_volume --- src/REPLICA/fix_pimd_langevin.cpp | 13 ++++++++++--- src/REPLICA/fix_pimd_langevin.h | 3 +-- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/src/REPLICA/fix_pimd_langevin.cpp b/src/REPLICA/fix_pimd_langevin.cpp index 4436878ba4..fe1dabd551 100644 --- a/src/REPLICA/fix_pimd_langevin.cpp +++ b/src/REPLICA/fix_pimd_langevin.cpp @@ -411,6 +411,8 @@ void FixPIMDLangevin::setup(int vflag) } collect_xc(); compute_spring_energy(); + compute_t_prim(); + compute_p_prim(); if (method == NMPIMD) { inter_replica_comm(x); if (cmode == SINGLE_PROC) @@ -495,6 +497,8 @@ void FixPIMDLangevin::initial_integrate(int /*vflag*/) } collect_xc(); compute_spring_energy(); + compute_t_prim(); + compute_p_prim(); if (method == NMPIMD) { inter_replica_comm(x); @@ -1181,7 +1185,7 @@ void FixPIMDLangevin::compute_stress_tensor() int nlocal = atom->nlocal; int *type = atom->type; if (universe->iworld == 0) { - inv_volume = 1.0 / (domain->xprd * domain->yprd * domain->zprd); + double inv_volume = 1.0 / (domain->xprd * domain->yprd * domain->zprd); for (int i = 0; i < 6; i++) ke_tensor[i] = 0.0; for (int i = 0; i < nlocal; i++) { ke_tensor[0] += 0.5 * mass[type[i]] * atom->v[i][0] * atom->v[i][0] * force->mvv2e; @@ -1213,6 +1217,8 @@ void FixPIMDLangevin::compute_totke() } kine *= force->mvv2e; MPI_Allreduce(&kine, &ke_bead, 1, MPI_DOUBLE, MPI_SUM, world); + MPI_Allreduce(&ke_bead, &totke, 1, MPI_DOUBLE, MPI_SUM, universe->uworld); + totke /= universe->procs_per_world[universe->iworld]; } /* ---------------------------------------------------------------------- */ @@ -1232,8 +1238,8 @@ void FixPIMDLangevin::compute_spring_energy() (x[i][0] * x[i][0] + x[i][1] * x[i][1] + x[i][2] * x[i][2]); } MPI_Allreduce(&spring_energy, &se_bead, 1, MPI_DOUBLE, MPI_SUM, world); - se_bead /= universe->procs_per_world[universe->iworld]; MPI_Allreduce(&se_bead, &total_spring_energy, 1, MPI_DOUBLE, MPI_SUM, universe->uworld); + total_spring_energy /= universe->procs_per_world[universe->iworld]; } /* ---------------------------------------------------------------------- */ @@ -1275,6 +1281,7 @@ void FixPIMDLangevin::compute_t_vir() void FixPIMDLangevin::compute_p_prim() { + double inv_volume = 1.0 / (domain->xprd * domain->yprd * domain->zprd); p_prim = atom->natoms * np * force->boltz * temp * inv_volume - 1.0 / 1.5 * inv_volume * total_spring_energy; p_prim *= force->nktv2p; } @@ -1283,7 +1290,7 @@ void FixPIMDLangevin::compute_p_prim() void FixPIMDLangevin::compute_p_cv() { - inv_volume = 1.0 / (domain->xprd * domain->yprd * domain->zprd); + double inv_volume = 1.0 / (domain->xprd * domain->yprd * domain->zprd); if (universe->iworld == 0) { p_cv = THIRD * inv_volume * ((2.0 * ke_bead - centroid_vir) * force->nktv2p + vir) / np; } diff --git a/src/REPLICA/fix_pimd_langevin.h b/src/REPLICA/fix_pimd_langevin.h index 87481b2770..43f6df5e84 100644 --- a/src/REPLICA/fix_pimd_langevin.h +++ b/src/REPLICA/fix_pimd_langevin.h @@ -139,8 +139,7 @@ class FixPIMDLangevin : public Fix { /* centroid-virial estimator computation */ double vol0 = 0.0; - double inv_volume = 0.0; - double volume = 0.0; + double volume; double **xc, *xcall; int maxxc; int maxunwrap; From 2c6fe1e8bc337a09df63ebb274b0b8c24362c818 Mon Sep 17 00:00:00 2001 From: Yifan Li Date: Wed, 15 Mar 2023 13:57:42 -0400 Subject: [PATCH 024/396] add p_md calculation --- src/REPLICA/fix_pimd_langevin.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/REPLICA/fix_pimd_langevin.cpp b/src/REPLICA/fix_pimd_langevin.cpp index fe1dabd551..12233f6ee0 100644 --- a/src/REPLICA/fix_pimd_langevin.cpp +++ b/src/REPLICA/fix_pimd_langevin.cpp @@ -585,7 +585,7 @@ void FixPIMDLangevin::end_of_step() if (pstat_flag) compute_totenthalpy(); if (update->ntimestep % 10000 == 0) { - if (universe->me == 0) printf("This is the end of step %ld.\n", update->ntimestep); + if (universe->me == 0) printf("This is the end of step %lld.\n", update->ntimestep); } } @@ -1294,6 +1294,7 @@ void FixPIMDLangevin::compute_p_cv() if (universe->iworld == 0) { p_cv = THIRD * inv_volume * ((2.0 * ke_bead - centroid_vir) * force->nktv2p + vir) / np; } + p_md = THIRD * inv_volume * (totke + vir); MPI_Bcast(&p_cv, 1, MPI_DOUBLE, 0, universe->uworld); } From 77b9fe37ba8e41b17e15118833ffb2203c162fd5 Mon Sep 17 00:00:00 2001 From: Yifan Li Date: Wed, 15 Mar 2023 14:00:56 -0400 Subject: [PATCH 025/396] delete dead code --- src/REPLICA/fix_pimd_langevin.cpp | 24 ------------------------ 1 file changed, 24 deletions(-) diff --git a/src/REPLICA/fix_pimd_langevin.cpp b/src/REPLICA/fix_pimd_langevin.cpp index 12233f6ee0..2266dc5e6c 100644 --- a/src/REPLICA/fix_pimd_langevin.cpp +++ b/src/REPLICA/fix_pimd_langevin.cpp @@ -1363,29 +1363,5 @@ double FixPIMDLangevin::compute_vector(int n) } } - /* - - if(n==7) { return p_prim; } - if(n==8) { return p_md; } - if(n==9) { return p_cv; } - if(n==10) {return totenthalpy; - if(pstyle == ISO){ - if(n==11) { return vw[0]; } - if(n==12) { - if(barostat == BZP) { return 0.5*W*vw[0]*vw[0]; } - else if(barostat == MTTK) { return 1.5*W*vw[0]*vw[0]; } - } - if(n==13) { volume = domain->xprd * domain->yprd * domain->zprd; return np * Pext * volume / force->nktv2p; } - if(n==14) { volume = domain->xprd * domain->yprd * domain->zprd; - // printf("Vcoeff = %.6e np = %d kBT = %.6e logV = %.6e\n", Vcoeff, np, kBT, log(volume)); - return - Vcoeff * np * kBT * log(volume); } - } - else if(pstyle==ANISO){ - if(n>10 && n<=13) return vw[n-11]; - if(n==14) return 0.5*W*vw[0]*vw[0]+0.5*W*vw[1]*vw[1]+0.5*W*vw[2]*vw[2]; - if(n>14 && n<21) return stress_tensor[n-15]; - if(n==21) { volume = domain->xprd * domain->yprd * domain->zprd; return np * Pext * volume / force->nktv2p; } - if(n==22) { volume = domain->xprd * domain->yprd * domain->zprd; return - Vcoeff * np * kBT * log(volume); } - } */ return 0.0; } From f7bc270c00040ae5a2da5cbc9dda990be571f3ab Mon Sep 17 00:00:00 2001 From: Yifan Li Date: Wed, 15 Mar 2023 14:51:04 -0400 Subject: [PATCH 026/396] Do not initialized random number generator when there is no thermostat --- src/REPLICA/fix_pimd_langevin.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/REPLICA/fix_pimd_langevin.cpp b/src/REPLICA/fix_pimd_langevin.cpp index 2266dc5e6c..bcd94b3beb 100644 --- a/src/REPLICA/fix_pimd_langevin.cpp +++ b/src/REPLICA/fix_pimd_langevin.cpp @@ -250,9 +250,11 @@ FixPIMDLangevin::FixPIMDLangevin(LAMMPS *lmp, int narg, char **arg) : // initialize Marsaglia RNG with processor-unique seed - if (integrator == BAOAB || integrator == OBABO) { - Lan_temp = temp; - random = new RanMars(lmp, seed + universe->me); + if (tstat_flag) { + if (integrator == BAOAB || integrator == OBABO) { + Lan_temp = temp; + random = new RanMars(lmp, seed + universe->me); + } } me = comm->me; From 3f965a1c337f60262585278753ca2b2e4ae3a197 Mon Sep 17 00:00:00 2001 From: Yifan Li Date: Wed, 15 Mar 2023 16:25:56 -0400 Subject: [PATCH 027/396] format the specification of external pressure --- src/REPLICA/fix_pimd_langevin.cpp | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/src/REPLICA/fix_pimd_langevin.cpp b/src/REPLICA/fix_pimd_langevin.cpp index bcd94b3beb..949129873f 100644 --- a/src/REPLICA/fix_pimd_langevin.cpp +++ b/src/REPLICA/fix_pimd_langevin.cpp @@ -185,9 +185,6 @@ FixPIMDLangevin::FixPIMDLangevin(LAMMPS *lmp, int narg, char **arg) : } } else if (strcmp(arg[i], "tau") == 0) { tau = utils::numeric(FLERR, arg[i + 1], false, lmp); - } else if (strcmp(arg[i], "press") == 0) { - Pext = utils::numeric(FLERR, arg[i + 1], false, lmp); - if (Pext < 0.0) error->universe_all(FLERR, "Invalid press value for fix pimd/langevin"); } else if (strcmp(arg[i], "barostat") == 0) { if (strcmp(arg[i + 1], "MTTK") == 0) { barostat = MTTK; @@ -197,10 +194,10 @@ FixPIMDLangevin::FixPIMDLangevin(LAMMPS *lmp, int narg, char **arg) : error->universe_all(FLERR, "Unknown barostat parameter for fix pimd/langevin"); } else if (strcmp(arg[i], "iso") == 0) { pstyle = ISO; - i--; + Pext = utils::numeric(FLERR, arg[i+1], false, lmp); } else if (strcmp(arg[i], "aniso") == 0) { pstyle = ANISO; - i--; + Pext = utils::numeric(FLERR, arg[i+1], false, lmp); } else if (strcmp(arg[i], "taup") == 0) { tau_p = utils::numeric(FLERR, arg[i + 1], false, lmp); if (tau_p <= 0.0) error->universe_all(FLERR, "Invalid tau_p value for fix pimd/langevin"); From 0aca0435ef3c852343fa985879623120bb4da199 Mon Sep 17 00:00:00 2001 From: Yifan Li Date: Wed, 15 Mar 2023 16:43:44 -0400 Subject: [PATCH 028/396] delete mapflag input script interface --- src/REPLICA/fix_pimd_langevin.cpp | 5 ----- 1 file changed, 5 deletions(-) diff --git a/src/REPLICA/fix_pimd_langevin.cpp b/src/REPLICA/fix_pimd_langevin.cpp index 949129873f..3559fc8efe 100644 --- a/src/REPLICA/fix_pimd_langevin.cpp +++ b/src/REPLICA/fix_pimd_langevin.cpp @@ -206,11 +206,6 @@ FixPIMDLangevin::FixPIMDLangevin(LAMMPS *lmp, int narg, char **arg) : removecomflag = 1; else if (strcmp(arg[i + 1], "no") == 0) removecomflag = 0; - } else if (strcmp(arg[i], "map") == 0) { - if (strcmp(arg[i + 1], "yes") == 0) - mapflag = 1; - else if (strcmp(arg[i + 1], "no") == 0) - mapflag = 0; } else { error->universe_all(FLERR, fmt::format("Unknown keyword {} for fix {}", arg[i], style)); } From aa84548002d4ca690f030b6fc3bccbe167f20fbb Mon Sep 17 00:00:00 2001 From: Yifan Li Date: Wed, 15 Mar 2023 16:45:18 -0400 Subject: [PATCH 029/396] set mapflag=0 if there is only 1 bead --- src/REPLICA/fix_pimd_langevin.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/REPLICA/fix_pimd_langevin.cpp b/src/REPLICA/fix_pimd_langevin.cpp index 3559fc8efe..964cca44c2 100644 --- a/src/REPLICA/fix_pimd_langevin.cpp +++ b/src/REPLICA/fix_pimd_langevin.cpp @@ -260,6 +260,9 @@ FixPIMDLangevin::FixPIMDLangevin(LAMMPS *lmp, int narg, char **arg) : nreplica = universe->nworlds; ireplica = universe->iworld; + if (nreplica == 1) mapflag = 0; + else mapflag = 1; + int *iroots = new int[nreplica]; MPI_Group uworldgroup, rootgroup; From 4e0af69b67d77a247a3495109219697d60e9e7c5 Mon Sep 17 00:00:00 2001 From: Yifan Li Date: Wed, 15 Mar 2023 17:06:28 -0400 Subject: [PATCH 030/396] update documentation keyword part --- doc/src/fix_pimd.rst | 28 +++++++++++++++++++++------- 1 file changed, 21 insertions(+), 7 deletions(-) diff --git a/doc/src/fix_pimd.rst b/doc/src/fix_pimd.rst index b774a7c8df..63f57f1fdf 100644 --- a/doc/src/fix_pimd.rst +++ b/doc/src/fix_pimd.rst @@ -30,15 +30,28 @@ Syntax * keywords for style *pimd/langevin* .. parsed-literal:: - *keywords* = *method* or *integrator* or *ensemble* or *fmass* or *fmmode* or *scale* or *lj* or *temp* or *thermostat* or *tau* or *press* or *barostat* or *taup* or *iso* or *aniso* + *keywords* = *method* or *integrator* or *ensemble* or *fmmode* or *scale* or *temp* or *thermostat* or *tau* or or *iso* or *aniso* or *barostat* or *taup* or *fixcom* or *lj* *method* value = *nmpimd* - *fmass* value = scaling factor on mass - *sp* value = scaling factor on Planck constant - *temp* value = target temperature (temperarate units) - *thermostat* values = PILE_L *seed* - *seed* = random number seed + *integrator* value = *obabo* or *baoab* + *fmmode* value = *physical* or *normal* + *temp* value = Temperature (temperarate unit) + Temperature = target temperarate of the thermostat + *thermostat* values = style seed + style value = *PILE_L* + seed = random number generator seed *tau* value = thermostat damping parameter (time unit) - *press* value = target pressure (pressure units) + *scale* value = scaling factor of the damping times of non-centroid modes of PILE_L thermostat + *iso* or *aniso* values = Pressure (pressure unit) + Pressure = scalar external pressure of the barostat + *barostat* value = *BZP* or *MTTK* + *taup* value = barostat damping parameter (time unit) + *fixcom* value = *yes* or *no* + *lj* values = epsilon sigma mass planck mvv2e + epsilon = energy scale for reduced units (energy units) + sigma = length scale for reduced units (length units) + mass = mass scale for reduced units (mass units) + planck = Planck's constant for other unit style + mvv2e = mass * velocity^2 to energy conversion factor for other unit style Examples """""""" @@ -46,6 +59,7 @@ Examples .. code-block:: LAMMPS fix 1 all pimd/nvt method nmpimd fmass 1.0 sp 2.0 temp 300.0 nhc 4 + fix 1 all pimd/langevin ensemble npt integrator obabo temp 113.15 thermostat PILE_L 1234 tau 1.0 press 1.0 barostat BZP taup 1.0 iso Description """"""""""" From 5071b2f016e591e9a4c469e9886745fb8d726633 Mon Sep 17 00:00:00 2001 From: Yifan Li Date: Wed, 15 Mar 2023 17:25:25 -0400 Subject: [PATCH 031/396] update document notes part --- doc/src/fix_pimd.rst | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/doc/src/fix_pimd.rst b/doc/src/fix_pimd.rst index 63f57f1fdf..5c82e9c55d 100644 --- a/doc/src/fix_pimd.rst +++ b/doc/src/fix_pimd.rst @@ -106,7 +106,9 @@ would be 3 x N x P x Nc. Fix *pimd/nvt* implements a complete velocity-verlet integrator combined with NH massive chain thermostat, so no other time integration fix should be used. - Similarly fix *pimd/langeving* implements ... + Fix *pimd/langevin* implements a complete velocity-verlet integrator + combined with Langevin thermostat in the normal mode representation, and + also provides a barostat to sample the NPH/NPT ensembles. The *method* keyword determines what style of PIMD is performed. A value of *pimd* is standard PIMD. A value of *nmpimd* is for From ad25af56a9bccd8c5da3b1f5ca610af25f0dde08 Mon Sep 17 00:00:00 2001 From: Yifan Li Date: Fri, 17 Mar 2023 15:29:26 -0400 Subject: [PATCH 032/396] add reference in fix pimd/langevin document --- doc/src/fix_pimd.rst | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/doc/src/fix_pimd.rst b/doc/src/fix_pimd.rst index 5c82e9c55d..1f7d406d5e 100644 --- a/doc/src/fix_pimd.rst +++ b/doc/src/fix_pimd.rst @@ -280,3 +280,10 @@ Path Integrals, McGraw-Hill, New York (1965). **(Herman)** M. F. Herman, E. J. Bruskin, B. J. Berne, J Chem Phys, 76, 5150 (1982). +.. _Parrinello1: + +**(Parrinello1)** G. Bussi, T. Zykova-Timan, M. Parrinello, J Chem Phys, 130, 074101 (2009). + +.. _Manolopoulos: + +**(Manolopoulos)** M. Ceriotti, M. Parrinello, T. Markland, D. Manolopoulos, J. Chem. Phys. 133, 124104 (2010). \ No newline at end of file From 0e22e36b941d26fd231cd69ce16c090382d91f97 Mon Sep 17 00:00:00 2001 From: Yifan Li Date: Fri, 17 Mar 2023 15:38:48 -0400 Subject: [PATCH 033/396] add method nmpimd note for fix pimd/langevin document --- doc/src/fix_pimd.rst | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/doc/src/fix_pimd.rst b/doc/src/fix_pimd.rst index 1f7d406d5e..4de504e70c 100644 --- a/doc/src/fix_pimd.rst +++ b/doc/src/fix_pimd.rst @@ -132,6 +132,10 @@ normal-mode PIMD. A value of *cmd* is for centroid molecular dynamics overall translation of the ring-polymer and is assigned the mass of the real particle. +.. note:: + Fix pimd/langevin only supports *method* value *nmpimd*. This should be enough + for most PIMD applications for quantum thermodynamics purpose. + Motion of the centroid can be effectively uncoupled from the other normal modes by scaling the fictitious masses to achieve a partial adiabatic separation. This is called a Centroid Molecular Dynamics From 008147d1f38dd1612d1ebe0e634208e265347dda Mon Sep 17 00:00:00 2001 From: Yifan Li Date: Fri, 17 Mar 2023 17:41:29 -0400 Subject: [PATCH 034/396] correct mass preconditioning of fix pimd/langevin --- src/REPLICA/fix_pimd_langevin.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/REPLICA/fix_pimd_langevin.cpp b/src/REPLICA/fix_pimd_langevin.cpp index 964cca44c2..671625afc8 100644 --- a/src/REPLICA/fix_pimd_langevin.cpp +++ b/src/REPLICA/fix_pimd_langevin.cpp @@ -150,7 +150,7 @@ FixPIMDLangevin::FixPIMDLangevin(LAMMPS *lmp, int narg, char **arg) : "Unknown ensemble parameter for fix pimd/langevin. Only nve and nvt " "ensembles are supported!"); } else if (strcmp(arg[i], "fmass") == 0) { - fmass = utils::numeric(FLERR, arg[i + 1], false, lmp); + fmass = utils::numeric(FLERR, arg[i+1], false, lmp); if (fmass < 0.0 || fmass > 1.0) error->universe_all(FLERR, "Invalid fmass value for fix pimd/langevin"); } else if (strcmp(arg[i], "fmmode") == 0) { @@ -830,13 +830,13 @@ void FixPIMDLangevin::Langevin_init() Lan_s = new double[np]; if (fmmode == PHYSICAL) { for (int i = 0; i < np; i++) { - _omega_k[i] = _omega_np * sqrt(lam[i]); + _omega_k[i] = _omega_np * sqrt(lam[i]) / sqrt(fmass); Lan_c[i] = cos(sqrt(lam[i]) * _omega_np_dt_half); Lan_s[i] = sin(sqrt(lam[i]) * _omega_np_dt_half); } } else if (fmmode == NORMAL) { for (int i = 0; i < np; i++) { - _omega_k[i] = _omega_np; + _omega_k[i] = _omega_np / sqrt(fmass); Lan_c[i] = cos(_omega_np_dt_half); Lan_s[i] = sin(_omega_np_dt_half); } @@ -947,17 +947,17 @@ void FixPIMDLangevin::nmpimd_init() for (int i = 0; i < np; i++) for (int j = 0; j < np; j++) { M_xp2x[i][j] = M_x2xp[j][i]; } - // Set up masses + // Set up fictitious masses int iworld = universe->iworld; for (int i = 1; i <= atom->ntypes; i++) { mass[i] = atom->mass[i]; + mass[i] *= fmass; if (iworld) { if (fmmode == PHYSICAL) { mass[i] *= 1.0; } else if (fmmode == NORMAL) { mass[i] *= lam[iworld]; } - mass[i] *= fmass; } } } From 76c19410c737faaeb2080b7268b31a5aed10b8d5 Mon Sep 17 00:00:00 2001 From: Yifan Li Date: Fri, 17 Mar 2023 17:44:48 -0400 Subject: [PATCH 035/396] correct fmass input of fix pimd/langevin --- src/REPLICA/fix_pimd_langevin.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/REPLICA/fix_pimd_langevin.cpp b/src/REPLICA/fix_pimd_langevin.cpp index 671625afc8..88289f7609 100644 --- a/src/REPLICA/fix_pimd_langevin.cpp +++ b/src/REPLICA/fix_pimd_langevin.cpp @@ -94,6 +94,7 @@ FixPIMDLangevin::FixPIMDLangevin(LAMMPS *lmp, int narg, char **arg) : thermostat = PILE_L; barostat = BZP; fmass = 1.0; + np = universe->nworlds; sp = 1.0; temp = 298.15; Lan_temp = 298.15; @@ -151,7 +152,7 @@ FixPIMDLangevin::FixPIMDLangevin(LAMMPS *lmp, int narg, char **arg) : "ensembles are supported!"); } else if (strcmp(arg[i], "fmass") == 0) { fmass = utils::numeric(FLERR, arg[i+1], false, lmp); - if (fmass < 0.0 || fmass > 1.0) + if (fmass < 0.0 || fmass > np) error->universe_all(FLERR, "Invalid fmass value for fix pimd/langevin"); } else if (strcmp(arg[i], "fmmode") == 0) { if (strcmp(arg[i + 1], "physical") == 0) @@ -335,7 +336,6 @@ void FixPIMDLangevin::init() // prepare the constants masstotal = group->mass(igroup); - np = universe->nworlds; inverse_np = 1.0 / np; double planck; From fd21a584bf01e15639db1823d99524d23748458d Mon Sep 17 00:00:00 2001 From: Yifan Li Date: Sat, 18 Mar 2023 10:17:01 -0400 Subject: [PATCH 036/396] update fmass part of fix pimd/langevin document --- doc/src/fix_pimd.rst | 28 ++++++++++++++++++++++++++-- 1 file changed, 26 insertions(+), 2 deletions(-) diff --git a/doc/src/fix_pimd.rst b/doc/src/fix_pimd.rst index 4de504e70c..28a5308dd7 100644 --- a/doc/src/fix_pimd.rst +++ b/doc/src/fix_pimd.rst @@ -30,10 +30,11 @@ Syntax * keywords for style *pimd/langevin* .. parsed-literal:: - *keywords* = *method* or *integrator* or *ensemble* or *fmmode* or *scale* or *temp* or *thermostat* or *tau* or or *iso* or *aniso* or *barostat* or *taup* or *fixcom* or *lj* + *keywords* = *method* or *integrator* or *ensemble* or *fmmode* or *fmass* or *scale* or *temp* or *thermostat* or *tau* or or *iso* or *aniso* or *barostat* or *taup* or *fixcom* or *lj* *method* value = *nmpimd* *integrator* value = *obabo* or *baoab* *fmmode* value = *physical* or *normal* + *fmass* value = scaling factor on mass *temp* value = Temperature (temperarate unit) Temperature = target temperarate of the thermostat *thermostat* values = style seed @@ -81,9 +82,11 @@ by the following equations: .. math:: Z = & \int d{\bf q} d{\bf p} \cdot \textrm{exp} [ -\beta H_{eff} ] \\ - H_{eff} = & \bigg(\sum_{i=1}^P \frac{p_i^2}{2m_i}\bigg) + V_{eff} \\ + H_{eff} = & \bigg(\sum_{i=1}^P \frac{p_i^2}{2M_i}\bigg) + V_{eff} \\ V_{eff} = & \sum_{i=1}^P \bigg[ \frac{mP}{2\beta^2 \hbar^2} (q_i - q_{i+1})^2 + \frac{1}{P} V(q_i)\bigg] +$M_i$ is the fictitious mass of the $i$-th mode, and m is the actual mass of the atoms. + The interested user is referred to any of the numerous references on this methodology, but briefly, each quantum particle in a path integral simulation is represented by a ring-polymer of P quasi-beads, labeled @@ -152,6 +155,27 @@ masses of beads, which can be used for the Partial Adiabatic CMD :ref:`(Hone) `, or to be set as P, which results in the fictitious masses to be equal to the real particle masses. +The keyword *fmmode* of *fix pimd/langevin* determines the mode of fictitious +mass preconditioning. There are two options: *physical* and *normal*. If *fmmode* is +*physical*, then the physical mass of the particles are used (and then multiplied by +*fmass*). If *fmmode* is *normal*, then the physical mass is first multiplied by the +eigenvalue of each normal mode, and then multiplied by *fmass*. More precisely, the +fictitious mass of *fix pimd/langevin* is determined by two factors: *fmmode* and *fmass*. +If *fmmode* is *physical*, then the fictitious mass is +.. math:: + $M_i = \mathrm{fmass} \times m$ + +If *fmmode* is *normal*, then the fictitious mass is +.. math:: + $M_i = \mathrm{fmass} \times \lambda_i \times m$ + +where $\lambda_i$ is the eigenvalue of the $i$-th normal mode. +.. note:: + Fictitious mass is only used in the momentum of the equation of motion + ($\bf{p}_i=M_i\bf{v}_i$), and not used in the spring elastic energy + ($\sum_{i=1}^P \frac{1}{2}m\omega_P^2(q_i - q_{i+1})^2$, $m$ is always the + actual mass of the particles). + The keyword *sp* is a scaling factor on Planck's constant, which can be useful for debugging or other purposes. The default value of 1.0 is appropriate for most situations. From 7beec96dd333601d17088b44efda65a0390cd283 Mon Sep 17 00:00:00 2001 From: Yifan Li Date: Sat, 18 Mar 2023 10:23:09 -0400 Subject: [PATCH 037/396] support sp in fix pimd/langevin --- src/REPLICA/fix_pimd_langevin.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/REPLICA/fix_pimd_langevin.cpp b/src/REPLICA/fix_pimd_langevin.cpp index 88289f7609..7a901316f3 100644 --- a/src/REPLICA/fix_pimd_langevin.cpp +++ b/src/REPLICA/fix_pimd_langevin.cpp @@ -154,6 +154,9 @@ FixPIMDLangevin::FixPIMDLangevin(LAMMPS *lmp, int narg, char **arg) : fmass = utils::numeric(FLERR, arg[i+1], false, lmp); if (fmass < 0.0 || fmass > np) error->universe_all(FLERR, "Invalid fmass value for fix pimd/langevin"); + } else if (strcmp(arg[i], "sp") == 0) { + sp = utils::numeric(FLERR, arg[i+1], false, lmp); + if (sp < 0.0) error->universe_all(FLERR, "Invalid sp value for fix pimd/nvt"); } else if (strcmp(arg[i], "fmmode") == 0) { if (strcmp(arg[i + 1], "physical") == 0) fmmode = PHYSICAL; @@ -345,7 +348,7 @@ void FixPIMDLangevin::init() } else { planck = force->hplanck; } - + planck *= sp; hbar = planck / (2.0 * MY_PI); kBT = force->boltz * temp; double beta = 1.0 / (force->boltz * temp); From d8f41a9032cb6271bb63bd53d8d5231d9051eddf Mon Sep 17 00:00:00 2001 From: Yifan Li Date: Sat, 18 Mar 2023 10:25:05 -0400 Subject: [PATCH 038/396] support sp in fix pimd/nvt --- src/REPLICA/fix_pimd_nvt.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/REPLICA/fix_pimd_nvt.cpp b/src/REPLICA/fix_pimd_nvt.cpp index 1f2f29f35c..e899c75a27 100644 --- a/src/REPLICA/fix_pimd_nvt.cpp +++ b/src/REPLICA/fix_pimd_nvt.cpp @@ -219,7 +219,7 @@ void FixPIMDNVT::init() const double Boltzmann = force->boltz; const double Plank = force->hplanck; - double hbar = Plank / (2.0 * MY_PI); + double hbar = Plank / (2.0 * MY_PI) * sp; double beta = 1.0 / (Boltzmann * nhc_temp); double _fbond = 1.0 * np / (beta * beta * hbar * hbar); From be8c0b9835d68354e4f5b9925f25eb0bfc9f539b Mon Sep 17 00:00:00 2001 From: Yifan Li Date: Mon, 20 Mar 2023 14:08:42 -0400 Subject: [PATCH 039/396] enable fixcom feature of fix pimd/langevin --- src/REPLICA/fix_pimd_langevin.cpp | 24 ++++++++++++++++++++++++ src/REPLICA/fix_pimd_langevin.h | 1 + 2 files changed, 25 insertions(+) diff --git a/src/REPLICA/fix_pimd_langevin.cpp b/src/REPLICA/fix_pimd_langevin.cpp index 7a901316f3..e1d3960a50 100644 --- a/src/REPLICA/fix_pimd_langevin.cpp +++ b/src/REPLICA/fix_pimd_langevin.cpp @@ -451,6 +451,7 @@ void FixPIMDLangevin::initial_integrate(int /*vflag*/) if (integrator == OBABO) { if (tstat_flag) { o_step(); + if (removecomflag) remove_com_motion(); if (pstat_flag) press_o_step(); } if (pstat_flag) { @@ -488,6 +489,7 @@ void FixPIMDLangevin::initial_integrate(int /*vflag*/) a_step(); if (tstat_flag) { o_step(); + if (removecomflag) remove_com_motion(); if (pstat_flag) press_o_step(); } qc_step(); @@ -526,6 +528,7 @@ void FixPIMDLangevin::final_integrate() if (integrator == OBABO) { if (tstat_flag) { o_step(); + if (removecomflag) remove_com_motion(); if (pstat_flag) press_o_step(); } } else if (integrator == BAOAB) { @@ -1134,6 +1137,27 @@ void FixPIMDLangevin::inter_replica_comm(double **ptr) /* ---------------------------------------------------------------------- */ +void FixPIMDLangevin::remove_com_motion(){ + if(universe->iworld == 0) + { + double **v = atom->v; + int *mask = atom->mask; + int nlocal = atom->nlocal; + if (dynamic) masstotal = group->mass(igroup); + double vcm[3]; + group->vcm(igroup,masstotal,vcm); + for (int i = 0; i < nlocal; i++) { + if (mask[i] & groupbit) { + v[i][0] -= vcm[0]; + v[i][1] -= vcm[1]; + v[i][2] -= vcm[2]; + } + } + } +} + +/* ---------------------------------------------------------------------- */ + void FixPIMDLangevin::compute_cvir() { int nlocal = atom->nlocal; diff --git a/src/REPLICA/fix_pimd_langevin.h b/src/REPLICA/fix_pimd_langevin.h index 43f6df5e84..b8bed1a10f 100644 --- a/src/REPLICA/fix_pimd_langevin.h +++ b/src/REPLICA/fix_pimd_langevin.h @@ -147,6 +147,7 @@ class FixPIMDLangevin : public Fix { void reallocate_x_unwrap(); void reallocate_xc(); void collect_xc(); + void remove_com_motion(); double xf, vir, vir_, xcf, centroid_vir; double t_prim, t_vir, t_cv, p_prim, p_vir, p_cv, p_md; From 7a38f49a21cacc6f0701e67c715f446f4c835df5 Mon Sep 17 00:00:00 2001 From: Yifan Li Date: Mon, 20 Mar 2023 14:10:09 -0400 Subject: [PATCH 040/396] add lj example for fix pimd/langevin --- examples/PACKAGES/pimd/lj/data.metalnpt01 | 422 ++++++++++++++++++++++ examples/PACKAGES/pimd/lj/data.metalnpt02 | 422 ++++++++++++++++++++++ examples/PACKAGES/pimd/lj/data.metalnpt03 | 422 ++++++++++++++++++++++ examples/PACKAGES/pimd/lj/data.metalnpt04 | 422 ++++++++++++++++++++++ examples/PACKAGES/pimd/lj/in.lmp | 28 ++ examples/PACKAGES/pimd/lj/run.sh | 1 + 6 files changed, 1717 insertions(+) create mode 100644 examples/PACKAGES/pimd/lj/data.metalnpt01 create mode 100644 examples/PACKAGES/pimd/lj/data.metalnpt02 create mode 100644 examples/PACKAGES/pimd/lj/data.metalnpt03 create mode 100644 examples/PACKAGES/pimd/lj/data.metalnpt04 create mode 100755 examples/PACKAGES/pimd/lj/in.lmp create mode 100644 examples/PACKAGES/pimd/lj/run.sh diff --git a/examples/PACKAGES/pimd/lj/data.metalnpt01 b/examples/PACKAGES/pimd/lj/data.metalnpt01 new file mode 100644 index 0000000000..3dc2944ed9 --- /dev/null +++ b/examples/PACKAGES/pimd/lj/data.metalnpt01 @@ -0,0 +1,422 @@ +LAMMPS data file via write_data, version 8 Feb 2023, timestep = 100000 + +200 atoms +1 atom types + +-11.876696863105703 11.876696863105703 xlo xhi +-11.876696863105703 11.876696863105703 ylo yhi +-11.876696863105703 11.876696863105703 zlo zhi + +Masses + +1 39.948 + +Pair Coeffs # lj/cut + +1 0.00965188 3.4 + +Atoms # atomic + +39 1 -10.338208372875723 -8.724519590498623 -8.445612139491281 0 -1 1 +82 1 -7.5133824622188925 -6.978636164411631 -10.191775661279799 0 0 0 +57 1 -6.093878587859262 -9.276313581141936 -7.744358551066254 1 0 0 +8 1 -7.188384493977925 -11.000743174865285 -10.566868392413127 0 1 1 +49 1 -0.45896030511450936 -8.721648062141405 -7.76988436909876 0 1 0 +54 1 4.36019737005205 -9.840722628422576 -9.652200105153977 0 -1 1 +114 1 3.904944042667676 -8.560258519206736 -6.227256449483399 -1 0 1 +128 1 1.537670815459421 11.367557646509137 -7.44113189883349 0 0 -2 +102 1 2.6467980910798623 -6.300231690446356 -10.839747469959917 1 -1 -1 +157 1 6.599214138053117 -6.278630725537236 -7.389049268829837 -1 0 1 +20 1 8.160418209241914 -11.236890922228888 -9.90427297873004 0 1 0 +147 1 10.464052914243185 -5.834517788008704 -9.403782126876184 -1 2 0 +169 1 9.355540563360105 -8.982132042608429 -6.861385656669775 0 1 1 +123 1 -6.908328795781873 -3.2942152122483694 -10.871702946953768 -1 0 -1 +130 1 -6.59789640513614 -2.559000332768779 -7.109058819418416 -1 1 0 +140 1 -9.12121182032633 -1.3228381271313019 -9.248705124201138 -1 1 0 +153 1 -4.57209419001429 -5.197951679459013 -8.806559015841044 0 1 0 +129 1 -0.17714454435176596 -5.056145756511569 -8.582370909018262 0 1 1 +148 1 -3.197585507102101 -2.0540921199407465 -9.77932871778502 0 0 0 +119 1 -3.51954842440485 -3.8478081846346726 10.678236929073831 0 -1 -1 +174 1 3.1384595215939513 -1.9078182147633918 -10.748237231758047 -1 1 -1 +134 1 -0.0032185119392025285 -0.36841629060197645 -8.631895429784365 -1 0 2 +189 1 2.892780086534627 -1.3587472579142499 -6.410113256095116 0 0 2 +28 1 6.224912481821424 -1.100900418829165 -9.316948573538184 0 0 -1 +1 1 7.533342646866252 -2.8858379557892953 -6.5588822497649195 1 -1 0 +24 1 10.891564390761006 -2.1693511431878143 -8.14872153065027 0 -1 1 +176 1 10.35065200687287 -3.6683271215630047 -4.32699396695263 0 0 0 +182 1 -10.764131367809398 0.5730937842904389 -5.180063181396292 0 1 -1 +137 1 -8.194528746006949 3.76661130396705 -8.596433076900993 -1 1 0 +89 1 -5.793296966734716 0.9591211322466908 -8.532912969707475 0 0 -1 +88 1 -3.2415549382910047 2.6063473128515433 -11.019658141847422 0 1 -1 +160 1 -0.17978720428819353 5.335367005111222 -5.961111228150678 0 0 1 +125 1 -3.2595127311899836 3.541669787125592 -7.094678802230409 0 1 0 +167 1 2.6101389699783257 2.7016950511217104 -7.510579719545417 0 1 0 +107 1 2.478905108002845 1.3710464608203452 -11.241338409619438 -1 1 1 +45 1 -0.2728444271939366 3.4472072045614333 -9.803824961885091 0 1 0 +95 1 7.005885045149228 1.8641755193621776 -11.033503201926393 0 2 -1 +111 1 11.28085723924775 1.3577973865073396 -8.404143782130012 0 1 1 +37 1 7.50412447792306 1.5806311975228182 -7.696866725729485 1 0 2 +53 1 9.464056637143884 5.181490576538966 -10.160960273108417 -1 -1 1 +122 1 -8.61454149114821 11.46923394337289 -7.097906043887797 2 -1 -1 +126 1 -8.658911027419105 9.160142379367757 -10.196432851978876 0 0 -1 +72 1 -11.223582472260205 7.275428216701358 10.836645274139237 2 0 0 +144 1 -3.0387339366126 -9.918200912273784 -9.896452956043586 0 1 1 +135 1 0.03771056281680529 7.830565362407303 -8.390686664231268 1 0 0 +183 1 2.8786138768293665 5.221499246050073 -10.100270572243783 0 0 0 +155 1 3.821499942128122 9.224610559399695 -9.359914290522674 0 0 0 +21 1 6.6299071097705 6.818271712520994 -8.197268594363944 1 0 0 +66 1 9.53812274637967 7.559409537149467 -6.194715694404919 -2 -1 0 +22 1 11.107750453110658 10.72621054512756 -6.232964722376559 -1 0 0 +42 1 9.127119842763733 9.280850325093446 -10.249747757735628 -1 1 0 +77 1 -6.840159982144716 -10.92057206639582 -3.876267638432264 1 -1 1 +47 1 -8.742923464684916 -8.023408201112765 -5.403173093100989 1 2 1 +18 1 -10.63751608820882 -11.30186343558728 -3.9206887105699195 1 0 -1 +46 1 11.298180499183054 -7.685155723666886 -4.06604680107494 1 0 -2 +14 1 -9.566429851257723 -7.447961115721825 -2.010931774940218 -1 0 2 +178 1 -4.527419254322211 -8.045910047035035 -4.819501104832851 2 1 0 +48 1 -3.2147691406929866 -10.888877164915472 -6.377437598460709 1 1 -1 +55 1 -0.9601171939836206 -6.238495322587188 -4.2762406549238605 -1 0 -1 +12 1 -1.8964494825899862 -9.405283267682947 -2.3799601015584315 -1 0 2 +15 1 6.020890846962015 -8.178330582079944 0.7240728610757863 -1 0 -1 +64 1 2.731938348082501 -10.543443272156145 -1.741916704711699 1 1 0 +44 1 8.065377899358 -6.2776681789760715 -3.599447303926354 -1 0 1 +188 1 10.02823971588665 -8.47709879900416 -0.7307124355000334 -1 0 0 +200 1 -9.394872508283228 -3.330386381489715 -5.1567351351767705 -1 0 0 +198 1 -7.21209897973175 -1.1704302343832897 -2.203950414480204 0 0 1 +76 1 -9.986350100477846 -3.0116982250661763 -1.5200938888623745 1 0 0 +194 1 -6.746550374491012 -4.972813556867408 -2.5010542319113824 0 1 -1 +68 1 -2.5395355119165752 -3.5084431511046077 -6.11089008487593 0 1 1 +96 1 -3.383034995518244 -3.996115182399876 -2.1114098179404905 -1 2 0 +91 1 3.023350222125586 -6.242259457656427 -2.3794062527217115 1 -1 -1 +154 1 -0.21966769644821582 -2.9431607814775376 -3.0023832902544516 -1 2 0 +19 1 3.1658091018639274 -2.0642468786997554 -2.307083850490244 0 1 -1 +120 1 6.655220459905831 -2.268055028492757 -2.8431810436972036 1 1 1 +138 1 9.657284951715521 -4.552145938528714 -0.6562837148986382 -1 1 -1 +9 1 7.577787647310252 -2.027383158459481 0.591256647470022 0 0 1 +150 1 -9.975709520806461 2.045189761629004 -1.3967042898865678 1 -1 1 +38 1 -5.780821497271447 4.724336446491739 -4.727424802574532 1 0 2 +172 1 -9.690365647641709 4.0528825638271995 -4.90299752668659 0 0 2 +29 1 -7.905836311144201 7.618140007848844 2.0916587803060374 1 -1 -1 +87 1 -3.2429786758343386 -0.9446923499804107 -3.602689802943157 0 -1 1 +93 1 -6.311310050813026 0.9463486890063564 -4.844328963553153 0 -1 1 +195 1 1.0294591756555889 0.17190072131794665 -3.729109843284945 1 -1 3 +149 1 -2.2517532526979984 2.837758606759653 -2.568308902690684 1 0 0 +25 1 4.622058806898725 1.1966098061131745 -0.5762266975161516 -1 0 1 +35 1 2.770724754796497 3.7811224145924633 -3.6900492736017867 1 -1 0 +116 1 5.985384722273807 5.820793889080573 -5.01963853113883 0 1 0 +5 1 5.710509981071034 1.5091333740272113 -4.1779355439452 0 -1 -1 +112 1 4.909280213802248 5.451229842365678 -0.23301351689583433 -1 0 0 +152 1 11.352756404691903 -0.5457110274170986 -1.851635893722021 -2 -1 0 +132 1 8.574718024729343 1.7846682488107686 -1.3135653711870618 0 0 0 +173 1 8.985071256603522 3.7974294357041134 -5.507410143502991 0 0 1 +73 1 -9.997675226742189 8.034933990134746 -6.6211967592334595 0 -2 1 +161 1 -11.552860384837217 7.057039822309078 -3.567109853559714 2 0 2 +78 1 -1.8080552760100446 10.151101687740656 -1.7466859905812946 1 -2 1 +11 1 4.503908677727956 -11.845112920212848 -5.000489634351112 0 2 1 +84 1 2.4816138724708487 7.425072174245171 -5.250945864454475 1 0 0 +90 1 6.134640615065156 9.297869169242624 -0.8361676575747339 0 -1 1 +36 1 1.9591052897014976 7.715785297331987 -1.741598961638701 2 -1 0 +98 1 8.55440808947692 7.573996243117245 -2.894381804652479 -1 0 0 +56 1 7.300059241947594 10.446841724098018 -6.708609001665156 -1 0 1 +109 1 9.185972290533323 11.319457447612841 -0.9199703749554402 -1 1 1 +115 1 -7.290737513756202 -8.128422064576581 2.840900089769448 1 0 0 +124 1 -11.095494798277388 -8.787146009506092 4.06143463064398 1 0 -2 +121 1 -8.269324094623837 -10.076632693187037 6.580117501920071 0 1 -1 +80 1 -4.964400090273426 -7.254460179243866 -0.2516287260948715 0 0 1 +101 1 -4.352556925935133 -8.093642941491481 4.9061967743324075 1 3 1 +4 1 1.6615068736969008 10.065280091130505 4.658196599859135 -1 -1 -1 +81 1 7.340287496174785 -8.542929146635126 6.681008128047246 -1 1 1 +6 1 8.92830710513934 -10.595453002991315 2.772878983207939 1 1 0 +166 1 -8.702005772998799 -5.0252019350878925 4.355591496028076 0 2 0 +40 1 -7.050509790391359 -4.52399648752538 1.2979104738341645 1 1 0 +127 1 -5.6981160982548635 -2.4804262914214696 3.963876974872145 0 -1 0 +104 1 -0.43889931205929145 -0.6786512342031208 -0.26982380817326046 -1 0 -1 +151 1 0.38632233704260427 -6.436575550724694 0.28827602607540115 0 1 2 +60 1 -2.3388191412291297 -2.1909895686965264 5.332358036316238 0 1 0 +168 1 3.905092056046815 -3.342842649601014 0.743162620375255 -1 1 -1 +51 1 0.30821594516237355 -3.3431888641351466 2.97421468380087 0 0 -1 +97 1 2.0959982908166124 -0.09218688876005032 2.2065126859574242 0 -1 -1 +103 1 4.032770557637615 -1.033589048853706 6.026643139338357 -1 2 0 +163 1 -10.67096111340156 -2.753792851497721 2.2777487994238297 0 -1 0 +175 1 5.732332747304902 -3.395357434547403 3.9793999602240824 -1 1 0 +158 1 8.900731939704714 -6.465614302153284 2.882524782105495 -1 0 -1 +85 1 10.256991086371421 -0.03399764580791596 5.19749850902792 1 0 1 +63 1 -8.206071489694988 -0.20777550918309284 1.1337283531787357 -1 0 1 +133 1 -10.53669133454302 2.413445898515217 3.6779422317228634 1 1 0 +67 1 -6.580427997228583 3.5308019506173483 3.249950052857889 1 0 0 +83 1 -3.837130760373457 0.5948829995405305 2.7555803207629808 0 -2 1 +162 1 0.5628056325507875 0.015590885064073646 6.104541108047491 0 0 0 +170 1 -2.741308504695489 4.278253215456882 6.467354505657028 -1 1 -2 +181 1 -5.298818879016533 0.6747551441657151 5.729306597544269 -1 1 -1 +71 1 1.6643578976841618 4.095917673198805 -0.5219437486813767 0 -1 -1 +31 1 1.0515428688465895 4.152933403466363 6.1671972298548825 0 -2 0 +139 1 3.7848906674638663 3.6854393920193473 3.29399693806094 -1 2 0 +3 1 10.981379981294642 1.2656622142958476 0.9353988521574017 0 -1 1 +108 1 6.1052451115408175 0.8636547219490183 3.620998736363435 1 1 0 +16 1 8.972094495168673 3.5728016103606848 4.03251575890399 0 -2 1 +110 1 -11.360244143589199 5.991417852211969 3.108858276372061 0 0 -2 +50 1 -7.001523002421964 11.111129854490866 4.085896982012491 0 0 0 +191 1 -8.535734954334753 7.01291974923636 5.601813919122847 1 -1 0 +187 1 -10.711068400768836 11.24759510548256 5.108018843428019 1 1 0 +180 1 -1.0115990012221623 6.198904069067613 -1.8166876549028856 1 -1 2 +30 1 -0.6366171189365808 8.860606610617594 1.2441466899617097 1 -2 -1 +2 1 -1.8186886713768473 5.401678057284073 2.675711617904522 1 -2 -1 +17 1 -2.0021887273825953 8.358120841698845 5.289337562756078 -2 0 -1 +7 1 4.074924702840786 8.78812906409422 1.7171879913627848 -1 0 1 +164 1 1.8692613585489788 6.285969009685708 2.179749632062295 -1 0 0 +69 1 4.63280772470042 6.917030747154868 5.0992927825629835 0 -2 -1 +61 1 10.180483484726627 5.102933813094147 -0.6143013682078827 -1 -2 0 +34 1 7.6753980260971115 9.289346236573914 2.385702988209246 0 0 -1 +43 1 7.122060213065371 6.027541758611427 2.434097564627603 -1 -2 1 +177 1 8.528259310530697 7.357497844279905 5.573095645895759 -1 1 -1 +179 1 11.765063377112929 -11.216117555594387 -10.520782276852188 -1 3 2 +65 1 -9.939292746165652 -8.35547457034324 11.370610161953358 0 -1 -1 +27 1 -10.951259960706151 -11.676718912293088 8.46919851147203 1 1 1 +58 1 -9.681801591871107 -6.867288275839336 8.155377252027327 -1 0 -1 +32 1 -6.131008336203429 -5.3807894145123 6.404139996945254 2 1 -2 +26 1 -5.277766259873033 -8.47443173172751 9.34226968131783 1 0 0 +142 1 -2.2300264866152233 -6.734520703453221 8.54527447884555 2 1 0 +100 1 -1.5334511532264656 -10.941538235330839 6.762850724892153 1 2 0 +184 1 7.375517404090732 -7.455937963783537 -11.443563002056962 0 1 2 +105 1 1.3322147240971494 -7.892907018083993 3.959755431262508 0 0 -1 +75 1 4.579073338589469 -6.332281766890766 5.401380400098642 0 -1 0 +99 1 1.6872589572610692 -11.008904691990601 10.790406649632594 0 0 0 +193 1 2.165378393000026 -6.907577487565213 9.269079214220964 1 1 -1 +33 1 4.415243573456659 -11.651415043860048 7.196586725345009 0 -1 0 +79 1 8.562132664810616 11.60776935837499 5.9765813232044 -1 0 0 +92 1 9.7882797687825 -9.546408677583251 11.099049944831634 0 2 -1 +165 1 -9.230629586630256 -3.286419219229394 7.361693942438226 0 0 0 +199 1 -6.865681519441191 -4.960200472270827 9.951650907912764 0 -1 1 +70 1 -5.465385410624981 -2.359017759235627 7.824489075549977 0 1 1 +146 1 -1.4128831058942808 -0.5651321764460739 11.276244400666037 2 1 1 +106 1 -1.359759429785522 -2.5612049312124596 8.66030082151058 0 0 -1 +52 1 0.6275246163307096 -3.6626685091764974 11.394079726568394 0 0 0 +86 1 5.385048800206313 -4.521509414521681 8.656605720260643 -1 0 1 +197 1 1.5960773668099044 -4.632851183052137 7.050260712413685 -1 0 -1 +185 1 2.0988154112902677 -0.6155858372057779 10.039741652805866 -2 1 -2 +190 1 7.402096413387279 -0.25029457328283883 9.918579248632192 0 0 -1 +145 1 7.12421994994077 -3.662416626939269 -11.744325877649178 -1 -2 0 +131 1 11.18002293743892 -5.284301350499634 6.202872301153104 1 0 0 +156 1 -5.458324556633278 -0.38542205585237 11.508150106421377 0 -1 -1 +10 1 -9.11455987814511 -0.7284053525098189 4.7937364242043685 0 0 2 +196 1 -9.334790977795333 0.22026194254469544 8.665774918646903 1 2 1 +143 1 -7.202065049712928 3.0671354576980563 8.711576683539384 1 0 0 +13 1 -11.827431931265373 3.351396387549464 6.969024410690874 -1 -1 1 +59 1 -3.4888315694577976 1.7945900827414363 9.37212343512276 1 -1 1 +186 1 0.1399856131518682 2.5706426278242667 9.701168522174706 1 1 0 +136 1 3.4415384834588973 2.185354911818653 7.959200431003509 0 -1 -3 +192 1 10.528638878678947 2.482587032106114 9.852249456508758 1 1 1 +113 1 7.169273245351864 2.240386648237891 6.81806834338785 -1 -1 -1 +62 1 3.8919207853480167 6.881948160439718 8.99101225575 1 0 0 +74 1 -8.178685418297237 9.818884262184877 8.930172678325137 1 -1 0 +118 1 -11.577334387980462 8.493934752303879 6.984011067983683 0 1 0 +117 1 -5.265098295144998 11.327347075770236 7.5602122003602945 -1 -1 0 +23 1 -5.150793196726769 5.778029085599102 11.296630874448987 0 0 -2 +171 1 -4.323653153250317 7.139179037030907 7.775653914779269 0 2 -2 +94 1 0.595594702317225 9.593135599654605 9.048522029833913 -1 0 0 +41 1 5.495056487999116 11.528824616719037 11.673423310901565 0 0 -1 +141 1 9.858324590689726 5.708495049079261 9.011577695177973 1 -1 -1 +159 1 9.655575431519994 9.766549249024301 9.761747234830672 0 -1 0 + +Velocities + +39 3.843901085922765 -0.7556840039136884 3.588481686862416 +82 -6.7131250110640295 0.1978517371310493 3.794615543737683 +57 -3.8444246166822666 -0.12509187511770853 -0.15016726331630528 +8 2.510198026755905 3.9393955076781997 2.1890256483333417 +49 2.3436002495676416 -3.937791517692209 -0.8678317852601907 +54 0.6032383013072746 3.3962808798459587 -4.353772407339659 +114 1.733121125021854 -5.515987819958336 5.5418081738213125 +128 0.6238341583124627 -4.373836957545107 -1.8358939583013871 +102 3.7217703111263405 -2.1130321869806172 0.3604425898099683 +157 -3.060805678543839 -4.541031970793705 2.0247670855961024 +20 0.19495210236206537 0.7445218389780817 -4.9481403197240175 +147 1.300002576089047 0.4456991718445389 -0.49416915478347523 +169 -0.4362191685321444 -3.947171092840025 -1.656461237016801 +123 -4.189637911629164 -3.3929868871757067 0.6670412748458154 +130 0.6134420085318386 2.2669355259081905 -3.459678248548238 +140 -3.017718530938869 2.2011145660870097 -0.08987220236519784 +153 1.8522800493758318 0.8156876148506785 -9.385509457300062 +129 4.422122082904887 0.7131966606636173 0.3531709089212848 +148 0.6611682907987628 -0.38909659051429185 -0.4773785971811748 +119 -1.669105812009433 -0.37002694554897725 -3.3024540150626986 +174 -6.672226703796612 4.247321732812844 1.6315053674536977 +134 -3.0608984486057835 -2.4129204610506294 -2.734745807674302 +189 -2.302704208974844 3.481037259019509 -2.794714120652709 +28 -2.75682827680027 -3.050875489215879 -4.227117245181596 +1 -2.1560141369701795 4.052819594846101 5.448339653382999 +24 -2.386079256841039 -2.8280668145030563 4.35837241466938 +176 -1.4372688768932664 -6.6415313837559875 4.129983376772735 +182 -0.4720828255607976 3.662207995039096 2.519318256725504 +137 3.2869116185302323 3.2307568609578143 -1.9509349541264633 +89 0.9583454014186878 -1.6238254590624648 1.3557912965537908 +88 1.7694593220184982 -1.036030143090322 1.9233033494166958 +160 1.008621423016506 -6.119196433851812 5.640861548269096 +125 1.8734575131064475 -1.5413231325971886 -1.3731468026454559 +167 0.5552538334188052 4.600624550198432 0.10361430748931168 +107 -3.2399064229680294 -1.8236363657903167 0.5755237816639006 +45 -0.8909937912895557 3.652128037032182 0.47945125158298724 +95 -3.55734648018246 -1.7071938037895589 -0.49307606319505376 +111 -0.5877274590969576 -1.0815552570296887 1.2264280053757328 +37 -0.4940015083502718 2.120546197357239 -6.129979680695427 +53 -0.2896516389711194 0.42515885739039166 -1.8677025658203998 +122 0.967791765282903 1.7401195129115046 1.9118554789129 +126 -2.954209751448974 2.164651827051895 2.3297982456925053 +72 3.173369384034092 -3.8176084785054245 -2.272242460318536 +144 7.811875555936 4.819434744326224 0.3359991553117815 +135 0.1395889289809734 1.0258297209323288 -3.8437628564556956 +183 3.6133240015570744 -0.6507150055387017 -3.110230107415811 +155 -1.81416144798709 -3.5659788058079758 -2.041490164886604 +21 0.6092276970785621 -4.133031653047547 -1.1692481377542574 +66 -1.2540845964267104 -3.824259504042551 3.29729030480536 +22 2.5446763351186448 -0.6513499783353496 -2.0932016159863465 +42 5.82871794909335 1.6743919751666467 0.7126718280768334 +77 -0.4040118365141223 -3.2290750702108357 1.818231240430787 +47 0.028653058178313952 -2.27141290239272 0.7388413469098802 +18 -0.3605358292652272 -2.51632133097868 -2.2152302223559324 +46 -4.956822430210972 1.7347845441659948 -0.8052402055568453 +14 1.0447813005670052 1.7950897980192044 -5.120385937069129 +178 2.8613069610645323 -1.221832900100255 4.786474400939546 +48 -1.0101057057064093 -4.108390928419403 -3.626668446988165 +55 3.380329095570148 1.9767809972549477 -0.7468971412257048 +12 0.5796037236485843 -2.968894009109519 -1.109629405353503 +15 -1.0805423425753338 -0.6224135466634316 2.517980927489596 +64 2.772129192684522 2.307682180641892 1.326944641441264 +44 -2.8172327982334355 1.083586023278567 -1.8763865737567058 +188 -3.437261818925725 1.5454398749025489 -0.16540078855271825 +200 -4.575258061249265 4.788641216932844 -0.4020526553149053 +198 2.0555443873273083 -3.895983368588817 1.158820403753976 +76 -0.43680328576927907 -2.690054938184871 -3.1926091395345697 +194 -4.927518640766644 -2.7958765254010074 2.346084579105554 +68 3.8869230882195995 -4.532127531608888 -3.709193335672372 +96 0.5541428371102486 2.469654795647139 1.3292842757665846 +91 -0.732047074282118 -2.6885559423815857 -2.1949168022734056 +154 -2.5136766428597386 3.590700279102351 -0.059374328708080126 +19 -6.161653279730477 -2.8765306398549155 2.4409492942004887 +120 3.4942280062726017 -3.9836089343560284 -3.098191865520773 +138 -1.392154916395345 -2.6054126458670575 -0.5249503554366697 +9 -1.4056559546036238 -7.532778826245055 -1.3371688664267456 +150 0.5460808983742688 1.1289965684546914 0.03903574349628039 +38 7.617629027425106 5.411105913171608 -2.660628272394109 +172 1.971077098016012 -2.934759849810778 -2.6385133345793075 +29 -0.8567705552974654 6.938534740571189 1.1877415743187205 +87 -2.465817251368031 -0.5425773738872799 -0.8367656554342691 +93 -3.238874163573574 -1.2524540618123574 0.7858441913773856 +195 0.6658739747764354 -1.3905513374439 -4.4817269197268415 +149 4.447455849494194 -3.5745477247727786 -0.5281496993793596 +25 3.022648709593685 0.43914951689799137 -0.6775610151451638 +35 1.3277674074899293 0.9468507964705938 -3.026965993493294 +116 3.907132307739244 1.560341819486881 -2.1186616218198884 +5 -3.10241641974574 6.10623002683338 -0.012215259748321432 +112 -2.863798374154691 0.5948426813836486 0.35177484162268213 +152 1.5766503044655036 -0.41730163186181074 1.996501964828515 +132 -2.0634425438904502 -6.992874517268254 -0.2451331836568511 +173 0.12455810167557121 0.14574198963840712 2.9966160518510416 +73 -0.10493988646970537 0.013265555839272553 -3.9096646776491677 +161 -0.7682600042762859 1.8026603641653332 -2.7660568636516665 +78 -4.598805320864625 -0.6966368634003359 -2.729429984123398 +11 -0.9758381654162251 0.5227854122925947 0.3448945101494703 +84 2.841479136799234 0.22602223675017963 -1.9286282882334902 +90 -1.170230656537341 -0.6922100007103397 1.00880686523509 +36 -1.555842370975647 0.5631255749042902 -1.1019837065378786 +98 2.0124676556916246 0.6570695281160257 5.910973495167498 +56 -0.022897610961461763 5.352337474059436 -7.2334429828662445 +109 -0.08981766099555996 -2.306157996649536 -0.3829489041252826 +115 -0.9773922652842171 -1.500230307176322 -3.510085314469408 +124 -1.1435154328225432 2.1646855444941977 -2.677614067537958 +121 -0.6489305438370466 -5.377205725667324 6.410392354489873 +80 -2.184720009719291 -4.6495239027996265 -0.404219915911962 +101 -1.8277373470288034 -0.16307514644975357 -4.871062878988115 +4 5.273572229084702 -6.329640548895822 -0.10537322064888095 +81 -3.237096839577087 -1.2899510482475711 -0.501749653216555 +6 -2.850185972190969 -0.9855865922331829 1.2879726986158606 +166 -0.71207408822265 -1.941276610007301 -0.46670672944069197 +40 2.5501094465369287 -4.1121537776062285 -3.7730629800493616 +127 0.9391826983400688 -0.23609028118969985 -0.8428319005564415 +104 -2.889702758235898 2.6026465825944647 1.733501739951787 +151 1.0239383010373613 4.20250515830853 -2.5188428027750676 +60 0.8768242700054026 -1.4452870366932915 4.607166615214986 +168 2.6499467008683806 0.15351519699868008 -2.4173199831848433 +51 -2.7001470663696083 2.298050292705142 -1.8727439352999022 +97 4.077411493370136 -0.49363711607361804 2.618893169202227 +103 -0.7976469434966291 -2.8296239792549494 -3.1085019733170576 +163 1.4239083858918546 -1.7152330037559187 -3.7262201886107413 +175 2.28608354457103 -5.013082617544787 1.9463144730607622 +158 2.364724804444635 -1.417965451640216 3.3110988056960116 +85 2.634049111053192 2.030183273599258 -1.1156959044778305 +63 -2.5594596368644584 6.5807348164634165 1.2216612365119401 +133 0.11496856368877509 -1.3029278864933922 0.3137832360475215 +67 3.2847742901460815 -3.509493405431694 2.207008202574443 +83 2.570557721108847 -0.3717669874940476 0.19918880069367745 +162 3.0399699011039054 1.3116112714661063 2.674382531726811 +170 -1.38109599459742 3.3822351643604485 2.3645182440787846 +181 -3.229104480841883 0.4809626947427979 -1.0038042842684436 +71 3.9132675825937917 1.4930647145750953 -2.169388439547446 +31 0.2080392077753374 -0.7175240437209078 5.244126748535574 +139 -3.2722113265821164 2.403646928095839 4.89007181946881 +3 0.23844888496446556 -1.2064671761077215 -3.765272552252597 +108 1.9533881124972572 2.2407632376201616 2.7809203919337717 +16 -2.546655497698339 -2.9475172512416052 5.679217575496501 +110 -2.0619258300646304 -2.5135908125338595 -1.9634278842507895 +50 2.7297022478135924 -1.7023753942716038 0.9305543045166054 +191 -5.08419299322051 0.0712033790584315 4.019663294315123 +187 -1.1602692653736124 0.6592040176624594 -0.9276587772961099 +180 3.9270482120535912 0.7337070019018614 -6.1521791130682715 +30 2.146405625539158 -4.470711382216746 2.4389136902743624 +2 -2.164694698633498 -3.946038803617009 -6.932908852758065 +17 -5.0136316664846525 -4.910395378878622 0.2531438520391362 +7 6.405139093241594 -0.029320522419797518 -2.4556700372713656 +164 -4.71978957162196 0.7565882723845814 -7.804804192177828 +69 0.585325244096323 -4.172549570259053 1.421305529899283 +61 -1.2969434367599055 0.21371727493194503 -5.996553017036012 +34 0.836211095631979 4.842199148306591 -0.264740483545493 +43 4.973431404758735 -3.0161637272673114 0.6585207320279483 +177 1.9972180553856484 2.8405653312769714 3.7936113983454574 +179 -1.8016662165736297 0.17922718595288942 1.675961420609039 +65 -0.3262344061357664 4.502937830108041 -1.6925046570602365 +27 3.2148912674329595 -4.265923914349978 0.20837858074619325 +58 -2.5148141053183966 -3.410776250506333 -4.126435252324821 +32 -3.9688004644027894 -4.975859333985981 -0.31037975343014773 +26 -1.8868624613436276 -0.6784023280861808 -6.9019978159434325 +142 -2.2655622806415803 5.065238482808602 -0.5612653461135326 +100 -3.1689440110918863 3.611829368506524 -5.535634657025687 +184 1.155071447769214 1.3970696009831187 5.21877428678114 +105 -1.0527289600189955 -0.359868396602688 -4.314898952688254 +75 1.1126434309490583 7.161365583137096 -6.8797286508213995 +99 -2.2511573267704605 4.325930022921806 -4.536664094156967 +193 -1.8538759123569282 -0.3771359852226918 1.3265167612281819 +33 4.043103770190031 -2.463191434468879 0.2825585567463736 +79 0.8247934215179962 -0.8593180918731026 1.8075425908507756 +92 -1.9872298962564725 4.526116206000229 5.875185828559399 +165 -0.9325271408003691 1.9234746099504088 0.09139445808177141 +199 -2.4466143796538278 -3.5392337118481905 0.07336564176962056 +70 1.6955535004916 2.7542669443749292 -2.844202030673744 +146 -2.7188074197448584 1.8546678027188679 3.404472056065058 +106 1.6207845192963544 1.2164210998710923 7.1450165172108 +52 6.210256198054289 -2.1514980948844977 -3.0246733234381606 +86 -4.166581136807711 -0.379450814784322 -2.11423926273923 +197 -2.0944322960049 2.1097024434581955 -1.5699756741420037 +185 0.496431323422778 -0.673746468047717 1.6256733179580487 +190 3.5894390751435754 -0.5232916689073732 -2.5898259464521436 +145 -5.060692392767518 -3.604348262830216 8.963086293155014 +131 -1.7493649096325448 1.9215551392824017 -5.654561521157757 +156 3.0486560090093078 0.7623397112130897 -0.6623326467666147 +10 -0.3025813929631971 3.8012367067722552 1.7944918683195408 +196 0.20779509519657535 1.1724947587327104 -3.2497684331092898 +143 0.1615216816901657 0.541965759645283 -0.3699391852573772 +13 0.3416281793998905 2.006587618812918 -4.356326172952984 +59 1.6542517855144645 1.9404536050042447 2.6385288647359855 +186 -3.4589984191612237 4.344929883747252 -2.4261876990284055 +136 -1.052237178030063 1.7981079687785935 1.5452947189881334 +192 -1.8283033036376375 -2.1460456664281984 0.4532252919540826 +113 -0.07210257811201395 0.4448121853700756 0.4002442722770919 +62 0.07671657245048122 3.988794018720988 -1.5215067553007326 +74 -6.261763851450271 6.841230877971418 0.19948931371832682 +118 -4.55843930988713 0.7045880922983706 -1.5541929923380147 +117 -1.7138030815767766 -2.2218466460669197 -2.4862510267677966 +23 3.4139900995951797 -1.2153416151189098 1.5870813641624815 +171 2.9673700826094715 -2.730113253007238 -0.013674771129509489 +94 -1.559158449433541 -4.089352807642382 -4.9936243516296415 +41 0.05830786336808787 1.0332428056957692 -1.4731928753411638 +141 2.0403501209228514 0.38114816689047215 0.2637593201666092 +159 -2.276370624127765 -5.5130320242721425 -2.201507053272948 diff --git a/examples/PACKAGES/pimd/lj/data.metalnpt02 b/examples/PACKAGES/pimd/lj/data.metalnpt02 new file mode 100644 index 0000000000..d48c9e654f --- /dev/null +++ b/examples/PACKAGES/pimd/lj/data.metalnpt02 @@ -0,0 +1,422 @@ +LAMMPS data file via write_data, version 8 Feb 2023, timestep = 100000 + +200 atoms +1 atom types + +-11.876696863105703 11.876696863105703 xlo xhi +-11.876696863105703 11.876696863105703 ylo yhi +-11.876696863105703 11.876696863105703 zlo zhi + +Masses + +1 39.948 + +Pair Coeffs # lj/cut + +1 0.00965188 3.4 + +Atoms # atomic + +39 1 -10.348412656724513 -8.709686235988883 -8.4270990310572 0 -1 1 +57 1 -6.076254771403757 -9.286388884881402 -7.702702502017148 1 0 0 +82 1 -7.550388144071918 -7.009510153923324 -10.103430125234938 0 0 0 +65 1 -10.007477542149314 -8.426774632489874 11.409858756818739 0 -1 -1 +8 1 -7.164995520412905 -11.038468804393306 -10.58636480246276 0 1 1 +49 1 -0.45959797061569213 -8.711842576893478 -7.759689256680434 0 1 0 +54 1 4.335836096446666 -9.860468354448713 -9.596810041931791 0 -1 1 +102 1 2.5723817340883883 -6.321599469181216 -10.836018784654463 1 -1 -1 +114 1 3.9633708583907534 -8.59122246718616 -6.211421303718058 -1 0 1 +128 1 1.6111319524977374 11.42178725036819 -7.424763349756333 0 0 -2 +157 1 6.676723241532642 -6.249807038476984 -7.434858543313773 -1 0 1 +20 1 8.180031746693997 -11.224906976375225 -9.914700910890055 0 1 0 +147 1 10.552595438745763 -5.846535200951102 -9.39377855844701 -1 2 0 +169 1 9.349136090221942 -8.979140149397233 -6.8265579785125965 0 1 1 +123 1 -6.855446583817184 -3.2640394531559696 -10.949254791001273 -1 0 -1 +130 1 -6.535059536526429 -2.567484128692307 -7.041716414515715 -1 1 0 +140 1 -9.06855871809178 -1.3542845787289544 -9.224892837601802 -1 1 0 +153 1 -4.569518029474378 -5.203914109037015 -8.781875667281184 0 1 0 +129 1 -0.2299073567614939 -5.077417463604178 -8.55580527821163 0 1 1 +148 1 -3.144987560803104 -2.0908434236033218 -9.879429686918634 0 0 0 +119 1 -3.5411143846194992 -3.8360561641889532 10.696563632316428 0 -1 -1 +134 1 -0.04545170129816967 -0.3594090384455699 -8.557611667254108 -1 0 2 +174 1 3.1061081743214345 -1.9799957752444968 -10.724581364205001 -1 1 -1 +189 1 2.8769937819916396 -1.3674240720053161 -6.389788220787231 0 0 2 +28 1 6.237115641177313 -1.1545998190288946 -9.272228860156012 0 0 -1 +1 1 7.549394959535029 -2.854734791893552 -6.538590887699934 1 -1 0 +24 1 10.883729099000904 -2.1271876989337706 -8.117545982704844 0 -1 1 +176 1 10.267930709995003 -3.6438442151633126 -4.343476582694092 0 0 0 +182 1 -10.786266284256198 0.5593263120798149 -5.188887623332871 0 1 -1 +137 1 -8.253864841052525 3.7298295620111226 -8.568533527553154 -1 1 0 +89 1 -5.794201120520342 0.9380076791670935 -8.557102414588634 0 0 -1 +88 1 -3.290466618666769 2.666597373561615 -10.965754432660972 0 1 -1 +160 1 -0.18201736379451042 5.440877252854083 -6.045408976448922 0 0 1 +125 1 -3.2721098231201498 3.482326329512073 -7.20800643325733 0 1 0 +167 1 2.6838478408055124 2.662941774470184 -7.446400398896404 0 1 0 +107 1 2.461769881852174 1.4723823486650787 -11.23948224456525 -1 1 1 +45 1 -0.32643148409171074 3.4132158246810462 -9.890588978502432 0 1 0 +95 1 7.12050576869771 1.8830305880227627 -11.021337217501824 0 2 -1 +111 1 11.302810293745958 1.3519264206984616 -8.432303785348612 0 1 1 +37 1 7.499987535787309 1.5957548452787924 -7.727720303674275 1 0 2 +53 1 9.440512427968931 5.294797843867766 -10.137582763727357 -1 -1 1 +122 1 -8.602536179448315 11.512272015578171 -7.106756749836173 2 -1 -1 +126 1 -8.684507097426447 9.102724910576027 -10.228076159133025 0 0 -1 +72 1 -11.212168106684132 7.24750708554837 10.879317278944692 2 0 0 +144 1 -3.026583839716779 -9.884067057114146 -9.895519067990667 0 1 1 +135 1 -0.0021296445465068814 7.861337183488864 -8.408004375424728 1 0 0 +183 1 2.8552963287326403 5.197557014594176 -10.04944592034365 0 0 0 +155 1 3.763607040992876 9.197661654352766 -9.383705258407385 0 0 0 +21 1 6.743085276662367 6.819489412060577 -8.245771575257553 1 0 0 +66 1 9.52403312105875 7.459476022143324 -6.138585785756646 -2 -1 0 +42 1 9.12856561120073 9.359598065403702 -10.255808680046007 -1 1 0 +22 1 11.084937277836246 10.7346270298744 -6.189336343510782 -1 0 0 +47 1 -8.79851480543095 -8.030651717047036 -5.3995272670275725 1 2 1 +77 1 -6.824604399212273 -10.927075660857042 -3.894519486445894 1 -1 1 +18 1 -10.638894292838417 -11.301447222259686 -3.92180055862298 1 0 -1 +46 1 11.290286356240586 -7.674430365874162 -4.055829279128204 1 0 -2 +14 1 -9.506577112536185 -7.441780453176744 -2.0080876276818103 -1 0 2 +178 1 -4.543756730558393 -8.097143654115143 -4.784790404681888 2 1 0 +48 1 -3.2444312260629573 -10.940861821243079 -6.354255167480908 1 1 -1 +55 1 -0.9464860706310958 -6.285996525353373 -4.30908825600282 -1 0 -1 +12 1 -1.856123326430506 -9.517447392023085 -2.3435724928975645 -1 0 2 +15 1 6.077305695814157 -8.166300444221115 0.7448836933119019 -1 0 -1 +64 1 2.7452944971646858 -10.558129575009149 -1.730050297615053 1 1 0 +44 1 8.116024736633927 -6.297043957734161 -3.618119081228304 -1 0 1 +188 1 9.990490631214506 -8.453825757862562 -0.7847723993749525 -1 0 0 +200 1 -9.371399961242005 -3.371895968187197 -5.193597997968697 -1 0 0 +198 1 -7.163187216472317 -1.1934858004192783 -2.2622400054633864 0 0 1 +76 1 -9.919958613706985 -3.040871792288106 -1.4149931903428534 1 0 0 +194 1 -6.743945843921815 -5.005230021567819 -2.613393963742155 0 1 -1 +68 1 -2.5671189668335317 -3.434435519320573 -6.1465461411366 0 1 1 +96 1 -3.430661147431614 -4.018545052073527 -2.021400662533695 -1 2 0 +91 1 2.9683873682514026 -6.254217834947031 -2.3589109971891737 1 -1 -1 +154 1 -0.2218228203315391 -2.902150057925404 -2.9725706529414366 -1 2 0 +19 1 3.2665435171804194 -1.9817522239515633 -2.3096363660640975 0 1 -1 +120 1 6.609146288179666 -2.2318382061287565 -2.808377349441308 1 1 1 +138 1 9.631227201052864 -4.547744518411388 -0.6709487904267171 -1 1 -1 +9 1 7.596887391638223 -2.0237588049028696 0.6051605861836649 0 0 1 +150 1 -10.044973671786467 2.0147581633676452 -1.3897952482345524 1 -1 1 +38 1 -5.7978106400822895 4.770632320137689 -4.758054319452569 1 0 2 +172 1 -9.658785222083136 4.026164557116778 -4.942402258050777 0 0 2 +152 1 11.431334273176418 -0.4623515239881826 -1.925450909701469 -2 -1 0 +29 1 -7.909238416570071 7.61624491229837 2.2042493522591258 1 -1 -1 +87 1 -3.3103551172038665 -0.94337019011639 -3.5930404382745955 0 -1 1 +93 1 -6.2863195662557 0.9404795536165196 -4.898675396085437 0 -1 1 +195 1 1.0245553543549981 0.20159488775043144 -3.679042462676364 1 -1 3 +149 1 -2.269526344184385 2.8074136653426387 -2.5814855370744945 1 0 0 +25 1 4.649154714287583 1.2394738761102164 -0.6186508337325307 -1 0 1 +35 1 2.8516234465534787 3.745844200453856 -3.7667964552544286 1 -1 0 +5 1 5.795606814798939 1.5285888723891716 -4.179888075744685 0 -1 -1 +116 1 6.001522247841404 5.755884373452364 -5.02433183427119 0 1 0 +112 1 4.844016623012077 5.465934695953432 -0.25432767294668557 -1 0 0 +132 1 8.53939720077536 1.8213558063438606 -1.3830903771567364 0 0 0 +173 1 9.062655610340409 3.8664027467280935 -5.47150892329001 0 0 1 +73 1 -9.979257287380412 7.98839910326609 -6.702836934882303 0 -2 1 +161 1 -11.50425364162053 7.022415057658153 -3.488322518144713 2 0 2 +78 1 -1.7469625877850241 10.184158454427994 -1.7648096425042503 1 -2 1 +11 1 4.444644958846757 11.851997915189173 -4.933412264679578 0 1 1 +84 1 2.459047681073617 7.373812748831801 -5.213139361825189 1 0 0 +90 1 6.1482860548874925 9.307626902509035 -0.9026751698054234 0 -1 1 +36 1 1.9695381713294537 7.78336838361963 -1.7729647147442544 2 -1 0 +98 1 8.527874795717773 7.612035599231426 -2.9325216125652 -1 0 0 +56 1 7.282783408448612 10.400831236794666 -6.728973679619628 -1 0 1 +109 1 9.156728968120607 11.308407539099598 -0.9040861597803378 -1 1 1 +115 1 -7.309621980156194 -8.117595813105002 2.8126740615279595 1 0 0 +124 1 -11.142069858043358 -8.82667541719755 4.10932707265772 1 0 -2 +121 1 -8.21003433895173 -10.089956822420406 6.660752548831763 0 1 -1 +80 1 -4.909425537698309 -7.256236799158399 -0.2747148144591023 0 0 1 +101 1 -4.312342956814611 -8.070113074572049 4.879741561255617 1 3 1 +4 1 1.5494925162428856 10.03102296069128 4.602107842780676 -1 -1 -1 +81 1 7.27113702294054 -8.472013640467047 6.625505444757195 -1 1 1 +6 1 8.885736885591768 -10.557271403060728 2.7878338185404203 1 1 0 +166 1 -8.69650192512206 -5.07362796560642 4.236148217669305 0 2 0 +40 1 -6.987849762900474 -4.511534637942379 1.3175075163680883 1 1 0 +127 1 -5.689629608203652 -2.3907227510814337 3.9463589292537864 0 -1 0 +104 1 -0.4397363632556015 -0.6165598923688651 -0.3313279093278112 -1 0 -1 +151 1 0.4300685018079994 -6.441488457556783 0.38045612640805615 0 1 2 +60 1 -2.3217820522915846 -2.1704723730197557 5.333166404467865 0 1 0 +168 1 3.9149834819211655 -3.3791911515481985 0.7567189672094479 -1 1 -1 +51 1 0.398133835057336 -3.3931578730294385 3.016370538231655 0 0 -1 +97 1 2.1573351041413034 -0.0855884286300217 2.2286851783702524 0 -1 -1 +103 1 3.9664988893980713 -1.064731427067052 6.037166605284854 -1 2 0 +163 1 -10.709566329240587 -2.7332402144894417 2.2660820588417665 0 -1 0 +175 1 5.762755562271241 -3.3856559659466114 4.002375112428048 -1 1 0 +158 1 8.862173003831924 -6.538751027751994 2.8769202677556542 -1 0 -1 +85 1 10.229250850148503 -0.01502947727190853 5.300096059690905 1 0 1 +63 1 -8.263417127255543 -0.18022873161562153 1.17510825734459 -1 0 1 +133 1 -10.480766232506394 2.392923584409271 3.720879727063737 1 1 0 +67 1 -6.544234163722191 3.501038541004621 3.191437971422375 1 0 0 +83 1 -3.849802400718045 0.6646468573486004 2.7446055069817703 0 -2 1 +162 1 0.6098193007635196 -0.05324811248282152 6.154363200071202 0 0 0 +170 1 -2.6786368359767714 4.255168732248176 6.435570102352074 -1 1 -2 +181 1 -5.252793067773865 0.7761154003139943 5.79909696611136 -1 1 -1 +71 1 1.6452911952303246 4.06622820161267 -0.5166203216146883 0 -1 -1 +31 1 1.0738987741436463 4.15303788757344 6.141061091921109 0 -2 0 +139 1 3.8104659718300624 3.693576878280304 3.384062081506274 -1 2 0 +3 1 10.9858871588246 1.2545617976234098 0.8570931258327192 0 -1 1 +108 1 6.174388178357244 0.8538858651722911 3.6472942727893374 1 1 0 +16 1 8.97282237909764 3.5943899325206274 4.02632096928566 0 -2 1 +110 1 -11.336507152318017 5.947474598331584 3.14037651741927 0 0 -2 +50 1 -7.046202899905131 11.083294806174674 4.036430331092051 0 0 0 +191 1 -8.508890702823583 6.994301261898876 5.5988324620755945 1 -1 0 +187 1 -10.749519222803974 11.280267500561628 5.071750333310352 1 1 0 +180 1 -1.0032349913124285 6.140237973021502 -1.7436540397788036 1 -1 2 +2 1 -1.7946548786825645 5.404613901091388 2.68002365908378 1 -2 -1 +30 1 -0.6282593143948212 8.881746166196663 1.2420280890418454 1 -2 -1 +17 1 -1.9971151666590217 8.252473054961822 5.30244560397972 -2 0 -1 +7 1 4.0488432159812255 8.81693522673231 1.6114995620401231 -1 0 1 +164 1 1.873438403508949 6.222826359057496 2.2533705281578316 -1 0 0 +69 1 4.6051775335846745 6.921132428828564 5.128620799236167 0 -2 -1 +61 1 10.268176907196304 5.08172043450454 -0.642274843845057 -1 -2 0 +34 1 7.601946368008498 9.256904252690223 2.406585955238384 0 0 -1 +43 1 7.165450199452092 6.0290506218302085 2.4419163969738023 -1 -2 1 +177 1 8.561622776612461 7.244917835893727 5.602147565752702 -1 1 -1 +179 1 11.750057623239174 -11.228395927014766 -10.487778908482419 -1 3 2 +27 1 -10.974224751020245 -11.635298968202441 8.509409995684443 1 1 1 +58 1 -9.692847117546727 -6.99702076150861 8.089242933510139 -1 0 -1 +32 1 -6.165044846878473 -5.3531372054847 6.419358142287187 2 1 -2 +26 1 -5.15775210282499 -8.509724647787523 9.35521475378418 1 0 0 +142 1 -2.2394120995772013 -6.757001235575803 8.53817557952535 2 1 0 +100 1 -1.562747759528225 -10.930435349230905 6.862796976881519 1 2 0 +184 1 7.329483236732028 -7.477553906204161 -11.457403276020457 0 1 2 +105 1 1.3124523565691075 -7.852976862538032 4.005035595809602 0 0 -1 +75 1 4.597924698307231 -6.283694211187047 5.476806400599068 0 -1 0 +99 1 1.716773073271929 -10.998458790026556 10.715096401091909 0 0 0 +193 1 2.1325154242736666 -6.931854968739277 9.419307764840358 1 1 -1 +33 1 4.48712925680286 -11.671378658171115 7.267170381111049 0 -1 0 +79 1 8.573107089496888 11.611228502272368 5.983087465760138 -1 0 0 +92 1 9.81601068917706 -9.527916362770739 11.159627680682005 0 2 -1 +165 1 -9.2113400341349 -3.219195257680457 7.288219778779848 0 0 0 +199 1 -6.931272020823427 -5.000130571946396 9.88597891452116 0 -1 1 +70 1 -5.507541862888313 -2.393142934597723 7.807143673901248 0 1 1 +146 1 -1.4771503758916822 -0.5410305896302106 11.279923136114263 2 1 1 +106 1 -1.3651808664767915 -2.54616781259121 8.590647351661577 0 0 -1 +52 1 0.6779843498698166 -3.7311606456725768 11.453754175953545 0 0 0 +86 1 5.4031998049641565 -4.549788149287394 8.596350093940629 -1 0 1 +197 1 1.573548668834416 -4.687213943022477 7.1278633337641 -1 0 -1 +185 1 2.1532991864501554 -0.6046775517606129 10.000779301772766 -2 1 -2 +190 1 7.401787297285096 -0.2505978640044338 9.870584022136198 0 0 -1 +145 1 7.111702440333872 -3.6540730490844453 -11.814469255040187 -1 -2 0 +131 1 11.130905707249603 -5.281990426153451 6.209567942496238 1 0 0 +156 1 -5.482768650143603 -0.4312680407464029 11.466238929392272 0 -1 -1 +10 1 -9.053182404201642 -0.711645217691651 4.8230146575990815 0 0 2 +196 1 -9.337441409320208 0.1609718702750058 8.663781619737854 1 2 1 +143 1 -7.17068301465806 3.0756929715249197 8.74321294778271 1 0 0 +13 1 -11.784452395762827 3.289072175663378 7.001527553636599 -1 -1 1 +59 1 -3.4378714190696336 1.7721863061771366 9.36771463550879 1 -1 1 +186 1 0.1662370132365254 2.5243181917810595 9.709168312215267 1 1 0 +136 1 3.4094152339708126 2.153729603693705 8.008621315534214 0 -1 -3 +192 1 10.489678729236587 2.4935818679754185 9.842929691077494 1 1 1 +113 1 7.1536296108923345 2.1797090477435894 6.8304033834765505 -1 -1 -1 +62 1 3.9169396613561496 6.861682724751661 8.976027690230366 1 0 0 +74 1 -8.118378807759774 9.793902614888827 8.932362315849124 1 -1 0 +118 1 -11.58583737453999 8.536873240765573 7.014861349235567 0 1 0 +117 1 -5.277108589074334 11.352800033973235 7.597327201748058 -1 -1 0 +23 1 -5.157626384085098 5.75340956696832 11.215724105856438 0 0 -2 +171 1 -4.306475221375887 7.1666374724202555 7.827635610104089 0 2 -2 +94 1 0.5173001347371304 9.700900025717369 9.033047100941438 -1 0 0 +41 1 5.490142462338115 11.510392579949611 11.613725539319557 0 0 -1 +141 1 9.87566572043054 5.774221219191659 9.0665289512053 1 -1 -1 +159 1 9.686865955901812 9.753371327924555 9.75057962979839 0 -1 0 + +Velocities + +39 -1.9399818993193945 -6.2245952285602995 3.5338548174142916 +57 1.5287860491005811 -2.72214429330134 2.2456706435699694 +82 4.011405667244886 1.5297461738282854 -0.00848199347765205 +65 -8.99687886174914 -3.5904944014362874 -0.24257004026483364 +8 1.3456043077490425 -2.128460026427474 0.5438548397418695 +49 3.9804563992312922 -6.033137289721198 -2.4992971438276896 +54 -0.8797092038138496 -4.4441361344158485 -1.158307352101043 +102 -1.6073661483672754 -6.3013772766305705 -0.8971841583061024 +114 4.952776653242985 1.9508143607180544 -4.637659613505405 +128 -1.269058654850369 2.9109256516813193 0.4053666332013952 +157 -1.0484348115580815 1.3302695757858152 -2.3230656835483483 +20 1.6286859684439459 0.8384182438479687 3.337320080806048 +147 1.7009416069818912 -1.6078420463299883 0.41513271531119245 +169 4.488200687237288 -6.490934602483694 0.13987631822178037 +123 -2.8913963004993426 7.445402407235762 -0.2708525381058624 +130 -1.3405859620177862 1.4399831113332697 0.048073865645907876 +140 5.071347652434061 -0.6702612789643095 4.605780995472893 +153 -3.7972143859475698 -0.514917067426214 -4.9181301157390225 +129 -0.524987732421045 -3.209340969084892 2.932495986872108 +148 -5.447057077277419 -1.4060679681657386 -5.483184347880067 +119 -2.5629223421862375 1.3882127095818109 2.83591016397441 +134 -1.3621064953428361 4.288456433365155 -1.6190478694645496 +174 1.7758446648889914 4.86331991854285 1.1265592480566544 +189 -2.1997618638118066 -5.481413979755256 -1.086026577758521 +28 0.47277982211285713 -2.417172577737755 -1.932990476216946 +1 0.6703800334847378 0.767366418061703 0.19201532965448842 +24 0.04297238333671294 5.144308305848863 0.078997482901074 +176 0.4965479246937361 -0.13321844730810892 -0.13420426694661658 +182 -0.03943631525057928 -0.4576897656157408 5.202139202652978 +137 3.3038160138315282 -2.8142339694373977 5.5902387847740025 +89 -0.7210799083306686 1.5890809944259632 -0.7203455040724582 +88 1.0693506358892855 0.004219772825099388 -0.34637529725335453 +160 2.818428049318086 3.2244292228167537 -4.494216600884747 +125 0.42818621594139183 3.1889923789665167 -0.2889418149701054 +167 -1.634028108672504 2.274964875925839 -2.5010575325085713 +107 -2.275260397982265 0.40965124117591156 3.7368455922538386 +45 -0.7001662440449031 1.119455401379465 0.23148546097076927 +95 5.262372995855103 -2.4350400461030928 4.204427583146448 +111 -2.8606969082837232 -2.7980553847036016 -5.595977877258418 +37 -2.2899225677006445 -0.8948602257995134 -0.4803200724258121 +53 3.002131309420766 2.6120771462261168 -0.9952903525863226 +122 0.8674217257039606 -7.734997952666523 0.833404061351757 +126 -1.1420613062006533 -4.550118096866477 -4.2790463933780245 +72 -1.8516741228057083 5.947761028964626 1.6102399224289305 +144 -1.1917460086100382 5.214371411898472 2.577241700331775 +135 -0.6560595442322588 -5.810339924107932 -4.318267593309593 +183 -10.386809746296331 1.1897898885572993 3.451816626760367 +155 -5.162635743080924 -0.24765733386766664 -0.9110712844247615 +21 -4.2563878171076155 -3.402344841498928 -6.759865341543254 +66 3.892260841699981 -3.872668437572034 -0.3337143786545691 +42 0.4166666127989469 6.100606589949791 -1.4397576055696024 +22 0.3608663266598049 -0.6522614903150212 1.896193166731318 +47 -5.327073086748509 -3.490472671050769 -0.07383525372930849 +77 -0.978728222397191 3.4020107799172736 1.0077489411757843 +18 -0.4650542307772494 2.9718359172432747 1.4633800163719572 +46 -3.027050149464662 4.17167624743228 -1.827230734431756 +14 -0.09677720578549692 -2.7193038262530447 1.7914199983541117 +178 3.696002315695369 1.6876713658009856 -4.672832052845037 +48 3.983692149992739 -1.1833239408832328 -4.299433489091069 +55 1.4078039475385906 2.056934505867413 3.7406982539078393 +12 -6.525348764219679 3.3122244911450394 2.6197769407714624 +15 -3.3141834562011994 0.5054069138851847 -2.97725365266652 +64 -7.771910612976191 -4.581106933347833 -0.41638292972909086 +44 1.6412238745050067 -1.8908109366759165 -0.06612343065785803 +188 -3.5844091539515395 1.8268122826497 -0.2374993089904055 +200 7.894813073634868 0.057995156825788374 -2.5771892403060033 +198 2.1286980919165597 1.0207578884216715 -2.002608806720997 +76 -4.082585877193767 -3.634723448931757 0.6497689857802457 +194 -5.141422516595061 -5.385767090831518 4.1044833771883145 +68 -1.3677719930905985 1.0604606148180302 -1.7254671966550923 +96 -2.592687583785919 -0.5546395167068001 0.38605262002135754 +91 -4.294011884932044 -4.480411411848511 4.543287343202344 +154 1.815487275814105 -0.07008532516876564 -4.441392134697374 +19 -0.24976249513756998 1.579721447829149 -1.7421975373515703 +120 1.804118819372854 0.520165481785893 -0.866356354838586 +138 0.7160603181741005 -3.5316114730742316 2.8815518324723897 +9 -4.1756988875943195 2.0672991466342374 -0.8825046873416664 +150 1.815083623557248 2.773051884794719 1.9746918971798604 +38 -1.502458122060807 2.504120522003904 3.5630087040476006 +172 2.925371783317832 -4.008067088721308 2.95272814084428 +152 -4.6300230395213555 -1.2429914909034638 -3.848634119515747 +29 2.326120452340355 2.730479927388889 -4.850062460498464 +87 -3.7757652246448092 -2.144244861787354 1.0169754355289107 +93 -2.0873983214067384 0.5358760575940038 -0.23325341995082138 +195 -1.4168233936677792 2.3959259540484603 -2.0506018284590537 +149 2.2841089396850274 0.26447423100144896 -0.8987301521306412 +25 2.8990369033774663 3.4475964151025584 0.06622887609588958 +35 -3.439056984685437 3.8288190767067634 0.5330155111995796 +5 1.1832213107046619 -0.3877998693431248 -1.369194610956917 +116 -2.0849829431786198 -1.7654561629509715 0.6633937705540919 +112 -0.5822227923488573 0.3013831835536517 -4.31387983328802 +132 -4.968232076425547 -0.6461873308157724 3.153818258163696 +173 -2.606365772909947 -3.929167709306097 -2.1504295970222675 +73 1.5595598163445097 -0.6161933298135185 6.6258235518245785 +161 5.1614226588847085 4.911303681383577 3.193451794720913 +78 2.399770604666089 -1.7368694007148553 3.13840955491289 +11 -0.1723279344217883 3.2117525787482495 -5.003125430736541 +84 -3.0246026160032238 -0.10349126829912314 -2.244471367403812 +90 2.2752472907587027 0.5192129247104318 1.739661062051631 +36 3.3131943405122586 -4.945706489020841 0.7304326039438429 +98 2.222390966846857 2.076728811998776 2.745752031197498 +56 3.2308827790046997 2.20226369176158 -0.16256864643069302 +109 -5.432919034165497 -0.6507653252627013 -2.288197504123378 +115 3.2470353212929526 -7.326498442980268 2.0848162375252226 +124 3.23326108206676 -1.3727946801269606 -2.040624527813595 +121 4.263689866797482 2.7161360736926117 -0.9353436003014414 +80 -3.183923910858363 -1.409115057483441 0.20655585479413852 +101 1.8647413072811272 -5.138741167769708 1.449442652238715 +4 -4.059920467104848 2.021712460074869 4.0296908872357 +81 -1.4496413113665318 0.22275997734715647 1.0204012050853233 +6 -2.5319674910604797 2.921972066778776 -0.5937144564354684 +166 -1.7032554189048639 0.4271452228969883 -3.929596648952609 +40 -3.2997667945300786 1.7569019147151133 0.9556994202850172 +127 -4.094479436855724 1.004173845399162 -0.957686162248562 +104 5.839775077994146 0.5614942472461542 1.3388300846640222 +151 0.03681474392662332 4.158212179208171 3.087410074045597 +60 -0.5753595098363337 -1.944185172990125 -8.542198180005448 +168 1.356831683366837 -2.3643099268420564 3.337777267437989 +51 0.594767745409305 2.5443394223058013 -0.5744844027146594 +97 -1.4592614460552826 -2.9896997140291077 4.468909988652328 +103 -1.7464552873436274 -2.725030040682925 -4.682984068370838 +163 -1.6811327453491027 1.203374785043913 -2.52756154734346 +175 -2.36073693749339 -3.2083472883959288 -2.522379591971816 +158 2.0901462213047384 -0.8790568223757592 2.862349710125339 +85 1.6955544698562546 1.329401432748634 1.339424168209504 +63 -0.9387866016534254 -4.101481886236126 2.5768942521591023 +133 -3.3950934863801323 -1.1853227351766746 -0.8938618367927571 +67 -4.93636647331341 -5.808321017441839 -1.5826220082758682 +83 -4.348910184667013 0.5721399223517865 -0.7197270365001088 +162 1.9809720767805532 -3.8356819219002203 -1.5209517397218844 +170 -4.1339290337428345 5.621618700525048 -1.5836709740423311 +181 1.1838126543084162 -1.2107904166348504 5.997389392830687 +71 -3.6322706258882382 0.4573448065249036 -3.4819929402094774 +31 1.5672965345476493 -2.5171072174405418 -5.016079150444441 +139 2.347944365043533 5.087068349207903 -1.4373175728413294 +3 -0.6897541703497496 -5.2109972760726215 -3.1967261285849102 +108 2.1632029794076 -2.3278780023196486 -2.2165896316468543 +16 0.5518752214748219 1.7443113317844785 -0.3914314868799459 +110 0.6545696772446776 -2.3972319991341955 4.869786319607602 +50 3.4589447101316337 -3.631848006300771 3.113137145447494 +191 -1.2968299225913498 0.4433703369757638 -1.5568387599668925 +187 1.9322905031758904 1.7630376183510783 -1.713007037692872 +180 6.8380544057940424 1.3883512491464782 2.155270210489675 +2 -0.9447291546303294 -0.0513923732527517 -3.0672808505869886 +30 1.6158645533289293 3.1155851081317145 -2.1710811001472363 +17 -1.543787339459575 3.1374805002054007 -4.413979305864849 +7 4.040936876599553 1.9639386370487468 3.3637852508743804 +164 1.4392327984967968 -0.8254697339648331 -0.33613984139186426 +69 4.683013019846548 -1.4001774602376138 2.7483283024733463 +61 4.859801586904617 0.3945575299928299 -0.36030106753723035 +34 2.144274218554215 0.30058665232035375 1.6815154302941946 +43 -2.262284846661947 -1.933549681130589 -1.7228919249476684 +177 -0.04379017544723046 -3.0489629385721146 0.8031465712034731 +179 0.1618165357299699 -0.15566873489305255 -1.156913000807537 +27 2.280685460437968 0.25990101487970774 2.9095092475822724 +58 -0.6292223334449243 -1.0309616093739953 -3.156937935356546 +32 -0.011281818866179849 -0.9102886141888968 3.1492471714773824 +26 0.3704942133027209 -1.9855236287495084 -1.1813125622083982 +142 -1.0547774115337973 9.781673444693524 -0.5474605098370294 +100 -2.466739505935093 -2.401234723424822 -0.9166143227115303 +184 0.998183931841219 0.5555844351868584 -0.24866844568146534 +105 -0.9091746414938665 -0.6852682268807229 -0.5049408850325867 +75 -1.2458876998256998 -3.70960636595479 -1.979594195572476 +99 4.943544682867021 -2.8438984768476887 -2.114165836507449 +193 1.6648153391738203 1.9396654116178769 -2.563892949279256 +33 -1.6878161438450656 0.40927910646954185 0.5582734801758544 +79 -3.538909021595642 3.805204310016289 2.7765516255860625 +92 -2.394452859130453 -1.9459314788883335 -4.8163793839903395 +165 5.545976326258468 -1.4902648191681507 -2.852217343260048 +199 6.057154285340822 -2.785333961235231 -3.9368802597200943 +70 4.428171740986177 -4.8728670167946255 3.9631873121213563 +146 3.789706894596731 -0.4960046634434 2.7214958472715947 +106 -0.23074985036276763 -8.713636612175375 4.005748004431039 +52 -0.7237533363087905 4.119548929665377 -2.8963629157006965 +86 -0.7790443173139772 8.632440811261022 1.3650149071424797 +197 1.0158635207501077 -0.6540677867631334 -1.9286092656946883 +185 0.14103906323580015 -1.9230099439242179 -2.9613897973588497 +190 -6.016428738140042 -1.2480913921594763 3.6835279433237065 +145 2.079579027486713 7.671127892348986 -1.2249224435341195 +131 -0.32590310182334836 -2.4757135143210527 -1.108006743304219 +156 1.5441602101522276 -4.3012365664752 2.152192470473115 +10 -1.9251615561320725 7.7941703098856605 1.152489777841718 +196 -2.5417164626144206 -2.322970333327737 6.382288207464665 +143 1.1146704068320736 2.2068798409995507 4.003296941736723 +13 0.2218873541633033 2.002339450538451 -3.9278426768807844 +59 -1.1249725039613747 -1.38236183692768 0.6273981188606278 +186 0.17954184943335427 -2.3932954696372053 -0.7313011465358523 +136 -0.6086309213506338 3.5713339511273894 -3.8080329205654193 +192 -2.4502215368224705 -4.545932925209442 -1.62934516857554 +113 -3.3214500416678074 4.555014566016373 7.353766374710929 +62 -4.358088896189819 -5.982496403026446 2.5501878477362316 +74 -0.5539329584507672 2.794170243271062 -2.161412931865338 +118 -1.979611801168517 3.0336891371182197 1.2515672466968413 +117 -2.6346443065380387 -6.52420382221947 -2.3221165776786097 +23 6.421824321311546 1.7253174765287 -9.160076509970361 +171 2.1156964930224973 3.568443790163169 -3.4488134770961105 +94 2.1701428589622624 4.886850980047828 3.260178593455835 +41 6.033712104492915 2.2785562972718627 -1.4849735175385876 +141 1.4706522295431979 -1.8195923066965298 0.019053288005804775 +159 -4.554564437682667 0.05936456417819991 -1.932073129933284 diff --git a/examples/PACKAGES/pimd/lj/data.metalnpt03 b/examples/PACKAGES/pimd/lj/data.metalnpt03 new file mode 100644 index 0000000000..ca36561e7a --- /dev/null +++ b/examples/PACKAGES/pimd/lj/data.metalnpt03 @@ -0,0 +1,422 @@ +LAMMPS data file via write_data, version 8 Feb 2023, timestep = 100000 + +200 atoms +1 atom types + +-11.876696863105703 11.876696863105703 xlo xhi +-11.876696863105703 11.876696863105703 ylo yhi +-11.876696863105703 11.876696863105703 zlo zhi + +Masses + +1 39.948 + +Pair Coeffs # lj/cut + +1 0.00965188 3.4 + +Atoms # atomic + +39 1 -10.394704135733114 -8.775565826160808 -8.397941096758792 0 -1 1 +57 1 -6.0931281896189695 -9.344348749599556 -7.681818125657076 1 0 0 +82 1 -7.510250310452092 -7.015516388660279 -10.07082880494168 0 0 0 +47 1 -8.77559664157391 -8.051556457641034 -5.414795391990417 1 2 1 +8 1 -7.186535453159322 -11.036850971616609 -10.567777816088821 0 1 1 +49 1 -0.39620530191825165 -8.622783800666731 -7.678166749572666 0 1 0 +184 1 7.393521813917142 -7.373039726272342 -11.446331826056564 0 1 2 +54 1 4.350458272629415 -9.857224313433228 -9.653286924521744 0 -1 1 +114 1 3.8685603455186985 -8.598956542283156 -6.307174409208557 -1 0 1 +128 1 1.5947628847115236 11.435941489344966 -7.415359628481937 0 0 -2 +102 1 2.581923114006006 -6.377657392511939 -10.762619336954629 1 -1 -1 +157 1 6.660414728640671 -6.277919775804619 -7.429265669038422 -1 0 1 +20 1 8.111607396483045 -11.231970200759829 -9.923403990974927 0 1 0 +147 1 10.627447337694411 -5.758860591417452 -9.410039814850826 -1 2 0 +169 1 9.360516562348877 -8.959647419481891 -6.858134439225374 0 1 1 +123 1 -6.81574278381186 -3.257465879140419 -10.90227212401971 -1 0 -1 +182 1 -10.83184823295899 0.6211210726593173 -5.225302920513499 0 1 -1 +130 1 -6.48675645240678 -2.4960330140097717 -7.149887944428669 -1 1 0 +140 1 -9.06689925915267 -1.3404094442689392 -9.265230651366284 -1 1 0 +153 1 -4.596115154274846 -5.2269288210583476 -8.762725686367764 0 1 0 +129 1 -0.18023204267520931 -5.069487595679249 -8.563855383994511 0 1 1 +148 1 -3.129776386379185 -2.132302209017619 -9.812957672584432 0 0 0 +68 1 -2.5326692981381176 -3.433323674590902 -6.08354364753642 0 1 1 +119 1 -3.563878018222407 -3.8548716132518166 10.583657201237452 0 -1 -1 +174 1 3.1103832548223167 -1.970524067942005 -10.720839500990373 -1 1 -1 +134 1 -0.0533798609747933 -0.3943397369034881 -8.568909963478589 -1 0 2 +189 1 2.8780134490012608 -1.3406833227009611 -6.386852522463116 0 0 2 +28 1 6.229563951867086 -1.1530156323854972 -9.327046250788925 0 0 -1 +1 1 7.525938759972945 -2.8198310481116913 -6.5604190503711814 1 -1 0 +24 1 10.94065283830757 -2.1209886921600436 -8.153560298060441 0 -1 1 +89 1 -5.78369558828959 0.914992281244533 -8.554571507812774 0 0 -1 +137 1 -8.18813666088715 3.7027977864495334 -8.645965827566897 -1 1 0 +88 1 -3.2799196205792844 2.576742862817614 -11.027465080959736 0 1 -1 +160 1 -0.2557418723462786 5.44151330793023 -5.976638045093324 0 0 1 +125 1 -3.2953557120100467 3.5116994482831103 -7.1553118740511215 0 1 0 +167 1 2.6725243652102173 2.638087495697569 -7.466301426847419 0 1 0 +107 1 2.5245946528561056 1.4391466346789628 -11.24156229950114 -1 1 1 +45 1 -0.29130191021650537 3.390022307884845 -9.780519849519312 0 1 0 +95 1 7.067732497970006 1.8275651232311958 -11.06782765028197 0 2 -1 +111 1 11.286054617943643 1.4415120259015062 -8.377487796984207 0 1 1 +37 1 7.567677172981714 1.512274859816151 -7.66702414977977 1 0 2 +53 1 9.41684489904846 5.317555173980882 -10.149115122842298 -1 -1 1 +122 1 -8.696560905496263 11.52907921791907 -7.072120720309414 2 -1 -1 +126 1 -8.701961655974642 9.131336810565264 -10.209192118557077 0 0 -1 +72 1 -11.181614439635823 7.328242947804642 10.873052780217858 2 0 0 +144 1 -3.063630044241759 -9.888584626042347 -9.88620302733954 0 1 1 +135 1 -0.011770197460421628 7.809248750526247 -8.433472830923051 1 0 0 +183 1 2.868185059788288 5.159526867067117 -10.074475497261854 0 0 0 +155 1 3.7046375990422384 9.18029420434672 -9.355401725486303 0 0 0 +21 1 6.6545915304717695 6.763201059850044 -8.264144019598284 1 0 0 +66 1 9.504750400993288 7.515486524178964 -6.171582593350192 -2 -1 0 +22 1 11.084351988266622 10.76412261505721 -6.106373064516015 -1 0 0 +42 1 9.142378798766934 9.296638377937079 -10.23790547780751 -1 1 0 +77 1 -6.875408369074396 -10.905367618463075 -3.8927601705390593 1 -1 1 +18 1 -10.586419483635158 -11.318597225412478 -3.865523315987396 1 0 -1 +46 1 11.248362092754824 -7.711534097612761 -3.9950725578324935 1 0 -2 +14 1 -9.503351845338017 -7.486629728113749 -2.029636008930268 -1 0 2 +178 1 -4.577490558383545 -8.077630279121967 -4.852591089043882 2 1 0 +48 1 -3.2127534742600403 -10.982725180284804 -6.34369805529311 1 1 -1 +55 1 -0.9448027936788463 -6.214616210957371 -4.309013304243614 -1 0 -1 +12 1 -1.8077376902517912 -9.51331251139922 -2.294135008818479 -1 0 2 +15 1 6.0707891099498035 -8.158735340051752 0.7389132882736256 -1 0 -1 +64 1 2.744794419170617 -10.568743032836894 -1.6560300803721786 1 1 0 +44 1 8.059994426810258 -6.349491556263628 -3.6188994660194567 -1 0 1 +188 1 10.007211181841205 -8.471311544163584 -0.7301030264655086 -1 0 0 +200 1 -9.361429934020506 -3.325582783501604 -5.251291205351098 -1 0 0 +198 1 -7.206783651218934 -1.1768543952383812 -2.2878728904921033 0 0 1 +76 1 -9.957900853453992 -2.990392708748729 -1.4836790089375538 1 0 0 +194 1 -6.720915931526202 -5.0514840317136205 -2.6178060083265535 0 1 -1 +96 1 -3.442998842345119 -4.030752937282784 -2.1099501345166054 -1 2 0 +104 1 -0.4344464897733502 -0.6370527730950448 -0.3065766310174318 -1 0 -1 +91 1 3.028414651691776 -6.371562707358944 -2.3012007885342207 1 -1 -1 +154 1 -0.18450456920986724 -2.8959245063427446 -2.9727341046372144 -1 2 0 +19 1 3.3110202139376677 -2.0069344123928587 -2.3036519362171575 0 1 -1 +176 1 10.315295502792623 -3.712962672865248 -4.262743726209571 0 0 0 +120 1 6.599910778171431 -2.290014983742207 -2.708516274908039 1 1 1 +138 1 9.70090444039391 -4.510671194156078 -0.7586380570561282 -1 1 -1 +9 1 7.581463530555666 -2.0591591013924426 0.5576192070111965 0 0 1 +150 1 -9.916366847902271 1.9274446583917424 -1.3280546499490278 1 -1 1 +38 1 -5.810864806174543 4.79569434382538 -4.7432663890343605 1 0 2 +172 1 -9.649044476681059 4.000883539130775 -4.9787866594630685 0 0 2 +87 1 -3.293106763914671 -0.9728697280200684 -3.5717383721780784 0 -1 1 +93 1 -6.290260113883048 1.000513447709075 -4.873943848533926 0 -1 1 +195 1 0.9143548729177553 0.18149461265281985 -3.719891858874817 1 -1 3 +149 1 -2.3007300445292564 2.7637958268752776 -2.589523265551314 1 0 0 +25 1 4.621842262318463 1.3043820546828728 -0.6225207492747167 -1 0 1 +35 1 2.847846769015831 3.7484794005209174 -3.7317005078406185 1 -1 0 +5 1 5.76859301522971 1.4821693744986142 -4.192625078793096 0 -1 -1 +116 1 5.980108401532309 5.771931805152196 -4.952107221267599 0 1 0 +112 1 4.9004069037624305 5.449030478588363 -0.25381811981375635 -1 0 0 +152 1 11.427575396440815 -0.5215078327180223 -1.9270850902641319 -2 -1 0 +132 1 8.550991064218966 1.8728424902700131 -1.3413841671493485 0 0 0 +173 1 8.98824885831321 3.8266779448060135 -5.54469830676447 0 0 1 +73 1 -9.970827412932536 8.006037772956901 -6.707069562638264 0 -2 1 +29 1 -7.851850658958549 7.656691482687513 2.2522623824361467 1 -1 -1 +161 1 -11.447924236091708 7.060851422709438 -3.5858559166646984 2 0 2 +78 1 -1.7537678607411138 10.085056705494843 -1.7540835643783588 1 -2 1 +11 1 4.471756401488951 11.779896969440827 -4.946674669424063 0 1 1 +84 1 2.43612195340992 7.404092397911457 -5.290554303714214 1 0 0 +90 1 6.2047805444381146 9.344776673352051 -0.9025295949725489 0 -1 1 +36 1 1.9413202066882462 7.760257880084115 -1.7928253633196454 2 -1 0 +98 1 8.489759189718113 7.59448375625753 -2.9903904190005255 -1 0 0 +56 1 7.283347233840352 10.49272575590101 -6.717344837699539 -1 0 1 +109 1 9.256731562506227 11.306927316729052 -0.9017849515922478 -1 1 1 +115 1 -7.271375340356332 -8.164250984794014 2.885007836656445 1 0 0 +124 1 -11.095529268087242 -8.923461918340646 4.126541576799873 1 0 -2 +121 1 -8.243366755262961 -10.114098944495577 6.642910506934619 0 1 -1 +80 1 -4.970941376701066 -7.256796443574398 -0.2694927115936565 0 0 1 +151 1 0.35720010482862147 -6.473326344145772 0.3145914251441795 0 1 2 +4 1 1.490868001691105 10.008505441456391 4.6538607757363515 -1 -1 -1 +6 1 9.00182583692019 -10.573496261667716 2.7405792887239087 1 1 0 +166 1 -8.709149836110669 -5.121301291304988 4.221356992297617 0 2 0 +40 1 -6.986302058442625 -4.546619094873101 1.2165687777692458 1 1 0 +127 1 -5.703890672733537 -2.4808733861641947 3.9258140668162143 0 -1 0 +60 1 -2.3900969955392997 -2.1240248283806444 5.301270425252238 0 1 0 +168 1 3.975110510651529 -3.4413029165097235 0.7867580630241555 -1 1 -1 +51 1 0.36128571956442473 -3.39012855469405 2.9987895355425387 0 0 -1 +97 1 2.1619059504545017 -0.14370659092792337 2.253550136735452 0 -1 -1 +103 1 4.021656515073349 -0.9827338117732367 6.042568640726292 -1 2 0 +163 1 -10.59690034092717 -2.73669268553396 2.3250010477277816 0 -1 0 +175 1 5.789631011184049 -3.417672117461432 3.9954654049476215 -1 1 0 +158 1 8.907482269205014 -6.491283319059688 2.9624073267859536 -1 0 -1 +85 1 10.197413661591135 -0.012917762754849087 5.257965818060175 1 0 1 +63 1 -8.188715623008076 -0.18029853692280418 1.160315648952679 -1 0 1 +133 1 -10.49518128239182 2.3754251515033395 3.670523930057962 1 1 0 +67 1 -6.57681506296786 3.490338685255813 3.2777499682226248 1 0 0 +83 1 -3.8395282904771557 0.6878472661538524 2.789698047147944 0 -2 1 +181 1 -5.242185082676098 0.757446996867543 5.798435988392239 -1 1 -1 +162 1 0.5730435311953745 0.02538554697642809 6.131446692962922 0 0 0 +71 1 1.5861291557437986 4.031923436354859 -0.5668685974116876 0 -1 -1 +31 1 1.1084648099889496 4.166735507593387 6.199029350547128 0 -2 0 +139 1 3.8934885611865404 3.644680090821751 3.3699758952172827 -1 2 0 +3 1 11.031167120250961 1.2297818113295769 0.8240448962619134 0 -1 1 +108 1 6.151774132335838 0.9127260755469919 3.630865862972541 1 1 0 +16 1 8.948393568215273 3.5697656211117277 4.019424538349256 0 -2 1 +110 1 -11.360902504880006 5.931262380786016 3.1386340545012104 0 0 -2 +50 1 -7.03855700568745 11.1587737863648 4.038018652970141 0 0 0 +191 1 -8.539592833531575 6.98957805034221 5.576163396973422 1 -1 0 +187 1 -10.749591400235348 11.27674482179097 5.078753839959464 1 1 0 +180 1 -1.0497509784332344 6.113751500784257 -1.8125940782158025 1 -1 2 +2 1 -1.7901048404834796 5.395364205758469 2.706946913090345 1 -2 -1 +30 1 -0.609763114135145 8.866708941315338 1.2567907242718874 1 -2 -1 +7 1 4.024360795442131 8.792731325824677 1.6316831819568236 -1 0 1 +164 1 1.9253904296798758 6.2539753963352425 2.2732172727821673 -1 0 0 +69 1 4.589943704480154 6.860175335740237 5.107742575629615 0 -2 -1 +61 1 10.211708813407666 5.048929362482134 -0.6556133826774401 -1 -2 0 +34 1 7.618123086186067 9.260791062852595 2.410253158978456 0 0 -1 +43 1 7.187831963553112 6.047643259558733 2.377231426556367 -1 -2 1 +177 1 8.53679514766192 7.2855280107021585 5.618179930120522 -1 1 -1 +65 1 -10.025744517789033 -8.43398132011017 11.42484399314975 0 -1 -1 +27 1 -10.94664003963282 -11.66367183635281 8.50586002909509 1 1 1 +58 1 -9.736423247717525 -6.9374057905213675 8.120131077653108 -1 0 -1 +26 1 -5.214988898132063 -8.488979255655 9.322140672840906 1 0 0 +142 1 -2.2289627568453696 -6.732212289220556 8.533930418433167 2 1 0 +101 1 -4.332868168974628 -8.046497536008985 4.908195000324994 1 3 1 +100 1 -1.5781140115056829 -10.89378955359733 6.845196027213777 1 2 0 +105 1 1.348709072973532 -7.840212526420486 3.935309569976617 0 0 -1 +75 1 4.538409842632715 -6.347596431637598 5.462073088539682 0 -1 0 +99 1 1.681804464017192 -11.02047184883833 10.743929007254543 0 0 0 +193 1 2.131527690130696 -6.895966349546285 9.427352746134135 1 1 -1 +33 1 4.441375653691135 -11.736850231117081 7.202677955581144 0 -1 0 +81 1 7.255373647519644 -8.53916396071646 6.739789624034124 -1 1 1 +92 1 9.790634573312333 -9.44185811686149 11.159147618448468 0 2 -1 +131 1 11.167512844489337 -5.2910720883824744 6.1780456625725 1 0 0 +32 1 -6.188065315477864 -5.388148534056967 6.4630859734577015 2 1 -2 +165 1 -9.199411318810375 -3.239575676768024 7.39142666230393 0 0 0 +199 1 -6.937479844200535 -4.998516463158538 9.811426478379644 0 -1 1 +70 1 -5.484149755229003 -2.3316100376807256 7.82342156113301 0 1 1 +146 1 -1.4782561675061032 -0.5332293079309558 11.298322053799005 2 1 1 +106 1 -1.299565649633866 -2.547377817344993 8.672457149378053 0 0 -1 +86 1 5.4346476876843255 -4.567525864857576 8.586496749161867 -1 0 1 +52 1 0.6258963928325112 -3.6737913184680213 11.408468473681546 0 0 0 +197 1 1.6655903827098761 -4.690360650696893 7.1487356646988935 -1 0 -1 +185 1 2.1215529597432052 -0.6042753779764993 10.00914541981377 -2 1 -2 +145 1 7.122063254971888 -3.6848122349525525 -11.806135592932787 -1 -2 0 +156 1 -5.464187808325629 -0.39192954326422935 11.38371879051662 0 -1 -1 +10 1 -9.035521158465771 -0.7757159430461369 4.809652747733452 0 0 2 +196 1 -9.335669158910619 0.22813232884729473 8.66176404595545 1 2 1 +143 1 -7.124352690053236 3.030922198080938 8.687337455424057 1 0 0 +13 1 -11.772101478818819 3.2748279418542197 6.990058907086091 -1 -1 1 +170 1 -2.6686912671072918 4.2637019013785284 6.493175161410804 -1 1 -2 +59 1 -3.414884055242947 1.7144589247064204 9.304818354414252 1 -1 1 +190 1 7.431647314963107 -0.2323681547056703 9.930387554553988 0 0 -1 +186 1 0.12403907626679356 2.5751847736553266 9.610847507588266 1 1 0 +136 1 3.4038632456152635 2.1695685652264665 7.948376142475482 0 -1 -3 +62 1 3.9322597596563718 6.930006246409542 8.985009369790514 1 0 0 +192 1 10.419594684028056 2.5035467156582776 9.806945423286493 1 1 1 +113 1 7.193391146269118 2.2362428283193516 6.875806515902987 -1 -1 -1 +179 1 11.834426610265067 -11.194697762969987 -10.475928756799647 -1 3 2 +74 1 -8.13998220698503 9.794354756748188 9.006589181804868 1 -1 0 +118 1 -11.66384578850255 8.468830152015009 7.042404750007243 0 1 0 +117 1 -5.315240522733173 11.32072783429444 7.576721087819581 -1 -1 0 +23 1 -5.138619088737474 5.725030905668137 11.239725943022542 0 0 -2 +171 1 -4.330917401708549 7.140228396638214 7.942565065680071 0 2 -2 +17 1 -2.03596415813805 8.313925455397243 5.2823718467129375 -2 0 -1 +94 1 0.5232518791432845 9.687616975679045 9.044820921363916 -1 0 0 +79 1 8.56918534055184 11.565534359174451 5.948120961320791 -1 0 0 +41 1 5.45739715811315 11.541960137674769 11.642369134799488 0 0 -1 +141 1 9.892948341443592 5.76405276568962 9.068370836458591 1 -1 -1 +159 1 9.60684214528172 9.743113663992652 9.758679903521092 0 -1 0 + +Velocities + +39 -2.179321628468343 1.1511761233721014 -0.5234785181560597 +57 -6.53120961304823 2.2544161501487334 -1.2373865721091248 +82 -1.0543302569480935 -1.2919030991113425 -2.688794866729753 +47 1.4420685217894869 -0.5747049377538087 0.6848122481945966 +8 2.36242269061923 3.5603470370323436 1.4936669774368116 +49 -0.6083156247744255 -1.170955618423765 -3.8346753413107364 +184 3.2429732085760055 -3.3821697881066015 -7.235911314720436 +54 -3.6115695852161833 0.0106170916100512 5.665158101271987 +114 6.929262289695876 4.643270489304085 -2.432510904848287 +128 3.7837119455630903 -0.5425190416852157 -0.9248832742343969 +102 -5.730330621950312 2.5925672733788283 -4.330025077474401 +157 -0.16543207126613158 -3.935307993847579 1.876153422628358 +20 -2.5674917416750285 7.261116339316168 -0.2822364811608604 +147 3.957269802164221 -0.44334252499690296 1.8428688293334772 +169 -0.43761432062493966 -2.7004091328373003 -1.9616354437812995 +123 0.4419336641195504 1.661879969268821 -0.34576656499174563 +182 -2.755633666515818 2.89026397900542 -3.3064689855078004 +130 0.4228585869964945 -2.6339270059626747 2.3472759619296717 +140 -2.5258615952943133 4.5464360654810925 -2.960299517136603 +153 2.614799199811544 -6.997005129983971 -0.4675266931999429 +129 -1.0794701392816852 -0.7999027589273617 -1.3594765973927763 +148 -2.5441459127388772 -5.738540142837333 1.2458734580393733 +68 -0.8806574381084391 3.664356747058979 4.498638804868755 +119 1.348535842985886 -1.9096618944303452 1.6705192446304495 +174 0.23536625265167066 3.432430764653958 -0.9841797613553105 +134 0.26301203065712264 2.9239481371691687 4.198089422305616 +189 -5.106229336056745 1.3598593078850199 -5.0921887654096665 +28 -0.5789581538284776 4.678352716038949 1.6083556088979694 +1 4.3168451733041335 -0.8087879863432109 -1.1510010508143134 +24 4.684129190758672 0.5864820180144825 1.3599272674223446 +89 1.2931815025110984 -1.7192563446283065 -3.2675358462468287 +137 -2.489381057507014 1.3936843668930472 -3.4953181455890334 +88 5.564916491075967 0.8520321811715912 -4.447122865446203 +160 -0.07033878109043368 2.2522705799844327 1.9030072089658323 +125 -1.5185131407725638 0.6804743431846004 -2.389477187487043 +167 -3.6035218377687275 -1.9787464624356907 1.2495634883162925 +107 -4.50061384293538 -4.128984940089246 -1.940600692273992 +45 -2.0130680589133294 1.0097638511181886 -1.9327875523898734 +95 -1.8894050626509937 -4.373548537324043 0.32709687823368594 +111 -4.9090211058158335 -4.89034728498546 -4.4838347069372535 +37 -0.7827825654937912 0.2606671310038102 1.2648209822548744 +53 -3.3248176554427693 -1.934526339006954 -2.2700456945424197 +122 2.3544797713703187 -0.1174286295452037 -1.1080357975092663 +126 -1.8232106805443349 -4.42954489421542 3.9468260248902474 +72 -0.3083487798866145 7.089424978098924 -4.065977117594069 +144 -3.209546353795563 2.7953912155418355 -1.9419952653204642 +135 2.825460830342647 -1.3242735854960683 -1.061464548303972 +183 -0.6219322132099675 4.350176294595897 -3.2016653855084876 +155 -4.16183730251878 -4.394917007094668 3.143265712814128 +21 1.042679461197399 -3.76474130433989 3.307467644481217 +66 -0.5660353999856405 -0.9094642274226821 -0.5314610131608182 +22 -1.709804393279522 2.6955272721787336 6.847933865416769 +42 1.5723865718421481 1.2482884329237185 2.4822430118654624 +77 1.0256281250413677 0.6998122284735013 2.9532003047278765 +18 -3.421972744387341 -0.5274519950694775 -4.133682641337289 +46 2.168436016686143 1.0804778012063694 -4.320033516090909 +14 -4.0164283054824255 0.49834440962343196 -0.8290451948901274 +178 -1.7412819488092 2.798973205265782 -0.479900827844132 +48 -0.555572193190021 -2.2271111327857946 -5.48753500392571 +55 -0.2945098160209474 -2.3597197684570634 -1.323571695006608 +12 2.648780275608345 -5.627798255886156 3.878499085658468 +15 5.08064047237585 10.983886551374368 -3.8614562219189974 +64 4.528407739688303 3.5669581487847277 -1.59783436247384 +44 0.6179240842533569 4.733042665051045 3.2581525303469463 +188 -7.148050937863482 -0.9829624495370496 -0.8418403492142479 +200 -2.1181786226695647 -0.7796260516164706 -2.0505857854477805 +198 -0.41864716042364125 2.296081055566785 0.29109905683884685 +76 3.589037248934578 3.9784201870774147 -0.18396191505765547 +194 3.2793423730519953 -0.6090514771278666 -3.4934826993710537 +96 -1.781539941975932 -4.363514711154816 4.864062078072237 +104 1.408163209882818 -2.2024070797001714 1.13197301326935 +91 0.7549842936282545 -1.8949946215618456 -1.0202618871629823 +154 -3.58496442590166 0.6965660533263317 -1.9948941159972786 +19 1.1538547086598117 4.352147462832853 0.5698931598819479 +176 6.6158635134989 -2.4436529370166666 -7.921148144074609 +120 1.9770896033272432 5.325440429480748 0.4321682589452387 +138 -2.434142355712014 -4.211844174503549 3.7463686848024356 +9 -7.9556317081134775 1.3611081846148716 1.1973651519179334 +150 7.132627873294173 -1.1589700932996243 -0.3531633921451265 +38 -2.373885424533282 -1.6670776794732187 7.126244784839699 +172 -4.190332426742245 1.4971407429268737 -2.1038522992559976 +87 3.8705371644824407 0.6946282376038537 -0.5718475935933448 +93 1.3514689577122314 2.2886635029067657 1.1457291529838165 +195 0.8294761589431854 6.809445622982572 -4.490681006002271 +149 4.665694837020095 -3.8971221183097815 -7.000247317496072 +25 -1.4227504585025186 2.666757793916314 -4.2485642256584795 +35 2.0433487025942068 2.1539055294115 -2.682708261193331 +5 -3.648704562720594 -0.39330823945136234 0.15528838477335327 +116 2.764952659364006 3.2308857608345534 -0.538944143891585 +112 1.7976356559372615 -1.540357698562047 -2.170928793825917 +152 -2.4572877205036923 -1.6206485240807629 -4.85936004694647 +132 4.802107956404735 -0.11013197470116909 0.6674735986355181 +173 -0.7045077946396323 0.6277364102624156 1.4282110726540087 +73 -3.4535983591604964 -1.3273163733693092 3.631166806617851 +29 -5.742750315320132 4.210335165654985 -3.183862358662845 +161 0.7207671082657183 -2.639249856838032 1.2031913703667394 +78 1.9802499580941673 3.892356471093276 -6.0300544674355 +11 0.3710597317170738 3.014897507875772 7.0674999285689495 +84 0.06314153271125988 -4.938702818012672 2.3405049696166014 +90 -3.021721770486999 0.5895782968475963 -0.883462541486843 +36 0.6115261475891951 3.326758596635819 5.305093464697983 +98 -3.289247327924386 -0.7716659861479829 -0.8061979190797803 +56 -2.484208615656381 -0.7583806019455193 2.000293738990754 +109 4.065544877208817 -0.31468790514138334 0.3860037578404895 +115 -1.5583103456503846 -4.034490286401138 0.5420000897756707 +124 2.716664944254732 1.195693130251065 -1.0534283229167152 +121 8.492299287405391 -0.8573607139000322 2.0906896396885357 +80 -4.269726737071596 1.290253084422534 1.3756246647776993 +151 0.17922239204385892 -5.243344038190157 -1.7214465623209987 +4 -1.5287457726003018 4.545253326761756 0.4075652200807629 +6 -5.5555965267113505 5.196757149002673 -2.131768740002899 +166 3.8192709965319924 8.287983828276944 -1.2203929922517287 +40 3.450300769917062 1.3679263003539135 -5.713912913407013 +127 -1.8550057408599427 0.2529213554001156 4.292787610095508 +60 -0.4570467791684108 2.1995625338737512 0.38684023826685754 +168 -1.1461639744415708 -3.7753008221986715 -0.7069362633693567 +51 4.246427854086795 2.2660286121479016 -0.17525536000106454 +97 -0.45920058079801923 2.3672214881822935 2.918793131685986 +103 2.8457407886760415 5.079818233132883 -1.6831372889932052 +163 6.588786306029201 2.961102097923318 0.12898108224833468 +175 -0.7784000842847736 0.05239163186710383 4.783927411692968 +158 1.324975092911766 5.716483065795907 -2.766582829578808 +85 1.126575470046233 1.8878210873276244 -0.3160540074040886 +63 0.26385610607819265 -1.0518690744177137 4.681584068045189 +133 -0.8004471826186864 6.474544076922776 1.4133211461125943 +67 3.6157553514613374 3.5767340310447207 0.22045279936244222 +83 -1.0062072078141164 -6.493845317833074 -5.600689394569981 +181 -1.9698774782124704 -2.4967875449198838 -1.482046688397622 +162 -2.904567214261779 4.609525946829769 -4.773883794319192 +71 4.704149679704777 3.1523586525426124 4.57547323305684 +31 -1.5901553457672002 -3.05689507101266 2.2039810687618497 +139 -2.695407001366337 2.151237461783768 -2.283708689815052 +3 -0.46766817551787454 -3.140857693103965 0.4361924390516714 +108 0.1913617703423478 -2.71581239158428 0.6724779385423365 +16 -0.5574602967458635 2.869089341747036 3.246617986586125 +110 -3.2935781644783413 -4.906537822882089 2.429950659174858 +50 1.3517081278566716 0.7979565345760338 -0.4185472621695281 +191 -6.186669509381163 1.5069910278978673 -3.122140179713244 +187 0.8559064953620825 0.3957056787517148 0.9088293844669495 +180 0.221714052316844 3.344232199120801 0.5800459730217239 +2 2.3994296631460794 -2.8375195813060388 -1.0887178593496891 +30 1.2210690766888224 3.5899619104376446 0.08151741673684687 +7 2.7726111769463913 0.687615055956059 0.37410979119832144 +164 -1.1931898641891907 -1.3539824930215878 -3.3405462160564703 +69 1.9731979197688503 -3.2571194324245205 1.6749831681024951 +61 3.1823016504442476 -3.0315743307115213 0.8747268024881065 +34 0.42940760329491323 -0.8546757769020348 0.7046464666351262 +43 -1.2834304624987016 -0.32585553857664296 0.40311374457538895 +177 -4.156106157869977 -1.1691085227558309 4.764406539360629 +65 0.7459698348800096 2.6999150256104985 -3.5548113977053744 +27 1.2331887682296838 -1.694381902758542 0.04304965560826135 +58 -6.154057979578904 -0.19938148972279413 -3.4163165607386854 +26 2.910747146350628 -2.990465499480819 -1.5258142005591657 +142 -2.6857404309480515 -0.4742647340730133 0.8619212003727141 +101 0.8564696967146533 -2.0546263222545185 5.004696469365843 +100 1.7773361390238631 3.5466656645190247 -4.741841979587642 +105 5.236015515046745 -7.745834640119119 -2.0944663177984997 +75 3.19034440896343 4.856191854526413 0.20239301909347396 +99 0.7372059827598996 0.8218000327204846 1.1962914445625328 +193 -5.54751039136509 -0.8984829893317632 -0.09804506747660646 +33 -0.9015609488918586 2.8634014710755875 -0.5142897564939601 +81 -4.226349362632615 0.4990338142221863 -3.177351469506789 +92 4.852938979419456 -0.5312580038435196 0.4444574326006344 +131 -6.780942865007681 0.2505331120455996 2.984671966978939 +32 2.043323184339133 -2.0915365663642502 0.3570674081797969 +165 1.772621337461088 5.624086428613788 -2.1958779155861525 +199 -4.655961690467214 -1.5582587292151853 -1.0372922469851396 +70 2.1009520029345854 -3.4367267457669444 0.3489118952393979 +146 1.1094627356046975 -3.7052416904893786 3.1151669468585044 +106 0.9244635796842038 -0.8697076449017062 -1.1271268628891515 +86 -2.4614440724404063 -1.1443915951868173 3.0472327038543923 +52 2.206997554373295 0.48895638167295574 7.813903343751546 +197 -4.43947099244034 0.3827402537789232 -6.114284477117655 +185 1.8450115502667273 -3.367103363338241 -2.7646657581326055 +145 -4.495233666659511 1.3255674480674051 -1.5848168476287035 +156 -1.1061826790673608 3.490100920043544 1.7425058587963753 +10 0.10888349121518726 -2.3346954910750384 0.3634642612209191 +196 -1.237862986215301 2.306399540514406 -5.426709024577362 +143 1.387043305733553 -2.3787136376519027 -0.20756141146550633 +13 2.2357687358768974 1.685714857075964 2.2457142840004356 +170 5.1889099023089535 2.9826822454922652 1.0755609101553643 +59 -1.712405925615148 -2.553137012160255 0.03926835373766702 +190 -1.7274645985224364 -0.0964601276780217 -0.8892867639051387 +186 -0.5051041743099376 2.0346977046537615 2.086897795173162 +136 1.6635288094047165 0.5254443611211371 1.8199836517530088 +62 0.7708640981248649 0.12152082573932288 1.7717141492471689 +192 -1.0422128532558474 -4.04447955732469 -1.926662726630305 +113 -4.472429838979146 -6.765621050808509 -3.003588999898843 +179 -1.7067254128417755 -7.980317775082368 -0.9140818138687279 +74 3.515578700667397 -5.09057685611017 -2.4373465493326076 +118 -3.836950473028625 -4.398228703366778 -0.9008313748045251 +117 1.2669363304661976 0.4817377004658103 -1.5641060379969072 +23 -3.023411190495862 0.4127754096885368 0.24116380806370397 +171 0.782437003849918 2.278657242176388 -1.477387925776958 +17 0.8979396881179555 -2.2139965953711083 -0.9661842759619532 +94 -2.2083649456241576 -0.3520697824173402 6.939477089019811 +79 -5.097477099334401 -1.1053765447054356 -0.5927717885602897 +41 2.717742851180541 -0.8197068618726784 -1.1670313842646072 +141 1.3223712852080913 -1.1251601779570968 2.4100632027817 +159 -3.979797713933269 1.5260607907829866 1.4624579807682239 diff --git a/examples/PACKAGES/pimd/lj/data.metalnpt04 b/examples/PACKAGES/pimd/lj/data.metalnpt04 new file mode 100644 index 0000000000..7fcb4a8bac --- /dev/null +++ b/examples/PACKAGES/pimd/lj/data.metalnpt04 @@ -0,0 +1,422 @@ +LAMMPS data file via write_data, version 8 Feb 2023, timestep = 100000 + +200 atoms +1 atom types + +-11.876696863105703 11.876696863105703 xlo xhi +-11.876696863105703 11.876696863105703 ylo yhi +-11.876696863105703 11.876696863105703 zlo zhi + +Masses + +1 39.948 + +Pair Coeffs # lj/cut + +1 0.00965188 3.4 + +Atoms # atomic + +39 1 -10.354249178970125 -8.813051919915168 -8.382969093379817 0 -1 1 +57 1 -6.095139656027609 -9.359263918713493 -7.698842353606457 1 0 0 +82 1 -7.493664607592135 -7.0059769885785474 -10.165574967227153 0 0 0 +8 1 -7.207830943811267 -11.030802786228156 -10.545758277848378 0 1 1 +49 1 -0.3707760358866739 -8.703874147846175 -7.734231800660862 0 1 0 +54 1 4.371171010756674 -9.822286390366472 -9.608608173022526 0 -1 1 +114 1 3.857478702816806 -8.583003039261015 -6.26115845444949 -1 0 1 +128 1 1.580452299690882 11.414121196534609 -7.383200117467098 0 0 -2 +102 1 2.6350731915864145 -6.397417482172074 -10.801961817246344 1 -1 -1 +157 1 6.611187455803048 -6.205022609136458 -7.392834911294685 -1 0 1 +20 1 8.102933091687992 -11.214330088075124 -9.936524774492973 0 1 0 +147 1 10.596045290286296 -5.759130098910738 -9.380762680610847 -1 2 0 +169 1 9.366630474689176 -8.921006522319503 -6.843673029579733 0 1 1 +123 1 -6.859009660270495 -3.2379537512590297 -10.864178266429683 -1 0 -1 +130 1 -6.577322046738903 -2.5106835965921164 -7.224326100490352 -1 1 0 +140 1 -9.107723436323155 -1.3229863757258506 -9.244986454221655 -1 1 0 +153 1 -4.548656766959874 -5.17967134910819 -8.787434718939945 0 1 0 +129 1 -0.17808656259561137 -5.023072792674526 -8.617493408883192 0 1 1 +148 1 -3.2601725736553027 -2.033844854035978 -9.777384129731104 0 0 0 +119 1 -3.5689822234610595 -3.8505044768944927 10.627709646886371 0 -1 -1 +174 1 3.140197534695247 -1.913882100151838 -10.76389374977719 -1 1 -1 +134 1 0.048608226174046365 -0.39555664243276595 -8.555122102444741 -1 0 2 +189 1 2.8889478385298655 -1.3768037709890826 -6.4534432907832056 0 0 2 +28 1 6.251824687614619 -1.150087307901578 -9.266876365488919 0 0 -1 +1 1 7.556173300837827 -2.8495110668506705 -6.5781416096142475 1 -1 0 +24 1 10.885498404916829 -2.163413929107282 -8.181530231530648 0 -1 1 +176 1 10.317143708012939 -3.6994503272775026 -4.285905348037859 0 0 0 +182 1 -10.866713794399553 0.5835390862478285 -5.190897922574198 0 1 -1 +137 1 -8.197336531384668 3.7710266805092836 -8.628333311872499 -1 1 0 +89 1 -5.830740775393367 0.9227024639457406 -8.56962226272939 0 0 -1 +88 1 -3.2174671278447153 2.596119117918313 -11.010039397757382 0 1 -1 +160 1 -0.16353319092958282 5.356569592952759 -6.027400461354258 0 0 1 +125 1 -3.2660565494911986 3.5402608994580014 -7.139474945270797 0 1 0 +107 1 2.5004686193441863 1.4213418016161157 -11.264390107008213 -1 1 1 +167 1 2.6306438675911963 2.7047021139073024 -7.49322777752869 0 1 0 +45 1 -0.26576210897417507 3.3660903959893673 -9.858663372020018 0 1 0 +95 1 7.02981932063029 1.8215081284089933 -11.08913793230704 0 2 -1 +111 1 11.249280516767561 1.4119125550850526 -8.355555586118154 0 1 1 +37 1 7.519477058425284 1.5490589443573544 -7.629176894794767 1 0 2 +53 1 9.42047942911636 5.244187392085703 -10.133263719784543 -1 -1 1 +122 1 -8.63992654505136 11.450404981587694 -7.075458716341785 2 -1 -1 +126 1 -8.723342916981192 9.13102883296233 -10.17466547482745 0 0 -1 +72 1 -11.206699277582317 7.297248005363309 10.79372604446887 2 0 0 +144 1 -3.0607758424636864 -9.877816322452732 -9.947243110943289 0 1 1 +135 1 -0.051808796348424835 7.83802622288054 -8.426793042584595 1 0 0 +183 1 2.8265474855254293 5.2650728973076095 -10.056888138059385 0 0 0 +155 1 3.7333346013160673 9.271985029918303 -9.380687277523048 0 0 0 +21 1 6.713007344355741 6.806136281598503 -8.223321187919673 1 0 0 +66 1 9.521874492322397 7.474069880889854 -6.18586873962963 -2 -1 0 +22 1 11.050170157856584 10.74761987425433 -6.194431008418831 -1 0 0 +42 1 9.124991617085433 9.313926068749339 -10.259091612355418 -1 1 0 +77 1 -6.847598261663958 -10.941109014822928 -3.892206492676891 1 -1 1 +47 1 -8.72137736883077 -8.020553455249186 -5.411695457067339 1 2 1 +46 1 11.333911554840483 -7.659682887184623 -4.080815689532784 1 0 -2 +18 1 -10.646224114047842 -11.295142102189118 -3.8769976756703564 1 0 -1 +14 1 -9.605745944890806 -7.401374860679573 -1.982921039201294 -1 0 2 +178 1 -4.564495057067056 -8.050510749495825 -4.8659978849512635 2 1 0 +48 1 -3.165816579392377 -10.956276319999837 -6.319173483966388 1 1 -1 +55 1 -0.9801312338979216 -6.257580408615657 -4.2669674058977485 -1 0 -1 +12 1 -1.844858616965503 -9.490670669998687 -2.2961766563429364 -1 0 2 +15 1 6.049786455655653 -8.189634166823847 0.7790760301881896 -1 0 -1 +64 1 2.7732180154018238 -10.586600242266561 -1.7220526985868578 1 1 0 +44 1 7.987685169786731 -6.317537693048875 -3.624602682973471 -1 0 1 +188 1 9.985693632064716 -8.552544016815117 -0.7260907476837022 -1 0 0 +200 1 -9.468913996814749 -3.332006112139499 -5.219156914346259 -1 0 0 +198 1 -7.176651640198091 -1.1963525306783946 -2.253714347543795 0 0 1 +76 1 -9.922127224407973 -2.9538091484944595 -1.5482866071777552 1 0 0 +194 1 -6.755129554954018 -4.9982944036574395 -2.6156955876752477 0 1 -1 +68 1 -2.4837259122195063 -3.490803572414407 -6.114089975980331 0 1 1 +96 1 -3.411864655652117 -4.073235933810771 -2.067669105620388 -1 2 0 +91 1 3.0280594613502636 -6.3376596415711255 -2.326898295867128 1 -1 -1 +154 1 -0.19811764587289105 -2.9629996027018635 -2.9145103486688195 -1 2 0 +19 1 3.201765959673939 -2.0909064907714274 -2.3150720129859153 0 1 -1 +120 1 6.666250093808799 -2.2381082538053363 -2.826357084420522 1 1 1 +138 1 9.709412364194842 -4.510669257803851 -0.7371785941816178 -1 1 -1 +9 1 7.576584804759921 -2.0173260225381977 0.5837619474494389 0 0 1 +150 1 -9.925148350003655 2.008414757334357 -1.3585989335940631 1 -1 1 +38 1 -5.774540065294694 4.703952130507923 -4.709776738882269 1 0 2 +172 1 -9.650643801070206 4.065753015545833 -4.8890536457268325 0 0 2 +152 1 11.354703841174967 -0.5574832611945055 -1.878354960063874 -2 -1 0 +29 1 -7.8756923654824735 7.618259977195223 2.1884603240114373 1 -1 -1 +87 1 -3.3182201208100697 -0.9619504843434044 -3.571516039019219 0 -1 1 +93 1 -6.22447967806385 0.9237017015404234 -4.899961705314269 0 -1 1 +195 1 0.9557760919893532 0.18190089307880442 -3.7530657563825116 1 -1 3 +149 1 -2.258211757279497 2.7869892960968605 -2.6067337721972543 1 0 0 +25 1 4.582659783463335 1.197304704789868 -0.6333382889463834 -1 0 1 +35 1 2.8340362437473665 3.775198295599683 -3.7220216498098746 1 -1 0 +5 1 5.712702262390174 1.525516395213053 -4.231454437885219 0 -1 -1 +116 1 5.993880302160488 5.819609728686341 -4.981314501727478 0 1 0 +112 1 4.993891288991353 5.44294004315121 -0.20000094912971011 -1 0 0 +132 1 8.553215140035688 1.848923908331039 -1.3929852223418029 0 0 0 +173 1 9.058614097754903 3.793989570565648 -5.529277027531151 0 0 1 +73 1 -9.97609370360327 8.001052498887105 -6.678871508542809 0 -2 1 +161 1 -11.443764897577033 7.1235053711641685 -3.5412879782897306 2 0 2 +78 1 -1.7946589875472476 10.140074782001498 -1.7188309657767924 1 -2 1 +11 1 4.48445505597226 -11.863465860429208 -4.995823112103199 0 2 1 +84 1 2.463379766571318 7.427030445050496 -5.251636426023569 1 0 0 +90 1 6.171978058160043 9.299313343642424 -0.9265676065333643 0 -1 1 +36 1 1.9133463519046003 7.719511929183511 -1.7420567765226709 2 -1 0 +56 1 7.255050752153057 10.433125182056429 -6.693622072998551 -1 0 1 +109 1 9.138840387988623 11.32849279657362 -0.9075432219499753 -1 1 1 +98 1 8.493633429672352 7.664253543281429 -2.9150549381854445 -1 0 0 +115 1 -7.310435599643078 -8.126317136056372 2.852881189844054 1 0 0 +124 1 -11.031652111608674 -8.829616358814924 4.11892916031843 1 0 -2 +121 1 -8.24719811507558 -10.102559907485395 6.644774570363861 0 1 -1 +80 1 -4.990158022745006 -7.228416620009519 -0.23616829431627906 0 0 1 +101 1 -4.425835217027135 -8.041862792922046 4.912842377205241 1 3 1 +4 1 1.6093443070111064 10.036215537003722 4.649624528139505 -1 -1 -1 +6 1 8.957102959942503 -10.648514255179037 2.7520244907338807 1 1 0 +81 1 7.208459443972924 -8.512507364143946 6.7186127098675 -1 1 1 +166 1 -8.735612761804596 -5.051940162290023 4.287135452158321 0 2 0 +40 1 -7.0154409632766175 -4.6058645552640805 1.2332349553758588 1 1 0 +127 1 -5.628166701486109 -2.4571683554307384 3.9074191001707503 0 -1 0 +104 1 -0.4346324933964958 -0.6513905925349095 -0.2958543835790408 -1 0 -1 +151 1 0.3877075536664327 -6.4007225085014845 0.24945488280004469 0 1 2 +60 1 -2.369840965541917 -2.0961144039265633 5.2852382593681435 0 1 0 +168 1 3.911007973828095 -3.389123300929967 0.7576129789066393 -1 1 -1 +51 1 0.3292384996563097 -3.420112775820937 2.935489834742583 0 0 -1 +97 1 2.1485649172664862 -0.10439592636417316 2.279403065792625 0 -1 -1 +103 1 4.042877904485135 -1.0208892892284567 6.118986931410435 -1 2 0 +163 1 -10.685207062128164 -2.805182722090798 2.2992408280776737 0 -1 0 +175 1 5.777080728790477 -3.428422767297768 3.9500489905592655 -1 1 0 +158 1 8.901770795533949 -6.449835056793116 2.8925949474189174 -1 0 -1 +85 1 10.225188926473791 0.0017773278841735195 5.209115671649155 1 0 1 +63 1 -8.213348572388885 -0.1729333455438991 1.128439638194422 -1 0 1 +133 1 -10.560391258433501 2.3871994933981604 3.6217764405881163 1 1 0 +67 1 -6.58893267726452 3.5537178434565275 3.2475644463629347 1 0 0 +83 1 -3.8515887631140515 0.6260605243857498 2.809794279660778 0 -2 1 +162 1 0.5353669870800427 0.011171969691910696 6.140615526988775 0 0 0 +170 1 -2.6982076482868784 4.239239002024167 6.5023488926564 -1 1 -2 +181 1 -5.269736706670749 0.6633143508889567 5.80856876438175 -1 1 -1 +71 1 1.6280398876142836 3.9922472717626896 -0.5550063690378906 0 -1 -1 +31 1 1.1405250667226041 4.200703300864838 6.2167435118694465 0 -2 0 +139 1 3.842562548009269 3.6547622321511497 3.2913955399115533 -1 2 0 +3 1 10.98202973743475 1.2548431833407037 0.9250033618641567 0 -1 1 +108 1 6.094576089388102 0.9247979169923504 3.624011344184912 1 1 0 +16 1 8.94421023892344 3.592040529277952 3.968834804835023 0 -2 1 +110 1 -11.386726712959288 6.012786074810452 3.1335330551037686 0 0 -2 +50 1 -7.019873322974002 11.162655244151733 4.132863440221239 0 0 0 +191 1 -8.58859990391919 7.042920679843704 5.549588183323656 1 -1 0 +187 1 -10.694945657883851 11.280545373237025 5.089277301544773 1 1 0 +180 1 -0.9832322177090624 6.17374336331137 -1.7810168677844587 1 -1 2 +30 1 -0.5786545001726999 8.92644611919124 1.2001444343316763 1 -2 -1 +2 1 -1.7987623083026563 5.385135175592104 2.641095387043805 1 -2 -1 +17 1 -1.9803131781320147 8.340104277288379 5.2339610584552005 -2 0 -1 +7 1 4.056078571838132 8.755054555667046 1.7129552906297647 -1 0 1 +164 1 1.8606879960472185 6.264401812470137 2.238048307949188 -1 0 0 +69 1 4.582260343749063 6.901308432226479 5.16724455389889 0 -2 -1 +61 1 10.203999344055715 5.098875037493535 -0.6552273031803888 -1 -2 0 +34 1 7.6452062423181015 9.296589241677342 2.4017008610787727 0 0 -1 +43 1 7.186240451053859 6.044802069738282 2.458597580290494 -1 -2 1 +177 1 8.52522272174418 7.310838340899178 5.550705478002598 -1 1 -1 +179 1 11.738401405730409 -11.171052154041227 -10.46073671167246 -1 3 2 +65 1 -9.923794257190753 -8.360277300667597 11.397343948439744 0 -1 -1 +27 1 -10.96202039046517 -11.679459496759502 8.461761452894827 1 1 1 +58 1 -9.782820449181592 -6.900116722543098 8.161461366886957 -1 0 -1 +32 1 -6.176757614808324 -5.427580338396943 6.37353314773015 2 1 -2 +26 1 -5.244950495195521 -8.48903289150118 9.276610316099598 1 0 0 +142 1 -2.2192381371286913 -6.710860567512032 8.5692633945157 2 1 0 +100 1 -1.5829434980745454 -10.919909502588283 6.783259906533759 1 2 0 +184 1 7.415704119987677 -7.40752254135457 -11.394836902247562 0 1 2 +105 1 1.324436294552863 -7.868824845245506 3.928981783067961 0 0 -1 +75 1 4.559950916659301 -6.316720857110099 5.422215632967026 0 -1 0 +99 1 1.6556187341181972 -11.042676696296036 10.823511254079808 0 0 0 +193 1 2.1147403084852634 -6.885083505075134 9.409447220216105 1 1 -1 +33 1 4.45464187128425 -11.736247949088288 7.271061852952995 0 -1 0 +79 1 8.565919655629239 11.638486198403275 5.960760377855752 -1 0 0 +92 1 9.769060714231218 -9.492631803351557 11.102372610406375 0 2 -1 +165 1 -9.212711733999253 -3.259454828813142 7.377981593005203 0 0 0 +199 1 -6.873376106851867 -4.9933518932685566 9.87422952115871 0 -1 1 +70 1 -5.445601633222862 -2.349920544152827 7.807205278865663 0 1 1 +146 1 -1.4368974006040247 -0.5526263308116413 11.329045170425331 2 1 1 +106 1 -1.320489681644758 -2.525949605897458 8.649126125808394 0 0 -1 +52 1 0.6432865601156172 -3.653577986848175 11.390625659771409 0 0 0 +86 1 5.463936380191402 -4.545155299286932 8.600558169678536 -1 0 1 +197 1 1.6297777023246702 -4.6288437196490895 7.127308915254101 -1 0 -1 +185 1 2.117376701545396 -0.6740584604995838 9.981858778655166 -2 1 -2 +190 1 7.391326441541653 -0.2420688149799064 9.912167028101104 0 0 -1 +145 1 7.1433612487852685 -3.600502105720082 -11.787138473864353 -1 -2 0 +131 1 11.237287581981867 -5.265986055819216 6.2884198947288406 1 0 0 +156 1 -5.499196268975016 -0.3842368684419455 11.47923685297254 0 -1 -1 +10 1 -9.091750969544233 -0.8101391784724588 4.798103517685853 0 0 2 +196 1 -9.331229431870144 0.22379652065858124 8.694495890506026 1 2 1 +143 1 -7.138465404537655 3.0174764853722347 8.68001066247089 1 0 0 +13 1 -11.76499693524697 3.321385859999623 6.936314787144568 -1 -1 1 +59 1 -3.4402166179497833 1.730296081472357 9.358944812035546 1 -1 1 +186 1 0.1617283142132493 2.5970365582430226 9.662083422391825 1 1 0 +136 1 3.4199513038280873 2.163828872826315 7.95543255977617 0 -1 -3 +62 1 3.963989117283031 6.890950850270743 8.983560199060738 1 0 0 +192 1 10.513433172209162 2.5350934882928264 9.78265608934408 1 1 1 +113 1 7.161285582100181 2.2124289355489886 6.79272048842973 -1 -1 -1 +74 1 -8.169335431227 9.77557136132564 9.00057456275031 1 -1 0 +118 1 -11.608821137521177 8.521503367814617 7.013321378357836 0 1 0 +117 1 -5.327579617349453 11.314505774662308 7.558097527322893 -1 -1 0 +23 1 -5.129126916477775 5.721102420605024 11.278247239081892 0 0 -2 +171 1 -4.352281149020513 7.112600115001591 7.871167109278595 0 2 -2 +94 1 0.5998107735037941 9.708724091432982 9.014903980367055 -1 0 0 +41 1 5.4449659738536695 11.522021070488632 11.662868284303414 0 0 -1 +141 1 9.872190892571076 5.7761026505659245 8.948318084922565 1 -1 -1 +159 1 9.641274357072867 9.726441601090215 9.76145240542319 0 -1 0 + +Velocities + +39 2.577793097354695 -3.3983788380629387 0.9311775479132861 +57 0.044350439903272976 -2.756321060337954 -1.0428315092461067 +82 -2.504296787676701 -3.6468474399030493 0.2541672097953289 +8 3.6367927137204146 -0.708503612114486 -3.734398328076926 +49 1.8873851156019454 -1.4752561333771483 0.44317628658177016 +54 2.0609459874818237 -3.7591063995516816 6.295629243534251 +114 5.3525465279303015 -3.959388563871946 6.9201302420483755 +128 1.2908060914043953 -2.111376197467554 -0.48873831716967264 +102 -4.571293842871747 8.300052861760934 -2.8260260042769847 +157 0.6864784580965262 2.3741938996988416 3.197851910441299 +20 4.652994650182517 -2.368616661754701 -3.6239824640674376 +147 2.3112278761829046 2.7926157746726785 0.3841905616879638 +169 3.8809056176148298 -3.783797831749185 1.5132762830383186 +123 1.2907138384495385 4.5605260997379515 6.265572889261794 +130 2.3899251274818005 0.27666961403153456 4.415473432866114 +140 1.0077403345435272 3.331618501750946 3.823686801783437 +153 -4.158360194263056 -0.05792314282326738 -0.09170129980331274 +129 -2.0924141264102167 -2.229463311149641 5.774701380963026 +148 4.419535691773222 -2.221801500903651 -1.322900377568077 +119 3.3013302732178436 1.0440417527080033 2.8019660816699443 +174 1.8865107534171663 4.984254074383621 -4.4680569390231515 +134 -3.051462360151183 0.13872483873263985 0.8334720216492622 +189 -1.575075881871396 1.8217362685289014 -2.0444979947436 +28 3.421168174684726 -5.498073809092277 -0.04014458535812704 +1 1.9883484696931384 -5.62737172391044 -0.6897496957906657 +24 -1.2667871307922316 4.30277534955836 -0.9434339008200991 +176 5.33889839399068 -0.7261935889242956 -1.0648636501642632 +182 -1.3434249574772492 -1.2612974855392476 -0.8264254407007674 +137 1.9669241314073078 1.4304166951432975 -0.7941330665668798 +89 3.0037245881229415 0.2485958612228784 0.43340084246330035 +88 -4.773290068397481 -4.145612735120506 2.9587651882723076 +160 3.2238819912540246 1.454427974780249 -0.8931785023147302 +125 -2.027584749577839 0.2846539404784728 -1.9747515011844237 +107 -0.4309962618034694 -3.6977689727188716 -1.9008509957370174 +167 1.1593622921328293 -1.8699221821464713 -0.35243227029296986 +45 3.8023301775972866 1.4226356824680009 0.7412574800338123 +95 -6.444883722807761 -0.36547146467399716 -2.3313614045704956 +111 2.654717565255864 1.4059595144409067 -0.8812624422906502 +37 2.6344865612342447 3.1241557322031097 0.21727945365726709 +53 -1.162490586497141 -1.8114743286402544 -3.3819238034771355 +122 -0.39245032082132514 6.341371204609977 0.15639083036810653 +126 -1.605697227924968 4.594486921923675 2.22444280178021 +72 5.553154164868334 -1.6002168773168566 2.986954509825138 +144 1.3403843285320132 -1.7279031413546053 1.3999311572505995 +135 2.534876793407053 -3.9801581090182863 3.1492981080983657 +183 -4.679242103632781 2.993032322724656 -1.3277928954591556 +155 2.478325342602548 0.096505570078343 0.23454435113676975 +21 -3.5229231861916004 -3.9816529561376006 0.026639755919907415 +66 -4.078355783351698 -0.12178976416838905 3.6922808103625115 +22 -3.6395126219587364 -6.832262596301959 1.5951115669463118 +42 -4.403508549300507 -1.075423056570003 -0.591849033607009 +77 -3.529890611915624 -4.75010415058562 1.6925557776838493 +47 -2.1850961781212535 0.29268584139732723 -6.145825548126078 +46 4.627258609793938 -0.35735610275796525 -4.228603145133978 +18 3.73167019444449 -0.1412650186120299 1.8269713694609548 +14 4.255528637119755 -1.6399584278487664 -2.3670010206718466 +178 -5.547816263652345 -3.2716811779531016 0.3760629173372536 +48 4.425750039051989 -1.6380895084775802 3.0834785539819825 +55 0.9664608309050373 -3.9279561872107216 3.738153737041613 +12 -0.41819517254673283 0.9367025298427245 1.548662259471958 +15 -1.5561256264944465 -1.7138464717908113 -5.214325558070718 +64 -4.340047339400262 -2.22675786620723 -1.8953705605237372 +44 1.1388904606478099 1.1952052434483869 -4.7138321817777165 +188 -0.6813174034115439 -5.349606335139992 -0.5494798369887832 +200 4.5313662932423755 -1.509632335926491 -0.7143667001741889 +198 -0.147474124917653 -4.398760900940008 -1.3829542092135303 +76 3.499335281047853 4.321577651994544 1.8422196851357424 +194 0.40702093571028386 2.536045454224767 -0.25948941675872716 +68 1.095513798887539 6.302453994563069 -0.032465133466722085 +96 -0.8025115532160563 4.133456324521671 -0.3987555142125939 +91 -1.0924701330602116 -4.134760716625712 -2.5476966892452007 +154 -0.6420195815805342 0.5441210237991451 -2.4764714848254394 +19 -6.45757006657402 -1.8917738383254377 -2.2385612755611657 +120 -2.333329676155747 -2.6263663088962446 -0.31608193981125454 +138 -4.2274347886527295 -5.149547905719161 0.18051226809116783 +9 1.9482438581325014 1.836033317169747 4.767132863545005 +150 1.9981648567087547 6.350098740087899 -2.8565846607881165 +38 0.7805411976234249 3.2336875919271204 -5.491325260091564 +172 -1.6067207370017498 -4.025457011374177 3.328473783113818 +152 1.2783569248468387 1.1836235305806408 -2.8398807957375904 +29 0.012522208655832867 -2.202968899510487 1.2653923818179775 +87 2.4301555960867915 -0.3844922649780862 2.3653616101850643 +93 -0.8167645337546143 7.0869554155527865 -0.992159930343214 +195 1.386850643478473 -2.1138124263507945 -2.6343099572277926 +149 -1.9222490388239173 -2.9269314999007365 1.9288615526733388 +25 -3.59971099165819 -1.6866464810245103 1.7143969426226588 +35 1.1068675504822845 2.9570865620910163 1.5489285873628789 +5 -0.06525583154753622 4.64663174535613 0.0051166703840210825 +116 -2.156521693342489 -1.106530196750272 -0.7392284182460408 +112 0.8256766355184204 -3.3427544054629896 2.364051175484082 +132 2.1070952059277808 -0.7636208241660348 -2.901239577070981 +173 0.9555468923097092 0.9205686685241707 -3.199573856104545 +73 1.5067078955449293 -1.4433124895723743 -1.0680684282081363 +161 2.1775187990003184 -2.0432036406877887 -2.502427749527437 +78 0.4277549814794872 0.923985061568942 -4.462582084674592 +11 -0.7883572752861073 -3.298996571191427 5.184829507433079 +84 -0.3908120720288031 0.8981771084266208 2.781123174827333 +90 0.1806374932457661 1.6703751943299625 2.7208543462130645 +36 -1.267739998375956 2.1167954160312523 -2.3987528368253503 +56 0.42755132352919767 0.3105230600944311 -0.03753157138922093 +109 1.9130458422765049 -2.4592218292820647 -3.7955776970359176 +98 2.224412680285525 2.8105570053709483 -6.007751163289515 +115 -2.8264888701698423 -6.77384783439804 -4.5128631453140455 +124 1.0115631212847158 2.197697811017366 -1.4884565302411554 +121 1.819952585372025 2.133685315101777 -0.48009196690211353 +80 3.6825834395072827 2.9369744584874624 0.7772431106319383 +101 3.8152106585296663 -0.7504695117106335 -1.3678083578602058 +4 1.1543968705285124 3.6108919626584783 1.279726012491966 +6 -2.734554328800396 0.45690265044985007 1.7653493310436426 +81 2.173385375162031 -1.545557384488483 -2.635973810143899 +166 -1.239464711076861 1.3504238003340796 -0.49024226288977 +40 1.7898346069542372 -0.4474778752941201 3.4790111502788887 +127 1.6296109635966738 0.6612604860538578 5.807821273928263 +104 -4.901664479006097 1.1052244598202794 3.4465808005881824 +151 -3.983151444075344 -3.2501191110732113 -1.2526584841338049 +60 -1.922006700361108 -0.7785585059363819 -4.390434339117124 +168 -2.788478664171041 3.923738577427861 2.49523972250301 +51 -1.6149322848467969 -3.4296394320723262 4.226459281197094 +97 -1.226730421851149 -2.392775221203476 5.070036120535187 +103 -2.9962982871055357 -2.90339448475708 -1.1348192929647936 +163 0.3128021577268095 -4.112121184421586 2.47129388197539 +175 -4.72131850682648 -1.6008946774115904 -3.6054426092000593 +158 -5.274680729271083 -0.4457302148856164 4.174272671309751 +85 2.9757034033315444 -0.5103121033627565 1.99919210117291 +63 1.600933165736236 1.4604641421860185 5.197681341346513 +133 0.3650834395918216 4.123541846312257 2.1615515366543354 +67 2.0607792864448453 2.3124375339420076 0.21959246817514527 +83 -6.156022387564482 -1.1548915743184078 -0.4948872456362283 +162 -2.1450070724040025 3.9286059442169066 2.007885747151935 +170 1.8166139807691821 -1.95234066921456 -1.8559861240898843 +181 -1.587457433365127 -3.2094890956838205 2.212401241994942 +71 1.7829689662908779 -3.6713609566551657 1.3773962271622693 +31 3.918178411733008 -0.5772484115851036 0.16726508680219976 +139 -4.560722486125075 -0.5471630166750243 5.863010868871481 +3 -3.9686726349917825 3.6173076990026054 2.5273959166862507 +108 0.3042801304200664 4.847444330423647 -0.35518169829313484 +16 -2.4685650045584717 5.98056595230015 0.9384145704518219 +110 -0.6129548866614436 1.8199747299312752 -0.6050782543434758 +50 -1.8884152067915962 -1.4877561250799833 -3.9811275374353494 +191 1.500896458072849 -1.9099553342822155 -5.024921011162899 +187 -2.013243274912701 -0.8604266013822317 -1.038480536601888 +180 1.4966822969502809 2.2104050426784707 3.732721924128324 +30 -2.3551911487538373 -1.0313809690434763 -1.4871503115129143 +2 2.4972367326603697 -1.5125466361921762 1.0762650051734106 +17 0.43112912988867413 -1.9548201848493156 -0.43017998184207773 +7 6.622180146484479 4.7673609572662725 0.19425898871224434 +164 2.301415823751322 0.4827221772498991 4.559127095693677 +69 -3.4364505629674733 -1.1594038113628669 -1.2078137888752072 +61 1.7869953777023173 0.9935547623401149 0.14745693195171444 +34 -0.027807484985171937 -3.1354780466577754 -1.036977576868685 +43 -1.3037743820903311 -5.61028065095172 -4.306710886889687 +177 2.1781720801097206 -1.516912077043328 -2.054689845757315 +179 0.4934049365569875 -4.8639422788504625 -6.225153590664796 +65 2.6970228261721383 0.19294320506195817 6.683323231860031 +27 -1.6731814501881797 0.7519385590564082 3.2183027406212203 +58 -0.7774753429967389 -0.6669437971456971 3.5183225900940927 +32 -5.389835933890947 -0.4954507654154201 0.4594525916972694 +26 0.7382474998065096 -3.102724138188651 -2.185686698723454 +142 -1.944479379421283 -1.2761486898263725 0.72348529709274 +100 -2.739025692998968 -2.6245009262596986 3.182008026346906 +184 1.4210317521782347 3.1395926369797884 5.319543188841913 +105 -1.2308708716614136 -1.2494207925918743 -3.3415190888725443 +75 -1.8835854547991517 -1.3807763884880995 3.052239941977269 +99 2.3501462152911015 -0.09098282020287418 -2.963130739502538 +193 3.2483282921859455 -6.045063326765766 -1.2297831607518321 +33 -1.5552221515820004 2.623852853566988 -0.3953508079233695 +79 2.0518370606822334 1.899510113710928 2.0859744201323727 +92 1.5026700715390955 0.9352029472761221 -5.528904283783295 +165 -2.240438523644089 -0.6103912799862421 0.40653914875448993 +199 -1.2653571662196268 3.710626862073433 1.4730516528440072 +70 1.655492430853343 0.17760859693009826 -1.650919734678463 +146 -1.4225048482747793 2.74232833480091 -3.413198079564811 +106 -1.093901348299414 0.20953760114868714 -0.7298112830112282 +52 6.647000075136453 -0.30141024565553315 1.2035752428962934 +86 0.6741589587443484 4.365068713763016 3.5677961016049315 +197 -0.666824417721529 0.7257967702216201 6.272517109849018 +185 -1.1845876194928404 2.1001111189632264 2.457366035714506 +190 -1.6517508143986053 2.271851696760304 3.7976228734124575 +145 -0.6660913411508007 -2.1887913545610314 1.427073342591097 +131 3.4923356345857024 1.8910870819349503 0.22757964871813297 +156 1.3901143776938099 -0.5912367128957199 -1.945898273856384 +10 -3.3254266550003906 2.363446512042732 -2.8505669909097167 +196 1.9772342503358795 2.9791453967072834 5.0702556945320305 +143 1.3619198656944898 -4.070780999483669 0.554762511858757 +13 -3.6607073229889986 -6.103961980753075 3.3895476442791126 +59 1.3424546798513801 -0.012418821554116527 -1.0607350515292961 +186 -0.19147109350375446 -0.14042042908600805 -5.06183250631794 +136 10.318783006250738 -0.33198398090799297 -3.1695432610471372 +62 -0.9320061937291512 -8.919718141167188 -1.0031472261072583 +192 -6.036717500669019 -0.4626110813075395 -5.283002697165421 +113 -1.9312339562598033 1.2868323831429733 -0.27836767602350954 +74 0.289298974376203 4.639184114550362 -1.3074893268836063 +118 2.3186362762712704 0.014757210175651903 -1.9096714905556824 +117 2.917320124569121 -0.927139463682407 -2.038093079844118 +23 3.445296199640721 -2.484450168397722 6.150025302403371 +171 -1.3488599922862394 -0.40015537573335275 5.541824987776105 +94 2.7016234671889183 -4.500360725821148 -0.3771036206116729 +41 0.040051409073174504 1.3144504850460685 -2.628956804481983 +141 0.8101589418958534 -0.40901282998394567 2.3777914588666906 +159 -2.168905163137191 -3.9077440516609387 3.1238186982134213 diff --git a/examples/PACKAGES/pimd/lj/in.lmp b/examples/PACKAGES/pimd/lj/in.lmp new file mode 100755 index 0000000000..9670225958 --- /dev/null +++ b/examples/PACKAGES/pimd/lj/in.lmp @@ -0,0 +1,28 @@ +variable ibead uloop 99 pad + +units metal +atom_style atomic +atom_modify map yes +boundary p p p +pair_style lj/cut 9.5251 +read_data data.metalnpt${ibead} + +pair_coeff * * 0.00965188 3.4 +pair_modify shift yes + +mass 1 39.948 + +timestep 0.001 + +velocity all create 0.0 ${ibead} + +fix 1 all pimd/langevin ensemble npt integrator obabo thermostat PILE_L 1234 tau 1.0 temp 113.15 iso 1.0 barostat BZP taup 1.0 fixcom no + +thermo_style custom step temp f_1[*] vol press +thermo 100 +thermo_modify norm no format line "%d %.16f %.16f %.16f %.16f %.16f %.16f %.16f %.16f %.16f %.16f %.16f %.16f %.16f %.16f %.16f %.16f %.16f %.16f %.16f %.16f %.16f %.16f %.16f" + +dump dcd all custom 100 ${ibead}.xyz id type xu yu zu vx vy vz ix iy iz fx fy fz +dump_modify dcd sort id format line "%d %d %.16f %.16f %.16f %.16f %.16f %.16f %d %d %d %.16f %.16f %.16f" + +run 1000 diff --git a/examples/PACKAGES/pimd/lj/run.sh b/examples/PACKAGES/pimd/lj/run.sh new file mode 100644 index 0000000000..2580ef1a41 --- /dev/null +++ b/examples/PACKAGES/pimd/lj/run.sh @@ -0,0 +1 @@ +mpirun -np 4 $LMP -in in.lmp -p 4x1 -log log -screen screen From 0dd8a6aea2e9183a4b88d13cf36de3307851ae9f Mon Sep 17 00:00:00 2001 From: Yifan Li Date: Mon, 20 Mar 2023 14:27:58 -0400 Subject: [PATCH 041/396] add document for keywords of fix pimd/langevin --- doc/src/fix_pimd.rst | 48 ++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 44 insertions(+), 4 deletions(-) diff --git a/doc/src/fix_pimd.rst b/doc/src/fix_pimd.rst index 28a5308dd7..d6808add44 100644 --- a/doc/src/fix_pimd.rst +++ b/doc/src/fix_pimd.rst @@ -24,7 +24,7 @@ Syntax *method* value = *pimd* or *nmpimd* or *cmd* *fmass* value = scaling factor on mass *sp* value = scaling factor on Planck constant - *temp* value = temperature (temperarate units) + *temp* value = temperature (temperature units) *nhc* value = Nc = number of chains in Nose-Hoover thermostat * keywords for style *pimd/langevin* @@ -35,8 +35,8 @@ Syntax *integrator* value = *obabo* or *baoab* *fmmode* value = *physical* or *normal* *fmass* value = scaling factor on mass - *temp* value = Temperature (temperarate unit) - Temperature = target temperarate of the thermostat + *temp* value = Temperature (temperature unit) + Temperature = target temperature of the thermostat *thermostat* values = style seed style value = *PILE_L* seed = random number generator seed @@ -180,6 +180,38 @@ The keyword *sp* is a scaling factor on Planck's constant, which can be useful for debugging or other purposes. The default value of 1.0 is appropriate for most situations. +The keyword *ensemble* for fix style *pimd/langevin* determines which ensemble is it +going to sample. The value can be *nve* (microcanonical), *nvt* (canonical), *nph* (isoenthalpic), and *npt* (isothermal-isobaric). + +The keyword *temp* specifies temperature parameter for fix styles *pimd/nvt* and *pimd/langevin*. It should read a +positive floating-point number. +.. note:: + For pimd simulations, a temperature values should be specified even for nve ensemble. Temperature will make a difference + for nve pimd, since the spring elastic frequency between the beads will be affected by the temperature. + +The keyword *thermostat* reads *style* and *seed* of thermostat for fix style *pimd/langevin*. *style* can only +be *PILE_L* (path integral Langevin equation local thermostat, as described in :ref:`(Manolopoulos) `), and *seed* should a positive integer number, which serves as the seed of the pseudo random number generator. + +.. note:: + The fix style *pimd/langevin* uses the stochastic PILE_L thermostat to control temperature. This thermostat works on the normal modes + of the ring polymer. The *tau* parameter controls the centroid mode, and the *scale* parameter controls the non-centroid modes. + +The keyword *tau* specifies the thermostat damping time parameter for fix style *pimd/langevin*. It is in time unit. It only works on the centroid mode. + +The keyword *scale* specifies a scaling parameter for the damping times of the non-centroid modes for fix style *pimd/langevin*. The default +damping time of the non-centroid mode $i$ is $\frac{P}{\beta\hbar}\sqrt{\lambda_i\times\mathrm{fmass}}$ (*fmmode* is *physical*) or $\frac{P}{\beta\hbar}\sqrt{\mathrm{fmass}}$ (*fmmode* is *normal*). The damping times of all non-centroid modes are the default values divided by *scale*. + +The barostat parameters for fix style *pimd/langevin* with *npt* or *nph* ensemble is specified using one of *iso* and *aniso* +keywords. A *pressure* value should be given with pressure unit. The keyword *iso* means couple all 3 diagonal components together when pressure is computed (hydrostatic pressure), and dilate/contract the dimensions together. The keyword *aniso* means x, y, and z dimensions are controlled independently using the Pxx, Pyy, and Pzz components of the stress tensor as the driving forces, and the specified scalar external pressure. + +The keyword *barostat* reads *style* of barostat for fix style *pimd/langevin*. *style* can +be *BZP* (Bussi-Zykova-Parrinello, as described in :ref:`(Parrinello1) `) or *MTTK* (Martyna-Tuckerman-Tobias-Klein, as described in :ref:`(Tuckerman2) `). + +The keyword *taup* specifies the barostat damping time parameter for fix style *pimd/langevin*. It is in time unit. + +The keyword *fixcom* specifies whether the center-of-mass of the extended ring-polymer system is fixed during the pimd simulation. +Once *fixcom* is set te be *yes*, the center-of-mass velocity will be distracted from the centroid-mode velocities in each step. + The PIMD algorithm in LAMMPS is implemented as a hyper-parallel scheme as described in :ref:`(Calhoun) `. In LAMMPS this is done by using :doc:`multi-replica feature ` in LAMMPS, where each @@ -314,4 +346,12 @@ Path Integrals, McGraw-Hill, New York (1965). .. _Manolopoulos: -**(Manolopoulos)** M. Ceriotti, M. Parrinello, T. Markland, D. Manolopoulos, J. Chem. Phys. 133, 124104 (2010). \ No newline at end of file +**(Manolopoulos)** M. Ceriotti, M. Parrinello, T. Markland, D. Manolopoulos, J. Chem. Phys. 133, 124104 (2010). + +.. _Klein: + +**(Klein)** G. Martyna, D. Tobias, M. Klein, J. Chem. Phys. 101, 4177 (1994). + +.. _Tuckerman2: + +**(Tuckerman2)** G. Martyna, A. Hughes, M. Tuckerman, J. Chem. Phys. 110, 3275 (1999). \ No newline at end of file From 3d47c5c6f0fccaf27bf9d81a74df25d29856ab2e Mon Sep 17 00:00:00 2001 From: Yifan Li Date: Tue, 21 Mar 2023 08:38:14 -0400 Subject: [PATCH 042/396] add x/y/z barostating options --- src/REPLICA/fix_pimd_langevin.cpp | 86 ++++++++++++++++++++++--------- src/REPLICA/fix_pimd_langevin.h | 4 +- 2 files changed, 65 insertions(+), 25 deletions(-) diff --git a/src/REPLICA/fix_pimd_langevin.cpp b/src/REPLICA/fix_pimd_langevin.cpp index e1d3960a50..d64d948ecf 100644 --- a/src/REPLICA/fix_pimd_langevin.cpp +++ b/src/REPLICA/fix_pimd_langevin.cpp @@ -101,6 +101,7 @@ FixPIMDLangevin::FixPIMDLangevin(LAMMPS *lmp, int narg, char **arg) : tau = 1.0; tau_p = 1.0; Pext = 1.0; + pdim = 0; pilescale = 1.0; tstat_flag = 1; pstat_flag = 0; @@ -112,7 +113,11 @@ FixPIMDLangevin::FixPIMDLangevin(LAMMPS *lmp, int narg, char **arg) : int seed = -1; - for (int i = 0; i < 6; i++) p_flag[i] = 0; + for (int i = 0; i < 6; i++) + { + p_flag[i] = 0; + p_target[i] = 0.0; + } for (int i = 3; i < narg - 1; i += 2) { if (strcmp(arg[i], "method") == 0) { @@ -199,9 +204,29 @@ FixPIMDLangevin::FixPIMDLangevin(LAMMPS *lmp, int narg, char **arg) : } else if (strcmp(arg[i], "iso") == 0) { pstyle = ISO; Pext = utils::numeric(FLERR, arg[i+1], false, lmp); + p_target[0] = p_target[1] = p_target[2] = Pext; + pdim = 3; } else if (strcmp(arg[i], "aniso") == 0) { pstyle = ANISO; + p_flag[0] = p_flag[1] = p_flag[2] = 1; Pext = utils::numeric(FLERR, arg[i+1], false, lmp); + p_target[0] = p_target[1] = p_target[2] = Pext; + pdim = 3; + } else if (strcmp(arg[i], "x") == 0) { + pstyle = ANISO; + p_flag[0] = 1; + p_target[0] = utils::numeric(FLERR, arg[i+1], false, lmp); + pdim++; + } else if (strcmp(arg[i], "y") == 0) { + pstyle = ANISO; + p_flag[1] = 1; + p_target[1] = utils::numeric(FLERR, arg[i+1], false, lmp); + pdim++; + } else if (strcmp(arg[i], "z") == 0) { + pstyle = ANISO; + p_flag[2] = 1; + p_target[2] = utils::numeric(FLERR, arg[i+1], false, lmp); + pdim++; } else if (strcmp(arg[i], "taup") == 0) { tau_p = utils::numeric(FLERR, arg[i + 1], false, lmp); if (tau_p <= 0.0) error->universe_all(FLERR, "Invalid tau_p value for fix pimd/langevin"); @@ -243,6 +268,7 @@ FixPIMDLangevin::FixPIMDLangevin(LAMMPS *lmp, int narg, char **arg) : fixedpoint[0] = 0.5 * (domain->boxlo[0] + domain->boxhi[0]); fixedpoint[1] = 0.5 * (domain->boxlo[1] + domain->boxhi[1]); fixedpoint[2] = 0.5 * (domain->boxlo[2] + domain->boxhi[2]); + if (pstat_flag) { p_hydro = (p_target[0]+p_target[1]+p_target[2])/pdim; } // initialize Marsaglia RNG with processor-unique seed @@ -670,8 +696,15 @@ void FixPIMDLangevin::qc_step() if (barostat == BZP) { for (int i = 0; i < nlocal; i++) { for (int j = 0; j < 3; j++) { - x[i][j] = expq[j] * x[i][j] + (expq[j] - expp[j]) / 2. / vw[j] * v[i][j]; - v[i][j] = expp[j] * v[i][j]; + if (p_flag[j]) + { + x[i][j] = expq[j] * x[i][j] + (expq[j] - expp[j]) / 2. / vw[j] * v[i][j]; + v[i][j] = expp[j] * v[i][j]; + } + else + { + x[i][j] += dtv * v[i][j]; + } } } oldlo = domain->boxlo[0]; @@ -762,7 +795,7 @@ void FixPIMDLangevin::press_v_step() if (pstyle == ISO) { if (barostat == BZP) { - vw[0] += dtv * 3 * (volume * np * (p_cv - Pext) / force->nktv2p + Vcoeff / beta_np) / W; + vw[0] += dtv * 3 * (volume * np * (p_cv - p_hydro) / force->nktv2p + Vcoeff / beta_np) / W; if (universe->iworld == 0) { double dvw_proc = 0.0, dvw = 0.0; for (int i = 0; i < nlocal; i++) { @@ -777,22 +810,25 @@ void FixPIMDLangevin::press_v_step() MPI_Bcast(&vw[0], 1, MPI_DOUBLE, 0, universe->uworld); } else if (barostat == MTTK) { mtk_term1 = 2. / atom->natoms * totke / 3; - f_omega = (volume * np * (p_md - Pext) + mtk_term1) / W; + f_omega = (volume * np * (p_md - p_hydro) + mtk_term1) / W; vw[0] += 0.5 * dtv * f_omega; } } else if (pstyle == ANISO) { compute_stress_tensor(); for (int ii = 0; ii < 3; ii++) { - vw[ii] += - dtv * (volume * np * (stress_tensor[ii] - Pext) / force->nktv2p + Vcoeff / beta_np) / W; - if (universe->iworld == 0) { - double dvw_proc = 0.0, dvw = 0.0; - for (int i = 0; i < nlocal; i++) { - dvw_proc += - dtv2 * f[i][ii] * v[i][ii] / W + dtv3 * f[i][ii] * f[i][ii] / mass[type[i]] / W; + if (p_flag[ii]) + { + vw[ii] += + dtv * (volume * np * (stress_tensor[ii] - p_hydro) / force->nktv2p + Vcoeff / beta_np) / W; + if (universe->iworld == 0) { + double dvw_proc = 0.0, dvw = 0.0; + for (int i = 0; i < nlocal; i++) { + dvw_proc += + dtv2 * f[i][ii] * v[i][ii] / W + dtv3 * f[i][ii] * f[i][ii] / mass[type[i]] / W; + } + MPI_Allreduce(&dvw_proc, &dvw, 1, MPI_DOUBLE, MPI_SUM, world); + vw[ii] += dvw; } - MPI_Allreduce(&dvw_proc, &dvw, 1, MPI_DOUBLE, MPI_SUM, world); - vw[ii] += dvw; } } } @@ -811,12 +847,14 @@ void FixPIMDLangevin::press_o_step() MPI_Bcast(&vw[0], 1, MPI_DOUBLE, 0, universe->uworld); } else if (pstyle == ANISO) { if (universe->me == 0) { - r1 = random->gaussian(); - r2 = random->gaussian(); - r3 = random->gaussian(); - vw[0] = c1 * vw[0] + c2 * sqrt(1.0 / W / beta_np) * r1; - vw[1] = c1 * vw[1] + c2 * sqrt(1.0 / W / beta_np) * r2; - vw[2] = c1 * vw[2] + c2 * sqrt(1.0 / W / beta_np) * r3; + for (int ii=0; ii<3; ii++) + { + if (p_flag[ii]) + { + r1 = random->gaussian(); + vw[ii] = c1 * vw[ii] + c2 * sqrt(1.0 / W / beta_np) * r1; + } + } } MPI_Barrier(universe->uworld); MPI_Bcast(&vw, 3, MPI_DOUBLE, 0, universe->uworld); @@ -1145,7 +1183,7 @@ void FixPIMDLangevin::remove_com_motion(){ int nlocal = atom->nlocal; if (dynamic) masstotal = group->mass(igroup); double vcm[3]; - group->vcm(igroup,masstotal,vcm); + group->vcm(igroup,masstotal,vcm); for (int i = 0; i < nlocal; i++) { if (mask[i] & groupbit) { v[i][0] -= vcm[0]; @@ -1329,15 +1367,15 @@ void FixPIMDLangevin::compute_totenthalpy() volume = domain->xprd * domain->yprd * domain->zprd; if (barostat == BZP) { if (pstyle == ISO) { - totenthalpy = tote + 0.5 * W * vw[0] * vw[0] * inverse_np + Pext * volume / force->nktv2p - + totenthalpy = tote + 0.5 * W * vw[0] * vw[0] * inverse_np + p_hydro * volume / force->nktv2p - Vcoeff * kBT * log(volume); } else if (pstyle == ANISO) { totenthalpy = tote + 0.5 * W * vw[0] * vw[0] * inverse_np + 0.5 * W * vw[1] * vw[1] * inverse_np + 0.5 * W * vw[2] * vw[2] * inverse_np + - Pext * volume / force->nktv2p - Vcoeff * kBT * log(volume); + p_hydro * volume / force->nktv2p - Vcoeff * kBT * log(volume); } } else if (barostat == MTTK) - totenthalpy = tote + 1.5 * W * vw[0] * vw[0] * inverse_np + Pext * (volume - vol0); + totenthalpy = tote + 1.5 * W * vw[0] * vw[0] * inverse_np + p_hydro * (volume - vol0); } /* ---------------------------------------------------------------------- */ diff --git a/src/REPLICA/fix_pimd_langevin.h b/src/REPLICA/fix_pimd_langevin.h index b8bed1a10f..6d236718c7 100644 --- a/src/REPLICA/fix_pimd_langevin.h +++ b/src/REPLICA/fix_pimd_langevin.h @@ -126,8 +126,10 @@ class FixPIMDLangevin : public Fix { double f_omega, mtk_term1; int pstat_flag; // pstat_flag = 1 if barostat is used int pstyle; // pstyle = ISO or ANISO (will support TRICLINIC in the future) - double W, tau_p, Pext, totenthalpy, Vcoeff; + double W, tau_p, Pext, p_hydro, totenthalpy, Vcoeff; + int pdim; int p_flag[6]; + double p_target[6]; double vw[6]; // barostat velocity double ke_tensor[6]; // kinetic energy tensor double c_vir_tensor[6]; // centroid-virial tensor From f94bea8d972d1f6f7064ebf599283a2d6b89e9d7 Mon Sep 17 00:00:00 2001 From: Yifan Li Date: Tue, 21 Mar 2023 09:22:37 -0400 Subject: [PATCH 043/396] correct fix pimd/langevin example file permission --- examples/PACKAGES/pimd/lj/in.lmp | 0 1 file changed, 0 insertions(+), 0 deletions(-) mode change 100755 => 100644 examples/PACKAGES/pimd/lj/in.lmp diff --git a/examples/PACKAGES/pimd/lj/in.lmp b/examples/PACKAGES/pimd/lj/in.lmp old mode 100755 new mode 100644 From 2cb9d2784bd3522911a456029ad3fd7b21f8522a Mon Sep 17 00:00:00 2001 From: Yifan Li Date: Tue, 21 Mar 2023 09:23:04 -0400 Subject: [PATCH 044/396] add false_positive for fix pimd/langevin doc --- doc/utils/sphinx-config/false_positives.txt | 3 +++ 1 file changed, 3 insertions(+) diff --git a/doc/utils/sphinx-config/false_positives.txt b/doc/utils/sphinx-config/false_positives.txt index 0f18e6822f..e8544a8975 100644 --- a/doc/utils/sphinx-config/false_positives.txt +++ b/doc/utils/sphinx-config/false_positives.txt @@ -2017,6 +2017,7 @@ Marchetti Marchi Mariella Marinica +Markland Marrink Marroquin Marsaglia @@ -3577,6 +3578,7 @@ THz Tigran Tij Tildesley +Timan timeI timespan timestamp @@ -4071,4 +4073,5 @@ zu zx zy Zybin +Zykova zz From 32efa1a3af3462c740afd90a1c2fdbbd02ef1e91 Mon Sep 17 00:00:00 2001 From: Yifan Li Date: Tue, 21 Mar 2023 09:23:22 -0400 Subject: [PATCH 045/396] update fix pimd/langevin doc --- doc/src/fix_pimd.rst | 87 +++++++++++++++++++++++++------------------- 1 file changed, 49 insertions(+), 38 deletions(-) diff --git a/doc/src/fix_pimd.rst b/doc/src/fix_pimd.rst index d6808add44..4d72d7232f 100644 --- a/doc/src/fix_pimd.rst +++ b/doc/src/fix_pimd.rst @@ -30,7 +30,8 @@ Syntax * keywords for style *pimd/langevin* .. parsed-literal:: - *keywords* = *method* or *integrator* or *ensemble* or *fmmode* or *fmass* or *scale* or *temp* or *thermostat* or *tau* or or *iso* or *aniso* or *barostat* or *taup* or *fixcom* or *lj* + *keywords* = *method* or *integrator* or *ensemble* or *fmmode* or *fmass* or *scale* or *temp* or *thermostat* or + *tau*or or *iso* or *aniso* or *barostat* or *taup* or *fixcom* or *lj* *method* value = *nmpimd* *integrator* value = *obabo* or *baoab* *fmmode* value = *physical* or *normal* @@ -43,7 +44,7 @@ Syntax *tau* value = thermostat damping parameter (time unit) *scale* value = scaling factor of the damping times of non-centroid modes of PILE_L thermostat *iso* or *aniso* values = Pressure (pressure unit) - Pressure = scalar external pressure of the barostat + Pressure = scalar external pressure of the barostat *barostat* value = *BZP* or *MTTK* *taup* value = barostat damping parameter (time unit) *fixcom* value = *yes* or *no* @@ -85,7 +86,7 @@ by the following equations: H_{eff} = & \bigg(\sum_{i=1}^P \frac{p_i^2}{2M_i}\bigg) + V_{eff} \\ V_{eff} = & \sum_{i=1}^P \bigg[ \frac{mP}{2\beta^2 \hbar^2} (q_i - q_{i+1})^2 + \frac{1}{P} V(q_i)\bigg] -$M_i$ is the fictitious mass of the $i$-th mode, and m is the actual mass of the atoms. +:math:`M_i` is the fictitious mass of the :math:`i`-th mode, and m is the actual mass of the atoms. The interested user is referred to any of the numerous references on this methodology, but briefly, each quantum particle in a path integral @@ -109,8 +110,9 @@ would be 3 x N x P x Nc. Fix *pimd/nvt* implements a complete velocity-verlet integrator combined with NH massive chain thermostat, so no other time integration fix should be used. + Fix *pimd/langevin* implements a complete velocity-verlet integrator - combined with Langevin thermostat in the normal mode representation, and + combined with Langevin thermostat in the normal mode representation, and also provides a barostat to sample the NPH/NPT ensembles. The *method* keyword determines what style of PIMD is performed. A @@ -136,7 +138,7 @@ normal-mode PIMD. A value of *cmd* is for centroid molecular dynamics the real particle. .. note:: - Fix pimd/langevin only supports *method* value *nmpimd*. This should be enough + Fix pimd/langevin only supports *method* value *nmpimd*. This should be enough for most PIMD applications for quantum thermodynamics purpose. Motion of the centroid can be effectively uncoupled from the other @@ -155,42 +157,51 @@ masses of beads, which can be used for the Partial Adiabatic CMD :ref:`(Hone) `, or to be set as P, which results in the fictitious masses to be equal to the real particle masses. -The keyword *fmmode* of *fix pimd/langevin* determines the mode of fictitious -mass preconditioning. There are two options: *physical* and *normal*. If *fmmode* is +The keyword *fmmode* of *fix pimd/langevin* determines the mode of fictitious +mass preconditioning. There are two options: *physical* and *normal*. If *fmmode* is *physical*, then the physical mass of the particles are used (and then multiplied by -*fmass*). If *fmmode* is *normal*, then the physical mass is first multiplied by the -eigenvalue of each normal mode, and then multiplied by *fmass*. More precisely, the +*fmass*). If *fmmode* is *normal*, then the physical mass is first multiplied by the +eigenvalue of each normal mode, and then multiplied by *fmass*. More precisely, the fictitious mass of *fix pimd/langevin* is determined by two factors: *fmmode* and *fmass*. If *fmmode* is *physical*, then the fictitious mass is -.. math:: - $M_i = \mathrm{fmass} \times m$ - -If *fmmode* is *normal*, then the fictitious mass is -.. math:: - $M_i = \mathrm{fmass} \times \lambda_i \times m$ -where $\lambda_i$ is the eigenvalue of the $i$-th normal mode. +.. math:: + + M_i = \mathrm{fmass} \times m + +If *fmmode* is *normal*, then the fictitious mass is + +.. math:: + + M_i = \mathrm{fmass} \times \lambda_i \times m + +where :math:`\lambda_i` is the eigenvalue of the :math:`i`-th normal mode. + .. note:: + Fictitious mass is only used in the momentum of the equation of motion - ($\bf{p}_i=M_i\bf{v}_i$), and not used in the spring elastic energy - ($\sum_{i=1}^P \frac{1}{2}m\omega_P^2(q_i - q_{i+1})^2$, $m$ is always the - actual mass of the particles). + (:math:`\mathbf{p}_i=M_i\mathbf{v}_i`), and not used in the spring elastic energy + (:math:`\sum_{i=1}^P \frac{1}{2}m\omega_P^2(q_i - q_{i+1})^2`, :math:`m` is always the + actual mass of the particles). The keyword *sp* is a scaling factor on Planck's constant, which can be useful for debugging or other purposes. The default value of 1.0 is appropriate for most situations. -The keyword *ensemble* for fix style *pimd/langevin* determines which ensemble is it -going to sample. The value can be *nve* (microcanonical), *nvt* (canonical), *nph* (isoenthalpic), and *npt* (isothermal-isobaric). +The keyword *ensemble* for fix style *pimd/langevin* determines which ensemble is it +going to sample. The value can be *nve* (microcanonical), *nvt* (canonical), *nph* (isoenthalpic), +and *npt* (isothermal-isobaric). + +The keyword *temp* specifies temperature parameter for fix styles *pimd/nvt* and *pimd/langevin*. It should read +a positive floating-point number. -The keyword *temp* specifies temperature parameter for fix styles *pimd/nvt* and *pimd/langevin*. It should read a -positive floating-point number. .. note:: + For pimd simulations, a temperature values should be specified even for nve ensemble. Temperature will make a difference for nve pimd, since the spring elastic frequency between the beads will be affected by the temperature. The keyword *thermostat* reads *style* and *seed* of thermostat for fix style *pimd/langevin*. *style* can only -be *PILE_L* (path integral Langevin equation local thermostat, as described in :ref:`(Manolopoulos) `), and *seed* should a positive integer number, which serves as the seed of the pseudo random number generator. +be *PILE_L* (path integral Langevin equation local thermostat, as described in :ref:`Ceriotti `), and *seed* should a positive integer number, which serves as the seed of the pseudo random number generator. .. note:: The fix style *pimd/langevin* uses the stochastic PILE_L thermostat to control temperature. This thermostat works on the normal modes @@ -199,21 +210,21 @@ be *PILE_L* (path integral Langevin equation local thermostat, as described in : The keyword *tau* specifies the thermostat damping time parameter for fix style *pimd/langevin*. It is in time unit. It only works on the centroid mode. The keyword *scale* specifies a scaling parameter for the damping times of the non-centroid modes for fix style *pimd/langevin*. The default -damping time of the non-centroid mode $i$ is $\frac{P}{\beta\hbar}\sqrt{\lambda_i\times\mathrm{fmass}}$ (*fmmode* is *physical*) or $\frac{P}{\beta\hbar}\sqrt{\mathrm{fmass}}$ (*fmmode* is *normal*). The damping times of all non-centroid modes are the default values divided by *scale*. +damping time of the non-centroid mode :math:`i` is :math:`\frac{P}{\beta\hbar}\sqrt{\lambda_i\times\mathrm{fmass}}` (*fmmode* is *physical*) or :math:`\frac{P}{\beta\hbar}\sqrt{\mathrm{fmass}}` (*fmmode* is *normal*). The damping times of all non-centroid modes are the default values divided by *scale*. -The barostat parameters for fix style *pimd/langevin* with *npt* or *nph* ensemble is specified using one of *iso* and *aniso* +The barostat parameters for fix style *pimd/langevin* with *npt* or *nph* ensemble is specified using one of *iso* and *aniso* keywords. A *pressure* value should be given with pressure unit. The keyword *iso* means couple all 3 diagonal components together when pressure is computed (hydrostatic pressure), and dilate/contract the dimensions together. The keyword *aniso* means x, y, and z dimensions are controlled independently using the Pxx, Pyy, and Pzz components of the stress tensor as the driving forces, and the specified scalar external pressure. The keyword *barostat* reads *style* of barostat for fix style *pimd/langevin*. *style* can -be *BZP* (Bussi-Zykova-Parrinello, as described in :ref:`(Parrinello1) `) or *MTTK* (Martyna-Tuckerman-Tobias-Klein, as described in :ref:`(Tuckerman2) `). +be *BZP* (Bussi-Zykova-Parrinello, as described in :ref:`Bussi `) or *MTTK* (Martyna-Tuckerman-Tobias-Klein, as described in :ref:`Martyna1 ` and :ref:`Martyna2 `). The keyword *taup* specifies the barostat damping time parameter for fix style *pimd/langevin*. It is in time unit. -The keyword *fixcom* specifies whether the center-of-mass of the extended ring-polymer system is fixed during the pimd simulation. -Once *fixcom* is set te be *yes*, the center-of-mass velocity will be distracted from the centroid-mode velocities in each step. +The keyword *fixcom* specifies whether the center-of-mass of the extended ring-polymer system is fixed during the pimd simulation. +Once *fixcom* is set to be *yes*, the center-of-mass velocity will be distracted from the centroid-mode velocities in each step. The PIMD algorithm in LAMMPS is implemented as a hyper-parallel scheme -as described in :ref:`(Calhoun) `. In LAMMPS this is done by using +as described in :ref:`Calhoun `. In LAMMPS this is done by using :doc:`multi-replica feature ` in LAMMPS, where each quasi-particle system is stored and simulated on a separate partition of processors. The following diagram illustrates this approach. The @@ -340,18 +351,18 @@ Path Integrals, McGraw-Hill, New York (1965). **(Herman)** M. F. Herman, E. J. Bruskin, B. J. Berne, J Chem Phys, 76, 5150 (1982). -.. _Parrinello1: +.. _Bussi: -**(Parrinello1)** G. Bussi, T. Zykova-Timan, M. Parrinello, J Chem Phys, 130, 074101 (2009). +**(Bussi)** G. Bussi, T. Zykova-Timan, M. Parrinello, J Chem Phys, 130, 074101 (2009). -.. _Manolopoulos: +.. _Ceriotti: -**(Manolopoulos)** M. Ceriotti, M. Parrinello, T. Markland, D. Manolopoulos, J. Chem. Phys. 133, 124104 (2010). +**(Ceriotti)** M. Ceriotti, M. Parrinello, T. Markland, D. Manolopoulos, J. Chem. Phys. 133, 124104 (2010). -.. _Klein: +.. _Martyna1: -**(Klein)** G. Martyna, D. Tobias, M. Klein, J. Chem. Phys. 101, 4177 (1994). +**(Martyna1)** G. Martyna, D. Tobias, M. Klein, J. Chem. Phys. 101, 4177 (1994). -.. _Tuckerman2: +.. _Martyna2: -**(Tuckerman2)** G. Martyna, A. Hughes, M. Tuckerman, J. Chem. Phys. 110, 3275 (1999). \ No newline at end of file +**(Martyna2)** G. Martyna, A. Hughes, M. Tuckerman, J. Chem. Phys. 110, 3275 (1999). From 2c0ac8299640305499f46f48b5641b8734456d9f Mon Sep 17 00:00:00 2001 From: Yifan Li Date: Tue, 21 Mar 2023 09:54:29 -0400 Subject: [PATCH 046/396] update doc press -> iso --- doc/src/fix_pimd.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/src/fix_pimd.rst b/doc/src/fix_pimd.rst index 4d72d7232f..75ba85bc96 100644 --- a/doc/src/fix_pimd.rst +++ b/doc/src/fix_pimd.rst @@ -61,7 +61,7 @@ Examples .. code-block:: LAMMPS fix 1 all pimd/nvt method nmpimd fmass 1.0 sp 2.0 temp 300.0 nhc 4 - fix 1 all pimd/langevin ensemble npt integrator obabo temp 113.15 thermostat PILE_L 1234 tau 1.0 press 1.0 barostat BZP taup 1.0 iso + fix 1 all pimd/langevin ensemble npt integrator obabo temp 113.15 thermostat PILE_L 1234 tau 1.0 iso 1.0 barostat BZP taup 1.0 Description """"""""""" From af8d4788b8bd4545ef88e098c6dc99a702862866 Mon Sep 17 00:00:00 2001 From: Yifan Li Date: Tue, 21 Mar 2023 10:11:37 -0400 Subject: [PATCH 047/396] fix doc errors --- doc/src/fix_pimd.rst | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/doc/src/fix_pimd.rst b/doc/src/fix_pimd.rst index 75ba85bc96..db6700633f 100644 --- a/doc/src/fix_pimd.rst +++ b/doc/src/fix_pimd.rst @@ -30,21 +30,20 @@ Syntax * keywords for style *pimd/langevin* .. parsed-literal:: - *keywords* = *method* or *integrator* or *ensemble* or *fmmode* or *fmass* or *scale* or *temp* or *thermostat* or - *tau*or or *iso* or *aniso* or *barostat* or *taup* or *fixcom* or *lj* + *keywords* = *method* or *integrator* or *ensemble* or *fmmode* or *fmass* or *scale* or *temp* or *thermostat* or *tau* or *iso* or *aniso* or *barostat* or *taup* or *fixcom* or *lj* *method* value = *nmpimd* *integrator* value = *obabo* or *baoab* *fmmode* value = *physical* or *normal* *fmass* value = scaling factor on mass - *temp* value = Temperature (temperature unit) - Temperature = target temperature of the thermostat + *temp* value = temperature (temperature unit) + temperature = target temperature of the thermostat *thermostat* values = style seed style value = *PILE_L* seed = random number generator seed *tau* value = thermostat damping parameter (time unit) *scale* value = scaling factor of the damping times of non-centroid modes of PILE_L thermostat - *iso* or *aniso* values = Pressure (pressure unit) - Pressure = scalar external pressure of the barostat + *iso* or *aniso* values = pressure (pressure unit) + pressure = scalar external pressure of the barostat *barostat* value = *BZP* or *MTTK* *taup* value = barostat damping parameter (time unit) *fixcom* value = *yes* or *no* From 5c94806a1d307d5552adeecf634fb9221abb1d71 Mon Sep 17 00:00:00 2001 From: Yifan Li Date: Thu, 23 Mar 2023 01:59:38 -0400 Subject: [PATCH 048/396] update doc --- doc/src/fix_pimd.rst | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/doc/src/fix_pimd.rst b/doc/src/fix_pimd.rst index db6700633f..eca58a409d 100644 --- a/doc/src/fix_pimd.rst +++ b/doc/src/fix_pimd.rst @@ -95,8 +95,10 @@ beads on the other ring-polymers with the same imaginary time index (the second term in the effective potential above). The quasi-beads also interact with the two neighboring quasi-beads through the spring potential in imaginary-time space (first term in effective potential). -To sample the canonical ensemble, a Nose-Hoover massive chain thermostat -is applied :ref:`(Tuckerman) `. With the massive chain +To sample the canonical ensemble, any thermostat can be applied. + +Fix *pimd/nvt* applies a Nose-Hoover massive chain thermostat +:ref:`(Tuckerman) `. With the massive chain algorithm, a chain of NH thermostats is coupled to each degree of freedom for each quasi-bead. The keyword *temp* sets the target temperature for the system and the keyword *nhc* sets the number *Nc* of @@ -104,16 +106,15 @@ thermostats in each chain. For example, for a simulation of N particles with P beads in each ring-polymer, the total number of NH thermostats would be 3 x N x P x Nc. +Fix *pimd/langevin* implements a Langevin thermostat in the normal mode +representation, and also provides a barostat to sample the NPH/NPT ensembles. + .. note:: - Fix *pimd/nvt* implements a complete velocity-verlet integrator - combined with NH massive chain thermostat, so no other time + Both these *fix* styles implement a complete velocity-verlet integrator + combined with a thermostat, so no other time integration fix should be used. - Fix *pimd/langevin* implements a complete velocity-verlet integrator - combined with Langevin thermostat in the normal mode representation, and - also provides a barostat to sample the NPH/NPT ensembles. - The *method* keyword determines what style of PIMD is performed. A value of *pimd* is standard PIMD. A value of *nmpimd* is for normal-mode PIMD. A value of *cmd* is for centroid molecular dynamics From 83b4e18704843c86de7cf26e91bae18851b6165a Mon Sep 17 00:00:00 2001 From: Yifan Li Date: Thu, 23 Mar 2023 21:05:07 -0400 Subject: [PATCH 049/396] update doc --- doc/src/fix_pimd.rst | 36 ++++++++++++++++++++++++++++-------- 1 file changed, 28 insertions(+), 8 deletions(-) diff --git a/doc/src/fix_pimd.rst b/doc/src/fix_pimd.rst index eca58a409d..78aa5fa107 100644 --- a/doc/src/fix_pimd.rst +++ b/doc/src/fix_pimd.rst @@ -112,8 +112,7 @@ representation, and also provides a barostat to sample the NPH/NPT ensembles. .. note:: Both these *fix* styles implement a complete velocity-verlet integrator - combined with a thermostat, so no other time - integration fix should be used. + combined with a thermostat, so no other time integration fix should be used. The *method* keyword determines what style of PIMD is performed. A value of *pimd* is standard PIMD. A value of *nmpimd* is for @@ -121,7 +120,7 @@ normal-mode PIMD. A value of *cmd* is for centroid molecular dynamics (CMD). The difference between the styles is as follows. In standard PIMD, the value used for a bead's fictitious mass is - arbitrary. A common choice is to use Mi = m/P, which results in the + arbitrary. A common choice is to use :math:`M_i = m/P`, which results in the mass of the entire ring-polymer being equal to the real quantum particle. But it can be difficult to efficiently integrate the equations of motion for the stiff harmonic interactions in the ring @@ -152,6 +151,10 @@ normal-mode PIMD. A value of *cmd* is for centroid molecular dynamics only the k > 0 modes are thermostatted, not the centroid degrees of freedom. +The keyword *integrator* specifies the Trotter splitting method used by *fix pimd/langevin*. +See :ref:`(Liu) ` for a discussion on the OBABO and BAOAB splitting schemes. Typically +either of the two should work fine. + The keyword *fmass* sets a further scaling factor for the fictitious masses of beads, which can be used for the Partial Adiabatic CMD :ref:`(Hone) `, or to be set as P, which results in the fictitious @@ -201,7 +204,7 @@ a positive floating-point number. for nve pimd, since the spring elastic frequency between the beads will be affected by the temperature. The keyword *thermostat* reads *style* and *seed* of thermostat for fix style *pimd/langevin*. *style* can only -be *PILE_L* (path integral Langevin equation local thermostat, as described in :ref:`Ceriotti `), and *seed* should a positive integer number, which serves as the seed of the pseudo random number generator. +be *PILE_L* (path integral Langevin equation local thermostat, as described in :ref:`Ceriotti `), and *seed* should a positive integer number, which serves as the seed of the pseudo random number generator. .. note:: The fix style *pimd/langevin* uses the stochastic PILE_L thermostat to control temperature. This thermostat works on the normal modes @@ -216,7 +219,7 @@ The barostat parameters for fix style *pimd/langevin* with *npt* or *nph* ensemb keywords. A *pressure* value should be given with pressure unit. The keyword *iso* means couple all 3 diagonal components together when pressure is computed (hydrostatic pressure), and dilate/contract the dimensions together. The keyword *aniso* means x, y, and z dimensions are controlled independently using the Pxx, Pyy, and Pzz components of the stress tensor as the driving forces, and the specified scalar external pressure. The keyword *barostat* reads *style* of barostat for fix style *pimd/langevin*. *style* can -be *BZP* (Bussi-Zykova-Parrinello, as described in :ref:`Bussi `) or *MTTK* (Martyna-Tuckerman-Tobias-Klein, as described in :ref:`Martyna1 ` and :ref:`Martyna2 `). +be *BZP* (Bussi-Zykova-Parrinello, as described in :ref:`Bussi `) or *MTTK* (Martyna-Tuckerman-Tobias-Klein, as described in :ref:`Martyna1 ` and :ref:`Martyna2 `). The keyword *taup* specifies the barostat damping time parameter for fix style *pimd/langevin*. It is in time unit. @@ -258,9 +261,18 @@ related tasks for each of the partitions, e.g. .. code-block:: LAMMPS dump dcd all dcd 10 system_${ibead}.dcd + dump 1 all custom 100 ${ibead}.xyz id type x y z vx vy vz ix iy iz fx fy fz restart 1000 system_${ibead}.restart1 system_${ibead}.restart2 read_restart system_${ibead}.restart2 +.. note:: + Fix *pimd/langevin* dumps the Catersian coordinates, but dumps the velocities and + forces in the normal mode representation. If the Catersian velocities and forces are + needed, it is easy to perform the transformation when doing post-processing. + + It is recommended to dump the image flags (*ix iy iz*) for fix *pimd/langevin*. It + will be useful if you want to calculate some estimators during post-processing. + Restart, fix_modify, output, run start/stop, minimize info """"""""""""""""""""""""""""""""""""""""""""""""""""""""""" @@ -287,6 +299,10 @@ the global vector are: The vector values calculated by fix *pimd/nvt* are "extensive", except for the temperature, which is "intensive". +Fix *pimd/langevin* computes a global vector of quantities, which +can be accessed by various :doc:`output commands `. If *ensemble* +is *nve* or *nvt*, the vector has 10 values. + No parameter of fix *pimd/nvt* can be used with the *start/stop* keywords of the :doc:`run ` command. Fix *pimd/nvt* is not invoked during :doc:`energy minimization `. @@ -355,14 +371,18 @@ Path Integrals, McGraw-Hill, New York (1965). **(Bussi)** G. Bussi, T. Zykova-Timan, M. Parrinello, J Chem Phys, 130, 074101 (2009). -.. _Ceriotti: +.. _Ceriotti2: **(Ceriotti)** M. Ceriotti, M. Parrinello, T. Markland, D. Manolopoulos, J. Chem. Phys. 133, 124104 (2010). -.. _Martyna1: +.. _Martyna3: **(Martyna1)** G. Martyna, D. Tobias, M. Klein, J. Chem. Phys. 101, 4177 (1994). -.. _Martyna2: +.. _Martyna4: **(Martyna2)** G. Martyna, A. Hughes, M. Tuckerman, J. Chem. Phys. 110, 3275 (1999). + +.. _Liujian: + +**(Liu)** J. Liu, D. Li, X. Liu, J. Chem. Phys. 145, 024103 (2016). From 4e4ae34de601159ffaf8af10eacefeab57781570 Mon Sep 17 00:00:00 2001 From: Yifan Li Date: Mon, 27 Mar 2023 22:16:41 -0400 Subject: [PATCH 050/396] update doc with output info and reduced unit instructions --- doc/src/fix_pimd.rst | 66 +++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 62 insertions(+), 4 deletions(-) diff --git a/doc/src/fix_pimd.rst b/doc/src/fix_pimd.rst index 78aa5fa107..e4a59b0078 100644 --- a/doc/src/fix_pimd.rst +++ b/doc/src/fix_pimd.rst @@ -226,6 +226,9 @@ The keyword *taup* specifies the barostat damping time parameter for fix style * The keyword *fixcom* specifies whether the center-of-mass of the extended ring-polymer system is fixed during the pimd simulation. Once *fixcom* is set to be *yes*, the center-of-mass velocity will be distracted from the centroid-mode velocities in each step. +The keyword *lj* should be used if :doc:`lj units ` is used for *fix pimd/langevin*. Typically one may want to use +reduced units to run the simulation, and then convert the results into some physical units (for example, :doc:`metal units `). In this case, the 5 quantities in the physical mass units are needed: epsilon (energy scale), sigma (length scale), mass, Planck's constant, mvv2e (mass * velocity^2 to energy conversion factor). Planck's constant and mvv2e can be found in src/update.cpp. If there is no need to convert reduced units to physical units, set all these five value to 1. + The PIMD algorithm in LAMMPS is implemented as a hyper-parallel scheme as described in :ref:`Calhoun `. In LAMMPS this is done by using :doc:`multi-replica feature ` in LAMMPS, where each @@ -300,11 +303,65 @@ The vector values calculated by fix *pimd/nvt* are "extensive", except for the temperature, which is "intensive". Fix *pimd/langevin* computes a global vector of quantities, which -can be accessed by various :doc:`output commands `. If *ensemble* -is *nve* or *nvt*, the vector has 10 values. +can be accessed by various :doc:`output commands `. Note that +it outputs multiple log files, and different log files contain information +about different beads or modes (see detailed explanations below). If *ensemble* +is *nve* or *nvt*, the vector has 10 values: -No parameter of fix *pimd/nvt* can be used with the *start/stop* keywords -of the :doc:`run ` command. Fix *pimd/nvt* is not invoked during + #. kinetic energy of the normal mode + #. spring elastic energy of the normal mode + #. potential energy of the bead + #. total energy of all beads (conserved if *ensemble* is *nve*) + #. primitive kinetic energy estimator + #. virial energy estimator + #. centroid-virial energy estimator + #. primitive pressure estimator + #. thermodynamic pressure estimator + #. centroid-virial pressure estimator + +The first 3 are different for different log files, and the others are the same for different log files. + +If *ensemble* is *nph* or *npt*, the vector stores internal variables of the barostat. If *iso* is used, +the vector has 15 values: + + #. kinetic energy of the normal mode + #. spring elastic energy of the normal mode + #. potential energy of the bead + #. total energy of all beads (conserved if *ensemble* is *nve*) + #. primitive kinetic energy estimator + #. virial energy estimator + #. centroid-virial energy estimator + #. primitive pressure estimator + #. thermodynamic pressure estimator + #. centroid-virial pressure estimator + #. barostat velocity + #. barostat kinetic energy + #. barostat potential energy + #. barostat cell Jacobian + #. enthalpy of the extended system (sum of 4, 12, 13, and 14; conserved if *ensemble* is *nph*) + +If *aniso* or *x* or *y* or *z* is used for the barostat, the vector has 17 values: + + #. kinetic energy of the normal mode + #. spring elastic energy of the normal mode + #. potential energy of the bead + #. total energy of all beads (conserved if *ensemble* is *nve*) + #. primitive kinetic energy estimator + #. virial energy estimator + #. centroid-virial energy estimator + #. primitive pressure estimator + #. thermodynamic pressure estimator + #. centroid-virial pressure estimator + #. x component of barostat velocity + #. y component of barostat velocity + #. z component of barostat velocity + #. barostat kinetic energy + #. barostat potential energy + #. barostat cell Jacobian + #. enthalpy of the extended system (sum of 4, 14, 15, and 16; conserved if *ensemble* is *nph*) + +No parameter of fix *pimd/nvt* or *pimd/langevin* can be used with the *start/stop* keywords +of the :doc:`run ` command. Fix *pimd/nvt* or *pimd/langevin* is not invoked during :doc:`energy minimization `. Restrictions @@ -315,6 +372,7 @@ LAMMPS was built with that package. See the :doc:`Build package ` page for more info. Fix *pimd/nvt* cannot be used with :doc:`lj units `. +Fix *pimd/langevin* can be used with :doc:`lj units `. See the above part for how to use it. A PIMD simulation can be initialized with a single data file read via the :doc:`read_data ` command. However, this means all From 561f80ccc731715049fcaa9c9663944089c4353a Mon Sep 17 00:00:00 2001 From: Yifan Li Date: Mon, 27 Mar 2023 22:21:38 -0400 Subject: [PATCH 051/396] add example for fix pimd/langevin with reduced units --- .../PACKAGES/pimd/lj_reduced_units/data.lj01 | 219 ++++++++++++++++++ .../PACKAGES/pimd/lj_reduced_units/data.lj02 | 219 ++++++++++++++++++ .../PACKAGES/pimd/lj_reduced_units/in.lmp | 26 +++ .../PACKAGES/pimd/lj_reduced_units/run.sh | 1 + 4 files changed, 465 insertions(+) create mode 100644 examples/PACKAGES/pimd/lj_reduced_units/data.lj01 create mode 100644 examples/PACKAGES/pimd/lj_reduced_units/data.lj02 create mode 100644 examples/PACKAGES/pimd/lj_reduced_units/in.lmp create mode 100644 examples/PACKAGES/pimd/lj_reduced_units/run.sh diff --git a/examples/PACKAGES/pimd/lj_reduced_units/data.lj01 b/examples/PACKAGES/pimd/lj_reduced_units/data.lj01 new file mode 100644 index 0000000000..e3d6b816a3 --- /dev/null +++ b/examples/PACKAGES/pimd/lj_reduced_units/data.lj01 @@ -0,0 +1,219 @@ +LAMMPS data file via write_data, version 8 Feb 2023, timestep = 2000 + +200 atoms +1 atom types + +-3.4945130603740377 3.4945130603740377 xlo xhi +-3.4945130603740377 3.4945130603740377 ylo yhi +-3.4945130603740377 3.4945130603740377 zlo zhi + +Masses + +1 1 + +Pair Coeffs # lj/cut + +1 1 1 + +Atoms # atomic + +108 1 -2.7795690566068996 -2.0367677788080942 3.4238258338844894 2 1 -1 +102 1 -2.609481280743025 -1.8912619121268304 -2.399753092988466 1 -1 -1 +141 1 -3.140749645549514 -2.8903241627869427 -2.7071762462261537 2 0 0 +49 1 -2.3658136681990007 -3.088812044820056 3.4760124445890623 0 1 -1 +88 1 -1.6158710173914035 -2.3369020600614756 3.233517474511907 0 1 -1 +192 1 -1.2960228223928079 -3.237522585981233 -3.1506262911155765 1 1 2 +113 1 -0.5058112539671865 -2.175265580488635 -2.895948573481031 -1 0 0 +147 1 -0.22721902013037146 -3.2095321965856187 -2.5444416457809185 0 1 0 +55 1 0.6250447384071113 -2.6446349401275255 -2.959767417439857 -1 0 -1 +63 1 1.6783992808137906 -3.22203513406057 -3.1652676844989256 -1 1 1 +95 1 1.3579478870419064 -2.684729254303277 -2.052496056604152 0 2 -1 +105 1 1.4496281787006915 -1.9673030959679096 -3.332658945278261 0 0 0 +84 1 2.4045875426768606 -1.8297724699275564 -2.7874627893944544 0 0 0 +65 1 -2.68682939849047 -0.8114540186440395 -3.126687818057689 0 -1 0 +112 1 -1.7203801180145006 -0.8038481618523634 -2.0163240721427838 0 0 0 +174 1 -1.4968933339977661 -1.3290620346554367 -3.064010040861048 -1 0 -1 +189 1 -0.6249709402997541 -1.252931712435372 -1.9882716349469658 0 0 2 +9 1 -0.23886293275872486 -1.0612344376875333 -3.025432389188406 0 0 1 +146 1 -0.9802936024515303 -0.3953988402073487 -2.8364522494017708 2 1 2 +171 1 0.39730078560778914 -1.7846492070113664 -2.443607407553737 0 2 -1 +140 1 0.5573788374911133 -0.5990036144148324 -2.402963062521378 -1 0 0 +152 1 3.4379847727225346 -1.3055938268830742 -2.4905074589410936 -2 -1 0 +11 1 3.1992117767992068 -1.191883736793153 -3.4723419170834338 -1 2 1 +69 1 2.6376153053668867 -0.2845436411244765 -2.788279844473203 0 -2 0 +173 1 -1.967038944001471 0.06098718735032446 -2.58940519609616 1 0 1 +190 1 -2.8711350478349926 0.9129034739862979 -3.477848194666021 0 0 0 +164 1 -2.8409776961511124 1.1599509265598786 -2.2464830240939375 0 0 1 +161 1 -1.6469671018177567 0.9360204597700993 -3.3491365145788827 1 0 2 +74 1 -0.028453987680887038 0.3739399392930446 -2.9891764409930484 1 -1 1 +162 1 -0.9152119867762214 1.8538003710645874 -2.0787458665529313 0 0 1 +165 1 0.20472499231506947 0.41157279287578097 -1.7804952487691292 0 0 0 +28 1 0.9556568956317052 0.9070586383550882 -3.051580171737043 0 -1 -1 +107 1 0.27101548210140264 1.6697625775553313 3.256398876364515 -1 1 0 +53 1 -2.2768986954542476 1.9520208666344268 -2.905899876141582 -1 -1 1 +60 1 -2.3748565234893153 3.1415519659534046 -2.6903226937570888 1 1 0 +172 1 -1.3831407623603917 2.6439383680022495 -2.988114399273657 0 0 2 +35 1 -1.9040946957475922 2.4850230251463294 -1.8238074088896814 1 -1 0 +90 1 -0.6407155002729499 2.891205873820353 -2.184576201275668 0 -1 1 +183 1 -0.7452468270399182 1.6958511415691964 -3.2646018242495516 1 0 0 +46 1 -0.22701759376730096 2.672935498985858 -3.2296828094464414 1 -1 -1 +26 1 0.3607641531328818 1.9915770180932266 -2.4322620664253045 0 -1 1 +41 1 0.6373758855225722 3.1576967379383136 -2.2076729513672273 0 0 1 +62 1 1.2599715479139464 2.4637352645229535 -2.996655642771261 0 0 1 +114 1 0.7095094175128512 3.3529225376529834 -3.446569928809617 0 -1 1 +29 1 -3.4441516076858747 3.186682881361427 -3.164290558791177 1 -1 0 +120 1 -2.7699397214807666 -3.0679149510930377 -1.4586405778286127 2 1 1 +166 1 -2.9639598123456348 -1.8230569851379879 -1.1336421298957986 0 1 0 +19 1 -2.219481001384856 -2.718720936926987 -0.17152653954078959 1 1 -1 +143 1 -3.3367462911096637 -2.646710289319255 -0.08639804580378332 1 1 0 +14 1 -0.8080539703460301 -3.3138674801902015 -1.5513416052298858 -1 0 1 +17 1 -1.2519028473371163 -1.9834151764617522 -0.4751925051419198 -2 0 0 +7 1 -0.6422036076119758 -2.1822637849150257 -1.309964136714573 -1 0 1 +76 1 0.002896678458885543 -2.2620445897063184 -0.2330303144789453 0 0 0 +25 1 0.3195487317939559 -2.5915964162672633 -1.6847661018972104 -1 0 1 +122 1 0.9437732996524034 -3.076308154774796 -1.0301951566376644 1 0 -1 +188 1 1.3149323047475332 -2.0202232851439175 -0.9332517483120624 -1 0 0 +196 1 2.4252816482051065 -2.9991133261256717 -0.2915609413585816 0 2 1 +154 1 1.617010887740887 -2.199305270305938 0.15712874770371849 -1 2 0 +64 1 2.934967635633404 -1.92620475221537 -0.7077313528493354 0 1 0 +79 1 -2.8111804533557017 -0.5176533778232942 -2.0486672107634094 0 1 0 +80 1 -2.079807139196039 -1.2506968999173758 -0.6878784167189951 0 0 1 +12 1 -2.996784469690298 -1.494057160171672 -0.09378065633433766 0 0 1 +87 1 -1.4786937501974577 -0.24572242955022147 -1.0411298155891553 0 -1 1 +118 1 -1.5219571471797697 -0.6469152337096267 0.07790607124041445 0 1 0 +106 1 1.1039107347748043 -0.9982945968846851 -1.4358613477546331 -1 0 0 +6 1 0.2994229743009 -1.5755502164022743 -1.1025451212735877 2 0 0 +98 1 0.14422647245316755 -0.4562748967814887 -1.1288823927075846 -1 0 0 +36 1 1.117403260546369 -0.6258611972204157 -0.45746732579129296 1 -1 0 +133 1 0.859517194013173 -1.4579095853876511 0.2223121798831755 1 1 1 +1 1 1.9750704226304612 -1.2226584851722493 -0.5050391499153623 0 -1 0 +91 1 2.930212504963826 -0.8900603772487206 0.31326990070574257 0 -1 -1 +135 1 -1.8704119131145511 1.4151617424236407 -2.0299493395071555 1 0 0 +145 1 -2.5978280185456044 0.23771261564216897 -0.6973478660383656 0 -2 -1 +194 1 -0.802106175542123 1.5380363524561962 -1.0014646333327863 0 1 -1 +177 1 -0.4209642163497379 1.4081511815239465 0.048786606404428355 0 1 -1 +56 1 0.1655081354187105 0.488612868229853 -0.6685586469118172 0 0 1 +137 1 1.0403444543974962 0.29392106264506496 -1.157047853549803 -1 1 -1 +3 1 1.426791637331859 1.1994824011018168 -0.7391487398561316 0 -1 1 +125 1 0.6384933993980926 1.4087406696008793 -0.04513978672724809 0 1 0 +85 1 3.492386221258323 -0.022918569575539983 -0.18415289757087 1 0 1 +37 1 1.9446560065460998 0.32690249887078415 -1.557848909197346 1 0 1 +157 1 2.2693311785439514 1.4234672203444076 -1.3950756204319474 -1 -1 1 +81 1 2.2043144165939133 0.7734976358785483 -0.1443989261496442 -1 0 1 +193 1 -2.800913203549158 3.3913795040038752 -0.3002902442199323 1 0 0 +127 1 -1.832485514575906 -3.475177695698571 -1.0143919033965547 0 0 0 +104 1 -0.9864189902172598 -3.128510029811542 -0.3946109581791233 0 0 -1 +72 1 -1.091863924309645 2.651695772194485 -1.1525574140711645 1 -1 0 +99 1 -1.376188772302252 2.1367308970905112 -0.22414000562735564 0 -1 0 +24 1 1.0798151658945965 1.8088284522753606 -1.611839691529319 1 -1 0 +42 1 3.3099578488331143 2.7636832208891664 -0.11775790598994411 -1 1 -1 +38 1 -2.6469918571054945 -2.446265188540552 0.8006326688775777 1 0 1 +86 1 -3.3982593364606077 -1.9911707046121028 1.4129412590921573 -1 0 0 +116 1 -3.3782151164102614 3.3939134790192074 0.6418244028431277 1 0 0 +144 1 -2.152212571536467 -2.8119708535854224 1.6778364082976118 0 1 0 +179 1 -0.8263021362457004 -1.7214596406733806 0.6812305480127513 -1 3 1 +151 1 -1.5217298498042864 -2.5933593936403763 0.7963122225368328 0 1 2 +130 1 -0.41366866285633624 -2.851509016203123 0.6773665297002652 -1 1 0 +149 1 -0.8196954968551895 -2.4620140380344058 1.6681749543249536 1 1 0 +123 1 0.42149982032625755 -2.3318080821151144 1.1400194349387576 -1 1 -1 +142 1 1.7676090653529768 -2.7694388971884765 1.0411093428968425 1 1 0 +43 1 1.2651581412723922 -1.7350310325188918 1.2119129817343088 -1 -1 1 +156 1 2.796603060966876 -1.975811297437484 0.5269881248554414 0 -1 0 +30 1 -2.572197786362113 -0.5211520888332514 0.06478473226429171 1 -1 0 +200 1 -2.796037525463158 -1.2242406753887405 0.9147806710233006 -1 0 0 +75 1 -3.264195451754593 -0.2758623474229462 0.8501703715118789 1 -1 0 +199 1 -1.8606891200301348 -0.81109530705794 1.234068196576104 1 -1 1 +119 1 -1.8952925629684365 -1.6742391291961565 0.3056526633582653 0 -1 0 +153 1 -0.6179778569135823 -0.6812551828045249 0.8822634033092613 1 1 0 +31 1 0.1434804396367878 -0.5352374975985325 0.00065681711961239 0 -1 0 +8 1 0.9896949675708329 -0.5825805499366115 0.8390036708294969 0 0 0 +198 1 0.20957042666083733 -1.2300305579788615 1.1505092305231928 0 0 1 +22 1 0.11282413745771128 -0.029722367543426716 1.1299864513218787 -1 0 -1 +195 1 2.9662277270739343 -0.9097471611972223 1.378968815531931 1 0 2 +32 1 1.9176581701385829 -1.0963885598161285 0.612637989357651 1 0 -1 +139 1 2.2034635745403706 -0.09403988556633318 0.8645554281632429 -1 2 0 +77 1 1.7035877859699526 -0.8133688575022073 1.6318409740615665 0 -1 1 +111 1 -3.223221512681343 0.8515794477136406 0.5304444380887284 1 1 1 +138 1 -2.102339643808083 0.3205080511040257 0.6397061187151873 0 1 -1 +103 1 -2.8441279458234914 0.5800051690180812 1.512417106043963 -1 1 0 +184 1 -2.4512811422970944 1.4407376078485292 1.024840909070544 0 0 1 +73 1 -1.2083083753201984 0.16913042396249212 1.31830897028215 0 -2 0 +89 1 -0.622943103836138 0.15695545887374523 0.03344907944561345 0 0 -1 +93 1 -0.6871612783719626 1.4782545941619265 1.7130745398216136 0 -1 0 +94 1 -1.209899480419889 1.1419050120740204 0.768566708093127 0 0 0 +181 1 0.8338139283938067 0.2955625473112081 0.1708175991674893 -1 1 -1 +129 1 1.1355758059362249 0.3630461551808931 1.290797674214222 -1 0 0 +182 1 0.08831527814343061 0.9709201913937692 0.9217855950625892 0 1 -1 +158 1 1.4062820374169525 1.1517166598840343 0.6269036353613398 0 0 0 +100 1 2.8360458941172935 1.5280995172170748 0.62642849190607 0 1 0 +59 1 3.120666407088228 0.49773318717092796 1.2390797462592613 0 -1 1 +40 1 2.1784673001300465 0.9493086808156442 1.37690657576216 0 0 0 +110 1 3.092811420136352 1.457598231264991 1.8333488137634408 0 0 -2 +71 1 -2.704068160468349 3.198799130983575 1.5420861670955985 0 -1 -1 +187 1 -3.3809787804159894 2.339193447924602 0.9253127201661663 1 1 0 +58 1 -1.8161128905276918 3.295453805825648 0.4419286058239596 0 -1 0 +39 1 -1.9288855291902436 2.399541640622866 1.1856795461879515 0 -2 0 +115 1 -1.3188418056778684 -3.426962627878111 1.3071043811339145 1 1 0 +109 1 0.7422148102651713 1.9772692916114134 0.8946623229549697 -1 1 0 +48 1 1.212990075236676 2.7637861839630933 1.668138216427735 0 0 -1 +44 1 1.8875283020177747 2.01954806585405 0.15097670327664356 -1 -1 1 +16 1 2.5088486436667465 3.2867062332187165 0.5352876678637931 0 -2 1 +150 1 2.339993315563226 2.225227215494749 1.201791196292386 0 -1 1 +101 1 -2.7232595674410254 -2.5310321070553594 2.520173028347837 1 3 1 +121 1 -0.1371595891679715 -2.734037361783574 3.2547541081110136 -1 1 -1 +131 1 -1.616105025949218 -1.97873290984862 2.2250110182725185 1 0 0 +50 1 -0.9774458776093428 -3.080336575399165 2.647294574069851 0 1 0 +78 1 -0.6388640381972747 -1.8358994538797384 3.0793625374288474 1 -1 1 +126 1 0.2617829860592282 -3.185635897887874 2.046978007125428 0 1 -1 +185 1 0.3910180046792306 -1.7476201774885758 3.460179487049301 -2 1 -1 +27 1 0.9216706073777299 -2.620009754961919 2.980059759810019 0 0 1 +5 1 0.14805884420723833 -2.060999311749248 2.194803632818035 0 -1 -1 +10 1 1.3885697256222325 -2.5811721069430047 1.960299612344295 0 0 1 +68 1 1.2305537223759786 3.452417391198064 2.5060768204562396 0 0 1 +92 1 3.2579931163558924 -3.0623298587917547 1.8252693484803535 0 2 -1 +178 1 2.26419751848874 -1.7585846281228215 1.7123805014943867 1 1 0 +96 1 2.599921016729558 -2.6427367710738228 3.4145177684858803 -2 2 -1 +57 1 3.2402592062064213 -1.9899576048001384 2.7907002699370937 1 0 0 +155 1 2.209613988042176 -1.7162524781709796 2.7271827572979834 0 0 -1 +168 1 3.477326382335708 -3.4068959852573992 2.821891114170504 -1 1 -2 +175 1 -3.1260125076640937 -0.1261845495956751 3.231607373653429 0 0 0 +117 1 -2.5082381499858095 -1.6201356456498082 1.916360867966056 0 0 0 +4 1 -3.1142920073981517 -0.7023062901592412 1.8555906719306698 0 0 -1 +51 1 -1.9626772134484154 -1.4010881760394245 3.033958867461655 0 0 -1 +148 1 -3.011516485433896 -1.1469037793442038 2.7610753028279933 0 0 0 +197 1 -2.0048159662329326 -0.6749211621392989 2.344679442661877 0 -1 -1 +70 1 -1.8654941392471802 -0.3319695813423535 3.329224742630753 0 1 1 +23 1 -1.0720302561208543 -0.8796307974060223 2.9652586368172633 0 0 -2 +134 1 -0.9769774773292339 -1.023866537972646 1.8133872200496586 -1 0 0 +66 1 0.0812156007450339 -1.0967406204476347 2.677696992399577 -1 -1 -1 +33 1 -0.42833987516917704 0.2127920276630183 3.0504271041557827 0 -1 -1 +18 1 0.8738459806171345 -0.7301638515378504 3.451151027750579 0 -1 -2 +167 1 1.1687036142366616 -1.4517802174625138 2.5014340704062015 0 1 -1 +136 1 1.795137560517328 -0.5623222017058748 2.761148573575212 0 -1 -2 +176 1 0.8667263057428289 -0.39855552371320657 2.157386135628261 0 0 0 +132 1 2.7791570748849397 -0.1854473725861777 3.06331164881256 0 0 -1 +163 1 2.861161516036147 -0.9653887253660198 2.3742914745631665 -1 -1 0 +159 1 -1.638440405488927 1.040992844593558 1.6945368306541542 0 0 0 +34 1 -2.319980614869211 0.615010700172925 2.607891496520952 1 0 -1 +67 1 -1.8758084270870021 1.7856292006021222 2.9794597615239873 1 0 0 +82 1 3.450078342208421 0.43347862445962865 2.3965330453749276 -1 -1 -1 +20 1 -0.3345634991984191 0.4474749361055883 2.021125197093307 1 0 -1 +160 1 -1.337826167757788 0.19507650189296638 2.4559469377176044 0 0 0 +191 1 -0.9433598322448645 1.0765639185970945 2.7978676989244713 1 -1 0 +97 1 1.4995074975439164 1.4827775589636611 2.8582397165142885 0 -1 -1 +83 1 0.7440931705195399 0.28485269404070884 2.8824261695219513 0 -2 0 +186 1 0.4501325900005473 1.1817617584793225 2.171005382838285 1 1 0 +21 1 1.5799209373811796 0.5165927484280916 2.197344395644513 1 0 -1 +170 1 1.781383760665039 0.4589516263468447 3.2606047972968697 -1 1 -1 +15 1 2.5264882009659457 -0.10271458568953422 1.9429509270634897 -1 0 -1 +54 1 2.4907565610148112 1.0443458588262453 2.659572052524602 0 -1 -1 +45 1 -2.3851170089162586 2.7278135027281576 3.2923683043438063 1 0 -1 +47 1 -2.417816843075144 1.911767591397239 2.070179319067279 0 1 0 +52 1 -3.4931268842957652 2.50155605132379 2.127865658713496 0 -1 0 +180 1 -1.9509177290095516 3.309670529089689 2.349688492929276 1 -1 1 +13 1 -0.12240867021598209 3.2141258686958913 2.833411182871058 -1 -1 1 +2 1 -1.340442106022601 2.2849149851767008 2.069093746173476 1 -2 -1 +124 1 -0.41265942682553436 2.1334074442091007 2.592421577863454 1 -1 -1 +61 1 0.7799049336891462 2.500510040165389 2.633457440959517 -1 -2 0 +128 1 2.8514020342376654 2.399755896897204 3.251183881976271 0 0 -2 +169 1 2.1185477137097575 2.27540363851787 2.3296903855745934 0 0 0 diff --git a/examples/PACKAGES/pimd/lj_reduced_units/data.lj02 b/examples/PACKAGES/pimd/lj_reduced_units/data.lj02 new file mode 100644 index 0000000000..aab14fd30f --- /dev/null +++ b/examples/PACKAGES/pimd/lj_reduced_units/data.lj02 @@ -0,0 +1,219 @@ +LAMMPS data file via write_data, version 8 Feb 2023, timestep = 8000 + +200 atoms +1 atom types + +-3.4945130603740377 3.4945130603740377 xlo xhi +-3.4945130603740377 3.4945130603740377 ylo yhi +-3.4945130603740377 3.4945130603740377 zlo zhi + +Masses + +1 1 + +Pair Coeffs # lj/cut + +1 1 1 + +Atoms # atomic + +141 1 -1.763209980389579 -2.6156484242195064 -2.931843780833984 2 0 0 +152 1 -1.5928871542954757 3.3501884422702433 -1.8656866405706811 -1 -2 0 +49 1 -2.7539752553137182 -3.2181862303090325 -3.2982185001231508 0 1 0 +113 1 -0.7003027892165357 -2.1799819378730754 -2.999588953057854 -1 0 0 +147 1 -0.9066147762335637 -3.0721536393085946 -3.451497569202878 0 1 0 +25 1 -0.8348129272923334 -3.2010555139777104 -2.4342714727995403 -1 0 1 +7 1 -1.155032969500839 -2.109409697780318 -2.01960214884411 -1 0 1 +122 1 -0.11210230788570166 -2.6275713274626975 -1.900506384406081 1 0 -1 +55 1 0.23346664931542635 -2.573966195106371 -3.0437128589517024 -1 0 -1 +95 1 0.716981854784511 -1.7560064219465084 -1.6999612600924723 0 2 -1 +105 1 1.1248014998718883 -1.7403082354703703 -3.356758018801178 0 0 0 +84 1 2.225043764737794 -2.1031554472806464 -3.42558560520243 0 0 0 +65 1 -2.8977942390562763 -2.1977837904725823 -3.370623324950664 0 -1 0 +175 1 -3.151432241251456 -0.37515180280237564 3.4437485581764316 0 0 0 +173 1 -2.3157350741156972 -0.12943144237356516 -2.753320161369244 1 0 1 +174 1 -1.4393153013859372 -1.4595317956467175 -2.895392195630071 -1 0 -1 +189 1 -0.9035292808774392 -0.8049470303120404 -2.0013910310988474 0 0 2 +171 1 -0.09043747063992294 -1.5712222691835853 -2.3464524824680155 0 2 -1 +9 1 -0.38933479997274456 -0.745737254721562 -3.0928316849953847 0 0 1 +37 1 0.8181444837942082 -0.7091668788083872 -2.594933610756206 1 0 1 +170 1 1.3754078695474516 -0.09950193181623739 -3.3522400330808644 -1 1 0 +69 1 1.8294621328196188 -1.0504767914076205 -2.8686605757666803 0 -2 0 +11 1 3.053917621871791 -1.2494689141836135 -3.2389748560412586 -1 2 1 +132 1 2.7977059570311695 -0.2496088420677755 -3.341775035063612 0 0 0 +190 1 3.4919178496580034 0.673724849434539 3.4160908466980175 -1 0 -1 +146 1 -0.6231884714133011 0.14913282842463038 -2.641949381637644 2 1 2 +135 1 -1.5674517925968012 0.6290709302591437 -2.3856462153486317 1 0 0 +183 1 -0.49431360672463004 1.4890871743231773 -2.7350680810605428 1 0 0 +74 1 0.37022638217671316 0.08409992531451556 -3.033741105582725 1 -1 1 +26 1 0.4574609043057575 1.0299917975368564 -2.3172978982485737 0 -1 1 +28 1 1.1181699312197082 1.1244486490934802 -3.1866832135712855 0 -1 -1 +29 1 -2.5977690868714194 2.5288932865762908 -3.4450145823917615 1 -1 0 +60 1 -1.7983398047844672 3.3151201773371946 -2.9557747417019304 1 1 0 +35 1 -2.341675516391612 2.5752707942079995 -2.1932303039293837 1 -1 0 +172 1 -1.5906394201515217 2.0015866768978423 -2.97713376733703 0 0 2 +90 1 -0.9570316941978154 2.7341944347748575 -2.39704430602322 0 -1 1 +41 1 0.17097469683906785 3.422589740764926 -2.7250117611585174 0 0 1 +102 1 -2.1834144246935057 -1.9708341062049972 -1.651792998752301 1 -1 -1 +19 1 -2.799899482947646 -2.4762586983196475 -0.30170497621753223 1 1 -1 +193 1 -1.8524344777477728 -2.9040612754975954 -0.9352876177978476 1 1 0 +76 1 -0.14754768813509733 -2.534237145454477 -0.5903298333231304 0 0 0 +104 1 -1.4292162927828058 -1.8887180032986757 -0.7510048521253992 0 0 -1 +14 1 -0.7531800111600084 -3.202737076324235 -1.3992046647831564 -1 0 1 +188 1 1.0895178734825146 -2.3416281855941414 0.09937021752979631 -1 0 0 +157 1 1.53648073670157 -2.278353849103656 -0.9969007844888839 -1 -1 1 +64 1 3.2685116460755688 -1.7040641958682559 -0.168149877537844 0 1 0 +196 1 3.243226770875574 -2.735431073745969 -0.24543333692900807 0 2 1 +120 1 -2.7480834527815015 -1.2726347498238166 -0.7010605053509458 2 1 1 +166 1 -2.5409778907446827 -0.09698240322803402 -1.3435121782531134 0 1 0 +30 1 -2.536346720442665 -0.46539641115594493 0.008770351469747525 1 -1 0 +80 1 -1.716490207148261 -0.7528793181105096 -0.6170398381312646 0 0 1 +17 1 -0.8652064576231921 -1.1974714632304932 -0.15888843807113082 -2 0 0 +98 1 -0.5496242692202938 -0.5939149881300675 -0.9303624863402448 -1 0 0 +6 1 -0.45332547354146785 -1.6738816451677578 -1.1232699958219994 2 0 0 +140 1 0.09381666738090248 -0.533597973200848 -1.8865070415277823 -1 0 0 +106 1 0.5488648307350995 -1.2535162508826685 -0.8256886196074045 -1 0 0 +36 1 0.7889198394938511 -0.3476398702185327 -0.04547023889787161 1 -1 0 +24 1 1.3300945978662577 -0.35153772413771023 -0.9700284287655409 1 -1 0 +81 1 2.0630098337462903 -0.9138666208698583 -0.13962068859670462 -1 0 1 +91 1 -3.4535066291698033 -0.4796384079540839 -0.5221884185889151 1 -1 -1 +164 1 -1.8003776637651108 1.3095354466285742 -0.9389018844249196 0 0 1 +87 1 -1.8547858498275616 0.3065099544053662 -0.4980768850921695 0 -1 1 +145 1 -3.090772587596814 0.5837989607708169 -0.6251810283740868 0 -2 -1 +111 1 -2.534664983415859 1.34688446772606 0.11460128889340086 1 1 1 +79 1 -1.380899470765548 0.24370827853097413 -1.4854169578503262 0 1 0 +162 1 -1.1815902722068103 1.6597770188121743 -1.9852434376303232 0 0 1 +112 1 -0.32558743037491716 0.7106169572157139 -1.615285962267308 0 0 0 +56 1 -0.8283072702254036 0.4564624534306639 -0.5700689028075459 0 0 1 +182 1 0.04863074266364189 0.7978824700683131 -0.008284573593351257 0 1 -1 +177 1 -0.6481696376748467 1.7650890642565358 -0.05338043165294714 0 1 -1 +137 1 0.32639925685778487 -0.05353328668133155 -0.9586895874383917 -1 1 -1 +165 1 0.9387159980444888 0.2522291776639033 -1.8478441123660552 0 0 0 +3 1 1.0844300875316264 0.6025889724525081 -0.4582563908829376 0 -1 1 +194 1 0.8662415299163716 1.2219273986337442 -1.3857941220556813 0 1 -1 +158 1 2.0486184184859972 0.9634063040985638 -0.3354215045861158 0 0 0 +42 1 -1.5693584560601268 2.9075068816274467 -0.8387140667909673 0 1 -1 +99 1 -1.6113116181616747 2.147179220461499 0.1775215873578245 0 -1 0 +72 1 -0.6293873725016741 2.630010118252137 -0.9564776518035689 1 -1 0 +38 1 -2.8640470065198236 -2.2435586739017785 1.3910743129711478 1 0 1 +143 1 -3.0743396057883414 -3.212849746838124 0.5259359570888149 1 1 0 +58 1 -1.9981958681612715 -3.1822656548185346 0.09920225142503952 0 0 0 +144 1 -2.279979967578157 -3.0851896187054515 1.4084093697981352 0 1 0 +151 1 -2.0216078245666655 -2.2216580360079643 0.7457122321748793 0 1 2 +130 1 -0.17493166269242383 -2.4315359476317373 0.444080856211588 -1 1 0 +149 1 -1.3750250274960272 -1.974930490228725 1.5829454078902832 1 1 0 +115 1 -1.2118995350185076 -2.9035919135907267 0.8179968023020373 1 1 0 +126 1 -0.25733050703242866 -2.3407760209116555 1.6674720764378244 0 1 -1 +123 1 0.5187414713973443 -1.8755931680751559 1.2290889493691715 -1 1 -1 +92 1 3.2842270894719214 -2.336991573654636 0.7621232582722934 0 2 -1 +142 1 2.8537576665436712 -3.369110508718591 0.5560526759827451 1 1 0 +1 1 2.08557845839204 -2.010493903326111 0.46603456602394955 0 -1 0 +12 1 -2.813558556370972 -1.5225310581093578 0.39881007051362743 0 0 1 +200 1 -2.620780645842095 -0.6334500549042138 1.1697962611458572 -1 0 0 +117 1 -2.3409262065663707 -1.4262844598718953 1.577896400637549 0 0 0 +199 1 -1.6721028915736709 -0.3937836671461621 1.764496832035196 1 -1 1 +119 1 -1.3702172421751233 -0.982726844411586 0.8109159599445125 0 -1 0 +118 1 -1.22523977151256 0.049111500972962366 0.34422431168243056 0 1 0 +179 1 -0.48400468992080004 -1.5634732075160336 0.9724005879568145 -1 3 1 +153 1 -0.7754078116015299 -0.12746028844271876 1.3139844087365358 1 1 0 +31 1 -0.21960550339589976 -0.3692535839546128 0.27760883173133294 0 -1 0 +154 1 1.1892001894282327 -1.234463776085168 0.4980011557336487 -1 2 0 +198 1 0.208959161472621 -0.7925251742172552 1.1981697813594612 0 0 1 +133 1 0.2021894978277857 -1.321629803385425 0.21342138424976495 1 1 1 +8 1 1.290866486655316 -0.32315323656178685 1.238429676489808 0 0 0 +43 1 1.4755875560077207 -1.5038423322367462 1.5696783276393578 -1 -1 1 +178 1 2.5595353005590473 -1.8548623704973153 1.5265130435507075 1 1 0 +156 1 3.10009336795942 -1.1347768292920712 0.7103971454931245 0 -1 0 +195 1 3.0488535895478486 -0.3819070637556806 1.6994009663148437 1 0 2 +32 1 2.1785721999000907 -0.8868183892594861 1.0608219538420214 1 0 -1 +75 1 -3.330023312049968 -0.13053199225722137 0.5772143324801579 1 -1 0 +138 1 -2.126928513622699 0.2705982397065681 0.9031685365715656 0 1 -1 +103 1 -2.5233875332738447 1.119832203926971 1.7143082124863906 -1 1 0 +89 1 -1.5625051595744621 1.0842527403417836 0.48114251556352683 0 0 -1 +73 1 -1.3841491529474708 0.7735632155517752 1.4917172788469495 0 -2 0 +93 1 -0.8459409435273203 1.6986071717879083 1.233579181789839 0 -1 0 +22 1 0.23130054165086983 0.3973595019638049 1.136265889331469 -1 0 -1 +181 1 1.6715679048902568 0.38189497066002065 0.5813616713777726 -1 1 -1 +125 1 0.7657348058398646 1.4638634812356126 0.3595929949039634 0 1 0 +129 1 1.187621376432971 0.7432781269466477 1.4756104377419834 -1 0 0 +186 1 0.12119836338531766 1.4258158866314226 1.7139997055217806 1 1 0 +44 1 3.246466614044557 0.935266979887072 0.09504504915790167 -1 -1 1 +139 1 2.294764083473655 0.2623628592978102 1.523064327633417 -1 2 0 +85 1 2.6715078057197426 -0.13923978779568133 0.48921080221894214 1 0 1 +100 1 2.179445623029225 1.1813699866412055 0.929258254331208 0 1 0 +59 1 3.199013987449739 0.7056213255691308 1.3011789902622373 0 -1 1 +184 1 -3.3541957825280964 1.6540170153788636 1.314525393258615 0 0 1 +116 1 -2.5607854807212633 2.8662954762956563 0.2561876654735037 1 0 0 +94 1 -2.209938696472392 1.817908573668992 0.9714554983444477 0 0 0 +16 1 3.462148790854558 2.750688132987863 1.1678814516580918 0 -2 1 +127 1 -0.6724215018270191 2.910608435174655 0.1393721830184081 0 -1 0 +39 1 -1.4963936644183389 2.8490269023893804 1.0397387839630663 0 -2 0 +109 1 1.2282064333649392 2.002097356660932 1.219647219360347 -1 1 0 +13 1 -0.038761589919005045 2.283368111259498 0.6285508805046305 -1 -1 1 +68 1 1.8122507294414043 2.919628635322565 1.388388027502655 0 0 1 +187 1 2.839543107439997 1.9712312705165291 0.44701965347775696 0 1 0 +150 1 2.6350933896773805 2.228885886643039 1.6430472643318494 0 -1 1 +101 1 -2.9845915106276357 -2.643240276070094 2.6131611879137338 1 3 1 +180 1 -2.4664624391703636 3.2461534604898077 2.2991216200041777 1 -1 1 +131 1 -2.1198879143055582 -2.5254800707290985 2.2468458013290475 1 0 0 +88 1 -1.8261664412558902 -3.2761989619835945 3.0217607589697706 0 1 -1 +51 1 -1.7527244407627123 -2.1114193587023125 3.178648460302574 0 0 -1 +121 1 -0.8632847382707834 -2.364486787477818 2.5298242427842235 -1 1 -1 +50 1 -1.3127850841438964 -3.332989957578539 1.7903541140988317 0 1 0 +63 1 1.6040989853168577 -2.8917377487223326 2.9749125296584396 -1 1 0 +27 1 0.22872838010698016 -2.994984028716655 2.6653598205127595 0 0 1 +10 1 0.9362147196804173 -2.581105523755157 1.9878669654444103 0 0 1 +185 1 0.06742724446398485 -1.8726052150227481 3.179787889614259 -2 1 -1 +62 1 0.9381874848569671 3.2183812476038773 2.122950032967029 0 0 0 +108 1 3.2075816395574557 -2.6473251670969744 3.3899630726255054 1 1 -1 +168 1 -3.4886505297786643 -3.024902771510678 1.648075348189236 0 1 -2 +96 1 2.193516168781477 -3.220451114036294 2.031971070369377 -2 2 -1 +57 1 2.897670474066688 -1.7869273194590956 2.7802854592878443 1 0 0 +155 1 2.0203257801003764 -2.093908363815807 2.3651374010253265 0 0 -1 +70 1 -2.289198729241698 -1.0693505000499786 3.3341581014665116 0 1 1 +86 1 3.4317154036170927 -1.33629793948954 1.5868690985104916 -2 0 0 +4 1 -2.642034929204445 -0.5735696636076526 2.24988074624273 0 0 -1 +148 1 -2.7958435550832177 -1.6271830272245196 2.4651167378398258 0 0 0 +197 1 -1.6297637248397103 -1.2496732630952756 2.4653302717640746 0 -1 -1 +23 1 -1.4165843839294037 -0.23332219410733462 -3.3887252652014874 0 0 -1 +78 1 -0.8539129642965406 -1.4368914881460948 3.1097976169270467 1 -1 1 +134 1 -0.7681520363929484 -1.1354013495310054 1.8538106613640677 -1 0 0 +66 1 -0.23373724912576396 -0.5882558302750734 2.5656269999794135 -1 -1 -1 +160 1 -1.1132775718863501 0.16126595419727965 2.3994619853672896 0 0 0 +18 1 0.6168554097448792 -0.8675105647197154 3.3233443940314107 0 -1 -2 +5 1 0.21124689546372627 -1.527936340282886 2.128421015823146 0 -1 -1 +167 1 1.157996163161525 -1.3890474926504965 2.5930120556899743 0 1 -1 +176 1 0.7227757787132028 -0.4265054817409199 2.130677354553178 0 0 0 +77 1 2.0007502274099562 -0.6930768409753575 2.0562080526704536 0 -1 1 +136 1 2.059758900185651 -1.052357318680519 3.1194387358517117 0 -1 -2 +163 1 3.3650479388293877 -0.7812523229666395 2.7231341802578797 -1 -1 0 +53 1 -2.3141819292399695 1.20855609162257 -3.127003289906138 -1 -1 1 +34 1 -2.2520285035649175 0.34377072469492165 3.2433897655354262 1 0 -1 +82 1 -3.1361148993392707 0.2917712829104399 2.508598507937298 0 -1 -1 +47 1 -2.903472142580087 1.2996380231419302 2.6614912616951822 0 1 0 +159 1 -1.8421866316781088 1.3742261871908503 2.7832166426856038 0 0 0 +161 1 -1.2319440636738626 0.9387211724622819 -3.4892930122068617 1 0 2 +33 1 -0.4449542140900899 0.2769280403688486 3.289217283277774 0 -1 -1 +191 1 -0.8687075277531521 1.281273999295463 2.3493691514045447 1 -1 0 +20 1 -0.12835229617409075 0.4001437971686418 2.091186274425671 1 0 -1 +21 1 1.5590447736292827 0.23116165627532026 2.4331182207698356 1 0 -1 +83 1 0.6019872094726322 0.17868421219256525 2.965010196172179 0 -2 0 +107 1 -0.09314344901480053 1.8386195873289717 2.9198165047206524 -1 1 0 +97 1 0.9500008570521725 1.1147256892756756 2.5445482565685626 0 -1 -1 +15 1 2.6866827472081427 0.05611542822496954 2.621280841687164 -1 0 -1 +40 1 2.0535009935702107 1.3482348414084473 2.153119101811638 0 0 0 +110 1 3.037377950690711 1.1454318013031137 2.4602998295324308 0 0 -2 +54 1 2.1368310833242825 0.6989281938007096 3.190545712320829 0 -1 -1 +71 1 -2.6906257490825327 2.3188264822083675 1.851572369390678 0 -1 -1 +45 1 -1.8822606439217724 2.5464355632785174 2.887157746831732 1 0 -1 +2 1 -1.527738763941238 2.1784215473644295 1.8498426738676617 1 -2 -1 +67 1 -1.014923597719753 2.0522310481028465 3.091487536680741 1 0 0 +192 1 -0.8672155474955553 3.087168735274927 2.6165250257240618 1 0 1 +124 1 -0.37769468839105996 2.5506571887551175 1.8053870882842125 1 -1 -1 +46 1 -0.2092884053324724 2.562694157698328 -3.2372195292692605 1 -1 -1 +114 1 -0.2001222858286487 -3.429888000295159 1.8301280696628333 0 0 0 +61 1 0.5140644440329998 2.208326878392573 2.2153556959139413 -1 -2 0 +169 1 1.5629071468921552 2.2983930760888316 2.2366483189031316 0 0 0 +128 1 -3.438885935852406 3.376929578988928 3.002455750479755 1 0 -2 +52 1 -3.4549495641597217 2.178628786705743 2.923210719991474 0 -1 0 +48 1 2.502392696348409 2.9340155922847346 2.5991521468190113 0 0 -1 diff --git a/examples/PACKAGES/pimd/lj_reduced_units/in.lmp b/examples/PACKAGES/pimd/lj_reduced_units/in.lmp new file mode 100644 index 0000000000..012214c4b2 --- /dev/null +++ b/examples/PACKAGES/pimd/lj_reduced_units/in.lmp @@ -0,0 +1,26 @@ +variable ibead uloop 32 pad + +units lj +atom_style atomic +atom_modify map yes +boundary p p p +pair_style lj/cut 2.8015 +read_data data.lj${ibead} + +pair_coeff * * 1.0 1.0 +pair_modify shift yes + +mass 1 1.0 + +timestep 0.00044905847 + +fix 1 all pimd/langevin ensemble nvt integrator obabo temp 1.00888 lj 0.00965188 3.4 39.948 4.135667403e-3 1.03646168908e-4 thermostat PILE_L ${ibead} + +thermo_style custom step temp f_1[*] vol press +thermo 100 +thermo_modify norm no format line "%d %.16f %.16f %.16f %.16f %.16f %.16f %.16f %.16f %.16f %.16f %.16f %.16f %.16f %.16f %.16f %.16f %.16f %.16f %.16f %.16f %.16f" + +dump dcd all custom 1 ${ibead}.xyz id type x y z vx vy vz ix iy iz fx fy fz +dump_modify dcd sort id format line "%d %d %.16f %.16f %.16f %.16f %.16f %.16f %d %d %d %.16f %.16f %.16f" + +run 1000 diff --git a/examples/PACKAGES/pimd/lj_reduced_units/run.sh b/examples/PACKAGES/pimd/lj_reduced_units/run.sh new file mode 100644 index 0000000000..adc7f4b955 --- /dev/null +++ b/examples/PACKAGES/pimd/lj_reduced_units/run.sh @@ -0,0 +1 @@ +mpirun -np 2 $LMP -in in.lmp -p 2x1 -log log -screen screen From f6d94a95dddc33e7407e256e79374a69044fc01f Mon Sep 17 00:00:00 2001 From: Yifan Li Date: Mon, 27 Mar 2023 22:45:14 -0400 Subject: [PATCH 052/396] fix whitespace in fix pimd doc --- doc/src/fix_pimd.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/doc/src/fix_pimd.rst b/doc/src/fix_pimd.rst index e4a59b0078..1767acb134 100644 --- a/doc/src/fix_pimd.rst +++ b/doc/src/fix_pimd.rst @@ -106,7 +106,7 @@ thermostats in each chain. For example, for a simulation of N particles with P beads in each ring-polymer, the total number of NH thermostats would be 3 x N x P x Nc. -Fix *pimd/langevin* implements a Langevin thermostat in the normal mode +Fix *pimd/langevin* implements a Langevin thermostat in the normal mode representation, and also provides a barostat to sample the NPH/NPT ensembles. .. note:: @@ -273,7 +273,7 @@ related tasks for each of the partitions, e.g. forces in the normal mode representation. If the Catersian velocities and forces are needed, it is easy to perform the transformation when doing post-processing. - It is recommended to dump the image flags (*ix iy iz*) for fix *pimd/langevin*. It + It is recommended to dump the image flags (*ix iy iz*) for fix *pimd/langevin*. It will be useful if you want to calculate some estimators during post-processing. Restart, fix_modify, output, run start/stop, minimize info From 849933a687610642ff26bf3af5ead984f8634e22 Mon Sep 17 00:00:00 2001 From: Yifan Li Date: Mon, 27 Mar 2023 23:06:05 -0400 Subject: [PATCH 053/396] add difference part in fix pimd doc --- doc/src/fix_pimd.rst | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/doc/src/fix_pimd.rst b/doc/src/fix_pimd.rst index 1767acb134..fda002484a 100644 --- a/doc/src/fix_pimd.rst +++ b/doc/src/fix_pimd.rst @@ -269,13 +269,25 @@ related tasks for each of the partitions, e.g. read_restart system_${ibead}.restart2 .. note:: - Fix *pimd/langevin* dumps the Catersian coordinates, but dumps the velocities and - forces in the normal mode representation. If the Catersian velocities and forces are + Fix *pimd/langevin* dumps the Cartesian coordinates, but dumps the velocities and + forces in the normal mode representation. If the Cartesian velocities and forces are needed, it is easy to perform the transformation when doing post-processing. It is recommended to dump the image flags (*ix iy iz*) for fix *pimd/langevin*. It will be useful if you want to calculate some estimators during post-processing. +Major differences of *fix pimd/nvt* and *fix pimd/langevin* are: + + #. *Fix pimd/nvt* includes Cartesian pimd, normal mode pimd, and centroid md. *Fix pimd/langevin* only intends to support normal mode pimd, as it is commonly enough for thermodynamic sampling. + #. *Fix pimd/nvt* uses Nose-Hoover chain thermostat. *Fix pimd/langevin* uses Langevin thermostat. + #. *Fix pimd/langevin* provides barostat, so the npt ensemble can be sampled. *Fix pimd/nvt* only support nvt ensemble. + #. *Fix pimd/langevin* provides several quantum estimators in output. + #. *Fix pimd/langevin* allows multiple processes for each bead. For *fix pimd/nvt*, there is a large chance that multi-process tasks for each bead may fail. + #. The dump of *fix pimd/nvt* are all Cartesian. *Fix pimd/langevin* dumps normal-mode velocities and forces, and Cartesian coordinates. + +Initially, the inter-replica communication and normal mode transformation parts of *fix pimd/langevin* are written based on +those of *fix pimd/nvt*, but are significantly revised. + Restart, fix_modify, output, run start/stop, minimize info """"""""""""""""""""""""""""""""""""""""""""""""""""""""""" From 19da998932f4df73954d81bc810d96d9f3df2981 Mon Sep 17 00:00:00 2001 From: Yifan Li Date: Mon, 27 Mar 2023 23:11:24 -0400 Subject: [PATCH 054/396] add Jacobian into utils/sphinx-config/false_positives.txt --- doc/utils/sphinx-config/false_positives.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/doc/utils/sphinx-config/false_positives.txt b/doc/utils/sphinx-config/false_positives.txt index fda9fb2b08..6a29c84974 100644 --- a/doc/utils/sphinx-config/false_positives.txt +++ b/doc/utils/sphinx-config/false_positives.txt @@ -1613,6 +1613,7 @@ Izumi Izvekov izz Izz +Jacobian Jacobsen Jadhao Jadhav From 18e4ed2e322a51734ca3250ee9aa593a15ef9864 Mon Sep 17 00:00:00 2001 From: Yifan Li Date: Fri, 31 Mar 2023 00:59:35 -0400 Subject: [PATCH 055/396] do not transform velocity to normal mode in setup --- src/REPLICA/fix_pimd_langevin.cpp | 7 ------- 1 file changed, 7 deletions(-) diff --git a/src/REPLICA/fix_pimd_langevin.cpp b/src/REPLICA/fix_pimd_langevin.cpp index d64d948ecf..6c5b1a0b09 100644 --- a/src/REPLICA/fix_pimd_langevin.cpp +++ b/src/REPLICA/fix_pimd_langevin.cpp @@ -450,13 +450,6 @@ void FixPIMDLangevin::setup(int vflag) for (int i = 0; i < nlocal; i++) domain->unmap_inv(x[i], image[i]); } - if (method == NMPIMD) { - inter_replica_comm(v); - if (cmode == SINGLE_PROC) - nmpimd_transform(bufsortedall, v, M_x2xp[universe->iworld]); - else if (cmode == MULTI_PROC) - nmpimd_transform(bufbeads, v, M_x2xp[universe->iworld]); - } post_force(vflag); compute_totke(); end_of_step(); From 25c449df8e2b78de7e4c29c8a8ec42ba71fbc8c5 Mon Sep 17 00:00:00 2001 From: Yifan Li Date: Fri, 31 Mar 2023 03:03:17 -0400 Subject: [PATCH 056/396] enable restart in fix pimd/langevin --- src/REPLICA/fix_pimd_langevin.cpp | 53 +++++++++++++++++++++++++++++-- src/REPLICA/fix_pimd_langevin.h | 5 +++ 2 files changed, 56 insertions(+), 2 deletions(-) diff --git a/src/REPLICA/fix_pimd_langevin.cpp b/src/REPLICA/fix_pimd_langevin.cpp index 6c5b1a0b09..b4ea68d49b 100644 --- a/src/REPLICA/fix_pimd_langevin.cpp +++ b/src/REPLICA/fix_pimd_langevin.cpp @@ -65,6 +65,7 @@ enum { SINGLE_PROC, MULTI_PROC }; FixPIMDLangevin::FixPIMDLangevin(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg), random(nullptr), c_pe(nullptr), c_press(nullptr) { + restart_global = 1; time_integrate = 1; tagsend = tagrecv = nullptr; bufsend = bufrecv = nullptr; @@ -254,6 +255,8 @@ FixPIMDLangevin::FixPIMDLangevin(LAMMPS *lmp, int narg, char **arg) : } } extvector = 1; + kBT = force->boltz * temp; + if (pstat_flag) baro_init(); // some initilizations @@ -376,7 +379,6 @@ void FixPIMDLangevin::init() } planck *= sp; hbar = planck / (2.0 * MY_PI); - kBT = force->boltz * temp; double beta = 1.0 / (force->boltz * temp); double _fbond = 1.0 * np * np / (beta * beta * hbar * hbar); @@ -408,7 +410,6 @@ void FixPIMDLangevin::init() nmpimd_init(); Langevin_init(); - if (pstat_flag) baro_init(); c_pe = modify->get_compute_by_id(id_pe); c_press = modify->get_compute_by_id(id_press); @@ -1371,6 +1372,54 @@ void FixPIMDLangevin::compute_totenthalpy() totenthalpy = tote + 1.5 * W * vw[0] * vw[0] * inverse_np + p_hydro * (volume - vol0); } +/* ---------------------------------------------------------------------- + pack entire state of Fix into one write +------------------------------------------------------------------------- */ + +void FixPIMDLangevin::write_restart(FILE *fp) +{ + int nsize = size_restart_global(); + + double *list; + memory->create(list,nsize,"FixPIMDLangevin:list"); + + pack_restart_data(list); + + if (comm->me == 0) { + int size = nsize * sizeof(double); + fwrite(&size,sizeof(int),1,fp); + fwrite(list,sizeof(double),nsize,fp); + } + + memory->destroy(list); +} +/* ---------------------------------------------------------------------- */ + +int FixPIMDLangevin::size_restart_global() +{ + int nsize = 6; + + return nsize; +} + +/* ---------------------------------------------------------------------- */ + +int FixPIMDLangevin::pack_restart_data(double *list) +{ + int n = 0; + for (int i=0; i<6; i++) { list[n++] = vw[i]; } + return n; +} + +/* ---------------------------------------------------------------------- */ + +void FixPIMDLangevin::restart(char *buf) +{ + int n = 0; + auto list = (double *) buf; + for (int i=0; i<6; i++) { vw[i] = list[n++]; } +} + /* ---------------------------------------------------------------------- */ double FixPIMDLangevin::compute_vector(int n) diff --git a/src/REPLICA/fix_pimd_langevin.h b/src/REPLICA/fix_pimd_langevin.h index 6d236718c7..79a2ee7477 100644 --- a/src/REPLICA/fix_pimd_langevin.h +++ b/src/REPLICA/fix_pimd_langevin.h @@ -175,6 +175,11 @@ class FixPIMDLangevin : public Fix { void compute_vir(); void compute_cvir(); void compute_totenthalpy(); + + void write_restart(FILE *fp) override; + int size_restart_global(); + int pack_restart_data(double *list); + void restart(char *buf) override; }; } // namespace LAMMPS_NS #endif From c37247eb5a75469493b7a81008c1b2fef9aa30e6 Mon Sep 17 00:00:00 2001 From: Yifan Li Date: Fri, 31 Mar 2023 03:09:34 -0400 Subject: [PATCH 057/396] add restart info in doc --- doc/src/fix_pimd.rst | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/doc/src/fix_pimd.rst b/doc/src/fix_pimd.rst index fda002484a..ae325023fd 100644 --- a/doc/src/fix_pimd.rst +++ b/doc/src/fix_pimd.rst @@ -297,7 +297,11 @@ quasi-beads to :doc:`binary restart files `. See the a fix in an input script that reads a restart file, so that the operation of the fix continues in an uninterrupted fashion. -Fix *pimd/langevin* ... +Fix *pimd/langevin* writes the state of the barostat overall beads to +:doc:`binary restart files `. Since it uses a stochastic thermostat, +the state of the thermostat is not written. However, the state of the system +can be restored by reading the restart file, execpt that it will re-initialize +the random number generator. None of the :doc:`fix_modify ` options are relevant to fix pimd/nvt. From f444fe8fdf0b139a44f33e4b47120dd45173dea1 Mon Sep 17 00:00:00 2001 From: Yifan Li Date: Fri, 31 Mar 2023 03:12:38 -0400 Subject: [PATCH 058/396] fix spelling error --- doc/src/fix_pimd.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/src/fix_pimd.rst b/doc/src/fix_pimd.rst index ae325023fd..7116ce526b 100644 --- a/doc/src/fix_pimd.rst +++ b/doc/src/fix_pimd.rst @@ -300,7 +300,7 @@ operation of the fix continues in an uninterrupted fashion. Fix *pimd/langevin* writes the state of the barostat overall beads to :doc:`binary restart files `. Since it uses a stochastic thermostat, the state of the thermostat is not written. However, the state of the system -can be restored by reading the restart file, execpt that it will re-initialize +can be restored by reading the restart file, except that it will re-initialize the random number generator. None of the :doc:`fix_modify ` options From 42758d0780835ded30631f8ed1a815f98fff6ec2 Mon Sep 17 00:00:00 2001 From: Yifan Li Date: Fri, 31 Mar 2023 03:28:09 -0400 Subject: [PATCH 059/396] delete dynamically allocated arrays in destructor --- src/REPLICA/fix_pimd_langevin.cpp | 39 +++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) diff --git a/src/REPLICA/fix_pimd_langevin.cpp b/src/REPLICA/fix_pimd_langevin.cpp index b4ea68d49b..4d1ca2eb62 100644 --- a/src/REPLICA/fix_pimd_langevin.cpp +++ b/src/REPLICA/fix_pimd_langevin.cpp @@ -341,6 +341,45 @@ FixPIMDLangevin::~FixPIMDLangevin() delete[] id_pe; delete[] id_press; delete random; + delete c_pe; + delete c_press; + delete[] mass; + delete[] _omega_k; + delete[] Lan_c; + delete[] Lan_s; + delete[] tau_k; + delete[] c1_k; + delete[] c2_k; + delete[] plansend; + delete[] planrecv; + delete[] modeindex; + memory->destroy(xcall); + if (cmode == SINGLE_PROC) { + memory->destroy(bufsorted); + memory->destroy(outsorted); + memory->destroy(bufsortedall); + memory->destroy(buftransall); + memory->destroy(counts); + memory->destroy(displacements); + } + + if (cmode == MULTI_PROC) { + memory->destroy(bufsendall); + memory->destroy(bufrecvall); + memory->destroy(tagsendall); + memory->destroy(tagrecvall); + memory->destroy(counts); + memory->destroy(displacements); + } + memory->destroy(M_x2xp); + memory->destroy(M_xp2x); + memory->destroy(xc); + memory->destroy(x_unwrap); + memory->destroy(bufsend); + memory->destroy(bufrecv); + memory->destroy(tagsend); + memory->destroy(tagrecv); + memory->destroy(bufbeads); } /* ---------------------------------------------------------------------- */ From 7c98d4dba3b56407ff2209e3249c32df9092a36c Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Wed, 17 May 2023 10:26:33 -0400 Subject: [PATCH 060/396] avoid null pointer dereferences by allocating a buffer for at least 1 item --- src/library.cpp | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/library.cpp b/src/library.cpp index cc4e748f57..33f49a4e53 100644 --- a/src/library.cpp +++ b/src/library.cpp @@ -3159,7 +3159,8 @@ void lammps_gather_bonds(void *handle, void *data) } tagint **bonds; - lmp->memory->create(bonds, localbonds, 3, "library:gather_bonds:localbonds"); + // add 1 to localbonds, so "bonds" does not become a NULL pointer + lmp->memory->create(bonds, localbonds+1, 3, "library:gather_bonds:localbonds"); lmp->atom->avec->pack_bond(bonds); MPI_Allgatherv(&bonds[0][0], 3*localbonds, MPI_LMP_TAGINT, data, bufsizes, bufoffsets, MPI_LMP_TAGINT, lmp->world); @@ -3269,7 +3270,8 @@ void lammps_gather_angles(void *handle, void *data) } tagint **angles; - lmp->memory->create(angles, localangles, 4, "library:gather_angles:localangles"); + // add 1 to localangles, so "angles" does not become a NULL pointer + lmp->memory->create(angles, localangles+1, 4, "library:gather_angles:localangles"); lmp->atom->avec->pack_angle(angles); MPI_Allgatherv(&angles[0][0], 4*localangles, MPI_LMP_TAGINT, data, bufsizes, bufoffsets, MPI_LMP_TAGINT, lmp->world); @@ -3380,7 +3382,8 @@ void lammps_gather_dihedrals(void *handle, void *data) } tagint **dihedrals; - lmp->memory->create(dihedrals, localdihedrals, 5, "library:gather_dihedrals:localdihedrals"); + // add 1 to localdihedrals, so "dihedrals" does not become a NULL pointer + lmp->memory->create(dihedrals, localdihedrals+1, 5, "library:gather_dihedrals:localdihedrals"); lmp->atom->avec->pack_dihedral(dihedrals); MPI_Allgatherv(&dihedrals[0][0], 5*localdihedrals, MPI_LMP_TAGINT, data, bufsizes, bufoffsets, MPI_LMP_TAGINT, lmp->world); @@ -3491,7 +3494,8 @@ void lammps_gather_impropers(void *handle, void *data) } tagint **impropers; - lmp->memory->create(impropers, localimpropers, 5, "library:gather_impropers:localimpropers"); + // add 1 to localimpropers, so "impropers" does not become a NULL pointer + lmp->memory->create(impropers, localimpropers+1, 5, "library:gather_impropers:localimpropers"); lmp->atom->avec->pack_improper(impropers); MPI_Allgatherv(&impropers[0][0], 5*localimpropers, MPI_LMP_TAGINT, data, bufsizes, bufoffsets, MPI_LMP_TAGINT, lmp->world); From 8736f97792ad951e3430bd678d56de2aa3d8e303 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Wed, 17 May 2023 17:35:14 -0400 Subject: [PATCH 061/396] remove dead code --- src/REPLICA/fix_pimd_langevin.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/src/REPLICA/fix_pimd_langevin.cpp b/src/REPLICA/fix_pimd_langevin.cpp index 4d1ca2eb62..3760c453ab 100644 --- a/src/REPLICA/fix_pimd_langevin.cpp +++ b/src/REPLICA/fix_pimd_langevin.cpp @@ -462,7 +462,6 @@ void FixPIMDLangevin::setup(int vflag) { int nlocal = atom->nlocal; double **x = atom->x; - double **v = atom->v; imageint *image = atom->image; if (mapflag) { for (int i = 0; i < nlocal; i++) domain->unmap(x[i], image[i]); From 79f3eb6a4d2fc2fa3ad596ede196efecda24ee16 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Wed, 17 May 2023 17:35:22 -0400 Subject: [PATCH 062/396] remove debug code --- src/REPLICA/fix_pimd_langevin.cpp | 4 ---- 1 file changed, 4 deletions(-) diff --git a/src/REPLICA/fix_pimd_langevin.cpp b/src/REPLICA/fix_pimd_langevin.cpp index 3760c453ab..733d38e038 100644 --- a/src/REPLICA/fix_pimd_langevin.cpp +++ b/src/REPLICA/fix_pimd_langevin.cpp @@ -644,10 +644,6 @@ void FixPIMDLangevin::end_of_step() compute_p_cv(); compute_tote(); if (pstat_flag) compute_totenthalpy(); - - if (update->ntimestep % 10000 == 0) { - if (universe->me == 0) printf("This is the end of step %lld.\n", update->ntimestep); - } } void FixPIMDLangevin::collect_xc() From 5d66dc6659718d2e16644a7b1c43ae50af134b6d Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Wed, 17 May 2023 17:38:16 -0400 Subject: [PATCH 063/396] apply clang-format --- src/REPLICA/fix_pimd_langevin.cpp | 123 ++++++++++++++---------------- 1 file changed, 58 insertions(+), 65 deletions(-) diff --git a/src/REPLICA/fix_pimd_langevin.cpp b/src/REPLICA/fix_pimd_langevin.cpp index 733d38e038..67d7cabe02 100644 --- a/src/REPLICA/fix_pimd_langevin.cpp +++ b/src/REPLICA/fix_pimd_langevin.cpp @@ -47,7 +47,8 @@ using namespace LAMMPS_NS; using namespace FixConst; -using namespace MathConst; +using MathConst::MY_PI; +using MathConst::THIRD; enum { NMPIMD }; enum { PHYSICAL, NORMAL }; @@ -63,7 +64,7 @@ enum { SINGLE_PROC, MULTI_PROC }; /* ---------------------------------------------------------------------- */ FixPIMDLangevin::FixPIMDLangevin(LAMMPS *lmp, int narg, char **arg) : - Fix(lmp, narg, arg), random(nullptr), c_pe(nullptr), c_press(nullptr) + Fix(lmp, narg, arg), random(nullptr), c_pe(nullptr), c_press(nullptr) { restart_global = 1; time_integrate = 1; @@ -114,18 +115,18 @@ FixPIMDLangevin::FixPIMDLangevin(LAMMPS *lmp, int narg, char **arg) : int seed = -1; - for (int i = 0; i < 6; i++) - { + for (int i = 0; i < 6; i++) { p_flag[i] = 0; p_target[i] = 0.0; } for (int i = 3; i < narg - 1; i += 2) { if (strcmp(arg[i], "method") == 0) { - if (strcmp(arg[i + 1], "nmpimd") == 0)method = NMPIMD; - else error->universe_all(FLERR, "Unknown method parameter for fix pimd/langevin"); - } - else if (strcmp(arg[i], "integrator") == 0) { + if (strcmp(arg[i + 1], "nmpimd") == 0) + method = NMPIMD; + else + error->universe_all(FLERR, "Unknown method parameter for fix pimd/langevin"); + } else if (strcmp(arg[i], "integrator") == 0) { if (strcmp(arg[i + 1], "obabo") == 0) integrator = OBABO; else if (strcmp(arg[i + 1], "baoab") == 0) @@ -157,11 +158,11 @@ FixPIMDLangevin::FixPIMDLangevin(LAMMPS *lmp, int narg, char **arg) : "Unknown ensemble parameter for fix pimd/langevin. Only nve and nvt " "ensembles are supported!"); } else if (strcmp(arg[i], "fmass") == 0) { - fmass = utils::numeric(FLERR, arg[i+1], false, lmp); + fmass = utils::numeric(FLERR, arg[i + 1], false, lmp); if (fmass < 0.0 || fmass > np) error->universe_all(FLERR, "Invalid fmass value for fix pimd/langevin"); } else if (strcmp(arg[i], "sp") == 0) { - sp = utils::numeric(FLERR, arg[i+1], false, lmp); + sp = utils::numeric(FLERR, arg[i + 1], false, lmp); if (sp < 0.0) error->universe_all(FLERR, "Invalid sp value for fix pimd/nvt"); } else if (strcmp(arg[i], "fmmode") == 0) { if (strcmp(arg[i + 1], "physical") == 0) @@ -204,29 +205,29 @@ FixPIMDLangevin::FixPIMDLangevin(LAMMPS *lmp, int narg, char **arg) : error->universe_all(FLERR, "Unknown barostat parameter for fix pimd/langevin"); } else if (strcmp(arg[i], "iso") == 0) { pstyle = ISO; - Pext = utils::numeric(FLERR, arg[i+1], false, lmp); + Pext = utils::numeric(FLERR, arg[i + 1], false, lmp); p_target[0] = p_target[1] = p_target[2] = Pext; pdim = 3; } else if (strcmp(arg[i], "aniso") == 0) { pstyle = ANISO; p_flag[0] = p_flag[1] = p_flag[2] = 1; - Pext = utils::numeric(FLERR, arg[i+1], false, lmp); + Pext = utils::numeric(FLERR, arg[i + 1], false, lmp); p_target[0] = p_target[1] = p_target[2] = Pext; pdim = 3; } else if (strcmp(arg[i], "x") == 0) { pstyle = ANISO; p_flag[0] = 1; - p_target[0] = utils::numeric(FLERR, arg[i+1], false, lmp); + p_target[0] = utils::numeric(FLERR, arg[i + 1], false, lmp); pdim++; } else if (strcmp(arg[i], "y") == 0) { pstyle = ANISO; p_flag[1] = 1; - p_target[1] = utils::numeric(FLERR, arg[i+1], false, lmp); + p_target[1] = utils::numeric(FLERR, arg[i + 1], false, lmp); pdim++; } else if (strcmp(arg[i], "z") == 0) { pstyle = ANISO; p_flag[2] = 1; - p_target[2] = utils::numeric(FLERR, arg[i+1], false, lmp); + p_target[2] = utils::numeric(FLERR, arg[i + 1], false, lmp); pdim++; } else if (strcmp(arg[i], "taup") == 0) { tau_p = utils::numeric(FLERR, arg[i + 1], false, lmp); @@ -245,12 +246,12 @@ FixPIMDLangevin::FixPIMDLangevin(LAMMPS *lmp, int narg, char **arg) : global_freq = 1; vector_flag = 1; - if (!pstat_flag) size_vector = 10; + if (!pstat_flag) + size_vector = 10; else if (pstat_flag) { - if (pstyle == ISO){ - size_vector = 15; - } - else if (pstyle == ANISO){ + if (pstyle == ISO) { + size_vector = 15; + } else if (pstyle == ANISO) { size_vector = 17; } } @@ -271,7 +272,7 @@ FixPIMDLangevin::FixPIMDLangevin(LAMMPS *lmp, int narg, char **arg) : fixedpoint[0] = 0.5 * (domain->boxlo[0] + domain->boxhi[0]); fixedpoint[1] = 0.5 * (domain->boxlo[1] + domain->boxhi[1]); fixedpoint[2] = 0.5 * (domain->boxlo[2] + domain->boxhi[2]); - if (pstat_flag) { p_hydro = (p_target[0]+p_target[1]+p_target[2])/pdim; } + if (pstat_flag) { p_hydro = (p_target[0] + p_target[1] + p_target[2]) / pdim; } // initialize Marsaglia RNG with processor-unique seed @@ -293,8 +294,10 @@ FixPIMDLangevin::FixPIMDLangevin(LAMMPS *lmp, int narg, char **arg) : nreplica = universe->nworlds; ireplica = universe->iworld; - if (nreplica == 1) mapflag = 0; - else mapflag = 1; + if (nreplica == 1) + mapflag = 0; + else + mapflag = 1; int *iroots = new int[nreplica]; MPI_Group uworldgroup, rootgroup; @@ -426,7 +429,8 @@ void FixPIMDLangevin::init() fbond = _fbond * force->mvv2e; if ((universe->me == 0) && (universe->uscreen)) - fprintf(universe->uscreen, "fix pimd/langevin -P/(beta^2 * hbar^2) = %20.7lE (kcal/mol/A^2)\n\n", fbond); + fprintf(universe->uscreen, + "fix pimd/langevin -P/(beta^2 * hbar^2) = %20.7lE (kcal/mol/A^2)\n\n", fbond); if (integrator == OBABO) { dtf = 0.5 * update->dt * force->ftm2v; @@ -724,13 +728,10 @@ void FixPIMDLangevin::qc_step() if (barostat == BZP) { for (int i = 0; i < nlocal; i++) { for (int j = 0; j < 3; j++) { - if (p_flag[j]) - { + if (p_flag[j]) { x[i][j] = expq[j] * x[i][j] + (expq[j] - expp[j]) / 2. / vw[j] * v[i][j]; v[i][j] = expp[j] * v[i][j]; - } - else - { + } else { x[i][j] += dtv * v[i][j]; } } @@ -844,10 +845,9 @@ void FixPIMDLangevin::press_v_step() } else if (pstyle == ANISO) { compute_stress_tensor(); for (int ii = 0; ii < 3; ii++) { - if (p_flag[ii]) - { - vw[ii] += - dtv * (volume * np * (stress_tensor[ii] - p_hydro) / force->nktv2p + Vcoeff / beta_np) / W; + if (p_flag[ii]) { + vw[ii] += dtv * + (volume * np * (stress_tensor[ii] - p_hydro) / force->nktv2p + Vcoeff / beta_np) / W; if (universe->iworld == 0) { double dvw_proc = 0.0, dvw = 0.0; for (int i = 0; i < nlocal; i++) { @@ -875,10 +875,8 @@ void FixPIMDLangevin::press_o_step() MPI_Bcast(&vw[0], 1, MPI_DOUBLE, 0, universe->uworld); } else if (pstyle == ANISO) { if (universe->me == 0) { - for (int ii=0; ii<3; ii++) - { - if (p_flag[ii]) - { + for (int ii = 0; ii < 3; ii++) { + if (p_flag[ii]) { r1 = random->gaussian(); vw[ii] = c1 * vw[ii] + c2 * sqrt(1.0 / W / beta_np) * r1; } @@ -1155,9 +1153,9 @@ void FixPIMDLangevin::inter_replica_comm(double **ptr) m++; } MPI_Allgather(&m, 1, MPI_INT, counts, 1, MPI_INT, universe->uworld); - for (i = 0; i < nreplica; i++) { counts[i] *= 3; } + for (i = 0; i < nreplica; i++) counts[i] *= 3; displacements[0] = 0; - for (i = 0; i < nreplica - 1; i++) { displacements[i + 1] = displacements[i] + counts[i]; } + for (i = 0; i < nreplica - 1; i++) displacements[i + 1] = displacements[i] + counts[i]; MPI_Allgatherv(bufsorted[0], 3 * m, MPI_DOUBLE, bufsortedall[0], counts, displacements, MPI_DOUBLE, universe->uworld); } else if (cmode == MULTI_PROC) { @@ -1171,11 +1169,11 @@ void FixPIMDLangevin::inter_replica_comm(double **ptr) } MPI_Gather(&m, 1, MPI_INT, counts, 1, MPI_INT, 0, world); displacements[0] = 0; - for (i = 0; i < nprocs - 1; i++) { displacements[i + 1] = displacements[i] + counts[i]; } + for (i = 0; i < nprocs - 1; i++) displacements[i + 1] = displacements[i] + counts[i]; MPI_Gatherv(tagsend, m, MPI_LMP_TAGINT, tagsendall, counts, displacements, MPI_LMP_TAGINT, 0, world); - for (i = 0; i < nprocs; i++) { counts[i] *= 3; } - for (i = 0; i < nprocs - 1; i++) { displacements[i + 1] = displacements[i] + counts[i]; } + for (i = 0; i < nprocs; i++) counts[i] *= 3; + for (i = 0; i < nprocs - 1; i++) displacements[i + 1] = displacements[i] + counts[i]; MPI_Gatherv(bufsend[0], 3 * m, MPI_DOUBLE, bufsendall[0], counts, displacements, MPI_DOUBLE, 0, world); for (int iplan = 0; iplan < sizeplan; iplan++) { @@ -1203,15 +1201,15 @@ void FixPIMDLangevin::inter_replica_comm(double **ptr) /* ---------------------------------------------------------------------- */ -void FixPIMDLangevin::remove_com_motion(){ - if(universe->iworld == 0) - { - double **v = atom->v; - int *mask = atom->mask; +void FixPIMDLangevin::remove_com_motion() +{ + if (universe->iworld == 0) { + double **v = atom->v; + int *mask = atom->mask; int nlocal = atom->nlocal; - if (dynamic) masstotal = group->mass(igroup); + if (dynamic) masstotal = group->mass(igroup); double vcm[3]; - group->vcm(igroup,masstotal,vcm); + group->vcm(igroup, masstotal, vcm); for (int i = 0; i < nlocal; i++) { if (mask[i] & groupbit) { v[i][0] -= vcm[0]; @@ -1372,7 +1370,8 @@ void FixPIMDLangevin::compute_t_vir() void FixPIMDLangevin::compute_p_prim() { double inv_volume = 1.0 / (domain->xprd * domain->yprd * domain->zprd); - p_prim = atom->natoms * np * force->boltz * temp * inv_volume - 1.0 / 1.5 * inv_volume * total_spring_energy; + p_prim = atom->natoms * np * force->boltz * temp * inv_volume - + 1.0 / 1.5 * inv_volume * total_spring_energy; p_prim *= force->nktv2p; } @@ -1415,14 +1414,14 @@ void FixPIMDLangevin::write_restart(FILE *fp) int nsize = size_restart_global(); double *list; - memory->create(list,nsize,"FixPIMDLangevin:list"); + memory->create(list, nsize, "FixPIMDLangevin:list"); pack_restart_data(list); if (comm->me == 0) { int size = nsize * sizeof(double); - fwrite(&size,sizeof(int),1,fp); - fwrite(list,sizeof(double),nsize,fp); + fwrite(&size, sizeof(int), 1, fp); + fwrite(list, sizeof(double), nsize, fp); } memory->destroy(list); @@ -1441,7 +1440,7 @@ int FixPIMDLangevin::size_restart_global() int FixPIMDLangevin::pack_restart_data(double *list) { int n = 0; - for (int i=0; i<6; i++) { list[n++] = vw[i]; } + for (int i = 0; i < 6; i++) list[n++] = vw[i]; return n; } @@ -1451,7 +1450,7 @@ void FixPIMDLangevin::restart(char *buf) { int n = 0; auto list = (double *) buf; - for (int i=0; i<6; i++) { vw[i] = list[n++]; } + for (int i = 0; i < 6; i++) vw[i] = list[n++]; } /* ---------------------------------------------------------------------- */ @@ -1470,7 +1469,7 @@ double FixPIMDLangevin::compute_vector(int n) if (n == 9) return p_cv; if (pstat_flag) { - volume = domain->xprd * domain->yprd * domain->zprd; + volume = domain->xprd * domain->yprd * domain->zprd; if (pstyle == ISO) { if (n == 10) return vw[0]; if (barostat == BZP) { @@ -1478,21 +1477,15 @@ double FixPIMDLangevin::compute_vector(int n) } else if (barostat == MTTK) { if (n == 11) return 1.5 * W * vw[0] * vw[0]; } - if (n == 12) { - return np * Pext * volume / force->nktv2p; - } - if (n == 13) { - return -Vcoeff * np * kBT * log(volume); - } + if (n == 12) { return np * Pext * volume / force->nktv2p; } + if (n == 13) { return -Vcoeff * np * kBT * log(volume); } if (n == 14) return totenthalpy; } else if (pstyle == ANISO) { if (n == 10) return vw[0]; if (n == 11) return vw[1]; if (n == 12) return vw[2]; if (n == 13) return 0.5 * W * (vw[0] * vw[0] + vw[1] * vw[1] + vw[2] * vw[2]); - if (n == 14) { - return np * Pext * volume / force->nktv2p; - } + if (n == 14) { return np * Pext * volume / force->nktv2p; } if (n == 15) { volume = domain->xprd * domain->yprd * domain->zprd; return -Vcoeff * np * kBT * log(volume); From 81a497adcd6d1fa52ac3bf0931bec76a7c8caaf4 Mon Sep 17 00:00:00 2001 From: oywg11 Date: Thu, 18 May 2023 21:51:53 +0800 Subject: [PATCH 064/396] add standard version of ilp_water_2dm --- src/INTERLAYER/pair_ilp_graphene_hbn.cpp | 25 +-- src/INTERLAYER/pair_ilp_graphene_hbn.h | 38 +++- src/INTERLAYER/pair_ilp_tmd.cpp | 213 +++++++++++++++++++---- src/INTERLAYER/pair_ilp_tmd.h | 2 +- src/INTERLAYER/pair_ilp_water_2dm.cpp | 80 +++++++++ src/INTERLAYER/pair_ilp_water_2dm.h | 67 +++++++ 6 files changed, 373 insertions(+), 52 deletions(-) create mode 100644 src/INTERLAYER/pair_ilp_water_2dm.cpp create mode 100644 src/INTERLAYER/pair_ilp_water_2dm.h diff --git a/src/INTERLAYER/pair_ilp_graphene_hbn.cpp b/src/INTERLAYER/pair_ilp_graphene_hbn.cpp index 0ff2811339..956d7ba2be 100644 --- a/src/INTERLAYER/pair_ilp_graphene_hbn.cpp +++ b/src/INTERLAYER/pair_ilp_graphene_hbn.cpp @@ -1,7 +1,7 @@ /* ---------------------------------------------------------------------- LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator https://www.lammps.org/, Sandia National Laboratories - LAMMPS development team: developers@lammps.org + 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 @@ -47,11 +47,11 @@ using namespace InterLayer; static const char cite_ilp[] = "ilp/graphene/hbn potential doi:10.1021/acs.nanolett.8b02848\n" "@Article{Ouyang2018\n" - " author = {W. Ouyang and D. Mandelli and M. Urbakh and O. Hod},\n" + " author = {W. Ouyang, D. Mandelli, M. Urbakh, and O. Hod},\n" " title = {Nanoserpents: Graphene Nanoribbon Motion on Two-Dimensional Hexagonal Materials},\n" " journal = {Nano Letters},\n" " volume = 18,\n" - " pages = 6009,\n" + " pages = {6009}\n" " year = 2018,\n" "}\n\n"; @@ -59,7 +59,10 @@ static const char cite_ilp[] = static std::map variant_map = { {PairILPGrapheneHBN::ILP_GrhBN, "ilp/graphene/hbn"}, {PairILPGrapheneHBN::ILP_TMD, "ilp/tmd"}, - {PairILPGrapheneHBN::SAIP_METAL, "saip/metal"}}; + {PairILPGrapheneHBN::ILP_PHOSPHORUS, "ilp/phosphorus"}, + {PairILPGrapheneHBN::ILP_WATER_2DM, "ilp/water/2dm"}, + {PairILPGrapheneHBN::SAIP_METAL, "saip/metal"}, + {PairILPGrapheneHBN::SAIP_METAL_TMD, "saip/metal/tmd"}}; /* ---------------------------------------------------------------------- */ @@ -313,14 +316,14 @@ void PairILPGrapheneHBN::read_file(char *filename) for (int m = 0; m < nparams; m++) { if (i == params[m].ielement && j == params[m].jelement) { if (n >= 0) - error->all(FLERR, "{} potential file {} has a duplicate entry for: {} {}", - variant_map[variant], filename, elements[i], elements[j]); + error->all(FLERR, "{} potential file {} has a duplicate entry", variant_map[variant], + filename); n = m; } } if (n < 0) - error->all(FLERR, "{} potential file {} is missing an entry for: {} {}", - variant_map[variant], filename, elements[i], elements[j]); + error->all(FLERR, "{} potential file {} is missing an entry", variant_map[variant], + filename); elem2param[i][j] = n; cutILPsq[i][j] = params[n].rcut * params[n].rcut; } @@ -632,7 +635,7 @@ void PairILPGrapheneHBN::calc_FRep(int eflag, int /* vflag */) void PairILPGrapheneHBN::ILP_neigh() { - int i, j, ii, jj, n, allnum, jnum, itype, jtype; + int i, j, ii, jj, n, inum, jnum, itype, jtype; double xtmp, ytmp, ztmp, delx, dely, delz, rsq; int *ilist, *jlist, *numneigh, **firstneigh; int *neighptr; @@ -649,7 +652,7 @@ void PairILPGrapheneHBN::ILP_neigh() (int **) memory->smalloc(maxlocal * sizeof(int *), "ILPGrapheneHBN:firstneigh"); } - allnum = list->inum + list->gnum; + inum = list->inum; // + list->gnum; ilist = list->ilist; numneigh = list->numneigh; firstneigh = list->firstneigh; @@ -659,7 +662,7 @@ void PairILPGrapheneHBN::ILP_neigh() ipage->reset(); - for (ii = 0; ii < allnum; ii++) { + for (ii = 0; ii < inum; ii++) { i = ilist[ii]; n = 0; diff --git a/src/INTERLAYER/pair_ilp_graphene_hbn.h b/src/INTERLAYER/pair_ilp_graphene_hbn.h index 9987830b1d..6381fb8f35 100644 --- a/src/INTERLAYER/pair_ilp_graphene_hbn.h +++ b/src/INTERLAYER/pair_ilp_graphene_hbn.h @@ -1,7 +1,7 @@ /* -*- c++ -*- ---------------------------------------------------------- LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator https://www.lammps.org/, Sandia National Laboratories - LAMMPS development team: developers@lammps.org + 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 @@ -35,11 +35,19 @@ class PairILPGrapheneHBN : public Pair { double init_one(int, int) override; void init_style() override; void calc_FvdW(int, int); + virtual void calc_FRep(int, int); + virtual void ILP_neigh(); + virtual void calc_normal(); + void read_file(char *); + void allocate(); + double single(int, int, int, int, double, double, double, double &) override; static constexpr int NPARAMS_PER_LINE = 13; - enum { ILP_GrhBN, ILP_TMD, SAIP_METAL }; // for telling class variants apart in shared code + // for telling class variants apart in shared code + enum { ILP_GrhBN, ILP_TMD, SAIP_METAL, + ILP_WATER_2DM, SAIP_METAL_TMD, ILP_PHOSPHORUS }; protected: int me; @@ -51,6 +59,7 @@ class PairILPGrapheneHBN : public Pair { int *ILP_numneigh; // # of pair neighbors for each atom int **ILP_firstneigh; // ptr to 1st neighbor of each atom int tap_flag; // flag to turn on/off taper function + double ncf; // for ilp/phosphorus, coefficients for calcualting the normals struct Param { double z0, alpha, epsilon, C, delta, d, sR, reff, C6, S; @@ -76,15 +85,28 @@ class PairILPGrapheneHBN : public Pair { double ***dpvet1; double ***dpvet2; double ***dNave; - - virtual void ILP_neigh(); - virtual void calc_normal(); - virtual void calc_FRep(int, int); - void read_file(char *); - void allocate(); }; } // namespace LAMMPS_NS #endif #endif + +/* ERROR/WARNING messages: + +E: Illegal ... command + +Self-explanatory. Check the input script syntax and compare to the +documentation for the command. You can use -echo screen as a +command-line option when running LAMMPS to see the offending line. + +E: Incorrect args for pair coefficients + +Self-explanatory. Check the input script or data file. + +E: All pair coeffs are not set + +All pair coefficients must be set in the data file or by the +pair_coeff command before running a simulation. + +*/ diff --git a/src/INTERLAYER/pair_ilp_tmd.cpp b/src/INTERLAYER/pair_ilp_tmd.cpp index c024e23079..d855b9423d 100644 --- a/src/INTERLAYER/pair_ilp_tmd.cpp +++ b/src/INTERLAYER/pair_ilp_tmd.cpp @@ -1,7 +1,7 @@ /* ---------------------------------------------------------------------- LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator https://www.lammps.org/, Sandia National Laboratories - LAMMPS development team: developers@lammps.org + 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 @@ -22,12 +22,14 @@ #include "atom.h" #include "citeme.h" +#include "comm.h" #include "error.h" #include "force.h" #include "interlayer_taper.h" #include "memory.h" #include "my_page.h" #include "neigh_list.h" +#include "neighbor.h" #include #include @@ -35,22 +37,20 @@ using namespace LAMMPS_NS; using namespace InterLayer; -#define MAXLINE 1024 #define DELTA 4 #define PGDELTA 1 -static const char cite_ilp_tmd[] = - "ilp/tmd potential doi:10.1021/acs.jctc.1c00782\n" - "@Article{Ouyang2021\n" - " author = {W. Ouyang and R. Sofer and X. Gao and J. Hermann and\n" - " A. Tkatchenko and L. Kronik and M. Urbakh and O. Hod},\n" - " title = {Anisotropic Interlayer Force Field for Transition\n" - " Metal Dichalcogenides: The Case of Molybdenum Disulfide},\n" - " journal = {J.~Chem.\\ Theory Comput.},\n" - " volume = 17,\n" - " pages = {7237--7245}\n" - " year = 2021,\n" - "}\n\n"; +static const char cite_ilp_tmd[] = "ilp/tmd potential doi/10.1021/acs.jctc.1c00782\n" + "@Article{Ouyang2021\n" + " author = {W. Ouyang, R. Sofer, X. Gao, J. Hermann, A. " + "Tkatchenko, L. Kronik, M. Urbakh, and O. Hod},\n" + " title = {Anisotropic Interlayer Force Field for Transition " + "Metal Dichalcogenides: The Case of Molybdenum Disulfide},\n" + " journal = {J. Chem. Theory Comput.},\n" + " volume = 17,\n" + " pages = {7237–7245}\n" + " year = 2021,\n" + "}\n\n"; /* ---------------------------------------------------------------------- */ @@ -232,7 +232,7 @@ void PairILPTMD::calc_FRep(int eflag, int /* vflag */) void PairILPTMD::ILP_neigh() { - int i, j, l, ii, jj, ll, n, allnum, jnum, itype, jtype, ltype, imol, jmol, count; + int i, j, l, ii, jj, ll, n, inum, jnum, itype, jtype, ltype, imol, jmol, count; double xtmp, ytmp, ztmp, delx, dely, delz, deljx, deljy, deljz, rsq, rsqlj; int *ilist, *jlist, *numneigh, **firstneigh; int *neighsort; @@ -249,7 +249,7 @@ void PairILPTMD::ILP_neigh() ILP_firstneigh = (int **) memory->smalloc(maxlocal * sizeof(int *), "ILPTMD:firstneigh"); } - allnum = list->inum + list->gnum; + inum = list->inum; //+ list->gnum; ilist = list->ilist; numneigh = list->numneigh; firstneigh = list->firstneigh; @@ -259,7 +259,7 @@ void PairILPTMD::ILP_neigh() ipage->reset(); - for (ii = 0; ii < allnum; ii++) { + for (ii = 0; ii < inum; ii++) { i = ilist[ii]; //initialize varibles @@ -288,21 +288,21 @@ void PairILPTMD::ILP_neigh() delz = ztmp - x[j][2]; rsq = delx * delx + dely * dely + delz * delz; - // check if the atom i is TMD, i.e., Mo/S/W/Se - if (strcmp(elements[itype], "Mo") == 0 || strcmp(elements[itype], "W") == 0 || - strcmp(elements[itype], "S") == 0 || strcmp(elements[itype], "Se") == 0 || + // check if the atom i is a TMD atom, i.e., Mo/S/W/Se + if (strcmp(elements[itype], "Mo") == 0 || strcmp(elements[itype], "W") == 0 || + strcmp(elements[itype], "S") == 0 || strcmp(elements[itype], "Se") == 0 || strcmp(elements[itype], "Te") == 0) { if (rsq != 0 && rsq < cutILPsq[itype][jtype] && imol == jmol && type[i] == type[j]) { neighptr[n++] = j; } - } else { // atom i is C, B, N or H. + } else { // atom i can be P, C, B, N or H. if (rsq != 0 && rsq < cutILPsq[itype][jtype] && imol == jmol) { neighptr[n++] = j; } } } // loop over jj // if atom i is Mo/W/S/Se/Te, then sorting the orders of neighbors - if (strcmp(elements[itype], "Mo") == 0 || strcmp(elements[itype], "W") == 0 || - strcmp(elements[itype], "S") == 0 || strcmp(elements[itype], "Se") == 0 || + if (strcmp(elements[itype], "Mo") == 0 || strcmp(elements[itype], "W") == 0 || + strcmp(elements[itype], "S") == 0 || strcmp(elements[itype], "Se") == 0 || strcmp(elements[itype], "Te") == 0) { // initialize neighsort for (ll = 0; ll < n; ll++) { @@ -367,11 +367,11 @@ void PairILPTMD::ILP_neigh() ll++; } } // end of sorting the order of neighbors - } else { // for B/N/C/H atoms + } else { // for P/B/N/C/H atoms if (n > 3) error->one( FLERR, - "There are too many neighbors for B/N/C/H atoms, please check your configuration"); + "There are too many neighbors for P/B/N/C/H atoms, please check your configuration"); for (ll = 0; ll < n; ll++) { neighsort[ll] = neighptr[ll]; } } @@ -390,12 +390,14 @@ void PairILPTMD::calc_normal() { int i, j, ii, jj, inum, jnum; int cont, id, ip, m, k, itype; - double nn, xtp, ytp, ztp, delx, dely, delz, nn2; int *ilist, *jlist; + int iH1,iH2,jH1,jH2; double Nave[3], dni[3], dpvdri[3][3]; + double nn, xtp, ytp, ztp, delx, dely, delz, nn2; double **x = atom->x; int *type = atom->type; + tagint *tag = atom->tag; memory->destroy(dnn); memory->destroy(vect); @@ -479,9 +481,63 @@ void PairILPTMD::calc_normal() for (m = 0; m < Nnei; m++) { dnormal[i][id][m][ip] = 0.0; } } } + // for hydrogen in water molecule + if (strcmp(elements[itype], "Hw") == 0) { + if(cont == 0) { + jH1 = atom->map(tag[i] - 1); + jH2 = atom->map(tag[i] - 2); + iH1 = map[type[jH1]]; + iH2 = map[type[jH2]]; + if (strcmp(elements[iH1], "Ow") == 0 ) { + vect[0][0] = x[jH1][0] - xtp; + vect[0][1] = x[jH1][1] - ytp; + vect[0][2] = x[jH1][2] - ztp; + } else if (strcmp(elements[iH2], "Ow") == 0 ) { + vect[0][0] = x[jH2][0] - xtp; + vect[0][1] = x[jH2][1] - ytp; + vect[0][2] = x[jH2][2] - ztp; + } else { + fprintf(screen, "jH1 jH2 = %d %d\n", jH1,jH2); + fprintf(screen, "Atom Type = %d %d\n", type[jH1],type[jH2]); + fprintf(screen, "For atom i = %d %d\n", tag[i],type[i]); + error->one(FLERR, "The order of atoms in water molecule should be O H H !"); + } + } + Nave[0] = vect[0][0]; + Nave[1] = vect[0][1]; + Nave[2] = vect[0][2]; + // the magnitude of the normal vector + nn2 = Nave[0] * Nave[0] + Nave[1] * Nave[1] + Nave[2] * Nave[2]; + nn = sqrt(nn2); + if (nn == 0) error->one(FLERR, "The magnitude of the normal vector is zero"); + // the unit normal vector + normal[i][0] = Nave[0] / nn; + normal[i][1] = Nave[1] / nn; + normal[i][2] = Nave[2] / nn; + + // Calculte dNave/dri, defined as dpvdri + for (id = 0; id < 3; id++) { + for (ip = 0; ip < 3; ip++) { + if (ip == id) { dpvdri[id][ip] = -1.0;} + else {dpvdri[id][ip] = 0.0;} + } + } + + // derivatives of nn, dnn:3x1 vector + dni[0] = (Nave[0] * dpvdri[0][0] + Nave[1] * dpvdri[1][0] + Nave[2] * dpvdri[2][0]) / nn; + dni[1] = (Nave[0] * dpvdri[0][1] + Nave[1] * dpvdri[1][1] + Nave[2] * dpvdri[2][1]) / nn; + dni[2] = (Nave[0] * dpvdri[0][2] + Nave[1] * dpvdri[1][2] + Nave[2] * dpvdri[2][2]) / nn; + // derivatives of unit vector ni respect to ri, the result is 3x3 matrix + for (id = 0; id < 3; id++) { + for (ip = 0; ip < 3; ip++) { + dnormdri[i][id][ip] = dpvdri[id][ip] / nn - Nave[id] * dni[ip] / nn2; + dnormal[i][id][0][ip] = -dnormdri[i][id][ip]; + } + } + } } //############################ For the edge atoms of TMD ################################ - else if (cont < Nnei) { + else if (cont > 1 && cont < Nnei) { if (strcmp(elements[itype], "Mo") == 0 || strcmp(elements[itype], "W") == 0 || strcmp(elements[itype], "S") == 0 || strcmp(elements[itype], "Se") == 0) { // derivatives of Ni[l] respect to the cont neighbors @@ -557,8 +613,7 @@ void PairILPTMD::calc_normal() for (m = 0; m < cont; m++) { for (id = 0; id < 3; id++) { dnn[m][id] = (Nave[0] * dNave[0][m][id] + Nave[1] * dNave[1][m][id] + - Nave[2] * dNave[2][m][id]) / - nn; + Nave[2] * dNave[2][m][id]) / nn; } } // dnormal[i][id][m][ip]: the derivative of normal[i][id] respect to r[m][ip], id,ip=0,1,2. @@ -589,12 +644,107 @@ void PairILPTMD::calc_normal() } } } // for TMD + //############################ For Oxygen in the water molecule ####################### + else if (strcmp(elements[itype], "Ow") == 0) { + if(cont == 0) { + jH1 = atom->map(tag[i] + 1); + jH2 = atom->map(tag[i] + 2); + iH1 = map[type[jH1]]; + iH2 = map[type[jH2]]; + if (strcmp(elements[iH1], "Hw") == 0 && strcmp(elements[iH2], "Hw") == 0) { + vect[0][0] = x[jH1][0] - xtp; + vect[0][1] = x[jH1][1] - ytp; + vect[0][2] = x[jH1][2] - ztp; + + vect[1][0] = x[jH2][0] - xtp; + vect[1][1] = x[jH2][1] - ytp; + vect[1][2] = x[jH2][2] - ztp; + + cont = 2; + } else { + fprintf(screen, "jH1 jH2 = %d %d\n", jH1,jH2); + fprintf(screen, "Atom Type = %d %d\n", type[jH1],type[jH2]); + fprintf(screen, "ID and type of atom i = %d %d\n", tag[i],type[i]); + error->one(FLERR, "The order of atoms in water molecule should be O H H !"); + } + } + if (cont == 2) { + Nave[0] = (vect[0][0] + vect[1][0])/cont; + Nave[1] = (vect[0][1] + vect[1][1])/cont; + Nave[2] = (vect[0][2] + vect[1][2])/cont; + // the magnitude of the normal vector + nn2 = Nave[0] * Nave[0] + Nave[1] * Nave[1] + Nave[2] * Nave[2]; + nn = sqrt(nn2); + if (nn == 0) error->one(FLERR, "The magnitude of the normal vector is zero"); + // the unit normal vector + normal[i][0] = Nave[0] / nn; + normal[i][1] = Nave[1] / nn; + normal[i][2] = Nave[2] / nn; + + // derivatives of non-normalized normal vector, dNave:3xcontx3 array + // dNave[id][m][ip]: the derivatve of the id component of Nave + // respect to the ip component of atom m + for (id = 0; id < 3; id++) { + for (ip = 0; ip < 3; ip++) { + for (m = 0; m < cont; m++) { + if (ip == id) { dNave[id][m][ip] = 0.5;} + else {dNave[id][m][ip] = 0.0;} + } + } + } + // derivatives of nn, dnn:contx3 vector + // dnn[m][id]: the derivative of nn respect to r[m][id], m=0,...Nnei-1; id=0,1,2 + // r[m][id]: the id's component of atom m + for (m = 0; m < cont; m++) { + for (id = 0; id < 3; id++) { + dnn[m][id] = (Nave[0] * dNave[0][m][id] + Nave[1] * dNave[1][m][id] + + Nave[2] * dNave[2][m][id]) / nn; + } + } + // dnormal[i][id][m][ip]: the derivative of normal[i][id] respect to r[m][ip], id,ip=0,1,2. + // for atom m, which is a neighbor atom of atom i, m = 0,...,Nnei-1 + for (m = 0; m < cont; m++) { + for (id = 0; id < 3; id++) { + for (ip = 0; ip < 3; ip++) { + dnormal[i][id][m][ip] = dNave[id][m][ip] / nn - Nave[id] * dnn[m][ip] / nn2; + } + } + } + // Calculte dNave/dri, defined as dpvdri + for (id = 0; id < 3; id++) { + for (ip = 0; ip < 3; ip++) { + dpvdri[id][ip] = 0.0; + for (k = 0; k < cont; k++) { dpvdri[id][ip] -= dNave[id][k][ip]; } + } + } + + // derivatives of nn, dnn:3x1 vector + dni[0] = (Nave[0] * dpvdri[0][0] + Nave[1] * dpvdri[1][0] + Nave[2] * dpvdri[2][0]) / nn; + dni[1] = (Nave[0] * dpvdri[0][1] + Nave[1] * dpvdri[1][1] + Nave[2] * dpvdri[2][1]) / nn; + dni[2] = (Nave[0] * dpvdri[0][2] + Nave[1] * dpvdri[1][2] + Nave[2] * dpvdri[2][2]) / nn; + // derivatives of unit vector ni respect to ri, the result is 3x3 matrix + for (id = 0; id < 3; id++) { + for (ip = 0; ip < 3; ip++) { + dnormdri[i][id][ip] = dpvdri[id][ip] / nn - Nave[id] * dni[ip] / nn2; + } + } + // printf("%4d:\t%e %e %e\n\t%e %e %e\n\t%e %e %e\n", + // i, dnormdri[i][0][0], dnormdri[i][0][1], dnormdri[i][0][2], + // dnormdri[i][1][0],dnormdri[i][1][1],dnormdri[i][1][2], + // dnormdri[i][2][0],dnormdri[i][2][1],dnormdri[i][2][2]); + // exit(0); + } + else if (cont >= 3) { + error->one(FLERR, + "There are too many neighbors for calculating normals of water molecules"); + } + } //############################ For the edge & bulk atoms of GrhBN ################################ else { if (cont == 2) { for (ip = 0; ip < 3; ip++) { pvet[0][ip] = vect[0][modulo(ip + 1, 3)] * vect[1][modulo(ip + 2, 3)] - - vect[0][modulo(ip + 2, 3)] * vect[1][modulo(ip + 1, 3)]; + vect[0][modulo(ip + 2, 3)] * vect[1][modulo(ip + 1, 3)]; } // dpvet1[k][l][ip]: the derivatve of the k (=0,...cont-1)th Nik respect to the ip component of atom l // derivatives respect to atom l @@ -657,8 +807,7 @@ void PairILPTMD::calc_normal() for (m = 0; m < cont; m++) { for (id = 0; id < 3; id++) { dnn[m][id] = (Nave[0] * dNave[0][m][id] + Nave[1] * dNave[1][m][id] + - Nave[2] * dNave[2][m][id]) / - nn; + Nave[2] * dNave[2][m][id]) / nn; } } // dnormal[i][id][m][ip]: the derivative of normal[i][id] respect to r[m][ip], id,ip=0,1,2. diff --git a/src/INTERLAYER/pair_ilp_tmd.h b/src/INTERLAYER/pair_ilp_tmd.h index 8381c2e830..8d5446d49c 100644 --- a/src/INTERLAYER/pair_ilp_tmd.h +++ b/src/INTERLAYER/pair_ilp_tmd.h @@ -1,7 +1,7 @@ /* -*- c++ -*- ---------------------------------------------------------- LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator https://www.lammps.org/, Sandia National Laboratories - LAMMPS development team: developers@lammps.org + 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 diff --git a/src/INTERLAYER/pair_ilp_water_2dm.cpp b/src/INTERLAYER/pair_ilp_water_2dm.cpp new file mode 100644 index 0000000000..58e56894f5 --- /dev/null +++ b/src/INTERLAYER/pair_ilp_water_2dm.cpp @@ -0,0 +1,80 @@ +/* ---------------------------------------------------------------------- + LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator + https://www.lammps.org/, 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 author: Wengen Ouyang (Wuhan University) + e-mail: w.g.ouyang at gmail dot com + + This is a full version of the potential described in + [Feng and Ouyang et al, J. Phys. Chem. C 127, 8704-8713 (2023).] +------------------------------------------------------------------------- */ + +#include "pair_ilp_water_2dm.h" + +#include "atom.h" +#include "citeme.h" +#include "comm.h" +#include "error.h" +#include "force.h" +#include "interlayer_taper.h" +#include "memory.h" +#include "my_page.h" +#include "neigh_list.h" +#include "neigh_request.h" +#include "neighbor.h" + +#include +#include + +using namespace LAMMPS_NS; +using namespace InterLayer; + +#define MAXLINE 1024 +#define DELTA 4 +#define PGDELTA 1 + +static const char cite_ilp_water[] = "ilp/water/2dm potential doi/10.1021/acs.jpcc.2c08464\n" + "@Article{Feng2023\n" + " author = {Z. Feng, Y. Yao, J. Liu, B. Wu, Z. Liu, and W. Ouyang},\n" + " title = {Registry-Dependent Potential for Interfaces of Water with Graphene},\n" + " journal = {J. Phys. Chem. C},\n" + " volume = 127,\n" + " pages = {8704-8713}\n" + " year = 2023,\n" + "}\n\n"; + +/* ---------------------------------------------------------------------- */ + +PairILPWATER2DM::PairILPWATER2DM(LAMMPS *lmp) : PairILPGrapheneHBN(lmp), PairILPTMD(lmp) +{ + variant = ILP_WATER_2DM; + single_enable = 0; + + // for TMD, each atom have six neighbors + Nnei = 6; + + if (lmp->citeme) lmp->citeme->add(cite_ilp_water); +} + +/* ---------------------------------------------------------------------- + global settings +------------------------------------------------------------------------- */ + +void PairILPWATER2DM::settings(int narg, char **arg) +{ + if (narg < 1 || narg > 2) error->all(FLERR, "Illegal pair_style command"); + if (!utils::strmatch(force->pair_style, "^hybrid/overlay")) + error->all(FLERR, "Pair style ilp/water/2dm must be used as sub-style with hybrid/overlay"); + + cut_global = utils::numeric(FLERR, arg[0], false, lmp); + if (narg == 2) tap_flag = utils::numeric(FLERR, arg[1], false, lmp); +} diff --git a/src/INTERLAYER/pair_ilp_water_2dm.h b/src/INTERLAYER/pair_ilp_water_2dm.h new file mode 100644 index 0000000000..c35d757ea0 --- /dev/null +++ b/src/INTERLAYER/pair_ilp_water_2dm.h @@ -0,0 +1,67 @@ +/* -*- c++ -*- ---------------------------------------------------------- + LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator + https://www.lammps.org/, 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. +------------------------------------------------------------------------- */ + +#ifdef PAIR_CLASS +// clang-format off +PairStyle(ilp/water/2dm,PairILPWATER2DM); +// clang-format on +#else + +#ifndef LMP_PAIR_ILP_WATER_2DM_H +#define LMP_PAIR_ILP_WATER_2DM_H + +#include "pair_ilp_tmd.h" + +namespace LAMMPS_NS { + +class PairILPWATER2DM : virtual public PairILPTMD { + public: + PairILPWATER2DM(class LAMMPS *); + + protected: + void settings(int, char **) override; + + /**************************************************************/ + /* modulo operation with cycling around range */ + + inline int modulo(int k, int range) + { + if (k < 0) k += range; + return k % range; + } + /**************************************************************/ +}; + +} // namespace LAMMPS_NS + +#endif +#endif + +/* ERROR/WARNING messages: + +E: Illegal ... command + +Self-explanatory. Check the input script syntax and compare to the +documentation for the command. You can use -echo screen as a +command-line option when running LAMMPS to see the offending line. + +E: Incorrect args for pair coefficients + +Self-explanatory. Check the input script or data file. + +E: All pair coeffs are not set + +All pair coefficients must be set in the data file or by the +pair_coeff command before running a simulation. + +*/ From cc30c4478dcfe6c73d908398437cc58909d1be5c Mon Sep 17 00:00:00 2001 From: oywg11 Date: Thu, 18 May 2023 21:58:40 +0800 Subject: [PATCH 065/396] add optmized verion of ilp_water_2dm --- src/OPT/pair_ilp_graphene_hbn_opt.cpp | 99 +++++++++++++++++++++++---- src/OPT/pair_ilp_graphene_hbn_opt.h | 12 +++- src/OPT/pair_ilp_water_2dm_opt.cpp | 73 ++++++++++++++++++++ src/OPT/pair_ilp_water_2dm_opt.h | 39 +++++++++++ 4 files changed, 207 insertions(+), 16 deletions(-) create mode 100644 src/OPT/pair_ilp_water_2dm_opt.cpp create mode 100644 src/OPT/pair_ilp_water_2dm_opt.h diff --git a/src/OPT/pair_ilp_graphene_hbn_opt.cpp b/src/OPT/pair_ilp_graphene_hbn_opt.cpp index 586c44be08..63822ad4c6 100644 --- a/src/OPT/pair_ilp_graphene_hbn_opt.cpp +++ b/src/OPT/pair_ilp_graphene_hbn_opt.cpp @@ -1,7 +1,7 @@ /* ---------------------------------------------------------------------- LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator https://www.lammps.org/, Sandia National Laboratories - LAMMPS development team: developers@lammps.org + 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 @@ -23,24 +23,27 @@ #include "atom.h" #include "citeme.h" +#include "comm.h" #include "error.h" #include "force.h" #include "interlayer_taper.h" #include "memory.h" #include "neigh_list.h" +#include "neigh_request.h" #include "neighbor.h" +#include "pointers.h" #include -#include +#include using namespace LAMMPS_NS; using namespace InterLayer; static const char cite_ilp_cur[] = - "ilp/graphene/hbn/opt potential: doi:10.1145/3458817.3476137\n" + "ilp/graphene/hbn/opt potential doi:10.1145/3458817.3476137\n" "@inproceedings{gao2021lmff\n" - " author = {Gao, Ping and Duan, Xiaohui and others},\n" - " title = {{LMFF}: Efficient and Scalable Layered Materials Force Field on Heterogeneous " + " author = {Gao, Ping and Duan, Xiaohui and Others},\n" + " title = {LMFF: Efficient and Scalable Layered Materials Force Field on Heterogeneous " "Many-Core Processors},\n" " year = {2021},\n" " isbn = {9781450384421},\n" @@ -50,14 +53,12 @@ static const char cite_ilp_cur[] = " doi = {10.1145/3458817.3476137},\n" " booktitle = {Proceedings of the International Conference for High Performance Computing, " "Networking, Storage and Analysis},\n" - " pages = {42},\n" + " articleno = {42},\n" " numpages = {14},\n" - " location = {St.~Louis, Missouri},\n" + " location = {St. Louis, Missouri},\n" " series = {SC'21},\n" "}\n\n"; -static bool check_vdw(tagint itag, tagint jtag, double *xi, double *xj); - /* ---------------------------------------------------------------------- */ PairILPGrapheneHBNOpt::PairILPGrapheneHBNOpt(LAMMPS *lmp) : @@ -168,6 +169,36 @@ void PairILPGrapheneHBNOpt::compute(int eflag, int vflag) } } } + } else if (variant == ILP_WATER_2DM) { + if (eflag_global || eflag_atom) { + if (vflag_either) { + if (tap_flag) { + eval<6, 1, 1, 1, ILP_WATER_2DM>(); + } else { + eval<6, 1, 1, 0, ILP_WATER_2DM>(); + } + } else { + if (tap_flag) { + eval<6, 1, 0, 1, ILP_WATER_2DM>(); + } else { + eval<6, 1, 0, 0, ILP_WATER_2DM>(); + } + } + } else { + if (vflag_either) { + if (tap_flag) { + eval<6, 0, 1, 1, ILP_WATER_2DM>(); + } else { + eval<6, 0, 1, 0, ILP_WATER_2DM>(); + } + } else { + if (tap_flag) { + eval<6, 0, 0, 1, ILP_WATER_2DM>(); + } else { + eval<6, 0, 0, 0, ILP_WATER_2DM>(); + } + } + } } else if (variant == SAIP_METAL) { if (eflag_global || eflag_atom) { if (vflag_either) { @@ -255,7 +286,7 @@ void PairILPGrapheneHBNOpt::eval() rsq = delx * delx + dely * dely + delz * delz; if (rsq != 0 && rsq < cutILPsq[itype_map][jtype]) { - if (VARIANT == ILP_TMD && special_type[itype] && itype != type[j]) continue; + if ((VARIANT == ILP_TMD || VARIANT == ILP_WATER_2DM) && special_type[itype] == TMD_METAL && itype != type[j]) continue; if (ILP_nneigh >= MAX_NNEIGH) { error->one(FLERR, "There are too many neighbors for calculating normals"); } @@ -269,7 +300,8 @@ void PairILPGrapheneHBNOpt::eval() dproddni[2] = 0.0; double norm[3], dnormdxi[3][3], dnormdxk[MAX_NNEIGH][3][3]; - calc_normal(i, ILP_neigh, ILP_nneigh, norm, dnormdxi, dnormdxk); + + calc_normal(i, itype, ILP_neigh, ILP_nneigh, norm, dnormdxi, dnormdxk); for (jj = 0; jj < jnum_inter; jj++) { j = jlist_inter[jj]; @@ -298,7 +330,7 @@ void PairILPGrapheneHBNOpt::eval() Tap = 1.0; dTap = 0.0; } - if (VARIANT != SAIP_METAL || !special_type[itype]) { + if (VARIANT != SAIP_METAL || special_type[itype] != SAIP_BNCH) { // Calculate the transverse distance prodnorm1 = norm[0] * delx + norm[1] * dely + norm[2] * delz; rhosq1 = rsq - prodnorm1 * prodnorm1; // rho_ij @@ -310,7 +342,7 @@ void PairILPGrapheneHBNOpt::eval() frho1 = exp1 * p.C; Erep = 0.5 * p.epsilon + frho1; - if (VARIANT == SAIP_METAL && special_type[jtype]) { Erep += 0.5 * p.epsilon + p.C; } + if (VARIANT == SAIP_METAL && special_type[jtype] == SAIP_BNCH) { Erep += 0.5 * p.epsilon + p.C; } Vilp = exp0 * Erep; // derivatives @@ -428,6 +460,19 @@ inline void deriv_normal(double dndr[3][3], double *del, double *n, double rnnor dndr[1][2] = (del[1] * n[0] * n[1] + del[0] * (n[0] * n[0] + n[2] * n[2])) * rnnorm; dndr[2][2] = (del[1] * n[0] * n[2] - del[0] * n[1] * n[2]) * rnnorm; } +inline void deriv_hat(double dnhatdn[3][3], double *n, double rnnorm, double factor){ + double cfactor = rnnorm * factor; + dnhatdn[0][0] = (n[1]*n[1]+n[2]*n[2])*cfactor; + dnhatdn[1][0] = -n[1]*n[0]*cfactor; + dnhatdn[2][0] = -n[2]*n[0]*cfactor; + dnhatdn[0][1] = -n[0]*n[1]*cfactor; + dnhatdn[1][1] = (n[0]*n[0]+n[2]*n[2])*cfactor; + dnhatdn[2][1] = -n[2]*n[1]*cfactor; + dnhatdn[0][2] = -n[0]*n[2]*cfactor; + dnhatdn[1][2] = -n[1]*n[2]*cfactor; + dnhatdn[2][2] = (n[0]*n[0]+n[1]*n[1])*cfactor; + +} inline double normalize_factor(double *n) { double nnorm = sqrt(n[0] * n[0] + n[1] * n[1] + n[2] * n[2]); @@ -441,7 +486,7 @@ inline double normalize_factor(double *n) Yet another normal calculation method for simpiler code. */ template -void PairILPGrapheneHBNOpt::calc_normal(int i, int *ILP_neigh, int nneigh, double *n, +void PairILPGrapheneHBNOpt::calc_normal(int i, int itype, int *ILP_neigh, int nneigh, double *n, double (*dnormdri)[3], double (*dnormdrk)[3][3]) { double **x = atom->x; @@ -475,6 +520,32 @@ void PairILPGrapheneHBNOpt::calc_normal(int i, int *ILP_neigh, int nneigh, doubl vet[jj][2] = x[j][2] - x[i][2]; } + //specialize for ILP_WATER_2DM for hydrogen has special normal vector rule + if (variant == ILP_WATER_2DM && special_type[itype] == WATER) { + if (nneigh == 1){ + n[0] = vet[0][0]; + n[1] = vet[0][1]; + n[2] = vet[0][2]; + + double rnnorm = normalize_factor(n); + + deriv_hat(dnormdri, n, rnnorm, -1.0); + deriv_hat(dnormdrk[0], n, rnnorm, 1.0); + + } else if (nneigh == 2){ + n[0] = (vet[0][0] + vet[1][0])*0.5; + n[1] = (vet[0][1] + vet[1][1])*0.5; + n[2] = (vet[0][2] + vet[1][2])*0.5; + double rnnorm = normalize_factor(n); + + deriv_hat(dnormdri, n, rnnorm, -1.0); + deriv_hat(dnormdrk[0], n, rnnorm, 0.5); + deriv_hat(dnormdrk[1], n, rnnorm, 0.5); + } else { + error->one(FLERR, "malformed water"); + } + return; + } if (nneigh <= 1) { n[0] = 0.0; n[1] = 0.0; diff --git a/src/OPT/pair_ilp_graphene_hbn_opt.h b/src/OPT/pair_ilp_graphene_hbn_opt.h index 0721014e00..bc22ab22b0 100644 --- a/src/OPT/pair_ilp_graphene_hbn_opt.h +++ b/src/OPT/pair_ilp_graphene_hbn_opt.h @@ -1,7 +1,7 @@ /* -*- c++ -*- ---------------------------------------------------------- LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator https://www.lammps.org/, Sandia National Laboratories - LAMMPS development team: developers@lammps.org + 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 @@ -35,7 +35,7 @@ class PairILPGrapheneHBNOpt : virtual public PairILPGrapheneHBN { protected: void update_internal_list(); template - void calc_normal(int i, int *ILP_neigh, int nneigh, double *normal, double (*dnormdri)[3], + void calc_normal(int i, int itype, int *ILP_neigh, int nneigh, double *normal, double (*dnormdri)[3], double (*dnormdrk)[3][3]); template void eval(); @@ -44,6 +44,14 @@ class PairILPGrapheneHBNOpt : virtual public PairILPGrapheneHBN { int *special_type; int *num_intra, *num_inter, *num_vdw; int inum_max, jnum_max; + + enum special_type_const { + NOT_SPECIAL = 0, + TMD_METAL, + SAIP_BNCH, + WATER, + }; + }; } // namespace LAMMPS_NS diff --git a/src/OPT/pair_ilp_water_2dm_opt.cpp b/src/OPT/pair_ilp_water_2dm_opt.cpp new file mode 100644 index 0000000000..6cdac00ed9 --- /dev/null +++ b/src/OPT/pair_ilp_water_2dm_opt.cpp @@ -0,0 +1,73 @@ +/* ---------------------------------------------------------------------- + LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator + https://www.lammps.org/, 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. +------------------------------------------------------------------------- */ + +/* ---------------------------------------------------------------------- + This is an optimized version of ilp/water/2dm based on the contribution of: + author: Wengen Ouyang (Wuhan University) + e-mail: w.g.ouyang at gmail dot com + + Optimizations are done by: + author1: Xiaohui Duan (National Supercomputing Center in Wuxi, China) + e-mail: sunrise_duan at 126 dot com + + author2: Ping Gao (National Supercomputing Center in Wuxi, China) + e-mail: qdgaoping at gmail dot com + + Optimizations are described in: + Gao, Ping and Duan, Xiaohui, et al: + LMFF: Efficient and Scalable Layered Materials Force Field on Heterogeneous Many-Core Processors + DOI: 10.1145/3458817.3476137 + + Potential is described by: + [Feng and Ouyang et al, J. Phys. Chem. C 127, 8704-8713 (2023).] +*/ +#include "pair_ilp_water_2dm_opt.h" + +#include "atom.h" +#include "citeme.h" +#include "comm.h" +#include "error.h" +#include "force.h" +#include "interlayer_taper.h" +#include "memory.h" +#include "neigh_list.h" +#include "neigh_request.h" +#include "neighbor.h" + +#include +#include + +using namespace LAMMPS_NS; +using namespace InterLayer; + +PairILPWATER2DMOpt::PairILPWATER2DMOpt(LAMMPS *lmp) : + PairILPGrapheneHBN(lmp), PairILPTMD(lmp), PairILPWATER2DM(lmp), PairILPGrapheneHBNOpt(lmp) +{ +} + +void PairILPWATER2DMOpt::coeff(int narg, char **args) +{ + PairILPTMD::coeff(narg, args); + memory->create(special_type, atom->ntypes + 1, "PairILPWATER2DMOpt:check_sublayer"); + for (int i = 1; i <= atom->ntypes; i++) { + int itype = map[i]; + if (strcmp(elements[itype], "Mo") == 0 || strcmp(elements[itype], "W") == 0 || + strcmp(elements[itype], "S") == 0 || strcmp(elements[itype], "Se") == 0 || + strcmp(elements[itype], "Te") == 0) { + special_type[i] = TMD_METAL; + } else if (strcmp(elements[itype], "Hw") == 0 || strcmp(elements[itype], "Ow") == 0) { + special_type[i] = WATER; + } else { + special_type[i] = NOT_SPECIAL; + } + } +} diff --git a/src/OPT/pair_ilp_water_2dm_opt.h b/src/OPT/pair_ilp_water_2dm_opt.h new file mode 100644 index 0000000000..25905643af --- /dev/null +++ b/src/OPT/pair_ilp_water_2dm_opt.h @@ -0,0 +1,39 @@ + /* -*- c++ -*- ---------------------------------------------------------- + LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator + https://www.lammps.org/, 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. +------------------------------------------------------------------------- */ + +#ifdef PAIR_CLASS +// clang-format off +PairStyle(ilp/water/2dm/opt,PairILPWATER2DMOpt); +// clang-format on +#else + +#ifndef LMP_PAIR_ILP_WATER_2DM_OPT_H +#define LMP_PAIR_ILP_WATER_2DM_OPT_H + +#include "pair_ilp_graphene_hbn_opt.h" +#include "pair_ilp_water_2dm.h" + +namespace LAMMPS_NS { + +class PairILPWATER2DMOpt : public PairILPWATER2DM, public PairILPGrapheneHBNOpt { + public: + PairILPWATER2DMOpt(class LAMMPS *); + void coeff(int narg, char **args) override; + + protected: +}; + +} // namespace LAMMPS_NS +#endif +#endif + From af04ecc53217f52e32bc51f626cfdabc067792ec Mon Sep 17 00:00:00 2001 From: oywg11 Date: Thu, 18 May 2023 21:59:07 +0800 Subject: [PATCH 066/396] add potential file --- potentials/COH.ILP | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100755 potentials/COH.ILP diff --git a/potentials/COH.ILP b/potentials/COH.ILP new file mode 100755 index 0000000000..bd815b5c00 --- /dev/null +++ b/potentials/COH.ILP @@ -0,0 +1,28 @@ +# DATE: 2023-05-18 UNITS: metal CONTRIBUTOR: Wengen Ouyang w.g.ouyang@gmail.com CITATION: Z. Feng, ..., and W. Ouyang, J. Phys. Chem. C 127, 8704 (2023). +# Interlayer Potential (ILP) for water/graphene heterojunctions +# The parameters below are fitted against the PBE + MBD-NL DFT reference data from 2.5 A to 15 A. +# +# ----------------- Repulsion Potential ------------------++++++++++++++ Vdw Potential ++++++++++++++++************ +# beta(A) alpha delta(A) epsilon(meV) C(meV) d sR reff(A) C6(meV*A^6) S rcut +# For graphene and hydrocarbons +C C 3.205843 7.511126 1.235334 1.528338E-5 37.530428 15.499947 0.7954443 3.681440 25.714535E3 1.0 2.0 +H H 3.974540 6.53799 1.080633 0.6700556 0.8333833 15.022371 0.7490632 2.767223 1.6159581E3 1.0 1.2 +C H 2.642950 12.91410 1.020257 0.9750012 25.340996 15.222927 0.8115998 3.887324 5.6874617E3 1.0 1.5 +H C 2.642950 12.91410 1.020257 0.9750012 25.340996 15.222927 0.8115998 3.887324 5.6874617E3 1.0 1.5 + +# For water-graphene +C Ow 5.45369612 6.18172364 1.25025450 3.34909245 0.68780636 9.05706482 1.23249498 2.77577173 100226.55503127 1.0 2.0 +C Hw 2.55380862 9.68664390 1.96489198 41.77617053 -16.30012807 9.01568534 0.74415463 2.41545571 7409.12856378 1.0 2.0 +Ow C 5.45369612 6.18172364 1.25025450 3.34909245 0.68780636 9.05706482 1.23249498 2.77577173 100226.55503127 1.0 1.2 +Hw C 2.55380862 9.68664390 1.96489198 41.77617053 -16.30012807 9.01568534 0.74415463 2.41545571 7409.12856378 1.0 1.2 + +# # The ILPs for other systems are set to zero +H Ow 5.45369612 6.18172364 1.25025450 0.00000000 0.00000000 9.05706482 1.23249498 2.77577173 0.00000000 1.0 1.2 +H Hw 5.45369612 6.18172364 1.25025450 0.00000000 0.00000000 9.05706482 1.23249498 2.77577173 0.00000000 1.0 1.2 +Ow H 5.45369612 6.18172364 1.25025450 0.00000000 0.00000000 9.05706482 1.23249498 2.77577173 0.00000000 1.0 1.2 +Hw H 5.45369612 6.18172364 1.25025450 0.00000000 0.00000000 9.05706482 1.23249498 2.77577173 0.00000000 1.0 1.2 + +Ow Ow 5.45369612 6.18172364 1.25025450 0.00000000 0.00000000 9.05706482 1.23249498 2.77577173 0.00000000 1.0 1.2 +Hw Hw 5.45369612 6.18172364 1.25025450 0.00000000 0.00000000 9.05706482 1.23249498 2.77577173 0.00000000 1.0 1.2 +Ow Hw 5.45369612 6.18172364 1.25025450 0.00000000 0.00000000 9.05706482 1.23249498 2.77577173 0.00000000 1.0 1.2 +Hw Ow 5.45369612 6.18172364 1.25025450 0.00000000 0.00000000 9.05706482 1.23249498 2.77577173 0.00000000 1.0 1.2 From 3d35d68a4bd9fc432e40239c5d0ad6c8169e75d1 Mon Sep 17 00:00:00 2001 From: oywg11 Date: Thu, 18 May 2023 22:00:03 +0800 Subject: [PATCH 067/396] add doc file --- doc/src/pair_ilp_graphene_hbn.rst | 20 +-- doc/src/pair_ilp_tmd.rst | 4 +- doc/src/pair_ilp_water_2dm.rst | 166 ++++++++++++++++++++++++ doc/src/pair_kolmogorov_crespi_full.rst | 2 +- doc/src/pair_saip_metal.rst | 4 +- 5 files changed, 181 insertions(+), 15 deletions(-) create mode 100644 doc/src/pair_ilp_water_2dm.rst diff --git a/doc/src/pair_ilp_graphene_hbn.rst b/doc/src/pair_ilp_graphene_hbn.rst index de088f2926..36e971ef62 100644 --- a/doc/src/pair_ilp_graphene_hbn.rst +++ b/doc/src/pair_ilp_graphene_hbn.rst @@ -155,8 +155,8 @@ interactions. The BNCH.ILP potential file provided with LAMMPS (see the potentials directory) are parameterized for *metal* units. You can use this -potential with any LAMMPS units, but you would need to create your -BNCH.ILP potential file with coefficients listed in the appropriate +potential with any LAMMPS units, but you would need to create your own +custom BNCH.ILP potential file with coefficients listed in the appropriate units, if your simulation does not use *metal* units. Related commands @@ -181,6 +181,14 @@ tap_flag = 1 ---------- +.. _Ouyang1: + +**(Ouyang1)** W. Ouyang, D. Mandelli, M. Urbakh and O. Hod, Nano Lett. 18, 6009-6016 (2018). + +.. _Ouyang2: + +**(Ouyang2)** W. Ouyang et al., J. Chem. Theory Comput. 16(1), 666-676 (2020). + .. _Leven1: **(Leven1)** I. Leven, I. Azuri, L. Kronik and O. Hod, J. Chem. Phys. 140, 104106 (2014). @@ -196,11 +204,3 @@ tap_flag = 1 .. _Kolmogorov2: **(Kolmogorov)** A. N. Kolmogorov, V. H. Crespi, Phys. Rev. B 71, 235415 (2005). - -.. _Ouyang1: - -**(Ouyang1)** W. Ouyang, D. Mandelli, M. Urbakh and O. Hod, Nano Lett. 18, 6009-6016 (2018). - -.. _Ouyang2: - -**(Ouyang2)** W. Ouyang et al., J. Chem. Theory Comput. 16(1), 666-676 (2020). diff --git a/doc/src/pair_ilp_tmd.rst b/doc/src/pair_ilp_tmd.rst index 77fa8bbfd5..482d75a100 100644 --- a/doc/src/pair_ilp_tmd.rst +++ b/doc/src/pair_ilp_tmd.rst @@ -135,8 +135,8 @@ interactions. The TMD.ILP potential file provided with LAMMPS (see the potentials directory) are parameterized for *metal* units. You can use this -potential with any LAMMPS units, but you would need to create your -BNCH.ILP potential file with coefficients listed in the appropriate +potential with any LAMMPS units, but you would need to create your own +custom TMD.ILP potential file with coefficients listed in the appropriate units, if your simulation does not use *metal* units. Related commands diff --git a/doc/src/pair_ilp_water_2dm.rst b/doc/src/pair_ilp_water_2dm.rst new file mode 100644 index 0000000000..5dc287493b --- /dev/null +++ b/doc/src/pair_ilp_water_2dm.rst @@ -0,0 +1,166 @@ +.. index:: pair_style ilp/water/2dm +.. index:: pair_style ilp/water/2dm/opt + +pair_style ilp/tmd command +=================================== + +Accelerator Variant: *ilp/water/2dm/opt* + +Syntax +"""""" + +.. code-block:: LAMMPS + + pair_style [hybrid/overlay ...] ilp/tmd cutoff tap_flag + +* cutoff = global cutoff (distance units) +* tap_flag = 0/1 to turn off/on the taper function + +Examples +"""""""" + +.. code-block:: LAMMPS + + pair_style hybrid/overlay ilp/water/2dm 16.0 1 + pair_coeff * * ilp/water/2dm COH.ILP C Ow Hw + + pair_style hybrid/overlay ilp/water/2dm 16.0 lj/cut/tip4p/long 2 3 1 1 0.1546 10 8.5 + pair_coeff 2 2 lj/cut/tip4p/long 8.0313e-3 3.1589 # O-O + pair_coeff 2 3 lj/cut/tip4p/long 0.0 0.0 # O-H + pair_coeff 3 3 lj/cut/tip4p/long 0.0 0.0 # H-H + pair_coeff * * ilp/water/2dm COH.ILP C Ow Hw + +Description +""""""""""" + +.. versionadded:: xxxx2023 + +The *ilp/water/2dm* style computes the registry-dependent interlayer +potential (ILP) potential for interfaces of water with two-dimensinal (2D) +materials as described in :ref:`(Feng) `. + +.. math:: + + E = & \frac{1}{2} \sum_i \sum_{j \neq i} V_{ij} \\ + V_{ij} = & {\rm Tap}(r_{ij})\left \{ e^{-\alpha (r_{ij}/\beta -1)} + \left [ \epsilon + f(\rho_{ij}) + f(\rho_{ji})\right ] - + \frac{1}{1+e^{-d\left [ \left ( r_{ij}/\left (s_R \cdot r^{eff} \right ) \right )-1 \right ]}} + \cdot \frac{C_6}{r^6_{ij}} \right \}\\ + \rho_{ij}^2 = & r_{ij}^2 - ({\bf r}_{ij} \cdot {\bf n}_i)^2 \\ + \rho_{ji}^2 = & r_{ij}^2 - ({\bf r}_{ij} \cdot {\bf n}_j)^2 \\ + f(\rho) = & C e^{ -( \rho / \delta )^2 } \\ + {\rm Tap}(r_{ij}) = & 20\left ( \frac{r_{ij}}{R_{cut}} \right )^7 - + 70\left ( \frac{r_{ij}}{R_{cut}} \right )^6 + + 84\left ( \frac{r_{ij}}{R_{cut}} \right )^5 - + 35\left ( \frac{r_{ij}}{R_{cut}} \right )^4 + 1 + +Where :math:`\mathrm{Tap}(r_{ij})` is the taper function which provides +a continuous cutoff (up to third derivative) for interatomic separations +larger than :math:`r_c` :doc:`pair_style ilp_graphene_hbn `. + +It is important to include all the pairs to build the neighbor list for +calculating the normals. + +.. note:: + + Since each water molecule contains one oxygen atom and two hydrogen atoms, + a new definition is proposed (see In :ref:`(Feng) `),the atomic + normal vectors of hydrogen atoms are assumed to lie along the corresponding + oxygen-hydrogen bonds and the normal vector of the central oxygen atom + is defined as their average. + +The parameter file (e.g. COH.ILP), is intended for use with *metal* +:doc:`units `, with energies in meV. Two additional parameters, +*S*, and *rcut* are included in the parameter file. *S* is designed to +facilitate scaling of energies. *rcut* is designed to build the neighbor +list for calculating the normals for each atom pair. + +.. note:: + + The parameters presented in the parameter file (e.g. COH.ILP), + are fitted with taper function by setting the cutoff equal to 16.0 + Angstrom. Using different cutoff or taper function should be careful. + These parameters provide a good description in both short- and long-range + interaction regimes. This feature is essential for simulations in high pressure + regime (i.e., the interlayer distance is smaller than the equilibrium + distance). + +This potential must be used in combination with hybrid/overlay. +Other interactions can be set to zero using pair_style *none*\ . + +This pair style tallies a breakdown of the total interlayer potential +energy into sub-categories, which can be accessed via the :doc:`compute pair ` command as a vector of values of length 2. +The 2 values correspond to the following sub-categories: + +1. *E_vdW* = vdW (attractive) energy +2. *E_Rep* = Repulsive energy + +To print these quantities to the log file (with descriptive column +headings) the following commands could be included in an input script: + +.. code-block:: LAMMPS + + compute 0 all pair ilp/water/2dm + variable Evdw equal c_0[1] + variable Erep equal c_0[2] + thermo_style custom step temp epair v_Erep v_Evdw + +---------- + +.. include:: accel_styles.rst + +---------- + +Mixing, shift, table, tail correction, restart, rRESPA info +""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" + +This pair style does not support the pair_modify mix, shift, table, and +tail options. + +This pair style does not write their information to binary restart +files, since it is stored in potential files. Thus, you need to +re-specify the pair_style and pair_coeff commands in an input script +that reads a restart file. + +Restrictions +"""""""""""" + +This pair style is part of the INTERLAYER package. It is only enabled +if LAMMPS was built with that package. See the :doc:`Build package +` page for more info. + +This pair style requires the newton setting to be *on* for pair +interactions. + +The COH.ILP potential file provided with LAMMPS (see the potentials +directory) are parameterized for *metal* units. You can use this +potential with any LAMMPS units, but you would need to create your +COH.ILP potential file with coefficients listed in the appropriate +units, if your simulation does not use *metal* units. + +Related commands +"""""""""""""""" + +:doc:`pair_coeff `, +:doc:`pair_none `, +:doc:`pair_style hybrid/overlay `, +:doc:`pair_style drip `, +:doc:`pair_style ilp_tmd `, +:doc:`pair_style saip_metal `, +:doc:`pair_style ilp_graphene_hbn `, +:doc:`pair_style pair_kolmogorov_crespi_z `, +:doc:`pair_style pair_kolmogorov_crespi_full `, +:doc:`pair_style pair_lebedeva_z `, +:doc:`pair_style pair_coul_shield `. + +Default +""""""" + +tap_flag = 1 + + +---------- + +.. _Feng: + +**(Feng)** Z. Feng, W. Ouyang, J. Phys. Chem. C. accepted (2023). diff --git a/doc/src/pair_kolmogorov_crespi_full.rst b/doc/src/pair_kolmogorov_crespi_full.rst index 1a33a3f4bb..1a4706dd6f 100644 --- a/doc/src/pair_kolmogorov_crespi_full.rst +++ b/doc/src/pair_kolmogorov_crespi_full.rst @@ -129,7 +129,7 @@ interactions. The CH.KC potential file provided with LAMMPS (see the potentials folder) is parameterized for metal units. You can use this pair style with any LAMMPS units, but you would need to create your own custom -CC.KC potential file with all coefficients converted to the appropriate +CH.KC potential file with all coefficients converted to the appropriate units. Related commands diff --git a/doc/src/pair_saip_metal.rst b/doc/src/pair_saip_metal.rst index 21bfeb0aa9..ed011894c9 100644 --- a/doc/src/pair_saip_metal.rst +++ b/doc/src/pair_saip_metal.rst @@ -134,8 +134,8 @@ interactions. The CHAu.ILP potential file provided with LAMMPS (see the potentials directory) are parameterized for *metal* units. You can use this -potential with any LAMMPS units, but you would need to create your -BNCH.ILP potential file with coefficients listed in the appropriate +potential with any LAMMPS units, but you would need to create your own +custom CHAu.ILP potential file with coefficients listed in the appropriate units, if your simulation does not use *metal* units. Related commands From bbff6c25b33625a1b34ff95e581c78d59eb74e56 Mon Sep 17 00:00:00 2001 From: oywg11 Date: Thu, 18 May 2023 22:01:19 +0800 Subject: [PATCH 068/396] add examples --- .../PACKAGES/interlayer/ilp_water_2dm/COH.ILP | 1 + .../interlayer/ilp_water_2dm/gra_water.data | 2040 +++++++++++++++++ .../interlayer/ilp_water_2dm/in.gr_water | 51 + .../interlayer/ilp_water_2dm/in.gr_water.opt | 51 + .../ilp_water_2dm/log.18May23.water.g++.1 | 234 ++ .../ilp_water_2dm/log.18May23.water.g++.4 | 234 ++ .../ilp_water_2dm/log.18May23.water.opt.g++.1 | 251 ++ .../ilp_water_2dm/log.18May23.water.opt.g++.4 | 251 ++ 8 files changed, 3113 insertions(+) create mode 120000 examples/PACKAGES/interlayer/ilp_water_2dm/COH.ILP create mode 100644 examples/PACKAGES/interlayer/ilp_water_2dm/gra_water.data create mode 100644 examples/PACKAGES/interlayer/ilp_water_2dm/in.gr_water create mode 100644 examples/PACKAGES/interlayer/ilp_water_2dm/in.gr_water.opt create mode 100644 examples/PACKAGES/interlayer/ilp_water_2dm/log.18May23.water.g++.1 create mode 100644 examples/PACKAGES/interlayer/ilp_water_2dm/log.18May23.water.g++.4 create mode 100644 examples/PACKAGES/interlayer/ilp_water_2dm/log.18May23.water.opt.g++.1 create mode 100644 examples/PACKAGES/interlayer/ilp_water_2dm/log.18May23.water.opt.g++.4 diff --git a/examples/PACKAGES/interlayer/ilp_water_2dm/COH.ILP b/examples/PACKAGES/interlayer/ilp_water_2dm/COH.ILP new file mode 120000 index 0000000000..526995dae4 --- /dev/null +++ b/examples/PACKAGES/interlayer/ilp_water_2dm/COH.ILP @@ -0,0 +1 @@ +../../../../potentials/COH.ILP \ No newline at end of file diff --git a/examples/PACKAGES/interlayer/ilp_water_2dm/gra_water.data b/examples/PACKAGES/interlayer/ilp_water_2dm/gra_water.data new file mode 100644 index 0000000000..7e6d3925f0 --- /dev/null +++ b/examples/PACKAGES/interlayer/ilp_water_2dm/gra_water.data @@ -0,0 +1,2040 @@ +LAMMPS data file via write_data, version 23 Jun 2022, timestep = 100000 + +936 atoms +3 atom types +96 bonds +1 bond types +48 angles +1 angle types + +0 46.92336 xlo xhi +0 44.331078317370086 ylo yhi +0 200 zlo zhi + +Atoms # full + +1 1 1 0 0 0 0 0 0 0 +2 1 1 0 0.71096 1.231418842149169 0 0 0 0 +3 1 1 0 2.13288 1.231418842149169 0 0 0 0 +4 1 1 0 2.84384 0 0 0 0 0 +5 1 1 0 0 2.462837684298338 0 0 0 0 +6 1 1 0 0.71096 3.694256526447507 0 0 0 0 +7 1 1 0 2.13288 3.694256526447507 0 0 0 0 +8 1 1 0 2.84384 2.462837684298338 0 0 0 0 +9 1 1 0 0 4.925675368596676 0 0 0 0 +10 1 1 0 0.71096 6.157094210745845 0 0 0 0 +11 1 1 0 2.13288 6.157094210745845 0 0 0 0 +12 1 1 0 2.84384 4.925675368596676 0 0 0 0 +13 1 1 0 0 7.388513052895014 0 0 0 0 +14 1 1 0 0.71096 8.619931895044184 0 0 0 0 +15 1 1 0 2.13288 8.619931895044184 0 0 0 0 +16 1 1 0 2.84384 7.388513052895014 0 0 0 0 +17 1 1 0 0 9.851350737193352 0 0 0 0 +20 1 1 0 2.84384 9.851350737193352 0 0 0 0 +73 1 1 0 4.26576 0 0 0 0 0 +74 1 1 0 4.97672 1.231418842149169 0 0 0 0 +77 1 1 0 4.26576 2.462837684298338 0 0 0 0 +78 1 1 0 4.97672 3.694256526447507 0 0 0 0 +81 1 1 0 4.26576 4.925675368596676 0 0 0 0 +82 1 1 0 4.97672 6.157094210745845 0 0 0 0 +85 1 1 0 4.26576 7.388513052895014 0 0 0 0 +86 1 1 0 4.97672 8.619931895044184 0 0 0 0 +89 1 1 0 4.26576 9.851350737193352 0 0 0 0 +18 1 1 0 0.71096 11.082769579342521 0 0 0 0 +19 1 1 0 2.13288 11.082769579342521 0 0 0 0 +21 1 1 0 0 12.31418842149169 0 0 0 0 +22 1 1 0 0.71096 13.545607263640859 0 0 0 0 +23 1 1 0 2.13288 13.545607263640859 0 0 0 0 +24 1 1 0 2.84384 12.31418842149169 0 0 0 0 +25 1 1 0 0 14.777026105790029 0 0 0 0 +26 1 1 0 0.71096 16.008444947939196 0 0 0 0 +27 1 1 0 2.13288 16.008444947939196 0 0 0 0 +28 1 1 0 2.84384 14.777026105790029 0 0 0 0 +29 1 1 0 0 17.239863790088364 0 0 0 0 +30 1 1 0 0.71096 18.471282632237532 0 0 0 0 +31 1 1 0 2.13288 18.471282632237532 0 0 0 0 +32 1 1 0 2.84384 17.239863790088364 0 0 0 0 +33 1 1 0 0 19.702701474386703 0 0 0 0 +34 1 1 0 0.71096 20.93412031653587 0 0 0 0 +35 1 1 0 2.13288 20.93412031653587 0 0 0 0 +36 1 1 0 2.84384 19.702701474386703 0 0 0 0 +90 1 1 0 4.97672 11.082769579342521 0 0 0 0 +93 1 1 0 4.26576 12.31418842149169 0 0 0 0 +94 1 1 0 4.97672 13.545607263640859 0 0 0 0 +97 1 1 0 4.26576 14.777026105790029 0 0 0 0 +98 1 1 0 4.97672 16.008444947939196 0 0 0 0 +101 1 1 0 4.26576 17.239863790088364 0 0 0 0 +102 1 1 0 4.97672 18.471282632237532 0 0 0 0 +105 1 1 0 4.26576 19.702701474386703 0 0 0 0 +106 1 1 0 4.97672 20.93412031653587 0 0 0 0 +37 1 1 0 0 22.165539158685043 0 0 0 0 +38 1 1 0 0.71096 23.39695800083421 0 0 0 0 +39 1 1 0 2.13288 23.39695800083421 0 0 0 0 +40 1 1 0 2.84384 22.165539158685043 0 0 0 0 +41 1 1 0 0 24.62837684298338 0 0 0 0 +42 1 1 0 0.71096 25.859795685132546 0 0 0 0 +43 1 1 0 2.13288 25.859795685132546 0 0 0 0 +44 1 1 0 2.84384 24.62837684298338 0 0 0 0 +45 1 1 0 0 27.091214527281718 0 0 0 0 +46 1 1 0 0.71096 28.322633369430886 0 0 0 0 +47 1 1 0 2.13288 28.322633369430886 0 0 0 0 +48 1 1 0 2.84384 27.091214527281718 0 0 0 0 +49 1 1 0 0 29.554052211580057 0 0 0 0 +50 1 1 0 0.71096 30.785471053729225 0 0 0 0 +51 1 1 0 2.13288 30.785471053729225 0 0 0 0 +52 1 1 0 2.84384 29.554052211580057 0 0 0 0 +53 1 1 0 0 32.01688989587839 0 0 0 0 +56 1 1 0 2.84384 32.01688989587839 0 0 0 0 +109 1 1 0 4.26576 22.165539158685043 0 0 0 0 +110 1 1 0 4.97672 23.39695800083421 0 0 0 0 +113 1 1 0 4.26576 24.62837684298338 0 0 0 0 +114 1 1 0 4.97672 25.859795685132546 0 0 0 0 +117 1 1 0 4.26576 27.091214527281718 0 0 0 0 +118 1 1 0 4.97672 28.322633369430886 0 0 0 0 +121 1 1 0 4.26576 29.554052211580057 0 0 0 0 +122 1 1 0 4.97672 30.785471053729225 0 0 0 0 +125 1 1 0 4.26576 32.01688989587839 0 0 0 0 +54 1 1 0 0.71096 33.24830873802756 0 0 0 0 +55 1 1 0 2.13288 33.24830873802756 0 0 0 0 +57 1 1 0 0 34.47972758017673 0 0 0 0 +58 1 1 0 0.71096 35.711146422325896 0 0 0 0 +59 1 1 0 2.13288 35.711146422325896 0 0 0 0 +60 1 1 0 2.84384 34.47972758017673 0 0 0 0 +61 1 1 0 0 36.94256526447507 0 0 0 0 +62 1 1 0 0.71096 38.17398410662424 0 0 0 0 +63 1 1 0 2.13288 38.17398410662424 0 0 0 0 +64 1 1 0 2.84384 36.94256526447507 0 0 0 0 +65 1 1 0 0 39.40540294877341 0 0 0 0 +66 1 1 0 0.71096 40.636821790922575 0 0 0 0 +67 1 1 0 2.13288 40.636821790922575 0 0 0 0 +68 1 1 0 2.84384 39.40540294877341 0 0 0 0 +69 1 1 0 0 41.86824063307174 0 0 0 0 +70 1 1 0 0.71096 43.09965947522091 0 0 0 0 +71 1 1 0 2.13288 43.09965947522091 0 0 0 0 +72 1 1 0 2.84384 41.86824063307174 0 0 0 0 +126 1 1 0 4.97672 33.24830873802756 0 0 0 0 +129 1 1 0 4.26576 34.47972758017673 0 0 0 0 +130 1 1 0 4.97672 35.711146422325896 0 0 0 0 +133 1 1 0 4.26576 36.94256526447507 0 0 0 0 +134 1 1 0 4.97672 38.17398410662424 0 0 0 0 +137 1 1 0 4.26576 39.40540294877341 0 0 0 0 +138 1 1 0 4.97672 40.636821790922575 0 0 0 0 +141 1 1 0 4.26576 41.86824063307174 0 0 0 0 +142 1 1 0 4.97672 43.09965947522091 0 0 0 0 +75 1 1 0 6.39864 1.231418842149169 0 0 0 0 +76 1 1 0 7.1096 0 0 0 0 0 +79 1 1 0 6.39864 3.694256526447507 0 0 0 0 +80 1 1 0 7.1096 2.462837684298338 0 0 0 0 +83 1 1 0 6.39864 6.157094210745845 0 0 0 0 +84 1 1 0 7.1096 4.925675368596676 0 0 0 0 +87 1 1 0 6.39864 8.619931895044184 0 0 0 0 +88 1 1 0 7.1096 7.388513052895014 0 0 0 0 +92 1 1 0 7.1096 9.851350737193352 0 0 0 0 +145 1 1 0 8.53152 0 0 0 0 0 +146 1 1 0 9.24248 1.231418842149169 0 0 0 0 +147 1 1 0 10.6644 1.231418842149169 0 0 0 0 +148 1 1 0 11.37536 0 0 0 0 0 +149 1 1 0 8.53152 2.462837684298338 0 0 0 0 +150 1 1 0 9.24248 3.694256526447507 0 0 0 0 +151 1 1 0 10.6644 3.694256526447507 0 0 0 0 +152 1 1 0 11.37536 2.462837684298338 0 0 0 0 +153 1 1 0 8.53152 4.925675368596676 0 0 0 0 +154 1 1 0 9.24248 6.157094210745845 0 0 0 0 +155 1 1 0 10.6644 6.157094210745845 0 0 0 0 +156 1 1 0 11.37536 4.925675368596676 0 0 0 0 +157 1 1 0 8.53152 7.388513052895014 0 0 0 0 +158 1 1 0 9.24248 8.619931895044184 0 0 0 0 +159 1 1 0 10.6644 8.619931895044184 0 0 0 0 +160 1 1 0 11.37536 7.388513052895014 0 0 0 0 +161 1 1 0 8.53152 9.851350737193352 0 0 0 0 +164 1 1 0 11.37536 9.851350737193352 0 0 0 0 +91 1 1 0 6.39864 11.082769579342521 0 0 0 0 +95 1 1 0 6.39864 13.545607263640859 0 0 0 0 +96 1 1 0 7.1096 12.31418842149169 0 0 0 0 +99 1 1 0 6.39864 16.008444947939196 0 0 0 0 +100 1 1 0 7.1096 14.777026105790029 0 0 0 0 +103 1 1 0 6.39864 18.471282632237532 0 0 0 0 +104 1 1 0 7.1096 17.239863790088364 0 0 0 0 +107 1 1 0 6.39864 20.93412031653587 0 0 0 0 +108 1 1 0 7.1096 19.702701474386703 0 0 0 0 +162 1 1 0 9.24248 11.082769579342521 0 0 0 0 +163 1 1 0 10.6644 11.082769579342521 0 0 0 0 +165 1 1 0 8.53152 12.31418842149169 0 0 0 0 +166 1 1 0 9.24248 13.545607263640859 0 0 0 0 +167 1 1 0 10.6644 13.545607263640859 0 0 0 0 +168 1 1 0 11.37536 12.31418842149169 0 0 0 0 +169 1 1 0 8.53152 14.777026105790029 0 0 0 0 +170 1 1 0 9.24248 16.008444947939196 0 0 0 0 +171 1 1 0 10.6644 16.008444947939196 0 0 0 0 +172 1 1 0 11.37536 14.777026105790029 0 0 0 0 +173 1 1 0 8.53152 17.239863790088364 0 0 0 0 +174 1 1 0 9.24248 18.471282632237532 0 0 0 0 +175 1 1 0 10.6644 18.471282632237532 0 0 0 0 +176 1 1 0 11.37536 17.239863790088364 0 0 0 0 +177 1 1 0 8.53152 19.702701474386703 0 0 0 0 +178 1 1 0 9.24248 20.93412031653587 0 0 0 0 +179 1 1 0 10.6644 20.93412031653587 0 0 0 0 +180 1 1 0 11.37536 19.702701474386703 0 0 0 0 +111 1 1 0 6.39864 23.39695800083421 0 0 0 0 +112 1 1 0 7.1096 22.165539158685043 0 0 0 0 +115 1 1 0 6.39864 25.859795685132546 0 0 0 0 +116 1 1 0 7.1096 24.62837684298338 0 0 0 0 +119 1 1 0 6.39864 28.322633369430886 0 0 0 0 +120 1 1 0 7.1096 27.091214527281718 0 0 0 0 +123 1 1 0 6.39864 30.785471053729225 0 0 0 0 +124 1 1 0 7.1096 29.554052211580057 0 0 0 0 +128 1 1 0 7.1096 32.01688989587839 0 0 0 0 +181 1 1 0 8.53152 22.165539158685043 0 0 0 0 +182 1 1 0 9.24248 23.39695800083421 0 0 0 0 +183 1 1 0 10.6644 23.39695800083421 0 0 0 0 +184 1 1 0 11.37536 22.165539158685043 0 0 0 0 +185 1 1 0 8.53152 24.62837684298338 0 0 0 0 +186 1 1 0 9.24248 25.859795685132546 0 0 0 0 +187 1 1 0 10.6644 25.859795685132546 0 0 0 0 +188 1 1 0 11.37536 24.62837684298338 0 0 0 0 +189 1 1 0 8.53152 27.091214527281718 0 0 0 0 +190 1 1 0 9.24248 28.322633369430886 0 0 0 0 +191 1 1 0 10.6644 28.322633369430886 0 0 0 0 +192 1 1 0 11.37536 27.091214527281718 0 0 0 0 +193 1 1 0 8.53152 29.554052211580057 0 0 0 0 +194 1 1 0 9.24248 30.785471053729225 0 0 0 0 +195 1 1 0 10.6644 30.785471053729225 0 0 0 0 +196 1 1 0 11.37536 29.554052211580057 0 0 0 0 +197 1 1 0 8.53152 32.01688989587839 0 0 0 0 +200 1 1 0 11.37536 32.01688989587839 0 0 0 0 +127 1 1 0 6.39864 33.24830873802756 0 0 0 0 +131 1 1 0 6.39864 35.711146422325896 0 0 0 0 +132 1 1 0 7.1096 34.47972758017673 0 0 0 0 +135 1 1 0 6.39864 38.17398410662424 0 0 0 0 +136 1 1 0 7.1096 36.94256526447507 0 0 0 0 +139 1 1 0 6.39864 40.636821790922575 0 0 0 0 +140 1 1 0 7.1096 39.40540294877341 0 0 0 0 +143 1 1 0 6.39864 43.09965947522091 0 0 0 0 +144 1 1 0 7.1096 41.86824063307174 0 0 0 0 +198 1 1 0 9.24248 33.24830873802756 0 0 0 0 +199 1 1 0 10.6644 33.24830873802756 0 0 0 0 +201 1 1 0 8.53152 34.47972758017673 0 0 0 0 +202 1 1 0 9.24248 35.711146422325896 0 0 0 0 +203 1 1 0 10.6644 35.711146422325896 0 0 0 0 +204 1 1 0 11.37536 34.47972758017673 0 0 0 0 +205 1 1 0 8.53152 36.94256526447507 0 0 0 0 +206 1 1 0 9.24248 38.17398410662424 0 0 0 0 +207 1 1 0 10.6644 38.17398410662424 0 0 0 0 +208 1 1 0 11.37536 36.94256526447507 0 0 0 0 +209 1 1 0 8.53152 39.40540294877341 0 0 0 0 +210 1 1 0 9.24248 40.636821790922575 0 0 0 0 +211 1 1 0 10.6644 40.636821790922575 0 0 0 0 +212 1 1 0 11.37536 39.40540294877341 0 0 0 0 +213 1 1 0 8.53152 41.86824063307174 0 0 0 0 +214 1 1 0 9.24248 43.09965947522091 0 0 0 0 +215 1 1 0 10.6644 43.09965947522091 0 0 0 0 +216 1 1 0 11.37536 41.86824063307174 0 0 0 0 +217 1 1 0 12.79728 0 0 0 0 0 +218 1 1 0 13.50824 1.231418842149169 0 0 0 0 +219 1 1 0 14.93016 1.231418842149169 0 0 0 0 +220 1 1 0 15.64112 0 0 0 0 0 +221 1 1 0 12.79728 2.462837684298338 0 0 0 0 +222 1 1 0 13.50824 3.694256526447507 0 0 0 0 +223 1 1 0 14.93016 3.694256526447507 0 0 0 0 +224 1 1 0 15.64112 2.462837684298338 0 0 0 0 +225 1 1 0 12.79728 4.925675368596676 0 0 0 0 +226 1 1 0 13.50824 6.157094210745845 0 0 0 0 +227 1 1 0 14.93016 6.157094210745845 0 0 0 0 +228 1 1 0 15.64112 4.925675368596676 0 0 0 0 +229 1 1 0 12.79728 7.388513052895014 0 0 0 0 +230 1 1 0 13.50824 8.619931895044184 0 0 0 0 +231 1 1 0 14.93016 8.619931895044184 0 0 0 0 +232 1 1 0 15.64112 7.388513052895014 0 0 0 0 +233 1 1 0 12.79728 9.851350737193352 0 0 0 0 +236 1 1 0 15.64112 9.851350737193352 0 0 0 0 +289 1 1 0 17.06304 0 0 0 0 0 +293 1 1 0 17.06304 2.462837684298338 0 0 0 0 +297 1 1 0 17.06304 4.925675368596676 0 0 0 0 +301 1 1 0 17.06304 7.388513052895014 0 0 0 0 +305 1 1 0 17.06304 9.851350737193352 0 0 0 0 +234 1 1 0 13.50824 11.082769579342521 0 0 0 0 +235 1 1 0 14.93016 11.082769579342521 0 0 0 0 +237 1 1 0 12.79728 12.31418842149169 0 0 0 0 +238 1 1 0 13.50824 13.545607263640859 0 0 0 0 +239 1 1 0 14.93016 13.545607263640859 0 0 0 0 +240 1 1 0 15.64112 12.31418842149169 0 0 0 0 +241 1 1 0 12.79728 14.777026105790029 0 0 0 0 +242 1 1 0 13.50824 16.008444947939196 0 0 0 0 +243 1 1 0 14.93016 16.008444947939196 0 0 0 0 +244 1 1 0 15.64112 14.777026105790029 0 0 0 0 +245 1 1 0 12.79728 17.239863790088364 0 0 0 0 +246 1 1 0 13.50824 18.471282632237532 0 0 0 0 +247 1 1 0 14.93016 18.471282632237532 0 0 0 0 +248 1 1 0 15.64112 17.239863790088364 0 0 0 0 +249 1 1 0 12.79728 19.702701474386703 0 0 0 0 +250 1 1 0 13.50824 20.93412031653587 0 0 0 0 +251 1 1 0 14.93016 20.93412031653587 0 0 0 0 +252 1 1 0 15.64112 19.702701474386703 0 0 0 0 +309 1 1 0 17.06304 12.31418842149169 0 0 0 0 +313 1 1 0 17.06304 14.777026105790029 0 0 0 0 +317 1 1 0 17.06304 17.239863790088364 0 0 0 0 +321 1 1 0 17.06304 19.702701474386703 0 0 0 0 +253 1 1 0 12.79728 22.165539158685043 0 0 0 0 +254 1 1 0 13.50824 23.39695800083421 0 0 0 0 +255 1 1 0 14.93016 23.39695800083421 0 0 0 0 +256 1 1 0 15.64112 22.165539158685043 0 0 0 0 +257 1 1 0 12.79728 24.62837684298338 0 0 0 0 +258 1 1 0 13.50824 25.859795685132546 0 0 0 0 +259 1 1 0 14.93016 25.859795685132546 0 0 0 0 +260 1 1 0 15.64112 24.62837684298338 0 0 0 0 +261 1 1 0 12.79728 27.091214527281718 0 0 0 0 +262 1 1 0 13.50824 28.322633369430886 0 0 0 0 +263 1 1 0 14.93016 28.322633369430886 0 0 0 0 +264 1 1 0 15.64112 27.091214527281718 0 0 0 0 +265 1 1 0 12.79728 29.554052211580057 0 0 0 0 +266 1 1 0 13.50824 30.785471053729225 0 0 0 0 +267 1 1 0 14.93016 30.785471053729225 0 0 0 0 +268 1 1 0 15.64112 29.554052211580057 0 0 0 0 +269 1 1 0 12.79728 32.01688989587839 0 0 0 0 +272 1 1 0 15.64112 32.01688989587839 0 0 0 0 +325 1 1 0 17.06304 22.165539158685043 0 0 0 0 +329 1 1 0 17.06304 24.62837684298338 0 0 0 0 +333 1 1 0 17.06304 27.091214527281718 0 0 0 0 +337 1 1 0 17.06304 29.554052211580057 0 0 0 0 +341 1 1 0 17.06304 32.01688989587839 0 0 0 0 +270 1 1 0 13.50824 33.24830873802756 0 0 0 0 +271 1 1 0 14.93016 33.24830873802756 0 0 0 0 +273 1 1 0 12.79728 34.47972758017673 0 0 0 0 +274 1 1 0 13.50824 35.711146422325896 0 0 0 0 +275 1 1 0 14.93016 35.711146422325896 0 0 0 0 +276 1 1 0 15.64112 34.47972758017673 0 0 0 0 +277 1 1 0 12.79728 36.94256526447507 0 0 0 0 +278 1 1 0 13.50824 38.17398410662424 0 0 0 0 +279 1 1 0 14.93016 38.17398410662424 0 0 0 0 +280 1 1 0 15.64112 36.94256526447507 0 0 0 0 +281 1 1 0 12.79728 39.40540294877341 0 0 0 0 +282 1 1 0 13.50824 40.636821790922575 0 0 0 0 +283 1 1 0 14.93016 40.636821790922575 0 0 0 0 +284 1 1 0 15.64112 39.40540294877341 0 0 0 0 +285 1 1 0 12.79728 41.86824063307174 0 0 0 0 +286 1 1 0 13.50824 43.09965947522091 0 0 0 0 +287 1 1 0 14.93016 43.09965947522091 0 0 0 0 +288 1 1 0 15.64112 41.86824063307174 0 0 0 0 +345 1 1 0 17.06304 34.47972758017673 0 0 0 0 +349 1 1 0 17.06304 36.94256526447507 0 0 0 0 +353 1 1 0 17.06304 39.40540294877341 0 0 0 0 +357 1 1 0 17.06304 41.86824063307174 0 0 0 0 +290 1 1 0 17.774 1.231418842149169 0 0 0 0 +291 1 1 0 19.19592 1.231418842149169 0 0 0 0 +292 1 1 0 19.90688 0 0 0 0 0 +294 1 1 0 17.774 3.694256526447507 0 0 0 0 +295 1 1 0 19.19592 3.694256526447507 0 0 0 0 +296 1 1 0 19.90688 2.462837684298338 0 0 0 0 +298 1 1 0 17.774 6.157094210745845 0 0 0 0 +299 1 1 0 19.19592 6.157094210745845 0 0 0 0 +300 1 1 0 19.90688 4.925675368596676 0 0 0 0 +302 1 1 0 17.774 8.619931895044184 0 0 0 0 +303 1 1 0 19.19592 8.619931895044184 0 0 0 0 +304 1 1 0 19.90688 7.388513052895014 0 0 0 0 +308 1 1 0 19.90688 9.851350737193352 0 0 0 0 +361 1 1 0 21.3288 0 0 0 0 0 +362 1 1 0 22.03976 1.231418842149169 0 0 0 0 +365 1 1 0 21.3288 2.462837684298338 0 0 0 0 +366 1 1 0 22.03976 3.694256526447507 0 0 0 0 +369 1 1 0 21.3288 4.925675368596676 0 0 0 0 +370 1 1 0 22.03976 6.157094210745845 0 0 0 0 +373 1 1 0 21.3288 7.388513052895014 0 0 0 0 +374 1 1 0 22.03976 8.619931895044184 0 0 0 0 +377 1 1 0 21.3288 9.851350737193352 0 0 0 0 +306 1 1 0 17.774 11.082769579342521 0 0 0 0 +307 1 1 0 19.19592 11.082769579342521 0 0 0 0 +310 1 1 0 17.774 13.545607263640859 0 0 0 0 +311 1 1 0 19.19592 13.545607263640859 0 0 0 0 +312 1 1 0 19.90688 12.31418842149169 0 0 0 0 +314 1 1 0 17.774 16.008444947939196 0 0 0 0 +315 1 1 0 19.19592 16.008444947939196 0 0 0 0 +316 1 1 0 19.90688 14.777026105790029 0 0 0 0 +318 1 1 0 17.774 18.471282632237532 0 0 0 0 +319 1 1 0 19.19592 18.471282632237532 0 0 0 0 +320 1 1 0 19.90688 17.239863790088364 0 0 0 0 +322 1 1 0 17.774 20.93412031653587 0 0 0 0 +323 1 1 0 19.19592 20.93412031653587 0 0 0 0 +324 1 1 0 19.90688 19.702701474386703 0 0 0 0 +378 1 1 0 22.03976 11.082769579342521 0 0 0 0 +381 1 1 0 21.3288 12.31418842149169 0 0 0 0 +382 1 1 0 22.03976 13.545607263640859 0 0 0 0 +385 1 1 0 21.3288 14.777026105790029 0 0 0 0 +386 1 1 0 22.03976 16.008444947939196 0 0 0 0 +389 1 1 0 21.3288 17.239863790088364 0 0 0 0 +390 1 1 0 22.03976 18.471282632237532 0 0 0 0 +393 1 1 0 21.3288 19.702701474386703 0 0 0 0 +394 1 1 0 22.03976 20.93412031653587 0 0 0 0 +326 1 1 0 17.774 23.39695800083421 0 0 0 0 +327 1 1 0 19.19592 23.39695800083421 0 0 0 0 +328 1 1 0 19.90688 22.165539158685043 0 0 0 0 +330 1 1 0 17.774 25.859795685132546 0 0 0 0 +331 1 1 0 19.19592 25.859795685132546 0 0 0 0 +332 1 1 0 19.90688 24.62837684298338 0 0 0 0 +334 1 1 0 17.774 28.322633369430886 0 0 0 0 +335 1 1 0 19.19592 28.322633369430886 0 0 0 0 +336 1 1 0 19.90688 27.091214527281718 0 0 0 0 +338 1 1 0 17.774 30.785471053729225 0 0 0 0 +339 1 1 0 19.19592 30.785471053729225 0 0 0 0 +340 1 1 0 19.90688 29.554052211580057 0 0 0 0 +344 1 1 0 19.90688 32.01688989587839 0 0 0 0 +397 1 1 0 21.3288 22.165539158685043 0 0 0 0 +398 1 1 0 22.03976 23.39695800083421 0 0 0 0 +401 1 1 0 21.3288 24.62837684298338 0 0 0 0 +402 1 1 0 22.03976 25.859795685132546 0 0 0 0 +405 1 1 0 21.3288 27.091214527281718 0 0 0 0 +406 1 1 0 22.03976 28.322633369430886 0 0 0 0 +409 1 1 0 21.3288 29.554052211580057 0 0 0 0 +410 1 1 0 22.03976 30.785471053729225 0 0 0 0 +413 1 1 0 21.3288 32.01688989587839 0 0 0 0 +342 1 1 0 17.774 33.24830873802756 0 0 0 0 +343 1 1 0 19.19592 33.24830873802756 0 0 0 0 +346 1 1 0 17.774 35.711146422325896 0 0 0 0 +347 1 1 0 19.19592 35.711146422325896 0 0 0 0 +348 1 1 0 19.90688 34.47972758017673 0 0 0 0 +350 1 1 0 17.774 38.17398410662424 0 0 0 0 +351 1 1 0 19.19592 38.17398410662424 0 0 0 0 +352 1 1 0 19.90688 36.94256526447507 0 0 0 0 +354 1 1 0 17.774 40.636821790922575 0 0 0 0 +355 1 1 0 19.19592 40.636821790922575 0 0 0 0 +356 1 1 0 19.90688 39.40540294877341 0 0 0 0 +358 1 1 0 17.774 43.09965947522091 0 0 0 0 +359 1 1 0 19.19592 43.09965947522091 0 0 0 0 +360 1 1 0 19.90688 41.86824063307174 0 0 0 0 +414 1 1 0 22.03976 33.24830873802756 0 0 0 0 +417 1 1 0 21.3288 34.47972758017673 0 0 0 0 +418 1 1 0 22.03976 35.711146422325896 0 0 0 0 +421 1 1 0 21.3288 36.94256526447507 0 0 0 0 +422 1 1 0 22.03976 38.17398410662424 0 0 0 0 +425 1 1 0 21.3288 39.40540294877341 0 0 0 0 +426 1 1 0 22.03976 40.636821790922575 0 0 0 0 +429 1 1 0 21.3288 41.86824063307174 0 0 0 0 +430 1 1 0 22.03976 43.09965947522091 0 0 0 0 +363 1 1 0 23.46168 1.231418842149169 0 0 0 0 +364 1 1 0 24.17264 0 0 0 0 0 +367 1 1 0 23.46168 3.694256526447507 0 0 0 0 +368 1 1 0 24.17264 2.462837684298338 0 0 0 0 +371 1 1 0 23.46168 6.157094210745845 0 0 0 0 +372 1 1 0 24.17264 4.925675368596676 0 0 0 0 +375 1 1 0 23.46168 8.619931895044184 0 0 0 0 +376 1 1 0 24.17264 7.388513052895014 0 0 0 0 +380 1 1 0 24.17264 9.851350737193352 0 0 0 0 +433 1 1 0 25.59456 0 0 0 0 0 +434 1 1 0 26.30552 1.231418842149169 0 0 0 0 +435 1 1 0 27.72744 1.231418842149169 0 0 0 0 +436 1 1 0 28.4384 0 0 0 0 0 +437 1 1 0 25.59456 2.462837684298338 0 0 0 0 +438 1 1 0 26.30552 3.694256526447507 0 0 0 0 +439 1 1 0 27.72744 3.694256526447507 0 0 0 0 +440 1 1 0 28.4384 2.462837684298338 0 0 0 0 +441 1 1 0 25.59456 4.925675368596676 0 0 0 0 +442 1 1 0 26.30552 6.157094210745845 0 0 0 0 +443 1 1 0 27.72744 6.157094210745845 0 0 0 0 +444 1 1 0 28.4384 4.925675368596676 0 0 0 0 +445 1 1 0 25.59456 7.388513052895014 0 0 0 0 +446 1 1 0 26.30552 8.619931895044184 0 0 0 0 +447 1 1 0 27.72744 8.619931895044184 0 0 0 0 +448 1 1 0 28.4384 7.388513052895014 0 0 0 0 +449 1 1 0 25.59456 9.851350737193352 0 0 0 0 +452 1 1 0 28.4384 9.851350737193352 0 0 0 0 +824 2 3 0.5564 27.869304504728962 5.441231954072771 7.1662725516060455 0 1 0 +882 2 3 0.5564 28.591049353698207 2.8104183869168513 5.199459350263634 0 1 0 +915 2 3 0.5564 28.292441133424674 2.1988836940092424 7.463258849755662 0 1 0 +839 2 3 0.5564 26.910290112042958 6.063448035194025 5.063585745298239 0 1 0 +880 2 2 -1.1128 28.406942326033935 2.7991510311135688 4.260199050138843 0 1 0 +897 2 3 0.5564 27.747536325556545 1.2206385238286348 3.5735630764050397 0 1 0 +881 2 3 0.5564 29.245437925664305 3.008615335710485 3.848759968343325 0 1 0 +840 2 3 0.5564 27.732306784723644 4.9179177154124885 4.512269230492448 0 1 0 +823 2 2 -1.1128 27.744982568298607 4.921082089542739 7.960138430480629 0 1 0 +825 2 3 0.5564 28.164684169862443 5.433634827582471 8.651059816127074 0 1 0 +838 2 2 -1.1128 27.618723311223718 5.461577610249769 5.291862125144689 0 1 0 +918 2 3 0.5564 29.02685745449238 0.37211643590853727 5.955025086554165 0 1 0 +895 2 2 -1.1128 27.54700508575224 0.3218588761159764 3.312383533998835 0 1 0 +913 2 2 -1.1128 28.964145363419156 1.767681453892013 6.93494944041131 0 1 0 +896 2 3 0.5564 26.73803217297322 0.39396829884754553 2.8058305738430946 0 1 0 +379 1 1 0 23.46168 11.082769579342521 0 0 0 0 +383 1 1 0 23.46168 13.545607263640859 0 0 0 0 +384 1 1 0 24.17264 12.31418842149169 0 0 0 0 +387 1 1 0 23.46168 16.008444947939196 0 0 0 0 +388 1 1 0 24.17264 14.777026105790029 0 0 0 0 +391 1 1 0 23.46168 18.471282632237532 0 0 0 0 +392 1 1 0 24.17264 17.239863790088364 0 0 0 0 +395 1 1 0 23.46168 20.93412031653587 0 0 0 0 +396 1 1 0 24.17264 19.702701474386703 0 0 0 0 +450 1 1 0 26.30552 11.082769579342521 0 0 0 0 +451 1 1 0 27.72744 11.082769579342521 0 0 0 0 +453 1 1 0 25.59456 12.31418842149169 0 0 0 0 +454 1 1 0 26.30552 13.545607263640859 0 0 0 0 +455 1 1 0 27.72744 13.545607263640859 0 0 0 0 +456 1 1 0 28.4384 12.31418842149169 0 0 0 0 +457 1 1 0 25.59456 14.777026105790029 0 0 0 0 +458 1 1 0 26.30552 16.008444947939196 0 0 0 0 +459 1 1 0 27.72744 16.008444947939196 0 0 0 0 +460 1 1 0 28.4384 14.777026105790029 0 0 0 0 +461 1 1 0 25.59456 17.239863790088364 0 0 0 0 +462 1 1 0 26.30552 18.471282632237532 0 0 0 0 +463 1 1 0 27.72744 18.471282632237532 0 0 0 0 +464 1 1 0 28.4384 17.239863790088364 0 0 0 0 +465 1 1 0 25.59456 19.702701474386703 0 0 0 0 +466 1 1 0 26.30552 20.93412031653587 0 0 0 0 +467 1 1 0 27.72744 20.93412031653587 0 0 0 0 +468 1 1 0 28.4384 19.702701474386703 0 0 0 0 +399 1 1 0 23.46168 23.39695800083421 0 0 0 0 +400 1 1 0 24.17264 22.165539158685043 0 0 0 0 +403 1 1 0 23.46168 25.859795685132546 0 0 0 0 +404 1 1 0 24.17264 24.62837684298338 0 0 0 0 +407 1 1 0 23.46168 28.322633369430886 0 0 0 0 +408 1 1 0 24.17264 27.091214527281718 0 0 0 0 +411 1 1 0 23.46168 30.785471053729225 0 0 0 0 +412 1 1 0 24.17264 29.554052211580057 0 0 0 0 +416 1 1 0 24.17264 32.01688989587839 0 0 0 0 +469 1 1 0 25.59456 22.165539158685043 0 0 0 0 +470 1 1 0 26.30552 23.39695800083421 0 0 0 0 +471 1 1 0 27.72744 23.39695800083421 0 0 0 0 +472 1 1 0 28.4384 22.165539158685043 0 0 0 0 +473 1 1 0 25.59456 24.62837684298338 0 0 0 0 +474 1 1 0 26.30552 25.859795685132546 0 0 0 0 +475 1 1 0 27.72744 25.859795685132546 0 0 0 0 +476 1 1 0 28.4384 24.62837684298338 0 0 0 0 +477 1 1 0 25.59456 27.091214527281718 0 0 0 0 +478 1 1 0 26.30552 28.322633369430886 0 0 0 0 +479 1 1 0 27.72744 28.322633369430886 0 0 0 0 +480 1 1 0 28.4384 27.091214527281718 0 0 0 0 +481 1 1 0 25.59456 29.554052211580057 0 0 0 0 +482 1 1 0 26.30552 30.785471053729225 0 0 0 0 +483 1 1 0 27.72744 30.785471053729225 0 0 0 0 +484 1 1 0 28.4384 29.554052211580057 0 0 0 0 +485 1 1 0 25.59456 32.01688989587839 0 0 0 0 +488 1 1 0 28.4384 32.01688989587839 0 0 0 0 +415 1 1 0 23.46168 33.24830873802756 0 0 0 0 +419 1 1 0 23.46168 35.711146422325896 0 0 0 0 +420 1 1 0 24.17264 34.47972758017673 0 0 0 0 +423 1 1 0 23.46168 38.17398410662424 0 0 0 0 +424 1 1 0 24.17264 36.94256526447507 0 0 0 0 +427 1 1 0 23.46168 40.636821790922575 0 0 0 0 +428 1 1 0 24.17264 39.40540294877341 0 0 0 0 +431 1 1 0 23.46168 43.09965947522091 0 0 0 0 +432 1 1 0 24.17264 41.86824063307174 0 0 0 0 +486 1 1 0 26.30552 33.24830873802756 0 0 0 0 +487 1 1 0 27.72744 33.24830873802756 0 0 0 0 +489 1 1 0 25.59456 34.47972758017673 0 0 0 0 +490 1 1 0 26.30552 35.711146422325896 0 0 0 0 +491 1 1 0 27.72744 35.711146422325896 0 0 0 0 +492 1 1 0 28.4384 34.47972758017673 0 0 0 0 +493 1 1 0 25.59456 36.94256526447507 0 0 0 0 +494 1 1 0 26.30552 38.17398410662424 0 0 0 0 +495 1 1 0 27.72744 38.17398410662424 0 0 0 0 +496 1 1 0 28.4384 36.94256526447507 0 0 0 0 +497 1 1 0 25.59456 39.40540294877341 0 0 0 0 +498 1 1 0 26.30552 40.636821790922575 0 0 0 0 +499 1 1 0 27.72744 40.636821790922575 0 0 0 0 +500 1 1 0 28.4384 39.40540294877341 0 0 0 0 +501 1 1 0 25.59456 41.86824063307174 0 0 0 0 +502 1 1 0 26.30552 43.09965947522091 0 0 0 0 +503 1 1 0 27.72744 43.09965947522091 0 0 0 0 +504 1 1 0 28.4384 41.86824063307174 0 0 0 0 +916 2 2 -1.1128 29.08618298573557 43.94947838758336 5.367978087245454 0 0 0 +917 2 3 0.5564 28.386514599822995 44.08700021343198 4.729397955617813 0 0 0 +505 1 1 0 29.86032 0 0 0 0 0 +506 1 1 0 30.57128 1.231418842149169 0 0 0 0 +507 1 1 0 31.9932 1.231418842149169 0 0 0 0 +508 1 1 0 32.70416 0 0 0 0 0 +509 1 1 0 29.86032 2.462837684298338 0 0 0 0 +510 1 1 0 30.57128 3.694256526447507 0 0 0 0 +511 1 1 0 31.9932 3.694256526447507 0 0 0 0 +512 1 1 0 32.70416 2.462837684298338 0 0 0 0 +513 1 1 0 29.86032 4.925675368596676 0 0 0 0 +514 1 1 0 30.57128 6.157094210745845 0 0 0 0 +515 1 1 0 31.9932 6.157094210745845 0 0 0 0 +516 1 1 0 32.70416 4.925675368596676 0 0 0 0 +517 1 1 0 29.86032 7.388513052895014 0 0 0 0 +518 1 1 0 30.57128 8.619931895044184 0 0 0 0 +519 1 1 0 31.9932 8.619931895044184 0 0 0 0 +520 1 1 0 32.70416 7.388513052895014 0 0 0 0 +521 1 1 0 29.86032 9.851350737193352 0 0 0 0 +524 1 1 0 32.70416 9.851350737193352 0 0 0 0 +577 1 1 0 34.12608 0 0 0 0 0 +578 1 1 0 34.83704 1.231418842149169 0 0 0 0 +581 1 1 0 34.12608 2.462837684298338 0 0 0 0 +582 1 1 0 34.83704 3.694256526447507 0 0 0 0 +585 1 1 0 34.12608 4.925675368596676 0 0 0 0 +586 1 1 0 34.83704 6.157094210745845 0 0 0 0 +589 1 1 0 34.12608 7.388513052895014 0 0 0 0 +590 1 1 0 34.83704 8.619931895044184 0 0 0 0 +593 1 1 0 34.12608 9.851350737193352 0 0 0 0 +817 2 2 -1.1128 32.95909328018726 1.6637108808053531 5.668801991409098 0 1 0 +934 2 2 -1.1128 33.03662922860542 5.539750355496759 3.4106598806856026 0 1 0 +844 2 2 -1.1128 32.621956673723574 8.462510491174692 3.097685137766835 0 1 0 +865 2 2 -1.1128 33.39821533005053 4.27658110246568 8.57211051291085 0 1 0 +926 2 3 0.5564 34.92704311330822 0.3845425638438278 3.265292528280904 0 1 0 +936 2 3 0.5564 33.75132011550044 5.390752767402144 2.7915877722683704 0 1 0 +845 2 3 0.5564 32.95333393700144 7.6062659773288255 3.3683635070864155 0 1 0 +819 2 3 0.5564 32.7762889404034 1.1154582070700432 4.905758051766679 0 1 0 +884 2 3 0.5564 34.37559715270682 2.4504450164493186 4.161687719751862 0 1 0 +928 2 2 -1.1128 31.427550994207557 2.4943780016602988 7.958560374626963 0 1 0 +832 2 2 -1.1128 30.792128585762608 3.236529264630232 3.148554951507026 0 1 0 +866 2 3 0.5564 33.498279431301086 5.15245480897742 8.94502756132422 0 1 0 +879 2 3 0.5564 31.732225644992504 0.6458474538482556 8.445047264076692 0 1 0 +929 2 3 0.5564 31.77966866913706 2.4458814443480152 7.069800530214144 0 1 0 +935 2 3 0.5564 33.378544384335676 5.232733920405251 4.250343211939568 0 1 0 +909 2 3 0.5564 34.652364031673926 9.711776039203794 3.0913066271420564 0 1 0 +846 2 3 0.5564 31.81206671515871 8.574696009442315 3.595405469907686 0 1 0 +867 2 3 0.5564 34.29090448110653 3.9354082288573955 8.517893415156758 0 1 0 +914 2 3 0.5564 29.77283350609241 1.883495478021958 7.433793196056744 0 1 0 +818 2 3 0.5564 33.45847517590033 1.097384085601532 6.25712553579729 0 1 0 +793 2 2 -1.1128 31.42830690864691 0.30749748676379024 3.451602894838017 0 1 0 +833 2 3 0.5564 31.524189385665945 3.8525231665567263 3.17806031753671 0 1 0 +834 2 3 0.5564 31.198864521440843 2.3888322887806708 2.969088763806106 0 1 0 +930 2 3 0.5564 31.832512681924495 3.2758254964154077 8.334829251422462 0 1 0 +883 2 2 -1.1128 35.06386221461597 2.1652239249670107 3.56071142612891 0 1 0 +794 2 3 0.5564 31.07805011932854 0.1628051877054162 2.572616093573198 0 1 0 +795 2 3 0.5564 30.711778331953756 0.06543858818245951 4.038311517945166 0 1 0 +522 1 1 0 30.57128 11.082769579342521 0 0 0 0 +523 1 1 0 31.9932 11.082769579342521 0 0 0 0 +525 1 1 0 29.86032 12.31418842149169 0 0 0 0 +526 1 1 0 30.57128 13.545607263640859 0 0 0 0 +527 1 1 0 31.9932 13.545607263640859 0 0 0 0 +528 1 1 0 32.70416 12.31418842149169 0 0 0 0 +529 1 1 0 29.86032 14.777026105790029 0 0 0 0 +530 1 1 0 30.57128 16.008444947939196 0 0 0 0 +531 1 1 0 31.9932 16.008444947939196 0 0 0 0 +532 1 1 0 32.70416 14.777026105790029 0 0 0 0 +533 1 1 0 29.86032 17.239863790088364 0 0 0 0 +534 1 1 0 30.57128 18.471282632237532 0 0 0 0 +535 1 1 0 31.9932 18.471282632237532 0 0 0 0 +536 1 1 0 32.70416 17.239863790088364 0 0 0 0 +537 1 1 0 29.86032 19.702701474386703 0 0 0 0 +538 1 1 0 30.57128 20.93412031653587 0 0 0 0 +539 1 1 0 31.9932 20.93412031653587 0 0 0 0 +540 1 1 0 32.70416 19.702701474386703 0 0 0 0 +594 1 1 0 34.83704 11.082769579342521 0 0 0 0 +597 1 1 0 34.12608 12.31418842149169 0 0 0 0 +598 1 1 0 34.83704 13.545607263640859 0 0 0 0 +601 1 1 0 34.12608 14.777026105790029 0 0 0 0 +602 1 1 0 34.83704 16.008444947939196 0 0 0 0 +605 1 1 0 34.12608 17.239863790088364 0 0 0 0 +606 1 1 0 34.83704 18.471282632237532 0 0 0 0 +609 1 1 0 34.12608 19.702701474386703 0 0 0 0 +610 1 1 0 34.83704 20.93412031653587 0 0 0 0 +541 1 1 0 29.86032 22.165539158685043 0 0 0 0 +542 1 1 0 30.57128 23.39695800083421 0 0 0 0 +543 1 1 0 31.9932 23.39695800083421 0 0 0 0 +544 1 1 0 32.70416 22.165539158685043 0 0 0 0 +545 1 1 0 29.86032 24.62837684298338 0 0 0 0 +546 1 1 0 30.57128 25.859795685132546 0 0 0 0 +547 1 1 0 31.9932 25.859795685132546 0 0 0 0 +548 1 1 0 32.70416 24.62837684298338 0 0 0 0 +549 1 1 0 29.86032 27.091214527281718 0 0 0 0 +550 1 1 0 30.57128 28.322633369430886 0 0 0 0 +551 1 1 0 31.9932 28.322633369430886 0 0 0 0 +552 1 1 0 32.70416 27.091214527281718 0 0 0 0 +553 1 1 0 29.86032 29.554052211580057 0 0 0 0 +554 1 1 0 30.57128 30.785471053729225 0 0 0 0 +555 1 1 0 31.9932 30.785471053729225 0 0 0 0 +556 1 1 0 32.70416 29.554052211580057 0 0 0 0 +557 1 1 0 29.86032 32.01688989587839 0 0 0 0 +560 1 1 0 32.70416 32.01688989587839 0 0 0 0 +613 1 1 0 34.12608 22.165539158685043 0 0 0 0 +614 1 1 0 34.83704 23.39695800083421 0 0 0 0 +617 1 1 0 34.12608 24.62837684298338 0 0 0 0 +618 1 1 0 34.83704 25.859795685132546 0 0 0 0 +621 1 1 0 34.12608 27.091214527281718 0 0 0 0 +622 1 1 0 34.83704 28.322633369430886 0 0 0 0 +625 1 1 0 34.12608 29.554052211580057 0 0 0 0 +626 1 1 0 34.83704 30.785471053729225 0 0 0 0 +629 1 1 0 34.12608 32.01688989587839 0 0 0 0 +558 1 1 0 30.57128 33.24830873802756 0 0 0 0 +559 1 1 0 31.9932 33.24830873802756 0 0 0 0 +561 1 1 0 29.86032 34.47972758017673 0 0 0 0 +562 1 1 0 30.57128 35.711146422325896 0 0 0 0 +563 1 1 0 31.9932 35.711146422325896 0 0 0 0 +564 1 1 0 32.70416 34.47972758017673 0 0 0 0 +565 1 1 0 29.86032 36.94256526447507 0 0 0 0 +566 1 1 0 30.57128 38.17398410662424 0 0 0 0 +567 1 1 0 31.9932 38.17398410662424 0 0 0 0 +568 1 1 0 32.70416 36.94256526447507 0 0 0 0 +569 1 1 0 29.86032 39.40540294877341 0 0 0 0 +570 1 1 0 30.57128 40.636821790922575 0 0 0 0 +571 1 1 0 31.9932 40.636821790922575 0 0 0 0 +572 1 1 0 32.70416 39.40540294877341 0 0 0 0 +573 1 1 0 29.86032 41.86824063307174 0 0 0 0 +574 1 1 0 30.57128 43.09965947522091 0 0 0 0 +575 1 1 0 31.9932 43.09965947522091 0 0 0 0 +576 1 1 0 32.70416 41.86824063307174 0 0 0 0 +630 1 1 0 34.83704 33.24830873802756 0 0 0 0 +633 1 1 0 34.12608 34.47972758017673 0 0 0 0 +634 1 1 0 34.83704 35.711146422325896 0 0 0 0 +637 1 1 0 34.12608 36.94256526447507 0 0 0 0 +638 1 1 0 34.83704 38.17398410662424 0 0 0 0 +641 1 1 0 34.12608 39.40540294877341 0 0 0 0 +642 1 1 0 34.83704 40.636821790922575 0 0 0 0 +645 1 1 0 34.12608 41.86824063307174 0 0 0 0 +646 1 1 0 34.83704 43.09965947522091 0 0 0 0 +857 2 3 0.5564 31.280093348563454 40.92413736707893 6.6129915041108855 0 0 0 +856 2 2 -1.1128 31.40625202155322 40.21708321945418 7.245756851263454 0 0 0 +892 2 2 -1.1128 31.44124789790012 42.595258440016934 5.939207128004798 0 0 0 +893 2 3 0.5564 31.51332483392942 42.86716514991827 6.854141078427132 0 0 0 +886 2 2 -1.1128 34.01903467331608 42.21640858508662 5.249166944042416 0 0 0 +828 2 3 0.5564 32.936087243922984 39.01715292261755 6.258330984602254 0 0 0 +887 2 3 0.5564 33.06416149038681 42.23692223473913 5.31266208454256 0 0 0 +826 2 2 -1.1128 33.39528676861921 38.50985593645892 5.588989616608882 0 0 0 +827 2 3 0.5564 32.73225698170465 37.911697838992474 5.244270601582248 0 0 0 +894 2 3 0.5564 30.602363734473947 42.95262718865609 5.648014222802151 0 0 0 +925 2 2 -1.1128 34.84802945499661 43.76986891444704 3.140612646843307 0 0 0 +858 2 3 0.5564 30.675738345874993 40.309216087673825 7.857389270234698 0 0 0 +878 2 3 0.5564 32.99974881977633 44.200178456643876 8.15878411943684 0 0 0 +812 2 3 0.5564 34.62910581051034 43.605123868773425 6.411277828859756 0 0 0 +927 2 3 0.5564 34.27329532640793 43.48151669199635 3.849673061844464 0 0 0 +888 2 3 0.5564 34.21818732626533 41.3445338672516 4.907982839354571 0 0 0 +877 2 2 -1.1128 32.10811143071273 44.09784681673461 8.491565398531655 0 0 0 +835 2 2 -1.1128 35.185759286779124 40.039097016824876 3.8999166884707246 0 0 0 +811 2 2 -1.1128 34.72988962100261 44.30600404203223 7.05535990375944 0 0 0 +837 2 3 0.5564 34.873780058275806 39.29804634363621 4.419289163091052 0 0 0 +579 1 1 0 36.25896 1.231418842149169 0 0 0 0 +580 1 1 0 36.96992 0 0 0 0 0 +583 1 1 0 36.25896 3.694256526447507 0 0 0 0 +584 1 1 0 36.96992 2.462837684298338 0 0 0 0 +587 1 1 0 36.25896 6.157094210745845 0 0 0 0 +588 1 1 0 36.96992 4.925675368596676 0 0 0 0 +591 1 1 0 36.25896 8.619931895044184 0 0 0 0 +592 1 1 0 36.96992 7.388513052895014 0 0 0 0 +596 1 1 0 36.96992 9.851350737193352 0 0 0 0 +649 1 1 0 38.39184 0 0 0 0 0 +650 1 1 0 39.1028 1.231418842149169 0 0 0 0 +651 1 1 0 40.52472 1.231418842149169 0 0 0 0 +653 1 1 0 38.39184 2.462837684298338 0 0 0 0 +654 1 1 0 39.1028 3.694256526447507 0 0 0 0 +655 1 1 0 40.52472 3.694256526447507 0 0 0 0 +657 1 1 0 38.39184 4.925675368596676 0 0 0 0 +658 1 1 0 39.1028 6.157094210745845 0 0 0 0 +659 1 1 0 40.52472 6.157094210745845 0 0 0 0 +661 1 1 0 38.39184 7.388513052895014 0 0 0 0 +662 1 1 0 39.1028 8.619931895044184 0 0 0 0 +663 1 1 0 40.52472 8.619931895044184 0 0 0 0 +665 1 1 0 38.39184 9.851350737193352 0 0 0 0 +864 2 3 0.5564 38.72559977454883 6.453140217896254 3.9654022350817373 0 1 0 +885 2 3 0.5564 35.86457499683829 2.187926621046695 4.084712133041518 0 1 0 +891 2 3 0.5564 36.49290196320123 4.5825554857830815 2.340280303271688 0 1 0 +905 2 3 0.5564 35.6539726734068 6.533533581961909 4.2226103514317215 0 1 0 +847 2 2 -1.1128 38.31073636731568 9.297637163461909 3.018631746447206 0 1 0 +807 2 3 0.5564 39.93839438218238 3.380787594401584 8.070189977397536 0 1 0 +842 2 3 0.5564 40.4439801215969 3.4539357982168974 5.874913654515922 0 1 0 +806 2 3 0.5564 39.53388614087088 1.9224662216249124 8.030602383511098 0 1 0 +841 2 2 -1.1128 40.346631074078815 3.161275558289171 4.968764399811248 0 1 0 +848 2 3 0.5564 37.378243475312125 9.509492777618444 2.9761304825701878 0 1 0 +805 2 2 -1.1128 39.1879363509718 2.799773990143194 8.194559951043354 0 1 0 +862 2 2 -1.1128 39.527254402566676 6.871055409294266 3.6508699018474053 0 1 0 +808 2 2 -1.1128 40.9813125028353 6.491622655244695 6.1252186603712815 0 1 0 +863 2 3 0.5564 39.2982209112595 7.796620838566813 3.566577577839523 0 1 0 +906 2 3 0.5564 35.63016556188961 6.980217848903836 5.668916912294608 0 1 0 +803 2 3 0.5564 37.21046144155504 3.3547056748419672 8.44685444624274 0 1 0 +820 2 2 -1.1128 40.238058884519425 8.892908109209923 7.228256282347458 0 1 0 +813 2 3 0.5564 35.66411242895095 0.1828007460118728 7.039625445693748 0 1 0 +830 2 3 0.5564 37.461900361164744 5.761054225296827 7.339683551589981 0 1 0 +809 2 3 0.5564 40.143388183992 6.666539751684856 5.6968272273146985 0 1 0 +849 2 3 0.5564 38.545146461582334 9.064870760768706 2.1202418370825424 0 1 0 +814 2 2 -1.1128 40.748134171936435 0.7389880780512781 3.3949349561238815 0 1 0 +816 2 3 0.5564 40.34138668782936 1.5417691543993164 3.7210197692903493 0 1 0 +933 2 3 0.5564 38.42845468599284 3.199245505203782 4.980786350179616 0 1 0 +932 2 3 0.5564 37.36968971559904 3.309266240641299 6.057265875709786 0 1 0 +802 2 2 -1.1128 36.25679030038503 3.29601481677218 8.38941777770298 0 1 0 +931 2 2 -1.1128 37.542384613917065 2.9133905650069245 5.203046413341369 0 1 0 +907 2 2 -1.1128 35.578884551020806 9.573590646940167 3.2880229990945917 0 1 0 +831 2 3 0.5564 36.268287811817636 4.832138094401851 7.27407174097549 0 1 0 +804 2 3 0.5564 36.035479013673445 2.501960846901915 8.875969191698895 0 1 0 +904 2 2 -1.1128 35.40021179318659 7.265609687237741 4.784662067802107 0 1 0 +829 2 2 -1.1128 36.67463142628169 5.575159558617119 6.8279361567305 0 1 0 +890 2 3 0.5564 35.51445085753465 3.6096863189422184 2.96322151266684 0 1 0 +919 2 2 -1.1128 40.013239321978745 0.15668706717705305 7.440776242049551 0 1 0 +908 2 3 0.5564 35.58368296090604 8.875183376627756 3.9425735956748125 0 1 0 +800 2 3 0.5564 37.74677816296982 0.734680968209546 5.402507033516551 0 1 0 +859 2 2 -1.1128 40.622879392981964 10.272720036648469 4.720042613666213 0 1 0 +861 2 3 0.5564 39.78296055209543 10.382230179324548 4.274198380882334 0 1 0 +889 2 2 -1.1128 35.68276124895589 4.5449882413929235 2.8487022953494807 0 1 0 +860 2 3 0.5564 40.42792864795578 9.700111278266009 5.461896012943214 0 1 0 +822 2 3 0.5564 40.522133068490525 8.019471778966093 6.958729128356608 0 1 0 +821 2 3 0.5564 40.47731496825091 8.948235047845442 8.153419981025246 0 1 0 +595 1 1 0 36.25896 11.082769579342521 0 0 0 0 +599 1 1 0 36.25896 13.545607263640859 0 0 0 0 +600 1 1 0 36.96992 12.31418842149169 0 0 0 0 +603 1 1 0 36.25896 16.008444947939196 0 0 0 0 +604 1 1 0 36.96992 14.777026105790029 0 0 0 0 +607 1 1 0 36.25896 18.471282632237532 0 0 0 0 +608 1 1 0 36.96992 17.239863790088364 0 0 0 0 +611 1 1 0 36.25896 20.93412031653587 0 0 0 0 +612 1 1 0 36.96992 19.702701474386703 0 0 0 0 +666 1 1 0 39.1028 11.082769579342521 0 0 0 0 +667 1 1 0 40.52472 11.082769579342521 0 0 0 0 +669 1 1 0 38.39184 12.31418842149169 0 0 0 0 +670 1 1 0 39.1028 13.545607263640859 0 0 0 0 +671 1 1 0 40.52472 13.545607263640859 0 0 0 0 +673 1 1 0 38.39184 14.777026105790029 0 0 0 0 +674 1 1 0 39.1028 16.008444947939196 0 0 0 0 +675 1 1 0 40.52472 16.008444947939196 0 0 0 0 +677 1 1 0 38.39184 17.239863790088364 0 0 0 0 +678 1 1 0 39.1028 18.471282632237532 0 0 0 0 +679 1 1 0 40.52472 18.471282632237532 0 0 0 0 +681 1 1 0 38.39184 19.702701474386703 0 0 0 0 +682 1 1 0 39.1028 20.93412031653587 0 0 0 0 +683 1 1 0 40.52472 20.93412031653587 0 0 0 0 +615 1 1 0 36.25896 23.39695800083421 0 0 0 0 +616 1 1 0 36.96992 22.165539158685043 0 0 0 0 +619 1 1 0 36.25896 25.859795685132546 0 0 0 0 +620 1 1 0 36.96992 24.62837684298338 0 0 0 0 +623 1 1 0 36.25896 28.322633369430886 0 0 0 0 +624 1 1 0 36.96992 27.091214527281718 0 0 0 0 +627 1 1 0 36.25896 30.785471053729225 0 0 0 0 +628 1 1 0 36.96992 29.554052211580057 0 0 0 0 +632 1 1 0 36.96992 32.01688989587839 0 0 0 0 +685 1 1 0 38.39184 22.165539158685043 0 0 0 0 +686 1 1 0 39.1028 23.39695800083421 0 0 0 0 +687 1 1 0 40.52472 23.39695800083421 0 0 0 0 +689 1 1 0 38.39184 24.62837684298338 0 0 0 0 +690 1 1 0 39.1028 25.859795685132546 0 0 0 0 +691 1 1 0 40.52472 25.859795685132546 0 0 0 0 +693 1 1 0 38.39184 27.091214527281718 0 0 0 0 +694 1 1 0 39.1028 28.322633369430886 0 0 0 0 +695 1 1 0 40.52472 28.322633369430886 0 0 0 0 +697 1 1 0 38.39184 29.554052211580057 0 0 0 0 +698 1 1 0 39.1028 30.785471053729225 0 0 0 0 +699 1 1 0 40.52472 30.785471053729225 0 0 0 0 +701 1 1 0 38.39184 32.01688989587839 0 0 0 0 +631 1 1 0 36.25896 33.24830873802756 0 0 0 0 +635 1 1 0 36.25896 35.711146422325896 0 0 0 0 +636 1 1 0 36.96992 34.47972758017673 0 0 0 0 +639 1 1 0 36.25896 38.17398410662424 0 0 0 0 +640 1 1 0 36.96992 36.94256526447507 0 0 0 0 +643 1 1 0 36.25896 40.636821790922575 0 0 0 0 +644 1 1 0 36.96992 39.40540294877341 0 0 0 0 +647 1 1 0 36.25896 43.09965947522091 0 0 0 0 +648 1 1 0 36.96992 41.86824063307174 0 0 0 0 +702 1 1 0 39.1028 33.24830873802756 0 0 0 0 +703 1 1 0 40.52472 33.24830873802756 0 0 0 0 +705 1 1 0 38.39184 34.47972758017673 0 0 0 0 +706 1 1 0 39.1028 35.711146422325896 0 0 0 0 +707 1 1 0 40.52472 35.711146422325896 0 0 0 0 +709 1 1 0 38.39184 36.94256526447507 0 0 0 0 +710 1 1 0 39.1028 38.17398410662424 0 0 0 0 +711 1 1 0 40.52472 38.17398410662424 0 0 0 0 +713 1 1 0 38.39184 39.40540294877341 0 0 0 0 +714 1 1 0 39.1028 40.636821790922575 0 0 0 0 +715 1 1 0 40.52472 40.636821790922575 0 0 0 0 +717 1 1 0 38.39184 41.86824063307174 0 0 0 0 +718 1 1 0 39.1028 43.09965947522091 0 0 0 0 +719 1 1 0 40.52472 43.09965947522091 0 0 0 0 +801 2 3 0.5564 37.548308436970686 43.56537533039196 5.365704432988823 0 0 0 +852 2 3 0.5564 38.88919502047367 42.042424135970684 3.6087789454249384 0 0 0 +876 2 3 0.5564 36.695468476045846 41.81307318973102 4.654847654027673 0 0 0 +851 2 3 0.5564 39.88056712847529 43.079060421379005 3.124565190962247 0 0 0 +836 2 3 0.5564 35.55710562397264 39.6409654643291 3.11262603757073 0 0 0 +874 2 2 -1.1128 37.156592548770114 42.42602324299549 4.082231251420106 0 0 0 +875 2 3 0.5564 36.4628015962606 42.8541504174728 3.580640511788261 0 0 0 +850 2 2 -1.1128 39.74740412124872 42.13377480969944 3.1948153248505924 0 0 0 +920 2 3 0.5564 40.541519697736526 43.81546496276574 7.010468244614621 0 0 0 +921 2 3 0.5564 39.11034070400223 44.265151888276336 7.21395020009192 0 0 0 +799 2 2 -1.1128 37.54782393045426 44.314597322511524 5.9614390867350435 0 0 0 +652 1 1 0 41.23568 0 0 0 0 0 +656 1 1 0 41.23568 2.462837684298338 0 0 0 0 +660 1 1 0 41.23568 4.925675368596676 0 0 0 0 +664 1 1 0 41.23568 7.388513052895014 0 0 0 0 +668 1 1 0 41.23568 9.851350737193352 0 0 0 0 +721 1 1 0 42.6576 0 0 0 0 0 +722 1 1 0 43.36856 1.231418842149169 0 0 0 0 +723 1 1 0 44.79048 1.231418842149169 0 0 0 0 +724 1 1 0 45.50144 0 0 0 0 0 +725 1 1 0 42.6576 2.462837684298338 0 0 0 0 +726 1 1 0 43.36856 3.694256526447507 0 0 0 0 +727 1 1 0 44.79048 3.694256526447507 0 0 0 0 +728 1 1 0 45.50144 2.462837684298338 0 0 0 0 +729 1 1 0 42.6576 4.925675368596676 0 0 0 0 +730 1 1 0 43.36856 6.157094210745845 0 0 0 0 +731 1 1 0 44.79048 6.157094210745845 0 0 0 0 +732 1 1 0 45.50144 4.925675368596676 0 0 0 0 +733 1 1 0 42.6576 7.388513052895014 0 0 0 0 +734 1 1 0 43.36856 8.619931895044184 0 0 0 0 +735 1 1 0 44.79048 8.619931895044184 0 0 0 0 +736 1 1 0 45.50144 7.388513052895014 0 0 0 0 +737 1 1 0 42.6576 9.851350737193352 0 0 0 0 +740 1 1 0 45.50144 9.851350737193352 0 0 0 0 +855 2 3 0.5564 42.60570890502672 6.754108104519662 3.2778996089299444 0 1 0 +853 2 2 -1.1128 42.099480757637274 5.9504482420758835 3.3966273472818673 0 1 0 +924 2 3 0.5564 42.55717296882286 9.17260477834803 2.5938337966266043 0 1 0 +796 2 2 -1.1128 42.77023484300884 3.2473201847921502 3.212925112248156 0 1 0 +902 2 3 0.5564 42.12839423169956 3.7289140838154062 7.1537282390574495 0 1 0 +903 2 3 0.5564 41.53585251071065 5.1118011663682905 7.322300070785221 0 1 0 +898 2 2 -1.1128 45.445001196506084 2.452551396966245 3.028403472579563 0 1 0 +797 2 3 0.5564 42.58443206962962 4.186306057729107 3.2089115332453373 0 1 0 +798 2 3 0.5564 43.71048122279908 3.189455512069421 3.38269391940839 0 1 0 +810 2 3 0.5564 41.63040595115056 6.5777864583716426 5.427015401612798 0 1 0 +854 2 3 0.5564 41.20236665318539 6.25112336337136 3.5415926908824034 0 1 0 +923 2 3 0.5564 42.32247135813611 9.521352146245636 4.048203548805301 0 1 0 +922 2 2 -1.1128 42.80519254575484 8.918478791891543 3.4827315727519106 0 1 0 +900 2 3 0.5564 45.15285956979833 1.5485234956341212 3.145105564354613 0 1 0 +899 2 3 0.5564 46.07339231136837 2.4105339689072443 2.3075759749099993 0 1 0 +901 2 2 -1.1128 41.44718299707816 4.208196261290198 7.625398774411962 0 1 0 +815 2 3 0.5564 41.32793113560261 1.0321378043039096 2.6919903566852 0 1 0 +843 2 3 0.5564 41.07940607864339 3.567038821973523 4.505483562010162 0 1 0 +672 1 1 0 41.23568 12.31418842149169 0 0 0 0 +676 1 1 0 41.23568 14.777026105790029 0 0 0 0 +680 1 1 0 41.23568 17.239863790088364 0 0 0 0 +684 1 1 0 41.23568 19.702701474386703 0 0 0 0 +738 1 1 0 43.36856 11.082769579342521 0 0 0 0 +739 1 1 0 44.79048 11.082769579342521 0 0 0 0 +741 1 1 0 42.6576 12.31418842149169 0 0 0 0 +742 1 1 0 43.36856 13.545607263640859 0 0 0 0 +743 1 1 0 44.79048 13.545607263640859 0 0 0 0 +744 1 1 0 45.50144 12.31418842149169 0 0 0 0 +745 1 1 0 42.6576 14.777026105790029 0 0 0 0 +746 1 1 0 43.36856 16.008444947939196 0 0 0 0 +747 1 1 0 44.79048 16.008444947939196 0 0 0 0 +748 1 1 0 45.50144 14.777026105790029 0 0 0 0 +749 1 1 0 42.6576 17.239863790088364 0 0 0 0 +750 1 1 0 43.36856 18.471282632237532 0 0 0 0 +751 1 1 0 44.79048 18.471282632237532 0 0 0 0 +752 1 1 0 45.50144 17.239863790088364 0 0 0 0 +753 1 1 0 42.6576 19.702701474386703 0 0 0 0 +754 1 1 0 43.36856 20.93412031653587 0 0 0 0 +755 1 1 0 44.79048 20.93412031653587 0 0 0 0 +756 1 1 0 45.50144 19.702701474386703 0 0 0 0 +688 1 1 0 41.23568 22.165539158685043 0 0 0 0 +692 1 1 0 41.23568 24.62837684298338 0 0 0 0 +696 1 1 0 41.23568 27.091214527281718 0 0 0 0 +700 1 1 0 41.23568 29.554052211580057 0 0 0 0 +704 1 1 0 41.23568 32.01688989587839 0 0 0 0 +757 1 1 0 42.6576 22.165539158685043 0 0 0 0 +758 1 1 0 43.36856 23.39695800083421 0 0 0 0 +759 1 1 0 44.79048 23.39695800083421 0 0 0 0 +760 1 1 0 45.50144 22.165539158685043 0 0 0 0 +761 1 1 0 42.6576 24.62837684298338 0 0 0 0 +762 1 1 0 43.36856 25.859795685132546 0 0 0 0 +763 1 1 0 44.79048 25.859795685132546 0 0 0 0 +764 1 1 0 45.50144 24.62837684298338 0 0 0 0 +765 1 1 0 42.6576 27.091214527281718 0 0 0 0 +766 1 1 0 43.36856 28.322633369430886 0 0 0 0 +767 1 1 0 44.79048 28.322633369430886 0 0 0 0 +768 1 1 0 45.50144 27.091214527281718 0 0 0 0 +769 1 1 0 42.6576 29.554052211580057 0 0 0 0 +770 1 1 0 43.36856 30.785471053729225 0 0 0 0 +771 1 1 0 44.79048 30.785471053729225 0 0 0 0 +772 1 1 0 45.50144 29.554052211580057 0 0 0 0 +773 1 1 0 42.6576 32.01688989587839 0 0 0 0 +776 1 1 0 45.50144 32.01688989587839 0 0 0 0 +708 1 1 0 41.23568 34.47972758017673 0 0 0 0 +712 1 1 0 41.23568 36.94256526447507 0 0 0 0 +716 1 1 0 41.23568 39.40540294877341 0 0 0 0 +720 1 1 0 41.23568 41.86824063307174 0 0 0 0 +774 1 1 0 43.36856 33.24830873802756 0 0 0 0 +775 1 1 0 44.79048 33.24830873802756 0 0 0 0 +777 1 1 0 42.6576 34.47972758017673 0 0 0 0 +778 1 1 0 43.36856 35.711146422325896 0 0 0 0 +779 1 1 0 44.79048 35.711146422325896 0 0 0 0 +780 1 1 0 45.50144 34.47972758017673 0 0 0 0 +781 1 1 0 42.6576 36.94256526447507 0 0 0 0 +782 1 1 0 43.36856 38.17398410662424 0 0 0 0 +783 1 1 0 44.79048 38.17398410662424 0 0 0 0 +784 1 1 0 45.50144 36.94256526447507 0 0 0 0 +785 1 1 0 42.6576 39.40540294877341 0 0 0 0 +786 1 1 0 43.36856 40.636821790922575 0 0 0 0 +787 1 1 0 44.79048 40.636821790922575 0 0 0 0 +788 1 1 0 45.50144 39.40540294877341 0 0 0 0 +789 1 1 0 42.6576 41.86824063307174 0 0 0 0 +790 1 1 0 43.36856 43.09965947522091 0 0 0 0 +791 1 1 0 44.79048 43.09965947522091 0 0 0 0 +792 1 1 0 45.50144 41.86824063307174 0 0 0 0 +871 2 2 -1.1128 42.43621342090696 41.361777660606826 3.5286311215230155 0 0 0 +910 2 2 -1.1128 44.00261269418429 44.009231456650014 3.7548439135777425 0 0 0 +873 2 3 0.5564 42.81116163142683 40.8806399438352 2.7909638607684895 0 0 0 +912 2 3 0.5564 44.01512081357764 43.199784996149646 3.244083663427368 0 0 0 +872 2 3 0.5564 41.50534987825062 41.436128256982094 3.318397554899502 0 0 0 +869 2 3 0.5564 41.92696097428322 42.44540495044042 4.918533220471727 0 0 0 +868 2 2 -1.1128 41.602312218152235 43.15319449082845 5.475195560073079 0 0 0 +870 2 3 0.5564 41.17840173459901 43.7603473856229 4.8686487491511015 0 0 0 +911 2 3 0.5564 43.2397024819597 43.9207537163753 4.326134358669964 0 0 0 + +Velocities + +1 0 0 0 +2 0 0 0 +3 0 0 0 +4 0 0 0 +5 0 0 0 +6 0 0 0 +7 0 0 0 +8 0 0 0 +9 0 0 0 +10 0 0 0 +11 0 0 0 +12 0 0 0 +13 0 0 0 +14 0 0 0 +15 0 0 0 +16 0 0 0 +17 0 0 0 +20 0 0 0 +73 0 0 0 +74 0 0 0 +77 0 0 0 +78 0 0 0 +81 0 0 0 +82 0 0 0 +85 0 0 0 +86 0 0 0 +89 0 0 0 +18 0 0 0 +19 0 0 0 +21 0 0 0 +22 0 0 0 +23 0 0 0 +24 0 0 0 +25 0 0 0 +26 0 0 0 +27 0 0 0 +28 0 0 0 +29 0 0 0 +30 0 0 0 +31 0 0 0 +32 0 0 0 +33 0 0 0 +34 0 0 0 +35 0 0 0 +36 0 0 0 +90 0 0 0 +93 0 0 0 +94 0 0 0 +97 0 0 0 +98 0 0 0 +101 0 0 0 +102 0 0 0 +105 0 0 0 +106 0 0 0 +37 0 0 0 +38 0 0 0 +39 0 0 0 +40 0 0 0 +41 0 0 0 +42 0 0 0 +43 0 0 0 +44 0 0 0 +45 0 0 0 +46 0 0 0 +47 0 0 0 +48 0 0 0 +49 0 0 0 +50 0 0 0 +51 0 0 0 +52 0 0 0 +53 0 0 0 +56 0 0 0 +109 0 0 0 +110 0 0 0 +113 0 0 0 +114 0 0 0 +117 0 0 0 +118 0 0 0 +121 0 0 0 +122 0 0 0 +125 0 0 0 +54 0 0 0 +55 0 0 0 +57 0 0 0 +58 0 0 0 +59 0 0 0 +60 0 0 0 +61 0 0 0 +62 0 0 0 +63 0 0 0 +64 0 0 0 +65 0 0 0 +66 0 0 0 +67 0 0 0 +68 0 0 0 +69 0 0 0 +70 0 0 0 +71 0 0 0 +72 0 0 0 +126 0 0 0 +129 0 0 0 +130 0 0 0 +133 0 0 0 +134 0 0 0 +137 0 0 0 +138 0 0 0 +141 0 0 0 +142 0 0 0 +75 0 0 0 +76 0 0 0 +79 0 0 0 +80 0 0 0 +83 0 0 0 +84 0 0 0 +87 0 0 0 +88 0 0 0 +92 0 0 0 +145 0 0 0 +146 0 0 0 +147 0 0 0 +148 0 0 0 +149 0 0 0 +150 0 0 0 +151 0 0 0 +152 0 0 0 +153 0 0 0 +154 0 0 0 +155 0 0 0 +156 0 0 0 +157 0 0 0 +158 0 0 0 +159 0 0 0 +160 0 0 0 +161 0 0 0 +164 0 0 0 +91 0 0 0 +95 0 0 0 +96 0 0 0 +99 0 0 0 +100 0 0 0 +103 0 0 0 +104 0 0 0 +107 0 0 0 +108 0 0 0 +162 0 0 0 +163 0 0 0 +165 0 0 0 +166 0 0 0 +167 0 0 0 +168 0 0 0 +169 0 0 0 +170 0 0 0 +171 0 0 0 +172 0 0 0 +173 0 0 0 +174 0 0 0 +175 0 0 0 +176 0 0 0 +177 0 0 0 +178 0 0 0 +179 0 0 0 +180 0 0 0 +111 0 0 0 +112 0 0 0 +115 0 0 0 +116 0 0 0 +119 0 0 0 +120 0 0 0 +123 0 0 0 +124 0 0 0 +128 0 0 0 +181 0 0 0 +182 0 0 0 +183 0 0 0 +184 0 0 0 +185 0 0 0 +186 0 0 0 +187 0 0 0 +188 0 0 0 +189 0 0 0 +190 0 0 0 +191 0 0 0 +192 0 0 0 +193 0 0 0 +194 0 0 0 +195 0 0 0 +196 0 0 0 +197 0 0 0 +200 0 0 0 +127 0 0 0 +131 0 0 0 +132 0 0 0 +135 0 0 0 +136 0 0 0 +139 0 0 0 +140 0 0 0 +143 0 0 0 +144 0 0 0 +198 0 0 0 +199 0 0 0 +201 0 0 0 +202 0 0 0 +203 0 0 0 +204 0 0 0 +205 0 0 0 +206 0 0 0 +207 0 0 0 +208 0 0 0 +209 0 0 0 +210 0 0 0 +211 0 0 0 +212 0 0 0 +213 0 0 0 +214 0 0 0 +215 0 0 0 +216 0 0 0 +217 0 0 0 +218 0 0 0 +219 0 0 0 +220 0 0 0 +221 0 0 0 +222 0 0 0 +223 0 0 0 +224 0 0 0 +225 0 0 0 +226 0 0 0 +227 0 0 0 +228 0 0 0 +229 0 0 0 +230 0 0 0 +231 0 0 0 +232 0 0 0 +233 0 0 0 +236 0 0 0 +289 0 0 0 +293 0 0 0 +297 0 0 0 +301 0 0 0 +305 0 0 0 +234 0 0 0 +235 0 0 0 +237 0 0 0 +238 0 0 0 +239 0 0 0 +240 0 0 0 +241 0 0 0 +242 0 0 0 +243 0 0 0 +244 0 0 0 +245 0 0 0 +246 0 0 0 +247 0 0 0 +248 0 0 0 +249 0 0 0 +250 0 0 0 +251 0 0 0 +252 0 0 0 +309 0 0 0 +313 0 0 0 +317 0 0 0 +321 0 0 0 +253 0 0 0 +254 0 0 0 +255 0 0 0 +256 0 0 0 +257 0 0 0 +258 0 0 0 +259 0 0 0 +260 0 0 0 +261 0 0 0 +262 0 0 0 +263 0 0 0 +264 0 0 0 +265 0 0 0 +266 0 0 0 +267 0 0 0 +268 0 0 0 +269 0 0 0 +272 0 0 0 +325 0 0 0 +329 0 0 0 +333 0 0 0 +337 0 0 0 +341 0 0 0 +270 0 0 0 +271 0 0 0 +273 0 0 0 +274 0 0 0 +275 0 0 0 +276 0 0 0 +277 0 0 0 +278 0 0 0 +279 0 0 0 +280 0 0 0 +281 0 0 0 +282 0 0 0 +283 0 0 0 +284 0 0 0 +285 0 0 0 +286 0 0 0 +287 0 0 0 +288 0 0 0 +345 0 0 0 +349 0 0 0 +353 0 0 0 +357 0 0 0 +290 0 0 0 +291 0 0 0 +292 0 0 0 +294 0 0 0 +295 0 0 0 +296 0 0 0 +298 0 0 0 +299 0 0 0 +300 0 0 0 +302 0 0 0 +303 0 0 0 +304 0 0 0 +308 0 0 0 +361 0 0 0 +362 0 0 0 +365 0 0 0 +366 0 0 0 +369 0 0 0 +370 0 0 0 +373 0 0 0 +374 0 0 0 +377 0 0 0 +306 0 0 0 +307 0 0 0 +310 0 0 0 +311 0 0 0 +312 0 0 0 +314 0 0 0 +315 0 0 0 +316 0 0 0 +318 0 0 0 +319 0 0 0 +320 0 0 0 +322 0 0 0 +323 0 0 0 +324 0 0 0 +378 0 0 0 +381 0 0 0 +382 0 0 0 +385 0 0 0 +386 0 0 0 +389 0 0 0 +390 0 0 0 +393 0 0 0 +394 0 0 0 +326 0 0 0 +327 0 0 0 +328 0 0 0 +330 0 0 0 +331 0 0 0 +332 0 0 0 +334 0 0 0 +335 0 0 0 +336 0 0 0 +338 0 0 0 +339 0 0 0 +340 0 0 0 +344 0 0 0 +397 0 0 0 +398 0 0 0 +401 0 0 0 +402 0 0 0 +405 0 0 0 +406 0 0 0 +409 0 0 0 +410 0 0 0 +413 0 0 0 +342 0 0 0 +343 0 0 0 +346 0 0 0 +347 0 0 0 +348 0 0 0 +350 0 0 0 +351 0 0 0 +352 0 0 0 +354 0 0 0 +355 0 0 0 +356 0 0 0 +358 0 0 0 +359 0 0 0 +360 0 0 0 +414 0 0 0 +417 0 0 0 +418 0 0 0 +421 0 0 0 +422 0 0 0 +425 0 0 0 +426 0 0 0 +429 0 0 0 +430 0 0 0 +363 0 0 0 +364 0 0 0 +367 0 0 0 +368 0 0 0 +371 0 0 0 +372 0 0 0 +375 0 0 0 +376 0 0 0 +380 0 0 0 +433 0 0 0 +434 0 0 0 +435 0 0 0 +436 0 0 0 +437 0 0 0 +438 0 0 0 +439 0 0 0 +440 0 0 0 +441 0 0 0 +442 0 0 0 +443 0 0 0 +444 0 0 0 +445 0 0 0 +446 0 0 0 +447 0 0 0 +448 0 0 0 +449 0 0 0 +452 0 0 0 +824 23.28678663838591 -19.695178733121715 -4.712860628654516 +882 -7.0610581976405244 16.44204311186104 -4.175586130223243 +915 5.458359862786789 12.338077912032869 3.646984172142374 +839 20.392115541402525 21.839207526251702 -29.285410530315588 +880 -1.6972489953530285 5.884325737897911 -5.109687018230828 +897 -0.5612899831289091 6.907522350424367 -17.06603259626599 +881 -3.29469084908246 18.230178486719424 -2.0874433657999796 +840 0.3491624797675958 -9.4770564186721 5.993889540912456 +823 -2.4113508906287486 0.7060826232690176 4.591531586272169 +825 -9.503739029582237 10.088287372649603 1.9260324522526424 +838 -4.206308232163817 2.7689815350821445 -3.2345774478153677 +918 5.963097489077942 -5.811799881204121 -1.1246744751170932 +895 -3.6065546286281265 3.360807936038344 -2.5135837850671177 +913 -3.9429603880542876 -3.803003714965937 4.88513733901858 +896 7.160890299407335 0.32762830929124437 -20.137386051219497 +379 0 0 0 +383 0 0 0 +384 0 0 0 +387 0 0 0 +388 0 0 0 +391 0 0 0 +392 0 0 0 +395 0 0 0 +396 0 0 0 +450 0 0 0 +451 0 0 0 +453 0 0 0 +454 0 0 0 +455 0 0 0 +456 0 0 0 +457 0 0 0 +458 0 0 0 +459 0 0 0 +460 0 0 0 +461 0 0 0 +462 0 0 0 +463 0 0 0 +464 0 0 0 +465 0 0 0 +466 0 0 0 +467 0 0 0 +468 0 0 0 +399 0 0 0 +400 0 0 0 +403 0 0 0 +404 0 0 0 +407 0 0 0 +408 0 0 0 +411 0 0 0 +412 0 0 0 +416 0 0 0 +469 0 0 0 +470 0 0 0 +471 0 0 0 +472 0 0 0 +473 0 0 0 +474 0 0 0 +475 0 0 0 +476 0 0 0 +477 0 0 0 +478 0 0 0 +479 0 0 0 +480 0 0 0 +481 0 0 0 +482 0 0 0 +483 0 0 0 +484 0 0 0 +485 0 0 0 +488 0 0 0 +415 0 0 0 +419 0 0 0 +420 0 0 0 +423 0 0 0 +424 0 0 0 +427 0 0 0 +428 0 0 0 +431 0 0 0 +432 0 0 0 +486 0 0 0 +487 0 0 0 +489 0 0 0 +490 0 0 0 +491 0 0 0 +492 0 0 0 +493 0 0 0 +494 0 0 0 +495 0 0 0 +496 0 0 0 +497 0 0 0 +498 0 0 0 +499 0 0 0 +500 0 0 0 +501 0 0 0 +502 0 0 0 +503 0 0 0 +504 0 0 0 +916 2.1969507203442245 -1.4352986791463374 -7.127919603909629 +917 11.826235663356204 14.279824537641929 -14.280083496635585 +505 0 0 0 +506 0 0 0 +507 0 0 0 +508 0 0 0 +509 0 0 0 +510 0 0 0 +511 0 0 0 +512 0 0 0 +513 0 0 0 +514 0 0 0 +515 0 0 0 +516 0 0 0 +517 0 0 0 +518 0 0 0 +519 0 0 0 +520 0 0 0 +521 0 0 0 +524 0 0 0 +577 0 0 0 +578 0 0 0 +581 0 0 0 +582 0 0 0 +585 0 0 0 +586 0 0 0 +589 0 0 0 +590 0 0 0 +593 0 0 0 +817 1.6133973243890818 0.09544910649802017 -2.82837163408008 +934 -0.7137103646976727 -3.722196372187516 0.848848803609948 +844 -1.412310995403245 2.5213507567859863 -4.599202803630543 +865 8.862935798755592 -1.7466754230232333 -1.6569510007225825 +926 -4.119692818575567 8.294228711700969 -32.74811918647688 +936 -15.928953261034998 -9.92364110983116 -15.23435729552565 +845 -7.482059146842958 -2.336334839582908 -12.584395592557943 +819 19.704188351794787 13.480076284531094 -16.836845023051307 +884 -5.8411676590434105 -3.4674785948480853 3.373261182910667 +928 -0.47949465869401636 4.8766140418593915 -1.7082902202551018 +832 3.7664949439970346 -7.725237251790142 2.249127795467372 +866 8.574128387623029 11.87092357709237 -33.55660077300949 +879 2.397970035203643 -1.0067012033099316 -24.55246411236801 +929 3.276394804624606 -17.02257780299615 0.9984492433600977 +935 20.101385093495328 5.113530565709303 -4.402939514605331 +909 -4.28073098421694 -15.637815198236153 -13.025293876950634 +846 -12.564589941629468 -6.4025051268954645 -20.75775453419462 +867 8.983700225517605 -3.390103398382499 10.693415861649115 +914 -2.2270563485919563 -24.131906542363726 6.875944405629472 +818 0.2383020958130696 -5.676983900196928 -7.219651526329348 +793 5.148041806008255 2.984645492151128 3.4961269673039586 +833 -0.6438138903502075 -2.2828874172817644 -2.0720922776886743 +834 10.612584098261342 -7.3667177513881885 16.15587930450157 +930 6.00984818290816 8.246158764929453 -15.698501664737071 +883 -3.3507225248985764 -0.5583884018684485 4.849649083643576 +794 3.908344161677918 -24.184551279453736 8.492626116154728 +795 8.894549364978065 12.946246804004156 12.17949248871838 +522 0 0 0 +523 0 0 0 +525 0 0 0 +526 0 0 0 +527 0 0 0 +528 0 0 0 +529 0 0 0 +530 0 0 0 +531 0 0 0 +532 0 0 0 +533 0 0 0 +534 0 0 0 +535 0 0 0 +536 0 0 0 +537 0 0 0 +538 0 0 0 +539 0 0 0 +540 0 0 0 +594 0 0 0 +597 0 0 0 +598 0 0 0 +601 0 0 0 +602 0 0 0 +605 0 0 0 +606 0 0 0 +609 0 0 0 +610 0 0 0 +541 0 0 0 +542 0 0 0 +543 0 0 0 +544 0 0 0 +545 0 0 0 +546 0 0 0 +547 0 0 0 +548 0 0 0 +549 0 0 0 +550 0 0 0 +551 0 0 0 +552 0 0 0 +553 0 0 0 +554 0 0 0 +555 0 0 0 +556 0 0 0 +557 0 0 0 +560 0 0 0 +613 0 0 0 +614 0 0 0 +617 0 0 0 +618 0 0 0 +621 0 0 0 +622 0 0 0 +625 0 0 0 +626 0 0 0 +629 0 0 0 +558 0 0 0 +559 0 0 0 +561 0 0 0 +562 0 0 0 +563 0 0 0 +564 0 0 0 +565 0 0 0 +566 0 0 0 +567 0 0 0 +568 0 0 0 +569 0 0 0 +570 0 0 0 +571 0 0 0 +572 0 0 0 +573 0 0 0 +574 0 0 0 +575 0 0 0 +576 0 0 0 +630 0 0 0 +633 0 0 0 +634 0 0 0 +637 0 0 0 +638 0 0 0 +641 0 0 0 +642 0 0 0 +645 0 0 0 +646 0 0 0 +857 0.014723103701010352 19.617056339014884 16.55424143708416 +856 -0.643223754474494 5.776893808258414 1.1873537786475037 +892 -3.075450592140558 0.21721350023132013 -1.4569947460087087 +893 -16.397277523345814 -3.4380854612300413 0.6965615832113001 +886 -0.2961775166926003 1.3204871191677252 -6.423441607226728 +828 -5.723804354158924 -2.2689365841904983 2.5260940343682323 +887 0.8430831533311819 -13.339077650133666 15.172508195501921 +826 -4.448639032696121 -0.8915914080568843 2.3567943259561948 +827 1.718412324889533 -14.893863590144628 14.797129976414348 +894 -6.427973685028659 -12.558615271775233 -7.485451456789206 +925 8.402235075352133 3.407952177949016 -3.5053149045150525 +858 -6.427819874217524 -13.261042052865486 -2.844099672535822 +878 4.549175257644374 -9.190685290399665 7.233790964076811 +812 1.6130765364411193 6.523491914724538 -2.1666788533706773 +927 5.411595894339899 18.95778556645519 0.4163503598847362 +888 6.673800249844219 -4.147769988251276 11.562868346675096 +877 0.7642590168406848 -0.42640846170725205 -0.24362676533615443 +835 4.762512418319816 4.257619894363519 -2.633248633741173 +811 2.94897877928045 1.1358222911198308 3.501491126078737 +837 -25.574582055486644 8.173269863077355 -15.333432600063208 +579 0 0 0 +580 0 0 0 +583 0 0 0 +584 0 0 0 +587 0 0 0 +588 0 0 0 +591 0 0 0 +592 0 0 0 +596 0 0 0 +649 0 0 0 +650 0 0 0 +651 0 0 0 +653 0 0 0 +654 0 0 0 +655 0 0 0 +657 0 0 0 +658 0 0 0 +659 0 0 0 +661 0 0 0 +662 0 0 0 +663 0 0 0 +665 0 0 0 +864 18.10875991489158 -1.221818047957972 14.493518869719745 +885 -3.50759902491298 9.459430974379575 4.647666016780896 +891 1.2937876234992576 -13.218582770473045 1.8043374968280674 +905 -4.091578474774505 3.159726887798095 -1.8642051540811495 +847 13.821135507553436 3.78277650099749 -0.8935962180188131 +807 -2.855822557363695 -1.3802914256701821 1.3207757685673218 +842 -3.5610017924774 20.399114965452245 -9.059382158173541 +806 -4.05498634870798 -0.7854363713825808 -8.046995507898338 +841 2.77935600657832 0.33087027354111276 -3.276950737363777 +848 14.223073217510889 7.872740511148931 10.887767283489458 +805 -1.6775622324299977 -2.2096661714145456 4.5967537734138295 +862 5.242654019377736 5.918079707262924 -8.884230198450263 +808 -3.696957383720496 1.0048882207315841 -0.5768482173888145 +863 -1.8703493217333826 5.862886335539861 9.68692462574889 +906 18.26182603645302 7.175694562498453 -2.7522051758285015 +803 3.2862566934744275 -9.793076664879903 3.0089122195092575 +820 -6.318316424453873 -6.3876103453941235 -3.8277653578536937 +813 2.860647424855888 1.4990458438578118 3.0590515326924304 +830 17.528802909679435 -19.339237046941598 -20.741951943235076 +809 -1.7667991174728181 2.556579099847797 -3.7133211964009396 +849 -1.1901850692743416 -8.440379804790025 -1.6424701640814479 +814 1.1332861799827034 0.6093309476680691 1.6239157816953607 +816 8.576684394424559 3.76294659470765 3.1067139692854044 +933 3.343313506115779 -12.788319535305213 0.4254781025251201 +932 1.2123994730269427 3.3154650357069606 -3.334409286644367 +802 3.413872469336105 -1.1546266031788768 -7.788063759324826 +931 -1.4494894135693275 -0.007254181008071915 -2.3332218927708426 +907 -5.153001723767468 0.1363135393043927 2.075664750863472 +831 -10.004566446956199 14.6294729429816 -0.9646159688100753 +804 -7.991671584288851 -7.475452917857694 -23.323610756314213 +904 -7.100120239541285 -0.3942667752088697 1.4081501423590068 +829 1.9015007439507077 5.283166213121213 -5.6785558614538445 +890 -19.32307212346698 3.2014322404638675 -4.971981839089952 +919 -2.338652775866846 -1.6192256874434943 3.5872094229145635 +908 -4.506448801038724 7.6944348035494805 10.147202763194022 +800 0.525815621025557 0.8800480170316483 -0.20140766169559945 +859 -3.7638632187225913 -1.3301900297863984 -1.6857540996503018 +861 -1.300800867558945 -21.968770646198 -11.380968378191717 +889 -0.13291154686447318 0.408222226270759 0.5188896950022159 +860 2.8418653167563583 -10.860696318995991 -7.274081987407397 +822 18.555841947164804 1.3488795446530215 -2.57263197376979 +821 2.5914509962410404 6.1128885622856535 -6.891713022600967 +595 0 0 0 +599 0 0 0 +600 0 0 0 +603 0 0 0 +604 0 0 0 +607 0 0 0 +608 0 0 0 +611 0 0 0 +612 0 0 0 +666 0 0 0 +667 0 0 0 +669 0 0 0 +670 0 0 0 +671 0 0 0 +673 0 0 0 +674 0 0 0 +675 0 0 0 +677 0 0 0 +678 0 0 0 +679 0 0 0 +681 0 0 0 +682 0 0 0 +683 0 0 0 +615 0 0 0 +616 0 0 0 +619 0 0 0 +620 0 0 0 +623 0 0 0 +624 0 0 0 +627 0 0 0 +628 0 0 0 +632 0 0 0 +685 0 0 0 +686 0 0 0 +687 0 0 0 +689 0 0 0 +690 0 0 0 +691 0 0 0 +693 0 0 0 +694 0 0 0 +695 0 0 0 +697 0 0 0 +698 0 0 0 +699 0 0 0 +701 0 0 0 +631 0 0 0 +635 0 0 0 +636 0 0 0 +639 0 0 0 +640 0 0 0 +643 0 0 0 +644 0 0 0 +647 0 0 0 +648 0 0 0 +702 0 0 0 +703 0 0 0 +705 0 0 0 +706 0 0 0 +707 0 0 0 +709 0 0 0 +710 0 0 0 +711 0 0 0 +713 0 0 0 +714 0 0 0 +715 0 0 0 +717 0 0 0 +718 0 0 0 +719 0 0 0 +801 6.3791360737229175 -0.06294951897585185 6.275276534287049 +852 9.533204722301026 3.635358487275625 11.325241984676676 +876 -7.5288457960325195 10.343955685749071 9.174112903806698 +851 11.324630200416946 -5.3841269941632195 -4.331280522070834 +836 -18.948267184095485 3.059583577066092 -13.205211938026421 +874 0.11331962980175045 -2.6443097750575877 1.3904229166613291 +875 5.578453451251161 -1.707571521972893 -5.365721983984957 +850 3.508833846356138 -4.177464350024476 -2.929550119627118 +920 9.735651740617827 11.172654877683243 -1.520392490494708 +921 2.634342633192178 -7.473941525247307 -10.3819677968746 +799 2.480261876941381 2.6479286070540775 2.8757710276609134 +652 0 0 0 +656 0 0 0 +660 0 0 0 +664 0 0 0 +668 0 0 0 +721 0 0 0 +722 0 0 0 +723 0 0 0 +724 0 0 0 +725 0 0 0 +726 0 0 0 +727 0 0 0 +728 0 0 0 +729 0 0 0 +730 0 0 0 +731 0 0 0 +732 0 0 0 +733 0 0 0 +734 0 0 0 +735 0 0 0 +736 0 0 0 +737 0 0 0 +740 0 0 0 +855 -4.983418977664709 7.316762475632069 -4.804677515261691 +853 -0.9889242911612474 4.9363545378208835 -3.893215427287619 +924 24.809030366392236 12.938030894027968 -7.929148423342626 +796 -2.042486989230798 -1.6716889696169193 4.818040886059996 +902 -12.24631912078176 -9.296091792191639 -5.933828252367176 +903 14.861767381200762 0.646302630400826 8.128909247439392 +898 -2.268970865642067 0.19593504253976693 -1.7002095325194038 +797 13.389488449540423 1.304501878497851 -5.024765837418713 +798 -4.04938216085792 -15.534814466192707 11.193556197029825 +810 -3.4873315530660745 -26.291881956134898 -3.7360180315706857 +854 -0.050097723565420214 1.1979024312153128 9.895624196355202 +923 -20.553020845996645 -9.899327350049255 -9.819708647345967 +922 4.523293437546675 5.218998274954441 -4.49072202518129 +900 7.633861074709448 -2.2307704025903523 4.296521673635092 +899 -19.369173009793435 5.968253817215517 -16.94178229768782 +901 3.1298945853524573 1.0199579971809891 5.836464708883643 +815 12.880886365907195 -2.18582234580474 10.172206114924288 +843 3.8805061810272847 -6.900108272859447 -7.842804013717792 +672 0 0 0 +676 0 0 0 +680 0 0 0 +684 0 0 0 +738 0 0 0 +739 0 0 0 +741 0 0 0 +742 0 0 0 +743 0 0 0 +744 0 0 0 +745 0 0 0 +746 0 0 0 +747 0 0 0 +748 0 0 0 +749 0 0 0 +750 0 0 0 +751 0 0 0 +752 0 0 0 +753 0 0 0 +754 0 0 0 +755 0 0 0 +756 0 0 0 +688 0 0 0 +692 0 0 0 +696 0 0 0 +700 0 0 0 +704 0 0 0 +757 0 0 0 +758 0 0 0 +759 0 0 0 +760 0 0 0 +761 0 0 0 +762 0 0 0 +763 0 0 0 +764 0 0 0 +765 0 0 0 +766 0 0 0 +767 0 0 0 +768 0 0 0 +769 0 0 0 +770 0 0 0 +771 0 0 0 +772 0 0 0 +773 0 0 0 +776 0 0 0 +708 0 0 0 +712 0 0 0 +716 0 0 0 +720 0 0 0 +774 0 0 0 +775 0 0 0 +777 0 0 0 +778 0 0 0 +779 0 0 0 +780 0 0 0 +781 0 0 0 +782 0 0 0 +783 0 0 0 +784 0 0 0 +785 0 0 0 +786 0 0 0 +787 0 0 0 +788 0 0 0 +789 0 0 0 +790 0 0 0 +791 0 0 0 +792 0 0 0 +871 3.8388411617482983 2.1415774247586086 2.2282258014613365 +910 7.602860298670014 2.6393823107390926 0.5414737324680828 +873 20.507332409943604 5.51145846781714 8.496326839610182 +912 -3.629349712693535 23.337951853868613 -32.58198418026529 +872 4.080216979227207 -18.995820981792978 -6.328839221258122 +869 25.409329042660474 4.159096283589856 8.003159128696433 +868 -6.119380276761435 0.9901059131840709 -6.330598686020231 +870 -10.78856535095556 -17.561195466544348 -21.63165476286472 +911 14.291030359419361 -16.1359695519986 6.557863766321599 + +Bonds + +1 1 880 881 +2 1 880 882 +3 1 823 824 +4 1 823 825 +5 1 838 839 +6 1 838 840 +7 1 895 896 +8 1 895 897 +9 1 913 914 +10 1 913 915 +11 1 916 917 +12 1 916 918 +13 1 817 818 +14 1 817 819 +15 1 934 935 +16 1 934 936 +17 1 844 845 +18 1 844 846 +19 1 865 866 +20 1 865 867 +21 1 928 929 +22 1 928 930 +23 1 832 833 +24 1 832 834 +25 1 793 794 +26 1 793 795 +27 1 883 884 +28 1 883 885 +29 1 856 857 +30 1 856 858 +31 1 892 893 +32 1 892 894 +33 1 886 887 +34 1 886 888 +35 1 826 827 +36 1 826 828 +37 1 925 926 +38 1 925 927 +39 1 877 878 +40 1 877 879 +41 1 835 836 +42 1 835 837 +43 1 811 812 +44 1 811 813 +45 1 847 848 +46 1 847 849 +47 1 841 842 +48 1 841 843 +49 1 805 806 +50 1 805 807 +51 1 862 863 +52 1 862 864 +53 1 808 809 +54 1 808 810 +55 1 820 821 +56 1 820 822 +57 1 814 815 +58 1 814 816 +59 1 802 803 +60 1 802 804 +61 1 931 932 +62 1 931 933 +63 1 907 908 +64 1 907 909 +65 1 904 905 +66 1 904 906 +67 1 829 830 +68 1 829 831 +69 1 919 920 +70 1 919 921 +71 1 859 860 +72 1 859 861 +73 1 889 890 +74 1 889 891 +75 1 874 875 +76 1 874 876 +77 1 850 851 +78 1 850 852 +79 1 799 800 +80 1 799 801 +81 1 853 854 +82 1 853 855 +83 1 796 797 +84 1 796 798 +85 1 898 899 +86 1 898 900 +87 1 922 923 +88 1 922 924 +89 1 901 902 +90 1 901 903 +91 1 871 872 +92 1 871 873 +93 1 910 911 +94 1 910 912 +95 1 868 869 +96 1 868 870 + +Angles + +1 1 881 880 882 +2 1 824 823 825 +3 1 839 838 840 +4 1 896 895 897 +5 1 914 913 915 +6 1 917 916 918 +7 1 818 817 819 +8 1 935 934 936 +9 1 845 844 846 +10 1 866 865 867 +11 1 929 928 930 +12 1 833 832 834 +13 1 794 793 795 +14 1 884 883 885 +15 1 857 856 858 +16 1 893 892 894 +17 1 887 886 888 +18 1 827 826 828 +19 1 926 925 927 +20 1 878 877 879 +21 1 836 835 837 +22 1 812 811 813 +23 1 848 847 849 +24 1 842 841 843 +25 1 806 805 807 +26 1 863 862 864 +27 1 809 808 810 +28 1 821 820 822 +29 1 815 814 816 +30 1 803 802 804 +31 1 932 931 933 +32 1 908 907 909 +33 1 905 904 906 +34 1 830 829 831 +35 1 920 919 921 +36 1 860 859 861 +37 1 890 889 891 +38 1 875 874 876 +39 1 851 850 852 +40 1 800 799 801 +41 1 854 853 855 +42 1 797 796 798 +43 1 899 898 900 +44 1 923 922 924 +45 1 902 901 903 +46 1 872 871 873 +47 1 911 910 912 +48 1 869 868 870 diff --git a/examples/PACKAGES/interlayer/ilp_water_2dm/in.gr_water b/examples/PACKAGES/interlayer/ilp_water_2dm/in.gr_water new file mode 100644 index 0000000000..9fccbf733b --- /dev/null +++ b/examples/PACKAGES/interlayer/ilp_water_2dm/in.gr_water @@ -0,0 +1,51 @@ +# Initialization +units metal +boundary p p p +atom_style full +processors * * 1 # domain decomposition over x and y +read_data ./gra_water.data +mass 1 12.0107 # carbon mass (g/mole) +mass 2 15.9994 # oxygen mass (g/mole) +mass 3 1.008 # hydrogen mass (g/mole) +# Separate atom groups +group gr molecule 1 +group water molecule 2 +######################## Potential defition ############################## +# Interlayer potential +pair_style hybrid/overlay ilp/water/2dm 16.0 lj/cut/tip4p/long 2 3 1 1 0.1546 10 8.5 +#################################################################### +pair_coeff 1 1 none +pair_coeff 2 2 lj/cut/tip4p/long 8.0313e-3 3.1589 # O-O +pair_coeff 2 3 lj/cut/tip4p/long 0.0 0.0 # O-H +pair_coeff 3 3 lj/cut/tip4p/long 0.0 0.0 # H-H +pair_coeff * * ilp/water/2dm COH.ILP C Ow Hw # C-water +# bond and angle +bond_style harmonic +bond_coeff 1 0.0 0.9572 +angle_style harmonic +angle_coeff 1 0.0 104.52 +# define kspace calculation +kspace_style pppm/tip4p 1E-5 +# Neighbor update settings +neighbor 2.0 bin +neigh_modify every 1 delay 5 check yes page 1000000 one 100000 +#################################################################### +# Calculate pair energy +compute 1 all pair lj/cut/tip4p/long +compute 2 all pair ilp/water/2dm +compute wt water temp +variable TIP4P equal c_1 +variable EILP equal c_2 # total interlayer energy +variable temp_wt equal c_wt +############# Output ############## +thermo_style custom step etotal pe ke v_TIP4P v_EILP v_temp_wt +thermo 100 +thermo_modify lost error + +fix subf gr setforce 0.0 0.0 0.0 +fix 1 water shake 0.0001 20 100 b 1 a 1 + +timestep 1e-3 +velocity water create 300.0 12345 dist gaussian mom yes rot yes +fix 2 water nve +run 1000 diff --git a/examples/PACKAGES/interlayer/ilp_water_2dm/in.gr_water.opt b/examples/PACKAGES/interlayer/ilp_water_2dm/in.gr_water.opt new file mode 100644 index 0000000000..1b38ab6e6e --- /dev/null +++ b/examples/PACKAGES/interlayer/ilp_water_2dm/in.gr_water.opt @@ -0,0 +1,51 @@ +# Initialization +units metal +boundary p p p +atom_style full +processors * * 1 # domain decomposition over x and y +read_data ./gra_water.data +mass 1 12.0107 # carbon mass (g/mole) +mass 2 15.9994 # oxygen mass (g/mole) +mass 3 1.008 # hydrogen mass (g/mole) +# Separate atom groups +group gr molecule 1 +group water molecule 2 +######################## Potential defition ############################## +# Interlayer potential +pair_style hybrid/overlay ilp/water/2dm/opt 16.0 lj/cut/tip4p/long 2 3 1 1 0.1546 10 8.5 +#################################################################### +pair_coeff 1 1 none +pair_coeff 2 2 lj/cut/tip4p/long 8.0313e-3 3.1589 # O-O +pair_coeff 2 3 lj/cut/tip4p/long 0.0 0.0 # O-H +pair_coeff 3 3 lj/cut/tip4p/long 0.0 0.0 # H-H +pair_coeff * * ilp/water/2dm/opt COH.ILP C Ow Hw # C-water +# bond and angle +bond_style harmonic +bond_coeff 1 0.0 0.9572 +angle_style harmonic +angle_coeff 1 0.0 104.52 +# define kspace calculation +kspace_style pppm/tip4p 1E-5 +# Neighbor update settings +neighbor 2.0 bin +neigh_modify every 1 delay 5 check yes page 1000000 one 100000 +#################################################################### +# Calculate pair energy +compute 1 all pair lj/cut/tip4p/long +compute 2 all pair ilp/water/2dm/opt +compute wt water temp +variable TIP4P equal c_1 +variable EILP equal c_2 # total interlayer energy +variable temp_wt equal c_wt +############# Output ############## +thermo_style custom step etotal pe ke v_TIP4P v_EILP v_temp_wt +thermo 100 +thermo_modify lost error + +fix subf gr setforce 0.0 0.0 0.0 +fix 1 water shake 0.0001 20 100 b 1 a 1 + +timestep 1e-3 +velocity water create 300.0 12345 dist gaussian mom yes rot yes +fix 2 water nve +run 1000 diff --git a/examples/PACKAGES/interlayer/ilp_water_2dm/log.18May23.water.g++.1 b/examples/PACKAGES/interlayer/ilp_water_2dm/log.18May23.water.g++.1 new file mode 100644 index 0000000000..6e13280f70 --- /dev/null +++ b/examples/PACKAGES/interlayer/ilp_water_2dm/log.18May23.water.g++.1 @@ -0,0 +1,234 @@ +LAMMPS (23 Jun 2022) +OMP_NUM_THREADS environment is not set. Defaulting to 1 thread. (../comm.cpp:98) + using 1 OpenMP thread(s) per MPI task +# Initialization +units metal +boundary p p p +atom_style full +processors * * 1 # domain decomposition over x and y +read_data ./gra_water.data +Reading data file ... + orthogonal box = (0 0 0) to (46.92336 44.331078 200) + 1 by 1 by 1 MPI processor grid + reading atoms ... + 936 atoms + reading velocities ... + 936 velocities + scanning bonds ... + 2 = max bonds/atom + scanning angles ... + 1 = max angles/atom + reading bonds ... + 96 bonds + reading angles ... + 48 angles +Finding 1-2 1-3 1-4 neighbors ... + special bond factors lj: 0 0 0 + special bond factors coul: 0 0 0 + 2 = max # of 1-2 neighbors + 1 = max # of 1-3 neighbors + 1 = max # of 1-4 neighbors + 2 = max # of special neighbors + special bonds CPU = 0.005 seconds + read_data CPU = 0.020 seconds +mass 1 12.0107 # carbon mass (g/mole) +mass 2 15.9994 # oxygen mass (g/mole) +mass 3 1.008 # hydrogen mass (g/mole) +# Separate atom groups +group gr molecule 1 +792 atoms in group gr +group water molecule 2 +144 atoms in group water +######################## Potential defition ############################## +# Interlayer potential +pair_style hybrid/overlay ilp/water/2dm 16.0 lj/cut/tip4p/long 2 3 1 1 0.1546 10 8.5 +#################################################################### +pair_coeff 1 1 none +pair_coeff 2 2 lj/cut/tip4p/long 8.0313e-3 3.1589 # O-O +pair_coeff 2 3 lj/cut/tip4p/long 0.0 0.0 # O-H +pair_coeff 3 3 lj/cut/tip4p/long 0.0 0.0 # H-H +pair_coeff * * ilp/water/2dm COH.ILP C Ow Hw # C-water +Reading ilp/water/2dm potential file COH.ILP with DATE: 2023-05-17 +# bond and angle +bond_style harmonic +bond_coeff 1 0.0 0.9572 +angle_style harmonic +angle_coeff 1 0.0 104.52 +# define kspace calculation +kspace_style pppm/tip4p 1E-5 +# Neighbor update settings +neighbor 2.0 bin +neigh_modify every 1 delay 5 check yes page 1000000 one 100000 +#################################################################### +# Calculate pair energy +compute 1 all pair lj/cut/tip4p/long +compute 2 all pair ilp/water/2dm +compute wt water temp +variable TIP4P equal c_1 +variable EILP equal c_2 # total interlayer energy +variable temp_wt equal c_wt +############# Output ############## +thermo_style custom step etotal pe ke v_TIP4P v_EILP v_temp_wt +thermo 100 +thermo_modify lost error + +fix subf gr setforce 0.0 0.0 0.0 +fix 1 water shake 0.0001 20 100 b 1 a 1 + 0 = # of size 2 clusters + 0 = # of size 3 clusters + 0 = # of size 4 clusters + 48 = # of frozen angles + find clusters CPU = 0.001 seconds + +timestep 1e-3 +velocity water create 300.0 12345 dist gaussian mom yes rot yes +fix 2 water nve +run 1000 + +CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE + +Your simulation uses code contributions which should be cited: + +- ilp/graphene/hbn potential doi:10.1021/acs.nanolett.8b02848 +@Article{Ouyang2018 + author = {W. Ouyang, D. Mandelli, M. Urbakh, and O. Hod}, + title = {Nanoserpents: Graphene Nanoribbon Motion on Two-Dimensional Hexagonal Materials}, + journal = {Nano Letters}, + volume = 18, + pages = {6009} + year = 2018, +} + +- ilp/tmd potential doi/10.1021/acs.jctc.1c00782 +@Article{Ouyang2021 + author = {W. Ouyang, R. Sofer, X. Gao, J. Hermann, A. Tkatchenko, L. Kronik, M. Urbakh, and O. Hod}, + title = {Anisotropic Interlayer Force Field for Transition Metal Dichalcogenides: The Case of Molybdenum Disulfide}, + journal = {J. Chem. Theory Comput.}, + volume = 17, + pages = {7237–7245} + year = 2021, +} + +- ilp/water/2dm potential doi/10.1021/acs.jpcc.2c08464 +@Article{Feng2023 + author = {Z. Feng, Y. Yao, J. Liu, B. Wu, Z. Liu, and W. Ouyang}, + title = {Registry-Dependent Potential for Interfaces of Water with Graphene}, + journal = {J. Phys. Chem. C}, + volume = 127, + pages = {8704-8713} + year = 2023, +} + +CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE + +PPPM initialization ... + extracting TIP4P info from pair style + using 12-bit tables for long-range coulomb (../kspace.cpp:342) + G vector (1/distance) = 0.28684806 + grid = 25 24 80 + stencil order = 5 + estimated absolute RMS force accuracy = 0.0001640931 + estimated relative force accuracy = 1.1395635e-05 + using single precision MKL FFT + 3d grid and FFT values/proc = 84320 48000 +WARNING: Using a manybody potential with bonds/angles/dihedrals and special_bond exclusions (../pair.cpp:239) +Neighbor list info ... + update every 1 steps, delay 5 steps, check yes + max neighbors/atom: 100000, page size: 1000000 + master list distance cutoff = 18 + ghost atom cutoff = 18 + binsize = 9, bins = 6 5 23 + 3 neighbor lists, perpetual/occasional/extra = 3 0 0 + (1) pair ilp/water/2dm, perpetual + attributes: full, newton on, ghost + pair build: full/bin/ghost + stencil: full/ghost/bin/3d + bin: standard + (2) pair lj/cut/tip4p/long, perpetual, skip from (3) + attributes: half, newton on + pair build: skip + stencil: none + bin: none + (3) neighbor class addition, perpetual + attributes: half, newton on + pair build: half/bin/newton + stencil: half/bin/3d + bin: standard +SHAKE stats (type/ave/delta/count) on step 0 +Bond: 1 0.957201 2.19705e-06 96 +Angle: 1 104.52 0.000203056 48 +Per MPI rank memory allocation (min/avg/max) = 33.53 | 33.53 | 33.53 Mbytes + Step TotEng PotEng KinEng v_TIP4P v_EILP v_temp_wt + 0 -16.131263 -19.815178 3.6839141 189.37246 -1.903543 300 +SHAKE stats (type/ave/delta/count) on step 100 +Bond: 1 0.9572 9.54949e-07 96 +Angle: 1 104.52 6.01522e-05 48 + 100 -17.494868 -20.796993 3.3021253 188.4955 -1.8981262 268.90898 +SHAKE stats (type/ave/delta/count) on step 200 +Bond: 1 0.9572 9.63922e-07 96 +Angle: 1 104.52 7.7021e-05 48 + 200 -17.486271 -21.194892 3.7086213 188.14561 -1.9871708 302.01203 +SHAKE stats (type/ave/delta/count) on step 300 +Bond: 1 0.9572 1.4264e-06 96 +Angle: 1 104.52 6.48393e-05 48 + 300 -17.502844 -20.993704 3.49086 188.23268 -1.8457229 284.27861 +SHAKE stats (type/ave/delta/count) on step 400 +Bond: 1 0.9572 1.33728e-06 96 +Angle: 1 104.52 7.6239e-05 48 + 400 -17.495287 -20.828353 3.3330658 188.48002 -1.8429075 271.42862 +SHAKE stats (type/ave/delta/count) on step 500 +Bond: 1 0.9572 1.14685e-06 96 +Angle: 1 104.52 8.58621e-05 48 + 500 -17.491435 -20.443044 2.9516084 188.7589 -1.8566335 240.36459 +SHAKE stats (type/ave/delta/count) on step 600 +Bond: 1 0.9572 9.17601e-07 96 +Angle: 1 104.52 8.24516e-05 48 + 600 -17.505684 -20.608457 3.1027731 188.72078 -1.9560796 252.67471 +SHAKE stats (type/ave/delta/count) on step 700 +Bond: 1 0.9572 9.50422e-07 96 +Angle: 1 104.52 5.62423e-05 48 + 700 -17.496703 -21.072663 3.5759596 188.2777 -1.9833956 291.20871 +SHAKE stats (type/ave/delta/count) on step 800 +Bond: 1 0.9572 1.15262e-06 96 +Angle: 1 104.52 7.02157e-05 48 + 800 -17.478623 -20.819504 3.3408809 188.37868 -1.9112996 272.06505 +SHAKE stats (type/ave/delta/count) on step 900 +Bond: 1 0.9572 9.14138e-07 96 +Angle: 1 104.52 6.98742e-05 48 + 900 -17.48086 -20.728495 3.2476349 188.59022 -1.8922102 264.47155 +SHAKE stats (type/ave/delta/count) on step 1000 +Bond: 1 0.9572 1.00586e-06 96 +Angle: 1 104.52 0.000111712 48 + 1000 -17.498465 -20.331545 2.8330804 188.87473 -1.812177 230.71225 +Loop time of 20.801 on 1 procs for 1000 steps with 936 atoms + +Performance: 4.154 ns/day, 5.778 hours/ns, 48.075 timesteps/s +99.9% CPU use with 1 MPI tasks x 1 OpenMP threads + +MPI task timing breakdown: +Section | min time | avg time | max time |%varavg| %total +--------------------------------------------------------------- +Pair | 16.429 | 16.429 | 16.429 | 0.0 | 78.98 +Bond | 0.0010991 | 0.0010991 | 0.0010991 | 0.0 | 0.01 +Kspace | 3.4769 | 3.4769 | 3.4769 | 0.0 | 16.72 +Neigh | 0.83359 | 0.83359 | 0.83359 | 0.0 | 4.01 +Comm | 0.028825 | 0.028825 | 0.028825 | 0.0 | 0.14 +Output | 0.00046349 | 0.00046349 | 0.00046349 | 0.0 | 0.00 +Modify | 0.01943 | 0.01943 | 0.01943 | 0.0 | 0.09 +Other | | 0.01154 | | | 0.06 + +Nlocal: 936 ave 936 max 936 min +Histogram: 1 0 0 0 0 0 0 0 0 0 +Nghost: 5242 ave 5242 max 5242 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: 431382 ave 431382 max 431382 min +Histogram: 1 0 0 0 0 0 0 0 0 0 + +Total # of neighbors = 431382 +Ave neighs/atom = 460.87821 +Ave special neighs/atom = 0.30769231 +Neighbor list builds = 28 +Dangerous builds = 0 +Total wall time: 0:00:21 diff --git a/examples/PACKAGES/interlayer/ilp_water_2dm/log.18May23.water.g++.4 b/examples/PACKAGES/interlayer/ilp_water_2dm/log.18May23.water.g++.4 new file mode 100644 index 0000000000..078ca76e2e --- /dev/null +++ b/examples/PACKAGES/interlayer/ilp_water_2dm/log.18May23.water.g++.4 @@ -0,0 +1,234 @@ +LAMMPS (23 Jun 2022) +OMP_NUM_THREADS environment is not set. Defaulting to 1 thread. (../comm.cpp:98) + using 1 OpenMP thread(s) per MPI task +# Initialization +units metal +boundary p p p +atom_style full +processors * * 1 # domain decomposition over x and y +read_data ./gra_water.data +Reading data file ... + orthogonal box = (0 0 0) to (46.92336 44.331078 200) + 2 by 2 by 1 MPI processor grid + reading atoms ... + 936 atoms + reading velocities ... + 936 velocities + scanning bonds ... + 2 = max bonds/atom + scanning angles ... + 1 = max angles/atom + reading bonds ... + 96 bonds + reading angles ... + 48 angles +Finding 1-2 1-3 1-4 neighbors ... + special bond factors lj: 0 0 0 + special bond factors coul: 0 0 0 + 2 = max # of 1-2 neighbors + 1 = max # of 1-3 neighbors + 1 = max # of 1-4 neighbors + 2 = max # of special neighbors + special bonds CPU = 0.003 seconds + read_data CPU = 0.018 seconds +mass 1 12.0107 # carbon mass (g/mole) +mass 2 15.9994 # oxygen mass (g/mole) +mass 3 1.008 # hydrogen mass (g/mole) +# Separate atom groups +group gr molecule 1 +792 atoms in group gr +group water molecule 2 +144 atoms in group water +######################## Potential defition ############################## +# Interlayer potential +pair_style hybrid/overlay ilp/water/2dm 16.0 lj/cut/tip4p/long 2 3 1 1 0.1546 10 8.5 +#################################################################### +pair_coeff 1 1 none +pair_coeff 2 2 lj/cut/tip4p/long 8.0313e-3 3.1589 # O-O +pair_coeff 2 3 lj/cut/tip4p/long 0.0 0.0 # O-H +pair_coeff 3 3 lj/cut/tip4p/long 0.0 0.0 # H-H +pair_coeff * * ilp/water/2dm COH.ILP C Ow Hw # C-water +Reading ilp/water/2dm potential file COH.ILP with DATE: 2023-05-17 +# bond and angle +bond_style harmonic +bond_coeff 1 0.0 0.9572 +angle_style harmonic +angle_coeff 1 0.0 104.52 +# define kspace calculation +kspace_style pppm/tip4p 1E-5 +# Neighbor update settings +neighbor 2.0 bin +neigh_modify every 1 delay 5 check yes page 1000000 one 100000 +#################################################################### +# Calculate pair energy +compute 1 all pair lj/cut/tip4p/long +compute 2 all pair ilp/water/2dm +compute wt water temp +variable TIP4P equal c_1 +variable EILP equal c_2 # total interlayer energy +variable temp_wt equal c_wt +############# Output ############## +thermo_style custom step etotal pe ke v_TIP4P v_EILP v_temp_wt +thermo 100 +thermo_modify lost error + +fix subf gr setforce 0.0 0.0 0.0 +fix 1 water shake 0.0001 20 100 b 1 a 1 + 0 = # of size 2 clusters + 0 = # of size 3 clusters + 0 = # of size 4 clusters + 48 = # of frozen angles + find clusters CPU = 0.001 seconds + +timestep 1e-3 +velocity water create 300.0 12345 dist gaussian mom yes rot yes +fix 2 water nve +run 1000 + +CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE + +Your simulation uses code contributions which should be cited: + +- ilp/graphene/hbn potential doi:10.1021/acs.nanolett.8b02848 +@Article{Ouyang2018 + author = {W. Ouyang, D. Mandelli, M. Urbakh, and O. Hod}, + title = {Nanoserpents: Graphene Nanoribbon Motion on Two-Dimensional Hexagonal Materials}, + journal = {Nano Letters}, + volume = 18, + pages = {6009} + year = 2018, +} + +- ilp/tmd potential doi/10.1021/acs.jctc.1c00782 +@Article{Ouyang2021 + author = {W. Ouyang, R. Sofer, X. Gao, J. Hermann, A. Tkatchenko, L. Kronik, M. Urbakh, and O. Hod}, + title = {Anisotropic Interlayer Force Field for Transition Metal Dichalcogenides: The Case of Molybdenum Disulfide}, + journal = {J. Chem. Theory Comput.}, + volume = 17, + pages = {7237–7245} + year = 2021, +} + +- ilp/water/2dm potential doi/10.1021/acs.jpcc.2c08464 +@Article{Feng2023 + author = {Z. Feng, Y. Yao, J. Liu, B. Wu, Z. Liu, and W. Ouyang}, + title = {Registry-Dependent Potential for Interfaces of Water with Graphene}, + journal = {J. Phys. Chem. C}, + volume = 127, + pages = {8704-8713} + year = 2023, +} + +CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE + +PPPM initialization ... + extracting TIP4P info from pair style + using 12-bit tables for long-range coulomb (../kspace.cpp:342) + G vector (1/distance) = 0.28684806 + grid = 25 24 80 + stencil order = 5 + estimated absolute RMS force accuracy = 0.0001640931 + estimated relative force accuracy = 1.1395635e-05 + using single precision MKL FFT + 3d grid and FFT values/proc = 30685 12480 +WARNING: Using a manybody potential with bonds/angles/dihedrals and special_bond exclusions (../pair.cpp:239) +Neighbor list info ... + update every 1 steps, delay 5 steps, check yes + max neighbors/atom: 100000, page size: 1000000 + master list distance cutoff = 18 + ghost atom cutoff = 18 + binsize = 9, bins = 6 5 23 + 3 neighbor lists, perpetual/occasional/extra = 3 0 0 + (1) pair ilp/water/2dm, perpetual + attributes: full, newton on, ghost + pair build: full/bin/ghost + stencil: full/ghost/bin/3d + bin: standard + (2) pair lj/cut/tip4p/long, perpetual, skip from (3) + attributes: half, newton on + pair build: skip + stencil: none + bin: none + (3) neighbor class addition, perpetual + attributes: half, newton on + pair build: half/bin/newton + stencil: half/bin/3d + bin: standard +SHAKE stats (type/ave/delta/count) on step 0 +Bond: 1 0.957201 2.19705e-06 96 +Angle: 1 104.52 0.000203056 48 +Per MPI rank memory allocation (min/avg/max) = 25.84 | 25.88 | 25.92 Mbytes + Step TotEng PotEng KinEng v_TIP4P v_EILP v_temp_wt + 0 -16.131263 -19.815178 3.6839141 189.37246 -1.903543 300 +SHAKE stats (type/ave/delta/count) on step 100 +Bond: 1 0.9572 9.54949e-07 96 +Angle: 1 104.52 6.01522e-05 48 + 100 -17.494869 -20.796995 3.3021253 188.4955 -1.8981262 268.90898 +SHAKE stats (type/ave/delta/count) on step 200 +Bond: 1 0.9572 9.63922e-07 96 +Angle: 1 104.52 7.7021e-05 48 + 200 -17.48627 -21.194892 3.7086213 188.14561 -1.9871708 302.01203 +SHAKE stats (type/ave/delta/count) on step 300 +Bond: 1 0.9572 1.4264e-06 96 +Angle: 1 104.52 6.48393e-05 48 + 300 -17.502843 -20.993703 3.4908599 188.23268 -1.8457229 284.27861 +SHAKE stats (type/ave/delta/count) on step 400 +Bond: 1 0.9572 1.33728e-06 96 +Angle: 1 104.52 7.6239e-05 48 + 400 -17.495285 -20.82835 3.333065 188.48003 -1.8429074 271.42856 +SHAKE stats (type/ave/delta/count) on step 500 +Bond: 1 0.9572 1.14685e-06 96 +Angle: 1 104.52 8.58621e-05 48 + 500 -17.491436 -20.443043 2.9516075 188.7589 -1.8566335 240.36452 +SHAKE stats (type/ave/delta/count) on step 600 +Bond: 1 0.9572 9.17601e-07 96 +Angle: 1 104.52 8.24517e-05 48 + 600 -17.505683 -20.608456 3.1027734 188.72078 -1.9560795 252.67474 +SHAKE stats (type/ave/delta/count) on step 700 +Bond: 1 0.9572 9.50425e-07 96 +Angle: 1 104.52 5.62422e-05 48 + 700 -17.496706 -21.072664 3.575958 188.2777 -1.9833951 291.20858 +SHAKE stats (type/ave/delta/count) on step 800 +Bond: 1 0.9572 1.15256e-06 96 +Angle: 1 104.52 7.02177e-05 48 + 800 -17.478628 -20.819507 3.340879 188.37868 -1.9113009 272.06489 +SHAKE stats (type/ave/delta/count) on step 900 +Bond: 1 0.9572 9.14163e-07 96 +Angle: 1 104.52 6.98849e-05 48 + 900 -17.480865 -20.728504 3.2476386 188.5902 -1.8922108 264.47185 +SHAKE stats (type/ave/delta/count) on step 1000 +Bond: 1 0.9572 1.00568e-06 96 +Angle: 1 104.52 0.000111707 48 + 1000 -17.498474 -20.331607 2.833133 188.87466 -1.8121689 230.71654 +Loop time of 9.42273 on 4 procs for 1000 steps with 936 atoms + +Performance: 9.169 ns/day, 2.617 hours/ns, 106.126 timesteps/s +97.1% CPU use with 4 MPI tasks x 1 OpenMP threads + +MPI task timing breakdown: +Section | min time | avg time | max time |%varavg| %total +--------------------------------------------------------------- +Pair | 2.2328 | 4.3228 | 7.5931 | 103.1 | 45.88 +Bond | 0.00084131 | 0.00088983 | 0.00095229 | 0.0 | 0.01 +Kspace | 1.3979 | 4.6476 | 6.7252 | 98.8 | 49.32 +Neigh | 0.34367 | 0.34371 | 0.34376 | 0.0 | 3.65 +Comm | 0.042806 | 0.062908 | 0.075887 | 5.4 | 0.67 +Output | 0.00037677 | 0.00041431 | 0.0004619 | 0.0 | 0.00 +Modify | 0.028432 | 0.031138 | 0.034528 | 1.3 | 0.33 +Other | | 0.01321 | | | 0.14 + +Nlocal: 234 ave 302 max 198 min +Histogram: 2 0 0 1 0 0 0 0 0 1 +Nghost: 2876.5 ave 3122 max 2632 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: 107846 ave 150684 max 82181 min +Histogram: 2 0 0 0 1 0 0 0 0 1 + +Total # of neighbors = 431382 +Ave neighs/atom = 460.87821 +Ave special neighs/atom = 0.30769231 +Neighbor list builds = 28 +Dangerous builds = 0 +Total wall time: 0:00:09 diff --git a/examples/PACKAGES/interlayer/ilp_water_2dm/log.18May23.water.opt.g++.1 b/examples/PACKAGES/interlayer/ilp_water_2dm/log.18May23.water.opt.g++.1 new file mode 100644 index 0000000000..c6a11d209d --- /dev/null +++ b/examples/PACKAGES/interlayer/ilp_water_2dm/log.18May23.water.opt.g++.1 @@ -0,0 +1,251 @@ +LAMMPS (23 Jun 2022) +OMP_NUM_THREADS environment is not set. Defaulting to 1 thread. (../comm.cpp:98) + using 1 OpenMP thread(s) per MPI task +# Initialization +units metal +boundary p p p +atom_style full +processors * * 1 # domain decomposition over x and y +read_data ./gra_water.data +Reading data file ... + orthogonal box = (0 0 0) to (46.92336 44.331078 200) + 1 by 1 by 1 MPI processor grid + reading atoms ... + 936 atoms + reading velocities ... + 936 velocities + scanning bonds ... + 2 = max bonds/atom + scanning angles ... + 1 = max angles/atom + reading bonds ... + 96 bonds + reading angles ... + 48 angles +Finding 1-2 1-3 1-4 neighbors ... + special bond factors lj: 0 0 0 + special bond factors coul: 0 0 0 + 2 = max # of 1-2 neighbors + 1 = max # of 1-3 neighbors + 1 = max # of 1-4 neighbors + 2 = max # of special neighbors + special bonds CPU = 0.005 seconds + read_data CPU = 0.020 seconds +mass 1 12.0107 # carbon mass (g/mole) +mass 2 15.9994 # oxygen mass (g/mole) +mass 3 1.008 # hydrogen mass (g/mole) +# Separate atom groups +group gr molecule 1 +792 atoms in group gr +group water molecule 2 +144 atoms in group water +######################## Potential defition ############################## +# Interlayer potential +pair_style hybrid/overlay ilp/water/2dm/opt 16.0 lj/cut/tip4p/long 2 3 1 1 0.1546 10 8.5 +#################################################################### +pair_coeff 1 1 none +pair_coeff 2 2 lj/cut/tip4p/long 8.0313e-3 3.1589 # O-O +pair_coeff 2 3 lj/cut/tip4p/long 0.0 0.0 # O-H +pair_coeff 3 3 lj/cut/tip4p/long 0.0 0.0 # H-H +pair_coeff * * ilp/water/2dm/opt COH.ILP C Ow Hw # C-water +Reading ilp/water/2dm potential file COH.ILP with DATE: 2023-05-17 +# bond and angle +bond_style harmonic +bond_coeff 1 0.0 0.9572 +angle_style harmonic +angle_coeff 1 0.0 104.52 +# define kspace calculation +kspace_style pppm/tip4p 1E-5 +# Neighbor update settings +neighbor 2.0 bin +neigh_modify every 1 delay 5 check yes page 1000000 one 100000 +#################################################################### +# Calculate pair energy +compute 1 all pair lj/cut/tip4p/long +compute 2 all pair ilp/water/2dm/opt +compute wt water temp +variable TIP4P equal c_1 +variable EILP equal c_2 # total interlayer energy +variable temp_wt equal c_wt +############# Output ############## +thermo_style custom step etotal pe ke v_TIP4P v_EILP v_temp_wt +thermo 100 +thermo_modify lost error + +fix subf gr setforce 0.0 0.0 0.0 +fix 1 water shake 0.0001 20 100 b 1 a 1 + 0 = # of size 2 clusters + 0 = # of size 3 clusters + 0 = # of size 4 clusters + 48 = # of frozen angles + find clusters CPU = 0.001 seconds + +timestep 1e-3 +velocity water create 300.0 12345 dist gaussian mom yes rot yes +fix 2 water nve +run 1000 + +CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE + +Your simulation uses code contributions which should be cited: + +- ilp/graphene/hbn potential doi:10.1021/acs.nanolett.8b02848 +@Article{Ouyang2018 + author = {W. Ouyang, D. Mandelli, M. Urbakh, and O. Hod}, + title = {Nanoserpents: Graphene Nanoribbon Motion on Two-Dimensional Hexagonal Materials}, + journal = {Nano Letters}, + volume = 18, + pages = {6009} + year = 2018, +} + +- ilp/tmd potential doi/10.1021/acs.jctc.1c00782 +@Article{Ouyang2021 + author = {W. Ouyang, R. Sofer, X. Gao, J. Hermann, A. Tkatchenko, L. Kronik, M. Urbakh, and O. Hod}, + title = {Anisotropic Interlayer Force Field for Transition Metal Dichalcogenides: The Case of Molybdenum Disulfide}, + journal = {J. Chem. Theory Comput.}, + volume = 17, + pages = {7237–7245} + year = 2021, +} + +- ilp/water/2dm potential doi/10.1021/acs.jpcc.2c08464 +@Article{Feng2023 + author = {Z. Feng, Y. Yao, J. Liu, B. Wu, Z. Liu, and W. Ouyang}, + title = {Registry-Dependent Potential for Interfaces of Water with Graphene}, + journal = {J. Phys. Chem. C}, + volume = 127, + pages = {8704-8713} + year = 2023, +} + +- ilp/graphene/hbn/opt potential doi:10.1145/3458817.3476137 +@inproceedings{gao2021lmff + author = {Gao, Ping and Duan, Xiaohui and Others}, + title = {LMFF: Efficient and Scalable Layered Materials Force Field on Heterogeneous Many-Core Processors}, + year = {2021}, + isbn = {9781450384421}, + publisher = {Association for Computing Machinery}, + address = {New York, NY, USA}, + url = {https://doi.org/10.1145/3458817.3476137}, + doi = {10.1145/3458817.3476137}, + booktitle = {Proceedings of the International Conference for High Performance Computing, Networking, Storage and Analysis}, + articleno = {42}, + numpages = {14}, + location = {St. Louis, Missouri}, + series = {SC'21}, +} + +CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE + +PPPM initialization ... + extracting TIP4P info from pair style + using 12-bit tables for long-range coulomb (../kspace.cpp:342) + G vector (1/distance) = 0.28684806 + grid = 25 24 80 + stencil order = 5 + estimated absolute RMS force accuracy = 0.0001640931 + estimated relative force accuracy = 1.1395635e-05 + using single precision MKL FFT + 3d grid and FFT values/proc = 84320 48000 +WARNING: Using a manybody potential with bonds/angles/dihedrals and special_bond exclusions (../pair.cpp:239) +Neighbor list info ... + update every 1 steps, delay 5 steps, check yes + max neighbors/atom: 100000, page size: 1000000 + master list distance cutoff = 18 + ghost atom cutoff = 18 + binsize = 9, bins = 6 5 23 + 3 neighbor lists, perpetual/occasional/extra = 3 0 0 + (1) pair ilp/water/2dm/opt, perpetual + attributes: full, newton on + pair build: full/bin + stencil: full/bin/3d + bin: standard + (2) pair lj/cut/tip4p/long, perpetual, skip from (3) + attributes: half, newton on + pair build: skip + stencil: none + bin: none + (3) neighbor class addition, perpetual, half/full from (1) + attributes: half, newton on + pair build: halffull/newton + stencil: none + bin: none +SHAKE stats (type/ave/delta/count) on step 0 +Bond: 1 0.957201 2.19705e-06 96 +Angle: 1 104.52 0.000203056 48 +Per MPI rank memory allocation (min/avg/max) = 25.89 | 25.89 | 25.89 Mbytes + Step TotEng PotEng KinEng v_TIP4P v_EILP v_temp_wt + 0 -16.131263 -19.815178 3.6839141 189.37246 -1.903543 300 +SHAKE stats (type/ave/delta/count) on step 100 +Bond: 1 0.9572 9.54949e-07 96 +Angle: 1 104.52 6.01522e-05 48 + 100 -17.494868 -20.796993 3.3021253 188.4955 -1.8981262 268.90898 +SHAKE stats (type/ave/delta/count) on step 200 +Bond: 1 0.9572 9.63922e-07 96 +Angle: 1 104.52 7.7021e-05 48 + 200 -17.486271 -21.194892 3.7086213 188.14561 -1.9871708 302.01203 +SHAKE stats (type/ave/delta/count) on step 300 +Bond: 1 0.9572 1.4264e-06 96 +Angle: 1 104.52 6.48393e-05 48 + 300 -17.502844 -20.993704 3.49086 188.23268 -1.8457229 284.27861 +SHAKE stats (type/ave/delta/count) on step 400 +Bond: 1 0.9572 1.33728e-06 96 +Angle: 1 104.52 7.6239e-05 48 + 400 -17.495287 -20.828353 3.3330658 188.48002 -1.8429075 271.42862 +SHAKE stats (type/ave/delta/count) on step 500 +Bond: 1 0.9572 1.14685e-06 96 +Angle: 1 104.52 8.58621e-05 48 + 500 -17.491436 -20.443044 2.9516084 188.7589 -1.8566335 240.36459 +SHAKE stats (type/ave/delta/count) on step 600 +Bond: 1 0.9572 9.17601e-07 96 +Angle: 1 104.52 8.24516e-05 48 + 600 -17.505684 -20.608457 3.1027731 188.72078 -1.9560796 252.67471 +SHAKE stats (type/ave/delta/count) on step 700 +Bond: 1 0.9572 9.50422e-07 96 +Angle: 1 104.52 5.62423e-05 48 + 700 -17.496701 -21.07266 3.5759595 188.2777 -1.9833956 291.20871 +SHAKE stats (type/ave/delta/count) on step 800 +Bond: 1 0.9572 1.15262e-06 96 +Angle: 1 104.52 7.02158e-05 48 + 800 -17.478623 -20.819504 3.340881 188.37868 -1.9112996 272.06506 +SHAKE stats (type/ave/delta/count) on step 900 +Bond: 1 0.9572 9.14138e-07 96 +Angle: 1 104.52 6.98742e-05 48 + 900 -17.480864 -20.728498 3.2476343 188.59022 -1.8922102 264.4715 +SHAKE stats (type/ave/delta/count) on step 1000 +Bond: 1 0.9572 1.00586e-06 96 +Angle: 1 104.52 0.000111711 48 + 1000 -17.498466 -20.331547 2.8330808 188.87473 -1.8121768 230.71228 +Loop time of 8.95265 on 1 procs for 1000 steps with 936 atoms + +Performance: 9.651 ns/day, 2.487 hours/ns, 111.699 timesteps/s +100.0% CPU use with 1 MPI tasks x 1 OpenMP threads + +MPI task timing breakdown: +Section | min time | avg time | max time |%varavg| %total +--------------------------------------------------------------- +Pair | 5.2127 | 5.2127 | 5.2127 | 0.0 | 58.23 +Bond | 0.00083377 | 0.00083377 | 0.00083377 | 0.0 | 0.01 +Kspace | 3.5005 | 3.5005 | 3.5005 | 0.0 | 39.10 +Neigh | 0.17946 | 0.17946 | 0.17946 | 0.0 | 2.00 +Comm | 0.028553 | 0.028553 | 0.028553 | 0.0 | 0.32 +Output | 0.00035446 | 0.00035446 | 0.00035446 | 0.0 | 0.00 +Modify | 0.01889 | 0.01889 | 0.01889 | 0.0 | 0.21 +Other | | 0.01135 | | | 0.13 + +Nlocal: 936 ave 936 max 936 min +Histogram: 1 0 0 0 0 0 0 0 0 0 +Nghost: 5242 ave 5242 max 5242 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: 431382 ave 431382 max 431382 min +Histogram: 1 0 0 0 0 0 0 0 0 0 + +Total # of neighbors = 431382 +Ave neighs/atom = 460.87821 +Ave special neighs/atom = 0.30769231 +Neighbor list builds = 28 +Dangerous builds = 0 +Total wall time: 0:00:09 diff --git a/examples/PACKAGES/interlayer/ilp_water_2dm/log.18May23.water.opt.g++.4 b/examples/PACKAGES/interlayer/ilp_water_2dm/log.18May23.water.opt.g++.4 new file mode 100644 index 0000000000..852c429323 --- /dev/null +++ b/examples/PACKAGES/interlayer/ilp_water_2dm/log.18May23.water.opt.g++.4 @@ -0,0 +1,251 @@ +LAMMPS (23 Jun 2022) +OMP_NUM_THREADS environment is not set. Defaulting to 1 thread. (../comm.cpp:98) + using 1 OpenMP thread(s) per MPI task +# Initialization +units metal +boundary p p p +atom_style full +processors * * 1 # domain decomposition over x and y +read_data ./gra_water.data +Reading data file ... + orthogonal box = (0 0 0) to (46.92336 44.331078 200) + 2 by 2 by 1 MPI processor grid + reading atoms ... + 936 atoms + reading velocities ... + 936 velocities + scanning bonds ... + 2 = max bonds/atom + scanning angles ... + 1 = max angles/atom + reading bonds ... + 96 bonds + reading angles ... + 48 angles +Finding 1-2 1-3 1-4 neighbors ... + special bond factors lj: 0 0 0 + special bond factors coul: 0 0 0 + 2 = max # of 1-2 neighbors + 1 = max # of 1-3 neighbors + 1 = max # of 1-4 neighbors + 2 = max # of special neighbors + special bonds CPU = 0.003 seconds + read_data CPU = 0.017 seconds +mass 1 12.0107 # carbon mass (g/mole) +mass 2 15.9994 # oxygen mass (g/mole) +mass 3 1.008 # hydrogen mass (g/mole) +# Separate atom groups +group gr molecule 1 +792 atoms in group gr +group water molecule 2 +144 atoms in group water +######################## Potential defition ############################## +# Interlayer potential +pair_style hybrid/overlay ilp/water/2dm/opt 16.0 lj/cut/tip4p/long 2 3 1 1 0.1546 10 8.5 +#################################################################### +pair_coeff 1 1 none +pair_coeff 2 2 lj/cut/tip4p/long 8.0313e-3 3.1589 # O-O +pair_coeff 2 3 lj/cut/tip4p/long 0.0 0.0 # O-H +pair_coeff 3 3 lj/cut/tip4p/long 0.0 0.0 # H-H +pair_coeff * * ilp/water/2dm/opt COH.ILP C Ow Hw # C-water +Reading ilp/water/2dm potential file COH.ILP with DATE: 2023-05-17 +# bond and angle +bond_style harmonic +bond_coeff 1 0.0 0.9572 +angle_style harmonic +angle_coeff 1 0.0 104.52 +# define kspace calculation +kspace_style pppm/tip4p 1E-5 +# Neighbor update settings +neighbor 2.0 bin +neigh_modify every 1 delay 5 check yes page 1000000 one 100000 +#################################################################### +# Calculate pair energy +compute 1 all pair lj/cut/tip4p/long +compute 2 all pair ilp/water/2dm/opt +compute wt water temp +variable TIP4P equal c_1 +variable EILP equal c_2 # total interlayer energy +variable temp_wt equal c_wt +############# Output ############## +thermo_style custom step etotal pe ke v_TIP4P v_EILP v_temp_wt +thermo 100 +thermo_modify lost error + +fix subf gr setforce 0.0 0.0 0.0 +fix 1 water shake 0.0001 20 100 b 1 a 1 + 0 = # of size 2 clusters + 0 = # of size 3 clusters + 0 = # of size 4 clusters + 48 = # of frozen angles + find clusters CPU = 0.001 seconds + +timestep 1e-3 +velocity water create 300.0 12345 dist gaussian mom yes rot yes +fix 2 water nve +run 1000 + +CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE + +Your simulation uses code contributions which should be cited: + +- ilp/graphene/hbn potential doi:10.1021/acs.nanolett.8b02848 +@Article{Ouyang2018 + author = {W. Ouyang, D. Mandelli, M. Urbakh, and O. Hod}, + title = {Nanoserpents: Graphene Nanoribbon Motion on Two-Dimensional Hexagonal Materials}, + journal = {Nano Letters}, + volume = 18, + pages = {6009} + year = 2018, +} + +- ilp/tmd potential doi/10.1021/acs.jctc.1c00782 +@Article{Ouyang2021 + author = {W. Ouyang, R. Sofer, X. Gao, J. Hermann, A. Tkatchenko, L. Kronik, M. Urbakh, and O. Hod}, + title = {Anisotropic Interlayer Force Field for Transition Metal Dichalcogenides: The Case of Molybdenum Disulfide}, + journal = {J. Chem. Theory Comput.}, + volume = 17, + pages = {7237–7245} + year = 2021, +} + +- ilp/water/2dm potential doi/10.1021/acs.jpcc.2c08464 +@Article{Feng2023 + author = {Z. Feng, Y. Yao, J. Liu, B. Wu, Z. Liu, and W. Ouyang}, + title = {Registry-Dependent Potential for Interfaces of Water with Graphene}, + journal = {J. Phys. Chem. C}, + volume = 127, + pages = {8704-8713} + year = 2023, +} + +- ilp/graphene/hbn/opt potential doi:10.1145/3458817.3476137 +@inproceedings{gao2021lmff + author = {Gao, Ping and Duan, Xiaohui and Others}, + title = {LMFF: Efficient and Scalable Layered Materials Force Field on Heterogeneous Many-Core Processors}, + year = {2021}, + isbn = {9781450384421}, + publisher = {Association for Computing Machinery}, + address = {New York, NY, USA}, + url = {https://doi.org/10.1145/3458817.3476137}, + doi = {10.1145/3458817.3476137}, + booktitle = {Proceedings of the International Conference for High Performance Computing, Networking, Storage and Analysis}, + articleno = {42}, + numpages = {14}, + location = {St. Louis, Missouri}, + series = {SC'21}, +} + +CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE + +PPPM initialization ... + extracting TIP4P info from pair style + using 12-bit tables for long-range coulomb (../kspace.cpp:342) + G vector (1/distance) = 0.28684806 + grid = 25 24 80 + stencil order = 5 + estimated absolute RMS force accuracy = 0.0001640931 + estimated relative force accuracy = 1.1395635e-05 + using single precision MKL FFT + 3d grid and FFT values/proc = 30685 12480 +WARNING: Using a manybody potential with bonds/angles/dihedrals and special_bond exclusions (../pair.cpp:239) +Neighbor list info ... + update every 1 steps, delay 5 steps, check yes + max neighbors/atom: 100000, page size: 1000000 + master list distance cutoff = 18 + ghost atom cutoff = 18 + binsize = 9, bins = 6 5 23 + 3 neighbor lists, perpetual/occasional/extra = 3 0 0 + (1) pair ilp/water/2dm/opt, perpetual + attributes: full, newton on + pair build: full/bin + stencil: full/bin/3d + bin: standard + (2) pair lj/cut/tip4p/long, perpetual, skip from (3) + attributes: half, newton on + pair build: skip + stencil: none + bin: none + (3) neighbor class addition, perpetual, half/full from (1) + attributes: half, newton on + pair build: halffull/newton + stencil: none + bin: none +SHAKE stats (type/ave/delta/count) on step 0 +Bond: 1 0.957201 2.19705e-06 96 +Angle: 1 104.52 0.000203056 48 +Per MPI rank memory allocation (min/avg/max) = 22.03 | 22.06 | 22.1 Mbytes + Step TotEng PotEng KinEng v_TIP4P v_EILP v_temp_wt + 0 -16.131263 -19.815178 3.6839141 189.37246 -1.903543 300 +SHAKE stats (type/ave/delta/count) on step 100 +Bond: 1 0.9572 9.54949e-07 96 +Angle: 1 104.52 6.01522e-05 48 + 100 -17.494869 -20.796995 3.3021253 188.4955 -1.8981262 268.90898 +SHAKE stats (type/ave/delta/count) on step 200 +Bond: 1 0.9572 9.63922e-07 96 +Angle: 1 104.52 7.7021e-05 48 + 200 -17.48627 -21.194892 3.7086213 188.14561 -1.9871708 302.01203 +SHAKE stats (type/ave/delta/count) on step 300 +Bond: 1 0.9572 1.4264e-06 96 +Angle: 1 104.52 6.48393e-05 48 + 300 -17.502843 -20.993703 3.4908599 188.23268 -1.8457229 284.27861 +SHAKE stats (type/ave/delta/count) on step 400 +Bond: 1 0.9572 1.33728e-06 96 +Angle: 1 104.52 7.6239e-05 48 + 400 -17.495285 -20.82835 3.333065 188.48003 -1.8429074 271.42856 +SHAKE stats (type/ave/delta/count) on step 500 +Bond: 1 0.9572 1.14685e-06 96 +Angle: 1 104.52 8.58621e-05 48 + 500 -17.491436 -20.443043 2.9516075 188.7589 -1.8566335 240.36452 +SHAKE stats (type/ave/delta/count) on step 600 +Bond: 1 0.9572 9.17601e-07 96 +Angle: 1 104.52 8.24517e-05 48 + 600 -17.505682 -20.608456 3.1027734 188.72078 -1.9560795 252.67474 +SHAKE stats (type/ave/delta/count) on step 700 +Bond: 1 0.9572 9.50425e-07 96 +Angle: 1 104.52 5.62423e-05 48 + 700 -17.496706 -21.072664 3.575958 188.2777 -1.9833951 291.20858 +SHAKE stats (type/ave/delta/count) on step 800 +Bond: 1 0.9572 1.15256e-06 96 +Angle: 1 104.52 7.02177e-05 48 + 800 -17.478628 -20.819507 3.340879 188.37868 -1.9113009 272.0649 +SHAKE stats (type/ave/delta/count) on step 900 +Bond: 1 0.9572 9.14163e-07 96 +Angle: 1 104.52 6.98849e-05 48 + 900 -17.480868 -20.728506 3.2476383 188.5902 -1.8922108 264.47182 +SHAKE stats (type/ave/delta/count) on step 1000 +Bond: 1 0.9572 1.00568e-06 96 +Angle: 1 104.52 0.000111707 48 + 1000 -17.498472 -20.331605 2.8331335 188.87466 -1.8121689 230.71657 +Loop time of 4.7828 on 4 procs for 1000 steps with 936 atoms + +Performance: 18.065 ns/day, 1.329 hours/ns, 209.082 timesteps/s +96.3% CPU use with 4 MPI tasks x 1 OpenMP threads + +MPI task timing breakdown: +Section | min time | avg time | max time |%varavg| %total +--------------------------------------------------------------- +Pair | 0.26735 | 1.3839 | 3.2059 | 99.7 | 28.93 +Bond | 0.00079377 | 0.00086039 | 0.00093529 | 0.0 | 0.02 +Kspace | 1.4248 | 3.2254 | 4.3332 | 64.6 | 67.44 +Neigh | 0.061885 | 0.061916 | 0.061951 | 0.0 | 1.29 +Comm | 0.044281 | 0.065185 | 0.078628 | 5.1 | 1.36 +Output | 0.0003482 | 0.0003787 | 0.00040746 | 0.0 | 0.01 +Modify | 0.028727 | 0.031529 | 0.034914 | 1.3 | 0.66 +Other | | 0.01367 | | | 0.29 + +Nlocal: 234 ave 302 max 198 min +Histogram: 2 0 0 1 0 0 0 0 0 1 +Nghost: 2876.5 ave 3122 max 2632 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: 107846 ave 150684 max 82181 min +Histogram: 2 0 0 0 1 0 0 0 0 1 + +Total # of neighbors = 431382 +Ave neighs/atom = 460.87821 +Ave special neighs/atom = 0.30769231 +Neighbor list builds = 28 +Dangerous builds = 0 +Total wall time: 0:00:04 From 9da310a33e947d9e07a7b3ea4540b9aaeab61274 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Fri, 19 May 2023 00:40:45 -0400 Subject: [PATCH 069/396] spelling --- doc/src/Build_manual.rst | 2 +- doc/src/variable.rst | 2 +- doc/utils/sphinx-config/false_positives.txt | 1 + 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/doc/src/Build_manual.rst b/doc/src/Build_manual.rst index e9a55134da..4b4bfa5a45 100644 --- a/doc/src/Build_manual.rst +++ b/doc/src/Build_manual.rst @@ -52,7 +52,7 @@ can be translated to different output format using the `Sphinx incorporates programmer documentation extracted from the LAMMPS C++ sources through the `Doxygen `_ program. Currently the translation to HTML, PDF (via LaTeX), ePUB (for many e-book readers) -and MOBI (for Amazon Kindle(tm) readers) are supported. For that to work a +and MOBI (for Amazon Kindle readers) are supported. For that to work a Python interpreter version 3.8 or later, the ``doxygen`` tools and internet access to download additional files and tools are required. This download is usually only required once or after the documentation diff --git a/doc/src/variable.rst b/doc/src/variable.rst index afa491e96e..1c76a2acf4 100644 --- a/doc/src/variable.rst +++ b/doc/src/variable.rst @@ -1474,7 +1474,7 @@ commands .. code-block:: LAMMPS # delete_atoms random fraction 0.5 yes all NULL 49839 - # run 0 + # run 0 post no variable t equal temp # this thermo keyword invokes a temperature compute print "Temperature of system = $t" run 1000 diff --git a/doc/utils/sphinx-config/false_positives.txt b/doc/utils/sphinx-config/false_positives.txt index d2d15633af..2951f7d12e 100644 --- a/doc/utils/sphinx-config/false_positives.txt +++ b/doc/utils/sphinx-config/false_positives.txt @@ -3736,6 +3736,7 @@ Umin un unary uncomment +uncommented uncompress uncompute underprediction From 7c14b750ef5fbf9be610aeaf122c37d6d872537e Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Fri, 19 May 2023 00:40:54 -0400 Subject: [PATCH 070/396] improve error message --- src/DIFFRACTION/compute_xrd.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/DIFFRACTION/compute_xrd.cpp b/src/DIFFRACTION/compute_xrd.cpp index 010e5bcb7d..426248b31e 100644 --- a/src/DIFFRACTION/compute_xrd.cpp +++ b/src/DIFFRACTION/compute_xrd.cpp @@ -90,8 +90,7 @@ ComputeXRD::ComputeXRD(LAMMPS *lmp, int narg, char **arg) : ztype[i] = j; } } - if (ztype[i] == XRDmaxType + 1) - error->all(FLERR,"Compute XRD: Invalid ASF atom type"); + if (ztype[i] == XRDmaxType + 1) error->all(FLERR,"Compute XRD: Invalid ASF atom type {}", arg[iarg]); iarg++; } From 22d9c047f44a9417028831c981889ec8e08f2e05 Mon Sep 17 00:00:00 2001 From: oywg11 Date: Fri, 19 May 2023 22:52:18 +0800 Subject: [PATCH 071/396] update doc file --- doc/src/pair_ilp_water_2dm.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/src/pair_ilp_water_2dm.rst b/doc/src/pair_ilp_water_2dm.rst index 5dc287493b..c611fb9275 100644 --- a/doc/src/pair_ilp_water_2dm.rst +++ b/doc/src/pair_ilp_water_2dm.rst @@ -163,4 +163,4 @@ tap_flag = 1 .. _Feng: -**(Feng)** Z. Feng, W. Ouyang, J. Phys. Chem. C. accepted (2023). +**(Feng)** Z. Feng and W. Ouyang et al, J. Phys. Chem. C 127, 8704-8713 (2023). From 0334ddb7c69a36b33757694b905820f56d8b90f2 Mon Sep 17 00:00:00 2001 From: Wengen Ouyang <34092370+oywg11@users.noreply.github.com> Date: Fri, 19 May 2023 22:57:45 +0800 Subject: [PATCH 072/396] Update pair_ilp_water_2dm.rst --- doc/src/pair_ilp_water_2dm.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/src/pair_ilp_water_2dm.rst b/doc/src/pair_ilp_water_2dm.rst index 5dc287493b..8ba75fb857 100644 --- a/doc/src/pair_ilp_water_2dm.rst +++ b/doc/src/pair_ilp_water_2dm.rst @@ -163,4 +163,4 @@ tap_flag = 1 .. _Feng: -**(Feng)** Z. Feng, W. Ouyang, J. Phys. Chem. C. accepted (2023). +**(Feng)** Z. Feng and W. Ouyang et al., J. Phys. Chem. C. 127, 8704-8713 (2023). From 7ec842d9cbcfa1f63496383f66125cdc1a9d47dd Mon Sep 17 00:00:00 2001 From: jtclemm Date: Fri, 19 May 2023 13:50:11 -0600 Subject: [PATCH 073/396] Adding requested feature to normalize forces --- src/BPM/bond_bpm_rotational.cpp | 28 ++++++++++++++++++++-------- src/BPM/bond_bpm_rotational.h | 2 +- src/BPM/bond_bpm_spring.cpp | 16 ++++++++++++++-- src/BPM/bond_bpm_spring.h | 2 +- 4 files changed, 36 insertions(+), 12 deletions(-) diff --git a/src/BPM/bond_bpm_rotational.cpp b/src/BPM/bond_bpm_rotational.cpp index ac29c0e376..5c5c0218b6 100644 --- a/src/BPM/bond_bpm_rotational.cpp +++ b/src/BPM/bond_bpm_rotational.cpp @@ -50,6 +50,7 @@ BondBPMRotational::BondBPMRotational(LAMMPS *_lmp) : { partial_flag = 1; smooth_flag = 1; + normalize_flag = 0; single_extra = 7; svector = new double[7]; @@ -203,6 +204,13 @@ double BondBPMRotational::elastic_forces(int i1, int i2, int type, double r_mag, double Ts[3], Tb[3], Tt[3], Tbp[3], Ttp[3], Tsp[3], T_rot[3], Ttmp[3]; double **quat = atom->quat; + double r0_mag_inv = 1.0 / r0_mag; + double Kr_type = Kr[type]; + double Ks_type = Ks[type]; + if (normalize_flag) { + Kr_type *= r0_mag_inv; + Ks_type *= r0_mag_inv; + } q1[0] = quat[i1][0]; q1[1] = quat[i1][1]; @@ -217,26 +225,26 @@ double BondBPMRotational::elastic_forces(int i1, int i2, int type, double r_mag, // Calculate normal forces, rb = bond vector in particle 1's frame MathExtra::qconjugate(q2, q2inv); MathExtra::quatrotvec(q2inv, r, rb); - Fr = Kr[type] * (r_mag - r0_mag); + Fr = Kr_type * (r_mag - r0_mag); MathExtra::scale3(Fr * r_mag_inv, rb, F_rot); // Calculate forces due to tangential displacements (no rotation) r0_dot_rb = MathExtra::dot3(r0, rb); - c = r0_dot_rb * r_mag_inv / r0_mag; + c = r0_dot_rb * r_mag_inv * r0_mag_inv; gamma = acos_limit(c); MathExtra::cross3(rb, r0, rb_x_r0); MathExtra::cross3(rb, rb_x_r0, s); MathExtra::norm3(s); - MathExtra::scale3(Ks[type] * r_mag * gamma, s, Fs); + MathExtra::scale3(Ks_type * r_mag * gamma, s, Fs); // Calculate torque due to tangential displacements MathExtra::cross3(r0, rb, t); MathExtra::norm3(t); - MathExtra::scale3(0.5 * r_mag * Ks[type] * r_mag * gamma, t, Ts); + MathExtra::scale3(0.5 * r_mag * Ks_type * r_mag * gamma, t, Ts); // Relative rotation force/torque // Use representation of X'Y'Z' rotations from Wang, Mora 2009 @@ -316,12 +324,12 @@ double BondBPMRotational::elastic_forces(int i1, int i2, int type, double r_mag, Ttp[1] = 0.0; Ttp[2] = Kt[type] * psi; - Fsp[0] = -0.5 * Ks[type] * r_mag * theta * cos_phi; - Fsp[1] = -0.5 * Ks[type] * r_mag * theta * sin_phi; + Fsp[0] = -0.5 * Ks_type * r_mag * theta * cos_phi; + Fsp[1] = -0.5 * Ks_type * r_mag * theta * sin_phi; Fsp[2] = 0.0; - Tsp[0] = 0.25 * Ks[type] * r_mag * r_mag * theta * sin_phi; - Tsp[1] = -0.25 * Ks[type] * r_mag * r_mag * theta * cos_phi; + Tsp[0] = 0.25 * Ks_type * r_mag * r_mag * theta * sin_phi; + Tsp[1] = -0.25 * Ks_type * r_mag * r_mag * theta * cos_phi; Tsp[2] = 0.0; // Rotate forces/torques back to 1st particle's frame @@ -667,6 +675,10 @@ void BondBPMRotational::settings(int narg, char **arg) if (iarg + 1 > narg) error->all(FLERR, "Illegal bond bpm command, missing option for smooth"); smooth_flag = utils::logical(FLERR, arg[iarg + 1], false, lmp); i += 1; + } else if (strcmp(arg[iarg], "normalize") == 0) { + if (iarg + 1 > narg) error->all(FLERR, "Illegal bond bpm command, missing option for normalize"); + normalize_flag = utils::logical(FLERR, arg[iarg + 1], false, lmp); + i += 1; } else { error->all(FLERR, "Illegal bond bpm command, invalid argument {}", arg[iarg]); } diff --git a/src/BPM/bond_bpm_rotational.h b/src/BPM/bond_bpm_rotational.h index 0fb38e7343..9fdc418d2d 100644 --- a/src/BPM/bond_bpm_rotational.h +++ b/src/BPM/bond_bpm_rotational.h @@ -41,7 +41,7 @@ class BondBPMRotational : public BondBPM { protected: double *Kr, *Ks, *Kt, *Kb, *gnorm, *gslide, *groll, *gtwist; double *Fcr, *Fcs, *Tct, *Tcb; - int smooth_flag; + int smooth_flag, normalize_flag; double elastic_forces(int, int, int, double, double, double, double *, double *, double *, double *, double *, double *); diff --git a/src/BPM/bond_bpm_spring.cpp b/src/BPM/bond_bpm_spring.cpp index ed4e71daf1..37b79f93fb 100644 --- a/src/BPM/bond_bpm_spring.cpp +++ b/src/BPM/bond_bpm_spring.cpp @@ -37,6 +37,7 @@ BondBPMSpring::BondBPMSpring(LAMMPS *_lmp) : { partial_flag = 1; smooth_flag = 1; + normalize_flag = 0; single_extra = 1; svector = new double[1]; @@ -190,7 +191,10 @@ void BondBPMSpring::compute(int eflag, int vflag) } rinv = 1.0 / r; - fbond = k[type] * (r0 - r); + if (normalize_flag) + fbond = -k[type] * e; + else + fbond = k[type] * (r0 - r); delvx = v[i1][0] - v[i2][0]; delvy = v[i1][1] - v[i2][1]; @@ -302,6 +306,10 @@ void BondBPMSpring::settings(int narg, char **arg) if (iarg + 1 > narg) error->all(FLERR, "Illegal bond bpm command, missing option for smooth"); smooth_flag = utils::logical(FLERR, arg[iarg + 1], false, lmp); i += 1; + } else if (strcmp(arg[iarg], "normalize") == 0) { + if (iarg + 1 > narg) error->all(FLERR, "Illegal bond bpm command, missing option for normalize"); + normalize_flag = utils::logical(FLERR, arg[iarg + 1], false, lmp); + i += 1; } else { error->all(FLERR, "Illegal bond bpm command, invalid argument {}", arg[iarg]); } @@ -376,7 +384,11 @@ double BondBPMSpring::single(int type, double rsq, int i, int j, double &fforce) double r = sqrt(rsq); double rinv = 1.0 / r; - fforce = k[type] * (r0 - r); + + if (normalize_flag) + fforce = k[type] * (r0 - r) / r0; + else + fforce = k[type] * (r0 - r); double **x = atom->x; double **v = atom->v; diff --git a/src/BPM/bond_bpm_spring.h b/src/BPM/bond_bpm_spring.h index 409469bef3..93f4b49a26 100644 --- a/src/BPM/bond_bpm_spring.h +++ b/src/BPM/bond_bpm_spring.h @@ -40,7 +40,7 @@ class BondBPMSpring : public BondBPM { protected: double *k, *ecrit, *gamma; - int smooth_flag; + int smooth_flag, normalize_flag; void allocate(); void store_data(); From cb5934cbcdbf6ea4098451473d45126c79f99ca2 Mon Sep 17 00:00:00 2001 From: jtclemm Date: Fri, 19 May 2023 13:51:53 -0600 Subject: [PATCH 074/396] Adding option to doc files, clarifying normal forces in compute pair/bond local --- doc/src/bond_bpm_rotational.rst | 6 ++++++ doc/src/bond_bpm_spring.rst | 8 +++++++- doc/src/compute_bond_local.rst | 5 ++++- doc/src/compute_pair_local.rst | 4 +++- 4 files changed, 20 insertions(+), 3 deletions(-) diff --git a/doc/src/bond_bpm_rotational.rst b/doc/src/bond_bpm_rotational.rst index ba93d679ba..0baf7e35b1 100644 --- a/doc/src/bond_bpm_rotational.rst +++ b/doc/src/bond_bpm_rotational.rst @@ -30,6 +30,9 @@ Syntax *smooth* value = *yes* or *no* smooths bond forces near the breaking point + *normalize* value = *yes* or *no* + normalizes normal and shear forces by the reference length + *break/no* indicates that bonds should not break during a run @@ -136,6 +139,9 @@ or :doc:`read_restart ` commands: * :math:`\gamma_r` (force*distance/velocity units) * :math:`\gamma_t` (force*distance/velocity units) +However, the *normalize* option will normalize the radial and shear forces +by :math:`r_0` such that :math:`k_r` and :math:`k_s` are unit less. + By default, pair forces are not calculated between bonded particles. Pair forces can alternatively be overlaid on top of bond forces using the *overlay/pair* keyword. These settings require specific diff --git a/doc/src/bond_bpm_spring.rst b/doc/src/bond_bpm_spring.rst index 5762dbe208..6da0d25a4a 100644 --- a/doc/src/bond_bpm_spring.rst +++ b/doc/src/bond_bpm_spring.rst @@ -30,6 +30,9 @@ Syntax *smooth* value = *yes* or *no* smooths bond forces near the breaking point + *normalize* value = *yes* or *no* + normalizes bond forces by their reference length + *break/no* indicates that bonds should not break during a run @@ -66,7 +69,7 @@ particles based on a model described by Clemmer and Robbins F = k (r - r_0) w -where :math:`k_r` is a stiffness, :math:`r` is the current distance +where :math:`k` is a stiffness, :math:`r` is the current distance and :math:`r_0` is the initial distance between the two particles, and :math:`w` is an optional smoothing factor discussed below. Bonds will break at a strain of :math:`\epsilon_c`. This is done by setting by @@ -102,6 +105,9 @@ the data file or restart files read by the :doc:`read_data * :math:`\epsilon_c` (unit less) * :math:`\gamma` (force/velocity units) +However, the *normalize* option will normalize the elastic bond force by +:math:`r_0` such that :math:`k` is unit less. + By default, pair forces are not calculated between bonded particles. Pair forces can alternatively be overlaid on top of bond forces using the *overlay/pair* keyword. These settings require specific diff --git a/doc/src/compute_bond_local.rst b/doc/src/compute_bond_local.rst index f3fb752ebe..10e86bbe44 100644 --- a/doc/src/compute_bond_local.rst +++ b/doc/src/compute_bond_local.rst @@ -76,7 +76,10 @@ The value *force* is the magnitude of the force acting between the pair of atoms in the bond. The values *fx*, *fy*, and *fz* are the xyz components of -*force* between the pair of atoms in the bond. +*force* between the pair of atoms in the bond. For bond styles that apply +non-central forces, such as :doc:`bond_style bpm/rotational +`, these values only include the :math:`(x,y,z)` +components of the normal force component. The remaining properties are all computed for motion of the two atoms relative to the center of mass (COM) velocity of the 2 atoms in the diff --git a/doc/src/compute_pair_local.rst b/doc/src/compute_pair_local.rst index dace280dee..31209f63f4 100644 --- a/doc/src/compute_pair_local.rst +++ b/doc/src/compute_pair_local.rst @@ -66,7 +66,9 @@ The value *eng* is the interaction energy for the pair of atoms. The value *force* is the force acting between the pair of atoms, which is positive for a repulsive force and negative for an attractive force. The values *fx*, *fy*, and *fz* are the :math:`(x,y,z)` components of -*force* on atom I. +*force* on atom I. For pair styles that apply non-central forces, +such as :doc:`granular pair styles `, these values only include +the :math:`(x,y,z)` components of the normal force component. A pair style may define additional pairwise quantities which can be accessed as *p1* to *pN*, where :math:`N` is defined by the pair style. From 0dd26189d4e8fb5b5630618687f74cd032d6ad62 Mon Sep 17 00:00:00 2001 From: jtclemm Date: Fri, 19 May 2023 13:52:35 -0600 Subject: [PATCH 075/396] Adding missing factor in bpm/rotational single method --- src/BPM/bond_bpm_rotational.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/BPM/bond_bpm_rotational.cpp b/src/BPM/bond_bpm_rotational.cpp index 5c5c0218b6..ffb0d9521d 100644 --- a/src/BPM/bond_bpm_rotational.cpp +++ b/src/BPM/bond_bpm_rotational.cpp @@ -805,7 +805,7 @@ double BondBPMRotational::single(int type, double rsq, int i, int j, double &ffo double breaking = elastic_forces(i, j, type, r_mag, r0_mag, r_mag_inv, rhat, r, r0, force1on2, torque1on2, torque2on1); damping_forces(i, j, type, rhat, r, force1on2, torque1on2, torque2on1); - fforce = MathExtra::dot3(force1on2, r); + fforce = MathExtra::dot3(force1on2, rhat); fforce *= -1; double smooth = 1.0; From 8d0eb9b1f71c3454d84f5c289d816deea29c5aed Mon Sep 17 00:00:00 2001 From: srtee Date: Tue, 9 May 2023 22:07:48 +1000 Subject: [PATCH 076/396] hook up efield variables to qeq/reaxff --- src/REAXFF/fix_qeq_reaxff.cpp | 41 +++++++++++++++++++--------- src/fix_efield.cpp | 50 +++++++++++++++++++++-------------- src/fix_efield.h | 1 + 3 files changed, 60 insertions(+), 32 deletions(-) diff --git a/src/REAXFF/fix_qeq_reaxff.cpp b/src/REAXFF/fix_qeq_reaxff.cpp index 704b43e642..5dc739d5e8 100644 --- a/src/REAXFF/fix_qeq_reaxff.cpp +++ b/src/REAXFF/fix_qeq_reaxff.cpp @@ -404,8 +404,6 @@ void FixQEqReaxFF::init() efield->init(); if (strcmp(update->unit_style,"real") != 0) error->all(FLERR,"Must use unit_style real with fix {} and external fields", style); - if (efield->varflag != FixEfield::CONSTANT) - error->all(FLERR,"Cannot (yet) use fix {} with variable efield", style); if (((fabs(efield->ex) > SMALL) && domain->xperiodic) || ((fabs(efield->ey) > SMALL) && domain->yperiodic) || @@ -1101,26 +1099,45 @@ void FixQEqReaxFF::get_chi_field() // efield energy is in real units of kcal/mol/angstrom, need to convert to eV - const double factor = -1.0/force->qe2f; + const double qe2f = force->qe2f; + const double factor = -1.0/qe2f; + + + if (efield->varflag != FixEfield::CONSTANT) { + efield->update_efield_variables(); + } - // currently we only support constant efield // atom selection is for the group of fix efield - if (efield->varflag == FixEfield::CONSTANT) { - double unwrap[3]; - const double fx = efield->ex; - const double fy = efield->ey; - const double fz = efield->ez; - const int efgroupbit = efield->groupbit; + double unwrap[3]; + const double ex = efield->ex; + const double ey = efield->ey; + const double ez = efield->ez; + const int efgroupbit = efield->groupbit; // charge interactions // force = qE, potential energy = F dot x in unwrapped coords - + if (efield->varflag != FixEfield::ATOM) { for (int i = 0; i < nlocal; i++) { if (mask[i] & efgroupbit) { if (region && !region->match(x[i][0],x[i][1],x[i][2])) continue; domain->unmap(x[i],image[i],unwrap); - chi_field[i] = factor*(fx*unwrap[0] + fy*unwrap[1] + fz*unwrap[2]); + chi_field[i] = factor*(ex*unwrap[0] + ey*unwrap[1] + ez*unwrap[2]); + } + } + } else { + for (int i = 0; i < nlocal; i++) { + if (mask[i] & efgroupbit) { + if (region && !region->match(x[i][0],x[i][1],x[i][2])) continue; + domain->unmap(x[i],image[i],unwrap); + double edisp = 0; // accumulate E dot displacement + edisp += unwrap[0]*( + (efield->xstyle == FixEfield::ATOM) ? qe2f*efield->efield[i][0] : ex); + edisp += unwrap[1]*( + (efield->ystyle == FixEfield::ATOM) ? qe2f*efield->efield[i][1] : ey); + edisp += unwrap[2]*( + (efield->zstyle == FixEfield::ATOM) ? qe2f*efield->efield[i][2] : ez); + chi_field[i] = factor*edisp; } } } diff --git a/src/fix_efield.cpp b/src/fix_efield.cpp index 7880655973..f1adc722ae 100644 --- a/src/fix_efield.cpp +++ b/src/fix_efield.cpp @@ -346,26 +346,7 @@ void FixEfield::post_force(int vflag) } else { - modify->clearstep_compute(); - - if (xstyle == EQUAL) { - ex = qe2f * input->variable->compute_equal(xvar); - } else if (xstyle == ATOM) { - input->variable->compute_atom(xvar, igroup, &efield[0][0], 4, 0); - } - if (ystyle == EQUAL) { - ey = qe2f * input->variable->compute_equal(yvar); - } else if (ystyle == ATOM) { - input->variable->compute_atom(yvar, igroup, &efield[0][1], 4, 0); - } - if (zstyle == EQUAL) { - ez = qe2f * input->variable->compute_equal(zvar); - } else if (zstyle == ATOM) { - input->variable->compute_atom(zvar, igroup, &efield[0][2], 4, 0); - } - if (estyle == ATOM) input->variable->compute_atom(evar, igroup, &efield[0][3], 4, 0); - - modify->addstep_compute(update->ntimestep + 1); + update_efield_variables(); // charge interactions // force = qE @@ -470,3 +451,32 @@ double FixEfield::compute_vector(int n) } return fsum_all[n + 1]; } + +/* ---------------------------------------------------------------------- + update efield variables without doing anything else + called by fix_qeq_reaxff +------------------------------------------------------------------------- */ + +void FixEfield::update_efield_variables() +{ + modify->clearstep_compute(); + + if (xstyle == EQUAL) { + ex = qe2f * input->variable->compute_equal(xvar); + } else if (xstyle == ATOM) { + input->variable->compute_atom(xvar, igroup, &efield[0][0], 4, 0); + } + if (ystyle == EQUAL) { + ey = qe2f * input->variable->compute_equal(yvar); + } else if (ystyle == ATOM) { + input->variable->compute_atom(yvar, igroup, &efield[0][1], 4, 0); + } + if (zstyle == EQUAL) { + ez = qe2f * input->variable->compute_equal(zvar); + } else if (zstyle == ATOM) { + input->variable->compute_atom(zvar, igroup, &efield[0][2], 4, 0); + } + if (estyle == ATOM) input->variable->compute_atom(evar, igroup, &efield[0][3], 4, 0); + + modify->addstep_compute(update->ntimestep + 1); +} diff --git a/src/fix_efield.h b/src/fix_efield.h index 52c827bb50..2bab26e140 100644 --- a/src/fix_efield.h +++ b/src/fix_efield.h @@ -59,6 +59,7 @@ class FixEfield : public Fix { int force_flag; double fsum[4], fsum_all[4]; + void update_efield_variables(); }; } // namespace LAMMPS_NS #endif From fe7a6fce296846e278233b2572f808d5da4eeb65 Mon Sep 17 00:00:00 2001 From: srtee Date: Wed, 17 May 2023 16:13:27 +1000 Subject: [PATCH 077/396] make QEQ work with atom-style potential --- src/REAXFF/fix_qeq_reaxff.cpp | 15 ++++-------- src/fix_efield.cpp | 45 ++++++++++++++++++++++++++--------- src/fix_efield.h | 5 ++-- 3 files changed, 42 insertions(+), 23 deletions(-) diff --git a/src/REAXFF/fix_qeq_reaxff.cpp b/src/REAXFF/fix_qeq_reaxff.cpp index 5dc739d5e8..b25ce479cd 100644 --- a/src/REAXFF/fix_qeq_reaxff.cpp +++ b/src/REAXFF/fix_qeq_reaxff.cpp @@ -405,6 +405,9 @@ void FixQEqReaxFF::init() if (strcmp(update->unit_style,"real") != 0) error->all(FLERR,"Must use unit_style real with fix {} and external fields", style); + if (efield->varflag == FixEfield::ATOM && efield->pstyle != FixEfield::ATOM) + error->all(FLERR,"Atom-style external electric field requires atom-style " + "potential variable when used with fix {}", style); if (((fabs(efield->ex) > SMALL) && domain->xperiodic) || ((fabs(efield->ey) > SMALL) && domain->yperiodic) || ((fabs(efield->ez) > SMALL) && domain->zperiodic)) @@ -1125,19 +1128,11 @@ void FixQEqReaxFF::get_chi_field() chi_field[i] = factor*(ex*unwrap[0] + ey*unwrap[1] + ez*unwrap[2]); } } - } else { + } else { // must use atom-style potential from FixEfield for (int i = 0; i < nlocal; i++) { if (mask[i] & efgroupbit) { if (region && !region->match(x[i][0],x[i][1],x[i][2])) continue; - domain->unmap(x[i],image[i],unwrap); - double edisp = 0; // accumulate E dot displacement - edisp += unwrap[0]*( - (efield->xstyle == FixEfield::ATOM) ? qe2f*efield->efield[i][0] : ex); - edisp += unwrap[1]*( - (efield->ystyle == FixEfield::ATOM) ? qe2f*efield->efield[i][1] : ey); - edisp += unwrap[2]*( - (efield->zstyle == FixEfield::ATOM) ? qe2f*efield->efield[i][2] : ez); - chi_field[i] = factor*edisp; + chi_field[i] = -efield->efield[i][3]; } } } diff --git a/src/fix_efield.cpp b/src/fix_efield.cpp index f1adc722ae..f335d8a765 100644 --- a/src/fix_efield.cpp +++ b/src/fix_efield.cpp @@ -41,7 +41,7 @@ using namespace FixConst; FixEfield::FixEfield(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg), xstr(nullptr), ystr(nullptr), zstr(nullptr), estr(nullptr), - idregion(nullptr), region(nullptr), efield(nullptr) + pstr(nullptr), idregion(nullptr), region(nullptr), efield(nullptr) { if (narg < 6) utils::missing_cmd_args(FLERR, std::string("fix ") + style, error); @@ -100,6 +100,14 @@ FixEfield::FixEfield(LAMMPS *lmp, int narg, char **arg) : } else error->all(FLERR, "Unsupported argument for fix {} energy command: {}", style, arg[iarg]); iarg += 2; + } else if (strcmp(arg[iarg], "potential") == 0) { + if (iarg + 2 > narg) + utils::missing_cmd_args(FLERR, std::string("fix ") + style + "potential", error); + if (utils::strmatch(arg[iarg + 1], "^v_")) { + pstr = utils::strdup(arg[iarg + 1] + 2); + } else + error->all(FLERR, "Unsupported argument for fix {} energy command: {}", style, arg[iarg]); + iarg += 2; } else { error->all(FLERR, "Unknown keyword for fix {} command: {}", style, arg[iarg]); } @@ -122,6 +130,7 @@ FixEfield::~FixEfield() delete[] ystr; delete[] zstr; delete[] estr; + delete[] pstr; delete[] idregion; memory->destroy(efield); } @@ -157,43 +166,55 @@ void FixEfield::init() if (xstr) { xvar = input->variable->find(xstr); - if (xvar < 0) error->all(FLERR, "Variable {} for fix {} does not exist", xstr, style); + if (xvar < 0) error->all(FLERR, "Variable {} for x-field in fix {} does not exist", xstr, style); if (input->variable->equalstyle(xvar)) xstyle = EQUAL; else if (input->variable->atomstyle(xvar)) xstyle = ATOM; else - error->all(FLERR, "Variable {} for fix {} is invalid style", xstr, style); + error->all(FLERR, "Variable {} for x-field in fix {} is invalid style", xstr, style); } if (ystr) { yvar = input->variable->find(ystr); - if (yvar < 0) error->all(FLERR, "Variable {} for fix {} does not exist", ystr, style); + if (yvar < 0) error->all(FLERR, "Variable {} for y-field in fix {} does not exist", ystr, style); if (input->variable->equalstyle(yvar)) ystyle = EQUAL; else if (input->variable->atomstyle(yvar)) ystyle = ATOM; else - error->all(FLERR, "Variable {} for fix {} is invalid style", ystr, style); + error->all(FLERR, "Variable {} for y-field in fix {} is invalid style", ystr, style); } if (zstr) { zvar = input->variable->find(zstr); - if (zvar < 0) error->all(FLERR, "Variable {} for fix {} does not exist", zstr, style); + if (zvar < 0) error->all(FLERR, "Variable {} for z-field in fix {} does not exist", zstr, style); if (input->variable->equalstyle(zvar)) zstyle = EQUAL; else if (input->variable->atomstyle(zvar)) zstyle = ATOM; else - error->all(FLERR, "Variable {} for fix {} is invalid style", zstr, style); + error->all(FLERR, "Variable {} for z-field in fix {} is invalid style", zstr, style); } if (estr) { evar = input->variable->find(estr); - if (evar < 0) error->all(FLERR, "Variable {} for fix {} does not exist", estr, style); + if (evar < 0) error->all(FLERR, "Variable {} for energy in fix {} does not exist", estr, style); if (input->variable->atomstyle(evar)) estyle = ATOM; else - error->all(FLERR, "Variable {} for fix {} is invalid style", estr, style); + error->all(FLERR, "Variable {} for energy in fix {} must be atom-style", estr, style); } else estyle = NONE; + if (pstr) { + pvar = input->variable->find(pstr); + if (pvar < 0) error->all(FLERR, "Variable {} for potential in fix {} does not exist", pstr, style); + if (input->variable->atomstyle(pvar)) + pstyle = ATOM; + else + error->all(FLERR, "Variable {} for potential in fix {} must be atom-style", pstr, style); + if (estyle != NONE) + error->warning(FLERR, "fix {} will ignore variable {} for energy " + "because atom-style potential has been specified", estr, style); + } else + pstyle = NONE; // set index and check validity of region @@ -376,7 +397,8 @@ void FixEfield::post_force(int vflag) } f[i][2] += fz; fsum[3] += fz; - if (estyle == ATOM) fsum[0] += efield[i][3]; + if (pstyle == ATOM) fsum[0] += qe2f * q[i] * efield[i][3]; + else if (estyle == ATOM) fsum[0] += efield[i][3]; } } @@ -476,7 +498,8 @@ void FixEfield::update_efield_variables() } else if (zstyle == ATOM) { input->variable->compute_atom(zvar, igroup, &efield[0][2], 4, 0); } - if (estyle == ATOM) input->variable->compute_atom(evar, igroup, &efield[0][3], 4, 0); + if (pstyle == ATOM) input->variable->compute_atom(pvar, igroup, &efield[0][3], 4, 0); + else if (estyle == ATOM) input->variable->compute_atom(evar, igroup, &efield[0][3], 4, 0); modify->addstep_compute(update->ntimestep + 1); } diff --git a/src/fix_efield.h b/src/fix_efield.h index 2bab26e140..72fd204898 100644 --- a/src/fix_efield.h +++ b/src/fix_efield.h @@ -46,10 +46,11 @@ class FixEfield : public Fix { protected: double ex, ey, ez; int varflag; - char *xstr, *ystr, *zstr, *estr; + char *xstr, *ystr, *zstr, *estr, *pstr; char *idregion; class Region *region; - int xvar, yvar, zvar, evar, xstyle, ystyle, zstyle, estyle; + int xvar, yvar, zvar, xstyle, ystyle, zstyle; + int evar, pvar, estyle, pstyle; int ilevel_respa; double qe2f; int qflag, muflag; From 36eb11f499d2ebfa896e14bd0caa8792561788ad Mon Sep 17 00:00:00 2001 From: Evangelos Voyiatzis Date: Sat, 20 May 2023 12:59:34 +0300 Subject: [PATCH 078/396] Include method for bond contribution & variables to compute_stress_mop.h --- src/EXTRA-COMPUTE/compute_stress_mop.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/EXTRA-COMPUTE/compute_stress_mop.h b/src/EXTRA-COMPUTE/compute_stress_mop.h index 5357d36371..c9f95c1996 100644 --- a/src/EXTRA-COMPUTE/compute_stress_mop.h +++ b/src/EXTRA-COMPUTE/compute_stress_mop.h @@ -38,11 +38,13 @@ class ComputeStressMop : public Compute { private: void compute_pairs(); + void compute_bonds(); int me, nvalues, dir; int *which; double *values_local, *values_global; + double *bond_local, *bond_global; double pos, pos1, dt, nktv2p, ftm2v; double area; class NeighList *list; From 5da65bbd0a158e89b06e959a17cde3af02474d71 Mon Sep 17 00:00:00 2001 From: Evangelos Voyiatzis Date: Sat, 20 May 2023 13:06:19 +0300 Subject: [PATCH 079/396] Code for bond contribution to stress/mop --- src/EXTRA-COMPUTE/compute_stress_mop.cpp | 137 ++++++++++++++++++++++- 1 file changed, 132 insertions(+), 5 deletions(-) diff --git a/src/EXTRA-COMPUTE/compute_stress_mop.cpp b/src/EXTRA-COMPUTE/compute_stress_mop.cpp index 60f2d76e06..7900a62bef 100644 --- a/src/EXTRA-COMPUTE/compute_stress_mop.cpp +++ b/src/EXTRA-COMPUTE/compute_stress_mop.cpp @@ -19,10 +19,13 @@ #include "compute_stress_mop.h" #include "atom.h" +#include "atom_vec.h" +#include "bond.h" #include "domain.h" #include "error.h" #include "force.h" #include "memory.h" +#include "molecule.h" #include "neigh_list.h" #include "neighbor.h" #include "pair.h" @@ -118,12 +121,16 @@ ComputeStressMop::ComputeStressMop(LAMMPS *lmp, int narg, char **arg) : // Initialize some variables values_local = values_global = vector = nullptr; + bond_local = nullptr; + bond_global = nullptr; // this fix produces a global vector memory->create(vector,nvalues,"stress/mop:vector"); memory->create(values_local,nvalues,"stress/mop/spatial:values_local"); memory->create(values_global,nvalues,"stress/mop/spatial:values_global"); + memory->create(bond_local,nvalues,"stress/mop/spatial:bond_local"); + memory->create(bond_global,nvalues,"stress/mop/spatial:bond_global"); size_vector = nvalues; vector_flag = 1; @@ -140,6 +147,8 @@ ComputeStressMop::~ComputeStressMop() memory->destroy(values_local); memory->destroy(values_global); + memory->destroy(bond_local); + memory->destroy(bond_global); memory->destroy(vector); } @@ -185,8 +194,8 @@ void ComputeStressMop::init() //Compute stress/mop only accounts for pair interactions. // issue a warning if any intramolecular potential or Kspace is defined. - if (force->bond!=nullptr) - error->warning(FLERR,"compute stress/mop does not account for bond potentials"); + //if (force->bond!=nullptr) + // error->warning(FLERR,"compute stress/mop does not account for bond potentials"); if (force->angle!=nullptr) error->warning(FLERR,"compute stress/mop does not account for angle potentials"); if (force->dihedral!=nullptr) @@ -224,9 +233,14 @@ void ComputeStressMop::compute_vector() MPI_Allreduce(values_local,values_global,nvalues, MPI_DOUBLE,MPI_SUM,world); - int m; - for (m=0; mx; + tagint *tag = atom->tag; + int *num_bond = atom->num_bond; + tagint **bond_atom = atom->bond_atom; + int **bond_type = atom->bond_type; + int *mask = atom->mask; + + int *molindex = atom->molindex; + int *molatom = atom->molatom; + Molecule **onemols = atom->avec->onemols; + + int nlocal = atom->nlocal; + int newton_bond = force->newton_bond; + int molecular = atom->molecular; + + Bond *bond = force->bond; + + double dx[3] {0}; + double x_bond_1[3] {0}; + double x_bond_2[3] {0}; + double local_contribution[3] {0}; + + // initialization + for (int i {0}; i < nvalues; i++) bond_local[i] = 0.0; + + // loop over all bonded atoms in the current proc + for (atom1 = 0; atom1 < nlocal; atom1++) { + if (!(mask[atom1] & groupbit)) continue; + + if (molecular == 1) + nb = num_bond[atom1]; + else { + if (molindex[atom1] < 0) continue; + imol = molindex[atom1]; + iatom = molatom[atom1]; + nb = onemols[imol]->num_bond[iatom]; + } + + for (i = 0; i < nb; i++) { + if (molecular == 1) { + btype = bond_type[atom1][i]; + atom2 = atom->map(bond_atom[atom1][i]); + } else { + tagprev = tag[atom1] - iatom - 1; + btype = onemols[imol]->bond_type[iatom][i]; + atom2 = atom->map(onemols[imol]->bond_atom[iatom][i] + tagprev); + } + + if (atom2 < 0 || !(mask[atom2] & groupbit)) continue; + if (newton_bond == 0 && tag[atom1] > tag[atom2]) continue; + if (btype <= 0) continue; + + // minimum image of atom1 with respect to the plane of interest + dx[0] = x[atom1][0]; + dx[1] = x[atom1][1]; + dx[2] = x[atom1][2]; + dx[dir] -= pos; + domain->minimum_image(dx[0], dx[1], dx[2]); + x_bond_1[0] = dx[0]; + x_bond_1[1] = dx[1]; + x_bond_1[2] = dx[2]; + x_bond_1[dir] += pos; + + // minimum image of atom2 with respect to atom1 + dx[0] = x[atom2][0] - x_bond_1[0]; + dx[1] = x[atom2][1] - x_bond_1[1]; + dx[2] = x[atom2][2] - x_bond_1[2]; + domain->minimum_image(dx[0], dx[1], dx[2]); + x_bond_2[0] = x_bond_1[0] + dx[0]; + x_bond_2[1] = x_bond_1[1] + dx[1]; + x_bond_2[2] = x_bond_1[2] + dx[2]; + + // check if the bond vector crosses the plane of interest + double tau = (x_bond_1[dir] - pos) / (x_bond_1[dir] - x_bond_2[dir]); + if ((tau <= 1) and (tau >= 0)) + { + //std::cout << "I have found one crossing bond " << tau << std::endl; + dx[0] = x_bond_1[0] - x_bond_2[0]; + dx[1] = x_bond_1[1] - x_bond_2[1]; + dx[2] = x_bond_1[2] - x_bond_2[2]; + rsq = dx[0] * dx[0] + dx[1] * dx[1] + dx[2] * dx[2]; + bond->single(btype, rsq, atom1, atom2, fpair); + + // check the correct contribution with the + or - sign + local_contribution[0] += fpair*dx[0]/area*nktv2p; + local_contribution[1] += fpair*dx[1]/area*nktv2p; + local_contribution[2] += fpair*dx[2]/area*nktv2p; + } + } + } + + // loop over the keywords and if necessary add the bond contribution + int m {0}; + while (m Date: Sat, 20 May 2023 15:12:42 +0300 Subject: [PATCH 080/396] Update compute_stress_mop.cpp --- src/EXTRA-COMPUTE/compute_stress_mop.cpp | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/src/EXTRA-COMPUTE/compute_stress_mop.cpp b/src/EXTRA-COMPUTE/compute_stress_mop.cpp index 7900a62bef..89ef4e8b2b 100644 --- a/src/EXTRA-COMPUTE/compute_stress_mop.cpp +++ b/src/EXTRA-COMPUTE/compute_stress_mop.cpp @@ -525,16 +525,13 @@ void ComputeStressMop::compute_bonds() // check if the bond vector crosses the plane of interest double tau = (x_bond_1[dir] - pos) / (x_bond_1[dir] - x_bond_2[dir]); - if ((tau <= 1) and (tau >= 0)) - { - //std::cout << "I have found one crossing bond " << tau << std::endl; + if ((tau <= 1) and (tau >= 0)) { dx[0] = x_bond_1[0] - x_bond_2[0]; dx[1] = x_bond_1[1] - x_bond_2[1]; dx[2] = x_bond_1[2] - x_bond_2[2]; rsq = dx[0] * dx[0] + dx[1] * dx[1] + dx[2] * dx[2]; bond->single(btype, rsq, atom1, atom2, fpair); - // check the correct contribution with the + or - sign local_contribution[0] += fpair*dx[0]/area*nktv2p; local_contribution[1] += fpair*dx[1]/area*nktv2p; local_contribution[2] += fpair*dx[2]/area*nktv2p; @@ -552,5 +549,4 @@ void ComputeStressMop::compute_bonds() } m += 3; } - return; } From 1d7a6f813bd623ba1d483da70e13d1c40ef24a43 Mon Sep 17 00:00:00 2001 From: Evangelos Voyiatzis Date: Sat, 20 May 2023 15:14:47 +0300 Subject: [PATCH 081/396] Update compute_stress_mop.cpp --- src/EXTRA-COMPUTE/compute_stress_mop.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/EXTRA-COMPUTE/compute_stress_mop.cpp b/src/EXTRA-COMPUTE/compute_stress_mop.cpp index 89ef4e8b2b..8391622242 100644 --- a/src/EXTRA-COMPUTE/compute_stress_mop.cpp +++ b/src/EXTRA-COMPUTE/compute_stress_mop.cpp @@ -525,7 +525,7 @@ void ComputeStressMop::compute_bonds() // check if the bond vector crosses the plane of interest double tau = (x_bond_1[dir] - pos) / (x_bond_1[dir] - x_bond_2[dir]); - if ((tau <= 1) and (tau >= 0)) { + if ((tau <= 1) && (tau >= 0)) { dx[0] = x_bond_1[0] - x_bond_2[0]; dx[1] = x_bond_1[1] - x_bond_2[1]; dx[2] = x_bond_1[2] - x_bond_2[2]; From 6977f71eb0ad15e370e330739cf6cf937f4ceca0 Mon Sep 17 00:00:00 2001 From: rohskopf Date: Sat, 20 May 2023 13:53:22 -0600 Subject: [PATCH 082/396] Initial example --- examples/mliap/jax/README.md | 38 +++++++++++ examples/mliap/jax/deploy_script.py | 32 +++++++++ examples/mliap/jax/in.run | 48 +++++++++++++ examples/mliap/jax/mliap_jax.pkl | Bin 0 -> 234 bytes examples/mliap/jax/mliap_unified_jax.py | 0 examples/mliap/jax/write_unified.py | 86 ++++++++++++++++++++++++ 6 files changed, 204 insertions(+) create mode 100644 examples/mliap/jax/README.md create mode 100644 examples/mliap/jax/deploy_script.py create mode 100644 examples/mliap/jax/in.run create mode 100644 examples/mliap/jax/mliap_jax.pkl create mode 100644 examples/mliap/jax/mliap_unified_jax.py create mode 100644 examples/mliap/jax/write_unified.py diff --git a/examples/mliap/jax/README.md b/examples/mliap/jax/README.md new file mode 100644 index 0000000000..14a049221a --- /dev/null +++ b/examples/mliap/jax/README.md @@ -0,0 +1,38 @@ +# Running JAX from LAMMPS + +### Getting started + +First make a Python environment with dependencies: + + conda create --name jax python=3.10 + conda activate jax + # Upgrade pip + python -m pip install --upgrade pip + # Install JAX: + python -m pip install --upgrade "jax[cpu]" + # Install other dependencies: + python -m pip install numpy scipy torch scikit-learn virtualenv psutil tabulate mpi4py Cython + +Install LAMMPS: + + cd /path/to/lammps + mkdir build-jax; cd build-jax + cmake ../cmake -DLAMMPS_EXCEPTIONS=yes \ + -DBUILD_SHARED_LIBS=yes \ + -DMLIAP_ENABLE_PYTHON=yes \ + -DPKG_PYTHON=yes \ + -DPKG_ML-SNAP=yes \ + -DPKG_ML-IAP=yes \ + -DPYTHON_EXECUTABLE:FILEPATH=`which python` + make -j4 + make install-python + +### Wrapping JAX code + +Take inspiration from the `FitSNAP` ML-IAP wrapper: https://github.com/rohskopf/FitSNAP/blob/mliap-unified/fitsnap3lib/tools/write_unified.py + +First define JAX model in `deploy_script.py`, which will wrap model with `write_unified`. + + python deploy_script.py + +Then load model in LAMMPS and run: \ No newline at end of file diff --git a/examples/mliap/jax/deploy_script.py b/examples/mliap/jax/deploy_script.py new file mode 100644 index 0000000000..58af797766 --- /dev/null +++ b/examples/mliap/jax/deploy_script.py @@ -0,0 +1,32 @@ +import numpy as np +import pickle +from pathlib import Path +from write_unified import MLIAPInterface + +class MyModel(): + def __init__(self,blah): + """ + coeffs = np.genfromtxt(file,skip_header=6) + self.bias = coeffs[0] + self.weights = coeffs[1:] + """ + self.blah = blah + self.n_params = 3 #len(coeffs) + self.n_descriptors = 1 #len(self.weights) + self.n_elements = 1 + + def __call__(self,rij): + print(rij) + #energy[:] = bispectrum @ self.weights + self.bias + #beta[:] = self.weights + return 5 + +model = MyModel(1) + +#unified = MLIAPInterface(model, ["Ta"], model_device="cpu") + +def create_pickle(): + unified = MLIAPInterface(model, ["Ta"]) + unified.pickle('mliap_jax.pkl') + +create_pickle() \ No newline at end of file diff --git a/examples/mliap/jax/in.run b/examples/mliap/jax/in.run new file mode 100644 index 0000000000..1ffc2d3c0f --- /dev/null +++ b/examples/mliap/jax/in.run @@ -0,0 +1,48 @@ +# Initialize simulation + +variable nsteps index 10000 +units metal + +# generate the box and atom positions using a BCC lattice + +#boundary p p p +#read_data DATA + +variable nrep equal 2 #10 +variable a equal 3.316 +variable nx equal ${nrep} +variable ny equal ${nrep} +variable nz equal ${nrep} +lattice bcc $a +region box block 0 ${nx} 0 ${ny} 0 ${nz} +create_box 1 box +create_atoms 1 box +mass 1 180.88 + +pair_style mliap unified mliap_jax.pkl 0 +pair_coeff * * Ta + +compute eatom all pe/atom +compute energy all reduce sum c_eatom + +compute satom all stress/atom NULL +compute str all reduce sum c_satom[1] c_satom[2] c_satom[3] +variable press equal (c_str[1]+c_str[2]+c_str[3])/(3*vol) + +thermo_style custom step temp epair c_energy etotal press v_press +thermo 10 +thermo_modify norm yes + +# Set up NVE run + +timestep 0.5e-3 +neighbor 1.0 bin +# is this neigh modify every 1 slow? +neigh_modify once no every 1 delay 0 check yes + +# Run MD + +velocity all create 3200.0 4928459 loop geom +dump 1 all xyz 10 dump.xyz +fix 1 all nve +run ${nsteps} \ No newline at end of file diff --git a/examples/mliap/jax/mliap_jax.pkl b/examples/mliap/jax/mliap_jax.pkl new file mode 100644 index 0000000000000000000000000000000000000000..2cbbedb7c1bd8dd8af97d7312471cf2054e163d1 GIT binary patch literal 234 zcmZ9GyAFat5Ji1pP$GVZHhzOvhA76u)=U-{<0deWWr?9M(SAC|@AFs0XW^}GZgI{% zJGXo59rlk#TZD@AUSlFW3Rl5=6Ocu-S24;}CKox$m>>>> hey!") + #elems = self.as_tensor(data.elems).type(torch.int64).reshape(1, data.ntotal) + + """ + elems = self.as_tensor(data.elems).type(torch.int64) + 1 + #z_vals = self.species_set[elems+1] + pair_i = self.as_tensor(data.pair_i).type(torch.int64) + pair_j = self.as_tensor(data.pair_j).type(torch.int64) + rij = self.as_tensor(data.rij).type(torch.float64).requires_grad_(True) + nlocal = self.as_tensor(data.nlistatoms) + """ + + rij = data.rij + + #(total_energy, fij) = self.network(rij, None, None, None, nlocal, elems, pair_i, pair_j, "cpu", dtype=torch.float64, mode="lammps") + + test = self.model(rij) + + #data.update_pair_forces(fij) + #data.energy = total_energy.item() + + pass + +def setup_LAMMPS(energy): + """ + + :param energy: energy node for lammps interface + :return: graph for computing from lammps MLIAP unified inputs. + """ + + model = TheModelClass(*args, **kwargs) + + save_state_dict = torch.load("Ta_Pytorch.pt") + model.load_state_dict(save_state_dict["model_state_dict"]) + + + #model.load_state_dict(torch.load(PATH)) + model.eval() + + #model.eval() + return model \ No newline at end of file From 28c9c274be1fd270a866258dafc09486d3cccf1a Mon Sep 17 00:00:00 2001 From: rohskopf Date: Sat, 20 May 2023 14:08:20 -0600 Subject: [PATCH 083/396] Copy MLIAPUnified LJ example --- examples/mliap/jax/README.md | 6 +- examples/mliap/jax/deploy_script.py | 33 ++--------- examples/mliap/jax/in.run | 59 ++++++++------------ examples/mliap/jax/mliap_unified_jax.py | 41 ++++++++++++++ examples/mliap/jax/mliap_unified_jax_Ar.pkl | Bin 0 -> 181 bytes examples/mliap/jax/write_unified.py | 1 + 6 files changed, 76 insertions(+), 64 deletions(-) create mode 100644 examples/mliap/jax/mliap_unified_jax_Ar.pkl diff --git a/examples/mliap/jax/README.md b/examples/mliap/jax/README.md index 14a049221a..320d87e465 100644 --- a/examples/mliap/jax/README.md +++ b/examples/mliap/jax/README.md @@ -35,4 +35,8 @@ First define JAX model in `deploy_script.py`, which will wrap model with `write_ python deploy_script.py -Then load model in LAMMPS and run: \ No newline at end of file +This creates `.pkl` file to be loaded by LAMMPS ML-IAP Unified. + +Run LAMMPS with the model: + + mpirun -np P lmp -in in.run \ No newline at end of file diff --git a/examples/mliap/jax/deploy_script.py b/examples/mliap/jax/deploy_script.py index 58af797766..5e73995565 100644 --- a/examples/mliap/jax/deploy_script.py +++ b/examples/mliap/jax/deploy_script.py @@ -1,32 +1,11 @@ -import numpy as np -import pickle -from pathlib import Path -from write_unified import MLIAPInterface +import lammps +import lammps.mliap -class MyModel(): - def __init__(self,blah): - """ - coeffs = np.genfromtxt(file,skip_header=6) - self.bias = coeffs[0] - self.weights = coeffs[1:] - """ - self.blah = blah - self.n_params = 3 #len(coeffs) - self.n_descriptors = 1 #len(self.weights) - self.n_elements = 1 - - def __call__(self,rij): - print(rij) - #energy[:] = bispectrum @ self.weights + self.bias - #beta[:] = self.weights - return 5 - -model = MyModel(1) - -#unified = MLIAPInterface(model, ["Ta"], model_device="cpu") +#from lammps.mliap.mliap_unified_lj import MLIAPUnifiedLJ +from mliap_unified_jax import MLIAPUnifiedJAX def create_pickle(): - unified = MLIAPInterface(model, ["Ta"]) - unified.pickle('mliap_jax.pkl') + unified = MLIAPUnifiedJAX(["Ar"]) + unified.pickle('mliap_unified_jax_Ar.pkl') create_pickle() \ No newline at end of file diff --git a/examples/mliap/jax/in.run b/examples/mliap/jax/in.run index 1ffc2d3c0f..354dfd769f 100644 --- a/examples/mliap/jax/in.run +++ b/examples/mliap/jax/in.run @@ -1,48 +1,35 @@ -# Initialize simulation +# 3d Lennard-Jones melt -variable nsteps index 10000 -units metal +units lj +atom_style atomic -# generate the box and atom positions using a BCC lattice - -#boundary p p p -#read_data DATA - -variable nrep equal 2 #10 -variable a equal 3.316 -variable nx equal ${nrep} -variable ny equal ${nrep} -variable nz equal ${nrep} -lattice bcc $a -region box block 0 ${nx} 0 ${ny} 0 ${nz} +lattice fcc 0.8442 +region box block 0 10 0 10 0 10 create_box 1 box create_atoms 1 box -mass 1 180.88 +mass 1 1.0 -pair_style mliap unified mliap_jax.pkl 0 -pair_coeff * * Ta +velocity all create 3.0 87287 loop geom -compute eatom all pe/atom -compute energy all reduce sum c_eatom +pair_style mliap unified mliap_unified_jax_Ar.pkl 0 +pair_coeff * * Ar -compute satom all stress/atom NULL -compute str all reduce sum c_satom[1] c_satom[2] c_satom[3] -variable press equal (c_str[1]+c_str[2]+c_str[3])/(3*vol) +neighbor 0.3 bin +neigh_modify every 20 delay 0 check no -thermo_style custom step temp epair c_energy etotal press v_press -thermo 10 -thermo_modify norm yes +fix 1 all nve -# Set up NVE run +#dump id all atom 50 dump.melt -timestep 0.5e-3 -neighbor 1.0 bin -# is this neigh modify every 1 slow? -neigh_modify once no every 1 delay 0 check yes +#dump 2 all image 25 image.*.jpg type type & +# axes yes 0.8 0.02 view 60 -30 +#dump_modify 2 pad 3 -# Run MD +#dump 3 all movie 1 movie.mpg type type & +# axes yes 0.8 0.02 view 60 -30 +#dump_modify 3 pad 3 -velocity all create 3200.0 4928459 loop geom -dump 1 all xyz 10 dump.xyz -fix 1 all nve -run ${nsteps} \ No newline at end of file +#dump 4 all custom 1 forces.xyz fx fy fz + +thermo 50 +run 250 \ No newline at end of file diff --git a/examples/mliap/jax/mliap_unified_jax.py b/examples/mliap/jax/mliap_unified_jax.py index e69de29bb2..a2447d1cdb 100644 --- a/examples/mliap/jax/mliap_unified_jax.py +++ b/examples/mliap/jax/mliap_unified_jax.py @@ -0,0 +1,41 @@ +from lammps.mliap.mliap_unified_abc import MLIAPUnified +import numpy as np + + +class MLIAPUnifiedJAX(MLIAPUnified): + """Test implementation for MLIAPUnified.""" + + def __init__(self, element_types, epsilon=1.0, sigma=1.0, rcutfac=1.25): + # ARGS: interface, element_types, ndescriptors, nparams, rcutfac + super().__init__(None, element_types, 1, 3, rcutfac) + # Mimicking the LJ pair-style: + # pair_style lj/cut 2.5 + # pair_coeff * * 1 1 + self.epsilon = epsilon + self.sigma = sigma + + def compute_gradients(self, data): + """Test compute_gradients.""" + + def compute_descriptors(self, data): + """Test compute_descriptors.""" + + def compute_forces(self, data): + """Test compute_forces.""" + eij, fij = self.compute_pair_ef(data) + data.update_pair_energy(eij) + data.update_pair_forces(fij) + + def compute_pair_ef(self, data): + rij = data.rij + + r2inv = 1.0 / np.sum(rij ** 2, axis=1) + r6inv = r2inv * r2inv * r2inv + + lj1 = 4.0 * self.epsilon * self.sigma**12 + lj2 = 4.0 * self.epsilon * self.sigma**6 + + eij = r6inv * (lj1 * r6inv - lj2) + fij = r6inv * (3.0 * lj2 - 6.0 * lj2 * r6inv) * r2inv + fij = fij[:, np.newaxis] * rij + return eij, fij \ No newline at end of file diff --git a/examples/mliap/jax/mliap_unified_jax_Ar.pkl b/examples/mliap/jax/mliap_unified_jax_Ar.pkl new file mode 100644 index 0000000000000000000000000000000000000000..04b173031520d82eb1b407293993b6329e52765e GIT binary patch literal 181 zcmZo*nYxMr0(t~i3yB=+#+rKA=o7iAWd Date: Sun, 21 May 2023 10:29:24 +0800 Subject: [PATCH 084/396] add potential file that parameterized against with DMC reference data --- potentials/COH.DMC.ILP | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100755 potentials/COH.DMC.ILP diff --git a/potentials/COH.DMC.ILP b/potentials/COH.DMC.ILP new file mode 100755 index 0000000000..7235afcdab --- /dev/null +++ b/potentials/COH.DMC.ILP @@ -0,0 +1,28 @@ +# DATE: 2023-05-18 UNITS: metal CONTRIBUTOR: Wengen Ouyang w.g.ouyang@gmail.com CITATION: Z. Feng, ..., and W. Ouyang, J. Phys. Chem. C 127, 8704 (2023). +# Interlayer Potential (ILP) for water/graphene heterojunctions +# The parameters below are fitted against the DMC reference data that rescaled from PBE+MBD-NL. +# +# ----------------- Repulsion Potential ------------------++++++++++++++ Vdw Potential ++++++++++++++++************ +# beta(A) alpha delta(A) epsilon(meV) C(meV) d sR reff(A) C6(meV*A^6) S rcut +# For graphene and hydrocarbons +C C 3.205843 7.511126 1.235334 1.528338E-5 37.530428 15.499947 0.7954443 3.681440 25.714535E3 1.0 2.0 +H H 3.974540 6.53799 1.080633 0.6700556 0.8333833 15.022371 0.7490632 2.767223 1.6159581E3 1.0 1.2 +C H 2.642950 12.91410 1.020257 0.9750012 25.340996 15.222927 0.8115998 3.887324 5.6874617E3 1.0 1.5 +H C 2.642950 12.91410 1.020257 0.9750012 25.340996 15.222927 0.8115998 3.887324 5.6874617E3 1.0 1.5 + +# For water-graphene +C Ow 4.03686677 15.09817069 1.00000323 1.03838111 0.16372013 9.00010553 1.12057182 2.96484087 21887.14173222 1.0 2.0 +C Hw 3.08246994 6.412090180 1.00000265 2.89390420 -1.85748759 9.00009101 1.04574423 2.21642099 4652.78021666 1.0 2.0 +Ow C 4.03686677 15.09817069 1.00000323 1.03838111 0.16372013 9.00010553 1.12057182 2.96484087 21887.14173222 1.0 1.2 +Hw C 3.08246994 6.412090180 1.00000265 2.89390420 -1.85748759 9.00009101 1.04574423 2.21642099 4652.78021666 1.0 1.2 + +# # The ILPs for other systems are set to zero +H Ow 5.45369612 6.18172364 1.25025450 0.00000000 0.00000000 9.05706482 1.23249498 2.77577173 0.00000000 1.0 1.2 +H Hw 5.45369612 6.18172364 1.25025450 0.00000000 0.00000000 9.05706482 1.23249498 2.77577173 0.00000000 1.0 1.2 +Ow H 5.45369612 6.18172364 1.25025450 0.00000000 0.00000000 9.05706482 1.23249498 2.77577173 0.00000000 1.0 1.2 +Hw H 5.45369612 6.18172364 1.25025450 0.00000000 0.00000000 9.05706482 1.23249498 2.77577173 0.00000000 1.0 1.2 + +Ow Ow 5.45369612 6.18172364 1.25025450 0.00000000 0.00000000 9.05706482 1.23249498 2.77577173 0.00000000 1.0 1.2 +Hw Hw 5.45369612 6.18172364 1.25025450 0.00000000 0.00000000 9.05706482 1.23249498 2.77577173 0.00000000 1.0 1.2 +Ow Hw 5.45369612 6.18172364 1.25025450 0.00000000 0.00000000 9.05706482 1.23249498 2.77577173 0.00000000 1.0 1.2 +Hw Ow 5.45369612 6.18172364 1.25025450 0.00000000 0.00000000 9.05706482 1.23249498 2.77577173 0.00000000 1.0 1.2 \ No newline at end of file From 91ac9ef3fc4c88ddcb7b1356a62c3c927535fb2c Mon Sep 17 00:00:00 2001 From: oywg11 Date: Sun, 21 May 2023 11:29:28 +0800 Subject: [PATCH 085/396] update doc file --- doc/src/pair_ilp_water_2dm.rst | 170 +++++++++++++++++++++++++++++++++ 1 file changed, 170 insertions(+) create mode 100644 doc/src/pair_ilp_water_2dm.rst diff --git a/doc/src/pair_ilp_water_2dm.rst b/doc/src/pair_ilp_water_2dm.rst new file mode 100644 index 0000000000..82cf1a6580 --- /dev/null +++ b/doc/src/pair_ilp_water_2dm.rst @@ -0,0 +1,170 @@ +.. index:: pair_style ilp/water/2dm +.. index:: pair_style ilp/water/2dm/opt + +pair_style ilp/tmd command +=================================== + +Accelerator Variant: *ilp/water/2dm/opt* + +Syntax +"""""" + +.. code-block:: LAMMPS + + pair_style [hybrid/overlay ...] ilp/tmd cutoff tap_flag + +* cutoff = global cutoff (distance units) +* tap_flag = 0/1 to turn off/on the taper function + +Examples +"""""""" + +.. code-block:: LAMMPS + + pair_style hybrid/overlay ilp/water/2dm 16.0 1 + pair_coeff * * ilp/water/2dm COH.ILP C Ow Hw + + pair_style hybrid/overlay ilp/water/2dm 16.0 lj/cut/tip4p/long 2 3 1 1 0.1546 10 8.5 + pair_coeff 2 2 lj/cut/tip4p/long 8.0313e-3 3.1589 # O-O + pair_coeff 2 3 lj/cut/tip4p/long 0.0 0.0 # O-H + pair_coeff 3 3 lj/cut/tip4p/long 0.0 0.0 # H-H + pair_coeff * * ilp/water/2dm COH.ILP C Ow Hw + +Description +""""""""""" + +.. versionadded:: xxxx2023 + +The *ilp/water/2dm* style computes the registry-dependent interlayer +potential (ILP) potential for interfaces of water with two-dimensinal (2D) +materials as described in :ref:`(Feng) `. + +.. math:: + + E = & \frac{1}{2} \sum_i \sum_{j \neq i} V_{ij} \\ + V_{ij} = & {\rm Tap}(r_{ij})\left \{ e^{-\alpha (r_{ij}/\beta -1)} + \left [ \epsilon + f(\rho_{ij}) + f(\rho_{ji})\right ] - + \frac{1}{1+e^{-d\left [ \left ( r_{ij}/\left (s_R \cdot r^{eff} \right ) \right )-1 \right ]}} + \cdot \frac{C_6}{r^6_{ij}} \right \}\\ + \rho_{ij}^2 = & r_{ij}^2 - ({\bf r}_{ij} \cdot {\bf n}_i)^2 \\ + \rho_{ji}^2 = & r_{ij}^2 - ({\bf r}_{ij} \cdot {\bf n}_j)^2 \\ + f(\rho) = & C e^{ -( \rho / \delta )^2 } \\ + {\rm Tap}(r_{ij}) = & 20\left ( \frac{r_{ij}}{R_{cut}} \right )^7 - + 70\left ( \frac{r_{ij}}{R_{cut}} \right )^6 + + 84\left ( \frac{r_{ij}}{R_{cut}} \right )^5 - + 35\left ( \frac{r_{ij}}{R_{cut}} \right )^4 + 1 + +Where :math:`\mathrm{Tap}(r_{ij})` is the taper function which provides +a continuous cutoff (up to third derivative) for interatomic separations +larger than :math:`r_c` :doc:`pair_style ilp_graphene_hbn `. + +It is important to include all the pairs to build the neighbor list for +calculating the normals. + +.. note:: + + Since each water molecule contains one oxygen atom and two hydrogen atoms, + a new definition is proposed (see In :ref:`(Feng) `),the atomic + normal vectors of hydrogen atoms are assumed to lie along the corresponding + oxygen-hydrogen bonds and the normal vector of the central oxygen atom + is defined as their average. + +The parameter file (e.g. COH.ILP), is intended for use with *metal* +:doc:`units `, with energies in meV. Two additional parameters, +*S*, and *rcut* are included in the parameter file. *S* is designed to +facilitate scaling of energies. *rcut* is designed to build the neighbor +list for calculating the normals for each atom pair. + +.. note:: + + The parameters presented in the parameter file (e.g. COH.ILP), + are fitted with taper function by setting the cutoff equal to 16.0 + Angstrom. Using different cutoff or taper function should be careful. + These parameters provide a good description in both short- and long-range + interaction regimes. This feature is essential for simulations in high pressure + regime (i.e., the interlayer distance is smaller than the equilibrium + distance). + +This potential must be used in combination with hybrid/overlay. +Other interactions can be set to zero using pair_style *none*\ . + +This pair style tallies a breakdown of the total interlayer potential +energy into sub-categories, which can be accessed via the :doc:`compute pair ` command as a vector of values of length 2. +The 2 values correspond to the following sub-categories: + +1. *E_vdW* = vdW (attractive) energy +2. *E_Rep* = Repulsive energy + +To print these quantities to the log file (with descriptive column +headings) the following commands could be included in an input script: + +.. code-block:: LAMMPS + + compute 0 all pair ilp/water/2dm + variable Evdw equal c_0[1] + variable Erep equal c_0[2] + thermo_style custom step temp epair v_Erep v_Evdw + +---------- + +.. include:: accel_styles.rst + +---------- + +Mixing, shift, table, tail correction, restart, rRESPA info +""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" + +This pair style does not support the pair_modify mix, shift, table, and +tail options. + +This pair style does not write their information to binary restart +files, since it is stored in potential files. Thus, you need to +re-specify the pair_style and pair_coeff commands in an input script +that reads a restart file. + +Restrictions +"""""""""""" + +This pair style is part of the INTERLAYER package. It is only enabled +if LAMMPS was built with that package. See the :doc:`Build package +` page for more info. + +This pair style requires the newton setting to be *on* for pair +interactions. + +The COH.ILP potential file provided with LAMMPS (see the potentials +directory) are parameterized for *metal* units. You can use this +potential with any LAMMPS units, but you would need to create your +COH.ILP potential file with coefficients listed in the appropriate +units, if your simulation does not use *metal* units. + +Related commands +"""""""""""""""" + +:doc:`pair_coeff `, +:doc:`pair_none `, +:doc:`pair_style hybrid/overlay `, +:doc:`pair_style drip `, +:doc:`pair_style ilp_tmd `, +:doc:`pair_style saip_metal `, +:doc:`pair_style ilp_graphene_hbn `, +:doc:`pair_style pair_kolmogorov_crespi_z `, +:doc:`pair_style pair_kolmogorov_crespi_full `, +:doc:`pair_style pair_lebedeva_z `, +:doc:`pair_style pair_coul_shield `. + +Default +""""""" + +tap_flag = 1 + + +---------- + +.. _Feng: + +<<<<<<< HEAD +**(Feng)** Z. Feng and W. Ouyang et al, J. Phys. Chem. C 127, 8704-8713 (2023). +======= +**(Feng)** Z. Feng and W. Ouyang et al., J. Phys. Chem. C. 127, 8704-8713 (2023). +>>>>>>> 0334ddb7c69a36b33757694b905820f56d8b90f2 From 685255083efaed1049724351fdfc33193ee493a5 Mon Sep 17 00:00:00 2001 From: oywg11 Date: Sun, 21 May 2023 11:43:39 +0800 Subject: [PATCH 086/396] clean the duplicate info --- doc/src/pair_ilp_water_2dm.rst | 5 ----- 1 file changed, 5 deletions(-) diff --git a/doc/src/pair_ilp_water_2dm.rst b/doc/src/pair_ilp_water_2dm.rst index 82cf1a6580..6a364f38ed 100644 --- a/doc/src/pair_ilp_water_2dm.rst +++ b/doc/src/pair_ilp_water_2dm.rst @@ -162,9 +162,4 @@ tap_flag = 1 ---------- .. _Feng: - -<<<<<<< HEAD -**(Feng)** Z. Feng and W. Ouyang et al, J. Phys. Chem. C 127, 8704-8713 (2023). -======= **(Feng)** Z. Feng and W. Ouyang et al., J. Phys. Chem. C. 127, 8704-8713 (2023). ->>>>>>> 0334ddb7c69a36b33757694b905820f56d8b90f2 From d190249e98b40e17995d6d96dad06533e6ad28ca Mon Sep 17 00:00:00 2001 From: srtee Date: Mon, 22 May 2023 00:10:01 +1000 Subject: [PATCH 087/396] add documentation and checks --- doc/src/fix_efield.rst | 26 +++++++++++++++++++++++--- doc/src/fix_qeq_reaxff.rst | 10 +++++++--- src/REAXFF/fix_qeq_reaxff.cpp | 5 +++++ src/fix_efield.cpp | 6 ++++-- 4 files changed, 39 insertions(+), 8 deletions(-) diff --git a/doc/src/fix_efield.rst b/doc/src/fix_efield.rst index e72510e4da..271912097f 100644 --- a/doc/src/fix_efield.rst +++ b/doc/src/fix_efield.rst @@ -19,7 +19,7 @@ Syntax * ex,ey,ez = E-field component values (electric field units) * any of ex,ey,ez can be a variable (see below) * zero or more keyword/value pairs may be appended to args -* keyword = *region* or *energy* +* keyword = *region* or *energy* or *potential* .. parsed-literal:: @@ -27,6 +27,8 @@ Syntax region-ID = ID of region atoms must be in to have added force *energy* value = v_name v_name = variable with name that calculates the potential energy of each atom in the added E-field + *potential* value = v_name + v_name = variable with name that calculates the electric potential of each atom in the added E-field (overrides *energy*) Examples """""""" @@ -112,7 +114,8 @@ one or more variables, and if you are performing dynamics via the :doc:`run ` command. If the keyword is not used, LAMMPS will set the energy to 0.0, which is typically fine for dynamics. -The *energy* keyword is required if the added force is defined with +The *energy* keyword (or *potential* keyword, described below) +is required if the added force is defined with one or more variables, and you are performing energy minimization via the "minimize" command for charged particles. It is not required for point-dipoles, but a warning is issued since the minimizer in LAMMPS @@ -122,7 +125,7 @@ minimize the orientation of dipoles in an applied electric field. The *energy* keyword specifies the name of an atom-style :doc:`variable ` which is used to compute the energy of each atom as function of its position. Like variables used for *ex*, -*ey*, *ez*, the energy variable is specified as v_name, where name +*ey*, *ez*, the energy variable is specified as "v_name", where "name" is the variable name. Note that when the *energy* keyword is used during an energy @@ -133,6 +136,23 @@ due to the electric field were a spring-like F = kx, then the energy formula should be E = -0.5kx\^2. If you don't do this correctly, the minimization will not converge properly. +The *potential* keyword can be used as an alternative to the *energy* +keyword to specify the name of an atom-style variable, which is used to compute +the added electric potential to each atom as a function of its position. +The variable should have units of electric field times distance (that is, +in `units real`, the potential should be in volts). As with the *energy* +keyword, the variable name is specified as "v_name". The energy added by this +fix is then calculated as the electric potential multiplied by charge. + +The *potential* keyword is mainly intended for correct charge equilibration +in simulations with :doc:`fix qeq/reaxff`, since with variable +charges the electric potential can be known beforehand but the energy cannot. +A small additional benefit is that the *energy* keyword requires an additional +conversion to energy units which the *potential* keyword avoids. Thus, when the +*potential* keyword is specified the *energy* keyword is ignored (the simulation +will proceed but with a warning issued). As with *energy*, the *potential* +keyword is not allowed if the added field is a constant vector. + ---------- Restart, fix_modify, output, run start/stop, minimize info diff --git a/doc/src/fix_qeq_reaxff.rst b/doc/src/fix_qeq_reaxff.rst index db9015f187..4422ddc89c 100644 --- a/doc/src/fix_qeq_reaxff.rst +++ b/doc/src/fix_qeq_reaxff.rst @@ -128,9 +128,13 @@ periodic cell dimensions less than 10 Angstroms. This fix may be used in combination with :doc:`fix efield ` and will apply the external electric field during charge equilibration, -but there may be only one fix efield instance used, it may only use a -constant electric field, and the electric field vector may only have -components in non-periodic directions. +but there may be only one fix efield instance used and the electric field +vector may only have components in non-periodic directions. Equal-style +variables can be used for electric field vector components without any further +settings. Atom-style variables can be used for spatially-varying electric field +vector components, but the resulting electric potential must be specified +as an atom-style variable using the (new) *potential* keyword for +`fix efield`. Related commands """""""""""""""" diff --git a/src/REAXFF/fix_qeq_reaxff.cpp b/src/REAXFF/fix_qeq_reaxff.cpp index b25ce479cd..4c0864ac27 100644 --- a/src/REAXFF/fix_qeq_reaxff.cpp +++ b/src/REAXFF/fix_qeq_reaxff.cpp @@ -408,6 +408,11 @@ void FixQEqReaxFF::init() if (efield->varflag == FixEfield::ATOM && efield->pstyle != FixEfield::ATOM) error->all(FLERR,"Atom-style external electric field requires atom-style " "potential variable when used with fix {}", style); + if (((efield->xstyle != FixEfield::CONSTANT) && domain->xperiodic) || + ((efield->ystyle != FixEfield::CONSTANT) && domain->yperiodic) || + ((efield->zstyle != FixEfield::CONSTANT) && domain->zperiodic)) + error->all(FLERR,"Must not have electric field component in direction of periodic " + "boundary when using charge equilibration with ReaxFF."); if (((fabs(efield->ex) > SMALL) && domain->xperiodic) || ((fabs(efield->ey) > SMALL) && domain->yperiodic) || ((fabs(efield->ez) > SMALL) && domain->zperiodic)) diff --git a/src/fix_efield.cpp b/src/fix_efield.cpp index f335d8a765..d2c0dc1ef6 100644 --- a/src/fix_efield.cpp +++ b/src/fix_efield.cpp @@ -238,8 +238,10 @@ void FixEfield::init() if (varflag == CONSTANT && estyle != NONE) error->all(FLERR, "Cannot use variable energy with constant efield in fix {}", style); - if ((varflag == EQUAL || varflag == ATOM) && update->whichflag == 2 && estyle == NONE) - error->all(FLERR, "Must use variable energy with fix {}", style); + if (varflag == CONSTANT && pstyle != NONE) + error->all(FLERR, "Cannot use variable potential with constant efield in fix {}", style); + if ((varflag == EQUAL || varflag == ATOM) && update->whichflag == 2 && estyle == NONE && pstyle == NONE) + error->all(FLERR, "Must use variable energy or potential with fix {} during minimization", style); if (utils::strmatch(update->integrate_style, "^respa")) { ilevel_respa = (dynamic_cast(update->integrate))->nlevels - 1; From 0692ed3bd72bfbd9f0524baa8ea45dadefb08407 Mon Sep 17 00:00:00 2001 From: Evangelos Voyiatzis Date: Wed, 24 May 2023 11:47:15 +0300 Subject: [PATCH 088/396] @evoyiatzis Include method for angle contribution & variables to compute_stress_mop.h --- src/EXTRA-COMPUTE/compute_stress_mop.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/EXTRA-COMPUTE/compute_stress_mop.h b/src/EXTRA-COMPUTE/compute_stress_mop.h index c9f95c1996..d1074e002a 100644 --- a/src/EXTRA-COMPUTE/compute_stress_mop.h +++ b/src/EXTRA-COMPUTE/compute_stress_mop.h @@ -39,12 +39,14 @@ class ComputeStressMop : public Compute { private: void compute_pairs(); void compute_bonds(); + void compute_angles(); int me, nvalues, dir; int *which; double *values_local, *values_global; double *bond_local, *bond_global; + double *angle_local, *angle_global; double pos, pos1, dt, nktv2p, ftm2v; double area; class NeighList *list; From df708a67a5f56f6ac64bd03ac2f6b8f3033f1cb4 Mon Sep 17 00:00:00 2001 From: Evangelos Voyiatzis Date: Wed, 24 May 2023 11:55:08 +0300 Subject: [PATCH 089/396] Code for angle contribution to stress/mop --- src/EXTRA-COMPUTE/compute_stress_mop.cpp | 186 ++++++++++++++++++++++- 1 file changed, 184 insertions(+), 2 deletions(-) diff --git a/src/EXTRA-COMPUTE/compute_stress_mop.cpp b/src/EXTRA-COMPUTE/compute_stress_mop.cpp index 8391622242..139c5b5903 100644 --- a/src/EXTRA-COMPUTE/compute_stress_mop.cpp +++ b/src/EXTRA-COMPUTE/compute_stress_mop.cpp @@ -18,6 +18,7 @@ #include "compute_stress_mop.h" +#include "angle.h" #include "atom.h" #include "atom_vec.h" #include "bond.h" @@ -123,6 +124,8 @@ ComputeStressMop::ComputeStressMop(LAMMPS *lmp, int narg, char **arg) : values_local = values_global = vector = nullptr; bond_local = nullptr; bond_global = nullptr; + angle_local = nullptr; + angle_global = nullptr; // this fix produces a global vector @@ -131,6 +134,8 @@ ComputeStressMop::ComputeStressMop(LAMMPS *lmp, int narg, char **arg) : memory->create(values_global,nvalues,"stress/mop/spatial:values_global"); memory->create(bond_local,nvalues,"stress/mop/spatial:bond_local"); memory->create(bond_global,nvalues,"stress/mop/spatial:bond_global"); + memory->create(angle_local,nvalues,"stress/mop/spatial:angle_local"); + memory->create(angle_global,nvalues,"stress/mop/spatial:angle_global"); size_vector = nvalues; vector_flag = 1; @@ -149,6 +154,8 @@ ComputeStressMop::~ComputeStressMop() memory->destroy(values_global); memory->destroy(bond_local); memory->destroy(bond_global); + memory->destroy(angle_local); + memory->destroy(angle_global); memory->destroy(vector); } @@ -197,7 +204,8 @@ void ComputeStressMop::init() //if (force->bond!=nullptr) // error->warning(FLERR,"compute stress/mop does not account for bond potentials"); if (force->angle!=nullptr) - error->warning(FLERR,"compute stress/mop does not account for angle potentials"); + if (force->angle->born_matrix_enable == 0) + error->warning(FLERR,"compute stress/mop does not account for angle potentials"); if (force->dihedral!=nullptr) error->warning(FLERR,"compute stress/mop does not account for dihedral potentials"); if (force->improper!=nullptr) @@ -239,8 +247,14 @@ void ComputeStressMop::compute_vector() // sum bond contribution over all procs MPI_Allreduce(bond_local,bond_global,nvalues,MPI_DOUBLE,MPI_SUM,world); + //Compute angle contribution on separate procs + compute_angles(); + + // sum angle contribution over all procs + MPI_Allreduce(angle_local,angle_global,nvalues,MPI_DOUBLE,MPI_SUM,world); + for (int m=0; mx; + tagint *tag = atom->tag; + int *num_angle = atom->num_angle; + tagint **angle_atom1 = atom->angle_atom1; + tagint **angle_atom2 = atom->angle_atom2; + tagint **angle_atom3 = atom->angle_atom3; + int **angle_type = atom->angle_type; + int *mask = atom->mask; + + int *molindex = atom->molindex; + int *molatom = atom->molatom; + Molecule **onemols = atom->avec->onemols; + + int nlocal = atom->nlocal; + int molecular = atom->molecular; + + // loop over all atoms and their angles + + Angle *angle = force->angle; + + double duang, du2ang; + double dx[3] {0}; + double dx_left[3] {0}; + double dx_right[3] {0}; + double x_angle_left[3] {0}; + double x_angle_middle[3] {0}; + double x_angle_right[3] {0}; + double dcos_theta[3] {0}; + double local_contribution[3] {0}; + + // initialization + for (int i {0}; i < nvalues; i++) angle_local[i] = 0.0; + + for (atom2 = 0; atom2 < nlocal; atom2++) { + if (!(mask[atom2] & groupbit)) continue; + + if (molecular == 1) + na = num_angle[atom2]; + else { + if (molindex[atom2] < 0) continue; + imol = molindex[atom2]; + iatom = molatom[atom2]; + na = onemols[imol]->num_angle[iatom]; + } + + for (int i = 0; i < na; i++) { + if (molecular == 1) { + if (tag[atom2] != angle_atom2[atom2][i]) continue; + atype = angle_type[atom2][i]; + atom1 = atom->map(angle_atom1[atom2][i]); + atom3 = atom->map(angle_atom3[atom2][i]); + } else { + if (tag[atom2] != onemols[imol]->angle_atom2[atom2][i]) continue; + atype = onemols[imol]->angle_type[atom2][i]; + tagprev = tag[atom2] - iatom - 1; + atom1 = atom->map(onemols[imol]->angle_atom1[atom2][i] + tagprev); + atom3 = atom->map(onemols[imol]->angle_atom3[atom2][i] + tagprev); + } + + if (atom1 < 0 || !(mask[atom1] & groupbit)) continue; + if (atom3 < 0 || !(mask[atom3] & groupbit)) continue; + if (atype <= 0) continue; + + // minimum image of atom1 with respect to the plane of interest + dx[0] = x[atom1][0]; + dx[1] = x[atom1][1]; + dx[2] = x[atom1][2]; + dx[dir] -= pos; + domain->minimum_image(dx[0], dx[1], dx[2]); + x_angle_left[0] = dx[0]; + x_angle_left[1] = dx[1]; + x_angle_left[2] = dx[2]; + x_angle_left[dir] += pos; + // minimum image of atom2 with respect to atom1 + dx_left[0] = x[atom2][0] - x_angle_left[0]; + dx_left[1] = x[atom2][1] - x_angle_left[1]; + dx_left[2] = x[atom2][2] - x_angle_left[2]; + domain->minimum_image(dx_left[0], dx_left[1], dx_left[2]); + x_angle_middle[0] = x_angle_left[0] + dx_left[0]; + x_angle_middle[1] = x_angle_left[1] + dx_left[1]; + x_angle_middle[2] = x_angle_left[2] + dx_left[2]; + + // minimum image of atom3 with respect to atom2 + dx_right[0] = x[atom3][0] - x_angle_middle[0]; + dx_right[1] = x[atom3][1] - x_angle_middle[1]; + dx_right[2] = x[atom3][2] - x_angle_middle[2]; + domain->minimum_image(dx_right[0], dx_right[1], dx_right[2]); + x_angle_right[0] = x_angle_middle[0] + dx_right[0]; + x_angle_right[1] = x_angle_middle[1] + dx_right[1]; + x_angle_right[2] = x_angle_middle[2] + dx_right[2]; + + // check if any bond vector crosses the plane of interest + double tau_right = (x_angle_right[dir] - pos) / (x_angle_right[dir] - x_angle_middle[dir]); + double tau_left = (x_angle_middle[dir] - pos) / (x_angle_middle[dir] - x_angle_left[dir]); + bool right_cross = ((tau_right >=0) && (tau_right <= 1)); + bool left_cross = ((tau_left >=0) && (tau_left <= 1)); + + // no bonds crossing the plane + if (!right_cross && !left_cross) continue; + + // compute the cos(theta) of the angle + r1 = sqrt(dx_left[0]*dx_left[0] + dx_left[1]*dx_left[1] + dx_left[2]*dx_left[2]); + r2 = sqrt(dx_right[0]*dx_right[0] + dx_right[1]*dx_right[1] + dx_right[2]*dx_right[2]); + cos_theta = (dx_right[0]*dx_left[0] + dx_right[1]*dx_left[1] + dx_right[2]*dx_left[2])/(r1*r2); + + if (cos_theta > 1.0) cos_theta = 1.0; + if (cos_theta < -1.0) cos_theta = -1.0; + + // The method returns derivative with regards to cos(theta) + angle->born_matrix(atype, atom1, atom2, atom3, duang, du2ang); + // only right bond crossing the plane + if (right_cross && !left_cross) + { + dcos_theta[0] = (dx_right[0]*cos_theta/r2 - dx_left[0]/r1)/r2; + dcos_theta[1] = (dx_right[1]*cos_theta/r2 - dx_left[1]/r1)/r2; + dcos_theta[2] = (dx_right[1]*cos_theta/r2 - dx_left[2]/r1)/r2; + } + + // only left bond crossing the plane + if (!right_cross && left_cross) + { + dcos_theta[0] = -(dx_left[0]*cos_theta/r1 - dx_right[0]/r2)/r1; + dcos_theta[1] = -(dx_left[1]*cos_theta/r1 - dx_right[1]/r2)/r1; + dcos_theta[2] = -(dx_left[2]*cos_theta/r1 - dx_right[2]/r2)/r1; + } + + // both bonds crossing the plane + if (right_cross && left_cross) + { + // due to right bond + dcos_theta[0] = -(dx_right[0]*cos_theta/r2 - dx_left[0]/r1)/r2; + dcos_theta[1] = -(dx_right[1]*cos_theta/r2 - dx_left[1]/r1)/r2; + dcos_theta[2] = -(dx_right[1]*cos_theta/r2 - dx_left[2]/r1)/r2; + + // due to left bond + dcos_theta[0] += (dx_left[0]*cos_theta/r1 - dx_right[0]/r2)/r1; + dcos_theta[1] += (dx_left[1]*cos_theta/r1 - dx_right[1]/r2)/r1; + dcos_theta[2] += (dx_left[2]*cos_theta/r1 - dx_right[2]/r2)/r1; + } + + // final contribution of the given angle term + local_contribution[0] += duang*dcos_theta[0]/area*nktv2p; + local_contribution[1] += duang*dcos_theta[1]/area*nktv2p; + local_contribution[2] += duang*dcos_theta[2]/area*nktv2p; + } + } + // loop over the keywords and if necessary add the angle contribution + int m {0}; + while (m Date: Wed, 24 May 2023 16:24:33 +0300 Subject: [PATCH 090/396] fixing bug with sign for angle contribution in compute_stress_mop.cpp --- src/EXTRA-COMPUTE/compute_stress_mop.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/EXTRA-COMPUTE/compute_stress_mop.cpp b/src/EXTRA-COMPUTE/compute_stress_mop.cpp index 139c5b5903..ff7c6d9e1b 100644 --- a/src/EXTRA-COMPUTE/compute_stress_mop.cpp +++ b/src/EXTRA-COMPUTE/compute_stress_mop.cpp @@ -705,14 +705,14 @@ void ComputeStressMop::compute_angles() if (right_cross && left_cross) { // due to right bond - dcos_theta[0] = -(dx_right[0]*cos_theta/r2 - dx_left[0]/r1)/r2; - dcos_theta[1] = -(dx_right[1]*cos_theta/r2 - dx_left[1]/r1)/r2; - dcos_theta[2] = -(dx_right[1]*cos_theta/r2 - dx_left[2]/r1)/r2; + dcos_theta[0] = (dx_right[0]*cos_theta/r2 - dx_left[0]/r1)/r2; + dcos_theta[1] = (dx_right[1]*cos_theta/r2 - dx_left[1]/r1)/r2; + dcos_theta[2] = (dx_right[1]*cos_theta/r2 - dx_left[2]/r1)/r2; // due to left bond - dcos_theta[0] += (dx_left[0]*cos_theta/r1 - dx_right[0]/r2)/r1; - dcos_theta[1] += (dx_left[1]*cos_theta/r1 - dx_right[1]/r2)/r1; - dcos_theta[2] += (dx_left[2]*cos_theta/r1 - dx_right[2]/r2)/r1; + dcos_theta[0] -= (dx_left[0]*cos_theta/r1 - dx_right[0]/r2)/r1; + dcos_theta[1] -= (dx_left[1]*cos_theta/r1 - dx_right[1]/r2)/r1; + dcos_theta[2] -= (dx_left[2]*cos_theta/r1 - dx_right[2]/r2)/r1; } // final contribution of the given angle term From c7c8b065a259979e7fcd3b6ccc777d3068a68d52 Mon Sep 17 00:00:00 2001 From: Evangelos Voyiatzis Date: Wed, 24 May 2023 16:49:35 +0300 Subject: [PATCH 091/396] fixing bug with sign issue for bond contribution in compute_stress_mop.cpp --- src/EXTRA-COMPUTE/compute_stress_mop.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/EXTRA-COMPUTE/compute_stress_mop.cpp b/src/EXTRA-COMPUTE/compute_stress_mop.cpp index ff7c6d9e1b..2454f93b7a 100644 --- a/src/EXTRA-COMPUTE/compute_stress_mop.cpp +++ b/src/EXTRA-COMPUTE/compute_stress_mop.cpp @@ -546,9 +546,10 @@ void ComputeStressMop::compute_bonds() rsq = dx[0] * dx[0] + dx[1] * dx[1] + dx[2] * dx[2]; bond->single(btype, rsq, atom1, atom2, fpair); - local_contribution[0] += fpair*dx[0]/area*nktv2p; - local_contribution[1] += fpair*dx[1]/area*nktv2p; - local_contribution[2] += fpair*dx[2]/area*nktv2p; + double sgn = copysign(1.0, x_bond_1[dir] - pos); + local_contribution[0] += sgn*fpair*dx[0]/area*nktv2p; + local_contribution[1] += sgn*fpair*dx[1]/area*nktv2p; + local_contribution[2] += sgn*fpair*dx[2]/area*nktv2p; } } } From 9ee40cceef79043d8c6c8c41e41093e227f97ff6 Mon Sep 17 00:00:00 2001 From: Evangelos Voyiatzis Date: Wed, 24 May 2023 17:01:13 +0300 Subject: [PATCH 092/396] fixing indexing issue and more sign problems for angle contributions --- src/EXTRA-COMPUTE/compute_stress_mop.cpp | 27 +++++++++++++----------- 1 file changed, 15 insertions(+), 12 deletions(-) diff --git a/src/EXTRA-COMPUTE/compute_stress_mop.cpp b/src/EXTRA-COMPUTE/compute_stress_mop.cpp index 2454f93b7a..63d671eee7 100644 --- a/src/EXTRA-COMPUTE/compute_stress_mop.cpp +++ b/src/EXTRA-COMPUTE/compute_stress_mop.cpp @@ -689,31 +689,34 @@ void ComputeStressMop::compute_angles() // only right bond crossing the plane if (right_cross && !left_cross) { - dcos_theta[0] = (dx_right[0]*cos_theta/r2 - dx_left[0]/r1)/r2; - dcos_theta[1] = (dx_right[1]*cos_theta/r2 - dx_left[1]/r1)/r2; - dcos_theta[2] = (dx_right[1]*cos_theta/r2 - dx_left[2]/r1)/r2; + double sgn = copysign(1.0, x_angle_right[dir] - pos); + dcos_theta[0] = sgn*(dx_right[0]*cos_theta/r2 - dx_left[0]/r1)/r2; + dcos_theta[1] = sgn*(dx_right[1]*cos_theta/r2 - dx_left[1]/r1)/r2; + dcos_theta[2] = sgn*(dx_right[2]*cos_theta/r2 - dx_left[2]/r1)/r2; } // only left bond crossing the plane if (!right_cross && left_cross) { - dcos_theta[0] = -(dx_left[0]*cos_theta/r1 - dx_right[0]/r2)/r1; - dcos_theta[1] = -(dx_left[1]*cos_theta/r1 - dx_right[1]/r2)/r1; - dcos_theta[2] = -(dx_left[2]*cos_theta/r1 - dx_right[2]/r2)/r1; + double sgn = copysign(1.0, x_angle_left[dir] - pos); + dcos_theta[0] = -sgn*(dx_left[0]*cos_theta/r1 - dx_right[0]/r2)/r1; + dcos_theta[1] = -sgn*(dx_left[1]*cos_theta/r1 - dx_right[1]/r2)/r1; + dcos_theta[2] = -sgn*(dx_left[2]*cos_theta/r1 - dx_right[2]/r2)/r1; } // both bonds crossing the plane if (right_cross && left_cross) { // due to right bond - dcos_theta[0] = (dx_right[0]*cos_theta/r2 - dx_left[0]/r1)/r2; - dcos_theta[1] = (dx_right[1]*cos_theta/r2 - dx_left[1]/r1)/r2; - dcos_theta[2] = (dx_right[1]*cos_theta/r2 - dx_left[2]/r1)/r2; + double sgn = copysign(1.0, x_angle_middle[dir] - pos); + dcos_theta[0] = -sgn*(dx_right[0]*cos_theta/r2 - dx_left[0]/r1)/r2; + dcos_theta[1] = -sgn*(dx_right[1]*cos_theta/r2 - dx_left[1]/r1)/r2; + dcos_theta[2] = -sgn*(dx_right[2]*cos_theta/r2 - dx_left[2]/r1)/r2; // due to left bond - dcos_theta[0] -= (dx_left[0]*cos_theta/r1 - dx_right[0]/r2)/r1; - dcos_theta[1] -= (dx_left[1]*cos_theta/r1 - dx_right[1]/r2)/r1; - dcos_theta[2] -= (dx_left[2]*cos_theta/r1 - dx_right[2]/r2)/r1; + dcos_theta[0] += sgn*(dx_left[0]*cos_theta/r1 - dx_right[0]/r2)/r1; + dcos_theta[1] += sgn*(dx_left[1]*cos_theta/r1 - dx_right[1]/r2)/r1; + dcos_theta[2] += sgn*(dx_left[2]*cos_theta/r1 - dx_right[2]/r2)/r1; } // final contribution of the given angle term From ecca46acf9fd283e2c40e57a3135618c9108a9eb Mon Sep 17 00:00:00 2001 From: Lars Veldscholte Date: Tue, 9 May 2023 17:11:06 +0200 Subject: [PATCH 093/396] Include bond interactions in force --- .../compute_stress_cartesian.cpp | 33 +++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/src/EXTRA-COMPUTE/compute_stress_cartesian.cpp b/src/EXTRA-COMPUTE/compute_stress_cartesian.cpp index 53ff70c561..d2b9fe7bd7 100644 --- a/src/EXTRA-COMPUTE/compute_stress_cartesian.cpp +++ b/src/EXTRA-COMPUTE/compute_stress_cartesian.cpp @@ -14,6 +14,7 @@ #include "compute_stress_cartesian.h" #include "atom.h" +#include "bond.h" #include "citeme.h" #include "comm.h" #include "domain.h" @@ -365,6 +366,38 @@ void ComputeStressCartesian::compute_array() } } + // Loop over all bonds + for (int i_bond = 0; i_bond < neighbor->nbondlist; i_bond++) { + // i == atom1, j == atom2 + int i = neighbor->bondlist[i_bond][0]; + int j = neighbor->bondlist[i_bond][1]; + int type = neighbor->bondlist[i_bond][2]; + + // Skip if one of both atoms is not in group + if (!(atom->mask[i] & groupbit)) continue; + if (!(atom->mask[j] & groupbit)) continue; + + // if newton_bond is off and atom2 is a ghost atom, only compute this on one processor + if (!force->newton_bond && j >= atom->nlocal) { + if (tag[i] > tag[j]) { + if ((tag[i] + tag[j]) % 2 == 0) continue; + } else if (tag[i] < tag[j]) { + if ((tag[i] < tag[j]) % 2 == 1) continue; + } + } + + double dx = x[j][0] - x[i][0]; + double dy = x[j][1] - x[i][1]; + double dz = x[j][2] - x[i][2]; + double rsq = dx*dx + dy*dy + dz*dz; + double xi = x[i][dir1] - boxlo[dir1]; + double yi = x[i][dir2] - boxlo[dir2]; + + double fbond; + force->bond->single(type, rsq, i, j, fbond); + compute_pressure(fbond, xi, yi, dx, dy, dz); + } + // normalize pressure for (bin = 0; bin < nbins1 * nbins2; bin++) { tdens[bin] *= invV; From e246864682f00655749a3a251965f82a81dae3d3 Mon Sep 17 00:00:00 2001 From: Lars Veldscholte Date: Wed, 24 May 2023 16:17:20 +0200 Subject: [PATCH 094/396] Refactor compute_array() and compute_pressure(): Remove unnecessary copies of variables, declare variables locally so they are properly scoped --- .../compute_stress_cartesian.cpp | 136 +++++++----------- 1 file changed, 52 insertions(+), 84 deletions(-) diff --git a/src/EXTRA-COMPUTE/compute_stress_cartesian.cpp b/src/EXTRA-COMPUTE/compute_stress_cartesian.cpp index d2b9fe7bd7..2f6e75b528 100644 --- a/src/EXTRA-COMPUTE/compute_stress_cartesian.cpp +++ b/src/EXTRA-COMPUTE/compute_stress_cartesian.cpp @@ -230,35 +230,16 @@ void ComputeStressCartesian::init_list(int /* id */, NeighList *ptr) void ComputeStressCartesian::compute_array() { - int i, j, ii, jj, inum, jnum, itype, jtype; - int bin, bin1, bin2; - tagint itag, jtag; - double xtmp, ytmp, ztmp, delx, dely, delz; - double rsq, fpair, factor_coul, factor_lj; - int *ilist, *jlist, *numneigh, **firstneigh; - double **x = atom->x; double **v = atom->v; - double *mass = atom->mass; tagint *tag = atom->tag; - int *type = atom->type; - int *mask = atom->mask; - int nlocal = atom->nlocal; - double *special_coul = force->special_coul; - double *special_lj = force->special_lj; - int newton_pair = force->newton_pair; double *boxlo = domain->boxlo; // invoke half neighbor list (will copy or build if necessary) neighbor->build_one(list); - inum = list->inum; - ilist = list->ilist; - numneigh = list->numneigh; - firstneigh = list->firstneigh; - // Zero arrays - for (bin = 0; bin < nbins1 * nbins2; bin++) { + for (int bin = 0; bin < nbins1 * nbins2; bin++) { tdens[bin] = 0; tpkxx[bin] = 0; tpkyy[bin] = 0; @@ -269,9 +250,9 @@ void ComputeStressCartesian::compute_array() } // calculate number density and kinetic contribution to pressure - for (i = 0; i < nlocal; i++) { - bin1 = (int) ((x[i][dir1] - boxlo[dir1]) / bin_width1) % nbins1; - bin2 = 0; + for (int i = 0; i < atom->nlocal; i++) { + int bin1 = (int) ((x[i][dir1] - boxlo[dir1]) / bin_width1) % nbins1; + int bin2 = 0; if (dims == 2) bin2 = (int) ((x[i][dir2] - boxlo[dir2]) / bin_width2) % nbins2; // Apply periodic boundary conditions and avoid out of range access @@ -295,73 +276,59 @@ void ComputeStressCartesian::compute_array() else if (bin2 >= nbins2) bin2 = nbins2 - 1; - j = bin1 + bin2 * nbins1; + int j = bin1 + bin2 * nbins1; tdens[j] += 1; - tpkxx[j] += mass[type[i]] * v[i][0] * v[i][0]; - tpkyy[j] += mass[type[i]] * v[i][1] * v[i][1]; - tpkzz[j] += mass[type[i]] * v[i][2] * v[i][2]; + tpkxx[j] += atom->mass[atom->type[i]] * v[i][0] * v[i][0]; + tpkyy[j] += atom->mass[atom->type[i]] * v[i][1] * v[i][1]; + tpkzz[j] += atom->mass[atom->type[i]] * v[i][2] * v[i][2]; } // loop over neighbors of my atoms - // skip if I or J are not in group - // for newton = 0 and J = ghost atom, - // need to ensure I,J pair is only output by one proc - // use same itag,jtag logic as in Neighbor::neigh_half_nsq() - // for flag = 0, just count pair interactions within force cutoff - // for flag = 1, calculate requested output fields + for (int ii = 0; ii < list->inum; ii++) { + int i = list->ilist[ii]; - Pair *pair = force->pair; - double **cutsq = force->pair->cutsq; + // skip if I or J are not in group + if (!(atom->mask[i] & groupbit)) continue; - double xi1, xi2; + double xi1 = x[i][dir1] - boxlo[dir1]; + double xi2 = x[i][dir2] - boxlo[dir2]; - for (ii = 0; ii < inum; ii++) { - i = ilist[ii]; - if (!(mask[i] & groupbit)) continue; - - xtmp = x[i][0]; - ytmp = x[i][1]; - ztmp = x[i][2]; - xi1 = x[i][dir1] - boxlo[dir1]; - xi2 = x[i][dir2] - boxlo[dir2]; - itag = tag[i]; - itype = type[i]; - jlist = firstneigh[i]; - jnum = numneigh[i]; - - for (jj = 0; jj < jnum; jj++) { - j = jlist[jj]; - factor_lj = special_lj[sbmask(j)]; - factor_coul = special_coul[sbmask(j)]; + for (int jj = 0; jj < list->numneigh[i]; jj++) { + int j = list->firstneigh[i][jj]; + double factor_lj = force->special_lj[sbmask(j)]; + double factor_coul = force->special_coul[sbmask(j)]; j &= NEIGHMASK; - if (!(mask[j] & groupbit)) continue; + if (!(atom->mask[j] & groupbit)) continue; - // itag = jtag is possible for long cutoffs that include images of self - // do calculation only on appropriate processor - if (newton_pair == 0 && j >= nlocal) { - jtag = tag[j]; - if (itag > jtag) { - if ((itag + jtag) % 2 == 0) continue; - } else if (itag < jtag) { - if ((itag + jtag) % 2 == 1) continue; + // for newton = 0 and J = ghost atom, need to ensure I,J pair is only output by one proc + // use same tag[i],tag[j] logic as in Neighbor::neigh_half_nsq() + if (force->newton_pair == 0 && j >= atom->nlocal) { + if (tag[i] > tag[j]) { + if ((tag[i] + tag[j]) % 2 == 0) continue; + } else if (tag[i] < tag[j]) { + if ((tag[i] + tag[j]) % 2 == 1) continue; } else { - if (x[j][2] < ztmp) continue; - if (x[j][2] == ztmp) { - if (x[j][1] < ytmp) continue; - if (x[j][1] == ytmp && x[j][0] < xtmp) continue; + // tag[i] = tag[j] is possible for long cutoffs that include images of self + if (x[j][2] < x[i][2]) continue; + if (x[j][2] == x[i][2]) { + if (x[j][1] < x[i][1]) continue; + if (x[j][1] == x[i][1] && x[j][0] < x[i][0]) continue; } } } - delx = x[j][0] - xtmp; - dely = x[j][1] - ytmp; - delz = x[j][2] - ztmp; - rsq = delx * delx + dely * dely + delz * delz; - jtype = type[j]; + double delx = x[j][0] - x[i][0]; + double dely = x[j][1] - x[i][1]; + double delz = x[j][2] - x[i][2]; + double rsq = delx * delx + dely * dely + delz * delz; // Check if inside cut-off - if (rsq >= cutsq[itype][jtype]) continue; - pair->single(i, j, itype, jtype, rsq, factor_coul, factor_lj, fpair); + int itype = atom->type[i]; + int jtype = atom->type[j]; + if (rsq >= force->pair->cutsq[itype][jtype]) continue; + + double fpair; + force->pair->single(i, j, itype, jtype, rsq, factor_coul, factor_lj, fpair); compute_pressure(fpair, xi1, xi2, delx, dely, delz); } } @@ -399,7 +366,7 @@ void ComputeStressCartesian::compute_array() } // normalize pressure - for (bin = 0; bin < nbins1 * nbins2; bin++) { + for (int bin = 0; bin < nbins1 * nbins2; bin++) { tdens[bin] *= invV; tpkxx[bin] *= invV; tpkyy[bin] *= invV; @@ -419,7 +386,7 @@ void ComputeStressCartesian::compute_array() MPI_Allreduce(tpczz, pczz, nbins1 * nbins2, MPI_DOUBLE, MPI_SUM, world); // populate array to output. - for (bin = 0; bin < nbins1 * nbins2; bin++) { + for (int bin = 0; bin < nbins1 * nbins2; bin++) { array[bin][0] = (bin % nbins1 + 0.5) * bin_width1; if (dims == 2) array[bin][1] = ((int) (bin / nbins1) + 0.5) * bin_width2; array[bin][0 + dims] = dens[bin]; @@ -435,25 +402,26 @@ void ComputeStressCartesian::compute_array() void ComputeStressCartesian::compute_pressure(double fpair, double xi, double yi, double delx, double dely, double delz) { - int bin1, bin2, next_bin1, next_bin2; double la = 0.0, lb = 0.0, l_sum = 0.0; double rij[3] = {delx, dely, delz}; - double l1 = 0.0, l2, rij1, rij2; - rij1 = rij[dir1]; - rij2 = rij[dir2]; + double rij1 = rij[dir1]; + double rij2 = rij[dir2]; - next_bin1 = (int) floor(xi / bin_width1); - next_bin2 = (int) floor(yi / bin_width2); + int next_bin1 = (int) floor(xi / bin_width1); + int next_bin2 = (int) floor(yi / bin_width2); // Integrating along line while (lb < 1.0) { - bin1 = next_bin1; - bin2 = next_bin2; + int bin1 = next_bin1; + int bin2 = next_bin2; + double l1; if (rij1 > 0) l1 = ((bin1 + 1) * bin_width1 - xi) / rij1; else l1 = (bin1 * bin_width1 - xi) / rij1; + + double l2; if (rij2 > 0) l2 = ((bin2 + 1) * bin_width2 - yi) / rij2; else From d66504be8159801f8efa1415344a5208d249ae41 Mon Sep 17 00:00:00 2001 From: rohskopf Date: Wed, 24 May 2023 11:39:05 -0600 Subject: [PATCH 095/396] Properly decorate energy/force compute --- examples/mliap/jax/in.run | 2 +- examples/mliap/jax/mliap_unified_jax.py | 29 ++++++++++++++++++++----- 2 files changed, 25 insertions(+), 6 deletions(-) diff --git a/examples/mliap/jax/in.run b/examples/mliap/jax/in.run index 354dfd769f..0685d58f08 100644 --- a/examples/mliap/jax/in.run +++ b/examples/mliap/jax/in.run @@ -32,4 +32,4 @@ fix 1 all nve #dump 4 all custom 1 forces.xyz fx fy fz thermo 50 -run 250 \ No newline at end of file +run 100 \ No newline at end of file diff --git a/examples/mliap/jax/mliap_unified_jax.py b/examples/mliap/jax/mliap_unified_jax.py index a2447d1cdb..b986b1247e 100644 --- a/examples/mliap/jax/mliap_unified_jax.py +++ b/examples/mliap/jax/mliap_unified_jax.py @@ -1,5 +1,9 @@ from lammps.mliap.mliap_unified_abc import MLIAPUnified import numpy as np +import jax +import jax.numpy as jnp +from jax import jit +from functools import partial class MLIAPUnifiedJAX(MLIAPUnified): @@ -13,6 +17,7 @@ class MLIAPUnifiedJAX(MLIAPUnified): # pair_coeff * * 1 1 self.epsilon = epsilon self.sigma = sigma + self.npair_max = 250000 def compute_gradients(self, data): """Test compute_gradients.""" @@ -22,12 +27,26 @@ class MLIAPUnifiedJAX(MLIAPUnified): def compute_forces(self, data): """Test compute_forces.""" - eij, fij = self.compute_pair_ef(data) - data.update_pair_energy(eij) - data.update_pair_forces(fij) + rij = data.rij - def compute_pair_ef(self, data): - rij = data.rij + # TODO: Take max npairs from the LAMMPS Cython side. + if (data.npairs > self.npair_max): + self.npair_max = data.npairs + + npad = self.npair_max - data.npairs + # TODO: Take pre-padded rij from the LAMMPS Cython side. + # This might account for ~2-3x slowdown compared to original LJ. + rij = np.pad(rij, ((0,npad), (0,0)), 'constant') + + eij, fij = self.compute_pair_ef(rij) + + data.update_pair_energy(np.array(np.double(eij))) + data.update_pair_forces(np.array(np.double(fij))) + + #@jax.jit # <-- This will error! See https://github.com/google/jax/issues/1251 + # @partial takes a function (e.g. jax.jit) as an arg. + @partial(jax.jit, static_argnums=(0,)) + def compute_pair_ef(self, rij): r2inv = 1.0 / np.sum(rij ** 2, axis=1) r6inv = r2inv * r2inv * r2inv From b2e5f93d490652d35dd67da8a1796b4912d7352a Mon Sep 17 00:00:00 2001 From: rohskopf Date: Wed, 24 May 2023 13:08:10 -0600 Subject: [PATCH 096/396] Use jax functions --- examples/mliap/jax/mliap_unified_jax.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/examples/mliap/jax/mliap_unified_jax.py b/examples/mliap/jax/mliap_unified_jax.py index b986b1247e..4625fbf7f7 100644 --- a/examples/mliap/jax/mliap_unified_jax.py +++ b/examples/mliap/jax/mliap_unified_jax.py @@ -17,6 +17,7 @@ class MLIAPUnifiedJAX(MLIAPUnified): # pair_coeff * * 1 1 self.epsilon = epsilon self.sigma = sigma + # TODO: Take this from the LAMMPS Cython side. self.npair_max = 250000 def compute_gradients(self, data): @@ -48,7 +49,7 @@ class MLIAPUnifiedJAX(MLIAPUnified): @partial(jax.jit, static_argnums=(0,)) def compute_pair_ef(self, rij): - r2inv = 1.0 / np.sum(rij ** 2, axis=1) + r2inv = 1.0 / jnp.sum(rij ** 2, axis=1) r6inv = r2inv * r2inv * r2inv lj1 = 4.0 * self.epsilon * self.sigma**12 @@ -56,5 +57,5 @@ class MLIAPUnifiedJAX(MLIAPUnified): eij = r6inv * (lj1 * r6inv - lj2) fij = r6inv * (3.0 * lj2 - 6.0 * lj2 * r6inv) * r2inv - fij = fij[:, np.newaxis] * rij - return eij, fij \ No newline at end of file + fij = fij[:, jnp.newaxis] * rij + return eij, fij From 29ba0e3f184337ed74b342d00521ee6835c1fd68 Mon Sep 17 00:00:00 2001 From: Linux-cpp-lisp <1473644+Linux-cpp-lisp@users.noreply.github.com> Date: Wed, 24 May 2023 18:15:56 -0700 Subject: [PATCH 097/396] Update MLIAP JAX example to use jax.grad --- examples/mliap/jax/mliap_unified_jax.py | 42 ++++++++++++++----------- 1 file changed, 23 insertions(+), 19 deletions(-) diff --git a/examples/mliap/jax/mliap_unified_jax.py b/examples/mliap/jax/mliap_unified_jax.py index 4625fbf7f7..d4e75ee5c0 100644 --- a/examples/mliap/jax/mliap_unified_jax.py +++ b/examples/mliap/jax/mliap_unified_jax.py @@ -5,10 +5,30 @@ import jax.numpy as jnp from jax import jit from functools import partial +# /- ensure epsilon and sigma are treated as compile-time constants +@partial(jit, static_argnums=(0, 1)) +def lj_potential(epsilon: float, sigma: float, rij): + # a pure function we can differentiate: + def _tot_e(rij): + r2inv = 1.0 / jnp.sum(rij ** 2, axis=1) + r6inv = r2inv * r2inv * r2inv + + lj1 = 4.0 * epsilon * sigma**12 + lj2 = 4.0 * epsilon * sigma**6 + + eij = r6inv * (lj1 * r6inv - lj2) + return jnp.sum(eij) + # /- construct a function computing _tot_e and its derivative + tot_e, fij = jax.value_and_grad(_tot_e)(rij) + return tot_e, fij + class MLIAPUnifiedJAX(MLIAPUnified): """Test implementation for MLIAPUnified.""" + epsilon: float + sigma: float + def __init__(self, element_types, epsilon=1.0, sigma=1.0, rcutfac=1.25): # ARGS: interface, element_types, ndescriptors, nparams, rcutfac super().__init__(None, element_types, 1, 3, rcutfac) @@ -39,23 +59,7 @@ class MLIAPUnifiedJAX(MLIAPUnified): # This might account for ~2-3x slowdown compared to original LJ. rij = np.pad(rij, ((0,npad), (0,0)), 'constant') - eij, fij = self.compute_pair_ef(rij) + e_tot, fij = lj_potential(rij) - data.update_pair_energy(np.array(np.double(eij))) - data.update_pair_forces(np.array(np.double(fij))) - - #@jax.jit # <-- This will error! See https://github.com/google/jax/issues/1251 - # @partial takes a function (e.g. jax.jit) as an arg. - @partial(jax.jit, static_argnums=(0,)) - def compute_pair_ef(self, rij): - - r2inv = 1.0 / jnp.sum(rij ** 2, axis=1) - r6inv = r2inv * r2inv * r2inv - - lj1 = 4.0 * self.epsilon * self.sigma**12 - lj2 = 4.0 * self.epsilon * self.sigma**6 - - eij = r6inv * (lj1 * r6inv - lj2) - fij = r6inv * (3.0 * lj2 - 6.0 * lj2 * r6inv) * r2inv - fij = fij[:, jnp.newaxis] * rij - return eij, fij + data.energy = e_tot.item() + data.update_pair_forces(np.array(fij, dtype=np.float64)) From 35a55068d7d1d2cd9448f36a4130fe4c88301989 Mon Sep 17 00:00:00 2001 From: rohskopf Date: Thu, 25 May 2023 01:35:08 -0600 Subject: [PATCH 098/396] Add input padded rij from LAMMPS Cython side --- examples/mliap/jax/mliap_unified_jax.py | 26 ++++++++----------------- src/ML-IAP/mliap_unified_couple.pyx | 11 +++++++++++ 2 files changed, 19 insertions(+), 18 deletions(-) diff --git a/examples/mliap/jax/mliap_unified_jax.py b/examples/mliap/jax/mliap_unified_jax.py index d4e75ee5c0..ee09392ee8 100644 --- a/examples/mliap/jax/mliap_unified_jax.py +++ b/examples/mliap/jax/mliap_unified_jax.py @@ -5,10 +5,9 @@ import jax.numpy as jnp from jax import jit from functools import partial -# /- ensure epsilon and sigma are treated as compile-time constants -@partial(jit, static_argnums=(0, 1)) -def lj_potential(epsilon: float, sigma: float, rij): - # a pure function we can differentiate: +@jax.jit +def lj_potential(epsilon, sigma, rij): + # A pure function we can differentiate: def _tot_e(rij): r2inv = 1.0 / jnp.sum(rij ** 2, axis=1) r6inv = r2inv * r2inv * r2inv @@ -17,8 +16,8 @@ def lj_potential(epsilon: float, sigma: float, rij): lj2 = 4.0 * epsilon * sigma**6 eij = r6inv * (lj1 * r6inv - lj2) - return jnp.sum(eij) - # /- construct a function computing _tot_e and its derivative + return 0.5 * jnp.sum(eij) + # Construct a function computing _tot_e and its derivative tot_e, fij = jax.value_and_grad(_tot_e)(rij) return tot_e, fij @@ -37,8 +36,6 @@ class MLIAPUnifiedJAX(MLIAPUnified): # pair_coeff * * 1 1 self.epsilon = epsilon self.sigma = sigma - # TODO: Take this from the LAMMPS Cython side. - self.npair_max = 250000 def compute_gradients(self, data): """Test compute_gradients.""" @@ -48,18 +45,11 @@ class MLIAPUnifiedJAX(MLIAPUnified): def compute_forces(self, data): """Test compute_forces.""" - rij = data.rij - # TODO: Take max npairs from the LAMMPS Cython side. - if (data.npairs > self.npair_max): - self.npair_max = data.npairs + # NOTE: Use data.rij_max with JAX. + rij = data.rij_max - npad = self.npair_max - data.npairs - # TODO: Take pre-padded rij from the LAMMPS Cython side. - # This might account for ~2-3x slowdown compared to original LJ. - rij = np.pad(rij, ((0,npad), (0,0)), 'constant') - - e_tot, fij = lj_potential(rij) + e_tot, fij = lj_potential(self.epsilon, self.sigma, rij) data.energy = e_tot.item() data.update_pair_forces(np.array(fij, dtype=np.float64)) diff --git a/src/ML-IAP/mliap_unified_couple.pyx b/src/ML-IAP/mliap_unified_couple.pyx index 3fde99a25e..25852a1c5f 100644 --- a/src/ML-IAP/mliap_unified_couple.pyx +++ b/src/ML-IAP/mliap_unified_couple.pyx @@ -281,6 +281,16 @@ cdef class MLIAPDataPy: return None return np.asarray( &self.data.rij[0][0]) + @property + def rij_max(self): + if self.data.rij is NULL: + return None + return np.asarray( &self.data.rij[0][0]) + + @property + def nneigh_max(self): + return self.data.nneigh_max + @write_only_property def graddesc(self, value): if self.data.graddesc is NULL: @@ -357,6 +367,7 @@ cdef public object mliap_unified_connect(char *fname, MLIAPDummyModel * model, unified_int.descriptor = descriptor unified.interface = unified_int + #print(unified_int) if unified.ndescriptors is None: raise ValueError("no descriptors set") From 8e6615918b0c7414664e17cea86378921d132069 Mon Sep 17 00:00:00 2001 From: Evangelos Voyiatzis Date: Thu, 25 May 2023 14:39:03 +0300 Subject: [PATCH 099/396] avoid crashing when no bonds or no angles exist --- src/EXTRA-COMPUTE/compute_stress_mop.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/EXTRA-COMPUTE/compute_stress_mop.h b/src/EXTRA-COMPUTE/compute_stress_mop.h index d1074e002a..791e18d624 100644 --- a/src/EXTRA-COMPUTE/compute_stress_mop.h +++ b/src/EXTRA-COMPUTE/compute_stress_mop.h @@ -44,6 +44,8 @@ class ComputeStressMop : public Compute { int me, nvalues, dir; int *which; + int bondflag, angleflag; + double *values_local, *values_global; double *bond_local, *bond_global; double *angle_local, *angle_global; From f26f397e087c183facd9e1cb108fe7f1b777a221 Mon Sep 17 00:00:00 2001 From: Evangelos Voyiatzis Date: Thu, 25 May 2023 14:47:20 +0300 Subject: [PATCH 100/396] avoid crashing when there are no bonds or no angles --- src/EXTRA-COMPUTE/compute_stress_mop.cpp | 27 ++++++++++++++++++------ 1 file changed, 20 insertions(+), 7 deletions(-) diff --git a/src/EXTRA-COMPUTE/compute_stress_mop.cpp b/src/EXTRA-COMPUTE/compute_stress_mop.cpp index 63d671eee7..e7a602e583 100644 --- a/src/EXTRA-COMPUTE/compute_stress_mop.cpp +++ b/src/EXTRA-COMPUTE/compute_stress_mop.cpp @@ -51,6 +51,9 @@ ComputeStressMop::ComputeStressMop(LAMMPS *lmp, int narg, char **arg) : MPI_Comm_rank(world,&me); + bondflag = 0; + angleflag = 0; + // set compute mode and direction of plane(s) for pressure calculation if (strcmp(arg[3],"x")==0) { @@ -201,11 +204,13 @@ void ComputeStressMop::init() //Compute stress/mop only accounts for pair interactions. // issue a warning if any intramolecular potential or Kspace is defined. - //if (force->bond!=nullptr) - // error->warning(FLERR,"compute stress/mop does not account for bond potentials"); + if (force->bond!=nullptr) bondflag = 1; if (force->angle!=nullptr) - if (force->angle->born_matrix_enable == 0) + if (force->angle->born_matrix_enable == 0) { error->warning(FLERR,"compute stress/mop does not account for angle potentials"); + } else { + angleflag = 1; + } if (force->dihedral!=nullptr) error->warning(FLERR,"compute stress/mop does not account for dihedral potentials"); if (force->improper!=nullptr) @@ -241,14 +246,22 @@ void ComputeStressMop::compute_vector() MPI_Allreduce(values_local,values_global,nvalues, MPI_DOUBLE,MPI_SUM,world); - //Compute bond contribution on separate procs - compute_bonds(); + if (bondflag) { + //Compute bond contribution on separate procs + compute_bonds(); + } else { + for (int i=0; i Date: Thu, 25 May 2023 12:58:57 -0600 Subject: [PATCH 101/396] Fixing mistakes in doc pages --- doc/src/compute_fabric.rst | 12 ++++++------ doc/src/pair_granular.rst | 2 +- src/GRANULAR/gran_sub_mod_normal.cpp | 2 +- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/doc/src/compute_fabric.rst b/doc/src/compute_fabric.rst index f1a5d3d7f9..b38ffafa48 100644 --- a/doc/src/compute_fabric.rst +++ b/doc/src/compute_fabric.rst @@ -146,13 +146,13 @@ m to :math:`M` (inclusive). A middle asterisk means all types from m to n Output info """"""""""" -This compute calculates a local vector of doubles and a scalar. The vector -stores the unique components of the first requested tensor in the order -:math:`xx`, :math:`yy`, :math:`zz`, :math:`xy`, :math:`xz`, :math:`yz` -followed by the same components for all subsequent tensors. +This compute calculates a global vector of doubles and a global scalar. The +vector stores the unique components of the first requested tensor in the +order :math:`xx`, :math:`yy`, :math:`zz`, :math:`xy`, :math:`xz`, +:math:`yz` followed by the same components for all subsequent tensors. The length of the vector is therefore six times the number of requested -tensors. The scalar output is the number of pairwise interactions included in -the calculation of the fabric tensor. +tensors. The scalar output is the number of pairwise interactions included +in the calculation of the fabric tensor. Restrictions """""""""""" diff --git a/doc/src/pair_granular.rst b/doc/src/pair_granular.rst index 0911a3486a..8a4d44fbf7 100644 --- a/doc/src/pair_granular.rst +++ b/doc/src/pair_granular.rst @@ -736,7 +736,7 @@ or .. math:: - E_{eff,ij} = \frac{E_{ij}}{2(1-\nu_{ij})} + E_{eff,ij} = \frac{E_{ij}}{2(1-\nu_{ij}^2)} These pair styles write their information to :doc:`binary restart files `, so a pair_style command does not need to be specified in an input script that reads a restart file. diff --git a/src/GRANULAR/gran_sub_mod_normal.cpp b/src/GRANULAR/gran_sub_mod_normal.cpp index 05639feb9d..f08892d6f2 100644 --- a/src/GRANULAR/gran_sub_mod_normal.cpp +++ b/src/GRANULAR/gran_sub_mod_normal.cpp @@ -167,7 +167,7 @@ void GranSubModNormalHertzMaterial::coeffs_to_local() void GranSubModNormalHertzMaterial::mix_coeffs(double* icoeffs, double* jcoeffs) { - coeffs[0] = mix_stiffnessE(icoeffs[0], jcoeffs[0],icoeffs[2], jcoeffs[2]); + coeffs[0] = mix_stiffnessE(icoeffs[0], jcoeffs[0], icoeffs[2], jcoeffs[2]); coeffs[1] = mix_geom(icoeffs[1], jcoeffs[1]); coeffs[2] = mix_geom(icoeffs[2], jcoeffs[2]); coeffs_to_local(); From edfb8cf10021ec15509a3cb04e306496222eeff4 Mon Sep 17 00:00:00 2001 From: jtclemm Date: Thu, 25 May 2023 13:54:12 -0600 Subject: [PATCH 102/396] Fixing double mixing of normal coeffs --- src/GRANULAR/gran_sub_mod_normal.cpp | 50 ++++++++++++++++++++-------- src/GRANULAR/gran_sub_mod_normal.h | 4 +++ 2 files changed, 40 insertions(+), 14 deletions(-) diff --git a/src/GRANULAR/gran_sub_mod_normal.cpp b/src/GRANULAR/gran_sub_mod_normal.cpp index f08892d6f2..9e19cab1f4 100644 --- a/src/GRANULAR/gran_sub_mod_normal.cpp +++ b/src/GRANULAR/gran_sub_mod_normal.cpp @@ -145,6 +145,7 @@ GranSubModNormalHertzMaterial::GranSubModNormalHertzMaterial(GranularModel *gm, material_properties = 1; num_coeffs = 3; contact_radius_flag = 1; + mixed_coefficients = 0; } /* ---------------------------------------------------------------------- */ @@ -154,10 +155,12 @@ void GranSubModNormalHertzMaterial::coeffs_to_local() Emod = coeffs[0]; damp = coeffs[1]; poiss = coeffs[2]; - if (gm->contact_type == PAIR) { - k = FOURTHIRDS * mix_stiffnessE(Emod, Emod, poiss, poiss); - } else { - k = FOURTHIRDS * mix_stiffnessE_wall(Emod, poiss); + if (!mixed_coefficients) { + if (gm->contact_type == PAIR) { + k = FOURTHIRDS * mix_stiffnessE(Emod, Emod, poiss, poiss); + } else { + k = FOURTHIRDS * mix_stiffnessE_wall(Emod, poiss); + } } if (Emod < 0.0 || damp < 0.0) error->all(FLERR, "Illegal Hertz material normal model"); @@ -170,6 +173,10 @@ void GranSubModNormalHertzMaterial::mix_coeffs(double* icoeffs, double* jcoeffs) coeffs[0] = mix_stiffnessE(icoeffs[0], jcoeffs[0], icoeffs[2], jcoeffs[2]); coeffs[1] = mix_geom(icoeffs[1], jcoeffs[1]); coeffs[2] = mix_geom(icoeffs[2], jcoeffs[2]); + + k = FOURTHIRDS * coeffs[0]; + mixed_coefficients = 1; + coeffs_to_local(); } @@ -183,6 +190,7 @@ GranSubModNormalDMT::GranSubModNormalDMT(GranularModel *gm, LAMMPS *lmp) : GranS cohesive_flag = 1; num_coeffs = 4; contact_radius_flag = 1; + mixed_coefficients = 0; } /* ---------------------------------------------------------------------- */ @@ -193,10 +201,13 @@ void GranSubModNormalDMT::coeffs_to_local() damp = coeffs[1]; poiss = coeffs[2]; cohesion = coeffs[3]; - if (gm->contact_type == PAIR) { - k = FOURTHIRDS * mix_stiffnessE(Emod, Emod, poiss, poiss); - } else { - k = FOURTHIRDS * mix_stiffnessE_wall(Emod, poiss); + + if (!mixed_coefficients) { + if (gm->contact_type == PAIR) { + k = FOURTHIRDS * mix_stiffnessE(Emod, Emod, poiss, poiss); + } else { + k = FOURTHIRDS * mix_stiffnessE_wall(Emod, poiss); + } } if (Emod < 0.0 || damp < 0.0) error->all(FLERR, "Illegal DMT normal model"); @@ -206,10 +217,14 @@ void GranSubModNormalDMT::coeffs_to_local() void GranSubModNormalDMT::mix_coeffs(double* icoeffs, double* jcoeffs) { - coeffs[0] = mix_stiffnessE(icoeffs[0], jcoeffs[0],icoeffs[2], jcoeffs[2]); + coeffs[0] = mix_stiffnessE(icoeffs[0], jcoeffs[0], icoeffs[2], jcoeffs[2]); coeffs[1] = mix_geom(icoeffs[1], jcoeffs[1]); coeffs[2] = mix_geom(icoeffs[2], jcoeffs[2]); coeffs[3] = mix_geom(icoeffs[3], jcoeffs[3]); + + k = FOURTHIRDS * coeffs[0]; + mixed_coefficients = 1; + coeffs_to_local(); } @@ -241,6 +256,7 @@ GranSubModNormalJKR::GranSubModNormalJKR(GranularModel *gm, LAMMPS *lmp) : GranS beyond_contact = 1; num_coeffs = 4; contact_radius_flag = 1; + mixed_coefficients = 0; } /* ---------------------------------------------------------------------- */ @@ -252,10 +268,12 @@ void GranSubModNormalJKR::coeffs_to_local() poiss = coeffs[2]; cohesion = coeffs[3]; - if (gm->contact_type == PAIR) { - Emix = mix_stiffnessE(Emod, Emod, poiss, poiss); - } else { - Emix = mix_stiffnessE_wall(Emod, poiss); + if (!mixed_coefficients) { + if (gm->contact_type == PAIR) { + Emix = mix_stiffnessE(Emod, Emod, poiss, poiss); + } else { + Emix = mix_stiffnessE_wall(Emod, poiss); + } } k = FOURTHIRDS * Emix; @@ -267,10 +285,14 @@ void GranSubModNormalJKR::coeffs_to_local() void GranSubModNormalJKR::mix_coeffs(double* icoeffs, double* jcoeffs) { - coeffs[0] = mix_stiffnessE(icoeffs[0], jcoeffs[0],icoeffs[2], jcoeffs[2]); + coeffs[0] = mix_stiffnessE(icoeffs[0], jcoeffs[0], icoeffs[2], jcoeffs[2]); coeffs[1] = mix_geom(icoeffs[1], jcoeffs[1]); coeffs[2] = mix_geom(icoeffs[2], jcoeffs[2]); coeffs[3] = mix_geom(icoeffs[3], jcoeffs[3]); + + Emix = coeffs[0]; + mixed_coefficients = 1; + coeffs_to_local(); } diff --git a/src/GRANULAR/gran_sub_mod_normal.h b/src/GRANULAR/gran_sub_mod_normal.h index ef022f864f..15e4c28701 100644 --- a/src/GRANULAR/gran_sub_mod_normal.h +++ b/src/GRANULAR/gran_sub_mod_normal.h @@ -99,6 +99,8 @@ class GranSubModNormalHertzMaterial : public GranSubModNormalHertz { GranSubModNormalHertzMaterial(class GranularModel *, class LAMMPS *); void coeffs_to_local() override; void mix_coeffs(double*, double*) override; + private: + int mixed_coefficients; }; /* ---------------------------------------------------------------------- */ @@ -113,6 +115,7 @@ class GranSubModNormalDMT : public GranSubModNormal { protected: double k, cohesion; double F_pulloff, Fne; + int mixed_coefficients; }; /* ---------------------------------------------------------------------- */ @@ -130,6 +133,7 @@ class GranSubModNormalJKR : public GranSubModNormal { protected: double k, cohesion; double Emix, F_pulloff, Fne; + int mixed_coefficients; }; } // namespace Granular_NS From 1fd34ffac602723d8279cad1274bc15554e5a8dc Mon Sep 17 00:00:00 2001 From: rohskopf Date: Thu, 25 May 2023 14:49:38 -0600 Subject: [PATCH 103/396] Update --- examples/mliap/jax/in.run | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/mliap/jax/in.run b/examples/mliap/jax/in.run index 0685d58f08..354dfd769f 100644 --- a/examples/mliap/jax/in.run +++ b/examples/mliap/jax/in.run @@ -32,4 +32,4 @@ fix 1 all nve #dump 4 all custom 1 forces.xyz fx fy fz thermo 50 -run 100 \ No newline at end of file +run 250 \ No newline at end of file From 3012426bd51261f04f5a87188dbb8fa80196ca16 Mon Sep 17 00:00:00 2001 From: Linux-cpp-lisp <1473644+Linux-cpp-lisp@users.noreply.github.com> Date: Thu, 25 May 2023 17:49:02 -0400 Subject: [PATCH 104/396] send eij to LAMMPS --- examples/mliap/jax/mliap_unified_jax.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/examples/mliap/jax/mliap_unified_jax.py b/examples/mliap/jax/mliap_unified_jax.py index ee09392ee8..96f9a067cc 100644 --- a/examples/mliap/jax/mliap_unified_jax.py +++ b/examples/mliap/jax/mliap_unified_jax.py @@ -15,11 +15,11 @@ def lj_potential(epsilon, sigma, rij): lj1 = 4.0 * epsilon * sigma**12 lj2 = 4.0 * epsilon * sigma**6 - eij = r6inv * (lj1 * r6inv - lj2) - return 0.5 * jnp.sum(eij) + eij = 0.5 * r6inv * (lj1 * r6inv - lj2) + return jnp.sum(eij), eij # Construct a function computing _tot_e and its derivative - tot_e, fij = jax.value_and_grad(_tot_e)(rij) - return tot_e, fij + (_, eij), fij = jax.value_and_grad(_tot_e, has_aux=True)(rij) + return eij, fij class MLIAPUnifiedJAX(MLIAPUnified): @@ -49,7 +49,7 @@ class MLIAPUnifiedJAX(MLIAPUnified): # NOTE: Use data.rij_max with JAX. rij = data.rij_max - e_tot, fij = lj_potential(self.epsilon, self.sigma, rij) + eij, fij = lj_potential(self.epsilon, self.sigma, rij) - data.energy = e_tot.item() + data.update_pair_energy(np.array(eij, dtype=np.float64)) data.update_pair_forces(np.array(fij, dtype=np.float64)) From 4174116014ef72d232511adaf4e9163d5fc94b58 Mon Sep 17 00:00:00 2001 From: rohskopf Date: Thu, 25 May 2023 16:02:45 -0600 Subject: [PATCH 105/396] Fix 1/2 factor in energy --- examples/mliap/jax/mliap_unified_jax.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/examples/mliap/jax/mliap_unified_jax.py b/examples/mliap/jax/mliap_unified_jax.py index 96f9a067cc..42134c19d2 100644 --- a/examples/mliap/jax/mliap_unified_jax.py +++ b/examples/mliap/jax/mliap_unified_jax.py @@ -15,8 +15,8 @@ def lj_potential(epsilon, sigma, rij): lj1 = 4.0 * epsilon * sigma**12 lj2 = 4.0 * epsilon * sigma**6 - eij = 0.5 * r6inv * (lj1 * r6inv - lj2) - return jnp.sum(eij), eij + eij = r6inv * (lj1 * r6inv - lj2) + return 0.5 * jnp.sum(eij), eij # Construct a function computing _tot_e and its derivative (_, eij), fij = jax.value_and_grad(_tot_e, has_aux=True)(rij) return eij, fij From 3d8df660c350b256bb6759f7c5783a5cf8af77f1 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Thu, 25 May 2023 18:08:42 -0400 Subject: [PATCH 106/396] make rigid water examples more realistic and consistent. avoid warnings. --- doc/src/Howto_spc.rst | 6 ++---- doc/src/Howto_tip3p.rst | 4 ++-- doc/src/Howto_tip4p.rst | 13 +++++++------ doc/src/Howto_tip5p.rst | 5 +++-- 4 files changed, 14 insertions(+), 14 deletions(-) diff --git a/doc/src/Howto_spc.rst b/doc/src/Howto_spc.rst index 6414d3b846..6dedfe40c4 100644 --- a/doc/src/Howto_spc.rst +++ b/doc/src/Howto_spc.rst @@ -69,15 +69,13 @@ SPC/E with rigid bonds. timestep 1.0 fix rigid all shake 0.0001 10 10000 b 1 a 1 minimize 0.0 0.0 1000 10000 - run 0 post no - reset_timestep 0 velocity all create 300.0 5463576 - fix integrate all nvt temp 300.0 300.0 1.0 + fix integrate all nvt temp 300.0 300.0 100.0 thermo_style custom step temp press etotal density pe ke thermo 1000 run 20000 upto - write_data tip4p.data nocoeff + write_data spce.data nocoeff .. _spce_molecule: .. code-block:: diff --git a/doc/src/Howto_tip3p.rst b/doc/src/Howto_tip3p.rst index 682c7f2640..5419b9ba1b 100644 --- a/doc/src/Howto_tip3p.rst +++ b/doc/src/Howto_tip3p.rst @@ -128,11 +128,11 @@ TIP3P with rigid bonds. fix rigid all shake 0.001 10 10000 b 1 a 1 minimize 0.0 0.0 1000 10000 - run 0 post no reset_timestep 0 + timestep 1.0 velocity all create 300.0 5463576 - fix integrate all nvt temp 300 300 1.0 + fix integrate all nvt temp 300 300 100.0 thermo_style custom step temp press etotal pe diff --git a/doc/src/Howto_tip4p.rst b/doc/src/Howto_tip4p.rst index 7775d43e76..4d9b514e0d 100644 --- a/doc/src/Howto_tip4p.rst +++ b/doc/src/Howto_tip4p.rst @@ -180,17 +180,17 @@ file changed): fix rigid all shake 0.001 10 10000 b 1 a 1 minimize 0.0 0.0 1000 10000 - run 0 post no reset_timestep 0 + timestep 1.0 velocity all create 300.0 5463576 - fix integrate all nvt temp 300 300 1.0 + fix integrate all nvt temp 300 300 100.0 thermo_style custom step temp press etotal pe thermo 1000 run 20000 - write_data tip3p.data nocoeff + write_data tip4p-implicit.data nocoeff Below is the code for a LAMMPS input file using the explicit method and a TIP4P molecule file. Because of using :doc:`fix rigid/nvt/small @@ -203,6 +203,7 @@ rigid/nvt/small can identify rigid bodies by their molecule ID: units real atom_style charge + atom_modify map array region box block -5 5 -5 5 -5 5 create_box 3 box @@ -219,14 +220,14 @@ rigid/nvt/small can identify rigid bodies by their molecule ID: molecule water tip4p.mol create_atoms 0 random 33 34564 NULL mol water 25367 overlap 1.33 - timestep 0.1 - fix integrate all rigid/nvt/small molecule temp 300.0 300.0 1.0 + timestep 0.5 + fix integrate all rigid/nvt/small molecule temp 300.0 300.0 100.0 velocity all create 300.0 5463576 thermo_style custom step temp press etotal density pe ke thermo 1000 run 20000 - write_data tip4p.data nocoeff + write_data tip4p-explicit.data nocoeff .. _tip4p_molecule: .. code-block:: diff --git a/doc/src/Howto_tip5p.rst b/doc/src/Howto_tip5p.rst index 21cc78a684..10674a04b6 100644 --- a/doc/src/Howto_tip5p.rst +++ b/doc/src/Howto_tip5p.rst @@ -91,6 +91,7 @@ ID: units real atom_style charge + atom_modify map array region box block -5 5 -5 5 -5 5 create_box 3 box @@ -107,8 +108,8 @@ ID: molecule water tip5p.mol create_atoms 0 random 33 34564 NULL mol water 25367 overlap 1.33 - timestep 0.20 - fix integrate all rigid/nvt/small molecule temp 300.0 300.0 1.0 + timestep 0.5 + fix integrate all rigid/nvt/small molecule temp 300.0 300.0 100.0 reset_timestep 0 velocity all create 300.0 5463576 From ff7bae17394d8ed47fb533e983d406ff28384d59 Mon Sep 17 00:00:00 2001 From: rohskopf Date: Thu, 25 May 2023 18:43:18 -0600 Subject: [PATCH 107/396] Add Kokkos getters --- src/KOKKOS/mliap_unified_couple_kokkos.pyx | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/KOKKOS/mliap_unified_couple_kokkos.pyx b/src/KOKKOS/mliap_unified_couple_kokkos.pyx index 5e274d7f36..bd94b79eb4 100644 --- a/src/KOKKOS/mliap_unified_couple_kokkos.pyx +++ b/src/KOKKOS/mliap_unified_couple_kokkos.pyx @@ -346,6 +346,16 @@ cdef class MLIAPDataPy: return None return create_array(self.data.dev, self.data.rij, [self.npairs,3],False) + @property + def rij_max(self): + if self.data.rij is NULL: + return None + return create_array(self.data.dev, self.data.rij, [self.nneigh_max,3], False) + + @property + def nneigh_max(self): + return self.data.nneigh_max + @write_only_property def graddesc(self, value): if self.data.graddesc is NULL: From b7146c900ffd09adfc7513691674a46de82cf83f Mon Sep 17 00:00:00 2001 From: rohskopf Date: Thu, 25 May 2023 18:58:56 -0600 Subject: [PATCH 108/396] Add instructions --- examples/mliap/jax/README.md | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/examples/mliap/jax/README.md b/examples/mliap/jax/README.md index 320d87e465..c56c9e6d93 100644 --- a/examples/mliap/jax/README.md +++ b/examples/mliap/jax/README.md @@ -27,6 +27,33 @@ Install LAMMPS: make -j4 make install-python +### Kokkos install + +Make sure you install cupy properly! + + python -m pip cupy + +Install LAMMPS. Take care to change `Kokkos_ARCH_*` flag: + + cmake ../cmake -DLAMMPS_EXCEPTIONS=yes \ + -DBUILD_SHARED_LIBS=yes \ + -DPKG_PYTHON=yes \ + -DPKG_ML-SNAP=yes \ + -DPKG_ML-IAP=yes \ + -DMLIAP_ENABLE_PYTHON=yes \ + -DPKG_KOKKOS=yes \ + -DKokkos_ARCH_TURING75=yes \ + -DKokkos_ENABLE_CUDA=yes \ + -DKokkos_ENABLE_OPENMP=yes \ + -DCMAKE_CXX_COMPILER=${HOME}/lammps/lib/kokkos/bin/nvcc_wrapper \ + -DPYTHON_EXECUTABLE:FILEPATH=`which python` + make -j + make install-python + +Run example: + + mpirun -np 1 lmp -k on g 1 -sf kk -pk kokkos newton on -in in.run + ### Wrapping JAX code Take inspiration from the `FitSNAP` ML-IAP wrapper: https://github.com/rohskopf/FitSNAP/blob/mliap-unified/fitsnap3lib/tools/write_unified.py From 6eb586e66fb9811d89083d072a0325aba2416e15 Mon Sep 17 00:00:00 2001 From: Linux-cpp-lisp <1473644+Linux-cpp-lisp@users.noreply.github.com> Date: Thu, 25 May 2023 21:03:32 -0400 Subject: [PATCH 109/396] update_atom_energy initial --- src/KOKKOS/mliap_unified_kokkos.cpp | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/src/KOKKOS/mliap_unified_kokkos.cpp b/src/KOKKOS/mliap_unified_kokkos.cpp index 1fdf039473..deb9cbc346 100644 --- a/src/KOKKOS/mliap_unified_kokkos.cpp +++ b/src/KOKKOS/mliap_unified_kokkos.cpp @@ -371,6 +371,25 @@ void LAMMPS_NS::update_pair_forces(MLIAPDataKokkosDevice *data, double *fij) } } +/* ---------------------------------------------------------------------- + set energy for i indexed atoms + ---------------------------------------------------------------------- */ + +void LAMMPS_NS::update_atom_energy(MLIAPDataKokkosDevice *data, double *ei) +{ + auto d_eatoms = data->eatoms; + const auto nlistatoms = data->nlistatoms; + + Kokkos::parallel_reduce(nlistatoms, KOKKOS_LAMBDA(int i, double &local_sum){ + double e = ei[i]; + // must not count any contribution where i is not a local atom + if (i < nlistatoms) { + d_eatoms[i] = e; + local_sum += e; + } + },*data->energy); +} + namespace LAMMPS_NS { template class MLIAPDummyModelKokkos; template class MLIAPDummyDescriptorKokkos; From 49b2c299a7ba44e95d958e1ed94005041373b811 Mon Sep 17 00:00:00 2001 From: rohskopf Date: Fri, 26 May 2023 10:48:58 -0600 Subject: [PATCH 110/396] Add Kokkos example --- examples/mliap/jax/README.md | 20 ++++-- examples/mliap/jax/in.run | 6 +- .../mliap/jax/mliap_unified_jax_kokkos.py | 62 +++++++++++++++++++ 3 files changed, 81 insertions(+), 7 deletions(-) create mode 100644 examples/mliap/jax/mliap_unified_jax_kokkos.py diff --git a/examples/mliap/jax/README.md b/examples/mliap/jax/README.md index c56c9e6d93..3a5fe0105c 100644 --- a/examples/mliap/jax/README.md +++ b/examples/mliap/jax/README.md @@ -54,11 +54,9 @@ Run example: mpirun -np 1 lmp -k on g 1 -sf kk -pk kokkos newton on -in in.run -### Wrapping JAX code +### Deploying JAX models on CPU -Take inspiration from the `FitSNAP` ML-IAP wrapper: https://github.com/rohskopf/FitSNAP/blob/mliap-unified/fitsnap3lib/tools/write_unified.py - -First define JAX model in `deploy_script.py`, which will wrap model with `write_unified`. +Use `deploy_script.py`, which will wrap model with `write_unified_jax`. python deploy_script.py @@ -66,4 +64,16 @@ This creates `.pkl` file to be loaded by LAMMPS ML-IAP Unified. Run LAMMPS with the model: - mpirun -np P lmp -in in.run \ No newline at end of file + mpirun -np P lmp -in in.run + +### Deploying JAX models in Kokkos + +Use `deploy_script_kokkos.py`, which will wrap model with `write_unified_jax_kokkos`. + + python deploy_script_kokkos.py + +This creates `.pkl` file to be loaded by LAMMPS ML-IAP Unified. + +Run LAMMPS with the model: + + mpirun -np 1 lmp -k on g 1 -sf kk -pk kokkos newton on -in in.run \ No newline at end of file diff --git a/examples/mliap/jax/in.run b/examples/mliap/jax/in.run index 354dfd769f..d0560e6620 100644 --- a/examples/mliap/jax/in.run +++ b/examples/mliap/jax/in.run @@ -31,5 +31,7 @@ fix 1 all nve #dump 4 all custom 1 forces.xyz fx fy fz -thermo 50 -run 250 \ No newline at end of file +dump 1 all xyz 10 dump.xyz + +thermo 1 +run 250 diff --git a/examples/mliap/jax/mliap_unified_jax_kokkos.py b/examples/mliap/jax/mliap_unified_jax_kokkos.py new file mode 100644 index 0000000000..5006936884 --- /dev/null +++ b/examples/mliap/jax/mliap_unified_jax_kokkos.py @@ -0,0 +1,62 @@ +from lammps.mliap.mliap_unified_abc import MLIAPUnified +import numpy as np +import jax +import jax.dlpack +import jax.numpy as jnp +from jax import jit +from functools import partial +import cupy + +@jax.jit +def lj_potential(epsilon, sigma, rij): + # A pure function we can differentiate: + def _tot_e(rij): + r2inv = 1.0 / jnp.sum(rij ** 2, axis=1) + r6inv = r2inv * r2inv * r2inv + + lj1 = 4.0 * epsilon * sigma**12 + lj2 = 4.0 * epsilon * sigma**6 + + eij = r6inv * (lj1 * r6inv - lj2) + return 0.5 * jnp.sum(eij), eij + # Construct a function computing _tot_e and its derivative + (_, eij), fij = jax.value_and_grad(_tot_e, has_aux=True)(rij) + return eij, fij + + +class MLIAPUnifiedJAXKokkos(MLIAPUnified): + """JAX wrapper for MLIAPUnified.""" + + epsilon: float + sigma: float + + def __init__(self, element_types, epsilon=1.0, sigma=1.0, rcutfac=1.25): + # ARGS: interface, element_types, ndescriptors, nparams, rcutfac + super().__init__(None, element_types, 1, 3, rcutfac) + # Mimicking the LJ pair-style: + # pair_style lj/cut 2.5 + # pair_coeff * * 1 1 + self.epsilon = epsilon + self.sigma = sigma + + def compute_gradients(self, data): + """Test compute_gradients.""" + + def compute_descriptors(self, data): + """Test compute_descriptors.""" + + def compute_forces(self, data): + """Test compute_forces.""" + + # NOTE: Use data.rij_max with JAX. + # dlpack requires cudnn: + rij = jax.dlpack.from_dlpack(data.rij_max.toDlpack()) + eij, fij = lj_potential(self.epsilon, self.sigma, rij) + + # Convert back to cupy. + eij = cupy.from_dlpack(jax.dlpack.to_dlpack(eij)).astype(np.float64) + fij = cupy.from_dlpack(jax.dlpack.to_dlpack(fij)).astype(np.float64) + + # Send to LAMMPS. + data.update_pair_energy(eij) + data.update_pair_forces(fij) From 87850f31cafb5c991a4a2520ac2c581f37586b97 Mon Sep 17 00:00:00 2001 From: rohskopf Date: Fri, 26 May 2023 11:18:37 -0600 Subject: [PATCH 111/396] Add Kokkos instructions --- examples/mliap/jax/README.md | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/examples/mliap/jax/README.md b/examples/mliap/jax/README.md index 3a5fe0105c..ccaa234034 100644 --- a/examples/mliap/jax/README.md +++ b/examples/mliap/jax/README.md @@ -29,9 +29,17 @@ Install LAMMPS: ### Kokkos install -Make sure you install cupy properly! +Use same Python dependencies as above, with some extra changes: - python -m pip cupy +1. Make sure you install cupy properly! E.g. + + python -m pip install cupy-cuda12x + +2. Install JAX for GPU/CUDA: + + python -m pip install --trusted-host storage.googleapis.com --upgrade "jax[cuda12_local]" -f https://storage.googleapis.com/jax-releases/jax_cuda_releases.html + +3. Install cudNN: https://developer.nvidia.com/cudnn Install LAMMPS. Take care to change `Kokkos_ARCH_*` flag: From 2e68930f2a1873826055223db7a6173be0e73b1f Mon Sep 17 00:00:00 2001 From: rohskopf Date: Fri, 26 May 2023 11:21:13 -0600 Subject: [PATCH 112/396] Format readme --- examples/mliap/jax/README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/examples/mliap/jax/README.md b/examples/mliap/jax/README.md index ccaa234034..5cc0c49f16 100644 --- a/examples/mliap/jax/README.md +++ b/examples/mliap/jax/README.md @@ -33,11 +33,11 @@ Use same Python dependencies as above, with some extra changes: 1. Make sure you install cupy properly! E.g. - python -m pip install cupy-cuda12x + python -m pip install cupy-cuda12x 2. Install JAX for GPU/CUDA: - python -m pip install --trusted-host storage.googleapis.com --upgrade "jax[cuda12_local]" -f https://storage.googleapis.com/jax-releases/jax_cuda_releases.html + python -m pip install --trusted-host storage.googleapis.com --upgrade "jax[cuda12_local]" -f https://storage.googleapis.com/jax-releases/jax_cuda_releases.html 3. Install cudNN: https://developer.nvidia.com/cudnn From b5a1c6d47f54ddb6bd2d646a8e51fe4a933fcc2c Mon Sep 17 00:00:00 2001 From: rohskopf Date: Fri, 26 May 2023 11:25:29 -0600 Subject: [PATCH 113/396] Declare update per atom function --- src/KOKKOS/mliap_unified_kokkos.h | 1 + 1 file changed, 1 insertion(+) diff --git a/src/KOKKOS/mliap_unified_kokkos.h b/src/KOKKOS/mliap_unified_kokkos.h index aad25891b0..1af7715dad 100644 --- a/src/KOKKOS/mliap_unified_kokkos.h +++ b/src/KOKKOS/mliap_unified_kokkos.h @@ -60,6 +60,7 @@ template MLIAPBuildUnifiedKokkos_t build_unified(char *, MLIAPDataKokkos *, LAMMPS *, char * = NULL); void update_pair_energy(MLIAPDataKokkosDevice *, double *); void update_pair_forces(MLIAPDataKokkosDevice *, double *); +void update_atom_energy(MLIAPDataKokkosDevice *, double *); } // namespace LAMMPS_NS From 16751b06b3c5c8949e164e709816f410d8d2b798 Mon Sep 17 00:00:00 2001 From: rohskopf Date: Fri, 26 May 2023 12:52:51 -0600 Subject: [PATCH 114/396] Add os env vars to allow more MPI procs --- examples/mliap/jax/mliap_unified_jax.py | 10 ++++++++-- examples/mliap/jax/mliap_unified_jax_kokkos.py | 7 +++++++ 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/examples/mliap/jax/mliap_unified_jax.py b/examples/mliap/jax/mliap_unified_jax.py index 42134c19d2..69cbee6221 100644 --- a/examples/mliap/jax/mliap_unified_jax.py +++ b/examples/mliap/jax/mliap_unified_jax.py @@ -4,11 +4,17 @@ import jax import jax.numpy as jnp from jax import jit from functools import partial +import os + +# Required else get `jaxlib.xla_extension.XlaRuntimeError: RESOURCE_EXHAUSTED: Out of memory` +os.environ["XLA_PYTHON_CLIENT_PREALLOCATE"]="false" +os.environ["XLA_PYTHON_CLIENT_MEM_FRACTION"]=".XX" +os.environ["XLA_PYTHON_CLIENT_ALLOCATOR"]="platform" @jax.jit def lj_potential(epsilon, sigma, rij): - # A pure function we can differentiate: def _tot_e(rij): + """A differentiable fn for total energy.""" r2inv = 1.0 / jnp.sum(rij ** 2, axis=1) r6inv = r2inv * r2inv * r2inv @@ -17,7 +23,7 @@ def lj_potential(epsilon, sigma, rij): eij = r6inv * (lj1 * r6inv - lj2) return 0.5 * jnp.sum(eij), eij - # Construct a function computing _tot_e and its derivative + # Compute _tot_e and its derivative. (_, eij), fij = jax.value_and_grad(_tot_e, has_aux=True)(rij) return eij, fij diff --git a/examples/mliap/jax/mliap_unified_jax_kokkos.py b/examples/mliap/jax/mliap_unified_jax_kokkos.py index 5006936884..fd7f106f47 100644 --- a/examples/mliap/jax/mliap_unified_jax_kokkos.py +++ b/examples/mliap/jax/mliap_unified_jax_kokkos.py @@ -6,6 +6,13 @@ import jax.numpy as jnp from jax import jit from functools import partial import cupy +import os + +# Required else get `jaxlib.xla_extension.XlaRuntimeError: RESOURCE_EXHAUSTED: Out of memory` +# Does not fix GPU problem with larger num. atoms. +#os.environ["XLA_PYTHON_CLIENT_PREALLOCATE"]="false" +#os.environ["XLA_PYTHON_CLIENT_MEM_FRACTION"]=".XX" +#os.environ["XLA_PYTHON_CLIENT_ALLOCATOR"]="platform" @jax.jit def lj_potential(epsilon, sigma, rij): From 01b481ec4f708ebeef3e856dcb3b9ab8ab53d289 Mon Sep 17 00:00:00 2001 From: Stan Moore Date: Fri, 26 May 2023 15:27:15 -0700 Subject: [PATCH 115/396] Small tweaks --- doc/src/fix_efield.rst | 10 +++++----- doc/src/fix_qeq_reaxff.rst | 3 +-- src/REAXFF/fix_qeq_reaxff.cpp | 3 +-- 3 files changed, 7 insertions(+), 9 deletions(-) diff --git a/doc/src/fix_efield.rst b/doc/src/fix_efield.rst index 271912097f..0b94f80b8c 100644 --- a/doc/src/fix_efield.rst +++ b/doc/src/fix_efield.rst @@ -136,10 +136,10 @@ due to the electric field were a spring-like F = kx, then the energy formula should be E = -0.5kx\^2. If you don't do this correctly, the minimization will not converge properly. -The *potential* keyword can be used as an alternative to the *energy* -keyword to specify the name of an atom-style variable, which is used to compute -the added electric potential to each atom as a function of its position. -The variable should have units of electric field times distance (that is, +The *potential* keyword can be used as an alternative to the *energy* keyword +to specify the name of an atom-style variable, which is used to compute the +added electric potential to each atom as a function of its position. The +variable should have units of electric field multiplied by distance (that is, in `units real`, the potential should be in volts). As with the *energy* keyword, the variable name is specified as "v_name". The energy added by this fix is then calculated as the electric potential multiplied by charge. @@ -149,7 +149,7 @@ in simulations with :doc:`fix qeq/reaxff`, since with variable charges the electric potential can be known beforehand but the energy cannot. A small additional benefit is that the *energy* keyword requires an additional conversion to energy units which the *potential* keyword avoids. Thus, when the -*potential* keyword is specified the *energy* keyword is ignored (the simulation +*potential* keyword is specified, the *energy* keyword is ignored (the simulation will proceed but with a warning issued). As with *energy*, the *potential* keyword is not allowed if the added field is a constant vector. diff --git a/doc/src/fix_qeq_reaxff.rst b/doc/src/fix_qeq_reaxff.rst index 4422ddc89c..00cfb6d3ce 100644 --- a/doc/src/fix_qeq_reaxff.rst +++ b/doc/src/fix_qeq_reaxff.rst @@ -133,8 +133,7 @@ vector may only have components in non-periodic directions. Equal-style variables can be used for electric field vector components without any further settings. Atom-style variables can be used for spatially-varying electric field vector components, but the resulting electric potential must be specified -as an atom-style variable using the (new) *potential* keyword for -`fix efield`. +as an atom-style variable using the *potential* keyword for `fix efield`. Related commands """""""""""""""" diff --git a/src/REAXFF/fix_qeq_reaxff.cpp b/src/REAXFF/fix_qeq_reaxff.cpp index 4c0864ac27..554b911151 100644 --- a/src/REAXFF/fix_qeq_reaxff.cpp +++ b/src/REAXFF/fix_qeq_reaxff.cpp @@ -1111,9 +1111,8 @@ void FixQEqReaxFF::get_chi_field() const double factor = -1.0/qe2f; - if (efield->varflag != FixEfield::CONSTANT) { + if (efield->varflag != FixEfield::CONSTANT) efield->update_efield_variables(); - } // atom selection is for the group of fix efield From 458cce76999318fa4dd990aa57f5506d782d6b40 Mon Sep 17 00:00:00 2001 From: Evangelos Voyiatzis Date: Sat, 27 May 2023 14:33:46 +0300 Subject: [PATCH 116/396] Updating unit test for mop to reflect the contribution from bonds --- unittest/commands/test_compute_global.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/unittest/commands/test_compute_global.cpp b/unittest/commands/test_compute_global.cpp index 6c365c8c2b..66a24f049f 100644 --- a/unittest/commands/test_compute_global.cpp +++ b/unittest/commands/test_compute_global.cpp @@ -225,9 +225,9 @@ TEST_F(ComputeGlobalTest, Geometry) EXPECT_DOUBLE_EQ(mom2[0], -0.022332069630161717); EXPECT_DOUBLE_EQ(mom2[1], -0.056896553865696115); EXPECT_DOUBLE_EQ(mom2[2], 0.069179891052881484); - EXPECT_DOUBLE_EQ(mop1[0], 3522311.3572200728); - EXPECT_DOUBLE_EQ(mop1[1], 2871104.9055934539); - EXPECT_DOUBLE_EQ(mop1[2], -4136077.5224247416); + EXPECT_DOUBLE_EQ(mop1[0], 3536584.0880458541); + EXPECT_DOUBLE_EQ(mop1[1], 2887485.033995091); + EXPECT_DOUBLE_EQ(mop1[2], -4154145.8952306858); EXPECT_DOUBLE_EQ(mop2[0][0], -8.0869239999999998); EXPECT_DOUBLE_EQ(mop2[0][1], 0.0); EXPECT_DOUBLE_EQ(mop2[0][2], 0.0); From b28ee36f000af8e90a70390b72f6d132312de43c Mon Sep 17 00:00:00 2001 From: Evangelos Voyiatzis Date: Sat, 27 May 2023 14:50:31 +0300 Subject: [PATCH 117/396] update documentation for compute stress/mop --- doc/src/compute_stress_mop.rst | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/doc/src/compute_stress_mop.rst b/doc/src/compute_stress_mop.rst index 4ad2261bb0..a8a3bc5660 100644 --- a/doc/src/compute_stress_mop.rst +++ b/doc/src/compute_stress_mop.rst @@ -117,8 +117,13 @@ size does not change in time, and axis-aligned planes. The method only works with two-body pair interactions, because it requires the class method pair->single() to be implemented. In -particular, it does not work with more than two-body pair interactions, -intra-molecular interactions, and long range (kspace) interactions. +particular, compute *stress/mop/profile* does not work with more than +two-body pair interactions, intra-molecular interactions, and long range +(kspace) interactions. Similarly, compute *stress/mop* does not work with more than +two-body pair interactions, long range (kspace) interactions and dihedral/improper +intramolecular interactions but works with all bond interactions with the class method +single() implemented and all angle interactions with the class method born_matrix() +implemented. Related commands """""""""""""""" From 4c4eb6ee1e00fcb0b7efefa8a6e47459e7dc5c33 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Sun, 28 May 2023 00:49:52 -0400 Subject: [PATCH 118/396] improve error message --- src/EXTRA-FIX/fix_electron_stopping.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/EXTRA-FIX/fix_electron_stopping.cpp b/src/EXTRA-FIX/fix_electron_stopping.cpp index 4a9421be6c..37f33f4ea0 100644 --- a/src/EXTRA-FIX/fix_electron_stopping.cpp +++ b/src/EXTRA-FIX/fix_electron_stopping.cpp @@ -175,7 +175,8 @@ void FixElectronStopping::post_force(int /*vflag*/) if (energy < Ecut) continue; if (energy < elstop_ranges[0][0]) continue; if (energy > elstop_ranges[0][table_entries - 1]) - error->one(FLERR, "Atom kinetic energy too high for fix electron/stopping"); + error->one(FLERR, "Fix electron/stopping: kinetic energy too high for atom {}: {} vs {}", + atom->tag[i], energy, elstop_ranges[0][table_entries - 1]); if (region) { // Only apply in the given region From f69b50408d98bc49ff0a6787e9ae59caea4d1a82 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Sun, 28 May 2023 11:47:32 -0400 Subject: [PATCH 119/396] improve error messages --- src/output.cpp | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/src/output.cpp b/src/output.cpp index 6282b85b76..ed8fa48831 100644 --- a/src/output.cpp +++ b/src/output.cpp @@ -276,7 +276,8 @@ void Output::setup(int memflag) auto nextrestart = static_cast (input->variable->compute_equal(ivar_restart_single)); if (nextrestart <= ntimestep) - error->all(FLERR,"Restart variable returned a bad timestep"); + error->all(FLERR,"Restart variable returned a bad next timestep: {} vs {}", + nextrestart, ntimestep); next_restart_single = nextrestart; } } else next_restart_single = update->laststep + 1; @@ -289,7 +290,8 @@ void Output::setup(int memflag) auto nextrestart = static_cast (input->variable->compute_equal(ivar_restart_double)); if (nextrestart <= ntimestep) - error->all(FLERR,"Restart variable returned a bad timestep"); + error->all(FLERR,"Restart variable returned a bad next timestep: {} vs {}", + nextrestart, ntimestep); next_restart_double = nextrestart; } } else next_restart_double = update->laststep + 1; @@ -401,7 +403,8 @@ void Output::write(bigint ntimestep) auto nextrestart = static_cast (input->variable->compute_equal(ivar_restart_single)); if (nextrestart <= ntimestep) - error->all(FLERR,"Restart variable returned a bad timestep"); + error->all(FLERR,"Restart variable returned a bad next timestep: {} vs {}", + nextrestart, ntimestep); next_restart_single = nextrestart; modify->addstep_compute(next_restart_single); } @@ -424,7 +427,8 @@ void Output::write(bigint ntimestep) auto nextrestart = static_cast (input->variable->compute_equal(ivar_restart_double)); if (nextrestart <= ntimestep) - error->all(FLERR,"Restart variable returned a bad timestep"); + error->all(FLERR,"Restart variable returned a bad next timestep: {} <= {}", + nextrestart, ntimestep); next_restart_double = nextrestart; modify->addstep_compute(next_restart_double); } @@ -647,7 +651,8 @@ void Output::reset_timestep(bigint ntimestep) auto nextrestart = static_cast (input->variable->compute_equal(ivar_restart_single)); if (nextrestart < ntimestep) - error->all(FLERR,"Restart variable returned a bad timestep"); + error->all(FLERR,"Restart variable returned a bad next timestep: {} <= {}", + nextrestart, ntimestep); update->ntimestep++; next_restart_single = nextrestart; modify->addstep_compute(next_restart_single); @@ -666,7 +671,8 @@ void Output::reset_timestep(bigint ntimestep) auto nextrestart = static_cast (input->variable->compute_equal(ivar_restart_double)); if (nextrestart < ntimestep) - error->all(FLERR,"Restart variable returned a bad timestep"); + error->all(FLERR,"Restart variable returned a bad next timestep: {} <= {}", + nextrestart, ntimestep); update->ntimestep++; next_restart_double = nextrestart; modify->addstep_compute(next_restart_double); From f9ee2ad42b991ed221da79f217e7f71d544427b0 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Sun, 28 May 2023 11:49:02 -0400 Subject: [PATCH 120/396] reorder thermo and dump output so dump styles include correct thermo data --- src/output.cpp | 90 +++++++++++++++++++++++++------------------------- 1 file changed, 45 insertions(+), 45 deletions(-) diff --git a/src/output.cpp b/src/output.cpp index ed8fa48831..6e57122ffe 100644 --- a/src/output.cpp +++ b/src/output.cpp @@ -190,6 +190,32 @@ void Output::setup(int memflag) { bigint ntimestep = update->ntimestep; + // print memory usage unless being called between multiple runs + + if (memflag) memory_usage(); + + // set next_thermo to multiple of every or variable eval if var defined + // ensure thermo output on last step of run + // thermo may invoke computes so wrap with clear/add + + modify->clearstep_compute(); + + thermo->header(); + thermo->compute(0); + last_thermo = ntimestep; + + if (var_thermo) { + next_thermo = static_cast + (input->variable->compute_equal(ivar_thermo)); + if (next_thermo <= ntimestep) + error->all(FLERR,"Thermo every variable returned a bad timestep"); + } else if (thermo_every) { + next_thermo = (ntimestep/thermo_every)*thermo_every + thermo_every; + next_thermo = MIN(next_thermo,update->laststep); + } else next_thermo = update->laststep; + + modify->addstep_compute(next_thermo); + // consider all dumps // decide whether to write snapshot and/or calculate next step for dump @@ -257,7 +283,7 @@ void Output::setup(int memflag) next_dump_any = MIN(next_dump_any,next_dump[idump]); } - // if no dumps, set next_dump_any to last+1 so will not influence next + // if no dumps, set next_dump_any to last+1 so will not influence next } else next_dump_any = update->laststep + 1; @@ -298,32 +324,6 @@ void Output::setup(int memflag) next_restart = MIN(next_restart_single,next_restart_double); } else next_restart = update->laststep + 1; - // print memory usage unless being called between multiple runs - - if (memflag) memory_usage(); - - // set next_thermo to multiple of every or variable eval if var defined - // ensure thermo output on last step of run - // thermo may invoke computes so wrap with clear/add - - modify->clearstep_compute(); - - thermo->header(); - thermo->compute(0); - last_thermo = ntimestep; - - if (var_thermo) { - next_thermo = static_cast - (input->variable->compute_equal(ivar_thermo)); - if (next_thermo <= ntimestep) - error->all(FLERR,"Thermo every variable returned a bad timestep"); - } else if (thermo_every) { - next_thermo = (ntimestep/thermo_every)*thermo_every + thermo_every; - next_thermo = MIN(next_thermo,update->laststep); - } else next_thermo = update->laststep; - - modify->addstep_compute(next_thermo); - // next = next timestep any output will be done next = MIN(next_dump_any,next_restart); @@ -338,6 +338,24 @@ void Output::setup(int memflag) void Output::write(bigint ntimestep) { + // ensure next_thermo forces output on last step of run + // thermo may invoke computes so wrap with clear/add + + if (next_thermo == ntimestep) { + modify->clearstep_compute(); + if (last_thermo != ntimestep) thermo->compute(1); + last_thermo = ntimestep; + if (var_thermo) { + next_thermo = static_cast + (input->variable->compute_equal(ivar_thermo)); + if (next_thermo <= ntimestep) + error->all(FLERR,"Thermo every variable returned a bad timestep"); + } else if (thermo_every) next_thermo += thermo_every; + else next_thermo = update->laststep; + next_thermo = MIN(next_thermo,update->laststep); + modify->addstep_compute(next_thermo); + } + // perform dump if its next_dump = current ntimestep // but not if it was already written on this step // set next_dump and also next_time_dump for mode_dump = 1 @@ -437,24 +455,6 @@ void Output::write(bigint ntimestep) next_restart = MIN(next_restart_single,next_restart_double); } - // ensure next_thermo forces output on last step of run - // thermo may invoke computes so wrap with clear/add - - if (next_thermo == ntimestep) { - modify->clearstep_compute(); - if (last_thermo != ntimestep) thermo->compute(1); - last_thermo = ntimestep; - if (var_thermo) { - next_thermo = static_cast - (input->variable->compute_equal(ivar_thermo)); - if (next_thermo <= ntimestep) - error->all(FLERR,"Thermo every variable returned a bad timestep"); - } else if (thermo_every) next_thermo += thermo_every; - else next_thermo = update->laststep; - next_thermo = MIN(next_thermo,update->laststep); - modify->addstep_compute(next_thermo); - } - // next = next timestep any output will be done next = MIN(next_dump_any,next_restart); From c934208a4a462ec55c4a25cadd6b6d3adc307edc Mon Sep 17 00:00:00 2001 From: jrgissing Date: Sun, 28 May 2023 14:07:25 -0400 Subject: [PATCH 121/396] only update ivector if it still exists --- src/atom.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/atom.cpp b/src/atom.cpp index f30ace174e..d5f8b64a52 100644 --- a/src/atom.cpp +++ b/src/atom.cpp @@ -2129,7 +2129,8 @@ void Atom::add_molecule_atom(Molecule *onemol, int iatom, int ilocal, tagint off // initialize custom per-atom properties to zero if present - for (int i = 0; i < nivector; ++i) ivector[i][ilocal] = 0; + for (int i = 0; i < nivector; ++i) + if (ivname[i] != nullptr) ivector[i][ilocal] = 0; for (int i = 0; i < ndvector; ++i) dvector[i][ilocal] = 0.0; for (int i = 0; i < niarray; ++i) for (int j = 0; j < icols[i]; ++j) From 86743bc0a6fa09ffd630d4d9220c76f60823d18d Mon Sep 17 00:00:00 2001 From: Evangelos Voyiatzis Date: Mon, 29 May 2023 10:59:18 +0300 Subject: [PATCH 122/396] Update compute_stress_mop.cpp The angle was computed using the dot product of the vectors x[atom2] - x[atom1] and x[atom3] - x[atom2]. This is not consistent with the lammps convention where the angle is computed using the dot product between x[atom1]-x[atom2] and x[atom3]-x[atom2]. --- src/EXTRA-COMPUTE/compute_stress_mop.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/EXTRA-COMPUTE/compute_stress_mop.cpp b/src/EXTRA-COMPUTE/compute_stress_mop.cpp index e7a602e583..d512ce4810 100644 --- a/src/EXTRA-COMPUTE/compute_stress_mop.cpp +++ b/src/EXTRA-COMPUTE/compute_stress_mop.cpp @@ -692,7 +692,7 @@ void ComputeStressMop::compute_angles() // compute the cos(theta) of the angle r1 = sqrt(dx_left[0]*dx_left[0] + dx_left[1]*dx_left[1] + dx_left[2]*dx_left[2]); r2 = sqrt(dx_right[0]*dx_right[0] + dx_right[1]*dx_right[1] + dx_right[2]*dx_right[2]); - cos_theta = (dx_right[0]*dx_left[0] + dx_right[1]*dx_left[1] + dx_right[2]*dx_left[2])/(r1*r2); + cos_theta = -(dx_right[0]*dx_left[0] + dx_right[1]*dx_left[1] + dx_right[2]*dx_left[2])/(r1*r2); if (cos_theta > 1.0) cos_theta = 1.0; if (cos_theta < -1.0) cos_theta = -1.0; From 3b38145d91b130b72a6770992efa35b282f0cfee Mon Sep 17 00:00:00 2001 From: Evangelos Voyiatzis Date: Mon, 29 May 2023 16:34:44 +0300 Subject: [PATCH 123/396] Update compute_stress_mop.cpp Fixing sign issues because I was considering the theta angle to be formed by vectors x[atom2] - x[atom1] & x[atom3] - x[atom2] instead of x[atom1] - x[atom2] & x[atom3] - x[atom2] as done in lammps --- src/EXTRA-COMPUTE/compute_stress_mop.cpp | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/src/EXTRA-COMPUTE/compute_stress_mop.cpp b/src/EXTRA-COMPUTE/compute_stress_mop.cpp index d512ce4810..a5f5969317 100644 --- a/src/EXTRA-COMPUTE/compute_stress_mop.cpp +++ b/src/EXTRA-COMPUTE/compute_stress_mop.cpp @@ -703,18 +703,18 @@ void ComputeStressMop::compute_angles() if (right_cross && !left_cross) { double sgn = copysign(1.0, x_angle_right[dir] - pos); - dcos_theta[0] = sgn*(dx_right[0]*cos_theta/r2 - dx_left[0]/r1)/r2; - dcos_theta[1] = sgn*(dx_right[1]*cos_theta/r2 - dx_left[1]/r1)/r2; - dcos_theta[2] = sgn*(dx_right[2]*cos_theta/r2 - dx_left[2]/r1)/r2; + dcos_theta[0] = sgn*(dx_right[0]*cos_theta/r2 + dx_left[0]/r1)/r2; + dcos_theta[1] = sgn*(dx_right[1]*cos_theta/r2 + dx_left[1]/r1)/r2; + dcos_theta[2] = sgn*(dx_right[2]*cos_theta/r2 + dx_left[2]/r1)/r2; } // only left bond crossing the plane if (!right_cross && left_cross) { double sgn = copysign(1.0, x_angle_left[dir] - pos); - dcos_theta[0] = -sgn*(dx_left[0]*cos_theta/r1 - dx_right[0]/r2)/r1; - dcos_theta[1] = -sgn*(dx_left[1]*cos_theta/r1 - dx_right[1]/r2)/r1; - dcos_theta[2] = -sgn*(dx_left[2]*cos_theta/r1 - dx_right[2]/r2)/r1; + dcos_theta[0] = -sgn*(dx_left[0]*cos_theta/r1 + dx_right[0]/r2)/r1; + dcos_theta[1] = -sgn*(dx_left[1]*cos_theta/r1 + dx_right[1]/r2)/r1; + dcos_theta[2] = -sgn*(dx_left[2]*cos_theta/r1 + dx_right[2]/r2)/r1; } // both bonds crossing the plane @@ -722,14 +722,14 @@ void ComputeStressMop::compute_angles() { // due to right bond double sgn = copysign(1.0, x_angle_middle[dir] - pos); - dcos_theta[0] = -sgn*(dx_right[0]*cos_theta/r2 - dx_left[0]/r1)/r2; - dcos_theta[1] = -sgn*(dx_right[1]*cos_theta/r2 - dx_left[1]/r1)/r2; - dcos_theta[2] = -sgn*(dx_right[2]*cos_theta/r2 - dx_left[2]/r1)/r2; + dcos_theta[0] = -sgn*(dx_right[0]*cos_theta/r2 + dx_left[0]/r1)/r2; + dcos_theta[1] = -sgn*(dx_right[1]*cos_theta/r2 + dx_left[1]/r1)/r2; + dcos_theta[2] = -sgn*(dx_right[2]*cos_theta/r2 + dx_left[2]/r1)/r2; // due to left bond - dcos_theta[0] += sgn*(dx_left[0]*cos_theta/r1 - dx_right[0]/r2)/r1; - dcos_theta[1] += sgn*(dx_left[1]*cos_theta/r1 - dx_right[1]/r2)/r1; - dcos_theta[2] += sgn*(dx_left[2]*cos_theta/r1 - dx_right[2]/r2)/r1; + dcos_theta[0] += sgn*(dx_left[0]*cos_theta/r1 + dx_right[0]/r2)/r1; + dcos_theta[1] += sgn*(dx_left[1]*cos_theta/r1 + dx_right[1]/r2)/r1; + dcos_theta[2] += sgn*(dx_left[2]*cos_theta/r1 + dx_right[2]/r2)/r1; } // final contribution of the given angle term From b3e9efcb50ded57acff46cc52305c59a0adb04a8 Mon Sep 17 00:00:00 2001 From: Evangelos Voyiatzis Date: Mon, 29 May 2023 17:55:24 +0300 Subject: [PATCH 124/396] Use system periodicity to find an equivalent position of the plane --- src/EXTRA-COMPUTE/compute_stress_mop.cpp | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/src/EXTRA-COMPUTE/compute_stress_mop.cpp b/src/EXTRA-COMPUTE/compute_stress_mop.cpp index a5f5969317..9249e4ce2d 100644 --- a/src/EXTRA-COMPUTE/compute_stress_mop.cpp +++ b/src/EXTRA-COMPUTE/compute_stress_mop.cpp @@ -74,6 +74,18 @@ ComputeStressMop::ComputeStressMop(LAMMPS *lmp, int narg, char **arg) : pos = 0.5*(domain->boxlo[dir]+domain->boxhi[dir]); } else pos = utils::numeric(FLERR,arg[4],false,lmp); + // plane inside the box + if (pos >domain->boxhi[dir] || pos boxlo[dir]) { + error->warning(FLERR,"The specified initial plane lies outside of the simulation box"); + double dx[3] {0}; + dx[dir] = pos - 0.5*(domain->boxhi[dir] + domain->boxlo[dir]); + domain->minimum_image(dx[0], dx[1], dx[2]); + pos = 0.5*(domain->boxhi[dir] + domain->boxlo[dir]) + dx[dir]; + + if (pos >domain->boxhi[dir] || pos boxlo[dir]) + error->all(FLERR, "Plane for compute stress/mop is out of bounds"); + } + if (pos < (domain->boxlo[dir]+domain->prd_half[dir])) { pos1 = pos + domain->prd[dir]; } else { @@ -117,10 +129,6 @@ ComputeStressMop::ComputeStressMop(LAMMPS *lmp, int narg, char **arg) : // orthogonal simulation box if (domain->triclinic != 0) error->all(FLERR, "Compute stress/mop incompatible with triclinic simulation box"); - // plane inside the box - if (pos >domain->boxhi[dir] || pos boxlo[dir]) - error->all(FLERR, "Plane for compute stress/mop is out of bounds"); - // Initialize some variables From 088d870e2062e7613b60f317eaccccd1dfff41cf Mon Sep 17 00:00:00 2001 From: jrgissing Date: Tue, 30 May 2023 17:17:54 -0400 Subject: [PATCH 125/396] check remaining per-atom initializations --- src/atom.cpp | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/src/atom.cpp b/src/atom.cpp index d5f8b64a52..3e9e177ae0 100644 --- a/src/atom.cpp +++ b/src/atom.cpp @@ -2131,13 +2131,16 @@ void Atom::add_molecule_atom(Molecule *onemol, int iatom, int ilocal, tagint off for (int i = 0; i < nivector; ++i) if (ivname[i] != nullptr) ivector[i][ilocal] = 0; - for (int i = 0; i < ndvector; ++i) dvector[i][ilocal] = 0.0; + for (int i = 0; i < ndvector; ++i) + if (dvname[i] != nullptr) dvector[i][ilocal] = 0.0; for (int i = 0; i < niarray; ++i) - for (int j = 0; j < icols[i]; ++j) - iarray[i][ilocal][j] = 0; + if (ianame[i] != nullptr) + for (int j = 0; j < icols[i]; ++j) + iarray[i][ilocal][j] = 0; for (int i = 0; i < ndarray; ++i) - for (int j = 0; j < dcols[i]; ++j) - darray[i][ilocal][j] = 0.0; + if (daname[i] != nullptr) + for (int j = 0; j < dcols[i]; ++j) + darray[i][ilocal][j] = 0.0; if (molecular != Atom::MOLECULAR) return; From ddc34e03d66452402993ec20203b12a089f2fe21 Mon Sep 17 00:00:00 2001 From: Lars Veldscholte Date: Wed, 31 May 2023 09:50:50 +0200 Subject: [PATCH 126/396] Revert removal of copies of pointers --- .../compute_stress_cartesian.cpp | 52 ++++++++++++------- 1 file changed, 32 insertions(+), 20 deletions(-) diff --git a/src/EXTRA-COMPUTE/compute_stress_cartesian.cpp b/src/EXTRA-COMPUTE/compute_stress_cartesian.cpp index 2f6e75b528..106ffef8fb 100644 --- a/src/EXTRA-COMPUTE/compute_stress_cartesian.cpp +++ b/src/EXTRA-COMPUTE/compute_stress_cartesian.cpp @@ -232,12 +232,24 @@ void ComputeStressCartesian::compute_array() { double **x = atom->x; double **v = atom->v; + double *mass = atom->mass; tagint *tag = atom->tag; + int *type = atom->type; + int *mask = atom->mask; + int nlocal = atom->nlocal; + double *special_coul = force->special_coul; + double *special_lj = force->special_lj; + int newton_pair = force->newton_pair; double *boxlo = domain->boxlo; // invoke half neighbor list (will copy or build if necessary) neighbor->build_one(list); + int inum = list->inum; + int *ilist = list->ilist; + int *numneigh = list->numneigh; + int **firstneigh = list->firstneigh; + // Zero arrays for (int bin = 0; bin < nbins1 * nbins2; bin++) { tdens[bin] = 0; @@ -250,7 +262,7 @@ void ComputeStressCartesian::compute_array() } // calculate number density and kinetic contribution to pressure - for (int i = 0; i < atom->nlocal; i++) { + for (int i = 0; i < nlocal; i++) { int bin1 = (int) ((x[i][dir1] - boxlo[dir1]) / bin_width1) % nbins1; int bin2 = 0; if (dims == 2) bin2 = (int) ((x[i][dir2] - boxlo[dir2]) / bin_width2) % nbins2; @@ -278,31 +290,31 @@ void ComputeStressCartesian::compute_array() int j = bin1 + bin2 * nbins1; tdens[j] += 1; - tpkxx[j] += atom->mass[atom->type[i]] * v[i][0] * v[i][0]; - tpkyy[j] += atom->mass[atom->type[i]] * v[i][1] * v[i][1]; - tpkzz[j] += atom->mass[atom->type[i]] * v[i][2] * v[i][2]; + tpkxx[j] += mass[type[i]] * v[i][0] * v[i][0]; + tpkyy[j] += mass[type[i]] * v[i][1] * v[i][1]; + tpkzz[j] += mass[type[i]] * v[i][2] * v[i][2]; } // loop over neighbors of my atoms - for (int ii = 0; ii < list->inum; ii++) { - int i = list->ilist[ii]; + for (int ii = 0; ii < inum; ii++) { + int i = ilist[ii]; // skip if I or J are not in group - if (!(atom->mask[i] & groupbit)) continue; + if (!(mask[i] & groupbit)) continue; double xi1 = x[i][dir1] - boxlo[dir1]; double xi2 = x[i][dir2] - boxlo[dir2]; - for (int jj = 0; jj < list->numneigh[i]; jj++) { - int j = list->firstneigh[i][jj]; - double factor_lj = force->special_lj[sbmask(j)]; - double factor_coul = force->special_coul[sbmask(j)]; + for (int jj = 0; jj < numneigh[i]; jj++) { + int j = firstneigh[i][jj]; + double factor_lj = special_lj[sbmask(j)]; + double factor_coul = special_coul[sbmask(j)]; j &= NEIGHMASK; - if (!(atom->mask[j] & groupbit)) continue; + if (!(mask[j] & groupbit)) continue; // for newton = 0 and J = ghost atom, need to ensure I,J pair is only output by one proc // use same tag[i],tag[j] logic as in Neighbor::neigh_half_nsq() - if (force->newton_pair == 0 && j >= atom->nlocal) { + if (newton_pair == 0 && j >= nlocal) { if (tag[i] > tag[j]) { if ((tag[i] + tag[j]) % 2 == 0) continue; } else if (tag[i] < tag[j]) { @@ -323,8 +335,8 @@ void ComputeStressCartesian::compute_array() double rsq = delx * delx + dely * dely + delz * delz; // Check if inside cut-off - int itype = atom->type[i]; - int jtype = atom->type[j]; + int itype = type[i]; + int jtype = type[j]; if (rsq >= force->pair->cutsq[itype][jtype]) continue; double fpair; @@ -338,14 +350,14 @@ void ComputeStressCartesian::compute_array() // i == atom1, j == atom2 int i = neighbor->bondlist[i_bond][0]; int j = neighbor->bondlist[i_bond][1]; - int type = neighbor->bondlist[i_bond][2]; + int btype = neighbor->bondlist[i_bond][2]; // Skip if one of both atoms is not in group - if (!(atom->mask[i] & groupbit)) continue; - if (!(atom->mask[j] & groupbit)) continue; + if (!(mask[i] & groupbit)) continue; + if (!(mask[j] & groupbit)) continue; // if newton_bond is off and atom2 is a ghost atom, only compute this on one processor - if (!force->newton_bond && j >= atom->nlocal) { + if (!force->newton_bond && j >= nlocal) { if (tag[i] > tag[j]) { if ((tag[i] + tag[j]) % 2 == 0) continue; } else if (tag[i] < tag[j]) { @@ -361,7 +373,7 @@ void ComputeStressCartesian::compute_array() double yi = x[i][dir2] - boxlo[dir2]; double fbond; - force->bond->single(type, rsq, i, j, fbond); + force->bond->single(btype, rsq, i, j, fbond); compute_pressure(fbond, xi, yi, dx, dy, dz); } From 69c549363171fb98524e49b09ac2461ff079f2eb Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Wed, 31 May 2023 09:09:35 -0400 Subject: [PATCH 127/396] silence compiler warning --- src/variable.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/variable.cpp b/src/variable.cpp index 783ceab832..81f0bdcfd6 100644 --- a/src/variable.cpp +++ b/src/variable.cpp @@ -1052,7 +1052,7 @@ char *Variable::retrieve(const char *name) if (vecs[ivar].dynamic || vecs[ivar].currentstep != update->ntimestep) { eval_in_progress[ivar] = 0; double *result; - int nvec = compute_vector(ivar,&result); + compute_vector(ivar,&result); delete[] data[ivar][1]; std::vector vectmp(vecs[ivar].values,vecs[ivar].values + vecs[ivar].n); std::string str = fmt::format("[{}]", fmt::join(vectmp,",")); From c0602b65000f654bfa8e19619e63ab899342ad88 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Wed, 31 May 2023 13:20:35 -0400 Subject: [PATCH 128/396] make using energy and potential keyword at the same time an error --- src/fix_efield.cpp | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/src/fix_efield.cpp b/src/fix_efield.cpp index d2c0dc1ef6..d01a498d39 100644 --- a/src/fix_efield.cpp +++ b/src/fix_efield.cpp @@ -58,7 +58,7 @@ FixEfield::FixEfield(LAMMPS *lmp, int narg, char **arg) : virial_global_flag = virial_peratom_flag = 1; qe2f = force->qe2f; - xstr = ystr = zstr = nullptr; + xstyle = ystyle = zstyle = estyle = pstyle = NONE; if (utils::strmatch(arg[3], "^v_")) { xstr = utils::strdup(arg[3] + 2); @@ -113,6 +113,9 @@ FixEfield::FixEfield(LAMMPS *lmp, int narg, char **arg) : } } + if (estr && pstr) + error->all(FLERR, "Must not use energy and potential keywords at the same time with fix efield"); + force_flag = 0; fsum[0] = fsum[1] = fsum[2] = fsum[3] = 0.0; @@ -174,6 +177,7 @@ void FixEfield::init() else error->all(FLERR, "Variable {} for x-field in fix {} is invalid style", xstr, style); } + if (ystr) { yvar = input->variable->find(ystr); if (yvar < 0) error->all(FLERR, "Variable {} for y-field in fix {} does not exist", ystr, style); @@ -184,6 +188,7 @@ void FixEfield::init() else error->all(FLERR, "Variable {} for y-field in fix {} is invalid style", ystr, style); } + if (zstr) { zvar = input->variable->find(zstr); if (zvar < 0) error->all(FLERR, "Variable {} for z-field in fix {} does not exist", zstr, style); @@ -194,6 +199,7 @@ void FixEfield::init() else error->all(FLERR, "Variable {} for z-field in fix {} is invalid style", zstr, style); } + if (estr) { evar = input->variable->find(estr); if (evar < 0) error->all(FLERR, "Variable {} for energy in fix {} does not exist", estr, style); @@ -201,8 +207,8 @@ void FixEfield::init() estyle = ATOM; else error->all(FLERR, "Variable {} for energy in fix {} must be atom-style", estr, style); - } else - estyle = NONE; + } + if (pstr) { pvar = input->variable->find(pstr); if (pvar < 0) error->all(FLERR, "Variable {} for potential in fix {} does not exist", pstr, style); @@ -210,11 +216,7 @@ void FixEfield::init() pstyle = ATOM; else error->all(FLERR, "Variable {} for potential in fix {} must be atom-style", pstr, style); - if (estyle != NONE) - error->warning(FLERR, "fix {} will ignore variable {} for energy " - "because atom-style potential has been specified", estr, style); - } else - pstyle = NONE; + } // set index and check validity of region From cb02563d3d749d46a8ee69dc2c64a6bf27f5c226 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Wed, 31 May 2023 13:29:41 -0400 Subject: [PATCH 129/396] the potential keyword is not (yet) supported by fix efield/tip4p --- src/EXTRA-FIX/fix_efield_tip4p.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/EXTRA-FIX/fix_efield_tip4p.cpp b/src/EXTRA-FIX/fix_efield_tip4p.cpp index 3d6a2f66b7..47b1d9e27a 100644 --- a/src/EXTRA-FIX/fix_efield_tip4p.cpp +++ b/src/EXTRA-FIX/fix_efield_tip4p.cpp @@ -47,6 +47,7 @@ void FixEfieldTIP4P::init() if (atom->tag_enable == 0) error->all(FLERR, "Fix efield/tip4p requires atom IDs"); if (!atom->q_flag) error->all(FLERR, "Fix efield/tip4p requires atom attribute q"); if (!force->pair) error->all(FLERR, "A TIP4P pair style must be defined fix efield/tip4p"); + if (pstr) error->all(FLERR, "Fix efield/tip4p does not support the potential keyword"); int itmp; double *p_qdist = (double *) force->pair->extract("qdist", itmp); From 90000ca166c14c34e59306c7751b6d77ee71a168 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Wed, 31 May 2023 13:29:48 -0400 Subject: [PATCH 130/396] update docs --- doc/src/fix_efield.rst | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/doc/src/fix_efield.rst b/doc/src/fix_efield.rst index 0b94f80b8c..4cf92cf946 100644 --- a/doc/src/fix_efield.rst +++ b/doc/src/fix_efield.rst @@ -28,7 +28,7 @@ Syntax *energy* value = v_name v_name = variable with name that calculates the potential energy of each atom in the added E-field *potential* value = v_name - v_name = variable with name that calculates the electric potential of each atom in the added E-field (overrides *energy*) + v_name = variable with name that calculates the electric potential of each atom in the added E-field Examples """""""" @@ -136,6 +136,8 @@ due to the electric field were a spring-like F = kx, then the energy formula should be E = -0.5kx\^2. If you don't do this correctly, the minimization will not converge properly. +.. versionadded:: TBD + The *potential* keyword can be used as an alternative to the *energy* keyword to specify the name of an atom-style variable, which is used to compute the added electric potential to each atom as a function of its position. The @@ -144,14 +146,16 @@ in `units real`, the potential should be in volts). As with the *energy* keyword, the variable name is specified as "v_name". The energy added by this fix is then calculated as the electric potential multiplied by charge. -The *potential* keyword is mainly intended for correct charge equilibration -in simulations with :doc:`fix qeq/reaxff`, since with variable -charges the electric potential can be known beforehand but the energy cannot. -A small additional benefit is that the *energy* keyword requires an additional -conversion to energy units which the *potential* keyword avoids. Thus, when the -*potential* keyword is specified, the *energy* keyword is ignored (the simulation -will proceed but with a warning issued). As with *energy*, the *potential* -keyword is not allowed if the added field is a constant vector. +The *potential* keyword is mainly intended for correct charge +equilibration in simulations with :doc:`fix qeq/reaxff`, +since with variable charges the electric potential can be known +beforehand but the energy cannot. A small additional benefit is that +the *energy* keyword requires an additional conversion to energy units +which the *potential* keyword avoids. Thus, when the *potential* +keyword is specified, the *energy* keyword must not be used. As with +*energy*, the *potential* keyword is not allowed if the added field is a +constant vector. The *potential* keyword is not supported by *fix +efield/tip4p*. ---------- From 6138b2b1f78e223c5e0d00d614d5399c3849a8ed Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Wed, 31 May 2023 13:31:45 -0400 Subject: [PATCH 131/396] fix grammar --- src/variable.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/variable.cpp b/src/variable.cpp index 81f0bdcfd6..437e4ac917 100644 --- a/src/variable.cpp +++ b/src/variable.cpp @@ -224,7 +224,7 @@ void Variable::set(int narg, char **arg) if (narg == 5 && strcmp(arg[4],"pad") == 0) { pad[nvar] = fmt::format("{}",nlast).size(); } else pad[nvar] = 0; - } else error->all(FLERR,"Illegal variable loop command: too much arguments"); + } else error->all(FLERR,"Illegal variable loop command: too many arguments"); num[nvar] = nlast; which[nvar] = nfirst-1; data[nvar] = new char*[1]; From cae2414126faa47448a8d7d4822cc5659b2b3241 Mon Sep 17 00:00:00 2001 From: Stan Gerald Moore Date: Wed, 31 May 2023 13:09:07 -0600 Subject: [PATCH 132/396] Fix compiler warnings in Kokkos ACKS2 --- src/KOKKOS/fix_acks2_reaxff_kokkos.h | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/src/KOKKOS/fix_acks2_reaxff_kokkos.h b/src/KOKKOS/fix_acks2_reaxff_kokkos.h index 3e89cb4d43..127c8d0402 100644 --- a/src/KOKKOS/fix_acks2_reaxff_kokkos.h +++ b/src/KOKKOS/fix_acks2_reaxff_kokkos.h @@ -66,10 +66,10 @@ class FixACKS2ReaxFFKokkos : public FixACKS2ReaxFF, public KokkosBase { FixACKS2ReaxFFKokkos(class LAMMPS *, int, char **); ~FixACKS2ReaxFFKokkos(); + void init() override; + void setup_pre_force(int) override; + void pre_force(int) override; void cleanup_copy(); - void init(); - void setup_pre_force(int); - void pre_force(int); DAT::tdual_ffloat_1d get_s() {return k_s;} @@ -235,11 +235,11 @@ class FixACKS2ReaxFFKokkos : public FixACKS2ReaxFF, public KokkosBase { void init_shielding_k(); void init_hist(); - void allocate_matrix(); + void allocate_matrix() override; void allocate_array(); void deallocate_array(); int bicgstab_solve(); - void calculate_Q(); + void calculate_Q() override; int neighflag; int nlocal,nall,nmax,newton_pair; @@ -251,13 +251,13 @@ class FixACKS2ReaxFFKokkos : public FixACKS2ReaxFF, public KokkosBase { typename AT::t_int_2d d_sendlist; typename AT::t_xfloat_1d_um v_buf; - void grow_arrays(int); - void copy_arrays(int, int, int); + void grow_arrays(int) override; + void copy_arrays(int, int, int) override; void sort_kokkos(Kokkos::BinSort &Sorter) override; - int pack_exchange(int, double *); - int unpack_exchange(int, double *); - void get_chi_field(); - double memory_usage(); + int pack_exchange(int, double *) override; + int unpack_exchange(int, double *) override; + void get_chi_field() override; + double memory_usage() override; void sparse_matvec_acks2(typename AT::t_ffloat_1d &, typename AT::t_ffloat_1d &); }; From a0461d29ddc23485c5995490bdbb126b0e917cfb Mon Sep 17 00:00:00 2001 From: Jacob Gissinger Date: Wed, 31 May 2023 17:04:49 -0400 Subject: [PATCH 133/396] Update atom.cpp --- src/atom.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/atom.cpp b/src/atom.cpp index 3e9e177ae0..08e9639440 100644 --- a/src/atom.cpp +++ b/src/atom.cpp @@ -2130,15 +2130,15 @@ void Atom::add_molecule_atom(Molecule *onemol, int iatom, int ilocal, tagint off // initialize custom per-atom properties to zero if present for (int i = 0; i < nivector; ++i) - if (ivname[i] != nullptr) ivector[i][ilocal] = 0; + if (ivname[i]) ivector[i][ilocal] = 0; for (int i = 0; i < ndvector; ++i) - if (dvname[i] != nullptr) dvector[i][ilocal] = 0.0; + if (dvname[i]) dvector[i][ilocal] = 0.0; for (int i = 0; i < niarray; ++i) - if (ianame[i] != nullptr) + if (ianame[i]) for (int j = 0; j < icols[i]; ++j) iarray[i][ilocal][j] = 0; for (int i = 0; i < ndarray; ++i) - if (daname[i] != nullptr) + if (daname[i]) for (int j = 0; j < dcols[i]; ++j) darray[i][ilocal][j] = 0.0; From ea6ece510edc25cc8f381d7d67e546f62bbd8058 Mon Sep 17 00:00:00 2001 From: Evangelos Voyiatzis Date: Thu, 1 Jun 2023 10:22:01 +0300 Subject: [PATCH 134/396] turning warning into errors for unsupported styles --- src/EXTRA-COMPUTE/compute_stress_mop.cpp | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/src/EXTRA-COMPUTE/compute_stress_mop.cpp b/src/EXTRA-COMPUTE/compute_stress_mop.cpp index 9249e4ce2d..0199a49c01 100644 --- a/src/EXTRA-COMPUTE/compute_stress_mop.cpp +++ b/src/EXTRA-COMPUTE/compute_stress_mop.cpp @@ -205,26 +205,25 @@ void ComputeStressMop::init() if (force->pair->single_enable == 0) error->all(FLERR,"Pair style does not support compute stress/mop"); - // Warnings + // Errors if (me==0) { - //Compute stress/mop only accounts for pair interactions. - // issue a warning if any intramolecular potential or Kspace is defined. + // issue an error for unimplemented intramolecular potentials or Kspace. if (force->bond!=nullptr) bondflag = 1; if (force->angle!=nullptr) if (force->angle->born_matrix_enable == 0) { - error->warning(FLERR,"compute stress/mop does not account for angle potentials"); + error->all(FLERR,"compute stress/mop does not account for angle potentials"); } else { angleflag = 1; } if (force->dihedral!=nullptr) - error->warning(FLERR,"compute stress/mop does not account for dihedral potentials"); + error->all(FLERR,"compute stress/mop does not account for dihedral potentials"); if (force->improper!=nullptr) - error->warning(FLERR,"compute stress/mop does not account for improper potentials"); + error->all(FLERR,"compute stress/mop does not account for improper potentials"); if (force->kspace!=nullptr) - error->warning(FLERR,"compute stress/mop does not account for kspace contributions"); + error->all(FLERR,"compute stress/mop does not account for kspace contributions"); } // need an occasional half neighbor list From b01db47b2d83a5d4656ef279c318c717cfefe192 Mon Sep 17 00:00:00 2001 From: Evangelos Voyiatzis Date: Thu, 1 Jun 2023 10:33:50 +0300 Subject: [PATCH 135/396] consistency in issuing errors between mop and mop/profile --- src/EXTRA-COMPUTE/compute_stress_mop_profile.cpp | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/EXTRA-COMPUTE/compute_stress_mop_profile.cpp b/src/EXTRA-COMPUTE/compute_stress_mop_profile.cpp index 709f109cb1..ffcc712548 100644 --- a/src/EXTRA-COMPUTE/compute_stress_mop_profile.cpp +++ b/src/EXTRA-COMPUTE/compute_stress_mop_profile.cpp @@ -178,23 +178,23 @@ void ComputeStressMopProfile::init() if (force->pair->single_enable == 0) error->all(FLERR,"Pair style does not support compute stress/mop/profile"); - // Warnings + // Errors if (me==0) { //Compute stress/mop/profile only accounts for pair interactions. - // issue a warning if any intramolecular potential or Kspace is defined. + // issue an error if any intramolecular potential or Kspace is defined. if (force->bond!=nullptr) - error->warning(FLERR,"compute stress/mop/profile does not account for bond potentials"); + error->all(FLERR,"compute stress/mop/profile does not account for bond potentials"); if (force->angle!=nullptr) - error->warning(FLERR,"compute stress/mop/profile does not account for angle potentials"); + error->all(FLERR,"compute stress/mop/profile does not account for angle potentials"); if (force->dihedral!=nullptr) - error->warning(FLERR,"compute stress/mop/profile does not account for dihedral potentials"); + error->all(FLERR,"compute stress/mop/profile does not account for dihedral potentials"); if (force->improper!=nullptr) - error->warning(FLERR,"compute stress/mop/profile does not account for improper potentials"); + error->all(FLERR,"compute stress/mop/profile does not account for improper potentials"); if (force->kspace!=nullptr) - error->warning(FLERR,"compute stress/mop/profile does not account for kspace contributions"); + error->all(FLERR,"compute stress/mop/profile does not account for kspace contributions"); } // need an occasional half neighbor list From 6bc27db58c2829dab6f13b8cb5e69702a2cd2b36 Mon Sep 17 00:00:00 2001 From: Yifan Li Date: Thu, 1 Jun 2023 06:17:11 -0400 Subject: [PATCH 136/396] do not delete c_pe and c_press in destructor --- src/REPLICA/fix_pimd_langevin.cpp | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/REPLICA/fix_pimd_langevin.cpp b/src/REPLICA/fix_pimd_langevin.cpp index 67d7cabe02..f9c7772d63 100644 --- a/src/REPLICA/fix_pimd_langevin.cpp +++ b/src/REPLICA/fix_pimd_langevin.cpp @@ -344,8 +344,6 @@ FixPIMDLangevin::~FixPIMDLangevin() delete[] id_pe; delete[] id_press; delete random; - delete c_pe; - delete c_press; delete[] mass; delete[] _omega_k; delete[] Lan_c; From f3bf20be8b15a9d82028934f27f33af019ae469e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Yifan=20Li=E6=9D=8E=E4=B8=80=E5=B8=86?= Date: Thu, 1 Jun 2023 08:26:02 -0400 Subject: [PATCH 137/396] The first three p_flags for iso should be 1. --- src/REPLICA/fix_pimd_langevin.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/REPLICA/fix_pimd_langevin.cpp b/src/REPLICA/fix_pimd_langevin.cpp index f9c7772d63..2e4b1c17b8 100644 --- a/src/REPLICA/fix_pimd_langevin.cpp +++ b/src/REPLICA/fix_pimd_langevin.cpp @@ -205,6 +205,7 @@ FixPIMDLangevin::FixPIMDLangevin(LAMMPS *lmp, int narg, char **arg) : error->universe_all(FLERR, "Unknown barostat parameter for fix pimd/langevin"); } else if (strcmp(arg[i], "iso") == 0) { pstyle = ISO; + p_flag[0] = p_flag[1] = p_flag[2] = 1; Pext = utils::numeric(FLERR, arg[i + 1], false, lmp); p_target[0] = p_target[1] = p_target[2] = Pext; pdim = 3; From c1cec4565250c5a1b28c850badae0785b140c60d Mon Sep 17 00:00:00 2001 From: Evangelos Voyiatzis Date: Thu, 1 Jun 2023 15:26:43 +0300 Subject: [PATCH 138/396] add keywords to specify contributions to stress/mop --- src/EXTRA-COMPUTE/compute_stress_mop.cpp | 23 +++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) diff --git a/src/EXTRA-COMPUTE/compute_stress_mop.cpp b/src/EXTRA-COMPUTE/compute_stress_mop.cpp index 0199a49c01..071bdf31ee 100644 --- a/src/EXTRA-COMPUTE/compute_stress_mop.cpp +++ b/src/EXTRA-COMPUTE/compute_stress_mop.cpp @@ -38,7 +38,7 @@ using namespace LAMMPS_NS; enum{X,Y,Z}; -enum{TOTAL,CONF,KIN}; +enum{TOTAL,CONF,KIN,PAIR,BOND,ANGLE}; #define BIG 1000000000 @@ -115,6 +115,21 @@ ComputeStressMop::ComputeStressMop(LAMMPS *lmp, int narg, char **arg) : which[nvalues] = TOTAL; nvalues++; } + } else if (strcmp(arg[iarg],"pair") == 0) { + for (i=0; i<3; i++) { + which[nvalues] = PAIR; + nvalues++; + } + } else if (strcmp(arg[iarg],"bond") == 0) { + for (i=0; i<3; i++) { + which[nvalues] = BOND; + nvalues++; + } + } else if (strcmp(arg[iarg],"angle") == 0) { + for (i=0; i<3; i++) { + which[nvalues] = ANGLE; + nvalues++; + } } else error->all(FLERR, "Illegal compute stress/mop command"); //break; iarg++; @@ -329,7 +344,7 @@ void ComputeStressMop::compute_pairs() m = 0; while (m Date: Thu, 1 Jun 2023 15:34:41 +0300 Subject: [PATCH 139/396] Update compute_stress_mop.rst to reflect the added keywords --- doc/src/compute_stress_mop.rst | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/doc/src/compute_stress_mop.rst b/doc/src/compute_stress_mop.rst index a8a3bc5660..b4c15257af 100644 --- a/doc/src/compute_stress_mop.rst +++ b/doc/src/compute_stress_mop.rst @@ -18,7 +18,7 @@ Syntax * style = *stress/mop* or *stress/mop/profile* * dir = *x* or *y* or *z* is the direction normal to the plane * args = argument specific to the compute style -* keywords = *kin* or *conf* or *total* (one of more can be specified) +* keywords = *kin* or *conf* or *total* or *pair* or *bond* or *angle* (one or more can be specified) .. parsed-literal:: @@ -64,9 +64,11 @@ atoms have crossed the plane if their positions at times :math:`t-\Delta t` and :math:`t` are one on either side of the plane, and uses the velocity at time :math:`t-\Delta t/2` given by the velocity Verlet algorithm. -Between one and three keywords can be used to indicate which -contributions to the stress must be computed: kinetic stress (kin), -configurational stress (conf), and/or total stress (total). +Between one and six keywords can be used to indicate which +contributions to the stress must be computed: total stress (total), kinetic stress (kin), +configurational stress (conf), stress due to bond stretching (bond), +stress due to angle bending (angle) and/or due to pairwise non-bonded interactions (pair). +The last three keywords are currently available only for the stress/mop command and not the stress/mop/profile. NOTE 1: The configurational stress is computed considering all pairs of atoms where at least one atom belongs to group group-ID. From 1189661edc3fa2fe0ecfb54c8fc048bdf0d42b3c Mon Sep 17 00:00:00 2001 From: oywg11 Date: Thu, 1 Jun 2023 21:00:16 +0800 Subject: [PATCH 140/396] revise the code files of standard version based on latest version of LAMMPS --- src/INTERLAYER/pair_ilp_graphene_hbn.cpp | 21 ++++++------- src/INTERLAYER/pair_ilp_graphene_hbn.h | 38 +++++------------------- src/INTERLAYER/pair_ilp_tmd.cpp | 30 +++++++++---------- src/INTERLAYER/pair_ilp_tmd.h | 2 +- src/INTERLAYER/pair_ilp_water_2dm.cpp | 23 +++++++------- src/INTERLAYER/pair_ilp_water_2dm.h | 21 +------------ 6 files changed, 45 insertions(+), 90 deletions(-) diff --git a/src/INTERLAYER/pair_ilp_graphene_hbn.cpp b/src/INTERLAYER/pair_ilp_graphene_hbn.cpp index 956d7ba2be..401d7f7b12 100644 --- a/src/INTERLAYER/pair_ilp_graphene_hbn.cpp +++ b/src/INTERLAYER/pair_ilp_graphene_hbn.cpp @@ -1,7 +1,7 @@ /* ---------------------------------------------------------------------- LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator https://www.lammps.org/, Sandia National Laboratories - Steve Plimpton, sjplimp@sandia.gov + LAMMPS development team: developers@lammps.org Copyright (2003) Sandia Corporation. Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains @@ -47,11 +47,11 @@ using namespace InterLayer; static const char cite_ilp[] = "ilp/graphene/hbn potential doi:10.1021/acs.nanolett.8b02848\n" "@Article{Ouyang2018\n" - " author = {W. Ouyang, D. Mandelli, M. Urbakh, and O. Hod},\n" + " author = {W. Ouyang and D. Mandelli and M. Urbakh and O. Hod},\n" " title = {Nanoserpents: Graphene Nanoribbon Motion on Two-Dimensional Hexagonal Materials},\n" " journal = {Nano Letters},\n" " volume = 18,\n" - " pages = {6009}\n" + " pages = 6009,\n" " year = 2018,\n" "}\n\n"; @@ -59,10 +59,7 @@ static const char cite_ilp[] = static std::map variant_map = { {PairILPGrapheneHBN::ILP_GrhBN, "ilp/graphene/hbn"}, {PairILPGrapheneHBN::ILP_TMD, "ilp/tmd"}, - {PairILPGrapheneHBN::ILP_PHOSPHORUS, "ilp/phosphorus"}, - {PairILPGrapheneHBN::ILP_WATER_2DM, "ilp/water/2dm"}, - {PairILPGrapheneHBN::SAIP_METAL, "saip/metal"}, - {PairILPGrapheneHBN::SAIP_METAL_TMD, "saip/metal/tmd"}}; + {PairILPGrapheneHBN::SAIP_METAL, "saip/metal"}}; /* ---------------------------------------------------------------------- */ @@ -316,14 +313,14 @@ void PairILPGrapheneHBN::read_file(char *filename) for (int m = 0; m < nparams; m++) { if (i == params[m].ielement && j == params[m].jelement) { if (n >= 0) - error->all(FLERR, "{} potential file {} has a duplicate entry", variant_map[variant], - filename); + error->all(FLERR, "{} potential file {} has a duplicate entry for: {} {}", + variant_map[variant], filename, elements[i], elements[j]); n = m; } } if (n < 0) - error->all(FLERR, "{} potential file {} is missing an entry", variant_map[variant], - filename); + error->all(FLERR, "{} potential file {} is missing an entry for: {} {}", + variant_map[variant], filename, elements[i], elements[j]); elem2param[i][j] = n; cutILPsq[i][j] = params[n].rcut * params[n].rcut; } @@ -652,7 +649,7 @@ void PairILPGrapheneHBN::ILP_neigh() (int **) memory->smalloc(maxlocal * sizeof(int *), "ILPGrapheneHBN:firstneigh"); } - inum = list->inum; // + list->gnum; + inum = list->inum; ilist = list->ilist; numneigh = list->numneigh; firstneigh = list->firstneigh; diff --git a/src/INTERLAYER/pair_ilp_graphene_hbn.h b/src/INTERLAYER/pair_ilp_graphene_hbn.h index 6381fb8f35..9987830b1d 100644 --- a/src/INTERLAYER/pair_ilp_graphene_hbn.h +++ b/src/INTERLAYER/pair_ilp_graphene_hbn.h @@ -1,7 +1,7 @@ /* -*- c++ -*- ---------------------------------------------------------- LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator https://www.lammps.org/, Sandia National Laboratories - Steve Plimpton, sjplimp@sandia.gov + LAMMPS development team: developers@lammps.org Copyright (2003) Sandia Corporation. Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains @@ -35,19 +35,11 @@ class PairILPGrapheneHBN : public Pair { double init_one(int, int) override; void init_style() override; void calc_FvdW(int, int); - virtual void calc_FRep(int, int); - virtual void ILP_neigh(); - virtual void calc_normal(); - void read_file(char *); - void allocate(); - double single(int, int, int, int, double, double, double, double &) override; static constexpr int NPARAMS_PER_LINE = 13; - // for telling class variants apart in shared code - enum { ILP_GrhBN, ILP_TMD, SAIP_METAL, - ILP_WATER_2DM, SAIP_METAL_TMD, ILP_PHOSPHORUS }; + enum { ILP_GrhBN, ILP_TMD, SAIP_METAL }; // for telling class variants apart in shared code protected: int me; @@ -59,7 +51,6 @@ class PairILPGrapheneHBN : public Pair { int *ILP_numneigh; // # of pair neighbors for each atom int **ILP_firstneigh; // ptr to 1st neighbor of each atom int tap_flag; // flag to turn on/off taper function - double ncf; // for ilp/phosphorus, coefficients for calcualting the normals struct Param { double z0, alpha, epsilon, C, delta, d, sR, reff, C6, S; @@ -85,28 +76,15 @@ class PairILPGrapheneHBN : public Pair { double ***dpvet1; double ***dpvet2; double ***dNave; + + virtual void ILP_neigh(); + virtual void calc_normal(); + virtual void calc_FRep(int, int); + void read_file(char *); + void allocate(); }; } // namespace LAMMPS_NS #endif #endif - -/* ERROR/WARNING messages: - -E: Illegal ... command - -Self-explanatory. Check the input script syntax and compare to the -documentation for the command. You can use -echo screen as a -command-line option when running LAMMPS to see the offending line. - -E: Incorrect args for pair coefficients - -Self-explanatory. Check the input script or data file. - -E: All pair coeffs are not set - -All pair coefficients must be set in the data file or by the -pair_coeff command before running a simulation. - -*/ diff --git a/src/INTERLAYER/pair_ilp_tmd.cpp b/src/INTERLAYER/pair_ilp_tmd.cpp index d855b9423d..f5636ce3fa 100644 --- a/src/INTERLAYER/pair_ilp_tmd.cpp +++ b/src/INTERLAYER/pair_ilp_tmd.cpp @@ -1,7 +1,7 @@ /* ---------------------------------------------------------------------- LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator https://www.lammps.org/, Sandia National Laboratories - Steve Plimpton, sjplimp@sandia.gov + LAMMPS development team: developers@lammps.org Copyright (2003) Sandia Corporation. Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains @@ -22,14 +22,12 @@ #include "atom.h" #include "citeme.h" -#include "comm.h" #include "error.h" #include "force.h" #include "interlayer_taper.h" #include "memory.h" #include "my_page.h" #include "neigh_list.h" -#include "neighbor.h" #include #include @@ -37,20 +35,22 @@ using namespace LAMMPS_NS; using namespace InterLayer; +#define MAXLINE 1024 #define DELTA 4 #define PGDELTA 1 -static const char cite_ilp_tmd[] = "ilp/tmd potential doi/10.1021/acs.jctc.1c00782\n" - "@Article{Ouyang2021\n" - " author = {W. Ouyang, R. Sofer, X. Gao, J. Hermann, A. " - "Tkatchenko, L. Kronik, M. Urbakh, and O. Hod},\n" - " title = {Anisotropic Interlayer Force Field for Transition " - "Metal Dichalcogenides: The Case of Molybdenum Disulfide},\n" - " journal = {J. Chem. Theory Comput.},\n" - " volume = 17,\n" - " pages = {7237–7245}\n" - " year = 2021,\n" - "}\n\n"; +static const char cite_ilp_tmd[] = + "ilp/tmd potential doi:10.1021/acs.jctc.1c00782\n" + "@Article{Ouyang2021\n" + " author = {W. Ouyang and R. Sofer and X. Gao and J. Hermann and\n" + " A. Tkatchenko and L. Kronik and M. Urbakh and O. Hod},\n" + " title = {Anisotropic Interlayer Force Field for Transition\n" + " Metal Dichalcogenides: The Case of Molybdenum Disulfide},\n" + " journal = {J.~Chem.\\ Theory Comput.},\n" + " volume = 17,\n" + " pages = {7237--7245}\n" + " year = 2021,\n" + "}\n\n"; /* ---------------------------------------------------------------------- */ @@ -249,7 +249,7 @@ void PairILPTMD::ILP_neigh() ILP_firstneigh = (int **) memory->smalloc(maxlocal * sizeof(int *), "ILPTMD:firstneigh"); } - inum = list->inum; //+ list->gnum; + inum = list->inum; ilist = list->ilist; numneigh = list->numneigh; firstneigh = list->firstneigh; diff --git a/src/INTERLAYER/pair_ilp_tmd.h b/src/INTERLAYER/pair_ilp_tmd.h index 8d5446d49c..8381c2e830 100644 --- a/src/INTERLAYER/pair_ilp_tmd.h +++ b/src/INTERLAYER/pair_ilp_tmd.h @@ -1,7 +1,7 @@ /* -*- c++ -*- ---------------------------------------------------------- LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator https://www.lammps.org/, Sandia National Laboratories - Steve Plimpton, sjplimp@sandia.gov + LAMMPS development team: developers@lammps.org Copyright (2003) Sandia Corporation. Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains diff --git a/src/INTERLAYER/pair_ilp_water_2dm.cpp b/src/INTERLAYER/pair_ilp_water_2dm.cpp index 58e56894f5..2eb50305cc 100644 --- a/src/INTERLAYER/pair_ilp_water_2dm.cpp +++ b/src/INTERLAYER/pair_ilp_water_2dm.cpp @@ -1,7 +1,7 @@ /* ---------------------------------------------------------------------- LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator https://www.lammps.org/, Sandia National Laboratories - Steve Plimpton, sjplimp@sandia.gov + LAMMPS development team: developers@lammps.org Copyright (2003) Sandia Corporation. Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains @@ -22,7 +22,6 @@ #include "atom.h" #include "citeme.h" -#include "comm.h" #include "error.h" #include "force.h" #include "interlayer_taper.h" @@ -30,7 +29,6 @@ #include "my_page.h" #include "neigh_list.h" #include "neigh_request.h" -#include "neighbor.h" #include #include @@ -42,15 +40,16 @@ using namespace InterLayer; #define DELTA 4 #define PGDELTA 1 -static const char cite_ilp_water[] = "ilp/water/2dm potential doi/10.1021/acs.jpcc.2c08464\n" - "@Article{Feng2023\n" - " author = {Z. Feng, Y. Yao, J. Liu, B. Wu, Z. Liu, and W. Ouyang},\n" - " title = {Registry-Dependent Potential for Interfaces of Water with Graphene},\n" - " journal = {J. Phys. Chem. C},\n" - " volume = 127,\n" - " pages = {8704-8713}\n" - " year = 2023,\n" - "}\n\n"; +static const char cite_ilp_water[] = + "ilp/water/2dm potential doi/10.1021/acs.jpcc.2c08464\n" + "@Article{Feng2023\n" + " author = {Z. Feng, Y. Yao, J. Liu, B. Wu, Z. Liu, and W. Ouyang},\n" + " title = {Registry-Dependent Potential for Interfaces of Water with Graphene},\n" + " journal = {J. Phys. Chem. C},\n" + " volume = 127,\n" + " pages = {8704-8713}\n" + " year = 2023,\n" + "}\n\n"; /* ---------------------------------------------------------------------- */ diff --git a/src/INTERLAYER/pair_ilp_water_2dm.h b/src/INTERLAYER/pair_ilp_water_2dm.h index c35d757ea0..fad9f99ff1 100644 --- a/src/INTERLAYER/pair_ilp_water_2dm.h +++ b/src/INTERLAYER/pair_ilp_water_2dm.h @@ -1,7 +1,7 @@ /* -*- c++ -*- ---------------------------------------------------------- LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator https://www.lammps.org/, Sandia National Laboratories - Steve Plimpton, sjplimp@sandia.gov + LAMMPS development team: developers@lammps.org Copyright (2003) Sandia Corporation. Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains @@ -46,22 +46,3 @@ class PairILPWATER2DM : virtual public PairILPTMD { #endif #endif - -/* ERROR/WARNING messages: - -E: Illegal ... command - -Self-explanatory. Check the input script syntax and compare to the -documentation for the command. You can use -echo screen as a -command-line option when running LAMMPS to see the offending line. - -E: Incorrect args for pair coefficients - -Self-explanatory. Check the input script or data file. - -E: All pair coeffs are not set - -All pair coefficients must be set in the data file or by the -pair_coeff command before running a simulation. - -*/ From 887534fd0211695a2086905ed568d6d0a4da3840 Mon Sep 17 00:00:00 2001 From: oywg11 Date: Thu, 1 Jun 2023 21:12:11 +0800 Subject: [PATCH 141/396] fix checkstyle --- src/INTERLAYER/pair_ilp_tmd.cpp | 10 +++++----- src/INTERLAYER/pair_ilp_water_2dm.cpp | 2 +- src/OPT/pair_ilp_graphene_hbn_opt.cpp | 3 +-- src/OPT/pair_ilp_graphene_hbn_opt.h | 2 +- src/OPT/pair_ilp_water_2dm_opt.cpp | 2 +- src/OPT/pair_ilp_water_2dm_opt.h | 2 +- 6 files changed, 10 insertions(+), 11 deletions(-) diff --git a/src/INTERLAYER/pair_ilp_tmd.cpp b/src/INTERLAYER/pair_ilp_tmd.cpp index f5636ce3fa..c1af7098cd 100644 --- a/src/INTERLAYER/pair_ilp_tmd.cpp +++ b/src/INTERLAYER/pair_ilp_tmd.cpp @@ -488,11 +488,11 @@ void PairILPTMD::calc_normal() jH2 = atom->map(tag[i] - 2); iH1 = map[type[jH1]]; iH2 = map[type[jH2]]; - if (strcmp(elements[iH1], "Ow") == 0 ) { + if (strcmp(elements[iH1], "Ow") == 0 ) { vect[0][0] = x[jH1][0] - xtp; vect[0][1] = x[jH1][1] - ytp; vect[0][2] = x[jH1][2] - ztp; - } else if (strcmp(elements[iH2], "Ow") == 0 ) { + } else if (strcmp(elements[iH2], "Ow") == 0 ) { vect[0][0] = x[jH2][0] - xtp; vect[0][1] = x[jH2][1] - ytp; vect[0][2] = x[jH2][2] - ztp; @@ -518,7 +518,7 @@ void PairILPTMD::calc_normal() // Calculte dNave/dri, defined as dpvdri for (id = 0; id < 3; id++) { for (ip = 0; ip < 3; ip++) { - if (ip == id) { dpvdri[id][ip] = -1.0;} + if (ip == id) { dpvdri[id][ip] = -1.0;} else {dpvdri[id][ip] = 0.0;} } } @@ -682,12 +682,12 @@ void PairILPTMD::calc_normal() normal[i][2] = Nave[2] / nn; // derivatives of non-normalized normal vector, dNave:3xcontx3 array - // dNave[id][m][ip]: the derivatve of the id component of Nave + // dNave[id][m][ip]: the derivatve of the id component of Nave // respect to the ip component of atom m for (id = 0; id < 3; id++) { for (ip = 0; ip < 3; ip++) { for (m = 0; m < cont; m++) { - if (ip == id) { dNave[id][m][ip] = 0.5;} + if (ip == id) { dNave[id][m][ip] = 0.5;} else {dNave[id][m][ip] = 0.0;} } } diff --git a/src/INTERLAYER/pair_ilp_water_2dm.cpp b/src/INTERLAYER/pair_ilp_water_2dm.cpp index 2eb50305cc..3747d249de 100644 --- a/src/INTERLAYER/pair_ilp_water_2dm.cpp +++ b/src/INTERLAYER/pair_ilp_water_2dm.cpp @@ -40,7 +40,7 @@ using namespace InterLayer; #define DELTA 4 #define PGDELTA 1 -static const char cite_ilp_water[] = +static const char cite_ilp_water[] = "ilp/water/2dm potential doi/10.1021/acs.jpcc.2c08464\n" "@Article{Feng2023\n" " author = {Z. Feng, Y. Yao, J. Liu, B. Wu, Z. Liu, and W. Ouyang},\n" diff --git a/src/OPT/pair_ilp_graphene_hbn_opt.cpp b/src/OPT/pair_ilp_graphene_hbn_opt.cpp index 63822ad4c6..e8cb205a52 100644 --- a/src/OPT/pair_ilp_graphene_hbn_opt.cpp +++ b/src/OPT/pair_ilp_graphene_hbn_opt.cpp @@ -1,7 +1,7 @@ /* ---------------------------------------------------------------------- LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator https://www.lammps.org/, Sandia National Laboratories - Steve Plimpton, sjplimp@sandia.gov + LAMMPS development team: developers@lammps.org Copyright (2003) Sandia Corporation. Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains @@ -471,7 +471,6 @@ inline void deriv_hat(double dnhatdn[3][3], double *n, double rnnorm, double fac dnhatdn[0][2] = -n[0]*n[2]*cfactor; dnhatdn[1][2] = -n[1]*n[2]*cfactor; dnhatdn[2][2] = (n[0]*n[0]+n[1]*n[1])*cfactor; - } inline double normalize_factor(double *n) { diff --git a/src/OPT/pair_ilp_graphene_hbn_opt.h b/src/OPT/pair_ilp_graphene_hbn_opt.h index bc22ab22b0..41d2178092 100644 --- a/src/OPT/pair_ilp_graphene_hbn_opt.h +++ b/src/OPT/pair_ilp_graphene_hbn_opt.h @@ -1,7 +1,7 @@ /* -*- c++ -*- ---------------------------------------------------------- LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator https://www.lammps.org/, Sandia National Laboratories - Steve Plimpton, sjplimp@sandia.gov + LAMMPS development team: developers@lammps.org Copyright (2003) Sandia Corporation. Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains diff --git a/src/OPT/pair_ilp_water_2dm_opt.cpp b/src/OPT/pair_ilp_water_2dm_opt.cpp index 6cdac00ed9..316551c345 100644 --- a/src/OPT/pair_ilp_water_2dm_opt.cpp +++ b/src/OPT/pair_ilp_water_2dm_opt.cpp @@ -1,7 +1,7 @@ /* ---------------------------------------------------------------------- LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator https://www.lammps.org/, Sandia National Laboratories - Steve Plimpton, sjplimp@sandia.gov + LAMMPS development team: developers@lammps.org Copyright (2003) Sandia Corporation. Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains diff --git a/src/OPT/pair_ilp_water_2dm_opt.h b/src/OPT/pair_ilp_water_2dm_opt.h index 25905643af..8062de880a 100644 --- a/src/OPT/pair_ilp_water_2dm_opt.h +++ b/src/OPT/pair_ilp_water_2dm_opt.h @@ -1,7 +1,7 @@ /* -*- c++ -*- ---------------------------------------------------------- LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator https://www.lammps.org/, Sandia National Laboratories - Steve Plimpton, sjplimp@sandia.gov + LAMMPS development team: developers@lammps.org Copyright (2003) Sandia Corporation. Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains From a4f4f965e3f1688d0e7da135c8809081a4e6083a Mon Sep 17 00:00:00 2001 From: oywg11 Date: Thu, 1 Jun 2023 21:45:52 +0800 Subject: [PATCH 142/396] fix a bug in the codes --- src/INTERLAYER/pair_ilp_graphene_hbn.cpp | 1 + src/INTERLAYER/pair_ilp_graphene_hbn.h | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/INTERLAYER/pair_ilp_graphene_hbn.cpp b/src/INTERLAYER/pair_ilp_graphene_hbn.cpp index 401d7f7b12..6d7526e3dd 100644 --- a/src/INTERLAYER/pair_ilp_graphene_hbn.cpp +++ b/src/INTERLAYER/pair_ilp_graphene_hbn.cpp @@ -59,6 +59,7 @@ static const char cite_ilp[] = static std::map variant_map = { {PairILPGrapheneHBN::ILP_GrhBN, "ilp/graphene/hbn"}, {PairILPGrapheneHBN::ILP_TMD, "ilp/tmd"}, + {PairILPGrapheneHBN::ILP_WATER_2DM, "ilp/water/2dm"}, {PairILPGrapheneHBN::SAIP_METAL, "saip/metal"}}; /* ---------------------------------------------------------------------- */ diff --git a/src/INTERLAYER/pair_ilp_graphene_hbn.h b/src/INTERLAYER/pair_ilp_graphene_hbn.h index 9987830b1d..e27fce420a 100644 --- a/src/INTERLAYER/pair_ilp_graphene_hbn.h +++ b/src/INTERLAYER/pair_ilp_graphene_hbn.h @@ -39,7 +39,7 @@ class PairILPGrapheneHBN : public Pair { static constexpr int NPARAMS_PER_LINE = 13; - enum { ILP_GrhBN, ILP_TMD, SAIP_METAL }; // for telling class variants apart in shared code + enum { ILP_GrhBN, ILP_TMD, SAIP_METAL, ILP_WATER_2DM }; // for telling class variants apart in shared code protected: int me; From 08ffd268bff9734217ea14be6d223810fd983991 Mon Sep 17 00:00:00 2001 From: Evangelos Voyiatzis Date: Fri, 2 Jun 2023 09:43:58 +0300 Subject: [PATCH 143/396] remove unused symbolic constant --- src/EXTRA-COMPUTE/compute_stress_mop.cpp | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/EXTRA-COMPUTE/compute_stress_mop.cpp b/src/EXTRA-COMPUTE/compute_stress_mop.cpp index 071bdf31ee..3ae758b875 100644 --- a/src/EXTRA-COMPUTE/compute_stress_mop.cpp +++ b/src/EXTRA-COMPUTE/compute_stress_mop.cpp @@ -40,8 +40,6 @@ using namespace LAMMPS_NS; enum{X,Y,Z}; enum{TOTAL,CONF,KIN,PAIR,BOND,ANGLE}; -#define BIG 1000000000 - /* ---------------------------------------------------------------------- */ ComputeStressMop::ComputeStressMop(LAMMPS *lmp, int narg, char **arg) : From 8ef4e933b25610a841a8107412cdb7a69cbb50da Mon Sep 17 00:00:00 2001 From: Stan Gerald Moore Date: Fri, 2 Jun 2023 10:17:38 -0600 Subject: [PATCH 144/396] Fix bug when Kokkos border comm is on host --- src/KOKKOS/comm_kokkos.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/KOKKOS/comm_kokkos.cpp b/src/KOKKOS/comm_kokkos.cpp index 7d007a666c..b0394821fc 100644 --- a/src/KOKKOS/comm_kokkos.cpp +++ b/src/KOKKOS/comm_kokkos.cpp @@ -980,9 +980,9 @@ void CommKokkos::borders() } else { atomKK->sync(Host,ALL_MASK); k_sendlist.sync(); - CommBrick::borders(); k_sendlist.modify(); - atomKK->modified(Host,ALL_MASK); + atomKK->modified(Host,ALL_MASK); // needed here for atom map + CommBrick::borders(); } if (comm->nprocs == 1 && !ghost_velocity && !forward_comm_classic) From 70507462e9e04e8466e9e7c48a56f065235f871d Mon Sep 17 00:00:00 2001 From: Evangelos Voyiatzis Date: Fri, 2 Jun 2023 19:22:28 +0300 Subject: [PATCH 145/396] Include method for bond contribution & variables to compute_stress_mop_profile.h --- src/EXTRA-COMPUTE/compute_stress_mop_profile.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/EXTRA-COMPUTE/compute_stress_mop_profile.h b/src/EXTRA-COMPUTE/compute_stress_mop_profile.h index b58f762c12..7bb87fa4c6 100644 --- a/src/EXTRA-COMPUTE/compute_stress_mop_profile.h +++ b/src/EXTRA-COMPUTE/compute_stress_mop_profile.h @@ -38,16 +38,20 @@ class ComputeStressMopProfile : public Compute { private: void compute_pairs(); + void compute_bonds(); void setup_bins(); int me, nvalues, dir; int *which; + int bondflag; + int originflag; double origin, delta, offset, invdelta; int nbins; double **coord, **coordp; double **values_local, **values_global; + double **bond_local, **bond_global; double dt, nktv2p, ftm2v; double area; From e7ae02dd2a53b12f8b6de5eabea4d9750d98b085 Mon Sep 17 00:00:00 2001 From: Evangelos Voyiatzis Date: Fri, 2 Jun 2023 19:33:15 +0300 Subject: [PATCH 146/396] Code for bond contribution to stress/mop/profile --- .../compute_stress_mop_profile.cpp | 169 +++++++++++++++++- 1 file changed, 162 insertions(+), 7 deletions(-) diff --git a/src/EXTRA-COMPUTE/compute_stress_mop_profile.cpp b/src/EXTRA-COMPUTE/compute_stress_mop_profile.cpp index ffcc712548..d15067a266 100644 --- a/src/EXTRA-COMPUTE/compute_stress_mop_profile.cpp +++ b/src/EXTRA-COMPUTE/compute_stress_mop_profile.cpp @@ -19,8 +19,11 @@ #include "compute_stress_mop_profile.h" #include "atom.h" +#include "atom_vec.h" +#include "bond.h" #include "update.h" #include "domain.h" +#include "molecule.h" #include "neighbor.h" #include "force.h" #include "pair.h" @@ -35,9 +38,7 @@ using namespace LAMMPS_NS; enum{X,Y,Z}; enum{LOWER,CENTER,UPPER,COORD}; -enum{TOTAL,CONF,KIN}; - -#define BIG 1000000000 +enum{TOTAL,CONF,KIN,PAIR,BOND}; /* ---------------------------------------------------------------------- */ @@ -48,6 +49,8 @@ ComputeStressMopProfile::ComputeStressMopProfile(LAMMPS *lmp, int narg, char **a MPI_Comm_rank(world,&me); + bondflag = 0; + // set compute mode and direction of plane(s) for pressure calculation if (strcmp(arg[3],"x")==0) { @@ -92,6 +95,16 @@ ComputeStressMopProfile::ComputeStressMopProfile(LAMMPS *lmp, int narg, char **a which[nvalues] = TOTAL; nvalues++; } + } else if (strcmp(arg[iarg],"pair") == 0) { + for (i=0; i<3; i++) { + which[nvalues] = PAIR; + nvalues++; + } + } else if (strcmp(arg[iarg],"bond") == 0) { + for (i=0; i<3; i++) { + which[nvalues] = PAIR; + nvalues++; + } } else error->all(FLERR, "Illegal compute stress/mop/profile command"); //break; iarg++; @@ -114,6 +127,8 @@ ComputeStressMopProfile::ComputeStressMopProfile(LAMMPS *lmp, int narg, char **a nbins = 0; coord = coordp = nullptr; values_local = values_global = array = nullptr; + bond_local = nullptr; + bond_global = nullptr; // bin setup @@ -140,6 +155,8 @@ ComputeStressMopProfile::~ComputeStressMopProfile() memory->destroy(coordp); memory->destroy(values_local); memory->destroy(values_global); + memory->destroy(bond_local); + memory->destroy(bond_global); memory->destroy(array); } @@ -185,8 +202,8 @@ void ComputeStressMopProfile::init() //Compute stress/mop/profile only accounts for pair interactions. // issue an error if any intramolecular potential or Kspace is defined. - if (force->bond!=nullptr) - error->all(FLERR,"compute stress/mop/profile does not account for bond potentials"); + if (force->bond!=nullptr) bondflag = 1; + if (force->angle!=nullptr) error->all(FLERR,"compute stress/mop/profile does not account for angle potentials"); if (force->dihedral!=nullptr) @@ -225,6 +242,21 @@ void ComputeStressMopProfile::compute_array() MPI_Allreduce(&values_local[0][0],&values_global[0][0],nbins*nvalues, MPI_DOUBLE,MPI_SUM,world); + if (bondflag) { + //Compute bond contribution on separate procs + compute_bonds(); + } else { + for (int m = 0; m < nbins; m++) { + for (int i = 0; i < nvalues; i++) { + bond_local[m][i] = 0.0; + } + } + } + + // sum bond contribution over all procs + MPI_Allreduce(&bond_local[0][0],&bond_global[0][0],nbins*nvalues, + MPI_DOUBLE,MPI_SUM,world); + int ibin,m,mo; for (ibin=0; ibinx; + tagint *tag = atom->tag; + int *num_bond = atom->num_bond; + tagint **bond_atom = atom->bond_atom; + int **bond_type = atom->bond_type; + int *mask = atom->mask; + + int *molindex = atom->molindex; + int *molatom = atom->molatom; + Molecule **onemols = atom->avec->onemols; + + int nlocal = atom->nlocal; + int newton_bond = force->newton_bond; + int molecular = atom->molecular; + + Bond *bond = force->bond; + + double dx[3] {0}; + double x_bond_1[3] {0}; + double x_bond_2[3] {0}; + double local_contribution[nbins][3] {0}; + + // initialization + for (int m {0}; m < nbins; m++) { + for (int i {0}; i < nvalues; i++) { + bond_local[m][i] = 0.0; + } + } + + // loop over all bonded atoms in the current proc + for (atom1 = 0; atom1 < nlocal; atom1++) { + if (!(mask[atom1] & groupbit)) continue; + + if (molecular == 1) + nb = num_bond[atom1]; + else { + if (molindex[atom1] < 0) continue; + imol = molindex[atom1]; + iatom = molatom[atom1]; + nb = onemols[imol]->num_bond[iatom]; + } + + for (i = 0; i < nb; i++) { + if (molecular == 1) { + btype = bond_type[atom1][i]; + atom2 = atom->map(bond_atom[atom1][i]); + } else { + tagprev = tag[atom1] - iatom - 1; + btype = onemols[imol]->bond_type[iatom][i]; + atom2 = atom->map(onemols[imol]->bond_atom[iatom][i] + tagprev); + } + + if (atom2 < 0 || !(mask[atom2] & groupbit)) continue; + if (newton_bond == 0 && tag[atom1] > tag[atom2]) continue; + if (btype <= 0) continue; + + for (int ibin {0}; ibinminimum_image(dx[0], dx[1], dx[2]); + x_bond_1[0] = dx[0]; + x_bond_1[1] = dx[1]; + x_bond_1[2] = dx[2]; + x_bond_1[dir] += pos; + + // minimum image of atom2 with respect to atom1 + dx[0] = x[atom2][0] - x_bond_1[0]; + dx[1] = x[atom2][1] - x_bond_1[1]; + dx[2] = x[atom2][2] - x_bond_1[2]; + domain->minimum_image(dx[0], dx[1], dx[2]); + x_bond_2[0] = x_bond_1[0] + dx[0]; + x_bond_2[1] = x_bond_1[1] + dx[1]; + x_bond_2[2] = x_bond_1[2] + dx[2]; + + // check if the bond vector crosses the plane of interest + double tau = (x_bond_1[dir] - pos) / (x_bond_1[dir] - x_bond_2[dir]); + if ((tau <= 1) && (tau >= 0)) { + dx[0] = x_bond_1[0] - x_bond_2[0]; + dx[1] = x_bond_1[1] - x_bond_2[1]; + dx[2] = x_bond_1[2] - x_bond_2[2]; + rsq = dx[0] * dx[0] + dx[1] * dx[1] + dx[2] * dx[2]; + bond->single(btype, rsq, atom1, atom2, fpair); + + double sgn = copysign(1.0, x_bond_1[dir] - pos); + local_contribution[ibin][0] += sgn*fpair*dx[0]/area*nktv2p; + local_contribution[ibin][1] += sgn*fpair*dx[1]/area*nktv2p; + local_contribution[ibin][2] += sgn*fpair*dx[2]/area*nktv2p; + } + } + } + } + + // loop over the keywords and if necessary add the bond contribution + int m {0}; + while (mcreate(coordp,nbins,1,"stress/mop/profile:coordp"); memory->create(values_local,nbins,nvalues,"stress/mop/profile:values_local"); memory->create(values_global,nbins,nvalues,"stress/mop/profile:values_global"); + memory->create(bond_local,nbins,nvalues,"stress/mop/profile:bond_local"); + memory->create(bond_global,nbins,nvalues,"stress/mop/profile:bond_global"); // set bin coordinates for (i = 0; i < nbins; i++) { From c30762ca8bfd35bb8554e2024ea57462298fa2e5 Mon Sep 17 00:00:00 2001 From: Evangelos Voyiatzis Date: Fri, 2 Jun 2023 19:44:37 +0300 Subject: [PATCH 147/396] Update documentation for compute stress/mop/profile --- doc/src/compute_stress_mop.rst | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/doc/src/compute_stress_mop.rst b/doc/src/compute_stress_mop.rst index b4c15257af..e1b151ebbd 100644 --- a/doc/src/compute_stress_mop.rst +++ b/doc/src/compute_stress_mop.rst @@ -68,7 +68,7 @@ Between one and six keywords can be used to indicate which contributions to the stress must be computed: total stress (total), kinetic stress (kin), configurational stress (conf), stress due to bond stretching (bond), stress due to angle bending (angle) and/or due to pairwise non-bonded interactions (pair). -The last three keywords are currently available only for the stress/mop command and not the stress/mop/profile. +The angle keyword is currently available only for the stress/mop command and not the stress/mop/profile. NOTE 1: The configurational stress is computed considering all pairs of atoms where at least one atom belongs to group group-ID. @@ -120,8 +120,8 @@ size does not change in time, and axis-aligned planes. The method only works with two-body pair interactions, because it requires the class method pair->single() to be implemented. In particular, compute *stress/mop/profile* does not work with more than -two-body pair interactions, intra-molecular interactions, and long range -(kspace) interactions. Similarly, compute *stress/mop* does not work with more than +two-body pair interactions, long range (kspace) interactions and angle/dihedral/improper +intramolecular interactions. Similarly, compute *stress/mop* does not work with more than two-body pair interactions, long range (kspace) interactions and dihedral/improper intramolecular interactions but works with all bond interactions with the class method single() implemented and all angle interactions with the class method born_matrix() From 28e3a741a8e84d7512e10c34364ac198cf456266 Mon Sep 17 00:00:00 2001 From: Evangelos Voyiatzis Date: Fri, 2 Jun 2023 20:02:52 +0300 Subject: [PATCH 148/396] declare local_contribution as pointer in compute_stress_mop_profile.h --- src/EXTRA-COMPUTE/compute_stress_mop_profile.h | 1 + 1 file changed, 1 insertion(+) diff --git a/src/EXTRA-COMPUTE/compute_stress_mop_profile.h b/src/EXTRA-COMPUTE/compute_stress_mop_profile.h index 7bb87fa4c6..1015d6e3eb 100644 --- a/src/EXTRA-COMPUTE/compute_stress_mop_profile.h +++ b/src/EXTRA-COMPUTE/compute_stress_mop_profile.h @@ -52,6 +52,7 @@ class ComputeStressMopProfile : public Compute { double **coord, **coordp; double **values_local, **values_global; double **bond_local, **bond_global; + double **local_contribution; double dt, nktv2p, ftm2v; double area; From 9dc1f45e1e7df4915740479fb29bd1944c99aecf Mon Sep 17 00:00:00 2001 From: Evangelos Voyiatzis Date: Fri, 2 Jun 2023 20:08:59 +0300 Subject: [PATCH 149/396] Create/destroy local_contribution --- src/EXTRA-COMPUTE/compute_stress_mop_profile.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/EXTRA-COMPUTE/compute_stress_mop_profile.cpp b/src/EXTRA-COMPUTE/compute_stress_mop_profile.cpp index d15067a266..3a60342887 100644 --- a/src/EXTRA-COMPUTE/compute_stress_mop_profile.cpp +++ b/src/EXTRA-COMPUTE/compute_stress_mop_profile.cpp @@ -129,6 +129,7 @@ ComputeStressMopProfile::ComputeStressMopProfile(LAMMPS *lmp, int narg, char **a values_local = values_global = array = nullptr; bond_local = nullptr; bond_global = nullptr; + local_contribution = nullptr; // bin setup @@ -157,6 +158,7 @@ ComputeStressMopProfile::~ComputeStressMopProfile() memory->destroy(values_global); memory->destroy(bond_local); memory->destroy(bond_global); + memory->destroy(local_contribution); memory->destroy(array); } @@ -514,13 +516,15 @@ void ComputeStressMopProfile::compute_bonds() double dx[3] {0}; double x_bond_1[3] {0}; double x_bond_2[3] {0}; - double local_contribution[nbins][3] {0}; // initialization for (int m {0}; m < nbins; m++) { for (int i {0}; i < nvalues; i++) { bond_local[m][i] = 0.0; } + local_contribution[m][0] = 0.0; + local_contribution[m][1] = 0.0; + local_contribution[m][2] = 0.0; } // loop over all bonded atoms in the current proc @@ -647,6 +651,7 @@ void ComputeStressMopProfile::setup_bins() memory->create(values_global,nbins,nvalues,"stress/mop/profile:values_global"); memory->create(bond_local,nbins,nvalues,"stress/mop/profile:bond_local"); memory->create(bond_global,nbins,nvalues,"stress/mop/profile:bond_global"); + memory->create(local_contribution,nbins,3,"stress/mop/profile:local_contribution"); // set bin coordinates for (i = 0; i < nbins; i++) { From 390888179fa2282ac9cd60f5eb5745260708d1a3 Mon Sep 17 00:00:00 2001 From: Evangelos Voyiatzis Date: Fri, 2 Jun 2023 20:24:32 +0300 Subject: [PATCH 150/396] Update compute_stress_mop_profile.cpp --- src/EXTRA-COMPUTE/compute_stress_mop_profile.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/EXTRA-COMPUTE/compute_stress_mop_profile.cpp b/src/EXTRA-COMPUTE/compute_stress_mop_profile.cpp index 3a60342887..d299633731 100644 --- a/src/EXTRA-COMPUTE/compute_stress_mop_profile.cpp +++ b/src/EXTRA-COMPUTE/compute_stress_mop_profile.cpp @@ -102,7 +102,7 @@ ComputeStressMopProfile::ComputeStressMopProfile(LAMMPS *lmp, int narg, char **a } } else if (strcmp(arg[iarg],"bond") == 0) { for (i=0; i<3; i++) { - which[nvalues] = PAIR; + which[nvalues] = BOND; nvalues++; } } else error->all(FLERR, "Illegal compute stress/mop/profile command"); //break; From 40cd3bbdc4f976790f484fdb1b560179cfb9096b Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Fri, 2 Jun 2023 16:29:10 -0400 Subject: [PATCH 151/396] add cache line size padding to avoid false sharing with OPENMP package --- src/my_page.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/my_page.h b/src/my_page.h index 6c06abd71e..ea19dc8e74 100644 --- a/src/my_page.h +++ b/src/my_page.h @@ -104,6 +104,9 @@ template class MyPage { int errorflag; // flag > 0 if error has occurred // 1 = chunk size exceeded maxchunk // 2 = memory allocation error +#if defined(_OPENMP) + char pad[64]; // to avoid false sharing with multi-threading +#endif void allocate(); void deallocate(); }; From 241f3b751e38df598b5d32c6f9bf9812e05c24d2 Mon Sep 17 00:00:00 2001 From: jtclemm Date: Fri, 2 Jun 2023 15:45:53 -0600 Subject: [PATCH 152/396] Unifying syntax for BPM bond options --- doc/src/bond_bpm_rotational.rst | 12 ++++++------ doc/src/bond_bpm_spring.rst | 14 +++++++------- src/BPM/bond_bpm.cpp | 8 +++++--- 3 files changed, 18 insertions(+), 16 deletions(-) diff --git a/doc/src/bond_bpm_rotational.rst b/doc/src/bond_bpm_rotational.rst index 0baf7e35b1..ca12d86ccc 100644 --- a/doc/src/bond_bpm_rotational.rst +++ b/doc/src/bond_bpm_rotational.rst @@ -24,7 +24,7 @@ Syntax *x, y, z* = the center of mass position of the 2 atoms when the bond broke (distance units) *x/ref, y/ref, z/ref* = the initial center of mass position of the 2 atoms (distance units) - *overlay/pair* value = none + *overlay/pair* value = *yes* or *no* bonded particles will still interact with pair forces *smooth* value = *yes* or *no* @@ -33,8 +33,8 @@ Syntax *normalize* value = *yes* or *no* normalizes normal and shear forces by the reference length - *break/no* - indicates that bonds should not break during a run + *break* value = *yes* or *no* + indicates whether bonds break during a run Examples """""""" @@ -144,14 +144,14 @@ by :math:`r_0` such that :math:`k_r` and :math:`k_s` are unit less. By default, pair forces are not calculated between bonded particles. Pair forces can alternatively be overlaid on top of bond forces using -the *overlay/pair* keyword. These settings require specific +the *overlay/pair* option. These settings require specific :doc:`special_bonds ` settings described in the restrictions. Further details can be found in the `:doc: how to ` page on BPMs. .. versionadded:: 28Mar2023 -If the *break/no* keyword is used, then LAMMPS assumes bonds should not break +If the *break* option is used, then LAMMPS assumes bonds should not break during a simulation run. This will prevent some unnecessary calculation. However, if a bond does break, it will trigger an error. @@ -257,7 +257,7 @@ Related commands Default """"""" -The option defaults are *smooth* = *yes* +The option defaults are *overlay/pair* = *no*, *smooth* = *yes*, *normalize* = *no*, and *break* = *yes* ---------- diff --git a/doc/src/bond_bpm_spring.rst b/doc/src/bond_bpm_spring.rst index 6da0d25a4a..d89035dcad 100644 --- a/doc/src/bond_bpm_spring.rst +++ b/doc/src/bond_bpm_spring.rst @@ -24,17 +24,17 @@ Syntax *x, y, z* = the center of mass position of the 2 atoms when the bond broke (distance units) *x/ref, y/ref, z/ref* = the initial center of mass position of the 2 atoms (distance units) - *overlay/pair* value = none + *overlay/pair* value = *yes* or *no* bonded particles will still interact with pair forces *smooth* value = *yes* or *no* smooths bond forces near the breaking point *normalize* value = *yes* or *no* - normalizes bond forces by their reference length + normalizes bond forces by the reference length - *break/no* - indicates that bonds should not break during a run + *break* value = *yes* or *no* + indicates whether bonds break during a run Examples """""""" @@ -110,14 +110,14 @@ However, the *normalize* option will normalize the elastic bond force by By default, pair forces are not calculated between bonded particles. Pair forces can alternatively be overlaid on top of bond forces using -the *overlay/pair* keyword. These settings require specific +the *overlay/pair* option. These settings require specific :doc:`special_bonds ` settings described in the restrictions. Further details can be found in the `:doc: how to ` page on BPMs. .. versionadded:: 28Mar2023 -If the *break/no* keyword is used, then LAMMPS assumes bonds should not break +If the *break* option is used, then LAMMPS assumes bonds should not break during a simulation run. This will prevent some unnecessary calculation. However, if a bond does break, it will trigger an error. @@ -212,7 +212,7 @@ Related commands Default """"""" -The option defaults are *smooth* = *yes* +The option defaults are *overlay/pair* = *no*, *smooth* = *yes*, *normalize* = *no*, and *break* = *yes* ---------- diff --git a/src/BPM/bond_bpm.cpp b/src/BPM/bond_bpm.cpp index a68aea3e68..da189ccaf5 100644 --- a/src/BPM/bond_bpm.cpp +++ b/src/BPM/bond_bpm.cpp @@ -187,10 +187,12 @@ void BondBPM::settings(int narg, char **arg) iarg++; } } else if (strcmp(arg[iarg], "overlay/pair") == 0) { - overlay_flag = 1; + if (iarg + 1 > narg) error->all(FLERR, "Illegal bond bpm command, missing option for overlay/pair"); + overlay_flag = utils::logical(FLERR, arg[iarg + 1], false, lmp); iarg++; - } else if (strcmp(arg[iarg], "break/no") == 0) { - break_flag = 0; + } else if (strcmp(arg[iarg], "break") == 0) { + if (iarg + 1 > narg) error->all(FLERR, "Illegal bond bpm command, missing option for break"); + break_flag = utils::logical(FLERR, arg[iarg + 1], false, lmp); iarg++; } else { leftover_iarg.push_back(iarg); From a42bfb0e26e8391076719f36a425c5d41ca41a23 Mon Sep 17 00:00:00 2001 From: rohskopf Date: Fri, 2 Jun 2023 17:26:40 -0600 Subject: [PATCH 153/396] Make cutoff factor 1 instead of 0 to prevent zero valued descriptors --- 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 fd58f1c4f3..d5690ea60a 100644 --- a/src/KOKKOS/sna_kokkos_impl.h +++ b/src/KOKKOS/sna_kokkos_impl.h @@ -2298,7 +2298,7 @@ void SNAKokkos::compute_s_dsfac(const real constexpr real_type zero = static_cast(0.0); constexpr real_type onehalf = static_cast(0.5); - if (switch_flag == 0) { sfac_outer = zero; dsfac_outer = zero; } + if (switch_flag == 0) { sfac_outer = one; dsfac_outer = zero; } else if (switch_flag == 1) { if (r <= rmin0) { sfac_outer = one; dsfac_outer = zero; } else if (r > rcut) { sfac = zero; dsfac = zero; return; } From 250eac93dccb4057e2abec357496624e1c3fbbee Mon Sep 17 00:00:00 2001 From: Xin Wu Date: Sat, 3 Jun 2023 07:34:39 +0200 Subject: [PATCH 154/396] fix bug in the reaxff HNS benchmark --- examples/reaxff/HNS/in.reaxc.hns | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/reaxff/HNS/in.reaxc.hns b/examples/reaxff/HNS/in.reaxc.hns index 775a389eca..5b83698917 100644 --- a/examples/reaxff/HNS/in.reaxc.hns +++ b/examples/reaxff/HNS/in.reaxc.hns @@ -37,4 +37,4 @@ velocity all create 300.0 41279 loop geom fix 1 all nve fix 2 all qeq/reax 1 0.0 10.0 1e-6 reax/c -run 100 +run $t From 2e7ca5f65cc8fd421a04b324a6815953e1641d37 Mon Sep 17 00:00:00 2001 From: oywg11 Date: Sat, 3 Jun 2023 18:14:45 +0800 Subject: [PATCH 155/396] rename the pair style --- .../{pair_ilp_water_2dm.cpp => pair_aip_water_2dm.cpp} | 0 src/INTERLAYER/{pair_ilp_water_2dm.h => pair_aip_water_2dm.h} | 0 src/INTERLAYER/pair_ilp_graphene_hbn.cpp | 2 +- src/INTERLAYER/pair_ilp_graphene_hbn.h | 2 +- 4 files changed, 2 insertions(+), 2 deletions(-) rename src/INTERLAYER/{pair_ilp_water_2dm.cpp => pair_aip_water_2dm.cpp} (100%) rename src/INTERLAYER/{pair_ilp_water_2dm.h => pair_aip_water_2dm.h} (100%) diff --git a/src/INTERLAYER/pair_ilp_water_2dm.cpp b/src/INTERLAYER/pair_aip_water_2dm.cpp similarity index 100% rename from src/INTERLAYER/pair_ilp_water_2dm.cpp rename to src/INTERLAYER/pair_aip_water_2dm.cpp diff --git a/src/INTERLAYER/pair_ilp_water_2dm.h b/src/INTERLAYER/pair_aip_water_2dm.h similarity index 100% rename from src/INTERLAYER/pair_ilp_water_2dm.h rename to src/INTERLAYER/pair_aip_water_2dm.h diff --git a/src/INTERLAYER/pair_ilp_graphene_hbn.cpp b/src/INTERLAYER/pair_ilp_graphene_hbn.cpp index 6d7526e3dd..e6711d0f19 100644 --- a/src/INTERLAYER/pair_ilp_graphene_hbn.cpp +++ b/src/INTERLAYER/pair_ilp_graphene_hbn.cpp @@ -59,7 +59,7 @@ static const char cite_ilp[] = static std::map variant_map = { {PairILPGrapheneHBN::ILP_GrhBN, "ilp/graphene/hbn"}, {PairILPGrapheneHBN::ILP_TMD, "ilp/tmd"}, - {PairILPGrapheneHBN::ILP_WATER_2DM, "ilp/water/2dm"}, + {PairILPGrapheneHBN::AIP_WATER_2DM, "aip/water/2dm"}, {PairILPGrapheneHBN::SAIP_METAL, "saip/metal"}}; /* ---------------------------------------------------------------------- */ diff --git a/src/INTERLAYER/pair_ilp_graphene_hbn.h b/src/INTERLAYER/pair_ilp_graphene_hbn.h index e27fce420a..e151ecc801 100644 --- a/src/INTERLAYER/pair_ilp_graphene_hbn.h +++ b/src/INTERLAYER/pair_ilp_graphene_hbn.h @@ -39,7 +39,7 @@ class PairILPGrapheneHBN : public Pair { static constexpr int NPARAMS_PER_LINE = 13; - enum { ILP_GrhBN, ILP_TMD, SAIP_METAL, ILP_WATER_2DM }; // for telling class variants apart in shared code + enum { ILP_GrhBN, ILP_TMD, SAIP_METAL, AIP_WATER_2DM }; // for telling class variants apart in shared code protected: int me; From 8c6e2ca000b7ad201c3c2676582832066343fc00 Mon Sep 17 00:00:00 2001 From: oywg11 Date: Sat, 3 Jun 2023 20:34:42 +0800 Subject: [PATCH 156/396] rename the opt pair style --- ...2dm_opt.cpp => pair_aip_water_2dm_opt.cpp} | 0 ...ter_2dm_opt.h => pair_aip_water_2dm_opt.h} | 0 src/OPT/pair_ilp_graphene_hbn_opt.cpp | 24 +++++++++---------- 3 files changed, 12 insertions(+), 12 deletions(-) rename src/OPT/{pair_ilp_water_2dm_opt.cpp => pair_aip_water_2dm_opt.cpp} (100%) rename src/OPT/{pair_ilp_water_2dm_opt.h => pair_aip_water_2dm_opt.h} (100%) diff --git a/src/OPT/pair_ilp_water_2dm_opt.cpp b/src/OPT/pair_aip_water_2dm_opt.cpp similarity index 100% rename from src/OPT/pair_ilp_water_2dm_opt.cpp rename to src/OPT/pair_aip_water_2dm_opt.cpp diff --git a/src/OPT/pair_ilp_water_2dm_opt.h b/src/OPT/pair_aip_water_2dm_opt.h similarity index 100% rename from src/OPT/pair_ilp_water_2dm_opt.h rename to src/OPT/pair_aip_water_2dm_opt.h diff --git a/src/OPT/pair_ilp_graphene_hbn_opt.cpp b/src/OPT/pair_ilp_graphene_hbn_opt.cpp index e8cb205a52..b2abcec7be 100644 --- a/src/OPT/pair_ilp_graphene_hbn_opt.cpp +++ b/src/OPT/pair_ilp_graphene_hbn_opt.cpp @@ -169,33 +169,33 @@ void PairILPGrapheneHBNOpt::compute(int eflag, int vflag) } } } - } else if (variant == ILP_WATER_2DM) { + } else if (variant == AIP_WATER_2DM) { if (eflag_global || eflag_atom) { if (vflag_either) { if (tap_flag) { - eval<6, 1, 1, 1, ILP_WATER_2DM>(); + eval<6, 1, 1, 1, AIP_WATER_2DM>(); } else { - eval<6, 1, 1, 0, ILP_WATER_2DM>(); + eval<6, 1, 1, 0, AIP_WATER_2DM>(); } } else { if (tap_flag) { - eval<6, 1, 0, 1, ILP_WATER_2DM>(); + eval<6, 1, 0, 1, AIP_WATER_2DM>(); } else { - eval<6, 1, 0, 0, ILP_WATER_2DM>(); + eval<6, 1, 0, 0, AIP_WATER_2DM>(); } } } else { if (vflag_either) { if (tap_flag) { - eval<6, 0, 1, 1, ILP_WATER_2DM>(); + eval<6, 0, 1, 1, AIP_WATER_2DM>(); } else { - eval<6, 0, 1, 0, ILP_WATER_2DM>(); + eval<6, 0, 1, 0, AIP_WATER_2DM>(); } } else { if (tap_flag) { - eval<6, 0, 0, 1, ILP_WATER_2DM>(); + eval<6, 0, 0, 1, AIP_WATER_2DM>(); } else { - eval<6, 0, 0, 0, ILP_WATER_2DM>(); + eval<6, 0, 0, 0, AIP_WATER_2DM>(); } } } @@ -286,7 +286,7 @@ void PairILPGrapheneHBNOpt::eval() rsq = delx * delx + dely * dely + delz * delz; if (rsq != 0 && rsq < cutILPsq[itype_map][jtype]) { - if ((VARIANT == ILP_TMD || VARIANT == ILP_WATER_2DM) && special_type[itype] == TMD_METAL && itype != type[j]) continue; + if ((VARIANT == ILP_TMD || VARIANT == AIP_WATER_2DM) && special_type[itype] == TMD_METAL && itype != type[j]) continue; if (ILP_nneigh >= MAX_NNEIGH) { error->one(FLERR, "There are too many neighbors for calculating normals"); } @@ -519,8 +519,8 @@ void PairILPGrapheneHBNOpt::calc_normal(int i, int itype, int *ILP_neigh, int nn vet[jj][2] = x[j][2] - x[i][2]; } - //specialize for ILP_WATER_2DM for hydrogen has special normal vector rule - if (variant == ILP_WATER_2DM && special_type[itype] == WATER) { + //specialize for AIP_WATER_2DM for hydrogen has special normal vector rule + if (variant == AIP_WATER_2DM && special_type[itype] == WATER) { if (nneigh == 1){ n[0] = vet[0][0]; n[1] = vet[0][1]; From a25100120bf59ac93f772b4ae158d9f1a8508304 Mon Sep 17 00:00:00 2001 From: oywg11 Date: Sat, 3 Jun 2023 20:36:12 +0800 Subject: [PATCH 157/396] update the doc file --- doc/src/{pair_ilp_water_2dm.rst => pair_aip_water_2dm.rst} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename doc/src/{pair_ilp_water_2dm.rst => pair_aip_water_2dm.rst} (100%) diff --git a/doc/src/pair_ilp_water_2dm.rst b/doc/src/pair_aip_water_2dm.rst similarity index 100% rename from doc/src/pair_ilp_water_2dm.rst rename to doc/src/pair_aip_water_2dm.rst From d85342cd6da16eded485da0e544bc35eddf35b94 Mon Sep 17 00:00:00 2001 From: Evangelos Voyiatzis Date: Sat, 3 Jun 2023 16:04:40 +0300 Subject: [PATCH 158/396] Update test_compute_global.cpp --- unittest/commands/test_compute_global.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/unittest/commands/test_compute_global.cpp b/unittest/commands/test_compute_global.cpp index 66a24f049f..04913f51b5 100644 --- a/unittest/commands/test_compute_global.cpp +++ b/unittest/commands/test_compute_global.cpp @@ -169,7 +169,7 @@ TEST_F(ComputeGlobalTest, Geometry) command("compute mom1 all momentum"); command("compute mom2 allwater momentum"); command("compute mop1 all stress/mop x 0.0 total"); - command("compute mop2 all stress/mop/profile z lower 0.5 kin conf"); + command("compute mop2 all stress/mop/profile z lower 0.5 kin pair"); thermo_style += " c_mu1 c_mu2 c_mop1[*] c_mop2[1][1]"; } From 738a955c4012397c0fadcbac740a6f48ad3d8909 Mon Sep 17 00:00:00 2001 From: oywg11 Date: Sat, 3 Jun 2023 22:37:57 +0800 Subject: [PATCH 159/396] fix checkstyle issues --- src/INTERLAYER/pair_aip_water_2dm.cpp | 14 +++++++------- src/INTERLAYER/pair_aip_water_2dm.h | 19 +++++-------------- src/OPT/pair_aip_water_2dm_opt.cpp | 12 ++++++------ src/OPT/pair_aip_water_2dm_opt.h | 12 ++++++------ 4 files changed, 24 insertions(+), 33 deletions(-) diff --git a/src/INTERLAYER/pair_aip_water_2dm.cpp b/src/INTERLAYER/pair_aip_water_2dm.cpp index 3747d249de..d88676a6e2 100644 --- a/src/INTERLAYER/pair_aip_water_2dm.cpp +++ b/src/INTERLAYER/pair_aip_water_2dm.cpp @@ -18,7 +18,7 @@ [Feng and Ouyang et al, J. Phys. Chem. C 127, 8704-8713 (2023).] ------------------------------------------------------------------------- */ -#include "pair_ilp_water_2dm.h" +#include "pair_aip_water_2dm.h" #include "atom.h" #include "citeme.h" @@ -40,7 +40,7 @@ using namespace InterLayer; #define DELTA 4 #define PGDELTA 1 -static const char cite_ilp_water[] = +static const char cite_aip_water[] = "ilp/water/2dm potential doi/10.1021/acs.jpcc.2c08464\n" "@Article{Feng2023\n" " author = {Z. Feng, Y. Yao, J. Liu, B. Wu, Z. Liu, and W. Ouyang},\n" @@ -53,26 +53,26 @@ static const char cite_ilp_water[] = /* ---------------------------------------------------------------------- */ -PairILPWATER2DM::PairILPWATER2DM(LAMMPS *lmp) : PairILPGrapheneHBN(lmp), PairILPTMD(lmp) +PairAIPWATER2DM::PairAIPWATER2DM(LAMMPS *lmp) : PairILPGrapheneHBN(lmp), PairILPTMD(lmp) { - variant = ILP_WATER_2DM; + variant = AIP_WATER_2DM; single_enable = 0; // for TMD, each atom have six neighbors Nnei = 6; - if (lmp->citeme) lmp->citeme->add(cite_ilp_water); + if (lmp->citeme) lmp->citeme->add(cite_aip_water); } /* ---------------------------------------------------------------------- global settings ------------------------------------------------------------------------- */ -void PairILPWATER2DM::settings(int narg, char **arg) +void PairAIPWATER2DM::settings(int narg, char **arg) { if (narg < 1 || narg > 2) error->all(FLERR, "Illegal pair_style command"); if (!utils::strmatch(force->pair_style, "^hybrid/overlay")) - error->all(FLERR, "Pair style ilp/water/2dm must be used as sub-style with hybrid/overlay"); + error->all(FLERR, "Pair style aip/water/2dm must be used as sub-style with hybrid/overlay"); cut_global = utils::numeric(FLERR, arg[0], false, lmp); if (narg == 2) tap_flag = utils::numeric(FLERR, arg[1], false, lmp); diff --git a/src/INTERLAYER/pair_aip_water_2dm.h b/src/INTERLAYER/pair_aip_water_2dm.h index fad9f99ff1..295cdfffb9 100644 --- a/src/INTERLAYER/pair_aip_water_2dm.h +++ b/src/INTERLAYER/pair_aip_water_2dm.h @@ -13,33 +13,24 @@ #ifdef PAIR_CLASS // clang-format off -PairStyle(ilp/water/2dm,PairILPWATER2DM); +PairStyle(aip/water/2dm,PairAIPWATER2DM); // clang-format on #else -#ifndef LMP_PAIR_ILP_WATER_2DM_H -#define LMP_PAIR_ILP_WATER_2DM_H +#ifndef LMP_PAIR_AIP_WATER_2DM_H +#define LMP_PAIR_AIP_WATER_2DM_H #include "pair_ilp_tmd.h" namespace LAMMPS_NS { -class PairILPWATER2DM : virtual public PairILPTMD { +class PairAIPWATER2DM : virtual public PairILPTMD { public: - PairILPWATER2DM(class LAMMPS *); + PairAIPWATER2DM(class LAMMPS *); protected: void settings(int, char **) override; - /**************************************************************/ - /* modulo operation with cycling around range */ - - inline int modulo(int k, int range) - { - if (k < 0) k += range; - return k % range; - } - /**************************************************************/ }; } // namespace LAMMPS_NS diff --git a/src/OPT/pair_aip_water_2dm_opt.cpp b/src/OPT/pair_aip_water_2dm_opt.cpp index 316551c345..17e981e479 100644 --- a/src/OPT/pair_aip_water_2dm_opt.cpp +++ b/src/OPT/pair_aip_water_2dm_opt.cpp @@ -11,7 +11,7 @@ ------------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- - This is an optimized version of ilp/water/2dm based on the contribution of: + This is an optimized version of aip/water/2dm based on the contribution of: author: Wengen Ouyang (Wuhan University) e-mail: w.g.ouyang at gmail dot com @@ -30,7 +30,7 @@ Potential is described by: [Feng and Ouyang et al, J. Phys. Chem. C 127, 8704-8713 (2023).] */ -#include "pair_ilp_water_2dm_opt.h" +#include "pair_aip_water_2dm_opt.h" #include "atom.h" #include "citeme.h" @@ -49,15 +49,15 @@ using namespace LAMMPS_NS; using namespace InterLayer; -PairILPWATER2DMOpt::PairILPWATER2DMOpt(LAMMPS *lmp) : - PairILPGrapheneHBN(lmp), PairILPTMD(lmp), PairILPWATER2DM(lmp), PairILPGrapheneHBNOpt(lmp) +PairAIPWATER2DMOpt::PairAIPWATER2DMOpt(LAMMPS *lmp) : + PairILPGrapheneHBN(lmp), PairILPTMD(lmp), PairAIPWATER2DM(lmp), PairILPGrapheneHBNOpt(lmp) { } -void PairILPWATER2DMOpt::coeff(int narg, char **args) +void PairAIPWATER2DMOpt::coeff(int narg, char **args) { PairILPTMD::coeff(narg, args); - memory->create(special_type, atom->ntypes + 1, "PairILPWATER2DMOpt:check_sublayer"); + memory->create(special_type, atom->ntypes + 1, "PairAIPWATER2DMOpt:check_sublayer"); for (int i = 1; i <= atom->ntypes; i++) { int itype = map[i]; if (strcmp(elements[itype], "Mo") == 0 || strcmp(elements[itype], "W") == 0 || diff --git a/src/OPT/pair_aip_water_2dm_opt.h b/src/OPT/pair_aip_water_2dm_opt.h index 8062de880a..46280c2b82 100644 --- a/src/OPT/pair_aip_water_2dm_opt.h +++ b/src/OPT/pair_aip_water_2dm_opt.h @@ -13,21 +13,21 @@ #ifdef PAIR_CLASS // clang-format off -PairStyle(ilp/water/2dm/opt,PairILPWATER2DMOpt); +PairStyle(aip/water/2dm/opt,PairAIPWATER2DMOpt); // clang-format on #else -#ifndef LMP_PAIR_ILP_WATER_2DM_OPT_H -#define LMP_PAIR_ILP_WATER_2DM_OPT_H +#ifndef LMP_PAIR_AIP_WATER_2DM_OPT_H +#define LMP_PAIR_AIP_WATER_2DM_OPT_H #include "pair_ilp_graphene_hbn_opt.h" -#include "pair_ilp_water_2dm.h" +#include "pair_aip_water_2dm.h" namespace LAMMPS_NS { -class PairILPWATER2DMOpt : public PairILPWATER2DM, public PairILPGrapheneHBNOpt { +class PairAIPWATER2DMOpt : public PairAIPWATER2DM, public PairILPGrapheneHBNOpt { public: - PairILPWATER2DMOpt(class LAMMPS *); + PairAIPWATER2DMOpt(class LAMMPS *); void coeff(int narg, char **args) override; protected: From a40b87b05c1e278b2c836c5d131d8b2a1603cd67 Mon Sep 17 00:00:00 2001 From: oywg11 Date: Sat, 3 Jun 2023 22:46:33 +0800 Subject: [PATCH 160/396] rename potential files --- potentials/{COH.DMC.ILP => COH.DMC.aip.water.2dm} | 6 +++--- potentials/{COH.ILP => COH.aip.water.2dm} | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) rename potentials/{COH.DMC.ILP => COH.DMC.aip.water.2dm} (91%) mode change 100755 => 100644 rename potentials/{COH.ILP => COH.aip.water.2dm} (94%) mode change 100755 => 100644 diff --git a/potentials/COH.DMC.ILP b/potentials/COH.DMC.aip.water.2dm old mode 100755 new mode 100644 similarity index 91% rename from potentials/COH.DMC.ILP rename to potentials/COH.DMC.aip.water.2dm index 7235afcdab..f3619dd3f1 --- a/potentials/COH.DMC.ILP +++ b/potentials/COH.DMC.aip.water.2dm @@ -1,5 +1,5 @@ -# DATE: 2023-05-18 UNITS: metal CONTRIBUTOR: Wengen Ouyang w.g.ouyang@gmail.com CITATION: Z. Feng, ..., and W. Ouyang, J. Phys. Chem. C 127, 8704 (2023). -# Interlayer Potential (ILP) for water/graphene heterojunctions +# DATE: 2022-12-02 UNITS: metal CONTRIBUTOR: Wengen Ouyang w.g.ouyang@gmail.com CITATION: Z. Feng, ..., and W. Ouyang, J. Phys. Chem. C 127, 8704 (2023). +# Anisotropic Interfacial Potential (AIP) parameters for water/graphene heterojunctions # The parameters below are fitted against the DMC reference data that rescaled from PBE+MBD-NL. # # ----------------- Repulsion Potential ------------------++++++++++++++ Vdw Potential ++++++++++++++++************ @@ -25,4 +25,4 @@ Hw H 5.45369612 6.18172364 1.25025450 0.00000000 0.00000000 9.05706482 1.232494 Ow Ow 5.45369612 6.18172364 1.25025450 0.00000000 0.00000000 9.05706482 1.23249498 2.77577173 0.00000000 1.0 1.2 Hw Hw 5.45369612 6.18172364 1.25025450 0.00000000 0.00000000 9.05706482 1.23249498 2.77577173 0.00000000 1.0 1.2 Ow Hw 5.45369612 6.18172364 1.25025450 0.00000000 0.00000000 9.05706482 1.23249498 2.77577173 0.00000000 1.0 1.2 -Hw Ow 5.45369612 6.18172364 1.25025450 0.00000000 0.00000000 9.05706482 1.23249498 2.77577173 0.00000000 1.0 1.2 \ No newline at end of file +Hw Ow 5.45369612 6.18172364 1.25025450 0.00000000 0.00000000 9.05706482 1.23249498 2.77577173 0.00000000 1.0 1.2 diff --git a/potentials/COH.ILP b/potentials/COH.aip.water.2dm old mode 100755 new mode 100644 similarity index 94% rename from potentials/COH.ILP rename to potentials/COH.aip.water.2dm index bd815b5c00..5325399abe --- a/potentials/COH.ILP +++ b/potentials/COH.aip.water.2dm @@ -1,5 +1,5 @@ -# DATE: 2023-05-18 UNITS: metal CONTRIBUTOR: Wengen Ouyang w.g.ouyang@gmail.com CITATION: Z. Feng, ..., and W. Ouyang, J. Phys. Chem. C 127, 8704 (2023). -# Interlayer Potential (ILP) for water/graphene heterojunctions +# DATE: 2022-12-02 UNITS: metal CONTRIBUTOR: Wengen Ouyang w.g.ouyang@gmail.com CITATION: Z. Feng, ..., and W. Ouyang, J. Phys. Chem. C 127, 8704 (2023). +# Anisotropic Interfacial Potential (AIP) parameters for water/graphene heterojunctions # The parameters below are fitted against the PBE + MBD-NL DFT reference data from 2.5 A to 15 A. # # ----------------- Repulsion Potential ------------------++++++++++++++ Vdw Potential ++++++++++++++++************ From f507e30d3698a44103b6acc404d20aa484a977ea Mon Sep 17 00:00:00 2001 From: oywg11 Date: Sat, 3 Jun 2023 22:52:45 +0800 Subject: [PATCH 161/396] update input files of examples --- .../aip_water_2dm/COH.aip.water.2dm | 1 + .../gra_water.data | 0 .../in.gr_water | 22 +++++++++---------- .../in.gr_water.opt | 22 +++++++++---------- .../log.18May23.water.g++.1 | 0 .../log.18May23.water.g++.4 | 0 .../log.18May23.water.opt.g++.1 | 0 .../log.18May23.water.opt.g++.4 | 0 .../PACKAGES/interlayer/ilp_water_2dm/COH.ILP | 1 - 9 files changed, 23 insertions(+), 23 deletions(-) create mode 120000 examples/PACKAGES/interlayer/aip_water_2dm/COH.aip.water.2dm rename examples/PACKAGES/interlayer/{ilp_water_2dm => aip_water_2dm}/gra_water.data (100%) rename examples/PACKAGES/interlayer/{ilp_water_2dm => aip_water_2dm}/in.gr_water (73%) rename examples/PACKAGES/interlayer/{ilp_water_2dm => aip_water_2dm}/in.gr_water.opt (73%) rename examples/PACKAGES/interlayer/{ilp_water_2dm => aip_water_2dm}/log.18May23.water.g++.1 (100%) rename examples/PACKAGES/interlayer/{ilp_water_2dm => aip_water_2dm}/log.18May23.water.g++.4 (100%) rename examples/PACKAGES/interlayer/{ilp_water_2dm => aip_water_2dm}/log.18May23.water.opt.g++.1 (100%) rename examples/PACKAGES/interlayer/{ilp_water_2dm => aip_water_2dm}/log.18May23.water.opt.g++.4 (100%) delete mode 120000 examples/PACKAGES/interlayer/ilp_water_2dm/COH.ILP diff --git a/examples/PACKAGES/interlayer/aip_water_2dm/COH.aip.water.2dm b/examples/PACKAGES/interlayer/aip_water_2dm/COH.aip.water.2dm new file mode 120000 index 0000000000..fe5cccfcd2 --- /dev/null +++ b/examples/PACKAGES/interlayer/aip_water_2dm/COH.aip.water.2dm @@ -0,0 +1 @@ +../../../../potentials/COH.aip.water.2dm \ No newline at end of file diff --git a/examples/PACKAGES/interlayer/ilp_water_2dm/gra_water.data b/examples/PACKAGES/interlayer/aip_water_2dm/gra_water.data similarity index 100% rename from examples/PACKAGES/interlayer/ilp_water_2dm/gra_water.data rename to examples/PACKAGES/interlayer/aip_water_2dm/gra_water.data diff --git a/examples/PACKAGES/interlayer/ilp_water_2dm/in.gr_water b/examples/PACKAGES/interlayer/aip_water_2dm/in.gr_water similarity index 73% rename from examples/PACKAGES/interlayer/ilp_water_2dm/in.gr_water rename to examples/PACKAGES/interlayer/aip_water_2dm/in.gr_water index 9fccbf733b..9f8e717a7e 100644 --- a/examples/PACKAGES/interlayer/ilp_water_2dm/in.gr_water +++ b/examples/PACKAGES/interlayer/aip_water_2dm/in.gr_water @@ -12,13 +12,13 @@ group gr molecule 1 group water molecule 2 ######################## Potential defition ############################## # Interlayer potential -pair_style hybrid/overlay ilp/water/2dm 16.0 lj/cut/tip4p/long 2 3 1 1 0.1546 10 8.5 +pair_style hybrid/overlay aip/water/2dm 16.0 lj/cut/tip4p/long 2 3 1 1 0.1546 10 8.5 #################################################################### pair_coeff 1 1 none -pair_coeff 2 2 lj/cut/tip4p/long 8.0313e-3 3.1589 # O-O +pair_coeff 2 2 lj/cut/tip4p/long 8.0313e-3 3.1589 # O-O pair_coeff 2 3 lj/cut/tip4p/long 0.0 0.0 # O-H -pair_coeff 3 3 lj/cut/tip4p/long 0.0 0.0 # H-H -pair_coeff * * ilp/water/2dm COH.ILP C Ow Hw # C-water +pair_coeff 3 3 lj/cut/tip4p/long 0.0 0.0 # H-H +pair_coeff * * aip/water/2dm COH.aip.water.2dm C Ow Hw # C-H2O # bond and angle bond_style harmonic bond_coeff 1 0.0 0.9572 @@ -32,7 +32,7 @@ neigh_modify every 1 delay 5 check yes page 1000000 one 100000 #################################################################### # Calculate pair energy compute 1 all pair lj/cut/tip4p/long -compute 2 all pair ilp/water/2dm +compute 2 all pair aip/water/2dm compute wt water temp variable TIP4P equal c_1 variable EILP equal c_2 # total interlayer energy @@ -42,10 +42,10 @@ thermo_style custom step etotal pe ke v_TIP4P v_EILP v_temp_wt thermo 100 thermo_modify lost error -fix subf gr setforce 0.0 0.0 0.0 -fix 1 water shake 0.0001 20 100 b 1 a 1 +fix subf gr setforce 0.0 0.0 0.0 +fix 1 water shake 0.0001 20 100 b 1 a 1 -timestep 1e-3 -velocity water create 300.0 12345 dist gaussian mom yes rot yes -fix 2 water nve -run 1000 +timestep 1e-3 +velocity water create 300.0 12345 dist gaussian mom yes rot yes +fix 2 water nve +run 1000 diff --git a/examples/PACKAGES/interlayer/ilp_water_2dm/in.gr_water.opt b/examples/PACKAGES/interlayer/aip_water_2dm/in.gr_water.opt similarity index 73% rename from examples/PACKAGES/interlayer/ilp_water_2dm/in.gr_water.opt rename to examples/PACKAGES/interlayer/aip_water_2dm/in.gr_water.opt index 1b38ab6e6e..8494bfcb3e 100644 --- a/examples/PACKAGES/interlayer/ilp_water_2dm/in.gr_water.opt +++ b/examples/PACKAGES/interlayer/aip_water_2dm/in.gr_water.opt @@ -12,13 +12,13 @@ group gr molecule 1 group water molecule 2 ######################## Potential defition ############################## # Interlayer potential -pair_style hybrid/overlay ilp/water/2dm/opt 16.0 lj/cut/tip4p/long 2 3 1 1 0.1546 10 8.5 +pair_style hybrid/overlay aip/water/2dm/opt 16.0 lj/cut/tip4p/long 2 3 1 1 0.1546 10 8.5 #################################################################### pair_coeff 1 1 none -pair_coeff 2 2 lj/cut/tip4p/long 8.0313e-3 3.1589 # O-O +pair_coeff 2 2 lj/cut/tip4p/long 8.0313e-3 3.1589 # O-O pair_coeff 2 3 lj/cut/tip4p/long 0.0 0.0 # O-H -pair_coeff 3 3 lj/cut/tip4p/long 0.0 0.0 # H-H -pair_coeff * * ilp/water/2dm/opt COH.ILP C Ow Hw # C-water +pair_coeff 3 3 lj/cut/tip4p/long 0.0 0.0 # H-H +pair_coeff * * aip/water/2dm/opt COH.aip.water.2dm C Ow Hw # C-H2O # bond and angle bond_style harmonic bond_coeff 1 0.0 0.9572 @@ -32,7 +32,7 @@ neigh_modify every 1 delay 5 check yes page 1000000 one 100000 #################################################################### # Calculate pair energy compute 1 all pair lj/cut/tip4p/long -compute 2 all pair ilp/water/2dm/opt +compute 2 all pair aip/water/2dm/opt compute wt water temp variable TIP4P equal c_1 variable EILP equal c_2 # total interlayer energy @@ -42,10 +42,10 @@ thermo_style custom step etotal pe ke v_TIP4P v_EILP v_temp_wt thermo 100 thermo_modify lost error -fix subf gr setforce 0.0 0.0 0.0 -fix 1 water shake 0.0001 20 100 b 1 a 1 +fix subf gr setforce 0.0 0.0 0.0 +fix 1 water shake 0.0001 20 100 b 1 a 1 -timestep 1e-3 -velocity water create 300.0 12345 dist gaussian mom yes rot yes -fix 2 water nve -run 1000 +timestep 1e-3 +velocity water create 300.0 12345 dist gaussian mom yes rot yes +fix 2 water nve +run 1000 diff --git a/examples/PACKAGES/interlayer/ilp_water_2dm/log.18May23.water.g++.1 b/examples/PACKAGES/interlayer/aip_water_2dm/log.18May23.water.g++.1 similarity index 100% rename from examples/PACKAGES/interlayer/ilp_water_2dm/log.18May23.water.g++.1 rename to examples/PACKAGES/interlayer/aip_water_2dm/log.18May23.water.g++.1 diff --git a/examples/PACKAGES/interlayer/ilp_water_2dm/log.18May23.water.g++.4 b/examples/PACKAGES/interlayer/aip_water_2dm/log.18May23.water.g++.4 similarity index 100% rename from examples/PACKAGES/interlayer/ilp_water_2dm/log.18May23.water.g++.4 rename to examples/PACKAGES/interlayer/aip_water_2dm/log.18May23.water.g++.4 diff --git a/examples/PACKAGES/interlayer/ilp_water_2dm/log.18May23.water.opt.g++.1 b/examples/PACKAGES/interlayer/aip_water_2dm/log.18May23.water.opt.g++.1 similarity index 100% rename from examples/PACKAGES/interlayer/ilp_water_2dm/log.18May23.water.opt.g++.1 rename to examples/PACKAGES/interlayer/aip_water_2dm/log.18May23.water.opt.g++.1 diff --git a/examples/PACKAGES/interlayer/ilp_water_2dm/log.18May23.water.opt.g++.4 b/examples/PACKAGES/interlayer/aip_water_2dm/log.18May23.water.opt.g++.4 similarity index 100% rename from examples/PACKAGES/interlayer/ilp_water_2dm/log.18May23.water.opt.g++.4 rename to examples/PACKAGES/interlayer/aip_water_2dm/log.18May23.water.opt.g++.4 diff --git a/examples/PACKAGES/interlayer/ilp_water_2dm/COH.ILP b/examples/PACKAGES/interlayer/ilp_water_2dm/COH.ILP deleted file mode 120000 index 526995dae4..0000000000 --- a/examples/PACKAGES/interlayer/ilp_water_2dm/COH.ILP +++ /dev/null @@ -1 +0,0 @@ -../../../../potentials/COH.ILP \ No newline at end of file From 63f3d183fe57cd035e8989c1df9f28f56d414c1e Mon Sep 17 00:00:00 2001 From: oywg11 Date: Sat, 3 Jun 2023 23:02:45 +0800 Subject: [PATCH 162/396] rename log files of examples --- .../{log.18May23.water.g++.1 => log.18May23.gr_water.g++.1} | 0 .../{log.18May23.water.g++.4 => log.18May23.gr_water.g++.4} | 0 ...log.18May23.water.opt.g++.1 => log.18May23.gr_water.opt.g++.1} | 0 ...log.18May23.water.opt.g++.4 => log.18May23.gr_water.opt.g++.4} | 0 4 files changed, 0 insertions(+), 0 deletions(-) rename examples/PACKAGES/interlayer/aip_water_2dm/{log.18May23.water.g++.1 => log.18May23.gr_water.g++.1} (100%) rename examples/PACKAGES/interlayer/aip_water_2dm/{log.18May23.water.g++.4 => log.18May23.gr_water.g++.4} (100%) rename examples/PACKAGES/interlayer/aip_water_2dm/{log.18May23.water.opt.g++.1 => log.18May23.gr_water.opt.g++.1} (100%) rename examples/PACKAGES/interlayer/aip_water_2dm/{log.18May23.water.opt.g++.4 => log.18May23.gr_water.opt.g++.4} (100%) diff --git a/examples/PACKAGES/interlayer/aip_water_2dm/log.18May23.water.g++.1 b/examples/PACKAGES/interlayer/aip_water_2dm/log.18May23.gr_water.g++.1 similarity index 100% rename from examples/PACKAGES/interlayer/aip_water_2dm/log.18May23.water.g++.1 rename to examples/PACKAGES/interlayer/aip_water_2dm/log.18May23.gr_water.g++.1 diff --git a/examples/PACKAGES/interlayer/aip_water_2dm/log.18May23.water.g++.4 b/examples/PACKAGES/interlayer/aip_water_2dm/log.18May23.gr_water.g++.4 similarity index 100% rename from examples/PACKAGES/interlayer/aip_water_2dm/log.18May23.water.g++.4 rename to examples/PACKAGES/interlayer/aip_water_2dm/log.18May23.gr_water.g++.4 diff --git a/examples/PACKAGES/interlayer/aip_water_2dm/log.18May23.water.opt.g++.1 b/examples/PACKAGES/interlayer/aip_water_2dm/log.18May23.gr_water.opt.g++.1 similarity index 100% rename from examples/PACKAGES/interlayer/aip_water_2dm/log.18May23.water.opt.g++.1 rename to examples/PACKAGES/interlayer/aip_water_2dm/log.18May23.gr_water.opt.g++.1 diff --git a/examples/PACKAGES/interlayer/aip_water_2dm/log.18May23.water.opt.g++.4 b/examples/PACKAGES/interlayer/aip_water_2dm/log.18May23.gr_water.opt.g++.4 similarity index 100% rename from examples/PACKAGES/interlayer/aip_water_2dm/log.18May23.water.opt.g++.4 rename to examples/PACKAGES/interlayer/aip_water_2dm/log.18May23.gr_water.opt.g++.4 From b5ab173763f7c6941c6f6b994f541ef3e9750017 Mon Sep 17 00:00:00 2001 From: oywg11 Date: Sat, 3 Jun 2023 23:03:12 +0800 Subject: [PATCH 163/396] update the doc file --- doc/src/pair_aip_water_2dm.rst | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/doc/src/pair_aip_water_2dm.rst b/doc/src/pair_aip_water_2dm.rst index 6a364f38ed..517cc00f4b 100644 --- a/doc/src/pair_aip_water_2dm.rst +++ b/doc/src/pair_aip_water_2dm.rst @@ -1,17 +1,17 @@ -.. index:: pair_style ilp/water/2dm -.. index:: pair_style ilp/water/2dm/opt +.. index:: pair_style aip/water/2dm +.. index:: pair_style aip/water/2dm/opt pair_style ilp/tmd command =================================== -Accelerator Variant: *ilp/water/2dm/opt* +Accelerator Variant: *aip/water/2dm/opt* Syntax """""" .. code-block:: LAMMPS - pair_style [hybrid/overlay ...] ilp/tmd cutoff tap_flag + pair_style [hybrid/overlay ...] aip/water/2dm cutoff tap_flag * cutoff = global cutoff (distance units) * tap_flag = 0/1 to turn off/on the taper function @@ -21,22 +21,22 @@ Examples .. code-block:: LAMMPS - pair_style hybrid/overlay ilp/water/2dm 16.0 1 - pair_coeff * * ilp/water/2dm COH.ILP C Ow Hw + pair_style hybrid/overlay aip/water/2dm 16.0 1 + pair_coeff * * aip/water/2dm COH.aip.water.2dm C Ow Hw - pair_style hybrid/overlay ilp/water/2dm 16.0 lj/cut/tip4p/long 2 3 1 1 0.1546 10 8.5 + pair_style hybrid/overlay aip/water/2dm 16.0 lj/cut/tip4p/long 2 3 1 1 0.1546 10 8.5 pair_coeff 2 2 lj/cut/tip4p/long 8.0313e-3 3.1589 # O-O pair_coeff 2 3 lj/cut/tip4p/long 0.0 0.0 # O-H pair_coeff 3 3 lj/cut/tip4p/long 0.0 0.0 # H-H - pair_coeff * * ilp/water/2dm COH.ILP C Ow Hw + pair_coeff * * aip/water/2dm COH.aip.water.2dm C Ow Hw Description """"""""""" .. versionadded:: xxxx2023 -The *ilp/water/2dm* style computes the registry-dependent interlayer -potential (ILP) potential for interfaces of water with two-dimensinal (2D) +The *aip/water/2dm* style computes the anisotropic interfacial +potential (AIP) potential for interfaces of water with two-dimensinal (2D) materials as described in :ref:`(Feng) `. .. math:: @@ -69,7 +69,7 @@ calculating the normals. oxygen-hydrogen bonds and the normal vector of the central oxygen atom is defined as their average. -The parameter file (e.g. COH.ILP), is intended for use with *metal* +The parameter file (e.g. COH.aip.water.2dm), is intended for use with *metal* :doc:`units `, with energies in meV. Two additional parameters, *S*, and *rcut* are included in the parameter file. *S* is designed to facilitate scaling of energies. *rcut* is designed to build the neighbor @@ -77,7 +77,7 @@ list for calculating the normals for each atom pair. .. note:: - The parameters presented in the parameter file (e.g. COH.ILP), + The parameters presented in the parameter file (e.g. COH.aip.water.2dm), are fitted with taper function by setting the cutoff equal to 16.0 Angstrom. Using different cutoff or taper function should be careful. These parameters provide a good description in both short- and long-range @@ -100,7 +100,7 @@ headings) the following commands could be included in an input script: .. code-block:: LAMMPS - compute 0 all pair ilp/water/2dm + compute 0 all pair aip/water/2dm variable Evdw equal c_0[1] variable Erep equal c_0[2] thermo_style custom step temp epair v_Erep v_Evdw @@ -132,10 +132,10 @@ if LAMMPS was built with that package. See the :doc:`Build package This pair style requires the newton setting to be *on* for pair interactions. -The COH.ILP potential file provided with LAMMPS (see the potentials +The COH.aip.water.2dm potential file provided with LAMMPS (see the potentials directory) are parameterized for *metal* units. You can use this potential with any LAMMPS units, but you would need to create your -COH.ILP potential file with coefficients listed in the appropriate +COH.aip.water.2dm potential file with coefficients listed in the appropriate units, if your simulation does not use *metal* units. Related commands From 196641927f6973ac76eca00b78b718a0f67cc925 Mon Sep 17 00:00:00 2001 From: oywg11 Date: Sat, 3 Jun 2023 23:07:55 +0800 Subject: [PATCH 164/396] correct a typo in the doc file --- doc/src/pair_aip_water_2dm.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/src/pair_aip_water_2dm.rst b/doc/src/pair_aip_water_2dm.rst index 517cc00f4b..3ae63e1e45 100644 --- a/doc/src/pair_aip_water_2dm.rst +++ b/doc/src/pair_aip_water_2dm.rst @@ -1,7 +1,7 @@ .. index:: pair_style aip/water/2dm .. index:: pair_style aip/water/2dm/opt -pair_style ilp/tmd command +pair_style aip/water/2dm command =================================== Accelerator Variant: *aip/water/2dm/opt* From bf8a4402cef5d2b9da6c0ffcc0c93e4f03ec0932 Mon Sep 17 00:00:00 2001 From: oywg11 Date: Sun, 4 Jun 2023 10:17:21 +0800 Subject: [PATCH 165/396] update log files in the examples --- .../aip_water_2dm/log.18May23.gr_water.g++.1 | 83 ++++++++++--------- .../aip_water_2dm/log.18May23.gr_water.g++.4 | 81 +++++++++--------- .../log.18May23.gr_water.opt.g++.1 | 83 ++++++++++--------- .../log.18May23.gr_water.opt.g++.4 | 81 +++++++++--------- 4 files changed, 174 insertions(+), 154 deletions(-) diff --git a/examples/PACKAGES/interlayer/aip_water_2dm/log.18May23.gr_water.g++.1 b/examples/PACKAGES/interlayer/aip_water_2dm/log.18May23.gr_water.g++.1 index 6e13280f70..c8268c72f6 100644 --- a/examples/PACKAGES/interlayer/aip_water_2dm/log.18May23.gr_water.g++.1 +++ b/examples/PACKAGES/interlayer/aip_water_2dm/log.18May23.gr_water.g++.1 @@ -1,4 +1,4 @@ -LAMMPS (23 Jun 2022) +LAMMPS (23 Jun 2022 - Update 4) OMP_NUM_THREADS environment is not set. Defaulting to 1 thread. (../comm.cpp:98) using 1 OpenMP thread(s) per MPI task # Initialization @@ -29,8 +29,8 @@ Finding 1-2 1-3 1-4 neighbors ... 1 = max # of 1-3 neighbors 1 = max # of 1-4 neighbors 2 = max # of special neighbors - special bonds CPU = 0.005 seconds - read_data CPU = 0.020 seconds + special bonds CPU = 0.000 seconds + read_data CPU = 0.012 seconds mass 1 12.0107 # carbon mass (g/mole) mass 2 15.9994 # oxygen mass (g/mole) mass 3 1.008 # hydrogen mass (g/mole) @@ -41,14 +41,14 @@ group water molecule 2 144 atoms in group water ######################## Potential defition ############################## # Interlayer potential -pair_style hybrid/overlay ilp/water/2dm 16.0 lj/cut/tip4p/long 2 3 1 1 0.1546 10 8.5 +pair_style hybrid/overlay aip/water/2dm 16.0 lj/cut/tip4p/long 2 3 1 1 0.1546 10 8.5 #################################################################### pair_coeff 1 1 none -pair_coeff 2 2 lj/cut/tip4p/long 8.0313e-3 3.1589 # O-O +pair_coeff 2 2 lj/cut/tip4p/long 8.0313e-3 3.1589 # O-O pair_coeff 2 3 lj/cut/tip4p/long 0.0 0.0 # O-H -pair_coeff 3 3 lj/cut/tip4p/long 0.0 0.0 # H-H -pair_coeff * * ilp/water/2dm COH.ILP C Ow Hw # C-water -Reading ilp/water/2dm potential file COH.ILP with DATE: 2023-05-17 +pair_coeff 3 3 lj/cut/tip4p/long 0.0 0.0 # H-H +pair_coeff * * aip/water/2dm COH.aip.water.2dm C Ow Hw # C-H2O +Reading aip/water/2dm potential file COH.aip.water.2dm with DATE: 2022-12-02 # bond and angle bond_style harmonic bond_coeff 1 0.0 0.9572 @@ -62,7 +62,7 @@ neigh_modify every 1 delay 5 check yes page 1000000 one 100000 #################################################################### # Calculate pair energy compute 1 all pair lj/cut/tip4p/long -compute 2 all pair ilp/water/2dm +compute 2 all pair aip/water/2dm compute wt water temp variable TIP4P equal c_1 variable EILP equal c_2 # total interlayer energy @@ -72,18 +72,18 @@ thermo_style custom step etotal pe ke v_TIP4P v_EILP v_temp_wt thermo 100 thermo_modify lost error -fix subf gr setforce 0.0 0.0 0.0 -fix 1 water shake 0.0001 20 100 b 1 a 1 +fix subf gr setforce 0.0 0.0 0.0 +fix 1 water shake 0.0001 20 100 b 1 a 1 0 = # of size 2 clusters 0 = # of size 3 clusters 0 = # of size 4 clusters 48 = # of frozen angles - find clusters CPU = 0.001 seconds + find clusters CPU = 0.000 seconds -timestep 1e-3 -velocity water create 300.0 12345 dist gaussian mom yes rot yes -fix 2 water nve -run 1000 +timestep 1e-3 +velocity water create 300.0 12345 dist gaussian mom yes rot yes +fix 2 water nve +run 1000 CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE @@ -91,22 +91,24 @@ Your simulation uses code contributions which should be cited: - ilp/graphene/hbn potential doi:10.1021/acs.nanolett.8b02848 @Article{Ouyang2018 - author = {W. Ouyang, D. Mandelli, M. Urbakh, and O. Hod}, + author = {W. Ouyang and D. Mandelli and M. Urbakh and O. Hod}, title = {Nanoserpents: Graphene Nanoribbon Motion on Two-Dimensional Hexagonal Materials}, journal = {Nano Letters}, volume = 18, - pages = {6009} + pages = 6009, year = 2018, } -- ilp/tmd potential doi/10.1021/acs.jctc.1c00782 +- ilp/tmd potential doi:10.1021/acs.jctc.1c00782 @Article{Ouyang2021 - author = {W. Ouyang, R. Sofer, X. Gao, J. Hermann, A. Tkatchenko, L. Kronik, M. Urbakh, and O. Hod}, - title = {Anisotropic Interlayer Force Field for Transition Metal Dichalcogenides: The Case of Molybdenum Disulfide}, - journal = {J. Chem. Theory Comput.}, - volume = 17, - pages = {7237–7245} - year = 2021, + author = {W. Ouyang and R. Sofer and X. Gao and J. Hermann and + A. Tkatchenko and L. Kronik and M. Urbakh and O. Hod}, + title = {Anisotropic Interlayer Force Field for Transition + Metal Dichalcogenides: The Case of Molybdenum Disulfide}, + journal = {J.~Chem.\ Theory Comput.}, + volume = 17, + pages = {7237--7245} + year = 2021, } - ilp/water/2dm potential doi/10.1021/acs.jpcc.2c08464 @@ -132,6 +134,8 @@ PPPM initialization ... using single precision MKL FFT 3d grid and FFT values/proc = 84320 48000 WARNING: Using a manybody potential with bonds/angles/dihedrals and special_bond exclusions (../pair.cpp:239) +WARNING: Communication cutoff 0 is shorter than a bond length based estimate of 3.4358. This may lead to errors. (../comm.cpp:727) +WARNING: Increasing communication cutoff to 11.6118 for TIP4P pair style (../pair_lj_cut_tip4p_long.cpp:484) Neighbor list info ... update every 1 steps, delay 5 steps, check yes max neighbors/atom: 100000, page size: 1000000 @@ -139,7 +143,7 @@ Neighbor list info ... ghost atom cutoff = 18 binsize = 9, bins = 6 5 23 3 neighbor lists, perpetual/occasional/extra = 3 0 0 - (1) pair ilp/water/2dm, perpetual + (1) pair aip/water/2dm, perpetual attributes: full, newton on, ghost pair build: full/bin/ghost stencil: full/ghost/bin/3d @@ -154,10 +158,11 @@ Neighbor list info ... pair build: half/bin/newton stencil: half/bin/3d bin: standard +WARNING: Communication cutoff adjusted to 18 (../comm.cpp:736) SHAKE stats (type/ave/delta/count) on step 0 Bond: 1 0.957201 2.19705e-06 96 Angle: 1 104.52 0.000203056 48 -Per MPI rank memory allocation (min/avg/max) = 33.53 | 33.53 | 33.53 Mbytes +Per MPI rank memory allocation (min/avg/max) = 32.9 | 32.9 | 32.9 Mbytes Step TotEng PotEng KinEng v_TIP4P v_EILP v_temp_wt 0 -16.131263 -19.815178 3.6839141 189.37246 -1.903543 300 SHAKE stats (type/ave/delta/count) on step 100 @@ -200,22 +205,22 @@ SHAKE stats (type/ave/delta/count) on step 1000 Bond: 1 0.9572 1.00586e-06 96 Angle: 1 104.52 0.000111712 48 1000 -17.498465 -20.331545 2.8330804 188.87473 -1.812177 230.71225 -Loop time of 20.801 on 1 procs for 1000 steps with 936 atoms +Loop time of 20.3334 on 1 procs for 1000 steps with 936 atoms -Performance: 4.154 ns/day, 5.778 hours/ns, 48.075 timesteps/s -99.9% CPU use with 1 MPI tasks x 1 OpenMP threads +Performance: 4.249 ns/day, 5.648 hours/ns, 49.180 timesteps/s +99.5% CPU use with 1 MPI tasks x 1 OpenMP threads MPI task timing breakdown: Section | min time | avg time | max time |%varavg| %total --------------------------------------------------------------- -Pair | 16.429 | 16.429 | 16.429 | 0.0 | 78.98 -Bond | 0.0010991 | 0.0010991 | 0.0010991 | 0.0 | 0.01 -Kspace | 3.4769 | 3.4769 | 3.4769 | 0.0 | 16.72 -Neigh | 0.83359 | 0.83359 | 0.83359 | 0.0 | 4.01 -Comm | 0.028825 | 0.028825 | 0.028825 | 0.0 | 0.14 -Output | 0.00046349 | 0.00046349 | 0.00046349 | 0.0 | 0.00 -Modify | 0.01943 | 0.01943 | 0.01943 | 0.0 | 0.09 -Other | | 0.01154 | | | 0.06 +Pair | 16.179 | 16.179 | 16.179 | 0.0 | 79.57 +Bond | 0.00021103 | 0.00021103 | 0.00021103 | 0.0 | 0.00 +Kspace | 3.3118 | 3.3118 | 3.3118 | 0.0 | 16.29 +Neigh | 0.79017 | 0.79017 | 0.79017 | 0.0 | 3.89 +Comm | 0.026379 | 0.026379 | 0.026379 | 0.0 | 0.13 +Output | 0.00046496 | 0.00046496 | 0.00046496 | 0.0 | 0.00 +Modify | 0.017013 | 0.017013 | 0.017013 | 0.0 | 0.08 +Other | | 0.008835 | | | 0.04 Nlocal: 936 ave 936 max 936 min Histogram: 1 0 0 0 0 0 0 0 0 0 @@ -231,4 +236,4 @@ Ave neighs/atom = 460.87821 Ave special neighs/atom = 0.30769231 Neighbor list builds = 28 Dangerous builds = 0 -Total wall time: 0:00:21 +Total wall time: 0:00:20 diff --git a/examples/PACKAGES/interlayer/aip_water_2dm/log.18May23.gr_water.g++.4 b/examples/PACKAGES/interlayer/aip_water_2dm/log.18May23.gr_water.g++.4 index 078ca76e2e..ab28c96657 100644 --- a/examples/PACKAGES/interlayer/aip_water_2dm/log.18May23.gr_water.g++.4 +++ b/examples/PACKAGES/interlayer/aip_water_2dm/log.18May23.gr_water.g++.4 @@ -1,4 +1,4 @@ -LAMMPS (23 Jun 2022) +LAMMPS (23 Jun 2022 - Update 4) OMP_NUM_THREADS environment is not set. Defaulting to 1 thread. (../comm.cpp:98) using 1 OpenMP thread(s) per MPI task # Initialization @@ -29,8 +29,8 @@ Finding 1-2 1-3 1-4 neighbors ... 1 = max # of 1-3 neighbors 1 = max # of 1-4 neighbors 2 = max # of special neighbors - special bonds CPU = 0.003 seconds - read_data CPU = 0.018 seconds + special bonds CPU = 0.001 seconds + read_data CPU = 0.017 seconds mass 1 12.0107 # carbon mass (g/mole) mass 2 15.9994 # oxygen mass (g/mole) mass 3 1.008 # hydrogen mass (g/mole) @@ -41,14 +41,14 @@ group water molecule 2 144 atoms in group water ######################## Potential defition ############################## # Interlayer potential -pair_style hybrid/overlay ilp/water/2dm 16.0 lj/cut/tip4p/long 2 3 1 1 0.1546 10 8.5 +pair_style hybrid/overlay aip/water/2dm 16.0 lj/cut/tip4p/long 2 3 1 1 0.1546 10 8.5 #################################################################### pair_coeff 1 1 none -pair_coeff 2 2 lj/cut/tip4p/long 8.0313e-3 3.1589 # O-O +pair_coeff 2 2 lj/cut/tip4p/long 8.0313e-3 3.1589 # O-O pair_coeff 2 3 lj/cut/tip4p/long 0.0 0.0 # O-H -pair_coeff 3 3 lj/cut/tip4p/long 0.0 0.0 # H-H -pair_coeff * * ilp/water/2dm COH.ILP C Ow Hw # C-water -Reading ilp/water/2dm potential file COH.ILP with DATE: 2023-05-17 +pair_coeff 3 3 lj/cut/tip4p/long 0.0 0.0 # H-H +pair_coeff * * aip/water/2dm COH.aip.water.2dm C Ow Hw # C-H2O +Reading aip/water/2dm potential file COH.aip.water.2dm with DATE: 2022-12-02 # bond and angle bond_style harmonic bond_coeff 1 0.0 0.9572 @@ -62,7 +62,7 @@ neigh_modify every 1 delay 5 check yes page 1000000 one 100000 #################################################################### # Calculate pair energy compute 1 all pair lj/cut/tip4p/long -compute 2 all pair ilp/water/2dm +compute 2 all pair aip/water/2dm compute wt water temp variable TIP4P equal c_1 variable EILP equal c_2 # total interlayer energy @@ -72,18 +72,18 @@ thermo_style custom step etotal pe ke v_TIP4P v_EILP v_temp_wt thermo 100 thermo_modify lost error -fix subf gr setforce 0.0 0.0 0.0 -fix 1 water shake 0.0001 20 100 b 1 a 1 +fix subf gr setforce 0.0 0.0 0.0 +fix 1 water shake 0.0001 20 100 b 1 a 1 0 = # of size 2 clusters 0 = # of size 3 clusters 0 = # of size 4 clusters 48 = # of frozen angles - find clusters CPU = 0.001 seconds + find clusters CPU = 0.000 seconds -timestep 1e-3 -velocity water create 300.0 12345 dist gaussian mom yes rot yes -fix 2 water nve -run 1000 +timestep 1e-3 +velocity water create 300.0 12345 dist gaussian mom yes rot yes +fix 2 water nve +run 1000 CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE @@ -91,22 +91,24 @@ Your simulation uses code contributions which should be cited: - ilp/graphene/hbn potential doi:10.1021/acs.nanolett.8b02848 @Article{Ouyang2018 - author = {W. Ouyang, D. Mandelli, M. Urbakh, and O. Hod}, + author = {W. Ouyang and D. Mandelli and M. Urbakh and O. Hod}, title = {Nanoserpents: Graphene Nanoribbon Motion on Two-Dimensional Hexagonal Materials}, journal = {Nano Letters}, volume = 18, - pages = {6009} + pages = 6009, year = 2018, } -- ilp/tmd potential doi/10.1021/acs.jctc.1c00782 +- ilp/tmd potential doi:10.1021/acs.jctc.1c00782 @Article{Ouyang2021 - author = {W. Ouyang, R. Sofer, X. Gao, J. Hermann, A. Tkatchenko, L. Kronik, M. Urbakh, and O. Hod}, - title = {Anisotropic Interlayer Force Field for Transition Metal Dichalcogenides: The Case of Molybdenum Disulfide}, - journal = {J. Chem. Theory Comput.}, - volume = 17, - pages = {7237–7245} - year = 2021, + author = {W. Ouyang and R. Sofer and X. Gao and J. Hermann and + A. Tkatchenko and L. Kronik and M. Urbakh and O. Hod}, + title = {Anisotropic Interlayer Force Field for Transition + Metal Dichalcogenides: The Case of Molybdenum Disulfide}, + journal = {J.~Chem.\ Theory Comput.}, + volume = 17, + pages = {7237--7245} + year = 2021, } - ilp/water/2dm potential doi/10.1021/acs.jpcc.2c08464 @@ -132,6 +134,8 @@ PPPM initialization ... using single precision MKL FFT 3d grid and FFT values/proc = 30685 12480 WARNING: Using a manybody potential with bonds/angles/dihedrals and special_bond exclusions (../pair.cpp:239) +WARNING: Communication cutoff 0 is shorter than a bond length based estimate of 3.4358. This may lead to errors. (../comm.cpp:727) +WARNING: Increasing communication cutoff to 11.6118 for TIP4P pair style (../pair_lj_cut_tip4p_long.cpp:484) Neighbor list info ... update every 1 steps, delay 5 steps, check yes max neighbors/atom: 100000, page size: 1000000 @@ -139,7 +143,7 @@ Neighbor list info ... ghost atom cutoff = 18 binsize = 9, bins = 6 5 23 3 neighbor lists, perpetual/occasional/extra = 3 0 0 - (1) pair ilp/water/2dm, perpetual + (1) pair aip/water/2dm, perpetual attributes: full, newton on, ghost pair build: full/bin/ghost stencil: full/ghost/bin/3d @@ -154,10 +158,11 @@ Neighbor list info ... pair build: half/bin/newton stencil: half/bin/3d bin: standard +WARNING: Communication cutoff adjusted to 18 (../comm.cpp:736) SHAKE stats (type/ave/delta/count) on step 0 Bond: 1 0.957201 2.19705e-06 96 Angle: 1 104.52 0.000203056 48 -Per MPI rank memory allocation (min/avg/max) = 25.84 | 25.88 | 25.92 Mbytes +Per MPI rank memory allocation (min/avg/max) = 25.22 | 25.25 | 25.29 Mbytes Step TotEng PotEng KinEng v_TIP4P v_EILP v_temp_wt 0 -16.131263 -19.815178 3.6839141 189.37246 -1.903543 300 SHAKE stats (type/ave/delta/count) on step 100 @@ -200,22 +205,22 @@ SHAKE stats (type/ave/delta/count) on step 1000 Bond: 1 0.9572 1.00568e-06 96 Angle: 1 104.52 0.000111707 48 1000 -17.498474 -20.331607 2.833133 188.87466 -1.8121689 230.71654 -Loop time of 9.42273 on 4 procs for 1000 steps with 936 atoms +Loop time of 9.05361 on 4 procs for 1000 steps with 936 atoms -Performance: 9.169 ns/day, 2.617 hours/ns, 106.126 timesteps/s -97.1% CPU use with 4 MPI tasks x 1 OpenMP threads +Performance: 9.543 ns/day, 2.515 hours/ns, 110.453 timesteps/s +99.6% CPU use with 4 MPI tasks x 1 OpenMP threads MPI task timing breakdown: Section | min time | avg time | max time |%varavg| %total --------------------------------------------------------------- -Pair | 2.2328 | 4.3228 | 7.5931 | 103.1 | 45.88 -Bond | 0.00084131 | 0.00088983 | 0.00095229 | 0.0 | 0.01 -Kspace | 1.3979 | 4.6476 | 6.7252 | 98.8 | 49.32 -Neigh | 0.34367 | 0.34371 | 0.34376 | 0.0 | 3.65 -Comm | 0.042806 | 0.062908 | 0.075887 | 5.4 | 0.67 -Output | 0.00037677 | 0.00041431 | 0.0004619 | 0.0 | 0.00 -Modify | 0.028432 | 0.031138 | 0.034528 | 1.3 | 0.33 -Other | | 0.01321 | | | 0.14 +Pair | 2.462 | 4.2266 | 7.1075 | 89.3 | 46.68 +Bond | 0.00018424 | 0.00019878 | 0.00022125 | 0.0 | 0.00 +Kspace | 1.4698 | 4.338 | 6.1001 | 87.8 | 47.91 +Neigh | 0.39462 | 0.39489 | 0.39518 | 0.0 | 4.36 +Comm | 0.043753 | 0.055826 | 0.062746 | 3.1 | 0.62 +Output | 0.00048755 | 0.00053971 | 0.00062785 | 0.0 | 0.01 +Modify | 0.027255 | 0.028664 | 0.030278 | 0.7 | 0.32 +Other | | 0.008904 | | | 0.10 Nlocal: 234 ave 302 max 198 min Histogram: 2 0 0 1 0 0 0 0 0 1 diff --git a/examples/PACKAGES/interlayer/aip_water_2dm/log.18May23.gr_water.opt.g++.1 b/examples/PACKAGES/interlayer/aip_water_2dm/log.18May23.gr_water.opt.g++.1 index c6a11d209d..c795e85d56 100644 --- a/examples/PACKAGES/interlayer/aip_water_2dm/log.18May23.gr_water.opt.g++.1 +++ b/examples/PACKAGES/interlayer/aip_water_2dm/log.18May23.gr_water.opt.g++.1 @@ -1,4 +1,4 @@ -LAMMPS (23 Jun 2022) +LAMMPS (23 Jun 2022 - Update 4) OMP_NUM_THREADS environment is not set. Defaulting to 1 thread. (../comm.cpp:98) using 1 OpenMP thread(s) per MPI task # Initialization @@ -29,8 +29,8 @@ Finding 1-2 1-3 1-4 neighbors ... 1 = max # of 1-3 neighbors 1 = max # of 1-4 neighbors 2 = max # of special neighbors - special bonds CPU = 0.005 seconds - read_data CPU = 0.020 seconds + special bonds CPU = 0.000 seconds + read_data CPU = 0.012 seconds mass 1 12.0107 # carbon mass (g/mole) mass 2 15.9994 # oxygen mass (g/mole) mass 3 1.008 # hydrogen mass (g/mole) @@ -41,14 +41,14 @@ group water molecule 2 144 atoms in group water ######################## Potential defition ############################## # Interlayer potential -pair_style hybrid/overlay ilp/water/2dm/opt 16.0 lj/cut/tip4p/long 2 3 1 1 0.1546 10 8.5 +pair_style hybrid/overlay aip/water/2dm/opt 16.0 lj/cut/tip4p/long 2 3 1 1 0.1546 10 8.5 #################################################################### pair_coeff 1 1 none -pair_coeff 2 2 lj/cut/tip4p/long 8.0313e-3 3.1589 # O-O +pair_coeff 2 2 lj/cut/tip4p/long 8.0313e-3 3.1589 # O-O pair_coeff 2 3 lj/cut/tip4p/long 0.0 0.0 # O-H -pair_coeff 3 3 lj/cut/tip4p/long 0.0 0.0 # H-H -pair_coeff * * ilp/water/2dm/opt COH.ILP C Ow Hw # C-water -Reading ilp/water/2dm potential file COH.ILP with DATE: 2023-05-17 +pair_coeff 3 3 lj/cut/tip4p/long 0.0 0.0 # H-H +pair_coeff * * aip/water/2dm/opt COH.aip.water.2dm C Ow Hw # C-H2O +Reading aip/water/2dm potential file COH.aip.water.2dm with DATE: 2022-12-02 # bond and angle bond_style harmonic bond_coeff 1 0.0 0.9572 @@ -62,7 +62,7 @@ neigh_modify every 1 delay 5 check yes page 1000000 one 100000 #################################################################### # Calculate pair energy compute 1 all pair lj/cut/tip4p/long -compute 2 all pair ilp/water/2dm/opt +compute 2 all pair aip/water/2dm/opt compute wt water temp variable TIP4P equal c_1 variable EILP equal c_2 # total interlayer energy @@ -72,18 +72,18 @@ thermo_style custom step etotal pe ke v_TIP4P v_EILP v_temp_wt thermo 100 thermo_modify lost error -fix subf gr setforce 0.0 0.0 0.0 -fix 1 water shake 0.0001 20 100 b 1 a 1 +fix subf gr setforce 0.0 0.0 0.0 +fix 1 water shake 0.0001 20 100 b 1 a 1 0 = # of size 2 clusters 0 = # of size 3 clusters 0 = # of size 4 clusters 48 = # of frozen angles - find clusters CPU = 0.001 seconds + find clusters CPU = 0.000 seconds -timestep 1e-3 -velocity water create 300.0 12345 dist gaussian mom yes rot yes -fix 2 water nve -run 1000 +timestep 1e-3 +velocity water create 300.0 12345 dist gaussian mom yes rot yes +fix 2 water nve +run 1000 CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE @@ -91,22 +91,24 @@ Your simulation uses code contributions which should be cited: - ilp/graphene/hbn potential doi:10.1021/acs.nanolett.8b02848 @Article{Ouyang2018 - author = {W. Ouyang, D. Mandelli, M. Urbakh, and O. Hod}, + author = {W. Ouyang and D. Mandelli and M. Urbakh and O. Hod}, title = {Nanoserpents: Graphene Nanoribbon Motion on Two-Dimensional Hexagonal Materials}, journal = {Nano Letters}, volume = 18, - pages = {6009} + pages = 6009, year = 2018, } -- ilp/tmd potential doi/10.1021/acs.jctc.1c00782 +- ilp/tmd potential doi:10.1021/acs.jctc.1c00782 @Article{Ouyang2021 - author = {W. Ouyang, R. Sofer, X. Gao, J. Hermann, A. Tkatchenko, L. Kronik, M. Urbakh, and O. Hod}, - title = {Anisotropic Interlayer Force Field for Transition Metal Dichalcogenides: The Case of Molybdenum Disulfide}, - journal = {J. Chem. Theory Comput.}, - volume = 17, - pages = {7237–7245} - year = 2021, + author = {W. Ouyang and R. Sofer and X. Gao and J. Hermann and + A. Tkatchenko and L. Kronik and M. Urbakh and O. Hod}, + title = {Anisotropic Interlayer Force Field for Transition + Metal Dichalcogenides: The Case of Molybdenum Disulfide}, + journal = {J.~Chem.\ Theory Comput.}, + volume = 17, + pages = {7237--7245} + year = 2021, } - ilp/water/2dm potential doi/10.1021/acs.jpcc.2c08464 @@ -149,6 +151,8 @@ PPPM initialization ... using single precision MKL FFT 3d grid and FFT values/proc = 84320 48000 WARNING: Using a manybody potential with bonds/angles/dihedrals and special_bond exclusions (../pair.cpp:239) +WARNING: Communication cutoff 0 is shorter than a bond length based estimate of 3.4358. This may lead to errors. (../comm.cpp:727) +WARNING: Increasing communication cutoff to 11.6118 for TIP4P pair style (../pair_lj_cut_tip4p_long.cpp:484) Neighbor list info ... update every 1 steps, delay 5 steps, check yes max neighbors/atom: 100000, page size: 1000000 @@ -156,7 +160,7 @@ Neighbor list info ... ghost atom cutoff = 18 binsize = 9, bins = 6 5 23 3 neighbor lists, perpetual/occasional/extra = 3 0 0 - (1) pair ilp/water/2dm/opt, perpetual + (1) pair aip/water/2dm/opt, perpetual attributes: full, newton on pair build: full/bin stencil: full/bin/3d @@ -171,10 +175,11 @@ Neighbor list info ... pair build: halffull/newton stencil: none bin: none +WARNING: Communication cutoff adjusted to 18 (../comm.cpp:736) SHAKE stats (type/ave/delta/count) on step 0 Bond: 1 0.957201 2.19705e-06 96 Angle: 1 104.52 0.000203056 48 -Per MPI rank memory allocation (min/avg/max) = 25.89 | 25.89 | 25.89 Mbytes +Per MPI rank memory allocation (min/avg/max) = 25.27 | 25.27 | 25.27 Mbytes Step TotEng PotEng KinEng v_TIP4P v_EILP v_temp_wt 0 -16.131263 -19.815178 3.6839141 189.37246 -1.903543 300 SHAKE stats (type/ave/delta/count) on step 100 @@ -217,22 +222,22 @@ SHAKE stats (type/ave/delta/count) on step 1000 Bond: 1 0.9572 1.00586e-06 96 Angle: 1 104.52 0.000111711 48 1000 -17.498466 -20.331547 2.8330808 188.87473 -1.8121768 230.71228 -Loop time of 8.95265 on 1 procs for 1000 steps with 936 atoms +Loop time of 8.11929 on 1 procs for 1000 steps with 936 atoms -Performance: 9.651 ns/day, 2.487 hours/ns, 111.699 timesteps/s -100.0% CPU use with 1 MPI tasks x 1 OpenMP threads +Performance: 10.641 ns/day, 2.255 hours/ns, 123.163 timesteps/s +99.7% CPU use with 1 MPI tasks x 1 OpenMP threads MPI task timing breakdown: Section | min time | avg time | max time |%varavg| %total --------------------------------------------------------------- -Pair | 5.2127 | 5.2127 | 5.2127 | 0.0 | 58.23 -Bond | 0.00083377 | 0.00083377 | 0.00083377 | 0.0 | 0.01 -Kspace | 3.5005 | 3.5005 | 3.5005 | 0.0 | 39.10 -Neigh | 0.17946 | 0.17946 | 0.17946 | 0.0 | 2.00 -Comm | 0.028553 | 0.028553 | 0.028553 | 0.0 | 0.32 -Output | 0.00035446 | 0.00035446 | 0.00035446 | 0.0 | 0.00 -Modify | 0.01889 | 0.01889 | 0.01889 | 0.0 | 0.21 -Other | | 0.01135 | | | 0.13 +Pair | 4.6849 | 4.6849 | 4.6849 | 0.0 | 57.70 +Bond | 0.00017678 | 0.00017678 | 0.00017678 | 0.0 | 0.00 +Kspace | 3.2098 | 3.2098 | 3.2098 | 0.0 | 39.53 +Neigh | 0.17546 | 0.17546 | 0.17546 | 0.0 | 2.16 +Comm | 0.024693 | 0.024693 | 0.024693 | 0.0 | 0.30 +Output | 0.00037798 | 0.00037798 | 0.00037798 | 0.0 | 0.00 +Modify | 0.015853 | 0.015853 | 0.015853 | 0.0 | 0.20 +Other | | 0.007983 | | | 0.10 Nlocal: 936 ave 936 max 936 min Histogram: 1 0 0 0 0 0 0 0 0 0 @@ -248,4 +253,4 @@ Ave neighs/atom = 460.87821 Ave special neighs/atom = 0.30769231 Neighbor list builds = 28 Dangerous builds = 0 -Total wall time: 0:00:09 +Total wall time: 0:00:08 diff --git a/examples/PACKAGES/interlayer/aip_water_2dm/log.18May23.gr_water.opt.g++.4 b/examples/PACKAGES/interlayer/aip_water_2dm/log.18May23.gr_water.opt.g++.4 index 852c429323..f885c5708d 100644 --- a/examples/PACKAGES/interlayer/aip_water_2dm/log.18May23.gr_water.opt.g++.4 +++ b/examples/PACKAGES/interlayer/aip_water_2dm/log.18May23.gr_water.opt.g++.4 @@ -1,4 +1,4 @@ -LAMMPS (23 Jun 2022) +LAMMPS (23 Jun 2022 - Update 4) OMP_NUM_THREADS environment is not set. Defaulting to 1 thread. (../comm.cpp:98) using 1 OpenMP thread(s) per MPI task # Initialization @@ -29,8 +29,8 @@ Finding 1-2 1-3 1-4 neighbors ... 1 = max # of 1-3 neighbors 1 = max # of 1-4 neighbors 2 = max # of special neighbors - special bonds CPU = 0.003 seconds - read_data CPU = 0.017 seconds + special bonds CPU = 0.001 seconds + read_data CPU = 0.014 seconds mass 1 12.0107 # carbon mass (g/mole) mass 2 15.9994 # oxygen mass (g/mole) mass 3 1.008 # hydrogen mass (g/mole) @@ -41,14 +41,14 @@ group water molecule 2 144 atoms in group water ######################## Potential defition ############################## # Interlayer potential -pair_style hybrid/overlay ilp/water/2dm/opt 16.0 lj/cut/tip4p/long 2 3 1 1 0.1546 10 8.5 +pair_style hybrid/overlay aip/water/2dm/opt 16.0 lj/cut/tip4p/long 2 3 1 1 0.1546 10 8.5 #################################################################### pair_coeff 1 1 none -pair_coeff 2 2 lj/cut/tip4p/long 8.0313e-3 3.1589 # O-O +pair_coeff 2 2 lj/cut/tip4p/long 8.0313e-3 3.1589 # O-O pair_coeff 2 3 lj/cut/tip4p/long 0.0 0.0 # O-H -pair_coeff 3 3 lj/cut/tip4p/long 0.0 0.0 # H-H -pair_coeff * * ilp/water/2dm/opt COH.ILP C Ow Hw # C-water -Reading ilp/water/2dm potential file COH.ILP with DATE: 2023-05-17 +pair_coeff 3 3 lj/cut/tip4p/long 0.0 0.0 # H-H +pair_coeff * * aip/water/2dm/opt COH.aip.water.2dm C Ow Hw # C-H2O +Reading aip/water/2dm potential file COH.aip.water.2dm with DATE: 2022-12-02 # bond and angle bond_style harmonic bond_coeff 1 0.0 0.9572 @@ -62,7 +62,7 @@ neigh_modify every 1 delay 5 check yes page 1000000 one 100000 #################################################################### # Calculate pair energy compute 1 all pair lj/cut/tip4p/long -compute 2 all pair ilp/water/2dm/opt +compute 2 all pair aip/water/2dm/opt compute wt water temp variable TIP4P equal c_1 variable EILP equal c_2 # total interlayer energy @@ -72,18 +72,18 @@ thermo_style custom step etotal pe ke v_TIP4P v_EILP v_temp_wt thermo 100 thermo_modify lost error -fix subf gr setforce 0.0 0.0 0.0 -fix 1 water shake 0.0001 20 100 b 1 a 1 +fix subf gr setforce 0.0 0.0 0.0 +fix 1 water shake 0.0001 20 100 b 1 a 1 0 = # of size 2 clusters 0 = # of size 3 clusters 0 = # of size 4 clusters 48 = # of frozen angles - find clusters CPU = 0.001 seconds + find clusters CPU = 0.000 seconds -timestep 1e-3 -velocity water create 300.0 12345 dist gaussian mom yes rot yes -fix 2 water nve -run 1000 +timestep 1e-3 +velocity water create 300.0 12345 dist gaussian mom yes rot yes +fix 2 water nve +run 1000 CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE @@ -91,22 +91,24 @@ Your simulation uses code contributions which should be cited: - ilp/graphene/hbn potential doi:10.1021/acs.nanolett.8b02848 @Article{Ouyang2018 - author = {W. Ouyang, D. Mandelli, M. Urbakh, and O. Hod}, + author = {W. Ouyang and D. Mandelli and M. Urbakh and O. Hod}, title = {Nanoserpents: Graphene Nanoribbon Motion on Two-Dimensional Hexagonal Materials}, journal = {Nano Letters}, volume = 18, - pages = {6009} + pages = 6009, year = 2018, } -- ilp/tmd potential doi/10.1021/acs.jctc.1c00782 +- ilp/tmd potential doi:10.1021/acs.jctc.1c00782 @Article{Ouyang2021 - author = {W. Ouyang, R. Sofer, X. Gao, J. Hermann, A. Tkatchenko, L. Kronik, M. Urbakh, and O. Hod}, - title = {Anisotropic Interlayer Force Field for Transition Metal Dichalcogenides: The Case of Molybdenum Disulfide}, - journal = {J. Chem. Theory Comput.}, - volume = 17, - pages = {7237–7245} - year = 2021, + author = {W. Ouyang and R. Sofer and X. Gao and J. Hermann and + A. Tkatchenko and L. Kronik and M. Urbakh and O. Hod}, + title = {Anisotropic Interlayer Force Field for Transition + Metal Dichalcogenides: The Case of Molybdenum Disulfide}, + journal = {J.~Chem.\ Theory Comput.}, + volume = 17, + pages = {7237--7245} + year = 2021, } - ilp/water/2dm potential doi/10.1021/acs.jpcc.2c08464 @@ -149,6 +151,8 @@ PPPM initialization ... using single precision MKL FFT 3d grid and FFT values/proc = 30685 12480 WARNING: Using a manybody potential with bonds/angles/dihedrals and special_bond exclusions (../pair.cpp:239) +WARNING: Communication cutoff 0 is shorter than a bond length based estimate of 3.4358. This may lead to errors. (../comm.cpp:727) +WARNING: Increasing communication cutoff to 11.6118 for TIP4P pair style (../pair_lj_cut_tip4p_long.cpp:484) Neighbor list info ... update every 1 steps, delay 5 steps, check yes max neighbors/atom: 100000, page size: 1000000 @@ -156,7 +160,7 @@ Neighbor list info ... ghost atom cutoff = 18 binsize = 9, bins = 6 5 23 3 neighbor lists, perpetual/occasional/extra = 3 0 0 - (1) pair ilp/water/2dm/opt, perpetual + (1) pair aip/water/2dm/opt, perpetual attributes: full, newton on pair build: full/bin stencil: full/bin/3d @@ -171,10 +175,11 @@ Neighbor list info ... pair build: halffull/newton stencil: none bin: none +WARNING: Communication cutoff adjusted to 18 (../comm.cpp:736) SHAKE stats (type/ave/delta/count) on step 0 Bond: 1 0.957201 2.19705e-06 96 Angle: 1 104.52 0.000203056 48 -Per MPI rank memory allocation (min/avg/max) = 22.03 | 22.06 | 22.1 Mbytes +Per MPI rank memory allocation (min/avg/max) = 21.4 | 21.44 | 21.48 Mbytes Step TotEng PotEng KinEng v_TIP4P v_EILP v_temp_wt 0 -16.131263 -19.815178 3.6839141 189.37246 -1.903543 300 SHAKE stats (type/ave/delta/count) on step 100 @@ -217,22 +222,22 @@ SHAKE stats (type/ave/delta/count) on step 1000 Bond: 1 0.9572 1.00568e-06 96 Angle: 1 104.52 0.000111707 48 1000 -17.498472 -20.331605 2.8331335 188.87466 -1.8121689 230.71657 -Loop time of 4.7828 on 4 procs for 1000 steps with 936 atoms +Loop time of 4.24862 on 4 procs for 1000 steps with 936 atoms -Performance: 18.065 ns/day, 1.329 hours/ns, 209.082 timesteps/s -96.3% CPU use with 4 MPI tasks x 1 OpenMP threads +Performance: 20.336 ns/day, 1.180 hours/ns, 235.370 timesteps/s +99.6% CPU use with 4 MPI tasks x 1 OpenMP threads MPI task timing breakdown: Section | min time | avg time | max time |%varavg| %total --------------------------------------------------------------- -Pair | 0.26735 | 1.3839 | 3.2059 | 99.7 | 28.93 -Bond | 0.00079377 | 0.00086039 | 0.00093529 | 0.0 | 0.02 -Kspace | 1.4248 | 3.2254 | 4.3332 | 64.6 | 67.44 -Neigh | 0.061885 | 0.061916 | 0.061951 | 0.0 | 1.29 -Comm | 0.044281 | 0.065185 | 0.078628 | 5.1 | 1.36 -Output | 0.0003482 | 0.0003787 | 0.00040746 | 0.0 | 0.01 -Modify | 0.028727 | 0.031529 | 0.034914 | 1.3 | 0.66 -Other | | 0.01367 | | | 0.29 +Pair | 0.25749 | 1.1806 | 2.6872 | 89.0 | 27.79 +Bond | 0.00018656 | 0.00020786 | 0.00025377 | 0.0 | 0.00 +Kspace | 1.4259 | 2.9204 | 3.8414 | 56.3 | 68.74 +Neigh | 0.057504 | 0.057852 | 0.05818 | 0.1 | 1.36 +Comm | 0.041952 | 0.053593 | 0.05876 | 3.0 | 1.26 +Output | 0.0004296 | 0.00046809 | 0.00055317 | 0.0 | 0.01 +Modify | 0.026204 | 0.027251 | 0.028382 | 0.6 | 0.64 +Other | | 0.008209 | | | 0.19 Nlocal: 234 ave 302 max 198 min Histogram: 2 0 0 1 0 0 0 0 0 1 From 3282470cf5b56ae62a0ede29aa8c1519b691d4d3 Mon Sep 17 00:00:00 2001 From: oywg11 Date: Sun, 4 Jun 2023 10:19:13 +0800 Subject: [PATCH 166/396] update the citation information --- src/INTERLAYER/pair_aip_water_2dm.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/INTERLAYER/pair_aip_water_2dm.cpp b/src/INTERLAYER/pair_aip_water_2dm.cpp index d88676a6e2..f2d68f448b 100644 --- a/src/INTERLAYER/pair_aip_water_2dm.cpp +++ b/src/INTERLAYER/pair_aip_water_2dm.cpp @@ -41,7 +41,7 @@ using namespace InterLayer; #define PGDELTA 1 static const char cite_aip_water[] = - "ilp/water/2dm potential doi/10.1021/acs.jpcc.2c08464\n" + "aip/water/2dm potential doi/10.1021/acs.jpcc.2c08464\n" "@Article{Feng2023\n" " author = {Z. Feng, Y. Yao, J. Liu, B. Wu, Z. Liu, and W. Ouyang},\n" " title = {Registry-Dependent Potential for Interfaces of Water with Graphene},\n" From a0057d674ff2ef0c7f9e99fb713852f7c1d3ab49 Mon Sep 17 00:00:00 2001 From: Evangelos Voyiatzis Date: Sun, 4 Jun 2023 13:40:31 +0300 Subject: [PATCH 167/396] Update compute_stress_mop_profile.cpp --- src/EXTRA-COMPUTE/compute_stress_mop_profile.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/EXTRA-COMPUTE/compute_stress_mop_profile.cpp b/src/EXTRA-COMPUTE/compute_stress_mop_profile.cpp index d299633731..99f522096c 100644 --- a/src/EXTRA-COMPUTE/compute_stress_mop_profile.cpp +++ b/src/EXTRA-COMPUTE/compute_stress_mop_profile.cpp @@ -207,9 +207,11 @@ void ComputeStressMopProfile::init() if (force->bond!=nullptr) bondflag = 1; if (force->angle!=nullptr) - error->all(FLERR,"compute stress/mop/profile does not account for angle potentials"); + if ((strcmp(force->angle_style, "zero") != 0) && (strcmp(force->angle_style, "none") != 0)) + error->all(FLERR,"compute stress/mop/profile does not account for angle potentials"); if (force->dihedral!=nullptr) - error->all(FLERR,"compute stress/mop/profile does not account for dihedral potentials"); + if ((strcmp(force->dihedral_style, "zero") != 0) && (strcmp(force->dihedral_style, "none") != 0)) + error->all(FLERR,"compute stress/mop/profile does not account for dihedral potentials"); if (force->improper!=nullptr) error->all(FLERR,"compute stress/mop/profile does not account for improper potentials"); if (force->kspace!=nullptr) From d8fad4db1516f2a9a3d5a2ee1e9fda7b6959089c Mon Sep 17 00:00:00 2001 From: Evangelos Voyiatzis Date: Sun, 4 Jun 2023 13:45:00 +0300 Subject: [PATCH 168/396] remove white space from compute_stress_mop.cpp --- src/EXTRA-COMPUTE/compute_stress_mop.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/EXTRA-COMPUTE/compute_stress_mop.cpp b/src/EXTRA-COMPUTE/compute_stress_mop.cpp index 3ae758b875..c9557a7ef3 100644 --- a/src/EXTRA-COMPUTE/compute_stress_mop.cpp +++ b/src/EXTRA-COMPUTE/compute_stress_mop.cpp @@ -83,7 +83,7 @@ ComputeStressMop::ComputeStressMop(LAMMPS *lmp, int narg, char **arg) : if (pos >domain->boxhi[dir] || pos boxlo[dir]) error->all(FLERR, "Plane for compute stress/mop is out of bounds"); } - + if (pos < (domain->boxlo[dir]+domain->prd_half[dir])) { pos1 = pos + domain->prd[dir]; } else { @@ -285,7 +285,7 @@ void ComputeStressMop::compute_vector() // sum angle contribution over all procs MPI_Allreduce(angle_local,angle_global,nvalues,MPI_DOUBLE,MPI_SUM,world); - + for (int m=0; m Date: Sun, 4 Jun 2023 13:45:52 +0300 Subject: [PATCH 169/396] remove whitespace from compute_stress_mop_profile.cpp --- src/EXTRA-COMPUTE/compute_stress_mop_profile.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/EXTRA-COMPUTE/compute_stress_mop_profile.cpp b/src/EXTRA-COMPUTE/compute_stress_mop_profile.cpp index 99f522096c..4f91f8f7fb 100644 --- a/src/EXTRA-COMPUTE/compute_stress_mop_profile.cpp +++ b/src/EXTRA-COMPUTE/compute_stress_mop_profile.cpp @@ -609,7 +609,7 @@ void ComputeStressMopProfile::compute_bonds() } m += 3; } -} +} /* ---------------------------------------------------------------------- setup 1d bins and their extent and coordinates From 3782eeee2b2bca5435ef51f13082e96a1e0151df Mon Sep 17 00:00:00 2001 From: Evangelos Voyiatzis Date: Sun, 4 Jun 2023 13:47:54 +0300 Subject: [PATCH 170/396] remove whitespace from compute_stress_mop.rst --- doc/src/compute_stress_mop.rst | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/doc/src/compute_stress_mop.rst b/doc/src/compute_stress_mop.rst index e1b151ebbd..7ab8c58a76 100644 --- a/doc/src/compute_stress_mop.rst +++ b/doc/src/compute_stress_mop.rst @@ -68,7 +68,7 @@ Between one and six keywords can be used to indicate which contributions to the stress must be computed: total stress (total), kinetic stress (kin), configurational stress (conf), stress due to bond stretching (bond), stress due to angle bending (angle) and/or due to pairwise non-bonded interactions (pair). -The angle keyword is currently available only for the stress/mop command and not the stress/mop/profile. +The angle keyword is currently available only for the stress/mop command and not the stress/mop/profile. NOTE 1: The configurational stress is computed considering all pairs of atoms where at least one atom belongs to group group-ID. @@ -119,12 +119,12 @@ size does not change in time, and axis-aligned planes. The method only works with two-body pair interactions, because it requires the class method pair->single() to be implemented. In -particular, compute *stress/mop/profile* does not work with more than +particular, compute *stress/mop/profile* does not work with more than two-body pair interactions, long range (kspace) interactions and angle/dihedral/improper -intramolecular interactions. Similarly, compute *stress/mop* does not work with more than +intramolecular interactions. Similarly, compute *stress/mop* does not work with more than two-body pair interactions, long range (kspace) interactions and dihedral/improper intramolecular interactions but works with all bond interactions with the class method -single() implemented and all angle interactions with the class method born_matrix() +single() implemented and all angle interactions with the class method born_matrix() implemented. Related commands From c25999d2087c6b79b71ab1d0f6934a7c4598087a Mon Sep 17 00:00:00 2001 From: Evangelos Voyiatzis Date: Sun, 4 Jun 2023 16:08:33 +0300 Subject: [PATCH 171/396] Update compute_stress_mop_profile.cpp --- src/EXTRA-COMPUTE/compute_stress_mop_profile.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/EXTRA-COMPUTE/compute_stress_mop_profile.cpp b/src/EXTRA-COMPUTE/compute_stress_mop_profile.cpp index 4f91f8f7fb..2c2260d22c 100644 --- a/src/EXTRA-COMPUTE/compute_stress_mop_profile.cpp +++ b/src/EXTRA-COMPUTE/compute_stress_mop_profile.cpp @@ -213,7 +213,8 @@ void ComputeStressMopProfile::init() if ((strcmp(force->dihedral_style, "zero") != 0) && (strcmp(force->dihedral_style, "none") != 0)) error->all(FLERR,"compute stress/mop/profile does not account for dihedral potentials"); if (force->improper!=nullptr) - error->all(FLERR,"compute stress/mop/profile does not account for improper potentials"); + if ((strcmp(force->improper_style, "zero") != 0) && (strcmp(force->improper_style, "none") != 0)) + error->all(FLERR,"compute stress/mop/profile does not account for improper potentials"); if (force->kspace!=nullptr) error->all(FLERR,"compute stress/mop/profile does not account for kspace contributions"); } From 0cff31060b5342f69d0b8d382fab423f29677fb4 Mon Sep 17 00:00:00 2001 From: Evangelos Voyiatzis Date: Sun, 4 Jun 2023 16:10:24 +0300 Subject: [PATCH 172/396] Update compute_stress_mop.cpp --- src/EXTRA-COMPUTE/compute_stress_mop.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/EXTRA-COMPUTE/compute_stress_mop.cpp b/src/EXTRA-COMPUTE/compute_stress_mop.cpp index c9557a7ef3..50eb3425f8 100644 --- a/src/EXTRA-COMPUTE/compute_stress_mop.cpp +++ b/src/EXTRA-COMPUTE/compute_stress_mop.cpp @@ -232,9 +232,11 @@ void ComputeStressMop::init() angleflag = 1; } if (force->dihedral!=nullptr) - error->all(FLERR,"compute stress/mop does not account for dihedral potentials"); + if ((strcmp(force->dihedral_style, "zero") != 0) && (strcmp(force->dihedral_style, "none") != 0)) + error->all(FLERR,"compute stress/mop does not account for dihedral potentials"); if (force->improper!=nullptr) - error->all(FLERR,"compute stress/mop does not account for improper potentials"); + if ((strcmp(force->improper_style, "zero") != 0) && (strcmp(force->improper_style, "none") != 0)) + error->all(FLERR,"compute stress/mop does not account for improper potentials"); if (force->kspace!=nullptr) error->all(FLERR,"compute stress/mop does not account for kspace contributions"); } From ead5a28d354297f20ea40b090aa19f87968a9ce6 Mon Sep 17 00:00:00 2001 From: Evangelos Voyiatzis Date: Mon, 5 Jun 2023 18:53:45 +0300 Subject: [PATCH 173/396] Update compute_stress_mop.cpp --- src/EXTRA-COMPUTE/compute_stress_mop.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/EXTRA-COMPUTE/compute_stress_mop.cpp b/src/EXTRA-COMPUTE/compute_stress_mop.cpp index 50eb3425f8..e5d0e2ed13 100644 --- a/src/EXTRA-COMPUTE/compute_stress_mop.cpp +++ b/src/EXTRA-COMPUTE/compute_stress_mop.cpp @@ -227,7 +227,8 @@ void ComputeStressMop::init() if (force->bond!=nullptr) bondflag = 1; if (force->angle!=nullptr) if (force->angle->born_matrix_enable == 0) { - error->all(FLERR,"compute stress/mop does not account for angle potentials"); + if ((strcmp(force->angle_style, "zero") != 0) && (strcmp(force->angle_style, "none") != 0)) + error->all(FLERR,"compute stress/mop does not account for angle potentials"); } else { angleflag = 1; } @@ -238,7 +239,7 @@ void ComputeStressMop::init() if ((strcmp(force->improper_style, "zero") != 0) && (strcmp(force->improper_style, "none") != 0)) error->all(FLERR,"compute stress/mop does not account for improper potentials"); if (force->kspace!=nullptr) - error->all(FLERR,"compute stress/mop does not account for kspace contributions"); + error->warning(FLERR,"compute stress/mop does not account for kspace contributions"); } // need an occasional half neighbor list From 8eed55b56c8330e46fd3715fca962140a0691b52 Mon Sep 17 00:00:00 2001 From: Evangelos Voyiatzis Date: Mon, 5 Jun 2023 18:54:26 +0300 Subject: [PATCH 174/396] Update compute_stress_mop_profile.cpp --- src/EXTRA-COMPUTE/compute_stress_mop_profile.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/EXTRA-COMPUTE/compute_stress_mop_profile.cpp b/src/EXTRA-COMPUTE/compute_stress_mop_profile.cpp index 2c2260d22c..807092b37e 100644 --- a/src/EXTRA-COMPUTE/compute_stress_mop_profile.cpp +++ b/src/EXTRA-COMPUTE/compute_stress_mop_profile.cpp @@ -216,7 +216,7 @@ void ComputeStressMopProfile::init() if ((strcmp(force->improper_style, "zero") != 0) && (strcmp(force->improper_style, "none") != 0)) error->all(FLERR,"compute stress/mop/profile does not account for improper potentials"); if (force->kspace!=nullptr) - error->all(FLERR,"compute stress/mop/profile does not account for kspace contributions"); + error->warning(FLERR,"compute stress/mop/profile does not account for kspace contributions"); } // need an occasional half neighbor list From a12133ce03fabe7d5746ea8a49905ca1f84267b2 Mon Sep 17 00:00:00 2001 From: Stan Gerald Moore Date: Mon, 5 Jun 2023 09:59:38 -0600 Subject: [PATCH 175/396] Update Kokkos library in LAMMPS to v3.7.2 --- lib/kokkos/CHANGELOG.md | 23 +++++- lib/kokkos/CMakeLists.txt | 2 +- lib/kokkos/Makefile.kokkos | 2 +- lib/kokkos/algorithms/src/CMakeLists.txt | 2 +- lib/kokkos/cmake/kokkos_arch.cmake | 3 + lib/kokkos/cmake/kokkos_tribits.cmake | 7 -- .../containers/src/Kokkos_DynamicView.hpp | 4 +- .../containers/unit_tests/TestDynamicView.hpp | 77 +++++++++++++++++++ lib/kokkos/core/perf_test/test_atomic.cpp | 2 +- .../core/src/HIP/Kokkos_HIP_Instance.cpp | 2 + lib/kokkos/core/src/Kokkos_Macros.hpp | 8 +- lib/kokkos/core/src/Kokkos_ScratchSpace.hpp | 56 +++++++++----- lib/kokkos/core/src/Kokkos_Serial.hpp | 8 -- lib/kokkos/core/src/Kokkos_View.hpp | 24 ++++-- lib/kokkos/core/src/Serial/Kokkos_Serial.cpp | 8 +- .../Serial/Kokkos_Serial_Parallel_MDRange.hpp | 19 ++--- lib/kokkos/core/src/impl/Kokkos_Core.cpp | 5 +- .../impl/Kokkos_InitializationSettings.hpp | 4 +- lib/kokkos/core/src/impl/Kokkos_Profiling.cpp | 6 +- .../unit_test/TestDefaultDeviceTypeInit.hpp | 24 +++--- lib/kokkos/core/unit_test/TestSharedAlloc.hpp | 4 +- lib/kokkos/core/unit_test/TestTeam.hpp | 66 +++++++++++++++- .../unit_test/cuda/TestCuda_InterOp_Init.cpp | 4 +- .../cuda/TestCuda_InterOp_Streams.cpp | 4 +- .../unit_test/hip/TestHIP_InterOp_Init.cpp | 4 +- .../unit_test/hip/TestHIP_InterOp_Streams.cpp | 4 +- .../unit_test/sycl/TestSYCL_InterOp_Init.cpp | 2 +- .../sycl/TestSYCL_InterOp_Init_Context.cpp | 1 + .../sycl/TestSYCL_InterOp_Streams.cpp | 8 +- .../include/desul/atomics/Lock_Array_Cuda.hpp | 49 +++++++----- lib/kokkos/tpls/desul/src/Lock_Array_CUDA.cpp | 4 +- 31 files changed, 312 insertions(+), 124 deletions(-) diff --git a/lib/kokkos/CHANGELOG.md b/lib/kokkos/CHANGELOG.md index bdbc75604b..34df76a0fd 100644 --- a/lib/kokkos/CHANGELOG.md +++ b/lib/kokkos/CHANGELOG.md @@ -1,4 +1,25 @@ -# Change Log +# CHANGELOG + +## [3.7.02](https://github.com/kokkos/kokkos/tree/3.7.02) (2023-05-17) +[Full Changelog](https://github.com/kokkos/kokkos/compare/3.7.01...3.7.02) + +### Backends and Archs Enhancements: +#### CUDA +- Add Hopper support and update nvcc_wrapper to work with CUDA-12 [\#5693](https://github.com/kokkos/kokkos/pull/5693) +### General Enhancements: +- sprintf -> snprintf [\#5787](https://github.com/kokkos/kokkos/pull/5787) +### Build System: +- Add error message when not using `hipcc` and when `CMAKE_CXX_STANDARD` is not set [\#5945](https://github.com/kokkos/kokkos/pull/5945) +### Bug Fixes: +- Fix Scratch allocation alignment issues [\#5692](https://github.com/kokkos/kokkos/pull/5692) +- Fix Intel Classic Compiler ICE [\#5710](https://github.com/kokkos/kokkos/pull/5710) +- Don't install std algorithm headers multiple times [\#5711](https://github.com/kokkos/kokkos/pull/5711) +- Fix static init order issue in InitalizationSettings [\#5721](https://github.com/kokkos/kokkos/pull/5721) +- Fix src/dst Properties in deep_copy(DynamicView,View) [\#5732](https://github.com/kokkos/kokkos/pull/5732) +- Fix build on Fedora Rawhide [\#5782](https://github.com/kokkos/kokkos/pull/5782) +- Finalize HIP lock arrays [\#5694](https://github.com/kokkos/kokkos/pull/5694) +- Fix CUDA lock arrays for current Desul [\#5812](https://github.com/kokkos/kokkos/pull/5812) +- Set the correct device/context in InterOp tests [\#5701](https://github.com/kokkos/kokkos/pull/5701) ## [3.7.01](https://github.com/kokkos/kokkos/tree/3.7.01) (2022-12-01) [Full Changelog](https://github.com/kokkos/kokkos/compare/3.7.00...3.7.01) diff --git a/lib/kokkos/CMakeLists.txt b/lib/kokkos/CMakeLists.txt index 7b78f29d73..404aad8065 100644 --- a/lib/kokkos/CMakeLists.txt +++ b/lib/kokkos/CMakeLists.txt @@ -129,7 +129,7 @@ ENDIF() set(Kokkos_VERSION_MAJOR 3) set(Kokkos_VERSION_MINOR 7) -set(Kokkos_VERSION_PATCH 01) +set(Kokkos_VERSION_PATCH 02) set(Kokkos_VERSION "${Kokkos_VERSION_MAJOR}.${Kokkos_VERSION_MINOR}.${Kokkos_VERSION_PATCH}") math(EXPR KOKKOS_VERSION "${Kokkos_VERSION_MAJOR} * 10000 + ${Kokkos_VERSION_MINOR} * 100 + ${Kokkos_VERSION_PATCH}") diff --git a/lib/kokkos/Makefile.kokkos b/lib/kokkos/Makefile.kokkos index b873fd1e06..361995d847 100644 --- a/lib/kokkos/Makefile.kokkos +++ b/lib/kokkos/Makefile.kokkos @@ -12,7 +12,7 @@ endif KOKKOS_VERSION_MAJOR = 3 KOKKOS_VERSION_MINOR = 7 -KOKKOS_VERSION_PATCH = 01 +KOKKOS_VERSION_PATCH = 02 KOKKOS_VERSION = $(shell echo $(KOKKOS_VERSION_MAJOR)*10000+$(KOKKOS_VERSION_MINOR)*100+$(KOKKOS_VERSION_PATCH) | bc) # Options: Cuda,HIP,SYCL,OpenMPTarget,OpenMP,Threads,Serial diff --git a/lib/kokkos/algorithms/src/CMakeLists.txt b/lib/kokkos/algorithms/src/CMakeLists.txt index 597626b111..606d83d18b 100644 --- a/lib/kokkos/algorithms/src/CMakeLists.txt +++ b/lib/kokkos/algorithms/src/CMakeLists.txt @@ -25,7 +25,7 @@ INSTALL ( # These will get ignored for standalone CMake and a true interface library made KOKKOS_ADD_INTERFACE_LIBRARY( kokkosalgorithms - HEADERS ${ALGO_HEADERS} + NOINSTALLHEADERS ${ALGO_HEADERS} SOURCES ${ALGO_SOURCES} ) KOKKOS_LIB_INCLUDE_DIRECTORIES(kokkosalgorithms diff --git a/lib/kokkos/cmake/kokkos_arch.cmake b/lib/kokkos/cmake/kokkos_arch.cmake index f20a91e42f..3aff6857a3 100644 --- a/lib/kokkos/cmake/kokkos_arch.cmake +++ b/lib/kokkos/cmake/kokkos_arch.cmake @@ -214,6 +214,9 @@ GLOBAL_SET(KOKKOS_AMDGPU_OPTIONS) IF(KOKKOS_ENABLE_HIP) SET(AMDGPU_ARCH_FLAG "--offload-arch") IF(NOT KOKKOS_CXX_COMPILER_ID STREQUAL HIPCC) + IF(KOKKOS_CXX_STANDARD STREQUAL 14 AND NOT CMAKE_CXX_STANDARD) + message(FATAL_ERROR "Set CMAKE_CXX_STANDARD to 14") + ENDIF() GLOBAL_APPEND(KOKKOS_AMDGPU_OPTIONS -x hip) IF(DEFINED ENV{ROCM_PATH}) GLOBAL_APPEND(KOKKOS_AMDGPU_OPTIONS --rocm-path=$ENV{ROCM_PATH}) diff --git a/lib/kokkos/cmake/kokkos_tribits.cmake b/lib/kokkos/cmake/kokkos_tribits.cmake index 34e45ecf72..9a55d2a5e9 100644 --- a/lib/kokkos/cmake/kokkos_tribits.cmake +++ b/lib/kokkos/cmake/kokkos_tribits.cmake @@ -534,13 +534,6 @@ FUNCTION(KOKKOS_ADD_INTERFACE_LIBRARY NAME) IF (KOKKOS_HAS_TRILINOS) TRIBITS_ADD_LIBRARY(${NAME} ${ARGN}) ELSE() - CMAKE_PARSE_ARGUMENTS(PARSE - "" - "" - "HEADERS;SOURCES" - ${ARGN} - ) - ADD_LIBRARY(${NAME} INTERFACE) KOKKOS_INTERNAL_ADD_LIBRARY_INSTALL(${NAME}) ENDIF() diff --git a/lib/kokkos/containers/src/Kokkos_DynamicView.hpp b/lib/kokkos/containers/src/Kokkos_DynamicView.hpp index a2b68064de..8450c06077 100644 --- a/lib/kokkos/containers/src/Kokkos_DynamicView.hpp +++ b/lib/kokkos/containers/src/Kokkos_DynamicView.hpp @@ -915,8 +915,8 @@ inline void deep_copy(const View& dst, template inline void deep_copy(const Kokkos::Experimental::DynamicView& dst, const View& src) { - using dst_type = Kokkos::Experimental::DynamicView; - using src_type = View; + using dst_type = Kokkos::Experimental::DynamicView; + using src_type = View; using dst_execution_space = typename ViewTraits::execution_space; using src_memory_space = typename ViewTraits::memory_space; diff --git a/lib/kokkos/containers/unit_tests/TestDynamicView.hpp b/lib/kokkos/containers/unit_tests/TestDynamicView.hpp index 5345f8ea24..303e3643c9 100644 --- a/lib/kokkos/containers/unit_tests/TestDynamicView.hpp +++ b/lib/kokkos/containers/unit_tests/TestDynamicView.hpp @@ -240,6 +240,83 @@ struct TestDynamicView { ASSERT_EQ(new_result_sum, (value_type)(da_resize * (da_resize - 1) / 2)); #endif } // end scope + + // Test: Reproducer to demonstrate compile-time error of deep_copy + // of DynamicView to/from on-host View. + // Case 4: + { + using device_view_type = Kokkos::View; + using host_view_type = typename Kokkos::View::HostMirror; + + view_type device_dynamic_view("on-device DynamicView", 1024, + arg_total_size); + device_view_type device_view("on-device View", arg_total_size); + host_view_type host_view("on-host View", arg_total_size); + + unsigned da_size = arg_total_size / 8; + device_dynamic_view.resize_serial(da_size); + + // Use parallel_for to populate device_dynamic_view and verify values +#if defined(KOKKOS_ENABLE_CXX11_DISPATCH_LAMBDA) + Kokkos::parallel_for( + Kokkos::RangePolicy(0, da_size), + KOKKOS_LAMBDA(const int i) { device_dynamic_view(i) = Scalar(i); }); + + value_type result_sum = 0.0; + Kokkos::parallel_reduce( + Kokkos::RangePolicy(0, da_size), + KOKKOS_LAMBDA(const int i, value_type& partial_sum) { + partial_sum += (value_type)device_dynamic_view(i); + }, + result_sum); + + ASSERT_EQ(result_sum, (value_type)(da_size * (da_size - 1) / 2)); +#endif + + // Use an on-device View as intermediate to deep_copy the + // device_dynamic_view to host, zero out the device_dynamic_view, + // deep_copy from host back to the device_dynamic_view and verify + Kokkos::deep_copy(device_view, device_dynamic_view); + Kokkos::deep_copy(host_view, device_view); + Kokkos::deep_copy(device_view, host_view); +#if defined(KOKKOS_ENABLE_CXX11_DISPATCH_LAMBDA) + Kokkos::parallel_for( + Kokkos::RangePolicy(0, da_size), + KOKKOS_LAMBDA(const int i) { device_dynamic_view(i) = Scalar(0); }); +#endif + Kokkos::deep_copy(device_dynamic_view, device_view); +#if defined(KOKKOS_ENABLE_CXX11_DISPATCH_LAMBDA) + value_type new_result_sum = 0.0; + Kokkos::parallel_reduce( + Kokkos::RangePolicy(0, da_size), + KOKKOS_LAMBDA(const int i, value_type& partial_sum) { + partial_sum += (value_type)device_dynamic_view(i); + }, + new_result_sum); + + ASSERT_EQ(new_result_sum, (value_type)(da_size * (da_size - 1) / 2)); +#endif + + // Try to deep_copy device_dynamic_view directly to/from host. + // host-to-device currently fails to compile because DP and SP are + // swapped in the deep_copy implementation. + // Once that's fixed, both deep_copy's will fail at runtime because the + // destination execution space cannot access the source memory space. + try { + Kokkos::deep_copy(host_view, device_dynamic_view); + } catch (std::runtime_error const& error) { + std::string msg = error.what(); + std::cerr << "Copy from on-device DynamicView to on-host View failed:\n" + << msg << std::endl; + } + try { + Kokkos::deep_copy(device_dynamic_view, host_view); + } catch (std::runtime_error const& error) { + std::string msg = error.what(); + std::cerr << "Copy from on-host View to on-device DynamicView failed:\n" + << msg << std::endl; + } + } } }; diff --git a/lib/kokkos/core/perf_test/test_atomic.cpp b/lib/kokkos/core/perf_test/test_atomic.cpp index 54824e5b39..094c40bfa7 100644 --- a/lib/kokkos/core/perf_test/test_atomic.cpp +++ b/lib/kokkos/core/perf_test/test_atomic.cpp @@ -73,7 +73,7 @@ void textcolor(int attr, int fg, int bg) { char command[40]; /* Command is the control command to the terminal */ - sprintf(command, "%c[%d;%d;%dm", 0x1B, attr, fg + 30, bg + 40); + snprintf(command, 40, "%c[%d;%d;%dm", 0x1B, attr, fg + 30, bg + 40); printf("%s", command); } void textcolor_standard() { textcolor(RESET, BLACK, WHITE); } diff --git a/lib/kokkos/core/src/HIP/Kokkos_HIP_Instance.cpp b/lib/kokkos/core/src/HIP/Kokkos_HIP_Instance.cpp index 3785cfe80b..bdba322fcc 100644 --- a/lib/kokkos/core/src/HIP/Kokkos_HIP_Instance.cpp +++ b/lib/kokkos/core/src/HIP/Kokkos_HIP_Instance.cpp @@ -428,6 +428,8 @@ void HIPInternal::finalize() { if (this == &singleton()) { (void)Kokkos::Impl::hip_global_unique_token_locks(true); + Kokkos::Impl::finalize_host_hip_lock_arrays(); + KOKKOS_IMPL_HIP_SAFE_CALL(hipHostFree(constantMemHostStaging)); KOKKOS_IMPL_HIP_SAFE_CALL(hipEventDestroy(constantMemReusable)); } diff --git a/lib/kokkos/core/src/Kokkos_Macros.hpp b/lib/kokkos/core/src/Kokkos_Macros.hpp index e42944d819..8d2aa4d188 100644 --- a/lib/kokkos/core/src/Kokkos_Macros.hpp +++ b/lib/kokkos/core/src/Kokkos_Macros.hpp @@ -228,11 +228,6 @@ #define KOKKOS_ENABLE_PRAGMA_SIMD 1 #endif -// FIXME Workaround for ICE with intel 17,18,19,20,21 in Trilinos -#if (KOKKOS_COMPILER_INTEL <= 2100) -#define KOKKOS_IMPL_WORKAROUND_ICE_IN_TRILINOS_WITH_OLD_INTEL_COMPILERS -#endif - // FIXME_SYCL #if !defined(KOKKOS_ENABLE_SYCL) #define KOKKOS_ENABLE_PRAGMA_IVDEP 1 @@ -653,7 +648,8 @@ static constexpr bool kokkos_omp_on_host() { return false; } #if (defined(KOKKOS_COMPILER_GNU) || defined(KOKKOS_COMPILER_CLANG) || \ defined(KOKKOS_COMPILER_INTEL) || defined(KOKKOS_COMPILER_PGI)) && \ !defined(_WIN32) -#if (!defined(__linux__) || defined(__GLIBC_MINOR__)) +// disable stacktrace for musl-libc +#if !defined(__linux__) || defined(__GLIBC_MINOR__) #define KOKKOS_IMPL_ENABLE_STACKTRACE #endif #define KOKKOS_IMPL_ENABLE_CXXABI diff --git a/lib/kokkos/core/src/Kokkos_ScratchSpace.hpp b/lib/kokkos/core/src/Kokkos_ScratchSpace.hpp index 3e37eb61dc..a1d77071f5 100644 --- a/lib/kokkos/core/src/Kokkos_ScratchSpace.hpp +++ b/lib/kokkos/core/src/Kokkos_ScratchSpace.hpp @@ -73,9 +73,8 @@ class ScratchMemorySpace { "Instantiating ScratchMemorySpace on non-execution-space type."); public: - // Alignment of memory chunks returned by 'get' - // must be a power of two - enum { ALIGN = 8 }; + // Minimal overalignment used by view scratch allocations + constexpr static int ALIGN = 8; private: mutable char* m_iter_L0 = nullptr; @@ -87,7 +86,9 @@ class ScratchMemorySpace { mutable int m_offset = 0; mutable int m_default_level = 0; - enum { MASK = ALIGN - 1 }; // Alignment used by View::shmem_size +#ifdef KOKKOS_ENABLE_DEPRECATED_CODE_4 + constexpr static int DEFAULT_ALIGNMENT_MASK = ALIGN - 1; +#endif public: //! Tag this class as a memory space @@ -101,39 +102,59 @@ class ScratchMemorySpace { static constexpr const char* name() { return "ScratchMemorySpace"; } +#ifdef KOKKOS_ENABLE_DEPRECATED_CODE_4 + // This function is unused template - KOKKOS_INLINE_FUNCTION static IntType align(const IntType& size) { - return (size + MASK) & ~MASK; + KOKKOS_DEPRECATED KOKKOS_INLINE_FUNCTION static constexpr IntType align( + const IntType& size) { + return (size + DEFAULT_ALIGNMENT_MASK) & ~DEFAULT_ALIGNMENT_MASK; } +#endif template KOKKOS_INLINE_FUNCTION void* get_shmem(const IntType& size, int level = -1) const { - return get_shmem_common(size, 1, level); + return get_shmem_common(size, 1, level); } template KOKKOS_INLINE_FUNCTION void* get_shmem_aligned(const IntType& size, const ptrdiff_t alignment, int level = -1) const { - return get_shmem_common(size, alignment, level); + return get_shmem_common(size, alignment, + level); } private: - template + template KOKKOS_INLINE_FUNCTION void* get_shmem_common(const IntType& size, const ptrdiff_t alignment, int level = -1) const { if (level == -1) level = m_default_level; - auto& m_iter = (level == 0) ? m_iter_L0 : m_iter_L1; - auto& m_end = (level == 0) ? m_end_L0 : m_end_L1; - char* previous = m_iter; - const ptrdiff_t missalign = size_t(m_iter) % alignment; - if (missalign) m_iter += alignment - missalign; + auto& m_iter = (level == 0) ? m_iter_L0 : m_iter_L1; + auto& m_end = (level == 0) ? m_end_L0 : m_end_L1; - void* tmp = m_iter + m_offset * (aligned ? size : align(size)); - if (m_end < (m_iter += (aligned ? size : align(size)) * m_multiplier)) { - m_iter = previous; // put it back like it was + if (alignment_requested) { + const ptrdiff_t missalign = size_t(m_iter) % alignment; + if (missalign) m_iter += alignment - missalign; + } + + // This is each thread's start pointer for its allocation + // Note: for team scratch m_offset is 0, since every + // thread will get back the same shared pointer + void* tmp = m_iter + m_offset * size; + ptrdiff_t increment = size * m_multiplier; + + // increment m_iter first and decrement it again if not + // enough memory was available. In the non-failing path + // this will save instructions. + m_iter += increment; + + if (m_end < m_iter) { + // Request did overflow: reset the base team ptr, and + // return nullptr + m_iter -= increment; + tmp = nullptr; #ifdef KOKKOS_ENABLE_DEBUG // mfh 23 Jun 2015: printf call consumes 25 registers // in a CUDA build, so only print in debug mode. The @@ -143,7 +164,6 @@ class ScratchMemorySpace { "%ld byte(s); remaining capacity is %ld byte(s)\n", long(size), long(m_end - m_iter)); #endif // KOKKOS_ENABLE_DEBUG - tmp = nullptr; } return tmp; } diff --git a/lib/kokkos/core/src/Kokkos_Serial.hpp b/lib/kokkos/core/src/Kokkos_Serial.hpp index ffdd1e9fc8..b0d1d693fc 100644 --- a/lib/kokkos/core/src/Kokkos_Serial.hpp +++ b/lib/kokkos/core/src/Kokkos_Serial.hpp @@ -203,19 +203,11 @@ class Serial { static const char* name(); Impl::SerialInternal* impl_internal_space_instance() const { -#ifdef KOKKOS_IMPL_WORKAROUND_ICE_IN_TRILINOS_WITH_OLD_INTEL_COMPILERS - return m_space_instance; -#else return m_space_instance.get(); -#endif } private: -#ifdef KOKKOS_IMPL_WORKAROUND_ICE_IN_TRILINOS_WITH_OLD_INTEL_COMPILERS - Impl::SerialInternal* m_space_instance; -#else Kokkos::Impl::HostSharedPtr m_space_instance; -#endif //-------------------------------------------------------------------------- }; diff --git a/lib/kokkos/core/src/Kokkos_View.hpp b/lib/kokkos/core/src/Kokkos_View.hpp index f8dcfc869e..795ef91e6a 100644 --- a/lib/kokkos/core/src/Kokkos_View.hpp +++ b/lib/kokkos/core/src/Kokkos_View.hpp @@ -67,6 +67,8 @@ KOKKOS_IMPL_WARNING("Including non-public Kokkos header files is not allowed.") #include +#include + //---------------------------------------------------------------------------- //---------------------------------------------------------------------------- @@ -1692,19 +1694,27 @@ class View : public ViewTraits { arg_N0, arg_N1, arg_N2, arg_N3, arg_N4, arg_N5, arg_N6, arg_N7)); } + private: + // Want to be able to align to minimum scratch alignment or sizeof or alignof + // elements + static constexpr size_t scratch_value_alignment = + ::Kokkos::max(::Kokkos::max(sizeof(typename traits::value_type), + alignof(typename traits::value_type)), + static_cast( + traits::execution_space::scratch_memory_space::ALIGN)); + + public: static KOKKOS_INLINE_FUNCTION size_t shmem_size(typename traits::array_layout const& arg_layout) { - return map_type::memory_span(arg_layout) + - sizeof(typename traits::value_type); + return map_type::memory_span(arg_layout) + scratch_value_alignment; } explicit KOKKOS_INLINE_FUNCTION View( const typename traits::execution_space::scratch_memory_space& arg_space, const typename traits::array_layout& arg_layout) - : View(Impl::ViewCtorProp( - reinterpret_cast(arg_space.get_shmem_aligned( - map_type::memory_span(arg_layout), - sizeof(typename traits::value_type)))), + : View(Impl::ViewCtorProp(reinterpret_cast( + arg_space.get_shmem_aligned(map_type::memory_span(arg_layout), + scratch_value_alignment))), arg_layout) {} explicit KOKKOS_INLINE_FUNCTION View( @@ -1722,7 +1732,7 @@ class View : public ViewTraits { map_type::memory_span(typename traits::array_layout( arg_N0, arg_N1, arg_N2, arg_N3, arg_N4, arg_N5, arg_N6, arg_N7)), - sizeof(typename traits::value_type)))), + scratch_value_alignment))), typename traits::array_layout(arg_N0, arg_N1, arg_N2, arg_N3, arg_N4, arg_N5, arg_N6, arg_N7), check_input_args::yes) { diff --git a/lib/kokkos/core/src/Serial/Kokkos_Serial.cpp b/lib/kokkos/core/src/Serial/Kokkos_Serial.cpp index 9205e82560..25d220e45d 100644 --- a/lib/kokkos/core/src/Serial/Kokkos_Serial.cpp +++ b/lib/kokkos/core/src/Serial/Kokkos_Serial.cpp @@ -173,14 +173,8 @@ void SerialInternal::resize_thread_team_data(size_t pool_reduce_bytes, } // namespace Impl Serial::Serial() -#ifdef KOKKOS_IMPL_WORKAROUND_ICE_IN_TRILINOS_WITH_OLD_INTEL_COMPILERS - : m_space_instance(&Impl::SerialInternal::singleton()) { -} -#else : m_space_instance(&Impl::SerialInternal::singleton(), - [](Impl::SerialInternal*) {}) { -} -#endif + [](Impl::SerialInternal*) {}) {} void Serial::print_configuration(std::ostream& os, bool /*verbose*/) const { os << "Host Serial Execution Space:\n"; diff --git a/lib/kokkos/core/src/Serial/Kokkos_Serial_Parallel_MDRange.hpp b/lib/kokkos/core/src/Serial/Kokkos_Serial_Parallel_MDRange.hpp index d726a86f76..c3e28c59f4 100644 --- a/lib/kokkos/core/src/Serial/Kokkos_Serial_Parallel_MDRange.hpp +++ b/lib/kokkos/core/src/Serial/Kokkos_Serial_Parallel_MDRange.hpp @@ -63,11 +63,10 @@ class ParallelFor, const FunctorType m_functor; const MDRangePolicy m_mdr_policy; - const Policy m_policy; void exec() const { - const typename Policy::member_type e = m_policy.end(); - for (typename Policy::member_type i = m_policy.begin(); i < e; ++i) { + const typename Policy::member_type e = m_mdr_policy.m_num_tiles; + for (typename Policy::member_type i = 0; i < e; ++i) { iterate_type(m_mdr_policy, m_functor)(i); } } @@ -85,9 +84,7 @@ class ParallelFor, } inline ParallelFor(const FunctorType& arg_functor, const MDRangePolicy& arg_policy) - : m_functor(arg_functor), - m_mdr_policy(arg_policy), - m_policy(Policy(0, m_mdr_policy.m_num_tiles).set_chunk_size(1)) {} + : m_functor(arg_functor), m_mdr_policy(arg_policy) {} }; template @@ -120,13 +117,12 @@ class ParallelReduce, ReducerType, const FunctorType m_functor; const MDRangePolicy m_mdr_policy; - const Policy m_policy; const ReducerType m_reducer; const pointer_type m_result_ptr; inline void exec(reference_type update) const { - const typename Policy::member_type e = m_policy.end(); - for (typename Policy::member_type i = m_policy.begin(); i < e; ++i) { + const typename Policy::member_type e = m_mdr_policy.m_num_tiles; + for (typename Policy::member_type i = 0; i < e; ++i) { iterate_type(m_mdr_policy, m_functor, update)(i); } } @@ -148,7 +144,8 @@ class ParallelReduce, ReducerType, const size_t team_shared_size = 0; // Never shrinks const size_t thread_local_size = 0; // Never shrinks - auto* internal_instance = m_policy.space().impl_internal_space_instance(); + auto* internal_instance = + m_mdr_policy.space().impl_internal_space_instance(); // Need to lock resize_thread_team_data std::lock_guard lock( internal_instance->m_thread_team_data_mutex); @@ -181,7 +178,6 @@ class ParallelReduce, ReducerType, void*> = nullptr) : m_functor(arg_functor), m_mdr_policy(arg_policy), - m_policy(Policy(0, m_mdr_policy.m_num_tiles).set_chunk_size(1)), m_reducer(InvalidType()), m_result_ptr(arg_result_view.data()) { static_assert(Kokkos::is_view::value, @@ -197,7 +193,6 @@ class ParallelReduce, ReducerType, MDRangePolicy arg_policy, const ReducerType& reducer) : m_functor(arg_functor), m_mdr_policy(arg_policy), - m_policy(Policy(0, m_mdr_policy.m_num_tiles).set_chunk_size(1)), m_reducer(reducer), m_result_ptr(reducer.view().data()) { /*static_assert( std::is_same< typename ViewType::memory_space diff --git a/lib/kokkos/core/src/impl/Kokkos_Core.cpp b/lib/kokkos/core/src/impl/Kokkos_Core.cpp index a5bd003237..fc89e485fd 100644 --- a/lib/kokkos/core/src/impl/Kokkos_Core.cpp +++ b/lib/kokkos/core/src/impl/Kokkos_Core.cpp @@ -1165,6 +1165,5 @@ void _kokkos_pgi_compiler_bug_workaround() {} #endif } // namespace Kokkos -Kokkos::Impl::InitializationSettingsHelper::storage_type const - Kokkos::Impl::InitializationSettingsHelper::unspecified = - "some string we don't expect user would ever provide"; +constexpr char + Kokkos::Impl::InitializationSettingsHelper::unspecified[]; diff --git a/lib/kokkos/core/src/impl/Kokkos_InitializationSettings.hpp b/lib/kokkos/core/src/impl/Kokkos_InitializationSettings.hpp index ceb35f0247..00b2335fd7 100644 --- a/lib/kokkos/core/src/impl/Kokkos_InitializationSettings.hpp +++ b/lib/kokkos/core/src/impl/Kokkos_InitializationSettings.hpp @@ -104,7 +104,9 @@ struct InitializationSettingsHelper { using value_type = std::string; using storage_type = std::string; - static storage_type const unspecified; + // prefer c-string to avoid static initialization order nightmare + static constexpr char unspecified[] = + "some string we don't expect user would ever provide"; }; } // namespace Impl diff --git a/lib/kokkos/core/src/impl/Kokkos_Profiling.cpp b/lib/kokkos/core/src/impl/Kokkos_Profiling.cpp index 480b1a392b..796552cead 100644 --- a/lib/kokkos/core/src/impl/Kokkos_Profiling.cpp +++ b/lib/kokkos/core/src/impl/Kokkos_Profiling.cpp @@ -655,9 +655,9 @@ void initialize(const std::string& profileLibrary) { char* envProfileLibrary = const_cast(profileLibrary.c_str()); - const auto envProfileCopy = - std::make_unique(strlen(envProfileLibrary) + 1); - sprintf(envProfileCopy.get(), "%s", envProfileLibrary); + const size_t envProfileLen = strlen(envProfileLibrary) + 1; + const auto envProfileCopy = std::make_unique(envProfileLen); + snprintf(envProfileCopy.get(), envProfileLen, "%s", envProfileLibrary); char* profileLibraryName = strtok(envProfileCopy.get(), ";"); diff --git a/lib/kokkos/core/unit_test/TestDefaultDeviceTypeInit.hpp b/lib/kokkos/core/unit_test/TestDefaultDeviceTypeInit.hpp index d915b7e472..55a29f1128 100644 --- a/lib/kokkos/core/unit_test/TestDefaultDeviceTypeInit.hpp +++ b/lib/kokkos/core/unit_test/TestDefaultDeviceTypeInit.hpp @@ -69,9 +69,10 @@ char** init_kokkos_args(bool do_threads, bool do_numa, bool do_device, nargs = (do_threads ? 1 : 0) + (do_numa ? 1 : 0) + (do_device ? 1 : 0) + (do_other ? 4 : 0) + (do_tune ? 1 : 0); - char** args_kokkos = new char*[nargs]; + char** args_kokkos = new char*[nargs]; + const int max_args_size = 45; for (int i = 0; i < nargs; i++) { - args_kokkos[i] = new char[45]; + args_kokkos[i] = new char[max_args_size]; delete_these.insert(args_kokkos[i]); } @@ -112,7 +113,7 @@ char** init_kokkos_args(bool do_threads, bool do_numa, bool do_device, #endif init_args.num_threads = nthreads; - sprintf(args_kokkos[threads_idx], "--threads=%i", nthreads); + snprintf(args_kokkos[threads_idx], max_args_size, "--threads=%i", nthreads); } if (do_numa) { @@ -130,24 +131,27 @@ char** init_kokkos_args(bool do_threads, bool do_numa, bool do_device, #endif init_args.num_numa = numa; - sprintf(args_kokkos[numa_idx], "--numa=%i", numa); + snprintf(args_kokkos[numa_idx], max_args_size, "--numa=%i", numa); } if (do_device) { init_args.device_id = 0; - sprintf(args_kokkos[device_idx], "--device-id=%i", 0); + snprintf(args_kokkos[device_idx], max_args_size, "--device-id=%i", 0); } if (do_other) { - sprintf(args_kokkos[0], "--dummyarg=1"); - sprintf(args_kokkos[threads_idx + (do_threads ? 1 : 0)], "--dummy2arg"); - sprintf(args_kokkos[threads_idx + (do_threads ? 1 : 0) + 1], "dummy3arg"); - sprintf(args_kokkos[device_idx + (do_device ? 1 : 0)], "dummy4arg=1"); + snprintf(args_kokkos[0], max_args_size, "--dummyarg=1"); + snprintf(args_kokkos[threads_idx + (do_threads ? 1 : 0)], max_args_size, + "--dummy2arg"); + snprintf(args_kokkos[threads_idx + (do_threads ? 1 : 0) + 1], max_args_size, + "dummy3arg"); + snprintf(args_kokkos[device_idx + (do_device ? 1 : 0)], max_args_size, + "dummy4arg=1"); } if (do_tune) { init_args.tune_internals = true; - sprintf(args_kokkos[tune_idx], "--kokkos-tune-internals"); + snprintf(args_kokkos[tune_idx], max_args_size, "--kokkos-tune-internals"); } return args_kokkos; diff --git a/lib/kokkos/core/unit_test/TestSharedAlloc.hpp b/lib/kokkos/core/unit_test/TestSharedAlloc.hpp index f66b35dc9f..18f3c9a777 100644 --- a/lib/kokkos/core/unit_test/TestSharedAlloc.hpp +++ b/lib/kokkos/core/unit_test/TestSharedAlloc.hpp @@ -91,7 +91,7 @@ void test_shared_alloc() { // Since always executed on host space, leave [=] Kokkos::parallel_for(range, [=](int i) { char name[64]; - sprintf(name, "test_%.2d", i); + snprintf(name, 64, "test_%.2d", i); r[i] = RecordMemS::allocate(s, name, size * (i + 1)); h[i] = Header::get_header(r[i]->data()); @@ -135,7 +135,7 @@ void test_shared_alloc() { Kokkos::parallel_for(range, [=](size_t i) { char name[64]; - sprintf(name, "test_%.2d", int(i)); + snprintf(name, 64, "test_%.2d", int(i)); RecordFull* rec = RecordFull::allocate(s, name, size * (i + 1)); diff --git a/lib/kokkos/core/unit_test/TestTeam.hpp b/lib/kokkos/core/unit_test/TestTeam.hpp index 3f05b2ef66..58db4360e5 100644 --- a/lib/kokkos/core/unit_test/TestTeam.hpp +++ b/lib/kokkos/core/unit_test/TestTeam.hpp @@ -1551,14 +1551,16 @@ struct TestScratchAlignment { double x, y, z; }; TestScratchAlignment() { - test(true); - test(false); + test_view(true); + test_view(false); + test_minimal(); + test_raw(); } using ScratchView = Kokkos::View; using ScratchViewInt = Kokkos::View; - void test(bool allocate_small) { + void test_view(bool allocate_small) { int shmem_size = ScratchView::shmem_size(11); #ifdef KOKKOS_ENABLE_OPENMPTARGET int team_size = @@ -1580,12 +1582,68 @@ struct TestScratchAlignment { }); Kokkos::fence(); } + + void test_minimal() { + using member_type = typename Kokkos::TeamPolicy::member_type; + Kokkos::TeamPolicy policy(1, 1); + size_t scratch_size = sizeof(int); + Kokkos::View flag("Flag"); + + Kokkos::parallel_for( + policy.set_scratch_size(0, Kokkos::PerTeam(scratch_size)), + KOKKOS_LAMBDA(const member_type &team) { + int *scratch_ptr = (int *)team.team_shmem().get_shmem(scratch_size); + if (scratch_ptr == nullptr) flag() = 1; + }); + Kokkos::fence(); + int minimal_scratch_allocation_failed = 0; + Kokkos::deep_copy(minimal_scratch_allocation_failed, flag); + ASSERT_TRUE(minimal_scratch_allocation_failed == 0); + } + + void test_raw() { + using member_type = typename Kokkos::TeamPolicy::member_type; + Kokkos::TeamPolicy policy(1, 1); + Kokkos::View flag("Flag"); + + Kokkos::parallel_for( + policy.set_scratch_size(0, Kokkos::PerTeam(1024)), + KOKKOS_LAMBDA(const member_type &team) { + int *scratch_ptr1 = (int *)team.team_shmem().get_shmem(24); + int *scratch_ptr2 = (int *)team.team_shmem().get_shmem(32); + int *scratch_ptr3 = (int *)team.team_shmem().get_shmem(12); + + if ((int(scratch_ptr2 - scratch_ptr1) != 6) || + (int(scratch_ptr3 - scratch_ptr2) != 8)) + flag() = 1; + + if (((scratch_ptr3 - static_cast(nullptr)) + 3) % 2 == 1) + scratch_ptr1 = (int *)team.team_shmem().get_shmem_aligned(24, 4); + else { + scratch_ptr1 = (int *)team.team_shmem().get_shmem_aligned(12, 4); + } + scratch_ptr2 = (int *)team.team_shmem().get_shmem_aligned(32, 8); + scratch_ptr3 = (int *)team.team_shmem().get_shmem_aligned(8, 4); + + if ((int(scratch_ptr2 - scratch_ptr1) != 7) && + (int(scratch_ptr2 - scratch_ptr1) != 4)) + flag() = 1; + if (int(scratch_ptr3 - scratch_ptr2) != 8) flag() = 1; + if ((int(size_t(scratch_ptr1) % 4) != 0) || + (int(size_t(scratch_ptr2) % 8) != 0) || + (int(size_t(scratch_ptr3) % 4) != 0)) + flag() = 1; + }); + Kokkos::fence(); + int raw_get_shmem_alignment_failed = 0; + Kokkos::deep_copy(raw_get_shmem_alignment_failed, flag); + ASSERT_TRUE(raw_get_shmem_alignment_failed == 0); + } }; } // namespace namespace { - template struct TestTeamPolicyHandleByValue { using scalar = double; diff --git a/lib/kokkos/core/unit_test/cuda/TestCuda_InterOp_Init.cpp b/lib/kokkos/core/unit_test/cuda/TestCuda_InterOp_Init.cpp index 31fd63f084..c4381b29e7 100644 --- a/lib/kokkos/core/unit_test/cuda/TestCuda_InterOp_Init.cpp +++ b/lib/kokkos/core/unit_test/cuda/TestCuda_InterOp_Init.cpp @@ -59,9 +59,11 @@ __global__ void offset(int* p) { // Test whether allocations survive Kokkos initialize/finalize if done via Raw // Cuda. TEST(cuda, raw_cuda_interop) { + // Make sure that we use the same device for all allocations + Kokkos::initialize(); + int* p; KOKKOS_IMPL_CUDA_SAFE_CALL(cudaMalloc(&p, sizeof(int) * 100)); - Kokkos::initialize(); Kokkos::View> v(p, 100); Kokkos::deep_copy(v, 5); diff --git a/lib/kokkos/core/unit_test/cuda/TestCuda_InterOp_Streams.cpp b/lib/kokkos/core/unit_test/cuda/TestCuda_InterOp_Streams.cpp index f11f657e00..69aef6f8d8 100644 --- a/lib/kokkos/core/unit_test/cuda/TestCuda_InterOp_Streams.cpp +++ b/lib/kokkos/core/unit_test/cuda/TestCuda_InterOp_Streams.cpp @@ -48,9 +48,11 @@ namespace Test { // Test Interoperability with Cuda Streams TEST(cuda, raw_cuda_streams) { + // Make sure that we use the same device for all allocations + Kokkos::initialize(); + cudaStream_t stream; cudaStreamCreate(&stream); - Kokkos::initialize(); int* p; cudaMalloc(&p, sizeof(int) * 100); using MemorySpace = typename TEST_EXECSPACE::memory_space; diff --git a/lib/kokkos/core/unit_test/hip/TestHIP_InterOp_Init.cpp b/lib/kokkos/core/unit_test/hip/TestHIP_InterOp_Init.cpp index af20e753d4..ce76076f9b 100644 --- a/lib/kokkos/core/unit_test/hip/TestHIP_InterOp_Init.cpp +++ b/lib/kokkos/core/unit_test/hip/TestHIP_InterOp_Init.cpp @@ -59,9 +59,11 @@ __global__ void offset(int* p) { // Test whether allocations survive Kokkos initialize/finalize if done via Raw // HIP. TEST(hip, raw_hip_interop) { + // Make sure that we use the same device for all allocations + Kokkos::initialize(); + int* p; KOKKOS_IMPL_HIP_SAFE_CALL(hipMalloc(&p, sizeof(int) * 100)); - Kokkos::initialize(); Kokkos::View> v(p, 100); Kokkos::deep_copy(v, 5); diff --git a/lib/kokkos/core/unit_test/hip/TestHIP_InterOp_Streams.cpp b/lib/kokkos/core/unit_test/hip/TestHIP_InterOp_Streams.cpp index 95d102d4d1..6c7fdd7044 100644 --- a/lib/kokkos/core/unit_test/hip/TestHIP_InterOp_Streams.cpp +++ b/lib/kokkos/core/unit_test/hip/TestHIP_InterOp_Streams.cpp @@ -50,9 +50,11 @@ namespace Test { // The difference with the CUDA tests are: raw HIP vs raw CUDA and no launch // bound in HIP due to an error when computing the block size. TEST(hip, raw_hip_streams) { + // Make sure that we use the same device for all allocations + Kokkos::initialize(); + hipStream_t stream; KOKKOS_IMPL_HIP_SAFE_CALL(hipStreamCreate(&stream)); - Kokkos::initialize(); int* p; KOKKOS_IMPL_HIP_SAFE_CALL(hipMalloc(&p, sizeof(int) * 100)); using MemorySpace = typename TEST_EXECSPACE::memory_space; diff --git a/lib/kokkos/core/unit_test/sycl/TestSYCL_InterOp_Init.cpp b/lib/kokkos/core/unit_test/sycl/TestSYCL_InterOp_Init.cpp index e45d990745..1189aba26f 100644 --- a/lib/kokkos/core/unit_test/sycl/TestSYCL_InterOp_Init.cpp +++ b/lib/kokkos/core/unit_test/sycl/TestSYCL_InterOp_Init.cpp @@ -52,8 +52,8 @@ namespace Test { // Test whether allocations survive Kokkos initialize/finalize if done via Raw // SYCL. TEST(sycl, raw_sycl_interop) { + // Make sure all queues use the same context Kokkos::initialize(); - Kokkos::Experimental::SYCL default_space; sycl::context default_context = default_space.sycl_queue().get_context(); diff --git a/lib/kokkos/core/unit_test/sycl/TestSYCL_InterOp_Init_Context.cpp b/lib/kokkos/core/unit_test/sycl/TestSYCL_InterOp_Init_Context.cpp index 114d2a4aa2..7b9a664304 100644 --- a/lib/kokkos/core/unit_test/sycl/TestSYCL_InterOp_Init_Context.cpp +++ b/lib/kokkos/core/unit_test/sycl/TestSYCL_InterOp_Init_Context.cpp @@ -51,6 +51,7 @@ namespace Test { // Test whether external allocations can be accessed by the default queue. TEST(sycl, raw_sycl_interop_context_1) { + // Make sure all queues use the same context Kokkos::Experimental::SYCL default_space; sycl::context default_context = default_space.sycl_queue().get_context(); diff --git a/lib/kokkos/core/unit_test/sycl/TestSYCL_InterOp_Streams.cpp b/lib/kokkos/core/unit_test/sycl/TestSYCL_InterOp_Streams.cpp index 8ffada1dab..be093d8edc 100644 --- a/lib/kokkos/core/unit_test/sycl/TestSYCL_InterOp_Streams.cpp +++ b/lib/kokkos/core/unit_test/sycl/TestSYCL_InterOp_Streams.cpp @@ -48,9 +48,13 @@ namespace Test { // Test Interoperability with SYCL Streams TEST(sycl, raw_sycl_queues) { - sycl::default_selector device_selector; - sycl::queue queue(device_selector); + // Make sure all queues use the same context Kokkos::initialize(); + Kokkos::Experimental::SYCL default_space; + sycl::context default_context = default_space.sycl_queue().get_context(); + + sycl::default_selector device_selector; + sycl::queue queue(default_context, device_selector); int* p = sycl::malloc_device(100, queue); using MemorySpace = typename TEST_EXECSPACE::memory_space; diff --git a/lib/kokkos/tpls/desul/include/desul/atomics/Lock_Array_Cuda.hpp b/lib/kokkos/tpls/desul/include/desul/atomics/Lock_Array_Cuda.hpp index 1815adb4a7..b55be52264 100644 --- a/lib/kokkos/tpls/desul/include/desul/atomics/Lock_Array_Cuda.hpp +++ b/lib/kokkos/tpls/desul/include/desul/atomics/Lock_Array_Cuda.hpp @@ -76,7 +76,7 @@ namespace Impl { /// instances in other translation units, we must update this CUDA global /// variable based on the Host global variable prior to running any kernels /// that will use it. -/// That is the purpose of the KOKKOS_ENSURE_CUDA_LOCK_ARRAYS_ON_DEVICE macro. +/// That is the purpose of the ensure_cuda_lock_arrays_on_device function. __device__ #ifdef __CUDACC_RDC__ __constant__ extern @@ -138,33 +138,42 @@ namespace { static int lock_array_copied = 0; inline int eliminate_warning_for_lock_array() { return lock_array_copied; } } // namespace + +#ifdef __CUDACC_RDC__ +inline +#else +inline static +#endif + void + copy_cuda_lock_arrays_to_device() { + if (lock_array_copied == 0) { + cudaMemcpyToSymbol(CUDA_SPACE_ATOMIC_LOCKS_DEVICE, + &CUDA_SPACE_ATOMIC_LOCKS_DEVICE_h, + sizeof(int32_t*)); + cudaMemcpyToSymbol(CUDA_SPACE_ATOMIC_LOCKS_NODE, + &CUDA_SPACE_ATOMIC_LOCKS_NODE_h, + sizeof(int32_t*)); + } + lock_array_copied = 1; +} + } // namespace Impl } // namespace desul -/* It is critical that this code be a macro, so that it will - capture the right address for desul::Impl::CUDA_SPACE_ATOMIC_LOCKS_DEVICE - putting this in an inline function will NOT do the right thing! */ -#define DESUL_IMPL_COPY_CUDA_LOCK_ARRAYS_TO_DEVICE() \ - { \ - if (::desul::Impl::lock_array_copied == 0) { \ - cudaMemcpyToSymbol(::desul::Impl::CUDA_SPACE_ATOMIC_LOCKS_DEVICE, \ - &::desul::Impl::CUDA_SPACE_ATOMIC_LOCKS_DEVICE_h, \ - sizeof(int32_t*)); \ - cudaMemcpyToSymbol(::desul::Impl::CUDA_SPACE_ATOMIC_LOCKS_NODE, \ - &::desul::Impl::CUDA_SPACE_ATOMIC_LOCKS_NODE_h, \ - sizeof(int32_t*)); \ - } \ - ::desul::Impl::lock_array_copied = 1; \ - } #endif /* defined( __CUDACC__ ) */ #endif /* defined( DESUL_HAVE_CUDA_ATOMICS ) */ +namespace desul { + #if defined(__CUDACC_RDC__) || (!defined(__CUDACC__)) -#define DESUL_ENSURE_CUDA_LOCK_ARRAYS_ON_DEVICE() +inline void ensure_cuda_lock_arrays_on_device() {} #else -#define DESUL_ENSURE_CUDA_LOCK_ARRAYS_ON_DEVICE() \ - DESUL_IMPL_COPY_CUDA_LOCK_ARRAYS_TO_DEVICE() +static inline void ensure_cuda_lock_arrays_on_device() { + Impl::copy_cuda_lock_arrays_to_device(); +} #endif -#endif /* #ifndef KOKKOS_CUDA_LOCKS_HPP_ */ +} // namespace desul + +#endif /* #ifndef DESUL_ATOMICS_LOCK_ARRAY_CUDA_HPP_ */ diff --git a/lib/kokkos/tpls/desul/src/Lock_Array_CUDA.cpp b/lib/kokkos/tpls/desul/src/Lock_Array_CUDA.cpp index cb8482c5da..19944b378e 100644 --- a/lib/kokkos/tpls/desul/src/Lock_Array_CUDA.cpp +++ b/lib/kokkos/tpls/desul/src/Lock_Array_CUDA.cpp @@ -70,7 +70,7 @@ void init_lock_arrays_cuda() { "init_lock_arrays_cuda: cudaMalloc host locks"); auto error_sync1 = cudaDeviceSynchronize(); - DESUL_IMPL_COPY_CUDA_LOCK_ARRAYS_TO_DEVICE(); + copy_cuda_lock_arrays_to_device(); check_error_and_throw_cuda(error_sync1, "init_lock_arrays_cuda: post mallocs"); init_lock_arrays_cuda_kernel<<<(CUDA_SPACE_ATOMIC_MASK + 1 + 255) / 256, 256>>>(); auto error_sync2 = cudaDeviceSynchronize(); @@ -85,7 +85,7 @@ void finalize_lock_arrays_cuda() { CUDA_SPACE_ATOMIC_LOCKS_DEVICE_h = nullptr; CUDA_SPACE_ATOMIC_LOCKS_NODE_h = nullptr; #ifdef __CUDACC_RDC__ - DESUL_IMPL_COPY_CUDA_LOCK_ARRAYS_TO_DEVICE(); + copy_cuda_lock_arrays_to_device(); #endif } From 2e09ba2702639ca5c5ac311e624249ac1f682d42 Mon Sep 17 00:00:00 2001 From: Stan Gerald Moore Date: Mon, 5 Jun 2023 10:08:20 -0600 Subject: [PATCH 176/396] Update CMake --- cmake/Modules/Packages/KOKKOS.cmake | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/cmake/Modules/Packages/KOKKOS.cmake b/cmake/Modules/Packages/KOKKOS.cmake index aa93e0cd7c..8b695667ae 100644 --- a/cmake/Modules/Packages/KOKKOS.cmake +++ b/cmake/Modules/Packages/KOKKOS.cmake @@ -49,8 +49,8 @@ if(DOWNLOAD_KOKKOS) list(APPEND KOKKOS_LIB_BUILD_ARGS "-DCMAKE_CXX_EXTENSIONS=${CMAKE_CXX_EXTENSIONS}") list(APPEND KOKKOS_LIB_BUILD_ARGS "-DCMAKE_TOOLCHAIN_FILE=${CMAKE_TOOLCHAIN_FILE}") include(ExternalProject) - set(KOKKOS_URL "https://github.com/kokkos/kokkos/archive/3.7.01.tar.gz" CACHE STRING "URL for KOKKOS tarball") - set(KOKKOS_MD5 "f140e02b826223b1045207d9bc10d404" CACHE STRING "MD5 checksum of KOKKOS tarball") + set(KOKKOS_URL "https://github.com/kokkos/kokkos/archive/3.7.02.tar.gz" CACHE STRING "URL for KOKKOS tarball") + set(KOKKOS_MD5 "34d7860d548c06a4040236d959c9f99a" CACHE STRING "MD5 checksum of KOKKOS tarball") mark_as_advanced(KOKKOS_URL) mark_as_advanced(KOKKOS_MD5) GetFallbackURL(KOKKOS_URL KOKKOS_FALLBACK) @@ -75,7 +75,7 @@ if(DOWNLOAD_KOKKOS) add_dependencies(LAMMPS::KOKKOSCORE kokkos_build) add_dependencies(LAMMPS::KOKKOSCONTAINERS kokkos_build) elseif(EXTERNAL_KOKKOS) - find_package(Kokkos 3.7.01 REQUIRED CONFIG) + find_package(Kokkos 3.7.02 REQUIRED CONFIG) target_link_libraries(lammps PRIVATE Kokkos::kokkos) else() set(LAMMPS_LIB_KOKKOS_SRC_DIR ${LAMMPS_LIB_SOURCE_DIR}/kokkos) From 966efd8bd53cf170e90a809af696077f6b8b3351 Mon Sep 17 00:00:00 2001 From: Stan Gerald Moore Date: Mon, 5 Jun 2023 10:33:30 -0600 Subject: [PATCH 177/396] Add missed changes --- .../src/Cuda/Kokkos_Cuda_KernelLaunch.hpp | 2 +- .../core/src/Cuda/Kokkos_Cuda_Locks.cpp | 7 +-- .../core/src/Cuda/Kokkos_Cuda_Locks.hpp | 58 ++++++++++--------- 3 files changed, 34 insertions(+), 33 deletions(-) diff --git a/lib/kokkos/core/src/Cuda/Kokkos_Cuda_KernelLaunch.hpp b/lib/kokkos/core/src/Cuda/Kokkos_Cuda_KernelLaunch.hpp index ba43e362bb..a91d0eb313 100644 --- a/lib/kokkos/core/src/Cuda/Kokkos_Cuda_KernelLaunch.hpp +++ b/lib/kokkos/core/src/Cuda/Kokkos_Cuda_KernelLaunch.hpp @@ -710,7 +710,7 @@ struct CudaParallelLaunchImpl< " occupancy requests are currently broken.")); } - KOKKOS_ENSURE_CUDA_LOCK_ARRAYS_ON_DEVICE(); + ensure_cuda_lock_arrays_on_device(); // Invoke the driver function on the device base_t::invoke_kernel(driver, grid, block, shmem, cuda_instance); diff --git a/lib/kokkos/core/src/Cuda/Kokkos_Cuda_Locks.cpp b/lib/kokkos/core/src/Cuda/Kokkos_Cuda_Locks.cpp index 84d4307cfd..3796534816 100644 --- a/lib/kokkos/core/src/Cuda/Kokkos_Cuda_Locks.cpp +++ b/lib/kokkos/core/src/Cuda/Kokkos_Cuda_Locks.cpp @@ -79,8 +79,7 @@ CudaLockArrays g_host_cuda_lock_arrays = {nullptr, 0}; void initialize_host_cuda_lock_arrays() { #ifdef KOKKOS_ENABLE_IMPL_DESUL_ATOMICS desul::Impl::init_lock_arrays(); - - DESUL_ENSURE_CUDA_LOCK_ARRAYS_ON_DEVICE(); + desul::ensure_cuda_lock_arrays_on_device(); #endif if (g_host_cuda_lock_arrays.atomic != nullptr) return; KOKKOS_IMPL_CUDA_SAFE_CALL( @@ -89,7 +88,7 @@ void initialize_host_cuda_lock_arrays() { Impl::cuda_device_synchronize( "Kokkos::Impl::initialize_host_cuda_lock_arrays: Pre Init Lock Arrays"); g_host_cuda_lock_arrays.n = Cuda::concurrency(); - KOKKOS_COPY_CUDA_LOCK_ARRAYS_TO_DEVICE(); + copy_cuda_lock_arrays_to_device(); init_lock_array_kernel_atomic<<<(CUDA_SPACE_ATOMIC_MASK + 1 + 255) / 256, 256>>>(); Impl::cuda_device_synchronize( @@ -106,7 +105,7 @@ void finalize_host_cuda_lock_arrays() { g_host_cuda_lock_arrays.atomic = nullptr; g_host_cuda_lock_arrays.n = 0; #ifdef KOKKOS_ENABLE_CUDA_RELOCATABLE_DEVICE_CODE - KOKKOS_COPY_CUDA_LOCK_ARRAYS_TO_DEVICE(); + copy_cuda_lock_arrays_to_device(); #endif } diff --git a/lib/kokkos/core/src/Cuda/Kokkos_Cuda_Locks.hpp b/lib/kokkos/core/src/Cuda/Kokkos_Cuda_Locks.hpp index bdb7723985..84bfc953fd 100644 --- a/lib/kokkos/core/src/Cuda/Kokkos_Cuda_Locks.hpp +++ b/lib/kokkos/core/src/Cuda/Kokkos_Cuda_Locks.hpp @@ -67,7 +67,7 @@ struct CudaLockArrays { /// \brief This global variable in Host space is the central definition /// of these arrays. -extern Kokkos::Impl::CudaLockArrays g_host_cuda_lock_arrays; +extern CudaLockArrays g_host_cuda_lock_arrays; /// \brief After this call, the g_host_cuda_lock_arrays variable has /// valid, initialized arrays. @@ -105,12 +105,12 @@ namespace Impl { /// instances in other translation units, we must update this CUDA global /// variable based on the Host global variable prior to running any kernels /// that will use it. -/// That is the purpose of the KOKKOS_ENSURE_CUDA_LOCK_ARRAYS_ON_DEVICE macro. +/// That is the purpose of the ensure_cuda_lock_arrays_on_device function. __device__ #ifdef KOKKOS_ENABLE_CUDA_RELOCATABLE_DEVICE_CODE __constant__ extern #endif - Kokkos::Impl::CudaLockArrays g_device_cuda_lock_arrays; + CudaLockArrays g_device_cuda_lock_arrays; #define CUDA_SPACE_ATOMIC_MASK 0x1FFFF @@ -123,9 +123,7 @@ __device__ inline bool lock_address_cuda_space(void* ptr) { size_t offset = size_t(ptr); offset = offset >> 2; offset = offset & CUDA_SPACE_ATOMIC_MASK; - return ( - 0 == - atomicCAS(&Kokkos::Impl::g_device_cuda_lock_arrays.atomic[offset], 0, 1)); + return (0 == atomicCAS(&g_device_cuda_lock_arrays.atomic[offset], 0, 1)); } /// \brief Release lock for the address @@ -138,7 +136,7 @@ __device__ inline void unlock_address_cuda_space(void* ptr) { size_t offset = size_t(ptr); offset = offset >> 2; offset = offset & CUDA_SPACE_ATOMIC_MASK; - atomicExch(&Kokkos::Impl::g_device_cuda_lock_arrays.atomic[offset], 0); + atomicExch(&g_device_cuda_lock_arrays.atomic[offset], 0); } } // namespace Impl @@ -151,45 +149,49 @@ namespace { static int lock_array_copied = 0; inline int eliminate_warning_for_lock_array() { return lock_array_copied; } } // namespace -} // namespace Impl -} // namespace Kokkos -/* Dan Ibanez: it is critical that this code be a macro, so that it will - capture the right address for Kokkos::Impl::g_device_cuda_lock_arrays! - putting this in an inline function will NOT do the right thing! */ -#define KOKKOS_COPY_CUDA_LOCK_ARRAYS_TO_DEVICE() \ - { \ - if (::Kokkos::Impl::lock_array_copied == 0) { \ - KOKKOS_IMPL_CUDA_SAFE_CALL( \ - cudaMemcpyToSymbol(Kokkos::Impl::g_device_cuda_lock_arrays, \ - &Kokkos::Impl::g_host_cuda_lock_arrays, \ - sizeof(Kokkos::Impl::CudaLockArrays))); \ - } \ - lock_array_copied = 1; \ +#ifdef KOKKOS_ENABLE_CUDA_RELOCATABLE_DEVICE_CODE +inline +#else +inline static +#endif + void + copy_cuda_lock_arrays_to_device() { + if (lock_array_copied == 0) { + KOKKOS_IMPL_CUDA_SAFE_CALL(cudaMemcpyToSymbol(g_device_cuda_lock_arrays, + &g_host_cuda_lock_arrays, + sizeof(CudaLockArrays))); } + lock_array_copied = 1; +} #ifndef KOKKOS_ENABLE_IMPL_DESUL_ATOMICS #ifdef KOKKOS_ENABLE_CUDA_RELOCATABLE_DEVICE_CODE -#define KOKKOS_ENSURE_CUDA_LOCK_ARRAYS_ON_DEVICE() +inline void ensure_cuda_lock_arrays_on_device() {} #else -#define KOKKOS_ENSURE_CUDA_LOCK_ARRAYS_ON_DEVICE() \ - KOKKOS_COPY_CUDA_LOCK_ARRAYS_TO_DEVICE() +inline static void ensure_cuda_lock_arrays_on_device() { + copy_cuda_lock_arrays_to_device(); +} #endif #else #ifdef KOKKOS_ENABLE_CUDA_RELOCATABLE_DEVICE_CODE -#define KOKKOS_ENSURE_CUDA_LOCK_ARRAYS_ON_DEVICE() +inline void ensure_cuda_lock_arrays_on_device() {} #else // Still Need COPY_CUDA_LOCK_ARRAYS for team scratch etc. -#define KOKKOS_ENSURE_CUDA_LOCK_ARRAYS_ON_DEVICE() \ - KOKKOS_COPY_CUDA_LOCK_ARRAYS_TO_DEVICE() \ - DESUL_ENSURE_CUDA_LOCK_ARRAYS_ON_DEVICE() +inline static void ensure_cuda_lock_arrays_on_device() { + copy_cuda_lock_arrays_to_device(); + desul::ensure_cuda_lock_arrays_on_device(); +} #endif #endif /* defined( KOKKOS_ENABLE_IMPL_DESUL_ATOMICS ) */ +} // namespace Impl +} // namespace Kokkos + #endif /* defined( KOKKOS_ENABLE_CUDA ) */ #endif /* #ifndef KOKKOS_CUDA_LOCKS_HPP */ From c558de3ce003e2f77744d82f30d3f967df7be81d Mon Sep 17 00:00:00 2001 From: oywg11 Date: Tue, 6 Jun 2023 08:27:14 +0800 Subject: [PATCH 178/396] remove the fprintf debug outputs --- src/INTERLAYER/pair_ilp_tmd.cpp | 14 -------------- 1 file changed, 14 deletions(-) diff --git a/src/INTERLAYER/pair_ilp_tmd.cpp b/src/INTERLAYER/pair_ilp_tmd.cpp index c1af7098cd..f0d618687a 100644 --- a/src/INTERLAYER/pair_ilp_tmd.cpp +++ b/src/INTERLAYER/pair_ilp_tmd.cpp @@ -336,9 +336,6 @@ void PairILPTMD::ILP_neigh() } } // end of idenfying the first neighbor } else if (n > Nnei) { - fprintf(screen, "Molecule ID = %d\n", imol); - fprintf(screen, "Atom Type = %d\n", type[i]); - fprintf(screen, "Neinum = %d\n", n); error->one(FLERR, "There are too many neighbors for TMD atoms, please check your configuration"); } @@ -497,9 +494,6 @@ void PairILPTMD::calc_normal() vect[0][1] = x[jH2][1] - ytp; vect[0][2] = x[jH2][2] - ztp; } else { - fprintf(screen, "jH1 jH2 = %d %d\n", jH1,jH2); - fprintf(screen, "Atom Type = %d %d\n", type[jH1],type[jH2]); - fprintf(screen, "For atom i = %d %d\n", tag[i],type[i]); error->one(FLERR, "The order of atoms in water molecule should be O H H !"); } } @@ -662,9 +656,6 @@ void PairILPTMD::calc_normal() cont = 2; } else { - fprintf(screen, "jH1 jH2 = %d %d\n", jH1,jH2); - fprintf(screen, "Atom Type = %d %d\n", type[jH1],type[jH2]); - fprintf(screen, "ID and type of atom i = %d %d\n", tag[i],type[i]); error->one(FLERR, "The order of atoms in water molecule should be O H H !"); } } @@ -728,11 +719,6 @@ void PairILPTMD::calc_normal() dnormdri[i][id][ip] = dpvdri[id][ip] / nn - Nave[id] * dni[ip] / nn2; } } - // printf("%4d:\t%e %e %e\n\t%e %e %e\n\t%e %e %e\n", - // i, dnormdri[i][0][0], dnormdri[i][0][1], dnormdri[i][0][2], - // dnormdri[i][1][0],dnormdri[i][1][1],dnormdri[i][1][2], - // dnormdri[i][2][0],dnormdri[i][2][1],dnormdri[i][2][2]); - // exit(0); } else if (cont >= 3) { error->one(FLERR, From 409bced5fd74e2c9b75a1e153ee126a5507605ca Mon Sep 17 00:00:00 2001 From: oywg11 Date: Tue, 6 Jun 2023 08:35:42 +0800 Subject: [PATCH 179/396] update affiliations --- src/INTERLAYER/pair_coul_shield.cpp | 2 +- src/INTERLAYER/pair_ilp_graphene_hbn.cpp | 4 ++-- src/INTERLAYER/pair_kolmogorov_crespi_full.cpp | 2 +- src/MANYBODY/pair_tersoff.cpp | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/INTERLAYER/pair_coul_shield.cpp b/src/INTERLAYER/pair_coul_shield.cpp index e647e1ea91..a5e3e63442 100644 --- a/src/INTERLAYER/pair_coul_shield.cpp +++ b/src/INTERLAYER/pair_coul_shield.cpp @@ -11,7 +11,7 @@ See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- - Contributing author: Wengen Ouyang (Tel Aviv University) + Contributing author: Wengen Ouyang (Wuhan University) e-mail: w.g.ouyang at gmail dot com This is a Coulomb potential described in diff --git a/src/INTERLAYER/pair_ilp_graphene_hbn.cpp b/src/INTERLAYER/pair_ilp_graphene_hbn.cpp index e6711d0f19..eb37b39864 100644 --- a/src/INTERLAYER/pair_ilp_graphene_hbn.cpp +++ b/src/INTERLAYER/pair_ilp_graphene_hbn.cpp @@ -11,11 +11,11 @@ ------------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- - Contributing author: Wengen Ouyang (Tel Aviv University) + Contributing author: Wengen Ouyang (Wuhan University) e-mail: w.g.ouyang at gmail dot com This is a full version of the potential described in - [Maaravi et al, J. Phys. Chem. C 121, 22826-22835 (2017)] + [Ouyang et al., J. Chem. Theory Comput. 16(1), 666-676 (2020)] The definition of normals are the same as that in [Kolmogorov & Crespi, Phys. Rev. B 71, 235415 (2005)] ------------------------------------------------------------------------- */ diff --git a/src/INTERLAYER/pair_kolmogorov_crespi_full.cpp b/src/INTERLAYER/pair_kolmogorov_crespi_full.cpp index b2eba787b1..b497ae3568 100644 --- a/src/INTERLAYER/pair_kolmogorov_crespi_full.cpp +++ b/src/INTERLAYER/pair_kolmogorov_crespi_full.cpp @@ -12,7 +12,7 @@ ------------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- - Contributing author: Wengen Ouyang (Tel Aviv University) + Contributing author: Wengen Ouyang (Wuhan University) e-mail: w.g.ouyang at gmail dot com based on previous versions by Jaap Kroes diff --git a/src/MANYBODY/pair_tersoff.cpp b/src/MANYBODY/pair_tersoff.cpp index f38ba00861..c7c45bc865 100644 --- a/src/MANYBODY/pair_tersoff.cpp +++ b/src/MANYBODY/pair_tersoff.cpp @@ -14,7 +14,7 @@ /* ---------------------------------------------------------------------- Contributing author: Aidan Thompson (SNL) - original Tersoff implementation - Wengen Ouyang (TAU) - Shift addition + Wengen Ouyang (WHU) - Shift addition ------------------------------------------------------------------------- */ #include "pair_tersoff.h" From 0ef0419a98adb1d804c17efc0c3d78cb2d549275 Mon Sep 17 00:00:00 2001 From: oywg11 Date: Tue, 6 Jun 2023 21:45:51 +0800 Subject: [PATCH 180/396] rename function names in opt version --- src/OPT/pair_aip_water_2dm_opt.cpp | 2 +- src/OPT/pair_ilp_graphene_hbn_opt.cpp | 51 +++++++++++++++++---------- src/OPT/pair_ilp_graphene_hbn_opt.h | 2 +- src/OPT/pair_ilp_tmd_opt.cpp | 2 +- 4 files changed, 35 insertions(+), 22 deletions(-) diff --git a/src/OPT/pair_aip_water_2dm_opt.cpp b/src/OPT/pair_aip_water_2dm_opt.cpp index 17e981e479..3aba5b9dbd 100644 --- a/src/OPT/pair_aip_water_2dm_opt.cpp +++ b/src/OPT/pair_aip_water_2dm_opt.cpp @@ -23,7 +23,7 @@ e-mail: qdgaoping at gmail dot com Optimizations are described in: - Gao, Ping and Duan, Xiaohui, et al: + Gao, Ping and Duan, Xiaohui, et al.: LMFF: Efficient and Scalable Layered Materials Force Field on Heterogeneous Many-Core Processors DOI: 10.1145/3458817.3476137 diff --git a/src/OPT/pair_ilp_graphene_hbn_opt.cpp b/src/OPT/pair_ilp_graphene_hbn_opt.cpp index b2abcec7be..5bf21e5c24 100644 --- a/src/OPT/pair_ilp_graphene_hbn_opt.cpp +++ b/src/OPT/pair_ilp_graphene_hbn_opt.cpp @@ -11,12 +11,24 @@ ------------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- - Optimization author1: Ping Gao (National Supercomputing Center in Wuxi, China) - e-mail: qdgaoping at gmail dot com - Optimization author2: Xiaohui Duan (National Supercomputing Center in Wuxi, China) - e-mail: sunrise_duan at 126 dot com + This is an optimized version of ilp/graphene/hbn based on the contribution of: + author: Wengen Ouyang (Wuhan University) + e-mail: w.g.ouyang at gmail dot com - Provides some bugfixes and performance optimizations in this potential. + Optimizations are done by: + author1: Ping Gao (National Supercomputing Center in Wuxi, China) + e-mail: qdgaoping at gmail dot com + + author2: Xiaohui Duan (National Supercomputing Center in Wuxi, China) + e-mail: sunrise_duan at 126 dot com + + Optimizations are described in: + Gao, Ping and Duan, Xiaohui, et al.: + LMFF: Efficient and Scalable Layered Materials Force Field on Heterogeneous Many-Core Processors + DOI: 10.1145/3458817.3476137 + + Potential is described by: + [Ouyang et al., J. Chem. Theory Comput. 16(1), 666-676 (2020)] */ #include "pair_ilp_graphene_hbn_opt.h" @@ -169,33 +181,33 @@ void PairILPGrapheneHBNOpt::compute(int eflag, int vflag) } } } - } else if (variant == AIP_WATER_2DM) { + } else if (variant == ILP_WATER_2DM) { if (eflag_global || eflag_atom) { if (vflag_either) { if (tap_flag) { - eval<6, 1, 1, 1, AIP_WATER_2DM>(); + eval<6, 1, 1, 1, ILP_WATER_2DM>(); } else { - eval<6, 1, 1, 0, AIP_WATER_2DM>(); + eval<6, 1, 1, 0, ILP_WATER_2DM>(); } } else { if (tap_flag) { - eval<6, 1, 0, 1, AIP_WATER_2DM>(); + eval<6, 1, 0, 1, ILP_WATER_2DM>(); } else { - eval<6, 1, 0, 0, AIP_WATER_2DM>(); + eval<6, 1, 0, 0, ILP_WATER_2DM>(); } } } else { if (vflag_either) { if (tap_flag) { - eval<6, 0, 1, 1, AIP_WATER_2DM>(); + eval<6, 0, 1, 1, ILP_WATER_2DM>(); } else { - eval<6, 0, 1, 0, AIP_WATER_2DM>(); + eval<6, 0, 1, 0, ILP_WATER_2DM>(); } } else { if (tap_flag) { - eval<6, 0, 0, 1, AIP_WATER_2DM>(); + eval<6, 0, 0, 1, ILP_WATER_2DM>(); } else { - eval<6, 0, 0, 0, AIP_WATER_2DM>(); + eval<6, 0, 0, 0, ILP_WATER_2DM>(); } } } @@ -286,7 +298,7 @@ void PairILPGrapheneHBNOpt::eval() rsq = delx * delx + dely * dely + delz * delz; if (rsq != 0 && rsq < cutILPsq[itype_map][jtype]) { - if ((VARIANT == ILP_TMD || VARIANT == AIP_WATER_2DM) && special_type[itype] == TMD_METAL && itype != type[j]) continue; + if ((VARIANT == ILP_TMD || VARIANT == ILP_WATER_2DM) && special_type[itype] == TMD_METAL && itype != type[j]) continue; if (ILP_nneigh >= MAX_NNEIGH) { error->one(FLERR, "There are too many neighbors for calculating normals"); } @@ -301,7 +313,7 @@ void PairILPGrapheneHBNOpt::eval() double norm[3], dnormdxi[3][3], dnormdxk[MAX_NNEIGH][3][3]; - calc_normal(i, itype, ILP_neigh, ILP_nneigh, norm, dnormdxi, dnormdxk); + calc_atom_normal(i, itype, ILP_neigh, ILP_nneigh, norm, dnormdxi, dnormdxk); for (jj = 0; jj < jnum_inter; jj++) { j = jlist_inter[jj]; @@ -471,6 +483,7 @@ inline void deriv_hat(double dnhatdn[3][3], double *n, double rnnorm, double fac dnhatdn[0][2] = -n[0]*n[2]*cfactor; dnhatdn[1][2] = -n[1]*n[2]*cfactor; dnhatdn[2][2] = (n[0]*n[0]+n[1]*n[1])*cfactor; + } inline double normalize_factor(double *n) { @@ -485,7 +498,7 @@ inline double normalize_factor(double *n) Yet another normal calculation method for simpiler code. */ template -void PairILPGrapheneHBNOpt::calc_normal(int i, int itype, int *ILP_neigh, int nneigh, double *n, +void PairILPGrapheneHBNOpt::calc_atom_normal(int i, int itype, int *ILP_neigh, int nneigh, double *n, double (*dnormdri)[3], double (*dnormdrk)[3][3]) { double **x = atom->x; @@ -519,8 +532,8 @@ void PairILPGrapheneHBNOpt::calc_normal(int i, int itype, int *ILP_neigh, int nn vet[jj][2] = x[j][2] - x[i][2]; } - //specialize for AIP_WATER_2DM for hydrogen has special normal vector rule - if (variant == AIP_WATER_2DM && special_type[itype] == WATER) { + //specialize for ILP_WATER_2DM for hydrogen has special normal vector rule + if (variant == ILP_WATER_2DM && special_type[itype] == WATER) { if (nneigh == 1){ n[0] = vet[0][0]; n[1] = vet[0][1]; diff --git a/src/OPT/pair_ilp_graphene_hbn_opt.h b/src/OPT/pair_ilp_graphene_hbn_opt.h index 41d2178092..01b66bb2fa 100644 --- a/src/OPT/pair_ilp_graphene_hbn_opt.h +++ b/src/OPT/pair_ilp_graphene_hbn_opt.h @@ -35,7 +35,7 @@ class PairILPGrapheneHBNOpt : virtual public PairILPGrapheneHBN { protected: void update_internal_list(); template - void calc_normal(int i, int itype, int *ILP_neigh, int nneigh, double *normal, double (*dnormdri)[3], + void calc_atom_normal(int i, int itype, int *ILP_neigh, int nneigh, double *normal, double (*dnormdri)[3], double (*dnormdrk)[3][3]); template void eval(); diff --git a/src/OPT/pair_ilp_tmd_opt.cpp b/src/OPT/pair_ilp_tmd_opt.cpp index 834f2a0c9f..3fa95b7e10 100644 --- a/src/OPT/pair_ilp_tmd_opt.cpp +++ b/src/OPT/pair_ilp_tmd_opt.cpp @@ -23,7 +23,7 @@ e-mail: qdgaoping at gmail dot com Optimizations are described in: - Gao, Ping and Duan, Xiaohui, et al: + Gao, Ping and Duan, Xiaohui, et al.: LMFF: Efficient and Scalable Layered Materials Force Field on Heterogeneous Many-Core Processors DOI: 10.1145/3458817.3476137 From f85474c9ecc64532c5197b96ba0d38c80547a729 Mon Sep 17 00:00:00 2001 From: oywg11 Date: Tue, 6 Jun 2023 22:03:33 +0800 Subject: [PATCH 181/396] fix a typo --- src/OPT/pair_aip_water_2dm_opt.h | 1 - src/OPT/pair_ilp_graphene_hbn_opt.cpp | 48 +++++++++++++-------------- 2 files changed, 23 insertions(+), 26 deletions(-) diff --git a/src/OPT/pair_aip_water_2dm_opt.h b/src/OPT/pair_aip_water_2dm_opt.h index 46280c2b82..50b5043360 100644 --- a/src/OPT/pair_aip_water_2dm_opt.h +++ b/src/OPT/pair_aip_water_2dm_opt.h @@ -36,4 +36,3 @@ class PairAIPWATER2DMOpt : public PairAIPWATER2DM, public PairILPGrapheneHBNOpt } // namespace LAMMPS_NS #endif #endif - diff --git a/src/OPT/pair_ilp_graphene_hbn_opt.cpp b/src/OPT/pair_ilp_graphene_hbn_opt.cpp index 5bf21e5c24..5cb896223e 100644 --- a/src/OPT/pair_ilp_graphene_hbn_opt.cpp +++ b/src/OPT/pair_ilp_graphene_hbn_opt.cpp @@ -11,31 +11,30 @@ ------------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- - This is an optimized version of ilp/graphene/hbn based on the contribution of: - author: Wengen Ouyang (Wuhan University) - e-mail: w.g.ouyang at gmail dot com + This is an optimized version of ilp/graphene/hbn based on the contirubtion of: + author: Wengen Ouyang (Wuhan University, China) + e-mail: w.g.ouyang at gmail dot com Optimizations are done by: - author1: Ping Gao (National Supercomputing Center in Wuxi, China) - e-mail: qdgaoping at gmail dot com + author1: Ping Gao (National Supercomputing Center in Wuxi, China) implements the base ILP potential. + e-mail: qdgaoping at gmail dot com - author2: Xiaohui Duan (National Supercomputing Center in Wuxi, China) - e-mail: sunrise_duan at 126 dot com + author2: Xiaohui Duan (Shandong University, China) adjusts the framework to adopt SAIP, TMD, WATER2DM, etc. + e-mail: sunrise_duan at 126 dot com Optimizations are described in: - Gao, Ping and Duan, Xiaohui, et al.: - LMFF: Efficient and Scalable Layered Materials Force Field on Heterogeneous Many-Core Processors - DOI: 10.1145/3458817.3476137 + Gao, Ping and Duan, Xiaohui, et al: + LMFF: Efficient and Scalable Layered Materials Force Field on Heterogeneous Many-Core Processors + DOI: 10.1145/3458817.3476137 Potential is described by: - [Ouyang et al., J. Chem. Theory Comput. 16(1), 666-676 (2020)] + [Ouyang et al., J. Chem. Theory Comput. 16(1), 666-676 (2020)] */ #include "pair_ilp_graphene_hbn_opt.h" #include "atom.h" #include "citeme.h" -#include "comm.h" #include "error.h" #include "force.h" #include "interlayer_taper.h" @@ -181,33 +180,33 @@ void PairILPGrapheneHBNOpt::compute(int eflag, int vflag) } } } - } else if (variant == ILP_WATER_2DM) { + } else if (variant == AIP_WATER_2DM) { if (eflag_global || eflag_atom) { if (vflag_either) { if (tap_flag) { - eval<6, 1, 1, 1, ILP_WATER_2DM>(); + eval<6, 1, 1, 1, AIP_WATER_2DM>(); } else { - eval<6, 1, 1, 0, ILP_WATER_2DM>(); + eval<6, 1, 1, 0, AIP_WATER_2DM>(); } } else { if (tap_flag) { - eval<6, 1, 0, 1, ILP_WATER_2DM>(); + eval<6, 1, 0, 1, AIP_WATER_2DM>(); } else { - eval<6, 1, 0, 0, ILP_WATER_2DM>(); + eval<6, 1, 0, 0, AIP_WATER_2DM>(); } } } else { if (vflag_either) { if (tap_flag) { - eval<6, 0, 1, 1, ILP_WATER_2DM>(); + eval<6, 0, 1, 1, AIP_WATER_2DM>(); } else { - eval<6, 0, 1, 0, ILP_WATER_2DM>(); + eval<6, 0, 1, 0, AIP_WATER_2DM>(); } } else { if (tap_flag) { - eval<6, 0, 0, 1, ILP_WATER_2DM>(); + eval<6, 0, 0, 1, AIP_WATER_2DM>(); } else { - eval<6, 0, 0, 0, ILP_WATER_2DM>(); + eval<6, 0, 0, 0, AIP_WATER_2DM>(); } } } @@ -298,7 +297,7 @@ void PairILPGrapheneHBNOpt::eval() rsq = delx * delx + dely * dely + delz * delz; if (rsq != 0 && rsq < cutILPsq[itype_map][jtype]) { - if ((VARIANT == ILP_TMD || VARIANT == ILP_WATER_2DM) && special_type[itype] == TMD_METAL && itype != type[j]) continue; + if ((VARIANT == ILP_TMD || VARIANT == AIP_WATER_2DM) && special_type[itype] == TMD_METAL && itype != type[j]) continue; if (ILP_nneigh >= MAX_NNEIGH) { error->one(FLERR, "There are too many neighbors for calculating normals"); } @@ -483,7 +482,6 @@ inline void deriv_hat(double dnhatdn[3][3], double *n, double rnnorm, double fac dnhatdn[0][2] = -n[0]*n[2]*cfactor; dnhatdn[1][2] = -n[1]*n[2]*cfactor; dnhatdn[2][2] = (n[0]*n[0]+n[1]*n[1])*cfactor; - } inline double normalize_factor(double *n) { @@ -532,8 +530,8 @@ void PairILPGrapheneHBNOpt::calc_atom_normal(int i, int itype, int *ILP_neigh, i vet[jj][2] = x[j][2] - x[i][2]; } - //specialize for ILP_WATER_2DM for hydrogen has special normal vector rule - if (variant == ILP_WATER_2DM && special_type[itype] == WATER) { + //specialize for AIP_WATER_2DM for hydrogen has special normal vector rule + if (variant == AIP_WATER_2DM && special_type[itype] == WATER) { if (nneigh == 1){ n[0] = vet[0][0]; n[1] = vet[0][1]; From 51b45d683071f1985d59a9a25b1ebc8f29739017 Mon Sep 17 00:00:00 2001 From: oywg11 Date: Tue, 6 Jun 2023 22:16:41 +0800 Subject: [PATCH 182/396] fix small format issues --- src/INTERLAYER/pair_ilp_graphene_hbn.cpp | 2 -- src/INTERLAYER/pair_ilp_tmd.cpp | 2 +- src/INTERLAYER/pair_saip_metal.cpp | 2 +- 3 files changed, 2 insertions(+), 4 deletions(-) diff --git a/src/INTERLAYER/pair_ilp_graphene_hbn.cpp b/src/INTERLAYER/pair_ilp_graphene_hbn.cpp index eb37b39864..69896d7c0b 100644 --- a/src/INTERLAYER/pair_ilp_graphene_hbn.cpp +++ b/src/INTERLAYER/pair_ilp_graphene_hbn.cpp @@ -16,8 +16,6 @@ This is a full version of the potential described in [Ouyang et al., J. Chem. Theory Comput. 16(1), 666-676 (2020)] - The definition of normals are the same as that in - [Kolmogorov & Crespi, Phys. Rev. B 71, 235415 (2005)] ------------------------------------------------------------------------- */ #include "pair_ilp_graphene_hbn.h" diff --git a/src/INTERLAYER/pair_ilp_tmd.cpp b/src/INTERLAYER/pair_ilp_tmd.cpp index f0d618687a..f29ee34180 100644 --- a/src/INTERLAYER/pair_ilp_tmd.cpp +++ b/src/INTERLAYER/pair_ilp_tmd.cpp @@ -15,7 +15,7 @@ e-mail: w.g.ouyang at gmail dot com This is a full version of the potential described in - [Ouyang et al, J. Chem. Theory Comput. 17, 7237 (2021).] + [Ouyang et al., J. Chem. Theory Comput. 17, 7237 (2021).] ------------------------------------------------------------------------- */ #include "pair_ilp_tmd.h" diff --git a/src/INTERLAYER/pair_saip_metal.cpp b/src/INTERLAYER/pair_saip_metal.cpp index 05fbfbf7f4..bd327391a4 100644 --- a/src/INTERLAYER/pair_saip_metal.cpp +++ b/src/INTERLAYER/pair_saip_metal.cpp @@ -15,7 +15,7 @@ e-mail: w.g.ouyang at gmail dot com This is a full version of the potential described in - [Ouyang et al, J. Chem. Theory Comput. 17, 7215-7223 (2021)] + [Ouyang et al., J. Chem. Theory Comput. 17, 7215-7223 (2021)] ------------------------------------------------------------------------- */ #include "pair_saip_metal.h" From c4d49324b52f708d9e0d8fc6ef123cee84f68845 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Tue, 6 Jun 2023 16:08:50 -0400 Subject: [PATCH 183/396] various documentation updates - spelling fixes - formatting conventions - grammar fixes and clarifications - full integration into manual build procedure --- doc/src/Commands_pair.rst | 1 + doc/src/pair_aip_water_2dm.rst | 64 +++++++++++---------- doc/src/pair_style.rst | 1 + doc/utils/sphinx-config/false_positives.txt | 3 + 4 files changed, 39 insertions(+), 30 deletions(-) diff --git a/doc/src/Commands_pair.rst b/doc/src/Commands_pair.rst index 5f79015aaf..87d3129880 100644 --- a/doc/src/Commands_pair.rst +++ b/doc/src/Commands_pair.rst @@ -37,6 +37,7 @@ OPT. * * :doc:`adp (ko) ` * :doc:`agni (o) ` + * :doc:`aip/water/2dm (o) ` * :doc:`airebo (io) ` * :doc:`airebo/morse (io) ` * :doc:`amoeba (g) ` diff --git a/doc/src/pair_aip_water_2dm.rst b/doc/src/pair_aip_water_2dm.rst index 3ae63e1e45..5218db9c37 100644 --- a/doc/src/pair_aip_water_2dm.rst +++ b/doc/src/pair_aip_water_2dm.rst @@ -35,8 +35,8 @@ Description .. versionadded:: xxxx2023 -The *aip/water/2dm* style computes the anisotropic interfacial -potential (AIP) potential for interfaces of water with two-dimensinal (2D) +The *aip/water/2dm* style computes the anisotropic interfacial potential +(AIP) potential for interfaces of water with two-dimensional (2D) materials as described in :ref:`(Feng) `. .. math:: @@ -56,41 +56,45 @@ materials as described in :ref:`(Feng) `. Where :math:`\mathrm{Tap}(r_{ij})` is the taper function which provides a continuous cutoff (up to third derivative) for interatomic separations -larger than :math:`r_c` :doc:`pair_style ilp_graphene_hbn `. +larger than :math:`r_c` :doc:`pair_style ilp_graphene_hbn +`. It is important to include all the pairs to build the neighbor list for calculating the normals. .. note:: - Since each water molecule contains one oxygen atom and two hydrogen atoms, - a new definition is proposed (see In :ref:`(Feng) `),the atomic - normal vectors of hydrogen atoms are assumed to lie along the corresponding - oxygen-hydrogen bonds and the normal vector of the central oxygen atom - is defined as their average. + Since each water molecule contains one oxygen atom and two hydrogen + atoms, a new definition is proposed (see In :ref:`(Feng) `),the + atomic normal vectors of hydrogen atoms are assumed to lie along the + corresponding oxygen-hydrogen bonds and the normal vector of the + central oxygen atom is defined as their average. -The parameter file (e.g. COH.aip.water.2dm), is intended for use with *metal* -:doc:`units `, with energies in meV. Two additional parameters, -*S*, and *rcut* are included in the parameter file. *S* is designed to -facilitate scaling of energies. *rcut* is designed to build the neighbor -list for calculating the normals for each atom pair. +The provided parameter file, ``COH.aip.water.2dm``, is intended for use +with *metal* :doc:`units `, with energies in meV. Two additional +parameters, *S*, and *rcut* are included in the parameter file. *S* is +designed to facilitate scaling of energies; *rcut* is designed to build +the neighbor list for calculating the normals for each atom pair. .. note:: - The parameters presented in the parameter file (e.g. COH.aip.water.2dm), - are fitted with taper function by setting the cutoff equal to 16.0 - Angstrom. Using different cutoff or taper function should be careful. - These parameters provide a good description in both short- and long-range - interaction regimes. This feature is essential for simulations in high pressure - regime (i.e., the interlayer distance is smaller than the equilibrium - distance). + The parameters presented in the provided parameter file, + ``COH.aip.water.2dm``, are fitted with the taper function enabled by + setting the cutoff equal to 16.0 Angstrom. Using a different cutoff + or taper function setting should be carefully checked as they can + lead to significant errors. These parameters provide a good + description in both short- and long-range interaction regimes. This + feature is essential for simulations in high pressure regime (i.e., + the interlayer distance is smaller than the equilibrium distance). -This potential must be used in combination with hybrid/overlay. -Other interactions can be set to zero using pair_style *none*\ . +This potential must be used in combination with hybrid/overlay. Other +interactions can be set to zero using :doc:`pair_coeff settings +` with the pair style set to *none*\ . This pair style tallies a breakdown of the total interlayer potential -energy into sub-categories, which can be accessed via the :doc:`compute pair ` command as a vector of values of length 2. -The 2 values correspond to the following sub-categories: +energy into sub-categories, which can be accessed via the :doc:`compute +pair ` command as a vector of values of length 2. The 2 +values correspond to the following sub-categories: 1. *E_vdW* = vdW (attractive) energy 2. *E_Rep* = Repulsive energy @@ -132,11 +136,11 @@ if LAMMPS was built with that package. See the :doc:`Build package This pair style requires the newton setting to be *on* for pair interactions. -The COH.aip.water.2dm potential file provided with LAMMPS (see the potentials -directory) are parameterized for *metal* units. You can use this -potential with any LAMMPS units, but you would need to create your -COH.aip.water.2dm potential file with coefficients listed in the appropriate -units, if your simulation does not use *metal* units. +The ``COH.aip.water.2dm`` potential file provided with LAMMPS is +parameterized for *metal* units. You can use this pair style with any +LAMMPS units, but you would need to create your own potential file with +parameters in the appropriate units, if your simulation does not use +*metal* units. Related commands """""""""""""""" @@ -158,8 +162,8 @@ Default tap_flag = 1 - ---------- .. _Feng: + **(Feng)** Z. Feng and W. Ouyang et al., J. Phys. Chem. C. 127, 8704-8713 (2023). diff --git a/doc/src/pair_style.rst b/doc/src/pair_style.rst index 441313b0b8..494a26aacf 100644 --- a/doc/src/pair_style.rst +++ b/doc/src/pair_style.rst @@ -114,6 +114,7 @@ accelerated styles exist. * :doc:`adp ` - angular dependent potential (ADP) of Mishin * :doc:`agni ` - AGNI machine-learning potential +* :doc:`aip/water/2dm ` - anisotropic interfacial potential for water in 2d geometries * :doc:`airebo ` - AIREBO potential of Stuart * :doc:`airebo/morse ` - AIREBO with Morse instead of LJ * :doc:`amoeba ` - diff --git a/doc/utils/sphinx-config/false_positives.txt b/doc/utils/sphinx-config/false_positives.txt index d2d15633af..ad2a255447 100644 --- a/doc/utils/sphinx-config/false_positives.txt +++ b/doc/utils/sphinx-config/false_positives.txt @@ -55,6 +55,7 @@ Ai Aidan aij aimd +aip airebo Aj ajaramil @@ -528,6 +529,7 @@ collisional Columic colvars Colvars +COH COLVARS comID Commun @@ -1090,6 +1092,7 @@ Fellinger femtosecond femtoseconds fene +Feng Fennell fep FEP From eafabf0fb1d0818b675953a7e5a56f044044491b Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Tue, 6 Jun 2023 16:10:11 -0400 Subject: [PATCH 184/396] update .gitignore --- src/.gitignore | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/.gitignore b/src/.gitignore index 204eec5e0b..2db7bb4663 100644 --- a/src/.gitignore +++ b/src/.gitignore @@ -1058,6 +1058,10 @@ /pair_adp.h /pair_agni.cpp /pair_agni.h +/pair_aip_water_2dm.cpp +/pair_aip_water_2dm.h +/pair_aip_water_2dm_opt.cpp +/pair_aip_water_2dm_opt.h /pair_airebo.cpp /pair_airebo.h /pair_airebo_morse.cpp From e954d8f0507bc31869f083777e412e5b1ed1aaed Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Tue, 6 Jun 2023 16:11:03 -0400 Subject: [PATCH 185/396] correctly indicate OPT package version of pair style --- doc/src/Commands_pair.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/src/Commands_pair.rst b/doc/src/Commands_pair.rst index 87d3129880..c45a1d778c 100644 --- a/doc/src/Commands_pair.rst +++ b/doc/src/Commands_pair.rst @@ -37,7 +37,7 @@ OPT. * * :doc:`adp (ko) ` * :doc:`agni (o) ` - * :doc:`aip/water/2dm (o) ` + * :doc:`aip/water/2dm (t) ` * :doc:`airebo (io) ` * :doc:`airebo/morse (io) ` * :doc:`amoeba (g) ` From ee6b12ee300c8adb1c8cd62ba6f703b4a6bb73b1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Yifan=20Li=E6=9D=8E=E4=B8=80=E5=B8=86?= Date: Tue, 6 Jun 2023 18:04:26 -0400 Subject: [PATCH 186/396] Correct reference info --- doc/src/fix_pimd.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/src/fix_pimd.rst b/doc/src/fix_pimd.rst index 22c064b60b..c08a4005f5 100644 --- a/doc/src/fix_pimd.rst +++ b/doc/src/fix_pimd.rst @@ -445,7 +445,7 @@ Path Integrals, McGraw-Hill, New York (1965). **(Bussi)** G. Bussi, T. Zykova-Timan, M. Parrinello, J Chem Phys, 130, 074101 (2009). -.. _Ceriotti2: +.. _Ceriotti3: **(Ceriotti)** M. Ceriotti, M. Parrinello, T. Markland, D. Manolopoulos, J. Chem. Phys. 133, 124104 (2010). From a415d732fc354ba7af12c438ad869f5f9f5484c4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Yifan=20Li=E6=9D=8E=E4=B8=80=E5=B8=86?= Date: Tue, 6 Jun 2023 18:11:01 -0400 Subject: [PATCH 187/396] rename Langevin init --- src/REPLICA/fix_pimd_langevin.cpp | 4 ++-- src/REPLICA/fix_pimd_langevin.h | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/REPLICA/fix_pimd_langevin.cpp b/src/REPLICA/fix_pimd_langevin.cpp index 2e4b1c17b8..17ea07c845 100644 --- a/src/REPLICA/fix_pimd_langevin.cpp +++ b/src/REPLICA/fix_pimd_langevin.cpp @@ -451,7 +451,7 @@ void FixPIMDLangevin::init() nmpimd_init(); - Langevin_init(); + langevin_init(); c_pe = modify->get_compute_by_id(id_pe); c_press = modify->get_compute_by_id(id_press); @@ -888,7 +888,7 @@ void FixPIMDLangevin::press_o_step() /* ---------------------------------------------------------------------- */ -void FixPIMDLangevin::Langevin_init() +void FixPIMDLangevin::langevin_init() { double beta = 1.0 / kBT; _omega_np = np / beta / hbar; diff --git a/src/REPLICA/fix_pimd_langevin.h b/src/REPLICA/fix_pimd_langevin.h index 79a2ee7477..1ef1dfae52 100644 --- a/src/REPLICA/fix_pimd_langevin.h +++ b/src/REPLICA/fix_pimd_langevin.h @@ -115,7 +115,7 @@ class FixPIMDLangevin : public Fix { class RanMars *random; int tstat_flag; // tstat_flat = 1 if thermostat if used - void Langevin_init(); + void langevin_init(); void b_step(); // integrate for dt/2 according to B part (v <- v + f * dt/2) void a_step(); // integrate for dt/2 according to A part (non-centroid mode, harmonic force between replicas) void qc_step(); // integrate for dt/2 for the centroid mode (x <- x + v * dt/2) From 5ff6fd9aad41084521a1a48381c6ebba6f584426 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Yifan=20Li=E6=9D=8E=E4=B8=80=E5=B8=86?= Date: Tue, 6 Jun 2023 18:14:28 -0400 Subject: [PATCH 188/396] rename kBT to kt --- src/REPLICA/fix_pimd_langevin.cpp | 16 ++++++++-------- src/REPLICA/fix_pimd_langevin.h | 2 +- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/REPLICA/fix_pimd_langevin.cpp b/src/REPLICA/fix_pimd_langevin.cpp index 17ea07c845..c85edc99f9 100644 --- a/src/REPLICA/fix_pimd_langevin.cpp +++ b/src/REPLICA/fix_pimd_langevin.cpp @@ -257,7 +257,7 @@ FixPIMDLangevin::FixPIMDLangevin(LAMMPS *lmp, int narg, char **arg) : } } extvector = 1; - kBT = force->boltz * temp; + kt = force->boltz * temp; if (pstat_flag) baro_init(); // some initilizations @@ -800,10 +800,10 @@ void FixPIMDLangevin::baro_init() { vw[0] = vw[1] = vw[2] = vw[3] = vw[4] = vw[5] = 0.0; if (pstyle == ISO) { - W = 3 * (atom->natoms) * tau_p * tau_p * np * kBT; + W = 3 * (atom->natoms) * tau_p * tau_p * np * kt; } // consistent with the definition in i-Pi else if (pstyle == ANISO) { - W = atom->natoms * tau_p * tau_p * np * kBT; + W = atom->natoms * tau_p * tau_p * np * kt; } Vcoeff = 1.0; std::string out = fmt::format("\nInitializing PIMD {:s} barostat...\n", Barostats[barostat]); @@ -890,7 +890,7 @@ void FixPIMDLangevin::press_o_step() void FixPIMDLangevin::langevin_init() { - double beta = 1.0 / kBT; + double beta = 1.0 / kt; _omega_np = np / beta / hbar; double _omega_np_dt_half = _omega_np * update->dt * 0.5; @@ -1394,11 +1394,11 @@ void FixPIMDLangevin::compute_totenthalpy() if (barostat == BZP) { if (pstyle == ISO) { totenthalpy = tote + 0.5 * W * vw[0] * vw[0] * inverse_np + p_hydro * volume / force->nktv2p - - Vcoeff * kBT * log(volume); + Vcoeff * kt * log(volume); } else if (pstyle == ANISO) { totenthalpy = tote + 0.5 * W * vw[0] * vw[0] * inverse_np + 0.5 * W * vw[1] * vw[1] * inverse_np + 0.5 * W * vw[2] * vw[2] * inverse_np + - p_hydro * volume / force->nktv2p - Vcoeff * kBT * log(volume); + p_hydro * volume / force->nktv2p - Vcoeff * kt * log(volume); } } else if (barostat == MTTK) totenthalpy = tote + 1.5 * W * vw[0] * vw[0] * inverse_np + p_hydro * (volume - vol0); @@ -1477,7 +1477,7 @@ double FixPIMDLangevin::compute_vector(int n) if (n == 11) return 1.5 * W * vw[0] * vw[0]; } if (n == 12) { return np * Pext * volume / force->nktv2p; } - if (n == 13) { return -Vcoeff * np * kBT * log(volume); } + if (n == 13) { return -Vcoeff * np * kt * log(volume); } if (n == 14) return totenthalpy; } else if (pstyle == ANISO) { if (n == 10) return vw[0]; @@ -1487,7 +1487,7 @@ double FixPIMDLangevin::compute_vector(int n) if (n == 14) { return np * Pext * volume / force->nktv2p; } if (n == 15) { volume = domain->xprd * domain->yprd * domain->zprd; - return -Vcoeff * np * kBT * log(volume); + return -Vcoeff * np * kt * log(volume); } if (n == 16) return totenthalpy; } diff --git a/src/REPLICA/fix_pimd_langevin.h b/src/REPLICA/fix_pimd_langevin.h index 1ef1dfae52..dc48832855 100644 --- a/src/REPLICA/fix_pimd_langevin.h +++ b/src/REPLICA/fix_pimd_langevin.h @@ -51,7 +51,7 @@ class FixPIMDLangevin : public Fix { double lj_epsilon, lj_sigma, lj_mass; // LJ unit energy, length, and mass scales double other_planck; double other_mvv2e; - double kBT; // k_B * temp + double kt; // k_B * temp double beta, beta_np; // beta = 1./kBT beta_np = 1./kBT/np int thermostat; // NHC or PILE_L int barostat; // BZP From f83867787c6eb7ed8b509a54be25b3ee46e7290d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Yifan=20Li=E6=9D=8E=E4=B8=80=E5=B8=86?= Date: Tue, 6 Jun 2023 18:17:39 -0400 Subject: [PATCH 189/396] update error message --- src/REPLICA/fix_pimd_langevin.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/REPLICA/fix_pimd_langevin.cpp b/src/REPLICA/fix_pimd_langevin.cpp index c85edc99f9..0af08b43b3 100644 --- a/src/REPLICA/fix_pimd_langevin.cpp +++ b/src/REPLICA/fix_pimd_langevin.cpp @@ -155,7 +155,7 @@ FixPIMDLangevin::FixPIMDLangevin(LAMMPS *lmp, int narg, char **arg) : pstat_flag = 1; } else error->universe_all(FLERR, - "Unknown ensemble parameter for fix pimd/langevin. Only nve and nvt " + "Unknown ensemble parameter for fix pimd/langevin. Only nve, nvt, nph, and npt " "ensembles are supported!"); } else if (strcmp(arg[i], "fmass") == 0) { fmass = utils::numeric(FLERR, arg[i + 1], false, lmp); From 14acb3e0ca5aa77662fbe4d96fc6463909e52be5 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Tue, 6 Jun 2023 20:38:15 -0400 Subject: [PATCH 190/396] add multitype data type and unittest (including tests for ubuf) --- src/lmptype.h | 82 +++++++++++++++++++++++++++++++- unittest/utils/CMakeLists.txt | 4 ++ unittest/utils/test_lmptype.cpp | 84 +++++++++++++++++++++++++++++++++ 3 files changed, 168 insertions(+), 2 deletions(-) create mode 100644 unittest/utils/test_lmptype.cpp diff --git a/src/lmptype.h b/src/lmptype.h index ecd6ee5761..6e0b54d988 100644 --- a/src/lmptype.h +++ b/src/lmptype.h @@ -95,7 +95,7 @@ typedef int64_t bigint; #define MAXSMALLINT INT_MAX #define MAXTAGINT INT_MAX #define MAXBIGINT INT64_MAX -#define MAXDOUBLEINT 9007199254740992 // 2^53 +#define MAXDOUBLEINT 9007199254740992 // 2^53 #define MPI_LMP_TAGINT MPI_INT #define MPI_LMP_IMAGEINT MPI_INT @@ -133,7 +133,7 @@ typedef int64_t bigint; #define MAXSMALLINT INT_MAX #define MAXTAGINT INT64_MAX #define MAXBIGINT INT64_MAX -#define MAXDOUBLEINT 9007199254740992 // 2^53 +#define MAXDOUBLEINT 9007199254740992 // 2^53 #define MPI_LMP_TAGINT MPI_LL #define MPI_LMP_IMAGEINT MPI_LL @@ -232,6 +232,84 @@ union ubuf { ubuf(const int64_t &arg) : i(arg) {} ubuf(const int &arg) : i(arg) {} }; + +/** Data structure for dynamic typing of int, bigint, and double + * + * Using this union allows to store any of the supported data types + * in the same container and allows to "see" its current type. +\verbatim embed:rst + +**Usage:** + +.. code-block:: c++ + :caption: To store data in multitype array: + + multitype m[5]; + int foo = 1; + double bar = 2.5; + bigint baz = 1<<40 - 1; + m[0] = foo; + m[1] = bar; + m[2] = -1; + m[3] = 2.0; + m[4] = baz; + +.. code-block:: c++ + :caption: To format data from multitype array into a space separated string: + + std::string str; + for (int i = 0; i < 5; ++i) { + switch (m[i].type) { + case multitype::DOUBLE: + str += std::to_string(m[i].data.d) + ' '; + break; + case multitype::INT: + str += std::to_string(m[i].data.i) + ' '; + break; + case multitype::BIGINT: + str += std::to_string(m[i].data.b) + ' '; + break; + default: + break; + } + } +\endverbatim + */ +struct multitype { + enum { NONE, DOUBLE, INT, BIGINT }; + + int type; + union { + double d; + int i; + int64_t b; + } data; + + multitype() : type(NONE) { data.d = 0.0; } + multitype(const multitype &) = default; + multitype(multitype &&) = default; + ~multitype() = default; + + multitype &operator=(const double &_d) + { + type = DOUBLE; + data.d = _d; + return *this; + } + multitype &operator=(const int &_i) + { + type = INT; + data.i = _i; + return *this; + } + multitype &operator=(const int64_t &_b) + { + type = BIGINT; + data.b = _b; + return *this; + } +}; + } // namespace LAMMPS_NS // preprocessor macros for compiler specific settings diff --git a/unittest/utils/CMakeLists.txt b/unittest/utils/CMakeLists.txt index a6d5545873..8c1a5a3f6a 100644 --- a/unittest/utils/CMakeLists.txt +++ b/unittest/utils/CMakeLists.txt @@ -7,6 +7,10 @@ add_executable(test_mempool test_mempool.cpp) target_link_libraries(test_mempool PRIVATE lammps GTest::GMockMain) add_test(NAME MemPool COMMAND test_mempool) +add_executable(test_lmptype test_lmptype.cpp) +target_link_libraries(test_lmptype PRIVATE lammps GTest::GMockMain) +add_test(NAME LmpType COMMAND test_lmptype) + add_executable(test_argutils test_argutils.cpp) target_link_libraries(test_argutils PRIVATE lammps GTest::GMockMain) add_test(NAME ArgUtils COMMAND test_argutils) diff --git a/unittest/utils/test_lmptype.cpp b/unittest/utils/test_lmptype.cpp new file mode 100644 index 0000000000..6db340fddf --- /dev/null +++ b/unittest/utils/test_lmptype.cpp @@ -0,0 +1,84 @@ +/* ---------------------------------------------------------------------- + LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator + https://www.lammps.org/, Sandia National Laboratories + LAMMPS Development team: developers@lammps.org + + 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. +------------------------------------------------------------------------- */ + +#include "lmptype.h" + +#include "gmock/gmock.h" +#include "gtest/gtest.h" + +#include + +using namespace LAMMPS_NS; + +TEST(Types, ubuf) +{ + double buf[3]; + double d1 = 0.1; + int i1 = -10; +#if defined(LAMMPS_SMALLSMALL) + bigint b1 = 2048; +#else + bigint b1 = (1L << 58) + (1L << 50); +#endif + buf[0] = d1; + buf[1] = ubuf(i1).d; + buf[2] = ubuf(b1).d; + + EXPECT_EQ(d1, buf[0]); + EXPECT_EQ(i1, (int)ubuf(buf[1]).i); + EXPECT_EQ(b1, (bigint)ubuf(buf[2]).i); +} + +TEST(Types, multitype) +{ + multitype m[6]; + int64_t b1 = (3L << 48) - 1; + int i1 = 20; + double d1 = 0.1; + + m[0] = b1; + m[1] = i1; + m[2] = d1; + +#if !defined(LAMMPS_SMALLSMALL) + m[3] = -((1L << 40) + (1L << 50)); +#endif + m[4] = -1023; + m[5] = -2.225; + +#if defined(LAMMPS_SMALLSMALL) + EXPECT_EQ(m[0].type, multitype::INT); +#else + EXPECT_EQ(m[0].type, multitype::BIGINT); +#endif + EXPECT_EQ(m[1].type, multitype::INT); + EXPECT_EQ(m[2].type, multitype::DOUBLE); + +#if defined(LAMMPS_SMALLSMALL) + EXPECT_EQ(m[3].type, multitype::NONE); +#else + EXPECT_EQ(m[3].type, multitype::BIGINT); +#endif + EXPECT_EQ(m[4].type, multitype::INT); + EXPECT_EQ(m[5].type, multitype::DOUBLE); + + EXPECT_EQ(m[0].data.b, b1); + EXPECT_EQ(m[1].data.i, i1); + EXPECT_EQ(m[2].data.d, d1); + +#if !defined(LAMMPS_SMALLSMALL) + EXPECT_EQ(m[3].data.b, -((1L << 40) + (1L << 50))); +#endif + EXPECT_EQ(m[4].data.i, -1023); + EXPECT_EQ(m[5].data.d, -2.225); +} From b81b1f5ecc587289538ee24160c6b23e45b92d8e Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Tue, 6 Jun 2023 22:40:13 -0400 Subject: [PATCH 191/396] switch dump yaml/netcdf thermo output to use new caching API. remove old API. --- doc/src/dump_modify.rst | 9 +++-- src/EXTRA-DUMP/dump_yaml.cpp | 31 ++++++++++------- src/NETCDF/dump_netcdf.cpp | 58 ++++++++++++++------------------ src/NETCDF/dump_netcdf_mpiio.cpp | 54 ++++++++++++++--------------- src/thermo.cpp | 17 ++++------ src/thermo.h | 11 +++--- 6 files changed, 87 insertions(+), 93 deletions(-) diff --git a/doc/src/dump_modify.rst b/doc/src/dump_modify.rst index f00cc339cc..89b3766083 100644 --- a/doc/src/dump_modify.rst +++ b/doc/src/dump_modify.rst @@ -753,9 +753,12 @@ run, this option is ignored since the output is already balanced. ---------- The *thermo* keyword only applies the dump styles *netcdf* and *yaml*. -It triggers writing of :doc:`thermo ` information to the dump file -alongside per-atom data. The values included in the dump file are -identical to the values specified by :doc:`thermo_style `. +It triggers writing of :doc:`thermo ` information to the dump +file alongside per-atom data. The values included in the dump file are +cached values from the last thermo output and include the exact same the +values as specified by the :doc:`thermo_style ` command. +Because these are cached values, they are only up-to-date when dump +output is on a timestep that also has thermo output. ---------- diff --git a/src/EXTRA-DUMP/dump_yaml.cpp b/src/EXTRA-DUMP/dump_yaml.cpp index 3c35ec43ba..029415164f 100644 --- a/src/EXTRA-DUMP/dump_yaml.cpp +++ b/src/EXTRA-DUMP/dump_yaml.cpp @@ -60,21 +60,26 @@ void DumpYAML::write_header(bigint ndump) std::string thermo_data; if (thermo) { Thermo *th = output->thermo; - thermo_data += "thermo:\n - keywords: [ "; - for (int i = 0; i < th->nfield; ++i) thermo_data += fmt::format("{}, ", th->keyword[i]); - thermo_data += "]\n - data: [ "; + // output thermo data only on timesteps where it was computed + if (update->ntimestep == th->get_timestep()) { - for (int i = 0; i < th->nfield; ++i) { - th->call_vfunc(i); - if (th->vtype[i] == Thermo::FLOAT) - thermo_data += fmt::format("{}, ", th->dvalue); - else if (th->vtype[i] == Thermo::INT) - thermo_data += fmt::format("{}, ", th->ivalue); - else if (th->vtype[i] == Thermo::BIGINT) - thermo_data += fmt::format("{}, ", th->bivalue); + thermo_data += "thermo:\n - keywords: [ "; + for (auto key : th->get_keywords()) thermo_data += fmt::format("{}, ", key); + thermo_data += "]\n - data: [ "; + + for (auto val : th->get_fields()) { + if (val.type == multitype::DOUBLE) + thermo_data += fmt::format("{}, ", val.data.d); + else if (val.type == multitype::INT) + thermo_data += fmt::format("{}, ", val.data.i); + else if (val.type == multitype::BIGINT) + thermo_data += fmt::format("{}, ", val.data.b); + else + thermo_data += ", "; + } + thermo_data += "]\n"; + MPI_Barrier(world); } - thermo_data += "]\n"; - MPI_Barrier(world); } if (comm->me == 0) { diff --git a/src/NETCDF/dump_netcdf.cpp b/src/NETCDF/dump_netcdf.cpp index 6fecf7f41b..cb6aea16cf 100644 --- a/src/NETCDF/dump_netcdf.cpp +++ b/src/NETCDF/dump_netcdf.cpp @@ -223,7 +223,7 @@ void DumpNetCDF::openfile() if (thermo && !singlefile_opened) { delete[] thermovar; - thermovar = new int[output->thermo->nfield]; + thermovar = new int[output->thermo->get_keywords().size()]; } // now the computes and fixes have been initialized, so we can query @@ -320,9 +320,10 @@ void DumpNetCDF::openfile() // perframe variables if (thermo) { - Thermo *th = output->thermo; - for (int i = 0; i < th->nfield; i++) { - NCERRX( nc_inq_varid(ncid, th->keyword[i].c_str(), &thermovar[i]), th->keyword[i].c_str() ); + auto keywords = output->thermo->get_keywords(); + int nfield = keywords.size(); + for (int i = 0; i < nfield; i++) { + NCERRX( nc_inq_varid(ncid, keywords[i].c_str(), &thermovar[i]), keywords[i].c_str() ); } } @@ -432,22 +433,16 @@ void DumpNetCDF::openfile() // perframe variables if (thermo) { - Thermo *th = output->thermo; - for (int i = 0; i < th->nfield; i++) { - if (th->vtype[i] == Thermo::FLOAT) { - NCERRX( nc_def_var(ncid, th->keyword[i].c_str(), type_nc_real, 1, dims, - &thermovar[i]), th->keyword[i].c_str() ); - } else if (th->vtype[i] == Thermo::INT) { - NCERRX( nc_def_var(ncid, th->keyword[i].c_str(), NC_INT, 1, dims, - &thermovar[i]), th->keyword[i].c_str() ); - } else if (th->vtype[i] == Thermo::BIGINT) { -#if defined(LAMMPS_SMALLBIG) || defined(LAMMPS_BIGBIG) - NCERRX( nc_def_var(ncid, th->keyword[i].c_str(), NC_INT64, 1, dims, - &thermovar[i]), th->keyword[i].c_str() ); -#else - NCERRX( nc_def_var(ncid, th->keyword[i].c_str(), NC_LONG, 1, dims, - &thermovar[i]), th->keyword[i].c_str() ); -#endif + auto fields = output->thermo->get_fields(); + auto keywords = output->thermo->get_keywords(); + int nfield = fields.size(); + for (int i = 0; i < nfield; i++) { + if (fields[i].type == multitype::DOUBLE) { + NCERRX( nc_def_var(ncid, keywords[i].c_str(), type_nc_real, 1, dims, &thermovar[i]), keywords[i].c_str() ); + } else if (fields[i].type == multitype::INT) { + NCERRX( nc_def_var(ncid, keywords[i].c_str(), NC_INT, 1, dims, &thermovar[i]), keywords[i].c_str() ); + } else if (fields[i].type == multitype::BIGINT) { + NCERRX( nc_def_var(ncid, keywords[i].c_str(), NC_INT64, 1, dims, &thermovar[i]), keywords[i].c_str() ); } } } @@ -605,20 +600,17 @@ void DumpNetCDF::write() start[1] = 0; if (thermo) { - Thermo *th = output->thermo; - for (int i = 0; i < th->nfield; i++) { - th->call_vfunc(i); + auto keywords = output->thermo->get_keywords(); + auto fields = output->thermo->get_fields(); + int nfield = fields.size(); + for (int i = 0; i < nfield; i++) { if (filewriter) { - if (th->vtype[i] == Thermo::FLOAT) { - NCERRX( nc_put_var1_double(ncid, thermovar[i], start, - &th->dvalue), - th->keyword[i].c_str() ); - } else if (th->vtype[i] == Thermo::INT) { - NCERRX( nc_put_var1_int(ncid, thermovar[i], start, &th->ivalue), - th->keyword[i].c_str() ); - } else if (th->vtype[i] == Thermo::BIGINT) { - NCERRX( nc_put_var1_bigint(ncid, thermovar[i], start, &th->bivalue), - th->keyword[i].c_str() ); + if (fields[i].type == multitype::DOUBLE) { + NCERRX( nc_put_var1_double(ncid, thermovar[i], start, &fields[i].data.d), keywords[i].c_str() ); + } else if (fields[i].type == multitype::INT) { + NCERRX( nc_put_var1_int(ncid, thermovar[i], start, &fields[i].data.i), keywords[i].c_str() ); + } else if (fields[i].type == multitype::BIGINT) { + NCERRX( nc_put_var1_bigint(ncid, thermovar[i], start, &fields[i].data.b), keywords[i].c_str() ); } } } diff --git a/src/NETCDF/dump_netcdf_mpiio.cpp b/src/NETCDF/dump_netcdf_mpiio.cpp index 0282903d77..fdcd03470e 100644 --- a/src/NETCDF/dump_netcdf_mpiio.cpp +++ b/src/NETCDF/dump_netcdf_mpiio.cpp @@ -220,7 +220,7 @@ void DumpNetCDFMPIIO::openfile() if (thermo && !singlefile_opened) { delete[] thermovar; - thermovar = new int[output->thermo->nfield]; + thermovar = new int[output->thermo->get_keywords().size()]; } // now the computes and fixes have been initialized, so we can query @@ -318,9 +318,10 @@ void DumpNetCDFMPIIO::openfile() // perframe variables if (thermo) { - Thermo *th = output->thermo; - for (int i = 0; i < th->nfield; i++) { - NCERRX( ncmpi_inq_varid(ncid, th->keyword[i].c_str(), &thermovar[i]), th->keyword[i].c_str() ); + auto keywords = output->thermo->get_keywords(); + int nfield = keywords.size(); + for (int i = 0; i < nfield; i++) { + NCERRX( ncmpi_inq_varid(ncid, keywords[i].c_str(), &thermovar[i]), keywords[i].c_str() ); } } @@ -422,18 +423,16 @@ void DumpNetCDFMPIIO::openfile() // perframe variables if (thermo) { - Thermo *th = output->thermo; - for (int i = 0; i < th->nfield; i++) { - if (th->vtype[i] == Thermo::FLOAT) { - NCERRX( ncmpi_def_var(ncid, th->keyword[i].c_str(), type_nc_real, 1, dims, &thermovar[i]), th->keyword[i].c_str() ); - } else if (th->vtype[i] == Thermo::INT) { - NCERRX( ncmpi_def_var(ncid, th->keyword[i].c_str(), NC_INT, 1, dims, &thermovar[i]), th->keyword[i].c_str() ); - } else if (th->vtype[i] == Thermo::BIGINT) { -#if defined(LAMMPS_SMALLBIG) || defined(LAMMPS_BIGBIG) - NCERRX( ncmpi_def_var(ncid, th->keyword[i].c_str(), NC_INT64, 1, dims, &thermovar[i]), th->keyword[i].c_str() ); -#else - NCERRX( ncmpi_def_var(ncid, th->keyword[i].c_str(), NC_LONG, 1, dims, &thermovar[i]), th->keyword[i].c_str() ); -#endif + auto fields = output->thermo->get_fields(); + auto keywords = output->thermo->get_keywords(); + int nfield = fields.size(); + for (int i = 0; i < nfield; i++) { + if (fields[i].type == multitype::DOUBLE) { + NCERRX( ncmpi_def_var(ncid, keywords[i].c_str(), type_nc_real, 1, dims, &thermovar[i]), keywords[i].c_str() ); + } else if (fields[i].type == multitype::INT) { + NCERRX( ncmpi_def_var(ncid, keywords[i].c_str(), NC_INT, 1, dims, &thermovar[i]), keywords[i].c_str() ); + } else if (fields[i].type == multitype::BIGINT) { + NCERRX( ncmpi_def_var(ncid, keywords[i].c_str(), NC_INT64, 1, dims, &thermovar[i]), keywords[i].c_str() ); } } } @@ -594,20 +593,17 @@ void DumpNetCDFMPIIO::write() NCERR( ncmpi_begin_indep_data(ncid) ); if (thermo) { - Thermo *th = output->thermo; - for (int i = 0; i < th->nfield; i++) { - th->call_vfunc(i); + auto keywords = output->thermo->get_keywords(); + auto fields = output->thermo->get_fields(); + int nfield = fields.size(); + for (int i = 0; i < nfield; i++) { if (filewriter) { - if (th->vtype[i] == Thermo::FLOAT) { - NCERRX( ncmpi_put_var1_double(ncid, thermovar[i], start, - &th->dvalue), - th->keyword[i].c_str() ); - } else if (th->vtype[i] == Thermo::INT) { - NCERRX( ncmpi_put_var1_int(ncid, thermovar[i], start, &th->ivalue), - th->keyword[i].c_str() ); - } else if (th->vtype[i] == Thermo::BIGINT) { - NCERRX( ncmpi_put_var1_bigint(ncid, thermovar[i], start, &th->bivalue), - th->keyword[i].c_str() ); + if (fields[i].type == multitype::DOUBLE) { + NCERRX( ncmpi_put_var1_double(ncid, thermovar[i], start, &fields[i].data.d), keywords[i].c_str() ); + } else if (fields[i].type == multitype::INT) { + NCERRX( ncmpi_put_var1_int(ncid, thermovar[i], start, &fields[i].data.i), keywords[i].c_str() ); + } else if (fields[i].type == multitype::BIGINT) { + NCERRX( ncmpi_put_var1_bigint(ncid, thermovar[i], start, &fields[i].data.b), keywords[i].c_str() ); } } } diff --git a/src/thermo.cpp b/src/thermo.cpp index 0503018a3a..31c19fbdc2 100644 --- a/src/thermo.cpp +++ b/src/thermo.cpp @@ -361,7 +361,7 @@ void Thermo::compute(int flag) int i; firststep = flag; - bigint ntimestep = update->ntimestep; + ntimestep = update->ntimestep; // check for lost atoms // turn off normflag if natoms = 0 to avoid divide by 0 @@ -405,18 +405,23 @@ void Thermo::compute(int flag) } // add each thermo value to line with its specific format + field_data.clear(); + field_data.resize(nfield); for (ifield = 0; ifield < nfield; ifield++) { (this->*vfunc[ifield])(); if (vtype[ifield] == FLOAT) { snprintf(fmtbuf, sizeof(fmtbuf), format[ifield].c_str(), dvalue); line += fmtbuf; + field_data[ifield] = dvalue; } else if (vtype[ifield] == INT) { snprintf(fmtbuf, sizeof(fmtbuf), format[ifield].c_str(), ivalue); line += fmtbuf; + field_data[ifield] = ivalue; } else if (vtype[ifield] == BIGINT) { snprintf(fmtbuf, sizeof(fmtbuf), format[ifield].c_str(), bivalue); line += fmtbuf; + field_data[ifield] = bivalue; } } @@ -433,16 +438,6 @@ void Thermo::compute(int flag) firststep = 1; } -/* ---------------------------------------------------------------------- - call function to compute property -------------------------------------------------------------------------- */ - -void Thermo::call_vfunc(int ifield_in) -{ - ifield = ifield_in; - (this->*vfunc[ifield])(); -} - /* ---------------------------------------------------------------------- check for lost atoms, return current number of atoms also could number of warnings across MPI ranks and update total diff --git a/src/thermo.h b/src/thermo.h index eaec3eb9f8..8a5cba29d7 100644 --- a/src/thermo.h +++ b/src/thermo.h @@ -21,9 +21,6 @@ namespace LAMMPS_NS { class Thermo : protected Pointers { friend class MinCG; // accesses compute_pe - friend class DumpNetCDF; // accesses thermo properties - friend class DumpNetCDFMPIIO; // accesses thermo properties - friend class DumpYAML; // accesses thermo properties public: char *style; @@ -45,6 +42,11 @@ class Thermo : protected Pointers { void compute(int); int evaluate_keyword(const std::string &, double *); + // for accessing cached thermo data + bigint get_timestep() const { return ntimestep; } + const std::vector &get_fields() const { return field_data; } + const std::vector &get_keywords() const { return keyword; } + private: int nfield, nfield_initial; int *vtype; @@ -52,6 +54,7 @@ class Thermo : protected Pointers { std::vector keyword, format, format_column_user, keyword_user; std::string format_line_user, format_float_user, format_int_user, format_bigint_user; std::map key2col; + std::vector field_data; int normvalue; // use this for normflag unless natoms = 0 int normuserflag; // 0 if user has not set, 1 if has @@ -66,6 +69,7 @@ class Thermo : protected Pointers { bigint last_step; bigint natoms; + bigint ntimestep; // data used by routines that compute single values int ivalue; // integer value to print @@ -114,7 +118,6 @@ class Thermo : protected Pointers { typedef void (Thermo::*FnPtr)(); void addfield(const char *, FnPtr, int); FnPtr *vfunc; // list of ptrs to functions - void call_vfunc(int ifield); void compute_compute(); // functions that compute a single value void compute_fix(); // via calls to Compute,Fix,Variable classes From bbfd909be64c3d6836f22d07c5049e9600a279ff Mon Sep 17 00:00:00 2001 From: "W. Michael Brown" Date: Tue, 6 Jun 2023 23:56:16 -0700 Subject: [PATCH 192/396] Adding redundant call to sync Intel package arrays with native arrays for methods such as MC that do not need pre_reverse. --- src/INTEL/fix_intel.cpp | 22 +++++++++++++--------- src/INTEL/fix_intel.h | 2 +- src/MC/fix_gcmc.cpp | 6 ------ src/MC/fix_widom.cpp | 8 +------- 4 files changed, 15 insertions(+), 23 deletions(-) diff --git a/src/INTEL/fix_intel.cpp b/src/INTEL/fix_intel.cpp index 1ce0b41338..89775108cb 100644 --- a/src/INTEL/fix_intel.cpp +++ b/src/INTEL/fix_intel.cpp @@ -275,10 +275,8 @@ int FixIntel::setmask() int mask = 0; mask |= PRE_REVERSE; mask |= MIN_PRE_REVERSE; - #ifdef _LMP_INTEL_OFFLOAD mask |= POST_FORCE; mask |= MIN_POST_FORCE; - #endif mask |= POST_RUN; return mask; } @@ -597,6 +595,19 @@ void FixIntel::pre_reverse(int /*eflag*/, int /*vflag*/) /* ---------------------------------------------------------------------- */ +void FixIntel::post_force(int vflag) +{ + // Redundant call to sync Intel data structs with native for methods that + // call force compute but do not call prereverse + _sync_main_arrays(1); + + #ifdef LMP_INTEL_OFFLOAD + if (_sync_mode == 2) sync_coprocessor(); + #endif +} + +/* ---------------------------------------------------------------------- */ + template void FixIntel::reduce_results(acc_t * _noalias const f_scalar) { @@ -883,13 +894,6 @@ double FixIntel::memory_usage() /* ---------------------------------------------------------------------- */ -void FixIntel::post_force(int vflag) -{ - if (_sync_mode == 2) sync_coprocessor(); -} - -/* ---------------------------------------------------------------------- */ - template void FixIntel::add_off_results(const ft * _noalias const f_in, const acc_t * _noalias const ev_global) { diff --git a/src/INTEL/fix_intel.h b/src/INTEL/fix_intel.h index 9214fe3419..1960a6d802 100644 --- a/src/INTEL/fix_intel.h +++ b/src/INTEL/fix_intel.h @@ -55,6 +55,7 @@ class FixIntel : public Fix { void pre_reverse(int eflag = 0, int vflag = 0) override; inline void min_pre_reverse(int eflag = 0, int vflag = 0) override { pre_reverse(eflag, vflag); } + void post_force(int vflag) override; void post_run() override { _print_pkg_info = 1; } // Get all forces, calculation results from coprocesser @@ -132,7 +133,6 @@ class FixIntel : public Fix { inline void get_buffern(const int offload, int &nlocal, int &nall, int &minlocal); #ifdef _LMP_INTEL_OFFLOAD - void post_force(int vflag); inline int coprocessor_number() { return _cop; } inline int full_host_list() { return _full_host_list; } void set_offload_affinity(); diff --git a/src/MC/fix_gcmc.cpp b/src/MC/fix_gcmc.cpp index 634b512936..21fb4431e1 100644 --- a/src/MC/fix_gcmc.cpp +++ b/src/MC/fix_gcmc.cpp @@ -2352,12 +2352,6 @@ double FixGCMC::energy_full() if (force->kspace) force->kspace->compute(eflag,vflag); - // unlike Verlet, not performing a reverse_comm() or forces here - // b/c GCMC does not care about forces - // don't think it will mess up energy due to any post_force() fixes - // but Modify::pre_reverse() is needed for INTEL - - if (modify->n_pre_reverse) modify->pre_reverse(eflag,vflag); if (modify->n_post_force_any) modify->post_force(vflag); // NOTE: all fixes with energy_global_flag set and which diff --git a/src/MC/fix_widom.cpp b/src/MC/fix_widom.cpp index a98f29da5e..cc2f1bc94d 100644 --- a/src/MC/fix_widom.cpp +++ b/src/MC/fix_widom.cpp @@ -1050,13 +1050,7 @@ double FixWidom::energy_full() if (force->kspace) force->kspace->compute(eflag,vflag); - // unlike Verlet, not performing a reverse_comm() or forces here - // b/c Widom does not care about forces - // don't think it will mess up energy due to any post_force() fixes - // but Modify::pre_reverse() is needed for INTEL - - if (modify->n_pre_reverse) modify->pre_reverse(eflag,vflag); - if (modify->n_pre_force) modify->pre_force(vflag); + if (modify->n_post_force_any) modify->post_force(vflag); // NOTE: all fixes with energy_global_flag set and which // operate at pre_force() or post_force() From 6c7a5d2f1efc77fcdf33ee30214a4faa6e0f9215 Mon Sep 17 00:00:00 2001 From: "W. Michael Brown" Date: Tue, 6 Jun 2023 23:56:31 -0700 Subject: [PATCH 193/396] Using bigint for Intel package neighbor overflow detection for large local sizes. --- src/INTEL/npair_full_bin_ghost_intel.cpp | 7 ++++--- src/INTEL/npair_intel.cpp | 9 +++++---- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/src/INTEL/npair_full_bin_ghost_intel.cpp b/src/INTEL/npair_full_bin_ghost_intel.cpp index b7b9ee4aea..381db62c08 100644 --- a/src/INTEL/npair_full_bin_ghost_intel.cpp +++ b/src/INTEL/npair_full_bin_ghost_intel.cpp @@ -292,12 +292,13 @@ void NPairFullBinGhostIntel::fbi(const int offload, NeighList * list, else ito -= wlocal - nlocal; int e_ito = ito; - const int list_size = (e_ito + tid * 2 + 2) * maxnbors; + const bigint list_size = (bigint)(e_ito + tid * 2 + 2) * + (bigint)maxnbors; int pack_offset = maxnbors; - int ct = (ifrom + tid * 2) * maxnbors; + bigint ct = (bigint)(ifrom + tid * 2) * (bigint)maxnbors; int * _noalias neighptr = intel_list + ct; - const int obound = pack_offset + maxnbors * 2; + const bigint obound = pack_offset + maxnbors * 2; const int toffs = tid * ncache_stride; flt_t * _noalias const tx = ncachex + toffs; diff --git a/src/INTEL/npair_intel.cpp b/src/INTEL/npair_intel.cpp index b85873f677..8b05aa38aa 100644 --- a/src/INTEL/npair_intel.cpp +++ b/src/INTEL/npair_intel.cpp @@ -287,16 +287,17 @@ void NPairIntel::bin_newton(const int offload, NeighList *list, if (imod) e_ito += pack_width - imod; } #endif - const int list_size = (e_ito + tid * 2 + 2) * maxnbors; + const bigint list_size = (bigint)(e_ito + tid * 2 + 2) * + (bigint)maxnbors; #ifdef LMP_INTEL_3BODY_FAST const int pack_offset = maxnbors * pack_width; - const int obound = pack_offset + maxnbors * 2; + const bigint obound = pack_offset + maxnbors * 2; #else const int pack_offset = 0; - const int obound = maxnbors * 3; + const bigint obound = maxnbors * 3; #endif - int ct = (ifrom + tid * 2) * maxnbors; + bigint ct = (bigint)(ifrom + tid * 2) * (bigint)maxnbors; int * _noalias neighptr = intel_list + ct; int * _noalias neighptr2; if (THREE) neighptr2 = neighptr; From 0f925f7a39ea4fccd20e5bd35cf81dc56dd00296 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Wed, 7 Jun 2023 04:33:08 -0400 Subject: [PATCH 194/396] reformat, add versionadded marker --- doc/src/compute_stress_mop.rst | 123 ++++++++++++++++++--------------- 1 file changed, 69 insertions(+), 54 deletions(-) diff --git a/doc/src/compute_stress_mop.rst b/doc/src/compute_stress_mop.rst index 7ab8c58a76..5662fc76d4 100644 --- a/doc/src/compute_stress_mop.rst +++ b/doc/src/compute_stress_mop.rst @@ -45,92 +45,107 @@ Examples Description """"""""""" -Compute *stress/mop* and compute *stress/mop/profile* define computations that -calculate components of the local stress tensor using the method of -planes :ref:`(Todd) `. Specifically in compute *stress/mop* calculates 3 -components are computed in directions *dir*,\ *x*\ ; *dir*,\ *y*\ ; and -*dir*,\ *z*\ ; where *dir* is the direction normal to the plane, while -in compute *stress/mop/profile* the profile of the stress is computed. +Compute *stress/mop* and compute *stress/mop/profile* define +computations that calculate components of the local stress tensor using +the method of planes :ref:`(Todd) `. Specifically in compute +*stress/mop* calculates 3 components are computed in directions *dir*,\ +*x*\ ; *dir*,\ *y*\ ; and *dir*,\ *z*\ ; where *dir* is the direction +normal to the plane, while in compute *stress/mop/profile* the profile +of the stress is computed. Contrary to methods based on histograms of atomic stress (i.e., using -:doc:`compute stress/atom `), the method of planes is -compatible with mechanical balance in heterogeneous systems and at +:doc:`compute stress/atom `), the method of planes +is compatible with mechanical balance in heterogeneous systems and at interfaces :ref:`(Todd) `. The stress tensor is the sum of a kinetic term and a configurational term, which are given respectively by Eq. (21) and Eq. (16) in -:ref:`(Todd) `. For the kinetic part, the algorithm considers that -atoms have crossed the plane if their positions at times :math:`t-\Delta t` -and :math:`t` are one on either side of the plane, and uses the velocity at -time :math:`t-\Delta t/2` given by the velocity Verlet algorithm. +:ref:`(Todd) `. For the kinetic part, the algorithm considers +that atoms have crossed the plane if their positions at times +:math:`t-\Delta t` and :math:`t` are one on either side of the plane, +and uses the velocity at time :math:`t-\Delta t/2` given by the velocity +Verlet algorithm. -Between one and six keywords can be used to indicate which -contributions to the stress must be computed: total stress (total), kinetic stress (kin), -configurational stress (conf), stress due to bond stretching (bond), -stress due to angle bending (angle) and/or due to pairwise non-bonded interactions (pair). -The angle keyword is currently available only for the stress/mop command and not the stress/mop/profile. +.. versionadded:: TBD -NOTE 1: The configurational stress is computed considering all pairs of atoms where at least one atom belongs to group group-ID. + contributions from bond and angle potentials + +Between one and six keywords can be used to indicate which contributions +to the stress must be computed: total stress (total), kinetic stress +(kin), configurational stress (conf), stress due to bond stretching +(bond), stress due to angle bending (angle) and/or due to pairwise +non-bonded interactions (pair). The angle keyword is currently +available only for the *stress/mop* command and **not** the +*stress/mop/profile* command. + +NOTE 1: The configurational stress is computed considering all pairs of +atoms where at least one atom belongs to group group-ID. NOTE 2: The local stress does not include any Lennard-Jones tail -corrections to the stress added by the :doc:`pair_modify tail yes ` -command, since those are contributions to the global system pressure. +corrections to the stress added by the :doc:`pair_modify tail yes +` command, since those are contributions to the global +system pressure. -NOTE 3: The local stress profile generated by compute *stress/mop/profile* -is similar to that obtained by compute -:doc:`stress/cartesian `. -A key difference is that compute *stress/mop/profile* considers particles -crossing a set of planes, while compute *stress/cartesian* computes averages -for a set of small volumes. More information -on the similarities and differences can be found in -:ref:`(Ikeshoji)`. +NOTE 3: The local stress profile generated by compute +*stress/mop/profile* is similar to that obtained by compute +:doc:`stress/cartesian `. A key difference is +that compute *stress/mop/profile* considers particles crossing a set of +planes, while compute *stress/cartesian* computes averages for a set of +small volumes. More information on the similarities and differences can +be found in :ref:`(Ikeshoji)`. Output info """"""""""" -Compute *stress/mop* calculates a global vector (indices starting at 1), with 3 -values for each declared keyword (in the order the keywords have been -declared). For each keyword, the stress tensor components are ordered as -follows: stress_dir,x, stress_dir,y, and stress_dir,z. +Compute *stress/mop* calculates a global vector (indices starting at 1), +with 3 values for each declared keyword (in the order the keywords have +been declared). For each keyword, the stress tensor components are +ordered as follows: stress_dir,x, stress_dir,y, and stress_dir,z. -Compute *stress/mop/profile* instead calculates a global array, with 1 column -giving the position of the planes where the stress tensor was computed, -and with 3 columns of values for each declared keyword (in the order the -keywords have been declared). For each keyword, the profiles of stress -tensor components are ordered as follows: stress_dir,x; stress_dir,y; -and stress_dir,z. +Compute *stress/mop/profile* instead calculates a global array, with 1 +column giving the position of the planes where the stress tensor was +computed, and with 3 columns of values for each declared keyword (in the +order the keywords have been declared). For each keyword, the profiles +of stress tensor components are ordered as follows: stress_dir,x; +stress_dir,y; and stress_dir,z. The values are in pressure :doc:`units `. -The values produced by this compute can be accessed by various :doc:`output commands `. -For instance, the results can be written to a file using the -:doc:`fix ave/time ` command. Please see the example -in the examples/PACKAGES/mop folder. +The values produced by this compute can be accessed by various +:doc:`output commands `. For instance, the results can be +written to a file using the :doc:`fix ave/time ` +command. Please see the example in the examples/PACKAGES/mop folder. Restrictions """""""""""" -These styles are part of the EXTRA-COMPUTE package. They are only enabled if -LAMMPS is built with that package. See the :doc:`Build package ` -doc page on for more info. +These styles are part of the EXTRA-COMPUTE package. They are only +enabled if LAMMPS is built with that package. See the :doc:`Build +package ` doc page on for more info. The method is only implemented for 3d orthogonal simulation boxes whose size does not change in time, and axis-aligned planes. The method only works with two-body pair interactions, because it -requires the class method pair->single() to be implemented. In -particular, compute *stress/mop/profile* does not work with more than -two-body pair interactions, long range (kspace) interactions and angle/dihedral/improper -intramolecular interactions. Similarly, compute *stress/mop* does not work with more than -two-body pair interactions, long range (kspace) interactions and dihedral/improper -intramolecular interactions but works with all bond interactions with the class method -single() implemented and all angle interactions with the class method born_matrix() -implemented. +requires the class method ``Pair::single()`` to be implemented, which is +not possible for manybody potentials. In particular, compute +*stress/mop/profile* does not work with more than two-body pair +interactions, long range (kspace) interactions and +angle/dihedral/improper intramolecular interactions. Similarly, compute +*stress/mop* does not work with more than two-body pair interactions, +long range (kspace) interactions and dihedral/improper intramolecular +interactions but works with all bond interactions with the class method +single() implemented and all angle interactions with the class method +born_matrix() implemented. Related commands """""""""""""""" -:doc:`compute stress/atom `, :doc:`compute pressure `, :doc:`compute stress/cartesian `, :doc:`compute stress/cylinder `, :doc:`compute stress/spherical ` +:doc:`compute stress/atom `, +:doc:`compute pressure `, +:doc:`compute stress/cartesian `, +:doc:`compute stress/cylinder `, +:doc:`compute stress/spherical ` Default """"""" From 045b230587c3fcf1eb4ea7a0fcf00f0f08b1d19c Mon Sep 17 00:00:00 2001 From: Lars Veldscholte Date: Wed, 7 Jun 2023 10:43:57 +0200 Subject: [PATCH 195/396] Fix shifted coordinates: Add `boxlo` to the bin centers --- src/EXTRA-COMPUTE/compute_stress_cartesian.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/EXTRA-COMPUTE/compute_stress_cartesian.cpp b/src/EXTRA-COMPUTE/compute_stress_cartesian.cpp index 106ffef8fb..0aae797111 100644 --- a/src/EXTRA-COMPUTE/compute_stress_cartesian.cpp +++ b/src/EXTRA-COMPUTE/compute_stress_cartesian.cpp @@ -399,8 +399,8 @@ void ComputeStressCartesian::compute_array() // populate array to output. for (int bin = 0; bin < nbins1 * nbins2; bin++) { - array[bin][0] = (bin % nbins1 + 0.5) * bin_width1; - if (dims == 2) array[bin][1] = ((int) (bin / nbins1) + 0.5) * bin_width2; + array[bin][0] = (bin % nbins1 + 0.5) * bin_width1 + boxlo[dir1]; + if (dims == 2) array[bin][1] = ((int) (bin / nbins1) + 0.5) * bin_width2 + boxlo[dir2]; array[bin][0 + dims] = dens[bin]; array[bin][1 + dims] = pkxx[bin]; array[bin][2 + dims] = pkyy[bin]; From 53b1af7720c9246eec9cbadf6ef0cb39bcc30fad Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Wed, 7 Jun 2023 05:11:53 -0400 Subject: [PATCH 196/396] LAMMPS programming style/conventions updates --- src/EXTRA-COMPUTE/compute_stress_mop.cpp | 171 ++++++++---------- src/EXTRA-COMPUTE/compute_stress_mop.h | 2 +- .../compute_stress_mop_profile.cpp | 96 +++++----- .../compute_stress_mop_profile.h | 2 +- 4 files changed, 126 insertions(+), 145 deletions(-) diff --git a/src/EXTRA-COMPUTE/compute_stress_mop.cpp b/src/EXTRA-COMPUTE/compute_stress_mop.cpp index e5d0e2ed13..98e3bf7043 100644 --- a/src/EXTRA-COMPUTE/compute_stress_mop.cpp +++ b/src/EXTRA-COMPUTE/compute_stress_mop.cpp @@ -1,4 +1,3 @@ -// clang-format off /* ---------------------------------------------------------------------- LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator https://www.lammps.org/, Sandia National Laboratories @@ -14,6 +13,7 @@ /*------------------------------------------------------------------------ Contributing Authors : Romain Vermorel (LFCR), Laurent Joly (ULyon) + Support for bonds and angles added by : Evangelos Voyiatzis (NovaMechanics) --------------------------------------------------------------------------*/ #include "compute_stress_mop.h" @@ -22,6 +22,7 @@ #include "atom.h" #include "atom_vec.h" #include "bond.h" +#include "comm.h" #include "domain.h" #include "error.h" #include "force.h" @@ -37,50 +38,49 @@ using namespace LAMMPS_NS; -enum{X,Y,Z}; -enum{TOTAL,CONF,KIN,PAIR,BOND,ANGLE}; +enum { X, Y, Z }; +enum { TOTAL, CONF, KIN, PAIR, BOND, ANGLE }; +// clang-format off /* ---------------------------------------------------------------------- */ ComputeStressMop::ComputeStressMop(LAMMPS *lmp, int narg, char **arg) : Compute(lmp, narg, arg) { - if (narg < 6) error->all(FLERR,"Illegal compute stress/mop command"); - - MPI_Comm_rank(world,&me); + if (narg < 6) utils::missing_cmd_args(FLERR, "compute stress/mop", error); bondflag = 0; angleflag = 0; // set compute mode and direction of plane(s) for pressure calculation - if (strcmp(arg[3],"x")==0) { + if (strcmp(arg[3],"x") == 0) { dir = X; - } else if (strcmp(arg[3],"y")==0) { + } else if (strcmp(arg[3],"y") == 0) { dir = Y; - } else if (strcmp(arg[3],"z")==0) { + } else if (strcmp(arg[3],"z") == 0) { dir = Z; } else error->all(FLERR,"Illegal compute stress/mop command"); // Position of the plane - if (strcmp(arg[4],"lower")==0) { + if (strcmp(arg[4],"lower") == 0) { pos = domain->boxlo[dir]; - } else if (strcmp(arg[4],"upper")==0) { + } else if (strcmp(arg[4],"upper") == 0) { pos = domain->boxhi[dir]; - } else if (strcmp(arg[4],"center")==0) { + } else if (strcmp(arg[4],"center") == 0) { pos = 0.5*(domain->boxlo[dir]+domain->boxhi[dir]); } else pos = utils::numeric(FLERR,arg[4],false,lmp); // plane inside the box - if (pos >domain->boxhi[dir] || pos boxlo[dir]) { - error->warning(FLERR,"The specified initial plane lies outside of the simulation box"); - double dx[3] {0}; + if ((pos > domain->boxhi[dir]) || (pos < domain->boxlo[dir])) { + error->warning(FLERR, "The specified initial plane lies outside of the simulation box"); + double dx[3] = {0.0, 0.0, 0.0}; dx[dir] = pos - 0.5*(domain->boxhi[dir] + domain->boxlo[dir]); domain->minimum_image(dx[0], dx[1], dx[2]); pos = 0.5*(domain->boxhi[dir] + domain->boxlo[dir]) + dx[dir]; - if (pos >domain->boxhi[dir] || pos boxlo[dir]) + if ((pos > domain->boxhi[dir]) || (pos < domain->boxlo[dir])) error->all(FLERR, "Plane for compute stress/mop is out of bounds"); } @@ -133,15 +133,15 @@ ComputeStressMop::ComputeStressMop(LAMMPS *lmp, int narg, char **arg) : iarg++; } - // Error check + // Error checks // 3D only - if (domain->dimension < 3) - error->all(FLERR, "Compute stress/mop incompatible with simulation dimension"); + if (domain->dimension != 3) + error->all(FLERR, "Compute stress/mop requires a 3d system"); // orthogonal simulation box if (domain->triclinic != 0) - error->all(FLERR, "Compute stress/mop incompatible with triclinic simulation box"); + error->all(FLERR, "Compute stress/mop is incompatible with triclinic simulation box"); // Initialize some variables @@ -154,12 +154,12 @@ ComputeStressMop::ComputeStressMop(LAMMPS *lmp, int narg, char **arg) : // this fix produces a global vector memory->create(vector,nvalues,"stress/mop:vector"); - memory->create(values_local,nvalues,"stress/mop/spatial:values_local"); - memory->create(values_global,nvalues,"stress/mop/spatial:values_global"); - memory->create(bond_local,nvalues,"stress/mop/spatial:bond_local"); - memory->create(bond_global,nvalues,"stress/mop/spatial:bond_global"); - memory->create(angle_local,nvalues,"stress/mop/spatial:angle_local"); - memory->create(angle_global,nvalues,"stress/mop/spatial:angle_global"); + memory->create(values_local,nvalues,"stress/mop:values_local"); + memory->create(values_global,nvalues,"stress/mop:values_global"); + memory->create(bond_local,nvalues,"stress/mop:bond_local"); + memory->create(bond_global,nvalues,"stress/mop:bond_global"); + memory->create(angle_local,nvalues,"stress/mop:angle_local"); + memory->create(angle_global,nvalues,"stress/mop:angle_global"); size_vector = nvalues; vector_flag = 1; @@ -171,8 +171,7 @@ ComputeStressMop::ComputeStressMop(LAMMPS *lmp, int narg, char **arg) : ComputeStressMop::~ComputeStressMop() { - - delete [] which; + delete[] which; memory->destroy(values_local); memory->destroy(values_global); @@ -209,36 +208,39 @@ void ComputeStressMop::init() // Compute stress/mop requires fixed simulation box if (domain->box_change_size || domain->box_change_shape || domain->deform_flag) - error->all(FLERR, "Compute stress/mop requires a fixed simulation box"); + error->all(FLERR, "Compute stress/mop requires a fixed size simulation box"); // This compute requires a pair style with pair_single method implemented - if (force->pair == nullptr) + if (!force->pair) error->all(FLERR,"No pair style is defined for compute stress/mop"); if (force->pair->single_enable == 0) error->all(FLERR,"Pair style does not support compute stress/mop"); // Errors - if (me==0) { + if (comm->me == 0) { // issue an error for unimplemented intramolecular potentials or Kspace. - if (force->bond!=nullptr) bondflag = 1; - if (force->angle!=nullptr) + if (force->bond) bondflag = 1; + if (force->angle) { if (force->angle->born_matrix_enable == 0) { if ((strcmp(force->angle_style, "zero") != 0) && (strcmp(force->angle_style, "none") != 0)) error->all(FLERR,"compute stress/mop does not account for angle potentials"); } else { angleflag = 1; } - if (force->dihedral!=nullptr) + } + if (force->dihedral) { if ((strcmp(force->dihedral_style, "zero") != 0) && (strcmp(force->dihedral_style, "none") != 0)) error->all(FLERR,"compute stress/mop does not account for dihedral potentials"); - if (force->improper!=nullptr) + } + if (force->improper) { if ((strcmp(force->improper_style, "zero") != 0) && (strcmp(force->improper_style, "none") != 0)) error->all(FLERR,"compute stress/mop does not account for improper potentials"); - if (force->kspace!=nullptr) + } + if (force->kspace) error->warning(FLERR,"compute stress/mop does not account for kspace contributions"); } @@ -266,8 +268,7 @@ void ComputeStressMop::compute_vector() compute_pairs(); // sum pressure contributions over all procs - MPI_Allreduce(values_local,values_global,nvalues, - MPI_DOUBLE,MPI_SUM,world); + MPI_Allreduce(values_local,values_global,nvalues,MPI_DOUBLE,MPI_SUM,world); if (bondflag) { //Compute bond contribution on separate procs @@ -292,7 +293,6 @@ void ComputeStressMop::compute_vector() for (int m=0; mpos) && (xj[dir]pos1) && (xj[dir] pos) && (xj[dir] < pos)) || ((xi[dir] > pos1) && (xj[dir] < pos1))) { pair->single(i,j,itype,jtype,rsq,factor_coul,factor_lj,fpair); - values_local[m] += fpair*(xi[0]-xj[0])/area*nktv2p; values_local[m+1] += fpair*(xi[1]-xj[1])/area*nktv2p; values_local[m+2] += fpair*(xi[2]-xj[2])/area*nktv2p; - } - else if (((xi[dir]pos)) || ((xi[dir]pos1))) { - + } else if (((xi[dir] < pos) && (xj[dir] > pos)) || ((xi[dir] < pos1) && (xj[dir] > pos1))) { pair->single(i,j,itype,jtype,rsq,factor_coul,factor_lj,fpair); - values_local[m] -= fpair*(xi[0]-xj[0])/area*nktv2p; values_local[m+1] -= fpair*(xi[1]-xj[1])/area*nktv2p; values_local[m+2] -= fpair*(xi[2]-xj[2])/area*nktv2p; } - } else { - - if (((xi[dir]>pos) && (xj[dir]pos1) && (xj[dir] pos) && (xj[dir] < pos)) || ((xi[dir] > pos1) && (xj[dir] < pos1))) { pair->single(i,j,itype,jtype,rsq,factor_coul,factor_lj,fpair); - values_local[m] += fpair*(xi[0]-xj[0])/area*nktv2p; values_local[m+1] += fpair*(xi[1]-xj[1])/area*nktv2p; values_local[m+2] += fpair*(xi[2]-xj[2])/area*nktv2p; } - } - } - } - } // Compute kinetic contribution to pressure // counts local particles transfers across the plane - if (which[m] == KIN || which[m] == TOTAL) { + if ((which[m] == KIN) || (which[m] == TOTAL)) { double sgn; for (int i = 0; i < nlocal; i++) { @@ -447,13 +434,13 @@ void ComputeStressMop::compute_pairs() //coordinates at t-dt (based on Velocity-Verlet alg.) if (rmass) { - xj[0] = xi[0]-vi[0]*dt+fi[0]/2/rmass[i]*dt*dt*ftm2v; - xj[1] = xi[1]-vi[1]*dt+fi[1]/2/rmass[i]*dt*dt*ftm2v; - xj[2] = xi[2]-vi[2]*dt+fi[2]/2/rmass[i]*dt*dt*ftm2v; + xj[0] = xi[0]-vi[0]*dt+fi[0]/2.0/rmass[i]*dt*dt*ftm2v; + xj[1] = xi[1]-vi[1]*dt+fi[1]/2.0/rmass[i]*dt*dt*ftm2v; + xj[2] = xi[2]-vi[2]*dt+fi[2]/2.0/rmass[i]*dt*dt*ftm2v; } else { - xj[0] = xi[0]-vi[0]*dt+fi[0]/2/mass[itype]*dt*dt*ftm2v; - xj[1] = xi[1]-vi[1]*dt+fi[1]/2/mass[itype]*dt*dt*ftm2v; - xj[2] = xi[2]-vi[2]*dt+fi[2]/2/mass[itype]*dt*dt*ftm2v; + xj[0] = xi[0]-vi[0]*dt+fi[0]/2.0/mass[itype]*dt*dt*ftm2v; + xj[1] = xi[1]-vi[1]*dt+fi[1]/2.0/mass[itype]*dt*dt*ftm2v; + xj[2] = xi[2]-vi[2]*dt+fi[2]/2.0/mass[itype]*dt*dt*ftm2v; } // because LAMMPS does not put atoms back in the box @@ -463,21 +450,21 @@ void ComputeStressMop::compute_pairs() double pos_temp = pos+copysign(1.0,domain->prd_half[dir]-pos)*domain->prd[dir]; if (fabs(xi[dir]-pos)bond; - double dx[3] {0}; - double x_bond_1[3] {0}; - double x_bond_2[3] {0}; - double local_contribution[3] {0}; + double dx[3] = {0.0, 0.0, 0.0}; + double x_bond_1[3] = {0.0, 0.0, 0.0}; + double x_bond_2[3] = {0.0, 0.0, 0.0}; + double local_contribution[3] = {0.0, 0.0, 0.0}; // initialization - for (int i {0}; i < nvalues; i++) bond_local[i] = 0.0; + for (int i = 0; i < nvalues; i++) bond_local[i] = 0.0; // loop over all bonded atoms in the current proc for (atom1 = 0; atom1 < nlocal; atom1++) { @@ -591,7 +578,7 @@ void ComputeStressMop::compute_bonds() } // loop over the keywords and if necessary add the bond contribution - int m {0}; + int m = 0; while (mangle; double duang, du2ang; - double dx[3] {0}; - double dx_left[3] {0}; - double dx_right[3] {0}; - double x_angle_left[3] {0}; - double x_angle_middle[3] {0}; - double x_angle_right[3] {0}; - double dcos_theta[3] {0}; - double local_contribution[3] {0}; + double dx[3] = {0.0, 0.0, 0.0}; + double dx_left[3] = {0.0, 0.0, 0.0}; + double dx_right[3] = {0.0, 0.0, 0.0}; + double x_angle_left[3] = {0.0, 0.0, 0.0}; + double x_angle_middle[3] = {0.0, 0.0, 0.0}; + double x_angle_right[3] = {0.0, 0.0, 0.0}; + double dcos_theta[3] = {0.0, 0.0, 0.0}; + double local_contribution[3] = {0.0, 0.0, 0.0}; // initialization - for (int i {0}; i < nvalues; i++) angle_local[i] = 0.0; + for (int i = 0; i < nvalues; i++) angle_local[i] = 0.0; for (atom2 = 0; atom2 < nlocal; atom2++) { if (!(mask[atom2] & groupbit)) continue; @@ -762,8 +749,8 @@ void ComputeStressMop::compute_angles() } } // loop over the keywords and if necessary add the angle contribution - int m {0}; - while (m #include using namespace LAMMPS_NS; -enum{X,Y,Z}; -enum{LOWER,CENTER,UPPER,COORD}; -enum{TOTAL,CONF,KIN,PAIR,BOND}; +enum { X, Y, Z }; +enum { LOWER, CENTER, UPPER, COORD }; +enum { TOTAL, CONF, KIN, PAIR, BOND }; +// clang-format off /* ---------------------------------------------------------------------- */ ComputeStressMopProfile::ComputeStressMopProfile(LAMMPS *lmp, int narg, char **arg) : Compute(lmp, narg, arg) { - if (narg < 7) error->all(FLERR,"Illegal compute stress/mop/profile command"); - - MPI_Comm_rank(world,&me); + if (narg < 7) utils::missing_cmd_args(FLERR, "compute stress/mop/profile", error); bondflag = 0; // set compute mode and direction of plane(s) for pressure calculation - if (strcmp(arg[3],"x")==0) { + if (strcmp(arg[3],"x") == 0) { dir = X; - } else if (strcmp(arg[3],"y")==0) { + } else if (strcmp(arg[3],"y") == 0) { dir = Y; - } else if (strcmp(arg[3],"z")==0) { + } else if (strcmp(arg[3],"z") == 0) { dir = Z; } else error->all(FLERR,"Illegal compute stress/mop/profile command"); @@ -67,8 +67,7 @@ ComputeStressMopProfile::ComputeStressMopProfile(LAMMPS *lmp, int narg, char **a else if (strcmp(arg[4],"center") == 0) originflag = CENTER; else if (strcmp(arg[4],"upper") == 0) originflag = UPPER; else originflag = COORD; - if (originflag == COORD) - origin = utils::numeric(FLERR,arg[4],false,lmp); + if (originflag == COORD) origin = utils::numeric(FLERR,arg[4],false,lmp); delta = utils::numeric(FLERR,arg[5],false,lmp); invdelta = 1.0/delta; @@ -149,8 +148,7 @@ ComputeStressMopProfile::ComputeStressMopProfile(LAMMPS *lmp, int narg, char **a ComputeStressMopProfile::~ComputeStressMopProfile() { - - delete [] which; + delete[] which; memory->destroy(coord); memory->destroy(coordp); @@ -166,7 +164,6 @@ ComputeStressMopProfile::~ComputeStressMopProfile() void ComputeStressMopProfile::init() { - // conversion constants nktv2p = force->nktv2p; @@ -192,30 +189,30 @@ void ComputeStressMopProfile::init() //This compute requires a pair style with pair_single method implemented - if (force->pair == nullptr) + if (!force->pair) error->all(FLERR,"No pair style is defined for compute stress/mop/profile"); if (force->pair->single_enable == 0) error->all(FLERR,"Pair style does not support compute stress/mop/profile"); // Errors - if (me==0) { + if (comm->me == 0) { //Compute stress/mop/profile only accounts for pair interactions. // issue an error if any intramolecular potential or Kspace is defined. - if (force->bond!=nullptr) bondflag = 1; + if (force->bond) bondflag = 1; - if (force->angle!=nullptr) + if (force->angle) if ((strcmp(force->angle_style, "zero") != 0) && (strcmp(force->angle_style, "none") != 0)) error->all(FLERR,"compute stress/mop/profile does not account for angle potentials"); - if (force->dihedral!=nullptr) + if (force->dihedral) if ((strcmp(force->dihedral_style, "zero") != 0) && (strcmp(force->dihedral_style, "none") != 0)) error->all(FLERR,"compute stress/mop/profile does not account for dihedral potentials"); - if (force->improper!=nullptr) + if (force->improper) if ((strcmp(force->improper_style, "zero") != 0) && (strcmp(force->improper_style, "none") != 0)) error->all(FLERR,"compute stress/mop/profile does not account for improper potentials"); - if (force->kspace!=nullptr) + if (force->kspace) error->warning(FLERR,"compute stress/mop/profile does not account for kspace contributions"); } @@ -244,8 +241,7 @@ void ComputeStressMopProfile::compute_array() compute_pairs(); // sum pressure contributions over all procs - MPI_Allreduce(&values_local[0][0],&values_global[0][0],nbins*nvalues, - MPI_DOUBLE,MPI_SUM,world); + MPI_Allreduce(&values_local[0][0],&values_global[0][0],nbins*nvalues,MPI_DOUBLE,MPI_SUM,world); if (bondflag) { //Compute bond contribution on separate procs @@ -259,16 +255,14 @@ void ComputeStressMopProfile::compute_array() } // sum bond contribution over all procs - MPI_Allreduce(&bond_local[0][0],&bond_global[0][0],nbins*nvalues, - MPI_DOUBLE,MPI_SUM,world); + MPI_Allreduce(&bond_local[0][0],&bond_global[0][0],nbins*nvalues,MPI_DOUBLE,MPI_SUM,world); - int ibin,m,mo; - for (ibin=0; ibinbond; - double dx[3] {0}; - double x_bond_1[3] {0}; - double x_bond_2[3] {0}; + double dx[3] = {0.0, 0.0, 0.0}; + double x_bond_1[3] = {0.0, 0.0, 0.0}; + double x_bond_2[3] = {0.0, 0.0, 0.0}; // initialization - for (int m {0}; m < nbins; m++) { - for (int i {0}; i < nvalues; i++) { + for (int m = 0; m < nbins; m++) { + for (int i = 0; i < nvalues; i++) { bond_local[m][i] = 0.0; } local_contribution[m][0] = 0.0; @@ -557,7 +551,7 @@ void ComputeStressMopProfile::compute_bonds() if (newton_bond == 0 && tag[atom1] > tag[atom2]) continue; if (btype <= 0) continue; - for (int ibin {0}; ibin Date: Wed, 7 Jun 2023 06:20:24 -0400 Subject: [PATCH 197/396] remove unused include and related statements --- src/INTERLAYER/pair_aip_water_2dm.cpp | 7 ------- src/INTERLAYER/pair_ilp_tmd.cpp | 4 ---- src/OPT/pair_aip_water_2dm_opt.cpp | 10 ---------- 3 files changed, 21 deletions(-) diff --git a/src/INTERLAYER/pair_aip_water_2dm.cpp b/src/INTERLAYER/pair_aip_water_2dm.cpp index f2d68f448b..6e2bf7228d 100644 --- a/src/INTERLAYER/pair_aip_water_2dm.cpp +++ b/src/INTERLAYER/pair_aip_water_2dm.cpp @@ -20,21 +20,14 @@ #include "pair_aip_water_2dm.h" -#include "atom.h" #include "citeme.h" #include "error.h" #include "force.h" -#include "interlayer_taper.h" -#include "memory.h" -#include "my_page.h" -#include "neigh_list.h" -#include "neigh_request.h" #include #include using namespace LAMMPS_NS; -using namespace InterLayer; #define MAXLINE 1024 #define DELTA 4 diff --git a/src/INTERLAYER/pair_ilp_tmd.cpp b/src/INTERLAYER/pair_ilp_tmd.cpp index f29ee34180..fd3a2f8c6f 100644 --- a/src/INTERLAYER/pair_ilp_tmd.cpp +++ b/src/INTERLAYER/pair_ilp_tmd.cpp @@ -35,10 +35,6 @@ using namespace LAMMPS_NS; using namespace InterLayer; -#define MAXLINE 1024 -#define DELTA 4 -#define PGDELTA 1 - static const char cite_ilp_tmd[] = "ilp/tmd potential doi:10.1021/acs.jctc.1c00782\n" "@Article{Ouyang2021\n" diff --git a/src/OPT/pair_aip_water_2dm_opt.cpp b/src/OPT/pair_aip_water_2dm_opt.cpp index 3aba5b9dbd..47c8c395db 100644 --- a/src/OPT/pair_aip_water_2dm_opt.cpp +++ b/src/OPT/pair_aip_water_2dm_opt.cpp @@ -33,21 +33,11 @@ #include "pair_aip_water_2dm_opt.h" #include "atom.h" -#include "citeme.h" -#include "comm.h" -#include "error.h" -#include "force.h" -#include "interlayer_taper.h" #include "memory.h" -#include "neigh_list.h" -#include "neigh_request.h" -#include "neighbor.h" -#include #include using namespace LAMMPS_NS; -using namespace InterLayer; PairAIPWATER2DMOpt::PairAIPWATER2DMOpt(LAMMPS *lmp) : PairILPGrapheneHBN(lmp), PairILPTMD(lmp), PairAIPWATER2DM(lmp), PairILPGrapheneHBNOpt(lmp) From 37d894db51074724b20ff1e6befe8c4f7099320f Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Wed, 7 Jun 2023 06:30:07 -0400 Subject: [PATCH 198/396] update/clarify docs --- doc/src/pair_aip_water_2dm.rst | 24 +++++++++++------------- 1 file changed, 11 insertions(+), 13 deletions(-) diff --git a/doc/src/pair_aip_water_2dm.rst b/doc/src/pair_aip_water_2dm.rst index 5218db9c37..f57e4b33fb 100644 --- a/doc/src/pair_aip_water_2dm.rst +++ b/doc/src/pair_aip_water_2dm.rst @@ -59,22 +59,20 @@ a continuous cutoff (up to third derivative) for interatomic separations larger than :math:`r_c` :doc:`pair_style ilp_graphene_hbn `. -It is important to include all the pairs to build the neighbor list for -calculating the normals. - .. note:: - Since each water molecule contains one oxygen atom and two hydrogen - atoms, a new definition is proposed (see In :ref:`(Feng) `),the - atomic normal vectors of hydrogen atoms are assumed to lie along the - corresponding oxygen-hydrogen bonds and the normal vector of the - central oxygen atom is defined as their average. + This pair style uses the atomic normal vector definition from + :ref:`(Feng) `), where the atomic normal vectors of the + hydrogen atoms are assumed to lie along the corresponding + oxygen-hydrogen bonds and the normal vector of the central oxygen + atom is defined as their average. The provided parameter file, ``COH.aip.water.2dm``, is intended for use with *metal* :doc:`units `, with energies in meV. Two additional parameters, *S*, and *rcut* are included in the parameter file. *S* is -designed to facilitate scaling of energies; *rcut* is designed to build -the neighbor list for calculating the normals for each atom pair. +designed to facilitate scaling of energies; *rcut* is the cutoff for an +internal, short distance neighbor list that is generated for speeding up +the calculation of the normals for all atom pairs. .. note:: @@ -83,9 +81,9 @@ the neighbor list for calculating the normals for each atom pair. setting the cutoff equal to 16.0 Angstrom. Using a different cutoff or taper function setting should be carefully checked as they can lead to significant errors. These parameters provide a good - description in both short- and long-range interaction regimes. This - feature is essential for simulations in high pressure regime (i.e., - the interlayer distance is smaller than the equilibrium distance). + description in both short- and long-range interaction regimes. This + is essential for simulations in high pressure regime (i.e., the + interlayer distance is smaller than the equilibrium distance). This potential must be used in combination with hybrid/overlay. Other interactions can be set to zero using :doc:`pair_coeff settings From 57f166670f08fe7a683306172ca4d5527e6564cb Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Wed, 7 Jun 2023 06:38:52 -0400 Subject: [PATCH 199/396] fix versionadded macro so it is detected when actual version is added --- doc/src/pair_aip_water_2dm.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/src/pair_aip_water_2dm.rst b/doc/src/pair_aip_water_2dm.rst index f57e4b33fb..532ee8f8f6 100644 --- a/doc/src/pair_aip_water_2dm.rst +++ b/doc/src/pair_aip_water_2dm.rst @@ -33,7 +33,7 @@ Examples Description """"""""""" -.. versionadded:: xxxx2023 +.. versionadded:: TBD The *aip/water/2dm* style computes the anisotropic interfacial potential (AIP) potential for interfaces of water with two-dimensional (2D) From f2f8e139d8c23e750ce603ef4cd2a95b245bdb5a Mon Sep 17 00:00:00 2001 From: Lars Veldscholte Date: Wed, 7 Jun 2023 16:03:32 +0200 Subject: [PATCH 200/396] Add optional keywords to arguments for ke/pair/bond forces --- .../compute_stress_cartesian.cpp | 232 ++++++++++-------- src/EXTRA-COMPUTE/compute_stress_cartesian.h | 3 + 2 files changed, 130 insertions(+), 105 deletions(-) diff --git a/src/EXTRA-COMPUTE/compute_stress_cartesian.cpp b/src/EXTRA-COMPUTE/compute_stress_cartesian.cpp index 0aae797111..3835b8bea9 100644 --- a/src/EXTRA-COMPUTE/compute_stress_cartesian.cpp +++ b/src/EXTRA-COMPUTE/compute_stress_cartesian.cpp @@ -62,14 +62,12 @@ ComputeStressCartesian::ComputeStressCartesian(LAMMPS *lmp, int narg, char **arg { if (lmp->citeme) lmp->citeme->add(cite_compute_stress_cartesian); - // narg == 5 for one-dimensional and narg == 7 for two-dimensional - if (narg == 5) - dims = 1; - else if (narg == 7) - dims = 2; - else - error->all(FLERR, "Illegal compute stress/cartesian command. Illegal number of arguments."); + if (narg < 7) error->all(FLERR, "Illegal compute stress/cartesian command: illegal number of arguments."); + // no triclinic boxes + if (domain->triclinic) error->all(FLERR, "Compute stress/cartesian requires an orthogonal box"); + + // Direction of first dimension if (strcmp(arg[3], "x") == 0) dir1 = 0; else if (strcmp(arg[3], "y") == 0) @@ -79,14 +77,8 @@ ComputeStressCartesian::ComputeStressCartesian(LAMMPS *lmp, int narg, char **arg else error->all(FLERR, "Illegal compute stress/cartesian direction: {}", arg[3]); - dir2 = 0; bin_width1 = utils::numeric(FLERR, arg[4], false, lmp); - bin_width2 = domain->boxhi[dir2] - domain->boxlo[dir2]; nbins1 = (int) ((domain->boxhi[dir1] - domain->boxlo[dir1]) / bin_width1); - nbins2 = 1; - - // no triclinic boxes - if (domain->triclinic) error->all(FLERR, "Compute stress/cartesian requires an orthogonal box"); // adjust bin width if not a perfect match double tmp_binwidth = (domain->boxhi[dir1] - domain->boxlo[dir1]) / nbins1; @@ -94,14 +86,23 @@ ComputeStressCartesian::ComputeStressCartesian(LAMMPS *lmp, int narg, char **arg utils::logmesg(lmp, "Adjusting first bin width for compute {} from {:.6f} to {:.6f}\n", style, bin_width1, tmp_binwidth); bin_width1 = tmp_binwidth; + invV = bin_width1; if (bin_width1 <= 0.0) error->all(FLERR, "Illegal compute stress/cartesian command. First bin width must be > 0"); else if (bin_width1 > domain->boxhi[dir1] - domain->boxlo[dir1]) error->all(FLERR, "Illegal compute stress/cartesian command. First bin width > box."); - invV = bin_width1; - if (dims == 2) { + // Direction of second dimension + if (strcmp(arg[5], "NULL") == 0) { + dims = 1; + dir2 = 0; + bin_width2 = domain->boxhi[dir2] - domain->boxlo[dir2]; + nbins2 = 1; + } else { + dims = 2; + + // Direction of first dimension if (strcmp(arg[5], "x") == 0) dir2 = 0; else if (strcmp(arg[5], "y") == 0) @@ -150,6 +151,21 @@ ComputeStressCartesian::ComputeStressCartesian(LAMMPS *lmp, int narg, char **arg if (box_incompatible) error->all(FLERR, "Must not use compute stress/cartesian on variable box dimension"); + // process optional args + if (narg > 7) { + compute_ke = false; + compute_pair = false; + compute_bond = false; + int iarg = 7; + while (iarg < narg) { + if (strcmp(arg[iarg], "ke") == 0) compute_ke = true; + else if (strcmp(arg[iarg], "pair") == 0) compute_pair = true; + else if (strcmp(arg[iarg], "bond") == 0) compute_bond = true; + else error->all(FLERR, "Illegal compute stress/atom command"); + iarg++; + } + } + for (int i = 0; i < 3; i++) if ((dims == 1 && i != dir1) || (dims == 2 && (i != dir1 && i != dir2))) invV *= domain->boxhi[i] - domain->boxlo[i]; @@ -262,119 +278,125 @@ void ComputeStressCartesian::compute_array() } // calculate number density and kinetic contribution to pressure - for (int i = 0; i < nlocal; i++) { - int bin1 = (int) ((x[i][dir1] - boxlo[dir1]) / bin_width1) % nbins1; - int bin2 = 0; - if (dims == 2) bin2 = (int) ((x[i][dir2] - boxlo[dir2]) / bin_width2) % nbins2; + if (compute_ke) { + for (int i = 0; i < nlocal; i++) { + int bin1 = (int) ((x[i][dir1] - boxlo[dir1]) / bin_width1) % nbins1; + int bin2 = 0; + if (dims == 2) bin2 = (int) ((x[i][dir2] - boxlo[dir2]) / bin_width2) % nbins2; - // Apply periodic boundary conditions and avoid out of range access - if (domain->periodicity[dir1] == 1) { - if (bin1 < 0) - bin1 = (bin1 + nbins1) % nbins1; + // Apply periodic boundary conditions and avoid out of range access + if (domain->periodicity[dir1] == 1) { + if (bin1 < 0) + bin1 = (bin1 + nbins1) % nbins1; + else if (bin1 >= nbins1) + bin1 = (bin1 - nbins1) % nbins1; + } else if (bin1 < 0) + bin1 = 0; else if (bin1 >= nbins1) - bin1 = (bin1 - nbins1) % nbins1; - } else if (bin1 < 0) - bin1 = 0; - else if (bin1 >= nbins1) - bin1 = nbins1 - 1; + bin1 = nbins1 - 1; - if (domain->periodicity[dir2] == 1) { - if (bin2 < 0) - bin2 = (bin2 + nbins2) % nbins2; + if (domain->periodicity[dir2] == 1) { + if (bin2 < 0) + bin2 = (bin2 + nbins2) % nbins2; + else if (bin2 >= nbins2) + bin2 = (bin2 - nbins2) % nbins2; + } else if (bin2 < 0) + bin2 = 0; else if (bin2 >= nbins2) - bin2 = (bin2 - nbins2) % nbins2; - } else if (bin2 < 0) - bin2 = 0; - else if (bin2 >= nbins2) - bin2 = nbins2 - 1; + bin2 = nbins2 - 1; - int j = bin1 + bin2 * nbins1; - tdens[j] += 1; - tpkxx[j] += mass[type[i]] * v[i][0] * v[i][0]; - tpkyy[j] += mass[type[i]] * v[i][1] * v[i][1]; - tpkzz[j] += mass[type[i]] * v[i][2] * v[i][2]; + int j = bin1 + bin2 * nbins1; + tdens[j] += 1; + tpkxx[j] += mass[type[i]] * v[i][0] * v[i][0]; + tpkyy[j] += mass[type[i]] * v[i][1] * v[i][1]; + tpkzz[j] += mass[type[i]] * v[i][2] * v[i][2]; + } } // loop over neighbors of my atoms - for (int ii = 0; ii < inum; ii++) { - int i = ilist[ii]; + if (compute_pair && force->pair) { + for (int ii = 0; ii < inum; ii++) { + int i = ilist[ii]; - // skip if I or J are not in group - if (!(mask[i] & groupbit)) continue; + // skip if I or J are not in group + if (!(mask[i] & groupbit)) continue; - double xi1 = x[i][dir1] - boxlo[dir1]; - double xi2 = x[i][dir2] - boxlo[dir2]; + double xi1 = x[i][dir1] - boxlo[dir1]; + double xi2 = x[i][dir2] - boxlo[dir2]; - for (int jj = 0; jj < numneigh[i]; jj++) { - int j = firstneigh[i][jj]; - double factor_lj = special_lj[sbmask(j)]; - double factor_coul = special_coul[sbmask(j)]; - j &= NEIGHMASK; - if (!(mask[j] & groupbit)) continue; + for (int jj = 0; jj < numneigh[i]; jj++) { + int j = firstneigh[i][jj]; + double factor_lj = special_lj[sbmask(j)]; + double factor_coul = special_coul[sbmask(j)]; + j &= NEIGHMASK; + if (!(mask[j] & groupbit)) continue; - // for newton = 0 and J = ghost atom, need to ensure I,J pair is only output by one proc - // use same tag[i],tag[j] logic as in Neighbor::neigh_half_nsq() - if (newton_pair == 0 && j >= nlocal) { - if (tag[i] > tag[j]) { - if ((tag[i] + tag[j]) % 2 == 0) continue; - } else if (tag[i] < tag[j]) { - if ((tag[i] + tag[j]) % 2 == 1) continue; - } else { - // tag[i] = tag[j] is possible for long cutoffs that include images of self - if (x[j][2] < x[i][2]) continue; - if (x[j][2] == x[i][2]) { - if (x[j][1] < x[i][1]) continue; - if (x[j][1] == x[i][1] && x[j][0] < x[i][0]) continue; + // for newton = 0 and J = ghost atom, need to ensure I,J pair is only output by one proc + // use same tag[i],tag[j] logic as in Neighbor::neigh_half_nsq() + if (newton_pair == 0 && j >= nlocal) { + if (tag[i] > tag[j]) { + if ((tag[i] + tag[j]) % 2 == 0) continue; + } else if (tag[i] < tag[j]) { + if ((tag[i] + tag[j]) % 2 == 1) continue; + } else { + // tag[i] = tag[j] is possible for long cutoffs that include images of self + if (x[j][2] < x[i][2]) continue; + if (x[j][2] == x[i][2]) { + if (x[j][1] < x[i][1]) continue; + if (x[j][1] == x[i][1] && x[j][0] < x[i][0]) continue; + } } } + + double delx = x[j][0] - x[i][0]; + double dely = x[j][1] - x[i][1]; + double delz = x[j][2] - x[i][2]; + double rsq = delx * delx + dely * dely + delz * delz; + + // Check if inside cut-off + int itype = type[i]; + int jtype = type[j]; + if (rsq >= force->pair->cutsq[itype][jtype]) continue; + + double fpair; + force->pair->single(i, j, itype, jtype, rsq, factor_coul, factor_lj, fpair); + compute_pressure(fpair, xi1, xi2, delx, dely, delz); } - - double delx = x[j][0] - x[i][0]; - double dely = x[j][1] - x[i][1]; - double delz = x[j][2] - x[i][2]; - double rsq = delx * delx + dely * dely + delz * delz; - - // Check if inside cut-off - int itype = type[i]; - int jtype = type[j]; - if (rsq >= force->pair->cutsq[itype][jtype]) continue; - - double fpair; - force->pair->single(i, j, itype, jtype, rsq, factor_coul, factor_lj, fpair); - compute_pressure(fpair, xi1, xi2, delx, dely, delz); } } // Loop over all bonds - for (int i_bond = 0; i_bond < neighbor->nbondlist; i_bond++) { - // i == atom1, j == atom2 - int i = neighbor->bondlist[i_bond][0]; - int j = neighbor->bondlist[i_bond][1]; - int btype = neighbor->bondlist[i_bond][2]; + if (compute_bond && force->bond) { + for (int i_bond = 0; i_bond < neighbor->nbondlist; i_bond++) { + // i == atom1, j == atom2 + int i = neighbor->bondlist[i_bond][0]; + int j = neighbor->bondlist[i_bond][1]; + int btype = neighbor->bondlist[i_bond][2]; - // Skip if one of both atoms is not in group - if (!(mask[i] & groupbit)) continue; - if (!(mask[j] & groupbit)) continue; + // Skip if one of both atoms is not in group + if (!(mask[i] & groupbit)) continue; + if (!(mask[j] & groupbit)) continue; - // if newton_bond is off and atom2 is a ghost atom, only compute this on one processor - if (!force->newton_bond && j >= nlocal) { - if (tag[i] > tag[j]) { - if ((tag[i] + tag[j]) % 2 == 0) continue; - } else if (tag[i] < tag[j]) { - if ((tag[i] < tag[j]) % 2 == 1) continue; + // if newton_bond is off and atom2 is a ghost atom, only compute this on one processor + if (!force->newton_bond && j >= nlocal) { + if (tag[i] > tag[j]) { + if ((tag[i] + tag[j]) % 2 == 0) continue; + } else if (tag[i] < tag[j]) { + if ((tag[i] < tag[j]) % 2 == 1) continue; + } } + + double dx = x[j][0] - x[i][0]; + double dy = x[j][1] - x[i][1]; + double dz = x[j][2] - x[i][2]; + double rsq = dx*dx + dy*dy + dz*dz; + double xi = x[i][dir1] - boxlo[dir1]; + double yi = x[i][dir2] - boxlo[dir2]; + + double fbond; + force->bond->single(btype, rsq, i, j, fbond); + compute_pressure(fbond, xi, yi, dx, dy, dz); } - - double dx = x[j][0] - x[i][0]; - double dy = x[j][1] - x[i][1]; - double dz = x[j][2] - x[i][2]; - double rsq = dx*dx + dy*dy + dz*dz; - double xi = x[i][dir1] - boxlo[dir1]; - double yi = x[i][dir2] - boxlo[dir2]; - - double fbond; - force->bond->single(btype, rsq, i, j, fbond); - compute_pressure(fbond, xi, yi, dx, dy, dz); } // normalize pressure diff --git a/src/EXTRA-COMPUTE/compute_stress_cartesian.h b/src/EXTRA-COMPUTE/compute_stress_cartesian.h index 0954d9ca71..40f2e9d4af 100644 --- a/src/EXTRA-COMPUTE/compute_stress_cartesian.h +++ b/src/EXTRA-COMPUTE/compute_stress_cartesian.h @@ -36,6 +36,9 @@ class ComputeStressCartesian : public Compute { private: int nbins1, nbins2, dir1, dir2, dims; double bin_width1, bin_width2, invV; + bool compute_ke = true; + bool compute_pair = true; + bool compute_bond = true; // Number density, kinetic and configurational contribution to the pressure. double *dens, *pkxx, *pkyy, *pkzz, *pcxx, *pcyy, *pczz; From 2f88153f060f8bac8a98108b86cd298403a1c5a6 Mon Sep 17 00:00:00 2001 From: "W. Michael Brown" Date: Wed, 7 Jun 2023 10:43:51 -0700 Subject: [PATCH 201/396] Implementing feature request for runtime control of pppm_table in Intel package. --- doc/src/package.rst | 19 +++++++++++-------- src/INTEL/fix_intel.cpp | 8 ++++++-- src/INTEL/fix_intel.h | 4 ++-- src/INTEL/intel_preprocess.h | 2 -- 4 files changed, 19 insertions(+), 14 deletions(-) diff --git a/doc/src/package.rst b/doc/src/package.rst index 6d425b63dd..ce45a1eb79 100644 --- a/doc/src/package.rst +++ b/doc/src/package.rst @@ -68,6 +68,9 @@ Syntax Ntpc = max number of co-processor threads per co-processor core (default = 4) *tptask* value = Ntptask Ntptask = max number of co-processor threads per MPI task (default = 240) + *pppm_table* value = *yes* or *no* + *yes* = Precompute pppm values in table (doesn't change accuracy) + *no* = Compute pppm values on the fly *no_affinity* values = none *kokkos* args = keyword value ... zero or more keyword/value pairs may be appended @@ -708,14 +711,14 @@ in your input script or via the "-pk gpu" :doc:`command-line switch ` is used. If it is -not used, you must invoke the package intel command in your input -script or via the "-pk intel" :doc:`command-line switch `. +tptask = 240, pppm_table = yes. The default ghost option is determined +by the pair style being used. This value is output to the screen in +the offload report at the end of each run. Note that all of these +settings, except "omp" and "mode", are ignored if LAMMPS was not built +with Xeon Phi co-processor support. These settings are made +automatically if the "-sf intel" :doc:`command-line switch ` +is used. If it is not used, you must invoke the package intel command +in your input script or via the "-pk intel" :doc:`command-line switch `. For the KOKKOS package, the option defaults for GPUs are neigh = full, neigh/qeq = full, newton = off, binsize for GPUs = 2x LAMMPS default diff --git a/src/INTEL/fix_intel.cpp b/src/INTEL/fix_intel.cpp index 89775108cb..2b786b6eed 100644 --- a/src/INTEL/fix_intel.cpp +++ b/src/INTEL/fix_intel.cpp @@ -95,6 +95,7 @@ FixIntel::FixIntel(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg) _allow_separate_buffers = 1; _offload_ghost = -1; _lrt = 0; + _p3m_table = 1; int iarg = 4; while (iarg < narg) { @@ -135,11 +136,14 @@ FixIntel::FixIntel(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg) if (iarg+2 > narg) error->all(FLERR,"Illegal package intel command"); _lrt = utils::logical(FLERR,arg[iarg+1],false,lmp); iarg += 2; - } + } else if (strcmp(arg[iarg], "pppm_table") == 0) { + if (iarg+2 > narg) error->all(FLERR,"Illegal package intel command"); + _p3m_table = utils::logical(FLERR,arg[iarg+1],false,lmp); + iarg += 2; // undocumented options - else if (strcmp(arg[iarg],"offload_affinity_balanced") == 0) { + } else if (strcmp(arg[iarg],"offload_affinity_balanced") == 0) { _offload_affinity_balanced = 1; iarg++; } else if (strcmp(arg[iarg],"buffers") == 0) { diff --git a/src/INTEL/fix_intel.h b/src/INTEL/fix_intel.h index 1960a6d802..050b27c313 100644 --- a/src/INTEL/fix_intel.h +++ b/src/INTEL/fix_intel.h @@ -103,7 +103,7 @@ class FixIntel : public Fix { inline int pppm_table() { if (force->kspace_match("^pppm/.*intel$", 0)) - return INTEL_P3M_TABLE; + return _p3m_table; else return 0; } @@ -194,7 +194,7 @@ class FixIntel : public Fix { protected: int _overflow_flag[5]; _alignvar(int _off_overflow_flag[5], 64); - int _allow_separate_buffers, _offload_ghost, _lrt; + int _allow_separate_buffers, _offload_ghost, _lrt, _p3m_table; IntelBuffers::vec3_acc_t *_force_array_s; IntelBuffers::vec3_acc_t *_force_array_m; diff --git a/src/INTEL/intel_preprocess.h b/src/INTEL/intel_preprocess.h index a3c961f436..2c4b9a0c1b 100644 --- a/src/INTEL/intel_preprocess.h +++ b/src/INTEL/intel_preprocess.h @@ -86,8 +86,6 @@ enum {TIME_PACK, TIME_HOST_NEIGHBOR, TIME_HOST_PAIR, TIME_OFFLOAD_NEIGHBOR, #define INTEL_MAX_STENCIL_CHECK 4096 #define INTEL_P3M_MAXORDER 8 #define INTEL_P3M_ALIGNED_MAXORDER 8 -// PRECOMPUTE VALUES IN TABLE (DOESN'T AFFECT ACCURACY) -#define INTEL_P3M_TABLE 1 #ifdef __INTEL_COMPILER #ifdef __AVX__ From 6360c02daaa882c73770aaebd3a11f1239b398f6 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Wed, 7 Jun 2023 14:04:41 -0400 Subject: [PATCH 202/396] use explicit const references --- src/EXTRA-DUMP/dump_yaml.cpp | 6 +++--- src/NETCDF/dump_netcdf.cpp | 10 +++++----- src/NETCDF/dump_netcdf_mpiio.cpp | 10 +++++----- 3 files changed, 13 insertions(+), 13 deletions(-) diff --git a/src/EXTRA-DUMP/dump_yaml.cpp b/src/EXTRA-DUMP/dump_yaml.cpp index 029415164f..ec7d26af31 100644 --- a/src/EXTRA-DUMP/dump_yaml.cpp +++ b/src/EXTRA-DUMP/dump_yaml.cpp @@ -64,10 +64,10 @@ void DumpYAML::write_header(bigint ndump) if (update->ntimestep == th->get_timestep()) { thermo_data += "thermo:\n - keywords: [ "; - for (auto key : th->get_keywords()) thermo_data += fmt::format("{}, ", key); + for (const auto &key : th->get_keywords()) thermo_data += fmt::format("{}, ", key); thermo_data += "]\n - data: [ "; - for (auto val : th->get_fields()) { + for (const auto &val : th->get_fields()) { if (val.type == multitype::DOUBLE) thermo_data += fmt::format("{}, ", val.data.d); else if (val.type == multitype::INT) @@ -90,7 +90,7 @@ void DumpYAML::write_header(bigint ndump) fmt::print(fp, "natoms: {}\n", ndump); fputs("boundary: [ ", fp); - for (const auto bflag : boundary) { + for (const auto &bflag : boundary) { if (bflag == ' ') continue; fmt::print(fp, "{}, ", bflag); } diff --git a/src/NETCDF/dump_netcdf.cpp b/src/NETCDF/dump_netcdf.cpp index cb6aea16cf..8c99ff1f70 100644 --- a/src/NETCDF/dump_netcdf.cpp +++ b/src/NETCDF/dump_netcdf.cpp @@ -320,7 +320,7 @@ void DumpNetCDF::openfile() // perframe variables if (thermo) { - auto keywords = output->thermo->get_keywords(); + const auto &keywords = output->thermo->get_keywords(); int nfield = keywords.size(); for (int i = 0; i < nfield; i++) { NCERRX( nc_inq_varid(ncid, keywords[i].c_str(), &thermovar[i]), keywords[i].c_str() ); @@ -433,8 +433,8 @@ void DumpNetCDF::openfile() // perframe variables if (thermo) { - auto fields = output->thermo->get_fields(); - auto keywords = output->thermo->get_keywords(); + const auto &fields = output->thermo->get_fields(); + const auto &keywords = output->thermo->get_keywords(); int nfield = fields.size(); for (int i = 0; i < nfield; i++) { if (fields[i].type == multitype::DOUBLE) { @@ -600,8 +600,8 @@ void DumpNetCDF::write() start[1] = 0; if (thermo) { - auto keywords = output->thermo->get_keywords(); - auto fields = output->thermo->get_fields(); + const auto &keywords = output->thermo->get_keywords(); + const auto &fields = output->thermo->get_fields(); int nfield = fields.size(); for (int i = 0; i < nfield; i++) { if (filewriter) { diff --git a/src/NETCDF/dump_netcdf_mpiio.cpp b/src/NETCDF/dump_netcdf_mpiio.cpp index fdcd03470e..3aec34dd40 100644 --- a/src/NETCDF/dump_netcdf_mpiio.cpp +++ b/src/NETCDF/dump_netcdf_mpiio.cpp @@ -318,7 +318,7 @@ void DumpNetCDFMPIIO::openfile() // perframe variables if (thermo) { - auto keywords = output->thermo->get_keywords(); + const auto &keywords = output->thermo->get_keywords(); int nfield = keywords.size(); for (int i = 0; i < nfield; i++) { NCERRX( ncmpi_inq_varid(ncid, keywords[i].c_str(), &thermovar[i]), keywords[i].c_str() ); @@ -423,8 +423,8 @@ void DumpNetCDFMPIIO::openfile() // perframe variables if (thermo) { - auto fields = output->thermo->get_fields(); - auto keywords = output->thermo->get_keywords(); + const auto &fields = output->thermo->get_fields(); + const auto &keywords = output->thermo->get_keywords(); int nfield = fields.size(); for (int i = 0; i < nfield; i++) { if (fields[i].type == multitype::DOUBLE) { @@ -593,8 +593,8 @@ void DumpNetCDFMPIIO::write() NCERR( ncmpi_begin_indep_data(ncid) ); if (thermo) { - auto keywords = output->thermo->get_keywords(); - auto fields = output->thermo->get_fields(); + const auto &keywords = output->thermo->get_keywords(); + const auto &fields = output->thermo->get_fields(); int nfield = fields.size(); for (int i = 0; i < nfield; i++) { if (filewriter) { From b7afe412dc939876b0165eaa7325c8bed9e0e56c Mon Sep 17 00:00:00 2001 From: jtclemm Date: Wed, 7 Jun 2023 13:08:46 -0600 Subject: [PATCH 203/396] Updating SDPD examples --- .../2d-diffusion-in-shear-flow/in.lammps | 6 +- ...g.24Oct18.2d-diffusion-in-shear-flow.g++.1 | 247 ----------------- ...g.24Oct18.2d-diffusion-in-shear-flow.g++.4 | 247 ----------------- ...g.28Mar23.2d-diffusion-in-shear-flow.g++.1 | 253 ++++++++++++++++++ ...g.28Mar23.2d-diffusion-in-shear-flow.g++.4 | 253 ++++++++++++++++++ .../dpd-smooth/2d-diffusion/in.lammps | 6 +- .../log.24Oct18.2d-diffusion.g++.1 | 226 ---------------- .../log.24Oct18.2d-diffusion.g++.4 | 226 ---------------- .../log.28Mar23.2d-diffusion.g++.1 | 230 ++++++++++++++++ .../log.28Mar23.2d-diffusion.g++.4 | 230 ++++++++++++++++ .../equipartition-verification/in.lammps | 6 +- ....g++.1 => log.28Mar23.equipartition.g++.1} | 91 ++++--- ....g++.4 => log.28Mar23.equipartition.g++.4} | 91 ++++--- 13 files changed, 1069 insertions(+), 1043 deletions(-) delete mode 100644 examples/PACKAGES/dpd-smooth/2d-diffusion-in-shear-flow/log.24Oct18.2d-diffusion-in-shear-flow.g++.1 delete mode 100644 examples/PACKAGES/dpd-smooth/2d-diffusion-in-shear-flow/log.24Oct18.2d-diffusion-in-shear-flow.g++.4 create mode 100644 examples/PACKAGES/dpd-smooth/2d-diffusion-in-shear-flow/log.28Mar23.2d-diffusion-in-shear-flow.g++.1 create mode 100644 examples/PACKAGES/dpd-smooth/2d-diffusion-in-shear-flow/log.28Mar23.2d-diffusion-in-shear-flow.g++.4 delete mode 100644 examples/PACKAGES/dpd-smooth/2d-diffusion/log.24Oct18.2d-diffusion.g++.1 delete mode 100644 examples/PACKAGES/dpd-smooth/2d-diffusion/log.24Oct18.2d-diffusion.g++.4 create mode 100644 examples/PACKAGES/dpd-smooth/2d-diffusion/log.28Mar23.2d-diffusion.g++.1 create mode 100644 examples/PACKAGES/dpd-smooth/2d-diffusion/log.28Mar23.2d-diffusion.g++.4 rename examples/PACKAGES/dpd-smooth/equipartition-verification/{log.24Oct18.equipartition.g++.1 => log.28Mar23.equipartition.g++.1} (58%) rename examples/PACKAGES/dpd-smooth/equipartition-verification/{log.24Oct18.equipartition.g++.4 => log.28Mar23.equipartition.g++.4} (58%) diff --git a/examples/PACKAGES/dpd-smooth/2d-diffusion-in-shear-flow/in.lammps b/examples/PACKAGES/dpd-smooth/2d-diffusion-in-shear-flow/in.lammps index 138f7b5338..dd50a5e69f 100644 --- a/examples/PACKAGES/dpd-smooth/2d-diffusion-in-shear-flow/in.lammps +++ b/examples/PACKAGES/dpd-smooth/2d-diffusion-in-shear-flow/in.lammps @@ -1,6 +1,6 @@ dimension 2 units micro -atom_style meso +atom_style sph variable R equal 0.5 # radius of sphere micrometers variable a equal $R/5 # lattice spacing micrometers @@ -37,12 +37,12 @@ group upper_wall type 3 group lower_wall type 4 mass * ${mass} -set group all meso/rho ${rho_0} +set group all sph/rho ${rho_0} pair_style sdpd/taitwater/isothermal $T ${mu} 76787 # temperature viscosity random_seed pair_coeff * * ${rho_0} ${c_0} ${h} -fix 1 fluid meso +fix 1 fluid sph fix 2 sphere rigid/meso single fix 3 upper_wall meso/move linear +${wall_velocity} 0 0 units box fix 4 lower_wall meso/move linear -${wall_velocity} 0 0 units box diff --git a/examples/PACKAGES/dpd-smooth/2d-diffusion-in-shear-flow/log.24Oct18.2d-diffusion-in-shear-flow.g++.1 b/examples/PACKAGES/dpd-smooth/2d-diffusion-in-shear-flow/log.24Oct18.2d-diffusion-in-shear-flow.g++.1 deleted file mode 100644 index cd01601292..0000000000 --- a/examples/PACKAGES/dpd-smooth/2d-diffusion-in-shear-flow/log.24Oct18.2d-diffusion-in-shear-flow.g++.1 +++ /dev/null @@ -1,247 +0,0 @@ -LAMMPS (24 Oct 2018) -dimension 2 -units micro -atom_style meso - -variable R equal 0.5 # radius of sphere micrometers -variable a equal $R/5 # lattice spacing micrometers -variable a equal 0.5/5 -variable Lf equal $R*3 -variable Lf equal 0.5*3 -variable Lb equal $R*4 -variable Lb equal 0.5*4 -variable wall_velocity equal 0.01 # micrometers/microsecond -variable T equal 300. -variable rho_0 equal 1. # density picograms/micrometer^3 -variable c_0 equal 100. # speed of sound micrometers/microsecond -variable mu equal 1. # dynamic viscosity picogram/(micrometer-microsecond) -variable h equal $a*4.5 # kernel function cutoff micrometers -variable h equal 0.1*4.5 -variable mass equal $a*$a*$a*${rho_0} -variable mass equal 0.1*$a*$a*${rho_0} -variable mass equal 0.1*0.1*$a*${rho_0} -variable mass equal 0.1*0.1*0.1*${rho_0} -variable mass equal 0.1*0.1*0.1*1 -variable dt equal 1e-3 # timestep microseconds -variable skin equal 0.2*$h -variable skin equal 0.2*0.45 - -region box block -${Lb} ${Lb} -${Lb} ${Lb} 0 ${a} units box -region box block -2 ${Lb} -${Lb} ${Lb} 0 ${a} units box -region box block -2 2 -${Lb} ${Lb} 0 ${a} units box -region box block -2 2 -2 ${Lb} 0 ${a} units box -region box block -2 2 -2 2 0 ${a} units box -region box block -2 2 -2 2 0 0.1 units box -create_box 4 box -Created orthogonal box = (-2 -2 0) to (2 2 0.1) - 1 by 1 by 1 MPI processor grid -lattice sq $a -lattice sq 0.1 -Lattice spacing in x,y,z = 0.1 0.1 0.1 - -create_atoms 1 box -Created 1600 atoms - Time spent = 0.00169706 secs - -region sphere sphere 0 0 0 $R units box -region sphere sphere 0 0 0 0.5 units box -set region sphere type 2 - 81 settings made for type - -region upper_wall block INF INF +${Lf} INF INF INF units box -region upper_wall block INF INF +1.5 INF INF INF units box -set region upper_wall type 3 - 200 settings made for type - -region lower_wall block INF INF INF -${Lf} INF INF units box -region lower_wall block INF INF INF -1.5 INF INF units box -set region lower_wall type 4 - 240 settings made for type - -group fluid type 1 -1079 atoms in group fluid -group sphere type 2 -81 atoms in group sphere -group upper_wall type 3 -200 atoms in group upper_wall -group lower_wall type 4 -240 atoms in group lower_wall - -mass * ${mass} -mass * 0.001 -set group all meso/rho ${rho_0} -set group all meso/rho 1 - 1600 settings made for meso/rho - -pair_style sdpd/taitwater/isothermal $T ${mu} 76787 # temperature viscosity random_seed -pair_style sdpd/taitwater/isothermal 300 ${mu} 76787 -pair_style sdpd/taitwater/isothermal 300 1 76787 -pair_coeff * * ${rho_0} ${c_0} ${h} -pair_coeff * * 1 ${c_0} ${h} -pair_coeff * * 1 100 ${h} -pair_coeff * * 1 100 0.45 - -fix 1 fluid meso -fix 2 sphere rigid/meso single -1 rigid bodies with 81 atoms -fix 3 upper_wall meso/move linear +${wall_velocity} 0 0 units box -fix 3 upper_wall meso/move linear +0.01 0 0 units box -fix 4 lower_wall meso/move linear -${wall_velocity} 0 0 units box -fix 4 lower_wall meso/move linear -0.01 0 0 units box - -fix 2d all enforce2d - -neighbor ${skin} bin -neighbor 0.09 bin -neigh_modify delay 0 every 1 check yes -timestep ${dt} -timestep 0.001 - -dump dump_id all atom 100 dump.lammpstrj - -thermo 100 -thermo_style custom step time nbuild ndanger - -run 10000 -Neighbor list info ... - update every 1 steps, delay 0 steps, check yes - max neighbors/atom: 2000, page size: 100000 - master list distance cutoff = 0.54 - ghost atom cutoff = 0.54 - binsize = 0.27, bins = 15 15 1 - 1 neighbor lists, perpetual/occasional/extra = 1 0 0 - (1) pair sdpd/taitwater/isothermal, perpetual - attributes: half, newton on - pair build: half/bin/atomonly/newton - stencil: half/bin/2d/newton - bin: standard -Per MPI rank memory allocation (min/avg/max) = 6.937 | 6.937 | 6.937 Mbytes -Step Time Nbuild Ndanger - 0 0 0 0 - 100 0.1 0 0 - 200 0.2 0 0 - 300 0.3 0 0 - 400 0.4 0 0 - 500 0.5 1 0 - 600 0.6 1 0 - 700 0.7 2 0 - 800 0.8 2 0 - 900 0.9 2 0 - 1000 1 3 0 - 1100 1.1 3 0 - 1200 1.2 3 0 - 1300 1.3 4 0 - 1400 1.4 4 0 - 1500 1.5 4 0 - 1600 1.6 5 0 - 1700 1.7 5 0 - 1800 1.8 5 0 - 1900 1.9 6 0 - 2000 2 6 0 - 2100 2.1 6 0 - 2200 2.2 7 0 - 2300 2.3 7 0 - 2400 2.4 7 0 - 2500 2.5 8 0 - 2600 2.6 8 0 - 2700 2.7 8 0 - 2800 2.8 9 0 - 2900 2.9 9 0 - 3000 3 9 0 - 3100 3.1 10 0 - 3200 3.2 10 0 - 3300 3.3 10 0 - 3400 3.4 11 0 - 3500 3.5 11 0 - 3600 3.6 11 0 - 3700 3.7 12 0 - 3800 3.8 12 0 - 3900 3.9 12 0 - 4000 4 13 0 - 4100 4.1 13 0 - 4200 4.2 14 0 - 4300 4.3 14 0 - 4400 4.4 14 0 - 4500 4.5 15 0 - 4600 4.6 15 0 - 4700 4.7 15 0 - 4800 4.8 16 0 - 4900 4.9 16 0 - 5000 5 16 0 - 5100 5.1 17 0 - 5200 5.2 17 0 - 5300 5.3 17 0 - 5400 5.4 17 0 - 5500 5.5 18 0 - 5600 5.6 18 0 - 5700 5.7 19 0 - 5800 5.8 19 0 - 5900 5.9 19 0 - 6000 6 20 0 - 6100 6.1 20 0 - 6200 6.2 21 0 - 6300 6.3 21 0 - 6400 6.4 21 0 - 6500 6.5 22 0 - 6600 6.6 22 0 - 6700 6.7 22 0 - 6800 6.8 23 0 - 6900 6.9 23 0 - 7000 7 23 0 - 7100 7.1 24 0 - 7200 7.2 24 0 - 7300 7.3 25 0 - 7400 7.4 25 0 - 7500 7.5 25 0 - 7600 7.6 26 0 - 7700 7.7 26 0 - 7800 7.8 26 0 - 7900 7.9 27 0 - 8000 8 27 0 - 8100 8.1 27 0 - 8200 8.2 28 0 - 8300 8.3 28 0 - 8400 8.4 28 0 - 8500 8.5 29 0 - 8600 8.6 29 0 - 8700 8.7 30 0 - 8800 8.8 30 0 - 8900 8.9 30 0 - 9000 9 31 0 - 9100 9.1 31 0 - 9200 9.2 31 0 - 9300 9.3 32 0 - 9400 9.4 32 0 - 9500 9.5 32 0 - 9600 9.6 33 0 - 9700 9.7 33 0 - 9800 9.8 33 0 - 9900 9.9 34 0 - 10000 10 34 0 -Loop time of 144.208 on 1 procs for 10000 steps with 1600 atoms - -Performance: 5991348.580 ns/day, 0.000 hours/ns, 69.344 timesteps/s -99.7% CPU use with 1 MPI tasks x no OpenMP threads - -MPI task timing breakdown: -Section | min time | avg time | max time |%varavg| %total ---------------------------------------------------------------- -Pair | 143.08 | 143.08 | 143.08 | 0.0 | 99.22 -Neigh | 0.033195 | 0.033195 | 0.033195 | 0.0 | 0.02 -Comm | 0.24139 | 0.24139 | 0.24139 | 0.0 | 0.17 -Output | 0.11687 | 0.11687 | 0.11687 | 0.0 | 0.08 -Modify | 0.61566 | 0.61566 | 0.61566 | 0.0 | 0.43 -Other | | 0.117 | | | 0.08 - -Nlocal: 1600 ave 1600 max 1600 min -Histogram: 1 0 0 0 0 0 0 0 0 0 -Nghost: 993 ave 993 max 993 min -Histogram: 1 0 0 0 0 0 0 0 0 0 -Neighs: 73236 ave 73236 max 73236 min -Histogram: 1 0 0 0 0 0 0 0 0 0 - -Total # of neighbors = 73236 -Ave neighs/atom = 45.7725 -Neighbor list builds = 34 -Dangerous builds = 0 -Total wall time: 0:02:24 diff --git a/examples/PACKAGES/dpd-smooth/2d-diffusion-in-shear-flow/log.24Oct18.2d-diffusion-in-shear-flow.g++.4 b/examples/PACKAGES/dpd-smooth/2d-diffusion-in-shear-flow/log.24Oct18.2d-diffusion-in-shear-flow.g++.4 deleted file mode 100644 index 77823e00fc..0000000000 --- a/examples/PACKAGES/dpd-smooth/2d-diffusion-in-shear-flow/log.24Oct18.2d-diffusion-in-shear-flow.g++.4 +++ /dev/null @@ -1,247 +0,0 @@ -LAMMPS (24 Oct 2018) -dimension 2 -units micro -atom_style meso - -variable R equal 0.5 # radius of sphere micrometers -variable a equal $R/5 # lattice spacing micrometers -variable a equal 0.5/5 -variable Lf equal $R*3 -variable Lf equal 0.5*3 -variable Lb equal $R*4 -variable Lb equal 0.5*4 -variable wall_velocity equal 0.01 # micrometers/microsecond -variable T equal 300. -variable rho_0 equal 1. # density picograms/micrometer^3 -variable c_0 equal 100. # speed of sound micrometers/microsecond -variable mu equal 1. # dynamic viscosity picogram/(micrometer-microsecond) -variable h equal $a*4.5 # kernel function cutoff micrometers -variable h equal 0.1*4.5 -variable mass equal $a*$a*$a*${rho_0} -variable mass equal 0.1*$a*$a*${rho_0} -variable mass equal 0.1*0.1*$a*${rho_0} -variable mass equal 0.1*0.1*0.1*${rho_0} -variable mass equal 0.1*0.1*0.1*1 -variable dt equal 1e-3 # timestep microseconds -variable skin equal 0.2*$h -variable skin equal 0.2*0.45 - -region box block -${Lb} ${Lb} -${Lb} ${Lb} 0 ${a} units box -region box block -2 ${Lb} -${Lb} ${Lb} 0 ${a} units box -region box block -2 2 -${Lb} ${Lb} 0 ${a} units box -region box block -2 2 -2 ${Lb} 0 ${a} units box -region box block -2 2 -2 2 0 ${a} units box -region box block -2 2 -2 2 0 0.1 units box -create_box 4 box -Created orthogonal box = (-2 -2 0) to (2 2 0.1) - 2 by 2 by 1 MPI processor grid -lattice sq $a -lattice sq 0.1 -Lattice spacing in x,y,z = 0.1 0.1 0.1 - -create_atoms 1 box -Created 1600 atoms - Time spent = 0.000589566 secs - -region sphere sphere 0 0 0 $R units box -region sphere sphere 0 0 0 0.5 units box -set region sphere type 2 - 81 settings made for type - -region upper_wall block INF INF +${Lf} INF INF INF units box -region upper_wall block INF INF +1.5 INF INF INF units box -set region upper_wall type 3 - 200 settings made for type - -region lower_wall block INF INF INF -${Lf} INF INF units box -region lower_wall block INF INF INF -1.5 INF INF units box -set region lower_wall type 4 - 240 settings made for type - -group fluid type 1 -1079 atoms in group fluid -group sphere type 2 -81 atoms in group sphere -group upper_wall type 3 -200 atoms in group upper_wall -group lower_wall type 4 -240 atoms in group lower_wall - -mass * ${mass} -mass * 0.001 -set group all meso/rho ${rho_0} -set group all meso/rho 1 - 1600 settings made for meso/rho - -pair_style sdpd/taitwater/isothermal $T ${mu} 76787 # temperature viscosity random_seed -pair_style sdpd/taitwater/isothermal 300 ${mu} 76787 -pair_style sdpd/taitwater/isothermal 300 1 76787 -pair_coeff * * ${rho_0} ${c_0} ${h} -pair_coeff * * 1 ${c_0} ${h} -pair_coeff * * 1 100 ${h} -pair_coeff * * 1 100 0.45 - -fix 1 fluid meso -fix 2 sphere rigid/meso single -1 rigid bodies with 81 atoms -fix 3 upper_wall meso/move linear +${wall_velocity} 0 0 units box -fix 3 upper_wall meso/move linear +0.01 0 0 units box -fix 4 lower_wall meso/move linear -${wall_velocity} 0 0 units box -fix 4 lower_wall meso/move linear -0.01 0 0 units box - -fix 2d all enforce2d - -neighbor ${skin} bin -neighbor 0.09 bin -neigh_modify delay 0 every 1 check yes -timestep ${dt} -timestep 0.001 - -dump dump_id all atom 100 dump.lammpstrj - -thermo 100 -thermo_style custom step time nbuild ndanger - -run 10000 -Neighbor list info ... - update every 1 steps, delay 0 steps, check yes - max neighbors/atom: 2000, page size: 100000 - master list distance cutoff = 0.54 - ghost atom cutoff = 0.54 - binsize = 0.27, bins = 15 15 1 - 1 neighbor lists, perpetual/occasional/extra = 1 0 0 - (1) pair sdpd/taitwater/isothermal, perpetual - attributes: half, newton on - pair build: half/bin/atomonly/newton - stencil: half/bin/2d/newton - bin: standard -Per MPI rank memory allocation (min/avg/max) = 6.854 | 6.854 | 6.854 Mbytes -Step Time Nbuild Ndanger - 0 0 0 0 - 100 0.1 0 0 - 200 0.2 0 0 - 300 0.3 0 0 - 400 0.4 1 0 - 500 0.5 1 0 - 600 0.6 1 0 - 700 0.7 2 0 - 800 0.8 2 0 - 900 0.9 2 0 - 1000 1 3 0 - 1100 1.1 3 0 - 1200 1.2 4 0 - 1300 1.3 4 0 - 1400 1.4 4 0 - 1500 1.5 4 0 - 1600 1.6 5 0 - 1700 1.7 5 0 - 1800 1.8 5 0 - 1900 1.9 6 0 - 2000 2 6 0 - 2100 2.1 6 0 - 2200 2.2 6 0 - 2300 2.3 7 0 - 2400 2.4 7 0 - 2500 2.5 7 0 - 2600 2.6 8 0 - 2700 2.7 8 0 - 2800 2.8 8 0 - 2900 2.9 9 0 - 3000 3 9 0 - 3100 3.1 9 0 - 3200 3.2 10 0 - 3300 3.3 10 0 - 3400 3.4 10 0 - 3500 3.5 11 0 - 3600 3.6 11 0 - 3700 3.7 11 0 - 3800 3.8 12 0 - 3900 3.9 12 0 - 4000 4 12 0 - 4100 4.1 13 0 - 4200 4.2 13 0 - 4300 4.3 13 0 - 4400 4.4 14 0 - 4500 4.5 14 0 - 4600 4.6 15 0 - 4700 4.7 15 0 - 4800 4.8 15 0 - 4900 4.9 16 0 - 5000 5 16 0 - 5100 5.1 17 0 - 5200 5.2 17 0 - 5300 5.3 17 0 - 5400 5.4 17 0 - 5500 5.5 18 0 - 5600 5.6 18 0 - 5700 5.7 18 0 - 5800 5.8 19 0 - 5900 5.9 19 0 - 6000 6 20 0 - 6100 6.1 20 0 - 6200 6.2 20 0 - 6300 6.3 21 0 - 6400 6.4 21 0 - 6500 6.5 21 0 - 6600 6.6 22 0 - 6700 6.7 22 0 - 6800 6.8 22 0 - 6900 6.9 23 0 - 7000 7 23 0 - 7100 7.1 23 0 - 7200 7.2 24 0 - 7300 7.3 24 0 - 7400 7.4 25 0 - 7500 7.5 25 0 - 7600 7.6 25 0 - 7700 7.7 25 0 - 7800 7.8 26 0 - 7900 7.9 26 0 - 8000 8 26 0 - 8100 8.1 27 0 - 8200 8.2 27 0 - 8300 8.3 27 0 - 8400 8.4 28 0 - 8500 8.5 28 0 - 8600 8.6 28 0 - 8700 8.7 29 0 - 8800 8.8 29 0 - 8900 8.9 29 0 - 9000 9 30 0 - 9100 9.1 30 0 - 9200 9.2 31 0 - 9300 9.3 31 0 - 9400 9.4 31 0 - 9500 9.5 32 0 - 9600 9.6 32 0 - 9700 9.7 32 0 - 9800 9.8 32 0 - 9900 9.9 33 0 - 10000 10 33 0 -Loop time of 63.2372 on 4 procs for 10000 steps with 1600 atoms - -Performance: 13662841.706 ns/day, 0.000 hours/ns, 158.135 timesteps/s -94.3% CPU use with 4 MPI tasks x no OpenMP threads - -MPI task timing breakdown: -Section | min time | avg time | max time |%varavg| %total ---------------------------------------------------------------- -Pair | 51.576 | 53.662 | 55.484 | 23.9 | 84.86 -Neigh | 0.011519 | 0.012395 | 0.013405 | 0.7 | 0.02 -Comm | 6.8389 | 8.5423 | 10.517 | 56.1 | 13.51 -Output | 0.12342 | 0.12513 | 0.1302 | 0.8 | 0.20 -Modify | 0.58708 | 0.69128 | 0.78806 | 11.3 | 1.09 -Other | | 0.2038 | | | 0.32 - -Nlocal: 400 ave 411 max 388 min -Histogram: 1 1 0 0 0 0 0 0 0 2 -Nghost: 552.25 ave 567 max 539 min -Histogram: 2 0 0 0 0 0 0 0 1 1 -Neighs: 18298.8 ave 18781 max 17829 min -Histogram: 2 0 0 0 0 0 0 0 0 2 - -Total # of neighbors = 73195 -Ave neighs/atom = 45.7469 -Neighbor list builds = 33 -Dangerous builds = 0 -Total wall time: 0:01:03 diff --git a/examples/PACKAGES/dpd-smooth/2d-diffusion-in-shear-flow/log.28Mar23.2d-diffusion-in-shear-flow.g++.1 b/examples/PACKAGES/dpd-smooth/2d-diffusion-in-shear-flow/log.28Mar23.2d-diffusion-in-shear-flow.g++.1 new file mode 100644 index 0000000000..c4c11205e1 --- /dev/null +++ b/examples/PACKAGES/dpd-smooth/2d-diffusion-in-shear-flow/log.28Mar23.2d-diffusion-in-shear-flow.g++.1 @@ -0,0 +1,253 @@ +LAMMPS (28 Mar 2023 - Development) +dimension 2 +units micro +atom_style sph + +variable R equal 0.5 # radius of sphere micrometers +variable a equal $R/5 # lattice spacing micrometers +variable a equal 0.5/5 +variable Lf equal $R*3 +variable Lf equal 0.5*3 +variable Lb equal $R*4 +variable Lb equal 0.5*4 +variable wall_velocity equal 0.01 # micrometers/microsecond +variable T equal 300. +variable rho_0 equal 1. # density picograms/micrometer^3 +variable c_0 equal 100. # speed of sound micrometers/microsecond +variable mu equal 1. # dynamic viscosity picogram/(micrometer-microsecond) +variable h equal $a*4.5 # kernel function cutoff micrometers +variable h equal 0.1*4.5 +variable mass equal $a*$a*$a*${rho_0} +variable mass equal 0.1*$a*$a*${rho_0} +variable mass equal 0.1*0.1*$a*${rho_0} +variable mass equal 0.1*0.1*0.1*${rho_0} +variable mass equal 0.1*0.1*0.1*1 +variable dt equal 1e-3 # timestep microseconds +variable skin equal 0.2*$h +variable skin equal 0.2*0.45 + +region box block -${Lb} ${Lb} -${Lb} ${Lb} 0 ${a} units box +region box block -2 ${Lb} -${Lb} ${Lb} 0 ${a} units box +region box block -2 2 -${Lb} ${Lb} 0 ${a} units box +region box block -2 2 -2 ${Lb} 0 ${a} units box +region box block -2 2 -2 2 0 ${a} units box +region box block -2 2 -2 2 0 0.1 units box +create_box 4 box +Created orthogonal box = (-2 -2 0) to (2 2 0.1) + 1 by 1 by 1 MPI processor grid +lattice sq $a +lattice sq 0.1 +Lattice spacing in x,y,z = 0.1 0.1 0.1 + +create_atoms 1 box +Created 1600 atoms + using lattice units in orthogonal box = (-2 -2 0) to (2 2 0.1) + create_atoms CPU = 0.001 seconds + +region sphere sphere 0 0 0 $R units box +region sphere sphere 0 0 0 0.5 units box +set region sphere type 2 +Setting atom values ... + 81 settings made for type + +region upper_wall block INF INF +${Lf} INF INF INF units box +region upper_wall block INF INF +1.5 INF INF INF units box +set region upper_wall type 3 +Setting atom values ... + 200 settings made for type + +region lower_wall block INF INF INF -${Lf} INF INF units box +region lower_wall block INF INF INF -1.5 INF INF units box +set region lower_wall type 4 +Setting atom values ... + 240 settings made for type + +group fluid type 1 +1079 atoms in group fluid +group sphere type 2 +81 atoms in group sphere +group upper_wall type 3 +200 atoms in group upper_wall +group lower_wall type 4 +240 atoms in group lower_wall + +mass * ${mass} +mass * 0.001 +set group all sph/rho ${rho_0} +set group all sph/rho 1 +Setting atom values ... + 1600 settings made for sph/rho + +pair_style sdpd/taitwater/isothermal $T ${mu} 76787 # temperature viscosity random_seed +pair_style sdpd/taitwater/isothermal 300 ${mu} 76787 +pair_style sdpd/taitwater/isothermal 300 1 76787 +pair_coeff * * ${rho_0} ${c_0} ${h} +pair_coeff * * 1 ${c_0} ${h} +pair_coeff * * 1 100 ${h} +pair_coeff * * 1 100 0.45 + +fix 1 fluid sph +fix 2 sphere rigid/meso single + 1 rigid bodies with 81 atoms +fix 3 upper_wall meso/move linear +${wall_velocity} 0 0 units box +fix 3 upper_wall meso/move linear +0.01 0 0 units box +fix 4 lower_wall meso/move linear -${wall_velocity} 0 0 units box +fix 4 lower_wall meso/move linear -0.01 0 0 units box + +fix 2d all enforce2d + +neighbor ${skin} bin +neighbor 0.09 bin +neigh_modify delay 0 every 1 check yes +timestep ${dt} +timestep 0.001 + +dump dump_id all atom 100 dump.lammpstrj + +thermo 100 +thermo_style custom step time nbuild ndanger + +run 10000 +Generated 0 of 6 mixed pair_coeff terms from geometric mixing rule +Neighbor list info ... + update: every = 1 steps, delay = 0 steps, check = yes + max neighbors/atom: 2000, page size: 100000 + master list distance cutoff = 0.54 + ghost atom cutoff = 0.54 + binsize = 0.27, bins = 15 15 1 + 1 neighbor lists, perpetual/occasional/extra = 1 0 0 + (1) pair sdpd/taitwater/isothermal, perpetual + attributes: half, newton on + pair build: half/bin/atomonly/newton + stencil: half/bin/2d + bin: standard +Per MPI rank memory allocation (min/avg/max) = 7.313 | 7.313 | 7.313 Mbytes + Step Time Nbuild Ndanger + 0 0 0 0 + 100 0.1 0 0 + 200 0.2 0 0 + 300 0.3 0 0 + 400 0.4 0 0 + 500 0.5 1 0 + 600 0.6 1 0 + 700 0.7 2 0 + 800 0.8 2 0 + 900 0.9 2 0 + 1000 1 3 0 + 1100 1.1 3 0 + 1200 1.2 3 0 + 1300 1.3 4 0 + 1400 1.4 4 0 + 1500 1.5 4 0 + 1600 1.6 5 0 + 1700 1.7 5 0 + 1800 1.8 5 0 + 1900 1.9 6 0 + 2000 2 6 0 + 2100 2.1 6 0 + 2200 2.2 7 0 + 2300 2.3 7 0 + 2400 2.4 7 0 + 2500 2.5 8 0 + 2600 2.6 8 0 + 2700 2.7 8 0 + 2800 2.8 9 0 + 2900 2.9 9 0 + 3000 3 9 0 + 3100 3.1 10 0 + 3200 3.2 10 0 + 3300 3.3 10 0 + 3400 3.4 11 0 + 3500 3.5 11 0 + 3600 3.6 11 0 + 3700 3.7 12 0 + 3800 3.8 12 0 + 3900 3.9 12 0 + 4000 4 13 0 + 4100 4.1 13 0 + 4200 4.2 14 0 + 4300 4.3 14 0 + 4400 4.4 14 0 + 4500 4.5 15 0 + 4600 4.6 15 0 + 4700 4.7 15 0 + 4800 4.8 16 0 + 4900 4.9 16 0 + 5000 5 16 0 + 5100 5.1 17 0 + 5200 5.2 17 0 + 5300 5.3 17 0 + 5400 5.4 17 0 + 5500 5.5 18 0 + 5600 5.6 18 0 + 5700 5.7 19 0 + 5800 5.8 19 0 + 5900 5.9 19 0 + 6000 6 20 0 + 6100 6.1 20 0 + 6200 6.2 21 0 + 6300 6.3 21 0 + 6400 6.4 21 0 + 6500 6.5 22 0 + 6600 6.6 22 0 + 6700 6.7 22 0 + 6800 6.8 23 0 + 6900 6.9 23 0 + 7000 7 23 0 + 7100 7.1 24 0 + 7200 7.2 24 0 + 7300 7.3 25 0 + 7400 7.4 25 0 + 7500 7.5 25 0 + 7600 7.6 26 0 + 7700 7.7 26 0 + 7800 7.8 26 0 + 7900 7.9 27 0 + 8000 8 27 0 + 8100 8.1 27 0 + 8200 8.2 28 0 + 8300 8.3 28 0 + 8400 8.4 28 0 + 8500 8.5 29 0 + 8600 8.6 29 0 + 8700 8.7 30 0 + 8800 8.8 30 0 + 8900 8.9 30 0 + 9000 9 31 0 + 9100 9.1 31 0 + 9200 9.2 31 0 + 9300 9.3 32 0 + 9400 9.4 32 0 + 9500 9.5 32 0 + 9600 9.6 33 0 + 9700 9.7 33 0 + 9800 9.8 33 0 + 9900 9.9 34 0 + 10000 10 34 0 +Loop time of 131.724 on 1 procs for 10000 steps with 1600 atoms + +Performance: 6559168.339 ns/day, 0.000 hours/ns, 75.916 timesteps/s, 121.466 katom-step/s +99.7% CPU use with 1 MPI tasks x no OpenMP threads + +MPI task timing breakdown: +Section | min time | avg time | max time |%varavg| %total +--------------------------------------------------------------- +Pair | 130.89 | 130.89 | 130.89 | 0.0 | 99.37 +Neigh | 0.02884 | 0.02884 | 0.02884 | 0.0 | 0.02 +Comm | 0.17863 | 0.17863 | 0.17863 | 0.0 | 0.14 +Output | 0.095497 | 0.095497 | 0.095497 | 0.0 | 0.07 +Modify | 0.42063 | 0.42063 | 0.42063 | 0.0 | 0.32 +Other | | 0.1069 | | | 0.08 + +Nlocal: 1600 ave 1600 max 1600 min +Histogram: 1 0 0 0 0 0 0 0 0 0 +Nghost: 993 ave 993 max 993 min +Histogram: 1 0 0 0 0 0 0 0 0 0 +Neighs: 73236 ave 73236 max 73236 min +Histogram: 1 0 0 0 0 0 0 0 0 0 + +Total # of neighbors = 73236 +Ave neighs/atom = 45.7725 +Neighbor list builds = 34 +Dangerous builds = 0 +Total wall time: 0:02:11 diff --git a/examples/PACKAGES/dpd-smooth/2d-diffusion-in-shear-flow/log.28Mar23.2d-diffusion-in-shear-flow.g++.4 b/examples/PACKAGES/dpd-smooth/2d-diffusion-in-shear-flow/log.28Mar23.2d-diffusion-in-shear-flow.g++.4 new file mode 100644 index 0000000000..6cb58bc233 --- /dev/null +++ b/examples/PACKAGES/dpd-smooth/2d-diffusion-in-shear-flow/log.28Mar23.2d-diffusion-in-shear-flow.g++.4 @@ -0,0 +1,253 @@ +LAMMPS (28 Mar 2023 - Development) +dimension 2 +units micro +atom_style sph + +variable R equal 0.5 # radius of sphere micrometers +variable a equal $R/5 # lattice spacing micrometers +variable a equal 0.5/5 +variable Lf equal $R*3 +variable Lf equal 0.5*3 +variable Lb equal $R*4 +variable Lb equal 0.5*4 +variable wall_velocity equal 0.01 # micrometers/microsecond +variable T equal 300. +variable rho_0 equal 1. # density picograms/micrometer^3 +variable c_0 equal 100. # speed of sound micrometers/microsecond +variable mu equal 1. # dynamic viscosity picogram/(micrometer-microsecond) +variable h equal $a*4.5 # kernel function cutoff micrometers +variable h equal 0.1*4.5 +variable mass equal $a*$a*$a*${rho_0} +variable mass equal 0.1*$a*$a*${rho_0} +variable mass equal 0.1*0.1*$a*${rho_0} +variable mass equal 0.1*0.1*0.1*${rho_0} +variable mass equal 0.1*0.1*0.1*1 +variable dt equal 1e-3 # timestep microseconds +variable skin equal 0.2*$h +variable skin equal 0.2*0.45 + +region box block -${Lb} ${Lb} -${Lb} ${Lb} 0 ${a} units box +region box block -2 ${Lb} -${Lb} ${Lb} 0 ${a} units box +region box block -2 2 -${Lb} ${Lb} 0 ${a} units box +region box block -2 2 -2 ${Lb} 0 ${a} units box +region box block -2 2 -2 2 0 ${a} units box +region box block -2 2 -2 2 0 0.1 units box +create_box 4 box +Created orthogonal box = (-2 -2 0) to (2 2 0.1) + 2 by 2 by 1 MPI processor grid +lattice sq $a +lattice sq 0.1 +Lattice spacing in x,y,z = 0.1 0.1 0.1 + +create_atoms 1 box +Created 1600 atoms + using lattice units in orthogonal box = (-2 -2 0) to (2 2 0.1) + create_atoms CPU = 0.001 seconds + +region sphere sphere 0 0 0 $R units box +region sphere sphere 0 0 0 0.5 units box +set region sphere type 2 +Setting atom values ... + 81 settings made for type + +region upper_wall block INF INF +${Lf} INF INF INF units box +region upper_wall block INF INF +1.5 INF INF INF units box +set region upper_wall type 3 +Setting atom values ... + 200 settings made for type + +region lower_wall block INF INF INF -${Lf} INF INF units box +region lower_wall block INF INF INF -1.5 INF INF units box +set region lower_wall type 4 +Setting atom values ... + 240 settings made for type + +group fluid type 1 +1079 atoms in group fluid +group sphere type 2 +81 atoms in group sphere +group upper_wall type 3 +200 atoms in group upper_wall +group lower_wall type 4 +240 atoms in group lower_wall + +mass * ${mass} +mass * 0.001 +set group all sph/rho ${rho_0} +set group all sph/rho 1 +Setting atom values ... + 1600 settings made for sph/rho + +pair_style sdpd/taitwater/isothermal $T ${mu} 76787 # temperature viscosity random_seed +pair_style sdpd/taitwater/isothermal 300 ${mu} 76787 +pair_style sdpd/taitwater/isothermal 300 1 76787 +pair_coeff * * ${rho_0} ${c_0} ${h} +pair_coeff * * 1 ${c_0} ${h} +pair_coeff * * 1 100 ${h} +pair_coeff * * 1 100 0.45 + +fix 1 fluid sph +fix 2 sphere rigid/meso single + 1 rigid bodies with 81 atoms +fix 3 upper_wall meso/move linear +${wall_velocity} 0 0 units box +fix 3 upper_wall meso/move linear +0.01 0 0 units box +fix 4 lower_wall meso/move linear -${wall_velocity} 0 0 units box +fix 4 lower_wall meso/move linear -0.01 0 0 units box + +fix 2d all enforce2d + +neighbor ${skin} bin +neighbor 0.09 bin +neigh_modify delay 0 every 1 check yes +timestep ${dt} +timestep 0.001 + +dump dump_id all atom 100 dump.lammpstrj + +thermo 100 +thermo_style custom step time nbuild ndanger + +run 10000 +Generated 0 of 6 mixed pair_coeff terms from geometric mixing rule +Neighbor list info ... + update: every = 1 steps, delay = 0 steps, check = yes + max neighbors/atom: 2000, page size: 100000 + master list distance cutoff = 0.54 + ghost atom cutoff = 0.54 + binsize = 0.27, bins = 15 15 1 + 1 neighbor lists, perpetual/occasional/extra = 1 0 0 + (1) pair sdpd/taitwater/isothermal, perpetual + attributes: half, newton on + pair build: half/bin/atomonly/newton + stencil: half/bin/2d + bin: standard +Per MPI rank memory allocation (min/avg/max) = 7.23 | 7.23 | 7.23 Mbytes + Step Time Nbuild Ndanger + 0 0 0 0 + 100 0.1 0 0 + 200 0.2 0 0 + 300 0.3 0 0 + 400 0.4 1 0 + 500 0.5 1 0 + 600 0.6 1 0 + 700 0.7 2 0 + 800 0.8 2 0 + 900 0.9 2 0 + 1000 1 3 0 + 1100 1.1 3 0 + 1200 1.2 3 0 + 1300 1.3 4 0 + 1400 1.4 4 0 + 1500 1.5 4 0 + 1600 1.6 5 0 + 1700 1.7 5 0 + 1800 1.8 5 0 + 1900 1.9 6 0 + 2000 2 6 0 + 2100 2.1 6 0 + 2200 2.2 7 0 + 2300 2.3 7 0 + 2400 2.4 7 0 + 2500 2.5 8 0 + 2600 2.6 8 0 + 2700 2.7 8 0 + 2800 2.8 9 0 + 2900 2.9 9 0 + 3000 3 9 0 + 3100 3.1 10 0 + 3200 3.2 10 0 + 3300 3.3 10 0 + 3400 3.4 11 0 + 3500 3.5 11 0 + 3600 3.6 11 0 + 3700 3.7 12 0 + 3800 3.8 12 0 + 3900 3.9 12 0 + 4000 4 13 0 + 4100 4.1 13 0 + 4200 4.2 13 0 + 4300 4.3 14 0 + 4400 4.4 14 0 + 4500 4.5 14 0 + 4600 4.6 14 0 + 4700 4.7 15 0 + 4800 4.8 15 0 + 4900 4.9 16 0 + 5000 5 16 0 + 5100 5.1 16 0 + 5200 5.2 17 0 + 5300 5.3 17 0 + 5400 5.4 17 0 + 5500 5.5 18 0 + 5600 5.6 18 0 + 5700 5.7 18 0 + 5800 5.8 19 0 + 5900 5.9 19 0 + 6000 6 20 0 + 6100 6.1 20 0 + 6200 6.2 20 0 + 6300 6.3 21 0 + 6400 6.4 21 0 + 6500 6.5 21 0 + 6600 6.6 22 0 + 6700 6.7 22 0 + 6800 6.8 22 0 + 6900 6.9 23 0 + 7000 7 23 0 + 7100 7.1 23 0 + 7200 7.2 24 0 + 7300 7.3 24 0 + 7400 7.4 24 0 + 7500 7.5 25 0 + 7600 7.6 25 0 + 7700 7.7 25 0 + 7800 7.8 25 0 + 7900 7.9 26 0 + 8000 8 26 0 + 8100 8.1 26 0 + 8200 8.2 27 0 + 8300 8.3 27 0 + 8400 8.4 28 0 + 8500 8.5 28 0 + 8600 8.6 28 0 + 8700 8.7 29 0 + 8800 8.8 29 0 + 8900 8.9 29 0 + 9000 9 30 0 + 9100 9.1 30 0 + 9200 9.2 30 0 + 9300 9.3 31 0 + 9400 9.4 31 0 + 9500 9.5 31 0 + 9600 9.6 32 0 + 9700 9.7 32 0 + 9800 9.8 32 0 + 9900 9.9 32 0 + 10000 10 33 0 +Loop time of 24.8261 on 4 procs for 10000 steps with 1600 atoms + +Performance: 34802055.618 ns/day, 0.000 hours/ns, 402.802 timesteps/s, 644.483 katom-step/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 | 21.84 | 22.879 | 23.944 | 21.4 | 92.16 +Neigh | 0.007446 | 0.0079435 | 0.0084435 | 0.6 | 0.03 +Comm | 0.5271 | 1.5894 | 2.6259 | 80.9 | 6.40 +Output | 0.034799 | 0.035302 | 0.036437 | 0.4 | 0.14 +Modify | 0.20079 | 0.21033 | 0.2202 | 1.7 | 0.85 +Other | | 0.1041 | | | 0.42 + +Nlocal: 400 ave 414 max 390 min +Histogram: 2 0 0 0 0 1 0 0 0 1 +Nghost: 555.5 ave 564 max 543 min +Histogram: 1 0 0 0 1 0 0 0 0 2 +Neighs: 18299.2 ave 18820 max 17906 min +Histogram: 1 1 0 0 0 0 1 0 0 1 + +Total # of neighbors = 73197 +Ave neighs/atom = 45.748125 +Neighbor list builds = 33 +Dangerous builds = 0 +Total wall time: 0:00:24 diff --git a/examples/PACKAGES/dpd-smooth/2d-diffusion/in.lammps b/examples/PACKAGES/dpd-smooth/2d-diffusion/in.lammps index 6ef36a0cf6..2e0e821480 100644 --- a/examples/PACKAGES/dpd-smooth/2d-diffusion/in.lammps +++ b/examples/PACKAGES/dpd-smooth/2d-diffusion/in.lammps @@ -1,6 +1,6 @@ dimension 2 units micro -atom_style meso +atom_style sph variable R equal 0.5 # radius of sphere micrometers variable a equal $R/5 # lattice spacing micrometers @@ -27,12 +27,12 @@ group fluid type 1 group sphere type 2 mass * ${mass} -set group all meso/rho ${rho_0} +set group all sph/rho ${rho_0} pair_style sdpd/taitwater/isothermal $T ${mu} 76787 # temperature viscosity random_seed pair_coeff * * ${rho_0} ${c_0} ${h} -fix 1 fluid meso +fix 1 fluid sph fix 2 sphere rigid/meso single fix 2d all enforce2d diff --git a/examples/PACKAGES/dpd-smooth/2d-diffusion/log.24Oct18.2d-diffusion.g++.1 b/examples/PACKAGES/dpd-smooth/2d-diffusion/log.24Oct18.2d-diffusion.g++.1 deleted file mode 100644 index d44c0fd6f4..0000000000 --- a/examples/PACKAGES/dpd-smooth/2d-diffusion/log.24Oct18.2d-diffusion.g++.1 +++ /dev/null @@ -1,226 +0,0 @@ -LAMMPS (24 Oct 2018) -dimension 2 -units micro -atom_style meso - -variable R equal 0.5 # radius of sphere micrometers -variable a equal $R/5 # lattice spacing micrometers -variable a equal 0.5/5 -variable L equal $R*3 -variable L equal 0.5*3 -variable T equal 300. -variable rho_0 equal 1. # density picograms/micrometer^3 -variable c_0 equal 100. # speed of sound micrometers/microsecond -variable mu equal 1. # dynamic viscosity picogram/(micrometer-microsecond) -variable h equal $a*4.5 # kernel function cutoff micrometers -variable h equal 0.1*4.5 -variable mass equal $a*$a*$a*${rho_0} -variable mass equal 0.1*$a*$a*${rho_0} -variable mass equal 0.1*0.1*$a*${rho_0} -variable mass equal 0.1*0.1*0.1*${rho_0} -variable mass equal 0.1*0.1*0.1*1 -variable dt equal 1e-3 # timestep microseconds -variable skin equal 0.2*$h -variable skin equal 0.2*0.45 - -region box block -$L $L -$L $L 0 $a units box -region box block -1.5 $L -$L $L 0 $a units box -region box block -1.5 1.5 -$L $L 0 $a units box -region box block -1.5 1.5 -1.5 $L 0 $a units box -region box block -1.5 1.5 -1.5 1.5 0 $a units box -region box block -1.5 1.5 -1.5 1.5 0 0.1 units box -create_box 2 box -Created orthogonal box = (-1.5 -1.5 0) to (1.5 1.5 0.1) - 1 by 1 by 1 MPI processor grid -lattice sq $a -lattice sq 0.1 -Lattice spacing in x,y,z = 0.1 0.1 0.1 - -create_atoms 1 box -Created 900 atoms - Time spent = 0.0015769 secs - -region sphere sphere 0 0 0 $R units box -region sphere sphere 0 0 0 0.5 units box -set region sphere type 2 - 81 settings made for type - -group fluid type 1 -819 atoms in group fluid -group sphere type 2 -81 atoms in group sphere - -mass * ${mass} -mass * 0.001 -set group all meso/rho ${rho_0} -set group all meso/rho 1 - 900 settings made for meso/rho - -pair_style sdpd/taitwater/isothermal $T ${mu} 76787 # temperature viscosity random_seed -pair_style sdpd/taitwater/isothermal 300 ${mu} 76787 -pair_style sdpd/taitwater/isothermal 300 1 76787 -pair_coeff * * ${rho_0} ${c_0} ${h} -pair_coeff * * 1 ${c_0} ${h} -pair_coeff * * 1 100 ${h} -pair_coeff * * 1 100 0.45 - -fix 1 fluid meso -fix 2 sphere rigid/meso single -1 rigid bodies with 81 atoms - -fix 2d all enforce2d - -neighbor ${skin} bin -neighbor 0.09 bin -neigh_modify delay 0 every 1 check yes -timestep ${dt} -timestep 0.001 - -dump dump_id all atom 100 dump.lammpstrj - -thermo 100 -thermo_style custom step time nbuild ndanger - -run 10000 -Neighbor list info ... - update every 1 steps, delay 0 steps, check yes - max neighbors/atom: 2000, page size: 100000 - master list distance cutoff = 0.54 - ghost atom cutoff = 0.54 - binsize = 0.27, bins = 12 12 1 - 1 neighbor lists, perpetual/occasional/extra = 1 0 0 - (1) pair sdpd/taitwater/isothermal, perpetual - attributes: half, newton on - pair build: half/bin/atomonly/newton - stencil: half/bin/2d/newton - bin: standard -Per MPI rank memory allocation (min/avg/max) = 6.137 | 6.137 | 6.137 Mbytes -Step Time Nbuild Ndanger - 0 0 0 0 - 100 0.1 0 0 - 200 0.2 0 0 - 300 0.3 0 0 - 400 0.4 1 0 - 500 0.5 1 0 - 600 0.6 1 0 - 700 0.7 2 0 - 800 0.8 2 0 - 900 0.9 2 0 - 1000 1 3 0 - 1100 1.1 3 0 - 1200 1.2 3 0 - 1300 1.3 4 0 - 1400 1.4 4 0 - 1500 1.5 4 0 - 1600 1.6 5 0 - 1700 1.7 5 0 - 1800 1.8 6 0 - 1900 1.9 6 0 - 2000 2 6 0 - 2100 2.1 7 0 - 2200 2.2 7 0 - 2300 2.3 7 0 - 2400 2.4 7 0 - 2500 2.5 8 0 - 2600 2.6 8 0 - 2700 2.7 8 0 - 2800 2.8 9 0 - 2900 2.9 9 0 - 3000 3 10 0 - 3100 3.1 10 0 - 3200 3.2 10 0 - 3300 3.3 11 0 - 3400 3.4 11 0 - 3500 3.5 11 0 - 3600 3.6 12 0 - 3700 3.7 12 0 - 3800 3.8 12 0 - 3900 3.9 13 0 - 4000 4 13 0 - 4100 4.1 13 0 - 4200 4.2 14 0 - 4300 4.3 14 0 - 4400 4.4 14 0 - 4500 4.5 15 0 - 4600 4.6 15 0 - 4700 4.7 15 0 - 4800 4.8 16 0 - 4900 4.9 16 0 - 5000 5 17 0 - 5100 5.1 17 0 - 5200 5.2 17 0 - 5300 5.3 17 0 - 5400 5.4 18 0 - 5500 5.5 18 0 - 5600 5.6 18 0 - 5700 5.7 19 0 - 5800 5.8 19 0 - 5900 5.9 19 0 - 6000 6 19 0 - 6100 6.1 20 0 - 6200 6.2 20 0 - 6300 6.3 20 0 - 6400 6.4 21 0 - 6500 6.5 21 0 - 6600 6.6 21 0 - 6700 6.7 21 0 - 6800 6.8 22 0 - 6900 6.9 22 0 - 7000 7 22 0 - 7100 7.1 23 0 - 7200 7.2 23 0 - 7300 7.3 23 0 - 7400 7.4 24 0 - 7500 7.5 24 0 - 7600 7.6 24 0 - 7700 7.7 25 0 - 7800 7.8 25 0 - 7900 7.9 26 0 - 8000 8 26 0 - 8100 8.1 26 0 - 8200 8.2 26 0 - 8300 8.3 27 0 - 8400 8.4 27 0 - 8500 8.5 27 0 - 8600 8.6 28 0 - 8700 8.7 28 0 - 8800 8.8 28 0 - 8900 8.9 29 0 - 9000 9 29 0 - 9100 9.1 29 0 - 9200 9.2 30 0 - 9300 9.3 30 0 - 9400 9.4 30 0 - 9500 9.5 30 0 - 9600 9.6 31 0 - 9700 9.7 31 0 - 9800 9.8 32 0 - 9900 9.9 32 0 - 10000 10 32 0 -Loop time of 80.9456 on 1 procs for 10000 steps with 900 atoms - -Performance: 10673829.855 ns/day, 0.000 hours/ns, 123.540 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 | 80.306 | 80.306 | 80.306 | 0.0 | 99.21 -Neigh | 0.017418 | 0.017418 | 0.017418 | 0.0 | 0.02 -Comm | 0.16939 | 0.16939 | 0.16939 | 0.0 | 0.21 -Output | 0.070281 | 0.070281 | 0.070281 | 0.0 | 0.09 -Modify | 0.3154 | 0.3154 | 0.3154 | 0.0 | 0.39 -Other | | 0.067 | | | 0.08 - -Nlocal: 900 ave 900 max 900 min -Histogram: 1 0 0 0 0 0 0 0 0 0 -Nghost: 762 ave 762 max 762 min -Histogram: 1 0 0 0 0 0 0 0 0 0 -Neighs: 40697 ave 40697 max 40697 min -Histogram: 1 0 0 0 0 0 0 0 0 0 - -Total # of neighbors = 40697 -Ave neighs/atom = 45.2189 -Neighbor list builds = 32 -Dangerous builds = 0 -Total wall time: 0:01:20 diff --git a/examples/PACKAGES/dpd-smooth/2d-diffusion/log.24Oct18.2d-diffusion.g++.4 b/examples/PACKAGES/dpd-smooth/2d-diffusion/log.24Oct18.2d-diffusion.g++.4 deleted file mode 100644 index f904b78ab4..0000000000 --- a/examples/PACKAGES/dpd-smooth/2d-diffusion/log.24Oct18.2d-diffusion.g++.4 +++ /dev/null @@ -1,226 +0,0 @@ -LAMMPS (24 Oct 2018) -dimension 2 -units micro -atom_style meso - -variable R equal 0.5 # radius of sphere micrometers -variable a equal $R/5 # lattice spacing micrometers -variable a equal 0.5/5 -variable L equal $R*3 -variable L equal 0.5*3 -variable T equal 300. -variable rho_0 equal 1. # density picograms/micrometer^3 -variable c_0 equal 100. # speed of sound micrometers/microsecond -variable mu equal 1. # dynamic viscosity picogram/(micrometer-microsecond) -variable h equal $a*4.5 # kernel function cutoff micrometers -variable h equal 0.1*4.5 -variable mass equal $a*$a*$a*${rho_0} -variable mass equal 0.1*$a*$a*${rho_0} -variable mass equal 0.1*0.1*$a*${rho_0} -variable mass equal 0.1*0.1*0.1*${rho_0} -variable mass equal 0.1*0.1*0.1*1 -variable dt equal 1e-3 # timestep microseconds -variable skin equal 0.2*$h -variable skin equal 0.2*0.45 - -region box block -$L $L -$L $L 0 $a units box -region box block -1.5 $L -$L $L 0 $a units box -region box block -1.5 1.5 -$L $L 0 $a units box -region box block -1.5 1.5 -1.5 $L 0 $a units box -region box block -1.5 1.5 -1.5 1.5 0 $a units box -region box block -1.5 1.5 -1.5 1.5 0 0.1 units box -create_box 2 box -Created orthogonal box = (-1.5 -1.5 0) to (1.5 1.5 0.1) - 2 by 2 by 1 MPI processor grid -lattice sq $a -lattice sq 0.1 -Lattice spacing in x,y,z = 0.1 0.1 0.1 - -create_atoms 1 box -Created 900 atoms - Time spent = 0.0010246 secs - -region sphere sphere 0 0 0 $R units box -region sphere sphere 0 0 0 0.5 units box -set region sphere type 2 - 81 settings made for type - -group fluid type 1 -819 atoms in group fluid -group sphere type 2 -81 atoms in group sphere - -mass * ${mass} -mass * 0.001 -set group all meso/rho ${rho_0} -set group all meso/rho 1 - 900 settings made for meso/rho - -pair_style sdpd/taitwater/isothermal $T ${mu} 76787 # temperature viscosity random_seed -pair_style sdpd/taitwater/isothermal 300 ${mu} 76787 -pair_style sdpd/taitwater/isothermal 300 1 76787 -pair_coeff * * ${rho_0} ${c_0} ${h} -pair_coeff * * 1 ${c_0} ${h} -pair_coeff * * 1 100 ${h} -pair_coeff * * 1 100 0.45 - -fix 1 fluid meso -fix 2 sphere rigid/meso single -1 rigid bodies with 81 atoms - -fix 2d all enforce2d - -neighbor ${skin} bin -neighbor 0.09 bin -neigh_modify delay 0 every 1 check yes -timestep ${dt} -timestep 0.001 - -dump dump_id all atom 100 dump.lammpstrj - -thermo 100 -thermo_style custom step time nbuild ndanger - -run 10000 -Neighbor list info ... - update every 1 steps, delay 0 steps, check yes - max neighbors/atom: 2000, page size: 100000 - master list distance cutoff = 0.54 - ghost atom cutoff = 0.54 - binsize = 0.27, bins = 12 12 1 - 1 neighbor lists, perpetual/occasional/extra = 1 0 0 - (1) pair sdpd/taitwater/isothermal, perpetual - attributes: half, newton on - pair build: half/bin/atomonly/newton - stencil: half/bin/2d/newton - bin: standard -Per MPI rank memory allocation (min/avg/max) = 6.087 | 6.087 | 6.087 Mbytes -Step Time Nbuild Ndanger - 0 0 0 0 - 100 0.1 0 0 - 200 0.2 0 0 - 300 0.3 0 0 - 400 0.4 1 0 - 500 0.5 1 0 - 600 0.6 1 0 - 700 0.7 2 0 - 800 0.8 2 0 - 900 0.9 2 0 - 1000 1 3 0 - 1100 1.1 3 0 - 1200 1.2 3 0 - 1300 1.3 4 0 - 1400 1.4 4 0 - 1500 1.5 5 0 - 1600 1.6 5 0 - 1700 1.7 5 0 - 1800 1.8 6 0 - 1900 1.9 6 0 - 2000 2 6 0 - 2100 2.1 7 0 - 2200 2.2 7 0 - 2300 2.3 7 0 - 2400 2.4 8 0 - 2500 2.5 8 0 - 2600 2.6 8 0 - 2700 2.7 9 0 - 2800 2.8 9 0 - 2900 2.9 9 0 - 3000 3 9 0 - 3100 3.1 10 0 - 3200 3.2 10 0 - 3300 3.3 10 0 - 3400 3.4 11 0 - 3500 3.5 11 0 - 3600 3.6 11 0 - 3700 3.7 12 0 - 3800 3.8 12 0 - 3900 3.9 12 0 - 4000 4 13 0 - 4100 4.1 13 0 - 4200 4.2 13 0 - 4300 4.3 14 0 - 4400 4.4 14 0 - 4500 4.5 15 0 - 4600 4.6 15 0 - 4700 4.7 15 0 - 4800 4.8 16 0 - 4900 4.9 16 0 - 5000 5 16 0 - 5100 5.1 16 0 - 5200 5.2 17 0 - 5300 5.3 17 0 - 5400 5.4 18 0 - 5500 5.5 18 0 - 5600 5.6 19 0 - 5700 5.7 19 0 - 5800 5.8 19 0 - 5900 5.9 20 0 - 6000 6 20 0 - 6100 6.1 20 0 - 6200 6.2 21 0 - 6300 6.3 21 0 - 6400 6.4 21 0 - 6500 6.5 22 0 - 6600 6.6 22 0 - 6700 6.7 22 0 - 6800 6.8 23 0 - 6900 6.9 23 0 - 7000 7 23 0 - 7100 7.1 24 0 - 7200 7.2 24 0 - 7300 7.3 24 0 - 7400 7.4 25 0 - 7500 7.5 25 0 - 7600 7.6 25 0 - 7700 7.7 26 0 - 7800 7.8 26 0 - 7900 7.9 26 0 - 8000 8 27 0 - 8100 8.1 27 0 - 8200 8.2 27 0 - 8300 8.3 28 0 - 8400 8.4 28 0 - 8500 8.5 28 0 - 8600 8.6 28 0 - 8700 8.7 29 0 - 8800 8.8 29 0 - 8900 8.9 29 0 - 9000 9 30 0 - 9100 9.1 30 0 - 9200 9.2 31 0 - 9300 9.3 31 0 - 9400 9.4 31 0 - 9500 9.5 31 0 - 9600 9.6 32 0 - 9700 9.7 32 0 - 9800 9.8 32 0 - 9900 9.9 33 0 - 10000 10 33 0 -Loop time of 69.01 on 4 procs for 10000 steps with 900 atoms - -Performance: 12519931.275 ns/day, 0.000 hours/ns, 144.907 timesteps/s -48.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 | 56.528 | 57.936 | 58.729 | 11.0 | 83.95 -Neigh | 0.013157 | 0.013382 | 0.013551 | 0.1 | 0.02 -Comm | 8.9594 | 9.7555 | 11.113 | 26.7 | 14.14 -Output | 0.14644 | 0.15009 | 0.15809 | 1.2 | 0.22 -Modify | 0.72913 | 0.91574 | 1.0524 | 12.4 | 1.33 -Other | | 0.2389 | | | 0.35 - -Nlocal: 225 ave 229 max 223 min -Histogram: 1 2 0 0 0 0 0 0 0 1 -Nghost: 442 ave 444 max 439 min -Histogram: 1 0 0 0 1 0 0 0 0 2 -Neighs: 10188.8 ave 10437 max 9932 min -Histogram: 1 0 0 1 0 0 0 1 0 1 - -Total # of neighbors = 40755 -Ave neighs/atom = 45.2833 -Neighbor list builds = 33 -Dangerous builds = 0 -Total wall time: 0:01:09 diff --git a/examples/PACKAGES/dpd-smooth/2d-diffusion/log.28Mar23.2d-diffusion.g++.1 b/examples/PACKAGES/dpd-smooth/2d-diffusion/log.28Mar23.2d-diffusion.g++.1 new file mode 100644 index 0000000000..30bf43dcf6 --- /dev/null +++ b/examples/PACKAGES/dpd-smooth/2d-diffusion/log.28Mar23.2d-diffusion.g++.1 @@ -0,0 +1,230 @@ +LAMMPS (28 Mar 2023 - Development) +dimension 2 +units micro +atom_style sph + +variable R equal 0.5 # radius of sphere micrometers +variable a equal $R/5 # lattice spacing micrometers +variable a equal 0.5/5 +variable L equal $R*3 +variable L equal 0.5*3 +variable T equal 300. +variable rho_0 equal 1. # density picograms/micrometer^3 +variable c_0 equal 100. # speed of sound micrometers/microsecond +variable mu equal 1. # dynamic viscosity picogram/(micrometer-microsecond) +variable h equal $a*4.5 # kernel function cutoff micrometers +variable h equal 0.1*4.5 +variable mass equal $a*$a*$a*${rho_0} +variable mass equal 0.1*$a*$a*${rho_0} +variable mass equal 0.1*0.1*$a*${rho_0} +variable mass equal 0.1*0.1*0.1*${rho_0} +variable mass equal 0.1*0.1*0.1*1 +variable dt equal 1e-3 # timestep microseconds +variable skin equal 0.2*$h +variable skin equal 0.2*0.45 + +region box block -$L $L -$L $L 0 $a units box +region box block -1.5 $L -$L $L 0 $a units box +region box block -1.5 1.5 -$L $L 0 $a units box +region box block -1.5 1.5 -1.5 $L 0 $a units box +region box block -1.5 1.5 -1.5 1.5 0 $a units box +region box block -1.5 1.5 -1.5 1.5 0 0.1 units box +create_box 2 box +Created orthogonal box = (-1.5 -1.5 0) to (1.5 1.5 0.1) + 1 by 1 by 1 MPI processor grid +lattice sq $a +lattice sq 0.1 +Lattice spacing in x,y,z = 0.1 0.1 0.1 + +create_atoms 1 box +Created 900 atoms + using lattice units in orthogonal box = (-1.5 -1.5 0) to (1.5 1.5 0.1) + create_atoms CPU = 0.001 seconds + +region sphere sphere 0 0 0 $R units box +region sphere sphere 0 0 0 0.5 units box +set region sphere type 2 +Setting atom values ... + 81 settings made for type + +group fluid type 1 +819 atoms in group fluid +group sphere type 2 +81 atoms in group sphere + +mass * ${mass} +mass * 0.001 +set group all sph/rho ${rho_0} +set group all sph/rho 1 +Setting atom values ... + 900 settings made for sph/rho + +pair_style sdpd/taitwater/isothermal $T ${mu} 76787 # temperature viscosity random_seed +pair_style sdpd/taitwater/isothermal 300 ${mu} 76787 +pair_style sdpd/taitwater/isothermal 300 1 76787 +pair_coeff * * ${rho_0} ${c_0} ${h} +pair_coeff * * 1 ${c_0} ${h} +pair_coeff * * 1 100 ${h} +pair_coeff * * 1 100 0.45 + +fix 1 fluid sph +fix 2 sphere rigid/meso single + 1 rigid bodies with 81 atoms + +fix 2d all enforce2d + +neighbor ${skin} bin +neighbor 0.09 bin +neigh_modify delay 0 every 1 check yes +timestep ${dt} +timestep 0.001 + +dump dump_id all atom 100 dump.lammpstrj + +thermo 100 +thermo_style custom step time nbuild ndanger + +run 10000 +Generated 0 of 1 mixed pair_coeff terms from geometric mixing rule +Neighbor list info ... + update: every = 1 steps, delay = 0 steps, check = yes + max neighbors/atom: 2000, page size: 100000 + master list distance cutoff = 0.54 + ghost atom cutoff = 0.54 + binsize = 0.27, bins = 12 12 1 + 1 neighbor lists, perpetual/occasional/extra = 1 0 0 + (1) pair sdpd/taitwater/isothermal, perpetual + attributes: half, newton on + pair build: half/bin/atomonly/newton + stencil: half/bin/2d + bin: standard +Per MPI rank memory allocation (min/avg/max) = 6.512 | 6.512 | 6.512 Mbytes + Step Time Nbuild Ndanger + 0 0 0 0 + 100 0.1 0 0 + 200 0.2 0 0 + 300 0.3 0 0 + 400 0.4 1 0 + 500 0.5 1 0 + 600 0.6 1 0 + 700 0.7 2 0 + 800 0.8 2 0 + 900 0.9 2 0 + 1000 1 3 0 + 1100 1.1 3 0 + 1200 1.2 3 0 + 1300 1.3 4 0 + 1400 1.4 4 0 + 1500 1.5 4 0 + 1600 1.6 5 0 + 1700 1.7 5 0 + 1800 1.8 6 0 + 1900 1.9 6 0 + 2000 2 6 0 + 2100 2.1 7 0 + 2200 2.2 7 0 + 2300 2.3 7 0 + 2400 2.4 7 0 + 2500 2.5 8 0 + 2600 2.6 8 0 + 2700 2.7 8 0 + 2800 2.8 9 0 + 2900 2.9 9 0 + 3000 3 10 0 + 3100 3.1 10 0 + 3200 3.2 10 0 + 3300 3.3 11 0 + 3400 3.4 11 0 + 3500 3.5 11 0 + 3600 3.6 12 0 + 3700 3.7 12 0 + 3800 3.8 12 0 + 3900 3.9 13 0 + 4000 4 13 0 + 4100 4.1 13 0 + 4200 4.2 14 0 + 4300 4.3 14 0 + 4400 4.4 14 0 + 4500 4.5 15 0 + 4600 4.6 15 0 + 4700 4.7 15 0 + 4800 4.8 16 0 + 4900 4.9 16 0 + 5000 5 17 0 + 5100 5.1 17 0 + 5200 5.2 17 0 + 5300 5.3 17 0 + 5400 5.4 18 0 + 5500 5.5 18 0 + 5600 5.6 18 0 + 5700 5.7 19 0 + 5800 5.8 19 0 + 5900 5.9 19 0 + 6000 6 19 0 + 6100 6.1 20 0 + 6200 6.2 20 0 + 6300 6.3 20 0 + 6400 6.4 21 0 + 6500 6.5 21 0 + 6600 6.6 21 0 + 6700 6.7 21 0 + 6800 6.8 22 0 + 6900 6.9 22 0 + 7000 7 22 0 + 7100 7.1 23 0 + 7200 7.2 23 0 + 7300 7.3 23 0 + 7400 7.4 24 0 + 7500 7.5 24 0 + 7600 7.6 24 0 + 7700 7.7 25 0 + 7800 7.8 25 0 + 7900 7.9 26 0 + 8000 8 26 0 + 8100 8.1 26 0 + 8200 8.2 26 0 + 8300 8.3 27 0 + 8400 8.4 27 0 + 8500 8.5 27 0 + 8600 8.6 28 0 + 8700 8.7 28 0 + 8800 8.8 28 0 + 8900 8.9 29 0 + 9000 9 29 0 + 9100 9.1 29 0 + 9200 9.2 30 0 + 9300 9.3 30 0 + 9400 9.4 30 0 + 9500 9.5 30 0 + 9600 9.6 31 0 + 9700 9.7 31 0 + 9800 9.8 32 0 + 9900 9.9 32 0 + 10000 10 32 0 +Loop time of 78.0094 on 1 procs for 10000 steps with 900 atoms + +Performance: 11075589.479 ns/day, 0.000 hours/ns, 128.190 timesteps/s, 115.371 katom-step/s +99.5% CPU use with 1 MPI tasks x no OpenMP threads + +MPI task timing breakdown: +Section | min time | avg time | max time |%varavg| %total +--------------------------------------------------------------- +Pair | 77.441 | 77.441 | 77.441 | 0.0 | 99.27 +Neigh | 0.016471 | 0.016471 | 0.016471 | 0.0 | 0.02 +Comm | 0.14821 | 0.14821 | 0.14821 | 0.0 | 0.19 +Output | 0.062415 | 0.062415 | 0.062415 | 0.0 | 0.08 +Modify | 0.25323 | 0.25323 | 0.25323 | 0.0 | 0.32 +Other | | 0.0877 | | | 0.11 + +Nlocal: 900 ave 900 max 900 min +Histogram: 1 0 0 0 0 0 0 0 0 0 +Nghost: 762 ave 762 max 762 min +Histogram: 1 0 0 0 0 0 0 0 0 0 +Neighs: 40697 ave 40697 max 40697 min +Histogram: 1 0 0 0 0 0 0 0 0 0 + +Total # of neighbors = 40697 +Ave neighs/atom = 45.218889 +Neighbor list builds = 32 +Dangerous builds = 0 +Total wall time: 0:01:18 diff --git a/examples/PACKAGES/dpd-smooth/2d-diffusion/log.28Mar23.2d-diffusion.g++.4 b/examples/PACKAGES/dpd-smooth/2d-diffusion/log.28Mar23.2d-diffusion.g++.4 new file mode 100644 index 0000000000..03f5ed01bb --- /dev/null +++ b/examples/PACKAGES/dpd-smooth/2d-diffusion/log.28Mar23.2d-diffusion.g++.4 @@ -0,0 +1,230 @@ +LAMMPS (28 Mar 2023 - Development) +dimension 2 +units micro +atom_style sph + +variable R equal 0.5 # radius of sphere micrometers +variable a equal $R/5 # lattice spacing micrometers +variable a equal 0.5/5 +variable L equal $R*3 +variable L equal 0.5*3 +variable T equal 300. +variable rho_0 equal 1. # density picograms/micrometer^3 +variable c_0 equal 100. # speed of sound micrometers/microsecond +variable mu equal 1. # dynamic viscosity picogram/(micrometer-microsecond) +variable h equal $a*4.5 # kernel function cutoff micrometers +variable h equal 0.1*4.5 +variable mass equal $a*$a*$a*${rho_0} +variable mass equal 0.1*$a*$a*${rho_0} +variable mass equal 0.1*0.1*$a*${rho_0} +variable mass equal 0.1*0.1*0.1*${rho_0} +variable mass equal 0.1*0.1*0.1*1 +variable dt equal 1e-3 # timestep microseconds +variable skin equal 0.2*$h +variable skin equal 0.2*0.45 + +region box block -$L $L -$L $L 0 $a units box +region box block -1.5 $L -$L $L 0 $a units box +region box block -1.5 1.5 -$L $L 0 $a units box +region box block -1.5 1.5 -1.5 $L 0 $a units box +region box block -1.5 1.5 -1.5 1.5 0 $a units box +region box block -1.5 1.5 -1.5 1.5 0 0.1 units box +create_box 2 box +Created orthogonal box = (-1.5 -1.5 0) to (1.5 1.5 0.1) + 2 by 2 by 1 MPI processor grid +lattice sq $a +lattice sq 0.1 +Lattice spacing in x,y,z = 0.1 0.1 0.1 + +create_atoms 1 box +Created 900 atoms + using lattice units in orthogonal box = (-1.5 -1.5 0) to (1.5 1.5 0.1) + create_atoms CPU = 0.001 seconds + +region sphere sphere 0 0 0 $R units box +region sphere sphere 0 0 0 0.5 units box +set region sphere type 2 +Setting atom values ... + 81 settings made for type + +group fluid type 1 +819 atoms in group fluid +group sphere type 2 +81 atoms in group sphere + +mass * ${mass} +mass * 0.001 +set group all sph/rho ${rho_0} +set group all sph/rho 1 +Setting atom values ... + 900 settings made for sph/rho + +pair_style sdpd/taitwater/isothermal $T ${mu} 76787 # temperature viscosity random_seed +pair_style sdpd/taitwater/isothermal 300 ${mu} 76787 +pair_style sdpd/taitwater/isothermal 300 1 76787 +pair_coeff * * ${rho_0} ${c_0} ${h} +pair_coeff * * 1 ${c_0} ${h} +pair_coeff * * 1 100 ${h} +pair_coeff * * 1 100 0.45 + +fix 1 fluid sph +fix 2 sphere rigid/meso single + 1 rigid bodies with 81 atoms + +fix 2d all enforce2d + +neighbor ${skin} bin +neighbor 0.09 bin +neigh_modify delay 0 every 1 check yes +timestep ${dt} +timestep 0.001 + +dump dump_id all atom 100 dump.lammpstrj + +thermo 100 +thermo_style custom step time nbuild ndanger + +run 10000 +Generated 0 of 1 mixed pair_coeff terms from geometric mixing rule +Neighbor list info ... + update: every = 1 steps, delay = 0 steps, check = yes + max neighbors/atom: 2000, page size: 100000 + master list distance cutoff = 0.54 + ghost atom cutoff = 0.54 + binsize = 0.27, bins = 12 12 1 + 1 neighbor lists, perpetual/occasional/extra = 1 0 0 + (1) pair sdpd/taitwater/isothermal, perpetual + attributes: half, newton on + pair build: half/bin/atomonly/newton + stencil: half/bin/2d + bin: standard +Per MPI rank memory allocation (min/avg/max) = 6.463 | 6.463 | 6.463 Mbytes + Step Time Nbuild Ndanger + 0 0 0 0 + 100 0.1 0 0 + 200 0.2 0 0 + 300 0.3 0 0 + 400 0.4 1 0 + 500 0.5 1 0 + 600 0.6 1 0 + 700 0.7 2 0 + 800 0.8 2 0 + 900 0.9 2 0 + 1000 1 3 0 + 1100 1.1 3 0 + 1200 1.2 3 0 + 1300 1.3 4 0 + 1400 1.4 4 0 + 1500 1.5 4 0 + 1600 1.6 5 0 + 1700 1.7 5 0 + 1800 1.8 5 0 + 1900 1.9 6 0 + 2000 2 6 0 + 2100 2.1 6 0 + 2200 2.2 7 0 + 2300 2.3 7 0 + 2400 2.4 7 0 + 2500 2.5 8 0 + 2600 2.6 8 0 + 2700 2.7 8 0 + 2800 2.8 9 0 + 2900 2.9 9 0 + 3000 3 9 0 + 3100 3.1 10 0 + 3200 3.2 10 0 + 3300 3.3 11 0 + 3400 3.4 11 0 + 3500 3.5 11 0 + 3600 3.6 12 0 + 3700 3.7 12 0 + 3800 3.8 12 0 + 3900 3.9 12 0 + 4000 4 13 0 + 4100 4.1 13 0 + 4200 4.2 14 0 + 4300 4.3 14 0 + 4400 4.4 14 0 + 4500 4.5 15 0 + 4600 4.6 15 0 + 4700 4.7 15 0 + 4800 4.8 16 0 + 4900 4.9 16 0 + 5000 5 16 0 + 5100 5.1 17 0 + 5200 5.2 17 0 + 5300 5.3 17 0 + 5400 5.4 17 0 + 5500 5.5 18 0 + 5600 5.6 18 0 + 5700 5.7 18 0 + 5800 5.8 19 0 + 5900 5.9 19 0 + 6000 6 19 0 + 6100 6.1 20 0 + 6200 6.2 20 0 + 6300 6.3 20 0 + 6400 6.4 21 0 + 6500 6.5 21 0 + 6600 6.6 21 0 + 6700 6.7 22 0 + 6800 6.8 22 0 + 6900 6.9 22 0 + 7000 7 23 0 + 7100 7.1 23 0 + 7200 7.2 23 0 + 7300 7.3 24 0 + 7400 7.4 24 0 + 7500 7.5 24 0 + 7600 7.6 25 0 + 7700 7.7 25 0 + 7800 7.8 26 0 + 7900 7.9 26 0 + 8000 8 26 0 + 8100 8.1 26 0 + 8200 8.2 27 0 + 8300 8.3 27 0 + 8400 8.4 28 0 + 8500 8.5 28 0 + 8600 8.6 28 0 + 8700 8.7 29 0 + 8800 8.8 29 0 + 8900 8.9 29 0 + 9000 9 30 0 + 9100 9.1 30 0 + 9200 9.2 30 0 + 9300 9.3 30 0 + 9400 9.4 31 0 + 9500 9.5 31 0 + 9600 9.6 31 0 + 9700 9.7 32 0 + 9800 9.8 32 0 + 9900 9.9 32 0 + 10000 10 33 0 +Loop time of 13.5306 on 4 procs for 10000 steps with 900 atoms + +Performance: 63855371.888 ns/day, 0.000 hours/ns, 739.067 timesteps/s, 665.160 katom-step/s +98.8% CPU use with 4 MPI tasks x no OpenMP threads + +MPI task timing breakdown: +Section | min time | avg time | max time |%varavg| %total +--------------------------------------------------------------- +Pair | 12.327 | 12.56 | 12.738 | 4.3 | 92.83 +Neigh | 0.0043391 | 0.0044297 | 0.0045381 | 0.1 | 0.03 +Comm | 0.53746 | 0.71463 | 0.94685 | 18.1 | 5.28 +Output | 0.021884 | 0.02228 | 0.023428 | 0.4 | 0.16 +Modify | 0.14457 | 0.14548 | 0.14643 | 0.2 | 1.08 +Other | | 0.08351 | | | 0.62 + +Nlocal: 225 ave 228 max 222 min +Histogram: 1 0 0 1 0 0 1 0 0 1 +Nghost: 438.25 ave 442 max 434 min +Histogram: 1 0 0 0 0 1 1 0 0 1 +Neighs: 10152.2 ave 10328 max 9853 min +Histogram: 1 0 0 0 0 0 0 1 1 1 + +Total # of neighbors = 40609 +Ave neighs/atom = 45.121111 +Neighbor list builds = 33 +Dangerous builds = 0 +Total wall time: 0:00:13 diff --git a/examples/PACKAGES/dpd-smooth/equipartition-verification/in.lammps b/examples/PACKAGES/dpd-smooth/equipartition-verification/in.lammps index 0d06723f59..59359d4b38 100644 --- a/examples/PACKAGES/dpd-smooth/equipartition-verification/in.lammps +++ b/examples/PACKAGES/dpd-smooth/equipartition-verification/in.lammps @@ -1,6 +1,6 @@ dimension 3 units micro -atom_style meso +atom_style sph variable a equal 0.1 # lattice spacing micrometers variable L equal $a*10 @@ -21,7 +21,7 @@ lattice sc $a create_atoms 1 box mass * ${mass} -set group all meso/rho ${rho_0} +set group all sph/rho ${rho_0} pair_style sdpd/taitwater/isothermal $T ${mu} 76787 # temperature viscosity random_seed pair_coeff * * ${rho_0} ${c_0} ${h} @@ -34,7 +34,7 @@ variable vx_sq_check equal c_v_sq[1]*${mass}/${kB}/$T variable vy_sq_check equal c_v_sq[2]*${mass}/${kB}/$T variable vz_sq_check equal c_v_sq[3]*${mass}/${kB}/$T -fix 1 all meso +fix 1 all sph neighbor ${skin} bin timestep ${dt} diff --git a/examples/PACKAGES/dpd-smooth/equipartition-verification/log.24Oct18.equipartition.g++.1 b/examples/PACKAGES/dpd-smooth/equipartition-verification/log.28Mar23.equipartition.g++.1 similarity index 58% rename from examples/PACKAGES/dpd-smooth/equipartition-verification/log.24Oct18.equipartition.g++.1 rename to examples/PACKAGES/dpd-smooth/equipartition-verification/log.28Mar23.equipartition.g++.1 index 06ffd699bc..2fa4771a74 100644 --- a/examples/PACKAGES/dpd-smooth/equipartition-verification/log.24Oct18.equipartition.g++.1 +++ b/examples/PACKAGES/dpd-smooth/equipartition-verification/log.28Mar23.equipartition.g++.1 @@ -1,7 +1,7 @@ -LAMMPS (24 Oct 2018) +LAMMPS (28 Mar 2023 - Development) dimension 3 units micro -atom_style meso +atom_style sph variable a equal 0.1 # lattice spacing micrometers variable L equal $a*10 @@ -38,13 +38,15 @@ Lattice spacing in x,y,z = 0.1 0.1 0.1 create_atoms 1 box Created 8000 atoms - Time spent = 0.00285411 secs + using lattice units in orthogonal box = (-1 -1 -1) to (1 1 1) + create_atoms CPU = 0.002 seconds mass * ${mass} mass * 0.001 -set group all meso/rho ${rho_0} -set group all meso/rho 1 - 8000 settings made for meso/rho +set group all sph/rho ${rho_0} +set group all sph/rho 1 +Setting atom values ... + 8000 settings made for sph/rho pair_style sdpd/taitwater/isothermal $T ${mu} 76787 # temperature viscosity random_seed pair_style sdpd/taitwater/isothermal 300 ${mu} 76787 @@ -71,7 +73,7 @@ variable vz_sq_check equal c_v_sq[3]*0.001/${kB}/$T variable vz_sq_check equal c_v_sq[3]*0.001/1.3806504e-08/$T variable vz_sq_check equal c_v_sq[3]*0.001/1.3806504e-08/300 -fix 1 all meso +fix 1 all sph neighbor ${skin} bin neighbor 0.04 bin @@ -82,8 +84,9 @@ thermo 10 thermo_style custom step time v_vx_sq_check v_vy_sq_check v_vz_sq_check run 200 +Generated 0 of 0 mixed pair_coeff terms from geometric mixing rule Neighbor list info ... - update every 1 steps, delay 10 steps, check yes + update: every = 1 steps, delay = 0 steps, check = yes max neighbors/atom: 2000, page size: 100000 master list distance cutoff = 0.44 ghost atom cutoff = 0.44 @@ -92,55 +95,55 @@ Neighbor list info ... (1) pair sdpd/taitwater/isothermal, perpetual attributes: half, newton on pair build: half/bin/atomonly/newton - stencil: half/bin/3d/newton + stencil: half/bin/3d bin: standard -Per MPI rank memory allocation (min/avg/max) = 13.54 | 13.54 | 13.54 Mbytes -Step Time v_vx_sq_check v_vy_sq_check v_vz_sq_check - 0 0 0 0 0 - 10 0.005 0.70973271 0.71495693 0.71910087 - 20 0.01 0.90418096 0.88845437 0.89659567 - 30 0.015 0.9590736 0.97880338 0.9619016 - 40 0.02 0.98533774 0.96057682 0.95600448 - 50 0.025 0.96433662 0.96650071 0.95509683 - 60 0.03 0.96598029 0.96373656 0.96734888 - 70 0.035 0.95433045 0.98004764 0.96255924 - 80 0.04 0.97872906 0.95987289 0.96623598 - 90 0.045 0.99913888 0.99255731 0.95616142 - 100 0.05 0.98872675 0.97141018 0.95338841 - 110 0.055 0.97794592 0.97389258 0.98473719 - 120 0.06 0.98389266 0.96716284 0.95504862 - 130 0.065 0.98572886 0.96680923 0.95599065 - 140 0.07 0.97602684 0.97580081 0.9886878 - 150 0.075 0.99172003 0.95027467 0.96028033 - 160 0.08 0.96793247 0.94590928 0.95644301 - 170 0.085 0.94167619 0.98048861 0.93439426 - 180 0.09 0.97277934 0.97383622 0.96900866 - 190 0.095 0.96647288 1.0027643 0.96230782 - 200 0.1 0.94864291 0.95902585 0.96398175 -Loop time of 60.1095 on 1 procs for 200 steps with 8000 atoms +Per MPI rank memory allocation (min/avg/max) = 14.29 | 14.29 | 14.29 Mbytes + Step Time v_vx_sq_check v_vy_sq_check v_vz_sq_check + 0 0 0 0 0 + 10 0.005 0.70973271 0.71495693 0.71910087 + 20 0.01 0.90418096 0.88845437 0.89659567 + 30 0.015 0.9590736 0.97880338 0.9619016 + 40 0.02 0.98533774 0.96057682 0.95600448 + 50 0.025 0.96433662 0.96650071 0.95509683 + 60 0.03 0.96598029 0.96373656 0.96734888 + 70 0.035 0.95433045 0.98004764 0.96255924 + 80 0.04 0.97872906 0.95987289 0.96623598 + 90 0.045 0.99913888 0.99255731 0.95616142 + 100 0.05 0.98872675 0.97141018 0.95338841 + 110 0.055 0.97794592 0.97389258 0.98473719 + 120 0.06 0.98389266 0.96716284 0.95504862 + 130 0.065 0.98572886 0.96680923 0.95599065 + 140 0.07 0.97602684 0.97580081 0.9886878 + 150 0.075 0.99172003 0.95027467 0.96028033 + 160 0.08 0.96793247 0.94590928 0.95644301 + 170 0.085 0.94167619 0.98048861 0.93439426 + 180 0.09 0.97277934 0.97383622 0.96900866 + 190 0.095 0.96647288 1.0027643 0.96230782 + 200 0.1 0.94864291 0.95902585 0.96398175 +Loop time of 55.7542 on 1 procs for 200 steps with 8000 atoms -Performance: 143737.595 ns/day, 0.000 hours/ns, 3.327 timesteps/s -99.7% CPU use with 1 MPI tasks x no OpenMP threads +Performance: 154965.922 ns/day, 0.000 hours/ns, 3.587 timesteps/s, 28.697 katom-step/s +99.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 | 59.92 | 59.92 | 59.92 | 0.0 | 99.68 +Pair | 55.642 | 55.642 | 55.642 | 0.0 | 99.80 Neigh | 0 | 0 | 0 | 0.0 | 0.00 -Comm | 0.11154 | 0.11154 | 0.11154 | 0.0 | 0.19 -Output | 0.0063498 | 0.0063498 | 0.0063498 | 0.0 | 0.01 -Modify | 0.043546 | 0.043546 | 0.043546 | 0.0 | 0.07 -Other | | 0.02811 | | | 0.05 +Comm | 0.060977 | 0.060977 | 0.060977 | 0.0 | 0.11 +Output | 0.0066393 | 0.0066393 | 0.0066393 | 0.0 | 0.01 +Modify | 0.028354 | 0.028354 | 0.028354 | 0.0 | 0.05 +Other | | 0.01623 | | | 0.03 -Nlocal: 8000 ave 8000 max 8000 min +Nlocal: 8000 ave 8000 max 8000 min Histogram: 1 0 0 0 0 0 0 0 0 0 -Nghost: 16389 ave 16389 max 16389 min +Nghost: 16389 ave 16389 max 16389 min Histogram: 1 0 0 0 0 0 0 0 0 0 -Neighs: 1.456e+06 ave 1.456e+06 max 1.456e+06 min +Neighs: 1.456e+06 ave 1.456e+06 max 1.456e+06 min Histogram: 1 0 0 0 0 0 0 0 0 0 Total # of neighbors = 1456000 Ave neighs/atom = 182 Neighbor list builds = 0 Dangerous builds = 0 -Total wall time: 0:01:00 +Total wall time: 0:00:56 diff --git a/examples/PACKAGES/dpd-smooth/equipartition-verification/log.24Oct18.equipartition.g++.4 b/examples/PACKAGES/dpd-smooth/equipartition-verification/log.28Mar23.equipartition.g++.4 similarity index 58% rename from examples/PACKAGES/dpd-smooth/equipartition-verification/log.24Oct18.equipartition.g++.4 rename to examples/PACKAGES/dpd-smooth/equipartition-verification/log.28Mar23.equipartition.g++.4 index 88509f0fd1..e4f11d305e 100644 --- a/examples/PACKAGES/dpd-smooth/equipartition-verification/log.24Oct18.equipartition.g++.4 +++ b/examples/PACKAGES/dpd-smooth/equipartition-verification/log.28Mar23.equipartition.g++.4 @@ -1,7 +1,7 @@ -LAMMPS (24 Oct 2018) +LAMMPS (28 Mar 2023 - Development) dimension 3 units micro -atom_style meso +atom_style sph variable a equal 0.1 # lattice spacing micrometers variable L equal $a*10 @@ -38,13 +38,15 @@ Lattice spacing in x,y,z = 0.1 0.1 0.1 create_atoms 1 box Created 8000 atoms - Time spent = 0.00252754 secs + using lattice units in orthogonal box = (-1 -1 -1) to (1 1 1) + create_atoms CPU = 0.001 seconds mass * ${mass} mass * 0.001 -set group all meso/rho ${rho_0} -set group all meso/rho 1 - 8000 settings made for meso/rho +set group all sph/rho ${rho_0} +set group all sph/rho 1 +Setting atom values ... + 8000 settings made for sph/rho pair_style sdpd/taitwater/isothermal $T ${mu} 76787 # temperature viscosity random_seed pair_style sdpd/taitwater/isothermal 300 ${mu} 76787 @@ -71,7 +73,7 @@ variable vz_sq_check equal c_v_sq[3]*0.001/${kB}/$T variable vz_sq_check equal c_v_sq[3]*0.001/1.3806504e-08/$T variable vz_sq_check equal c_v_sq[3]*0.001/1.3806504e-08/300 -fix 1 all meso +fix 1 all sph neighbor ${skin} bin neighbor 0.04 bin @@ -82,8 +84,9 @@ thermo 10 thermo_style custom step time v_vx_sq_check v_vy_sq_check v_vz_sq_check run 200 +Generated 0 of 0 mixed pair_coeff terms from geometric mixing rule Neighbor list info ... - update every 1 steps, delay 10 steps, check yes + update: every = 1 steps, delay = 0 steps, check = yes max neighbors/atom: 2000, page size: 100000 master list distance cutoff = 0.44 ghost atom cutoff = 0.44 @@ -92,55 +95,55 @@ Neighbor list info ... (1) pair sdpd/taitwater/isothermal, perpetual attributes: half, newton on pair build: half/bin/atomonly/newton - stencil: half/bin/3d/newton + stencil: half/bin/3d bin: standard -Per MPI rank memory allocation (min/avg/max) = 5.795 | 5.795 | 5.795 Mbytes -Step Time v_vx_sq_check v_vy_sq_check v_vz_sq_check - 0 0 0 0 0 - 10 0.005 0.71224819 0.71470372 0.7008956 - 20 0.01 0.90627589 0.90683966 0.90116506 - 30 0.015 0.938505 0.95884272 0.93337542 - 40 0.02 0.94394649 0.93668038 0.96468004 - 50 0.025 0.97152309 0.97546161 0.95107762 - 60 0.03 0.94710871 0.95678322 0.97285504 - 70 0.035 0.96253148 0.95838642 0.95450883 - 80 0.04 0.97581495 0.95278681 0.95099478 - 90 0.045 0.96251614 0.9740684 0.96081505 - 100 0.05 0.94191275 0.97137523 0.94084858 - 110 0.055 0.953406 0.95739684 0.98574522 - 120 0.06 0.99001614 0.99608287 0.9839996 - 130 0.065 0.96575225 0.94309655 0.92847798 - 140 0.07 0.97642687 0.97458638 0.94696406 - 150 0.075 0.99316381 0.96876814 0.95440106 - 160 0.08 0.94589744 0.95264791 0.95495169 - 170 0.085 0.97599092 0.95336014 0.97687718 - 180 0.09 0.97214242 0.9726305 0.9726035 - 190 0.095 0.97577583 0.96523645 0.9756968 - 200 0.1 0.96386053 0.97268854 0.94582436 -Loop time of 32.5247 on 4 procs for 200 steps with 8000 atoms +Per MPI rank memory allocation (min/avg/max) = 6.172 | 6.172 | 6.172 Mbytes + Step Time v_vx_sq_check v_vy_sq_check v_vz_sq_check + 0 0 0 0 0 + 10 0.005 0.71224819 0.71470372 0.7008956 + 20 0.01 0.90627589 0.90683966 0.90116506 + 30 0.015 0.938505 0.95884272 0.93337542 + 40 0.02 0.94394649 0.93668038 0.96468004 + 50 0.025 0.97152309 0.97546161 0.95107762 + 60 0.03 0.94710871 0.95678322 0.97285504 + 70 0.035 0.96253148 0.95838642 0.95450883 + 80 0.04 0.97581495 0.95278681 0.95099478 + 90 0.045 0.96251614 0.9740684 0.96081505 + 100 0.05 0.94191275 0.97137523 0.94084858 + 110 0.055 0.953406 0.95739684 0.98574522 + 120 0.06 0.99001614 0.99608287 0.9839996 + 130 0.065 0.96575225 0.94309655 0.92847798 + 140 0.07 0.97642687 0.97458638 0.94696406 + 150 0.075 0.99316381 0.96876814 0.95440106 + 160 0.08 0.94589744 0.95264791 0.95495169 + 170 0.085 0.97599092 0.95336014 0.97687718 + 180 0.09 0.97214242 0.9726305 0.9726035 + 190 0.095 0.97577583 0.96523645 0.9756968 + 200 0.1 0.96386053 0.97268854 0.94582436 +Loop time of 9.59181 on 4 procs for 200 steps with 8000 atoms -Performance: 265644.515 ns/day, 0.000 hours/ns, 6.149 timesteps/s -73.9% CPU use with 4 MPI tasks x no OpenMP threads +Performance: 900768.333 ns/day, 0.000 hours/ns, 20.851 timesteps/s, 166.809 katom-step/s +98.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 | 27.385 | 28.409 | 28.761 | 11.1 | 87.34 +Pair | 8.9729 | 9.2147 | 9.4383 | 5.5 | 96.07 Neigh | 0 | 0 | 0 | 0.0 | 0.00 -Comm | 3.582 | 3.9343 | 4.9531 | 29.7 | 12.10 -Output | 0.022267 | 0.026073 | 0.033141 | 2.7 | 0.08 -Modify | 0.031714 | 0.033134 | 0.034367 | 0.6 | 0.10 -Other | | 0.1226 | | | 0.38 +Comm | 0.13739 | 0.36068 | 0.60216 | 27.6 | 3.76 +Output | 0.0022724 | 0.002394 | 0.0026506 | 0.3 | 0.02 +Modify | 0.0068559 | 0.0069926 | 0.0070974 | 0.1 | 0.07 +Other | | 0.007004 | | | 0.07 -Nlocal: 2000 ave 2000 max 2000 min +Nlocal: 2000 ave 2000 max 2000 min Histogram: 4 0 0 0 0 0 0 0 0 0 -Nghost: 8469 ave 8469 max 8469 min +Nghost: 8469 ave 8469 max 8469 min Histogram: 4 0 0 0 0 0 0 0 0 0 -Neighs: 364000 ave 376628 max 351184 min +Neighs: 364000 ave 376628 max 351184 min Histogram: 1 0 1 0 0 0 0 1 0 1 Total # of neighbors = 1456000 Ave neighs/atom = 182 Neighbor list builds = 0 Dangerous builds = 0 -Total wall time: 0:00:32 +Total wall time: 0:00:09 From 620cca34d4f840722fefaeca35c3548200dadce0 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Wed, 7 Jun 2023 15:19:13 -0400 Subject: [PATCH 204/396] add accessor to nfield, make certain field types are initialized early --- src/thermo.cpp | 10 ++++++++++ src/thermo.h | 1 + 2 files changed, 11 insertions(+) diff --git a/src/thermo.cpp b/src/thermo.cpp index 31c19fbdc2..1c07da695f 100644 --- a/src/thermo.cpp +++ b/src/thermo.cpp @@ -201,6 +201,8 @@ void Thermo::init() ValueTokenizer *format_line = nullptr; if (format_line_user.size()) format_line = new ValueTokenizer(format_line_user); + field_data.clear(); + field_data.resize(nfield); std::string format_this, format_line_user_def; for (int i = 0; i < nfield; i++) { @@ -208,6 +210,14 @@ void Thermo::init() format_this.clear(); format_line_user_def.clear(); + if (vtype[i] == FLOAT) { + field_data[i] = (double) 0.0; + } else if (vtype[i] == INT) { + field_data[i] = (int) 0; + } else if (vtype[i] == BIGINT) { + field_data[i] = (bigint) 0; + } + if ((lineflag == MULTILINE) && ((i % 3) == 0)) format[i] += "\n"; if ((lineflag == YAMLLINE) && (i == 0)) format[i] += " - ["; if (format_line) format_line_user_def = format_line->next_string(); diff --git a/src/thermo.h b/src/thermo.h index 8a5cba29d7..f22f3103b0 100644 --- a/src/thermo.h +++ b/src/thermo.h @@ -43,6 +43,7 @@ class Thermo : protected Pointers { int evaluate_keyword(const std::string &, double *); // for accessing cached thermo data + int get_nfield() const { return nfield; } bigint get_timestep() const { return ntimestep; } const std::vector &get_fields() const { return field_data; } const std::vector &get_keywords() const { return keyword; } From 30e6b8b9b6405cd979b87d4abb951ae5ca4e0a46 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Wed, 7 Jun 2023 15:19:58 -0400 Subject: [PATCH 205/396] make more reliable with explicit loops using exported nfield value --- src/EXTRA-DUMP/dump_yaml.cpp | 19 +++++++++------- src/NETCDF/dump_netcdf.cpp | 37 ++++++++++++++++++++++-------- src/NETCDF/dump_netcdf.h | 1 + src/NETCDF/dump_netcdf_mpiio.cpp | 39 ++++++++++++++++++++++++-------- src/NETCDF/dump_netcdf_mpiio.h | 1 + 5 files changed, 70 insertions(+), 27 deletions(-) diff --git a/src/EXTRA-DUMP/dump_yaml.cpp b/src/EXTRA-DUMP/dump_yaml.cpp index ec7d26af31..f8d2fb2264 100644 --- a/src/EXTRA-DUMP/dump_yaml.cpp +++ b/src/EXTRA-DUMP/dump_yaml.cpp @@ -62,18 +62,21 @@ void DumpYAML::write_header(bigint ndump) Thermo *th = output->thermo; // output thermo data only on timesteps where it was computed if (update->ntimestep == th->get_timestep()) { + int nfield = th->get_nfield(); + const auto &keywords = th->get_keywords(); + const auto &fields = th->get_fields(); thermo_data += "thermo:\n - keywords: [ "; - for (const auto &key : th->get_keywords()) thermo_data += fmt::format("{}, ", key); + for (int i = 0; i < nfield; ++i) thermo_data += fmt::format("{}, ", keywords[i]); thermo_data += "]\n - data: [ "; - for (const auto &val : th->get_fields()) { - if (val.type == multitype::DOUBLE) - thermo_data += fmt::format("{}, ", val.data.d); - else if (val.type == multitype::INT) - thermo_data += fmt::format("{}, ", val.data.i); - else if (val.type == multitype::BIGINT) - thermo_data += fmt::format("{}, ", val.data.b); + for (int i = 0; i < nfield; ++i) { + if (fields[i].type == multitype::DOUBLE) + thermo_data += fmt::format("{}, ", fields[i].data.d); + else if (fields[i].type == multitype::INT) + thermo_data += fmt::format("{}, ", fields[i].data.i); + else if (fields[i].type == multitype::BIGINT) + thermo_data += fmt::format("{}, ", fields[i].data.b); else thermo_data += ", "; } diff --git a/src/NETCDF/dump_netcdf.cpp b/src/NETCDF/dump_netcdf.cpp index 8c99ff1f70..2b064edeae 100644 --- a/src/NETCDF/dump_netcdf.cpp +++ b/src/NETCDF/dump_netcdf.cpp @@ -195,6 +195,7 @@ DumpNetCDF::DumpNetCDF(LAMMPS *lmp, int narg, char **arg) : type_nc_real = NC_FLOAT; thermo = false; + thermo_warn = true; thermovar = nullptr; framei = 0; @@ -223,7 +224,7 @@ void DumpNetCDF::openfile() if (thermo && !singlefile_opened) { delete[] thermovar; - thermovar = new int[output->thermo->get_keywords().size()]; + thermovar = new int[output->thermo->get_nfield()]; } // now the computes and fixes have been initialized, so we can query @@ -320,8 +321,10 @@ void DumpNetCDF::openfile() // perframe variables if (thermo) { - const auto &keywords = output->thermo->get_keywords(); - int nfield = keywords.size(); + Thermo *th = output->thermo; + const auto &keywords = th->get_keywords(); + const int nfield = th->get_nfield(); + for (int i = 0; i < nfield; i++) { NCERRX( nc_inq_varid(ncid, keywords[i].c_str(), &thermovar[i]), keywords[i].c_str() ); } @@ -433,9 +436,11 @@ void DumpNetCDF::openfile() // perframe variables if (thermo) { - const auto &fields = output->thermo->get_fields(); - const auto &keywords = output->thermo->get_keywords(); - int nfield = fields.size(); + Thermo *th = output->thermo; + const auto &fields = th->get_fields(); + const auto &keywords = th->get_keywords(); + const int nfield = th->get_nfield(); + for (int i = 0; i < nfield; i++) { if (fields[i].type == multitype::DOUBLE) { NCERRX( nc_def_var(ncid, keywords[i].c_str(), type_nc_real, 1, dims, &thermovar[i]), keywords[i].c_str() ); @@ -600,9 +605,23 @@ void DumpNetCDF::write() start[1] = 0; if (thermo) { - const auto &keywords = output->thermo->get_keywords(); - const auto &fields = output->thermo->get_fields(); - int nfield = fields.size(); + Thermo *th = output->thermo; + + // will output current thermo data only on timesteps where it was computed. + // warn (once) about using cached copy from old timestep. + + if (thermo_warn && (update->ntimestep != th->get_timestep())) { + thermo_warn = false; + if (comm->me == 0) { + error->warning(FLERR, "Dump {} output on incompatible timestep with thermo output: {} vs {} \n" + " Dump netcdf always stores thermo data from last thermo output", + id, th->get_timestep(), update->ntimestep); + } + } + + const auto &keywords = th->get_keywords(); + const auto &fields = th->get_fields(); + int nfield = th->get_nfield(); for (int i = 0; i < nfield; i++) { if (filewriter) { if (fields[i].type == multitype::DOUBLE) { diff --git a/src/NETCDF/dump_netcdf.h b/src/NETCDF/dump_netcdf.h index 20c60ef104..982cd99fb5 100644 --- a/src/NETCDF/dump_netcdf.h +++ b/src/NETCDF/dump_netcdf.h @@ -65,6 +65,7 @@ class DumpNetCDF : public DumpCustom { int type_nc_real; // netcdf type to use for real variables: float or double bool thermo; // write thermo output to netcdf file + bool thermo_warn; // warn (once) that thermo output is on incompatible step bigint n_buffer; // size of buffer bigint *int_buffer; // buffer for passing data to netcdf diff --git a/src/NETCDF/dump_netcdf_mpiio.cpp b/src/NETCDF/dump_netcdf_mpiio.cpp index 3aec34dd40..4a34f11ab4 100644 --- a/src/NETCDF/dump_netcdf_mpiio.cpp +++ b/src/NETCDF/dump_netcdf_mpiio.cpp @@ -192,6 +192,7 @@ DumpNetCDFMPIIO::DumpNetCDFMPIIO(LAMMPS *lmp, int narg, char **arg) : type_nc_real = NC_FLOAT; thermo = false; + thermo_warn = true; thermovar = nullptr; framei = 0; @@ -220,7 +221,7 @@ void DumpNetCDFMPIIO::openfile() if (thermo && !singlefile_opened) { delete[] thermovar; - thermovar = new int[output->thermo->get_keywords().size()]; + thermovar = new int[output->thermo->get_nfield()]; } // now the computes and fixes have been initialized, so we can query @@ -318,8 +319,10 @@ void DumpNetCDFMPIIO::openfile() // perframe variables if (thermo) { - const auto &keywords = output->thermo->get_keywords(); - int nfield = keywords.size(); + Thermo *th = output->thermo; + const auto &keywords = th->get_keywords(); + const int nfield = th->get_nfield(); + for (int i = 0; i < nfield; i++) { NCERRX( ncmpi_inq_varid(ncid, keywords[i].c_str(), &thermovar[i]), keywords[i].c_str() ); } @@ -423,9 +426,11 @@ void DumpNetCDFMPIIO::openfile() // perframe variables if (thermo) { - const auto &fields = output->thermo->get_fields(); - const auto &keywords = output->thermo->get_keywords(); - int nfield = fields.size(); + Thermo *th = output->thermo; + const auto &fields = th->get_fields(); + const auto &keywords = th->get_keywords(); + const int nfield = th->get_nfield(); + for (int i = 0; i < nfield; i++) { if (fields[i].type == multitype::DOUBLE) { NCERRX( ncmpi_def_var(ncid, keywords[i].c_str(), type_nc_real, 1, dims, &thermovar[i]), keywords[i].c_str() ); @@ -593,9 +598,23 @@ void DumpNetCDFMPIIO::write() NCERR( ncmpi_begin_indep_data(ncid) ); if (thermo) { - const auto &keywords = output->thermo->get_keywords(); - const auto &fields = output->thermo->get_fields(); - int nfield = fields.size(); + Thermo *th = output->thermo; + + // will output current thermo data only on timesteps where it was computed. + // warn (once) about using cached copy from old timestep. + + if (thermo_warn && (update->ntimestep != th->get_timestep())) { + thermo_warn = false; + if (comm->me == 0) { + error->warning(FLERR, "Dump {} output on incompatible timestep with thermo output: {} vs {} \n" + " Dump netcdf/mpiio always stores thermo data from last thermo output", + id, th->get_timestep(), update->ntimestep); + } + } + + const auto &keywords = th->get_keywords(); + const auto &fields = th->get_fields(); + int nfield = th->get_nfield(); for (int i = 0; i < nfield; i++) { if (filewriter) { if (fields[i].type == multitype::DOUBLE) { @@ -609,7 +628,7 @@ void DumpNetCDFMPIIO::write() } } - // write timestep header + // write timestep header write_time_and_cell(); diff --git a/src/NETCDF/dump_netcdf_mpiio.h b/src/NETCDF/dump_netcdf_mpiio.h index 5948dc272b..14ee930e26 100644 --- a/src/NETCDF/dump_netcdf_mpiio.h +++ b/src/NETCDF/dump_netcdf_mpiio.h @@ -62,6 +62,7 @@ class DumpNetCDFMPIIO : public DumpCustom { int type_nc_real; // netcdf type to use for real variables: float or double bool thermo; // write thermo output to netcdf file + bool thermo_warn; // warn (once) that thermo output is on incompatible step bigint n_buffer; // size of buffer bigint *int_buffer; // buffer for passing data to netcdf From de561737a3be4a0c3554b544273110c7be46e16e Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Wed, 7 Jun 2023 15:28:35 -0400 Subject: [PATCH 206/396] update docs --- doc/src/dump_modify.rst | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/doc/src/dump_modify.rst b/doc/src/dump_modify.rst index 89b3766083..0ac2afbeee 100644 --- a/doc/src/dump_modify.rst +++ b/doc/src/dump_modify.rst @@ -758,7 +758,8 @@ file alongside per-atom data. The values included in the dump file are cached values from the last thermo output and include the exact same the values as specified by the :doc:`thermo_style ` command. Because these are cached values, they are only up-to-date when dump -output is on a timestep that also has thermo output. +output is on a timestep that also has thermo output. Dump style *yaml* +will skip thermo output on incompatible steps. ---------- From 491e152289e3abf267f4ebee6cddda7ba797591f Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Wed, 7 Jun 2023 16:21:01 -0400 Subject: [PATCH 207/396] add API to library interface to access last thermo data --- src/EXTRA-DUMP/dump_yaml.cpp | 4 +- src/NETCDF/dump_netcdf.cpp | 12 ++-- src/NETCDF/dump_netcdf_mpiio.cpp | 12 ++-- src/library.cpp | 99 +++++++++++++++++++++++++++++++- src/library.h | 1 + src/thermo.cpp | 1 + src/thermo.h | 4 +- 7 files changed, 116 insertions(+), 17 deletions(-) diff --git a/src/EXTRA-DUMP/dump_yaml.cpp b/src/EXTRA-DUMP/dump_yaml.cpp index f8d2fb2264..47cab1ee02 100644 --- a/src/EXTRA-DUMP/dump_yaml.cpp +++ b/src/EXTRA-DUMP/dump_yaml.cpp @@ -61,8 +61,8 @@ void DumpYAML::write_header(bigint ndump) if (thermo) { Thermo *th = output->thermo; // output thermo data only on timesteps where it was computed - if (update->ntimestep == th->get_timestep()) { - int nfield = th->get_nfield(); + if (update->ntimestep == *th->get_timestep()) { + int nfield = *th->get_nfield(); const auto &keywords = th->get_keywords(); const auto &fields = th->get_fields(); diff --git a/src/NETCDF/dump_netcdf.cpp b/src/NETCDF/dump_netcdf.cpp index 2b064edeae..0115c0bbe9 100644 --- a/src/NETCDF/dump_netcdf.cpp +++ b/src/NETCDF/dump_netcdf.cpp @@ -224,7 +224,7 @@ void DumpNetCDF::openfile() if (thermo && !singlefile_opened) { delete[] thermovar; - thermovar = new int[output->thermo->get_nfield()]; + thermovar = new int[*output->thermo->get_nfield()]; } // now the computes and fixes have been initialized, so we can query @@ -323,7 +323,7 @@ void DumpNetCDF::openfile() if (thermo) { Thermo *th = output->thermo; const auto &keywords = th->get_keywords(); - const int nfield = th->get_nfield(); + const int nfield = *th->get_nfield(); for (int i = 0; i < nfield; i++) { NCERRX( nc_inq_varid(ncid, keywords[i].c_str(), &thermovar[i]), keywords[i].c_str() ); @@ -439,7 +439,7 @@ void DumpNetCDF::openfile() Thermo *th = output->thermo; const auto &fields = th->get_fields(); const auto &keywords = th->get_keywords(); - const int nfield = th->get_nfield(); + const int nfield = *th->get_nfield(); for (int i = 0; i < nfield; i++) { if (fields[i].type == multitype::DOUBLE) { @@ -610,18 +610,18 @@ void DumpNetCDF::write() // will output current thermo data only on timesteps where it was computed. // warn (once) about using cached copy from old timestep. - if (thermo_warn && (update->ntimestep != th->get_timestep())) { + if (thermo_warn && (update->ntimestep != *th->get_timestep())) { thermo_warn = false; if (comm->me == 0) { error->warning(FLERR, "Dump {} output on incompatible timestep with thermo output: {} vs {} \n" " Dump netcdf always stores thermo data from last thermo output", - id, th->get_timestep(), update->ntimestep); + id, *th->get_timestep(), update->ntimestep); } } const auto &keywords = th->get_keywords(); const auto &fields = th->get_fields(); - int nfield = th->get_nfield(); + int nfield = *th->get_nfield(); for (int i = 0; i < nfield; i++) { if (filewriter) { if (fields[i].type == multitype::DOUBLE) { diff --git a/src/NETCDF/dump_netcdf_mpiio.cpp b/src/NETCDF/dump_netcdf_mpiio.cpp index 4a34f11ab4..f9382dacef 100644 --- a/src/NETCDF/dump_netcdf_mpiio.cpp +++ b/src/NETCDF/dump_netcdf_mpiio.cpp @@ -221,7 +221,7 @@ void DumpNetCDFMPIIO::openfile() if (thermo && !singlefile_opened) { delete[] thermovar; - thermovar = new int[output->thermo->get_nfield()]; + thermovar = new int[*output->thermo->get_nfield()]; } // now the computes and fixes have been initialized, so we can query @@ -321,7 +321,7 @@ void DumpNetCDFMPIIO::openfile() if (thermo) { Thermo *th = output->thermo; const auto &keywords = th->get_keywords(); - const int nfield = th->get_nfield(); + const int nfield = *th->get_nfield(); for (int i = 0; i < nfield; i++) { NCERRX( ncmpi_inq_varid(ncid, keywords[i].c_str(), &thermovar[i]), keywords[i].c_str() ); @@ -429,7 +429,7 @@ void DumpNetCDFMPIIO::openfile() Thermo *th = output->thermo; const auto &fields = th->get_fields(); const auto &keywords = th->get_keywords(); - const int nfield = th->get_nfield(); + const int nfield = *th->get_nfield(); for (int i = 0; i < nfield; i++) { if (fields[i].type == multitype::DOUBLE) { @@ -603,18 +603,18 @@ void DumpNetCDFMPIIO::write() // will output current thermo data only on timesteps where it was computed. // warn (once) about using cached copy from old timestep. - if (thermo_warn && (update->ntimestep != th->get_timestep())) { + if (thermo_warn && (update->ntimestep != *th->get_timestep())) { thermo_warn = false; if (comm->me == 0) { error->warning(FLERR, "Dump {} output on incompatible timestep with thermo output: {} vs {} \n" " Dump netcdf/mpiio always stores thermo data from last thermo output", - id, th->get_timestep(), update->ntimestep); + id, *th->get_timestep(), update->ntimestep); } } const auto &keywords = th->get_keywords(); const auto &fields = th->get_fields(); - int nfield = th->get_nfield(); + int nfield = *th->get_nfield(); for (int i = 0; i < nfield; i++) { if (filewriter) { if (fields[i].type == multitype::DOUBLE) { diff --git a/src/library.cpp b/src/library.cpp index 33f49a4e53..6b079b4a93 100644 --- a/src/library.cpp +++ b/src/library.cpp @@ -719,7 +719,7 @@ double lammps_get_natoms(void *handle) /* ---------------------------------------------------------------------- */ -/** Get current value of a thermo keyword. +/** Evaluate a thermo keyword. * \verbatim embed:rst @@ -750,6 +750,103 @@ double lammps_get_thermo(void *handle, const char *keyword) /* ---------------------------------------------------------------------- */ +/** Access cached data from last thermo output + * +\verbatim embed:rst + +This function provides access to cached data from the last thermo +output. This differs from :cpp:func:`lammps_get_thermo` in that it does +not trigger an evaluation. It provides direct access to a a read-only +location of the last thermo output data and the corresponding keyword +strings. The output depends on the value of the *what* argument string. + +.. list-table:: + :header-rows: 1 + :widths: auto + + * - Value of *what + - Description of return value + - Data type + - Uses index + * - step + - timestep when the last thermo output was generated or -1 when no data available + - pointer to bigint cast to void pointer + - no + * - num + - number of fields in thermo output + - pointer to int cast to void pointer + - no + * - keyword + - column keyword for thermo output + - const char pointer cast to void pointer + - yes + * - type + - data type of thermo output column. LAMMPS_INT, LAMMPS_DOUBLE, or LAMMPS_INT64 + - const int cast to void pointer + - yes + * - data + - actual field data for column + - pointer to either int, int64_t or double cast to void pointer + - yes + +\endverbatim + * + * \param handle pointer to a previously created LAMMPS instance + * \param what string with the kind of data requested + * \param idx integer with index into data arrays, ignored for scalar data + * \return pointer to location of requested data cast to void or NULL */ + +void *lammps_last_thermo(void *handle, const char *what, int idx) +{ + auto lmp = (LAMMPS *) handle; + void *val = nullptr; + Thermo *th = lmp->output->thermo; + if (!th) return nullptr; + const int nfield = *th->get_nfield(); + + BEGIN_CAPTURE + { + if (strcmp(what, "step") == 0) { + val = (void *) th->get_timestep(); + + } else if (strcmp(what, "num") == 0) { + val = (void *) th->get_nfield(); + + } else if (strcmp(what, "keyword") == 0) { + if ((idx < 0) || (idx >= nfield)) return nullptr; + const auto &keywords = th->get_keywords(); + val = (void *) keywords[idx].c_str(); + + } else if (strcmp(what, "type") == 0) { + if ((idx < 0) || (idx >= nfield)) return nullptr; + const auto &field = th->get_fields()[idx]; + if (field.type == multitype::INT) { + val = (void *) LAMMPS_INT; + } else if (field.type == multitype::BIGINT) { + val = (void *) LAMMPS_INT64; + } else if (field.type == multitype::DOUBLE) { + val = (void *) LAMMPS_DOUBLE; + } + + } else if (strcmp(what, "data") == 0) { + if ((idx < 0) || (idx >= nfield)) return nullptr; + const auto &field = th->get_fields()[idx]; + if (field.type == multitype::INT) { + val = (void *) &field.data.i; + } else if (field.type == multitype::BIGINT) { + val = (void *) &field.data.b; + } else if (field.type == multitype::DOUBLE) { + val = (void *) &field.data.d; + } + + } else val = nullptr; + } + END_CAPTURE + return val; +} + +/* ---------------------------------------------------------------------- */ + /** Extract simulation box parameters. * \verbatim embed:rst diff --git a/src/library.h b/src/library.h index 340b0edb7b..4c2530210c 100644 --- a/src/library.h +++ b/src/library.h @@ -148,6 +148,7 @@ void lammps_commands_string(void *handle, const char *str); double lammps_get_natoms(void *handle); double lammps_get_thermo(void *handle, const char *keyword); +void *lammps_last_thermo(void *handle, const char *what, int idx); void lammps_extract_box(void *handle, double *boxlo, double *boxhi, double *xy, double *yz, double *xz, int *pflags, int *boxflag); diff --git a/src/thermo.cpp b/src/thermo.cpp index 1c07da695f..c6e71354ff 100644 --- a/src/thermo.cpp +++ b/src/thermo.cpp @@ -111,6 +111,7 @@ Thermo::Thermo(LAMMPS *_lmp, int narg, char **arg) : lostflag = lostbond = Thermo::ERROR; lostbefore = warnbefore = 0; flushflag = 0; + ntimestep = -1; // set style and corresponding lineflag // custom style builds its own line of keywords, including wildcard expansion diff --git a/src/thermo.h b/src/thermo.h index f22f3103b0..333a282ca0 100644 --- a/src/thermo.h +++ b/src/thermo.h @@ -43,8 +43,8 @@ class Thermo : protected Pointers { int evaluate_keyword(const std::string &, double *); // for accessing cached thermo data - int get_nfield() const { return nfield; } - bigint get_timestep() const { return ntimestep; } + const int *get_nfield() const { return &nfield; } + const bigint *get_timestep() const { return &ntimestep; } const std::vector &get_fields() const { return field_data; } const std::vector &get_keywords() const { return keyword; } From f3ff8dac6626add46564385dcc39c622cc09546b Mon Sep 17 00:00:00 2001 From: jbcouli Date: Wed, 7 Jun 2023 16:23:06 -0600 Subject: [PATCH 208/396] clean up documentation for BPM bond styles --- doc/src/bond_bpm_rotational.rst | 45 +++++++++++++++++---------------- doc/src/bond_bpm_spring.rst | 37 ++++++++++++++------------- 2 files changed, 42 insertions(+), 40 deletions(-) diff --git a/doc/src/bond_bpm_rotational.rst b/doc/src/bond_bpm_rotational.rst index ca12d86ccc..cfacfde2cd 100644 --- a/doc/src/bond_bpm_rotational.rst +++ b/doc/src/bond_bpm_rotational.rst @@ -10,7 +10,7 @@ Syntax bond_style bpm/rotational keyword value attribute1 attribute2 ... -* optional keyword = *overlay/pair* or *store/local* or *smooth* or *break/no* +* optional keyword = *overlay/pair* or *store/local* or *smooth* or *break* .. parsed-literal:: @@ -80,32 +80,32 @@ respectively. Details on the calculations of shear displacements and angular displacements can be found in :ref:`(Wang) ` and :ref:`(Wang and Mora) `. -Bonds will break under sufficient stress. A breaking criteria is calculated +Bonds will break under sufficient stress. A breaking criterion is calculated .. math:: - B = \mathrm{max}\{0, \frac{f_r}{f_{r,c}} + \frac{|f_s|}{f_{s,c}} + - \frac{|\tau_b|}{\tau_{b,c}} + \frac{|\tau_t|}{\tau_{t,c}} \} + B = \mathrm{max}\left\{0, \frac{f_r}{f_{r,c}} + \frac{|f_s|}{f_{s,c}} + + \frac{|\tau_b|}{\tau_{b,c}} + \frac{|\tau_t|}{\tau_{t,c}} \right\} where :math:`|f_s|` is the magnitude of the shear force and :math:`|\tau_b|` and :math:`|\tau_t|` are the magnitudes of the -bending and twisting forces, respectively. The corresponding variables +bending and twisting torques, respectively. The corresponding variables :math:`f_{r,c}` :math:`f_{s,c}`, :math:`\tau_{b,c}`, and :math:`\tau_{t,c}` are critical limits to each force or torque. If :math:`B` is ever equal to or exceeds one, the bond will break. This -is done by setting by setting its type to 0 such that forces and +is done by setting the bond type to 0 such that forces and torques are no longer computed. After computing the base magnitudes of the forces and torques, they can be optionally multiplied by an extra factor :math:`w` to smoothly interpolate forces and torques to zero as the bond breaks. This term -is calculated as :math:`w = (1.0 - B^4)`. This smoothing factor can be -added or removed using the *smooth* keyword. +is calculated as :math:`w = (1.0 - B^4)`. This smoothing factor can be added +or removed by setting the *smooth* keyword to *yes* or *no*, respectively. Finally, additional damping forces and torques are applied to the two particles. A force is applied proportional to the difference in the normal velocity of particles using a similar construction as -dissipative particle dynamics (:ref:`(Groot) `): +dissipative particle dynamics :ref:`(Groot) `: .. math:: @@ -115,8 +115,8 @@ where :math:`\gamma_n` is the damping strength, :math:`\hat{r}` is the radial normal vector, and :math:`\vec{v}` is the velocity difference between the two particles. Similarly, tangential forces are applied to each atom proportional to the relative differences in sliding -velocities with a constant prefactor :math:`\gamma_s` (:ref:`(Wang et -al.) `) along with their associated torques. The rolling and +velocities with a constant prefactor :math:`\gamma_s` :ref:`(Wang et +al.) ` along with their associated torques. The rolling and twisting components of the relative angular velocities of the two atoms are also damped by applying torques with prefactors of :math:`\gamma_r` and :math:`\gamma_t`, respectively. @@ -139,21 +139,23 @@ or :doc:`read_restart ` commands: * :math:`\gamma_r` (force*distance/velocity units) * :math:`\gamma_t` (force*distance/velocity units) -However, the *normalize* option will normalize the radial and shear forces -by :math:`r_0` such that :math:`k_r` and :math:`k_s` are unit less. +If the *normalize* keyword is set to *yes*, the radial and shear forces +will be normalized by :math:`r_0` such that :math:`k_r` and :math:`k_s` +must be given in force units. By default, pair forces are not calculated between bonded particles. -Pair forces can alternatively be overlaid on top of bond forces using -the *overlay/pair* option. These settings require specific +Pair forces can alternatively be overlaid on top of bond forces by setting +the *overlay/pair* keyword to *yes*. These settings require specific :doc:`special_bonds ` settings described in the -restrictions. Further details can be found in the `:doc: how to -` page on BPMs. +restrictions. Further details can be found in the :doc:`how to +` page on BPMs. .. versionadded:: 28Mar2023 -If the *break* option is used, then LAMMPS assumes bonds should not break +If the *break* keyword is set to *no*, LAMMPS assumes bonds should not break during a simulation run. This will prevent some unnecessary calculation. -However, if a bond does break, it will trigger an error. +However, if a bond reaches a damage criterion greater than one, +it will trigger an error. If the *store/local* keyword is used, an internal fix will track bonds that break during the simulation. Whenever a bond breaks, data is processed @@ -239,9 +241,8 @@ requires setting special_bonds lj 0 1 1 coul 1 1 1 -and :doc:`newton ` must be set to bond off. If the -*overlay/pair* option is used, this bond style alternatively requires -setting +and :doc:`newton ` must be set to bond off. If the *overlay/pair* +keyword is set to *yes*, this bond style alternatively requires setting .. code-block:: LAMMPS diff --git a/doc/src/bond_bpm_spring.rst b/doc/src/bond_bpm_spring.rst index d89035dcad..2376b8e077 100644 --- a/doc/src/bond_bpm_spring.rst +++ b/doc/src/bond_bpm_spring.rst @@ -10,7 +10,7 @@ Syntax bond_style bpm/spring keyword value attribute1 attribute2 ... -* optional keyword = *overlay/pair* or *store/local* or *smooth* or *break/no* +* optional keyword = *overlay/pair* or *store/local* or *smooth* or *break* .. parsed-literal:: @@ -72,13 +72,13 @@ particles based on a model described by Clemmer and Robbins where :math:`k` is a stiffness, :math:`r` is the current distance and :math:`r_0` is the initial distance between the two particles, and :math:`w` is an optional smoothing factor discussed below. Bonds will -break at a strain of :math:`\epsilon_c`. This is done by setting by -setting its type to 0 such that forces are no longer computed. +break at a strain of :math:`\epsilon_c`. This is done by setting +the bond type to 0 such that forces are no longer computed. An additional damping force is applied to the bonded particles. This forces is proportional to the difference in the normal velocity of particles using a similar construction as -dissipative particle dynamics (:ref:`(Groot) `): +dissipative particle dynamics :ref:`(Groot) `: .. math:: @@ -88,9 +88,10 @@ where :math:`\gamma` is the damping strength, :math:`\hat{r}` is the radial normal vector, and :math:`\vec{v}` is the velocity difference between the two particles. -The smoothing factor :math:`w` can be added or removed using the -*smooth* keyword. It is constructed such that forces smoothly go -to zero, avoiding discontinuities, as bonds approach the critical strain +The smoothing factor :math:`w` can be added or removed by setting the +*smooth* keyword to *yes* or *no*, respectively. It is constructed such +that forces smoothly go to zero, avoiding discontinuities, as bonds +approach the critical strain .. math:: @@ -105,21 +106,22 @@ the data file or restart files read by the :doc:`read_data * :math:`\epsilon_c` (unit less) * :math:`\gamma` (force/velocity units) -However, the *normalize* option will normalize the elastic bond force by -:math:`r_0` such that :math:`k` is unit less. +If the *normalize* keyword is set to *yes*, the elastic bond force will be +normalized by :math:`r_0` such that :math:`k` must be given in force units. By default, pair forces are not calculated between bonded particles. -Pair forces can alternatively be overlaid on top of bond forces using -the *overlay/pair* option. These settings require specific +Pair forces can alternatively be overlaid on top of bond forces by setting +the *overlay/pair* keyword to *yes*. These settings require specific :doc:`special_bonds ` settings described in the -restrictions. Further details can be found in the `:doc: how to -` page on BPMs. +restrictions. Further details can be found in the :doc:`how to +` page on BPMs. .. versionadded:: 28Mar2023 -If the *break* option is used, then LAMMPS assumes bonds should not break +If the *break* keyword is set to *no*, LAMMPS assumes bonds should not break during a simulation run. This will prevent some unnecessary calculation. -However, if a bond does break, it will trigger an error. +However, if a bond reaches a strain greater than :math:`\epsilon_c`, +it will trigger an error. If the *store/local* keyword is used, an internal fix will track bonds that break during the simulation. Whenever a bond breaks, data is processed @@ -196,9 +198,8 @@ requires setting special_bonds lj 0 1 1 coul 1 1 1 -and :doc:`newton ` must be set to bond off. If the -*overlay/pair* option is used, this bond style alternatively requires -setting +and :doc:`newton ` must be set to bond off. If the *overlay/pair* +keyword is set to *yes*, this bond style alternatively requires setting .. code-block:: LAMMPS From 7551219d81c368e9b1879a3224377693beac306f Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Wed, 7 Jun 2023 20:16:26 -0400 Subject: [PATCH 209/396] correct multitype unittest for -DLAMMPS_SMALLSMALL --- unittest/utils/test_lmptype.cpp | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/unittest/utils/test_lmptype.cpp b/unittest/utils/test_lmptype.cpp index 6db340fddf..e5dc871953 100644 --- a/unittest/utils/test_lmptype.cpp +++ b/unittest/utils/test_lmptype.cpp @@ -41,7 +41,7 @@ TEST(Types, ubuf) TEST(Types, multitype) { - multitype m[6]; + multitype m[7]; int64_t b1 = (3L << 48) - 1; int i1 = 20; double d1 = 0.1; @@ -50,27 +50,22 @@ TEST(Types, multitype) m[1] = i1; m[2] = d1; -#if !defined(LAMMPS_SMALLSMALL) - m[3] = -((1L << 40) + (1L << 50)); -#endif + m[3] = (bigint) -((1L << 40) + (1L << 50)); m[4] = -1023; m[5] = -2.225; -#if defined(LAMMPS_SMALLSMALL) - EXPECT_EQ(m[0].type, multitype::INT); -#else EXPECT_EQ(m[0].type, multitype::BIGINT); -#endif EXPECT_EQ(m[1].type, multitype::INT); EXPECT_EQ(m[2].type, multitype::DOUBLE); #if defined(LAMMPS_SMALLSMALL) - EXPECT_EQ(m[3].type, multitype::NONE); + EXPECT_EQ(m[3].type, multitype::INT); #else EXPECT_EQ(m[3].type, multitype::BIGINT); #endif EXPECT_EQ(m[4].type, multitype::INT); EXPECT_EQ(m[5].type, multitype::DOUBLE); + EXPECT_EQ(m[6].type, multitype::NONE); EXPECT_EQ(m[0].data.b, b1); EXPECT_EQ(m[1].data.i, i1); From dd0bba6ac7a62f4e321f62c6105a7f736d3fd3bb Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Wed, 7 Jun 2023 20:37:53 -0400 Subject: [PATCH 210/396] whitespace --- src/GRANULAR/gran_sub_mod_normal.h | 6 +++--- src/library.cpp | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/GRANULAR/gran_sub_mod_normal.h b/src/GRANULAR/gran_sub_mod_normal.h index c1511fdfa5..6f2f3aabbe 100644 --- a/src/GRANULAR/gran_sub_mod_normal.h +++ b/src/GRANULAR/gran_sub_mod_normal.h @@ -94,7 +94,7 @@ namespace Granular_NS { void coeffs_to_local() override; void mix_coeffs(double *, double *) override; private: - int mixed_coefficients; + int mixed_coefficients; }; /* ---------------------------------------------------------------------- */ @@ -110,7 +110,7 @@ namespace Granular_NS { protected: double k, cohesion; double F_pulloff, Fne; - int mixed_coefficients; + int mixed_coefficients; }; /* ---------------------------------------------------------------------- */ @@ -129,7 +129,7 @@ namespace Granular_NS { protected: double k, cohesion; double Emix, F_pulloff, Fne; - int mixed_coefficients; + int mixed_coefficients; }; } // namespace Granular_NS diff --git a/src/library.cpp b/src/library.cpp index 6b079b4a93..62d029f625 100644 --- a/src/library.cpp +++ b/src/library.cpp @@ -788,7 +788,7 @@ strings. The output depends on the value of the *what* argument string. - actual field data for column - pointer to either int, int64_t or double cast to void pointer - yes - + \endverbatim * * \param handle pointer to a previously created LAMMPS instance From c851c7304c02d8b38424c240e3ee84671a402f7a Mon Sep 17 00:00:00 2001 From: Lars Veldscholte Date: Thu, 8 Jun 2023 11:03:21 +0200 Subject: [PATCH 211/396] Update documentation for compute stress/cartesian, and split the doc page compute_stress_profile into compute_stress_cartesian and compute_stress_curvilinear --- doc/src/compute_stress_cartesian.rst | 118 ++++++++++++++++++ ...ile.rst => compute_stress_curvilinear.rst} | 48 ++----- 2 files changed, 125 insertions(+), 41 deletions(-) create mode 100644 doc/src/compute_stress_cartesian.rst rename doc/src/{compute_stress_profile.rst => compute_stress_curvilinear.rst} (69%) diff --git a/doc/src/compute_stress_cartesian.rst b/doc/src/compute_stress_cartesian.rst new file mode 100644 index 0000000000..f52b360aa6 --- /dev/null +++ b/doc/src/compute_stress_cartesian.rst @@ -0,0 +1,118 @@ +.. index:: compute stress/cartesian + +compute stress/cartesian command +================================== + +Syntax +"""""" + +.. code-block:: LAMMPS + + compute ID group-ID stress/cartesian args + +* ID, group-ID are documented in :doc:`compute ` command +* args = argument specific to the compute style + +.. parsed-literal:: + + *stress/cartesian* args = dim1 bin_width1 dim2 bin_width2 keyword + dim1 = *x* or *y* or *z* + bin_width1 = width of the bin + dim2 = *x* or *y* or *z* or *NULL* + bin_width2 = width of the bin + keyword = *ke* or *pair* or *bond* + +Examples +"""""""" + +.. code-block:: LAMMPS + compute 1 all stress/cartesian x 0.1 NULL 0 + compute 1 all stress/cartesian y 0.1 z 0.1 + compute 1 all stress/cartesian x 0.1 NULL 0 ke pair + +Description +""""""""""" + +Compute *stress/cartesian* defines computations that calculate profiles of the +diagonal components of the local stress tensor over one or two Cartesian +dimensions, as described in :ref:`(Ikeshoji)`. The stress tensor is +split into a kinetic contribution :math:`P^k` and a virial contribution +:math:`P^v`. The sum gives the total stress tensor :math:`P = P^k+P^v`. +This compute obeys momentum balance through fluid interfaces. They use the +Irving--Kirkwood contour, which is the straight line between particle pairs. + +This compute only supports pair and bond (no angle, dihedral, improper, +or kspace) forces. By default, if no extra keywords are specified, all +supported contributions to the stress are included (ke, pair, bond). If any +keywords are specified, then only those components are summed. + +Output info +""""""""""" + +The output columns for *stress/cartesian* are the position of the +center of the local volume in the first and second dimensions, number +density, :math:`P^k_{xx}`, :math:`P^k_{yy}`, :math:`P^k_{zz}`, +:math:`P^v_{xx}`, :math:`P^v_{yy}`, and :math:`P^v_{zz}`. There are 8 +columns when one dimension is specified and 9 columns when two +dimensions are specified. The number of bins (rows) is +:math:`(L_1/b_1)(L_2/b_2)`, where :math:`L_1` and :math:`L_2` are the lengths +of the simulation box in the specified dimensions and :math:`b_1` and +:math:`b_2` are the specified bin widths. When only one dimension is +specified, the number of bins (rows) is :math:`L_1/b_1`. + +This array can be output with :doc:`fix ave/time `, + +.. code-block:: LAMMPS + + compute p all stress/cartesian x 0.1 + fix 2 all ave/time 100 1 100 c_p[*] file dump_p.out mode vector + +The values calculated by this compute are "intensive". The stress +values will be in pressure :doc:`units `. The number density +values are in inverse volume :doc:`units `. + +NOTE 1: The local stress does not include any Lennard-Jones tail +corrections to the stress added by the +:doc:`pair_modify tail yes ` +command, since those are contributions to the global system pressure. + +NOTE 2: The local stress profiles generated by these computes are +similar to those obtained by the +:doc:`method-of-planes (MOP) `. +A key difference +is that compute `stress/mop/profile ` +considers particles crossing a set of planes, while +*stress/cartesian* computes averages for a set of small volumes. +Moreover, this compute computes the diagonal components of the stress +tensor :math:`P_{xx}`, :math:`P_{yy}`, and :math:`P_{zz}`, while +`stress/mop/profile ` computes the components +:math:`P_{ix}`, :math:`P_{iy}`, and :math:`P_{iz}`, where :math:`i` is the +direction normal to the plane. + +More information on the similarities and differences can be found in +:ref:`(Ikeshoji)`. + +Restrictions +"""""""""""" + +These computes calculate the stress tensor contributions for pair and bond +forces only (no angle, dihedral, improper, or kspace force). +It requires pairwise force calculations not available for most +many-body pair styles. + +These computes are part of the EXTRA-COMPUTE package. They are only +enabled if LAMMPS was built with that package. See the :doc:`Build +package ` doc page for more info. + +Related commands +"""""""""""""""" + +:doc:`compute stress/atom `, :doc:`compute pressure `, +:doc:`compute stress/mop/profile `, :doc:`compute stress/spherical `, +:doc:`compute stress/cylinder ` + +---------- + +.. _Ikeshoji2: + +**(Ikeshoji)** Ikeshoji, Hafskjold, Furuholt, Mol Sim, 29, 101-109, (2003). \ No newline at end of file diff --git a/doc/src/compute_stress_profile.rst b/doc/src/compute_stress_curvilinear.rst similarity index 69% rename from doc/src/compute_stress_profile.rst rename to doc/src/compute_stress_curvilinear.rst index 7a4b6a38e6..f7cbf5efbe 100644 --- a/doc/src/compute_stress_profile.rst +++ b/doc/src/compute_stress_curvilinear.rst @@ -1,11 +1,6 @@ -.. index:: compute stress/cartesian .. index:: compute stress/cylinder .. index:: compute stress/spherical - -compute stress/cartesian command -================================== - compute stress/cylinder command ================================= @@ -20,15 +15,11 @@ Syntax compute ID group-ID style args * ID, group-ID are documented in :doc:`compute ` command -* style = stress/cartesian or stress/spherical or stress/cylinder +* style = stress/spherical or stress/cylinder * args = argument specific to the compute style .. parsed-literal:: - *stress/cartesian* args = dim bin_width - dim = *x* or *y* or *z* - bin_width = width of the bin - one or two dim/bin_width pairs may be appended *stress/cylinder* args = zlo zh Rmax bin_width keyword zlo = minimum z-boundary for cylinder zhi = maximum z-boundary for cylinder @@ -45,9 +36,6 @@ Examples """""""" .. code-block:: LAMMPS - - compute 1 all stress/cartesian x 0.1 - compute 1 all stress/cartesian y 0.25 z 0.1 compute 1 all stress/cylinder -10.0 10.0 15.0 0.25 compute 1 all stress/cylinder -10.0 10.0 15.0 0.25 ke no compute 1 all stress/spherical 0 0 0 0.1 10 @@ -55,21 +43,19 @@ Examples Description """"""""""" -Compute *stress/cartesian*, compute *stress/cylinder*, and compute +Compute *stress/cylinder*, and compute *stress/spherical* define computations that calculate profiles of the diagonal components of the local stress tensor in the specified coordinate system. The stress tensor is split into a kinetic contribution :math:`P^k` and a virial contribution :math:`P^v`. The sum gives the total stress tensor :math:`P = P^k+P^v`. These computes can for example be used to calculate the diagonal components of the local -stress tensor of interfaces with flat, cylindrical, or spherical +stress tensor of surfaces with cylindrical or spherical symmetry. These computes obeys momentum balance through fluid interfaces. They use the Irving--Kirkwood contour, which is the straight line between particle pairs. -The *stress/cartesian* computes the stress profile along one or two -Cartesian coordinates, as described in :ref:`(Ikeshoji)`. The -compute *stress/cylinder* computes the stress profile along the +The compute *stress/cylinder* computes the stress profile along the radial direction in cylindrical coordinates, as described in :ref:`(Addington)`. The compute *stress/spherical* computes the stress profile along the radial direction in spherical @@ -79,17 +65,6 @@ coordinates, as described in :ref:`(Ikeshoji)`. Output info """"""""""" -The output columns for *stress/cartesian* are the position of the -center of the local volume in the first and second dimensions, number -density, :math:`P^k_{xx}`, :math:`P^k_{yy}`, :math:`P^k_{zz}`, -:math:`P^v_{xx}`, :math:`P^v_{yy}`, and :math:`P^v_{zz}`. There are 8 -columns when one dimension is specified and 9 columns when two -dimensions are specified. The number of bins (rows) is -:math:`(L_1/b_1)(L_2/b_2)`, where :math:`L_1` and :math:`L_2` are the lengths -of the simulation box in the specified dimensions and :math:`b_1` and -:math:`b_2` are the specified bin widths. When only one dimension is -specified, the number of bins (rows) is :math:`L_1/b_1`. - The default output columns for *stress/cylinder* are the radius to the center of the cylindrical shell, number density, :math:`P^k_{rr}`, :math:`P^k_{\phi\phi}`, :math:`P^k_{zz}`, :math:`P^v_{rr}`, @@ -111,7 +86,7 @@ This array can be output with :doc:`fix ave/time `, .. code-block:: LAMMPS - compute p all stress/cartesian x 0.1 + compute 1 all stress/spherical 0 0 0 0.1 10 fix 2 all ave/time 100 1 100 c_p[*] file dump_p.out mode vector The values calculated by this compute are "intensive". The stress @@ -123,16 +98,6 @@ corrections to the stress added by the :doc:`pair_modify tail yes ` command, since those are contributions to the global system pressure. -NOTE 2: The local stress profiles generated by these computes are -similar to those obtained by the -:doc:`method-of-planes (MOP) `. -A key difference -is that compute `stress/mop/profile ` -considers particles crossing a set of planes, while -*stress/cartesian* computes averages for a set of small volumes. -More information on the similarities and differences can be found in -:ref:`(Ikeshoji)`. - Restrictions """""""""""" @@ -150,7 +115,8 @@ package ` doc page for more info. Related commands """""""""""""""" -:doc:`compute stress/atom `, :doc:`compute pressure `, :doc:`compute stress/mop/profile ` +:doc:`compute stress/atom `, :doc:`compute pressure `, :doc:`compute +stress/mop/profile `, :doc:`compute stress/cartesian ` Default """"""" From 2272d8dd205c99cf91c202e3961723719b7f673d Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Thu, 8 Jun 2023 09:45:12 -0400 Subject: [PATCH 212/396] add new library interface function to documentation --- doc/src/Library_properties.rst | 6 ++++ src/library.cpp | 53 ++++++++++++++++++---------------- 2 files changed, 34 insertions(+), 25 deletions(-) diff --git a/doc/src/Library_properties.rst b/doc/src/Library_properties.rst index 21e5609fc0..005bfaeea5 100644 --- a/doc/src/Library_properties.rst +++ b/doc/src/Library_properties.rst @@ -5,6 +5,7 @@ This section documents the following functions: - :cpp:func:`lammps_get_natoms` - :cpp:func:`lammps_get_thermo` +- :cpp:func:`lammps_last_thermo` - :cpp:func:`lammps_extract_box` - :cpp:func:`lammps_reset_box` - :cpp:func:`lammps_memory_usage` @@ -81,6 +82,11 @@ subdomains and processors. ----------------------- +.. doxygenfunction:: lammps_last_thermo + :project: progguide + +----------------------- + .. doxygenfunction:: lammps_extract_box :project: progguide diff --git a/src/library.cpp b/src/library.cpp index 62d029f625..36d53c3e6c 100644 --- a/src/library.cpp +++ b/src/library.cpp @@ -723,10 +723,12 @@ double lammps_get_natoms(void *handle) * \verbatim embed:rst -This function returns the current value of a :doc:`thermo keyword -`. Unlike :cpp:func:`lammps_extract_global` it does not -give access to the storage of the desired data but returns its value as -a ``double``, so it can also return information that is computed on-the-fly. +This function returns the current value of a :doc:`thermo keyword `. +Unlike :cpp:func:`lammps_extract_global` it does not give access to the +storage of the desired data but returns its value as a ``double``, so it +can also return information that is computed on-the-fly. +Use :cpp:func:`lammps_last_thermo` to get access to the cached data from +the last thermo output. \endverbatim * @@ -754,49 +756,50 @@ double lammps_get_thermo(void *handle, const char *keyword) * \verbatim embed:rst -This function provides access to cached data from the last thermo -output. This differs from :cpp:func:`lammps_get_thermo` in that it does -not trigger an evaluation. It provides direct access to a a read-only -location of the last thermo output data and the corresponding keyword -strings. The output depends on the value of the *what* argument string. +This function provides access to cached data from the last thermo output. +This differs from :cpp:func:`lammps_get_thermo` in that it does not trigger +an evaluation. Instead it provides direct access to a read-only location +of the last thermo output data and the corresponding keyword strings. +The how to handle the return value depends on the value of the *what* +argument string. .. list-table:: :header-rows: 1 :widths: auto - * - Value of *what + * - Value of *what* - Description of return value - Data type - Uses index * - step - - timestep when the last thermo output was generated or -1 when no data available - - pointer to bigint cast to void pointer + - timestep when the last thermo output was generated or -1 + - pointer to bigint - no * - num - number of fields in thermo output - - pointer to int cast to void pointer + - pointer to int - no * - keyword - column keyword for thermo output - - const char pointer cast to void pointer + - const char pointer - yes * - type - - data type of thermo output column. LAMMPS_INT, LAMMPS_DOUBLE, or LAMMPS_INT64 - - const int cast to void pointer + - data type of thermo output column; see :cpp:enum:`_LMP_DATATYPE_CONST` + - const int - yes * - data - actual field data for column - - pointer to either int, int64_t or double cast to void pointer + - pointer to either int, int64_t or double - yes \endverbatim * * \param handle pointer to a previously created LAMMPS instance * \param what string with the kind of data requested - * \param idx integer with index into data arrays, ignored for scalar data + * \param index integer with index into data arrays, ignored for scalar data * \return pointer to location of requested data cast to void or NULL */ -void *lammps_last_thermo(void *handle, const char *what, int idx) +void *lammps_last_thermo(void *handle, const char *what, int index) { auto lmp = (LAMMPS *) handle; void *val = nullptr; @@ -813,13 +816,13 @@ void *lammps_last_thermo(void *handle, const char *what, int idx) val = (void *) th->get_nfield(); } else if (strcmp(what, "keyword") == 0) { - if ((idx < 0) || (idx >= nfield)) return nullptr; + if ((index < 0) || (index >= nfield)) return nullptr; const auto &keywords = th->get_keywords(); - val = (void *) keywords[idx].c_str(); + val = (void *) keywords[index].c_str(); } else if (strcmp(what, "type") == 0) { - if ((idx < 0) || (idx >= nfield)) return nullptr; - const auto &field = th->get_fields()[idx]; + if ((index < 0) || (index >= nfield)) return nullptr; + const auto &field = th->get_fields()[index]; if (field.type == multitype::INT) { val = (void *) LAMMPS_INT; } else if (field.type == multitype::BIGINT) { @@ -829,8 +832,8 @@ void *lammps_last_thermo(void *handle, const char *what, int idx) } } else if (strcmp(what, "data") == 0) { - if ((idx < 0) || (idx >= nfield)) return nullptr; - const auto &field = th->get_fields()[idx]; + if ((index < 0) || (index >= nfield)) return nullptr; + const auto &field = th->get_fields()[index]; if (field.type == multitype::INT) { val = (void *) &field.data.i; } else if (field.type == multitype::BIGINT) { From d6ad52ea6604cbf031076dd583c07d154bfdcca7 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Thu, 8 Jun 2023 09:46:33 -0400 Subject: [PATCH 213/396] allow wildcards with "cutoff" keyword to fix reaxff/species this also switched to using fmtlib for column aligned output formatting and re-applies clang-format. --- doc/src/fix_reaxff_species.rst | 23 +++++-- src/REAXFF/fix_reaxff_species.cpp | 106 +++++++++++++++--------------- src/REAXFF/fix_reaxff_species.h | 2 - 3 files changed, 71 insertions(+), 60 deletions(-) diff --git a/doc/src/fix_reaxff_species.rst b/doc/src/fix_reaxff_species.rst index f57132f08b..c22c9d7b9f 100644 --- a/doc/src/fix_reaxff_species.rst +++ b/doc/src/fix_reaxff_species.rst @@ -25,7 +25,7 @@ Syntax .. parsed-literal:: *cutoff* value = I J Cutoff - I, J = atom types + I, J = atom types (see asterisk form below) Cutoff = Bond-order cutoff value for this pair of atom types *element* value = Element1, Element2, ... *position* value = posfreq filepos @@ -49,7 +49,7 @@ Examples .. code-block:: LAMMPS fix 1 all reaxff/species 10 10 100 species.out - fix 1 all reaxff/species 1 2 20 species.out cutoff 1 1 0.40 cutoff 1 2 0.55 + fix 1 all reaxff/species 1 2 20 species.out cutoff 1 1 0.40 cutoff 1 2*3 0.55 fix 1 all reaxff/species 1 100 100 species.out element Au O H position 1000 AuOH.pos fix 1 all reaxff/species 1 100 100 species.out delete species.del masslimit 0 50 @@ -88,13 +88,24 @@ If the filename ends with ".gz", the output file is written in gzipped format. A gzipped dump file will be about 3x smaller than the text version, but will also take longer to write. +.. versionadded:: TBD + + Support for wildcards added + Optional keyword *cutoff* can be assigned to change the minimum bond-order values used in identifying chemical bonds between pairs of atoms. Bond-order cutoffs should be carefully chosen, as bond-order -cutoffs that are too small may include too many bonds (which will -result in an error), while cutoffs that are too large will result in -fragmented molecules. The default cutoff of 0.3 usually gives good -results. +cutoffs that are too small may include too many bonds (which will result +in an error), while cutoffs that are too large will result in fragmented +molecules. The default cutoff of 0.3 usually gives good results. A +wildcard asterisk can be used in place of or in conjunction with the I,J +arguments to set the bond-order cutoff for multiple pairs of atom types. +This takes the form "\*" or "\*n" or "n\*" or "m\*n". If :math:`N` is +the number of atom types, then an asterisk with no numeric values means +all types from 1 to :math:`N`. A leading asterisk means all types from +1 to n (inclusive). A trailing asterisk means all types from n to +:math:`N` (inclusive). A middle asterisk means all types from m to n +(inclusive). The optional keyword *element* can be used to specify the chemical symbol printed for each LAMMPS atom type. The number of symbols must diff --git a/src/REAXFF/fix_reaxff_species.cpp b/src/REAXFF/fix_reaxff_species.cpp index 92bca99ae0..8fa06cafb3 100644 --- a/src/REAXFF/fix_reaxff_species.cpp +++ b/src/REAXFF/fix_reaxff_species.cpp @@ -48,15 +48,16 @@ using namespace LAMMPS_NS; using namespace FixConst; static const char cite_reaxff_species_delete[] = - "fix reaxff/species, 'delete' keyword: https://doi.org/10.1016/j.carbon.2022.11.002\n\n" - "@Article{Gissinger23,\n" - " author = {J. R. Gissinger, S. R. Zavada, J. G. Smith, J. Kemppainen, I. Gallegos, G. M. Odegard, E. J. Siochi, K. E. Wise},\n" - " title = {Predicting char yield of high-temperature resins},\n" - " journal = {Carbon},\n" - " year = 2023,\n" - " volume = 202,\n" - " pages = {336-347}\n" - "}\n\n"; + "fix reaxff/species, 'delete' keyword: https://doi.org/10.1016/j.carbon.2022.11.002\n\n" + "@Article{Gissinger23,\n" + " author = {J. R. Gissinger, S. R. Zavada, J. G. Smith, J. Kemppainen, I. Gallegos, G. M. " + "Odegard, E. J. Siochi, K. E. Wise},\n" + " title = {Predicting char yield of high-temperature resins},\n" + " journal = {Carbon},\n" + " year = 2023,\n" + " volume = 202,\n" + " pages = {336-347}\n" + "}\n\n"; /* ---------------------------------------------------------------------- */ @@ -148,13 +149,11 @@ FixReaxFFSpecies::FixReaxFFSpecies(LAMMPS *lmp, int narg, char **arg) : setupflag = 0; // set default bond order cutoff - int itype, jtype; - double bo_cut; - bg_cut = 0.30; + double bo_cut = 0.30; int np1 = ntypes + 1; memory->create(BOCut, np1, np1, "reaxff/species:BOCut"); for (int i = 1; i < np1; i++) - for (int j = 1; j < np1; j++) BOCut[i][j] = bg_cut; + for (int j = 1; j < np1; j++) BOCut[i][j] = bo_cut; // optional args eletype = nullptr; @@ -172,16 +171,19 @@ FixReaxFFSpecies::FixReaxFFSpecies(LAMMPS *lmp, int narg, char **arg) : // set BO cutoff if (strcmp(arg[iarg], "cutoff") == 0) { if (iarg + 4 > narg) utils::missing_cmd_args(FLERR, "fix reaxff/species cutoff", error); - itype = utils::inumeric(FLERR, arg[iarg + 1], false, lmp); - jtype = utils::inumeric(FLERR, arg[iarg + 2], false, lmp); + int ilo, ihi, jlo, jhi; + utils::bounds(FLERR, arg[iarg + 1], 1, atom->ntypes, ilo, ihi, error); + utils::bounds(FLERR, arg[iarg + 2], 1, atom->ntypes, jlo, jhi, error); bo_cut = utils::numeric(FLERR, arg[iarg + 3], false, lmp); - if ((itype <= 0) || (jtype <= 0) || (itype > ntypes) || (jtype > ntypes)) - error->all(FLERR, "Fix reaxff/species cutoff atom type(s) out of range"); if ((bo_cut > 1.0) || (bo_cut < 0.0)) error->all(FLERR, "Fix reaxff/species invalid cutoff value: {}", bo_cut); - BOCut[itype][jtype] = bo_cut; - BOCut[jtype][itype] = bo_cut; + for (int i = ilo; i <= ihi; ++i) { + for (int j = MAX(jlo, i); j <= jhi; ++j) { + BOCut[i][j] = bo_cut; + BOCut[j][i] = bo_cut; + } + } iarg += 4; // modify element type names @@ -240,17 +242,21 @@ FixReaxFFSpecies::FixReaxFFSpecies(LAMMPS *lmp, int narg, char **arg) : error->all(FLERR, "Unknown fix reaxff/species delete option: {}", arg[iarg]); // rate limit when deleting molecules } else if (strcmp(arg[iarg], "delete_rate_limit") == 0) { - if (iarg + 3 > narg) utils::missing_cmd_args(FLERR, "fix reaxff/species delete_rate_limit", error); + if (iarg + 3 > narg) + utils::missing_cmd_args(FLERR, "fix reaxff/species delete_rate_limit", error); delete_Nlimit_varid = -1; - if (strncmp(arg[iarg+1],"v_",2) == 0) { - delete_Nlimit_varname = &arg[iarg+1][2]; + if (strncmp(arg[iarg + 1], "v_", 2) == 0) { + delete_Nlimit_varname = &arg[iarg + 1][2]; delete_Nlimit_varid = input->variable->find(delete_Nlimit_varname.c_str()); if (delete_Nlimit_varid < 0) - error->all(FLERR,"Fix reaxff/species: Variable name {} does not exist",delete_Nlimit_varname); + error->all(FLERR, "Fix reaxff/species: Variable name {} does not exist", + delete_Nlimit_varname); if (!input->variable->equalstyle(delete_Nlimit_varid)) - error->all(FLERR,"Fix reaxff/species: Variable {} is not equal-style",delete_Nlimit_varname); - } else delete_Nlimit = utils::numeric(FLERR, arg[iarg+1], false, lmp); - delete_Nsteps = utils::numeric(FLERR, arg[iarg+2], false, lmp); + error->all(FLERR, "Fix reaxff/species: Variable {} is not equal-style", + delete_Nlimit_varname); + } else + delete_Nlimit = utils::numeric(FLERR, arg[iarg + 1], false, lmp); + delete_Nsteps = utils::numeric(FLERR, arg[iarg + 2], false, lmp); iarg += 3; // position of molecules } else if (strcmp(arg[iarg], "position") == 0) { @@ -292,10 +298,9 @@ FixReaxFFSpecies::FixReaxFFSpecies(LAMMPS *lmp, int narg, char **arg) : if (delete_Nsteps > 0) { if (lmp->citeme) lmp->citeme->add(cite_reaxff_species_delete); - memory->create(delete_Tcount,delete_Nsteps,"reaxff/species:delete_Tcount"); + memory->create(delete_Tcount, delete_Nsteps, "reaxff/species:delete_Tcount"); - for (int i = 0; i < delete_Nsteps; i++) - delete_Tcount[i] = -1; + for (int i = 0; i < delete_Nsteps; i++) delete_Tcount[i] = -1; delete_Tcount[0] = 0; } @@ -393,9 +398,11 @@ void FixReaxFFSpecies::init() if (delete_Nsteps > 0) { delete_Nlimit_varid = input->variable->find(delete_Nlimit_varname.c_str()); if (delete_Nlimit_varid < 0) - error->all(FLERR,"Fix reaxff/species: Variable name {} does not exist",delete_Nlimit_varname); + error->all(FLERR, "Fix reaxff/species: Variable name {} does not exist", + delete_Nlimit_varname); if (!input->variable->equalstyle(delete_Nlimit_varid)) - error->all(FLERR,"Fix reaxff/species: Variable {} is not equal-style",delete_Nlimit_varname); + error->all(FLERR, "Fix reaxff/species: Variable {} is not equal-style", + delete_Nlimit_varname); } } @@ -427,8 +434,7 @@ void FixReaxFFSpecies::Output_ReaxFF_Bonds(bigint ntimestep, FILE * /*fp*/) if (ntimestep != nvalid) { // push back delete_Tcount on every step if (delete_Nsteps > 0) - for (int i = delete_Nsteps-1; i > 0; i--) - delete_Tcount[i] = delete_Tcount[i-1]; + for (int i = delete_Nsteps - 1; i > 0; i--) delete_Tcount[i] = delete_Tcount[i - 1]; return; } @@ -732,31 +738,31 @@ void FixReaxFFSpecies::WriteFormulas(int Nmole, int Nspec) int i, j, itemp; bigint ntimestep = update->ntimestep; - fprintf(fp, "# Timestep No_Moles No_Specs "); + fprintf(fp, "# Timestep No_Moles No_Specs"); Nmoltype = 0; for (i = 0; i < Nspec; i++) nd[i] = CheckExistence(i, ntypes); for (i = 0; i < Nmoltype; i++) { + std::string molname; for (j = 0; j < ntypes; j++) { itemp = MolType[ntypes * i + j]; if (itemp != 0) { if (eletype) - fprintf(fp, "%s", eletype[j]); + molname += eletype[j]; else - fprintf(fp, "%c", ele[j]); - if (itemp != 1) fprintf(fp, "%d", itemp); + molname += ele[j]; + if (itemp != 1) molname += std::to_string(itemp); } } - fputs("\t", fp); + fmt::print(fp, " {:>11}", molname); } fputs("\n", fp); - fmt::print(fp, "{} {:11} {:11}\t", ntimestep, Nmole, Nspec); - - for (i = 0; i < Nmoltype; i++) fprintf(fp, " %d\t", NMol[i]); - fprintf(fp, "\n"); + fmt::print(fp, "{:>11} {:>11} {:>11}", ntimestep, Nmole, Nspec); + for (i = 0; i < Nmoltype; i++) fmt::print(fp, " {:>11}", NMol[i]); + fputs("\n", fp); } /* ---------------------------------------------------------------------- */ @@ -884,8 +890,8 @@ void FixReaxFFSpecies::DeleteSpecies(int Nmole, int Nspec) int ndeletions; int headroom = -1; if (delete_Nsteps > 0) { - if (delete_Tcount[delete_Nsteps-1] == -1) return; - ndeletions = delete_Tcount[0] - delete_Tcount[delete_Nsteps-1]; + if (delete_Tcount[delete_Nsteps - 1] == -1) return; + ndeletions = delete_Tcount[0] - delete_Tcount[delete_Nsteps - 1]; if (delete_Nlimit_varid > -1) delete_Nlimit = input->variable->compute_equal(delete_Nlimit_varid); headroom = MAX(0, delete_Nlimit - ndeletions); @@ -925,13 +931,11 @@ void FixReaxFFSpecies::DeleteSpecies(int Nmole, int Nspec) std::random_device rnd; std::minstd_rand park_rng(rnd()); int *molrange; - memory->create(molrange,Nmole,"reaxff/species:molrange"); - for (m = 0; m < Nmole; m++) - molrange[m] = m + 1; + memory->create(molrange, Nmole, "reaxff/species:molrange"); + for (m = 0; m < Nmole; m++) molrange[m] = m + 1; if (delete_Nsteps > 0) { // shuffle index when using rate_limit, in case order is biased - if (comm->me == 0) - std::shuffle(&molrange[0],&molrange[Nmole], park_rng); + if (comm->me == 0) std::shuffle(&molrange[0], &molrange[Nmole], park_rng); MPI_Bcast(&molrange[0], Nmole, MPI_INT, 0, world); } @@ -1060,11 +1064,9 @@ void FixReaxFFSpecies::DeleteSpecies(int Nmole, int Nspec) } } - // push back delete_Tcount on every step if (delete_Nsteps > 0) { - for (i = delete_Nsteps-1; i > 0; i--) - delete_Tcount[i] = delete_Tcount[i-1]; + for (i = delete_Nsteps - 1; i > 0; i--) delete_Tcount[i] = delete_Tcount[i - 1]; delete_Tcount[0] += this_delete_Tcount; } diff --git a/src/REAXFF/fix_reaxff_species.h b/src/REAXFF/fix_reaxff_species.h index 27efa0f915..f711cdeb11 100644 --- a/src/REAXFF/fix_reaxff_species.h +++ b/src/REAXFF/fix_reaxff_species.h @@ -51,8 +51,6 @@ class FixReaxFFSpecies : public Fix { int *Mol2Spec; double *clusterID; AtomCoord *x0; - - double bg_cut; double **BOCut; std::vector del_species; From 36cac1e83deba7aa03f6122128f6fdf5244ff1bc Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Thu, 8 Jun 2023 12:45:41 -0400 Subject: [PATCH 214/396] make sure the field_data vector size always matches the size of the keywords vector --- src/thermo.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/thermo.cpp b/src/thermo.cpp index c6e71354ff..6122edec83 100644 --- a/src/thermo.cpp +++ b/src/thermo.cpp @@ -1068,6 +1068,8 @@ void Thermo::parse_fields(const std::string &str) } } } + field_data.clear(); + field_data.resize(nfield); } /* ---------------------------------------------------------------------- From a2c968386ed31621e288b63b954243d5ae8a9c4e Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Thu, 8 Jun 2023 12:46:00 -0400 Subject: [PATCH 215/396] include versionadded tag --- src/library.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/library.cpp b/src/library.cpp index 36d53c3e6c..02758abcda 100644 --- a/src/library.cpp +++ b/src/library.cpp @@ -756,6 +756,8 @@ double lammps_get_thermo(void *handle, const char *keyword) * \verbatim embed:rst +.. versionadded:: TBD + This function provides access to cached data from the last thermo output. This differs from :cpp:func:`lammps_get_thermo` in that it does not trigger an evaluation. Instead it provides direct access to a read-only location From 8ddac8cf0229212b046f6eca6b29c4829d319df0 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Thu, 8 Jun 2023 12:46:41 -0400 Subject: [PATCH 216/396] search through the python folders recursive to detect all pending version tags --- tools/coding_standard/versiontags.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/coding_standard/versiontags.py b/tools/coding_standard/versiontags.py index 0b4597046f..ec512a3fad 100644 --- a/tools/coding_standard/versiontags.py +++ b/tools/coding_standard/versiontags.py @@ -21,7 +21,7 @@ DEFAULT_CONFIG = """ recursive: true include: - doc/src/** - - python + - python/** - src/** exclude: - src/Make.sh From 3f6032e80d05039f538aac19f7916102520e08ee Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Thu, 8 Jun 2023 13:03:28 -0400 Subject: [PATCH 217/396] add python module interface to lammps_last_thermo, small consistency fixes --- python/lammps/core.py | 54 +++++++++++++++++++++++++++++++++++++++++++ src/library.cpp | 6 ++--- src/library.h | 2 +- 3 files changed, 58 insertions(+), 4 deletions(-) diff --git a/python/lammps/core.py b/python/lammps/core.py index 80961186f3..932d4b863c 100644 --- a/python/lammps/core.py +++ b/python/lammps/core.py @@ -272,6 +272,9 @@ class lammps(object): self.lib.lammps_get_thermo.argtypes = [c_void_p, c_char_p] self.lib.lammps_get_thermo.restype = c_double + self.lib.lammps_last_thermo.argtypes = [c_void_p, c_char_p, c_int] + self.lib.lammps_last_thermo.restype = c_void_p + self.lib.lammps_encode_image_flags.restype = self.c_imageint self.lib.lammps_config_has_package.argtypes = [c_char_p] @@ -744,6 +747,57 @@ class lammps(object): # ------------------------------------------------------------------------- + def last_thermo(self): + """Get a dictionary of the last thermodynamic output + + This is a wrapper around the :cpp:func:`lammps_last_thermo` + function of the C-library interface. It collects the cached thermo + data from the last timestep into a dictionary. The return value + is None, if there has not been any thermo output yet. + + :return: value of thermo keyword + :rtype: dict or None + """ + + rv = dict() + with ExceptionCheck(self): + ptr = self.lib.lammps_last_thermo(self.lmp, c_char_p("step".encode()), 0) + mystep = cast(ptr, POINTER(self.c_bigint)).contents.value + if mystep < 0: + return None + + with ExceptionCheck(self): + ptr = self.lib.lammps_last_thermo(self.lmp, c_char_p("num".encode()), 0) + nfield = cast(ptr, POINTER(c_int)).contents.value + + for i in range(nfield): + with ExceptionCheck(self): + ptr = self.lib.lammps_last_thermo(self.lmp, c_char_p("keyword".encode()), i) + kw = cast(ptr, c_char_p).value.decode() + + # temporarily switch return type since this stores an int in a pointer + self.lib.lammps_last_thermo.restype = c_int + with ExceptionCheck(self): + typ = self.lib.lammps_last_thermo(self.lmp, c_char_p("type".encode()), i) + self.lib.lammps_last_thermo.restype = c_void_p + with ExceptionCheck(self): + ptr = self.lib.lammps_last_thermo(self.lmp, c_char_p("data".encode()), i) + + if typ == LAMMPS_DOUBLE: + val = cast(ptr, POINTER(c_double)).contents.value + elif typ == LAMMPS_INT: + val = cast(ptr, POINTER(c_int)).contents.value + elif typ == LAMMPS_INT64: + val = cast(ptr, POINTER(c_int64)).contents.value + else: + # we should not get here + raise TypeError("Unknown LAMMPS data type " + str(typ)) + rv[kw] = val + + return rv + + # ------------------------------------------------------------------------- + def extract_setting(self, name): """Query LAMMPS about global settings that can be expressed as an integer. diff --git a/src/library.cpp b/src/library.cpp index 02758abcda..cf5d131ba6 100644 --- a/src/library.cpp +++ b/src/library.cpp @@ -783,15 +783,15 @@ argument string. - no * - keyword - column keyword for thermo output - - const char pointer + - pointer to 0-terminated const char array - yes * - type - data type of thermo output column; see :cpp:enum:`_LMP_DATATYPE_CONST` - - const int + - const int (**not** a pointer) - yes * - data - actual field data for column - - pointer to either int, int64_t or double + - pointer to int, int64_t or double - yes \endverbatim diff --git a/src/library.h b/src/library.h index 4c2530210c..5f46e36ccf 100644 --- a/src/library.h +++ b/src/library.h @@ -148,7 +148,7 @@ void lammps_commands_string(void *handle, const char *str); double lammps_get_natoms(void *handle); double lammps_get_thermo(void *handle, const char *keyword); -void *lammps_last_thermo(void *handle, const char *what, int idx); +void *lammps_last_thermo(void *handle, const char *what, int index); void lammps_extract_box(void *handle, double *boxlo, double *boxhi, double *xy, double *yz, double *xz, int *pflags, int *boxflag); From b093f1aac19f056e0decfccef23f95d24cd6d44f Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Thu, 8 Jun 2023 13:11:19 -0400 Subject: [PATCH 218/396] move versionadded tags to the top, replace some missed TBD with version info --- python/lammps/core.py | 71 ++++++++-------- python/lammps/numpy_wrapper.py | 28 +++---- src/library.cpp | 144 +++++++++++++++++---------------- 3 files changed, 125 insertions(+), 118 deletions(-) diff --git a/python/lammps/core.py b/python/lammps/core.py index 932d4b863c..b15ddf9302 100644 --- a/python/lammps/core.py +++ b/python/lammps/core.py @@ -506,9 +506,9 @@ class lammps(object): def error(self, error_type, error_text): """Forward error to the LAMMPS Error class. - This is a wrapper around the :cpp:func:`lammps_error` function of the C-library interface. + .. versionadded:: 3Nov2022 - .. versionadded:: TBD + This is a wrapper around the :cpp:func:`lammps_error` function of the C-library interface. :param error_type: :type error_type: int @@ -1343,6 +1343,8 @@ class lammps(object): def gather_bonds(self): """Retrieve global list of bonds + .. versionadded:: 28Jul2021 + This is a wrapper around the :cpp:func:`lammps_gather_bonds` function of the C-library interface. @@ -1350,8 +1352,6 @@ class lammps(object): flat list of ctypes integer values with the bond type, bond atom1, bond atom2 for each bond. - .. versionadded:: 28Jul2021 - :return: a tuple with the number of bonds and a list of c_int or c_long :rtype: (int, 3*nbonds*c_tagint) """ @@ -1366,6 +1366,8 @@ class lammps(object): def gather_angles(self): """Retrieve global list of angles + .. versionadded:: 8Feb2023 + This is a wrapper around the :cpp:func:`lammps_gather_angles` function of the C-library interface. @@ -1373,8 +1375,6 @@ class lammps(object): flat list of ctypes integer values with the angle type, angle atom1, angle atom2, angle atom3 for each angle. - .. versionadded:: TBD - :return: a tuple with the number of angles and a list of c_int or c_long :rtype: (int, 4*nangles*c_tagint) """ @@ -1389,6 +1389,8 @@ class lammps(object): def gather_dihedrals(self): """Retrieve global list of dihedrals + .. versionadded:: 8Feb2023 + This is a wrapper around the :cpp:func:`lammps_gather_dihedrals` function of the C-library interface. @@ -1396,8 +1398,6 @@ class lammps(object): flat list of ctypes integer values with the dihedral type, dihedral atom1, dihedral atom2, dihedral atom3, dihedral atom4 for each dihedral. - .. versionadded:: TBD - :return: a tuple with the number of dihedrals and a list of c_int or c_long :rtype: (int, 5*ndihedrals*c_tagint) """ @@ -1412,6 +1412,8 @@ class lammps(object): def gather_impropers(self): """Retrieve global list of impropers + .. versionadded:: 8Feb2023 + This is a wrapper around the :cpp:func:`lammps_gather_impropers` function of the C-library interface. @@ -1419,8 +1421,6 @@ class lammps(object): flat list of ctypes integer values with the improper type, improper atom1, improper atom2, improper atom3, improper atom4 for each improper. - .. versionadded:: TBD - :return: a tuple with the number of impropers and a list of c_int or c_long :rtype: (int, 5*nimpropers*c_tagint) """ @@ -1659,13 +1659,13 @@ class lammps(object): def is_running(self): """ Report whether being called from a function during a run or a minimization + .. versionadded:: 9Oct2020 + Various LAMMPS commands must not be called during an ongoing run or minimization. This property allows to check for that. This is a wrapper around the :cpp:func:`lammps_is_running` function of the library interface. - .. versionadded:: 9Oct2020 - :return: True when called during a run otherwise false :rtype: bool """ @@ -1676,12 +1676,13 @@ class lammps(object): def force_timeout(self): """ Trigger an immediate timeout, i.e. a "soft stop" of a run. + .. versionadded:: 9Oct2020 + This function allows to cleanly stop an ongoing run or minimization at the next loop iteration. This is a wrapper around the :cpp:func:`lammps_force_timeout` function of the library interface. - .. versionadded:: 9Oct2020 """ self.lib.lammps_force_timeout(self.lmp) @@ -1764,11 +1765,11 @@ class lammps(object): def has_package(self, name): """ Report if the named package has been enabled in the LAMMPS shared library. + .. versionadded:: 3Nov2022 + This is a wrapper around the :cpp:func:`lammps_config_has_package` function of the library interface. - .. versionadded:: TBD - :param name: name of the package :type name: string @@ -1908,11 +1909,11 @@ class lammps(object): def has_id(self, category, name): """Returns whether a given ID name is available in a given category + .. versionadded:: 9Oct2020 + This is a wrapper around the function :cpp:func:`lammps_has_id` of the library interface. - .. versionadded:: 9Oct2020 - :param category: name of category :type category: string :param name: name of the ID @@ -1928,11 +1929,11 @@ class lammps(object): def available_ids(self, category): """Returns a list of IDs available for a given category + .. versionadded:: 9Oct2020 + This is a wrapper around the functions :cpp:func:`lammps_id_count()` and :cpp:func:`lammps_id_name()` of the library interface. - .. versionadded:: 9Oct2020 - :param category: name of category :type category: string @@ -1955,11 +1956,11 @@ class lammps(object): def available_plugins(self, category): """Returns a list of plugins available for a given category + .. versionadded:: 10Mar2021 + This is a wrapper around the functions :cpp:func:`lammps_plugin_count()` and :cpp:func:`lammps_plugin_name()` of the library interface. - .. versionadded:: 10Mar2021 - :return: list of style/name pairs of loaded plugins :rtype: list """ @@ -2024,11 +2025,11 @@ class lammps(object): def fix_external_get_force(self, fix_id): """Get access to the array with per-atom forces of a fix external instance with a given fix ID. + .. versionadded:: 28Jul2021 + This is a wrapper around the :cpp:func:`lammps_fix_external_get_force` function of the C-library interface. - .. versionadded:: 28Jul2021 - :param fix_id: Fix-ID of a fix external instance :type: string :return: requested data @@ -2043,11 +2044,11 @@ class lammps(object): def fix_external_set_energy_global(self, fix_id, eng): """Set the global energy contribution for a fix external instance with the given ID. + .. versionadded:: 28Jul2021 + This is a wrapper around the :cpp:func:`lammps_fix_external_set_energy_global` function of the C-library interface. - .. versionadded:: 28Jul2021 - :param fix_id: Fix-ID of a fix external instance :type: string :param eng: potential energy value to be added by fix external @@ -2062,11 +2063,11 @@ class lammps(object): def fix_external_set_virial_global(self, fix_id, virial): """Set the global virial contribution for a fix external instance with the given ID. + .. versionadded:: 28Jul2021 + This is a wrapper around the :cpp:func:`lammps_fix_external_set_virial_global` function of the C-library interface. - .. versionadded:: 28Jul2021 - :param fix_id: Fix-ID of a fix external instance :type: string :param eng: list of 6 floating point numbers with the virial to be added by fix external @@ -2082,11 +2083,11 @@ class lammps(object): def fix_external_set_energy_peratom(self, fix_id, eatom): """Set the per-atom energy contribution for a fix external instance with the given ID. + .. versionadded:: 28Jul2021 + This is a wrapper around the :cpp:func:`lammps_fix_external_set_energy_peratom` function of the C-library interface. - .. versionadded:: 28Jul2021 - :param fix_id: Fix-ID of a fix external instance :type: string :param eatom: list of potential energy values for local atoms to be added by fix external @@ -2105,11 +2106,11 @@ class lammps(object): def fix_external_set_virial_peratom(self, fix_id, vatom): """Set the per-atom virial contribution for a fix external instance with the given ID. + .. versionadded:: 28Jul2021 + This is a wrapper around the :cpp:func:`lammps_fix_external_set_virial_peratom` function of the C-library interface. - .. versionadded:: 28Jul2021 - :param fix_id: Fix-ID of a fix external instance :type: string :param vatom: list of natoms lists with 6 floating point numbers to be added by fix external @@ -2137,11 +2138,11 @@ class lammps(object): def fix_external_set_vector_length(self, fix_id, length): """Set the vector length for a global vector stored with fix external for analysis + .. versionadded:: 28Jul2021 + This is a wrapper around the :cpp:func:`lammps_fix_external_set_vector_length` function of the C-library interface. - .. versionadded:: 28Jul2021 - :param fix_id: Fix-ID of a fix external instance :type: string :param length: length of the global vector @@ -2155,11 +2156,11 @@ class lammps(object): def fix_external_set_vector(self, fix_id, idx, val): """Store a global vector value for a fix external instance with the given ID. + .. versionadded:: 28Jul2021 + This is a wrapper around the :cpp:func:`lammps_fix_external_set_vector` function of the C-library interface. - .. versionadded:: 28Jul2021 - :param fix_id: Fix-ID of a fix external instance :type: string :param idx: 1-based index of the value in the global vector diff --git a/python/lammps/numpy_wrapper.py b/python/lammps/numpy_wrapper.py index 8286fb9a5c..f3ea0fdf8e 100644 --- a/python/lammps/numpy_wrapper.py +++ b/python/lammps/numpy_wrapper.py @@ -262,12 +262,12 @@ class numpy_wrapper: def gather_bonds(self): """Retrieve global list of bonds as NumPy array + .. versionadded:: 28Jul2021 + This is a wrapper around :py:meth:`lammps.gather_bonds() ` It behaves the same as the original method, but returns a NumPy array instead of a ``ctypes`` list. - .. versionadded:: 28Jul2021 - :return: the requested data as a 2d-integer numpy array :rtype: numpy.array(nbonds,3) """ @@ -280,12 +280,12 @@ class numpy_wrapper: def gather_angles(self): """ Retrieve global list of angles as NumPy array + .. versionadded:: 8Feb2023 + This is a wrapper around :py:meth:`lammps.gather_angles() ` It behaves the same as the original method, but returns a NumPy array instead of a ``ctypes`` list. - .. versionadded:: TBD - :return: the requested data as a 2d-integer numpy array :rtype: numpy.array(nangles,4) """ @@ -298,12 +298,12 @@ class numpy_wrapper: def gather_dihedrals(self): """ Retrieve global list of dihedrals as NumPy array + .. versionadded:: 8Feb2023 + This is a wrapper around :py:meth:`lammps.gather_dihedrals() ` It behaves the same as the original method, but returns a NumPy array instead of a ``ctypes`` list. - .. versionadded:: TBD - :return: the requested data as a 2d-integer numpy array :rtype: numpy.array(ndihedrals,5) """ @@ -316,12 +316,12 @@ class numpy_wrapper: def gather_impropers(self): """ Retrieve global list of impropers as NumPy array + .. versionadded:: 8Feb2023 + This is a wrapper around :py:meth:`lammps.gather_impropers() ` It behaves the same as the original method, but returns a NumPy array instead of a ``ctypes`` list. - .. versionadded:: TBD - :return: the requested data as a 2d-integer numpy array :rtype: numpy.array(nimpropers,5) """ @@ -334,13 +334,13 @@ class numpy_wrapper: def fix_external_get_force(self, fix_id): """Get access to the array with per-atom forces of a fix external instance with a given fix ID. + .. versionchanged:: 28Jul2021 + This function is a wrapper around the :py:meth:`lammps.fix_external_get_force() ` method. It behaves the same as the original method, but returns a NumPy array instead of a ``ctypes`` pointer. - .. versionchanged:: 28Jul2021 - :param fix_id: Fix-ID of a fix external instance :type: string :return: requested data @@ -356,13 +356,13 @@ class numpy_wrapper: def fix_external_set_energy_peratom(self, fix_id, eatom): """Set the per-atom energy contribution for a fix external instance with the given ID. + .. versionadded:: 28Jul2021 + This function is an alternative to :py:meth:`lammps.fix_external_set_energy_peratom() ` method. It behaves the same as the original method, but accepts a NumPy array instead of a list as argument. - .. versionadded:: 28Jul2021 - :param fix_id: Fix-ID of a fix external instance :type: string :param eatom: per-atom potential energy @@ -383,13 +383,13 @@ class numpy_wrapper: def fix_external_set_virial_peratom(self, fix_id, vatom): """Set the per-atom virial contribution for a fix external instance with the given ID. + .. versionadded:: 28Jul2021 + This function is an alternative to :py:meth:`lammps.fix_external_set_virial_peratom() ` method. It behaves the same as the original method, but accepts a NumPy array instead of a list as argument. - .. versionadded:: 28Jul2021 - :param fix_id: Fix-ID of a fix external instance :type: string :param eatom: per-atom potential energy diff --git a/src/library.cpp b/src/library.cpp index cf5d131ba6..24a8afa7c7 100644 --- a/src/library.cpp +++ b/src/library.cpp @@ -247,6 +247,8 @@ void *lammps_open_no_mpi(int argc, char **argv, void **ptr) * \verbatim embed:rst +.. versionadded:: 18Sep2020 + This function is a version of :cpp:func:`lammps_open`, that uses an integer for the MPI communicator as the MPI Fortran interface does. It is used in the :f:func:`lammps` constructor of the LAMMPS Fortran @@ -257,8 +259,6 @@ communicator with ``MPI_Comm_f2c()`` and then calls If for some reason the creation or initialization of the LAMMPS instance fails a null pointer is returned. -.. versionadded:: 18Sep2020 - *See also* :cpp:func:`lammps_open_fortran`, :cpp:func:`lammps_open_no_mpi` @@ -304,13 +304,13 @@ void lammps_close(void *handle) * \verbatim embed:rst +.. versionadded:: 18Sep2020 + The MPI standard requires that any MPI application must call ``MPI_Init()`` exactly once before performing any other MPI function calls. This function checks, whether MPI is already initialized and calls ``MPI_Init()`` in case it is not. -.. versionadded:: 18Sep2020 - \endverbatim */ void lammps_mpi_init() @@ -333,6 +333,8 @@ void lammps_mpi_init() * \verbatim embed:rst +.. versionadded:: 18Sep2020 + The MPI standard requires that any MPI application calls ``MPI_Finalize()`` before exiting. Even if a calling program does not do any MPI calls, MPI is still initialized internally to avoid errors @@ -341,8 +343,6 @@ before exiting the program to wait until all (parallel) tasks are completed and then MPI is cleanly shut down. After calling this function no more MPI calls may be made. -.. versionadded:: 18Sep2020 - *See also* :cpp:func:`lammps_kokkos_finalize`, :cpp:func:`lammps_python_finalize` \endverbatim */ @@ -366,6 +366,8 @@ void lammps_mpi_finalize() * \verbatim embed:rst +.. versionadded:: 2Jul2021 + The Kokkos library may only be initialized once during the execution of a process. This is done automatically the first time Kokkos functionality is used. This requires that the Kokkos environment @@ -373,8 +375,6 @@ must be explicitly shut down after any LAMMPS instance using it is closed (to release associated resources). After calling this function no Kokkos functionality may be used. -.. versionadded:: 2Jul2021 - *See also* :cpp:func:`lammps_mpi_finalize`, :cpp:func:`lammps_python_finalize` \endverbatim */ @@ -390,6 +390,8 @@ void lammps_kokkos_finalize() * \verbatim embed:rst +.. versionadded:: 20Sep2021 + This function resets and clears an embedded Python environment by calling the `Py_Finalize() function `_ @@ -409,8 +411,6 @@ after calling Py_Finalize(). This function can be called to explicitly clear the Python environment in case it is safe to do so. -.. versionadded:: 20Sep2021 - *See also* :cpp:func:`lammps_mpi_finalize`, :cpp:func:`lammps_kokkos_finalize` \endverbatim */ @@ -427,6 +427,8 @@ void lammps_python_finalize() * \verbatim embed:rst +.. versionadded:: 3Nov2022 + This function is a wrapper around functions in the ``Error`` to print an error message and then stop LAMMPS. @@ -435,8 +437,6 @@ of constants from :cpp:enum:`_LMP_ERROR_CONST`. If the value does not match any valid combination of constants a warning is printed and the function returns. -.. versionadded:: 3Nov2022 - \endverbatim * * \param handle pointer to a previously created LAMMPS instance @@ -979,6 +979,8 @@ void lammps_reset_box(void *handle, double *boxlo, double *boxhi, * \verbatim embed:rst +.. versionadded:: 18Sep2020 + This function will retrieve memory usage information for the current LAMMPS instance or process. The *meminfo* buffer will be filled with 3 different numbers (if supported by the operating system). The first @@ -991,8 +993,6 @@ third number is the maximum amount of RAM (not swap) used by the process so far. If any of the two latter parameters is not supported by the operating system it will be set to zero. -.. versionadded:: 18Sep2020 - \endverbatim * * \param handle pointer to a previously created LAMMPS instance @@ -1012,6 +1012,8 @@ void lammps_memory_usage(void *handle, double *meminfo) * \verbatim embed:rst +.. versionadded:: 18Sep2020 + This will take the LAMMPS "world" communicator and convert it to an integer using ``MPI_Comm_c2f()``, so it is equivalent to the corresponding MPI communicator in Fortran. This way it can be safely @@ -1020,8 +1022,6 @@ to the C language representation use ``MPI_Comm_f2c()``. If LAMMPS was compiled with MPI_STUBS, this function returns -1. -.. versionadded:: 18Sep2020 - *See also* :cpp:func:`lammps_open_fortran` @@ -1284,13 +1284,13 @@ int lammps_extract_setting(void *handle, const char *keyword) * \verbatim embed:rst +.. versionadded:: 18Sep2020 + This function returns an integer that encodes the data type of the global property with the specified name. See :cpp:enum:`_LMP_DATATYPE_CONST` for valid values. Callers of :cpp:func:`lammps_extract_global` can use this information to then decide how to cast the ``void *`` pointer and access the data. -.. versionadded:: 18Sep2020 - \endverbatim * * \param handle pointer to a previously created LAMMPS instance (unused) @@ -1773,13 +1773,13 @@ void *lammps_extract_global(void *handle, const char *name) * \verbatim embed:rst +.. versionadded:: 18Sep2020 + This function returns an integer that encodes the data type of the per-atom property with the specified name. See :cpp:enum:`_LMP_DATATYPE_CONST` for valid values. Callers of :cpp:func:`lammps_extract_atom` can use this information to then decide how to cast the ``void *`` pointer and access the data. -.. versionadded:: 18Sep2020 - \endverbatim * * \param handle pointer to a previously created LAMMPS instance @@ -2308,13 +2308,13 @@ void *lammps_extract_variable(void *handle, const char *name, const char *group) * \verbatim embed:rst +.. versionadded:: 3Nov2022 + This function returns an integer that encodes the data type of the variable with the specified name. See :cpp:enum:`_LMP_VAR_CONST` for valid values. Callers of :cpp:func:`lammps_extract_variable` can use this information to decide how to cast the ``void *`` pointer and access the data. -.. versionadded:: 3Nov2022 - \endverbatim * * \param handle pointer to a previously created LAMMPS instance @@ -3166,6 +3166,8 @@ void lammps_scatter_atoms_subset(void *handle, const char *name, int type, * \verbatim embed:rst +.. versionadded:: 28Jul2021 + This function copies the list of all bonds into a buffer provided by the calling code. The buffer will be filled with bond type, bond atom 1, bond atom 2 for each bond. Thus the buffer has to be allocated to the @@ -3180,8 +3182,6 @@ When running in parallel, the data buffer must be allocated on **all** MPI ranks and will be filled with the information for **all** bonds in the system. -.. versionadded:: 28Jul2021 - Below is a brief C code demonstrating accessing this collected bond information. .. code-block:: c @@ -3277,6 +3277,8 @@ void lammps_gather_bonds(void *handle, void *data) * \verbatim embed:rst +.. versionadded:: 8Feb2023 + This function copies the list of all angles into a buffer provided by the calling code. The buffer will be filled with angle type, angle atom 1, angle atom 2, angle atom 3 for each angle. Thus the buffer has to be allocated to the @@ -3291,8 +3293,6 @@ When running in parallel, the data buffer must be allocated on **all** MPI ranks and will be filled with the information for **all** angles in the system. -.. versionadded:: 8Feb2023 - Below is a brief C code demonstrating accessing this collected angle information. .. code-block:: c @@ -3388,6 +3388,8 @@ void lammps_gather_angles(void *handle, void *data) * \verbatim embed:rst +.. versionadded:: 8Feb2023 + This function copies the list of all dihedrals into a buffer provided by the calling code. The buffer will be filled with dihedral type, dihedral atom 1, dihedral atom 2, dihedral atom 3, dihedral atom 4 for each dihedral. @@ -3403,8 +3405,6 @@ When running in parallel, the data buffer must be allocated on **all** MPI ranks and will be filled with the information for **all** dihedrals in the system. -.. versionadded:: 8Feb2023 - Below is a brief C code demonstrating accessing this collected dihedral information. .. code-block:: c @@ -3500,6 +3500,8 @@ void lammps_gather_dihedrals(void *handle, void *data) * \verbatim embed:rst +.. versionadded:: 8Feb2023 + This function copies the list of all impropers into a buffer provided by the calling code. The buffer will be filled with improper type, improper atom 1, improper atom 2, improper atom 3, improper atom 4 for each improper. @@ -3515,8 +3517,6 @@ When running in parallel, the data buffer must be allocated on **all** MPI ranks and will be filled with the information for **all** impropers in the system. -.. versionadded:: 8Feb2023 - Below is a brief C code demonstrating accessing this collected improper information. .. code-block:: c @@ -5310,6 +5310,8 @@ int lammps_version(void *handle) * \verbatim embed:rst +.. versionadded:: 9Oct2020 + The :cpp:func:`lammps_get_os_info` function can be used to retrieve detailed information about the hosting operating system and compiler/runtime. @@ -5318,8 +5320,6 @@ A suitable buffer for a C-style string has to be provided and its length. The assembled text will be truncated to not overflow this buffer. The string is typically a few hundred bytes long. -.. versionadded:: 9Oct2020 - \endverbatim * * \param buffer string buffer to copy the information to @@ -5548,6 +5548,8 @@ int lammps_config_accelerator(const char *package, * \verbatim embed:rst +.. versionadded:: 14May2021 + The :cpp:func:`lammps_has_gpu_device` function checks at runtime if an accelerator device is present that can be used with the :doc:`GPU package `. If at least one suitable device is @@ -5557,8 +5559,6 @@ More detailed information about the available device or devices can be obtained by calling the :cpp:func:`lammps_get_gpu_device_info` function. -.. versionadded:: 14May2021 - \endverbatim * * \return 1 if viable device is available, 0 if not. */ @@ -5572,6 +5572,8 @@ int lammps_has_gpu_device() * \verbatim embed:rst +.. versionadded:: 14May2021 + The :cpp:func:`lammps_get_gpu_device_info` function can be used to retrieve detailed information about any accelerator devices that are viable for use with the :doc:`GPU package `. It will produce a string that is @@ -5583,8 +5585,6 @@ A suitable buffer for a C-style string has to be provided and its length. The assembled text will be truncated to not overflow this buffer. This string can be several kilobytes long, if multiple devices are present. -.. versionadded:: 14May2021 - \endverbatim * * \param buffer string buffer to copy the information to @@ -5681,12 +5681,13 @@ int lammps_style_name(void *handle, const char *category, int idx, /** Check if a specific ID exists in the current LAMMPS instance * \verbatim embed:rst + +.. versionadded:: 9Oct2020 + This function checks if the current LAMMPS instance a *category* ID of the given *name* exists. Valid categories are: *compute*\ , *dump*\ , *fix*\ , *group*\ , *molecule*\ , *region*\ , and *variable*\ . -.. versionadded:: 9Oct2020 - \endverbatim * * \param handle pointer to a previously created LAMMPS instance cast to ``void *``. @@ -5720,13 +5721,14 @@ int lammps_has_id(void *handle, const char *category, const char *name) { /** Count the number of IDs of a category. * \verbatim embed:rst + +.. versionadded:: 9Oct2020 + This function counts how many IDs in the provided *category* are defined in the current LAMMPS instance. Please see :cpp:func:`lammps_has_id` for a list of valid categories. -.. versionadded:: 9Oct2020 - \endverbatim * * \param handle pointer to a previously created LAMMPS instance cast to ``void *``. @@ -5758,6 +5760,9 @@ int lammps_id_count(void *handle, const char *category) { /** Look up the name of an ID by index in the list of IDs of a given category. * \verbatim embed:rst + +.. versionadded:: 9Oct2020 + This function copies the name of the *category* ID with the index *idx* into the provided C-style string buffer. The length of the buffer must be provided as *buf_size* argument. If the name of the style @@ -5765,8 +5770,6 @@ exceeds the length of the buffer, it will be truncated accordingly. If the index is out of range, the function returns 0 and *buffer* is set to an empty string, otherwise 1. -.. versionadded:: 9Oct2020 - \endverbatim * * \param handle pointer to a previously created LAMMPS instance cast to ``void *``. @@ -5829,10 +5832,11 @@ int lammps_id_name(void *handle, const char *category, int idx, char *buffer, in /** Count the number of loaded plugins * \verbatim embed:rst -This function counts how many plugins are currently loaded. .. versionadded:: 10Mar2021 +This function counts how many plugins are currently loaded. + \endverbatim * * \return number of loaded plugins @@ -5851,6 +5855,9 @@ int lammps_plugin_count() /** Look up the info of a loaded plugin by its index in the list of plugins * \verbatim embed:rst + +.. versionadded:: 10Mar2021 + This function copies the name of the *style* plugin with the index *idx* into the provided C-style string buffer. The length of the buffer must be provided as *buf_size* argument. If the name of the style @@ -5858,8 +5865,6 @@ exceeds the length of the buffer, it will be truncated accordingly. If the index is out of range, the function returns 0 and *buffer* is set to an empty string, otherwise 1. -.. versionadded:: 10Mar2021 - \endverbatim * * \param idx index of the plugin in the list all or *style* plugins @@ -6018,9 +6023,11 @@ void lammps_set_fix_external_callback(void *handle, const char *id, FixExternalF \verbatim embed:rst -Fix :doc:`external ` allows programs that are running LAMMPS through -its library interface to add or modify certain LAMMPS properties on specific -timesteps, similar to the way other fixes do. +.. versionadded:: 28Jul2021 + +Fix :doc:`external ` allows programs that are running +LAMMPS through its library interface to add or modify certain LAMMPS +properties on specific timesteps, similar to the way other fixes do. This function provides access to the per-atom force storage in a fix external instance with the given fix-ID to be added to the individual @@ -6033,12 +6040,12 @@ data structures can change as well as the order of atom as they migrate between MPI processes because of the domain decomposition parallelization, this function should be always called immediately before the forces are going to be set to get an up-to-date pointer. -You can use, for example, :cpp:func:`lammps_extract_setting` to obtain the -number of local atoms `nlocal` and then assume the dimensions of the returned -force array as ``double force[nlocal][3]``. +You can use, for example, :cpp:func:`lammps_extract_setting` to obtain +the number of local atoms `nlocal` and then assume the dimensions of +the returned force array as ``double force[nlocal][3]``. -This is an alternative to the callback mechanism in fix external set up by -:cpp:func:`lammps_set_fix_external_callback`. The main difference is +This is an alternative to the callback mechanism in fix external set up +by :cpp:func:`lammps_set_fix_external_callback`. The main difference is that this mechanism can be used when forces are be pre-computed and the control alternates between LAMMPS and the external code, while the callback mechanism can call the external code to compute the force when @@ -6048,8 +6055,6 @@ Please see the documentation for :doc:`fix external ` for more information about how to use the fix and how to couple it with an external code. -.. versionadded:: 28Jul2021 - \endverbatim * * \param handle pointer to a previously created LAMMPS instance cast to ``void *``. @@ -6080,6 +6085,8 @@ double **lammps_fix_external_get_force(void *handle, const char *id) \verbatim embed:rst +.. versionadded:: 28Jul2021 + This is a companion function to :cpp:func:`lammps_set_fix_external_callback` and :cpp:func:`lammps_fix_external_get_force` to also set the contribution to the global energy from the external code. The value of the *eng* @@ -6096,8 +6103,6 @@ Please see the documentation for :doc:`fix external ` for more information about how to use the fix and how to couple it with an external code. -.. versionadded:: 28Jul2021 - \endverbatim * * \param handle pointer to a previously created LAMMPS instance cast to ``void *``. @@ -6126,6 +6131,8 @@ void lammps_fix_external_set_energy_global(void *handle, const char *id, double \verbatim embed:rst +.. versionadded:: 28Jul2021 + This is a companion function to :cpp:func:`lammps_set_fix_external_callback` and :cpp:func:`lammps_fix_external_get_force` to set the contribution to the global virial from the external code. @@ -6144,8 +6151,6 @@ Please see the documentation for :doc:`fix external ` for more information about how to use the fix and how to couple it with an external code. -.. versionadded:: 28Jul2021 - \endverbatim * * \param handle pointer to a previously created LAMMPS instance cast to ``void *``. @@ -6174,6 +6179,8 @@ void lammps_fix_external_set_virial_global(void *handle, const char *id, double \verbatim embed:rst +.. versionadded:: 28Jul2021 + This is a companion function to :cpp:func:`lammps_set_fix_external_callback` to set the per-atom energy contribution due to the fix from the external code as part of the callback function. For this to work, the handle to the @@ -6192,8 +6199,6 @@ Please see the documentation for :doc:`fix external ` for more information about how to use the fix and how to couple it with an external code. -.. versionadded:: 28Jul2021 - \endverbatim * * \param handle pointer to a previously created LAMMPS instance cast to ``void *``. @@ -6222,6 +6227,8 @@ void lammps_fix_external_set_energy_peratom(void *handle, const char *id, double \verbatim embed:rst +.. versionadded:: 28Jul2021 + This is a companion function to :cpp:func:`lammps_set_fix_external_callback` to set the per-atom virial contribution due to the fix from the external code as part of the callback function. For this to work, the handle to the @@ -6243,8 +6250,6 @@ Please see the documentation for :doc:`fix external ` for more information about how to use the fix and how to couple it with an external code. -.. versionadded:: 28Jul2021 - \endverbatim * * \param handle pointer to a previously created LAMMPS instance cast to ``void *``. @@ -6273,6 +6278,8 @@ void lammps_fix_external_set_virial_peratom(void *handle, const char *id, double \verbatim embed:rst +.. versionadded:: 28Jul2021 + This is a companion function to :cpp:func:`lammps_set_fix_external_callback` and :cpp:func:`lammps_fix_external_get_force` to set the length of a global vector of properties that will be stored with the fix via @@ -6287,8 +6294,6 @@ Please see the documentation for :doc:`fix external ` for more information about how to use the fix and how to couple it with an external code. -.. versionadded:: 28Jul2021 - \endverbatim * * \param handle pointer to a previously created LAMMPS instance cast to ``void *``. @@ -6317,6 +6322,8 @@ void lammps_fix_external_set_vector_length(void *handle, const char *id, int len \verbatim embed:rst +.. versionadded:: 28Jul2021 + This is a companion function to :cpp:func:`lammps_set_fix_external_callback` and :cpp:func:`lammps_fix_external_get_force` to set the values of a global vector of properties that will be stored with the fix. And can be accessed from @@ -6340,8 +6347,6 @@ Please see the documentation for :doc:`fix external ` for more information about how to use the fix and how to couple it with an external code. -.. versionadded:: 28Jul2021 - \endverbatim * * \param handle pointer to a previously created LAMMPS instance cast to ``void *``. @@ -6513,12 +6518,13 @@ int lammps_get_last_error_message(void *handle, char *buffer, int buf_size) { /** Return API version of embedded Python interpreter \verbatim embed:rst + +.. versionadded:: 3Nov2022 + This function is used by the ML-IAP python code (mliappy) to verify the API version of the embedded python interpreter of the PYTHON package. It returns -1 if the PYTHON package is not enabled. -.. versionadded:: 3Nov2022 - \endverbatim * * \return PYTHON_API_VERSION constant of the python interpreter or -1 */ From 81854cd03e1903e6fc545f1e27028e65d1864385 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Thu, 8 Jun 2023 14:55:45 -0400 Subject: [PATCH 219/396] change type keyword to return a pointer to static location for better portability --- python/lammps/core.py | 7 +++---- src/library.cpp | 19 +++++++++++++++---- 2 files changed, 18 insertions(+), 8 deletions(-) diff --git a/python/lammps/core.py b/python/lammps/core.py index b15ddf9302..d34d5de4d4 100644 --- a/python/lammps/core.py +++ b/python/lammps/core.py @@ -775,11 +775,10 @@ class lammps(object): ptr = self.lib.lammps_last_thermo(self.lmp, c_char_p("keyword".encode()), i) kw = cast(ptr, c_char_p).value.decode() - # temporarily switch return type since this stores an int in a pointer - self.lib.lammps_last_thermo.restype = c_int with ExceptionCheck(self): - typ = self.lib.lammps_last_thermo(self.lmp, c_char_p("type".encode()), i) - self.lib.lammps_last_thermo.restype = c_void_p + ptr = self.lib.lammps_last_thermo(self.lmp, c_char_p("type".encode()), i) + typ = cast(ptr, POINTER(c_int)).contents.value + with ExceptionCheck(self): ptr = self.lib.lammps_last_thermo(self.lmp, c_char_p("data".encode()), i) diff --git a/src/library.cpp b/src/library.cpp index 24a8afa7c7..0fcedfc20b 100644 --- a/src/library.cpp +++ b/src/library.cpp @@ -765,6 +765,13 @@ of the last thermo output data and the corresponding keyword strings. The how to handle the return value depends on the value of the *what* argument string. +.. note:: + + The *type* property points to a static location that is reassigned + with every call, so the returned pointer should be recast, + dereferenced, and assigned immediately. Otherwise, its value may be + changed with the next invocation of the function. + .. list-table:: :header-rows: 1 :widths: auto @@ -787,7 +794,7 @@ argument string. - yes * - type - data type of thermo output column; see :cpp:enum:`_LMP_DATATYPE_CONST` - - const int (**not** a pointer) + - pointer to static int - yes * - data - actual field data for column @@ -808,6 +815,7 @@ void *lammps_last_thermo(void *handle, const char *what, int index) Thermo *th = lmp->output->thermo; if (!th) return nullptr; const int nfield = *th->get_nfield(); + static int datatype; BEGIN_CAPTURE { @@ -826,11 +834,14 @@ void *lammps_last_thermo(void *handle, const char *what, int index) if ((index < 0) || (index >= nfield)) return nullptr; const auto &field = th->get_fields()[index]; if (field.type == multitype::INT) { - val = (void *) LAMMPS_INT; + datatype = LAMMPS_INT; + val = (void *) &datatype; } else if (field.type == multitype::BIGINT) { - val = (void *) LAMMPS_INT64; + datatype = LAMMPS_INT64; + val = (void *) &datatype; } else if (field.type == multitype::DOUBLE) { - val = (void *) LAMMPS_DOUBLE; + datatype = LAMMPS_DOUBLE; + val = (void *) &datatype; } } else if (strcmp(what, "data") == 0) { From 5d4f9abf5b6604414e8f82537e49b21fbbfb65bc Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Thu, 8 Jun 2023 15:15:28 -0400 Subject: [PATCH 220/396] add unit tests for c-library interface and plain python module --- .../c-library/test_library_properties.cpp | 61 ++++++++++++++++++- unittest/python/python-commands.py | 27 ++++++++ 2 files changed, 86 insertions(+), 2 deletions(-) diff --git a/unittest/c-library/test_library_properties.cpp b/unittest/c-library/test_library_properties.cpp index d6dd55f75e..14eab06213 100644 --- a/unittest/c-library/test_library_properties.cpp +++ b/unittest/c-library/test_library_properties.cpp @@ -14,6 +14,7 @@ #define STRINGIFY(val) XSTR(val) #define XSTR(val) #val +using ::LAMMPS_NS::bigint; using ::LAMMPS_NS::tagint; using ::LAMMPS_NS::platform::path_join; using ::testing::HasSubstr; @@ -93,6 +94,9 @@ TEST_F(LibraryProperties, natoms) TEST_F(LibraryProperties, thermo) { + bigint bval = *(bigint *)lammps_last_thermo(lmp, "step", 0); + EXPECT_EQ(bval, -1); + if (!lammps_has_style(lmp, "atom", "full")) GTEST_SKIP(); std::string input = path_join(INPUT_DIR, "in.fourmol"); ::testing::internal::CaptureStdout(); @@ -105,6 +109,59 @@ TEST_F(LibraryProperties, thermo) EXPECT_DOUBLE_EQ(lammps_get_thermo(lmp, "vol"), 3375.0); EXPECT_DOUBLE_EQ(lammps_get_thermo(lmp, "density"), 0.12211250945013695); EXPECT_DOUBLE_EQ(lammps_get_thermo(lmp, "cellalpha"), 90.0); + + bval = *(bigint *)lammps_last_thermo(lmp, "step", 0); + EXPECT_EQ(bval, 2); + int ival = *(int *)lammps_last_thermo(lmp, "num", 0); + EXPECT_EQ(ival, 6); + + const char *key = (const char *)lammps_last_thermo(lmp, "keyword", 0); + EXPECT_THAT(key, StrEq("Step")); + ival = *(int *)lammps_last_thermo(lmp, "type", 0); +#if defined(LAMMPS_SMALLSMALL) + EXPECT_EQ(ival, LAMMPS_INT); + ival = *(int *)lammps_last_thermo(lmp, "data", 0); + EXPECT_EQ(ival, 2); +#else + EXPECT_EQ(ival, LAMMPS_INT64); + bval = *(bigint *)lammps_last_thermo(lmp, "data", 0); + EXPECT_EQ(bval, 2); +#endif + + key = (const char *)lammps_last_thermo(lmp, "keyword", 1); + EXPECT_THAT(key, StrEq("Temp")); + ival = *(int *)lammps_last_thermo(lmp, "type", 1); + EXPECT_EQ(ival, LAMMPS_DOUBLE); + double dval = *(double *)lammps_last_thermo(lmp, "data", 1); + EXPECT_DOUBLE_EQ(dval, 28.042780385852982); + + key = (const char *)lammps_last_thermo(lmp, "keyword", 2); + EXPECT_THAT(key, StrEq("E_pair")); + ival = *(int *)lammps_last_thermo(lmp, "type", 2); + EXPECT_EQ(ival, LAMMPS_DOUBLE); + dval = *(double *)lammps_last_thermo(lmp, "data", 2); + EXPECT_DOUBLE_EQ(dval, 0.0); + + key = (const char *)lammps_last_thermo(lmp, "keyword", 3); + EXPECT_THAT(key, StrEq("E_mol")); + ival = *(int *)lammps_last_thermo(lmp, "type", 3); + EXPECT_EQ(ival, LAMMPS_DOUBLE); + dval = *(double *)lammps_last_thermo(lmp, "data", 3); + EXPECT_DOUBLE_EQ(dval, 0.0); + + key = (const char *)lammps_last_thermo(lmp, "keyword", 4); + EXPECT_THAT(key, StrEq("TotEng")); + ival = *(int *)lammps_last_thermo(lmp, "type", 4); + EXPECT_EQ(ival, LAMMPS_DOUBLE); + dval = *(double *)lammps_last_thermo(lmp, "data", 4); + EXPECT_DOUBLE_EQ(dval, 2.3405256449146163); + + key = (const char *)lammps_last_thermo(lmp, "keyword", 5); + EXPECT_THAT(key, StrEq("Press")); + ival = *(int *)lammps_last_thermo(lmp, "type", 5); + EXPECT_EQ(ival, LAMMPS_DOUBLE); + dval = *(double *)lammps_last_thermo(lmp, "data", 5); + EXPECT_DOUBLE_EQ(dval, 31.700964689115658); }; TEST_F(LibraryProperties, box) @@ -325,8 +382,8 @@ TEST_F(LibraryProperties, global) EXPECT_EQ(lammps_extract_global_datatype(lmp, "special_lj"), LAMMPS_DOUBLE); EXPECT_EQ(lammps_extract_global_datatype(lmp, "special_coul"), LAMMPS_DOUBLE); - double *special_lj = (double *)lammps_extract_global(lmp, "special_lj"); - double *special_coul= (double *)lammps_extract_global(lmp, "special_coul"); + double *special_lj = (double *)lammps_extract_global(lmp, "special_lj"); + double *special_coul = (double *)lammps_extract_global(lmp, "special_coul"); EXPECT_DOUBLE_EQ(special_lj[0], 1.0); EXPECT_DOUBLE_EQ(special_lj[1], 0.0); EXPECT_DOUBLE_EQ(special_lj[2], 0.5); diff --git a/unittest/python/python-commands.py b/unittest/python/python-commands.py index 33b19ba4f0..1c25751191 100644 --- a/unittest/python/python-commands.py +++ b/unittest/python/python-commands.py @@ -533,6 +533,33 @@ create_atoms 1 single & result = self.lmp.get_thermo(key) self.assertEqual(value, result, key) + + def test_last_thermo(self): + self.lmp.command("units lj") + self.lmp.command("atom_style atomic") + self.lmp.command("atom_modify map array") + self.lmp.command("boundary f f f") + self.lmp.command("region box block 0 2 0 2 0 2") + self.lmp.command("create_box 1 box") + self.lmp.command("mass * 1") + + x = [ + 0.5, 0.5, 0.5, + 1.5, 1.5, 1.5 + ] + types = [1, 1] + self.lmp.create_atoms(2, id=None, type=types, x=x) + + self.assertEqual(self.lmp.last_thermo(), None) + self.lmp.command("run 2 post no") + ref = { "Step" : 2, + "Temp" : 0.0, + "E_pair" : 0.0, + "E_mol" : 0.0, + "TotEng" : 0.0, + "Press" : 0.0} + self.assertDictEqual(self.lmp.last_thermo(), ref) + def test_extract_global(self): self.lmp.command("region box block -1 1 -2 2 -3 3") self.lmp.command("create_box 1 box") From 2e1190bfee1bee986abe9e8272e3ab3718815feb Mon Sep 17 00:00:00 2001 From: "W. Michael Brown" Date: Thu, 8 Jun 2023 15:02:17 -0700 Subject: [PATCH 221/396] Fixing issue with when atom styles using torque are mixed with intel pair styles not using torque. Generating runtime error for mixing intel gayberne style with non-ellipsoid intel pair styles. --- src/INTEL/fix_intel.cpp | 31 +++++++++++++++++++++++++------ src/INTEL/fix_intel.h | 2 +- src/INTEL/intel_buffers.cpp | 3 ++- src/INTEL/intel_buffers.h | 6 ++++-- 4 files changed, 32 insertions(+), 10 deletions(-) diff --git a/src/INTEL/fix_intel.cpp b/src/INTEL/fix_intel.cpp index 2b786b6eed..ef6bfc3408 100644 --- a/src/INTEL/fix_intel.cpp +++ b/src/INTEL/fix_intel.cpp @@ -61,6 +61,7 @@ FixIntel::FixIntel(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg) _hybrid_nonpair = 0; _print_pkg_info = 1; _nthreads = comm->nthreads; + _torque_flag = 0; _precision_mode = PREC_MODE_MIXED; _offload_balance = -1.0; @@ -301,14 +302,29 @@ void FixIntel::init() } #endif + _torque_flag = 0; + if (force->pair_match("gayberne/intel$", 0)) _torque_flag = 1; + const int nstyles = _pair_intel_count; if (force->pair_match("^hybrid", 0) != nullptr) { _pair_hybrid_flag = 1; + + // Check if need to handle torque + auto hybrid = dynamic_cast(force->pair); + for (int i = 0; i < hybrid->nstyles; i++) + if (utils::strmatch(hybrid->keywords[i],"/intel$") && + utils::strmatch(hybrid->keywords[i],"gayberne")) + _torque_flag = 1; + if (force->newton_pair != 0 && force->pair->no_virial_fdotr_compute) error->all(FLERR,"INTEL package requires fdotr virial with newton on."); } else _pair_hybrid_flag = 0; + if (_torque_flag && nstyles > 1) + error->all(FLERR,"gayberne/intel style cannot yet be used with other " + "intel pair styles."); + if (nstyles > 1 && _pair_hybrid_flag) _pair_hybrid_flag = 2; else if (force->newton_pair == 0) _pair_hybrid_flag = 0; @@ -335,14 +351,17 @@ void FixIntel::init() int off_mode = 0; if (_offload_balance != 0.0) off_mode = 1; if (_precision_mode == PREC_MODE_SINGLE) { + _single_buffers->set_torque_flag(_torque_flag); _single_buffers->zero_ev(); _single_buffers->grow_ncache(off_mode, comm->nthreads); _single_buffers->free_list_ptrs(); } else if (_precision_mode == PREC_MODE_MIXED) { + _mixed_buffers->set_torque_flag(_torque_flag); _mixed_buffers->zero_ev(); _mixed_buffers->grow_ncache(off_mode, comm->nthreads); _mixed_buffers->free_list_ptrs(); } else { + _double_buffers->set_torque_flag(_torque_flag); _double_buffers->zero_ev(); _double_buffers->grow_ncache(off_mode, comm->nthreads); _double_buffers->free_list_ptrs(); @@ -620,7 +639,7 @@ void FixIntel::reduce_results(acc_t * _noalias const f_scalar) o_range = atom->nlocal + atom->nghost; else o_range = atom->nlocal; - IP_PRE_get_stride(f_stride, o_range, (sizeof(acc_t)*4), lmp->atom->torque); + IP_PRE_get_stride(f_stride, o_range, (sizeof(acc_t)*4), _torque_flag); o_range *= 4; const int f_stride4 = f_stride * 4; @@ -719,7 +738,7 @@ void FixIntel::add_results(const ft * _noalias const f_in, add_oresults(f_in, ev_global, eatom, vatom, 0, _offload_nlocal); const acc_t * _noalias const enull = 0; int offset = _offload_nlocal; - if (atom->torque) offset *= 2; + if (_torque_flag) offset *= 2; add_oresults(f_in + offset, enull, eatom, vatom, _offload_min_ghost, _offload_nghost); } else @@ -730,7 +749,7 @@ void FixIntel::add_results(const ft * _noalias const f_in, _host_min_local, _host_used_local); const acc_t * _noalias const enull = 0; int offset = _host_used_local; - if (atom->torque) offset *= 2; + if (_torque_flag) offset *= 2; add_oresults(f_in + offset, enull, eatom, vatom, _host_min_ghost, _host_used_ghost); } else { @@ -779,7 +798,7 @@ void FixIntel::add_oresults(const ft * _noalias const f_in, const int eatom, const int /*vatom*/, const int out_offset, const int nall) { lmp_ft * _noalias const f = (lmp_ft *) lmp->atom->f[0] + out_offset; - if (atom->torque) { + if (_torque_flag) { if (f_in[1].w) { if (f_in[1].w == 1) @@ -803,7 +822,7 @@ void FixIntel::add_oresults(const ft * _noalias const f_in, #endif int ifrom, ito; IP_PRE_omp_range_align(ifrom, ito, tid, nall, packthreads, sizeof(acc_t)); - if (atom->torque) { + if (_torque_flag) { int ii = ifrom * 2; lmp_ft * _noalias const tor = (lmp_ft *) lmp->atom->torque[0] + out_offset; @@ -927,7 +946,7 @@ void FixIntel::add_off_results(const ft * _noalias const f_in, _offload_nlocal; } - if (atom->torque) + if (_torque_flag) if (f_in[1].w < 0.0) error->all(FLERR,"Bad matrix inversion in mldivide3"); add_results(f_in, ev_global, _off_results_eatom, _off_results_vatom, 1); diff --git a/src/INTEL/fix_intel.h b/src/INTEL/fix_intel.h index 050b27c313..08d0a534d9 100644 --- a/src/INTEL/fix_intel.h +++ b/src/INTEL/fix_intel.h @@ -116,7 +116,7 @@ class FixIntel : public Fix { int _precision_mode, _nthreads, _nbor_pack_width, _three_body_neighbor; int _pair_intel_count, _pair_hybrid_flag, _print_pkg_info; // These should be removed in subsequent update w/ simpler hybrid arch - int _pair_hybrid_zero, _hybrid_nonpair, _zero_master; + int _pair_hybrid_zero, _hybrid_nonpair, _zero_master, _torque_flag; public: inline int *get_overflow_flag() { return _overflow_flag; } diff --git a/src/INTEL/intel_buffers.cpp b/src/INTEL/intel_buffers.cpp index bb54577097..6d4c9bffcd 100644 --- a/src/INTEL/intel_buffers.cpp +++ b/src/INTEL/intel_buffers.cpp @@ -28,6 +28,7 @@ template IntelBuffers::IntelBuffers(class LAMMPS *lmp_in) : lmp(lmp_in), _x(nullptr), _q(nullptr), _quat(nullptr), _f(nullptr), _off_threads(0), _n_list_ptrs(1), _max_list_ptrs(4), _buf_size(0), _buf_local_size(0) { + _torque_flag = 0; _neigh_list_ptrs = new IntelNeighListPtrs[_max_list_ptrs]; _neigh_list_ptrs[0].cnumneigh = nullptr; _list_alloc_atoms = 0; @@ -695,7 +696,7 @@ double IntelBuffers::memory_usage(const int nthreads) { double tmem = sizeof(atom_t); if (lmp->atom->q) tmem += sizeof(flt_t); - if (lmp->atom->torque) tmem += sizeof(quat_t); + if (_torque_flag) tmem += sizeof(quat_t); #ifdef _LMP_INTEL_OFFLOAD if (_separate_buffers) tmem *= 2; #endif diff --git a/src/INTEL/intel_buffers.h b/src/INTEL/intel_buffers.h index 7422850184..1e9739c3b2 100644 --- a/src/INTEL/intel_buffers.h +++ b/src/INTEL/intel_buffers.h @@ -57,7 +57,7 @@ class IntelBuffers { inline int get_stride(int nall) { int stride; IP_PRE_get_stride(stride, nall, sizeof(vec3_acc_t), - lmp->atom->torque); + _torque_flag); return stride; } @@ -76,6 +76,8 @@ class IntelBuffers { _neigh_list_ptrs[0].numneighhalf = atombin; } + inline void set_torque_flag(const int in) { _torque_flag = in; } + inline void grow(const int nall, const int nlocal, const int nthreads, const int offload_end) { if (nall >= _buf_size || nlocal >= _buf_local_size) @@ -329,7 +331,7 @@ class IntelBuffers { flt_t *_q; quat_t *_quat; vec3_acc_t * _f; - int _off_threads, _off_map_listlocal; + int _torque_flag, _off_threads, _off_map_listlocal; int _list_alloc_atoms; int *_list_alloc, *_cnumneigh, *_atombin, *_binpacked; From ce38bb988d67f1b82f9093bf1d1563198795cda8 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Thu, 8 Jun 2023 19:12:59 -0400 Subject: [PATCH 222/396] add lammps_last_thermo support to swig, plugin and fortran interface --- examples/COUPLE/plugin/liblammpsplugin.c | 1 + examples/COUPLE/plugin/liblammpsplugin.h | 1 + fortran/lammps.f90 | 80 +++++++++++++++++++++++- tools/swig/lammps.i | 2 + 4 files changed, 83 insertions(+), 1 deletion(-) diff --git a/examples/COUPLE/plugin/liblammpsplugin.c b/examples/COUPLE/plugin/liblammpsplugin.c index d446f9cd2f..0cf9bea512 100644 --- a/examples/COUPLE/plugin/liblammpsplugin.c +++ b/examples/COUPLE/plugin/liblammpsplugin.c @@ -90,6 +90,7 @@ liblammpsplugin_t *liblammpsplugin_load(const char *lib) ADDSYM(get_natoms); ADDSYM(get_thermo); + ADDSYM(last_thermo); ADDSYM(extract_box); ADDSYM(reset_box); diff --git a/examples/COUPLE/plugin/liblammpsplugin.h b/examples/COUPLE/plugin/liblammpsplugin.h index c6ec03e498..40fba6b9e3 100644 --- a/examples/COUPLE/plugin/liblammpsplugin.h +++ b/examples/COUPLE/plugin/liblammpsplugin.h @@ -133,6 +133,7 @@ struct _liblammpsplugin { double (*get_natoms)(void *); double (*get_thermo)(void *, const char *); + void *(*last_thermo)(void *, const char *, int); void (*extract_box)(void *, double *, double *, double *, double *, double *, int *, int *); diff --git a/fortran/lammps.f90 b/fortran/lammps.f90 index cb7adfd34b..f511e6bb60 100644 --- a/fortran/lammps.f90 +++ b/fortran/lammps.f90 @@ -87,10 +87,15 @@ MODULE LIBLAMMPS INTEGER(c_int) :: scalar, vector, array END TYPE lammps_type + TYPE lammps_dtype + INTEGER(c_int) :: i32, i64, r64, str + END TYPE lammps_dtype + TYPE lammps TYPE(c_ptr) :: handle = c_null_ptr TYPE(lammps_style) :: style TYPE(lammps_type) :: type + TYPE(lammps_dtype) :: dtype CONTAINS PROCEDURE :: close => lmp_close PROCEDURE :: error => lmp_error @@ -100,6 +105,7 @@ MODULE LIBLAMMPS PROCEDURE :: commands_string => lmp_commands_string PROCEDURE :: get_natoms => lmp_get_natoms PROCEDURE :: get_thermo => lmp_get_thermo + PROCEDURE :: last_thermo => lmp_last_thermo PROCEDURE :: extract_box => lmp_extract_box PROCEDURE :: reset_box => lmp_reset_box PROCEDURE :: memory_usage => lmp_memory_usage @@ -243,7 +249,7 @@ MODULE LIBLAMMPS END TYPE lammps_data_baseclass ! Derived type for receiving LAMMPS data (in lieu of the ability to type cast - ! pointers). Used for extract_compute, extract_atom + ! pointers). Used for extract_compute, extract_atom, last_thermo TYPE, EXTENDS(lammps_data_baseclass) :: lammps_data INTEGER(c_int), POINTER :: i32 => NULL() INTEGER(c_int), DIMENSION(:), POINTER :: i32_vec => NULL() @@ -439,6 +445,15 @@ MODULE LIBLAMMPS TYPE(c_ptr), INTENT(IN), VALUE :: name END FUNCTION lammps_get_thermo + FUNCTION lammps_last_thermo(handle,what,index) BIND(C) + IMPORT :: c_ptr, c_int + IMPLICIT NONE + TYPE(c_ptr) :: lammps_last_thermo + TYPE(c_ptr), INTENT(IN), VALUE :: handle + TYPE(c_ptr), INTENT(IN), VALUE :: what + INTEGER(c_int), INTENT(IN), VALUE :: index + END FUNCTION lammps_last_thermo + SUBROUTINE lammps_extract_box(handle,boxlo,boxhi,xy,yz,xz,pflags, & boxflag) BIND(C) IMPORT :: c_ptr, c_double, c_int @@ -995,6 +1010,10 @@ CONTAINS lmp_open%type%scalar = LMP_TYPE_SCALAR lmp_open%type%vector = LMP_TYPE_VECTOR lmp_open%type%array = LMP_TYPE_ARRAY + lmp_open%dtype%i32 = LAMMPS_INT + lmp_open%dtype%i64 = LAMMPS_INT64 + lmp_open%dtype%r64 = LAMMPS_DOUBLE + lmp_open%dtype%str = LAMMPS_STRING ! Assign constants for bigint and tagint for use elsewhere SIZE_TAGINT = lmp_extract_setting(lmp_open, 'tagint') @@ -1103,6 +1122,65 @@ CONTAINS CALL lammps_free(Cname) END FUNCTION lmp_get_thermo + ! equivalent function to lammps_last_thermo + FUNCTION lmp_last_thermo(self,what,index) RESULT(thermo_data) + CLASS(lammps), INTENT(IN), TARGET :: self + CHARACTER(LEN=*), INTENT(IN) :: what + INTEGER(c_int) :: index + TYPE(lammps_data) :: thermo_data, type_data + INTEGER(c_int) :: datatype + TYPE(c_ptr) :: Cname, Cptr + + ! set data type for known cases + SELECT CASE (what) + CASE ('step') + IF (SIZE_BIGINT == 4_c_int) THEN + datatype = LAMMPS_INT + ELSE + datatype = LAMMPS_INT64 + END IF + CASE ('num') + datatype = LAMMPS_INT + CASE ('type') + datatype = LAMMPS_INT + CASE ('keyword') + datatype = LAMMPS_STRING + CASE ('data') + Cname = f2c_string('type') + Cptr = lammps_last_thermo(self%handle,Cname,index-1) + type_data%lammps_instance => self + type_data%datatype = DATA_INT + CALL C_F_POINTER(Cptr, type_data%i32) + datatype = type_data%i32 + CALL lammps_free(Cname) + CASE DEFAULT + datatype = -1 + END SELECT + + Cname = f2c_string(what) + Cptr = lammps_last_thermo(self%handle,Cname,index-1) + CALL lammps_free(Cname) + + thermo_data%lammps_instance => self + SELECT CASE (datatype) + CASE (LAMMPS_INT) + thermo_data%datatype = DATA_INT + CALL C_F_POINTER(Cptr, thermo_data%i32) + CASE (LAMMPS_INT64) + thermo_data%datatype = DATA_INT64 + CALL C_F_POINTER(Cptr, thermo_data%i64) + CASE (LAMMPS_DOUBLE) + thermo_data%datatype = DATA_DOUBLE + CALL C_F_POINTER(Cptr, thermo_data%r64) + CASE (LAMMPS_STRING) + thermo_data%datatype = DATA_STRING + thermo_data%str = c2f_string(Cptr) + CASE DEFAULT + CALL lmp_error(self, LMP_ERROR_ALL + LMP_ERROR_WORLD, & + 'Unknown pointer type in last_thermo') + END SELECT + END FUNCTION lmp_last_thermo + ! equivalent subroutine to lammps_extract_box SUBROUTINE lmp_extract_box(self, boxlo, boxhi, xy, yz, xz, pflags, boxflag) CLASS(lammps), INTENT(IN) :: self diff --git a/tools/swig/lammps.i b/tools/swig/lammps.i index b7414573ba..c4ef0a7109 100644 --- a/tools/swig/lammps.i +++ b/tools/swig/lammps.i @@ -113,6 +113,7 @@ extern void lammps_commands_string(void *handle, const char *str); extern double lammps_get_natoms(void *handle); extern double lammps_get_thermo(void *handle, const char *keyword); +extern void *lammps_last_thermo(void *handle, const char *what, int index); extern void lammps_extract_box(void *handle, double *boxlo, double *boxhi, double *xy, double *yz, double *xz, int *pflags, int *boxflag); @@ -295,6 +296,7 @@ extern void lammps_commands_string(void *handle, const char *str); extern double lammps_get_natoms(void *handle); extern double lammps_get_thermo(void *handle, const char *keyword); +extern void *lammps_last_thermo(void *handle, const char *what, int index); extern void lammps_extract_box(void *handle, double *boxlo, double *boxhi, double *xy, double *yz, double *xz, int *pflags, int *boxflag); From 4cad18a057ea81b92ebb119af520fc517dba3fe2 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Thu, 8 Jun 2023 19:59:47 -0400 Subject: [PATCH 223/396] document Fortran version of lammps_last_thermo --- doc/src/Fortran.rst | 191 +++++++++++++++++++++++++++++++++++--------- 1 file changed, 154 insertions(+), 37 deletions(-) diff --git a/doc/src/Fortran.rst b/doc/src/Fortran.rst index 92a42997b8..a0e4da56b5 100644 --- a/doc/src/Fortran.rst +++ b/doc/src/Fortran.rst @@ -203,40 +203,62 @@ Below is an example demonstrating some of the possible uses. .. code-block:: fortran - PROGRAM testprop - USE LIBLAMMPS - USE, INTRINSIC :: ISO_C_BINDING, ONLY : c_double, c_int64_t - USE, INTRINSIC :: ISO_FORTRAN_ENV, ONLY : OUTPUT_UNIT - TYPE(lammps) :: lmp - INTEGER(KIND=c_int64_t), POINTER :: natoms - REAL(KIND=c_double), POINTER :: dt - INTEGER(KIND=c_int64_t), POINTER :: ntimestep - REAL(KIND=c_double) :: pe, ke + PROGRAM testprop + USE LIBLAMMPS + USE, INTRINSIC :: ISO_C_BINDING, ONLY : c_double, c_int64_t, c_int + USE, INTRINSIC :: ISO_FORTRAN_ENV, ONLY : OUTPUT_UNIT + TYPE(lammps) :: lmp + INTEGER(KIND=c_int64_t), POINTER :: natoms, ntimestep, bval + REAL(KIND=c_double), POINTER :: dt, dval + INTEGER(KIND=c_int), POINTER :: nfield, typ, ival + INTEGER(KIND=c_int) :: i + CHARACTER(LEN=11) :: key + REAL(KIND=c_double) :: pe, ke - lmp = lammps() - CALL lmp%file('in.sysinit') - natoms = lmp%extract_global('natoms') - WRITE(OUTPUT_UNIT,'(A,I0,A)') 'Running a simulation with ', natoms, ' atoms' - WRITE(OUTPUT_UNIT,'(I0,A,I0,A,I0,A)') lmp%extract_setting('nlocal'), & - ' local and ', lmp%extract_setting('nghost'), ' ghost atoms. ', & - lmp%extract_setting('ntypes'), ' atom types' + lmp = lammps() + CALL lmp%file('in.sysinit') + natoms = lmp%extract_global('natoms') + WRITE(OUTPUT_UNIT,'(A,I0,A)') 'Running a simulation with ', natoms, ' atoms' + WRITE(OUTPUT_UNIT,'(I0,A,I0,A,I0,A)') lmp%extract_setting('nlocal'), & + ' local and ', lmp%extract_setting('nghost'), ' ghost atoms. ', & + lmp%extract_setting('ntypes'), ' atom types' - CALL lmp%command('run 2 post no') - dt = lmp%extract_global('dt') - ntimestep = lmp%extract_global('ntimestep') - WRITE(OUTPUT_UNIT,'(A,I0,A,F4.1,A)') 'At step: ', ntimestep, & - ' Changing timestep from', dt, ' to 0.5' - dt = 0.5_c_double - CALL lmp%command('run 2 post no') + CALL lmp%command('run 2 post no') - WRITE(OUTPUT_UNIT,'(A,I0)') 'At step: ', ntimestep - pe = lmp%get_thermo('pe') - ke = lmp%get_thermo('ke') - PRINT*, 'PE = ', pe - PRINT*, 'KE = ', ke + ntimestep = lmp%last_thermo('step', 0) + nfield = lmp%last_thermo('num', 0) + WRITE(OUTPUT_UNIT,'(A,I0,A,I0)') 'Last thermo output on step: ', ntimestep, & + ', number of fields: ', nfield + DO i=1, nfield + key = lmp%last_thermo('keyword',i) + typ = lmp%last_thermo('type',i) + IF (typ == lmp%dtype%i32) THEN + ival = lmp%last_thermo('data',i) + WRITE(OUTPUT_UNIT,*) key, ':', ival + ELSE IF (typ == lmp%dtype%i64) THEN + bval = lmp%last_thermo('data',i) + WRITE(OUTPUT_UNIT,*) key, ':', bval + ELSE IF (typ == lmp%dtype%r64) THEN + dval = lmp%last_thermo('data',i) + WRITE(OUTPUT_UNIT,*) key, ':', dval + END IF + END DO - CALL lmp%close(.TRUE.) - END PROGRAM testprop + dt = lmp%extract_global('dt') + ntimestep = lmp%extract_global('ntimestep') + WRITE(OUTPUT_UNIT,'(A,I0,A,F4.1,A)') 'At step: ', ntimestep, & + ' Changing timestep from', dt, ' to 0.5' + dt = 0.5_c_double + CALL lmp%command('run 2 post no') + + WRITE(OUTPUT_UNIT,'(A,I0)') 'At step: ', ntimestep + pe = lmp%get_thermo('pe') + ke = lmp%get_thermo('ke') + WRITE(OUTPUT_UNIT,*) 'PE = ', pe + WRITE(OUTPUT_UNIT,*) 'KE = ', ke + + CALL lmp%close(.TRUE.) + END PROGRAM testprop --------------- @@ -262,6 +284,8 @@ of the contents of the :f:mod:`LIBLAMMPS` Fortran interface to LAMMPS. :ftype style: type(lammps_style) :f type: derived type to access lammps type constants :ftype type: type(lammps_type) + :f dtype: derived type to access lammps data type constants + :ftype dtype: type(lammps_dtype) :f close: :f:subr:`close` :ftype close: subroutine :f subroutine error: :f:subr:`error` @@ -278,6 +302,8 @@ of the contents of the :f:mod:`LIBLAMMPS` Fortran interface to LAMMPS. :ftype get_natoms: function :f get_thermo: :f:func:`get_thermo` :ftype get_thermo: function + :f last_thermo: :f:func:`last_thermo` + :ftype last_thermo: function :f extract_box: :f:subr:`extract_box` :ftype extract_box: subroutine :f reset_box: :f:subr:`reset_box` @@ -587,6 +613,96 @@ Procedures Bound to the :f:type:`lammps` Derived Type -------- +.. f:function:: last_thermo(what, index) + + This function will call :cpp:func:`lammps_last_thermo` and returns + either a string or a pointer to a cached copy of LAMMPS last thermodynamic + output, depending on the data requested through *what*. Note that *index* + uses 1-based indexing to access thermo output columns. + + .. versionadded:: TBD + + Note that this function actually does not return a value, but rather + associates the pointer on the left side of the assignment to point to + internal LAMMPS data (with the exception of string data, which are + copied and returned as ordinary Fortran strings). Pointers must be + of the correct data type to point to said data (typically + ``INTEGER(c_int)``, ``INTEGER(c_int64_t)``, or ``REAL(c_double)``). + The pointer being associated with LAMMPS data is type-checked at + run-time via an overloaded assignment operator. The pointers + returned by this function point to temporary, read-only data that may + be overwritten at any time, so their target values need to be copied + to local storage if they are supposed to persist. + + For example, + + .. code-block:: fortran + + PROGRAM thermo + USE LIBLAMMPS + USE, INTRINSIC :: ISO_C_BINDING, ONLY : c_double, c_int64_t, c_int + TYPE(lammps) :: lmp + INTEGER(KIND=c_int64_t), POINTER :: ntimestep, bval + REAL(KIND=c_double), POINTER :: dval + INTEGER(KIND=c_int), POINTER :: nfield, typ, ival + INTEGER(KIND=c_int) :: i + CHARACTER(LEN=11) :: key + + lmp = lammps() + CALL lmp%file('in.sysinit') + + ntimestep = lmp%last_thermo('step', 0) + nfield = lmp%last_thermo('num', 0) + PRINT*, 'Last thermo output on step: ', ntimestep, ' Number of fields: ', nfield + DO i=1, nfield + key = lmp%last_thermo('keyword',i) + typ = lmp%last_thermo('type',i) + IF (typ == lmp%dtype%i32) THEN + ival = lmp%last_thermo('data',i) + PRINT*, key, ':', ival + ELSE IF (typ == lmp%dtype%i64) THEN + bval = lmp%last_thermo('data',i) + PRINT*, key, ':', bval + ELSE IF (typ == lmp%dtype%r64) THEN + dval = lmp%last_thermo('data',i) + PRINT*, key, ':', dval + END IF + END DO + CALL lmp%close(.TRUE.) + END PROGRAM thermo + + would extract the last timestep where thermo output was done and the number + of columns it printed. Then it loops over the columns to print out column + header keywords and the corresponding data. + + .. note:: + + If :f:func:`last_thermo` returns a string, the string must have a length + greater than or equal to the length of the string (not including the + terminal ``NULL`` character) that LAMMPS returns. If the variable's + length is too short, the string will be truncated. As usual in Fortran, + strings are padded with spaces at the end. If you use an allocatable + string, the string **must be allocated** prior to calling this function. + + :p character(len=\*) what: string with the name of the thermo keyword + :p integer(c_int) index: 1-based column index + :to: :cpp:func:`lammps_last_thermo` + :r pointer [polymorphic]: pointer to LAMMPS data. The left-hand side of the + assignment should be either a string (if expecting string data) or a + C-compatible pointer (e.g., ``INTEGER(c_int), POINTER :: nlocal``) to the + extracted property. + + .. warning:: + + Modifying the data in the location pointed to by the returned pointer + may lead to inconsistent internal data and thus may cause failures, + crashes, or bogus simulations. In general, it is much better + to use a LAMMPS input command that sets or changes these parameters. + Using an input command will take care of all side effects and necessary + updates of settings derived from such settings. + +-------- + .. f:subroutine:: extract_box([boxlo][, boxhi][, xy][, yz][, xz][, pflags][, boxflag]) This subroutine will call :cpp:func:`lammps_extract_box`. All @@ -764,13 +880,14 @@ Procedures Bound to the :f:type:`lammps` Derived Type .. note:: - If :f:func:`extract_global` returns a string, the string must have length - greater than or equal to the length of the string (not including the - terminal ``NULL`` character) that LAMMPS returns. If the variable's - length is too short, the string will be truncated. As usual in Fortran, - strings are padded with spaces at the end. If you use an allocatable - string, the string **must be allocated** prior to calling this function, - but you can automatically reallocate it to the correct length after the + If :f:func:`extract_global` returns a string, the string must have + a length greater than or equal to the length of the string (not + including the terminal ``NULL`` character) that LAMMPS returns. If + the variable's length is too short, the string will be + truncated. As usual in Fortran, strings are padded with spaces at + the end. If you use an allocatable string, the string **must be + allocated** prior to calling this function, but you can + automatically reallocate it to the correct length after the function returns, viz., .. code-block :: fortran From 2cb87bc9a2e3758f342ec6f47b8265d52f05f0bf Mon Sep 17 00:00:00 2001 From: "W. Michael Brown" Date: Thu, 8 Jun 2023 21:47:30 -0700 Subject: [PATCH 224/396] Intel package should not reset atom sort frequency if it is 0 (disabled). --- src/INTEL/fix_intel.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/INTEL/fix_intel.cpp b/src/INTEL/fix_intel.cpp index ef6bfc3408..59224cc511 100644 --- a/src/INTEL/fix_intel.cpp +++ b/src/INTEL/fix_intel.cpp @@ -411,7 +411,7 @@ bool FixIntel::pair_hybrid_check() void FixIntel::pair_init_check(const bool cdmessage) { #ifdef INTEL_VMASK - atom->sortfreq = 1; + if (atom->sortfreq) atom->sortfreq = 1; #endif _nbor_pack_width = 1; From 04a31c33e231bbe2a7151447fa46e4b6b39dc3f7 Mon Sep 17 00:00:00 2001 From: jtclemm Date: Fri, 9 Jun 2023 09:57:23 -0600 Subject: [PATCH 225/396] Changing output of fforce in pair granular single() --- src/GRANULAR/pair_granular.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/GRANULAR/pair_granular.cpp b/src/GRANULAR/pair_granular.cpp index 0b6bd537e5..390a7581d7 100644 --- a/src/GRANULAR/pair_granular.cpp +++ b/src/GRANULAR/pair_granular.cpp @@ -767,10 +767,11 @@ double PairGranular::single(int i, int j, int itype, int jtype, model->history = history; model->calculate_forces(); - double *forces = model->forces; // apply forces & torques - fforce = MathExtra::len3(forces); + // Calculate normal component, normalized by r + fforce = MathExtra::dot3(model->forces, model->dx); + fforce *= model->rinv * model->rinv; // set single_extra quantities svector[0] = model->fs[0]; From e0cbcff1f9ab272b21c028ca8be1765be37e7178 Mon Sep 17 00:00:00 2001 From: jtclemm Date: Fri, 9 Jun 2023 10:43:00 -0600 Subject: [PATCH 226/396] Simplying normal force calculation --- src/GRANULAR/pair_granular.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/GRANULAR/pair_granular.cpp b/src/GRANULAR/pair_granular.cpp index 390a7581d7..30f272791e 100644 --- a/src/GRANULAR/pair_granular.cpp +++ b/src/GRANULAR/pair_granular.cpp @@ -770,8 +770,7 @@ double PairGranular::single(int i, int j, int itype, int jtype, // apply forces & torques // Calculate normal component, normalized by r - fforce = MathExtra::dot3(model->forces, model->dx); - fforce *= model->rinv * model->rinv; + fforce = model->Fnormal * model->rinv; // set single_extra quantities svector[0] = model->fs[0]; From f6b0981474c0a8ec20c3808efdeae5664280bc49 Mon Sep 17 00:00:00 2001 From: "W. Michael Brown" Date: Fri, 9 Jun 2023 14:05:41 -0700 Subject: [PATCH 227/396] Fixing some issues introduced into verlet_lrt_intel.cpp --- src/INTEL/verlet_lrt_intel.cpp | 42 +++++++++++++++++++--------------- 1 file changed, 24 insertions(+), 18 deletions(-) diff --git a/src/INTEL/verlet_lrt_intel.cpp b/src/INTEL/verlet_lrt_intel.cpp index 42414420b6..9df17d8cef 100644 --- a/src/INTEL/verlet_lrt_intel.cpp +++ b/src/INTEL/verlet_lrt_intel.cpp @@ -19,7 +19,6 @@ #include "atom_vec.h" #include "bond.h" #include "comm.h" -#include "compute.h" #include "dihedral.h" #include "domain.h" #include "error.h" @@ -27,7 +26,6 @@ #include "force.h" #include "improper.h" #include "kspace.h" -#include "memory.h" #include "modify.h" #include "neighbor.h" #include "output.h" @@ -35,9 +33,7 @@ #include "timer.h" #include "update.h" -#if defined(_OPENMP) -#include -#endif +#include using namespace LAMMPS_NS; @@ -67,7 +63,7 @@ void VerletLRTIntel::init() { Verlet::init(); - _intel_kspace = dynamic_cast(force->kspace_match("^pppm\\..*intel$", 0)); + _intel_kspace = dynamic_cast(force->kspace_match("^pppm/.*intel$", 0)); // include pppm/electrode/intel #ifndef LMP_INTEL_USELRT @@ -95,12 +91,15 @@ void VerletLRTIntel::setup(int flag) } #endif - if (comm->me == 0) { - fprintf(screen,"Setting up VerletLRTIntel run ...\n"); - fprintf(screen," Unit style : %s\n", update->unit_style); - fmt::print(screen," Current step : {}\n", update->ntimestep); - fprintf(screen," Time step : %g\n", update->dt); - timer->print_timeout(screen); + if (comm->me == 0 && screen) { + fputs("Setting up VerletLRTIntel run ...\n",screen); + if (flag) { + fmt::print(screen," Unit style : {}\n" + " Current step : {}\n" + " Time step : {}\n", + update->unit_style,update->ntimestep,update->dt); + timer->print_timeout(screen); + } } #if defined(_LMP_INTEL_LRT_PTHREAD) @@ -110,8 +109,9 @@ void VerletLRTIntel::setup(int flag) sched_getaffinity(0, sizeof(cpuset), &cpuset); int my_cpu_count = CPU_COUNT(&cpuset); if (my_cpu_count < comm->nthreads + 1) { - error->warning(FLERR, "Using {} threads per MPI rank, but only {} core(s) allocated " - "for each MPI rank", comm->nthreads + 1, my_cpu_count); + error->warning(FLERR, "Using {} threads per MPI rank, but only {} " + "core(s) allocated for each MPI rank", + comm->nthreads + 1, my_cpu_count); } } #endif @@ -144,6 +144,7 @@ void VerletLRTIntel::setup(int flag) domain->box_too_small_check(); modify->setup_pre_neighbor(); neighbor->build(1); + modify->setup_post_neighbor(); neighbor->ncalls = 0; // compute all forces @@ -189,11 +190,11 @@ void VerletLRTIntel::setup(int flag) if (kspace_compute_flag) _intel_kspace->compute_second(eflag,vflag); - modify->pre_reverse(eflag,vflag); + modify->setup_pre_reverse(eflag,vflag); if (force->newton) comm->reverse_comm(); modify->setup(vflag); - output->setup(); + output->setup(flag); update->setupflag = 0; } @@ -214,9 +215,10 @@ void VerletLRTIntel::run(int n) int n_post_integrate = modify->n_post_integrate; int n_pre_exchange = modify->n_pre_exchange; int n_pre_neighbor = modify->n_pre_neighbor; + int n_post_neighbor = modify->n_post_neighbor; int n_pre_force = modify->n_pre_force; int n_pre_reverse = modify->n_pre_reverse; - int n_post_force = modify->n_post_force_any; + int n_post_force_any = modify->n_post_force_any; int n_end_of_step = modify->n_end_of_step; if (atom->sortfreq > 0) sortflag = 1; @@ -279,6 +281,10 @@ void VerletLRTIntel::run(int n) } neighbor->build(1); timer->stamp(Timer::NEIGH); + if (n_post_neighbor) { + modify->post_neighbor(); + timer->stamp(Timer::MODIFY); + } } // force computations @@ -353,7 +359,7 @@ void VerletLRTIntel::run(int n) // force modifications, final time integration, diagnostics - if (n_post_force) modify->post_force(vflag); + if (n_post_force_any) modify->post_force(vflag); modify->final_integrate(); if (n_end_of_step) modify->end_of_step(); timer->stamp(Timer::MODIFY); From ecf7c24e874cb70c19888811b09838d42cd1912b Mon Sep 17 00:00:00 2001 From: Richard Berger Date: Fri, 9 Jun 2023 00:06:00 -0600 Subject: [PATCH 228/396] Avoid static int in lammps_last_thermo --- src/library.cpp | 15 ++------------- src/lmptype.h | 3 ++- 2 files changed, 4 insertions(+), 14 deletions(-) diff --git a/src/library.cpp b/src/library.cpp index 0fcedfc20b..a94e385148 100644 --- a/src/library.cpp +++ b/src/library.cpp @@ -794,7 +794,7 @@ argument string. - yes * - type - data type of thermo output column; see :cpp:enum:`_LMP_DATATYPE_CONST` - - pointer to static int + - pointer to int - yes * - data - actual field data for column @@ -815,7 +815,6 @@ void *lammps_last_thermo(void *handle, const char *what, int index) Thermo *th = lmp->output->thermo; if (!th) return nullptr; const int nfield = *th->get_nfield(); - static int datatype; BEGIN_CAPTURE { @@ -833,17 +832,7 @@ void *lammps_last_thermo(void *handle, const char *what, int index) } else if (strcmp(what, "type") == 0) { if ((index < 0) || (index >= nfield)) return nullptr; const auto &field = th->get_fields()[index]; - if (field.type == multitype::INT) { - datatype = LAMMPS_INT; - val = (void *) &datatype; - } else if (field.type == multitype::BIGINT) { - datatype = LAMMPS_INT64; - val = (void *) &datatype; - } else if (field.type == multitype::DOUBLE) { - datatype = LAMMPS_DOUBLE; - val = (void *) &datatype; - } - + val = (void *) &field.type; } else if (strcmp(what, "data") == 0) { if ((index < 0) || (index >= nfield)) return nullptr; const auto &field = th->get_fields()[index]; diff --git a/src/lmptype.h b/src/lmptype.h index 6e0b54d988..e559bd9416 100644 --- a/src/lmptype.h +++ b/src/lmptype.h @@ -276,7 +276,8 @@ union ubuf { \endverbatim */ struct multitype { - enum { NONE, DOUBLE, INT, BIGINT }; + // same values as LAMMPS_INT, LAMMPS_DOUBLE, and LAMMPS_INT64 in library.h + enum { NONE = -1, INT = 0, DOUBLE = 2, BIGINT = 4 }; int type; union { From fe45b766c3067052805548b7ee1a9f5abbcd5f45 Mon Sep 17 00:00:00 2001 From: Richard Berger Date: Fri, 9 Jun 2023 02:29:30 -0600 Subject: [PATCH 229/396] pylammps: make use of lammps_last_thermo this now avoids parsing LAMMPS output to extract thermo data, but instead uses the new lammps_last_thermo library function --- python/lammps/core.py | 9 +++-- python/lammps/pylammps.py | 75 +++++++++++++-------------------------- 2 files changed, 31 insertions(+), 53 deletions(-) diff --git a/python/lammps/core.py b/python/lammps/core.py index d34d5de4d4..cf613fcbf4 100644 --- a/python/lammps/core.py +++ b/python/lammps/core.py @@ -746,6 +746,11 @@ class lammps(object): return self.lib.lammps_get_thermo(self.lmp,name) # ------------------------------------------------------------------------- + @property + def last_thermo_step(self): + with ExceptionCheck(self): + ptr = self.lib.lammps_last_thermo(self.lmp, c_char_p("step".encode()), 0) + return cast(ptr, POINTER(self.c_bigint)).contents.value def last_thermo(self): """Get a dictionary of the last thermodynamic output @@ -760,9 +765,7 @@ class lammps(object): """ rv = dict() - with ExceptionCheck(self): - ptr = self.lib.lammps_last_thermo(self.lmp, c_char_p("step".encode()), 0) - mystep = cast(ptr, POINTER(self.c_bigint)).contents.value + mystep = self.last_thermo_step if mystep < 0: return None diff --git a/python/lammps/pylammps.py b/python/lammps/pylammps.py index d0ff7ab1aa..a7349ebd2c 100644 --- a/python/lammps/pylammps.py +++ b/python/lammps/pylammps.py @@ -377,55 +377,6 @@ class variable_set: def __repr__(self): return self.__str__() -# ------------------------------------------------------------------------- - -def get_thermo_data(output): - """ traverse output of runs and extract thermo data columns """ - if isinstance(output, str): - lines = output.splitlines() - else: - lines = output - - runs = [] - columns = [] - in_run = False - current_run = {} - - for line in lines: - if line.startswith("Per MPI rank memory allocation"): - in_run = True - elif in_run and len(columns) == 0: - # first line after memory usage are column names - columns = line.split() - - current_run = {} - - for col in columns: - current_run[col] = [] - - elif line.startswith("Loop time of "): - in_run = False - columns = [] - thermo_data = variable_set('ThermoData', current_run) - r = {'thermo' : thermo_data } - runs.append(namedtuple('Run', list(r.keys()))(*list(r.values()))) - elif in_run and len(columns) > 0: - items = line.split() - # Convert thermo output and store it. - # It must have the same number of columns and - # all of them must be convertible to floats. - # Otherwise we ignore the line - if len(items) == len(columns): - try: - values = [float(x) for x in items] - for i, col in enumerate(columns): - current_run[col].append(values[i]) - except ValueError: - # cannot convert. must be a non-thermo output. ignore. - pass - - return runs - # ------------------------------------------------------------------------- # ------------------------------------------------------------------------- @@ -573,6 +524,13 @@ class PyLammps(object): if self.enable_cmd_history: self._cmd_history.append(cmd) + def _append_run_thermo(self, thermo): + for k, v in thermo.items(): + if k in self._current_run: + self._current_run[k].append(v) + else: + self._current_run[k] = [v] + def run(self, *args, **kwargs): """ Execute LAMMPS run command with given arguments @@ -581,8 +539,25 @@ class PyLammps(object): :py:attr:`PyLammps.runs`. The latest run can be retrieved by :py:attr:`PyLammps.last_run`. """ + self._current_run = {} + self._last_thermo_step = -1 + def end_of_step_callback(lmp): + if self.lmp.last_thermo_step == self._last_thermo_step: return + thermo = self.lmp.last_thermo() + self._append_run_thermo(thermo) + self._last_thermo_step = thermo['Step'] + + import __main__ + __main__._PyLammps_end_of_step_callback = end_of_step_callback + + self.fix("__pylammps_internal_run_callback", "all", "python/invoke", "1", "end_of_step", "_PyLammps_end_of_step_callback") output = self.__getattr__('run')(*args, **kwargs) - self.runs += get_thermo_data(output) + self.unfix("__pylammps_internal_run_callback") + self._append_run_thermo(self.lmp.last_thermo()) + + thermo_data = variable_set('ThermoData', self._current_run) + r = {'thermo' : thermo_data } + self.runs.append(namedtuple('Run', list(r.keys()))(*list(r.values()))) return output @property From 235e98ee6a2995adf9b431d98fd1550d6b8a2fd4 Mon Sep 17 00:00:00 2001 From: Richard Berger Date: Fri, 9 Jun 2023 09:49:07 -0600 Subject: [PATCH 230/396] pylammps: only capture all thermo if PYTHON package is enabled --- python/lammps/pylammps.py | 18 +++++++++++++++--- unittest/python/python-pylammps.py | 28 ++++++++++++++++++++-------- 2 files changed, 35 insertions(+), 11 deletions(-) diff --git a/python/lammps/pylammps.py b/python/lammps/pylammps.py index a7349ebd2c..6efc355f5c 100644 --- a/python/lammps/pylammps.py +++ b/python/lammps/pylammps.py @@ -434,6 +434,9 @@ class PyLammps(object): self._enable_cmd_history = False self.runs = [] + if not self.lmp.has_package("PYTHON"): + print("WARNING: run thermo data not captured since PYTHON LAMMPS package is not enabled") + def __enter__(self): return self @@ -535,9 +538,13 @@ class PyLammps(object): """ Execute LAMMPS run command with given arguments - All thermo output during the run is captured and saved as new entry in + Thermo data of the run is recorded and saved as new entry in :py:attr:`PyLammps.runs`. The latest run can be retrieved by :py:attr:`PyLammps.last_run`. + + Note, for recording of all thermo steps during a run, the PYTHON package + needs to be enabled in LAMMPS. Otherwise, it will only capture the final + timestep. """ self._current_run = {} self._last_thermo_step = -1 @@ -549,10 +556,15 @@ class PyLammps(object): import __main__ __main__._PyLammps_end_of_step_callback = end_of_step_callback + capture_thermo = self.lmp.has_package("PYTHON") + + if capture_thermo: + self.fix("__pylammps_internal_run_callback", "all", "python/invoke", "1", "end_of_step", "_PyLammps_end_of_step_callback") - self.fix("__pylammps_internal_run_callback", "all", "python/invoke", "1", "end_of_step", "_PyLammps_end_of_step_callback") output = self.__getattr__('run')(*args, **kwargs) - self.unfix("__pylammps_internal_run_callback") + + if capture_thermo: + self.unfix("__pylammps_internal_run_callback") self._append_run_thermo(self.lmp.last_thermo()) thermo_data = variable_set('ThermoData', self._current_run) diff --git a/unittest/python/python-pylammps.py b/unittest/python/python-pylammps.py index 2b92f82248..9e691b1b8c 100644 --- a/unittest/python/python-pylammps.py +++ b/unittest/python/python-pylammps.py @@ -82,14 +82,26 @@ class PythonPyLammps(unittest.TestCase): self.pylmp.variable("fx atom fx") self.pylmp.run(10) - self.assertEqual(len(self.pylmp.runs), 1) - self.assertEqual(self.pylmp.last_run, self.pylmp.runs[0]) - self.assertEqual(len(self.pylmp.last_run.thermo.Step), 2) - self.assertEqual(len(self.pylmp.last_run.thermo.Temp), 2) - self.assertEqual(len(self.pylmp.last_run.thermo.E_pair), 2) - self.assertEqual(len(self.pylmp.last_run.thermo.E_mol), 2) - self.assertEqual(len(self.pylmp.last_run.thermo.TotEng), 2) - self.assertEqual(len(self.pylmp.last_run.thermo.Press), 2) + # thermo data is only captured during a run if PYTHON package is enabled + # without it, it will only capture the final thermo at completion + if self.pylmp.lmp.has_package("PYTHON"): + self.assertEqual(len(self.pylmp.runs), 1) + self.assertEqual(self.pylmp.last_run, self.pylmp.runs[0]) + self.assertEqual(len(self.pylmp.last_run.thermo.Step), 2) + self.assertEqual(len(self.pylmp.last_run.thermo.Temp), 2) + self.assertEqual(len(self.pylmp.last_run.thermo.E_pair), 2) + self.assertEqual(len(self.pylmp.last_run.thermo.E_mol), 2) + self.assertEqual(len(self.pylmp.last_run.thermo.TotEng), 2) + self.assertEqual(len(self.pylmp.last_run.thermo.Press), 2) + else: + self.assertEqual(len(self.pylmp.runs), 1) + self.assertEqual(self.pylmp.last_run, self.pylmp.runs[0]) + self.assertEqual(len(self.pylmp.last_run.thermo.Step), 1) + self.assertEqual(len(self.pylmp.last_run.thermo.Temp), 1) + self.assertEqual(len(self.pylmp.last_run.thermo.E_pair), 1) + self.assertEqual(len(self.pylmp.last_run.thermo.E_mol), 1) + self.assertEqual(len(self.pylmp.last_run.thermo.TotEng), 1) + self.assertEqual(len(self.pylmp.last_run.thermo.Press), 1) def test_info_queries(self): self.pylmp.lattice("fcc", 0.8442), From 0e7d91b6114d63b49a121e3817318db98c0019c6 Mon Sep 17 00:00:00 2001 From: Richard Berger Date: Sat, 10 Jun 2023 07:45:52 -0600 Subject: [PATCH 231/396] add missing documentation --- doc/src/Python_properties.rst | 5 +++++ python/lammps/core.py | 7 ++++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/doc/src/Python_properties.rst b/doc/src/Python_properties.rst index d8e772379c..031461660a 100644 --- a/doc/src/Python_properties.rst +++ b/doc/src/Python_properties.rst @@ -53,6 +53,7 @@ against invalid accesses. * :py:meth:`version() `: return the numerical version id, e.g. LAMMPS 2 Sep 2015 -> 20150902 * :py:meth:`get_thermo() `: return current value of a thermo keyword + * :py:meth:`last_thermo() `: return a dictionary of the last thermodynamic output * :py:meth:`get_natoms() `: total # of atoms as int * :py:meth:`reset_box() `: reset the simulation box size * :py:meth:`extract_setting() `: return a global setting @@ -60,6 +61,10 @@ against invalid accesses. * :py:meth:`extract_box() `: extract box info * :py:meth:`create_atoms() `: create N atoms with IDs, types, x, v, and image flags + **Properties**: + + * :py:attr:`last_thermo_step `: the last timestep thermodynamic output was computed + .. tab:: PyLammps/IPyLammps API In addition to the functions provided by :py:class:`lammps `, :py:class:`PyLammps ` objects diff --git a/python/lammps/core.py b/python/lammps/core.py index cf613fcbf4..84a80e77a3 100644 --- a/python/lammps/core.py +++ b/python/lammps/core.py @@ -748,6 +748,11 @@ class lammps(object): # ------------------------------------------------------------------------- @property def last_thermo_step(self): + """ Get the last timestep where thermodynamic data was computed + + :return: the timestep or a negative number if there has not been any thermo output yet + :rtype: int + """ with ExceptionCheck(self): ptr = self.lib.lammps_last_thermo(self.lmp, c_char_p("step".encode()), 0) return cast(ptr, POINTER(self.c_bigint)).contents.value @@ -760,7 +765,7 @@ class lammps(object): data from the last timestep into a dictionary. The return value is None, if there has not been any thermo output yet. - :return: value of thermo keyword + :return: a dictionary containing the last computed thermo output values :rtype: dict or None """ From acaa2b7f9b3aa8adda8e5d8f228f3799f808259a Mon Sep 17 00:00:00 2001 From: Richard Berger Date: Sat, 10 Jun 2023 11:35:36 -0600 Subject: [PATCH 232/396] pylammps: update email --- python/lammps/pylammps.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/python/lammps/pylammps.py b/python/lammps/pylammps.py index 6efc355f5c..72cfed53f0 100644 --- a/python/lammps/pylammps.py +++ b/python/lammps/pylammps.py @@ -13,7 +13,7 @@ ################################################################################ # Alternative Python Wrapper -# Written by Richard Berger +# Written by Richard Berger ################################################################################ # for python2/3 compatibility From da9637e94c13c20bbc66c6b83e27f45c1e96ac4f Mon Sep 17 00:00:00 2001 From: "W. Michael Brown" Date: Sat, 10 Jun 2023 13:33:10 -0700 Subject: [PATCH 233/396] Adding std namespace specifier to transcendentals in intel pkg --- src/INTEL/angle_charmm_intel.cpp | 10 ++-- src/INTEL/angle_harmonic_intel.cpp | 8 +-- src/INTEL/bond_harmonic_intel.cpp | 2 +- src/INTEL/dihedral_charmm_intel.cpp | 6 +- src/INTEL/dihedral_fourier_intel.cpp | 4 +- src/INTEL/dihedral_harmonic_intel.cpp | 4 +- src/INTEL/dihedral_opls_intel.cpp | 14 ++--- src/INTEL/fix_nh_intel.cpp | 28 ++++----- src/INTEL/improper_cvff_intel.cpp | 10 ++-- src/INTEL/improper_harmonic_intel.cpp | 12 ++-- src/INTEL/intel_intrinsics.h | 2 +- src/INTEL/math_extra_intel.h | 14 ++--- src/INTEL/pair_airebo_intel.cpp | 2 +- src/INTEL/pair_buck_coul_cut_intel.cpp | 2 +- src/INTEL/pair_buck_coul_long_intel.cpp | 2 +- src/INTEL/pair_buck_intel.cpp | 2 +- src/INTEL/pair_dpd_intel.cpp | 4 +- src/INTEL/pair_eam_intel.cpp | 4 +- src/INTEL/pair_gayberne_intel.cpp | 2 +- .../pair_lj_charmm_coul_charmm_intel.cpp | 2 +- src/INTEL/pair_lj_charmm_coul_long_intel.cpp | 6 +- src/INTEL/pair_lj_cut_coul_long_intel.cpp | 2 +- src/INTEL/pair_sw_intel.cpp | 4 +- src/INTEL/pppm_disp_intel.cpp | 60 +++++++++---------- src/INTEL/pppm_intel.cpp | 12 ++-- 25 files changed, 109 insertions(+), 109 deletions(-) diff --git a/src/INTEL/angle_charmm_intel.cpp b/src/INTEL/angle_charmm_intel.cpp index 1ea9c8348e..e13448e28a 100644 --- a/src/INTEL/angle_charmm_intel.cpp +++ b/src/INTEL/angle_charmm_intel.cpp @@ -178,7 +178,7 @@ void AngleCharmmIntel::eval(const int vflag, const flt_t delz1 = x[i1].z - x[i2].z; const flt_t rsq1 = delx1*delx1 + dely1*dely1 + delz1*delz1; - flt_t ir12 = (flt_t)1.0/sqrt(rsq1); + flt_t ir12 = (flt_t)1.0/std::sqrt(rsq1); // 2nd bond @@ -187,7 +187,7 @@ void AngleCharmmIntel::eval(const int vflag, const flt_t delz2 = x[i3].z - x[i2].z; const flt_t rsq2 = delx2*delx2 + dely2*dely2 + delz2*delz2; - ir12 *= (flt_t)1.0/sqrt(rsq2); + ir12 *= (flt_t)1.0/std::sqrt(rsq2); // Urey-Bradley bond @@ -196,7 +196,7 @@ void AngleCharmmIntel::eval(const int vflag, const flt_t delzUB = x[i3].z - x[i1].z; const flt_t rsqUB = delxUB*delxUB + delyUB*delyUB + delzUB*delzUB; - const flt_t irUB = (flt_t)1.0/sqrt(rsqUB); + const flt_t irUB = (flt_t)1.0/std::sqrt(rsqUB); // Urey-Bradley force & energy @@ -219,12 +219,12 @@ void AngleCharmmIntel::eval(const int vflag, if (c < (flt_t)-1.0) c = (flt_t)-1.0; const flt_t sd = (flt_t)1.0 - c * c; - flt_t s = (flt_t)1.0 / sqrt(sd); + flt_t s = (flt_t)1.0 / std::sqrt(sd); if (sd < SMALL2) s = INVSMALL; // harmonic force & energy - const flt_t dtheta = acos(c) - fc.fc[type].theta0; + const flt_t dtheta = std::acos(c) - fc.fc[type].theta0; const flt_t tk = fc.fc[type].k * dtheta; if (EFLAG) eangle += tk*dtheta; diff --git a/src/INTEL/angle_harmonic_intel.cpp b/src/INTEL/angle_harmonic_intel.cpp index 8cdab1d43a..98125b164b 100644 --- a/src/INTEL/angle_harmonic_intel.cpp +++ b/src/INTEL/angle_harmonic_intel.cpp @@ -178,7 +178,7 @@ void AngleHarmonicIntel::eval(const int vflag, const flt_t delz1 = x[i1].z - x[i2].z; const flt_t rsq1 = delx1*delx1 + dely1*dely1 + delz1*delz1; - const flt_t r1 = (flt_t)1.0/sqrt(rsq1); + const flt_t r1 = (flt_t)1.0/std::sqrt(rsq1); // 2nd bond @@ -187,7 +187,7 @@ void AngleHarmonicIntel::eval(const int vflag, const flt_t delz2 = x[i3].z - x[i2].z; const flt_t rsq2 = delx2*delx2 + dely2*dely2 + delz2*delz2; - const flt_t r2 = (flt_t)1.0/sqrt(rsq2); + const flt_t r2 = (flt_t)1.0/std::sqrt(rsq2); // angle (cos and sin) @@ -199,12 +199,12 @@ void AngleHarmonicIntel::eval(const int vflag, if (c < (flt_t)-1.0) c = (flt_t)-1.0; const flt_t sd = (flt_t)1.0 - c * c; - flt_t s = (flt_t)1.0/sqrt(sd); + flt_t s = (flt_t)1.0/std::sqrt(sd); if (sd < SMALL2) s = INVSMALL; // harmonic force & energy - const flt_t dtheta = acos(c) - fc.fc[type].theta0; + const flt_t dtheta = std::acos(c) - fc.fc[type].theta0; const flt_t tk = fc.fc[type].k * dtheta; flt_t eangle; diff --git a/src/INTEL/bond_harmonic_intel.cpp b/src/INTEL/bond_harmonic_intel.cpp index a60050bb6b..ab38cefea4 100644 --- a/src/INTEL/bond_harmonic_intel.cpp +++ b/src/INTEL/bond_harmonic_intel.cpp @@ -168,7 +168,7 @@ void BondHarmonicIntel::eval(const int vflag, const flt_t delz = x[i1].z - x[i2].z; const flt_t rsq = delx*delx + dely*dely + delz*delz; - const flt_t r = sqrt(rsq); + const flt_t r = std::sqrt(rsq); const flt_t dr = r - fc.fc[type].r0; const flt_t rk = fc.fc[type].k * dr; diff --git a/src/INTEL/dihedral_charmm_intel.cpp b/src/INTEL/dihedral_charmm_intel.cpp index 6c3ae2c927..a41cfb867c 100644 --- a/src/INTEL/dihedral_charmm_intel.cpp +++ b/src/INTEL/dihedral_charmm_intel.cpp @@ -240,14 +240,14 @@ void DihedralCharmmIntel::eval(const int vflag, const flt_t rasq = ax*ax + ay*ay + az*az; const flt_t rbsq = bx*bx + by*by + bz*bz; const flt_t rgsq = vb2xm*vb2xm + vb2ym*vb2ym + vb2zm*vb2zm; - const flt_t rg = sqrt(rgsq); + const flt_t rg = std::sqrt(rgsq); flt_t rginv, ra2inv, rb2inv; rginv = ra2inv = rb2inv = (flt_t)0.0; if (rg > 0) rginv = (flt_t)1.0/rg; if (rasq > 0) ra2inv = (flt_t)1.0/rasq; if (rbsq > 0) rb2inv = (flt_t)1.0/rbsq; - const flt_t rabinv = sqrt(ra2inv*rb2inv); + const flt_t rabinv = std::sqrt(ra2inv*rb2inv); flt_t c = (ax*bx + ay*by + az*bz)*rabinv; const flt_t s = rg*rabinv*(ax*vb3x + ay*vb3y + az*vb3z); @@ -367,7 +367,7 @@ void DihedralCharmmIntel::eval(const int vflag, flt_t forcecoul; if (implicit) forcecoul = qqrd2e * q[i1]*q[i4]*r2inv; - else forcecoul = qqrd2e * q[i1]*q[i4]*sqrt(r2inv); + else forcecoul = qqrd2e * q[i1]*q[i4]*std::sqrt(r2inv); const flt_t forcelj = r6inv * (fc.ljp[itype][jtype].lj1*r6inv - fc.ljp[itype][jtype].lj2); const flt_t fpair = tweight * (forcelj+forcecoul)*r2inv; diff --git a/src/INTEL/dihedral_fourier_intel.cpp b/src/INTEL/dihedral_fourier_intel.cpp index 5448fdae98..595d747839 100644 --- a/src/INTEL/dihedral_fourier_intel.cpp +++ b/src/INTEL/dihedral_fourier_intel.cpp @@ -199,14 +199,14 @@ void DihedralFourierIntel::eval(const int vflag, const flt_t rasq = ax*ax + ay*ay + az*az; const flt_t rbsq = bx*bx + by*by + bz*bz; const flt_t rgsq = vb2xm*vb2xm + vb2ym*vb2ym + vb2zm*vb2zm; - const flt_t rg = sqrt(rgsq); + const flt_t rg = std::sqrt(rgsq); flt_t rginv, ra2inv, rb2inv; rginv = ra2inv = rb2inv = (flt_t)0.0; if (rg > 0) rginv = (flt_t)1.0/rg; if (rasq > 0) ra2inv = (flt_t)1.0/rasq; if (rbsq > 0) rb2inv = (flt_t)1.0/rbsq; - const flt_t rabinv = sqrt(ra2inv*rb2inv); + const flt_t rabinv = std::sqrt(ra2inv*rb2inv); flt_t c = (ax*bx + ay*by + az*bz)*rabinv; const flt_t s = rg*rabinv*(ax*vb3x + ay*vb3y + az*vb3z); diff --git a/src/INTEL/dihedral_harmonic_intel.cpp b/src/INTEL/dihedral_harmonic_intel.cpp index 8d91a3fd27..138545d94a 100644 --- a/src/INTEL/dihedral_harmonic_intel.cpp +++ b/src/INTEL/dihedral_harmonic_intel.cpp @@ -199,14 +199,14 @@ void DihedralHarmonicIntel::eval(const int vflag, const flt_t rasq = ax*ax + ay*ay + az*az; const flt_t rbsq = bx*bx + by*by + bz*bz; const flt_t rgsq = vb2xm*vb2xm + vb2ym*vb2ym + vb2zm*vb2zm; - const flt_t rg = sqrt(rgsq); + const flt_t rg = std::sqrt(rgsq); flt_t rginv, ra2inv, rb2inv; rginv = ra2inv = rb2inv = (flt_t)0.0; if (rg > 0) rginv = (flt_t)1.0/rg; if (rasq > 0) ra2inv = (flt_t)1.0/rasq; if (rbsq > 0) rb2inv = (flt_t)1.0/rbsq; - const flt_t rabinv = sqrt(ra2inv*rb2inv); + const flt_t rabinv = std::sqrt(ra2inv*rb2inv); flt_t c = (ax*bx + ay*by + az*bz)*rabinv; const flt_t s = rg*rabinv*(ax*vb3x + ay*vb3y + az*vb3z); diff --git a/src/INTEL/dihedral_opls_intel.cpp b/src/INTEL/dihedral_opls_intel.cpp index 82151a8585..52763e6bd8 100644 --- a/src/INTEL/dihedral_opls_intel.cpp +++ b/src/INTEL/dihedral_opls_intel.cpp @@ -195,15 +195,15 @@ void DihedralOPLSIntel::eval(const int vflag, // 1st and 2nd angle const flt_t b1mag2 = vb1x*vb1x + vb1y*vb1y + vb1z*vb1z; - const flt_t rb1 = (flt_t)1.0 / sqrt(b1mag2); + const flt_t rb1 = (flt_t)1.0 / std::sqrt(b1mag2); const flt_t sb1 = (flt_t)1.0 / b1mag2; const flt_t b2mag2 = vb2xm*vb2xm + vb2ym*vb2ym + vb2zm*vb2zm; - const flt_t rb2 = (flt_t)1.0 / sqrt(b2mag2); + const flt_t rb2 = (flt_t)1.0 / std::sqrt(b2mag2); const flt_t sb2 = (flt_t)1.0 / b2mag2; const flt_t b3mag2 = vb3x*vb3x + vb3y*vb3y + vb3z*vb3z; - const flt_t rb3 = (flt_t)1.0 / sqrt(b3mag2); + const flt_t rb3 = (flt_t)1.0 / std::sqrt(b3mag2); const flt_t sb3 = (flt_t)1.0 / b3mag2; const flt_t c0 = (vb1x*vb3x + vb1y*vb3y + vb1z*vb3z) * rb1*rb3; @@ -219,11 +219,11 @@ void DihedralOPLSIntel::eval(const int vflag, // cos and sin of 2 angles and final c flt_t sin2 = MAX((flt_t)1.0 - c1mag*c1mag,(flt_t)0.0); - flt_t sc1 = (flt_t)1.0/sqrt(sin2); + flt_t sc1 = (flt_t)1.0/std::sqrt(sin2); if (sin2 < SMALL2) sc1 = INVSMALL; sin2 = MAX((flt_t)1.0 - c2mag*c2mag,(flt_t)0.0); - flt_t sc2 = (flt_t)1.0/sqrt(sin2); + flt_t sc2 = (flt_t)1.0/std::sqrt(sin2); if (sin2 < SMALL2) sc2 = INVSMALL; const flt_t s1 = sc1 * sc1; @@ -234,7 +234,7 @@ void DihedralOPLSIntel::eval(const int vflag, const flt_t cx = vb1z*vb2ym - vb1y*vb2zm; const flt_t cy = vb1x*vb2zm - vb1z*vb2xm; const flt_t cz = vb1y*vb2xm - vb1x*vb2ym; - const flt_t cmag = (flt_t)1.0/sqrt(cx*cx + cy*cy + cz*cz); + const flt_t cmag = (flt_t)1.0/std::sqrt(cx*cx + cy*cy + cz*cz); const flt_t dx = (cx*vb3x + cy*vb3y + cz*vb3z)*cmag*rb3; // error check @@ -252,7 +252,7 @@ void DihedralOPLSIntel::eval(const int vflag, const flt_t cossq = c * c; const flt_t sinsq = (flt_t)1.0 - cossq; - flt_t siinv = (flt_t)1.0/sqrt(sinsq); + flt_t siinv = (flt_t)1.0/std::sqrt(sinsq); if (sinsq < SMALLER2 ) siinv = INVSMALLER; if (dx < (flt_t)0.0) siinv = -siinv; diff --git a/src/INTEL/fix_nh_intel.cpp b/src/INTEL/fix_nh_intel.cpp index 87ce0dbe43..2c05c3f6fa 100644 --- a/src/INTEL/fix_nh_intel.cpp +++ b/src/INTEL/fix_nh_intel.cpp @@ -166,28 +166,28 @@ void FixNHIntel::remap() if (pstyle == TRICLINIC) { if (p_flag[4]) { - expfac = exp(dto8*omega_dot[0]); + expfac = std::exp(dto8*omega_dot[0]); h[4] *= expfac; h[4] += dto4*(omega_dot[5]*h[3]+omega_dot[4]*h[2]); h[4] *= expfac; } if (p_flag[3]) { - expfac = exp(dto4*omega_dot[1]); + expfac = std::exp(dto4*omega_dot[1]); h[3] *= expfac; h[3] += dto2*(omega_dot[3]*h[2]); h[3] *= expfac; } if (p_flag[5]) { - expfac = exp(dto4*omega_dot[0]); + expfac = std::exp(dto4*omega_dot[0]); h[5] *= expfac; h[5] += dto2*(omega_dot[5]*h[1]); h[5] *= expfac; } if (p_flag[4]) { - expfac = exp(dto8*omega_dot[0]); + expfac = std::exp(dto8*omega_dot[0]); h[4] *= expfac; h[4] += dto4*(omega_dot[5]*h[3]+omega_dot[4]*h[2]); h[4] *= expfac; @@ -200,7 +200,7 @@ void FixNHIntel::remap() if (p_flag[0]) { oldlo = domain->boxlo[0]; oldhi = domain->boxhi[0]; - expfac = exp(dto*omega_dot[0]); + expfac = std::exp(dto*omega_dot[0]); domain->boxlo[0] = (oldlo-fixedpoint[0])*expfac + fixedpoint[0]; domain->boxhi[0] = (oldhi-fixedpoint[0])*expfac + fixedpoint[0]; } @@ -208,7 +208,7 @@ void FixNHIntel::remap() if (p_flag[1]) { oldlo = domain->boxlo[1]; oldhi = domain->boxhi[1]; - expfac = exp(dto*omega_dot[1]); + expfac = std::exp(dto*omega_dot[1]); domain->boxlo[1] = (oldlo-fixedpoint[1])*expfac + fixedpoint[1]; domain->boxhi[1] = (oldhi-fixedpoint[1])*expfac + fixedpoint[1]; if (scalexy) h[5] *= expfac; @@ -217,7 +217,7 @@ void FixNHIntel::remap() if (p_flag[2]) { oldlo = domain->boxlo[2]; oldhi = domain->boxhi[2]; - expfac = exp(dto*omega_dot[2]); + expfac = std::exp(dto*omega_dot[2]); domain->boxlo[2] = (oldlo-fixedpoint[2])*expfac + fixedpoint[2]; domain->boxhi[2] = (oldhi-fixedpoint[2])*expfac + fixedpoint[2]; if (scalexz) h[4] *= expfac; @@ -229,28 +229,28 @@ void FixNHIntel::remap() if (pstyle == TRICLINIC) { if (p_flag[4]) { - expfac = exp(dto8*omega_dot[0]); + expfac = std::exp(dto8*omega_dot[0]); h[4] *= expfac; h[4] += dto4*(omega_dot[5]*h[3]+omega_dot[4]*h[2]); h[4] *= expfac; } if (p_flag[3]) { - expfac = exp(dto4*omega_dot[1]); + expfac = std::exp(dto4*omega_dot[1]); h[3] *= expfac; h[3] += dto2*(omega_dot[3]*h[2]); h[3] *= expfac; } if (p_flag[5]) { - expfac = exp(dto4*omega_dot[0]); + expfac = std::exp(dto4*omega_dot[0]); h[5] *= expfac; h[5] += dto2*(omega_dot[5]*h[1]); h[5] *= expfac; } if (p_flag[4]) { - expfac = exp(dto8*omega_dot[0]); + expfac = std::exp(dto8*omega_dot[0]); h[4] *= expfac; h[4] += dto4*(omega_dot[5]*h[3]+omega_dot[4]*h[2]); h[4] *= expfac; @@ -427,9 +427,9 @@ void FixNHIntel::nh_v_press() int nlocal = atom->nlocal; if (igroup == atom->firstgroup) nlocal = atom->nfirst; - double f0 = exp(-dt4*(omega_dot[0]+mtk_term2)); - double f1 = exp(-dt4*(omega_dot[1]+mtk_term2)); - double f2 = exp(-dt4*(omega_dot[2]+mtk_term2)); + double f0 = std::exp(-dt4*(omega_dot[0]+mtk_term2)); + double f1 = std::exp(-dt4*(omega_dot[1]+mtk_term2)); + double f2 = std::exp(-dt4*(omega_dot[2]+mtk_term2)); f0 *= f0; f1 *= f1; f2 *= f2; diff --git a/src/INTEL/improper_cvff_intel.cpp b/src/INTEL/improper_cvff_intel.cpp index 09b2d42167..a503f45541 100644 --- a/src/INTEL/improper_cvff_intel.cpp +++ b/src/INTEL/improper_cvff_intel.cpp @@ -191,15 +191,15 @@ void ImproperCvffIntel::eval(const int vflag, // 1st and 2nd angle const flt_t b1mag2 = vb1x*vb1x + vb1y*vb1y + vb1z*vb1z; - const flt_t rb1 = (flt_t)1.0 / sqrt(b1mag2); + const flt_t rb1 = (flt_t)1.0 / std::sqrt(b1mag2); const flt_t sb1 = (flt_t)1.0 / b1mag2; const flt_t b2mag2 = vb2xm*vb2xm + vb2ym*vb2ym + vb2zm*vb2zm; - const flt_t rb2 = (flt_t)1.0 / sqrt(b2mag2); + const flt_t rb2 = (flt_t)1.0 / std::sqrt(b2mag2); const flt_t sb2 = (flt_t)1.0 / b2mag2; const flt_t b3mag2 = vb3x*vb3x + vb3y*vb3y + vb3z*vb3z; - const flt_t rb3 = (flt_t)1.0 / sqrt(b3mag2); + const flt_t rb3 = (flt_t)1.0 / std::sqrt(b3mag2); const flt_t sb3 = (flt_t)1.0 / b3mag2; const flt_t c0 = (vb1x * vb3x + vb1y * vb3y + vb1z * vb3z) * rb1 * rb3; @@ -215,11 +215,11 @@ void ImproperCvffIntel::eval(const int vflag, // cos and sin of 2 angles and final c const flt_t sd1 = (flt_t)1.0 - c1mag * c1mag; - flt_t sc1 = (flt_t)1.0/sqrt(sd1); + flt_t sc1 = (flt_t)1.0/std::sqrt(sd1); if (sd1 < SMALL2) sc1 = INVSMALL; const flt_t sd2 = (flt_t)1.0 - c2mag * c2mag; - flt_t sc2 = (flt_t)1.0/sqrt(sd2); + flt_t sc2 = (flt_t)1.0/std::sqrt(sd2); if (sc2 < SMALL2) sc2 = INVSMALL; const flt_t s1 = sc1 * sc1; diff --git a/src/INTEL/improper_harmonic_intel.cpp b/src/INTEL/improper_harmonic_intel.cpp index a9a152d5f0..869051ab6b 100644 --- a/src/INTEL/improper_harmonic_intel.cpp +++ b/src/INTEL/improper_harmonic_intel.cpp @@ -194,9 +194,9 @@ void ImproperHarmonicIntel::eval(const int vflag, flt_t ss2 = vb2x*vb2x + vb2y*vb2y + vb2z*vb2z; flt_t ss3 = vb3x*vb3x + vb3y*vb3y + vb3z*vb3z; - const flt_t r1 = (flt_t)1.0 / sqrt(ss1); - const flt_t r2 = (flt_t)1.0 / sqrt(ss2); - const flt_t r3 = (flt_t)1.0 / sqrt(ss3); + const flt_t r1 = (flt_t)1.0 / std::sqrt(ss1); + const flt_t r2 = (flt_t)1.0 / std::sqrt(ss2); + const flt_t r3 = (flt_t)1.0 / std::sqrt(ss3); ss1 = (flt_t)1.0 / ss1; ss2 = (flt_t)1.0 / ss2; @@ -214,7 +214,7 @@ void ImproperHarmonicIntel::eval(const int vflag, flt_t s2 = (flt_t)1.0 - c2*c2; if (s2 < SMALL) s2 = SMALL; - flt_t s12 = (flt_t)1.0 / sqrt(s1*s2); + flt_t s12 = (flt_t)1.0 / std::sqrt(s1*s2); s1 = (flt_t)1.0 / s1; s2 = (flt_t)1.0 / s2; flt_t c = (c1*c2 + c0) * s12; @@ -229,12 +229,12 @@ void ImproperHarmonicIntel::eval(const int vflag, if (c < (flt_t)-1.0) c = (flt_t)-1.0; const flt_t sd = (flt_t)1.0 - c * c; - flt_t s = (flt_t)1.0 / sqrt(sd); + flt_t s = (flt_t)1.0 / std::sqrt(sd); if (sd < SMALL2) s = INVSMALL; // force & energy - const flt_t domega = acos(c) - fc.fc[type].chi; + const flt_t domega = std::acos(c) - fc.fc[type].chi; flt_t a; a = fc.fc[type].k * domega; diff --git a/src/INTEL/intel_intrinsics.h b/src/INTEL/intel_intrinsics.h index 1ff405edd2..c106dfd411 100644 --- a/src/INTEL/intel_intrinsics.h +++ b/src/INTEL/intel_intrinsics.h @@ -1764,7 +1764,7 @@ struct vector_ops { return a < b; } static fvec invsqrt(const fvec &a) { - return 1. / sqrt(a); + return 1. / std::sqrt(a); } static fvec sincos(fvec *c, const fvec &a) { *c = cos(a); diff --git a/src/INTEL/math_extra_intel.h b/src/INTEL/math_extra_intel.h index a8869f7384..556f3f4590 100644 --- a/src/INTEL/math_extra_intel.h +++ b/src/INTEL/math_extra_intel.h @@ -100,12 +100,12 @@ normalize a vector, return in ans ------------------------------------------------------------------------- */ -#define ME_normalize3(v0, v1, v2, ans) \ -{ \ - flt_t scale = (flt_t)1.0 / sqrt(v0*v0+v1*v1+v2*v2); \ - ans##_0 = v0 * scale; \ - ans##_1 = v1 * scale; \ - ans##_2 = v2 * scale; \ +#define ME_normalize3(v0, v1, v2, ans) \ +{ \ + flt_t scale = (flt_t)1.0 / std::sqrt(v0*v0+v1*v1+v2*v2); \ + ans##_0 = v0 * scale; \ + ans##_1 = v1 * scale; \ + ans##_2 = v2 * scale; \ } /* ---------------------------------------------------------------------- @@ -359,7 +359,7 @@ #define ME_qnormalize(q) \ { \ double norm = 1.0 / \ - sqrt(q##_w*q##_w + q##_i*q##_i + q##_j*q##_j + q##_k*q##_k); \ + std::sqrt(q##_w*q##_w + q##_i*q##_i + q##_j*q##_j + q##_k*q##_k); \ q##_w *= norm; \ q##_i *= norm; \ q##_j *= norm; \ diff --git a/src/INTEL/pair_airebo_intel.cpp b/src/INTEL/pair_airebo_intel.cpp index 0b05447dd7..7bc2b3edb8 100644 --- a/src/INTEL/pair_airebo_intel.cpp +++ b/src/INTEL/pair_airebo_intel.cpp @@ -905,7 +905,7 @@ inline flt_t frebo_pij(KernelArgsAIREBOT * ka, int i, int j, flt_t rho_k = ka->params.rho[ktype][1]; flt_t rho_j = ka->params.rho[jtype][1]; flt_t lamdajik = 4 * itype * ((rho_k - rikmag) - (rho_j - rijmag)); - flt_t ex_lam = exp(lamdajik); + flt_t ex_lam = overloaded::exp(lamdajik); flt_t rcminik = ka->params.rcmin[itype][ktype]; flt_t rcmaxik = ka->params.rcmax[itype][ktype]; flt_t dwik; diff --git a/src/INTEL/pair_buck_coul_cut_intel.cpp b/src/INTEL/pair_buck_coul_cut_intel.cpp index 01a9f91bcf..424e38c16a 100644 --- a/src/INTEL/pair_buck_coul_cut_intel.cpp +++ b/src/INTEL/pair_buck_coul_cut_intel.cpp @@ -267,7 +267,7 @@ void PairBuckCoulCutIntel::eval(const int offload, const int vflag, const flt_t delz = ztmp - x[j].z; const int jtype = IP_PRE_dword_index(x[j].w); const flt_t rsq = delx * delx + dely * dely + delz * delz; - const flt_t r = sqrt(rsq); + const flt_t r = std::sqrt(rsq); const flt_t r2inv = (flt_t)1.0 / rsq; #ifdef INTEL_VMASK diff --git a/src/INTEL/pair_buck_coul_long_intel.cpp b/src/INTEL/pair_buck_coul_long_intel.cpp index ff57b571a4..48007c30d9 100644 --- a/src/INTEL/pair_buck_coul_long_intel.cpp +++ b/src/INTEL/pair_buck_coul_long_intel.cpp @@ -322,7 +322,7 @@ void PairBuckCoulLongIntel::eval(const int offload, const int vflag, const int jtype = tjtype[jj]; const flt_t rsq = trsq[jj]; const flt_t r2inv = (flt_t)1.0 / rsq; - const flt_t r = (flt_t)1.0 / sqrt(r2inv); + const flt_t r = (flt_t)1.0 / std::sqrt(r2inv); #ifdef INTEL_ALLOW_TABLE if (!ncoultablebits || rsq <= tabinnersq) { diff --git a/src/INTEL/pair_buck_intel.cpp b/src/INTEL/pair_buck_intel.cpp index 2461361788..1f2a033784 100644 --- a/src/INTEL/pair_buck_intel.cpp +++ b/src/INTEL/pair_buck_intel.cpp @@ -255,7 +255,7 @@ void PairBuckIntel::eval(const int offload, const int vflag, const flt_t delz = ztmp - x[j].z; const int jtype = IP_PRE_dword_index(x[j].w); const flt_t rsq = delx * delx + dely * dely + delz * delz; - const flt_t r = sqrt(rsq); + const flt_t r = std::sqrt(rsq); const flt_t r2inv = (flt_t)1.0 / rsq; #ifdef INTEL_VMASK diff --git a/src/INTEL/pair_dpd_intel.cpp b/src/INTEL/pair_dpd_intel.cpp index 011979223e..7b11053d41 100644 --- a/src/INTEL/pair_dpd_intel.cpp +++ b/src/INTEL/pair_dpd_intel.cpp @@ -180,7 +180,7 @@ void PairDPDIntel::eval(const int offload, const int vflag, ATOM_T * _noalias const x = buffers->get_x(offload); typedef struct { double x, y, z; } lmp_vt; auto *v = (lmp_vt *)atom->v[0]; - const flt_t dtinvsqrt = 1.0/sqrt(update->dt); + const flt_t dtinvsqrt = 1.0/std::sqrt(update->dt); const int * _noalias const ilist = list->ilist; const int * _noalias const numneigh = list->numneigh; @@ -322,7 +322,7 @@ void PairDPDIntel::eval(const int offload, const int vflag, icut = parami[jtype].icut; } const flt_t rsq = delx * delx + dely * dely + delz * delz; - const flt_t rinv = (flt_t)1.0/sqrt(rsq); + const flt_t rinv = (flt_t)1.0/std::sqrt(rsq); if (rinv > icut) { flt_t factor_dpd, factor_sqrt; diff --git a/src/INTEL/pair_eam_intel.cpp b/src/INTEL/pair_eam_intel.cpp index ba5047a15a..9c5d6da5e5 100644 --- a/src/INTEL/pair_eam_intel.cpp +++ b/src/INTEL/pair_eam_intel.cpp @@ -340,7 +340,7 @@ void PairEAMIntel::eval(const int offload, const int vflag, const int j = tj[jj] & NEIGHMASK; if (!ONETYPE) jtype = tjtype[jj]; const flt_t rsq = trsq[jj]; - flt_t p = sqrt(rsq)*frdr + (flt_t)1.0; + flt_t p = std::sqrt(rsq)*frdr + (flt_t)1.0; int m = static_cast (p); m = MIN(m,nr-1); p -= m; @@ -546,7 +546,7 @@ void PairEAMIntel::eval(const int offload, const int vflag, const int j = tj[jj] & NEIGHMASK; if (!ONETYPE) jtype = tjtype[jj]; const flt_t rsq = trsq[jj]; - const flt_t r = sqrt(rsq); + const flt_t r = std::sqrt(rsq); flt_t p = r*frdr + (flt_t)1.0; int m = static_cast (p); m = MIN(m,nr-1); diff --git a/src/INTEL/pair_gayberne_intel.cpp b/src/INTEL/pair_gayberne_intel.cpp index 5609479388..92e074e5e1 100644 --- a/src/INTEL/pair_gayberne_intel.cpp +++ b/src/INTEL/pair_gayberne_intel.cpp @@ -492,7 +492,7 @@ void PairGayBerneIntel::eval(const int offload, const int vflag, flt_t r12hat_0, r12hat_1, r12hat_2; ME_normalize3(delx_form[jj], dely_form[jj], delz_form[jj], r12hat); - flt_t r = sqrt(rsq_form[jj]); + flt_t r = std::sqrt(rsq_form[jj]); // compute distance of closest approach diff --git a/src/INTEL/pair_lj_charmm_coul_charmm_intel.cpp b/src/INTEL/pair_lj_charmm_coul_charmm_intel.cpp index e920257ef4..faae6e5cbc 100644 --- a/src/INTEL/pair_lj_charmm_coul_charmm_intel.cpp +++ b/src/INTEL/pair_lj_charmm_coul_charmm_intel.cpp @@ -306,7 +306,7 @@ void PairLJCharmmCoulCharmmIntel::eval(const int offload, const int vflag, const int sbindex = tj[jj] >> SBBITS & 3; const flt_t rsq = trsq[jj]; const flt_t r2inv = (flt_t)1.0 / rsq; - const flt_t r_inv = (flt_t)1.0 / sqrt(rsq); + const flt_t r_inv = (flt_t)1.0 / std::sqrt(rsq); forcecoul = qqrd2e * qtmp * q[j] * r_inv; if (rsq > cut_coul_innersq) { const flt_t ccr = cut_coulsq - rsq; diff --git a/src/INTEL/pair_lj_charmm_coul_long_intel.cpp b/src/INTEL/pair_lj_charmm_coul_long_intel.cpp index 0a93621bcd..412af17357 100644 --- a/src/INTEL/pair_lj_charmm_coul_long_intel.cpp +++ b/src/INTEL/pair_lj_charmm_coul_long_intel.cpp @@ -339,7 +339,7 @@ void PairLJCharmmCoulLongIntel::eval(const int offload, const int vflag, const flt_t EWALD_F = 1.12837917; const flt_t INV_EWALD_P = 1.0 / 0.3275911; - const flt_t r = (flt_t)1.0 / sqrt(r2inv); + const flt_t r = (flt_t)1.0 / std::sqrt(r2inv); const flt_t grij = g_ewald * r; const flt_t expm2 = std::exp(-grij * grij); const flt_t t = INV_EWALD_P / (INV_EWALD_P + grij); @@ -591,10 +591,10 @@ void PairLJCharmmCoulLongIntel::pack_force_const(ForceConst &fc, for (int j = 1; j < tp1; j++) { if (i <= j) { fc.lj[i][j].x = epsilon[i][j] * 4.0; - fc.lj[i][j].y = pow(sigma[i][j],6.0); + fc.lj[i][j].y = std::pow(sigma[i][j],6.0); } else { fc.lj[i][j].x = epsilon[j][i] * 4.0; - fc.lj[i][j].y = pow(sigma[j][i],6.0); + fc.lj[i][j].y = std::pow(sigma[j][i],6.0); } fc.cutsq[i][j] = cutsq[i][j]; } diff --git a/src/INTEL/pair_lj_cut_coul_long_intel.cpp b/src/INTEL/pair_lj_cut_coul_long_intel.cpp index 89e556defa..5eb3cbc1f7 100644 --- a/src/INTEL/pair_lj_cut_coul_long_intel.cpp +++ b/src/INTEL/pair_lj_cut_coul_long_intel.cpp @@ -332,7 +332,7 @@ void PairLJCutCoulLongIntel::eval(const int offload, const int vflag, const flt_t EWALD_F = 1.12837917; const flt_t INV_EWALD_P = 1.0 / 0.3275911; - const flt_t r = (flt_t)1.0 / sqrt(r2inv); + const flt_t r = (flt_t)1.0 / std::sqrt(r2inv); const flt_t grij = g_ewald * r; const flt_t expm2 = std::exp(-grij * grij); const flt_t t = INV_EWALD_P / (INV_EWALD_P + grij); diff --git a/src/INTEL/pair_sw_intel.cpp b/src/INTEL/pair_sw_intel.cpp index 07d590ee2c..fa62f499de 100644 --- a/src/INTEL/pair_sw_intel.cpp +++ b/src/INTEL/pair_sw_intel.cpp @@ -382,7 +382,7 @@ void PairSWIntel::eval(const int offload, const int vflag, const flt_t rsq1 = trsq[jj]; const flt_t rinvsq1 = (flt_t)1.0 / rsq1; - const flt_t r1 = (flt_t)1.0/sqrt(rinvsq1); + const flt_t r1 = (flt_t)1.0/std::sqrt(rinvsq1); if (!ONETYPE) cut = p2f[ijtype].cut; const flt_t rainv1 = (flt_t)1.0 / (r1 - cut); @@ -475,7 +475,7 @@ void PairSWIntel::eval(const int offload, const int vflag, const flt_t rsq2 = trsq[kk]; const flt_t rinvsq2 = (flt_t)1.0 / rsq2; - const flt_t r2 = (flt_t)1.0 / sqrt(rinvsq2); + const flt_t r2 = (flt_t)1.0 / std::sqrt(rinvsq2); const flt_t rainv2 = (flt_t)1.0 / (r2 - cut); const flt_t gsrainv2 = sigma_gamma * rainv2; const flt_t gsrainvsq2 = gsrainv2 * rainv2 / r2; diff --git a/src/INTEL/pppm_disp_intel.cpp b/src/INTEL/pppm_disp_intel.cpp index fdff23fe5e..e17c077c6e 100644 --- a/src/INTEL/pppm_disp_intel.cpp +++ b/src/INTEL/pppm_disp_intel.cpp @@ -662,8 +662,8 @@ void PPPMDispIntel::compute(int eflag, int vflag) energy_1 -= g_ewald*qsqsum/MY_PIS + MY_PI2*qsum*qsum / (g_ewald*g_ewald*volume); - energy_6 += - MY_PI*MY_PIS/(6*volume)*pow(g_ewald_6,3)*csumij + - 1.0/12.0*pow(g_ewald_6,6)*csum; + energy_6 += - MY_PI*MY_PIS/(6*volume)*std::pow(g_ewald_6,3)*csumij + + 1.0/12.0*std::pow(g_ewald_6,6)*csum; energy_1 *= qscale; } @@ -676,7 +676,7 @@ void PPPMDispIntel::compute(int eflag, int vflag) MPI_Allreduce(virial_6,virial_all,6,MPI_DOUBLE,MPI_SUM,world); for (i = 0; i < 6; i++) virial[i] += 0.5*volume*virial_all[i]; if (function[1]+function[2]+function[3]) { - double a = MY_PI*MY_PIS/(6*volume)*pow(g_ewald_6,3)*csumij; + double a = MY_PI*MY_PIS/(6*volume)*std::pow(g_ewald_6,3)*csumij; virial[0] -= a; virial[1] -= a; virial[2] -= a; @@ -695,8 +695,8 @@ void PPPMDispIntel::compute(int eflag, int vflag) int tmp; for (i = 0; i < atom->nlocal; i++) { tmp = atom->type[i]; - eatom[i] += - MY_PI*MY_PIS/(6*volume)*pow(g_ewald_6,3)*csumi[tmp] + - 1.0/12.0*pow(g_ewald_6,6)*cii[tmp]; + eatom[i] += - MY_PI*MY_PIS/(6*volume)*std::pow(g_ewald_6,3)* + csumi[tmp] + 1.0/12.0*std::pow(g_ewald_6,6)*cii[tmp]; } } } @@ -708,7 +708,7 @@ void PPPMDispIntel::compute(int eflag, int vflag) tmp = atom->type[i]; //dispersion self virial correction for (int n = 0; n < 3; n++) vatom[i][n] -= MY_PI*MY_PIS/(6*volume)* - pow(g_ewald_6,3)*csumi[tmp]; + std::pow(g_ewald_6,3)*csumi[tmp]; } } } @@ -1788,18 +1788,18 @@ void PPPMDispIntel::fieldforce_c_ad(IntelBuffers * /*buffers*/) const flt_t s1 = x[i][0] * hx_inv; const flt_t s2 = x[i][1] * hy_inv; const flt_t s3 = x[i][2] * hz_inv; - flt_t sf = fsf_coeff0 * sin(ftwo_pi * s1); - sf += fsf_coeff1 * sin(ffour_pi * s1); + flt_t sf = fsf_coeff0 * std::sin(ftwo_pi * s1); + sf += fsf_coeff1 * std::sin(ffour_pi * s1); sf *= twoqsq; f[i][0] += qfactor * particle_ekx[i] - fqqrd2es * sf; - sf = fsf_coeff2 * sin(ftwo_pi * s2); - sf += fsf_coeff3 * sin(ffour_pi * s2); + sf = fsf_coeff2 * std::sin(ftwo_pi * s2); + sf += fsf_coeff3 * std::sin(ffour_pi * s2); sf *= twoqsq; f[i][1] += qfactor * particle_eky[i] - fqqrd2es * sf; - sf = fsf_coeff4 * sin(ftwo_pi * s3); - sf += fsf_coeff5 * sin(ffour_pi * s3); + sf = fsf_coeff4 * std::sin(ftwo_pi * s3); + sf += fsf_coeff5 * std::sin(ffour_pi * s3); sf *= twoqsq; if (slabflag != 2) f[i][2] += qfactor * particle_ekz[i] - fqqrd2es * sf; @@ -2160,18 +2160,18 @@ void PPPMDispIntel::fieldforce_g_ad(IntelBuffers * /*buffers*/) const flt_t s1 = x[i][0] * hx_inv; const flt_t s2 = x[i][1] * hy_inv; const flt_t s3 = x[i][2] * hz_inv; - flt_t sf = fsf_coeff0 * sin(ftwo_pi * s1); - sf += fsf_coeff1 * sin(ffour_pi * s1); + flt_t sf = fsf_coeff0 * std::sin(ftwo_pi * s1); + sf += fsf_coeff1 * std::sin(ffour_pi * s1); sf *= twoljsq; f[i][0] += lj * particle_ekx[i] - sf; - sf = fsf_coeff2 * sin(ftwo_pi * s2); - sf += fsf_coeff3 * sin(ffour_pi * s2); + sf = fsf_coeff2 * std::sin(ftwo_pi * s2); + sf += fsf_coeff3 * std::sin(ffour_pi * s2); sf *= twoljsq; f[i][1] += lj * particle_eky[i] - sf; - sf = fsf_coeff4 * sin(ftwo_pi * s3); - sf += fsf_coeff5 * sin(ffour_pi * s3); + sf = fsf_coeff4 * std::sin(ftwo_pi * s3); + sf += fsf_coeff5 * std::sin(ffour_pi * s3); sf *= twoljsq; if (slabflag != 2) f[i][2] += lj * particle_ekz[i] - sf; @@ -2707,22 +2707,22 @@ void PPPMDispIntel::fieldforce_a_ad(IntelBuffers * /*buffers*/) const flt_t s1 = x[i][0] * hx_inv; const flt_t s2 = x[i][1] * hy_inv; const flt_t s3 = x[i][2] * hz_inv; - flt_t sf = fsf_coeff0 * sin(ftwo_pi * s1); - sf += fsf_coeff1 * sin(ffour_pi * s1); + flt_t sf = fsf_coeff0 * std::sin(ftwo_pi * s1); + sf += fsf_coeff1 * std::sin(ffour_pi * s1); sf *= 4*lj0*lj6 + 4*lj1*lj5 + 4*lj2*lj4 + 2*lj3*lj3; f[i][0] += lj0*particle_ekx0[i] + lj1*particle_ekx1[i] + lj2*particle_ekx2[i] + lj3*particle_ekx3[i] + lj4*particle_ekx4[i] + lj5*particle_ekx5[i] + lj6*particle_ekx6[i] - sf; - sf = fsf_coeff2 * sin(ftwo_pi * s2); - sf += fsf_coeff3 * sin(ffour_pi * s2); + sf = fsf_coeff2 * std::sin(ftwo_pi * s2); + sf += fsf_coeff3 * std::sin(ffour_pi * s2); sf *= 4*lj0*lj6 + 4*lj1*lj5 + 4*lj2*lj4 + 2*lj3*lj3; f[i][1] += lj0*particle_eky0[i] + lj1*particle_eky1[i] + lj2*particle_eky2[i] + lj3*particle_eky3[i] + lj4*particle_eky4[i] + lj5*particle_eky5[i] + lj6*particle_eky6[i] - sf; - sf = fsf_coeff4 * sin(ftwo_pi * s3); - sf += fsf_coeff5 * sin(ffour_pi * s3); + sf = fsf_coeff4 * std::sin(ftwo_pi * s3); + sf += fsf_coeff5 * std::sin(ffour_pi * s3); sf *= 4*lj0*lj6 + 4*lj1*lj5 + 4*lj2*lj4 + 2*lj3*lj3; if (slabflag != 2) f[i][2] += lj0*particle_ekz0[i] + lj1*particle_ekz1[i] + @@ -3106,14 +3106,14 @@ void PPPMDispIntel::fieldforce_none_ad(IntelBuffers * /*buffers*/) const flt_t s1 = x[i][0] * hx_inv; const flt_t s2 = x[i][1] * hy_inv; const flt_t s3 = x[i][2] * hz_inv; - flt_t sf1 = fsf_coeff0 * sin(ftwo_pi * s1); - sf1 += fsf_coeff1 * sin(ffour_pi * s1); + flt_t sf1 = fsf_coeff0 * std::sin(ftwo_pi * s1); + sf1 += fsf_coeff1 * std::sin(ffour_pi * s1); - flt_t sf2 = fsf_coeff2 * sin(ftwo_pi * s2); - sf2 += fsf_coeff3 * sin(ffour_pi * s2); + flt_t sf2 = fsf_coeff2 * std::sin(ftwo_pi * s2); + sf2 += fsf_coeff3 * std::sin(ffour_pi * s2); - flt_t sf3 = fsf_coeff4 * sin(ftwo_pi * s3); - sf3 += fsf_coeff5 * sin(ffour_pi * s3); + flt_t sf3 = fsf_coeff4 * std::sin(ftwo_pi * s3); + sf3 += fsf_coeff5 * std::sin(ffour_pi * s3); for (int k = 0; k < nsplit; k++) { const flt_t lj = B[nsplit*type + k]; const flt_t twoljsq = lj*lj * B[k] * 2; diff --git a/src/INTEL/pppm_intel.cpp b/src/INTEL/pppm_intel.cpp index 2ceca54d29..f67b3a89b3 100644 --- a/src/INTEL/pppm_intel.cpp +++ b/src/INTEL/pppm_intel.cpp @@ -953,18 +953,18 @@ void PPPMIntel::fieldforce_ad(IntelBuffers *buffers) const flt_t s1 = x[i].x * hx_inv; const flt_t s2 = x[i].y * hy_inv; const flt_t s3 = x[i].z * hz_inv; - flt_t sf = fsf_coeff0 * sin(ftwo_pi * s1); - sf += fsf_coeff1 * sin(ffour_pi * s1); + flt_t sf = fsf_coeff0 * std::sin(ftwo_pi * s1); + sf += fsf_coeff1 * std::sin(ffour_pi * s1); sf *= twoqsq; f[i].x += qfactor * particle_ekx[i] - fqqrd2es * sf; - sf = fsf_coeff2 * sin(ftwo_pi * s2); - sf += fsf_coeff3 * sin(ffour_pi * s2); + sf = fsf_coeff2 * std::sin(ftwo_pi * s2); + sf += fsf_coeff3 * std::sin(ffour_pi * s2); sf *= twoqsq; f[i].y += qfactor * particle_eky[i] - fqqrd2es * sf; - sf = fsf_coeff4 * sin(ftwo_pi * s3); - sf += fsf_coeff5 * sin(ffour_pi * s3); + sf = fsf_coeff4 * std::sin(ftwo_pi * s3); + sf += fsf_coeff5 * std::sin(ffour_pi * s3); sf *= twoqsq; if (slabflag != 2) f[i].z += qfactor * particle_ekz[i] - fqqrd2es * sf; From 0dab1910db6c6e8fb945567131f7da287f6b5e44 Mon Sep 17 00:00:00 2001 From: "W. Michael Brown" Date: Sat, 10 Jun 2023 13:34:16 -0700 Subject: [PATCH 234/396] Small updates to benchmark script in INTEL/TEST --- src/INTEL/TEST/run_benchmarks.sh | 25 +++++++++++-------------- 1 file changed, 11 insertions(+), 14 deletions(-) diff --git a/src/INTEL/TEST/run_benchmarks.sh b/src/INTEL/TEST/run_benchmarks.sh index 01ddfbebf3..82eb51c928 100755 --- a/src/INTEL/TEST/run_benchmarks.sh +++ b/src/INTEL/TEST/run_benchmarks.sh @@ -7,12 +7,10 @@ # --------------------- MPI Launch Command export MPI="mpirun" -#export MPI="numactl -p 1 mpirun" # -- Systems w/ MCDRAM in flat mode # ------------- Name and location of the LAMMPS binary export LMP_BIN=../../lmp_intel_cpu_intelmpi -#export LMP_BIN=../../lmp_knl # ------------- Directory containing the LAMMPS installation @@ -20,21 +18,18 @@ export LMP_ROOT=../../../ # ------------- Number of physical cores (not HW threads) -export LMP_CORES=36 # -- For Intel Xeon E5-2697v4 SKU -#export LMP_CORES=68 # -- For Intel Xeon Phi x200 7250 SKU +export LMP_CORES=36 +# Set automatically with lscpu +export LMP_CORES=`lscpu | awk '$1=="Core(s)"{t=NF; cores=$t}$1=="Socket(s):"{t=NF; sockets=$t}END{print cores*sockets}'` # ------------- Number of HW threads to use in tests -export LMP_THREAD_LIST="2" # -- For 2 threads per core w/ HT enabled -#export LMP_THREAD_LIST="2 4" # -- For 2 threads per core w/ HT enabled +export LMP_THREAD_LIST="1 2" # -- Also test 2 threads per core w/ HT enabled # ------------- MPI Tuning Parameters -#export I_MPI_SHM_LMT=shm # -- Uncomment for Xeon Phi x200 series - -# ------------- Library locations for build - -#source /opt/intel/parallel_studio_xe_2017.2.050/psxevars.sh +export I_MPI_FABRICS=shm +export I_MPI_PIN_DOMAIN=core ######################################################################### # End settings for your system @@ -50,8 +45,6 @@ export DATE_STRING=`date +%s` export LOG_DIR=$LOG_DIR_HOST"_"$LOG_DIR_HEADER"_"$DATE_STRING mkdir $LOG_DIR -export I_MPI_PIN_DOMAIN=core -#export I_MPI_FABRICS=shm export KMP_BLOCKTIME=0 echo -n "Creating restart file...." @@ -73,6 +66,9 @@ do export LOGFILE=$LOG_DIR/$workload"_lrt".$LMP_CORES"c"$threads"t".log cmd="$MPI -np $LMP_CORES $LMP_BIN -in in.intel.$workload -log $LOGFILE $RLMP_ARGS"; rthreads=$((threads-1)) + if [ $rthreads -lt 1 ]; then + rthreads=1 + fi export KMP_AFFINITY=none export OMP_NUM_THREADS=$rthreads echo " $cmd" >> $LOG_DIR/commands.info @@ -82,4 +78,5 @@ do done # Performance reported by LAMMPS (Timesteps/second ignoring warm-up run) -grep Perf $LOG_DIR/*.log | awk 'BEGIN{n=1}n%2==0{print $0}{n++}' | sed 's/\/day//g' | sed 's/steps\/s/steps_s/g' | sed 's/hours\/ns//g' | sed 's/.*\///g' | sed 's/\.log:Performance://g' | awk '{c=NF-1; print $1,$c}' +grep Perf $LOG_DIR/*.log | awk 'n%2==1{c=NF-3; print $1,$c}{n++}' | sed -e 's/.*\///g' -e 's/:.*://g' + From 62b388b48fd34e1d5e2bfbd4af221ad062f4847e Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Sat, 10 Jun 2023 19:23:11 -0400 Subject: [PATCH 235/396] consolidate LAMMPS data type constants and enums and use the same names --- examples/COUPLE/plugin/liblammpsplugin.h | 5 +++-- fortran/lammps.f90 | 3 ++- python/lammps/constants.py | 8 ++++++-- src/EXTRA-DUMP/dump_yaml.cpp | 6 +++--- src/NETCDF/dump_netcdf.cpp | 12 ++++++------ src/NETCDF/dump_netcdf_mpiio.cpp | 12 ++++++------ src/library.cpp | 6 +++--- src/library.h | 3 ++- src/lmptype.h | 25 ++++++++++++++++++------ tools/swig/lammps.i | 3 ++- unittest/utils/test_lmptype.cpp | 16 +++++++-------- 11 files changed, 60 insertions(+), 39 deletions(-) diff --git a/examples/COUPLE/plugin/liblammpsplugin.h b/examples/COUPLE/plugin/liblammpsplugin.h index 40fba6b9e3..1520ef638d 100644 --- a/examples/COUPLE/plugin/liblammpsplugin.h +++ b/examples/COUPLE/plugin/liblammpsplugin.h @@ -37,12 +37,13 @@ #endif /* The following enums must be kept in sync with the equivalent enums - * or constants in python/lammps/constants.py, fortran/lammps.f90, - * tools/swig/lammps.i, and examples/COUPLE/plugin/liblammpsplugin.h */ + * or constants in src/library.h, src/lmptype.h, python/lammps/constants.py, + * fortran/lammps.f90, and tools/swig/lammps.i */ /* Data type constants for extracting data from atoms, computes and fixes */ enum _LMP_DATATYPE_CONST { + LAMMPS_NONE = -1, /*!< no data type assigned (yet) */ LAMMPS_INT = 0, /*!< 32-bit integer (array) */ LAMMPS_INT_2D = 1, /*!< two-dimensional 32-bit integer array */ LAMMPS_DOUBLE = 2, /*!< 64-bit double (array) */ diff --git a/fortran/lammps.f90 b/fortran/lammps.f90 index f511e6bb60..669e9c700d 100644 --- a/fortran/lammps.f90 +++ b/fortran/lammps.f90 @@ -44,11 +44,12 @@ MODULE LIBLAMMPS ! Data type constants for extracting data from global, atom, compute, and fix ! ! Must be kept in sync with the equivalent declarations in - ! src/library.h, python/lammps/constants.py, tools/swig/lammps.i, + ! src/library.h, src/lmptype.h, python/lammps/constants.py, tools/swig/lammps.i, ! and examples/COUPLE/plugin/liblammpsplugin.h ! ! These are NOT part of the API (the part the user sees) INTEGER(c_int), PARAMETER :: & + LAMMPS_NONE = -1, & ! no data type assigned (yet) LAMMPS_INT = 0, & ! 32-bit integer (or array) LAMMPS_INT_2D = 1, & ! two-dimensional 32-bit integer array LAMMPS_DOUBLE = 2, & ! 64-bit double (or array) diff --git a/python/lammps/constants.py b/python/lammps/constants.py index 8fd6a9eaf5..1d0d8adb78 100644 --- a/python/lammps/constants.py +++ b/python/lammps/constants.py @@ -13,7 +13,13 @@ # various symbolic constants to be used # in certain calls to select data formats + +# these must be kept in sync with the enums in src/library.h, src/lmptype.h, +# tools/swig/lammps.i, examples/COUPLE/plugin/liblammpsplugin.h, +# and the constants in fortran/lammps.f90 + LAMMPS_AUTODETECT = None +LAMMPS_NONE = -1 LAMMPS_INT = 0 LAMMPS_INT_2D = 1 LAMMPS_DOUBLE = 2 @@ -22,8 +28,6 @@ LAMMPS_INT64 = 4 LAMMPS_INT64_2D = 5 LAMMPS_STRING = 6 -# these must be kept in sync with the enums in src/library.h, tools/swig/lammps.i, -# examples/COUPLE/plugin/liblammpsplugin.h, and the constants in fortran/lammps.f90 LMP_STYLE_GLOBAL = 0 LMP_STYLE_ATOM = 1 LMP_STYLE_LOCAL = 2 diff --git a/src/EXTRA-DUMP/dump_yaml.cpp b/src/EXTRA-DUMP/dump_yaml.cpp index 47cab1ee02..3ca5c59edf 100644 --- a/src/EXTRA-DUMP/dump_yaml.cpp +++ b/src/EXTRA-DUMP/dump_yaml.cpp @@ -71,11 +71,11 @@ void DumpYAML::write_header(bigint ndump) thermo_data += "]\n - data: [ "; for (int i = 0; i < nfield; ++i) { - if (fields[i].type == multitype::DOUBLE) + if (fields[i].type == multitype::LAMMPS_DOUBLE) thermo_data += fmt::format("{}, ", fields[i].data.d); - else if (fields[i].type == multitype::INT) + else if (fields[i].type == multitype::LAMMPS_INT) thermo_data += fmt::format("{}, ", fields[i].data.i); - else if (fields[i].type == multitype::BIGINT) + else if (fields[i].type == multitype::LAMMPS_INT64) thermo_data += fmt::format("{}, ", fields[i].data.b); else thermo_data += ", "; diff --git a/src/NETCDF/dump_netcdf.cpp b/src/NETCDF/dump_netcdf.cpp index 0115c0bbe9..a4699897a3 100644 --- a/src/NETCDF/dump_netcdf.cpp +++ b/src/NETCDF/dump_netcdf.cpp @@ -442,11 +442,11 @@ void DumpNetCDF::openfile() const int nfield = *th->get_nfield(); for (int i = 0; i < nfield; i++) { - if (fields[i].type == multitype::DOUBLE) { + if (fields[i].type == multitype::LAMMPS_DOUBLE) { NCERRX( nc_def_var(ncid, keywords[i].c_str(), type_nc_real, 1, dims, &thermovar[i]), keywords[i].c_str() ); - } else if (fields[i].type == multitype::INT) { + } else if (fields[i].type == multitype::LAMMPS_INT) { NCERRX( nc_def_var(ncid, keywords[i].c_str(), NC_INT, 1, dims, &thermovar[i]), keywords[i].c_str() ); - } else if (fields[i].type == multitype::BIGINT) { + } else if (fields[i].type == multitype::LAMMPS_INT64) { NCERRX( nc_def_var(ncid, keywords[i].c_str(), NC_INT64, 1, dims, &thermovar[i]), keywords[i].c_str() ); } } @@ -624,11 +624,11 @@ void DumpNetCDF::write() int nfield = *th->get_nfield(); for (int i = 0; i < nfield; i++) { if (filewriter) { - if (fields[i].type == multitype::DOUBLE) { + if (fields[i].type == multitype::LAMMPS_DOUBLE) { NCERRX( nc_put_var1_double(ncid, thermovar[i], start, &fields[i].data.d), keywords[i].c_str() ); - } else if (fields[i].type == multitype::INT) { + } else if (fields[i].type == multitype::LAMMPS_INT) { NCERRX( nc_put_var1_int(ncid, thermovar[i], start, &fields[i].data.i), keywords[i].c_str() ); - } else if (fields[i].type == multitype::BIGINT) { + } else if (fields[i].type == multitype::LAMMPS_INT64) { NCERRX( nc_put_var1_bigint(ncid, thermovar[i], start, &fields[i].data.b), keywords[i].c_str() ); } } diff --git a/src/NETCDF/dump_netcdf_mpiio.cpp b/src/NETCDF/dump_netcdf_mpiio.cpp index f9382dacef..2407678386 100644 --- a/src/NETCDF/dump_netcdf_mpiio.cpp +++ b/src/NETCDF/dump_netcdf_mpiio.cpp @@ -432,11 +432,11 @@ void DumpNetCDFMPIIO::openfile() const int nfield = *th->get_nfield(); for (int i = 0; i < nfield; i++) { - if (fields[i].type == multitype::DOUBLE) { + if (fields[i].type == multitype::LAMMPS_DOUBLE) { NCERRX( ncmpi_def_var(ncid, keywords[i].c_str(), type_nc_real, 1, dims, &thermovar[i]), keywords[i].c_str() ); - } else if (fields[i].type == multitype::INT) { + } else if (fields[i].type == multitype::LAMMPS_INT) { NCERRX( ncmpi_def_var(ncid, keywords[i].c_str(), NC_INT, 1, dims, &thermovar[i]), keywords[i].c_str() ); - } else if (fields[i].type == multitype::BIGINT) { + } else if (fields[i].type == multitype::LAMMPS_INT64) { NCERRX( ncmpi_def_var(ncid, keywords[i].c_str(), NC_INT64, 1, dims, &thermovar[i]), keywords[i].c_str() ); } } @@ -617,11 +617,11 @@ void DumpNetCDFMPIIO::write() int nfield = *th->get_nfield(); for (int i = 0; i < nfield; i++) { if (filewriter) { - if (fields[i].type == multitype::DOUBLE) { + if (fields[i].type == multitype::LAMMPS_DOUBLE) { NCERRX( ncmpi_put_var1_double(ncid, thermovar[i], start, &fields[i].data.d), keywords[i].c_str() ); - } else if (fields[i].type == multitype::INT) { + } else if (fields[i].type == multitype::LAMMPS_INT) { NCERRX( ncmpi_put_var1_int(ncid, thermovar[i], start, &fields[i].data.i), keywords[i].c_str() ); - } else if (fields[i].type == multitype::BIGINT) { + } else if (fields[i].type == multitype::LAMMPS_INT64) { NCERRX( ncmpi_put_var1_bigint(ncid, thermovar[i], start, &fields[i].data.b), keywords[i].c_str() ); } } diff --git a/src/library.cpp b/src/library.cpp index a94e385148..96af7cbf43 100644 --- a/src/library.cpp +++ b/src/library.cpp @@ -836,11 +836,11 @@ void *lammps_last_thermo(void *handle, const char *what, int index) } else if (strcmp(what, "data") == 0) { if ((index < 0) || (index >= nfield)) return nullptr; const auto &field = th->get_fields()[index]; - if (field.type == multitype::INT) { + if (field.type == multitype::LAMMPS_INT) { val = (void *) &field.data.i; - } else if (field.type == multitype::BIGINT) { + } else if (field.type == multitype::LAMMPS_INT64) { val = (void *) &field.data.b; - } else if (field.type == multitype::DOUBLE) { + } else if (field.type == multitype::LAMMPS_DOUBLE) { val = (void *) &field.data.d; } diff --git a/src/library.h b/src/library.h index 5f46e36ccf..30a12ebdef 100644 --- a/src/library.h +++ b/src/library.h @@ -41,10 +41,11 @@ /** Data type constants for extracting data from atoms, computes and fixes * * Must be kept in sync with the equivalent constants in ``python/lammps/constants.py``, - * ``fortran/lammps.f90``, ``tools/swig/lammps.i``, and + * ``fortran/lammps.f90``, ``tools/swig/lammps.i``, ``src/lmptype.h``, and *``examples/COUPLE/plugin/liblammpsplugin.h`` */ enum _LMP_DATATYPE_CONST { + LAMMPS_NONE = -1, /*!< no data type assigned (yet) */ LAMMPS_INT = 0, /*!< 32-bit integer (array) */ LAMMPS_INT_2D = 1, /*!< two-dimensional 32-bit integer array */ LAMMPS_DOUBLE = 2, /*!< 64-bit double (array) */ diff --git a/src/lmptype.h b/src/lmptype.h index e559bd9416..2089350f48 100644 --- a/src/lmptype.h +++ b/src/lmptype.h @@ -276,8 +276,21 @@ union ubuf { \endverbatim */ struct multitype { - // same values as LAMMPS_INT, LAMMPS_DOUBLE, and LAMMPS_INT64 in library.h - enum { NONE = -1, INT = 0, DOUBLE = 2, BIGINT = 4 }; + /** Data type constants for extracting data from atoms, computes and fixes + * + * This enum must be kept in sync with the corresponding enum or constants + * in ``python/lammps/constants.py``, ``fortran/lammps.f90``, ``tools/swig/lammps.i``, + * ``src/library.h``, and ``examples/COUPLE/plugin/liblammpsplugin.h`` */ + enum _LMP_DATATYPE_CONST { + LAMMPS_NONE = -1, /*!< no data type assigned (yet) */ + LAMMPS_INT = 0, /*!< 32-bit integer (array) */ + LAMMPS_INT_2D = 1, /*!< two-dimensional 32-bit integer array */ + LAMMPS_DOUBLE = 2, /*!< 64-bit double (array) */ + LAMMPS_DOUBLE_2D = 3, /*!< two-dimensional 64-bit double array */ + LAMMPS_INT64 = 4, /*!< 64-bit integer (array) */ + LAMMPS_INT64_2D = 5, /*!< two-dimensional 64-bit integer array */ + LAMMPS_STRING = 6 /*!< C-String */ + }; int type; union { @@ -286,26 +299,26 @@ struct multitype { int64_t b; } data; - multitype() : type(NONE) { data.d = 0.0; } + multitype() : type(LAMMPS_NONE) { data.d = 0.0; } multitype(const multitype &) = default; multitype(multitype &&) = default; ~multitype() = default; multitype &operator=(const double &_d) { - type = DOUBLE; + type = LAMMPS_DOUBLE; data.d = _d; return *this; } multitype &operator=(const int &_i) { - type = INT; + type = LAMMPS_INT; data.i = _i; return *this; } multitype &operator=(const int64_t &_b) { - type = BIGINT; + type = LAMMPS_INT64; data.b = _b; return *this; } diff --git a/tools/swig/lammps.i b/tools/swig/lammps.i index c4ef0a7109..91a6866107 100644 --- a/tools/swig/lammps.i +++ b/tools/swig/lammps.i @@ -28,9 +28,10 @@ * * Must be kept in sync with the equivalent constants in ``src/library.h``, * ``python/lammps/constants.py``, ``examples/COUPLE/plugin/liblammpsplugin.h``, - * and ``fortran/lammps.f90`` */ + * ``src/lmptype.h``, and ``fortran/lammps.f90`` */ enum _LMP_DATATYPE_CONST { + LAMMPS_NONE =-1, /*!< no data type assigned (yet) */ LAMMPS_INT = 0, /*!< 32-bit integer (array) */ LAMMPS_INT_2D = 1, /*!< two-dimensional 32-bit integer array */ LAMMPS_DOUBLE = 2, /*!< 64-bit double (array) */ diff --git a/unittest/utils/test_lmptype.cpp b/unittest/utils/test_lmptype.cpp index e5dc871953..383c9d4b2c 100644 --- a/unittest/utils/test_lmptype.cpp +++ b/unittest/utils/test_lmptype.cpp @@ -54,18 +54,18 @@ TEST(Types, multitype) m[4] = -1023; m[5] = -2.225; - EXPECT_EQ(m[0].type, multitype::BIGINT); - EXPECT_EQ(m[1].type, multitype::INT); - EXPECT_EQ(m[2].type, multitype::DOUBLE); + EXPECT_EQ(m[0].type, multitype::LAMMPS_INT64); + EXPECT_EQ(m[1].type, multitype::LAMMPS_INT); + EXPECT_EQ(m[2].type, multitype::LAMMPS_DOUBLE); #if defined(LAMMPS_SMALLSMALL) - EXPECT_EQ(m[3].type, multitype::INT); + EXPECT_EQ(m[3].type, multitype::LAMMPS_INT); #else - EXPECT_EQ(m[3].type, multitype::BIGINT); + EXPECT_EQ(m[3].type, multitype::LAMMPS_INT64); #endif - EXPECT_EQ(m[4].type, multitype::INT); - EXPECT_EQ(m[5].type, multitype::DOUBLE); - EXPECT_EQ(m[6].type, multitype::NONE); + EXPECT_EQ(m[4].type, multitype::LAMMPS_INT); + EXPECT_EQ(m[5].type, multitype::LAMMPS_DOUBLE); + EXPECT_EQ(m[6].type, multitype::LAMMPS_NONE); EXPECT_EQ(m[0].data.b, b1); EXPECT_EQ(m[1].data.i, i1); From 92e069b19deaf39ea79cadd36b5bce53c18e4988 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Sat, 10 Jun 2023 21:36:56 -0400 Subject: [PATCH 236/396] add fortran unit tests for lammps_last_thermo --- fortran/lammps.f90 | 8 +- unittest/fortran/test_fortran_get_thermo.f90 | 108 +++++++++++++++++++ unittest/fortran/wrap_get_thermo.cpp | 41 +++++++ 3 files changed, 154 insertions(+), 3 deletions(-) diff --git a/fortran/lammps.f90 b/fortran/lammps.f90 index 669e9c700d..ba3997ac8e 100644 --- a/fortran/lammps.f90 +++ b/fortran/lammps.f90 @@ -1127,11 +1127,13 @@ CONTAINS FUNCTION lmp_last_thermo(self,what,index) RESULT(thermo_data) CLASS(lammps), INTENT(IN), TARGET :: self CHARACTER(LEN=*), INTENT(IN) :: what - INTEGER(c_int) :: index + INTEGER :: index + INTEGER(c_int) :: idx TYPE(lammps_data) :: thermo_data, type_data INTEGER(c_int) :: datatype TYPE(c_ptr) :: Cname, Cptr + idx = index - 1 ! set data type for known cases SELECT CASE (what) CASE ('step') @@ -1148,7 +1150,7 @@ CONTAINS datatype = LAMMPS_STRING CASE ('data') Cname = f2c_string('type') - Cptr = lammps_last_thermo(self%handle,Cname,index-1) + Cptr = lammps_last_thermo(self%handle,Cname,idx) type_data%lammps_instance => self type_data%datatype = DATA_INT CALL C_F_POINTER(Cptr, type_data%i32) @@ -1159,7 +1161,7 @@ CONTAINS END SELECT Cname = f2c_string(what) - Cptr = lammps_last_thermo(self%handle,Cname,index-1) + Cptr = lammps_last_thermo(self%handle,Cname,idx) CALL lammps_free(Cname) thermo_data%lammps_instance => self diff --git a/unittest/fortran/test_fortran_get_thermo.f90 b/unittest/fortran/test_fortran_get_thermo.f90 index 7911ab07d5..965e6d58f7 100644 --- a/unittest/fortran/test_fortran_get_thermo.f90 +++ b/unittest/fortran/test_fortran_get_thermo.f90 @@ -152,3 +152,111 @@ FUNCTION f_lammps_get_thermo_zhi() BIND(C) f_lammps_get_thermo_zhi = lmp%get_thermo('zhi') END FUNCTION f_lammps_get_thermo_zhi + +SUBROUTINE f_lammps_last_thermo_setup() BIND(C) + USE liblammps + USE keepstuff, ONLY : lmp, big_input, cont_input, pair_input + IMPLICIT NONE + + CALL lmp%commands_list(big_input) + CALL lmp%commands_list(cont_input) + CALL lmp%commands_list(pair_input) + CALL lmp%command('thermo 10') + CALL lmp%command('run 15 post no') +END SUBROUTINE f_lammps_last_thermo_setup + +FUNCTION f_lammps_last_thermo_step() BIND(C) + USE, INTRINSIC :: ISO_C_BINDING, ONLY: c_int, c_int64_t + USE liblammps + USE keepstuff, ONLY : lmp + IMPLICIT NONE + INTEGER(c_int) :: f_lammps_last_thermo_step + INTEGER :: size_bigint + INTEGER(c_int), POINTER :: ival + INTEGER(c_int64_t), POINTER :: bval + + size_bigint = lmp%extract_setting('bigint') + IF (size_bigint == 4) THEN + ival = lmp%last_thermo('step',1) + f_lammps_last_thermo_step = INT(ival) + ELSE + bval = lmp%last_thermo('step',1) + f_lammps_last_thermo_step = INT(bval) + END IF +END FUNCTION f_lammps_last_thermo_step + +FUNCTION f_lammps_last_thermo_num() BIND(C) + USE, INTRINSIC :: ISO_C_BINDING, ONLY: c_int + USE liblammps + USE keepstuff, ONLY : lmp + IMPLICIT NONE + INTEGER(c_int) :: f_lammps_last_thermo_num + INTEGER(c_int), POINTER :: ival + + ival = lmp%last_thermo('num',1) + f_lammps_last_thermo_num = ival +END FUNCTION f_lammps_last_thermo_num + +FUNCTION f_lammps_last_thermo_type(idx) BIND(C) + USE, INTRINSIC :: ISO_C_BINDING, ONLY: c_int + USE liblammps + USE keepstuff, ONLY : lmp + IMPLICIT NONE + INTEGER(c_int), VALUE :: idx + INTEGER(c_int) :: f_lammps_last_thermo_type + INTEGER(c_int), POINTER :: ival + + ival = lmp%last_thermo('type',idx) + f_lammps_last_thermo_type = ival +END FUNCTION f_lammps_last_thermo_type + +FUNCTION f_lammps_last_thermo_string(idx) BIND(C) + USE, INTRINSIC :: ISO_C_BINDING, ONLY: c_int, c_ptr, c_null_ptr + USE liblammps + USE keepstuff, ONLY : lmp, f2c_string + IMPLICIT NONE + INTEGER(c_int), VALUE :: idx + TYPE(c_ptr) :: f_lammps_last_thermo_string + CHARACTER(LEN=12) :: buffer + + buffer = lmp%last_thermo('keyword',idx) + IF (LEN_TRIM(buffer) > 0) THEN + f_lammps_last_thermo_string = f2c_string(buffer) + ELSE + f_lammps_last_thermo_string = c_null_ptr + END IF +END FUNCTION f_lammps_last_thermo_string + +FUNCTION f_lammps_last_thermo_int(idx) BIND(C) + USE, INTRINSIC :: ISO_C_BINDING, ONLY: c_int, c_int64_t + USE liblammps + USE keepstuff, ONLY : lmp + IMPLICIT NONE + INTEGER(c_int), VALUE :: idx + INTEGER(c_int), POINTER :: ival + INTEGER(c_int64_t), POINTER :: bval + INTEGER(c_int) :: f_lammps_last_thermo_int + INTEGER :: size_bigint + + size_bigint = lmp%extract_setting('bigint') + IF (size_bigint == 4) THEN + ival = lmp%last_thermo('data',idx) + f_lammps_last_thermo_int = INT(ival) + ELSE + bval = lmp%last_thermo('data',idx) + f_lammps_last_thermo_int = INT(bval) + END IF +END FUNCTION f_lammps_last_thermo_int + +FUNCTION f_lammps_last_thermo_double(idx) BIND(C) + USE, INTRINSIC :: ISO_C_BINDING, ONLY: c_int, c_double + USE liblammps + USE keepstuff, ONLY : lmp + IMPLICIT NONE + INTEGER(c_int), VALUE :: idx + REAL(c_double), POINTER :: dval + REAL(c_double) :: f_lammps_last_thermo_double + + dval = lmp%last_thermo('data',idx) + f_lammps_last_thermo_double = dval +END FUNCTION f_lammps_last_thermo_double diff --git a/unittest/fortran/wrap_get_thermo.cpp b/unittest/fortran/wrap_get_thermo.cpp index 71b51609eb..e18697ba9b 100644 --- a/unittest/fortran/wrap_get_thermo.cpp +++ b/unittest/fortran/wrap_get_thermo.cpp @@ -1,6 +1,7 @@ // unit tests for getting thermodynamic output from a LAMMPS instance through the Fortran wrapper #include "lammps.h" +#include "lmptype.h" #include #include @@ -23,8 +24,18 @@ double f_lammps_get_thermo_ylo(); double f_lammps_get_thermo_yhi(); double f_lammps_get_thermo_zlo(); double f_lammps_get_thermo_zhi(); + +void f_lammps_last_thermo_setup(); +int f_lammps_last_thermo_step(); +int f_lammps_last_thermo_num(); +int f_lammps_last_thermo_type(int); +const char *f_lammps_last_thermo_string(int); +int f_lammps_last_thermo_int(int); +double f_lammps_last_thermo_double(int); } +using LAMMPS_NS::multitype; + class LAMMPS_thermo : public ::testing::Test { protected: LAMMPS_NS::LAMMPS *lmp; @@ -65,3 +76,33 @@ TEST_F(LAMMPS_thermo, get_thermo) EXPECT_DOUBLE_EQ(f_lammps_get_thermo_zlo(), 0.0); EXPECT_DOUBLE_EQ(f_lammps_get_thermo_zhi(), 4.0); }; + +TEST_F(LAMMPS_thermo, last_thermo) +{ + EXPECT_EQ(f_lammps_last_thermo_step(), -1); + EXPECT_EQ(f_lammps_last_thermo_type(1), multitype::LAMMPS_NONE); + EXPECT_EQ(f_lammps_last_thermo_type(2), multitype::LAMMPS_NONE); + f_lammps_last_thermo_setup(); + EXPECT_EQ(f_lammps_last_thermo_step(), 15); + EXPECT_EQ(f_lammps_last_thermo_num(), 6); + EXPECT_STREQ(f_lammps_last_thermo_string(1), "Step"); + EXPECT_STREQ(f_lammps_last_thermo_string(2), "Temp"); + EXPECT_STREQ(f_lammps_last_thermo_string(3), "E_pair"); + EXPECT_STREQ(f_lammps_last_thermo_string(6), "Press"); +#if defined(LAMMPS_SMALLSMALL) + EXPECT_EQ(f_lammps_last_thermo_type(1), multitype::LAMMPS_INT); +#else + EXPECT_EQ(f_lammps_last_thermo_type(1), multitype::LAMMPS_INT64); +#endif + EXPECT_EQ(f_lammps_last_thermo_int(1), 15); + EXPECT_EQ(f_lammps_last_thermo_type(2), multitype::LAMMPS_DOUBLE); + EXPECT_EQ(f_lammps_last_thermo_type(3), multitype::LAMMPS_DOUBLE); + EXPECT_EQ(f_lammps_last_thermo_type(4), multitype::LAMMPS_DOUBLE); + EXPECT_EQ(f_lammps_last_thermo_type(5), multitype::LAMMPS_DOUBLE); + EXPECT_EQ(f_lammps_last_thermo_type(6), multitype::LAMMPS_DOUBLE); + EXPECT_DOUBLE_EQ(f_lammps_last_thermo_double(2), 0.0); + EXPECT_DOUBLE_EQ(f_lammps_last_thermo_double(3), -0.13713425198078993); + EXPECT_DOUBLE_EQ(f_lammps_last_thermo_double(4), 0.0); + EXPECT_DOUBLE_EQ(f_lammps_last_thermo_double(5), -0.13713425198078993); + EXPECT_DOUBLE_EQ(f_lammps_last_thermo_double(6), -0.022421073321023492); +}; From 23552d4b7a93f4a8a5982880173a076c4c15eb61 Mon Sep 17 00:00:00 2001 From: jrgissing Date: Sun, 11 Jun 2023 17:59:16 -0400 Subject: [PATCH 237/396] refactor to carry around extra per-reaction values --- src/REACTION/fix_bond_react.cpp | 79 ++++++++++++++++++--------------- src/REACTION/fix_bond_react.h | 2 + 2 files changed, 44 insertions(+), 37 deletions(-) diff --git a/src/REACTION/fix_bond_react.cpp b/src/REACTION/fix_bond_react.cpp index 784c163f70..4d2d4a0680 100644 --- a/src/REACTION/fix_bond_react.cpp +++ b/src/REACTION/fix_bond_react.cpp @@ -131,6 +131,7 @@ FixBondReact::FixBondReact(LAMMPS *lmp, int narg, char **arg) : global_freq = 1; extvector = 0; rxnID = 0; + cuff = 1; maxnconstraints = 0; narrhenius = 0; status = PROCEED; @@ -388,7 +389,10 @@ FixBondReact::FixBondReact(LAMMPS *lmp, int narg, char **arg) : if (iarg+2 > narg) error->all(FLERR,"Illegal fix bond/react command: " "'rescale_charges' has too few arguments"); if (strcmp(arg[iarg+1],"no") == 0) rescale_charges_flag[rxn] = 0; //default - else if (strcmp(arg[iarg+1],"yes") == 0) rescale_charges_flag[rxn] = 1; + else if (strcmp(arg[iarg+1],"yes") == 0) { + rescale_charges_flag[rxn] = 1; + cuff = 2; // index shift for extra values carried around by mega_gloves + } else error->one(FLERR,"Bond/react: Illegal option for 'rescale_charges' keyword"); iarg += 2; } else if (strcmp(arg[iarg],"molecule") == 0) { @@ -1282,9 +1286,9 @@ void FixBondReact::superimpose_algorithm() memory->create(restore_pt,MAXGUESS,4,"bond/react:restore_pt"); memory->create(pioneers,max_natoms,"bond/react:pioneers"); memory->create(restore,max_natoms,MAXGUESS*4,"bond/react:restore"); - memory->create(my_mega_glove,max_natoms+1,allnattempt,"bond/react:local_mega_glove"); + memory->create(my_mega_glove,max_natoms+cuff,allnattempt,"bond/react:my_mega_glove"); - for (int i = 0; i < max_natoms+1; i++) + for (int i = 0; i < max_natoms+cuff; i++) for (int j = 0; j < allnattempt; j++) my_mega_glove[i][j] = 0; @@ -1338,7 +1342,7 @@ void FixBondReact::superimpose_algorithm() status = ACCEPT; my_mega_glove[0][my_num_mega] = rxnID; for (int i = 0; i < onemol->natoms; i++) { - my_mega_glove[i+1][my_num_mega] = glove[i][1]; + my_mega_glove[i+cuff][my_num_mega] = glove[i][1]; } my_num_mega++; } @@ -1386,7 +1390,7 @@ void FixBondReact::superimpose_algorithm() else { my_mega_glove[0][my_num_mega] = rxnID; for (int i = 0; i < onemol->natoms; i++) { - my_mega_glove[i+1][my_num_mega] = glove[i][1]; + my_mega_glove[i+cuff][my_num_mega] = glove[i][1]; } my_num_mega++; } @@ -1405,10 +1409,10 @@ void FixBondReact::superimpose_algorithm() global_megasize = 0; - memory->create(local_mega_glove,max_natoms+1,my_num_mega,"bond/react:local_mega_glove"); - memory->create(ghostly_mega_glove,max_natoms+1,my_num_mega,"bond/react:ghostly_mega_glove"); + memory->create(local_mega_glove,max_natoms+cuff,my_num_mega,"bond/react:local_mega_glove"); + memory->create(ghostly_mega_glove,max_natoms+cuff,my_num_mega,"bond/react:ghostly_mega_glove"); - for (int i = 0; i < max_natoms+1; i++) { + for (int i = 0; i < max_natoms+cuff; i++) { for (int j = 0; j < my_num_mega; j++) { local_mega_glove[i][j] = 0; ghostly_mega_glove[i][j] = 0; @@ -2674,17 +2678,17 @@ void FixBondReact::dedup_mega_gloves(int dedup_mode) } tagint **dedup_glove; - memory->create(dedup_glove,max_natoms+1,dedup_size,"bond/react:dedup_glove"); + memory->create(dedup_glove,max_natoms+cuff,dedup_size,"bond/react:dedup_glove"); if (dedup_mode == LOCAL) { for (int i = 0; i < dedup_size; i++) { - for (int j = 0; j < max_natoms+1; j++) { + for (int j = 0; j < max_natoms+cuff; j++) { dedup_glove[j][i] = my_mega_glove[j][i]; } } } else if (dedup_mode == GLOBAL) { for (int i = 0; i < dedup_size; i++) { - for (int j = 0; j < max_natoms+1; j++) { + for (int j = 0; j < max_natoms+cuff; j++) { dedup_glove[j][i] = global_mega_glove[j][i]; } } @@ -2700,16 +2704,16 @@ void FixBondReact::dedup_mega_gloves(int dedup_mode) // let's randomly mix up our reaction instances first // then we can feel okay about ignoring ones we've already deleted (or accepted) // based off std::shuffle - int *temp_rxn = new int[max_natoms+1]; + int *temp_rxn = new int[max_natoms+cuff]; for (int i = dedup_size-1; i > 0; --i) { //dedup_size // choose random entry to swap current one with int k = floor(random[0]->uniform()*(i+1)); // swap entries - for (int j = 0; j < max_natoms+1; j++) + for (int j = 0; j < max_natoms+cuff; j++) temp_rxn[j] = dedup_glove[j][i]; - for (int j = 0; j < max_natoms+1; j++) { + for (int j = 0; j < max_natoms+cuff; j++) { dedup_glove[j][i] = dedup_glove[j][k]; dedup_glove[j][k] = temp_rxn[j]; } @@ -2721,13 +2725,13 @@ void FixBondReact::dedup_mega_gloves(int dedup_mode) int myrxnid1 = dedup_glove[0][i]; onemol = atom->molecules[unreacted_mol[myrxnid1]]; for (int j = 0; j < onemol->natoms; j++) { - int check1 = dedup_glove[j+1][i]; + int check1 = dedup_glove[j+cuff][i]; for (int ii = i + 1; ii < dedup_size; ii++) { if (dedup_mask[ii] == 0) { int myrxnid2 = dedup_glove[0][ii]; twomol = atom->molecules[unreacted_mol[myrxnid2]]; for (int jj = 0; jj < twomol->natoms; jj++) { - int check2 = dedup_glove[jj+1][ii]; + int check2 = dedup_glove[jj+cuff][ii]; if (check2 == check1) { dedup_mask[ii] = 1; break; @@ -2745,7 +2749,7 @@ void FixBondReact::dedup_mega_gloves(int dedup_mode) int my_new_megasize = 0; for (int i = 0; i < my_num_mega; i++) { if (dedup_mask[i] == 0) { - for (int j = 0; j < max_natoms+1; j++) { + for (int j = 0; j < max_natoms+cuff; j++) { my_mega_glove[j][my_new_megasize] = dedup_glove[j][i]; } my_new_megasize++; @@ -2761,7 +2765,7 @@ void FixBondReact::dedup_mega_gloves(int dedup_mode) for (int i = 0; i < global_megasize; i++) { if (dedup_mask[i] == 0) { ghostly_rxn_count[dedup_glove[0][i]]++; - for (int j = 0; j < max_natoms + 1; j++) { + for (int j = 0; j < max_natoms + cuff; j++) { global_mega_glove[j][new_global_megasize] = dedup_glove[j][i]; } new_global_megasize++; @@ -2839,7 +2843,7 @@ void FixBondReact::glove_ghostcheck() ghostly = 1; } else { for (int j = 0; j < onemol->natoms; j++) { - int ilocal = atom->map(my_mega_glove[j+1][i]); + int ilocal = atom->map(my_mega_glove[j+cuff][i]); if (ilocal >= atom->nlocal || localsendlist[ilocal] == 1) { ghostly = 1; break; @@ -2852,15 +2856,13 @@ void FixBondReact::glove_ghostcheck() #endif if (ghostly == 1) { - ghostly_mega_glove[0][ghostly_num_mega] = rxnID; - for (int j = 0; j < onemol->natoms+1; j++) { + for (int j = 0; j < onemol->natoms+cuff; j++) { ghostly_mega_glove[j][ghostly_num_mega] = my_mega_glove[j][i]; } ghostly_num_mega++; } else { - local_mega_glove[0][local_num_mega] = rxnID; local_rxn_count[rxnID]++; - for (int j = 0; j < onemol->natoms+1; j++) { + for (int j = 0; j < onemol->natoms+cuff; j++) { local_mega_glove[j][local_num_mega] = my_mega_glove[j][i]; } local_num_mega++; @@ -2899,8 +2901,8 @@ void FixBondReact::ghost_glovecast() } MPI_Allgather(&start, 1, MPI_INT, allstarts, 1, MPI_INT, world); MPI_Datatype columnunsized, column; - int sizes[2] = {max_natoms+1, global_megasize}; - int subsizes[2] = {max_natoms+1, 1}; + int sizes[2] = {max_natoms+cuff, global_megasize}; + int subsizes[2] = {max_natoms+cuff, 1}; int starts[2] = {0,0}; MPI_Type_create_subarray (2, sizes, subsizes, starts, MPI_ORDER_C, MPI_LMP_TAGINT, &columnunsized); @@ -2908,14 +2910,14 @@ void FixBondReact::ghost_glovecast() MPI_Type_commit(&column); memory->destroy(global_mega_glove); - memory->create(global_mega_glove,max_natoms+1,global_megasize,"bond/react:global_mega_glove"); + memory->create(global_mega_glove,max_natoms+cuff,global_megasize,"bond/react:global_mega_glove"); - for (int i = 0; i < max_natoms+1; i++) + for (int i = 0; i < max_natoms+cuff; i++) for (int j = 0; j < global_megasize; j++) global_mega_glove[i][j] = 0; if (ghostly_num_mega > 0) { - for (int i = 0; i < max_natoms+1; i++) { + for (int i = 0; i < max_natoms+cuff; i++) { for (int j = 0; j < ghostly_num_mega; j++) { global_mega_glove[i][j+start] = ghostly_mega_glove[i][j]; } @@ -3006,6 +3008,7 @@ void FixBondReact::update_everything() int update_num_mega; tagint **update_mega_glove; + // for now, keeping rxnID in update_mega_glove, but not rest of cuff memory->create(update_mega_glove,max_natoms+1,MAX(local_num_mega,global_megasize),"bond/react:update_mega_glove"); for (int pass = 0; pass < 2; pass++) { @@ -3030,8 +3033,9 @@ void FixBondReact::update_everything() } } - for (int j = 0; j < max_natoms+1; j++) - update_mega_glove[j][update_num_mega] = local_mega_glove[j][i]; + update_mega_glove[0][update_num_mega] = local_mega_glove[0][i]; + for (int j = 0; j < max_natoms; j++) + update_mega_glove[j+1][update_num_mega] = local_mega_glove[j+cuff][i]; update_num_mega++; } } else if (pass == 1) { @@ -3054,8 +3058,9 @@ void FixBondReact::update_everything() } } - for (int j = 0; j < max_natoms+1; j++) - update_mega_glove[j][update_num_mega] = global_mega_glove[j][i]; + update_mega_glove[0][update_num_mega] = global_mega_glove[0][i]; + for (int j = 0; j < max_natoms; j++) + update_mega_glove[j+1][update_num_mega] = global_mega_glove[j+cuff][i]; update_num_mega++; } } @@ -3692,7 +3697,7 @@ int FixBondReact::insert_atoms(tagint **my_mega_glove, int iupdate) n2superpose++; } - int ifit = atom->map(my_mega_glove[ibonding[rxnID]+1][iupdate]); // use this local ID to find fitting proc + int ifit = atom->map(my_mega_glove[ibonding[rxnID]+cuff][iupdate]); // use this local ID to find fitting proc Superpose3D superposer(n2superpose); int fitroot = 0; if (ifit >= 0 && ifit < atom->nlocal) { @@ -3713,12 +3718,12 @@ int FixBondReact::insert_atoms(tagint **my_mega_glove, int iupdate) if (!twomol->fragmentmask[modify_create_fragid[rxnID]][j]) continue; int ipre = equivalences[j][1][rxnID]-1; // equiv pre-reaction template index if (!create_atoms[j][rxnID] && !delete_atoms[ipre][rxnID]) { - if (atom->map(my_mega_glove[ipre+1][iupdate]) < 0) { + if (atom->map(my_mega_glove[ipre+cuff][iupdate]) < 0) { error->warning(FLERR," eligible atoms skipped for created-atoms fit on rank {}\n", comm->me); continue; } - iatom = atom->map(my_mega_glove[ipre+1][iupdate]); + iatom = atom->map(my_mega_glove[ipre+cuff][iupdate]); if (iref == -1) iref = iatom; iatom = domain->closest_image(iref,iatom); for (int k = 0; k < 3; k++) { @@ -3838,7 +3843,7 @@ int FixBondReact::insert_atoms(tagint **my_mega_glove, int iupdate) atom->tag[n] = maxtag_all + add_count; // locally update mega_glove - my_mega_glove[preID][iupdate] = atom->tag[n]; + my_mega_glove[preID+cuff-1][iupdate] = atom->tag[n]; if (atom->molecule_flag) { if (twomol->moleculeflag) { @@ -3866,7 +3871,7 @@ int FixBondReact::insert_atoms(tagint **my_mega_glove, int iupdate) } // globally update mega_glove and equivalences MPI_Allreduce(MPI_IN_PLACE,&root,1,MPI_INT,MPI_SUM,world); - MPI_Bcast(&my_mega_glove[preID][iupdate],1,MPI_LMP_TAGINT,root,world); + MPI_Bcast(&my_mega_glove[preID+cuff-1][iupdate],1,MPI_LMP_TAGINT,root,world); equivalences[m][0][rxnID] = m+1; equivalences[m][1][rxnID] = preID; reverse_equiv[preID-1][0][rxnID] = preID; diff --git a/src/REACTION/fix_bond_react.h b/src/REACTION/fix_bond_react.h index 66a5e4d6a0..5e7ffb733a 100644 --- a/src/REACTION/fix_bond_react.h +++ b/src/REACTION/fix_bond_react.h @@ -156,6 +156,8 @@ class FixBondReact : public Fix { int lcl_inst; // reaction instance tagint **glove; // 1st colmn: pre-reacted template, 2nd colmn: global IDs // for all mega_gloves: first row is the ID of bond/react + // 'cuff' leaves room for additional values carried around + int cuff; // default = 1, w/ rescale_charges_flag = 2 tagint **my_mega_glove; // local + ghostly reaction instances tagint **local_mega_glove; // consolidation of local reaction instances tagint **ghostly_mega_glove; // consolidation of nonlocal reaction instances From c214f654b6c5206fa40e7fcd96cf623c31ebfb00 Mon Sep 17 00:00:00 2001 From: jrgissing Date: Sun, 11 Jun 2023 19:27:58 -0400 Subject: [PATCH 238/396] update communicated rxn instances to doubles --- src/REACTION/fix_bond_react.cpp | 60 ++++++++++++++++++--------------- src/REACTION/fix_bond_react.h | 8 ++--- 2 files changed, 36 insertions(+), 32 deletions(-) diff --git a/src/REACTION/fix_bond_react.cpp b/src/REACTION/fix_bond_react.cpp index 4d2d4a0680..5a2f274d91 100644 --- a/src/REACTION/fix_bond_react.cpp +++ b/src/REACTION/fix_bond_react.cpp @@ -1340,9 +1340,9 @@ void FixBondReact::superimpose_algorithm() status = REJECT; } else { status = ACCEPT; - my_mega_glove[0][my_num_mega] = rxnID; + my_mega_glove[0][my_num_mega] = (double) rxnID; for (int i = 0; i < onemol->natoms; i++) { - my_mega_glove[i+cuff][my_num_mega] = glove[i][1]; + my_mega_glove[i+cuff][my_num_mega] = (double) glove[i][1]; } my_num_mega++; } @@ -1388,9 +1388,9 @@ void FixBondReact::superimpose_algorithm() if (fraction[rxnID] < 1.0 && random[rxnID]->uniform() >= fraction[rxnID]) status = REJECT; else { - my_mega_glove[0][my_num_mega] = rxnID; + my_mega_glove[0][my_num_mega] = (double) rxnID; for (int i = 0; i < onemol->natoms; i++) { - my_mega_glove[i+cuff][my_num_mega] = glove[i][1]; + my_mega_glove[i+cuff][my_num_mega] = (double) glove[i][1]; } my_num_mega++; } @@ -2677,7 +2677,7 @@ void FixBondReact::dedup_mega_gloves(int dedup_mode) dedup_size = global_megasize; } - tagint **dedup_glove; + double **dedup_glove; memory->create(dedup_glove,max_natoms+cuff,dedup_size,"bond/react:dedup_glove"); if (dedup_mode == LOCAL) { @@ -2704,7 +2704,7 @@ void FixBondReact::dedup_mega_gloves(int dedup_mode) // let's randomly mix up our reaction instances first // then we can feel okay about ignoring ones we've already deleted (or accepted) // based off std::shuffle - int *temp_rxn = new int[max_natoms+cuff]; + double *temp_rxn = new double[max_natoms+cuff]; for (int i = dedup_size-1; i > 0; --i) { //dedup_size // choose random entry to swap current one with int k = floor(random[0]->uniform()*(i+1)); @@ -2764,7 +2764,7 @@ void FixBondReact::dedup_mega_gloves(int dedup_mode) int new_global_megasize = 0; for (int i = 0; i < global_megasize; i++) { if (dedup_mask[i] == 0) { - ghostly_rxn_count[dedup_glove[0][i]]++; + ghostly_rxn_count[(int) dedup_glove[0][i]]++; for (int j = 0; j < max_natoms + cuff; j++) { global_mega_glove[j][new_global_megasize] = dedup_glove[j][i]; } @@ -2834,7 +2834,7 @@ void FixBondReact::glove_ghostcheck() local_rxn_count[i] = 0; for (int i = 0; i < my_num_mega; i++) { - rxnID = my_mega_glove[0][i]; + rxnID = (int) my_mega_glove[0][i]; onemol = atom->molecules[unreacted_mol[rxnID]]; int ghostly = 0; #if !defined(MPI_STUBS) @@ -2843,7 +2843,7 @@ void FixBondReact::glove_ghostcheck() ghostly = 1; } else { for (int j = 0; j < onemol->natoms; j++) { - int ilocal = atom->map(my_mega_glove[j+cuff][i]); + int ilocal = atom->map((tagint) my_mega_glove[j+cuff][i]); if (ilocal >= atom->nlocal || localsendlist[ilocal] == 1) { ghostly = 1; break; @@ -2905,8 +2905,8 @@ void FixBondReact::ghost_glovecast() int subsizes[2] = {max_natoms+cuff, 1}; int starts[2] = {0,0}; MPI_Type_create_subarray (2, sizes, subsizes, starts, MPI_ORDER_C, - MPI_LMP_TAGINT, &columnunsized); - MPI_Type_create_resized (columnunsized, 0, sizeof(tagint), &column); + MPI_DOUBLE, &columnunsized); + MPI_Type_create_resized (columnunsized, 0, sizeof(double), &column); MPI_Type_commit(&column); memory->destroy(global_mega_glove); @@ -3017,15 +3017,20 @@ void FixBondReact::update_everything() for (int i = 0; i < nreacts; i++) iskip[i] = 0; if (pass == 0) { for (int i = 0; i < local_num_mega; i++) { - rxnID = local_mega_glove[0][i]; + rxnID = (int) local_mega_glove[0][i]; // reactions already shuffled from dedup procedure, so can skip first N if (iskip[rxnID]++ < nlocalskips[rxnID]) continue; + // this will be overwritten if reaction skipped by create_atoms below + update_mega_glove[0][update_num_mega] = (tagint) local_mega_glove[0][i]; + for (int j = 0; j < max_natoms; j++) + update_mega_glove[j+1][update_num_mega] = (tagint) local_mega_glove[j+cuff][i]; + // atoms inserted here for serial MPI_STUBS build only if (create_atoms_flag[rxnID] == 1) { onemol = atom->molecules[unreacted_mol[rxnID]]; twomol = atom->molecules[reacted_mol[rxnID]]; - if (insert_atoms(local_mega_glove,i)) { + if (insert_atoms(update_mega_glove,update_num_mega)) { inserted_atoms_flag = 1; } else { // create aborted reaction_count_total[rxnID]--; @@ -3033,24 +3038,26 @@ void FixBondReact::update_everything() } } - update_mega_glove[0][update_num_mega] = local_mega_glove[0][i]; - for (int j = 0; j < max_natoms; j++) - update_mega_glove[j+1][update_num_mega] = local_mega_glove[j+cuff][i]; update_num_mega++; } } else if (pass == 1) { for (int i = 0; i < global_megasize; i++) { - rxnID = global_mega_glove[0][i]; + rxnID = (int) global_mega_glove[0][i]; // reactions already shuffled from dedup procedure, so can skip first N if (iskip[rxnID]++ < nghostlyskips[rxnID]) continue; + // this will be overwritten if reaction skipped by create_atoms below + update_mega_glove[0][update_num_mega] = (tagint) global_mega_glove[0][i]; + for (int j = 0; j < max_natoms; j++) + update_mega_glove[j+1][update_num_mega] = (tagint) global_mega_glove[j+cuff][i]; + // we can insert atoms here, now that reactions are finalized // can't do it any earlier, due to skipped reactions (max_rxn) // for MPI build, reactions that create atoms are always treated as 'global' if (create_atoms_flag[rxnID] == 1) { onemol = atom->molecules[unreacted_mol[rxnID]]; twomol = atom->molecules[reacted_mol[rxnID]]; - if (insert_atoms(global_mega_glove,i)) { + if (insert_atoms(update_mega_glove,update_num_mega)) { inserted_atoms_flag = 1; } else { // create aborted reaction_count_total[rxnID]--; @@ -3058,9 +3065,6 @@ void FixBondReact::update_everything() } } - update_mega_glove[0][update_num_mega] = global_mega_glove[0][i]; - for (int j = 0; j < max_natoms; j++) - update_mega_glove[j+1][update_num_mega] = global_mega_glove[j+cuff][i]; update_num_mega++; } } @@ -3648,7 +3652,7 @@ void FixBondReact::update_everything() insert created atoms ------------------------------------------------------------------------- */ -int FixBondReact::insert_atoms(tagint **my_mega_glove, int iupdate) +int FixBondReact::insert_atoms(tagint **my_update_mega_glove, int iupdate) { // inserting atoms based off fix_deposit->pre_exchange int flag; @@ -3697,14 +3701,14 @@ int FixBondReact::insert_atoms(tagint **my_mega_glove, int iupdate) n2superpose++; } - int ifit = atom->map(my_mega_glove[ibonding[rxnID]+cuff][iupdate]); // use this local ID to find fitting proc + int ifit = atom->map(my_update_mega_glove[ibonding[rxnID]+1][iupdate]); // use this local ID to find fitting proc Superpose3D superposer(n2superpose); int fitroot = 0; if (ifit >= 0 && ifit < atom->nlocal) { fitroot = comm->me; // get 'temperatere' averaged over site, used for created atoms' vels - t = get_temperature(my_mega_glove,1,iupdate); + t = get_temperature(my_update_mega_glove,1,iupdate); double **xfrozen; // coordinates for the "frozen" target molecule double **xmobile; // coordinates for the "mobile" molecule @@ -3718,12 +3722,12 @@ int FixBondReact::insert_atoms(tagint **my_mega_glove, int iupdate) if (!twomol->fragmentmask[modify_create_fragid[rxnID]][j]) continue; int ipre = equivalences[j][1][rxnID]-1; // equiv pre-reaction template index if (!create_atoms[j][rxnID] && !delete_atoms[ipre][rxnID]) { - if (atom->map(my_mega_glove[ipre+cuff][iupdate]) < 0) { + if (atom->map(my_update_mega_glove[ipre+1][iupdate]) < 0) { error->warning(FLERR," eligible atoms skipped for created-atoms fit on rank {}\n", comm->me); continue; } - iatom = atom->map(my_mega_glove[ipre+cuff][iupdate]); + iatom = atom->map(my_update_mega_glove[ipre+1][iupdate]); if (iref == -1) iref = iatom; iatom = domain->closest_image(iref,iatom); for (int k = 0; k < 3; k++) { @@ -3843,7 +3847,7 @@ int FixBondReact::insert_atoms(tagint **my_mega_glove, int iupdate) atom->tag[n] = maxtag_all + add_count; // locally update mega_glove - my_mega_glove[preID+cuff-1][iupdate] = atom->tag[n]; + my_update_mega_glove[preID][iupdate] = atom->tag[n]; if (atom->molecule_flag) { if (twomol->moleculeflag) { @@ -3871,7 +3875,7 @@ int FixBondReact::insert_atoms(tagint **my_mega_glove, int iupdate) } // globally update mega_glove and equivalences MPI_Allreduce(MPI_IN_PLACE,&root,1,MPI_INT,MPI_SUM,world); - MPI_Bcast(&my_mega_glove[preID+cuff-1][iupdate],1,MPI_LMP_TAGINT,root,world); + MPI_Bcast(&my_update_mega_glove[preID][iupdate],1,MPI_LMP_TAGINT,root,world); equivalences[m][0][rxnID] = m+1; equivalences[m][1][rxnID] = preID; reverse_equiv[preID-1][0][rxnID] = preID; diff --git a/src/REACTION/fix_bond_react.h b/src/REACTION/fix_bond_react.h index 5e7ffb733a..a028e4b5dc 100644 --- a/src/REACTION/fix_bond_react.h +++ b/src/REACTION/fix_bond_react.h @@ -158,10 +158,10 @@ class FixBondReact : public Fix { // for all mega_gloves: first row is the ID of bond/react // 'cuff' leaves room for additional values carried around int cuff; // default = 1, w/ rescale_charges_flag = 2 - tagint **my_mega_glove; // local + ghostly reaction instances - tagint **local_mega_glove; // consolidation of local reaction instances - tagint **ghostly_mega_glove; // consolidation of nonlocal reaction instances - tagint **global_mega_glove; // consolidation (inter-processor) of gloves + double **my_mega_glove; // local + ghostly reaction instances + double **local_mega_glove; // consolidation of local reaction instances + double **ghostly_mega_glove; // consolidation of nonlocal reaction instances + double **global_mega_glove; // consolidation (inter-processor) of gloves // containing nonlocal atoms int *localsendlist; // indicates ghosts of other procs From 68a73f1c339188beb831d62f9bd20712ea37e29b Mon Sep 17 00:00:00 2001 From: Richard Berger Date: Sun, 11 Jun 2023 17:46:58 -0600 Subject: [PATCH 239/396] library: return atom and force styles via extract_global --- src/library.cpp | 42 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) diff --git a/src/library.cpp b/src/library.cpp index a94e385148..4022a6ba7b 100644 --- a/src/library.cpp +++ b/src/library.cpp @@ -1340,6 +1340,13 @@ int lammps_extract_global_datatype(void * /*handle*/, const char *name) if (strcmp(name,"q_flag") == 0) return LAMMPS_INT; if (strcmp(name,"units") == 0) return LAMMPS_STRING; + if (strcmp(name,"atom_style") == 0) return LAMMPS_STRING; + if (strcmp(name,"pair_style") == 0) return LAMMPS_STRING; + if (strcmp(name,"bond_style") == 0) return LAMMPS_STRING; + if (strcmp(name,"angle_style") == 0) return LAMMPS_STRING; + if (strcmp(name,"dihedral_style") == 0) return LAMMPS_STRING; + if (strcmp(name,"improper_style") == 0) return LAMMPS_STRING; + if (strcmp(name,"kspace_style") == 0) return LAMMPS_STRING; if (strcmp(name,"boltz") == 0) return LAMMPS_DOUBLE; if (strcmp(name,"hplanck") == 0) return LAMMPS_DOUBLE; if (strcmp(name,"mvv2e") == 0) return LAMMPS_DOUBLE; @@ -1586,6 +1593,34 @@ report the "native" data type. The following tables are provided: - int - 1 - **deprecated**. Use :cpp:func:`lammps_extract_setting` instead. + * - atom_style + - char \* + - 1 + - string with the current atom style. + * - pair_style + - char \* + - 1 + - string with the current pair style. + * - bond_style + - char \* + - 1 + - string with the current bond style. + * - angle_style + - char \* + - 1 + - string with the current angle style. + * - dihedral_style + - char \* + - 1 + - string with the current dihedral style. + * - improper_style + - char \* + - 1 + - string with the current improper style. + * - kspace_style + - char \* + - 1 + - string with the current KSpace style. .. _extract_unit_settings: @@ -1692,6 +1727,13 @@ void *lammps_extract_global(void *handle, const char *name) auto lmp = (LAMMPS *) handle; if (strcmp(name,"units") == 0) return (void *) lmp->update->unit_style; + if (strcmp(name,"atom_style") == 0) return (void *) lmp->atom->atom_style; + if (strcmp(name,"pair_style") == 0) return (void *) lmp->force->pair_style; + if (strcmp(name,"bond_style") == 0) return (void *) lmp->force->bond_style; + if (strcmp(name,"angle_style") == 0) return (void *) lmp->force->angle_style; + if (strcmp(name,"dihedral_style") == 0) return (void *) lmp->force->dihedral_style; + if (strcmp(name,"improper_style") == 0) return (void *) lmp->force->improper_style; + if (strcmp(name,"kspace_style") == 0) return (void *) lmp->force->kspace_style; if (strcmp(name,"dt") == 0) return (void *) &lmp->update->dt; if (strcmp(name,"ntimestep") == 0) return (void *) &lmp->update->ntimestep; // update->atime can be referenced as a pointer From 82cea7a546aadd72079a74b87e8807f21df06731 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Mon, 12 Jun 2023 15:31:03 -0400 Subject: [PATCH 240/396] small doc updates for added pppm_table keyword --- doc/src/package.rst | 81 +++++++++++++++++++++++---------------------- 1 file changed, 42 insertions(+), 39 deletions(-) diff --git a/doc/src/package.rst b/doc/src/package.rst index ce45a1eb79..1988e78245 100644 --- a/doc/src/package.rst +++ b/doc/src/package.rst @@ -49,7 +49,7 @@ Syntax *intel* args = NPhi keyword value ... Nphi = # of co-processors per node zero or more keyword/value pairs may be appended - keywords = *mode* or *omp* or *lrt* or *balance* or *ghost* or *tpc* or *tptask* or *no_affinity* + keywords = *mode* or *omp* or *lrt* or *balance* or *ghost* or *tpc* or *tptask* or *pppm_table* or *no_affinity* *mode* value = *single* or *mixed* or *double* single = perform force calculations in single precision mixed = perform force calculations in mixed precision @@ -395,13 +395,13 @@ is identical to the default *verlet* style aside from supporting the LRT feature. This feature requires setting the pre-processor flag -DLMP_INTEL_USELRT in the makefile when compiling LAMMPS. -The *balance* keyword sets the fraction of :doc:`pair style ` work offloaded to the co-processor for split -values between 0.0 and 1.0 inclusive. While this fraction of work is -running on the co-processor, other calculations will run on the host, -including neighbor and pair calculations that are not offloaded, as -well as angle, bond, dihedral, kspace, and some MPI communications. -If *split* is set to -1, the fraction of work is dynamically adjusted -automatically throughout the run. This typically give performance +The *balance* keyword sets the fraction of :doc:`pair style ` work +offloaded to the co-processor for split values between 0.0 and 1.0 inclusive. +While this fraction of work is running on the co-processor, other calculations +will run on the host, including neighbor and pair calculations that are not +offloaded, as well as angle, bond, dihedral, kspace, and some MPI +communications. If *split* is set to -1, the fraction of work is dynamically +adjusted automatically throughout the run. This typically give performance within 5 to 10 percent of the optimal fixed fraction. The *ghost* keyword determines whether or not ghost atoms, i.e. atoms @@ -433,6 +433,11 @@ with 16 threads, for a total of 128. Note that the default settings for *tpc* and *tptask* are fine for most problems, regardless of how many MPI tasks you assign to a Phi. +The *pppm_table* keyword with the argument yes allows to use a +pre-computed table to efficiently spread the charge to the PPPM grid. +This feature is enabled by default but can be turned off using the +keyword with the argument *no*. + The *no_affinity* keyword will turn off automatic setting of core affinity for MPI tasks and OpenMP threads on the host when using offload to a co-processor. Affinity settings are used when possible @@ -702,39 +707,37 @@ Related commands Default """"""" -For the GPU package, the default is Ngpu = 0 and the option defaults -are neigh = yes, newton = off, binsize = 0.0, split = 1.0, gpuID = 0 -to Ngpu-1, tpa = 1, omp = 0, and platform=-1. These settings are made -automatically if the "-sf gpu" :doc:`command-line switch ` -is used. If it is not used, you must invoke the package gpu command -in your input script or via the "-pk gpu" :doc:`command-line switch `. +For the GPU package, the default is Ngpu = 0 and the option defaults are neigh += yes, newton = off, binsize = 0.0, split = 1.0, gpuID = 0 to Ngpu-1, tpa = 1, +omp = 0, and platform=-1. These settings are made automatically if the "-sf +gpu" :doc:`command-line switch ` is used. If it is not used, you +must invoke the package gpu command in your input script or via the "-pk gpu" +:doc:`command-line switch `. -For the INTEL package, the default is Nphi = 1 and the option -defaults are omp = 0, mode = mixed, lrt = no, balance = -1, tpc = 4, -tptask = 240, pppm_table = yes. The default ghost option is determined -by the pair style being used. This value is output to the screen in -the offload report at the end of each run. Note that all of these -settings, except "omp" and "mode", are ignored if LAMMPS was not built -with Xeon Phi co-processor support. These settings are made -automatically if the "-sf intel" :doc:`command-line switch ` -is used. If it is not used, you must invoke the package intel command -in your input script or via the "-pk intel" :doc:`command-line switch `. +For the INTEL package, the default is Nphi = 1 and the option defaults are omp += 0, mode = mixed, lrt = no, balance = -1, tpc = 4, tptask = 240, pppm_table = +yes. The default ghost option is determined by the pair style being used. +This value is output to the screen in the offload report at the end of each +run. Note that all of these settings, except "omp" and "mode", are ignored if +LAMMPS was not built with Xeon Phi co-processor support. These settings are +made automatically if the "-sf intel" :doc:`command-line switch ` +is used. If it is not used, you must invoke the package intel command in your +input script or via the "-pk intel" :doc:`command-line switch `. For the KOKKOS package, the option defaults for GPUs are neigh = full, -neigh/qeq = full, newton = off, binsize for GPUs = 2x LAMMPS default -value, comm = device, sort = device, neigh/transpose = off, gpu/aware = -on. When LAMMPS can safely detect that GPU-aware MPI is not available, -the default value of gpu/aware becomes "off". For CPUs or Xeon Phis, the -option defaults are neigh = half, neigh/qeq = half, newton = on, binsize -= 0.0, comm = no, and sort = no. The option neigh/thread = on when -there are 16K atoms or less on an MPI rank, otherwise it is "off". These -settings are made automatically by the required "-k on" -:doc:`command-line switch `. You can change them by using -the package kokkos command in your input script or via the :doc:`-pk +neigh/qeq = full, newton = off, binsize for GPUs = 2x LAMMPS default value, +comm = device, sort = device, neigh/transpose = off, gpu/aware = on. When +LAMMPS can safely detect that GPU-aware MPI is not available, the default value +of gpu/aware becomes "off". For CPUs or Xeon Phis, the option defaults are +neigh = half, neigh/qeq = half, newton = on, binsize = 0.0, comm = no, and sort += no. The option neigh/thread = on when there are 16K atoms or less on an MPI +rank, otherwise it is "off". These settings are made automatically by the +required "-k on" :doc:`command-line switch `. You can change them +by using the package kokkos command in your input script or via the :doc:`-pk kokkos command-line switch `. -For the OMP package, the default is Nthreads = 0 and the option -defaults are neigh = yes. These settings are made automatically if -the "-sf omp" :doc:`command-line switch ` is used. If it -is not used, you must invoke the package omp command in your input -script or via the "-pk omp" :doc:`command-line switch `. +For the OMP package, the default is Nthreads = 0 and the option defaults are +neigh = yes. These settings are made automatically if the "-sf omp" +:doc:`command-line switch ` is used. If it is not used, you must +invoke the package omp command in your input script or via the "-pk omp" +:doc:`command-line switch `. From 2ba83a4d8f3ef0451b9de2bcd2a1360b1b21a76a Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Mon, 12 Jun 2023 15:31:37 -0400 Subject: [PATCH 241/396] add versionadded keyword --- doc/src/package.rst | 2 ++ 1 file changed, 2 insertions(+) diff --git a/doc/src/package.rst b/doc/src/package.rst index 1988e78245..b0549ba7d9 100644 --- a/doc/src/package.rst +++ b/doc/src/package.rst @@ -433,6 +433,8 @@ with 16 threads, for a total of 128. Note that the default settings for *tpc* and *tptask* are fine for most problems, regardless of how many MPI tasks you assign to a Phi. +.. versionadded:: TBD + The *pppm_table* keyword with the argument yes allows to use a pre-computed table to efficiently spread the charge to the PPPM grid. This feature is enabled by default but can be turned off using the From 603e397919bc9bd5d7898436411229896a9faf8c Mon Sep 17 00:00:00 2001 From: jrgissing Date: Mon, 12 Jun 2023 20:20:45 -0400 Subject: [PATCH 242/396] get_totalcharge routine --- src/REACTION/fix_bond_react.cpp | 49 +++++++++++++++++++++++++++------ src/REACTION/fix_bond_react.h | 2 ++ 2 files changed, 42 insertions(+), 9 deletions(-) diff --git a/src/REACTION/fix_bond_react.cpp b/src/REACTION/fix_bond_react.cpp index 5a2f274d91..8e4202cad0 100644 --- a/src/REACTION/fix_bond_react.cpp +++ b/src/REACTION/fix_bond_react.cpp @@ -251,8 +251,9 @@ FixBondReact::FixBondReact(LAMMPS *lmp, int narg, char **arg) : memory->create(ghostly_rxn_count,nreacts,"bond/react:ghostly_rxn_count"); memory->create(reaction_count_total,nreacts,"bond/react:reaction_count_total"); + rescale_charges_anyflag = 0; for (int i = 0; i < nreacts; i++) { - fraction[i] = 1; + fraction[i] = 1.0; seed[i] = 12345; max_rxn[i] = INT_MAX; for (int j = 0; j < 3; j++) @@ -262,7 +263,7 @@ FixBondReact::FixBondReact(LAMMPS *lmp, int narg, char **arg) : rescale_charges_flag[i] = 0; create_atoms_flag[i] = 0; modify_create_fragid[i] = -1; - overlapsq[i] = 0; + overlapsq[i] = 0.0; molecule_keyword[i] = OFF; nconstraints[i] = 0; // set default limit duration to 60 timesteps @@ -390,7 +391,10 @@ FixBondReact::FixBondReact(LAMMPS *lmp, int narg, char **arg) : "'rescale_charges' has too few arguments"); if (strcmp(arg[iarg+1],"no") == 0) rescale_charges_flag[rxn] = 0; //default else if (strcmp(arg[iarg+1],"yes") == 0) { + if (!atom->q_flag) error->all(FLERR,"Illegal fix bond/react command: " + "cannot use 'rescale_charges' without atomic charges enabled"); rescale_charges_flag[rxn] = 1; + rescale_charges_anyflag = 1; cuff = 2; // index shift for extra values carried around by mega_gloves } else error->one(FLERR,"Bond/react: Illegal option for 'rescale_charges' keyword"); @@ -1290,7 +1294,7 @@ void FixBondReact::superimpose_algorithm() for (int i = 0; i < max_natoms+cuff; i++) for (int j = 0; j < allnattempt; j++) - my_mega_glove[i][j] = 0; + my_mega_glove[i][j] = 0.0; attempted_rxn = 1; @@ -1341,6 +1345,7 @@ void FixBondReact::superimpose_algorithm() } else { status = ACCEPT; my_mega_glove[0][my_num_mega] = (double) rxnID; + if (rescale_charges_flag[rxnID]) my_mega_glove[1][my_num_mega] = get_totalcharge(); for (int i = 0; i < onemol->natoms; i++) { my_mega_glove[i+cuff][my_num_mega] = (double) glove[i][1]; } @@ -1389,6 +1394,7 @@ void FixBondReact::superimpose_algorithm() random[rxnID]->uniform() >= fraction[rxnID]) status = REJECT; else { my_mega_glove[0][my_num_mega] = (double) rxnID; + if (rescale_charges_flag[rxnID]) my_mega_glove[1][my_num_mega] = get_totalcharge(); for (int i = 0; i < onemol->natoms; i++) { my_mega_glove[i+cuff][my_num_mega] = (double) glove[i][1]; } @@ -1414,8 +1420,8 @@ void FixBondReact::superimpose_algorithm() for (int i = 0; i < max_natoms+cuff; i++) { for (int j = 0; j < my_num_mega; j++) { - local_mega_glove[i][j] = 0; - ghostly_mega_glove[i][j] = 0; + local_mega_glove[i][j] = 0.0; + ghostly_mega_glove[i][j] = 0.0; } } @@ -2190,6 +2196,24 @@ double FixBondReact::get_temperature(tagint **myglove, int row_offset, int col) return t; } +/* ---------------------------------------------------------------------- +compute sum of partial charges in rxn site, for updated atoms +note: currently uses global rxnID and onemol variables +------------------------------------------------------------------------- */ + +double FixBondReact::get_totalcharge() +{ + int j,jj,ilocal; + double *q = atom->q; + double sim_total_charge = 0.0; + for (j = 0; j < onemol->natoms; j++) { + jj = equivalences[j][1][rxnID]-1; + if (custom_charges[jj][rxnID] == 1) + sim_total_charge += q[atom->map(glove[jj][1])]; + } + return sim_total_charge; +} + /* ---------------------------------------------------------------------- get per-atom variable names used by custom constraint ------------------------------------------------------------------------- */ @@ -3008,8 +3032,12 @@ void FixBondReact::update_everything() int update_num_mega; tagint **update_mega_glove; - // for now, keeping rxnID in update_mega_glove, but not rest of cuff - memory->create(update_mega_glove,max_natoms+1,MAX(local_num_mega,global_megasize),"bond/react:update_mega_glove"); + // for now, keeping rxnID in update_mega_glove, but not rest of cuff in update_mega_glove + int maxmega = MAX(local_num_mega,global_megasize); + memory->create(update_mega_glove,max_natoms+1,maxmega,"bond/react:update_mega_glove"); + + double *sim_total_charges; + if (rescale_charges_anyflag) memory->create(sim_total_charges,maxmega,"bond/react:sim_total_charges"); for (int pass = 0; pass < 2; pass++) { update_num_mega = 0; @@ -3038,6 +3066,7 @@ void FixBondReact::update_everything() } } + if (rescale_charges_flag[rxnID]) sim_total_charges[update_num_mega] = local_mega_glove[1][i]; update_num_mega++; } } else if (pass == 1) { @@ -3065,6 +3094,7 @@ void FixBondReact::update_everything() } } + if (rescale_charges_flag[rxnID]) sim_total_charges[update_num_mega] = global_mega_glove[1][i]; update_num_mega++; } } @@ -3112,8 +3142,6 @@ void FixBondReact::update_everything() int jj = equivalences[j][1][rxnID]-1; if (atom->map(update_mega_glove[jj+1][i]) >= 0 && atom->map(update_mega_glove[jj+1][i]) < nlocal) { - if (landlocked_atoms[j][rxnID] == 1) - type[atom->map(update_mega_glove[jj+1][i])] = twomol->type[j]; if (twomol->qflag && atom->q_flag && custom_charges[jj][rxnID] == 1) { double *q = atom->q; sim_total_charge += q[atom->map(update_mega_glove[jj+1][i])]; @@ -3122,6 +3150,7 @@ void FixBondReact::update_everything() } } } + printf("check1 %g %g\n",sim_total_charge,sim_total_charges[i]); } charge_rescale_addend = (sim_total_charge-mol_total_charge)/n_custom_charge; } @@ -3564,6 +3593,7 @@ void FixBondReact::update_everything() } memory->destroy(update_mega_glove); + if (rescale_charges_anyflag) memory->destroy(sim_total_charges); // delete atoms. taken from fix_evaporate. but don't think it needs to be in pre_exchange // loop in reverse order to avoid copying marked atoms @@ -3708,6 +3738,7 @@ int FixBondReact::insert_atoms(tagint **my_update_mega_glove, int iupdate) fitroot = comm->me; // get 'temperatere' averaged over site, used for created atoms' vels + // note: row_offset for my_update_mega_glove is unity, not 'cuff' t = get_temperature(my_update_mega_glove,1,iupdate); double **xfrozen; // coordinates for the "frozen" target molecule diff --git a/src/REACTION/fix_bond_react.h b/src/REACTION/fix_bond_react.h index a028e4b5dc..d8c6c45494 100644 --- a/src/REACTION/fix_bond_react.h +++ b/src/REACTION/fix_bond_react.h @@ -72,6 +72,7 @@ class FixBondReact : public Fix { int *stabilize_steps_flag; int *custom_charges_fragid; int *rescale_charges_flag; + int rescale_charges_anyflag; int *create_atoms_flag; int *modify_create_fragid; double *overlapsq; @@ -193,6 +194,7 @@ class FixBondReact : public Fix { int check_constraints(); void get_IDcoords(int, int, double *); double get_temperature(tagint **, int, int); + double get_totalcharge(); void customvarnames(); // get per-atom variables names used by custom constraint void get_customvars(); // evaluate local values for variables names used by custom constraint double custom_constraint(const std::string &); // evaulate expression for custom constraint From 53f90fff3de67475dfb98b31162343e0577fc4b7 Mon Sep 17 00:00:00 2001 From: jrgissing Date: Mon, 12 Jun 2023 21:28:51 -0400 Subject: [PATCH 243/396] final touch --- src/REACTION/fix_bond_react.cpp | 56 ++++++++++++++++----------------- src/REACTION/fix_bond_react.h | 5 +-- 2 files changed, 30 insertions(+), 31 deletions(-) diff --git a/src/REACTION/fix_bond_react.cpp b/src/REACTION/fix_bond_react.cpp index 8e4202cad0..8315fde557 100644 --- a/src/REACTION/fix_bond_react.cpp +++ b/src/REACTION/fix_bond_react.cpp @@ -393,11 +393,10 @@ FixBondReact::FixBondReact(LAMMPS *lmp, int narg, char **arg) : else if (strcmp(arg[iarg+1],"yes") == 0) { if (!atom->q_flag) error->all(FLERR,"Illegal fix bond/react command: " "cannot use 'rescale_charges' without atomic charges enabled"); - rescale_charges_flag[rxn] = 1; + rescale_charges_flag[rxn] = 1; // overloaded below to also indicate number of atoms to update rescale_charges_anyflag = 1; cuff = 2; // index shift for extra values carried around by mega_gloves - } - else error->one(FLERR,"Bond/react: Illegal option for 'rescale_charges' keyword"); + } else error->one(FLERR,"Bond/react: Illegal option for 'rescale_charges' keyword"); iarg += 2; } else if (strcmp(arg[iarg],"molecule") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal fix bond/react command: " @@ -450,8 +449,10 @@ FixBondReact::FixBondReact(LAMMPS *lmp, int narg, char **arg) : memory->create(delete_atoms,max_natoms,nreacts,"bond/react:delete_atoms"); memory->create(create_atoms,max_natoms,nreacts,"bond/react:create_atoms"); memory->create(chiral_atoms,max_natoms,6,nreacts,"bond/react:chiral_atoms"); + memory->create(mol_total_charge,nreacts,"bond/react:mol_total_charge"); for (int j = 0; j < nreacts; j++) { + mol_total_charge[j] = 0.0; for (int i = 0; i < max_natoms; i++) { edge[i][j] = 0; custom_charges[i][j] = 1; // update all partial charges by default @@ -491,6 +492,21 @@ FixBondReact::FixBondReact(LAMMPS *lmp, int narg, char **arg) : if (custom_charges_fragid[i] >= 0) CustomCharges(custom_charges_fragid[i],i); } + // charge rescaling values must be calculated after calling CustomCharges + for (int myrxn = 0; myrxn < nreacts; myrxn++) { + if (rescale_charges_flag[myrxn]) { + rescale_charges_flag[myrxn] = 0; // will now store number of updated atoms + twomol = atom->molecules[reacted_mol[myrxn]]; + for (int j = 0; j < twomol->natoms; j++) { + int jj = equivalences[j][1][myrxn]-1; + if (twomol->qflag && custom_charges[jj][myrxn] == 1) { + mol_total_charge[myrxn] += twomol->q[j]; + rescale_charges_flag[myrxn]++; + } + } + } + } + // get the names of per-atom variables needed by 'rxn' functions of custom constraint customvarnames(); @@ -613,6 +629,7 @@ FixBondReact::~FixBondReact() memory->destroy(delete_atoms); memory->destroy(create_atoms); memory->destroy(chiral_atoms); + memory->destroy(mol_total_charge); if (vvec != nullptr) memory->destroy(vvec); memory->destroy(rxn_name); @@ -3129,37 +3146,18 @@ void FixBondReact::update_everything() } } - // get charge rescale delta - double charge_rescale_addend = 0; - if (rescale_charges_flag[rxnID] == 1) { - double sim_total_charge = 0; - double mol_total_charge = 0; - int n_custom_charge = 0; - for (int i = 0; i < update_num_mega; i++) { - rxnID = update_mega_glove[0][i]; - twomol = atom->molecules[reacted_mol[rxnID]]; - for (int j = 0; j < twomol->natoms; j++) { - int jj = equivalences[j][1][rxnID]-1; - if (atom->map(update_mega_glove[jj+1][i]) >= 0 && - atom->map(update_mega_glove[jj+1][i]) < nlocal) { - if (twomol->qflag && atom->q_flag && custom_charges[jj][rxnID] == 1) { - double *q = atom->q; - sim_total_charge += q[atom->map(update_mega_glove[jj+1][i])]; - mol_total_charge += twomol->q[j]; - n_custom_charge++; - } - } - } - printf("check1 %g %g\n",sim_total_charge,sim_total_charges[i]); - } - charge_rescale_addend = (sim_total_charge-mol_total_charge)/n_custom_charge; - } - // update charges and types of landlocked atoms // also keep track of 'stabilization' groups here + int n_custom_charge; + double charge_rescale_addend; for (int i = 0; i < update_num_mega; i++) { + charge_rescale_addend = 0; rxnID = update_mega_glove[0][i]; twomol = atom->molecules[reacted_mol[rxnID]]; + if (rescale_charges_flag[rxnID]) { + n_custom_charge = rescale_charges_flag[rxnID]; + charge_rescale_addend = (sim_total_charges[i]-mol_total_charge[rxnID])/n_custom_charge; + } for (int j = 0; j < twomol->natoms; j++) { int jj = equivalences[j][1][rxnID]-1; int ilocal = atom->map(update_mega_glove[jj+1][i]); diff --git a/src/REACTION/fix_bond_react.h b/src/REACTION/fix_bond_react.h index d8c6c45494..534261e11d 100644 --- a/src/REACTION/fix_bond_react.h +++ b/src/REACTION/fix_bond_react.h @@ -71,8 +71,9 @@ class FixBondReact : public Fix { int **store_rxn_count; int *stabilize_steps_flag; int *custom_charges_fragid; - int *rescale_charges_flag; - int rescale_charges_anyflag; + int *rescale_charges_flag; // if nonzero, indicates number of atoms whose charges are updated + int rescale_charges_anyflag; // indicates if any reactions do charge rescaling + double *mol_total_charge; // sum of charges of post-reaction atoms whose charges are updated int *create_atoms_flag; int *modify_create_fragid; double *overlapsq; From 2f7c3bf959b8ebd11e9001b2e610f39acebbdc1b Mon Sep 17 00:00:00 2001 From: Richard Berger Date: Sun, 11 Jun 2023 18:02:11 -0600 Subject: [PATCH 244/396] pylammps: reduce dependency to info command output --- python/lammps/pylammps.py | 85 ++++++++++++++++----------------------- 1 file changed, 35 insertions(+), 50 deletions(-) diff --git a/python/lammps/pylammps.py b/python/lammps/pylammps.py index 72cfed53f0..d3c65f783c 100644 --- a/python/lammps/pylammps.py +++ b/python/lammps/pylammps.py @@ -707,66 +707,55 @@ class PyLammps(object): def _parse_info_system(self, output): system = {} + system['dimensions'] = self.lmp.extract_setting("dimension") + system['xlo'] = self.lmp.extract_global("boxxlo") + system['ylo'] = self.lmp.extract_global("boxylo") + system['zlo'] = self.lmp.extract_global("boxzlo") + system['xhi'] = self.lmp.extract_global("boxxhi") + system['yhi'] = self.lmp.extract_global("boxyhi") + system['zhi'] = self.lmp.extract_global("boxzhi") + xprd = system["xhi"] - system["xlo"] + yprd = system["yhi"] - system["ylo"] + zprd = system["zhi"] - system["zlo"] + if self.lmp.extract_setting("triclinic") == 1: + system['triclinic_box'] = (xprd, yprd, zprd) + else: + system['orthogonal_box'] = (xprd, yprd, zprd) + system['nangles'] = self.lmp.extract_global("nbonds") + system['nangletypes'] = self.lmp.extract_setting("nbondtypes") + system['angle_style'] = self.lmp.extract_global("angle_style") + system['nbonds'] = self.lmp.extract_global("nbonds") + system['nbondtypes'] = self.lmp.extract_setting("nbondtypes") + system['bond_style'] = self.lmp.extract_global("bond_style") + system['ndihedrals'] = self.lmp.extract_global("ndihedrals") + system['ndihedraltypes'] = self.lmp.extract_setting("ndihedraltypes") + system['dihedral_style'] = self.lmp.extract_global("dihedral_style") + system['nimpropers'] = self.lmp.extract_global("nimpropers") + system['nimpropertypes'] = self.lmp.extract_setting("nimpropertypes") + system['improper_style'] = self.lmp.extract_global("improper_style") + system['kspace_style'] = self.lmp.extract_global("kspace_style") + system['natoms'] = self.lmp.extract_global("natoms") + system['ntypes'] = self.lmp.extract_global("ntypes") + system['pair_style'] = self.lmp.extract_global("pair_style") + system['atom_style'] = self.lmp.extract_global("atom_style") + system['units'] = self.lmp.extract_global("units") for line in output: - if line.startswith("Units"): - system['units'] = self._get_pair(line)[1] - elif line.startswith("Atom style"): - system['atom_style'] = self._get_pair(line)[1] - elif line.startswith("Atom map"): + if line.startswith("Atom map"): system['atom_map'] = self._get_pair(line)[1] elif line.startswith("Atoms"): parts = self._split_values(line) - system['natoms'] = int(self._get_pair(parts[0])[1]) - system['ntypes'] = int(self._get_pair(parts[1])[1]) - system['style'] = self._get_pair(parts[2])[1] - elif line.startswith("Kspace style"): - system['kspace_style'] = self._get_pair(line)[1] - elif line.startswith("Dimensions"): - system['dimensions'] = int(self._get_pair(line)[1]) - elif line.startswith("Orthogonal box"): - system['orthogonal_box'] = [float(x) for x in self._get_pair(line)[1].split('x')] elif line.startswith("Boundaries"): system['boundaries'] = self._get_pair(line)[1] - elif line.startswith("xlo"): - keys, values = [self._split_values(x) for x in self._get_pair(line)] - for key, value in zip(keys, values): - system[key] = float(value) - elif line.startswith("ylo"): - keys, values = [self._split_values(x) for x in self._get_pair(line)] - for key, value in zip(keys, values): - system[key] = float(value) - elif line.startswith("zlo"): - keys, values = [self._split_values(x) for x in self._get_pair(line)] - for key, value in zip(keys, values): - system[key] = float(value) elif line.startswith("Molecule type"): system['molecule_type'] = self._get_pair(line)[1] - elif line.startswith("Bonds"): - parts = self._split_values(line) - system['nbonds'] = int(self._get_pair(parts[0])[1]) - system['nbondtypes'] = int(self._get_pair(parts[1])[1]) - system['bond_style'] = self._get_pair(parts[2])[1] - elif line.startswith("Angles"): - parts = self._split_values(line) - system['nangles'] = int(self._get_pair(parts[0])[1]) - system['nangletypes'] = int(self._get_pair(parts[1])[1]) - system['angle_style'] = self._get_pair(parts[2])[1] - elif line.startswith("Dihedrals"): - parts = self._split_values(line) - system['ndihedrals'] = int(self._get_pair(parts[0])[1]) - system['ndihedraltypes'] = int(self._get_pair(parts[1])[1]) - system['dihedral_style'] = self._get_pair(parts[2])[1] - elif line.startswith("Impropers"): - parts = self._split_values(line) - system['nimpropers'] = int(self._get_pair(parts[0])[1]) - system['nimpropertypes'] = int(self._get_pair(parts[1])[1]) - system['improper_style'] = self._get_pair(parts[2])[1] return system def _parse_info_communication(self, output): comm = {} + comm['nprocs'] = self.lmp.extract_setting("world_size") + comm['nthreads'] = self.lmp.extract_setting("nthreads") for line in output: if line.startswith("MPI library"): @@ -779,10 +768,6 @@ class PyLammps(object): comm['proc_grid'] = [int(x) for x in self._get_pair(line)[1].split('x')] elif line.startswith("Communicate velocities for ghost atoms"): comm['ghost_velocity'] = (self._get_pair(line)[1] == "yes") - elif line.startswith("Nprocs"): - parts = self._split_values(line) - comm['nprocs'] = int(self._get_pair(parts[0])[1]) - comm['nthreads'] = int(self._get_pair(parts[1])[1]) return comm def _parse_element_list(self, output): From d7ecf41ff6acba213e5c2c55725d873342739ad7 Mon Sep 17 00:00:00 2001 From: Richard Berger Date: Sun, 11 Jun 2023 23:11:28 -0600 Subject: [PATCH 245/396] pylammps: use library API for variable access --- python/lammps/pylammps.py | 48 +++++++++++++++++++++++++++------------ 1 file changed, 34 insertions(+), 14 deletions(-) diff --git a/python/lammps/pylammps.py b/python/lammps/pylammps.py index d3c65f783c..7acdff658a 100644 --- a/python/lammps/pylammps.py +++ b/python/lammps/pylammps.py @@ -28,6 +28,7 @@ import tempfile from collections import namedtuple from .core import lammps +from .constants import * # lgtm [py/polluting-import] # ------------------------------------------------------------------------- @@ -65,22 +66,43 @@ class OutputCapture(object): # ------------------------------------------------------------------------- class Variable(object): - def __init__(self, pylammps_instance, name, style, definition): + def __init__(self, pylammps_instance, name): self._pylmp = pylammps_instance self.name = name - self.style = style - self.definition = definition.split() + + @property + def style(self): + vartype = self._pylmp.lmp.lib.lammps_extract_variable_datatype(self._pylmp.lmp.lmp, self.name.encode()) + if vartype == LMP_VAR_EQUAL: + return "equal" + elif vartype == LMP_VAR_ATOM: + return "atom" + elif vartype == LMP_VAR_VECTOR: + return "vector" + elif vartype == LMP_VAR_STRING: + return "string" + return None @property def value(self): - if self.style == 'atom': - return list(self._pylmp.lmp.extract_variable(self.name, "all", 1)) + return self._pylmp.lmp.extract_variable(self.name) + + @value.setter + def value(self, newvalue): + style = self.style + if style == "equal" or style == "string": + self._pylmp.variable("{} {} {}".format(self.name, style, newvalue)) else: - value = self._pylmp.lmp_print('"${%s}"' % self.name).strip() - try: - return float(value) - except ValueError: - return value + raise Exception("Setter not implemented for {} style variables.".format(style)) + + def __str__(self): + value = self.value + if isinstance(value, str): + value = "\"{}\"".format(value) + return "Variable(name=\"{}\", value={})".format(self.name, value) + + def __repr__(self): + return self.__str__() # ------------------------------------------------------------------------- @@ -676,11 +698,9 @@ class PyLammps(object): :getter: Returns a dictionary of all variables that are defined in this LAMMPS instance :type: dict """ - output = self.lmp_info("variables") - output = output[output.index("Variable information:")+1:] variables = {} - for v in self._parse_element_list(output): - variables[v['name']] = Variable(self, v['name'], v['style'], v['def']) + for name in self.lmp.available_ids("variable"): + variables[name] = Variable(self, name) return variables def eval(self, expr): From 64508e08aac5d6c73c0511fab4903603cd6d8da0 Mon Sep 17 00:00:00 2001 From: Richard Berger Date: Sun, 11 Jun 2023 23:19:20 -0600 Subject: [PATCH 246/396] pylammps: use library API to return available groups --- python/lammps/pylammps.py | 14 +------------- 1 file changed, 1 insertion(+), 13 deletions(-) diff --git a/python/lammps/pylammps.py b/python/lammps/pylammps.py index 7acdff658a..bdbed3e971 100644 --- a/python/lammps/pylammps.py +++ b/python/lammps/pylammps.py @@ -686,9 +686,7 @@ class PyLammps(object): :getter: Returns a list of atom groups that are currently active in this LAMMPS instance :type: list """ - output = self.lmp_info("groups") - output = output[output.index("Group information:")+1:] - return self._parse_groups(output) + return self.lmp.available_ids("group") @property def variables(self): @@ -802,16 +800,6 @@ class PyLammps(object): elements.append(element) return elements - def _parse_groups(self, output): - groups = [] - group_pattern = re.compile(r"(?P.+) \((?P.+)\)") - - for line in output: - m = group_pattern.match(line.split(':')[1].strip()) - group = {'name': m.group('name'), 'type': m.group('type')} - groups.append(group) - return groups - def lmp_print(self, s): """ needed for Python2 compatibility, since print is a reserved keyword """ return self.__getattr__("print")(s) From f128de7dd0ef6cdd83297399910b287a87ab909b Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Tue, 13 Jun 2023 15:13:16 -0400 Subject: [PATCH 247/396] Bugfix from @ndtrung81 for indexing bug when tallying per-atom Coulomb energy --- lib/gpu/lal_answer.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/gpu/lal_answer.cpp b/lib/gpu/lal_answer.cpp index 1911be8431..fc8e2cfe7a 100644 --- a/lib/gpu/lal_answer.cpp +++ b/lib/gpu/lal_answer.cpp @@ -260,10 +260,10 @@ double AnswerT::energy_virial(double *eatom, double **vatom, ecoul+=ecv; if (_ef_atom) { if (_ilist==nullptr) { - for (int i=0; i<_ev_stride; i++) - eatom[i]+=engv[i]; - for (int i=_ev_stride; i Date: Tue, 13 Jun 2023 14:24:12 -0500 Subject: [PATCH 248/396] Rescaled EPSILON with a length scale (rounded radii) for contact detection --- src/BODY/fix_wall_body_polygon.cpp | 2 +- src/BODY/fix_wall_body_polyhedron.cpp | 2 +- src/BODY/pair_body_rounded_polygon.cpp | 22 +++++++++++++------- src/BODY/pair_body_rounded_polyhedron.cpp | 25 +++++++++++++++++------ 4 files changed, 36 insertions(+), 15 deletions(-) diff --git a/src/BODY/fix_wall_body_polygon.cpp b/src/BODY/fix_wall_body_polygon.cpp index 4d0517e527..6f0622cbf6 100644 --- a/src/BODY/fix_wall_body_polygon.cpp +++ b/src/BODY/fix_wall_body_polygon.cpp @@ -44,7 +44,7 @@ enum {FAR=0,XLO,XHI,YLO,YHI}; //#define _POLYGON_DEBUG #define DELTA 10000 -#define EPSILON 1e-2 +#define EPSILON 1e-2 // dimensionless threshold (dot products, end point checks, contact checks) #define BIG 1.0e20 #define MAX_CONTACTS 4 // maximum number of contacts for 2D models #define EFF_CONTACTS 2 // effective contacts for 2D models diff --git a/src/BODY/fix_wall_body_polyhedron.cpp b/src/BODY/fix_wall_body_polyhedron.cpp index 212830eb81..546ef1f0d4 100644 --- a/src/BODY/fix_wall_body_polyhedron.cpp +++ b/src/BODY/fix_wall_body_polyhedron.cpp @@ -42,7 +42,7 @@ enum {FAR=0,XLO,XHI,YLO,YHI,ZLO,ZHI}; //#define _POLYHEDRON_DEBUG #define DELTA 10000 -#define EPSILON 1e-2 +#define EPSILON 1e-3 // dimensionless threshold (dot products, end point checks) #define BIG 1.0e20 #define MAX_CONTACTS 4 // maximum number of contacts for 2D models #define EFF_CONTACTS 2 // effective contacts for 2D models diff --git a/src/BODY/pair_body_rounded_polygon.cpp b/src/BODY/pair_body_rounded_polygon.cpp index 0e83b63f99..24f38a6a0a 100644 --- a/src/BODY/pair_body_rounded_polygon.cpp +++ b/src/BODY/pair_body_rounded_polygon.cpp @@ -40,7 +40,7 @@ using namespace LAMMPS_NS; #define DELTA 10000 -#define EPSILON 1e-3 +#define EPSILON 1e-3 // dimensionless threshold (dot products, end point checks, contact checks) #define MAX_CONTACTS 4 // maximum number of contacts for 2D models #define EFF_CONTACTS 2 // effective contacts for 2D models @@ -624,7 +624,8 @@ void PairBodyRoundedPolygon::sphere_against_sphere(int i, int j, fy = dely*fpair/rij; fz = delz*fpair/rij; - if (R <= EPSILON) { // in contact + double rmin = MIN(rradi, rradj); + if (R <= EPSILON*rmin) { // in contact // relative translational velocity @@ -1019,6 +1020,7 @@ int PairBodyRoundedPolygon::compute_distance_to_vertex(int ibody, double xi1[3],xi2[3],u[3],v[3],uij[3]; double udotv, magv, magucostheta; double delx,dely,delz; + double rmin = MIN(rounded_radius, x0_rounded_radius); ifirst = dfirst[ibody]; iefirst = edfirst[ibody]; @@ -1105,17 +1107,17 @@ int PairBodyRoundedPolygon::compute_distance_to_vertex(int ibody, // x0 and xmi are on the different sides // t is the ratio to detect if x0 is closer to the vertices xi or xj - if (fabs(xi2[0] - xi1[0]) > EPSILON) + if (fabs(xi2[0] - xi1[0]) > EPSILON*rmin) t = (hi[0] - xi1[0]) / (xi2[0] - xi1[0]); - else if (fabs(xi2[1] - xi1[1]) > EPSILON) + else if (fabs(xi2[1] - xi1[1]) > EPSILON*rmin) t = (hi[1] - xi1[1]) / (xi2[1] - xi1[1]); - else if (fabs(xi2[2] - xi1[2]) > EPSILON) + else if (fabs(xi2[2] - xi1[2]) > EPSILON*rmin) t = (hi[2] - xi1[2]) / (xi2[2] - xi1[2]); double contact_dist = rounded_radius + x0_rounded_radius; if (t >= 0 && t <= 1) { mode = EDGE; - if (d < contact_dist + EPSILON) + if (d < contact_dist + EPSILON*rmin) contact = 1; } else { // t < 0 || t > 1: closer to either vertices of the edge @@ -1293,8 +1295,14 @@ double PairBodyRoundedPolygon::contact_separation(const Contact& c1, double x3 = c2.xv[0]; double y3 = c2.xv[1]; + int ibody = c1.ibody; + int jbody = c1.ibody; + double rradi = rounded_radius[ibody]; + double rradj = rounded_radius[jbody]; + double rmin = MIN(rradi, rradj); + double delta_a = 0.0; - if (fabs(x2 - x1) > EPSILON) { + if (fabs(x2 - x1) > EPSILON*rmin) { double A = (y2 - y1) / (x2 - x1); delta_a = fabs(y1 - A * x1 - y3 + A * x3) / sqrt(1 + A * A); } else { diff --git a/src/BODY/pair_body_rounded_polyhedron.cpp b/src/BODY/pair_body_rounded_polyhedron.cpp index 2c23199e33..d9a79abad0 100644 --- a/src/BODY/pair_body_rounded_polyhedron.cpp +++ b/src/BODY/pair_body_rounded_polyhedron.cpp @@ -44,7 +44,7 @@ using namespace LAMMPS_NS; using namespace MathConst; #define DELTA 10000 -#define EPSILON 1e-3 +#define EPSILON 1e-3 // dimensionless threshold (dot products, end point checks, contact checks) #define MAX_FACE_SIZE 4 // maximum number of vertices per face (same as BodyRoundedPolyhedron) #define MAX_CONTACTS 32 // for 3D models (including duplicated counts) @@ -1186,7 +1186,13 @@ int PairBodyRoundedPolyhedron::interaction_edge_to_edge(int ibody, // singularity case, ignore interactions - if (r < EPSILON) return interact; + double rmin = MIN(rounded_radius_i, rounded_radius_j); + if (r < EPSILON*rmin) { + #ifdef _POLYHEDRON_DEBUG + printf("ignore interaction: r = %0.16f\n", r); + #endif + return interact; + } // include the vertices for interactions @@ -1898,10 +1904,12 @@ void PairBodyRoundedPolyhedron::inside_polygon(int ibody, int face_index, { int i,n,ifirst,iffirst,npi1,npi2; - double xi1[3],xi2[3],u[3],v[3],costheta,anglesum1,anglesum2,magu,magv; + double xi1[3],xi2[3],u[3],v[3],costheta,anglesum1,anglesum2,magu,magv,rradi; ifirst = dfirst[ibody]; iffirst = facfirst[ibody]; + rradi = rounded_radius[ibody]; + double rradsq = rradi*rradi; anglesum1 = anglesum2 = 0;; for (i = 0; i < MAX_FACE_SIZE; i++) { npi1 = static_cast(face[iffirst+face_index][i]); @@ -1929,7 +1937,7 @@ void PairBodyRoundedPolyhedron::inside_polygon(int ibody, int face_index, // the point is at either vertices - if (magu * magv < EPSILON) inside1 = 1; + if (magu * magv < EPSILON*rradsq) inside1 = 1; else { costheta = MathExtra::dot3(u,v)/(magu*magv); anglesum1 += acos(costheta); @@ -1940,7 +1948,7 @@ void PairBodyRoundedPolyhedron::inside_polygon(int ibody, int face_index, MathExtra::sub3(xi2,q2,v); magu = MathExtra::len3(u); magv = MathExtra::len3(v); - if (magu * magv < EPSILON) inside2 = 1; + if (magu * magv < EPSILON*rradsq) inside2 = 1; else { costheta = MathExtra::dot3(u,v)/(magu*magv); anglesum2 += acos(costheta); @@ -2338,7 +2346,12 @@ void PairBodyRoundedPolyhedron::find_unique_contacts(Contact* contact_list, for (int j = i + 1; j < n; j++) { if (contact_list[i].unique == 0) continue; double d = contact_separation(contact_list[i], contact_list[j]); - if (d < EPSILON) contact_list[j].unique = 0; + int ibody = contact_list[i].ibody; + int jbody = contact_list[i].jbody; + double rradi = rounded_radius[ibody]; + double rradj = rounded_radius[jbody]; + double rmin = MIN(rradi, rradj); + if (d < EPSILON*rmin) contact_list[j].unique = 0; } } } From 14a27e98c9e9e2db7b1fc88ebe36a397a2825c05 Mon Sep 17 00:00:00 2001 From: jrgissing Date: Tue, 13 Jun 2023 21:09:29 -0400 Subject: [PATCH 249/396] fix for when deleting atoms --- src/REACTION/fix_bond_react.cpp | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/REACTION/fix_bond_react.cpp b/src/REACTION/fix_bond_react.cpp index 8315fde557..7e5da4a3ca 100644 --- a/src/REACTION/fix_bond_react.cpp +++ b/src/REACTION/fix_bond_react.cpp @@ -497,11 +497,13 @@ FixBondReact::FixBondReact(LAMMPS *lmp, int narg, char **arg) : if (rescale_charges_flag[myrxn]) { rescale_charges_flag[myrxn] = 0; // will now store number of updated atoms twomol = atom->molecules[reacted_mol[myrxn]]; - for (int j = 0; j < twomol->natoms; j++) { - int jj = equivalences[j][1][myrxn]-1; - if (twomol->qflag && custom_charges[jj][myrxn] == 1) { - mol_total_charge[myrxn] += twomol->q[j]; - rescale_charges_flag[myrxn]++; + if (twomol->qflag) { + for (int j = 0; j < twomol->natoms; j++) { + int jj = equivalences[j][1][myrxn]-1; + if (custom_charges[jj][myrxn] == 1 && delete_atoms[jj][myrxn] == 0) { + mol_total_charge[myrxn] += twomol->q[j]; + rescale_charges_flag[myrxn]++; + } } } } From 03b25dcbaaab70ac46cec5e323dd577cf84470a2 Mon Sep 17 00:00:00 2001 From: jrgissing Date: Tue, 13 Jun 2023 21:25:58 -0400 Subject: [PATCH 250/396] update error checks --- src/REACTION/fix_bond_react.cpp | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/src/REACTION/fix_bond_react.cpp b/src/REACTION/fix_bond_react.cpp index 7e5da4a3ca..83442ecb25 100644 --- a/src/REACTION/fix_bond_react.cpp +++ b/src/REACTION/fix_bond_react.cpp @@ -391,8 +391,11 @@ FixBondReact::FixBondReact(LAMMPS *lmp, int narg, char **arg) : "'rescale_charges' has too few arguments"); if (strcmp(arg[iarg+1],"no") == 0) rescale_charges_flag[rxn] = 0; //default else if (strcmp(arg[iarg+1],"yes") == 0) { - if (!atom->q_flag) error->all(FLERR,"Illegal fix bond/react command: " - "cannot use 'rescale_charges' without atomic charges enabled"); + if (!atom->q_flag) error->all(FLERR,"Illegal fix bond/react command: cannot use " + "'rescale_charges' without atomic charges enabled"); + twomol = atom->molecules[reacted_mol[rxn]]; + if (!twomol->qflag) error->all(FLERR,"Illegal fix bond/react command: cannot use " + "'rescale_charges' without Charges section in post-reaction template"); rescale_charges_flag[rxn] = 1; // overloaded below to also indicate number of atoms to update rescale_charges_anyflag = 1; cuff = 2; // index shift for extra values carried around by mega_gloves @@ -497,13 +500,11 @@ FixBondReact::FixBondReact(LAMMPS *lmp, int narg, char **arg) : if (rescale_charges_flag[myrxn]) { rescale_charges_flag[myrxn] = 0; // will now store number of updated atoms twomol = atom->molecules[reacted_mol[myrxn]]; - if (twomol->qflag) { - for (int j = 0; j < twomol->natoms; j++) { - int jj = equivalences[j][1][myrxn]-1; - if (custom_charges[jj][myrxn] == 1 && delete_atoms[jj][myrxn] == 0) { - mol_total_charge[myrxn] += twomol->q[j]; - rescale_charges_flag[myrxn]++; - } + for (int j = 0; j < twomol->natoms; j++) { + int jj = equivalences[j][1][myrxn]-1; + if (custom_charges[jj][myrxn] == 1 && delete_atoms[jj][myrxn] == 0) { + mol_total_charge[myrxn] += twomol->q[j]; + rescale_charges_flag[myrxn]++; } } } From 233fb67eaa7b6e82ec22a74886288660267567a3 Mon Sep 17 00:00:00 2001 From: Trung Nguyen Date: Wed, 14 Jun 2023 00:28:24 -0500 Subject: [PATCH 251/396] Reverted the zero net induced charge constraint, updated the fix polarize doc page for q_scaled and q --- doc/src/fix_polarize.rst | 15 +++++++++++++- src/DIELECTRIC/fix_polarize_bem_gmres.cpp | 24 ---------------------- src/DIELECTRIC/fix_polarize_bem_icc.cpp | 24 ---------------------- src/DIELECTRIC/fix_polarize_functional.cpp | 13 +----------- 4 files changed, 15 insertions(+), 61 deletions(-) diff --git a/doc/src/fix_polarize.rst b/doc/src/fix_polarize.rst index dd8a0c7d75..f35e34bc67 100644 --- a/doc/src/fix_polarize.rst +++ b/doc/src/fix_polarize.rst @@ -130,10 +130,23 @@ Fix *polarize/functional* employs the energy functional variation approach as described in :ref:`(Jadhao) ` to solve :math:`\sigma_b`. +The induced charges computed by these fixes are stored in the *q_scaled* field, +and can be accessed as in the following example: + +.. code-block:: LAMMPS + + compute qs all property/atom q_scaled + dump 1 all custom 1000 all.txt id type q x y z c_qs + +Note that the *q* field is the regular atom charges, which do not change +during the simulation. For interface particles, *q_scaled* is the sum +of the real charge, divided by the local dielectric constant *epsilon*, +and their induced charges. For non-interface particles, *q_scaled* is +the real charge, divided by the local dielectric constant *epsilon*. + More details on the implementation of these fixes and their recommended use are described in :ref:`(NguyenTD) `. - Restart, fix_modify, output, run start/stop, minimize info """""""""""""""""""""""""""""""""""""""""""""""""""""""""" diff --git a/src/DIELECTRIC/fix_polarize_bem_gmres.cpp b/src/DIELECTRIC/fix_polarize_bem_gmres.cpp index b11ac7e482..3945b76641 100644 --- a/src/DIELECTRIC/fix_polarize_bem_gmres.cpp +++ b/src/DIELECTRIC/fix_polarize_bem_gmres.cpp @@ -445,31 +445,7 @@ void FixPolarizeBEMGMRES::compute_induced_charges() comm->forward_comm(this); - // compute the total induced charges of the interface particles - // for interface particles: set the charge to be the sum of unscaled (free) charges and induced charges - - double tmp = 0; - for (int i = 0; i < nlocal; i++) { - if (!(mask[i] & groupbit)) continue; - - double q_bound = q_scaled[i] - q[i]; - tmp += q_bound; - q[i] = q_scaled[i]; - } - if (first) first = 0; - - // ensure sum of all induced charges being zero - - int ncount = group->count(igroup); - double sum = 0; - MPI_Allreduce(&tmp, &sum, 1, MPI_DOUBLE, MPI_SUM, world); - double qboundave = sum / (double) ncount; - - for (int i = 0; i < nlocal; i++) { - if (!(mask[i] & groupbit)) continue; - q[i] -= qboundave; - } } /* ---------------------------------------------------------------------- */ diff --git a/src/DIELECTRIC/fix_polarize_bem_icc.cpp b/src/DIELECTRIC/fix_polarize_bem_icc.cpp index 697d45f416..2b5664e4f5 100644 --- a/src/DIELECTRIC/fix_polarize_bem_icc.cpp +++ b/src/DIELECTRIC/fix_polarize_bem_icc.cpp @@ -361,30 +361,6 @@ void FixPolarizeBEMICC::compute_induced_charges() } iterations = itr; - - // compute the total induced charges of the interface particles - // for interface particles: set the charge to be the sum of unscaled (free) charges and induced charges - - double tmp = 0; - for (int i = 0; i < nlocal; i++) { - if (!(mask[i] & groupbit)) continue; - - double q_bound = q_scaled[i] - q[i]; - tmp += q_bound; - q[i] = q_scaled[i]; - } - - // ensure sum of all induced charges being zero - - int ncount = group->count(igroup); - double sum = 0; - MPI_Allreduce(&tmp, &sum, 1, MPI_DOUBLE, MPI_SUM, world); - double qboundave = sum / (double) ncount; - - for (int i = 0; i < nlocal; i++) { - if (!(mask[i] & groupbit)) continue; - q[i] -= qboundave; - } } /* ---------------------------------------------------------------------- */ diff --git a/src/DIELECTRIC/fix_polarize_functional.cpp b/src/DIELECTRIC/fix_polarize_functional.cpp index a0dc034818..ab039f9c48 100644 --- a/src/DIELECTRIC/fix_polarize_functional.cpp +++ b/src/DIELECTRIC/fix_polarize_functional.cpp @@ -386,18 +386,7 @@ void FixPolarizeFunctional::update_induced_charges() for (int i = 0; i < nlocal; i++) { if (induced_charge_idx[i] < 0) continue; int idx = induced_charge_idx[i]; - q[i] = -induced_charges[idx] / (4 * MY_PI); - q_scaled[i] = q[i] / epsilon[i]; - tmp += q_scaled[i]; - } - - double sum = 0; - MPI_Allreduce(&tmp, &sum, 1, MPI_DOUBLE, MPI_SUM, world); - double qboundave = sum/(double)num_induced_charges; - - for (int i = 0; i < nlocal; i++) { - if (induced_charge_idx[i] < 0) continue; - q_scaled[i] -= qboundave; + q_scaled[i] = -induced_charges[idx] / (4 * MY_PI); } // revert to scaled charges to calculate forces From 8984b89feb469b35acec18757f21fc30c202cfcf Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Wed, 14 Jun 2023 03:18:17 -0400 Subject: [PATCH 252/396] use consistent comments, apply clang-format --- src/REPLICA/fix_pimd_langevin.h | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/REPLICA/fix_pimd_langevin.h b/src/REPLICA/fix_pimd_langevin.h index dc48832855..d3b9d5b77e 100644 --- a/src/REPLICA/fix_pimd_langevin.h +++ b/src/REPLICA/fix_pimd_langevin.h @@ -41,7 +41,7 @@ class FixPIMDLangevin : public Fix { double compute_vector(int) override; protected: - /* System setting variables */ + // System setting variables int method; // PIMD or NMPIMD or CMD int fmmode; // physical or normal int np; // number of beads @@ -51,7 +51,7 @@ class FixPIMDLangevin : public Fix { double lj_epsilon, lj_sigma, lj_mass; // LJ unit energy, length, and mass scales double other_planck; double other_mvv2e; - double kt; // k_B * temp + double kt; // k_B * temp double beta, beta_np; // beta = 1./kBT beta_np = 1./kBT/np int thermostat; // NHC or PILE_L int barostat; // BZP @@ -62,15 +62,16 @@ class FixPIMDLangevin : public Fix { double masstotal; double fixedpoint[3]; // location of dilation fixed-point - /* ring-polymer model */ + + // ring-polymer model double omega_np, fbond, spring_energy, sp; - /* fictitious mass */ + // fictitious mass double fmass, *mass; - /* inter-partition communication */ + // inter-partition communication MPI_Comm rootworld; int me, nprocs, ireplica, nreplica, nprocs_universe; @@ -117,7 +118,8 @@ class FixPIMDLangevin : public Fix { int tstat_flag; // tstat_flat = 1 if thermostat if used void langevin_init(); void b_step(); // integrate for dt/2 according to B part (v <- v + f * dt/2) - void a_step(); // integrate for dt/2 according to A part (non-centroid mode, harmonic force between replicas) + void + a_step(); // integrate for dt/2 according to A part (non-centroid mode, harmonic force between replicas) void qc_step(); // integrate for dt/2 for the centroid mode (x <- x + v * dt/2) void o_step(); // integrate for dt according to O part (O-U process, for thermostating) From 6f69e5ae02a8cacead4f5b76d930d2d7a4d76593 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Wed, 14 Jun 2023 03:18:37 -0400 Subject: [PATCH 253/396] initialized all pointers to null in initializer list --- src/REPLICA/fix_pimd_langevin.cpp | 39 ++++++++++++------------------- 1 file changed, 15 insertions(+), 24 deletions(-) diff --git a/src/REPLICA/fix_pimd_langevin.cpp b/src/REPLICA/fix_pimd_langevin.cpp index 0af08b43b3..e4e60520d1 100644 --- a/src/REPLICA/fix_pimd_langevin.cpp +++ b/src/REPLICA/fix_pimd_langevin.cpp @@ -64,31 +64,23 @@ enum { SINGLE_PROC, MULTI_PROC }; /* ---------------------------------------------------------------------- */ FixPIMDLangevin::FixPIMDLangevin(LAMMPS *lmp, int narg, char **arg) : - Fix(lmp, narg, arg), random(nullptr), c_pe(nullptr), c_press(nullptr) + Fix(lmp, narg, arg), mass(nullptr), plansend(nullptr), planrecv(nullptr), tagsend(nullptr), + tagrecv(nullptr), bufsend(nullptr), bufrecv(nullptr), bufbeads(nullptr), bufsorted(nullptr), + bufsortedall(nullptr), outsorted(nullptr), buftransall(nullptr), bufsendall(nullptr), + bufrecvall(nullptr), tagsendall(nullptr), tagrecvall(nullptr), counts(nullptr), + displacements(nullptr), lam(nullptr), M_x2xp(nullptr), M_xp2x(nullptr), M_f2fp(nullptr), + M_fp2f(nullptr), modeindex(nullptr), tau_k(nullptr), c1_k(nullptr), c2_k(nullptr), + _omega_k(nullptr), Lan_s(nullptr), Lan_c(nullptr), , random(nullptr), xc(nullptr), + xcall(nullptr), x_unwrap(nullptr), id_pe(nullptr), id_press(nullptr), c_pe(nullptr), + c_press(nullptr) { restart_global = 1; time_integrate = 1; - tagsend = tagrecv = nullptr; - bufsend = bufrecv = nullptr; - bufsendall = bufrecvall = nullptr; - bufsorted = bufsortedall = nullptr; - outsorted = buftransall = nullptr; ntotal = 0; maxlocal = maxunwrap = maxxc = 0; - bufbeads = nullptr; - x_unwrap = xc = nullptr; - xcall = nullptr; - counts = nullptr; sizeplan = 0; - plansend = planrecv = nullptr; - - M_x2xp = M_xp2x = M_f2fp = M_fp2f = nullptr; - lam = nullptr; - modeindex = nullptr; - - mass = nullptr; method = NMPIMD; ensemble = NVT; @@ -97,6 +89,7 @@ FixPIMDLangevin::FixPIMDLangevin(LAMMPS *lmp, int narg, char **arg) : barostat = BZP; fmass = 1.0; np = universe->nworlds; + inverse_np = 1.0 / np; sp = 1.0; temp = 298.15; Lan_temp = 298.15; @@ -155,8 +148,8 @@ FixPIMDLangevin::FixPIMDLangevin(LAMMPS *lmp, int narg, char **arg) : pstat_flag = 1; } else error->universe_all(FLERR, - "Unknown ensemble parameter for fix pimd/langevin. Only nve, nvt, nph, and npt " - "ensembles are supported!"); + "Unknown ensemble parameter for fix pimd/langevin. Only nve, nvt, nph, " + "and npt ensembles are supported!"); } else if (strcmp(arg[i], "fmass") == 0) { fmass = utils::numeric(FLERR, arg[i + 1], false, lmp); if (fmass < 0.0 || fmass > np) @@ -170,10 +163,9 @@ FixPIMDLangevin::FixPIMDLangevin(LAMMPS *lmp, int narg, char **arg) : else if (strcmp(arg[i + 1], "normal") == 0) fmmode = NORMAL; else - error->universe_all( - FLERR, - "Unknown fictitious mass mode for fix pimd/langevin. Only physical mass and " - "normal mode mass are supported!"); + error->universe_all(FLERR, + "Unknown fictitious mass mode for fix pimd/langevin. Only physical " + "mass and normal mode mass are supported!"); } else if (strcmp(arg[i], "scale") == 0) { pilescale = utils::numeric(FLERR, arg[i + 1], false, lmp); if (pilescale < 0.0) @@ -409,7 +401,6 @@ void FixPIMDLangevin::init() // prepare the constants masstotal = group->mass(igroup); - inverse_np = 1.0 / np; double planck; if (strcmp(update->unit_style, "lj") == 0) { From 494341ba48df6284d86df1000d1517e828a584df Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Wed, 14 Jun 2023 03:39:52 -0400 Subject: [PATCH 254/396] error out when using barostat without pressure couple or vice versa --- src/REPLICA/fix_pimd_langevin.cpp | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/src/REPLICA/fix_pimd_langevin.cpp b/src/REPLICA/fix_pimd_langevin.cpp index e4e60520d1..58b9ec6726 100644 --- a/src/REPLICA/fix_pimd_langevin.cpp +++ b/src/REPLICA/fix_pimd_langevin.cpp @@ -56,11 +56,12 @@ enum { BAOAB, OBABO }; enum { ISO, ANISO, TRICLINIC }; enum { PILE_L }; enum { MTTK, BZP }; - -static std::map Barostats{{MTTK, "MTTK"}, {BZP, "BZP"}}; enum { NVE, NVT, NPH, NPT }; enum { SINGLE_PROC, MULTI_PROC }; +static std::map Barostats{{MTTK, "MTTK"}, {BZP, "BZP"}}; +static std::map Ensembles{{NVE, "NVE"}, {NVT, "NVT"}, {NPH, "NPH"}, {NPT, "NPT"}}; + /* ---------------------------------------------------------------------- */ FixPIMDLangevin::FixPIMDLangevin(LAMMPS *lmp, int narg, char **arg) : @@ -235,13 +236,20 @@ FixPIMDLangevin::FixPIMDLangevin(LAMMPS *lmp, int narg, char **arg) : } } + if (pstat_flag && !pdim) + error->universe_all( + FLERR, fmt::format("Must use pressure coupling with {} ensemble", Ensembles[ensemble])); + if (!pstat_flag && pdim) + error->universe_all( + FLERR, fmt::format("Must not use pressure coupling with {} ensemble", Ensembles[ensemble])); + /* Initiation */ global_freq = 1; vector_flag = 1; - if (!pstat_flag) + if (!pstat_flag) { size_vector = 10; - else if (pstat_flag) { + } else if (pstat_flag) { if (pstyle == ISO) { size_vector = 15; } else if (pstyle == ANISO) { @@ -250,7 +258,7 @@ FixPIMDLangevin::FixPIMDLangevin(LAMMPS *lmp, int narg, char **arg) : } extvector = 1; kt = force->boltz * temp; - if (pstat_flag) baro_init(); + if (pstat_flag) FixPIMDLangevin::baro_init(); // some initilizations From dfd384eeffa9e78df315a7b9a58070070a2754c0 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Wed, 14 Jun 2023 03:40:38 -0400 Subject: [PATCH 255/396] some more formatting and programming style improvements --- src/REPLICA/fix_pimd_langevin.cpp | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/src/REPLICA/fix_pimd_langevin.cpp b/src/REPLICA/fix_pimd_langevin.cpp index 58b9ec6726..75280fd3d5 100644 --- a/src/REPLICA/fix_pimd_langevin.cpp +++ b/src/REPLICA/fix_pimd_langevin.cpp @@ -67,13 +67,12 @@ static std::map Ensembles{{NVE, "NVE"}, {NVT, "NVT"}, {NPH, "N FixPIMDLangevin::FixPIMDLangevin(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg), mass(nullptr), plansend(nullptr), planrecv(nullptr), tagsend(nullptr), tagrecv(nullptr), bufsend(nullptr), bufrecv(nullptr), bufbeads(nullptr), bufsorted(nullptr), - bufsortedall(nullptr), outsorted(nullptr), buftransall(nullptr), bufsendall(nullptr), - bufrecvall(nullptr), tagsendall(nullptr), tagrecvall(nullptr), counts(nullptr), + bufsortedall(nullptr), outsorted(nullptr), buftransall(nullptr), tagsendall(nullptr), + tagrecvall(nullptr), bufsendall(nullptr), bufrecvall(nullptr), counts(nullptr), displacements(nullptr), lam(nullptr), M_x2xp(nullptr), M_xp2x(nullptr), M_f2fp(nullptr), M_fp2f(nullptr), modeindex(nullptr), tau_k(nullptr), c1_k(nullptr), c2_k(nullptr), - _omega_k(nullptr), Lan_s(nullptr), Lan_c(nullptr), , random(nullptr), xc(nullptr), - xcall(nullptr), x_unwrap(nullptr), id_pe(nullptr), id_press(nullptr), c_pe(nullptr), - c_press(nullptr) + _omega_k(nullptr), Lan_s(nullptr), Lan_c(nullptr), random(nullptr), xc(nullptr), xcall(nullptr), + x_unwrap(nullptr), id_pe(nullptr), id_press(nullptr), c_pe(nullptr), c_press(nullptr) { restart_global = 1; time_integrate = 1; @@ -126,10 +125,9 @@ FixPIMDLangevin::FixPIMDLangevin(LAMMPS *lmp, int narg, char **arg) : else if (strcmp(arg[i + 1], "baoab") == 0) integrator = BAOAB; else - error->universe_all( - FLERR, - "Unknown integrator parameter for fix pimd/langevin. Only obabo and baoab " - "integrators are supported!"); + error->universe_all(FLERR, + "Unknown integrator parameter for fix pimd/langevin. Only obabo and " + "baoab integrators are supported!"); } else if (strcmp(arg[i], "ensemble") == 0) { if (strcmp(arg[i + 1], "nve") == 0) { ensemble = NVE; @@ -273,7 +271,7 @@ FixPIMDLangevin::FixPIMDLangevin(LAMMPS *lmp, int narg, char **arg) : fixedpoint[0] = 0.5 * (domain->boxlo[0] + domain->boxhi[0]); fixedpoint[1] = 0.5 * (domain->boxlo[1] + domain->boxhi[1]); fixedpoint[2] = 0.5 * (domain->boxlo[2] + domain->boxhi[2]); - if (pstat_flag) { p_hydro = (p_target[0] + p_target[1] + p_target[2]) / pdim; } + if (pstat_flag) p_hydro = (p_target[0] + p_target[1] + p_target[2]) / pdim; // initialize Marsaglia RNG with processor-unique seed From 2afa07655f810bea8649a20f8fa998296c67446e Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Wed, 14 Jun 2023 03:44:11 -0400 Subject: [PATCH 256/396] set code owner for fix pimd/langevin --- .github/CODEOWNERS | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index 2686011281..f99a336dbb 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -67,6 +67,7 @@ src/EXTRA-COMPUTE/compute_born_matrix.* @Bibobu @athomps src/MISC/*_tracker.* @jtclemm src/MC/fix_gcmc.* @athomps src/MC/fix_sgcmc.* @athomps +src/REPLICA/fix_pimd_langevin.* @Yi-FanLi # core LAMMPS classes src/lammps.* @sjplimp From beabb4effec6bdf62cbd3d29fa01e0021280df6c Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Wed, 14 Jun 2023 03:48:59 -0400 Subject: [PATCH 257/396] remove dead code --- src/npair_skip_size_off2on_oneside.cpp | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/src/npair_skip_size_off2on_oneside.cpp b/src/npair_skip_size_off2on_oneside.cpp index eecf293755..3300ef1526 100644 --- a/src/npair_skip_size_off2on_oneside.cpp +++ b/src/npair_skip_size_off2on_oneside.cpp @@ -36,7 +36,7 @@ NPairSkipSizeOff2onOneside::NPairSkipSizeOff2onOneside(LAMMPS *lmp) : void NPairSkipSizeOff2onOneside::build(NeighList *list) { - int i,j,ii,jj,n,itype,jnum,joriginal,flip,tmp; + int i,j,ii,jj,itype,jnum,joriginal,flip,tmp; int *surf,*jlist; int *type = atom->type; @@ -76,8 +76,6 @@ void NPairSkipSizeOff2onOneside::build(NeighList *list) itype = type[i]; if (iskip[itype]) continue; - n = 0; - // loop over parent non-skip size list jlist = firstneigh_skip[i]; @@ -108,8 +106,7 @@ void NPairSkipSizeOff2onOneside::build(NeighList *list) for (i = 0; i < nlocal; i++) { if (numneigh[i] == 0) continue; - n = numneigh[i]; - firstneigh[i] = ipage->get(n); + firstneigh[i] = ipage->get(numneigh[i]); if (ipage->status()) error->one(FLERR,"Neighbor list overflow, boost neigh_modify one"); } From bc52d863b46876c85f67e76be572d9ce5df72e1d Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Wed, 14 Jun 2023 08:48:01 -0400 Subject: [PATCH 258/396] cosmetic --- src/MC/fix_gcmc.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/MC/fix_gcmc.cpp b/src/MC/fix_gcmc.cpp index 634b512936..5d1e318db2 100644 --- a/src/MC/fix_gcmc.cpp +++ b/src/MC/fix_gcmc.cpp @@ -2328,8 +2328,7 @@ double FixGCMC::energy_full() } if (overlaptest) break; } - MPI_Allreduce(&overlaptest, &overlaptestall, 1, - MPI_INT, MPI_MAX, world); + MPI_Allreduce(&overlaptest, &overlaptestall, 1, MPI_INT, MPI_MAX, world); if (overlaptestall) return MAXENERGYSIGNAL; } From 8aeb059ce867b279f1b30fe359475b6fc1b3b243 Mon Sep 17 00:00:00 2001 From: Lars Veldscholte Date: Wed, 14 Jun 2023 15:03:35 +0200 Subject: [PATCH 259/396] Update doc/src/compute_stress_cartesian.rst Co-authored-by: Axel Kohlmeyer --- doc/src/compute_stress_cartesian.rst | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/doc/src/compute_stress_cartesian.rst b/doc/src/compute_stress_cartesian.rst index f52b360aa6..b9f090ef58 100644 --- a/doc/src/compute_stress_cartesian.rst +++ b/doc/src/compute_stress_cartesian.rst @@ -41,6 +41,10 @@ split into a kinetic contribution :math:`P^k` and a virial contribution This compute obeys momentum balance through fluid interfaces. They use the Irving--Kirkwood contour, which is the straight line between particle pairs. +.. versionadded:: TBD + + Added support for bond styles + This compute only supports pair and bond (no angle, dihedral, improper, or kspace) forces. By default, if no extra keywords are specified, all supported contributions to the stress are included (ke, pair, bond). If any From e6cd79e0e928071fbff2617ac9fd172657acc5d3 Mon Sep 17 00:00:00 2001 From: Lars Veldscholte Date: Wed, 14 Jun 2023 15:04:35 +0200 Subject: [PATCH 260/396] Fix doc links --- doc/src/Commands_compute.rst | 6 +++--- doc/src/compute.rst | 6 +++--- doc/src/compute_stress_cartesian.rst | 6 +++--- doc/src/compute_stress_curvilinear.rst | 4 ++-- doc/src/compute_stress_mop.rst | 22 +++++++++++++++------- 5 files changed, 26 insertions(+), 18 deletions(-) diff --git a/doc/src/Commands_compute.rst b/doc/src/Commands_compute.rst index 755000c976..9066531459 100644 --- a/doc/src/Commands_compute.rst +++ b/doc/src/Commands_compute.rst @@ -153,11 +153,11 @@ KOKKOS, o = OPENMP, t = OPT. * :doc:`sph/t/atom ` * :doc:`spin ` * :doc:`stress/atom ` - * :doc:`stress/cartesian ` - * :doc:`stress/cylinder ` + * :doc:`stress/cartesian ` + * :doc:`stress/cylinder ` * :doc:`stress/mop ` * :doc:`stress/mop/profile ` - * :doc:`stress/spherical ` + * :doc:`stress/spherical ` * :doc:`stress/tally ` * :doc:`tdpd/cc/atom ` * :doc:`temp (k) ` diff --git a/doc/src/compute.rst b/doc/src/compute.rst index 950487cb72..4e5d8e6cb4 100644 --- a/doc/src/compute.rst +++ b/doc/src/compute.rst @@ -307,11 +307,11 @@ The individual style names on the :doc:`Commands compute ` pag * :doc:`sph/t/atom ` - per-atom internal temperature of Smooth-Particle Hydrodynamics atoms * :doc:`spin ` - magnetic quantities for a system of atoms having spins * :doc:`stress/atom ` - stress tensor for each atom -* :doc:`stress/cartesian ` - stress tensor in cartesian coordinates -* :doc:`stress/cylinder ` - stress tensor in cylindrical coordinates +* :doc:`stress/cartesian ` - stress tensor in cartesian coordinates +* :doc:`stress/cylinder ` - stress tensor in cylindrical coordinates * :doc:`stress/mop ` - normal components of the local stress tensor using the method of planes * :doc:`stress/mop/profile ` - profile of the normal components of the local stress tensor using the method of planes -* :doc:`stress/spherical ` - stress tensor in spherical coordinates +* :doc:`stress/spherical ` - stress tensor in spherical coordinates * :doc:`stress/tally ` - stress between two groups of atoms via the tally callback mechanism * :doc:`tdpd/cc/atom ` - per-atom chemical concentration of a specified species for each tDPD particle * :doc:`temp ` - temperature of group of atoms diff --git a/doc/src/compute_stress_cartesian.rst b/doc/src/compute_stress_cartesian.rst index b9f090ef58..3e1e9d9a8a 100644 --- a/doc/src/compute_stress_cartesian.rst +++ b/doc/src/compute_stress_cartesian.rst @@ -83,13 +83,13 @@ command, since those are contributions to the global system pressure. NOTE 2: The local stress profiles generated by these computes are similar to those obtained by the :doc:`method-of-planes (MOP) `. -A key difference -is that compute `stress/mop/profile ` +A key difference is that compute +:doc:`stress/mop/profile ` considers particles crossing a set of planes, while *stress/cartesian* computes averages for a set of small volumes. Moreover, this compute computes the diagonal components of the stress tensor :math:`P_{xx}`, :math:`P_{yy}`, and :math:`P_{zz}`, while -`stress/mop/profile ` computes the components +*stress/mop/profile* computes the components :math:`P_{ix}`, :math:`P_{iy}`, and :math:`P_{iz}`, where :math:`i` is the direction normal to the plane. diff --git a/doc/src/compute_stress_curvilinear.rst b/doc/src/compute_stress_curvilinear.rst index f7cbf5efbe..edd1df9217 100644 --- a/doc/src/compute_stress_curvilinear.rst +++ b/doc/src/compute_stress_curvilinear.rst @@ -115,8 +115,8 @@ package ` doc page for more info. Related commands """""""""""""""" -:doc:`compute stress/atom `, :doc:`compute pressure `, :doc:`compute -stress/mop/profile `, :doc:`compute stress/cartesian ` +:doc:`compute stress/atom `, :doc:`compute pressure `, +:doc:`compute stress/mop/profile `, :doc:`compute stress/cartesian ` Default """"""" diff --git a/doc/src/compute_stress_mop.rst b/doc/src/compute_stress_mop.rst index 4ad2261bb0..0b31805fbf 100644 --- a/doc/src/compute_stress_mop.rst +++ b/doc/src/compute_stress_mop.rst @@ -76,12 +76,16 @@ command, since those are contributions to the global system pressure. NOTE 3: The local stress profile generated by compute *stress/mop/profile* is similar to that obtained by compute -:doc:`stress/cartesian `. -A key difference is that compute *stress/mop/profile* considers particles -crossing a set of planes, while compute *stress/cartesian* computes averages -for a set of small volumes. More information -on the similarities and differences can be found in -:ref:`(Ikeshoji)`. +:doc:`stress/cartesian `. +A key difference is that compute *stress/mop/profile* +considers particles crossing a set of planes, while +*stress/cartesian* computes averages for a set +of small volumes. +Moreover, *stress/cartesian* compute computes the diagonal components of the stress +tensor :math:`P_{xx}`, :math:`P_{yy}`, and :math:`P_{zz}`, while +*stress/mop/profile* computes the components +:math:`P_{ix}`, :math:`P_{iy}`, and :math:`P_{iz}`, where :math:`i` is the +direction normal to the plane. Output info """"""""""" @@ -123,7 +127,11 @@ intra-molecular interactions, and long range (kspace) interactions. Related commands """""""""""""""" -:doc:`compute stress/atom `, :doc:`compute pressure `, :doc:`compute stress/cartesian `, :doc:`compute stress/cylinder `, :doc:`compute stress/spherical ` +:doc:`compute stress/atom `, +:doc:`compute pressure `, +:doc:`compute stress/cartesian `, +:doc:`compute stress/cylinder `, +:doc:`compute stress/spherical ` Default """"""" From 3b37c92b87df94a3087cbb038ec4bcc0d8328be0 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Wed, 14 Jun 2023 10:06:01 -0400 Subject: [PATCH 261/396] consistently print error when box has changed to triclinic without redefining kspace style --- src/INTEL/pppm_disp_intel.cpp | 15 ++++------- src/KOKKOS/pppm_kokkos.cpp | 6 ++++- src/KSPACE/pppm_disp.cpp | 47 +++++++++++++++++++---------------- 3 files changed, 35 insertions(+), 33 deletions(-) diff --git a/src/INTEL/pppm_disp_intel.cpp b/src/INTEL/pppm_disp_intel.cpp index fdff23fe5e..319d070e66 100644 --- a/src/INTEL/pppm_disp_intel.cpp +++ b/src/INTEL/pppm_disp_intel.cpp @@ -124,8 +124,7 @@ void PPPMDispIntel::init() _use_lrt = fix->lrt(); if (_use_lrt) - error->all(FLERR, - "LRT mode is currently not supported for pppm/disp/intel"); + error->all(FLERR, "LRT mode is currently not supported for pppm/disp/intel"); // For vectorization, we need some padding in the end @@ -142,19 +141,15 @@ void PPPMDispIntel::init() if (_use_table) { rho_points = 5000; memory->destroy(rho_lookup); - memory->create(rho_lookup, rho_points, INTEL_P3M_ALIGNED_MAXORDER, - "pppmdispintel:rho_lookup"); + memory->create(rho_lookup, rho_points, INTEL_P3M_ALIGNED_MAXORDER,"pppmdispintel:rho_lookup"); memory->destroy(rho6_lookup); - memory->create(rho6_lookup, rho_points, INTEL_P3M_ALIGNED_MAXORDER, - "pppmdispintel:rho6_lookup"); + memory->create(rho6_lookup, rho_points, INTEL_P3M_ALIGNED_MAXORDER,"pppmdispintel:rho6_lookup"); if (differentiation_flag == 1) { memory->destroy(drho_lookup); - memory->create(drho_lookup, rho_points, INTEL_P3M_ALIGNED_MAXORDER, - "pppmdispintel:drho_lookup"); + memory->create(drho_lookup, rho_points, INTEL_P3M_ALIGNED_MAXORDER,"pppmdispintel:drho_lookup"); memory->destroy(drho6_lookup); - memory->create(drho6_lookup, rho_points, INTEL_P3M_ALIGNED_MAXORDER, - "pppmdispintel:drho6_lookup"); + memory->create(drho6_lookup, rho_points, INTEL_P3M_ALIGNED_MAXORDER,"pppmdispintel:drho6_lookup"); } precompute_rho(); } diff --git a/src/KOKKOS/pppm_kokkos.cpp b/src/KOKKOS/pppm_kokkos.cpp index f76cab6f0f..912ae36f6f 100644 --- a/src/KOKKOS/pppm_kokkos.cpp +++ b/src/KOKKOS/pppm_kokkos.cpp @@ -138,7 +138,7 @@ PPPMKokkos::~PPPMKokkos() template void PPPMKokkos::init() { - if (me == 0) utils::logmesg(lmp,"PPPM initialization ...\n"); + if (me == 0) utils::logmesg(lmp,"PPPM Kokkos initialization ...\n"); // error check @@ -146,6 +146,10 @@ void PPPMKokkos::init() error->all(FLERR,"Cannot (yet) use PPPM Kokkos with 'kspace_modify diff ad'"); triclinic_check(); + + if (triclinic != domain->triclinic) + error->all(FLERR,"Must redefine kspace_style after changing to triclinic box"); + if (domain->triclinic && slabflag) error->all(FLERR,"Cannot (yet) use PPPM with triclinic box and slab correction"); if (domain->dimension == 2) diff --git a/src/KSPACE/pppm_disp.cpp b/src/KSPACE/pppm_disp.cpp index 84a21b46e6..ffa34a7e14 100644 --- a/src/KSPACE/pppm_disp.cpp +++ b/src/KSPACE/pppm_disp.cpp @@ -242,12 +242,12 @@ void PPPMDisp::settings(int narg, char **arg) PPPMDisp::~PPPMDisp() { - delete [] factors; - delete [] B; + delete[] factors; + delete[] B; B = nullptr; - delete [] cii; + delete[] cii; cii = nullptr; - delete [] csumi; + delete[] csumi; csumi = nullptr; PPPMDisp::deallocate(); PPPMDisp::deallocate_peratom(); @@ -268,6 +268,9 @@ void PPPMDisp::init() triclinic_check(); + if (triclinic != domain->triclinic) + error->all(FLERR,"Must redefine kspace_style after changing to triclinic box"); + if (domain->dimension == 2) error->all(FLERR,"Cannot use PPPMDisp with 2d simulation"); if (comm->style != Comm::BRICK) @@ -1277,7 +1280,7 @@ void PPPMDisp::init_coeffs() int n = atom->ntypes; int converged; - delete [] B; + delete[] B; B = nullptr; // no mixing rule or arithmetic @@ -3352,10 +3355,10 @@ void PPPMDisp::calc_csum() int ntypes = atom->ntypes; int i,j,k; - delete [] cii; + delete[] cii; cii = new double[ntypes+1]; for (i = 0; i<=ntypes; i++) cii[i] = 0.0; - delete [] csumi; + delete[] csumi; csumi = new double[ntypes+1]; for (i = 0; i<=ntypes; i++) csumi[i] = 0.0; int *neach = new int[ntypes+1]; @@ -3447,8 +3450,8 @@ void PPPMDisp::calc_csum() } } - delete [] neach; - delete [] neach_all; + delete[] neach; + delete[] neach_all; } /* ---------------------------------------------------------------------- @@ -6538,9 +6541,9 @@ void PPPMDisp::fieldforce_none_ik() } } - delete [] ekx; - delete [] eky; - delete [] ekz; + delete[] ekx; + delete[] eky; + delete[] ekz; } /* ---------------------------------------------------------------------- @@ -6660,9 +6663,9 @@ void PPPMDisp::fieldforce_none_ad() } } - delete [] ekx; - delete [] eky; - delete [] ekz; + delete[] ekx; + delete[] eky; + delete[] ekz; } /* ---------------------------------------------------------------------- @@ -6756,13 +6759,13 @@ void PPPMDisp::fieldforce_none_peratom() } } - delete [] u_pa; - delete [] v0; - delete [] v1; - delete [] v2; - delete [] v3; - delete [] v4; - delete [] v5; + delete[] u_pa; + delete[] v0; + delete[] v1; + delete[] v2; + delete[] v3; + delete[] v4; + delete[] v5; } /* ---------------------------------------------------------------------- From 0314c9892cee6410349f7ae147b669384e1de937 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Wed, 14 Jun 2023 10:26:38 -0400 Subject: [PATCH 262/396] silence compiler warnings --- .../fortran/test_fortran_gather_scatter.f90 | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/unittest/fortran/test_fortran_gather_scatter.f90 b/unittest/fortran/test_fortran_gather_scatter.f90 index 1f8d4f0905..8741bba485 100644 --- a/unittest/fortran/test_fortran_gather_scatter.f90 +++ b/unittest/fortran/test_fortran_gather_scatter.f90 @@ -207,7 +207,7 @@ END SUBROUTINE f_lammps_scatter_atoms_subset_mask SUBROUTINE f_lammps_setup_gather_topology() BIND(C) USE LIBLAMMPS - USE keepstuff, ONLY : lmp, cont_input, more_input, pair_input + USE keepstuff, ONLY : lmp IMPLICIT NONE CALL lmp%command('include ${input_dir}/in.fourmol') @@ -232,7 +232,7 @@ FUNCTION f_lammps_test_gather_bonds_small() BIND(C) RESULT(count) nbonds = nbonds_small ELSE nbonds_big = lmp%extract_global('nbonds') - nbonds = nbonds_big + nbonds = INT(nbonds_big) END IF CALL lmp%gather_bonds(bonds) @@ -280,7 +280,7 @@ FUNCTION f_lammps_test_gather_bonds_big() BIND(C) RESULT(count) INTEGER(c_int64_t), POINTER :: nbonds_big nbonds_big = lmp%extract_global('nbonds') - nbonds = nbonds_big + nbonds = INT(nbonds_big) CALL lmp%gather_bonds(bonds) bonds_array(1:3,1:SIZE(bonds)/3) => bonds count = 0 @@ -332,7 +332,7 @@ FUNCTION f_lammps_test_gather_angles_small() BIND(C) RESULT(count) nangles = nangles_small ELSE nangles_big = lmp%extract_global('nangles') - nangles = nangles_big + nangles = INT(nangles_big) END IF CALL lmp%gather_angles(angles) @@ -380,7 +380,7 @@ FUNCTION f_lammps_test_gather_angles_big() BIND(C) RESULT(count) INTEGER(c_int64_t), POINTER :: nangles_big nangles_big = lmp%extract_global('nangles') - nangles = nangles_big + nangles = INT(nangles_big) CALL lmp%gather_angles(angles) angles_array(1:4,1:SIZE(angles)/4) => angles count = 0 @@ -432,7 +432,7 @@ FUNCTION f_lammps_test_gather_dihedrals_small() BIND(C) RESULT(count) ndihedrals = ndihedrals_small ELSE ndihedrals_big = lmp%extract_global('ndihedrals') - ndihedrals = ndihedrals_big + ndihedrals = INT(ndihedrals_big) END IF CALL lmp%gather_dihedrals(dihedrals) @@ -478,7 +478,7 @@ FUNCTION f_lammps_test_gather_dihedrals_big() BIND(C) RESULT(count) INTEGER(c_int64_t), POINTER :: ndihedrals_big ndihedrals_big = lmp%extract_global('ndihedrals') - ndihedrals = ndihedrals_big + ndihedrals = INT(ndihedrals_big) CALL lmp%gather_dihedrals(dihedrals) dihedrals_array(1:5,1:SIZE(dihedrals)/5) => dihedrals count = 0 @@ -528,7 +528,7 @@ FUNCTION f_lammps_test_gather_impropers_small() BIND(C) RESULT(count) nimpropers = nimpropers_small ELSE nimpropers_big = lmp%extract_global('nimpropers') - nimpropers = nimpropers_big + nimpropers = INT(nimpropers_big) END IF CALL lmp%gather_impropers(impropers) @@ -566,7 +566,7 @@ FUNCTION f_lammps_test_gather_impropers_big() BIND(C) RESULT(count) INTEGER(c_int64_t), POINTER :: nimpropers_big nimpropers_big = lmp%extract_global('nimpropers') - nimpropers = nimpropers_big + nimpropers = INT(nimpropers_big) CALL lmp%gather_impropers(impropers) impropers_array(1:5,1:SIZE(impropers)/5) => impropers count = 0 From b225c94f5964f51e7220f8542666a8d8e8146718 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Wed, 14 Jun 2023 12:12:04 -0400 Subject: [PATCH 263/396] remove variable shadowing instance in base class --- src/KOKKOS/pppm_kokkos.h | 1 - 1 file changed, 1 deletion(-) diff --git a/src/KOKKOS/pppm_kokkos.h b/src/KOKKOS/pppm_kokkos.h index 50b5ac0f35..2c6dcc4e15 100644 --- a/src/KOKKOS/pppm_kokkos.h +++ b/src/KOKKOS/pppm_kokkos.h @@ -430,7 +430,6 @@ class PPPMKokkos : public PPPM, public KokkosBaseFFT { // triclinic - int triclinic; // domain settings, orthog or triclinic void setup_triclinic(); void compute_gf_ik_triclinic(); void poisson_ik_triclinic(); From 8a738fabcb073ab9a0a7a0709be91079bb983e9d Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Wed, 14 Jun 2023 12:12:18 -0400 Subject: [PATCH 264/396] must initialized triclinic variable in constructor --- src/KSPACE/pppm_disp.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/KSPACE/pppm_disp.cpp b/src/KSPACE/pppm_disp.cpp index ffa34a7e14..78ebad512a 100644 --- a/src/KSPACE/pppm_disp.cpp +++ b/src/KSPACE/pppm_disp.cpp @@ -110,6 +110,7 @@ PPPMDisp::PPPMDisp(LAMMPS *lmp) : KSpace(lmp), { triclinic_support = 0; pppmflag = dispersionflag = 1; + triclinic = domain->triclinic; nfactors = 3; factors = new int[nfactors]; From 0cd566a4179d123a98b288ec3c270725fc87477c Mon Sep 17 00:00:00 2001 From: Stan Gerald Moore Date: Wed, 14 Jun 2023 10:43:30 -0600 Subject: [PATCH 265/396] Fix compile error for HIP --- src/KOKKOS/pair_eam_alloy_kokkos.cpp | 53 +++++++++++++++------------- src/KOKKOS/pair_eam_alloy_kokkos.h | 4 +-- src/KOKKOS/pair_eam_fs_kokkos.cpp | 51 ++++++++++++++------------ src/KOKKOS/pair_eam_fs_kokkos.h | 4 +-- src/KOKKOS/pair_eam_kokkos.cpp | 51 ++++++++++++++------------ src/KOKKOS/pair_eam_kokkos.h | 4 +-- 6 files changed, 91 insertions(+), 76 deletions(-) diff --git a/src/KOKKOS/pair_eam_alloy_kokkos.cpp b/src/KOKKOS/pair_eam_alloy_kokkos.cpp index f97af7bce2..2b81e21e2b 100644 --- a/src/KOKKOS/pair_eam_alloy_kokkos.cpp +++ b/src/KOKKOS/pair_eam_alloy_kokkos.cpp @@ -193,7 +193,7 @@ void PairEAMAlloyKokkos::compute(int eflag_in, int vflag_in) *this,ev); else Kokkos::parallel_for( - policyInstance>(inum), + policyInstance>::get(inum), *this); } @@ -246,31 +246,31 @@ void PairEAMAlloyKokkos::compute(int eflag_in, int vflag_in) if (neighflag == HALF) { if (newton_pair) { Kokkos::parallel_for( - policyInstance>(inum), + policyInstance>::get(inum), *this); } else { Kokkos::parallel_for( - policyInstance>(inum), + policyInstance>::get(inum), *this); } } else if (neighflag == HALFTHREAD) { if (newton_pair) { Kokkos::parallel_for( - policyInstance>(inum), + policyInstance>::get(inum), *this); } else { Kokkos::parallel_for( - policyInstance>(inum), + policyInstance>::get(inum), *this); } } else if (neighflag == FULL) { if (newton_pair) { Kokkos::parallel_for( - policyInstance>(inum), + policyInstance>::get(inum), *this); } else { Kokkos::parallel_for( - policyInstance>(inum), + policyInstance>::get(inum), *this); } } @@ -655,7 +655,7 @@ void PairEAMAlloyKokkos::operator()(TagPairEAMAlloyKernelB, c ////Specialisation for Neighborlist types Half, HalfThread, Full template template - +KOKKOS_INLINE_FUNCTION void PairEAMAlloyKokkos::operator()(TagPairEAMAlloyKernelAB, const int &ii, EV_FLOAT& ev) const { // rho = density at each atom @@ -1474,27 +1474,32 @@ void PairEAMAlloyKokkos::file2array_alloy() /* ---------------------------------------------------------------------- */ -template -template -auto PairEAMAlloyKokkos::policyInstance(int inum) { - #ifdef KOKKOS_ENABLE_HIP - if (execution_space != Host) { +template +template +struct PairEAMAlloyKokkos::policyInstance { + KOKKOS_INLINE_FUNCTION + static auto get(int inum) { + auto policy = Kokkos::RangePolicy(0,inum); + return policy; + } +}; + +#ifdef KOKKOS_ENABLE_HIP +template<> +template +struct PairEAMAlloyKokkos::policyInstance { + KOKKOS_INLINE_FUNCTION + static auto get(int inum) { static_assert(t_ffloat_2d_n7::static_extent(2) == 7, "Breaking assumption of spline dim for KernelAB and KernelC scratch caching"); - auto policy = Kokkos::TeamPolicy((inum+1023)/1024, 1024) + auto policy = Kokkos::TeamPolicy((inum+1023)/1024, 1024) .set_scratch_size(0, - Kokkos::PerTeam(MAX_CACHE_ROWS*t_ffloat_2d_n7::static_extent(2)*sizeof(double))); + Kokkos::PerTeam(MAX_CACHE_ROWS*7*sizeof(double))); return policy; - } else { - auto policy = Kokkos::RangePolicy(0,inum); - return policy; - } - #else - auto policy = Kokkos::RangePolicy(0,inum); - return policy; - #endif -} + } +}; +#endif /* ---------------------------------------------------------------------- */ diff --git a/src/KOKKOS/pair_eam_alloy_kokkos.h b/src/KOKKOS/pair_eam_alloy_kokkos.h index f9703ef473..2eb40189ac 100644 --- a/src/KOKKOS/pair_eam_alloy_kokkos.h +++ b/src/KOKKOS/pair_eam_alloy_kokkos.h @@ -183,8 +183,8 @@ class PairEAMAlloyKokkos : public PairEAM, public KokkosBase { void array2spline() override; void read_file(char *) override; - template - auto policyInstance(int inum); + template + struct policyInstance; typename AT::t_neighbors_2d d_neighbors; typename AT::t_int_1d d_ilist; diff --git a/src/KOKKOS/pair_eam_fs_kokkos.cpp b/src/KOKKOS/pair_eam_fs_kokkos.cpp index a437527584..4572d14e48 100644 --- a/src/KOKKOS/pair_eam_fs_kokkos.cpp +++ b/src/KOKKOS/pair_eam_fs_kokkos.cpp @@ -193,7 +193,7 @@ void PairEAMFSKokkos::compute(int eflag_in, int vflag_in) *this,ev); else Kokkos::parallel_for( - policyInstance>(inum), + policyInstance>::get(inum), *this); } @@ -246,31 +246,31 @@ void PairEAMFSKokkos::compute(int eflag_in, int vflag_in) if (neighflag == HALF) { if (newton_pair) { Kokkos::parallel_for( - policyInstance>(inum), + policyInstance>::get(inum), *this); } else { Kokkos::parallel_for( - policyInstance>(inum), + policyInstance>::get(inum), *this); } } else if (neighflag == HALFTHREAD) { if (newton_pair) { Kokkos::parallel_for( - policyInstance>(inum), + policyInstance>::get(inum), *this); } else { Kokkos::parallel_for( - policyInstance>(inum), + policyInstance>::get(inum), *this); } } else if (neighflag == FULL) { if (newton_pair) { Kokkos::parallel_for( - policyInstance>(inum), + policyInstance>::get(inum), *this); } else { Kokkos::parallel_for( - policyInstance>(inum), + policyInstance>::get(inum), *this); } } @@ -1484,27 +1484,32 @@ void PairEAMFSKokkos::file2array_fs() /* ---------------------------------------------------------------------- */ -template -template -auto PairEAMFSKokkos::policyInstance(int inum) { - #ifdef KOKKOS_ENABLE_HIP - if (execution_space != Host) { +template +template +struct PairEAMFSKokkos::policyInstance { + KOKKOS_INLINE_FUNCTION + static auto get(int inum) { + auto policy = Kokkos::RangePolicy(0,inum); + return policy; + } +}; + +#ifdef KOKKOS_ENABLE_HIP +template<> +template +struct PairEAMFSKokkos::policyInstance { + KOKKOS_INLINE_FUNCTION + static auto get(int inum) { static_assert(t_ffloat_2d_n7::static_extent(2) == 7, "Breaking assumption of spline dim for KernelAB and KernelC scratch caching"); - auto policy = Kokkos::TeamPolicy((inum+1023)/1024, 1024) + auto policy = Kokkos::TeamPolicy((inum+1023)/1024, 1024) .set_scratch_size(0, - Kokkos::PerTeam(MAX_CACHE_ROWS*t_ffloat_2d_n7::static_extent(2)*sizeof(double))); + Kokkos::PerTeam(MAX_CACHE_ROWS*7*sizeof(double))); return policy; - } else { - auto policy = Kokkos::RangePolicy(0,inum); - return policy; - } - #else - auto policy = Kokkos::RangePolicy(0,inum); - return policy; - #endif -} + } +}; +#endif /* ---------------------------------------------------------------------- */ diff --git a/src/KOKKOS/pair_eam_fs_kokkos.h b/src/KOKKOS/pair_eam_fs_kokkos.h index f7513b3008..bd03ab0015 100644 --- a/src/KOKKOS/pair_eam_fs_kokkos.h +++ b/src/KOKKOS/pair_eam_fs_kokkos.h @@ -183,8 +183,8 @@ class PairEAMFSKokkos : public PairEAM, public KokkosBase { void array2spline() override; void read_file(char *) override; - template - auto policyInstance(int inum); + template + struct policyInstance; typename AT::t_neighbors_2d d_neighbors; typename AT::t_int_1d d_ilist; diff --git a/src/KOKKOS/pair_eam_kokkos.cpp b/src/KOKKOS/pair_eam_kokkos.cpp index 5e2ea4357f..de6d3646bf 100644 --- a/src/KOKKOS/pair_eam_kokkos.cpp +++ b/src/KOKKOS/pair_eam_kokkos.cpp @@ -188,7 +188,7 @@ void PairEAMKokkos::compute(int eflag_in, int vflag_in) *this,ev); else Kokkos::parallel_for( - policyInstance>(inum), + policyInstance>::get(inum), *this); } @@ -241,31 +241,31 @@ void PairEAMKokkos::compute(int eflag_in, int vflag_in) if (neighflag == HALF) { if (newton_pair) { Kokkos::parallel_for( - policyInstance>(inum), + policyInstance>::get(inum), *this); } else { Kokkos::parallel_for( - policyInstance>(inum), + policyInstance>::get(inum), *this); } } else if (neighflag == HALFTHREAD) { if (newton_pair) { Kokkos::parallel_for( - policyInstance>(inum), + policyInstance>::get(inum), *this); } else { Kokkos::parallel_for( - policyInstance>(inum), + policyInstance>::get(inum), *this); } } else if (neighflag == FULL) { if (newton_pair) { Kokkos::parallel_for( - policyInstance>(inum), + policyInstance>::get(inum), *this); } else { Kokkos::parallel_for( - policyInstance>(inum), + policyInstance>::get(inum), *this); } } @@ -1159,27 +1159,32 @@ void PairEAMKokkos::ev_tally(EV_FLOAT &ev, const int &i, const int & /* ---------------------------------------------------------------------- */ -template -template -auto PairEAMKokkos::policyInstance(int inum) { - #ifdef KOKKOS_ENABLE_HIP - if (execution_space != Host) { +template +template +struct PairEAMKokkos::policyInstance { + KOKKOS_INLINE_FUNCTION + static auto get(int inum) { + auto policy = Kokkos::RangePolicy(0,inum); + return policy; + } +}; + +#ifdef KOKKOS_ENABLE_HIP +template<> +template +struct PairEAMKokkos::policyInstance { + KOKKOS_INLINE_FUNCTION + static auto get(int inum) { static_assert(t_ffloat_2d_n7::static_extent(2) == 7, "Breaking assumption of spline dim for KernelAB and KernelC scratch caching"); - auto policy = Kokkos::TeamPolicy((inum+1023)/1024, 1024) + auto policy = Kokkos::TeamPolicy((inum+1023)/1024, 1024) .set_scratch_size(0, - Kokkos::PerTeam(MAX_CACHE_ROWS*t_ffloat_2d_n7::static_extent(2)*sizeof(double))); + Kokkos::PerTeam(MAX_CACHE_ROWS*7*sizeof(double))); return policy; - } else { - auto policy = Kokkos::RangePolicy(0,inum); - return policy; - } - #else - auto policy = Kokkos::RangePolicy(0,inum); - return policy; - #endif -} + } +}; +#endif /* ---------------------------------------------------------------------- */ diff --git a/src/KOKKOS/pair_eam_kokkos.h b/src/KOKKOS/pair_eam_kokkos.h index 41e02e68cc..d9765b37c0 100644 --- a/src/KOKKOS/pair_eam_kokkos.h +++ b/src/KOKKOS/pair_eam_kokkos.h @@ -179,8 +179,8 @@ class PairEAMKokkos : public PairEAM, public KokkosBase { void file2array() override; void array2spline() override; - template - auto policyInstance(int inum); + template + struct policyInstance; typename AT::t_neighbors_2d d_neighbors; typename AT::t_int_1d d_ilist; From 0564d795700e92d527d3ce034c09071d19a57320 Mon Sep 17 00:00:00 2001 From: Stan Gerald Moore Date: Wed, 14 Jun 2023 10:52:47 -0600 Subject: [PATCH 266/396] Fix SYCL compile error with GNU make, see https://github.com/kokkos/kokkos/pull/6218 --- lib/kokkos/Makefile.kokkos | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/kokkos/Makefile.kokkos b/lib/kokkos/Makefile.kokkos index 361995d847..adcee303ba 100644 --- a/lib/kokkos/Makefile.kokkos +++ b/lib/kokkos/Makefile.kokkos @@ -1376,6 +1376,7 @@ ifneq ($(KOKKOS_INTERNAL_NEW_CONFIG), 0) ifeq ($(KOKKOS_INTERNAL_USE_SYCL), 1) tmp := $(call kokkos_append_config_header,"$H""include ","KokkosCore_Config_FwdBackend.hpp") tmp := $(call kokkos_append_config_header,"$H""include ","KokkosCore_Config_DeclareBackend.hpp") + tmp := $(call kokkos_append_config_header,"$H""include ","KokkosCore_Config_SetupBackend.hpp") endif ifeq ($(KOKKOS_INTERNAL_USE_HIP), 1) tmp := $(call kokkos_append_config_header,"$H""include ","KokkosCore_Config_FwdBackend.hpp") From c83dc1ff305f950cbc60c72c89b3cc6c85a5fd9f Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Wed, 14 Jun 2023 13:52:54 -0400 Subject: [PATCH 267/396] fix STORE global -> fix STORE/GLOBAL --- src/EXTRA-FIX/fix_npt_cauchy.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/EXTRA-FIX/fix_npt_cauchy.cpp b/src/EXTRA-FIX/fix_npt_cauchy.cpp index 380964f058..feb5a95c6f 100644 --- a/src/EXTRA-FIX/fix_npt_cauchy.cpp +++ b/src/EXTRA-FIX/fix_npt_cauchy.cpp @@ -2461,7 +2461,7 @@ void FixNPTCauchy::CauchyStat_init() if (!init_store) init_store = dynamic_cast( - modify->add_fix(std::string(id_store) + " all STORE global 1 6")); + modify->add_fix(std::string(id_store) + " all STORE/GLOBAL 1 6")); initRUN = 0; initPK = 1; From 27908139aeb0509550cbc84b47913524bff7135e Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Wed, 14 Jun 2023 14:14:47 -0400 Subject: [PATCH 268/396] whitespace --- src/KOKKOS/pair_eam_kokkos.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/KOKKOS/pair_eam_kokkos.h b/src/KOKKOS/pair_eam_kokkos.h index d9765b37c0..9d066d40a0 100644 --- a/src/KOKKOS/pair_eam_kokkos.h +++ b/src/KOKKOS/pair_eam_kokkos.h @@ -59,7 +59,7 @@ class PairEAMKokkos : public PairEAM, public KokkosBase { ~PairEAMKokkos() override; void compute(int, int) override; void init_style() override; - + KOKKOS_INLINE_FUNCTION void operator()(TagPairEAMPackForwardComm, const int&) const; From 82f664acd4613e2b103eb0c648eb48391233bdc7 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Wed, 14 Jun 2023 14:43:29 -0400 Subject: [PATCH 269/396] update log files for BODY package styles --- examples/body/log.14Jun23.body.g++.1 | 180 ++++++++++++++ examples/body/log.14Jun23.body.g++.4 | 180 ++++++++++++++ ...18.cubes.g++.1 => log.14Jun23.cubes.g++.1} | 70 +++--- ...18.cubes.g++.4 => log.14Jun23.cubes.g++.4} | 72 +++--- examples/body/log.14Jun23.pour3d.g++.1 | 148 +++++++++++ examples/body/log.14Jun23.pour3d.g++.4 | 148 +++++++++++ examples/body/log.14Jun23.squares.g++.1 | 226 +++++++++++++++++ examples/body/log.14Jun23.squares.g++.4 | 226 +++++++++++++++++ examples/body/log.14Jun23.wall2d.g++.1 | 229 ++++++++++++++++++ examples/body/log.14Jun23.wall2d.g++.4 | 229 ++++++++++++++++++ examples/body/log.27Nov18.body.g++.1 | 177 -------------- examples/body/log.27Nov18.body.g++.4 | 177 -------------- examples/body/log.27Nov18.pour3d.g++.1 | 74 ------ examples/body/log.27Nov18.pour3d.g++.4 | 74 ------ examples/body/log.27Nov18.squares.g++.1 | 222 ----------------- examples/body/log.27Nov18.squares.g++.4 | 222 ----------------- examples/body/log.27Nov18.wall2d.g++.1 | 224 ----------------- examples/body/log.27Nov18.wall2d.g++.4 | 224 ----------------- 18 files changed, 1641 insertions(+), 1461 deletions(-) create mode 100644 examples/body/log.14Jun23.body.g++.1 create mode 100644 examples/body/log.14Jun23.body.g++.4 rename examples/body/{log.27Nov18.cubes.g++.1 => log.14Jun23.cubes.g++.1} (52%) rename examples/body/{log.27Nov18.cubes.g++.4 => log.14Jun23.cubes.g++.4} (50%) create mode 100644 examples/body/log.14Jun23.pour3d.g++.1 create mode 100644 examples/body/log.14Jun23.pour3d.g++.4 create mode 100644 examples/body/log.14Jun23.squares.g++.1 create mode 100644 examples/body/log.14Jun23.squares.g++.4 create mode 100644 examples/body/log.14Jun23.wall2d.g++.1 create mode 100644 examples/body/log.14Jun23.wall2d.g++.4 delete mode 100644 examples/body/log.27Nov18.body.g++.1 delete mode 100644 examples/body/log.27Nov18.body.g++.4 delete mode 100644 examples/body/log.27Nov18.pour3d.g++.1 delete mode 100644 examples/body/log.27Nov18.pour3d.g++.4 delete mode 100644 examples/body/log.27Nov18.squares.g++.1 delete mode 100644 examples/body/log.27Nov18.squares.g++.4 delete mode 100644 examples/body/log.27Nov18.wall2d.g++.1 delete mode 100644 examples/body/log.27Nov18.wall2d.g++.4 diff --git a/examples/body/log.14Jun23.body.g++.1 b/examples/body/log.14Jun23.body.g++.1 new file mode 100644 index 0000000000..e016e88b0b --- /dev/null +++ b/examples/body/log.14Jun23.body.g++.1 @@ -0,0 +1,180 @@ +LAMMPS (28 Mar 2023 - Development) + using 1 OpenMP thread(s) per MPI task +# 2d polygon nparticle bodies + +units lj +dimension 2 +atom_style body nparticle 2 6 + +read_data data.body +Reading data file ... + orthogonal box = (-15.532225 -15.532225 -0.5) to (15.532225 15.532225 0.5) + 1 by 1 by 1 MPI processor grid + reading atoms ... + 100 atoms + 100 bodies + read_data CPU = 0.002 seconds + +velocity all create 1.44 87287 loop geom + +pair_style body/nparticle 5.0 +pair_coeff * * 1.0 1.0 + +neighbor 0.5 bin +neigh_modify every 1 delay 0 check yes + +fix 1 all nve/body +#fix 1 all nvt/body temp 1.44 1.44 1.0 +fix 2 all enforce2d + +#compute 1 all body/local type 1 2 3 +#dump 1 all local 100 dump.body index c_1[1] c_1[2] c_1[3] c_1[4] + +#dump 2 all image 1000 image.*.jpg type type # zoom 1.6 adiam 1.5 body type 1.0 0 +#dump_modify 2 pad 5 + +thermo 100 +run 10000 +Generated 0 of 0 mixed pair_coeff terms from geometric mixing rule +Neighbor list info ... + update: every = 1 steps, delay = 0 steps, check = yes + max neighbors/atom: 2000, page size: 100000 + master list distance cutoff = 5.5 + ghost atom cutoff = 5.5 + binsize = 2.75, bins = 12 12 1 + 1 neighbor lists, perpetual/occasional/extra = 1 0 0 + (1) pair body/nparticle, perpetual + attributes: half, newton on + pair build: half/bin/atomonly/newton + stencil: half/bin/2d + bin: standard +Per MPI rank memory allocation (min/avg/max) = 5.279 | 5.279 | 5.279 Mbytes + Step Temp E_pair E_mol TotEng Press + 0 1.44 -0.63799525 0 0.78760475 -0.15028724 + 100 1.6423694 -1.0001516 0 0.62579417 0.16116443 + 200 1.4802187 -1.2479519 0 0.21746458 0.35445329 + 300 1.4734223 -1.3213583 0 0.1373298 0.45266192 + 400 1.5118818 -1.5924889 0 -0.095725867 0.13296961 + 500 1.5471951 -1.630886 0 -0.099162814 0.12439793 + 600 1.6264248 -1.6468162 0 -0.03665568 0.43392484 + 700 1.597475 -1.6539821 0 -0.072481849 0.13128147 + 800 1.6841531 -1.775776 0 -0.10846445 -0.032960346 + 900 1.556262 -1.6750139 0 -0.1343146 0.53484605 + 1000 1.6272373 -1.7572956 0 -0.14633067 0.18431831 + 1100 1.6448235 -1.7176556 0 -0.089280316 0.25900065 + 1200 1.5486928 -1.6481004 0 -0.11489454 0.036934194 + 1300 1.7449183 -1.6039068 0 0.12356231 -0.071099427 + 1400 1.668581 -1.5939776 0 0.057917584 0.02239666 + 1500 1.6514223 -1.7086624 0 -0.073754397 0.39021328 + 1600 1.8367415 -1.808017 0 0.010357066 0.1405097 + 1700 1.6439993 -1.7711084 0 -0.14354908 0.37488252 + 1800 1.8105437 -1.7312044 0 0.061233893 0.033817829 + 1900 1.7745557 -1.7184539 0 0.038356243 0.26826112 + 2000 1.4919032 -1.7635799 0 -0.28659575 0.32901186 + 2100 1.5086111 -1.5151192 0 -0.021594146 0.37082072 + 2200 1.4464813 -1.5702682 0 -0.13825163 -0.043079808 + 2300 1.398236 -1.5359564 0 -0.15170277 0.14467017 + 2400 1.5050139 -1.6002694 0 -0.11030569 0.30358205 + 2500 1.5549789 -1.652805 0 -0.11337589 0.2916046 + 2600 1.4774593 -1.5406116 0 -0.077926888 0.020921323 + 2700 1.3700851 -1.5855698 0 -0.22918557 0.22226615 + 2800 1.4656869 -1.629742 0 -0.17871195 -0.0090503155 + 2900 1.4355808 -1.6486992 0 -0.22747424 0.12741636 + 3000 1.5859288 -1.5467092 0 0.023360382 0.23081334 + 3100 1.6099287 -1.4917881 0 0.10204129 0.22085916 + 3200 1.6814814 -1.554998 0 0.10966853 0.10312492 + 3300 1.5319494 -1.4723195 0 0.044310484 0.18583117 + 3400 1.5124418 -1.499312 0 -0.0019945387 0.15564425 + 3500 1.6106798 -1.5568215 0 0.037751529 0.27433785 + 3600 1.460087 -1.5530078 0 -0.10752165 0.0073889211 + 3700 1.5744452 -1.5720821 0 -0.013381308 0.27735962 + 3800 1.7290106 -1.6504739 0 0.061246632 0.48173619 + 3900 1.611197 -1.6452216 0 -0.05013663 0.4286963 + 4000 1.6715425 -1.6409258 0 0.013901267 0.017020657 + 4100 1.6913694 -1.5885259 0 0.085929717 0.13679669 + 4200 1.5347633 -1.6316222 0 -0.11220653 0.024396005 + 4300 1.5221369 -1.5924627 0 -0.085547139 0.29634927 + 4400 1.7020273 -1.7069204 0 -0.021913362 0.12700619 + 4500 1.7176336 -1.7439335 0 -0.043476251 0.14745343 + 4600 1.4409943 -1.6121558 0 -0.18557152 0.018887675 + 4700 1.7868207 -1.6707762 0 0.098176247 0.20004565 + 4800 1.8720226 -1.7000206 0 0.15328178 0.25661867 + 4900 1.7128343 -1.7289913 0 -0.033285317 0.24698662 + 5000 1.7242114 -1.6662075 0 0.040761785 0.18935677 + 5100 1.7589418 -1.7267393 0 0.014613086 0.40918365 + 5200 1.7138074 -1.778402 0 -0.081732715 0.39679805 + 5300 1.8149032 -1.7708654 0 0.025888786 0.29874434 + 5400 1.7140097 -1.6444743 0 0.052395323 0.62588743 + 5500 1.8076873 -1.7276245 0 0.061985946 0.25434646 + 5600 1.7137948 -1.678778 0 0.017878859 0.21062182 + 5700 1.8625614 -1.7114074 0 0.1325284 0.14365823 + 5800 1.667941 -1.6462142 0 0.0050473638 0.36134037 + 5900 1.7080521 -1.6919526 0 -0.00098107526 0.27472252 + 6000 1.7180315 -1.6677683 0 0.033082909 0.29905397 + 6100 1.8264687 -1.6837934 0 0.12441065 0.033504487 + 6200 1.757998 -1.634503 0 0.10591508 0.14360478 + 6300 1.6444838 -1.5734502 0 0.05458881 0.50314779 + 6400 1.7213235 -1.705482 0 -0.0013717454 -0.063375271 + 6500 1.5454026 -1.7236013 0 -0.19365272 0.21355367 + 6600 1.7550617 -1.7304462 0 0.0070648556 0.1782743 + 6700 1.6931304 -1.7005361 0 -0.024337029 0.31165135 + 6800 1.7953505 -1.7377126 0 0.039684354 0.27052592 + 6900 1.6547086 -1.6971987 0 -0.059037125 0.26390513 + 7000 1.678321 -1.6343689 0 0.027168906 0.23632145 + 7100 1.6389472 -1.690589 0 -0.068031265 0.26471258 + 7200 1.6772509 -1.7305397 0 -0.070061301 0.16013956 + 7300 1.7401473 -1.7461921 0 -0.023446315 0.14462402 + 7400 1.7381776 -1.6586839 0 0.06211186 0.47746891 + 7500 1.7184021 -1.8309755 0 -0.1297574 0.27706616 + 7600 1.8404039 -1.7957552 0 0.026244663 0.12898128 + 7700 1.8474196 -1.7118818 0 0.11706359 0.1959609 + 7800 1.7635506 -1.6119363 0 0.1339788 0.086260229 + 7900 1.5873929 -1.5651473 0 0.0063716922 0.0010935251 + 8000 1.6394989 -1.5900851 0 0.033018817 0.41301427 + 8100 1.6731865 -1.6981463 0 -0.041691712 0.46624156 + 8200 1.7728067 -1.7515658 0 0.0035128109 0.16520115 + 8300 1.6142221 -1.8030321 0 -0.20495225 0.039485737 + 8400 1.6775678 -1.8266472 0 -0.16585509 0.074514313 + 8500 1.8399403 -1.8100014 0 0.011539538 0.38126754 + 8600 1.8259529 -1.6641902 0 0.14350318 0.80219793 + 8700 1.8454807 -1.68448 0 0.14254593 0.18855669 + 8800 1.7017088 -1.7219601 0 -0.037268433 0.36465692 + 8900 1.612135 -1.5813013 0 0.014712431 0.21657263 + 9000 1.5992353 -1.7093785 0 -0.12613559 0.038933966 + 9100 1.7486466 -1.7024749 0 0.028685202 0.28688996 + 9200 1.546781 -1.6512407 0 -0.1199275 0.16188207 + 9300 1.8424683 -1.7304781 0 0.093565478 0.35295164 + 9400 1.7646311 -1.7795324 0 -0.032547636 0.39114207 + 9500 1.8061763 -1.8458669 0 -0.057752329 0.18930255 + 9600 1.6953348 -1.7144901 0 -0.036108734 0.18392219 + 9700 1.693168 -1.5860306 0 0.090205689 0.18749665 + 9800 1.6057784 -1.6478049 0 -0.05808426 0.28339031 + 9900 1.712654 -1.6566387 0 0.038888773 0.52108885 + 10000 1.7102385 -1.6670768 0 0.026059337 0.073458218 +Loop time of 1.09582 on 1 procs for 10000 steps with 100 atoms + +Performance: 3942257.351 tau/day, 9125.596 timesteps/s, 912.560 katom-step/s +99.8% CPU use with 1 MPI tasks x 1 OpenMP threads + +MPI task timing breakdown: +Section | min time | avg time | max time |%varavg| %total +--------------------------------------------------------------- +Pair | 0.95651 | 0.95651 | 0.95651 | 0.0 | 87.29 +Neigh | 0.0064365 | 0.0064365 | 0.0064365 | 0.0 | 0.59 +Comm | 0.015238 | 0.015238 | 0.015238 | 0.0 | 1.39 +Output | 0.00059554 | 0.00059554 | 0.00059554 | 0.0 | 0.05 +Modify | 0.10993 | 0.10993 | 0.10993 | 0.0 | 10.03 +Other | | 0.007113 | | | 0.65 + +Nlocal: 100 ave 100 max 100 min +Histogram: 1 0 0 0 0 0 0 0 0 0 +Nghost: 80 ave 80 max 80 min +Histogram: 1 0 0 0 0 0 0 0 0 0 +Neighs: 448 ave 448 max 448 min +Histogram: 1 0 0 0 0 0 0 0 0 0 + +Total # of neighbors = 448 +Ave neighs/atom = 4.48 +Neighbor list builds = 463 +Dangerous builds = 0 +Total wall time: 0:00:01 diff --git a/examples/body/log.14Jun23.body.g++.4 b/examples/body/log.14Jun23.body.g++.4 new file mode 100644 index 0000000000..54ae630872 --- /dev/null +++ b/examples/body/log.14Jun23.body.g++.4 @@ -0,0 +1,180 @@ +LAMMPS (28 Mar 2023 - Development) + using 1 OpenMP thread(s) per MPI task +# 2d polygon nparticle bodies + +units lj +dimension 2 +atom_style body nparticle 2 6 + +read_data data.body +Reading data file ... + orthogonal box = (-15.532225 -15.532225 -0.5) to (15.532225 15.532225 0.5) + 2 by 2 by 1 MPI processor grid + reading atoms ... + 100 atoms + 100 bodies + read_data CPU = 0.001 seconds + +velocity all create 1.44 87287 loop geom + +pair_style body/nparticle 5.0 +pair_coeff * * 1.0 1.0 + +neighbor 0.5 bin +neigh_modify every 1 delay 0 check yes + +fix 1 all nve/body +#fix 1 all nvt/body temp 1.44 1.44 1.0 +fix 2 all enforce2d + +#compute 1 all body/local type 1 2 3 +#dump 1 all local 100 dump.body index c_1[1] c_1[2] c_1[3] c_1[4] + +#dump 2 all image 1000 image.*.jpg type type # zoom 1.6 adiam 1.5 body type 1.0 0 +#dump_modify 2 pad 5 + +thermo 100 +run 10000 +Generated 0 of 0 mixed pair_coeff terms from geometric mixing rule +Neighbor list info ... + update: every = 1 steps, delay = 0 steps, check = yes + max neighbors/atom: 2000, page size: 100000 + master list distance cutoff = 5.5 + ghost atom cutoff = 5.5 + binsize = 2.75, bins = 12 12 1 + 1 neighbor lists, perpetual/occasional/extra = 1 0 0 + (1) pair body/nparticle, perpetual + attributes: half, newton on + pair build: half/bin/atomonly/newton + stencil: half/bin/2d + bin: standard +Per MPI rank memory allocation (min/avg/max) = 5.268 | 5.268 | 5.268 Mbytes + Step Temp E_pair E_mol TotEng Press + 0 1.44 -0.63799525 0 0.78760475 -0.15028724 + 100 1.6423663 -1.000111 0 0.62583161 0.16116978 + 200 1.4802732 -1.2478364 0 0.21763407 0.35464152 + 300 1.4735433 -1.3211072 0 0.13770068 0.45307413 + 400 1.5119491 -1.5930779 0 -0.096248286 0.13119532 + 500 1.5449834 -1.6300143 0 -0.10048065 0.12635421 + 600 1.621105 -1.6459036 0 -0.041009639 0.43837884 + 700 1.5959719 -1.6348501 0 -0.054837867 0.13233006 + 800 1.6862723 -1.6902254 0 -0.020815854 0.20072937 + 900 1.6771131 -1.6544493 0 0.0058926625 0.34898089 + 1000 1.5867 -1.6797024 0 -0.10886943 0.33511593 + 1100 1.7842277 -1.6814985 0 0.084886913 0.23634574 + 1200 1.7089241 -1.6766866 0 0.015148192 0.40440454 + 1300 1.6195529 -1.6078381 0 -0.004480726 0.12193834 + 1400 1.5967912 -1.563198 0 0.017625291 0.2233618 + 1500 1.6131091 -1.5731367 0 0.023841282 0.13856054 + 1600 1.6096972 -1.5741595 0 0.01944073 0.096081201 + 1700 1.6099281 -1.5875363 0 0.0062924683 0.28628509 + 1800 1.7328539 -1.5696894 0 0.14583598 0.2202503 + 1900 1.6433157 -1.6659757 0 -0.039093124 0.12006746 + 2000 1.8262234 -1.778379 0 0.029582122 0.17815935 + 2100 1.7441298 -1.704871 0 0.021817442 0.30772022 + 2200 1.7933363 -1.7246149 0 0.050788098 0.11323852 + 2300 1.7458809 -1.7186101 0 0.0098120012 0.0034260299 + 2400 1.8202324 -1.7777769 0 0.024253178 0.089077551 + 2500 1.691512 -1.6976236 0 -0.023026761 0.23901369 + 2600 1.6221153 -1.639172 0 -0.033277785 0.36881214 + 2700 1.5532388 -1.7286197 0 -0.19091334 0.1714534 + 2800 1.6648128 -1.7298542 0 -0.081689467 0.0077427265 + 2900 1.6548465 -1.7126766 0 -0.074378524 0.096972027 + 3000 1.604345 -1.7210036 0 -0.13270205 0.25227471 + 3100 1.67823 -1.6537385 0 0.0077092269 0.13198555 + 3200 1.4695581 -1.5609142 0 -0.10605159 0.28909806 + 3300 1.6778332 -1.7396206 0 -0.078565681 0.25069132 + 3400 1.7588934 -1.680043 0 0.061261505 0.28609454 + 3500 1.6699117 -1.7762865 0 -0.12307397 0.2584648 + 3600 1.5951406 -1.6611845 0 -0.081995282 0.35801267 + 3700 1.5267137 -1.6371603 0 -0.12571366 0.6116418 + 3800 1.6792717 -1.638182 0 0.024296953 0.43447072 + 3900 1.5857658 -1.6607833 0 -0.09087513 0.19479457 + 4000 1.6062152 -1.5436014 0 0.046551586 0.55118141 + 4100 1.5505892 -1.5259333 0 0.0091500726 0.49075107 + 4200 1.6933 -1.6314975 0 0.044869524 0.032970187 + 4300 1.6498743 -1.7298746 0 -0.096499053 0.14837573 + 4400 1.6535324 -1.7095911 0 -0.072593998 0.24207879 + 4500 1.835466 -1.7677327 0 0.049378652 0.18168744 + 4600 1.7346556 -1.6379956 0 0.07931344 0.49973778 + 4700 1.8050359 -1.8354358 0 -0.048450223 -0.037354111 + 4800 1.6361661 -1.7741414 0 -0.15433697 0.36409064 + 4900 1.6511224 -1.7703808 0 -0.13576956 0.23794467 + 5000 1.6249047 -1.6516641 0 -0.043008453 0.15155643 + 5100 1.6842561 -1.7128485 0 -0.045434914 0.30999124 + 5200 1.6153583 -1.630441 0 -0.031236245 -0.0083460068 + 5300 1.6806066 -1.6907533 0 -0.026952801 0.16886559 + 5400 1.7541932 -1.7161908 0 0.020460503 0.16560614 + 5500 1.8643473 -1.7810235 0 0.064680293 0.061200837 + 5600 1.5963536 -1.6145484 0 -0.034158307 0.47888104 + 5700 1.7385482 -1.7214092 0 -0.00024648083 0.22078849 + 5800 1.6726308 -1.6987799 0 -0.042875376 0.46131938 + 5900 1.7830081 -1.7766484 0 -0.011470422 0.12597212 + 6000 1.9057941 -1.719849 0 0.16688715 0.37367068 + 6100 1.6882353 -1.6888488 0 -0.0174959 0.33635307 + 6200 1.8644261 -1.7435021 0 0.10227973 0.54157135 + 6300 1.8043895 -1.8169618 0 -0.030616242 0.20596562 + 6400 1.8745855 -1.7752732 0 0.080566434 0.18365661 + 6500 1.8330698 -1.6984304 0 0.11630864 0.058109254 + 6600 1.8006644 -1.7398524 0 0.042805376 0.17509961 + 6700 1.7471279 -1.7009995 0 0.0286571 0.13439557 + 6800 1.7077006 -1.7462928 0 -0.055669263 0.16474264 + 6900 1.7602738 -1.8336138 0 -0.090942793 0.37533762 + 7000 1.6962037 -1.7746381 0 -0.095396485 0.28764793 + 7100 1.6040275 -1.652448 0 -0.064460796 0.47621288 + 7200 1.7595892 -1.6260406 0 0.11595278 0.55174207 + 7300 1.8031743 -1.7436876 0 0.041454978 0.35699364 + 7400 1.6575485 -1.5994276 0 0.041545422 0.38389368 + 7500 1.8539985 -1.6888181 0 0.14664046 0.25524239 + 7600 1.6721617 -1.6819419 0 -0.026501825 0.18077253 + 7700 1.4696976 -1.5368001 0 -0.081799475 0.37392274 + 7800 1.6532125 -1.6604679 0 -0.023787555 0.25683053 + 7900 1.5890818 -1.711541 0 -0.13834993 0.28943398 + 8000 1.6729844 -1.674981 0 -0.01872644 0.1725141 + 8100 1.6041427 -1.7188678 0 -0.13076654 0.22948004 + 8200 1.7000012 -1.5584259 0 0.12457532 0.82913741 + 8300 1.6662649 -1.8411986 0 -0.19159634 0.40893581 + 8400 1.6031593 -1.8225478 0 -0.23542004 0.21287004 + 8500 1.6615542 -1.685667 0 -0.040728376 0.40063656 + 8600 1.6094262 -1.7942547 0 -0.20092282 0.28738874 + 8700 1.6040855 -1.6483081 0 -0.060263486 0.22614876 + 8800 1.6658931 -1.6751256 0 -0.025891437 0.027723314 + 8900 1.7989105 -1.7318497 0 0.049071648 0.27645866 + 9000 1.8242262 -1.6879124 0 0.11807158 0.21701732 + 9100 1.6795701 -1.6926952 0 -0.029920813 0.28702517 + 9200 1.8093352 -1.8430841 0 -0.051842329 0.04182244 + 9300 1.7654746 -1.7580453 0 -0.010225436 0.41460279 + 9400 1.9494599 -1.7162713 0 0.21369396 0.22445951 + 9500 1.8650839 -1.6517629 0 0.19467014 0.34042974 + 9600 1.8080088 -1.651068 0 0.13886064 0.38597156 + 9700 1.757349 -1.6397227 0 0.10005277 0.12075072 + 9800 1.8111959 -1.7155458 0 0.077538075 0.023545696 + 9900 1.7255423 -1.7364511 0 -0.02816423 0.24284116 + 10000 1.794001 -1.7545014 0 0.021559597 0.15092078 +Loop time of 0.461554 on 4 procs for 10000 steps with 100 atoms + +Performance: 9359693.727 tau/day, 21665.958 timesteps/s, 2.167 Matom-step/s +93.5% CPU use with 4 MPI tasks x 1 OpenMP threads + +MPI task timing breakdown: +Section | min time | avg time | max time |%varavg| %total +--------------------------------------------------------------- +Pair | 0.21335 | 0.24947 | 0.30554 | 7.2 | 54.05 +Neigh | 0.0016861 | 0.0018238 | 0.0019357 | 0.2 | 0.40 +Comm | 0.078727 | 0.14542 | 0.19247 | 10.9 | 31.51 +Output | 0.00086191 | 0.0026451 | 0.0079866 | 6.0 | 0.57 +Modify | 0.028228 | 0.029642 | 0.030811 | 0.5 | 6.42 +Other | | 0.03255 | | | 7.05 + +Nlocal: 25 ave 28 max 21 min +Histogram: 1 0 0 0 0 1 0 1 0 1 +Nghost: 47.5 ave 50 max 46 min +Histogram: 2 0 0 0 0 1 0 0 0 1 +Neighs: 117.25 ave 144 max 91 min +Histogram: 1 0 0 1 0 0 1 0 0 1 + +Total # of neighbors = 469 +Ave neighs/atom = 4.69 +Neighbor list builds = 494 +Dangerous builds = 0 +Total wall time: 0:00:00 diff --git a/examples/body/log.27Nov18.cubes.g++.1 b/examples/body/log.14Jun23.cubes.g++.1 similarity index 52% rename from examples/body/log.27Nov18.cubes.g++.1 rename to examples/body/log.14Jun23.cubes.g++.1 index 588f95f69d..4010d1013b 100644 --- a/examples/body/log.27Nov18.cubes.g++.1 +++ b/examples/body/log.14Jun23.cubes.g++.1 @@ -1,4 +1,4 @@ -LAMMPS (27 Nov 2018) +LAMMPS (28 Mar 2023 - Development) using 1 OpenMP thread(s) per MPI task # 3d rounded cubes @@ -11,20 +11,23 @@ dimension 3 atom_style body rounded/polyhedron 1 10 read_data data.cubes +Reading data file ... orthogonal box = (0 0 0) to (6 6 6) 1 by 1 by 1 MPI processor grid reading atoms ... 2 atoms 2 bodies + read_data CPU = 0.001 seconds replicate $r $r $r replicate 3 $r $r replicate 3 3 $r replicate 3 3 3 +Replication is creating a 3x3x3 = 27 times larger system... orthogonal box = (0 0 0) to (18 18 18) 1 by 1 by 1 MPI processor grid 54 atoms - Time spent = 0.000426769 secs + replicate CPU = 0.001 seconds velocity all create 1.2 187287 dist gaussian mom yes rot yes @@ -71,56 +74,57 @@ thermo 1000 run ${steps} run 10000 +Generated 0 of 0 mixed pair_coeff terms from geometric mixing rule Neighbor list info ... - update every 1 steps, delay 0 steps, check yes + update: every = 1 steps, delay = 0 steps, check = yes max neighbors/atom: 2000, page size: 100000 - master list distance cutoff = 3.9641 - ghost atom cutoff = 3.9641 - binsize = 1.98205, bins = 10 10 10 + master list distance cutoff = 3.9641016 + ghost atom cutoff = 3.9641016 + binsize = 1.9820508, bins = 10 10 10 1 neighbor lists, perpetual/occasional/extra = 1 0 0 (1) pair body/rounded/polyhedron, perpetual attributes: half, newton on pair build: half/bin/atomonly/newton - stencil: half/bin/3d/newton + stencil: half/bin/3d bin: standard -Per MPI rank memory allocation (min/avg/max) = 4.953 | 4.953 | 4.953 Mbytes -Step KinEng PotEng TotEng c_p2 c_1_temp - 0 1.7666667 0 1.7666667 0.01090535 0.59439252 - 1000 3.1462962 0.17392649 3.3202227 0.02361912 1.1654694 - 2000 2.9311648 0.13836102 3.0695258 0.021748224 1.1950624 - 3000 3.090491 0.16511199 3.255603 0.018691142 1.23672 - 4000 2.7401565 0.17792155 2.9180781 0.015093853 1.1180839 - 5000 3.0880849 0.17587085 3.2639557 0.030563042 1.2831154 - 6000 3.2180776 0.19732251 3.4154001 0.028338151 1.258839 - 7000 2.9514882 0.25088882 3.202377 0.025296925 1.1746326 - 8000 3.0101226 0.28825968 3.2983823 0.027273454 1.2138056 - 9000 3.0164253 0.1901733 3.2065986 0.033228915 1.3095914 - 10000 2.3780401 0.34082434 2.7188644 0.031838531 1.0208679 -Loop time of 51.5779 on 1 procs for 10000 steps with 54 atoms +Per MPI rank memory allocation (min/avg/max) = 5.973 | 5.973 | 5.973 Mbytes + Step KinEng PotEng TotEng c_p2 c_1_temp + 0 1.7666667 0 1.7666667 0.01090535 0.59439252 + 1000 3.1462962 0.17392649 3.3202227 0.02361912 1.1654694 + 2000 2.9311648 0.13836102 3.0695258 0.021748224 1.1950624 + 3000 3.090491 0.16511199 3.255603 0.018691142 1.23672 + 4000 2.7401565 0.17792155 2.9180781 0.015093853 1.1180839 + 5000 3.0880849 0.17587085 3.2639557 0.030563042 1.2831154 + 6000 3.2180776 0.19732251 3.4154001 0.028338151 1.258839 + 7000 2.9514882 0.25088882 3.202377 0.025296925 1.1746326 + 8000 3.0101226 0.28825968 3.2983823 0.027273454 1.2138056 + 9000 3.0164253 0.1901733 3.2065986 0.033228915 1.3095914 + 10000 2.3780401 0.34082434 2.7188644 0.031838531 1.0208679 +Loop time of 33.0201 on 1 procs for 10000 steps with 54 atoms -Performance: 16751.376 tau/day, 193.882 timesteps/s +Performance: 26165.890 tau/day, 302.846 timesteps/s, 16.354 katom-step/s 99.8% CPU use with 1 MPI tasks x 1 OpenMP threads MPI task timing breakdown: Section | min time | avg time | max time |%varavg| %total --------------------------------------------------------------- -Pair | 51.377 | 51.377 | 51.377 | 0.0 | 99.61 -Neigh | 0.0063686 | 0.0063686 | 0.0063686 | 0.0 | 0.01 -Comm | 0.072127 | 0.072127 | 0.072127 | 0.0 | 0.14 -Output | 0.0002768 | 0.0002768 | 0.0002768 | 0.0 | 0.00 -Modify | 0.10849 | 0.10849 | 0.10849 | 0.0 | 0.21 -Other | | 0.01404 | | | 0.03 +Pair | 32.897 | 32.897 | 32.897 | 0.0 | 99.63 +Neigh | 0.0028124 | 0.0028124 | 0.0028124 | 0.0 | 0.01 +Comm | 0.034404 | 0.034404 | 0.034404 | 0.0 | 0.10 +Output | 0.00017643 | 0.00017643 | 0.00017643 | 0.0 | 0.00 +Modify | 0.078202 | 0.078202 | 0.078202 | 0.0 | 0.24 +Other | | 0.00767 | | | 0.02 -Nlocal: 54 ave 54 max 54 min +Nlocal: 54 ave 54 max 54 min Histogram: 1 0 0 0 0 0 0 0 0 0 -Nghost: 96 ave 96 max 96 min +Nghost: 96 ave 96 max 96 min Histogram: 1 0 0 0 0 0 0 0 0 0 -Neighs: 100 ave 100 max 100 min +Neighs: 100 ave 100 max 100 min Histogram: 1 0 0 0 0 0 0 0 0 0 Total # of neighbors = 100 -Ave neighs/atom = 1.85185 +Ave neighs/atom = 1.8518519 Neighbor list builds = 268 Dangerous builds = 0 -Total wall time: 0:00:51 +Total wall time: 0:00:33 diff --git a/examples/body/log.27Nov18.cubes.g++.4 b/examples/body/log.14Jun23.cubes.g++.4 similarity index 50% rename from examples/body/log.27Nov18.cubes.g++.4 rename to examples/body/log.14Jun23.cubes.g++.4 index f10a4c8a0a..1439af95a0 100644 --- a/examples/body/log.27Nov18.cubes.g++.4 +++ b/examples/body/log.14Jun23.cubes.g++.4 @@ -1,4 +1,4 @@ -LAMMPS (27 Nov 2018) +LAMMPS (28 Mar 2023 - Development) using 1 OpenMP thread(s) per MPI task # 3d rounded cubes @@ -11,20 +11,23 @@ dimension 3 atom_style body rounded/polyhedron 1 10 read_data data.cubes +Reading data file ... orthogonal box = (0 0 0) to (6 6 6) 1 by 2 by 2 MPI processor grid reading atoms ... 2 atoms 2 bodies + read_data CPU = 0.001 seconds replicate $r $r $r replicate 3 $r $r replicate 3 3 $r replicate 3 3 3 +Replication is creating a 3x3x3 = 27 times larger system... orthogonal box = (0 0 0) to (18 18 18) 1 by 2 by 2 MPI processor grid 54 atoms - Time spent = 0.000776052 secs + replicate CPU = 0.001 seconds velocity all create 1.2 187287 dist gaussian mom yes rot yes @@ -71,56 +74,57 @@ thermo 1000 run ${steps} run 10000 +Generated 0 of 0 mixed pair_coeff terms from geometric mixing rule Neighbor list info ... - update every 1 steps, delay 0 steps, check yes + update: every = 1 steps, delay = 0 steps, check = yes max neighbors/atom: 2000, page size: 100000 - master list distance cutoff = 3.9641 - ghost atom cutoff = 3.9641 - binsize = 1.98205, bins = 10 10 10 + master list distance cutoff = 3.9641016 + ghost atom cutoff = 3.9641016 + binsize = 1.9820508, bins = 10 10 10 1 neighbor lists, perpetual/occasional/extra = 1 0 0 (1) pair body/rounded/polyhedron, perpetual attributes: half, newton on pair build: half/bin/atomonly/newton - stencil: half/bin/3d/newton + stencil: half/bin/3d bin: standard -Per MPI rank memory allocation (min/avg/max) = 4.879 | 5.068 | 5.256 Mbytes -Step KinEng PotEng TotEng c_p2 c_1_temp - 0 1.7666667 0 1.7666667 0.01090535 0.59439252 - 1000 3.1462962 0.17392649 3.3202227 0.02361912 1.1654694 - 2000 2.9311648 0.13836102 3.0695258 0.021748224 1.1950624 - 3000 3.090491 0.16511199 3.255603 0.018691142 1.23672 - 4000 2.7401565 0.17792155 2.9180781 0.015093853 1.1180839 - 5000 3.0880849 0.17587085 3.2639557 0.030563042 1.2831154 - 6000 3.2180776 0.19732251 3.4154001 0.028338151 1.258839 - 7000 2.9514882 0.25088882 3.202377 0.025296925 1.1746326 - 8000 3.0101226 0.28825968 3.2983823 0.027273454 1.2138056 - 9000 3.0164253 0.1901733 3.2065986 0.033228915 1.3095914 - 10000 2.3780401 0.34082434 2.7188644 0.031838531 1.0208679 -Loop time of 25.5798 on 4 procs for 10000 steps with 54 atoms +Per MPI rank memory allocation (min/avg/max) = 5.901 | 5.902 | 5.904 Mbytes + Step KinEng PotEng TotEng c_p2 c_1_temp + 0 1.7666667 0 1.7666667 0.01090535 0.59439252 + 1000 3.1462962 0.17392649 3.3202227 0.02361912 1.1654694 + 2000 2.9311648 0.13836102 3.0695258 0.021748224 1.1950624 + 3000 3.090491 0.16511199 3.255603 0.018691142 1.23672 + 4000 2.7401565 0.17792155 2.9180781 0.015093853 1.1180839 + 5000 3.0880849 0.17587085 3.2639557 0.030563042 1.2831154 + 6000 3.2180776 0.19732251 3.4154001 0.028338151 1.258839 + 7000 2.9514882 0.25088882 3.202377 0.025296925 1.1746326 + 8000 3.0101226 0.28825968 3.2983823 0.027273454 1.2138056 + 9000 3.0164253 0.1901733 3.2065986 0.033228915 1.3095914 + 10000 2.3780401 0.34082434 2.7188644 0.031838531 1.0208679 +Loop time of 16.4904 on 4 procs for 10000 steps with 54 atoms -Performance: 33776.718 tau/day, 390.934 timesteps/s -97.1% CPU use with 4 MPI tasks x 1 OpenMP threads +Performance: 52394.037 tau/day, 606.412 timesteps/s, 32.746 katom-step/s +95.4% CPU use with 4 MPI tasks x 1 OpenMP threads MPI task timing breakdown: Section | min time | avg time | max time |%varavg| %total --------------------------------------------------------------- -Pair | 9.256 | 13.423 | 24.653 | 177.1 | 52.47 -Neigh | 0.0021949 | 0.0024942 | 0.0031152 | 0.7 | 0.01 -Comm | 0.73678 | 11.948 | 16.096 | 187.4 | 46.71 -Output | 0.00023246 | 0.00041932 | 0.0009768 | 0.0 | 0.00 -Modify | 0.12505 | 0.15661 | 0.18165 | 6.0 | 0.61 -Other | | 0.04968 | | | 0.19 +Pair | 5.8583 | 8.5985 | 15.966 | 145.2 | 52.14 +Neigh | 0.00098311 | 0.0011219 | 0.0014163 | 0.5 | 0.01 +Comm | 0.39088 | 7.7607 | 10.504 | 152.9 | 47.06 +Output | 0.00016175 | 0.00044056 | 0.0012766 | 0.0 | 0.00 +Modify | 0.084729 | 0.094756 | 0.10558 | 2.8 | 0.57 +Other | | 0.0349 | | | 0.21 -Nlocal: 13.5 ave 17 max 9 min +Nlocal: 13.5 ave 17 max 9 min Histogram: 1 0 0 1 0 0 0 0 1 1 -Nghost: 63.5 ave 68 max 58 min +Nghost: 63.5 ave 68 max 58 min Histogram: 1 0 0 1 0 0 0 0 0 2 -Neighs: 25 ave 38 max 6 min +Neighs: 25 ave 38 max 6 min Histogram: 1 0 0 0 0 1 0 0 1 1 Total # of neighbors = 100 -Ave neighs/atom = 1.85185 +Ave neighs/atom = 1.8518519 Neighbor list builds = 268 Dangerous builds = 0 -Total wall time: 0:00:25 +Total wall time: 0:00:16 diff --git a/examples/body/log.14Jun23.pour3d.g++.1 b/examples/body/log.14Jun23.pour3d.g++.1 new file mode 100644 index 0000000000..3bca25ee6b --- /dev/null +++ b/examples/body/log.14Jun23.pour3d.g++.1 @@ -0,0 +1,148 @@ +LAMMPS (28 Mar 2023 - Development) + using 1 OpenMP thread(s) per MPI task +# pouring 3d rounded polyhedron bodies + +variable steps index 6000 + +units lj +boundary p p fm +comm_modify vel yes + +atom_style body rounded/polyhedron 1 8 +atom_modify map array + +region reg block 0 50 0 50 0 50 units box +create_box 4 reg +Created orthogonal box = (0 0 0) to (50 50 50) + 1 by 1 by 1 MPI processor grid + +variable cut_inner equal 0.5 +variable k_n equal 100 +variable k_na equal 5 +variable c_n equal 20 +variable c_t equal 5 +variable mu equal 0 +variable A_ua equal 1 + +pair_style body/rounded/polyhedron ${c_n} ${c_t} ${mu} ${A_ua} ${cut_inner} +pair_style body/rounded/polyhedron 20 ${c_t} ${mu} ${A_ua} ${cut_inner} +pair_style body/rounded/polyhedron 20 5 ${mu} ${A_ua} ${cut_inner} +pair_style body/rounded/polyhedron 20 5 0 ${A_ua} ${cut_inner} +pair_style body/rounded/polyhedron 20 5 0 1 ${cut_inner} +pair_style body/rounded/polyhedron 20 5 0 1 0.5 +pair_coeff * * ${k_n} ${k_na} +pair_coeff * * 100 ${k_na} +pair_coeff * * 100 5 + +neighbor 0.5 bin +neigh_modify every 1 delay 0 check yes + +timestep 0.001 + +fix 1 all nve/body +fix 2 all gravity 1.0 spherical 0.0 -180.0 + +molecule object molecule.cube molecule.tetra toff 1 molecule.rod3d toff 2 molecule.point3d toff 3 +Read molecule template object: + 1 molecules + 0 fragments + 1 atoms with max type 1 + 0 bonds with max type 0 + 0 angles with max type 0 + 0 dihedrals with max type 0 + 0 impropers with max type 0 +Read molecule template object: + 1 molecules + 0 fragments + 1 atoms with max type 2 + 0 bonds with max type 0 + 0 angles with max type 0 + 0 dihedrals with max type 0 + 0 impropers with max type 0 +Read molecule template object: + 1 molecules + 0 fragments + 1 atoms with max type 3 + 0 bonds with max type 0 + 0 angles with max type 0 + 0 dihedrals with max type 0 + 0 impropers with max type 0 +Read molecule template object: + 1 molecules + 0 fragments + 1 atoms with max type 4 + 0 bonds with max type 0 + 0 angles with max type 0 + 0 dihedrals with max type 0 + 0 impropers with max type 0 + +region slab block 5 45 5 45 25 35 units box +fix ins all pour 500 0 4767548 vol 0.4 10 region slab mol object molfrac 0.25 0.25 0.25 0.25 +Particle insertion: 134 every 4472 steps, 500 by step 13417 + +fix 4 all wall/body/polyhedron 2000 50 50 zplane 0.0 NULL + +#compute 1 all body/local type 1 2 3 +#dump 1 all local 1000 dump.polyhedron index c_1[1] c_1[2] c_1[3] c_1[4] +#dump 10 all custom 1000 tmp.dump id type x y z radius + +thermo_style custom step atoms ke pe etotal press + +thermo 1000 + +#dump 2 all image 500 image.*.jpg type type # zoom 1.5 adiam 1.5 body type 0 0 view 75 15 +#dump_modify 2 pad 6 + +run ${steps} +run 6000 +Generated 0 of 6 mixed pair_coeff terms from geometric mixing rule +Neighbor list info ... + update: every = 1 steps, delay = 0 steps, check = yes + max neighbors/atom: 2000, page size: 100000 + master list distance cutoff = 5 + ghost atom cutoff = 5 + binsize = 2.5, bins = 20 20 20 + 1 neighbor lists, perpetual/occasional/extra = 1 0 0 + (1) pair body/rounded/polyhedron, perpetual + attributes: half, newton on + pair build: half/bin/atomonly/newton + stencil: half/bin/3d + bin: standard +Per MPI rank memory allocation (min/avg/max) = 0.508 | 0.508 | 0.508 Mbytes + Step Atoms KinEng PotEng TotEng Press + 0 0 -0 0 0 0 + 1000 134 -0 0.0038737172 0.0038737172 -3.395325e-06 + 2000 134 -0 -0.0009235483 -0.0009235483 -6.5977025e-07 + 3000 134 -0 0.004338364 0.004338364 -1.4565607e-05 + 4000 134 -0 0.0028464278 0.0028464278 -7.6723299e-06 + 5000 268 -0 0.017425002 0.017425002 0.000175191 + 6000 268 -0 0.035730061 0.035730061 0.00019697961 +Loop time of 0.432886 on 1 procs for 6000 steps with 268 atoms + +Performance: 1197543.331 tau/day, 13860.455 timesteps/s, 3.715 Matom-step/s +99.8% CPU use with 1 MPI tasks x 1 OpenMP threads + +MPI task timing breakdown: +Section | min time | avg time | max time |%varavg| %total +--------------------------------------------------------------- +Pair | 0.29261 | 0.29261 | 0.29261 | 0.0 | 67.59 +Neigh | 0.0040123 | 0.0040123 | 0.0040123 | 0.0 | 0.93 +Comm | 0.0019937 | 0.0019937 | 0.0019937 | 0.0 | 0.46 +Output | 5.8179e-05 | 5.8179e-05 | 5.8179e-05 | 0.0 | 0.01 +Modify | 0.12864 | 0.12864 | 0.12864 | 0.0 | 29.72 +Other | | 0.005574 | | | 1.29 + +Nlocal: 268 ave 268 max 268 min +Histogram: 1 0 0 0 0 0 0 0 0 0 +Nghost: 2 ave 2 max 2 min +Histogram: 1 0 0 0 0 0 0 0 0 0 +Neighs: 95 ave 95 max 95 min +Histogram: 1 0 0 0 0 0 0 0 0 0 + +Total # of neighbors = 95 +Ave neighs/atom = 0.35447761 +Neighbor list builds = 167 +Dangerous builds = 0 + + +Total wall time: 0:00:00 diff --git a/examples/body/log.14Jun23.pour3d.g++.4 b/examples/body/log.14Jun23.pour3d.g++.4 new file mode 100644 index 0000000000..5a8206b95a --- /dev/null +++ b/examples/body/log.14Jun23.pour3d.g++.4 @@ -0,0 +1,148 @@ +LAMMPS (28 Mar 2023 - Development) + using 1 OpenMP thread(s) per MPI task +# pouring 3d rounded polyhedron bodies + +variable steps index 6000 + +units lj +boundary p p fm +comm_modify vel yes + +atom_style body rounded/polyhedron 1 8 +atom_modify map array + +region reg block 0 50 0 50 0 50 units box +create_box 4 reg +Created orthogonal box = (0 0 0) to (50 50 50) + 1 by 2 by 2 MPI processor grid + +variable cut_inner equal 0.5 +variable k_n equal 100 +variable k_na equal 5 +variable c_n equal 20 +variable c_t equal 5 +variable mu equal 0 +variable A_ua equal 1 + +pair_style body/rounded/polyhedron ${c_n} ${c_t} ${mu} ${A_ua} ${cut_inner} +pair_style body/rounded/polyhedron 20 ${c_t} ${mu} ${A_ua} ${cut_inner} +pair_style body/rounded/polyhedron 20 5 ${mu} ${A_ua} ${cut_inner} +pair_style body/rounded/polyhedron 20 5 0 ${A_ua} ${cut_inner} +pair_style body/rounded/polyhedron 20 5 0 1 ${cut_inner} +pair_style body/rounded/polyhedron 20 5 0 1 0.5 +pair_coeff * * ${k_n} ${k_na} +pair_coeff * * 100 ${k_na} +pair_coeff * * 100 5 + +neighbor 0.5 bin +neigh_modify every 1 delay 0 check yes + +timestep 0.001 + +fix 1 all nve/body +fix 2 all gravity 1.0 spherical 0.0 -180.0 + +molecule object molecule.cube molecule.tetra toff 1 molecule.rod3d toff 2 molecule.point3d toff 3 +Read molecule template object: + 1 molecules + 0 fragments + 1 atoms with max type 1 + 0 bonds with max type 0 + 0 angles with max type 0 + 0 dihedrals with max type 0 + 0 impropers with max type 0 +Read molecule template object: + 1 molecules + 0 fragments + 1 atoms with max type 2 + 0 bonds with max type 0 + 0 angles with max type 0 + 0 dihedrals with max type 0 + 0 impropers with max type 0 +Read molecule template object: + 1 molecules + 0 fragments + 1 atoms with max type 3 + 0 bonds with max type 0 + 0 angles with max type 0 + 0 dihedrals with max type 0 + 0 impropers with max type 0 +Read molecule template object: + 1 molecules + 0 fragments + 1 atoms with max type 4 + 0 bonds with max type 0 + 0 angles with max type 0 + 0 dihedrals with max type 0 + 0 impropers with max type 0 + +region slab block 5 45 5 45 25 35 units box +fix ins all pour 500 0 4767548 vol 0.4 10 region slab mol object molfrac 0.25 0.25 0.25 0.25 +Particle insertion: 134 every 4472 steps, 500 by step 13417 + +fix 4 all wall/body/polyhedron 2000 50 50 zplane 0.0 NULL + +#compute 1 all body/local type 1 2 3 +#dump 1 all local 1000 dump.polyhedron index c_1[1] c_1[2] c_1[3] c_1[4] +#dump 10 all custom 1000 tmp.dump id type x y z radius + +thermo_style custom step atoms ke pe etotal press + +thermo 1000 + +#dump 2 all image 500 image.*.jpg type type # zoom 1.5 adiam 1.5 body type 0 0 view 75 15 +#dump_modify 2 pad 6 + +run ${steps} +run 6000 +Generated 0 of 6 mixed pair_coeff terms from geometric mixing rule +Neighbor list info ... + update: every = 1 steps, delay = 0 steps, check = yes + max neighbors/atom: 2000, page size: 100000 + master list distance cutoff = 5 + ghost atom cutoff = 5 + binsize = 2.5, bins = 20 20 20 + 1 neighbor lists, perpetual/occasional/extra = 1 0 0 + (1) pair body/rounded/polyhedron, perpetual + attributes: half, newton on + pair build: half/bin/atomonly/newton + stencil: half/bin/3d + bin: standard +Per MPI rank memory allocation (min/avg/max) = 0.4666 | 0.4666 | 0.4666 Mbytes + Step Atoms KinEng PotEng TotEng Press + 0 0 -0 0 0 0 + 1000 134 -0 0.0038737172 0.0038737172 -3.395325e-06 + 2000 134 -0 -0.0009235483 -0.0009235483 -6.5977025e-07 + 3000 134 -0 0.004338364 0.004338364 -1.4565607e-05 + 4000 134 -0 0.0028464278 0.0028464278 -7.6723299e-06 + 5000 268 -0 0.017425002 0.017425002 0.000175191 + 6000 268 -0 0.035730061 0.035730061 0.00019697961 +Loop time of 0.266391 on 4 procs for 6000 steps with 268 atoms + +Performance: 1946012.521 tau/day, 22523.293 timesteps/s, 6.036 Matom-step/s +92.6% CPU use with 4 MPI tasks x 1 OpenMP threads + +MPI task timing breakdown: +Section | min time | avg time | max time |%varavg| %total +--------------------------------------------------------------- +Pair | 0.024599 | 0.072944 | 0.14627 | 18.6 | 27.38 +Neigh | 0.0011942 | 0.0013474 | 0.0014323 | 0.3 | 0.51 +Comm | 0.047438 | 0.11992 | 0.17106 | 14.8 | 45.02 +Output | 7.6297e-05 | 0.00017637 | 0.00044875 | 0.0 | 0.07 +Modify | 0.029377 | 0.035972 | 0.040396 | 2.4 | 13.50 +Other | | 0.03603 | | | 13.52 + +Nlocal: 67 ave 89 max 43 min +Histogram: 1 1 0 0 0 0 0 0 1 1 +Nghost: 38 ave 53 max 25 min +Histogram: 1 1 0 0 0 0 0 1 0 1 +Neighs: 23.75 ave 42 max 7 min +Histogram: 1 0 1 0 0 0 0 1 0 1 + +Total # of neighbors = 95 +Ave neighs/atom = 0.35447761 +Neighbor list builds = 167 +Dangerous builds = 0 + + +Total wall time: 0:00:00 diff --git a/examples/body/log.14Jun23.squares.g++.1 b/examples/body/log.14Jun23.squares.g++.1 new file mode 100644 index 0000000000..4588481dc6 --- /dev/null +++ b/examples/body/log.14Jun23.squares.g++.1 @@ -0,0 +1,226 @@ +LAMMPS (28 Mar 2023 - Development) + using 1 OpenMP thread(s) per MPI task +# 2d rounded polygon bodies + +variable r index 4 +variable steps index 100000 +variable T index 0.5 +variable P index 0.1 +variable seed index 980411 + +units lj +dimension 2 + +atom_style body rounded/polygon 1 6 +atom_modify map array +read_data data.squares +Reading data file ... + orthogonal box = (0 0 -0.5) to (12 12 0.5) + 1 by 1 by 1 MPI processor grid + reading atoms ... + 2 atoms + 2 bodies + read_data CPU = 0.001 seconds + +replicate $r $r 1 +replicate 4 $r 1 +replicate 4 4 1 +Replication is creating a 4x4x1 = 16 times larger system... + orthogonal box = (0 0 -0.5) to (48 48 0.5) + 1 by 1 by 1 MPI processor grid + 32 atoms + replicate CPU = 0.001 seconds + +velocity all create $T ${seed} dist gaussian mom yes rot yes +velocity all create 0.5 ${seed} dist gaussian mom yes rot yes +velocity all create 0.5 980411 dist gaussian mom yes rot yes + +variable cut_inner equal 0.5 +variable k_n equal 100 +variable k_na equal 2 +variable c_n equal 1 +variable c_t equal 1 +variable mu equal 0.1 +variable delta_ua equal 0.5 + +pair_style body/rounded/polygon ${c_n} ${c_t} ${mu} ${delta_ua} ${cut_inner} +pair_style body/rounded/polygon 1 ${c_t} ${mu} ${delta_ua} ${cut_inner} +pair_style body/rounded/polygon 1 1 ${mu} ${delta_ua} ${cut_inner} +pair_style body/rounded/polygon 1 1 0.1 ${delta_ua} ${cut_inner} +pair_style body/rounded/polygon 1 1 0.1 0.5 ${cut_inner} +pair_style body/rounded/polygon 1 1 0.1 0.5 0.5 +pair_coeff * * ${k_n} ${k_na} +pair_coeff * * 100 ${k_na} +pair_coeff * * 100 2 + +comm_modify vel yes + +neighbor 0.5 bin +neigh_modify every 1 delay 0 check yes + +timestep 0.001 + +#fix 1 all nve/body +#fix 1 all nvt/body temp $T $T 1.0 +fix 1 all npt/body temp $T $T 1.0 x 0.001 $P 1.0 y 0.001 $P 1.0 couple xy fixedpoint 0 0 0 +fix 1 all npt/body temp 0.5 $T 1.0 x 0.001 $P 1.0 y 0.001 $P 1.0 couple xy fixedpoint 0 0 0 +fix 1 all npt/body temp 0.5 0.5 1.0 x 0.001 $P 1.0 y 0.001 $P 1.0 couple xy fixedpoint 0 0 0 +fix 1 all npt/body temp 0.5 0.5 1.0 x 0.001 0.1 1.0 y 0.001 $P 1.0 couple xy fixedpoint 0 0 0 +fix 1 all npt/body temp 0.5 0.5 1.0 x 0.001 0.1 1.0 y 0.001 0.1 1.0 couple xy fixedpoint 0 0 0 + +fix 2 all enforce2d + +#compute 1 all body/local id 1 2 3 +#dump 1 all local 100000 dump.polygon.* index c_1[1] c_1[2] c_1[3] c_1[4] + +thermo_style custom step ke pe etotal press +thermo 1000 + +#dump 2 all image 10000 image.*.jpg type type zoom 2.0 # adiam 1.5 body type 0 0 +#dump_modify 2 pad 6 + +run ${steps} +run 100000 +Generated 0 of 0 mixed pair_coeff terms from geometric mixing rule +Neighbor list info ... + update: every = 1 steps, delay = 0 steps, check = yes + max neighbors/atom: 2000, page size: 100000 + master list distance cutoff = 6.1568542 + ghost atom cutoff = 6.1568542 + binsize = 3.0784271, bins = 16 16 1 + 1 neighbor lists, perpetual/occasional/extra = 1 0 0 + (1) pair body/rounded/polygon, perpetual + attributes: half, newton on + pair build: half/bin/atomonly/newton + stencil: half/bin/2d + bin: standard +Per MPI rank memory allocation (min/avg/max) = 5.386 | 5.386 | 5.386 Mbytes + Step KinEng PotEng TotEng Press + 0 0.484375 0.25 0.734375 0.0067274306 + 1000 0.39720235 0.0015845731 0.39878692 0.00223489 + 2000 0.42893425 0.011718891 0.44065314 0.0027413224 + 3000 0.57823511 0.012407489 0.5906426 0.0025306081 + 4000 0.71610647 0.028149437 0.74425591 0.0016504948 + 5000 0.84027279 0.018917017 0.8591898 0.0037451875 + 6000 0.72410001 0.073495378 0.79759539 0.00018672875 + 7000 0.53886484 0.077723366 0.61658821 0.004729216 + 8000 0.66196054 0.05502242 0.71698296 0.0054997323 + 9000 0.93104065 0.071628784 1.0026694 0.011330629 + 10000 0.75494389 0.15204106 0.90698495 0.021702117 + 11000 0.72349154 0.11102332 0.83451486 0.019264158 + 12000 0.56216531 0.117059 0.67922431 -0.028295891 + 13000 0.63793498 0.11701868 0.75495366 0.029470631 + 14000 0.62996509 0.020871971 0.65083706 0.0086224023 + 15000 0.6403927 0.0091092209 0.64950192 0.016897685 + 16000 0.70288045 0.046856749 0.7497372 0.02312871 + 17000 0.6820593 0.038994474 0.72105377 0.0068705173 + 18000 0.75623543 0.0069908315 0.76322626 0.025170959 + 19000 0.85962145 0.059005169 0.91862661 0.012725758 + 20000 0.73334823 0.033043489 0.76639172 0.023661433 + 21000 0.60850654 0.081277767 0.68978431 0.021031136 + 22000 0.38251144 0.27624263 0.65875407 0.047336318 + 23000 0.4288127 0.30632792 0.73514062 0.034108416 + 24000 0.4452138 0.13179024 0.57700404 0.010303821 + 25000 0.48091107 0.1816109 0.66252197 0.021201342 + 26000 0.67970784 0.088616708 0.76832455 0.034997245 + 27000 0.8223642 0.08699442 0.90935862 0.023508839 + 28000 0.60062179 0.1119578 0.71257959 -0.0010008016 + 29000 0.54629437 0.1202995 0.66659387 0.040613547 + 30000 0.28102412 0.38657163 0.66759575 -0.0086538064 + 31000 0.12433474 0.18824131 0.31257605 0.049899211 + 32000 0.089510322 0.20890679 0.29841711 0.045555094 + 33000 0.12657665 0.17720119 0.30377784 0.028306214 + 34000 0.18400652 0.17677189 0.36077841 0.034628531 + 35000 0.24048631 0.11010844 0.35059475 0.029848365 + 36000 0.33435006 0.077341882 0.41169194 0.055963098 + 37000 0.46088842 0.1210638 0.58195222 0.072006022 + 38000 0.76551752 0.07037755 0.83589507 0.018204686 + 39000 0.89388464 0.080990198 0.97487484 0.038361105 + 40000 0.65618718 0.078644754 0.73483193 0.040567246 + 41000 0.47284043 0.16391389 0.63675432 0.027523843 + 42000 0.52454668 0.057988616 0.58253529 0.03122996 + 43000 0.78769394 0.08405077 0.87174471 0.044743697 + 44000 0.92932837 0.093922981 1.0232514 0.042510479 + 45000 0.5722596 0.17607834 0.74833794 0.034646914 + 46000 0.54352389 0.085652886 0.62917677 0.033203865 + 47000 0.45608912 0.25183842 0.70792754 0.08370224 + 48000 0.47530886 0.10106466 0.57637352 0.046113986 + 49000 0.67945305 0.0065249477 0.68597799 0.054743491 + 50000 0.49661922 0.097381596 0.59400082 0.006998965 + 51000 0.60992235 0.059017331 0.66893968 0.09445106 + 52000 0.69563455 0.18702969 0.88266424 0.034154598 + 53000 0.87598532 0.18260917 1.0585945 0.065734536 + 54000 0.58822846 0.27562038 0.86384884 0.0764045 + 55000 0.43454899 0.17174441 0.6062934 0.026434052 + 56000 0.4004495 0.12778644 0.52823594 0.065986005 + 57000 0.36272102 0.09849578 0.4612168 0.064217596 + 58000 0.40987214 0.21777618 0.62764832 0.058625636 + 59000 0.64813089 0.1479689 0.79609979 0.033378701 + 60000 0.90328265 0.11049926 1.0137819 0.055828397 + 61000 0.82921839 0.074638688 0.90385707 0.062488824 + 62000 0.63223087 0.094386302 0.72661718 0.054784559 + 63000 0.62946839 0.087807829 0.71727622 0.058398323 + 64000 0.79784108 0.094756776 0.89259786 0.065765914 + 65000 0.87500942 0.13514078 1.0101502 0.068123475 + 66000 0.66961949 0.19942965 0.86904914 0.065587832 + 67000 0.61612396 0.11436282 0.73048678 0.061233427 + 68000 0.74149449 0.03129016 0.77278465 0.072517897 + 69000 0.84060202 0.027261803 0.86786382 0.063374451 + 70000 0.78182528 0.023528774 0.80535405 0.07431822 + 71000 0.71611101 0.023512727 0.73962374 0.069575276 + 72000 0.68437263 0.023941199 0.70831382 0.069821154 + 73000 0.75652323 0.023580324 0.78010355 0.075046425 + 74000 0.92077658 0.023272419 0.944049 0.070992373 + 75000 0.75277766 0.023186631 0.77596429 0.074859227 + 76000 0.59333539 0.024276648 0.61761204 0.076132037 + 77000 0.68243436 0.024600726 0.70703508 0.075525977 + 78000 0.79699751 0.024238959 0.82123647 0.078255526 + 79000 0.77318109 0.024249895 0.79743099 0.078223339 + 80000 0.72004911 0.024522473 0.74457159 0.079009398 + 81000 0.71732947 0.024702988 0.74203245 0.080902007 + 82000 0.73395391 0.024817681 0.75877159 0.081203115 + 83000 0.74389794 0.02487774 0.76877568 0.082273058 + 84000 0.73219737 0.024967311 0.75716468 0.08359401 + 85000 0.66523255 0.025299293 0.69053184 0.084260931 + 86000 0.67031201 0.02564609 0.6959581 0.085495986 + 87000 0.81345283 0.025297963 0.8387508 0.086292085 + 88000 0.85008513 0.024879647 0.87496478 0.087116741 + 89000 0.62893149 0.025674927 0.65460642 0.088514693 + 90000 0.58336052 0.026632218 0.60999274 0.089459637 + 91000 0.72615388 0.026181899 0.75233578 0.090289473 + 92000 0.76593408 0.025893082 0.79182717 0.091294308 + 93000 0.73475998 0.026113022 0.76087301 0.092256366 + 94000 0.68995562 0.026409704 0.71636532 0.093332419 + 95000 0.69491284 0.026726159 0.721639 0.094314615 + 96000 0.83274635 0.026420125 0.85916648 0.09513317 + 97000 0.85486073 0.025941089 0.88080181 0.096122793 + 98000 0.63095894 0.027021709 0.65798064 0.097348373 + 99000 0.60847495 0.027908563 0.63638351 0.098362493 + 100000 0.75867487 0.027331375 0.78600625 0.099184572 +Loop time of 3.87848 on 1 procs for 100000 steps with 32 atoms + +Performance: 2227674.150 tau/day, 25783.266 timesteps/s, 825.065 katom-step/s +97.7% CPU use with 1 MPI tasks x 1 OpenMP threads + +MPI task timing breakdown: +Section | min time | avg time | max time |%varavg| %total +--------------------------------------------------------------- +Pair | 2.9048 | 2.9048 | 2.9048 | 0.0 | 74.90 +Neigh | 0.0027304 | 0.0027304 | 0.0027304 | 0.0 | 0.07 +Comm | 0.071653 | 0.071653 | 0.071653 | 0.0 | 1.85 +Output | 0.00069287 | 0.00069287 | 0.00069287 | 0.0 | 0.02 +Modify | 0.85771 | 0.85771 | 0.85771 | 0.0 | 22.11 +Other | | 0.04088 | | | 1.05 + +Nlocal: 32 ave 32 max 32 min +Histogram: 1 0 0 0 0 0 0 0 0 0 +Nghost: 32 ave 32 max 32 min +Histogram: 1 0 0 0 0 0 0 0 0 0 +Neighs: 57 ave 57 max 57 min +Histogram: 1 0 0 0 0 0 0 0 0 0 + +Total # of neighbors = 57 +Ave neighs/atom = 1.78125 +Neighbor list builds = 1379 +Dangerous builds = 0 +Total wall time: 0:00:03 diff --git a/examples/body/log.14Jun23.squares.g++.4 b/examples/body/log.14Jun23.squares.g++.4 new file mode 100644 index 0000000000..51f1a0c7e9 --- /dev/null +++ b/examples/body/log.14Jun23.squares.g++.4 @@ -0,0 +1,226 @@ +LAMMPS (28 Mar 2023 - Development) + using 1 OpenMP thread(s) per MPI task +# 2d rounded polygon bodies + +variable r index 4 +variable steps index 100000 +variable T index 0.5 +variable P index 0.1 +variable seed index 980411 + +units lj +dimension 2 + +atom_style body rounded/polygon 1 6 +atom_modify map array +read_data data.squares +Reading data file ... + orthogonal box = (0 0 -0.5) to (12 12 0.5) + 2 by 2 by 1 MPI processor grid + reading atoms ... + 2 atoms + 2 bodies + read_data CPU = 0.001 seconds + +replicate $r $r 1 +replicate 4 $r 1 +replicate 4 4 1 +Replication is creating a 4x4x1 = 16 times larger system... + orthogonal box = (0 0 -0.5) to (48 48 0.5) + 2 by 2 by 1 MPI processor grid + 32 atoms + replicate CPU = 0.001 seconds + +velocity all create $T ${seed} dist gaussian mom yes rot yes +velocity all create 0.5 ${seed} dist gaussian mom yes rot yes +velocity all create 0.5 980411 dist gaussian mom yes rot yes + +variable cut_inner equal 0.5 +variable k_n equal 100 +variable k_na equal 2 +variable c_n equal 1 +variable c_t equal 1 +variable mu equal 0.1 +variable delta_ua equal 0.5 + +pair_style body/rounded/polygon ${c_n} ${c_t} ${mu} ${delta_ua} ${cut_inner} +pair_style body/rounded/polygon 1 ${c_t} ${mu} ${delta_ua} ${cut_inner} +pair_style body/rounded/polygon 1 1 ${mu} ${delta_ua} ${cut_inner} +pair_style body/rounded/polygon 1 1 0.1 ${delta_ua} ${cut_inner} +pair_style body/rounded/polygon 1 1 0.1 0.5 ${cut_inner} +pair_style body/rounded/polygon 1 1 0.1 0.5 0.5 +pair_coeff * * ${k_n} ${k_na} +pair_coeff * * 100 ${k_na} +pair_coeff * * 100 2 + +comm_modify vel yes + +neighbor 0.5 bin +neigh_modify every 1 delay 0 check yes + +timestep 0.001 + +#fix 1 all nve/body +#fix 1 all nvt/body temp $T $T 1.0 +fix 1 all npt/body temp $T $T 1.0 x 0.001 $P 1.0 y 0.001 $P 1.0 couple xy fixedpoint 0 0 0 +fix 1 all npt/body temp 0.5 $T 1.0 x 0.001 $P 1.0 y 0.001 $P 1.0 couple xy fixedpoint 0 0 0 +fix 1 all npt/body temp 0.5 0.5 1.0 x 0.001 $P 1.0 y 0.001 $P 1.0 couple xy fixedpoint 0 0 0 +fix 1 all npt/body temp 0.5 0.5 1.0 x 0.001 0.1 1.0 y 0.001 $P 1.0 couple xy fixedpoint 0 0 0 +fix 1 all npt/body temp 0.5 0.5 1.0 x 0.001 0.1 1.0 y 0.001 0.1 1.0 couple xy fixedpoint 0 0 0 + +fix 2 all enforce2d + +#compute 1 all body/local id 1 2 3 +#dump 1 all local 100000 dump.polygon.* index c_1[1] c_1[2] c_1[3] c_1[4] + +thermo_style custom step ke pe etotal press +thermo 1000 + +#dump 2 all image 10000 image.*.jpg type type zoom 2.0 # adiam 1.5 body type 0 0 +#dump_modify 2 pad 6 + +run ${steps} +run 100000 +Generated 0 of 0 mixed pair_coeff terms from geometric mixing rule +Neighbor list info ... + update: every = 1 steps, delay = 0 steps, check = yes + max neighbors/atom: 2000, page size: 100000 + master list distance cutoff = 6.1568542 + ghost atom cutoff = 6.1568542 + binsize = 3.0784271, bins = 16 16 1 + 1 neighbor lists, perpetual/occasional/extra = 1 0 0 + (1) pair body/rounded/polygon, perpetual + attributes: half, newton on + pair build: half/bin/atomonly/newton + stencil: half/bin/2d + bin: standard +Per MPI rank memory allocation (min/avg/max) = 5.379 | 5.379 | 5.379 Mbytes + Step KinEng PotEng TotEng Press + 0 0.484375 0.25 0.734375 0.0067274306 + 1000 0.39720235 0.0015845731 0.39878692 0.00223489 + 2000 0.42893425 0.011718891 0.44065314 0.0027413224 + 3000 0.57823511 0.012407489 0.5906426 0.0025306081 + 4000 0.71610647 0.028149437 0.74425591 0.0016504948 + 5000 0.84027279 0.018917017 0.8591898 0.0037451875 + 6000 0.72410001 0.073495378 0.79759539 0.00018672875 + 7000 0.53886484 0.077723366 0.61658821 0.004729216 + 8000 0.66196054 0.05502242 0.71698296 0.0054997327 + 9000 0.93104065 0.071628784 1.0026694 0.011330629 + 10000 0.75494389 0.15204106 0.90698496 0.021702127 + 11000 0.72349155 0.11102332 0.83451487 0.019264192 + 12000 0.56216536 0.11705898 0.67922434 -0.028296196 + 13000 0.63793556 0.11701866 0.75495421 0.029469295 + 14000 0.62999448 0.020866813 0.65086129 0.008609569 + 15000 0.6404504 0.0090011224 0.64945152 0.01706906 + 16000 0.70195749 0.044735201 0.74669269 0.0179597 + 17000 0.69097976 0.03894214 0.72992191 0.015704476 + 18000 0.75303457 0.0019263825 0.75496095 0.021536711 + 19000 0.6459718 0.10419136 0.75016317 0.033861092 + 20000 0.73026363 0.13023974 0.86050337 0.022207497 + 21000 0.77107035 0.30464112 1.0757115 0.013967631 + 22000 0.44134768 0.22883887 0.67018655 0.014202518 + 23000 0.53410601 0.16702381 0.70112983 0.009305779 + 24000 0.5144312 0.19041122 0.70484242 -0.0059836303 + 25000 0.60922681 0.15475207 0.76397888 0.016370526 + 26000 0.70922367 0.25374443 0.9629681 0.027301754 + 27000 0.67289133 0.39287626 1.0657676 0.025562031 + 28000 0.62112601 0.017177715 0.63830372 0.018556767 + 29000 0.56492546 0.087573524 0.65249898 0.025132036 + 30000 0.62612507 -0.01835118 0.60777389 0.050139664 + 31000 0.69157641 0.064849873 0.75642628 0.033954585 + 32000 0.72648211 0.08597545 0.81245756 0.038082388 + 33000 0.58608821 0.13013111 0.71621932 0.054766043 + 34000 0.49330983 0.080490598 0.57380043 0.034154681 + 35000 0.54570666 0.075020466 0.62072713 0.03879264 + 36000 0.60305736 0.10717781 0.71023516 0.030701059 + 37000 0.52801767 0.12516316 0.65318083 0.007411688 + 38000 0.5838277 0.12569072 0.70951842 0.03272916 + 39000 0.53999819 0.043261294 0.58325949 0.084115917 + 40000 0.64957099 0.040023268 0.68959426 0.027021958 + 41000 0.59235949 0.10449793 0.69685742 0.045773377 + 42000 0.71752786 0.043289363 0.76081722 0.040926021 + 43000 0.78581005 0.024363927 0.81017398 0.034694164 + 44000 0.6396541 0.06004252 0.69969662 0.037227348 + 45000 0.35753293 0.11456039 0.47209332 0.033569048 + 46000 0.11031158 0.11831834 0.22862991 0.076545681 + 47000 0.11720754 0.035471414 0.15267896 0.022093929 + 48000 0.13370328 0.031802339 0.16550562 0.053298269 + 49000 0.2700883 0.15584422 0.42593252 0.057108168 + 50000 0.53837779 0.13398219 0.67235998 0.047704986 + 51000 0.38133073 0.011372933 0.39270366 0.04696367 + 52000 0.32448241 0.009137008 0.33361942 0.033573259 + 53000 0.25798301 -0.016530605 0.2414524 0.04623663 + 54000 0.2842707 0.054504088 0.33877479 0.03751156 + 55000 0.28895106 0.025307766 0.31425882 0.03935955 + 56000 0.19130753 0.099678989 0.29098652 0.051888728 + 57000 0.12237303 0.057536458 0.17990949 0.09984021 + 58000 0.17962003 0.012450682 0.19207072 0.028644351 + 59000 0.21667262 -0.013693164 0.20297945 0.048086277 + 60000 0.4298123 -0.012970819 0.41684148 0.019347498 + 61000 0.69591654 -0.027048452 0.66886809 0.069793861 + 62000 1.0040382 -0.044228622 0.95980957 0.056563167 + 63000 0.78189663 -0.053045577 0.72885106 0.059491526 + 64000 0.57051419 -0.050757181 0.51975701 0.061863162 + 65000 0.62584243 -0.050616328 0.5752261 0.068924362 + 66000 0.85558894 -0.051396155 0.80419278 0.059309337 + 67000 0.86314978 -0.052635701 0.81051408 0.071855924 + 68000 0.65427495 -0.05147951 0.60279544 0.064001735 + 69000 0.60658011 -0.050623824 0.55595629 0.0715805 + 70000 0.76353932 -0.050863795 0.71267553 0.06771349 + 71000 0.87559332 -0.051720153 0.82387317 0.071884106 + 72000 0.71924774 -0.051167456 0.66808029 0.071010747 + 73000 0.6100998 -0.050025233 0.56007457 0.073319802 + 74000 0.71838075 -0.049907287 0.66847346 0.07314982 + 75000 0.91863251 -0.051069435 0.86756308 0.07493433 + 76000 0.78459189 -0.050803207 0.73378868 0.075397431 + 77000 0.70827012 -0.049701237 0.65856888 0.076901086 + 78000 0.72333497 -0.04940986 0.67392511 0.077456938 + 79000 0.76543474 -0.049588137 0.7158466 0.078792278 + 80000 0.77759003 -0.049596899 0.72799313 0.079470668 + 81000 0.67474562 -0.048929658 0.62581596 0.080740407 + 82000 0.60162355 -0.047698966 0.55392459 0.081758686 + 83000 0.7602675 -0.047827179 0.71244032 0.082547083 + 84000 0.9061851 -0.049481366 0.85670374 0.083443845 + 85000 0.74071256 -0.048645397 0.69206717 0.084605474 + 86000 0.67634638 -0.046894309 0.62945207 0.085608904 + 87000 0.71669859 -0.046524067 0.67017453 0.086561551 + 88000 0.77025498 -0.047090994 0.72316398 0.087515495 + 89000 0.76590655 -0.047083362 0.71882319 0.088522842 + 90000 0.61372503 -0.045529779 0.56819526 0.08963777 + 91000 0.58583927 -0.043777544 0.54206173 0.093090208 + 92000 0.80507421 -0.04423346 0.76084075 0.093861418 + 93000 0.84631942 -0.046878171 0.79944125 0.093279847 + 94000 0.70915593 -0.04570489 0.66345104 0.092425564 + 95000 0.66813988 -0.043460537 0.62467934 0.093467021 + 96000 0.71739316 -0.042402374 0.67499079 0.095183179 + 97000 0.74132854 -0.042457291 0.69887124 0.096665917 + 98000 0.74033914 -0.042269007 0.69807013 0.097869908 + 99000 0.72447372 -0.041519159 0.68295457 0.098825459 + 100000 0.6968193 -0.040321034 0.65649827 0.099797629 +Loop time of 2.55809 on 4 procs for 100000 steps with 32 atoms + +Performance: 3377521.712 tau/day, 39091.686 timesteps/s, 1.251 Matom-step/s +91.9% CPU use with 4 MPI tasks x 1 OpenMP threads + +MPI task timing breakdown: +Section | min time | avg time | max time |%varavg| %total +--------------------------------------------------------------- +Pair | 0.53547 | 0.78258 | 1.0169 | 21.0 | 30.59 +Neigh | 0.0010868 | 0.0011973 | 0.0013608 | 0.3 | 0.05 +Comm | 0.57019 | 0.78963 | 1.0091 | 19.2 | 30.87 +Output | 0.00075581 | 0.0030547 | 0.0098741 | 7.1 | 0.12 +Modify | 0.80723 | 0.81855 | 0.83849 | 1.3 | 32.00 +Other | | 0.1631 | | | 6.37 + +Nlocal: 8 ave 12 max 2 min +Histogram: 1 0 0 0 0 0 1 0 1 1 +Nghost: 15.25 ave 19 max 13 min +Histogram: 1 1 0 1 0 0 0 0 0 1 +Neighs: 12 ave 18 max 1 min +Histogram: 1 0 0 0 0 0 0 1 1 1 + +Total # of neighbors = 48 +Ave neighs/atom = 1.5 +Neighbor list builds = 1420 +Dangerous builds = 0 +Total wall time: 0:00:02 diff --git a/examples/body/log.14Jun23.wall2d.g++.1 b/examples/body/log.14Jun23.wall2d.g++.1 new file mode 100644 index 0000000000..dd54f37c03 --- /dev/null +++ b/examples/body/log.14Jun23.wall2d.g++.1 @@ -0,0 +1,229 @@ +LAMMPS (28 Mar 2023 - Development) + using 1 OpenMP thread(s) per MPI task +# 2d rounded polygon bodies + +variable r index 4 +variable steps index 100000 +variable T index 0.5 +variable P index 0.1 +variable seed index 980411 + +units lj +dimension 2 + +atom_style body rounded/polygon 1 6 +atom_modify map array +read_data data.squares +Reading data file ... + orthogonal box = (0 0 -0.5) to (12 12 0.5) + 1 by 1 by 1 MPI processor grid + reading atoms ... + 2 atoms + 2 bodies + read_data CPU = 0.001 seconds + +replicate $r $r 1 +replicate 4 $r 1 +replicate 4 4 1 +Replication is creating a 4x4x1 = 16 times larger system... + orthogonal box = (0 0 -0.5) to (48 48 0.5) + 1 by 1 by 1 MPI processor grid + 32 atoms + replicate CPU = 0.001 seconds + +velocity all create $T ${seed} dist gaussian mom yes rot yes +velocity all create 0.5 ${seed} dist gaussian mom yes rot yes +velocity all create 0.5 980411 dist gaussian mom yes rot yes + +change_box all boundary p f p +Changing box ... + +variable cut_inner equal 0.5 +variable k_n equal 100 +variable k_na equal 2 +variable c_n equal 0.1 +variable c_t equal 0.1 +variable mu equal 0.1 +variable delta_ua equal 0.5 + +pair_style body/rounded/polygon ${c_n} ${c_t} ${mu} ${delta_ua} ${cut_inner} +pair_style body/rounded/polygon 0.1 ${c_t} ${mu} ${delta_ua} ${cut_inner} +pair_style body/rounded/polygon 0.1 0.1 ${mu} ${delta_ua} ${cut_inner} +pair_style body/rounded/polygon 0.1 0.1 0.1 ${delta_ua} ${cut_inner} +pair_style body/rounded/polygon 0.1 0.1 0.1 0.5 ${cut_inner} +pair_style body/rounded/polygon 0.1 0.1 0.1 0.5 0.5 +pair_coeff * * ${k_n} ${k_na} +pair_coeff * * 100 ${k_na} +pair_coeff * * 100 2 + +comm_modify vel yes + +neighbor 0.5 bin +neigh_modify every 1 delay 0 check yes + +timestep 0.001 + +#fix 1 all nve/body +#fix 1 all nvt/body temp $T $T 1.0 +fix 1 all npt/body temp $T $T 1.0 x 0.001 $P 1.0 fixedpoint 0 0 0 +fix 1 all npt/body temp 0.5 $T 1.0 x 0.001 $P 1.0 fixedpoint 0 0 0 +fix 1 all npt/body temp 0.5 0.5 1.0 x 0.001 $P 1.0 fixedpoint 0 0 0 +fix 1 all npt/body temp 0.5 0.5 1.0 x 0.001 0.1 1.0 fixedpoint 0 0 0 + +fix 2 all enforce2d +fix 3 all wall/body/polygon 2000 50 50 yplane 0.0 48.0 + +#compute 1 all body/local id 1 2 3 +#dump 1 all local 100000 dump.polygon.* index c_1[1] c_1[2] c_1[3] c_1[4] + +thermo_style custom step ke pe etotal press +thermo 1000 + +#dump 2 all image 10000 image.*.jpg type type zoom 2.0 # adiam 1.5 body type 0 0 +#dump_modify 2 pad 6 + +run ${steps} +run 100000 +Generated 0 of 0 mixed pair_coeff terms from geometric mixing rule +Neighbor list info ... + update: every = 1 steps, delay = 0 steps, check = yes + max neighbors/atom: 2000, page size: 100000 + master list distance cutoff = 6.1568542 + ghost atom cutoff = 6.1568542 + binsize = 3.0784271, bins = 16 16 1 + 1 neighbor lists, perpetual/occasional/extra = 1 0 0 + (1) pair body/rounded/polygon, perpetual + attributes: half, newton on + pair build: half/bin/atomonly/newton + stencil: half/bin/2d + bin: standard +Per MPI rank memory allocation (min/avg/max) = 5.376 | 5.376 | 5.376 Mbytes + Step KinEng PotEng TotEng Press + 0 0.484375 0.25 0.734375 0.0067274306 + 1000 0.51464289 0.00099012638 0.51563301 0.013444625 + 2000 0.55653313 0.0040982283 0.56063136 0.0034505512 + 3000 0.75323998 0.023578898 0.77681887 0.0036652891 + 4000 0.70044978 0.092406287 0.79285607 0.0089262842 + 5000 0.54548803 0.096501313 0.64198934 0.0051379523 + 6000 0.48208829 0.097798861 0.57988715 0.015298049 + 7000 0.68219182 0.038843941 0.72103576 0.016842202 + 8000 0.53792445 0.012983807 0.55090825 0.0066797902 + 9000 0.49980359 0.029397948 0.52920154 0.0046731993 + 10000 0.48705779 0.10138799 0.58844578 -1.9696743e-05 + 11000 0.52151792 0.065893508 0.58741142 0.0049365175 + 12000 0.59066419 0.039261015 0.62992521 0.001420608 + 13000 0.46059009 0.07386532 0.53445541 0.005654565 + 14000 0.37899234 0.13421331 0.51320565 0.0097199047 + 15000 0.49566894 0.052006844 0.54767578 0.00053157628 + 16000 0.59294062 0.028393451 0.62133407 0.0057809461 + 17000 0.51260882 0.1266054 0.63921422 0.0021637817 + 18000 0.45603179 0.15710959 0.61314138 0.017707488 + 19000 0.52137969 0.1123825 0.63376219 0.015894031 + 20000 0.64553686 0.11579772 0.76133459 0.013239309 + 21000 0.38581837 0.17867419 0.56449256 0.0048572535 + 22000 0.42776514 0.12979071 0.55755585 0.008093469 + 23000 0.490055 0.14197765 0.63203265 -0.003575896 + 24000 0.57689881 0.10164831 0.67854712 0.022418321 + 25000 0.45630031 0.057905852 0.51420616 0.007959034 + 26000 0.59497685 0.193113 0.78808985 0.0076331679 + 27000 0.40943362 0.098595954 0.50802958 0.0016863757 + 28000 0.34512273 0.15696637 0.50208909 0.037435926 + 29000 0.59187862 0.1845377 0.77641632 0.014563665 + 30000 0.69204623 0.16392147 0.8559677 0.031708423 + 31000 0.40436029 0.34429435 0.74865464 0.073818847 + 32000 0.47580383 0.22708448 0.70288831 0.015795198 + 33000 0.48923447 0.23636413 0.72559861 0.025932606 + 34000 0.51960128 0.15145893 0.67106021 -0.00079607564 + 35000 0.44792834 0.19927109 0.64719943 -0.0063461505 + 36000 0.54265821 0.17924788 0.72190609 0.017916439 + 37000 0.56020344 0.24977507 0.80997851 0.057844411 + 38000 0.28874871 0.21399353 0.50274224 0.022675277 + 39000 0.39030236 0.30170176 0.69200411 0.037482614 + 40000 0.4699469 0.20663643 0.67658333 -0.014082215 + 41000 0.50202447 0.21510708 0.71713155 -0.0063284222 + 42000 0.43029593 0.23511818 0.6654141 0.046478372 + 43000 0.41628842 0.21031596 0.62660438 -0.0053073644 + 44000 0.51101573 0.15862165 0.66963738 0.010251868 + 45000 0.56984114 0.18071709 0.75055823 0.021333409 + 46000 0.45510513 0.15385488 0.60896001 0.048441048 + 47000 0.41229547 0.20577222 0.61806769 0.027485704 + 48000 0.64114797 0.33672519 0.97787315 0.13522091 + 49000 0.44298056 0.27708867 0.72006923 0.026660315 + 50000 0.43250082 0.17778506 0.61028588 0.02714938 + 51000 0.59697891 0.25460003 0.85157894 0.026959715 + 52000 0.63110331 0.21528376 0.84638707 0.023157155 + 53000 0.46085491 0.25375607 0.71461099 0.024933391 + 54000 0.50772891 0.29280628 0.80053519 0.010621547 + 55000 0.67213557 0.2071375 0.87927307 0.061770903 + 56000 0.61184167 0.34686662 0.95870829 0.095262009 + 57000 0.42364554 0.29899934 0.72264488 -0.0080865129 + 58000 0.5033641 0.39810693 0.90147103 0.081474225 + 59000 0.61363438 0.25296035 0.86659472 0.041921315 + 60000 0.64600872 0.36997737 1.0159861 0.053833686 + 61000 0.43392277 0.29276613 0.7266889 0.054911225 + 62000 0.38910577 0.27714798 0.66625375 -0.0141031 + 63000 0.42343097 0.21637816 0.63980913 -1.6862315e-05 + 64000 0.52512516 0.38797726 0.91310242 0.03170217 + 65000 0.48930994 0.4863269 0.97563684 0.025108671 + 66000 0.68354817 0.3629732 1.0465214 0.066714362 + 67000 0.5361863 0.44003399 0.97622029 0.1063525 + 68000 0.3605148 0.40138904 0.76190383 0.03287684 + 69000 0.62747502 0.49229352 1.1197685 0.053648724 + 70000 0.51326037 0.36561885 0.87887922 0.070871008 + 71000 0.45429341 0.38458357 0.83887698 0.010485881 + 72000 0.55377877 0.36434231 0.91812107 0.10507819 + 73000 0.6857324 0.45242968 1.1381621 0.022470322 + 74000 0.46349397 0.39082798 0.85432196 0.067650912 + 75000 0.59216869 0.32893138 0.92110008 0.0196582 + 76000 0.42985327 0.40674342 0.83659669 0.025700762 + 77000 0.54319568 0.55627833 1.099474 0.067233159 + 78000 0.59244798 0.5121155 1.1045635 0.12063624 + 79000 0.61140864 0.45505083 1.0664595 0.088578795 + 80000 0.64308346 0.4143502 1.0574337 0.038537249 + 81000 0.55053046 0.43357659 0.98410705 0.053930256 + 82000 0.54049882 0.41354335 0.95404217 -0.036458392 + 83000 0.47517728 0.30128468 0.77646196 0.0019488841 + 84000 0.57452781 0.1949493 0.76947711 0.039244382 + 85000 0.7907368 0.51406164 1.3047984 0.12766082 + 86000 0.59488507 0.50084726 1.0957323 0.080232158 + 87000 0.43071262 0.4682738 0.89898642 0.1266876 + 88000 0.53305256 0.55941308 1.0924656 0.17062068 + 89000 0.60672487 0.64951209 1.256237 0.17194524 + 90000 0.7134227 0.57323404 1.2866567 0.074617282 + 91000 0.65670871 0.58567381 1.2423825 0.025281565 + 92000 0.72364891 0.59755693 1.3212058 0.092201188 + 93000 0.69254418 0.75766186 1.450206 0.16036111 + 94000 0.56326058 0.6398442 1.2031048 0.26280736 + 95000 0.47480145 0.57734551 1.052147 0.039940021 + 96000 0.56909151 0.73081903 1.2999105 0.030223516 + 97000 0.53198039 0.71808155 1.2500619 0.033191485 + 98000 0.63572731 0.86931519 1.5050425 0.20901135 + 99000 0.64477038 0.76771721 1.4124876 0.059732095 + 100000 0.71275398 0.66613673 1.3788907 0.020038364 +Loop time of 2.21223 on 1 procs for 100000 steps with 32 atoms + +Performance: 3905566.671 tau/day, 45203.318 timesteps/s, 1.447 Matom-step/s +96.4% CPU use with 1 MPI tasks x 1 OpenMP threads + +MPI task timing breakdown: +Section | min time | avg time | max time |%varavg| %total +--------------------------------------------------------------- +Pair | 1.1162 | 1.1162 | 1.1162 | 0.0 | 50.45 +Neigh | 0.0049629 | 0.0049629 | 0.0049629 | 0.0 | 0.22 +Comm | 0.045069 | 0.045069 | 0.045069 | 0.0 | 2.04 +Output | 0.00060169 | 0.00060169 | 0.00060169 | 0.0 | 0.03 +Modify | 1.0017 | 1.0017 | 1.0017 | 0.0 | 45.28 +Other | | 0.04368 | | | 1.97 + +Nlocal: 32 ave 32 max 32 min +Histogram: 1 0 0 0 0 0 0 0 0 0 +Nghost: 19 ave 19 max 19 min +Histogram: 1 0 0 0 0 0 0 0 0 0 +Neighs: 59 ave 59 max 59 min +Histogram: 1 0 0 0 0 0 0 0 0 0 + +Total # of neighbors = 59 +Ave neighs/atom = 1.84375 +Neighbor list builds = 3214 +Dangerous builds = 0 +Total wall time: 0:00:02 diff --git a/examples/body/log.14Jun23.wall2d.g++.4 b/examples/body/log.14Jun23.wall2d.g++.4 new file mode 100644 index 0000000000..0d0005c6ef --- /dev/null +++ b/examples/body/log.14Jun23.wall2d.g++.4 @@ -0,0 +1,229 @@ +LAMMPS (28 Mar 2023 - Development) + using 1 OpenMP thread(s) per MPI task +# 2d rounded polygon bodies + +variable r index 4 +variable steps index 100000 +variable T index 0.5 +variable P index 0.1 +variable seed index 980411 + +units lj +dimension 2 + +atom_style body rounded/polygon 1 6 +atom_modify map array +read_data data.squares +Reading data file ... + orthogonal box = (0 0 -0.5) to (12 12 0.5) + 2 by 2 by 1 MPI processor grid + reading atoms ... + 2 atoms + 2 bodies + read_data CPU = 0.001 seconds + +replicate $r $r 1 +replicate 4 $r 1 +replicate 4 4 1 +Replication is creating a 4x4x1 = 16 times larger system... + orthogonal box = (0 0 -0.5) to (48 48 0.5) + 2 by 2 by 1 MPI processor grid + 32 atoms + replicate CPU = 0.001 seconds + +velocity all create $T ${seed} dist gaussian mom yes rot yes +velocity all create 0.5 ${seed} dist gaussian mom yes rot yes +velocity all create 0.5 980411 dist gaussian mom yes rot yes + +change_box all boundary p f p +Changing box ... + +variable cut_inner equal 0.5 +variable k_n equal 100 +variable k_na equal 2 +variable c_n equal 0.1 +variable c_t equal 0.1 +variable mu equal 0.1 +variable delta_ua equal 0.5 + +pair_style body/rounded/polygon ${c_n} ${c_t} ${mu} ${delta_ua} ${cut_inner} +pair_style body/rounded/polygon 0.1 ${c_t} ${mu} ${delta_ua} ${cut_inner} +pair_style body/rounded/polygon 0.1 0.1 ${mu} ${delta_ua} ${cut_inner} +pair_style body/rounded/polygon 0.1 0.1 0.1 ${delta_ua} ${cut_inner} +pair_style body/rounded/polygon 0.1 0.1 0.1 0.5 ${cut_inner} +pair_style body/rounded/polygon 0.1 0.1 0.1 0.5 0.5 +pair_coeff * * ${k_n} ${k_na} +pair_coeff * * 100 ${k_na} +pair_coeff * * 100 2 + +comm_modify vel yes + +neighbor 0.5 bin +neigh_modify every 1 delay 0 check yes + +timestep 0.001 + +#fix 1 all nve/body +#fix 1 all nvt/body temp $T $T 1.0 +fix 1 all npt/body temp $T $T 1.0 x 0.001 $P 1.0 fixedpoint 0 0 0 +fix 1 all npt/body temp 0.5 $T 1.0 x 0.001 $P 1.0 fixedpoint 0 0 0 +fix 1 all npt/body temp 0.5 0.5 1.0 x 0.001 $P 1.0 fixedpoint 0 0 0 +fix 1 all npt/body temp 0.5 0.5 1.0 x 0.001 0.1 1.0 fixedpoint 0 0 0 + +fix 2 all enforce2d +fix 3 all wall/body/polygon 2000 50 50 yplane 0.0 48.0 + +#compute 1 all body/local id 1 2 3 +#dump 1 all local 100000 dump.polygon.* index c_1[1] c_1[2] c_1[3] c_1[4] + +thermo_style custom step ke pe etotal press +thermo 1000 + +#dump 2 all image 10000 image.*.jpg type type zoom 2.0 # adiam 1.5 body type 0 0 +#dump_modify 2 pad 6 + +run ${steps} +run 100000 +Generated 0 of 0 mixed pair_coeff terms from geometric mixing rule +Neighbor list info ... + update: every = 1 steps, delay = 0 steps, check = yes + max neighbors/atom: 2000, page size: 100000 + master list distance cutoff = 6.1568542 + ghost atom cutoff = 6.1568542 + binsize = 3.0784271, bins = 16 16 1 + 1 neighbor lists, perpetual/occasional/extra = 1 0 0 + (1) pair body/rounded/polygon, perpetual + attributes: half, newton on + pair build: half/bin/atomonly/newton + stencil: half/bin/2d + bin: standard +Per MPI rank memory allocation (min/avg/max) = 5.378 | 5.378 | 5.379 Mbytes + Step KinEng PotEng TotEng Press + 0 0.484375 0.25 0.734375 0.0067274306 + 1000 0.51464289 0.00099012638 0.51563301 0.013444625 + 2000 0.55653313 0.0040982283 0.56063136 0.0034505512 + 3000 0.75323998 0.023578898 0.77681887 0.0036652891 + 4000 0.70044978 0.092406287 0.79285607 0.0089262842 + 5000 0.54548803 0.096501313 0.64198934 0.0051379522 + 6000 0.48208828 0.097798868 0.57988715 0.01529805 + 7000 0.68219182 0.038843949 0.72103577 0.016842202 + 8000 0.53792445 0.01298383 0.55090828 0.0066797984 + 9000 0.49980358 0.029397965 0.52920155 0.0046731992 + 10000 0.48705755 0.10138831 0.58844586 -1.9690665e-05 + 11000 0.52151879 0.065897951 0.58741674 0.0049324908 + 12000 0.59065198 0.03929683 0.62994881 0.0014198454 + 13000 0.46076897 0.073363984 0.53413295 0.0057849056 + 14000 0.38058168 0.16336914 0.54395082 0.0099910111 + 15000 0.58924494 0.13219579 0.72144074 0.012781632 + 16000 0.65163924 0.10979538 0.76143462 0.015088945 + 17000 0.51431594 0.036344433 0.55066037 0.001446035 + 18000 0.42677394 0.093297234 0.52007117 0.00093775852 + 19000 0.62399853 0.13309136 0.75708989 0.0095351169 + 20000 0.52835966 0.085936455 0.61429611 0.013158115 + 21000 0.42999051 0.12857394 0.55856445 0.024369485 + 22000 0.56770038 0.19738636 0.76508675 0.024211788 + 23000 0.55137392 0.18212359 0.7334975 0.024095463 + 24000 0.6225794 0.13091248 0.75349189 0.032707954 + 25000 0.47106345 0.10241626 0.57347971 0.0059731265 + 26000 0.60567231 0.055894222 0.66156653 0.010614697 + 27000 0.49075416 0.13914345 0.62989761 0.00048442735 + 28000 0.48902573 0.21423204 0.70325777 0.021295043 + 29000 0.42728391 0.24136135 0.66864527 0.031633766 + 30000 0.64658635 0.15368867 0.80027502 0.0084616839 + 31000 0.71370199 0.18014549 0.89384748 0.02367184 + 32000 0.40141173 0.1833294 0.58474113 0.034918949 + 33000 0.55780706 0.14130843 0.69911549 0.012266172 + 34000 0.36544303 0.15788143 0.52332446 0.0084938225 + 35000 0.56844142 0.17507842 0.74351984 0.061506713 + 36000 0.5048707 0.15834563 0.66321633 0.0286909 + 37000 0.4371274 0.087735559 0.52486296 -0.0016289252 + 38000 0.49941117 0.22576207 0.72517324 0.059233327 + 39000 0.69480051 0.15465372 0.84945423 0.039061293 + 40000 0.52881719 0.29110071 0.8199179 0.032439208 + 41000 0.56931201 0.38596881 0.95528082 0.045284803 + 42000 0.46759969 0.21337568 0.68097537 0.086759715 + 43000 0.63416318 0.44687151 1.0810347 0.072272415 + 44000 0.43914666 0.20832735 0.64747401 0.026280272 + 45000 0.38329718 0.25407815 0.63737533 0.017356403 + 46000 0.59511045 0.32148788 0.91659833 -0.0076184601 + 47000 0.50635988 0.37243112 0.878791 0.025435347 + 48000 0.42316224 0.29368731 0.71684954 0.00067040329 + 49000 0.40194259 0.26659105 0.66853364 0.069225504 + 50000 0.4740342 0.305674 0.77970819 0.014813566 + 51000 0.57279011 0.32080139 0.8935915 0.0091332017 + 52000 0.54543481 0.34482955 0.89026435 -0.021131696 + 53000 0.39241519 0.36432403 0.75673922 0.0077163816 + 54000 0.62021406 0.32010094 0.940315 0.044477965 + 55000 0.45160485 0.29442122 0.74602607 0.02563201 + 56000 0.41737028 0.31207675 0.72944704 0.050342936 + 57000 0.53454189 0.29192181 0.8264637 0.068452573 + 58000 0.65449932 0.33567481 0.99017413 0.055352019 + 59000 0.58742699 0.37317432 0.96060131 0.012805462 + 60000 0.42430458 0.33744246 0.76174704 0.018744436 + 61000 0.65433333 0.40723506 1.0615684 0.019757611 + 62000 0.64472397 0.34658649 0.99131047 0.090688735 + 63000 0.65381774 0.47452792 1.1283457 0.2090513 + 64000 0.44107995 0.60507044 1.0461504 0.03144844 + 65000 0.38159186 0.45527276 0.83686462 0.090856608 + 66000 0.48842595 0.49445721 0.98288316 0.08753844 + 67000 0.65088575 0.4611542 1.11204 0.066602605 + 68000 0.5155131 0.38693864 0.90245174 0.0062596909 + 69000 0.41477899 0.45120406 0.86598306 0.037396561 + 70000 0.60305022 0.47624271 1.0792929 0.040607751 + 71000 0.67077877 0.51044906 1.1812278 0.029084971 + 72000 0.50912034 0.34340114 0.85252148 0.055767674 + 73000 0.55167778 0.43795801 0.98963579 0.083371911 + 74000 0.53603549 0.37357862 0.90961411 0.058762722 + 75000 0.47521522 0.529749 1.0049642 0.12419171 + 76000 0.48952134 0.63953611 1.1290574 0.09709472 + 77000 0.63445283 0.57542295 1.2098758 0.11868116 + 78000 0.62184463 0.60025138 1.222096 0.079417229 + 79000 0.52715665 0.54847579 1.0756324 0.033981154 + 80000 0.6264593 0.39323366 1.019693 0.05627332 + 81000 0.78582235 0.47541992 1.2612423 0.031287815 + 82000 0.69665491 0.58355423 1.2802091 -0.04433392 + 83000 0.4994351 0.40089694 0.90033204 -0.0019687817 + 84000 0.50932093 0.62716285 1.1364838 0.095177695 + 85000 0.56251638 0.56010929 1.1226257 0.013989132 + 86000 0.67155822 0.51326814 1.1848264 0.10616402 + 87000 0.61317511 0.52704394 1.140219 0.076578899 + 88000 0.57436568 0.60641096 1.1807766 0.042050421 + 89000 0.62350614 0.65896923 1.2824754 0.15949038 + 90000 0.57445242 0.65085438 1.2253068 0.034123951 + 91000 0.50043488 0.69213026 1.1925651 -0.076403957 + 92000 0.57345231 0.74801993 1.3214722 0.033715387 + 93000 0.63056204 0.64474627 1.2753083 0.051205732 + 94000 0.70948937 0.61081243 1.3203018 -0.0069457836 + 95000 0.66048722 0.61001641 1.2705036 0.16072266 + 96000 0.48720026 0.64888522 1.1360855 0.12573765 + 97000 0.41570988 0.68810987 1.1038198 -0.033070846 + 98000 0.53689925 0.83787736 1.3747766 0.098173219 + 99000 0.5147061 0.92360546 1.4383116 0.12155736 + 100000 0.5793939 0.63393822 1.2133321 0.090967465 +Loop time of 2.08698 on 4 procs for 100000 steps with 32 atoms + +Performance: 4139957.491 tau/day, 47916.175 timesteps/s, 1.533 Matom-step/s +92.1% CPU use with 4 MPI tasks x 1 OpenMP threads + +MPI task timing breakdown: +Section | min time | avg time | max time |%varavg| %total +--------------------------------------------------------------- +Pair | 0.31 | 0.33594 | 0.35254 | 2.8 | 16.10 +Neigh | 0.001991 | 0.0021241 | 0.0022581 | 0.2 | 0.10 +Comm | 0.40717 | 0.43106 | 0.46731 | 3.4 | 20.65 +Output | 0.00076842 | 0.002908 | 0.0092082 | 6.7 | 0.14 +Modify | 1.1389 | 1.1624 | 1.1753 | 1.3 | 55.70 +Other | | 0.1525 | | | 7.31 + +Nlocal: 8 ave 9 max 7 min +Histogram: 2 0 0 0 0 0 0 0 0 2 +Nghost: 14 ave 16 max 12 min +Histogram: 1 0 1 0 0 0 0 1 0 1 +Neighs: 13.25 ave 17 max 11 min +Histogram: 1 1 0 1 0 0 0 0 0 1 + +Total # of neighbors = 53 +Ave neighs/atom = 1.65625 +Neighbor list builds = 3000 +Dangerous builds = 0 +Total wall time: 0:00:02 diff --git a/examples/body/log.27Nov18.body.g++.1 b/examples/body/log.27Nov18.body.g++.1 deleted file mode 100644 index adb2c5dd6f..0000000000 --- a/examples/body/log.27Nov18.body.g++.1 +++ /dev/null @@ -1,177 +0,0 @@ -LAMMPS (27 Nov 2018) - using 1 OpenMP thread(s) per MPI task -# 2d polygon nparticle bodies - -units lj -dimension 2 -atom_style body nparticle 2 6 - -read_data data.body - orthogonal box = (-15.5322 -15.5322 -0.5) to (15.5322 15.5322 0.5) - 1 by 1 by 1 MPI processor grid - reading atoms ... - 100 atoms - 100 bodies - -velocity all create 1.44 87287 loop geom - -pair_style body/nparticle 5.0 -pair_coeff * * 1.0 1.0 - -neighbor 0.5 bin -neigh_modify every 1 delay 0 check yes - -fix 1 all nve/body -#fix 1 all nvt/body temp 1.44 1.44 1.0 -fix 2 all enforce2d - -#compute 1 all body/local type 1 2 3 -#dump 1 all local 100 dump.body index c_1[1] c_1[2] c_1[3] c_1[4] - -#dump 2 all image 1000 image.*.jpg type type # zoom 1.6 adiam 1.5 body type 1.0 0 -#dump_modify 2 pad 5 - -thermo 100 -run 10000 -Neighbor list info ... - update every 1 steps, delay 0 steps, check yes - max neighbors/atom: 2000, page size: 100000 - master list distance cutoff = 5.5 - ghost atom cutoff = 5.5 - binsize = 2.75, bins = 12 12 1 - 1 neighbor lists, perpetual/occasional/extra = 1 0 0 - (1) pair body/nparticle, perpetual - attributes: half, newton on - pair build: half/bin/atomonly/newton - stencil: half/bin/2d/newton - bin: standard -Per MPI rank memory allocation (min/avg/max) = 4.772 | 4.772 | 4.772 Mbytes -Step Temp E_pair E_mol TotEng Press - 0 1.44 -0.63799525 0 0.78760475 -0.15028724 - 100 1.642337 -1.0003869 0 0.62552682 0.16140818 - 200 1.470473 -1.2465469 0 0.20922135 0.35146925 - 300 1.4834687 -1.3464946 0 0.12213946 0.40783535 - 400 1.5075814 -1.6170041 0 -0.12449852 0.11302717 - 500 1.5681124 -1.6060641 0 -0.053632801 0.23819933 - 600 1.7129405 -1.6939468 0 0.0018642497 0.46490776 - 700 1.5803869 -1.6182998 0 -0.053716823 0.36807869 - 800 1.6454324 -1.6537709 0 -0.024792836 0.21305673 - 900 1.5454528 -1.6310447 0 -0.10104644 0.22323772 - 1000 1.7596217 -1.7290976 0 0.012927885 0.12600944 - 1100 1.3845533 -1.635035 0 -0.26432721 0.31778997 - 1200 1.6448321 -1.6985254 0 -0.070141617 0.14347958 - 1300 1.6158541 -1.581817 0 0.017878542 0.16186588 - 1400 1.4702758 -1.5210898 0 -0.065516797 0.35241206 - 1500 1.5746718 -1.5427933 0 0.016131764 0.21832857 - 1600 1.5276572 -1.6755951 0 -0.16321447 -0.046196207 - 1700 1.8182153 -1.7471337 0 0.052899504 0.14576284 - 1800 1.8054446 -1.8814075 0 -0.094017352 0.11678153 - 1900 1.6318148 -1.636557 0 -0.021060353 0.29300401 - 2000 1.6187604 -1.5563087 0 0.046264125 0.35910875 - 2100 1.8270056 -1.9189599 0 -0.11022441 -0.031374982 - 2200 1.8203075 -1.8672658 0 -0.065161309 0.38667462 - 2300 2.1336292 -1.8962621 0 0.2160309 0.13286893 - 2400 1.79223 -1.7128682 0 0.061439536 0.30570635 - 2500 1.7208941 -1.6955053 0 0.0081798834 0.24562038 - 2600 1.7755824 -1.7744614 0 -0.016634836 0.11148721 - 2700 1.7308273 -1.744062 0 -0.030542972 0.17938105 - 2800 1.7059134 -1.6131603 0 0.075694024 0.06746694 - 2900 1.7152544 -1.665102 0 0.032999854 0.14918116 - 3000 1.7917767 -1.6654545 0 0.10840436 0.22990289 - 3100 1.7153899 -1.8140872 0 -0.11585128 0.1070804 - 3200 1.5704305 -1.5645642 0 -0.0098380461 0.30331339 - 3300 1.6707504 -1.6224865 0 0.03155641 0.21402203 - 3400 1.7390711 -1.6969145 0 0.024765924 0.25633302 - 3500 1.7601895 -1.7159833 0 0.026604288 0.10350991 - 3600 1.7796243 -1.6848496 0 0.076978483 0.24287746 - 3700 1.8883198 -1.7216992 0 0.14773748 0.071179538 - 3800 1.5757461 -1.6445584 0 -0.084569808 0.23580968 - 3900 1.5509957 -1.6221122 0 -0.086626425 0.2208604 - 4000 1.7403415 -1.6515882 0 0.071349901 0.171317 - 4100 1.6394046 -1.69549 0 -0.072479406 0.18077211 - 4200 1.788413 -1.6410039 0 0.12952501 0.41737981 - 4300 1.7211754 -1.6535323 0 0.050431306 0.1688929 - 4400 1.6034779 -1.7771275 0 -0.18968442 0.091947982 - 4500 1.5692666 -1.6176359 0 -0.064061965 0.31716418 - 4600 1.6454802 -1.5764942 0 0.052531194 0.021026463 - 4700 1.4715049 -1.582096 0 -0.12530612 0.17687943 - 4800 1.5615071 -1.6276031 0 -0.081711137 0.077798682 - 4900 1.6407636 -1.622773 0 0.0015829265 0.28751203 - 5000 1.6390013 -1.7257036 0 -0.10309236 0.35133795 - 5100 1.6540912 -1.7056399 0 -0.068089648 0.52254354 - 5200 1.6438013 -1.7568895 0 -0.12952624 0.16423828 - 5300 1.6791806 -1.756297 0 -0.093908192 0.3151943 - 5400 1.7527095 -1.729977 0 0.0052053655 0.29874227 - 5500 1.7604924 -1.6920395 0 0.050847912 0.2062502 - 5600 1.8225025 -1.6746221 0 0.12965535 0.29423091 - 5700 1.6896356 -1.6591445 0 0.013594822 0.41582329 - 5800 1.575776 -1.6605307 0 -0.10051246 0.17434812 - 5900 1.6893771 -1.6046258 0 0.067857462 0.188486 - 6000 1.6506959 -1.6295482 0 0.0046407782 0.18737656 - 6100 1.8137143 -1.6634096 0 0.13216758 0.22425414 - 6200 1.6337368 -1.6016206 0 0.015778794 0.17026591 - 6300 1.6232904 -1.7102709 0 -0.10321339 0.22621086 - 6400 1.8146767 -1.7354533 0 0.061076657 0.25907309 - 6500 1.5565608 -1.8652953 0 -0.32430015 0.096916202 - 6600 1.6366532 -1.65732 0 -0.037033272 0.30276466 - 6700 1.6612051 -1.6621545 0 -0.017561423 0.16685109 - 6800 1.5574268 -1.6082827 0 -0.066430166 0.37630931 - 6900 1.6556225 -1.6744213 0 -0.035355078 0.11599545 - 7000 1.5078585 -1.6049482 0 -0.11216833 0.37716682 - 7100 1.6147622 -1.7044793 0 -0.10586467 0.48915924 - 7200 1.8022216 -1.7117836 0 0.072415791 0.24007939 - 7300 1.6302834 -1.8522784 0 -0.23829784 0.19326557 - 7400 1.7108472 -1.8993043 0 -0.20556558 0.34554364 - 7500 1.8570536 -1.7135598 0 0.12492326 0.53728185 - 7600 1.7812105 -1.7239897 0 0.039408716 0.44348124 - 7700 1.8724942 -1.7871204 0 0.066648837 0.2529344 - 7800 1.8237412 -1.6467621 0 0.15874169 0.2354529 - 7900 1.7222899 -1.7254585 0 -0.02039155 0.13271481 - 8000 1.6839 -1.5913695 0 0.075691547 0.011932379 - 8100 1.599835 -1.672507 0 -0.088670351 0.11203274 - 8200 1.8369376 -1.7464532 0 0.072115105 0.21380276 - 8300 1.9603301 -1.9121791 0 0.02854768 0.18178367 - 8400 1.7903688 -1.8798475 0 -0.10738231 0.37173469 - 8500 1.687183 -1.760587 0 -0.090275846 0.23751647 - 8600 1.6515772 -1.7918091 0 -0.15674775 0.099895142 - 8700 1.7083909 -1.7297068 0 -0.038399775 0.57093506 - 8800 1.6150569 -1.6976608 0 -0.098754502 0.15348519 - 8900 1.5452011 -1.7517421 0 -0.22199306 0.22143091 - 9000 1.7498686 -1.8569695 0 -0.12459962 0.1989093 - 9100 1.6287336 -1.7505293 0 -0.13808305 0.23881397 - 9200 1.5431194 -1.6845999 0 -0.15691169 0.10646288 - 9300 1.4900229 -1.5671955 0 -0.092072887 0.31588548 - 9400 1.523362 -1.5531592 0 -0.045030785 0.21546483 - 9500 1.5783775 -1.65292 0 -0.090326215 0.25980559 - 9600 1.9192786 -1.9303222 0 -0.030236392 -0.0046632743 - 9700 1.747544 -1.7886479 0 -0.058579385 0.38543046 - 9800 1.6713187 -1.6842507 0 -0.029645137 0.17982115 - 9900 1.7707351 -1.6638268 0 0.089200949 0.2983883 - 10000 1.6466807 -1.592436 0 0.037777866 0.12761693 -Loop time of 1.76365 on 1 procs for 10000 steps with 100 atoms - -Performance: 2449465.017 tau/day, 5670.058 timesteps/s -98.9% CPU use with 1 MPI tasks x 1 OpenMP threads - -MPI task timing breakdown: -Section | min time | avg time | max time |%varavg| %total ---------------------------------------------------------------- -Pair | 1.5533 | 1.5533 | 1.5533 | 0.0 | 88.08 -Neigh | 0.01155 | 0.01155 | 0.01155 | 0.0 | 0.65 -Comm | 0.042146 | 0.042146 | 0.042146 | 0.0 | 2.39 -Output | 0.00089574 | 0.00089574 | 0.00089574 | 0.0 | 0.05 -Modify | 0.14124 | 0.14124 | 0.14124 | 0.0 | 8.01 -Other | | 0.01448 | | | 0.82 - -Nlocal: 100 ave 100 max 100 min -Histogram: 1 0 0 0 0 0 0 0 0 0 -Nghost: 82 ave 82 max 82 min -Histogram: 1 0 0 0 0 0 0 0 0 0 -Neighs: 467 ave 467 max 467 min -Histogram: 1 0 0 0 0 0 0 0 0 0 - -Total # of neighbors = 467 -Ave neighs/atom = 4.67 -Neighbor list builds = 468 -Dangerous builds = 0 -Total wall time: 0:00:01 diff --git a/examples/body/log.27Nov18.body.g++.4 b/examples/body/log.27Nov18.body.g++.4 deleted file mode 100644 index 24ed0a5436..0000000000 --- a/examples/body/log.27Nov18.body.g++.4 +++ /dev/null @@ -1,177 +0,0 @@ -LAMMPS (27 Nov 2018) - using 1 OpenMP thread(s) per MPI task -# 2d polygon nparticle bodies - -units lj -dimension 2 -atom_style body nparticle 2 6 - -read_data data.body - orthogonal box = (-15.5322 -15.5322 -0.5) to (15.5322 15.5322 0.5) - 2 by 2 by 1 MPI processor grid - reading atoms ... - 100 atoms - 100 bodies - -velocity all create 1.44 87287 loop geom - -pair_style body/nparticle 5.0 -pair_coeff * * 1.0 1.0 - -neighbor 0.5 bin -neigh_modify every 1 delay 0 check yes - -fix 1 all nve/body -#fix 1 all nvt/body temp 1.44 1.44 1.0 -fix 2 all enforce2d - -#compute 1 all body/local type 1 2 3 -#dump 1 all local 100 dump.body index c_1[1] c_1[2] c_1[3] c_1[4] - -#dump 2 all image 1000 image.*.jpg type type # zoom 1.6 adiam 1.5 body type 1.0 0 -#dump_modify 2 pad 5 - -thermo 100 -run 10000 -Neighbor list info ... - update every 1 steps, delay 0 steps, check yes - max neighbors/atom: 2000, page size: 100000 - master list distance cutoff = 5.5 - ghost atom cutoff = 5.5 - binsize = 2.75, bins = 12 12 1 - 1 neighbor lists, perpetual/occasional/extra = 1 0 0 - (1) pair body/nparticle, perpetual - attributes: half, newton on - pair build: half/bin/atomonly/newton - stencil: half/bin/2d/newton - bin: standard -Per MPI rank memory allocation (min/avg/max) = 4.759 | 4.759 | 4.759 Mbytes -Step Temp E_pair E_mol TotEng Press - 0 1.44 -0.63799525 0 0.78760475 -0.15028724 - 100 1.642337 -1.0003869 0 0.62552682 0.16140818 - 200 1.470473 -1.2465469 0 0.20922135 0.35146925 - 300 1.4834687 -1.3464946 0 0.12213946 0.40783535 - 400 1.5075814 -1.6170041 0 -0.12449852 0.11302717 - 500 1.5681124 -1.6060641 0 -0.053632801 0.23819933 - 600 1.7129405 -1.6939468 0 0.0018642497 0.46490776 - 700 1.5803869 -1.6182998 0 -0.053716823 0.36807869 - 800 1.6454324 -1.6537709 0 -0.024792836 0.21305673 - 900 1.5454528 -1.6310447 0 -0.10104644 0.22323772 - 1000 1.7596217 -1.7290976 0 0.012927885 0.12600944 - 1100 1.3845533 -1.635035 0 -0.26432721 0.31778997 - 1200 1.6448321 -1.6985254 0 -0.070141617 0.14347958 - 1300 1.6158541 -1.581817 0 0.017878542 0.16186588 - 1400 1.4702758 -1.5210898 0 -0.065516796 0.35241206 - 1500 1.5746718 -1.5427933 0 0.016131765 0.21832856 - 1600 1.5276572 -1.6755951 0 -0.16321446 -0.046196204 - 1700 1.8182153 -1.7471336 0 0.052899516 0.14576285 - 1800 1.8054446 -1.8814074 0 -0.094017286 0.11678173 - 1900 1.6318146 -1.636557 0 -0.021060549 0.2930043 - 2000 1.6187614 -1.5563095 0 0.046264283 0.3591072 - 2100 1.8270046 -1.9189568 0 -0.11022215 -0.031366859 - 2200 1.8203171 -1.8672823 0 -0.065168391 0.38665482 - 2300 2.1336582 -1.8962717 0 0.21604988 0.13283887 - 2400 1.7923604 -1.7129915 0 0.061445317 0.30554793 - 2500 1.7207328 -1.694912 0 0.008613452 0.24608272 - 2600 1.7761079 -1.7743463 0 -0.015999568 0.11128836 - 2700 1.7327782 -1.7433093 0 -0.027858862 0.17923355 - 2800 1.6869096 -1.6050313 0 0.065009255 0.082020625 - 2900 1.723365 -1.6453122 0 0.06081914 0.11381101 - 3000 1.759037 -1.7499957 0 -0.008549105 0.12711249 - 3100 1.7608876 -1.8502753 0 -0.10699653 0.10597269 - 3200 1.6030658 -1.6772861 0 -0.090250949 0.16058698 - 3300 1.6136204 -1.6247049 0 -0.027220627 0.27194341 - 3400 1.7126562 -1.6002267 0 0.095302885 0.034174254 - 3500 1.5286242 -1.5693205 0 -0.055982557 -0.028526272 - 3600 1.5529814 -1.6309948 0 -0.093543248 0.25627254 - 3700 1.4066962 -1.4583439 0 -0.06571463 0.36890582 - 3800 1.5736098 -1.5849626 0 -0.027088852 0.19376983 - 3900 1.5819362 -1.6452885 0 -0.07917158 0.17494451 - 4000 1.806905 -1.7114262 0 0.077409698 0.059568431 - 4100 1.7116803 -1.7160461 0 -0.02148265 0.12178783 - 4200 1.8262315 -1.6682893 0 0.13967987 0.25082769 - 4300 1.7548351 -1.6835554 0 0.053731392 0.39252317 - 4400 1.7564816 -1.8020325 0 -0.063115749 0.18973764 - 4500 1.727529 -1.771176 0 -0.06092227 0.51752631 - 4600 1.633861 -1.7554104 0 -0.13788808 0.43310585 - 4700 1.6678523 -1.8066719 0 -0.15549814 -0.086702533 - 4800 1.5903598 -1.7410621 0 -0.1666059 0.064914366 - 4900 1.4894085 -1.5982645 0 -0.12375007 0.23124626 - 5000 1.5422574 -1.6830449 0 -0.15621011 0.12943511 - 5100 1.6123243 -1.6577202 0 -0.061519159 0.26031057 - 5200 1.6815554 -1.6889534 0 -0.024213484 0.1747903 - 5300 1.6502994 -1.5929462 0 0.040850243 0.25623758 - 5400 1.5900521 -1.8240806 0 -0.24992903 0.17822148 - 5500 1.6976803 -1.8370034 0 -0.15629992 0.30793026 - 5600 1.737085 -1.6873775 0 0.032336607 0.32235718 - 5700 1.6995769 -1.6328398 0 0.04974131 0.22932613 - 5800 1.6299367 -1.6582188 0 -0.044581533 0.33036589 - 5900 1.6232041 -1.6456588 0 -0.038686805 0.20701623 - 6000 1.6912228 -1.6401907 0 0.034119867 0.091519693 - 6100 1.6314651 -1.6045998 0 0.010550658 0.32331621 - 6200 1.7575091 -1.7271281 0 0.012805903 0.14214943 - 6300 1.6830653 -1.7955472 0 -0.12931258 0.38730996 - 6400 1.6323392 -1.7470603 0 -0.13104448 0.16724215 - 6500 1.537874 -1.7277794 0 -0.20528423 0.28976791 - 6600 1.8375539 -1.8388229 0 -0.019644528 0.31704541 - 6700 1.7519102 -1.7739002 0 -0.039509043 0.19065098 - 6800 1.4602447 -1.6902787 0 -0.24463645 0.20244553 - 6900 1.6734836 -1.72224 0 -0.065491224 0.27092829 - 7000 1.8166001 -1.7288037 0 0.069630392 0.43514063 - 7100 1.9080746 -1.7849767 0 0.10401717 0.086258744 - 7200 1.6346559 -1.602179 0 0.016130393 0.37208486 - 7300 1.669382 -1.594527 0 0.058161153 0.12543161 - 7400 1.5858819 -1.447937 0 0.12208615 0.42666321 - 7500 1.6947983 -1.637715 0 0.040135322 -0.020875259 - 7600 1.7085903 -1.6810854 0 0.010419044 0.1341074 - 7700 1.5780919 -1.6213683 0 -0.059057356 0.3826822 - 7800 1.8079476 -1.761193 0 0.028675183 0.034143718 - 7900 1.836977 -1.8401332 0 -0.021525986 0.21458105 - 8000 1.9135057 -1.8302694 0 0.064101272 0.23217665 - 8100 1.8606829 -1.6984146 0 0.14366143 0.18168582 - 8200 1.7474236 -1.7574166 0 -0.027467252 0.26529178 - 8300 1.7637155 -1.7861969 0 -0.040118627 0.12298468 - 8400 1.6564242 -1.477104 0 0.16275596 0.14143164 - 8500 1.5868929 -1.6520125 0 -0.080988476 0.22461508 - 8600 1.7556628 -1.7647169 0 -0.026610688 0.19913257 - 8700 1.804704 -1.7892113 0 -0.0025543811 0.2825016 - 8800 1.6511248 -1.8632147 0 -0.22860119 0.041019097 - 8900 1.8323591 -1.7923506 0 0.021684941 0.21335945 - 9000 1.9100569 -1.955559 0 -0.064602644 0.158775 - 9100 1.7562572 -1.8720716 0 -0.13337695 0.19662119 - 9200 1.6566561 -1.9406507 0 -0.30056122 0.12296597 - 9300 1.8367792 -1.9060138 0 -0.087602325 0.19447518 - 9400 1.8420592 -1.6318148 0 0.19182383 0.50726082 - 9500 1.7773475 -1.6973532 0 0.062220818 0.2487172 - 9600 1.6545313 -1.701977 0 -0.063991036 0.20549434 - 9700 1.7463358 -1.8329845 0 -0.10411212 0.15498427 - 9800 1.7799071 -1.7889616 0 -0.026853542 0.3169291 - 9900 1.5838158 -1.718909 0 -0.15093133 0.46050618 - 10000 1.6100625 -1.7018091 0 -0.10784725 0.10312591 -Loop time of 0.715445 on 4 procs for 10000 steps with 100 atoms - -Performance: 6038199.147 tau/day, 13977.313 timesteps/s -95.9% CPU use with 4 MPI tasks x 1 OpenMP threads - -MPI task timing breakdown: -Section | min time | avg time | max time |%varavg| %total ---------------------------------------------------------------- -Pair | 0.35395 | 0.40307 | 0.45588 | 5.9 | 56.34 -Neigh | 0.0033705 | 0.0036112 | 0.0039394 | 0.4 | 0.50 -Comm | 0.17564 | 0.22399 | 0.26912 | 7.8 | 31.31 -Output | 0.0014601 | 0.0024824 | 0.0054784 | 3.5 | 0.35 -Modify | 0.038037 | 0.039219 | 0.04163 | 0.7 | 5.48 -Other | | 0.04308 | | | 6.02 - -Nlocal: 25 ave 28 max 23 min -Histogram: 1 0 1 0 1 0 0 0 0 1 -Nghost: 47.25 ave 49 max 42 min -Histogram: 1 0 0 0 0 0 0 0 0 3 -Neighs: 113.25 ave 132 max 104 min -Histogram: 2 0 1 0 0 0 0 0 0 1 - -Total # of neighbors = 453 -Ave neighs/atom = 4.53 -Neighbor list builds = 483 -Dangerous builds = 0 -Total wall time: 0:00:00 diff --git a/examples/body/log.27Nov18.pour3d.g++.1 b/examples/body/log.27Nov18.pour3d.g++.1 deleted file mode 100644 index 10a4999d14..0000000000 --- a/examples/body/log.27Nov18.pour3d.g++.1 +++ /dev/null @@ -1,74 +0,0 @@ -LAMMPS (27 Nov 2018) - using 1 OpenMP thread(s) per MPI task -# pouring 3d rounded polyhedron bodies - -variable steps index 6000 - -units lj -boundary p p fm -comm_modify vel yes - -atom_style body rounded/polyhedron 1 8 -atom_modify map array - -region reg block 0 50 0 50 0 50 units box -create_box 4 reg -Created orthogonal box = (0 0 0) to (50 50 50) - 1 by 1 by 1 MPI processor grid - -variable cut_inner equal 0.5 -variable k_n equal 100 -variable k_na equal 5 -variable c_n equal 20 -variable c_t equal 5 -variable mu equal 0 -variable A_ua equal 1 - -pair_style body/rounded/polyhedron ${c_n} ${c_t} ${mu} ${A_ua} ${cut_inner} -pair_style body/rounded/polyhedron 20 ${c_t} ${mu} ${A_ua} ${cut_inner} -pair_style body/rounded/polyhedron 20 5 ${mu} ${A_ua} ${cut_inner} -pair_style body/rounded/polyhedron 20 5 0 ${A_ua} ${cut_inner} -pair_style body/rounded/polyhedron 20 5 0 1 ${cut_inner} -pair_style body/rounded/polyhedron 20 5 0 1 0.5 -pair_coeff * * ${k_n} ${k_na} -pair_coeff * * 100 ${k_na} -pair_coeff * * 100 5 - -neighbor 0.5 bin -neigh_modify every 1 delay 0 check yes - -timestep 0.001 - -fix 1 all nve/body -fix 2 all gravity 1.0 spherical 0.0 -180.0 - -molecule object molecule.cube molecule.tetra toff 1 molecule.rod3d toff 2 molecule.point3d toff 3 -Read molecule object: - 1 atoms with max type 1 - 0 bonds with max type 0 - 0 angles with max type 0 - 0 dihedrals with max type 0 - 0 impropers with max type 0 -Read molecule object: - 1 atoms with max type 2 - 0 bonds with max type 0 - 0 angles with max type 0 - 0 dihedrals with max type 0 - 0 impropers with max type 0 -Read molecule object: - 1 atoms with max type 3 - 0 bonds with max type 0 - 0 angles with max type 0 - 0 dihedrals with max type 0 - 0 impropers with max type 0 -Read molecule object: - 1 atoms with max type 4 - 0 bonds with max type 0 - 0 angles with max type 0 - 0 dihedrals with max type 0 - 0 impropers with max type 0 - -region slab block 5 45 5 45 25 35 units box -fix ins all pour 500 0 4767548 vol 0.4 10 region slab mol object molfrac 0.25 0.25 0.25 0.25 -ERROR: Unknown fix style pour (src/modify.cpp:898) -Last command: fix ins all pour 500 0 4767548 vol 0.4 10 region slab mol object molfrac 0.25 0.25 0.25 0.25 diff --git a/examples/body/log.27Nov18.pour3d.g++.4 b/examples/body/log.27Nov18.pour3d.g++.4 deleted file mode 100644 index eb65f99bc2..0000000000 --- a/examples/body/log.27Nov18.pour3d.g++.4 +++ /dev/null @@ -1,74 +0,0 @@ -LAMMPS (27 Nov 2018) - using 1 OpenMP thread(s) per MPI task -# pouring 3d rounded polyhedron bodies - -variable steps index 6000 - -units lj -boundary p p fm -comm_modify vel yes - -atom_style body rounded/polyhedron 1 8 -atom_modify map array - -region reg block 0 50 0 50 0 50 units box -create_box 4 reg -Created orthogonal box = (0 0 0) to (50 50 50) - 1 by 2 by 2 MPI processor grid - -variable cut_inner equal 0.5 -variable k_n equal 100 -variable k_na equal 5 -variable c_n equal 20 -variable c_t equal 5 -variable mu equal 0 -variable A_ua equal 1 - -pair_style body/rounded/polyhedron ${c_n} ${c_t} ${mu} ${A_ua} ${cut_inner} -pair_style body/rounded/polyhedron 20 ${c_t} ${mu} ${A_ua} ${cut_inner} -pair_style body/rounded/polyhedron 20 5 ${mu} ${A_ua} ${cut_inner} -pair_style body/rounded/polyhedron 20 5 0 ${A_ua} ${cut_inner} -pair_style body/rounded/polyhedron 20 5 0 1 ${cut_inner} -pair_style body/rounded/polyhedron 20 5 0 1 0.5 -pair_coeff * * ${k_n} ${k_na} -pair_coeff * * 100 ${k_na} -pair_coeff * * 100 5 - -neighbor 0.5 bin -neigh_modify every 1 delay 0 check yes - -timestep 0.001 - -fix 1 all nve/body -fix 2 all gravity 1.0 spherical 0.0 -180.0 - -molecule object molecule.cube molecule.tetra toff 1 molecule.rod3d toff 2 molecule.point3d toff 3 -Read molecule object: - 1 atoms with max type 1 - 0 bonds with max type 0 - 0 angles with max type 0 - 0 dihedrals with max type 0 - 0 impropers with max type 0 -Read molecule object: - 1 atoms with max type 2 - 0 bonds with max type 0 - 0 angles with max type 0 - 0 dihedrals with max type 0 - 0 impropers with max type 0 -Read molecule object: - 1 atoms with max type 3 - 0 bonds with max type 0 - 0 angles with max type 0 - 0 dihedrals with max type 0 - 0 impropers with max type 0 -Read molecule object: - 1 atoms with max type 4 - 0 bonds with max type 0 - 0 angles with max type 0 - 0 dihedrals with max type 0 - 0 impropers with max type 0 - -region slab block 5 45 5 45 25 35 units box -fix ins all pour 500 0 4767548 vol 0.4 10 region slab mol object molfrac 0.25 0.25 0.25 0.25 -ERROR: Unknown fix style pour (src/modify.cpp:898) -Last command: fix ins all pour 500 0 4767548 vol 0.4 10 region slab mol object molfrac 0.25 0.25 0.25 0.25 diff --git a/examples/body/log.27Nov18.squares.g++.1 b/examples/body/log.27Nov18.squares.g++.1 deleted file mode 100644 index cc334b416c..0000000000 --- a/examples/body/log.27Nov18.squares.g++.1 +++ /dev/null @@ -1,222 +0,0 @@ -LAMMPS (27 Nov 2018) - using 1 OpenMP thread(s) per MPI task -# 2d rounded polygon bodies - -variable r index 4 -variable steps index 100000 -variable T index 0.5 -variable P index 0.1 -variable seed index 980411 - -units lj -dimension 2 - -atom_style body rounded/polygon 1 6 -atom_modify map array -read_data data.squares - orthogonal box = (0 0 -0.5) to (12 12 0.5) - 1 by 1 by 1 MPI processor grid - reading atoms ... - 2 atoms - 2 bodies - -replicate $r $r 1 -replicate 4 $r 1 -replicate 4 4 1 - orthogonal box = (0 0 -0.5) to (48 48 0.5) - 1 by 1 by 1 MPI processor grid - 32 atoms - Time spent = 0.000279665 secs - -velocity all create $T ${seed} dist gaussian mom yes rot yes -velocity all create 0.5 ${seed} dist gaussian mom yes rot yes -velocity all create 0.5 980411 dist gaussian mom yes rot yes - -variable cut_inner equal 0.5 -variable k_n equal 100 -variable k_na equal 2 -variable c_n equal 1 -variable c_t equal 1 -variable mu equal 0.1 -variable delta_ua equal 0.5 - -pair_style body/rounded/polygon ${c_n} ${c_t} ${mu} ${delta_ua} ${cut_inner} -pair_style body/rounded/polygon 1 ${c_t} ${mu} ${delta_ua} ${cut_inner} -pair_style body/rounded/polygon 1 1 ${mu} ${delta_ua} ${cut_inner} -pair_style body/rounded/polygon 1 1 0.1 ${delta_ua} ${cut_inner} -pair_style body/rounded/polygon 1 1 0.1 0.5 ${cut_inner} -pair_style body/rounded/polygon 1 1 0.1 0.5 0.5 -pair_coeff * * ${k_n} ${k_na} -pair_coeff * * 100 ${k_na} -pair_coeff * * 100 2 - -comm_modify vel yes - -neighbor 0.5 bin -neigh_modify every 1 delay 0 check yes - -timestep 0.001 - -#fix 1 all nve/body -#fix 1 all nvt/body temp $T $T 1.0 -fix 1 all npt/body temp $T $T 1.0 x 0.001 $P 1.0 y 0.001 $P 1.0 couple xy fixedpoint 0 0 0 -fix 1 all npt/body temp 0.5 $T 1.0 x 0.001 $P 1.0 y 0.001 $P 1.0 couple xy fixedpoint 0 0 0 -fix 1 all npt/body temp 0.5 0.5 1.0 x 0.001 $P 1.0 y 0.001 $P 1.0 couple xy fixedpoint 0 0 0 -fix 1 all npt/body temp 0.5 0.5 1.0 x 0.001 0.1 1.0 y 0.001 $P 1.0 couple xy fixedpoint 0 0 0 -fix 1 all npt/body temp 0.5 0.5 1.0 x 0.001 0.1 1.0 y 0.001 0.1 1.0 couple xy fixedpoint 0 0 0 - -fix 2 all enforce2d - -#compute 1 all body/local id 1 2 3 -#dump 1 all local 100000 dump.polygon.* index c_1[1] c_1[2] c_1[3] c_1[4] - -thermo_style custom step ke pe etotal press -thermo 1000 - -#dump 2 all image 10000 image.*.jpg type type zoom 2.0 # adiam 1.5 body type 0 0 -#dump_modify 2 pad 6 - -run ${steps} -run 100000 -Neighbor list info ... - update every 1 steps, delay 0 steps, check yes - max neighbors/atom: 2000, page size: 100000 - master list distance cutoff = 6.15685 - ghost atom cutoff = 6.15685 - binsize = 3.07843, bins = 16 16 1 - 1 neighbor lists, perpetual/occasional/extra = 1 0 0 - (1) pair body/rounded/polygon, perpetual - attributes: half, newton on - pair build: half/bin/atomonly/newton - stencil: half/bin/2d/newton - bin: standard -Per MPI rank memory allocation (min/avg/max) = 4.781 | 4.781 | 4.781 Mbytes -Step KinEng PotEng TotEng Press - 0 0.484375 0.25 0.734375 0.0067274306 - 1000 0.38428256 0.0014168922 0.38569945 0.0020468171 - 2000 0.41372193 0.015263236 0.42898517 0.0029343462 - 3000 0.54844547 0.014870378 0.56331585 0.001978353 - 4000 0.73816048 0.031668204 0.76982869 0.0025939718 - 5000 0.84536165 0.011504649 0.8568663 0.0037990517 - 6000 0.73776478 0.14445932 0.8822241 0.0086538113 - 7000 0.52022565 0.069507637 0.58973329 0.0072098694 - 8000 0.72653213 0.12783368 0.85436581 0.023907183 - 9000 0.87685727 0.1239819 1.0008392 0.0064590959 - 10000 0.7250918 0.097243508 0.82233531 0.0012448267 - 11000 0.62302234 0.05597557 0.67899791 0.00080239872 - 12000 0.57159363 0.18199602 0.75358965 0.01033626 - 13000 0.7505295 0.071545266 0.82207477 0.011480236 - 14000 0.84703598 0.15914379 1.0061798 0.032814039 - 15000 0.41905013 0.090552572 0.5096027 0.015717153 - 16000 0.41805189 0.042916881 0.46096877 0.020702707 - 17000 0.59966233 0.05285043 0.65251275 0.016526024 - 18000 0.54282285 0.20835047 0.75117332 0.036414059 - 19000 0.777922 0.034754101 0.8126761 0.036467537 - 20000 0.54703924 0.14633506 0.6933743 0.012917248 - 21000 0.49337931 0.1858754 0.67925471 0.037890735 - 22000 0.64916623 0.19281344 0.84197967 0.011996773 - 23000 0.66958738 0.20459682 0.8741842 0.023639466 - 24000 0.63729755 0.1111959 0.74849345 0.025049919 - 25000 0.60094316 0.13375799 0.73470115 0.035286376 - 26000 0.35419589 0.22049451 0.5746904 0.0024215291 - 27000 0.33789786 0.18494942 0.52284728 0.0066457643 - 28000 0.32376056 0.13151726 0.45527782 0.010773856 - 29000 0.36198203 0.11044834 0.47243037 0.063012638 - 30000 0.22624436 0.19690087 0.42314523 0.037422734 - 31000 0.32284312 0.059623656 0.38246677 0.0287682 - 32000 0.4457193 0.042396136 0.48811544 0.022025252 - 33000 0.61078662 0.059447221 0.67023384 0.030335089 - 34000 0.63157762 0.062056279 0.6936339 0.044624352 - 35000 0.69577644 0.086216204 0.78199264 0.0319995 - 36000 0.76814336 0.062105963 0.83024933 0.044316891 - 37000 0.58641664 0.095034548 0.68145119 0.03234133 - 38000 0.48772813 0.12911854 0.61684667 0.038732146 - 39000 0.74957742 0.09823432 0.84781174 0.053181162 - 40000 0.57881374 0.2932491 0.87206284 0.065740126 - 41000 0.4415176 0.22899179 0.67050939 0.026159841 - 42000 0.5260339 0.2048105 0.7308444 0.046294432 - 43000 0.33493572 0.32500572 0.65994144 -0.01250241 - 44000 0.46467243 0.07907132 0.54374375 0.13386238 - 45000 0.48135518 0.2618908 0.74324598 -0.016767159 - 46000 0.27223209 0.24562643 0.51785852 0.052118439 - 47000 0.26402739 0.1838767 0.44790409 -0.0015878764 - 48000 0.10229166 0.25519169 0.35748335 -0.033927088 - 49000 0.24313495 0.16578185 0.40891679 0.12414926 - 50000 0.27400066 0.27688032 0.55088098 0.10421157 - 51000 0.43081855 0.18111733 0.61193587 0.16373371 - 52000 0.81969298 0.060995894 0.88068887 0.057285357 - 53000 0.99936159 0.029137886 1.0284995 0.19425015 - 54000 0.69750047 0.038079774 0.73558024 -0.089236384 - 55000 0.54823746 0.056369886 0.60460734 -0.021320579 - 56000 0.6752322 0.050322917 0.72555512 0.25303548 - 57000 0.90328009 0.061107142 0.96438723 -0.1962713 - 58000 0.81463148 0.050387847 0.86501933 0.35952157 - 59000 0.61636455 0.064910223 0.68127478 -0.27208497 - 60000 0.62573918 0.052264617 0.67800379 0.4493407 - 61000 0.81065726 0.071269668 0.88192693 -0.34643283 - 62000 0.86420318 0.052799365 0.91700254 0.48308047 - 63000 0.67848508 0.069087342 0.74757242 -0.31814526 - 64000 0.61430417 0.052109373 0.66641354 0.38336646 - 65000 0.75782937 0.063488206 0.82131757 -0.19113322 - 66000 0.88735857 0.051779306 0.93913787 0.29410996 - 67000 0.70684373 0.061786313 0.76863005 -0.16503578 - 68000 0.58571951 0.052402151 0.63812166 0.30173228 - 69000 0.64997491 0.064435462 0.71441037 -0.1920633 - 70000 0.75071821 0.053416991 0.8041352 0.3846747 - 71000 0.8124718 0.06877986 0.88125166 -0.26852566 - 72000 0.71352066 0.05358784 0.7671085 0.41321806 - 73000 0.55151827 0.066470642 0.61798891 -0.2211738 - 74000 0.65473635 0.061946814 0.71668316 0.29536873 - 75000 0.88704613 0.059476353 0.94652248 -0.0312656 - 76000 0.76899803 0.057351665 0.8263497 0.017885214 - 77000 0.65149455 0.05407174 0.70556629 0.25192449 - 78000 0.68614394 0.074251169 0.76039511 -0.19369404 - 79000 0.97451567 0.06262739 1.0371431 0.4217182 - 80000 0.88207775 0.070157004 0.95223476 -0.27318477 - 81000 0.69294455 0.062623957 0.75556851 0.40150141 - 82000 0.70748016 0.073924331 0.78140449 -0.17128794 - 83000 0.78180774 0.063513978 0.84532172 0.22033652 - 84000 0.80170993 0.065812223 0.86752216 0.083202913 - 85000 0.64788122 0.070348079 0.7182293 -0.066913668 - 86000 0.56575431 0.064865112 0.63061942 0.33905786 - 87000 0.78205358 0.07983702 0.8618906 -0.22844912 - 88000 0.87426443 0.065703482 0.93996791 0.448573 - 89000 0.73269893 0.079827385 0.81252632 -0.24183162 - 90000 0.66703106 0.065630146 0.73266121 0.35410109 - 91000 0.73107154 0.07402702 0.80509856 -0.085492997 - 92000 1.043635 0.067156523 1.1107915 0.14311135 - 93000 0.86063344 0.065607238 0.92624068 0.20750649 - 94000 0.68304235 0.075962239 0.75900459 -0.14594625 - 95000 0.7069191 0.067125732 0.77404483 0.39459759 - 96000 0.79860046 0.090957588 0.88955805 -0.24202125 - 97000 0.81366777 0.071387081 0.88505485 0.32217266 - 98000 0.61885746 0.041524228 0.66038169 0.31635364 - 99000 0.57007759 0.055438456 0.62551604 -0.21172902 - 100000 0.80462394 0.045542313 0.85016626 0.099207503 -Loop time of 6.34495 on 1 procs for 100000 steps with 32 atoms - -Performance: 1361713.788 tau/day, 15760.576 timesteps/s -99.7% CPU use with 1 MPI tasks x 1 OpenMP threads - -MPI task timing breakdown: -Section | min time | avg time | max time |%varavg| %total ---------------------------------------------------------------- -Pair | 5.0158 | 5.0158 | 5.0158 | 0.0 | 79.05 -Neigh | 0.0072868 | 0.0072868 | 0.0072868 | 0.0 | 0.11 -Comm | 0.18669 | 0.18669 | 0.18669 | 0.0 | 2.94 -Output | 0.00098681 | 0.00098681 | 0.00098681 | 0.0 | 0.02 -Modify | 1.0417 | 1.0417 | 1.0417 | 0.0 | 16.42 -Other | | 0.09245 | | | 1.46 - -Nlocal: 32 ave 32 max 32 min -Histogram: 1 0 0 0 0 0 0 0 0 0 -Nghost: 35 ave 35 max 35 min -Histogram: 1 0 0 0 0 0 0 0 0 0 -Neighs: 61 ave 61 max 61 min -Histogram: 1 0 0 0 0 0 0 0 0 0 - -Total # of neighbors = 61 -Ave neighs/atom = 1.90625 -Neighbor list builds = 1545 -Dangerous builds = 0 -Total wall time: 0:00:06 diff --git a/examples/body/log.27Nov18.squares.g++.4 b/examples/body/log.27Nov18.squares.g++.4 deleted file mode 100644 index 62c6206677..0000000000 --- a/examples/body/log.27Nov18.squares.g++.4 +++ /dev/null @@ -1,222 +0,0 @@ -LAMMPS (27 Nov 2018) - using 1 OpenMP thread(s) per MPI task -# 2d rounded polygon bodies - -variable r index 4 -variable steps index 100000 -variable T index 0.5 -variable P index 0.1 -variable seed index 980411 - -units lj -dimension 2 - -atom_style body rounded/polygon 1 6 -atom_modify map array -read_data data.squares - orthogonal box = (0 0 -0.5) to (12 12 0.5) - 2 by 2 by 1 MPI processor grid - reading atoms ... - 2 atoms - 2 bodies - -replicate $r $r 1 -replicate 4 $r 1 -replicate 4 4 1 - orthogonal box = (0 0 -0.5) to (48 48 0.5) - 2 by 2 by 1 MPI processor grid - 32 atoms - Time spent = 0.000400782 secs - -velocity all create $T ${seed} dist gaussian mom yes rot yes -velocity all create 0.5 ${seed} dist gaussian mom yes rot yes -velocity all create 0.5 980411 dist gaussian mom yes rot yes - -variable cut_inner equal 0.5 -variable k_n equal 100 -variable k_na equal 2 -variable c_n equal 1 -variable c_t equal 1 -variable mu equal 0.1 -variable delta_ua equal 0.5 - -pair_style body/rounded/polygon ${c_n} ${c_t} ${mu} ${delta_ua} ${cut_inner} -pair_style body/rounded/polygon 1 ${c_t} ${mu} ${delta_ua} ${cut_inner} -pair_style body/rounded/polygon 1 1 ${mu} ${delta_ua} ${cut_inner} -pair_style body/rounded/polygon 1 1 0.1 ${delta_ua} ${cut_inner} -pair_style body/rounded/polygon 1 1 0.1 0.5 ${cut_inner} -pair_style body/rounded/polygon 1 1 0.1 0.5 0.5 -pair_coeff * * ${k_n} ${k_na} -pair_coeff * * 100 ${k_na} -pair_coeff * * 100 2 - -comm_modify vel yes - -neighbor 0.5 bin -neigh_modify every 1 delay 0 check yes - -timestep 0.001 - -#fix 1 all nve/body -#fix 1 all nvt/body temp $T $T 1.0 -fix 1 all npt/body temp $T $T 1.0 x 0.001 $P 1.0 y 0.001 $P 1.0 couple xy fixedpoint 0 0 0 -fix 1 all npt/body temp 0.5 $T 1.0 x 0.001 $P 1.0 y 0.001 $P 1.0 couple xy fixedpoint 0 0 0 -fix 1 all npt/body temp 0.5 0.5 1.0 x 0.001 $P 1.0 y 0.001 $P 1.0 couple xy fixedpoint 0 0 0 -fix 1 all npt/body temp 0.5 0.5 1.0 x 0.001 0.1 1.0 y 0.001 $P 1.0 couple xy fixedpoint 0 0 0 -fix 1 all npt/body temp 0.5 0.5 1.0 x 0.001 0.1 1.0 y 0.001 0.1 1.0 couple xy fixedpoint 0 0 0 - -fix 2 all enforce2d - -#compute 1 all body/local id 1 2 3 -#dump 1 all local 100000 dump.polygon.* index c_1[1] c_1[2] c_1[3] c_1[4] - -thermo_style custom step ke pe etotal press -thermo 1000 - -#dump 2 all image 10000 image.*.jpg type type zoom 2.0 # adiam 1.5 body type 0 0 -#dump_modify 2 pad 6 - -run ${steps} -run 100000 -Neighbor list info ... - update every 1 steps, delay 0 steps, check yes - max neighbors/atom: 2000, page size: 100000 - master list distance cutoff = 6.15685 - ghost atom cutoff = 6.15685 - binsize = 3.07843, bins = 16 16 1 - 1 neighbor lists, perpetual/occasional/extra = 1 0 0 - (1) pair body/rounded/polygon, perpetual - attributes: half, newton on - pair build: half/bin/atomonly/newton - stencil: half/bin/2d/newton - bin: standard -Per MPI rank memory allocation (min/avg/max) = 4.774 | 4.774 | 4.774 Mbytes -Step KinEng PotEng TotEng Press - 0 0.484375 0.25 0.734375 0.0067274306 - 1000 0.38428256 0.0014168922 0.38569945 0.0020468171 - 2000 0.41372193 0.015263236 0.42898517 0.0029343462 - 3000 0.54844547 0.014870378 0.56331585 0.001978353 - 4000 0.73816048 0.031668204 0.76982869 0.0025939718 - 5000 0.84536165 0.011504649 0.8568663 0.0037990517 - 6000 0.73776478 0.14445932 0.8822241 0.0086538113 - 7000 0.52022565 0.069507637 0.58973329 0.0072098694 - 8000 0.72653213 0.12783367 0.85436581 0.023907185 - 9000 0.87685728 0.12398193 1.0008392 0.0064591005 - 10000 0.72509641 0.097241969 0.82233837 0.0012418726 - 11000 0.62314955 0.056042914 0.67919247 0.0018880786 - 12000 0.57157436 0.18187429 0.75344865 0.0096135623 - 13000 0.7489742 0.08262775 0.83160195 0.009183917 - 14000 0.78835138 0.18761048 0.97596186 0.023684357 - 15000 0.40408761 0.079431327 0.48351893 0.025285348 - 16000 0.4071013 0.13207058 0.53917188 0.02015488 - 17000 0.48417067 0.16699781 0.65116848 0.059188189 - 18000 0.60038567 0.18317457 0.78356024 -0.046456387 - 19000 0.73796958 0.064271521 0.8022411 0.090257204 - 20000 0.62508659 0.14486336 0.76994994 0.04948543 - 21000 0.5596837 0.10018831 0.65987201 0.044961962 - 22000 0.30731517 0.1386103 0.44592547 0.015096596 - 23000 0.34371843 0.1486761 0.49239453 0.026100892 - 24000 0.33484204 0.25428479 0.58912683 0.01974393 - 25000 0.48714744 0.32743616 0.8145836 0.037925893 - 26000 0.33255994 0.29851422 0.63107417 0.049419529 - 27000 0.21735889 0.18816203 0.40552093 0.050622152 - 28000 0.31911317 0.12559898 0.44471215 -0.0036236361 - 29000 0.53280161 0.055185441 0.58798705 0.083856225 - 30000 0.52916941 0.28697284 0.81614225 0.055873213 - 31000 0.47861645 0.21932568 0.69794214 0.02762301 - 32000 0.46786314 0.041856438 0.50971958 0.029923804 - 33000 0.69944716 0.039356744 0.7388039 0.028174645 - 34000 0.39964317 0.1027175 0.50236068 0.039495865 - 35000 0.70199237 0.10421859 0.80621095 0.015943417 - 36000 0.45053533 0.078626602 0.52916193 0.0073950287 - 37000 0.41587918 0.056551665 0.47243084 0.034091318 - 38000 0.58663473 0.039228671 0.6258634 0.033093641 - 39000 0.72480658 0.14792564 0.87273222 0.030903741 - 40000 0.51163285 0.13445292 0.64608577 -0.03114559 - 41000 0.56273761 0.16720374 0.72994135 0.027968528 - 42000 0.61850184 0.10584389 0.72434573 -0.036301799 - 43000 0.60039772 0.11984289 0.72024062 0.080894236 - 44000 0.57499839 0.068211092 0.64320948 0.049726122 - 45000 0.69937239 0.16287141 0.8622438 0.044921114 - 46000 0.23303785 0.2391726 0.47221045 0.021668935 - 47000 0.27051781 0.10690378 0.37742159 0.11963476 - 48000 0.408895 0.079919688 0.48881469 0.087484004 - 49000 0.74363181 0.040819422 0.78445123 0.011937456 - 50000 0.84482316 0.10205256 0.94687572 0.064133262 - 51000 0.84923574 0.089882984 0.93911872 0.062696388 - 52000 0.66278324 0.0331554 0.69593864 0.035150337 - 53000 0.64737251 0.039608076 0.68698058 0.057687461 - 54000 0.68931435 0.042661403 0.73197576 0.069664795 - 55000 0.84523308 0.10293275 0.94816583 0.047343755 - 56000 0.80033937 0.1534797 0.95381907 0.070206074 - 57000 0.6214799 0.1174575 0.7389374 0.078530452 - 58000 0.64228495 0.088089896 0.73037485 0.060245994 - 59000 0.89376363 0.065171887 0.95893552 0.071658895 - 60000 0.90162992 0.016564761 0.91819468 0.089245946 - 61000 0.72439995 0.0076508835 0.73205083 0.031430213 - 62000 0.71590702 0.0046728326 0.72057986 0.10153514 - 63000 0.74491219 0.0046757926 0.74958798 0.077145851 - 64000 0.77173614 0.008265632 0.78000178 -0.049932265 - 65000 0.72789092 0.0053605745 0.73325149 0.27060389 - 66000 0.63001101 0.013871945 0.64388296 -0.17766692 - 67000 0.65887071 0.0069105692 0.66578128 0.31632918 - 68000 0.89042862 0.0026334652 0.89306209 -0.050495873 - 69000 0.83442374 0.0059232957 0.84034703 -0.21871692 - 70000 0.65149642 0.004885383 0.65638181 0.50428108 - 71000 0.66888808 0.01125057 0.68013865 -0.29575772 - 72000 0.74941609 0.0026616299 0.75207772 0.34800716 - 73000 0.7898844 0.0048982026 0.7947826 -0.096872644 - 74000 0.68823538 0.0021467794 0.69038216 0.12272852 - 75000 0.5238808 0.0046112795 0.52849208 0.25760316 - 76000 0.65512889 0.014567969 0.66969686 -0.24622674 - 77000 0.82292373 0.0092471048 0.83217083 0.4002304 - 78000 0.76305221 0.01101937 0.77407158 -0.10704945 - 79000 0.66279814 0.0090486405 0.67184678 0.037466134 - 80000 0.65808885 0.010000569 0.66808942 0.31742291 - 81000 0.91357798 0.046226814 0.95980479 -0.20945693 - 82000 0.87611859 -0.016794871 0.85932372 0.31759733 - 83000 0.66285455 -0.017921021 0.64493353 0.27065273 - 84000 0.67460715 -0.0076174891 0.66698966 -0.024772659 - 85000 0.77786135 0.0014316505 0.779293 -0.21635327 - 86000 0.83246393 0.087489797 0.91995372 -0.13431455 - 87000 0.62935573 0.045088823 0.67444455 0.037766395 - 88000 0.55264538 -0.024625272 0.52802011 0.18121213 - 89000 0.74171392 -0.012629926 0.729084 -0.27666424 - 90000 0.82542165 -0.02296567 0.80245598 -0.30497174 - 91000 0.72958657 -0.026275093 0.70331147 -0.27624518 - 92000 0.6319558 0.022568297 0.65452409 -0.33539318 - 93000 0.66685301 0.021889807 0.68874282 -0.39890762 - 94000 0.91243243 0.0078218509 0.92025428 -0.27213648 - 95000 0.81125179 -0.0096756295 0.80157616 -0.099802335 - 96000 0.63354907 -0.018329423 0.61521965 0.18199604 - 97000 0.66812347 -0.016650228 0.65147324 0.49878257 - 98000 0.81490013 -0.0049164866 0.80998365 -0.13473106 - 99000 0.82131147 0.0043198846 0.82563136 -0.3083957 - 100000 0.50880983 -0.010467027 0.4983428 0.060606332 -Loop time of 4.3169 on 4 procs for 100000 steps with 32 atoms - -Performance: 2001435.573 tau/day, 23164.764 timesteps/s -95.1% CPU use with 4 MPI tasks x 1 OpenMP threads - -MPI task timing breakdown: -Section | min time | avg time | max time |%varavg| %total ---------------------------------------------------------------- -Pair | 1.2078 | 1.3972 | 1.6653 | 15.1 | 32.36 -Neigh | 0.0030954 | 0.003284 | 0.0034814 | 0.3 | 0.08 -Comm | 1.074 | 1.3595 | 1.6003 | 16.2 | 31.49 -Output | 0.001703 | 0.0030067 | 0.0068843 | 4.1 | 0.07 -Modify | 1.2071 | 1.2647 | 1.3062 | 3.6 | 29.30 -Other | | 0.2893 | | | 6.70 - -Nlocal: 8 ave 9 max 6 min -Histogram: 1 0 0 0 0 0 1 0 0 2 -Nghost: 17.75 ave 20 max 16 min -Histogram: 1 0 1 0 0 1 0 0 0 1 -Neighs: 14 ave 18 max 7 min -Histogram: 1 0 0 0 0 0 0 1 1 1 - -Total # of neighbors = 56 -Ave neighs/atom = 1.75 -Neighbor list builds = 1566 -Dangerous builds = 0 -Total wall time: 0:00:04 diff --git a/examples/body/log.27Nov18.wall2d.g++.1 b/examples/body/log.27Nov18.wall2d.g++.1 deleted file mode 100644 index 1987280bee..0000000000 --- a/examples/body/log.27Nov18.wall2d.g++.1 +++ /dev/null @@ -1,224 +0,0 @@ -LAMMPS (27 Nov 2018) - using 1 OpenMP thread(s) per MPI task -# 2d rounded polygon bodies - -variable r index 4 -variable steps index 100000 -variable T index 0.5 -variable P index 0.1 -variable seed index 980411 - -units lj -dimension 2 - -atom_style body rounded/polygon 1 6 -atom_modify map array -read_data data.squares - orthogonal box = (0 0 -0.5) to (12 12 0.5) - 1 by 1 by 1 MPI processor grid - reading atoms ... - 2 atoms - 2 bodies - -replicate $r $r 1 -replicate 4 $r 1 -replicate 4 4 1 - orthogonal box = (0 0 -0.5) to (48 48 0.5) - 1 by 1 by 1 MPI processor grid - 32 atoms - Time spent = 0.000318766 secs - -velocity all create $T ${seed} dist gaussian mom yes rot yes -velocity all create 0.5 ${seed} dist gaussian mom yes rot yes -velocity all create 0.5 980411 dist gaussian mom yes rot yes - -change_box all boundary p f p - -variable cut_inner equal 0.5 -variable k_n equal 100 -variable k_na equal 2 -variable c_n equal 0.1 -variable c_t equal 0.1 -variable mu equal 0.1 -variable delta_ua equal 0.5 - -pair_style body/rounded/polygon ${c_n} ${c_t} ${mu} ${delta_ua} ${cut_inner} -pair_style body/rounded/polygon 0.1 ${c_t} ${mu} ${delta_ua} ${cut_inner} -pair_style body/rounded/polygon 0.1 0.1 ${mu} ${delta_ua} ${cut_inner} -pair_style body/rounded/polygon 0.1 0.1 0.1 ${delta_ua} ${cut_inner} -pair_style body/rounded/polygon 0.1 0.1 0.1 0.5 ${cut_inner} -pair_style body/rounded/polygon 0.1 0.1 0.1 0.5 0.5 -pair_coeff * * ${k_n} ${k_na} -pair_coeff * * 100 ${k_na} -pair_coeff * * 100 2 - -comm_modify vel yes - -neighbor 0.5 bin -neigh_modify every 1 delay 0 check yes - -timestep 0.001 - -#fix 1 all nve/body -#fix 1 all nvt/body temp $T $T 1.0 -fix 1 all npt/body temp $T $T 1.0 x 0.001 $P 1.0 fixedpoint 0 0 0 -fix 1 all npt/body temp 0.5 $T 1.0 x 0.001 $P 1.0 fixedpoint 0 0 0 -fix 1 all npt/body temp 0.5 0.5 1.0 x 0.001 $P 1.0 fixedpoint 0 0 0 -fix 1 all npt/body temp 0.5 0.5 1.0 x 0.001 0.1 1.0 fixedpoint 0 0 0 - -fix 2 all enforce2d -fix 3 all wall/body/polygon 2000 50 50 yplane 0.0 48.0 - -#compute 1 all body/local id 1 2 3 -#dump 1 all local 100000 dump.polygon.* index c_1[1] c_1[2] c_1[3] c_1[4] - -thermo_style custom step ke pe etotal press -thermo 1000 - -#dump 2 all image 10000 image.*.jpg type type zoom 2.0 # adiam 1.5 body type 0 0 -#dump_modify 2 pad 6 - -run ${steps} -run 100000 -Neighbor list info ... - update every 1 steps, delay 0 steps, check yes - max neighbors/atom: 2000, page size: 100000 - master list distance cutoff = 6.15685 - ghost atom cutoff = 6.15685 - binsize = 3.07843, bins = 16 16 1 - 1 neighbor lists, perpetual/occasional/extra = 1 0 0 - (1) pair body/rounded/polygon, perpetual - attributes: half, newton on - pair build: half/bin/atomonly/newton - stencil: half/bin/2d/newton - bin: standard -Per MPI rank memory allocation (min/avg/max) = 4.771 | 4.771 | 4.771 Mbytes -Step KinEng PotEng TotEng Press - 0 0.484375 0.25 0.734375 0.0067274306 - 1000 0.51467204 0.00099202506 0.51566407 0.013452386 - 2000 0.55674899 0.0040762275 0.56082522 0.0034529066 - 3000 0.7546177 0.02259362 0.77721132 0.003650781 - 4000 0.72710218 0.10284108 0.82994326 0.0059629371 - 5000 0.5771012 0.069052145 0.64615335 0.00053937622 - 6000 0.53848154 0.041891239 0.58037277 0.0018693312 - 7000 0.61777556 0.033379829 0.65115538 0.0027584418 - 8000 0.47427227 0.059558934 0.5338312 0.017087187 - 9000 0.46822364 0.064382578 0.53260622 0.023258465 - 10000 0.46511051 0.027799371 0.49290988 0.015319493 - 11000 0.58686703 0.088016891 0.67488392 0.0088428936 - 12000 0.49962603 0.09879099 0.59841702 0.00074311497 - 13000 0.53160049 0.069625775 0.60122626 0.017019775 - 14000 0.49574902 0.041214164 0.53696318 0.0060355978 - 15000 0.56620415 0.13621516 0.70241931 0.045583297 - 16000 0.40942564 0.11469877 0.52412441 0.029905784 - 17000 0.608066 0.096938921 0.70500493 0.018509814 - 18000 0.45622168 0.057018077 0.51323975 0.0034035281 - 19000 0.48763322 0.057832224 0.54546545 0.0022972169 - 20000 0.41577025 0.14480819 0.56057844 0.023882542 - 21000 0.58565738 0.1601676 0.74582498 0.01702799 - 22000 0.60430354 0.16740706 0.7717106 -0.0047632836 - 23000 0.45659601 0.13740896 0.59400497 0.0191143 - 24000 0.42741367 0.25490516 0.68231884 0.051459175 - 25000 0.40851048 0.077823072 0.48633355 0.024392284 - 26000 0.53392894 0.14504323 0.67897217 0.028964572 - 27000 0.39775205 0.13101153 0.52876358 0.0080564916 - 28000 0.63138106 0.17706612 0.80844718 0.017594524 - 29000 0.57897788 0.26855503 0.84753292 0.019310624 - 30000 0.37401002 0.2274666 0.60147663 0.0044804008 - 31000 0.60924323 0.23142663 0.84066986 0.088271242 - 32000 0.60310397 0.35719837 0.96030234 0.0096762289 - 33000 0.47468105 0.17727177 0.65195282 0.0078486602 - 34000 0.42270829 0.20131235 0.62402064 0.090216203 - 35000 0.49578606 0.1697981 0.66558416 0.079099134 - 36000 0.50744538 0.29600416 0.80344954 0.018819487 - 37000 0.66728184 0.28166655 0.94894838 -0.01679437 - 38000 0.38972905 0.25798163 0.64771068 0.040442456 - 39000 0.38292839 0.21774389 0.60067228 0.016754932 - 40000 0.61770336 0.34202184 0.9597252 0.10986262 - 41000 0.42252651 0.13424708 0.5567736 0.040987711 - 42000 0.67513868 0.29515562 0.9702943 0.0013757417 - 43000 0.36768915 0.20349753 0.57118668 0.031443504 - 44000 0.49371025 0.095615653 0.5893259 0.032289477 - 45000 0.42144079 0.28894639 0.71038718 0.040302569 - 46000 0.36360136 0.33117431 0.69477567 0.010881881 - 47000 0.4206309 0.19557595 0.61620685 0.051137535 - 48000 0.4131465 0.37027912 0.78342561 0.11903042 - 49000 0.544703 0.38013565 0.92483865 0.054939742 - 50000 0.47394272 0.32384493 0.79778764 0.088363602 - 51000 0.55377533 0.38103395 0.93480927 0.097981664 - 52000 0.60648433 0.30877364 0.91525797 0.088877781 - 53000 0.62933509 0.33187159 0.96120668 0.10275954 - 54000 0.55077522 0.39050008 0.94127529 0.066721412 - 55000 0.41646397 0.34545572 0.76191969 0.011056796 - 56000 0.44244954 0.39274744 0.83519698 0.039963853 - 57000 0.41963092 0.33483982 0.75447073 0.032555938 - 58000 0.37941475 0.36905323 0.74846798 0.043952263 - 59000 0.53008564 0.32843795 0.85852359 0.080787301 - 60000 0.43408908 0.19840268 0.63249176 0.06421165 - 61000 0.56287814 0.31500577 0.87788391 0.12031895 - 62000 0.5185192 0.18275672 0.70127592 -0.0086212356 - 63000 0.57275413 0.45147395 1.0242281 0.054617465 - 64000 0.28322907 0.33687722 0.62010629 0.07268947 - 65000 0.40230876 0.37989067 0.78219943 -0.029604066 - 66000 0.58601209 0.52721274 1.1132248 -0.00037054404 - 67000 0.52669356 0.44276199 0.96945554 0.18969356 - 68000 0.41566831 0.47320489 0.8888732 0.040635264 - 69000 0.52140574 0.4261935 0.94759923 0.016566201 - 70000 0.42034133 0.55867009 0.97901142 0.047465899 - 71000 0.48720036 0.43749264 0.924693 0.15984789 - 72000 0.5244238 0.55854139 1.0829652 0.10155994 - 73000 0.69990219 0.57313852 1.2730407 0.11108648 - 74000 0.38274347 0.23359664 0.61634011 0.027968087 - 75000 0.47493369 0.49472607 0.96965976 0.10961568 - 76000 0.57064727 0.37996383 0.9506111 0.034746271 - 77000 0.50401727 0.34437588 0.84839315 0.015116686 - 78000 0.59504118 0.44154772 1.0365889 0.059341875 - 79000 0.4920801 0.58935767 1.0814378 0.12139906 - 80000 0.56992818 0.38916606 0.95909424 0.073618074 - 81000 0.38446945 0.77314417 1.1576136 0.12173381 - 82000 0.48734531 0.56198203 1.0493273 0.1080115 - 83000 0.5516933 0.56743096 1.1191243 0.13936805 - 84000 0.53336893 0.62914863 1.1625176 0.0084970895 - 85000 0.46456977 0.77446084 1.2390306 0.18024688 - 86000 0.58067599 0.53109608 1.1117721 0.012492021 - 87000 0.55096446 0.61715622 1.1681207 0.13264723 - 88000 0.56548774 0.74463701 1.3101247 0.14491188 - 89000 0.52492634 0.58482194 1.1097483 0.21155245 - 90000 0.64973565 0.85514474 1.5048804 0.036911953 - 91000 0.55367722 0.74046971 1.2941469 0.23918851 - 92000 0.44863249 0.56773761 1.0163701 0.00042860088 - 93000 0.64728356 0.66594086 1.3132244 0.0022850006 - 94000 0.65255497 0.82136644 1.4739214 0.10037643 - 95000 0.62266654 0.82642147 1.449088 0.11964602 - 96000 0.50656004 0.83312844 1.3396885 0.078491084 - 97000 0.47126712 0.70469684 1.175964 0.12956056 - 98000 0.48661103 1.0121726 1.4987837 0.043537851 - 99000 0.48379797 0.9520931 1.4358911 0.082047522 - 100000 0.54266361 1.0959698 1.6386334 -0.13092175 -Loop time of 3.8532 on 1 procs for 100000 steps with 32 atoms - -Performance: 2242290.202 tau/day, 25952.433 timesteps/s -98.8% CPU use with 1 MPI tasks x 1 OpenMP threads - -MPI task timing breakdown: -Section | min time | avg time | max time |%varavg| %total ---------------------------------------------------------------- -Pair | 2.3917 | 2.3917 | 2.3917 | 0.0 | 62.07 -Neigh | 0.012386 | 0.012386 | 0.012386 | 0.0 | 0.32 -Comm | 0.11307 | 0.11307 | 0.11307 | 0.0 | 2.93 -Output | 0.0010369 | 0.0010369 | 0.0010369 | 0.0 | 0.03 -Modify | 1.246 | 1.246 | 1.246 | 0.0 | 32.34 -Other | | 0.08895 | | | 2.31 - -Nlocal: 32 ave 32 max 32 min -Histogram: 1 0 0 0 0 0 0 0 0 0 -Nghost: 21 ave 21 max 21 min -Histogram: 1 0 0 0 0 0 0 0 0 0 -Neighs: 55 ave 55 max 55 min -Histogram: 1 0 0 0 0 0 0 0 0 0 - -Total # of neighbors = 55 -Ave neighs/atom = 1.71875 -Neighbor list builds = 2886 -Dangerous builds = 0 -Total wall time: 0:00:03 diff --git a/examples/body/log.27Nov18.wall2d.g++.4 b/examples/body/log.27Nov18.wall2d.g++.4 deleted file mode 100644 index d9a27cb1e4..0000000000 --- a/examples/body/log.27Nov18.wall2d.g++.4 +++ /dev/null @@ -1,224 +0,0 @@ -LAMMPS (27 Nov 2018) - using 1 OpenMP thread(s) per MPI task -# 2d rounded polygon bodies - -variable r index 4 -variable steps index 100000 -variable T index 0.5 -variable P index 0.1 -variable seed index 980411 - -units lj -dimension 2 - -atom_style body rounded/polygon 1 6 -atom_modify map array -read_data data.squares - orthogonal box = (0 0 -0.5) to (12 12 0.5) - 2 by 2 by 1 MPI processor grid - reading atoms ... - 2 atoms - 2 bodies - -replicate $r $r 1 -replicate 4 $r 1 -replicate 4 4 1 - orthogonal box = (0 0 -0.5) to (48 48 0.5) - 2 by 2 by 1 MPI processor grid - 32 atoms - Time spent = 0.000329733 secs - -velocity all create $T ${seed} dist gaussian mom yes rot yes -velocity all create 0.5 ${seed} dist gaussian mom yes rot yes -velocity all create 0.5 980411 dist gaussian mom yes rot yes - -change_box all boundary p f p - -variable cut_inner equal 0.5 -variable k_n equal 100 -variable k_na equal 2 -variable c_n equal 0.1 -variable c_t equal 0.1 -variable mu equal 0.1 -variable delta_ua equal 0.5 - -pair_style body/rounded/polygon ${c_n} ${c_t} ${mu} ${delta_ua} ${cut_inner} -pair_style body/rounded/polygon 0.1 ${c_t} ${mu} ${delta_ua} ${cut_inner} -pair_style body/rounded/polygon 0.1 0.1 ${mu} ${delta_ua} ${cut_inner} -pair_style body/rounded/polygon 0.1 0.1 0.1 ${delta_ua} ${cut_inner} -pair_style body/rounded/polygon 0.1 0.1 0.1 0.5 ${cut_inner} -pair_style body/rounded/polygon 0.1 0.1 0.1 0.5 0.5 -pair_coeff * * ${k_n} ${k_na} -pair_coeff * * 100 ${k_na} -pair_coeff * * 100 2 - -comm_modify vel yes - -neighbor 0.5 bin -neigh_modify every 1 delay 0 check yes - -timestep 0.001 - -#fix 1 all nve/body -#fix 1 all nvt/body temp $T $T 1.0 -fix 1 all npt/body temp $T $T 1.0 x 0.001 $P 1.0 fixedpoint 0 0 0 -fix 1 all npt/body temp 0.5 $T 1.0 x 0.001 $P 1.0 fixedpoint 0 0 0 -fix 1 all npt/body temp 0.5 0.5 1.0 x 0.001 $P 1.0 fixedpoint 0 0 0 -fix 1 all npt/body temp 0.5 0.5 1.0 x 0.001 0.1 1.0 fixedpoint 0 0 0 - -fix 2 all enforce2d -fix 3 all wall/body/polygon 2000 50 50 yplane 0.0 48.0 - -#compute 1 all body/local id 1 2 3 -#dump 1 all local 100000 dump.polygon.* index c_1[1] c_1[2] c_1[3] c_1[4] - -thermo_style custom step ke pe etotal press -thermo 1000 - -#dump 2 all image 10000 image.*.jpg type type zoom 2.0 # adiam 1.5 body type 0 0 -#dump_modify 2 pad 6 - -run ${steps} -run 100000 -Neighbor list info ... - update every 1 steps, delay 0 steps, check yes - max neighbors/atom: 2000, page size: 100000 - master list distance cutoff = 6.15685 - ghost atom cutoff = 6.15685 - binsize = 3.07843, bins = 16 16 1 - 1 neighbor lists, perpetual/occasional/extra = 1 0 0 - (1) pair body/rounded/polygon, perpetual - attributes: half, newton on - pair build: half/bin/atomonly/newton - stencil: half/bin/2d/newton - bin: standard -Per MPI rank memory allocation (min/avg/max) = 4.773 | 4.773 | 4.773 Mbytes -Step KinEng PotEng TotEng Press - 0 0.484375 0.25 0.734375 0.0067274306 - 1000 0.51467204 0.00099202506 0.51566407 0.013452386 - 2000 0.55674899 0.0040762275 0.56082522 0.0034529066 - 3000 0.7546177 0.02259362 0.77721132 0.003650781 - 4000 0.72710218 0.10284108 0.82994326 0.0059629371 - 5000 0.57710119 0.069052154 0.64615335 0.00053937664 - 6000 0.53848104 0.041891152 0.58037219 0.0018693259 - 7000 0.61777485 0.033380825 0.65115568 0.0027584782 - 8000 0.47427732 0.059553658 0.53383098 0.017087698 - 9000 0.46820943 0.064379697 0.53258913 0.02325702 - 10000 0.46605511 0.02332689 0.489382 0.013699209 - 11000 0.57547516 0.090133398 0.66560855 0.0083913962 - 12000 0.465348 0.084853345 0.55020135 0.006231552 - 13000 0.55340889 0.07116165 0.62457054 0.030622563 - 14000 0.58866362 0.052281859 0.64094548 0.0079106838 - 15000 0.51757672 0.12255618 0.6401329 0.014005369 - 16000 0.42696011 0.086987541 0.51394765 -0.0017128649 - 17000 0.37612579 0.13054778 0.50667357 0.0046284992 - 18000 0.47659682 0.14670523 0.62330205 0.02206928 - 19000 0.47897909 0.15540332 0.63438241 0.02544138 - 20000 0.59377323 0.15357757 0.7473508 0.030262926 - 21000 0.52781204 0.22074491 0.74855695 -0.0022170167 - 22000 0.44843285 0.12779345 0.5762263 0.0097268482 - 23000 0.60400735 0.18098124 0.78498858 0.05778325 - 24000 0.58254338 0.1570243 0.73956769 0.022530491 - 25000 0.60524318 0.23660272 0.8418459 0.062530421 - 26000 0.45892702 0.34294121 0.80186823 0.038657393 - 27000 0.58418023 0.19551937 0.7796996 -0.0055396645 - 28000 0.45655369 0.26718934 0.72374303 0.006593108 - 29000 0.50277299 0.1747088 0.67748179 0.016059369 - 30000 0.38640717 0.1631573 0.54956447 0.036055723 - 31000 0.46944541 0.22076826 0.69021367 0.014334038 - 32000 0.53862858 0.26867594 0.80730452 0.057406282 - 33000 0.45666352 0.21796554 0.67462906 0.056555205 - 34000 0.51644038 0.21866786 0.73510824 0.015713 - 35000 0.50489584 0.1596236 0.66451945 0.040400644 - 36000 0.41723489 0.16227853 0.57951342 0.02863261 - 37000 0.481638 0.28830624 0.76994424 0.038381986 - 38000 0.6036094 0.33479287 0.93840227 0.0032059452 - 39000 0.47822122 0.18876355 0.66698476 0.029252649 - 40000 0.54949607 0.35011086 0.89960693 0.093909148 - 41000 0.54876522 0.27501735 0.82378257 -0.0084167014 - 42000 0.67801592 0.18102522 0.85904114 -0.0058395209 - 43000 0.54342066 0.34322081 0.88664146 0.12263806 - 44000 0.46672513 0.29749157 0.76421671 0.051073701 - 45000 0.4679867 0.25820875 0.72619545 0.069790993 - 46000 0.59598501 0.22285276 0.81883777 0.050578807 - 47000 0.48858341 0.29811577 0.78669917 0.080971431 - 48000 0.41238073 0.29362937 0.7060101 0.031893588 - 49000 0.61516435 0.33082609 0.94599044 -0.010710982 - 50000 0.57576635 0.37137185 0.94713819 0.062160249 - 51000 0.54614001 0.36960628 0.91574629 -0.0083424769 - 52000 0.42232354 0.25214442 0.67446796 0.028666126 - 53000 0.43025129 0.24479385 0.67504514 0.030342054 - 54000 0.54614922 0.29602426 0.84217348 0.083070642 - 55000 0.60719748 0.3577285 0.96492598 0.053799744 - 56000 0.47073149 0.31070429 0.78143579 0.083895368 - 57000 0.56861582 0.33249784 0.90111366 0.032324233 - 58000 0.75061035 0.33313728 1.0837476 0.031039937 - 59000 0.59473893 0.48870773 1.0834467 0.039503585 - 60000 0.55252481 0.38350562 0.93603043 0.0027643882 - 61000 0.45010855 0.43945065 0.8895592 0.028168222 - 62000 0.63942467 0.53372899 1.1731537 0.13790959 - 63000 0.69407873 0.37980402 1.0738828 0.035919608 - 64000 0.54898275 0.39910419 0.94808693 0.0015016851 - 65000 0.58229838 0.42300361 1.005302 0.089787193 - 66000 0.53443537 0.5597136 1.094149 -0.015781756 - 67000 0.59212426 0.56172146 1.1538457 0.030464683 - 68000 0.68164926 0.48724393 1.1688932 0.071465948 - 69000 0.59721737 0.49476309 1.0919805 0.07575647 - 70000 0.52314551 0.31950477 0.84265028 0.11206672 - 71000 0.53230509 0.53846575 1.0707708 0.0047204701 - 72000 0.71341933 0.4924749 1.2058942 0.116568 - 73000 0.70498496 0.54121008 1.246195 0.11210249 - 74000 0.54188682 0.61729607 1.1591829 0.044083048 - 75000 0.44073609 0.42072284 0.86145893 -0.041508511 - 76000 0.51225567 0.36848317 0.88073884 -0.028636748 - 77000 0.6517329 0.5503086 1.2020415 0.049605026 - 78000 0.60053898 0.52760266 1.1281416 0.094361256 - 79000 0.51560788 0.46563043 0.98123832 -0.03336136 - 80000 0.53357884 0.60743981 1.1410186 0.027259883 - 81000 0.6256228 0.40412923 1.029752 0.083274981 - 82000 0.6903519 0.69599412 1.386346 0.168747 - 83000 0.62621394 0.50082841 1.1270424 0.12294403 - 84000 0.5682146 0.73827702 1.3064916 0.085884707 - 85000 0.48179077 0.73669563 1.2184864 0.065002035 - 86000 0.61101399 0.80673836 1.4177523 0.037555163 - 87000 0.52278725 0.71608722 1.2388745 0.020943688 - 88000 0.53318823 0.50916748 1.0423557 -0.01946691 - 89000 0.56428713 0.56042234 1.1247095 0.040998134 - 90000 0.58720508 0.66023073 1.2474358 0.040313529 - 91000 0.61509407 0.86254343 1.4776375 0.15215034 - 92000 0.5640475 0.57694543 1.1409929 0.10238679 - 93000 0.60586378 0.67978456 1.2856483 -0.043948113 - 94000 0.75406595 0.74795347 1.5020194 0.015341415 - 95000 0.4974314 0.60192267 1.0993541 -0.018173218 - 96000 0.50048302 0.82845218 1.3289352 0.045394283 - 97000 0.65335222 0.6470855 1.3004377 0.011624967 - 98000 0.65693072 0.45222133 1.109152 0.13763684 - 99000 0.60573344 0.50284289 1.1085763 0.12853674 - 100000 0.50677068 0.58143063 1.0882013 0.11351254 -Loop time of 3.24642 on 4 procs for 100000 steps with 32 atoms - -Performance: 2661396.711 tau/day, 30803.203 timesteps/s -94.4% CPU use with 4 MPI tasks x 1 OpenMP threads - -MPI task timing breakdown: -Section | min time | avg time | max time |%varavg| %total ---------------------------------------------------------------- -Pair | 0.64148 | 0.70244 | 0.76391 | 6.5 | 21.64 -Neigh | 0.0049012 | 0.0050417 | 0.0052478 | 0.2 | 0.16 -Comm | 0.79447 | 0.88412 | 0.97443 | 8.1 | 27.23 -Output | 0.001776 | 0.0031438 | 0.0072262 | 4.2 | 0.10 -Modify | 1.325 | 1.3684 | 1.4049 | 2.4 | 42.15 -Other | | 0.2833 | | | 8.73 - -Nlocal: 8 ave 9 max 7 min -Histogram: 1 0 0 0 0 2 0 0 0 1 -Nghost: 14 ave 15 max 13 min -Histogram: 1 0 0 0 0 2 0 0 0 1 -Neighs: 13.25 ave 16 max 11 min -Histogram: 1 0 1 0 0 0 1 0 0 1 - -Total # of neighbors = 53 -Ave neighs/atom = 1.65625 -Neighbor list builds = 2654 -Dangerous builds = 0 -Total wall time: 0:00:03 From 4faebaf4ed32aae48f5a4f531821362913b91118 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Wed, 14 Jun 2023 14:53:06 -0400 Subject: [PATCH 270/396] add log files for fix pimd/langevin --- .../data.metalnpt01 | 0 .../data.metalnpt02 | 0 .../data.metalnpt03 | 0 .../data.metalnpt04 | 0 .../pimd/{lj => langevin_metal_units}/in.lmp | 6 +- .../log.14Jun23.langevin.metal.g++ | 2 + .../log.14Jun23.langevin.metal.g++.0 | 106 ++++++++++++++++++ .../log.14Jun23.langevin.metal.g++.1 | 106 ++++++++++++++++++ .../log.14Jun23.langevin.metal.g++.2 | 106 ++++++++++++++++++ .../log.14Jun23.langevin.metal.g++.3 | 106 ++++++++++++++++++ .../pimd/{lj => langevin_metal_units}/run.sh | 0 .../data.lj01 | 0 .../data.lj02 | 0 .../in.lmp | 6 +- .../log.14Jun23.langevin.reduced.g++ | 2 + .../log.14Jun23.langevin.reduced.g++.0 | 97 ++++++++++++++++ .../log.14Jun23.langevin.reduced.g++.1 | 97 ++++++++++++++++ .../run.sh | 0 18 files changed, 628 insertions(+), 6 deletions(-) rename examples/PACKAGES/pimd/{lj => langevin_metal_units}/data.metalnpt01 (100%) rename examples/PACKAGES/pimd/{lj => langevin_metal_units}/data.metalnpt02 (100%) rename examples/PACKAGES/pimd/{lj => langevin_metal_units}/data.metalnpt03 (100%) rename examples/PACKAGES/pimd/{lj => langevin_metal_units}/data.metalnpt04 (100%) rename examples/PACKAGES/pimd/{lj => langevin_metal_units}/in.lmp (56%) create mode 100644 examples/PACKAGES/pimd/langevin_metal_units/log.14Jun23.langevin.metal.g++ create mode 100644 examples/PACKAGES/pimd/langevin_metal_units/log.14Jun23.langevin.metal.g++.0 create mode 100644 examples/PACKAGES/pimd/langevin_metal_units/log.14Jun23.langevin.metal.g++.1 create mode 100644 examples/PACKAGES/pimd/langevin_metal_units/log.14Jun23.langevin.metal.g++.2 create mode 100644 examples/PACKAGES/pimd/langevin_metal_units/log.14Jun23.langevin.metal.g++.3 rename examples/PACKAGES/pimd/{lj => langevin_metal_units}/run.sh (100%) rename examples/PACKAGES/pimd/{lj_reduced_units => langevin_reduced_units}/data.lj01 (100%) rename examples/PACKAGES/pimd/{lj_reduced_units => langevin_reduced_units}/data.lj02 (100%) rename examples/PACKAGES/pimd/{lj_reduced_units => langevin_reduced_units}/in.lmp (56%) create mode 100644 examples/PACKAGES/pimd/langevin_reduced_units/log.14Jun23.langevin.reduced.g++ create mode 100644 examples/PACKAGES/pimd/langevin_reduced_units/log.14Jun23.langevin.reduced.g++.0 create mode 100644 examples/PACKAGES/pimd/langevin_reduced_units/log.14Jun23.langevin.reduced.g++.1 rename examples/PACKAGES/pimd/{lj_reduced_units => langevin_reduced_units}/run.sh (100%) diff --git a/examples/PACKAGES/pimd/lj/data.metalnpt01 b/examples/PACKAGES/pimd/langevin_metal_units/data.metalnpt01 similarity index 100% rename from examples/PACKAGES/pimd/lj/data.metalnpt01 rename to examples/PACKAGES/pimd/langevin_metal_units/data.metalnpt01 diff --git a/examples/PACKAGES/pimd/lj/data.metalnpt02 b/examples/PACKAGES/pimd/langevin_metal_units/data.metalnpt02 similarity index 100% rename from examples/PACKAGES/pimd/lj/data.metalnpt02 rename to examples/PACKAGES/pimd/langevin_metal_units/data.metalnpt02 diff --git a/examples/PACKAGES/pimd/lj/data.metalnpt03 b/examples/PACKAGES/pimd/langevin_metal_units/data.metalnpt03 similarity index 100% rename from examples/PACKAGES/pimd/lj/data.metalnpt03 rename to examples/PACKAGES/pimd/langevin_metal_units/data.metalnpt03 diff --git a/examples/PACKAGES/pimd/lj/data.metalnpt04 b/examples/PACKAGES/pimd/langevin_metal_units/data.metalnpt04 similarity index 100% rename from examples/PACKAGES/pimd/lj/data.metalnpt04 rename to examples/PACKAGES/pimd/langevin_metal_units/data.metalnpt04 diff --git a/examples/PACKAGES/pimd/lj/in.lmp b/examples/PACKAGES/pimd/langevin_metal_units/in.lmp similarity index 56% rename from examples/PACKAGES/pimd/lj/in.lmp rename to examples/PACKAGES/pimd/langevin_metal_units/in.lmp index 9670225958..124063df99 100644 --- a/examples/PACKAGES/pimd/lj/in.lmp +++ b/examples/PACKAGES/pimd/langevin_metal_units/in.lmp @@ -20,9 +20,9 @@ fix 1 all pimd/langevin ensemble npt integrator obabo thermostat PILE_L 1234 tau thermo_style custom step temp f_1[*] vol press thermo 100 -thermo_modify norm no format line "%d %.16f %.16f %.16f %.16f %.16f %.16f %.16f %.16f %.16f %.16f %.16f %.16f %.16f %.16f %.16f %.16f %.16f %.16f %.16f %.16f %.16f %.16f %.16f" +thermo_modify norm no -dump dcd all custom 100 ${ibead}.xyz id type xu yu zu vx vy vz ix iy iz fx fy fz -dump_modify dcd sort id format line "%d %d %.16f %.16f %.16f %.16f %.16f %.16f %d %d %d %.16f %.16f %.16f" +# dump dcd all custom 100 ${ibead}.dcd id type xu yu zu vx vy vz ix iy iz fx fy fz +# dump_modify dcd sort id format line "%d %d %.16f %.16f %.16f %.16f %.16f %.16f %d %d %d %.16f %.16f %.16f" run 1000 diff --git a/examples/PACKAGES/pimd/langevin_metal_units/log.14Jun23.langevin.metal.g++ b/examples/PACKAGES/pimd/langevin_metal_units/log.14Jun23.langevin.metal.g++ new file mode 100644 index 0000000000..fa22106766 --- /dev/null +++ b/examples/PACKAGES/pimd/langevin_metal_units/log.14Jun23.langevin.metal.g++ @@ -0,0 +1,2 @@ +LAMMPS (28 Mar 2023) +Running on 4 partitions of processors diff --git a/examples/PACKAGES/pimd/langevin_metal_units/log.14Jun23.langevin.metal.g++.0 b/examples/PACKAGES/pimd/langevin_metal_units/log.14Jun23.langevin.metal.g++.0 new file mode 100644 index 0000000000..00787df8ba --- /dev/null +++ b/examples/PACKAGES/pimd/langevin_metal_units/log.14Jun23.langevin.metal.g++.0 @@ -0,0 +1,106 @@ +LAMMPS (28 Mar 2023) +Processor partition = 0 + using 1 OpenMP thread(s) per MPI task +variable ibead uloop 99 pad + +units metal +atom_style atomic +atom_modify map yes +boundary p p p +pair_style lj/cut 9.5251 +read_data data.metalnpt${ibead} +read_data data.metalnpt01 +Reading data file ... + orthogonal box = (-11.876697 -11.876697 -11.876697) to (11.876697 11.876697 11.876697) + 1 by 1 by 1 MPI processor grid + reading atoms ... + 200 atoms + reading velocities ... + 200 velocities + read_data CPU = 0.001 seconds + +pair_coeff * * 0.00965188 3.4 +pair_modify shift yes + +mass 1 39.948 + +timestep 0.001 + +velocity all create 0.0 ${ibead} +velocity all create 0.0 01 + +fix 1 all pimd/langevin ensemble npt integrator obabo thermostat PILE_L 1234 tau 1.0 temp 113.15 iso 1.0 barostat BZP taup 1.0 fixcom no + +Initializing PIMD BZP barostat... +The barostat mass is W = 2.3401256650800001e+01 + +thermo_style custom step temp f_1[*] vol press +thermo 100 +thermo_modify norm no + +# dump dcd all custom 100 ${ibead}.dcd id type xu yu zu vx vy vz ix iy iz fx fy fz +# dump_modify dcd sort id format line "%d %d %.16f %.16f %.16f %.16f %.16f %.16f %d %d %d %.16f %.16f %.16f" + +run 1000 +Generated 0 of 0 mixed pair_coeff terms from geometric mixing rule + +Initializing PI Langevin equation thermostat... +Bead ID | omega | tau | c1 | c2 + 0 0.00000000e+00 1.00000000e+00 9.99500125e-01 3.16148726e-02 + 1 8.37986825e+01 5.96668092e-03 9.19616372e-01 3.92817678e-01 + 2 1.18509233e+02 4.21908054e-03 8.88243614e-01 4.59372705e-01 + 3 8.37986825e+01 5.96668092e-03 9.19616372e-01 3.92817678e-01 +PILE_L thermostat successfully initialized! + +Neighbor list info ... + update: every = 1 steps, delay = 0 steps, check = yes + max neighbors/atom: 2000, page size: 100000 + master list distance cutoff = 11.5251 + ghost atom cutoff = 11.5251 + binsize = 5.76255, bins = 5 5 5 + 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 + bin: standard +Per MPI rank memory allocation (min/avg/max) = 3.121 | 3.121 | 3.121 Mbytes + Step Temp f_1[1] f_1[2] f_1[3] f_1[4] f_1[5] f_1[6] f_1[7] f_1[8] f_1[9] f_1[10] f_1[11] f_1[12] f_1[13] f_1[14] f_1[15] Volume Press + 0 0 0 0 -7.3046601 4.3005229 -21.877018 -8.7249482 2.9571502 -1743.5332 -698.49808 -172.07477 0 0 0.033460054 -0.37064378 4.216227 13402.228 -164.47373 + 100 149.95804 3.8573359 0 -7.7921375 42.886648 -23.396327 -1.980193 2.954003 -1888.0547 -1648.7118 -332.0298 -0.099139345 0.11500091 0.033044702 -0.3701566 42.83112 13235.861 -101.30374 + 200 245.00113 6.3021074 0 -8.2639651 41.690123 -22.521598 -4.273021 2.9600599 -1906.2904 -1609.02 -265.94404 -0.20527926 0.49305948 0.031504957 -0.36829556 41.729191 12619.125 112.22426 + 300 300.57486 7.7316177 0 -8.2986331 43.180131 -21.755813 -7.7032433 2.9714114 -1968.7685 290.49656 251.72564 -0.21935745 0.56300721 0.029467915 -0.36568855 43.236828 11803.2 814.45889 + 400 368.08438 9.4681493 0 -8.4800193 49.109699 -24.824142 2.9744597 2.9794185 -2335.993 1368.7398 570.03286 -0.028366234 0.0094148316 0.028338146 -0.36416383 49.028096 11350.678 1202.0398 + 500 419.32066 10.786088 0 -8.640773 45.427771 -22.825143 16.22356 2.9684828 -2113.91 -272.84753 185.53392 0.091614289 0.098205455 0.028793585 -0.36478567 45.368325 11533.101 952.59748 + 600 385.4127 9.9138817 0 -8.4356035 47.783726 -22.456104 6.837575 2.967236 -2023.8117 -918.27943 -2.4106994 0.093360761 0.10198539 0.029589188 -0.36584873 47.725157 11851.775 676.62913 + 700 360.14242 9.2638601 0 -8.2900275 42.626187 -20.571698 -5.7252564 2.9560528 -1806.9448 -1418.2247 -148.41657 0.075011202 0.065835696 0.030359455 -0.36685105 42.558523 12160.301 456.91446 + 800 346.92167 8.923786 0 -8.0694169 45.160336 -21.885719 -6.7745694 2.9575472 -1894.3641 -1329.3179 -136.42193 0.011114896 0.0014455064 0.030808183 -0.3674233 45.076543 12340.037 454.60123 + 900 364.39442 9.3732334 0 -8.0415668 45.604542 -21.816625 5.586068 2.9578604 -1890.4653 -1271.1107 -111.89061 -0.020285587 0.0048148677 0.030774258 -0.36738033 45.521594 12326.448 499.75868 + 1000 390.77042 10.051697 0 -8.1948009 45.264242 -22.833545 6.9260573 2.960122 -2007.6188 -1179.7125 -70.907567 -0.062733519 0.046047757 0.030329191 -0.36681215 45.191633 12148.179 572.98799 +Loop time of 0.248186 on 1 procs for 1000 steps with 200 atoms + +Performance: 348.126 ns/day, 0.069 hours/ns, 4029.238 timesteps/s, 805.848 katom-step/s +99.6% CPU use with 1 MPI tasks x 1 OpenMP threads + +MPI task timing breakdown: +Section | min time | avg time | max time |%varavg| %total +--------------------------------------------------------------- +Pair | 0.14541 | 0.14541 | 0.14541 | 0.0 | 58.59 +Neigh | 0.00099082 | 0.00099082 | 0.00099082 | 0.0 | 0.40 +Comm | 0.0039966 | 0.0039966 | 0.0039966 | 0.0 | 1.61 +Output | 0.00016346 | 0.00016346 | 0.00016346 | 0.0 | 0.07 +Modify | 0.096205 | 0.096205 | 0.096205 | 0.0 | 38.76 +Other | | 0.001425 | | | 0.57 + +Nlocal: 200 ave 200 max 200 min +Histogram: 1 0 0 0 0 0 0 0 0 0 +Nghost: 1342 ave 1342 max 1342 min +Histogram: 1 0 0 0 0 0 0 0 0 0 +Neighs: 10325 ave 10325 max 10325 min +Histogram: 1 0 0 0 0 0 0 0 0 0 + +Total # of neighbors = 10325 +Ave neighs/atom = 51.625 +Neighbor list builds = 4 +Dangerous builds = 0 +Total wall time: 0:00:00 diff --git a/examples/PACKAGES/pimd/langevin_metal_units/log.14Jun23.langevin.metal.g++.1 b/examples/PACKAGES/pimd/langevin_metal_units/log.14Jun23.langevin.metal.g++.1 new file mode 100644 index 0000000000..83821cafb7 --- /dev/null +++ b/examples/PACKAGES/pimd/langevin_metal_units/log.14Jun23.langevin.metal.g++.1 @@ -0,0 +1,106 @@ +LAMMPS (28 Mar 2023) +Processor partition = 1 + using 1 OpenMP thread(s) per MPI task +variable ibead uloop 99 pad + +units metal +atom_style atomic +atom_modify map yes +boundary p p p +pair_style lj/cut 9.5251 +read_data data.metalnpt${ibead} +read_data data.metalnpt02 +Reading data file ... + orthogonal box = (-11.876697 -11.876697 -11.876697) to (11.876697 11.876697 11.876697) + 1 by 1 by 1 MPI processor grid + reading atoms ... + 200 atoms + reading velocities ... + 200 velocities + read_data CPU = 0.001 seconds + +pair_coeff * * 0.00965188 3.4 +pair_modify shift yes + +mass 1 39.948 + +timestep 0.001 + +velocity all create 0.0 ${ibead} +velocity all create 0.0 02 + +fix 1 all pimd/langevin ensemble npt integrator obabo thermostat PILE_L 1234 tau 1.0 temp 113.15 iso 1.0 barostat BZP taup 1.0 fixcom no + +Initializing PIMD BZP barostat... +The barostat mass is W = 2.3401256650800001e+01 + +thermo_style custom step temp f_1[*] vol press +thermo 100 +thermo_modify norm no + +# dump dcd all custom 100 ${ibead}.dcd id type xu yu zu vx vy vz ix iy iz fx fy fz +# dump_modify dcd sort id format line "%d %d %.16f %.16f %.16f %.16f %.16f %.16f %d %d %d %.16f %.16f %.16f" + +run 1000 +Generated 0 of 0 mixed pair_coeff terms from geometric mixing rule + +Initializing PI Langevin equation thermostat... +Bead ID | omega | tau | c1 | c2 + 0 0.00000000e+00 1.00000000e+00 9.99500125e-01 3.16148726e-02 + 1 8.37986825e+01 5.96668092e-03 9.19616372e-01 3.92817678e-01 + 2 1.18509233e+02 4.21908054e-03 8.88243614e-01 4.59372705e-01 + 3 8.37986825e+01 5.96668092e-03 9.19616372e-01 3.92817678e-01 +PILE_L thermostat successfully initialized! + +Neighbor list info ... + update: every = 1 steps, delay = 0 steps, check = yes + max neighbors/atom: 2000, page size: 100000 + master list distance cutoff = 11.5251 + ghost atom cutoff = 11.5251 + binsize = 5.76255, bins = 5 5 5 + 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 + bin: standard +Per MPI rank memory allocation (min/avg/max) = 3.121 | 3.121 | 3.121 Mbytes + Step Temp f_1[1] f_1[2] f_1[3] f_1[4] f_1[5] f_1[6] f_1[7] f_1[8] f_1[9] f_1[10] f_1[11] f_1[12] f_1[13] f_1[14] f_1[15] Volume Press + 0 0 0 11.920908 -7.3063682 4.3005229 -21.877018 -8.7249482 2.9571502 -1743.5332 -698.49808 -172.07477 0 0 0.033460054 -0.37064378 4.216227 13402.228 -167.65544 + 100 483.61933 12.440028 11.405863 -7.7749671 42.886648 -23.396327 -1.980193 2.954003 -1888.0547 -1648.7118 -332.0298 -0.099139345 0.11500091 0.033044702 -0.3701566 42.83112 13235.861 606.14668 + 200 452.03836 11.627678 11.47094 -8.2534927 41.690123 -22.521598 -4.273021 2.9600599 -1906.2904 -1609.02 -265.94404 -0.20527926 0.49305948 0.031504957 -0.36829556 41.729191 12619.125 583.5476 + 300 470.25997 12.096389 11.739306 -8.3750153 43.180131 -21.755813 -7.7032433 2.9714114 -1968.7685 290.49656 251.72564 -0.21935745 0.56300721 0.029467915 -0.36568855 43.236828 11803.2 1152.6851 + 400 459.46597 11.818737 12.502421 -8.5240576 49.109699 -24.824142 2.9744597 2.9794185 -2335.993 1368.7398 570.03286 -0.028366234 0.0094148316 0.028338146 -0.36416383 49.028096 11350.678 1381.0251 + 500 442.73121 11.388273 11.19396 -8.6488583 45.427771 -22.825143 16.22356 2.9684828 -2113.91 -272.84753 185.53392 0.091614289 0.098205455 0.028793585 -0.36478567 45.368325 11533.101 1000.6119 + 600 493.47034 12.693424 11.91335 -8.4625706 47.783726 -22.456104 6.837575 2.967236 -2023.8117 -918.27943 -2.4106994 0.093360761 0.10198539 0.029589188 -0.36584873 47.725157 11851.775 904.52944 + 700 470.04548 12.090871 10.348757 -8.278182 42.626187 -20.571698 -5.7252564 2.9560528 -1806.9448 -1418.2247 -148.41657 0.075011202 0.065835696 0.030359455 -0.36685105 42.558523 12160.301 715.22796 + 800 458.04928 11.782296 11.152029 -8.0926613 45.160336 -21.885719 -6.7745694 2.9575472 -1894.3641 -1329.3179 -136.42193 0.011114896 0.0014455064 0.030808183 -0.3674233 45.076543 12340.037 678.21261 + 900 468.60547 12.05383 10.937315 -8.0319335 45.604542 -21.816625 5.586068 2.9578604 -1890.4653 -1271.1107 -111.89061 -0.020285587 0.0048148677 0.030774258 -0.36738033 45.521594 12326.448 735.24377 + 1000 427.44192 10.99499 11.916587 -8.2229199 45.264242 -22.833545 6.9260573 2.960122 -2007.6188 -1179.7125 -70.907567 -0.062733519 0.046047757 0.030329191 -0.36681215 45.191633 12148.179 637.98311 +Loop time of 0.248186 on 1 procs for 1000 steps with 200 atoms + +Performance: 348.126 ns/day, 0.069 hours/ns, 4029.238 timesteps/s, 805.848 katom-step/s +99.5% CPU use with 1 MPI tasks x 1 OpenMP threads + +MPI task timing breakdown: +Section | min time | avg time | max time |%varavg| %total +--------------------------------------------------------------- +Pair | 0.14654 | 0.14654 | 0.14654 | 0.0 | 59.04 +Neigh | 0.00099986 | 0.00099986 | 0.00099986 | 0.0 | 0.40 +Comm | 0.0041628 | 0.0041628 | 0.0041628 | 0.0 | 1.68 +Output | 0.00018019 | 0.00018019 | 0.00018019 | 0.0 | 0.07 +Modify | 0.094878 | 0.094878 | 0.094878 | 0.0 | 38.23 +Other | | 0.001424 | | | 0.57 + +Nlocal: 200 ave 200 max 200 min +Histogram: 1 0 0 0 0 0 0 0 0 0 +Nghost: 1346 ave 1346 max 1346 min +Histogram: 1 0 0 0 0 0 0 0 0 0 +Neighs: 10328 ave 10328 max 10328 min +Histogram: 1 0 0 0 0 0 0 0 0 0 + +Total # of neighbors = 10328 +Ave neighs/atom = 51.64 +Neighbor list builds = 4 +Dangerous builds = 0 +Total wall time: 0:00:00 diff --git a/examples/PACKAGES/pimd/langevin_metal_units/log.14Jun23.langevin.metal.g++.2 b/examples/PACKAGES/pimd/langevin_metal_units/log.14Jun23.langevin.metal.g++.2 new file mode 100644 index 0000000000..fd8dd409ae --- /dev/null +++ b/examples/PACKAGES/pimd/langevin_metal_units/log.14Jun23.langevin.metal.g++.2 @@ -0,0 +1,106 @@ +LAMMPS (28 Mar 2023) +Processor partition = 2 + using 1 OpenMP thread(s) per MPI task +variable ibead uloop 99 pad + +units metal +atom_style atomic +atom_modify map yes +boundary p p p +pair_style lj/cut 9.5251 +read_data data.metalnpt${ibead} +read_data data.metalnpt03 +Reading data file ... + orthogonal box = (-11.876697 -11.876697 -11.876697) to (11.876697 11.876697 11.876697) + 1 by 1 by 1 MPI processor grid + reading atoms ... + 200 atoms + reading velocities ... + 200 velocities + read_data CPU = 0.001 seconds + +pair_coeff * * 0.00965188 3.4 +pair_modify shift yes + +mass 1 39.948 + +timestep 0.001 + +velocity all create 0.0 ${ibead} +velocity all create 0.0 03 + +fix 1 all pimd/langevin ensemble npt integrator obabo thermostat PILE_L 1234 tau 1.0 temp 113.15 iso 1.0 barostat BZP taup 1.0 fixcom no + +Initializing PIMD BZP barostat... +The barostat mass is W = 2.3401256650800001e+01 + +thermo_style custom step temp f_1[*] vol press +thermo 100 +thermo_modify norm no + +# dump dcd all custom 100 ${ibead}.dcd id type xu yu zu vx vy vz ix iy iz fx fy fz +# dump_modify dcd sort id format line "%d %d %.16f %.16f %.16f %.16f %.16f %.16f %d %d %d %.16f %.16f %.16f" + +run 1000 +Generated 0 of 0 mixed pair_coeff terms from geometric mixing rule + +Initializing PI Langevin equation thermostat... +Bead ID | omega | tau | c1 | c2 + 0 0.00000000e+00 1.00000000e+00 9.99500125e-01 3.16148726e-02 + 1 8.37986825e+01 5.96668092e-03 9.19616372e-01 3.92817678e-01 + 2 1.18509233e+02 4.21908054e-03 8.88243614e-01 4.59372705e-01 + 3 8.37986825e+01 5.96668092e-03 9.19616372e-01 3.92817678e-01 +PILE_L thermostat successfully initialized! + +Neighbor list info ... + update: every = 1 steps, delay = 0 steps, check = yes + max neighbors/atom: 2000, page size: 100000 + master list distance cutoff = 11.5251 + ghost atom cutoff = 11.5251 + binsize = 5.76255, bins = 5 5 5 + 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 + bin: standard +Per MPI rank memory allocation (min/avg/max) = 3.121 | 3.121 | 3.121 Mbytes + Step Temp f_1[1] f_1[2] f_1[3] f_1[4] f_1[5] f_1[6] f_1[7] f_1[8] f_1[9] f_1[10] f_1[11] f_1[12] f_1[13] f_1[14] f_1[15] Volume Press + 0 0 0 10.862314 -7.320388 4.3005229 -21.877018 -8.7249482 2.9571502 -1743.5332 -698.49808 -172.07477 0 0 0.033460054 -0.37064378 4.216227 13402.228 -175.34503 + 100 455.18121 11.708521 11.48472 -7.8033686 42.886648 -23.396327 -1.980193 2.954003 -1888.0547 -1648.7118 -332.0298 -0.099139345 0.11500091 0.033044702 -0.3701566 42.83112 13235.861 526.41632 + 200 460.81997 11.853566 10.817157 -8.2276485 41.690123 -22.521598 -4.273021 2.9600599 -1906.2904 -1609.02 -265.94404 -0.20527926 0.49305948 0.031504957 -0.36829556 41.729191 12619.125 615.80924 + 300 481.48652 12.385166 10.035423 -8.3866916 43.180131 -21.755813 -7.7032433 2.9714114 -1968.7685 290.49656 251.72564 -0.21935745 0.56300721 0.029467915 -0.36568855 43.236828 11803.2 1169.2917 + 400 487.3584 12.536208 11.766522 -8.3643382 49.109699 -24.824142 2.9744597 2.9794185 -2335.993 1368.7398 570.03286 -0.028366234 0.0094148316 0.028338146 -0.36416383 49.028096 11350.678 1574.1427 + 500 446.36019 11.48162 12.144202 -8.680266 45.427771 -22.825143 16.22356 2.9684828 -2113.91 -272.84753 185.53392 0.091614289 0.098205455 0.028793585 -0.36478567 45.368325 11533.101 979.68395 + 600 500.3783 12.871115 11.075008 -8.47833 47.783726 -22.456104 6.837575 2.967236 -2023.8117 -918.27943 -2.4106994 0.093360761 0.10198539 0.029589188 -0.36584873 47.725157 11851.775 912.39361 + 700 435.40634 11.199857 10.923558 -8.3090105 42.626187 -20.571698 -5.7252564 2.9560528 -1806.9448 -1418.2247 -148.41657 0.075011202 0.065835696 0.030359455 -0.36685105 42.558523 12160.301 617.20857 + 800 446.82793 11.493652 11.599712 -8.0900498 45.160336 -21.885719 -6.7745694 2.9575472 -1894.3641 -1329.3179 -136.42193 0.011114896 0.0014455064 0.030808183 -0.3674233 45.076543 12340.037 652.13243 + 900 448.28506 11.531133 12.130739 -8.0810557 45.604542 -21.816625 5.586068 2.9578604 -1890.4653 -1271.1107 -111.89061 -0.020285587 0.0048148677 0.030774258 -0.36738033 45.521594 12326.448 674.68073 + 1000 440.94913 11.342433 10.765654 -8.1419484 45.264242 -22.833545 6.9260573 2.960122 -2007.6188 -1179.7125 -70.907567 -0.062733519 0.046047757 0.030329191 -0.36681215 45.191633 12148.179 730.67128 +Loop time of 0.248185 on 1 procs for 1000 steps with 200 atoms + +Performance: 348.128 ns/day, 0.069 hours/ns, 4029.259 timesteps/s, 805.852 katom-step/s +97.8% CPU use with 1 MPI tasks x 1 OpenMP threads + +MPI task timing breakdown: +Section | min time | avg time | max time |%varavg| %total +--------------------------------------------------------------- +Pair | 0.14702 | 0.14702 | 0.14702 | 0.0 | 59.24 +Neigh | 0.0010003 | 0.0010003 | 0.0010003 | 0.0 | 0.40 +Comm | 0.0039821 | 0.0039821 | 0.0039821 | 0.0 | 1.60 +Output | 0.00023527 | 0.00023527 | 0.00023527 | 0.0 | 0.09 +Modify | 0.094519 | 0.094519 | 0.094519 | 0.0 | 38.08 +Other | | 0.001427 | | | 0.58 + +Nlocal: 200 ave 200 max 200 min +Histogram: 1 0 0 0 0 0 0 0 0 0 +Nghost: 1346 ave 1346 max 1346 min +Histogram: 1 0 0 0 0 0 0 0 0 0 +Neighs: 10313 ave 10313 max 10313 min +Histogram: 1 0 0 0 0 0 0 0 0 0 + +Total # of neighbors = 10313 +Ave neighs/atom = 51.565 +Neighbor list builds = 4 +Dangerous builds = 0 +Total wall time: 0:00:00 diff --git a/examples/PACKAGES/pimd/langevin_metal_units/log.14Jun23.langevin.metal.g++.3 b/examples/PACKAGES/pimd/langevin_metal_units/log.14Jun23.langevin.metal.g++.3 new file mode 100644 index 0000000000..423ebb7d63 --- /dev/null +++ b/examples/PACKAGES/pimd/langevin_metal_units/log.14Jun23.langevin.metal.g++.3 @@ -0,0 +1,106 @@ +LAMMPS (28 Mar 2023) +Processor partition = 3 + using 1 OpenMP thread(s) per MPI task +variable ibead uloop 99 pad + +units metal +atom_style atomic +atom_modify map yes +boundary p p p +pair_style lj/cut 9.5251 +read_data data.metalnpt${ibead} +read_data data.metalnpt04 +Reading data file ... + orthogonal box = (-11.876697 -11.876697 -11.876697) to (11.876697 11.876697 11.876697) + 1 by 1 by 1 MPI processor grid + reading atoms ... + 200 atoms + reading velocities ... + 200 velocities + read_data CPU = 0.001 seconds + +pair_coeff * * 0.00965188 3.4 +pair_modify shift yes + +mass 1 39.948 + +timestep 0.001 + +velocity all create 0.0 ${ibead} +velocity all create 0.0 04 + +fix 1 all pimd/langevin ensemble npt integrator obabo thermostat PILE_L 1234 tau 1.0 temp 113.15 iso 1.0 barostat BZP taup 1.0 fixcom no + +Initializing PIMD BZP barostat... +The barostat mass is W = 2.3401256650800001e+01 + +thermo_style custom step temp f_1[*] vol press +thermo 100 +thermo_modify norm no + +# dump dcd all custom 100 ${ibead}.dcd id type xu yu zu vx vy vz ix iy iz fx fy fz +# dump_modify dcd sort id format line "%d %d %.16f %.16f %.16f %.16f %.16f %.16f %d %d %d %.16f %.16f %.16f" + +run 1000 +Generated 0 of 0 mixed pair_coeff terms from geometric mixing rule + +Initializing PI Langevin equation thermostat... +Bead ID | omega | tau | c1 | c2 + 0 0.00000000e+00 1.00000000e+00 9.99500125e-01 3.16148726e-02 + 1 8.37986825e+01 5.96668092e-03 9.19616372e-01 3.92817678e-01 + 2 1.18509233e+02 4.21908054e-03 8.88243614e-01 4.59372705e-01 + 3 8.37986825e+01 5.96668092e-03 9.19616372e-01 3.92817678e-01 +PILE_L thermostat successfully initialized! + +Neighbor list info ... + update: every = 1 steps, delay = 0 steps, check = yes + max neighbors/atom: 2000, page size: 100000 + master list distance cutoff = 11.5251 + ghost atom cutoff = 11.5251 + binsize = 5.76255, bins = 5 5 5 + 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 + bin: standard +Per MPI rank memory allocation (min/avg/max) = 3.121 | 3.121 | 3.121 Mbytes + Step Temp f_1[1] f_1[2] f_1[3] f_1[4] f_1[5] f_1[6] f_1[7] f_1[8] f_1[9] f_1[10] f_1[11] f_1[12] f_1[13] f_1[14] f_1[15] Volume Press + 0 0 0 10.794425 -7.3457072 4.3005229 -21.877018 -8.7249482 2.9571502 -1743.5332 -698.49808 -172.07477 0 0 0.033460054 -0.37064378 4.216227 13402.228 -191.02389 + 100 426.01705 10.958338 12.206372 -7.8040582 42.886648 -23.396327 -1.980193 2.954003 -1888.0547 -1648.7118 -332.0298 -0.099139345 0.11500091 0.033044702 -0.3701566 42.83112 13235.861 464.39271 + 200 414.52703 10.662783 11.934129 -8.2331312 41.690123 -22.521598 -4.273021 2.9600599 -1906.2904 -1609.02 -265.94404 -0.20527926 0.49305948 0.031504957 -0.36829556 41.729191 12619.125 502.87052 + 300 424.85622 10.928478 11.681713 -8.357621 43.180131 -21.755813 -7.7032433 2.9714114 -1968.7685 290.49656 251.72564 -0.21935745 0.56300721 0.029467915 -0.36568855 43.236828 11803.2 1058.1162 + 400 485.80103 12.496148 12.255827 -8.3658975 49.109699 -24.824142 2.9744597 2.9794185 -2335.993 1368.7398 570.03286 -0.028366234 0.0094148316 0.028338146 -0.36416383 49.028096 11350.678 1570.2486 + 500 462.99006 11.909386 11.187609 -8.6934698 45.427771 -22.825143 16.22356 2.9684828 -2113.91 -272.84753 185.53392 0.091614289 0.098205455 0.028793585 -0.36478567 45.368325 11533.101 1014.2134 + 600 465.24407 11.967366 11.168375 -8.4422887 47.783726 -22.456104 6.837575 2.967236 -2023.8117 -918.27943 -2.4106994 0.093360761 0.10198539 0.029589188 -0.36584873 47.725157 11851.775 864.12413 + 700 426.16111 10.962044 11.000011 -8.2855512 42.626187 -20.571698 -5.7252564 2.9560528 -1806.9448 -1418.2247 -148.41657 0.075011202 0.065835696 0.030359455 -0.36685105 42.558523 12160.301 614.76939 + 800 454.53159 11.691811 10.834606 -8.0654281 45.160336 -21.885719 -6.7745694 2.9575472 -1894.3641 -1329.3179 -136.42193 0.011114896 0.0014455064 0.030808183 -0.3674233 45.076543 12340.037 684.85907 + 900 441.72064 11.362278 10.4492 -8.0786302 45.604542 -21.816625 5.586068 2.9578604 -1890.4653 -1271.1107 -111.89061 -0.020285587 0.0048148677 0.030774258 -0.36738033 45.521594 12326.448 659.68525 + 1000 429.90929 11.058457 11.851933 -8.1578394 45.264242 -22.833545 6.9260573 2.960122 -2007.6188 -1179.7125 -70.907567 -0.062733519 0.046047757 0.030329191 -0.36681215 45.191633 12148.179 698.73278 +Loop time of 0.248175 on 1 procs for 1000 steps with 200 atoms + +Performance: 348.141 ns/day, 0.069 hours/ns, 4029.409 timesteps/s, 805.882 katom-step/s +98.1% CPU use with 1 MPI tasks x 1 OpenMP threads + +MPI task timing breakdown: +Section | min time | avg time | max time |%varavg| %total +--------------------------------------------------------------- +Pair | 0.14919 | 0.14919 | 0.14919 | 0.0 | 60.12 +Neigh | 0.00099112 | 0.00099112 | 0.00099112 | 0.0 | 0.40 +Comm | 0.0040992 | 0.0040992 | 0.0040992 | 0.0 | 1.65 +Output | 0.0001723 | 0.0001723 | 0.0001723 | 0.0 | 0.07 +Modify | 0.092299 | 0.092299 | 0.092299 | 0.0 | 37.19 +Other | | 0.00142 | | | 0.57 + +Nlocal: 200 ave 200 max 200 min +Histogram: 1 0 0 0 0 0 0 0 0 0 +Nghost: 1346 ave 1346 max 1346 min +Histogram: 1 0 0 0 0 0 0 0 0 0 +Neighs: 10332 ave 10332 max 10332 min +Histogram: 1 0 0 0 0 0 0 0 0 0 + +Total # of neighbors = 10332 +Ave neighs/atom = 51.66 +Neighbor list builds = 4 +Dangerous builds = 0 +Total wall time: 0:00:00 diff --git a/examples/PACKAGES/pimd/lj/run.sh b/examples/PACKAGES/pimd/langevin_metal_units/run.sh similarity index 100% rename from examples/PACKAGES/pimd/lj/run.sh rename to examples/PACKAGES/pimd/langevin_metal_units/run.sh diff --git a/examples/PACKAGES/pimd/lj_reduced_units/data.lj01 b/examples/PACKAGES/pimd/langevin_reduced_units/data.lj01 similarity index 100% rename from examples/PACKAGES/pimd/lj_reduced_units/data.lj01 rename to examples/PACKAGES/pimd/langevin_reduced_units/data.lj01 diff --git a/examples/PACKAGES/pimd/lj_reduced_units/data.lj02 b/examples/PACKAGES/pimd/langevin_reduced_units/data.lj02 similarity index 100% rename from examples/PACKAGES/pimd/lj_reduced_units/data.lj02 rename to examples/PACKAGES/pimd/langevin_reduced_units/data.lj02 diff --git a/examples/PACKAGES/pimd/lj_reduced_units/in.lmp b/examples/PACKAGES/pimd/langevin_reduced_units/in.lmp similarity index 56% rename from examples/PACKAGES/pimd/lj_reduced_units/in.lmp rename to examples/PACKAGES/pimd/langevin_reduced_units/in.lmp index 012214c4b2..80bfbe4956 100644 --- a/examples/PACKAGES/pimd/lj_reduced_units/in.lmp +++ b/examples/PACKAGES/pimd/langevin_reduced_units/in.lmp @@ -18,9 +18,9 @@ fix 1 all pimd/langevin ensemble nvt integrator obabo temp 1.00888 lj 0.00965188 thermo_style custom step temp f_1[*] vol press thermo 100 -thermo_modify norm no format line "%d %.16f %.16f %.16f %.16f %.16f %.16f %.16f %.16f %.16f %.16f %.16f %.16f %.16f %.16f %.16f %.16f %.16f %.16f %.16f %.16f %.16f" +thermo_modify norm no -dump dcd all custom 1 ${ibead}.xyz id type x y z vx vy vz ix iy iz fx fy fz -dump_modify dcd sort id format line "%d %d %.16f %.16f %.16f %.16f %.16f %.16f %d %d %d %.16f %.16f %.16f" +#dump dcd all custom 1 ${ibead}.lammpstrj id type x y z vx vy vz ix iy iz fx fy fz +#dump_modify dcd sort id format line "%d %d %.16f %.16f %.16f %.16f %.16f %.16f %d %d %d %.16f %.16f %.16f" run 1000 diff --git a/examples/PACKAGES/pimd/langevin_reduced_units/log.14Jun23.langevin.reduced.g++ b/examples/PACKAGES/pimd/langevin_reduced_units/log.14Jun23.langevin.reduced.g++ new file mode 100644 index 0000000000..4ed421dddb --- /dev/null +++ b/examples/PACKAGES/pimd/langevin_reduced_units/log.14Jun23.langevin.reduced.g++ @@ -0,0 +1,2 @@ +LAMMPS (28 Mar 2023) +Running on 2 partitions of processors diff --git a/examples/PACKAGES/pimd/langevin_reduced_units/log.14Jun23.langevin.reduced.g++.0 b/examples/PACKAGES/pimd/langevin_reduced_units/log.14Jun23.langevin.reduced.g++.0 new file mode 100644 index 0000000000..d219e20845 --- /dev/null +++ b/examples/PACKAGES/pimd/langevin_reduced_units/log.14Jun23.langevin.reduced.g++.0 @@ -0,0 +1,97 @@ +LAMMPS (28 Mar 2023) +Processor partition = 0 + using 1 OpenMP thread(s) per MPI task +variable ibead uloop 32 pad + +units lj +atom_style atomic +atom_modify map yes +boundary p p p +pair_style lj/cut 2.8015 +read_data data.lj${ibead} +read_data data.lj01 +Reading data file ... + orthogonal box = (-3.4945131 -3.4945131 -3.4945131) to (3.4945131 3.4945131 3.4945131) + 1 by 1 by 1 MPI processor grid + reading atoms ... + 200 atoms + read_data CPU = 0.001 seconds + +pair_coeff * * 1.0 1.0 +pair_modify shift yes + +mass 1 1.0 + +timestep 0.00044905847 + +fix 1 all pimd/langevin ensemble nvt integrator obabo temp 1.00888 lj 0.00965188 3.4 39.948 4.135667403e-3 1.03646168908e-4 thermostat PILE_L ${ibead} +fix 1 all pimd/langevin ensemble nvt integrator obabo temp 1.00888 lj 0.00965188 3.4 39.948 4.135667403e-3 1.03646168908e-4 thermostat PILE_L 01 + +thermo_style custom step temp f_1[*] vol press +thermo 100 +thermo_modify norm no + +#dump dcd all custom 1 ${ibead}.lammpstrj id type x y z vx vy vz ix iy iz fx fy fz +#dump_modify dcd sort id format line "%d %d %.16f %.16f %.16f %.16f %.16f %.16f %d %d %d %.16f %.16f %.16f" + +run 1000 +Generated 0 of 0 mixed pair_coeff terms from geometric mixing rule + +Initializing PI Langevin equation thermostat... +Bead ID | omega | tau | c1 | c2 + 0 0.00000000e+00 1.00000000e+00 9.99775496e-01 2.11886210e-02 + 1 1.31777963e+02 3.79426112e-03 9.42540858e-01 3.34090903e-01 +PILE_L thermostat successfully initialized! + +Neighbor list info ... + update: every = 1 steps, delay = 0 steps, check = yes + max neighbors/atom: 2000, page size: 100000 + master list distance cutoff = 3.1015 + ghost atom cutoff = 3.1015 + binsize = 1.55075, bins = 5 5 5 + 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 + bin: standard +Per MPI rank memory allocation (min/avg/max) = 3.117 | 3.117 | 3.117 Mbytes + Step Temp f_1[1] f_1[2] f_1[3] f_1[4] f_1[5] f_1[6] f_1[7] f_1[8] f_1[9] f_1[10] Volume Press + 0 0 0 0 -875.67022 841866.06 -843041.14 253.30998 382.47517 -1646.2945 -1.9663356 -0.82731217 341.38937 -1.3810467 + 100 14.815998 4422.5753 0 -534.91485 5336.9805 -409.03828 7790.9787 306.80845 -0.79877176 13.250868 8.3263811 341.38937 12.561531 + 200 13.762526 4108.114 0 -535.07896 4177.1707 63.548813 -8225.489 308.68383 0.1240984 12.723365 8.0800159 341.38937 12.1757 + 300 12.566448 3751.0847 0 -493.13907 3999.3337 -31.433066 8675.7059 309.21599 -0.061382631 14.105486 8.6052841 341.38937 12.245009 + 400 11.843976 3535.4267 0 -515.14836 3784.077 -23.971605 -81.467506 309.02093 -0.046811856 13.638064 8.2470184 341.38937 11.61585 + 500 11.100239 3313.4214 0 -521.49831 3555.6926 -56.076799 648.94757 309.45936 -0.10950702 12.805213 7.7261445 341.38937 10.991018 + 600 9.9616183 2973.5431 0 -462.72888 3219.061 41.992567 3171.6576 309.48724 0.082003271 13.759365 8.0375919 341.38937 11.071546 + 700 9.3388468 2787.6458 0 -501.33865 2901.4483 81.033913 2000.5159 309.02619 0.15824338 12.744135 7.4580508 341.38937 10.129991 + 800 8.9069211 2658.716 0 -523.1858 2864.6773 -29.435005 2329.1521 308.67617 -0.057480808 11.604242 6.8135454 341.38937 9.3513467 + 900 8.5046965 2538.6519 0 -543.75602 2597.5491 50.752591 601.47078 308.62547 0.099109884 10.497389 6.2142574 341.38937 8.6389792 + 1000 8.0725601 2409.6592 0 -571.72872 2533.47 -23.431499 -1267.4683 308.58765 -0.045757135 9.421094 5.5928021 341.38937 7.8375753 +Loop time of 0.201181 on 1 procs for 1000 steps with 200 atoms + +Performance: 192854.150 tau/day, 4970.640 timesteps/s, 994.128 katom-step/s +98.8% CPU use with 1 MPI tasks x 1 OpenMP threads + +MPI task timing breakdown: +Section | min time | avg time | max time |%varavg| %total +--------------------------------------------------------------- +Pair | 0.11949 | 0.11949 | 0.11949 | 0.0 | 59.39 +Neigh | 0.011868 | 0.011868 | 0.011868 | 0.0 | 5.90 +Comm | 0.0041169 | 0.0041169 | 0.0041169 | 0.0 | 2.05 +Output | 0.00011916 | 0.00011916 | 0.00011916 | 0.0 | 0.06 +Modify | 0.064249 | 0.064249 | 0.064249 | 0.0 | 31.94 +Other | | 0.00134 | | | 0.67 + +Nlocal: 200 ave 200 max 200 min +Histogram: 1 0 0 0 0 0 0 0 0 0 +Nghost: 1117 ave 1117 max 1117 min +Histogram: 1 0 0 0 0 0 0 0 0 0 +Neighs: 7492 ave 7492 max 7492 min +Histogram: 1 0 0 0 0 0 0 0 0 0 + +Total # of neighbors = 7492 +Ave neighs/atom = 37.46 +Neighbor list builds = 55 +Dangerous builds = 0 +Total wall time: 0:00:00 diff --git a/examples/PACKAGES/pimd/langevin_reduced_units/log.14Jun23.langevin.reduced.g++.1 b/examples/PACKAGES/pimd/langevin_reduced_units/log.14Jun23.langevin.reduced.g++.1 new file mode 100644 index 0000000000..0804a3488a --- /dev/null +++ b/examples/PACKAGES/pimd/langevin_reduced_units/log.14Jun23.langevin.reduced.g++.1 @@ -0,0 +1,97 @@ +LAMMPS (28 Mar 2023) +Processor partition = 1 + using 1 OpenMP thread(s) per MPI task +variable ibead uloop 32 pad + +units lj +atom_style atomic +atom_modify map yes +boundary p p p +pair_style lj/cut 2.8015 +read_data data.lj${ibead} +read_data data.lj02 +Reading data file ... + orthogonal box = (-3.4945131 -3.4945131 -3.4945131) to (3.4945131 3.4945131 3.4945131) + 1 by 1 by 1 MPI processor grid + reading atoms ... + 200 atoms + read_data CPU = 0.001 seconds + +pair_coeff * * 1.0 1.0 +pair_modify shift yes + +mass 1 1.0 + +timestep 0.00044905847 + +fix 1 all pimd/langevin ensemble nvt integrator obabo temp 1.00888 lj 0.00965188 3.4 39.948 4.135667403e-3 1.03646168908e-4 thermostat PILE_L ${ibead} +fix 1 all pimd/langevin ensemble nvt integrator obabo temp 1.00888 lj 0.00965188 3.4 39.948 4.135667403e-3 1.03646168908e-4 thermostat PILE_L 02 + +thermo_style custom step temp f_1[*] vol press +thermo 100 +thermo_modify norm no + +#dump dcd all custom 1 ${ibead}.lammpstrj id type x y z vx vy vz ix iy iz fx fy fz +#dump_modify dcd sort id format line "%d %d %.16f %.16f %.16f %.16f %.16f %.16f %d %d %d %.16f %.16f %.16f" + +run 1000 +Generated 0 of 0 mixed pair_coeff terms from geometric mixing rule + +Initializing PI Langevin equation thermostat... +Bead ID | omega | tau | c1 | c2 + 0 0.00000000e+00 1.00000000e+00 9.99775496e-01 2.11886210e-02 + 1 1.31777963e+02 3.79426112e-03 9.42540858e-01 3.34090903e-01 +PILE_L thermostat successfully initialized! + +Neighbor list info ... + update: every = 1 steps, delay = 0 steps, check = yes + max neighbors/atom: 2000, page size: 100000 + master list distance cutoff = 3.1015 + ghost atom cutoff = 3.1015 + binsize = 1.55075, bins = 5 5 5 + 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 + bin: standard +Per MPI rank memory allocation (min/avg/max) = 3.117 | 3.117 | 3.117 Mbytes + Step Temp f_1[1] f_1[2] f_1[3] f_1[4] f_1[5] f_1[6] f_1[7] f_1[8] f_1[9] f_1[10] Volume Press + 0 0 0 843646.47 -904.74343 841866.06 -843041.14 253.30998 382.47517 -1646.2945 -1.9663356 -0.82731217 341.38937 -0.58528882 + 100 3.1994696 955.04167 1014.3663 -520.08788 5336.9805 -409.03828 7790.9787 306.80845 -0.79877176 13.250868 8.3263811 341.38937 5.9400539 + 200 2.0518234 612.46927 541.77919 -550.11284 4177.1707 63.548813 -8225.489 308.68383 0.1240984 12.723365 8.0800159 341.38937 5.1568532 + 300 2.0005565 597.16612 636.76107 -492.53916 3999.3337 -31.433066 8675.7059 309.21599 -0.061382631 14.105486 8.6052841 341.38937 6.1061183 + 400 2.1301774 635.85796 629.2996 -501.35894 3784.077 -23.971605 -81.467506 309.02093 -0.046811856 13.638064 8.2470184 341.38937 6.0950651 + 500 2.1090509 629.55171 661.4048 -527.18699 3555.6926 -56.076799 648.94757 309.45936 -0.10950702 12.805213 7.7261445 341.38937 5.6641225 + 600 2.1073653 629.04855 563.33543 -484.13719 3219.061 41.992567 3171.6576 309.48724 0.082003271 13.759365 8.0375919 341.38937 6.2053973 + 700 1.9719777 588.63535 524.29409 -497.78822 2901.4483 81.033913 2000.5159 309.02619 0.15824338 12.744135 7.4580508 341.38937 5.9107525 + 800 2.0469949 611.02799 634.76301 -516.64387 2864.6773 -29.435005 2329.1521 308.67617 -0.057480808 11.604242 6.8135454 341.38937 5.445481 + 900 1.9587942 584.70008 554.57541 -536.62232 2597.5491 50.752591 601.47078 308.62547 0.099109884 10.497389 6.2142574 341.38937 4.9080572 + 1000 2.0978185 626.19882 628.7595 -559.41879 2533.47 -23.431499 -1267.4683 308.58765 -0.045757135 9.421094 5.5928021 341.38937 4.5477372 +Loop time of 0.20118 on 1 procs for 1000 steps with 200 atoms + +Performance: 192855.450 tau/day, 4970.674 timesteps/s, 994.135 katom-step/s +99.6% CPU use with 1 MPI tasks x 1 OpenMP threads + +MPI task timing breakdown: +Section | min time | avg time | max time |%varavg| %total +--------------------------------------------------------------- +Pair | 0.12009 | 0.12009 | 0.12009 | 0.0 | 59.69 +Neigh | 0.012807 | 0.012807 | 0.012807 | 0.0 | 6.37 +Comm | 0.0040331 | 0.0040331 | 0.0040331 | 0.0 | 2.00 +Output | 0.00012271 | 0.00012271 | 0.00012271 | 0.0 | 0.06 +Modify | 0.062764 | 0.062764 | 0.062764 | 0.0 | 31.20 +Other | | 0.001361 | | | 0.68 + +Nlocal: 200 ave 200 max 200 min +Histogram: 1 0 0 0 0 0 0 0 0 0 +Nghost: 1117 ave 1117 max 1117 min +Histogram: 1 0 0 0 0 0 0 0 0 0 +Neighs: 7460 ave 7460 max 7460 min +Histogram: 1 0 0 0 0 0 0 0 0 0 + +Total # of neighbors = 7460 +Ave neighs/atom = 37.3 +Neighbor list builds = 57 +Dangerous builds = 0 +Total wall time: 0:00:00 diff --git a/examples/PACKAGES/pimd/lj_reduced_units/run.sh b/examples/PACKAGES/pimd/langevin_reduced_units/run.sh similarity index 100% rename from examples/PACKAGES/pimd/lj_reduced_units/run.sh rename to examples/PACKAGES/pimd/langevin_reduced_units/run.sh From 77898e4a86f82d9c231fe743f07662671351ceed Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Wed, 14 Jun 2023 18:28:51 -0400 Subject: [PATCH 271/396] update log files for fix widom --- examples/mc/log.14Jun23.widom.lj.g++.1 | 91 +++++++++++++++ examples/mc/log.14Jun23.widom.lj.g++.4 | 91 +++++++++++++++ examples/mc/log.14Jun23.widom.spce.g++.1 | 139 +++++++++++++++++++++++ examples/mc/log.30Jun20.widom.lj.g++.1 | 89 --------------- examples/mc/log.30Jun20.widom.lj.g++.4 | 89 --------------- examples/mc/log.30Jun20.widom.spce.g++.1 | 133 ---------------------- 6 files changed, 321 insertions(+), 311 deletions(-) create mode 100644 examples/mc/log.14Jun23.widom.lj.g++.1 create mode 100644 examples/mc/log.14Jun23.widom.lj.g++.4 create mode 100644 examples/mc/log.14Jun23.widom.spce.g++.1 delete mode 100644 examples/mc/log.30Jun20.widom.lj.g++.1 delete mode 100644 examples/mc/log.30Jun20.widom.lj.g++.4 delete mode 100644 examples/mc/log.30Jun20.widom.spce.g++.1 diff --git a/examples/mc/log.14Jun23.widom.lj.g++.1 b/examples/mc/log.14Jun23.widom.lj.g++.1 new file mode 100644 index 0000000000..6cbbae89ed --- /dev/null +++ b/examples/mc/log.14Jun23.widom.lj.g++.1 @@ -0,0 +1,91 @@ +LAMMPS (28 Mar 2023 - Development) + using 1 OpenMP thread(s) per MPI task +# Kob and Andersen model Phys. Rev. E 51, 4626 (1995) + +units lj +atom_style atomic + +pair_style lj/cut 2.5 +pair_modify shift yes + +read_data data.widom.lj +Reading data file ... + orthogonal box = (0 0 0) to (9.4 9.4 9.4) + 1 by 1 by 1 MPI processor grid + reading atoms ... + 1000 atoms + reading velocities ... + 1000 velocities + read_data CPU = 0.006 seconds + +pair_coeff 1 1 1.0 1.0 2.5 +pair_coeff 1 2 1.5 0.8 2.0 +pair_coeff 2 2 0.5 0.88 2.2 + +neighbor 0.3 bin +neigh_modify delay 0 every 5 check yes + +fix mywidom all widom 10 100000 2 29494 0.75 + +fix 1 all langevin 0.75 0.75 0.1 48279 zero yes +fix 2 all nve + +timestep 0.002 + +thermo_style custom step temp pe etotal press vol density f_mywidom[1] f_mywidom[2] f_mywidom[3] +thermo 10 + +run 100 +Generated 0 of 1 mixed pair_coeff terms from geometric mixing rule +Neighbor list info ... + update: every = 5 steps, delay = 0 steps, check = yes + max neighbors/atom: 2000, page size: 100000 + master list distance cutoff = 2.8 + ghost atom cutoff = 2.8 + binsize = 1.4, bins = 7 7 7 + 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 + bin: standard +Per MPI rank memory allocation (min/avg/max) = 3.181 | 3.181 | 3.181 Mbytes + Step Temp PotEng TotEng Press Volume Density f_mywidom[1] f_mywidom[2] f_mywidom[3] + 0 0.75021245 -6.4204308 -5.2962374 7.2962696 830.584 1.2039721 0 0 830.584 + 10 0.7358936 -6.4405082 -5.3377717 7.1699962 830.584 1.2039721 -3.8577501 171.3429 830.584 + 20 0.75426414 -6.4267946 -5.2965298 7.2833985 830.584 1.2039721 -4.0708206 227.63895 830.584 + 30 0.72947489 -6.4064078 -5.3132896 7.3872583 830.584 1.2039721 -4.4304803 367.7146 830.584 + 40 0.73504751 -6.4248725 -5.3234038 7.2927069 830.584 1.2039721 -4.1904189 266.99373 830.584 + 50 0.76497439 -6.4352472 -5.2889331 7.3046861 830.584 1.2039721 -3.8628472 172.51133 830.584 + 60 0.75752861 -6.4147051 -5.2795485 7.4416 830.584 1.2039721 -3.5355467 111.5042 830.584 + 70 0.77775078 -6.4210798 -5.2556202 7.4473703 830.584 1.2039721 -3.4754802 102.92223 830.584 + 80 0.80937104 -6.4320008 -5.2191583 7.4121087 830.584 1.2039721 -3.9287513 188.35625 830.584 + 90 0.76321255 -6.4203633 -5.2766893 7.4307727 830.584 1.2039721 -4.2257529 279.87337 830.584 + 100 0.74561743 -6.4010576 -5.2837499 7.52907 830.584 1.2039721 -3.6817835 135.5099 830.584 +Loop time of 10.2362 on 1 procs for 100 steps with 1000 atoms + +Performance: 1688.128 tau/day, 9.769 timesteps/s, 9.769 katom-step/s +99.8% CPU use with 1 MPI tasks x 1 OpenMP threads + +MPI task timing breakdown: +Section | min time | avg time | max time |%varavg| %total +--------------------------------------------------------------- +Pair | 0.058411 | 0.058411 | 0.058411 | 0.0 | 0.57 +Neigh | 0.017611 | 0.017611 | 0.017611 | 0.0 | 0.17 +Comm | 0.001774 | 0.001774 | 0.001774 | 0.0 | 0.02 +Output | 0.00029892 | 0.00029892 | 0.00029892 | 0.0 | 0.00 +Modify | 10.158 | 10.158 | 10.158 | 0.0 | 99.23 +Other | | 0.0003838 | | | 0.00 + +Nlocal: 1000 ave 1000 max 1000 min +Histogram: 1 0 0 0 0 0 0 0 0 0 +Nghost: 3049 ave 3049 max 3049 min +Histogram: 1 0 0 0 0 0 0 0 0 0 +Neighs: 46176 ave 46176 max 46176 min +Histogram: 1 0 0 0 0 0 0 0 0 0 + +Total # of neighbors = 46176 +Ave neighs/atom = 46.176 +Neighbor list builds = 10 +Dangerous builds = 0 +Total wall time: 0:00:10 diff --git a/examples/mc/log.14Jun23.widom.lj.g++.4 b/examples/mc/log.14Jun23.widom.lj.g++.4 new file mode 100644 index 0000000000..7a1171f1b8 --- /dev/null +++ b/examples/mc/log.14Jun23.widom.lj.g++.4 @@ -0,0 +1,91 @@ +LAMMPS (28 Mar 2023 - Development) + using 1 OpenMP thread(s) per MPI task +# Kob and Andersen model Phys. Rev. E 51, 4626 (1995) + +units lj +atom_style atomic + +pair_style lj/cut 2.5 +pair_modify shift yes + +read_data data.widom.lj +Reading data file ... + orthogonal box = (0 0 0) to (9.4 9.4 9.4) + 1 by 2 by 2 MPI processor grid + reading atoms ... + 1000 atoms + reading velocities ... + 1000 velocities + read_data CPU = 0.009 seconds + +pair_coeff 1 1 1.0 1.0 2.5 +pair_coeff 1 2 1.5 0.8 2.0 +pair_coeff 2 2 0.5 0.88 2.2 + +neighbor 0.3 bin +neigh_modify delay 0 every 5 check yes + +fix mywidom all widom 10 100000 2 29494 0.75 + +fix 1 all langevin 0.75 0.75 0.1 48279 zero yes +fix 2 all nve + +timestep 0.002 + +thermo_style custom step temp pe etotal press vol density f_mywidom[1] f_mywidom[2] f_mywidom[3] +thermo 10 + +run 100 +Generated 0 of 1 mixed pair_coeff terms from geometric mixing rule +Neighbor list info ... + update: every = 5 steps, delay = 0 steps, check = yes + max neighbors/atom: 2000, page size: 100000 + master list distance cutoff = 2.8 + ghost atom cutoff = 2.8 + binsize = 1.4, bins = 7 7 7 + 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 + bin: standard +Per MPI rank memory allocation (min/avg/max) = 3.13 | 3.13 | 3.131 Mbytes + Step Temp PotEng TotEng Press Volume Density f_mywidom[1] f_mywidom[2] f_mywidom[3] + 0 0.75021245 -6.4204308 -5.2962374 7.2962696 830.584 1.2039721 0 0 830.584 + 10 0.74279259 -6.4332442 -5.3201696 7.2071344 830.584 1.2039721 -3.4462258 98.984938 830.584 + 20 0.73016272 -6.4222911 -5.3281423 7.2714238 830.584 1.2039721 -4.4887329 397.41346 830.584 + 30 0.74416342 -6.429139 -5.3140101 7.2713375 830.584 1.2039721 -4.3313574 322.19056 830.584 + 40 0.73295457 -6.4370942 -5.3387618 7.227091 830.584 1.2039721 -4.7419281 557.00309 830.584 + 50 0.76914235 -6.4473959 -5.2948361 7.2179148 830.584 1.2039721 -3.1794069 69.352982 830.584 + 60 0.74099083 -6.4433012 -5.3329265 7.204973 830.584 1.2039721 -3.5231065 109.66994 830.584 + 70 0.74514671 -6.4288463 -5.312244 7.2771269 830.584 1.2039721 -1.0154832 3.8727995 830.584 + 80 0.72787097 -6.4457574 -5.3550427 7.1130709 830.584 1.2039721 -3.6691709 133.2501 830.584 + 90 0.78452846 -6.5034376 -5.3278217 6.8238659 830.584 1.2039721 -2.0798339 16.008373 830.584 + 100 0.77188499 -6.487313 -5.3306433 6.9133194 830.584 1.2039721 -2.066579 15.727938 830.584 +Loop time of 1.59209 on 4 procs for 100 steps with 1000 atoms + +Performance: 10853.637 tau/day, 62.810 timesteps/s, 62.810 katom-step/s +96.4% CPU use with 4 MPI tasks x 1 OpenMP threads + +MPI task timing breakdown: +Section | min time | avg time | max time |%varavg| %total +--------------------------------------------------------------- +Pair | 0.014713 | 0.015481 | 0.016154 | 0.4 | 0.97 +Neigh | 0.0045952 | 0.0047537 | 0.0048917 | 0.2 | 0.30 +Comm | 0.026382 | 0.086811 | 0.14145 | 13.9 | 5.45 +Output | 0.00022704 | 0.0002596 | 0.00035704 | 0.0 | 0.02 +Modify | 1.4299 | 1.4845 | 1.5447 | 3.4 | 93.24 +Other | | 0.0003365 | | | 0.02 + +Nlocal: 250 ave 256 max 242 min +Histogram: 1 0 0 0 1 0 0 0 1 1 +Nghost: 1666 ave 1670 max 1659 min +Histogram: 1 0 0 0 0 0 1 0 0 2 +Neighs: 11538 ave 11832 max 11091 min +Histogram: 1 0 0 0 0 0 1 1 0 1 + +Total # of neighbors = 46152 +Ave neighs/atom = 46.152 +Neighbor list builds = 10 +Dangerous builds = 0 +Total wall time: 0:00:01 diff --git a/examples/mc/log.14Jun23.widom.spce.g++.1 b/examples/mc/log.14Jun23.widom.spce.g++.1 new file mode 100644 index 0000000000..712566985d --- /dev/null +++ b/examples/mc/log.14Jun23.widom.spce.g++.1 @@ -0,0 +1,139 @@ +LAMMPS (28 Mar 2023 - Development) + using 1 OpenMP thread(s) per MPI task +units real +dimension 3 +boundary p p p +atom_style full + +pair_style lj/cut/coul/long 10.0 +bond_style harmonic +angle_style harmonic + +read_data data.spce +Reading data file ... + orthogonal box = (-0.031613 -0.023523 -0.085255) to (43.234352 44.939753 42.306533) + 1 by 1 by 1 MPI processor grid + reading atoms ... + 8640 atoms + scanning bonds ... + 2 = max bonds/atom + scanning angles ... + 1 = max angles/atom + reading bonds ... + 5760 bonds + reading angles ... + 2880 angles +Finding 1-2 1-3 1-4 neighbors ... + special bond factors lj: 0 0 0 + special bond factors coul: 0 0 0 + 2 = max # of 1-2 neighbors + 1 = max # of 1-3 neighbors + 1 = max # of 1-4 neighbors + 2 = max # of special neighbors + special bonds CPU = 0.002 seconds + read_data CPU = 0.048 seconds + +molecule h2omol H2O.txt +Read molecule template h2omol: + 1 molecules + 0 fragments + 3 atoms with max type 2 + 2 bonds with max type 1 + 1 angles with max type 1 + 0 dihedrals with max type 0 + 0 impropers with max type 0 + +### Flexible SPC/E Potential Parameters ### +### Zhang et al., Fluid Phase Equilibria, 262 (2007) 210-216 ### +pair_coeff 1 1 0.1502629 3.1169 +pair_coeff 1 2 0.0341116368 2.04845 +pair_coeff 2 2 0.00774378 0.98 + +bond_coeff 1 176.864 0.9611 +angle_coeff 1 42.1845 109.4712 +kspace_style pppm 1.0e-4 + +fix mywidom all widom 10 20 0 29494 298 mol h2omol + +fix 2 all nvt temp 298.0 298.0 100.0 + +neighbor 2.0 bin +neigh_modify delay 10 every 2 check yes + + +#run variables +timestep 0.5 + +thermo 10 +thermo_style custom step etotal pe temp press vol density f_mywidom[1] f_mywidom[2] f_mywidom[3] + +run 100 +PPPM initialization ... + using 12-bit tables for long-range coulomb (src/kspace.cpp:342) + G vector (1/distance) = 0.2690183 + grid = 24 24 24 + stencil order = 5 + estimated absolute RMS force accuracy = 0.024843102 + estimated relative force accuracy = 7.4814263e-05 + using double precision KISS FFT + 3d grid and FFT values/proc = 29791 13824 +Generated 0 of 1 mixed pair_coeff terms from geometric mixing rule +WARNING: Fix widom using full_energy option (src/MC/fix_widom.cpp:320) +0 atoms in group FixWidom:widom_exclusion_group:mywidom +0 atoms in group FixWidom:rotation_gas_atoms:mywidom +WARNING: Neighbor exclusions used with KSpace solver may give inconsistent Coulombic energies (src/neighbor.cpp:654) +Neighbor list info ... + update: every = 2 steps, delay = 10 steps, check = yes + max neighbors/atom: 2000, page size: 100000 + master list distance cutoff = 12 + ghost atom cutoff = 12 + binsize = 6, bins = 8 8 8 + 1 neighbor lists, perpetual/occasional/extra = 1 0 0 + (1) pair lj/cut/coul/long, perpetual + attributes: half, newton on + pair build: half/bin/newton + stencil: half/bin/3d + bin: standard +Per MPI rank memory allocation (min/avg/max) = 29.66 | 29.66 | 29.66 Mbytes + Step TotEng PotEng Temp Press Volume Density f_mywidom[1] f_mywidom[2] f_mywidom[3] + 0 -29703.973 -29703.973 0 -4764.5901 82468.116 1.0447118 0 0 82468.116 + 10 -29718 -32598.944 111.87604 -498.88935 82468.116 1.0447118 200.15526 1.6274344e-147 82468.116 + 20 -29698.227 -32625.357 113.6696 -3120.7115 82468.116 1.0447118 -1.0295764 5.6893637 82468.116 + 30 -29668.463 -33188.922 136.71037 -8129.0179 82468.116 1.0447118 5.5971294 7.856256e-05 82468.116 + 40 -29654.066 -34017.797 169.45726 -5730.6427 82468.116 1.0447118 128.14313 1.0550462e-94 82468.116 + 50 -29627.714 -33214.549 139.28799 -3954.0179 82468.116 1.0447118 122.28545 2.0851209e-90 82468.116 + 60 -29602.616 -32995.039 131.73836 -8099.2136 82468.116 1.0447118 -1.4752191 12.07497 82468.116 + 70 -29591.096 -33872.451 166.25834 -7065.2821 82468.116 1.0447118 17.210054 2.3911575e-13 82468.116 + 80 -29553.631 -32971.209 132.7152 -3535.4257 82468.116 1.0447118 11.148921 6.6631697e-09 82468.116 + 90 -29530.109 -33346.146 148.18857 -5312.6414 82468.116 1.0447118 51.783293 1.055658e-38 82468.116 + 100 -29505.327 -34074.801 177.4469 -5991.0034 82468.116 1.0447118 32.415523 1.6878187e-24 82468.116 +Loop time of 55.4401 on 1 procs for 100 steps with 8640 atoms + +Performance: 0.078 ns/day, 308.000 hours/ns, 1.804 timesteps/s, 15.584 katom-step/s +99.8% CPU use with 1 MPI tasks x 1 OpenMP threads + +MPI task timing breakdown: +Section | min time | avg time | max time |%varavg| %total +--------------------------------------------------------------- +Pair | 5.4117 | 5.4117 | 5.4117 | 0.0 | 9.76 +Bond | 0.029451 | 0.029451 | 0.029451 | 0.0 | 0.05 +Kspace | 0.73758 | 0.73758 | 0.73758 | 0.0 | 1.33 +Neigh | 1.4296 | 1.4296 | 1.4296 | 0.0 | 2.58 +Comm | 0.018593 | 0.018593 | 0.018593 | 0.0 | 0.03 +Output | 0.00069303 | 0.00069303 | 0.00069303 | 0.0 | 0.00 +Modify | 47.81 | 47.81 | 47.81 | 0.0 | 86.24 +Other | | 0.002525 | | | 0.00 + +Nlocal: 8640 ave 8640 max 8640 min +Histogram: 1 0 0 0 0 0 0 0 0 0 +Nghost: 23534 ave 23534 max 23534 min +Histogram: 1 0 0 0 0 0 0 0 0 0 +Neighs: 3.27356e+06 ave 3.27356e+06 max 3.27356e+06 min +Histogram: 1 0 0 0 0 0 0 0 0 0 + +Total # of neighbors = 3273560 +Ave neighs/atom = 378.88426 +Ave special neighs/atom = 2 +Neighbor list builds = 220 +Dangerous builds = 0 +Total wall time: 0:00:55 diff --git a/examples/mc/log.30Jun20.widom.lj.g++.1 b/examples/mc/log.30Jun20.widom.lj.g++.1 deleted file mode 100644 index 71621f9b4e..0000000000 --- a/examples/mc/log.30Jun20.widom.lj.g++.1 +++ /dev/null @@ -1,89 +0,0 @@ -LAMMPS (30 Jun 2020) - using 1 OpenMP thread(s) per MPI task -# Kob and Andersen model Phys. Rev. E 51, 4626 (1995) - -units lj -atom_style atomic - -pair_style lj/cut 2.5 -pair_modify shift yes - -read_data data.widom.lj - orthogonal box = (0.0000000 0.0000000 0.0000000) to (9.4000000 9.4000000 9.4000000) - 1 by 1 by 1 MPI processor grid - reading atoms ... - 1000 atoms - reading velocities ... - 1000 velocities - read_data CPU = 0.003 seconds - -pair_coeff 1 1 1.0 1.0 2.5 -pair_coeff 1 2 1.5 0.8 2.0 -pair_coeff 2 2 0.5 0.88 2.2 - -neighbor 0.3 bin -neigh_modify delay 0 every 5 check yes - -fix mywidom all widom 10 100000 2 29494 0.75 - -fix 1 all langevin 0.75 0.75 0.1 48279 zero yes -fix 2 all nve - -timestep 0.002 - -thermo_style custom step temp pe etotal press vol density f_mywidom[1] f_mywidom[2] f_mywidom[3] -thermo 10 - -run 100 -Neighbor list info ... - update every 5 steps, delay 0 steps, check yes - max neighbors/atom: 2000, page size: 100000 - master list distance cutoff = 2.8 - ghost atom cutoff = 2.8 - binsize = 1.4, bins = 7 7 7 - 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) = 3.181 | 3.181 | 3.181 Mbytes -Step Temp PotEng TotEng Press Volume Density f_mywidom[1] f_mywidom[2] f_mywidom[3] - 0 0.75021245 -6.4204308 -5.2962374 7.2962696 830.584 1.2039721 0 0 830.584 - 10 0.7358936 -6.4405082 -5.3377717 7.1699962 830.584 1.2039721 -3.8577501 171.3429 830.584 - 20 0.75426414 -6.4267946 -5.2965298 7.2833985 830.584 1.2039721 -4.0708206 227.63895 830.584 - 30 0.72947489 -6.4064078 -5.3132896 7.3872583 830.584 1.2039721 -4.4304803 367.7146 830.584 - 40 0.73504751 -6.4248725 -5.3234038 7.2927069 830.584 1.2039721 -4.1904189 266.99373 830.584 - 50 0.76497439 -6.4352472 -5.2889331 7.3046861 830.584 1.2039721 -3.8628472 172.51133 830.584 - 60 0.75752861 -6.4147051 -5.2795485 7.4416 830.584 1.2039721 -3.5355467 111.5042 830.584 - 70 0.77775078 -6.4210798 -5.2556202 7.4473703 830.584 1.2039721 -3.4754802 102.92223 830.584 - 80 0.80937104 -6.4320008 -5.2191583 7.4121087 830.584 1.2039721 -3.9287513 188.35625 830.584 - 90 0.76321255 -6.4203633 -5.2766893 7.4307727 830.584 1.2039721 -4.2257529 279.87337 830.584 - 100 0.74561743 -6.4010576 -5.2837499 7.52907 830.584 1.2039721 -3.6817835 135.5099 830.584 -Loop time of 25.8264 on 1 procs for 100 steps with 1000 atoms - -Performance: 669.082 tau/day, 3.872 timesteps/s -99.8% CPU use with 1 MPI tasks x 1 OpenMP threads - -MPI task timing breakdown: -Section | min time | avg time | max time |%varavg| %total ---------------------------------------------------------------- -Pair | 0.08186 | 0.08186 | 0.08186 | 0.0 | 0.32 -Neigh | 0.023613 | 0.023613 | 0.023613 | 0.0 | 0.09 -Comm | 0.0053532 | 0.0053532 | 0.0053532 | 0.0 | 0.02 -Output | 0.00037837 | 0.00037837 | 0.00037837 | 0.0 | 0.00 -Modify | 25.715 | 25.715 | 25.715 | 0.0 | 99.57 -Other | | 0.0005643 | | | 0.00 - -Nlocal: 1000.00 ave 1000 max 1000 min -Histogram: 1 0 0 0 0 0 0 0 0 0 -Nghost: 3049.00 ave 3049 max 3049 min -Histogram: 1 0 0 0 0 0 0 0 0 0 -Neighs: 46176.0 ave 46176 max 46176 min -Histogram: 1 0 0 0 0 0 0 0 0 0 - -Total # of neighbors = 46176 -Ave neighs/atom = 46.176000 -Neighbor list builds = 10 -Dangerous builds = 0 -Total wall time: 0:00:25 diff --git a/examples/mc/log.30Jun20.widom.lj.g++.4 b/examples/mc/log.30Jun20.widom.lj.g++.4 deleted file mode 100644 index f726faed66..0000000000 --- a/examples/mc/log.30Jun20.widom.lj.g++.4 +++ /dev/null @@ -1,89 +0,0 @@ -LAMMPS (30 Jun 2020) - using 1 OpenMP thread(s) per MPI task -# Kob and Andersen model Phys. Rev. E 51, 4626 (1995) - -units lj -atom_style atomic - -pair_style lj/cut 2.5 -pair_modify shift yes - -read_data data.widom.lj - orthogonal box = (0.0000000 0.0000000 0.0000000) to (9.4000000 9.4000000 9.4000000) - 1 by 2 by 2 MPI processor grid - reading atoms ... - 1000 atoms - reading velocities ... - 1000 velocities - read_data CPU = 0.002 seconds - -pair_coeff 1 1 1.0 1.0 2.5 -pair_coeff 1 2 1.5 0.8 2.0 -pair_coeff 2 2 0.5 0.88 2.2 - -neighbor 0.3 bin -neigh_modify delay 0 every 5 check yes - -fix mywidom all widom 10 100000 2 29494 0.75 - -fix 1 all langevin 0.75 0.75 0.1 48279 zero yes -fix 2 all nve - -timestep 0.002 - -thermo_style custom step temp pe etotal press vol density f_mywidom[1] f_mywidom[2] f_mywidom[3] -thermo 10 - -run 100 -Neighbor list info ... - update every 5 steps, delay 0 steps, check yes - max neighbors/atom: 2000, page size: 100000 - master list distance cutoff = 2.8 - ghost atom cutoff = 2.8 - binsize = 1.4, bins = 7 7 7 - 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) = 3.13 | 3.13 | 3.131 Mbytes -Step Temp PotEng TotEng Press Volume Density f_mywidom[1] f_mywidom[2] f_mywidom[3] - 0 0.75021245 -6.4204308 -5.2962374 7.2962696 830.584 1.2039721 0 0 830.584 - 10 0.74279259 -6.4332442 -5.3201696 7.2071344 830.584 1.2039721 -3.4462258 98.984938 830.584 - 20 0.73016272 -6.4222911 -5.3281423 7.2714238 830.584 1.2039721 -4.4887329 397.41346 830.584 - 30 0.74416342 -6.429139 -5.3140101 7.2713375 830.584 1.2039721 -4.3313574 322.19056 830.584 - 40 0.73295457 -6.4370942 -5.3387618 7.227091 830.584 1.2039721 -4.7419281 557.00309 830.584 - 50 0.76914235 -6.4473959 -5.2948361 7.2179148 830.584 1.2039721 -3.1794069 69.352982 830.584 - 60 0.74099083 -6.4433012 -5.3329265 7.204973 830.584 1.2039721 -3.5231065 109.66994 830.584 - 70 0.74514671 -6.4288463 -5.312244 7.2771269 830.584 1.2039721 -1.0154832 3.8727995 830.584 - 80 0.72787097 -6.4457574 -5.3550427 7.1130709 830.584 1.2039721 -3.6691709 133.2501 830.584 - 90 0.78452846 -6.5034376 -5.3278217 6.8238659 830.584 1.2039721 -2.0798339 16.008373 830.584 - 100 0.77188499 -6.487313 -5.3306433 6.9133194 830.584 1.2039721 -2.066579 15.727938 830.584 -Loop time of 3.37748 on 4 procs for 100 steps with 1000 atoms - -Performance: 5116.239 tau/day, 29.608 timesteps/s -98.7% CPU use with 4 MPI tasks x 1 OpenMP threads - -MPI task timing breakdown: -Section | min time | avg time | max time |%varavg| %total ---------------------------------------------------------------- -Pair | 0.02025 | 0.020952 | 0.021322 | 0.3 | 0.62 -Neigh | 0.0059071 | 0.0060568 | 0.0061543 | 0.1 | 0.18 -Comm | 0.016558 | 0.059554 | 0.094282 | 12.2 | 1.76 -Output | 0.00022173 | 0.00042927 | 0.0010471 | 0.0 | 0.01 -Modify | 3.2552 | 3.2902 | 3.3335 | 1.7 | 97.42 -Other | | 0.0003003 | | | 0.01 - -Nlocal: 250.000 ave 256 max 242 min -Histogram: 1 0 0 0 1 0 0 0 1 1 -Nghost: 1666.00 ave 1670 max 1659 min -Histogram: 1 0 0 0 0 0 1 0 0 2 -Neighs: 11538.0 ave 11832 max 11091 min -Histogram: 1 0 0 0 0 0 1 1 0 1 - -Total # of neighbors = 46152 -Ave neighs/atom = 46.152000 -Neighbor list builds = 10 -Dangerous builds = 0 -Total wall time: 0:00:03 diff --git a/examples/mc/log.30Jun20.widom.spce.g++.1 b/examples/mc/log.30Jun20.widom.spce.g++.1 deleted file mode 100644 index 25aecc685d..0000000000 --- a/examples/mc/log.30Jun20.widom.spce.g++.1 +++ /dev/null @@ -1,133 +0,0 @@ -LAMMPS (30 Jun 2020) - using 1 OpenMP thread(s) per MPI task -units real -dimension 3 -boundary p p p -atom_style full - -pair_style lj/cut/coul/long 10.0 -bond_style harmonic -angle_style harmonic - -read_data data.spce - orthogonal box = (-0.031613 -0.023523 -0.085255) to (43.234352 44.939753 42.306533) - 1 by 1 by 1 MPI processor grid - reading atoms ... - 8640 atoms - scanning bonds ... - 2 = max bonds/atom - scanning angles ... - 1 = max angles/atom - reading bonds ... - 5760 bonds - reading angles ... - 2880 angles - 2 = max # of 1-2 neighbors - 1 = max # of 1-3 neighbors - 1 = max # of 1-4 neighbors - 2 = max # of special neighbors - special bonds CPU = 0.008 seconds - read_data CPU = 0.028 seconds - -molecule h2omol H2O.txt -Read molecule template h2omol: - 1 molecules - 3 atoms with max type 2 - 2 bonds with max type 1 - 1 angles with max type 1 - 0 dihedrals with max type 0 - 0 impropers with max type 0 - -### Flexible SPC/E Potential Parameters ### -### Zhang et al., Fluid Phase Equilibria, 262 (2007) 210-216 ### -pair_coeff 1 1 0.1502629 3.1169 -pair_coeff 1 2 0.0341116368 2.04845 -pair_coeff 2 2 0.00774378 0.98 - -bond_coeff 1 176.864 0.9611 -angle_coeff 1 42.1845 109.4712 -kspace_style pppm 1.0e-4 - -fix mywidom all widom 10 20 0 29494 298 mol h2omol - -fix 2 all nvt temp 298.0 298.0 100.0 - -neighbor 2.0 bin -neigh_modify delay 10 every 2 check yes - - -#run variables -timestep 0.5 - -thermo 10 -thermo_style custom step etotal pe temp press vol density f_mywidom[1] f_mywidom[2] f_mywidom[3] - -run 100 -PPPM initialization ... - using 12-bit tables for long-range coulomb (src/kspace.cpp:330) - G vector (1/distance) = 0.2690183 - grid = 24 24 24 - stencil order = 5 - estimated absolute RMS force accuracy = 0.024843102 - estimated relative force accuracy = 7.4814263e-05 - using double precision FFTW3 - 3d grid and FFT values/proc = 29791 13824 -WARNING: Fix Widom using full_energy option (src/MC/fix_widom.cpp:297) -0 atoms in group FixWidom:widom_exclusion_group:mywidom -0 atoms in group FixWidom:rotation_gas_atoms:mywidom -WARNING: Neighbor exclusions used with KSpace solver may give inconsistent Coulombic energies (src/neighbor.cpp:487) -Neighbor list info ... - update every 2 steps, delay 10 steps, check yes - max neighbors/atom: 2000, page size: 100000 - master list distance cutoff = 12 - ghost atom cutoff = 12 - binsize = 6, bins = 8 8 8 - 1 neighbor lists, perpetual/occasional/extra = 1 0 0 - (1) pair lj/cut/coul/long, perpetual - attributes: half, newton on - pair build: half/bin/newton - stencil: half/bin/3d/newton - bin: standard -Per MPI rank memory allocation (min/avg/max) = 29.66 | 29.66 | 29.66 Mbytes -Step TotEng PotEng Temp Press Volume Density f_mywidom[1] f_mywidom[2] f_mywidom[3] - 0 -29703.973 -29703.973 0 -4764.5901 82468.116 1.9140713 0 0 82468.116 - 10 -29712.131 -31110.041 54.285179 -3154.4423 82468.116 1.9140713 241.93348 3.7366217e-178 82468.116 - 20 -29711.939 -32614.429 112.71273 -4216.1592 82468.116 1.9140713 16.095006 1.5716469e-12 82468.116 - 30 -29688.142 -32368.506 104.08688 -4093.6515 82468.116 1.9140713 5.7862327 5.7086352e-05 82468.116 - 40 -29662.343 -32252.144 100.57005 -1458.5339 82468.116 1.9140713 126.68071 1.2467216e-93 82468.116 - 50 -29646.78 -32837.635 123.91081 -4607.1155 82468.116 1.9140713 74.622397 1.8790479e-55 82468.116 - 60 -29628.968 -33001.229 130.9554 -4589.5296 82468.116 1.9140713 3.6575433 0.0020780497 82468.116 - 70 -29602.78 -32816.28 124.79023 -3082.1133 82468.116 1.9140713 13.983097 5.561247e-11 82468.116 - 80 -29577.552 -33141.454 138.39742 -6332.8138 82468.116 1.9140713 41.98931 1.6075608e-31 82468.116 - 90 -29550.865 -33792.115 164.70094 -4607.6419 82468.116 1.9140713 68.690681 4.2082269e-51 82468.116 - 100 -29515.107 -34052.782 176.21207 -3609.5709 82468.116 1.9140713 41.090597 7.3326206e-31 82468.116 -Loop time of 163.407 on 1 procs for 100 steps with 8640 atoms - -Performance: 0.026 ns/day, 907.819 hours/ns, 0.612 timesteps/s -99.8% CPU use with 1 MPI tasks x 1 OpenMP threads - -MPI task timing breakdown: -Section | min time | avg time | max time |%varavg| %total ---------------------------------------------------------------- -Pair | 8.5495 | 8.5495 | 8.5495 | 0.0 | 5.23 -Bond | 0.031981 | 0.031981 | 0.031981 | 0.0 | 0.02 -Kspace | 2.3995 | 2.3995 | 2.3995 | 0.0 | 1.47 -Neigh | 5.0542 | 5.0542 | 5.0542 | 0.0 | 3.09 -Comm | 0.051965 | 0.051965 | 0.051965 | 0.0 | 0.03 -Output | 0.0018802 | 0.0018802 | 0.0018802 | 0.0 | 0.00 -Modify | 147.31 | 147.31 | 147.31 | 0.0 | 90.15 -Other | | 0.003614 | | | 0.00 - -Nlocal: 8640.00 ave 8640 max 8640 min -Histogram: 1 0 0 0 0 0 0 0 0 0 -Nghost: 23499.0 ave 23499 max 23499 min -Histogram: 1 0 0 0 0 0 0 0 0 0 -Neighs: 3.27380e+06 ave 3.2738e+06 max 3.2738e+06 min -Histogram: 1 0 0 0 0 0 0 0 0 0 - -Total # of neighbors = 3273800 -Ave neighs/atom = 378.91204 -Ave special neighs/atom = 2.0000000 -Neighbor list builds = 220 -Dangerous builds = 0 -Total wall time: 0:02:44 From 4d02c6f26f391f9703b49ba7a79af890c5a147b3 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Wed, 14 Jun 2023 21:50:27 -0400 Subject: [PATCH 272/396] update version strings for upcoming release --- doc/lammps.1 | 4 ++-- doc/src/Commands_removed.rst | 2 +- doc/src/Fortran.rst | 2 +- doc/src/compute_count_type.rst | 2 +- doc/src/compute_stress_cartesian.rst | 4 ++-- doc/src/compute_stress_mop.rst | 2 +- doc/src/fix_dpd_source.rst | 2 +- doc/src/fix_efield.rst | 2 +- doc/src/fix_print.rst | 2 +- doc/src/fix_reaxff_species.rst | 2 +- doc/src/package.rst | 2 +- doc/src/pair_aip_water_2dm.rst | 2 +- doc/src/pair_lepton.rst | 6 ++++-- doc/src/pair_lj_cut_sphere.rst | 2 +- doc/src/pair_lj_expand_sphere.rst | 2 +- doc/src/print.rst | 2 +- doc/src/variable.rst | 4 ++-- src/library.cpp | 2 +- src/version.h | 3 +-- 19 files changed, 25 insertions(+), 24 deletions(-) diff --git a/doc/lammps.1 b/doc/lammps.1 index b1be867e60..9bc107624f 100644 --- a/doc/lammps.1 +++ b/doc/lammps.1 @@ -1,7 +1,7 @@ -.TH LAMMPS "1" "28 March 2023" "2023-03-28" +.TH LAMMPS "1" "15 June 2023" "2023-06-15" .SH NAME .B LAMMPS -\- Molecular Dynamics Simulator. Version 28 March 2023 +\- Molecular Dynamics Simulator. Version 15 June 2023 .SH SYNOPSIS .B lmp diff --git a/doc/src/Commands_removed.rst b/doc/src/Commands_removed.rst index d50eab3a41..1848a28024 100644 --- a/doc/src/Commands_removed.rst +++ b/doc/src/Commands_removed.rst @@ -41,7 +41,7 @@ warning. LATTE package ------------- -.. deprecated:: TBD +.. deprecated:: 15Jun2023 The LATTE package with the fix latte command was removed from LAMMPS. This functionality has been superseded by :doc:`fix mdi/qm ` diff --git a/doc/src/Fortran.rst b/doc/src/Fortran.rst index a0e4da56b5..7e9f16fa70 100644 --- a/doc/src/Fortran.rst +++ b/doc/src/Fortran.rst @@ -620,7 +620,7 @@ Procedures Bound to the :f:type:`lammps` Derived Type output, depending on the data requested through *what*. Note that *index* uses 1-based indexing to access thermo output columns. - .. versionadded:: TBD + .. versionadded:: 15Jun2023 Note that this function actually does not return a value, but rather associates the pointer on the left side of the assignment to point to diff --git a/doc/src/compute_count_type.rst b/doc/src/compute_count_type.rst index 81fffb4f28..ca3b02ecdb 100644 --- a/doc/src/compute_count_type.rst +++ b/doc/src/compute_count_type.rst @@ -25,7 +25,7 @@ Examples Description """"""""""" -.. versionadded:: TBD +.. versionadded:: 15Jun2023 Define a computation that counts the current number of atoms for each atom type. Or the number of bonds (angles, dihedrals, impropers) for diff --git a/doc/src/compute_stress_cartesian.rst b/doc/src/compute_stress_cartesian.rst index 3e1e9d9a8a..46785149f8 100644 --- a/doc/src/compute_stress_cartesian.rst +++ b/doc/src/compute_stress_cartesian.rst @@ -41,7 +41,7 @@ split into a kinetic contribution :math:`P^k` and a virial contribution This compute obeys momentum balance through fluid interfaces. They use the Irving--Kirkwood contour, which is the straight line between particle pairs. -.. versionadded:: TBD +.. versionadded:: 15Jun2023 Added support for bond styles @@ -119,4 +119,4 @@ Related commands .. _Ikeshoji2: -**(Ikeshoji)** Ikeshoji, Hafskjold, Furuholt, Mol Sim, 29, 101-109, (2003). \ No newline at end of file +**(Ikeshoji)** Ikeshoji, Hafskjold, Furuholt, Mol Sim, 29, 101-109, (2003). diff --git a/doc/src/compute_stress_mop.rst b/doc/src/compute_stress_mop.rst index ec654dc61c..21c2963545 100644 --- a/doc/src/compute_stress_mop.rst +++ b/doc/src/compute_stress_mop.rst @@ -66,7 +66,7 @@ that atoms have crossed the plane if their positions at times and uses the velocity at time :math:`t-\Delta t/2` given by the velocity Verlet algorithm. -.. versionadded:: TBD +.. versionadded:: 15Jun2023 contributions from bond and angle potentials diff --git a/doc/src/fix_dpd_source.rst b/doc/src/fix_dpd_source.rst index ade9659d00..71894161f1 100644 --- a/doc/src/fix_dpd_source.rst +++ b/doc/src/fix_dpd_source.rst @@ -61,7 +61,7 @@ heat conduction with a source term (see Fig.12 in :ref:`(Li2014) `) or diffusion with a source term (see Fig.1 in :ref:`(Li2015) `), as an analog of a periodic Poiseuille flow problem. -.. deprecated:: TBD +.. deprecated:: 15Jun2023 The *sphere* and *cuboid* keywords will be removed in a future version of LAMMPS. The same functionality and more can be achieved with a region. diff --git a/doc/src/fix_efield.rst b/doc/src/fix_efield.rst index 4cf92cf946..e38e1e6894 100644 --- a/doc/src/fix_efield.rst +++ b/doc/src/fix_efield.rst @@ -136,7 +136,7 @@ due to the electric field were a spring-like F = kx, then the energy formula should be E = -0.5kx\^2. If you don't do this correctly, the minimization will not converge properly. -.. versionadded:: TBD +.. versionadded:: 15Jun2023 The *potential* keyword can be used as an alternative to the *energy* keyword to specify the name of an atom-style variable, which is used to compute the diff --git a/doc/src/fix_print.rst b/doc/src/fix_print.rst index 938b40d1f9..05abbe3c98 100644 --- a/doc/src/fix_print.rst +++ b/doc/src/fix_print.rst @@ -44,7 +44,7 @@ one word. If it contains variables it must be enclosed in double quotes to ensure they are not evaluated when the input script line is read, but will instead be evaluated each time the string is printed. -.. versionadded:: TBD +.. versionadded:: 15Jun2023 support for vector style variables diff --git a/doc/src/fix_reaxff_species.rst b/doc/src/fix_reaxff_species.rst index c22c9d7b9f..6a171ede5e 100644 --- a/doc/src/fix_reaxff_species.rst +++ b/doc/src/fix_reaxff_species.rst @@ -88,7 +88,7 @@ If the filename ends with ".gz", the output file is written in gzipped format. A gzipped dump file will be about 3x smaller than the text version, but will also take longer to write. -.. versionadded:: TBD +.. versionadded:: 15Jun2023 Support for wildcards added diff --git a/doc/src/package.rst b/doc/src/package.rst index b0549ba7d9..0f28598029 100644 --- a/doc/src/package.rst +++ b/doc/src/package.rst @@ -433,7 +433,7 @@ with 16 threads, for a total of 128. Note that the default settings for *tpc* and *tptask* are fine for most problems, regardless of how many MPI tasks you assign to a Phi. -.. versionadded:: TBD +.. versionadded:: 15Jun2023 The *pppm_table* keyword with the argument yes allows to use a pre-computed table to efficiently spread the charge to the PPPM grid. diff --git a/doc/src/pair_aip_water_2dm.rst b/doc/src/pair_aip_water_2dm.rst index 532ee8f8f6..5cee40edda 100644 --- a/doc/src/pair_aip_water_2dm.rst +++ b/doc/src/pair_aip_water_2dm.rst @@ -33,7 +33,7 @@ Examples Description """"""""""" -.. versionadded:: TBD +.. versionadded:: 15Jun2023 The *aip/water/2dm* style computes the anisotropic interfacial potential (AIP) potential for interfaces of water with two-dimensional (2D) diff --git a/doc/src/pair_lepton.rst b/doc/src/pair_lepton.rst index 608265ecbd..21e619a3d9 100644 --- a/doc/src/pair_lepton.rst +++ b/doc/src/pair_lepton.rst @@ -61,9 +61,11 @@ Description .. versionadded:: 8Feb2023 -.. versionchanged:: TBD + added pair styles *lepton* and *lepton/coul* - added pair style lepton/sphere +.. versionchanged:: 15Jun2023 + + added pair style *lepton/sphere* Pair styles *lepton*, *lepton/coul*, *lepton/sphere* compute pairwise interactions between particles which depend on the distance and have a diff --git a/doc/src/pair_lj_cut_sphere.rst b/doc/src/pair_lj_cut_sphere.rst index 428047d5df..31f84bc40e 100644 --- a/doc/src/pair_lj_cut_sphere.rst +++ b/doc/src/pair_lj_cut_sphere.rst @@ -33,7 +33,7 @@ Examples Description """"""""""" -.. versionadded:: TBD +.. versionadded:: 15Jun2023 The *lj/cut/sphere* style compute the standard 12/6 Lennard-Jones potential, given by diff --git a/doc/src/pair_lj_expand_sphere.rst b/doc/src/pair_lj_expand_sphere.rst index c60cf160f0..2c01624251 100644 --- a/doc/src/pair_lj_expand_sphere.rst +++ b/doc/src/pair_lj_expand_sphere.rst @@ -33,7 +33,7 @@ Examples Description """"""""""" -.. versionadded:: TBD +.. versionadded:: 15Jun2023 The *lj/expand/sphere* style compute a 12/6 Lennard-Jones potential with a distance shifted by :math:`\Delta = \frac{1}{2} (d_i + d_j)`, the diff --git a/doc/src/print.rst b/doc/src/print.rst index f5a872e768..a221ed04b6 100644 --- a/doc/src/print.rst +++ b/doc/src/print.rst @@ -46,7 +46,7 @@ lines of output, the string can be enclosed in triple quotes, as in the last example above. If the text string contains variables, they will be evaluated and their current values printed. -.. versionadded:: TBD +.. versionadded:: 15Jun2023 support for vector style variables diff --git a/doc/src/variable.rst b/doc/src/variable.rst index 1b1acba92d..67600af62d 100644 --- a/doc/src/variable.rst +++ b/doc/src/variable.rst @@ -1001,7 +1001,7 @@ map kind (atom, bond, angle, dihedral, or improper) and the second argument is the label. The function returns the corresponding numeric type or triggers an error if the queried label does not exist. -.. versionadded:: TBD +.. versionadded:: 15Jun2023 The is_typelabel(kind,label) function has the same arguments as label2type(), but returns 1 if the type label has been assigned, @@ -1320,7 +1320,7 @@ Vectors" discussion above. Vector Initialization --------------------- -.. versionadded:: TBD +.. versionadded:: 15Jun2023 *Vector*-style variables only can be initialized with a special syntax, instead of using a formula. The syntax is a bracketed, diff --git a/src/library.cpp b/src/library.cpp index 1996ebbcb4..872b59693f 100644 --- a/src/library.cpp +++ b/src/library.cpp @@ -756,7 +756,7 @@ double lammps_get_thermo(void *handle, const char *keyword) * \verbatim embed:rst -.. versionadded:: TBD +.. versionadded:: 15Jun2023 This function provides access to cached data from the last thermo output. This differs from :cpp:func:`lammps_get_thermo` in that it does not trigger diff --git a/src/version.h b/src/version.h index 2d0eb0480e..63547c4a01 100644 --- a/src/version.h +++ b/src/version.h @@ -1,2 +1 @@ -#define LAMMPS_VERSION "28 Mar 2023" -#define LAMMPS_UPDATE "Development" +#define LAMMPS_VERSION "15 Jun 2023" From b8dda7ebfe9c3b04b9ca46e375714a139a9ac24b Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Wed, 14 Jun 2023 22:08:30 -0400 Subject: [PATCH 273/396] documentation formatting and spelling fixes --- doc/src/compute_stress_cartesian.rst | 3 ++- doc/src/compute_stress_curvilinear.rst | 5 +++-- doc/utils/sphinx-config/false_positives.txt | 1 + 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/doc/src/compute_stress_cartesian.rst b/doc/src/compute_stress_cartesian.rst index 3e1e9d9a8a..d2c2aa9ba9 100644 --- a/doc/src/compute_stress_cartesian.rst +++ b/doc/src/compute_stress_cartesian.rst @@ -26,6 +26,7 @@ Examples """""""" .. code-block:: LAMMPS + compute 1 all stress/cartesian x 0.1 NULL 0 compute 1 all stress/cartesian y 0.1 z 0.1 compute 1 all stress/cartesian x 0.1 NULL 0 ke pair @@ -119,4 +120,4 @@ Related commands .. _Ikeshoji2: -**(Ikeshoji)** Ikeshoji, Hafskjold, Furuholt, Mol Sim, 29, 101-109, (2003). \ No newline at end of file +**(Ikeshoji)** Ikeshoji, Hafskjold, Furuholt, Mol Sim, 29, 101-109, (2003). diff --git a/doc/src/compute_stress_curvilinear.rst b/doc/src/compute_stress_curvilinear.rst index edd1df9217..022a87058f 100644 --- a/doc/src/compute_stress_curvilinear.rst +++ b/doc/src/compute_stress_curvilinear.rst @@ -36,6 +36,7 @@ Examples """""""" .. code-block:: LAMMPS + compute 1 all stress/cylinder -10.0 10.0 15.0 0.25 compute 1 all stress/cylinder -10.0 10.0 15.0 0.25 ke no compute 1 all stress/spherical 0 0 0 0.1 10 @@ -59,7 +60,7 @@ The compute *stress/cylinder* computes the stress profile along the radial direction in cylindrical coordinates, as described in :ref:`(Addington)`. The compute *stress/spherical* computes the stress profile along the radial direction in spherical -coordinates, as described in :ref:`(Ikeshoji)`. +coordinates, as described in :ref:`(Ikeshoji)`. Output info @@ -125,7 +126,7 @@ The keyword default for ke in style *stress/cylinder* is yes. ---------- -.. _Ikeshoji2: +.. _Ikeshoji4: **(Ikeshoji)** Ikeshoji, Hafskjold, Furuholt, Mol Sim, 29, 101-109, (2003). diff --git a/doc/utils/sphinx-config/false_positives.txt b/doc/utils/sphinx-config/false_positives.txt index 867a0e0631..5791288a06 100644 --- a/doc/utils/sphinx-config/false_positives.txt +++ b/doc/utils/sphinx-config/false_positives.txt @@ -552,6 +552,7 @@ conformational Connor conp conq +const ConstMatrix Contrib cooperativity From 4eb602e0d47530b05baff96df6b625e282a8eae3 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Wed, 14 Jun 2023 22:18:08 -0400 Subject: [PATCH 274/396] improve error messages and apply clang-format --- src/EXTRA-COMPUTE/compute_stress_cartesian.cpp | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/src/EXTRA-COMPUTE/compute_stress_cartesian.cpp b/src/EXTRA-COMPUTE/compute_stress_cartesian.cpp index 3835b8bea9..0380acbb82 100644 --- a/src/EXTRA-COMPUTE/compute_stress_cartesian.cpp +++ b/src/EXTRA-COMPUTE/compute_stress_cartesian.cpp @@ -62,7 +62,7 @@ ComputeStressCartesian::ComputeStressCartesian(LAMMPS *lmp, int narg, char **arg { if (lmp->citeme) lmp->citeme->add(cite_compute_stress_cartesian); - if (narg < 7) error->all(FLERR, "Illegal compute stress/cartesian command: illegal number of arguments."); + if (narg < 7) utils::missing_cmd_args(FLERR, "compute stress/cartesian", error); // no triclinic boxes if (domain->triclinic) error->all(FLERR, "Compute stress/cartesian requires an orthogonal box"); @@ -158,10 +158,14 @@ ComputeStressCartesian::ComputeStressCartesian(LAMMPS *lmp, int narg, char **arg compute_bond = false; int iarg = 7; while (iarg < narg) { - if (strcmp(arg[iarg], "ke") == 0) compute_ke = true; - else if (strcmp(arg[iarg], "pair") == 0) compute_pair = true; - else if (strcmp(arg[iarg], "bond") == 0) compute_bond = true; - else error->all(FLERR, "Illegal compute stress/atom command"); + if (strcmp(arg[iarg], "ke") == 0) + compute_ke = true; + else if (strcmp(arg[iarg], "pair") == 0) + compute_pair = true; + else if (strcmp(arg[iarg], "bond") == 0) + compute_bond = true; + else + error->all(FLERR, "Unknown compute stress/cartesian keyword: {}", arg[iarg]); iarg++; } } @@ -371,7 +375,7 @@ void ComputeStressCartesian::compute_array() // i == atom1, j == atom2 int i = neighbor->bondlist[i_bond][0]; int j = neighbor->bondlist[i_bond][1]; - int btype = neighbor->bondlist[i_bond][2]; + int btype = neighbor->bondlist[i_bond][2]; // Skip if one of both atoms is not in group if (!(mask[i] & groupbit)) continue; @@ -389,7 +393,7 @@ void ComputeStressCartesian::compute_array() double dx = x[j][0] - x[i][0]; double dy = x[j][1] - x[i][1]; double dz = x[j][2] - x[i][2]; - double rsq = dx*dx + dy*dy + dz*dz; + double rsq = dx * dx + dy * dy + dz * dz; double xi = x[i][dir1] - boxlo[dir1]; double yi = x[i][dir2] - boxlo[dir2]; From e01bde5be518853f14ee2b72481b51168a090d8a Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Thu, 15 Jun 2023 01:50:07 -0400 Subject: [PATCH 275/396] avoid null pointer dereference --- src/INTEL/fix_intel.cpp | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/INTEL/fix_intel.cpp b/src/INTEL/fix_intel.cpp index 59224cc511..4c46608677 100644 --- a/src/INTEL/fix_intel.cpp +++ b/src/INTEL/fix_intel.cpp @@ -306,16 +306,17 @@ void FixIntel::init() if (force->pair_match("gayberne/intel$", 0)) _torque_flag = 1; const int nstyles = _pair_intel_count; - if (force->pair_match("^hybrid", 0) != nullptr) { + if (force->pair_match("^hybrid", 0)) { _pair_hybrid_flag = 1; // Check if need to handle torque auto hybrid = dynamic_cast(force->pair); - for (int i = 0; i < hybrid->nstyles; i++) - if (utils::strmatch(hybrid->keywords[i],"/intel$") && - utils::strmatch(hybrid->keywords[i],"gayberne")) - _torque_flag = 1; - + if (hybrid) { + for (int i = 0; i < hybrid->nstyles; i++) + if (utils::strmatch(hybrid->keywords[i],"/intel$") && + utils::strmatch(hybrid->keywords[i],"gayberne")) + _torque_flag = 1; + } if (force->newton_pair != 0 && force->pair->no_virial_fdotr_compute) error->all(FLERR,"INTEL package requires fdotr virial with newton on."); } else From 55d767e41609cbbd0016e9cff0f6279ed59621c8 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Thu, 15 Jun 2023 01:51:12 -0400 Subject: [PATCH 276/396] make sure intermediate results are 64-bit compatible, so the won't overflow --- src/INTEL/npair_full_bin_ghost_intel.cpp | 2 +- src/INTEL/npair_intel.cpp | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/INTEL/npair_full_bin_ghost_intel.cpp b/src/INTEL/npair_full_bin_ghost_intel.cpp index 381db62c08..920c0c559a 100644 --- a/src/INTEL/npair_full_bin_ghost_intel.cpp +++ b/src/INTEL/npair_full_bin_ghost_intel.cpp @@ -559,7 +559,7 @@ void NPairFullBinGhostIntel::fbi(const int offload, NeighList * list, if (ct + obound > list_size) { if (i < ito - 1) { *overflow = 1; - ct = (ifrom + tid * 2) * maxnbors; + ct = (bigint)(ifrom + tid * 2) * (bigint)maxnbors; } } } diff --git a/src/INTEL/npair_intel.cpp b/src/INTEL/npair_intel.cpp index 8b05aa38aa..600109d7ae 100644 --- a/src/INTEL/npair_intel.cpp +++ b/src/INTEL/npair_intel.cpp @@ -723,7 +723,7 @@ void NPairIntel::bin_newton(const int offload, NeighList *list, if (ct + obound > list_size) { if (i < ito - 1) { *overflow = 1; - ct = (ifrom + tid * 2) * maxnbors; + ct = (bigint)(ifrom + tid * 2) * (bigint)maxnbors; } } } @@ -737,7 +737,7 @@ void NPairIntel::bin_newton(const int offload, NeighList *list, if (ct + obound > list_size) { if (i < ito - 1) { *overflow = 1; - ct = (ifrom + tid * 2) * maxnbors; + ct = (bigint)(ifrom + tid * 2) * (bigint)maxnbors; } } } From 0df1542be10815a6d735779fecd7ffce4f5835e5 Mon Sep 17 00:00:00 2001 From: Stan Gerald Moore Date: Thu, 15 Jun 2023 10:22:35 -0600 Subject: [PATCH 277/396] Pair SNAP tuning for Kokkos SYCL --- src/KOKKOS/kokkos_type.h | 8 ++++++-- src/KOKKOS/pair_snap_kokkos.h | 11 +++++++++++ 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/src/KOKKOS/kokkos_type.h b/src/KOKKOS/kokkos_type.h index 3c9886905e..fac75221bc 100644 --- a/src/KOKKOS/kokkos_type.h +++ b/src/KOKKOS/kokkos_type.h @@ -1310,9 +1310,13 @@ struct alignas(4 * sizeof(int)) reax_int4 { #define SNAP_KOKKOS_HOST_VECLEN 1 #ifdef LMP_KOKKOS_GPU -#define SNAP_KOKKOS_DEVICE_VECLEN 32 + #if defined(KOKKOS_ENABLE_SYCL) + #define SNAP_KOKKOS_DEVICE_VECLEN 16 + #else + #define SNAP_KOKKOS_DEVICE_VECLEN 32 + #endif #else -#define SNAP_KOKKOS_DEVICE_VECLEN 1 + #define SNAP_KOKKOS_DEVICE_VECLEN 1 #endif diff --git a/src/KOKKOS/pair_snap_kokkos.h b/src/KOKKOS/pair_snap_kokkos.h index fba95a679e..0df02e0bc7 100644 --- a/src/KOKKOS/pair_snap_kokkos.h +++ b/src/KOKKOS/pair_snap_kokkos.h @@ -97,6 +97,17 @@ class PairSNAPKokkos : public PairSNAP { static constexpr int tile_size_transform_bi = 2; static constexpr int tile_size_compute_yi = 2; static constexpr int team_size_compute_fused_deidrj = 2; +#elif defined(KOKKOS_ENABLE_SYCL) + 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 = 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 = 8; + static constexpr int team_size_compute_fused_deidrj = 4; #else static constexpr int team_size_compute_neigh = 4; static constexpr int tile_size_compute_ck = 4; From 74c4eb10636e3fe6656c3bebd070b443a0445e3e Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Fri, 16 Jun 2023 12:12:12 -0400 Subject: [PATCH 278/396] indicate that LAMMPS was built from a development version --- src/version.h | 1 + 1 file changed, 1 insertion(+) diff --git a/src/version.h b/src/version.h index 63547c4a01..2a1c8a9a37 100644 --- a/src/version.h +++ b/src/version.h @@ -1 +1,2 @@ #define LAMMPS_VERSION "15 Jun 2023" +#define LAMMPS_UPDATE "Development" From 59c5ed63e375ff1b66ee9d27468d9874b579a597 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Fri, 16 Jun 2023 12:12:23 -0400 Subject: [PATCH 279/396] programming style --- src/dump_image.cpp | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/dump_image.cpp b/src/dump_image.cpp index ff1c540d3f..0d54c60595 100644 --- a/src/dump_image.cpp +++ b/src/dump_image.cpp @@ -201,7 +201,7 @@ DumpImage::DumpImage(LAMMPS *lmp, int narg, char **arg) : if (iflag == ArgInfo::COMPUTE) id_grid_compute = utils::strdup(id); else if (iflag == ArgInfo::FIX) id_grid_fix = utils::strdup(id); - delete [] id; + delete[] id; grid_igrid = igrid; grid_idata = idata; grid_index = index; @@ -461,18 +461,18 @@ DumpImage::~DumpImage() { delete image; - delete [] diamtype; - delete [] diamelement; - delete [] colortype; - delete [] colorelement; - delete [] bdiamtype; - delete [] bcolortype; + delete[] diamtype; + delete[] diamelement; + delete[] colortype; + delete[] colorelement; + delete[] bdiamtype; + delete[] bcolortype; memory->destroy(chooseghost); memory->destroy(bufcopy); memory->destroy(gbuf); - delete [] id_grid_compute; - delete [] id_grid_fix; + delete[] id_grid_compute; + delete[] id_grid_fix; } /* ---------------------------------------------------------------------- */ From a20ed8e5e4bc40ebc65e0ba0954a4c091e8d76f2 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Fri, 16 Jun 2023 12:13:22 -0400 Subject: [PATCH 280/396] improve error messages for dump style custom --- src/dump_custom.cpp | 75 +++++++++++++++++++++++---------------------- 1 file changed, 38 insertions(+), 37 deletions(-) diff --git a/src/dump_custom.cpp b/src/dump_custom.cpp index 517956caf1..33cfba2cef 100644 --- a/src/dump_custom.cpp +++ b/src/dump_custom.cpp @@ -61,12 +61,12 @@ DumpCustom::DumpCustom(LAMMPS *lmp, int narg, char **arg) : fix(nullptr), id_variable(nullptr), variable(nullptr), vbuf(nullptr), id_custom(nullptr), custom(nullptr), custom_flag(nullptr), typenames(nullptr), pack_choice(nullptr) { - if (narg == 5) error->all(FLERR,"No dump custom arguments specified"); + if (narg == 5) error->all(FLERR,"No dump {} arguments specified", style); clearstep = 1; nevery = utils::inumeric(FLERR,arg[3],false,lmp); - if (nevery <= 0) error->all(FLERR,"Illegal dump custom command"); + if (nevery <= 0) error->all(FLERR,"Illegal dump {} command: output frequency must be > 0", style); // expand args if any have wildcard character "*" // ok to include trailing optional args, @@ -141,7 +141,7 @@ DumpCustom::DumpCustom(LAMMPS *lmp, int narg, char **arg) : else if (vtype[i] == Dump::BIGINT) cols += BIGINT_FORMAT " "; vformat[i] = nullptr; } - cols.resize(cols.size()-1); + if (nfield > 0) cols.resize(cols.size()-1); format_default = utils::strdup(cols); format_column_user = new char*[nfield]; @@ -309,20 +309,20 @@ void DumpCustom::init_style() for (i = 0; i < ncompute; i++) { compute[i] = modify->get_compute_by_id(id_compute[i]); - if (!compute[i]) error->all(FLERR,"Could not find dump custom compute ID {}",id_compute[i]); + if (!compute[i]) error->all(FLERR,"Could not find dump {} compute ID {}",style,id_compute[i]); } for (i = 0; i < nfix; i++) { fix[i] = modify->get_fix_by_id(id_fix[i]); - if (!fix[i]) error->all(FLERR,"Could not find dump custom fix ID {}", id_fix[i]); + if (!fix[i]) error->all(FLERR,"Could not find dump {} fix ID {}", style, id_fix[i]); if (nevery % fix[i]->peratom_freq) - error->all(FLERR,"Dump custom and fix not computed at compatible times"); + error->all(FLERR,"Dump {} and fix not computed at compatible times", style); } for (i = 0; i < nvariable; i++) { int ivariable = input->variable->find(id_variable[i]); if (ivariable < 0) - error->all(FLERR,"Could not find dump custom variable name {}", id_variable[i]); + error->all(FLERR,"Could not find dump {} variable name {}", style, id_variable[i]); variable[i] = ivariable; } @@ -330,7 +330,7 @@ void DumpCustom::init_style() for (int i = 0; i < ncustom; i++) { icustom = atom->find_custom(id_custom[i],flag,cols); if (icustom < 0) - error->all(FLERR,"Could not find dump custom atom property name"); + error->all(FLERR,"Could not find dump {} atom property name", style); custom[i] = icustom; if (!flag && !cols) custom_flag[i] = IVEC; else if (flag && !cols) custom_flag[i] = DVEC; @@ -341,7 +341,7 @@ void DumpCustom::init_style() // check validity of region if (idregion && !domain->get_region_by_id(idregion)) - error->all(FLERR,"Region {} for dump custom does not exist", idregion); + error->all(FLERR,"Region {} for dump {} does not exist", idregion, style); // open single file, one time only @@ -1461,7 +1461,8 @@ int DumpCustom::parse_fields(int narg, char **arg) switch (argi.get_type()) { case ArgInfo::UNKNOWN: - error->all(FLERR,"Invalid attribute in dump custom command"); + case ArgInfo::NONE: + error->all(FLERR,"Invalid attribute {} in dump {} command",arg[iarg],style); break; // compute value = c_ID @@ -1472,15 +1473,15 @@ int DumpCustom::parse_fields(int narg, char **arg) vtype[iarg] = Dump::DOUBLE; icompute = modify->get_compute_by_id(name); - if (!icompute) error->all(FLERR,"Could not find dump custom compute ID: {}",name); + if (!icompute) error->all(FLERR,"Could not find dump {} compute ID: {}", style, name); if (icompute->peratom_flag == 0) - error->all(FLERR,"Dump custom compute {} does not compute per-atom info",name); + error->all(FLERR,"Dump {} compute {} does not compute per-atom info", style, name); if (argi.get_dim() == 0 && icompute->size_peratom_cols > 0) - error->all(FLERR,"Dump custom compute {} does not calculate per-atom vector",name); + error->all(FLERR,"Dump {} compute {} does not calculate per-atom vector", style, name); if (argi.get_dim() > 0 && icompute->size_peratom_cols == 0) - error->all(FLERR,"Dump custom compute {} does not calculate per-atom array",name); + error->all(FLERR,"Dump {} compute {} does not calculate per-atom array", style, name); if (argi.get_dim() > 0 && argi.get_index1() > icompute->size_peratom_cols) - error->all(FLERR,"Dump custom compute {} vector is accessed out-of-range",name); + error->all(FLERR,"Dump {} compute {} vector is accessed out-of-range", style, name); field2index[iarg] = add_compute(name); break; @@ -1493,15 +1494,15 @@ int DumpCustom::parse_fields(int narg, char **arg) vtype[iarg] = Dump::DOUBLE; ifix = modify->get_fix_by_id(name); - if (!ifix) error->all(FLERR,"Could not find dump custom fix ID: {}",name); + if (!ifix) error->all(FLERR,"Could not find dump {} fix ID: {}", style, name); if (ifix->peratom_flag == 0) - error->all(FLERR,"Dump custom fix {} does not compute per-atom info",name); + error->all(FLERR,"Dump {} fix {} does not compute per-atom info", style, name); if (argi.get_dim() == 0 && ifix->size_peratom_cols > 0) - error->all(FLERR,"Dump custom fix {} does not compute per-atom vector",name); + error->all(FLERR,"Dump {} fix {} does not compute per-atom vector", style, name); if (argi.get_dim() > 0 && ifix->size_peratom_cols == 0) - error->all(FLERR,"Dump custom fix {} does not compute per-atom array",name); + error->all(FLERR,"Dump {} fix {} does not compute per-atom array", style, name); if (argi.get_dim() > 0 && argi.get_index1() > ifix->size_peratom_cols) - error->all(FLERR,"Dump custom fix {} vector is accessed out-of-range",name); + error->all(FLERR,"Dump {} fix {} vector is accessed out-of-range", style, name); field2index[iarg] = add_fix(name); break; @@ -1513,9 +1514,9 @@ int DumpCustom::parse_fields(int narg, char **arg) vtype[iarg] = Dump::DOUBLE; n = input->variable->find(name); - if (n < 0) error->all(FLERR,"Could not find dump custom variable name {}",name); + if (n < 0) error->all(FLERR,"Could not find dump {} variable name {}", style, name); if (input->variable->atomstyle(n) == 0) - error->all(FLERR,"Dump custom variable {} is not atom-style variable",name); + error->all(FLERR,"Dump {} variable {} is not atom-style variable", style, name); field2index[iarg] = add_variable(name); break; @@ -1532,12 +1533,12 @@ int DumpCustom::parse_fields(int narg, char **arg) error->all(FLERR,"Could not find custom per-atom property ID: {}", name); if (argindex[iarg] == 0) { if (!flag || cols) - error->all(FLERR,"Property double vector {} for dump custom does not exist",name); + error->all(FLERR,"Property double vector {} for dump {} does not exist", name, style); } else { if (!flag || !cols) - error->all(FLERR,"Property double array {} for dump custom does not exist",name); + error->all(FLERR,"Property double array {} for dump {} does not exist", name, style); if (argindex[iarg] > atom->dcols[n]) - error->all(FLERR,"Dump custom property array {} is accessed out-of-range",name); + error->all(FLERR,"Dump {} property array {} is accessed out-of-range", style, name); } field2index[iarg] = add_custom(name,1); @@ -1555,12 +1556,12 @@ int DumpCustom::parse_fields(int narg, char **arg) error->all(FLERR,"Could not find custom per-atom property ID: {}", name); if (argindex[iarg] == 0) { if (flag || cols) - error->all(FLERR,"Property integer vector {} for dump custom does not exist",name); + error->all(FLERR,"Property integer vector {} for dump {} does not exist", name, style); } else { if (flag || !cols) - error->all(FLERR,"Property integer array {} for dump custom does not exist",name); + error->all(FLERR,"Property integer array {} for dump {} does not exist", name, style); if (argindex[iarg] > atom->icols[n]) - error->all(FLERR,"Dump custom property array {} is accessed out-of-range",name); + error->all(FLERR,"Dump {} property array {} is accessed out-of-range", style, name); } field2index[iarg] = add_custom(name,0); @@ -1945,9 +1946,9 @@ int DumpCustom::modify_param(int narg, char **arg) case ArgInfo::VARIABLE: thresh_array[nthresh] = VARIABLE; n = input->variable->find(name); - if (n < 0) error->all(FLERR,"Could not find dump modify variable name: {}",name); + if (n < 0) error->all(FLERR,"Could not find dump modify variable name: {}", name); if (input->variable->atomstyle(n) == 0) - error->all(FLERR,"Dump modify variable {} is not atom-style variable",name); + error->all(FLERR,"Dump modify variable {} is not atom-style variable", name); field2index[nfield+nthresh] = add_variable(name); break; @@ -1961,13 +1962,13 @@ int DumpCustom::modify_param(int narg, char **arg) error->all(FLERR,"Could not find custom per-atom property ID: {}", name); if (argindex[nfield+nthresh] == 0) { if (!flag || cols) - error->all(FLERR,"Property double vector for dump custom does not exist"); + error->all(FLERR,"Property double vector {} for dump {} does not exist", name, style); thresh_array[nthresh] = DVEC; } else { if (!flag || !cols) - error->all(FLERR,"Property double array for dump custom does not exist"); + error->all(FLERR,"Property double array {} for dump {} does not exist", name, style); if (argindex[nfield+nthresh] > atom->dcols[n]) - error->all(FLERR,"Dump custom property array is accessed out-of-range"); + error->all(FLERR,"Dump {} property array {} is accessed out-of-range", style, name); thresh_array[nthresh] = DARRAY; } @@ -1983,13 +1984,13 @@ int DumpCustom::modify_param(int narg, char **arg) error->all(FLERR,"Could not find custom per-atom property ID: {}", name); if (argindex[nfield+nthresh] == 0) { if (flag || cols) - error->all(FLERR,"Property integer vector for dump custom does not exist"); + error->all(FLERR,"Property integer vector {} for dump {} does not exist", name, style); thresh_array[nthresh] = IVEC; } else { if (flag || !cols) - error->all(FLERR,"Property integer array for dump custom does not exist"); + error->all(FLERR,"Property integer array {} for dump {} does not exist", name, style); if (argindex[nfield+nthresh] > atom->icols[n]) - error->all(FLERR,"Dump custom property array is accessed out-of-range"); + error->all(FLERR,"Dump {} property array {} is accessed out-of-range", style, name); thresh_array[nthresh] = IARRAY; } @@ -1999,7 +2000,7 @@ int DumpCustom::modify_param(int narg, char **arg) // no match default: - error->all(FLERR,"Invalid dump_modify thresh attribute: {}",name); + error->all(FLERR,"Invalid dump_modify thresh attribute: {}", name); break; } } From bb9dc960b76ebb92841352f6b00fbc88dd90c9e9 Mon Sep 17 00:00:00 2001 From: Stan Gerald Moore Date: Fri, 16 Jun 2023 10:26:01 -0600 Subject: [PATCH 281/396] Use updated values from @cjknight --- src/KOKKOS/pair_snap_kokkos.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/KOKKOS/pair_snap_kokkos.h b/src/KOKKOS/pair_snap_kokkos.h index 0df02e0bc7..ca1884bfd2 100644 --- a/src/KOKKOS/pair_snap_kokkos.h +++ b/src/KOKKOS/pair_snap_kokkos.h @@ -100,9 +100,9 @@ class PairSNAPKokkos : public PairSNAP { #elif defined(KOKKOS_ENABLE_SYCL) 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 = 4; - static constexpr int tile_size_transform_ui = 4; + static constexpr int tile_size_pre_ui = 8; + static constexpr int team_size_compute_ui = 8; + static constexpr int tile_size_transform_ui = 8; static constexpr int tile_size_compute_zi = 4; static constexpr int tile_size_compute_bi = 4; static constexpr int tile_size_transform_bi = 4; From 2d3bbd2e725a00e2af227862ea86d9de2f9422d9 Mon Sep 17 00:00:00 2001 From: Stan Gerald Moore Date: Fri, 16 Jun 2023 10:52:21 -0600 Subject: [PATCH 282/396] Temporarily disable team policy for ghost neigh list build due to known bug --- src/KOKKOS/npair_kokkos.cpp | 33 ++++++++++++++++++--------------- 1 file changed, 18 insertions(+), 15 deletions(-) diff --git a/src/KOKKOS/npair_kokkos.cpp b/src/KOKKOS/npair_kokkos.cpp index 852a4a9280..06567cbeb6 100644 --- a/src/KOKKOS/npair_kokkos.cpp +++ b/src/KOKKOS/npair_kokkos.cpp @@ -240,22 +240,25 @@ void NPairKokkos::build(NeighList *list_) // assumes newton off NPairKokkosBuildFunctorGhost f(data,atoms_per_bin * 5 * sizeof(X_FLOAT) * factor); -#ifdef LMP_KOKKOS_GPU - if (ExecutionSpaceFromDevice::space == Device) { - int team_size = atoms_per_bin*factor; - int team_size_max = Kokkos::TeamPolicy(team_size,Kokkos::AUTO).team_size_max(f,Kokkos::ParallelForTag()); - if (team_size <= team_size_max) { - Kokkos::TeamPolicy config((mbins+factor-1)/factor,team_size); - Kokkos::parallel_for(config, f); - } else { // fall back to flat method - f.sharedsize = 0; - Kokkos::parallel_for(nall, f); - } - } else - Kokkos::parallel_for(nall, f); -#else + +// temporarily disable team policy for ghost due to known bug + +//#ifdef LMP_KOKKOS_GPU +// if (ExecutionSpaceFromDevice::space == Device) { +// int team_size = atoms_per_bin*factor; +// int team_size_max = Kokkos::TeamPolicy(team_size,Kokkos::AUTO).team_size_max(f,Kokkos::ParallelForTag()); +// if (team_size <= team_size_max) { +// Kokkos::TeamPolicy config((mbins+factor-1)/factor,team_size); +// Kokkos::parallel_for(config, f); +// } else { // fall back to flat method +// f.sharedsize = 0; +// Kokkos::parallel_for(nall, f); +// } +// } else +// Kokkos::parallel_for(nall, f); +//#else Kokkos::parallel_for(nall, f); -#endif +//#endif } else { if (SIZE) { NPairKokkosBuildFunctorSize f(data,atoms_per_bin * 6 * sizeof(X_FLOAT) * factor); From 6f5e5746b356e15f2a18a60c4e67de73f946182d Mon Sep 17 00:00:00 2001 From: ilia-nikiforov-umn <78983960+ilia-nikiforov-umn@users.noreply.github.com> Date: Fri, 16 Jun 2023 12:21:42 -0500 Subject: [PATCH 283/396] Update lib/kim/README Fix some typos and update to non-deprecated form of kim commands --- lib/kim/README | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/lib/kim/README b/lib/kim/README index 3cba4a4597..b4cba92fb5 100644 --- a/lib/kim/README +++ b/lib/kim/README @@ -1,6 +1,6 @@ This directory contains build settings for the KIM API library which is -required to use the KIM package and its kim_init, kim_interactions, kim_query, -and pair_kim commands in a LAMMPS input script. +required to use the KIM package and its kim init, kim interactions and kim query +commands in a LAMMPS input script. Information about the KIM project can be found at https://openkim.org. The KIM project is lead by Ellad Tadmor and Ryan Elliott (U Minn). @@ -13,7 +13,7 @@ do the same thing by typing "python Install.py" from within this directory, or you can do it manually by following the instructions below. -Use of the kim_query command requires that the CURL library (libcurl) +Use of the kim query command requires that the CURL library (libcurl) development package and its configuration query tool, curl-config, are installed. The provided Makefile.lammps is set up to automatically detect this. @@ -29,7 +29,7 @@ $ printf "${PWD}/installed-kim-api-X-X.Y.Z" > ./kim-prefix.txt 2. Download and unpack the kim-api $ wget http://s3.openkim.org/kim-api/kim-api-X.Y.Z.txz -$ tar zxvf kim-api-X.Y.Z.txz +$ tar xvf kim-api-X.Y.Z.txz # configure the kim-api $ cd kim-api-X.Y.Z @@ -50,7 +50,7 @@ $ rm -rf kim-api-X.Y.Z.txz 5. To add items do the following (replace the kim item name with your desired value) -$ source ${PWD}/kim-api-X.Y.Z/bin/kim-api-activate +$ source ${PWD}/installed-kim-api-X.Y.Z/bin/kim-api-activate $ kim-api-collections-management install system EAM_ErcolessiAdams_1994_Al__MO_324507536345_002 @@ -59,7 +59,7 @@ $ kim-api-collections-management install system EAM_ErcolessiAdams_1994_Al__MO_3 When these steps are complete you can build LAMMPS with the KIM package installed: -$ cd lammpos/src +$ cd lammps/src $ make yes-kim $ make g++ (or whatever target you wish) From ce75691eaed0c71c5eb8d258c534dd97d96297a5 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Sat, 17 Jun 2023 00:35:05 -0400 Subject: [PATCH 284/396] address issues flagged by coverity scan --- src/DPD-REACT/fix_eos_table_rx.cpp | 10 ++++------ src/DPD-REACT/fix_rx.cpp | 15 +++++---------- src/YAFF/pair_lj_switch3_coulgauss_long.cpp | 2 -- 3 files changed, 9 insertions(+), 18 deletions(-) diff --git a/src/DPD-REACT/fix_eos_table_rx.cpp b/src/DPD-REACT/fix_eos_table_rx.cpp index 2687a11658..f7afddc64f 100644 --- a/src/DPD-REACT/fix_eos_table_rx.cpp +++ b/src/DPD-REACT/fix_eos_table_rx.cpp @@ -476,16 +476,14 @@ void FixEOStableRX::read_table(Table *tb, Table *tb2, char *file, char *keyword) utils::sfgets(FLERR,line,MAXLINE,fp,file,error); nwords = utils::count_words(utils::trim_comment(line)); - if (nwords != nspecies+2) { - printf("nwords=%d nspecies=%d\n",nwords,nspecies); - error->all(FLERR,"Illegal fix eos/table/rx command"); - } - nwords = 0; + if (nwords != nspecies+2) + error->all(FLERR,"Illegal fix eos/table/rx command: nwords={} nspecies={}", nwords, nspecies); + word = strtok(line," \t\n\r\f"); word = strtok(nullptr," \t\n\r\f"); rtmp = atof(word); - for (int icolumn=0;icolumn Date: Sat, 17 Jun 2023 14:38:49 -0400 Subject: [PATCH 285/396] fix logic bug --- src/ELECTRODE/fix_electrode_conp.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/ELECTRODE/fix_electrode_conp.cpp b/src/ELECTRODE/fix_electrode_conp.cpp index 1547fa6b97..dafd3c8fec 100644 --- a/src/ELECTRODE/fix_electrode_conp.cpp +++ b/src/ELECTRODE/fix_electrode_conp.cpp @@ -1209,8 +1209,8 @@ FixElectrodeConp::~FixElectrodeConp() } catch (std::exception &) { } } - if (!modify->get_fix_by_id(id)) // avoid segfault if derived fixes' ctor throws err - atom->delete_callback(id, Atom::GROW); // atomvec track local electrode atoms + + if (modify->get_fix_by_id(id)) atom->delete_callback(id, Atom::GROW); delete[] recvcounts; delete[] displs; From 37ca3f9af83e7e99614eff5c281e4a5925c5aa53 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Sat, 17 Jun 2023 14:38:59 -0400 Subject: [PATCH 286/396] apply clang-format --- src/ELECTRODE/fix_electrode_conp.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/ELECTRODE/fix_electrode_conp.cpp b/src/ELECTRODE/fix_electrode_conp.cpp index dafd3c8fec..85f59127f1 100644 --- a/src/ELECTRODE/fix_electrode_conp.cpp +++ b/src/ELECTRODE/fix_electrode_conp.cpp @@ -859,7 +859,7 @@ void FixElectrodeConp::update_charges() std::vector FixElectrodeConp::ele_ele_interaction(const std::vector &q_local) { - assert((int)q_local.size() == nlocalele); + assert((int) q_local.size() == nlocalele); assert(algo == Algo::CG || algo == Algo::MATRIX_CG); if (algo == Algo::CG) { set_charges(q_local); @@ -873,7 +873,7 @@ std::vector FixElectrodeConp::ele_ele_interaction(const std::vector q_local) { - assert((int)q_local.size() == nlocalele); + assert((int) q_local.size() == nlocalele); double *q = atom->q; for (int i = 0; i < nlocalele; i++) q[atom->map(taglist_local[i])] = q_local[i]; comm->forward_comm(this); @@ -942,7 +942,7 @@ std::vector FixElectrodeConp::scale_vector(double alpha, std::vector FixElectrodeConp::add_nlocalele(std::vector a, std::vector b) { - assert(((int)a.size() == nlocalele) && ((int)b.size() == nlocalele)); + assert(((int) a.size() == nlocalele) && ((int) b.size() == nlocalele)); for (int i = 0; i < nlocalele; i++) a[i] += b[i]; return a; } @@ -951,7 +951,7 @@ std::vector FixElectrodeConp::add_nlocalele(std::vector a, std:: double FixElectrodeConp::dot_nlocalele(std::vector a, std::vector b) { - assert(((int)a.size() == nlocalele) && ((int)b.size() == nlocalele)); + assert(((int) a.size() == nlocalele) && ((int) b.size() == nlocalele)); double out = 0.; for (int i = 0; i < nlocalele; i++) out += a[i] * b[i]; MPI_Allreduce(MPI_IN_PLACE, &out, 1, MPI_DOUBLE, MPI_SUM, world); @@ -962,7 +962,7 @@ double FixElectrodeConp::dot_nlocalele(std::vector a, std::vector FixElectrodeConp::times_elastance(std::vector x) { - assert((int)x.size() == ngroup); + assert((int) x.size() == ngroup); auto out = std::vector(nlocalele, 0.); for (int i = 0; i < nlocalele; i++) { double *_noalias row = elastance[list_iele[i]]; @@ -1412,7 +1412,7 @@ void FixElectrodeConp::gather_list_iele() } } nlocalele = static_cast(taglist_local.size()); // just for safety - assert((int)iele_to_group_local.size() == nlocalele); + assert((int) iele_to_group_local.size() == nlocalele); if (matrix_algo) { MPI_Allgather(&nlocalele, 1, MPI_INT, recvcounts, 1, MPI_INT, world); From 9231ec6dbe6978c79dd81f60ee7c1739a25665bc Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Sat, 17 Jun 2023 14:39:32 -0400 Subject: [PATCH 287/396] avoid segfault on deleting callback when there is an error in the constructor or a derived class --- src/QEQ/fix_qeq.cpp | 3 ++- src/RIGID/fix_rigid_small.cpp | 2 +- src/RIGID/fix_shake.cpp | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/QEQ/fix_qeq.cpp b/src/QEQ/fix_qeq.cpp index c8112ca24d..394ce69d22 100644 --- a/src/QEQ/fix_qeq.cpp +++ b/src/QEQ/fix_qeq.cpp @@ -143,7 +143,8 @@ FixQEq::FixQEq(LAMMPS *lmp, int narg, char **arg) : FixQEq::~FixQEq() { // unregister callbacks to this fix from Atom class - atom->delete_callback(id,Atom::GROW); + + if (modify->get_fix_by_id(id)) atom->delete_callback(id,Atom::GROW); memory->destroy(s_hist); memory->destroy(t_hist); diff --git a/src/RIGID/fix_rigid_small.cpp b/src/RIGID/fix_rigid_small.cpp index 089c644f1e..c579e362c7 100644 --- a/src/RIGID/fix_rigid_small.cpp +++ b/src/RIGID/fix_rigid_small.cpp @@ -481,7 +481,7 @@ FixRigidSmall::~FixRigidSmall() { // unregister callbacks to this fix from Atom class - atom->delete_callback(id,Atom::GROW); + if (modify->get_fix_by_id(id)) atom->delete_callback(id,Atom::GROW); // delete locally stored arrays diff --git a/src/RIGID/fix_shake.cpp b/src/RIGID/fix_shake.cpp index 6cd624c755..94c7668453 100644 --- a/src/RIGID/fix_shake.cpp +++ b/src/RIGID/fix_shake.cpp @@ -255,7 +255,7 @@ FixShake::~FixShake() // unregister callbacks to this fix from Atom class - atom->delete_callback(id,Atom::GROW); + if (modify->get_fix_by_id(id)) atom->delete_callback(id,Atom::GROW); // set bond_type and angle_type back to positive for SHAKE clusters // must set for all SHAKE bonds and angles stored by each atom From a3de790a0da60c1ff13a39e0617bc75f45bdb9b1 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Sat, 17 Jun 2023 15:01:17 -0400 Subject: [PATCH 288/396] include git descriptor info when compiling develop or maintenance version --- src/lammps.cpp | 8 +++++++- unittest/CMakeLists.txt | 2 +- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/lammps.cpp b/src/lammps.cpp index 1c7d12f79c..956793c20a 100644 --- a/src/lammps.cpp +++ b/src/lammps.cpp @@ -132,6 +132,12 @@ LAMMPS::LAMMPS(int narg, char **arg, MPI_Comm communicator) : num_ver = utils::date2num(version); restart_ver = -1; + // append git descriptor info to update string when compiling development or maintenance version + + std::string update_string = UPDATE_STRING; + if (has_git_info() && (update_string == " - Development") || (update_string == " - Maintenance")) + update_string += fmt::format(" - {}", git_descriptor()); + external_comm = 0; mdicomm = nullptr; @@ -524,7 +530,7 @@ LAMMPS::LAMMPS(int narg, char **arg, MPI_Comm communicator) : if (infile == nullptr) error->one(FLERR,"Cannot open input script {}: {}", arg[inflag], utils::getsyserror()); if (!helpflag) - utils::logmesg(this,fmt::format("LAMMPS ({}{})\n",version,UPDATE_STRING)); + utils::logmesg(this,fmt::format("LAMMPS ({}{})\n", version, update_string)); // warn against using I/O redirection in parallel runs if ((inflag == 0) && (universe->nprocs > 1)) diff --git a/unittest/CMakeLists.txt b/unittest/CMakeLists.txt index f41e8a2878..f7be54f9ae 100644 --- a/unittest/CMakeLists.txt +++ b/unittest/CMakeLists.txt @@ -54,7 +54,7 @@ add_test(NAME RunLammps COMMAND $ -log none -echo none -in in.empty) set_tests_properties(RunLammps PROPERTIES ENVIRONMENT "TSAN_OPTIONS=ignore_noninstrumented_modules=1;HWLOC_HIDE_ERRORS=2" - PASS_REGULAR_EXPRESSION "LAMMPS \\([0-9]+ [A-Za-z]+ 2[0-9][0-9][0-9]( - Update [0-9]+)?( - Development)?( - Maintenance)?\\)") + PASS_REGULAR_EXPRESSION "LAMMPS \\([0-9]+ [A-Za-z]+ 2[0-9][0-9][0-9]( - Update [0-9]+)?( - Development.*)?( - Maintenance.*)?\\)") # check if the compiled executable will print the help message add_test(NAME HelpMessage From 058d817335db93ed263cb9aa16770af20761a408 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Sat, 17 Jun 2023 17:45:16 -0400 Subject: [PATCH 289/396] whitespace --- src/RIGID/fix_rigid_small.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/RIGID/fix_rigid_small.cpp b/src/RIGID/fix_rigid_small.cpp index c579e362c7..bf0a847d48 100644 --- a/src/RIGID/fix_rigid_small.cpp +++ b/src/RIGID/fix_rigid_small.cpp @@ -259,7 +259,7 @@ FixRigidSmall::FixRigidSmall(LAMMPS *lmp, int narg, char **arg) : utils::numeric(FLERR,arg[iarg+3],false,lmp); p_flag[0] = p_flag[1] = p_flag[2] = 1; if (domain->dimension == 2) { - p_start[2] = p_stop[2] = p_period[2] = 0.0; + p_start[2] = p_stop[2] = p_period[2] = 0.0; p_flag[2] = 0; } iarg += 4; @@ -275,7 +275,7 @@ FixRigidSmall::FixRigidSmall(LAMMPS *lmp, int narg, char **arg) : p_flag[0] = p_flag[1] = p_flag[2] = 1; if (domain->dimension == 2) { p_start[2] = p_stop[2] = p_period[2] = 0.0; - p_flag[2] = 0; + p_flag[2] = 0; } iarg += 4; From f193a87426b0a4bb32abd8fb22369869aa15f25c Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Sat, 17 Jun 2023 18:04:38 -0400 Subject: [PATCH 290/396] correct CMake syntax --- unittest/c-library/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/unittest/c-library/CMakeLists.txt b/unittest/c-library/CMakeLists.txt index 21b00b5c03..496cbb5055 100644 --- a/unittest/c-library/CMakeLists.txt +++ b/unittest/c-library/CMakeLists.txt @@ -88,7 +88,7 @@ if(BUILD_MPI) add_test(NAME RunCoupleSimpleCC COMMAND $ 1 ${LAMMPS_DIR}/examples/COUPLE/simple/in.lj) - if($) + if(TARGET simpleF90) add_test(NAME RunCoupleSimpleF90 COMMAND $ 1 ${LAMMPS_DIR}/examples/COUPLE/simple/in.lj) set_tests_properties(RunCoupleSimpleF90 PROPERTIES From 5eba9d7ee3de42cc5fbc20c1bdfa45e614f013cd Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Sat, 17 Jun 2023 18:04:54 -0400 Subject: [PATCH 291/396] update regex for change to version output --- unittest/c-library/CMakeLists.txt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/unittest/c-library/CMakeLists.txt b/unittest/c-library/CMakeLists.txt index 496cbb5055..3e5b7a8cc0 100644 --- a/unittest/c-library/CMakeLists.txt +++ b/unittest/c-library/CMakeLists.txt @@ -80,7 +80,7 @@ if(BUILD_MPI) COMMAND $ 1 ${LAMMPS_DIR}/examples/COUPLE/plugin/in.lj $) set_tests_properties(RunCoupleSimplePlugin PROPERTIES ENVIRONMENT "TSAN_OPTIONS=ignore_noninstrumented_modules=1;HWLOC_HIDE_ERRORS=2" - PASS_REGULAR_EXPRESSION "LAMMPS \\([0-9]+ [A-Za-z]+ 2[0-9][0-9][0-9]( - Update [0-9]+)?( - Development)?( - Maintenance)?\\)") + PASS_REGULAR_EXPRESSION "LAMMPS \\([0-9]+ [A-Za-z]+ 2[0-9][0-9][0-9]( - Update [0-9]+)?( - Development.*)?( - Maintenance.*)?\\)") endif() add_subdirectory(${LAMMPS_DIR}/examples/COUPLE/simple ${CMAKE_BINARY_DIR}/build-simple) add_test(NAME RunCoupleSimpleC @@ -93,10 +93,10 @@ if(BUILD_MPI) COMMAND $ 1 ${LAMMPS_DIR}/examples/COUPLE/simple/in.lj) set_tests_properties(RunCoupleSimpleF90 PROPERTIES ENVIRONMENT "TSAN_OPTIONS=ignore_noninstrumented_modules=1;HWLOC_HIDE_ERRORS=2" - PASS_REGULAR_EXPRESSION "LAMMPS \\([0-9]+ [A-Za-z]+ 2[0-9][0-9][0-9]( - Update [0-9]+)?( - Development)?( - Maintenance)?\\)") + PASS_REGULAR_EXPRESSION "LAMMPS \\([0-9]+ [A-Za-z]+ 2[0-9][0-9][0-9]( - Update [0-9]+)?( - Development.*)?( - Maintenance.*)?\\)") endif() set_tests_properties(RunCoupleSimpleC RunCoupleSimpleCC PROPERTIES ENVIRONMENT "TSAN_OPTIONS=ignore_noninstrumented_modules=1;HWLOC_HIDE_ERRORS=2" - PASS_REGULAR_EXPRESSION "LAMMPS \\([0-9]+ [A-Za-z]+ 2[0-9][0-9][0-9]( - Update [0-9]+)?( - Development)?( - Maintenance)?\\)") + PASS_REGULAR_EXPRESSION "LAMMPS \\([0-9]+ [A-Za-z]+ 2[0-9][0-9][0-9]( - Update [0-9]+)?( - Development.*)?( - Maintenance.*)?\\)") endif() From 753a0bd386162925b4d93c48bd4bcda06df308fe Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Sat, 17 Jun 2023 18:22:53 -0400 Subject: [PATCH 292/396] remove obsolete Fortran interfaces from examples/COUPLE folder --- doc/src/Fortran.rst | 11 - examples/COUPLE/README | 13 +- examples/COUPLE/fortran2/.gitignore | 1 - examples/COUPLE/fortran2/LAMMPS-wrapper.cpp | 96 - examples/COUPLE/fortran2/LAMMPS-wrapper.h | 41 - examples/COUPLE/fortran2/LAMMPS.F90 | 1788 ----------------- examples/COUPLE/fortran2/Makefile | 41 - examples/COUPLE/fortran2/README | 273 --- examples/COUPLE/fortran2/in.simple | 16 - examples/COUPLE/fortran2/simple.f90 | 112 -- .../COUPLE/fortran_dftb/LAMMPS-wrapper.cpp | 96 - examples/COUPLE/fortran_dftb/LAMMPS-wrapper.h | 40 - .../COUPLE/fortran_dftb/LAMMPS-wrapper2.cpp | 80 - .../COUPLE/fortran_dftb/LAMMPS-wrapper2.h | 37 - examples/COUPLE/fortran_dftb/LAMMPS.F90 | 982 --------- examples/COUPLE/fortran_dftb/README | 37 - examples/COUPLE/fortran_dftb/data.diamond | 148 -- examples/COUPLE/fortran_dftb/dftb_in.hsd | 40 - examples/COUPLE/fortran_dftb/dftb_pin.hsd | 129 -- examples/COUPLE/fortran_dftb/in.simple | 16 - examples/COUPLE/fortran_dftb/log.simple | 71 - examples/COUPLE/fortran_dftb/makefile | 45 - examples/COUPLE/fortran_dftb/simple.f90 | 110 - 23 files changed, 4 insertions(+), 4219 deletions(-) delete mode 100644 examples/COUPLE/fortran2/.gitignore delete mode 100644 examples/COUPLE/fortran2/LAMMPS-wrapper.cpp delete mode 100644 examples/COUPLE/fortran2/LAMMPS-wrapper.h delete mode 100644 examples/COUPLE/fortran2/LAMMPS.F90 delete mode 100644 examples/COUPLE/fortran2/Makefile delete mode 100644 examples/COUPLE/fortran2/README delete mode 100644 examples/COUPLE/fortran2/in.simple delete mode 100644 examples/COUPLE/fortran2/simple.f90 delete mode 100644 examples/COUPLE/fortran_dftb/LAMMPS-wrapper.cpp delete mode 100644 examples/COUPLE/fortran_dftb/LAMMPS-wrapper.h delete mode 100644 examples/COUPLE/fortran_dftb/LAMMPS-wrapper2.cpp delete mode 100644 examples/COUPLE/fortran_dftb/LAMMPS-wrapper2.h delete mode 100644 examples/COUPLE/fortran_dftb/LAMMPS.F90 delete mode 100644 examples/COUPLE/fortran_dftb/README delete mode 100644 examples/COUPLE/fortran_dftb/data.diamond delete mode 100644 examples/COUPLE/fortran_dftb/dftb_in.hsd delete mode 100644 examples/COUPLE/fortran_dftb/dftb_pin.hsd delete mode 100644 examples/COUPLE/fortran_dftb/in.simple delete mode 100644 examples/COUPLE/fortran_dftb/log.simple delete mode 100644 examples/COUPLE/fortran_dftb/makefile delete mode 100644 examples/COUPLE/fortran_dftb/simple.f90 diff --git a/doc/src/Fortran.rst b/doc/src/Fortran.rst index 7e9f16fa70..3b9ad9d1ff 100644 --- a/doc/src/Fortran.rst +++ b/doc/src/Fortran.rst @@ -56,17 +56,6 @@ C++ in the ``examples/COUPLE/simple`` folder of the LAMMPS distribution. and Ubuntu 18.04 LTS and not compatible. Either newer compilers need to be installed or the Linux updated. -.. versionchanged:: 8Feb2023 - -.. note:: - - A contributed Fortran interface is available in the - ``examples/COUPLE/fortran2`` folder. However, since the completion - of the :f:mod:`LIBLAMMPS` module, this interface is now deprecated, - no longer actively maintained and will likely be removed in the - future. Please see the ``README`` file in that folder for more - information about it and how to contact its author and maintainer. - ---------- Creating or deleting a LAMMPS object diff --git a/examples/COUPLE/README b/examples/COUPLE/README index adf46d027d..13e593d55d 100644 --- a/examples/COUPLE/README +++ b/examples/COUPLE/README @@ -19,12 +19,12 @@ See these sections of the LAMMPS manual for details: Build LAMMPS as a library (doc/html/Build_basics.html) Link LAMMPS as a library to another code (doc/html/Build_link.html) Coupling LAMMPS to other codes (doc/html/Howto_couple.html) -Using LAMMPS in client/server mode (doc/html/Howto_client_server.html) Library interface to LAMMPS (doc/html/Howto_library.html) +Detailed documentation of the LAMMPS interfaces (doc/html/Library.html) -The library interface to LAMMPS is in src/library.cpp. Routines can -be easily added to this file so an external program can perform the -LAMMPS tasks desired. +The core library interface to LAMMPS is in src/library.cpp. Routines +can be easily added to this file so an external program can perform +the LAMMPS tasks desired. ------------------------------------------------------------------- @@ -36,10 +36,5 @@ plugin example for loading LAMMPS at runtime from a shared library lammps_spparks grain-growth Monte Carlo with strain via MD, coupling to SPPARKS kinetic MC code library collection of useful inter-code communication routines -fortran2 a more sophisticated wrapper on the LAMMPS library API that - can be called from Fortran -fortran_dftb wrapper written by Nir Goldman (LLNL), as an - extension to fortran2, used for calling LAMMPS - from Fortran DFTB+ tight-binding code Each sub-directory has its own README with more details. diff --git a/examples/COUPLE/fortran2/.gitignore b/examples/COUPLE/fortran2/.gitignore deleted file mode 100644 index 63a7748cf4..0000000000 --- a/examples/COUPLE/fortran2/.gitignore +++ /dev/null @@ -1 +0,0 @@ -*.mod diff --git a/examples/COUPLE/fortran2/LAMMPS-wrapper.cpp b/examples/COUPLE/fortran2/LAMMPS-wrapper.cpp deleted file mode 100644 index 4774cb6b49..0000000000 --- a/examples/COUPLE/fortran2/LAMMPS-wrapper.cpp +++ /dev/null @@ -1,96 +0,0 @@ -/* ----------------------------------------------------------------------- - LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator - https://www.lammps.org/, Sandia National Laboratories - LAMMPS development team: developers@lammps.org - - 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 author: Karl D. Hammond - University of Missouri (USA), 2012 -------------------------------------------------------------------------- */ - -/* This is set of "wrapper" functions to assist LAMMPS.F90, which itself - provides a (I hope) robust Fortran interface to library.cpp and - library.h. All functions herein COULD be added to library.cpp instead of - including this as a separate file. See the README for instructions. */ - -#include -#include "LAMMPS-wrapper.h" -#define LAMMPS_LIB_MPI 1 -#include -#include -#include -#include -#include -#include -#include -#include - -using namespace LAMMPS_NS; - -void lammps_open_fortran_wrapper (int argc, char **argv, - MPI_Fint communicator, void **ptr) -{ - MPI_Comm C_communicator = MPI_Comm_f2c (communicator); - lammps_open (argc, argv, C_communicator, ptr); -} - -int lammps_get_ntypes (void *ptr) -{ - class LAMMPS *lmp = (class LAMMPS *) ptr; - int ntypes = lmp->atom->ntypes; - return ntypes; -} - -void lammps_error_all (void *ptr, const char *file, int line, const char *str) -{ - class LAMMPS *lmp = (class LAMMPS *) ptr; - lmp->error->all (file, line, str); -} - -int lammps_extract_compute_vectorsize (void *ptr, char *id, int style) -{ - int *size; - size = (int *) lammps_extract_compute(ptr, id, style, LMP_SIZE_VECTOR); - if (size) return *size; - return 0; -} - -void lammps_extract_compute_arraysize (void *ptr, char *id, int style, - int *nrows, int *ncols) -{ - int *tmp; - tmp = (int *) lammps_extract_compute(ptr, id, style, LMP_SIZE_ROWS); - if (tmp) *nrows = *tmp; - tmp = (int *) lammps_extract_compute(ptr, id, style, LMP_SIZE_COLS); - if (tmp) *ncols = *tmp; - return; -} - -int lammps_extract_fix_vectorsize (void *ptr, char *id, int style) -{ - int *size; - size = (int *) lammps_extract_fix(ptr, id, style, LMP_SIZE_VECTOR, 0, 0); - if (size) return *size; - return 0; -} - -void lammps_extract_fix_arraysize (void *ptr, char *id, int style, - int *nrows, int *ncols) -{ - int *tmp; - tmp = (int *) lammps_extract_fix(ptr, id, style, LMP_SIZE_ROWS, 0, 0); - if (tmp) *nrows = *tmp; - tmp = (int *) lammps_extract_fix(ptr, id, style, LMP_SIZE_COLS, 0, 0); - if (tmp) *ncols = *tmp; - return; -} - -/* vim: set ts=3 sts=3 expandtab: */ diff --git a/examples/COUPLE/fortran2/LAMMPS-wrapper.h b/examples/COUPLE/fortran2/LAMMPS-wrapper.h deleted file mode 100644 index 02e1a651a9..0000000000 --- a/examples/COUPLE/fortran2/LAMMPS-wrapper.h +++ /dev/null @@ -1,41 +0,0 @@ -/* ----------------------------------------------------------------------- - LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator - https://www.lammps.org/, Sandia National Laboratories - LAMMPS development team: developers@lammps.org - - 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 author: Karl D. Hammond - University of Missouri (USA), 2012 -------------------------------------------------------------------------- */ - -/* This is set of "wrapper" functions to assist LAMMPS.F90, which itself - provides a (I hope) robust Fortran interface to library.cpp and - library.h. All prototypes herein COULD be added to library.h instead of - including this as a separate file. See the README for instructions. */ - -#ifdef __cplusplus -extern "C" { -#endif - -/* Prototypes for auxiliary functions */ -void lammps_open_fortran_wrapper (int, char**, MPI_Fint, void**); -int lammps_get_ntypes (void*); -int lammps_extract_compute_vectorsize (void*, char*, int); -void lammps_extract_compute_arraysize (void*, char*, int, int*, int*); -int lammps_extract_fix_vectorsize (void*, char*, int); -void lammps_extract_fix_arraysize (void*, char*, int, int*, int*); -void lammps_error_all (void*, const char*, int, const char*); - -#ifdef __cplusplus -} -#endif - -/* vim: set ts=3 sts=3 expandtab: */ diff --git a/examples/COUPLE/fortran2/LAMMPS.F90 b/examples/COUPLE/fortran2/LAMMPS.F90 deleted file mode 100644 index 2f4ae2c95e..0000000000 --- a/examples/COUPLE/fortran2/LAMMPS.F90 +++ /dev/null @@ -1,1788 +0,0 @@ -!! ----------------------------------------------------------------------- -! LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator -! https://www.lammps.org/ Sandia National Laboratories -! LAMMPS Development team: developers@lammps.org -! -! 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 author: Karl D. Hammond -! University of Tennessee, Knoxville (USA), 2012 -! Updated October 2020 by the author (now at the University of Missouri). -!-------------------------------------------------------------------------- - -!! NOTE ------------------------------------------------------------------- -! This interface is obsolete and may be removed in a future release of -! LAMMPS. The interface in fortran/lammps.f90 replaces this one. That API -! is maintained by the LAMMPS developers and has documentation written for -! it; it is based loosely on this one, but binds all procedures to a lammps -! derived type. That interface was written in large -! part by the same author, but is also supported by other developers. -!-------------------------------------------------------------------------- - -!! LAMMPS, a Fortran 2003 module containing an interface between Fortran -!! programs and the C-style functions in library.cpp that ship with LAMMPS. -!! This file should be accompanied by LAMMPS-wrapper.cpp and LAMMPS-wrapper.h, -!! which define wrapper functions that ease portability and enforce array -!! dimensions. -!! -!! Everything in this module should be 100% portable by way of Fortran 2003's -!! ISO_C_BINDING intrinsic module. See the README for instructions for -!! compilation and use. -!! -!! Here are the PUBLIC functions and subroutines included in this module. -!! subroutine lammps_open (command_line, communicator, ptr) -!! subroutine lammps_open_no_mpi (command_line, ptr) -!! subroutine lammps_close (ptr) -!! integer (kind=C_int) lammps_version (ptr) -!! subroutine lammps_file (ptr, str) -!! subroutine lammps_command (ptr, str) -!! subroutine lammps_commands_list (ptr, cmds) -!! subroutine lammps_commands_string (ptr, str) -!! subroutine lammps_free (ptr) -!! integer function lammps_extract_setting (ptr, name) -!! subroutine lammps_extract_global (global, ptr, name) -!! subroutine lammps_extract_box (ptr, boxlo, boxhi, xy, yz, xz, & -!! periodicity, box_change) -!! subroutine lammps_extract_atom (atom, ptr, name) -!! subroutine lammps_extract_compute (compute, ptr, id, style, type) -!! subroutine lammps_extract_fix (fix, ptr, id, style, type, i, j) -!! subroutine lammps_extract_variable (variable, ptr, name, group) -!! double precision function lammps_get_thermo (ptr, name) -!! double precision function lammps_get_natoms (ptr) -!! subroutine lammps_set_variable (ptr, name, str, [err]) -!! subroutine lammps_reset_box (ptr, boxlo, boxhi, xy, yz, xz) -!! subroutine lammps_gather_atoms (ptr, name, count, data) -!! subroutine lammps_gather_atoms_concat (ptr, name, count, data) -!! subroutine lammps_gather_atoms_subset (ptr, name, count, ids, data) -!! subroutine lammps_scatter_atoms (ptr, name, data) -!! subroutine lammps_scatter_atoms_subset (ptr, name, ids, data) -!! logical function lammps_config_has_package (package_name) -!! integer function lammps_config_package_count () -!! logical function lammps_config_package_name (index, buffer) -!! logical function lammps_config_has_gzip_support () -!! logical function lammps_config_has_png_support () -!! logical function lammps_config_has_jpeg_support () -!! logical function lammps_config_has_ffmpeg_support () -!! logical function lammps_config_has_exceptions () -!! integer function lammps_find_pair_neighlist (ptr, style, exact, nsub, -!! request) -!! integer function lammps_find_fix_neighlist (ptr, id, request) -!! integer function lammps_find_compute_neighlist (ptr, id, request) -!! integer function lammps_neighlist_num_elements (ptr, idx) -!! subroutine lammps_neighlist_element_neighbors (ptr, idx, element, iatom, -!! numneigh, neighbors) -!! subroutine lammps_create_atoms (ptr, n, id, type, x, v, image, -!1 shrinkexceed) -!! -!! The following are also available if compiled with -DLAMMPS_EXCEPTIONS -!! function lammps_has_error (ptr) -!! function lammps_get_last_error_message (ptr, buffer) -!! -!! Note that the following function is not implemented from this interface: -!! lammps_set_fix_external_callback - -#define FLERR __FILE__,__LINE__ -! The above line allows for similar error checking as is done with standard -! LAMMPS files. - -! This should (?) allow this module to work with settings in lmptype.h -#if !defined(LAMMPS_SMALLSMALL) && !defined(LAMMPS_BIGBIG) && !defined(LAMMPS_SMALLBIG) -#define LAMMPS_SMALLBIG -#endif - -#ifdef LAMMPS_SMALLBIG -#define C_smallint C_int -#define C_imageint C_int -#define C_tagint C_int -#define C_bigint C_int64_t -#endif - -#ifdef LAMMPS_BIGBIG -#define C_smallint C_int -#define C_imageint C_int64_t -#define C_tagint C_int64_t -#define C_bigint C_int64_t -#endif - -#ifdef LAMMPS_SMALLSMALL -#define C_smallint C_int -#define C_imageint C_int -#define C_tagint C_int -#define C_bigint C_int -#endif - -module LAMMPS - - use, intrinsic :: ISO_C_binding, only : C_double, C_int, C_ptr, C_char, & - C_NULL_CHAR, C_NULL_PTR, C_loc, C_F_pointer, C_int64_t, & - lammps_instance => C_ptr - implicit none - private - - ! We inherit some ISO_C_BINDING entities for ease of use - public :: lammps_instance, C_ptr, C_double, C_int - ! Only the following functions may be called by the user: - public :: lammps_open, lammps_open_no_mpi, lammps_close, & - lammps_version, lammps_file, lammps_command, lammps_commands_list, & - lammps_commands_string, lammps_free, lammps_extract_setting, & - lammps_extract_global, lammps_extract_box, lammps_extract_atom, & - lammps_extract_compute, lammps_extract_fix, lammps_extract_variable, & - lammps_get_thermo, lammps_get_natoms, lammps_set_variable, & - lammps_reset_box, lammps_gather_atoms, lammps_gather_atoms_concat, & - lammps_gather_atoms_subset, lammps_scatter_atoms, & - lammps_scatter_atoms_subset, lammps_config_has_package, & - lammps_config_package_count, lammps_config_package_name, & - lammps_config_has_gzip_support, lammps_config_has_png_support, & - lammps_config_has_jpeg_support, lammps_config_has_ffmpeg_support, & - lammps_config_has_exceptions, lammps_find_pair_neighlist, & - lammps_find_fix_neighlist, lammps_find_compute_neighlist, & - lammps_neighlist_num_elements, lammps_neighlist_element_neighbors, & - lammps_create_atoms - -#ifdef LAMMPS_EXCEPTIONS - public :: lammps_has_error, lammps_get_last_error_message -#endif - - !! constants for extracting data from computes and fixes - !! and data types - - INTEGER, PARAMETER :: LMP_STYLE_GLOBAL = 0, LMP_STYLE_ATOM = 1, & - LMP_STYLE_LOCAL = 2, LMP_TYPE_SCALAR = 0, LMP_TYPE_VECTOR = 1, & - LMP_TYPE_ARRAY = 2, LMP_SIZE_VECTOR = 3, LMP_SIZE_ROWS = 4, & - LMP_SIZE_COLS = 5, LAMMPS_INT = 0, LAMMPS_INT_2D = 1, & - LAMMPS_DOUBLE = 2, LAMMPS_DOUBLE_2D = 3, LAMMPS_INT64 = 4, & - LAMMPS_INT64_2D = 5, LAMMPS_STRING = 6 - - PUBLIC :: LMP_STYLE_GLOBAL, LMP_STYLE_ATOM, LMP_STYLE_LOCAL, & - LMP_TYPE_SCALAR, LMP_TYPE_VECTOR, LMP_TYPE_ARRAY, & - LMP_SIZE_VECTOR, LMP_SIZE_ROWS, LMP_SIZE_COLS, LAMMPS_INT, & - LAMMPS_INT_2D, LAMMPS_DOUBLE, LAMMPS_DOUBLE_2D, LAMMPS_INT64, & - LAMMPS_INT64_2D, LAMMPS_STRING - - !! Functions supplemental to the prototypes in library.h. {{{1 - !! The function definitions (in C++) are contained in LAMMPS-wrapper.cpp. - !! I would have written the first in Fortran, but the MPI libraries (which - !! were written in C) have C-based functions to convert from Fortran MPI - !! handles to C MPI handles, and there is no Fortran equivalent for those - !! functions. - interface - subroutine lammps_open_wrapper (argc, argv, communicator, ptr) & - bind (C, name='lammps_open_fortran_wrapper') - import :: C_int, C_ptr - integer (C_int), value :: argc - type (C_ptr), dimension(*) :: argv - integer, value :: communicator - type (C_ptr) :: ptr - end subroutine lammps_open_wrapper - subroutine lammps_actual_error_all (ptr, file, line, str) & - bind (C, name='lammps_error_all') - import :: C_int, C_char, C_ptr - type (C_ptr), value :: ptr - character (kind=C_char), dimension(*) :: file, str - integer (C_int), value :: line - end subroutine lammps_actual_error_all - function lammps_get_ntypes (ptr) result (ntypes) & - bind (C, name='lammps_get_ntypes') - import :: C_int, C_ptr - type (C_ptr), value :: ptr - integer (C_int) :: ntypes - end function lammps_get_ntypes - function lammps_actual_extract_compute_vectorsize (ptr, id, style) & - result (vectorsize) bind (C, name='lammps_extract_compute_vectorsize') - import :: C_int, C_char, C_ptr - integer (C_int) :: vectorsize - type (C_ptr), value :: ptr - character (kind=C_char), dimension(*) :: id - integer (C_int), value :: style - end function lammps_actual_extract_compute_vectorsize - subroutine lammps_actual_extract_compute_arraysize (ptr, id, style, & - nrows, ncols) bind (C, name='lammps_extract_compute_arraysize') - import :: C_int, C_char, C_ptr - integer (C_int) :: arraysize - type (C_ptr), value :: ptr - character (kind=C_char), dimension(*) :: id - integer (C_int), value :: style - integer (C_int) :: nrows, ncols - end subroutine lammps_actual_extract_compute_arraysize - function lammps_actual_extract_fix_vectorsize (ptr, id, style) & - result (vectorsize) bind (C, name='lammps_extract_fix_vectorsize') - import :: C_int, C_char, C_ptr - integer (C_int) :: vectorsize - type (C_ptr), value :: ptr - character (kind=C_char), dimension(*) :: id - integer (C_int), value :: style - end function lammps_actual_extract_fix_vectorsize - subroutine lammps_actual_extract_fix_arraysize (ptr, id, style, & - nrows, ncols) bind (C, name='lammps_extract_fix_arraysize') - import :: C_int, C_char, C_ptr - type (C_ptr), value :: ptr - character (kind=C_char), dimension(*) :: id - integer (C_int), value :: style - integer (C_int) :: nrows, ncols - end subroutine lammps_actual_extract_fix_arraysize - end interface - - !! Functions/subroutines defined in library.h and library.cpp {{{1 - interface - subroutine lammps_actual_open_no_mpi (argc, argv, ptr) & - bind (C, name='lammps_open_no_mpi') - import :: C_int, C_ptr - integer (C_int), value :: argc - type (C_ptr), dimension(*) :: argv - type (C_ptr) :: ptr - end subroutine lammps_actual_open_no_mpi - - subroutine lammps_close (ptr) bind (C, name='lammps_close') - import :: C_ptr - type (C_ptr), value :: ptr - end subroutine lammps_close - - function lammps_version (ptr) result (version) & - bind (C, name='lammps_version') - import :: C_ptr, C_int - type (C_ptr), value :: ptr - integer (kind=C_int) :: version - end function lammps_version - - subroutine lammps_actual_file (ptr, str) bind (C, name='lammps_file') - import :: C_ptr, C_char - type (C_ptr), value :: ptr - character (kind=C_char), dimension(*) :: str - end subroutine lammps_actual_file - - function lammps_actual_command (ptr, str) result (command) & - bind (C, name='lammps_command') - import :: C_ptr, C_char - type (C_ptr), value :: ptr - character (kind=C_char), dimension(*) :: str - type (C_ptr) :: command - end function lammps_actual_command - - subroutine lammps_actual_commands_list (ptr, ncmd, cmds) & - bind (C, name='lammps_commands_list') - import :: C_ptr, C_int - type (C_ptr), value :: ptr - type (C_ptr), dimension(*) :: cmds - integer (C_int), value :: ncmd - end subroutine lammps_actual_commands_list - - subroutine lammps_actual_commands_string (ptr, str) & - bind (C, name='lammps_commands_string') - import :: C_ptr, C_char - type (C_ptr), value :: ptr - character (kind=C_char), dimension(*) :: str - end subroutine lammps_actual_commands_string - - subroutine lammps_free (ptr) bind (C, name='lammps_free') - import :: C_ptr - type (C_ptr), value :: ptr - end subroutine lammps_free - - function lammps_actual_extract_setting (ptr, name) result (setting) & - bind(C, name='lammps_extract_setting') - import :: C_ptr, C_char, C_int - type (C_ptr), value :: ptr - character (kind=C_char), dimension(*) :: name - integer (kind=C_int) :: setting - end function lammps_actual_extract_setting - - function lammps_actual_extract_global (ptr, name) & - bind (C, name='lammps_extract_global') result (global) - import :: C_ptr, C_char - type (C_ptr), value :: ptr - character (kind=C_char), dimension(*) :: name - type (C_ptr) :: global - end function lammps_actual_extract_global - - subroutine lammps_actual_extract_box (ptr, boxlo, boxhi, xy, yz, & - xz, periodicity, box_change) bind (C, name='lammps_extract_box') - import :: C_ptr, C_double, C_int - type (C_ptr), value :: ptr - real (C_double) :: boxlo(3), boxhi(3), xy, yz, xz - integer (C_int) :: periodicity(3), box_change - end subroutine lammps_actual_extract_box - - function lammps_actual_extract_atom (ptr, name) & - bind (C, name='lammps_extract_atom') result (atom) - import :: C_ptr, C_char - type (C_ptr), value :: ptr - character (kind=C_char), dimension(*) :: name - type (C_ptr) :: atom - end function lammps_actual_extract_atom - - function lammps_actual_extract_compute (ptr, id, style, type) & - result (compute) bind (C, name='lammps_extract_compute') - import :: C_ptr, C_char, C_int - type (C_ptr), value :: ptr - character (kind=C_char), dimension(*) :: id - integer (C_int), value :: style, type - type (C_ptr) :: compute - end function lammps_actual_extract_compute - - function lammps_actual_extract_fix (ptr, id, style, type, i, j) & - result (fix) bind (C, name='lammps_extract_fix') - import :: C_ptr, C_char, C_int - type (C_ptr), value :: ptr - character (kind=C_char), dimension(*) :: id - integer (C_int), value :: style, type, i, j - type (C_ptr) :: fix - end function lammps_actual_extract_fix - - function lammps_actual_extract_variable (ptr, name, group) & - result (variable) bind (C, name='lammps_extract_variable') - import :: C_ptr, C_char - type (C_ptr), value :: ptr - character (kind=C_char), dimension(*) :: name, group - type (C_ptr) :: variable - end function lammps_actual_extract_variable - - function lammps_actual_get_thermo (ptr, name) result (dval) & - bind (C, name='lammps_get_thermo') - import :: C_ptr, C_char, C_double - type (C_ptr), value :: ptr - character (kind=C_char), dimension(*) :: name - real (C_double) :: dval - end function lammps_actual_get_thermo - - function lammps_get_natoms (ptr) result (natoms) & - bind (C, name='lammps_get_natoms') - import :: C_ptr, C_double - type (C_ptr), value :: ptr - real (C_double) :: natoms - end function lammps_get_natoms - - function lammps_actual_set_variable (ptr, name, str) result (err) & - bind (C, name='lammps_set_variable') - import :: C_ptr, C_char, C_int - type (C_ptr), value :: ptr - character (kind=C_char), dimension(*) :: name, str - integer (C_int) :: err - end function lammps_actual_set_variable - - subroutine lammps_actual_reset_box (ptr, boxlo, boxhi, xy, yz, xz) & - bind (C, name='lammps_reset_box') - import :: C_ptr, C_double, C_int - type (C_ptr), value :: ptr - real (C_double) :: boxlo(3), boxhi(3), xy, yz, xz - end subroutine lammps_actual_reset_box - - subroutine lammps_actual_gather_atoms (ptr, name, type, count, data) & - bind (C, name='lammps_gather_atoms') - import :: C_ptr, C_int, C_char - type (C_ptr), value :: ptr, data - character (kind=C_char), dimension(*) :: name - integer (C_int), value :: type, count - end subroutine lammps_actual_gather_atoms - - subroutine lammps_actual_gather_atoms_concat (ptr, name, type, count, & - data) bind (C, name='lammps_gather_atoms_concat') - import :: C_ptr, C_int, C_char - type (C_ptr), value :: ptr, data - character (kind=C_char), dimension(*) :: name - integer (C_int), value :: type, count - end subroutine lammps_actual_gather_atoms_concat - - subroutine lammps_actual_gather_atoms_subset (ptr, name, type, count, & - ndata, ids, data) bind (C, name='lammps_gather_atoms_subset') - import :: C_ptr, C_int, C_char - type (C_ptr), value :: ptr, data - character (kind=C_char), dimension(*) :: name - integer (C_int), value :: type, count, ndata - integer (C_int) :: ids(:) - end subroutine lammps_actual_gather_atoms_subset - - subroutine lammps_actual_scatter_atoms (ptr, name, type, count, data) & - bind (C, name='lammps_scatter_atoms') - import :: C_ptr, C_int, C_char - type (C_ptr), value :: ptr, data - character (kind=C_char), dimension(*) :: name - integer (C_int), value :: type, count - end subroutine lammps_actual_scatter_atoms - - subroutine lammps_actual_scatter_atoms_subset (ptr, name, type, count, & - ndata, ids, data) bind (C, name='lammps_scatter_atoms_subset') - import :: C_ptr, C_int, C_char - type (C_ptr), value :: ptr, data - character (kind=C_char), dimension(*) :: name - integer (C_int), value :: type, count, ndata - integer (C_int), dimension(*) :: ids - end subroutine lammps_actual_scatter_atoms_subset - - function lammps_actual_config_has_package (package_name) & - result (has_it) bind (C, name='lammps_config_has_package') - import :: C_char, C_int - character (len=1, kind=C_char), dimension(*) :: package_name - integer (C_int) :: has_it - end function lammps_actual_config_has_package - - function lammps_config_package_count () result (count) & - bind (C, name='lammps_config_package_count') - import :: C_int - integer (C_int) :: count - end function lammps_config_package_count - - function lammps_actual_config_package_name (index, buffer, max_size) & - result (num) bind (C, name='lammps_config_package_name') - import :: C_int, C_char - integer (C_int), value :: index, max_size - character (len=1, kind=C_char), dimension(*) :: buffer - integer (C_int) :: num - end function lammps_actual_config_package_name - - function lammps_actual_config_has_gzip_support () result (C_has_it) & - bind (C, name='lammps_config_has_gzip_support') - import :: C_int - integer (C_int) :: C_has_it - end function lammps_actual_config_has_gzip_support - - function lammps_actual_config_has_png_support () result (C_has_it) & - bind (C, name='lammps_config_has_png_support') - import :: C_int - integer (C_int) :: C_has_it - end function lammps_actual_config_has_png_support - - function lammps_actual_config_has_jpeg_support () result (C_has_it) & - bind (C, name='lammps_config_has_jpeg_support') - import :: C_int - integer (C_int) :: C_has_it - end function lammps_actual_config_has_jpeg_support - - function lammps_actual_config_has_ffmpeg_support () result (C_has_it) & - bind (C, name='lammps_config_has_ffmpeg_support') - import :: C_int - integer (C_int) :: C_has_it - end function lammps_actual_config_has_ffmpeg_support - - function lammps_actual_config_has_exceptions () result (C_has_it) & - bind (C, name='lammps_config_has_exceptions') - import :: C_int - integer (C_int) :: C_has_it - end function lammps_actual_config_has_exceptions - - function lammps_actual_find_pair_neighlist (ptr, style, exact, nsub, & - request) result (C_neighlist) & - bind (C, name='lammps_find_pair_neighlist') - import :: C_ptr, C_int, C_char - integer (C_int) :: C_neighlist - type (C_ptr), value :: ptr - character (len=1, kind=C_char), dimension(*) :: style - integer (C_int), value :: exact, nsub, request - end function lammps_actual_find_pair_neighlist - - function lammps_actual_find_fix_neighlist (ptr, id, request) & - result (C_neighlist) bind (C, name='lammps_find_fix_neighlist') - import :: C_ptr, C_int, C_char - integer (C_int) :: C_neighlist - type (C_ptr), value :: ptr - character (len=1, kind=C_char), dimension(*) :: id - integer (C_int), value :: request - end function lammps_actual_find_fix_neighlist - - function lammps_actual_find_compute_neighlist (ptr, id, request) & - result (C_neighlist) bind (C, name='lammps_find_compute_neighlist') - import :: C_ptr, C_int, C_char - integer (C_int) :: C_neighlist - type (C_ptr), value :: ptr - character (len=1, kind=C_char), dimension(*) :: id - integer (C_int), value :: request - end function lammps_actual_find_compute_neighlist - - function lammps_actual_neighlist_num_elements (ptr, idx) & - result (nelements) bind (C, name='lammps_neighlist_num_elements') - import :: C_ptr, C_int - integer (C_int) :: nelements - type (C_ptr), value :: ptr - integer (C_int), value :: idx - end function lammps_actual_neighlist_num_elements - - subroutine lammps_actual_neighlist_element_neighbors (ptr, idx, & - element, iatom, numneigh, neighbors) & - bind (C, name='lammps_neighlist_element_neighbors') - import :: C_ptr, C_int - type (C_ptr), value :: ptr - integer (C_int), value :: idx, element - integer (C_int) :: iatom, numneigh - type (C_ptr) :: neighbors - end subroutine lammps_actual_neighlist_element_neighbors - - subroutine lammps_actual_create_atoms (ptr, n, id, type, x, v, image, & - shrinkexceed) bind (C, name='lammps_create_atoms') - import :: C_ptr, C_int64_t, C_double, C_int - type (C_ptr), value :: ptr - integer (C_int), value :: n - integer (C_tagint) :: id - integer (C_int) :: type - real (C_double), dimension(*) :: x, v - integer (C_imageint), dimension(*) :: image - integer (C_int), value :: shrinkexceed - end subroutine lammps_actual_create_atoms - -#ifdef LAMMPS_EXCEPTIONS - - function lammps_actual_has_error (ptr) result (C_has_it) & - bind (C, name='lammps_has_error') - import :: C_int, C_ptr - type (C_ptr), value :: ptr - integer (C_int) :: C_has_it - end function lammps_actual_has_error - - function lammps_actual_get_last_error_message (ptr, buffer, & - buffer_size) result (error_type) & - bind (C, name='lammps_get_last_error_message') - import :: C_ptr, C_char, C_int - type (C_ptr), value :: ptr - integer (C_int), value :: buffer_size - character (len=1, kind=C_char), dimension(*) :: buffer - integer (C_int) :: error_type - end function lammps_actual_get_last_error_message - -#endif - - end interface - - ! Generic functions for the wrappers below {{{1 - - interface lammps_extract_global - module procedure lammps_extract_global_i, & - lammps_extract_global_dp - end interface lammps_extract_global - - interface lammps_extract_atom - module procedure lammps_extract_atom_ia, & - lammps_extract_atom_dpa, & - lammps_extract_atom_dp2a - end interface lammps_extract_atom - - interface lammps_extract_compute - module procedure lammps_extract_compute_dp, & - lammps_extract_compute_dpa, & - lammps_extract_compute_dp2a - end interface lammps_extract_compute - - interface lammps_extract_fix - module procedure lammps_extract_fix_dp, & - lammps_extract_fix_dpa, & - lammps_extract_fix_dp2a - end interface lammps_extract_fix - - interface lammps_extract_variable - module procedure lammps_extract_variable_dp, & - lammps_extract_variable_dpa - end interface lammps_extract_variable - - interface lammps_gather_atoms - module procedure lammps_gather_atoms_ia, lammps_gather_atoms_dpa - end interface lammps_gather_atoms - - interface lammps_gather_atoms_concat - module procedure lammps_gather_atoms_concat_ia, & - lammps_gather_atoms_concat_dpa - end interface lammps_gather_atoms_concat - - interface lammps_gather_atoms_subset - module procedure lammps_gather_atoms_subset_ia, & - lammps_gather_atoms_subset_dpa - end interface lammps_gather_atoms_subset - - interface lammps_scatter_atoms - module procedure lammps_scatter_atoms_ia, lammps_scatter_atoms_dpa - end interface lammps_scatter_atoms - - interface lammps_scatter_atoms_subset - module procedure lammps_scatter_atoms_subset_ia, & - lammps_scatter_atoms_subset_dpa - end interface lammps_scatter_atoms_subset - -contains !! Wrapper functions local to this module {{{1 - - subroutine lammps_open (command_line, communicator, ptr) - character (len=*), intent(in) :: command_line - integer, intent(in) :: communicator - type (C_ptr) :: ptr - integer (C_int) :: argc - type (C_ptr), dimension(:), allocatable :: argv - character (kind=C_char), dimension(len_trim(command_line)+1), target :: & - c_command_line - c_command_line = string2Cstring (command_line) - call Cstring2argcargv (c_command_line, argc, argv) - call lammps_open_wrapper (argc, argv, communicator, ptr) - deallocate (argv) - end subroutine lammps_open - -!----------------------------------------------------------------------------- - - subroutine lammps_open_no_mpi (command_line, ptr) - character (len=*), intent(in) :: command_line - type (C_ptr) :: ptr - integer (C_int) :: argc - type (C_ptr), dimension(:), allocatable :: argv - character (kind=C_char), dimension(len_trim(command_line)+1), target :: & - c_command_line - c_command_line = string2Cstring (command_line) - call Cstring2argcargv (c_command_line, argc, argv) - call lammps_actual_open_no_mpi (argc, argv, ptr) - deallocate (argv) - end subroutine lammps_open_no_mpi - -!----------------------------------------------------------------------------- - - subroutine lammps_file (ptr, str) - type (C_ptr) :: ptr - character (len=*) :: str - character (kind=C_char), dimension(len_trim(str)+1) :: Cstr - Cstr = string2Cstring (str) - call lammps_actual_file (ptr, Cstr) - end subroutine lammps_file - -!----------------------------------------------------------------------------- - - subroutine lammps_command (ptr, str) - type (C_ptr) :: ptr - character (len=*) :: str - character (kind=C_char), dimension(len_trim(str)+1) :: Cstr - type (C_ptr) :: dummy - Cstr = string2Cstring (str) - dummy = lammps_actual_command (ptr, Cstr) - end subroutine lammps_command - -!----------------------------------------------------------------------------- - - subroutine lammps_commands_list (ptr, cmds) - type (C_ptr), intent(in) :: ptr - character (len=*), dimension(:) :: cmds - integer (C_int) :: ncmd -! character (kind=C_char,len=1), dimension(size(cmds)) :: C_cmds - type (C_ptr), dimension(:), allocatable :: C_cmds - character (len=1, kind=C_char), allocatable, target :: C_strings(:,:) - integer :: i, max_len - ncmd = size(cmds) - allocate (C_cmds(ncmd)) - max_len = 0 - do i=1, size(cmds) - if ( len(cmds(i)) > max_len ) max_len = len(cmds(i)) - end do - allocate (C_strings(max_len + 1, ncmd)) - do i=1, size(cmds) - C_strings(:,i) = string2Cstring(cmds(i)) - C_cmds(i) = C_loc(C_strings(1,i)) - end do - call lammps_actual_commands_list (ptr, ncmd, C_cmds) - deallocate (C_strings) - deallocate (C_cmds) - end subroutine lammps_commands_list - -!----------------------------------------------------------------------------- - - subroutine lammps_commands_string (ptr, str) - type (C_ptr), intent(in) :: ptr - character (len=*), intent(in) :: str - character (kind=C_char), dimension(len_trim(str)+1) :: C_str - C_str = string2Cstring (str) - call lammps_actual_commands_string (ptr, C_str) - end subroutine lammps_commands_string - -!----------------------------------------------------------------------------- - - function lammps_extract_setting (ptr, name) result (setting) - integer :: setting - type (C_ptr), intent(in) :: ptr - character (len=*), intent(in) :: name - character (kind=C_char), dimension(len_trim(name)+1) :: C_name - C_name = string2Cstring (name) - setting = lammps_actual_extract_setting (ptr, C_name) - end function lammps_extract_setting - -!----------------------------------------------------------------------------- - -! lammps_extract_global {{{2 - function lammps_extract_global_Cptr (ptr, name) result (global) - type (C_ptr) :: global - type (C_ptr), intent(in) :: ptr - character (len=*), intent(in) :: name - character (kind=C_char), dimension(len_trim(name)+1) :: Cname - Cname = string2Cstring (name) - global = lammps_actual_extract_global (ptr, Cname) - end function lammps_extract_global_Cptr - subroutine lammps_extract_global_i (global, ptr, name) - integer (C_int), pointer, intent(out) :: global - type (C_ptr), intent(in) :: ptr - character (len=*), intent(in) :: name - type (C_ptr) :: Cptr - Cptr = lammps_extract_global_Cptr (ptr, name) - call C_F_pointer (Cptr, global) - end subroutine lammps_extract_global_i - subroutine lammps_extract_global_dp (global, ptr, name) - real (C_double), pointer, intent(out) :: global - type (C_ptr), intent(in) :: ptr - character (len=*), intent(in) :: name - type (C_ptr) :: Cptr - Cptr = lammps_extract_global_Cptr (ptr, name) - call C_F_pointer (Cptr, global) - end subroutine lammps_extract_global_dp - -!----------------------------------------------------------------------------- - -! lammps_extract_box {{{2 - subroutine lammps_extract_box (ptr, boxlo, boxhi, xy, yz, xz, & - periodicity, box_change) - type (C_ptr), intent(in) :: ptr - double precision, dimension(3), intent(out) :: boxlo, boxhi - double precision, intent(out) :: xy, yz, xz - logical, intent(out) :: periodicity(3), box_change - integer (kind=C_int) :: C_periodicity(3), C_box_change - real (C_double) :: C_boxlo(3), C_boxhi(3), C_xy, C_yz, C_xz - call lammps_actual_extract_box (ptr, C_boxlo, C_boxhi, C_xy, C_yz, & - C_xz, C_periodicity, C_box_change) - boxlo = C_boxlo - boxhi = C_boxhi - xy = C_xy - yz = C_yz - xz = C_xz - periodicity = (C_periodicity == 1) - box_change = (C_box_change == 1) - end subroutine - -!----------------------------------------------------------------------------- - -! lammps_extract_atom {{{2 - function lammps_extract_atom_Cptr (ptr, name) result (atom) - type (C_ptr) :: atom - type (C_ptr), intent(in) :: ptr - character (len=*), intent(in) :: name - character (kind=C_char), dimension(len_trim(name)+1) :: Cname - Cname = string2Cstring (name) - atom = lammps_actual_extract_atom (ptr, Cname) - end function lammps_extract_atom_Cptr - subroutine lammps_extract_atom_ia (atom, ptr, name) - integer (C_int), dimension(:), pointer, intent(out) :: atom - type (C_ptr), intent(in) :: ptr - character (len=*), intent(in) :: name - type (C_ptr) :: Cptr - integer (C_int), pointer :: nelements - call lammps_extract_global_i (nelements, ptr, 'nlocal') - Cptr = lammps_extract_atom_Cptr (ptr, name) - call C_F_pointer (Cptr, atom, (/nelements/)) - end subroutine lammps_extract_atom_ia - subroutine lammps_extract_atom_dpa (atom, ptr, name) - real (C_double), dimension(:), pointer, intent(out) :: atom - type (C_ptr), intent(in) :: ptr - character (len=*), intent(in) :: name - type (C_ptr) :: Cptr - integer (C_int), pointer :: nlocal - integer :: nelements - real (C_double), dimension(:), pointer :: Fptr - if ( name == 'mass' ) then - nelements = lammps_get_ntypes (ptr) + 1 - else if ( name == 'x' .or. name == 'v' .or. name == 'f' .or. & - name == 'mu' .or. name == 'omega' .or. name == 'torque' .or. & - name == 'angmom' ) then - ! We should not be getting a rank-2 array here! - call lammps_error_all (ptr, FLERR, 'You cannot extract those atom& - & data (' // trim(name) // ') into a rank 1 array.') - return - else - ! Everything else we can get is probably nlocal units long - call lammps_extract_global_i (nlocal, ptr, 'nlocal') - nelements = nlocal - end if - Cptr = lammps_extract_atom_Cptr (ptr, name) - call C_F_pointer (Cptr, Fptr, (/nelements/)) - if ( name == 'mass' ) then - atom(0:) => Fptr - else - atom => Fptr - end if - end subroutine lammps_extract_atom_dpa - subroutine lammps_extract_atom_dp2a (atom, ptr, name) - real (C_double), dimension(:,:), pointer, intent(out) :: atom - type (C_ptr), intent(in) :: ptr - character (len=*), intent(in) :: name - type (C_ptr) :: Cptr - type (C_ptr), pointer, dimension(:) :: Catom - integer (C_int), pointer :: nelements - if ( name /= 'x' .and. name /= 'v' .and. name /= 'f' .and. & - name /= 'mu' .and. name /= 'omega' .and. name /= 'tandque' .and. & - name /= 'angmom' ) then - ! We should not be getting a rank-2 array here! - call lammps_error_all (ptr, FLERR, 'You cannot extract those atom& - & data (' // trim(name) // ') into a rank 2 array.') - return - end if - Cptr = lammps_extract_atom_Cptr (ptr, name) - call lammps_extract_global_i (nelements, ptr, 'nlocal') - ! Catom will now be the array of void* pointers that the void** pointer - ! pointed to. Catom(1) is now the pointer to the first element. - call C_F_pointer (Cptr, Catom, (/nelements/)) - ! Now get the actual array, which has its shape transposed from what we - ! might think of it in C - call C_F_pointer (Catom(1), atom, (/3, nelements/)) - end subroutine lammps_extract_atom_dp2a - -!----------------------------------------------------------------------------- - -! lammps_extract_compute {{{2 - function lammps_extract_compute_Cptr (ptr, id, style, type) result (compute) - type (C_ptr) :: compute - type (C_ptr), intent(in) :: ptr - character (len=*), intent(in) :: id - integer, intent(in) :: style, type - integer (kind=C_int) :: Cstyle, Ctype - character (kind=C_char), dimension(len_trim(id)+1) :: Cid - Cid = string2Cstring (id) - Cstyle = style - Ctype = type - compute = lammps_actual_extract_compute (ptr, Cid, Cstyle, Ctype) - end function lammps_extract_compute_Cptr - subroutine lammps_extract_compute_dp (compute, ptr, id, style, type) - real (C_double), pointer, intent(out) :: compute - type (C_ptr), intent(in) :: ptr - character (len=*), intent(in) :: id - integer, intent(in) :: style, type - type (C_ptr) :: Cptr - ! The only valid values of (style,type) are (0,0) for scalar 'compute' - if ( style /= 0 ) then - call lammps_error_all (ptr, FLERR, 'You cannot pack per-atom/local& - & data into a scalar.') - return - end if - if ( type == 1 ) then - call lammps_error_all (ptr, FLERR, 'You cannot extract a compute& - & vector (rank 1) into a scalar.') - return - else if ( type == 2 ) then - call lammps_error_all (ptr, FLERR, 'You cannot extract a compute& - & array (rank 2) into a scalar.') - return - end if - Cptr = lammps_extract_compute_Cptr (ptr, id, style, type) - call C_F_pointer (Cptr, compute) - end subroutine lammps_extract_compute_dp - subroutine lammps_extract_compute_dpa (compute, ptr, id, style, type) - real (C_double), dimension(:), pointer, intent(out) :: compute - type (C_ptr), intent(in) :: ptr - character (len=*), intent(in) :: id - integer, intent(in) :: style, type - type (C_ptr) :: Cptr - integer :: nelements - ! Check for the correct dimensionality - if ( type == 0 ) then - call lammps_error_all (ptr, FLERR, 'You cannot extract a compute& - & scalar (rank 0) into a rank 1 variable.') - return - else if ( type == 2 ) then - call lammps_error_all (ptr, FLERR, 'You cannot extract a compute& - & array (rank 2) into a rank 1 variable.') - return - end if - nelements = lammps_extract_compute_vectorsize (ptr, id, style) - Cptr = lammps_extract_compute_Cptr (ptr, id, style, type) - call C_F_pointer (Cptr, compute, (/nelements/)) - end subroutine lammps_extract_compute_dpa - subroutine lammps_extract_compute_dp2a (compute, ptr, id, style, type) - real (C_double), dimension(:,:), pointer, intent(out) :: compute - type (C_ptr), intent(in) :: ptr - character (len=*), intent(in) :: id - integer, intent(in) :: style, type - type (C_ptr) :: Cptr - type (C_ptr), pointer, dimension(:) :: Ccompute - integer :: nr, nc - ! Check for the correct dimensionality - if ( type == 0 ) then - call lammps_error_all (ptr, FLERR, 'You cannot extract a compute& - & scalar (rank 0) into a rank 2 variable.') - return - else if ( type == 1 ) then - call lammps_error_all (ptr, FLERR, 'You cannot extract a compute& - & array (rank 1) into a rank 2 variable.') - return - end if - call lammps_extract_compute_arraysize (ptr, id, style, nr, nc) - Cptr = lammps_extract_compute_Cptr (ptr, id, style, type) - call C_F_pointer (Cptr, Ccompute, (/nr/)) - ! Note that the matrix is transposed, from Fortran's perspective - call C_F_pointer (Ccompute(1), compute, (/nc, nr/)) - end subroutine lammps_extract_compute_dp2a - -!----------------------------------------------------------------------------- - -! lammps_extract_fix {{{2 - function lammps_extract_fix_Cptr (ptr, id, style, type, i, j) & - result (fix) - type (C_ptr) :: fix - type (C_ptr), intent(in) :: ptr - character (len=*), intent(in) :: id - integer, intent(in) :: style, type, i, j - character (kind=C_char), dimension(len_trim(id)+1) :: Cid - integer (kind=C_int) :: Cstyle, Ctype, Ci, Cj - Cid = string2Cstring (id) - Cstyle = style - Ctype = type - Ci = i - 1 ! This is for consistency with the values from f_ID[i], - Cj = j - 1 ! which is different from what library.cpp uses! - if ( (type >= 1 .and. Ci < 0) .or. & - (type == 2 .and. (Ci < 0 .or. Cj < 0) ) ) then - call lammps_error_all (ptr, FLERR, 'Index out of range in& - & lammps_extract_fix') - end if - fix = lammps_actual_extract_fix (ptr, Cid, Cstyle, Ctype, Ci, Cj) - end function lammps_extract_fix_Cptr - subroutine lammps_extract_fix_dp (fix, ptr, id, style, type, i, j) - real (C_double), intent(out) :: fix - type (C_ptr), intent(in) :: ptr - character (len=*), intent(in) :: id - integer, intent(in) :: style, type, i, j - type (C_ptr) :: Cptr - real (C_double), pointer :: Fptr - ! Check for the correct dimensionality - if ( style /= 0 ) then - select case (type) - case (0) - call lammps_error_all (ptr, FLERR, 'There is no per-atom or local& - & scalar data available from fixes.') - case (1) - call lammps_error_all (ptr, FLERR, 'You cannot extract a fix''s & - &per-atom/local vector (rank 1) into a scalar.') - case (2) - call lammps_error_all (ptr, FLERR, 'You cannot extract a fix''s & - &per-atom/local array (rank 2) into a scalar.') - case default - call lammps_error_all (ptr, FLERR, 'Invalid extract_fix style/& - &type combination.') - end select - return - end if - Cptr = lammps_extract_fix_Cptr (ptr, id, style, type, i, j) - call C_F_pointer (Cptr, Fptr) - fix = Fptr - nullify (Fptr) - ! Memory is only allocated for "global" fix variables - if ( style == 0 ) call lammps_free (Cptr) - end subroutine lammps_extract_fix_dp - subroutine lammps_extract_fix_dpa (fix, ptr, id, style, type, i, j) - real (C_double), dimension(:), pointer, intent(out) :: fix - type (C_ptr), intent(in) :: ptr - character (len=*), intent(in) :: id - integer, intent(in) :: style, type, i, j - type (C_ptr) :: Cptr - integer :: fix_len - ! Check for the correct dimensionality - if ( style == 0 ) then - call lammps_error_all (ptr, FLERR, 'You can''t extract the& - & whole vector from global fix data') - return - else if ( type == 0 ) then - call lammps_error_all (ptr, FLERR, 'You can''t extract a fix& - & scalar into a rank 1 variable') - return - else if ( type == 2 ) then - call lammps_error_all (ptr, FLERR, 'You cannot extract a fix& - & array into a rank 1 variable.') - return - else if ( type /= 1 ) then - call lammps_error_all (ptr, FLERR, 'Invalid type for fix extraction.') - return - end if - fix_len = lammps_extract_fix_vectorsize (ptr, id, style) - call C_F_pointer (Cptr, fix, (/fix_len/)) - ! Memory is only allocated for "global" fix variables, which we should - ! never get here, so no need to call lammps_free! - end subroutine lammps_extract_fix_dpa - subroutine lammps_extract_fix_dp2a (fix, ptr, id, style, type, i, j) - real (C_double), dimension(:,:), pointer, intent(out) :: fix - type (C_ptr), intent(in) :: ptr - character (len=*), intent(in) :: id - integer, intent(in) :: style, type, i, j - type (C_ptr) :: Cptr - type (C_ptr), pointer, dimension(:) :: Cfix - integer :: nr, nc - ! Check for the correct dimensionality - if ( style == 0 ) then - call lammps_error_all (ptr, FLERR, 'It is not possible to extract the& - & entire array from global fix data.') - return - else if ( type == 0 ) then - call lammps_error_all (ptr, FLERR, 'You cannot extract a fix& - & scalar (rank 0) into a rank 2 variable.') - return - else if ( type == 1 ) then - call lammps_error_all (ptr, FLERR, 'You cannot extract a fix& - & vector (rank 1) into a rank 2 variable.') - return - end if - call lammps_extract_fix_arraysize (ptr, id, style, nr, nc) - ! Extract pointer to first element as Cfix(1) - call C_F_pointer (Cptr, Cfix, (/nr/)) - ! Now extract the array, which is transposed - call C_F_pointer (Cfix(1), fix, (/nc, nr/)) - end subroutine lammps_extract_fix_dp2a - -!----------------------------------------------------------------------------- - -! lammps_extract_variable {{{2 - function lammps_extract_variable_Cptr (ptr, name, group) result (variable) - type (C_ptr) :: ptr, variable - character (len=*) :: name - character (len=*), optional :: group - character (kind=C_char), dimension(len_trim(name)+1) :: Cname - character (kind=C_char), dimension(:), allocatable :: Cgroup - Cname = string2Cstring (name) - if ( present(group) ) then - allocate (Cgroup(len_trim(group)+1)) - Cgroup = string2Cstring (group) - else - allocate (Cgroup(1)) - Cgroup(1) = C_NULL_CHAR - end if - variable = lammps_actual_extract_variable (ptr, Cname, Cgroup) - deallocate (Cgroup) - end function lammps_extract_variable_Cptr - subroutine lammps_extract_variable_dp (variable, ptr, name, group) - real (C_double), intent(out) :: variable - type (C_ptr), intent(in) :: ptr - character (len=*), intent(in) :: name - character (len=*), intent(in), optional :: group - type (C_ptr) :: Cptr - real (C_double), pointer :: Fptr - if ( present(group) ) then - Cptr = lammps_extract_variable_Cptr (ptr, name, group) - else - Cptr = lammps_extract_variable_Cptr (ptr, name) - end if - call C_F_pointer (Cptr, Fptr) - variable = Fptr - nullify (Fptr) - call lammps_free (Cptr) - end subroutine lammps_extract_variable_dp - subroutine lammps_extract_variable_dpa (variable, ptr, name, group) - real (C_double), dimension(:), allocatable, intent(out) :: variable - type (C_ptr), intent(in) :: ptr - character (len=*), intent(in) :: name - character (len=*), intent(in), optional :: group - type (C_ptr) :: Cptr - real (C_double), dimension(:), pointer :: Fptr - integer :: natoms - if ( present(group) ) then - Cptr = lammps_extract_variable_Cptr (ptr, name, group) - else - Cptr = lammps_extract_variable_Cptr (ptr, name) - end if - natoms = lammps_get_natoms (ptr) - allocate (variable(natoms)) - call C_F_pointer (Cptr, Fptr, (/natoms/)) - variable = Fptr - nullify (Fptr) - call lammps_free (Cptr) - end subroutine lammps_extract_variable_dpa - -!-------------------------------------------------------------------------2}}} - - function lammps_get_thermo (ptr, name) result (dval) - double precision :: dval - type (C_ptr), intent(in) :: ptr - character (len=*), intent(in) :: name - character (kind=C_char), dimension(len_trim(name)+1) :: Cname - Cname = string2Cstring (name) - dval = lammps_actual_get_thermo (ptr, Cname) - end function lammps_get_thermo - - subroutine lammps_set_variable (ptr, name, str, err) - type (C_ptr), intent(in) :: ptr - character (len=*), intent(in) :: name, str - integer, optional :: err - integer (C_int) :: Cerr - character (kind=C_char) :: Cname(len_trim(name)+1), Cstr(len_trim(str)+1) - Cname = string2Cstring (name) - Cstr = string2Cstring (str) - Cerr = lammps_actual_set_variable (ptr, Cname, Cstr) - if ( present(err) ) err = Cerr - end subroutine lammps_set_variable - - subroutine lammps_reset_box (ptr, boxlo, boxhi, xy, yz, xz) - type (C_ptr), intent(in) :: ptr - double precision, dimension(3), intent(in) :: boxlo, boxhi - double precision, intent(in) :: xy, yz, xz - real (C_double) :: C_boxlo(3), C_boxhi(3), C_xy, C_yz, C_xz - C_boxlo = boxlo - C_boxhi = boxhi - C_xy = xy - C_xz = xz - C_yz = yz - call lammps_actual_reset_box (ptr, C_boxlo, C_boxhi, C_xy, C_yz, C_xz) - end subroutine lammps_reset_box - -! lammps_gather_atoms {{{2 - subroutine lammps_gather_atoms_ia (ptr, name, count, data) - type (C_ptr), intent(in) :: ptr - character (len=*), intent(in) :: name - integer, intent(in) :: count - integer, dimension(:), allocatable, intent(out) :: data - type (C_ptr) :: Cdata - integer (C_int), dimension(:), pointer :: Fdata - integer (C_int) :: natoms - character (kind=C_char), dimension(len_trim(name)+1) :: Cname - integer (C_int), parameter :: Ctype = 0_C_int - integer (C_int) :: Ccount - natoms = lammps_get_natoms (ptr) - Cname = string2Cstring (name) - if ( count /= 1 .and. count /= 3 ) then - call lammps_error_all (ptr, FLERR, 'lammps_gather_atoms requires& - & count to be either 1 or 3') - else - Ccount = count - end if - allocate ( Fdata(count*natoms) ) - allocate ( data(count*natoms) ) - Cdata = C_loc (Fdata(1)) - call lammps_actual_gather_atoms (ptr, Cname, Ctype, Ccount, Cdata) - data = Fdata - deallocate (Fdata) - end subroutine lammps_gather_atoms_ia - subroutine lammps_gather_atoms_dpa (ptr, name, count, data) - type (C_ptr), intent(in) :: ptr - character (len=*), intent(in) :: name - integer, intent(in) :: count - double precision, dimension(:), allocatable, intent(out) :: data - type (C_ptr) :: Cdata - real (C_double), dimension(:), pointer :: Fdata - integer (C_int) :: natoms - character (kind=C_char), dimension(len_trim(name)+1) :: Cname - integer (C_int), parameter :: Ctype = 1_C_int - integer (C_int) :: Ccount - natoms = lammps_get_natoms (ptr) - Cname = string2Cstring (name) - if ( count /= 1 .and. count /= 3 ) then - call lammps_error_all (ptr, FLERR, 'lammps_gather_atoms requires& - & count to be either 1 or 3') - else - Ccount = count - end if - allocate ( Fdata(count*natoms) ) - allocate ( data(count*natoms) ) - Cdata = C_loc (Fdata(1)) - call lammps_actual_gather_atoms (ptr, Cname, Ctype, Ccount, Cdata) - data = Fdata(:) - deallocate (Fdata) - end subroutine lammps_gather_atoms_dpa - -! lammps_gather_atoms_concat {{{2 - subroutine lammps_gather_atoms_concat_ia (ptr, name, count, data) - type (C_ptr), intent(in) :: ptr - character (len=*), intent(in) :: name - integer, intent(in) :: count - integer, dimension(:), allocatable, intent(out) :: data - type (C_ptr) :: Cdata - integer (C_int), dimension(:), pointer :: Fdata - integer (C_int) :: natoms - character (kind=C_char), dimension(len_trim(name)+1) :: Cname - integer (C_int), parameter :: Ctype = 0_C_int - integer (C_int) :: Ccount - natoms = lammps_get_natoms (ptr) - Cname = string2Cstring (name) - if ( count /= 1 .and. count /= 3 ) then - call lammps_error_all (ptr, FLERR, 'lammps_gather_atoms requires& - & count to be either 1 or 3') - else - Ccount = count - end if - allocate ( Fdata(count*natoms) ) - allocate ( data(count*natoms) ) - Cdata = C_loc (Fdata(1)) - call lammps_actual_gather_atoms_concat (ptr, Cname, Ctype, Ccount, Cdata) - data = Fdata - deallocate (Fdata) - end subroutine lammps_gather_atoms_concat_ia - subroutine lammps_gather_atoms_concat_dpa (ptr, name, count, data) - type (C_ptr), intent(in) :: ptr - character (len=*), intent(in) :: name - integer, intent(in) :: count - double precision, dimension(:), allocatable, intent(out) :: data - type (C_ptr) :: Cdata - real (C_double), dimension(:), pointer :: Fdata - integer (C_int) :: natoms - character (kind=C_char), dimension(len_trim(name)+1) :: Cname - integer (C_int), parameter :: Ctype = 1_C_int - integer (C_int) :: Ccount - natoms = lammps_get_natoms (ptr) - Cname = string2Cstring (name) - if ( count /= 1 .and. count /= 3 ) then - call lammps_error_all (ptr, FLERR, 'lammps_gather_atoms_concat& - & requires count to be either 1 or 3') - else - Ccount = count - end if - allocate ( Fdata(count*natoms) ) - allocate ( data(count*natoms) ) - Cdata = C_loc (Fdata(1)) - call lammps_actual_gather_atoms_concat (ptr, Cname, Ctype, Ccount, Cdata) - data = Fdata(:) - deallocate (Fdata) - end subroutine lammps_gather_atoms_concat_dpa - -!----------------------------------------------------------------------------- - -! lammps_gather_atoms_subset {{{2 - subroutine lammps_gather_atoms_subset_ia (ptr,name,count,ids,data) - type (C_ptr), intent(in) :: ptr - character (len=*), intent(in) :: name - integer, intent(in) :: count, ids(:) - integer, dimension(:), allocatable, intent(out) :: data - type (C_ptr) :: Cdata - integer (C_int), dimension(:), pointer :: Fdata - integer (C_int) :: ndata, Cids(size(ids)) - character (kind=C_char), dimension(len_trim(name)+1) :: Cname - integer (C_int), parameter :: Ctype = 0_C_int - integer (C_int) :: Ccount - ndata = size(ids) - Cname = string2Cstring (name) - Cids = ids - if ( count /= 1 .and. count /= 3 ) then - call lammps_error_all (ptr, FLERR, 'lammps_gather_atoms_subset& - & requires count to be either 1 or 3') - else - Ccount = count - end if - allocate ( Fdata(count*ndata) ) - allocate ( data(count*ndata) ) - Cdata = C_loc (Fdata(1)) - call lammps_actual_gather_atoms_subset (ptr, Cname, Ctype, Ccount, & - ndata, Cids, Cdata) - data = Fdata - deallocate (Fdata) - end subroutine lammps_gather_atoms_subset_ia - subroutine lammps_gather_atoms_subset_dpa (ptr,name,count,ids,data) - type (C_ptr), intent(in) :: ptr - character (len=*), intent(in) :: name - integer, intent(in) :: count, ids(:) - double precision, dimension(:), allocatable, intent(out) :: data - type (C_ptr) :: Cdata - real (C_double), dimension(:), pointer :: Fdata - integer (C_int) :: ndata, Cids(size(ids)) - character (kind=C_char), dimension(len_trim(name)+1) :: Cname - integer (C_int), parameter :: Ctype = 1_C_int - integer (C_int) :: Ccount - ndata = size(ids) - Cname = string2Cstring (name) - Cids = ids - if ( count /= 1 .and. count /= 3 ) then - call lammps_error_all (ptr, FLERR, 'lammps_gather_atoms requires& - & count to be either 1 or 3') - else - Ccount = count - end if - allocate ( Fdata(count*ndata) ) - allocate ( data(count*ndata) ) - Cdata = C_loc (Fdata(1)) - call lammps_actual_gather_atoms_subset (ptr, Cname, Ctype, Ccount, & - ndata, Cids, Cdata) - data = Fdata - deallocate (Fdata) - end subroutine lammps_gather_atoms_subset_dpa - -!----------------------------------------------------------------------------- - -! lammps_scatter_atoms {{{2 - subroutine lammps_scatter_atoms_ia (ptr, name, data) - type (C_ptr), intent(in) :: ptr - character (len=*), intent(in) :: name - integer, dimension(:), intent(in) :: data - integer (kind=C_int) :: natoms, Ccount - integer (kind=C_int), parameter :: Ctype = 0_C_int - character (kind=C_char), dimension(len_trim(name)+1) :: Cname - integer (C_int), dimension(size(data)), target :: Fdata - type (C_ptr) :: Cdata - natoms = lammps_get_natoms (ptr) - Cname = string2Cstring (name) - Ccount = size(data) / natoms - if ( Ccount /= 1 .and. Ccount /= 3 ) & - call lammps_error_all (ptr, FLERR, 'lammps_scatter_atoms requires& - & count to be either 1 or 3') - Fdata = data - Cdata = C_loc (Fdata(1)) - call lammps_actual_scatter_atoms (ptr, Cname, Ctype, Ccount, Cdata) - end subroutine lammps_scatter_atoms_ia - subroutine lammps_scatter_atoms_dpa (ptr, name, data) - type (C_ptr), intent(in) :: ptr - character (len=*), intent(in) :: name - double precision, dimension(:), intent(in) :: data - integer (kind=C_int) :: natoms, Ccount - integer (kind=C_int), parameter :: Ctype = 1_C_int - character (kind=C_char), dimension(len_trim(name)+1) :: Cname - real (C_double), dimension(size(data)), target :: Fdata - type (C_ptr) :: Cdata - natoms = lammps_get_natoms (ptr) - Cname = string2Cstring (name) - Ccount = size(data) / natoms - if ( Ccount /= 1 .and. Ccount /= 3 ) & - call lammps_error_all (ptr, FLERR, 'lammps_scatter_atoms requires& - & count to be either 1 or 3') - Fdata = data - Cdata = C_loc (Fdata(1)) - call lammps_actual_scatter_atoms (ptr, Cname, Ctype, Ccount, Cdata) - end subroutine lammps_scatter_atoms_dpa - -!----------------------------------------------------------------------------- - -! lammps_scatter_atoms_subset {{{2 - subroutine lammps_scatter_atoms_subset_ia (ptr, name, ids, data) - type (C_ptr), intent(in) :: ptr - character (len=*), intent(in) :: name - integer, dimension(:), intent(in) :: data, ids - integer (kind=C_int) :: ndata, Ccount, Cids(size(ids)) - integer (kind=C_int), parameter :: Ctype = 0_C_int - character (kind=C_char), dimension(len_trim(name)+1) :: Cname - integer (C_int), dimension(size(data)), target :: Fdata - type (C_ptr) :: Cdata - ndata = size(ids) - Cname = string2Cstring (name) - Ccount = size(data) / ndata - if ( Ccount /= 1 .and. Ccount /= 3 ) & - call lammps_error_all (ptr, FLERR, 'lammps_gather_atoms requires& - & count to be either 1 or 3') - Fdata = data - Cdata = C_loc (Fdata(1)) - Cids = ids - call lammps_actual_scatter_atoms_subset (ptr, Cname, Ctype, Ccount, & - ndata, Cids, Cdata) - end subroutine lammps_scatter_atoms_subset_ia - subroutine lammps_scatter_atoms_subset_dpa (ptr, name, ids, data) - type (C_ptr), intent(in) :: ptr - character (len=*), intent(in) :: name - double precision, dimension(:), intent(in) :: data, ids - integer (kind=C_int) :: ndata, Ccount, Cids(size(ids)) - integer (kind=C_int), parameter :: Ctype = 1_C_int - character (kind=C_char), dimension(len_trim(name)+1) :: Cname - real (C_double), dimension(size(data)), target :: Fdata - type (C_ptr) :: Cdata - ndata = size(ids) - Cname = string2Cstring (name) - Ccount = size(data) / ndata - if ( Ccount /= 1 .and. Ccount /= 3 ) & - call lammps_error_all (ptr, FLERR, 'lammps_scatter_atoms requires& - & count to be either 1 or 3') - Fdata = data - Cdata = C_loc (Fdata(1)) - call lammps_actual_scatter_atoms_subset (ptr, Cname, Ctype, Ccount, & - ndata, Cids, Cdata) - end subroutine lammps_scatter_atoms_subset_dpa - -!----------------------------------------------------------------------------- - - subroutine lammps_create_atoms (ptr, id, type, x, v, image, shrinkexceed) - type (C_ptr), intent(in) :: ptr - integer (kind=C_tagint), dimension(:), optional :: id - integer, dimension(:) :: type - double precision, dimension(:,:) :: x - double precision, dimension(:,:), optional :: v - integer (kind=C_imageint), dimension(:), target, optional :: image - logical, optional :: shrinkexceed - real (C_double), dimension(size(x)) :: C_x, C_v - integer (C_int) :: C_shrinkexceed, n - integer (kind=C_tagint) :: C_id - integer (C_imageint), dimension(size(x)/3) :: C_image - integer (C_int) :: C_type - if (shrinkexceed) then - C_shrinkexceed = 1_C_int - else - C_shrinkexceed = 0_C_int - end if - C_x = reshape(transpose(x), shape(C_x)) - if ( present(v) ) then - C_v = reshape(transpose(v), shape(C_v)) - else - C_v = 0.0_C_double - end if - if ( present(image) ) then - C_image = image - else - C_image = int(0,kind=C_imageint) - end if - n = size(type) - call lammps_actual_create_atoms (ptr, n, C_id, C_type, C_x, C_v, & - C_image, C_shrinkexceed) - end subroutine lammps_create_atoms - -!----------------------------------------------------------------------------- - - function lammps_config_has_package (package_name) result (has_it) - character (len=*), intent(in) :: package_name - character (len=1, kind=C_char), dimension(len_trim(package_name)+1) :: & - C_package_name - logical :: has_it - integer (C_int) :: C_has_it - C_package_name = string2Cstring (package_name) - C_has_it = lammps_actual_config_has_package (C_package_name) - has_it = (C_has_it == 1) - end function lammps_config_has_package - -!----------------------------------------------------------------------------- - - function lammps_config_package_name (index, buffer) result (installed) - character (len=*), intent(inout) :: buffer - integer, intent(in) :: index - logical :: installed - integer (kind=C_int) :: C_installed, C_index, max_size - character (len=1, kind=C_char), dimension(len_trim(buffer)+1) :: C_buffer - C_buffer = string2Cstring (buffer) - max_size = len(buffer) - C_index = index - C_installed = lammps_actual_config_package_name (C_index, C_buffer, & - max_size) - installed = (C_installed == 1_C_int) - buffer = Cstring2string (C_buffer) - end function lammps_config_package_name - -!----------------------------------------------------------------------------- - - logical function lammps_config_has_gzip_support () result (has_it) - integer (C_int) :: C_has_it - C_has_it = lammps_actual_config_has_gzip_support () - has_it = (C_has_it == 1_C_int) - end function lammps_config_has_gzip_support - -!----------------------------------------------------------------------------- - - logical function lammps_config_has_png_support () result (has_it) - integer (C_int) :: C_has_it - C_has_it = lammps_actual_config_has_png_support () - has_it = (C_has_it == 1_C_int) - end function lammps_config_has_png_support - -!----------------------------------------------------------------------------- - - logical function lammps_config_has_jpeg_support () result (has_it) - integer (C_int) :: C_has_it - C_has_it = lammps_actual_config_has_jpeg_support () - has_it = (C_has_it == 1_C_int) - end function lammps_config_has_jpeg_support - -!----------------------------------------------------------------------------- - - logical function lammps_config_has_ffmpeg_support () result (has_it) - integer (C_int) :: C_has_it - C_has_it = lammps_actual_config_has_ffmpeg_support () - has_it = (C_has_it == 1_C_int) - end function lammps_config_has_ffmpeg_support - -!----------------------------------------------------------------------------- - - logical function lammps_config_has_exceptions () result (has_it) - integer (C_int) :: C_has_it - C_has_it = lammps_actual_config_has_exceptions () - has_it = (C_has_it == 1_C_int) - end function lammps_config_has_exceptions - -!----------------------------------------------------------------------------- - - function lammps_find_pair_neighlist (ptr, style, exact, nsub, request) & - result (neighlist) - integer :: neighlist - type (C_ptr), intent(in) :: ptr - character (len=*), intent(in) :: style - logical, intent(in) :: exact - integer, intent(in) :: nsub, request - integer (C_int) :: C_exact, C_nsub, C_neighlist, C_request - character (kind=C_char), dimension(len_trim(style)+1) :: C_style - if (exact) then - C_exact = 1_C_int - else - C_exact = 0_C_int - end if - C_nsub = nsub - C_request = request - C_style = string2Cstring (style) - C_neighlist = lammps_actual_find_pair_neighlist (ptr, C_style, C_exact, & - C_nsub, C_request) - neighlist = C_neighlist - end function lammps_find_pair_neighlist - -!----------------------------------------------------------------------------- - - function lammps_find_fix_neighlist (ptr, id, request) result (neighlist) - integer :: neighlist - type (C_ptr), intent(in) :: ptr - character (len=*), intent(in) :: id - integer, intent(in) :: request - integer (C_int) :: C_request, C_neighlist - character (kind=C_char), dimension(len_trim(id)+1) :: C_id - C_id = string2Cstring(id) - C_request = request - C_neighlist = lammps_actual_find_fix_neighlist (ptr, C_id, C_request) - neighlist = C_neighlist - end function lammps_find_fix_neighlist - -!----------------------------------------------------------------------------- - - function lammps_find_compute_neighlist (ptr, id, request) result (neighlist) - integer :: neighlist - type (C_ptr), intent(in) :: ptr - character (len=*), intent(in) :: id - integer, intent(in) :: request - integer (C_int) :: C_request - character (kind=C_char), dimension(len_trim(id)+1) :: C_id - C_id = string2Cstring(id) - C_request = request - neighlist = lammps_actual_find_compute_neighlist (ptr, C_id, C_request) - end function lammps_find_compute_neighlist - -!----------------------------------------------------------------------------- - - function lammps_neighlist_num_elements (ptr, idx) result (nelements) - integer :: nelements - type (C_ptr), intent(in) :: ptr - integer, intent(in) :: idx - integer (C_int) :: C_idx - C_idx = idx - nelements = lammps_actual_neighlist_num_elements (ptr, C_idx) - end function lammps_neighlist_num_elements - -!----------------------------------------------------------------------------- - - subroutine lammps_neighlist_element_neighbors (ptr, idx, element, iatom, & - numneigh, neighbors) - type (C_ptr), intent(in) :: ptr - integer, intent(in) :: idx, element - integer, intent(out) :: iatom, numneigh - integer (C_int), dimension(:), pointer, intent(out) :: neighbors - integer (C_int) :: C_idx, C_element, C_iatom, C_numneigh - type (C_ptr) :: C_neighbors - C_idx = idx - C_element = element - call lammps_actual_neighlist_element_neighbors (ptr, C_idx, C_element, & - C_iatom, C_numneigh, C_neighbors) - iatom = C_iatom - numneigh = C_numneigh - call C_F_pointer (C_neighbors, neighbors, [numneigh]) - end subroutine lammps_neighlist_element_neighbors - -!----------------------------------------------------------------------------- - -! These are only defined if -DLAMMPS_EXCEPTIONS was issued -#ifdef LAMMPS_EXCEPTIONS - logical function lammps_has_error (ptr) result (has_it) - type (C_ptr), intent(in) :: ptr - integer (kind=C_int) :: C_has_it - C_has_it = lammps_actual_has_error (ptr) - has_it = (C_has_it == 1_C_int) - end function lammps_has_error - -!----------------------------------------------------------------------------- - - function lammps_get_last_error_message (ptr, buffer) result (error_type) - integer (C_int) :: error_type - type (C_ptr), intent(in) :: ptr - character (len=*), intent(out) :: buffer - integer (C_int) :: buffer_size - character (len=1, kind=C_char), dimension(len(buffer)+1) :: C_buffer - buffer_size = len(buffer) - error_type = lammps_actual_get_last_error_message (ptr, C_buffer, & - buffer_size) - buffer = Cstring2string (C_buffer) - end function lammps_get_last_error_message -#endif -!-------------------------------------------------------------------------2}}} - - function lammps_extract_compute_vectorsize (ptr, id, style) & - result (vectorsize) - integer :: vectorsize - type (C_ptr), intent(in) :: ptr - character (len=*), intent(in) :: id - integer, intent(in) :: style - integer (C_int) :: Cvectorsize, Cstyle - character (kind=C_char), dimension(len_trim(id)+1) :: Cid - Cid = string2Cstring (id) - Cstyle = int(style, C_int) - Cvectorsize = lammps_actual_extract_compute_vectorsize (ptr, Cid, Cstyle) - vectorsize = int(Cvectorsize, kind(vectorsize)) - end function lammps_extract_compute_vectorsize - -!----------------------------------------------------------------------------- - - function lammps_extract_fix_vectorsize (ptr, id, style) & - result (vectorsize) - integer :: vectorsize - type (C_ptr), intent(in) :: ptr - character (len=*), intent(in) :: id - integer, intent(in) :: style - integer (C_int) :: Cvectorsize, Cstyle - character (kind=C_char), dimension(len_trim(id)+1) :: Cid - Cid = string2Cstring (id) - Cstyle = int(style, C_int) - Cvectorsize = lammps_actual_extract_fix_vectorsize (ptr, Cid, Cstyle) - vectorsize = int(Cvectorsize, kind(vectorsize)) - end function lammps_extract_fix_vectorsize - -!----------------------------------------------------------------------------- - - subroutine lammps_extract_compute_arraysize (ptr, id, style, nrows, ncols) - type (C_ptr), intent(in) :: ptr - character (len=*), intent(in) :: id - integer, intent(in) :: style - integer, intent(out) :: nrows, ncols - integer (C_int) :: Cstyle, Cnrows, Cncols - character (kind=C_char), dimension(len_trim(id)+1) :: Cid - Cid = string2Cstring (id) - Cstyle = int (style, C_int) - call lammps_actual_extract_compute_arraysize (ptr, Cid, Cstyle, & - Cnrows, Cncols) - nrows = int (Cnrows, kind(nrows)) - ncols = int (Cncols, kind(ncols)) - end subroutine lammps_extract_compute_arraysize - -!----------------------------------------------------------------------------- - - subroutine lammps_extract_fix_arraysize (ptr, id, style, nrows, ncols) - type (C_ptr), intent(in) :: ptr - character (len=*), intent(in) :: id - integer, intent(in) :: style - integer, intent(out) :: nrows, ncols - integer (C_int) :: Cstyle, Cnrows, Cncols - character (kind=C_char), dimension(len_trim(id)+1) :: Cid - Cid = string2Cstring (id) - Cstyle = int (style, kind(Cstyle)) - call lammps_actual_extract_fix_arraysize (ptr, Cid, Cstyle, & - Cnrows, Cncols) - nrows = int (Cnrows, kind(nrows)) - ncols = int (Cncols, kind(ncols)) - end subroutine lammps_extract_fix_arraysize - -!----------------------------------------------------------------------------- - - subroutine lammps_error_all (ptr, file, line, str) - type (C_ptr), intent(in) :: ptr - character (len=*), intent(in) :: file, str - integer, intent(in) :: line - character (kind=C_char), dimension(len_trim(file)+1) :: Cfile - character (kind=C_char), dimension(len_trim(str)+1) :: Cstr - integer (C_int) :: Cline - Cline = int(line, kind(Cline)) - Cfile = string2Cstring (file) - Cstr = string2Cstring (str) - call lammps_actual_error_all (ptr, Cfile, Cline, Cstr) - end subroutine lammps_error_all - -!----------------------------------------------------------------------------- - -! Locally defined helper functions {{{1 - - pure function string2Cstring (string) result (C_string) - use, intrinsic :: ISO_C_binding, only : C_char, C_NULL_CHAR - character (len=*), intent(in) :: string - character (len=1, kind=C_char) :: C_string (len_trim(string)+1) - integer :: i, n - n = len_trim (string) - forall (i = 1:n) - C_string(i) = string(i:i) - end forall - C_string(n+1) = C_NULL_CHAR - end function string2Cstring - -!----------------------------------------------------------------------------- - - pure function Cstrlen (Cstring) result (n) - character (len=1, kind=C_char), dimension(:), intent(in) :: Cstring - integer :: n, i - n = size(Cstring) - do i = 1, size(Cstring) - if ( Cstring(i) == C_NULL_CHAR ) then - n = i - 1 - return - end if - end do - end function Cstrlen - -!----------------------------------------------------------------------------- - - pure function Cstring2string (Cstring) result (string) - !use, intrinsic :: ISO_C_binding, only : C_char, C_NULL_CHAR - character (len=1, kind=C_char), intent(in) :: Cstring (:) - character (len=Cstrlen(Cstring)) :: string - integer :: i, n - n = Cstrlen(Cstring) - string = '' - forall (i = 1:n) - string(i:i) = Cstring(i) - end forall - end function Cstring2string - -!----------------------------------------------------------------------------- - - subroutine Cstring2argcargv (Cstring, argc, argv) - !! Converts a C-style string to argc and argv, that is, words in Cstring - !! become C-style strings in argv. IMPORTANT: Cstring is modified by - !! this routine! I would make Cstring local TO this routine and accept - !! a Fortran-style string instead, but we run into scoping and - !! allocation problems that way. This routine assumes the string is - !! null-terminated, as all C-style strings must be. - - character (kind=C_char), dimension(*), target, intent(inout) :: Cstring - integer (C_int), intent(out) :: argc - type (C_ptr), dimension(:), allocatable, intent(out) :: argv - - integer :: StringStart, SpaceIndex, strlen, argnum - - argc = 1_C_int - - ! Find the length of the string - strlen = 1 - do while ( Cstring(strlen) /= C_NULL_CHAR ) - strlen = strlen + 1 - end do - - ! Find the number of non-escaped spaces - SpaceIndex = 2 - do while ( SpaceIndex < strlen ) - if ( Cstring(SpaceIndex) == ' ' .and. & - Cstring(SpaceIndex-1) /= '\' ) then - argc = argc + 1_C_int - ! Find the next non-space character - do while ( Cstring(SpaceIndex+1) == ' ') - SpaceIndex = SpaceIndex + 1 - end do - end if - SpaceIndex = SpaceIndex + 1 - end do - - ! Now allocate memory for argv - allocate (argv(argc)) - - ! Now find the string starting and ending locations - StringStart = 1 - SpaceIndex = 2 - argnum = 1 - do while ( SpaceIndex < strlen ) - if ( Cstring(SpaceIndex) == ' ' .and. & - Cstring(SpaceIndex-1) /= '\' ) then - ! Found a real space => split strings and store this one - Cstring(Spaceindex) = C_NULL_CHAR ! Replaces space with NULL - argv(argnum) = C_loc(Cstring(StringStart)) - argnum = argnum + 1 - ! Find the next non-space character - do while ( Cstring(SpaceIndex+1) == ' ') - SpaceIndex = SpaceIndex + 1 - end do - StringStart = SpaceIndex + 1 - else if ( Cstring(SpaceIndex) == ' ' .and. & - Cstring(SpaceIndex-1) == '\' ) then - ! Escaped space => remove backslash and move rest of array - Cstring(SpaceIndex-1:strlen-1) = Cstring(SpaceIndex:strlen) - strlen = strlen - 1 ! Last character is still C_NULL_CHAR - end if - SpaceIndex = SpaceIndex + 1 - end do - ! Now handle the last argument - argv(argnum) = C_loc(Cstring(StringStart)) - - end subroutine Cstring2argcargv - -! 1}}} - -end module LAMMPS - -! vim: foldmethod=marker tabstop=3 softtabstop=3 shiftwidth=3 expandtab diff --git a/examples/COUPLE/fortran2/Makefile b/examples/COUPLE/fortran2/Makefile deleted file mode 100644 index 8ac957a4c1..0000000000 --- a/examples/COUPLE/fortran2/Makefile +++ /dev/null @@ -1,41 +0,0 @@ -SHELL = /bin/sh - -# Path to LAMMPS extraction directory -LAMMPS_ROOT = ../../.. -LAMMPS_SRC = $(LAMMPS_ROOT)/src - -# Uncomment the line below if using the MPI stubs library -MPI_STUBS = #-I$(LAMMPS_SRC)/STUBS - -FC = mpifort # replace with your Fortran compiler -CXX = mpicxx # replace with your C++ compiler -CXXLIB = -lstdc++ # replace with your C++ runtime libs - -# Flags for Fortran compiler, C++ compiler, and C preprocessor, respectively -FFLAGS = -O2 -fPIC -CXXFLAGS = -O2 -fPIC -CPPFLAGS = -DOMPI_SKIP_MPICXX=1 -DMPICH_SKIP_MPICXX - -all : liblammps_fortran.a liblammps_fortran.so - @echo "WARNING: this Fortran interface is obsolete and is no longer -maintained. See $(LAMMPS_ROOT)/fortran for the new, maintained interface -(largely written by the same author). You may continue to use this interface if -desired, but it may eventually be removed from LAMMPS." - -liblammps_fortran.so : LAMMPS.o LAMMPS-wrapper.o - $(FC) $(FFLAGS) -shared -o $@ $^ $(CXXLIB) - -liblammps_fortran.a : LAMMPS.o LAMMPS-wrapper.o - $(AR) rs $@ $^ - -LAMMPS.o lammps.mod : LAMMPS.F90 - $(FC) $(CPPFLAGS) $(FFLAGS) -c $< - -LAMMPS-wrapper.o : LAMMPS-wrapper.cpp LAMMPS-wrapper.h - $(CXX) $(CPPFLAGS) $(CXXFLAGS) -c $< -I$(LAMMPS_SRC) $(MPI_STUBS) - -clean : - $(RM) *.o *.mod liblammps_fortran.a liblammps_fortran.so - -dist : - tar -czf Fortran-interface.tar.gz LAMMPS-wrapper.h LAMMPS-wrapper.cpp LAMMPS.F90 makefile README diff --git a/examples/COUPLE/fortran2/README b/examples/COUPLE/fortran2/README deleted file mode 100644 index b36cb43746..0000000000 --- a/examples/COUPLE/fortran2/README +++ /dev/null @@ -1,273 +0,0 @@ -!! NOTE ------------------------------------------------------------------- -! This interface is obsolete and may be removed in a future release of -! LAMMPS. The interface in fortran/lammps.f90 replaces this one. That API -! is maintained by the LAMMPS developers and has documentation written for -! it; it is based loosely on this one, but binds all procedures to a lammps -! derived type. That interface was written in large -! part by the same author, but is also supported by other developers. -!-------------------------------------------------------------------------- - -LAMMPS.F90 defines a Fortran 2003 module, LAMMPS, which wraps all functions in -src/library.h so they can be used directly from Fortran-encoded programs. - -All functions in src/library.h that use and/or return C-style pointers have -Fortran wrapper functions that use Fortran-style arrays, pointers, and -strings; all C-style memory management is handled internally with no user -intervention. See --USE-- for notes on how this interface differs from the -C interface (and the Python interface). - -This interface was created by Karl Hammond who you can contact with -questions: - -Karl D. Hammond -University of Missouri -hammondkd at missouri.edu - -------------------------------------- - ---COMPILATION-- - -First, be advised that mixed-language programming is not trivial. It requires -you to link in the required libraries of all languages you use (in this case, -those for Fortran, C, and C++), as well as any other libraries required. -You are also advised to read the --USE-- section below before trying to -compile. - -The following steps will work to compile this module (replace ${LAMMPS_SRC} -with the path to your LAMMPS source directory). - -Steps 3-5 are accomplished, possibly after some modifications to -the makefile, by make using the attached makefile. Said makefile also builds -the dynamically-linkable library (liblammps_fortran.so). - -** STATIC LIBRARY INSTRUCTIONS ** - (1) Compile LAMMPS as a static library. - Call the resulting file ${LAMMPS_LIB}, which will have an actual name - like liblmp_openmpi.a. If compiling using the MPI stubs in - ${LAMMPS_SRC}/STUBS, you will need to know where libmpi_stubs.a - is as well (I'll call it ${MPI_STUBS} hereafter) - (2) Copy said library to your Fortran program's source directory or replace - ${LAMMPS_LIB} with its full path in the instructions below. - (3) Compile (but don't link!) LAMMPS.F90. Example: - mpifort -c LAMMPS.f90 - OR - gfortran -c LAMMPS.F90 - NOTE: you may get a warning such as, - subroutine lammps_open_wrapper (argc, argv, communicator, ptr) & - Variable 'communicator' at (1) is a parameter to the BIND(C) - procedure 'lammps_open_wrapper' but may not be C interoperable - This is normal (see --IMPLEMENTATION NOTES--). - - (4) Compile (but don't link) LAMMPS-wrapper.cpp. You will need its header - file as well. You will have to provide the locations of LAMMPS's - header files. For example, - mpicxx -c -I${LAMMPS_SRC} LAMMPS-wrapper.cpp - OR - g++ -c -I${LAMMPS_SRC} -I${LAMMPS_SRC}/STUBS LAMMPS-wrapper.cpp - OR - icpc -c -I${LAMMPS_SRC} -I${LAMMPS_SRC}/STUBS LAMMPS-wrapper.cpp - (5) OPTIONAL: Make a library from the object files so you can carry around - two files instead of three. Example: - ar rs liblammps_fortran.a LAMMPS.o LAMMPS-wrapper.o - This will create the file liblammps_fortran.a that you can use in place - of "LAMMPS.o LAMMPS-wrapper.o" later. Note that you will still - need to have the .mod file from part (3). - - It is also possible to add LAMMPS.o and LAMMPS-wrapper.o into the - LAMMPS library (e.g., liblmp_openmpi.a) instead of creating a separate - library, like so: - ar rs ${LAMMPS_LIB} LAMMPS.o LAMMPS-wrapper.o - In this case, you can now use the Fortran wrapper functions as if they - were part of the usual LAMMPS library interface (if you have the module - file visible to the compiler, that is). - (6) Compile (but don't link) your Fortran program. Example: - mpifort -c myfreeformatfile.f90 - mpifort -c myfixedformatfile.f - OR - gfortran -c myfreeformatfile.f90 - gfortran -c myfixedformatfile.f - The object files generated by these steps are collectively referred to - as ${my_object_files} in the next step(s). - - IMPORTANT: If the Fortran module from part (3) is not in the current - directory or in one searched by the compiler for module files, you will - need to include that location via the -I flag to the compiler, like so: - mpifort -I${LAMMPS_SRC}/examples/COUPLE/fortran2 -c myfreeformatfile.f90 - - (7) Link everything together, including any libraries needed by LAMMPS (such - as the C++ standard library, the C math library, the JPEG library, fftw, - etc.) For example, - mpifort LAMMPS.o LAMMPS-wrapper.o ${my_object_files} \ - ${LAMMPS_LIB} -lmpi_cxx -lstdc++ -lm - OR - gfortran LAMMPS.o LAMMPS-wrapper.o ${my_object_files} \ - ${LAMMPS_LIB} ${MPI_STUBS} -lstdc++ -lm - OR - ifort LAMMPS.o LAMMPS-wrapper.o ${my_object_files} \ - ${LAMMPS_LIB} ${MPI_STUBS} -cxxlib -lm - Any other required libraries (e.g. -ljpeg, -lfftw) should be added to - the end of this line. - -You should now have a working executable. - -** DYNAMIC LIBRARY INSTRUCTIONS ** - (1) Compile LAMMPS as a dynamic library - (make makeshlib && make -f Makefile.shlib [targetname]). - (2) Compile, but don't link, LAMMPS.F90 using the -fPIC flag, such as - mpifort -fPIC -c LAMMPS.f90 - (3) Compile, but don't link, LAMMPS-wrapper.cpp in the same manner, e.g. - mpicxx -fPIC -c LAMMPS-wrapper.cpp - (4) Make the dynamic library, like so: - mpifort -fPIC -shared -o liblammps_fortran.so LAMMPS.o LAMMPS-wrapper.o - (5) Compile your program, such as, - mpifort -I${LAMMPS_SRC}/examples/COUPLE/fortran2 -c myfreeformatfile.f90 - where ${LAMMPS_SRC}/examples/COUPLE/fortran2 contains the .mod file from - step (3) - (6) Link everything together, such as - mpifort ${my_object_files} -L${LAMMPS_SRC} \ - -L${LAMMPS_SRC}/examples/COUPLE/fortran2 -llammps_fortran \ - -llammps_openmpi -lmpi_cxx -lstdc++ -lm - -If you wish to avoid the -L flags, add the directories containing your -shared libraries to the LIBRARY_PATH environment variable. At run time, you -will have to add these directories to LD_LIBRARY_PATH as well; otherwise, -your executable will not find the libraries it needs. - -------------------------------------- - ---USAGE-- - -To use this API, your program unit (PROGRAM/SUBROUTINE/FUNCTION/MODULE/etc.) -should look something like this: - program call_lammps - use LAMMPS - ! Other modules, etc. - implicit none - type (lammps_instance) :: lmp ! This is a pointer to your LAMMPS instance - real (C_double) :: fix - real (C_double), dimension(:), pointer :: fix2 - ! Rest of declarations - call lammps_open_no_mpi ('lmp -in /dev/null -screen out.lammps',lmp) - ! Set up rest of program here - call lammps_file (lmp, 'in.example') - call lammps_extract_fix (fix, lmp, '2', 0, 1, 1, 1) - call lammps_extract_fix (fix2, lmp, '4', 0, 2, 1, 1) - call lammps_close (lmp) - end program call_lammps - -Important notes: - * Though I dislike the use of pointers, they are necessary when communicating - with C and C++, which do not support Fortran's ALLOCATABLE attribute. - * There is no need to deallocate C-allocated memory; this is done for you in - the cases when it is done (which are all cases when pointers are not - accepted, such as global fix data) - * All arguments which are char* variables in library.cpp are character (len=*) - variables here. For example, - call lammps_command (lmp, 'units metal') - will work as expected. - * The public functions (the only ones you can use) have interfaces as - described in the comments at the top of LAMMPS.F90. They are not always - the same as those in library.h, since C strings are replaced by Fortran - strings and the like. - * The module attempts to check whether you have done something stupid (such - as assign a 2D array to a scalar), but it's not perfect. For example, the - command - call lammps_extract_global (nlocal, ptr, 'nlocal') - will give nlocal correctly if nlocal is a pointer to type INTEGER, but it - will give the wrong answer if nlocal is a pointer to type REAL. This is a - feature of the (void*) type cast in library.cpp. There is no way I can - check this for you! It WILL catch you if you pass it an allocatable or - fixed-size array when it expects a pointer. - * Arrays constructed from temporary data from LAMMPS are ALLOCATABLE, and - represent COPIES of data, not the originals. Functions like - lammps_extract_atom, which return actual LAMMPS data, are pointers. - * IMPORTANT: Due to the differences between C and Fortran arrays (C uses - row-major vectors, Fortran uses column-major vectors), all arrays returned - from LAMMPS have their indices swapped. - * An example of a complete program, simple.f90, is included with this - package. - -------------------------------------- - ---TROUBLESHOOTING-- - -Compile-time errors (when compiling LAMMPS.F90, that is) probably indicate -that your compiler is not new enough to support Fortran 2003 features. For -example, GCC 4.1.2 will not compile this module, but GCC 4.4.0 will. - -If your compiler balks at 'use, intrinsic :: ISO_C_binding,' try removing the -intrinsic part so it looks like an ordinary module. However, it is likely -that such a compiler will also have problems with everything else in the -file as well. - -If you get a segfault as soon as the lammps_open call is made, check that you -compiled your program AND LAMMPS-wrapper.cpp using the same MPI headers. Using -the stubs for one and the actual MPI library for the other will cause Bad -Things to happen. - -If you find run-time errors, please pass them along via the LAMMPS Users -mailing list (please CC me as well; address above). Please provide a minimal -working example along with the names and versions of the compilers you are -using. Please make sure the error is repeatable and is in MY code, not yours -(generating a minimal working example will usually ensure this anyway). - -------------------------------------- - ---IMPLEMENTATION NOTES-- - -The Fortran procedures have the same names as the C procedures, and -their purpose is the same, but they may take different arguments. Here are -some of the important differences: - * lammps_open and lammps_open_no_mpi take a string instead of argc and - argv. This is necessary because C and C++ have a very different way - of treating strings than Fortran. If you want the command line to be - passed to lammps_open (as it often would be from C/C++), use the - GET_COMMAND intrinsic to obtain it. - * All C++ functions that accept char* pointers now accept Fortran-style - strings within this interface instead. - * All of the lammps_extract_[something] functions, which return void* - C-style pointers, have been replaced by generic subroutines that return - Fortran variables (which may be arrays). The first argument houses the - variable/pointer to be returned (pretend it's on the left-hand side); all - other arguments are identical except as stipulated above. - Note that it is not possible to declare generic functions that are selected - based solely on the type/kind/rank (TKR) signature of the return value, - only based on the TKR of the arguments. - * The SHAPE of the first argument to lammps_extract_[something] is checked - against the "shape" of the C array (e.g., double vs. double* vs. double**). - Calling a subroutine with arguments of inappropriate rank will result in an - error at run time. - * The indices i and j in lammps_extract_fix are used the same way they - are in f_ID[i][j] references in LAMMPS (i.e., starting from 1). This is - different than the way library.cpp uses these numbers, but is more - consistent with the way arrays are accessed in LAMMPS and in Fortran. - * The char* pointer normally returned by lammps_command is thrown away - in this version; note also that lammps_command is now a subroutine - instead of a function. - * The pointer to LAMMPS itself is of type(lammps_instance), which is itself - a synonym for type(C_ptr), part of ISO_C_BINDING. Type (C_ptr) is - C's void* data type. - * This module will almost certainly generate a compile-time warning, - such as, - subroutine lammps_open_wrapper (argc, argv, communicator, ptr) & - Variable 'communicator' at (1) is a parameter to the BIND(C) - procedure 'lammps_open_wrapper' but may not be C interoperable - This happens because lammps_open_wrapper actually takes a Fortran - INTEGER argument, whose type is defined by the MPI library itself. The - Fortran integer is converted to a C integer by the MPI library (if such - conversion is actually necessary). - * lammps_extract_global returns COPIES of the (scalar) data, as does the - C version. - * lammps_extract_atom, lammps_extract_compute, and lammps_extract_fix - have a first argument that will be associated with ACTUAL LAMMPS DATA. - This means the first argument must be: - * The right rank (via the DIMENSION modifier) - * A C-interoperable POINTER type (i.e., INTEGER (C_int) or - REAL (C_double)). - * lammps_extract_variable returns COPIES of the data, as the C library - interface does. There is no need to deallocate using lammps_free. - * The 'data' argument to lammps_gather_atoms and lammps_scatter atoms must - be ALLOCATABLE. It should be of type INTEGER or DOUBLE PRECISION. It - does NOT need to be C inter-operable (and indeed should not be). - * The 'count' argument of lammps_scatter_atoms is unnecessary; the shape of - the array determines the number of elements LAMMPS will read. diff --git a/examples/COUPLE/fortran2/in.simple b/examples/COUPLE/fortran2/in.simple deleted file mode 100644 index 5982cbaac1..0000000000 --- a/examples/COUPLE/fortran2/in.simple +++ /dev/null @@ -1,16 +0,0 @@ -units lj -atom_modify map array -lattice bcc 1.0 -region simbox block 0 10 0 10 0 10 -create_box 2 simbox -create_atoms 1 region simbox -pair_style lj/cut 2.5 -pair_coeff * * 1.0 1.0 -mass 1 58.2 # These are made-up numbers -mass 2 28.3 -velocity all create 1200.0 7474848 dist gaussian -fix 1 all nve -fix 2 all dt/reset 1 1E-5 1E-3 0.01 units box -fix 4 all ave/histo 10 5 100 0.5 1.5 50 f_2 file temp.histo ave running -thermo_style custom step dt temp press etotal f_4[1][1] -thermo 100 diff --git a/examples/COUPLE/fortran2/simple.f90 b/examples/COUPLE/fortran2/simple.f90 deleted file mode 100644 index 0b84a1ecc1..0000000000 --- a/examples/COUPLE/fortran2/simple.f90 +++ /dev/null @@ -1,112 +0,0 @@ -program simple - - use MPI - use LAMMPS - - ! The following line is unnecessary, as I have included these three entities - ! with the LAMMPS module, but I leave them in anyway to remind people where - ! they came from - use, intrinsic :: ISO_C_binding, only : C_double, C_ptr, C_int - - implicit none - - ! Notes: - ! * If LAMMPS returns a scalar that is allocated by the library interface - ! (see library.cpp), then that memory is deallocated automatically and - ! the argument to lammps_extract_fix must be a SCALAR. - ! * If LAMMPS returns a pointer to an array, consisting of internal LAMMPS - ! data, then the argument must be an interoperable Fortran pointer. - ! Interoperable means it is of type INTEGER (C_INT) or of type - ! REAL (C_DOUBLE) in this context. - ! * Pointers should NEVER be deallocated, as that would deallocate internal - ! LAMMPS data! - ! * Note that just because you can read the values of, say, a compute at - ! any time does not mean those values represent the "correct" values. - ! LAMMPS will abort you if you try to grab a pointer to a non-current - ! entity, but once it's bound, it's your responsibility to check that - ! it's current before evaluating. - ! * IMPORTANT: Two-dimensional arrays (such as 'x' from extract_atom) - ! will be transposed from what they might look like in C++. This is - ! because of different bookkeeping conventions between Fortran and C - ! that date back to about 1970 or so (when C was written). - ! * Arrays start from 1, EXCEPT for mass from extract_atom, which - ! starts from 0. This is because the C array actually has a blank - ! first element (and thus mass[1] corresponds to the mass of type 1) - - type (C_ptr) :: lmp - real (C_double), pointer :: compute => NULL() - real (C_double) :: fix, fix2 - real (C_double), dimension(:), pointer :: compute_v => NULL() - real (C_double), dimension(:,:), pointer :: x => NULL() - real (C_double), dimension(:), pointer :: mass => NULL() - integer, dimension(:), allocatable :: types - double precision, dimension(:), allocatable :: r - integer :: error, narg, me, nprocs - character (len=1024) :: command_line - - call MPI_Init (error) - call MPI_Comm_rank (MPI_COMM_WORLD, me, error) - call MPI_Comm_size (MPI_COMM_WORLD, nprocs, error) - - ! You are free to pass any string you like to lammps_open or - ! lammps_open_no_mpi; here is how you pass it the command line - !call get_command (command_line) - !call lammps_open (command_line, MPI_COMM_WORLD, lmp) - - ! And here's how to to it with a string constant of your choice - call lammps_open_no_mpi ('lmp -log log.simple', lmp) - - call lammps_file (lmp, 'in.simple') - call lammps_command (lmp, 'run 500') - - ! This extracts f_2 as a scalar (the last two arguments can be arbitrary) - call lammps_extract_fix (fix, lmp, '2', LMP_STYLE_GLOBAL, LMP_TYPE_SCALAR, 1, 1) - print *, 'Fix is ', fix - - ! This extracts f_4[1][1] as a scalar - call lammps_extract_fix (fix2, lmp, '4', LMP_STYLE_GLOBAL, LMP_TYPE_ARRAY, 1, 1) - print *, 'Fix 2 is ', fix2 - - ! This extracts the scalar compute of compute thermo_temp - call lammps_extract_compute (compute, lmp, 'thermo_temp', LMP_STYLE_GLOBAL, LMP_TYPE_SCALAR) - print *, 'Compute is ', compute - - ! This extracts the vector compute of compute thermo_temp - call lammps_extract_compute (compute_v, lmp, 'thermo_temp', LMP_STYLE_GLOBAL, LMP_TYPE_VECTOR) - print *, 'Vector is ', compute_v - - ! This extracts the masses - call lammps_extract_atom (mass, lmp, 'mass') - print *, 'Mass is ', mass(1:) - - ! Extracts a pointer to the arrays of positions for all atoms - call lammps_extract_atom (x, lmp, 'x') - if ( .not. associated (x) ) print *, 'x is not associated' - print *, 'x is ', x(:,1) ! Prints x, y, z for atom 1 - - ! Extracts pointer to atom types - call lammps_gather_atoms (lmp, 'type', 1, types) - print *, 'types is ', types(1:3) - - ! Allocates an array and assigns all positions to it - call lammps_gather_atoms (lmp, 'x', 3, r) - print *, 'natoms = ', int(lammps_get_natoms(lmp)) - print *, 'size(r) = ', size(r) - print *, 'r is ', r(1:6) - - ! Puts those position data back - call lammps_scatter_atoms (lmp, 'x', r) - - call lammps_command (lmp, 'run 1') - print *, 'x is ', x(:,1) ! Note that the position updates! - print *, 'Compute is ', compute ! This did only because "temp" is part of - ! the thermo output; the vector part did - ! not, and won't until we give LAMMPS a - ! thermo output or other command that - ! requires its value - - call lammps_close (lmp) - - call MPI_Finalize (error) - -end program simple diff --git a/examples/COUPLE/fortran_dftb/LAMMPS-wrapper.cpp b/examples/COUPLE/fortran_dftb/LAMMPS-wrapper.cpp deleted file mode 100644 index 4774cb6b49..0000000000 --- a/examples/COUPLE/fortran_dftb/LAMMPS-wrapper.cpp +++ /dev/null @@ -1,96 +0,0 @@ -/* ----------------------------------------------------------------------- - LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator - https://www.lammps.org/, Sandia National Laboratories - LAMMPS development team: developers@lammps.org - - 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 author: Karl D. Hammond - University of Missouri (USA), 2012 -------------------------------------------------------------------------- */ - -/* This is set of "wrapper" functions to assist LAMMPS.F90, which itself - provides a (I hope) robust Fortran interface to library.cpp and - library.h. All functions herein COULD be added to library.cpp instead of - including this as a separate file. See the README for instructions. */ - -#include -#include "LAMMPS-wrapper.h" -#define LAMMPS_LIB_MPI 1 -#include -#include -#include -#include -#include -#include -#include -#include - -using namespace LAMMPS_NS; - -void lammps_open_fortran_wrapper (int argc, char **argv, - MPI_Fint communicator, void **ptr) -{ - MPI_Comm C_communicator = MPI_Comm_f2c (communicator); - lammps_open (argc, argv, C_communicator, ptr); -} - -int lammps_get_ntypes (void *ptr) -{ - class LAMMPS *lmp = (class LAMMPS *) ptr; - int ntypes = lmp->atom->ntypes; - return ntypes; -} - -void lammps_error_all (void *ptr, const char *file, int line, const char *str) -{ - class LAMMPS *lmp = (class LAMMPS *) ptr; - lmp->error->all (file, line, str); -} - -int lammps_extract_compute_vectorsize (void *ptr, char *id, int style) -{ - int *size; - size = (int *) lammps_extract_compute(ptr, id, style, LMP_SIZE_VECTOR); - if (size) return *size; - return 0; -} - -void lammps_extract_compute_arraysize (void *ptr, char *id, int style, - int *nrows, int *ncols) -{ - int *tmp; - tmp = (int *) lammps_extract_compute(ptr, id, style, LMP_SIZE_ROWS); - if (tmp) *nrows = *tmp; - tmp = (int *) lammps_extract_compute(ptr, id, style, LMP_SIZE_COLS); - if (tmp) *ncols = *tmp; - return; -} - -int lammps_extract_fix_vectorsize (void *ptr, char *id, int style) -{ - int *size; - size = (int *) lammps_extract_fix(ptr, id, style, LMP_SIZE_VECTOR, 0, 0); - if (size) return *size; - return 0; -} - -void lammps_extract_fix_arraysize (void *ptr, char *id, int style, - int *nrows, int *ncols) -{ - int *tmp; - tmp = (int *) lammps_extract_fix(ptr, id, style, LMP_SIZE_ROWS, 0, 0); - if (tmp) *nrows = *tmp; - tmp = (int *) lammps_extract_fix(ptr, id, style, LMP_SIZE_COLS, 0, 0); - if (tmp) *ncols = *tmp; - return; -} - -/* vim: set ts=3 sts=3 expandtab: */ diff --git a/examples/COUPLE/fortran_dftb/LAMMPS-wrapper.h b/examples/COUPLE/fortran_dftb/LAMMPS-wrapper.h deleted file mode 100644 index e1eec9fc72..0000000000 --- a/examples/COUPLE/fortran_dftb/LAMMPS-wrapper.h +++ /dev/null @@ -1,40 +0,0 @@ -/* ----------------------------------------------------------------------- - LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator - https://www.lammps.org/, Sandia National Laboratories - LAMMPS development team: developers@lammps.org - - 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 author: Karl D. Hammond - University of Missouri (USA), 2012 -------------------------------------------------------------------------- */ - -/* This is set of "wrapper" functions to assist LAMMPS.F90, which itself - provides a (I hope) robust Fortran interface to library.cpp and - library.h. All prototypes herein COULD be added to library.h instead of - including this as a separate file. See the README for instructions. */ -#ifdef __cplusplus -extern "C" { -#endif - -/* Prototypes for auxiliary functions */ -void lammps_open_fortran_wrapper (int, char**, MPI_Fint, void**); -int lammps_get_ntypes (void*); -int lammps_extract_compute_vectorsize (void*, char*, int); -void lammps_extract_compute_arraysize (void*, char*, int, int*, int*); -int lammps_extract_fix_vectorsize (void*, char*, int); -void lammps_extract_fix_arraysize (void*, char*, int, int*, int*); -void lammps_error_all (void*, const char*, int, const char*); - -#ifdef __cplusplus -} -#endif - -/* vim: set ts=3 sts=3 expandtab: */ diff --git a/examples/COUPLE/fortran_dftb/LAMMPS-wrapper2.cpp b/examples/COUPLE/fortran_dftb/LAMMPS-wrapper2.cpp deleted file mode 100644 index 83d594df60..0000000000 --- a/examples/COUPLE/fortran_dftb/LAMMPS-wrapper2.cpp +++ /dev/null @@ -1,80 +0,0 @@ -/* ----------------------------------------------------------------------- - LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator - https://www.lammps.org/, Sandia National Laboratories - LAMMPS development team: developers@lammps.org - - 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 author: Nir Goldman, LLNL , 2016 -------------------------------------------------------------------------- */ - -/* This is set of "wrapper" functions to assist LAMMPS.F90, which itself - provides a (I hope) robust Fortran interface to library.cpp and - library.h. All functions herein COULD be added to library.cpp instead of - including this as a separate file. See the README for instructions. */ - -#include -#include "LAMMPS-wrapper2.h" -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -using namespace LAMMPS_NS; - -extern "C" void f_callback(void *, bigint, int, tagint *, double **, double **); - -void lammps_set_callback (void *ptr) { - class LAMMPS *lmp = (class LAMMPS *) ptr; - int ifix = lmp->modify->find_fix_by_style("external"); - FixExternal *fix = (FixExternal *) lmp->modify->fix[ifix]; - fix->set_callback(f_callback, ptr); - return; -} - -void lammps_set_external_vector_length (void *ptr, int n) { - class LAMMPS *lmp = (class LAMMPS *) ptr; - int ifix = lmp->modify->find_fix_by_style("external"); - FixExternal *fix = (FixExternal *) lmp->modify->fix[ifix]; - fix->set_vector_length(n); - return; -} - -void lammps_set_external_vector (void *ptr, int n, double val) { - class LAMMPS *lmp = (class LAMMPS *) ptr; - int ifix = lmp->modify->find_fix_by_style("external"); - FixExternal *fix = (FixExternal *) lmp->modify->fix[ifix]; - fix->set_vector (n, val); - return; -} - -void lammps_set_user_energy (void *ptr, double energy) { - class LAMMPS *lmp = (class LAMMPS *) ptr; - int ifix = lmp->modify->find_fix_by_style("external"); - FixExternal *fix = (FixExternal *) lmp->modify->fix[ifix]; - fix->set_energy_global(energy); - return; -} - -void lammps_set_user_virial (void *ptr, double *virial) { - class LAMMPS *lmp = (class LAMMPS *) ptr; - int ifix = lmp->modify->find_fix_by_style("external"); - FixExternal *fix = (FixExternal *) lmp->modify->fix[ifix]; - fix->set_virial_global(virial); - return; -} - diff --git a/examples/COUPLE/fortran_dftb/LAMMPS-wrapper2.h b/examples/COUPLE/fortran_dftb/LAMMPS-wrapper2.h deleted file mode 100644 index 45c41b569a..0000000000 --- a/examples/COUPLE/fortran_dftb/LAMMPS-wrapper2.h +++ /dev/null @@ -1,37 +0,0 @@ -/* ----------------------------------------------------------------------- - LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator - https://www.lammps.org/, Sandia National Laboratories - LAMMPS development team: developers@lammps.org - - 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 author: Nir Goldman, LLNL , 2016 -------------------------------------------------------------------------- */ - -/* This is set of "wrapper" functions to assist LAMMPS.F90, which itself - provides a (I hope) robust Fortran interface to library.cpp and - library.h. All prototypes herein COULD be added to library.h instead of - including this as a separate file. See the README for instructions. */ -#ifdef __cplusplus -extern "C" { -#endif - -/* Prototypes for auxiliary functions */ -void lammps_set_callback (void *); -void lammps_set_user_energy (void*, double); -void lammps_set_user_virial (void*, double*); -void lammps_set_external_vector_length (void*, int); -void lammps_set_external_vector (void*, int, double); - -#ifdef __cplusplus -} -#endif - -/* vim: set ts=3 sts=3 expandtab: */ diff --git a/examples/COUPLE/fortran_dftb/LAMMPS.F90 b/examples/COUPLE/fortran_dftb/LAMMPS.F90 deleted file mode 100644 index 188fff9d60..0000000000 --- a/examples/COUPLE/fortran_dftb/LAMMPS.F90 +++ /dev/null @@ -1,982 +0,0 @@ -!! ----------------------------------------------------------------------- -! LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator -! www.cs.sandia.gov/~sjplimp/lammps.html -! Steve Plimpton, sjplimp@sandia.gov, Sandia National Laboratories -! -! 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 author: Karl D. Hammond -! University of Missouri (USA), 2012 -!-------------------------------------------------------------------------- - -!! LAMMPS, a Fortran 2003 module containing an interface between Fortran -!! programs and the C-style functions in library.cpp that ship with LAMMPS. -!! This file should be accompanied by LAMMPS-wrapper.cpp and LAMMPS-wrapper.h, -!! which define wrapper functions that ease portability and enforce array -!! dimensions. -!! -!! Everything in this module should be 100% portable by way of Fortran 2003's -!! ISO_C_BINDING intrinsic module. See the README for instructions for -!! compilation and use. -!! -!! Here are the PUBLIC functions and subroutines included in this module. -!! subroutine lammps_open (command_line, communicator, ptr) -!! subroutine lammps_open_no_mpi (command_line, ptr) -!! subroutine lammps_close (ptr) -!! subroutine lammps_file (ptr, str) -!! subroutine lammps_command (ptr, str) -!! subroutine lammps_free (ptr) -!! subroutine lammps_extract_global (global, ptr, name) -!! subroutine lammps_extract_atom (atom, ptr, name) -!! subroutine lammps_extract_fix (fix, ptr, id, style, type, i, j) -!! subroutine lammps_extract_compute (compute, ptr, id, style, type) -!! subroutine lammps_extract_variable (variable, ptr, name, group) -!! function lammps_get_natoms (ptr) -!! subroutine lammps_gather_atoms (ptr, name, count, data) -!! subroutine lammps_scatter_atoms (ptr, name, data) - -#define FLERR __FILE__,__LINE__ -! The above line allows for similar error checking as is done with standard -! LAMMPS files. - -module LAMMPS - - use, intrinsic :: ISO_C_binding, only : C_double, C_int, C_ptr, C_char, & - C_NULL_CHAR, C_loc, C_F_pointer, lammps_instance => C_ptr - implicit none - private - public :: lammps_set_user_virial - public :: lammps_set_external_vector_length - public :: lammps_set_external_vector - public :: lammps_set_user_energy - public :: lammps_open, lammps_open_no_mpi, lammps_close, lammps_file, & - lammps_command, lammps_free, lammps_extract_global, & - lammps_extract_atom, lammps_extract_compute, lammps_extract_fix, & - lammps_extract_variable, lammps_get_natoms, lammps_gather_atoms, & - lammps_set_callback - public :: lammps_scatter_atoms, lammps_instance, C_ptr, C_double, C_int - - !! Functions supplemental to the prototypes in library.h. {{{1 - !! The function definitions (in C++) are contained in LAMMPS-wrapper.cpp. - !! I would have written the first in Fortran, but the MPI libraries (which - !! were written in C) have C-based functions to convert from Fortran MPI - !! handles to C MPI handles, and there is no Fortran equivalent for those - !! functions. - interface - subroutine lammps_open_wrapper (argc, argv, communicator, ptr) & - bind (C, name='lammps_open_fortran_wrapper') - import :: C_int, C_ptr - integer (C_int), value :: argc - type (C_ptr), dimension(*) :: argv - integer, value :: communicator - type (C_ptr) :: ptr - end subroutine lammps_open_wrapper - subroutine lammps_actual_error_all (ptr, file, line, str) & - bind (C, name='lammps_error_all') - import :: C_int, C_char, C_ptr - type (C_ptr), value :: ptr - character (kind=C_char), dimension(*), intent(in) :: file, str - integer (C_int), value :: line - end subroutine lammps_actual_error_all - function lammps_get_ntypes (ptr) result (ntypes) & - bind (C, name='lammps_get_ntypes') - import :: C_int, C_ptr - type (C_ptr), value :: ptr - integer (C_int) :: ntypes - end function lammps_get_ntypes - function lammps_actual_extract_compute_vectorsize (ptr, id, style) & - result (vectorsize) bind (C, name='lammps_extract_compute_vectorsize') - import :: C_int, C_char, C_ptr - integer (C_int) :: vectorsize - type (C_ptr), value :: ptr - character (kind=C_char), dimension(*) :: id - integer (C_int), value :: style - end function lammps_actual_extract_compute_vectorsize - subroutine lammps_actual_extract_compute_arraysize (ptr, id, style, & - nrows, ncols) bind (C, name='lammps_extract_compute_arraysize') - import :: C_int, C_char, C_ptr - integer (C_int) :: arraysize - type (C_ptr), value :: ptr - character (kind=C_char), dimension(*) :: id - integer (C_int), value :: style - integer (C_int) :: nrows, ncols - end subroutine lammps_actual_extract_compute_arraysize - function lammps_actual_extract_fix_vectorsize (ptr, id, style) & - result (vectorsize) bind (C, name='lammps_extract_fix_vectorsize') - import :: C_int, C_char, C_ptr - integer (C_int) :: vectorsize - type (C_ptr), value :: ptr - character (kind=C_char), dimension(*) :: id - integer (C_int), value :: style - end function lammps_actual_extract_fix_vectorsize - subroutine lammps_actual_extract_fix_arraysize (ptr, id, style, & - nrows, ncols) bind (C, name='lammps_extract_fix_arraysize') - import :: C_int, C_char, C_ptr - type (C_ptr), value :: ptr - character (kind=C_char), dimension(*) :: id - integer (C_int), value :: style - integer (C_int) :: nrows, ncols - end subroutine lammps_actual_extract_fix_arraysize - end interface - - !! Functions/subroutines defined in library.h and library.cpp {{{1 - interface - subroutine lammps_actual_open_no_mpi (argc, argv, ptr) & - bind (C, name='lammps_open_no_mpi') - import :: C_int, C_ptr - integer (C_int), value :: argc - type (C_ptr), dimension(*) :: argv - type (C_ptr) :: ptr - end subroutine lammps_actual_open_no_mpi - - subroutine lammps_close (ptr) bind (C, name='lammps_close') - import :: C_ptr - type (C_ptr), value :: ptr - end subroutine lammps_close - - subroutine lammps_actual_file (ptr, str) bind (C, name='lammps_file') - import :: C_ptr, C_char - type (C_ptr), value :: ptr - character (kind=C_char), dimension(*) :: str - end subroutine lammps_actual_file - - function lammps_actual_command (ptr, str) result (command) & - bind (C, name='lammps_command') - import :: C_ptr, C_char - type (C_ptr), value :: ptr - character (kind=C_char), dimension(*) :: str - type (C_ptr) :: command - end function lammps_actual_command - - subroutine lammps_free (ptr) bind (C, name='lammps_free') - import :: C_ptr - type (C_ptr), value :: ptr - end subroutine lammps_free - - function lammps_actual_extract_global (ptr, name) & - bind (C, name='lammps_extract_global') result (global) - import :: C_ptr, C_char - type (C_ptr), value :: ptr - character (kind=C_char), dimension(*) :: name - type (C_ptr) :: global - end function lammps_actual_extract_global - - function lammps_actual_extract_atom (ptr, name) & - bind (C, name='lammps_extract_atom') result (atom) - import :: C_ptr, C_char - type (C_ptr), value :: ptr - character (kind=C_char), dimension(*) :: name - type (C_ptr) :: atom - end function lammps_actual_extract_atom - - function lammps_actual_extract_compute (ptr, id, style, type) & - result (compute) bind (C, name='lammps_extract_compute') - import :: C_ptr, C_char, C_int - type (C_ptr), value :: ptr - character (kind=C_char), dimension(*) :: id - integer (C_int), value :: style, type - type (C_ptr) :: compute - end function lammps_actual_extract_compute - - function lammps_actual_extract_fix (ptr, id, style, type, i, j) & - result (fix) bind (C, name='lammps_extract_fix') - import :: C_ptr, C_char, C_int - type (C_ptr), value :: ptr - character (kind=C_char), dimension(*) :: id - integer (C_int), value :: style, type, i, j - type (C_ptr) :: fix - end function lammps_actual_extract_fix - - function lammps_actual_extract_variable (ptr, name, group) & - result (variable) bind (C, name='lammps_extract_variable') - import :: C_ptr, C_char - type (C_ptr), value :: ptr - character (kind=C_char), dimension(*) :: name, group - type (C_ptr) :: variable - end function lammps_actual_extract_variable - - function lammps_get_natoms (ptr) result (natoms) & - bind (C, name='lammps_get_natoms') - import :: C_ptr, C_int - type (C_ptr), value :: ptr - integer (C_int) :: natoms - end function lammps_get_natoms - - subroutine lammps_set_callback (ptr) & - bind (C, name='lammps_set_callback') - import :: C_ptr - type (C_ptr), value :: ptr - end subroutine lammps_set_callback - - subroutine lammps_set_user_energy (ptr, energy) & - bind (C, name='lammps_set_user_energy') - import :: C_ptr, C_double - type (C_ptr), value :: ptr - real(C_double), value :: energy - end subroutine lammps_set_user_energy - - subroutine lammps_set_user_virial (ptr, virial) & - bind (C, name='lammps_set_user_virial') - import :: C_ptr, C_double - type (C_ptr), value :: ptr - real(C_double) :: virial(6) - end subroutine lammps_set_user_virial - - subroutine lammps_set_external_vector_length (ptr, n) & - bind (C, name='lammps_set_external_vector_length') - import :: C_ptr, C_double, C_int - type(C_ptr), value :: ptr - integer (C_int), value :: n - end subroutine lammps_set_external_vector_length - - subroutine lammps_set_external_vector (ptr, n, val) & - bind (C, name='lammps_set_external_vector') - import :: C_ptr, C_int, C_double - type (C_ptr), value :: ptr - integer (C_int), value :: n - real(C_double), value :: val - end subroutine lammps_set_external_vector - - subroutine lammps_actual_gather_atoms (ptr, name, type, count, data) & - bind (C, name='lammps_gather_atoms') - import :: C_ptr, C_int, C_char - type (C_ptr), value :: ptr, data - character (kind=C_char), dimension(*) :: name - integer (C_int), value :: type, count - end subroutine lammps_actual_gather_atoms - - subroutine lammps_actual_scatter_atoms (ptr, name, type, count, data) & - bind (C, name='lammps_scatter_atoms') - import :: C_ptr, C_int, C_char - type (C_ptr), value :: ptr, data - character (kind=C_char), dimension(*) :: name - integer (C_int), value :: type, count - end subroutine lammps_actual_scatter_atoms - end interface - - ! Generic functions for the wrappers below {{{1 - - interface lammps_extract_global - module procedure lammps_extract_global_i, & - lammps_extract_global_dp - end interface lammps_extract_global - - interface lammps_extract_atom - module procedure lammps_extract_atom_ia, & - lammps_extract_atom_dpa, & - lammps_extract_atom_dp2a - end interface lammps_extract_atom - - interface lammps_extract_compute - module procedure lammps_extract_compute_dp, & - lammps_extract_compute_dpa, & - lammps_extract_compute_dp2a - end interface lammps_extract_compute - - interface lammps_extract_fix - module procedure lammps_extract_fix_dp, & - lammps_extract_fix_dpa, & - lammps_extract_fix_dp2a - end interface lammps_extract_fix - - interface lammps_extract_variable - module procedure lammps_extract_variable_dp, & - lammps_extract_variable_dpa - end interface lammps_extract_variable - - interface lammps_gather_atoms - module procedure lammps_gather_atoms_ia, lammps_gather_atoms_dpa - end interface lammps_gather_atoms - - interface lammps_scatter_atoms - module procedure lammps_scatter_atoms_ia, lammps_scatter_atoms_dpa - end interface lammps_scatter_atoms - -contains !! Wrapper functions local to this module {{{1 - - subroutine lammps_open (command_line, communicator, ptr) - character (len=*), intent(in) :: command_line - integer, intent(in) :: communicator - type (C_ptr) :: ptr - integer (C_int) :: argc - type (C_ptr), dimension(:), allocatable :: argv - character (kind=C_char), dimension(len_trim(command_line)+1), target :: & - c_command_line - c_command_line = string2Cstring (command_line) - call Cstring2argcargv (c_command_line, argc, argv) - call lammps_open_wrapper (argc, argv, communicator, ptr) - deallocate (argv) - end subroutine lammps_open - -!----------------------------------------------------------------------------- - - subroutine lammps_open_no_mpi (command_line, ptr) - character (len=*), intent(in) :: command_line - type (C_ptr) :: ptr - integer (C_int) :: argc - type (C_ptr), dimension(:), allocatable :: argv - character (kind=C_char), dimension(len_trim(command_line)+1), target :: & - c_command_line - c_command_line = string2Cstring (command_line) - call Cstring2argcargv (c_command_line, argc, argv) - call lammps_actual_open_no_mpi (argc, argv, ptr) - deallocate (argv) - end subroutine lammps_open_no_mpi - -!----------------------------------------------------------------------------- - - subroutine lammps_file (ptr, str) - type (C_ptr) :: ptr - character (len=*) :: str - character (kind=C_char), dimension(len_trim(str)+1) :: Cstr - Cstr = string2Cstring (str) - call lammps_actual_file (ptr, Cstr) - end subroutine lammps_file - -!----------------------------------------------------------------------------- - - subroutine lammps_command (ptr, str) - type (C_ptr) :: ptr - character (len=*) :: str - character (kind=C_char), dimension(len_trim(str)+1) :: Cstr - type (C_ptr) :: dummy - Cstr = string2Cstring (str) - dummy = lammps_actual_command (ptr, Cstr) - end subroutine lammps_command - -!----------------------------------------------------------------------------- - -! lammps_extract_global {{{2 - function lammps_extract_global_Cptr (ptr, name) result (global) - type (C_ptr) :: global - type (C_ptr), intent(in) :: ptr - character (len=*), intent(in) :: name - character (kind=C_char), dimension(len_trim(name)+1) :: Cname - Cname = string2Cstring (name) - global = lammps_actual_extract_global (ptr, Cname) - end function lammps_extract_global_Cptr - subroutine lammps_extract_global_i (global, ptr, name) - integer (C_int), pointer, intent(out) :: global - type (C_ptr), intent(in) :: ptr - character (len=*), intent(in) :: name - type (C_ptr) :: Cptr - Cptr = lammps_extract_global_Cptr (ptr, name) - call C_F_pointer (Cptr, global) - end subroutine lammps_extract_global_i - subroutine lammps_extract_global_dp (global, ptr, name) - real (C_double), pointer, intent(out) :: global - type (C_ptr), intent(in) :: ptr - character (len=*), intent(in) :: name - type (C_ptr) :: Cptr - Cptr = lammps_extract_global_Cptr (ptr, name) - call C_F_pointer (Cptr, global) - end subroutine lammps_extract_global_dp - -!----------------------------------------------------------------------------- - -! lammps_extract_atom {{{2 - function lammps_extract_atom_Cptr (ptr, name) result (atom) - type (C_ptr) :: atom - type (C_ptr), intent(in) :: ptr - character (len=*), intent(in) :: name - character (kind=C_char), dimension(len_trim(name)+1) :: Cname - Cname = string2Cstring (name) - atom = lammps_actual_extract_atom (ptr, Cname) - end function lammps_extract_atom_Cptr - subroutine lammps_extract_atom_ia (atom, ptr, name) - integer (C_int), dimension(:), pointer, intent(out) :: atom - type (C_ptr), intent(in) :: ptr - character (len=*), intent(in) :: name - type (C_ptr) :: Cptr - integer (C_int), pointer :: nelements - call lammps_extract_global_i (nelements, ptr, 'nlocal') - Cptr = lammps_extract_atom_Cptr (ptr, name) - call C_F_pointer (Cptr, atom, (/nelements/)) - end subroutine lammps_extract_atom_ia - subroutine lammps_extract_atom_dpa (atom, ptr, name) - real (C_double), dimension(:), pointer, intent(out) :: atom - type (C_ptr), intent(in) :: ptr - character (len=*), intent(in) :: name - type (C_ptr) :: Cptr - integer (C_int), pointer :: nlocal - integer :: nelements - real (C_double), dimension(:), pointer :: Fptr - if ( name == 'mass' ) then - nelements = lammps_get_ntypes (ptr) + 1 - else if ( name == 'x' .or. name == 'v' .or. name == 'f' .or. & - name == 'mu' .or. name == 'omega' .or. name == 'torque' .or. & - name == 'angmom' ) then - ! We should not be getting a rank-2 array here! - call lammps_error_all (ptr, FLERR, 'You cannot extract those atom& - & data (' // trim(name) // ') into a rank 1 array.') - return - else - ! Everything else we can get is probably nlocal units long - call lammps_extract_global_i (nlocal, ptr, 'nlocal') - nelements = nlocal - end if - Cptr = lammps_extract_atom_Cptr (ptr, name) - call C_F_pointer (Cptr, Fptr, (/nelements/)) - if ( name == 'mass' ) then - !atom(0:) => Fptr - atom => Fptr - else - atom => Fptr - end if - end subroutine lammps_extract_atom_dpa - subroutine lammps_extract_atom_dp2a (atom, ptr, name) - real (C_double), dimension(:,:), pointer, intent(out) :: atom - type (C_ptr), intent(in) :: ptr - character (len=*), intent(in) :: name - type (C_ptr) :: Cptr - type (C_ptr), pointer, dimension(:) :: Catom - integer (C_int), pointer :: nelements - if ( name /= 'x' .and. name /= 'v' .and. name /= 'f' .and. & - name /= 'mu' .and. name /= 'omega' .and. name /= 'tandque' .and. & - name /= 'angmom' .and. name /= 'fexternal' ) then - ! We should not be getting a rank-2 array here! - call lammps_error_all (ptr, FLERR, 'You cannot extract those atom& - & data (' // trim(name) // ') into a rank 2 array.') - return - end if - Cptr = lammps_extract_atom_Cptr (ptr, name) - call lammps_extract_global_i (nelements, ptr, 'nlocal') - ! Catom will now be the array of void* pointers that the void** pointer - ! pointed to. Catom(1) is now the pointer to the first element. - call C_F_pointer (Cptr, Catom, (/nelements/)) - ! Now get the actual array, which has its shape transposed from what we - ! might think of it in C - call C_F_pointer (Catom(1), atom, (/3, nelements/)) - end subroutine lammps_extract_atom_dp2a - -!----------------------------------------------------------------------------- - -! lammps_extract_compute {{{2 - function lammps_extract_compute_Cptr (ptr, id, style, type) result (compute) - type (C_ptr) :: compute - type (C_ptr), intent(in) :: ptr - character (len=*), intent(in) :: id - integer, intent(in) :: style, type - integer (kind=C_int) :: Cstyle, Ctype - character (kind=C_char), dimension(len_trim(id)+1) :: Cid - Cid = string2Cstring (id) - Cstyle = style - Ctype = type - compute = lammps_actual_extract_compute (ptr, Cid, Cstyle, Ctype) - end function lammps_extract_compute_Cptr - subroutine lammps_extract_compute_dp (compute, ptr, id, style, type) - real (C_double), pointer, intent(out) :: compute - type (C_ptr), intent(in) :: ptr - character (len=*), intent(in) :: id - integer, intent(in) :: style, type - type (C_ptr) :: Cptr - ! The only valid values of (style,type) are (0,0) for scalar 'compute' - if ( style /= 0 ) then - call lammps_error_all (ptr, FLERR, 'You cannot pack per-atom/local& - & data into a scalar.') - return - end if - if ( type == 1 ) then - call lammps_error_all (ptr, FLERR, 'You cannot extract a compute& - & vector (rank 1) into a scalar.') - return - else if ( type == 2 ) then - call lammps_error_all (ptr, FLERR, 'You cannot extract a compute& - & array (rank 2) into a scalar.') - return - end if - Cptr = lammps_extract_compute_Cptr (ptr, id, style, type) - call C_F_pointer (Cptr, compute) - end subroutine lammps_extract_compute_dp - subroutine lammps_extract_compute_dpa (compute, ptr, id, style, type) - real (C_double), dimension(:), pointer, intent(out) :: compute - type (C_ptr), intent(in) :: ptr - character (len=*), intent(in) :: id - integer, intent(in) :: style, type - type (C_ptr) :: Cptr - integer :: nelements - ! Check for the correct dimensionality - if ( type == 0 ) then - call lammps_error_all (ptr, FLERR, 'You cannot extract a compute& - & scalar (rank 0) into a rank 1 variable.') - return - else if ( type == 2 ) then - call lammps_error_all (ptr, FLERR, 'You cannot extract a compute& - & array (rank 2) into a rank 1 variable.') - return - end if - nelements = lammps_extract_compute_vectorsize (ptr, id, style) - Cptr = lammps_extract_compute_Cptr (ptr, id, style, type) - call C_F_pointer (Cptr, compute, (/nelements/)) - end subroutine lammps_extract_compute_dpa - subroutine lammps_extract_compute_dp2a (compute, ptr, id, style, type) - real (C_double), dimension(:,:), pointer, intent(out) :: compute - type (C_ptr), intent(in) :: ptr - character (len=*), intent(in) :: id - integer, intent(in) :: style, type - type (C_ptr) :: Cptr - type (C_ptr), pointer, dimension(:) :: Ccompute - integer :: nr, nc - ! Check for the correct dimensionality - if ( type == 0 ) then - call lammps_error_all (ptr, FLERR, 'You cannot extract a compute& - & scalar (rank 0) into a rank 2 variable.') - return - else if ( type == 1 ) then - call lammps_error_all (ptr, FLERR, 'You cannot extract a compute& - & array (rank 1) into a rank 2 variable.') - return - end if - call lammps_extract_compute_arraysize (ptr, id, style, nr, nc) - Cptr = lammps_extract_compute_Cptr (ptr, id, style, type) - call C_F_pointer (Cptr, Ccompute, (/nr/)) - ! Note that the matrix is transposed, from Fortran's perspective - call C_F_pointer (Ccompute(1), compute, (/nc, nr/)) - end subroutine lammps_extract_compute_dp2a - -!----------------------------------------------------------------------------- - -! lammps_extract_fix {{{2 - function lammps_extract_fix_Cptr (ptr, id, style, type, i, j) & - result (fix) - type (C_ptr) :: fix - type (C_ptr), intent(in) :: ptr - character (len=*), intent(in) :: id - integer, intent(in) :: style, type, i, j - character (kind=C_char), dimension(len_trim(id)+1) :: Cid - integer (kind=C_int) :: Cstyle, Ctype, Ci, Cj - Cid = string2Cstring (id) - Cstyle = style - Ctype = type - Ci = i - 1 ! This is for consistency with the values from f_ID[i], - Cj = j - 1 ! which is different from what library.cpp uses! - if ( (type >= 1 .and. Ci < 0) .or. & - (type == 2 .and. (Ci < 0 .or. Cj < 0) ) ) then - call lammps_error_all (ptr, FLERR, 'Index out of range in& - & lammps_extract_fix') - end if - fix = lammps_actual_extract_fix (ptr, Cid, Cstyle, Ctype, Ci, Cj) - end function lammps_extract_fix_Cptr - subroutine lammps_extract_fix_dp (fix, ptr, id, style, type, i, j) - real (C_double), intent(out) :: fix - type (C_ptr), intent(in) :: ptr - character (len=*), intent(in) :: id - integer, intent(in) :: style, type, i, j - type (C_ptr) :: Cptr - real (C_double), pointer :: Fptr - ! Check for the correct dimensionality - if ( style /= 0 ) then - select case (type) - case (0) - call lammps_error_all (ptr, FLERR, 'There is no per-atom or local& - & scalar data available from fixes.') - case (1) - call lammps_error_all (ptr, FLERR, 'You cannot extract a fix''s & - &per-atom/local vector (rank 1) into a scalar.') - case (2) - call lammps_error_all (ptr, FLERR, 'You cannot extract a fix''s & - &per-atom/local array (rank 2) into a scalar.') - case default - call lammps_error_all (ptr, FLERR, 'Invalid extract_fix style/& - &type combination.') - end select - return - end if - Cptr = lammps_extract_fix_Cptr (ptr, id, style, type, i, j) - call C_F_pointer (Cptr, Fptr) - fix = Fptr - nullify (Fptr) - ! Memory is only allocated for "global" fix variables - if ( style == 0 ) call lammps_free (Cptr) - end subroutine lammps_extract_fix_dp - subroutine lammps_extract_fix_dpa (fix, ptr, id, style, type, i, j) - real (C_double), dimension(:), pointer, intent(out) :: fix - type (C_ptr), intent(in) :: ptr - character (len=*), intent(in) :: id - integer, intent(in) :: style, type, i, j - type (C_ptr) :: Cptr - integer :: fix_len - ! Check for the correct dimensionality - if ( style == 0 ) then - call lammps_error_all (ptr, FLERR, 'You can''t extract the& - & whole vector from global fix data') - return - else if ( type == 0 ) then - call lammps_error_all (ptr, FLERR, 'You can''t extract a fix& - & scalar into a rank 1 variable') - return - else if ( type == 2 ) then - call lammps_error_all (ptr, FLERR, 'You cannot extract a fix& - & array into a rank 1 variable.') - return - else if ( type /= 1 ) then - call lammps_error_all (ptr, FLERR, 'Invalid type for fix extraction.') - return - end if - fix_len = lammps_extract_fix_vectorsize (ptr, id, style) - call C_F_pointer (Cptr, fix, (/fix_len/)) - ! Memory is only allocated for "global" fix variables, which we should - ! never get here, so no need to call lammps_free! - end subroutine lammps_extract_fix_dpa - subroutine lammps_extract_fix_dp2a (fix, ptr, id, style, type, i, j) - real (C_double), dimension(:,:), pointer, intent(out) :: fix - type (C_ptr), intent(in) :: ptr - character (len=*), intent(in) :: id - integer, intent(in) :: style, type, i, j - type (C_ptr) :: Cptr - type (C_ptr), pointer, dimension(:) :: Cfix - integer :: nr, nc - ! Check for the correct dimensionality - if ( style == 0 ) then - call lammps_error_all (ptr, FLERR, 'It is not possible to extract the& - & entire array from global fix data.') - return - else if ( type == 0 ) then - call lammps_error_all (ptr, FLERR, 'You cannot extract a fix& - & scalar (rank 0) into a rank 2 variable.') - return - else if ( type == 1 ) then - call lammps_error_all (ptr, FLERR, 'You cannot extract a fix& - & vector (rank 1) into a rank 2 variable.') - return - end if - call lammps_extract_fix_arraysize (ptr, id, style, nr, nc) - ! Extract pointer to first element as Cfix(1) - call C_F_pointer (Cptr, Cfix, (/nr/)) - ! Now extract the array, which is transposed - call C_F_pointer (Cfix(1), fix, (/nc, nr/)) - end subroutine lammps_extract_fix_dp2a - -!----------------------------------------------------------------------------- - -! lammps_extract_variable {{{2 - function lammps_extract_variable_Cptr (ptr, name, group) result (variable) - type (C_ptr) :: ptr, variable - character (len=*) :: name - character (len=*), optional :: group - character (kind=C_char), dimension(len_trim(name)+1) :: Cname - character (kind=C_char), dimension(:), allocatable :: Cgroup - Cname = string2Cstring (name) - if ( present(group) ) then - allocate (Cgroup(len_trim(group)+1)) - Cgroup = string2Cstring (group) - else - allocate (Cgroup(1)) - Cgroup(1) = C_NULL_CHAR - end if - variable = lammps_actual_extract_variable (ptr, Cname, Cgroup) - deallocate (Cgroup) - end function lammps_extract_variable_Cptr - subroutine lammps_extract_variable_dp (variable, ptr, name, group) - real (C_double), intent(out) :: variable - type (C_ptr), intent(in) :: ptr - character (len=*), intent(in) :: name - character (len=*), intent(in), optional :: group - type (C_ptr) :: Cptr - real (C_double), pointer :: Fptr - if ( present(group) ) then - Cptr = lammps_extract_variable_Cptr (ptr, name, group) - else - Cptr = lammps_extract_variable_Cptr (ptr, name) - end if - call C_F_pointer (Cptr, Fptr) - variable = Fptr - nullify (Fptr) - call lammps_free (Cptr) - end subroutine lammps_extract_variable_dp - subroutine lammps_extract_variable_dpa (variable, ptr, name, group) - real (C_double), dimension(:), allocatable, intent(out) :: variable - type (C_ptr), intent(in) :: ptr - character (len=*), intent(in) :: name - character (len=*), intent(in), optional :: group - type (C_ptr) :: Cptr - real (C_double), dimension(:), pointer :: Fptr - integer :: natoms - if ( present(group) ) then - Cptr = lammps_extract_variable_Cptr (ptr, name, group) - else - Cptr = lammps_extract_variable_Cptr (ptr, name) - end if - natoms = lammps_get_natoms (ptr) - allocate (variable(natoms)) - call C_F_pointer (Cptr, Fptr, (/natoms/)) - variable = Fptr - nullify (Fptr) - call lammps_free (Cptr) - end subroutine lammps_extract_variable_dpa - -!-------------------------------------------------------------------------2}}} - - subroutine lammps_gather_atoms_ia (ptr, name, count, data) - type (C_ptr), intent(in) :: ptr - character (len=*), intent(in) :: name - integer, intent(in) :: count - integer, dimension(:), allocatable, intent(out) :: data - type (C_ptr) :: Cdata - integer (C_int), dimension(:), pointer :: Fdata - integer (C_int) :: natoms - character (kind=C_char), dimension(len_trim(name)+1) :: Cname - integer (C_int), parameter :: Ctype = 0_C_int - integer (C_int) :: Ccount - natoms = lammps_get_natoms (ptr) - Cname = string2Cstring (name) - if ( count /= 1 .and. count /= 3 ) then - call lammps_error_all (ptr, FLERR, 'lammps_gather_atoms requires& - & count to be either 1 or 3') - else - Ccount = count - end if - allocate ( Fdata(count*natoms) ) - allocate ( data(count*natoms) ) - Cdata = C_loc (Fdata(1)) - call lammps_actual_gather_atoms (ptr, Cname, Ctype, Ccount, Cdata) - data = Fdata - deallocate (Fdata) - end subroutine lammps_gather_atoms_ia - subroutine lammps_gather_atoms_dpa (ptr, name, count, data) - type (C_ptr), intent(in) :: ptr - character (len=*), intent(in) :: name - integer, intent(in) :: count - double precision, dimension(:), allocatable, intent(out) :: data - type (C_ptr) :: Cdata - real (C_double), dimension(:), pointer :: Fdata - integer (C_int) :: natoms - character (kind=C_char), dimension(len_trim(name)+1) :: Cname - integer (C_int), parameter :: Ctype = 1_C_int - integer (C_int) :: Ccount - natoms = lammps_get_natoms (ptr) - Cname = string2Cstring (name) - if ( count /= 1 .and. count /= 3 ) then - call lammps_error_all (ptr, FLERR, 'lammps_gather_atoms requires& - & count to be either 1 or 3') - else - Ccount = count - end if - allocate ( Fdata(count*natoms) ) - allocate ( data(count*natoms) ) - Cdata = C_loc (Fdata(1)) - call lammps_actual_gather_atoms (ptr, Cname, Ctype, Ccount, Cdata) - data = Fdata(:) - deallocate (Fdata) - end subroutine lammps_gather_atoms_dpa - -!----------------------------------------------------------------------------- - - subroutine lammps_scatter_atoms_ia (ptr, name, data) - type (C_ptr), intent(in) :: ptr - character (len=*), intent(in) :: name - integer, dimension(:), intent(in) :: data - integer (kind=C_int) :: natoms, Ccount - integer (kind=C_int), parameter :: Ctype = 0_C_int - character (kind=C_char), dimension(len_trim(name)+1) :: Cname - integer (C_int), dimension(size(data)), target :: Fdata - type (C_ptr) :: Cdata - natoms = lammps_get_natoms (ptr) - Cname = string2Cstring (name) - Ccount = size(data) / natoms - if ( Ccount /= 1 .and. Ccount /= 3 ) & - call lammps_error_all (ptr, FLERR, 'lammps_gather_atoms requires& - & count to be either 1 or 3') - Fdata = data - Cdata = C_loc (Fdata(1)) - call lammps_actual_scatter_atoms (ptr, Cname, Ctype, Ccount, Cdata) - end subroutine lammps_scatter_atoms_ia - subroutine lammps_scatter_atoms_dpa (ptr, name, data) - type (C_ptr), intent(in) :: ptr - character (len=*), intent(in) :: name - double precision, dimension(:), intent(in) :: data - integer (kind=C_int) :: natoms, Ccount - integer (kind=C_int), parameter :: Ctype = 1_C_int - character (kind=C_char), dimension(len_trim(name)+1) :: Cname - real (C_double), dimension(size(data)), target :: Fdata - type (C_ptr) :: Cdata - natoms = lammps_get_natoms (ptr) - Cname = string2Cstring (name) - Ccount = size(data) / natoms - if ( Ccount /= 1 .and. Ccount /= 3 ) & - call lammps_error_all (ptr, FLERR, 'lammps_gather_atoms requires& - & count to be either 1 or 3') - Fdata = data - Cdata = C_loc (Fdata(1)) - call lammps_actual_scatter_atoms (ptr, Cname, Ctype, Ccount, Cdata) - end subroutine lammps_scatter_atoms_dpa - -!----------------------------------------------------------------------------- - - function lammps_extract_compute_vectorsize (ptr, id, style) & - result (vectorsize) - integer :: vectorsize - type (C_ptr), intent(in) :: ptr - character (len=*), intent(in) :: id - integer, intent(in) :: style - integer (C_int) :: Cvectorsize, Cstyle - character (kind=C_char), dimension(len_trim(id)+1) :: Cid - Cid = string2Cstring (id) - Cstyle = int(style, C_int) - Cvectorsize = lammps_actual_extract_compute_vectorsize (ptr, Cid, Cstyle) - vectorsize = int(Cvectorsize, kind(vectorsize)) - end function lammps_extract_compute_vectorsize - -!----------------------------------------------------------------------------- - - function lammps_extract_fix_vectorsize (ptr, id, style) & - result (vectorsize) - integer :: vectorsize - type (C_ptr), intent(in) :: ptr - character (len=*), intent(in) :: id - integer, intent(in) :: style - integer (C_int) :: Cvectorsize, Cstyle - character (kind=C_char), dimension(len_trim(id)+1) :: Cid - Cid = string2Cstring (id) - Cstyle = int(style, C_int) - Cvectorsize = lammps_actual_extract_fix_vectorsize (ptr, Cid, Cstyle) - vectorsize = int(Cvectorsize, kind(vectorsize)) - end function lammps_extract_fix_vectorsize - -!----------------------------------------------------------------------------- - - subroutine lammps_extract_compute_arraysize (ptr, id, style, nrows, ncols) - type (C_ptr), intent(in) :: ptr - character (len=*), intent(in) :: id - integer, intent(in) :: style - integer, intent(out) :: nrows, ncols - integer (C_int) :: Cstyle, Cnrows, Cncols - character (kind=C_char), dimension(len_trim(id)+1) :: Cid - Cid = string2Cstring (id) - Cstyle = int (style, C_int) - call lammps_actual_extract_compute_arraysize (ptr, Cid, Cstyle, & - Cnrows, Cncols) - nrows = int (Cnrows, kind(nrows)) - ncols = int (Cncols, kind(ncols)) - end subroutine lammps_extract_compute_arraysize - -!----------------------------------------------------------------------------- - - subroutine lammps_extract_fix_arraysize (ptr, id, style, nrows, ncols) - type (C_ptr), intent(in) :: ptr - character (len=*), intent(in) :: id - integer, intent(in) :: style - integer, intent(out) :: nrows, ncols - integer (C_int) :: Cstyle, Cnrows, Cncols - character (kind=C_char), dimension(len_trim(id)+1) :: Cid - Cid = string2Cstring (id) - Cstyle = int (style, kind(Cstyle)) - call lammps_actual_extract_fix_arraysize (ptr, Cid, Cstyle, & - Cnrows, Cncols) - nrows = int (Cnrows, kind(nrows)) - ncols = int (Cncols, kind(ncols)) - end subroutine lammps_extract_fix_arraysize - -!----------------------------------------------------------------------------- - - subroutine lammps_error_all (ptr, file, line, str) - type (C_ptr), intent(in) :: ptr - character (len=*), intent(in) :: file, str - integer, intent(in) :: line - character (kind=C_char), dimension(len_trim(file)+1) :: Cfile - character (kind=C_char), dimension(len_trim(str)+1) :: Cstr - integer (C_int) :: Cline - Cline = int(line, kind(Cline)) - Cfile = string2Cstring (file) - Cstr = string2Cstring (str) - call lammps_actual_error_all (ptr, Cfile, Cline, Cstr) - end subroutine lammps_error_all - -!----------------------------------------------------------------------------- - -! Locally defined helper functions {{{1 - - pure function string2Cstring (string) result (C_string) - use, intrinsic :: ISO_C_binding, only : C_char, C_NULL_CHAR - character (len=*), intent(in) :: string - character (len=1, kind=C_char) :: C_string (len_trim(string)+1) - integer :: i, n - n = len_trim (string) - forall (i = 1:n) - C_string(i) = string(i:i) - end forall - C_string(n+1) = C_NULL_CHAR - end function string2Cstring - -!----------------------------------------------------------------------------- - - subroutine Cstring2argcargv (Cstring, argc, argv) - !! Converts a C-style string to argc and argv, that is, words in Cstring - !! become C-style strings in argv. IMPORTANT: Cstring is modified by - !! this routine! I would make Cstring local TO this routine and accept - !! a Fortran-style string instead, but we run into scoping and - !! allocation problems that way. This routine assumes the string is - !! null-terminated, as all C-style strings must be. - - character (kind=C_char), dimension(*), target, intent(inout) :: Cstring - integer (C_int), intent(out) :: argc - type (C_ptr), dimension(:), allocatable, intent(out) :: argv - - integer :: StringStart, SpaceIndex, strlen, argnum - - argc = 1_C_int - - ! Find the length of the string - strlen = 1 - do while ( Cstring(strlen) /= C_NULL_CHAR ) - strlen = strlen + 1 - end do - - ! Find the number of non-escaped spaces - SpaceIndex = 2 - do while ( SpaceIndex < strlen ) - if ( Cstring(SpaceIndex) == ' ' .and. & - Cstring(SpaceIndex-1) /= '\' ) then - argc = argc + 1_C_int - ! Find the next non-space character - do while ( Cstring(SpaceIndex+1) == ' ') - SpaceIndex = SpaceIndex + 1 - end do - end if - SpaceIndex = SpaceIndex + 1 - end do - - ! Now allocate memory for argv - allocate (argv(argc)) - - ! Now find the string starting and ending locations - StringStart = 1 - SpaceIndex = 2 - argnum = 1 - do while ( SpaceIndex < strlen ) - if ( Cstring(SpaceIndex) == ' ' .and. & - Cstring(SpaceIndex-1) /= '\' ) then - ! Found a real space => split strings and store this one - Cstring(Spaceindex) = C_NULL_CHAR ! Replaces space with NULL - argv(argnum) = C_loc(Cstring(StringStart)) - argnum = argnum + 1 - ! Find the next non-space character - do while ( Cstring(SpaceIndex+1) == ' ') - SpaceIndex = SpaceIndex + 1 - end do - StringStart = SpaceIndex + 1 - else if ( Cstring(SpaceIndex) == ' ' .and. & - Cstring(SpaceIndex-1) == '\' ) then - ! Escaped space => remove backslash and move rest of array - Cstring(SpaceIndex-1:strlen-1) = Cstring(SpaceIndex:strlen) - strlen = strlen - 1 ! Last character is still C_NULL_CHAR - end if - SpaceIndex = SpaceIndex + 1 - end do - ! Now handle the last argument - argv(argnum) = C_loc(Cstring(StringStart)) - - end subroutine Cstring2argcargv - -! 1}}} - -end module LAMMPS - -! vim: foldmethod=marker tabstop=3 softtabstop=3 shiftwidth=3 expandtab diff --git a/examples/COUPLE/fortran_dftb/README b/examples/COUPLE/fortran_dftb/README deleted file mode 100644 index 39a2f18169..0000000000 --- a/examples/COUPLE/fortran_dftb/README +++ /dev/null @@ -1,37 +0,0 @@ -This directory has an example of using a callback function to obtain -forces from a fortran code for a LAMMPS simulation. The reader should -refer to the README file in COUPLE/fortran2 before proceeding. Here, -the LAMMPS.F90 file has been modified slightly and additional files -named LAMMPS-wrapper2.h and LAMMPS-wrapper2.cpp have been included in -order to supply wrapper functions to set the LAMMPS callback function, -total energy, virial, and electronic entropy contribution (needed for -MSST simulations with a quantum code). - -In this example, the callback function is set to run the -semi-empirical quantum code DFTB+ in serial and then read in the total -energy, forces, and stress tensor from file. In this case, nlocal = -the total number of atoms in the system, so particle positions can be -read from the pos array directly, and DFTB+ forces can simply be -included via the fext array. The user should take care in the case of -a parallel calculation, where LAMMPS can assign different particules -to each processor. For example, the user should use functions such as -lammps_gather_atoms() and lammps_scatter_atoms() in the case where the -fortran force calculating code requires the positions of all atoms, -etc. - -A few more important notes: - --Calling the subroutine lammps_set_callback() is required in order to set - a pointer to the callback function in LAMMPS. --The subroutine lammps_set_user_energy() passes in the potential energy - from DFTB+ to LAMMPS. Similarly, lammps_set_user_virial passes the stress tensor. - --The electronic entropy contribution is set via lammps_set_external_vector(). Their needs - to be a call to lammps_set_external_vector_length() before this value can be - passed to LAMMPS. - -This example was created by Nir Goldman, whom you can contact with -questions: - -Nir Goldman, LLNL -ngoldman@llnl.gov diff --git a/examples/COUPLE/fortran_dftb/data.diamond b/examples/COUPLE/fortran_dftb/data.diamond deleted file mode 100644 index b3dd599cf4..0000000000 --- a/examples/COUPLE/fortran_dftb/data.diamond +++ /dev/null @@ -1,148 +0,0 @@ -# Position data file - -64 atoms -1 atom types - -0 7.134 xlo xhi -0 7.134 ylo yhi -0 7.134 zlo zhi - -0.00000000 0.00000000 0.00000000 xy xz yz - -Masses - -1 12.010000 - -Atoms - - 1 1 0 0 0 0 - 2 1 0 0.89175 0.89175 0.89175 - 3 1 0 1.7835 1.7835 0 - 4 1 0 2.67525 2.67525 0.89175 - 5 1 0 0 1.7835 1.7835 - 6 1 0 0.89175 2.67525 2.67525 - 7 1 0 1.7835 0 1.7835 - 8 1 0 2.67525 0.89175 2.67525 - 9 1 0 0 0 3.567 - 10 1 0 0.89175 0.89175 4.45875 - 11 1 0 1.7835 1.7835 3.567 - 12 1 0 2.67525 2.67525 4.45875 - 13 1 0 0 1.7835 5.3505 - 14 1 0 0.89175 2.67525 6.24225 - 15 1 0 1.7835 0 5.3505 - 16 1 0 2.67525 0.89175 6.24225 - 17 1 0 0 3.567 0 - 18 1 0 0.89175 4.45875 0.89175 - 19 1 0 1.7835 5.3505 0 - 20 1 0 2.67525 6.24225 0.89175 - 21 1 0 0 5.3505 1.7835 - 22 1 0 0.89175 6.24225 2.67525 - 23 1 0 1.7835 3.567 1.7835 - 24 1 0 2.67525 4.45875 2.67525 - 25 1 0 0 3.567 3.567 - 26 1 0 0.89175 4.45875 4.45875 - 27 1 0 1.7835 5.3505 3.567 - 28 1 0 2.67525 6.24225 4.45875 - 29 1 0 0 5.3505 5.3505 - 30 1 0 0.89175 6.24225 6.24225 - 31 1 0 1.7835 3.567 5.3505 - 32 1 0 2.67525 4.45875 6.24225 - 33 1 0 3.567 0 0 - 34 1 0 4.45875 0.89175 0.89175 - 35 1 0 5.3505 1.7835 0 - 36 1 0 6.24225 2.67525 0.89175 - 37 1 0 3.567 1.7835 1.7835 - 38 1 0 4.45875 2.67525 2.67525 - 39 1 0 5.3505 0 1.7835 - 40 1 0 6.24225 0.89175 2.67525 - 41 1 0 3.567 0 3.567 - 42 1 0 4.45875 0.89175 4.45875 - 43 1 0 5.3505 1.7835 3.567 - 44 1 0 6.24225 2.67525 4.45875 - 45 1 0 3.567 1.7835 5.3505 - 46 1 0 4.45875 2.67525 6.24225 - 47 1 0 5.3505 0 5.3505 - 48 1 0 6.24225 0.89175 6.24225 - 49 1 0 3.567 3.567 0 - 50 1 0 4.45875 4.45875 0.89175 - 51 1 0 5.3505 5.3505 0 - 52 1 0 6.24225 6.24225 0.89175 - 53 1 0 3.567 5.3505 1.7835 - 54 1 0 4.45875 6.24225 2.67525 - 55 1 0 5.3505 3.567 1.7835 - 56 1 0 6.24225 4.45875 2.67525 - 57 1 0 3.567 3.567 3.567 - 58 1 0 4.45875 4.45875 4.45875 - 59 1 0 5.3505 5.3505 3.567 - 60 1 0 6.24225 6.24225 4.45875 - 61 1 0 3.567 5.3505 5.3505 - 62 1 0 4.45875 6.24225 6.24225 - 63 1 0 5.3505 3.567 5.3505 - 64 1 0 6.24225 4.45875 6.24225 - -Velocities - -1 -0.00733742 -0.0040297 -0.00315229 -2 -0.00788609 -0.00567535 -0.00199152 -3 -0.00239042 0.00710139 -0.00335049 -4 0.00678551 0.0019976 0.00219289 -5 0.00413717 0.00275709 0.000937637 -6 -0.00126313 0.00485636 0.00727862 -7 0.00337547 -0.00234623 -0.000922223 -8 -0.00792183 -0.00509186 -0.00104168 -9 0.00414091 0.00390285 0.000845961 -10 -0.000284543 0.0010771 -0.00458404 -11 -0.00394968 -0.00446363 -0.00361688 -12 0.00067088 -0.00655175 -0.00752464 -13 0.00306632 -0.00245545 -0.00183867 -14 -0.0082145 -0.00564127 0.000281191 -15 0.00504454 0.0045835 0.000495763 -16 0.0035767 0.00320441 -0.00486426 -17 0.00420597 0.00262005 -0.0049459 -18 0.00440579 -1.76783e-05 0.00449311 -19 -0.00406463 0.00613304 0.00285599 -20 0.00171215 -0.00517887 0.00124326 -21 0.0011118 0.00334129 -0.0015222 -22 -0.00838394 -0.00112906 -0.00353379 -23 -0.00578527 -0.00415501 0.00297043 -24 -0.00211466 0.000964108 -0.00716523 -25 -0.000204107 -0.00380986 0.00681648 -26 0.00677838 0.00540935 0.0044354 -27 -0.00266809 -0.00358382 -0.00241889 -28 -0.0003973 0.00236566 0.00558871 -29 0.000754103 0.00457797 0.000105531 -30 -0.00246049 0.00110428 0.00511088 -31 0.00248891 0.00623314 0.00461597 -32 -0.00509423 0.000570503 0.00720856 -33 -0.00244427 -0.00374384 0.00618767 -34 -0.000360752 -8.10558e-05 0.00314052 -35 0.00435313 -0.00630587 -0.0070309 -36 0.00651087 -0.00389833 3.72525e-05 -37 0.00631828 -0.00316064 0.00231522 -38 -0.00579624 -0.00345068 -0.000277486 -39 0.00483974 0.000715028 0.000206355 -40 -0.00388164 -0.00189242 -0.00554862 -41 0.00398115 0.00152915 0.00756919 -42 -0.000552263 0.00352025 -0.000246143 -43 -0.00800284 0.00555703 0.00425716 -44 -0.00734405 -0.00752512 0.00667173 -45 -0.00545636 0.00421035 0.00399552 -46 0.00480246 0.00621147 -0.00492715 -47 -0.00424168 0.00621818 -9.37733e-05 -48 -0.00649561 0.00612908 -0.0020753 -49 -0.0075007 -0.00384737 -0.00687913 -50 -0.00203903 -0.00764372 0.0023883 -51 0.00442642 0.00744072 -0.0049344 -52 -0.00280486 -0.00509128 -0.00678045 -53 0.00679491 0.00583493 0.00333875 -54 0.00574665 -0.00521074 0.00523475 -55 0.00305618 -0.00320094 0.00341297 -56 0.004304 0.000615544 -0.00668787 -57 0.00564532 0.00327373 0.00388611 -58 0.000676899 0.00210326 0.00495295 -59 0.000160781 -0.00744313 -0.00279828 -60 0.00623521 0.00371301 0.00178015 -61 0.00520759 0.000642669 0.00207913 -62 0.00398042 0.0046438 -0.00359978 -63 -0.00478071 -0.00304932 -0.00765125 -64 0.00282671 -0.00548392 -0.00692691 diff --git a/examples/COUPLE/fortran_dftb/dftb_in.hsd b/examples/COUPLE/fortran_dftb/dftb_in.hsd deleted file mode 100644 index 104a4c04ce..0000000000 --- a/examples/COUPLE/fortran_dftb/dftb_in.hsd +++ /dev/null @@ -1,40 +0,0 @@ -#sample DFTB+ script to run this test code -Geometry = GenFormat { -<<< "lammps.gen" -} - -Driver = { -} - -Hamiltonian = DFTB { - LAMMPS = Yes # keyword to print energy, forces, and stress tensor to file(results.out) - SCC = No - MaxAngularMomentum = { - C = "p" - } - Charge = 0.0 - Eigensolver = Standard {} - Filling = Fermi { - Temperature [Kelvin] = 298.0 - } - SlaterKosterFiles = Type2FileNames { - Prefix = "~/slako/mio-1-1/" # the user must define the location of the skf files - Separator = "-" - Suffix = ".skf" - LowerCaseTypeName = No - } - KPointsAndWeights = { - 0.0000000000000 0.0000000000000 0.0000000000000 1.00000000000000 - } -} - -Options = { - CalculateForces = Yes - WriteDetailedOut = No - WriteBandOut = No - RandomSeed = 12345 -} - -ParserOptions = { - ParserVersion = 3 -} diff --git a/examples/COUPLE/fortran_dftb/dftb_pin.hsd b/examples/COUPLE/fortran_dftb/dftb_pin.hsd deleted file mode 100644 index 6d9dea4a15..0000000000 --- a/examples/COUPLE/fortran_dftb/dftb_pin.hsd +++ /dev/null @@ -1,129 +0,0 @@ -Geometry = GenFormat { -64 S -C -1 1 7.099007 7.117657 7.119139 -2 1 0.858709 0.867233 0.882294 -3 1 1.772527 1.811776 7.120239 -4 1 2.702145 2.681271 0.901362 -5 1 0.017539 1.794455 1.788454 -6 1 0.885593 2.694118 2.707994 -7 1 1.795055 7.120787 1.777896 -8 1 2.642849 0.868278 2.670699 -9 1 0.016060 0.017156 3.568644 -10 1 0.891891 0.896406 4.439286 -11 1 1.766086 1.764402 3.550134 -12 1 2.677349 2.648926 4.427174 -13 1 0.010133 1.771283 5.342173 -14 1 0.858153 2.653565 6.241596 -15 1 1.804087 0.020636 5.353268 -16 1 2.689680 0.907188 6.224575 -17 1 0.017845 3.577563 7.113016 -18 1 0.910027 4.459286 0.910286 -19 1 1.766394 5.376046 0.015526 -20 1 2.683727 6.220728 0.898553 -21 1 0.003357 5.363423 1.774139 -22 1 0.856735 6.238324 2.660213 -23 1 1.761079 3.549776 1.797054 -24 1 2.667227 4.463441 2.646074 -25 1 7.132499 3.551558 3.599764 -26 1 0.920387 4.482191 4.479257 -27 1 1.772194 5.337132 3.555569 -28 1 2.675010 6.251629 4.483124 -29 1 0.005702 5.371095 5.351147 -30 1 0.880807 6.249819 6.264231 -31 1 1.793177 3.592396 5.369939 -32 1 2.653179 4.463595 6.274044 -33 1 3.557243 7.118913 0.026006 -34 1 4.458971 0.889331 0.904950 -35 1 5.367903 1.759757 7.104941 -36 1 6.271565 2.658454 0.890168 -37 1 3.591915 1.768681 1.793880 -38 1 4.435612 2.662184 2.676722 -39 1 5.371040 0.000196 1.783464 -40 1 6.226453 0.886640 2.653384 -41 1 3.583339 0.005449 3.600177 -42 1 4.453692 0.909417 4.459713 -43 1 5.314554 1.805409 3.584215 -44 1 6.210181 2.642660 4.486206 -45 1 3.545704 1.802745 5.365369 -46 1 4.476660 2.701226 6.220451 -47 1 5.332820 0.029557 5.347965 -48 1 6.215725 0.915081 6.230289 -49 1 3.536446 3.551469 7.106600 -50 1 4.451181 4.426439 0.900180 -51 1 5.368735 5.377996 7.109524 -52 1 6.230666 6.220985 0.862175 -53 1 3.596626 5.372822 1.797613 -54 1 4.485613 6.221252 2.699652 -55 1 5.364421 3.549838 1.796281 -56 1 6.261739 4.459046 2.648152 -57 1 3.588752 3.581054 3.581755 -58 1 4.462342 4.467270 4.478800 -59 1 5.355202 5.318323 3.556531 -60 1 6.268570 6.259831 4.465795 -61 1 3.588636 5.354278 5.362327 -62 1 4.475747 6.263866 6.227803 -63 1 5.331158 3.554349 5.318368 -64 1 6.254581 4.436344 6.209681 -0.0 0.0 0.0 -7.13400000000000 0 0 -0 7.13400000000000 0 -0 0 7.13400000000000 -} -Driver = {} -Hamiltonian = DFTB { - LAMMPS = Yes - SCC = No - MaxAngularMomentum = { - C = "p" - } - Charge = 0.0 - Eigensolver = Standard {} - Filling = Fermi { - Temperature [Kelvin] = 298.0 - IndependentKFilling = No - } - SlaterKosterFiles = Type2FileNames { - Prefix = "~/slako/mio-1-1/" - Separator = "-" - Suffix = ".skf" - LowerCaseTypeName = No - } - KPointsAndWeights = { -0.0000000000000 0.0000000000000 0.0000000000000 1.00000000000000 - } - PolynomialRepulsive = {} - OldRepulsiveSum = No - OrbitalResolvedSCC = No - OldSKInterpolation = No - NoErep = No - Dispersion = {} - ThirdOrder = No - ThirdOrderFull = No -} -Options = { - CalculateForces = Yes - WriteDetailedOut = No - WriteBandOut = No - RandomSeed = 12345 - MullikenAnalysis = No - WriteEigenvectors = No - WriteAutotestTag = No - WriteDetailedXML = No - WriteResultsTag = No - AtomResolvedEnergies = No - WriteHS = No - WriteRealHS = No - MinimiseMemoryUsage = No - ShowFoldedCoords = No -} -ParserOptions = { - ParserVersion = 3 - WriteHSDInput = Yes - WriteXMLInput = No - StopAfterParsing = No - IgnoreUnprocessedNodes = No -} -Analysis = { - ProjectStates = {} -} diff --git a/examples/COUPLE/fortran_dftb/in.simple b/examples/COUPLE/fortran_dftb/in.simple deleted file mode 100644 index 894a490cf8..0000000000 --- a/examples/COUPLE/fortran_dftb/in.simple +++ /dev/null @@ -1,16 +0,0 @@ -units real -atom_style charge -atom_modify map array -atom_modify sort 0 0.0 -read_data data.diamond -neighbor 1.0 bin -neigh_modify delay 0 every 5 check no -fix 1 all nve -fix 2 all external pf/callback 1 1 - -fix_modify 2 energy yes -thermo_style custom step temp etotal ke pe lx ly lz pxx pyy pzz press - -thermo 1 -timestep 0.5 - diff --git a/examples/COUPLE/fortran_dftb/log.simple b/examples/COUPLE/fortran_dftb/log.simple deleted file mode 100644 index 3496e94ebe..0000000000 --- a/examples/COUPLE/fortran_dftb/log.simple +++ /dev/null @@ -1,71 +0,0 @@ -LAMMPS (6 Jul 2017) -units real -atom_style charge -atom_modify map array -atom_modify sort 0 0.0 -read_data data.diamond - triclinic box = (0 0 0) to (7.134 7.134 7.134) with tilt (0 0 0) - 1 by 1 by 1 MPI processor grid - reading atoms ... - 64 atoms - reading velocities ... - 64 velocities -neighbor 1.0 bin -neigh_modify delay 0 every 5 check no -fix 1 all nve -fix 2 all external pf/callback 1 1 - -fix_modify 2 energy yes -thermo_style custom step temp etotal ke pe lx ly lz pxx pyy pzz press - -thermo 1 -timestep 0.5 - -run 10 -Neighbor list info ... - update every 5 steps, delay 0 steps, check no - max neighbors/atom: 2000, page size: 100000 - master list distance cutoff = 0 - ghost atom cutoff = 0 - binsize = 7.134, bins = 1 1 1 - 0 neighbor lists, perpetual/occasional/extra = 0 0 0 -Per MPI rank memory allocation (min/avg/max) = 2.3 | 2.3 | 2.3 Mbytes -Step Temp TotEng KinEng PotEng Lx Ly Lz Pxx Pyy Pzz Press - 0 298.24835 -69593.587 56.008365 -69649.595 7.134 7.134 7.134 -19980.19 -21024.038 -21097.458 -20700.562 - 1 295.24358 -69593.585 55.444098 -69649.029 7.134 7.134 7.134 -19778.833 -20799.657 -20854.156 -20477.549 - 2 286.37211 -69593.58 53.778115 -69647.358 7.134 7.134 7.134 -19227.52 -20177.28 -20176.12 -19860.306 - 3 272.062 -69593.572 51.090804 -69644.663 7.134 7.134 7.134 -18360.869 -19189.684 -19100.021 -18883.525 - 4 253.01834 -69593.561 47.514575 -69641.075 7.134 7.134 7.134 -17198.143 -17855.03 -17652.036 -17568.403 - 5 230.19242 -69593.547 43.228073 -69636.775 7.134 7.134 7.134 -15750.247 -16183.764 -15854.145 -15929.386 - 6 204.71787 -69593.533 38.44418 -69631.977 7.134 7.134 7.134 -14083.498 -14247.434 -13789.835 -14040.256 - 7 177.82397 -69593.518 33.393748 -69626.911 7.134 7.134 7.134 -12340.963 -12202.878 -11623.171 -12055.671 - 8 150.76736 -69593.503 28.312758 -69621.816 7.134 7.134 7.134 -10637.824 -10180.827 -9495.0496 -10104.567 - 9 124.7737 -69593.49 23.431383 -69616.921 7.134 7.134 7.134 -9113.3842 -8339.0492 -7572.8076 -8341.747 - 10 100.98183 -69593.478 18.963481 -69612.442 7.134 7.134 7.134 -7833.9349 -6756.9749 -5945.8968 -6845.6022 -Loop time of 2.20497 on 1 procs for 10 steps with 64 atoms - -Performance: 0.196 ns/day, 122.499 hours/ns, 4.535 timesteps/s -0.2% 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 | 1.4305e-06 | 1.4305e-06 | 1.4305e-06 | 0.0 | 0.00 -Comm | 4.22e-05 | 4.22e-05 | 4.22e-05 | 0.0 | 0.00 -Output | 0.00067687 | 0.00067687 | 0.00067687 | 0.0 | 0.03 -Modify | 2.2042 | 2.2042 | 2.2042 | 0.0 | 99.96 -Other | | 6.533e-05 | | | 0.00 - -Nlocal: 64 ave 64 max 64 min -Histogram: 1 0 0 0 0 0 0 0 0 0 -Nghost: 0 ave 0 max 0 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 - -Total # of neighbors = 0 -Ave neighs/atom = 0 -Neighbor list builds = 2 -Dangerous builds not checked -Total wall time: 0:00:02 diff --git a/examples/COUPLE/fortran_dftb/makefile b/examples/COUPLE/fortran_dftb/makefile deleted file mode 100644 index 225bd0025a..0000000000 --- a/examples/COUPLE/fortran_dftb/makefile +++ /dev/null @@ -1,45 +0,0 @@ -SHELL = /bin/sh - -# Path to LAMMPS extraction directory -LAMMPS_ROOT = ../../.. -LAMMPS_SRC = $(LAMMPS_ROOT)/src - -# Uncomment the line below if using the MPI stubs library -MPI_STUBS = #-I$(LAMMPS_SRC)/STUBS - -FC = mpif90 # replace with your Fortran compiler -CXX = mpicc # replace with your C++ compiler - -# Flags for Fortran compiler, C++ compiler, and C preprocessor, respectively -FFLAGS = -O2 -fPIC -CXXFLAGS = -O2 -fPIC -CPPFLAGS = -DOMPI_SKIP_MPICXX=1 -DMPICH_SKIP_MPICXX - -all : liblammps_fortran.a liblammps_fortran.so simpleF.x - -liblammps_fortran.so : LAMMPS.o LAMMPS-wrapper.o LAMMPS-wrapper2.o - $(FC) $(FFLAGS) -shared -o $@ $^ - -simpleF.x: simple.o LAMMPS.o LAMMPS-wrapper.o LAMMPS-wrapper2.o - $(FC) $(FFLAGS) simple.o -o simpleF.x liblammps_fortran.a $(LAMMPS_SRC)/liblammps_mvapich.a -lstdc++ /usr/lib64/libfftw3.a - -liblammps_fortran.a : LAMMPS.o LAMMPS-wrapper.o LAMMPS-wrapper2.o - $(AR) rs $@ $^ - -LAMMPS.o lammps.mod : LAMMPS.F90 - $(FC) $(CPPFLAGS) $(FFLAGS) -c $< - -simple.o : simple.f90 - $(FC) $(FFLAGS) -c $< - -LAMMPS-wrapper.o : LAMMPS-wrapper.cpp LAMMPS-wrapper.h - $(CXX) $(CPPFLAGS) $(CXXFLAGS) -c $< -I$(LAMMPS_SRC) $(MPI_STUBS) - -LAMMPS-wrapper2.o : LAMMPS-wrapper2.cpp LAMMPS-wrapper2.h - $(CXX) $(CPPFLAGS) $(CXXFLAGS) -c $< -I$(LAMMPS_SRC) $(MPI_STUBS) - -clean : - $(RM) *.o *.mod liblammps_fortran.a liblammps_fortran.so - -dist : - tar -czvf fortran-interface-callback.tar.gz LAMMPS-wrapper.h LAMMPS-wrapper.cpp LAMMPS-wrapper2.h LAMMPS-wrapper2.cpp LAMMPS.F90 makefile README simple.f90 diff --git a/examples/COUPLE/fortran_dftb/simple.f90 b/examples/COUPLE/fortran_dftb/simple.f90 deleted file mode 100644 index 4604b4e4a9..0000000000 --- a/examples/COUPLE/fortran_dftb/simple.f90 +++ /dev/null @@ -1,110 +0,0 @@ - module callback - implicit none - contains - subroutine fortran_callback(lmp, timestep, nlocal, ids, c_pos, c_fext) & - & bind(C, name='f_callback') - use, intrinsic :: ISO_C_binding - use LAMMPS - implicit none - type (C_ptr), value :: lmp - integer(C_int64_t), intent(in), value :: timestep - integer(C_int), intent(in), value :: nlocal - real (C_double), dimension(:,:), pointer :: x - type(c_ptr) :: c_pos, c_fext, c_ids - double precision, pointer :: fext(:,:), pos(:,:) - integer, intent(in) :: ids(nlocal) - real(C_double) :: virial(6) - real (C_double) :: etot - real(C_double), pointer :: ts_lmp - double precision :: stress(3,3), ts_dftb - integer :: natom , i - real (C_double), parameter :: econv = 627.4947284155114 ! converts from Ha to - double precision, parameter :: fconv = 1185.793095983065 ! converts from Ha/bohr to - double precision, parameter :: autoatm = 2.9037166638E8 - double precision lx, ly, lz - real (C_double), pointer :: boxxlo, boxxhi - real (C_double), pointer :: boxylo, boxyhi - real (C_double), pointer :: boxzlo, boxzhi - double precision, parameter :: nktv2p = 68568.4149999999935972 - double precision :: volume - type (C_ptr) :: Cptr - type (C_ptr), pointer, dimension(:) :: Catom - - call c_f_pointer(c_pos, pos, [3,nlocal]) - call c_f_pointer(c_fext, fext, [3,nlocal]) - call lammps_extract_global(boxxlo, lmp, 'boxxlo') - call lammps_extract_global(boxxhi, lmp, 'boxxhi') - call lammps_extract_global(boxylo, lmp, 'boxylo') - call lammps_extract_global(boxyhi, lmp, 'boxyhi') - call lammps_extract_global(boxzlo, lmp, 'boxzlo') - call lammps_extract_global(boxzhi, lmp, 'boxzhi') - lx = boxxhi - boxxlo - ly = boxyhi - boxylo - lz = boxzhi - boxzlo - volume = lx*ly*lz - open (unit = 10, status = 'replace', action = 'write', file='lammps.gen') - write(10,*)nlocal,"S" - write(10,*) "C" - do i = 1, nlocal - write(10,'(2I,3F15.6)')i,1,pos(:,ids(i)) - enddo - write(10,*)"0.0 0.0 0.0" - write(10,*)lx,0,0 - write(10,*)0,ly,0 - write(10,*)0,0,lz - close(10) - call system("./dftb+ > dftb.out") - open (unit = 10, status = 'old', file = 'results.out') - read(10,*)etot - read(10,*)ts_dftb - do i = 1, 3 - read(10,*)stress(i,:) - enddo - stress (:,:) = stress(:,:)*autoatm - virial(1) = stress(1,1)/(nktv2p/volume) - virial(2) = stress(2,2)/(nktv2p/volume) - virial(3) = stress(3,3)/(nktv2p/volume) - virial(4) = stress(1,2)/(nktv2p/volume) - virial(5) = stress(1,3)/(nktv2p/volume) - virial(6) = stress(2,3)/(nktv2p/volume) - etot = etot*econv - call lammps_set_external_vector(lmp,1,ts_dftb*econv) - do i = 1, nlocal - read(10,*)fext(:,ids(i)) - fext(:,ids(i)) = fext(:,ids(i))*fconv - enddo - close(10) - call lammps_set_user_energy (lmp, etot) - call lammps_set_user_virial (lmp, virial) - - end subroutine - end module callback - - -program simple_fortran_callback - - use MPI - use LAMMPS - use callback - use, intrinsic :: ISO_C_binding, only : C_double, C_ptr, C_int, C_FUNPTR - implicit none - type (C_ptr) :: lmp - integer :: error, narg, me, nprocs - - call MPI_Init (error) - call MPI_Comm_rank (MPI_COMM_WORLD, me, error) - call MPI_Comm_size (MPI_COMM_WORLD, nprocs, error) - - call lammps_open_no_mpi ('lmp -log log.simple', lmp) - call lammps_file (lmp, 'in.simple') - call lammps_set_callback(lmp) - call lammps_set_external_vector_length(lmp,2) - - call lammps_command (lmp, 'run 10') - call lammps_close (lmp) - call MPI_Finalize (error) - - -end program simple_fortran_callback - - From e2e9170dfa8ddcd9bce8f3376619b8993537c46c Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Sat, 17 Jun 2023 18:52:57 -0400 Subject: [PATCH 293/396] protect a couple more fixes from segfaults from errors in derived classes --- src/RIGID/fix_rigid.cpp | 2 +- src/fix_langevin.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/RIGID/fix_rigid.cpp b/src/RIGID/fix_rigid.cpp index df49d84439..44427d2914 100644 --- a/src/RIGID/fix_rigid.cpp +++ b/src/RIGID/fix_rigid.cpp @@ -610,7 +610,7 @@ FixRigid::~FixRigid() { // unregister callbacks to this fix from Atom class - atom->delete_callback(id,Atom::GROW); + if (modify->get_fix_by_id(id)) atom->delete_callback(id,Atom::GROW); delete random; delete[] inpfile; diff --git a/src/fix_langevin.cpp b/src/fix_langevin.cpp index 0e083ce012..35bffb24fa 100644 --- a/src/fix_langevin.cpp +++ b/src/fix_langevin.cpp @@ -203,7 +203,7 @@ FixLangevin::~FixLangevin() if (gjfflag) { memory->destroy(franprev); memory->destroy(lv); - atom->delete_callback(id, Atom::GROW); + if (modify->get_fix_by_id(id)) atom->delete_callback(id, Atom::GROW); } } From 70823cac50a1bfecce5ed484adc6c7010bba8056 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Sat, 17 Jun 2023 23:30:36 -0400 Subject: [PATCH 294/396] remove dead code --- python/lammps/pylammps.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/python/lammps/pylammps.py b/python/lammps/pylammps.py index bdbed3e971..c693b7d565 100644 --- a/python/lammps/pylammps.py +++ b/python/lammps/pylammps.py @@ -761,8 +761,6 @@ class PyLammps(object): for line in output: if line.startswith("Atom map"): system['atom_map'] = self._get_pair(line)[1] - elif line.startswith("Atoms"): - parts = self._split_values(line) elif line.startswith("Boundaries"): system['boundaries'] = self._get_pair(line)[1] elif line.startswith("Molecule type"): From 5196e4422be2059a68081c1197729fe0759660d2 Mon Sep 17 00:00:00 2001 From: Shern Tee Date: Sun, 18 Jun 2023 17:51:15 +1000 Subject: [PATCH 295/396] debug fix_modify press for press/berendsen --- src/fix_press_berendsen.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/fix_press_berendsen.cpp b/src/fix_press_berendsen.cpp index da49b3dbdb..e27a4560f0 100644 --- a/src/fix_press_berendsen.cpp +++ b/src/fix_press_berendsen.cpp @@ -491,7 +491,7 @@ int FixPressBerendsen::modify_param(int narg, char **arg) id_press = utils::strdup(arg[1]); pressure = modify->get_compute_by_id(arg[1]); - if (pressure) error->all(FLERR,"Could not find fix_modify pressure compute ID: {}", arg[1]); + if (!pressure) error->all(FLERR,"Could not find fix_modify pressure compute ID: {}", arg[1]); if (pressure->pressflag == 0) error->all(FLERR,"Fix_modify pressure compute {} does not compute pressure", arg[1]); return 2; From 2cea819e7fe05e1ee97e152a29eecd0701a20f5e Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Sun, 18 Jun 2023 07:24:42 -0400 Subject: [PATCH 296/396] cosmetic --- potentials/BNC.tersoff | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/potentials/BNC.tersoff b/potentials/BNC.tersoff index 046566dd99..a072aa05b3 100644 --- a/potentials/BNC.tersoff +++ b/potentials/BNC.tersoff @@ -1,4 +1,4 @@ -# DATE: 2013-03-21 UNITS: metal CONTRIBUTOR: Cem Sevik CITATION: Kinaci, Haskins, Sevik and Cagin, Phys Rev B, 86, 115410 (2012) +# DATE: 2013-03-21 UNITS: metal CONTRIBUTOR: Cem Sevik CITATION: Kinaci, Haskins, Sevik and Cagin, Phys Rev B, 86, 115410 (2012) # Tersoff parameters for B, C, and BN-C hybrid based graphene like nano structures # multiple entries can be added to this file, LAMMPS reads the ones it needs @@ -7,11 +7,11 @@ # other quantities are unitless # Cem Sevik (csevik at anadolu.edu.tr) takes full blame for this -# file. It specifies B-N, B-C, and N-C interaction parameters -# generated and published by the reseacrh group of Prof. Tahir Cagin. +# file. It specifies B-N, B-C, and N-C interaction parameters +# generated and published by the research group of Prof. Tahir Cagin. # 1. Physical Review B 84, 085409 2011 -# Characterization of thermal transport in low-dimensional boron nitride nanostructures, +# Characterization of thermal transport in low-dimensional boron nitride nanostructures, # # 2. Physical Review B 86, 075403 2012 @@ -22,14 +22,14 @@ # Thermal conductivity of BN-C nanostructures # -# The file also specifies C-C, interaction parameters +# The file also specifies C-C, interaction parameters # generated and published by the research group of Dr. D. A. Broido # Physical Review B 81, 205441 2010 -# Optimized Tersoff and Brenner empirical potential parameters for +# Optimized Tersoff and Brenner empirical potential parameters for # lattice dynamics and phonon thermal transport in carbon nanotubes and graphene # Users in referring the full parameters can cite the full parameter paper (3) as: -# A. Kinaci, J. B. Haskins, C. Sevik, T. Cagin, Physical Review B 86, 115410 (2012) +# A. Kinaci, J. B. Haskins, C. Sevik, T. Cagin, Physical Review B 86, 115410 (2012) # Thermal conductivity of BN-C nanostructures # @@ -38,11 +38,11 @@ # m, gamma, lambda3, c, d, costheta0, n, beta, lambda2, B, R, D, lambda1, A N B B 3.0 1.0 0.0 25000 4.3484 -0.89000 0.72751 1.25724e-7 2.199 340.00 1.95 0.05 3.568 1380.0 -N B N 3.0 1.0 0.0 25000 4.3484 -0.89000 0.72751 1.25724e-7 2.199 340.00 1.95 0.05 3.568 1380.0 +N B N 3.0 1.0 0.0 25000 4.3484 -0.89000 0.72751 1.25724e-7 2.199 340.00 1.95 0.05 3.568 1380.0 N B C 3.0 1.0 0.0 25000 4.3484 -0.89000 0.72751 1.25724e-7 2.199 340.00 1.95 0.05 3.568 1380.0 B N B 3.0 1.0 0.0 25000 4.3484 -0.89000 0.72751 1.25724e-7 2.199 340.00 1.95 0.05 3.568 1380.0 -B N N 3.0 1.0 0.0 25000 4.3484 -0.89000 0.72751 1.25724e-7 2.199 340.00 1.95 0.05 3.568 1380.0 +B N N 3.0 1.0 0.0 25000 4.3484 -0.89000 0.72751 1.25724e-7 2.199 340.00 1.95 0.05 3.568 1380.0 B N C 3.0 1.0 0.0 25000 4.3484 -0.89000 0.72751 1.25724e-7 2.199 340.00 1.95 0.05 3.568 1380.0 N N B 3.0 1.0 0.0 17.7959 5.9484 0.00000 0.6184432 0.019251 2.6272721 138.77866 2.0 0.1 2.8293093 128.86866 From 21fb50f37b264c7ec33cb34be97b76fbd0169578 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Sun, 18 Jun 2023 07:40:04 -0400 Subject: [PATCH 297/396] correct logic bug --- src/compute_chunk_spread_atom.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/compute_chunk_spread_atom.cpp b/src/compute_chunk_spread_atom.cpp index 933cf0af0c..53b8517c22 100644 --- a/src/compute_chunk_spread_atom.cpp +++ b/src/compute_chunk_spread_atom.cpp @@ -106,7 +106,7 @@ ComputeChunkSpreadAtom(LAMMPS *lmp, int narg, char **arg) : } else if (val.which == ArgInfo::FIX) { auto ifix = modify->get_fix_by_id(val.id); - if (ifix) + if (!ifix) error->all(FLERR,"Fix ID {} for compute chunk/spread/atom does not exist", val.id); if (val.argindex == 0) { if (!ifix->vector_flag) From 6ccf5f107c3767b0f1e42b4ced7cee141aaebff5 Mon Sep 17 00:00:00 2001 From: John Lucas Date: Sun, 18 Jun 2023 20:39:18 -0500 Subject: [PATCH 298/396] fix a bug in fix pair --- src/fix_pair.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/fix_pair.cpp b/src/fix_pair.cpp index 81e62ba966..66212684a8 100644 --- a/src/fix_pair.cpp +++ b/src/fix_pair.cpp @@ -283,11 +283,14 @@ void FixPair::post_force(int /*vflag*/) } else { double **parray = (double **) pvoid; - for (int i = 0; i < nlocal; i++) + int icoltmp = icol; + for (int i = 0; i < nlocal; i++) { + icol = icoltmp; for (int m = 0; m < columns; m++) { array[i][icol] = parray[i][m]; icol++; } + } } } From 542aa203dad3b18602b8b4ff58a1292ba4bb7f71 Mon Sep 17 00:00:00 2001 From: John Lucas Date: Sun, 18 Jun 2023 20:42:45 -0500 Subject: [PATCH 299/396] correct typo in fix pair documentation --- doc/src/fix_pair.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/src/fix_pair.rst b/doc/src/fix_pair.rst index 44c91f18ee..07e934d1c0 100644 --- a/doc/src/fix_pair.rst +++ b/doc/src/fix_pair.rst @@ -85,7 +85,7 @@ columns 4-6 will store the "uinp" values. .. code-block:: LAMMPS pair_style amoeba - fix ex all pair amoeba 10 uind 0 uinp 0 + fix ex all pair 10 amoeba uind 0 uinp 0 Restart, fix_modify, output, run start/stop, minimize info """"""""""""""""""""""""""""""""""""""""""""""""""""""""""" From 838be24af426e9769adde43ce7fdac1684b71bbe Mon Sep 17 00:00:00 2001 From: jtclemm Date: Mon, 19 Jun 2023 10:15:06 -0600 Subject: [PATCH 300/396] Fixing argument parsing increment --- src/BPM/bond_bpm.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/BPM/bond_bpm.cpp b/src/BPM/bond_bpm.cpp index da189ccaf5..d965a19067 100644 --- a/src/BPM/bond_bpm.cpp +++ b/src/BPM/bond_bpm.cpp @@ -189,11 +189,11 @@ void BondBPM::settings(int narg, char **arg) } else if (strcmp(arg[iarg], "overlay/pair") == 0) { if (iarg + 1 > narg) error->all(FLERR, "Illegal bond bpm command, missing option for overlay/pair"); overlay_flag = utils::logical(FLERR, arg[iarg + 1], false, lmp); - iarg++; + iarg += 2; } else if (strcmp(arg[iarg], "break") == 0) { if (iarg + 1 > narg) error->all(FLERR, "Illegal bond bpm command, missing option for break"); break_flag = utils::logical(FLERR, arg[iarg + 1], false, lmp); - iarg++; + iarg += 2; } else { leftover_iarg.push_back(iarg); iarg++; From af3d97102383772d3f96743d8afec8e93e54dfa4 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Mon, 19 Jun 2023 15:28:27 -0400 Subject: [PATCH 301/396] allow longer argument strings to avoid failues with unit tests --- examples/COUPLE/simple/simple.f90 | 2 +- fortran/lammps.f90 | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/examples/COUPLE/simple/simple.f90 b/examples/COUPLE/simple/simple.f90 index 3aafbee01b..d9505fff4d 100644 --- a/examples/COUPLE/simple/simple.f90 +++ b/examples/COUPLE/simple/simple.f90 @@ -30,7 +30,7 @@ PROGRAM f_driver REAL (kind=8), ALLOCATABLE :: x(:) REAL (kind=8), PARAMETER :: epsilon=0.1 - CHARACTER (len=64) :: arg + CHARACTER (len=1024) :: arg CHARACTER (len=1024) :: line ! setup MPI and various communicators diff --git a/fortran/lammps.f90 b/fortran/lammps.f90 index ba3997ac8e..28e40bca44 100644 --- a/fortran/lammps.f90 +++ b/fortran/lammps.f90 @@ -20,7 +20,7 @@ ! University of Missouri, 2012-2020 ! ! Contributing authors: -! - Axel Kohlmeyer , Temple University, 2020-2022 +! - Axel Kohlmeyer , Temple University, 2020-2023 ! - Karl D. Hammond , University of Missouri, 2022 ! ! The Fortran module tries to follow the API of the C library interface From 6791651b62b047da4d69889fc8343b47f6120f7e Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Tue, 20 Jun 2023 09:41:55 -0400 Subject: [PATCH 302/396] add else branch to make coverity scan happy --- src/REPLICA/fix_pimd_langevin.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/REPLICA/fix_pimd_langevin.cpp b/src/REPLICA/fix_pimd_langevin.cpp index 75280fd3d5..7ba502d2e6 100644 --- a/src/REPLICA/fix_pimd_langevin.cpp +++ b/src/REPLICA/fix_pimd_langevin.cpp @@ -906,7 +906,10 @@ void FixPIMDLangevin::langevin_init() Lan_c[i] = cos(_omega_np_dt_half); Lan_s[i] = sin(_omega_np_dt_half); } + } else { + error->universe_all(FLERR, "Unknown fmmode setting; only physical and normal are supported!"); } + if (tau > 0) gamma = 1.0 / tau; else From fcc3c99e2bf402abf683e9d4518d5732f5917348 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Tue, 20 Jun 2023 13:31:16 -0400 Subject: [PATCH 303/396] avoid segfaults if a dump is created and followed by run pre no --- src/MPIIO/dump_atom_mpiio.cpp | 2 ++ src/MPIIO/dump_custom_mpiio.cpp | 2 ++ src/dump.cpp | 39 ++++++++++----------------------- src/dump_atom.cpp | 9 ++++++-- src/dump_custom.cpp | 18 ++++++++------- src/dump_grid.cpp | 2 ++ src/dump_xyz.cpp | 7 +++--- 7 files changed, 39 insertions(+), 40 deletions(-) diff --git a/src/MPIIO/dump_atom_mpiio.cpp b/src/MPIIO/dump_atom_mpiio.cpp index 4e0fd47a29..844d1a46e4 100644 --- a/src/MPIIO/dump_atom_mpiio.cpp +++ b/src/MPIIO/dump_atom_mpiio.cpp @@ -283,6 +283,8 @@ void DumpAtomMPIIO::init_style() void DumpAtomMPIIO::write_header(bigint ndump) { + if (!header_choice) error->all(FLERR, "Must not use 'run pre no' after creating a new dump"); + (this->*header_choice)(ndump); } diff --git a/src/MPIIO/dump_custom_mpiio.cpp b/src/MPIIO/dump_custom_mpiio.cpp index 32e09675a8..80adefa325 100644 --- a/src/MPIIO/dump_custom_mpiio.cpp +++ b/src/MPIIO/dump_custom_mpiio.cpp @@ -309,6 +309,8 @@ void DumpCustomMPIIO::init_style() void DumpCustomMPIIO::write_header(bigint ndump) { + if (!header_choice) error->all(FLERR, "Must not use 'run pre no' after creating a new dump"); + (this->*header_choice)(ndump); } diff --git a/src/dump.cpp b/src/dump.cpp index 372773bbb2..c1a246ada2 100644 --- a/src/dump.cpp +++ b/src/dump.cpp @@ -1,4 +1,4 @@ -// clang-format off + // clang-format off /* ---------------------------------------------------------------------- LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator https://www.lammps.org/, Sandia National Laboratories @@ -41,14 +41,20 @@ Dump *Dump::dumpptr; #define BIG 1.0e20 #define EPSILON 1.0e-6 -enum{ASCEND,DESCEND}; +enum { ASCEND, DESCEND }; /* ---------------------------------------------------------------------- */ -Dump::Dump(LAMMPS *lmp, int /*narg*/, char **arg) : Pointers(lmp) +Dump::Dump(LAMMPS *lmp, int /*narg*/, char **arg) : + Pointers(lmp), multiname(nullptr), refresh(nullptr), skipvar(nullptr), format(nullptr), + format_default(nullptr), format_line_user(nullptr), format_float_user(nullptr), + format_int_user(nullptr), format_bigint_user(nullptr), format_column_user(nullptr), fp(nullptr), + nameslist(nullptr), buf(nullptr), sbuf(nullptr), ids(nullptr), bufsort(nullptr), + idsort(nullptr), index(nullptr), proclist(nullptr), xpbc(nullptr), vpbc(nullptr), + imagepbc(nullptr), irregular(nullptr) { - MPI_Comm_rank(world,&me); - MPI_Comm_size(world,&nprocs); + MPI_Comm_rank(world, &me); + MPI_Comm_size(world, &nprocs); id = utils::strdup(arg[0]); @@ -64,17 +70,7 @@ Dump::Dump(LAMMPS *lmp, int /*narg*/, char **arg) : Pointers(lmp) first_flag = 0; flush_flag = 1; - format = nullptr; - format_default = nullptr; - - format_line_user = nullptr; - format_float_user = nullptr; - format_int_user = nullptr; - format_bigint_user = nullptr; - format_column_user = nullptr; - refreshflag = 0; - refresh = nullptr; clearstep = 0; sort_flag = 0; @@ -92,25 +88,15 @@ Dump::Dump(LAMMPS *lmp, int /*narg*/, char **arg) : Pointers(lmp) has_id = 1; skipflag = 0; - skipvar = nullptr; maxfiles = -1; numfiles = 0; fileidx = 0; - nameslist = nullptr; maxbuf = maxids = maxsort = maxproc = 0; - buf = bufsort = nullptr; - ids = idsort = nullptr; - index = proclist = nullptr; - irregular = nullptr; - maxsbuf = 0; - sbuf = nullptr; maxpbc = -1; - xpbc = vpbc = nullptr; - imagepbc = nullptr; // parse filename for special syntax // if contains '%', write one file per proc and replace % with proc-ID @@ -120,18 +106,17 @@ Dump::Dump(LAMMPS *lmp, int /*narg*/, char **arg) : Pointers(lmp) // else if ends in .gz or other known extensions -> compressed text file // else ASCII text file - fp = nullptr; singlefile_opened = 0; compressed = 0; binary = 0; multifile = 0; + size_one = 0; multiproc = 0; nclusterprocs = nprocs; filewriter = 0; if (me == 0) filewriter = 1; fileproc = 0; - multiname = nullptr; char *ptr; if ((ptr = strchr(filename,'%'))) { diff --git a/src/dump_atom.cpp b/src/dump_atom.cpp index 1d3862ab26..656eef8c9d 100644 --- a/src/dump_atom.cpp +++ b/src/dump_atom.cpp @@ -1,4 +1,3 @@ -// clang-format off /* ---------------------------------------------------------------------- LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator https://www.lammps.org/, Sandia National Laboratories @@ -29,8 +28,10 @@ using namespace LAMMPS_NS; /* ---------------------------------------------------------------------- */ -DumpAtom::DumpAtom(LAMMPS *lmp, int narg, char **arg) : Dump(lmp, narg, arg) +DumpAtom::DumpAtom(LAMMPS *lmp, int narg, char **arg) : + Dump(lmp, narg, arg), header_choice(nullptr), pack_choice(nullptr) { + // clang-format off if (narg != 5) error->all(FLERR,"Illegal dump atom command"); scale_flag = 1; @@ -146,6 +147,8 @@ int DumpAtom::modify_param(int narg, char **arg) void DumpAtom::write_header(bigint ndump) { + if (!header_choice) error->all(FLERR, "Must not use 'run pre no' after creating a new dump"); + if (multiproc) (this->*header_choice)(ndump); else if (me == 0) (this->*header_choice)(ndump); } @@ -154,6 +157,8 @@ void DumpAtom::write_header(bigint ndump) void DumpAtom::pack(tagint *ids) { + if (!pack_choice) error->all(FLERR, "Must not use 'run pre no' after creating a new dump"); + (this->*pack_choice)(ids); } diff --git a/src/dump_custom.cpp b/src/dump_custom.cpp index 33cfba2cef..6a10641434 100644 --- a/src/dump_custom.cpp +++ b/src/dump_custom.cpp @@ -1,4 +1,3 @@ -// clang-format off /* ---------------------------------------------------------------------- LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator https://www.lammps.org/, Sandia National Laboratories @@ -53,13 +52,14 @@ enum{LT,LE,GT,GE,EQ,NEQ,XOR}; /* ---------------------------------------------------------------------- */ DumpCustom::DumpCustom(LAMMPS *lmp, int narg, char **arg) : - Dump(lmp, narg, arg), idregion(nullptr), thresh_array(nullptr), thresh_op(nullptr), - thresh_value(nullptr), thresh_last(nullptr), thresh_fix(nullptr), thresh_fixID(nullptr), - thresh_first(nullptr), earg(nullptr), vtype(nullptr), vformat(nullptr), columns(nullptr), - columns_default(nullptr), choose(nullptr), dchoose(nullptr), clist(nullptr), - field2index(nullptr), argindex(nullptr), id_compute(nullptr), compute(nullptr), id_fix(nullptr), - fix(nullptr), id_variable(nullptr), variable(nullptr), vbuf(nullptr), id_custom(nullptr), - custom(nullptr), custom_flag(nullptr), typenames(nullptr), pack_choice(nullptr) + Dump(lmp, narg, arg), idregion(nullptr), thresh_array(nullptr), thresh_op(nullptr), + thresh_value(nullptr), thresh_last(nullptr), thresh_fix(nullptr), thresh_fixID(nullptr), + thresh_first(nullptr), earg(nullptr), vtype(nullptr), vformat(nullptr), columns(nullptr), + columns_default(nullptr), choose(nullptr), dchoose(nullptr), clist(nullptr), + field2index(nullptr), argindex(nullptr), id_compute(nullptr), compute(nullptr), id_fix(nullptr), + fix(nullptr), id_variable(nullptr), variable(nullptr), vbuf(nullptr), id_custom(nullptr), + custom(nullptr), custom_flag(nullptr), typenames(nullptr), header_choice(nullptr), + pack_choice(nullptr) { if (narg == 5) error->all(FLERR,"No dump {} arguments specified", style); @@ -352,6 +352,8 @@ void DumpCustom::init_style() void DumpCustom::write_header(bigint ndump) { + if (!header_choice) error->all(FLERR, "Must not use 'run pre no' after creating a new dump"); + if (multiproc) (this->*header_choice)(ndump); else if (me == 0) (this->*header_choice)(ndump); } diff --git a/src/dump_grid.cpp b/src/dump_grid.cpp index 056cac1095..39d80ade11 100644 --- a/src/dump_grid.cpp +++ b/src/dump_grid.cpp @@ -311,6 +311,8 @@ void DumpGrid::init_style() void DumpGrid::write_header(bigint ndump) { + if (!header_choice) error->all(FLERR, "Must not use 'run pre no' after creating a new dump"); + if (multiproc) (this->*header_choice)(ndump); else if (me == 0) (this->*header_choice)(ndump); } diff --git a/src/dump_xyz.cpp b/src/dump_xyz.cpp index 83c4d180d6..241ec1c059 100644 --- a/src/dump_xyz.cpp +++ b/src/dump_xyz.cpp @@ -130,6 +130,8 @@ int DumpXYZ::modify_param(int narg, char **arg) void DumpXYZ::write_header(bigint n) { if (me == 0) { + if (!fp) error->one(FLERR, "Must not use 'run pre no' after creating a new dump"); + auto header = fmt::format("{}\n Atoms. Timestep: {}", n, update->ntimestep); if (time_flag) header += fmt::format(" Time: {:.6f}", compute_time()); header += "\n"; @@ -177,9 +179,8 @@ int DumpXYZ::convert_string(int n, double *mybuf) memory->grow(sbuf,maxsbuf,"dump:sbuf"); } - offset += sprintf(&sbuf[offset],format, - typenames[static_cast (mybuf[m+1])], - mybuf[m+2],mybuf[m+3],mybuf[m+4]); + offset += sprintf(&sbuf[offset], format, typenames[static_cast (mybuf[m+1])], + mybuf[m+2], mybuf[m+3], mybuf[m+4]); m += size_one; } From 6d6f57aeff1db9d1a75d55d0d5b2c642e811441b Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Tue, 20 Jun 2023 16:17:11 -0400 Subject: [PATCH 304/396] cosmetic --- src/variable.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/src/variable.cpp b/src/variable.cpp index 456359de2f..4d07a9e3c2 100644 --- a/src/variable.cpp +++ b/src/variable.cpp @@ -3658,7 +3658,6 @@ int Variable::math_function(char *word, char *contents, Tree **tree, Tree **tree print_var_error(FLERR,"Invalid math function in variable formula",ivar); double value; if (update->ntimestep < ivalue1) value = ivalue1; - //else if (update->ntimestep <= ivalue3) { else { value = ivalue1; double logsp = ivalue1; From e4b50a610e9b740bb8c9d7e072cd183a4bd7cc12 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Tue, 20 Jun 2023 13:31:16 -0400 Subject: [PATCH 305/396] avoid segfaults if a dump is created and followed by run pre no --- src/MPIIO/dump_atom_mpiio.cpp | 2 ++ src/MPIIO/dump_custom_mpiio.cpp | 2 ++ src/dump.cpp | 39 ++++++++++----------------------- src/dump_atom.cpp | 9 ++++++-- src/dump_custom.cpp | 18 ++++++++------- src/dump_grid.cpp | 2 ++ src/dump_xyz.cpp | 7 +++--- 7 files changed, 39 insertions(+), 40 deletions(-) diff --git a/src/MPIIO/dump_atom_mpiio.cpp b/src/MPIIO/dump_atom_mpiio.cpp index 4e0fd47a29..844d1a46e4 100644 --- a/src/MPIIO/dump_atom_mpiio.cpp +++ b/src/MPIIO/dump_atom_mpiio.cpp @@ -283,6 +283,8 @@ void DumpAtomMPIIO::init_style() void DumpAtomMPIIO::write_header(bigint ndump) { + if (!header_choice) error->all(FLERR, "Must not use 'run pre no' after creating a new dump"); + (this->*header_choice)(ndump); } diff --git a/src/MPIIO/dump_custom_mpiio.cpp b/src/MPIIO/dump_custom_mpiio.cpp index 32e09675a8..80adefa325 100644 --- a/src/MPIIO/dump_custom_mpiio.cpp +++ b/src/MPIIO/dump_custom_mpiio.cpp @@ -309,6 +309,8 @@ void DumpCustomMPIIO::init_style() void DumpCustomMPIIO::write_header(bigint ndump) { + if (!header_choice) error->all(FLERR, "Must not use 'run pre no' after creating a new dump"); + (this->*header_choice)(ndump); } diff --git a/src/dump.cpp b/src/dump.cpp index 372773bbb2..c1a246ada2 100644 --- a/src/dump.cpp +++ b/src/dump.cpp @@ -1,4 +1,4 @@ -// clang-format off + // clang-format off /* ---------------------------------------------------------------------- LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator https://www.lammps.org/, Sandia National Laboratories @@ -41,14 +41,20 @@ Dump *Dump::dumpptr; #define BIG 1.0e20 #define EPSILON 1.0e-6 -enum{ASCEND,DESCEND}; +enum { ASCEND, DESCEND }; /* ---------------------------------------------------------------------- */ -Dump::Dump(LAMMPS *lmp, int /*narg*/, char **arg) : Pointers(lmp) +Dump::Dump(LAMMPS *lmp, int /*narg*/, char **arg) : + Pointers(lmp), multiname(nullptr), refresh(nullptr), skipvar(nullptr), format(nullptr), + format_default(nullptr), format_line_user(nullptr), format_float_user(nullptr), + format_int_user(nullptr), format_bigint_user(nullptr), format_column_user(nullptr), fp(nullptr), + nameslist(nullptr), buf(nullptr), sbuf(nullptr), ids(nullptr), bufsort(nullptr), + idsort(nullptr), index(nullptr), proclist(nullptr), xpbc(nullptr), vpbc(nullptr), + imagepbc(nullptr), irregular(nullptr) { - MPI_Comm_rank(world,&me); - MPI_Comm_size(world,&nprocs); + MPI_Comm_rank(world, &me); + MPI_Comm_size(world, &nprocs); id = utils::strdup(arg[0]); @@ -64,17 +70,7 @@ Dump::Dump(LAMMPS *lmp, int /*narg*/, char **arg) : Pointers(lmp) first_flag = 0; flush_flag = 1; - format = nullptr; - format_default = nullptr; - - format_line_user = nullptr; - format_float_user = nullptr; - format_int_user = nullptr; - format_bigint_user = nullptr; - format_column_user = nullptr; - refreshflag = 0; - refresh = nullptr; clearstep = 0; sort_flag = 0; @@ -92,25 +88,15 @@ Dump::Dump(LAMMPS *lmp, int /*narg*/, char **arg) : Pointers(lmp) has_id = 1; skipflag = 0; - skipvar = nullptr; maxfiles = -1; numfiles = 0; fileidx = 0; - nameslist = nullptr; maxbuf = maxids = maxsort = maxproc = 0; - buf = bufsort = nullptr; - ids = idsort = nullptr; - index = proclist = nullptr; - irregular = nullptr; - maxsbuf = 0; - sbuf = nullptr; maxpbc = -1; - xpbc = vpbc = nullptr; - imagepbc = nullptr; // parse filename for special syntax // if contains '%', write one file per proc and replace % with proc-ID @@ -120,18 +106,17 @@ Dump::Dump(LAMMPS *lmp, int /*narg*/, char **arg) : Pointers(lmp) // else if ends in .gz or other known extensions -> compressed text file // else ASCII text file - fp = nullptr; singlefile_opened = 0; compressed = 0; binary = 0; multifile = 0; + size_one = 0; multiproc = 0; nclusterprocs = nprocs; filewriter = 0; if (me == 0) filewriter = 1; fileproc = 0; - multiname = nullptr; char *ptr; if ((ptr = strchr(filename,'%'))) { diff --git a/src/dump_atom.cpp b/src/dump_atom.cpp index 1d3862ab26..656eef8c9d 100644 --- a/src/dump_atom.cpp +++ b/src/dump_atom.cpp @@ -1,4 +1,3 @@ -// clang-format off /* ---------------------------------------------------------------------- LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator https://www.lammps.org/, Sandia National Laboratories @@ -29,8 +28,10 @@ using namespace LAMMPS_NS; /* ---------------------------------------------------------------------- */ -DumpAtom::DumpAtom(LAMMPS *lmp, int narg, char **arg) : Dump(lmp, narg, arg) +DumpAtom::DumpAtom(LAMMPS *lmp, int narg, char **arg) : + Dump(lmp, narg, arg), header_choice(nullptr), pack_choice(nullptr) { + // clang-format off if (narg != 5) error->all(FLERR,"Illegal dump atom command"); scale_flag = 1; @@ -146,6 +147,8 @@ int DumpAtom::modify_param(int narg, char **arg) void DumpAtom::write_header(bigint ndump) { + if (!header_choice) error->all(FLERR, "Must not use 'run pre no' after creating a new dump"); + if (multiproc) (this->*header_choice)(ndump); else if (me == 0) (this->*header_choice)(ndump); } @@ -154,6 +157,8 @@ void DumpAtom::write_header(bigint ndump) void DumpAtom::pack(tagint *ids) { + if (!pack_choice) error->all(FLERR, "Must not use 'run pre no' after creating a new dump"); + (this->*pack_choice)(ids); } diff --git a/src/dump_custom.cpp b/src/dump_custom.cpp index 33cfba2cef..6a10641434 100644 --- a/src/dump_custom.cpp +++ b/src/dump_custom.cpp @@ -1,4 +1,3 @@ -// clang-format off /* ---------------------------------------------------------------------- LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator https://www.lammps.org/, Sandia National Laboratories @@ -53,13 +52,14 @@ enum{LT,LE,GT,GE,EQ,NEQ,XOR}; /* ---------------------------------------------------------------------- */ DumpCustom::DumpCustom(LAMMPS *lmp, int narg, char **arg) : - Dump(lmp, narg, arg), idregion(nullptr), thresh_array(nullptr), thresh_op(nullptr), - thresh_value(nullptr), thresh_last(nullptr), thresh_fix(nullptr), thresh_fixID(nullptr), - thresh_first(nullptr), earg(nullptr), vtype(nullptr), vformat(nullptr), columns(nullptr), - columns_default(nullptr), choose(nullptr), dchoose(nullptr), clist(nullptr), - field2index(nullptr), argindex(nullptr), id_compute(nullptr), compute(nullptr), id_fix(nullptr), - fix(nullptr), id_variable(nullptr), variable(nullptr), vbuf(nullptr), id_custom(nullptr), - custom(nullptr), custom_flag(nullptr), typenames(nullptr), pack_choice(nullptr) + Dump(lmp, narg, arg), idregion(nullptr), thresh_array(nullptr), thresh_op(nullptr), + thresh_value(nullptr), thresh_last(nullptr), thresh_fix(nullptr), thresh_fixID(nullptr), + thresh_first(nullptr), earg(nullptr), vtype(nullptr), vformat(nullptr), columns(nullptr), + columns_default(nullptr), choose(nullptr), dchoose(nullptr), clist(nullptr), + field2index(nullptr), argindex(nullptr), id_compute(nullptr), compute(nullptr), id_fix(nullptr), + fix(nullptr), id_variable(nullptr), variable(nullptr), vbuf(nullptr), id_custom(nullptr), + custom(nullptr), custom_flag(nullptr), typenames(nullptr), header_choice(nullptr), + pack_choice(nullptr) { if (narg == 5) error->all(FLERR,"No dump {} arguments specified", style); @@ -352,6 +352,8 @@ void DumpCustom::init_style() void DumpCustom::write_header(bigint ndump) { + if (!header_choice) error->all(FLERR, "Must not use 'run pre no' after creating a new dump"); + if (multiproc) (this->*header_choice)(ndump); else if (me == 0) (this->*header_choice)(ndump); } diff --git a/src/dump_grid.cpp b/src/dump_grid.cpp index 056cac1095..39d80ade11 100644 --- a/src/dump_grid.cpp +++ b/src/dump_grid.cpp @@ -311,6 +311,8 @@ void DumpGrid::init_style() void DumpGrid::write_header(bigint ndump) { + if (!header_choice) error->all(FLERR, "Must not use 'run pre no' after creating a new dump"); + if (multiproc) (this->*header_choice)(ndump); else if (me == 0) (this->*header_choice)(ndump); } diff --git a/src/dump_xyz.cpp b/src/dump_xyz.cpp index 83c4d180d6..241ec1c059 100644 --- a/src/dump_xyz.cpp +++ b/src/dump_xyz.cpp @@ -130,6 +130,8 @@ int DumpXYZ::modify_param(int narg, char **arg) void DumpXYZ::write_header(bigint n) { if (me == 0) { + if (!fp) error->one(FLERR, "Must not use 'run pre no' after creating a new dump"); + auto header = fmt::format("{}\n Atoms. Timestep: {}", n, update->ntimestep); if (time_flag) header += fmt::format(" Time: {:.6f}", compute_time()); header += "\n"; @@ -177,9 +179,8 @@ int DumpXYZ::convert_string(int n, double *mybuf) memory->grow(sbuf,maxsbuf,"dump:sbuf"); } - offset += sprintf(&sbuf[offset],format, - typenames[static_cast (mybuf[m+1])], - mybuf[m+2],mybuf[m+3],mybuf[m+4]); + offset += sprintf(&sbuf[offset], format, typenames[static_cast (mybuf[m+1])], + mybuf[m+2], mybuf[m+3], mybuf[m+4]); m += size_one; } From e95b10f24aef2735da23330bf64c4fa390b0e55a Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Wed, 21 Jun 2023 06:42:19 -0400 Subject: [PATCH 306/396] update VMD plugin headers to the latest version --- lib/molfile/molfile_plugin.h | 1 - lib/molfile/vmdplugin.h | 6 +++--- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/lib/molfile/molfile_plugin.h b/lib/molfile/molfile_plugin.h index 491cd375bb..a417b82e96 100644 --- a/lib/molfile/molfile_plugin.h +++ b/lib/molfile/molfile_plugin.h @@ -987,4 +987,3 @@ typedef struct { } molfile_plugin_t; #endif - diff --git a/lib/molfile/vmdplugin.h b/lib/molfile/vmdplugin.h index 7afc358e97..9336d3e24f 100644 --- a/lib/molfile/vmdplugin.h +++ b/lib/molfile/vmdplugin.h @@ -11,7 +11,7 @@ * * $RCSfile: vmdplugin.h,v $ * $Author: johns $ $Locker: $ $State: Exp $ - * $Revision: 1.34 $ $Date: 2018/05/02 03:12:56 $ + * $Revision: 1.35 $ $Date: 2020/10/16 07:50:56 $ * ***************************************************************************/ @@ -58,8 +58,8 @@ /*@}*/ -/** "WIN32" is defined on both WIN32 and WIN64 platforms... */ -#if (defined(WIN32)) +/** Detect compilations targeting Windows x86 and x64 platforms */ +#if (defined(WIN32) || defined(WIN64) || defined(_MSC_VER)) #define WIN32_LEAN_AND_MEAN #include From ffda6596da1f44a920daa57b8719290476c0a1b1 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Thu, 22 Jun 2023 10:48:07 -0400 Subject: [PATCH 307/396] detect and flag short reads with missing lines in utils::read_lines_from_file() --- src/utils.cpp | 67 +++++++++++++++++++++++++++++---------------------- 1 file changed, 38 insertions(+), 29 deletions(-) diff --git a/src/utils.cpp b/src/utils.cpp index bc4eee7385..eee1d5dd46 100644 --- a/src/utils.cpp +++ b/src/utils.cpp @@ -272,6 +272,7 @@ int utils::read_lines_from_file(FILE *fp, int nlines, int nmax, char *buffer, in { char *ptr = buffer; *ptr = '\0'; + int mylines = 0; if (me == 0) { if (fp) { @@ -282,13 +283,15 @@ int utils::read_lines_from_file(FILE *fp, int nlines, int nmax, char *buffer, in ptr += strlen(ptr); // ensure buffer is null terminated. null char is start of next line. *ptr = '\0'; + // count line + ++mylines; } } } int n = strlen(buffer); MPI_Bcast(&n, 1, MPI_INT, 0, comm); - if (n == 0) return 1; + if ((n == 0) || (nlines != mylines)) return 1; MPI_Bcast(buffer, n + 1, MPI_CHAR, 0, comm); return 0; } @@ -879,8 +882,8 @@ char *utils::expand_type(const char *file, int line, const std::string &str, int caller decides what to do if arg is not a COMPUTE or FIX reference ------------------------------------------------------------------------- */ -int utils::check_grid_reference(char *errstr, char *ref, int nevery, - char *&id, int &igrid, int &idata, int &index, LAMMPS *lmp) +int utils::check_grid_reference(char *errstr, char *ref, int nevery, char *&id, int &igrid, + int &idata, int &index, LAMMPS *lmp) { ArgInfo argi(ref, ArgInfo::COMPUTE | ArgInfo::FIX); index = argi.get_index1(); @@ -889,80 +892,85 @@ int utils::check_grid_reference(char *errstr, char *ref, int nevery, switch (argi.get_type()) { case ArgInfo::UNKNOWN: { - lmp->error->all(FLERR,"%s grid reference %s is invalid",errstr,ref); + lmp->error->all(FLERR, "%s grid reference %s is invalid", errstr, ref); } break; - // compute value = c_ID + // compute value = c_ID case ArgInfo::COMPUTE: { // split name = idcompute:gname:dname into 3 strings - auto words = parse_grid_id(FLERR,name,lmp->error); + auto words = parse_grid_id(FLERR, name, lmp->error); const auto &idcompute = words[0]; const auto &gname = words[1]; const auto &dname = words[2]; auto icompute = lmp->modify->get_compute_by_id(idcompute); - if (!icompute) lmp->error->all(FLERR,"{} compute ID {} not found",errstr,idcompute); + if (!icompute) lmp->error->all(FLERR, "{} compute ID {} not found", errstr, idcompute); if (icompute->pergrid_flag == 0) - lmp->error->all(FLERR,"{} compute {} does not compute per-grid info",errstr,idcompute); + lmp->error->all(FLERR, "{} compute {} does not compute per-grid info", errstr, idcompute); int dim; - igrid = icompute->get_grid_by_name(gname,dim); + igrid = icompute->get_grid_by_name(gname, dim); if (igrid < 0) - lmp->error->all(FLERR,"{} compute {} does not recognize grid name {}",errstr,idcompute,gname); + lmp->error->all(FLERR, "{} compute {} does not recognize grid name {}", errstr, idcompute, + gname); int ncol; - idata = icompute->get_griddata_by_name(igrid,dname,ncol); + idata = icompute->get_griddata_by_name(igrid, dname, ncol); if (idata < 0) - lmp->error->all(FLERR,"{} compute {} does not recognize data name {}",errstr,idcompute,dname); + lmp->error->all(FLERR, "{} compute {} does not recognize data name {}", errstr, idcompute, + dname); if (argi.get_dim() == 0 && ncol) - lmp->error->all(FLERR,"{} compute {} data {} is not per-grid vector",errstr,idcompute,dname); + lmp->error->all(FLERR, "{} compute {} data {} is not per-grid vector", errstr, idcompute, + dname); if (argi.get_dim() && ncol == 0) - lmp->error->all(FLERR,"{} compute {} data {} is not per-grid array",errstr,idcompute,dname); + lmp->error->all(FLERR, "{} compute {} data {} is not per-grid array", errstr, idcompute, + dname); if (argi.get_dim() && argi.get_index1() > ncol) - lmp->error->all(FLERR,"{} compute {} array {} is accessed out-of-range",errstr,idcompute,dname); + lmp->error->all(FLERR, "{} compute {} array {} is accessed out-of-range", errstr, idcompute, + dname); id = utils::strdup(idcompute); return ArgInfo::COMPUTE; } break; - // fix value = f_ID + // fix value = f_ID case ArgInfo::FIX: { // split name = idfix:gname:dname into 3 strings - auto words = parse_grid_id(FLERR,name,lmp->error); + auto words = parse_grid_id(FLERR, name, lmp->error); const auto &idfix = words[0]; const auto &gname = words[1]; const auto &dname = words[2]; auto ifix = lmp->modify->get_fix_by_id(idfix); - if (!ifix) lmp->error->all(FLERR,"{} fix ID {} not found",errstr,idfix); + if (!ifix) lmp->error->all(FLERR, "{} fix ID {} not found", errstr, idfix); if (ifix->pergrid_flag == 0) - lmp->error->all(FLERR,"{} fix {} does not compute per-grid info",errstr,idfix); + lmp->error->all(FLERR, "{} fix {} does not compute per-grid info", errstr, idfix); if (nevery % ifix->pergrid_freq) - lmp->error->all(FLERR,"{} fix {} not computed at compatible time",errstr,idfix); + lmp->error->all(FLERR, "{} fix {} not computed at compatible time", errstr, idfix); int dim; - igrid = ifix->get_grid_by_name(gname,dim); + igrid = ifix->get_grid_by_name(gname, dim); if (igrid < 0) - lmp->error->all(FLERR,"{} fix {} does not recognize grid name {}",errstr,idfix,gname); + lmp->error->all(FLERR, "{} fix {} does not recognize grid name {}", errstr, idfix, gname); int ncol; - idata = ifix->get_griddata_by_name(igrid,dname,ncol); + idata = ifix->get_griddata_by_name(igrid, dname, ncol); if (idata < 0) - lmp->error->all(FLERR,"{} fix {} does not recognize data name {}",errstr,idfix,dname); + lmp->error->all(FLERR, "{} fix {} does not recognize data name {}", errstr, idfix, dname); if (argi.get_dim() == 0 && ncol) - lmp->error->all(FLERR,"{} fix {} data {} is not per-grid vector",errstr,idfix,dname); + lmp->error->all(FLERR, "{} fix {} data {} is not per-grid vector", errstr, idfix, dname); if (argi.get_dim() > 0 && ncol == 0) - lmp->error->all(FLERR,"{} fix {} data {} is not per-grid array",errstr,idfix,dname); + lmp->error->all(FLERR, "{} fix {} data {} is not per-grid array", errstr, idfix, dname); if (argi.get_dim() > 0 && argi.get_index1() > ncol) - lmp->error->all(FLERR,"{} fix {} array {} is accessed out-of-range",errstr,idfix,dname); + lmp->error->all(FLERR, "{} fix {} array {} is accessed out-of-range", errstr, idfix, dname); id = utils::strdup(idfix); return ArgInfo::FIX; @@ -1360,8 +1368,9 @@ bool utils::is_double(const std::string &str) { if (str.empty()) return false; - return strmatch(str, "^[+-]?\\d+\\.?\\d*$") || strmatch(str, "^[+-]?\\d+\\.?\\d*[eE][+-]?\\d+$") || - strmatch(str, "^[+-]?\\d*\\.?\\d+$") || strmatch(str, "^[+-]?\\d*\\.?\\d+[eE][+-]?\\d+$"); + return strmatch(str, "^[+-]?\\d+\\.?\\d*$") || + strmatch(str, "^[+-]?\\d+\\.?\\d*[eE][+-]?\\d+$") || strmatch(str, "^[+-]?\\d*\\.?\\d+$") || + strmatch(str, "^[+-]?\\d*\\.?\\d+[eE][+-]?\\d+$"); } /* ---------------------------------------------------------------------- From e9a06a065451d82bc82e7c7a6b1b00f97ae9632e Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Thu, 22 Jun 2023 11:49:56 -0400 Subject: [PATCH 308/396] correct and reformat error messages for short reads --- src/read_data.cpp | 21 +++++---------------- 1 file changed, 5 insertions(+), 16 deletions(-) diff --git a/src/read_data.cpp b/src/read_data.cpp index 2fea75f7c0..e3087ae215 100644 --- a/src/read_data.cpp +++ b/src/read_data.cpp @@ -2021,9 +2021,7 @@ void ReadData::pairIJcoeffs() if (eof) error->all(FLERR, "Unexpected end of data file"); if (tlabelflag && !lmap->is_complete(Atom::ATOM)) - error->all(FLERR, - "Label map is incomplete: " - "all types must be assigned a unique type label"); + error->all(FLERR,"Label map is incomplete: all types must be assigned a unique type label"); char *original = buf; for (i = 0; i < ntypes; i++) @@ -2032,10 +2030,7 @@ void ReadData::pairIJcoeffs() *next = '\0'; parse_coeffs(buf, nullptr, 0, 2, toffset, tlabelflag, lmap->lmap2lmap.atom); if (ncoeffarg == 0) - error->all(FLERR, - "Unexpected empty line in PairIJCoeffs section. " - "Expected {} lines.", - (ntypes - 1) * ntypes); + error->all(FLERR, "Unexpected empty line in PairIJCoeffs section. Expected {} lines.", nsq); force->pair->coeff(ncoeffarg, coeffarg); buf = next + 1; } @@ -2055,9 +2050,7 @@ void ReadData::bondcoeffs() if (eof) error->all(FLERR, "Unexpected end of data file"); if (blabelflag && !lmap->is_complete(Atom::BOND)) - error->all(FLERR, - "Label map is incomplete: " - "all types must be assigned a unique type label"); + error->all(FLERR, "Label map is incomplete: all types must be assigned a unique type label"); char *original = buf; for (int i = 0; i < nbondtypes; i++) { @@ -2086,9 +2079,7 @@ void ReadData::anglecoeffs(int which) if (eof) error->all(FLERR, "Unexpected end of data file"); if (alabelflag && !lmap->is_complete(Atom::ANGLE)) - error->all(FLERR, - "Label map is incomplete: " - "all types must be assigned a unique type label"); + error->all(FLERR, "Label map is incomplete: all types must be assigned a unique type label"); char *original = buf; for (int i = 0; i < nangletypes; i++) { @@ -2122,9 +2113,7 @@ void ReadData::dihedralcoeffs(int which) if (eof) error->all(FLERR, "Unexpected end of data file"); if (dlabelflag && !lmap->is_complete(Atom::DIHEDRAL)) - error->all(FLERR, - "Label map is incomplete: " - "all types must be assigned a unique type label"); + error->all(FLERR, "Label map is incomplete: all types must be assigned a unique type label"); char *original = buf; for (int i = 0; i < ndihedraltypes; i++) { From a38e0fb47b586331f54bcb19a46995d5d8546fb8 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Fri, 23 Jun 2023 08:22:31 -0400 Subject: [PATCH 309/396] restore clang-format comments --- src/dump.cpp | 2 +- src/dump_atom.cpp | 2 +- src/dump_custom.cpp | 1 + 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/dump.cpp b/src/dump.cpp index c1a246ada2..39d8989c41 100644 --- a/src/dump.cpp +++ b/src/dump.cpp @@ -1,4 +1,4 @@ - // clang-format off +// clang-format off /* ---------------------------------------------------------------------- LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator https://www.lammps.org/, Sandia National Laboratories diff --git a/src/dump_atom.cpp b/src/dump_atom.cpp index 656eef8c9d..2d047dc0a0 100644 --- a/src/dump_atom.cpp +++ b/src/dump_atom.cpp @@ -1,3 +1,4 @@ +// clang-format off /* ---------------------------------------------------------------------- LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator https://www.lammps.org/, Sandia National Laboratories @@ -31,7 +32,6 @@ using namespace LAMMPS_NS; DumpAtom::DumpAtom(LAMMPS *lmp, int narg, char **arg) : Dump(lmp, narg, arg), header_choice(nullptr), pack_choice(nullptr) { - // clang-format off if (narg != 5) error->all(FLERR,"Illegal dump atom command"); scale_flag = 1; diff --git a/src/dump_custom.cpp b/src/dump_custom.cpp index 6a10641434..bdbc8ec185 100644 --- a/src/dump_custom.cpp +++ b/src/dump_custom.cpp @@ -1,3 +1,4 @@ +// clang-format off /* ---------------------------------------------------------------------- LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator https://www.lammps.org/, Sandia National Laboratories From fab01c7d5fa771040485ba6f624badb1eeec82e3 Mon Sep 17 00:00:00 2001 From: Richard Berger Date: Sat, 24 Jun 2023 20:26:08 -0600 Subject: [PATCH 310/396] Remove extra semicolons --- src/grid2d.h | 2 +- src/grid3d.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/grid2d.h b/src/grid2d.h index bb1bfb25e1..fd6b5efd1e 100644 --- a/src/grid2d.h +++ b/src/grid2d.h @@ -67,7 +67,7 @@ protected: int stencil_grid_lo,stencil_grid_hi; // grid cells accessed beyond owned cell double shift_grid; // location of grid point within grid cell // only affects which proc owns grid cell - double shift_atom_lo,shift_atom_hi;; // max shift applied to atoms + double shift_atom_lo,shift_atom_hi; // max shift applied to atoms // when mapped to grid cell by caller // can be different in lo/hi directions // only affects extent of ghost cells diff --git a/src/grid3d.h b/src/grid3d.h index 97fcf5992a..c15d5ac7f2 100644 --- a/src/grid3d.h +++ b/src/grid3d.h @@ -69,7 +69,7 @@ class Grid3d : protected Pointers { int stencil_grid_lo,stencil_grid_hi; // grid cells accessed beyond owned cell double shift_grid; // location of grid point within grid cell // only affects which proc owns grid cell - double shift_atom_lo,shift_atom_hi;; // max shift applied to atoms + double shift_atom_lo,shift_atom_hi; // max shift applied to atoms // when mapped to grid cell by caller // can be different in lo/hi directions // only affects extent of ghost cells From bfa39a37ff81e37a871e4ff6968edda648349ff8 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Sun, 25 Jun 2023 05:47:21 -0400 Subject: [PATCH 311/396] apply clang-format --- src/grid2d.h | 30 +++++++++++++++--------------- src/grid3d.h | 36 ++++++++++++++++++------------------ 2 files changed, 33 insertions(+), 33 deletions(-) diff --git a/src/grid2d.h b/src/grid2d.h index fd6b5efd1e..6c1cca5f9d 100644 --- a/src/grid2d.h +++ b/src/grid2d.h @@ -53,7 +53,7 @@ class Grid2d : protected Pointers { void read_file(int, void *, FILE *, int, int); void write_file(int, void *, int, int, int, MPI_Datatype); -protected: + protected: int me, nprocs; int layout; // not TILED or TILED, same as Comm class MPI_Comm gridcomm; // communicator for this class @@ -61,18 +61,18 @@ protected: // inputs from caller via constructor - int nx, ny; // size of global grid in both dims - double maxdist; // distance owned atoms can move outside subdomain - int stencil_atom_lo,stencil_atom_hi; // grid cells accessed beyond atom's cell - int stencil_grid_lo,stencil_grid_hi; // grid cells accessed beyond owned cell - double shift_grid; // location of grid point within grid cell - // only affects which proc owns grid cell - double shift_atom_lo,shift_atom_hi; // max shift applied to atoms - // when mapped to grid cell by caller - // can be different in lo/hi directions - // only affects extent of ghost cells - int yextra; // 1 if extra grid cells in Y, 0 if not - double yfactor; // multiplier on extent of grid in Y direction + int nx, ny; // size of global grid in both dims + double maxdist; // distance owned atoms can move outside subdomain + int stencil_atom_lo, stencil_atom_hi; // grid cells accessed beyond atom's cell + int stencil_grid_lo, stencil_grid_hi; // grid cells accessed beyond owned cell + double shift_grid; // location of grid point within grid cell + // only affects which proc owns grid cell + double shift_atom_lo, shift_atom_hi; // max shift applied to atoms + // when mapped to grid cell by caller + // can be different in lo/hi directions + // only affects extent of ghost cells + int yextra; // 1 if extra grid cells in Y, 0 if not + double yfactor; // multiplier on extent of grid in Y direction // extent of my owned and ghost cells @@ -190,11 +190,11 @@ protected: // internal variables for OVERLAP operation // ------------------------------------------- - int *overlap_procs; // length of Nprocs in communicator + int *overlap_procs; // length of Nprocs in communicator // BRICK decomposition - double *xsplit,*ysplit,*zsplit; + double *xsplit, *ysplit, *zsplit; int ***grid2proc; // TILED decomposition diff --git a/src/grid3d.h b/src/grid3d.h index c15d5ac7f2..e4a8e276f5 100644 --- a/src/grid3d.h +++ b/src/grid3d.h @@ -23,8 +23,8 @@ class Grid3d : protected Pointers { enum { KSPACE = 0, PAIR = 1, FIX = 2 }; // calling classes Grid3d(class LAMMPS *, MPI_Comm, int, int, int); - Grid3d(class LAMMPS *, MPI_Comm, int, int, int, - int, int, int, int, int, int, int, int, int, int, int, int); + Grid3d(class LAMMPS *, MPI_Comm, int, int, int, int, int, int, int, int, int, int, int, int, int, + int, int); ~Grid3d(); void set_distance(double); @@ -41,8 +41,8 @@ class Grid3d : protected Pointers { void get_bounds_owned(int &, int &, int &, int &, int &, int &); void get_bounds_ghost(int &, int &, int &, int &, int &, int &); - void setup_grid(int &, int &, int &, int &, int &, int &, - int &, int &, int &, int &, int &, int &); + void setup_grid(int &, int &, int &, int &, int &, int &, int &, int &, int &, int &, int &, + int &); void setup_comm(int &, int &); int ghost_adjacent(); @@ -63,18 +63,18 @@ class Grid3d : protected Pointers { // input from caller - int nx, ny, nz; // size of global grid in all 3 dims - double maxdist; // distance owned atoms can move outside subdomain - int stencil_atom_lo,stencil_atom_hi; // grid cells accessed beyond atom's cell - int stencil_grid_lo,stencil_grid_hi; // grid cells accessed beyond owned cell - double shift_grid; // location of grid point within grid cell - // only affects which proc owns grid cell - double shift_atom_lo,shift_atom_hi; // max shift applied to atoms - // when mapped to grid cell by caller - // can be different in lo/hi directions - // only affects extent of ghost cells - int zextra; // 1 if extra grid cells in Z, 0 if not - double zfactor; // multiplier on extent of grid in Z direction + int nx, ny, nz; // size of global grid in all 3 dims + double maxdist; // distance owned atoms can move outside subdomain + int stencil_atom_lo, stencil_atom_hi; // grid cells accessed beyond atom's cell + int stencil_grid_lo, stencil_grid_hi; // grid cells accessed beyond owned cell + double shift_grid; // location of grid point within grid cell + // only affects which proc owns grid cell + double shift_atom_lo, shift_atom_hi; // max shift applied to atoms + // when mapped to grid cell by caller + // can be different in lo/hi directions + // only affects extent of ghost cells + int zextra; // 1 if extra grid cells in Z, 0 if not + double zfactor; // multiplier on extent of grid in Z direction // extent of my owned and ghost cells @@ -196,11 +196,11 @@ class Grid3d : protected Pointers { // internal variables for OVERLAP operation // ------------------------------------------- - int *overlap_procs; // length of Nprocs in communicator + int *overlap_procs; // length of Nprocs in communicator // BRICK decomposition - double *xsplit,*ysplit,*zsplit; + double *xsplit, *ysplit, *zsplit; int ***grid2proc; // TILED decomposition From 92c118b29fc760a26aca9f38ad0db0fb2dd08fe8 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Sun, 25 Jun 2023 05:56:51 -0400 Subject: [PATCH 312/396] replace for (;;) with while (true) --- src/EXTRA-COMPUTE/compute_ackland_atom.cpp | 8 ++++---- src/EXTRA-COMPUTE/compute_basal_atom.cpp | 8 ++++---- src/EXTRA-COMPUTE/compute_hexorder_atom.cpp | 4 ++-- src/KOKKOS/compute_orientorder_atom_kokkos.cpp | 4 ++-- src/compute_centro_atom.cpp | 8 ++++---- src/compute_orientorder_atom.cpp | 4 ++-- 6 files changed, 18 insertions(+), 18 deletions(-) diff --git a/src/EXTRA-COMPUTE/compute_ackland_atom.cpp b/src/EXTRA-COMPUTE/compute_ackland_atom.cpp index d8a77b9c2f..fd7a5fb05c 100644 --- a/src/EXTRA-COMPUTE/compute_ackland_atom.cpp +++ b/src/EXTRA-COMPUTE/compute_ackland_atom.cpp @@ -357,7 +357,7 @@ void ComputeAcklandAtom::select(int k, int n, double *arr) arr--; l = 1; ir = n; - for (;;) { + while (true) { if (ir <= l+1) { if (ir == l+1 && arr[ir] < arr[l]) { SWAP(arr[l],arr[ir]) @@ -378,7 +378,7 @@ void ComputeAcklandAtom::select(int k, int n, double *arr) i = l+1; j = ir; a = arr[l+1]; - for (;;) { + while (true) { do i++; while (arr[i] < a); do j--; while (arr[j] > a); if (j < i) break; @@ -403,7 +403,7 @@ void ComputeAcklandAtom::select2(int k, int n, double *arr, int *iarr) iarr--; l = 1; ir = n; - for (;;) { + while (true) { if (ir <= l+1) { if (ir == l+1 && arr[ir] < arr[l]) { SWAP(arr[l],arr[ir]) @@ -430,7 +430,7 @@ void ComputeAcklandAtom::select2(int k, int n, double *arr, int *iarr) j = ir; a = arr[l+1]; ia = iarr[l+1]; - for (;;) { + while (true) { do i++; while (arr[i] < a); do j--; while (arr[j] > a); if (j < i) break; diff --git a/src/EXTRA-COMPUTE/compute_basal_atom.cpp b/src/EXTRA-COMPUTE/compute_basal_atom.cpp index b149746fb4..8b65917111 100644 --- a/src/EXTRA-COMPUTE/compute_basal_atom.cpp +++ b/src/EXTRA-COMPUTE/compute_basal_atom.cpp @@ -442,7 +442,7 @@ void ComputeBasalAtom::select(int k, int n, double *arr) arr--; l = 1; ir = n; - for (;;) { + while (true) { if (ir <= l+1) { if (ir == l+1 && arr[ir] < arr[l]) { SWAP(arr[l],arr[ir]) @@ -463,7 +463,7 @@ void ComputeBasalAtom::select(int k, int n, double *arr) i = l+1; j = ir; a = arr[l+1]; - for (;;) { + while (true) { do i++; while (arr[i] < a); do j--; while (arr[j] > a); if (j < i) break; @@ -488,7 +488,7 @@ void ComputeBasalAtom::select2(int k, int n, double *arr, int *iarr) iarr--; l = 1; ir = n; - for (;;) { + while (true) { if (ir <= l+1) { if (ir == l+1 && arr[ir] < arr[l]) { SWAP(arr[l],arr[ir]) @@ -515,7 +515,7 @@ void ComputeBasalAtom::select2(int k, int n, double *arr, int *iarr) j = ir; a = arr[l+1]; ia = iarr[l+1]; - for (;;) { + while (true) { do i++; while (arr[i] < a); do j--; while (arr[j] > a); if (j < i) break; diff --git a/src/EXTRA-COMPUTE/compute_hexorder_atom.cpp b/src/EXTRA-COMPUTE/compute_hexorder_atom.cpp index a10e810e82..dc04c6b650 100644 --- a/src/EXTRA-COMPUTE/compute_hexorder_atom.cpp +++ b/src/EXTRA-COMPUTE/compute_hexorder_atom.cpp @@ -281,7 +281,7 @@ void ComputeHexOrderAtom::select2(int k, int n, double *arr, int *iarr) iarr--; l = 1; ir = n; - for (;;) { + while (true) { if (ir <= l+1) { if (ir == l+1 && arr[ir] < arr[l]) { SWAP(arr[l],arr[ir]) @@ -308,7 +308,7 @@ void ComputeHexOrderAtom::select2(int k, int n, double *arr, int *iarr) j = ir; a = arr[l+1]; ia = iarr[l+1]; - for (;;) { + while (true) { do i++; while (arr[i] < a); do j--; while (arr[j] > a); if (j < i) break; diff --git a/src/KOKKOS/compute_orientorder_atom_kokkos.cpp b/src/KOKKOS/compute_orientorder_atom_kokkos.cpp index 157d41126f..263a070a3a 100644 --- a/src/KOKKOS/compute_orientorder_atom_kokkos.cpp +++ b/src/KOKKOS/compute_orientorder_atom_kokkos.cpp @@ -386,7 +386,7 @@ void ComputeOrientOrderAtomKokkos::select3(int k, int n, int ii) con l = 0; ir = n-1; - for (;;) { + while (true) { if (ir <= l+1) { if (ir == l+1 && arr[ir] < arr[l]) { SWAP(arr,l,ir); @@ -421,7 +421,7 @@ void ComputeOrientOrderAtomKokkos::select3(int k, int n, int ii) con a3[0] = arr3(l+1,0); a3[1] = arr3(l+1,1); a3[2] = arr3(l+1,2); - for (;;) { + while (true) { do i++; while (arr[i] < a); do j--; while (arr[j] > a); if (j < i) break; diff --git a/src/compute_centro_atom.cpp b/src/compute_centro_atom.cpp index ae6ef4901f..f726a95594 100644 --- a/src/compute_centro_atom.cpp +++ b/src/compute_centro_atom.cpp @@ -338,7 +338,7 @@ void ComputeCentroAtom::select(int k, int n, double *arr) arr--; l = 1; ir = n; - for (;;) { + while (true) { if (ir <= l + 1) { if (ir == l + 1 && arr[ir] < arr[l]) { SWAP(arr[l], arr[ir]) } return; @@ -351,7 +351,7 @@ void ComputeCentroAtom::select(int k, int n, double *arr) i = l + 1; j = ir; a = arr[l + 1]; - for (;;) { + while (true) { do i++; while (arr[i] < a); do j--; @@ -378,7 +378,7 @@ void ComputeCentroAtom::select2(int k, int n, double *arr, int *iarr) iarr--; l = 1; ir = n; - for (;;) { + while (true) { if (ir <= l + 1) { if (ir == l + 1 && arr[ir] < arr[l]) { SWAP(arr[l], arr[ir]) @@ -405,7 +405,7 @@ void ComputeCentroAtom::select2(int k, int n, double *arr, int *iarr) j = ir; a = arr[l + 1]; ia = iarr[l + 1]; - for (;;) { + while (true) { do i++; while (arr[i] < a); do j--; diff --git a/src/compute_orientorder_atom.cpp b/src/compute_orientorder_atom.cpp index 5682432c8e..6f1b2b4036 100644 --- a/src/compute_orientorder_atom.cpp +++ b/src/compute_orientorder_atom.cpp @@ -370,7 +370,7 @@ void ComputeOrientOrderAtom::select3(int k, int n, double *arr, int *iarr, doubl arr3--; l = 1; ir = n; - for (;;) { + while (true) { if (ir <= l + 1) { if (ir == l + 1 && arr[ir] < arr[l]) { SWAP(arr[l], arr[ir]); @@ -405,7 +405,7 @@ void ComputeOrientOrderAtom::select3(int k, int n, double *arr, int *iarr, doubl a3[0] = arr3[l + 1][0]; a3[1] = arr3[l + 1][1]; a3[2] = arr3[l + 1][2]; - for (;;) { + while (true) { do i++; while (arr[i] < a); do j--; From d1980031efbb2a8b73ca5ca75596b5b4c314e445 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Sun, 25 Jun 2023 06:02:17 -0400 Subject: [PATCH 313/396] remove more duplicate semicolons --- src/BODY/pair_body_rounded_polyhedron.cpp | 2 +- src/CG-DNA/bond_oxdna_fene.cpp | 2 +- src/CG-DNA/pair_oxdna2_coaxstk.cpp | 2 +- src/CG-DNA/pair_oxdna2_dh.cpp | 2 +- src/CG-DNA/pair_oxdna_coaxstk.cpp | 2 +- src/CG-DNA/pair_oxdna_xstk.cpp | 2 +- src/CG-DNA/pair_oxrna2_xstk.cpp | 2 +- src/EXTRA-COMPUTE/compute_adf.cpp | 2 +- src/EXTRA-DUMP/dump_xtc.cpp | 2 +- src/EXTRA-FIX/fix_wall_ees.cpp | 2 +- src/INTEL/npair_full_bin_intel.cpp | 2 +- src/INTEL/pppm_disp_intel.cpp | 2 +- src/KOKKOS/atom_vec_dpd_kokkos.cpp | 12 ++++++------ src/KOKKOS/dihedral_harmonic_kokkos.cpp | 6 +++--- src/KOKKOS/fix_wall_gran_old.cpp | 2 +- src/KSPACE/ewald.cpp | 2 +- src/KSPACE/pair_lj_charmmfsw_coul_long.cpp | 6 +++--- src/KSPACE/pppm.cpp | 2 +- src/KSPACE/pppm_disp.cpp | 2 +- src/MOLECULE/pair_lj_charmmfsw_coul_charmmfsh.cpp | 4 ++-- src/RIGID/fix_shake.cpp | 2 +- src/SMTBQ/pair_smtbq.cpp | 2 +- src/SPIN/min_spin_lbfgs.cpp | 2 +- src/fix_ave_grid.cpp | 2 +- src/input.cpp | 2 +- src/special.cpp | 2 +- 26 files changed, 36 insertions(+), 36 deletions(-) diff --git a/src/BODY/pair_body_rounded_polyhedron.cpp b/src/BODY/pair_body_rounded_polyhedron.cpp index d9a79abad0..9425707ef1 100644 --- a/src/BODY/pair_body_rounded_polyhedron.cpp +++ b/src/BODY/pair_body_rounded_polyhedron.cpp @@ -1910,7 +1910,7 @@ void PairBodyRoundedPolyhedron::inside_polygon(int ibody, int face_index, iffirst = facfirst[ibody]; rradi = rounded_radius[ibody]; double rradsq = rradi*rradi; - anglesum1 = anglesum2 = 0;; + anglesum1 = anglesum2 = 0; for (i = 0; i < MAX_FACE_SIZE; i++) { npi1 = static_cast(face[iffirst+face_index][i]); if (npi1 < 0) break; diff --git a/src/CG-DNA/bond_oxdna_fene.cpp b/src/CG-DNA/bond_oxdna_fene.cpp index 2d471cbbe6..780b71e44c 100644 --- a/src/CG-DNA/bond_oxdna_fene.cpp +++ b/src/CG-DNA/bond_oxdna_fene.cpp @@ -146,7 +146,7 @@ void BondOxdnaFene::ev_tally_xyz(int i, int j, int nlocal, int newton_bond, doub void BondOxdnaFene::compute(int eflag, int vflag) { int a, b, in, type; - double delf[3], delta[3], deltb[3]; // force, torque increment;; + double delf[3], delta[3], deltb[3]; // force, torque increment double delr[3], ebond, fbond; double rsq, Deltasq, rlogarg; double r, rr0, rr0sq; diff --git a/src/CG-DNA/pair_oxdna2_coaxstk.cpp b/src/CG-DNA/pair_oxdna2_coaxstk.cpp index 844ba56577..527020076c 100644 --- a/src/CG-DNA/pair_oxdna2_coaxstk.cpp +++ b/src/CG-DNA/pair_oxdna2_coaxstk.cpp @@ -612,7 +612,7 @@ void PairOxdna2Coaxstk::coeff(int narg, char **arg) (0.5 * (cut_cxst_lo_one - cut_cxst_0_one) * (cut_cxst_lo_one - cut_cxst_0_one) - k_cxst_one * 0.5 * (cut_cxst_0_one -cut_cxst_c_one) * (cut_cxst_0_one - cut_cxst_c_one)/k_cxst_one); - cut_cxst_lc_one = cut_cxst_lo_one - 0.5 * (cut_cxst_lo_one - cut_cxst_0_one)/b_cxst_lo_one;; + cut_cxst_lc_one = cut_cxst_lo_one - 0.5 * (cut_cxst_lo_one - cut_cxst_0_one)/b_cxst_lo_one; b_cxst_hi_one = 0.25 * (cut_cxst_hi_one - cut_cxst_0_one) * (cut_cxst_hi_one - cut_cxst_0_one)/ (0.5 * (cut_cxst_hi_one - cut_cxst_0_one) * (cut_cxst_hi_one - cut_cxst_0_one) - diff --git a/src/CG-DNA/pair_oxdna2_dh.cpp b/src/CG-DNA/pair_oxdna2_dh.cpp index dcfe3f9ea1..a8114c84d7 100644 --- a/src/CG-DNA/pair_oxdna2_dh.cpp +++ b/src/CG-DNA/pair_oxdna2_dh.cpp @@ -79,7 +79,7 @@ void PairOxdna2Dh::compute_interaction_sites(double e1[3], void PairOxdna2Dh::compute(int eflag, int vflag) { - double delf[3],delta[3],deltb[3]; // force, torque increment;; + double delf[3],delta[3],deltb[3]; // force, torque increment double rtmp_s[3],delr[3]; double evdwl,fpair,factor_lj; double r,rsq,rinv; diff --git a/src/CG-DNA/pair_oxdna_coaxstk.cpp b/src/CG-DNA/pair_oxdna_coaxstk.cpp index b9b34338fe..679bfbf18d 100644 --- a/src/CG-DNA/pair_oxdna_coaxstk.cpp +++ b/src/CG-DNA/pair_oxdna_coaxstk.cpp @@ -749,7 +749,7 @@ void PairOxdnaCoaxstk::coeff(int narg, char **arg) (0.5 * (cut_cxst_lo_one - cut_cxst_0_one) * (cut_cxst_lo_one - cut_cxst_0_one) - k_cxst_one * 0.5 * (cut_cxst_0_one -cut_cxst_c_one) * (cut_cxst_0_one - cut_cxst_c_one)/k_cxst_one); - cut_cxst_lc_one = cut_cxst_lo_one - 0.5 * (cut_cxst_lo_one - cut_cxst_0_one)/b_cxst_lo_one;; + cut_cxst_lc_one = cut_cxst_lo_one - 0.5 * (cut_cxst_lo_one - cut_cxst_0_one)/b_cxst_lo_one; b_cxst_hi_one = 0.25 * (cut_cxst_hi_one - cut_cxst_0_one) * (cut_cxst_hi_one - cut_cxst_0_one)/ (0.5 * (cut_cxst_hi_one - cut_cxst_0_one) * (cut_cxst_hi_one - cut_cxst_0_one) - diff --git a/src/CG-DNA/pair_oxdna_xstk.cpp b/src/CG-DNA/pair_oxdna_xstk.cpp index d95004f537..6ef6091889 100644 --- a/src/CG-DNA/pair_oxdna_xstk.cpp +++ b/src/CG-DNA/pair_oxdna_xstk.cpp @@ -696,7 +696,7 @@ void PairOxdnaXstk::coeff(int narg, char **arg) (0.5 * (cut_xst_lo_one - cut_xst_0_one) * (cut_xst_lo_one - cut_xst_0_one) - k_xst_one * 0.5 * (cut_xst_0_one -cut_xst_c_one) * (cut_xst_0_one - cut_xst_c_one)/k_xst_one); - cut_xst_lc_one = cut_xst_lo_one - 0.5 * (cut_xst_lo_one - cut_xst_0_one)/b_xst_lo_one;; + cut_xst_lc_one = cut_xst_lo_one - 0.5 * (cut_xst_lo_one - cut_xst_0_one)/b_xst_lo_one; b_xst_hi_one = 0.25 * (cut_xst_hi_one - cut_xst_0_one) * (cut_xst_hi_one - cut_xst_0_one)/ (0.5 * (cut_xst_hi_one - cut_xst_0_one) * (cut_xst_hi_one - cut_xst_0_one) - diff --git a/src/CG-DNA/pair_oxrna2_xstk.cpp b/src/CG-DNA/pair_oxrna2_xstk.cpp index cdba56e33a..e28b6573bf 100644 --- a/src/CG-DNA/pair_oxrna2_xstk.cpp +++ b/src/CG-DNA/pair_oxrna2_xstk.cpp @@ -639,7 +639,7 @@ void PairOxrna2Xstk::coeff(int narg, char **arg) (0.5 * (cut_xst_lo_one - cut_xst_0_one) * (cut_xst_lo_one - cut_xst_0_one) - k_xst_one * 0.5 * (cut_xst_0_one -cut_xst_c_one) * (cut_xst_0_one - cut_xst_c_one)/k_xst_one); - cut_xst_lc_one = cut_xst_lo_one - 0.5 * (cut_xst_lo_one - cut_xst_0_one)/b_xst_lo_one;; + cut_xst_lc_one = cut_xst_lo_one - 0.5 * (cut_xst_lo_one - cut_xst_0_one)/b_xst_lo_one; b_xst_hi_one = 0.25 * (cut_xst_hi_one - cut_xst_0_one) * (cut_xst_hi_one - cut_xst_0_one)/ (0.5 * (cut_xst_hi_one - cut_xst_0_one) * (cut_xst_hi_one - cut_xst_0_one) - diff --git a/src/EXTRA-COMPUTE/compute_adf.cpp b/src/EXTRA-COMPUTE/compute_adf.cpp index fc74cb8037..35ff8bfd33 100644 --- a/src/EXTRA-COMPUTE/compute_adf.cpp +++ b/src/EXTRA-COMPUTE/compute_adf.cpp @@ -288,7 +288,7 @@ void ComputeADF::init() rcutinnerk[0] = 0.0; rcutouterj[0] = force->pair->cutforce; rcutouterk[0] = force->pair->cutforce; - maxouter = force->pair->cutforce;; + maxouter = force->pair->cutforce; } else { for (int m = 0; m < ntriples; m++) { maxouter = MAX(rcutouterj[m],maxouter); diff --git a/src/EXTRA-DUMP/dump_xtc.cpp b/src/EXTRA-DUMP/dump_xtc.cpp index 6b0b97181b..ba3f740cf7 100644 --- a/src/EXTRA-DUMP/dump_xtc.cpp +++ b/src/EXTRA-DUMP/dump_xtc.cpp @@ -1046,7 +1046,7 @@ int xdr3dfcoord(XDR *xdrs, float *fp, int *size, float *precision) sizesmall[0] = sizesmall[1] = sizesmall[2] = magicints[smallidx]; } } - if (buf[1] != 0) buf[0]++;; + if (buf[1] != 0) buf[0]++; xdr_int(xdrs, &(buf[0])); /* buf[0] holds the length in bytes */ return errval * (xdr_opaque(xdrs, (caddr_t)&(buf[3]), (u_int)buf[0])); } else { diff --git a/src/EXTRA-FIX/fix_wall_ees.cpp b/src/EXTRA-FIX/fix_wall_ees.cpp index 230b8f6ac0..0e4d5aa1eb 100644 --- a/src/EXTRA-FIX/fix_wall_ees.cpp +++ b/src/EXTRA-FIX/fix_wall_ees.cpp @@ -116,7 +116,7 @@ void FixWallEES::wall_particle(int m, int which, double coord) nhat[(dim+2)%3] = 0 ; - double* shape = bonus[ellipsoid[i]].shape;; + double* shape = bonus[ellipsoid[i]].shape; MathExtra::quat_to_mat(bonus[ellipsoid[i]].quat,A); MathExtra::transpose_matvec(A,nhat,tempvec); for (int k = 0; k<3; k++) { diff --git a/src/INTEL/npair_full_bin_intel.cpp b/src/INTEL/npair_full_bin_intel.cpp index 2f8af4c8af..285ed35ec9 100644 --- a/src/INTEL/npair_full_bin_intel.cpp +++ b/src/INTEL/npair_full_bin_intel.cpp @@ -62,7 +62,7 @@ fbi(NeighList *list, IntelBuffers *buffers) { list->inum = nlocal; list->gnum = 0; - int host_start = _fix->host_start_neighbor();; + int host_start = _fix->host_start_neighbor(); const int off_end = _fix->offload_end_neighbor(); #ifdef _LMP_INTEL_OFFLOAD diff --git a/src/INTEL/pppm_disp_intel.cpp b/src/INTEL/pppm_disp_intel.cpp index cc4aa6ab93..6dac9fad99 100644 --- a/src/INTEL/pppm_disp_intel.cpp +++ b/src/INTEL/pppm_disp_intel.cpp @@ -1478,7 +1478,7 @@ void PPPMDispIntel::fieldforce_c_ik(IntelBuffers * /*buffers*/) int nxsum = nx + nlower; int nysum = ny + nlower; - int nzsum = nz + nlower;; + int nzsum = nz + nlower; FFT_SCALAR dx = nx+fshiftone - (x[i][0]-lo0)*xi; FFT_SCALAR dy = ny+fshiftone - (x[i][1]-lo1)*yi; diff --git a/src/KOKKOS/atom_vec_dpd_kokkos.cpp b/src/KOKKOS/atom_vec_dpd_kokkos.cpp index eda26a92dc..a8ce29f666 100644 --- a/src/KOKKOS/atom_vec_dpd_kokkos.cpp +++ b/src/KOKKOS/atom_vec_dpd_kokkos.cpp @@ -116,22 +116,22 @@ void AtomVecDPDKokkos::grow_pointers() d_dpdTheta = atomKK->k_dpdTheta.d_view; h_dpdTheta = atomKK->k_dpdTheta.h_view; uCond = atomKK->uCond; - d_uCond = atomKK->k_uCond.d_view;; + d_uCond = atomKK->k_uCond.d_view; h_uCond = atomKK->k_uCond.h_view; uMech = atomKK->uMech; - d_uMech = atomKK->k_uMech.d_view;; + d_uMech = atomKK->k_uMech.d_view; h_uMech = atomKK->k_uMech.h_view; uChem = atomKK->uChem; - d_uChem = atomKK->k_uChem.d_view;; + d_uChem = atomKK->k_uChem.d_view; h_uChem = atomKK->k_uChem.h_view; uCG = atomKK->uCG; - d_uCG = atomKK->k_uCG.d_view;; + d_uCG = atomKK->k_uCG.d_view; h_uCG = atomKK->k_uCG.h_view; uCGnew = atomKK->uCGnew; - d_uCGnew = atomKK->k_uCGnew.d_view;; + d_uCGnew = atomKK->k_uCGnew.d_view; h_uCGnew = atomKK->k_uCGnew.h_view; duChem = atomKK->duChem; - d_duChem = atomKK->k_duChem.d_view;; + d_duChem = atomKK->k_duChem.d_view; h_duChem = atomKK->k_duChem.h_view; } diff --git a/src/KOKKOS/dihedral_harmonic_kokkos.cpp b/src/KOKKOS/dihedral_harmonic_kokkos.cpp index 96287946ea..8ca0b368df 100644 --- a/src/KOKKOS/dihedral_harmonic_kokkos.cpp +++ b/src/KOKKOS/dihedral_harmonic_kokkos.cpp @@ -265,9 +265,9 @@ void DihedralHarmonicKokkos::operator()(TagDihedralHarmonicComputenspecial[iatom][0]; for (j = 0; j < npartner[i]; j++) - partner_tag[i][j] = atommols[imol]->special[iatom][j] + tagprev;; + partner_tag[i][j] = atommols[imol]->special[iatom][j] + tagprev; } } diff --git a/src/SMTBQ/pair_smtbq.cpp b/src/SMTBQ/pair_smtbq.cpp index 15e5c2da5e..fdef0b6043 100644 --- a/src/SMTBQ/pair_smtbq.cpp +++ b/src/SMTBQ/pair_smtbq.cpp @@ -204,7 +204,7 @@ PairSMTBQ::~PairSMTBQ() memory->destroy(potcov); memory->destroy(nvsm); - memory->destroy(vsm);; + memory->destroy(vsm); memory->destroy(flag_QEq); memory->destroy(nQEqall); diff --git a/src/SPIN/min_spin_lbfgs.cpp b/src/SPIN/min_spin_lbfgs.cpp index c9c84239b6..ae9d33a705 100644 --- a/src/SPIN/min_spin_lbfgs.cpp +++ b/src/SPIN/min_spin_lbfgs.cpp @@ -378,7 +378,7 @@ void MinSpinLBFGS::calc_search_direction() scaling = maximum_rotation(g_cur); for (int i = 0; i < 3 * nlocal; i++) { - p_s[i] = -g_cur[i] * factor * scaling;; + p_s[i] = -g_cur[i] * factor * scaling; g_old[i] = g_cur[i] * factor; for (int k = 0; k < num_mem; k++) { ds[k][i] = 0.0; diff --git a/src/fix_ave_grid.cpp b/src/fix_ave_grid.cpp index 524def73a4..039c656fab 100644 --- a/src/fix_ave_grid.cpp +++ b/src/fix_ave_grid.cpp @@ -931,7 +931,7 @@ void FixAveGrid::atom2grid() vsq = v[i][0]*v[i][0] + v[i][1]*v[i][1] + v[i][2]*v[i][2]; if (rmass) one = rmass[i]; else one = mass[type[i]]; - array2d[bin[i][0]][bin[i][1]][m] += one*vsq;; + array2d[bin[i][0]][bin[i][1]][m] += one*vsq; } } } else { diff --git a/src/input.cpp b/src/input.cpp index 1dc2b00ebc..dbbc62df59 100644 --- a/src/input.cpp +++ b/src/input.cpp @@ -567,7 +567,7 @@ void Input::substitute(char *&str, char *&str2, int &max, int &max2, int flag) // else $x becomes x followed by null char // beyond = points to text following variable - int i,n,paren_count,nchars;; + int i,n,paren_count,nchars; char immediate[256]; char *var,*value,*beyond; int quoteflag = 0; diff --git a/src/special.cpp b/src/special.cpp index a210b6a82a..7e15ec9e80 100644 --- a/src/special.cpp +++ b/src/special.cpp @@ -958,7 +958,7 @@ void Special::combine() void Special::angle_trim() { - int i,j,k,m;; + int i,j,k,m; int *num_angle = atom->num_angle; int *num_dihedral = atom->num_dihedral; From d8135194931b08efa7ae2b786e4e7a5c9617919b Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Mon, 26 Jun 2023 10:52:12 -0400 Subject: [PATCH 314/396] make handling of masses consistent and simplify code --- src/EXTRA-COMPUTE/compute_stress_mop.cpp | 37 +++++++--------- .../compute_stress_mop_profile.cpp | 44 +++++++------------ 2 files changed, 31 insertions(+), 50 deletions(-) diff --git a/src/EXTRA-COMPUTE/compute_stress_mop.cpp b/src/EXTRA-COMPUTE/compute_stress_mop.cpp index 98e3bf7043..aa50f39ab9 100644 --- a/src/EXTRA-COMPUTE/compute_stress_mop.cpp +++ b/src/EXTRA-COMPUTE/compute_stress_mop.cpp @@ -432,16 +432,14 @@ void ComputeStressMop::compute_pairs() fi[1] = atom->f[i][1]; fi[2] = atom->f[i][2]; - //coordinates at t-dt (based on Velocity-Verlet alg.) - if (rmass) { - xj[0] = xi[0]-vi[0]*dt+fi[0]/2.0/rmass[i]*dt*dt*ftm2v; - xj[1] = xi[1]-vi[1]*dt+fi[1]/2.0/rmass[i]*dt*dt*ftm2v; - xj[2] = xi[2]-vi[2]*dt+fi[2]/2.0/rmass[i]*dt*dt*ftm2v; - } else { - xj[0] = xi[0]-vi[0]*dt+fi[0]/2.0/mass[itype]*dt*dt*ftm2v; - xj[1] = xi[1]-vi[1]*dt+fi[1]/2.0/mass[itype]*dt*dt*ftm2v; - xj[2] = xi[2]-vi[2]*dt+fi[2]/2.0/mass[itype]*dt*dt*ftm2v; - } + const double imass = (rmass) ? rmass[i] : mass[itype]; + const double iterm = 0.5/imass*dt*ftm2v; + + // coordinates at t-dt (based on Velocity-Verlet alg.) + + xj[0] = xi[0]-vi[0]*dt+fi[0]*iterm*dt; + xj[1] = xi[1]-vi[1]*dt+fi[1]*iterm*dt; + xj[2] = xi[2]-vi[2]*dt+fi[2]*iterm*dt; // because LAMMPS does not put atoms back in the box // at each timestep, must check atoms going through the @@ -453,23 +451,18 @@ void ComputeStressMop::compute_pairs() if (((xi[dir]-pos_temp)*(xj[dir]-pos_temp)) < 0) { // sgn = copysign(1.0,vi[dir]-vcm[dir]); + sgn = copysign(1.0,vi[dir]); // approximate crossing velocity by v(t-dt/2) (based on Velocity-Verlet alg.) double vcross[3]; - if (rmass) { - vcross[0] = vi[0]-fi[0]/rmass[i]/2.0*ftm2v*dt; - vcross[1] = vi[1]-fi[1]/rmass[i]/2.0*ftm2v*dt; - vcross[2] = vi[2]-fi[2]/rmass[i]/2.0*ftm2v*dt; - } else { - vcross[0] = vi[0]-fi[0]/mass[itype]/2.0*ftm2v*dt; - vcross[1] = vi[1]-fi[1]/mass[itype]/2.0*ftm2v*dt; - vcross[2] = vi[2]-fi[2]/mass[itype]/2.0*ftm2v*dt; - } + vcross[0] = vi[0]-fi[0]*iterm; + vcross[1] = vi[1]-fi[1]*iterm; + vcross[2] = vi[2]-fi[2]*iterm; - values_local[m] += mass[itype]*vcross[0]*sgn/dt/area*nktv2p/ftm2v; - values_local[m+1] += mass[itype]*vcross[1]*sgn/dt/area*nktv2p/ftm2v; - values_local[m+2] += mass[itype]*vcross[2]*sgn/dt/area*nktv2p/ftm2v; + values_local[m] += imass*vcross[0]*sgn/dt/area*nktv2p/ftm2v; + values_local[m+1] += imass*vcross[1]*sgn/dt/area*nktv2p/ftm2v; + values_local[m+2] += imass*vcross[2]*sgn/dt/area*nktv2p/ftm2v; } } } diff --git a/src/EXTRA-COMPUTE/compute_stress_mop_profile.cpp b/src/EXTRA-COMPUTE/compute_stress_mop_profile.cpp index 1f1dc30733..12a02cbe63 100644 --- a/src/EXTRA-COMPUTE/compute_stress_mop_profile.cpp +++ b/src/EXTRA-COMPUTE/compute_stress_mop_profile.cpp @@ -435,16 +435,14 @@ void ComputeStressMopProfile::compute_pairs() fi[1] = atom->f[i][1]; fi[2] = atom->f[i][2]; - //coordinates at t-dt (based on Velocity-Verlet alg.) - if (rmass) { - xj[0] = xi[0]-vi[0]*dt+fi[0]/2/rmass[i]*dt*dt*ftm2v; - xj[1] = xi[1]-vi[1]*dt+fi[1]/2/rmass[i]*dt*dt*ftm2v; - xj[2] = xi[2]-vi[2]*dt+fi[2]/2/rmass[i]*dt*dt*ftm2v; - } else { - xj[0] = xi[0]-vi[0]*dt+fi[0]/2/mass[itype]*dt*dt*ftm2v; - xj[1] = xi[1]-vi[1]*dt+fi[1]/2/mass[itype]*dt*dt*ftm2v; - xj[2] = xi[2]-vi[2]*dt+fi[2]/2/mass[itype]*dt*dt*ftm2v; - } + const double imass = (rmass) ? rmass[i] : mass[itype]; + const double iterm = 0.5/imass*dt*ftm2v; + + // coordinates at t-dt (based on Velocity-Verlet alg.) + + xj[0] = xi[0]-vi[0]*dt+fi[0]*iterm*dt; + xj[1] = xi[1]-vi[1]*dt+fi[1]*iterm*dt; + xj[2] = xi[2]-vi[2]*dt+fi[2]*iterm*dt; for (ibin = 0; ibin < nbins; ibin++) { pos = coord[ibin][0]; @@ -454,26 +452,16 @@ void ComputeStressMopProfile::compute_pairs() sgn = copysign(1.0,vi[dir]); - //approximate crossing velocity by v(t-dt/2) (based on Velocity-Verlet alg.) - if (rmass) { - double vcross[3]; - vcross[0] = vi[0]-fi[0]/rmass[i]/2*ftm2v*dt; - vcross[1] = vi[1]-fi[1]/rmass[i]/2*ftm2v*dt; - vcross[2] = vi[2]-fi[2]/rmass[i]/2*ftm2v*dt; + // approximate crossing velocity by v(t-dt/2) (based on Velocity-Verlet alg.) - values_local[ibin][m] += rmass[i]*vcross[0]*sgn/dt/area*nktv2p/ftm2v; - values_local[ibin][m+1] += rmass[i]*vcross[1]*sgn/dt/area*nktv2p/ftm2v; - values_local[ibin][m+2] += rmass[i]*vcross[2]*sgn/dt/area*nktv2p/ftm2v; - } else { - double vcross[3]; - vcross[0] = vi[0]-fi[0]/mass[itype]/2*ftm2v*dt; - vcross[1] = vi[1]-fi[1]/mass[itype]/2*ftm2v*dt; - vcross[2] = vi[2]-fi[2]/mass[itype]/2*ftm2v*dt; + double vcross[3]; + vcross[0] = vi[0]-fi[0]*iterm; + vcross[1] = vi[1]-fi[1]*iterm; + vcross[2] = vi[2]-fi[2]*iterm; - values_local[ibin][m] += mass[itype]*vcross[0]*sgn/dt/area*nktv2p/ftm2v; - values_local[ibin][m+1] += mass[itype]*vcross[1]*sgn/dt/area*nktv2p/ftm2v; - values_local[ibin][m+2] += mass[itype]*vcross[2]*sgn/dt/area*nktv2p/ftm2v; - } + values_local[ibin][m] += imass*vcross[0]*sgn/dt/area*nktv2p/ftm2v; + values_local[ibin][m+1] += imass*vcross[1]*sgn/dt/area*nktv2p/ftm2v; + values_local[ibin][m+2] += imass*vcross[2]*sgn/dt/area*nktv2p/ftm2v; } } } From d4e705b0598dc6489b9dffeb6533599a7371a005 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Mon, 26 Jun 2023 10:59:03 -0400 Subject: [PATCH 315/396] enable and apply clang-format --- src/EXTRA-COMPUTE/compute_stress_mop.cpp | 308 ++++++++++-------- .../compute_stress_mop_profile.cpp | 269 ++++++++------- 2 files changed, 314 insertions(+), 263 deletions(-) diff --git a/src/EXTRA-COMPUTE/compute_stress_mop.cpp b/src/EXTRA-COMPUTE/compute_stress_mop.cpp index aa50f39ab9..fc9de602a7 100644 --- a/src/EXTRA-COMPUTE/compute_stress_mop.cpp +++ b/src/EXTRA-COMPUTE/compute_stress_mop.cpp @@ -41,11 +41,9 @@ using namespace LAMMPS_NS; enum { X, Y, Z }; enum { TOTAL, CONF, KIN, PAIR, BOND, ANGLE }; -// clang-format off /* ---------------------------------------------------------------------- */ -ComputeStressMop::ComputeStressMop(LAMMPS *lmp, int narg, char **arg) : - Compute(lmp, narg, arg) +ComputeStressMop::ComputeStressMop(LAMMPS *lmp, int narg, char **arg) : Compute(lmp, narg, arg) { if (narg < 6) utils::missing_cmd_args(FLERR, "compute stress/mop", error); @@ -54,37 +52,40 @@ ComputeStressMop::ComputeStressMop(LAMMPS *lmp, int narg, char **arg) : // set compute mode and direction of plane(s) for pressure calculation - if (strcmp(arg[3],"x") == 0) { + if (strcmp(arg[3], "x") == 0) { dir = X; - } else if (strcmp(arg[3],"y") == 0) { + } else if (strcmp(arg[3], "y") == 0) { dir = Y; - } else if (strcmp(arg[3],"z") == 0) { + } else if (strcmp(arg[3], "z") == 0) { dir = Z; - } else error->all(FLERR,"Illegal compute stress/mop command"); + } else + error->all(FLERR, "Illegal compute stress/mop command"); // Position of the plane - if (strcmp(arg[4],"lower") == 0) { + if (strcmp(arg[4], "lower") == 0) { pos = domain->boxlo[dir]; - } else if (strcmp(arg[4],"upper") == 0) { + } else if (strcmp(arg[4], "upper") == 0) { pos = domain->boxhi[dir]; - } else if (strcmp(arg[4],"center") == 0) { - pos = 0.5*(domain->boxlo[dir]+domain->boxhi[dir]); - } else pos = utils::numeric(FLERR,arg[4],false,lmp); + } else if (strcmp(arg[4], "center") == 0) { + pos = 0.5 * (domain->boxlo[dir] + domain->boxhi[dir]); + } else + pos = utils::numeric(FLERR, arg[4], false, lmp); // plane inside the box + if ((pos > domain->boxhi[dir]) || (pos < domain->boxlo[dir])) { error->warning(FLERR, "The specified initial plane lies outside of the simulation box"); double dx[3] = {0.0, 0.0, 0.0}; - dx[dir] = pos - 0.5*(domain->boxhi[dir] + domain->boxlo[dir]); + dx[dir] = pos - 0.5 * (domain->boxhi[dir] + domain->boxlo[dir]); domain->minimum_image(dx[0], dx[1], dx[2]); - pos = 0.5*(domain->boxhi[dir] + domain->boxlo[dir]) + dx[dir]; + pos = 0.5 * (domain->boxhi[dir] + domain->boxlo[dir]) + dx[dir]; if ((pos > domain->boxhi[dir]) || (pos < domain->boxlo[dir])) error->all(FLERR, "Plane for compute stress/mop is out of bounds"); } - if (pos < (domain->boxlo[dir]+domain->prd_half[dir])) { + if (pos < (domain->boxlo[dir] + domain->prd_half[dir])) { pos1 = pos + domain->prd[dir]; } else { pos1 = pos - domain->prd[dir]; @@ -92,52 +93,53 @@ ComputeStressMop::ComputeStressMop(LAMMPS *lmp, int narg, char **arg) : // parse values until one isn't recognized - which = new int[3*(narg-5)]; + which = new int[3 * (narg - 5)]; nvalues = 0; int i; - int iarg=5; + int iarg = 5; while (iarg < narg) { - if (strcmp(arg[iarg],"conf") == 0) { - for (i=0; i<3; i++) { + if (strcmp(arg[iarg], "conf") == 0) { + for (i = 0; i < 3; i++) { which[nvalues] = CONF; nvalues++; } - } else if (strcmp(arg[iarg],"kin") == 0) { - for (i=0; i<3; i++) { + } else if (strcmp(arg[iarg], "kin") == 0) { + for (i = 0; i < 3; i++) { which[nvalues] = KIN; nvalues++; } - } else if (strcmp(arg[iarg],"total") == 0) { - for (i=0; i<3; i++) { + } else if (strcmp(arg[iarg], "total") == 0) { + for (i = 0; i < 3; i++) { which[nvalues] = TOTAL; nvalues++; } - } else if (strcmp(arg[iarg],"pair") == 0) { - for (i=0; i<3; i++) { + } else if (strcmp(arg[iarg], "pair") == 0) { + for (i = 0; i < 3; i++) { which[nvalues] = PAIR; nvalues++; } - } else if (strcmp(arg[iarg],"bond") == 0) { - for (i=0; i<3; i++) { + } else if (strcmp(arg[iarg], "bond") == 0) { + for (i = 0; i < 3; i++) { which[nvalues] = BOND; nvalues++; } - } else if (strcmp(arg[iarg],"angle") == 0) { - for (i=0; i<3; i++) { + } else if (strcmp(arg[iarg], "angle") == 0) { + for (i = 0; i < 3; i++) { which[nvalues] = ANGLE; nvalues++; } - } else error->all(FLERR, "Illegal compute stress/mop command"); //break; + } else + error->all(FLERR, "Illegal compute stress/mop command"); //break; iarg++; } - // Error checks + // Error checks: + // 3D only - if (domain->dimension != 3) - error->all(FLERR, "Compute stress/mop requires a 3d system"); + if (domain->dimension != 3) error->all(FLERR, "Compute stress/mop requires a 3d system"); // orthogonal simulation box if (domain->triclinic != 0) @@ -153,18 +155,17 @@ ComputeStressMop::ComputeStressMop(LAMMPS *lmp, int narg, char **arg) : // this fix produces a global vector - memory->create(vector,nvalues,"stress/mop:vector"); - memory->create(values_local,nvalues,"stress/mop:values_local"); - memory->create(values_global,nvalues,"stress/mop:values_global"); - memory->create(bond_local,nvalues,"stress/mop:bond_local"); - memory->create(bond_global,nvalues,"stress/mop:bond_global"); - memory->create(angle_local,nvalues,"stress/mop:angle_local"); - memory->create(angle_global,nvalues,"stress/mop:angle_global"); + memory->create(vector, nvalues, "stress/mop:vector"); + memory->create(values_local, nvalues, "stress/mop:values_local"); + memory->create(values_global, nvalues, "stress/mop:values_global"); + memory->create(bond_local, nvalues, "stress/mop:bond_local"); + memory->create(bond_global, nvalues, "stress/mop:bond_global"); + memory->create(angle_local, nvalues, "stress/mop:angle_local"); + memory->create(angle_global, nvalues, "stress/mop:angle_global"); size_vector = nvalues; vector_flag = 1; extvector = 0; - } /* ---------------------------------------------------------------------- */ @@ -196,8 +197,8 @@ void ComputeStressMop::init() area = 1; int i; - for (i=0; i<3; i++) { - if (i!=dir) area = area*domain->prd[i]; + for (i = 0; i < 3; i++) { + if (i != dir) area = area * domain->prd[i]; } // Timestep Value @@ -212,10 +213,9 @@ void ComputeStressMop::init() // This compute requires a pair style with pair_single method implemented - if (!force->pair) - error->all(FLERR,"No pair style is defined for compute stress/mop"); + if (!force->pair) error->all(FLERR, "No pair style is defined for compute stress/mop"); if (force->pair->single_enable == 0) - error->all(FLERR,"Pair style does not support compute stress/mop"); + error->all(FLERR, "Pair style does not support compute stress/mop"); // Errors @@ -227,21 +227,23 @@ void ComputeStressMop::init() if (force->angle) { if (force->angle->born_matrix_enable == 0) { if ((strcmp(force->angle_style, "zero") != 0) && (strcmp(force->angle_style, "none") != 0)) - error->all(FLERR,"compute stress/mop does not account for angle potentials"); + error->all(FLERR, "compute stress/mop does not account for angle potentials"); } else { - angleflag = 1; + angleflag = 1; } } if (force->dihedral) { - if ((strcmp(force->dihedral_style, "zero") != 0) && (strcmp(force->dihedral_style, "none") != 0)) - error->all(FLERR,"compute stress/mop does not account for dihedral potentials"); + if ((strcmp(force->dihedral_style, "zero") != 0) && + (strcmp(force->dihedral_style, "none") != 0)) + error->all(FLERR, "compute stress/mop does not account for dihedral potentials"); } if (force->improper) { - if ((strcmp(force->improper_style, "zero") != 0) && (strcmp(force->improper_style, "none") != 0)) - error->all(FLERR,"compute stress/mop does not account for improper potentials"); + if ((strcmp(force->improper_style, "zero") != 0) && + (strcmp(force->improper_style, "none") != 0)) + error->all(FLERR, "compute stress/mop does not account for improper potentials"); } if (force->kspace) - error->warning(FLERR,"compute stress/mop does not account for kspace contributions"); + error->warning(FLERR, "compute stress/mop does not account for kspace contributions"); } // need an occasional half neighbor list @@ -255,7 +257,6 @@ void ComputeStressMop::init_list(int /* id */, NeighList *ptr) list = ptr; } - /* ---------------------------------------------------------------------- compute output vector ------------------------------------------------------------------------- */ @@ -264,38 +265,43 @@ void ComputeStressMop::compute_vector() { invoked_array = update->ntimestep; - //Compute pressures on separate procs + // Compute pressures on separate procs + compute_pairs(); // sum pressure contributions over all procs - MPI_Allreduce(values_local,values_global,nvalues,MPI_DOUBLE,MPI_SUM,world); + + MPI_Allreduce(values_local, values_global, nvalues, MPI_DOUBLE, MPI_SUM, world); + + // Compute bond contribution on separate procs if (bondflag) { - //Compute bond contribution on separate procs compute_bonds(); } else { - for (int i=0; imass; double *rmass = atom->rmass; @@ -317,7 +323,6 @@ void ComputeStressMop::compute_pairs() double *special_lj = force->special_lj; int newton_pair = force->newton_pair; - // zero out arrays for one sample for (i = 0; i < nvalues; i++) values_local[i] = 0.0; @@ -373,7 +378,7 @@ void ComputeStressMop::compute_pairs() delx = xi[0] - xj[0]; dely = xi[1] - xj[1]; delz = xi[2] - xj[2]; - rsq = delx*delx + dely*dely + delz*delz; + rsq = delx * delx + dely * dely + delz * delz; jtype = type[j]; if (rsq >= cutsq[itype][jtype]) continue; @@ -381,29 +386,29 @@ void ComputeStressMop::compute_pairs() //check if ij pair is across plane, add contribution to pressure if (((xi[dir] > pos) && (xj[dir] < pos)) || ((xi[dir] > pos1) && (xj[dir] < pos1))) { - pair->single(i,j,itype,jtype,rsq,factor_coul,factor_lj,fpair); - values_local[m] += fpair*(xi[0]-xj[0])/area*nktv2p; - values_local[m+1] += fpair*(xi[1]-xj[1])/area*nktv2p; - values_local[m+2] += fpair*(xi[2]-xj[2])/area*nktv2p; - } else if (((xi[dir] < pos) && (xj[dir] > pos)) || ((xi[dir] < pos1) && (xj[dir] > pos1))) { - pair->single(i,j,itype,jtype,rsq,factor_coul,factor_lj,fpair); - values_local[m] -= fpair*(xi[0]-xj[0])/area*nktv2p; - values_local[m+1] -= fpair*(xi[1]-xj[1])/area*nktv2p; - values_local[m+2] -= fpair*(xi[2]-xj[2])/area*nktv2p; + pair->single(i, j, itype, jtype, rsq, factor_coul, factor_lj, fpair); + values_local[m] += fpair * (xi[0] - xj[0]) / area * nktv2p; + values_local[m + 1] += fpair * (xi[1] - xj[1]) / area * nktv2p; + values_local[m + 2] += fpair * (xi[2] - xj[2]) / area * nktv2p; + } else if (((xi[dir] < pos) && (xj[dir] > pos)) || + ((xi[dir] < pos1) && (xj[dir] > pos1))) { + pair->single(i, j, itype, jtype, rsq, factor_coul, factor_lj, fpair); + values_local[m] -= fpair * (xi[0] - xj[0]) / area * nktv2p; + values_local[m + 1] -= fpair * (xi[1] - xj[1]) / area * nktv2p; + values_local[m + 2] -= fpair * (xi[2] - xj[2]) / area * nktv2p; } } else { if (((xi[dir] > pos) && (xj[dir] < pos)) || ((xi[dir] > pos1) && (xj[dir] < pos1))) { - pair->single(i,j,itype,jtype,rsq,factor_coul,factor_lj,fpair); - values_local[m] += fpair*(xi[0]-xj[0])/area*nktv2p; - values_local[m+1] += fpair*(xi[1]-xj[1])/area*nktv2p; - values_local[m+2] += fpair*(xi[2]-xj[2])/area*nktv2p; + pair->single(i, j, itype, jtype, rsq, factor_coul, factor_lj, fpair); + values_local[m] += fpair * (xi[0] - xj[0]) / area * nktv2p; + values_local[m + 1] += fpair * (xi[1] - xj[1]) / area * nktv2p; + values_local[m + 2] += fpair * (xi[2] - xj[2]) / area * nktv2p; } } } } } - // Compute kinetic contribution to pressure // counts local particles transfers across the plane @@ -413,56 +418,61 @@ void ComputeStressMop::compute_pairs() for (int i = 0; i < nlocal; i++) { // skip if I is not in group + if (mask[i] & groupbit) { itype = type[i]; - //coordinates at t + // coordinates at t + xi[0] = atom->x[i][0]; xi[1] = atom->x[i][1]; xi[2] = atom->x[i][2]; - //velocities at t + // velocities at t + vi[0] = atom->v[i][0]; vi[1] = atom->v[i][1]; vi[2] = atom->v[i][2]; - //forces at t + // forces at t + fi[0] = atom->f[i][0]; fi[1] = atom->f[i][1]; fi[2] = atom->f[i][2]; const double imass = (rmass) ? rmass[i] : mass[itype]; - const double iterm = 0.5/imass*dt*ftm2v; + const double iterm = 0.5 / imass * dt * ftm2v; // coordinates at t-dt (based on Velocity-Verlet alg.) - xj[0] = xi[0]-vi[0]*dt+fi[0]*iterm*dt; - xj[1] = xi[1]-vi[1]*dt+fi[1]*iterm*dt; - xj[2] = xi[2]-vi[2]*dt+fi[2]*iterm*dt; + xj[0] = xi[0] - vi[0] * dt + fi[0] * iterm * dt; + xj[1] = xi[1] - vi[1] * dt + fi[1] * iterm * dt; + xj[2] = xi[2] - vi[2] * dt + fi[2] * iterm * dt; // because LAMMPS does not put atoms back in the box // at each timestep, must check atoms going through the // image of the plane that is closest to the box - double pos_temp = pos+copysign(1.0,domain->prd_half[dir]-pos)*domain->prd[dir]; - if (fabs(xi[dir]-pos)prd_half[dir] - pos) * domain->prd[dir]; + if (fabs(xi[dir] - pos) < fabs(xi[dir] - pos_temp)) pos_temp = pos; - if (((xi[dir]-pos_temp)*(xj[dir]-pos_temp)) < 0) { + if (((xi[dir] - pos_temp) * (xj[dir] - pos_temp)) < 0) { // sgn = copysign(1.0,vi[dir]-vcm[dir]); - sgn = copysign(1.0,vi[dir]); + sgn = copysign(1.0, vi[dir]); // approximate crossing velocity by v(t-dt/2) (based on Velocity-Verlet alg.) - double vcross[3]; - vcross[0] = vi[0]-fi[0]*iterm; - vcross[1] = vi[1]-fi[1]*iterm; - vcross[2] = vi[2]-fi[2]*iterm; - values_local[m] += imass*vcross[0]*sgn/dt/area*nktv2p/ftm2v; - values_local[m+1] += imass*vcross[1]*sgn/dt/area*nktv2p/ftm2v; - values_local[m+2] += imass*vcross[2]*sgn/dt/area*nktv2p/ftm2v; + double vcross[3]; + vcross[0] = vi[0] - fi[0] * iterm; + vcross[1] = vi[1] - fi[1] * iterm; + vcross[2] = vi[2] - fi[2] * iterm; + + values_local[m] += imass * vcross[0] * sgn / dt / area * nktv2p / ftm2v; + values_local[m + 1] += imass * vcross[1] * sgn / dt / area * nktv2p / ftm2v; + values_local[m + 2] += imass * vcross[2] * sgn / dt / area * nktv2p / ftm2v; } } } @@ -504,9 +514,11 @@ void ComputeStressMop::compute_bonds() double local_contribution[3] = {0.0, 0.0, 0.0}; // initialization + for (int i = 0; i < nvalues; i++) bond_local[i] = 0.0; // loop over all bonded atoms in the current proc + for (atom1 = 0; atom1 < nlocal; atom1++) { if (!(mask[atom1] & groupbit)) continue; @@ -534,6 +546,7 @@ void ComputeStressMop::compute_bonds() if (btype <= 0) continue; // minimum image of atom1 with respect to the plane of interest + dx[0] = x[atom1][0]; dx[1] = x[atom1][1]; dx[2] = x[atom1][2]; @@ -545,6 +558,7 @@ void ComputeStressMop::compute_bonds() x_bond_1[dir] += pos; // minimum image of atom2 with respect to atom1 + dx[0] = x[atom2][0] - x_bond_1[0]; dx[1] = x[atom2][1] - x_bond_1[1]; dx[2] = x[atom2][2] - x_bond_1[2]; @@ -554,6 +568,7 @@ void ComputeStressMop::compute_bonds() x_bond_2[2] = x_bond_1[2] + dx[2]; // check if the bond vector crosses the plane of interest + double tau = (x_bond_1[dir] - pos) / (x_bond_1[dir] - x_bond_2[dir]); if ((tau <= 1) && (tau >= 0)) { dx[0] = x_bond_1[0] - x_bond_2[0]; @@ -563,20 +578,21 @@ void ComputeStressMop::compute_bonds() bond->single(btype, rsq, atom1, atom2, fpair); double sgn = copysign(1.0, x_bond_1[dir] - pos); - local_contribution[0] += sgn*fpair*dx[0]/area*nktv2p; - local_contribution[1] += sgn*fpair*dx[1]/area*nktv2p; - local_contribution[2] += sgn*fpair*dx[2]/area*nktv2p; + local_contribution[0] += sgn * fpair * dx[0] / area * nktv2p; + local_contribution[1] += sgn * fpair * dx[1] / area * nktv2p; + local_contribution[2] += sgn * fpair * dx[2] / area * nktv2p; } } } // loop over the keywords and if necessary add the bond contribution + int m = 0; - while (m=0) && (tau_right <= 1)); - bool left_cross = ((tau_left >=0) && (tau_left <= 1)); + bool right_cross = ((tau_right >= 0) && (tau_right <= 1)); + bool left_cross = ((tau_left >= 0) && (tau_left <= 1)); // no bonds crossing the plane + if (!right_cross && !left_cross) continue; // compute the cos(theta) of the angle - r1 = sqrt(dx_left[0]*dx_left[0] + dx_left[1]*dx_left[1] + dx_left[2]*dx_left[2]); - r2 = sqrt(dx_right[0]*dx_right[0] + dx_right[1]*dx_right[1] + dx_right[2]*dx_right[2]); - cos_theta = -(dx_right[0]*dx_left[0] + dx_right[1]*dx_left[1] + dx_right[2]*dx_left[2])/(r1*r2); - if (cos_theta > 1.0) cos_theta = 1.0; + r1 = sqrt(dx_left[0] * dx_left[0] + dx_left[1] * dx_left[1] + dx_left[2] * dx_left[2]); + r2 = sqrt(dx_right[0] * dx_right[0] + dx_right[1] * dx_right[1] + dx_right[2] * dx_right[2]); + cos_theta = + -(dx_right[0] * dx_left[0] + dx_right[1] * dx_left[1] + dx_right[2] * dx_left[2]) / + (r1 * r2); + + if (cos_theta > 1.0) cos_theta = 1.0; if (cos_theta < -1.0) cos_theta = -1.0; // The method returns derivative with regards to cos(theta) + angle->born_matrix(atype, atom1, atom2, atom3, duang, du2ang); + // only right bond crossing the plane - if (right_cross && !left_cross) - { + + if (right_cross && !left_cross) { double sgn = copysign(1.0, x_angle_right[dir] - pos); - dcos_theta[0] = sgn*(dx_right[0]*cos_theta/r2 + dx_left[0]/r1)/r2; - dcos_theta[1] = sgn*(dx_right[1]*cos_theta/r2 + dx_left[1]/r1)/r2; - dcos_theta[2] = sgn*(dx_right[2]*cos_theta/r2 + dx_left[2]/r1)/r2; + dcos_theta[0] = sgn * (dx_right[0] * cos_theta / r2 + dx_left[0] / r1) / r2; + dcos_theta[1] = sgn * (dx_right[1] * cos_theta / r2 + dx_left[1] / r1) / r2; + dcos_theta[2] = sgn * (dx_right[2] * cos_theta / r2 + dx_left[2] / r1) / r2; } // only left bond crossing the plane - if (!right_cross && left_cross) - { + + if (!right_cross && left_cross) { double sgn = copysign(1.0, x_angle_left[dir] - pos); - dcos_theta[0] = -sgn*(dx_left[0]*cos_theta/r1 + dx_right[0]/r2)/r1; - dcos_theta[1] = -sgn*(dx_left[1]*cos_theta/r1 + dx_right[1]/r2)/r1; - dcos_theta[2] = -sgn*(dx_left[2]*cos_theta/r1 + dx_right[2]/r2)/r1; + dcos_theta[0] = -sgn * (dx_left[0] * cos_theta / r1 + dx_right[0] / r2) / r1; + dcos_theta[1] = -sgn * (dx_left[1] * cos_theta / r1 + dx_right[1] / r2) / r1; + dcos_theta[2] = -sgn * (dx_left[2] * cos_theta / r1 + dx_right[2] / r2) / r1; } // both bonds crossing the plane - if (right_cross && left_cross) - { + + if (right_cross && left_cross) { + // due to right bond + double sgn = copysign(1.0, x_angle_middle[dir] - pos); - dcos_theta[0] = -sgn*(dx_right[0]*cos_theta/r2 + dx_left[0]/r1)/r2; - dcos_theta[1] = -sgn*(dx_right[1]*cos_theta/r2 + dx_left[1]/r1)/r2; - dcos_theta[2] = -sgn*(dx_right[2]*cos_theta/r2 + dx_left[2]/r1)/r2; + dcos_theta[0] = -sgn * (dx_right[0] * cos_theta / r2 + dx_left[0] / r1) / r2; + dcos_theta[1] = -sgn * (dx_right[1] * cos_theta / r2 + dx_left[1] / r1) / r2; + dcos_theta[2] = -sgn * (dx_right[2] * cos_theta / r2 + dx_left[2] / r1) / r2; // due to left bond - dcos_theta[0] += sgn*(dx_left[0]*cos_theta/r1 + dx_right[0]/r2)/r1; - dcos_theta[1] += sgn*(dx_left[1]*cos_theta/r1 + dx_right[1]/r2)/r1; - dcos_theta[2] += sgn*(dx_left[2]*cos_theta/r1 + dx_right[2]/r2)/r1; + + dcos_theta[0] += sgn * (dx_left[0] * cos_theta / r1 + dx_right[0] / r2) / r1; + dcos_theta[1] += sgn * (dx_left[1] * cos_theta / r1 + dx_right[1] / r2) / r1; + dcos_theta[2] += sgn * (dx_left[2] * cos_theta / r1 + dx_right[2] / r2) / r1; } // final contribution of the given angle term - local_contribution[0] += duang*dcos_theta[0]/area*nktv2p; - local_contribution[1] += duang*dcos_theta[1]/area*nktv2p; - local_contribution[2] += duang*dcos_theta[2]/area*nktv2p; + + local_contribution[0] += duang * dcos_theta[0] / area * nktv2p; + local_contribution[1] += duang * dcos_theta[1] / area * nktv2p; + local_contribution[2] += duang * dcos_theta[2] / area * nktv2p; } } + // loop over the keywords and if necessary add the angle contribution + int m = 0; while (m < nvalues) { if (which[m] == CONF || which[m] == TOTAL || which[m] == ANGLE) { angle_local[m] = local_contribution[0]; - angle_local[m+1] = local_contribution[1]; - angle_local[m+2] = local_contribution[2]; + angle_local[m + 1] = local_contribution[1]; + angle_local[m + 2] = local_contribution[2]; } m += 3; } diff --git a/src/EXTRA-COMPUTE/compute_stress_mop_profile.cpp b/src/EXTRA-COMPUTE/compute_stress_mop_profile.cpp index 12a02cbe63..cc201fdbaa 100644 --- a/src/EXTRA-COMPUTE/compute_stress_mop_profile.cpp +++ b/src/EXTRA-COMPUTE/compute_stress_mop_profile.cpp @@ -41,11 +41,10 @@ enum { X, Y, Z }; enum { LOWER, CENTER, UPPER, COORD }; enum { TOTAL, CONF, KIN, PAIR, BOND }; -// clang-format off /* ---------------------------------------------------------------------- */ ComputeStressMopProfile::ComputeStressMopProfile(LAMMPS *lmp, int narg, char **arg) : - Compute(lmp, narg, arg) + Compute(lmp, narg, arg) { if (narg < 7) utils::missing_cmd_args(FLERR, "compute stress/mop/profile", error); @@ -53,58 +52,64 @@ ComputeStressMopProfile::ComputeStressMopProfile(LAMMPS *lmp, int narg, char **a // set compute mode and direction of plane(s) for pressure calculation - if (strcmp(arg[3],"x") == 0) { + if (strcmp(arg[3], "x") == 0) { dir = X; - } else if (strcmp(arg[3],"y") == 0) { + } else if (strcmp(arg[3], "y") == 0) { dir = Y; - } else if (strcmp(arg[3],"z") == 0) { + } else if (strcmp(arg[3], "z") == 0) { dir = Z; - } else error->all(FLERR,"Illegal compute stress/mop/profile command"); + } else + error->all(FLERR, "Illegal compute stress/mop/profile command"); // bin parameters - if (strcmp(arg[4],"lower") == 0) originflag = LOWER; - else if (strcmp(arg[4],"center") == 0) originflag = CENTER; - else if (strcmp(arg[4],"upper") == 0) originflag = UPPER; - else originflag = COORD; - if (originflag == COORD) origin = utils::numeric(FLERR,arg[4],false,lmp); - delta = utils::numeric(FLERR,arg[5],false,lmp); - invdelta = 1.0/delta; + if (strcmp(arg[4], "lower") == 0) + originflag = LOWER; + else if (strcmp(arg[4], "center") == 0) + originflag = CENTER; + else if (strcmp(arg[4], "upper") == 0) + originflag = UPPER; + else + originflag = COORD; + if (originflag == COORD) origin = utils::numeric(FLERR, arg[4], false, lmp); + delta = utils::numeric(FLERR, arg[5], false, lmp); + invdelta = 1.0 / delta; // parse values until one isn't recognized - which = new int[3*(narg-6)]; + which = new int[3 * (narg - 6)]; nvalues = 0; int i; - int iarg=6; + int iarg = 6; while (iarg < narg) { - if (strcmp(arg[iarg],"conf") == 0) { - for (i=0; i<3; i++) { + if (strcmp(arg[iarg], "conf") == 0) { + for (i = 0; i < 3; i++) { which[nvalues] = CONF; nvalues++; } - } else if (strcmp(arg[iarg],"kin") == 0) { - for (i=0; i<3; i++) { + } else if (strcmp(arg[iarg], "kin") == 0) { + for (i = 0; i < 3; i++) { which[nvalues] = KIN; nvalues++; } - } else if (strcmp(arg[iarg],"total") == 0) { - for (i=0; i<3; i++) { + } else if (strcmp(arg[iarg], "total") == 0) { + for (i = 0; i < 3; i++) { which[nvalues] = TOTAL; nvalues++; } - } else if (strcmp(arg[iarg],"pair") == 0) { - for (i=0; i<3; i++) { + } else if (strcmp(arg[iarg], "pair") == 0) { + for (i = 0; i < 3; i++) { which[nvalues] = PAIR; nvalues++; } - } else if (strcmp(arg[iarg],"bond") == 0) { - for (i=0; i<3; i++) { + } else if (strcmp(arg[iarg], "bond") == 0) { + for (i = 0; i < 3; i++) { which[nvalues] = BOND; nvalues++; } - } else error->all(FLERR, "Illegal compute stress/mop/profile command"); //break; + } else + error->all(FLERR, "Illegal compute stress/mop/profile command"); //break; iarg++; } @@ -136,7 +141,7 @@ ComputeStressMopProfile::ComputeStressMopProfile(LAMMPS *lmp, int narg, char **a // this fix produces a global array - memory->create(array,nbins,1+nvalues,"stress/mop/profile:array"); + memory->create(array, nbins, 1 + nvalues, "stress/mop/profile:array"); size_array_rows = nbins; size_array_cols = 1 + nvalues; @@ -173,47 +178,49 @@ void ComputeStressMopProfile::init() area = 1; int i; - for (i=0; i<3; i++) { - if (i!=dir) area = area*domain->prd[i]; + for (i = 0; i < 3; i++) { + if (i != dir) area = area * domain->prd[i]; } // timestep Value dt = update->dt; - // Error check + // Error checks: + // Compute stress/mop/profile requires fixed simulation box if (domain->box_change_size || domain->box_change_shape || domain->deform_flag) error->all(FLERR, "Compute stress/mop/profile requires a fixed simulation box"); - //This compute requires a pair style with pair_single method implemented + // This compute requires a pair style with pair_single method implemented - if (!force->pair) - error->all(FLERR,"No pair style is defined for compute stress/mop/profile"); + if (!force->pair) error->all(FLERR, "No pair style is defined for compute stress/mop/profile"); if (force->pair->single_enable == 0) - error->all(FLERR,"Pair style does not support compute stress/mop/profile"); + error->all(FLERR, "Pair style does not support compute stress/mop/profile"); // Errors if (comm->me == 0) { - //Compute stress/mop/profile only accounts for pair interactions. + // Compute stress/mop/profile only accounts for pair interactions. // issue an error if any intramolecular potential or Kspace is defined. if (force->bond) bondflag = 1; if (force->angle) if ((strcmp(force->angle_style, "zero") != 0) && (strcmp(force->angle_style, "none") != 0)) - error->all(FLERR,"compute stress/mop/profile does not account for angle potentials"); + error->all(FLERR, "compute stress/mop/profile does not account for angle potentials"); if (force->dihedral) - if ((strcmp(force->dihedral_style, "zero") != 0) && (strcmp(force->dihedral_style, "none") != 0)) - error->all(FLERR,"compute stress/mop/profile does not account for dihedral potentials"); + if ((strcmp(force->dihedral_style, "zero") != 0) && + (strcmp(force->dihedral_style, "none") != 0)) + error->all(FLERR, "compute stress/mop/profile does not account for dihedral potentials"); if (force->improper) - if ((strcmp(force->improper_style, "zero") != 0) && (strcmp(force->improper_style, "none") != 0)) - error->all(FLERR,"compute stress/mop/profile does not account for improper potentials"); + if ((strcmp(force->improper_style, "zero") != 0) && + (strcmp(force->improper_style, "none") != 0)) + error->all(FLERR, "compute stress/mop/profile does not account for improper potentials"); if (force->kspace) - error->warning(FLERR,"compute stress/mop/profile does not account for kspace contributions"); + error->warning(FLERR, "compute stress/mop/profile does not account for kspace contributions"); } // need an occasional half neighbor list @@ -228,7 +235,6 @@ void ComputeStressMopProfile::init_list(int /* id */, NeighList *ptr) list = ptr; } - /* ---------------------------------------------------------------------- compute output array ------------------------------------------------------------------------- */ @@ -237,39 +243,41 @@ void ComputeStressMopProfile::compute_array() { invoked_array = update->ntimestep; - //Compute pressures on separate procs + // Compute pressures on separate procs + compute_pairs(); // sum pressure contributions over all procs - MPI_Allreduce(&values_local[0][0],&values_global[0][0],nbins*nvalues,MPI_DOUBLE,MPI_SUM,world); + + MPI_Allreduce(&values_local[0][0], &values_global[0][0], nbins * nvalues, MPI_DOUBLE, MPI_SUM, + world); + + // Compute bond contribution on separate procs if (bondflag) { - //Compute bond contribution on separate procs compute_bonds(); } else { for (int m = 0; m < nbins; m++) { - for (int i = 0; i < nvalues; i++) { - bond_local[m][i] = 0.0; - } + for (int i = 0; i < nvalues; i++) { bond_local[m][i] = 0.0; } } } // sum bond contribution over all procs - MPI_Allreduce(&bond_local[0][0],&bond_global[0][0],nbins*nvalues,MPI_DOUBLE,MPI_SUM,world); - for (int ibin=0; ibinmass; double *rmass = atom->rmass; @@ -292,8 +300,8 @@ void ComputeStressMopProfile::compute_pairs() double *special_lj = force->special_lj; int newton_pair = force->newton_pair; - // zero out arrays for one sample + for (m = 0; m < nbins; m++) { for (i = 0; i < nvalues; i++) values_local[m][i] = 0.0; } @@ -351,53 +359,51 @@ void ComputeStressMopProfile::compute_pairs() delx = xi[0] - xj[0]; dely = xi[1] - xj[1]; delz = xi[2] - xj[2]; - rsq = delx*delx + dely*dely + delz*delz; + rsq = delx * delx + dely * dely + delz * delz; jtype = type[j]; if (rsq >= cutsq[itype][jtype]) continue; if (newton_pair || j < nlocal) { - for (ibin=0;ibinpos) && (xj[dir]pos1) && (xj[dir] pos) && (xj[dir] < pos)) || ((xi[dir] > pos1) && (xj[dir] < pos1))) { - pair->single(i,j,itype,jtype,rsq,factor_coul,factor_lj,fpair); + pair->single(i, j, itype, jtype, rsq, factor_coul, factor_lj, fpair); - values_local[ibin][m] += fpair*(xi[0]-xj[0])/area*nktv2p; - values_local[ibin][m+1] += fpair*(xi[1]-xj[1])/area*nktv2p; - values_local[ibin][m+2] += fpair*(xi[2]-xj[2])/area*nktv2p; + values_local[ibin][m] += fpair * (xi[0] - xj[0]) / area * nktv2p; + values_local[ibin][m + 1] += fpair * (xi[1] - xj[1]) / area * nktv2p; + values_local[ibin][m + 2] += fpair * (xi[2] - xj[2]) / area * nktv2p; - } else if ( ((xi[dir]pos)) - || ((xi[dir]pos1))) { + } else if (((xi[dir] < pos) && (xj[dir] > pos)) || + ((xi[dir] < pos1) && (xj[dir] > pos1))) { - pair->single(i,j,itype,jtype,rsq,factor_coul,factor_lj,fpair); + pair->single(i, j, itype, jtype, rsq, factor_coul, factor_lj, fpair); - values_local[ibin][m] -= fpair*(xi[0]-xj[0])/area*nktv2p; - values_local[ibin][m+1] -= fpair*(xi[1]-xj[1])/area*nktv2p; - values_local[ibin][m+2] -= fpair*(xi[2]-xj[2])/area*nktv2p; + values_local[ibin][m] -= fpair * (xi[0] - xj[0]) / area * nktv2p; + values_local[ibin][m + 1] -= fpair * (xi[1] - xj[1]) / area * nktv2p; + values_local[ibin][m + 2] -= fpair * (xi[2] - xj[2]) / area * nktv2p; } } } else { - for (ibin=0;ibinpos) && (xj[dir]pos1) && (xj[dir] pos) && (xj[dir] < pos)) || ((xi[dir] > pos1) && (xj[dir] < pos1))) { - pair->single(i,j,itype,jtype,rsq,factor_coul,factor_lj,fpair); + pair->single(i, j, itype, jtype, rsq, factor_coul, factor_lj, fpair); - values_local[ibin][m] += fpair*(xi[0]-xj[0])/area*nktv2p; - values_local[ibin][m+1] += fpair*(xi[1]-xj[1])/area*nktv2p; - values_local[ibin][m+2] += fpair*(xi[2]-xj[2])/area*nktv2p; + values_local[ibin][m] += fpair * (xi[0] - xj[0]) / area * nktv2p; + values_local[ibin][m + 1] += fpair * (xi[1] - xj[1]) / area * nktv2p; + values_local[ibin][m + 2] += fpair * (xi[2] - xj[2]) / area * nktv2p; } } } @@ -420,54 +426,57 @@ void ComputeStressMopProfile::compute_pairs() itype = type[i]; - //coordinates at t + // coordinates at t + xi[0] = atom->x[i][0]; xi[1] = atom->x[i][1]; xi[2] = atom->x[i][2]; - //velocities at t + // velocities at t + vi[0] = atom->v[i][0]; vi[1] = atom->v[i][1]; vi[2] = atom->v[i][2]; - //forces at t + // forces at t + fi[0] = atom->f[i][0]; fi[1] = atom->f[i][1]; fi[2] = atom->f[i][2]; const double imass = (rmass) ? rmass[i] : mass[itype]; - const double iterm = 0.5/imass*dt*ftm2v; + const double iterm = 0.5 / imass * dt * ftm2v; // coordinates at t-dt (based on Velocity-Verlet alg.) - xj[0] = xi[0]-vi[0]*dt+fi[0]*iterm*dt; - xj[1] = xi[1]-vi[1]*dt+fi[1]*iterm*dt; - xj[2] = xi[2]-vi[2]*dt+fi[2]*iterm*dt; + xj[0] = xi[0] - vi[0] * dt + fi[0] * iterm * dt; + xj[1] = xi[1] - vi[1] * dt + fi[1] * iterm * dt; + xj[2] = xi[2] - vi[2] * dt + fi[2] * iterm * dt; for (ibin = 0; ibin < nbins; ibin++) { pos = coord[ibin][0]; pos1 = coordp[ibin][0]; - if (((xi[dir]-pos)*(xj[dir]-pos)*(xi[dir]-pos1)*(xj[dir]-pos1)<0)) { + if (((xi[dir] - pos) * (xj[dir] - pos) * (xi[dir] - pos1) * (xj[dir] - pos1) < 0)) { - sgn = copysign(1.0,vi[dir]); + sgn = copysign(1.0, vi[dir]); // approximate crossing velocity by v(t-dt/2) (based on Velocity-Verlet alg.) double vcross[3]; - vcross[0] = vi[0]-fi[0]*iterm; - vcross[1] = vi[1]-fi[1]*iterm; - vcross[2] = vi[2]-fi[2]*iterm; + vcross[0] = vi[0] - fi[0] * iterm; + vcross[1] = vi[1] - fi[1] * iterm; + vcross[2] = vi[2] - fi[2] * iterm; - values_local[ibin][m] += imass*vcross[0]*sgn/dt/area*nktv2p/ftm2v; - values_local[ibin][m+1] += imass*vcross[1]*sgn/dt/area*nktv2p/ftm2v; - values_local[ibin][m+2] += imass*vcross[2]*sgn/dt/area*nktv2p/ftm2v; + values_local[ibin][m] += imass * vcross[0] * sgn / dt / area * nktv2p / ftm2v; + values_local[ibin][m + 1] += imass * vcross[1] * sgn / dt / area * nktv2p / ftm2v; + values_local[ibin][m + 2] += imass * vcross[2] * sgn / dt / area * nktv2p / ftm2v; } } } } } - m+=3; + m += 3; } } @@ -503,16 +512,16 @@ void ComputeStressMopProfile::compute_bonds() double x_bond_2[3] = {0.0, 0.0, 0.0}; // initialization + for (int m = 0; m < nbins; m++) { - for (int i = 0; i < nvalues; i++) { - bond_local[m][i] = 0.0; - } + for (int i = 0; i < nvalues; i++) { bond_local[m][i] = 0.0; } local_contribution[m][0] = 0.0; local_contribution[m][1] = 0.0; local_contribution[m][2] = 0.0; } // loop over all bonded atoms in the current proc + for (atom1 = 0; atom1 < nlocal; atom1++) { if (!(mask[atom1] & groupbit)) continue; @@ -539,10 +548,11 @@ void ComputeStressMopProfile::compute_bonds() if (newton_bond == 0 && tag[atom1] > tag[atom2]) continue; if (btype <= 0) continue; - for (int ibin = 0; ibin= 0)) { dx[0] = x_bond_1[0] - x_bond_2[0]; @@ -572,22 +584,23 @@ void ComputeStressMopProfile::compute_bonds() bond->single(btype, rsq, atom1, atom2, fpair); double sgn = copysign(1.0, x_bond_1[dir] - pos); - local_contribution[ibin][0] += sgn*fpair*dx[0]/area*nktv2p; - local_contribution[ibin][1] += sgn*fpair*dx[1]/area*nktv2p; - local_contribution[ibin][2] += sgn*fpair*dx[2]/area*nktv2p; + local_contribution[ibin][0] += sgn * fpair * dx[0] / area * nktv2p; + local_contribution[ibin][1] += sgn * fpair * dx[1] / area * nktv2p; + local_contribution[ibin][2] += sgn * fpair * dx[2] / area * nktv2p; } } } } // loop over the keywords and if necessary add the bond contribution + int m = 0; while (m < nvalues) { if ((which[m] == CONF) || (which[m] == TOTAL) || (which[m] == BOND)) { for (int ibin = 0; ibin < nbins; ibin++) { bond_local[ibin][m] = local_contribution[ibin][0]; - bond_local[ibin][m+1] = local_contribution[ibin][1]; - bond_local[ibin][m+2] = local_contribution[ibin][2]; + bond_local[ibin][m + 1] = local_contribution[ibin][1]; + bond_local[ibin][m + 2] = local_contribution[ibin][2]; } } m += 3; @@ -601,47 +614,51 @@ void ComputeStressMopProfile::compute_bonds() void ComputeStressMopProfile::setup_bins() { - int i,n; + int i, n; double lo = 0.0, hi = 0.0; - double *boxlo,*boxhi; + double *boxlo, *boxhi; boxlo = domain->boxlo; boxhi = domain->boxhi; - if (originflag == LOWER) origin = boxlo[dir]; - else if (originflag == UPPER) origin = boxhi[dir]; + if (originflag == LOWER) + origin = boxlo[dir]; + else if (originflag == UPPER) + origin = boxhi[dir]; else if (originflag == CENTER) origin = 0.5 * (boxlo[dir] + boxhi[dir]); if (origin < boxlo[dir]) { - error->all(FLERR,"Origin of bins for compute stress/mop/profile is out of bounds" ); + error->all(FLERR, "Origin of bins for compute stress/mop/profile is out of bounds"); } else { - n = static_cast ((origin - boxlo[dir]) * invdelta); - lo = origin - n*delta; + n = static_cast((origin - boxlo[dir]) * invdelta); + lo = origin - n * delta; } if (origin < boxhi[dir]) { - n = static_cast ((boxhi[dir] - origin) * invdelta); - hi = origin + n*delta; + n = static_cast((boxhi[dir] - origin) * invdelta); + hi = origin + n * delta; } else { - error->all(FLERR,"Origin of bins for compute stress/mop/profile is out of bounds" ); + error->all(FLERR, "Origin of bins for compute stress/mop/profile is out of bounds"); } offset = lo; - nbins = static_cast ((hi-lo) * invdelta + 1.5); + nbins = static_cast((hi - lo) * invdelta + 1.5); - //allocate bin arrays - memory->create(coord,nbins,1,"stress/mop/profile:coord"); - memory->create(coordp,nbins,1,"stress/mop/profile:coordp"); - memory->create(values_local,nbins,nvalues,"stress/mop/profile:values_local"); - memory->create(values_global,nbins,nvalues,"stress/mop/profile:values_global"); - memory->create(bond_local,nbins,nvalues,"stress/mop/profile:bond_local"); - memory->create(bond_global,nbins,nvalues,"stress/mop/profile:bond_global"); - memory->create(local_contribution,nbins,3,"stress/mop/profile:local_contribution"); + // allocate bin arrays + + memory->create(coord, nbins, 1, "stress/mop/profile:coord"); + memory->create(coordp, nbins, 1, "stress/mop/profile:coordp"); + memory->create(values_local, nbins, nvalues, "stress/mop/profile:values_local"); + memory->create(values_global, nbins, nvalues, "stress/mop/profile:values_global"); + memory->create(bond_local, nbins, nvalues, "stress/mop/profile:bond_local"); + memory->create(bond_global, nbins, nvalues, "stress/mop/profile:bond_global"); + memory->create(local_contribution, nbins, 3, "stress/mop/profile:local_contribution"); // set bin coordinates + for (i = 0; i < nbins; i++) { - coord[i][0] = offset + i*delta; - if (coord[i][0] < (domain->boxlo[dir]+domain->prd_half[dir])) { + coord[i][0] = offset + i * delta; + if (coord[i][0] < (domain->boxlo[dir] + domain->prd_half[dir])) { coordp[i][0] = coord[i][0] + domain->prd[dir]; } else { coordp[i][0] = coord[i][0] - domain->prd[dir]; From 46a9f0a08c4e9d5a7777015f68ce57ca5a18e306 Mon Sep 17 00:00:00 2001 From: Steve Plimpton Date: Mon, 26 Jun 2023 11:08:04 -0700 Subject: [PATCH 316/396] change QM Python wrappers to use ENERGY instead of PE as MDI command --- examples/QUANTUM/LATTE/latte_mdi.py | 6 +++--- examples/QUANTUM/NWChem/nwchem_mdi.py | 6 +++--- examples/QUANTUM/PySCF/pyscf_mdi.py | 6 +++--- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/examples/QUANTUM/LATTE/latte_mdi.py b/examples/QUANTUM/LATTE/latte_mdi.py index 0170feee1f..ba1a83120a 100644 --- a/examples/QUANTUM/LATTE/latte_mdi.py +++ b/examples/QUANTUM/LATTE/latte_mdi.py @@ -153,7 +153,7 @@ def mdi_engine(other_options): # engine --> driver - mdi.MDI_Register_Command("@DEFAULT","LATTICE_FORCES") mdi.MDI_Register_Command("@DEFAULT"," driver - mdi.MDI_Register_Command("@DEFAULT","LATTICE_FORCES") #mdi.MDI_Register_Command("@DEFAULT"," driver - mdi.MDI_Register_Command("@DEFAULT"," Date: Mon, 26 Jun 2023 15:20:29 -0400 Subject: [PATCH 317/396] make short read detection bugfix work in parallel --- src/utils.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/utils.cpp b/src/utils.cpp index eee1d5dd46..dd18c4406d 100644 --- a/src/utils.cpp +++ b/src/utils.cpp @@ -290,8 +290,9 @@ int utils::read_lines_from_file(FILE *fp, int nlines, int nmax, char *buffer, in } int n = strlen(buffer); + if (nlines != mylines) n = 0; MPI_Bcast(&n, 1, MPI_INT, 0, comm); - if ((n == 0) || (nlines != mylines)) return 1; + if (n == 0) return 1; MPI_Bcast(buffer, n + 1, MPI_CHAR, 0, comm); return 0; } From c347de78501d7e9693842559c37e22e17f0bf6a1 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Mon, 26 Jun 2023 16:12:15 -0400 Subject: [PATCH 318/396] improve error messages --- src/create_bonds.cpp | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/src/create_bonds.cpp b/src/create_bonds.cpp index 5355ce2b7c..fa063c7dc6 100644 --- a/src/create_bonds.cpp +++ b/src/create_bonds.cpp @@ -49,7 +49,7 @@ void CreateBonds::command(int narg, char **arg) if (atom->molecular != Atom::MOLECULAR) error->all(FLERR, "Cannot use create_bonds with non-molecular system"); - if (narg < 4) error->all(FLERR, "Illegal create_bonds command"); + if (narg < 4) utils::missing_cmd_args(FLERR, "create_bonds", error); // parse args @@ -58,38 +58,38 @@ void CreateBonds::command(int narg, char **arg) int iarg = 0; if (strcmp(arg[0], "many") == 0) { style = MANY; - if (narg != 6) error->all(FLERR, "Illegal create_bonds command"); + if (narg != 6) error->all(FLERR, "No optional keywords allowed with create_bonds many"); igroup = group->find(arg[1]); - if (igroup == -1) error->all(FLERR, "Cannot find create_bonds group ID"); + if (igroup == -1) error->all(FLERR, "Cannot find create_bonds first group ID {}",arg[1]); group1bit = group->bitmask[igroup]; igroup = group->find(arg[2]); - if (igroup == -1) error->all(FLERR, "Cannot find create_bonds group ID"); + if (igroup == -1) error->all(FLERR, "Cannot find create_bonds second group ID {}", arg[2]); group2bit = group->bitmask[igroup]; btype = utils::inumeric(FLERR, arg[3], false, lmp); rmin = utils::numeric(FLERR, arg[4], false, lmp); rmax = utils::numeric(FLERR, arg[5], false, lmp); - if (rmin > rmax) error->all(FLERR, "Illegal create_bonds command"); + if (rmin > rmax) error->all(FLERR, "Inconsistent cutoffs for create_bonds many"); iarg = 6; } else if (strcmp(arg[0], "single/bond") == 0) { style = SBOND; btype = utils::inumeric(FLERR, arg[1], false, lmp); batom1 = utils::tnumeric(FLERR, arg[2], false, lmp); batom2 = utils::tnumeric(FLERR, arg[3], false, lmp); - if (batom1 == batom2) error->all(FLERR, "Illegal create_bonds command"); + if (batom1 == batom2) error->all(FLERR, "Bond atoms must be different"); iarg = 4; } else if (strcmp(arg[0], "single/angle") == 0) { style = SANGLE; - if (narg < 5) error->all(FLERR, "Illegal create_bonds command"); + if (narg < 5) utils::missing_cmd_args(FLERR, "create_bonds single/angle", error); atype = utils::inumeric(FLERR, arg[1], false, lmp); aatom1 = utils::tnumeric(FLERR, arg[2], false, lmp); aatom2 = utils::tnumeric(FLERR, arg[3], false, lmp); aatom3 = utils::tnumeric(FLERR, arg[4], false, lmp); if ((aatom1 == aatom2) || (aatom1 == aatom3) || (aatom2 == aatom3)) - error->all(FLERR, "Illegal create_bonds command"); + error->all(FLERR, "Angle atoms must be different"); iarg = 5; } else if (strcmp(arg[0], "single/dihedral") == 0) { style = SDIHEDRAL; - if (narg < 6) error->all(FLERR, "Illegal create_bonds command"); + if (narg < 6) utils::missing_cmd_args(FLERR, "create_bonds single/dihedral", error); dtype = utils::inumeric(FLERR, arg[1], false, lmp); datom1 = utils::tnumeric(FLERR, arg[2], false, lmp); datom2 = utils::tnumeric(FLERR, arg[3], false, lmp); @@ -101,7 +101,7 @@ void CreateBonds::command(int narg, char **arg) iarg = 6; } else if (strcmp(arg[0], "single/improper") == 0) { style = SIMPROPER; - if (narg < 6) error->all(FLERR, "Illegal create_bonds command"); + if (narg < 6) utils::missing_cmd_args(FLERR, "create_bonds single/improper", error); dtype = utils::inumeric(FLERR, arg[1], false, lmp); datom1 = utils::tnumeric(FLERR, arg[2], false, lmp); datom2 = utils::tnumeric(FLERR, arg[3], false, lmp); From 906eecdbd7346b2921b01ec9f998f18e1c8886f0 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Tue, 27 Jun 2023 17:53:06 -0400 Subject: [PATCH 319/396] clarify the temperature computation in compute temp --- doc/src/compute_temp.rst | 28 +++++++++++++-------- doc/utils/sphinx-config/false_positives.txt | 1 + 2 files changed, 19 insertions(+), 10 deletions(-) diff --git a/doc/src/compute_temp.rst b/doc/src/compute_temp.rst index 8f6f9f225f..e081280496 100644 --- a/doc/src/compute_temp.rst +++ b/doc/src/compute_temp.rst @@ -37,20 +37,24 @@ The temperature is calculated by the formula .. math:: - \text{KE} = \frac{\text{dim}}{2} N k_B T, + T = \frac{2 E_\mathrm{kin}}{N_\mathrm{DOF} k_B} \quad \mathrm{with} \quad + E_\mathrm{kin} = \sum^{N_\mathrm{atoms}}_{i=1} \frac{1}{2} m_i v^2_i \quad \mathrm{and} \quad + N_\mathrm{DOF} = n_\mathrm{dim} N_\mathrm{atoms} - n_\mathrm{dim} - N_\mathrm{fix DOFs} -where KE = total kinetic energy of the group of atoms (sum of -:math:`\frac12 m v^2`), dim = 2 or 3 is the dimensionality of the -simulation, :math:`N` is the number of atoms in the group, :math:`k_B` -is the Boltzmann constant, and :math:`T` is the absolute temperature. +where :math:`E_\mathrm{kin}` is the total kinetic energy of the group of +atoms, :math:`n_\mathrm{dim}` is the dimensionality of the simulation +(i.e. either 2 or 3), :math:`N_\mathrm{atoms}` is the number of atoms in +the group, :math:`N_\mathrm{fix DOFs}` is the number of degrees of +freedom removed by fix commands (see below), :math:`k_B` is the +Boltzmann constant, and :math:`T` is the resulting computed temperature. A kinetic energy tensor, stored as a six-element vector, is also calculated by this compute for use in the computation of a pressure -tensor. The formula for the components of the tensor is the same as -the above formula, except that :math:`v^2` is replaced by :math:`v_x -v_y` for the :math:`xy` component, and so on. The six components of -the vector are ordered :math:`xx`, :math:`yy`, :math:`zz`, :math:`xy`, -:math:`xz`, :math:`yz`. +tensor. The formula for the components of the tensor is the same as the +above expression for :math:`E_\mathrm{kin}`, except that :math:`v_i^2` is +replaced by :math:`v_{i,x} v_{i,y}` for the :math:`xy` component, and so on. +The six components of the vector are ordered :math:`xx`, :math:`yy`, +:math:`zz`, :math:`xy`, :math:`xz`, :math:`yz`. The number of atoms contributing to the temperature is assumed to be constant for the duration of the run; use the *dynamic* option of the @@ -62,6 +66,10 @@ constrain molecular motion, such as :doc:`fix shake ` and atoms that include these constraints will be computed correctly. If needed, the subtracted degrees-of-freedom can be altered using the *extra* option of the :doc:`compute_modify ` command. +By default this *extra* component is initialized to +:math:`n_\mathrm{dim}` (as shown in the formula above) to represent the +degrees of freedom removed from a system due to its translation +invariance due to periodic boundary conditions. A compute of this style with the ID of "thermo_temp" is created when LAMMPS starts up, as if this command were in the input script: diff --git a/doc/utils/sphinx-config/false_positives.txt b/doc/utils/sphinx-config/false_positives.txt index 5791288a06..a68cd2714f 100644 --- a/doc/utils/sphinx-config/false_positives.txt +++ b/doc/utils/sphinx-config/false_positives.txt @@ -1559,6 +1559,7 @@ intramolecular ints inumeric inv +invariance invariants inversed invertible From a4cba99ff9851e5279e2521a45f2ce1e1d5dc2ca Mon Sep 17 00:00:00 2001 From: Trung Nguyen Date: Tue, 27 Jun 2023 23:55:57 -0500 Subject: [PATCH 320/396] Attempted to update slabcorr() in pppm/dielectric --- src/DIELECTRIC/fix_polarize_bem_icc.cpp | 2 ++ src/DIELECTRIC/pppm_dielectric.cpp | 6 +++--- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/DIELECTRIC/fix_polarize_bem_icc.cpp b/src/DIELECTRIC/fix_polarize_bem_icc.cpp index 2b5664e4f5..4dc7dd2669 100644 --- a/src/DIELECTRIC/fix_polarize_bem_icc.cpp +++ b/src/DIELECTRIC/fix_polarize_bem_icc.cpp @@ -455,6 +455,7 @@ void FixPolarizeBEMICC::set_dielectric_params(double ediff, double emean, double double *ed = atom->ed; double *em = atom->em; double *q = atom->q; + double *q_scaled = atom->q_scaled; double *epsilon = atom->epsilon; int *mask = atom->mask; int nlocal = atom->nlocal; @@ -466,6 +467,7 @@ void FixPolarizeBEMICC::set_dielectric_params(double ediff, double emean, double if (areai > 0) area[i] = areai; if (epsiloni > 0) epsilon[i] = epsiloni; if (set_charge) q[i] = qvalue; + q_scaled[i] = q[i] / epsilon[i]; } } } diff --git a/src/DIELECTRIC/pppm_dielectric.cpp b/src/DIELECTRIC/pppm_dielectric.cpp index b9ae1d65ff..e308cb0826 100644 --- a/src/DIELECTRIC/pppm_dielectric.cpp +++ b/src/DIELECTRIC/pppm_dielectric.cpp @@ -575,7 +575,7 @@ void PPPMDielectric::slabcorr() int nlocal = atom->nlocal; double dipole = 0.0; - for (int i = 0; i < nlocal; i++) dipole += q[i]*x[i][2]; + for (int i = 0; i < nlocal; i++) dipole += eps[i]*q[i]*x[i][2]; // sum local contributions to get global dipole moment @@ -588,7 +588,7 @@ void PPPMDielectric::slabcorr() double dipole_r2 = 0.0; if (eflag_atom || fabs(qsum) > SMALL) { for (int i = 0; i < nlocal; i++) - dipole_r2 += q[i]*x[i][2]*x[i][2]; + dipole_r2 += eps[i]*q[i]*x[i][2]*x[i][2]; // sum local contributions @@ -621,6 +621,6 @@ void PPPMDielectric::slabcorr() for (int i = 0; i < nlocal; i++) { f[i][2] += ffact * eps[i]*q[i]*(dipole_all - qsum*x[i][2]); - efield[i][2] += ffact * eps[i]*(dipole_all - qsum*x[i][2]); + efield[i][2] += ffact * (dipole_all - qsum*x[i][2]); } } From 5d027fc92c66e9875c165355f094dfac3adab74c Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Wed, 28 Jun 2023 09:50:27 -0400 Subject: [PATCH 321/396] error out when many bonds creation cutoff is larger than periodic domain --- src/create_bonds.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/create_bonds.cpp b/src/create_bonds.cpp index fa063c7dc6..2960eda766 100644 --- a/src/create_bonds.cpp +++ b/src/create_bonds.cpp @@ -60,7 +60,7 @@ void CreateBonds::command(int narg, char **arg) style = MANY; if (narg != 6) error->all(FLERR, "No optional keywords allowed with create_bonds many"); igroup = group->find(arg[1]); - if (igroup == -1) error->all(FLERR, "Cannot find create_bonds first group ID {}",arg[1]); + if (igroup == -1) error->all(FLERR, "Cannot find create_bonds first group ID {}", arg[1]); group1bit = group->bitmask[igroup]; igroup = group->find(arg[2]); if (igroup == -1) error->all(FLERR, "Cannot find create_bonds second group ID {}", arg[2]); @@ -197,6 +197,10 @@ void CreateBonds::many() if (rmax > neighbor->cutneighmin && comm->me == 0) error->warning(FLERR, "Create_bonds max distance > minimum neighbor cutoff"); + if ((domain->xperiodic && (rmax > domain->xprd)) || + (domain->yperiodic && (rmax > domain->yprd)) || (domain->zperiodic && (rmax > domain->zprd))) + error->all(FLERR, "Bond creation cutoff is larger than periodic domain"); + // require special_bonds 1-2 weights = 0.0 and KSpace = nullptr // so that already bonded atom pairs do not appear in neighbor list // otherwise with newton_bond = 1, @@ -205,7 +209,7 @@ void CreateBonds::many() if (force->special_lj[1] != 0.0 || force->special_coul[1] != 0.0) error->all(FLERR, "Create_bonds command requires special_bonds 1-2 weights be 0.0"); - if (force->kspace) error->all(FLERR, "Create_bonds command requires no kspace_style be defined"); + if (force->kspace) error->all(FLERR, "Create_bonds command is incompatible with Kspace styles"); // setup domain, communication and neighboring // acquire ghosts and build standard neighbor lists From a50993dac1255e3fb39e7d2436c69f9a34d38581 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Wed, 28 Jun 2023 10:06:31 -0400 Subject: [PATCH 322/396] update docs for create_bonds --- doc/src/create_bonds.rst | 45 ++++++++++++++++++++++++---------------- 1 file changed, 27 insertions(+), 18 deletions(-) diff --git a/doc/src/create_bonds.rst b/doc/src/create_bonds.rst index d520f1a88e..53a9a1ca50 100644 --- a/doc/src/create_bonds.rst +++ b/doc/src/create_bonds.rst @@ -86,19 +86,20 @@ data file for a complex system of molecules. .. note:: - If the system has no bonds (angles, dihedrals, impropers) to begin with, - or if more bonds per atom are being added than currently exist, then you - must ensure that the number of bond types and the maximum number of - bonds per atom are set to large enough values, and similarly for - angles, dihedrals, and impropers, otherwise an error may occur when too many - bonds (angles, dihedrals, impropers) are added to an atom. If the - :doc:`read_data ` command is used to define the system, these - parameters can be set via the "bond types" and "extra bond per atom" - fields in the header section of the data file. If the - :doc:`create_box ` command is used to define the system, - these two parameters can be set via its optional *bond/types* and - *extra/bond/per/atom* arguments, and similarly for angles, dihedrals, and - impropers. See the doc pages for these two commands for details. + If the system has no bonds (angles, dihedrals, impropers) to begin + with, or if more bonds per atom are being added than currently exist, + then you must ensure that the number of bond types and the maximum + number of bonds per atom are set to large enough values, and + similarly for angles, dihedrals, impropers, and special neighbors, + otherwise an error may occur when too many bonds (angles, dihedrals, + impropers) are added to an atom. If the :doc:`read_data ` + command is used to define the system, these parameters can be set via + its optional *extra/bond/types*, *extra/bond/per/atom*, and similar + keywords to the command. If the :doc:`create_box ` + command is used to define the system, these two parameters can be set + via its optional *bond/types* and *extra/bond/per/atom* arguments, + and similarly for angles, dihedrals, and impropers. See the + corresponding documentation pages for these two commands for details. ---------- @@ -112,7 +113,7 @@ For a bond to be created, an :math:`I,J` pair of atoms must be a distance :math:`D` apart such that :math:`r_\text{min} \le D \le r_\text{max}`. The following settings must have been made in an input script before -this style is used: +the *many* style is used: * special_bonds weight for 1--2 interactions must be 0.0 * a :doc:`pair_style ` must be defined @@ -121,10 +122,13 @@ this style is used: skin :math:`\ge r_\text{max}` These settings are required so that a neighbor list can be created to -search for nearby atoms. Pairs of atoms that are already bonded -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. +search for nearby atoms. Pairs of atoms that are already bonded 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. When using +periodic boundary conditions, the box length in each periodic dimension +must be larger than *rmax*, so that no bonds are created between the +system and its own periodic image. .. note:: @@ -219,6 +223,11 @@ This command cannot be used with molecular systems defined using molecule template files via the :doc:`molecule ` and :doc:`atom_style template ` commands. +For style *many*, no :doc:`kspace style ` must be +defined. Also, the *rmax* value must be smaller than any periodic box +length and the neighbor list cutoff (largest pair cutoff plus neighbor +skin). + Related commands """""""""""""""" From b0b26d9d3a329c76b6ca8d9d164b28f9d597645e Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Thu, 29 Jun 2023 07:32:52 -0400 Subject: [PATCH 323/396] silence compiler warning --- src/lammps.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lammps.cpp b/src/lammps.cpp index 956793c20a..9ac4c98bc3 100644 --- a/src/lammps.cpp +++ b/src/lammps.cpp @@ -135,7 +135,7 @@ LAMMPS::LAMMPS(int narg, char **arg, MPI_Comm communicator) : // append git descriptor info to update string when compiling development or maintenance version std::string update_string = UPDATE_STRING; - if (has_git_info() && (update_string == " - Development") || (update_string == " - Maintenance")) + if (has_git_info() && ((update_string == " - Development") || (update_string == " - Maintenance"))) update_string += fmt::format(" - {}", git_descriptor()); external_comm = 0; From 14462d8f8064884452b3ca3904b3c2ed58920eef Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Thu, 29 Jun 2023 16:13:16 -0400 Subject: [PATCH 324/396] join strings --- src/neighbor.cpp | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/neighbor.cpp b/src/neighbor.cpp index 006101da64..23b4b9984e 100644 --- a/src/neighbor.cpp +++ b/src/neighbor.cpp @@ -839,8 +839,7 @@ int Neighbor::init_pair() if (style == Neighbor::BIN) { for (i = 0; i < nrequest; i++) if (requests[i]->occasional && requests[i]->ghost) - error->all(FLERR,"Cannot request an occasional binned neighbor list " - "with ghost info"); + error->all(FLERR,"Cannot request an occasional binned neighbor list with ghost info"); } // morph requests in various ways @@ -2672,8 +2671,7 @@ void Neighbor::modify_params(int narg, char **arg) strcmp(arg[iarg+1],"molecule/intra") == 0) { if (iarg+3 > narg) utils::missing_cmd_args(FLERR, "neigh_modify exclude molecule", error); if (atom->molecule_flag == 0) - error->all(FLERR,"Neigh_modify exclude molecule " - "requires atom attribute molecule"); + error->all(FLERR,"Neigh_modify exclude molecule requires atom attribute molecule"); if (nex_mol == maxex_mol) { maxex_mol += EXDELTA; memory->grow(ex_mol_group,maxex_mol,"neigh:ex_mol_group"); From b7024288b66c3930d87b5cfc1dc825366e0a7390 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Thu, 29 Jun 2023 21:20:07 -0400 Subject: [PATCH 325/396] add check to disallow custom neighbor list cutoffs larger than the communication cutoff. --- src/neighbor.cpp | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/src/neighbor.cpp b/src/neighbor.cpp index 23b4b9984e..df1547e5eb 100644 --- a/src/neighbor.cpp +++ b/src/neighbor.cpp @@ -837,9 +837,20 @@ int Neighbor::init_pair() // similar to what vanilla Nbin::coord2atom() does now in atom2bin if (style == Neighbor::BIN) { - for (i = 0; i < nrequest; i++) + for (i = 0; i < nrequest; ++i) if (requests[i]->occasional && requests[i]->ghost) - error->all(FLERR,"Cannot request an occasional binned neighbor list with ghost info"); + error->all(FLERR, "Cannot request an occasional binned neighbor list with ghost info"); + } + + // check requests with a custom neighbor list cutoff to make sure the cutoff is within + // the communication cutoff. For perpetual lists, neighbor list skin is added later. + + const double comm_cutoff = comm->get_comm_cutoff(); + for (i = 0; i < nrequest; ++i) { + if (requests[i]->cut) { + if (comm_cutoff < (requests[i]->cutoff + (requests[i]->occasional ? 0.0 : skin))) + error->all(FLERR, "Custom neighbor list cutoff too large for communication cutoff"); + } } // morph requests in various ways From ab1e090e0e5aff5c943e25e64bc6e320d58c70a1 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Thu, 29 Jun 2023 21:32:04 -0400 Subject: [PATCH 326/396] neighbor list skin is added to custom cutoff automatically --- src/KIM/pair_kim.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/KIM/pair_kim.cpp b/src/KIM/pair_kim.cpp index ae2e6e6ea0..8ac6fe1f75 100644 --- a/src/KIM/pair_kim.cpp +++ b/src/KIM/pair_kim.cpp @@ -596,7 +596,7 @@ void PairKIM::init_style() if (kim_cutoff_values[i] <= neighbor->skin) error->all(FLERR,"Illegal neighbor request (force cutoff {:.3} <= skin {:.3})", kim_cutoff_values[i], neighbor->skin); - req->set_cutoff(kim_cutoff_values[i] + neighbor->skin); + req->set_cutoff(kim_cutoff_values[i]); } // increment instance_me in case of need to change the neighbor list // request settings From 02498925c57e86bbabdfc861fdf442babe10e03e Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Thu, 29 Jun 2023 22:07:04 -0400 Subject: [PATCH 327/396] only fail on too small periodic domain in z direction if 3d system. --- src/create_bonds.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/create_bonds.cpp b/src/create_bonds.cpp index 2960eda766..13a99a182f 100644 --- a/src/create_bonds.cpp +++ b/src/create_bonds.cpp @@ -198,7 +198,8 @@ void CreateBonds::many() error->warning(FLERR, "Create_bonds max distance > minimum neighbor cutoff"); if ((domain->xperiodic && (rmax > domain->xprd)) || - (domain->yperiodic && (rmax > domain->yprd)) || (domain->zperiodic && (rmax > domain->zprd))) + (domain->yperiodic && (rmax > domain->yprd)) || + ((domain->dimension == 3) && domain->zperiodic && (rmax > domain->zprd))) error->all(FLERR, "Bond creation cutoff is larger than periodic domain"); // require special_bonds 1-2 weights = 0.0 and KSpace = nullptr From 83528f02e83cdfc84e627f7a9f4b54c766c52bcf Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Thu, 29 Jun 2023 22:10:31 -0400 Subject: [PATCH 328/396] whitespace --- examples/balance/in.balance | 44 ++++++------- examples/balance/in.balance.bond.fast | 44 ++++++------- examples/balance/in.balance.bond.slow | 44 ++++++------- examples/balance/in.balance.clock.dynamic | 68 ++++++++++---------- examples/balance/in.balance.clock.static | 62 +++++++++--------- examples/balance/in.balance.group.dynamic | 56 ++++++++-------- examples/balance/in.balance.group.static | 62 +++++++++--------- examples/balance/in.balance.kspace | 52 +++++++-------- examples/balance/in.balance.neigh.dynamic | 66 +++++++++---------- examples/balance/in.balance.neigh.rcb | 66 +++++++++---------- examples/balance/in.balance.neigh.static | 58 ++++++++--------- examples/balance/in.balance.var.dynamic | 78 +++++++++++------------ 12 files changed, 350 insertions(+), 350 deletions(-) diff --git a/examples/balance/in.balance b/examples/balance/in.balance index e0fb5078aa..3a1298acfd 100644 --- a/examples/balance/in.balance +++ b/examples/balance/in.balance @@ -2,34 +2,34 @@ variable b index 0 -variable x index 50 -variable y index 20 -variable d index 20 -variable v index 5 -variable w index 2 - -units lj +variable x index 50 +variable y index 20 +variable d index 20 +variable v index 5 +variable w index 2 + +units lj dimension 2 -atom_style atomic +atom_style atomic boundary f f p -lattice hex 0.85 -region box block 0 $x 0 $y -0.5 0.5 -create_box 1 box -region circle sphere $(v_d/2+1) $(v_d/2/sqrt(3.0)+1) 0.0 $(v_d/2) -create_atoms 1 region circle -mass 1 1.0 +lattice hex 0.85 +region box block 0 $x 0 $y -0.5 0.5 +create_box 1 box +region circle sphere $(v_d/2+1) $(v_d/2/sqrt(3.0)+1) 0.0 $(v_d/2) +create_atoms 1 region circle +mass 1 1.0 -velocity all create 0.5 87287 loop geom +velocity all create 0.5 87287 loop geom velocity all set $v $w 0 sum yes -pair_style lj/cut 2.5 -pair_coeff 1 1 10.0 1.0 2.5 +pair_style lj/cut 2.5 +pair_coeff 1 1 10.0 1.0 2.5 -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 nve fix 2 all wall/lj93 xlo 0.0 1 1 2.5 xhi $x 1 1 2.5 fix 3 all wall/lj93 ylo 0.0 1 1 2.5 yhi $y 1 1 2.5 @@ -49,6 +49,6 @@ fix 10 all balance 50 0.9 rcb #dump_modify 3 pad 5 amap 0 10 sa 1 10 ${colors} thermo_style custom step temp epair press f_10[3] f_10 -thermo 100 +thermo 100 -run 10000 +run 10000 diff --git a/examples/balance/in.balance.bond.fast b/examples/balance/in.balance.bond.fast index 3bfcea033e..ff54fb94cc 100644 --- a/examples/balance/in.balance.bond.fast +++ b/examples/balance/in.balance.bond.fast @@ -2,29 +2,29 @@ variable b index 0 -variable x index 50 -variable y index 20 -variable d index 20 -variable v index 5 -variable w index 2 - -units lj +variable x index 50 +variable y index 20 +variable d index 20 +variable v index 5 +variable w index 2 + +units lj dimension 2 -atom_style bond +atom_style bond boundary f f p -lattice hex 0.85 -region box block 0 $x 0 $y -0.5 0.5 -create_box 1 box bond/types 1 extra/bond/per/atom 6 -region circle sphere $(v_d/2+1) $(v_d/2/sqrt(3.0)+1) 0.0 $(v_d/2) -create_atoms 1 region circle -mass 1 1.0 +lattice hex 0.85 +region box block 0 $x 0 $y -0.5 0.5 +create_box 1 box bond/types 1 extra/bond/per/atom 6 +region circle sphere $(v_d/2+1) $(v_d/2/sqrt(3.0)+1) 0.0 $(v_d/2) +create_atoms 1 region circle +mass 1 1.0 -velocity all create 0.5 87287 loop geom +velocity all create 0.5 87287 loop geom velocity all set $v $w 0 sum yes -pair_style lj/cut 2.5 -pair_coeff 1 1 10.0 1.0 2.5 +pair_style lj/cut 2.5 +pair_coeff 1 1 10.0 1.0 2.5 bond_style harmonic bond_coeff 1 10.0 1.2 @@ -34,10 +34,10 @@ bond_coeff 1 10.0 1.2 special_bonds lj/coul 0 1 1 create_bonds many all all 1 1.0 1.5 -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 nve fix 2 all wall/lj93 xlo 0.0 1 1 2.5 xhi $x 1 1 2.5 fix 3 all wall/lj93 ylo 0.0 1 1 2.5 yhi $y 1 1 2.5 @@ -58,6 +58,6 @@ fix 10 all balance 50 0.9 rcb #dump_modify 3 pad 5 amap 0 10 sa 1 10 ${colors} thermo_style custom step temp epair press f_10[3] f_10 -thermo 100 +thermo 100 -run 10000 +run 10000 diff --git a/examples/balance/in.balance.bond.slow b/examples/balance/in.balance.bond.slow index 68b1110c3d..1fd4ae4c85 100644 --- a/examples/balance/in.balance.bond.slow +++ b/examples/balance/in.balance.bond.slow @@ -2,42 +2,42 @@ variable b index 0 -variable x index 50 -variable y index 20 -variable d index 20 +variable x index 50 +variable y index 20 +variable d index 20 # careful not to slam into wall too hard -variable v index 0.3 -variable w index 0.08 - -units lj +variable v index 0.3 +variable w index 0.08 + +units lj dimension 2 -atom_style bond +atom_style bond boundary f f p -lattice hex 0.85 -region box block 0 $x 0 $y -0.5 0.5 -create_box 1 box bond/types 1 extra/bond/per/atom 6 -region circle sphere $(v_d/2+1) $(v_d/2/sqrt(3.0)+1) 0.0 $(v_d/2) -create_atoms 1 region circle -mass 1 1.0 +lattice hex 0.85 +region box block 0 $x 0 $y -0.5 0.5 +create_box 1 box bond/types 1 extra/bond/per/atom 6 +region circle sphere $(v_d/2+1) $(v_d/2/sqrt(3.0)+1) 0.0 $(v_d/2) +create_atoms 1 region circle +mass 1 1.0 -velocity all create 0.5 87287 loop geom +velocity all create 0.5 87287 loop geom velocity all set $v $w 0 sum yes -pair_style lj/cut 2.5 -pair_coeff 1 1 10.0 1.0 2.5 +pair_style lj/cut 2.5 +pair_coeff 1 1 10.0 1.0 2.5 bond_style harmonic bond_coeff 1 10.0 1.2 create_bonds many all all 1 1.0 1.5 -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 nve fix 2 all wall/lj93 xlo 0.0 1 1 2.5 xhi $x 1 1 2.5 fix 3 all wall/lj93 ylo 0.0 1 1 2.5 yhi $y 1 1 2.5 @@ -57,6 +57,6 @@ fix 10 all balance 50 0.9 rcb #dump_modify 3 pad 5 amap 0 10 sa 1 10 ${colors} thermo_style custom step temp epair press f_10[3] f_10 -thermo 100 +thermo 100 -run 40000 +run 40000 diff --git a/examples/balance/in.balance.clock.dynamic b/examples/balance/in.balance.clock.dynamic index a0bebd518d..aafaf34326 100644 --- a/examples/balance/in.balance.clock.dynamic +++ b/examples/balance/in.balance.clock.dynamic @@ -1,54 +1,54 @@ # 3d Lennard-Jones melt -units lj -atom_style atomic +units lj +atom_style atomic processors * 1 1 -lattice fcc 0.8442 -region box block 0 10 0 10 0 10 -create_box 3 box -create_atoms 1 box -mass * 1.0 +lattice fcc 0.8442 +region box block 0 10 0 10 0 10 +create_box 3 box +create_atoms 1 box +mass * 1.0 -region long block 3 6 0 10 0 10 +region long block 3 6 0 10 0 10 set region long type 2 -velocity all create 1.0 87287 +velocity all create 1.0 87287 -pair_style lj/cut 2.5 -pair_coeff * * 1.0 1.0 2.5 +pair_style lj/cut 2.5 +pair_coeff * * 1.0 1.0 2.5 pair_coeff * 2 1.0 1.0 5.0 -neighbor 0.3 bin -neigh_modify every 2 delay 4 check yes -fix p all property/atom d_WEIGHT -compute p all property/atom d_WEIGHT -fix 0 all balance 50 1.0 shift x 10 1.0 & +neighbor 0.3 bin +neigh_modify every 2 delay 4 check yes +fix p all property/atom d_WEIGHT +compute p all property/atom d_WEIGHT +fix 0 all balance 50 1.0 shift x 10 1.0 & weight time 1.0 weight store WEIGHT -variable maximb equal f_0[1] -variable iter equal f_0[2] -variable prev equal f_0[3] -variable final equal f_0 +variable maximb equal f_0[1] +variable iter equal f_0[2] +variable prev equal f_0[3] +variable final equal f_0 -#fix 3 all print 50 "${iter} ${prev} ${final} ${maximb}" +#fix 3 all print 50 "${iter} ${prev} ${final} ${maximb}" -fix 1 all nve +fix 1 all nve -#dump id all atom 50 dump.melt -#dump id all custom 50 dump.lammpstrj id type x y z c_p +#dump id all atom 50 dump.melt +#dump id all custom 50 dump.lammpstrj id type x y z c_p -#dump 2 all image 25 image.*.jpg type type & -# axes yes 0.8 0.02 view 60 -30 -#dump_modify 2 pad 3 +#dump 2 all image 25 image.*.jpg type type & +# axes yes 0.8 0.02 view 60 -30 +#dump_modify 2 pad 3 -#dump 3 all movie 25 movie.mpg type type & -# axes yes 0.8 0.02 view 60 -30 -#dump_modify 3 pad 3 +#dump 3 all movie 25 movie.mpg type type & +# axes yes 0.8 0.02 view 60 -30 +#dump_modify 3 pad 3 -thermo 50 -run 500 -run 500 -fix 0 all balance 50 1.0 shift x 5 1.0 & +thermo 50 +run 500 +run 500 +fix 0 all balance 50 1.0 shift x 5 1.0 & weight neigh 0.5 weight time 0.66 weight store WEIGHT run 500 run 500 diff --git a/examples/balance/in.balance.clock.static b/examples/balance/in.balance.clock.static index 6301e56fd0..519e567403 100644 --- a/examples/balance/in.balance.clock.static +++ b/examples/balance/in.balance.clock.static @@ -1,48 +1,48 @@ # 3d Lennard-Jones melt -units lj -atom_style atomic +units lj +atom_style atomic processors * 1 1 -variable factor index 1.0 +variable factor index 1.0 -lattice fcc 0.8442 -region box block 0 10 0 10 0 10 -create_box 3 box -create_atoms 1 box -mass * 1.0 +lattice fcc 0.8442 +region box block 0 10 0 10 0 10 +create_box 3 box +create_atoms 1 box +mass * 1.0 -region long block 3 6 0 10 0 10 +region long block 3 6 0 10 0 10 set region long type 2 -velocity all create 1.0 87287 +velocity all create 1.0 87287 -pair_style lj/cut 2.5 -pair_coeff * * 1.0 1.0 2.5 +pair_style lj/cut 2.5 +pair_coeff * * 1.0 1.0 2.5 pair_coeff * 2 1.0 1.0 5.0 -neighbor 0.3 bin -neigh_modify every 2 delay 4 check yes +neighbor 0.3 bin +neigh_modify every 2 delay 4 check yes -group fast type 1 -group slow type 2 -balance 1.0 shift x 5 1.1 weight time 1.0 # out unweighted.txt +group fast type 1 +group slow type 2 +balance 1.0 shift x 5 1.1 weight time 1.0 # out unweighted.txt -fix 1 all nve +fix 1 all nve -#dump id all atom 50 dump.melt +#dump id all atom 50 dump.melt -#dump 2 all image 25 image.*.jpg type type & -# axes yes 0.8 0.02 view 60 -30 -#dump_modify 2 pad 3 +#dump 2 all image 25 image.*.jpg type type & +# axes yes 0.8 0.02 view 60 -30 +#dump_modify 2 pad 3 -#dump 3 all movie 25 movie.mpg type type & -# axes yes 0.8 0.02 view 60 -30 -#dump_modify 3 pad 3 +#dump 3 all movie 25 movie.mpg type type & +# axes yes 0.8 0.02 view 60 -30 +#dump_modify 3 pad 3 -thermo 50 -run 250 -balance 1.0 shift x 5 1.1 weight time 1.0 # out unweighted.txt -run 250 -balance 1.0 shift x 5 1.1 weight time 1.0 # out unweighted.txt -run 250 +thermo 50 +run 250 +balance 1.0 shift x 5 1.1 weight time 1.0 # out unweighted.txt +run 250 +balance 1.0 shift x 5 1.1 weight time 1.0 # out unweighted.txt +run 250 diff --git a/examples/balance/in.balance.group.dynamic b/examples/balance/in.balance.group.dynamic index 3e2b44f897..04dc349197 100644 --- a/examples/balance/in.balance.group.dynamic +++ b/examples/balance/in.balance.group.dynamic @@ -1,47 +1,47 @@ # 3d Lennard-Jones melt -units lj -atom_style atomic +units lj +atom_style atomic processors * 1 1 -variable factor index 1.0 +variable factor index 1.0 -lattice fcc 0.8442 -region box block 0 10 0 10 0 10 -create_box 3 box -create_atoms 1 box -mass * 1.0 +lattice fcc 0.8442 +region box block 0 10 0 10 0 10 +create_box 3 box +create_atoms 1 box +mass * 1.0 -region long block 3 6 0 10 0 10 +region long block 3 6 0 10 0 10 set region long type 2 -velocity all create 1.0 87287 +velocity all create 1.0 87287 -pair_style lj/cut 2.5 -pair_coeff * * 1.0 1.0 2.5 +pair_style lj/cut 2.5 +pair_coeff * * 1.0 1.0 2.5 pair_coeff * 2 1.0 1.0 5.0 -neighbor 0.3 bin -neigh_modify every 2 delay 4 check yes +neighbor 0.3 bin +neigh_modify every 2 delay 4 check yes -group fast type 1 -group slow type 2 -balance 1.0 shift x 5 1.1 & +group fast type 1 +group slow type 2 +balance 1.0 shift x 5 1.1 & weight group 2 fast 1.0 slow ${factor} # out weighted.txt -fix 0 all balance 10 1.0 shift x 5 1.1 & +fix 0 all balance 10 1.0 shift x 5 1.1 & weight group 2 fast 1.0 slow ${factor} -fix 1 all nve +fix 1 all nve -#dump id all atom 50 dump.melt +#dump id all atom 50 dump.melt -#dump 2 all image 25 image.*.jpg type type & -# axes yes 0.8 0.02 view 60 -30 -#dump_modify 2 pad 3 +#dump 2 all image 25 image.*.jpg type type & +# axes yes 0.8 0.02 view 60 -30 +#dump_modify 2 pad 3 -#dump 3 all movie 25 movie.mpg type type & -# axes yes 0.8 0.02 view 60 -30 -#dump_modify 3 pad 3 +#dump 3 all movie 25 movie.mpg type type & +# axes yes 0.8 0.02 view 60 -30 +#dump_modify 3 pad 3 -thermo 50 -run 250 +thermo 50 +run 250 diff --git a/examples/balance/in.balance.group.static b/examples/balance/in.balance.group.static index 92ff3e8cb4..ad45c5381d 100644 --- a/examples/balance/in.balance.group.static +++ b/examples/balance/in.balance.group.static @@ -1,54 +1,54 @@ # 3d Lennard-Jones melt -units lj -atom_style atomic +units lj +atom_style atomic processors * 1 1 -variable factor index 1.0 +variable factor index 1.0 -lattice fcc 0.8442 -region box block 0 10 0 10 0 10 -create_box 3 box -create_atoms 1 box -mass * 1.0 +lattice fcc 0.8442 +region box block 0 10 0 10 0 10 +create_box 3 box +create_atoms 1 box +mass * 1.0 -region long block 3 6 0 10 0 10 +region long block 3 6 0 10 0 10 set region long type 2 -velocity all create 1.0 87287 +velocity all create 1.0 87287 -pair_style lj/cut 2.5 -pair_coeff * * 1.0 1.0 2.5 +pair_style lj/cut 2.5 +pair_coeff * * 1.0 1.0 2.5 pair_coeff * 2 1.0 1.0 5.0 -neighbor 0.3 bin -neigh_modify every 2 delay 4 check yes +neighbor 0.3 bin +neigh_modify every 2 delay 4 check yes -balance 1.0 shift x 5 1.1 # out unweighted.txt +balance 1.0 shift x 5 1.1 # out unweighted.txt -balance 1.0 x uniform +balance 1.0 x uniform variable weight atom (type==1)*1.0+(type==2)*v_factor -balance 1.0 shift x 5 1.1 weight var weight # out weighted_var.txt +balance 1.0 shift x 5 1.1 weight var weight # out weighted_var.txt -balance 1.0 x uniform +balance 1.0 x uniform -group fast type 1 -group slow type 2 -balance 1.0 shift x 5 1.1 & +group fast type 1 +group slow type 2 +balance 1.0 shift x 5 1.1 & weight group 2 fast 1.0 slow ${factor} # out weighted_group.txt -fix 1 all nve +fix 1 all nve -#dump id all atom 50 dump.melt +#dump id all atom 50 dump.melt -#dump 2 all image 25 image.*.jpg type type & -# axes yes 0.8 0.02 view 60 -30 -#dump_modify 2 pad 3 +#dump 2 all image 25 image.*.jpg type type & +# axes yes 0.8 0.02 view 60 -30 +#dump_modify 2 pad 3 -#dump 3 all movie 25 movie.mpg type type & -# axes yes 0.8 0.02 view 60 -30 -#dump_modify 3 pad 3 +#dump 3 all movie 25 movie.mpg type type & +# axes yes 0.8 0.02 view 60 -30 +#dump_modify 3 pad 3 -thermo 50 -run 250 +thermo 50 +run 250 diff --git a/examples/balance/in.balance.kspace b/examples/balance/in.balance.kspace index 5a2de11c70..c89024d76f 100644 --- a/examples/balance/in.balance.kspace +++ b/examples/balance/in.balance.kspace @@ -1,47 +1,47 @@ # 3d Lennard-Jones melt -units lj -#atom_style charge +units lj +#atom_style charge processors * 1 1 -lattice fcc 0.8442 -region box block 0 10 0 10 0 10 -create_box 3 box -create_atoms 1 box -mass * 1.0 +lattice fcc 0.8442 +region box block 0 10 0 10 0 10 +create_box 3 box +create_atoms 1 box +mass * 1.0 -region long block 3 6 0 10 0 10 +region long block 3 6 0 10 0 10 set region long type 2 #set type 1:2 charge 0.0 -velocity all create 1.0 87287 +velocity all create 1.0 87287 -pair_style lj/long/coul/long long off 2.5 -pair_coeff * * 1.0 1.0 2.5 +pair_style lj/long/coul/long long off 2.5 +pair_coeff * * 1.0 1.0 2.5 pair_coeff * 2 1.0 1.0 5.0 kspace_style pppm/disp 1.0e-4 kspace_modify gewald/disp 0.1 -neighbor 0.3 bin -neigh_modify every 2 delay 4 check yes +neighbor 0.3 bin +neigh_modify every 2 delay 4 check yes -group fast type 1 -group slow type 2 -fix 0 all balance 20 1.0 shift x 5 1.0 & +group fast type 1 +group slow type 2 +fix 0 all balance 20 1.0 shift x 5 1.0 & weight group 2 fast 1.0 slow 2.0 weight time 0.66 -fix 1 all nve +fix 1 all nve -#dump id all atom 50 dump.melt +#dump id all atom 50 dump.melt -#dump 2 all image 25 image.*.jpg type type & -# axes yes 0.8 0.02 view 60 -30 -#dump_modify 2 pad 3 +#dump 2 all image 25 image.*.jpg type type & +# axes yes 0.8 0.02 view 60 -30 +#dump_modify 2 pad 3 -#dump 3 all movie 25 movie.mpg type type & -# axes yes 0.8 0.02 view 60 -30 -#dump_modify 3 pad 3 +#dump 3 all movie 25 movie.mpg type type & +# axes yes 0.8 0.02 view 60 -30 +#dump_modify 3 pad 3 -thermo 50 -run 500 +thermo 50 +run 500 diff --git a/examples/balance/in.balance.neigh.dynamic b/examples/balance/in.balance.neigh.dynamic index 395f9f37eb..9217a1c3a6 100644 --- a/examples/balance/in.balance.neigh.dynamic +++ b/examples/balance/in.balance.neigh.dynamic @@ -1,53 +1,53 @@ # 3d Lennard-Jones melt -units lj -atom_style atomic +units lj +atom_style atomic processors * 1 1 -lattice fcc 0.8442 -region box block 0 10 0 10 0 10 -create_box 3 box -create_atoms 1 box -mass * 1.0 +lattice fcc 0.8442 +region box block 0 10 0 10 0 10 +create_box 3 box +create_atoms 1 box +mass * 1.0 -region long block 3 6 0 10 0 10 +region long block 3 6 0 10 0 10 set region long type 2 -velocity all create 1.0 87287 +velocity all create 1.0 87287 -pair_style lj/cut 2.5 -pair_coeff * * 1.0 1.0 2.5 +pair_style lj/cut 2.5 +pair_coeff * * 1.0 1.0 2.5 pair_coeff * 2 1.0 1.0 5.0 -neighbor 0.3 bin -neigh_modify every 2 delay 4 check yes -fix p all property/atom d_WEIGHT -fix 0 all balance 50 1.0 shift x 5 1.0 & +neighbor 0.3 bin +neigh_modify every 2 delay 4 check yes +fix p all property/atom d_WEIGHT +fix 0 all balance 50 1.0 shift x 5 1.0 & weight neigh 0.8 weight store WEIGHT -compute p all property/atom d_WEIGHT -variable maximb equal f_0[1] -variable iter equal f_0[2] -variable prev equal f_0[3] -variable final equal f_0 +compute p all property/atom d_WEIGHT +variable maximb equal f_0[1] +variable iter equal f_0[2] +variable prev equal f_0[3] +variable final equal f_0 -#fix 3 all print 50 "${iter} ${prev} ${final} ${maximb}" +#fix 3 all print 50 "${iter} ${prev} ${final} ${maximb}" -fix 1 all nve +fix 1 all nve -#dump id all atom 50 dump.melt -#dump id all custom 50 dump.lammpstrj id type x y z c_p +#dump id all atom 50 dump.melt +#dump id all custom 50 dump.lammpstrj id type x y z c_p -#dump 2 all image 25 image.*.jpg type type & -# axes yes 0.8 0.02 view 60 -30 -#dump_modify 2 pad 3 +#dump 2 all image 25 image.*.jpg type type & +# axes yes 0.8 0.02 view 60 -30 +#dump_modify 2 pad 3 -#dump 3 all movie 25 movie.mp4 c_p type & -# axes yes 0.8 0.02 view 60 -30 -#dump_modify 3 pad 3 amap 0.0 2.0 cf 0.1 3 min blue 0.5 green max red +#dump 3 all movie 25 movie.mp4 c_p type & +# axes yes 0.8 0.02 view 60 -30 +#dump_modify 3 pad 3 amap 0.0 2.0 cf 0.1 3 min blue 0.5 green max red -thermo 50 -run 500 -run 500 +thermo 50 +run 500 +run 500 run 500 run 500 diff --git a/examples/balance/in.balance.neigh.rcb b/examples/balance/in.balance.neigh.rcb index 0b2ca59441..040e47fcad 100644 --- a/examples/balance/in.balance.neigh.rcb +++ b/examples/balance/in.balance.neigh.rcb @@ -1,53 +1,53 @@ # 3d Lennard-Jones melt -units lj -atom_style atomic +units lj +atom_style atomic processors * 1 1 -lattice fcc 0.8442 -region box block 0 10 0 10 0 10 -create_box 3 box -create_atoms 1 box -mass * 1.0 +lattice fcc 0.8442 +region box block 0 10 0 10 0 10 +create_box 3 box +create_atoms 1 box +mass * 1.0 -region long block 3 6 0 10 0 10 +region long block 3 6 0 10 0 10 set region long type 2 -velocity all create 1.0 87287 +velocity all create 1.0 87287 -pair_style lj/cut 2.5 -pair_coeff * * 1.0 1.0 2.5 +pair_style lj/cut 2.5 +pair_coeff * * 1.0 1.0 2.5 pair_coeff * 2 1.0 1.0 5.0 -comm_style tiled +comm_style tiled -neighbor 0.3 bin -neigh_modify every 2 delay 4 check yes -fix p all property/atom d_WEIGHT -fix 0 all balance 50 1.0 rcb weight neigh 0.8 weight store WEIGHT -compute p all property/atom d_WEIGHT -variable maximb equal f_0[1] -variable iter equal f_0[2] -variable prev equal f_0[3] -variable final equal f_0 +neighbor 0.3 bin +neigh_modify every 2 delay 4 check yes +fix p all property/atom d_WEIGHT +fix 0 all balance 50 1.0 rcb weight neigh 0.8 weight store WEIGHT +compute p all property/atom d_WEIGHT +variable maximb equal f_0[1] +variable iter equal f_0[2] +variable prev equal f_0[3] +variable final equal f_0 -#fix 3 all print 50 "${iter} ${prev} ${final} ${maximb}" +#fix 3 all print 50 "${iter} ${prev} ${final} ${maximb}" -fix 1 all nve +fix 1 all nve -#dump id all atom 50 dump.melt -#dump id all custom 50 dump.lammpstrj id type x y z c_p +#dump id all atom 50 dump.melt +#dump id all custom 50 dump.lammpstrj id type x y z c_p -#dump 2 all image 25 image.*.jpg type type & -# axes yes 0.8 0.02 view 60 -30 -#dump_modify 2 pad 3 +#dump 2 all image 25 image.*.jpg type type & +# axes yes 0.8 0.02 view 60 -30 +#dump_modify 2 pad 3 -#dump 3 all movie 25 movie.mpg type type & -# axes yes 0.8 0.02 view 60 -30 -#dump_modify 3 pad 3 +#dump 3 all movie 25 movie.mpg type type & +# axes yes 0.8 0.02 view 60 -30 +#dump_modify 3 pad 3 -thermo 50 +thermo 50 -run 250 +run 250 run 250 diff --git a/examples/balance/in.balance.neigh.static b/examples/balance/in.balance.neigh.static index c3c061bcbe..28fd5eaa9b 100644 --- a/examples/balance/in.balance.neigh.static +++ b/examples/balance/in.balance.neigh.static @@ -1,51 +1,51 @@ # 3d Lennard-Jones melt -units lj -atom_style atomic +units lj +atom_style atomic processors * 1 1 -variable factor index 1.0 +variable factor index 1.0 -lattice fcc 0.8442 -region box block 0 10 0 10 0 10 -create_box 3 box -create_atoms 1 box -mass * 1.0 +lattice fcc 0.8442 +region box block 0 10 0 10 0 10 +create_box 3 box +create_atoms 1 box +mass * 1.0 -region long block 3 6 0 10 0 10 +region long block 3 6 0 10 0 10 set region long type 2 -velocity all create 1.0 87287 +velocity all create 1.0 87287 -pair_style lj/cut 2.5 -pair_coeff * * 1.0 1.0 2.5 +pair_style lj/cut 2.5 +pair_coeff * * 1.0 1.0 2.5 pair_coeff * 2 1.0 1.0 5.0 -neighbor 0.3 bin -neigh_modify every 2 delay 4 check yes +neighbor 0.3 bin +neigh_modify every 2 delay 4 check yes -balance 1.0 shift x 10 1.0 weight neigh 0.8 # out weighted_var.txt +balance 1.0 shift x 10 1.0 weight neigh 0.8 # out weighted_var.txt -fix 1 all nve +fix 1 all nve -#dump id all atom 50 dump.melt +#dump id all atom 50 dump.melt -#dump 2 all image 25 image.*.jpg type type & -# axes yes 0.8 0.02 view 60 -30 -#dump_modify 2 pad 3 +#dump 2 all image 25 image.*.jpg type type & +# axes yes 0.8 0.02 view 60 -30 +#dump_modify 2 pad 3 -#dump 3 all movie 25 movie.mpg type type & -# axes yes 0.8 0.02 view 60 -30 -#dump_modify 3 pad 3 +#dump 3 all movie 25 movie.mpg type type & +# axes yes 0.8 0.02 view 60 -30 +#dump_modify 3 pad 3 -thermo 50 -run 250 post no -balance 1.0 shift x 10 1.0 weight neigh 0.8 +thermo 50 run 250 post no -balance 1.0 shift x 10 1.0 weight neigh 0.8 +balance 1.0 shift x 10 1.0 weight neigh 0.8 run 250 post no -balance 1.0 shift x 10 1.0 weight neigh 0.8 weight time 0.6 +balance 1.0 shift x 10 1.0 weight neigh 0.8 +run 250 post no +balance 1.0 shift x 10 1.0 weight neigh 0.8 weight time 0.6 run 250 -balance 1.0 shift x 10 1.0 weight neigh 0.8 weight time 0.6 +balance 1.0 shift x 10 1.0 weight neigh 0.8 weight time 0.6 run 250 diff --git a/examples/balance/in.balance.var.dynamic b/examples/balance/in.balance.var.dynamic index 0c49106cdf..846c0c1fdb 100644 --- a/examples/balance/in.balance.var.dynamic +++ b/examples/balance/in.balance.var.dynamic @@ -1,65 +1,65 @@ # 3d Lennard-Jones melt -units lj -atom_style atomic +units lj +atom_style atomic processors * 1 1 -lattice fcc 0.8442 -region box block 0 10 0 10 0 10 -create_box 3 box -create_atoms 1 box -mass * 1.0 +lattice fcc 0.8442 +region box block 0 10 0 10 0 10 +create_box 3 box +create_atoms 1 box +mass * 1.0 -region long block 3 6 0 10 0 10 +region long block 3 6 0 10 0 10 set region long type 2 -velocity all create 1.0 87287 +velocity all create 1.0 87287 -pair_style lj/cut 2.5 -pair_coeff * * 1.0 1.0 2.5 +pair_style lj/cut 2.5 +pair_coeff * * 1.0 1.0 2.5 pair_coeff * 2 1.0 1.0 5.0 -neighbor 0.3 bin -neigh_modify every 2 delay 4 check yes -fix p all property/atom d_WEIGHT -compute p all property/atom d_WEIGHT +neighbor 0.3 bin +neigh_modify every 2 delay 4 check yes +fix p all property/atom d_WEIGHT +compute p all property/atom d_WEIGHT -group fast type 1 -group slow type 2 -balance 1.0 shift x 10 1.0 & +group fast type 1 +group slow type 2 +balance 1.0 shift x 10 1.0 & weight group 2 fast 0.8 slow 2.5 weight store WEIGHT -variable lastweight atom c_p +variable lastweight atom c_p -fix 0 all balance 50 1.0 shift x 10 1.0 & +fix 0 all balance 50 1.0 shift x 10 1.0 & weight var lastweight weight time 0.5 weight store WEIGHT -variable maximb equal f_0[1] -variable iter equal f_0[2] -variable prev equal f_0[3] -variable final equal f_0 +variable maximb equal f_0[1] +variable iter equal f_0[2] +variable prev equal f_0[3] +variable final equal f_0 -#fix 3 all print 50 "${iter} ${prev} ${final} ${maximb}" +#fix 3 all print 50 "${iter} ${prev} ${final} ${maximb}" -fix 1 all nve +fix 1 all nve -#dump id all atom 50 dump.melt -#dump id all custom 50 dump.lammpstrj id type x y z c_p +#dump id all atom 50 dump.melt +#dump id all custom 50 dump.lammpstrj id type x y z c_p -#dump 2 all image 25 image.*.jpg type type & -# axes yes 0.8 0.02 view 60 -30 -#dump_modify 2 pad 3 +#dump 2 all image 25 image.*.jpg type type & +# axes yes 0.8 0.02 view 60 -30 +#dump_modify 2 pad 3 -#dump 3 all movie 25 movie.mpg type type & -# axes yes 0.8 0.02 view 60 -30 -#dump_modify 3 pad 3 +#dump 3 all movie 25 movie.mpg type type & +# axes yes 0.8 0.02 view 60 -30 +#dump_modify 3 pad 3 -thermo 50 -run 500 -run 500 +thermo 50 +run 500 +run 500 -balance 1.0 shift x 10 1.0 & +balance 1.0 shift x 10 1.0 & weight group 2 fast 0.8 slow 2.5 weight store WEIGHT -fix 0 all balance 50 1.0 shift x 5 1.0 & +fix 0 all balance 50 1.0 shift x 5 1.0 & weight var lastweight weight neigh 0.5 weight store WEIGHT run 500 From 55918ebabf2d18d43813dd5bfa81fc1a34aefb05 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Fri, 30 Jun 2023 16:17:04 -0400 Subject: [PATCH 329/396] sphinx-tabs 3.4.1 is now available directly --- doc/utils/requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/utils/requirements.txt b/doc/utils/requirements.txt index 3f7bc065d0..9c8522948b 100644 --- a/doc/utils/requirements.txt +++ b/doc/utils/requirements.txt @@ -2,7 +2,7 @@ Sphinx >= 5.3.0, <7.1.0 sphinxcontrib-spelling sphinxcontrib-jquery git+https://github.com/akohlmey/sphinx-fortran@parallel-read -git+https://github.com/executablebooks/sphinx-tabs@v3.4.1 +sphinx-tabs>=3.4.1 breathe Pygments six From c1213c5222607860dda764b5915afd4d36092f35 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Fri, 30 Jun 2023 16:17:47 -0400 Subject: [PATCH 330/396] use dynamic/dof and extra/dof consistently. remove compatibility note in docs. --- doc/src/compute_modify.rst | 37 +++--- doc/src/compute_rdf.rst | 2 +- doc/src/compute_temp_asphere.rst | 49 ++++---- doc/src/compute_temp_body.rst | 16 +-- doc/src/compute_temp_drude.rst | 3 +- doc/src/compute_temp_sphere.rst | 35 +++--- doc/src/fix_charge_regulation.rst | 2 +- doc/src/fix_deposit.rst | 25 ++-- doc/src/fix_evaporate.rst | 10 +- doc/src/fix_gcmc.rst | 114 +++++++++--------- doc/src/fix_modify.rst | 33 ++--- doc/src/fix_pour.rst | 22 ++-- .../PACKAGES/atc/cauchy_born/in.flying_cube | 16 +-- .../PACKAGES/atc/cauchy_born/in.ftcb_constV | 24 ++-- examples/PACKAGES/atc/fluids/in.bar1d_fluids | 84 ++++++------- examples/PACKAGES/atc/fluids/in.concentration | 76 ++++++------ examples/PACKAGES/atc/fluids/in.shear_flow | 64 +++++----- examples/PACKAGES/atc/hardy/in.eshelby_static | 42 +++---- examples/PACKAGES/atc/hardy/in.nvt | 26 ++-- examples/PACKAGES/atc/thermal/in.bar1d | 76 ++++++------ .../PACKAGES/atc/thermal/in.bar1d_all_atoms | 84 ++++++------- .../PACKAGES/atc/thermal/in.bar1d_combined | 74 ++++++------ examples/PACKAGES/atc/thermal/in.bar1d_flux | 70 +++++------ .../PACKAGES/atc/thermal/in.bar1d_frac_step | 58 ++++----- examples/PACKAGES/atc/thermal/in.bar1d_hoover | 80 ++++++------ .../PACKAGES/atc/thermal/in.bar1d_interpolate | 74 ++++++------ examples/PACKAGES/atc/thermal/in.bar1d_lumped | 72 +++++------ .../atc/two_temperature/in.uniform_heating | 42 +++---- .../PACKAGES/charge_regulation/in.chreg-acid | 2 +- .../charge_regulation/in.chreg-acid-real | 14 +-- .../charge_regulation/in.chreg-polymer | 2 +- examples/mc/in.gcmc.lj | 48 ++++---- 32 files changed, 688 insertions(+), 688 deletions(-) diff --git a/doc/src/compute_modify.rst b/doc/src/compute_modify.rst index 2c5f7d0e8e..028eb8b66d 100644 --- a/doc/src/compute_modify.rst +++ b/doc/src/compute_modify.rst @@ -12,16 +12,14 @@ Syntax * compute-ID = ID of the compute to modify * one or more keyword/value pairs may be listed -* keyword = *extra/dof* or *extra* or *dynamic/dof* or *dynamic* +* keyword = *extra/dof* or *dynamic/dof* .. parsed-literal:: *extra/dof* value = N N = # of extra degrees of freedom to subtract - *extra* syntax is identical to *extra/dof*, will be disabled at some point *dynamic/dof* value = *yes* or *no* yes/no = do or do not re-compute the number of degrees of freedom (DOF) contributing to the temperature - *dynamic* syntax is identical to *dynamic/dof*, will be disabled at some point Examples """""""" @@ -37,19 +35,18 @@ Description Modify one or more parameters of a previously defined compute. Not all compute styles support all parameters. -The *extra/dof* or *extra* keyword refers to how many degrees of -freedom are subtracted (typically from :math:`3N`) as a normalizing -factor in a temperature computation. Only computes that compute a -temperature use this option. The default is 2 or 3 for :doc:`2d or 3d -systems ` which is a correction factor for an ensemble of -velocities with zero total linear momentum. For compute temp/partial, -if one or more velocity components are excluded, the value used for -*extra* is scaled accordingly. You can use a negative number for the -*extra* parameter if you need to add degrees-of-freedom. See the -:doc:`compute temp/asphere ` command for an -example. +The *extra/dof* keyword refers to how many degrees of freedom are +subtracted (typically from :math:`3N`) as a normalizing factor in a +temperature computation. Only computes that compute a temperature use +this option. The default is 2 or 3 for :doc:`2d or 3d systems +` which is a correction factor for an ensemble of velocities +with zero total linear momentum. For compute temp/partial, if one or +more velocity components are excluded, the value used for *extra/dof* is +scaled accordingly. You can use a negative number for the *extra/dof* +parameter if you need to add degrees-of-freedom. See the :doc:`compute +temp/asphere ` command for an example. -The *dynamic/dof* or *dynamic* keyword determines whether the number +The *dynamic/dof* keyword determines whether the number of atoms :math:`N` in the compute group and their associated degrees of freedom (DOF) are re-computed each time a temperature is computed. Only compute styles that calculate a temperature use this option. By @@ -61,12 +58,6 @@ are adding atoms or molecules to the system (see the :doc:`fix pour `), then this option should be used to ensure the temperature is correctly normalized. -.. note:: - - The *extra* and *dynamic* keywords should not be used as they - are deprecated (March 2017) and will eventually be disabled. Instead, - use the equivalent *extra/dof* and *dynamic/dof* keywords. - Restrictions """""""""""" none @@ -79,5 +70,5 @@ Related commands Default """"""" -The option defaults are extra/dof = 2 or 3 for 2d or 3d systems and -dynamic/dof = *no*. +The option defaults are extra/dof = 2 or 3 for 2d or 3d systems, +respectively, and dynamic/dof = *no*. diff --git a/doc/src/compute_rdf.rst b/doc/src/compute_rdf.rst index 88bd7ec74c..ed73800f82 100644 --- a/doc/src/compute_rdf.rst +++ b/doc/src/compute_rdf.rst @@ -202,7 +202,7 @@ change from zero to one at the location of the spike in :math:`g(r)`. parallel efficiency and scaling. For systems, where only the type of atoms changes (e.g., when using :doc:`fix atom/swap `), you need to explicitly request the dynamic normalization updates - via :doc:`compute_modify dynamic yes ` + via :doc:`compute_modify dynamic/dof yes ` Related commands """""""""""""""" diff --git a/doc/src/compute_temp_asphere.rst b/doc/src/compute_temp_asphere.rst index cba52a68b4..5741db76aa 100644 --- a/doc/src/compute_temp_asphere.rst +++ b/doc/src/compute_temp_asphere.rst @@ -49,25 +49,26 @@ rotational). .. note:: - This choice for degrees of freedom (DOF) assumes that all - finite-size aspherical or spherical particles in your model will - freely rotate, sampling all their rotational DOF. It is possible to - use a combination of interaction potentials and fixes that induce no - torque or otherwise constrain some of all of your particles so that - this is not the case. Then there are fewer DOF and you should use the - :doc:`compute_modify extra ` command to adjust the DOF - accordingly. + This choice for degrees of freedom (DOF) assumes that all finite-size + aspherical or spherical particles in your model will freely rotate, + sampling all their rotational DOF. It is possible to use a + combination of interaction potentials and fixes that induce no torque + or otherwise constrain some of all of your particles so that this is + not the case. Then there are fewer DOF and you should use the + :doc:`compute_modify extra/dof ` command to adjust + the DOF accordingly. For example, an aspherical particle with all three of its shape -parameters the same is a sphere. If it does not rotate, then it -should have 3 DOF instead of 6 in 3d (or two instead of three in 2d). -A uniaxial aspherical particle has two of its three shape parameters the +parameters the same is a sphere. If it does not rotate, then it should +have 3 DOF instead of 6 in 3d (or two instead of three in 2d). A +uniaxial aspherical particle has two of its three shape parameters the same. If it does not rotate around the axis perpendicular to its circular cross section, then it should have 5 DOF instead of 6 in 3d. -The latter is the case for uniaxial ellipsoids in a :doc:`GayBerne model ` since there is no induced torque around the -optical axis. It will also be the case for biaxial ellipsoids when -exactly two of the semiaxes have the same length and the corresponding -relative well depths are equal. +The latter is the case for uniaxial ellipsoids in a :doc:`GayBerne model +` since there is no induced torque around the optical +axis. It will also be the case for biaxial ellipsoids when exactly two +of the semiaxes have the same length and the corresponding relative well +depths are equal. The translational kinetic energy is computed the same as is described by the :doc:`compute temp ` command. The rotational @@ -90,15 +91,17 @@ inertia tensor are used. The six components of the vector are ordered :math:`xx`, :math:`yy`, :math:`zz`, :math:`xy`, :math:`xz`, :math:`yz`. The number of atoms contributing to the temperature is assumed to be -constant for the duration of the run; use the *dynamic* option of the -:doc:`compute_modify ` command if this is not the case. +constant for the duration of the run; use the *dynamic/dof* option of +the :doc:`compute_modify ` command if this is not the +case. -This compute subtracts out translational degrees-of-freedom due to -fixes that constrain molecular motion, such as :doc:`fix shake ` and :doc:`fix rigid `. This means the -temperature of groups of atoms that include these constraints will be -computed correctly. If needed, the subtracted degrees-of-freedom can -be altered using the *extra* option of the -:doc:`compute_modify ` command. +This compute subtracts out translational degrees-of-freedom due to fixes +that constrain molecular motion, such as :doc:`fix shake ` +and :doc:`fix rigid `. This means the temperature of groups +of atoms that include these constraints will be computed correctly. If +needed, the subtracted degrees-of-freedom can be altered using the +*extra/dof* option of the :doc:`compute_modify ` +command. See the :doc:`Howto thermostat ` page for a discussion of different ways to compute temperature and perform diff --git a/doc/src/compute_temp_body.rst b/doc/src/compute_temp_body.rst index 64f5ce9a0f..f29ca5c39b 100644 --- a/doc/src/compute_temp_body.rst +++ b/doc/src/compute_temp_body.rst @@ -51,11 +51,10 @@ rotational). This choice for degrees of freedom (DOF) assumes that all body particles in your model will freely rotate, sampling all their rotational DOF. It is possible to use a combination of interaction - potentials and fixes that induce no torque or otherwise constrain some - of all of your particles so that this is not the case. Then there are - less DOF and you should use the - :doc:`compute_modify extra ` command to adjust the DOF - accordingly. + potentials and fixes that induce no torque or otherwise constrain + some of all of your particles so that this is not the case. Then + there are less DOF and you should use the :doc:`compute_modify + extra/dof ` command to adjust the DOF accordingly. The translational kinetic energy is computed the same as is described by the :doc:`compute temp ` command. The rotational @@ -72,15 +71,16 @@ used. The six components of the vector are ordered :math:`xx`, :math:`yy`, :math:`zz`, :math:`xy`, :math:`xz`, :math:`yz`. The number of atoms contributing to the temperature is assumed to be -constant for the duration of the run; use the *dynamic* option of the -:doc:`compute_modify ` command if this is not the case. +constant for the duration of the run; use the *dynamic/dof* option of +the :doc:`compute_modify ` command if this is not the +case. This compute subtracts out translational degrees-of-freedom due to fixes that constrain molecular motion, such as :doc:`fix shake ` and :doc:`fix rigid `. This means the temperature of groups of atoms that include these constraints will be computed correctly. If needed, the subtracted degrees-of-freedom can -be altered using the *extra* option of the +be altered using the *extra/dof* option of the :doc:`compute_modify ` command. See the :doc:`Howto thermostat ` page for a diff --git a/doc/src/compute_temp_drude.rst b/doc/src/compute_temp_drude.rst index 8602bc3589..be09afc6a4 100644 --- a/doc/src/compute_temp_drude.rst +++ b/doc/src/compute_temp_drude.rst @@ -75,7 +75,8 @@ Restrictions The number of degrees of freedom contributing to the temperature is assumed to be constant for the duration of the run unless the -*fix_modify* command sets the option *dynamic yes*\ . +:doc:`fix_modify command ` sets the option *dynamic/dof +yes*\ . Related commands """""""""""""""" diff --git a/doc/src/compute_temp_sphere.rst b/doc/src/compute_temp_sphere.rst index 5c7c73a8d2..d1891f64bf 100644 --- a/doc/src/compute_temp_sphere.rst +++ b/doc/src/compute_temp_sphere.rst @@ -49,14 +49,13 @@ each has three degrees of freedom (two translational, one rotational). .. note:: - This choice for degrees of freedom (DOF) assumes that all - finite-size spherical particles in your model will freely rotate, - sampling all their rotational DOF. It is possible to use a - combination of interaction potentials and fixes that induce no torque - or otherwise constrain some of all of your particles so that this is - not the case. Then there are less DOF and you should use the - :doc:`compute_modify extra ` command to adjust the DOF - accordingly. + This choice for degrees of freedom (DOF) assumes that all finite-size + spherical particles in your model will freely rotate, sampling all + their rotational DOF. It is possible to use a combination of + interaction potentials and fixes that induce no torque or otherwise + constrain some of all of your particles so that this is not the case. + Then there are less DOF and you should use the :doc:`compute_modify + extra/dof ` command to adjust the DOF accordingly. The translational kinetic energy is computed the same as is described by the :doc:`compute temp ` command. The rotational @@ -73,20 +72,22 @@ velocity. A kinetic energy tensor, stored as a six-element vector, is also calculated by this compute. The formula for the components of the tensor is the same as the above formulas, except that :math:`v^2` and -:math:`\omega^2` are replaced by :math:`v_x v_y` and :math:`\omega_x \omega_y` -for the :math:`xy` component. The six components of the vector are ordered -:math:`xx`, :math:`yy`, :math:`zz`, :math:`xy`, :math:`xz`, :math:`yz`. +:math:`\omega^2` are replaced by :math:`v_x v_y` and :math:`\omega_x +\omega_y` for the :math:`xy` component. The six components of the +vector are ordered :math:`xx`, :math:`yy`, :math:`zz`, :math:`xy`, +:math:`xz`, :math:`yz`. The number of atoms contributing to the temperature is assumed to be constant for the duration of the run; use the *dynamic* option of the :doc:`compute_modify ` command if this is not the case. -This compute subtracts out translational degrees-of-freedom due to -fixes that constrain molecular motion, such as :doc:`fix shake ` and :doc:`fix rigid `. This means the -temperature of groups of atoms that include these constraints will be -computed correctly. If needed, the subtracted degrees of freedom can -be altered using the *extra* option of the -:doc:`compute_modify ` command. +This compute subtracts out translational degrees-of-freedom due to fixes +that constrain molecular motion, such as :doc:`fix shake ` +and :doc:`fix rigid `. This means the temperature of groups +of atoms that include these constraints will be computed correctly. If +needed, the subtracted degrees of freedom can be altered using the +*extra/dof* option of the :doc:`compute_modify ` +command. See the :doc:`Howto thermostat ` page for a discussion of different ways to compute temperature and perform diff --git a/doc/src/fix_charge_regulation.rst b/doc/src/fix_charge_regulation.rst index c1e790c691..203d40951d 100644 --- a/doc/src/fix_charge_regulation.rst +++ b/doc/src/fix_charge_regulation.rst @@ -171,7 +171,7 @@ Langevin thermostat: .. code-block:: LAMMPS compute dtemp all temp - compute_modify dtemp dynamic yes + compute_modify dtemp dynamic/dof yes fix fT all langevin 1.0 1.0 1.0 123 fix_modify fT temp dtemp diff --git a/doc/src/fix_deposit.rst b/doc/src/fix_deposit.rst index 7d19e93148..c8746bcf9c 100644 --- a/doc/src/fix_deposit.rst +++ b/doc/src/fix_deposit.rst @@ -95,10 +95,9 @@ default group "all" and the group specified in the fix deposit command (which can also be "all"). If you are computing temperature values which include inserted -particles, you will want to use the -:doc:`compute_modify ` dynamic option, which ensures the -current number of atoms is used as a normalizing factor each time the -temperature is computed. +particles, you will want to use the :doc:`compute_modify dynamic/dof yes +` option, which ensures the current number of atoms is +used as a normalizing factor each time the temperature is computed. Care must be taken that inserted particles are not too near existing atoms, using the options described below. When inserting particles @@ -160,15 +159,17 @@ command which also appears in your input script. .. note:: - If you wish the new rigid molecules (and other rigid molecules) - to be thermostatted correctly via :doc:`fix rigid/small/nvt ` - or :doc:`fix rigid/small/npt `, then you need to use the - "fix_modify dynamic/dof yes" command for the rigid fix. This is to - inform that fix that the molecule count will vary dynamically. + If you wish the new rigid molecules (and other rigid molecules) to be + thermostatted correctly via :doc:`fix rigid/small/nvt ` or + :doc:`fix rigid/small/npt `, then you need to use the + :doc:`fix_modify dynamic/dof yes ` command for the rigid + fix. This is to inform that fix that the molecule count will vary + dynamically. If you wish to insert molecules via the *mol* keyword, that will have their bonds or angles constrained via SHAKE, use the *shake* keyword, -specifying as its value the ID of a separate :doc:`fix shake ` command which also appears in your input script. +specifying as its value the ID of a separate :doc:`fix shake +` command which also appears in your input script. Each timestep a particle is inserted, the coordinates for its atoms are chosen as follows. For insertion of individual atoms, the @@ -268,8 +269,8 @@ units of distance or velocity. If you are monitoring the temperature of a system where the atom count is changing due to adding particles, you typically should use - the :doc:`compute_modify dynamic yes ` command for the - temperature compute you are using. + the :doc:`compute_modify dynamic/dof yes ` command + for the temperature compute you are using. Restart, fix_modify, output, run start/stop, minimize info """"""""""""""""""""""""""""""""""""""""""""""""""""""""""" diff --git a/doc/src/fix_evaporate.rst b/doc/src/fix_evaporate.rst index 4c5ea01e13..c8e46631a3 100644 --- a/doc/src/fix_evaporate.rst +++ b/doc/src/fix_evaporate.rst @@ -69,14 +69,15 @@ incur overhead due to the cost of building neighbor lists. If you are monitoring the temperature of a system where the atom count is changing due to evaporation, you typically should use the - :doc:`compute_modify dynamic yes ` command for the + :doc:`compute_modify dynamic/dof yes ` command for the temperature compute you are using. Restart, fix_modify, output, run start/stop, minimize info """"""""""""""""""""""""""""""""""""""""""""""""""""""""""" -No information about this fix is written to :doc:`binary restart files `. None of the :doc:`fix_modify ` options -are relevant to this fix. +No information about this fix is written to :doc:`binary restart files +`. None of the :doc:`fix_modify ` options are +relevant to this fix. This fix computes a global scalar, which can be accessed by various :doc:`output commands `. The scalar is the cumulative @@ -84,7 +85,8 @@ number of deleted atoms. The scalar value calculated by this fix is "intensive". No parameter of this fix can be used with the *start/stop* keywords of -the :doc:`run ` command. This fix is not invoked during :doc:`energy minimization `. +the :doc:`run ` command. This fix is not invoked during +:doc:`energy minimization `. Restrictions """""""""""" diff --git a/doc/src/fix_gcmc.rst b/doc/src/fix_gcmc.rst index c348e2a44f..c0fa990d6e 100644 --- a/doc/src/fix_gcmc.rst +++ b/doc/src/fix_gcmc.rst @@ -146,8 +146,8 @@ center-of-mass is inside the specified region. If used with :doc:`fix nvt `, the temperature of the imaginary reservoir, T, should be set to be equivalent to the target temperature used in fix nvt. Otherwise, the imaginary reservoir will not be in -thermal equilibrium with the simulation cell. Also, it is important -that the temperature used by fix nvt be dynamic/dof, which can be +thermal equilibrium with the simulation cell. Also, it is important that +the temperature used by *fix nvt* is dynamically updated, which can be achieved as follows: .. code-block:: LAMMPS @@ -197,15 +197,17 @@ which also appears in your input script. .. note:: - If you wish the new rigid molecules (and other rigid molecules) - to be thermostatted correctly via :doc:`fix rigid/small/nvt ` - or :doc:`fix rigid/small/npt `, then you need to use the - "fix_modify dynamic/dof yes" command for the rigid fix. This is to - inform that fix that the molecule count will vary dynamically. + If you wish the new rigid molecules (and other rigid molecules) to be + thermostatted correctly via :doc:`fix rigid/small/nvt ` or + :doc:`fix rigid/small/npt `, then you need to use the + :doc:`fix_modify dynamic/dof yes ` command for the rigid + fix. This is to inform that fix that the molecule count will vary + dynamically. If you wish to insert molecules via the *mol* keyword, that will have their bonds or angles constrained via SHAKE, use the *shake* keyword, -specifying as its value the ID of a separate :doc:`fix shake ` command which also appears in your input script. +specifying as its value the ID of a separate :doc:`fix shake +` command which also appears in your input script. Optionally, users may specify the relative amounts of different MC moves using the *mcmoves* keyword. The values *Patomtrans*, @@ -335,31 +337,30 @@ temperature. Some fixes have an associated potential energy. Examples of such fixes include: :doc:`efield `, :doc:`gravity `, :doc:`addforce `, :doc:`langevin `, -:doc:`restrain `, -:doc:`temp/berendsen `, -:doc:`temp/rescale `, and :doc:`wall fixes `. -For that energy to be included in the total potential energy of the -system (the quantity used when performing GCMC exchange and MC moves), -you MUST enable -the :doc:`fix_modify ` *energy* option for that fix. The -doc pages for individual :doc:`fix ` commands specify if this -should be done. +:doc:`restrain `, :doc:`temp/berendsen +`, :doc:`temp/rescale `, and +:doc:`wall fixes `. For that energy to be included in the +total potential energy of the system (the quantity used when performing +GCMC exchange and MC moves), you MUST enable the :doc:`fix_modify +` *energy* option for that fix. The doc pages for +individual :doc:`fix ` commands specify if this should be done. Use the *charge* option to insert atoms with a user-specified point -charge. Note that doing so will cause the system to become -non-neutral. LAMMPS issues a warning when using long-range -electrostatics (kspace) with non-neutral systems. See the :doc:`compute group/group ` documentation for more details -about simulating non-neutral systems with kspace on. +charge. Note that doing so will cause the system to become non-neutral. +LAMMPS issues a warning when using long-range electrostatics (kspace) +with non-neutral systems. See the :doc:`compute group/group +` documentation for more details about simulating +non-neutral systems with kspace on. Use of this fix typically will cause the number of atoms to fluctuate, -therefore, you will want to use the -:doc:`compute_modify dynamic/dof ` command to ensure that the -current number of atoms is used as a normalizing factor each time -temperature is computed. A simple example of this is: +therefore, you will want to use the :doc:`compute_modify dynamic/dof +` command to ensure that the current number of atoms is +used as a normalizing factor each time temperature is computed. A simple +example of this is: .. code-block:: LAMMPS - compute_modify thermo_temp dynamic yes + compute_modify thermo_temp dynamic/dof yes A more complicated example is listed earlier on this page in the context of NVT dynamics. @@ -369,31 +370,29 @@ in the context of NVT dynamics. If the density of the cell is initially very small or zero, and increases to a much larger density after a period of equilibration, then certain quantities that are only calculated once at the start - (kspace parameters) may no longer be accurate. The - solution is to start a new simulation after the equilibrium density - has been reached. + (kspace parameters) may no longer be accurate. The solution is to + start a new simulation after the equilibrium density has been + reached. With some pair_styles, such as :doc:`Buckingham `, -:doc:`Born-Mayer-Huggins ` and :doc:`ReaxFF `, two -atoms placed close to each other may have an arbitrary large, negative -potential energy due to the functional form of the potential. While -these unphysical configurations are inaccessible to typical dynamical -trajectories, they can be generated by Monte Carlo moves. The -*overlap_cutoff* keyword suppresses these moves by effectively -assigning an infinite positive energy to all new configurations that -place any pair of atoms closer than the specified overlap cutoff -distance. +:doc:`Born-Mayer-Huggins ` and :doc:`ReaxFF `, +two atoms placed close to each other may have an arbitrary large, +negative potential energy due to the functional form of the potential. +While these unphysical configurations are inaccessible to typical +dynamical trajectories, they can be generated by Monte Carlo moves. The +*overlap_cutoff* keyword suppresses these moves by effectively assigning +an infinite positive energy to all new configurations that place any +pair of atoms closer than the specified overlap cutoff distance. -The *max* and *min* keywords allow for the restriction of the number -of atoms in the simulation. They automatically reject all insertion -or deletion moves that would take the system beyond the set boundaries. +The *max* and *min* keywords allow for the restriction of the number of +atoms in the simulation. They automatically reject all insertion or +deletion moves that would take the system beyond the set boundaries. Should the system already be beyond the boundary, only moves that bring the system closer to the bounds may be accepted. -The *group* keyword adds all inserted atoms to the -:doc:`group ` of the group-ID value. The *grouptype* keyword -adds all inserted atoms of the specified type to the -:doc:`group ` of the group-ID value. +The *group* keyword adds all inserted atoms to the :doc:`group ` +of the group-ID value. The *grouptype* keyword adds all inserted atoms +of the specified type to the :doc:`group ` of the group-ID value. Restart, fix_modify, output, run start/stop, minimize info """"""""""""""""""""""""""""""""""""""""""""""""""""""""""" @@ -446,22 +445,21 @@ called. Reneighboring is required. Only usable for 3D simulations. -Can be run in parallel, but aspects of the GCMC part will not scale -well in parallel. Currently, molecule translations and rotations -are not supported with more than one MPI process. -It is still possible to do parallel molecule exchange without -translation and rotation moves by setting MC moves to zero -and/or by using the *mcmoves* keyword with *Pmoltrans* = *Pmolrotate* = 0 . +This fix can be run in parallel, but aspects of the GCMC part will not +scale well in parallel. Currently, molecule translations and rotations +are not supported with more than one MPI process. It is still possible +to do parallel molecule exchange without translation and rotation moves +by setting MC moves to zero and/or by using the *mcmoves* keyword with +*Pmoltrans* = *Pmolrotate* = 0 . -When using fix gcmc in combination with fix shake or fix rigid, -only GCMC exchange moves are supported, so the argument -*M* must be zero. +When using fix gcmc in combination with fix shake or fix rigid, only +GCMC exchange moves are supported, so the argument *M* must be zero. -When using fix gcmc in combination with fix rigid, deletion -of the last remaining molecule is not allowed for technical reasons, -and so the molecule count will never drop below 1, regardless of the -specified chemical potential. +When using fix gcmc in combination with fix rigid, deletion of the last +remaining molecule is not allowed for technical reasons, and so the +molecule count will never drop below 1, regardless of the specified +chemical potential. Note that very lengthy simulations involving insertions/deletions of billions of gas molecules may run out of atom or molecule IDs and diff --git a/doc/src/fix_modify.rst b/doc/src/fix_modify.rst index 175d02dd8f..265803c213 100644 --- a/doc/src/fix_modify.rst +++ b/doc/src/fix_modify.rst @@ -131,24 +131,24 @@ with their specified level at the beginning of a r-RESPA run. The *dynamic/dof* keyword determines whether the number of atoms N in the fix group and their associated degrees of freedom are re-computed each time a temperature is computed. Only fix styles that calculate -their own internal temperature use this option. Currently this is -only the :doc:`fix rigid/nvt/small ` and :doc:`fix -rigid/npt/small ` commands for the purpose of -thermostatting rigid body translation and rotation. By default, N and -their DOF are assumed to be constant. If you are adding atoms or -molecules to the system (see the :doc:`fix pour `, :doc:`fix -deposit `, and :doc:`fix gcmc ` commands) or -expect atoms or molecules to be lost (e.g. due to exiting the -simulation box or via :doc:`fix evaporate `), then this -option should be used to ensure the temperature is correctly -normalized. +their own internal temperature use this option. Currently this is only +the :doc:`fix rigid/nvt/small ` and :doc:`fix rigid/npt/small +` commands for the purpose of thermostatting rigid body +translation and rotation. By default, N and their DOF are assumed to be +constant. If you are adding atoms or molecules to the system (see the +:doc:`fix pour `, :doc:`fix deposit `, and +:doc:`fix gcmc ` commands) or expect atoms or molecules to be +lost (e.g. due to exiting the simulation box or via :doc:`fix evaporate +`), then this option should be used to ensure the +temperature is correctly normalized. .. note:: - Other thermostatting fixes, such as :doc:`fix nvt `, do - not use the *dynamic/dof* keyword because they use a temperature - compute to calculate temperature. See the :doc:`compute_modify dynamic/dof ` command for a similar way to ensure - correct temperature normalization for those thermostats. + Other thermostatting fixes, such as :doc:`fix nvt `, do not + use the *dynamic/dof* keyword because they use a temperature compute + to calculate temperature. See the :doc:`compute_modify dynamic/dof + ` command for a similar way to ensure correct + temperature normalization for those thermostats. The *bodyforces* keyword determines whether the forces and torques acting on rigid bodies are computed *early* at the post-force stage of @@ -156,7 +156,8 @@ each timestep (right after per-atom forces have been computed and communicated among processors), or *late* at the final-integrate stage of each timestep (after any other fixes have finished their post-force tasks). Only the rigid-body integration fixes use this option, which -includes :doc:`fix rigid ` and :doc:`fix rigid/small `, and their variants, and also :doc:`fix poems `. +includes :doc:`fix rigid ` and :doc:`fix rigid/small +`, and their variants, and also :doc:`fix poems `. The default is *late*\ . If there are other fixes that add forces to individual atoms, then the rigid-body constraints will include these diff --git a/doc/src/fix_pour.rst b/doc/src/fix_pour.rst index 6ef18ea800..8a7000662e 100644 --- a/doc/src/fix_pour.rst +++ b/doc/src/fix_pour.rst @@ -123,15 +123,17 @@ command which also appears in your input script. .. note:: - If you wish the new rigid molecules (and other rigid molecules) - to be thermostatted correctly via :doc:`fix rigid/small/nvt ` - or :doc:`fix rigid/small/npt `, then you need to use the - "fix_modify dynamic/dof yes" command for the rigid fix. This is to - inform that fix that the molecule count will vary dynamically. + If you wish the new rigid molecules (and other rigid molecules) to be + thermostatted correctly via :doc:`fix rigid/small/nvt ` or + :doc:`fix rigid/small/npt `, then you need to use the + :doc:`fix_modify dynamic/dof yes ` command for the rigid + fix. This is to inform that fix that the molecule count will vary + dynamically. If you wish to insert molecules via the *mol* keyword, that will have their bonds or angles constrained via SHAKE, use the *shake* keyword, -specifying as its value the ID of a separate :doc:`fix shake ` command which also appears in your input script. +specifying as its value the ID of a separate :doc:`fix shake +` command which also appears in your input script. Each timestep particles are inserted, they are placed randomly inside the insertion volume so as to mimic a stream of poured particles. If @@ -148,10 +150,10 @@ many timesteps until the desired # of particles has been inserted. .. note:: - If you are monitoring the temperature of a system where the - particle count is changing due to adding particles, you typically - should use the :doc:`compute_modify dynamic yes ` - command for the temperature compute you are using. + If you are monitoring the temperature of a system where the particle + count is changing due to adding particles, you typically should use + the :doc:`compute_modify dynamic/dof yes ` command + for the temperature compute you are using. ---------- diff --git a/examples/PACKAGES/atc/cauchy_born/in.flying_cube b/examples/PACKAGES/atc/cauchy_born/in.flying_cube index 23bd7a5ae0..9b81fcf6a0 100644 --- a/examples/PACKAGES/atc/cauchy_born/in.flying_cube +++ b/examples/PACKAGES/atc/cauchy_born/in.flying_cube @@ -1,11 +1,11 @@ # This test evaluates Hardy fields for a small block of LJ material -# that's undergoing translation in the x-direction through the +# that's undergoing translation in the x-direction through the # periodic boundary. echo both -log log.flying_cube +log log.flying_cube units real atom_style atomic -variable lattice_constant equal 5.256227487 +variable lattice_constant equal 5.256227487 variable c equal 6 variable L equal (${lattice_constant}*$c) variable V equal $L*$L*$L @@ -23,15 +23,15 @@ create_box 1 box create_atoms 1 region box mass 1 $m group all region box -pair_style lj/cut 13.5 -pair_coeff 1 1 0.238 3.405 +pair_style lj/cut 13.5 +pair_coeff 1 1 0.238 3.405 # define region neighbor 1.0 bin neigh_modify delay 0 every 200 check no # neigh_modify delay 0 every $n reset_timestep 0 thermo $s -compute_modify thermo_temp extra 0 +compute_modify thermo_temp extra/dof 0 thermo_style custom step temp pxx pyy pzz etotal lx ly lz timestep ${dt} min_modify line quadratic @@ -46,10 +46,10 @@ variable zHI equal zhi # region BOX block ${xLO} ${xHI} ${yLO} ${yHI} ${zLO} ${zHI} units box region BOX block ${xLO} ${xHI} -0.5 31.7 -0.5 31.7 units box fix ATC all atc field -fix_modify ATC mesh create 1 1 1 box p p p +fix_modify ATC mesh create 1 1 1 box p p p fix_modify ATC fields add stress velocity displacement fix_modify ATC fields add temperature kinetic_temperature -fix_modify ATC fields add internal_energy energy +fix_modify ATC fields add internal_energy energy fix_modify ATC output flying_cubeFE $s text binary tensor_components # fix_modify ATC atomic_output flying_cubeMD $m text binary tensor_components dump dumpfc all atom $s flying_cube.dmp diff --git a/examples/PACKAGES/atc/cauchy_born/in.ftcb_constV b/examples/PACKAGES/atc/cauchy_born/in.ftcb_constV index 431fe15ddd..2b54a50739 100644 --- a/examples/PACKAGES/atc/cauchy_born/in.ftcb_constV +++ b/examples/PACKAGES/atc/cauchy_born/in.ftcb_constV @@ -1,34 +1,34 @@ # This test compares Hardy and Cauchy-Born metrics of energy density and stress # for an Ar system undergoing dynamics at a finite temperature. echo both -log ftcb_constV.log +log ftcb_constV.log units real atom_style atomic -variable lattice_constant equal 5.256227487 +variable lattice_constant equal 5.256227487 variable c equal 6 variable L equal (${lattice_constant}*$c) variable V equal $L*$L*$L print "Volume : $V" -variable Ti equal 0.0001 +variable Ti equal 0.0001 variable dT equal 0.2 variable n equal 10000 variable m equal 200 variable dt equal 0.1 # create system -lattice fcc ${lattice_constant} +lattice fcc ${lattice_constant} region box block 0 $c 0 $c 0 $c boundary p p p -pair_style lj/cut 13.5 +pair_style lj/cut 13.5 read_data ftcb_constV_setup.init mass 1 39.95 -pair_coeff 1 1 0.238 3.405 +pair_coeff 1 1 0.238 3.405 # define region neighbor 1.0 bin neigh_modify delay 0 every 2000 check no reset_timestep 0 thermo $m -compute_modify thermo_temp extra 0 -variable nrepeat equal $n/$m +compute_modify thermo_temp extra/dof 0 +variable nrepeat equal $n/$m variable sxx equal -pxx variable intenergy equal etotal fix TDAVE all ave/time $m ${nrepeat} $n c_thermo_temp v_sxx v_intenergy ave one file ftcb_constV.profile @@ -37,7 +37,7 @@ timestep ${dt} # filtered fix ATCFILT all atc field Ar_CauchyBorn.mat #fix_modify ATCFILT reset_atomic_reference_positions ftcb_constV_setup.data -fix_modify ATCFILT mesh create 1 1 1 box p p p +fix_modify ATCFILT mesh create 1 1 1 box p p p fix_modify ATCFILT fields none fix_modify ATCFILT fields add internal_energy stress cauchy_born_energy cauchy_born_stress fix_modify ATCFILT fields add temperature displacement @@ -51,7 +51,7 @@ fix_modify ATCFILT filter type step # not filtered fix ATC all atc field Ar_CauchyBorn.mat #fix_modify ATC reset_atomic_reference_positions ftcb_constV_setup.data -fix_modify ATC mesh create 1 1 1 box p p p +fix_modify ATC mesh create 1 1 1 box p p p fix_modify ATC fields none fix_modify ATC fields add internal_energy stress cauchy_born_energy cauchy_born_stress fix_modify ATC fields add temperature displacement @@ -59,7 +59,7 @@ fix_modify ATC gradients add displacement fix_modify ATC output ftcb_constVFE $m text binary tensor_components velocity all create ${Ti} 102486 mom yes rot yes dist gaussian # step iu T,V space -variable i loop 1 +variable i loop 1 label loop_i print ">>> step $i, T: ${Ti}, V: $V" variable Tf equal ${Ti}+${dT} @@ -69,6 +69,6 @@ label loop_i fix NVT all nvt temp ${Tf} ${Tf} 20 drag 0.5 tchain 1 run $n unfix NVT - variable Ti equal ${Tf} + variable Ti equal ${Tf} next i jump in.ftcb_constV loop_i diff --git a/examples/PACKAGES/atc/fluids/in.bar1d_fluids b/examples/PACKAGES/atc/fluids/in.bar1d_fluids index 79a6c8a4c2..69a2df6900 100644 --- a/examples/PACKAGES/atc/fluids/in.bar1d_fluids +++ b/examples/PACKAGES/atc/fluids/in.bar1d_fluids @@ -5,50 +5,50 @@ # out # to the FEM on the right. Insufficient time is captured to reach the # linear # steady state, but heat crossing both boundaries should be observed. log bar1d_fluids.log -units real -atom_style atomic +units real +atom_style atomic # create domain -#lattice type reduced density rho* = 4*(sigma/a)^3, where N=4 for fcc, s = 3.405 A (Wagner) and a = 5.25 A (Ashcroft & Mermin, p. 70) +#lattice type reduced density rho* = 4*(sigma/a)^3, where N=4 for fcc, s = 3.405 A (Wagner) and a = 5.25 A (Ashcroft & Mermin, p. 70) # NOTE following 3 lines added for restart boundary f p p pair_style lj/cut 13.5 read_data temp.init -#read_restart post_eq.dat +#read_restart post_eq.dat lattice fcc 5.405 origin 0.25 0.25 0.25 # create atoms, NOTE commented out for restart -#region mdRegion block -7 7 -3 3 -3 3 -#boundary f p p -#create_box 2 mdRegion -#create_atoms 1 region mdRegion -#mass * 39.95 +#region mdRegion block -7 7 -3 3 -3 3 +#boundary f p p +#create_box 2 mdRegion +#create_atoms 1 region mdRegion +#mass * 39.95 # specify interal/ghost atoms -#region mdInternal block -6 6 -3 3 -3 3 -#region mdGhost block -6 6 -3 3 -3 3 side out +#region mdInternal block -6 6 -3 3 -3 3 +#region mdGhost block -6 6 -3 3 -3 3 side out #create_atoms 1 region mdGhost #lattice fcc 6.5 origin 0.25 0.25 0.25 -#create_atoms 2 region mdInternal -group internal type 2 -group ghost type 1 +#create_atoms 2 region mdInternal +group internal type 2 +group ghost type 1 # velocities have Vcm = 0, NOTE next four lines commented out for restart -#velocity internal create 100. 87287 mom yes loop geom -#pair_style lj/cut 13.5 -##pair_coeff 1 1 0.010323166 3.405 13.5 -#pair_coeff * * .238 3.405 13.5 -neighbor 5. bin -neigh_modify every 10 delay 0 check no -#write_restart tinit.dat +#velocity internal create 100. 87287 mom yes loop geom +#pair_style lj/cut 13.5 +##pair_coeff 1 1 0.010323166 3.405 13.5 +#pair_coeff * * .238 3.405 13.5 +neighbor 5. bin +neigh_modify every 10 delay 0 check no +#write_restart tinit.dat # ID group atc PhysicsType ParameterFile lattice fcc 5.405 origin 0.25 0.25 0.25 -region atcRegion block -6.25 6.25 -3 3 -3 3 +region atcRegion block -6.25 6.25 -3 3 -3 3 fix AtC internal atc thermal Ar_thermal.mat # ID part keywords nx ny nz region periodicity fix_modify AtC mesh create 6 1 1 atcRegion f p p fix_modify AtC time_integration fractional_step -fix_modify AtC atom_element_map eulerian 10 # NOTE this introduces a minor amount of time integration error tracking the atomic temperature +fix_modify AtC atom_element_map eulerian 10 # NOTE this introduces a minor amount of time integration error tracking the atomic temperature fix_modify AtC internal_quadrature off -#fix_modify AtC mass_matrix fe +#fix_modify AtC mass_matrix fe # fix a temperature -fix_modify AtC fix temperature all 100. +fix_modify AtC fix temperature all 100. # add nodesets # ID mesh create_nodeset tag xmin xmax ymin ymax zmin zmax fix_modify AtC mesh create_nodeset lbc -6.3 -6.2 -INF INF -INF INF @@ -56,43 +56,43 @@ fix_modify AtC mesh create_nodeset rbc 6.2 6.3 -INF INF -INF INF #fix_modify AtC fix temperature lbc 120. #fix_modify AtC fix temperature rbc 100. #used for restarting -#fix_modify AtC consistent_fe_initialization on +#fix_modify AtC consistent_fe_initialization on #fix_modify AtC initial temperature all 100. # turn on thermostat -fix_modify AtC control thermal rescale 10 +fix_modify AtC control thermal rescale 10 # equilibrate MD field variable xdof equal 3*count(ghost) -compute_modify thermo_temp extra ${xdof} +compute_modify thermo_temp extra/dof ${xdof} thermo_style custom step cpu etotal pe f_AtC[1] temp f_AtC[2] thermo_modify format 1 %6i format 2 %7.2g #fix_modify AtC output bar1d_fluids_eqFE 200 text binary #dump D1 all atom 200 dump_eq.bar1d -timestep 2 -thermo 200 -run 2000 -#write_restart post_eq.dat +timestep 2 +thermo 200 +run 2000 +#write_restart post_eq.dat # change thermostat to hoover reset_timestep 0 -fix_modify AtC reset_time +fix_modify AtC reset_time fix_modify AtC unfix temperature all variable deltaT equal 2.*2000. fix_modify AtC fix temperature lbc temporal_ramp 100. 120. ${deltaT} -#fix_modify AtC fix temperature lbc 100. +#fix_modify AtC fix temperature lbc 100. fix_modify AtC fix temperature rbc 100. fix_modify AtC control thermal flux no_boundary -fix_modify AtC control tolerance 1.e-14 -fix_modify AtC control localized_lambda on +fix_modify AtC control tolerance 1.e-14 +fix_modify AtC control localized_lambda on fix_modify AtC filter type exponential fix_modify AtC filter scale 1000.0 fix_modify AtC filter on # output commands fix_modify AtC output bar1d_fluidsFE 100 text #undump D1 -#dump D2 all atom 200 dump.bar1d -#dump D2 all custom 200 dump.bar1d id type xs ys zs vx vy vz +#dump D2 all atom 200 dump.bar1d +#dump D2 all custom 200 dump.bar1d id type xs ys zs vx vy vz # set-up non-equilibrium IC -thermo 100 -run 2000 +thermo 100 +run 2000 # run non-equilibrium condition -fix_modify AtC fix temperature lbc 120. -run 4000 +fix_modify AtC fix temperature lbc 120. +run 4000 diff --git a/examples/PACKAGES/atc/fluids/in.concentration b/examples/PACKAGES/atc/fluids/in.concentration index 255524bc0a..f5c2a37cbb 100644 --- a/examples/PACKAGES/atc/fluids/in.concentration +++ b/examples/PACKAGES/atc/fluids/in.concentration @@ -1,10 +1,10 @@ echo both -units real +units real atom_style full # charge ### NOTE p p p is required for both lammps & atc since periodic images are employed in ExtrinsicModelElectrostatic::correct_electrostatic_forces ########### BEGIN PARAMETERS #################################### -variable T equal 300 -variable a equal 1.0 # 5.719025032 +variable T equal 300 +variable a equal 1.0 # 5.719025032 variable i equal 10 # thermo variable f equal 50 # neighbor & conc interval variable s equal 100 # 10 # 100 # output @@ -12,18 +12,18 @@ variable n equal 800 # 20 # 200 # 300 # duration variable x equal 4 # 40 # 2 # 4 # exchanges variable e equal 100. # 1. # 100. # 10. # energy variable h equal 5 # nelems -variable dt equal 4. #1. # 0 # 4.0 +variable dt equal 4. #1. # 0 # 4.0 ############## END PARAMETERS ################################# -dimension 3 -boundary p p p -pair_style lj/cut/coul/cut 13.0 -lattice sc $a +dimension 3 +boundary p p p +pair_style lj/cut/coul/cut 13.0 +lattice sc $a read_data concentration_init.data atom_modify sort 0 1 mass * 39.948 pair_coeff * * 0.2381 3.405 pair_coeff 1 * 0.4 3.405 -dielectric 80.0 +dielectric 80.0 variable xlo equal xlo variable xhi equal xhi variable xmid equal 0.5*(${xhi}+${xlo}) @@ -37,9 +37,9 @@ region FLUID block ${xlo} ${xhi} ${ylo} ${yhi} ${zlo} ${zhi} units box region R block ${xmid} ${xhi} ${ylo} ${yhi} ${zlo} ${zhi} units box group SOLID type 1 variable xdof equal 3*count(SOLID) -compute_modify thermo_temp extra ${xdof} -#set group SOLID charge 0 -group NEUTRAL type 2 +compute_modify thermo_temp extra/dof ${xdof} +#set group SOLID charge 0 +group NEUTRAL type 2 group FLUID type 2 3 4 group NION type 3 group PION type 4 @@ -72,16 +72,16 @@ compute PMIN PION reduce min x compute PMAX PION reduce max x compute NMIN NION reduce min x compute NMAX NION reduce max x -timestep ${dt} +timestep ${dt} #neighbor 13 bin neigh_modify every $i check no # coulombic interactions -fix ATC FLUID atc species_electrostatic Ar_electrostatic.mat +fix ATC FLUID atc species_electrostatic Ar_electrostatic.mat #fix_modify ATC parallel_consistency off fix_modify ATC extrinsic short_range off #fix_modify ATC boundary SOLID fix_modify ATC atom_element_map eulerian $i -fix_modify ATC internal_quadrature off +fix_modify ATC internal_quadrature off fix_modify ATC consistent_fe_initialization on fix_modify ATC filter type exponential fix_modify ATC filter scale $i @@ -97,31 +97,31 @@ fix_modify ATC mesh create_elementset BOX BOX fix_modify ATC mass_matrix fe fix_modify ATC include atomic_charge fix_modify ATC add_species N type 3 -fix_modify ATC add_species P type 4 +fix_modify ATC add_species P type 4 fix_modify ATC add_species Nt type 5 -fix_modify ATC add_species Pt type 6 +fix_modify ATC add_species Pt type 6 ## CC fix_modify ATC control concentration N R 0.001 Nt # deletions R -fix_modify ATC control concentration N frequency $f -fix_modify ATC control concentration N max_energy $e +fix_modify ATC control concentration N frequency $f +fix_modify ATC control concentration N max_energy $e fix_modify ATC control concentration N max_attempts 100 fix_modify ATC control concentration N max_exchanges $x #- fix_modify ATC control concentration P R 0.002 Pt # addtions R -fix_modify ATC control concentration P frequency $f +fix_modify ATC control concentration P frequency $f fix_modify ATC control concentration P max_energy $e -fix_modify ATC control concentration P max_attempts 100 +fix_modify ATC control concentration P max_attempts 100 fix_modify ATC control concentration P max_exchanges $x fix_modify ATC output volume_integral all mass_density fix_modify ATC output volume_integral all charge_density # data reduction fix PP all atc field -#fix_modify PP add_species ions type 3 4 +#fix_modify PP add_species ions type 3 4 #fix_modify PP add_species IONS type 3 4 1 2 -fix_modify PP add_species n type 3 -fix_modify PP add_species p type 4 -fix_modify PP add_species s type 1 -fix_modify PP add_species o type 2 +fix_modify PP add_species n type 3 +fix_modify PP add_species p type 4 +fix_modify PP add_species s type 1 +fix_modify PP add_species o type 2 fix_modify PP fields add species_concentration mass_density charge_density temperature fix_modify PP fields add charge_flux species_flux fix_modify PP output volume_integral all mass_density @@ -129,7 +129,7 @@ fix_modify PP output volume_integral all charge_density fix_modify PP mesh create $h 1 1 BOX f p p fix_modify PP atom_element_map eulerian $i # output -thermo $i +thermo $i variable dN equal f_ATC[1] variable dP equal f_ATC[2] variable Nc equal f_ATC[3] @@ -141,19 +141,19 @@ variable Nu equal f_ATC[7] variable Pu equal f_ATC[8] variable Ng equal f_ATC[9] variable Pg equal f_ATC[10] -thermo_style custom step temp etotal & +thermo_style custom step temp etotal & atoms v_F v_P v_N v_dP v_dN v_Pc v_Nc v_Pr v_Nr v_Pt v_Nt & c_PMIN c_NMIN c_PMAX c_NMAX c_Q c_M c_Qf c_Mf v_Pu v_Nu v_Pg v_Ng -# NOTE this doesn't seem to work -#thermo_modify format 4 %5d format 5 %5d format 6 %5d format 7 %5d format 8 %5d -#thermo_modify format 4 %5d -#thermo_modify format 5 %5d -#thermo_modify format 6 %5d -#thermo_modify format 7 %5d -#thermo_modify format 8 %5d -#thermo_modify format 9 %5d -#thermo_modify format 10 %5d -#thermo_modify format 11 %5d +# NOTE this doesn't seem to work +#thermo_modify format 4 %5d format 5 %5d format 6 %5d format 7 %5d format 8 %5d +#thermo_modify format 4 %5d +#thermo_modify format 5 %5d +#thermo_modify format 6 %5d +#thermo_modify format 7 %5d +#thermo_modify format 8 %5d +#thermo_modify format 9 %5d +#thermo_modify format 10 %5d +#thermo_modify format 11 %5d log concentration.log fix_modify ATC output concentrationFE $s text binary fix_modify PP output concentrationPP $s text diff --git a/examples/PACKAGES/atc/fluids/in.shear_flow b/examples/PACKAGES/atc/fluids/in.shear_flow index 3c06676c64..29327dfb1c 100644 --- a/examples/PACKAGES/atc/fluids/in.shear_flow +++ b/examples/PACKAGES/atc/fluids/in.shear_flow @@ -2,42 +2,42 @@ # This benchmark tests momentum flux as a BC to the MD region to generate shear flow. # Currently heat will be generated as it will have no where to go. log shear_flow.log -units real -atom_style atomic +units real +atom_style atomic # create domain -#lattice type reduced density rho* = 4*(sigma/a)^3, where N=4 for fcc, s = 3.405 A (Wagner) and a = 5.25 A (Ashcroft & Mermin, p. 70) +#lattice type reduced density rho* = 4*(sigma/a)^3, where N=4 for fcc, s = 3.405 A (Wagner) and a = 5.25 A (Ashcroft & Mermin, p. 70) # NOTE following 3 lines added for restart boundary f p p pair_style lj/cut 13.5 #read_data temp.init -read_data post_eq.init +read_data post_eq.init lattice fcc 5.405 origin 0.25 0.25 0.25 # create atoms, NOTE commented out for restart -#region mdRegion block -8 8 -3 3 -3 3 -#boundary f p p -#create_box 2 mdRegion -#create_atoms 1 region mdRegion -#mass * 39.95 +#region mdRegion block -8 8 -3 3 -3 3 +#boundary f p p +#create_box 2 mdRegion +#create_atoms 1 region mdRegion +#mass * 39.95 # specify interal/ghost atoms -#region mdInternal block -6 6 -3 3 -3 3 -#region mdGhost block -6 6 -3 3 -3 3 side out +#region mdInternal block -6 6 -3 3 -3 3 +#region mdGhost block -6 6 -3 3 -3 3 side out #create_atoms 1 region mdGhost #lattice fcc 6.5 origin 0.25 0.25 0.25 -#create_atoms 2 region mdInternal -group internal type 2 -group ghost type 1 +#create_atoms 2 region mdInternal +group internal type 2 +group ghost type 1 # velocities have Vcm = 0, NOTE next four lines commented out for restart -#velocity internal create 100. 87287 mom yes loop geom -#pair_style lj/cut 13.5 -##pair_coeff 1 1 0.010323166 3.405 13.5 -#pair_coeff * * .238 3.405 13.5 +#velocity internal create 100. 87287 mom yes loop geom +#pair_style lj/cut 13.5 +##pair_coeff 1 1 0.010323166 3.405 13.5 +#pair_coeff * * .238 3.405 13.5 #write_restart tinit.dat -neighbor 5. bin -neigh_modify every 10 delay 0 check no +neighbor 5. bin +neigh_modify every 10 delay 0 check no # equilibrate MD field variable xdof equal 3*count(ghost) -compute_modify thermo_temp extra ${xdof} +compute_modify thermo_temp extra/dof ${xdof} thermo_style custom step cpu etotal pe temp thermo_modify format 1 %6i format 2 %7.2g #fix NVT internal nvt temp 100 100 10 drag 0.2 @@ -49,28 +49,28 @@ timestep 2 # ID group atc PhysicsType ParameterFile lattice fcc 5.405 origin 0.25 0.25 0.25 -region atcRegion block -6.25 6.25 -3 3 -3 3 +region atcRegion block -6.25 6.25 -3 3 -3 3 fix AtC internal atc shear Ar_viscosity.mat # ID part keywords nx ny nz region periodicity fix_modify AtC mesh create 6 1 1 atcRegion f p p #fix_modify AtC time_integration fractional_step -##fix_modify AtC atom_element_map eulerian 10 # NOTE this introduces a minor amount of time integration error tracking the atomic temperature +##fix_modify AtC atom_element_map eulerian 10 # NOTE this introduces a minor amount of time integration error tracking the atomic temperature fix_modify AtC internal_quadrature off -#fix_modify AtC mass_matrix fe +#fix_modify AtC mass_matrix fe # add nodesets # ID mesh create_nodeset tag xmin xmax ymin ymax zmin zmax fix_modify AtC mesh create_elementset rbc 4.12 6.3 -INF INF -INF INF #used for restarting -fix_modify AtC consistent_fe_initialization on +fix_modify AtC consistent_fe_initialization on #fix_modify AtC initial velocity x all 0. # turn on kinetostat reset_timestep 0 -fix_modify AtC reset_time -fix_modify AtC source velocity y rbc .0000001 +fix_modify AtC reset_time +fix_modify AtC source velocity y rbc .0000001 fix_modify AtC control momentum flux no_boundary -fix_modify AtC control tolerance 1.e-14 -fix_modify AtC control localized_lambda on +fix_modify AtC control tolerance 1.e-14 +fix_modify AtC control localized_lambda on #fix_modify AtC filter type exponential #fix_modify AtC filter scale 1000.0 #fix_modify AtC filter on @@ -78,7 +78,7 @@ fix_modify AtC control localized_lambda on # output commands fix_modify AtC output shear_flowFE 100 text #binary #undump D1 -#dump D1 all custom 100 shear_flow.dmp id type xs ys zs vx vy vz +#dump D1 all custom 100 shear_flow.dmp id type xs ys zs vx vy vz # set-up non-equilibrium IC -thermo 100 -run 2000 +thermo 100 +run 2000 diff --git a/examples/PACKAGES/atc/hardy/in.eshelby_static b/examples/PACKAGES/atc/hardy/in.eshelby_static index b0ccc94af5..b00dcd1185 100644 --- a/examples/PACKAGES/atc/hardy/in.eshelby_static +++ b/examples/PACKAGES/atc/hardy/in.eshelby_static @@ -1,4 +1,4 @@ -# This test calculates the J-integral for a sequence of different loads +# This test calculates the J-integral for a sequence of different loads # for a system with a crack tip. # # loops around crack and one around undefected material @@ -7,17 +7,17 @@ # loop 2 - medium contour around left crack tip # loop 3 - largest contour around left crack tip # loop 4 - medium contour around right crack tip -#for Lennard-Jones potential for gold: -# surface energy (gamma) of 0.1599 eV/Å^2 = 2.56191 J/m2. +#for Lennard-Jones potential for gold: +# surface energy (gamma) of 0.1599 eV/Å^2 = 2.56191 J/m2. # 2*gamma = 0.3198 eV/Å^2 = 5.12382 J/m2 -# using the internal nktv2p conversion factor, +# using the internal nktv2p conversion factor, # the units of eshelby_stress are eV/Å^3, and # the resulting boundary integral is eV/Å since we also include thickness (a # boundary surface area rather than a periphery). If we multiply the 2*gamma # quantity times the thickness t = 3*4.08 = 12.24 Å, we obtain 2*gamma*t = -# 3.914352 eV/Å, which agrees with the mesh calculation. +# 3.914352 eV/Å, which agrees with the mesh calculation. echo both -log eshelby_static.log +log eshelby_static.log units metal dimension 3 boundary p p p @@ -29,12 +29,12 @@ lattice fcc 4.08 origin 0.25 0.25 0.25 region SYSTEM block -10 10 -10 10 0 3 region UPPER block -10 10 0 10 0 3 region LOWER block -10 0 -10 10 0 3 -create_box 1 SYSTEM +create_box 1 SYSTEM create_atoms 1 region SYSTEM mass 1 63.55 -group internal region SYSTEM -group upper region UPPER -group lower region LOWER +group internal region SYSTEM +group upper region UPPER +group lower region LOWER #pair_style eam #pair_coeff * * ../../../../potentials/Cu_u3.eam #pair_style lj/smooth 8.0 10.0 @@ -42,27 +42,27 @@ group lower region LOWER pair_style lj/smooth/linear 5.456108274435118 pair_coeff * * 0.7242785984051078 2.598146797350056 # define region -region abovecrack block -2.01 2.01 0 8 INF INF units lattice +region abovecrack block -2.01 2.01 0 8 INF INF units lattice group abovecrack region abovecrack -region belowcrack block -2.01 2.01 -8 0 INF INF units lattice +region belowcrack block -2.01 2.01 -8 0 INF INF units lattice group belowcrack region belowcrack neighbor 1.0 bin neigh_modify delay 1000000 -neigh_modify exclude group abovecrack belowcrack +neigh_modify exclude group abovecrack belowcrack thermo 10 -compute_modify thermo_temp extra 0 +compute_modify thermo_temp extra/dof 0 region FORCECHECK block -6 0 6 10 0 3 group FORCECHECK region FORCECHECK compute fxsum FORCECHECK reduce sum fx compute fysum FORCECHECK reduce sum fy compute fzsum FORCECHECK reduce sum fz thermo_style custom step ke pe press c_fxsum c_fysum c_fzsum -thermo_modify format 1 %4i format 2 %3.1g format 3 %20.16g +thermo_modify format 1 %4i format 2 %3.1g format 3 %20.16g timestep 0.0 # (1) minimize the system to get a relaxed configuration min_modify line quadratic variable tol equal 1.e-11 -minimize 0.0 ${tol} 100000 1000000 +minimize 0.0 ${tol} 100000 1000000 write_restart eshelby.restart # (2) pull crack apart reset_timestep 0 @@ -70,13 +70,13 @@ fix PK1 internal atc field # NOTE tune this relative to lattice size fix_modify PK1 mesh create 10 10 1 SYSTEM p f p fix_modify PK1 fields none -fix_modify PK1 fields add mass_density internal_energy temperature stress displacement -fix_modify PK1 fields add eshelby_stress transformed_stress -fix_modify PK1 gradients add displacement +fix_modify PK1 fields add mass_density internal_energy temperature stress displacement +fix_modify PK1 fields add eshelby_stress transformed_stress +fix_modify PK1 gradients add displacement fix_modify PK1 set reference_potential_energy fix_modify PK1 output eshelby_staticFE 1 text binary tensor_components -#fix_modify PK1 on_the_fly -#-- make concentric loops around one/both of the crack tips +#fix_modify PK1 on_the_fly +#-- make concentric loops around one/both of the crack tips #-- & another around undefected material (loop0) fix_modify PK1 mesh create_faceset loop0 box -6 0 6 10 -INF INF outward fix_modify PK1 output boundary_integral eshelby_stress faceset loop0 diff --git a/examples/PACKAGES/atc/hardy/in.nvt b/examples/PACKAGES/atc/hardy/in.nvt index 68ba2eba17..c6de0842f9 100644 --- a/examples/PACKAGES/atc/hardy/in.nvt +++ b/examples/PACKAGES/atc/hardy/in.nvt @@ -5,12 +5,12 @@ atom_style atomic echo both dimension 3 boundary p p p -lattice fcc 5.376 orient x 1 0 0 orient y 0 1 0 orient z 0 0 1 -region box block 0 5 0 5 0 5 -read_data nvt.init +lattice fcc 5.376 orient x 1 0 0 orient y 0 1 0 orient z 0 0 1 +region box block 0 5 0 5 0 5 +read_data nvt.init pair_style lj/cut 13.0 -pair_coeff 1 1 0.2381 3.405 -group internal region box +pair_coeff 1 1 0.2381 3.405 +group internal region box fix ATC internal atc field fix_modify ATC mesh create 1 1 1 box p p p @@ -27,12 +27,12 @@ fix_modify PP atom_element_map eulerian 100 fix_modify PP fields add mass_density energy stress temperature kinetic_temperature fix_modify PP fields add velocity thermal_energy kinetic_energy fix_modify PP output nvtPP 100 text -thermo 100 -compute_modify thermo_temp extra 0 -thermo_style custom step temp etotal ke pe press vol -timestep 4.0 -reset_timestep 0 +thermo 100 +compute_modify thermo_temp extra/dof 0 +thermo_style custom step temp etotal ke pe press vol +timestep 4.0 +reset_timestep 0 # NOTE fixes performing time integration (init_integrate/final_integrate) should be defined after atc -fix NVT all nvt temp 30 30 10.0 drag 0.2 tchain 1 -log nvt.log -run 1000 +fix NVT all nvt temp 30 30 10.0 drag 0.2 tchain 1 +log nvt.log +run 1000 diff --git a/examples/PACKAGES/atc/thermal/in.bar1d b/examples/PACKAGES/atc/thermal/in.bar1d index 3f70577ec3..9fe5617ec3 100644 --- a/examples/PACKAGES/atc/thermal/in.bar1d +++ b/examples/PACKAGES/atc/thermal/in.bar1d @@ -1,38 +1,38 @@ #AtC Thermal Coupling # This benchmark tests heat conducting into and out of the MD region. The # temperature is initially 20 everywhere and the left boundary BC is fixed at 40. -# The result should show heat diffusing through the FEM to the MD and back out -# to the FEM on the right. Insufficient time is captured to reach the linear +# The result should show heat diffusing through the FEM to the MD and back out +# to the FEM on the right. Insufficient time is captured to reach the linear # steady state, but heat crossing both boundaries should be observed. - -units real -atom_style atomic + +units real +atom_style atomic echo both # create domain -#lattice type reduced density rho* = 4*(sigma/a)^3, where N=4 for fcc, s = 3.405 A (Wagner) and a = 5.25 A (Ashcroft & Mermin, p. 70) +#lattice type reduced density rho* = 4*(sigma/a)^3, where N=4 for fcc, s = 3.405 A (Wagner) and a = 5.25 A (Ashcroft & Mermin, p. 70) # NOTE following 3 lines added for restart boundary f p p pair_style lj/cut 13.5 read_data temp.init lattice fcc 5.405 origin 0.25 0.25 0.25 -region simRegion block -12 12 -3 3 -3 3 +region simRegion block -12 12 -3 3 -3 3 # create atoms, NOTE commented out for restart -#region mdRegion block -5 5 -3 3 -3 3 -#boundary f p p -#create_box 1 mdRegion -#create_atoms 1 region mdRegion -#mass 1 39.95 +#region mdRegion block -5 5 -3 3 -3 3 +#boundary f p p +#create_box 1 mdRegion +#create_atoms 1 region mdRegion +#mass 1 39.95 # specify interal/ghost atoms -region mdInternal block -4 4 -3 3 -3 3 -group internal region mdInternal -group ghost subtract all internal +region mdInternal block -4 4 -3 3 -3 3 +group internal region mdInternal +group ghost subtract all internal # velocities have Vcm = 0, NOTE next four lines commented out for restart -#velocity internal create 40. 87287 mom yes loop geom -#pair_style lj/cut 13.5 -##pair_coeff 1 1 0.010323166 3.405 13.5 -#pair_coeff 1 1 .238 3.405 13.5 -neighbor 5. bin -neigh_modify every 10 delay 0 check no +#velocity internal create 40. 87287 mom yes loop geom +#pair_style lj/cut 13.5 +##pair_coeff 1 1 0.010323166 3.405 13.5 +#pair_coeff 1 1 .238 3.405 13.5 +neighbor 5. bin +neigh_modify every 10 delay 0 check no # ID group atc PhysicsType ParameterFile fix AtC internal atc thermal Ar_thermal.mat fix_modify AtC boundary ghost @@ -40,26 +40,26 @@ fix_modify AtC boundary ghost fix_modify AtC mesh create 12 1 1 simRegion f p p fix_modify AtC internal_quadrature off # fix a temperature -fix_modify AtC fix temperature all 20. +fix_modify AtC fix temperature all 20. # turn on thermostat -fix_modify AtC control thermal rescale 10 +fix_modify AtC control thermal rescale 10 # equilibrate MD field #dump D1 all atom 100 dump.bar1d #fix_modify AtC output bar1dfe 100 -timestep 5 +timestep 5 variable xdof equal 3*count(ghost) -compute_modify thermo_temp extra ${xdof} -thermo_style custom step cpu etotal pe f_AtC[1] temp f_AtC[2] +compute_modify thermo_temp extra/dof ${xdof} +thermo_style custom step cpu etotal pe f_AtC[1] temp f_AtC[2] thermo_modify format 1 %6i format 2 %7.2g -thermo 100 -run 400 +thermo 100 +run 400 # change thermostat to hoover -fix_modify AtC unfix temperature all -fix_modify AtC control thermal hoover -#fix_modify AtC localized_lambda on -fix_modify AtC filter type exponential -fix_modify AtC filter scale 10000.0 -fix_modify AtC filter on +fix_modify AtC unfix temperature all +fix_modify AtC control thermal hoover +#fix_modify AtC localized_lambda on +fix_modify AtC filter type exponential +fix_modify AtC filter scale 10000.0 +fix_modify AtC filter on # add nodesets # ID mesh create_nodeset tag xmin xmax ymin ymax zmin zmax fix_modify AtC mesh create_nodeset lbc -12.1 -11.9 -INF INF -INF INF @@ -67,13 +67,13 @@ fix_modify AtC mesh create_nodeset rbc 11.9 12.1 -INF INF -INF INF fix_modify AtC fix temperature lbc 40. fix_modify AtC fix temperature rbc 20. # initialize filter -thermo 1 -run 100 +thermo 1 +run 100 # set up output, should be before a "run" fix_modify AtC output bar1dFE 100 text binary # output command #dump D1 all atom 1000 dump.bar1d # run with FE reset_timestep 0 -thermo 100 -run 10000 +thermo 100 +run 10000 diff --git a/examples/PACKAGES/atc/thermal/in.bar1d_all_atoms b/examples/PACKAGES/atc/thermal/in.bar1d_all_atoms index 2219b803ec..1faf24427d 100644 --- a/examples/PACKAGES/atc/thermal/in.bar1d_all_atoms +++ b/examples/PACKAGES/atc/thermal/in.bar1d_all_atoms @@ -4,33 +4,33 @@ # 40.# The result should show heat diffusing through the FEM to the MD and back # out # to the FEM on the right. Insufficient time is captured to reach the # linear # steady state, but heat crossing both boundaries should be observed. -units real -atom_style atomic +units real +atom_style atomic # create domain -#lattice type reduced density rho* = 4*(sigma/a)^3, where N=4 for fcc, s = 3.405 A (Wagner) and a = 5.25 A (Ashcroft & Mermin, p. 70) +#lattice type reduced density rho* = 4*(sigma/a)^3, where N=4 for fcc, s = 3.405 A (Wagner) and a = 5.25 A (Ashcroft & Mermin, p. 70) # NOTE following 3 lines added for restart boundary f p p pair_style lj/cut 13.5 read_data all_atoms.init lattice fcc 5.405 origin 0.25 0.25 0.25 -region simRegion block -7 7 -3 3 -3 3 +region simRegion block -7 7 -3 3 -3 3 # create atoms, NOTE commented out for restart -#boundary f p p -#create_box 1 simRegion -#create_atoms 1 region simRegion -#mass 1 39.95 +#boundary f p p +#create_box 1 simRegion +#create_atoms 1 region simRegion +#mass 1 39.95 # specify interal/ghost atoms -region mdInternal block -6 6 -3 3 -3 3 -group internal region mdInternal -group ghost subtract all internal +region mdInternal block -6 6 -3 3 -3 3 +group internal region mdInternal +group ghost subtract all internal # velocities have Vcm = 0, NOTE next four lines commented out for restart -#velocity internal create 40. 87287 mom yes loop geom -#pair_style lj/cut 13.5 -##pair_coeff 1 1 0.010323166 3.405 13.5 -#pair_coeff 1 1 .238 3.405 13.5 -#write_restart all_atoms.init -neighbor 5. bin -neigh_modify every 10 delay 0 check no +#velocity internal create 40. 87287 mom yes loop geom +#pair_style lj/cut 13.5 +##pair_coeff 1 1 0.010323166 3.405 13.5 +#pair_coeff 1 1 .238 3.405 13.5 +#write_restart all_atoms.init +neighbor 5. bin +neigh_modify every 10 delay 0 check no # ID group atc PhysicsType ParameterFile fix AtC internal atc thermal Ar_thermal.mat # ID part keywords nx ny nz region @@ -39,34 +39,34 @@ fix_modify AtC mesh create_faceset obndy box -6.0 6.0 -INF INF -INF INF out fix_modify AtC mesh create_faceset lbndy box -6.0 16.0 -INF INF -INF INF outward fix_modify AtC mesh create_faceset rbndy box -16.0 6.0 -INF INF -INF INF outward # fix a temperature -fix_modify AtC fix temperature all 20. +fix_modify AtC fix temperature all 20. # turn on thermostat -fix_modify AtC control thermal rescale 10 +fix_modify AtC control thermal rescale 10 fix_modify AtC internal_quadrature off # equilibrate MD field #dump D1 all atom 100 dump.bar1d #fix_modify AtC output bar1dfe 100 -#fix_modify AtC time_integration frac_step -timestep 5 +#fix_modify AtC time_integration frac_step +timestep 5 variable xdof equal 3*count(ghost) -compute_modify thermo_temp extra ${xdof} +compute_modify thermo_temp extra/dof ${xdof} thermo_style custom step cpu etotal pe f_AtC[1] temp f_AtC[2] thermo_modify format 1 %6i format 2 %7.2g -thermo 100 -run 400 +thermo 100 +run 400 # change thermostat to hoover -fix_modify AtC control thermal hoover -#fix_modify AtC thermal control flux interpolate -#fix_modify AtC thermal control flux faceset obndy -fix_modify AtC filter scale 1000.0 -#fix_modify AtC filter equilibrate -#fix_modify AtC filter on -#fix_modify AtC localized_lambda on +fix_modify AtC control thermal hoover +#fix_modify AtC thermal control flux interpolate +#fix_modify AtC thermal control flux faceset obndy +fix_modify AtC filter scale 1000.0 +#fix_modify AtC filter equilibrate +#fix_modify AtC filter on +#fix_modify AtC localized_lambda on fix_modify AtC boundary_faceset is obndy # initialize filter #fix_modify AtC output bar1d_all_atoms_preqFE 1 reset_timestep 0 -thermo 1 +thermo 1 #run 5000 # add nodesets and ramp temperature # ID mesh create_nodeset tag xmin xmax ymin ymax zmin zmax @@ -76,26 +76,26 @@ thermo 1 #fix_modify AtC fix temperature rbc 20. # initialize filter #fix_modify AtC output bar1d_all_atoms_eqFE 200 -reset_timestep 0 -fix_modify AtC reset_time +reset_timestep 0 +fix_modify AtC reset_time #run 5000 # release and let run -#fix_modify AtC filter on -fix_modify AtC unfix temperature all +#fix_modify AtC filter on +fix_modify AtC unfix temperature all #fix_modify AtC localized_lambda on -fix_modify AtC control lumped_lambda_solve on +fix_modify AtC control lumped_lambda_solve on # dirichlet boundaries #fix_modify AtC fix temperature lbc 40. #fix_modify AtC fix temperature rbc 20. # neumann boundaries fix_modify AtC control thermal flux no_boundary -fix_modify AtC fix_flux temperature lbndy 0.0000000001 +fix_modify AtC fix_flux temperature lbndy 0.0000000001 fix_modify AtC fix_flux temperature rbndy -0.0000000001 # set up output, should be before a "run" fix_modify AtC output bar1d_all_atomsFE 200 text binary # output command #dump D1 all atom 1000 dump.bar1d # run with FE -reset_timestep 0 -thermo 200 -run 5000 +reset_timestep 0 +thermo 200 +run 5000 diff --git a/examples/PACKAGES/atc/thermal/in.bar1d_combined b/examples/PACKAGES/atc/thermal/in.bar1d_combined index 70dafe72be..23b01139f2 100644 --- a/examples/PACKAGES/atc/thermal/in.bar1d_combined +++ b/examples/PACKAGES/atc/thermal/in.bar1d_combined @@ -6,62 +6,62 @@ # linear # steady state, but heat crossing the boundaries should be observed, # as should the interaction of the two themostat types. #echo both -units real -atom_style atomic +units real +atom_style atomic # create domain -#lattice type reduced density rho* = 4*(sigma/a)^3, where N=4 for fcc, s = 3.405 A (Wagner) and a = 5.25 A (Ashcroft & Mermin, p. 70) +#lattice type reduced density rho* = 4*(sigma/a)^3, where N=4 for fcc, s = 3.405 A (Wagner) and a = 5.25 A (Ashcroft & Mermin, p. 70) # NOTE following 3 lines added for restart -boundary f p p -pair_style lj/cut 13.5 +boundary f p p +pair_style lj/cut 13.5 read_data temp.init lattice fcc 5.405 origin 0.25 0.25 0.25 -region simRegion block -16 4 -3 3 -3 3 +region simRegion block -16 4 -3 3 -3 3 # create atoms, NOTE commented out for restart -#region mdRegion block -5 5 -3 3 -3 3 -#boundary f p p -#create_box 1 mdRegion -#create_atoms 1 region mdRegion -#mass 1 39.95 +#region mdRegion block -5 5 -3 3 -3 3 +#boundary f p p +#create_box 1 mdRegion +#create_atoms 1 region mdRegion +#mass 1 39.95 # specify interal/ghost atoms -region mdInternal block -4 4 -3 3 -3 3 -group internal region mdInternal -region mdGhost block -5 -4 -3 3 -3 3 -group ghost region mdGhost +region mdInternal block -4 4 -3 3 -3 3 +group internal region mdInternal +region mdGhost block -5 -4 -3 3 -3 3 +group ghost region mdGhost # velocities have Vcm = 0, NOTE next four lines commented out for restart -#velocity internal create 40. 87287 mom yes loop geom -#pair_style lj/cut 13.5 -##pair_coeff 1 1 0.010323166 3.405 13.5 -#pair_coeff 1 1 .238 3.405 13.5 -neighbor 5. bin -neigh_modify every 10 delay 0 check no -#write_restart tinit.dat +#velocity internal create 40. 87287 mom yes loop geom +#pair_style lj/cut 13.5 +##pair_coeff 1 1 0.010323166 3.405 13.5 +#pair_coeff 1 1 .238 3.405 13.5 +neighbor 5. bin +neigh_modify every 10 delay 0 check no +#write_restart tinit.dat # ID group atc PhysicsType ParameterFile fix AtC internal atc thermal Ar_thermal.mat fix_modify AtC boundary ghost fix_modify AtC time_integration fractional_step -fix_modify AtC internal_quadrature off +fix_modify AtC internal_quadrature off # ID part keywords nx ny nz region fix_modify AtC mesh create 10 1 1 simRegion f p p fix_modify AtC mesh create_faceset ibndy box -4.0 40.0 -INF INF -INF INF in fix_modify AtC mesh create_faceset obndy box -4.0 40.0 -INF INF -INF INF outward # fix a temperature -fix_modify AtC fix temperature all 20. +fix_modify AtC fix temperature all 20. # turn on thermostat -fix_modify AtC control thermal rescale 10 +fix_modify AtC control thermal rescale 10 variable xdof equal 3*count(ghost) -compute_modify thermo_temp extra ${xdof} +compute_modify thermo_temp extra/dof ${xdof} thermo_style custom step cpu etotal pe f_AtC[1] temp f_AtC[2] thermo_modify format 1 %6i format 2 %7.2g # equilibrate MD field #fix_modify AtC output bar1dfe_combined_init 100 -timestep 5 -thermo 10 -run 400 +timestep 5 +thermo 10 +run 400 # change thermostat to flux -fix_modify AtC unfix temperature all -fix_modify AtC control thermal flux faceset obndy -#fix_modify AtC control thermal hoover -fix_modify AtC control localized_lambda on +fix_modify AtC unfix temperature all +fix_modify AtC control thermal flux faceset obndy +#fix_modify AtC control thermal hoover +fix_modify AtC control localized_lambda on #fix_modify AtC control tolerance 1.e-16 # this tolerance seems necessary to prevent noticeable drift # add nodesets # ID mesh create_nodeset tag xmin xmax ymin ymax zmin zmax @@ -74,8 +74,8 @@ fix_modify AtC fix temperature rbc 20. fix_modify AtC filter type exponential fix_modify AtC filter scale 1000.0 #fix_modify AtC filter on -thermo 100 -#run 100 +thermo 100 +#run 100 # set up output, should be before a "run" fix_modify AtC output bar1d_combinedFE 100 text @@ -83,5 +83,5 @@ fix_modify AtC output bar1d_combinedFE 100 text #dump D1 all atom 100 dump.bar1d_combined # run with FE reset_timestep 0 -thermo 100 -run 5000 +thermo 100 +run 5000 diff --git a/examples/PACKAGES/atc/thermal/in.bar1d_flux b/examples/PACKAGES/atc/thermal/in.bar1d_flux index 2b79aa6339..6f7fdcca21 100644 --- a/examples/PACKAGES/atc/thermal/in.bar1d_flux +++ b/examples/PACKAGES/atc/thermal/in.bar1d_flux @@ -5,34 +5,34 @@ # out # to the FEM on the right. Insufficient time is captured to reach the # linear # steady state, but heat crossing both boundaries should be observed. #echo both -units real -atom_style atomic +units real +atom_style atomic # create domain -#lattice type reduced density rho* = 4*(sigma/a)^3, where N=4 for fcc, s = 3.405 A (Wagner) and a = 5.25 A (Ashcroft & Mermin, p. 70) +#lattice type reduced density rho* = 4*(sigma/a)^3, where N=4 for fcc, s = 3.405 A (Wagner) and a = 5.25 A (Ashcroft & Mermin, p. 70) # NOTE following 3 lines added for restart -boundary f p p -pair_style lj/cut 13.5 +boundary f p p +pair_style lj/cut 13.5 read_data temp.init lattice fcc 5.405 origin 0.25 0.25 0.25 -region simRegion block -12 12 -3 3 -3 3 +region simRegion block -12 12 -3 3 -3 3 # create atoms, NOTE commented out for restart -#region mdRegion block -5 5 -3 3 -3 3 -#boundary f p p -#create_box 1 mdRegion -#create_atoms 1 region mdRegion -#mass 1 39.95 +#region mdRegion block -5 5 -3 3 -3 3 +#boundary f p p +#create_box 1 mdRegion +#create_atoms 1 region mdRegion +#mass 1 39.95 # specify interal/ghost atoms -region mdInternal block -4 4 -3 3 -3 3 -group internal region mdInternal -group ghost subtract all internal +region mdInternal block -4 4 -3 3 -3 3 +group internal region mdInternal +group ghost subtract all internal # velocities have Vcm = 0, NOTE next four lines commented out for restart -#velocity internal create 40. 87287 mom yes loop geom -#pair_style lj/cut 13.5 -##pair_coeff 1 1 0.010323166 3.405 13.5 -#pair_coeff 1 1 .238 3.405 13.5 -neighbor 5. bin -neigh_modify every 10 delay 0 check no -#write_restart tinit.dat +#velocity internal create 40. 87287 mom yes loop geom +#pair_style lj/cut 13.5 +##pair_coeff 1 1 0.010323166 3.405 13.5 +#pair_coeff 1 1 .238 3.405 13.5 +neighbor 5. bin +neigh_modify every 10 delay 0 check no +#write_restart tinit.dat # ID group atc PhysicsType ParameterFile fix AtC internal atc thermal Ar_thermal.mat fix_modify AtC boundary ghost @@ -42,25 +42,25 @@ fix_modify AtC mesh create 12 1 1 simRegion f p p fix_modify AtC mesh create_faceset ibndy box -4.0 4.0 -INF INF -INF INF in fix_modify AtC mesh create_faceset obndy box -4.0 4.0 -INF INF -INF INF outward # fix a temperature -fix_modify AtC fix temperature all 20. -#fix_modify AtC fix temperature all linear 0 0 0 -0.154 0 0 30. +fix_modify AtC fix temperature all 20. +#fix_modify AtC fix temperature all linear 0 0 0 -0.154 0 0 30. # turn on thermostat -fix_modify AtC control thermal rescale 10 +fix_modify AtC control thermal rescale 10 variable xdof equal 3*count(ghost) -compute_modify thermo_temp extra ${xdof} +compute_modify thermo_temp extra/dof ${xdof} thermo_style custom step cpu etotal pe f_AtC[1] temp f_AtC[2] thermo_modify format 1 %6i format 2 %7.2g # equilibrate MD field #fix_modify AtC output bar1dfe_flux_init 100 -timestep 5 -thermo 10 -run 400 +timestep 5 +thermo 10 +run 400 # change thermostat to hoover -fix_modify AtC unfix temperature all -fix_modify AtC control thermal flux faceset obndy +fix_modify AtC unfix temperature all +fix_modify AtC control thermal flux faceset obndy fix_modify AtC filter type exponential -fix_modify AtC filter scale 10000.0 -#fix_modify AtC filter on +fix_modify AtC filter scale 10000.0 +#fix_modify AtC filter on # add nodesets # ID mesh create_nodeset tag xmin xmax ymin ymax zmin zmax fix_modify AtC mesh create_nodeset lbc -12.1 -11.9 -INF INF -INF INF @@ -68,12 +68,12 @@ fix_modify AtC mesh create_nodeset rbc 11.9 12.1 -INF INF -INF INF fix_modify AtC fix temperature lbc 40. fix_modify AtC fix temperature rbc 20. # initialize filter -run 100 +run 100 # set up output, should be before a "run" fix_modify AtC output bar1d_fluxFE 100 text binary # output command #dump D1 all atom 1000 dump.bar1d # run with FE reset_timestep 0 -thermo 100 -run 10000 +thermo 100 +run 10000 diff --git a/examples/PACKAGES/atc/thermal/in.bar1d_frac_step b/examples/PACKAGES/atc/thermal/in.bar1d_frac_step index e8540d9151..09295cab24 100644 --- a/examples/PACKAGES/atc/thermal/in.bar1d_frac_step +++ b/examples/PACKAGES/atc/thermal/in.bar1d_frac_step @@ -4,33 +4,33 @@ # 40.# The result should show heat diffusing through the FEM to the MD and back # out # to the FEM on the right. Insufficient time is captured to reach the # linear # steady state, but heat crossing both boundaries should be observed. -units real -atom_style atomic +units real +atom_style atomic # create domain -#lattice type reduced density rho* = 4*(sigma/a)^3, where N=4 for fcc, s = 3.405 A (Wagner) and a = 5.25 A (Ashcroft & Mermin, p. 70) +#lattice type reduced density rho* = 4*(sigma/a)^3, where N=4 for fcc, s = 3.405 A (Wagner) and a = 5.25 A (Ashcroft & Mermin, p. 70) # NOTE following 3 lines added for restart boundary f p p pair_style lj/cut 13.5 read_data temp.init lattice fcc 5.405 origin 0.25 0.25 0.25 -region simRegion block -12 12 -3 3 -3 3 +region simRegion block -12 12 -3 3 -3 3 # create atoms, NOTE commented out for restart -#region mdRegion block -5 5 -3 3 -3 3 -#boundary f p p -#create_box 1 mdRegion -#create_atoms 1 region mdRegion -#mass 1 39.95 +#region mdRegion block -5 5 -3 3 -3 3 +#boundary f p p +#create_box 1 mdRegion +#create_atoms 1 region mdRegion +#mass 1 39.95 # specify interal/ghost atoms -region mdInternal block -4 4 -3 3 -3 3 -group internal region mdInternal -group ghost subtract all internal +region mdInternal block -4 4 -3 3 -3 3 +group internal region mdInternal +group ghost subtract all internal # velocities have Vcm = 0, NOTE next four lines commented out for restart -#velocity internal create 40. 87287 mom yes loop geom -#pair_style lj/cut 13.5 -##pair_coeff 1 1 0.010323166 3.405 13.5 -#pair_coeff 1 1 .238 3.405 13.5 -neighbor 5. bin -neigh_modify every 10 delay 0 check no +#velocity internal create 40. 87287 mom yes loop geom +#pair_style lj/cut 13.5 +##pair_coeff 1 1 0.010323166 3.405 13.5 +#pair_coeff 1 1 .238 3.405 13.5 +neighbor 5. bin +neigh_modify every 10 delay 0 check no # ID group atc PhysicsType ParameterFile fix AtC internal atc thermal Ar_thermal.mat # ID part keywords nx ny nz region @@ -40,7 +40,7 @@ fix_modify AtC internal_atom_integrate off fix iNVE internal nve fix_modify AtC internal_quadrature off # fix a temperature -fix_modify AtC fix temperature all 20. +fix_modify AtC fix temperature all 20. # add nodesets # ID mesh create_nodeset tag xmin xmax ymin ymax zmin zmax fix_modify AtC mesh create_nodeset lbc -4.1 -3.9 -INF INF -INF INF @@ -48,25 +48,25 @@ fix_modify AtC mesh create_nodeset rbc 3.9 4.1 -INF INF -INF INF fix_modify AtC fix temperature lbc 40. fix_modify AtC fix temperature rbc 20. # turn on thermostat -fix_modify AtC control thermal rescale 10 +fix_modify AtC control thermal rescale 10 # equilibrate MD field #dump D1 all atom 100 dump.bar1d #fix_modify AtC output bar1dfe 100 text -timestep 5 +timestep 5 variable xdof equal 3*count(ghost) -compute_modify thermo_temp extra ${xdof} +compute_modify thermo_temp extra/dof ${xdof} thermo_style custom step cpu etotal pe f_AtC[1] temp f_AtC[2] thermo_modify format 1 %6i format 2 %7.2g -thermo 100 -run 400 +thermo 100 +run 400 # change thermostat to hoover fix_modify AtC unfix temperature all fix_modify AtC fix temperature lbc 40. fix_modify AtC fix temperature rbc 20. fix_modify AtC control thermal flux no_boundary -fix_modify AtC control tolerance 1.e-9 # this is to remove looser benchmark tolerance because the lambda solution was reacting to numerical noise, but it results in a slight drift in the constraints -#fix_modify AtC thermal control none -fix_modify AtC control localized_lambda on +fix_modify AtC control tolerance 1.e-9 # this is to remove looser benchmark tolerance because the lambda solution was reacting to numerical noise, but it results in a slight drift in the constraints +#fix_modify AtC thermal control none +fix_modify AtC control localized_lambda on fix_modify AtC filter type exponential fix_modify AtC filter scale 1000.0 fix_modify AtC filter on @@ -76,5 +76,5 @@ fix_modify AtC output bar1d_frac_stepFE 200 text #dump D1 all atom 1000 dump.bar1d # run with FE reset_timestep 0 -thermo 100 -run 10000 +thermo 100 +run 10000 diff --git a/examples/PACKAGES/atc/thermal/in.bar1d_hoover b/examples/PACKAGES/atc/thermal/in.bar1d_hoover index 2f0518d0d2..477a2bf08d 100644 --- a/examples/PACKAGES/atc/thermal/in.bar1d_hoover +++ b/examples/PACKAGES/atc/thermal/in.bar1d_hoover @@ -4,35 +4,35 @@ # 40.# The result should show heat diffusing through the FEM to the MD and back # out # to the FEM on the right. Insufficient time is captured to reach the # linear # steady state, but heat crossing both boundaries should be observed. -units real -atom_style atomic +units real +atom_style atomic log bar1d_hoover.log # create domain -#lattice type reduced density rho* = 4*(sigma/a)^3, where N=4 for fcc, s = 3.405 A (Wagner) and a = 5.25 A (Ashcroft & Mermin, p. 70) +#lattice type reduced density rho* = 4*(sigma/a)^3, where N=4 for fcc, s = 3.405 A (Wagner) and a = 5.25 A (Ashcroft & Mermin, p. 70) # NOTE following 3 lines added for restart boundary f p p pair_style lj/cut 13.5 read_data all_atoms.init lattice fcc 5.405 origin 0.25 0.25 0.25 -region simRegion block -7 7 -3 3 -3 3 +region simRegion block -7 7 -3 3 -3 3 # create atoms, NOTE commented out for restart -#boundary f p p -#create_box 1 simRegion -#create_atoms 1 region simRegion -#mass 1 39.95 -#atom_modify sort 0 0 +#boundary f p p +#create_box 1 simRegion +#create_atoms 1 region simRegion +#mass 1 39.95 +#atom_modify sort 0 0 # specify interal/ghost atoms -region mdInternal block -6 6 -3 3 -3 3 -group internal region mdInternal -group ghost subtract all internal +region mdInternal block -6 6 -3 3 -3 3 +group internal region mdInternal +group ghost subtract all internal # velocities have Vcm = 0, NOTE next four lines commented out for restart -#velocity internal create 40. 87287 mom yes loop geom -#pair_style lj/cut 13.5 -##pair_coeff 1 1 0.010323166 3.405 13.5 -#pair_coeff 1 1 .238 3.405 13.5 -#write_restart all_atoms.init -neighbor 5. bin -neigh_modify every 10 delay 0 check no +#velocity internal create 40. 87287 mom yes loop geom +#pair_style lj/cut 13.5 +##pair_coeff 1 1 0.010323166 3.405 13.5 +#pair_coeff 1 1 .238 3.405 13.5 +#write_restart all_atoms.init +neighbor 5. bin +neigh_modify every 10 delay 0 check no # ID group atc PhysicsType ParameterFile fix AtC internal atc thermal Ar_thermal.mat # ID part keywords nx ny nz region @@ -40,9 +40,9 @@ fix AtC internal atc thermal Ar_thermal.mat # switch depending on application of BCs or coupling #variable nEls equal 6 # for boundary conditions variable nEls equal 12 # for coupling -fix_modify AtC boundary ghost # for coupling +fix_modify AtC boundary ghost # for coupling -region atcRegion block -${nEls} ${nEls} -3 3 -3 3 +region atcRegion block -${nEls} ${nEls} -3 3 -3 3 fix_modify AtC mesh create ${nEls} 1 1 atcRegion f p p fix_modify AtC mesh create_faceset obndy box -6.0 6.0 -INF INF -INF INF outward fix_modify AtC mesh create_faceset lbndy box -6.0 16.0 -INF INF -INF INF outward @@ -50,39 +50,39 @@ fix_modify AtC mesh create_faceset rbndy box -16.0 6.0 -INF INF -INF INF ou variable tol equal 0.1 variable uBnd equal ${nEls}+${tol} variable lBnd equal ${nEls}-${tol} -fix_modify AtC mesh create_nodeset lbc -${uBnd} -${lBnd} -INF INF -INF INF +fix_modify AtC mesh create_nodeset lbc -${uBnd} -${lBnd} -INF INF -INF INF fix_modify AtC mesh create_nodeset rbc ${lBnd} ${uBnd} -INF INF -INF INF # fix a temperature -fix_modify AtC fix temperature all 20. -#fix_modify AtC initial temperature all 20. -#fix_modify AtC consistent_fe_initialization on +fix_modify AtC fix temperature all 20. +#fix_modify AtC initial temperature all 20. +#fix_modify AtC consistent_fe_initialization on # turn on thermostat -fix_modify AtC control thermal rescale 10 +fix_modify AtC control thermal rescale 10 fix_modify AtC internal_quadrature off # equilibrate MD field #dump D1 all atom 100 dump.bar1d_hoover_init #fix_modify AtC output bar1d_hoover_init 100 text binary -fix_modify AtC time_integration fractional_step -fix_modify AtC temperature_definition total -timestep 5 +fix_modify AtC time_integration fractional_step +fix_modify AtC temperature_definition total +timestep 5 variable xdof equal 3*count(ghost) -compute_modify thermo_temp extra ${xdof} +compute_modify thermo_temp extra/dof ${xdof} thermo_style custom step cpu etotal pe f_AtC[1] temp f_AtC[2] thermo_modify format 1 %6i format 2 %7.2g -thermo 100 -run 400 +thermo 100 +run 400 -fix_modify AtC unfix temperature all +fix_modify AtC unfix temperature all -fix_modify AtC filter type exponential +fix_modify AtC filter type exponential fix_modify AtC filter scale 1000.0 fix_modify AtC filter on # boundary conditions------------------------ # dirichlet with ramp (unstable when filtered due to instantaneous change in rate) -#fix_modify AtC fix temperature lbc temporal_ramp 20. 40. 25000. -#fix_modify AtC fix temperature rbc 20. +#fix_modify AtC fix temperature lbc temporal_ramp 20. 40. 25000. +#fix_modify AtC fix temperature rbc 20. #fix_modify AtC localized_lambda on #fix_modify AtC control thermal flux no_boundary #fix_modify AtC output test_rampFE 200 text binary @@ -94,7 +94,7 @@ fix_modify AtC filter on #fix_modify AtC fix temperature lbc 40. # dirichlet with rescaling -#fix_modify AtC filter off +#fix_modify AtC filter off #fix_modify AtC fix temperature all 20. #fix_modify AtC fix temperature lbc 40. #fix_modify AtC output test_rampFE 200 text binary @@ -126,13 +126,13 @@ fix_modify AtC fix temperature rbc 20. #fix_modify AtC lumped_lambda_solve on # hoover -fix_modify AtC control thermal hoover +fix_modify AtC control thermal hoover fix_modify AtC control localized_lambda on -fix_modify AtC control tolerance 1.e-14 +fix_modify AtC control tolerance 1.e-14 fix_modify AtC output bar1d_hooverFE 200 text binary #dump D1 all atom 200 dump.bar1d_hoover reset_timestep 0 fix_modify AtC reset_time -thermo 100 +thermo 100 run 5000 diff --git a/examples/PACKAGES/atc/thermal/in.bar1d_interpolate b/examples/PACKAGES/atc/thermal/in.bar1d_interpolate index 0333bf117d..7e1d6295b4 100644 --- a/examples/PACKAGES/atc/thermal/in.bar1d_interpolate +++ b/examples/PACKAGES/atc/thermal/in.bar1d_interpolate @@ -4,65 +4,65 @@ # 40.# The result should show heat diffusing through the FEM to the MD and back # out # to the FEM on the right. Insufficient time is captured to reach the # linear # steady state, but heat crossing both boundaries should be observed. -units real -atom_style atomic +units real +atom_style atomic # create domain -#lattice type reduced density rho* = 4*(sigma/a)^3, where N=4 for fcc, s = 3.405 A (Wagner) and a = 5.25 A (Ashcroft & Mermin, p. 70) +#lattice type reduced density rho* = 4*(sigma/a)^3, where N=4 for fcc, s = 3.405 A (Wagner) and a = 5.25 A (Ashcroft & Mermin, p. 70) # NOTE following 3 lines added for restart boundary f p p pair_style lj/cut 13.5 read_data temp.init lattice fcc 5.405 origin 0.25 0.25 0.25 -region simRegion block -12 12 -3 3 -3 3 +region simRegion block -12 12 -3 3 -3 3 # create atoms, NOTE commented out for restart -#region mdRegion block -5 5 -3 3 -3 3 -#boundary f p p -#create_box 1 mdRegion -#create_atoms 1 region mdRegion -#mass 1 39.95 +#region mdRegion block -5 5 -3 3 -3 3 +#boundary f p p +#create_box 1 mdRegion +#create_atoms 1 region mdRegion +#mass 1 39.95 # specify interal/ghost atoms -region mdInternal block -4 4 -3 3 -3 3 -group internal region mdInternal -group ghost subtract all internal +region mdInternal block -4 4 -3 3 -3 3 +group internal region mdInternal +group ghost subtract all internal # velocities have Vcm = 0, NOTE next three lines commented out for restart -#velocity internal create 40. 87287 mom yes loop geom -#pair_style lj/cut 13.5 -#pair_coeff 1 1 .238 3.405 13.5 -neighbor 5. bin -neigh_modify every 10 delay 0 check no +#velocity internal create 40. 87287 mom yes loop geom +#pair_style lj/cut 13.5 +#pair_coeff 1 1 .238 3.405 13.5 +neighbor 5. bin +neigh_modify every 10 delay 0 check no # ID group atc PhysicsType ParameterFile fix AtC internal atc thermal Ar_thermal.mat fix_modify AtC boundary ghost # numerical parameters -fix_modify AtC time_integration fractional_step +fix_modify AtC time_integration fractional_step # ID part keywords nx ny nz region fix_modify AtC mesh create 12 1 1 simRegion f p p fix_modify AtC mesh create_faceset ibndy box -4.0 4.0 -INF INF -INF INF in fix_modify AtC mesh create_faceset obndy box -4.0 4.0 -INF INF -INF INF outward # fix a temperature -fix_modify AtC fix temperature all 20. -#fix_modify AtC fix temperature all linear 0 0 0 -0.154 0 0 30. -#fix_modify AtC fix temperature all quadratic 0 0 0 -0.154 0 0 30. 0.01 0.0 0.0 0 0 0 +fix_modify AtC fix temperature all 20. +#fix_modify AtC fix temperature all linear 0 0 0 -0.154 0 0 30. +#fix_modify AtC fix temperature all quadratic 0 0 0 -0.154 0 0 30. 0.01 0.0 0.0 0 0 0 # turn on thermostat -fix_modify AtC control thermal rescale 10 +fix_modify AtC control thermal rescale 10 # equilibrate MD field #fix_modify AtC output bar1dfe_flux_init 100 -timestep 5 +timestep 5 variable xdof equal 3*count(ghost) -compute_modify thermo_temp extra ${xdof} +compute_modify thermo_temp extra/dof ${xdof} thermo_style custom step cpu etotal pe f_AtC[1] temp f_AtC[2] thermo_modify format 1 %6i format 2 %7.2g -thermo 100 -run 400 +thermo 100 +run 400 # change thermostat to hoover -fix_modify AtC unfix temperature all -fix_modify AtC control thermal none -fix_modify AtC control thermal flux interpolate -fix_modify AtC control localized_lambda on -#fix_modify AtC thermal control flux faceset obndy +fix_modify AtC unfix temperature all +fix_modify AtC control thermal none +fix_modify AtC control thermal flux interpolate +fix_modify AtC control localized_lambda on +#fix_modify AtC thermal control flux faceset obndy fix_modify AtC filter type exponential -fix_modify AtC filter scale 10000.0 -fix_modify AtC filter on +fix_modify AtC filter scale 10000.0 +fix_modify AtC filter on # add nodesets # ID mesh create_nodeset tag xmin xmax ymin ymax zmin zmax fix_modify AtC mesh create_nodeset lbc -12.1 -11.9 -INF INF -INF INF @@ -70,11 +70,11 @@ fix_modify AtC mesh create_nodeset rbc 11.9 12.1 -INF INF -INF INF fix_modify AtC fix temperature lbc 40. fix_modify AtC fix temperature rbc 20. # initialize filter -run 100 +run 100 # set up output, should be before a "run" fix_modify AtC output bar1d_interpolateFE 100 text # run with FE reset_timestep 0 -thermo 100 -#run 10 -run 10000 +thermo 100 +#run 10 +run 10000 diff --git a/examples/PACKAGES/atc/thermal/in.bar1d_lumped b/examples/PACKAGES/atc/thermal/in.bar1d_lumped index 153f7b632d..5321c45eb4 100644 --- a/examples/PACKAGES/atc/thermal/in.bar1d_lumped +++ b/examples/PACKAGES/atc/thermal/in.bar1d_lumped @@ -5,32 +5,32 @@ # out # to the FEM on the right. Insufficient time is captured to reach the # linear # steady state, but heat crossing both boundaries should be observed. echo both -units real -atom_style atomic +units real +atom_style atomic # create domain -#lattice type reduced density rho* = 4*(sigma/a)^3, where N=4 for fcc, s = 3.405 A (Wagner) and a = 5.25 A (Ashcroft & Mermin, p. 70) +#lattice type reduced density rho* = 4*(sigma/a)^3, where N=4 for fcc, s = 3.405 A (Wagner) and a = 5.25 A (Ashcroft & Mermin, p. 70) # NOTE following 3 lines added for restart boundary f p p pair_style lj/cut 13.5 read_data temp.init lattice fcc 5.405 origin 0.25 0.25 0.25 -region simRegion block -12 12 -3 3 -3 3 +region simRegion block -12 12 -3 3 -3 3 # create atoms, NOTE commented out for restart -#region mdRegion block -5 5 -3 3 -3 3 -#boundary f p p -#create_box 1 mdRegion -#create_atoms 1 region mdRegion -#mass 1 39.95 +#region mdRegion block -5 5 -3 3 -3 3 +#boundary f p p +#create_box 1 mdRegion +#create_atoms 1 region mdRegion +#mass 1 39.95 # specify interal/ghost atoms -region mdInternal block -4 4 -3 3 -3 3 -group internal region mdInternal -group ghost subtract all internal +region mdInternal block -4 4 -3 3 -3 3 +group internal region mdInternal +group ghost subtract all internal # velocities have Vcm = 0, NOTE next three lines commented out for restart -#velocity internal create 40. 87287 mom yes loop geom -#pair_style lj/cut 13.5 -#pair_coeff 1 1 .238 3.405 13.5 -neighbor 5. bin -neigh_modify every 10 delay 0 check no +#velocity internal create 40. 87287 mom yes loop geom +#pair_style lj/cut 13.5 +#pair_coeff 1 1 .238 3.405 13.5 +neighbor 5. bin +neigh_modify every 10 delay 0 check no # ID group atc PhysicsType ParameterFile fix AtC internal atc thermal Ar_thermal.mat fix_modify AtC boundary ghost @@ -42,30 +42,30 @@ fix_modify AtC mesh create 12 1 1 simRegion f p p fix_modify AtC mesh create_faceset ibndy box -4.0 4.0 -INF INF -INF INF in fix_modify AtC mesh create_faceset obndy box -4.0 4.0 -INF INF -INF INF outward # fix a temperature -fix_modify AtC fix temperature all 20. -#fix_modify AtC fix temperature all linear 0 0 0 -0.154 0 0 30. -#fix_modify AtC fix temperature all quadratic 0 0 0 -0.154 0 0 30. 0.01 0.0 0.0 0 0 0 +fix_modify AtC fix temperature all 20. +#fix_modify AtC fix temperature all linear 0 0 0 -0.154 0 0 30. +#fix_modify AtC fix temperature all quadratic 0 0 0 -0.154 0 0 30. 0.01 0.0 0.0 0 0 0 # turn on thermostat -fix_modify AtC control thermal rescale 10 +fix_modify AtC control thermal rescale 10 # output -thermo 100 +thermo 100 variable xdof equal 3*count(ghost) -compute_modify thermo_temp extra ${xdof} +compute_modify thermo_temp extra/dof ${xdof} thermo_style custom step cpu etotal pe f_AtC[1] temp f_AtC[2] thermo_modify format 1 %6i format 2 %7.2g # equilibrate MD field #fix_modify AtC output bar1d_lumped_initFE 1 text -timestep 5 -run 400 -#run 100 +timestep 5 +run 400 +#run 100 # change thermostat to hoover -fix_modify AtC unfix temperature all -#fix_modify AtC thermal control flux interpolate -fix_modify AtC control thermal flux faceset obndy -fix_modify AtC control localized_lambda on +fix_modify AtC unfix temperature all +#fix_modify AtC thermal control flux interpolate +fix_modify AtC control thermal flux faceset obndy +fix_modify AtC control localized_lambda on fix_modify AtC filter type exponential -fix_modify AtC filter scale 10000.0 -fix_modify AtC filter on +fix_modify AtC filter scale 10000.0 +fix_modify AtC filter on # add nodesets # ID mesh create_nodeset tag xmin xmax ymin ymax zmin zmax fix_modify AtC mesh create_nodeset lbc -12.1 -11.9 -INF INF -INF INF @@ -73,13 +73,13 @@ fix_modify AtC mesh create_nodeset rbc 11.9 12.1 -INF INF -INF INF fix_modify AtC fix temperature lbc 80. fix_modify AtC fix temperature rbc 80. # initialize -thermo 10 -run 100 +thermo 10 +run 100 # relax fix_modify AtC unfix temperature all # output fix_modify AtC output bar1d_lumpedFE 100 text # run with FE reset_timestep 0 -thermo 100 -run 10000 +thermo 100 +run 10000 diff --git a/examples/PACKAGES/atc/two_temperature/in.uniform_heating b/examples/PACKAGES/atc/two_temperature/in.uniform_heating index 0565fe8449..81a649e847 100644 --- a/examples/PACKAGES/atc/two_temperature/in.uniform_heating +++ b/examples/PACKAGES/atc/two_temperature/in.uniform_heating @@ -1,41 +1,41 @@ # needs description #AtC Thermal Coupling echo both -units real -atom_style atomic -boundary f p p +units real +atom_style atomic +boundary f p p # create domain -#lattice type reduced density rho* = 4*(sigma/a)^3, where N=4 for fcc, s = 3.405 A (Wagner) and a = 5.25 A (Ashcroft & Mermin, p. 70) -pair_style lj/cut 13.5 -read_data uniform_heating.init +#lattice type reduced density rho* = 4*(sigma/a)^3, where N=4 for fcc, s = 3.405 A (Wagner) and a = 5.25 A (Ashcroft & Mermin, p. 70) +pair_style lj/cut 13.5 +read_data uniform_heating.init lattice fcc 5.405 origin 0.25 0.25 0.25 -region mdRegion block -8 8 -3 3 -3 3 -region mdInternal block -6 6 -3 3 -3 3 -group internal region mdInternal -neighbor 5. bin -neigh_modify every 10 delay 0 check no +region mdRegion block -8 8 -3 3 -3 3 +region mdInternal block -6 6 -3 3 -3 3 +group internal region mdInternal +neighbor 5. bin +neigh_modify every 10 delay 0 check no # ID group atc PhysicsType ParameterFile fix AtC internal atc two_temperature Ar_ttm.mat # ID part keywords nx ny nz region fix_modify AtC mesh create 6 1 1 mdInternal f p p fix_modify AtC internal_quadrature on # fix a temperature -fix_modify AtC initial temperature all 20. -fix_modify AtC fix temperature all 20. -fix_modify AtC initial electron_temperature all 20. -fix_modify AtC fix electron_temperature all 20. +fix_modify AtC initial temperature all 20. +fix_modify AtC fix temperature all 20. +fix_modify AtC initial electron_temperature all 20. +fix_modify AtC fix electron_temperature all 20. # turn on thermostat -fix_modify AtC control thermal rescale 10 +fix_modify AtC control thermal rescale 10 # output thermo_style custom step cpu pe etotal temp f_AtC[1] f_AtC[2] -thermo 100 +thermo 100 log uniform_heating.log # make thermo output the correct temperature by removing ghost dof # variable xdof equal 3*count(ghost) -# compute_modify thermo_temp extra ${xdof} +# compute_modify thermo_temp extra/dof ${xdof} # equilibrate MD field -timestep 5 -run 400 +timestep 5 +run 400 # change thermostat fix_modify AtC output uniform_heatingFE 100 text fix_modify AtC unfix temperature all @@ -50,4 +50,4 @@ fix_modify AtC fix temperature rbc 20. fix_modify AtC source temperature all 6.3363e-10 # run with FE reset_timestep 0 -run 1000 +run 1000 diff --git a/examples/PACKAGES/charge_regulation/in.chreg-acid b/examples/PACKAGES/charge_regulation/in.chreg-acid index 68ef5e1b7c..30ae13c6da 100644 --- a/examples/PACKAGES/charge_regulation/in.chreg-acid +++ b/examples/PACKAGES/charge_regulation/in.chreg-acid @@ -25,7 +25,7 @@ pair_modify shift yes ######### VERLET INTEGRATION WITH LANGEVIN THERMOSTAT ########### fix fnve all nve compute dtemp all temp -compute_modify dtemp dynamic yes +compute_modify dtemp dynamic/dof yes fix fT all langevin 1.0 1.0 1.0 123 fix_modify fT temp dtemp diff --git a/examples/PACKAGES/charge_regulation/in.chreg-acid-real b/examples/PACKAGES/charge_regulation/in.chreg-acid-real index d7225f33ea..361027c596 100644 --- a/examples/PACKAGES/charge_regulation/in.chreg-acid-real +++ b/examples/PACKAGES/charge_regulation/in.chreg-acid-real @@ -6,12 +6,12 @@ neighbor 10.0 bin read_data data.chreg-acid-real #real units -variable sigma equal 7.2 # particle diameter 0.72 nm -variable temperature equal 298 # temperature 298 K +variable sigma equal 7.2 # particle diameter 0.72 nm +variable temperature equal 298 # temperature 298 K variable kb index 0.0019872067 # kB in Kcal/mol/K -variable epsilon equal ${kb}*${temperature} -variable tunit equal 2000 # time unit is 2000 fs -variable timestep equal 0.005*${tunit} +variable epsilon equal ${kb}*${temperature} +variable tunit equal 2000 # time unit is 2000 fs +variable timestep equal 0.005*${tunit} variable cut_long equal 12.5*${sigma} variable nevery equal 100 @@ -27,13 +27,13 @@ velocity all create ${temperature} 8008 loop geom pair_style lj/cut/coul/long ${cut_lj} ${cut_long} pair_coeff * * ${epsilon} ${sigma} kspace_style pppm 1.0e-3 -dielectric 78 +dielectric 78 pair_modify shift yes ######### VERLET INTEGRATION WITH LANGEVIN THERMOSTAT ########### fix fnve all nve compute dtemp all temp -compute_modify dtemp dynamic yes +compute_modify dtemp dynamic/dof yes fix fT all langevin $(v_temperature) $(v_temperature) $(v_tunit) 123 fix_modify fT temp dtemp diff --git a/examples/PACKAGES/charge_regulation/in.chreg-polymer b/examples/PACKAGES/charge_regulation/in.chreg-polymer index 055032c018..068fe35c90 100644 --- a/examples/PACKAGES/charge_regulation/in.chreg-polymer +++ b/examples/PACKAGES/charge_regulation/in.chreg-polymer @@ -17,7 +17,7 @@ dielectric 1.0 ######### VERLET INTEGRATION WITH LANGEVIN THERMOSTAT ########### fix fnve all nve compute dtemp all temp -compute_modify dtemp dynamic yes +compute_modify dtemp dynamic/dof yes fix fT all langevin 1.0 1.0 1.0 123 fix_modify fT temp dtemp diff --git a/examples/mc/in.gcmc.lj b/examples/mc/in.gcmc.lj index a1c7c6eb10..5f007fbf40 100644 --- a/examples/mc/in.gcmc.lj +++ b/examples/mc/in.gcmc.lj @@ -3,35 +3,35 @@ # rho ~ 0.5 # p ~ 1.5 # mu_ex ~ 0.0 -# comparable to Frenkel and Smit GCMC Case Study, Figure 5.8 +# comparable to Frenkel and Smit GCMC Case Study, Figure 5.8 # variables modifiable using -var command line switch variable mu index -1.25 variable temp index 2.0 -variable disp index 1.0 +variable disp index 1.0 variable lbox index 5.0 # global model settings units lj atom_style atomic -pair_style lj/cut 3.0 -pair_modify tail no # turn of to avoid triggering full_energy +pair_style lj/cut 3.0 +pair_modify tail no # turn of to avoid triggering full_energy # box -region box block 0 ${lbox} 0 ${lbox} 0 ${lbox} -create_box 1 box +region box block 0 ${lbox} 0 ${lbox} 0 ${lbox} +create_box 1 box # lj parameters -pair_coeff * * 1.0 1.0 -mass * 1.0 +pair_coeff * * 1.0 1.0 +mass * 1.0 # we recommend setting up a dedicated group for gcmc -group gcmcgroup type 1 +group gcmcgroup type 1 # gcmc @@ -39,29 +39,29 @@ fix mygcmc gcmcgroup gcmc 1 100 100 1 29494 ${temp} ${mu} ${disp} # atom count -variable type1 atom "type==1" -group type1 dynamic gcmcgroup var type1 +variable type1 atom "type==1" +group type1 dynamic gcmcgroup var type1 variable n1 equal count(type1) # averaging -variable rho equal density -variable p equal press -variable nugget equal 1.0e-8 +variable rho equal density +variable p equal press +variable nugget equal 1.0e-8 variable lambda equal 1.0 -variable muex equal ${mu}-${temp}*ln(density*${lambda}+${nugget}) -fix ave all ave/time 10 100 1000 v_rho v_p v_muex v_n1 ave one file rho_vs_p.dat -variable rhoav equal f_ave[1] -variable pav equal f_ave[2] -variable muexav equal f_ave[3] -variable n1av equal f_ave[4] +variable muex equal ${mu}-${temp}*ln(density*${lambda}+${nugget}) +fix ave all ave/time 10 100 1000 v_rho v_p v_muex v_n1 ave one file rho_vs_p.dat +variable rhoav equal f_ave[1] +variable pav equal f_ave[2] +variable muexav equal f_ave[3] +variable n1av equal f_ave[4] # output -variable tacc equal f_mygcmc[2]/(f_mygcmc[1]+${nugget}) -variable iacc equal f_mygcmc[4]/(f_mygcmc[3]+${nugget}) -variable dacc equal f_mygcmc[6]/(f_mygcmc[5]+${nugget}) -compute_modify thermo_temp dynamic yes +variable tacc equal f_mygcmc[2]/(f_mygcmc[1]+${nugget}) +variable iacc equal f_mygcmc[4]/(f_mygcmc[3]+${nugget}) +variable dacc equal f_mygcmc[6]/(f_mygcmc[5]+${nugget}) +compute_modify thermo_temp dynamic/dof yes thermo_style custom step temp press pe ke density atoms v_iacc v_dacc v_tacc v_rhoav v_pav v_muexav v_n1av thermo 1000 From 900c6cf545fe74bacb3adfa0721fa87c9ec5b2db Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Sat, 1 Jul 2023 18:27:35 -0400 Subject: [PATCH 331/396] remove unused variable --- src/REACTION/fix_bond_react.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/REACTION/fix_bond_react.cpp b/src/REACTION/fix_bond_react.cpp index 83442ecb25..cf99efd099 100644 --- a/src/REACTION/fix_bond_react.cpp +++ b/src/REACTION/fix_bond_react.cpp @@ -2223,7 +2223,7 @@ note: currently uses global rxnID and onemol variables double FixBondReact::get_totalcharge() { - int j,jj,ilocal; + int j,jj; double *q = atom->q; double sim_total_charge = 0.0; for (j = 0; j < onemol->natoms; j++) { From 5878040f26b273c7ff9f56fe6c70c6d194b5d80c Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Sat, 1 Jul 2023 18:44:57 -0400 Subject: [PATCH 332/396] skip undesired 'make install' targets from bundled Kokkos library --- cmake/Modules/Packages/KOKKOS.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmake/Modules/Packages/KOKKOS.cmake b/cmake/Modules/Packages/KOKKOS.cmake index 8b695667ae..795b087bcb 100644 --- a/cmake/Modules/Packages/KOKKOS.cmake +++ b/cmake/Modules/Packages/KOKKOS.cmake @@ -88,7 +88,7 @@ else() if(CMAKE_REQUEST_PIC) set(CMAKE_POSITION_INDEPENDENT_CODE ON) endif() - add_subdirectory(${LAMMPS_LIB_KOKKOS_SRC_DIR} ${LAMMPS_LIB_KOKKOS_BIN_DIR}) + add_subdirectory(${LAMMPS_LIB_KOKKOS_SRC_DIR} ${LAMMPS_LIB_KOKKOS_BIN_DIR} EXCLUDE_FROM_ALL) set(Kokkos_INCLUDE_DIRS ${LAMMPS_LIB_KOKKOS_SRC_DIR}/core/src ${LAMMPS_LIB_KOKKOS_SRC_DIR}/containers/src From b7bfc86eaf6cdd354553cd76b670b4ae0d7fdece Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Sun, 2 Jul 2023 07:07:12 -0400 Subject: [PATCH 333/396] remove unused files still available and used in download-build-jpeg-png branch --- cmake/CMakeLists.jpeg | 615 ----------------------------------- cmake/CMakeLists.png | 741 ------------------------------------------ cmake/CMakeLists.zlib | 195 ----------- 3 files changed, 1551 deletions(-) delete mode 100644 cmake/CMakeLists.jpeg delete mode 100644 cmake/CMakeLists.png delete mode 100644 cmake/CMakeLists.zlib diff --git a/cmake/CMakeLists.jpeg b/cmake/CMakeLists.jpeg deleted file mode 100644 index f0bd85a90d..0000000000 --- a/cmake/CMakeLists.jpeg +++ /dev/null @@ -1,615 +0,0 @@ -cmake_minimum_required(VERSION 3.10) -# When using CMake 3.4 and later, don't export symbols from executables unless -# the CMAKE_ENABLE_EXPORTS variable is set. -if(POLICY CMP0065) - cmake_policy(SET CMP0065 NEW) -endif() -if (POLICY CMP0077) - cmake_policy(SET CMP0077 NEW) -endif() -if(CMAKE_EXECUTABLE_SUFFIX) - set(CMAKE_EXECUTABLE_SUFFIX_TMP ${CMAKE_EXECUTABLE_SUFFIX}) -endif() - -project(libjpeg-turbo C) -set(VERSION 2.1.3) -set(COPYRIGHT_YEAR "1991-2022") -string(REPLACE "." ";" VERSION_TRIPLET ${VERSION}) -list(GET VERSION_TRIPLET 0 VERSION_MAJOR) -list(GET VERSION_TRIPLET 1 VERSION_MINOR) -list(GET VERSION_TRIPLET 2 VERSION_REVISION) -function(pad_number NUMBER OUTPUT_LEN) - string(LENGTH "${${NUMBER}}" INPUT_LEN) - if(INPUT_LEN LESS OUTPUT_LEN) - math(EXPR ZEROES "${OUTPUT_LEN} - ${INPUT_LEN} - 1") - set(NUM ${${NUMBER}}) - foreach(C RANGE ${ZEROES}) - set(NUM "0${NUM}") - endforeach() - set(${NUMBER} ${NUM} PARENT_SCOPE) - endif() -endfunction() -pad_number(VERSION_MINOR 3) -pad_number(VERSION_REVISION 3) -set(LIBJPEG_TURBO_VERSION_NUMBER ${VERSION_MAJOR}${VERSION_MINOR}${VERSION_REVISION}) - -# CMake 3.14 and later sets CMAKE_MACOSX_BUNDLE to TRUE by default when -# CMAKE_SYSTEM_NAME is iOS, tvOS, or watchOS, which breaks the libjpeg-turbo -# build. (Specifically, when CMAKE_MACOSX_BUNDLE is TRUE, executables for -# Apple platforms are built as application bundles, which causes CMake to -# complain that our install() directives for executables do not specify a -# BUNDLE DESTINATION. Even if CMake did not complain, building executables as -# application bundles would break our iOS packages.) -set(CMAKE_MACOSX_BUNDLE FALSE) - -string(TIMESTAMP DEFAULT_BUILD "%Y%m%d") -set(BUILD ${DEFAULT_BUILD} CACHE STRING "Build string (default: ${DEFAULT_BUILD})") - -# NOTE: On Windows, this does nothing except when using MinGW or Cygwin. -# CMAKE_BUILD_TYPE has no meaning in Visual Studio, and it always defaults to -# Debug when using NMake. -if(NOT CMAKE_BUILD_TYPE) - set(CMAKE_BUILD_TYPE Release) -endif() -message(STATUS "CMAKE_BUILD_TYPE = ${CMAKE_BUILD_TYPE}") - -message(STATUS "VERSION = ${VERSION}, BUILD = ${BUILD}") - -include(cmakescripts/PackageInfo.cmake) - -# Detect CPU type and whether we're building 64-bit or 32-bit code -math(EXPR BITS "${CMAKE_SIZEOF_VOID_P} * 8") -string(TOLOWER ${CMAKE_SYSTEM_PROCESSOR} CMAKE_SYSTEM_PROCESSOR_LC) -set(COUNT 1) -foreach(ARCH ${CMAKE_OSX_ARCHITECTURES}) - if(COUNT GREATER 1) - message(FATAL_ERROR "The libjpeg-turbo build system does not support multiple values in CMAKE_OSX_ARCHITECTURES.") - endif() - math(EXPR COUNT "${COUNT}+1") -endforeach() -if(CMAKE_SYSTEM_PROCESSOR_LC MATCHES "x86_64" OR - CMAKE_SYSTEM_PROCESSOR_LC MATCHES "amd64" OR - CMAKE_SYSTEM_PROCESSOR_LC MATCHES "i[0-9]86" OR - CMAKE_SYSTEM_PROCESSOR_LC MATCHES "x86" OR - CMAKE_SYSTEM_PROCESSOR_LC MATCHES "ia32") - if(BITS EQUAL 64 OR CMAKE_C_COMPILER_ABI MATCHES "ELF X32") - set(CPU_TYPE x86_64) - else() - set(CPU_TYPE i386) - endif() - if(NOT CMAKE_SYSTEM_PROCESSOR STREQUAL ${CPU_TYPE}) - set(CMAKE_SYSTEM_PROCESSOR ${CPU_TYPE}) - endif() -elseif(CMAKE_SYSTEM_PROCESSOR_LC STREQUAL "aarch64" OR - CMAKE_SYSTEM_PROCESSOR_LC MATCHES "^arm") - if(BITS EQUAL 64) - set(CPU_TYPE arm64) - else() - set(CPU_TYPE arm) - endif() -elseif(CMAKE_SYSTEM_PROCESSOR_LC MATCHES "^ppc" OR - CMAKE_SYSTEM_PROCESSOR_LC MATCHES "^powerpc") - set(CPU_TYPE powerpc) -else() - set(CPU_TYPE ${CMAKE_SYSTEM_PROCESSOR_LC}) -endif() -if(CMAKE_OSX_ARCHITECTURES MATCHES "x86_64" OR - CMAKE_OSX_ARCHITECTURES MATCHES "arm64" OR - CMAKE_OSX_ARCHITECTURES MATCHES "i386") - set(CPU_TYPE ${CMAKE_OSX_ARCHITECTURES}) -endif() -if(CMAKE_OSX_ARCHITECTURES MATCHES "ppc") - set(CPU_TYPE powerpc) -endif() -if(MSVC_IDE AND CMAKE_GENERATOR_PLATFORM MATCHES "arm64") - set(CPU_TYPE arm64) -endif() - -message(STATUS "${BITS}-bit build (${CPU_TYPE})") - -macro(report_directory var) - if(CMAKE_INSTALL_${var} STREQUAL CMAKE_INSTALL_FULL_${var}) - message(STATUS "CMAKE_INSTALL_${var} = ${CMAKE_INSTALL_${var}}") - else() - message(STATUS "CMAKE_INSTALL_${var} = ${CMAKE_INSTALL_${var}} (${CMAKE_INSTALL_FULL_${var}})") - endif() - mark_as_advanced(CLEAR CMAKE_INSTALL_${var}) -endmacro() - -set(DIRLIST "BINDIR;DATAROOTDIR;DOCDIR;INCLUDEDIR;LIBDIR") -if(UNIX) - list(APPEND DIRLIST "MANDIR") -endif() -foreach(dir ${DIRLIST}) - report_directory(${dir}) -endforeach() - - -############################################################################### -# CONFIGURATION OPTIONS -############################################################################### - -macro(boolean_number var) - if(${var}) - set(${var} 1 ${ARGN}) - else() - set(${var} 0 ${ARGN}) - endif() -endmacro() - -option(ENABLE_SHARED "Build shared libraries" FALSE) -boolean_number(ENABLE_SHARED) -option(ENABLE_STATIC "Build static libraries" TRUE) -boolean_number(ENABLE_STATIC) -option(REQUIRE_SIMD "Generate a fatal error if SIMD extensions are not available for this platform (default is to fall back to a non-SIMD build)" FALSE) -boolean_number(REQUIRE_SIMD) -option(WITH_12BIT "Encode/decode JPEG images with 12-bit samples (implies WITH_ARITH_DEC=0 WITH_ARITH_ENC=0 WITH_JAVA=0 WITH_SIMD=0 WITH_TURBOJPEG=0 )" FALSE) -boolean_number(WITH_12BIT) -option(WITH_ARITH_DEC "Include arithmetic decoding support when emulating the libjpeg v6b API/ABI" TRUE) -boolean_number(WITH_ARITH_DEC) -option(WITH_ARITH_ENC "Include arithmetic encoding support when emulating the libjpeg v6b API/ABI" TRUE) -boolean_number(WITH_ARITH_ENC) -if(CMAKE_C_COMPILER_ABI MATCHES "ELF X32") - set(WITH_JAVA 0) -else() - option(WITH_JAVA "Build Java wrapper for the TurboJPEG API library (implies ENABLE_SHARED=1)" FALSE) - boolean_number(WITH_JAVA) -endif() -option(WITH_JPEG7 "Emulate libjpeg v7 API/ABI (this makes ${CMAKE_PROJECT_NAME} backward-incompatible with libjpeg v6b)" FALSE) -boolean_number(WITH_JPEG7) -option(WITH_JPEG8 "Emulate libjpeg v8 API/ABI (this makes ${CMAKE_PROJECT_NAME} backward-incompatible with libjpeg v6b)" FALSE) -boolean_number(WITH_JPEG8) -option(WITH_MEM_SRCDST "Include in-memory source/destination manager functions when emulating the libjpeg v6b or v7 API/ABI" TRUE) -boolean_number(WITH_MEM_SRCDST) -option(WITH_SIMD "Include SIMD extensions, if available for this platform" FALSE) -boolean_number(WITH_SIMD) -option(WITH_TURBOJPEG "Include the TurboJPEG API library and associated test programs" FALSE) -boolean_number(WITH_TURBOJPEG) -option(WITH_FUZZ "Build fuzz targets" FALSE) - -macro(report_option var desc) - if(${var}) - message(STATUS "${desc} enabled (${var} = ${${var}})") - else() - message(STATUS "${desc} disabled (${var} = ${${var}})") - endif() -endmacro() - -if(WITH_JAVA) - set(ENABLE_SHARED 1) -endif() - -# Explicitly setting CMAKE_POSITION_INDEPENDENT_CODE=FALSE disables PIC for all -# targets, which will cause the shared library builds to fail. Thus, if shared -# libraries are enabled and CMAKE_POSITION_INDEPENDENT_CODE is explicitly set -# to FALSE, we need to unset it, thus restoring the default behavior -# (automatically using PIC for shared library targets.) -if(DEFINED CMAKE_POSITION_INDEPENDENT_CODE AND - NOT CMAKE_POSITION_INDEPENDENT_CODE AND ENABLE_SHARED) - unset(CMAKE_POSITION_INDEPENDENT_CODE CACHE) -endif() - -report_option(ENABLE_SHARED "Shared libraries") -report_option(ENABLE_STATIC "Static libraries") - -if(ENABLE_SHARED) - set(CMAKE_INSTALL_RPATH ${CMAKE_INSTALL_FULL_LIBDIR}) -endif() - -if(WITH_JPEG8 OR WITH_JPEG7) - set(WITH_ARITH_ENC 1) - set(WITH_ARITH_DEC 1) -endif() -if(WITH_JPEG8) - set(WITH_MEM_SRCDST 0) -endif() - -if(WITH_12BIT) - set(WITH_ARITH_DEC 0) - set(WITH_ARITH_ENC 0) - set(WITH_JAVA 0) - set(WITH_SIMD 0) - set(WITH_TURBOJPEG 0) - set(BITS_IN_JSAMPLE 12) -else() - set(BITS_IN_JSAMPLE 8) -endif() -report_option(WITH_12BIT "12-bit JPEG support") - -if(WITH_ARITH_DEC) - set(D_ARITH_CODING_SUPPORTED 1) -endif() -if(NOT WITH_12BIT) - report_option(WITH_ARITH_DEC "Arithmetic decoding support") -endif() - -if(WITH_ARITH_ENC) - set(C_ARITH_CODING_SUPPORTED 1) -endif() -if(NOT WITH_12BIT) - report_option(WITH_ARITH_ENC "Arithmetic encoding support") -endif() - -if(NOT WITH_12BIT) - report_option(WITH_TURBOJPEG "TurboJPEG API library") - report_option(WITH_JAVA "TurboJPEG Java wrapper") -endif() - -if(WITH_MEM_SRCDST) - set(MEM_SRCDST_SUPPORTED 1) - set(MEM_SRCDST_FUNCTIONS "global: jpeg_mem_dest; jpeg_mem_src;") -endif() -if(NOT WITH_JPEG8) - report_option(WITH_MEM_SRCDST "In-memory source/destination managers") -endif() - -set(SO_AGE 2) -if(WITH_MEM_SRCDST) - set(SO_AGE 3) -endif() - -if(WITH_JPEG8) - set(JPEG_LIB_VERSION 80) -elseif(WITH_JPEG7) - set(JPEG_LIB_VERSION 70) -else() - set(JPEG_LIB_VERSION 62) -endif() - -math(EXPR JPEG_LIB_VERSION_DIV10 "${JPEG_LIB_VERSION} / 10") -math(EXPR JPEG_LIB_VERSION_MOD10 "${JPEG_LIB_VERSION} % 10") -if(JPEG_LIB_VERSION STREQUAL "62") - set(DEFAULT_SO_MAJOR_VERSION ${JPEG_LIB_VERSION}) -else() - set(DEFAULT_SO_MAJOR_VERSION ${JPEG_LIB_VERSION_DIV10}) -endif() -if(JPEG_LIB_VERSION STREQUAL "80") - set(DEFAULT_SO_MINOR_VERSION 2) -else() - set(DEFAULT_SO_MINOR_VERSION 0) -endif() - -# This causes SO_MAJOR_VERSION/SO_MINOR_VERSION to reset to defaults if -# WITH_JPEG7 or WITH_JPEG8 has changed. -if((DEFINED WITH_JPEG7_INT AND NOT WITH_JPEG7 EQUAL WITH_JPEG7_INT) OR - (DEFINED WITH_JPEG8_INT AND NOT WITH_JPEG8 EQUAL WITH_JPEG8_INT)) - set(FORCE_SO_VERSION "FORCE") -endif() -set(WITH_JPEG7_INT ${WITH_JPEG7} CACHE INTERNAL "") -set(WITH_JPEG8_INT ${WITH_JPEG8} CACHE INTERNAL "") - -set(SO_MAJOR_VERSION ${DEFAULT_SO_MAJOR_VERSION} CACHE STRING - "Major version of the libjpeg API shared library (default: ${DEFAULT_SO_MAJOR_VERSION})" - ${FORCE_SO_VERSION}) -set(SO_MINOR_VERSION ${DEFAULT_SO_MINOR_VERSION} CACHE STRING - "Minor version of the libjpeg API shared library (default: ${DEFAULT_SO_MINOR_VERSION})" - ${FORCE_SO_VERSION}) - -set(JPEG_LIB_VERSION_DECIMAL "${JPEG_LIB_VERSION_DIV10}.${JPEG_LIB_VERSION_MOD10}") -message(STATUS "Emulating libjpeg API/ABI v${JPEG_LIB_VERSION_DECIMAL} (WITH_JPEG7 = ${WITH_JPEG7}, WITH_JPEG8 = ${WITH_JPEG8})") -message(STATUS "libjpeg API shared library version = ${SO_MAJOR_VERSION}.${SO_AGE}.${SO_MINOR_VERSION}") - -# Because the TurboJPEG API library uses versioned symbols and changes the -# names of functions whenever they are modified in a backward-incompatible -# manner, it is always backward-ABI-compatible with itself, so the major and -# minor SO versions don't change. However, we increase the middle number (the -# SO "age") whenever functions are added to the API. -set(TURBOJPEG_SO_MAJOR_VERSION 0) -set(TURBOJPEG_SO_AGE 2) -set(TURBOJPEG_SO_VERSION 0.${TURBOJPEG_SO_AGE}.0) - - -############################################################################### -# COMPILER SETTINGS -############################################################################### - -if(MSVC) - option(WITH_CRT_DLL - "Link all ${CMAKE_PROJECT_NAME} libraries and executables with the C run-time DLL (msvcr*.dll) instead of the static C run-time library (libcmt*.lib.) The default is to use the C run-time DLL only with the libraries and executables that need it." - FALSE) - if(NOT WITH_CRT_DLL) - # Use the static C library for all build types - foreach(var CMAKE_C_FLAGS CMAKE_C_FLAGS_DEBUG CMAKE_C_FLAGS_RELEASE - CMAKE_C_FLAGS_MINSIZEREL CMAKE_C_FLAGS_RELWITHDEBINFO) - if(${var} MATCHES "/MD") - string(REGEX REPLACE "/MD" "/MT" ${var} "${${var}}") - endif() - endforeach() - endif() - add_definitions(-D_CRT_NONSTDC_NO_WARNINGS) -endif() - -if(CMAKE_COMPILER_IS_GNUCC OR CMAKE_C_COMPILER_ID STREQUAL "Clang") - # Use the maximum optimization level for release builds - foreach(var CMAKE_C_FLAGS_RELEASE CMAKE_C_FLAGS_RELWITHDEBINFO) - if(${var} MATCHES "-O2") - string(REGEX REPLACE "-O2" "-O3" ${var} "${${var}}") - endif() - endforeach() -endif() - -if(CMAKE_SYSTEM_NAME STREQUAL "SunOS") - if(CMAKE_C_COMPILER_ID MATCHES "SunPro") - # Use the maximum optimization level for release builds - foreach(var CMAKE_C_FLAGS_RELEASE CMAKE_C_FLAGS_RELWITHDEBINFO) - if(${var} MATCHES "-xO3") - string(REGEX REPLACE "-xO3" "-xO5" ${var} "${${var}}") - endif() - if(${var} MATCHES "-xO2") - string(REGEX REPLACE "-xO2" "-xO5" ${var} "${${var}}") - endif() - endforeach() - endif() -endif() - -string(TOUPPER ${CMAKE_BUILD_TYPE} CMAKE_BUILD_TYPE_UC) - -set(EFFECTIVE_C_FLAGS "${CMAKE_C_FLAGS} ${CMAKE_C_FLAGS_${CMAKE_BUILD_TYPE_UC}}") -message(STATUS "Compiler flags = ${EFFECTIVE_C_FLAGS}") - -set(EFFECTIVE_LD_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${CMAKE_EXE_LINKER_FLAGS_${CMAKE_BUILD_TYPE_UC}}") -message(STATUS "Linker flags = ${EFFECTIVE_LD_FLAGS}") - -include(CheckCSourceCompiles) -include(CheckIncludeFiles) -include(CheckTypeSize) - -check_type_size("size_t" SIZE_T) -check_type_size("unsigned long" UNSIGNED_LONG) - -if(SIZE_T EQUAL UNSIGNED_LONG) - check_c_source_compiles("int main(int argc, char **argv) { unsigned long a = argc; return __builtin_ctzl(a); }" - HAVE_BUILTIN_CTZL) -endif() -if(MSVC) - check_include_files("intrin.h" HAVE_INTRIN_H) -endif() - -if(UNIX) - if(CMAKE_CROSSCOMPILING) - set(RIGHT_SHIFT_IS_UNSIGNED 0) - else() - include(CheckCSourceRuns) - check_c_source_runs(" - #include - #include - int is_shifting_signed (long arg) { - long res = arg >> 4; - if (res == -0x7F7E80CL) - return 1; /* right shift is signed */ - /* see if unsigned-shift hack will fix it. */ - /* we can't just test exact value since it depends on width of long... */ - res |= (~0L) << (32-4); - if (res == -0x7F7E80CL) - return 0; /* right shift is unsigned */ - printf(\"Right shift isn't acting as I expect it to.\\\\n\"); - printf(\"I fear the JPEG software will not work at all.\\\\n\\\\n\"); - return 0; /* try it with unsigned anyway */ - } - int main (void) { - exit(is_shifting_signed(-0x7F7E80B1L)); - }" RIGHT_SHIFT_IS_UNSIGNED) - endif() -endif() - -if(MSVC) - set(INLINE_OPTIONS "__inline;inline") -else() - set(INLINE_OPTIONS "__inline__;inline") -endif() -option(FORCE_INLINE "Force function inlining" TRUE) -boolean_number(FORCE_INLINE) -if(FORCE_INLINE) - if(MSVC) - list(INSERT INLINE_OPTIONS 0 "__forceinline") - else() - list(INSERT INLINE_OPTIONS 0 "inline __attribute__((always_inline))") - list(INSERT INLINE_OPTIONS 0 "__inline__ __attribute__((always_inline))") - endif() -endif() -foreach(inline ${INLINE_OPTIONS}) - check_c_source_compiles("${inline} static int foo(void) { return 0; } int main(void) { return foo(); }" - INLINE_WORKS) - if(INLINE_WORKS) - set(INLINE ${inline}) - break() - endif() -endforeach() -if(NOT INLINE_WORKS) - message(FATAL_ERROR "Could not determine how to inline functions.") -endif() -message(STATUS "INLINE = ${INLINE} (FORCE_INLINE = ${FORCE_INLINE})") - -if(WITH_TURBOJPEG) - if(MSVC) - set(THREAD_LOCAL "__declspec(thread)") - else() - set(THREAD_LOCAL "__thread") - endif() - check_c_source_compiles("${THREAD_LOCAL} int i; int main(void) { i = 0; return i; }" HAVE_THREAD_LOCAL) - if(HAVE_THREAD_LOCAL) - message(STATUS "THREAD_LOCAL = ${THREAD_LOCAL}") - else() - message(WARNING "Thread-local storage is not available. The TurboJPEG API library's global error handler will not be thread-safe.") - unset(THREAD_LOCAL) - endif() -endif() - -if(UNIX AND NOT APPLE) - file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/conftest.map "VERS_1 { global: *; };") - set(CMAKE_REQUIRED_FLAGS - "-Wl,--version-script,${CMAKE_CURRENT_BINARY_DIR}/conftest.map") - check_c_source_compiles("int main(void) { return 0; }" HAVE_VERSION_SCRIPT) - set(CMAKE_REQUIRED_FLAGS) - file(REMOVE ${CMAKE_CURRENT_BINARY_DIR}/conftest.map) - if(HAVE_VERSION_SCRIPT) - message(STATUS "Linker supports GNU-style version scripts") - set(MAPFLAG "-Wl,--version-script,") - set(TJMAPFLAG "-Wl,--version-script,") - else() - message(STATUS "Linker does not support GNU-style version scripts") - if(CMAKE_SYSTEM_NAME STREQUAL "SunOS") - # The Solaris linker doesn't like our version script for the libjpeg API - # library, but the version script for the TurboJPEG API library should - # still work. - file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/conftest.map - "VERS_1 { global: foo; local: *; }; VERS_2 { global: foo2; } VERS_1;") - set(CMAKE_REQUIRED_FLAGS "-Wl,-M,${CMAKE_CURRENT_BINARY_DIR}/conftest.map -shared") - check_c_source_compiles("int foo() { return 0; } int foo2() { return 2; }" - HAVE_MAPFILE) - set(CMAKE_REQUIRED_FLAGS) - file(REMOVE ${CMAKE_CURRENT_BINARY_DIR}/conftest.map) - if(HAVE_MAPFILE) - message(STATUS "Linker supports mapfiles") - set(TJMAPFLAG "-Wl,-M,") - else() - message(STATUS "Linker does not support mapfiles") - endif() - endif() - endif() -endif() - -# Generate files -if(WIN32) - configure_file(${CMAKE_CURRENT_SOURCE_DIR}/win/jconfig.h.in jconfig.h) -else() - configure_file(jconfig.h.in jconfig.h) -endif() -configure_file(jconfigint.h.in jconfigint.h) -configure_file(jversion.h.in jversion.h) -if(UNIX) - configure_file(libjpeg.map.in libjpeg.map) -endif() - -# Include directories and compiler definitions -include_directories(${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR}) - - -############################################################################### -# TARGETS -############################################################################### - -if(CMAKE_EXECUTABLE_SUFFIX_TMP) - set(CMAKE_EXECUTABLE_SUFFIX ${CMAKE_EXECUTABLE_SUFFIX_TMP}) -endif() -message(STATUS "CMAKE_EXECUTABLE_SUFFIX = ${CMAKE_EXECUTABLE_SUFFIX}") - -set(JPEG_SOURCES jcapimin.c jcapistd.c jccoefct.c jccolor.c jcdctmgr.c jchuff.c - jcicc.c jcinit.c jcmainct.c jcmarker.c jcmaster.c jcomapi.c jcparam.c - jcphuff.c jcprepct.c jcsample.c jctrans.c jdapimin.c jdapistd.c jdatadst.c - jdatasrc.c jdcoefct.c jdcolor.c jddctmgr.c jdhuff.c jdicc.c jdinput.c - jdmainct.c jdmarker.c jdmaster.c jdmerge.c jdphuff.c jdpostct.c jdsample.c - jdtrans.c jerror.c jfdctflt.c jfdctfst.c jfdctint.c jidctflt.c jidctfst.c - jidctint.c jidctred.c jquant1.c jquant2.c jutils.c jmemmgr.c jmemnobs.c) - -if(WITH_ARITH_ENC OR WITH_ARITH_DEC) - set(JPEG_SOURCES ${JPEG_SOURCES} jaricom.c) -endif() - -if(WITH_ARITH_ENC) - set(JPEG_SOURCES ${JPEG_SOURCES} jcarith.c) -endif() - -if(WITH_ARITH_DEC) - set(JPEG_SOURCES ${JPEG_SOURCES} jdarith.c) -endif() - -if(WITH_SIMD) - add_subdirectory(simd) - if(NEON_INTRINSICS) - add_definitions(-DNEON_INTRINSICS) - endif() -elseif(NOT WITH_12BIT) - message(STATUS "SIMD extensions: None (WITH_SIMD = ${WITH_SIMD})") -endif() -if(WITH_SIMD) - message(STATUS "SIMD extensions: ${CPU_TYPE} (WITH_SIMD = ${WITH_SIMD})") - if(MSVC_IDE OR XCODE) - set_source_files_properties(${SIMD_OBJS} PROPERTIES GENERATED 1) - endif() -else() - add_library(simd OBJECT jsimd_none.c) - if(NOT WIN32 AND (CMAKE_POSITION_INDEPENDENT_CODE OR ENABLE_SHARED)) - set_target_properties(simd PROPERTIES POSITION_INDEPENDENT_CODE 1) - endif() -endif() - -if(WITH_JAVA) - add_subdirectory(java) -endif() - -if(ENABLE_SHARED) - add_subdirectory(sharedlib) -endif() - -if(ENABLE_STATIC) - add_library(jpeg-static STATIC ${JPEG_SOURCES} $ - ${SIMD_OBJS}) - if(NOT MSVC) - set_target_properties(jpeg-static PROPERTIES OUTPUT_NAME jpeg) - endif() -endif() - -if(WITH_TURBOJPEG) - if(ENABLE_SHARED) - set(TURBOJPEG_SOURCES ${JPEG_SOURCES} $ ${SIMD_OBJS} - turbojpeg.c transupp.c jdatadst-tj.c jdatasrc-tj.c rdbmp.c rdppm.c - wrbmp.c wrppm.c) - set(TJMAPFILE ${CMAKE_CURRENT_SOURCE_DIR}/turbojpeg-mapfile) - if(WITH_JAVA) - set(TURBOJPEG_SOURCES ${TURBOJPEG_SOURCES} turbojpeg-jni.c) - include_directories(${JAVA_INCLUDE_PATH} ${JAVA_INCLUDE_PATH2}) - set(TJMAPFILE ${CMAKE_CURRENT_SOURCE_DIR}/turbojpeg-mapfile.jni) - endif() - if(MSVC) - configure_file(${CMAKE_SOURCE_DIR}/win/turbojpeg.rc.in - ${CMAKE_BINARY_DIR}/win/turbojpeg.rc) - set(TURBOJPEG_SOURCES ${TURBOJPEG_SOURCES} - ${CMAKE_BINARY_DIR}/win/turbojpeg.rc) - endif() - add_library(turbojpeg SHARED ${TURBOJPEG_SOURCES}) - set_property(TARGET turbojpeg PROPERTY COMPILE_FLAGS - "-DBMP_SUPPORTED -DPPM_SUPPORTED") - if(WIN32) - set_target_properties(turbojpeg PROPERTIES DEFINE_SYMBOL DLLDEFINE) - endif() - if(MINGW) - set_target_properties(turbojpeg PROPERTIES LINK_FLAGS -Wl,--kill-at) - endif() - if(APPLE AND (NOT CMAKE_OSX_DEPLOYMENT_TARGET OR - CMAKE_OSX_DEPLOYMENT_TARGET VERSION_GREATER 10.4)) - if(NOT CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG) - set(CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG "-Wl,-rpath,") - endif() - set_target_properties(turbojpeg PROPERTIES MACOSX_RPATH 1) - endif() - set_target_properties(turbojpeg PROPERTIES - SOVERSION ${TURBOJPEG_SO_MAJOR_VERSION} VERSION ${TURBOJPEG_SO_VERSION}) - if(TJMAPFLAG) - set_target_properties(turbojpeg PROPERTIES - LINK_FLAGS "${TJMAPFLAG}${TJMAPFILE}") - endif() - endif() - - if(ENABLE_STATIC) - add_library(turbojpeg-static STATIC ${JPEG_SOURCES} $ - ${SIMD_OBJS} turbojpeg.c transupp.c jdatadst-tj.c jdatasrc-tj.c rdbmp.c - rdppm.c wrbmp.c wrppm.c) - set_property(TARGET turbojpeg-static PROPERTY COMPILE_FLAGS - "-DBMP_SUPPORTED -DPPM_SUPPORTED") - if(NOT MSVC) - set_target_properties(turbojpeg-static PROPERTIES OUTPUT_NAME turbojpeg) - endif() - endif() -endif() - -if(WIN32) - set(USE_SETMODE "-DUSE_SETMODE") -endif() -if(WITH_12BIT) - set(COMPILE_FLAGS "-DGIF_SUPPORTED -DPPM_SUPPORTED ${USE_SETMODE}") -else() - set(COMPILE_FLAGS "-DBMP_SUPPORTED -DGIF_SUPPORTED -DPPM_SUPPORTED -DTARGA_SUPPORTED ${USE_SETMODE}") - set(CJPEG_BMP_SOURCES rdbmp.c rdtarga.c) - set(DJPEG_BMP_SOURCES wrbmp.c wrtarga.c) -endif() \ No newline at end of file diff --git a/cmake/CMakeLists.png b/cmake/CMakeLists.png deleted file mode 100644 index 2521ab41be..0000000000 --- a/cmake/CMakeLists.png +++ /dev/null @@ -1,741 +0,0 @@ -# CMakeLists.txt - -# Copyright (C) 2018 Cosmin Truta -# Copyright (C) 2007,2009-2018 Glenn Randers-Pehrson -# Written by Christian Ehrlicher, 2007 -# Revised by Roger Lowman, 2009-2010 -# Revised by Clifford Yapp, 2011-2012,2017 -# Revised by Roger Leigh, 2016 -# Revised by Andreas Franek, 2016 -# Revised by Sam Serrels, 2017 -# Revised by Vadim Barkov, 2017 -# Revised by Vicky Pfau, 2018 -# Revised by Cameron Cawley, 2018 -# Revised by Cosmin Truta, 2018 -# Revised by Kyle Bentley, 2018 - -# This code is released under the libpng license. -# For conditions of distribution and use, see the disclaimer -# and license in png.h - -cmake_minimum_required(VERSION 3.10) -cmake_policy(VERSION 3.1) -# When using CMake 3.4 and later, don't export symbols from executables unless -# the CMAKE_ENABLE_EXPORTS variable is set. -if(POLICY CMP0065) - cmake_policy(SET CMP0065 NEW) -endif() -if (POLICY CMP0077) - cmake_policy(SET CMP0077 NEW) -endif() -set(CMAKE_ALLOW_LOOSE_LOOP_CONSTRUCTS ON) - -project(libpng C ASM) -enable_testing() - -set(PNGLIB_MAJOR 1) -set(PNGLIB_MINOR 6) -set(PNGLIB_RELEASE 37) -set(PNGLIB_NAME libpng${PNGLIB_MAJOR}${PNGLIB_MINOR}) -set(PNGLIB_VERSION ${PNGLIB_MAJOR}.${PNGLIB_MINOR}.${PNGLIB_RELEASE}) - -include(GNUInstallDirs) - -# needed packages - -# Allow users to specify location of Zlib. -# Useful if zlib is being built alongside this as a sub-project. -option(PNG_BUILD_ZLIB "Custom zlib Location, else find_package is used" ON) - -if(NOT PNG_BUILD_ZLIB) - find_package(ZLIB REQUIRED) - include_directories(${ZLIB_INCLUDE_DIR}) -endif() - -if(UNIX AND NOT APPLE AND NOT BEOS AND NOT HAIKU) - find_library(M_LIBRARY m) -else() - # libm is not needed and/or not available - set(M_LIBRARY "") -endif() - -# COMMAND LINE OPTIONS -option(PNG_SHARED "Build shared lib" OFF) -option(PNG_STATIC "Build static lib" ON) -option(PNG_TESTS "Build libpng tests" OFF) - -# Many more configuration options could be added here -option(PNG_FRAMEWORK "Build OS X framework" OFF) -option(PNG_DEBUG "Build with debug output" OFF) -option(PNG_HARDWARE_OPTIMIZATIONS "Enable hardware optimizations" OFF) - -set(PNG_PREFIX "" CACHE STRING "Prefix to add to the API function names") -set(DFA_XTRA "" CACHE FILEPATH "File containing extra configuration settings") - -if(PNG_HARDWARE_OPTIMIZATIONS) - -# set definitions and sources for arm -if(CMAKE_SYSTEM_PROCESSOR MATCHES "^arm" OR - CMAKE_SYSTEM_PROCESSOR MATCHES "^aarch64") - set(PNG_ARM_NEON_POSSIBLE_VALUES check on off) - set(PNG_ARM_NEON "check" CACHE STRING "Enable ARM NEON optimizations: - check: (default) use internal checking code; - off: disable the optimizations; - on: turn on unconditionally.") - set_property(CACHE PNG_ARM_NEON PROPERTY STRINGS - ${PNG_ARM_NEON_POSSIBLE_VALUES}) - list(FIND PNG_ARM_NEON_POSSIBLE_VALUES ${PNG_ARM_NEON} index) - if(index EQUAL -1) - message(FATAL_ERROR - "PNG_ARM_NEON must be one of [${PNG_ARM_NEON_POSSIBLE_VALUES}]") - elseif(NOT ${PNG_ARM_NEON} STREQUAL "off") - set(libpng_arm_sources - arm/arm_init.c - arm/filter_neon.S - arm/filter_neon_intrinsics.c - arm/palette_neon_intrinsics.c) - - if(${PNG_ARM_NEON} STREQUAL "on") - add_definitions(-DPNG_ARM_NEON_OPT=2) - elseif(${PNG_ARM_NEON} STREQUAL "check") - add_definitions(-DPNG_ARM_NEON_CHECK_SUPPORTED) - endif() - else() - add_definitions(-DPNG_ARM_NEON_OPT=0) - endif() -endif() - -# set definitions and sources for powerpc -if(CMAKE_SYSTEM_PROCESSOR MATCHES "^powerpc*" OR - CMAKE_SYSTEM_PROCESSOR MATCHES "^ppc64*") - set(PNG_POWERPC_VSX_POSSIBLE_VALUES on off) - set(PNG_POWERPC_VSX "on" CACHE STRING "Enable POWERPC VSX optimizations: - off: disable the optimizations.") - set_property(CACHE PNG_POWERPC_VSX PROPERTY STRINGS - ${PNG_POWERPC_VSX_POSSIBLE_VALUES}) - list(FIND PNG_POWERPC_VSX_POSSIBLE_VALUES ${PNG_POWERPC_VSX} index) - if(index EQUAL -1) - message(FATAL_ERROR - "PNG_POWERPC_VSX must be one of [${PNG_POWERPC_VSX_POSSIBLE_VALUES}]") - elseif(NOT ${PNG_POWERPC_VSX} STREQUAL "off") - set(libpng_powerpc_sources - powerpc/powerpc_init.c - powerpc/filter_vsx_intrinsics.c) - if(${PNG_POWERPC_VSX} STREQUAL "on") - add_definitions(-DPNG_POWERPC_VSX_OPT=2) - endif() - else() - add_definitions(-DPNG_POWERPC_VSX_OPT=0) - endif() -endif() - -# set definitions and sources for intel -if(CMAKE_SYSTEM_PROCESSOR MATCHES "^i?86" OR - CMAKE_SYSTEM_PROCESSOR MATCHES "^x86_64*") - set(PNG_INTEL_SSE_POSSIBLE_VALUES on off) - set(PNG_INTEL_SSE "on" CACHE STRING "Enable INTEL_SSE optimizations: - off: disable the optimizations") - set_property(CACHE PNG_INTEL_SSE PROPERTY STRINGS - ${PNG_INTEL_SSE_POSSIBLE_VALUES}) - list(FIND PNG_INTEL_SSE_POSSIBLE_VALUES ${PNG_INTEL_SSE} index) - if(index EQUAL -1) - message(FATAL_ERROR - "PNG_INTEL_SSE must be one of [${PNG_INTEL_SSE_POSSIBLE_VALUES}]") - elseif(NOT ${PNG_INTEL_SSE} STREQUAL "off") - set(libpng_intel_sources - intel/intel_init.c - intel/filter_sse2_intrinsics.c) - if(${PNG_INTEL_SSE} STREQUAL "on") - add_definitions(-DPNG_INTEL_SSE_OPT=1) - endif() - else() - add_definitions(-DPNG_INTEL_SSE_OPT=0) - endif() -endif() - -# set definitions and sources for MIPS -if(CMAKE_SYSTEM_PROCESSOR MATCHES "mipsel*" OR - CMAKE_SYSTEM_PROCESSOR MATCHES "mips64el*") - set(PNG_MIPS_MSA_POSSIBLE_VALUES on off) - set(PNG_MIPS_MSA "on" CACHE STRING "Enable MIPS_MSA optimizations: - off: disable the optimizations") - set_property(CACHE PNG_MIPS_MSA PROPERTY STRINGS - ${PNG_MIPS_MSA_POSSIBLE_VALUES}) - list(FIND PNG_MIPS_MSA_POSSIBLE_VALUES ${PNG_MIPS_MSA} index) - if(index EQUAL -1) - message(FATAL_ERROR - "PNG_MIPS_MSA must be one of [${PNG_MIPS_MSA_POSSIBLE_VALUES}]") - elseif(NOT ${PNG_MIPS_MSA} STREQUAL "off") - set(libpng_mips_sources - mips/mips_init.c - mips/filter_msa_intrinsics.c) - if(${PNG_MIPS_MSA} STREQUAL "on") - add_definitions(-DPNG_MIPS_MSA_OPT=2) - endif() - else() - add_definitions(-DPNG_MIPS_MSA_OPT=0) - endif() -endif() - -else(PNG_HARDWARE_OPTIMIZATIONS) - -# set definitions and sources for arm -if(CMAKE_SYSTEM_PROCESSOR MATCHES "^arm" OR - CMAKE_SYSTEM_PROCESSOR MATCHES "^aarch64") - add_definitions(-DPNG_ARM_NEON_OPT=0) -endif() - -# set definitions and sources for powerpc -if(CMAKE_SYSTEM_PROCESSOR MATCHES "^powerpc*" OR - CMAKE_SYSTEM_PROCESSOR MATCHES "^ppc64*") - add_definitions(-DPNG_POWERPC_VSX_OPT=0) -endif() - -# set definitions and sources for intel -if(CMAKE_SYSTEM_PROCESSOR MATCHES "^i?86" OR - CMAKE_SYSTEM_PROCESSOR MATCHES "^x86_64*") - add_definitions(-DPNG_INTEL_SSE_OPT=0) -endif() - -# set definitions and sources for MIPS -if(CMAKE_SYSTEM_PROCESSOR MATCHES "mipsel*" OR - CMAKE_SYSTEM_PROCESSOR MATCHES "mips64el*") - add_definitions(-DPNG_MIPS_MSA_OPT=0) -endif() - -endif(PNG_HARDWARE_OPTIMIZATIONS) - -# SET LIBNAME -set(PNG_LIB_NAME png${PNGLIB_MAJOR}${PNGLIB_MINOR}) - -# to distinguish between debug and release lib -set(CMAKE_DEBUG_POSTFIX "d") - -include(CheckCSourceCompiles) -option(ld-version-script "Enable linker version script" ON) -if(ld-version-script AND NOT APPLE) - # Check if LD supports linker scripts. - file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/conftest.map" "VERS_1 { - global: sym; - local: *; -}; - -VERS_2 { - global: sym2; - main; -} VERS_1; -") - set(CMAKE_REQUIRED_FLAGS_SAVE ${CMAKE_REQUIRED_FLAGS}) - set(CMAKE_REQUIRED_FLAGS ${CMAKE_REQUIRED_FLAGS} "-Wl,--version-script='${CMAKE_CURRENT_BINARY_DIR}/conftest.map'") - check_c_source_compiles("void sym(void) {} -void sym2(void) {} -int main(void) {return 0;} -" HAVE_LD_VERSION_SCRIPT) - if(NOT HAVE_LD_VERSION_SCRIPT) - set(CMAKE_REQUIRED_FLAGS ${CMAKE_REQUIRED_FLAGS_SAVE} "-Wl,-M -Wl,${CMAKE_CURRENT_BINARY_DIR}/conftest.map") - check_c_source_compiles("void sym(void) {} -void sym2(void) {} -int main(void) {return 0;} -" HAVE_SOLARIS_LD_VERSION_SCRIPT) - endif() - set(CMAKE_REQUIRED_FLAGS ${CMAKE_REQUIRED_FLAGS_SAVE}) - file(REMOVE "${CMAKE_CURRENT_BINARY_DIR}/conftest.map") -endif() - -# Find symbol prefix. Likely obsolete and unnecessary with recent -# toolchains (it's not done in many other projects). -function(symbol_prefix) - set(SYMBOL_PREFIX) - - execute_process(COMMAND "${CMAKE_C_COMPILER}" "-E" "-" - INPUT_FILE /dev/null - OUTPUT_VARIABLE OUT - RESULT_VARIABLE STATUS) - - if(CPP_FAIL) - message(WARNING "Failed to run the C preprocessor") - endif() - - string(REPLACE "\n" ";" OUT "${OUT}") - foreach(line ${OUT}) - string(REGEX MATCH "^PREFIX=" found_match "${line}") - if(found_match) - string(REGEX REPLACE "^PREFIX=(.*\)" "\\1" prefix "${line}") - string(REGEX MATCH "__USER_LABEL_PREFIX__" found_match "${prefix}") - if(found_match) - string(REGEX REPLACE "(.*)__USER_LABEL_PREFIX__(.*)" "\\1\\2" prefix "${prefix}") - endif() - set(SYMBOL_PREFIX "${prefix}") - endif() - endforeach() - - message(STATUS "Symbol prefix: ${SYMBOL_PREFIX}") - set(SYMBOL_PREFIX "${SYMBOL_PREFIX}" PARENT_SCOPE) -endfunction() - -if(UNIX) - symbol_prefix() -endif() - -find_program(AWK NAMES gawk awk) - -include_directories(${CMAKE_CURRENT_BINARY_DIR}) - -if(NOT AWK OR ANDROID) - # No awk available to generate sources; use pre-built pnglibconf.h - configure_file(${CMAKE_CURRENT_SOURCE_DIR}/scripts/pnglibconf.h.prebuilt - ${CMAKE_CURRENT_BINARY_DIR}/pnglibconf.h) - add_custom_target(genfiles) # Dummy -else() - include(CMakeParseArguments) - # Generate .chk from .out with awk - # generate_chk(INPUT inputfile OUTPUT outputfile [DEPENDS dep1 [dep2...]]) - function(generate_chk) - set(options) - set(oneValueArgs INPUT OUTPUT) - set(multiValueArgs DEPENDS) - cmake_parse_arguments(_GC "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN}) - if(NOT _GC_INPUT) - message(FATAL_ERROR "generate_chk: Missing INPUT argument") - endif() - if(NOT _GC_OUTPUT) - message(FATAL_ERROR "generate_chk: Missing OUTPUT argument") - endif() - - add_custom_command(OUTPUT "${_GC_OUTPUT}" - COMMAND "${CMAKE_COMMAND}" - "-DINPUT=${_GC_INPUT}" - "-DOUTPUT=${_GC_OUTPUT}" - -P "${CMAKE_CURRENT_BINARY_DIR}/scripts/genchk.cmake" - DEPENDS "${_GC_INPUT}" ${_GC_DEPENDS} - WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}") - endfunction() - - # Generate .out from .c with awk - # generate_out(INPUT inputfile OUTPUT outputfile [DEPENDS dep1 [dep2...]]) - function(generate_out) - set(options) - set(oneValueArgs INPUT OUTPUT) - set(multiValueArgs DEPENDS) - cmake_parse_arguments(_GO "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN}) - if(NOT _GO_INPUT) - message(FATAL_ERROR "generate_out: Missing INPUT argument") - endif() - if(NOT _GO_OUTPUT) - message(FATAL_ERROR "generate_out: Missing OUTPUT argument") - endif() - - add_custom_command(OUTPUT "${_GO_OUTPUT}" - COMMAND "${CMAKE_COMMAND}" - "-DINPUT=${_GO_INPUT}" - "-DOUTPUT=${_GO_OUTPUT}" - -P "${CMAKE_CURRENT_BINARY_DIR}/scripts/genout.cmake" - DEPENDS "${_GO_INPUT}" ${_GO_DEPENDS} - WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}") - endfunction() - - # Generate specific source file with awk - # generate_source(OUTPUT outputfile [DEPENDS dep1 [dep2...]]) - function(generate_source) - set(options) - set(oneValueArgs OUTPUT) - set(multiValueArgs DEPENDS) - cmake_parse_arguments(_GSO "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN}) - if(NOT _GSO_OUTPUT) - message(FATAL_ERROR "generate_source: Missing OUTPUT argument") - endif() - - add_custom_command(OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/${_GSO_OUTPUT}" - COMMAND "${CMAKE_COMMAND}" - "-DOUTPUT=${_GSO_OUTPUT}" - -P "${CMAKE_CURRENT_BINARY_DIR}/scripts/gensrc.cmake" - DEPENDS ${_GSO_DEPENDS} - WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}") - endfunction() - - # Copy file - function(generate_copy source destination) - add_custom_command(OUTPUT "${destination}" - COMMAND "${CMAKE_COMMAND}" -E remove "${destination}" - COMMAND "${CMAKE_COMMAND}" -E copy "${source}" - "${destination}" - DEPENDS "${source}") - endfunction() - - # Generate scripts/pnglibconf.h - generate_source(OUTPUT "scripts/pnglibconf.c" - DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/scripts/pnglibconf.dfa" - "${CMAKE_CURRENT_SOURCE_DIR}/scripts/options.awk" - "${CMAKE_CURRENT_SOURCE_DIR}/pngconf.h") - - # Generate pnglibconf.c - generate_source(OUTPUT "pnglibconf.c" - DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/scripts/pnglibconf.dfa" - "${CMAKE_CURRENT_SOURCE_DIR}/scripts/options.awk" - "${CMAKE_CURRENT_SOURCE_DIR}/pngconf.h") - - if(PNG_PREFIX) - set(PNGLIBCONF_H_EXTRA_DEPENDS - "${CMAKE_CURRENT_BINARY_DIR}/scripts/prefix.out" - "${CMAKE_CURRENT_SOURCE_DIR}/scripts/macro.lst") - set(PNGPREFIX_H_EXTRA_DEPENDS - "${CMAKE_CURRENT_BINARY_DIR}/scripts/intprefix.out") - endif() - - generate_out(INPUT "${CMAKE_CURRENT_BINARY_DIR}/pnglibconf.c" - OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/pnglibconf.out") - - # Generate pnglibconf.h - generate_source(OUTPUT "pnglibconf.h" - DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/pnglibconf.out" - ${PNGLIBCONF_H_EXTRA_DEPENDS}) - - generate_out(INPUT "${CMAKE_CURRENT_SOURCE_DIR}/scripts/intprefix.c" - OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/scripts/intprefix.out" - DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/pnglibconf.h") - - generate_out(INPUT "${CMAKE_CURRENT_SOURCE_DIR}/scripts/prefix.c" - OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/scripts/prefix.out" - DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/png.h" - "${CMAKE_CURRENT_SOURCE_DIR}/pngconf.h" - "${CMAKE_CURRENT_BINARY_DIR}/pnglibconf.out") - - # Generate pngprefix.h - generate_source(OUTPUT "pngprefix.h" - DEPENDS ${PNGPREFIX_H_EXTRA_DEPENDS}) - - generate_out(INPUT "${CMAKE_CURRENT_SOURCE_DIR}/scripts/sym.c" - OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/scripts/sym.out" - DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/pnglibconf.h") - - generate_out(INPUT "${CMAKE_CURRENT_SOURCE_DIR}/scripts/symbols.c" - OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/scripts/symbols.out" - DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/png.h" - "${CMAKE_CURRENT_SOURCE_DIR}/pngconf.h" - "${CMAKE_CURRENT_SOURCE_DIR}/scripts/pnglibconf.h.prebuilt") - - generate_out(INPUT "${CMAKE_CURRENT_SOURCE_DIR}/scripts/vers.c" - OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/scripts/vers.out" - DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/png.h" - "${CMAKE_CURRENT_SOURCE_DIR}/pngconf.h" - "${CMAKE_CURRENT_BINARY_DIR}/pnglibconf.h") - - generate_chk(INPUT "${CMAKE_CURRENT_BINARY_DIR}/scripts/symbols.out" - OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/scripts/symbols.chk" - DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/scripts/checksym.awk" - "${CMAKE_CURRENT_SOURCE_DIR}/scripts/symbols.def") - - add_custom_target(symbol-check DEPENDS - "${CMAKE_CURRENT_BINARY_DIR}/scripts/symbols.chk") - - generate_copy("${CMAKE_CURRENT_BINARY_DIR}/scripts/sym.out" - "${CMAKE_CURRENT_BINARY_DIR}/libpng.sym") - generate_copy("${CMAKE_CURRENT_BINARY_DIR}/scripts/vers.out" - "${CMAKE_CURRENT_BINARY_DIR}/libpng.vers") - - add_custom_target(genvers DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/libpng.vers") - add_custom_target(gensym DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/libpng.sym") - - add_custom_target("genprebuilt" - COMMAND "${CMAKE_COMMAND}" - "-DOUTPUT=scripts/pnglibconf.h.prebuilt" - -P "${CMAKE_CURRENT_BINARY_DIR}/scripts/gensrc.cmake" - WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}") - - # A single target handles generation of all generated files. If - # they are depended upon separately by multiple targets, this - # confuses parallel make (it would require a separate top-level - # target for each file to track the dependencies properly). - add_custom_target(genfiles DEPENDS - "${CMAKE_CURRENT_BINARY_DIR}/libpng.sym" - "${CMAKE_CURRENT_BINARY_DIR}/libpng.vers" - "${CMAKE_CURRENT_BINARY_DIR}/pnglibconf.c" - "${CMAKE_CURRENT_BINARY_DIR}/pnglibconf.h" - "${CMAKE_CURRENT_BINARY_DIR}/pnglibconf.out" - "${CMAKE_CURRENT_BINARY_DIR}/pngprefix.h" - "${CMAKE_CURRENT_BINARY_DIR}/scripts/intprefix.out" - "${CMAKE_CURRENT_BINARY_DIR}/scripts/pnglibconf.c" - "${CMAKE_CURRENT_BINARY_DIR}/scripts/prefix.out" - "${CMAKE_CURRENT_BINARY_DIR}/scripts/sym.out" - "${CMAKE_CURRENT_BINARY_DIR}/scripts/symbols.chk" - "${CMAKE_CURRENT_BINARY_DIR}/scripts/symbols.out" - "${CMAKE_CURRENT_BINARY_DIR}/scripts/vers.out") -endif(NOT AWK OR ANDROID) - -# OUR SOURCES -set(libpng_public_hdrs - png.h - pngconf.h - "${CMAKE_CURRENT_BINARY_DIR}/pnglibconf.h" -) -set(libpng_private_hdrs - pngpriv.h - pngdebug.h - pnginfo.h - pngstruct.h -) -if(AWK AND NOT ANDROID) - list(APPEND libpng_private_hdrs "${CMAKE_CURRENT_BINARY_DIR}/pngprefix.h") -endif() -set(libpng_sources - ${libpng_public_hdrs} - ${libpng_private_hdrs} - png.c - pngerror.c - pngget.c - pngmem.c - pngpread.c - pngread.c - pngrio.c - pngrtran.c - pngrutil.c - pngset.c - pngtrans.c - pngwio.c - pngwrite.c - pngwtran.c - pngwutil.c - ${libpng_arm_sources} - ${libpng_intel_sources} - ${libpng_mips_sources} - ${libpng_powerpc_sources} -) -set(pngtest_sources - pngtest.c -) -set(pngvalid_sources - contrib/libtests/pngvalid.c -) -set(pngstest_sources - contrib/libtests/pngstest.c -) -set(pngunknown_sources - contrib/libtests/pngunknown.c -) -set(pngimage_sources - contrib/libtests/pngimage.c -) -set(pngfix_sources - contrib/tools/pngfix.c -) -set(png_fix_itxt_sources - contrib/tools/png-fix-itxt.c -) - -if(MSVC) - add_definitions(-D_CRT_SECURE_NO_DEPRECATE) -endif() - -if(PNG_DEBUG) - add_definitions(-DPNG_DEBUG) -endif() - -# NOW BUILD OUR TARGET -include_directories(${CMAKE_CURRENT_SOURCE_DIR} ${ZLIB_INCLUDE_DIR}) - -unset(PNG_LIB_TARGETS) - -if(PNG_STATIC) - # does not work without changing name - set(PNG_LIB_NAME_STATIC png_static) - add_library(png_static STATIC ${libpng_sources}) - add_dependencies(png_static genfiles) - # MSVC doesn't use a different file extension for shared vs. static - # libs. We are able to change OUTPUT_NAME to remove the _static - # for all other platforms. - if(NOT MSVC) - set_target_properties(png_static PROPERTIES - OUTPUT_NAME "${PNG_LIB_NAME}" - CLEAN_DIRECT_OUTPUT 1) - else() - set_target_properties(png_static PROPERTIES - OUTPUT_NAME "${PNG_LIB_NAME}_static" - CLEAN_DIRECT_OUTPUT 1) - endif() - list(APPEND PNG_LIB_TARGETS png_static) - if(MSVC) - # msvc does not append 'lib' - do it here to have consistent name - set_target_properties(png_static PROPERTIES PREFIX "lib") - endif() - target_link_libraries(png_static ${M_LIBRARY}) -endif() - -if(NOT PNG_LIB_TARGETS) - message(SEND_ERROR - "No library variant selected to build. " - "Please enable at least one of the following options: " - "PNG_STATIC, PNG_SHARED, PNG_FRAMEWORK") -endif() - -# Set a variable with CMake code which: -# Creates a symlink from src to dest (if possible) or alternatively -# copies if different. -include(CMakeParseArguments) - -function(create_symlink DEST_FILE) - - cmake_parse_arguments(S "" "FILE;TARGET" "" ${ARGN}) - - if(NOT S_TARGET AND NOT S_FILE) - message(FATAL_ERROR "create_symlink: Missing TARGET or FILE argument") - endif() - - if(S_TARGET AND S_FILE) - message(FATAL_ERROR "create_symlink: Both source file ${S_FILE} and build target ${S_TARGET} arguments are present; can only have one.") - endif() - - if(S_FILE) - # If we don't need to symlink something that's coming from a build target, - # we can go ahead and symlink/copy at configure time. - if(CMAKE_HOST_WIN32 AND NOT CYGWIN) - execute_process( - COMMAND "${CMAKE_COMMAND}" -E copy_if_different ${S_FILE} ${DEST_FILE} - WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}") - else() - execute_process( - COMMAND ${CMAKE_COMMAND} -E create_symlink ${S_FILE} ${DEST_FILE} - WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}") - endif() - endif() - - if(S_TARGET) - # We need to use generator expressions, which can be a bit tricky, so for - # simplicity make the symlink a POST_BUILD step and use the TARGET - # signature of add_custom_command. - if(CMAKE_HOST_WIN32 AND NOT CYGWIN) - add_custom_command(TARGET ${S_TARGET} POST_BUILD - COMMAND "${CMAKE_COMMAND}" -E copy_if_different $ $/${DEST_FILE}) - else() - add_custom_command(TARGET ${S_TARGET} POST_BUILD - COMMAND "${CMAKE_COMMAND}" -E create_symlink $ $/${DEST_FILE}) - endif() - endif() - -endfunction() - -# Create source generation scripts. -configure_file(${CMAKE_CURRENT_SOURCE_DIR}/scripts/genchk.cmake.in - ${CMAKE_CURRENT_BINARY_DIR}/scripts/genchk.cmake @ONLY) -configure_file(${CMAKE_CURRENT_SOURCE_DIR}/scripts/genout.cmake.in - ${CMAKE_CURRENT_BINARY_DIR}/scripts/genout.cmake @ONLY) -configure_file(${CMAKE_CURRENT_SOURCE_DIR}/scripts/gensrc.cmake.in - ${CMAKE_CURRENT_BINARY_DIR}/scripts/gensrc.cmake @ONLY) - -# libpng is a library so default to 'lib' -if(NOT DEFINED CMAKE_INSTALL_LIBDIR) - set(CMAKE_INSTALL_LIBDIR lib) -endif() - -# CREATE PKGCONFIG FILES -# We use the same files like ./configure, so we have to set its vars. -# Only do this on Windows for Cygwin - the files don't make much sense outside -# of a UNIX look-alike. -if(NOT WIN32 OR CYGWIN OR MINGW) - set(prefix ${CMAKE_INSTALL_PREFIX}) - set(exec_prefix ${CMAKE_INSTALL_PREFIX}) - set(libdir ${CMAKE_INSTALL_FULL_LIBDIR}) - set(includedir ${CMAKE_INSTALL_FULL_INCLUDEDIR}) - set(LIBS "-lz -lm") - configure_file(${CMAKE_CURRENT_SOURCE_DIR}/libpng.pc.in - ${CMAKE_CURRENT_BINARY_DIR}/${PNGLIB_NAME}.pc @ONLY) - create_symlink(libpng.pc FILE ${PNGLIB_NAME}.pc) - - configure_file(${CMAKE_CURRENT_SOURCE_DIR}/libpng-config.in - ${CMAKE_CURRENT_BINARY_DIR}/${PNGLIB_NAME}-config @ONLY) - create_symlink(libpng-config FILE ${PNGLIB_NAME}-config) -endif() - -# SET UP LINKS -if(PNG_SHARED) - set_target_properties(png PROPERTIES -# VERSION 16.${PNGLIB_RELEASE}.1.6.37 - VERSION 16.${PNGLIB_RELEASE}.0 - SOVERSION 16 - CLEAN_DIRECT_OUTPUT 1) -endif() - -# INSTALL -if(NOT SKIP_INSTALL_LIBRARIES AND NOT SKIP_INSTALL_ALL) - install(TARGETS ${PNG_LIB_TARGETS} - EXPORT libpng - RUNTIME DESTINATION bin - LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} - ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} - FRAMEWORK DESTINATION ${CMAKE_INSTALL_LIBDIR}) - - if(PNG_SHARED) - # Create a symlink for libpng.dll.a => libpng16.dll.a on Cygwin - if(CYGWIN OR MINGW) - create_symlink(libpng${CMAKE_IMPORT_LIBRARY_SUFFIX} TARGET png) - install(FILES $/libpng${CMAKE_IMPORT_LIBRARY_SUFFIX} - DESTINATION ${CMAKE_INSTALL_LIBDIR}) - endif() - - if(NOT WIN32) - create_symlink(libpng${CMAKE_SHARED_LIBRARY_SUFFIX} TARGET png) - install(FILES $/libpng${CMAKE_SHARED_LIBRARY_SUFFIX} - DESTINATION ${CMAKE_INSTALL_LIBDIR}) - endif() - endif() - - if(PNG_STATIC) - if(NOT WIN32 OR CYGWIN OR MINGW) - create_symlink(libpng${CMAKE_STATIC_LIBRARY_SUFFIX} TARGET png_static) - install(FILES $/libpng${CMAKE_STATIC_LIBRARY_SUFFIX} - DESTINATION ${CMAKE_INSTALL_LIBDIR}) - endif() - endif() -endif() - -if(NOT SKIP_INSTALL_HEADERS AND NOT SKIP_INSTALL_ALL) - install(FILES ${libpng_public_hdrs} DESTINATION include) - install(FILES ${libpng_public_hdrs} DESTINATION include/${PNGLIB_NAME}) -endif() -if(NOT SKIP_INSTALL_EXECUTABLES AND NOT SKIP_INSTALL_ALL) - if(NOT WIN32 OR CYGWIN OR MINGW) - install(PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/libpng-config DESTINATION bin) - install(PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/${PNGLIB_NAME}-config DESTINATION bin) - endif() -endif() - -if(NOT SKIP_INSTALL_PROGRAMS AND NOT SKIP_INSTALL_ALL) - install(TARGETS ${PNG_BIN_TARGETS} - RUNTIME DESTINATION bin) -endif() - -if(NOT SKIP_INSTALL_FILES AND NOT SKIP_INSTALL_ALL) - # Install man pages - if(NOT PNG_MAN_DIR) - set(PNG_MAN_DIR "share/man") - endif() - install(FILES libpng.3 libpngpf.3 DESTINATION ${PNG_MAN_DIR}/man3) - install(FILES png.5 DESTINATION ${PNG_MAN_DIR}/man5) - # Install pkg-config files - if(NOT CMAKE_HOST_WIN32 OR CYGWIN OR MINGW) - install(FILES ${CMAKE_CURRENT_BINARY_DIR}/libpng.pc - DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig) - install(PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/libpng-config - DESTINATION bin) - install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${PNGLIB_NAME}.pc - DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig) - install(PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/${PNGLIB_NAME}-config - DESTINATION bin) - endif() -endif() - -# Create an export file that CMake users can include() to import our targets. -if(NOT SKIP_INSTALL_EXPORT AND NOT SKIP_INSTALL_ALL) - install(EXPORT libpng DESTINATION lib/libpng FILE lib${PNG_LIB_NAME}.cmake) -endif() - -# what's with libpng-manual.txt and all the extra files? - -# UNINSTALL -# do we need this? - -# DIST -# do we need this? - -# to create msvc import lib for mingw compiled shared lib -# pexports libpng.dll > libpng.def -# lib /def:libpng.def /machine:x86 diff --git a/cmake/CMakeLists.zlib b/cmake/CMakeLists.zlib deleted file mode 100644 index a33f14ce64..0000000000 --- a/cmake/CMakeLists.zlib +++ /dev/null @@ -1,195 +0,0 @@ -cmake_minimum_required(VERSION 3.10) -# When using CMake 3.4 and later, don't export symbols from executables unless -# the CMAKE_ENABLE_EXPORTS variable is set. -if(POLICY CMP0065) - cmake_policy(SET CMP0065 NEW) -endif() -if (POLICY CMP0077) - cmake_policy(SET CMP0077 NEW) -endif() -set(CMAKE_ALLOW_LOOSE_LOOP_CONSTRUCTS ON) - -project(zlib C) - -set(VERSION "1.2.11") - -option(ASM686 "Enable building i686 assembly implementation" OFF) -option(AMD64 "Enable building amd64 assembly implementation" OFF) - -set(INSTALL_BIN_DIR "${CMAKE_INSTALL_PREFIX}/bin" CACHE PATH "Installation directory for executables") -set(INSTALL_LIB_DIR "${CMAKE_INSTALL_PREFIX}/lib" CACHE PATH "Installation directory for libraries") -set(INSTALL_INC_DIR "${CMAKE_INSTALL_PREFIX}/include" CACHE PATH "Installation directory for headers") -set(INSTALL_MAN_DIR "${CMAKE_INSTALL_PREFIX}/share/man" CACHE PATH "Installation directory for manual pages") -set(INSTALL_PKGCONFIG_DIR "${CMAKE_INSTALL_PREFIX}/share/pkgconfig" CACHE PATH "Installation directory for pkgconfig (.pc) files") - -include(CheckTypeSize) -include(CheckFunctionExists) -include(CheckIncludeFile) -include(CheckCSourceCompiles) - -check_include_file(sys/types.h HAVE_SYS_TYPES_H) -check_include_file(stdint.h HAVE_STDINT_H) -check_include_file(stddef.h HAVE_STDDEF_H) - -# -# Check to see if we have large file support -# -set(CMAKE_REQUIRED_DEFINITIONS -D_LARGEFILE64_SOURCE=1) -# We add these other definitions here because CheckTypeSize.cmake -# in CMake 2.4.x does not automatically do so and we want -# compatibility with CMake 2.4.x. -if(HAVE_SYS_TYPES_H) - list(APPEND CMAKE_REQUIRED_DEFINITIONS -DHAVE_SYS_TYPES_H) -endif() -if(HAVE_STDINT_H) - list(APPEND CMAKE_REQUIRED_DEFINITIONS -DHAVE_STDINT_H) -endif() -if(HAVE_STDDEF_H) - list(APPEND CMAKE_REQUIRED_DEFINITIONS -DHAVE_STDDEF_H) -endif() -check_type_size(off64_t OFF64_T) -check_type_size(off64_t OFF64_T) -if(HAVE_OFF64_T) - add_definitions(-D_LARGEFILE64_SOURCE=1) -endif() -set(CMAKE_REQUIRED_DEFINITIONS) # clear variable - -# -# Check for fseeko -# -check_function_exists(fseeko HAVE_FSEEKO) -if(NOT HAVE_FSEEKO) - add_definitions(-DNO_FSEEKO) -endif() - -# -# Check for unistd.h -# -check_include_file(unistd.h Z_HAVE_UNISTD_H) - -if(MSVC) - set(CMAKE_DEBUG_POSTFIX "d") - add_definitions(-D_CRT_SECURE_NO_DEPRECATE) - add_definitions(-D_CRT_NONSTDC_NO_DEPRECATE) - include_directories(${CMAKE_CURRENT_SOURCE_DIR}) -endif() - -if(NOT CMAKE_CURRENT_SOURCE_DIR STREQUAL CMAKE_CURRENT_BINARY_DIR) - # If we're doing an out of source build and the user has a zconf.h - # in their source tree... - if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/zconf.h) - file(RENAME ${CMAKE_CURRENT_SOURCE_DIR}/zconf.h ${CMAKE_CURRENT_SOURCE_DIR}/zconf.h.included) - endif() -endif() - -set(ZLIB_PC ${CMAKE_CURRENT_BINARY_DIR}/zlib.pc) -configure_file( ${CMAKE_CURRENT_SOURCE_DIR}/zlib.pc.cmakein - ${ZLIB_PC} @ONLY) -configure_file( ${CMAKE_CURRENT_SOURCE_DIR}/zconf.h.cmakein - ${CMAKE_CURRENT_BINARY_DIR}/zconf.h @ONLY) -include_directories(${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_SOURCE_DIR}) - - -#============================================================================ -# zlib -#============================================================================ - -set(ZLIB_PUBLIC_HDRS - ${CMAKE_CURRENT_BINARY_DIR}/zconf.h - zlib.h -) -set(ZLIB_PRIVATE_HDRS - crc32.h - deflate.h - gzguts.h - inffast.h - inffixed.h - inflate.h - inftrees.h - trees.h - zutil.h -) -set(ZLIB_SRCS - adler32.c - compress.c - crc32.c - deflate.c - gzclose.c - gzlib.c - gzread.c - gzwrite.c - inflate.c - infback.c - inftrees.c - inffast.c - trees.c - uncompr.c - zutil.c -) - -if(NOT MINGW) - set(ZLIB_DLL_SRCS - win32/zlib1.rc # If present will override custom build rule below. - ) -endif() - -if(CMAKE_COMPILER_IS_GNUCC) - if(ASM686) - set(ZLIB_ASMS contrib/asm686/match.S) - elseif (AMD64) - set(ZLIB_ASMS contrib/amd64/amd64-match.S) - endif () - - if(ZLIB_ASMS) - add_definitions(-DASMV) - set_source_files_properties(${ZLIB_ASMS} PROPERTIES LANGUAGE C COMPILE_FLAGS -DNO_UNDERLINE) - endif() -endif() - -if(MSVC) - if(ASM686) - ENABLE_LANGUAGE(ASM_MASM) - set(ZLIB_ASMS - contrib/masmx86/inffas32.asm - contrib/masmx86/match686.asm - ) - elseif (AMD64) - ENABLE_LANGUAGE(ASM_MASM) - set(ZLIB_ASMS - contrib/masmx64/gvmat64.asm - contrib/masmx64/inffasx64.asm - ) - endif() - - if(ZLIB_ASMS) - add_definitions(-DASMV -DASMINF) - endif() -endif() - -# parse the full version number from zlib.h and include in ZLIB_FULL_VERSION -file(READ ${CMAKE_CURRENT_SOURCE_DIR}/zlib.h _zlib_h_contents) -string(REGEX REPLACE ".*#define[ \t]+ZLIB_VERSION[ \t]+\"([-0-9A-Za-z.]+)\".*" - "\\1" ZLIB_FULL_VERSION ${_zlib_h_contents}) - -if(MINGW) - # This gets us DLL resource information when compiling on MinGW. - if(NOT CMAKE_RC_COMPILER) - set(CMAKE_RC_COMPILER windres.exe) - endif() - - add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/zlib1rc.obj - COMMAND ${CMAKE_RC_COMPILER} - -D GCC_WINDRES - -I ${CMAKE_CURRENT_SOURCE_DIR} - -I ${CMAKE_CURRENT_BINARY_DIR} - -o ${CMAKE_CURRENT_BINARY_DIR}/zlib1rc.obj - -i ${CMAKE_CURRENT_SOURCE_DIR}/win32/zlib1.rc) - set(ZLIB_DLL_SRCS ${CMAKE_CURRENT_BINARY_DIR}/zlib1rc.obj) -endif(MINGW) - -add_library(zlibstatic STATIC ${ZLIB_SRCS} ${ZLIB_ASMS} ${ZLIB_PUBLIC_HDRS} ${ZLIB_PRIVATE_HDRS}) - -if(UNIX) - # On unix-like platforms the library is almost always called libz - set_target_properties(zlibstatic PROPERTIES OUTPUT_NAME z) -endif() \ No newline at end of file From d23cebf9f16908ba8d7a587f203570b7ce90b44a Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Mon, 3 Jul 2023 09:53:59 -0400 Subject: [PATCH 334/396] must copy wheel to olddir when -w flag is not given --- python/install.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/python/install.py b/python/install.py index 25784791b4..853479e9f6 100644 --- a/python/install.py +++ b/python/install.py @@ -11,7 +11,7 @@ independently and used to build the wheel without installing it. """ from __future__ import print_function -import sys,os,shutil,glob,subprocess +import sys, os, shutil, glob, subprocess from argparse import ArgumentParser parser = ArgumentParser(prog='install.py', @@ -105,12 +105,12 @@ os.system(sys.executable + ' makewheel.py') for wheel in glob.glob('lammps-*.whl'): if args.wheeldir: shutil.copy(wheel, args.wheeldir) - -print('wheel = ', wheel) + else: + shutil.copy(wheel, olddir) # remove temporary folders and files os.chdir(olddir) -shutil.rmtree('build-python',True) +shutil.rmtree('build-python', True) # stop here if we were asked not to install the wheel we created if args.noinstall: From 268faf935b050097cf873f1e233c9405998466b6 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Mon, 3 Jul 2023 10:32:24 -0400 Subject: [PATCH 335/396] avoid overeager flagging of errors for arguments to derived classes --- src/dump_custom.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/dump_custom.cpp b/src/dump_custom.cpp index bdbc8ec185..dba72c7478 100644 --- a/src/dump_custom.cpp +++ b/src/dump_custom.cpp @@ -1464,10 +1464,14 @@ int DumpCustom::parse_fields(int narg, char **arg) switch (argi.get_type()) { case ArgInfo::UNKNOWN: - case ArgInfo::NONE: error->all(FLERR,"Invalid attribute {} in dump {} command",arg[iarg],style); break; + case ArgInfo::NONE: + // ignore because this may be a valid argument for a derived dump style class + return iarg; + break; + // compute value = c_ID // if no trailing [], then arg is set to 0, else arg is int between [] From 677ff15740c5e993b2a8305d173c1f34db3d75b3 Mon Sep 17 00:00:00 2001 From: "Dan S. Bolintineanu" Date: Mon, 3 Jul 2023 11:52:41 -0600 Subject: [PATCH 336/396] Gran/heat changes --- doc/src/pair_granular.rst | 31 +++++++++++++++++++++++----- src/GRANULAR/fix_heat_flow.cpp | 20 ++++++++---------- src/GRANULAR/gran_sub_mod_heat.cpp | 33 +++++++++++++++++++++++++++--- src/GRANULAR/gran_sub_mod_heat.h | 15 +++++++++++++- 4 files changed, 79 insertions(+), 20 deletions(-) diff --git a/doc/src/pair_granular.rst b/doc/src/pair_granular.rst index 37ff8fcbfe..fb5d5c6338 100644 --- a/doc/src/pair_granular.rst +++ b/doc/src/pair_granular.rst @@ -641,22 +641,36 @@ The optional *heat* keyword enables heat conduction. The options currently supported are: 1. *none* -2. *area* : :math:`k_{s}` +2. *radius* : :math:`k_{s}` +3. *area* : :math:`h_{s}` If the *heat* keyword is not specified, the model defaults to *none*. +For *heat* *radius*, the heat +:math:`Q` conducted between two particles is given by + +.. math:: + + Q = 2 k_{s} a \Delta T + +where :math:`\Delta T` is the difference in the two particles' temperature, +:math:`k_{s}` is a non-negative numeric value for the conductivity (in units +of power/(length*temperature)), and :math:`a` is the radius of the contact and +depends on the normal force model. This is the model proposed by +:ref:`Vargas and McCarthy ` + For *heat* *area*, the heat :math:`Q` conducted between two particles is given by .. math:: - Q = k_{s} A \Delta T - + Q = h_{s} A \Delta T where :math:`\Delta T` is the difference in the two particles' temperature, -:math:`k_{s}` is a non-negative numeric value for the conductivity, and -:math:`A` is the area of the contact and depends on the normal force model. +:math:`h_{s}` is a non-negative numeric value for the heat transfer +coefficient (in units of power/(area*temperature)), and :math:`A=\pi a^2` is +the area of the contact and depends on the normal force model. Note that the option *none* must either be used in all or none of of the *pair_coeff* calls. See :doc:`fix heat/flow ` and @@ -894,3 +908,10 @@ J. Appl. Mech., ASME 20, 327-344. **(Agnolin and Roux 2007)** Agnolin, I. & Roux, J-N. (2007). Internal states of model isotropic granular packings. I. Assembling process, geometry, and contact networks. Phys. Rev. E, 76, 061302. + +.. _VargasMcCarthy2001: + +**(Vargas and McCarthy 2001)** Vargas, W.L. and McCarthy, J.J. (2001). +Heat conduction in granular materials. +AIChE Journal, 47(5), 1052-1059. + diff --git a/src/GRANULAR/fix_heat_flow.cpp b/src/GRANULAR/fix_heat_flow.cpp index a9c110a2e7..16f7755d44 100644 --- a/src/GRANULAR/fix_heat_flow.cpp +++ b/src/GRANULAR/fix_heat_flow.cpp @@ -89,23 +89,21 @@ void FixHeatFlow::init() void FixHeatFlow::setup(int /*vflag*/) { - // Identify whether this is the first instance of fix heat/flow - first_flag = 0; - - int i = 0; - auto fixlist = modify->get_fix_by_style("heat/flow"); - for (const auto &ifix : fixlist) { - if (strcmp(ifix->id, id) == 0) break; - i++; - } - - if (i == 0) first_flag = 1; } /* ---------------------------------------------------------------------- */ void FixHeatFlow::setup_pre_force(int /*vflag*/) { + // Identify whether this is the first instance of fix heat/flow + first_flag = 0; + int i = 0; + auto fixlist = modify->get_fix_by_style("heat/flow"); + for (const auto &ifix : fixlist) { + if (strcmp(ifix->id, id) == 0) break; + i++; + } + if (i == 0) first_flag = 1; pre_force(0); } diff --git a/src/GRANULAR/gran_sub_mod_heat.cpp b/src/GRANULAR/gran_sub_mod_heat.cpp index 75dcd30b73..dc6d50f7ec 100644 --- a/src/GRANULAR/gran_sub_mod_heat.cpp +++ b/src/GRANULAR/gran_sub_mod_heat.cpp @@ -41,6 +41,33 @@ double GranSubModHeatNone::calculate_heat() return 0.0; } +/* ---------------------------------------------------------------------- + Radius-based heat conduction +------------------------------------------------------------------------- */ + +GranSubModHeatRadius::GranSubModHeatRadius(GranularModel *gm, LAMMPS *lmp) : GranSubModHeat(gm, lmp) +{ + num_coeffs = 1; + contact_radius_flag = 1; +} + +/* ---------------------------------------------------------------------- */ + +void GranSubModHeatRadius::coeffs_to_local() +{ + conductivity = coeffs[0]; + + if (conductivity < 0.0) error->all(FLERR, "Illegal radius heat model"); +} + +/* ---------------------------------------------------------------------- */ + +double GranSubModHeatRadius::calculate_heat() +{ + return 2 * conductivity * gm->contact_radius * (gm->Tj - gm->Ti); +} + + /* ---------------------------------------------------------------------- Area-based heat conduction ------------------------------------------------------------------------- */ @@ -55,14 +82,14 @@ GranSubModHeatArea::GranSubModHeatArea(GranularModel *gm, LAMMPS *lmp) : GranSub void GranSubModHeatArea::coeffs_to_local() { - conductivity = coeffs[0]; + heat_transfer_coeff = coeffs[0]; - if (conductivity < 0.0) error->all(FLERR, "Illegal area heat model"); + if (heat_transfer_coeff < 0.0) error->all(FLERR, "Illegal area heat model"); } /* ---------------------------------------------------------------------- */ double GranSubModHeatArea::calculate_heat() { - return conductivity * MY_PI * gm->contact_radius * gm->contact_radius * (gm->Tj - gm->Ti); + return heat_transfer_coeff * MY_PI * gm->contact_radius * gm->contact_radius * (gm->Tj - gm->Ti); } diff --git a/src/GRANULAR/gran_sub_mod_heat.h b/src/GRANULAR/gran_sub_mod_heat.h index 8e5dc2693d..1098a0aa78 100644 --- a/src/GRANULAR/gran_sub_mod_heat.h +++ b/src/GRANULAR/gran_sub_mod_heat.h @@ -14,6 +14,7 @@ #ifdef GRAN_SUB_MOD_CLASS // clang-format off GranSubModStyle(none,GranSubModHeatNone,HEAT); +GranSubModStyle(radius,GranSubModHeatRadius,HEAT); GranSubModStyle(area,GranSubModHeatArea,HEAT); // clang-format on #else @@ -39,6 +40,18 @@ namespace Granular_NS { GranSubModHeatNone(class GranularModel *, class LAMMPS *); double calculate_heat() override; }; + + /* ---------------------------------------------------------------------- */ + + class GranSubModHeatRadius : public GranSubModHeat { + public: + GranSubModHeatRadius(class GranularModel *, class LAMMPS *); + void coeffs_to_local() override; + double calculate_heat() override; + + protected: + double conductivity; + }; /* ---------------------------------------------------------------------- */ @@ -49,7 +62,7 @@ namespace Granular_NS { double calculate_heat() override; protected: - double conductivity; + double heat_transfer_coeff; }; } // namespace Granular_NS From 9dd5ceaf4eee1a81bdd824952368dddcdef2a491 Mon Sep 17 00:00:00 2001 From: Stan Gerald Moore Date: Mon, 3 Jul 2023 15:06:23 -0600 Subject: [PATCH 337/396] Kokkos Makefiles --- ...le.spock_kokkos => Makefile.aurora_kokkos} | 25 ++++++++----------- ...rusher_kokkos => Makefile.frontier_kokkos} | 4 +-- 2 files changed, 11 insertions(+), 18 deletions(-) rename src/MAKE/MACHINES/{Makefile.spock_kokkos => Makefile.aurora_kokkos} (82%) rename src/MAKE/MACHINES/{Makefile.crusher_kokkos => Makefile.frontier_kokkos} (94%) diff --git a/src/MAKE/MACHINES/Makefile.spock_kokkos b/src/MAKE/MACHINES/Makefile.aurora_kokkos similarity index 82% rename from src/MAKE/MACHINES/Makefile.spock_kokkos rename to src/MAKE/MACHINES/Makefile.aurora_kokkos index 8f7e5bd63d..a263d4cb8c 100644 --- a/src/MAKE/MACHINES/Makefile.spock_kokkos +++ b/src/MAKE/MACHINES/Makefile.aurora_kokkos @@ -1,4 +1,4 @@ -# spock_kokkos = KOKKOS/HIP, AMD MI100 GPU and AMD EPYC 7662 "Rome" CPU, Cray MPICH, hipcc compiler, hipFFT +# aurora_kokkos = KOKKOS/SYCL, Intel Data Center Max (Ponte Vecchio) GPU, Intel Sapphire Rapids CPU, mpicxx compiler SHELL = /bin/sh @@ -6,14 +6,12 @@ SHELL = /bin/sh # compiler/linker settings # specify flags and libraries needed for your compiler -KOKKOS_ABSOLUTE_PATH = $(shell cd $(KOKKOS_PATH); pwd) - -CC = hipcc -CCFLAGS = -g -O3 -DNDEBUG -DKOKKOS_ENABLE_HIP_MULTIPLE_KERNEL_INSTANTIATIONS +CC = mpicxx +CCFLAGS = -g -O3 -DNDEBUG SHFLAGS = -fPIC DEPFLAGS = -M -LINK = hipcc +LINK = mpicxx LINKFLAGS = -g -O3 LIB = SIZE = size @@ -21,8 +19,8 @@ SIZE = size ARCHIVE = ar ARFLAGS = -rc SHLIBFLAGS = -shared -KOKKOS_DEVICES = HIP -KOKKOS_ARCH = Zen2,Vega908 +KOKKOS_DEVICES = SYCL +KOKKOS_ARCH = PVC,SPR # --------------------------------------------------------------------- # LAMMPS-specific settings, all OPTIONAL @@ -43,9 +41,9 @@ LMP_INC = -DLAMMPS_GZIP # PATH = path for MPI library # LIB = name of MPI library -MPI_INC = -DMPICH_SKIP_MPICXX -DOMPI_SKIP_MPICXX=1 -I${MPICH_DIR}/include +MPI_INC = -DMPICH_SKIP_MPICXX -DOMPI_SKIP_MPICXX=1 MPI_PATH = -MPI_LIB = -L${MPICH_DIR}/lib -lmpi -L${CRAY_MPICH_ROOTDIR}/gtl/lib -lmpi_gtl_hsa +MPI_LIB = # FFT library # see discussion in Section 3.5.2 of manual @@ -54,12 +52,9 @@ MPI_LIB = -L${MPICH_DIR}/lib -lmpi -L${CRAY_MPICH_ROOTDIR}/gtl/lib -lmpi_gtl_hsa # PATH = path for FFT library # LIB = name of FFT library -MY_HIP_EXE = $(shell which hipcc) -MY_HIP_PATH = $(dir ${MY_HIP_EXE}) - -FFT_INC = -DFFT_HIPFFT +FFT_INC = FFT_PATH = -FFT_LIB = -L${MY_HIP_PATH}../lib -lhipfft +FFT_LIB = # JPEG and/or PNG library # see discussion in Section 3.5.4 of manual diff --git a/src/MAKE/MACHINES/Makefile.crusher_kokkos b/src/MAKE/MACHINES/Makefile.frontier_kokkos similarity index 94% rename from src/MAKE/MACHINES/Makefile.crusher_kokkos rename to src/MAKE/MACHINES/Makefile.frontier_kokkos index d6332805f7..ade90e6ffb 100644 --- a/src/MAKE/MACHINES/Makefile.crusher_kokkos +++ b/src/MAKE/MACHINES/Makefile.frontier_kokkos @@ -1,4 +1,4 @@ -# crusher_kokkos = KOKKOS/HIP, AMD MI250X GPU and AMD EPYC 7A53 "Optimized 3rd Gen EPYC" CPU, Cray MPICH, hipcc compiler, hipFFT +# frontier_kokkos = KOKKOS/HIP, AMD MI250X GPU and AMD EPYC 7A53 "Optimized 3rd Gen EPYC" CPU, Cray MPICH, hipcc compiler, hipFFT SHELL = /bin/sh @@ -6,8 +6,6 @@ SHELL = /bin/sh # compiler/linker settings # specify flags and libraries needed for your compiler -KOKKOS_ABSOLUTE_PATH = $(shell cd $(KOKKOS_PATH); pwd) - CC = hipcc CCFLAGS = -g -O3 -munsafe-fp-atomics -DNDEBUG -DKOKKOS_ENABLE_HIP_MULTIPLE_KERNEL_INSTANTIATIONS SHFLAGS = -fPIC From 9031d7979161afd541f27b268416176158f04d3c Mon Sep 17 00:00:00 2001 From: Stan Moore Date: Mon, 3 Jul 2023 21:47:47 +0000 Subject: [PATCH 338/396] Add Makefile for Perlmutter --- src/MAKE/MACHINES/Makefile.frontier_kokkos | 2 +- src/MAKE/MACHINES/Makefile.perlmutter_kokkos | 128 +++++++++++++++++++ 2 files changed, 129 insertions(+), 1 deletion(-) create mode 100644 src/MAKE/MACHINES/Makefile.perlmutter_kokkos diff --git a/src/MAKE/MACHINES/Makefile.frontier_kokkos b/src/MAKE/MACHINES/Makefile.frontier_kokkos index ade90e6ffb..86cddd12b7 100644 --- a/src/MAKE/MACHINES/Makefile.frontier_kokkos +++ b/src/MAKE/MACHINES/Makefile.frontier_kokkos @@ -20,7 +20,7 @@ ARCHIVE = ar ARFLAGS = -rc SHLIBFLAGS = -shared KOKKOS_DEVICES = HIP -KOKKOS_ARCH = Zen3,Vega90A +KOKKOS_ARCH = Vega90A,Zen3 # --------------------------------------------------------------------- # LAMMPS-specific settings, all OPTIONAL diff --git a/src/MAKE/MACHINES/Makefile.perlmutter_kokkos b/src/MAKE/MACHINES/Makefile.perlmutter_kokkos new file mode 100644 index 0000000000..2882fb6260 --- /dev/null +++ b/src/MAKE/MACHINES/Makefile.perlmutter_kokkos @@ -0,0 +1,128 @@ +# perlmutter_kokkos = KOKKOS/CUDA, NVIDIA A100 GPU and AMD EPYC 7763 (Milan) CPU, Cray MPICH, nvcc compiler with gcc + +SHELL = /bin/sh + +# --------------------------------------------------------------------- +# compiler/linker settings +# specify flags and libraries needed for your compiler + +KOKKOS_ABSOLUTE_PATH = $(shell cd $(KOKKOS_PATH); pwd) + +CC = $(KOKKOS_ABSOLUTE_PATH)/bin/nvcc_wrapper +CCFLAGS = -g -O3 -DNDEBUG -Xcudafe --diag_suppress=unrecognized_pragma +SHFLAGS = -fPIC +DEPFLAGS = -M + +LINK = $(KOKKOS_ABSOLUTE_PATH)/bin/nvcc_wrapper +LINKFLAGS = -g -O3 +LIB = +SIZE = size + +ARCHIVE = ar +ARFLAGS = -rc +SHLIBFLAGS = -shared +KOKKOS_DEVICES = Cuda +KOKKOS_ARCH = Ampere80,Zen3 + +# --------------------------------------------------------------------- +# LAMMPS-specific settings, all OPTIONAL +# specify settings for LAMMPS features you will use +# if you change any -D setting, do full re-compile after "make clean" + +# LAMMPS ifdef settings +# see possible settings in Section 3.5 of the manual + +LMP_INC = -DLAMMPS_GZIP + +# MPI library +# see discussion in Section 3.4 of the manual +# MPI wrapper compiler/linker can provide this info +# can point to dummy MPI library in src/STUBS as in Makefile.serial +# use -D MPICH and OMPI settings in INC to avoid C++ lib conflicts +# INC = path for mpi.h, MPI compiler settings +# PATH = path for MPI library +# LIB = name of MPI library + +MPI_INC = -DMPICH_SKIP_MPICXX -DOMPI_SKIP_MPICXX=1 -I${MPICH_DIR}/include +MPI_PATH = +MPI_LIB = -L${MPICH_DIR}/lib -lmpi -L${CRAY_MPICH_ROOTDIR}/gtl/lib -lmpi_gtl_cuda + +# FFT library +# see discussion in Section 3.5.2 of manual +# can be left blank to use provided KISS FFT library +# INC = -DFFT setting, e.g. -DFFT_FFTW, FFT compiler settings +# PATH = path for FFT library +# LIB = name of FFT library + +FFT_INC = -DFFT_CUFFT +FFT_PATH = +FFT_LIB = -lcufft + +# JPEG and/or PNG library +# see discussion in Section 3.5.4 of manual +# only needed if -DLAMMPS_JPEG or -DLAMMPS_PNG listed with LMP_INC +# INC = path(s) for jpeglib.h and/or png.h +# PATH = path(s) for JPEG library and/or PNG library +# LIB = name(s) of JPEG library and/or PNG library + +JPG_INC = +JPG_PATH = +JPG_LIB = + +# library for loading shared objects (defaults to -ldl, should be empty on Windows) +# uncomment to change the default + +# override DYN_LIB = + +# --------------------------------------------------------------------- +# build rules and dependencies +# do not edit this section + +include Makefile.package.settings +include Makefile.package + +EXTRA_INC = $(LMP_INC) $(PKG_INC) $(MPI_INC) $(FFT_INC) $(JPG_INC) $(PKG_SYSINC) +EXTRA_PATH = $(PKG_PATH) $(MPI_PATH) $(FFT_PATH) $(JPG_PATH) $(PKG_SYSPATH) +EXTRA_LIB = $(PKG_LIB) $(MPI_LIB) $(FFT_LIB) $(JPG_LIB) $(PKG_SYSLIB) $(DYN_LIB) +EXTRA_CPP_DEPENDS = $(PKG_CPP_DEPENDS) +EXTRA_LINK_DEPENDS = $(PKG_LINK_DEPENDS) + +# Path to src files + +vpath %.cpp .. +vpath %.h .. + +# Link target + +$(EXE): main.o $(LMPLIB) $(EXTRA_LINK_DEPENDS) + $(LINK) $(LINKFLAGS) main.o $(EXTRA_PATH) $(LMPLINK) $(EXTRA_LIB) $(LIB) -o $@ + $(SIZE) $@ + +# Library targets + +$(ARLIB): $(OBJ) $(EXTRA_LINK_DEPENDS) + @rm -f ../$(ARLIB) + $(ARCHIVE) $(ARFLAGS) ../$(ARLIB) $(OBJ) + @rm -f $(ARLIB) + @ln -s ../$(ARLIB) $(ARLIB) + +$(SHLIB): $(OBJ) $(EXTRA_LINK_DEPENDS) + $(CC) $(CCFLAGS) $(SHFLAGS) $(SHLIBFLAGS) $(EXTRA_PATH) -o ../$(SHLIB) \ + $(OBJ) $(EXTRA_LIB) $(LIB) + @rm -f $(SHLIB) + @ln -s ../$(SHLIB) $(SHLIB) + +# Compilation rules + +%.o:%.cpp + $(CC) $(CCFLAGS) $(SHFLAGS) $(EXTRA_INC) -c $< + +# Individual dependencies + +depend : fastdep.exe $(SRC) + @./fastdep.exe $(EXTRA_INC) -- $^ > .depend || exit 1 + +fastdep.exe: ../DEPEND/fastdep.c + cc -O -o $@ $< + +sinclude .depend From d57e1be9420699863dce18491fae67842f933285 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Tue, 4 Jul 2023 08:13:06 -0400 Subject: [PATCH 339/396] avoid division by zero in angle style dipole --- src/DIPOLE/angle_dipole.cpp | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/src/DIPOLE/angle_dipole.cpp b/src/DIPOLE/angle_dipole.cpp index f6508022db..6ad4a0fb4c 100644 --- a/src/DIPOLE/angle_dipole.cpp +++ b/src/DIPOLE/angle_dipole.cpp @@ -31,6 +31,8 @@ using namespace LAMMPS_NS; using namespace MathConst; +static constexpr double SMALL = 1.0e-100; + /* ---------------------------------------------------------------------- */ AngleDipole::AngleDipole(LAMMPS *lmp) : Angle(lmp) @@ -72,7 +74,7 @@ void AngleDipole::compute(int eflag, int vflag) double **f = atom->f; double delTx, delTy, delTz; - double fx, fy, fz, fmod, fmod_sqrtff; + double fx, fy, fz, fmod, fmod_len, len; if (!newton_bond) error->all(FLERR, "'newton' flag for bonded interactions must be 'on'"); @@ -87,6 +89,7 @@ void AngleDipole::compute(int eflag, int vflag) delz = x[iRef][2] - x[iDip][2]; r = sqrt(delx * delx + dely * dely + delz * delz); + if (r < SMALL) continue; rmu = r * mu[iDip][3]; cosGamma = (mu[iDip][0] * delx + mu[iDip][1] * dely + mu[iDip][2] * delz) / rmu; @@ -111,11 +114,13 @@ void AngleDipole::compute(int eflag, int vflag) fz = delx * delTy - dely * delTx; fmod = sqrt(delTx * delTx + delTy * delTy + delTz * delTz) / r; // magnitude - fmod_sqrtff = fmod / sqrt(fx * fx + fy * fy + fz * fz); + len = sqrt(fx * fx + fy * fy + fz * fz); + if (len < SMALL) continue; + fmod_len = fmod / len; - fi[0] = fx * fmod_sqrtff; - fi[1] = fy * fmod_sqrtff; - fi[2] = fz * fmod_sqrtff; + fi[0] = fx * fmod_len; + fi[1] = fy * fmod_len; + fi[2] = fz * fmod_len; fj[0] = -fi[0]; fj[1] = -fi[1]; @@ -249,6 +254,8 @@ double AngleDipole::single(int type, int iRef, int iDip, int /*iDummy*/) domain->minimum_image(delx, dely, delz); double r = sqrt(delx * delx + dely * dely + delz * delz); + if (r < SMALL) return 0.0; + double rmu = r * mu[iDip][3]; double cosGamma = (mu[iDip][0] * delx + mu[iDip][1] * dely + mu[iDip][2] * delz) / rmu; double deltaGamma = cosGamma - cos(gamma0[type]); From fcf30f4c582003ad6f0fef5b096158694330469d Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Thu, 6 Jul 2023 09:16:58 -0400 Subject: [PATCH 340/396] modernize example for dumping ellipsoid info to visualize with OVITO --- examples/ASPHERE/ellipsoid/in.ellipsoid | 127 +++++++++++---------- examples/ASPHERE/ellipsoid/in.ellipsoid.mp | 127 +++++++++++---------- 2 files changed, 132 insertions(+), 122 deletions(-) diff --git a/examples/ASPHERE/ellipsoid/in.ellipsoid b/examples/ASPHERE/ellipsoid/in.ellipsoid index 5e9a20f6e0..2dda95a029 100644 --- a/examples/ASPHERE/ellipsoid/in.ellipsoid +++ b/examples/ASPHERE/ellipsoid/in.ellipsoid @@ -1,23 +1,23 @@ # SRD diffusion demo - ellipsoids -units lj -atom_style ellipsoid -atom_modify first big -dimension 2 +units lj +atom_style ellipsoid +atom_modify first big +dimension 2 # create big ellipsoidal particles -lattice sq 0.14 -region box block 0 10 0 10 -0.5 0.5 -create_box 2 box -create_atoms 1 region box +lattice sq 0.14 +region box block 0 10 0 10 -0.5 0.5 +create_box 2 box +create_atoms 1 region box -set type 1 mass 1.0 -set type 1 shape 3.0 1.0 1.0 -group big type 1 -set group big quat/random 29898 +set type 1 mass 1.0 +set type 1 shape 3.0 1.0 1.0 +group big type 1 +set group big quat/random 29898 -velocity big create 1.44 87287 loop geom +velocity big create 1.44 87287 loop geom # equilibrate big particles @@ -26,57 +26,60 @@ pair_coeff 1 1 1.0 1.0 1 1 1 1 1 1 pair_coeff 1 2 1.0 1.0 1 1 1 1 1 1 0.0 pair_coeff 2 2 1.0 1.0 1 1 1 1 1 1 0.0 -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 big nve/asphere -fix 2 all enforce2d +fix 1 big nve/asphere +fix 2 all enforce2d -compute rot big temp/asphere +compute rot big temp/asphere +compute 0 all property/atom quatw quati quatj quatk shapex shapey shapez -#dump 1 all custom 10 dump.ellipsoid.equil id type x y z & -# quatw quati quatj quatk +#dump 1 all custom 10 dump.ellipsoid.equil id type x y z & +# c_0[1] c_0[2] c_0[3] c_0[4] c_0[5] c_0[6] c_0[7] +#dump_modify 1 colname c_0[1] quatw colname c_0[2] quati colname c_0[3] quatj colname c_0[4] quatk & +# colname c_0[5] shapex colname c_0[6] shapey colname c_0[7] shapez -thermo_style custom step temp c_rot epair etotal press -thermo 100 +thermo_style custom step temp c_rot epair etotal press +thermo 100 -run 1000 +run 1000 -#undump 1 -unfix 1 -unfix 2 +#undump 1 +unfix 1 +unfix 2 # add small particles as hi density lattice -region plane block INF INF INF INF -0.001 0.001 units box -lattice sq 120.0 -create_atoms 2 region plane +region plane block INF INF INF INF -0.001 0.001 units box +lattice sq 120.0 +create_atoms 2 region plane -set type 2 mass 0.01 -group small type 2 -velocity small create 1.0 593849 loop geom +set type 2 mass 0.01 +group small type 2 +velocity small create 1.0 593849 loop geom # delete overlaps # must set 1-2 cutoff to non-zero value -pair_style lj/cut 2.5 -pair_coeff 1 1 1.0 1.0 -pair_coeff 2 2 0.0 1.0 0.0 -pair_coeff 1 2 0.0 1.0 2.0 +pair_style lj/cut 2.5 +pair_coeff 1 1 1.0 1.0 +pair_coeff 2 2 0.0 1.0 0.0 +pair_coeff 1 2 0.0 1.0 2.0 -neigh_modify one 10000 +neigh_modify one 10000 -delete_atoms overlap 1.6 small big +delete_atoms overlap 1.6 small big # SRD run -reset_timestep 0 +reset_timestep 0 -neighbor 0.3 multi -neigh_modify delay 0 every 1 check yes +neighbor 0.3 multi +neigh_modify delay 0 every 1 check yes -comm_modify mode multi group big vel yes -neigh_modify include big +comm_modify mode multi group big vel yes +neigh_modify include big # no pairwise interactions with small particles @@ -88,29 +91,31 @@ pair_coeff 2 2 1.0 1.0 1 1 1 1 1 1 0.0 # use fix SRD to push small particles out from inside big ones # if comment out, big particles won't see SRD particles -timestep 0.0005 +timestep 0.0005 -fix 1 big nve/asphere -fix 2 small srd 20 big 1.0 0.25 49894 shift yes 54979 & - collision noslip search 0.2 inside ignore exact no bounce 50 -fix 3 all enforce2d +fix 1 big nve/asphere +fix 2 small srd 20 big 1.0 0.25 49894 shift yes 54979 & + collision noslip search 0.2 inside ignore exact no bounce 50 +fix 3 all enforce2d # diagnostics -compute tbig big temp/asphere -variable pebig equal pe*atoms/count(big) -variable ebig equal etotal*atoms/count(big) -thermo_style custom step temp c_rot f_2[9] etotal v_pebig v_ebig press & - f_2[1] f_2[2] f_2[3] f_2[4] f_2[5] & - f_2[6] f_2[7] f_2[8] f_2[9] f_2[10] f_2[11] f_2[12] +compute tbig big temp/asphere +variable pebig equal pe*atoms/count(big) +variable ebig equal etotal*atoms/count(big) +thermo_style custom step temp c_rot f_2[9] etotal v_pebig v_ebig press & + f_2[1] f_2[2] f_2[3] f_2[4] f_2[5] & + f_2[6] f_2[7] f_2[8] f_2[9] f_2[10] f_2[11] f_2[12] -thermo_modify temp tbig -thermo 1000 +thermo_modify temp tbig +thermo 1000 -#dump 1 all custom 1000 dump.ellipsoid id type x y z & -# quatw quati quatj quatk +#dump 1 all custom 1000 dump.ellipsoid id type x y z & +# c_0[1] c_0[2] c_0[3] c_0[4] c_0[5] c_0[6] c_0[7] +#dump_modify 1 colname c_0[1] quatw colname c_0[2] quati colname c_0[3] quatj colname c_0[4] quatk & +# colname c_0[5] shapex colname c_0[6] shapey colname c_0[7] shapez -#dump 1 all image 1000 image.*.jpg type type zoom 1.6 -#dump_modify 1 pad 6 adiam 1 1 adiam 2 0.2 +#dump 2 all image 1000 image.*.jpg type type zoom 1.6 +#dump_modify 2 pad 6 adiam 1 1 adiam 2 0.2 -run 100000 +run 100000 diff --git a/examples/ASPHERE/ellipsoid/in.ellipsoid.mp b/examples/ASPHERE/ellipsoid/in.ellipsoid.mp index 7ce01ad4e1..e950cc86f5 100644 --- a/examples/ASPHERE/ellipsoid/in.ellipsoid.mp +++ b/examples/ASPHERE/ellipsoid/in.ellipsoid.mp @@ -1,23 +1,23 @@ # SRD viscosity demo - ellipsoids -units lj -atom_style ellipsoid -atom_modify first big -dimension 2 +units lj +atom_style ellipsoid +atom_modify first big +dimension 2 # create big ellipsoidal particles -lattice sq 0.14 -region box block 0 10 0 10 -0.5 0.5 -create_box 2 box -create_atoms 1 region box +lattice sq 0.14 +region box block 0 10 0 10 -0.5 0.5 +create_box 2 box +create_atoms 1 region box -set type 1 mass 1.0 -set type 1 shape 3.0 1.0 1.0 -group big type 1 -set group big quat/random 29898 +set type 1 mass 1.0 +set type 1 shape 3.0 1.0 1.0 +group big type 1 +set group big quat/random 29898 -velocity big create 1.44 87287 loop geom +velocity big create 1.44 87287 loop geom # equilibrate big particles @@ -26,57 +26,60 @@ pair_coeff 1 1 1.0 1.0 1 1 1 1 1 1 pair_coeff 1 2 1.0 1.0 1 1 1 1 1 1 0.0 pair_coeff 2 2 1.0 1.0 1 1 1 1 1 1 0.0 -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 big nve/asphere -fix 2 all enforce2d +fix 1 big nve/asphere +fix 2 all enforce2d -compute rot big temp/asphere +compute rot big temp/asphere +compute 0 all property/atom quatw quati quatj quatk shapex shapey shapez -#dump 1 all custom 10 dump.ellipsoid.equil id type x y z & -# quatw quati quatj quatk +#dump 1 all custom 10 dump.ellipsoid.equil id type x y z & +# c_0[1] c_0[2] c_0[3] c_0[4] c_0[5] c_0[6] c_0[7] +#dump_modify 1 colname c_0[1] quatw colname c_0[2] quati colname c_0[3] quatj colname c_0[4] quatk & +# colname c_0[5] shapex colname c_0[6] shapey colname c_0[7] shapez -thermo_style custom step temp c_rot epair etotal press -thermo 100 +thermo_style custom step temp c_rot epair etotal press +thermo 100 -run 1000 +run 1000 -#undump 1 -unfix 1 -unfix 2 +#undump 1 +unfix 1 +unfix 2 # add small particles as hi density lattice -region plane block INF INF INF INF -0.001 0.001 units box -lattice sq 120.0 -create_atoms 2 region plane +region plane block INF INF INF INF -0.001 0.001 units box +lattice sq 120.0 +create_atoms 2 region plane -set type 2 mass 0.01 -group small type 2 -velocity small create 1.0 593849 loop geom +set type 2 mass 0.01 +group small type 2 +velocity small create 1.0 593849 loop geom # delete overlaps # must set 1-2 cutoff to non-zero value -pair_style lj/cut 2.5 -pair_coeff 1 1 1.0 1.0 -pair_coeff 2 2 0.0 1.0 0.0 -pair_coeff 1 2 0.0 1.0 2.0 +pair_style lj/cut 2.5 +pair_coeff 1 1 1.0 1.0 +pair_coeff 2 2 0.0 1.0 0.0 +pair_coeff 1 2 0.0 1.0 2.0 -neigh_modify one 10000 +neigh_modify one 10000 -delete_atoms overlap 1.6 small big +delete_atoms overlap 1.6 small big # SRD run -reset_timestep 0 +reset_timestep 0 -neighbor 0.3 multi -neigh_modify delay 0 every 1 check yes +neighbor 0.3 multi +neigh_modify delay 0 every 1 check yes -comm_modify mode multi group big vel yes -neigh_modify include big +comm_modify mode multi group big vel yes +neigh_modify include big # no pairwise interactions with small particles @@ -88,30 +91,32 @@ pair_coeff 2 2 1.0 1.0 1 1 1 1 1 1 0.0 # use fix SRD to push small particles out from inside big ones # if comment out, big particles won't see SRD particles -timestep 0.0005 +timestep 0.0005 -fix 1 big nve/asphere -fix 2 small srd 20 big 1.0 0.25 49894 shift yes 54979 & +fix 1 big nve/asphere +fix 2 small srd 20 big 1.0 0.25 49894 shift yes 54979 & collision noslip search 0.2 inside ignore exact no bounce 50 -fix 3 small viscosity 20 x y 50 -fix 4 all enforce2d +fix 3 small viscosity 20 x y 50 +fix 4 all enforce2d # diagnostics -compute tbig big temp/asphere -variable pebig equal pe*atoms/count(big) -variable ebig equal etotal*atoms/count(big) -thermo_style custom step temp c_rot f_2[9] etotal v_pebig v_ebig press & - f_2[1] f_2[2] f_2[3] f_2[4] f_2[5] & - f_2[6] f_2[7] f_2[8] f_2[9] f_2[10] f_2[11] f_2[12] +compute tbig big temp/asphere +variable pebig equal pe*atoms/count(big) +variable ebig equal etotal*atoms/count(big) +thermo_style custom step temp c_rot f_2[9] etotal v_pebig v_ebig press & + f_2[1] f_2[2] f_2[3] f_2[4] f_2[5] & + f_2[6] f_2[7] f_2[8] f_2[9] f_2[10] f_2[11] f_2[12] -thermo_modify temp tbig -thermo 1000 +thermo_modify temp tbig +thermo 1000 -#dump 1 all custom 500 dump.ellipsoid.mp id type x y z & -# quatw quati quatj quatk +#dump 1 all custom 500 dump.ellipsoid id type x y z & +# c_0[1] c_0[2] c_0[3] c_0[4] c_0[5] c_0[6] c_0[7] +#dump_modify 1 colname c_0[1] quatw colname c_0[2] quati colname c_0[3] quatj colname c_0[4] quatk & +# colname c_0[5] shapex colname c_0[6] shapey colname c_0[7] shapez -#dump 1 all image 500 image.*.jpg type type zoom 1.6 -#dump_modify 1 pad 6 adiam 1 1 adiam 2 0.2 +#dump 1 all image 500 image.*.jpg type type zoom 1.6 +#dump_modify 1 pad 6 adiam 1 1 adiam 2 0.2 -run 50000 +run 50000 From 8ae5ab57fcac05783a82c674ce9727ac1c819b56 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Thu, 6 Jul 2023 09:17:27 -0400 Subject: [PATCH 341/396] non-ellipsoid particles you have a 1,0,0,0 quaternion and 1,1,1 shape --- src/compute_property_atom.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/compute_property_atom.cpp b/src/compute_property_atom.cpp index fc7089fa01..fbb9129b6e 100644 --- a/src/compute_property_atom.cpp +++ b/src/compute_property_atom.cpp @@ -1268,7 +1268,7 @@ void ComputePropertyAtom::pack_shapex(int n) for (int i = 0; i < nlocal; i++) { if ((mask[i] & groupbit) && ellipsoid[i] >= 0) buf[n] = 2.0*bonus[ellipsoid[i]].shape[0]; - else buf[n] = 0.0; + else buf[n] = 1.0; n += nvalues; } } @@ -1285,7 +1285,7 @@ void ComputePropertyAtom::pack_shapey(int n) for (int i = 0; i < nlocal; i++) { if ((mask[i] & groupbit) && ellipsoid[i] >= 0) buf[n] = 2.0*bonus[ellipsoid[i]].shape[1]; - else buf[n] = 0.0; + else buf[n] = 1.0; n += nvalues; } } @@ -1302,7 +1302,7 @@ void ComputePropertyAtom::pack_shapez(int n) for (int i = 0; i < nlocal; i++) { if ((mask[i] & groupbit) && ellipsoid[i] >= 0) buf[n] = 2.0*bonus[ellipsoid[i]].shape[2]; - else buf[n] = 0.0; + else buf[n] = 1.0; n += nvalues; } } @@ -1320,7 +1320,7 @@ void ComputePropertyAtom::pack_quatw(int n) for (int i = 0; i < nlocal; i++) { if ((mask[i] & groupbit) && ellipsoid[i] >= 0) buf[n] = bonus[ellipsoid[i]].quat[0]; - else buf[n] = 0.0; + else buf[n] = 1.0; n += nvalues; } From 02845483d2038b42aecd77d327028d7a0fed9d09 Mon Sep 17 00:00:00 2001 From: Steve Plimpton Date: Thu, 6 Jul 2023 09:08:15 -0700 Subject: [PATCH 342/396] add gravity keyword info to fix rigid doc page --- doc/src/fix_rigid.rst | 32 ++++++++++++++++++++++++++++---- 1 file changed, 28 insertions(+), 4 deletions(-) diff --git a/doc/src/fix_rigid.rst b/doc/src/fix_rigid.rst index 884d883f5a..098b900050 100644 --- a/doc/src/fix_rigid.rst +++ b/doc/src/fix_rigid.rst @@ -610,10 +610,12 @@ such attributes: the total mass of the rigid body, its center-of-mass position, its 6 moments of inertia, its center-of-mass velocity, and the 3 image flags of the center-of-mass position. For rigid bodies consisting of point particles or non-overlapping finite-size -particles, LAMMPS can compute these values accurately. However, for -rigid bodies consisting of finite-size particles which overlap each -other, LAMMPS will ignore the overlaps when computing these 4 -attributes. The amount of error this induces depends on the amount of +particles, LAMMPS can compute these values accurately. + +However, for rigid bodies consisting of finite-size particles which +overlap each other, LAMMPS will ignore the overlaps when computing +these 4 attributes, which means the dynamics of the bodies will be +incorrect. The amount of error this induces depends on the amount of overlap. To avoid this issue, the values can be pre-computed (e.g. using Monte Carlo integration). @@ -677,6 +679,28 @@ cross periodic boundaries during the simulation. auxiliary file will contain one line for every rigid body, even if the original file only listed a subset of the rigid bodies. +If the system has rigid bodies with finite-size overlapping particles +and the model uses the :doc:`fix gravity ` command to +apply a gravitational force to the rigid bodies, then the *gravity* +keyword should be used in the following manner. + +First, the group specified for the :doc:`fix gravity ` +command should not include any atoms in rigid bodies which have +overlapping particles. It can be empty (see the :doc:`group empty +` command) or only contain single particles not in rigid +bodies, e.g. background particles. + +Second, the *infile* keyword should be used to specify the total mass +and other properties of the rigid bodies with overlaps, so that their +dyamics will be modeled correctly, as explained above. + +Third, the *gravity* keyword should be used the with the ID of the +:doc:`fix gravity ` command as its argument. The rigid +fixes will access gravity fix to extract the current direction of the +gravity vector at each timestep (which can be static or dynamic). A +gravity force will then be applied to each rigid body at its +center-of-mass position using its total mass. + ---------- If you use a :doc:`temperature compute ` with a group that From 6e41ac7ead41188a9660ddd8074aa76a9f1d342c Mon Sep 17 00:00:00 2001 From: Steve Plimpton Date: Thu, 6 Jul 2023 09:14:00 -0700 Subject: [PATCH 343/396] fix typo --- doc/src/fix_rigid.rst | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/doc/src/fix_rigid.rst b/doc/src/fix_rigid.rst index 098b900050..7650822626 100644 --- a/doc/src/fix_rigid.rst +++ b/doc/src/fix_rigid.rst @@ -696,9 +696,9 @@ dyamics will be modeled correctly, as explained above. Third, the *gravity* keyword should be used the with the ID of the :doc:`fix gravity ` command as its argument. The rigid -fixes will access gravity fix to extract the current direction of the -gravity vector at each timestep (which can be static or dynamic). A -gravity force will then be applied to each rigid body at its +fixes will access the gravity fix to extract the current direction of +the gravity vector at each timestep (which can be static or dynamic). +A gravity force will then be applied to each rigid body at its center-of-mass position using its total mass. ---------- From cac82473836961e7fddbdc068e3848939a07ae29 Mon Sep 17 00:00:00 2001 From: "Dan S. Bolintineanu" Date: Thu, 6 Jul 2023 11:19:22 -0600 Subject: [PATCH 344/396] Modified doc page for pair granular to include flux as extra pairwise quantity --- doc/src/pair_granular.rst | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/doc/src/pair_granular.rst b/doc/src/pair_granular.rst index fb5d5c6338..730eff9eee 100644 --- a/doc/src/pair_granular.rst +++ b/doc/src/pair_granular.rst @@ -763,15 +763,17 @@ The single() function of these pair styles returns 0.0 for the energy of a pairwise interaction, since energy is not conserved in these dissipative potentials. It also returns only the normal component of the pairwise interaction force. However, the single() function also -calculates 12 extra pairwise quantities. The first 3 are the +calculates 13 extra pairwise quantities. The first 3 are the components of the tangential force between particles I and J, acting on particle I. The fourth is the magnitude of this tangential force. The next 3 (5-7) are the components of the rolling torque acting on particle I. The next entry (8) is the magnitude of the rolling torque. The next entry (9) is the magnitude of the twisting torque acting about the vector connecting the two particle centers. -The last 3 (10-12) are the components of the vector connecting -the centers of the two particles (x_I - x_J). +The next 3 (10-12) are the components of the vector connecting +the centers of the two particles (x_I - x_J). The last quantity (13) +is the heat flow between the two particles, set to 0 if no heat model +is active. These extra quantities can be accessed by the :doc:`compute pair/local ` command, as *p1*, *p2*, ..., *p12*\ . From b66a5cd225e7a8b020cf3d5518f43e722acbb1c5 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Thu, 6 Jul 2023 13:31:00 -0400 Subject: [PATCH 345/396] fix another typo --- doc/src/fix_rigid.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/src/fix_rigid.rst b/doc/src/fix_rigid.rst index 7650822626..b6c2c99071 100644 --- a/doc/src/fix_rigid.rst +++ b/doc/src/fix_rigid.rst @@ -692,7 +692,7 @@ bodies, e.g. background particles. Second, the *infile* keyword should be used to specify the total mass and other properties of the rigid bodies with overlaps, so that their -dyamics will be modeled correctly, as explained above. +dynamics will be modeled correctly, as explained above. Third, the *gravity* keyword should be used the with the ID of the :doc:`fix gravity ` command as its argument. The rigid From 55b7b3d9992a22522bd85553389b5eda16a8ad65 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Thu, 6 Jul 2023 14:03:07 -0400 Subject: [PATCH 346/396] whitespace fixes --- doc/src/pair_granular.rst | 10 +++++----- src/GRANULAR/gran_sub_mod_heat.h | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/doc/src/pair_granular.rst b/doc/src/pair_granular.rst index 730eff9eee..c54df44d95 100644 --- a/doc/src/pair_granular.rst +++ b/doc/src/pair_granular.rst @@ -655,8 +655,8 @@ For *heat* *radius*, the heat where :math:`\Delta T` is the difference in the two particles' temperature, :math:`k_{s}` is a non-negative numeric value for the conductivity (in units -of power/(length*temperature)), and :math:`a` is the radius of the contact and -depends on the normal force model. This is the model proposed by +of power/(length*temperature)), and :math:`a` is the radius of the contact and +depends on the normal force model. This is the model proposed by :ref:`Vargas and McCarthy ` For *heat* *area*, the heat @@ -668,7 +668,7 @@ For *heat* *area*, the heat where :math:`\Delta T` is the difference in the two particles' temperature, -:math:`h_{s}` is a non-negative numeric value for the heat transfer +:math:`h_{s}` is a non-negative numeric value for the heat transfer coefficient (in units of power/(area*temperature)), and :math:`A=\pi a^2` is the area of the contact and depends on the normal force model. @@ -913,7 +913,7 @@ I. Assembling process, geometry, and contact networks. Phys. Rev. E, 76, 061302. .. _VargasMcCarthy2001: -**(Vargas and McCarthy 2001)** Vargas, W.L. and McCarthy, J.J. (2001). -Heat conduction in granular materials. +**(Vargas and McCarthy 2001)** Vargas, W.L. and McCarthy, J.J. (2001). +Heat conduction in granular materials. AIChE Journal, 47(5), 1052-1059. diff --git a/src/GRANULAR/gran_sub_mod_heat.h b/src/GRANULAR/gran_sub_mod_heat.h index 1098a0aa78..5f264cb913 100644 --- a/src/GRANULAR/gran_sub_mod_heat.h +++ b/src/GRANULAR/gran_sub_mod_heat.h @@ -40,7 +40,7 @@ namespace Granular_NS { GranSubModHeatNone(class GranularModel *, class LAMMPS *); double calculate_heat() override; }; - + /* ---------------------------------------------------------------------- */ class GranSubModHeatRadius : public GranSubModHeat { From 3e4b66378a4a31b243249cc2893efa54360b496a Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Thu, 6 Jul 2023 14:06:31 -0400 Subject: [PATCH 347/396] typo --- doc/src/pair_granular.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/src/pair_granular.rst b/doc/src/pair_granular.rst index c54df44d95..bc469412d9 100644 --- a/doc/src/pair_granular.rst +++ b/doc/src/pair_granular.rst @@ -657,7 +657,7 @@ where :math:`\Delta T` is the difference in the two particles' temperature, :math:`k_{s}` is a non-negative numeric value for the conductivity (in units of power/(length*temperature)), and :math:`a` is the radius of the contact and depends on the normal force model. This is the model proposed by -:ref:`Vargas and McCarthy ` +:ref:`Vargas and McCarthy `. For *heat* *area*, the heat :math:`Q` conducted between two particles is given by From bf0372280e42d46f02d12d392fc30a3d97a29d71 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Thu, 6 Jul 2023 14:59:09 -0400 Subject: [PATCH 348/396] remove dead code --- src/GRANULAR/fix_heat_flow.cpp | 6 ------ src/GRANULAR/fix_heat_flow.h | 1 - 2 files changed, 7 deletions(-) diff --git a/src/GRANULAR/fix_heat_flow.cpp b/src/GRANULAR/fix_heat_flow.cpp index 16f7755d44..e948e5454f 100644 --- a/src/GRANULAR/fix_heat_flow.cpp +++ b/src/GRANULAR/fix_heat_flow.cpp @@ -87,12 +87,6 @@ void FixHeatFlow::init() /* ---------------------------------------------------------------------- */ -void FixHeatFlow::setup(int /*vflag*/) -{ -} - -/* ---------------------------------------------------------------------- */ - void FixHeatFlow::setup_pre_force(int /*vflag*/) { // Identify whether this is the first instance of fix heat/flow diff --git a/src/GRANULAR/fix_heat_flow.h b/src/GRANULAR/fix_heat_flow.h index 5a06eed4d3..89fabc5a4d 100644 --- a/src/GRANULAR/fix_heat_flow.h +++ b/src/GRANULAR/fix_heat_flow.h @@ -30,7 +30,6 @@ class FixHeatFlow : public Fix { int setmask() override; void init() override; - void setup(int) override; void setup_pre_force(int) override; void pre_force(int) override; void final_integrate() override; From 6d8f5a38ea44270cad55d208076ddd3a149b7f90 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Thu, 6 Jul 2023 15:03:38 -0400 Subject: [PATCH 349/396] improve error messages --- src/GRANULAR/fix_heat_flow.cpp | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/src/GRANULAR/fix_heat_flow.cpp b/src/GRANULAR/fix_heat_flow.cpp index e948e5454f..519b7f731d 100644 --- a/src/GRANULAR/fix_heat_flow.cpp +++ b/src/GRANULAR/fix_heat_flow.cpp @@ -33,7 +33,7 @@ enum {NONE, CONSTANT, TYPE}; FixHeatFlow::FixHeatFlow(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg) { - if (narg < 4) error->all(FLERR,"Illegal fix command"); + if (narg < 4) utils::missing_cmd_args(FLERR,"fix heat/flow", error); cp_style = NONE; comm_forward = 1; @@ -41,24 +41,24 @@ FixHeatFlow::FixHeatFlow(LAMMPS *lmp, int narg, char **arg) : int ntypes = atom->ntypes; if (strcmp(arg[3],"constant") == 0) { - if (narg != 5) error->all(FLERR,"Illegal fix command"); + if (narg != 5) error->all(FLERR,"Illegal fix heat/flow constant command"); cp_style = CONSTANT; cp = utils::numeric(FLERR,arg[4],false,lmp); - if (cp < 0.0) error->all(FLERR,"Illegal fix command"); + if (cp < 0.0) error->all(FLERR,"Illegal fix heat/flow constant command value"); } else if (strcmp(arg[3],"type") == 0) { - if (narg != 4 + ntypes) error->all(FLERR,"Illegal fix command"); + if (narg != 4 + ntypes) error->all(FLERR,"Illegal fix heat/flow type command"); cp_style = TYPE; - memory->create(cp_type,ntypes+1,"fix/temp/integrate:cp_type"); + memory->create(cp_type,ntypes+1,"fix_heat_flow:cp_type"); for (int i = 1; i <= ntypes; i++) { cp_type[i] = utils::numeric(FLERR,arg[3+i],false,lmp); - if (cp_type[i] < 0.0) error->all(FLERR,"Illegal fix command"); + if (cp_type[i] < 0.0) error->all(FLERR,"Illegal fix heat/flow type command value"); } } else { - error->all(FLERR,"Illegal fix command"); + error->all(FLERR,"Unknown fix heat/flow keyword {}", arg[3]); } if (cp_style == NONE) - error->all(FLERR, "Must specify specific heat in fix temp/integrate"); + error->all(FLERR, "Must specify specific heat in fix heat/flow"); dynamic_group_allow = 1; } @@ -80,9 +80,9 @@ void FixHeatFlow::init() dt = update->dt; if (!atom->temperature_flag) - error->all(FLERR,"Fix temp/integrate requires atom style with temperature property"); + error->all(FLERR,"Fix heat/flow requires atom style with temperature property"); if (!atom->heatflow_flag) - error->all(FLERR,"Fix temp/integrate requires atom style with heatflow property"); + error->all(FLERR,"Fix heat/flow requires atom style with heatflow property"); } /* ---------------------------------------------------------------------- */ From 6f289df9806de41c8c0231067bef45510f0c9b4a Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Thu, 6 Jul 2023 15:05:36 -0400 Subject: [PATCH 350/396] enable and apply clang-format --- src/GRANULAR/fix_heat_flow.cpp | 53 ++++++++++++++-------------------- 1 file changed, 21 insertions(+), 32 deletions(-) diff --git a/src/GRANULAR/fix_heat_flow.cpp b/src/GRANULAR/fix_heat_flow.cpp index 519b7f731d..d0d7a73ce6 100644 --- a/src/GRANULAR/fix_heat_flow.cpp +++ b/src/GRANULAR/fix_heat_flow.cpp @@ -1,4 +1,3 @@ -// clang-format off /* -*- c++ -*- ---------------------------------------------------------- LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator https://www.lammps.org/, Sandia National Laboratories @@ -26,39 +25,37 @@ using namespace LAMMPS_NS; using namespace FixConst; -enum {NONE, CONSTANT, TYPE}; +enum { NONE, CONSTANT, TYPE }; /* ---------------------------------------------------------------------- */ -FixHeatFlow::FixHeatFlow(LAMMPS *lmp, int narg, char **arg) : - Fix(lmp, narg, arg) +FixHeatFlow::FixHeatFlow(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg) { - if (narg < 4) utils::missing_cmd_args(FLERR,"fix heat/flow", error); + if (narg < 4) utils::missing_cmd_args(FLERR, "fix heat/flow", error); cp_style = NONE; comm_forward = 1; comm_reverse = 1; int ntypes = atom->ntypes; - if (strcmp(arg[3],"constant") == 0) { - if (narg != 5) error->all(FLERR,"Illegal fix heat/flow constant command"); + if (strcmp(arg[3], "constant") == 0) { + if (narg != 5) error->all(FLERR, "Illegal fix heat/flow constant command"); cp_style = CONSTANT; - cp = utils::numeric(FLERR,arg[4],false,lmp); - if (cp < 0.0) error->all(FLERR,"Illegal fix heat/flow constant command value"); - } else if (strcmp(arg[3],"type") == 0) { - if (narg != 4 + ntypes) error->all(FLERR,"Illegal fix heat/flow type command"); + cp = utils::numeric(FLERR, arg[4], false, lmp); + if (cp < 0.0) error->all(FLERR, "Illegal fix heat/flow constant command value"); + } else if (strcmp(arg[3], "type") == 0) { + if (narg != 4 + ntypes) error->all(FLERR, "Illegal fix heat/flow type command"); cp_style = TYPE; - memory->create(cp_type,ntypes+1,"fix_heat_flow:cp_type"); + memory->create(cp_type, ntypes + 1, "fix_heat_flow:cp_type"); for (int i = 1; i <= ntypes; i++) { - cp_type[i] = utils::numeric(FLERR,arg[3+i],false,lmp); - if (cp_type[i] < 0.0) error->all(FLERR,"Illegal fix heat/flow type command value"); + cp_type[i] = utils::numeric(FLERR, arg[3 + i], false, lmp); + if (cp_type[i] < 0.0) error->all(FLERR, "Illegal fix heat/flow type command value"); } } else { - error->all(FLERR,"Unknown fix heat/flow keyword {}", arg[3]); + error->all(FLERR, "Unknown fix heat/flow keyword {}", arg[3]); } - if (cp_style == NONE) - error->all(FLERR, "Must specify specific heat in fix heat/flow"); + if (cp_style == NONE) error->all(FLERR, "Must specify specific heat in fix heat/flow"); dynamic_group_allow = 1; } @@ -80,9 +77,9 @@ void FixHeatFlow::init() dt = update->dt; if (!atom->temperature_flag) - error->all(FLERR,"Fix heat/flow requires atom style with temperature property"); + error->all(FLERR, "Fix heat/flow requires atom style with temperature property"); if (!atom->heatflow_flag) - error->all(FLERR,"Fix heat/flow requires atom style with heatflow property"); + error->all(FLERR, "Fix heat/flow requires atom style with heatflow property"); } /* ---------------------------------------------------------------------- */ @@ -130,19 +127,14 @@ void FixHeatFlow::final_integrate() if (igroup == atom->firstgroup) nlocal = atom->nfirst; // add ghost contributions to heatflow if first instance of fix - if (first_flag) - comm->reverse_comm(this); + if (first_flag) comm->reverse_comm(this); if (rmass) { for (int i = 0; i < nlocal; i++) - if (mask[i] & groupbit) { - temperature[i] += dt * heatflow[i] / (calc_cp(i) * rmass[i]); - } + if (mask[i] & groupbit) temperature[i] += dt * heatflow[i] / (calc_cp(i) * rmass[i]); } else { for (int i = 0; i < nlocal; i++) - if (mask[i] & groupbit) { - temperature[i] += dt * heatflow[i] / (calc_cp(i) * mass[type[i]]); - } + if (mask[i] & groupbit) temperature[i] += dt * heatflow[i] / (calc_cp(i) * mass[type[i]]); } } @@ -211,9 +203,7 @@ int FixHeatFlow::pack_reverse_comm(int n, int first, double *buf) int last = first + n; double *heatflow = atom->heatflow; - for (int i = first; i < last; i++) { - buf[m++] = heatflow[i]; - } + for (int i = first; i < last; i++) { buf[m++] = heatflow[i]; } return m; } @@ -225,6 +215,5 @@ void FixHeatFlow::unpack_reverse_comm(int n, int *list, double *buf) int m = 0; double *heatflow = atom->heatflow; - for (int i = 0; i < n; i++) - heatflow[list[i]] += buf[m++]; + for (int i = 0; i < n; i++) heatflow[list[i]] += buf[m++]; } From a3b9914f62423731607a5d7f5d7e2b41658656b4 Mon Sep 17 00:00:00 2001 From: jbcouli Date: Thu, 6 Jul 2023 17:48:49 -0600 Subject: [PATCH 351/396] make error messages consistent with keyword values yes/no. Allow coul weight for 1-2 bonds to be zero for break no to eliminate bonded atoms from neighbor list when bonds cannot break --- doc/src/Howto_bpm.rst | 6 +++++- doc/src/bond_bpm_rotational.rst | 4 ++-- doc/src/bond_bpm_spring.rst | 4 ++-- src/BPM/bond_bpm.cpp | 18 +++++++++--------- 4 files changed, 18 insertions(+), 14 deletions(-) diff --git a/doc/src/Howto_bpm.rst b/doc/src/Howto_bpm.rst index 8b84e96b99..1c30b177e7 100644 --- a/doc/src/Howto_bpm.rst +++ b/doc/src/Howto_bpm.rst @@ -107,7 +107,11 @@ bond lists is expensive. By setting the lj weight for 1-2 bonds to zero, this turns off pairwise interactions. Even though there are no charges in BPM models, setting a nonzero coul weight for 1-2 bonds ensures all bonded neighbors are still included in the neighbor list -in case bonds break between neighbor list builds. +in case bonds break between neighbor list builds. If bond breakage is +disabled during a simulation run by setting the *break* keyword to *no*, +a zero coul weight for 1-2 bonds can be used to exclude bonded neighbors +from the neighbor list builds. This can be useful for post-processing, +or to determine pair interaction properties between distinct bonded particles. To monitor the fracture of bonds in the system, all BPM bond styles have the ability to record instances of bond breakage to output using diff --git a/doc/src/bond_bpm_rotational.rst b/doc/src/bond_bpm_rotational.rst index cfacfde2cd..7459d491d6 100644 --- a/doc/src/bond_bpm_rotational.rst +++ b/doc/src/bond_bpm_rotational.rst @@ -234,8 +234,8 @@ This bond style is part of the BPM package. It is only enabled if LAMMPS was built with that package. See the :doc:`Build package ` page for more info. -By default if pair interactions are to be disabled, this bond style -requires setting +By default if pair interactions between bonded atoms are to be disabled, +this bond style requires setting .. code-block:: LAMMPS diff --git a/doc/src/bond_bpm_spring.rst b/doc/src/bond_bpm_spring.rst index 2376b8e077..04ff4d5991 100644 --- a/doc/src/bond_bpm_spring.rst +++ b/doc/src/bond_bpm_spring.rst @@ -191,8 +191,8 @@ This bond style is part of the BPM package. It is only enabled if LAMMPS was built with that package. See the :doc:`Build package ` page for more info. -By default if pair interactions are to be disabled, this bond style -requires setting +By default if pair interactions between bonded atoms are to be disabled, +this bond style requires setting .. code-block:: LAMMPS diff --git a/src/BPM/bond_bpm.cpp b/src/BPM/bond_bpm.cpp index d965a19067..4f3577b2ca 100644 --- a/src/BPM/bond_bpm.cpp +++ b/src/BPM/bond_bpm.cpp @@ -96,7 +96,7 @@ void BondBPM::init_style() if (overlay_flag) { if (force->special_lj[1] != 1.0) error->all(FLERR, - "With overlay/pair, BPM bond styles require special_bonds weight of 1.0 for " + "With overlay/pair yes, BPM bond styles require special_bonds weight of 1.0 for " "first neighbors"); if (id_fix_update) { modify->delete_fix(id_fix_update); @@ -106,18 +106,18 @@ void BondBPM::init_style() } else { // Require atoms know about all of their bonds and if they break if (force->newton_bond && break_flag) - error->all(FLERR, "Without overlay/pair or break/no, BPM bond styles require Newton bond off"); + error->all(FLERR, "With overlay/pair no, or break no, BPM bond styles require Newton bond off"); // special lj must be 0 1 1 to censor pair forces between bonded particles - // special coulomb must be 1 1 1 to ensure all pairs are included in the - // neighbor list and 1-3 and 1-4 special bond lists are skipped if (force->special_lj[1] != 0.0 || force->special_lj[2] != 1.0 || force->special_lj[3] != 1.0) error->all(FLERR, - "Without overlay/pair, BPM bond styles requires special LJ weights = 0,1,1"); - if (force->special_coul[1] != 1.0 || force->special_coul[2] != 1.0 || - force->special_coul[3] != 1.0) + "With overlay/pair no, BPM bond styles require special LJ weights = 0,1,1"); + // if bonds can break, special coulomb must be 1 1 1 to ensure all pairs are included in the + // neighbor list and 1-3 and 1-4 special bond lists are skipped + if (break_flag && (force->special_coul[1] != 1.0 || force->special_coul[2] != 1.0 || + force->special_coul[3] != 1.0)) error->all(FLERR, - "Without overlay/pair, BPM bond styles requires special Coulomb weights = 1,1,1"); + "With overlay/pair no, and break yes, BPM bond styles requires special Coulomb weights = 1,1,1"); if (id_fix_dummy && break_flag) { id_fix_update = utils::strdup("BPM_UPDATE_SPECIAL_BONDS"); @@ -335,7 +335,7 @@ void BondBPM::read_restart(FILE *fp) void BondBPM::process_broken(int i, int j) { if (!break_flag) - error->one(FLERR, "BPM bond broke with break/no option"); + error->one(FLERR, "BPM bond broke with break no option"); if (fix_store_local) { for (int n = 0; n < nvalues; n++) (this->*pack_choice[n])(n, i, j); From 651ed1960d19de9c88b4822630b59d346cae8d64 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Fri, 7 Jul 2023 18:29:28 -0400 Subject: [PATCH 352/396] add per-atom data bugfix from Stan for fix ave/histo and fix ave/histo/weight --- src/fix_ave_histo.cpp | 2 +- src/fix_ave_histo_weight.cpp | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/fix_ave_histo.cpp b/src/fix_ave_histo.cpp index 157e43610a..0a2975bb2e 100644 --- a/src/fix_ave_histo.cpp +++ b/src/fix_ave_histo.cpp @@ -590,7 +590,7 @@ void FixAveHisto::end_of_step() } else if (kind == PERATOM) { if (j == 0) bin_atoms(val.val.f->vector_atom,1); else if (val.val.f->array_atom) - bin_atoms(val.val.f->array_atom[j-1],val.val.f->size_peratom_cols); + bin_atoms(&val.val.f->array_atom[0][j-1],val.val.f->size_peratom_cols); } else if (kind == LOCAL) { if (j == 0) bin_vector(val.val.f->size_local_rows,val.val.f->vector_local,1); diff --git a/src/fix_ave_histo_weight.cpp b/src/fix_ave_histo_weight.cpp index 17dd00440e..181aa2a79d 100644 --- a/src/fix_ave_histo_weight.cpp +++ b/src/fix_ave_histo_weight.cpp @@ -212,7 +212,7 @@ void FixAveHistoWeight::end_of_step() weights = val.val.f->vector_atom; stride = 1; } else if (val.val.f->array_atom) { - weights = val.val.f->array_atom[j-1]; + weights = &val.val.f->array_atom[0][j-1]; stride = val.val.f->size_peratom_cols; } } else if (kind == LOCAL) { @@ -339,7 +339,7 @@ void FixAveHistoWeight::end_of_step() if (j == 0) bin_atoms_weights(val.val.f->vector_atom,1,weights,stride); else if (val.val.f->array_atom) - bin_atoms_weights(val.val.f->array_atom[j-1],val.val.f->size_peratom_cols, + bin_atoms_weights(&val.val.f->array_atom[0][j-1],val.val.f->size_peratom_cols, weights,stride); From d6412dc97b86c0dc95a8f9a014ab75796bd6c12f Mon Sep 17 00:00:00 2001 From: Trung Nguyen Date: Sat, 8 Jul 2023 00:50:19 -0500 Subject: [PATCH 353/396] Attempted to resolve issues with switching from acctyp4 to acctyp3 in tep, fieldp since the changes in PR #3675, noting some changes with Intel OCL PR #3663 --- lib/gpu/lal_base_amoeba.cpp | 5 +++++ lib/gpu/lal_base_amoeba.h | 2 +- lib/gpu/lal_hippo.cpp | 16 ++++++++++------ src/GPU/pair_amoeba_gpu.cpp | 30 +++++++++++++++--------------- src/GPU/pair_hippo_gpu.cpp | 30 +++++++++++++++--------------- 5 files changed, 46 insertions(+), 37 deletions(-) diff --git a/lib/gpu/lal_base_amoeba.cpp b/lib/gpu/lal_base_amoeba.cpp index 0821a33b06..c41c66fb5f 100644 --- a/lib/gpu/lal_base_amoeba.cpp +++ b/lib/gpu/lal_base_amoeba.cpp @@ -420,6 +420,11 @@ void BaseAmoebaT::compute_udirect2b(int *host_amtype, int *host_amgroup, double cast_extra_data(host_amtype, host_amgroup, host_rpole, host_uind, host_uinp, host_pval); atom->add_extra_data(); + if (_max_tep_size>_max_fieldp_size) { + _max_fieldp_size = _max_tep_size; + _fieldp.resize(_max_fieldp_size*6); + } + *fieldp_ptr=_fieldp.host.begin(); // specify the correct cutoff and alpha values diff --git a/lib/gpu/lal_base_amoeba.h b/lib/gpu/lal_base_amoeba.h index 0eaaafeb1e..f415b30334 100644 --- a/lib/gpu/lal_base_amoeba.h +++ b/lib/gpu/lal_base_amoeba.h @@ -203,7 +203,7 @@ class BaseAmoeba { virtual void update_fieldp(void **fieldp_ptr) { *fieldp_ptr=_fieldp.host.begin(); // _fieldp store both arrays, one after another - _fieldp.update_host(_max_fieldp_size*8,false); + _fieldp.update_host(_max_fieldp_size*6,false); } /// setup a plan for FFT, where size is the number of elements diff --git a/lib/gpu/lal_hippo.cpp b/lib/gpu/lal_hippo.cpp index 24ffae8de2..8d6ad5dfb2 100644 --- a/lib/gpu/lal_hippo.cpp +++ b/lib/gpu/lal_hippo.cpp @@ -211,7 +211,7 @@ void HippoT::compute_repulsion(const int /*ago*/, const int inum_full, if (inum_full>this->_max_tep_size) { this->_max_tep_size=static_cast(static_cast(inum_full)*1.10); - this->_tep.resize(this->_max_tep_size*4); + this->_tep.resize(this->_max_tep_size*3); } *tep_ptr=this->_tep.host.begin(); @@ -226,7 +226,7 @@ void HippoT::compute_repulsion(const int /*ago*/, const int inum_full, repulsion(this->_eflag,this->_vflag); // copy tep from device to host - this->_tep.update_host(this->_max_tep_size*4,false); + this->_tep.update_host(this->_max_tep_size*3,false); } // --------------------------------------------------------------------------- @@ -366,7 +366,7 @@ void HippoT::compute_multipole_real(const int /*ago*/, const int inum_full, if (inum_full>this->_max_tep_size) { this->_max_tep_size=static_cast(static_cast(inum_full)*1.10); - this->_tep.resize(this->_max_tep_size*4); + this->_tep.resize(this->_max_tep_size*3); } *tep_ptr=this->_tep.host.begin(); @@ -376,7 +376,7 @@ void HippoT::compute_multipole_real(const int /*ago*/, const int inum_full, multipole_real(this->_eflag,this->_vflag); // copy tep from device to host - this->_tep.update_host(this->_max_tep_size*4,false); + this->_tep.update_host(this->_max_tep_size*3,false); } // --------------------------------------------------------------------------- @@ -434,6 +434,10 @@ void HippoT::compute_udirect2b(int * /*host_amtype*/, int * /*host_amgroup*/, do this->cast_extra_data(nullptr, nullptr, nullptr, host_uind, host_uinp, host_pval); this->atom->add_extra_data(); + if (this->_max_tep_size>this->_max_fieldp_size) { + this->_max_fieldp_size = this->_max_tep_size; + this->_fieldp.resize(this->_max_fieldp_size*6); + } *fieldp_ptr=this->_fieldp.host.begin(); this->_off2_polar = off2_polar; @@ -442,7 +446,7 @@ void HippoT::compute_udirect2b(int * /*host_amtype*/, int * /*host_amgroup*/, do // copy field and fieldp from device to host (_fieldp store both arrays, one after another) - this->_fieldp.update_host(this->_max_fieldp_size*8,false); + this->_fieldp.update_host(this->_max_fieldp_size*6,false); } // --------------------------------------------------------------------------- @@ -580,7 +584,7 @@ void HippoT::compute_polar_real(int * /*host_amtype*/, int * /*host_amgroup*/, d this->device->add_ans_object(this->ans); // copy tep from device to host - this->_tep.update_host(this->_max_tep_size*4,false); + this->_tep.update_host(this->_max_tep_size*3,false); } // --------------------------------------------------------------------------- diff --git a/src/GPU/pair_amoeba_gpu.cpp b/src/GPU/pair_amoeba_gpu.cpp index b7e1f8e118..8b3cf2cfea 100644 --- a/src/GPU/pair_amoeba_gpu.cpp +++ b/src/GPU/pair_amoeba_gpu.cpp @@ -745,15 +745,15 @@ void PairAmoebaGPU::udirect2b(double **field, double **fieldp) auto field_ptr = (float *)fieldp_pinned; for (int i = 0; i < nlocal; i++) { - int idx = 4*i; + int idx = 3*i; field[i][0] += field_ptr[idx]; field[i][1] += field_ptr[idx+1]; field[i][2] += field_ptr[idx+2]; } - field_ptr += 4*inum; + field_ptr += 3*inum; for (int i = 0; i < nlocal; i++) { - int idx = 4*i; + int idx = 3*i; fieldp[i][0] += field_ptr[idx]; fieldp[i][1] += field_ptr[idx+1]; fieldp[i][2] += field_ptr[idx+2]; @@ -762,15 +762,15 @@ void PairAmoebaGPU::udirect2b(double **field, double **fieldp) auto field_ptr = (double *)fieldp_pinned; for (int i = 0; i < nlocal; i++) { - int idx = 4*i; + int idx = 3*i; field[i][0] += field_ptr[idx]; field[i][1] += field_ptr[idx+1]; field[i][2] += field_ptr[idx+2]; } - field_ptr += 4*inum; + field_ptr += 3*inum; for (int i = 0; i < nlocal; i++) { - int idx = 4*i; + int idx = 3*i; fieldp[i][0] += field_ptr[idx]; fieldp[i][1] += field_ptr[idx+1]; fieldp[i][2] += field_ptr[idx+2]; @@ -976,15 +976,15 @@ void PairAmoebaGPU::ufield0c(double **field, double **fieldp) auto field_ptr = (float *)fieldp_pinned; for (int i = 0; i < nlocal; i++) { - int idx = 4*i; + int idx = 3*i; field[i][0] += field_ptr[idx]; field[i][1] += field_ptr[idx+1]; field[i][2] += field_ptr[idx+2]; } - field_ptr += 4*inum; + field_ptr += 3*inum; for (int i = 0; i < nlocal; i++) { - int idx = 4*i; + int idx = 3*i; fieldp[i][0] += field_ptr[idx]; fieldp[i][1] += field_ptr[idx+1]; fieldp[i][2] += field_ptr[idx+2]; @@ -993,15 +993,15 @@ void PairAmoebaGPU::ufield0c(double **field, double **fieldp) auto field_ptr = (double *)fieldp_pinned; for (int i = 0; i < nlocal; i++) { - int idx = 4*i; + int idx = 3*i; field[i][0] += field_ptr[idx]; field[i][1] += field_ptr[idx+1]; field[i][2] += field_ptr[idx+2]; } - field_ptr += 4*inum; + field_ptr += 3*inum; for (int i = 0; i < nlocal; i++) { - int idx = 4*i; + int idx = 3*i; fieldp[i][0] += field_ptr[idx]; fieldp[i][1] += field_ptr[idx+1]; fieldp[i][2] += field_ptr[idx+2]; @@ -2029,9 +2029,9 @@ void PairAmoebaGPU::compute_force_from_torque(const numtyp* tq_ptr, int nlocal = atom->nlocal; for (i = 0; i < nlocal; i++) { - _tq[0] = tq_ptr[4*i]; - _tq[1] = tq_ptr[4*i+1]; - _tq[2] = tq_ptr[4*i+2]; + _tq[0] = tq_ptr[3*i]; + _tq[1] = tq_ptr[3*i+1]; + _tq[2] = tq_ptr[3*i+2]; torque2force(i,_tq,fix,fiy,fiz,force_comp); iz = zaxis2local[i]; diff --git a/src/GPU/pair_hippo_gpu.cpp b/src/GPU/pair_hippo_gpu.cpp index f87676ec08..256b4088d8 100644 --- a/src/GPU/pair_hippo_gpu.cpp +++ b/src/GPU/pair_hippo_gpu.cpp @@ -859,15 +859,15 @@ void PairHippoGPU::udirect2b(double **field, double **fieldp) auto field_ptr = (float *)fieldp_pinned; for (int i = 0; i < nlocal; i++) { - int idx = 4*i; + int idx = 3*i; field[i][0] += field_ptr[idx]; field[i][1] += field_ptr[idx+1]; field[i][2] += field_ptr[idx+2]; } - field_ptr += 4*inum; + field_ptr += 3*inum; for (int i = 0; i < nlocal; i++) { - int idx = 4*i; + int idx = 3*i; fieldp[i][0] += field_ptr[idx]; fieldp[i][1] += field_ptr[idx+1]; fieldp[i][2] += field_ptr[idx+2]; @@ -877,15 +877,15 @@ void PairHippoGPU::udirect2b(double **field, double **fieldp) auto field_ptr = (double *)fieldp_pinned; for (int i = 0; i < nlocal; i++) { - int idx = 4*i; + int idx = 3*i; field[i][0] += field_ptr[idx]; field[i][1] += field_ptr[idx+1]; field[i][2] += field_ptr[idx+2]; } - field_ptr += 4*inum; + field_ptr += 3*inum; for (int i = 0; i < nlocal; i++) { - int idx = 4*i; + int idx = 3*i; fieldp[i][0] += field_ptr[idx]; fieldp[i][1] += field_ptr[idx+1]; fieldp[i][2] += field_ptr[idx+2]; @@ -1087,15 +1087,15 @@ void PairHippoGPU::ufield0c(double **field, double **fieldp) auto *field_ptr = (float *)fieldp_pinned; for (int i = 0; i < nlocal; i++) { - int idx = 4*i; + int idx = 3*i; field[i][0] += field_ptr[idx]; field[i][1] += field_ptr[idx+1]; field[i][2] += field_ptr[idx+2]; } - field_ptr += 4*inum; + field_ptr += 3*inum; for (int i = 0; i < nlocal; i++) { - int idx = 4*i; + int idx = 3*i; fieldp[i][0] += field_ptr[idx]; fieldp[i][1] += field_ptr[idx+1]; fieldp[i][2] += field_ptr[idx+2]; @@ -1105,15 +1105,15 @@ void PairHippoGPU::ufield0c(double **field, double **fieldp) auto *field_ptr = (double *)fieldp_pinned; for (int i = 0; i < nlocal; i++) { - int idx = 4*i; + int idx = 3*i; field[i][0] += field_ptr[idx]; field[i][1] += field_ptr[idx+1]; field[i][2] += field_ptr[idx+2]; } - field_ptr += 4*inum; + field_ptr += 3*inum; for (int i = 0; i < nlocal; i++) { - int idx = 4*i; + int idx = 3*i; fieldp[i][0] += field_ptr[idx]; fieldp[i][1] += field_ptr[idx+1]; fieldp[i][2] += field_ptr[idx+2]; @@ -1456,9 +1456,9 @@ void PairHippoGPU::compute_force_from_torque(const numtyp* tq_ptr, int nlocal = atom->nlocal; for (i = 0; i < nlocal; i++) { - _tq[0] = tq_ptr[4*i]; - _tq[1] = tq_ptr[4*i+1]; - _tq[2] = tq_ptr[4*i+2]; + _tq[0] = tq_ptr[3*i]; + _tq[1] = tq_ptr[3*i+1]; + _tq[2] = tq_ptr[3*i+2]; torque2force(i,_tq,fix,fiy,fiz,force_comp); iz = zaxis2local[i]; From 75a2557e826eab29aaf277f2960b9bb7f438173e Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Sun, 9 Jul 2023 15:41:39 -0400 Subject: [PATCH 354/396] fix bugs where an Atom::tag value was stored in an int and not a tagint --- src/MANYBODY/pair_gw.cpp | 3 ++- src/MGPT/pair_mgpt.cpp | 3 +-- src/OPENMP/npair_half_nsq_newton_omp.cpp | 4 ++-- src/OPENMP/npair_half_respa_nsq_newton_omp.cpp | 4 ++-- src/OPENMP/npair_half_size_nsq_newton_omp.cpp | 4 ++-- src/npair_half_respa_nsq_newton.cpp | 4 ++-- src/npair_half_size_nsq_newton.cpp | 4 ++-- 7 files changed, 13 insertions(+), 13 deletions(-) diff --git a/src/MANYBODY/pair_gw.cpp b/src/MANYBODY/pair_gw.cpp index be2a1e41f3..1fd98b80f0 100644 --- a/src/MANYBODY/pair_gw.cpp +++ b/src/MANYBODY/pair_gw.cpp @@ -73,7 +73,8 @@ PairGW::~PairGW() void PairGW::compute(int eflag, int vflag) { int i,j,k,ii,jj,kk,inum,jnum; - int itag,jtag,itype,jtype,ktype,iparam_ij,iparam_ijk; + int itype,jtype,ktype,iparam_ij,iparam_ijk; + tagint itag,jtag; double xtmp,ytmp,ztmp,delx,dely,delz,evdwl,fpair; double rsq,rsq1,rsq2; double delr1[3],delr2[3],fi[3],fj[3],fk[3]; diff --git a/src/MGPT/pair_mgpt.cpp b/src/MGPT/pair_mgpt.cpp index 5c4b889f8a..c924cbea84 100644 --- a/src/MGPT/pair_mgpt.cpp +++ b/src/MGPT/pair_mgpt.cpp @@ -589,8 +589,7 @@ void PairMGPT::compute_x(const int *nnei,const int * const *nlist, double *e_s,double *e_p,double *e_t,double *e_q, int evflag,int newton_pair) { Hash bond_hash(100000); - int i,j,k,m,ix,jx,kx,mx,itag,jtag,p; - + int i,j,k,m,ix,jx,kx,mx,p; double e_single,e_pair,e_triplet,e_triplet_c,e_quad; double volvir2; diff --git a/src/OPENMP/npair_half_nsq_newton_omp.cpp b/src/OPENMP/npair_half_nsq_newton_omp.cpp index cb08cb7f7a..5996cd2013 100644 --- a/src/OPENMP/npair_half_nsq_newton_omp.cpp +++ b/src/OPENMP/npair_half_nsq_newton_omp.cpp @@ -49,8 +49,8 @@ void NPairHalfNsqNewtonOmp::build(NeighList *list) #endif NPAIR_OMP_SETUP(nlocal); - int i,j,n,itype,jtype,itag,jtag,which,imol,iatom; - tagint tagprev; + int i,j,n,itype,jtype,which,imol,iatom; + tagint itag,jtag,tagprev; double xtmp,ytmp,ztmp,delx,dely,delz,rsq; int *neighptr; diff --git a/src/OPENMP/npair_half_respa_nsq_newton_omp.cpp b/src/OPENMP/npair_half_respa_nsq_newton_omp.cpp index 6604861f74..61d9165b1e 100644 --- a/src/OPENMP/npair_half_respa_nsq_newton_omp.cpp +++ b/src/OPENMP/npair_half_respa_nsq_newton_omp.cpp @@ -55,8 +55,8 @@ void NPairHalfRespaNsqNewtonOmp::build(NeighList *list) #endif NPAIR_OMP_SETUP(nlocal); - int i,j,n,itype,jtype,itag,jtag,n_inner,n_middle,imol,iatom; - tagint tagprev; + int i,j,n,itype,jtype,n_inner,n_middle,imol,iatom; + tagint itag,jtag,tagprev; double xtmp,ytmp,ztmp,delx,dely,delz,rsq; int *neighptr,*neighptr_inner,*neighptr_middle; diff --git a/src/OPENMP/npair_half_size_nsq_newton_omp.cpp b/src/OPENMP/npair_half_size_nsq_newton_omp.cpp index 35dc42ec5b..fe2a1be3da 100644 --- a/src/OPENMP/npair_half_size_nsq_newton_omp.cpp +++ b/src/OPENMP/npair_half_size_nsq_newton_omp.cpp @@ -58,8 +58,8 @@ void NPairHalfSizeNsqNewtonOmp::build(NeighList *list) #endif NPAIR_OMP_SETUP(nlocal); - int i,j,jh,n,itag,jtag,which,imol,iatom; - tagint tagprev; + int i,j,jh,n,which,imol,iatom; + tagint itag,jtag,tagprev; double xtmp,ytmp,ztmp,delx,dely,delz,rsq; double radi,radsum,cutsq; int *neighptr; diff --git a/src/npair_half_respa_nsq_newton.cpp b/src/npair_half_respa_nsq_newton.cpp index 77d6af141f..d231cddb87 100644 --- a/src/npair_half_respa_nsq_newton.cpp +++ b/src/npair_half_respa_nsq_newton.cpp @@ -38,9 +38,9 @@ NPairHalfRespaNsqNewton::NPairHalfRespaNsqNewton(LAMMPS *lmp) : NPair(lmp) {} void NPairHalfRespaNsqNewton::build(NeighList *list) { - int i,j,n,itype,jtype,itag,jtag,n_inner,n_middle,bitmask; + int i,j,n,itype,jtype,n_inner,n_middle,bitmask; int imol,iatom,moltemplate; - tagint tagprev; + tagint itag,jtag,tagprev; double xtmp,ytmp,ztmp,delx,dely,delz,rsq; int *neighptr,*neighptr_inner,*neighptr_middle; diff --git a/src/npair_half_size_nsq_newton.cpp b/src/npair_half_size_nsq_newton.cpp index 8b596e6968..93d65c7a45 100644 --- a/src/npair_half_size_nsq_newton.cpp +++ b/src/npair_half_size_nsq_newton.cpp @@ -39,8 +39,8 @@ NPairHalfSizeNsqNewton::NPairHalfSizeNsqNewton(LAMMPS *lmp) : NPair(lmp) {} void NPairHalfSizeNsqNewton::build(NeighList *list) { - int i,j,jh,n,itag,jtag,bitmask,which,imol,iatom,moltemplate; - tagint tagprev; + int i,j,jh,n,bitmask,which,imol,iatom,moltemplate; + tagint itag,jtag,tagprev; double xtmp,ytmp,ztmp,delx,dely,delz,rsq; double radi,radsum,cutsq; int *neighptr; From 0718114a67cdf5ff970965a4a457c280cd1f59d6 Mon Sep 17 00:00:00 2001 From: jbcouli Date: Sun, 9 Jul 2023 17:43:39 -0600 Subject: [PATCH 355/396] fix typo for broken links in doc --- doc/src/fix_ave_grid.rst | 4 ++-- doc/src/variable.rst | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/doc/src/fix_ave_grid.rst b/doc/src/fix_ave_grid.rst index 5760bb4508..da0d1f957b 100644 --- a/doc/src/fix_ave_grid.rst +++ b/doc/src/fix_ave_grid.rst @@ -129,12 +129,12 @@ overlays the simulation box. For 2d simulations, *Nz* must be 1. The very coarse compared to the particle count, or very fine. If one or more of the values = 1, then bins are 2d planes or 1d slices of the simulation domain. Note that if the total number of grid cells is -small, it may be more efficient to use the doc:`fix ave/chunk +small, it may be more efficient to use the :doc:`fix ave/chunk ` command which can treat a grid defined by the :doc:`compute chunk/atom ` command as a global grid where each processor owns a copy of all the grid cells. If *Nx* = *Ny* = *Nz* = 1 is used, the same calculation would be more -efficiently performed by the doc:`fix ave/atom ` +efficiently performed by the :doc:`fix ave/atom ` command. If the simulation box size or shape changes during a simulation, the diff --git a/doc/src/variable.rst b/doc/src/variable.rst index 67600af62d..a9d21bab9b 100644 --- a/doc/src/variable.rst +++ b/doc/src/variable.rst @@ -1441,7 +1441,7 @@ timestep that the variable needs the tallies. An input script can also request variables be evaluated before or after or in between runs, e.g. by including them in a :doc:`print ` command. -LAMMPS keeps track of all of this as it performs a doc:`run ` or +LAMMPS keeps track of all of this as it performs a :doc:`run ` or :doc:`minimize ` simulation, as well as in between simulations. An error will be generated if you attempt to evaluate a variable when LAMMPS knows it cannot produce accurate values. For @@ -1453,7 +1453,7 @@ command, then an error will occur. However, there are two special cases to be aware when a variable requires invocation of a compute (directly or indirectly). The first -is if the variable is evaluated before the first doc:`run ` or +is if the variable is evaluated before the first :doc:`run ` or :doc:`minimize ` command in the input script. In this case, LAMMPS will generate an error. This is because many computes require initializations which have not yet taken place. One example is the @@ -1463,10 +1463,10 @@ energy or virial quantities; these values are not tallied until the first simulation begins. The second special case is when a variable that depends on a compute -is evaluated in between doc:`run ` or :doc:`minimize ` +is evaluated in between :doc:`run ` or :doc:`minimize ` commands. It is possible for other input script commands issued following the previous run, but before the variable is evaluated, to -change the system. For example, the doc:`delete_atoms ` +change the system. For example, the :doc:`delete_atoms ` command could be used to remove atoms. Since the compute will not re-initialize itself until the next simulation or it may depend on energy/virial computations performed before the system was changed, it From 60b45f97661a6d6506f771602f716620a39d1ce3 Mon Sep 17 00:00:00 2001 From: jbcouli Date: Sun, 9 Jul 2023 18:01:19 -0600 Subject: [PATCH 356/396] correct error message --- doc/src/Howto_bpm.rst | 2 +- src/BPM/bond_bpm.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/doc/src/Howto_bpm.rst b/doc/src/Howto_bpm.rst index 1c30b177e7..448a43a654 100644 --- a/doc/src/Howto_bpm.rst +++ b/doc/src/Howto_bpm.rst @@ -109,7 +109,7 @@ charges in BPM models, setting a nonzero coul weight for 1-2 bonds ensures all bonded neighbors are still included in the neighbor list in case bonds break between neighbor list builds. If bond breakage is disabled during a simulation run by setting the *break* keyword to *no*, -a zero coul weight for 1-2 bonds can be used to exclude bonded neighbors +a zero coul weight for 1-2 bonds can be used to exclude bonded atoms from the neighbor list builds. This can be useful for post-processing, or to determine pair interaction properties between distinct bonded particles. diff --git a/src/BPM/bond_bpm.cpp b/src/BPM/bond_bpm.cpp index 4f3577b2ca..023988b64d 100644 --- a/src/BPM/bond_bpm.cpp +++ b/src/BPM/bond_bpm.cpp @@ -106,7 +106,7 @@ void BondBPM::init_style() } else { // Require atoms know about all of their bonds and if they break if (force->newton_bond && break_flag) - error->all(FLERR, "With overlay/pair no, or break no, BPM bond styles require Newton bond off"); + error->all(FLERR, "With overlay/pair no, or break yes, BPM bond styles require Newton bond off"); // special lj must be 0 1 1 to censor pair forces between bonded particles if (force->special_lj[1] != 0.0 || force->special_lj[2] != 1.0 || force->special_lj[3] != 1.0) From 91b16c59452c64e7df22864c6fd3ad74442fb554 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Sun, 9 Jul 2023 21:10:44 -0400 Subject: [PATCH 357/396] make certain conductivity class member is always initialized --- src/GRANULAR/gran_sub_mod_heat.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/GRANULAR/gran_sub_mod_heat.cpp b/src/GRANULAR/gran_sub_mod_heat.cpp index 75dcd30b73..c3dd9ea5dc 100644 --- a/src/GRANULAR/gran_sub_mod_heat.cpp +++ b/src/GRANULAR/gran_sub_mod_heat.cpp @@ -49,6 +49,7 @@ GranSubModHeatArea::GranSubModHeatArea(GranularModel *gm, LAMMPS *lmp) : GranSub { num_coeffs = 1; contact_radius_flag = 1; + conductivity = 0.0; } /* ---------------------------------------------------------------------- */ From 2607212363d2697a7d5d82f3f8615254b6fde20a Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Sun, 9 Jul 2023 21:21:39 -0400 Subject: [PATCH 358/396] update for upstream changes --- src/GRANULAR/gran_sub_mod_heat.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/GRANULAR/gran_sub_mod_heat.cpp b/src/GRANULAR/gran_sub_mod_heat.cpp index 9dffdfa7d7..5378a72fd4 100644 --- a/src/GRANULAR/gran_sub_mod_heat.cpp +++ b/src/GRANULAR/gran_sub_mod_heat.cpp @@ -49,6 +49,7 @@ GranSubModHeatRadius::GranSubModHeatRadius(GranularModel *gm, LAMMPS *lmp) : Gra { num_coeffs = 1; contact_radius_flag = 1; + conductivity = 0.0; } /* ---------------------------------------------------------------------- */ @@ -76,7 +77,7 @@ GranSubModHeatArea::GranSubModHeatArea(GranularModel *gm, LAMMPS *lmp) : GranSub { num_coeffs = 1; contact_radius_flag = 1; - conductivity = 0.0; + heat_transfer_coeff = 0.0; } /* ---------------------------------------------------------------------- */ From 55343d715c3597ff11d50a583a04d1e2d3b7dd00 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Sun, 9 Jul 2023 21:39:51 -0400 Subject: [PATCH 359/396] update URL --- doc/src/Bibliography.rst | 2 +- doc/src/fix_electron_stopping.rst | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/doc/src/Bibliography.rst b/doc/src/Bibliography.rst index 2d27d2e6f9..e9ea8b0925 100644 --- a/doc/src/Bibliography.rst +++ b/doc/src/Bibliography.rst @@ -203,7 +203,7 @@ Bibliography A Caro, DA Crowson, M Caro; Phys Rev Lett, 95, 075702 (2005) **(CasP)** - CasP webpage: https://www.helmholtz-berlin.de/people/gregor-schiwietz/casp_en.html + CasP webpage: http://www.casp-program.org/ **(Cawkwell2012)** A.\ M. N. Niklasson, M. J. Cawkwell, Phys. Rev. B, 86 (17), 174308 (2012). diff --git a/doc/src/fix_electron_stopping.rst b/doc/src/fix_electron_stopping.rst index fa0fc763f5..a90d0932ee 100644 --- a/doc/src/fix_electron_stopping.rst +++ b/doc/src/fix_electron_stopping.rst @@ -204,7 +204,7 @@ The default is no limitation by region, and minneigh = 1. .. _CasP: -**(CasP)** CasP webpage: https://www.helmholtz-berlin.de/people/gregor-schiwietz/casp_en.html +**(CasP)** CasP webpage: http://www.casp-program.org/ .. _PASS: From a4b3306b7cf1fccff293a6b75403c7036f98aac5 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Mon, 10 Jul 2023 18:48:13 -0400 Subject: [PATCH 360/396] fix error message --- src/compute_property_atom.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/compute_property_atom.cpp b/src/compute_property_atom.cpp index fbb9129b6e..c3c101b995 100644 --- a/src/compute_property_atom.cpp +++ b/src/compute_property_atom.cpp @@ -376,7 +376,7 @@ ComputePropertyAtom::ComputePropertyAtom(LAMMPS *lmp, int narg, char **arg) : index[i] = atom->avec->property_atom(arg[iarg]); if (index[i] < 0) error->all(FLERR,"Invalid keyword {} for atom style {} in compute property/atom command ", - atom->get_style(), arg[iarg]); + arg[iarg], atom->get_style()); pack_choice[i] = &ComputePropertyAtom::pack_atom_style; } } From c63c9711d5942c6eea177bbb04f94713d28d3ca0 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Mon, 10 Jul 2023 19:42:48 -0400 Subject: [PATCH 361/396] update remaining ellipsoid example dump output for OVITO compatibility --- examples/ASPHERE/ellipsoid/in.ellipsoid | 6 +-- examples/ASPHERE/ellipsoid/in.ellipsoid.mp | 6 +-- examples/ellipse/in.ellipse.gayberne | 53 ++++++++++---------- examples/ellipse/in.ellipse.resquared | 56 ++++++++++++---------- 4 files changed, 61 insertions(+), 60 deletions(-) diff --git a/examples/ASPHERE/ellipsoid/in.ellipsoid b/examples/ASPHERE/ellipsoid/in.ellipsoid index 2dda95a029..1ee59597da 100644 --- a/examples/ASPHERE/ellipsoid/in.ellipsoid +++ b/examples/ASPHERE/ellipsoid/in.ellipsoid @@ -35,8 +35,7 @@ fix 2 all enforce2d compute rot big temp/asphere compute 0 all property/atom quatw quati quatj quatk shapex shapey shapez -#dump 1 all custom 10 dump.ellipsoid.equil id type x y z & -# c_0[1] c_0[2] c_0[3] c_0[4] c_0[5] c_0[6] c_0[7] +#dump 1 all custom 10 dump.ellipsoid.equil id type x y z c_0[*] #dump_modify 1 colname c_0[1] quatw colname c_0[2] quati colname c_0[3] quatj colname c_0[4] quatk & # colname c_0[5] shapex colname c_0[6] shapey colname c_0[7] shapez @@ -110,8 +109,7 @@ thermo_style custom step temp c_rot f_2[9] etotal v_pebig v_ebig press & thermo_modify temp tbig thermo 1000 -#dump 1 all custom 1000 dump.ellipsoid id type x y z & -# c_0[1] c_0[2] c_0[3] c_0[4] c_0[5] c_0[6] c_0[7] +#dump 1 all custom 1000 dump.ellipsoid id type x y z c_0[*] #dump_modify 1 colname c_0[1] quatw colname c_0[2] quati colname c_0[3] quatj colname c_0[4] quatk & # colname c_0[5] shapex colname c_0[6] shapey colname c_0[7] shapez diff --git a/examples/ASPHERE/ellipsoid/in.ellipsoid.mp b/examples/ASPHERE/ellipsoid/in.ellipsoid.mp index e950cc86f5..31fe79eb58 100644 --- a/examples/ASPHERE/ellipsoid/in.ellipsoid.mp +++ b/examples/ASPHERE/ellipsoid/in.ellipsoid.mp @@ -35,8 +35,7 @@ fix 2 all enforce2d compute rot big temp/asphere compute 0 all property/atom quatw quati quatj quatk shapex shapey shapez -#dump 1 all custom 10 dump.ellipsoid.equil id type x y z & -# c_0[1] c_0[2] c_0[3] c_0[4] c_0[5] c_0[6] c_0[7] +#dump 1 all custom 10 dump.ellipsoid.equil id type x y z c_0[*] #dump_modify 1 colname c_0[1] quatw colname c_0[2] quati colname c_0[3] quatj colname c_0[4] quatk & # colname c_0[5] shapex colname c_0[6] shapey colname c_0[7] shapez @@ -111,8 +110,7 @@ thermo_style custom step temp c_rot f_2[9] etotal v_pebig v_ebig press & thermo_modify temp tbig thermo 1000 -#dump 1 all custom 500 dump.ellipsoid id type x y z & -# c_0[1] c_0[2] c_0[3] c_0[4] c_0[5] c_0[6] c_0[7] +#dump 1 all custom 500 dump.ellipsoid id type x y z c_0[*] #dump_modify 1 colname c_0[1] quatw colname c_0[2] quati colname c_0[3] quatj colname c_0[4] quatk & # colname c_0[5] shapex colname c_0[6] shapey colname c_0[7] shapez diff --git a/examples/ellipse/in.ellipse.gayberne b/examples/ellipse/in.ellipse.gayberne index fe783ac6de..0e6b21797a 100644 --- a/examples/ellipse/in.ellipse.gayberne +++ b/examples/ellipse/in.ellipse.gayberne @@ -1,23 +1,23 @@ # GayBerne ellipsoids in LJ background fluid -units lj +units lj atom_style ellipsoid dimension 2 -lattice sq 0.02 -region box block 0 20 0 20 -0.5 0.5 +lattice sq 0.02 +region box block 0 20 0 20 -0.5 0.5 create_box 2 box create_atoms 1 box -set group all type/fraction 2 0.1 95392 -set type 1 mass 1.0 -set type 2 mass 1.5 -set type 1 shape 1 1 1 -set type 2 shape 3 1 1 -set group all quat/random 18238 +set group all type/fraction 2 0.1 95392 +set type 1 mass 1.0 +set type 2 mass 1.5 +set type 1 shape 1 1 1 +set type 2 shape 3 1 1 +set group all quat/random 18238 -compute rot all temp/asphere -group spheroid type 1 +compute rot all temp/asphere +group spheroid type 1 variable dof equal count(spheroid)+2 compute_modify rot extra/dof ${dof} @@ -31,36 +31,37 @@ pair_coeff 2 2 1.0 1.0 1 1 0.2 0 0 0 neighbor 0.8 bin thermo_style custom step c_rot epair etotal press vol -thermo 100 +thermo 100 timestep 0.002 -compute q all property/atom quatw quati quatj quatk +compute 0 all property/atom quatw quati quatj quatk shapex shapey shapez -#dump 1 all custom 100 dump.ellipse.gayberne & -# id type x y z c_q[1] c_q[2] c_q[3] c_q[4] +dump 1 all custom 100 dump.ellipse.gayberne id type x y z c_0[*] +dump_modify 1 colname c_0[1] quatw colname c_0[2] quati colname c_0[3] quatj colname c_0[4] quatk & + colname c_0[5] shapex colname c_0[6] shapey colname c_0[7] shapez -#dump 2 all image 100 image.*.jpg type type & -# zoom 1.6 center d 0.5 0.5 0.5 +#dump 2 all image 100 image.*.jpg type type & +# zoom 1.6 center d 0.5 0.5 0.5 #dump_modify 2 pad 4 adiam 1 1.0 adiam 2 2.0 -#dump 3 all movie 100 movie.mpg type type & -# zoom 1.6 center d 0.5 0.5 0.5 +#dump 3 all movie 100 movie.mpg type type & +# zoom 1.6 center d 0.5 0.5 0.5 #dump_modify 3 pad 4 adiam 1 1.0 adiam 2 2.0 -fix 1 all npt/asphere temp 2.0 2.0 0.1 iso 0.0 1.0 1.0 & - mtk no pchain 0 tchain 1 -fix 2 all enforce2d +fix 1 all npt/asphere temp 2.0 2.0 0.1 iso 0.0 1.0 1.0 & + mtk no pchain 0 tchain 1 +fix 2 all enforce2d compute_modify 1_temp extra/dof ${dof} # equilibrate to shrink box around dilute system -run 2000 +run 2000 # run dynamics on dense system -unfix 1 -fix 1 all nve/asphere +unfix 1 +fix 1 all nve/asphere -run 2000 +run 2000 diff --git a/examples/ellipse/in.ellipse.resquared b/examples/ellipse/in.ellipse.resquared index 82398987f8..d5bc8897cb 100644 --- a/examples/ellipse/in.ellipse.resquared +++ b/examples/ellipse/in.ellipse.resquared @@ -1,23 +1,23 @@ # RESquared ellipsoids in LJ background fluid -units lj +units lj atom_style ellipsoid dimension 2 -lattice sq 0.02 -region box block 0 20 0 20 -0.5 0.5 +lattice sq 0.02 +region box block 0 20 0 20 -0.5 0.5 create_box 2 box create_atoms 1 box -set group all type/fraction 2 0.1 95392 -set type 1 mass 1.0 -set type 2 mass 1.5 -set type 1 shape 1 1 1 -set type 2 shape 3 1 1 -set group all quat/random 18238 +set group all type/fraction 2 0.1 95392 +set type 1 mass 1.0 +set type 2 mass 1.5 +set type 1 shape 1 1 1 +set type 2 shape 3 1 1 +set group all quat/random 18238 -compute rot all temp/asphere -group spheroid type 1 +compute rot all temp/asphere +group spheroid type 1 variable dof equal count(spheroid)+2 compute_modify rot extra/dof ${dof} @@ -31,36 +31,40 @@ pair_coeff 2 2 1.0 1 1 1 0.2 0 0 0 neighbor 0.8 bin thermo_style custom step c_rot epair etotal press vol -thermo 100 +thermo 100 timestep 0.002 -compute q all property/atom quatw quati quatj quatk +compute 0 all property/atom quatw quati quatj quatk shapex shapey shapez -#dump 1 all custom 100 dump.ellipse.resquared & -# id type x y z c_q[1] c_q[2] c_q[3] c_q[4] +dump 1 all custom 100 dump.ellipse.resquared id type x y z c_0[*] +dump_modify 1 colname c_0[1] quatw colname c_0[2] quati colname c_0[3] quatj colname c_0[4] quatk & + colname c_0[5] shapex colname c_0[6] shapey colname c_0[7] shapez -#dump 2 all image 100 image.*.jpg type type & -# zoom 1.6 center d 0.5 0.5 0.5 +#dump 1 all custom 100 dump.ellipse.resquared & +# id type x y z c_q[1] c_q[2] c_q[3] c_q[4] + +#dump 2 all image 100 image.*.jpg type type & +# zoom 1.6 center d 0.5 0.5 0.5 #dump_modify 2 pad 4 adiam 1 1.0 adiam 2 2.0 -#dump 3 all movie 100 movie.mpg type type & -# zoom 1.6 center d 0.5 0.5 0.5 +#dump 3 all movie 100 movie.mpg type type & +# zoom 1.6 center d 0.5 0.5 0.5 #dump_modify 3 pad 4 adiam 1 1.0 adiam 2 2.0 -fix 1 all npt/asphere temp 2.0 2.0 0.1 iso 0.0 1.0 1.0 & - mtk no pchain 0 tchain 1 -fix 2 all enforce2d +fix 1 all npt/asphere temp 2.0 2.0 0.1 iso 0.0 1.0 1.0 & + mtk no pchain 0 tchain 1 +fix 2 all enforce2d compute_modify 1_temp extra/dof ${dof} # equilibrate to shrink box around dilute system -run 2000 +run 2000 # run dynamics on dense system -unfix 1 -fix 1 all nve/asphere +unfix 1 +fix 1 all nve/asphere -run 2000 +run 2000 From 4d8ef552c4e4f2d894be6458054d186f246a0f3f Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Mon, 10 Jul 2023 22:42:49 -0400 Subject: [PATCH 362/396] remove dead code, trim namespace imports --- src/DIELECTRIC/fix_polarize_bem_gmres.cpp | 1 - src/DIELECTRIC/fix_polarize_functional.cpp | 9 +++------ 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/src/DIELECTRIC/fix_polarize_bem_gmres.cpp b/src/DIELECTRIC/fix_polarize_bem_gmres.cpp index 3945b76641..40f7d0c853 100644 --- a/src/DIELECTRIC/fix_polarize_bem_gmres.cpp +++ b/src/DIELECTRIC/fix_polarize_bem_gmres.cpp @@ -350,7 +350,6 @@ void FixPolarizeBEMGMRES::compute_induced_charges() double *ed = atom->ed; double *em = atom->em; double *epsilon = atom->epsilon; - int *mask = atom->mask; int nlocal = atom->nlocal; int eflag = 1; int vflag = 0; diff --git a/src/DIELECTRIC/fix_polarize_functional.cpp b/src/DIELECTRIC/fix_polarize_functional.cpp index ab039f9c48..dd0c0eb648 100644 --- a/src/DIELECTRIC/fix_polarize_functional.cpp +++ b/src/DIELECTRIC/fix_polarize_functional.cpp @@ -55,9 +55,9 @@ using namespace LAMMPS_NS; using namespace FixConst; -using namespace MathExtra; -using namespace MathConst; -using namespace MathSpecial; +using MathConst::MY_PI; +using MathConst::MY_PIS; +using MathSpecial::square; //#define _POLARIZE_DEBUG @@ -378,10 +378,7 @@ void FixPolarizeFunctional::update_induced_charges() // assign charges to the particles in the group double *q_scaled = atom->q_scaled; - double *q = atom->q; - double *epsilon = atom->epsilon; int nlocal = atom->nlocal; - double tmp = 0; for (int i = 0; i < nlocal; i++) { if (induced_charge_idx[i] < 0) continue; From 564a8e88c127926ae1ce84a75cbf1d4c129acf6a Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Tue, 11 Jul 2023 10:31:16 -0400 Subject: [PATCH 363/396] use blanks on both sides of comparison operators not only one, remove blanks next to parenthesis --- purge-workflows.py | 22 +++++++++++++++++++ src/EFF/pair_eff_cut.cpp | 4 ++-- src/EXTRA-DUMP/dump_xtc.cpp | 2 +- src/EXTRA-FIX/fix_wall_reflect_stochastic.cpp | 2 +- src/EXTRA-PAIR/pair_lj_relres.cpp | 2 +- src/INTEL/fix_intel.cpp | 2 +- src/INTERLAYER/pair_ilp_tmd.cpp | 4 ++-- src/KIM/pair_kim.cpp | 3 +-- src/KOKKOS/mliap_so3_kokkos.cpp | 2 +- src/KOKKOS/neigh_bond_kokkos.cpp | 4 ++-- src/MANYBODY/pair_comb3.cpp | 6 ++--- src/MANYBODY/pair_lcbop.cpp | 2 +- src/MISC/fix_ipi.cpp | 12 +++++----- src/MISC/pair_agni.cpp | 2 +- src/OPENMP/npair_full_bin_ghost_omp.cpp | 2 +- src/OPENMP/npair_full_bin_omp.cpp | 2 +- src/OPENMP/npair_full_nsq_ghost_omp.cpp | 2 +- src/OPENMP/npair_full_nsq_omp.cpp | 2 +- .../npair_half_bin_newtoff_ghost_omp.cpp | 2 +- src/OPENMP/npair_half_bin_newtoff_omp.cpp | 2 +- src/OPENMP/npair_half_bin_newton_omp.cpp | 4 ++-- src/OPENMP/npair_half_bin_newton_tri_omp.cpp | 2 +- .../npair_half_multi_old_newtoff_omp.cpp | 2 +- .../npair_half_multi_old_newton_omp.cpp | 4 ++-- .../npair_half_multi_old_newton_tri_omp.cpp | 2 +- .../npair_half_nsq_newtoff_ghost_omp.cpp | 2 +- src/OPENMP/npair_half_nsq_newtoff_omp.cpp | 2 +- src/OPENMP/npair_half_nsq_newton_omp.cpp | 2 +- .../npair_half_respa_bin_newtoff_omp.cpp | 2 +- .../npair_half_respa_bin_newton_omp.cpp | 4 ++-- .../npair_half_respa_bin_newton_tri_omp.cpp | 2 +- .../npair_half_respa_nsq_newtoff_omp.cpp | 2 +- .../npair_half_respa_nsq_newton_omp.cpp | 2 +- .../npair_half_size_bin_newtoff_omp.cpp | 2 +- src/OPENMP/npair_half_size_bin_newton_omp.cpp | 4 ++-- .../npair_half_size_bin_newton_tri_omp.cpp | 2 +- .../npair_half_size_multi_newtoff_omp.cpp | 4 ++-- .../npair_half_size_multi_newton_omp.cpp | 4 ++-- .../npair_half_size_multi_newton_tri_omp.cpp | 2 +- .../npair_half_size_multi_old_newtoff_omp.cpp | 2 +- .../npair_half_size_multi_old_newton_omp.cpp | 4 ++-- ...air_half_size_multi_old_newton_tri_omp.cpp | 2 +- .../npair_half_size_nsq_newtoff_omp.cpp | 2 +- src/OPENMP/npair_half_size_nsq_newton_omp.cpp | 2 +- src/PHONON/dynamical_matrix.cpp | 2 +- src/PHONON/third_order.cpp | 2 +- src/REACTION/fix_bond_react.cpp | 6 ++--- src/REAXFF/fix_reaxff_bonds.cpp | 2 +- src/SMTBQ/pair_smtbq.cpp | 16 +++++++------- src/VTK/dump_vtk.cpp | 2 +- src/atom.cpp | 8 +++---- src/library.cpp | 20 ++++++++--------- src/read_restart.cpp | 14 ++++++------ src/variable.cpp | 6 ++--- 54 files changed, 121 insertions(+), 100 deletions(-) create mode 100644 purge-workflows.py diff --git a/purge-workflows.py b/purge-workflows.py new file mode 100644 index 0000000000..73b7d22f7a --- /dev/null +++ b/purge-workflows.py @@ -0,0 +1,22 @@ +from yaml import load +import subprocess +try: + from yaml import CLoader as Loader +except ImportError: + from yaml import Loader + +runs = subprocess.check_output('gh api repos/lammps/lammps/actions/runs',shell=True) +data = load(runs,Loader=Loader) +while data['total_count'] > 3: + print('remaining: ', data['total_count']) + num=1 + for d in data['workflow_runs']: + print(num, d['id'],d['name'],d['run_number']) + num += 1 + if num > 4: + subprocess.call('gh api -X DELETE repos/lammps/lammps/actions/runs/' + str(d['id']), shell=True) + #print('gh api -X DELETE repos/lammps/lammps/actions/runs/' + str(d['id'])) + else: + print('skip') + runs = subprocess.check_output('gh api repos/lammps/lammps/actions/runs',shell=True) + data = load(runs,Loader=Loader) diff --git a/src/EFF/pair_eff_cut.cpp b/src/EFF/pair_eff_cut.cpp index 1cfe5cd1dd..5f32de9912 100644 --- a/src/EFF/pair_eff_cut.cpp +++ b/src/EFF/pair_eff_cut.cpp @@ -921,13 +921,13 @@ void PairEffCut::coeff(int narg, char **arg) } else { int ecp; ecp = utils::inumeric(FLERR,arg[0],false,lmp); - if (strcmp(arg[1],"s") ==0) { + if (strcmp(arg[1],"s") == 0) { PAULI_CORE_A[ecp_type[ecp]] = utils::numeric(FLERR,arg[2],false,lmp); PAULI_CORE_B[ecp_type[ecp]] = utils::numeric(FLERR,arg[3],false,lmp); PAULI_CORE_C[ecp_type[ecp]] = utils::numeric(FLERR,arg[4],false,lmp); PAULI_CORE_D[ecp_type[ecp]] = 0.0; PAULI_CORE_E[ecp_type[ecp]] = 0.0; - } else if (strcmp(arg[1],"p") ==0) { + } else if (strcmp(arg[1],"p") == 0) { PAULI_CORE_A[ecp_type[ecp]] = utils::numeric(FLERR,arg[2],false,lmp); PAULI_CORE_B[ecp_type[ecp]] = utils::numeric(FLERR,arg[3],false,lmp); PAULI_CORE_C[ecp_type[ecp]] = utils::numeric(FLERR,arg[4],false,lmp); diff --git a/src/EXTRA-DUMP/dump_xtc.cpp b/src/EXTRA-DUMP/dump_xtc.cpp index ba3f740cf7..798bdcb391 100644 --- a/src/EXTRA-DUMP/dump_xtc.cpp +++ b/src/EXTRA-DUMP/dump_xtc.cpp @@ -740,7 +740,7 @@ static void receiveints(int buf[], const int num_of_ints, int num_of_bits, } for (i = num_of_ints-1; i > 0; i--) { num = 0; - for (j = num_of_bytes-1; j >=0; j--) { + for (j = num_of_bytes-1; j >= 0; j--) { num = (num << 8) | bytes[j]; p = num / sizes[i]; bytes[j] = p; diff --git a/src/EXTRA-FIX/fix_wall_reflect_stochastic.cpp b/src/EXTRA-FIX/fix_wall_reflect_stochastic.cpp index c0b44530e8..c435cc14ae 100644 --- a/src/EXTRA-FIX/fix_wall_reflect_stochastic.cpp +++ b/src/EXTRA-FIX/fix_wall_reflect_stochastic.cpp @@ -109,7 +109,7 @@ FixWallReflectStochastic(LAMMPS *lmp, int narg, char **arg) : for (int dir = 0; dir < 3; dir++) { wallvel[nwall][dir]= utils::numeric(FLERR,arg[iarg+dir+3],false,lmp); int dim = wallwhich[nwall] / 2; - if ((wallvel[nwall][dir] !=0) & (dir == dim)) + if ((wallvel[nwall][dir] != 0) & (dir == dim)) error->all(FLERR,"The wall velocity must be tangential"); // DIFFUSIVE = no accommodation coeffs diff --git a/src/EXTRA-PAIR/pair_lj_relres.cpp b/src/EXTRA-PAIR/pair_lj_relres.cpp index 85d0a04bf9..1826f3f1db 100644 --- a/src/EXTRA-PAIR/pair_lj_relres.cpp +++ b/src/EXTRA-PAIR/pair_lj_relres.cpp @@ -453,7 +453,7 @@ double PairLJRelRes::init_one(int i, int j) offset[i][j] = 0.0; } - if (epsilonf[i][j] != 0 ) { // fg (cut=cutf coefficients) + if (epsilonf[i][j] != 0) { // fg (cut=cutf coefficients) ljf1[i][j] = 48.0 * epsilonf[i][j] * pow(sigmaf[i][j],12.0); ljf2[i][j] = 24.0 * epsilonf[i][j] * pow(sigmaf[i][j],6.0); ljf3[i][j] = 4.0 * epsilonf[i][j] * pow(sigmaf[i][j],12.0); diff --git a/src/INTEL/fix_intel.cpp b/src/INTEL/fix_intel.cpp index 4c46608677..0a3d27a978 100644 --- a/src/INTEL/fix_intel.cpp +++ b/src/INTEL/fix_intel.cpp @@ -430,7 +430,7 @@ void FixIntel::pair_init_check(const bool cdmessage) double *time1 = off_watch_pair(); double *time2 = off_watch_neighbor(); int *overflow = get_off_overflow_flag(); - if (_offload_balance !=0.0) { + if (_offload_balance != 0.0) { #pragma offload_transfer target(mic:_cop) \ nocopy(time1,time2:length(1) alloc_if(1) free_if(0)) \ in(overflow:length(5) alloc_if(1) free_if(0)) diff --git a/src/INTERLAYER/pair_ilp_tmd.cpp b/src/INTERLAYER/pair_ilp_tmd.cpp index fd3a2f8c6f..8b08de39c0 100644 --- a/src/INTERLAYER/pair_ilp_tmd.cpp +++ b/src/INTERLAYER/pair_ilp_tmd.cpp @@ -481,11 +481,11 @@ void PairILPTMD::calc_normal() jH2 = atom->map(tag[i] - 2); iH1 = map[type[jH1]]; iH2 = map[type[jH2]]; - if (strcmp(elements[iH1], "Ow") == 0 ) { + if (strcmp(elements[iH1], "Ow") == 0) { vect[0][0] = x[jH1][0] - xtp; vect[0][1] = x[jH1][1] - ytp; vect[0][2] = x[jH1][2] - ztp; - } else if (strcmp(elements[iH2], "Ow") == 0 ) { + } else if (strcmp(elements[iH2], "Ow") == 0) { vect[0][0] = x[jH2][0] - xtp; vect[0][1] = x[jH2][1] - ytp; vect[0][2] = x[jH2][2] - ztp; diff --git a/src/KIM/pair_kim.cpp b/src/KIM/pair_kim.cpp index 8ac6fe1f75..e0fc90ea46 100644 --- a/src/KIM/pair_kim.cpp +++ b/src/KIM/pair_kim.cpp @@ -198,8 +198,7 @@ PairKIM::~PairKIM() void PairKIM::set_contributing() { int const nall = atom->nlocal + atom->nghost; - for (int i = 0; i < nall; ++i) - kim_particleContributing[i] = ( (i < atom->nlocal) ? 1 : 0 ); + for (int i = 0; i < nall; ++i) kim_particleContributing[i] = (i < atom->nlocal) ? 1 : 0; } /* ---------------------------------------------------------------------- */ diff --git a/src/KOKKOS/mliap_so3_kokkos.cpp b/src/KOKKOS/mliap_so3_kokkos.cpp index 128e0f0a0c..bfdf4af0aa 100644 --- a/src/KOKKOS/mliap_so3_kokkos.cpp +++ b/src/KOKKOS/mliap_so3_kokkos.cpp @@ -856,7 +856,7 @@ void MLIAP_SO3Kokkos::spectrum_dxdr(int nlocal, DAT::tdual_int_1d nu memoryKK->create_kokkos(m_clisttot_i, nlocal, m_nmax, m_numYlms, "MLIAP_SO3Kokkos:m_clisttot_i"); int num_of_temp = std::min(nlocal, m_chunk_size); int delta=num_of_temp-m_ulist_r.extent(0); - if (delta > 0 ){ + if (delta > 0){ memoryKK->destroy_kokkos(m_ulist_r); memoryKK->create_kokkos(m_ulist_r, num_of_temp, m_idxu_count, "MLIAP_SO3Kokkos:m_ulist_r"); memoryKK->destroy_kokkos(m_ulist_i); diff --git a/src/KOKKOS/neigh_bond_kokkos.cpp b/src/KOKKOS/neigh_bond_kokkos.cpp index 9067284426..4cfe440b1f 100644 --- a/src/KOKKOS/neigh_bond_kokkos.cpp +++ b/src/KOKKOS/neigh_bond_kokkos.cpp @@ -266,7 +266,7 @@ void NeighBondKokkos::bond_all() int all; MPI_Allreduce(&nmissing,&all,1,MPI_INT,MPI_SUM,world); - if (all && me ==0) + if (all && me == 0) error->warning(FLERR,"Bond atoms missing at step {}", update->ntimestep); k_bondlist.modify(); @@ -345,7 +345,7 @@ void NeighBondKokkos::bond_partial() int all; MPI_Allreduce(&nmissing,&all,1,MPI_INT,MPI_SUM,world); - if (all && me ==0) + if (all && me == 0) error->warning(FLERR,"Bond atoms missing at step {}", update->ntimestep); k_bondlist.modify(); diff --git a/src/MANYBODY/pair_comb3.cpp b/src/MANYBODY/pair_comb3.cpp index ac1ac0ea62..a6a6ed37fd 100644 --- a/src/MANYBODY/pair_comb3.cpp +++ b/src/MANYBODY/pair_comb3.cpp @@ -593,9 +593,9 @@ void PairComb3::read_file(char *file) if (params[nparams].lambda < 0.0 || params[nparams].powern < 0.0 || params[nparams].beta < 0.0 || params[nparams].alpha1 < 0.0 || - params[nparams].bigB1< 0.0 || params[nparams].bigA< 0.0 || - params[nparams].bigB2< 0.0 || params[nparams].alpha2 <0.0 || - params[nparams].bigB3< 0.0 || params[nparams].alpha3 <0.0 || + params[nparams].bigB1 < 0.0 || params[nparams].bigA < 0.0 || + params[nparams].bigB2 < 0.0 || params[nparams].alpha2 < 0.0 || + params[nparams].bigB3 < 0.0 || params[nparams].alpha3 < 0.0 || params[nparams].bigr < 0.0 || params[nparams].bigd < 0.0 || params[nparams].bigd > params[nparams].bigr || params[nparams].powerm - params[nparams].powermint != 0.0 || diff --git a/src/MANYBODY/pair_lcbop.cpp b/src/MANYBODY/pair_lcbop.cpp index 65191ae85e..ed085c4b98 100644 --- a/src/MANYBODY/pair_lcbop.cpp +++ b/src/MANYBODY/pair_lcbop.cpp @@ -115,7 +115,7 @@ void PairLCBOP::allocate() ------------------------------------------------------------------------- */ void PairLCBOP::settings(int narg, char **/*arg*/) { - if (narg != 0 ) error->all(FLERR,"Illegal pair_style command"); + if (narg != 0) error->all(FLERR,"Illegal pair_style command"); } /* ---------------------------------------------------------------------- diff --git a/src/MISC/fix_ipi.cpp b/src/MISC/fix_ipi.cpp index 9411fa763d..69e0f2a7f3 100644 --- a/src/MISC/fix_ipi.cpp +++ b/src/MISC/fix_ipi.cpp @@ -284,17 +284,17 @@ void FixIPI::initial_integrate(int /*vflag*/) // while i-PI just asks for status, signal we are ready and wait readbuffer(ipisock, header, MSGLEN, error); header[MSGLEN]=0; - if (strcmp(header,"STATUS ") == 0 ) + if (strcmp(header,"STATUS ") == 0) writebuffer(ipisock,"READY ",MSGLEN, error); else break; } - if (strcmp(header,"EXIT ") == 0 ) + if (strcmp(header,"EXIT ") == 0) error->one(FLERR, "Got EXIT message from i-PI. Now leaving!"); // when i-PI signals it has positions to evaluate new forces, // read positions and cell data - if (strcmp(header,"POSDATA ") == 0 ) { + if (strcmp(header,"POSDATA ") == 0) { readbuffer(ipisock, (char*) cellh, 9*8, error); readbuffer(ipisock, (char*) cellih, 9*8, error); readbuffer(ipisock, (char*) &nat, 4, error); @@ -454,15 +454,15 @@ void FixIPI::final_integrate() while (true) { readbuffer(ipisock, header, MSGLEN, error); header[MSGLEN]=0; - if (strcmp(header,"STATUS ") == 0 ) + if (strcmp(header,"STATUS ") == 0) writebuffer(ipisock,"HAVEDATA ",MSGLEN, error); else break; } - if (strcmp(header,"EXIT ") == 0 ) + if (strcmp(header,"EXIT ") == 0) error->one(FLERR, "Got EXIT message from i-PI. Now leaving!"); - if (strcmp(header,"GETFORCE ") == 0 ) { + if (strcmp(header,"GETFORCE ") == 0) { writebuffer(ipisock,"FORCEREADY ",MSGLEN, error); writebuffer(ipisock,(char*) &pot,8, error); writebuffer(ipisock,(char*) &nat,4, error); diff --git a/src/MISC/pair_agni.cpp b/src/MISC/pair_agni.cpp index 539c0ca00f..8597e5db93 100644 --- a/src/MISC/pair_agni.cpp +++ b/src/MISC/pair_agni.cpp @@ -347,7 +347,7 @@ void PairAGNI::read_file(char *filename) curparam = -1; } else error->warning(FLERR,"Ignoring unknown tag '{}' in AGNI potential file.",tag); } else { - if (params && wantdata >=0) { + if (params && wantdata >= 0) { if ((int)values.count() == params[wantdata].numeta + 2) { for (k = 0; k < params[wantdata].numeta; ++k) params[wantdata].xU[k][fp_counter] = values.next_double(); diff --git a/src/OPENMP/npair_full_bin_ghost_omp.cpp b/src/OPENMP/npair_full_bin_ghost_omp.cpp index 5723a418f5..0825d61b49 100644 --- a/src/OPENMP/npair_full_bin_ghost_omp.cpp +++ b/src/OPENMP/npair_full_bin_ghost_omp.cpp @@ -114,7 +114,7 @@ void NPairFullBinGhostOmp::build(NeighList *list) if (molecular != Atom::ATOMIC) { if (!moltemplate) which = find_special(special[i],nspecial[i],tag[j]); - else if (imol >=0) + else if (imol >= 0) which = find_special(onemols[imol]->special[iatom], onemols[imol]->nspecial[iatom], tag[j]-tagprev); diff --git a/src/OPENMP/npair_full_bin_omp.cpp b/src/OPENMP/npair_full_bin_omp.cpp index 94668002a9..65af519850 100644 --- a/src/OPENMP/npair_full_bin_omp.cpp +++ b/src/OPENMP/npair_full_bin_omp.cpp @@ -108,7 +108,7 @@ void NPairFullBinOmp::build(NeighList *list) if (molecular != Atom::ATOMIC) { if (!moltemplate) which = find_special(special[i],nspecial[i],tag[j]); - else if (imol >=0) + else if (imol >= 0) which = find_special(onemols[imol]->special[iatom], onemols[imol]->nspecial[iatom], tag[j]-tagprev); diff --git a/src/OPENMP/npair_full_nsq_ghost_omp.cpp b/src/OPENMP/npair_full_nsq_ghost_omp.cpp index 05f402a99d..c1270d9fdc 100644 --- a/src/OPENMP/npair_full_nsq_ghost_omp.cpp +++ b/src/OPENMP/npair_full_nsq_ghost_omp.cpp @@ -108,7 +108,7 @@ void NPairFullNsqGhostOmp::build(NeighList *list) if (molecular != Atom::ATOMIC) { if (!moltemplate) which = find_special(special[i],nspecial[i],tag[j]); - else if (imol >=0) + else if (imol >= 0) which = find_special(onemols[imol]->special[iatom], onemols[imol]->nspecial[iatom], tag[j]-tagprev); diff --git a/src/OPENMP/npair_full_nsq_omp.cpp b/src/OPENMP/npair_full_nsq_omp.cpp index 6349906771..695cb1bc48 100644 --- a/src/OPENMP/npair_full_nsq_omp.cpp +++ b/src/OPENMP/npair_full_nsq_omp.cpp @@ -108,7 +108,7 @@ void NPairFullNsqOmp::build(NeighList *list) if (molecular != Atom::ATOMIC) { if (!moltemplate) which = find_special(special[i],nspecial[i],tag[j]); - else if (imol >=0) + else if (imol >= 0) which = find_special(onemols[imol]->special[iatom], onemols[imol]->nspecial[iatom], tag[j]-tagprev); diff --git a/src/OPENMP/npair_half_bin_newtoff_ghost_omp.cpp b/src/OPENMP/npair_half_bin_newtoff_ghost_omp.cpp index 2255033204..e10d181a8c 100644 --- a/src/OPENMP/npair_half_bin_newtoff_ghost_omp.cpp +++ b/src/OPENMP/npair_half_bin_newtoff_ghost_omp.cpp @@ -122,7 +122,7 @@ void NPairHalfBinNewtoffGhostOmp::build(NeighList *list) if (molecular != Atom::ATOMIC) { if (!moltemplate) which = find_special(special[i],nspecial[i],tag[j]); - else if (imol >=0) + else if (imol >= 0) which = find_special(onemols[imol]->special[iatom], onemols[imol]->nspecial[iatom], tag[j]-tagprev); diff --git a/src/OPENMP/npair_half_bin_newtoff_omp.cpp b/src/OPENMP/npair_half_bin_newtoff_omp.cpp index 36997d9bcb..9d32cc7e2b 100644 --- a/src/OPENMP/npair_half_bin_newtoff_omp.cpp +++ b/src/OPENMP/npair_half_bin_newtoff_omp.cpp @@ -113,7 +113,7 @@ void NPairHalfBinNewtoffOmp::build(NeighList *list) if (molecular != Atom::ATOMIC) { if (!moltemplate) which = find_special(special[i],nspecial[i],tag[j]); - else if (imol >=0) + else if (imol >= 0) which = find_special(onemols[imol]->special[iatom], onemols[imol]->nspecial[iatom], tag[j]-tagprev); diff --git a/src/OPENMP/npair_half_bin_newton_omp.cpp b/src/OPENMP/npair_half_bin_newton_omp.cpp index 1663a2f14c..d2da12962c 100644 --- a/src/OPENMP/npair_half_bin_newton_omp.cpp +++ b/src/OPENMP/npair_half_bin_newton_omp.cpp @@ -114,7 +114,7 @@ void NPairHalfBinNewtonOmp::build(NeighList *list) if (molecular != Atom::ATOMIC) { if (!moltemplate) which = find_special(special[i],nspecial[i],tag[j]); - else if (imol >=0) + else if (imol >= 0) which = find_special(onemols[imol]->special[iatom], onemols[imol]->nspecial[iatom], tag[j]-tagprev); @@ -145,7 +145,7 @@ void NPairHalfBinNewtonOmp::build(NeighList *list) if (molecular != Atom::ATOMIC) { if (!moltemplate) which = find_special(special[i],nspecial[i],tag[j]); - else if (imol >=0) + else if (imol >= 0) which = find_special(onemols[imol]->special[iatom], onemols[imol]->nspecial[iatom], tag[j]-tagprev); diff --git a/src/OPENMP/npair_half_bin_newton_tri_omp.cpp b/src/OPENMP/npair_half_bin_newton_tri_omp.cpp index e754456ef1..4d93d06d75 100644 --- a/src/OPENMP/npair_half_bin_newton_tri_omp.cpp +++ b/src/OPENMP/npair_half_bin_newton_tri_omp.cpp @@ -119,7 +119,7 @@ void NPairHalfBinNewtonTriOmp::build(NeighList *list) if (molecular != Atom::ATOMIC) { if (!moltemplate) which = find_special(special[i],nspecial[i],tag[j]); - else if (imol >=0) + else if (imol >= 0) which = find_special(onemols[imol]->special[iatom], onemols[imol]->nspecial[iatom], tag[j]-tagprev); diff --git a/src/OPENMP/npair_half_multi_old_newtoff_omp.cpp b/src/OPENMP/npair_half_multi_old_newtoff_omp.cpp index ac5e9dae04..4447b4414e 100644 --- a/src/OPENMP/npair_half_multi_old_newtoff_omp.cpp +++ b/src/OPENMP/npair_half_multi_old_newtoff_omp.cpp @@ -120,7 +120,7 @@ void NPairHalfMultiOldNewtoffOmp::build(NeighList *list) if (molecular != Atom::ATOMIC) { if (!moltemplate) which = find_special(special[i],nspecial[i],tag[j]); - else if (imol >=0) + else if (imol >= 0) which = find_special(onemols[imol]->special[iatom], onemols[imol]->nspecial[iatom], tag[j]-tagprev); diff --git a/src/OPENMP/npair_half_multi_old_newton_omp.cpp b/src/OPENMP/npair_half_multi_old_newton_omp.cpp index baa9dd0724..29c551f17d 100644 --- a/src/OPENMP/npair_half_multi_old_newton_omp.cpp +++ b/src/OPENMP/npair_half_multi_old_newton_omp.cpp @@ -116,7 +116,7 @@ void NPairHalfMultiOldNewtonOmp::build(NeighList *list) if (molecular != Atom::ATOMIC) { if (!moltemplate) which = find_special(special[i],nspecial[i],tag[j]); - else if (imol >=0) + else if (imol >= 0) which = find_special(onemols[imol]->special[iatom], onemols[imol]->nspecial[iatom], tag[j]-tagprev); @@ -153,7 +153,7 @@ void NPairHalfMultiOldNewtonOmp::build(NeighList *list) if (molecular != Atom::ATOMIC) { if (!moltemplate) which = find_special(special[i],nspecial[i],tag[j]); - else if (imol >=0) + else if (imol >= 0) which = find_special(onemols[imol]->special[iatom], onemols[imol]->nspecial[iatom], tag[j]-tagprev); diff --git a/src/OPENMP/npair_half_multi_old_newton_tri_omp.cpp b/src/OPENMP/npair_half_multi_old_newton_tri_omp.cpp index e4895ff1a9..1d906b1fa5 100644 --- a/src/OPENMP/npair_half_multi_old_newton_tri_omp.cpp +++ b/src/OPENMP/npair_half_multi_old_newton_tri_omp.cpp @@ -129,7 +129,7 @@ void NPairHalfMultiOldNewtonTriOmp::build(NeighList *list) if (molecular != Atom::ATOMIC) { if (!moltemplate) which = find_special(special[i],nspecial[i],tag[j]); - else if (imol >=0) + else if (imol >= 0) which = find_special(onemols[imol]->special[iatom], onemols[imol]->nspecial[iatom], tag[j]-tagprev); diff --git a/src/OPENMP/npair_half_nsq_newtoff_ghost_omp.cpp b/src/OPENMP/npair_half_nsq_newtoff_ghost_omp.cpp index 388e51e1af..54de8b9607 100644 --- a/src/OPENMP/npair_half_nsq_newtoff_ghost_omp.cpp +++ b/src/OPENMP/npair_half_nsq_newtoff_ghost_omp.cpp @@ -117,7 +117,7 @@ void NPairHalfNsqNewtoffGhostOmp::build(NeighList *list) if (molecular != Atom::ATOMIC) { if (!moltemplate) which = find_special(special[i],nspecial[i],tag[j]); - else if (imol >=0) + else if (imol >= 0) which = find_special(onemols[imol]->special[iatom], onemols[imol]->nspecial[iatom], tag[j]-tagprev); diff --git a/src/OPENMP/npair_half_nsq_newtoff_omp.cpp b/src/OPENMP/npair_half_nsq_newtoff_omp.cpp index 002ea37e6b..54a90d9f2b 100644 --- a/src/OPENMP/npair_half_nsq_newtoff_omp.cpp +++ b/src/OPENMP/npair_half_nsq_newtoff_omp.cpp @@ -109,7 +109,7 @@ void NPairHalfNsqNewtoffOmp::build(NeighList *list) if (molecular != Atom::ATOMIC) { if (!moltemplate) which = find_special(special[i],nspecial[i],tag[j]); - else if (imol >=0) + else if (imol >= 0) which = find_special(onemols[imol]->special[iatom], onemols[imol]->nspecial[iatom], tag[j]-tagprev); diff --git a/src/OPENMP/npair_half_nsq_newton_omp.cpp b/src/OPENMP/npair_half_nsq_newton_omp.cpp index 5996cd2013..c010a3b024 100644 --- a/src/OPENMP/npair_half_nsq_newton_omp.cpp +++ b/src/OPENMP/npair_half_nsq_newton_omp.cpp @@ -127,7 +127,7 @@ void NPairHalfNsqNewtonOmp::build(NeighList *list) if (molecular != Atom::ATOMIC) { if (!moltemplate) which = find_special(special[i],nspecial[i],tag[j]); - else if (imol >=0) + else if (imol >= 0) which = find_special(onemols[imol]->special[iatom], onemols[imol]->nspecial[iatom], tag[j]-tagprev); diff --git a/src/OPENMP/npair_half_respa_bin_newtoff_omp.cpp b/src/OPENMP/npair_half_respa_bin_newtoff_omp.cpp index c6be04419d..e1d4ee59b1 100644 --- a/src/OPENMP/npair_half_respa_bin_newtoff_omp.cpp +++ b/src/OPENMP/npair_half_respa_bin_newtoff_omp.cpp @@ -144,7 +144,7 @@ void NPairHalfRespaBinNewtoffOmp::build(NeighList *list) if (molecular != Atom::ATOMIC) { if (!moltemplate) which = find_special(special[i],nspecial[i],tag[j]); - else if (imol >=0) + else if (imol >= 0) which = find_special(onemols[imol]->special[iatom], onemols[imol]->nspecial[iatom], tag[j]-tagprev); diff --git a/src/OPENMP/npair_half_respa_bin_newton_omp.cpp b/src/OPENMP/npair_half_respa_bin_newton_omp.cpp index 51fc7a2ed8..ce8a103170 100644 --- a/src/OPENMP/npair_half_respa_bin_newton_omp.cpp +++ b/src/OPENMP/npair_half_respa_bin_newton_omp.cpp @@ -146,7 +146,7 @@ void NPairHalfRespaBinNewtonOmp::build(NeighList *list) if (molecular != Atom::ATOMIC) { if (!moltemplate) which = find_special(special[i],nspecial[i],tag[j]); - else if (imol >=0) + else if (imol >= 0) which = find_special(onemols[imol]->special[iatom], onemols[imol]->nspecial[iatom], tag[j]-tagprev); @@ -190,7 +190,7 @@ void NPairHalfRespaBinNewtonOmp::build(NeighList *list) if (molecular != Atom::ATOMIC) { if (!moltemplate) which = find_special(special[i],nspecial[i],tag[j]); - else if (imol >=0) + else if (imol >= 0) which = find_special(onemols[imol]->special[iatom], onemols[imol]->nspecial[iatom], tag[j]-tagprev); diff --git a/src/OPENMP/npair_half_respa_bin_newton_tri_omp.cpp b/src/OPENMP/npair_half_respa_bin_newton_tri_omp.cpp index c998f71290..73f2102dba 100644 --- a/src/OPENMP/npair_half_respa_bin_newton_tri_omp.cpp +++ b/src/OPENMP/npair_half_respa_bin_newton_tri_omp.cpp @@ -151,7 +151,7 @@ void NPairHalfRespaBinNewtonTriOmp::build(NeighList *list) if (molecular != Atom::ATOMIC) { if (!moltemplate) which = find_special(special[i],nspecial[i],tag[j]); - else if (imol >=0) + else if (imol >= 0) which = find_special(onemols[imol]->special[iatom], onemols[imol]->nspecial[iatom], tag[j]-tagprev); diff --git a/src/OPENMP/npair_half_respa_nsq_newtoff_omp.cpp b/src/OPENMP/npair_half_respa_nsq_newtoff_omp.cpp index 1167a7601b..428ca778e8 100644 --- a/src/OPENMP/npair_half_respa_nsq_newtoff_omp.cpp +++ b/src/OPENMP/npair_half_respa_nsq_newtoff_omp.cpp @@ -141,7 +141,7 @@ void NPairHalfRespaNsqNewtoffOmp::build(NeighList *list) if (molecular != Atom::ATOMIC) { if (!moltemplate) which = find_special(special[i],nspecial[i],tag[j]); - else if (imol >=0) + else if (imol >= 0) which = find_special(onemols[imol]->special[iatom], onemols[imol]->nspecial[iatom], tag[j]-tagprev); diff --git a/src/OPENMP/npair_half_respa_nsq_newton_omp.cpp b/src/OPENMP/npair_half_respa_nsq_newton_omp.cpp index 61d9165b1e..4bcba0fbef 100644 --- a/src/OPENMP/npair_half_respa_nsq_newton_omp.cpp +++ b/src/OPENMP/npair_half_respa_nsq_newton_omp.cpp @@ -159,7 +159,7 @@ void NPairHalfRespaNsqNewtonOmp::build(NeighList *list) if (molecular != Atom::ATOMIC) { if (!moltemplate) which = find_special(special[i],nspecial[i],tag[j]); - else if (imol >=0) + else if (imol >= 0) which = find_special(onemols[imol]->special[iatom], onemols[imol]->nspecial[iatom], tag[j]-tagprev); diff --git a/src/OPENMP/npair_half_size_bin_newtoff_omp.cpp b/src/OPENMP/npair_half_size_bin_newtoff_omp.cpp index c205b67539..478e28a5f4 100644 --- a/src/OPENMP/npair_half_size_bin_newtoff_omp.cpp +++ b/src/OPENMP/npair_half_size_bin_newtoff_omp.cpp @@ -125,7 +125,7 @@ void NPairHalfSizeBinNewtoffOmp::build(NeighList *list) if (molecular != Atom::ATOMIC) { if (!moltemplate) which = find_special(special[i],nspecial[i],tag[j]); - else if (imol >=0) + else if (imol >= 0) which = find_special(onemols[imol]->special[iatom], onemols[imol]->nspecial[iatom], tag[j]-tagprev); diff --git a/src/OPENMP/npair_half_size_bin_newton_omp.cpp b/src/OPENMP/npair_half_size_bin_newton_omp.cpp index 628057d41d..dba392781e 100644 --- a/src/OPENMP/npair_half_size_bin_newton_omp.cpp +++ b/src/OPENMP/npair_half_size_bin_newton_omp.cpp @@ -126,7 +126,7 @@ void NPairHalfSizeBinNewtonOmp::build(NeighList *list) if (molecular != Atom::ATOMIC) { if (!moltemplate) which = find_special(special[i],nspecial[i],tag[j]); - else if (imol >=0) + else if (imol >= 0) which = find_special(onemols[imol]->special[iatom], onemols[imol]->nspecial[iatom], tag[j]-tagprev); @@ -161,7 +161,7 @@ void NPairHalfSizeBinNewtonOmp::build(NeighList *list) if (molecular != Atom::ATOMIC) { if (!moltemplate) which = find_special(special[i],nspecial[i],tag[j]); - else if (imol >=0) + else if (imol >= 0) which = find_special(onemols[imol]->special[iatom], onemols[imol]->nspecial[iatom], tag[j]-tagprev); diff --git a/src/OPENMP/npair_half_size_bin_newton_tri_omp.cpp b/src/OPENMP/npair_half_size_bin_newton_tri_omp.cpp index c320296442..160cf64194 100644 --- a/src/OPENMP/npair_half_size_bin_newton_tri_omp.cpp +++ b/src/OPENMP/npair_half_size_bin_newton_tri_omp.cpp @@ -132,7 +132,7 @@ void NPairHalfSizeBinNewtonTriOmp::build(NeighList *list) if (molecular != Atom::ATOMIC) { if (!moltemplate) which = find_special(special[i],nspecial[i],tag[j]); - else if (imol >=0) + else if (imol >= 0) which = find_special(onemols[imol]->special[iatom], onemols[imol]->nspecial[iatom], tag[j]-tagprev); diff --git a/src/OPENMP/npair_half_size_multi_newtoff_omp.cpp b/src/OPENMP/npair_half_size_multi_newtoff_omp.cpp index 73564a150c..ba0dfc16be 100644 --- a/src/OPENMP/npair_half_size_multi_newtoff_omp.cpp +++ b/src/OPENMP/npair_half_size_multi_newtoff_omp.cpp @@ -124,7 +124,7 @@ void NPairHalfSizeMultiNewtoffOmp::build(NeighList *list) for (k = 0; k < ns; k++) { js = binhead_multi[jcollection][jbin + s[k]]; - for (j = js; j >=0; j = bins[j]) { + for (j = js; j >= 0; j = bins[j]) { if (j <= i) continue; jtype = type[j]; @@ -145,7 +145,7 @@ void NPairHalfSizeMultiNewtoffOmp::build(NeighList *list) if (molecular != Atom::ATOMIC) { if (!moltemplate) which = find_special(special[i],nspecial[i],tag[j]); - else if (imol >=0) + else if (imol >= 0) which = find_special(onemols[imol]->special[iatom], onemols[imol]->nspecial[iatom], tag[j]-tagprev); diff --git a/src/OPENMP/npair_half_size_multi_newton_omp.cpp b/src/OPENMP/npair_half_size_multi_newton_omp.cpp index 0ed843ea0b..4bc17f911c 100644 --- a/src/OPENMP/npair_half_size_multi_newton_omp.cpp +++ b/src/OPENMP/npair_half_size_multi_newton_omp.cpp @@ -155,7 +155,7 @@ void NPairHalfSizeMultiNewtonOmp::build(NeighList *list) if (molecular != Atom::ATOMIC) { if (!moltemplate) which = find_special(special[i],nspecial[i],tag[j]); - else if (imol >=0) + else if (imol >= 0) which = find_special(onemols[imol]->special[iatom], onemols[imol]->nspecial[iatom], tag[j]-tagprev); @@ -198,7 +198,7 @@ void NPairHalfSizeMultiNewtonOmp::build(NeighList *list) if (molecular != Atom::ATOMIC) { if (!moltemplate) which = find_special(special[i],nspecial[i],tag[j]); - else if (imol >=0) + else if (imol >= 0) which = find_special(onemols[imol]->special[iatom], onemols[imol]->nspecial[iatom], tag[j]-tagprev); diff --git a/src/OPENMP/npair_half_size_multi_newton_tri_omp.cpp b/src/OPENMP/npair_half_size_multi_newton_tri_omp.cpp index 9a0ead482b..73e11a2745 100644 --- a/src/OPENMP/npair_half_size_multi_newton_tri_omp.cpp +++ b/src/OPENMP/npair_half_size_multi_newton_tri_omp.cpp @@ -160,7 +160,7 @@ void NPairHalfSizeMultiNewtonTriOmp::build(NeighList *list) if (molecular != Atom::ATOMIC) { if (!moltemplate) which = find_special(special[i],nspecial[i],tag[j]); - else if (imol >=0) + else if (imol >= 0) which = find_special(onemols[imol]->special[iatom], onemols[imol]->nspecial[iatom], tag[j]-tagprev); diff --git a/src/OPENMP/npair_half_size_multi_old_newtoff_omp.cpp b/src/OPENMP/npair_half_size_multi_old_newtoff_omp.cpp index c368e71095..e4169482bc 100644 --- a/src/OPENMP/npair_half_size_multi_old_newtoff_omp.cpp +++ b/src/OPENMP/npair_half_size_multi_old_newtoff_omp.cpp @@ -132,7 +132,7 @@ void NPairHalfSizeMultiOldNewtoffOmp::build(NeighList *list) if (molecular != Atom::ATOMIC) { if (!moltemplate) which = find_special(special[i],nspecial[i],tag[j]); - else if (imol >=0) + else if (imol >= 0) which = find_special(onemols[imol]->special[iatom], onemols[imol]->nspecial[iatom], tag[j]-tagprev); diff --git a/src/OPENMP/npair_half_size_multi_old_newton_omp.cpp b/src/OPENMP/npair_half_size_multi_old_newton_omp.cpp index 187efe04d1..7d6a3de871 100644 --- a/src/OPENMP/npair_half_size_multi_old_newton_omp.cpp +++ b/src/OPENMP/npair_half_size_multi_old_newton_omp.cpp @@ -127,7 +127,7 @@ void NPairHalfSizeMultiOldNewtonOmp::build(NeighList *list) if (molecular != Atom::ATOMIC) { if (!moltemplate) which = find_special(special[i],nspecial[i],tag[j]); - else if (imol >=0) + else if (imol >= 0) which = find_special(onemols[imol]->special[iatom], onemols[imol]->nspecial[iatom], tag[j]-tagprev); @@ -170,7 +170,7 @@ void NPairHalfSizeMultiOldNewtonOmp::build(NeighList *list) if (molecular != Atom::ATOMIC) { if (!moltemplate) which = find_special(special[i],nspecial[i],tag[j]); - else if (imol >=0) + else if (imol >= 0) which = find_special(onemols[imol]->special[iatom], onemols[imol]->nspecial[iatom], tag[j]-tagprev); diff --git a/src/OPENMP/npair_half_size_multi_old_newton_tri_omp.cpp b/src/OPENMP/npair_half_size_multi_old_newton_tri_omp.cpp index c74b191f66..caa993ed38 100644 --- a/src/OPENMP/npair_half_size_multi_old_newton_tri_omp.cpp +++ b/src/OPENMP/npair_half_size_multi_old_newton_tri_omp.cpp @@ -140,7 +140,7 @@ void NPairHalfSizeMultiOldNewtonTriOmp::build(NeighList *list) if (molecular != Atom::ATOMIC) { if (!moltemplate) which = find_special(special[i],nspecial[i],tag[j]); - else if (imol >=0) + else if (imol >= 0) which = find_special(onemols[imol]->special[iatom], onemols[imol]->nspecial[iatom], tag[j]-tagprev); diff --git a/src/OPENMP/npair_half_size_nsq_newtoff_omp.cpp b/src/OPENMP/npair_half_size_nsq_newtoff_omp.cpp index 020551bd8e..2982586a18 100644 --- a/src/OPENMP/npair_half_size_nsq_newtoff_omp.cpp +++ b/src/OPENMP/npair_half_size_nsq_newtoff_omp.cpp @@ -122,7 +122,7 @@ void NPairHalfSizeNsqNewtoffOmp::build(NeighList *list) if (molecular != Atom::ATOMIC) { if (!moltemplate) which = find_special(special[i],nspecial[i],tag[j]); - else if (imol >=0) + else if (imol >= 0) which = find_special(onemols[imol]->special[iatom], onemols[imol]->nspecial[iatom], tag[j]-tagprev); diff --git a/src/OPENMP/npair_half_size_nsq_newton_omp.cpp b/src/OPENMP/npair_half_size_nsq_newton_omp.cpp index fe2a1be3da..0a80da9422 100644 --- a/src/OPENMP/npair_half_size_nsq_newton_omp.cpp +++ b/src/OPENMP/npair_half_size_nsq_newton_omp.cpp @@ -140,7 +140,7 @@ void NPairHalfSizeNsqNewtonOmp::build(NeighList *list) if (molecular != Atom::ATOMIC) { if (!moltemplate) which = find_special(special[i],nspecial[i],tag[j]); - else if (imol >=0) + else if (imol >= 0) which = find_special(onemols[imol]->special[iatom], onemols[imol]->nspecial[iatom], tag[j]-tagprev); diff --git a/src/PHONON/dynamical_matrix.cpp b/src/PHONON/dynamical_matrix.cpp index 8e4f8557a2..c2ba34c4c2 100644 --- a/src/PHONON/dynamical_matrix.cpp +++ b/src/PHONON/dynamical_matrix.cpp @@ -365,7 +365,7 @@ void DynamicalMatrix::calculateMatrix() delete [] fdynmat[i]; delete [] fdynmat; - if (screen && me ==0 ) fprintf(screen,"Finished Calculating Dynamical Matrix\n"); + if (screen && me == 0) fprintf(screen,"Finished Calculating Dynamical Matrix\n"); } /* ---------------------------------------------------------------------- diff --git a/src/PHONON/third_order.cpp b/src/PHONON/third_order.cpp index 4a8948de77..c31aae0086 100644 --- a/src/PHONON/third_order.cpp +++ b/src/PHONON/third_order.cpp @@ -412,7 +412,7 @@ void ThirdOrder::calculateMatrix() delete [] dynmat; delete [] fdynmat; - if (screen && me ==0) + if (screen && me == 0) fprintf(screen,"Finished Calculating Third Order Tensor\n"); } diff --git a/src/REACTION/fix_bond_react.cpp b/src/REACTION/fix_bond_react.cpp index cf99efd099..d124b06dc2 100644 --- a/src/REACTION/fix_bond_react.cpp +++ b/src/REACTION/fix_bond_react.cpp @@ -412,7 +412,7 @@ FixBondReact::FixBondReact(LAMMPS *lmp, int narg, char **arg) : } else if (strcmp(arg[iarg],"modify_create") == 0) { if (iarg++ > narg) error->all(FLERR,"Illegal fix bond/react command: " "'modify_create' has too few arguments"); - while (iarg < narg && strcmp(arg[iarg],"react") != 0 ) { + while (iarg < narg && strcmp(arg[iarg],"react") != 0) { if (strcmp(arg[iarg],"fit") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal fix bond/react command: " "'modify_create' has too few arguments"); @@ -1394,7 +1394,7 @@ void FixBondReact::superimpose_algorithm() } for (int i = 0; i < onemol->natoms; i++) { - if (glove[i][0] !=0 && pioneer_count[i] < onemol_nxspecial[i][0] && edge[i][rxnID] == 0) { + if (glove[i][0] != 0 && pioneer_count[i] < onemol_nxspecial[i][0] && edge[i][rxnID] == 0) { pioneers[i] = 1; } } @@ -1837,7 +1837,7 @@ void FixBondReact::inner_crosscheck_loop() for (int i=1; i < num_choices; ++i) { tagint hold = tag_choices[i]; int j = i - 1; - while ((j >=0) && (tag_choices[j] > hold)) { + while ((j >= 0) && (tag_choices[j] > hold)) { tag_choices[j+1] = tag_choices[j]; --j; } diff --git a/src/REAXFF/fix_reaxff_bonds.cpp b/src/REAXFF/fix_reaxff_bonds.cpp index 393e22930f..8bd7ed0020 100644 --- a/src/REAXFF/fix_reaxff_bonds.cpp +++ b/src/REAXFF/fix_reaxff_bonds.cpp @@ -295,7 +295,7 @@ void FixReaxFFBonds::RecvBuffer(double *buf, int nbuf, int nbuf_local, MPI_Isend(&buf[0],nbuf_local,MPI_DOUBLE,0,0,world,&irequest2); MPI_Wait(&irequest2,MPI_STATUS_IGNORE); } - if (me ==0) fputs("# \n",fp); + if (me == 0) fputs("# \n",fp); } diff --git a/src/SMTBQ/pair_smtbq.cpp b/src/SMTBQ/pair_smtbq.cpp index fdef0b6043..4f924a6fca 100644 --- a/src/SMTBQ/pair_smtbq.cpp +++ b/src/SMTBQ/pair_smtbq.cpp @@ -446,7 +446,7 @@ void PairSMTBQ::read_file(char *file) params[i].chi = values.next_double(); params[i].dj = values.next_double(); - if (strcmp(params[i].nom, "O") !=0) { + if (strcmp(params[i].nom, "O") != 0) { params[i].R = values.next_double(); if ((comm->me == 0) && VERBOSE) utils::logmesg(lmp, " {} {} {} {} {}\n",label,params[i].ne,params[i].chi, @@ -782,7 +782,7 @@ void PairSMTBQ::read_file(char *file) if (intparams[m].intsm == 0) continue; intparams[m].neig_cut = 1.2*intparams[m].r0; - if (strcmp(intparams[m].typepot,"second_moment") == 0 ) + if (strcmp(intparams[m].typepot,"second_moment") == 0) if ((comm->me == 0) && VERBOSE) utils::logmesg(lmp, " Rc 1er voisin, typepot {} -> {} Ang\n", intparams[m].typepot,intparams[m].neig_cut); @@ -1020,7 +1020,7 @@ void PairSMTBQ::compute(int eflag, int vflag) // ---------------------------------------------- if ( strcmp(intparams[m].typepot,"buck") == 0 || - strcmp(intparams[m].typepot,"buckPlusAttr") ==0) { + strcmp(intparams[m].typepot,"buckPlusAttr") == 0) { // ---------------------------------------------- evdwl = 0.0; fpair =0.0; @@ -1070,7 +1070,7 @@ void PairSMTBQ::compute(int eflag, int vflag) // ----------------------------------------------------------------- - if (strcmp(intparams[m].typepot,"second_moment") != 0 ) continue; + if (strcmp(intparams[m].typepot,"second_moment") != 0) continue; // ----------------------------------------------------------------- @@ -2575,7 +2575,7 @@ void PairSMTBQ::Charge() if (me == 0 && strcmp(Bavard,"false") != 0) { for (gp = 0; gp < nteam+1; gp++) { printf (" ++++ Groupe %d - Nox %d Ncat %d\n",gp,nQEqaall[gp],nQEqcall[gp]); - if (nQEqcall[gp] !=0 && nQEqaall[gp] !=0 ) + if (nQEqcall[gp] != 0 && nQEqaall[gp] !=0 ) printf (" neutralite des charges %f\n qtotc %f qtota %f\n", qtotll,qtotcll[gp]/nQEqcall[gp],qtotall[gp]/nQEqaall[gp]); printf (" ---------------------------- \n");} @@ -2641,7 +2641,7 @@ void PairSMTBQ::Charge() for (i = 0; i < nteam+1; i++) { - if (nQEqall[i] !=0) TransfAll[i] /= static_cast(nQEqall[i]); + if (nQEqall[i] != 0) TransfAll[i] /= static_cast(nQEqall[i]); enegchk[i] = enegmax[i] = 0.0; } @@ -2665,7 +2665,7 @@ void PairSMTBQ::Charge() for (gp = 0; gp < nteam+1; gp++) { - if (nQEqall[gp] !=0) { + if (nQEqall[gp] != 0) { enegchk[gp] = enegchkall[gp]/static_cast(nQEqall[gp]); enegmax[gp] = enegmaxall[gp]; } @@ -2729,7 +2729,7 @@ void PairSMTBQ::Charge() // Statistique (ecart type) // ------------------------ for (i=0; i(nQEqcall[i]) ; TransfAll[i+2*cluster] /= static_cast(nQEqaall[i]) ;} sigmaa[i] = sigmac[i] = 0.0; diff --git a/src/VTK/dump_vtk.cpp b/src/VTK/dump_vtk.cpp index 3667180bc9..a77f5b2e11 100644 --- a/src/VTK/dump_vtk.cpp +++ b/src/VTK/dump_vtk.cpp @@ -1933,7 +1933,7 @@ void DumpVTK::identify_vectors() // assume components are grouped together and in correct order if (name.count(it->first + 1) && name.count(it->first + 2)) { // more attributes? if (it->second.compare(0,it->second.length()-3,name[it->first + 1],0,it->second.length()-3) == 0 && // same attributes? - it->second.compare(0,it->second.length()-3,name[it->first + 2],0,it->second.length()-3) == 0 ) + it->second.compare(0,it->second.length()-3,name[it->first + 2],0,it->second.length()-3) == 0) { it->second.erase(it->second.length()-1); std::ostringstream oss; diff --git a/src/atom.cpp b/src/atom.cpp index 08e9639440..6b014fc9c8 100644 --- a/src/atom.cpp +++ b/src/atom.cpp @@ -966,10 +966,10 @@ void Atom::bonus_check() bigint local_bodies = 0, num_global; for (int i = 0; i < nlocal; ++i) { - if (ellipsoid && (ellipsoid[i] >=0)) ++local_ellipsoids; - if (line && (line[i] >=0)) ++local_lines; - if (tri && (tri[i] >=0)) ++local_tris; - if (body && (body[i] >=0)) ++local_bodies; + if (ellipsoid && (ellipsoid[i] >= 0)) ++local_ellipsoids; + if (line && (line[i] >= 0)) ++local_lines; + if (tri && (tri[i] >= 0)) ++local_tris; + if (body && (body[i] >= 0)) ++local_bodies; } MPI_Allreduce(&local_ellipsoids,&num_global,1,MPI_LMP_BIGINT,MPI_SUM,world); diff --git a/src/library.cpp b/src/library.cpp index 872b59693f..8cec7c4505 100644 --- a/src/library.cpp +++ b/src/library.cpp @@ -2328,7 +2328,7 @@ void *lammps_extract_variable(void *handle, const char *name, const char *group) } else if (lmp->input->variable->vectorstyle(ivar)) { double *values = nullptr; int nvector = lmp->input->variable->compute_vector(ivar, &values); - if ( group != nullptr && strcmp(group,"LMP_SIZE_VECTOR") == 0 ) { + if (group != nullptr && strcmp(group,"LMP_SIZE_VECTOR") == 0) { int* nvecptr = (int *) malloc(sizeof(int)); *nvecptr = nvector; return (void *) nvecptr; @@ -2372,7 +2372,7 @@ int lammps_extract_variable_datatype(void *handle, const char *name) BEGIN_CAPTURE { int ivar = lmp->input->variable->find(name); - if ( ivar < 0 ) return -1; + if (ivar < 0) return -1; if (lmp->input->variable->equalstyle(ivar)) return LMP_VAR_EQUAL; @@ -5199,7 +5199,7 @@ int lammps_find_pair_neighlist(void *handle, const char *style, int exact, int n // find neigh list for (int i = 0; i < lmp->neighbor->nlist; i++) { NeighList *list = lmp->neighbor->lists[i]; - if ( (list->requestor_type == NeighList::PAIR) + if ((list->requestor_type == NeighList::PAIR) && (pair == list->requestor) && (list->id == reqid) ) return i; } @@ -5229,7 +5229,7 @@ int lammps_find_fix_neighlist(void *handle, const char *id, int reqid) { // find neigh list for (int i = 0; i < lmp->neighbor->nlist; i++) { NeighList *list = lmp->neighbor->lists[i]; - if ( (list->requestor_type == NeighList::FIX) + if ((list->requestor_type == NeighList::FIX) && (fix == list->requestor) && (list->id == reqid) ) return i; } @@ -5258,7 +5258,7 @@ int lammps_find_compute_neighlist(void *handle, const char *id, int reqid) { // find neigh list for (int i = 0; i < lmp->neighbor->nlist; i++) { NeighList * list = lmp->neighbor->lists[i]; - if ( (list->requestor_type == NeighList::COMPUTE) + if ((list->requestor_type == NeighList::COMPUTE) && (compute == list->requestor) && (list->id == reqid) ) return i; } @@ -5709,7 +5709,7 @@ int lammps_style_name(void *handle, const char *category, int idx, Info info(lmp); auto styles = info.get_available_styles(category); - if ((idx >=0) && (idx < (int) styles.size())) { + if ((idx >= 0) && (idx < (int) styles.size())) { strncpy(buffer, styles[idx].c_str(), buf_size); return 1; } @@ -5844,23 +5844,23 @@ int lammps_id_name(void *handle, const char *category, int idx, char *buffer, in return 1; } } else if (strcmp(category,"group") == 0) { - if ((idx >=0) && (idx < lmp->group->ngroup)) { + if ((idx >= 0) && (idx < lmp->group->ngroup)) { strncpy(buffer, lmp->group->names[idx], buf_size); return 1; } } else if (strcmp(category,"molecule") == 0) { - if ((idx >=0) && (idx < lmp->atom->nmolecule)) { + if ((idx >= 0) && (idx < lmp->atom->nmolecule)) { strncpy(buffer, lmp->atom->molecules[idx]->id, buf_size); return 1; } } else if (strcmp(category,"region") == 0) { auto regions = lmp->domain->get_region_list(); - if ((idx >=0) && (idx < (int) regions.size())) { + if ((idx >= 0) && (idx < (int) regions.size())) { strncpy(buffer, regions[idx]->id, buf_size); return 1; } } else if (strcmp(category,"variable") == 0) { - if ((idx >=0) && (idx < lmp->input->variable->nvar)) { + if ((idx >= 0) && (idx < lmp->input->variable->nvar)) { strncpy(buffer, lmp->input->variable->names[idx], buf_size); return 1; } diff --git a/src/read_restart.cpp b/src/read_restart.cpp index aa9f5fe8ee..0de36ebe1e 100644 --- a/src/read_restart.cpp +++ b/src/read_restart.cpp @@ -768,7 +768,7 @@ void ReadRestart::header() for (int i = 0; i < nargcopy; i++) argcopy[i] = read_string(); atom->create_avec(style,nargcopy,argcopy,1); - if (comm->me ==0) + if (comm->me == 0) utils::logmesg(lmp," restoring atom style {} from restart\n",atom->atom_style); for (int i = 0; i < nargcopy; i++) delete[] argcopy[i]; delete[] argcopy; @@ -921,14 +921,14 @@ void ReadRestart::force_fields() style = read_string(); force->create_pair(style,1); delete[] style; - if (comm->me ==0) + if (comm->me == 0) utils::logmesg(lmp," restoring pair style {} from restart\n", force->pair_style); force->pair->read_restart(fp); } else if (flag == NO_PAIR) { style = read_string(); - if (comm->me ==0) + if (comm->me == 0) utils::logmesg(lmp," pair style {} stores no restart info\n", style); force->create_pair("none",0); force->pair_restart = style; @@ -937,7 +937,7 @@ void ReadRestart::force_fields() style = read_string(); force->create_bond(style,1); delete[] style; - if (comm->me ==0) + if (comm->me == 0) utils::logmesg(lmp," restoring bond style {} from restart\n", force->bond_style); force->bond->read_restart(fp); @@ -946,7 +946,7 @@ void ReadRestart::force_fields() style = read_string(); force->create_angle(style,1); delete[] style; - if (comm->me ==0) + if (comm->me == 0) utils::logmesg(lmp," restoring angle style {} from restart\n", force->angle_style); force->angle->read_restart(fp); @@ -955,7 +955,7 @@ void ReadRestart::force_fields() style = read_string(); force->create_dihedral(style,1); delete[] style; - if (comm->me ==0) + if (comm->me == 0) utils::logmesg(lmp," restoring dihedral style {} from restart\n", force->dihedral_style); force->dihedral->read_restart(fp); @@ -964,7 +964,7 @@ void ReadRestart::force_fields() style = read_string(); force->create_improper(style,1); delete[] style; - if (comm->me ==0) + if (comm->me == 0) utils::logmesg(lmp," restoring improper style {} from restart\n", force->improper_style); force->improper->read_restart(fp); diff --git a/src/variable.cpp b/src/variable.cpp index 4d07a9e3c2..3264cfa1ee 100644 --- a/src/variable.cpp +++ b/src/variable.cpp @@ -2726,7 +2726,7 @@ double Variable::collapse_tree(Tree *tree) if (tree->first->type != VALUE || tree->second->type != VALUE || tree->extra[0]->type != VALUE) return 0.0; tree->type = VALUE; - if (ivalue1 <= 0 || ivalue2 <= 0 || ivalue3 <= 0 ) + if (ivalue1 <= 0 || ivalue2 <= 0 || ivalue3 <= 0) error->all(FLERR,"Invalid math function in variable formula"); if (update->ntimestep < ivalue1) tree->value = ivalue1; else { @@ -3097,7 +3097,7 @@ double Variable::eval_tree(Tree *tree, int i) auto ivalue1 = static_cast (eval_tree(tree->first,i)); auto ivalue2 = static_cast (eval_tree(tree->second,i)); auto ivalue3 = static_cast (eval_tree(tree->extra[0],i)); - if (ivalue1 <= 0 || ivalue2 <= 0 || ivalue3 <= 0 ) + if (ivalue1 <= 0 || ivalue2 <= 0 || ivalue3 <= 0) error->all(FLERR,"Invalid math function in variable formula"); if (update->ntimestep < ivalue1) arg = ivalue1; else { @@ -3628,7 +3628,7 @@ int Variable::math_function(char *word, char *contents, Tree **tree, Tree **tree auto ivalue1 = static_cast (value1); auto ivalue2 = static_cast (value2); auto ivalue3 = static_cast (values[0]); - if (ivalue1 <= 0 || ivalue2 <= 0 || ivalue3 <= 0 ) + if (ivalue1 <= 0 || ivalue2 <= 0 || ivalue3 <= 0) print_var_error(FLERR,"Invalid math function in variable formula",ivar); double value; if (update->ntimestep < ivalue1) value = ivalue1; From 0f89a8b2caf50226c002b2a958d5eb18e41dc39d Mon Sep 17 00:00:00 2001 From: jbcouli Date: Tue, 11 Jul 2023 10:42:26 -0600 Subject: [PATCH 364/396] explicit special_bonds commands for 1-2 coul weight equal to zero --- doc/src/Howto_bpm.rst | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/doc/src/Howto_bpm.rst b/doc/src/Howto_bpm.rst index 448a43a654..380c114866 100644 --- a/doc/src/Howto_bpm.rst +++ b/doc/src/Howto_bpm.rst @@ -110,8 +110,14 @@ ensures all bonded neighbors are still included in the neighbor list in case bonds break between neighbor list builds. If bond breakage is disabled during a simulation run by setting the *break* keyword to *no*, a zero coul weight for 1-2 bonds can be used to exclude bonded atoms -from the neighbor list builds. This can be useful for post-processing, -or to determine pair interaction properties between distinct bonded particles. +from the neighbor list builds + + .. code-block:: LAMMPS + + special_bonds lj 0 1 1 coul 0 1 1 + +This can be useful for post-processing, or to determine pair interaction +properties between distinct bonded particles. To monitor the fracture of bonds in the system, all BPM bond styles have the ability to record instances of bond breakage to output using From 6123883324c95190713bba64b543a5449eef253a Mon Sep 17 00:00:00 2001 From: Karl Hammond Date: Tue, 11 Jul 2023 17:57:22 -0500 Subject: [PATCH 365/396] Replaced parsed-literal:: with code-block:: LAMMPS under "Syntax" --- doc/src/atc_add_molecule.rst | 2 +- doc/src/atc_add_species.rst | 2 +- doc/src/atc_atom_element_map.rst | 2 +- doc/src/atc_atom_weight.rst | 2 +- doc/src/atc_atomic_charge.rst | 2 +- doc/src/atc_boundary_dynamics.rst | 2 +- doc/src/atc_boundary_faceset.rst | 2 +- doc/src/atc_boundary_type.rst | 2 +- doc/src/atc_consistent_fe_initialization.rst | 2 +- doc/src/atc_control_localized_lambda.rst | 2 +- doc/src/atc_control_momentum.rst | 2 +- doc/src/atc_control_thermal.rst | 2 +- doc/src/atc_decomposition.rst | 2 +- doc/src/atc_electron_integration.rst | 2 +- doc/src/atc_equilibrium_start.rst | 2 +- doc/src/atc_extrinsic_exchange.rst | 2 +- doc/src/atc_fe_md_boundary.rst | 2 +- doc/src/atc_filter_scale.rst | 2 +- doc/src/atc_filter_type.rst | 2 +- doc/src/atc_fix.rst | 2 +- doc/src/atc_fix_flux.rst | 2 +- doc/src/atc_hardy_computes.rst | 2 +- doc/src/atc_hardy_fields.rst | 2 +- doc/src/atc_hardy_gradients.rst | 2 +- doc/src/atc_hardy_kernel.rst | 2 +- doc/src/atc_hardy_on_the_fly.rst | 2 +- doc/src/atc_hardy_rates.rst | 2 +- doc/src/atc_initial.rst | 2 +- doc/src/atc_internal_element_set.rst | 2 +- doc/src/atc_internal_quadrature.rst | 2 +- doc/src/atc_kernel_bandwidth.rst | 2 +- doc/src/atc_lumped_lambda_solve.rst | 2 +- doc/src/atc_mask_direction.rst | 2 +- doc/src/atc_mass_matrix.rst | 2 +- doc/src/atc_material.rst | 2 +- doc/src/atc_mesh_add_to_nodeset.rst | 2 +- doc/src/atc_mesh_create.rst | 2 +- doc/src/atc_mesh_create_elementset.rst | 2 +- doc/src/atc_mesh_create_faceset_box.rst | 2 +- doc/src/atc_mesh_create_faceset_plane.rst | 2 +- doc/src/atc_mesh_create_nodeset.rst | 2 +- doc/src/atc_mesh_delete_elements.rst | 2 +- doc/src/atc_mesh_nodeset_to_elementset.rst | 2 +- doc/src/atc_mesh_output.rst | 2 +- doc/src/atc_mesh_quadrature.rst | 2 +- doc/src/atc_mesh_read.rst | 2 +- doc/src/atc_mesh_write.rst | 2 +- doc/src/atc_output.rst | 2 +- doc/src/atc_output_boundary_integral.rst | 2 +- doc/src/atc_output_contour_integral.rst | 2 +- doc/src/atc_output_nodeset.rst | 2 +- doc/src/atc_output_volume_integral.rst | 2 +- doc/src/atc_pair_interactions.rst | 2 +- doc/src/atc_poisson_solver.rst | 2 +- doc/src/atc_read_restart.rst | 2 +- doc/src/atc_remove_molecule.rst | 2 +- doc/src/atc_remove_source.rst | 2 +- doc/src/atc_remove_species.rst | 2 +- doc/src/atc_reset_atomic_reference.rst | 2 +- doc/src/atc_reset_time.rst | 2 +- doc/src/atc_sample_frequency.rst | 2 +- doc/src/atc_set_reference_pe.rst | 2 +- doc/src/atc_source.rst | 2 +- doc/src/atc_source_integration.rst | 2 +- doc/src/atc_temperature_definition.rst | 2 +- doc/src/atc_time_filter.rst | 2 +- doc/src/atc_time_integration.rst | 2 +- doc/src/atc_track_displacement.rst | 2 +- doc/src/atc_unfix.rst | 2 +- doc/src/atc_unfix_flux.rst | 2 +- doc/src/atc_write_atom_weights.rst | 2 +- doc/src/atc_write_restart.rst | 2 +- doc/src/compute_property_grid.rst | 2 +- doc/src/compute_reduce_chunk.rst | 2 +- doc/src/compute_saed.rst | 2 +- doc/src/compute_slice.rst | 2 +- doc/src/compute_smd_contact_radius.rst | 2 +- doc/src/compute_smd_damage.rst | 2 +- doc/src/compute_smd_hourglass_error.rst | 2 +- doc/src/compute_smd_internal_energy.rst | 2 +- doc/src/compute_smd_plastic_strain.rst | 2 +- doc/src/compute_smd_plastic_strain_rate.rst | 2 +- doc/src/compute_smd_rho.rst | 2 +- doc/src/compute_smd_tlsph_defgrad.rst | 2 +- doc/src/compute_smd_tlsph_dt.rst | 2 +- doc/src/compute_smd_tlsph_num_neighs.rst | 2 +- doc/src/compute_smd_tlsph_shape.rst | 2 +- doc/src/compute_smd_tlsph_strain.rst | 2 +- doc/src/compute_smd_tlsph_strain_rate.rst | 2 +- doc/src/compute_smd_tlsph_stress.rst | 2 +- doc/src/compute_smd_triangle_vertices.rst | 2 +- doc/src/compute_smd_vol.rst | 2 +- doc/src/compute_sna_atom.rst | 2 +- doc/src/compute_sph_e_atom.rst | 2 +- doc/src/compute_sph_rho_atom.rst | 2 +- doc/src/compute_sph_t_atom.rst | 2 +- doc/src/dump_image.rst | 2 +- doc/src/dump_molfile.rst | 2 +- doc/src/dump_netcdf.rst | 2 +- doc/src/fitpod_command.rst | 2 +- doc/src/fix_alchemy.rst | 2 +- doc/src/fix_ave_grid.rst | 2 +- doc/src/fix_bond_swap.rst | 2 +- doc/src/fix_box_relax.rst | 2 +- doc/src/fix_charge_regulation.rst | 4 ++-- doc/src/fix_cmap.rst | 2 +- doc/src/fix_colvars.rst | 2 +- doc/src/fix_controller.rst | 2 +- doc/src/fix_damping_cundall.rst | 2 +- doc/src/fix_deform.rst | 2 +- doc/src/fix_deposit.rst | 2 +- doc/src/fix_dpd_energy.rst | 2 +- doc/src/fix_dpd_source.rst | 2 +- doc/src/fix_drag.rst | 2 +- doc/src/fix_drude.rst | 2 +- doc/src/fix_drude_transform.rst | 2 +- doc/src/fix_dt_reset.rst | 2 +- doc/src/fix_efield.rst | 2 +- doc/src/fix_ehex.rst | 2 +- doc/src/fix_electron_stopping.rst | 2 +- doc/src/fix_enforce2d.rst | 2 +- doc/src/fix_eos_cv.rst | 2 +- doc/src/fix_eos_table.rst | 2 +- doc/src/fix_eos_table_rx.rst | 2 +- doc/src/fix_evaporate.rst | 2 +- doc/src/fix_external.rst | 2 +- doc/src/fix_ffl.rst | 2 +- doc/src/fix_filter_corotate.rst | 2 +- doc/src/fix_flow_gauss.rst | 2 +- doc/src/fix_freeze.rst | 2 +- doc/src/fix_gcmc.rst | 2 +- doc/src/fix_gld.rst | 2 +- doc/src/fix_gle.rst | 2 +- doc/src/fix_gravity.rst | 2 +- doc/src/fix_grem.rst | 2 +- doc/src/fix_halt.rst | 2 +- doc/src/fix_heat.rst | 2 +- doc/src/fix_heat_flow.rst | 2 +- doc/src/fix_hyper_global.rst | 2 +- doc/src/fix_hyper_local.rst | 2 +- doc/src/fix_imd.rst | 2 +- doc/src/fix_indent.rst | 2 +- doc/src/fix_ipi.rst | 2 +- doc/src/fix_langevin.rst | 2 +- doc/src/fix_langevin_drude.rst | 2 +- doc/src/fix_langevin_eff.rst | 2 +- doc/src/fix_langevin_spin.rst | 2 +- doc/src/fix_lb_fluid.rst | 2 +- doc/src/fix_lb_momentum.rst | 2 +- doc/src/fix_lb_viscous.rst | 2 +- doc/src/fix_lineforce.rst | 2 +- doc/src/fix_manifoldforce.rst | 2 +- doc/src/fix_mdi_qm.rst | 2 +- doc/src/fix_mdi_qmmm.rst | 2 +- doc/src/fix_meso_move.rst | 2 +- doc/src/fix_mol_swap.rst | 2 +- doc/src/fix_momentum.rst | 2 +- doc/src/fix_move.rst | 2 +- doc/src/fix_mscg.rst | 2 +- doc/src/fix_msst.rst | 2 +- doc/src/fix_mvv_dpd.rst | 2 +- doc/src/fix_neb.rst | 2 +- doc/src/fix_neb_spin.rst | 2 +- doc/src/fix_nh.rst | 2 +- doc/src/fix_nh_eff.rst | 2 +- doc/src/fix_nh_uef.rst | 2 +- doc/src/fix_nph_asphere.rst | 2 +- doc/src/fix_nph_body.rst | 2 +- doc/src/fix_nph_sphere.rst | 2 +- doc/src/fix_nphug.rst | 2 +- doc/src/fix_npt_asphere.rst | 2 +- doc/src/fix_npt_body.rst | 2 +- doc/src/fix_npt_cauchy.rst | 2 +- doc/src/fix_npt_sphere.rst | 2 +- doc/src/fix_numdiff.rst | 2 +- doc/src/fix_numdiff_virial.rst | 2 +- doc/src/fix_nve.rst | 2 +- doc/src/fix_nve_asphere.rst | 2 +- doc/src/fix_nve_asphere_noforce.rst | 2 +- doc/src/fix_nve_awpmd.rst | 2 +- doc/src/fix_nve_body.rst | 2 +- doc/src/fix_nve_bpm_sphere.rst | 2 +- doc/src/fix_nve_dot.rst | 2 +- doc/src/fix_nve_dotc_langevin.rst | 2 +- doc/src/fix_nve_eff.rst | 2 +- doc/src/fix_nve_limit.rst | 2 +- doc/src/fix_nve_line.rst | 2 +- doc/src/fix_nve_manifold_rattle.rst | 2 +- doc/src/fix_nve_noforce.rst | 2 +- doc/src/fix_nve_sphere.rst | 2 +- doc/src/fix_nve_spin.rst | 2 +- doc/src/fix_nve_tri.rst | 2 +- doc/src/fix_nvk.rst | 2 +- doc/src/fix_nvt_asphere.rst | 2 +- doc/src/fix_nvt_body.rst | 2 +- doc/src/fix_nvt_manifold_rattle.rst | 2 +- doc/src/fix_nvt_sllod.rst | 2 +- doc/src/fix_nvt_sllod_eff.rst | 2 +- doc/src/fix_nvt_sphere.rst | 2 +- doc/src/fix_oneway.rst | 2 +- doc/src/fix_orient.rst | 2 +- doc/src/fix_pafi.rst | 2 +- doc/src/fix_pair.rst | 2 +- doc/src/fix_phonon.rst | 2 +- doc/src/fix_pimd.rst | 2 +- doc/src/fix_planeforce.rst | 2 +- doc/src/fix_plumed.rst | 2 +- doc/src/fix_poems.rst | 2 +- doc/src/fix_polarize.rst | 2 +- doc/src/fix_pour.rst | 2 +- doc/src/fix_press_berendsen.rst | 2 +- doc/src/fix_print.rst | 2 +- doc/src/fix_propel_self.rst | 2 +- doc/src/fix_property_atom.rst | 2 +- doc/src/fix_python_invoke.rst | 2 +- doc/src/fix_python_move.rst | 2 +- doc/src/fix_qbmsst.rst | 2 +- doc/src/fix_qeq.rst | 2 +- doc/src/fix_qeq_comb.rst | 2 +- doc/src/fix_qeq_reaxff.rst | 2 +- doc/src/fix_qmmm.rst | 2 +- doc/src/fix_qtb.rst | 2 +- doc/src/fix_reaxff_bonds.rst | 2 +- doc/src/fix_reaxff_species.rst | 2 +- doc/src/fix_recenter.rst | 2 +- doc/src/fix_rhok.rst | 2 +- doc/src/fix_rigid.rst | 2 +- doc/src/fix_rigid_meso.rst | 2 +- doc/src/fix_rx.rst | 2 +- doc/src/fix_saed_vtk.rst | 2 +- doc/src/fix_setforce.rst | 2 +- doc/src/fix_sgcmc.rst | 2 +- doc/src/fix_shake.rst | 2 +- doc/src/fix_shardlow.rst | 2 +- doc/src/fix_smd.rst | 2 +- doc/src/fix_smd_setvel.rst | 2 +- doc/src/fix_sph.rst | 2 +- doc/src/fix_sph_stationary.rst | 2 +- doc/src/fix_spring.rst | 2 +- doc/src/fix_spring_chunk.rst | 2 +- doc/src/fix_spring_rg.rst | 2 +- doc/src/fix_spring_self.rst | 2 +- doc/src/fix_srd.rst | 2 +- doc/src/fix_store_force.rst | 2 +- doc/src/fix_store_state.rst | 2 +- doc/src/fix_temp_berendsen.rst | 2 +- doc/src/fix_temp_csvr.rst | 2 +- doc/src/fix_temp_rescale.rst | 2 +- doc/src/fix_temp_rescale_eff.rst | 2 +- doc/src/fix_tfmc.rst | 2 +- doc/src/fix_tgnh_drude.rst | 2 +- doc/src/fix_thermal_conductivity.rst | 2 +- doc/src/fix_ti_spring.rst | 2 +- doc/src/fix_tmd.rst | 2 +- doc/src/fix_ttm.rst | 2 +- doc/src/fix_tune_kspace.rst | 2 +- doc/src/fix_vector.rst | 2 +- doc/src/fix_viscosity.rst | 2 +- doc/src/fix_viscous.rst | 2 +- doc/src/fix_viscous_sphere.rst | 2 +- doc/src/fix_wall.rst | 2 +- doc/src/fix_wall_body_polygon.rst | 2 +- doc/src/fix_wall_body_polyhedron.rst | 2 +- doc/src/fix_wall_ees.rst | 2 +- doc/src/fix_wall_gran.rst | 2 +- doc/src/fix_wall_gran_region.rst | 2 +- doc/src/fix_wall_piston.rst | 2 +- doc/src/fix_wall_reflect.rst | 2 +- doc/src/fix_wall_reflect_stochastic.rst | 2 +- doc/src/fix_wall_region.rst | 2 +- doc/src/fix_wall_srd.rst | 2 +- doc/src/fix_widom.rst | 2 +- doc/src/group2ndx.rst | 2 +- doc/src/hyper.rst | 2 +- doc/src/include.rst | 2 +- doc/src/info.rst | 2 +- doc/src/jump.rst | 2 +- doc/src/label.rst | 2 +- doc/src/lattice.rst | 2 +- doc/src/log.rst | 2 +- doc/src/mass.rst | 2 +- doc/src/min_style.rst | 2 +- doc/src/minimize.rst | 2 +- doc/src/molecule.rst | 2 +- doc/src/neb.rst | 2 +- doc/src/neb_spin.rst | 2 +- doc/src/neighbor.rst | 2 +- doc/src/newton.rst | 2 +- doc/src/next.rst | 2 +- doc/src/package.rst | 2 +- doc/src/partition.rst | 2 +- doc/src/plugin.rst | 2 +- doc/src/prd.rst | 2 +- doc/src/print.rst | 2 +- doc/src/processors.rst | 2 +- doc/src/python.rst | 2 +- doc/src/quit.rst | 2 +- doc/src/region.rst | 2 +- doc/src/replicate.rst | 2 +- doc/src/rerun.rst | 2 +- doc/src/restart.rst | 2 +- doc/src/run.rst | 2 +- doc/src/set.rst | 2 +- doc/src/shell.rst | 2 +- doc/src/suffix.rst | 2 +- doc/src/tad.rst | 2 +- doc/src/temper.rst | 2 +- doc/src/temper_grem.rst | 2 +- doc/src/temper_npt.rst | 2 +- doc/src/thermo.rst | 2 +- doc/src/timer.rst | 2 +- doc/src/timestep.rst | 2 +- doc/src/uncompute.rst | 2 +- doc/src/undump.rst | 2 +- doc/src/unfix.rst | 2 +- doc/src/units.rst | 2 +- doc/src/variable.rst | 2 +- doc/src/velocity.rst | 2 +- 318 files changed, 319 insertions(+), 319 deletions(-) diff --git a/doc/src/atc_add_molecule.rst b/doc/src/atc_add_molecule.rst index dc0f0318ac..68330da256 100644 --- a/doc/src/atc_add_molecule.rst +++ b/doc/src/atc_add_molecule.rst @@ -6,7 +6,7 @@ fix_modify AtC add_molecule command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix_modify add_molecule diff --git a/doc/src/atc_add_species.rst b/doc/src/atc_add_species.rst index 0b39379e62..3fc2bcb2d3 100644 --- a/doc/src/atc_add_species.rst +++ b/doc/src/atc_add_species.rst @@ -6,7 +6,7 @@ fix_modify AtC add_species command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix_modify add_species diff --git a/doc/src/atc_atom_element_map.rst b/doc/src/atc_atom_element_map.rst index 96895acc8e..f614e8f350 100644 --- a/doc/src/atc_atom_element_map.rst +++ b/doc/src/atc_atom_element_map.rst @@ -6,7 +6,7 @@ fix_modify AtC atom_element_map command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix_modify atom_element_map [] diff --git a/doc/src/atc_atom_weight.rst b/doc/src/atc_atom_weight.rst index 50e7ea146d..1e1d771ef1 100644 --- a/doc/src/atc_atom_weight.rst +++ b/doc/src/atc_atom_weight.rst @@ -6,7 +6,7 @@ fix_modify AtC atom_weight command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix_modify atom_weight diff --git a/doc/src/atc_atomic_charge.rst b/doc/src/atc_atomic_charge.rst index 4b3d34b815..1207043324 100644 --- a/doc/src/atc_atomic_charge.rst +++ b/doc/src/atc_atomic_charge.rst @@ -6,7 +6,7 @@ fix_modify AtC atomic_charge command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix_modify atomic_charge diff --git a/doc/src/atc_boundary_dynamics.rst b/doc/src/atc_boundary_dynamics.rst index 696d091094..6b571f53d0 100644 --- a/doc/src/atc_boundary_dynamics.rst +++ b/doc/src/atc_boundary_dynamics.rst @@ -6,7 +6,7 @@ fix_modify AtC boundary_dynamics command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix_modify boundary_dynamics diff --git a/doc/src/atc_boundary_faceset.rst b/doc/src/atc_boundary_faceset.rst index c33239b833..7c0654cc00 100644 --- a/doc/src/atc_boundary_faceset.rst +++ b/doc/src/atc_boundary_faceset.rst @@ -6,7 +6,7 @@ fix_modify AtC boundary_faceset command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix_modify boundary_faceset diff --git a/doc/src/atc_boundary_type.rst b/doc/src/atc_boundary_type.rst index 26b40e5a12..a43c17a658 100644 --- a/doc/src/atc_boundary_type.rst +++ b/doc/src/atc_boundary_type.rst @@ -6,7 +6,7 @@ fix_modify AtC boundary type command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix_modify boundary type diff --git a/doc/src/atc_consistent_fe_initialization.rst b/doc/src/atc_consistent_fe_initialization.rst index 3241752262..78f7699906 100644 --- a/doc/src/atc_consistent_fe_initialization.rst +++ b/doc/src/atc_consistent_fe_initialization.rst @@ -6,7 +6,7 @@ fix_modify AtC consistent_fe_initialization command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix_modify consistent_fe_initialization diff --git a/doc/src/atc_control_localized_lambda.rst b/doc/src/atc_control_localized_lambda.rst index eb286756b7..ca0bba30d5 100644 --- a/doc/src/atc_control_localized_lambda.rst +++ b/doc/src/atc_control_localized_lambda.rst @@ -6,7 +6,7 @@ fix_modify AtC control localized_lambda command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix_modify control localized_lambda diff --git a/doc/src/atc_control_momentum.rst b/doc/src/atc_control_momentum.rst index e87bd789b9..fcc3570e06 100644 --- a/doc/src/atc_control_momentum.rst +++ b/doc/src/atc_control_momentum.rst @@ -6,7 +6,7 @@ fix_modify AtC control momentum command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix_modify control fix_modify AtC control momentum none diff --git a/doc/src/atc_control_thermal.rst b/doc/src/atc_control_thermal.rst index 7a17701c5c..c14e52ac8f 100644 --- a/doc/src/atc_control_thermal.rst +++ b/doc/src/atc_control_thermal.rst @@ -6,7 +6,7 @@ fix_modify AtC control thermal command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix_modify control fix_modify control thermal diff --git a/doc/src/atc_decomposition.rst b/doc/src/atc_decomposition.rst index 50d11bf52f..182a27d915 100644 --- a/doc/src/atc_decomposition.rst +++ b/doc/src/atc_decomposition.rst @@ -6,7 +6,7 @@ fix_modify AtC decomposition command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix_modify decomposition diff --git a/doc/src/atc_electron_integration.rst b/doc/src/atc_electron_integration.rst index 2f3fd9eee2..b3cd858e3d 100644 --- a/doc/src/atc_electron_integration.rst +++ b/doc/src/atc_electron_integration.rst @@ -6,7 +6,7 @@ fix_modify AtC extrinsic electron_integration command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix_modify extrinsic electron_integration [] diff --git a/doc/src/atc_equilibrium_start.rst b/doc/src/atc_equilibrium_start.rst index 0068dc02c3..b1ef99dc11 100644 --- a/doc/src/atc_equilibrium_start.rst +++ b/doc/src/atc_equilibrium_start.rst @@ -6,7 +6,7 @@ fix_modify AtC equilibrium_start command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix_modify equilibrium_start diff --git a/doc/src/atc_extrinsic_exchange.rst b/doc/src/atc_extrinsic_exchange.rst index 03d794115b..55aa4115b5 100644 --- a/doc/src/atc_extrinsic_exchange.rst +++ b/doc/src/atc_extrinsic_exchange.rst @@ -6,7 +6,7 @@ fix_modify AtC extrinsic exchange command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix_modify extrinsic exchange diff --git a/doc/src/atc_fe_md_boundary.rst b/doc/src/atc_fe_md_boundary.rst index ad66bf6d49..ebc783c333 100644 --- a/doc/src/atc_fe_md_boundary.rst +++ b/doc/src/atc_fe_md_boundary.rst @@ -6,7 +6,7 @@ fix_modify AtC fe_md_boundary command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix_modify fe_md_boundary diff --git a/doc/src/atc_filter_scale.rst b/doc/src/atc_filter_scale.rst index ce62a589eb..100906d9f7 100644 --- a/doc/src/atc_filter_scale.rst +++ b/doc/src/atc_filter_scale.rst @@ -6,7 +6,7 @@ fix_modify AtC filter scale command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix_modify filter scale diff --git a/doc/src/atc_filter_type.rst b/doc/src/atc_filter_type.rst index 5e2da80755..605c84c192 100644 --- a/doc/src/atc_filter_type.rst +++ b/doc/src/atc_filter_type.rst @@ -6,7 +6,7 @@ fix_modify AtC filter type command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix_modify filter type diff --git a/doc/src/atc_fix.rst b/doc/src/atc_fix.rst index d3ba972508..77bc37ccef 100644 --- a/doc/src/atc_fix.rst +++ b/doc/src/atc_fix.rst @@ -6,7 +6,7 @@ fix_modify AtC fix command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix_modify fix diff --git a/doc/src/atc_fix_flux.rst b/doc/src/atc_fix_flux.rst index 12699e9163..71513eb1f9 100644 --- a/doc/src/atc_fix_flux.rst +++ b/doc/src/atc_fix_flux.rst @@ -6,7 +6,7 @@ fix_modify AtC fix_flux command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix_modify fix_flux diff --git a/doc/src/atc_hardy_computes.rst b/doc/src/atc_hardy_computes.rst index 609740fe99..fe42a6265f 100644 --- a/doc/src/atc_hardy_computes.rst +++ b/doc/src/atc_hardy_computes.rst @@ -6,7 +6,7 @@ fix_modify AtC computes command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix_modify computes diff --git a/doc/src/atc_hardy_fields.rst b/doc/src/atc_hardy_fields.rst index bef051bbe8..0159bb55ab 100644 --- a/doc/src/atc_hardy_fields.rst +++ b/doc/src/atc_hardy_fields.rst @@ -6,7 +6,7 @@ fix_modify AtC fields command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix_modify fields fix_modify fields diff --git a/doc/src/atc_hardy_gradients.rst b/doc/src/atc_hardy_gradients.rst index 2e7649d73c..52d05eac7c 100644 --- a/doc/src/atc_hardy_gradients.rst +++ b/doc/src/atc_hardy_gradients.rst @@ -6,7 +6,7 @@ fix_modify AtC gradients command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix_modify gradients diff --git a/doc/src/atc_hardy_kernel.rst b/doc/src/atc_hardy_kernel.rst index 74316ec8b2..b3a10e8e99 100644 --- a/doc/src/atc_hardy_kernel.rst +++ b/doc/src/atc_hardy_kernel.rst @@ -6,7 +6,7 @@ fix_modify AtC kernel command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix_modify kernel diff --git a/doc/src/atc_hardy_on_the_fly.rst b/doc/src/atc_hardy_on_the_fly.rst index fe7c688387..4635d72d13 100644 --- a/doc/src/atc_hardy_on_the_fly.rst +++ b/doc/src/atc_hardy_on_the_fly.rst @@ -6,7 +6,7 @@ fix_modify AtC on_the_fly command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix_modify on_the_fly diff --git a/doc/src/atc_hardy_rates.rst b/doc/src/atc_hardy_rates.rst index 56166087d7..0c23e211ba 100644 --- a/doc/src/atc_hardy_rates.rst +++ b/doc/src/atc_hardy_rates.rst @@ -6,7 +6,7 @@ fix_modify AtC rates command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix_modify rates diff --git a/doc/src/atc_initial.rst b/doc/src/atc_initial.rst index 7d62251c6c..721f0f3538 100644 --- a/doc/src/atc_initial.rst +++ b/doc/src/atc_initial.rst @@ -6,7 +6,7 @@ fix_modify AtC initial command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix_modify initial diff --git a/doc/src/atc_internal_element_set.rst b/doc/src/atc_internal_element_set.rst index 4a376f55a3..e50463feed 100644 --- a/doc/src/atc_internal_element_set.rst +++ b/doc/src/atc_internal_element_set.rst @@ -6,7 +6,7 @@ fix_modify AtC internal_element_set command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix_modify internal_element_set diff --git a/doc/src/atc_internal_quadrature.rst b/doc/src/atc_internal_quadrature.rst index b171914021..d8e241572c 100644 --- a/doc/src/atc_internal_quadrature.rst +++ b/doc/src/atc_internal_quadrature.rst @@ -6,7 +6,7 @@ fix_modify AtC internal_quadrature command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix_modify internal_quadrature [region] diff --git a/doc/src/atc_kernel_bandwidth.rst b/doc/src/atc_kernel_bandwidth.rst index 02707cfd30..f166a063e3 100644 --- a/doc/src/atc_kernel_bandwidth.rst +++ b/doc/src/atc_kernel_bandwidth.rst @@ -6,7 +6,7 @@ fix_modify AtC kernel_bandwidth command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix_modify kernel_bandwidth diff --git a/doc/src/atc_lumped_lambda_solve.rst b/doc/src/atc_lumped_lambda_solve.rst index e777116da5..b64ffb2d01 100644 --- a/doc/src/atc_lumped_lambda_solve.rst +++ b/doc/src/atc_lumped_lambda_solve.rst @@ -6,7 +6,7 @@ fix_modify AtC control lumped_lambda_solve command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix_modify control lumped_lambda_solve diff --git a/doc/src/atc_mask_direction.rst b/doc/src/atc_mask_direction.rst index ed5c605834..0e55cc7190 100644 --- a/doc/src/atc_mask_direction.rst +++ b/doc/src/atc_mask_direction.rst @@ -6,7 +6,7 @@ fix_modify AtC control mask_direction command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix_modify control mask_direction diff --git a/doc/src/atc_mass_matrix.rst b/doc/src/atc_mass_matrix.rst index eb586b933b..7763044ec8 100644 --- a/doc/src/atc_mass_matrix.rst +++ b/doc/src/atc_mass_matrix.rst @@ -6,7 +6,7 @@ fix_modify AtC mass_matrix command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix_modify mass_matrix diff --git a/doc/src/atc_material.rst b/doc/src/atc_material.rst index 471bffffb2..eef5dbdd0e 100644 --- a/doc/src/atc_material.rst +++ b/doc/src/atc_material.rst @@ -6,7 +6,7 @@ fix_modify AtC material command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix_modify material diff --git a/doc/src/atc_mesh_add_to_nodeset.rst b/doc/src/atc_mesh_add_to_nodeset.rst index f9f6f575fe..0944a51099 100644 --- a/doc/src/atc_mesh_add_to_nodeset.rst +++ b/doc/src/atc_mesh_add_to_nodeset.rst @@ -6,7 +6,7 @@ fix_modify AtC mesh add_to_nodeset command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix_modify mesh add_to_nodeset diff --git a/doc/src/atc_mesh_create.rst b/doc/src/atc_mesh_create.rst index b17bb8ac0d..289c0e5c56 100644 --- a/doc/src/atc_mesh_create.rst +++ b/doc/src/atc_mesh_create.rst @@ -6,7 +6,7 @@ fix_modify AtC mesh create command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix_modify mesh create diff --git a/doc/src/atc_mesh_create_elementset.rst b/doc/src/atc_mesh_create_elementset.rst index 3cb406e7bc..35086b0fc9 100644 --- a/doc/src/atc_mesh_create_elementset.rst +++ b/doc/src/atc_mesh_create_elementset.rst @@ -6,7 +6,7 @@ fix_modify AtC mesh create_elementset command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix_modify mesh create_elementset diff --git a/doc/src/atc_mesh_create_faceset_box.rst b/doc/src/atc_mesh_create_faceset_box.rst index 09b099d179..29dcfa69ad 100644 --- a/doc/src/atc_mesh_create_faceset_box.rst +++ b/doc/src/atc_mesh_create_faceset_box.rst @@ -6,7 +6,7 @@ fix_modify AtC mesh create_faceset box command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix_modify mesh create_faceset box [units] diff --git a/doc/src/atc_mesh_create_faceset_plane.rst b/doc/src/atc_mesh_create_faceset_plane.rst index 035e584044..e36990de40 100644 --- a/doc/src/atc_mesh_create_faceset_plane.rst +++ b/doc/src/atc_mesh_create_faceset_plane.rst @@ -6,7 +6,7 @@ fix_modify AtC mesh create_faceset plane command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix_modify mesh create_faceset plane [units] diff --git a/doc/src/atc_mesh_create_nodeset.rst b/doc/src/atc_mesh_create_nodeset.rst index a2f9d74d07..943d1c7d19 100644 --- a/doc/src/atc_mesh_create_nodeset.rst +++ b/doc/src/atc_mesh_create_nodeset.rst @@ -6,7 +6,7 @@ fix_modify AtC mesh create_nodeset command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix_modify mesh create_nodeset diff --git a/doc/src/atc_mesh_delete_elements.rst b/doc/src/atc_mesh_delete_elements.rst index 9785f0adf6..2c9d83d506 100644 --- a/doc/src/atc_mesh_delete_elements.rst +++ b/doc/src/atc_mesh_delete_elements.rst @@ -6,7 +6,7 @@ fix_modify AtC mesh delete_elements command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix_modify mesh delete_elements diff --git a/doc/src/atc_mesh_nodeset_to_elementset.rst b/doc/src/atc_mesh_nodeset_to_elementset.rst index d8721cc295..1838aa120f 100644 --- a/doc/src/atc_mesh_nodeset_to_elementset.rst +++ b/doc/src/atc_mesh_nodeset_to_elementset.rst @@ -6,7 +6,7 @@ fix_modify AtC mesh nodeset_to_elementset command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix_modify mesh nodeset_to_elementset diff --git a/doc/src/atc_mesh_output.rst b/doc/src/atc_mesh_output.rst index 63756df98e..237b88eff6 100644 --- a/doc/src/atc_mesh_output.rst +++ b/doc/src/atc_mesh_output.rst @@ -6,7 +6,7 @@ fix_modify AtC mesh output command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix_modify mesh output diff --git a/doc/src/atc_mesh_quadrature.rst b/doc/src/atc_mesh_quadrature.rst index 0c9bd4b30f..4cc94d77e2 100644 --- a/doc/src/atc_mesh_quadrature.rst +++ b/doc/src/atc_mesh_quadrature.rst @@ -6,7 +6,7 @@ fix_modify AtC mesh quadrature command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix_modify mesh quatrature diff --git a/doc/src/atc_mesh_read.rst b/doc/src/atc_mesh_read.rst index 9848e12b07..dcc999166f 100644 --- a/doc/src/atc_mesh_read.rst +++ b/doc/src/atc_mesh_read.rst @@ -6,7 +6,7 @@ fix_modify AtC mesh read command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix_modify mesh read diff --git a/doc/src/atc_mesh_write.rst b/doc/src/atc_mesh_write.rst index dbb8f9c219..2636f51fc5 100644 --- a/doc/src/atc_mesh_write.rst +++ b/doc/src/atc_mesh_write.rst @@ -6,7 +6,7 @@ fix_modify AtC mesh write command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix_modify mesh write diff --git a/doc/src/atc_output.rst b/doc/src/atc_output.rst index 5003817daa..13df4c7d58 100644 --- a/doc/src/atc_output.rst +++ b/doc/src/atc_output.rst @@ -6,7 +6,7 @@ fix_modify AtC output command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix_modify output [text|full_text|binary|vector_components|tensor_components] fix_modify output index [step|time] diff --git a/doc/src/atc_output_boundary_integral.rst b/doc/src/atc_output_boundary_integral.rst index 71a3e03ac2..65ad6e835e 100644 --- a/doc/src/atc_output_boundary_integral.rst +++ b/doc/src/atc_output_boundary_integral.rst @@ -6,7 +6,7 @@ fix_modify AtC output boundary_integral command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix_modify output boundary_integral faceset [name] diff --git a/doc/src/atc_output_contour_integral.rst b/doc/src/atc_output_contour_integral.rst index 24678ef6cc..fa6ab8c9d1 100644 --- a/doc/src/atc_output_contour_integral.rst +++ b/doc/src/atc_output_contour_integral.rst @@ -6,7 +6,7 @@ fix_modify AtC output contour_integral command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix_modify output contour_integral faceset [axis [x|y|z]] diff --git a/doc/src/atc_output_nodeset.rst b/doc/src/atc_output_nodeset.rst index eb12a2344e..e5d1580274 100644 --- a/doc/src/atc_output_nodeset.rst +++ b/doc/src/atc_output_nodeset.rst @@ -6,7 +6,7 @@ fix_modify AtC output nodeset command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix_modify output nodeset diff --git a/doc/src/atc_output_volume_integral.rst b/doc/src/atc_output_volume_integral.rst index 464d43cbce..a740c56e8b 100644 --- a/doc/src/atc_output_volume_integral.rst +++ b/doc/src/atc_output_volume_integral.rst @@ -6,7 +6,7 @@ fix_modify AtC output volume_integral command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix_modify output volume_integral diff --git a/doc/src/atc_pair_interactions.rst b/doc/src/atc_pair_interactions.rst index 73ada09001..d8de219d89 100644 --- a/doc/src/atc_pair_interactions.rst +++ b/doc/src/atc_pair_interactions.rst @@ -9,7 +9,7 @@ fix_modify AtC bond_interactions command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix_modify pair_interactions fix_modify bond_interactions diff --git a/doc/src/atc_poisson_solver.rst b/doc/src/atc_poisson_solver.rst index d37f214b97..e203c3dc51 100644 --- a/doc/src/atc_poisson_solver.rst +++ b/doc/src/atc_poisson_solver.rst @@ -6,7 +6,7 @@ fix_modify AtC poisson_solver command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix_modify poisson_solver mesh create diff --git a/doc/src/atc_read_restart.rst b/doc/src/atc_read_restart.rst index 11ba4519a4..32badbd3a8 100644 --- a/doc/src/atc_read_restart.rst +++ b/doc/src/atc_read_restart.rst @@ -6,7 +6,7 @@ fix_modify AtC read_restart command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix_modify read_restart diff --git a/doc/src/atc_remove_molecule.rst b/doc/src/atc_remove_molecule.rst index a654cd5c1d..13c0856307 100644 --- a/doc/src/atc_remove_molecule.rst +++ b/doc/src/atc_remove_molecule.rst @@ -6,7 +6,7 @@ fix_modify AtC remove_molecule command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix_modify remove_molecule diff --git a/doc/src/atc_remove_source.rst b/doc/src/atc_remove_source.rst index d98b7933da..253166cd3c 100644 --- a/doc/src/atc_remove_source.rst +++ b/doc/src/atc_remove_source.rst @@ -6,7 +6,7 @@ fix_modify AtC remove_source command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix_modify remove_source diff --git a/doc/src/atc_remove_species.rst b/doc/src/atc_remove_species.rst index 5c4fd771ba..b7718a6874 100644 --- a/doc/src/atc_remove_species.rst +++ b/doc/src/atc_remove_species.rst @@ -6,7 +6,7 @@ fix_modify AtC remove_species command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix_modify remove_species diff --git a/doc/src/atc_reset_atomic_reference.rst b/doc/src/atc_reset_atomic_reference.rst index 8f53cbfbe9..43acc9b4b2 100644 --- a/doc/src/atc_reset_atomic_reference.rst +++ b/doc/src/atc_reset_atomic_reference.rst @@ -6,7 +6,7 @@ fix_modify AtC reset_atomic_reference_positions command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix_modify reset_atomic_reference_positions diff --git a/doc/src/atc_reset_time.rst b/doc/src/atc_reset_time.rst index 147a6ab910..f02c723011 100644 --- a/doc/src/atc_reset_time.rst +++ b/doc/src/atc_reset_time.rst @@ -6,7 +6,7 @@ fix_modify AtC reset_time command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix_modify reset_time diff --git a/doc/src/atc_sample_frequency.rst b/doc/src/atc_sample_frequency.rst index 5b0da6d9dd..e61e9fd6ed 100644 --- a/doc/src/atc_sample_frequency.rst +++ b/doc/src/atc_sample_frequency.rst @@ -6,7 +6,7 @@ fix_modify AtC sample_frequency command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix_modify sample_frequency diff --git a/doc/src/atc_set_reference_pe.rst b/doc/src/atc_set_reference_pe.rst index 8053a1df98..f85e3f7ebc 100644 --- a/doc/src/atc_set_reference_pe.rst +++ b/doc/src/atc_set_reference_pe.rst @@ -6,7 +6,7 @@ fix_modify AtC set reference_potential_energy command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix_modify set reference_potential_energy [] diff --git a/doc/src/atc_source.rst b/doc/src/atc_source.rst index 6df4b67d1c..ce712c8186 100644 --- a/doc/src/atc_source.rst +++ b/doc/src/atc_source.rst @@ -6,7 +6,7 @@ fix_modify AtC source command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix_modify source diff --git a/doc/src/atc_source_integration.rst b/doc/src/atc_source_integration.rst index b10e6c7e2a..a145a7c9f1 100644 --- a/doc/src/atc_source_integration.rst +++ b/doc/src/atc_source_integration.rst @@ -6,7 +6,7 @@ fix_modify AtC source_integration command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix_modify source_integration diff --git a/doc/src/atc_temperature_definition.rst b/doc/src/atc_temperature_definition.rst index b5a27467ca..0194e38314 100644 --- a/doc/src/atc_temperature_definition.rst +++ b/doc/src/atc_temperature_definition.rst @@ -6,7 +6,7 @@ fix_modify AtC temperature_definition command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix_modify temperature_definition diff --git a/doc/src/atc_time_filter.rst b/doc/src/atc_time_filter.rst index 0a97c83259..76163a77b5 100644 --- a/doc/src/atc_time_filter.rst +++ b/doc/src/atc_time_filter.rst @@ -6,7 +6,7 @@ fix_modify AtC filter command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix_modify filter diff --git a/doc/src/atc_time_integration.rst b/doc/src/atc_time_integration.rst index cf746dde0d..3eae147a6e 100644 --- a/doc/src/atc_time_integration.rst +++ b/doc/src/atc_time_integration.rst @@ -6,7 +6,7 @@ fix_modify AtC time_integration command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix_modify time_integration diff --git a/doc/src/atc_track_displacement.rst b/doc/src/atc_track_displacement.rst index 043f42ea9c..f5a2d1742c 100644 --- a/doc/src/atc_track_displacement.rst +++ b/doc/src/atc_track_displacement.rst @@ -6,7 +6,7 @@ fix_modify AtC track_displacement command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix_modify track_displacement diff --git a/doc/src/atc_unfix.rst b/doc/src/atc_unfix.rst index 12ee37bbde..c6ada6dcca 100644 --- a/doc/src/atc_unfix.rst +++ b/doc/src/atc_unfix.rst @@ -6,7 +6,7 @@ fix_modify AtC unfix command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix_modify unfix diff --git a/doc/src/atc_unfix_flux.rst b/doc/src/atc_unfix_flux.rst index da9d1b4aba..73ef5b17af 100644 --- a/doc/src/atc_unfix_flux.rst +++ b/doc/src/atc_unfix_flux.rst @@ -6,7 +6,7 @@ fix_modify AtC unfix_flux command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix_modify unfix_flux diff --git a/doc/src/atc_write_atom_weights.rst b/doc/src/atc_write_atom_weights.rst index ecb69b5deb..40af619356 100644 --- a/doc/src/atc_write_atom_weights.rst +++ b/doc/src/atc_write_atom_weights.rst @@ -6,7 +6,7 @@ fix_modify AtC write_atom_weights command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix_modify write_atom_weights diff --git a/doc/src/atc_write_restart.rst b/doc/src/atc_write_restart.rst index e4f19dea10..75945e1715 100644 --- a/doc/src/atc_write_restart.rst +++ b/doc/src/atc_write_restart.rst @@ -6,7 +6,7 @@ fix_modify AtC write_restart command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix_modify write_restart diff --git a/doc/src/compute_property_grid.rst b/doc/src/compute_property_grid.rst index e65e822516..44389320d6 100644 --- a/doc/src/compute_property_grid.rst +++ b/doc/src/compute_property_grid.rst @@ -6,7 +6,7 @@ compute property/grid command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS compute ID group-ID property/grid Nx Ny Nz input1 input2 ... diff --git a/doc/src/compute_reduce_chunk.rst b/doc/src/compute_reduce_chunk.rst index 43fee39cf2..8ec19ade66 100644 --- a/doc/src/compute_reduce_chunk.rst +++ b/doc/src/compute_reduce_chunk.rst @@ -6,7 +6,7 @@ compute reduce/chunk command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS compute ID group-ID reduce/chunk chunkID mode input1 input2 ... diff --git a/doc/src/compute_saed.rst b/doc/src/compute_saed.rst index deb6a61f7c..9ec455d03b 100644 --- a/doc/src/compute_saed.rst +++ b/doc/src/compute_saed.rst @@ -6,7 +6,7 @@ compute saed command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS compute ID group-ID saed lambda type1 type2 ... typeN keyword value ... diff --git a/doc/src/compute_slice.rst b/doc/src/compute_slice.rst index 9b4e7df626..0da7c99573 100644 --- a/doc/src/compute_slice.rst +++ b/doc/src/compute_slice.rst @@ -6,7 +6,7 @@ compute slice command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS compute ID group-ID slice Nstart Nstop Nskip input1 input2 ... diff --git a/doc/src/compute_smd_contact_radius.rst b/doc/src/compute_smd_contact_radius.rst index 4911ac4e27..2ac039a3b5 100644 --- a/doc/src/compute_smd_contact_radius.rst +++ b/doc/src/compute_smd_contact_radius.rst @@ -6,7 +6,7 @@ compute smd/contact/radius command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS compute ID group-ID smd/contact/radius diff --git a/doc/src/compute_smd_damage.rst b/doc/src/compute_smd_damage.rst index fe5d94fa83..72307bc184 100644 --- a/doc/src/compute_smd_damage.rst +++ b/doc/src/compute_smd_damage.rst @@ -6,7 +6,7 @@ compute smd/damage command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS compute ID group-ID smd/damage diff --git a/doc/src/compute_smd_hourglass_error.rst b/doc/src/compute_smd_hourglass_error.rst index 7e0aadd6d2..533c0f03c0 100644 --- a/doc/src/compute_smd_hourglass_error.rst +++ b/doc/src/compute_smd_hourglass_error.rst @@ -6,7 +6,7 @@ compute smd/hourglass/error command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS compute ID group-ID smd/hourglass/error diff --git a/doc/src/compute_smd_internal_energy.rst b/doc/src/compute_smd_internal_energy.rst index 36bd816e8f..91c671c6a1 100644 --- a/doc/src/compute_smd_internal_energy.rst +++ b/doc/src/compute_smd_internal_energy.rst @@ -6,7 +6,7 @@ compute smd/internal/energy command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS compute ID group-ID smd/internal/energy diff --git a/doc/src/compute_smd_plastic_strain.rst b/doc/src/compute_smd_plastic_strain.rst index 00c6cb9a4a..b1e5719249 100644 --- a/doc/src/compute_smd_plastic_strain.rst +++ b/doc/src/compute_smd_plastic_strain.rst @@ -6,7 +6,7 @@ compute smd/plastic/strain command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS compute ID group-ID smd/plastic/strain diff --git a/doc/src/compute_smd_plastic_strain_rate.rst b/doc/src/compute_smd_plastic_strain_rate.rst index 681573be9b..bf9b3b23f4 100644 --- a/doc/src/compute_smd_plastic_strain_rate.rst +++ b/doc/src/compute_smd_plastic_strain_rate.rst @@ -6,7 +6,7 @@ compute smd/plastic/strain/rate command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS compute ID group-ID smd/plastic/strain/rate diff --git a/doc/src/compute_smd_rho.rst b/doc/src/compute_smd_rho.rst index 605dd5b79c..8ecb09f318 100644 --- a/doc/src/compute_smd_rho.rst +++ b/doc/src/compute_smd_rho.rst @@ -6,7 +6,7 @@ compute smd/rho command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS compute ID group-ID smd/rho diff --git a/doc/src/compute_smd_tlsph_defgrad.rst b/doc/src/compute_smd_tlsph_defgrad.rst index 399e54d055..aceecc1722 100644 --- a/doc/src/compute_smd_tlsph_defgrad.rst +++ b/doc/src/compute_smd_tlsph_defgrad.rst @@ -6,7 +6,7 @@ compute smd/tlsph/defgrad command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS compute ID group-ID smd/tlsph/defgrad diff --git a/doc/src/compute_smd_tlsph_dt.rst b/doc/src/compute_smd_tlsph_dt.rst index 9490f7da14..1cafecdb7c 100644 --- a/doc/src/compute_smd_tlsph_dt.rst +++ b/doc/src/compute_smd_tlsph_dt.rst @@ -6,7 +6,7 @@ compute smd/tlsph/dt command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS compute ID group-ID smd/tlsph/dt diff --git a/doc/src/compute_smd_tlsph_num_neighs.rst b/doc/src/compute_smd_tlsph_num_neighs.rst index ef8c19d49c..8bf244a8db 100644 --- a/doc/src/compute_smd_tlsph_num_neighs.rst +++ b/doc/src/compute_smd_tlsph_num_neighs.rst @@ -6,7 +6,7 @@ compute smd/tlsph/num/neighs command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS compute ID group-ID smd/tlsph/num/neighs diff --git a/doc/src/compute_smd_tlsph_shape.rst b/doc/src/compute_smd_tlsph_shape.rst index 4a5abd868b..b682e72fdd 100644 --- a/doc/src/compute_smd_tlsph_shape.rst +++ b/doc/src/compute_smd_tlsph_shape.rst @@ -6,7 +6,7 @@ compute smd/tlsph/shape command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS compute ID group-ID smd/tlsph/shape diff --git a/doc/src/compute_smd_tlsph_strain.rst b/doc/src/compute_smd_tlsph_strain.rst index 053488886b..89b9bee132 100644 --- a/doc/src/compute_smd_tlsph_strain.rst +++ b/doc/src/compute_smd_tlsph_strain.rst @@ -6,7 +6,7 @@ compute smd/tlsph/strain command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS compute ID group-ID smd/tlsph/strain diff --git a/doc/src/compute_smd_tlsph_strain_rate.rst b/doc/src/compute_smd_tlsph_strain_rate.rst index 2f3d561cee..83797edd49 100644 --- a/doc/src/compute_smd_tlsph_strain_rate.rst +++ b/doc/src/compute_smd_tlsph_strain_rate.rst @@ -6,7 +6,7 @@ compute smd/tlsph/strain/rate command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS compute ID group-ID smd/tlsph/strain/rate diff --git a/doc/src/compute_smd_tlsph_stress.rst b/doc/src/compute_smd_tlsph_stress.rst index 4f0473f30a..12539ffda7 100644 --- a/doc/src/compute_smd_tlsph_stress.rst +++ b/doc/src/compute_smd_tlsph_stress.rst @@ -6,7 +6,7 @@ compute smd/tlsph/stress command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS compute ID group-ID smd/tlsph/stress diff --git a/doc/src/compute_smd_triangle_vertices.rst b/doc/src/compute_smd_triangle_vertices.rst index 309c4260e9..2e7dd0cfd0 100644 --- a/doc/src/compute_smd_triangle_vertices.rst +++ b/doc/src/compute_smd_triangle_vertices.rst @@ -6,7 +6,7 @@ compute smd/triangle/vertices command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS compute ID group-ID smd/triangle/vertices diff --git a/doc/src/compute_smd_vol.rst b/doc/src/compute_smd_vol.rst index d31eb53785..94372c23ce 100644 --- a/doc/src/compute_smd_vol.rst +++ b/doc/src/compute_smd_vol.rst @@ -6,7 +6,7 @@ compute smd/vol command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS compute ID group-ID smd/vol diff --git a/doc/src/compute_sna_atom.rst b/doc/src/compute_sna_atom.rst index d604ca9d29..8d06868f3d 100644 --- a/doc/src/compute_sna_atom.rst +++ b/doc/src/compute_sna_atom.rst @@ -26,7 +26,7 @@ compute sna/grid/local command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS compute ID group-ID sna/atom rcutfac rfac0 twojmax R_1 R_2 ... w_1 w_2 ... keyword values ... compute ID group-ID snad/atom rcutfac rfac0 twojmax R_1 R_2 ... w_1 w_2 ... keyword values ... diff --git a/doc/src/compute_sph_e_atom.rst b/doc/src/compute_sph_e_atom.rst index 5e6706fa27..d557eb7920 100644 --- a/doc/src/compute_sph_e_atom.rst +++ b/doc/src/compute_sph_e_atom.rst @@ -6,7 +6,7 @@ compute sph/e/atom command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS compute ID group-ID sph/e/atom diff --git a/doc/src/compute_sph_rho_atom.rst b/doc/src/compute_sph_rho_atom.rst index 7fcec0c9da..6e8579476a 100644 --- a/doc/src/compute_sph_rho_atom.rst +++ b/doc/src/compute_sph_rho_atom.rst @@ -6,7 +6,7 @@ compute sph/rho/atom command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS compute ID group-ID sph/rho/atom diff --git a/doc/src/compute_sph_t_atom.rst b/doc/src/compute_sph_t_atom.rst index 702d81027d..3383c26145 100644 --- a/doc/src/compute_sph_t_atom.rst +++ b/doc/src/compute_sph_t_atom.rst @@ -6,7 +6,7 @@ compute sph/t/atom command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS compute ID group-ID sph/t/atom diff --git a/doc/src/dump_image.rst b/doc/src/dump_image.rst index dd3354faaa..25d1efff7d 100644 --- a/doc/src/dump_image.rst +++ b/doc/src/dump_image.rst @@ -98,7 +98,7 @@ dump_modify options for dump image/movie Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS dump_modify dump-ID keyword values ... diff --git a/doc/src/dump_molfile.rst b/doc/src/dump_molfile.rst index ffc0b443e0..2878bc7b73 100644 --- a/doc/src/dump_molfile.rst +++ b/doc/src/dump_molfile.rst @@ -6,7 +6,7 @@ dump molfile command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS dump ID group-ID molfile N file format path diff --git a/doc/src/dump_netcdf.rst b/doc/src/dump_netcdf.rst index 296b725e20..f7495e29a8 100644 --- a/doc/src/dump_netcdf.rst +++ b/doc/src/dump_netcdf.rst @@ -10,7 +10,7 @@ dump netcdf/mpiio command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS dump ID group-ID netcdf N file args dump ID group-ID netcdf/mpiio N file args diff --git a/doc/src/fitpod_command.rst b/doc/src/fitpod_command.rst index fc21caec70..28afb990ff 100644 --- a/doc/src/fitpod_command.rst +++ b/doc/src/fitpod_command.rst @@ -6,7 +6,7 @@ fitpod command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fitpod Ta_param.pod Ta_data.pod diff --git a/doc/src/fix_alchemy.rst b/doc/src/fix_alchemy.rst index 4f0ad06fd4..14273d65c4 100644 --- a/doc/src/fix_alchemy.rst +++ b/doc/src/fix_alchemy.rst @@ -6,7 +6,7 @@ fix alchemy command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix ID group-ID alchemy v_name diff --git a/doc/src/fix_ave_grid.rst b/doc/src/fix_ave_grid.rst index da0d1f957b..a79a6cf486 100644 --- a/doc/src/fix_ave_grid.rst +++ b/doc/src/fix_ave_grid.rst @@ -6,7 +6,7 @@ fix ave/grid command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix ID group-ID ave/grid Nevery Nrepeat Nfreq Nx Ny Nz value1 value2 ... keyword args ... diff --git a/doc/src/fix_bond_swap.rst b/doc/src/fix_bond_swap.rst index c7535c21b1..6448dd6e1c 100644 --- a/doc/src/fix_bond_swap.rst +++ b/doc/src/fix_bond_swap.rst @@ -6,7 +6,7 @@ fix bond/swap command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix ID group-ID bond/swap Nevery fraction cutoff seed diff --git a/doc/src/fix_box_relax.rst b/doc/src/fix_box_relax.rst index 5efbfcab1b..9f1dade765 100644 --- a/doc/src/fix_box_relax.rst +++ b/doc/src/fix_box_relax.rst @@ -6,7 +6,7 @@ fix box/relax command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix ID group-ID box/relax keyword value ... diff --git a/doc/src/fix_charge_regulation.rst b/doc/src/fix_charge_regulation.rst index 203d40951d..bc2651a55b 100644 --- a/doc/src/fix_charge_regulation.rst +++ b/doc/src/fix_charge_regulation.rst @@ -7,7 +7,7 @@ fix charge/regulation command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix ID group-ID charge/regulation cation_type anion_type keyword value(s) @@ -45,10 +45,10 @@ Syntax Examples """""""" + .. code-block:: LAMMPS fix chareg all charge/regulation 1 2 acid_type 3 base_type 4 pKa 5.0 pKb 6.0 pH 7.0 pIp 3.0 pIm 3.0 nevery 200 nmc 200 seed 123 tempfixid fT - fix chareg all charge/regulation 1 2 pIp 3 pIm 3 onlysalt yes 2 -1 seed 123 tag yes temp 1.0 Description diff --git a/doc/src/fix_cmap.rst b/doc/src/fix_cmap.rst index 19d8cd2d52..316ad5d038 100644 --- a/doc/src/fix_cmap.rst +++ b/doc/src/fix_cmap.rst @@ -6,7 +6,7 @@ fix cmap command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix ID group-ID cmap filename diff --git a/doc/src/fix_colvars.rst b/doc/src/fix_colvars.rst index 77a90cc54f..5acd79ba34 100644 --- a/doc/src/fix_colvars.rst +++ b/doc/src/fix_colvars.rst @@ -6,7 +6,7 @@ fix colvars command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix ID group-ID colvars configfile keyword values ... diff --git a/doc/src/fix_controller.rst b/doc/src/fix_controller.rst index d03d9a123c..fc8186ef29 100644 --- a/doc/src/fix_controller.rst +++ b/doc/src/fix_controller.rst @@ -6,7 +6,7 @@ fix controller command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix ID group-ID controller Nevery alpha Kp Ki Kd pvar setpoint cvar diff --git a/doc/src/fix_damping_cundall.rst b/doc/src/fix_damping_cundall.rst index 262291c0b8..5c532f08d0 100644 --- a/doc/src/fix_damping_cundall.rst +++ b/doc/src/fix_damping_cundall.rst @@ -6,7 +6,7 @@ fix damping/cundall command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix ID group-ID damping/cundall gamma_l gamma_a keyword values ... diff --git a/doc/src/fix_deform.rst b/doc/src/fix_deform.rst index 9adf5b4aa2..ee010f5645 100644 --- a/doc/src/fix_deform.rst +++ b/doc/src/fix_deform.rst @@ -9,7 +9,7 @@ Accelerator Variants: *deform/kk* Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix ID group-ID deform N parameter args ... keyword value ... diff --git a/doc/src/fix_deposit.rst b/doc/src/fix_deposit.rst index c8746bcf9c..7d2d28bfa9 100644 --- a/doc/src/fix_deposit.rst +++ b/doc/src/fix_deposit.rst @@ -6,7 +6,7 @@ fix deposit command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix ID group-ID deposit N type M seed keyword values ... diff --git a/doc/src/fix_dpd_energy.rst b/doc/src/fix_dpd_energy.rst index d6e8dd7230..ef5a5ed073 100644 --- a/doc/src/fix_dpd_energy.rst +++ b/doc/src/fix_dpd_energy.rst @@ -9,7 +9,7 @@ Accelerator Variants: *dpd/energy/kk* Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix ID group-ID dpd/energy diff --git a/doc/src/fix_dpd_source.rst b/doc/src/fix_dpd_source.rst index 71894161f1..8ec5163854 100644 --- a/doc/src/fix_dpd_source.rst +++ b/doc/src/fix_dpd_source.rst @@ -10,7 +10,7 @@ fix tdpd/source command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix ID group-ID edpd/source keyword values ... fix ID group-ID tdpd/source cc_index keyword values ... diff --git a/doc/src/fix_drag.rst b/doc/src/fix_drag.rst index 3bfc5420de..9e29762cf5 100644 --- a/doc/src/fix_drag.rst +++ b/doc/src/fix_drag.rst @@ -6,7 +6,7 @@ fix drag command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix ID group-ID drag x y z fmag delta diff --git a/doc/src/fix_drude.rst b/doc/src/fix_drude.rst index 5300d1f490..679d6eb4bf 100644 --- a/doc/src/fix_drude.rst +++ b/doc/src/fix_drude.rst @@ -6,7 +6,7 @@ fix drude command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix ID group-ID drude flag1 flag2 ... flagN diff --git a/doc/src/fix_drude_transform.rst b/doc/src/fix_drude_transform.rst index bd63a411be..399bf2dd45 100644 --- a/doc/src/fix_drude_transform.rst +++ b/doc/src/fix_drude_transform.rst @@ -10,7 +10,7 @@ fix drude/transform/inverse command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix ID group-ID style keyword value ... diff --git a/doc/src/fix_dt_reset.rst b/doc/src/fix_dt_reset.rst index 5757f0ec99..03b07776e6 100644 --- a/doc/src/fix_dt_reset.rst +++ b/doc/src/fix_dt_reset.rst @@ -9,7 +9,7 @@ Accelerator Variants: *dt/reset/kk* Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix ID group-ID dt/reset N Tmin Tmax Xmax keyword values ... diff --git a/doc/src/fix_efield.rst b/doc/src/fix_efield.rst index e38e1e6894..2958d89794 100644 --- a/doc/src/fix_efield.rst +++ b/doc/src/fix_efield.rst @@ -10,7 +10,7 @@ fix efield/tip4p command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix ID group-ID style ex ey ez keyword value ... diff --git a/doc/src/fix_ehex.rst b/doc/src/fix_ehex.rst index 186ed7065e..d7c09ce36c 100644 --- a/doc/src/fix_ehex.rst +++ b/doc/src/fix_ehex.rst @@ -6,7 +6,7 @@ fix ehex command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix ID group-ID ehex nevery F keyword value diff --git a/doc/src/fix_electron_stopping.rst b/doc/src/fix_electron_stopping.rst index fa0fc763f5..681a000321 100644 --- a/doc/src/fix_electron_stopping.rst +++ b/doc/src/fix_electron_stopping.rst @@ -10,7 +10,7 @@ fix electron/stopping/fit command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix ID group-ID style args diff --git a/doc/src/fix_enforce2d.rst b/doc/src/fix_enforce2d.rst index a8061e5eaa..5dd0b79057 100644 --- a/doc/src/fix_enforce2d.rst +++ b/doc/src/fix_enforce2d.rst @@ -9,7 +9,7 @@ Accelerator Variants: *enforce2d/kk* Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix ID group-ID enforce2d diff --git a/doc/src/fix_eos_cv.rst b/doc/src/fix_eos_cv.rst index c43b5461b1..3f5c87cd38 100644 --- a/doc/src/fix_eos_cv.rst +++ b/doc/src/fix_eos_cv.rst @@ -6,7 +6,7 @@ fix eos/cv command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix ID group-ID eos/cv cv diff --git a/doc/src/fix_eos_table.rst b/doc/src/fix_eos_table.rst index bfb8ec2c3c..533904b0e7 100644 --- a/doc/src/fix_eos_table.rst +++ b/doc/src/fix_eos_table.rst @@ -6,7 +6,7 @@ fix eos/table command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix ID group-ID eos/table style file N keyword diff --git a/doc/src/fix_eos_table_rx.rst b/doc/src/fix_eos_table_rx.rst index c9f134f985..104fa79c20 100644 --- a/doc/src/fix_eos_table_rx.rst +++ b/doc/src/fix_eos_table_rx.rst @@ -9,7 +9,7 @@ Accelerator Variants: *eos/table/rx/kk* Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix ID group-ID eos/table/rx style file1 N keyword ... diff --git a/doc/src/fix_evaporate.rst b/doc/src/fix_evaporate.rst index c8e46631a3..1df58aa5d5 100644 --- a/doc/src/fix_evaporate.rst +++ b/doc/src/fix_evaporate.rst @@ -6,7 +6,7 @@ fix evaporate command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix ID group-ID evaporate N M region-ID seed diff --git a/doc/src/fix_external.rst b/doc/src/fix_external.rst index a3677a350c..44dd0929ee 100644 --- a/doc/src/fix_external.rst +++ b/doc/src/fix_external.rst @@ -6,7 +6,7 @@ fix external command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix ID group-ID external mode args diff --git a/doc/src/fix_ffl.rst b/doc/src/fix_ffl.rst index 6058b0ed3e..04e4d9be90 100644 --- a/doc/src/fix_ffl.rst +++ b/doc/src/fix_ffl.rst @@ -6,7 +6,7 @@ fix ffl command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix ID id-group ffl tau Tstart Tstop seed [flip-type] diff --git a/doc/src/fix_filter_corotate.rst b/doc/src/fix_filter_corotate.rst index c0a2216be3..7c091140df 100644 --- a/doc/src/fix_filter_corotate.rst +++ b/doc/src/fix_filter_corotate.rst @@ -6,7 +6,7 @@ fix filter/corotate command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix ID group-ID filter/corotate keyword value ... diff --git a/doc/src/fix_flow_gauss.rst b/doc/src/fix_flow_gauss.rst index 87ab283923..6100c5d635 100644 --- a/doc/src/fix_flow_gauss.rst +++ b/doc/src/fix_flow_gauss.rst @@ -6,7 +6,7 @@ fix flow/gauss command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix ID group-ID flow/gauss xflag yflag zflag keyword diff --git a/doc/src/fix_freeze.rst b/doc/src/fix_freeze.rst index ce79ce3caf..9b579633b1 100644 --- a/doc/src/fix_freeze.rst +++ b/doc/src/fix_freeze.rst @@ -9,7 +9,7 @@ Accelerator Variants: *freeze/kk* Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix ID group-ID freeze diff --git a/doc/src/fix_gcmc.rst b/doc/src/fix_gcmc.rst index c0fa990d6e..13ae509684 100644 --- a/doc/src/fix_gcmc.rst +++ b/doc/src/fix_gcmc.rst @@ -6,7 +6,7 @@ fix gcmc command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix ID group-ID gcmc N X M type seed T mu displace keyword values ... diff --git a/doc/src/fix_gld.rst b/doc/src/fix_gld.rst index d0fd6a4c9e..ba26f7a51b 100644 --- a/doc/src/fix_gld.rst +++ b/doc/src/fix_gld.rst @@ -6,7 +6,7 @@ fix gld command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix ID group-ID gld Tstart Tstop N_k seed series c_1 tau_1 ... c_N_k tau_N_k keyword values ... diff --git a/doc/src/fix_gle.rst b/doc/src/fix_gle.rst index 03add9d354..d28a9bbf0d 100644 --- a/doc/src/fix_gle.rst +++ b/doc/src/fix_gle.rst @@ -6,7 +6,7 @@ fix gle command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix ID id-group gle Ns Tstart Tstop seed Amatrix [noneq Cmatrix] [every stride] diff --git a/doc/src/fix_gravity.rst b/doc/src/fix_gravity.rst index 6d34cc1bf3..cd7cfcc3df 100644 --- a/doc/src/fix_gravity.rst +++ b/doc/src/fix_gravity.rst @@ -10,7 +10,7 @@ Accelerator Variants: *gravity/omp*, *gravity/kk* Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix ID group gravity magnitude style args diff --git a/doc/src/fix_grem.rst b/doc/src/fix_grem.rst index 3e3ec02994..9cc6e3f43e 100644 --- a/doc/src/fix_grem.rst +++ b/doc/src/fix_grem.rst @@ -6,7 +6,7 @@ fix grem command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix ID group-ID grem lambda eta H0 thermostat-ID diff --git a/doc/src/fix_halt.rst b/doc/src/fix_halt.rst index 56e86208cd..4231c77cc5 100644 --- a/doc/src/fix_halt.rst +++ b/doc/src/fix_halt.rst @@ -6,7 +6,7 @@ fix halt command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix ID group-ID halt N attribute operator avalue keyword value ... diff --git a/doc/src/fix_heat.rst b/doc/src/fix_heat.rst index 19bc3d84ca..1badf08bff 100644 --- a/doc/src/fix_heat.rst +++ b/doc/src/fix_heat.rst @@ -6,7 +6,7 @@ fix heat command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix ID group-ID heat N eflux diff --git a/doc/src/fix_heat_flow.rst b/doc/src/fix_heat_flow.rst index ee73d7d4f2..1ca99a1686 100644 --- a/doc/src/fix_heat_flow.rst +++ b/doc/src/fix_heat_flow.rst @@ -6,7 +6,7 @@ fix heat/flow command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix ID group-ID heat/flow style values ... diff --git a/doc/src/fix_hyper_global.rst b/doc/src/fix_hyper_global.rst index c8643b3b86..2ac1e5e4f3 100644 --- a/doc/src/fix_hyper_global.rst +++ b/doc/src/fix_hyper_global.rst @@ -6,7 +6,7 @@ fix hyper/global command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix ID group-ID hyper/global cutbond qfactor Vmax Tequil diff --git a/doc/src/fix_hyper_local.rst b/doc/src/fix_hyper_local.rst index b5350e9765..76b17cddc4 100644 --- a/doc/src/fix_hyper_local.rst +++ b/doc/src/fix_hyper_local.rst @@ -6,7 +6,7 @@ fix hyper/local command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix ID group-ID hyper/local cutbond qfactor Vmax Tequil Dcut alpha Btarget diff --git a/doc/src/fix_imd.rst b/doc/src/fix_imd.rst index cb1831d174..520af505a1 100644 --- a/doc/src/fix_imd.rst +++ b/doc/src/fix_imd.rst @@ -6,7 +6,7 @@ fix imd command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix ID group-ID imd trate port keyword values ... diff --git a/doc/src/fix_indent.rst b/doc/src/fix_indent.rst index c8349e9381..15790e15d0 100644 --- a/doc/src/fix_indent.rst +++ b/doc/src/fix_indent.rst @@ -6,7 +6,7 @@ fix indent command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix ID group-ID indent K keyword values ... diff --git a/doc/src/fix_ipi.rst b/doc/src/fix_ipi.rst index 5e13d25971..7705f211e8 100644 --- a/doc/src/fix_ipi.rst +++ b/doc/src/fix_ipi.rst @@ -6,7 +6,7 @@ fix ipi command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix ID group-ID ipi address port [unix] [reset] diff --git a/doc/src/fix_langevin.rst b/doc/src/fix_langevin.rst index c09fc7b928..e04805427e 100644 --- a/doc/src/fix_langevin.rst +++ b/doc/src/fix_langevin.rst @@ -9,7 +9,7 @@ Accelerator Variants: *langevin/kk* Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix ID group-ID langevin Tstart Tstop damp seed keyword values ... diff --git a/doc/src/fix_langevin_drude.rst b/doc/src/fix_langevin_drude.rst index 5e62e4f416..c53c29b3ac 100644 --- a/doc/src/fix_langevin_drude.rst +++ b/doc/src/fix_langevin_drude.rst @@ -6,7 +6,7 @@ fix langevin/drude command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix ID group-ID langevin/drude Tcom damp_com seed_com Tdrude damp_drude seed_drude keyword values ... diff --git a/doc/src/fix_langevin_eff.rst b/doc/src/fix_langevin_eff.rst index 506b5052d5..21cdc4a789 100644 --- a/doc/src/fix_langevin_eff.rst +++ b/doc/src/fix_langevin_eff.rst @@ -6,7 +6,7 @@ fix langevin/eff command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix ID group-ID langevin/eff Tstart Tstop damp seed keyword values ... diff --git a/doc/src/fix_langevin_spin.rst b/doc/src/fix_langevin_spin.rst index 0ca291a732..c82751a755 100644 --- a/doc/src/fix_langevin_spin.rst +++ b/doc/src/fix_langevin_spin.rst @@ -6,7 +6,7 @@ fix langevin/spin command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix ID group-ID langevin/spin T Tdamp seed diff --git a/doc/src/fix_lb_fluid.rst b/doc/src/fix_lb_fluid.rst index 04f306156a..a461175f71 100644 --- a/doc/src/fix_lb_fluid.rst +++ b/doc/src/fix_lb_fluid.rst @@ -6,7 +6,7 @@ fix lb/fluid command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix ID group-ID lb/fluid nevery viscosity density keyword values ... diff --git a/doc/src/fix_lb_momentum.rst b/doc/src/fix_lb_momentum.rst index 8b2c5e6ae2..67a8d86d5f 100644 --- a/doc/src/fix_lb_momentum.rst +++ b/doc/src/fix_lb_momentum.rst @@ -6,7 +6,7 @@ fix lb/momentum command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix ID group-ID lb/momentum nevery keyword values ... diff --git a/doc/src/fix_lb_viscous.rst b/doc/src/fix_lb_viscous.rst index 6e0ec21b7e..5557cba57f 100644 --- a/doc/src/fix_lb_viscous.rst +++ b/doc/src/fix_lb_viscous.rst @@ -6,7 +6,7 @@ fix lb/viscous command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix ID group-ID lb/viscous diff --git a/doc/src/fix_lineforce.rst b/doc/src/fix_lineforce.rst index e82f6ed556..9b1d30e832 100644 --- a/doc/src/fix_lineforce.rst +++ b/doc/src/fix_lineforce.rst @@ -6,7 +6,7 @@ fix lineforce command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix ID group-ID lineforce x y z diff --git a/doc/src/fix_manifoldforce.rst b/doc/src/fix_manifoldforce.rst index 2d72743707..cd5fffc881 100644 --- a/doc/src/fix_manifoldforce.rst +++ b/doc/src/fix_manifoldforce.rst @@ -6,7 +6,7 @@ fix manifoldforce command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix ID group-ID manifoldforce manifold manifold-args ... diff --git a/doc/src/fix_mdi_qm.rst b/doc/src/fix_mdi_qm.rst index 3d0b350407..0868cbbac8 100644 --- a/doc/src/fix_mdi_qm.rst +++ b/doc/src/fix_mdi_qm.rst @@ -6,7 +6,7 @@ fix mdi/qm command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix ID group-ID mdi/qm keyword value(s) keyword value(s) ... diff --git a/doc/src/fix_mdi_qmmm.rst b/doc/src/fix_mdi_qmmm.rst index 1afce0f7e4..a39f8ba71d 100644 --- a/doc/src/fix_mdi_qmmm.rst +++ b/doc/src/fix_mdi_qmmm.rst @@ -6,7 +6,7 @@ fix mdi/qmmm command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix ID group-ID mdi/qmmm mode keyword value(s) keyword value(s) ... diff --git a/doc/src/fix_meso_move.rst b/doc/src/fix_meso_move.rst index 7b3609a8c7..55d54b2107 100644 --- a/doc/src/fix_meso_move.rst +++ b/doc/src/fix_meso_move.rst @@ -6,7 +6,7 @@ fix meso/move command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix ID group-ID meso/move style args keyword values ... diff --git a/doc/src/fix_mol_swap.rst b/doc/src/fix_mol_swap.rst index 737536fa0d..b344b9c0e6 100644 --- a/doc/src/fix_mol_swap.rst +++ b/doc/src/fix_mol_swap.rst @@ -6,7 +6,7 @@ fix mol/swap command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix ID group-ID mol/swap N X itype jtype seed T keyword value ... diff --git a/doc/src/fix_momentum.rst b/doc/src/fix_momentum.rst index dff30fffc4..727cb176a1 100644 --- a/doc/src/fix_momentum.rst +++ b/doc/src/fix_momentum.rst @@ -13,7 +13,7 @@ fix momentum/chunk command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix ID group-ID momentum N keyword values ... diff --git a/doc/src/fix_move.rst b/doc/src/fix_move.rst index ff1f8403df..3fde5f0861 100644 --- a/doc/src/fix_move.rst +++ b/doc/src/fix_move.rst @@ -6,7 +6,7 @@ fix move command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix ID group-ID move style args keyword values ... diff --git a/doc/src/fix_mscg.rst b/doc/src/fix_mscg.rst index 3255f3fbe9..91eb0fe772 100644 --- a/doc/src/fix_mscg.rst +++ b/doc/src/fix_mscg.rst @@ -6,7 +6,7 @@ fix mscg command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix ID group-ID mscg N keyword args ... diff --git a/doc/src/fix_msst.rst b/doc/src/fix_msst.rst index 9502fe21b8..6750934f61 100644 --- a/doc/src/fix_msst.rst +++ b/doc/src/fix_msst.rst @@ -6,7 +6,7 @@ fix msst command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix ID group-ID msst dir shockvel keyword value ... diff --git a/doc/src/fix_mvv_dpd.rst b/doc/src/fix_mvv_dpd.rst index c2f8a50391..ff5b169f97 100644 --- a/doc/src/fix_mvv_dpd.rst +++ b/doc/src/fix_mvv_dpd.rst @@ -14,7 +14,7 @@ fix mvv/tdpd command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix ID group-ID mvv/dpd lambda diff --git a/doc/src/fix_neb.rst b/doc/src/fix_neb.rst index 5f22acfb2b..ccd0f9b83d 100644 --- a/doc/src/fix_neb.rst +++ b/doc/src/fix_neb.rst @@ -6,7 +6,7 @@ fix neb command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix ID group-ID neb Kspring keyword value diff --git a/doc/src/fix_neb_spin.rst b/doc/src/fix_neb_spin.rst index 16baba44c0..d04ba367c4 100644 --- a/doc/src/fix_neb_spin.rst +++ b/doc/src/fix_neb_spin.rst @@ -6,7 +6,7 @@ fix neb/spin command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix ID group-ID neb/spin Kspring diff --git a/doc/src/fix_nh.rst b/doc/src/fix_nh.rst index 7f2ec69f9b..0cfbc8f921 100644 --- a/doc/src/fix_nh.rst +++ b/doc/src/fix_nh.rst @@ -30,7 +30,7 @@ Accelerator Variants: *nph/kk*, *nph/omp* Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix ID group-ID style_name keyword value ... diff --git a/doc/src/fix_nh_eff.rst b/doc/src/fix_nh_eff.rst index 11990d365b..7f0f8ee8f1 100644 --- a/doc/src/fix_nh_eff.rst +++ b/doc/src/fix_nh_eff.rst @@ -14,7 +14,7 @@ fix nph/eff command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix ID group-ID style_name keyword value ... diff --git a/doc/src/fix_nh_uef.rst b/doc/src/fix_nh_uef.rst index 922c2d515a..a515375746 100644 --- a/doc/src/fix_nh_uef.rst +++ b/doc/src/fix_nh_uef.rst @@ -10,7 +10,7 @@ fix npt/uef command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix ID group-ID style_name erate edot_x edot_y temp Tstart Tstop Tdamp keyword value ... diff --git a/doc/src/fix_nph_asphere.rst b/doc/src/fix_nph_asphere.rst index a1028efacc..93938fdd58 100644 --- a/doc/src/fix_nph_asphere.rst +++ b/doc/src/fix_nph_asphere.rst @@ -9,7 +9,7 @@ Accelerator Variants: *nph/asphere/omp* Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix ID group-ID nph/asphere args keyword value ... diff --git a/doc/src/fix_nph_body.rst b/doc/src/fix_nph_body.rst index 1b740a5ae2..9ee0bd7669 100644 --- a/doc/src/fix_nph_body.rst +++ b/doc/src/fix_nph_body.rst @@ -6,7 +6,7 @@ fix nph/body command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix ID group-ID nph/body args keyword value ... diff --git a/doc/src/fix_nph_sphere.rst b/doc/src/fix_nph_sphere.rst index 2ef85953e5..9d47cedc28 100644 --- a/doc/src/fix_nph_sphere.rst +++ b/doc/src/fix_nph_sphere.rst @@ -9,7 +9,7 @@ Accelerator Variants: *nph/sphere/omp* Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix ID group-ID nph/sphere args keyword value ... diff --git a/doc/src/fix_nphug.rst b/doc/src/fix_nphug.rst index 1cedfa909a..ce63f5eddd 100644 --- a/doc/src/fix_nphug.rst +++ b/doc/src/fix_nphug.rst @@ -9,7 +9,7 @@ Accelerator Variants: *nphug/omp* Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix ID group-ID nphug keyword value ... diff --git a/doc/src/fix_npt_asphere.rst b/doc/src/fix_npt_asphere.rst index 64e1c45be7..0d195821ad 100644 --- a/doc/src/fix_npt_asphere.rst +++ b/doc/src/fix_npt_asphere.rst @@ -9,7 +9,7 @@ Accelerator Variants: *npt/asphere/omp* Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix ID group-ID npt/asphere keyword value ... diff --git a/doc/src/fix_npt_body.rst b/doc/src/fix_npt_body.rst index ff98638b63..31ef1653b8 100644 --- a/doc/src/fix_npt_body.rst +++ b/doc/src/fix_npt_body.rst @@ -6,7 +6,7 @@ fix npt/body command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix ID group-ID npt/body keyword value ... diff --git a/doc/src/fix_npt_cauchy.rst b/doc/src/fix_npt_cauchy.rst index 36b22037bf..6764f88eee 100644 --- a/doc/src/fix_npt_cauchy.rst +++ b/doc/src/fix_npt_cauchy.rst @@ -6,7 +6,7 @@ fix npt/cauchy command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix ID group-ID style_name keyword value ... diff --git a/doc/src/fix_npt_sphere.rst b/doc/src/fix_npt_sphere.rst index afaa2c9d67..f881bc2dfe 100644 --- a/doc/src/fix_npt_sphere.rst +++ b/doc/src/fix_npt_sphere.rst @@ -9,7 +9,7 @@ Accelerator Variants: *npt/sphere/omp* Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix ID group-ID npt/sphere keyword value ... diff --git a/doc/src/fix_numdiff.rst b/doc/src/fix_numdiff.rst index b5fdfb12e6..9b3d3bf7da 100644 --- a/doc/src/fix_numdiff.rst +++ b/doc/src/fix_numdiff.rst @@ -6,7 +6,7 @@ fix numdiff command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix ID group-ID numdiff Nevery delta diff --git a/doc/src/fix_numdiff_virial.rst b/doc/src/fix_numdiff_virial.rst index f909d41111..2075d1d05f 100644 --- a/doc/src/fix_numdiff_virial.rst +++ b/doc/src/fix_numdiff_virial.rst @@ -6,7 +6,7 @@ fix numdiff/virial command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix ID group-ID numdiff/virial Nevery delta diff --git a/doc/src/fix_nve.rst b/doc/src/fix_nve.rst index c50bc4d62f..3757233bcc 100644 --- a/doc/src/fix_nve.rst +++ b/doc/src/fix_nve.rst @@ -12,7 +12,7 @@ Accelerator Variants: *nve/gpu*, *nve/intel*, *nve/kk*, *nve/omp* Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix ID group-ID nve diff --git a/doc/src/fix_nve_asphere.rst b/doc/src/fix_nve_asphere.rst index fbba2bc8dd..cf956bd0c4 100644 --- a/doc/src/fix_nve_asphere.rst +++ b/doc/src/fix_nve_asphere.rst @@ -10,7 +10,7 @@ Accelerator Variants: *nve/asphere/gpu*, *nve/asphere/intel* Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix ID group-ID nve/asphere diff --git a/doc/src/fix_nve_asphere_noforce.rst b/doc/src/fix_nve_asphere_noforce.rst index 7d904bef1c..9e6f35b56b 100644 --- a/doc/src/fix_nve_asphere_noforce.rst +++ b/doc/src/fix_nve_asphere_noforce.rst @@ -6,7 +6,7 @@ fix nve/asphere/noforce command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix ID group-ID nve/asphere/noforce diff --git a/doc/src/fix_nve_awpmd.rst b/doc/src/fix_nve_awpmd.rst index c716a94a84..f835758e00 100644 --- a/doc/src/fix_nve_awpmd.rst +++ b/doc/src/fix_nve_awpmd.rst @@ -6,7 +6,7 @@ fix nve/awpmd command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix ID group-ID nve/awpmd diff --git a/doc/src/fix_nve_body.rst b/doc/src/fix_nve_body.rst index 45beee0659..9f562ef59e 100644 --- a/doc/src/fix_nve_body.rst +++ b/doc/src/fix_nve_body.rst @@ -6,7 +6,7 @@ fix nve/body command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix ID group-ID nve/body diff --git a/doc/src/fix_nve_bpm_sphere.rst b/doc/src/fix_nve_bpm_sphere.rst index ef170605a4..fb3bd9e466 100644 --- a/doc/src/fix_nve_bpm_sphere.rst +++ b/doc/src/fix_nve_bpm_sphere.rst @@ -6,7 +6,7 @@ fix nve/bpm/sphere command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix ID group-ID nve/bpm/sphere diff --git a/doc/src/fix_nve_dot.rst b/doc/src/fix_nve_dot.rst index 0a99e11452..0d6e0ab5c3 100644 --- a/doc/src/fix_nve_dot.rst +++ b/doc/src/fix_nve_dot.rst @@ -6,7 +6,7 @@ fix nve/dot command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix ID group-ID nve/dot diff --git a/doc/src/fix_nve_dotc_langevin.rst b/doc/src/fix_nve_dotc_langevin.rst index e47e8f4a2a..51efa06a02 100644 --- a/doc/src/fix_nve_dotc_langevin.rst +++ b/doc/src/fix_nve_dotc_langevin.rst @@ -6,7 +6,7 @@ fix nve/dotc/langevin command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix ID group-ID nve/dotc/langevin Tstart Tstop damp seed keyword value diff --git a/doc/src/fix_nve_eff.rst b/doc/src/fix_nve_eff.rst index 60bece43d0..1cf954a88d 100644 --- a/doc/src/fix_nve_eff.rst +++ b/doc/src/fix_nve_eff.rst @@ -6,7 +6,7 @@ fix nve/eff command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix ID group-ID nve/eff diff --git a/doc/src/fix_nve_limit.rst b/doc/src/fix_nve_limit.rst index 0c572c6c6a..b00a5d64ca 100644 --- a/doc/src/fix_nve_limit.rst +++ b/doc/src/fix_nve_limit.rst @@ -6,7 +6,7 @@ fix nve/limit command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix ID group-ID nve/limit xmax diff --git a/doc/src/fix_nve_line.rst b/doc/src/fix_nve_line.rst index 5bb6fd4213..7574110041 100644 --- a/doc/src/fix_nve_line.rst +++ b/doc/src/fix_nve_line.rst @@ -6,7 +6,7 @@ fix nve/line command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix ID group-ID nve/line diff --git a/doc/src/fix_nve_manifold_rattle.rst b/doc/src/fix_nve_manifold_rattle.rst index 63632ebac0..6adf72ac55 100644 --- a/doc/src/fix_nve_manifold_rattle.rst +++ b/doc/src/fix_nve_manifold_rattle.rst @@ -6,7 +6,7 @@ fix nve/manifold/rattle command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix ID group-ID nve/manifold/rattle tol maxit manifold manifold-args keyword value ... diff --git a/doc/src/fix_nve_noforce.rst b/doc/src/fix_nve_noforce.rst index ed13123403..9b9c30d325 100644 --- a/doc/src/fix_nve_noforce.rst +++ b/doc/src/fix_nve_noforce.rst @@ -6,7 +6,7 @@ fix nve/noforce command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix ID group-ID nve diff --git a/doc/src/fix_nve_sphere.rst b/doc/src/fix_nve_sphere.rst index df177a2eca..9340e4af22 100644 --- a/doc/src/fix_nve_sphere.rst +++ b/doc/src/fix_nve_sphere.rst @@ -10,7 +10,7 @@ Accelerator Variants: *nve/sphere/omp*, *nve/sphere/kk* Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix ID group-ID nve/sphere diff --git a/doc/src/fix_nve_spin.rst b/doc/src/fix_nve_spin.rst index e35647aef4..6edc9da09a 100644 --- a/doc/src/fix_nve_spin.rst +++ b/doc/src/fix_nve_spin.rst @@ -6,7 +6,7 @@ fix nve/spin command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix ID group-ID nve/spin keyword values diff --git a/doc/src/fix_nve_tri.rst b/doc/src/fix_nve_tri.rst index b511d9b318..1bcecb71db 100644 --- a/doc/src/fix_nve_tri.rst +++ b/doc/src/fix_nve_tri.rst @@ -6,7 +6,7 @@ fix nve/tri command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix ID group-ID nve/tri diff --git a/doc/src/fix_nvk.rst b/doc/src/fix_nvk.rst index 0d83a4b1be..d74ec1639c 100644 --- a/doc/src/fix_nvk.rst +++ b/doc/src/fix_nvk.rst @@ -6,7 +6,7 @@ fix nvk command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix ID group-ID nvk diff --git a/doc/src/fix_nvt_asphere.rst b/doc/src/fix_nvt_asphere.rst index 7ce3aec125..b456516e3c 100644 --- a/doc/src/fix_nvt_asphere.rst +++ b/doc/src/fix_nvt_asphere.rst @@ -9,7 +9,7 @@ Accelerator Variants: *nvt/asphere/omp* Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix ID group-ID nvt/asphere keyword value ... diff --git a/doc/src/fix_nvt_body.rst b/doc/src/fix_nvt_body.rst index 7b9e996a5b..4397159515 100644 --- a/doc/src/fix_nvt_body.rst +++ b/doc/src/fix_nvt_body.rst @@ -6,7 +6,7 @@ fix nvt/body command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix ID group-ID nvt/body keyword value ... diff --git a/doc/src/fix_nvt_manifold_rattle.rst b/doc/src/fix_nvt_manifold_rattle.rst index 91a5f28649..921022d743 100644 --- a/doc/src/fix_nvt_manifold_rattle.rst +++ b/doc/src/fix_nvt_manifold_rattle.rst @@ -6,7 +6,7 @@ fix nvt/manifold/rattle command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix ID group-ID nvt/manifold/rattle tol maxit manifold manifold-args keyword value ... diff --git a/doc/src/fix_nvt_sllod.rst b/doc/src/fix_nvt_sllod.rst index 48d0bb5946..430ed31c14 100644 --- a/doc/src/fix_nvt_sllod.rst +++ b/doc/src/fix_nvt_sllod.rst @@ -11,7 +11,7 @@ Accelerator Variants: *nvt/sllod/intel*, *nvt/sllod/omp*, *nvt/sllod/kk* Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix ID group-ID nvt/sllod keyword value ... diff --git a/doc/src/fix_nvt_sllod_eff.rst b/doc/src/fix_nvt_sllod_eff.rst index dd4dd469ef..71a7e75b80 100644 --- a/doc/src/fix_nvt_sllod_eff.rst +++ b/doc/src/fix_nvt_sllod_eff.rst @@ -6,7 +6,7 @@ fix nvt/sllod/eff command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix ID group-ID nvt/sllod/eff keyword value ... diff --git a/doc/src/fix_nvt_sphere.rst b/doc/src/fix_nvt_sphere.rst index f107940af9..6baa79532c 100644 --- a/doc/src/fix_nvt_sphere.rst +++ b/doc/src/fix_nvt_sphere.rst @@ -9,7 +9,7 @@ Accelerator Variants: *nvt/sphere/omp* Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix ID group-ID nvt/sphere keyword value ... diff --git a/doc/src/fix_oneway.rst b/doc/src/fix_oneway.rst index 272797fa17..b4a55e9968 100644 --- a/doc/src/fix_oneway.rst +++ b/doc/src/fix_oneway.rst @@ -6,7 +6,7 @@ fix oneway command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix ID group-ID oneway N region-ID direction diff --git a/doc/src/fix_orient.rst b/doc/src/fix_orient.rst index 68522209b7..7e30b7bb01 100644 --- a/doc/src/fix_orient.rst +++ b/doc/src/fix_orient.rst @@ -10,7 +10,7 @@ fix orient/bcc command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix ID group-ID orient/fcc nstats dir alat dE cutlo cuthi file0 file1 fix ID group-ID orient/bcc nstats dir alat dE cutlo cuthi file0 file1 diff --git a/doc/src/fix_pafi.rst b/doc/src/fix_pafi.rst index c8830316a2..a57fc658fc 100644 --- a/doc/src/fix_pafi.rst +++ b/doc/src/fix_pafi.rst @@ -6,7 +6,7 @@ fix pafi command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix ID group-ID pafi compute-ID Temp Tdamp seed keyword values... diff --git a/doc/src/fix_pair.rst b/doc/src/fix_pair.rst index 07e934d1c0..ec4a5bcb3f 100644 --- a/doc/src/fix_pair.rst +++ b/doc/src/fix_pair.rst @@ -6,7 +6,7 @@ fix pair command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix ID group-ID pair N pstyle name flag ... diff --git a/doc/src/fix_phonon.rst b/doc/src/fix_phonon.rst index 527498bb21..e99d2b6891 100644 --- a/doc/src/fix_phonon.rst +++ b/doc/src/fix_phonon.rst @@ -6,7 +6,7 @@ fix phonon command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix ID group-ID phonon N Noutput Nwait map_file prefix keyword values ... diff --git a/doc/src/fix_pimd.rst b/doc/src/fix_pimd.rst index c08a4005f5..5b51b97c52 100644 --- a/doc/src/fix_pimd.rst +++ b/doc/src/fix_pimd.rst @@ -10,7 +10,7 @@ fix pimd/nvt command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix ID group-ID style keyword value ... diff --git a/doc/src/fix_planeforce.rst b/doc/src/fix_planeforce.rst index d0f1b8102e..f4032cf829 100644 --- a/doc/src/fix_planeforce.rst +++ b/doc/src/fix_planeforce.rst @@ -6,7 +6,7 @@ fix planeforce command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix ID group-ID planeforce x y z diff --git a/doc/src/fix_plumed.rst b/doc/src/fix_plumed.rst index c562ecc81d..ca56f83958 100644 --- a/doc/src/fix_plumed.rst +++ b/doc/src/fix_plumed.rst @@ -6,7 +6,7 @@ fix plumed command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix ID group-ID plumed keyword value ... diff --git a/doc/src/fix_poems.rst b/doc/src/fix_poems.rst index 7ecb4eef7d..a43e552fbb 100644 --- a/doc/src/fix_poems.rst +++ b/doc/src/fix_poems.rst @@ -6,7 +6,7 @@ fix poems command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix ID group-ID poems keyword values diff --git a/doc/src/fix_polarize.rst b/doc/src/fix_polarize.rst index f35e34bc67..93ef1e4276 100644 --- a/doc/src/fix_polarize.rst +++ b/doc/src/fix_polarize.rst @@ -14,7 +14,7 @@ fix polarize/functional command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix ID group-ID style nevery tolerance diff --git a/doc/src/fix_pour.rst b/doc/src/fix_pour.rst index 8a7000662e..eca1f70c41 100644 --- a/doc/src/fix_pour.rst +++ b/doc/src/fix_pour.rst @@ -6,7 +6,7 @@ fix pour command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix ID group-ID pour N type seed keyword values ... diff --git a/doc/src/fix_press_berendsen.rst b/doc/src/fix_press_berendsen.rst index dee93c5b8b..09ec44e673 100644 --- a/doc/src/fix_press_berendsen.rst +++ b/doc/src/fix_press_berendsen.rst @@ -6,7 +6,7 @@ fix press/berendsen command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix ID group-ID press/berendsen keyword value ... diff --git a/doc/src/fix_print.rst b/doc/src/fix_print.rst index 05abbe3c98..1ec643a635 100644 --- a/doc/src/fix_print.rst +++ b/doc/src/fix_print.rst @@ -6,7 +6,7 @@ fix print command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix ID group-ID print N string keyword value ... diff --git a/doc/src/fix_propel_self.rst b/doc/src/fix_propel_self.rst index 863d43b6f2..0b932c7316 100644 --- a/doc/src/fix_propel_self.rst +++ b/doc/src/fix_propel_self.rst @@ -6,7 +6,7 @@ fix propel/self command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix ID group-ID propel/self mode magnitude keyword values diff --git a/doc/src/fix_property_atom.rst b/doc/src/fix_property_atom.rst index d09c15d192..b177fe9a96 100644 --- a/doc/src/fix_property_atom.rst +++ b/doc/src/fix_property_atom.rst @@ -9,7 +9,7 @@ Accelerator Variants: *property/atom/kk* Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix ID group-ID property/atom name1 name2 ... keyword value ... diff --git a/doc/src/fix_python_invoke.rst b/doc/src/fix_python_invoke.rst index c82fb91a27..ad55882270 100644 --- a/doc/src/fix_python_invoke.rst +++ b/doc/src/fix_python_invoke.rst @@ -6,7 +6,7 @@ fix python/invoke command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix ID group-ID python/invoke N callback function_name diff --git a/doc/src/fix_python_move.rst b/doc/src/fix_python_move.rst index b338dcbfac..63898f3aa1 100644 --- a/doc/src/fix_python_move.rst +++ b/doc/src/fix_python_move.rst @@ -6,7 +6,7 @@ fix python/move command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix python/move pymodule.CLASS diff --git a/doc/src/fix_qbmsst.rst b/doc/src/fix_qbmsst.rst index 5428eeb637..3234335b6b 100644 --- a/doc/src/fix_qbmsst.rst +++ b/doc/src/fix_qbmsst.rst @@ -6,7 +6,7 @@ fix qbmsst command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix ID group-ID qbmsst dir shockvel keyword value ... diff --git a/doc/src/fix_qeq.rst b/doc/src/fix_qeq.rst index 73cf013fb9..bace7af0ca 100644 --- a/doc/src/fix_qeq.rst +++ b/doc/src/fix_qeq.rst @@ -22,7 +22,7 @@ fix qeq/fire command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix ID group-ID style Nevery cutoff tolerance maxiter qfile keyword ... diff --git a/doc/src/fix_qeq_comb.rst b/doc/src/fix_qeq_comb.rst index 0c04a8c4a7..f93a650c17 100644 --- a/doc/src/fix_qeq_comb.rst +++ b/doc/src/fix_qeq_comb.rst @@ -9,7 +9,7 @@ Accelerator Variants: *qeq/comb/omp* Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix ID group-ID qeq/comb Nevery precision keyword value ... diff --git a/doc/src/fix_qeq_reaxff.rst b/doc/src/fix_qeq_reaxff.rst index 00cfb6d3ce..e90842ea6a 100644 --- a/doc/src/fix_qeq_reaxff.rst +++ b/doc/src/fix_qeq_reaxff.rst @@ -10,7 +10,7 @@ Accelerator Variants: *qeq/reaxff/kk*, *qeq/reaxff/omp* Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix ID group-ID qeq/reaxff Nevery cutlo cuthi tolerance params args diff --git a/doc/src/fix_qmmm.rst b/doc/src/fix_qmmm.rst index 546635520c..eabbdbba03 100644 --- a/doc/src/fix_qmmm.rst +++ b/doc/src/fix_qmmm.rst @@ -6,7 +6,7 @@ fix qmmm command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix ID group-ID qmmm diff --git a/doc/src/fix_qtb.rst b/doc/src/fix_qtb.rst index c41a58a8f4..2112a0f14b 100644 --- a/doc/src/fix_qtb.rst +++ b/doc/src/fix_qtb.rst @@ -6,7 +6,7 @@ fix qtb command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix ID group-ID qtb keyword value ... diff --git a/doc/src/fix_reaxff_bonds.rst b/doc/src/fix_reaxff_bonds.rst index 15b2eb6da9..15fd9abafa 100644 --- a/doc/src/fix_reaxff_bonds.rst +++ b/doc/src/fix_reaxff_bonds.rst @@ -9,7 +9,7 @@ Accelerator Variants: *reaxff/bonds/kk* Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix ID group-ID reaxff/bonds Nevery filename diff --git a/doc/src/fix_reaxff_species.rst b/doc/src/fix_reaxff_species.rst index 6a171ede5e..9bf1a82933 100644 --- a/doc/src/fix_reaxff_species.rst +++ b/doc/src/fix_reaxff_species.rst @@ -9,7 +9,7 @@ Accelerator Variants: *reaxff/species/kk* Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix ID group-ID reaxff/species Nevery Nrepeat Nfreq filename keyword value ... diff --git a/doc/src/fix_recenter.rst b/doc/src/fix_recenter.rst index 520564677a..9991904b37 100644 --- a/doc/src/fix_recenter.rst +++ b/doc/src/fix_recenter.rst @@ -6,7 +6,7 @@ fix recenter command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix ID group-ID recenter x y z keyword value ... diff --git a/doc/src/fix_rhok.rst b/doc/src/fix_rhok.rst index 9d6114328f..7ac40e1bed 100644 --- a/doc/src/fix_rhok.rst +++ b/doc/src/fix_rhok.rst @@ -6,7 +6,7 @@ fix rhok command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix ID group-ID rhok nx ny nz K a diff --git a/doc/src/fix_rigid.rst b/doc/src/fix_rigid.rst index b6c2c99071..89759da817 100644 --- a/doc/src/fix_rigid.rst +++ b/doc/src/fix_rigid.rst @@ -60,7 +60,7 @@ fix rigid/nph/small command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix ID group-ID style bodystyle args keyword values ... diff --git a/doc/src/fix_rigid_meso.rst b/doc/src/fix_rigid_meso.rst index 1c70092092..c8c994fd26 100644 --- a/doc/src/fix_rigid_meso.rst +++ b/doc/src/fix_rigid_meso.rst @@ -6,7 +6,7 @@ fix rigid/meso command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix ID group-ID rigid/meso bodystyle args keyword values ... diff --git a/doc/src/fix_rx.rst b/doc/src/fix_rx.rst index 4028a4e7e1..631b227449 100644 --- a/doc/src/fix_rx.rst +++ b/doc/src/fix_rx.rst @@ -9,7 +9,7 @@ Accelerator Variants: *rx/kk* Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix ID group-ID rx file localTemp matrix solver minSteps ... diff --git a/doc/src/fix_saed_vtk.rst b/doc/src/fix_saed_vtk.rst index cd3cad7c72..e0cf251780 100644 --- a/doc/src/fix_saed_vtk.rst +++ b/doc/src/fix_saed_vtk.rst @@ -6,7 +6,7 @@ fix saed/vtk command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix ID group-ID saed/vtk Nevery Nrepeat Nfreak c_ID attribute args ... keyword args ... diff --git a/doc/src/fix_setforce.rst b/doc/src/fix_setforce.rst index e115c52991..e194ad4c11 100644 --- a/doc/src/fix_setforce.rst +++ b/doc/src/fix_setforce.rst @@ -13,7 +13,7 @@ fix setforce/spin command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix ID group-ID setforce fx fy fz keyword value ... diff --git a/doc/src/fix_sgcmc.rst b/doc/src/fix_sgcmc.rst index fd6f8beab4..63cfaf22da 100644 --- a/doc/src/fix_sgcmc.rst +++ b/doc/src/fix_sgcmc.rst @@ -6,7 +6,7 @@ fix sgcmc command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix ID group-ID sgcmc every_nsteps swap_fraction temperature deltamu ... diff --git a/doc/src/fix_shake.rst b/doc/src/fix_shake.rst index 2483b9431a..73caa9c668 100644 --- a/doc/src/fix_shake.rst +++ b/doc/src/fix_shake.rst @@ -13,7 +13,7 @@ fix rattle command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix ID group-ID style tol iter N constraint values ... keyword value ... diff --git a/doc/src/fix_shardlow.rst b/doc/src/fix_shardlow.rst index 468985be1b..bc2684af53 100644 --- a/doc/src/fix_shardlow.rst +++ b/doc/src/fix_shardlow.rst @@ -9,7 +9,7 @@ Accelerator Variants: *shardlow/kk* Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix ID group-ID shardlow diff --git a/doc/src/fix_smd.rst b/doc/src/fix_smd.rst index 4c682e66c0..14892227fd 100644 --- a/doc/src/fix_smd.rst +++ b/doc/src/fix_smd.rst @@ -6,7 +6,7 @@ fix smd command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix ID group-ID smd type values keyword values diff --git a/doc/src/fix_smd_setvel.rst b/doc/src/fix_smd_setvel.rst index 9dcc3c636c..31b92491ab 100644 --- a/doc/src/fix_smd_setvel.rst +++ b/doc/src/fix_smd_setvel.rst @@ -6,7 +6,7 @@ fix smd/setvel command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix ID group-ID smd/setvel vx vy vz keyword value ... diff --git a/doc/src/fix_sph.rst b/doc/src/fix_sph.rst index 1133142f05..4932485b03 100644 --- a/doc/src/fix_sph.rst +++ b/doc/src/fix_sph.rst @@ -6,7 +6,7 @@ fix sph command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix ID group-ID sph diff --git a/doc/src/fix_sph_stationary.rst b/doc/src/fix_sph_stationary.rst index 4496a10eca..07bedad4c3 100644 --- a/doc/src/fix_sph_stationary.rst +++ b/doc/src/fix_sph_stationary.rst @@ -6,7 +6,7 @@ fix sph/stationary command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix ID group-ID sph/stationary diff --git a/doc/src/fix_spring.rst b/doc/src/fix_spring.rst index 007f2cd278..b85fe26813 100644 --- a/doc/src/fix_spring.rst +++ b/doc/src/fix_spring.rst @@ -6,7 +6,7 @@ fix spring command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix ID group-ID spring keyword values diff --git a/doc/src/fix_spring_chunk.rst b/doc/src/fix_spring_chunk.rst index 3d3069c53e..63a225e878 100644 --- a/doc/src/fix_spring_chunk.rst +++ b/doc/src/fix_spring_chunk.rst @@ -6,7 +6,7 @@ fix spring/chunk command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix ID group-ID spring/chunk K chunkID comID diff --git a/doc/src/fix_spring_rg.rst b/doc/src/fix_spring_rg.rst index aba35c8134..e615771d2a 100644 --- a/doc/src/fix_spring_rg.rst +++ b/doc/src/fix_spring_rg.rst @@ -6,7 +6,7 @@ fix spring/rg command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix ID group-ID spring/rg K RG0 diff --git a/doc/src/fix_spring_self.rst b/doc/src/fix_spring_self.rst index 6cf0a9e0e7..3383f27ebb 100644 --- a/doc/src/fix_spring_self.rst +++ b/doc/src/fix_spring_self.rst @@ -6,7 +6,7 @@ fix spring/self command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix ID group-ID spring/self K dir diff --git a/doc/src/fix_srd.rst b/doc/src/fix_srd.rst index 04eaeed251..1fc574a7ad 100644 --- a/doc/src/fix_srd.rst +++ b/doc/src/fix_srd.rst @@ -6,7 +6,7 @@ fix srd command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix ID group-ID srd N groupbig-ID Tsrd hgrid seed keyword value ... diff --git a/doc/src/fix_store_force.rst b/doc/src/fix_store_force.rst index f6bed4d4af..487d4f0352 100644 --- a/doc/src/fix_store_force.rst +++ b/doc/src/fix_store_force.rst @@ -6,7 +6,7 @@ fix store/force command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix ID group-ID store/force diff --git a/doc/src/fix_store_state.rst b/doc/src/fix_store_state.rst index b47b6900aa..4a0bef2f74 100644 --- a/doc/src/fix_store_state.rst +++ b/doc/src/fix_store_state.rst @@ -6,7 +6,7 @@ fix store/state command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix ID group-ID store/state N input1 input2 ... keyword value ... diff --git a/doc/src/fix_temp_berendsen.rst b/doc/src/fix_temp_berendsen.rst index 473c30aced..67e496e6c5 100644 --- a/doc/src/fix_temp_berendsen.rst +++ b/doc/src/fix_temp_berendsen.rst @@ -6,7 +6,7 @@ fix temp/berendsen command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix ID group-ID temp/berendsen Tstart Tstop Tdamp diff --git a/doc/src/fix_temp_csvr.rst b/doc/src/fix_temp_csvr.rst index 5fc6e8eae7..781ce97d96 100644 --- a/doc/src/fix_temp_csvr.rst +++ b/doc/src/fix_temp_csvr.rst @@ -10,7 +10,7 @@ fix temp/csld command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix ID group-ID temp/csvr Tstart Tstop Tdamp seed fix ID group-ID temp/csld Tstart Tstop Tdamp seed diff --git a/doc/src/fix_temp_rescale.rst b/doc/src/fix_temp_rescale.rst index 41ad8709cc..bfdcaa90f8 100644 --- a/doc/src/fix_temp_rescale.rst +++ b/doc/src/fix_temp_rescale.rst @@ -6,7 +6,7 @@ fix temp/rescale command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix ID group-ID temp/rescale N Tstart Tstop window fraction diff --git a/doc/src/fix_temp_rescale_eff.rst b/doc/src/fix_temp_rescale_eff.rst index ea3996e9b6..b92feccfed 100644 --- a/doc/src/fix_temp_rescale_eff.rst +++ b/doc/src/fix_temp_rescale_eff.rst @@ -6,7 +6,7 @@ fix temp/rescale/eff command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix ID group-ID temp/rescale/eff N Tstart Tstop window fraction diff --git a/doc/src/fix_tfmc.rst b/doc/src/fix_tfmc.rst index 7eb4d24935..f3379c1e2f 100644 --- a/doc/src/fix_tfmc.rst +++ b/doc/src/fix_tfmc.rst @@ -6,7 +6,7 @@ fix tfmc command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix ID group-ID tfmc Delta Temp seed keyword value diff --git a/doc/src/fix_tgnh_drude.rst b/doc/src/fix_tgnh_drude.rst index d1f5cf19a4..0a67af291f 100644 --- a/doc/src/fix_tgnh_drude.rst +++ b/doc/src/fix_tgnh_drude.rst @@ -11,7 +11,7 @@ fix tgnpt/drude command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix ID group-ID style_name keyword values ... diff --git a/doc/src/fix_thermal_conductivity.rst b/doc/src/fix_thermal_conductivity.rst index 0652810267..041fde8be5 100644 --- a/doc/src/fix_thermal_conductivity.rst +++ b/doc/src/fix_thermal_conductivity.rst @@ -6,7 +6,7 @@ fix thermal/conductivity command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix ID group-ID thermal/conductivity N edim Nbin keyword value ... diff --git a/doc/src/fix_ti_spring.rst b/doc/src/fix_ti_spring.rst index d519f36157..6273164d52 100644 --- a/doc/src/fix_ti_spring.rst +++ b/doc/src/fix_ti_spring.rst @@ -6,7 +6,7 @@ fix ti/spring command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix ID group-ID ti/spring k t_s t_eq keyword value ... diff --git a/doc/src/fix_tmd.rst b/doc/src/fix_tmd.rst index ccebb35823..3ee7f2a5c8 100644 --- a/doc/src/fix_tmd.rst +++ b/doc/src/fix_tmd.rst @@ -6,7 +6,7 @@ fix tmd command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix ID group-ID tmd rho_final file1 N file2 diff --git a/doc/src/fix_ttm.rst b/doc/src/fix_ttm.rst index 413c5f5c3c..ccf7f16554 100644 --- a/doc/src/fix_ttm.rst +++ b/doc/src/fix_ttm.rst @@ -14,7 +14,7 @@ fix ttm/mod command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix ID group-ID ttm seed C_e rho_e kappa_e gamma_p gamma_s v_0 Nx Ny Nz keyword value ... fix ID group-ID ttm/mod seed init_file Nx Ny Nz keyword value ... diff --git a/doc/src/fix_tune_kspace.rst b/doc/src/fix_tune_kspace.rst index 6a3cba16e4..17e0710be8 100644 --- a/doc/src/fix_tune_kspace.rst +++ b/doc/src/fix_tune_kspace.rst @@ -6,7 +6,7 @@ fix tune/kspace command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix ID group-ID tune/kspace N diff --git a/doc/src/fix_vector.rst b/doc/src/fix_vector.rst index f4eee41269..95ec350e12 100644 --- a/doc/src/fix_vector.rst +++ b/doc/src/fix_vector.rst @@ -6,7 +6,7 @@ fix vector command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix ID group-ID vector Nevery value1 value2 ... diff --git a/doc/src/fix_viscosity.rst b/doc/src/fix_viscosity.rst index c99196e09b..187d723d68 100644 --- a/doc/src/fix_viscosity.rst +++ b/doc/src/fix_viscosity.rst @@ -6,7 +6,7 @@ fix viscosity command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix ID group-ID viscosity N vdim pdim Nbin keyword value ... diff --git a/doc/src/fix_viscous.rst b/doc/src/fix_viscous.rst index d5fd794020..68d2568529 100644 --- a/doc/src/fix_viscous.rst +++ b/doc/src/fix_viscous.rst @@ -9,7 +9,7 @@ Accelerator Variants: *viscous/kk* Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix ID group-ID viscous gamma keyword values ... diff --git a/doc/src/fix_viscous_sphere.rst b/doc/src/fix_viscous_sphere.rst index 13463c8c11..678cb9904f 100644 --- a/doc/src/fix_viscous_sphere.rst +++ b/doc/src/fix_viscous_sphere.rst @@ -6,7 +6,7 @@ fix viscous/sphere command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix ID group-ID viscous/sphere gamma keyword values ... diff --git a/doc/src/fix_wall.rst b/doc/src/fix_wall.rst index 42cd94978d..eb8219e157 100644 --- a/doc/src/fix_wall.rst +++ b/doc/src/fix_wall.rst @@ -37,7 +37,7 @@ fix wall/table command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix ID group-ID style [tabstyle] [N] face args ... keyword value ... diff --git a/doc/src/fix_wall_body_polygon.rst b/doc/src/fix_wall_body_polygon.rst index ac0a58f55c..504ded6aaf 100644 --- a/doc/src/fix_wall_body_polygon.rst +++ b/doc/src/fix_wall_body_polygon.rst @@ -6,7 +6,7 @@ fix wall/body/polygon command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix ID group-ID wall/body/polygon k_n c_n c_t wallstyle args keyword values ... diff --git a/doc/src/fix_wall_body_polyhedron.rst b/doc/src/fix_wall_body_polyhedron.rst index 9930c10f74..86bd35ae02 100644 --- a/doc/src/fix_wall_body_polyhedron.rst +++ b/doc/src/fix_wall_body_polyhedron.rst @@ -6,7 +6,7 @@ fix wall/body/polyhedron command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix ID group-ID wall/body/polyhedron k_n c_n c_t wallstyle args keyword values ... diff --git a/doc/src/fix_wall_ees.rst b/doc/src/fix_wall_ees.rst index 9c7f82e015..7bcfc830e2 100644 --- a/doc/src/fix_wall_ees.rst +++ b/doc/src/fix_wall_ees.rst @@ -10,7 +10,7 @@ fix wall/region/ees command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix ID group-ID style args diff --git a/doc/src/fix_wall_gran.rst b/doc/src/fix_wall_gran.rst index 27d19d60b5..f6465d1159 100644 --- a/doc/src/fix_wall_gran.rst +++ b/doc/src/fix_wall_gran.rst @@ -9,7 +9,7 @@ Accelerator Variants: *wall/gran/kk* Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix ID group-ID wall/gran fstyle fstyle_params wallstyle args keyword values ... diff --git a/doc/src/fix_wall_gran_region.rst b/doc/src/fix_wall_gran_region.rst index 94edebbcf1..0a4343493b 100644 --- a/doc/src/fix_wall_gran_region.rst +++ b/doc/src/fix_wall_gran_region.rst @@ -6,7 +6,7 @@ fix wall/gran/region command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix ID group-ID wall/gran/region fstyle fstyle_params wallstyle regionID keyword values ... diff --git a/doc/src/fix_wall_piston.rst b/doc/src/fix_wall_piston.rst index 1237d1ac7c..d60d8cb731 100644 --- a/doc/src/fix_wall_piston.rst +++ b/doc/src/fix_wall_piston.rst @@ -6,7 +6,7 @@ fix wall/piston command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix ID group-ID wall/piston face ... keyword value ... diff --git a/doc/src/fix_wall_reflect.rst b/doc/src/fix_wall_reflect.rst index 8bb895280c..c2f4c3a6ab 100644 --- a/doc/src/fix_wall_reflect.rst +++ b/doc/src/fix_wall_reflect.rst @@ -9,7 +9,7 @@ Accelerator Variants: *wall/reflect/kk* Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix ID group-ID wall/reflect face arg ... keyword value ... diff --git a/doc/src/fix_wall_reflect_stochastic.rst b/doc/src/fix_wall_reflect_stochastic.rst index 64e3d759c1..5a93950a5d 100644 --- a/doc/src/fix_wall_reflect_stochastic.rst +++ b/doc/src/fix_wall_reflect_stochastic.rst @@ -6,7 +6,7 @@ fix wall/reflect/stochastic command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix ID group-ID wall/reflect/stochastic rstyle seed face args ... keyword value ... diff --git a/doc/src/fix_wall_region.rst b/doc/src/fix_wall_region.rst index adfd8402c6..466319c12e 100644 --- a/doc/src/fix_wall_region.rst +++ b/doc/src/fix_wall_region.rst @@ -6,7 +6,7 @@ fix wall/region command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix ID group-ID wall/region region-ID style args ... cutoff diff --git a/doc/src/fix_wall_srd.rst b/doc/src/fix_wall_srd.rst index a8cbdd1619..dfb6560ffd 100644 --- a/doc/src/fix_wall_srd.rst +++ b/doc/src/fix_wall_srd.rst @@ -6,7 +6,7 @@ fix wall/srd command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix ID group-ID wall/srd face arg ... keyword value ... diff --git a/doc/src/fix_widom.rst b/doc/src/fix_widom.rst index 5be93100b3..ff66095db5 100644 --- a/doc/src/fix_widom.rst +++ b/doc/src/fix_widom.rst @@ -6,7 +6,7 @@ fix widom command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix ID group-ID widom N M type seed T keyword values ... diff --git a/doc/src/group2ndx.rst b/doc/src/group2ndx.rst index e465c4629f..122341f7f6 100644 --- a/doc/src/group2ndx.rst +++ b/doc/src/group2ndx.rst @@ -10,7 +10,7 @@ ndx2group command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS group2ndx file group-ID ... ndx2group file group-ID ... diff --git a/doc/src/hyper.rst b/doc/src/hyper.rst index 9266a95523..c707c6b3fc 100644 --- a/doc/src/hyper.rst +++ b/doc/src/hyper.rst @@ -6,7 +6,7 @@ hyper command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS hyper N Nevent fix-ID compute-ID keyword values ... diff --git a/doc/src/include.rst b/doc/src/include.rst index 6d146061db..5e19f4a377 100644 --- a/doc/src/include.rst +++ b/doc/src/include.rst @@ -6,7 +6,7 @@ include command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS include file diff --git a/doc/src/info.rst b/doc/src/info.rst index 853e5020fc..958542e3c8 100644 --- a/doc/src/info.rst +++ b/doc/src/info.rst @@ -6,7 +6,7 @@ info command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS info args diff --git a/doc/src/jump.rst b/doc/src/jump.rst index e8047222ef..bf56934d8f 100644 --- a/doc/src/jump.rst +++ b/doc/src/jump.rst @@ -6,7 +6,7 @@ jump command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS jump file label diff --git a/doc/src/label.rst b/doc/src/label.rst index 430587135f..bf232431d7 100644 --- a/doc/src/label.rst +++ b/doc/src/label.rst @@ -6,7 +6,7 @@ label command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS label ID diff --git a/doc/src/lattice.rst b/doc/src/lattice.rst index d4d69c7af0..7dc9c579e5 100644 --- a/doc/src/lattice.rst +++ b/doc/src/lattice.rst @@ -6,7 +6,7 @@ lattice command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS lattice style scale keyword values ... diff --git a/doc/src/log.rst b/doc/src/log.rst index 5d4036dc06..46784f6ea6 100644 --- a/doc/src/log.rst +++ b/doc/src/log.rst @@ -6,7 +6,7 @@ log command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS log file keyword diff --git a/doc/src/mass.rst b/doc/src/mass.rst index f359ccf3a5..88bd14950c 100644 --- a/doc/src/mass.rst +++ b/doc/src/mass.rst @@ -6,7 +6,7 @@ mass command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS mass I value diff --git a/doc/src/min_style.rst b/doc/src/min_style.rst index 2f43308610..b89ae6d398 100644 --- a/doc/src/min_style.rst +++ b/doc/src/min_style.rst @@ -27,7 +27,7 @@ min_style fire command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS min_style style diff --git a/doc/src/minimize.rst b/doc/src/minimize.rst index 6221d33aad..c71c8e3632 100644 --- a/doc/src/minimize.rst +++ b/doc/src/minimize.rst @@ -9,7 +9,7 @@ minimize/kk command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS minimize etol ftol maxiter maxeval diff --git a/doc/src/molecule.rst b/doc/src/molecule.rst index b42bece327..480e175e7b 100644 --- a/doc/src/molecule.rst +++ b/doc/src/molecule.rst @@ -6,7 +6,7 @@ molecule command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS molecule ID file1 keyword values ... file2 keyword values ... fileN ... diff --git a/doc/src/neb.rst b/doc/src/neb.rst index a959eee01b..0bc5de010b 100644 --- a/doc/src/neb.rst +++ b/doc/src/neb.rst @@ -6,7 +6,7 @@ neb command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS neb etol ftol N1 N2 Nevery file-style arg keyword values diff --git a/doc/src/neb_spin.rst b/doc/src/neb_spin.rst index 9f714096dc..1d42ff884c 100644 --- a/doc/src/neb_spin.rst +++ b/doc/src/neb_spin.rst @@ -6,7 +6,7 @@ neb/spin command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS neb/spin etol ttol N1 N2 Nevery file-style arg keyword diff --git a/doc/src/neighbor.rst b/doc/src/neighbor.rst index 9dcdd1daf2..12d6d91fde 100644 --- a/doc/src/neighbor.rst +++ b/doc/src/neighbor.rst @@ -6,7 +6,7 @@ neighbor command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS neighbor skin style diff --git a/doc/src/newton.rst b/doc/src/newton.rst index c1a015c3e6..f77c8c54c4 100644 --- a/doc/src/newton.rst +++ b/doc/src/newton.rst @@ -6,7 +6,7 @@ newton command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS newton flag newton flag1 flag2 diff --git a/doc/src/next.rst b/doc/src/next.rst index 46d39660eb..d86c15c5fb 100644 --- a/doc/src/next.rst +++ b/doc/src/next.rst @@ -6,7 +6,7 @@ next command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS next variables diff --git a/doc/src/package.rst b/doc/src/package.rst index 0f28598029..63a7f095ad 100644 --- a/doc/src/package.rst +++ b/doc/src/package.rst @@ -6,7 +6,7 @@ package command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS package style args diff --git a/doc/src/partition.rst b/doc/src/partition.rst index f05c3fa446..6b1866d8d8 100644 --- a/doc/src/partition.rst +++ b/doc/src/partition.rst @@ -6,7 +6,7 @@ partition command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS partition style N command ... diff --git a/doc/src/plugin.rst b/doc/src/plugin.rst index 41e2621fef..f8f668789d 100644 --- a/doc/src/plugin.rst +++ b/doc/src/plugin.rst @@ -6,7 +6,7 @@ plugin command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS plugin command args diff --git a/doc/src/prd.rst b/doc/src/prd.rst index 7c6af3abb5..fd20fa4a3b 100644 --- a/doc/src/prd.rst +++ b/doc/src/prd.rst @@ -6,7 +6,7 @@ prd command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS prd N t_event n_dephase t_dephase t_correlate compute-ID seed keyword value ... diff --git a/doc/src/print.rst b/doc/src/print.rst index a221ed04b6..f5ba16d8b5 100644 --- a/doc/src/print.rst +++ b/doc/src/print.rst @@ -6,7 +6,7 @@ print command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS print string keyword value diff --git a/doc/src/processors.rst b/doc/src/processors.rst index 676f339725..921bbcc667 100644 --- a/doc/src/processors.rst +++ b/doc/src/processors.rst @@ -6,7 +6,7 @@ processors command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS processors Px Py Pz keyword args ... diff --git a/doc/src/python.rst b/doc/src/python.rst index b05de7094d..99f32e7c80 100644 --- a/doc/src/python.rst +++ b/doc/src/python.rst @@ -6,7 +6,7 @@ python command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS python mode keyword args ... diff --git a/doc/src/quit.rst b/doc/src/quit.rst index ba6b4037be..2355fb238b 100644 --- a/doc/src/quit.rst +++ b/doc/src/quit.rst @@ -6,7 +6,7 @@ quit command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS quit status diff --git a/doc/src/region.rst b/doc/src/region.rst index 4589e6deb1..36c7c799dc 100644 --- a/doc/src/region.rst +++ b/doc/src/region.rst @@ -6,7 +6,7 @@ region command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS region ID style args keyword arg ... diff --git a/doc/src/replicate.rst b/doc/src/replicate.rst index ed4e844c35..6bfbeab891 100644 --- a/doc/src/replicate.rst +++ b/doc/src/replicate.rst @@ -6,7 +6,7 @@ replicate command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS replicate nx ny nz *keyword* diff --git a/doc/src/rerun.rst b/doc/src/rerun.rst index cfed2e2872..1c1b4fb570 100644 --- a/doc/src/rerun.rst +++ b/doc/src/rerun.rst @@ -6,7 +6,7 @@ rerun command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS rerun file1 file2 ... keyword args ... diff --git a/doc/src/restart.rst b/doc/src/restart.rst index 5de2d3d75c..10394de80e 100644 --- a/doc/src/restart.rst +++ b/doc/src/restart.rst @@ -6,7 +6,7 @@ restart command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS restart 0 restart N root keyword value ... diff --git a/doc/src/run.rst b/doc/src/run.rst index 8bcf469052..c3dd171f6b 100644 --- a/doc/src/run.rst +++ b/doc/src/run.rst @@ -6,7 +6,7 @@ run command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS run N keyword values ... diff --git a/doc/src/set.rst b/doc/src/set.rst index 2ba1057ef5..8a6510f88f 100644 --- a/doc/src/set.rst +++ b/doc/src/set.rst @@ -6,7 +6,7 @@ set command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS set style ID keyword values ... diff --git a/doc/src/shell.rst b/doc/src/shell.rst index fb9baffe08..378ebdc479 100644 --- a/doc/src/shell.rst +++ b/doc/src/shell.rst @@ -6,7 +6,7 @@ shell command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS shell command args diff --git a/doc/src/suffix.rst b/doc/src/suffix.rst index 4789229800..6c723657a5 100644 --- a/doc/src/suffix.rst +++ b/doc/src/suffix.rst @@ -6,7 +6,7 @@ suffix command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS suffix style args diff --git a/doc/src/tad.rst b/doc/src/tad.rst index cc6d52d415..b35bc3dfbb 100644 --- a/doc/src/tad.rst +++ b/doc/src/tad.rst @@ -6,7 +6,7 @@ tad command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS tad N t_event T_lo T_hi delta tmax compute-ID keyword value ... diff --git a/doc/src/temper.rst b/doc/src/temper.rst index 363e0102fc..d8bbcb959b 100644 --- a/doc/src/temper.rst +++ b/doc/src/temper.rst @@ -6,7 +6,7 @@ temper command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS temper N M temp fix-ID seed1 seed2 index diff --git a/doc/src/temper_grem.rst b/doc/src/temper_grem.rst index 312df21254..0963ea98c1 100644 --- a/doc/src/temper_grem.rst +++ b/doc/src/temper_grem.rst @@ -6,7 +6,7 @@ temper/grem command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS temper/grem N M lambda fix-ID thermostat-ID seed1 seed2 index diff --git a/doc/src/temper_npt.rst b/doc/src/temper_npt.rst index a8f5999dbe..0659ba2c03 100644 --- a/doc/src/temper_npt.rst +++ b/doc/src/temper_npt.rst @@ -6,7 +6,7 @@ temper/npt command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS temper/npt N M temp fix-ID seed1 seed2 pressure index diff --git a/doc/src/thermo.rst b/doc/src/thermo.rst index 5621b554c8..f918810cc2 100644 --- a/doc/src/thermo.rst +++ b/doc/src/thermo.rst @@ -6,7 +6,7 @@ thermo command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS thermo N diff --git a/doc/src/timer.rst b/doc/src/timer.rst index a604cc2212..13d5a92473 100644 --- a/doc/src/timer.rst +++ b/doc/src/timer.rst @@ -6,7 +6,7 @@ timer command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS timer args diff --git a/doc/src/timestep.rst b/doc/src/timestep.rst index 3142509611..037b3f8642 100644 --- a/doc/src/timestep.rst +++ b/doc/src/timestep.rst @@ -6,7 +6,7 @@ timestep command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS timestep dt diff --git a/doc/src/uncompute.rst b/doc/src/uncompute.rst index 24b7c028d5..e65cbb2038 100644 --- a/doc/src/uncompute.rst +++ b/doc/src/uncompute.rst @@ -6,7 +6,7 @@ uncompute command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS uncompute compute-ID diff --git a/doc/src/undump.rst b/doc/src/undump.rst index 9320338854..89874457b0 100644 --- a/doc/src/undump.rst +++ b/doc/src/undump.rst @@ -6,7 +6,7 @@ undump command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS undump dump-ID diff --git a/doc/src/unfix.rst b/doc/src/unfix.rst index 419559a118..aeb640201d 100644 --- a/doc/src/unfix.rst +++ b/doc/src/unfix.rst @@ -6,7 +6,7 @@ unfix command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS unfix fix-ID diff --git a/doc/src/units.rst b/doc/src/units.rst index 2554806fb5..3f0904f162 100644 --- a/doc/src/units.rst +++ b/doc/src/units.rst @@ -6,7 +6,7 @@ units command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS units style diff --git a/doc/src/variable.rst b/doc/src/variable.rst index a9d21bab9b..28c0d29799 100644 --- a/doc/src/variable.rst +++ b/doc/src/variable.rst @@ -6,7 +6,7 @@ variable command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS variable name style args ... diff --git a/doc/src/velocity.rst b/doc/src/velocity.rst index ee1d546d79..48b0526df9 100644 --- a/doc/src/velocity.rst +++ b/doc/src/velocity.rst @@ -6,7 +6,7 @@ velocity command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS velocity group-ID style args keyword value ... From 6efa8526ba2740838659d4fbf9fcf5c521a8c004 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Tue, 11 Jul 2023 19:39:54 -0400 Subject: [PATCH 366/396] work around pygments issue --- doc/src/group2ndx.rst | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/doc/src/group2ndx.rst b/doc/src/group2ndx.rst index 122341f7f6..e3d8999714 100644 --- a/doc/src/group2ndx.rst +++ b/doc/src/group2ndx.rst @@ -12,11 +12,11 @@ Syntax .. code-block:: LAMMPS - group2ndx file group-ID ... - ndx2group file group-ID ... + group2ndx file group-ID args + ndx2group file group-ID args * file = name of index file to write out or read in -* zero or more group IDs may be appended +* args = zero or more group IDs may be appended Examples """""""" From fe2a275531a16610e8ad38e027f0a03b23e9ae60 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Tue, 11 Jul 2023 19:40:14 -0400 Subject: [PATCH 367/396] update list of known commands --- doc/utils/sphinx-config/LAMMPSLexer.py | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/doc/utils/sphinx-config/LAMMPSLexer.py b/doc/utils/sphinx-config/LAMMPSLexer.py index c8826a9ed6..9a4a1e2bc6 100644 --- a/doc/utils/sphinx-config/LAMMPSLexer.py +++ b/doc/utils/sphinx-config/LAMMPSLexer.py @@ -2,14 +2,15 @@ from pygments.lexer import RegexLexer, words, include, default from pygments.token import * LAMMPS_COMMANDS = ("angle_coeff", "angle_style", "atom_modify", - "atom_style", "balance", "bond_coeff", "bond_style", - "bond_write", "boundary", "clear", "comm_modify", - "comm_style", "compute_modify", "create_atoms", - "create_bonds", "create_box", "delete_atoms", - "delete_bonds", "dielectric", "dihedral_coeff", - "dihedral_style", "dimension", "displace_atoms", - "dump_modify", "dynamical_matrix", "echo", "elif", - "else", "fix_modify", "group2ndx", "hyper", "if", + "atom_style", "angle_write", "balance", "bond_coeff", + "bond_style", "bond_write", "boundary", "clear", + "comm_modify", "comm_style", "compute_modify", + "create_atoms", "create_bonds", "create_box", + "delete_atoms", "delete_bonds", "dielectric", + "dihedral_coeff", "dihedral_style", "dihedral_write", + "dimension", "displace_atoms", "dump_modify", + "dynamical_matrix", "echo", "elif", "else", "fitpod", + "fix_modify", "group2ndx", "hyper", "if", "improper_coeff", "improper_style", "include", "info", "jump", "kim", "kspace_modify", "kspace_style", "label", "labelmap", "lattice", From 9e049147bee35b3b861fce68701f5cefcab4cb00 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Tue, 11 Jul 2023 19:50:37 -0400 Subject: [PATCH 368/396] remove accidental commit --- purge-workflows.py | 22 ---------------------- 1 file changed, 22 deletions(-) delete mode 100644 purge-workflows.py diff --git a/purge-workflows.py b/purge-workflows.py deleted file mode 100644 index 73b7d22f7a..0000000000 --- a/purge-workflows.py +++ /dev/null @@ -1,22 +0,0 @@ -from yaml import load -import subprocess -try: - from yaml import CLoader as Loader -except ImportError: - from yaml import Loader - -runs = subprocess.check_output('gh api repos/lammps/lammps/actions/runs',shell=True) -data = load(runs,Loader=Loader) -while data['total_count'] > 3: - print('remaining: ', data['total_count']) - num=1 - for d in data['workflow_runs']: - print(num, d['id'],d['name'],d['run_number']) - num += 1 - if num > 4: - subprocess.call('gh api -X DELETE repos/lammps/lammps/actions/runs/' + str(d['id']), shell=True) - #print('gh api -X DELETE repos/lammps/lammps/actions/runs/' + str(d['id'])) - else: - print('skip') - runs = subprocess.check_output('gh api repos/lammps/lammps/actions/runs',shell=True) - data = load(runs,Loader=Loader) From 3b859094bffa575cc7488f87c3d24ad9b039133b Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Wed, 12 Jul 2023 12:26:55 -0400 Subject: [PATCH 369/396] there is no mandatory group-ID for both commands --- doc/src/group2ndx.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/doc/src/group2ndx.rst b/doc/src/group2ndx.rst index e3d8999714..077f88e3e8 100644 --- a/doc/src/group2ndx.rst +++ b/doc/src/group2ndx.rst @@ -12,8 +12,8 @@ Syntax .. code-block:: LAMMPS - group2ndx file group-ID args - ndx2group file group-ID args + group2ndx file args + ndx2group file args * file = name of index file to write out or read in * args = zero or more group IDs may be appended From 751dc1cfb6922fbd1a4b3ef6d45c406670d1f9e4 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Wed, 12 Jul 2023 12:28:03 -0400 Subject: [PATCH 370/396] improve pygments lexer to detect more text to highlight and for more consistency --- doc/utils/sphinx-config/LAMMPSLexer.py | 32 ++++++++++++++++++-------- 1 file changed, 23 insertions(+), 9 deletions(-) diff --git a/doc/utils/sphinx-config/LAMMPSLexer.py b/doc/utils/sphinx-config/LAMMPSLexer.py index 9a4a1e2bc6..48c52d6460 100644 --- a/doc/utils/sphinx-config/LAMMPSLexer.py +++ b/doc/utils/sphinx-config/LAMMPSLexer.py @@ -46,15 +46,24 @@ class LAMMPSLexer(RegexLexer): tokens = { 'root': [ (r'fix\s+', Keyword, 'fix'), + (r'fix_modify\s+', Keyword, 'modify_cmd'), (r'compute\s+', Keyword, 'compute'), + (r'compute_modify\s+', Keyword, 'modify_cmd'), (r'dump\s+', Keyword, 'dump'), + (r'dump_modify\s+', Keyword, 'modify_cmd'), (r'region\s+', Keyword, 'region'), (r'^\s*variable\s+', Keyword, 'variable_cmd'), (r'group\s+', Keyword, 'group'), (r'change_box\s+', Keyword, 'change_box'), - (r'uncompute\s+', Keyword, 'uncompute'), - (r'unfix\s+', Keyword, 'unfix'), - (r'undump\s+', Keyword, 'undump'), + (r'create_box\s+', Keyword, 'create_box'), + (r'delete_bonds\s+', Keyword, 'id_cmd'), + (r'displace_atoms\s+', Keyword, 'id_cmd'), + (r'dynamical_matrix\s+', Keyword, 'id_cmd'), + (r'group2ndx\s+', Keyword, 'ndx_cmd'), + (r'ndx2group\s+', Keyword, 'ndx_cmd'), + (r'uncompute\s+', Keyword, 'id_cmd'), + (r'unfix\s+', Keyword, 'id_cmd'), + (r'undump\s+', Keyword, 'id_cmd'), (r'write_dump\s+', Keyword, 'write_dump'), include('keywords'), (r'#.*?\n', Comment), @@ -91,6 +100,10 @@ class LAMMPSLexer(RegexLexer): ('\(', Name.Variable, 'expression'), ('\)', Name.Variable, '#pop'), ], + 'modify_cmd' : [ + (r'[\w_\-\.\[\]]+', Name.Variable.Identifier), + default('#pop') + ], 'fix' : [ (r'[\w_\-\.\[\]]+', Name.Variable.Identifier), (r'\s+', Whitespace, 'group_id'), @@ -122,15 +135,16 @@ class LAMMPSLexer(RegexLexer): (r'[\w_\-\.\[\]]+', Name.Variable.Identifier), default('#pop') ], - 'unfix' : [ + 'create_box' : [ + (r'[\w_\-\.\[\]]+', Name.Variable.Identifier), + (r'\s+', Whitespace, 'group_id'), + default('#pop') + ], + 'id_cmd' : [ (r'[\w_\-\.\[\]]+', Name.Variable.Identifier), default('#pop') ], - 'undump' : [ - (r'[\w_\-\.\[\]]+', Name.Variable.Identifier), - default('#pop') - ], - 'uncompute' : [ + 'ndx_cmd' : [ (r'[\w_\-\.\[\]]+', Name.Variable.Identifier), default('#pop') ], From fe95dbc82f9d0c258923501a60dde34f3ca0e922 Mon Sep 17 00:00:00 2001 From: jbcouli Date: Wed, 12 Jul 2023 11:37:17 -0600 Subject: [PATCH 371/396] enforce all special_bonds weights to be 1.0 when overlay/pair is used --- doc/src/Howto_bpm.rst | 6 +++--- src/BPM/bond_bpm.cpp | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/doc/src/Howto_bpm.rst b/doc/src/Howto_bpm.rst index 380c114866..0ca4e85fbb 100644 --- a/doc/src/Howto_bpm.rst +++ b/doc/src/Howto_bpm.rst @@ -79,9 +79,9 @@ As bonds can be broken between neighbor list builds, the bond styles. There are two possible settings which determine how pair interactions work between bonded particles. First, one can overlay pair forces with bond forces such that all bonded particles also -feel pair interactions. This can be accomplished by using the *overlay/pair* -keyword present in all bpm bond styles and by using the following special -bond settings +feel pair interactions. This can be accomplished by setting the *overlay/pair* +keyword present in all bpm bond styles to *yes* and requires using the +following special bond settings .. code-block:: LAMMPS diff --git a/src/BPM/bond_bpm.cpp b/src/BPM/bond_bpm.cpp index 023988b64d..3ebeed3f1d 100644 --- a/src/BPM/bond_bpm.cpp +++ b/src/BPM/bond_bpm.cpp @@ -94,10 +94,10 @@ void BondBPM::init_style() } if (overlay_flag) { - if (force->special_lj[1] != 1.0) + if (force->special_lj[1] != 1.0 || force->special_lj[2] != 1.0 || force->special_lj[3] != 1.0 || + force->special_coul[1] != 1.0 || force->special_coul[2] != 1.0 || force->special_coul[3] != 1.0) error->all(FLERR, - "With overlay/pair yes, BPM bond styles require special_bonds weight of 1.0 for " - "first neighbors"); + "With overlay/pair yes, BPM bond styles require a value of 1.0 for all special_bonds weights"); if (id_fix_update) { modify->delete_fix(id_fix_update); delete[] id_fix_update; From 24de6377d34fb2685513ce459b679df9534fa119 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Wed, 12 Jul 2023 14:43:04 -0400 Subject: [PATCH 372/396] handle more commands with arguments for more consistent syntax highlighting --- doc/utils/sphinx-config/LAMMPSLexer.py | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/doc/utils/sphinx-config/LAMMPSLexer.py b/doc/utils/sphinx-config/LAMMPSLexer.py index 48c52d6460..d09dda5302 100644 --- a/doc/utils/sphinx-config/LAMMPSLexer.py +++ b/doc/utils/sphinx-config/LAMMPSLexer.py @@ -61,10 +61,18 @@ class LAMMPSLexer(RegexLexer): (r'dynamical_matrix\s+', Keyword, 'id_cmd'), (r'group2ndx\s+', Keyword, 'ndx_cmd'), (r'ndx2group\s+', Keyword, 'ndx_cmd'), + (r'jump\s+', Keyword, 'jump_cmd'), + (r'label\s+', Keyword, 'jump_cmd'), + (r'next\s+', Keyword, 'id_cmd'), + (r'kim\s+', Keyword, 'kim_cmd'), (r'uncompute\s+', Keyword, 'id_cmd'), (r'unfix\s+', Keyword, 'id_cmd'), (r'undump\s+', Keyword, 'id_cmd'), + (r'velocity\s+', Keyword, 'id_cmd'), + (r'write_coeff\s+', Keyword, 'ndx_cmd'), + (r'write_data\s+', Keyword, 'ndx_cmd'), (r'write_dump\s+', Keyword, 'write_dump'), + (r'write_restart\s+', Keyword, 'ndx_cmd'), include('keywords'), (r'#.*?\n', Comment), ('"', String, 'string'), @@ -80,7 +88,7 @@ class LAMMPSLexer(RegexLexer): (r'[\~\.\w_:,@\-\/\\0-9]+', Text), ], 'keywords' : [ - (words(LAMMPS_COMMANDS, suffix=r'\b', prefix=r'^'), Keyword) + (words(LAMMPS_COMMANDS, suffix=r'\b', prefix=r'^\s*'), Keyword) ] , 'variable' : [ @@ -148,6 +156,14 @@ class LAMMPSLexer(RegexLexer): (r'[\w_\-\.\[\]]+', Name.Variable.Identifier), default('#pop') ], + 'jump_cmd' : [ + (r'[\w_\-\.\[\]]+', Literal.String.Char), + default('#pop') + ], + 'kim_cmd' : [ + (r'[\w_\-\.\[\]]+', Literal.String.Single), + default('#pop') + ], 'write_dump' : [ (r'[\w_\-\.\[\]]+', Name.Variable.Identifier), default('#pop') From 6907543e9df06e9868396ba41b4fa26ad474670d Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Wed, 12 Jul 2023 20:25:49 -0400 Subject: [PATCH 373/396] highlight if/then/elif/else everywhere, but revert for general keywords --- doc/utils/sphinx-config/LAMMPSLexer.py | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/doc/utils/sphinx-config/LAMMPSLexer.py b/doc/utils/sphinx-config/LAMMPSLexer.py index d09dda5302..a7ba5d92a8 100644 --- a/doc/utils/sphinx-config/LAMMPSLexer.py +++ b/doc/utils/sphinx-config/LAMMPSLexer.py @@ -9,8 +9,8 @@ LAMMPS_COMMANDS = ("angle_coeff", "angle_style", "atom_modify", "delete_atoms", "delete_bonds", "dielectric", "dihedral_coeff", "dihedral_style", "dihedral_write", "dimension", "displace_atoms", "dump_modify", - "dynamical_matrix", "echo", "elif", "else", "fitpod", - "fix_modify", "group2ndx", "hyper", "if", + "dynamical_matrix", "echo", "fitpod", + "fix_modify", "group2ndx", "hyper", "improper_coeff", "improper_style", "include", "info", "jump", "kim", "kspace_modify", "kspace_style", "label", "labelmap", "lattice", @@ -24,7 +24,7 @@ LAMMPS_COMMANDS = ("angle_coeff", "angle_style", "atom_modify", "read_restart", "replicate", "rerun", "reset_atoms", "reset_timestep", "restart", "run", "run_style", "server", "set", "shell", "special_bonds", "suffix", - "tad", "temper", "temper/grem", "temper/npt", "then", + "tad", "temper", "temper/grem", "temper/npt", "thermo", "thermo_modify", "thermo_style", "third_order", "timer", "timestep", "units", "velocity", "write_coeff", "write_data", @@ -52,7 +52,7 @@ class LAMMPSLexer(RegexLexer): (r'dump\s+', Keyword, 'dump'), (r'dump_modify\s+', Keyword, 'modify_cmd'), (r'region\s+', Keyword, 'region'), - (r'^\s*variable\s+', Keyword, 'variable_cmd'), + (r'variable\s+', Keyword, 'variable_cmd'), (r'group\s+', Keyword, 'group'), (r'change_box\s+', Keyword, 'change_box'), (r'create_box\s+', Keyword, 'create_box'), @@ -73,6 +73,7 @@ class LAMMPSLexer(RegexLexer): (r'write_data\s+', Keyword, 'ndx_cmd'), (r'write_dump\s+', Keyword, 'write_dump'), (r'write_restart\s+', Keyword, 'ndx_cmd'), + include('conditionals'), include('keywords'), (r'#.*?\n', Comment), ('"', String, 'string'), @@ -87,6 +88,10 @@ class LAMMPSLexer(RegexLexer): (r'[\+\-\*\^\|\/\!%&=<>]', Operator), (r'[\~\.\w_:,@\-\/\\0-9]+', Text), ], + 'conditionals' : [ + (words(('if','else','elif','then'), suffix=r'\b', prefix=r'\b'), Keyword) + ] + , 'keywords' : [ (words(LAMMPS_COMMANDS, suffix=r'\b', prefix=r'^\s*'), Keyword) ] From acb0b89833f873e77d2def92192c792b64f9a17a Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Wed, 12 Jul 2023 20:48:14 -0400 Subject: [PATCH 374/396] fix typos --- doc/src/Howto_2d.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/doc/src/Howto_2d.rst b/doc/src/Howto_2d.rst index be223c076a..ae58711063 100644 --- a/doc/src/Howto_2d.rst +++ b/doc/src/Howto_2d.rst @@ -13,9 +13,9 @@ box with a single z plane of atoms - e.g. .. code-block:: LAMMPS - create box 1 -10 10 -10 10 -0.25 0.25 + create_box 1 -10 10 -10 10 -0.25 0.25 -If using the :doc:`read data ` command to read in a file of +If using the :doc:`read_data ` command to read in a file of atom coordinates, set the "zlo zhi" values to be finite but narrow, similar to the create_box command settings just described. For each atom in the file, assign a z coordinate so it falls inside the From 02d189fb23d7b61f1cacb3bbf38bc5e157ad8739 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Thu, 13 Jul 2023 10:53:56 -0400 Subject: [PATCH 375/396] avoid false positive with static code analysis --- src/compute_count_type.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/compute_count_type.cpp b/src/compute_count_type.cpp index 3cb2e6bc3a..3d4815f9ff 100644 --- a/src/compute_count_type.cpp +++ b/src/compute_count_type.cpp @@ -159,6 +159,8 @@ void ComputeCountType::compute_vector() nvec = count_dihedrals(); else if (mode == IMPROPER) nvec = count_impropers(); + else + nvec = 0; // sum across procs as bigint, then convert to double // correct for multiple counting if newton_bond off From 620c60122a9e68ec036e824fc51bd50517a11fdc Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Fri, 14 Jul 2023 10:08:09 -0400 Subject: [PATCH 376/396] should not use pow() for computing cube, use multiplication. --- lib/gpu/lal_amoeba.cu | 3 ++- lib/gpu/lal_hippo.cu | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/gpu/lal_amoeba.cu b/lib/gpu/lal_amoeba.cu index 82a42cff6c..799cfe6d63 100644 --- a/lib/gpu/lal_amoeba.cu +++ b/lib/gpu/lal_amoeba.cu @@ -992,7 +992,8 @@ __kernel void k_amoeba_umutual2b(const __global numtyp4 *restrict x_, numtyp damp = pdi * coeff[jtype].x; // pdamp[jtype] if (damp != (numtyp)0.0) { numtyp pgamma = MIN(pti,coeff[jtype].y); // thole[jtype] - damp = pgamma * ucl_powr(r/damp,(numtyp)3.0); + numtyp rdamp = r/damp; + damp = pgamma * rdamp*rdamp*rdamp; if (damp < (numtyp)50.0) { numtyp expdamp = ucl_exp(-damp); scale3 = (numtyp)1.0 - expdamp; diff --git a/lib/gpu/lal_hippo.cu b/lib/gpu/lal_hippo.cu index 0a0f4f02be..92cb55f69b 100644 --- a/lib/gpu/lal_hippo.cu +++ b/lib/gpu/lal_hippo.cu @@ -845,7 +845,7 @@ __kernel void k_hippo_dispersion(const __global numtyp4 *restrict x_, numtyp scale = factor_disp * damp*damp; scale = scale - (numtyp)1.0; numtyp e = -ci * ck * (expa+scale) / r6; - numtyp rterm = -ucl_powr(ralpha2,(numtyp)3.0) * expterm / r; + numtyp rterm = -ralpha2*ralpha2*ralpha2 * expterm / r; numtyp de = (numtyp)-6.0*e/r2 - ci*ck*rterm/r7 - (numtyp)2.0*ci*ck*factor_disp*damp*ddamp/r7; energy+= e; From be2e437cecf47a20fcb5266277984b5a20a81bbd Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Fri, 14 Jul 2023 10:08:59 -0400 Subject: [PATCH 377/396] use approximation for erfc() on OpenCL for Intel since the OpenCL version seems broken --- lib/gpu/lal_amoeba.cu | 20 ++++++++++++++++++++ lib/gpu/lal_hippo.cu | 20 ++++++++++++++++++++ 2 files changed, 40 insertions(+) diff --git a/lib/gpu/lal_amoeba.cu b/lib/gpu/lal_amoeba.cu index 799cfe6d63..e7c313301e 100644 --- a/lib/gpu/lal_amoeba.cu +++ b/lib/gpu/lal_amoeba.cu @@ -585,7 +585,12 @@ __kernel void k_amoeba_multipole(const __global numtyp4 *restrict x_, numtyp ralpha = aewald * r; numtyp exp2a = ucl_exp(-ralpha*ralpha); numtyp bn[6]; +#ifdef INTEL_OCL + numtyp t = ucl_recip((numtyp)1.0 + EWALD_P*ralpha); + bn[0] = t * (A1+t*(A2+t*(A3+t*(A4+t*A5)))) * exp2a * rinv; +#else bn[0] = ucl_erfc(ralpha) * rinv; +#endif numtyp alsq2 = (numtyp)2.0 * aewald*aewald; numtyp alsq2n = (numtyp)0.0; @@ -802,7 +807,12 @@ __kernel void k_amoeba_udirect2b(const __global numtyp4 *restrict x_, numtyp ralpha = aewald * r; numtyp exp2a = ucl_exp(-ralpha*ralpha); numtyp bn[4], bcn[3]; +#ifdef INTEL_OCL + numtyp t = ucl_recip((numtyp)1.0 + EWALD_P*ralpha); + bn[0] = t * (A1+t*(A2+t*(A3+t*(A4+t*A5)))) * exp2a * rinv; +#else bn[0] = ucl_erfc(ralpha) * rinv; +#endif numtyp aefac = aesq2n; for (int m = 1; m <= 3; m++) { @@ -976,7 +986,12 @@ __kernel void k_amoeba_umutual2b(const __global numtyp4 *restrict x_, numtyp ralpha = aewald * r; numtyp exp2a = ucl_exp(-ralpha*ralpha); numtyp bn[4]; +#ifdef INTEL_OCL + numtyp t = ucl_recip((numtyp)1.0 + EWALD_P*ralpha); + bn[0] = t * (A1+t*(A2+t*(A3+t*(A4+t*A5)))) * exp2a * rinv; +#else bn[0] = ucl_erfc(ralpha) * rinv; +#endif numtyp aefac = aesq2n; for (int m = 1; m <= 3; m++) { @@ -1231,7 +1246,12 @@ __kernel void k_amoeba_polar(const __global numtyp4 *restrict x_, numtyp ralpha = aewald * r; numtyp exp2a = ucl_exp(-ralpha*ralpha); numtyp bn[5]; +#ifdef INTEL_OCL + numtyp t = ucl_recip((numtyp)1.0 + EWALD_P*ralpha); + bn[0] = t * (A1+t*(A2+t*(A3+t*(A4+t*A5)))) * exp2a * rinv; +#else bn[0] = ucl_erfc(ralpha) * rinv; +#endif numtyp alsq2 = (numtyp)2.0 * aewald*aewald; numtyp alsq2n = (numtyp)0.0; diff --git a/lib/gpu/lal_hippo.cu b/lib/gpu/lal_hippo.cu index 92cb55f69b..7de7bd594f 100644 --- a/lib/gpu/lal_hippo.cu +++ b/lib/gpu/lal_hippo.cu @@ -1072,7 +1072,12 @@ __kernel void k_hippo_multipole(const __global numtyp4 *restrict x_, numtyp ralpha = aewald * r; numtyp exp2a = ucl_exp(-ralpha*ralpha); numtyp bn[6]; +#ifdef INTEL_OCL + numtyp t = ucl_recip((numtyp)1.0 + EWALD_P*ralpha); + bn[0] = t * (A1+t*(A2+t*(A3+t*(A4+t*A5)))) * exp2a * rinv; +#else bn[0] = ucl_erfc(ralpha) * rinv; +#endif numtyp alsq2 = (numtyp)2.0 * aewald*aewald; numtyp alsq2n = (numtyp)0.0; @@ -1319,7 +1324,12 @@ __kernel void k_hippo_udirect2b(const __global numtyp4 *restrict x_, numtyp ralpha = aewald * r; numtyp exp2a = ucl_exp(-ralpha*ralpha); numtyp bn[4]; +#ifdef INTEL_OCL + numtyp t = ucl_recip((numtyp)1.0 + EWALD_P*ralpha); + bn[0] = t * (A1+t*(A2+t*(A3+t*(A4+t*A5)))) * exp2a * rinv; +#else bn[0] = ucl_erfc(ralpha) * rinv; +#endif numtyp aefac = aesq2n; for (int m = 1; m <= 3; m++) { @@ -1477,7 +1487,12 @@ __kernel void k_hippo_umutual2b(const __global numtyp4 *restrict x_, numtyp ralpha = aewald * r; numtyp exp2a = ucl_exp(-ralpha*ralpha); numtyp bn[4]; +#ifdef INTEL_OCL + numtyp t = ucl_recip((numtyp)1.0 + EWALD_P*ralpha); + bn[0] = t * (A1+t*(A2+t*(A3+t*(A4+t*A5)))) * exp2a * rinv; +#else bn[0] = ucl_erfc(ralpha) * rinv; +#endif numtyp aefac = aesq2n; for (int m = 1; m <= 3; m++) { @@ -1702,7 +1717,12 @@ __kernel void k_hippo_polar(const __global numtyp4 *restrict x_, numtyp ralpha = aewald * r; numtyp exp2a = ucl_exp(-ralpha*ralpha); numtyp bn[5]; +#ifdef INTEL_OCL + numtyp t = ucl_recip((numtyp)1.0 + EWALD_P*ralpha); + bn[0] = t * (A1+t*(A2+t*(A3+t*(A4+t*A5)))) * exp2a * rinv; +#else bn[0] = ucl_erfc(ralpha) * rinv; +#endif numtyp alsq2 = (numtyp)2.0 * aewald*aewald; numtyp alsq2n = (numtyp)0.0; From 78d3d4948f281c62e57e4f5ec200afcca5145ef2 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Fri, 14 Jul 2023 20:06:31 -0400 Subject: [PATCH 378/396] fix off-by-one bug in argument parsing --- src/REPLICA/temper_npt.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/REPLICA/temper_npt.cpp b/src/REPLICA/temper_npt.cpp index 6567cb83e1..6aa895e813 100644 --- a/src/REPLICA/temper_npt.cpp +++ b/src/REPLICA/temper_npt.cpp @@ -89,7 +89,9 @@ void TemperNPT::command(int narg, char **arg) seed_boltz = utils::inumeric(FLERR,arg[5],false,lmp); my_set_temp = universe->iworld; - if (narg == 8) my_set_temp = utils::inumeric(FLERR,arg[6],false,lmp); + if (narg == 8) my_set_temp = utils::inumeric(FLERR,arg[7],false,lmp); + if ((my_set_temp < 0) || (my_set_temp > 7)) + error->universe_all(FLERR,"Invalid partition number for temperature index keyword"); // swap frequency must evenly divide total # of timesteps From e6873bb7c816cea6e5f46ad47f8b650b4b70ec79 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Fri, 14 Jul 2023 20:07:09 -0400 Subject: [PATCH 379/396] modernize code --- src/REPLICA/temper_npt.cpp | 35 ++++++++++++++++------------------- src/REPLICA/temper_npt.h | 3 +-- 2 files changed, 17 insertions(+), 21 deletions(-) diff --git a/src/REPLICA/temper_npt.cpp b/src/REPLICA/temper_npt.cpp index 6aa895e813..303eff59b3 100644 --- a/src/REPLICA/temper_npt.cpp +++ b/src/REPLICA/temper_npt.cpp @@ -52,10 +52,10 @@ TemperNPT::~TemperNPT() MPI_Comm_free(&roots); if (ranswap) delete ranswap; delete ranboltz; - delete [] set_temp; - delete [] temp2world; - delete [] world2temp; - delete [] world2root; + delete[] set_temp; + delete[] temp2world; + delete[] world2temp; + delete[] world2root; } /* ---------------------------------------------------------------------- @@ -68,8 +68,7 @@ void TemperNPT::command(int narg, char **arg) error->all(FLERR,"Must have more than one processor partition to temper"); if (domain->box_exist == 0) error->all(FLERR,"temper/npt command before simulation box is defined"); - if (narg != 7 && narg != 8) - error->universe_all(FLERR,"Illegal temper/npt command"); + if (narg != 7 && narg != 8) error->universe_all(FLERR,"Illegal temper/npt command"); int nsteps = utils::inumeric(FLERR,arg[0],false,lmp); nevery = utils::inumeric(FLERR,arg[1],false,lmp); @@ -80,10 +79,9 @@ void TemperNPT::command(int narg, char **arg) if (timer->is_timeout()) return; - for (whichfix = 0; whichfix < modify->nfix; whichfix++) - if (strcmp(arg[3],modify->fix[whichfix]->id) == 0) break; - if (whichfix == modify->nfix) - error->universe_all(FLERR,"Tempering fix ID is not defined"); + whichfix = modify->get_fix_by_id(arg[3]); + if (!whichfix) + error->universe_all(FLERR,fmt::format("Tempering fix ID {} is not defined", arg[3])); seed_swap = utils::inumeric(FLERR,arg[4],false,lmp); seed_boltz = utils::inumeric(FLERR,arg[5],false,lmp); @@ -106,8 +104,8 @@ void TemperNPT::command(int narg, char **arg) // change the volume. This currently only applies to fix npt and // fix rigid/npt variants - if ( (!utils::strmatch(modify->fix[whichfix]->style,"^npt")) && - (!utils::strmatch(modify->fix[whichfix]->style,"^rigid/npt")) ) + if ( (!utils::strmatch(whichfix->style,"^npt")) && + (!utils::strmatch(whichfix->style,"^rigid/npt")) ) error->universe_all(FLERR,"Tempering temperature and pressure fix is not supported"); // setup for long tempering run @@ -118,8 +116,7 @@ void TemperNPT::command(int narg, char **arg) update->nsteps = nsteps; update->beginstep = update->firststep = update->ntimestep; update->endstep = update->laststep = update->firststep + nsteps; - if (update->laststep < 0) - error->all(FLERR,"Too many timesteps"); + if (update->laststep < 0) error->all(FLERR,"Too many timesteps"); lmp->init(); @@ -135,9 +132,9 @@ void TemperNPT::command(int narg, char **arg) // pe_compute = ptr to thermo_pe compute // notify compute it will be called at first swap - int id = modify->find_compute("thermo_pe"); - if (id < 0) error->all(FLERR,"Tempering could not find thermo_pe compute"); - Compute *pe_compute = modify->compute[id]; + Compute *pe_compute = modify->get_compute_by_id("thermo_pe"); + if (!pe_compute) error->all(FLERR,"Tempering could not find thermo_pe compute"); + pe_compute->addstep(update->ntimestep + nevery); // create MPI communicator for root proc from each world @@ -186,7 +183,7 @@ void TemperNPT::command(int narg, char **arg) if (narg == 8) { double new_temp = set_temp[my_set_temp]; - modify->fix[whichfix]->reset_target(new_temp); + whichfix->reset_target(new_temp); } // setup tempering runs @@ -327,7 +324,7 @@ void TemperNPT::command(int narg, char **arg) if (swap) { new_temp = set_temp[partner_set_temp]; - modify->fix[whichfix]->reset_target(new_temp); + whichfix->reset_target(new_temp); } // update my_set_temp and temp2world on every proc diff --git a/src/REPLICA/temper_npt.h b/src/REPLICA/temper_npt.h index 3a51fc74e4..2e831c55ef 100644 --- a/src/REPLICA/temper_npt.h +++ b/src/REPLICA/temper_npt.h @@ -42,8 +42,7 @@ class TemperNPT : public Command { int nswaps; // # of tempering swaps to perform int seed_swap; // 0 = toggle swaps, n = RNG for swap direction int seed_boltz; // seed for Boltz factor comparison - int whichfix; // index of temperature fix to use - int fixstyle; // what kind of temperature fix is used + class Fix *whichfix; // index of temperature fix to use int my_set_temp; // which set temp I am simulating double *set_temp; // static list of replica set temperatures From baac049aed55d644783289d424ed0528c81e0ad3 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Sat, 15 Jul 2023 12:25:03 -0400 Subject: [PATCH 380/396] update LAMMPS input file syntax highlighting for recent changes --- tools/vim/lammps.vim | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/tools/vim/lammps.vim b/tools/vim/lammps.vim index 008ae1ee3f..9565d0a86e 100644 --- a/tools/vim/lammps.vim +++ b/tools/vim/lammps.vim @@ -1,23 +1,27 @@ " Vim syntax file -" Language: Lammps Simulation Script File +" Language: Lammps Simulation Script File " Maintainer: Gerolf Ziegenhain " Updates: Axel Kohlmeyer , Sam Bateman , Daniel Möller Montull , Eryk Skalinski -" Latest Revision: 2022-08-17 +" Latest Revision: 2023-07-15 syn clear -syn keyword lammpsOutput log write_data write_dump info shell write_restart restart dump undump thermo thermo_modify thermo_style print timer +" Add '/' to list of valid keyword characters +set iskeyword+=/ + +syn keyword lammpsOutput log write_data write_dump write_coeff info shell write_restart restart dump undump thermo thermo_modify +syn keyword lammpsOutput thermo_style print timer syn keyword lammpsRead include read_restart read_data read_dump molecule syn keyword lammpsLattice boundary units atom_style lattice region create_box create_atoms dielectric syn keyword lammpsLattice delete_atoms displace_atoms change_box dimension replicate -syn keyword lammpsParticle pair_coeff pair_style pair_modify pair_write mass velocity angle_coeff angle_style +syn keyword lammpsParticle pair_coeff pair_style pair_modify pair_write mass velocity angle_coeff angle_style angle_write syn keyword lammpsParticle atom_modify atom_style bond_coeff bond_style bond_write create_bonds delete_bonds kspace_style -syn keyword lammpsParticle kspace_modify dihedral_style dihedral_coeff improper_style improper_coeff -syn keyword lammpsSetup min_style fix_modify run_style timestep neighbor neigh_modify fix unfix suffix special_bonds -syn keyword lammpsSetup balance box clear comm_modify comm_style newton package processors reset_ids reset_timestep -syn keyword lammpsRun minimize run rerun tad neb prd quit server temper temper/grem temper/npt -syn keyword lammpsRun min/spin message hyper dynamical_matrix -syn keyword lammpsDefine variable group compute python set uncompute kim_query +syn keyword lammpsParticle kspace_modify dihedral_style dihedral_coeff dihedral_write improper_style improper_coeff labelmap +syn keyword lammpsSetup min_style min_modify fix_modify run_style timestep neighbor neigh_modify fix unfix suffix special_bonds +syn keyword lammpsSetup balance box clear comm_modify comm_style newton package processors reset_atoms reset_ids reset_timestep +syn keyword lammpsRun minimize minimize/kk run rerun tad neb neb/spin prd quit server temper/npt temper/grem temper +syn keyword lammpsRun message hyper dynamical_matrix dynamical_matrix/kk third_order third_order/kk fitpod +syn keyword lammpsDefine variable group compute python set uncompute kim_query kim group2ndx ndx2group mdi syn keyword lammpsRepeat jump next loop From 77bdcb3e19679ae43ed1b4b969e5b818939be5f1 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Sat, 15 Jul 2023 12:36:41 -0400 Subject: [PATCH 381/396] small doc style update --- doc/src/dynamical_matrix.rst | 2 +- doc/src/minimize.rst | 4 ++-- doc/src/third_order.rst | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/doc/src/dynamical_matrix.rst b/doc/src/dynamical_matrix.rst index 93e4c2a1aa..0243fb49db 100644 --- a/doc/src/dynamical_matrix.rst +++ b/doc/src/dynamical_matrix.rst @@ -4,7 +4,7 @@ dynamical_matrix command ======================== -Accelerator Variants: dynamical_matrix/kk +Accelerator Variant: dynamical_matrix/kk Syntax """""" diff --git a/doc/src/minimize.rst b/doc/src/minimize.rst index c71c8e3632..56efa12f44 100644 --- a/doc/src/minimize.rst +++ b/doc/src/minimize.rst @@ -1,10 +1,10 @@ .. index:: minimize +.. index:: minimize/kk minimize command ================ -minimize/kk command -=================== +Accelerator Variant: minimize/kk Syntax """""" diff --git a/doc/src/third_order.rst b/doc/src/third_order.rst index 2635c92f84..bbbf424c44 100644 --- a/doc/src/third_order.rst +++ b/doc/src/third_order.rst @@ -4,7 +4,7 @@ third_order command =================== -Accelerator Variants: third_order/kk +Accelerator Variant: third_order/kk Syntax """""" From fd0a72eab53889af860c33d406b1390fd59ce609 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Sat, 15 Jul 2023 12:37:12 -0400 Subject: [PATCH 382/396] modernize and consolidate style across all three temper command variants --- src/REPLICA/temper.cpp | 58 +++++++++++++--------------- src/REPLICA/temper.h | 3 +- src/REPLICA/temper_grem.cpp | 75 ++++++++++++++++++------------------- src/REPLICA/temper_grem.h | 4 +- src/REPLICA/temper_npt.cpp | 33 ++++++++-------- 5 files changed, 82 insertions(+), 91 deletions(-) diff --git a/src/REPLICA/temper.cpp b/src/REPLICA/temper.cpp index 9e7e67d79d..adbdb4d742 100644 --- a/src/REPLICA/temper.cpp +++ b/src/REPLICA/temper.cpp @@ -37,7 +37,7 @@ using namespace LAMMPS_NS; -// #define TEMPER_DEBUG 1 +#define TEMPER_DEBUG 0 /* ---------------------------------------------------------------------- */ @@ -50,10 +50,10 @@ Temper::~Temper() MPI_Comm_free(&roots); if (ranswap) delete ranswap; delete ranboltz; - delete [] set_temp; - delete [] temp2world; - delete [] world2temp; - delete [] world2root; + delete[] set_temp; + delete[] temp2world; + delete[] world2temp; + delete[] world2root; } /* ---------------------------------------------------------------------- @@ -63,11 +63,10 @@ Temper::~Temper() void Temper::command(int narg, char **arg) { if (universe->nworlds == 1) - error->all(FLERR,"Must have more than one processor partition to temper"); + error->universe_all(FLERR,"More than one processor partition required for temper command"); if (domain->box_exist == 0) - error->all(FLERR,"Temper command before simulation box is defined"); - if (narg != 6 && narg != 7) - error->universe_all(FLERR,"Illegal temper command"); + error->universe_all(FLERR,"Temper command before simulation box is defined"); + if (narg != 6 && narg != 7) error->universe_all(FLERR,"Illegal temper command"); int nsteps = utils::inumeric(FLERR,arg[0],false,lmp); nevery = utils::inumeric(FLERR,arg[1],false,lmp); @@ -77,10 +76,9 @@ void Temper::command(int narg, char **arg) if (timer->is_timeout()) return; - for (whichfix = 0; whichfix < modify->nfix; whichfix++) - if (strcmp(arg[3],modify->fix[whichfix]->id) == 0) break; - if (whichfix == modify->nfix) - error->universe_all(FLERR,"Tempering fix ID is not defined"); + whichfix = modify->get_fix_by_id(arg[3]); + if (!whichfix) + error->universe_all(FLERR,fmt::format("Tempering fix ID {} is not defined", arg[3])); seed_swap = utils::inumeric(FLERR,arg[4],false,lmp); seed_boltz = utils::inumeric(FLERR,arg[5],false,lmp); @@ -88,7 +86,7 @@ void Temper::command(int narg, char **arg) my_set_temp = universe->iworld; if (narg == 7) my_set_temp = utils::inumeric(FLERR,arg[6],false,lmp); if ((my_set_temp < 0) || (my_set_temp >= universe->nworlds)) - error->universe_one(FLERR,"Illegal temperature index"); + error->universe_one(FLERR,"Invalid temperature index value"); // swap frequency must evenly divide total # of timesteps @@ -101,11 +99,11 @@ void Temper::command(int narg, char **arg) // fix style must be appropriate for temperature control, i.e. it needs // to provide a working Fix::reset_target() and must not change the volume. - if ((!utils::strmatch(modify->fix[whichfix]->style,"^nvt")) && - (!utils::strmatch(modify->fix[whichfix]->style,"^langevin")) && - (!utils::strmatch(modify->fix[whichfix]->style,"^gl[de]$")) && - (!utils::strmatch(modify->fix[whichfix]->style,"^rigid/nvt")) && - (!utils::strmatch(modify->fix[whichfix]->style,"^temp/"))) + if ((!utils::strmatch(whichfix->style,"^nvt")) && + (!utils::strmatch(whichfix->style,"^langevin")) && + (!utils::strmatch(whichfix->style,"^gl[de]$")) && + (!utils::strmatch(whichfix->style,"^rigid/nvt")) && + (!utils::strmatch(whichfix->style,"^temp/"))) error->universe_all(FLERR,"Tempering temperature fix is not supported"); // setup for long tempering run @@ -116,8 +114,7 @@ void Temper::command(int narg, char **arg) update->nsteps = nsteps; update->beginstep = update->firststep = update->ntimestep; update->endstep = update->laststep = update->firststep + nsteps; - if (update->laststep < 0) - error->all(FLERR,"Too many timesteps"); + if (update->laststep < 0) error->all(FLERR,"Too many timesteps"); lmp->init(); @@ -132,9 +129,9 @@ void Temper::command(int narg, char **arg) // pe_compute = ptr to thermo_pe compute // notify compute it will be called at first swap - int id = modify->find_compute("thermo_pe"); - if (id < 0) error->all(FLERR,"Tempering could not find thermo_pe compute"); - Compute *pe_compute = modify->compute[id]; + Compute *pe_compute = modify->get_compute_by_id("thermo_pe"); + if (!pe_compute) error->all(FLERR,"Tempering could not find thermo_pe compute"); + pe_compute->addstep(update->ntimestep + nevery); // create MPI communicator for root proc from each world @@ -183,7 +180,7 @@ void Temper::command(int narg, char **arg) if (narg == 7) { double new_temp = set_temp[my_set_temp]; - modify->fix[whichfix]->reset_target(new_temp); + whichfix->reset_target(new_temp); } // setup tempering runs @@ -289,13 +286,12 @@ void Temper::command(int narg, char **arg) else MPI_Recv(&swap,1,MPI_INT,partner,0,universe->uworld,MPI_STATUS_IGNORE); -#ifdef TEMPER_DEBUG +#if TEMPER_DEBUG if (me_universe < partner) - printf("SWAP %d & %d: yes = %d,Ts = %d %d, PEs = %g %g, Bz = %g %g\n", - me_universe,partner,swap,my_set_temp,partner_set_temp, - pe,pe_partner,boltz_factor,exp(boltz_factor)); + fprintf(universe->uscreen,"SWAP %d & %d: yes = %d,Ts = %d %d, PEs = %g %g, Bz = %g %g\n", + me_universe,partner,swap,my_set_temp,partner_set_temp, + pe,pe_partner,boltz_factor,exp(boltz_factor)); #endif - } // bcast swap result to other procs in my world @@ -310,7 +306,7 @@ void Temper::command(int narg, char **arg) if (swap) { new_temp = set_temp[partner_set_temp]; - modify->fix[whichfix]->reset_target(new_temp); + whichfix->reset_target(new_temp); } // update my_set_temp and temp2world on every proc diff --git a/src/REPLICA/temper.h b/src/REPLICA/temper.h index b557e8ddd8..d959892587 100644 --- a/src/REPLICA/temper.h +++ b/src/REPLICA/temper.h @@ -40,8 +40,7 @@ class Temper : public Command { int nswaps; // # of tempering swaps to perform int seed_swap; // 0 = toggle swaps, n = RNG for swap direction int seed_boltz; // seed for Boltz factor comparison - int whichfix; // index of temperature fix to use - int fixstyle; // what kind of temperature fix is used + class Fix *whichfix; // index of temperature fix to use int my_set_temp; // which set temp I am simulating double *set_temp; // static list of replica set temperatures diff --git a/src/REPLICA/temper_grem.cpp b/src/REPLICA/temper_grem.cpp index 68fbb4eef6..303f502309 100644 --- a/src/REPLICA/temper_grem.cpp +++ b/src/REPLICA/temper_grem.cpp @@ -24,6 +24,7 @@ #include "finish.h" #include "fix.h" #include "fix_grem.h" +#include "fix_nh.h" #include "force.h" #include "integrate.h" #include "modify.h" @@ -37,7 +38,7 @@ using namespace LAMMPS_NS; -//#define TEMPER_DEBUG 1 +#define TEMPER_DEBUG 0 /* ---------------------------------------------------------------------- */ @@ -50,11 +51,10 @@ TemperGrem::~TemperGrem() MPI_Comm_free(&roots); if (ranswap) delete ranswap; delete ranboltz; - delete [] set_lambda; - delete [] lambda2world; - delete [] world2lambda; - delete [] world2root; - delete [] id_nh; + delete[] set_lambda; + delete[] lambda2world; + delete[] world2lambda; + delete[] world2root; } /* ---------------------------------------------------------------------- @@ -64,46 +64,50 @@ TemperGrem::~TemperGrem() void TemperGrem::command(int narg, char **arg) { if (universe->nworlds == 1) - error->all(FLERR,"Must have more than one processor partition to temper"); + error->universe_all(FLERR,"More than one processor partition required for temper/grem command"); if (domain->box_exist == 0) - error->all(FLERR,"Temper/gREM command before simulation box is defined"); - if (narg != 7 && narg != 8) - error->universe_all(FLERR,"Illegal temper command"); + error->universe_all(FLERR,"Temper/grem command before simulation box is defined"); + if (narg != 7 && narg != 8) error->universe_all(FLERR,"Illegal temper/grem command"); int nsteps = utils::inumeric(FLERR,arg[0],false,lmp); nevery = utils::inumeric(FLERR,arg[1],false,lmp); double lambda = utils::numeric(FLERR,arg[2],false,lmp); // ignore temper command, if walltime limit was already reached + if (timer->is_timeout()) return; - // Get and check if gREM fix exists - for (whichfix = 0; whichfix < modify->nfix; whichfix++) - if (strcmp(arg[3],modify->fix[whichfix]->id) == 0) break; - if (whichfix == modify->nfix) - error->universe_all(FLERR,"Tempering fix ID is not defined"); - fix_grem = dynamic_cast(modify->fix[whichfix]); + // Get and check if gREM fix exists and is correct style + + auto ifix = modify->get_fix_by_id(arg[3]); + if (!ifix) error->universe_all(FLERR,fmt::format("Tempering fix ID {} is not defined", arg[3])); + + fix_grem = dynamic_cast(ifix); + if (!fix_grem || (strcmp(ifix->style,"grem") != 0)) + error->universe_all(FLERR,"Tempering temperature fix is of incorrect style"); // Check input values lambdas should be equal, assign other gREM values if (lambda != fix_grem->lambda) - error->universe_all(FLERR,"Lambda from tempering and fix in the same world" - " must be the same"); + error->universe_all(FLERR,"Lambda from tempering and fix in the same world must be the same"); double eta = fix_grem->eta; double h0 = fix_grem->h0; double pressref = 0; // Get and check for nh fix - id_nh = utils::strdup(arg[4]); - int ifix = modify->find_fix(id_nh); - if (ifix < 0) - error->all(FLERR,"Fix id for nvt or npt fix does not exist"); - Fix *nh = modify->fix[ifix]; + + FixNH *nh = dynamic_cast(modify->get_fix_by_id(arg[4])); + if (!nh) + error->all(FLERR,fmt::format("Fix {} for Nose-Hoover fix does not exist", arg[4])); // get result from nvt vs npt check from fix_grem + int pressflag = fix_grem->pressflag; + // fix_grem does all the checking... + if (pressflag) { - auto p_start = (double *) nh->extract("p_start",ifix); + int dummy; + auto p_start = (double *) nh->extract("p_start",dummy); pressref = p_start[0]; } @@ -123,11 +127,6 @@ void TemperGrem::command(int narg, char **arg) if (nswaps*nevery != nsteps) error->universe_all(FLERR,"Non integer # of swaps in temper command"); - // Must be used with fix_grem - - if (strcmp(modify->fix[whichfix]->style,"grem") != 0) - error->universe_all(FLERR,"Tempering temperature fix is not supported"); - // setup for long tempering run update->whichflag = 1; @@ -136,8 +135,7 @@ void TemperGrem::command(int narg, char **arg) update->nsteps = nsteps; update->beginstep = update->firststep = update->ntimestep; update->endstep = update->laststep = update->firststep + nsteps; - if (update->laststep < 0) - error->all(FLERR,"Too many timesteps"); + if (update->laststep < 0) error->all(FLERR,"Too many timesteps"); lmp->init(); @@ -152,9 +150,9 @@ void TemperGrem::command(int narg, char **arg) // pe_compute = ptr to thermo_pe compute // notify compute it will be called at first swap - int id = modify->find_compute("thermo_pe"); - if (id < 0) error->all(FLERR,"Tempering could not find thermo_pe compute"); - Compute *pe_compute = modify->compute[id]; + Compute *pe_compute = modify->get_compute_by_id("thermo_pe"); + if (!pe_compute) error->all(FLERR,"Tempering could not find thermo_pe compute"); + pe_compute->addstep(update->ntimestep + nevery); // create MPI communicator for root proc from each world @@ -319,13 +317,12 @@ void TemperGrem::command(int narg, char **arg) else MPI_Recv(&swap,1,MPI_INT,partner,0,universe->uworld,MPI_STATUS_IGNORE); -#ifdef TEMPER_DEBUG +#if TEMPER_DEBUG if (me_universe < partner) - printf("SWAP %d & %d: yes = %d,Ts = %d %d, PEs = %g %g, Bz = %g %g\n", - me_universe,partner,swap,my_set_lambda,partner_set_lambda, - weight,weight_partner,boltz_factor,exp(boltz_factor)); + fprintf(universe->uscreen,"SWAP %d & %d: yes = %d,Ts = %d %d, PEs = %g %g, Bz = %g %g\n", + me_universe,partner,swap,my_set_lambda,partner_set_lambda, + weight,weight_partner,boltz_factor,exp(boltz_factor)); #endif - } // bcast swap result to other procs in my world diff --git a/src/REPLICA/temper_grem.h b/src/REPLICA/temper_grem.h index 3c41f9b082..c66239a794 100644 --- a/src/REPLICA/temper_grem.h +++ b/src/REPLICA/temper_grem.h @@ -40,8 +40,7 @@ class TemperGrem : public Command { int nswaps; // # of tempering swaps to perform int seed_swap; // 0 = toggle swaps, n = RNG for swap direction int seed_boltz; // seed for Boltz factor comparison - int whichfix; // index of temperature fix to use - int fixstyle; // what kind of temperature fix is used + class Fix *whichfix; // index of temperature fix to use int my_set_lambda; // which set lambda I am simulating double *set_lambda; // static list of replica set lambdas @@ -54,7 +53,6 @@ class TemperGrem : public Command { class FixGrem *fix_grem; protected: - char *id_nh; int pressflag; }; diff --git a/src/REPLICA/temper_npt.cpp b/src/REPLICA/temper_npt.cpp index 303eff59b3..d814bf6725 100644 --- a/src/REPLICA/temper_npt.cpp +++ b/src/REPLICA/temper_npt.cpp @@ -65,9 +65,9 @@ TemperNPT::~TemperNPT() void TemperNPT::command(int narg, char **arg) { if (universe->nworlds == 1) - error->all(FLERR,"Must have more than one processor partition to temper"); + error->universe_all(FLERR,"More than one processor partition required for temper/npt command"); if (domain->box_exist == 0) - error->all(FLERR,"temper/npt command before simulation box is defined"); + error->universe_all(FLERR,"Temper/npt command before simulation box is defined"); if (narg != 7 && narg != 8) error->universe_all(FLERR,"Illegal temper/npt command"); int nsteps = utils::inumeric(FLERR,arg[0],false,lmp); @@ -88,8 +88,8 @@ void TemperNPT::command(int narg, char **arg) my_set_temp = universe->iworld; if (narg == 8) my_set_temp = utils::inumeric(FLERR,arg[7],false,lmp); - if ((my_set_temp < 0) || (my_set_temp > 7)) - error->universe_all(FLERR,"Invalid partition number for temperature index keyword"); + if ((my_set_temp < 0) || (my_set_temp >= universe->nworlds)) + error->universe_one(FLERR,"Invalid temperature index value"); // swap frequency must evenly divide total # of timesteps @@ -278,22 +278,23 @@ void TemperNPT::command(int narg, char **arg) swap = 0; if (partner != -1) { - if (me_universe > partner) { + if (me_universe > partner) MPI_Send(&pe,1,MPI_DOUBLE,partner,0,universe->uworld); - } - else { + else MPI_Recv(&pe_partner,1,MPI_DOUBLE,partner,0,universe->uworld,MPI_STATUS_IGNORE); - } - if (me_universe > partner) { + + if (me_universe > partner) MPI_Send(&vol,1, MPI_DOUBLE,partner,0,universe->uworld); - } - else { + else MPI_Recv(&vol_partner,1,MPI_DOUBLE,partner,0,universe->uworld,MPI_STATUS_IGNORE); - } - // Acceptance criteria changed for NPT ensemble + + // Acceptance criteria changed versus temper command for NPT ensemble if (me_universe < partner) { press_units = press_set/nktv2p; - delr = (pe_partner - pe)*(1.0/(boltz*set_temp[my_set_temp]) - 1.0/(boltz*set_temp[partner_set_temp])) + press_units*(1.0/(boltz*set_temp[my_set_temp]) - 1.0/(boltz*set_temp[partner_set_temp]))*(vol_partner - vol); + delr = (pe_partner - pe)*(1.0/(boltz*set_temp[my_set_temp]) + - 1.0/(boltz*set_temp[partner_set_temp])) + + press_units*(1.0/(boltz*set_temp[my_set_temp]) + - 1.0/(boltz*set_temp[partner_set_temp]))*(vol_partner - vol); boltz_factor = -delr; if (boltz_factor >= 0.0) swap = 1; else if (ranboltz->uniform() < exp(boltz_factor)) swap = 1; @@ -303,13 +304,13 @@ void TemperNPT::command(int narg, char **arg) MPI_Send(&swap,1,MPI_INT,partner,0,universe->uworld); else MPI_Recv(&swap,1,MPI_INT,partner,0,universe->uworld,MPI_STATUS_IGNORE); -#ifdef TEMPER_DEBUG + +#if TEMPER_DEBUG if (me_universe < partner) fprintf(universe->uscreen,"SWAP %d & %d: yes = %d,Ts = %d %d, PEs = %g %g, Bz = %g %g, vol = %g %g\n", me_universe,partner,swap,my_set_temp,partner_set_temp, pe,pe_partner,boltz_factor,exp(boltz_factor), vol, vol_partner); #endif - } // bcast swap result to other procs in my world From 89d82fde22eb625bcf42cdba8d8b5d489ffddba2 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Sun, 16 Jul 2023 15:20:36 -0400 Subject: [PATCH 383/396] modernize access to list of fixes --- src/fix_wall_reflect.cpp | 9 ++++----- src/reset_atoms_id.cpp | 6 +++--- 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/src/fix_wall_reflect.cpp b/src/fix_wall_reflect.cpp index 60a055fbd6..00ef968828 100644 --- a/src/fix_wall_reflect.cpp +++ b/src/fix_wall_reflect.cpp @@ -176,12 +176,11 @@ void FixWallReflect::init() } int nrigid = 0; - for (int i = 0; i < modify->nfix; i++) - if (modify->fix[i]->rigid_flag) nrigid++; + for (const auto &ifix : modify->get_fix_list()) + if (ifix->rigid_flag) nrigid++; - if (nrigid && comm->me == 0) - error->warning(FLERR,"Should not allow rigid bodies to bounce off " - "relecting walls"); + if (nrigid && (comm->me == 0)) + error->warning(FLERR,"Should not use reflecting walls with rigid bodies"); } /* ---------------------------------------------------------------------- */ diff --git a/src/reset_atoms_id.cpp b/src/reset_atoms_id.cpp index c0fce95326..9e8ba3630d 100644 --- a/src/reset_atoms_id.cpp +++ b/src/reset_atoms_id.cpp @@ -55,9 +55,9 @@ void ResetAtomsID::command(int narg, char **arg) error->all(FLERR, "Reset_atoms id command before simulation box is defined"); if (atom->tag_enable == 0) error->all(FLERR, "Cannot use reset_atoms id unless atoms have IDs"); - for (int i = 0; i < modify->nfix; i++) - if (modify->fix[i]->stores_ids) - error->all(FLERR, "Cannot use reset_atoms id when a fix exists that stores atom IDs"); + for (const auto &ifix : modify->get_fix_list()) + if (ifix->stores_ids) + error->all(FLERR, "Cannot use reset_atoms id with a fix {} storing atom IDs", ifix->style); if (comm->me == 0) utils::logmesg(lmp, "Resetting atom IDs ...\n"); From 27aa6898f8b137d3db9e6504774f1a83f64d82fd Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Sun, 16 Jul 2023 20:05:52 -0400 Subject: [PATCH 384/396] modernize access for fixes and computes --- src/atom.cpp | 13 ++++++------- src/atom_vec_sphere.cpp | 15 +++++++++++---- src/compute_aggregate_atom.cpp | 6 ++---- src/compute_centro_atom.cpp | 8 +++----- src/compute_cluster_atom.cpp | 6 ++---- src/compute_cna_atom.cpp | 14 +++++--------- src/compute_coord_atom.cpp | 16 ++++++++++------ src/compute_erotate_sphere_atom.cpp | 7 ++----- src/compute_fragment_atom.cpp | 7 ++----- src/compute_ke_atom.cpp | 6 ++---- 10 files changed, 45 insertions(+), 53 deletions(-) diff --git a/src/atom.cpp b/src/atom.cpp index 6b014fc9c8..c4521a244e 100644 --- a/src/atom.cpp +++ b/src/atom.cpp @@ -1818,17 +1818,16 @@ void Atom::data_bodies(int n, char *buf, AtomVec *avec_body, tagint id_offset) void Atom::data_fix_compute_variable(int nprev, int nnew) { - for (const auto &fix : modify->get_fix_list()) { - if (fix->create_attribute) + for (const auto &ifix : modify->get_fix_list()) { + if (ifix->create_attribute) for (int i = nprev; i < nnew; i++) - fix->set_arrays(i); + ifix->set_arrays(i); } - for (int m = 0; m < modify->ncompute; m++) { - Compute *compute = modify->compute[m]; - if (compute->create_attribute) + for (const auto &icompute : modify->get_compute_list()) { + if (icompute->create_attribute) for (int i = nprev; i < nnew; i++) - compute->set_arrays(i); + icompute->set_arrays(i); } for (int i = nprev; i < nnew; i++) diff --git a/src/atom_vec_sphere.cpp b/src/atom_vec_sphere.cpp index d2f9c51880..27ea4b6fef 100644 --- a/src/atom_vec_sphere.cpp +++ b/src/atom_vec_sphere.cpp @@ -17,6 +17,7 @@ #include "error.h" #include "fix.h" #include "fix_adapt.h" +#include "fix_adapt_fep.h" #include "math_const.h" #include "modify.h" @@ -88,12 +89,18 @@ void AtomVecSphere::init() // check if optional radvary setting should have been set to 1 - for (int i = 0; i < modify->nfix; i++) - if (strcmp(modify->fix[i]->style, "adapt") == 0) { - auto fix = dynamic_cast(modify->fix[i]); - if (fix->diamflag && radvary == 0) + for (auto &ifix : modify->get_fix_by_style("^adapt")) { + if (utils::strmatch(ifix->style, "^adapt$")) { + auto fix = dynamic_cast(ifix); + if (fix && fix->diamflag && radvary == 0) error->all(FLERR, "Fix adapt changes particle radii but atom_style sphere is not dynamic"); } + if (utils::strmatch(ifix->style, "^adapt/fep$")) { + auto fix = dynamic_cast(ifix); + if (fix && fix->diamflag && radvary == 0) + error->all(FLERR, "Fix adapt/fep changes particle radii but atom_style sphere is not dynamic"); + } + } } /* ---------------------------------------------------------------------- diff --git a/src/compute_aggregate_atom.cpp b/src/compute_aggregate_atom.cpp index 05526494c0..e68062b73e 100644 --- a/src/compute_aggregate_atom.cpp +++ b/src/compute_aggregate_atom.cpp @@ -82,10 +82,8 @@ void ComputeAggregateAtom::init() neighbor->add_request(this, NeighConst::REQ_FULL | NeighConst::REQ_OCCASIONAL); - int count = 0; - for (int i = 0; i < modify->ncompute; i++) - if (strcmp(modify->compute[i]->style, "aggregate/atom") == 0) count++; - if (count > 1 && comm->me == 0) error->warning(FLERR, "More than one compute aggregate/atom"); + if (modify->get_compute_by_style(style).size() > 1) + if (comm->me == 0) error->warning(FLERR, "More than one compute {}", style); } /* ---------------------------------------------------------------------- */ diff --git a/src/compute_centro_atom.cpp b/src/compute_centro_atom.cpp index f726a95594..10d2a79c45 100644 --- a/src/compute_centro_atom.cpp +++ b/src/compute_centro_atom.cpp @@ -93,14 +93,12 @@ void ComputeCentroAtom::init() if (force->pair == nullptr) error->all(FLERR, "Compute centro/atom requires a pair style be defined"); - int count = 0; - for (int i = 0; i < modify->ncompute; i++) - if (strcmp(modify->compute[i]->style, "centro/atom") == 0) count++; - if (count > 1 && comm->me == 0) error->warning(FLERR, "More than one compute centro/atom"); - // need an occasional full neighbor list neighbor->add_request(this, NeighConst::REQ_FULL | NeighConst::REQ_OCCASIONAL); + + if (modify->get_compute_by_style(style).size() > 1) + if (comm->me == 0) error->warning(FLERR, "More than one compute {}", style); } /* ---------------------------------------------------------------------- */ diff --git a/src/compute_cluster_atom.cpp b/src/compute_cluster_atom.cpp index 0a0a36debd..ae44fbcd37 100644 --- a/src/compute_cluster_atom.cpp +++ b/src/compute_cluster_atom.cpp @@ -69,10 +69,8 @@ void ComputeClusterAtom::init() neighbor->add_request(this, NeighConst::REQ_FULL | NeighConst::REQ_OCCASIONAL); - int count = 0; - for (int i = 0; i < modify->ncompute; i++) - if (strcmp(modify->compute[i]->style, "cluster/atom") == 0) count++; - if (count > 1 && comm->me == 0) error->warning(FLERR, "More than one compute cluster/atom"); + if (modify->get_compute_by_style(style).size() > 1) + if (comm->me == 0) error->warning(FLERR, "More than one compute {}", style); } /* ---------------------------------------------------------------------- */ diff --git a/src/compute_cna_atom.cpp b/src/compute_cna_atom.cpp index ccb4183707..a09a671c07 100644 --- a/src/compute_cna_atom.cpp +++ b/src/compute_cna_atom.cpp @@ -76,19 +76,15 @@ void ComputeCNAAtom::init() // cannot use neighbor->cutneighmax b/c neighbor has not yet been init - if (2.0 * sqrt(cutsq) > force->pair->cutforce + neighbor->skin && comm->me == 0) - error->warning(FLERR, - "Compute cna/atom cutoff may be too large to find " - "ghost atom neighbors"); - - int count = 0; - for (int i = 0; i < modify->ncompute; i++) - if (strcmp(modify->compute[i]->style, "cna/atom") == 0) count++; - if (count > 1 && comm->me == 0) error->warning(FLERR, "More than one compute cna/atom defined"); + if ((2.0 * sqrt(cutsq)) > (force->pair->cutforce + neighbor->skin) && (comm->me == 0)) + error->warning(FLERR, "Compute cna/atom cutoff may be too large to find ghost atom neighbors"); // need an occasional full neighbor list neighbor->add_request(this, NeighConst::REQ_FULL | NeighConst::REQ_OCCASIONAL); + + if (modify->get_compute_by_style(style).size() > 1) + if (comm->me == 0) error->warning(FLERR, "More than one compute {}", style); } /* ---------------------------------------------------------------------- */ diff --git a/src/compute_coord_atom.cpp b/src/compute_coord_atom.cpp index 0d56ea6573..ea19f01b91 100644 --- a/src/compute_coord_atom.cpp +++ b/src/compute_coord_atom.cpp @@ -82,10 +82,11 @@ ComputeCoordAtom::ComputeCoordAtom(LAMMPS *lmp, int narg, char **arg) : id_orientorder = utils::strdup(arg[4]); - int iorientorder = modify->find_compute(id_orientorder); - if (iorientorder < 0) error->all(FLERR, "Could not find compute coord/atom compute ID"); - if (!utils::strmatch(modify->compute[iorientorder]->style, "^orientorder/atom")) - error->all(FLERR, "Compute coord/atom compute ID is not orientorder/atom"); + auto iorientorder = modify->get_compute_by_id(id_orientorder); + if (!iorientorder) + error->all(FLERR, "Could not find compute coord/atom compute ID {}", id_orientorder); + if (!utils::strmatch(iorientorder->style, "^orientorder/atom")) + error->all(FLERR, "Compute coord/atom compute ID {} is not orientorder/atom", id_orientorder); threshold = utils::numeric(FLERR, arg[5], false, lmp); if (threshold <= -1.0 || threshold >= 1.0) @@ -128,8 +129,11 @@ ComputeCoordAtom::~ComputeCoordAtom() void ComputeCoordAtom::init() { if (cstyle == ORIENT) { - int iorientorder = modify->find_compute(id_orientorder); - c_orientorder = dynamic_cast(modify->compute[iorientorder]); + c_orientorder = + dynamic_cast(modify->get_compute_by_id(id_orientorder)); + if (!c_orientorder) + error->all(FLERR, "Could not find compute coord/atom compute ID {}", id_orientorder); + cutsq = c_orientorder->cutsq; l = c_orientorder->qlcomp; // communicate real and imaginary 2*l+1 components of the normalized vector diff --git a/src/compute_erotate_sphere_atom.cpp b/src/compute_erotate_sphere_atom.cpp index 9bfa0afaea..3ec0f402a8 100644 --- a/src/compute_erotate_sphere_atom.cpp +++ b/src/compute_erotate_sphere_atom.cpp @@ -57,11 +57,8 @@ ComputeErotateSphereAtom::~ComputeErotateSphereAtom() void ComputeErotateSphereAtom::init() { - int count = 0; - for (int i = 0; i < modify->ncompute; i++) - if (strcmp(modify->compute[i]->style,"erotate/sphere/atom") == 0) count++; - if (count > 1 && comm->me == 0) - error->warning(FLERR,"More than one compute erotate/sphere/atom"); + if (modify->get_compute_by_style(style).size() > 1) + if (comm->me == 0) error->warning(FLERR, "More than one compute {}", style); pfactor = 0.5 * force->mvv2e * INERTIA; } diff --git a/src/compute_fragment_atom.cpp b/src/compute_fragment_atom.cpp index 810ffa4d66..035f554c8d 100644 --- a/src/compute_fragment_atom.cpp +++ b/src/compute_fragment_atom.cpp @@ -84,11 +84,8 @@ void ComputeFragmentAtom::init() if (atom->molecular != Atom::MOLECULAR) error->all(FLERR,"Compute fragment/atom requires a molecular system"); - int count = 0; - for (int i = 0; i < modify->ncompute; i++) - if (strcmp(modify->compute[i]->style,"fragment/atom") == 0) count++; - if (count > 1 && comm->me == 0) - error->warning(FLERR,"More than one compute fragment/atom"); + if (modify->get_compute_by_style(style).size() > 1) + if (comm->me == 0) error->warning(FLERR, "More than one compute {}", style); } /* ---------------------------------------------------------------------- */ diff --git a/src/compute_ke_atom.cpp b/src/compute_ke_atom.cpp index aab687755e..9a329232b3 100644 --- a/src/compute_ke_atom.cpp +++ b/src/compute_ke_atom.cpp @@ -47,10 +47,8 @@ ComputeKEAtom::~ComputeKEAtom() void ComputeKEAtom::init() { - int count = 0; - for (int i = 0; i < modify->ncompute; i++) - if (strcmp(modify->compute[i]->style, "ke/atom") == 0) count++; - if (count > 1 && comm->me == 0) error->warning(FLERR, "More than one compute ke/atom"); + if (modify->get_compute_by_style(style).size() > 1) + if (comm->me == 0) error->warning(FLERR, "More than one compute {}", style); } /* ---------------------------------------------------------------------- */ From 3568cced4bd6b5c42841a9c61ee658ae3031d325 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Mon, 17 Jul 2023 09:52:44 -0400 Subject: [PATCH 385/396] update comment --- src/REPLICA/temper.h | 2 +- src/REPLICA/temper_grem.h | 2 +- src/REPLICA/temper_npt.h | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/REPLICA/temper.h b/src/REPLICA/temper.h index d959892587..46a6666f07 100644 --- a/src/REPLICA/temper.h +++ b/src/REPLICA/temper.h @@ -40,7 +40,7 @@ class Temper : public Command { int nswaps; // # of tempering swaps to perform int seed_swap; // 0 = toggle swaps, n = RNG for swap direction int seed_boltz; // seed for Boltz factor comparison - class Fix *whichfix; // index of temperature fix to use + class Fix *whichfix; // temperature fix to use int my_set_temp; // which set temp I am simulating double *set_temp; // static list of replica set temperatures diff --git a/src/REPLICA/temper_grem.h b/src/REPLICA/temper_grem.h index c66239a794..8fe49ae804 100644 --- a/src/REPLICA/temper_grem.h +++ b/src/REPLICA/temper_grem.h @@ -40,7 +40,7 @@ class TemperGrem : public Command { int nswaps; // # of tempering swaps to perform int seed_swap; // 0 = toggle swaps, n = RNG for swap direction int seed_boltz; // seed for Boltz factor comparison - class Fix *whichfix; // index of temperature fix to use + class Fix *whichfix; // temperature fix to use int my_set_lambda; // which set lambda I am simulating double *set_lambda; // static list of replica set lambdas diff --git a/src/REPLICA/temper_npt.h b/src/REPLICA/temper_npt.h index 2e831c55ef..3ea29a21f6 100644 --- a/src/REPLICA/temper_npt.h +++ b/src/REPLICA/temper_npt.h @@ -42,7 +42,7 @@ class TemperNPT : public Command { int nswaps; // # of tempering swaps to perform int seed_swap; // 0 = toggle swaps, n = RNG for swap direction int seed_boltz; // seed for Boltz factor comparison - class Fix *whichfix; // index of temperature fix to use + class Fix *whichfix; // temperature fix to use int my_set_temp; // which set temp I am simulating double *set_temp; // static list of replica set temperatures From 1057fa9b0008345e0bd5288a4a41e23f6b0f19e6 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Mon, 17 Jul 2023 22:17:05 -0400 Subject: [PATCH 386/396] move diamflag from fix adapt and adapt/fep to base class for cleaner code --- src/BPM/atom_vec_bpm_sphere.cpp | 12 +++--------- src/FEP/fix_adapt_fep.cpp | 9 ++++----- src/FEP/fix_adapt_fep.h | 1 - src/atom_vec_sphere.cpp | 15 +++------------ src/fix.cpp | 1 + src/fix.h | 1 + src/fix_adapt.cpp | 11 +++++------ src/fix_adapt.h | 1 - 8 files changed, 17 insertions(+), 34 deletions(-) diff --git a/src/BPM/atom_vec_bpm_sphere.cpp b/src/BPM/atom_vec_bpm_sphere.cpp index 375a33c28d..9428d5e9e4 100644 --- a/src/BPM/atom_vec_bpm_sphere.cpp +++ b/src/BPM/atom_vec_bpm_sphere.cpp @@ -17,7 +17,6 @@ #include "comm.h" #include "error.h" #include "fix.h" -#include "fix_adapt.h" #include "math_const.h" #include "modify.h" @@ -99,14 +98,9 @@ void AtomVecBPMSphere::init() // check if optional radvary setting should have been set to 1 for (auto ifix : modify->get_fix_by_style("^adapt")) { - if (radvary == 0) { - if ((strcmp(ifix->style, "adapt") == 0) && (dynamic_cast(ifix)->diamflag)) - error->all(FLERR, "Fix adapt changes atom radii but atom_style bpm/sphere is not dynamic"); - // cannot properly check for fix adapt/fep since its header is optional - if ((strcmp(ifix->style, "adapt/fep") == 0) && (comm->me == 0)) - error->warning( - FLERR, "Fix adapt/fep may change atom radii but atom_style bpm/sphere is not dynamic"); - } + if (ifix->diam_flag && (radvary == 0)) + error->all(FLERR, "Fix {} changes atom radii but atom_style bpm/sphere is not dynamic", + ifix->style); } } diff --git a/src/FEP/fix_adapt_fep.cpp b/src/FEP/fix_adapt_fep.cpp index 6e38c90ef2..e050b8cf21 100644 --- a/src/FEP/fix_adapt_fep.cpp +++ b/src/FEP/fix_adapt_fep.cpp @@ -82,7 +82,6 @@ FixAdaptFEP::FixAdaptFEP(LAMMPS *lmp, int narg, char **arg) : // parse keywords nadapt = 0; - diamflag = 0; chgflag = 0; iarg = 4; @@ -114,7 +113,7 @@ FixAdaptFEP::FixAdaptFEP(LAMMPS *lmp, int narg, char **arg) : adapt[nadapt].which = ATOM; if (strcmp(arg[iarg+1],"diameter") == 0) { adapt[nadapt].aparam = DIAMETER; - diamflag = 1; + diam_flag = 1; } else if (strcmp(arg[iarg+1],"charge") == 0) { adapt[nadapt].aparam = CHARGE; chgflag = 1; @@ -201,7 +200,7 @@ int FixAdaptFEP::setmask() void FixAdaptFEP::post_constructor() { if (!resetflag) return; - if (!diamflag && !chgflag) return; + if (!diam_flag && !chgflag) return; // new id = fix-ID + FIX_STORE_ATTRIBUTE // new fix group = group for this fix @@ -209,7 +208,7 @@ void FixAdaptFEP::post_constructor() id_fix_diam = nullptr; id_fix_chg = nullptr; - if (diamflag) { + if (diam_flag) { id_fix_diam = utils::strdup(id + std::string("_FIX_STORE_DIAM")); fix_diam = dynamic_cast( modify->add_fix(fmt::format("{} {} STORE/ATOM 1 0 0 1", id_fix_diam,group->names[igroup]))); @@ -513,7 +512,7 @@ void FixAdaptFEP::restore_settings() *kspace_scale = 1.0; } else if (ad->which == ATOM) { - if (diamflag) { + if (diam_flag) { double density; double *vec = fix_diam->vstore; diff --git a/src/FEP/fix_adapt_fep.h b/src/FEP/fix_adapt_fep.h index 370a34a0f3..97749abcb6 100644 --- a/src/FEP/fix_adapt_fep.h +++ b/src/FEP/fix_adapt_fep.h @@ -26,7 +26,6 @@ namespace LAMMPS_NS { class FixAdaptFEP : public Fix { public: - int diamflag; // 1 if atom diameters will vary, for AtomVecGranular int chgflag; FixAdaptFEP(class LAMMPS *, int, char **); diff --git a/src/atom_vec_sphere.cpp b/src/atom_vec_sphere.cpp index 27ea4b6fef..5599ef4370 100644 --- a/src/atom_vec_sphere.cpp +++ b/src/atom_vec_sphere.cpp @@ -16,8 +16,6 @@ #include "atom.h" #include "error.h" #include "fix.h" -#include "fix_adapt.h" -#include "fix_adapt_fep.h" #include "math_const.h" #include "modify.h" @@ -90,16 +88,9 @@ void AtomVecSphere::init() // check if optional radvary setting should have been set to 1 for (auto &ifix : modify->get_fix_by_style("^adapt")) { - if (utils::strmatch(ifix->style, "^adapt$")) { - auto fix = dynamic_cast(ifix); - if (fix && fix->diamflag && radvary == 0) - error->all(FLERR, "Fix adapt changes particle radii but atom_style sphere is not dynamic"); - } - if (utils::strmatch(ifix->style, "^adapt/fep$")) { - auto fix = dynamic_cast(ifix); - if (fix && fix->diamflag && radvary == 0) - error->all(FLERR, "Fix adapt/fep changes particle radii but atom_style sphere is not dynamic"); - } + if (ifix->diam_flag && (radvary == 0)) + error->all(FLERR, "Fix {} changes atom radii but atom_style sphere is not dynamic", + ifix->style); } } diff --git a/src/fix.cpp b/src/fix.cpp index 82389ba433..70e4133cdd 100644 --- a/src/fix.cpp +++ b/src/fix.cpp @@ -79,6 +79,7 @@ Fix::Fix(LAMMPS *lmp, int /*narg*/, char **arg) : maxexchange_dynamic = 0; pre_exchange_migrate = 0; stores_ids = 0; + diam_flag = 0; scalar_flag = vector_flag = array_flag = 0; peratom_flag = local_flag = pergrid_flag = 0; diff --git a/src/fix.h b/src/fix.h index 30373ab6f2..5d55048c28 100644 --- a/src/fix.h +++ b/src/fix.h @@ -79,6 +79,7 @@ class Fix : protected Pointers { int maxexchange_dynamic; // 1 if fix sets maxexchange dynamically int pre_exchange_migrate; // 1 if fix migrates atoms in pre_exchange() int stores_ids; // 1 if fix stores atom IDs + int diam_flag; // 1 if fix may change partical diameter int scalar_flag; // 0/1 if compute_scalar() function exists int vector_flag; // 0/1 if compute_vector() function exists diff --git a/src/fix_adapt.cpp b/src/fix_adapt.cpp index 0b4ec9a638..660e3f6107 100644 --- a/src/fix_adapt.cpp +++ b/src/fix_adapt.cpp @@ -90,7 +90,6 @@ FixAdapt::FixAdapt(LAMMPS *lmp, int narg, char **arg) : // parse keywords nadapt = 0; - diamflag = 0; chgflag = 0; iarg = 4; @@ -149,7 +148,7 @@ FixAdapt::FixAdapt(LAMMPS *lmp, int narg, char **arg) : if (strcmp(arg[iarg+1],"diameter") == 0 || strcmp(arg[iarg+1],"diameter/disc") == 0) { adapt[nadapt].atomparam = DIAMETER; - diamflag = 1; + diam_flag = 1; discflag = 0; if (strcmp(arg[iarg+1],"diameter/disc") == 0) discflag = 1; } else if (strcmp(arg[iarg+1],"charge") == 0) { @@ -190,7 +189,7 @@ FixAdapt::FixAdapt(LAMMPS *lmp, int narg, char **arg) : // then previous step scale factors are written to restart file // initialize them here in case one is used and other is never defined - if (scaleflag && (diamflag || chgflag)) restart_global = 1; + if (scaleflag && (diam_flag || chgflag)) restart_global = 1; previous_diam_scale = previous_chg_scale = 1.0; // allocate pair style arrays @@ -260,7 +259,7 @@ int FixAdapt::setmask() void FixAdapt::post_constructor() { if (!resetflag) return; - if (!diamflag && !chgflag) return; + if (!diam_flag && !chgflag) return; // new id = fix-ID + FIX_STORE_ATTRIBUTE // new fix group = group for this fix @@ -268,7 +267,7 @@ void FixAdapt::post_constructor() id_fix_diam = nullptr; id_fix_chg = nullptr; - if (diamflag && atom->radius_flag) { + if (diam_flag && atom->radius_flag) { id_fix_diam = utils::strdup(id + std::string("_FIX_STORE_DIAM")); fix_diam = dynamic_cast( modify->add_fix(fmt::format("{} {} STORE/ATOM 1 0 0 1", id_fix_diam,group->names[igroup]))); @@ -707,7 +706,7 @@ void FixAdapt::restore_settings() *kspace_scale = 1.0; } else if (ad->which == ATOM) { - if (diamflag) { + if (diam_flag) { double scale; double *vec = fix_diam->vstore; diff --git a/src/fix_adapt.h b/src/fix_adapt.h index f8477f7259..20964a8b12 100644 --- a/src/fix_adapt.h +++ b/src/fix_adapt.h @@ -26,7 +26,6 @@ namespace LAMMPS_NS { class FixAdapt : public Fix { public: - int diamflag; // 1 if atom diameters will vary, for AtomVecGranular int chgflag; FixAdapt(class LAMMPS *, int, char **); From 7a04e048fed83f85a37b7a5122a8f0009346affc Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Tue, 18 Jul 2023 11:08:59 -0400 Subject: [PATCH 387/396] make certain radvary is initialized in constructor --- src/BPM/atom_vec_bpm_sphere.cpp | 1 + src/atom_vec_sphere.cpp | 1 + 2 files changed, 2 insertions(+) diff --git a/src/BPM/atom_vec_bpm_sphere.cpp b/src/BPM/atom_vec_bpm_sphere.cpp index 9428d5e9e4..d3070383e5 100644 --- a/src/BPM/atom_vec_bpm_sphere.cpp +++ b/src/BPM/atom_vec_bpm_sphere.cpp @@ -32,6 +32,7 @@ AtomVecBPMSphere::AtomVecBPMSphere(LAMMPS *_lmp) : AtomVec(_lmp) mass_type = PER_ATOM; molecular = Atom::MOLECULAR; bonds_allow = 1; + radvary = 0; atom->molecule_flag = 1; atom->sphere_flag = 1; diff --git a/src/atom_vec_sphere.cpp b/src/atom_vec_sphere.cpp index 5599ef4370..5a98d78abc 100644 --- a/src/atom_vec_sphere.cpp +++ b/src/atom_vec_sphere.cpp @@ -30,6 +30,7 @@ AtomVecSphere::AtomVecSphere(LAMMPS *lmp) : AtomVec(lmp) { mass_type = PER_ATOM; molecular = Atom::ATOMIC; + radvary = 0; atom->sphere_flag = 1; atom->radius_flag = atom->rmass_flag = atom->omega_flag = atom->torque_flag = 1; From cea202ebe90a13d5bf4277f61366576e0805ff9d Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Tue, 18 Jul 2023 11:09:09 -0400 Subject: [PATCH 388/396] include file is not needed --- src/KOKKOS/atom_vec_sphere_kokkos.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/src/KOKKOS/atom_vec_sphere_kokkos.cpp b/src/KOKKOS/atom_vec_sphere_kokkos.cpp index a9b64fc835..5a1c2beee3 100644 --- a/src/KOKKOS/atom_vec_sphere_kokkos.cpp +++ b/src/KOKKOS/atom_vec_sphere_kokkos.cpp @@ -20,7 +20,6 @@ #include "domain.h" #include "error.h" #include "fix.h" -#include "fix_adapt.h" #include "math_const.h" #include "memory.h" #include "memory_kokkos.h" From 2e2624d719ebbe4b5ffba0b0dec65deb1b069070 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Tue, 18 Jul 2023 11:10:18 -0400 Subject: [PATCH 389/396] update loop over adapt fixes logic --- src/BPM/atom_vec_bpm_sphere.cpp | 11 ++++++----- src/atom_vec_sphere.cpp | 11 ++++++----- 2 files changed, 12 insertions(+), 10 deletions(-) diff --git a/src/BPM/atom_vec_bpm_sphere.cpp b/src/BPM/atom_vec_bpm_sphere.cpp index d3070383e5..2820a74c8a 100644 --- a/src/BPM/atom_vec_bpm_sphere.cpp +++ b/src/BPM/atom_vec_bpm_sphere.cpp @@ -98,11 +98,12 @@ void AtomVecBPMSphere::init() // check if optional radvary setting should have been set to 1 - for (auto ifix : modify->get_fix_by_style("^adapt")) { - if (ifix->diam_flag && (radvary == 0)) - error->all(FLERR, "Fix {} changes atom radii but atom_style bpm/sphere is not dynamic", - ifix->style); - } + if (radvary == 0) + for (const auto &ifix : modify->get_fix_by_style("^adapt")) { + if (ifix->diam_flag) + error->all(FLERR, "Fix {} changes atom radii but atom_style bpm/sphere is not dynamic", + ifix->style); + } } /* ---------------------------------------------------------------------- diff --git a/src/atom_vec_sphere.cpp b/src/atom_vec_sphere.cpp index 5a98d78abc..8769c316d9 100644 --- a/src/atom_vec_sphere.cpp +++ b/src/atom_vec_sphere.cpp @@ -88,11 +88,12 @@ void AtomVecSphere::init() // check if optional radvary setting should have been set to 1 - for (auto &ifix : modify->get_fix_by_style("^adapt")) { - if (ifix->diam_flag && (radvary == 0)) - error->all(FLERR, "Fix {} changes atom radii but atom_style sphere is not dynamic", - ifix->style); - } + if (radvary == 0) + for (const auto &ifix : modify->get_fix_by_style("^adapt")) { + if (ifix->diam_flag) + error->all(FLERR, "Fix {} changes atom radii but atom_style sphere is not dynamic", + ifix->style); + } } /* ---------------------------------------------------------------------- From 7d46165c2a935b18a96bee124ccbe6a762ac7907 Mon Sep 17 00:00:00 2001 From: Stan Gerald Moore Date: Thu, 20 Jul 2023 13:31:34 -0600 Subject: [PATCH 390/396] Fix compile bug in Kokkos MEAM styles --- src/KOKKOS/pair_meam_kokkos.cpp | 2 +- src/KOKKOS/pair_meam_ms_kokkos.cpp | 2 +- src/KOKKOS/pppm_kokkos.h | 15 ++++++++++++++- 3 files changed, 16 insertions(+), 3 deletions(-) diff --git a/src/KOKKOS/pair_meam_kokkos.cpp b/src/KOKKOS/pair_meam_kokkos.cpp index c2b03c2054..daf9c1e18b 100644 --- a/src/KOKKOS/pair_meam_kokkos.cpp +++ b/src/KOKKOS/pair_meam_kokkos.cpp @@ -980,7 +980,7 @@ void PairMEAMKokkos::update_meam_views() namespace LAMMPS_NS { template class PairMEAMKokkos; -#ifdef KOKKOS_ENABLE_CUDA +#ifdef LMP_KOKKOS_GPU template class PairMEAMKokkos; #endif } diff --git a/src/KOKKOS/pair_meam_ms_kokkos.cpp b/src/KOKKOS/pair_meam_ms_kokkos.cpp index 491fc0273c..eaa7d500b9 100644 --- a/src/KOKKOS/pair_meam_ms_kokkos.cpp +++ b/src/KOKKOS/pair_meam_ms_kokkos.cpp @@ -26,7 +26,7 @@ PairMEAMMSKokkos::PairMEAMMSKokkos(LAMMPS *lmp) : PairMEAMKokkos; -#ifdef KOKKOS_ENABLE_CUDA +#ifdef LMP_KOKKOS_GPU template class PairMEAMMSKokkos; #endif } diff --git a/src/KOKKOS/pppm_kokkos.h b/src/KOKKOS/pppm_kokkos.h index 2c6dcc4e15..d621313873 100644 --- a/src/KOKKOS/pppm_kokkos.h +++ b/src/KOKKOS/pppm_kokkos.h @@ -33,7 +33,7 @@ KSpaceStyle(pppm/kk/host,PPPMKokkos); // clang-format off -// fix up FFT defines for KOKKOS with CUDA +// fix up FFT defines for KOKKOS with CUDA and HIP #ifdef KOKKOS_ENABLE_CUDA # if defined(FFT_FFTW) @@ -48,6 +48,19 @@ KSpaceStyle(pppm/kk/host,PPPMKokkos); # if !defined(FFT_CUFFT) && !defined(FFT_KISSFFT) # define FFT_KISSFFT # endif +#elif defined(KOKKOS_ENABLE_HIP) +# if defined(FFT_FFTW) +# undef FFT_FFTW +# endif +# if defined(FFT_FFTW3) +# undef FFT_FFTW3 +# endif +# if defined(FFT_MKL) +# undef FFT_MKL +# endif +# if !defined(FFT_HIPFFT) && !defined(FFT_KISSFFT) +# define FFT_KISSFFT +# endif #endif #include "pppm.h" From 6c6258371b774b2f44b75adb5a574dcde9d3f75e Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Thu, 20 Jul 2023 20:31:16 -0400 Subject: [PATCH 391/396] add init_flags() and is_initialized() methods --- src/compute.cpp | 10 ++++++++++ src/compute.h | 6 +++++- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/src/compute.cpp b/src/compute.cpp index dcad4954fc..2bd1544fd7 100644 --- a/src/compute.cpp +++ b/src/compute.cpp @@ -74,6 +74,7 @@ Compute::Compute(LAMMPS *lmp, int narg, char **arg) : dynamic = 0; dynamic_group_allow = 1; + initialized_flag = 0; invoked_scalar = invoked_vector = invoked_array = -1; invoked_peratom = invoked_local = -1; invoked_flag = INVOKED_NONE; @@ -111,6 +112,15 @@ Compute::~Compute() /* ---------------------------------------------------------------------- */ +void Compute::init_flags() +{ + initialized_flag = 1; + invoked_scalar = invoked_vector = invoked_array = -1; + invoked_peratom = invoked_local = -1; +} + +/* ---------------------------------------------------------------------- */ + void Compute::modify_params(int narg, char **arg) { if (narg == 0) error->all(FLERR,"Illegal compute_modify command"); diff --git a/src/compute.h b/src/compute.h index 72b0075fd6..8ae01a4469 100644 --- a/src/compute.h +++ b/src/compute.h @@ -62,7 +62,7 @@ class Compute : protected Pointers { int size_local_rows; // rows in local vector or array int size_local_cols; // 0 = vector, N = columns in local array - int pergrid_flag; // 0/1 if compute_pergrid() function exists + int pergrid_flag; // 0/1 if compute_pergrid() function exists int extscalar; // 0/1 if global scalar is intensive/extensive int extvector; // 0/1/-1 if global vector is all int/ext/extlist @@ -88,6 +88,7 @@ class Compute : protected Pointers { int maxtime; // max # of entries time list can hold bigint *tlist; // list of timesteps the Compute is called on + int initialized_flag; // 1 if compute is initialized, 0 if not int invoked_flag; // non-zero if invoked or accessed this step, 0 if not bigint invoked_scalar; // last timestep on which compute_scalar() was invoked bigint invoked_vector; // ditto for compute_vector() @@ -114,6 +115,7 @@ class Compute : protected Pointers { void modify_params(int, char **); virtual void reset_extra_dof(); + void init_flags(); virtual void init() = 0; virtual void init_list(int, class NeighList *) {} virtual void setup() {} @@ -161,6 +163,8 @@ class Compute : protected Pointers { int matchstep(bigint); void clearstep(); + bool is_initialized() const { return initialized_flag == 1; } + virtual double memory_usage() { return 0.0; } virtual void pair_setup_callback(int, int) {} From c7996b506a4f0f1663cf039dffac7051aeff51f0 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Thu, 20 Jul 2023 20:31:48 -0400 Subject: [PATCH 392/396] make use of Compute::is_initialized() and Compute::init_flags() --- src/modify.cpp | 6 +----- src/thermo.cpp | 16 ++++++++-------- src/variable.cpp | 44 ++++++++++++++++++++++---------------------- 3 files changed, 31 insertions(+), 35 deletions(-) diff --git a/src/modify.cpp b/src/modify.cpp index d0656d3895..427c4e259b 100644 --- a/src/modify.cpp +++ b/src/modify.cpp @@ -191,11 +191,7 @@ void Modify::init() for (i = 0; i < ncompute; i++) { compute[i]->init(); - compute[i]->invoked_scalar = -1; - compute[i]->invoked_vector = -1; - compute[i]->invoked_array = -1; - compute[i]->invoked_peratom = -1; - compute[i]->invoked_local = -1; + compute[i]->init_flags(); } addstep_compute_all(update->ntimestep); diff --git a/src/thermo.cpp b/src/thermo.cpp index 6122edec83..bdf2b8cf7b 100644 --- a/src/thermo.cpp +++ b/src/thermo.cpp @@ -1134,8 +1134,8 @@ void Thermo::check_temp(const std::string &keyword) if (!temperature) error->all(FLERR, "Thermo keyword {} in variable requires thermo to use/init temperature", keyword); - if (update->first_update == 0) - error->all(FLERR,"Thermo keyword {} cannot be invoked before first run",keyword); + if (!temperature->is_initialized()) + error->all(FLERR,"Thermo keyword {} cannot be invoked before initialized by run",keyword); if (!(temperature->invoked_flag & Compute::INVOKED_SCALAR)) { temperature->compute_scalar(); temperature->invoked_flag |= Compute::INVOKED_SCALAR; @@ -1153,8 +1153,8 @@ void Thermo::check_pe(const std::string &keyword) if (!pe) error->all(FLERR, "Thermo keyword {} in variable requires thermo to use/init potential energy", keyword); - if (update->first_update == 0) - error->all(FLERR,"Thermo keyword {} cannot be invoked before first run",keyword); + if (!pe->is_initialized()) + error->all(FLERR,"Thermo keyword {} cannot be invoked before initialized by run",keyword); if (!(pe->invoked_flag & Compute::INVOKED_SCALAR)) { pe->compute_scalar(); pe->invoked_flag |= Compute::INVOKED_SCALAR; @@ -1169,8 +1169,8 @@ void Thermo::check_press_scalar(const std::string &keyword) { if (!pressure) error->all(FLERR, "Thermo keyword {} in variable requires thermo to use/init press", keyword); - if (update->first_update == 0) - error->all(FLERR,"Thermo keyword {} cannot be invoked before first run",keyword); + if (!pressure->is_initialized()) + error->all(FLERR,"Thermo keyword {} cannot be invoked before initialized by run",keyword); if (!(pressure->invoked_flag & Compute::INVOKED_SCALAR)) { pressure->compute_scalar(); pressure->invoked_flag |= Compute::INVOKED_SCALAR; @@ -1185,8 +1185,8 @@ void Thermo::check_press_vector(const std::string &keyword) { if (!pressure) error->all(FLERR, "Thermo keyword {} in variable requires thermo to use/init press", keyword); - if (update->first_update == 0) - error->all(FLERR,"Thermo keyword {} cannot be invoked before first run",keyword); + if (!pressure->is_initialized()) + error->all(FLERR,"Thermo keyword {} cannot be invoked before initialized by run",keyword); if (!(pressure->invoked_flag & Compute::INVOKED_VECTOR)) { pressure->compute_vector(); pressure->invoked_flag |= Compute::INVOKED_VECTOR; diff --git a/src/variable.cpp b/src/variable.cpp index 3264cfa1ee..7cbd43b7c6 100644 --- a/src/variable.cpp +++ b/src/variable.cpp @@ -1505,8 +1505,8 @@ double Variable::evaluate(char *str, Tree **tree, int ivar) if (nbracket == 0 && compute->scalar_flag && lowercase) { - if (update->first_update == 0) - print_var_error(FLERR,"Variable formula compute cannot be invoked before first run",ivar); + if (!compute->is_initialized()) + print_var_error(FLERR,"Variable formula compute cannot be invoked before initialized by run",ivar); if (!(compute->invoked_flag & Compute::INVOKED_SCALAR)) { compute->compute_scalar(); compute->invoked_flag |= Compute::INVOKED_SCALAR; @@ -1527,8 +1527,8 @@ double Variable::evaluate(char *str, Tree **tree, int ivar) if (index1 > compute->size_vector && compute->size_vector_variable == 0) print_var_error(FLERR,"Variable formula compute vector is accessed out-of-range",ivar,0); - if (update->first_update == 0) - print_var_error(FLERR,"Variable formula compute cannot be invoked before first run",ivar); + if (!compute->is_initialized()) + print_var_error(FLERR,"Variable formula compute cannot be invoked before initialized by run",ivar); if (!(compute->invoked_flag & Compute::INVOKED_VECTOR)) { compute->compute_vector(); compute->invoked_flag |= Compute::INVOKED_VECTOR; @@ -1553,8 +1553,8 @@ double Variable::evaluate(char *str, Tree **tree, int ivar) print_var_error(FLERR,"Variable formula compute array is accessed out-of-range",ivar,0); if (index2 > compute->size_array_cols) print_var_error(FLERR,"Variable formula compute array is accessed out-of-range",ivar,0); - if (update->first_update == 0) - print_var_error(FLERR,"Variable formula compute cannot be invoked before first run",ivar); + if (!compute->is_initialized()) + print_var_error(FLERR,"Variable formula compute cannot be invoked before initialized by run",ivar); if (!(compute->invoked_flag & Compute::INVOKED_ARRAY)) { compute->compute_array(); compute->invoked_flag |= Compute::INVOKED_ARRAY; @@ -1580,8 +1580,8 @@ double Variable::evaluate(char *str, Tree **tree, int ivar) print_var_error(FLERR,"Compute global vector in atom-style variable formula",ivar); if (compute->size_vector == 0) print_var_error(FLERR,"Variable formula compute vector is zero length",ivar); - if (update->first_update == 0) - print_var_error(FLERR,"Variable formula compute cannot be invoked before first run",ivar); + if (!compute->is_initialized()) + print_var_error(FLERR,"Variable formula compute cannot be invoked before initialized by run",ivar); if (!(compute->invoked_flag & Compute::INVOKED_VECTOR)) { compute->compute_vector(); compute->invoked_flag |= Compute::INVOKED_VECTOR; @@ -1604,8 +1604,8 @@ double Variable::evaluate(char *str, Tree **tree, int ivar) print_var_error(FLERR,"Compute global vector in atom-style variable formula",ivar); if (compute->size_array_rows == 0) print_var_error(FLERR,"Variable formula compute array is zero length",ivar); - if (update->first_update == 0) - print_var_error(FLERR,"Variable formula compute cannot be invoked before first run",ivar); + if (!compute->is_initialized()) + print_var_error(FLERR,"Variable formula compute cannot be invoked before initialized by run",ivar); if (!(compute->invoked_flag & Compute::INVOKED_ARRAY)) { compute->compute_array(); compute->invoked_flag |= Compute::INVOKED_ARRAY; @@ -1623,8 +1623,8 @@ double Variable::evaluate(char *str, Tree **tree, int ivar) } else if (nbracket == 1 && compute->peratom_flag && compute->size_peratom_cols == 0) { - if (update->first_update == 0) - print_var_error(FLERR,"Variable formula compute cannot be invoked before first run",ivar); + if (!compute->is_initialized()) + print_var_error(FLERR,"Variable formula compute cannot be invoked before initialized by run",ivar); if (!(compute->invoked_flag & Compute::INVOKED_PERATOM)) { compute->compute_peratom(); compute->invoked_flag |= Compute::INVOKED_PERATOM; @@ -1640,8 +1640,8 @@ double Variable::evaluate(char *str, Tree **tree, int ivar) if (index2 > compute->size_peratom_cols) print_var_error(FLERR,"Variable formula compute array is accessed out-of-range",ivar,0); - if (update->first_update == 0) - print_var_error(FLERR,"Variable formula compute cannot be invoked before first run",ivar); + if (!compute->is_initialized()) + print_var_error(FLERR,"Variable formula compute cannot be invoked before initialized by run",ivar); if (!(compute->invoked_flag & Compute::INVOKED_PERATOM)) { compute->compute_peratom(); compute->invoked_flag |= Compute::INVOKED_PERATOM; @@ -1663,8 +1663,8 @@ double Variable::evaluate(char *str, Tree **tree, int ivar) print_var_error(FLERR,"Per-atom compute in equal-style variable formula",ivar); if (treetype == VECTOR) print_var_error(FLERR,"Per-atom compute in vector-style variable formula",ivar); - if (update->first_update == 0) - print_var_error(FLERR,"Variable formula compute cannot be invoked before first run",ivar); + if (!compute->is_initialized()) + print_var_error(FLERR,"Variable formula compute cannot be invoked before initialized by run",ivar); if (!(compute->invoked_flag & Compute::INVOKED_PERATOM)) { compute->compute_peratom(); compute->invoked_flag |= Compute::INVOKED_PERATOM; @@ -1687,8 +1687,8 @@ double Variable::evaluate(char *str, Tree **tree, int ivar) print_var_error(FLERR,"Per-atom compute in vector-style variable formula",ivar); if (index1 > compute->size_peratom_cols) print_var_error(FLERR,"Variable formula compute array is accessed out-of-range",ivar,0); - if (update->first_update == 0) - print_var_error(FLERR,"Variable formula compute cannot be invoked before first run",ivar); + if (!compute->is_initialized()) + print_var_error(FLERR,"Variable formula compute cannot be invoked before initialized by run",ivar); if (!(compute->invoked_flag & Compute::INVOKED_PERATOM)) { compute->compute_peratom(); compute->invoked_flag |= Compute::INVOKED_PERATOM; @@ -4163,8 +4163,8 @@ int Variable::special_function(char *word, char *contents, Tree **tree, Tree **t print_var_error(FLERR,mesg,ivar); } if (index == 0 && compute->vector_flag) { - if (update->first_update == 0) - print_var_error(FLERR,"Variable formula compute cannot be invoked before first run",ivar); + if (!compute->is_initialized()) + print_var_error(FLERR,"Variable formula compute cannot be invoked before initialized by run",ivar); if (!(compute->invoked_flag & Compute::INVOKED_VECTOR)) { compute->compute_vector(); compute->invoked_flag |= Compute::INVOKED_VECTOR; @@ -4174,8 +4174,8 @@ int Variable::special_function(char *word, char *contents, Tree **tree, Tree **t } else if (index && compute->array_flag) { if (index > compute->size_array_cols) print_var_error(FLERR,"Variable formula compute array is accessed out-of-range",ivar,0); - if (update->first_update == 0) - print_var_error(FLERR,"Variable formula compute cannot be invoked before first run",ivar); + if (!compute->is_initialized()) + print_var_error(FLERR,"Variable formula compute cannot be invoked before initialized by run",ivar); if (!(compute->invoked_flag & Compute::INVOKED_ARRAY)) { compute->compute_array(); compute->invoked_flag |= Compute::INVOKED_ARRAY; From 78880c909915f00b44c4efb52e9da7ae8695a56f Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Thu, 20 Jul 2023 21:28:45 -0400 Subject: [PATCH 393/396] update reset_atoms image to call Compute::init_flag() as a workaround --- src/reset_atoms_image.cpp | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/src/reset_atoms_image.cpp b/src/reset_atoms_image.cpp index d39ea0fec1..7e9dd45a17 100644 --- a/src/reset_atoms_image.cpp +++ b/src/reset_atoms_image.cpp @@ -93,15 +93,16 @@ void ResetAtomsImage::command(int narg, char **arg) "c_ifmax_r_i_f[*] c_ifmin_r_i_f[*]"); // trigger computes - // need to ensure update->first_update = 1 - // to allow this input script command prior to first run/minimize - // this is b/c internal variables are evaulated which invoke computes - // that will trigger an error unless first_update = 1 - // reset update->first_update when done - - int first_update_saved = update->first_update; - update->first_update = 1; + // need to first initialize compute flags to allow this input script command prior + // to a first run/minimize. this is b/c internal variables are evaulated which + // invoke computes that will trigger an error unless they are initialized + frags->init_flags(); + chunk->init_flags(); + flags->init_flags(); + ifmin->init_flags(); + ifmax->init_flags(); + cdist->init_flags(); frags->compute_peratom(); chunk->compute_peratom(); flags->compute_peratom(); @@ -109,8 +110,6 @@ void ResetAtomsImage::command(int narg, char **arg) ifmax->compute_array(); cdist->compute_peratom(); - update->first_update = first_update_saved; - // reset image flags for atoms in group const int *const mask = atom->mask; From 0b57ea246c536e0d3594e5f2e526fefe876734ae Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Thu, 20 Jul 2023 21:48:51 -0400 Subject: [PATCH 394/396] update dump styles to use Compute::is_initialized() --- src/VTK/dump_vtk.cpp | 5 +++-- src/dump_custom.cpp | 5 +++-- src/dump_grid.cpp | 5 +++-- src/dump_image.cpp | 5 +++-- src/dump_local.cpp | 5 +++-- 5 files changed, 15 insertions(+), 10 deletions(-) diff --git a/src/VTK/dump_vtk.cpp b/src/VTK/dump_vtk.cpp index a77f5b2e11..00bd451fb0 100644 --- a/src/VTK/dump_vtk.cpp +++ b/src/VTK/dump_vtk.cpp @@ -297,9 +297,10 @@ int DumpVTK::count() // cannot invoke before first run, otherwise invoke if necessary if (ncompute) { - if (update->first_update == 0) - error->all(FLERR,"Dump compute cannot be invoked before first run"); for (i = 0; i < ncompute; i++) { + if (!compute[i]->is_initialized()) + error->all(FLERR,"Dump compute ID {} cannot be invoked before initialized by a run", + compute[i]->id); if (!(compute[i]->invoked_flag & Compute::INVOKED_PERATOM)) { compute[i]->compute_peratom(); compute[i]->invoked_flag |= Compute::INVOKED_PERATOM; diff --git a/src/dump_custom.cpp b/src/dump_custom.cpp index dba72c7478..570ddd104f 100644 --- a/src/dump_custom.cpp +++ b/src/dump_custom.cpp @@ -562,9 +562,10 @@ int DumpCustom::count() // cannot invoke before first run, otherwise invoke if necessary if (ncompute) { - if (update->first_update == 0) - error->all(FLERR,"Dump compute cannot be invoked before first run"); for (i = 0; i < ncompute; i++) { + if (!compute[i]->is_initialized()) + error->all(FLERR,"Dump compute ID {} cannot be invoked before initialized by a run", + compute[i]->id); if (!(compute[i]->invoked_flag & Compute::INVOKED_PERATOM)) { compute[i]->compute_peratom(); compute[i]->invoked_flag |= Compute::INVOKED_PERATOM; diff --git a/src/dump_grid.cpp b/src/dump_grid.cpp index 39d80ade11..24f2586568 100644 --- a/src/dump_grid.cpp +++ b/src/dump_grid.cpp @@ -527,9 +527,10 @@ int DumpGrid::count() // cannot invoke before first run, otherwise invoke if necessary if (ncompute) { - if (update->first_update == 0) - error->all(FLERR,"Dump compute cannot be invoked before first run"); for (i = 0; i < ncompute; i++) { + if (!compute[i]->is_initialized()) + error->all(FLERR,"Dump compute ID {} cannot be invoked before initialized by a run", + compute[i]->id); if (!(compute[i]->invoked_flag & Compute::INVOKED_PERGRID)) { compute[i]->compute_pergrid(); compute[i]->invoked_flag |= Compute::INVOKED_PERGRID; diff --git a/src/dump_image.cpp b/src/dump_image.cpp index 0d54c60595..530e19a04c 100644 --- a/src/dump_image.cpp +++ b/src/dump_image.cpp @@ -667,8 +667,9 @@ void DumpImage::write() // cannot invoke before first run, otherwise invoke if necessary if (grid_compute) { - if (update->first_update == 0) - error->all(FLERR,"Grid compute used in dump image cannot be invoked before first run"); + if (!grid_compute->is_initialized()) + error->all(FLERR,"Grid compute ID {} used in dump image cannot be invoked " + "before initialized by a run", grid_compute->id); if (!(grid_compute->invoked_flag & Compute::INVOKED_PERGRID)) { grid_compute->compute_pergrid(); grid_compute->invoked_flag |= Compute::INVOKED_PERGRID; diff --git a/src/dump_local.cpp b/src/dump_local.cpp index 097589ea41..e81ab0590f 100644 --- a/src/dump_local.cpp +++ b/src/dump_local.cpp @@ -328,9 +328,10 @@ int DumpLocal::count() // cannot invoke before first run, otherwise invoke if necessary if (ncompute) { - if (update->first_update == 0) - error->all(FLERR,"Dump compute cannot be invoked before first run"); for (i = 0; i < ncompute; i++) { + if (!compute[i]->is_initialized()) + error->all(FLERR,"Dump compute ID {} cannot be invoked before initialized by a run", + compute[i]->id); if (!(compute[i]->invoked_flag & Compute::INVOKED_LOCAL)) { compute[i]->compute_local(); compute[i]->invoked_flag |= Compute::INVOKED_LOCAL; From 2da908190bd34dca2791e58e96bb2354c85f7484 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Fri, 21 Jul 2023 11:24:57 -0400 Subject: [PATCH 395/396] make error messages consistent and improve their grammar --- src/VTK/dump_vtk.cpp | 2 +- src/dump_custom.cpp | 2 +- src/dump_grid.cpp | 2 +- src/dump_image.cpp | 2 +- src/dump_local.cpp | 2 +- src/thermo.cpp | 8 ++++---- src/variable.cpp | 33 ++++++++++++++++++++++----------- 7 files changed, 31 insertions(+), 20 deletions(-) diff --git a/src/VTK/dump_vtk.cpp b/src/VTK/dump_vtk.cpp index 00bd451fb0..172a092629 100644 --- a/src/VTK/dump_vtk.cpp +++ b/src/VTK/dump_vtk.cpp @@ -299,7 +299,7 @@ int DumpVTK::count() if (ncompute) { for (i = 0; i < ncompute; i++) { if (!compute[i]->is_initialized()) - error->all(FLERR,"Dump compute ID {} cannot be invoked before initialized by a run", + error->all(FLERR,"Dump compute ID {} cannot be invoked before initialization by a run", compute[i]->id); if (!(compute[i]->invoked_flag & Compute::INVOKED_PERATOM)) { compute[i]->compute_peratom(); diff --git a/src/dump_custom.cpp b/src/dump_custom.cpp index 570ddd104f..1e60295bbe 100644 --- a/src/dump_custom.cpp +++ b/src/dump_custom.cpp @@ -564,7 +564,7 @@ int DumpCustom::count() if (ncompute) { for (i = 0; i < ncompute; i++) { if (!compute[i]->is_initialized()) - error->all(FLERR,"Dump compute ID {} cannot be invoked before initialized by a run", + error->all(FLERR,"Dump compute ID {} cannot be invoked before initialization by a run", compute[i]->id); if (!(compute[i]->invoked_flag & Compute::INVOKED_PERATOM)) { compute[i]->compute_peratom(); diff --git a/src/dump_grid.cpp b/src/dump_grid.cpp index 24f2586568..3c10aa9083 100644 --- a/src/dump_grid.cpp +++ b/src/dump_grid.cpp @@ -529,7 +529,7 @@ int DumpGrid::count() if (ncompute) { for (i = 0; i < ncompute; i++) { if (!compute[i]->is_initialized()) - error->all(FLERR,"Dump compute ID {} cannot be invoked before initialized by a run", + error->all(FLERR,"Dump compute ID {} cannot be invoked before initialization by a run", compute[i]->id); if (!(compute[i]->invoked_flag & Compute::INVOKED_PERGRID)) { compute[i]->compute_pergrid(); diff --git a/src/dump_image.cpp b/src/dump_image.cpp index 530e19a04c..1ba433f93f 100644 --- a/src/dump_image.cpp +++ b/src/dump_image.cpp @@ -669,7 +669,7 @@ void DumpImage::write() if (grid_compute) { if (!grid_compute->is_initialized()) error->all(FLERR,"Grid compute ID {} used in dump image cannot be invoked " - "before initialized by a run", grid_compute->id); + "before initialization by a run", grid_compute->id); if (!(grid_compute->invoked_flag & Compute::INVOKED_PERGRID)) { grid_compute->compute_pergrid(); grid_compute->invoked_flag |= Compute::INVOKED_PERGRID; diff --git a/src/dump_local.cpp b/src/dump_local.cpp index e81ab0590f..9695e152b2 100644 --- a/src/dump_local.cpp +++ b/src/dump_local.cpp @@ -330,7 +330,7 @@ int DumpLocal::count() if (ncompute) { for (i = 0; i < ncompute; i++) { if (!compute[i]->is_initialized()) - error->all(FLERR,"Dump compute ID {} cannot be invoked before initialized by a run", + error->all(FLERR,"Dump compute ID {} cannot be invoked before initialization by a run", compute[i]->id); if (!(compute[i]->invoked_flag & Compute::INVOKED_LOCAL)) { compute[i]->compute_local(); diff --git a/src/thermo.cpp b/src/thermo.cpp index bdf2b8cf7b..a8442d42db 100644 --- a/src/thermo.cpp +++ b/src/thermo.cpp @@ -1135,7 +1135,7 @@ void Thermo::check_temp(const std::string &keyword) error->all(FLERR, "Thermo keyword {} in variable requires thermo to use/init temperature", keyword); if (!temperature->is_initialized()) - error->all(FLERR,"Thermo keyword {} cannot be invoked before initialized by run",keyword); + error->all(FLERR,"Thermo keyword {} cannot be invoked before initialization by a run",keyword); if (!(temperature->invoked_flag & Compute::INVOKED_SCALAR)) { temperature->compute_scalar(); temperature->invoked_flag |= Compute::INVOKED_SCALAR; @@ -1154,7 +1154,7 @@ void Thermo::check_pe(const std::string &keyword) error->all(FLERR, "Thermo keyword {} in variable requires thermo to use/init potential energy", keyword); if (!pe->is_initialized()) - error->all(FLERR,"Thermo keyword {} cannot be invoked before initialized by run",keyword); + error->all(FLERR,"Thermo keyword {} cannot be invoked before initialization by a run",keyword); if (!(pe->invoked_flag & Compute::INVOKED_SCALAR)) { pe->compute_scalar(); pe->invoked_flag |= Compute::INVOKED_SCALAR; @@ -1170,7 +1170,7 @@ void Thermo::check_press_scalar(const std::string &keyword) if (!pressure) error->all(FLERR, "Thermo keyword {} in variable requires thermo to use/init press", keyword); if (!pressure->is_initialized()) - error->all(FLERR,"Thermo keyword {} cannot be invoked before initialized by run",keyword); + error->all(FLERR,"Thermo keyword {} cannot be invoked before initialization by a run",keyword); if (!(pressure->invoked_flag & Compute::INVOKED_SCALAR)) { pressure->compute_scalar(); pressure->invoked_flag |= Compute::INVOKED_SCALAR; @@ -1186,7 +1186,7 @@ void Thermo::check_press_vector(const std::string &keyword) if (!pressure) error->all(FLERR, "Thermo keyword {} in variable requires thermo to use/init press", keyword); if (!pressure->is_initialized()) - error->all(FLERR,"Thermo keyword {} cannot be invoked before initialized by run",keyword); + error->all(FLERR,"Thermo keyword {} cannot be invoked before initialization by a run",keyword); if (!(pressure->invoked_flag & Compute::INVOKED_VECTOR)) { pressure->compute_vector(); pressure->invoked_flag |= Compute::INVOKED_VECTOR; diff --git a/src/variable.cpp b/src/variable.cpp index 7cbd43b7c6..cf2e5c3b6f 100644 --- a/src/variable.cpp +++ b/src/variable.cpp @@ -1506,7 +1506,8 @@ double Variable::evaluate(char *str, Tree **tree, int ivar) if (nbracket == 0 && compute->scalar_flag && lowercase) { if (!compute->is_initialized()) - print_var_error(FLERR,"Variable formula compute cannot be invoked before initialized by run",ivar); + print_var_error(FLERR,"Variable formula compute cannot be invoked before " + "initialization by a run",ivar); if (!(compute->invoked_flag & Compute::INVOKED_SCALAR)) { compute->compute_scalar(); compute->invoked_flag |= Compute::INVOKED_SCALAR; @@ -1528,7 +1529,8 @@ double Variable::evaluate(char *str, Tree **tree, int ivar) compute->size_vector_variable == 0) print_var_error(FLERR,"Variable formula compute vector is accessed out-of-range",ivar,0); if (!compute->is_initialized()) - print_var_error(FLERR,"Variable formula compute cannot be invoked before initialized by run",ivar); + print_var_error(FLERR,"Variable formula compute cannot be invoked before " + "initialization by a run",ivar); if (!(compute->invoked_flag & Compute::INVOKED_VECTOR)) { compute->compute_vector(); compute->invoked_flag |= Compute::INVOKED_VECTOR; @@ -1554,7 +1556,8 @@ double Variable::evaluate(char *str, Tree **tree, int ivar) if (index2 > compute->size_array_cols) print_var_error(FLERR,"Variable formula compute array is accessed out-of-range",ivar,0); if (!compute->is_initialized()) - print_var_error(FLERR,"Variable formula compute cannot be invoked before initialized by run",ivar); + print_var_error(FLERR,"Variable formula compute cannot be invoked before " + "initialization by a run",ivar); if (!(compute->invoked_flag & Compute::INVOKED_ARRAY)) { compute->compute_array(); compute->invoked_flag |= Compute::INVOKED_ARRAY; @@ -1581,7 +1584,8 @@ double Variable::evaluate(char *str, Tree **tree, int ivar) if (compute->size_vector == 0) print_var_error(FLERR,"Variable formula compute vector is zero length",ivar); if (!compute->is_initialized()) - print_var_error(FLERR,"Variable formula compute cannot be invoked before initialized by run",ivar); + print_var_error(FLERR,"Variable formula compute cannot be invoked before " + "initialization by a run",ivar); if (!(compute->invoked_flag & Compute::INVOKED_VECTOR)) { compute->compute_vector(); compute->invoked_flag |= Compute::INVOKED_VECTOR; @@ -1605,7 +1609,8 @@ double Variable::evaluate(char *str, Tree **tree, int ivar) if (compute->size_array_rows == 0) print_var_error(FLERR,"Variable formula compute array is zero length",ivar); if (!compute->is_initialized()) - print_var_error(FLERR,"Variable formula compute cannot be invoked before initialized by run",ivar); + print_var_error(FLERR,"Variable formula compute cannot be invoked before " + "initialization by a run",ivar); if (!(compute->invoked_flag & Compute::INVOKED_ARRAY)) { compute->compute_array(); compute->invoked_flag |= Compute::INVOKED_ARRAY; @@ -1624,7 +1629,8 @@ double Variable::evaluate(char *str, Tree **tree, int ivar) compute->size_peratom_cols == 0) { if (!compute->is_initialized()) - print_var_error(FLERR,"Variable formula compute cannot be invoked before initialized by run",ivar); + print_var_error(FLERR,"Variable formula compute cannot be invoked before " + "initialization by a run",ivar); if (!(compute->invoked_flag & Compute::INVOKED_PERATOM)) { compute->compute_peratom(); compute->invoked_flag |= Compute::INVOKED_PERATOM; @@ -1641,7 +1647,8 @@ double Variable::evaluate(char *str, Tree **tree, int ivar) if (index2 > compute->size_peratom_cols) print_var_error(FLERR,"Variable formula compute array is accessed out-of-range",ivar,0); if (!compute->is_initialized()) - print_var_error(FLERR,"Variable formula compute cannot be invoked before initialized by run",ivar); + print_var_error(FLERR,"Variable formula compute cannot be invoked before " + "initialization by a run",ivar); if (!(compute->invoked_flag & Compute::INVOKED_PERATOM)) { compute->compute_peratom(); compute->invoked_flag |= Compute::INVOKED_PERATOM; @@ -1664,7 +1671,8 @@ double Variable::evaluate(char *str, Tree **tree, int ivar) if (treetype == VECTOR) print_var_error(FLERR,"Per-atom compute in vector-style variable formula",ivar); if (!compute->is_initialized()) - print_var_error(FLERR,"Variable formula compute cannot be invoked before initialized by run",ivar); + print_var_error(FLERR,"Variable formula compute cannot be invoked before " + "initialization by a run",ivar); if (!(compute->invoked_flag & Compute::INVOKED_PERATOM)) { compute->compute_peratom(); compute->invoked_flag |= Compute::INVOKED_PERATOM; @@ -1688,7 +1696,8 @@ double Variable::evaluate(char *str, Tree **tree, int ivar) if (index1 > compute->size_peratom_cols) print_var_error(FLERR,"Variable formula compute array is accessed out-of-range",ivar,0); if (!compute->is_initialized()) - print_var_error(FLERR,"Variable formula compute cannot be invoked before initialized by run",ivar); + print_var_error(FLERR,"Variable formula compute cannot be invoked before " + "initialization by a run",ivar); if (!(compute->invoked_flag & Compute::INVOKED_PERATOM)) { compute->compute_peratom(); compute->invoked_flag |= Compute::INVOKED_PERATOM; @@ -4164,7 +4173,8 @@ int Variable::special_function(char *word, char *contents, Tree **tree, Tree **t } if (index == 0 && compute->vector_flag) { if (!compute->is_initialized()) - print_var_error(FLERR,"Variable formula compute cannot be invoked before initialized by run",ivar); + print_var_error(FLERR,"Variable formula compute cannot be invoked before " + "initialization by a run",ivar); if (!(compute->invoked_flag & Compute::INVOKED_VECTOR)) { compute->compute_vector(); compute->invoked_flag |= Compute::INVOKED_VECTOR; @@ -4175,7 +4185,8 @@ int Variable::special_function(char *word, char *contents, Tree **tree, Tree **t if (index > compute->size_array_cols) print_var_error(FLERR,"Variable formula compute array is accessed out-of-range",ivar,0); if (!compute->is_initialized()) - print_var_error(FLERR,"Variable formula compute cannot be invoked before initialized by run",ivar); + print_var_error(FLERR,"Variable formula compute cannot be invoked before " + "initialization by a run",ivar); if (!(compute->invoked_flag & Compute::INVOKED_ARRAY)) { compute->compute_array(); compute->invoked_flag |= Compute::INVOKED_ARRAY; From 9669bf3d3b3d57286469ba9dc6f48e9b29e35787 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Fri, 21 Jul 2023 11:25:44 -0400 Subject: [PATCH 396/396] move creation of internal computes and variables before lmp->init() so they are initialized --- src/reset_atoms_image.cpp | 40 ++++++++++++++++----------------------- 1 file changed, 16 insertions(+), 24 deletions(-) diff --git a/src/reset_atoms_image.cpp b/src/reset_atoms_image.cpp index 7e9dd45a17..84df5bf746 100644 --- a/src/reset_atoms_image.cpp +++ b/src/reset_atoms_image.cpp @@ -61,6 +61,22 @@ void ResetAtomsImage::command(int narg, char **arg) MPI_Barrier(world); double time1 = platform::walltime(); + // create computes and variables + // must come before lmp->init so the computes are properly initialized + + auto frags = modify->add_compute("frags_r_i_f all fragment/atom single yes"); + auto chunk = modify->add_compute("chunk_r_i_f all chunk/atom c_frags_r_i_f compress yes"); + auto flags = modify->add_compute("flags_r_i_f all property/atom ix iy iz"); + input->variable->set("ix_r_i_f atom c_flags_r_i_f[1]"); + input->variable->set("iy_r_i_f atom c_flags_r_i_f[2]"); + input->variable->set("iz_r_i_f atom c_flags_r_i_f[3]"); + auto ifmin = modify->add_compute("ifmin_r_i_f all reduce/chunk chunk_r_i_f min " + "v_ix_r_i_f v_iy_r_i_f v_iz_r_i_f"); + auto ifmax = modify->add_compute("ifmax_r_i_f all reduce/chunk chunk_r_i_f max " + "v_ix_r_i_f v_iy_r_i_f v_iz_r_i_f"); + auto cdist = modify->add_compute("cdist_r_i_f all chunk/spread/atom chunk_r_i_f " + "c_ifmax_r_i_f[*] c_ifmin_r_i_f[*]"); + // initialize system since comm->borders() will be invoked lmp->init(); @@ -77,32 +93,8 @@ void ResetAtomsImage::command(int narg, char **arg) comm->borders(); if (domain->triclinic) domain->lamda2x(atom->nlocal + atom->nghost); - // create computes and variables - - auto frags = modify->add_compute("frags_r_i_f all fragment/atom single yes"); - auto chunk = modify->add_compute("chunk_r_i_f all chunk/atom c_frags_r_i_f compress yes"); - auto flags = modify->add_compute("flags_r_i_f all property/atom ix iy iz"); - input->variable->set("ix_r_i_f atom c_flags_r_i_f[1]"); - input->variable->set("iy_r_i_f atom c_flags_r_i_f[2]"); - input->variable->set("iz_r_i_f atom c_flags_r_i_f[3]"); - auto ifmin = modify->add_compute("ifmin_r_i_f all reduce/chunk chunk_r_i_f min " - "v_ix_r_i_f v_iy_r_i_f v_iz_r_i_f"); - auto ifmax = modify->add_compute("ifmax_r_i_f all reduce/chunk chunk_r_i_f max " - "v_ix_r_i_f v_iy_r_i_f v_iz_r_i_f"); - auto cdist = modify->add_compute("cdist_r_i_f all chunk/spread/atom chunk_r_i_f " - "c_ifmax_r_i_f[*] c_ifmin_r_i_f[*]"); - // trigger computes - // need to first initialize compute flags to allow this input script command prior - // to a first run/minimize. this is b/c internal variables are evaulated which - // invoke computes that will trigger an error unless they are initialized - frags->init_flags(); - chunk->init_flags(); - flags->init_flags(); - ifmin->init_flags(); - ifmax->init_flags(); - cdist->init_flags(); frags->compute_peratom(); chunk->compute_peratom(); flags->compute_peratom();