diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index f99a336dbb..9b316fbeb9 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -135,6 +135,7 @@ src/timer.* @akohlmey src/utils.* @akohlmey @rbberger src/verlet.* @sjplimp @stanmoore1 src/math_eigen_impl.h @jewettaij +src/fix_press_langevin.* @Bibobu # tools tools/coding_standard/* @akohlmey @rbberger diff --git a/doc/src/variable.rst b/doc/src/variable.rst index f1a316da1f..3407b48156 100644 --- a/doc/src/variable.rst +++ b/doc/src/variable.rst @@ -1183,7 +1183,7 @@ table: +--------+------------+------------------------------------------+ | vector | c_ID | global vector | | vector | c_ID[I] | column of global array | ----------+------------+------------------------------------------+ ++--------+------------+------------------------------------------+ | atom | c_ID | per-atom vector | | atom | c_ID[I] | column of per-atom array | +--------+------------+------------------------------------------+ @@ -1247,7 +1247,7 @@ and atom-style variables are listed in the following table: +--------+------------+------------------------------------------+ | vector | f_ID | global vector | | vector | f_ID[I] | column of global array | ----------+------------+------------------------------------------+ ++--------+------------+------------------------------------------+ | atom | f_ID | per-atom vector | | atom | f_ID[I] | column of per-atom array | +--------+------------+------------------------------------------+ diff --git a/src/EXTRA-DUMP/dump_yaml.cpp b/src/EXTRA-DUMP/dump_yaml.cpp index 3ca5c59edf..6c21c24f77 100644 --- a/src/EXTRA-DUMP/dump_yaml.cpp +++ b/src/EXTRA-DUMP/dump_yaml.cpp @@ -24,6 +24,8 @@ using namespace LAMMPS_NS; +static constexpr char special_chars[] = "{}[],&:*#?|-<>=!%@\\"; + /* ---------------------------------------------------------------------- */ DumpYAML::DumpYAML(class LAMMPS *_lmp, int narg, char **args) : DumpCustom(_lmp, narg, args), thermo(false) @@ -67,7 +69,12 @@ void DumpYAML::write_header(bigint ndump) const auto &fields = th->get_fields(); thermo_data += "thermo:\n - keywords: [ "; - for (int i = 0; i < nfield; ++i) thermo_data += fmt::format("{}, ", keywords[i]); + for (int i = 0; i < nfield; ++i) { + if (keywords[i].find_first_of(special_chars) == std::string::npos) + thermo_data += fmt::format("{}, ", keywords[i]); + else + thermo_data += fmt::format("'{}', ", keywords[i]); + } thermo_data += "]\n - data: [ "; for (int i = 0; i < nfield; ++i) { @@ -107,7 +114,12 @@ void DumpYAML::write_header(bigint ndump) if (domain->triclinic) fmt::print(fp, " - [ {}, {}, {} ]\n", boxxy, boxxz, boxyz); fmt::print(fp, "keywords: [ "); - for (const auto &item : utils::split_words(columns)) fmt::print(fp, "{}, ", item); + for (const auto &item : utils::split_words(columns)) { + if (item.find_first_of(special_chars) == std::string::npos) + fmt::print(fp, "{}, ", item); + else + fmt::print(fp, "'{}', ", item); + } fputs(" ]\ndata:\n", fp); } else // reset so that the remainder of the output is not multi-proc filewriter = 0; diff --git a/src/KOKKOS/min_kokkos.cpp b/src/KOKKOS/min_kokkos.cpp index 4e1c3967ff..bbb9a0bd6e 100644 --- a/src/KOKKOS/min_kokkos.cpp +++ b/src/KOKKOS/min_kokkos.cpp @@ -59,6 +59,9 @@ void MinKokkos::init() { Min::init(); + if (!fix_minimize->kokkosable) + error->all(FLERR,"KOKKOS package requires fix minimize/kk"); + fix_minimize_kk = (FixMinimizeKokkos*) fix_minimize; } diff --git a/src/KOKKOS/npair_halffull_kokkos.h b/src/KOKKOS/npair_halffull_kokkos.h index 98526c7fee..3eee19b8c3 100644 --- a/src/KOKKOS/npair_halffull_kokkos.h +++ b/src/KOKKOS/npair_halffull_kokkos.h @@ -16,7 +16,7 @@ // Trim off -// Newton, no triclinic +// Newton, no triclinic typedef NPairHalffullKokkos NPairKokkosHalffullNewtonDevice; NPairStyle(halffull/newton/kk/device, diff --git a/src/KOKKOS/npair_kokkos.cpp b/src/KOKKOS/npair_kokkos.cpp index f677b3a1bf..45ec83e90e 100644 --- a/src/KOKKOS/npair_kokkos.cpp +++ b/src/KOKKOS/npair_kokkos.cpp @@ -1354,7 +1354,7 @@ void NeighborKokkosExecute::build_ItemSizeGPU(typename Kokkos::TeamP other_x[MY_II + 2 * atoms_per_bin] = ztmp; other_x[MY_II + 3 * atoms_per_bin] = itype; other_x[MY_II + 4 * atoms_per_bin] = radi; - if (HalfNeigh && Newton && Tri) { + if (HalfNeigh && Newton && Tri) { itag = tag(i); other_x[MY_II + 5 * atoms_per_bin] = itag; } diff --git a/src/KOKKOS/pair_snap_kokkos_impl.h b/src/KOKKOS/pair_snap_kokkos_impl.h index 91f432dbaf..7b9fda60db 100644 --- a/src/KOKKOS/pair_snap_kokkos_impl.h +++ b/src/KOKKOS/pair_snap_kokkos_impl.h @@ -63,10 +63,6 @@ PairSNAPKokkos::PairSNAPKokkos(LAMMPS *lmp datamask_read = EMPTY_MASK; datamask_modify = EMPTY_MASK; - k_cutsq = tdual_fparams("PairSNAPKokkos::cutsq",atom->ntypes+1,atom->ntypes+1); - auto d_cutsq = k_cutsq.template view(); - rnd_cutsq = d_cutsq; - host_flag = (execution_space == Host); } @@ -546,6 +542,9 @@ void PairSNAPKokkos::allocate() int n = atom->ntypes; MemKK::realloc_kokkos(d_map,"PairSNAPKokkos::map",n+1); + + MemKK::realloc_kokkos(k_cutsq,"PairSNAPKokkos::cutsq",n+1,n+1); + rnd_cutsq = k_cutsq.template view(); } 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 7faa210107..1c6d025fab 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 @@ -87,6 +87,7 @@ void NPairHalfSizeMultiOldNewtonTriOmp::build(NeighList *list) n = 0; neighptr = ipage.vget(); + itag = tag[i]; itype = type[i]; xtmp = x[i][0]; ytmp = x[i][1]; diff --git a/src/balance.cpp b/src/balance.cpp index 3bd083e2b9..6f28081f13 100644 --- a/src/balance.cpp +++ b/src/balance.cpp @@ -473,7 +473,7 @@ void Balance::options(int iarg, int narg, char **arg, int sortflag_default) } iarg += 2+nopt; - } else if (strcmp(arg[iarg+1],"sort") == 0) { + } else if (strcmp(arg[iarg],"sort") == 0) { if (iarg+2 > narg) utils::missing_cmd_args(FLERR, "balance sort", error); sortflag = utils::logical(FLERR,arg[iarg+1],false,lmp); iarg += 2; diff --git a/src/fix_press_langevin.cpp b/src/fix_press_langevin.cpp index d8b90d8b49..2f6e765cd5 100644 --- a/src/fix_press_langevin.cpp +++ b/src/fix_press_langevin.cpp @@ -46,7 +46,8 @@ enum { ISO, ANISO, TRICLINIC }; /* ---------------------------------------------------------------------- */ FixPressLangevin::FixPressLangevin(LAMMPS *lmp, int narg, char **arg) : - Fix(lmp, narg, arg), id_press(nullptr), pflag(0), random(nullptr), irregular(nullptr) + Fix(lmp, narg, arg), id_temp(nullptr), id_press(nullptr), temperature(nullptr), + pressure(nullptr), irregular(nullptr), random(nullptr) { if (narg < 5) utils::missing_cmd_args(FLERR, "fix press/langevin", error); @@ -62,6 +63,9 @@ FixPressLangevin::FixPressLangevin(LAMMPS *lmp, int narg, char **arg) : allremap = 1; pre_exchange_flag = 0; flipflag = 1; + seed = 111111; + pflag = 0; + kspace_flag = 0; p_ltime = 0.0; @@ -239,7 +243,7 @@ FixPressLangevin::FixPressLangevin(LAMMPS *lmp, int narg, char **arg) : t_start = utils::numeric(FLERR, arg[iarg + 1], false, lmp); t_stop = utils::numeric(FLERR, arg[iarg + 2], false, lmp); seed = utils::numeric(FLERR, arg[iarg + 3], false, lmp); - if (seed <= 0.0) error->all(FLERR, "Fix press/langevin temp seed must be > 0"); + if (seed <= 0) error->all(FLERR, "Fix press/langevin temp seed must be > 0"); iarg += 4; } @@ -349,7 +353,7 @@ FixPressLangevin::FixPressLangevin(LAMMPS *lmp, int narg, char **arg) : // Kinetic contribution will be added by the fix style id_press = utils::strdup(std::string(id) + "_press"); - modify->add_compute(fmt::format("{} all pressure NULL virial", id_press)); + pressure = modify->add_compute(fmt::format("{} all pressure NULL virial", id_press)); pflag = 1; // p_fric is alpha coeff from GJF @@ -482,7 +486,7 @@ void FixPressLangevin::initial_integrate(int /* vflag */) if (delta != 0.0) delta /= update->endstep - update->beginstep; t_target = t_start + delta * (t_stop - t_start); - couple_beta(t_target); + couple_beta(); dt = update->dt; @@ -492,11 +496,12 @@ void FixPressLangevin::initial_integrate(int /* vflag */) displacement = dt * p_deriv[i] * gjfb[i]; displacement += 0.5 * dt * dt * f_piston[i] * gjfb[i] / p_mass[i]; displacement += 0.5 * dt * fran[i] * gjfb[i] / p_mass[i]; - dl = domain->boxhi[i] - domain->boxlo[i]; - if (i < 3) + if (i < 3) { + dl = domain->boxhi[i] - domain->boxlo[i]; dilation[i] = (dl + displacement) / dl; - else + } else { dilation[i] = displacement; + } } } } @@ -527,7 +532,7 @@ void FixPressLangevin::post_force(int /*vflag*/) } couple_pressure(); - couple_kinetic(t_target); + couple_kinetic(); for (int i = 0; i < 6; i++) { if (p_flag[i]) { @@ -594,10 +599,9 @@ void FixPressLangevin::couple_pressure() } /* ---------------------------------------------------------------------- */ -void FixPressLangevin::couple_kinetic(double t_target) +void FixPressLangevin::couple_kinetic() { double pk, volume; - nktv2p = force->nktv2p; // kinetic part @@ -607,7 +611,7 @@ void FixPressLangevin::couple_kinetic(double t_target) volume = domain->xprd * domain->yprd; pk = atom->natoms * force->boltz * t_target / volume; - pk *= nktv2p; + pk *= force->nktv2p; p_current[0] += pk; p_current[1] += pk; @@ -616,7 +620,7 @@ void FixPressLangevin::couple_kinetic(double t_target) /* ---------------------------------------------------------------------- */ -void FixPressLangevin::couple_beta(double t_target) +void FixPressLangevin::couple_beta() { double gamma[6]; int me = comm->me; @@ -812,7 +816,7 @@ int FixPressLangevin::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; diff --git a/src/fix_press_langevin.h b/src/fix_press_langevin.h index fc9f39c434..868993b1f4 100644 --- a/src/fix_press_langevin.h +++ b/src/fix_press_langevin.h @@ -40,10 +40,9 @@ class FixPressLangevin : public Fix { int modify_param(int, char **) override; protected: - int dimension, which; + int dimension; int pstyle, pcouple, allremap; int p_flag[6]; // 1 if control P on this dim, 0 if not - double nktv2p; double t_start, t_stop, t_target; double p_fric[6], p_ltime; // Friction and Langevin charac. time double p_alpha[6]; @@ -68,8 +67,8 @@ class FixPressLangevin : public Fix { int seed; void couple_pressure(); - void couple_kinetic(double); - void couple_beta(double); + void couple_kinetic(); + void couple_beta(); void remap(); }; diff --git a/src/fix_property_atom.cpp b/src/fix_property_atom.cpp index 3a53110839..9613523059 100644 --- a/src/fix_property_atom.cpp +++ b/src/fix_property_atom.cpp @@ -46,6 +46,7 @@ FixPropertyAtom::FixPropertyAtom(LAMMPS *lmp, int narg, char **arg) : rmass_flag = 0; temperature_flag = 0; heatflow_flag = 0; + nmax_old = 0; nvalue = 0; values_peratom = 0; @@ -212,7 +213,6 @@ void FixPropertyAtom::post_constructor() { // perform initial allocation of atom-based array - nmax_old = 0; grow_arrays(atom->nmax); } diff --git a/src/min.cpp b/src/min.cpp index 5a469a788b..acc7d17654 100644 --- a/src/min.cpp +++ b/src/min.cpp @@ -215,6 +215,9 @@ void Min::setup(int flag) } update->setupflag = 1; + if (lmp->kokkos) + error->all(FLERR,"KOKKOS package requires Kokkos-enabled min_style"); + // setup extra global dof due to fixes // cannot be done in init() b/c update init() is before modify init() diff --git a/tools/lammps-gui/CMakeLists.txt b/tools/lammps-gui/CMakeLists.txt index edfeeb1128..e83db05fdd 100644 --- a/tools/lammps-gui/CMakeLists.txt +++ b/tools/lammps-gui/CMakeLists.txt @@ -110,14 +110,15 @@ endif() # we require Qt 5 and at least version 5.12 at that. if(NOT LAMMPS_GUI_USE_QT5) - find_package(Qt6 6.2 COMPONENTS Widgets Charts) + find_package(Qt6 6.2 QUIET COMPONENTS Widgets Charts) endif() if(NOT Qt6_FOUND) find_package(Qt5 5.12 REQUIRED COMPONENTS Widgets Charts) - set(QT_VERSION_MAJOR "5") + set(QT_VERSION_MAJOR 5) else() - set(QT_VERSION_MAJOR "6") + set(QT_VERSION_MAJOR 6) endif() +message(STATUS "Using Qt version ${Qt${QT_VERSION_MAJOR}_VERSION} for LAMMPS GUI") set(PROJECT_SOURCES main.cpp @@ -188,7 +189,7 @@ else() endif() target_include_directories(lammps-gui PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}) target_compile_definitions(lammps-gui PRIVATE LAMMPS_GUI_VERSION="${PROJECT_VERSION}") -target_link_libraries(lammps-gui PRIVATE Qt${QT_VERSION_MAJOR}::Widgets Qt${VERSION_MAJOR}::Charts) +target_link_libraries(lammps-gui PRIVATE Qt${QT_VERSION_MAJOR}::Widgets Qt${QT_VERSION_MAJOR}::Charts) if(BUILD_OMP) find_package(OpenMP COMPONENTS CXX REQUIRED) target_link_libraries(lammps-gui PRIVATE OpenMP::OpenMP_CXX) diff --git a/tools/lammps-gui/lammpsgui.cpp b/tools/lammps-gui/lammpsgui.cpp index 11f2554b55..37b8aebf88 100644 --- a/tools/lammps-gui/lammpsgui.cpp +++ b/tools/lammps-gui/lammpsgui.cpp @@ -1432,12 +1432,12 @@ void LammpsGui::start_lammps() lammps.open(narg, args); lammpsstatus->show(); - // must have at least 2 August 2023 version of LAMMPS + // must have a version newer than the 2 August 2023 release of LAMMPS // TODO: must update this check before next feature release - if (lammps.version() < 20230802) { + if (lammps.version() <= 20230802) { QMessageBox::critical(this, "Incompatible LAMMPS Version", "LAMMPS-GUI version " LAMMPS_GUI_VERSION " requires\n" - "LAMMPS version 2 August 2023 or later"); + "a LAMMPS version more recent than 2 August 2023"); exit(1); }