diff --git a/doc/src/compute_orientorder_atom.rst b/doc/src/compute_orientorder_atom.rst index a68aa563ec..22cf8b066c 100644 --- a/doc/src/compute_orientorder_atom.rst +++ b/doc/src/compute_orientorder_atom.rst @@ -61,8 +61,8 @@ The summation is over the *nnn* nearest neighbors of the central atom. The angles :math:`theta` and :math:`phi` are the standard spherical polar angles defining the direction of the bond vector :math:`r_{ij}`. -The phase and sign of :math:`Y_{lm}` follow the standard conventions, -so that :math:`{\rm sign}(Y_{ll}(0,0)) = (-1)^l`. +The phase and sign of :math:`Y_{lm}` follow the standard conventions, +so that :math:`{\rm sign}(Y_{ll}(0,0)) = (-1)^l`. The second equation defines :math:`Q_l`, which is a rotationally invariant non-negative amplitude obtained by summing over all the components of degree *l*\ . @@ -181,13 +181,13 @@ values for each atom will be added to the output array, which are real numbers. If the keyword *components* is set, then the real and imaginary parts of each component of *normalized* :math:`\hat{Y}_{lm}` will be added to the -output array in the following order: :math:`{\rm Re}(\hat{Y}_{-m}), {\rm Im}(\hat{Y}_{-m}), -{\rm Re}(\hat{Y}_{-m+1}), {\rm Im}(\hat{Y}_{-m+1}), \dots , {\rm Re}(\hat{Y}_m), {\rm Im}(\hat{Y}_m)`. +output array in the following order: :math:`{\rm Re}(\hat{Y}_{-m}), {\rm Im}(\hat{Y}_{-m}), +{\rm Re}(\hat{Y}_{-m+1}), {\rm Im}(\hat{Y}_{-m+1}), \dots , {\rm Re}(\hat{Y}_m), {\rm Im}(\hat{Y}_m)`. In summary, the per-atom array will contain *nlvalues* columns, followed by an additional *nlvalues* columns if *wl* is set to yes, followed by an additional *nlvalues* columns if *wl/hat* is set to yes, followed -by an additional 2\*(2\* *ldegree*\ +1) columns if the *components* +by an additional 2\*(2\* *ldegree*\ +1) columns if the *components* keyword is set. These values can be accessed by any command that uses per-atom values diff --git a/doc/src/pair_mliap.rst b/doc/src/pair_mliap.rst index b569a26910..ed7caea86f 100644 --- a/doc/src/pair_mliap.rst +++ b/doc/src/pair_mliap.rst @@ -16,19 +16,19 @@ Examples .. code-block:: LAMMPS pair_style mliap model linear InP.mliap.model descriptor sna InP.mliap.descriptor - pair_style mliap model quadratic W.mliap.model descriptor sna W.mliap.descriptor + pair_style mliap model quadratic W.mliap.model descriptor sna W.mliap.descriptor pair_coeff * * In P Description """"""""""" -Pair style *mliap* provides a general interface to families of -machine-learning interatomic potentials. It provides separate +Pair style *mliap* provides a general interface to families of +machine-learning interatomic potentials. It provides separate definitions of the interatomic potential functional form (*model*) and the geometric quantities that characterize the atomic positions -(*descriptor*). By defining *model* and *descriptor* separately, +(*descriptor*). By defining *model* and *descriptor* separately, it is possible to use many different models with a given descriptor, -or many different descriptors with a given model. Currently, the pair_style +or many different descriptors with a given model. Currently, the pair_style supports just two models, *linear* and *quadratic*, and one descriptor, *sna*, the SNAP descriptor used by :doc:`pair_style snap `, including the linear, quadratic, and chem variants. Work is currently underway to extend @@ -37,23 +37,23 @@ and it is also straightforward to add new descriptor styles. The pair_style *mliap* command must be followed by two keywords *model* and *descriptor* in either order. A single -*pair_coeff* command is also required. The first 2 arguments +*pair_coeff* command is also required. The first 2 arguments must be \* \* so as to span all LAMMPS atom types. This is followed by a list of N arguments that specify the mapping of MLIAP -element names to LAMMPS atom types, +element names to LAMMPS atom types, where N is the number of LAMMPS atom types. The *model* keyword is followed by a model style, currently limited to either *linear* or *quadratic*. In both cases, -this is followed by a single argument specifying the model filename containing the -linear or quadratic coefficients for a set of elements. +this is followed by a single argument specifying the model filename containing the +linear or quadratic coefficients for a set of elements. The model filename usually ends in the *.mliap.model* extension. It may contain coefficients for many elements. The only requirement is that it contain at least those element names appearing in the *pair_coeff* command. -The top of the model file can contain any number of blank and comment lines (start with #), +The top of the model file can contain any number of blank and comment lines (start with #), but follows a strict format after that. The first non-blank non-comment line must contain two integers: @@ -64,20 +64,20 @@ This is followed by one block for each of the *nelem* elements. Each block consists of *ncoeff* coefficients, one per line. Note that this format is similar, but not identical to that used for the :doc:`pair_style snap ` coefficient file. -Specifically, the line containing the element weight and radius is omitted, +Specifically, the line containing the element weight and radius is omitted, since these are handled by the *descriptor*. The *descriptor* keyword is followed by a descriptor style, and additional arguments. -Currently the only descriptor style is *sna*, indicating the bispectrum component -descriptors used by the Spectral Neighbor Analysis Potential (SNAP) potentials of +Currently the only descriptor style is *sna*, indicating the bispectrum component +descriptors used by the Spectral Neighbor Analysis Potential (SNAP) potentials of :doc:`pair_style snap `. -The \'p\' in SNAP is dropped, because keywords that match pair_styles are silently stripped -out by the LAMMPS command parser. A single additional argument specifies the descriptor filename -containing the parameters and setting used by the SNAP descriptor. +The \'p\' in SNAP is dropped, because keywords that match pair_styles are silently stripped +out by the LAMMPS command parser. A single additional argument specifies the descriptor filename +containing the parameters and setting used by the SNAP descriptor. The descriptor filename usually ends in the *.mliap.descriptor* extension. -The SNAP descriptor file closely follows the format of the -:doc:`pair_style snap ` parameter file. +The SNAP descriptor file closely follows the format of the +:doc:`pair_style snap ` parameter file. The file can contain blank and comment lines (start with #) anywhere. Each non-blank non-comment line must contain one keyword/value pair. The required keywords are *rcutfac* and @@ -87,7 +87,7 @@ In addition, the SNAP descriptor file must contain the *nelems*, *elems*, *radelems*, and *welems* keywords. The *nelems* keyword specifies the number of elements provided in the other three keywords. -The *elems* keyword is followed by a list of *nelems* +The *elems* keyword is followed by a list of *nelems* element names that must include the element names appearing in the *pair_coeff* command, but can contain other names too. diff --git a/doc/src/pair_snap.rst b/doc/src/pair_snap.rst index a46df30609..0ff6f1dfcc 100644 --- a/doc/src/pair_snap.rst +++ b/doc/src/pair_snap.rst @@ -25,9 +25,9 @@ Description """"""""""" Pair style *snap* defines the spectral -neighbor analysis potential (SNAP), a machine-learning +neighbor analysis potential (SNAP), a machine-learning interatomic potential :ref:`(Thompson) `. -Like the GAP framework of Bartok et al. :ref:`(Bartok2010) `, +Like the GAP framework of Bartok et al. :ref:`(Bartok2010) `, SNAP uses bispectrum components to characterize the local neighborhood of each atom in a very general way. The mathematical definition of the @@ -139,7 +139,7 @@ The SNAP parameter file can contain blank and comment lines (start with #) anywhere. Each non-blank non-comment line must contain one keyword/value pair. The required keywords are *rcutfac* and *twojmax*\ . Optional keywords are *rfac0*\ , *rmin0*\ , -*switchflag*\ , *bzeroflag*\ , *quadraticflag*\ , *chemflag*\ , +*switchflag*\ , *bzeroflag*\ , *quadraticflag*\ , *chemflag*\ , *bnormflag*\ , *wselfallflag*\ , and *chunksize*\ . The default values for these keywords are @@ -154,34 +154,34 @@ The default values for these keywords are * *wselfallflag* = 0 * *chunksize* = 2000 -If *quadraticflag* is set to 1, then the SNAP energy expression includes additional quadratic terms +If *quadraticflag* is set to 1, then the SNAP energy expression includes additional quadratic terms that have been shown to increase the overall accuracy of the potential without much increase -in computational cost :ref:`(Wood) `. +in computational cost :ref:`(Wood) `. .. math:: E^i_{SNAP}(\mathbf{B}^i) = \beta^{\mu_i}_0 + \boldsymbol{\beta}^{\mu_i} \cdot \mathbf{B}_i + \frac{1}{2}\mathbf{B}^t_i \cdot \boldsymbol{\alpha}^{\mu_i} \cdot \mathbf{B}_i -where :math:`\mathbf{B}_i` is the *K*-vector of bispectrum components, -:math:`\boldsymbol{\beta}^{\mu_i}` is the *K*-vector of linear coefficients -for element :math:`\mu_i`, and :math:`\boldsymbol{\alpha}^{\mu_i}` +where :math:`\mathbf{B}_i` is the *K*-vector of bispectrum components, +:math:`\boldsymbol{\beta}^{\mu_i}` is the *K*-vector of linear coefficients +for element :math:`\mu_i`, and :math:`\boldsymbol{\alpha}^{\mu_i}` is the symmetric *K* by *K* matrix of quadratic coefficients. The SNAP element file should contain *K*\ (\ *K*\ +1)/2 additional coefficients for each element, the upper-triangular elements of :math:`\boldsymbol{\alpha}^{\mu_i}`. If *chemflag* is set to 1, then the energy expression is written in terms of explicit multi-element bispectrum components indexed on ordered triplets of elements, which has been shown to increase the ability of the SNAP -potential to capture energy differences in chemically complex systems, +potential to capture energy differences in chemically complex systems, at the expense of a significant increase in computational cost :ref:`(Cusentino) `. .. math:: - E^i_{SNAP}(\mathbf{B}^i) = \beta^{\mu_i}_0 + \sum_{\kappa,\lambda,\mu} \boldsymbol{\beta}^{\kappa\lambda\mu}_{\mu_i} \cdot \mathbf{B}^{\kappa\lambda\mu}_i + E^i_{SNAP}(\mathbf{B}^i) = \beta^{\mu_i}_0 + \sum_{\kappa,\lambda,\mu} \boldsymbol{\beta}^{\kappa\lambda\mu}_{\mu_i} \cdot \mathbf{B}^{\kappa\lambda\mu}_i -where :math:`\mathbf{B}^{\kappa\lambda\mu}_i` is the *K*-vector of bispectrum components -for neighbors of elements :math:`\kappa`, :math:`\lambda`, and :math:`\mu` and -:math:`\boldsymbol{\beta}^{\kappa\lambda\mu}_{\mu_i}` is the corresponding *K*-vector -of linear coefficients for element :math:`\mu_i`. The SNAP element file should contain +where :math:`\mathbf{B}^{\kappa\lambda\mu}_i` is the *K*-vector of bispectrum components +for neighbors of elements :math:`\kappa`, :math:`\lambda`, and :math:`\mu` and +:math:`\boldsymbol{\beta}^{\kappa\lambda\mu}_{\mu_i}` is the corresponding *K*-vector +of linear coefficients for element :math:`\mu_i`. The SNAP element file should contain a total of :math:`K N_{elem}^3` coefficients for each of the :math:`N_{elem}` elements. The keyword *chunksize* is only applicable when using the diff --git a/src/KOKKOS/pair_snap_kokkos_impl.h b/src/KOKKOS/pair_snap_kokkos_impl.h index 6bedf5554e..d6c677d14c 100644 --- a/src/KOKKOS/pair_snap_kokkos_impl.h +++ b/src/KOKKOS/pair_snap_kokkos_impl.h @@ -632,8 +632,8 @@ void PairSNAPKokkos::operator() (TagPairSNAPComputeNeigh,const typen template KOKKOS_INLINE_FUNCTION void PairSNAPKokkos::operator() (TagPairSNAPBeta,const int& ii) const { - - if (ii >= chunk_size) return; + + if (ii >= chunk_size) return; const int iatom_mod = ii % 32; const int iatom_div = ii / 32; diff --git a/src/KOKKOS/sna_kokkos.h b/src/KOKKOS/sna_kokkos.h index 121f293633..7edac7de00 100644 --- a/src/KOKKOS/sna_kokkos.h +++ b/src/KOKKOS/sna_kokkos.h @@ -160,17 +160,17 @@ inline t_sna_3c_ll ulist; t_sna_3c_ll ylist; - + // derivatives of data t_sna_4c3_ll dulist; - + // Modified structures for GPU backend t_sna_3d_ll ulisttot_re; // split real, t_sna_3d_ll ulisttot_im; // imag t_sna_4c_ll ulisttot_pack; // AoSoA layout t_sna_4c_ll zlist_pack; // AoSoA layout t_sna_4d_ll blist_pack; - t_sna_4d_ll ylist_pack_re; // split real, + t_sna_4d_ll ylist_pack_re; // split real, t_sna_4d_ll ylist_pack_im; // imag AoSoA layout int idxcg_max, idxu_max, idxz_max, idxb_max; diff --git a/src/KOKKOS/sna_kokkos_impl.h b/src/KOKKOS/sna_kokkos_impl.h index d1de943fe3..b7f0c9f7df 100644 --- a/src/KOKKOS/sna_kokkos_impl.h +++ b/src/KOKKOS/sna_kokkos_impl.h @@ -295,7 +295,7 @@ void SNAKokkos::pre_ui(const typename Kokkos::TeamPolicy // if m is on the "diagonal", initialize it with the self energy. // Otherwise zero it out - double re_part = 0.; + double re_part = 0.; if (m % (j+2) == 0 && (!chem_flag || ielem == jelem || wselfall_flag)) { re_part = wself; } ulisttot_re(jjup, jelem, iatom) = re_part; @@ -436,7 +436,7 @@ void SNAKokkos::compute_ui(const typename Kokkos::TeamPolicy::compute_bi(const int& iatom_mod, const int& jjb, con blist_pack(iatom_mod, jjb, itriple, iatom_div) = sumzu; //} // end loop over j //} // end loop over j1, j2 - itriple++; + itriple++; } // end loop over elem3 idouble++; } // end loop over elem2 @@ -788,7 +788,7 @@ void SNAKokkos::compute_fused_deidrj(const typename Kokkos::TeamPoli // single has a warp barrier at the end Kokkos::single(Kokkos::PerThread(team), [=]() { - + ulist_buf1[0] = {1., 0.}; dulist_buf1[0] = {0., 0.}; }); @@ -878,7 +878,7 @@ void SNAKokkos::compute_fused_deidrj(const typename Kokkos::TeamPoli // u[ma-j][mb-j] = (-1)^(ma-mb)*Conj([u[ma][mb]) if (j%2==1 && mb+1==n_mb) { int sign_factor = (((ma+mb)%2==0)?1:-1); - + const int jju_shared_flip = (j+1-mb)*(j+1)-(ma+1); if (sign_factor == 1) { @@ -1138,7 +1138,7 @@ void SNAKokkos::compute_bi_cpu(const typename Kokkos::TeamPolicy::compute_bi_cpu(const typename Kokkos::TeamPolicy::memory_usage() #ifdef KOKKOS_ENABLE_CUDA if (std::is_same::value) { - + bytes += natom * idxu_max * nelements * sizeof(double); // ulisttot_re bytes += natom * idxu_max * nelements * sizeof(double); // ulisttot_im bytes += natom_pad * idxu_max * nelements * sizeof(double) * 2; // ulisttot_pack diff --git a/src/KSPACE/fix_tune_kspace.cpp b/src/KSPACE/fix_tune_kspace.cpp index a3150847f3..0eb29cf485 100644 --- a/src/KSPACE/fix_tune_kspace.cpp +++ b/src/KSPACE/fix_tune_kspace.cpp @@ -149,7 +149,7 @@ void FixTuneKspace::pre_exchange() update_pair_style(new_pair_style,pair_cut_coul); update_kspace_style(new_kspace_style,new_acc_str); } else if (niter == 4) { - store_old_kspace_settings(); + store_old_kspace_settings(); if (comm->me == 0) utils::logmesg(lmp,fmt::format("ewald_time = {}\n" "pppm_time = {}\n" diff --git a/src/MLIAP/mliap_descriptor_snap.cpp b/src/MLIAP/mliap_descriptor_snap.cpp index fa8724a2ca..5568ad5b4f 100644 --- a/src/MLIAP/mliap_descriptor_snap.cpp +++ b/src/MLIAP/mliap_descriptor_snap.cpp @@ -36,7 +36,7 @@ using namespace LAMMPS_NS; /* ---------------------------------------------------------------------- */ -MLIAPDescriptorSNAP::MLIAPDescriptorSNAP(LAMMPS *lmp, char *paramfilename): +MLIAPDescriptorSNAP::MLIAPDescriptorSNAP(LAMMPS *lmp, char *paramfilename): MLIAPDescriptor(lmp) { nelements = 0; @@ -242,13 +242,13 @@ void MLIAPDescriptorSNAP::backward(PairMLIAP* pairmliap, NeighList* list, double // add in gloabl and per-atom virial contributions // this is optional and has no effect on force calculation - + if (vflag) pairmliap->v_tally(i,j, fij[0],fij[1],fij[2], -snaptr->rij[jj][0],-snaptr->rij[jj][1], -snaptr->rij[jj][2]); - + } } @@ -338,8 +338,8 @@ void MLIAPDescriptorSNAP::read_paramfile(char *paramfilename) utils::logmesg(lmp, fmt::format("SNAP keyword {} {} \n", keywd, keyval)); } - // check for keywords with one value per element - + // check for keywords with one value per element + if (strcmp(keywd,"elems") == 0 || strcmp(keywd,"radelems") == 0 || strcmp(keywd,"welems") == 0) { @@ -372,9 +372,9 @@ void MLIAPDescriptorSNAP::read_paramfile(char *paramfilename) } else { - // all other keywords take one value + // all other keywords take one value - if (nwords != 2) + if (nwords != 2) error->all(FLERR,"Incorrect SNAP parameter file"); if (strcmp(keywd,"nelems") == 0) { @@ -408,8 +408,8 @@ void MLIAPDescriptorSNAP::read_paramfile(char *paramfilename) } } - - if (!rcutfacflag || !twojmaxflag || !nelementsflag || + + if (!rcutfacflag || !twojmaxflag || !nelementsflag || !elementsflag || !radelemflag || !wjelemflag) error->all(FLERR,"Incorrect SNAP parameter file"); diff --git a/src/MLIAP/mliap_model_linear.cpp b/src/MLIAP/mliap_model_linear.cpp index fe3665938f..36c0a054f1 100644 --- a/src/MLIAP/mliap_model_linear.cpp +++ b/src/MLIAP/mliap_model_linear.cpp @@ -28,7 +28,7 @@ using namespace LAMMPS_NS; /* ---------------------------------------------------------------------- */ -MLIAPModelLinear::MLIAPModelLinear(LAMMPS* lmp, char* coefffilename) : +MLIAPModelLinear::MLIAPModelLinear(LAMMPS* lmp, char* coefffilename) : MLIAPModel(lmp, coefffilename) { nonlinearflag = 0; @@ -71,7 +71,7 @@ void MLIAPModelLinear::gradient(PairMLIAP* pairmliap, NeighList* list, double ** for (int icoeff = 0; icoeff < ndescriptors; icoeff++) etmp += coeffi[icoeff+1]*descriptors[ii][icoeff]; - + pairmliap->e_tally(i,etmp); } } diff --git a/src/MLIAP/mliap_model_quadratic.cpp b/src/MLIAP/mliap_model_quadratic.cpp index 94d8972416..57b89caacf 100644 --- a/src/MLIAP/mliap_model_quadratic.cpp +++ b/src/MLIAP/mliap_model_quadratic.cpp @@ -28,7 +28,7 @@ using namespace LAMMPS_NS; /* ---------------------------------------------------------------------- */ -MLIAPModelQuadratic::MLIAPModelQuadratic(LAMMPS* lmp, char* coefffilename) : +MLIAPModelQuadratic::MLIAPModelQuadratic(LAMMPS* lmp, char* coefffilename) : MLIAPModel(lmp, coefffilename) { nonlinearflag = 1; @@ -72,7 +72,7 @@ void MLIAPModelQuadratic::gradient(PairMLIAP* pairmliap, NeighList* list, double // add in contributions to global and per-atom energy // this is optional and has no effect on force calculation - + if (eflag) { // energy of atom I diff --git a/src/MLIAP/pair_mliap.cpp b/src/MLIAP/pair_mliap.cpp index b97dd51d67..fac25ae578 100644 --- a/src/MLIAP/pair_mliap.cpp +++ b/src/MLIAP/pair_mliap.cpp @@ -93,10 +93,10 @@ void PairMLIAP::compute(int eflag, int vflag) model->gradient(this, list, descriptors, beta, eflag); // calculate force contributions beta_i*dB_i/dR_j - + descriptor->backward(this, list, beta, vflag); - // calculate stress + // calculate stress if (vflag_fdotr) virial_fdotr_compute(); } diff --git a/src/MLIAP/pair_mliap.h b/src/MLIAP/pair_mliap.h index 66bafab97a..4d4499edd1 100644 --- a/src/MLIAP/pair_mliap.h +++ b/src/MLIAP/pair_mliap.h @@ -45,7 +45,7 @@ protected: double** beta; // betas for all atoms in list double** descriptors; // descriptors for all atoms in list - int ndescriptors; // number of descriptors + int ndescriptors; // number of descriptors int beta_max; // number of atoms allocated for beta, descriptors class MLIAPModel* model; diff --git a/src/REPLICA/fix_hyper_local.cpp b/src/REPLICA/fix_hyper_local.cpp index db2cf5ab02..d5311fc37d 100644 --- a/src/REPLICA/fix_hyper_local.cpp +++ b/src/REPLICA/fix_hyper_local.cpp @@ -1683,7 +1683,7 @@ double FixHyperLocal::compute_vector(int i) return (double) allovercount; } */ - + return 0.0; } diff --git a/src/USER-MISC/pair_tersoff_table.cpp b/src/USER-MISC/pair_tersoff_table.cpp index be8e4d701a..590a32c2c6 100644 --- a/src/USER-MISC/pair_tersoff_table.cpp +++ b/src/USER-MISC/pair_tersoff_table.cpp @@ -852,7 +852,7 @@ void PairTersoffTable::read_file(char *file) if (comm->me == 0) { PotentialFileReader reader(lmp, file, "TersoffTable", unit_convert_flag); char *line; - + // transparently convert units for supported conversions int unit_convert = reader.get_unit_convert();