diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index b20118794f..f2a73c3cf2 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -22,42 +22,42 @@ src/MESSAGE/* @sjplimp src/MLIAP/* @athomps src/SNAP/* @athomps src/SPIN/* @julient31 -src/BROWNIAN/* @samueljmcameron -src/CG-DNA/* @ohenrich -src/CG-SDK/* @akohlmey -src/COLVARS/* @giacomofiorin -src/DIELECTRIC/* @ndtrung81 -src/FEP/* @agiliopadua -src/ML-HDNNP/* @singraber -src/INTEL/* @wmbrownintel -src/MANIFOLD/* @Pakketeretet2 -src/MDI/* @taylor-a-barnes -src/MEAM/* @martok -src/MESONT/* @iafoss -src/MOFFF/* @hheenen -src/MOLFILE/* @akohlmey -src/NETCDF/* @pastewka -src/ML-PACE/* @yury-lysogorskiy -src/PLUMED/* @gtribello -src/PHONON/* @lingtikong -src/PTM/* @pmla -src/OPENMP/* @akohlmey -src/QMMM/* @akohlmey -src/REAXFF/* @hasanmetin -src/REACTION/* @jrgissing -src/SCAFACOS/* @rhalver -src/TALLY/* @akohlmey -src/UEF/* @danicholson -src/VTK/* @rbberger - +src/BROWNIAN/* @samueljmcameron +src/CG-DNA/* @ohenrich +src/CG-SDK/* @akohlmey +src/COLVARS/* @giacomofiorin +src/DIELECTRIC/* @ndtrung81 +src/FEP/* @agiliopadua +src/ML-HDNNP/* @singraber +src/INTEL/* @wmbrownintel +src/MANIFOLD/* @Pakketeretet2 +src/MDI/* @taylor-a-barnes +src/MEAM/* @martok +src/MESONT/* @iafoss +src/MOFFF/* @hheenen +src/MOLFILE/* @akohlmey +src/NETCDF/* @pastewka +src/ML-PACE/* @yury-lysogorskiy +src/PLUMED/* @gtribello +src/PHONON/* @lingtikong +src/PTM/* @pmla +src/OPENMP/* @akohlmey +src/QMMM/* @akohlmey +src/REAXFF/* @hasanmetin @stanmoore1 +src/REACTION/* @jrgissing +src/SCAFACOS/* @rhalver +src/TALLY/* @akohlmey +src/UEF/* @danicholson +src/VTK/* @rbberger # individual files in packages src/GPU/pair_vashishta_gpu.* @andeplane src/KOKKOS/pair_vashishta_kokkos.* @andeplane src/MANYBODY/pair_vashishta_table.* @andeplane src/MANYBODY/pair_atm.* @sergeylishchuk -src/USER-MISC/*_grem.* @dstelter92 -src/USER-MISC/compute_stress_mop*.* @RomainVermorel +src/REPLICA/*_grem.* @dstelter92 +src/EXTRA-COMPUTE/compute_stress_mop*.* @RomainVermorel +src/MISC/*_tracker.* @jtclemm # core LAMMPS classes src/lammps.* @sjplimp @@ -81,6 +81,7 @@ src/kspace.* @sjplimp src/lmptyp.h @sjplimp src/library.* @sjplimp src/main.cpp @sjplimp +src/min_*.* @sjplimp src/memory.* @sjplimp src/modify.* @sjplimp src/molecule.* @sjplimp @@ -109,7 +110,6 @@ src/thermo.* @sjplimp src/universe.* @sjplimp src/update.* @sjplimp src/variable.* @sjplimp -src/verlet.* @sjplimp src/velocity.* @sjplimp src/write_data.* @sjplimp src/write_restart.* @sjplimp @@ -122,6 +122,7 @@ src/info.* @akohlmey @rbberger src/timer.* @akohlmey src/min* @sjplimp @stanmoore1 src/utils.* @akohlmey @rbberger +src/verlet.* @sjplimp @stanmoore1 src/math_eigen_impl.h @jewettaij # tools diff --git a/doc/src/Commands_pair.rst b/doc/src/Commands_pair.rst index db3d947892..184fb25300 100644 --- a/doc/src/Commands_pair.rst +++ b/doc/src/Commands_pair.rst @@ -29,7 +29,7 @@ OPT. * :doc:`hybrid/scaled ` * :doc:`kim ` * :doc:`list ` - * + * :doc:`tracker ` * * * @@ -273,7 +273,6 @@ OPT. * :doc:`tip4p/cut (o) ` * :doc:`tip4p/long (o) ` * :doc:`tip4p/long/soft (o) ` - * :doc:`tracker ` * :doc:`tri/lj ` * :doc:`ufm (got) ` * :doc:`vashishta (gko) ` diff --git a/doc/src/pair_beck.rst b/doc/src/pair_beck.rst index d220e0abdd..2bf027515c 100644 --- a/doc/src/pair_beck.rst +++ b/doc/src/pair_beck.rst @@ -84,7 +84,10 @@ This pair style can only be used via the *pair* keyword of the Restrictions """""""""""" -none + +This pair style is part of the EXTRA-PAIR package. It is only enabled if +LAMMPS was built with that package. See the +:doc:`Build package ` page for more info. Related commands """""""""""""""" diff --git a/examples/PACKAGES/cauchy/NiAlH_jea.eam.alloy b/examples/PACKAGES/cauchy/NiAlH_jea.eam.alloy index 9d763bffe4..da57022dd3 120000 --- a/examples/PACKAGES/cauchy/NiAlH_jea.eam.alloy +++ b/examples/PACKAGES/cauchy/NiAlH_jea.eam.alloy @@ -1 +1 @@ -../../../../potentials/NiAlH_jea.eam.alloy \ No newline at end of file +../../../potentials/NiAlH_jea.eam.alloy \ No newline at end of file diff --git a/examples/PACKAGES/electron_stopping/Si.sw b/examples/PACKAGES/electron_stopping/Si.sw index e575921334..f2bb3ce799 120000 --- a/examples/PACKAGES/electron_stopping/Si.sw +++ b/examples/PACKAGES/electron_stopping/Si.sw @@ -1 +1 @@ -../../../../potentials/Si.sw \ No newline at end of file +../../../potentials/Si.sw \ No newline at end of file diff --git a/examples/PACKAGES/orient_eco/Ni_u3.eam b/examples/PACKAGES/orient_eco/Ni_u3.eam index 0abe5fb328..7a9c552e94 120000 --- a/examples/PACKAGES/orient_eco/Ni_u3.eam +++ b/examples/PACKAGES/orient_eco/Ni_u3.eam @@ -1 +1 @@ -../../../../potentials/Ni_u3.eam \ No newline at end of file +../../../potentials/Ni_u3.eam \ No newline at end of file diff --git a/src/.gitignore b/src/.gitignore index 961901e322..6c0a838c1b 100644 --- a/src/.gitignore +++ b/src/.gitignore @@ -77,6 +77,7 @@ /compute_mliap.h /mliap_*.cpp /mliap_*.h +/mliap_model_python_couple.pyx /pair_mliap.cpp /pair_mliap.h @@ -250,8 +251,12 @@ /pair_mesont_tpm.cpp /pair_mesont_tpm.h +/compute_adf.cpp +/compute_adf.h /compute_contact_atom.cpp /compute_contact_atom.h +/compute_hexorder_atom.cpp +/compute_hexorder_atom.h /dump_dcd.cpp /dump_dcd.h /fix_controller.cpp @@ -270,6 +275,8 @@ /fix_temp_csvr.h /fix_tmd.cpp /fix_tmd.h +/pair_beck.cpp +/pair_beck.h /pair_born_coul_dsf.cpp /pair_born_coul_dsf.h /pair_born_coul_wolf.cpp @@ -284,6 +291,7 @@ /pair_lj96_cut.h /pair_lj_cubic.cpp /pair_lj_cubic.h +/pair_lj_cubic_const.h /pair_lj_cut_coul_debye.cpp /pair_lj_cut_coul_debye.h /pair_lj_cut_coul_dsf.cpp @@ -292,8 +300,8 @@ /pair_lj_cut_coul_wolf.h /pair_lj_gromacs.cpp /pair_lj_gromacs.h -/pair_lj_gromacs_could_gromacs.cpp -/pair_lj_gromacs_could_gromacs.h +/pair_lj_gromacs_coul_gromacs.cpp +/pair_lj_gromacs_coul_gromacs.h /pair_lj_relres.cpp /pair_lj_relres.h /pair_lj_smooth.cpp @@ -783,18 +791,18 @@ /fix_pour.h /fix_qeq_comb.cpp /fix_qeq_comb.h -/fix_qeq_reax.cpp /fix_qeq_fire.cpp /fix_qeq_fire.h -/fix_qeq_reax.h +/fix_qeq_reaxff.cpp +/fix_qeq_reaxff.h /fix_qmmm.cpp /fix_qmmm.h -/fix_reaxc.cpp -/fix_reaxc.h -/fix_reaxc_bonds.cpp -/fix_reaxc_bonds.h -/fix_reaxc_species.cpp -/fix_reaxc_species.h +/fix_reaxff.cpp +/fix_reaxff.h +/fix_reaxff_bonds.cpp +/fix_reaxff_bonds.h +/fix_reaxff_species.cpp +/fix_reaxff_species.h /fix_rhok.cpp /fix_rhok.h /fix_rigid.cpp @@ -1182,8 +1190,8 @@ /pair_peri_ves.h /pair_quip.cpp /pair_quip.h -/pair_reaxc.cpp -/pair_reaxc.h +/pair_reaxff.cpp +/pair_reaxff.h /pair_rebo.cpp /pair_rebo.h /pair_resquared.cpp @@ -1270,23 +1278,22 @@ /reader_adios.h /reader_molfile.cpp /reader_molfile.h -/reaxc_allocate.cpp -/reaxc_basic_comm.cpp -/reaxc_bond_orders.cpp -/reaxc_bonds.cpp -/reaxc_control.cpp -/reaxc_ffield.cpp -/reaxc_forces.cpp -/reaxc_hydrogen_bonds.cpp -/reaxc_init_md.cpp -/reaxc_list.cpp -/reaxc_lookup.cpp -/reaxc_multi_body.cpp -/reaxc_nonbonded.cpp -/reaxc_reset_tools.cpp -/reaxc_tool_box.cpp -/reaxc_torsion_angles.cpp -/reaxc_valence_angles.cpp +/reaxff_allocate.cpp +/reaxff_bond_orders.cpp +/reaxff_bonds.cpp +/reaxff_control.cpp +/reaxff_ffield.cpp +/reaxff_forces.cpp +/reaxff_hydrogen_bonds.cpp +/reaxff_init_md.cpp +/reaxff_list.cpp +/reaxff_lookup.cpp +/reaxff_multi_body.cpp +/reaxff_nonbonded.cpp +/reaxff_reset_tools.cpp +/reaxff_tool_box.cpp +/reaxff_torsion_angles.cpp +/reaxff_valence_angles.cpp /reaxff_api.h /reaxff_defs.h /reaxff_inline.h diff --git a/src/CG-DNA/atom_vec_oxdna.cpp b/src/CG-DNA/atom_vec_oxdna.cpp index 7ce2189a64..f5d56eef31 100644 --- a/src/CG-DNA/atom_vec_oxdna.cpp +++ b/src/CG-DNA/atom_vec_oxdna.cpp @@ -80,7 +80,7 @@ void AtomVecOxdna::data_atom_post(int ilocal) store 5' partner to inform 3'->5' bond directionality ------------------------------------------------------------------------- */ -void AtomVecOxdna::data_bonds_post(int m, int num_bond, tagint atom1, tagint atom2, +void AtomVecOxdna::data_bonds_post(int /*m*/, int /*num_bond*/, tagint atom1, tagint atom2, tagint id_offset) { int n; diff --git a/src/CG-DNA/pair_oxdna_stk.cpp b/src/CG-DNA/pair_oxdna_stk.cpp index 63439e3ac4..2f1a0bf1b6 100644 --- a/src/CG-DNA/pair_oxdna_stk.cpp +++ b/src/CG-DNA/pair_oxdna_stk.cpp @@ -255,7 +255,6 @@ void PairOxdnaStk::compute(int eflag, int vflag) double f1,f4t4,f4t5,f4t6,f5c1,f5c2; double df1,df4t4,df4t5,df4t6,df5c1,df5c2; - double tptofp; evdwl = 0.0; ev_init(eflag,vflag); diff --git a/src/CG-DNA/pair_oxrna2_stk.cpp b/src/CG-DNA/pair_oxrna2_stk.cpp index b6b68662d5..4d733f53b5 100644 --- a/src/CG-DNA/pair_oxrna2_stk.cpp +++ b/src/CG-DNA/pair_oxrna2_stk.cpp @@ -272,7 +272,6 @@ void PairOxrna2Stk::compute(int eflag, int vflag) double f1,f4t5,f4t6,f4t9,f4t10,f5c1,f5c2; double df1,df4t5,df4t6,df4t9,df4t10,df5c1,df5c2; - double tptofp; evdwl = 0.0; ev_init(eflag,vflag); diff --git a/src/DIELECTRIC/pppm_disp_dielectric.cpp b/src/DIELECTRIC/pppm_disp_dielectric.cpp index b6a82296b2..944225dd43 100644 --- a/src/DIELECTRIC/pppm_disp_dielectric.cpp +++ b/src/DIELECTRIC/pppm_disp_dielectric.cpp @@ -609,7 +609,6 @@ void PPPMDispDielectric::fieldforce_c_ad() double *q = atom->q; double **x = atom->x; double **f = atom->f; - double *eps = atom->epsilon; int nlocal = atom->nlocal; for (i = 0; i < nlocal; i++) { diff --git a/src/DPD-SMOOTH/fix_meso_move.cpp b/src/DPD-SMOOTH/fix_meso_move.cpp index 220019ea98..85eee5ffbe 100644 --- a/src/DPD-SMOOTH/fix_meso_move.cpp +++ b/src/DPD-SMOOTH/fix_meso_move.cpp @@ -68,7 +68,7 @@ FixMesoMove::FixMesoMove (LAMMPS *lmp, int narg, char **arg) : // parse args - int iarg; + int iarg = narg; if (strcmp(arg[3],"linear") == 0) { if (narg < 7) error->all(FLERR,"Illegal fix meso/move command"); diff --git a/src/Depend.sh b/src/Depend.sh index 4bbbeb9a51..af88f24bb4 100755 --- a/src/Depend.sh +++ b/src/Depend.sh @@ -73,6 +73,8 @@ fi if (test $1 = "DPD-BASIC") then depend GPU + depend OPENMP + depend INTEL fi if (test $1 = "EXTRA-MOLECULE") then diff --git a/src/pair_beck.cpp b/src/EXTRA-PAIR/pair_beck.cpp similarity index 100% rename from src/pair_beck.cpp rename to src/EXTRA-PAIR/pair_beck.cpp diff --git a/src/pair_beck.h b/src/EXTRA-PAIR/pair_beck.h similarity index 100% rename from src/pair_beck.h rename to src/EXTRA-PAIR/pair_beck.h diff --git a/src/GPU/Install.sh b/src/GPU/Install.sh index 8d55cd5857..2e2b32d96a 100755 --- a/src/GPU/Install.sh +++ b/src/GPU/Install.sh @@ -41,14 +41,14 @@ action fix_npt_gpu.cpp action fix_nve_asphere_gpu.h fix_nve_asphere.h action fix_nve_asphere_gpu.cpp fix_nve_asphere.cpp action gpu_extra.h -action pair_beck_gpu.cpp -action pair_beck_gpu.h +action pair_beck_gpu.cpp pair_beck.cpp +action pair_beck_gpu.h pair_beck.h action pair_born_coul_long_gpu.cpp pair_born_coul_long.cpp action pair_born_coul_long_gpu.h pair_born_coul_long.cpp action pair_born_coul_long_cs_gpu.cpp pair_born_coul_long_cs.cpp action pair_born_coul_long_cs_gpu.h pair_born_coul_long_cs.cpp -action pair_born_coul_wolf_gpu.cpp -action pair_born_coul_wolf_gpu.h +action pair_born_coul_wolf_gpu.cpp pair_born_coul_wolf.cpp +action pair_born_coul_wolf_gpu.h pair_born_coul_wolf.h action pair_born_coul_wolf_cs_gpu.cpp pair_born_coul_wolf_cs.cpp action pair_born_coul_wolf_cs_gpu.h pair_born_coul_wolf_cs.cpp action pair_born_gpu.cpp @@ -71,10 +71,10 @@ action pair_coul_long_gpu.cpp pair_coul_long.cpp action pair_coul_long_gpu.h pair_coul_long.cpp action pair_coul_long_cs_gpu.cpp pair_coul_long_cs.cpp action pair_coul_long_cs_gpu.h pair_coul_long_cs.cpp -action pair_dpd_gpu.cpp -action pair_dpd_gpu.h -action pair_dpd_tstat_gpu.cpp -action pair_dpd_tstat_gpu.h +action pair_dpd_gpu.cpp pair_dpd.cpp +action pair_dpd_gpu.h pair_dpd.h +action pair_dpd_tstat_gpu.cpp pair_dpd_tstat.cpp +action pair_dpd_tstat_gpu.h pair_dpd_tstat.h action pair_lj_cut_dipole_cut_gpu.cpp pair_lj_cut_dipole_cut.cpp action pair_lj_cut_dipole_cut_gpu.h pair_lj_cut_dipole_cut.cpp action pair_lj_sf_dipole_sf_gpu.cpp pair_lj_sf_dipole_sf.cpp @@ -85,12 +85,12 @@ action pair_eam_fs_gpu.cpp pair_eam.cpp action pair_eam_fs_gpu.h pair_eam.cpp action pair_eam_gpu.cpp pair_eam.cpp action pair_eam_gpu.h pair_eam.cpp -action pair_gauss_gpu.cpp -action pair_gauss_gpu.h +action pair_gauss_gpu.cpp pair_gauss.cpp +action pair_gauss_gpu.h pair_gauss.h action pair_gayberne_gpu.cpp pair_gayberne.cpp action pair_gayberne_gpu.h pair_gayberne.cpp -action pair_lj96_cut_gpu.cpp -action pair_lj96_cut_gpu.h +action pair_lj96_cut_gpu.cpp pair_lj96_cut.cpp +action pair_lj96_cut_gpu.h pair_lj96_cut.h action pair_lj_charmm_coul_long_gpu.cpp pair_lj_charmm_coul_long.cpp action pair_lj_charmm_coul_long_gpu.h pair_lj_charmm_coul_long.cpp action pair_lj_charmm_coul_charmm_gpu.cpp pair_lj_charmm_coul_charmm.cpp @@ -99,14 +99,14 @@ action pair_lj_class2_coul_long_gpu.cpp pair_lj_class2_coul_long.cpp action pair_lj_class2_coul_long_gpu.h pair_lj_class2_coul_long.cpp action pair_lj_class2_gpu.cpp pair_lj_class2.cpp action pair_lj_class2_gpu.h pair_lj_class2.cpp -action pair_lj_cubic_gpu.cpp -action pair_lj_cubic_gpu.h +action pair_lj_cubic_gpu.cpp pair_lj_cubic.cpp +action pair_lj_cubic_gpu.h pair_lj_cubic.h action pair_lj_cut_coul_cut_gpu.cpp action pair_lj_cut_coul_cut_gpu.h -action pair_lj_cut_coul_debye_gpu.cpp -action pair_lj_cut_coul_debye_gpu.h -action pair_lj_cut_coul_dsf_gpu.cpp -action pair_lj_cut_coul_dsf_gpu.h +action pair_lj_cut_coul_debye_gpu.cpp pair_lj_cut_coul_debye.cpp +action pair_lj_cut_coul_debye_gpu.h pair_lj_cut_coul_debye.h +action pair_lj_cut_coul_dsf_gpu.cpp pair_lj_cut_coul_dsf.cpp +action pair_lj_cut_coul_dsf_gpu.h pair_lj_cut_coul_dsf.h action pair_lj_cut_coul_long_gpu.cpp pair_lj_cut_coul_long.cpp action pair_lj_cut_coul_long_gpu.h pair_lj_cut_coul_long.cpp action pair_lj_cut_coul_msm_gpu.cpp pair_lj_cut_coul_msm.cpp @@ -119,14 +119,14 @@ action pair_lj_expand_gpu.cpp action pair_lj_expand_gpu.h action pair_lj_expand_coul_long_gpu.cpp pair_lj_expand_coul_long.cpp action pair_lj_expand_coul_long_gpu.h pair_lj_expand_coul_long.cpp -action pair_lj_gromacs_gpu.cpp -action pair_lj_gromacs_gpu.h +action pair_lj_gromacs_gpu.cpp pair_lj_gromacs.cpp +action pair_lj_gromacs_gpu.h pair_lj_gromacs.h action pair_lj_sdk_coul_long_gpu.cpp pair_lj_sdk_coul_long.cpp action pair_lj_sdk_coul_long_gpu.h pair_lj_sdk_coul_long.cpp action pair_lj_sdk_gpu.cpp pair_lj_sdk.cpp action pair_lj_sdk_gpu.h pair_lj_sdk.cpp -action pair_mie_cut_gpu.cpp -action pair_mie_cut_gpu.h +action pair_mie_cut_gpu.cpp pair_mie_cut.cpp +action pair_mie_cut_gpu.h pair_mie_cut.h action pair_morse_gpu.cpp action pair_morse_gpu.h action pair_resquared_gpu.cpp pair_resquared.cpp @@ -153,8 +153,8 @@ action pair_zbl_gpu.cpp action pair_zbl_gpu.h action pppm_gpu.cpp pppm.cpp action pppm_gpu.h pppm.cpp -action pair_ufm_gpu.cpp -action pair_ufm_gpu.h +action pair_ufm_gpu.cpp pair_ufm.cpp +action pair_ufm_gpu.h pair_ufm.h action pair_lj_cut_dipole_long_gpu.cpp pair_lj_cut_dipole_long.cpp action pair_lj_cut_dipole_long_gpu.h pair_lj_cut_dipole_long.cpp action pair_lj_cut_tip4p_long_gpu.h pair_lj_cut_tip4p_long.cpp diff --git a/src/KOKKOS/kissfft_kokkos.cpp b/src/KOKKOS/kissfft_kokkos.cpp deleted file mode 100644 index f0695edb10..0000000000 --- a/src/KOKKOS/kissfft_kokkos.cpp +++ /dev/null @@ -1,21 +0,0 @@ -// clang-format off -/* ---------------------------------------------------------------------- - 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. -------------------------------------------------------------------------- */ - - -namespace LAMMPS_NS { -template class KissFFTKokkos; -#ifdef LMP_KOKKOS_GPU -template class KissFFTKokkos; -#endif -} diff --git a/src/MDI/fix_mdi_engine.cpp b/src/MDI/fix_mdi_engine.cpp index db9e114488..81eb87a0f3 100644 --- a/src/MDI/fix_mdi_engine.cpp +++ b/src/MDI/fix_mdi_engine.cpp @@ -554,7 +554,7 @@ void FixMDIEngine::send_charges(Error *error) void FixMDIEngine::send_energy(Error *error) { // get conversion factor to atomic units - double energy_conv; + double energy_conv = 1.0; if (lmpunits == REAL) { double kelvin_to_hartree; MDI_Conversion_factor("kelvin_energy", "hartree", &kelvin_to_hartree); @@ -884,10 +884,9 @@ void FixMDIEngine::receive_cell(Error *error) // ensure that the new cell vector is orthogonal double small = std::numeric_limits::min(); - if (abs(celldata[1]) > small or abs(celldata[2]) > small or abs(celldata[3]) > small or - abs(celldata[5]) > small or abs(celldata[6]) > small or abs(celldata[7]) > small) { - error->all(FLERR, - "MDI: LAMMPS currently only supports the >CELL command for orthogonal cell vectors"); + if (fabs(celldata[1]) > small or fabs(celldata[2]) > small or fabs(celldata[3]) > small or + fabs(celldata[5]) > small or fabs(celldata[6]) > small or fabs(celldata[7]) > small) { + error->all(FLERR, "MDI: LAMMPS currently only supports the >CELL command for orthogonal cell vectors"); } // set the new LAMMPS cell dimensions diff --git a/src/ML-RANN/pair_rann.cpp b/src/ML-RANN/pair_rann.cpp index 73ff747c81..faab2d1b2f 100644 --- a/src/ML-RANN/pair_rann.cpp +++ b/src/ML-RANN/pair_rann.cpp @@ -32,6 +32,7 @@ DISTRIBUTION A. Approved for public release; distribution unlimited. OPSEC#4918 #include "pair_rann.h" #include "atom.h" +#include "citeme.h" #include "comm.h" #include "error.h" #include "force.h" @@ -61,7 +62,7 @@ DISTRIBUTION A. Approved for public release; distribution unlimited. OPSEC#4918 using namespace LAMMPS_NS; -static const char cite_user_rann_package[] = +static const char cite_ml_rann_package[] = "ML-RANN package:\n\n" "@Article{Nitol2021,\n" " author = {Nitol, Mashroor S and Dickel, Doyl E and Barrett, Christopher D},\n" @@ -75,6 +76,8 @@ static const char cite_user_rann_package[] = PairRANN::PairRANN(LAMMPS *lmp) : Pair(lmp) { + if (lmp->citeme) lmp->citeme->add(cite_ml_rann_package); + //initialize ints and bools single_enable = 0; restartinfo = 0; @@ -353,7 +356,7 @@ void PairRANN::read_file(char *filename) int eof = 0; std::string line,line1; const int longline = 4096; - int linenum; + int linenum=0; char linetemp[longline]; std::string strtemp; char *ptr; diff --git a/src/OPENMP/pair_lj_cut_coul_cut_dielectric_omp.cpp b/src/OPENMP/pair_lj_cut_coul_cut_dielectric_omp.cpp index 22ae388236..eacb774372 100644 --- a/src/OPENMP/pair_lj_cut_coul_cut_dielectric_omp.cpp +++ b/src/OPENMP/pair_lj_cut_coul_cut_dielectric_omp.cpp @@ -104,11 +104,11 @@ void PairLJCutCoulCutDielectricOMP::compute(int eflag, int vflag) template void PairLJCutCoulCutDielectricOMP::eval(int iifrom, int iito, ThrData *const thr) { - int i, j, ii, jj, jnum, itype, jtype, itable; - double qtmp, etmp, xtmp, ytmp, ztmp, delx, dely, delz, evdwl, ecoul, fpair; + int i, j, ii, jj, jnum, itype, jtype; + double qtmp, etmp, xtmp, ytmp, ztmp, delx, dely, delz, evdwl, ecoul; double fpair_i, fpair_j; - double r, rsq, r2inv, r6inv, forcecoul, forcelj, factor_coul, factor_lj; - double grij, expm2, prefactor, t, erfc, prefactorE, efield_i, epot_i; + double rsq, r2inv, r6inv, forcecoul, forcelj, factor_coul, factor_lj; + double efield_i, epot_i; int *ilist, *jlist, *numneigh, **firstneigh; evdwl = ecoul = 0.0; @@ -221,7 +221,7 @@ void PairLJCutCoulCutDielectricOMP::eval(int iifrom, int iito, ThrData *const th } if (EVFLAG) - ev_tally_thr(this, i, j, nlocal, NEWTON_PAIR, evdwl, ecoul, fpair, delx, dely, delz, thr); + ev_tally_thr(this, i, j, nlocal, NEWTON_PAIR, evdwl, ecoul, fpair_i, delx, dely, delz, thr); } } f[i].x += fxtmp; diff --git a/src/arg_info.cpp b/src/arg_info.cpp index b83bb141fa..a274b47b92 100644 --- a/src/arg_info.cpp +++ b/src/arg_info.cpp @@ -68,11 +68,11 @@ ArgInfo::ArgInfo(const std::string &arg, int allowed) : type(NONE), dim(0), inde } else has_idx2 = arg.size(); - if (arg[has_idx2 - 1] != ']') { + if ((arg[has_idx2 - 1] != ']') || ((dim == 1) && (arg.find(']') != has_idx2 - 1))) { type = UNKNOWN; } else { try { - index1 = std::stoi(arg.substr(has_idx1 + 1, arg.size() - (has_idx2 + 2))); + index1 = std::stoi(arg.substr(has_idx1 + 1, arg.size() - (has_idx1 + 2))); } catch (std::invalid_argument &) { type = UNKNOWN; } diff --git a/src/imbalance_neigh.cpp b/src/imbalance_neigh.cpp index 3a523114ee..0a1c2a87cc 100644 --- a/src/imbalance_neigh.cpp +++ b/src/imbalance_neigh.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 @@ #include "imbalance_neigh.h" +#include "accelerator_kokkos.h" #include "atom.h" #include "comm.h" #include "error.h" @@ -36,9 +36,9 @@ ImbalanceNeigh::ImbalanceNeigh(LAMMPS *lmp) : Imbalance(lmp) int ImbalanceNeigh::options(int narg, char **arg) { - if (narg < 1) error->all(FLERR,"Illegal balance weight command"); - factor = utils::numeric(FLERR,arg[0],false,lmp); - if (factor <= 0.0) error->all(FLERR,"Illegal balance weight command"); + if (narg < 1) error->all(FLERR, "Illegal balance weight command"); + factor = utils::numeric(FLERR, arg[0], false, lmp); + if (factor <= 0.0) error->all(FLERR, "Illegal balance weight command"); return 1; } @@ -50,19 +50,30 @@ void ImbalanceNeigh::compute(double *weight) if (factor == 0.0) return; + // cannot use neighbor list weight with KOKKOS using GPUs + + if (lmp->kokkos && lmp->kokkos->kokkos_exists) { + if (lmp->kokkos->ngpus > 0) { + if (comm->me == 0 && !did_warn) + error->warning(FLERR, "Balance weight neigh skipped with KOKKOS using GPUs"); + did_warn = 1; + return; + } + } + // find suitable neighbor list // can only use certain conventional neighbor lists // NOTE: why not full list, if half does not exist? for (req = 0; req < neighbor->old_nrequest; ++req) { - if (neighbor->old_requests[req]->half && - neighbor->old_requests[req]->skip == 0 && - neighbor->lists[req] && neighbor->lists[req]->numneigh) break; + if (neighbor->old_requests[req]->half && neighbor->old_requests[req]->skip == 0 && + neighbor->lists[req] && neighbor->lists[req]->numneigh) + break; } if (req >= neighbor->old_nrequest || neighbor->ago < 0) { if (comm->me == 0 && !did_warn) - error->warning(FLERR,"Balance weight neigh skipped b/c no list found"); + error->warning(FLERR, "Balance weight neigh skipped b/c no list found"); did_warn = 1; return; } @@ -72,16 +83,16 @@ void ImbalanceNeigh::compute(double *weight) NeighList *list = neighbor->lists[req]; const int inum = list->inum; - const int * const ilist = list->ilist; - const int * const numneigh = list->numneigh; + const int *const ilist = list->ilist; + const int *const numneigh = list->numneigh; int nlocal = atom->nlocal; bigint neighsum = 0; for (int i = 0; i < inum; ++i) neighsum += numneigh[ilist[i]]; double localwt = 0.0; - if (nlocal) localwt = 1.0*neighsum/nlocal; + if (nlocal) localwt = 1.0 * neighsum / nlocal; - if (nlocal && localwt <= 0.0) error->one(FLERR,"Balance weight <= 0.0"); + if (nlocal && localwt <= 0.0) error->one(FLERR, "Balance weight <= 0.0"); // apply factor if specified != 1.0 // wtlo,wthi = lo/hi values excluding 0.0 due to no atoms on this proc @@ -90,15 +101,15 @@ void ImbalanceNeigh::compute(double *weight) // expand/contract all localwt values from lo->hi to lo->newhi if (factor != 1.0) { - double wtlo,wthi; + double wtlo, wthi; if (localwt == 0.0) localwt = BIG; - MPI_Allreduce(&localwt,&wtlo,1,MPI_DOUBLE,MPI_MIN,world); + MPI_Allreduce(&localwt, &wtlo, 1, MPI_DOUBLE, MPI_MIN, world); if (localwt == BIG) localwt = 0.0; - MPI_Allreduce(&localwt,&wthi,1,MPI_DOUBLE,MPI_MAX,world); + MPI_Allreduce(&localwt, &wthi, 1, MPI_DOUBLE, MPI_MAX, world); if (wtlo == wthi) return; - double newhi = wthi*factor; - localwt = wtlo + ((localwt-wtlo)/(wthi-wtlo)) * (newhi-wtlo); + double newhi = wthi * factor; + localwt = wtlo + ((localwt - wtlo) / (wthi - wtlo)) * (newhi - wtlo); } for (int i = 0; i < nlocal; i++) weight[i] *= localwt; @@ -108,5 +119,5 @@ void ImbalanceNeigh::compute(double *weight) std::string ImbalanceNeigh::info() { - return fmt::format(" neighbor weight factor: {}\n",factor); + return fmt::format(" neighbor weight factor: {}\n", factor); } diff --git a/src/read_restart.cpp b/src/read_restart.cpp index ac00a7d086..faf9fd1620 100644 --- a/src/read_restart.cpp +++ b/src/read_restart.cpp @@ -71,16 +71,18 @@ void ReadRestart::command(int narg, char **arg) // if filename contains "*", search dir for latest restart file - char *file = new char[strlen(arg[0]) + 16]; + char *file; if (strchr(arg[0],'*')) { - int n; + int n=0; if (me == 0) { - file_search(arg[0],file); - n = strlen(file) + 1; + auto fn = file_search(arg[0]); + n = fn.size()+1; + file = utils::strdup(fn); } MPI_Bcast(&n,1,MPI_INT,0,world); + if (me != 0) file = new char[n]; MPI_Bcast(file,n,MPI_CHAR,0,world); - } else strcpy(file,arg[0]); + } else file = utils::strdup(arg[0]); // check for multiproc files and an MPI-IO filename @@ -90,14 +92,12 @@ void ReadRestart::command(int narg, char **arg) else mpiioflag = 0; if (multiproc && mpiioflag) - error->all(FLERR, - "Read restart MPI-IO input not allowed with % in filename"); + error->all(FLERR,"Read restart MPI-IO input not allowed with % in filename"); if (mpiioflag) { mpiio = new RestartMPIIO(lmp); if (!mpiio->mpiio_exists) - error->all(FLERR,"Reading from MPI-IO filename when " - "MPIIO package is not installed"); + error->all(FLERR,"Reading from MPI-IO filename when MPIIO package is not installed"); } // open single restart file or base file for multiproc case @@ -538,83 +538,45 @@ void ReadRestart::command(int narg, char **arg) only called by proc 0 ------------------------------------------------------------------------- */ -void ReadRestart::file_search(char *inpfile, char *outfile) +std::string ReadRestart::file_search(const std::string &inpfile) { - char *ptr; - // separate inpfile into dir + filename - char *dirname = new char[strlen(inpfile) + 1]; - char *filename = new char[strlen(inpfile) + 1]; - - if (strchr(inpfile,'/')) { - ptr = strrchr(inpfile,'/'); - *ptr = '\0'; - strcpy(dirname,inpfile); - strcpy(filename,ptr+1); - *ptr = '/'; - } else { - strcpy(dirname,"./"); - strcpy(filename,inpfile); - } + auto dirname = utils::path_dirname(inpfile); + auto filename = utils::path_basename(inpfile); // if filename contains "%" replace "%" with "base" - char *pattern = new char[strlen(filename) + 16]; + auto pattern = filename; + auto loc = pattern.find('%'); + if (loc != std::string::npos) pattern.replace(loc,1,"base"); - if ((ptr = strchr(filename,'%'))) { - *ptr = '\0'; - sprintf(pattern,"%s%s%s",filename,"base",ptr+1); - *ptr = '%'; - } else strcpy(pattern,filename); + // scan all files in directory, searching for files that match regexp pattern + // maxnum = largest integer that matches "*" - // scan all files in directory, searching for files that match pattern - // maxnum = largest int that matches "*" - - int n = strlen(pattern) + 16; - char *begin = new char[n]; - char *middle = new char[n]; - char *end = new char[n]; - - ptr = strchr(pattern,'*'); - *ptr = '\0'; - strcpy(begin,pattern); - strcpy(end,ptr+1); - int nbegin = strlen(begin); bigint maxnum = -1; + loc = pattern.find('*'); + if (loc != std::string::npos) { + // convert pattern to equivalent regexp + pattern.replace(loc,1,"\\d+"); + struct dirent *ep; + DIR *dp = opendir(dirname.c_str()); + if (dp == nullptr) + error->one(FLERR,"Cannot open directory {} to search for restart file: {}", + dirname, utils::getsyserror()); - struct dirent *ep; - DIR *dp = opendir(dirname); - if (dp == nullptr) - error->one(FLERR,"Cannot open dir to search for restart file"); - while ((ep = readdir(dp))) { - if (strstr(ep->d_name,begin) != ep->d_name) continue; - if ((ptr = strstr(&ep->d_name[nbegin],end)) == nullptr) continue; - if (strlen(end) == 0) ptr = ep->d_name + strlen(ep->d_name); - *ptr = '\0'; - if ((int)strlen(&ep->d_name[nbegin]) < n) { - strcpy(middle,&ep->d_name[nbegin]); - if (ATOBIGINT(middle) > maxnum) maxnum = ATOBIGINT(middle); + while ((ep = readdir(dp))) { + std::string candidate(ep->d_name); + if (utils::strmatch(candidate,pattern)) { + bigint num = ATOBIGINT(utils::strfind(candidate.substr(loc),"\\d+").c_str()); + if (num > maxnum) maxnum = num; + } } + closedir(dp); + if (maxnum < 0) error->one(FLERR,"Found no restart file matching pattern"); + filename.replace(filename.find('*'),1,std::to_string(maxnum)); } - closedir(dp); - if (maxnum < 0) error->one(FLERR,"Found no restart file matching pattern"); - - // create outfile with maxint substituted for "*" - // use original inpfile, not pattern, since need to retain "%" in filename - - std::string newoutfile = inpfile; - newoutfile.replace(newoutfile.find("*"),1,fmt::format("{}",maxnum)); - strcpy(outfile,newoutfile.c_str()); - - // clean up - - delete [] dirname; - delete [] filename; - delete [] pattern; - delete [] begin; - delete [] middle; - delete [] end; + return utils::path_join(dirname,filename); } /* ---------------------------------------------------------------------- diff --git a/src/read_restart.h b/src/read_restart.h index a3f889fbc3..9de52a5f28 100644 --- a/src/read_restart.h +++ b/src/read_restart.h @@ -46,7 +46,7 @@ class ReadRestart : public Command { bigint assignedChunkSize; MPI_Offset assignedChunkOffset, headerOffset; - void file_search(char *, char *); + std::string file_search(const std::string &); void header(); void type_arrays(); void force_fields(); diff --git a/src/utils.h b/src/utils.h index 7df9368b4d..b761534d66 100644 --- a/src/utils.h +++ b/src/utils.h @@ -45,7 +45,7 @@ namespace utils { * * \param text the text to be matched against the pattern * \param pattern the search pattern, which may contain regexp markers - * \return the string that matches the patters or an empty one */ + * \return the string that matches the pattern or an empty one */ std::string strfind(const std::string &text, const std::string &pattern); diff --git a/unittest/tools/test_lammps_shell.py b/unittest/tools/test_lammps_shell.py index 1768bcf753..15cb259f84 100644 --- a/unittest/tools/test_lammps_shell.py +++ b/unittest/tools/test_lammps_shell.py @@ -94,25 +94,25 @@ class LammpsShell(unittest.TestCase): def testExpandComputeGroup(self): """Test expansion of a group-ID and a compute command""" - matches = re.findall(cmd_group_re, self.InputRunner(b'compute test al\tcentro/at\t\n'), re.MULTILINE) + matches = re.findall(cmd_group_re, self.InputRunner(b'compute test al\tstress/at\t\n'), re.MULTILINE) if self.timeout: self.fail("Timeout") else: self.assertEqual(matches[0][1],"compute") self.assertEqual(matches[0][2],"test") self.assertEqual(matches[0][3],"all") - self.assertEqual(matches[0][4],"centro/atom") + self.assertEqual(matches[0][4],"stress/atom") def testExpandFixGroup(self): """Test expansion of a group-ID and a fix command""" - matches = re.findall(cmd_group_re, self.InputRunner(b'fix test al\tcontroll\t\n'), re.MULTILINE) + matches = re.findall(cmd_group_re, self.InputRunner(b'fix test al\tpropert\t\n'), re.MULTILINE) if self.timeout: self.fail("Timeout") else: self.assertEqual(matches[0][1],"fix") self.assertEqual(matches[0][2],"test") self.assertEqual(matches[0][3],"all") - self.assertEqual(matches[0][4],"controller") + self.assertEqual(matches[0][4],"property/atom") def testExpandSource(self): """Test expansion of a shell command and a file name""" diff --git a/unittest/utils/test_argutils.cpp b/unittest/utils/test_argutils.cpp index 7d4653cc13..a527df6fe7 100644 --- a/unittest/utils/test_argutils.cpp +++ b/unittest/utils/test_argutils.cpp @@ -51,10 +51,10 @@ TEST(ArgInfo, compute0) TEST(ArgInfo, compute1) { - ArgInfo arg("c_1[5]", ArgInfo::COMPUTE); + ArgInfo arg("c_1[15]", ArgInfo::COMPUTE); ASSERT_EQ(arg.get_dim(), 1); ASSERT_EQ(arg.get_type(), ArgInfo::COMPUTE); - ASSERT_EQ(arg.get_index1(), 5); + ASSERT_EQ(arg.get_index1(), 15); ASSERT_EQ(arg.get_index2(), -1); ASSERT_THAT(arg.get_name(), StrEq("1")); } @@ -69,6 +69,26 @@ TEST(ArgInfo, compute2) ASSERT_THAT(arg.get_name(), StrEq("text")); } +TEST(ArgInfo, compute3) +{ + ArgInfo arg("c_text[08123][51]", ArgInfo::COMPUTE | ArgInfo::FIX); + ASSERT_EQ(arg.get_dim(), 2); + ASSERT_EQ(arg.get_type(), ArgInfo::COMPUTE); + ASSERT_EQ(arg.get_index1(), 8123); + ASSERT_EQ(arg.get_index2(), 51); + ASSERT_THAT(arg.get_name(), StrEq("text")); +} + +TEST(ArgInfo, compute4) +{ + ArgInfo arg("c_text[111][0125]", ArgInfo::COMPUTE | ArgInfo::FIX); + ASSERT_EQ(arg.get_dim(), 2); + ASSERT_EQ(arg.get_type(), ArgInfo::COMPUTE); + ASSERT_EQ(arg.get_index1(), 111); + ASSERT_EQ(arg.get_index2(), 125); + ASSERT_THAT(arg.get_name(), StrEq("text")); +} + TEST(ArgInfo, fix0) { ArgInfo arg("f_2"); @@ -99,6 +119,26 @@ TEST(ArgInfo, fix2) ASSERT_THAT(arg.get_name(), StrEq("text")); } +TEST(ArgInfo, fix3) +{ + ArgInfo arg("f_text[1234][5]", ArgInfo::FIX); + ASSERT_EQ(arg.get_dim(), 2); + ASSERT_EQ(arg.get_type(), ArgInfo::FIX); + ASSERT_EQ(arg.get_index1(), 1234); + ASSERT_EQ(arg.get_index2(), 5); + ASSERT_THAT(arg.get_name(), StrEq("text")); +} + +TEST(ArgInfo, fix4) +{ + ArgInfo arg("f_text[22][120]", ArgInfo::FIX); + ASSERT_EQ(arg.get_dim(), 2); + ASSERT_EQ(arg.get_type(), ArgInfo::FIX); + ASSERT_EQ(arg.get_index1(), 22); + ASSERT_EQ(arg.get_index2(), 120); + ASSERT_THAT(arg.get_name(), StrEq("text")); +} + TEST(ArgInfo, variable0) { ArgInfo arg("v_text"); @@ -169,19 +209,25 @@ TEST(ArgInfo, unsupported3) TEST(ArgInfo, no_bracket1) { - ArgInfo arg("v_text[2"); + ArgInfo arg("v_text[22"); ASSERT_EQ(arg.get_type(), ArgInfo::UNKNOWN); } TEST(ArgInfo, no_bracket2) { - ArgInfo arg("v_text[2][1"); + ArgInfo arg("v_text[123][12"); ASSERT_EQ(arg.get_type(), ArgInfo::UNKNOWN); } TEST(ArgInfo, no_bracket3) { - ArgInfo arg("v_text[2[1]"); + ArgInfo arg("v_text[2[11]"); + ASSERT_EQ(arg.get_type(), ArgInfo::UNKNOWN); +} + +TEST(ArgInfo, no_bracket4) +{ + ArgInfo arg("v_text[25]021]"); ASSERT_EQ(arg.get_type(), ArgInfo::UNKNOWN); }