Merge branch 'develop' into fix-srd-doc-page

This commit is contained in:
Axel Kohlmeyer 2023-10-20 20:47:17 -04:00
commit 4aedba058c
No known key found for this signature in database
GPG Key ID: D9B44E93BF0C375A
15 changed files with 59 additions and 36 deletions

1
.github/CODEOWNERS vendored
View File

@ -135,6 +135,7 @@ src/timer.* @akohlmey
src/utils.* @akohlmey @rbberger src/utils.* @akohlmey @rbberger
src/verlet.* @sjplimp @stanmoore1 src/verlet.* @sjplimp @stanmoore1
src/math_eigen_impl.h @jewettaij src/math_eigen_impl.h @jewettaij
src/fix_press_langevin.* @Bibobu
# tools # tools
tools/coding_standard/* @akohlmey @rbberger tools/coding_standard/* @akohlmey @rbberger

View File

@ -1183,7 +1183,7 @@ table:
+--------+------------+------------------------------------------+ +--------+------------+------------------------------------------+
| vector | c_ID | global vector | | vector | c_ID | global vector |
| vector | c_ID[I] | column of global array | | vector | c_ID[I] | column of global array |
---------+------------+------------------------------------------+ +--------+------------+------------------------------------------+
| atom | c_ID | per-atom vector | | atom | c_ID | per-atom vector |
| atom | c_ID[I] | column of per-atom array | | 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 | global vector |
| vector | f_ID[I] | column of global array | | vector | f_ID[I] | column of global array |
---------+------------+------------------------------------------+ +--------+------------+------------------------------------------+
| atom | f_ID | per-atom vector | | atom | f_ID | per-atom vector |
| atom | f_ID[I] | column of per-atom array | | atom | f_ID[I] | column of per-atom array |
+--------+------------+------------------------------------------+ +--------+------------+------------------------------------------+

View File

@ -24,6 +24,8 @@
using namespace LAMMPS_NS; using namespace LAMMPS_NS;
static constexpr char special_chars[] = "{}[],&:*#?|-<>=!%@\\";
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
DumpYAML::DumpYAML(class LAMMPS *_lmp, int narg, char **args) : DumpYAML::DumpYAML(class LAMMPS *_lmp, int narg, char **args) :
DumpCustom(_lmp, narg, args), thermo(false) DumpCustom(_lmp, narg, args), thermo(false)
@ -67,7 +69,12 @@ void DumpYAML::write_header(bigint ndump)
const auto &fields = th->get_fields(); const auto &fields = th->get_fields();
thermo_data += "thermo:\n - keywords: [ "; 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: [ "; thermo_data += "]\n - data: [ ";
for (int i = 0; i < nfield; ++i) { 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); if (domain->triclinic) fmt::print(fp, " - [ {}, {}, {} ]\n", boxxy, boxxz, boxyz);
fmt::print(fp, "keywords: [ "); 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); fputs(" ]\ndata:\n", fp);
} else // reset so that the remainder of the output is not multi-proc } else // reset so that the remainder of the output is not multi-proc
filewriter = 0; filewriter = 0;

View File

@ -59,6 +59,9 @@ void MinKokkos::init()
{ {
Min::init(); Min::init();
if (!fix_minimize->kokkosable)
error->all(FLERR,"KOKKOS package requires fix minimize/kk");
fix_minimize_kk = (FixMinimizeKokkos*) fix_minimize; fix_minimize_kk = (FixMinimizeKokkos*) fix_minimize;
} }

View File

@ -16,7 +16,7 @@
// Trim off // Trim off
// Newton, no triclinic // Newton, no triclinic
typedef NPairHalffullKokkos<LMPDeviceType,1,0,0> NPairKokkosHalffullNewtonDevice; typedef NPairHalffullKokkos<LMPDeviceType,1,0,0> NPairKokkosHalffullNewtonDevice;
NPairStyle(halffull/newton/kk/device, NPairStyle(halffull/newton/kk/device,

View File

@ -1354,7 +1354,7 @@ void NeighborKokkosExecute<DeviceType>::build_ItemSizeGPU(typename Kokkos::TeamP
other_x[MY_II + 2 * atoms_per_bin] = ztmp; other_x[MY_II + 2 * atoms_per_bin] = ztmp;
other_x[MY_II + 3 * atoms_per_bin] = itype; other_x[MY_II + 3 * atoms_per_bin] = itype;
other_x[MY_II + 4 * atoms_per_bin] = radi; other_x[MY_II + 4 * atoms_per_bin] = radi;
if (HalfNeigh && Newton && Tri) { if (HalfNeigh && Newton && Tri) {
itag = tag(i); itag = tag(i);
other_x[MY_II + 5 * atoms_per_bin] = itag; other_x[MY_II + 5 * atoms_per_bin] = itag;
} }

View File

@ -63,10 +63,6 @@ PairSNAPKokkos<DeviceType, real_type, vector_length>::PairSNAPKokkos(LAMMPS *lmp
datamask_read = EMPTY_MASK; datamask_read = EMPTY_MASK;
datamask_modify = 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<DeviceType>();
rnd_cutsq = d_cutsq;
host_flag = (execution_space == Host); host_flag = (execution_space == Host);
} }
@ -546,6 +542,9 @@ void PairSNAPKokkos<DeviceType, real_type, vector_length>::allocate()
int n = atom->ntypes; int n = atom->ntypes;
MemKK::realloc_kokkos(d_map,"PairSNAPKokkos::map",n+1); 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<DeviceType>();
} }

View File

@ -87,6 +87,7 @@ void NPairHalfSizeMultiOldNewtonTriOmp::build(NeighList *list)
n = 0; n = 0;
neighptr = ipage.vget(); neighptr = ipage.vget();
itag = tag[i];
itype = type[i]; itype = type[i];
xtmp = x[i][0]; xtmp = x[i][0];
ytmp = x[i][1]; ytmp = x[i][1];

View File

@ -473,7 +473,7 @@ void Balance::options(int iarg, int narg, char **arg, int sortflag_default)
} }
iarg += 2+nopt; 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); if (iarg+2 > narg) utils::missing_cmd_args(FLERR, "balance sort", error);
sortflag = utils::logical(FLERR,arg[iarg+1],false,lmp); sortflag = utils::logical(FLERR,arg[iarg+1],false,lmp);
iarg += 2; iarg += 2;

View File

@ -46,7 +46,8 @@ enum { ISO, ANISO, TRICLINIC };
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
FixPressLangevin::FixPressLangevin(LAMMPS *lmp, int narg, char **arg) : 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); 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; allremap = 1;
pre_exchange_flag = 0; pre_exchange_flag = 0;
flipflag = 1; flipflag = 1;
seed = 111111;
pflag = 0;
kspace_flag = 0;
p_ltime = 0.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_start = utils::numeric(FLERR, arg[iarg + 1], false, lmp);
t_stop = utils::numeric(FLERR, arg[iarg + 2], false, lmp); t_stop = utils::numeric(FLERR, arg[iarg + 2], false, lmp);
seed = utils::numeric(FLERR, arg[iarg + 3], 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; iarg += 4;
} }
@ -349,7 +353,7 @@ FixPressLangevin::FixPressLangevin(LAMMPS *lmp, int narg, char **arg) :
// Kinetic contribution will be added by the fix style // Kinetic contribution will be added by the fix style
id_press = utils::strdup(std::string(id) + "_press"); 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; pflag = 1;
// p_fric is alpha coeff from GJF // 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; if (delta != 0.0) delta /= update->endstep - update->beginstep;
t_target = t_start + delta * (t_stop - t_start); t_target = t_start + delta * (t_stop - t_start);
couple_beta(t_target); couple_beta();
dt = update->dt; dt = update->dt;
@ -492,11 +496,12 @@ void FixPressLangevin::initial_integrate(int /* vflag */)
displacement = dt * p_deriv[i] * gjfb[i]; displacement = dt * p_deriv[i] * gjfb[i];
displacement += 0.5 * dt * dt * f_piston[i] * gjfb[i] / p_mass[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]; 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; dilation[i] = (dl + displacement) / dl;
else } else {
dilation[i] = displacement; dilation[i] = displacement;
}
} }
} }
} }
@ -527,7 +532,7 @@ void FixPressLangevin::post_force(int /*vflag*/)
} }
couple_pressure(); couple_pressure();
couple_kinetic(t_target); couple_kinetic();
for (int i = 0; i < 6; i++) { for (int i = 0; i < 6; i++) {
if (p_flag[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; double pk, volume;
nktv2p = force->nktv2p;
// kinetic part // kinetic part
@ -607,7 +611,7 @@ void FixPressLangevin::couple_kinetic(double t_target)
volume = domain->xprd * domain->yprd; volume = domain->xprd * domain->yprd;
pk = atom->natoms * force->boltz * t_target / volume; pk = atom->natoms * force->boltz * t_target / volume;
pk *= nktv2p; pk *= force->nktv2p;
p_current[0] += pk; p_current[0] += pk;
p_current[1] += 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]; double gamma[6];
int me = comm->me; int me = comm->me;
@ -812,7 +816,7 @@ int FixPressLangevin::modify_param(int narg, char **arg)
id_press = utils::strdup(arg[1]); id_press = utils::strdup(arg[1]);
pressure = modify->get_compute_by_id(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) if (pressure->pressflag == 0)
error->all(FLERR, "Fix_modify pressure compute {} does not compute pressure", arg[1]); error->all(FLERR, "Fix_modify pressure compute {} does not compute pressure", arg[1]);
return 2; return 2;

View File

@ -40,10 +40,9 @@ class FixPressLangevin : public Fix {
int modify_param(int, char **) override; int modify_param(int, char **) override;
protected: protected:
int dimension, which; int dimension;
int pstyle, pcouple, allremap; int pstyle, pcouple, allremap;
int p_flag[6]; // 1 if control P on this dim, 0 if not int p_flag[6]; // 1 if control P on this dim, 0 if not
double nktv2p;
double t_start, t_stop, t_target; double t_start, t_stop, t_target;
double p_fric[6], p_ltime; // Friction and Langevin charac. time double p_fric[6], p_ltime; // Friction and Langevin charac. time
double p_alpha[6]; double p_alpha[6];
@ -68,8 +67,8 @@ class FixPressLangevin : public Fix {
int seed; int seed;
void couple_pressure(); void couple_pressure();
void couple_kinetic(double); void couple_kinetic();
void couple_beta(double); void couple_beta();
void remap(); void remap();
}; };

View File

@ -46,6 +46,7 @@ FixPropertyAtom::FixPropertyAtom(LAMMPS *lmp, int narg, char **arg) :
rmass_flag = 0; rmass_flag = 0;
temperature_flag = 0; temperature_flag = 0;
heatflow_flag = 0; heatflow_flag = 0;
nmax_old = 0;
nvalue = 0; nvalue = 0;
values_peratom = 0; values_peratom = 0;
@ -212,7 +213,6 @@ void FixPropertyAtom::post_constructor()
{ {
// perform initial allocation of atom-based array // perform initial allocation of atom-based array
nmax_old = 0;
grow_arrays(atom->nmax); grow_arrays(atom->nmax);
} }

View File

@ -215,6 +215,9 @@ void Min::setup(int flag)
} }
update->setupflag = 1; update->setupflag = 1;
if (lmp->kokkos)
error->all(FLERR,"KOKKOS package requires Kokkos-enabled min_style");
// setup extra global dof due to fixes // setup extra global dof due to fixes
// cannot be done in init() b/c update init() is before modify init() // cannot be done in init() b/c update init() is before modify init()

View File

@ -110,14 +110,15 @@ endif()
# we require Qt 5 and at least version 5.12 at that. # we require Qt 5 and at least version 5.12 at that.
if(NOT LAMMPS_GUI_USE_QT5) if(NOT LAMMPS_GUI_USE_QT5)
find_package(Qt6 6.2 COMPONENTS Widgets Charts) find_package(Qt6 6.2 QUIET COMPONENTS Widgets Charts)
endif() endif()
if(NOT Qt6_FOUND) if(NOT Qt6_FOUND)
find_package(Qt5 5.12 REQUIRED COMPONENTS Widgets Charts) find_package(Qt5 5.12 REQUIRED COMPONENTS Widgets Charts)
set(QT_VERSION_MAJOR "5") set(QT_VERSION_MAJOR 5)
else() else()
set(QT_VERSION_MAJOR "6") set(QT_VERSION_MAJOR 6)
endif() endif()
message(STATUS "Using Qt version ${Qt${QT_VERSION_MAJOR}_VERSION} for LAMMPS GUI")
set(PROJECT_SOURCES set(PROJECT_SOURCES
main.cpp main.cpp
@ -188,7 +189,7 @@ else()
endif() endif()
target_include_directories(lammps-gui PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}) target_include_directories(lammps-gui PRIVATE ${CMAKE_CURRENT_SOURCE_DIR})
target_compile_definitions(lammps-gui PRIVATE LAMMPS_GUI_VERSION="${PROJECT_VERSION}") 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) if(BUILD_OMP)
find_package(OpenMP COMPONENTS CXX REQUIRED) find_package(OpenMP COMPONENTS CXX REQUIRED)
target_link_libraries(lammps-gui PRIVATE OpenMP::OpenMP_CXX) target_link_libraries(lammps-gui PRIVATE OpenMP::OpenMP_CXX)

View File

@ -1432,12 +1432,12 @@ void LammpsGui::start_lammps()
lammps.open(narg, args); lammps.open(narg, args);
lammpsstatus->show(); 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 // TODO: must update this check before next feature release
if (lammps.version() < 20230802) { if (lammps.version() <= 20230802) {
QMessageBox::critical(this, "Incompatible LAMMPS Version", QMessageBox::critical(this, "Incompatible LAMMPS Version",
"LAMMPS-GUI version " LAMMPS_GUI_VERSION " requires\n" "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); exit(1);
} }