From 348296e638628f3552deea0c6ef9a6a29805b527 Mon Sep 17 00:00:00 2001 From: jtclemm Date: Wed, 15 Feb 2023 16:07:10 -0700 Subject: [PATCH 001/158] Adding base fix and atom style --- src/RHEO/atom_vec_rheo.cpp | 135 ++++++++++++++ src/RHEO/atom_vec_rheo.h | 45 +++++ src/RHEO/fix_rheo.cpp | 365 +++++++++++++++++++++++++++++++++++++ src/RHEO/fix_rheo.h | 91 +++++++++ src/atom.cpp | 20 ++ src/atom.h | 5 + 6 files changed, 661 insertions(+) create mode 100644 src/RHEO/atom_vec_rheo.cpp create mode 100644 src/RHEO/atom_vec_rheo.h create mode 100644 src/RHEO/fix_rheo.cpp create mode 100644 src/RHEO/fix_rheo.h diff --git a/src/RHEO/atom_vec_rheo.cpp b/src/RHEO/atom_vec_rheo.cpp new file mode 100644 index 0000000000..9effad685c --- /dev/null +++ b/src/RHEO/atom_vec_rheo.cpp @@ -0,0 +1,135 @@ +/* ---------------------------------------------------------------------- + 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 "atom_vec_rheo.h" + +#include "atom.h" + +#include + +using namespace LAMMPS_NS; + +/* ---------------------------------------------------------------------- */ + +AtomVecRHEO::AtomVecRHEO(LAMMPS *lmp) : AtomVec(lmp) +{ + molecular = Atom::ATOMIC; + mass_type = PER_TYPE; + forceclearflag = 1; + + atom->status_flag = 1; + atom->rho_flag = 1; + + // strings with peratom variables to include in each AtomVec method + // strings cannot contain fields in corresponding AtomVec default strings + // order of fields in a string does not matter + // except: fields_data_atom & fields_data_vel must match data file + + fields_grow = {"status", "rho", "drho"}; + fields_copy = {"status", "rho", "drho"}; + fields_comm = {"status", "rho"}; + fields_comm_vel = {"status", "rho"}; + fields_reverse = {"drho"}; + fields_border = {"status", "rho"}; + fields_border_vel = {"status", "rho"}; + fields_exchange = {"status", "rho"}; + fields_restart = {"status", "rho"}; + fields_create = {"status", "rho", "drho"}; + fields_data_atom = {"id", "type", "status", "rho", "x"}; + fields_data_vel = {"id", "v"}; + + setup_fields(); +} + +/* ---------------------------------------------------------------------- + set local copies of all grow ptrs used by this class, except defaults + needed in replicate when 2 atom classes exist and it calls pack_restart() +------------------------------------------------------------------------- */ + +void AtomVecRHEO::grow_pointers() +{ + status = atom->status; + rho = atom->rho; + drho = atom->drho; +} + +/* ---------------------------------------------------------------------- + clear extra forces starting at atom N + nbytes = # of bytes to clear for a per-atom vector +------------------------------------------------------------------------- */ + +void AtomVecRHEO::force_clear(int n, size_t nbytes) +{ + memset(&drho[n], 0, nbytes); +} + +/* ---------------------------------------------------------------------- + modify what AtomVec::data_atom() just unpacked + or initialize other atom quantities +------------------------------------------------------------------------- */ + +void AtomVecRHEO::data_atom_post(int ilocal) +{ + drho[ilocal] = 0.0; +} + +/* ---------------------------------------------------------------------- + assign an index to named atom property and return index + return -1 if name is unknown to this atom style +------------------------------------------------------------------------- */ + +int AtomVecRHEO::property_atom(const std::string &name) +{ + if (name == "status") return 0; + if (name == "rho") return 1; + if (name == "drho") return 2; + return -1; +} + +/* ---------------------------------------------------------------------- + pack per-atom data into buf for ComputePropertyAtom + index maps to data specific to this atom style +------------------------------------------------------------------------- */ + +void AtomVecRHEO::pack_property_atom(int index, double *buf, int nvalues, int groupbit) +{ + int *mask = atom->mask; + int nlocal = atom->nlocal; + int n = 0; + + if (index == 0) { + for (int i = 0; i < nlocal; i++) { + if (mask[i] & groupbit) + buf[n] = status[i]; + else + buf[n] = 0.0; + n += nvalues; + } + } if else (index == 1) { + for (int i = 0; i < nlocal; i++) { + if (mask[i] & groupbit) + buf[n] = rho[i]; + else + buf[n] = 0.0; + n += nvalues; + } + } else if (index == 2) { + for (int i = 0; i < nlocal; i++) { + if (mask[i] & groupbit) + buf[n] = drho[i]; + else + buf[n] = 0.0; + n += nvalues; + } + } +} diff --git a/src/RHEO/atom_vec_rheo.h b/src/RHEO/atom_vec_rheo.h new file mode 100644 index 0000000000..bdd617a01d --- /dev/null +++ b/src/RHEO/atom_vec_rheo.h @@ -0,0 +1,45 @@ +/* -*- 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 ATOM_CLASS +// clang-format off +AtomStyle(rheo,AtomVecRHEO); +// clang-format on +#else + +#ifndef LMP_ATOM_VEC_RHEO_H +#define LMP_ATOM_VEC_RHEO_H + +#include "atom_vec.h" + +namespace LAMMPS_NS { + +class AtomVecRHEO : virtual public AtomVec { + public: + AtomVecRHEO(class LAMMPS *); + + void grow_pointers() override; + void force_clear(int, size_t) override; + void data_atom_post(int) override; + int property_atom(const std::string &) override; + void pack_property_atom(int, double *, int, int) override; + + private: + int *status; + double *rho, *drho; +}; + +} // namespace LAMMPS_NS + +#endif +#endif diff --git a/src/RHEO/fix_rheo.cpp b/src/RHEO/fix_rheo.cpp new file mode 100644 index 0000000000..fd476d4c9e --- /dev/null +++ b/src/RHEO/fix_rheo.cpp @@ -0,0 +1,365 @@ +/* ---------------------------------------------------------------------- + LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator + http://lammps.sandia.gov, 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. + ------------------------------------------------------------------------- */ + +#include "fix_rheo.h" + +#include "atom.h" +#include "compute_rheo_grad.h" +#include "compute_rheo_interface.h" +#include "compute_rheo_kernel.h" +#include "compute_rheo_rhosum.h" +#include "compute_rheo_vshift.h" +#include "domain.h" +#include "error.h" +#include "force.h" +#include "modify.h" +#include "update.h" +#include "utils.h" + +using namespace LAMMPS_NS; +using namespace FixConst; + +/* ---------------------------------------------------------------------- */ + +FixRHEO::FixRHEO(LAMMPS *lmp, int narg, char **arg) : + Fix(lmp, narg, arg), compute_grad(nullptr), compute_kernel(nullptr), + compute_interface(nullptr), compute_rhosum(nullptr), compute_vshift(nullptr) +{ + thermal_flag = 0; + rhosum_flag = 0; + shift_flag = 0; + solid_flag = 0; + rho0 = 1.0; + csq = 1.0; + + if (atom->rho_flag != 1) + error->all(FLERR,"fix rheo command requires atom_style with density"); + if (atom->status_flag != 1) + error->all(FLERR,"fix rheo command requires atom_style with status"); + + if (narg < 5) + error->all(FLERR,"Insufficient arguments for fix rheo command"); + + cut = utils::numeric(FLERR,arg[3],false,lmp); + if (strcmp(arg[4],"Quintic") == 0) { + kernel_style = QUINTIC; + } else if (strcmp(arg[4],"CRK0") == 0) { + kernel_style = CRK0; + } else if (strcmp(arg[4],"CRK1") == 0) { + kernel_style = CRK1; + } else if (strcmp(arg[4],"CRK2") == 0) { + kernel_style = CRK2; + } else error->all(FLERR,"Unknown kernel style {} in fix rheo", arg[4]); + zmin_kernel = utils::numeric(FLERR,arg[5],false,lmp); + + int iarg = 6; + while (iarg < narg){ + if (strcmp(arg[iarg],"shift") == 0) { + shift_flag = 1; + } else if (strcmp(arg[iarg],"thermal") == 0) { + thermal_flag = 1; + } else if (strcmp(arg[iarg],"rhosum") == 0) { + rhosum_flag = 1; + if(iarg + 1 >= narg) error->all(FLERR,"Illegal rhosum option in fix rheo"); + zmin_rhosum = utils::inumeric(FLERR,arg[iarg + 1],false,lmp); + iarg += 1; + } else if (strcmp(arg[iarg],"rho0") == 0) { + if(iarg + 1 >= narg) error->all(FLERR,"Illegal rho0 option in fix rheo"); + rho0 = utils::numeric(FLERR,arg[iarg + 1],false,lmp); + iarg += 1; + } else if (strcmp(arg[iarg],"csq") == 0) { + if(iarg+1 >= narg) error->all(FLERR,"Illegal csq option in fix rheo"); + csq = utils::numeric(FLERR,arg[iarg + 1],false,lmp); + iarg += 1; + } else { + error->all(FLERR, "Illegal fix rheo command: {}", arg[iarg]); + } + iarg += 1; + } + + time_integrate = 1; + thermal_fix_defined = 0; + viscosity_fix_defined = 0; + pressure_fix_defined = 0; +} + +/* ---------------------------------------------------------------------- */ + +FixRHEO::~FixRHEO() +{ + if (compute_kernel) modify->delete_compute("rheo_kernel"); + if (compute_grad) modify->delete_compute("rheo_grad"); + if (compute_interface) modify->delete_compute("rheo_interface"); + if (compute_rhosum) modify->delete_compute("rheo_rhosum"); + if (compute_vshift) modify->delete_compute("rheo_vshift"); +} + +/* ---------------------------------------------------------------------- */ + +void FixRHEO::post_constructor() +{ + compute_kernel = dynamic_cast(modify->add_compute(fmt::format("rheo_kernel all rheo/kernel {} {} {}", kernel_style, zmin_kernel, cut))); + + if (thermal_flag) + compute_grad = dynamic_cast(modify->add_compute(fmt::format("rheo_grad all rheo/grad {} velocity rho viscosity temprature", cut))); + else + compute_grad = dynamic_cast(modify->add_compute(fmt::format("rheo_grad all rheo/grad {} velocity rho viscosity", cut))); + + compute_interface = dynamic_cast(modify->add_compute(fmt::format("rheo_interface all rheo/interface {}", cut))); + + if (rhosum_flag) + compute_rhosum = dynamic_cast(modify->add_compute(fmt::format("rheo_rhosum all rheo/rho/sum {} {}", cut, zmin_rhosum))); + + if (shift_flag) + compute_vshift = dynamic_cast(modify->add_compute(fmt::format("rheo_vshift all rheo/vshift {}", cut))); +} + +/* ---------------------------------------------------------------------- */ + +int FixRHEO::setmask() +{ + int mask = 0; + mask |= INITIAL_INTEGRATE; + mask |= FINAL_INTEGRATE; + mask |= PRE_FORCE; + return mask; +} + +/* ---------------------------------------------------------------------- */ + +void FixRHEO::init() +{ + dtv = update->dt; + dtf = 0.5 * update->dt * force->ftm2v; +} + +/* ---------------------------------------------------------------------- */ + +void FixRHEO::setup_pre_force(int /*vflag*/) +{ + // Check to confirm all accessory fixes are defined + if(!thermal_fix_defined && thermal_flag) + error->all(FLERR, "Missing fix rheo/thermal"); + + if (!viscosity_fix_defined) + error->all(FLERR, "Missing fix rheo/viscosity"); + + if (!pressure_fix_defined) + error->all(FLERR, "Missing fix rheo/pressure"); + + // Reset to zero for next run + thermal_fix_defined = 0; + viscosity_fix_defined = 0; + pressure_fix_defined = 0; + + pre_force(0); +} + +/* ---------------------------------------------------------------------- */ + +void FixRHEO::initial_integrate(int /*vflag*/) +{ + // update v and x and rho of atoms in group + int i, a, b; + double dtfm, divu; + int dim = domain->dimension; + + int *status = atom->status; + double **x = atom->x; + double **v = atom->v; + double **f = atom->f; + double *rho = atom->rho; + double *drho = atom->drho; + double *mass = atom->mass; + double *rmass = atom->rmass; + int rmass_flag = atom->rmass_flag; + + double **gradr = compute_grad->gradr; + double **gradv = compute_grad->gradv; + double **vshift = compute_vshift->array_atom; + + int *type = atom->type; + int *mask = atom->mask; + int nlocal = atom->nlocal; + + if (igroup == atom->firstgroup) + nlocal = atom->nfirst; + + //Density Half-step + for (i = 0; i < nlocal; i++) { + if (status[i] & STATUS_NO_FORCE) continue; + + if (mask[i] & groupbit) { + if (rmass_flag) { + dtfm = dtf / rmass[i]; + } else { + dtfm = dtf / mass[type[i]]; + } + + v[i][0] += dtfm * f[i][0]; + v[i][1] += dtfm * f[i][1]; + v[i][2] += dtfm * f[i][2]; + } + } + + // Update gradients and interpolate solid properties + compute_grad->forward_fields(); // also forwards v and rho for chi + compute_interface->store_forces(); // Need to save, wiped in exchange + compute_interface->compute_peratom(); + compute_grad->compute_peratom(); + + // Position half-step + for (i = 0; i < nlocal; i++) { + if (mask[i] & groupbit) { + for (a = 0; a < dim; a++) { + x[i][a] += dtv * v[i][a]; + } + } + } + + // Update density using div(u) + if (!rhosum_flag) { + for (i = 0; i < nlocal; i++) { + if (mask[i] & groupbit) { + if (status[i] & STATUS_NO_FORCE) continue; + if (!(status[i] & STATUS_FLUID)) continue; + + divu = 0; + for (a = 0; a < dim; a++) { + divu += gradv[i][a * (1 + dim)]; + } + rho[i] += dtf * (drho[i] - rho[i] * divu); + } + } + } + + // Shifting atoms + if (shift_flag) { + compute_vshift->correct_surfaces(); + for (i = 0; i < nlocal; i++) { + + if (!(status[i] & STATUS_SHIFT)) continue; + + if (mask[i] & groupbit) { + for (a = 0; a < dim; a++) { + x[i][a] += dtv * vshift[i][a]; + for (b = 0; b < dim; b++) { + v[i][a] += dtv * vshift[i][b] * gradv[i][a * dim + b]; + } + } + + if (!rhosum_flag) { + for (a = 0; a < dim; a++) { + rho[i] += dtv * vshift[i][a] * gradr[i][a]; + } + } + } + } + } +} + +/* ---------------------------------------------------------------------- */ + +void FixRHEO::pre_force(int /*vflag*/) +{ + if (rhosum_flag) + compute_rhosum->compute_peratom(); + + compute_grad->forward_fields(); // also forwards v and rho for chi + compute_kernel->compute_peratom(); + compute_interface->compute_peratom(); + + compute_grad->compute_peratom(); + compute_grad->forward_gradients(); + + if (shift_flag) + compute_vshift->compute_peratom(); + + // Remove extra shifting/no force options options + int *status = atom->status; + int nall = atom->nlocal + atom->nghost; + for (int i = 0; i < nall; i++) { + if (mask[i] & groupbit) { + status[i] &= ~STATUS_NO_FORCE; + + if (status[i] & STATUS_FLUID) + status[i] &= ~STATUS_SHIFT; + } + } +} + +/* ---------------------------------------------------------------------- */ + +void FixRHEO::final_integrate() { + int *status = atom->status; + double **gradv = compute_grad->gradv; + double **x = atom->x; + double **v = atom->v; + double **f = atom->f; + + double *rho = atom->rho; + double *drho = atom->drho; + int *type = atom->type; + int *mask = atom->mask; + double *mass = atom->mass; + int nlocal = atom->nlocal; + if (igroup == atom->firstgroup) + nlocal = atom->nfirst; + double dtfm, divu; + double *rmass = atom->rmass; + int rmass_flag = atom->rmass_flag; + int i, a; + + int dim = domain->dimension; + + // Update velocity + for (i = 0; i < nlocal; i++) { + if (mask[i] & groupbit) { + if (status[i] & STATUS_NO_FORCE) continue; + + if (rmass_flag) { + dtfm = dtf / rmass[i]; + } else { + dtfm = dtf / mass[type[i]]; + } + + for (a = 0; a < dim; a++) { + v[i][a] += dtfm * f[i][a]; + } + } + } + + // Update density using divu + if (!rhosum_flag) { + for (i = 0; i < nlocal; i++) { + if (mask[i] & groupbit) { + if (status[i] & STATUS_NO_FORCE) continue; + if (!(status[i] & STATUS_FLUID)) continue; + + divu = 0; + for (a = 0; a < dim; a++) { + divu += gradv[i][a * (1 + dim)]; + } + rho[i] += dtf * (drho[i] - rho[i] * divu); + } + } + } +} + +/* ---------------------------------------------------------------------- */ + +void FixRHEO::reset_dt() +{ + dtv = update->dt; + dtf = 0.5 * update->dt * force->ftm2v; +} diff --git a/src/RHEO/fix_rheo.h b/src/RHEO/fix_rheo.h new file mode 100644 index 0000000000..8597eb2809 --- /dev/null +++ b/src/RHEO/fix_rheo.h @@ -0,0 +1,91 @@ +/* -*- 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(rheo,FixRHEO) +// clang-format on +#else + +#ifndef LMP_FIX_RHEO_H +#define LMP_FIX_RHEO_H + +#include "fix.h" + +namespace LAMMPS_NS { + +class FixRHEO : public Fix { + public: + FixRHEO(class LAMMPS *, int, char **); + virtual ~FixRHEO(); + int setmask(); + virtual void post_constructor(); + virtual void init(); + virtual void setup_pre_force(int); + virtual void pre_force(int); + virtual void initial_integrate(int); + virtual void final_integrate(); + void reset_dt(); + + int kernel_style; + int thermal_flag; + int rhosum_flag; + int shift_flag; + int solid_flag; + + int thermal_fix_defined; + int viscosity_fix_defined; + int pressure_fix_defined; + + int *status, *surface; + double *conductivity, *viscosity, *pressure; + double **f_pressure; + + class ComputeRHEOGrad *compute_grad; + class ComputeRHEOKernel *compute_kernel; + class ComputeRHEOInterface *compute_interface; + class ComputeRHEORhoSum *compute_rhosum; + class ComputeRHEOVShift *compute_vshift; + + enum {QUINTIC, CRK0, CRK1, CRK2}; + enum {LINEAR, CUBIC, TAITWATER}; + + enum { + // Phase status + STATUS_FLUID = 1 << 0, + STATUS_REACTIVE = 1 << 1, + STATUS_SOLID = 1 << 2, + STATUS_FREEZING = 1 << 3 + + // Temporary status options - reset in preforce + STATUS_SHIFT = 1 << 4, + STATUS_NO_FORCE = 1 << 5, + + // Surface status + STATUS_BULK = 1 << 6, + STATUS_LAYER = 1 << 7, + STATUS_SURFACE = 1 << 8, + STATUS_SPLASH = 1 << 9, + }; + + protected: + double cut, rho0, csq; + int zmin_kernel, rhosum_zmin; + + double dtv, dtf; +}; + +} // namespace LAMMPS_NS + +#endif +#endif diff --git a/src/atom.cpp b/src/atom.cpp index 32285758c0..e2613c801e 100644 --- a/src/atom.cpp +++ b/src/atom.cpp @@ -195,6 +195,10 @@ Atom::Atom(LAMMPS *_lmp) : Pointers(_lmp) eff_plastic_strain_rate = nullptr; damage = nullptr; + // RHEO package + + status = nullptr; + // SPH package rho = drho = esph = desph = cv = nullptr; @@ -521,6 +525,10 @@ void Atom::peratom_create() add_peratom("cc",&cc,DOUBLE,1); add_peratom("cc_flux",&cc_flux,DOUBLE,1,1); // set per-thread flag + // RHEO package + + add_peratom("status",&status,INT,0); + // SPH package add_peratom("rho",&rho,DOUBLE,0); @@ -625,6 +633,7 @@ void Atom::set_atomflag_defaults() rmass_flag = radius_flag = omega_flag = torque_flag = angmom_flag = 0; vfrac_flag = spin_flag = eradius_flag = ervel_flag = erforce_flag = 0; cs_flag = csforce_flag = vforce_flag = ervelforce_flag = etag_flag = 0; + status_flag = 0; rho_flag = esph_flag = cv_flag = vest_flag = 0; dpd_flag = edpd_flag = tdpd_flag = 0; sp_flag = 0; @@ -2911,7 +2920,12 @@ void *Atom::extract(const char *name) if (strcmp(name,"vforce") == 0) return (void *) vforce; if (strcmp(name,"etag") == 0) return (void *) etag; + // RHEO package + + if (strcmp(name,"status") == 0) return (void *) status; + // SPH package + if (strcmp(name,"rho") == 0) return (void *) rho; if (strcmp(name,"drho") == 0) return (void *) drho; if (strcmp(name,"esph") == 0) return (void *) esph; @@ -3030,6 +3044,12 @@ int Atom::extract_datatype(const char *name) if (strcmp(name,"vforce") == 0) return LAMMPS_DOUBLE_2D; if (strcmp(name,"etag") == 0) return LAMMPS_INT; + // RHEO package + + if (strcmp(name,"status") == 0) return LAMMPS_INT; + + // SPH package + if (strcmp(name,"rho") == 0) return LAMMPS_DOUBLE; if (strcmp(name,"drho") == 0) return LAMMPS_DOUBLE; if (strcmp(name,"esph") == 0) return LAMMPS_DOUBLE; diff --git a/src/atom.h b/src/atom.h index 20f2021947..52cec2b1bb 100644 --- a/src/atom.h +++ b/src/atom.h @@ -154,6 +154,10 @@ class Atom : protected Pointers { double *eff_plastic_strain_rate; double *damage; + // RHEO package + + int *status; + // SPH package double *rho, *drho, *esph, *desph, *cv; @@ -188,6 +192,7 @@ class Atom : protected Pointers { int rmass_flag, radius_flag, omega_flag, torque_flag, angmom_flag, quat_flag; int vfrac_flag, spin_flag, eradius_flag, ervel_flag, erforce_flag; int cs_flag, csforce_flag, vforce_flag, ervelforce_flag, etag_flag; + int status_flag; int rho_flag, esph_flag, cv_flag, vest_flag; int dpd_flag, edpd_flag, tdpd_flag; int mesont_flag; From 6cbade576c7d5726226dbb7236d81bb5f5ddfed4 Mon Sep 17 00:00:00 2001 From: jtclemm Date: Sun, 19 Feb 2023 20:41:33 -0700 Subject: [PATCH 002/158] Adding gradient compute, minor patch bond history --- src/RHEO/compute_rheo_grad.cpp | 457 +++++++++++++++++++++++++++++++++ src/RHEO/compute_rheo_grad.h | 62 +++++ src/RHEO/fix_rheo.cpp | 1 + src/fix_bond_history.cpp | 4 +- 4 files changed, 522 insertions(+), 2 deletions(-) create mode 100644 src/RHEO/compute_rheo_grad.cpp create mode 100644 src/RHEO/compute_rheo_grad.h diff --git a/src/RHEO/compute_rheo_grad.cpp b/src/RHEO/compute_rheo_grad.cpp new file mode 100644 index 0000000000..33dd3dc3bc --- /dev/null +++ b/src/RHEO/compute_rheo_grad.cpp @@ -0,0 +1,457 @@ +/* ---------------------------------------------------------------------- + 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 "compute_rheo_grad.h" + +#include "atom.h" +#include "comm.h" +#include "compute_rheo_kernel.h" +#include "compute_rheo_solids.h" +#include "domain.h" +#include "error.h" +#include "fix_rheo.h" +#include "force.h" +#include "neighbor.h" +#include "neigh_list.h" +#include "pair.h" +#include "memory.h" +#include "modify.h" +#include "update.h" +#include "utils.h" + +#include +#include + +using namespace LAMMPS_NS; +enum{COMMGRAD, COMMFIELD}; + +/* ---------------------------------------------------------------------- */ + +ComputeRHEOGrad::ComputeRHEOGrad(LAMMPS *lmp, int narg, char **arg) : + Compute(lmp, narg, arg), compute_interface(nullptr), compute_kernel(nullptr) +{ + if (narg < 4) error->all(FLERR,"Illegal compute rheo/grad command"); + + + velocity_flag = temperature_flag = rho_flag = eta_flag = 0; + for (int iarg = 3; iarg < narg; iarg ++) { + if (strcmp(arg[iarg],"velocity") == 0) velocity_flag = 1; + else if (strcmp(arg[iarg],"rho") == 0) rho_flag = 1; + else if (strcmp(arg[iarg],"temperature") == 0) temperature_flag = 1; + else if (strcmp(arg[iarg],"viscosity") == 0) eta_flag = 1; + else error->all(FLERR, "Illegal compute rheo/grad command, {}", arg[iarg]); + } + + dim = domain->dimension; + + ncomm_grad = 0; + ncomm_field = 0; + comm_reverse = 0; + + std::string fix_cmd = "rheo_grad_property_atom all property/atom" + + if (velocity_flag) { + ncomm_grad += dim * dim; + ncomm_field += dim; + comm_reverse += dim * dim; + fix_cmd += " d2_gradv 9" + } + + if (rho_flag) { + ncomm_grad += dim; + ncomm_field += 1; + comm_reverse += dim; + fix_cmd += " d2_gradr 3" + } + + if (temperature_flag) { + ncomm_grad += dim; + ncomm_field += 1; + comm_reverse += dim; + fix_cmd += " d2_gradt 3" + } + + if (eta_flag) { + ncomm_grad += dim; + comm_reverse += dim; + fix_cmd += " d2_gradn 3" + } + + comm_forward = ncomm_grad; + + modify->add_fix(fix_cmd); + + int tmp1, tmp2, index; + if (velocity_flag) { + index = atom->find_custom("gradv", tmp1, tmp2); + gradv = atom->darray[index]; + } + + if (rho_flag) { + index = atom->find_custom("gradr", tmp1, tmp2); + gradr = atom->darray[index]; + } + + if (temperature_flag) { + index = atom->find_custom("gradt", tmp1, tmp2); + gradt = atom->darray[index]; + } + + if (eta_flag) { + index = atom->find_custom("gradn", tmp1, tmp2); + gradn = atom->darray[index]; + } +} + +/* ---------------------------------------------------------------------- */ + +ComputeRHEOGrad::~ComputeRHEOGrad() +{ + modify->delete_fix("rheo_grad_property_atom"); +} + + +/* ---------------------------------------------------------------------- */ + +void ComputeRHEOGrad::init() +{ + neighbor->add_request(this, NeighConst::REQ_DEFAULT); + + cut = fix_rheo->cut; + cutsq = cut * cut; + rho0 = fix_rheo->rho0; + compute_kernel = fix_rheo->compute_kernel; + compute_interface = fix_rheo->compute_interface; +} + +/* ---------------------------------------------------------------------- */ + +void ComputeRHEOGrad::init_list(int /*id*/, NeighList *ptr) +{ + list = ptr; +} + +/* ---------------------------------------------------------------------- */ + +void ComputeRHEOGrad::compute_peratom() +{ + int i, j, k, ii, jj, jnum, itype, jtype, a, b; + double xtmp, ytmp, ztmp, delx, dely, delz; + double rsq, imass, jmass; + double rhoi, rhoj, Voli, Volj, drho, dT, deta; + double vij[3]; + double wp, *dWij, *dWji; + + int inum, *ilist, *numneigh, **firstneigh; + int *jlist; + int nlocal = atom->nlocal; + + double **x = atom->x; + double **v = atom->v; + double *rho = atom->rho; + double *temperature = atom->temperature; + double *eta = atom->viscosity; + int *status = atom->status; + int *type = atom->type; + double *mass = atom->mass; + int newton = force->newton; + + inum = list->inum; + ilist = list->ilist; + numneigh = list->numneigh; + firstneigh = list->firstneigh; + + // initialize arrays + for (i = 0; i < nmax; i++) { + if (velocity_flag) { + for (k = 0; k < dim * dim; k++) + gradv[i][k] = 0.0; + } + if (rho_flag) { + for (k = 0; k < dim; k++) + gradr[i][k] = 0.0; + } + if (temperature_flag) { + for (k = 0; k < dim; k++) + gradt[i][k] = 0.0; + } + if (eta_flag) { + for (k = 0; k < dim; k++) + gradn[i][k] = 0.0; + } + } + + for (ii = 0; ii < inum; ii++) { + i = ilist[ii]; + xtmp = x[i][0]; + ytmp = x[i][1]; + ztmp = x[i][2]; + itype = type[i]; + jlist = firstneigh[i]; + jnum = numneigh[i]; + + for (jj = 0; jj < jnum; jj++) { + j = jlist[jj]; + j &= NEIGHMASK; + + jtype = type[j]; + delx = xtmp - x[j][0]; + dely = ytmp - x[j][1]; + delz = ztmp - x[j][2]; + rsq = delx * delx + dely * dely + delz * delz; + + if (rsq < cutsq) { + rhoi = rho[i]; + rhoj = rho[j]; + + // Add corrections for walls + if ((status[i] & FixRHEO::STATUS_FLUID) && !(status[j] & FixRHEO::STATUS_FLUID)) { + compute_interface->correct_v(v[i], v[j], vi, i, j); + rhoj = compute_interface->correct_rho(j,i); + } else if (!(status[i] & FixRHEO::STATUS_FLUID) && (status[j] & FixRHEO::STATUS_FLUID)) { + compute_interface->correct_v(v[j], v[i], vj, j, i); + rhoi = compute_interface->correct_rho(i,j); + } else if (!(status[i] & FixRHEO::STATUS_FLUID) && !(status[j] & FixRHEO::STATUS_FLUID)) { + rhoi = rho0; + rhoj = rho0; + } + + Voli = mass[itype] / rhoi; + Volj = mass[jtype] / rhoj; + + vij[0] = v[i][0] - v[j][0]; + vij[1] = v[i][1] - v[j][1]; + vij[2] = v[i][2] - v[j][2]; + + if (rho_flag) drho = rhoi - rhoj; + if (temperature_flag) dT = temperature[i] - temperature[j]; + if (eta_flag) deta = eta[i] - eta[j]; + + wp = compute_kernel->calc_dw(i, j, delx, dely, delz, sqrt(rsq)); + dWij = compute_kernel->dWij; + dWji = compute_kernel->dWji; + + for (a = 0; a < dim; a++) { + for (b = 0; b < dim; b++) { + if (velocity_flag) // uxx uxy uxz uyx uyy uyz uzx uzy uzz + gradv[i][a * dim + b] -= vij[a] * Volj * dWij[b]; + } + + if (rho_flag) // P,x P,y P,z + gradr[i][a] -= drho * Volj * dWij[a]; + + if (temperature_flag) // T,x T,y T,z + gradt[i][a] -= dT * Volj * dWij[a]; + + if (eta_flag) // n,x n,y n,z + gradn[i][a] -= deta * Volj * dWij[a]; + } + + if (newton || j < nlocal) { + for (a = 0; a < dim; a++) { + for (b = 0; b < dim; b++) { + if (velocity_flag) // uxx uxy uxz uyx uyy uyz uzx uzy uzz + gradv[j][a * dim + b] += vij[a] * Voli * dWji[b]; + } + + if (rho_flag) // P,x P,y P,z + gradr[j][a] += drho * Voli * dWji[a]; + + if (temperature_flag) // T,x T,y T,z + gradt[j][a] += dT * Voli * dWji[a]; + + if (eta_flag) // n,x n,y n,z + gradn[j][a] += deta * Voli * dWji[a]; + } + } + } + } + } + + if (newton) comm->reverse_comm(this); +} + +/* ---------------------------------------------------------------------- */ + +void ComputeRHEOGrad::forward_gradients() +{ + comm_stage = COMMGRAD; + comm_forward = ncomm_grad; + comm->forward_comm(this); +} + + +/* ---------------------------------------------------------------------- */ + +void ComputeRHEOGrad::forward_fields() +{ + comm_stage = COMMFIELD; + comm_forward = ncomm_field; + comm->forward_comm(this); +} + +/* ---------------------------------------------------------------------- */ + +int ComputeRHEOGrad::pack_forward_comm(int n, int *list, double *buf, + int /*pbc_flag*/, int * /*pbc*/) +{ + int i,j,k,m; + double *rho = atom->rho; + double *temperature = atom->temperature; + double *eta = atom->viscosity; + double **v = atom->v; + + m = 0; + + for (i = 0; i < n; i++) { + j = list[i]; + if (comm_stage == COMMGRAD) { + + if (velocity_flag){ + for (k = 0; k < dim * dim; k++) + buf[m++] = gradv[j][k]; + } + + if (rho_flag) { + for (k = 0; k < dim; k++) + buf[m++] = gradr[j][k]; + } + + if (temperature_flag) { + for (k = 0; k < dim; k++) + buf[m++] = gradt[j][k]; + } + + if (eta_flag){ + for (k = 0; k < dim; k++) + buf[m++] = gradn[j][k]; + } + } else if (comm_stage == COMMFIELD) { + + if (velocity_flag) { + for (k = 0; k < dim; k++) + buf[m++] = v[j][k]; + } + + if (rho_flag) { + buf[m++] = rho[j]; + } + + if (temperature_flag) { + buf[m++] = temperature[j]; + } + } + } + return m; +} + +/* ---------------------------------------------------------------------- */ + +void ComputeRHEOGrad::unpack_forward_comm(int n, int first, double *buf) +{ + int i, k, m, last; + double * rho = atom->rho; + double * temperature = atom->temperature; + double ** v = atom->v; + + m = 0; + last = first + n; + for (i = first; i < last; i++) { + if (comm_stage == COMMGRAD) { + if (velocity_flag) { + for (k = 0; k < dim * dim; k++) + gradv[i][k] = buf[m++]; + } + if (rho_flag) { + for (k = 0; k < dim; k++) + gradr[i][k] = buf[m++]; + } + if (temperature_flag) { + for (k = 0; k < dim; k++) + gradt[i][k] = buf[m++]; + } + if (eta_flag) { + for (k = 0; k < dim; k++) + gradn[i][k] = buf[m++]; + } + } else if (comm_stage == COMMFIELD) { + if (velocity_flag) { + for (k = 0; k < dim; k++) + v[i][k] = buf[m++]; + } + if (rho_flag) { + rho[i] = buf[m++]; + } + if (temperature_flag) { + temperature[i] = buf[m++]; + } + } + } +} + +/* ---------------------------------------------------------------------- */ + +int ComputeRHEOGrad::pack_reverse_comm(int n, int first, double *buf) +{ + int i,k,m,last; + + m = 0; + last = first + n; + for (i = first; i < last; i++) { + if (velocity_flag) { + for (k = 0; k < dim * dim; k++) + buf[m++] = gradv[i][k]; + } + if (rho_flag) { + for (k = 0; k < dim; k++) + buf[m++] = gradr[i][k]; + } + if (temperature_flag) { + for (k = 0; k < dim; k++) + buf[m++] = gradt[i][k]; + } + if (eta_flag) { + for (k = 0; k < dim; k++) + buf[m++] = gradn[i][k]; + } + } + return m; +} + +/* ---------------------------------------------------------------------- */ + +void ComputeRHEOGrad::unpack_reverse_comm(int n, int *list, double *buf) +{ + int i,k,j,m; + + m = 0; + for (i = 0; i < n; i++) { + j = list[i]; + if (velocity_flag) { + for (k = 0; k < dim * dim; k++) + gradv[j][k] += buf[m++]; + } + if (rho_flag) { + for (k = 0; k < dim; k++) + gradr[j][k] += buf[m++]; + } + if (temperature_flag) { + for (k = 0; k < dim; k++) + gradt[j][k] += buf[m++]; + } + if (eta_flag) { + for (k = 0; k < dim; k++) + gradn[j][k] += buf[m++]; + } + } +} diff --git a/src/RHEO/compute_rheo_grad.h b/src/RHEO/compute_rheo_grad.h new file mode 100644 index 0000000000..8b8e28fd98 --- /dev/null +++ b/src/RHEO/compute_rheo_grad.h @@ -0,0 +1,62 @@ +/* -*- 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 COMPUTE_CLASS +// clang-format off +ComputeStyle(rheo/grad,ComputeRHEOGrad) +// clang-format on +#else + +#ifndef LMP_COMPUTE_RHEO_GRAD_H +#define LMP_COMPUTE_RHEO_GRAD_H + +#include "compute.h" + +namespace LAMMPS_NS { + +class ComputeRHEOGrad : public Compute { + public: + ComputeRHEOGrad(class LAMMPS *, int, char **); + ~ComputeRHEOGrad(); + void init(); + void init_list(int, class NeighList *); + void compute_peratom(); + int pack_forward_comm(int, int *, double *, int, int *); + void unpack_forward_comm(int, int, double *); + int pack_reverse_comm(int, int, double *); + void unpack_reverse_comm(int, int *, double *); + void forward_gradients(); + void forward_fields(); + double **gradv; + double **gradr; + double **gradt; + double **gradn; + int stage; + + private: + int dim, comm_stage; + int ncomm_grad, ncomm_field; + double cut, cutsq, rho0; + class NeighList *list; + + class FixRHEO *fix_rheo; + class ComputeRHEOKernel *compute_kernel; + class ComputeRHEOInterface *compute_interface; + + int velocity_flag, temperature_flag, rho_flag, eta_flag; +}; + +} // namespace LAMMPS_NS + +#endif +#endif diff --git a/src/RHEO/fix_rheo.cpp b/src/RHEO/fix_rheo.cpp index fd476d4c9e..17108b4c91 100644 --- a/src/RHEO/fix_rheo.cpp +++ b/src/RHEO/fix_rheo.cpp @@ -114,6 +114,7 @@ void FixRHEO::post_constructor() compute_grad = dynamic_cast(modify->add_compute(fmt::format("rheo_grad all rheo/grad {} velocity rho viscosity temprature", cut))); else compute_grad = dynamic_cast(modify->add_compute(fmt::format("rheo_grad all rheo/grad {} velocity rho viscosity", cut))); + compute_grad->fix_rheo = this; compute_interface = dynamic_cast(modify->add_compute(fmt::format("rheo_interface all rheo/interface {}", cut))); diff --git a/src/fix_bond_history.cpp b/src/fix_bond_history.cpp index cae9dc744d..277df75085 100644 --- a/src/fix_bond_history.cpp +++ b/src/fix_bond_history.cpp @@ -97,7 +97,7 @@ void FixBondHistory::post_constructor() void FixBondHistory::update_atom_value(int i, int m, int idata, double value) { - if (idata >= ndata || m > nbond) error->all(FLERR, "Index exceeded in fix bond history"); + if (idata >= ndata || m > nbond) error->one(FLERR, "Index exceeded in fix bond history"); atom->darray[index][i][m * ndata + idata] = value; } @@ -105,7 +105,7 @@ void FixBondHistory::update_atom_value(int i, int m, int idata, double value) double FixBondHistory::get_atom_value(int i, int m, int idata) { - if (idata >= ndata || m > nbond) error->all(FLERR, "Index exceeded in fix bond history"); + if (idata >= ndata || m > nbond) error->one(FLERR, "Index exceeded in fix bond history"); return atom->darray[index][i][m * ndata + idata]; } From 560bd90e1149bd880600b1edea291b7b2f1963cb Mon Sep 17 00:00:00 2001 From: jtclemm Date: Sun, 19 Feb 2023 22:08:02 -0700 Subject: [PATCH 003/158] Drafting viscosity fix --- src/RHEO/compute_rheo_grad.cpp | 11 +- src/RHEO/compute_rheo_grad.h | 16 +-- src/RHEO/fix_rheo.cpp | 9 ++ src/RHEO/fix_rheo.h | 3 +- src/RHEO/fix_rheo_viscosity.cpp | 198 ++++++++++++++++++++++++++++++++ src/RHEO/fix_rheo_viscosity.h | 49 ++++++++ 6 files changed, 272 insertions(+), 14 deletions(-) create mode 100644 src/RHEO/fix_rheo_viscosity.cpp create mode 100644 src/RHEO/fix_rheo_viscosity.h diff --git a/src/RHEO/compute_rheo_grad.cpp b/src/RHEO/compute_rheo_grad.cpp index 33dd3dc3bc..e87d39aa53 100644 --- a/src/RHEO/compute_rheo_grad.cpp +++ b/src/RHEO/compute_rheo_grad.cpp @@ -23,11 +23,8 @@ #include "force.h" #include "neighbor.h" #include "neigh_list.h" -#include "pair.h" -#include "memory.h" #include "modify.h" #include "update.h" -#include "utils.h" #include #include @@ -52,14 +49,13 @@ ComputeRHEOGrad::ComputeRHEOGrad(LAMMPS *lmp, int narg, char **arg) : else error->all(FLERR, "Illegal compute rheo/grad command, {}", arg[iarg]); } - dim = domain->dimension; - ncomm_grad = 0; ncomm_field = 0; comm_reverse = 0; std::string fix_cmd = "rheo_grad_property_atom all property/atom" + int dim = domain->dimension; if (velocity_flag) { ncomm_grad += dim * dim; ncomm_field += dim; @@ -165,6 +161,7 @@ void ComputeRHEOGrad::compute_peratom() int *type = atom->type; double *mass = atom->mass; int newton = force->newton; + int dim = domain->dimension; inum = list->inum; ilist = list->ilist; @@ -310,6 +307,7 @@ int ComputeRHEOGrad::pack_forward_comm(int n, int *list, double *buf, double *temperature = atom->temperature; double *eta = atom->viscosity; double **v = atom->v; + int dim = domain->dimension; m = 0; @@ -363,6 +361,7 @@ void ComputeRHEOGrad::unpack_forward_comm(int n, int first, double *buf) double * rho = atom->rho; double * temperature = atom->temperature; double ** v = atom->v; + int dim = domain->dimension; m = 0; last = first + n; @@ -404,6 +403,7 @@ void ComputeRHEOGrad::unpack_forward_comm(int n, int first, double *buf) int ComputeRHEOGrad::pack_reverse_comm(int n, int first, double *buf) { int i,k,m,last; + int dim = domain->dimension; m = 0; last = first + n; @@ -433,6 +433,7 @@ int ComputeRHEOGrad::pack_reverse_comm(int n, int first, double *buf) void ComputeRHEOGrad::unpack_reverse_comm(int n, int *list, double *buf) { int i,k,j,m; + int dim = domain->dimension; m = 0; for (i = 0; i < n; i++) { diff --git a/src/RHEO/compute_rheo_grad.h b/src/RHEO/compute_rheo_grad.h index 8b8e28fd98..35b50ca834 100644 --- a/src/RHEO/compute_rheo_grad.h +++ b/src/RHEO/compute_rheo_grad.h @@ -28,13 +28,13 @@ class ComputeRHEOGrad : public Compute { public: ComputeRHEOGrad(class LAMMPS *, int, char **); ~ComputeRHEOGrad(); - void init(); - void init_list(int, class NeighList *); - void compute_peratom(); - int pack_forward_comm(int, int *, double *, int, int *); - void unpack_forward_comm(int, int, double *); - int pack_reverse_comm(int, int, double *); - void unpack_reverse_comm(int, int *, double *); + void init() override; + void init_list(int, class NeighList *) override; + void compute_peratom() override; + int pack_forward_comm(int, int *, double *, int, int *) override; + void unpack_forward_comm(int, int, double *) override; + int pack_reverse_comm(int, int, double *) override; + void unpack_reverse_comm(int, int *, double *) override; void forward_gradients(); void forward_fields(); double **gradv; @@ -44,7 +44,7 @@ class ComputeRHEOGrad : public Compute { int stage; private: - int dim, comm_stage; + int comm_stage; int ncomm_grad, ncomm_field; double cut, cutsq, rho0; class NeighList *list; diff --git a/src/RHEO/fix_rheo.cpp b/src/RHEO/fix_rheo.cpp index 17108b4c91..b77a35dd95 100644 --- a/src/RHEO/fix_rheo.cpp +++ b/src/RHEO/fix_rheo.cpp @@ -123,6 +123,12 @@ void FixRHEO::post_constructor() if (shift_flag) compute_vshift = dynamic_cast(modify->add_compute(fmt::format("rheo_vshift all rheo/vshift {}", cut))); + + + //todo here + //allocate memory for viscosity, pressure, etc + //don't want to save to restart/datafiles (could disable fix store/state) + //but do want it available for dupm files } /* ---------------------------------------------------------------------- */ @@ -142,6 +148,9 @@ void FixRHEO::init() { dtv = update->dt; dtf = 0.5 * update->dt * force->ftm2v; + + if (modify->get_fix_by_style("rheo").size() > 1) + error->all(FLERR,"Can only specify one instance of fix rheo"); } /* ---------------------------------------------------------------------- */ diff --git a/src/RHEO/fix_rheo.h b/src/RHEO/fix_rheo.h index 8597eb2809..24be629efe 100644 --- a/src/RHEO/fix_rheo.h +++ b/src/RHEO/fix_rheo.h @@ -47,7 +47,8 @@ class FixRHEO : public Fix { int viscosity_fix_defined; int pressure_fix_defined; - int *status, *surface; + // Non-persistent per-atom arrays are initialized here + int *surface; double *conductivity, *viscosity, *pressure; double **f_pressure; diff --git a/src/RHEO/fix_rheo_viscosity.cpp b/src/RHEO/fix_rheo_viscosity.cpp new file mode 100644 index 0000000000..9f7d3cf23c --- /dev/null +++ b/src/RHEO/fix_rheo_viscosity.cpp @@ -0,0 +1,198 @@ +/* ---------------------------------------------------------------------- + LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator + http://lammps.sandia.gov, 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. + ------------------------------------------------------------------------- */ + +#include "fix_rheo_viscosity.h" + +#include "atom.h" +#include "comm.h" +#include "compute_rheo_grad.h" +#include "domain.h" +#include "error.h" +#include "fix_rheo.h" +#include "memory.h" +#include "modify.h" +#include "update.h" + +#include + +using namespace LAMMPS_NS; +using namespace FixConst; +enum {NONE, CONSTANT, TYPE, POWER}; + +/* ---------------------------------------------------------------------- */ + +FixRHEOViscosity::FixRHEOViscosity(LAMMPS *lmp, int narg, char **arg) : + Fix(lmp, narg, arg), eta_type(nullptr) +{ + if (narg < 4) error->all(FLERR,"Illegal fix command"); + + viscosity_style = NONE; + + comm_forward = 1; + + int ntypes = atom->ntypes; + int iarg = 3; + if (strcmp(arg[iarg],"constant") == 0) { + if (iarg+1 >= narg) error->all(FLERR,"Insufficient arguments for fix rheo/viscosity"); + viscosity_style = CONSTANT; + eta = utils::numeric(FLERR,arg[iarg + 1],false,lmp); + if (eta < 0.0) error->all(FLERR,"The viscosity must be positive in fix rheo/viscosity"); + iarg += 1; + } else if (strcmp(arg[iarg],"type") == 0) { + if(iarg+ntypes >= narg) error->all(FLERR,"Insufficient arguments for fix rheo/viscosity"); + viscosity_style = TYPE; + memory->create(eta_type, ntypes + 1, "rheo_thermal:eta_type"); + for (int i = 1; i <= ntypes; i++) { + eta_type[i] = utils::numeric(FLERR,arg[iarg + 1 + i], false, lmp); + if (eta_type[i] < 0.0) error->all(FLERR,"The viscosity must be positive in fix rheo/viscosity"); + } + iarg += ntypes; + } else if (strcmp(arg[iarg],"power") == 0) { + if (iarg+4 >= narg) error->all(FLERR,"Insufficient arguments for fix rheo/viscosity"); + viscosity_style = POWER; + eta = utils::numeric(FLERR,arg[iarg + 1],false,lmp); + gd0 = utils::numeric(FLERR,arg[iarg + 2],false,lmp); + K = utils::numeric(FLERR,arg[iarg + 3],false,lmp); + npow = utils::numeric(FLERR,arg[iarg + 4],false,lmp); + tau0 = eta * gd0 - K * pow(gd0, npow); + if (eta < 0.0) error->all(FLERR,"The viscosity must be positive in fix rheo/viscosity"); + iarg += 5; + } else { + error->all(FLERR,"Illegal fix command, {}", arg[iarg]); + } + + if (viscosity_style == NONE) + error->all(FLERR,"Must specify viscosity style for fix/rheo/viscosity"); +} + +/* ---------------------------------------------------------------------- */ + +FixRHEOViscosity::~FixRHEOViscosity() +{ + memory->destroy(eta_type); +} + +/* ---------------------------------------------------------------------- */ + +int FixRHEOViscosity::setmask() +{ + int mask = 0; + mask |= PRE_FORCE; + return mask; +} + +/* ---------------------------------------------------------------------- */ + +void FixRHEOViscosity::init() +{ + auto fixes = modify->get_fix_by_style("rheo"); + if (fixes.size() == 0) error->all(FLERR, "Need to define fix rheo to use fix rheo/viscosity"); + fix_rheo = dynamic_cast(fixes[0]); + + fix_rheo->viscosity_fix_defined = 1; + compute_grad = fix_rheo->compute_grad; +} + +/* ---------------------------------------------------------------------- */ + +void FixRHEOViscosity::setup_pre_force(int /*vflag*/) +{ + // Identify whether this is the last instance of fix viscosity + // Will handle communication + last_flag = 0; + + int i = 0; + auto fixlist = modify->get_fix_by_style("rheo/viscosity"); + for (const auto &ifix : fixlist) { + if (strcmp(ifix->id, id) == 0) break; + i++; + } + + if ((i + 1) == fixlist.size()) last_flag = 1; + + pre_force(0); +} + +/* ---------------------------------------------------------------------- */ + +void FixRHEOViscosity::pre_force(int /*vflag*/) +{ + int i, a, b; + double tmp, gdot; + + int *type = atom->type; + double *viscosity = fix_rheo->viscosity; + int *mask = atom->mask; + double **gradv = compute_grad->gradv; + + int nlocal = atom->nlocal; + int dim = domain->dimension; + + for (i = 0; i < nlocal; i++) { + if (mask[i] & groupbit) { + if (viscosity_style == CONSTANT) { + viscosity[i] = eta; + } else if (viscosity_style == TYPE) { + viscosity[i] = eta_type[type[i]]; + } else if (viscosity_style == POWER) { + gdot = 0.0; + for (a = 0; a < dim; a++) { + for (b = a; b < dim; b++) { + tmp = gradv[i][a * dim + b] + gradv[i][b * dim + a]; + tmp = tmp * tmp; + if (a == b) tmp *= 0.5; + gdot += tmp; + } + } + gdot = sqrt(gdot); + if (gdot <= gd0) { + viscosity[i] = eta; + } else { + viscosity[i] = K * pow(gdot, npow - 1) + tau0 / gdot; + } + } + } + } + + if (last_flag) comm->forward_comm(this); +} + +/* ---------------------------------------------------------------------- */ + +int FixRHEOViscosity::pack_forward_comm(int n, int *list, double *buf, + int /*pbc_flag*/, int * /*pbc*/) +{ + int i,j,k,m; + double *viscosity = fix_rheo->viscosity; + m = 0; + + for (i = 0; i < n; i++) { + j = list[i]; + buf[m++] = viscosity[j]; + } + return m; +} + +/* ---------------------------------------------------------------------- */ + +void FixRHEOViscosity::unpack_forward_comm(int n, int first, double *buf) +{ + int i, k, m, last; + double *viscosity = fix_rheo->viscosity; + + m = 0; + last = first + n; + for (i = first; i < last; i++) { + viscosity[i] = buf[m++]; + } +} diff --git a/src/RHEO/fix_rheo_viscosity.h b/src/RHEO/fix_rheo_viscosity.h new file mode 100644 index 0000000000..130d4d8cc8 --- /dev/null +++ b/src/RHEO/fix_rheo_viscosity.h @@ -0,0 +1,49 @@ +/* -*- 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(rheo/viscosity,FixRHEOViscosity) +// clang-format on +#else + +#ifndef LMP_FIX_RHEO_VISCOSITY_H +#define LMP_FIX_RHEO_VISCOSITY_H + +#include "fix.h" + +namespace LAMMPS_NS { + +class FixRHEOViscosity : public Fix { + public: + FixRHEOViscosity(class LAMMPS *, int, char **); + ~FixRHEOViscosity(); + int setmask() override; + void init() override; + virtual void setup_pre_force(int) override; + void pre_force(int) override; + int pack_forward_comm(int, int *, double *, int, int *) override; + void unpack_forward_comm(int, int, double *) override; + private: + double *eta_type, eta; + double npow, K, gd0, tau0; + int viscosity_style; + int last_flag; + class FixRHEO *fix_rheo; + class ComputeRHEOGrad *compute_grad; +}; + +} // namespace LAMMPS_NS + +#endif +#endif From 4ac7a228b5ebcb6ba656713179d8ac331417ed6f Mon Sep 17 00:00:00 2001 From: jtclemm Date: Mon, 20 Feb 2023 12:47:51 -0700 Subject: [PATCH 004/158] Revamping atom data storage in fixes --- src/RHEO/fix_rheo.cpp | 84 +++++++++++++++++++++++++-------- src/RHEO/fix_rheo.h | 14 ++++-- src/RHEO/fix_rheo_viscosity.cpp | 13 ++++- src/RHEO/fix_rheo_viscosity.h | 3 +- 4 files changed, 88 insertions(+), 26 deletions(-) diff --git a/src/RHEO/fix_rheo.cpp b/src/RHEO/fix_rheo.cpp index b77a35dd95..f5a5f8b151 100644 --- a/src/RHEO/fix_rheo.cpp +++ b/src/RHEO/fix_rheo.cpp @@ -21,6 +21,7 @@ #include "compute_rheo_vshift.h" #include "domain.h" #include "error.h" +#include "fix_store_peratom.h" #include "force.h" #include "modify.h" #include "update.h" @@ -33,15 +34,30 @@ using namespace FixConst; FixRHEO::FixRHEO(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg), compute_grad(nullptr), compute_kernel(nullptr), - compute_interface(nullptr), compute_rhosum(nullptr), compute_vshift(nullptr) + compute_interface(nullptr), compute_rhosum(nullptr), compute_vshift(nullptr), + fix_store_visc(nullptr), fix_store_pres(nullptr), fix_store_cond(nullptr), + fix_store_surf(nullptr), fix_store_fp(nullptr), surface(nullptr), conductivity(nullptr), + viscosity(nullptr), pressure(nullptr), f_pressure(nullptr) { + time_integrate = 1; + + viscosity_fix_defined = 0; + pressure_fix_defined = 0; + thermal_fix_defined = 0; + surface_fix_defined = 0; + thermal_flag = 0; rhosum_flag = 0; shift_flag = 0; - solid_flag = 0; + interface_flag = 0; + surface_flag = 0; + rho0 = 1.0; csq = 1.0; + if (igroup != 0) + error->all(FLERR,"fix rheo command requires group all"); + if (atom->rho_flag != 1) error->all(FLERR,"fix rheo command requires atom_style with density"); if (atom->status_flag != 1) @@ -68,6 +84,10 @@ FixRHEO::FixRHEO(LAMMPS *lmp, int narg, char **arg) : shift_flag = 1; } else if (strcmp(arg[iarg],"thermal") == 0) { thermal_flag = 1; + } else if (strcmp(arg[iarg],"surface/detection") == 0) { + surface_flag = 1; + } else if (strcmp(arg[iarg],"interface/reconstruction") == 0) { + interface_flag = 1; } else if (strcmp(arg[iarg],"rhosum") == 0) { rhosum_flag = 1; if(iarg + 1 >= narg) error->all(FLERR,"Illegal rhosum option in fix rheo"); @@ -86,17 +106,18 @@ FixRHEO::FixRHEO(LAMMPS *lmp, int narg, char **arg) : } iarg += 1; } - - time_integrate = 1; - thermal_fix_defined = 0; - viscosity_fix_defined = 0; - pressure_fix_defined = 0; } /* ---------------------------------------------------------------------- */ FixRHEO::~FixRHEO() { + if (fix_store_visc) modify->delete_fix("rheo_store_visc"); + if (fix_store_pres) modify->delete_fix("rheo_store_pres"); + if (fix_store_surf) modify->delete_fix("rheo_store_surf"); + if (fix_store_cond) modify->delete_fix("rheo_store_cond"); + if (fix_store_fp) modify->delete_fix("rheo_store_fp"); + if (compute_kernel) modify->delete_compute("rheo_kernel"); if (compute_grad) modify->delete_compute("rheo_grad"); if (compute_interface) modify->delete_compute("rheo_interface"); @@ -110,13 +131,18 @@ void FixRHEO::post_constructor() { compute_kernel = dynamic_cast(modify->add_compute(fmt::format("rheo_kernel all rheo/kernel {} {} {}", kernel_style, zmin_kernel, cut))); - if (thermal_flag) - compute_grad = dynamic_cast(modify->add_compute(fmt::format("rheo_grad all rheo/grad {} velocity rho viscosity temprature", cut))); - else - compute_grad = dynamic_cast(modify->add_compute(fmt::format("rheo_grad all rheo/grad {} velocity rho viscosity", cut))); - compute_grad->fix_rheo = this; + fix_store_visc = dynamic_cast(modify->add_fix("rheo_store_visc all STORE/PERATOM 0 1")) + fix_store_visc->disable = 1; + viscosity = fix_store_visc->vstore; + fix_store_pres = dynamic_cast(modify->add_fix("rheo_store_pres all STORE/PERATOM 0 1")) + pressure = fix_store_pres->vstore; + fix_store_pres->disable = 1; - compute_interface = dynamic_cast(modify->add_compute(fmt::format("rheo_interface all rheo/interface {}", cut))); + + std::string cmd = "rheo_grad all rheo/grad {} velocity rho viscosity"; + if (thermal_flag) cmd += "temperature"; + compute_grad = dynamic_cast(modify->add_compute(fmt::format(cmd, cut))); + compute_grad->fix_rheo = this; if (rhosum_flag) compute_rhosum = dynamic_cast(modify->add_compute(fmt::format("rheo_rhosum all rheo/rho/sum {} {}", cut, zmin_rhosum))); @@ -124,11 +150,25 @@ void FixRHEO::post_constructor() if (shift_flag) compute_vshift = dynamic_cast(modify->add_compute(fmt::format("rheo_vshift all rheo/vshift {}", cut))); + if (surface_flag) { + fix_store_surf = dynamic_cast(modify->add_fix("rheo_store_surf all STORE/PERATOM 0 1")) + surface = fix_store_surf->vstore; + fix_store_surf->disable = 1; + } - //todo here - //allocate memory for viscosity, pressure, etc - //don't want to save to restart/datafiles (could disable fix store/state) - //but do want it available for dupm files + if (thermal_flag) { + fix_store_cond = dynamic_cast(modify->add_fix("rheo_store_cond all STORE/PERATOM 0 1")) + conductivity = fix_store_cond->vstore; + fix_store_cond->disable = 1; + } + + if (interface_flag) { + compute_interface = dynamic_cast(modify->add_compute(fmt::format("rheo_interface all rheo/interface {}", cut))); + + fix_store_fp = dynamic_cast(modify->add_fix("rheo_store_fp all STORE/PERATOM 0 3")) + f_pressure = fix_store_fp->astore; + fix_store_fp->disable = 1; + } } /* ---------------------------------------------------------------------- */ @@ -158,19 +198,23 @@ void FixRHEO::init() void FixRHEO::setup_pre_force(int /*vflag*/) { // Check to confirm all accessory fixes are defined - if(!thermal_fix_defined && thermal_flag) - error->all(FLERR, "Missing fix rheo/thermal"); - if (!viscosity_fix_defined) error->all(FLERR, "Missing fix rheo/viscosity"); if (!pressure_fix_defined) error->all(FLERR, "Missing fix rheo/pressure"); + if(!thermal_fix_defined && thermal_flag) + error->all(FLERR, "Missing fix rheo/thermal"); + + if(!surface_fix_defined && surface_flag) + error->all(FLERR, "Missing fix rheo/surface"); + // Reset to zero for next run thermal_fix_defined = 0; viscosity_fix_defined = 0; pressure_fix_defined = 0; + surface_fix_defined = 0; pre_force(0); } diff --git a/src/RHEO/fix_rheo.h b/src/RHEO/fix_rheo.h index 24be629efe..1e35701278 100644 --- a/src/RHEO/fix_rheo.h +++ b/src/RHEO/fix_rheo.h @@ -41,17 +41,25 @@ class FixRHEO : public Fix { int thermal_flag; int rhosum_flag; int shift_flag; - int solid_flag; + int interface_flag; + int surface_flag; - int thermal_fix_defined; int viscosity_fix_defined; int pressure_fix_defined; + int thermal_fix_defined; + int surface_fix_defined; - // Non-persistent per-atom arrays are initialized here + // Non-persistent per-atom arrays int *surface; double *conductivity, *viscosity, *pressure; double **f_pressure; + class FixStorePeratom *fix_store_visc; + class FixStorePeratom *fix_store_pres; + class FixStorePeratom *fix_store_cond; + class FixStorePeratom *fix_store_surf; + class FixStorePeratom *fix_store_fp; + class ComputeRHEOGrad *compute_grad; class ComputeRHEOKernel *compute_kernel; class ComputeRHEOInterface *compute_interface; diff --git a/src/RHEO/fix_rheo_viscosity.cpp b/src/RHEO/fix_rheo_viscosity.cpp index 9f7d3cf23c..846eb0f97f 100644 --- a/src/RHEO/fix_rheo_viscosity.cpp +++ b/src/RHEO/fix_rheo_viscosity.cpp @@ -39,6 +39,7 @@ FixRHEOViscosity::FixRHEOViscosity(LAMMPS *lmp, int narg, char **arg) : viscosity_style = NONE; comm_forward = 1; + nmax = atom->nmax; int ntypes = atom->ntypes; int iarg = 3; @@ -107,8 +108,10 @@ void FixRHEOViscosity::init() void FixRHEOViscosity::setup_pre_force(int /*vflag*/) { - // Identify whether this is the last instance of fix viscosity - // Will handle communication + // Identify whether this is the first/last instance of fix viscosity + // First will handle growing arrays + // Last will handle communication + first_flag = 0 last_flag = 0; int i = 0; @@ -118,6 +121,7 @@ void FixRHEOViscosity::setup_pre_force(int /*vflag*/) i++; } + if (i == 0) first_flag = 1; if ((i + 1) == fixlist.size()) last_flag = 1; pre_force(0); @@ -138,6 +142,11 @@ void FixRHEOViscosity::pre_force(int /*vflag*/) int nlocal = atom->nlocal; int dim = domain->dimension; + if (first_flag & nmax < atom->nmax) { + nmax = atom->nmax; + fix_rheo->fix_store_visc->grow_arrays(nmax); + } + for (i = 0; i < nlocal; i++) { if (mask[i] & groupbit) { if (viscosity_style == CONSTANT) { diff --git a/src/RHEO/fix_rheo_viscosity.h b/src/RHEO/fix_rheo_viscosity.h index 130d4d8cc8..b907617477 100644 --- a/src/RHEO/fix_rheo_viscosity.h +++ b/src/RHEO/fix_rheo_viscosity.h @@ -38,7 +38,8 @@ class FixRHEOViscosity : public Fix { double *eta_type, eta; double npow, K, gd0, tau0; int viscosity_style; - int last_flag; + int first_flag, last_flag; + int nmax; class FixRHEO *fix_rheo; class ComputeRHEOGrad *compute_grad; }; From c73f9188ce5d26c78e4119436a44ebb582bc6792 Mon Sep 17 00:00:00 2001 From: jtclemm Date: Mon, 20 Feb 2023 20:42:44 -0700 Subject: [PATCH 005/158] Initial thermal/pair files --- src/RHEO/fix_rheo_thermal.cpp | 382 +++++++++++++++++++++++++ src/RHEO/fix_rheo_thermal.h | 73 +++++ src/RHEO/pair_rheo.cpp | 517 ++++++++++++++++++++++++++++++++++ src/RHEO/pair_rheo.h | 59 ++++ 4 files changed, 1031 insertions(+) create mode 100644 src/RHEO/fix_rheo_thermal.cpp create mode 100644 src/RHEO/fix_rheo_thermal.h create mode 100644 src/RHEO/pair_rheo.cpp create mode 100644 src/RHEO/pair_rheo.h diff --git a/src/RHEO/fix_rheo_thermal.cpp b/src/RHEO/fix_rheo_thermal.cpp new file mode 100644 index 0000000000..ed56d5a618 --- /dev/null +++ b/src/RHEO/fix_rheo_thermal.cpp @@ -0,0 +1,382 @@ +/* ---------------------------------------------------------------------- + LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator + http://lammps.sandia.gov, 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. +------------------------------------------------------------------------- */ + +#include "fix_rheo_thermal.h" +#include "fix_rheo.h" +#include "atom.h" +#include "memory.h" +#include "modify.h" +#include "error.h" +#include "update.h" +#include "force.h" +#include "math_extra.h" + +using namespace LAMMPS_NS; +using namespace FixConst; +enum {NONE, CONSTANT, TYPE, ALUMINUM}; + +/* ---------------------------------------------------------------------- */ + +FixRHEOThermal::FixRHEOThermal(LAMMPS *lmp, int narg, char **arg) : + Fix(lmp, narg, arg) +{ + if (narg < 4) error->all(FLERR,"Illegal fix command"); + + Tc_style = NONE; + cv_style = NONE; + alpha_style = NONE; + conductivity_style = NONE; + dynamic_group_allow = 1; + + Tc_type = nullptr; + kappa_type = nullptr; + cv_type = nullptr; + alpha_type = nullptr; + + int ntypes = atom->ntypes; + int iarg = 3; + while (iarg < narg) { + if (strcmp(arg[iarg],"conductivity") == 0) { + // Conductivity arguments + if (iarg+1 >= narg) error->all(FLERR,"Illegal fix command"); + if (strcmp(arg[iarg+1],"constant") == 0) { + if (iarg+2 >= narg) error->all(FLERR,"Illegal fix command"); + conductivity_style = CONSTANT; + kappa = utils::numeric(FLERR,arg[iarg+2],false,lmp); + if (kappa < 0.0) error->all(FLERR,"Illegal fix command"); + iarg += 2; + } else if (strcmp(arg[iarg+1],"type") == 0) { + if (iarg+1+ntypes >= narg) error->all(FLERR,"Illegal fix command"); + conductivity_style = TYPE; + memory->create(kappa_type,ntypes+1,"rheo_thermal:kappa_type"); + for (int i = 1; i <= ntypes; i++) { + kappa_type[i] = utils::numeric(FLERR,arg[iarg+1+i],false,lmp); + if (kappa_type[i] < 0.0) error->all(FLERR,"Illegal fix command"); + } + iarg += 1+ntypes; + } else { + error->all(FLERR,"Illegal fix command"); + } + } else if (strcmp(arg[iarg],"cv") == 0) { + // Cv arguments + if (iarg+1 >= narg) error->all(FLERR,"Illegal fix command"); + if (strcmp(arg[iarg+1],"constant") == 0) { + if (iarg+2 >= narg) error->all(FLERR,"Illegal fix command"); + cv_style = CONSTANT; + cv = utils::numeric(FLERR,arg[iarg+2],false,lmp); + if (cv < 0.0) error->all(FLERR,"Illegal fix command"); + iarg += 2; + } else if (strcmp(arg[iarg+1],"type") == 0) { + if (iarg+1+ntypes >= narg) error->all(FLERR,"Illegal fix command"); + cv_style = TYPE; + memory->create(cv_type,ntypes+1,"rheo_thermal:cv_type"); + for (int i = 1; i <= ntypes; i++) { + cv_type[i] = utils::numeric(FLERR,arg[iarg+1+i],false,lmp); + if (cv_type[i] < 0.0) error->all(FLERR,"Illegal fix command"); + } + iarg += 1+ntypes; + } else { + error->all(FLERR,"Illegal fix command"); + } + } else if (strcmp(arg[iarg],"alpha") == 0) { + // Cv arguments + if (iarg+1 >= narg) error->all(FLERR,"Illegal fix command"); + if (strcmp(arg[iarg+1],"constant") == 0) { + if (iarg+2 >= narg) error->all(FLERR,"Illegal fix command"); + alpha_style = CONSTANT; + alpha = utils::numeric(FLERR,arg[iarg+2],false,lmp); + iarg += 2; + } else if (strcmp(arg[iarg+1],"type") == 0) { + if (iarg+1+ntypes >= narg) error->all(FLERR,"Illegal fix command"); + alpha_style = TYPE; + memory->create(alpha_type,ntypes+1,"rheo_thermal:alpha_type"); + for (int i = 1; i <= ntypes; i++) { + alpha_type[i] = utils::numeric(FLERR,arg[iarg+1+i],false,lmp); + if (alpha_type[i] < 0.0) error->all(FLERR,"Illegal fix command"); + } + iarg += 1+ntypes; + } else { + error->all(FLERR,"Illegal fix command"); + } + } else if (strcmp(arg[iarg],"Tfreeze") == 0) { + // T freeze arguments + if (iarg+1 >= narg) error->all(FLERR,"Illegal fix command"); + if (strcmp(arg[iarg+1],"constant") == 0) { + if (iarg+2 >= narg) error->all(FLERR,"Illegal fix command"); + Tc_style = CONSTANT; + Tc = utils::numeric(FLERR,arg[iarg+2],false,lmp); + if (Tc < 0.0) error->all(FLERR,"Illegal fix command"); + iarg += 2; + } else if (strcmp(arg[iarg+1],"type") == 0) { + if (iarg+1+ntypes >= narg) error->all(FLERR,"Illegal fix command"); + Tc_style = TYPE; + memory->create(Tc_type,ntypes+1,"rheo_thermal:Tc_type"); + for (int i = 1; i <= ntypes; i++) { + Tc_type[i] = utils::numeric(FLERR,arg[iarg+1+i],false,lmp); + if (Tc_type[i] < 0.0) error->all(FLERR,"Illegal fix command"); + } + iarg += 1+ntypes; + } else { + error->all(FLERR,"Illegal fix command"); + } + } else { + error->all(FLERR,"Illegal fix command"); + } + iarg += 1; + } + + if (cv_style == NONE || conductivity_style == NONE) + error->all(FLERR, "Must specify specific heat and conductivity styles\n"); +} + +/* ---------------------------------------------------------------------- */ + +FixRHEOThermal::~FixRHEOThermal() +{ + // If fix rheo is still defined, remove any set flags + if (fix_rheo) { + //fix_rheo->thermal_fix_defined = 0; + //if(viscosity_style != NONE) fix_rheo->viscosity_fix_defined = 0; + } + + memory->destroy(cv_type); + memory->destroy(Tc_type); + memory->destroy(kappa_type); + memory->destroy(alpha_type); +} + +/* ---------------------------------------------------------------------- */ + +int FixRHEOThermal::setmask() +{ + int mask = 0; + mask |= PRE_FORCE; + mask |= INITIAL_INTEGRATE; + mask |= POST_INTEGRATE; + mask |= END_OF_STEP; + return mask; +} + +/* ---------------------------------------------------------------------- */ + +void FixRHEOThermal::init() +{ + int flag; + int ifix = modify->find_fix_by_style("rheo"); + if (ifix == -1) error->all(FLERR, "Need to define fix rheo to use fix rheo/thermal"); + fix_rheo = ((FixRHEO *) modify->fix[ifix]); + + if (!fix_rheo->thermal_flag) error->all(FLERR, "Need to define thermal setting in fix rheo"); + + if (fix_rheo->thermal_fix_defined) + error->all(FLERR, "Cannot define two rheo thermal evolution fixes"); + fix_rheo->thermal_fix_defined = 1; + + int ifix2 = modify->find_fix_by_style("rheo/thermal"); + if (ifix > ifix2) + error->all(FLERR, "Fix RHEO must be defined before fix RHEO/thermal"); + + dtf = 0.5 * update->dt * force->ftm2v; +} + +/* ---------------------------------------------------------------------- */ + +void FixRHEOThermal::initial_integrate(int /*vflag*/) +{ + // update temperature from shifting + int i; + int *status = atom->status; + double **gradt = compute_grad->gradt; + double **vshift = compute_vshift->array_atom; + + int *mask = atom->mask; + int nlocal = atom->nlocal; + + if (igroup == atom->firstgroup) + nlocal = atom->nfirst; + + if (shift_flag) { + compute_vshift->correct_surfaces(); + for (i = 0; i < nlocal; i++) { + + if (!(status[i] & STATUS_SHIFT)) continue; + + if (mask[i] & groupbit) { + for (a = 0; a < dim; a++) { + temperature[i] += dtv * vshift[i][a] * gradt[i][a]; + } + } + } + } +} + + +/* ---------------------------------------------------------------------- */ + +void FixRHEOThermal::setup_pre_force(int /*vflag*/) +{ + pre_force(0); +} + +/* ---------------------------------------------------------------------- */ + +void FixRHEOThermal::post_integrate() +{ + //Post integrate teo ensure gradient up to date + int *phase = atom->phase; + double *temp = atom->temp; + double *heat = atom->heat; + double *rho = atom->rho; + int *mask = atom->mask; + + double cvi, Tc, Tci, Ti, alphai; + + //Integrate temperature and check phase + for (int i = 0; i < atom->nlocal; i++) { + if (mask[i] & groupbit) { + if (phase[i] == FixRHEO::FLUID_NO_FORCE) continue; + + cvi = calc_cv(i); + temp[i] += dtf*heat[i]/cvi; + + if (alpha_style != NONE && phase[i] <= FixRHEO::FLUID_MAX) { + alphai = calc_alpha(i); + rho[i] += dtf*heat[i]/cvi*alphai; + } + + if (Tc_style != NONE) { + Ti = temp[i]; + Tci = calc_Tc(i); + + if (Ti > Tci) { + phase[i] = FixRHEO::FLUID; + } else { + if (phase[i] == FixRHEO::SOLID) { + continue; + } else { + phase[i] = FixRHEO::FREEZING; + } + } + } + } + } +} + +/* ---------------------------------------------------------------------- */ + +void FixRHEOThermal::pre_force(int /*vflag*/) +{ + double *conductivity = atom->conductivity; + int *mask = atom->mask; + int nlocal = atom->nlocal; + + // Calculate non-persistent quantities before pairstyles + for (int i = 0; i < nlocal; i++) { + if (mask[i] & groupbit) { + conductivity[i] = calc_kappa(i); + } + } +} + +/* ---------------------------------------------------------------------- */ + +void FixRHEOThermal::end_of_step() +{ + double *temp = atom->temp; + double *heat = atom->heat; + int *phase = atom->phase; + int *mask = atom->mask; + double *rho = atom->rho; + + double cvi, alphai; + + //Integrate temperature and check phase + for (int i = 0; i < atom->nlocal; i++) { + if (mask[i] & groupbit) { + if (phase[i] == FixRHEO::FLUID_NO_FORCE) continue; + + cvi = calc_cv(i); + temp[i] += dtf*heat[i]/cvi; + + if (alpha_style != NONE && phase[i] <= FixRHEO::FLUID_MAX) { + alphai = calc_alpha(i); + rho[i] += dtf*heat[i]/cvi*alphai; + } + } + } +} + +/* ---------------------------------------------------------------------- */ + +void FixRHEOThermal::reset_dt() +{ + dtv = update->dt; + dtf = 0.5 * update->dt * force->ftm2v; +} + +/* ---------------------------------------------------------------------- */ + +double FixRHEOThermal::calc_kappa(int i) +{ + if (conductivity_style == CONSTANT) { + return kappa; + } else if (conductivity_style == TYPE) { + int itype = atom->type[i]; + return(kappa_type[itype]); + } else { + error->all(FLERR, "Invalid style"); + } +} + +/* ---------------------------------------------------------------------- */ + +double FixRHEOThermal::calc_cv(int i) +{ + if (cv_style == CONSTANT) { + return cv; + } else if (cv_style == TYPE) { + int itype = atom->type[i]; + return(cv_type[itype]); + } else { + error->all(FLERR, "Invalid style"); + } +} + + +/* ---------------------------------------------------------------------- */ + +double FixRHEOThermal::calc_alpha(int i) +{ + if (alpha_style == CONSTANT) { + return alpha; + } else if (alpha_style == TYPE) { + int itype = atom->type[i]; + return(alpha_type[itype]); + } else { + error->all(FLERR, "Invalid style"); + } +} + +/* ---------------------------------------------------------------------- */ + +double FixRHEOThermal::calc_Tc(int i) +{ + if (Tc_style == CONSTANT) { + return Tc; + } else if (Tc_style == TYPE) { + int itype = atom->type[i]; + return(Tc_type[itype]); + } else { + error->all(FLERR, "Invalid style"); + } +} \ No newline at end of file diff --git a/src/RHEO/fix_rheo_thermal.h b/src/RHEO/fix_rheo_thermal.h new file mode 100644 index 0000000000..d1dcdc6e4d --- /dev/null +++ b/src/RHEO/fix_rheo_thermal.h @@ -0,0 +1,73 @@ +/* -*- c++ -*- ---------------------------------------------------------- + LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator + http://lammps.sandia.gov, 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 FIX_CLASS + +FixStyle(rheo/thermal,FixRHEOThermal) + +#else + +#ifndef LMP_FIX_RHEO_THERMAL_H +#define LMP_FIX_RHEO_THERMAL_H + +#include "fix.h" + +namespace LAMMPS_NS { + +class FixRHEOThermal : public Fix { + public: + FixRHEOThermal(class LAMMPS *, int, char **); + ~FixRHEOThermal(); + int setmask(); + void init(); + void setup_pre_force(int); + void initial_integrate(); + void post_integrate(); + void pre_force(int); + void end_of_step(); + void reset_dt(); + + private: + double *cv_type, cv; + double *Tc_type, Tc; + double *kappa_type, kappa; + double *alpha_type, alpha; + double dtf, dtv; + + double calc_kappa(int); + double calc_cv(int); + double calc_Tc(int); + double calc_alpha(int); + + int Tc_style; + int cv_style; + int alpha_style; + int conductivity_style; + + class FixRHEO *fix_rheo; +}; + +} + +#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. + +*/ diff --git a/src/RHEO/pair_rheo.cpp b/src/RHEO/pair_rheo.cpp new file mode 100644 index 0000000000..b0443933e1 --- /dev/null +++ b/src/RHEO/pair_rheo.cpp @@ -0,0 +1,517 @@ +/* ---------------------------------------------------------------------- + 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 "pair_rheo.h" + +#include "atom.h" +#include "comm.h" +#include "compute_rheo_kernel.h" +#include "compute_rheo_grad.h" +#include "compute_rheo_interface.h" +#include "domain.h" +#include "error.h" +#include "fix_rheo.h" +#include "force.h" +#include "memory.h" +#include "modify.h" +#include "neighbor.h" +#include "neigh_list.h" +#include "update.h" +#include "utils.h" + +#include + +using namespace LAMMPS_NS; + +#define EPSILON 1e-2 + +/* ---------------------------------------------------------------------- */ + +PairRHEO::PairRHEO(LAMMPS *lmp) : + Pair(lmp), compute_kernel(nullptr), compute_grad(nullptr), + compute_interface(nullptr), fix_rheo(nullptr) +{ + restartinfo = 0; + single_enable = 0; + + artificial_visc_flag = 0; + rho_damp_flag = 0; + thermal_flag = 0; +} + +/* ---------------------------------------------------------------------- */ + +PairRHEO::~PairRHEO() +{ + if (allocated) { + memory->destroy(setflag); + memory->destroy(cutsq); + } +} + +/* ---------------------------------------------------------------------- */ + +void PairRHEO::compute(int eflag, int vflag) +{ + int i, j, a, b, ii, jj, inum, jnum, itype, jtype; + int error_flag, pair_force_flag, pair_rho_flag, pair_avisc_flag; + double xtmp, ytmp, ztmp; + + int *ilist, *jlist, *numneigh, **firstneigh; + double imass, jmass, rsq, r, ir; + + double w, wp, rhoi, rhoj, voli, volj, Pi, Pj; + double *dWij, *dWji, *d2Wij, *d2Wji, *dW1ij, *dW1ji; + double vijeij, etai, etaj, kappai, kappaj; + double Ti, Tj, dT; + double drho_damp, fmag; + double mu, q, cs, fp_prefactor; + double dx[3] = {0}; + double fv[3] = {0}; + double dfp[3] = {0}; + double fsolid[3] = {0}; + double du[3] = {0}; + double vi[3] = {0}; + double vj[3] = {0}; + double dv[3] = {0}; + double psi_ij = 0.0; + double Fij = 0.0; + + ev_init(eflag, vflag); + + double **gradv = compute_grad->gradv; + double **gradt = compute_grad->gradt; + double **gradr = compute_grad->gradr; + double **gradn = compute_grad->gradn; + double **v = atom->v; + double **x = atom->x; + double **f = atom->f; + double **fp = atom->fp; + double *rho = atom->rho; + double *mass = atom->mass; + double *drho = atom->drho; + double *temp = atom->temp; + double *heat = atom->heat; + double *viscosity = atom->viscosity; + double *conductivity = atom->conductivity; + double *special_lj = force->special_lj; + tagint *tag = atom->tag; + int *type = atom->type; + int *phase = atom->phase; + + int nlocal = atom->nlocal; + int newton_pair = force->newton_pair; + int dim = domain->dimension; + + inum = list->inum; + ilist = list->ilist; + numneigh = list->numneigh; + firstneigh = list->firstneigh; + + // loop over neighbors of my atoms + + for (ii = 0; ii < inum; ii++) { + i = ilist[ii]; + xtmp = x[i][0]; + ytmp = x[i][1]; + ztmp = x[i][2]; + itype = type[i]; + jlist = firstneigh[i]; + jnum = numneigh[i]; + imass = mass[itype]; + + kappai = conductivity[i]; + etai = viscosity[i]; + Ti = temp[i]; + + for (jj = 0; jj < jnum; jj++) { + j = jlist[jj]; + factor_lj = special_lj[sbmask(j)]; + j &= NEIGHMASK; + + dx[0] = xtmp - x[j][0]; + dx[1] = ytmp - x[j][1]; + dx[2] = ztmp - x[j][2]; + rsq = dx[0]*dx[0] + dx[1]*dx[1] + dx[2]*dx[2]; + jtype = type[j]; + jmass = mass[jtype]; + + if (rsq < cutsq[itype][jtype]) { + r = sqrt(rsq); + ir = 1/r; + + kappaj = conductivity[j]; + etaj = viscosity[j]; + Tj = temp[j]; + + pair_rho_flag = 0; + pair_force_flag = 0; + pair_avisc_flag = 0; + if (phase[i] <= FixRHEO::FLUID_MAX || phase[j] <= FixRHEO::FLUID_MAX) { + pair_force_flag = 1; + } + if (phase[i] <= FixRHEO::FLUID_MAX && phase[j] <= FixRHEO::FLUID_MAX) { + pair_avisc_flag = 1; + pair_rho_flag = 1; + } + + wp = compute_kernel->calc_dw(i, j, dx[0], dx[1], dx[2], r); + dWij = compute_kernel->dWij; + dWji = compute_kernel->dWji; + + for (a = 0; a < dim; a ++) { + vi[a] = v[i][a]; + vj[a] = v[j][a]; + fsolid[a] = 0.0; + } + + // Add corrections for walls + rhoi = rho[i]; + rhoj = rho[j]; + if (phase[i] <= FixRHEO::FLUID_MAX && phase[j] > FixRHEO::FLUID_MAX) { + compute_sinterpolation->correct_v(v[i], v[j], vi, i, j); + rhoj = compute_sinterpolation->correct_rho(j,i); + + // Repel if close to inner solid particle + if (compute_sinterpolation->chi[j] > 0.9 && r < (cut[itype][jtype] * 0.5)) { + fmag = (compute_sinterpolation->chi[j] - 0.9) * (cut[itype][jtype] * 0.5 - r); + fmag *= rho0[itype] * csq[itype] * cut[itype][jtype] * ir; + fsolid[0] = fmag * dx[0]; + fsolid[1] = fmag * dx[1]; + fsolid[2] = fmag * dx[2]; + } + } else if (phase[i] > FixRHEO::FLUID_MAX && phase[j] <= FixRHEO::FLUID_MAX) { + compute_sinterpolation->correct_v(v[j], v[i], vj, j, i); + rhoi = compute_sinterpolation->correct_rho(i,j); + + // Repel if close to inner solid particle + if (compute_sinterpolation->chi[i] > 0.9 && r < (cut[itype][jtype] * 0.5)) { + fmag = (compute_sinterpolation->chi[i] - 0.9) * (cut[itype][jtype] * 0.5 - r); + fmag *= rho0[jtype] * csq[jtype] * cut[itype][jtype] * ir; + fsolid[0] = fmag * dx[0]; + fsolid[1] = fmag * dx[1]; + fsolid[2] = fmag * dx[2]; + } + } else if (phase[i] > FixRHEO::FLUID_MAX && phase[j] > FixRHEO::FLUID_MAX) { + rhoi = 1.0; + rhoj = 1.0; + } + + // Compute volume and pressure after reconstructing + voli = imass / rhoi; + volj = jmass / rhoj; + Pj = calc_pressure(rhoj, jtype); + Pi = calc_pressure(rhoi, itype); + + //Check if Second order kernels will be used for eta*Lap(v) + error_flag = 0; + if (laplacian_order == 2) { + error_flag = compute_kernel->calc_d2w(i, j, dx[0], dx[1], dx[2], r); + d2Wij = compute_kernel->d2Wij; + d2Wji = compute_kernel->d2Wji; + } + + //Thermal Evolution + if (thermal_flag) { + dT = 0.0; + for (a = 0; a < dim; a++) { + dT += (kappai + kappaj) * (Ti-Tj) * dx[a] * dWij[a] * ir * ir; + //Assumes heat capacity and density = 1, needs to be generalized + } + dT *= voli * volj; + heat[i] += dT; + } + + // If either particle is fluid, compute hydrostatic and viscous forces + // Compute eta*Lap(v) - different forms depending on order of RK correction + if (pair_force_flag) { + //Hydrostatic pressure forces + fp_prefactor = voli * volj * (Pj + Pi); + + //Add artificial viscous pressure if required + if (artificial_visc_flag && pair_avisc_flag){ + //Interpolate velocities to midpoint and use this difference for artificial viscosity + for (a = 0; a < dim; a++) { + du[a] = vi[a] - vj[a]; + for (b = 0; b < dim; b++) { + du[a] -= 0.5 * (gradv[i][a * dim + b] + gradv[j][a * dim + b]) * dx[b]; + } + } + mu = (du[0] * dx[0] + du[1] * dx[1]+ du[2] * dx[2]) * hinv3; + mu = mu / (rsq * hinv3 * hinv3 + EPSILON); + mu= MIN(0.0, mu); + cs = 0.5 * (sqrt(csq[itype]) + sqrt(csq[jtype])); + // "kinematic viscous pressure" q = Q/rho + q = av*(-2.0*cs*mu + 1.0*mu*mu); + fp_prefactor += voli*volj*q*(rhoj + rhoi); + } + + // -Grad[P + Q] + dfp[0] = - fp_prefactor*dWij[0]; + dfp[1] = - fp_prefactor*dWij[1]; + dfp[2] = - fp_prefactor*dWij[2]; + + // Now compute viscous eta*Lap[v] terms + for (a = 0; a < dim; a ++) { + fv[a] = 0.0; + for (b = 0; b < dim; b++) { + fv[a] += (etai+etaj)*(vi[a]-vj[a])*dx[b]*dWij[b]*ir*ir; + } + fv[a] *= voli*volj; + } + + } else { + for (a = 0; a < dim; a ++) { + fv[a] = 0; + dfp[a] = 0; + } + } + + if (pair_force_flag) { + f[i][0] += fv[0] + dfp[0] + fsolid[0]; + f[i][1] += fv[1] + dfp[1] + fsolid[1]; + f[i][2] += fv[2] + dfp[2] + fsolid[2]; + fp[i][0] += dfp[0]; + fp[i][1] += dfp[1]; + fp[i][2] += dfp[2]; + } + + // Density damping + // conventional for low-order h + // interpolated for RK 1 & 2 (Antuono et al, Computers & Fluids 2021) + if (rho_damp_flag && pair_rho_flag) { + if (laplacian_order>=1 && error_flag == 0){ + psi_ij = rhoj-rhoi; + Fij = 0.0; + for (a = 0; a < dim; a++){ + psi_ij += 0.5*(gradr[i][a]+gradr[j][a])*dx[a]; + Fij -= dx[a]*dWij[a]; + } + Fij *= ir*ir; + drho[i] += 2*rho_damp*psi_ij*Fij*volj; + } + else { + drho_damp = 2*rho_damp*(rhoj-rhoi)*ir*wp; + drho[i] -= drho_damp*volj; + } + } + + if (evflag) // Doesn't account for unbalanced forces + ev_tally_xyz(i, j, nlocal, newton_pair, 0.0, 0.0, fv[0]+dfp[0], fv[1]+dfp[1], fv[2]+dfp[2], dx[0], dx[1], dx[2]); + + // Newton neighbors + if (newton_pair || j < nlocal) { + + if (thermal_flag) { + dT = 0.0; + for(a = 0; a < dim; a++){ + //dT += kappai*dWji[a]*gradt[i][a]; + //dT -= kappaj*dWji[a]*gradt[j][a]; + dT += 1/1*(kappai+kappaj)*(Ti-Tj)*dx[a]*dWji[a]*ir*ir; //Assumes heat capacity and density = 1, needs to be generalized + } + dT *= -voli*volj; + heat[j] -= dT; + } + + for (a = 0; a < dim; a ++) { + fv[a] = 0.0; + for (b = 0; b < dim; b++) { + //fv[a] += etai*dWji[b]*(gradv[i][a*dim+b]+gradv[i][b*dim+a]); + //fv[a] -= etaj*dWji[b]*(gradv[j][a*dim+b]+gradv[j][b*dim+a]); + fv[a] += (etai+etaj)*(vi[a]-vj[a])*dx[b]*dWji[b]*ir*ir; + } + fv[a] *= -voli*volj; // flip sign here b/c -= at accummulator + } + + + + if (pair_force_flag) { + for (a = 0; a < dim; a++) + dfp[a] = fp_prefactor*dWji[a]; + } + + if (rho_damp_flag && pair_rho_flag){ + if (laplacian_order>=1 && error_flag == 0){ + Fij = 0.0; + for (a = 0; a < dim; a++){ + Fij += dx[a]*dWji[a]; + } + Fij *= ir*ir; + psi_ij *= -1; + drho[j] += 2*rho_damp*psi_ij*Fij*voli; + } + else { + drho_damp = 2*rho_damp*(rhoj-rhoi)*ir*wp; + drho[j] += drho_damp*voli; + } + } + if (pair_force_flag) { + f[j][0] -= fv[0] + dfp[0] + fsolid[0]; + f[j][1] -= fv[1] + dfp[1] + fsolid[1]; + f[j][2] -= fv[2] + dfp[2] + fsolid[2]; + + fp[j][0] -= dfp[0]; + fp[j][1] -= dfp[1]; + fp[j][2] -= dfp[2]; + } + } + } + } + } + if (vflag_fdotr) virial_fdotr_compute(); +} + +/* ---------------------------------------------------------------------- + allocate all arrays + ------------------------------------------------------------------------- */ + +void PairRHEO::allocate() +{ + allocated = 1; + int n = atom->ntypes; + + memory->create(setflag, n + 1, n + 1, "pair:setflag"); + for (int i = 1; i <= n; i++) + for (int j = i; j <= n; j++) + setflag[i][j] = 0; + + memory->create(cutsq, n + 1, n + 1, "pair:cutsq"); +} + +/* ---------------------------------------------------------------------- + global settings + ------------------------------------------------------------------------- */ + +void PairRHEO::settings(int narg, char **arg) +{ + if(narg < 1) error->all(FLERR,"Illegal pair_style command"); + + int iarg = 0; + while (iarg < narg) { + if (strcmp(arg[iarg], "rho/damp") == 0) { + if (iarg+1 >= narg) error->all(FLERR,"Illegal pair_style command"); + + rho_damp_flag = 1; + rho_damp = utils::numeric(FLERR,arg[iarg+1],false,lmp); + iarg ++; + } else if (strcmp(arg[iarg], "artificial/visc") == 0) { + if (iarg+1 >= narg) error->all(FLERR,"Illegal pair_style command"); + + artificial_visc_flag = 1; + av = utils::numeric(FLERR,arg[iarg+1],false,lmp); + iarg ++; + } else error->all(FLERR,"Illegal pair_style command"); + iarg++; + } +} + +/* ---------------------------------------------------------------------- + set coeffs for one or more type pairs + ------------------------------------------------------------------------- */ + +void PairRHEO::coeff(int narg, char **arg) +{ + if (narg != 4) + error->all(FLERR,"Incorrect number of args for pair_style llns coefficients"); + if (!allocated) + allocate(); + + int ilo, ihi, jlo, jhi; + utils::bounds(FLERR,arg[0],1, atom->ntypes, ilo, ihi,error); + utils::bounds(FLERR,arg[1],1, atom->ntypes, jlo, jhi,error); + + double rho0_one = utils::numeric(FLERR,arg[2],false,lmp); + double c_one = utils::numeric(FLERR,arg[3],false,lmp); + + if (c_one != 1.0) error->warning(FLERR, "Need c = 1 for assumption in compute rheo/solids"); + if (rho0_one != 1.0) error->warning(FLERR, "Need rho0 = 1 for assumption in compute rheo/solids"); + + int count = 0; + for (int i = ilo; i <= ihi; i++) { + rho0[i] = rho0_one; + csq[i] = c_one*c_one; + + for (int j = 0; j <= atom->ntypes; j++) { + setflag[i][j] = 1; + count++; + } + } + + if (count == 0) + error->all(FLERR,"Incorrect args for pair llns coefficients"); +} + +/* ---------------------------------------------------------------------- + setup specific to this pair style + ------------------------------------------------------------------------- */ + +void PairRHEO::setup() +{ + int flag; + int ifix = modify->find_fix_by_style("rheo"); + if (ifix == -1) error->all(FLERR, "Using pair RHEO without fix RHEO"); + fix_rheo = ((FixRHEO *) modify->fix[ifix]); + + compute_kernel = fix_rheo->compute_kernel; + compute_grad = fix_rheo->compute_grad; + compute_sinterpolation = fix_rheo->compute_sinterpolation; + thermal_flag = fix_rheo->thermal_flag; + + + + + h = utils::numeric(FLERR,arg[0],false,lmp); + if (h <= 0.0) error->all(FLERR,"Illegal pair_style command"); + hinv = 1.0 / h; + hinv3 = 3.0 * hinv; + laplacian_order = -1; + + + if (comm->ghost_velocity == 0) + error->all(FLERR,"Pair RHEO requires ghost atoms store velocity"); + + if (laplacian_order == -1) { + if (fix_rheo->kernel_type == FixRHEO::CRK2) + laplacian_order = 2; + else if (fix_rheo->kernel_type == FixRHEO::CRK1) + laplacian_order = 1; + else + laplacian_order = 0; + } +} + +/* ---------------------------------------------------------------------- + init for one type pair i,j and corresponding j,i + ------------------------------------------------------------------------- */ + +double PairRHEO::init_one(int i, int j) +{ + if (setflag[i][j] == 0) { + error->all(FLERR,"All pair rheo coeffs are not set"); + } + + cut[i][j] = h; + cut[j][i] = cut[i][j]; + + return cut[i][j]; +} + +/* ---------------------------------------------------------------------- */ + +double PairRHEO::single(int /*i*/, int /*j*/, int /*itype*/, int /*jtype*/, + double /*rsq*/, double /*factor_coul*/, double /*factor_lj*/, double &fforce) +{ + fforce = 0.0; + + return 0.0; +} diff --git a/src/RHEO/pair_rheo.h b/src/RHEO/pair_rheo.h new file mode 100644 index 0000000000..ebe97cd542 --- /dev/null +++ b/src/RHEO/pair_rheo.h @@ -0,0 +1,59 @@ +/* -*- 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 PAIR_CLASS + +PairStyle(rheo,PairRHEO) + +#else + +#ifndef LMP_PAIR_RHEO_H +#define LMP_PAIR_RHEO_H + +#include "pair.h" + +namespace LAMMPS_NS { + +class PairRHEO : public Pair { + public: + PairRHEO(class LAMMPS *); + virtual ~PairRHEO(); + virtual void compute(int, int); + void settings(int, char **); + void coeff(int, char **); + void setup(); + virtual double init_one(int, int); + virtual double single(int, int, int, int, double, double, double, double &); + + protected: + int laplacian_order; // From fix RHEO + double h, csq*, rho0*; // From fix RHEO + + double hsq, hinv, rho0, av, rho_damp; + + int artificial_visc_flag; + int rho_damp_flag; + int thermal_flag; + + void allocate(); + + class ComputeRHEOKernel *compute_kernel; + class ComputeRHEOGrad *compute_grad; + class ComputeRHEOSolidInterpolation *compute_sinterpolation; + class FixRHEO *fix_rheo; +}; + +} + +#endif +#endif From 1adc66e82ba7c3252d28ab86771c1e3c2369caa3 Mon Sep 17 00:00:00 2001 From: jtclemm Date: Mon, 20 Feb 2023 22:07:30 -0700 Subject: [PATCH 006/158] Beginning updates to thermal fix --- src/RHEO/compute_rheo_grad.h | 2 +- src/RHEO/fix_rheo.cpp | 1 + src/RHEO/fix_rheo.h | 22 +-- src/RHEO/fix_rheo_thermal.cpp | 330 +++++++++++++------------------- src/RHEO/fix_rheo_thermal.h | 53 ++--- src/RHEO/fix_rheo_viscosity.cpp | 60 ++++-- src/RHEO/fix_rheo_viscosity.h | 5 +- src/RHEO/pair_rheo.h | 14 +- 8 files changed, 222 insertions(+), 265 deletions(-) diff --git a/src/RHEO/compute_rheo_grad.h b/src/RHEO/compute_rheo_grad.h index 35b50ca834..52c5d7c924 100644 --- a/src/RHEO/compute_rheo_grad.h +++ b/src/RHEO/compute_rheo_grad.h @@ -27,7 +27,7 @@ namespace LAMMPS_NS { class ComputeRHEOGrad : public Compute { public: ComputeRHEOGrad(class LAMMPS *, int, char **); - ~ComputeRHEOGrad(); + ~ComputeRHEOGrad() override; void init() override; void init_list(int, class NeighList *) override; void compute_peratom() override; diff --git a/src/RHEO/fix_rheo.cpp b/src/RHEO/fix_rheo.cpp index f5a5f8b151..0c3f784c0e 100644 --- a/src/RHEO/fix_rheo.cpp +++ b/src/RHEO/fix_rheo.cpp @@ -197,6 +197,7 @@ void FixRHEO::init() void FixRHEO::setup_pre_force(int /*vflag*/) { + //Need to rethink and replan // Check to confirm all accessory fixes are defined if (!viscosity_fix_defined) error->all(FLERR, "Missing fix rheo/viscosity"); diff --git a/src/RHEO/fix_rheo.h b/src/RHEO/fix_rheo.h index 1e35701278..432d319728 100644 --- a/src/RHEO/fix_rheo.h +++ b/src/RHEO/fix_rheo.h @@ -27,15 +27,15 @@ namespace LAMMPS_NS { class FixRHEO : public Fix { public: FixRHEO(class LAMMPS *, int, char **); - virtual ~FixRHEO(); - int setmask(); - virtual void post_constructor(); - virtual void init(); - virtual void setup_pre_force(int); - virtual void pre_force(int); - virtual void initial_integrate(int); - virtual void final_integrate(); - void reset_dt(); + ~FixRHEO() override; + int setmask() override; + void post_constructor() override; + void init() override; + void setup_pre_force(int) override; + void pre_force(int) override; + void initial_integrate(int) override; + void final_integrate() override; + void reset_dt() override; int kernel_style; int thermal_flag; @@ -71,7 +71,7 @@ class FixRHEO : public Fix { enum { // Phase status - STATUS_FLUID = 1 << 0, + STATUS_FLUID = 1 << 0, //Need to turn off other options STATUS_REACTIVE = 1 << 1, STATUS_SOLID = 1 << 2, STATUS_FREEZING = 1 << 3 @@ -81,7 +81,7 @@ class FixRHEO : public Fix { STATUS_NO_FORCE = 1 << 5, // Surface status - STATUS_BULK = 1 << 6, + STATUS_BULK = 1 << 6, //Need to turn off other options STATUS_LAYER = 1 << 7, STATUS_SURFACE = 1 << 8, STATUS_SPLASH = 1 << 9, diff --git a/src/RHEO/fix_rheo_thermal.cpp b/src/RHEO/fix_rheo_thermal.cpp index ed56d5a618..0fc4fe294b 100644 --- a/src/RHEO/fix_rheo_thermal.cpp +++ b/src/RHEO/fix_rheo_thermal.cpp @@ -1,136 +1,116 @@ /* ---------------------------------------------------------------------- - LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator - http://lammps.sandia.gov, Sandia National Laboratories - Steve Plimpton, sjplimp@sandia.gov + LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator + http://lammps.sandia.gov, 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. + 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. -------------------------------------------------------------------------- */ + See the README file in the top-level LAMMPS directory. + ------------------------------------------------------------------------- */ #include "fix_rheo_thermal.h" -#include "fix_rheo.h" + #include "atom.h" -#include "memory.h" -#include "modify.h" +#include "comm.h" +#include "compute_rheo_grad.h" +#include "compute_rheo_vshift.h" #include "error.h" -#include "update.h" +#include "fix_rheo.h" #include "force.h" #include "math_extra.h" +#include "memory.h" +#include "modify.h" +#include "update.h" using namespace LAMMPS_NS; using namespace FixConst; -enum {NONE, CONSTANT, TYPE, ALUMINUM}; +enum {NONE, CONSTANT, TYPE}; /* ---------------------------------------------------------------------- */ FixRHEOThermal::FixRHEOThermal(LAMMPS *lmp, int narg, char **arg) : - Fix(lmp, narg, arg) + Fix(lmp, narg, arg), Tc_type(nullptr), kappa_type(nullptr), cv_type(nullptr) { if (narg < 4) error->all(FLERR,"Illegal fix command"); Tc_style = NONE; cv_style = NONE; - alpha_style = NONE; conductivity_style = NONE; - dynamic_group_allow = 1; - Tc_type = nullptr; - kappa_type = nullptr; - cv_type = nullptr; - alpha_type = nullptr; + comm_forward = 0; + nmax = atom->nmax; int ntypes = atom->ntypes; int iarg = 3; while (iarg < narg) { if (strcmp(arg[iarg],"conductivity") == 0) { // Conductivity arguments - if (iarg+1 >= narg) error->all(FLERR,"Illegal fix command"); - if (strcmp(arg[iarg+1],"constant") == 0) { - if (iarg+2 >= narg) error->all(FLERR,"Illegal fix command"); + if (iarg + 1 >= narg) error->all(FLERR,"Insufficient arguments for conductivity option"); + if (strcmp(arg[iarg + 1],"constant") == 0) { + if (iarg + 2 >= narg) error->all(FLERR,"Insufficient arguments for conductivity option"); conductivity_style = CONSTANT; - kappa = utils::numeric(FLERR,arg[iarg+2],false,lmp); - if (kappa < 0.0) error->all(FLERR,"Illegal fix command"); + kappa = utils::numeric(FLERR,arg[iarg + 2],false,lmp); + if (kappa < 0.0) error->all(FLERR,"The conductivity must be positive"); iarg += 2; - } else if (strcmp(arg[iarg+1],"type") == 0) { - if (iarg+1+ntypes >= narg) error->all(FLERR,"Illegal fix command"); + } else if (strcmp(arg[iarg + 1],"type") == 0) { + if (iarg + 1 + ntypes >= narg) error->all(FLERR,"Insufficient arguments for conductivity option"); conductivity_style = TYPE; memory->create(kappa_type,ntypes+1,"rheo_thermal:kappa_type"); for (int i = 1; i <= ntypes; i++) { - kappa_type[i] = utils::numeric(FLERR,arg[iarg+1+i],false,lmp); - if (kappa_type[i] < 0.0) error->all(FLERR,"Illegal fix command"); + kappa_type[i] = utils::numeric(FLERR,arg[iarg + 1 + i],false,lmp); + if (kappa_type[i] < 0.0) error->all(FLERR,"The conductivity must be positive"); } - iarg += 1+ntypes; + iarg += 1 + ntypes; } else { - error->all(FLERR,"Illegal fix command"); + error->all(FLERR,"Illegal fix command, {}", arg[iarg + 1]); } } else if (strcmp(arg[iarg],"cv") == 0) { // Cv arguments - if (iarg+1 >= narg) error->all(FLERR,"Illegal fix command"); - if (strcmp(arg[iarg+1],"constant") == 0) { - if (iarg+2 >= narg) error->all(FLERR,"Illegal fix command"); + if (iarg + 1 >= narg) error->all(FLERR,"Insufficient arguments for cv option"); + if (strcmp(arg[iarg + 1],"constant") == 0) { + if (iarg + 2 >= narg) error->all(FLERR,"Insufficient arguments for cv option"); cv_style = CONSTANT; - cv = utils::numeric(FLERR,arg[iarg+2],false,lmp); - if (cv < 0.0) error->all(FLERR,"Illegal fix command"); + cv = utils::numeric(FLERR,arg[iarg + 2],false,lmp); + if (cv < 0.0) error->all(FLERR,"The specific heat must be positive"); iarg += 2; - } else if (strcmp(arg[iarg+1],"type") == 0) { - if (iarg+1+ntypes >= narg) error->all(FLERR,"Illegal fix command"); + } else if (strcmp(arg[iarg + 1],"type") == 0) { + if (iarg + 1 + ntypes >= narg) error->all(FLERR,"Insufficient arguments for cv option"); cv_style = TYPE; - memory->create(cv_type,ntypes+1,"rheo_thermal:cv_type"); + memory->create(cv_type,ntypes + 1,"rheo_thermal:cv_type"); for (int i = 1; i <= ntypes; i++) { - cv_type[i] = utils::numeric(FLERR,arg[iarg+1+i],false,lmp); - if (cv_type[i] < 0.0) error->all(FLERR,"Illegal fix command"); + cv_type[i] = utils::numeric(FLERR,arg[iarg + 1 + i],false,lmp); + if (cv_type[i] < 0.0) error->all(FLERR,"The specific heat must be positive"); } - iarg += 1+ntypes; + iarg += 1 + ntypes; } else { - error->all(FLERR,"Illegal fix command"); - } - } else if (strcmp(arg[iarg],"alpha") == 0) { - // Cv arguments - if (iarg+1 >= narg) error->all(FLERR,"Illegal fix command"); - if (strcmp(arg[iarg+1],"constant") == 0) { - if (iarg+2 >= narg) error->all(FLERR,"Illegal fix command"); - alpha_style = CONSTANT; - alpha = utils::numeric(FLERR,arg[iarg+2],false,lmp); - iarg += 2; - } else if (strcmp(arg[iarg+1],"type") == 0) { - if (iarg+1+ntypes >= narg) error->all(FLERR,"Illegal fix command"); - alpha_style = TYPE; - memory->create(alpha_type,ntypes+1,"rheo_thermal:alpha_type"); - for (int i = 1; i <= ntypes; i++) { - alpha_type[i] = utils::numeric(FLERR,arg[iarg+1+i],false,lmp); - if (alpha_type[i] < 0.0) error->all(FLERR,"Illegal fix command"); - } - iarg += 1+ntypes; - } else { - error->all(FLERR,"Illegal fix command"); + error->all(FLERR,"Illegal fix command, {}", arg[iarg + 1]); } } else if (strcmp(arg[iarg],"Tfreeze") == 0) { // T freeze arguments - if (iarg+1 >= narg) error->all(FLERR,"Illegal fix command"); - if (strcmp(arg[iarg+1],"constant") == 0) { - if (iarg+2 >= narg) error->all(FLERR,"Illegal fix command"); + if (iarg+1 >= narg) error->all(FLERR,"Insufficient arguments for Tfreeze option"); + if (strcmp(arg[iarg + 1],"constant") == 0) { + if (iarg + 2 >= narg) error->all(FLERR,"Insufficient arguments for Tfreeze option"); Tc_style = CONSTANT; - Tc = utils::numeric(FLERR,arg[iarg+2],false,lmp); - if (Tc < 0.0) error->all(FLERR,"Illegal fix command"); + Tc = utils::numeric(FLERR,arg[iarg + 2],false,lmp); + if (Tc < 0.0) error->all(FLERR,"The melting temperature must be positive"); iarg += 2; - } else if (strcmp(arg[iarg+1],"type") == 0) { - if (iarg+1+ntypes >= narg) error->all(FLERR,"Illegal fix command"); + } else if (strcmp(arg[iarg + 1],"type") == 0) { + if (iarg + 1 + ntypes >= narg) error->all(FLERR,"Insufficient arguments for Tfreeze option"); Tc_style = TYPE; - memory->create(Tc_type,ntypes+1,"rheo_thermal:Tc_type"); + memory->create(Tc_type,ntypes + 1,"rheo_thermal:Tc_type"); for (int i = 1; i <= ntypes; i++) { - Tc_type[i] = utils::numeric(FLERR,arg[iarg+1+i],false,lmp); - if (Tc_type[i] < 0.0) error->all(FLERR,"Illegal fix command"); + Tc_type[i] = utils::numeric(FLERR,arg[iarg + 1 + i],false,lmp); + if (Tc_type[i] < 0.0) error->all(FLERR,"The melting temperature must be positive"); } - iarg += 1+ntypes; + iarg += 1 + ntypes; } else { - error->all(FLERR,"Illegal fix command"); + error->all(FLERR,"Illegal fix command, {}", arg[iarg + 1]); } } else { - error->all(FLERR,"Illegal fix command"); + error->all(FLERR,"Illegal fix command, {}", arg[iarg]); } iarg += 1; } @@ -143,16 +123,9 @@ FixRHEOThermal::FixRHEOThermal(LAMMPS *lmp, int narg, char **arg) : FixRHEOThermal::~FixRHEOThermal() { - // If fix rheo is still defined, remove any set flags - if (fix_rheo) { - //fix_rheo->thermal_fix_defined = 0; - //if(viscosity_style != NONE) fix_rheo->viscosity_fix_defined = 0; - } - memory->destroy(cv_type); memory->destroy(Tc_type); memory->destroy(kappa_type); - memory->destroy(alpha_type); } /* ---------------------------------------------------------------------- */ @@ -160,10 +133,11 @@ FixRHEOThermal::~FixRHEOThermal() int FixRHEOThermal::setmask() { int mask = 0; - mask |= PRE_FORCE; mask |= INITIAL_INTEGRATE; mask |= POST_INTEGRATE; - mask |= END_OF_STEP; + mask |= POST_NEIGHBOR; + mask |= PRE_FORCE; + mask |= FINAL_INTEGRATE; return mask; } @@ -171,29 +145,49 @@ int FixRHEOThermal::setmask() void FixRHEOThermal::init() { - int flag; - int ifix = modify->find_fix_by_style("rheo"); - if (ifix == -1) error->all(FLERR, "Need to define fix rheo to use fix rheo/thermal"); - fix_rheo = ((FixRHEO *) modify->fix[ifix]); + auto fixes = modify->get_fix_by_style("rheo"); + if (fixes.size() == 0) error->all(FLERR, "Need to define fix rheo to use fix rheo/viscosity"); + fix_rheo = dynamic_cast(fixes[0]); - if (!fix_rheo->thermal_flag) error->all(FLERR, "Need to define thermal setting in fix rheo"); - - if (fix_rheo->thermal_fix_defined) - error->all(FLERR, "Cannot define two rheo thermal evolution fixes"); fix_rheo->thermal_fix_defined = 1; - - int ifix2 = modify->find_fix_by_style("rheo/thermal"); - if (ifix > ifix2) - error->all(FLERR, "Fix RHEO must be defined before fix RHEO/thermal"); + if (!fix_rheo->thermal_flag) + error->all(FLERR, "Need to define thermal setting in fix rheo"); + compute_grad = fix_rheo->compute_grad; + compute_vshift = fix_rheo->compute_vshift; dtf = 0.5 * update->dt * force->ftm2v; } /* ---------------------------------------------------------------------- */ +void FixRHEOThermal::setup_pre_force(int /*vflag*/) +{ + // Identify whether this is the first/last instance of fix thermal + // First will handle growing arrays + // Last will handle communication + first_flag = 0 + last_flag = 0; + + int i = 0; + auto fixlist = modify->get_fix_by_style("rheo/thermal"); + for (const auto &ifix : fixlist) { + if (strcmp(ifix->id, id) == 0) break; + i++; + } + + if (i == 0) first_flag = 1; + if ((i + 1) == fixlist.size()) last_flag = 1; + + post_neighbor(); + pre_force(0); +} + +/* ---------------------------------------------------------------------- */ + void FixRHEOThermal::initial_integrate(int /*vflag*/) { // update temperature from shifting + if (!fix_rheo->shift_flag) return; int i; int *status = atom->status; double **gradt = compute_grad->gradt; @@ -205,73 +199,58 @@ void FixRHEOThermal::initial_integrate(int /*vflag*/) if (igroup == atom->firstgroup) nlocal = atom->nfirst; - if (shift_flag) { - compute_vshift->correct_surfaces(); - for (i = 0; i < nlocal; i++) { + for (i = 0; i < nlocal; i++) { + if (!(status[i] & STATUS_SHIFT)) continue; - if (!(status[i] & STATUS_SHIFT)) continue; - - if (mask[i] & groupbit) { - for (a = 0; a < dim; a++) { - temperature[i] += dtv * vshift[i][a] * gradt[i][a]; - } + if (mask[i] & groupbit) { + for (a = 0; a < dim; a++) { + temperature[i] += dtv * vshift[i][a] * gradt[i][a]; } } } } - -/* ---------------------------------------------------------------------- */ - -void FixRHEOThermal::setup_pre_force(int /*vflag*/) -{ - pre_force(0); -} - /* ---------------------------------------------------------------------- */ void FixRHEOThermal::post_integrate() { - //Post integrate teo ensure gradient up to date - int *phase = atom->phase; - double *temp = atom->temp; + int *status = atom->status; + double *temperature = atom->temperature; double *heat = atom->heat; double *rho = atom->rho; int *mask = atom->mask; + int *type = aotm->type; - double cvi, Tc, Tci, Ti, alphai; + double cvi, Tci, Ti; - //Integrate temperature and check phase + //Integrate temperature and check status for (int i = 0; i < atom->nlocal; i++) { if (mask[i] & groupbit) { - if (phase[i] == FixRHEO::FLUID_NO_FORCE) continue; + if (status[i] == FixRHEO::FLUID_NO_FORCE) continue; cvi = calc_cv(i); - temp[i] += dtf*heat[i]/cvi; - - if (alpha_style != NONE && phase[i] <= FixRHEO::FLUID_MAX) { - alphai = calc_alpha(i); - rho[i] += dtf*heat[i]/cvi*alphai; - } + temperature[i] += dtf*heat[i]/cvi; if (Tc_style != NONE) { - Ti = temp[i]; - Tci = calc_Tc(i); + Ti = temperature[i]; + if (Tc_style == CONSTANT) { + Tci = Tc; + } else if (Tc_style == TYPE) { + Tci = Tc_type[type[i]]); + } - if (Ti > Tci) { - phase[i] = FixRHEO::FLUID; - } else { - if (phase[i] == FixRHEO::SOLID) { - continue; - } else { - phase[i] = FixRHEO::FREEZING; - } + if (Ti > Tci) { //Need to untoggle other phase options + status[i] |= FixRHEO::STATUS_FLUID; + } else if (!(status[i] & FixRHEO::STATUS_SOLID)) + status[i] |= FixRHEO::STATUS_FREEZING; } } } } } + +add post neighbor then update preforce below /* ---------------------------------------------------------------------- */ void FixRHEOThermal::pre_force(int /*vflag*/) @@ -286,32 +265,35 @@ void FixRHEOThermal::pre_force(int /*vflag*/) conductivity[i] = calc_kappa(i); } } + + if (conductivity_style == CONSTANT) { + return kappa; + } else if (conductivity_style == TYPE) { + int itype = atom->type[i]; + return(kappa_type[itype]); + } else { + error->all(FLERR, "Invalid style"); + } } /* ---------------------------------------------------------------------- */ -void FixRHEOThermal::end_of_step() +void FixRHEOThermal::final_integrate() { - double *temp = atom->temp; + double *temperature = atom->temperature; double *heat = atom->heat; - int *phase = atom->phase; + int *status = atom->status; int *mask = atom->mask; - double *rho = atom->rho; - double cvi, alphai; + double cvi; - //Integrate temperature and check phase + //Integrate temperature and check status for (int i = 0; i < atom->nlocal; i++) { if (mask[i] & groupbit) { - if (phase[i] == FixRHEO::FLUID_NO_FORCE) continue; + if (status[i] & FixRHEO::STATUS_NO_FORCE) continue; cvi = calc_cv(i); - temp[i] += dtf*heat[i]/cvi; - - if (alpha_style != NONE && phase[i] <= FixRHEO::FLUID_MAX) { - alphai = calc_alpha(i); - rho[i] += dtf*heat[i]/cvi*alphai; - } + temperature[i] += dtf * heat[i] / cvi; } } } @@ -326,57 +308,11 @@ void FixRHEOThermal::reset_dt() /* ---------------------------------------------------------------------- */ -double FixRHEOThermal::calc_kappa(int i) -{ - if (conductivity_style == CONSTANT) { - return kappa; - } else if (conductivity_style == TYPE) { - int itype = atom->type[i]; - return(kappa_type[itype]); - } else { - error->all(FLERR, "Invalid style"); - } -} - -/* ---------------------------------------------------------------------- */ - double FixRHEOThermal::calc_cv(int i) { if (cv_style == CONSTANT) { return cv; } else if (cv_style == TYPE) { - int itype = atom->type[i]; - return(cv_type[itype]); - } else { - error->all(FLERR, "Invalid style"); + return(cv_type[atom->type[i]]); } } - - -/* ---------------------------------------------------------------------- */ - -double FixRHEOThermal::calc_alpha(int i) -{ - if (alpha_style == CONSTANT) { - return alpha; - } else if (alpha_style == TYPE) { - int itype = atom->type[i]; - return(alpha_type[itype]); - } else { - error->all(FLERR, "Invalid style"); - } -} - -/* ---------------------------------------------------------------------- */ - -double FixRHEOThermal::calc_Tc(int i) -{ - if (Tc_style == CONSTANT) { - return Tc; - } else if (Tc_style == TYPE) { - int itype = atom->type[i]; - return(Tc_type[itype]); - } else { - error->all(FLERR, "Invalid style"); - } -} \ No newline at end of file diff --git a/src/RHEO/fix_rheo_thermal.h b/src/RHEO/fix_rheo_thermal.h index d1dcdc6e4d..c0b5255caa 100644 --- a/src/RHEO/fix_rheo_thermal.h +++ b/src/RHEO/fix_rheo_thermal.h @@ -1,7 +1,7 @@ /* -*- c++ -*- ---------------------------------------------------------- LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator - http://lammps.sandia.gov, Sandia National Laboratories - Steve Plimpton, sjplimp@sandia.gov + 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 @@ -12,9 +12,9 @@ ------------------------------------------------------------------------- */ #ifdef FIX_CLASS - +// clang-format off FixStyle(rheo/thermal,FixRHEOThermal) - +// clang-format on #else #ifndef LMP_FIX_RHEO_THERMAL_H @@ -27,47 +27,36 @@ namespace LAMMPS_NS { class FixRHEOThermal : public Fix { public: FixRHEOThermal(class LAMMPS *, int, char **); - ~FixRHEOThermal(); - int setmask(); - void init(); - void setup_pre_force(int); - void initial_integrate(); - void post_integrate(); - void pre_force(int); - void end_of_step(); - void reset_dt(); + ~FixRHEOThermal() override; + int setmask() override; + void init() override; + void setup_pre_force(int) override; + void initial_integrate() override; + void post_integrate() override; + void post_neighbor() override; + void pre_force(int) override; + void final_integrate() override; + void reset_dt() override; + int pack_forward_comm(int, int *, double *, int, int *) override; + void unpack_forward_comm(int, int, double *) override; private: double *cv_type, cv; double *Tc_type, Tc; double *kappa_type, kappa; - double *alpha_type, alpha; double dtf, dtv; - - double calc_kappa(int); - double calc_cv(int); - double calc_Tc(int); - double calc_alpha(int); - int Tc_style; int cv_style; - int alpha_style; int conductivity_style; + int first_flag, last_flag; + int nmax; class FixRHEO *fix_rheo; + + double calc_cv(int); }; -} +} // 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. - -*/ diff --git a/src/RHEO/fix_rheo_viscosity.cpp b/src/RHEO/fix_rheo_viscosity.cpp index 846eb0f97f..72168b2ee9 100644 --- a/src/RHEO/fix_rheo_viscosity.cpp +++ b/src/RHEO/fix_rheo_viscosity.cpp @@ -38,35 +38,36 @@ FixRHEOViscosity::FixRHEOViscosity(LAMMPS *lmp, int narg, char **arg) : viscosity_style = NONE; - comm_forward = 1; + comm_forward = 0; nmax = atom->nmax; int ntypes = atom->ntypes; int iarg = 3; if (strcmp(arg[iarg],"constant") == 0) { - if (iarg+1 >= narg) error->all(FLERR,"Insufficient arguments for fix rheo/viscosity"); + if (iarg+1 >= narg) error->all(FLERR,"Insufficient arguments for viscosity option"); viscosity_style = CONSTANT; eta = utils::numeric(FLERR,arg[iarg + 1],false,lmp); - if (eta < 0.0) error->all(FLERR,"The viscosity must be positive in fix rheo/viscosity"); + if (eta < 0.0) error->all(FLERR,"The viscosity must be positive"); iarg += 1; } else if (strcmp(arg[iarg],"type") == 0) { - if(iarg+ntypes >= narg) error->all(FLERR,"Insufficient arguments for fix rheo/viscosity"); + if(iarg+ntypes >= narg) error->all(FLERR,"Insufficient arguments for viscosity option"); viscosity_style = TYPE; memory->create(eta_type, ntypes + 1, "rheo_thermal:eta_type"); for (int i = 1; i <= ntypes; i++) { eta_type[i] = utils::numeric(FLERR,arg[iarg + 1 + i], false, lmp); - if (eta_type[i] < 0.0) error->all(FLERR,"The viscosity must be positive in fix rheo/viscosity"); + if (eta_type[i] < 0.0) error->all(FLERR,"The viscosity must be positive"); } iarg += ntypes; } else if (strcmp(arg[iarg],"power") == 0) { - if (iarg+4 >= narg) error->all(FLERR,"Insufficient arguments for fix rheo/viscosity"); + if (iarg+4 >= narg) error->all(FLERR,"Insufficient arguments for viscosity option"); viscosity_style = POWER; + comm_forward = 1; eta = utils::numeric(FLERR,arg[iarg + 1],false,lmp); gd0 = utils::numeric(FLERR,arg[iarg + 2],false,lmp); K = utils::numeric(FLERR,arg[iarg + 3],false,lmp); npow = utils::numeric(FLERR,arg[iarg + 4],false,lmp); tau0 = eta * gd0 - K * pow(gd0, npow); - if (eta < 0.0) error->all(FLERR,"The viscosity must be positive in fix rheo/viscosity"); + if (eta < 0.0) error->all(FLERR,"The viscosity must be positive"); iarg += 5; } else { error->all(FLERR,"Illegal fix command, {}", arg[iarg]); @@ -88,6 +89,7 @@ FixRHEOViscosity::~FixRHEOViscosity() int FixRHEOViscosity::setmask() { int mask = 0; + mask |= POST_NEIGHBOR; mask |= PRE_FORCE; return mask; } @@ -124,9 +126,40 @@ void FixRHEOViscosity::setup_pre_force(int /*vflag*/) if (i == 0) first_flag = 1; if ((i + 1) == fixlist.size()) last_flag = 1; + post_neighbor(); pre_force(0); } + +/* ---------------------------------------------------------------------- */ + +void FixRHEOViscosity::post_neighbor() +{ + int i; + + int *type = atom->type; + double *viscosity = fix_rheo->viscosity; + int *mask = atom->mask; + + int nlocal = atom->nlocal; + int nall = nlocal + atom->nghost; + + if (first_flag & nmax < atom->nmax) { + nmax = atom->nmax; + fix_rheo->fix_store_visc->grow_arrays(nmax); + } + + // Update non-evolving viscosity styles only after atoms can exchange + if (viscosity_style == CONSTANT) { + for (i = 0; i < nall; i++) + if (mask[i] & groupbit) viscosity[i] = eta; + } else if (viscosity_style == TYPE) { + for (i = 0; i < nall; i++) + if (mask[i] & groupbit) viscosity[i] = eta_type[type[i]]; + } + } +} + /* ---------------------------------------------------------------------- */ void FixRHEOViscosity::pre_force(int /*vflag*/) @@ -147,13 +180,10 @@ void FixRHEOViscosity::pre_force(int /*vflag*/) fix_rheo->fix_store_visc->grow_arrays(nmax); } - for (i = 0; i < nlocal; i++) { - if (mask[i] & groupbit) { - if (viscosity_style == CONSTANT) { - viscosity[i] = eta; - } else if (viscosity_style == TYPE) { - viscosity[i] = eta_type[type[i]]; - } else if (viscosity_style == POWER) { + // Update viscosity styles that evolve in time every timestep + if (viscosity_style == POWER) { + for (i = 0; i < nlocal; i++) { + if (mask[i] & groupbit) { gdot = 0.0; for (a = 0; a < dim; a++) { for (b = a; b < dim; b++) { @@ -173,7 +203,7 @@ void FixRHEOViscosity::pre_force(int /*vflag*/) } } - if (last_flag) comm->forward_comm(this); + if (last_flag && comm_forward) comm->forward_comm(this); } /* ---------------------------------------------------------------------- */ diff --git a/src/RHEO/fix_rheo_viscosity.h b/src/RHEO/fix_rheo_viscosity.h index b907617477..31c1441e40 100644 --- a/src/RHEO/fix_rheo_viscosity.h +++ b/src/RHEO/fix_rheo_viscosity.h @@ -27,10 +27,11 @@ namespace LAMMPS_NS { class FixRHEOViscosity : public Fix { public: FixRHEOViscosity(class LAMMPS *, int, char **); - ~FixRHEOViscosity(); + ~FixRHEOViscosity() override; int setmask() override; void init() override; - virtual void setup_pre_force(int) override; + void setup_pre_force(int) override; + void post_neighbor() override; void pre_force(int) override; int pack_forward_comm(int, int *, double *, int, int *) override; void unpack_forward_comm(int, int, double *) override; diff --git a/src/RHEO/pair_rheo.h b/src/RHEO/pair_rheo.h index ebe97cd542..9a9d751d45 100644 --- a/src/RHEO/pair_rheo.h +++ b/src/RHEO/pair_rheo.h @@ -27,13 +27,13 @@ namespace LAMMPS_NS { class PairRHEO : public Pair { public: PairRHEO(class LAMMPS *); - virtual ~PairRHEO(); - virtual void compute(int, int); - void settings(int, char **); - void coeff(int, char **); - void setup(); - virtual double init_one(int, int); - virtual double single(int, int, int, int, double, double, double, double &); + ~PairRHEO() override; + void compute(int, int) override; + void settings(int, char **) override; + void coeff(int, char **) override; + void setup() override; + double init_one(int, int) override; + double single(int, int, int, int, double, double, double, double &) override; protected: int laplacian_order; // From fix RHEO From c715552f7e77ea0575869749f728293e37b14abd Mon Sep 17 00:00:00 2001 From: jtclemm Date: Tue, 21 Feb 2023 10:17:15 -0700 Subject: [PATCH 007/158] Ensuring fix order --- src/RHEO/fix_rheo.cpp | 18 +++++++++++++++--- src/RHEO/fix_rheo_thermal.cpp | 3 ++- src/RHEO/fix_rheo_viscosity.cpp | 3 ++- 3 files changed, 19 insertions(+), 5 deletions(-) diff --git a/src/RHEO/fix_rheo.cpp b/src/RHEO/fix_rheo.cpp index 0c3f784c0e..5ff72045f7 100644 --- a/src/RHEO/fix_rheo.cpp +++ b/src/RHEO/fix_rheo.cpp @@ -197,8 +197,22 @@ void FixRHEO::init() void FixRHEO::setup_pre_force(int /*vflag*/) { - //Need to rethink and replan + // Check to confirm no accessory fixes are yet defined + // FixRHEO must be the first fix + // Note: these fixes set this flag in setup_pre_force() + if (viscosity_fix_defined || pressure_fix_defined || thermal_fix_defined || surface_fix_defined) + error->all(FLERR, "Fix RHEO must be defined before all other RHEO fixes"); + + pre_force(0); +} + +/* ---------------------------------------------------------------------- */ + +void FixRHEO::setup() +{ // Check to confirm all accessory fixes are defined + // Does not ensure fixes correctly cover all atoms (could be a subset group) + // Note: these fixes set this flag in setup_pre_force() if (!viscosity_fix_defined) error->all(FLERR, "Missing fix rheo/viscosity"); @@ -216,8 +230,6 @@ void FixRHEO::setup_pre_force(int /*vflag*/) viscosity_fix_defined = 0; pressure_fix_defined = 0; surface_fix_defined = 0; - - pre_force(0); } /* ---------------------------------------------------------------------- */ diff --git a/src/RHEO/fix_rheo_thermal.cpp b/src/RHEO/fix_rheo_thermal.cpp index 0fc4fe294b..37290e3951 100644 --- a/src/RHEO/fix_rheo_thermal.cpp +++ b/src/RHEO/fix_rheo_thermal.cpp @@ -149,7 +149,6 @@ void FixRHEOThermal::init() if (fixes.size() == 0) error->all(FLERR, "Need to define fix rheo to use fix rheo/viscosity"); fix_rheo = dynamic_cast(fixes[0]); - fix_rheo->thermal_fix_defined = 1; if (!fix_rheo->thermal_flag) error->all(FLERR, "Need to define thermal setting in fix rheo"); compute_grad = fix_rheo->compute_grad; @@ -162,6 +161,8 @@ void FixRHEOThermal::init() void FixRHEOThermal::setup_pre_force(int /*vflag*/) { + fix_rheo->thermal_fix_defined = 1; + // Identify whether this is the first/last instance of fix thermal // First will handle growing arrays // Last will handle communication diff --git a/src/RHEO/fix_rheo_viscosity.cpp b/src/RHEO/fix_rheo_viscosity.cpp index 72168b2ee9..8ac32cd1dc 100644 --- a/src/RHEO/fix_rheo_viscosity.cpp +++ b/src/RHEO/fix_rheo_viscosity.cpp @@ -102,7 +102,6 @@ void FixRHEOViscosity::init() if (fixes.size() == 0) error->all(FLERR, "Need to define fix rheo to use fix rheo/viscosity"); fix_rheo = dynamic_cast(fixes[0]); - fix_rheo->viscosity_fix_defined = 1; compute_grad = fix_rheo->compute_grad; } @@ -110,6 +109,8 @@ void FixRHEOViscosity::init() void FixRHEOViscosity::setup_pre_force(int /*vflag*/) { + fix_rheo->viscosity_fix_defined = 1; + // Identify whether this is the first/last instance of fix viscosity // First will handle growing arrays // Last will handle communication From 99e7673e8ea44429a52c3b0c53f68dde001b75a4 Mon Sep 17 00:00:00 2001 From: jtclemm Date: Tue, 21 Feb 2023 19:41:52 -0700 Subject: [PATCH 008/158] Starting pair style, various clean ups --- src/RHEO/fix_rheo.cpp | 23 +++++------ src/RHEO/fix_rheo.h | 63 +++++++++++++++-------------- src/RHEO/fix_rheo_thermal.cpp | 70 +++++++++++++++++++++++---------- src/RHEO/fix_rheo_viscosity.cpp | 12 +++--- src/RHEO/pair_rheo.cpp | 58 ++++++++------------------- src/RHEO/pair_rheo.h | 15 ++++--- 6 files changed, 126 insertions(+), 115 deletions(-) diff --git a/src/RHEO/fix_rheo.cpp b/src/RHEO/fix_rheo.cpp index 5ff72045f7..e2819ad320 100644 --- a/src/RHEO/fix_rheo.cpp +++ b/src/RHEO/fix_rheo.cpp @@ -66,7 +66,7 @@ FixRHEO::FixRHEO(LAMMPS *lmp, int narg, char **arg) : if (narg < 5) error->all(FLERR,"Insufficient arguments for fix rheo command"); - cut = utils::numeric(FLERR,arg[3],false,lmp); + h = utils::numeric(FLERR,arg[3],false,lmp); if (strcmp(arg[4],"Quintic") == 0) { kernel_style = QUINTIC; } else if (strcmp(arg[4],"CRK0") == 0) { @@ -125,11 +125,14 @@ FixRHEO::~FixRHEO() if (compute_vshift) modify->delete_compute("rheo_vshift"); } -/* ---------------------------------------------------------------------- */ + +/* ---------------------------------------------------------------------- + Create necessary internal computes +------------------------------------------------------------------------- */ void FixRHEO::post_constructor() { - compute_kernel = dynamic_cast(modify->add_compute(fmt::format("rheo_kernel all rheo/kernel {} {} {}", kernel_style, zmin_kernel, cut))); + compute_kernel = dynamic_cast(modify->add_compute(fmt::format("rheo_kernel all rheo/kernel {} {} {}", kernel_style, zmin_kernel, h))); fix_store_visc = dynamic_cast(modify->add_fix("rheo_store_visc all STORE/PERATOM 0 1")) fix_store_visc->disable = 1; @@ -141,14 +144,14 @@ void FixRHEO::post_constructor() std::string cmd = "rheo_grad all rheo/grad {} velocity rho viscosity"; if (thermal_flag) cmd += "temperature"; - compute_grad = dynamic_cast(modify->add_compute(fmt::format(cmd, cut))); + compute_grad = dynamic_cast(modify->add_compute(fmt::format(cmd, h))); compute_grad->fix_rheo = this; if (rhosum_flag) - compute_rhosum = dynamic_cast(modify->add_compute(fmt::format("rheo_rhosum all rheo/rho/sum {} {}", cut, zmin_rhosum))); + compute_rhosum = dynamic_cast(modify->add_compute(fmt::format("rheo_rhosum all rheo/rho/sum {} {}", h, zmin_rhosum))); if (shift_flag) - compute_vshift = dynamic_cast(modify->add_compute(fmt::format("rheo_vshift all rheo/vshift {}", cut))); + compute_vshift = dynamic_cast(modify->add_compute(fmt::format("rheo_vshift all rheo/vshift {}", h))); if (surface_flag) { fix_store_surf = dynamic_cast(modify->add_fix("rheo_store_surf all STORE/PERATOM 0 1")) @@ -163,7 +166,7 @@ void FixRHEO::post_constructor() } if (interface_flag) { - compute_interface = dynamic_cast(modify->add_compute(fmt::format("rheo_interface all rheo/interface {}", cut))); + compute_interface = dynamic_cast(modify->add_compute(fmt::format("rheo_interface all rheo/interface {}", h))); fix_store_fp = dynamic_cast(modify->add_fix("rheo_store_fp all STORE/PERATOM 0 3")) f_pressure = fix_store_fp->astore; @@ -197,8 +200,7 @@ void FixRHEO::init() void FixRHEO::setup_pre_force(int /*vflag*/) { - // Check to confirm no accessory fixes are yet defined - // FixRHEO must be the first fix + // Check to confirm accessory fixes do not preceed FixRHEO // Note: these fixes set this flag in setup_pre_force() if (viscosity_fix_defined || pressure_fix_defined || thermal_fix_defined || surface_fix_defined) error->all(FLERR, "Fix RHEO must be defined before all other RHEO fixes"); @@ -210,8 +212,7 @@ void FixRHEO::setup_pre_force(int /*vflag*/) void FixRHEO::setup() { - // Check to confirm all accessory fixes are defined - // Does not ensure fixes correctly cover all atoms (could be a subset group) + // Confirm all accessory fixes are defined, may not cover group all // Note: these fixes set this flag in setup_pre_force() if (!viscosity_fix_defined) error->all(FLERR, "Missing fix rheo/viscosity"); diff --git a/src/RHEO/fix_rheo.h b/src/RHEO/fix_rheo.h index 432d319728..3487dd7273 100644 --- a/src/RHEO/fix_rheo.h +++ b/src/RHEO/fix_rheo.h @@ -32,12 +32,45 @@ class FixRHEO : public Fix { void post_constructor() override; void init() override; void setup_pre_force(int) override; + void setup() override; void pre_force(int) override; void initial_integrate(int) override; void final_integrate() override; void reset_dt() override; + // Model parameters + double h, rho0, csq; + int zmin_kernel, rhosum_zmin; int kernel_style; + enum {QUINTIC, CRK0, CRK1, CRK2}; + + // Non-persistent per-atom arrays + int *surface; + double *conductivity, *viscosity, *pressure; + double **f_pressure; + + // Status variables + enum { + // Phase status + STATUS_FLUID = 1 << 0, + STATUS_REACTIVE = 1 << 1, + STATUS_SOLID = 1 << 2, + STATUS_FREEZING = 1 << 3 + + // Surface status + STATUS_BULK = 1 << 4, + STATUS_LAYER = 1 << 5, + STATUS_SURFACE = 1 << 6, + STATUS_SPLASH = 1 << 7, + + // Temporary status options - reset in preforce + STATUS_SHIFT = 1 << 8, + STATUS_NO_FORCE = 1 << 9, + }; + int phasemask = FFFFFFF0; + int surfacemask = FFFFFF0F; + + // Accessory fixes/computes int thermal_flag; int rhosum_flag; int shift_flag; @@ -47,13 +80,9 @@ class FixRHEO : public Fix { int viscosity_fix_defined; int pressure_fix_defined; int thermal_fix_defined; + int interface_fix_defined; int surface_fix_defined; - // Non-persistent per-atom arrays - int *surface; - double *conductivity, *viscosity, *pressure; - double **f_pressure; - class FixStorePeratom *fix_store_visc; class FixStorePeratom *fix_store_pres; class FixStorePeratom *fix_store_cond; @@ -66,31 +95,7 @@ class FixRHEO : public Fix { class ComputeRHEORhoSum *compute_rhosum; class ComputeRHEOVShift *compute_vshift; - enum {QUINTIC, CRK0, CRK1, CRK2}; - enum {LINEAR, CUBIC, TAITWATER}; - - enum { - // Phase status - STATUS_FLUID = 1 << 0, //Need to turn off other options - STATUS_REACTIVE = 1 << 1, - STATUS_SOLID = 1 << 2, - STATUS_FREEZING = 1 << 3 - - // Temporary status options - reset in preforce - STATUS_SHIFT = 1 << 4, - STATUS_NO_FORCE = 1 << 5, - - // Surface status - STATUS_BULK = 1 << 6, //Need to turn off other options - STATUS_LAYER = 1 << 7, - STATUS_SURFACE = 1 << 8, - STATUS_SPLASH = 1 << 9, - }; - protected: - double cut, rho0, csq; - int zmin_kernel, rhosum_zmin; - double dtv, dtf; }; diff --git a/src/RHEO/fix_rheo_thermal.cpp b/src/RHEO/fix_rheo_thermal.cpp index 37290e3951..406439f93e 100644 --- a/src/RHEO/fix_rheo_thermal.cpp +++ b/src/RHEO/fix_rheo_thermal.cpp @@ -240,9 +240,11 @@ void FixRHEOThermal::post_integrate() Tci = Tc_type[type[i]]); } - if (Ti > Tci) { //Need to untoggle other phase options + if (Ti > Tci) { + status[i] &= phasemask; status[i] |= FixRHEO::STATUS_FLUID; } else if (!(status[i] & FixRHEO::STATUS_SOLID)) + status[i] &= phasemask; status[i] |= FixRHEO::STATUS_FREEZING; } } @@ -250,31 +252,59 @@ void FixRHEOThermal::post_integrate() } } +/* ---------------------------------------------------------------------- + Only need to update non-evolving conductivity styles after atoms exchange +------------------------------------------------------------------------- */ -add post neighbor then update preforce below -/* ---------------------------------------------------------------------- */ +void FixRHEOThermal::post_neighbor() +{ + int i; + int *type = atom->type; + double *conductivity = fix_rheo->conductivity; + int *mask = atom->mask; + int nlocal = atom->nlocal; + int nall = nlocal + atom->nghost; + + if (first_flag & nmax < atom->nmax) { + nmax = atom->nmax; + fix_rheo->fix_store_cond->grow_arrays(nmax); + } + + if (conductivity_style == CONSTANT) { + for (i = 0; i < nall; i++) + if (mask[i] & groupbit) conductivity[i] = kappa; + } else if (conductivity_style == TYPE) { + for (i = 0; i < nall; i++) + if (mask[i] & groupbit) conductivity[i] = kappa_type[type[i]]; + } + } +} + +/* ---------------------------------------------------------------------- + Update (and forward) evolving conductivity styles every timestep +------------------------------------------------------------------------- */ void FixRHEOThermal::pre_force(int /*vflag*/) { - double *conductivity = atom->conductivity; - int *mask = atom->mask; - int nlocal = atom->nlocal; + // So far, none exist + //int i; + //double *conductivity = fix_rheo->conductivity; + //int *mask = atom->mask; + //int nlocal = atom->nlocal; - // Calculate non-persistent quantities before pairstyles - for (int i = 0; i < nlocal; i++) { - if (mask[i] & groupbit) { - conductivity[i] = calc_kappa(i); - } - } + //if (first_flag & nmax < atom->nmax) { + // nmax = atom->nmax; + // fix_rheo->fix_store_cond->grow_arrays(nmax); + //} - if (conductivity_style == CONSTANT) { - return kappa; - } else if (conductivity_style == TYPE) { - int itype = atom->type[i]; - return(kappa_type[itype]); - } else { - error->all(FLERR, "Invalid style"); - } + //if (conductivity_style == TBD) { + // for (i = 0; i < nlocal; i++) { + // if (mask[i] & groupbit) { + // } + // } + //} + + //if (last_flag && comm_forward) comm->forward_comm(this); } /* ---------------------------------------------------------------------- */ diff --git a/src/RHEO/fix_rheo_viscosity.cpp b/src/RHEO/fix_rheo_viscosity.cpp index 8ac32cd1dc..f57410783c 100644 --- a/src/RHEO/fix_rheo_viscosity.cpp +++ b/src/RHEO/fix_rheo_viscosity.cpp @@ -131,8 +131,9 @@ void FixRHEOViscosity::setup_pre_force(int /*vflag*/) pre_force(0); } - -/* ---------------------------------------------------------------------- */ +/* ---------------------------------------------------------------------- + Only need to update non-evolving viscosity styles after atoms exchange +------------------------------------------------------------------------- */ void FixRHEOViscosity::post_neighbor() { @@ -150,7 +151,6 @@ void FixRHEOViscosity::post_neighbor() fix_rheo->fix_store_visc->grow_arrays(nmax); } - // Update non-evolving viscosity styles only after atoms can exchange if (viscosity_style == CONSTANT) { for (i = 0; i < nall; i++) if (mask[i] & groupbit) viscosity[i] = eta; @@ -161,14 +161,15 @@ void FixRHEOViscosity::post_neighbor() } } -/* ---------------------------------------------------------------------- */ +/* ---------------------------------------------------------------------- + Update (and forward) evolving viscosity styles every timestep +------------------------------------------------------------------------- */ void FixRHEOViscosity::pre_force(int /*vflag*/) { int i, a, b; double tmp, gdot; - int *type = atom->type; double *viscosity = fix_rheo->viscosity; int *mask = atom->mask; double **gradv = compute_grad->gradv; @@ -181,7 +182,6 @@ void FixRHEOViscosity::pre_force(int /*vflag*/) fix_rheo->fix_store_visc->grow_arrays(nmax); } - // Update viscosity styles that evolve in time every timestep if (viscosity_style == POWER) { for (i = 0; i < nlocal; i++) { if (mask[i] & groupbit) { diff --git a/src/RHEO/pair_rheo.cpp b/src/RHEO/pair_rheo.cpp index b0443933e1..c796db208a 100644 --- a/src/RHEO/pair_rheo.cpp +++ b/src/RHEO/pair_rheo.cpp @@ -394,23 +394,23 @@ void PairRHEO::allocate() void PairRHEO::settings(int narg, char **arg) { - if(narg < 1) error->all(FLERR,"Illegal pair_style command"); + if (narg < 1) error->all(FLERR,"Illegal pair_style command"); int iarg = 0; while (iarg < narg) { if (strcmp(arg[iarg], "rho/damp") == 0) { - if (iarg+1 >= narg) error->all(FLERR,"Illegal pair_style command"); + if (iarg + 1 >= narg) error->all(FLERR,"Illegal pair_style command"); rho_damp_flag = 1; - rho_damp = utils::numeric(FLERR,arg[iarg+1],false,lmp); - iarg ++; + rho_damp = utils::numeric(FLERR,arg[iarg + 1],false,lmp); + iarg++; } else if (strcmp(arg[iarg], "artificial/visc") == 0) { - if (iarg+1 >= narg) error->all(FLERR,"Illegal pair_style command"); + if (iarg + 1 >= narg) error->all(FLERR,"Illegal pair_style command"); artificial_visc_flag = 1; av = utils::numeric(FLERR,arg[iarg+1],false,lmp); - iarg ++; - } else error->all(FLERR,"Illegal pair_style command"); + iarg++; + } else error->all(FLERR,"Illegal pair_style command, {}", arg[iarg]); iarg++; } } @@ -421,8 +421,8 @@ void PairRHEO::settings(int narg, char **arg) void PairRHEO::coeff(int narg, char **arg) { - if (narg != 4) - error->all(FLERR,"Incorrect number of args for pair_style llns coefficients"); + if (narg != 2) + error->all(FLERR,"Incorrect number of args for pair_style rheo coefficients"); if (!allocated) allocate(); @@ -430,17 +430,8 @@ void PairRHEO::coeff(int narg, char **arg) utils::bounds(FLERR,arg[0],1, atom->ntypes, ilo, ihi,error); utils::bounds(FLERR,arg[1],1, atom->ntypes, jlo, jhi,error); - double rho0_one = utils::numeric(FLERR,arg[2],false,lmp); - double c_one = utils::numeric(FLERR,arg[3],false,lmp); - - if (c_one != 1.0) error->warning(FLERR, "Need c = 1 for assumption in compute rheo/solids"); - if (rho0_one != 1.0) error->warning(FLERR, "Need rho0 = 1 for assumption in compute rheo/solids"); - int count = 0; for (int i = ilo; i <= ihi; i++) { - rho0[i] = rho0_one; - csq[i] = c_one*c_one; - for (int j = 0; j <= atom->ntypes; j++) { setflag[i][j] = 1; count++; @@ -448,7 +439,7 @@ void PairRHEO::coeff(int narg, char **arg) } if (count == 0) - error->all(FLERR,"Incorrect args for pair llns coefficients"); + error->all(FLERR,"Incorrect args for pair rheo coefficients"); } /* ---------------------------------------------------------------------- @@ -457,26 +448,21 @@ void PairRHEO::coeff(int narg, char **arg) void PairRHEO::setup() { - int flag; - int ifix = modify->find_fix_by_style("rheo"); - if (ifix == -1) error->all(FLERR, "Using pair RHEO without fix RHEO"); - fix_rheo = ((FixRHEO *) modify->fix[ifix]); + auto fixes = modify->get_fix_by_style("rheo"); + if (fixes.size() == 0) error->all(FLERR, "Need to define fix rheo to use fix rheo/viscosity"); + fix_rheo = dynamic_cast(fixes[0]); compute_kernel = fix_rheo->compute_kernel; compute_grad = fix_rheo->compute_grad; - compute_sinterpolation = fix_rheo->compute_sinterpolation; + compute_interface = fix_rheo->compute_interface; thermal_flag = fix_rheo->thermal_flag; + h = fix_rheo->h; + csq = fix_rheo->csq; + rho0 = fix_rheo->rho0; - - - - h = utils::numeric(FLERR,arg[0],false,lmp); - if (h <= 0.0) error->all(FLERR,"Illegal pair_style command"); hinv = 1.0 / h; - hinv3 = 3.0 * hinv; laplacian_order = -1; - if (comm->ghost_velocity == 0) error->all(FLERR,"Pair RHEO requires ghost atoms store velocity"); @@ -505,13 +491,3 @@ double PairRHEO::init_one(int i, int j) return cut[i][j]; } - -/* ---------------------------------------------------------------------- */ - -double PairRHEO::single(int /*i*/, int /*j*/, int /*itype*/, int /*jtype*/, - double /*rsq*/, double /*factor_coul*/, double /*factor_lj*/, double &fforce) -{ - fforce = 0.0; - - return 0.0; -} diff --git a/src/RHEO/pair_rheo.h b/src/RHEO/pair_rheo.h index 9a9d751d45..026bc16527 100644 --- a/src/RHEO/pair_rheo.h +++ b/src/RHEO/pair_rheo.h @@ -12,9 +12,9 @@ ------------------------------------------------------------------------- */ #ifdef PAIR_CLASS - +// clang-format off PairStyle(rheo,PairRHEO) - +// clang-format on #else #ifndef LMP_PAIR_RHEO_H @@ -33,14 +33,13 @@ class PairRHEO : public Pair { void coeff(int, char **) override; void setup() override; double init_one(int, int) override; - double single(int, int, int, int, double, double, double, double &) override; protected: - int laplacian_order; // From fix RHEO - double h, csq*, rho0*; // From fix RHEO + double h, csq, rho0; // From fix RHEO - double hsq, hinv, rho0, av, rho_damp; + double hsq, hinv, av, rho_damp; + int laplacian_order; int artificial_visc_flag; int rho_damp_flag; int thermal_flag; @@ -49,11 +48,11 @@ class PairRHEO : public Pair { class ComputeRHEOKernel *compute_kernel; class ComputeRHEOGrad *compute_grad; - class ComputeRHEOSolidInterpolation *compute_sinterpolation; + class ComputeRHEOInterface *compute_interface; class FixRHEO *fix_rheo; }; -} +} // namespace LAMMPS_NS #endif #endif From ecf43524d4ff2320b226d381af0090f0fd4e3aff Mon Sep 17 00:00:00 2001 From: jtclemm Date: Tue, 21 Feb 2023 22:07:11 -0700 Subject: [PATCH 009/158] Most updates to pair --- src/RHEO/pair_rheo.cpp | 199 +++++++++++++++++++---------------------- src/RHEO/pair_rheo.h | 2 +- 2 files changed, 91 insertions(+), 110 deletions(-) diff --git a/src/RHEO/pair_rheo.cpp b/src/RHEO/pair_rheo.cpp index c796db208a..1bed3f1d3e 100644 --- a/src/RHEO/pair_rheo.cpp +++ b/src/RHEO/pair_rheo.cpp @@ -22,6 +22,7 @@ #include "error.h" #include "fix_rheo.h" #include "force.h" +#include "math_extra.h" #include "memory.h" #include "modify.h" #include "neighbor.h" @@ -32,6 +33,7 @@ #include using namespace LAMMPS_NS; +using namespace MathExtra; #define EPSILON 1e-2 @@ -66,16 +68,17 @@ void PairRHEO::compute(int eflag, int vflag) int i, j, a, b, ii, jj, inum, jnum, itype, jtype; int error_flag, pair_force_flag, pair_rho_flag, pair_avisc_flag; double xtmp, ytmp, ztmp; + int fluidi, fluidj; int *ilist, *jlist, *numneigh, **firstneigh; - double imass, jmass, rsq, r, ir; + double imass, jmass, rsq, r, rinv; double w, wp, rhoi, rhoj, voli, volj, Pi, Pj; double *dWij, *dWji, *d2Wij, *d2Wji, *dW1ij, *dW1ji; double vijeij, etai, etaj, kappai, kappaj; double Ti, Tj, dT; double drho_damp, fmag; - double mu, q, cs, fp_prefactor; + double mu, q, fp_prefactor; double dx[3] = {0}; double fv[3] = {0}; double dfp[3] = {0}; @@ -96,18 +99,20 @@ void PairRHEO::compute(int eflag, int vflag) double **v = atom->v; double **x = atom->x; double **f = atom->f; - double **fp = atom->fp; double *rho = atom->rho; double *mass = atom->mass; double *drho = atom->drho; - double *temp = atom->temp; - double *heat = atom->heat; - double *viscosity = atom->viscosity; - double *conductivity = atom->conductivity; + double *temperature = atom->temperature; + double *heatflow = atom->heatflow; + double *chi = compute_interface->chi; + double **f_pressure = fix_rheo->f_pressure; + double *viscosity = fix_rheo->viscosity; + double *conductivity = fix_rheo->conductivity; + double *pressure = fix_rheo->pressure; double *special_lj = force->special_lj; tagint *tag = atom->tag; int *type = atom->type; - int *phase = atom->phase; + int *status = atom->status; int nlocal = atom->nlocal; int newton_pair = force->newton_pair; @@ -132,7 +137,8 @@ void PairRHEO::compute(int eflag, int vflag) kappai = conductivity[i]; etai = viscosity[i]; - Ti = temp[i]; + Ti = temperature[i]; + fluidi = status[i] & FixRHEO::STATUS_FLUID; for (jj = 0; jj < jnum; jj++) { j = jlist[jj]; @@ -142,25 +148,26 @@ void PairRHEO::compute(int eflag, int vflag) dx[0] = xtmp - x[j][0]; dx[1] = ytmp - x[j][1]; dx[2] = ztmp - x[j][2]; - rsq = dx[0]*dx[0] + dx[1]*dx[1] + dx[2]*dx[2]; + rsq = lensq3(dx); jtype = type[j]; jmass = mass[jtype]; if (rsq < cutsq[itype][jtype]) { r = sqrt(rsq); - ir = 1/r; + rinv = 1 / r; kappaj = conductivity[j]; etaj = viscosity[j]; - Tj = temp[j]; + Tj = temperature[j]; + fluidj = status[j] & FixRHEO::STATUS_FLUID; pair_rho_flag = 0; pair_force_flag = 0; pair_avisc_flag = 0; - if (phase[i] <= FixRHEO::FLUID_MAX || phase[j] <= FixRHEO::FLUID_MAX) { + if (fluidi || fluidj) { pair_force_flag = 1; } - if (phase[i] <= FixRHEO::FLUID_MAX && phase[j] <= FixRHEO::FLUID_MAX) { + if (fluidi && fluidj) { pair_avisc_flag = 1; pair_rho_flag = 1; } @@ -169,51 +176,45 @@ void PairRHEO::compute(int eflag, int vflag) dWij = compute_kernel->dWij; dWji = compute_kernel->dWji; - for (a = 0; a < dim; a ++) { + for (a = 0; a < dim; a++) { vi[a] = v[i][a]; vj[a] = v[j][a]; - fsolid[a] = 0.0; } + // TODO: search for fix pressure and add calculate P function // Add corrections for walls rhoi = rho[i]; rhoj = rho[j]; - if (phase[i] <= FixRHEO::FLUID_MAX && phase[j] > FixRHEO::FLUID_MAX) { - compute_sinterpolation->correct_v(v[i], v[j], vi, i, j); - rhoj = compute_sinterpolation->correct_rho(j,i); + Pi = pressure[i]; + Pj = pressure[j]; + fmag = 0; + if (fluidi && (!fluidj)) { + compute_interface->correct_v(v[i], v[j], vi, i, j); + rhoj = compute_interface->correct_rho(j, i); + Pj = fix_pressure->calculate_P(rhoj); + if ((chi[j] > 0.9) && (r < (h * 0.5))) + fmag = (chi[j] - 0.9) * (h * 0.5 - r) * rho0 * csq * h * rinv; - // Repel if close to inner solid particle - if (compute_sinterpolation->chi[j] > 0.9 && r < (cut[itype][jtype] * 0.5)) { - fmag = (compute_sinterpolation->chi[j] - 0.9) * (cut[itype][jtype] * 0.5 - r); - fmag *= rho0[itype] * csq[itype] * cut[itype][jtype] * ir; - fsolid[0] = fmag * dx[0]; - fsolid[1] = fmag * dx[1]; - fsolid[2] = fmag * dx[2]; - } - } else if (phase[i] > FixRHEO::FLUID_MAX && phase[j] <= FixRHEO::FLUID_MAX) { - compute_sinterpolation->correct_v(v[j], v[i], vj, j, i); - rhoi = compute_sinterpolation->correct_rho(i,j); + } else if ((!fluidi) && fluidj) { + compute_interface->correct_v(v[j], v[i], vj, j, i); + rhoi = compute_interface->correct_rho(i,j); + Pi = fix_pressure->calculate_P(rhoi); + if ((chi[i] > 0.9) && (r < (h * 0.5))) + fmag = (chi[i] - 0.9) * (h * 0.5 - r) * rho0 * csq * h * rinv; - // Repel if close to inner solid particle - if (compute_sinterpolation->chi[i] > 0.9 && r < (cut[itype][jtype] * 0.5)) { - fmag = (compute_sinterpolation->chi[i] - 0.9) * (cut[itype][jtype] * 0.5 - r); - fmag *= rho0[jtype] * csq[jtype] * cut[itype][jtype] * ir; - fsolid[0] = fmag * dx[0]; - fsolid[1] = fmag * dx[1]; - fsolid[2] = fmag * dx[2]; - } - } else if (phase[i] > FixRHEO::FLUID_MAX && phase[j] > FixRHEO::FLUID_MAX) { + } else if ((!fluidi) && (!fluidj)) { rhoi = 1.0; rhoj = 1.0; } - // Compute volume and pressure after reconstructing + // Repel if close to inner solid particle + scale3(fmag, dx, fsolid); + + // Compute volume after reconstructing voli = imass / rhoi; volj = jmass / rhoj; - Pj = calc_pressure(rhoj, jtype); - Pi = calc_pressure(rhoi, itype); - //Check if Second order kernels will be used for eta*Lap(v) + //Check if Second order kernels will be used for eta * Lap(v) error_flag = 0; if (laplacian_order == 2) { error_flag = compute_kernel->calc_d2w(i, j, dx[0], dx[1], dx[2], r); @@ -221,15 +222,13 @@ void PairRHEO::compute(int eflag, int vflag) d2Wji = compute_kernel->d2Wji; } - //Thermal Evolution + // Thermal Evolution if (thermal_flag) { dT = 0.0; - for (a = 0; a < dim; a++) { - dT += (kappai + kappaj) * (Ti-Tj) * dx[a] * dWij[a] * ir * ir; - //Assumes heat capacity and density = 1, needs to be generalized - } - dT *= voli * volj; - heat[i] += dT; + for (a = 0; a < dim; a++) dT += dx[a] * dWij[a]; + //TODO: Assumes heat capacity and density = 1, needs to be generalized + dT *= voli * volj * (kappai + kappaj) * (Ti - Tj) * rinv * rinv; + heatflow[i] += dT; } // If either particle is fluid, compute hydrostatic and viscous forces @@ -247,62 +246,56 @@ void PairRHEO::compute(int eflag, int vflag) du[a] -= 0.5 * (gradv[i][a * dim + b] + gradv[j][a * dim + b]) * dx[b]; } } - mu = (du[0] * dx[0] + du[1] * dx[1]+ du[2] * dx[2]) * hinv3; - mu = mu / (rsq * hinv3 * hinv3 + EPSILON); + // TODO is hinv3 supposed to be 3.0/h? + mu = lensq3(du) * 3 * hinv; + mu /= (rsq * 9 * hinv * hinv + EPSILON); mu= MIN(0.0, mu); - cs = 0.5 * (sqrt(csq[itype]) + sqrt(csq[jtype])); + // "kinematic viscous pressure" q = Q/rho - q = av*(-2.0*cs*mu + 1.0*mu*mu); - fp_prefactor += voli*volj*q*(rhoj + rhoi); + q = av * (-2.0 * cs * mu + 1.0 * mu * mu); //TODO is 1.0 supposed to be something? + fp_prefactor += voli * volj * q * (rhoj + rhoi); } // -Grad[P + Q] - dfp[0] = - fp_prefactor*dWij[0]; - dfp[1] = - fp_prefactor*dWij[1]; - dfp[2] = - fp_prefactor*dWij[2]; + scale3(-fp_prefactor, dWij, dfp); - // Now compute viscous eta*Lap[v] terms + // Now compute viscous eta * Lap[v] terms for (a = 0; a < dim; a ++) { fv[a] = 0.0; - for (b = 0; b < dim; b++) { - fv[a] += (etai+etaj)*(vi[a]-vj[a])*dx[b]*dWij[b]*ir*ir; - } - fv[a] *= voli*volj; + for (b = 0; b < dim; b++) fv[a] += (vi[a] - vj[a]) * dx[b] * dWij[b]; + fv[a] *= voli * volj * rinv * rinv * (etai + etaj); } } else { - for (a = 0; a < dim; a ++) { - fv[a] = 0; - dfp[a] = 0; - } + zero3(fv); + zero3(dfp); } if (pair_force_flag) { f[i][0] += fv[0] + dfp[0] + fsolid[0]; f[i][1] += fv[1] + dfp[1] + fsolid[1]; f[i][2] += fv[2] + dfp[2] + fsolid[2]; - fp[i][0] += dfp[0]; - fp[i][1] += dfp[1]; - fp[i][2] += dfp[2]; + f_pressure[i][0] += dfp[0]; + f_pressure[i][1] += dfp[1]; + f_pressure[i][2] += dfp[2]; } // Density damping // conventional for low-order h // interpolated for RK 1 & 2 (Antuono et al, Computers & Fluids 2021) if (rho_damp_flag && pair_rho_flag) { - if (laplacian_order>=1 && error_flag == 0){ - psi_ij = rhoj-rhoi; + if ((laplacian_order >= 1) && (error_flag == 0)) { + psi_ij = rhoj - rhoi; Fij = 0.0; for (a = 0; a < dim; a++){ - psi_ij += 0.5*(gradr[i][a]+gradr[j][a])*dx[a]; - Fij -= dx[a]*dWij[a]; + psi_ij += 0.5 * (gradr[i][a] + gradr[j][a]) * dx[a]; + Fij -= dx[a] * dWij[a]; } - Fij *= ir*ir; - drho[i] += 2*rho_damp*psi_ij*Fij*volj; - } - else { - drho_damp = 2*rho_damp*(rhoj-rhoi)*ir*wp; - drho[i] -= drho_damp*volj; + Fij *= rinv * rinv; + drho[i] += 2 * rho_damp * psi_ij * Fij * volj; + } else { + drho_damp = 2 * rho_damp * (rhoj - rhoi) * rinv * wp; + drho[i] -= drho_damp * volj; } } @@ -314,55 +307,42 @@ void PairRHEO::compute(int eflag, int vflag) if (thermal_flag) { dT = 0.0; - for(a = 0; a < dim; a++){ - //dT += kappai*dWji[a]*gradt[i][a]; - //dT -= kappaj*dWji[a]*gradt[j][a]; - dT += 1/1*(kappai+kappaj)*(Ti-Tj)*dx[a]*dWji[a]*ir*ir; //Assumes heat capacity and density = 1, needs to be generalized - } - dT *= -voli*volj; + for (a = 0; a < dim; a++) dT += dx[a] * dWji[a]; //TODO csq and h terms + dT *= -voli * volj * (kappai + kappaj) * (Ti - Tj) * rinv * rinv; heat[j] -= dT; } for (a = 0; a < dim; a ++) { fv[a] = 0.0; - for (b = 0; b < dim; b++) { - //fv[a] += etai*dWji[b]*(gradv[i][a*dim+b]+gradv[i][b*dim+a]); - //fv[a] -= etaj*dWji[b]*(gradv[j][a*dim+b]+gradv[j][b*dim+a]); - fv[a] += (etai+etaj)*(vi[a]-vj[a])*dx[b]*dWji[b]*ir*ir; - } - fv[a] *= -voli*volj; // flip sign here b/c -= at accummulator + for (b = 0; b < dim; b++) fv[a] += (vi[a] - vj[a]) * dx[b] * dWji[b]; + fv[a] *= -voli * volj * (etai + etaj) * rinv * rinv; + // flip sign here b/c -= at accummulator } - - if (pair_force_flag) { for (a = 0; a < dim; a++) - dfp[a] = fp_prefactor*dWji[a]; + dfp[a] = fp_prefactor * dWji[a]; } if (rho_damp_flag && pair_rho_flag){ - if (laplacian_order>=1 && error_flag == 0){ + if ((laplacian_order >= 1) && (error_flag == 0)) { Fij = 0.0; - for (a = 0; a < dim; a++){ - Fij += dx[a]*dWji[a]; - } - Fij *= ir*ir; + for (a = 0; a < dim; a++) Fij += dx[a] * dWji[a]; + Fij *= rinv * rinv; psi_ij *= -1; - drho[j] += 2*rho_damp*psi_ij*Fij*voli; - } - else { - drho_damp = 2*rho_damp*(rhoj-rhoi)*ir*wp; - drho[j] += drho_damp*voli; + drho[j] += 2 * rho_damp * psi_ij * Fij * voli; + } else { + drho_damp = 2 * rho_damp * (rhoj - rhoi) * rinv * wp; + drho[j] += drho_damp * voli; } } if (pair_force_flag) { f[j][0] -= fv[0] + dfp[0] + fsolid[0]; f[j][1] -= fv[1] + dfp[1] + fsolid[1]; f[j][2] -= fv[2] + dfp[2] + fsolid[2]; - - fp[j][0] -= dfp[0]; - fp[j][1] -= dfp[1]; - fp[j][2] -= dfp[2]; + f_pressure[j][0] -= dfp[0]; + f_pressure[j][1] -= dfp[1]; + f_pressure[j][2] -= dfp[2]; } } } @@ -461,6 +441,7 @@ void PairRHEO::setup() rho0 = fix_rheo->rho0; hinv = 1.0 / h; + cs = sqrt(csq); laplacian_order = -1; if (comm->ghost_velocity == 0) diff --git a/src/RHEO/pair_rheo.h b/src/RHEO/pair_rheo.h index 026bc16527..42172be3a4 100644 --- a/src/RHEO/pair_rheo.h +++ b/src/RHEO/pair_rheo.h @@ -37,7 +37,7 @@ class PairRHEO : public Pair { protected: double h, csq, rho0; // From fix RHEO - double hsq, hinv, av, rho_damp; + double cs, hsq, hinv, av, rho_damp; int laplacian_order; int artificial_visc_flag; From 6e65d13ad31f36a9b30b8852c676e1efd8a9bd57 Mon Sep 17 00:00:00 2001 From: jtclemm Date: Sun, 26 Feb 2023 21:13:32 -0700 Subject: [PATCH 010/158] Adding vshift + pressure, various fixes --- src/RHEO/compute_rheo_grad.cpp | 2 +- src/RHEO/compute_rheo_vshift.cpp | 294 +++++++++++++++++++++++++++++++ src/RHEO/compute_rheo_vshift.h | 57 ++++++ src/RHEO/fix_rheo.cpp | 45 ++++- src/RHEO/fix_rheo_pressure.cpp | 206 ++++++++++++++++++++++ src/RHEO/fix_rheo_pressure.h | 49 ++++++ src/RHEO/fix_rheo_thermal.cpp | 2 +- src/RHEO/fix_rheo_viscosity.cpp | 6 +- src/RHEO/pair_rheo.cpp | 51 +++--- src/RHEO/pair_rheo.h | 1 + 10 files changed, 669 insertions(+), 44 deletions(-) create mode 100644 src/RHEO/compute_rheo_vshift.cpp create mode 100644 src/RHEO/compute_rheo_vshift.h create mode 100644 src/RHEO/fix_rheo_pressure.cpp create mode 100644 src/RHEO/fix_rheo_pressure.h diff --git a/src/RHEO/compute_rheo_grad.cpp b/src/RHEO/compute_rheo_grad.cpp index e87d39aa53..0cefd2ac6a 100644 --- a/src/RHEO/compute_rheo_grad.cpp +++ b/src/RHEO/compute_rheo_grad.cpp @@ -41,7 +41,7 @@ ComputeRHEOGrad::ComputeRHEOGrad(LAMMPS *lmp, int narg, char **arg) : velocity_flag = temperature_flag = rho_flag = eta_flag = 0; - for (int iarg = 3; iarg < narg; iarg ++) { + for (int iarg = 3; iarg < narg; iarg++) { if (strcmp(arg[iarg],"velocity") == 0) velocity_flag = 1; else if (strcmp(arg[iarg],"rho") == 0) rho_flag = 1; else if (strcmp(arg[iarg],"temperature") == 0) temperature_flag = 1; diff --git a/src/RHEO/compute_rheo_vshift.cpp b/src/RHEO/compute_rheo_vshift.cpp new file mode 100644 index 0000000000..42fa1e8c82 --- /dev/null +++ b/src/RHEO/compute_rheo_vshift.cpp @@ -0,0 +1,294 @@ +/* ---------------------------------------------------------------------- + LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator + http://lammps.sandia.gov, 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. +------------------------------------------------------------------------- */ + +#include "compute_rheo_vshift.h" +#include "fix_rheo.h" +#include "compute_rheo_solids.h" +#include "compute_rheo_grad.h" +#include "compute_rheo_kernel.h" +#include "fix_rheo_surface.h" +#include +#include +#include "atom.h" +#include "modify.h" +#include "domain.h" +#include "neighbor.h" +#include "neigh_list.h" +#include "neigh_request.h" +#include "force.h" +#include "pair.h" +#include "comm.h" +#include "memory.h" +#include "error.h" + +using namespace LAMMPS_NS; + +/* ---------------------------------------------------------------------- */ + +ComputeRHEOVShift::ComputeRHEOVShift(LAMMPS *lmp, int narg, char **arg) : + Compute(lmp, narg, arg), vshift(nullptr), fix_rheo(nullptr), compute_kernel(nullptr), + compute_grad(nullptr), compute_surface(nullptr), compute_interface(nullptr) +{ + if (narg != 3) error->all(FLERR,"Illegal compute RHEO/VShift command"); + + comm_reverse = 3; + surface_flag = 0; + + nmax = atom->nmax; + memory->create(vshift, nmax, 3, "rheo/vshift:vshift"); + array_atom = vshift; + peratom_flag = 1; + size_peratom_cols = 3; +} + +/* ---------------------------------------------------------------------- */ + +ComputeRHEOVShift::~ComputeRHEOVShift() +{ + memory->destroy(vshift); +} + +/* ---------------------------------------------------------------------- */ + +void ComputeRHEOVShift::init() +{ + neighbor->add_request(this, NeighConst::REQ_DEFAULT); + + surface_flag = 0; + if (fix_rheo->surface_flag) { + surface_flag = 1; + fix_rheo_surface = fix_rheo->fix_rheo_surface; + } + + compute_kernel = fix_rheo->compute_kernel; + compute_grad = fix_rheo->compute_grad; + compute_interface = fix_rheo->compute_interface; + + cut = fix_rheo->cut; + cutsq = cut * cut; + cutthird = cut / 3.0; +} + +/* ---------------------------------------------------------------------- */ + +void ComputeRHEOVShift::init_list(int /*id*/, NeighList *ptr) +{ + list = ptr; +} + +/* ---------------------------------------------------------------------- */ + +void ComputeRHEOVShift::compute_peratom() +{ + int i, j, a, b, ii, jj, jnum, itype, jtype; + int fluidi, fluidj; + double xtmp, ytmp, ztmp, rsq, r, rinv; + double w, wp, dr, w0, w4, vmag, prefactor; + double imass, jmass, voli, volj, rhoi, rhoj; + double dx[3], vi[3], vj[3] = {0}; + int dim = domain->dimension; + + int *jlist; + int inum, *ilist, *numneigh, **firstneigh; + int nlocal = atom->nlocal; + int nall = nlocal + atom->nghost; + + double **x = atom->x; + double **v = atom->v; + int *type = atom->type; + int *status = atom->status; + int *surface = atom->surface; + double *rho = atom->rho; + double *mass = atom->mass; + int newton_pair = force->newton_pair; + + inum = list->inum; + ilist = list->ilist; + numneigh = list->numneigh; + firstneigh = list->firstneigh; + + if (nall > nmax) { + nmax = nall; + memory->destroy(vshift); + memory->create(vshift, nmax, 3, "rheo/vshift:vshift"); + array_atom = vshift; + } + + for (i = 0; i < nall; i++) + for (a = 0; a < dim; a++) + vshift[i][a] = 0.0; + + for (ii = 0; ii < inum; ii++) { + i = ilist[ii]; + xtmp = x[i][0]; + ytmp = x[i][1]; + ztmp = x[i][2]; + itype = type[i]; + jlist = firstneigh[i]; + jnum = numneigh[i]; + imass = mass[itype]; + fluidi = status[i] & FixRHEO::STATUS_FLUID; + + for (jj = 0; jj < jnum; jj++) { + j = jlist[jj]; + j &= NEIGHMASK; + + fluidj = status[j] & FixRHEO::STATUS_FLUID; + if ((!fluidi) && (!fluidj)) continue; + if (!(status[i] & FixRHEO::STATUS_SHIFT) && !(status[j] & FixRHEO::STATUS_SHIFT)) continue; + + dx[0] = xtmp - x[j][0]; + dx[1] = ytmp - x[j][1]; + dx[2] = ztmp - x[j][2]; + rsq = dx[0] * dx[0] + dx[1] * dx[1] + dx[2] * dx[2]; + + if (rsq < cutsq) { + jtype = type[j]; + jmass = mass[jtype]; + + r = sqrt(rsq); + rinv = 1 / r; + + for (a = 0; a < dim; a ++) { + vi[a] = v[i][a]; + vj[a] = v[j][a]; + } + + rhoi = rho[i]; + rhoj = rho[j]; + + // Add corrections for walls + if (fluidi && (!fluidj)) { + compute_interface->correct_v(v[i], v[j], vi, i, j); + rhoj = compute_interface->correct_rho(j,i); + } else if ((!fluidi) && fluidj) { + compute_interface->correct_v(v[j], v[i], vj, j, i); + rhoi = compute_interface->correct_rho(i,j); + } else if ((!fluidi) && (!fluidj)) { + rhoi = 1.0; + rhoj = 1.0; + } + + voli = imass / rhoi; + volj = jmass / rhoj; + + wp = compute_kernel->calc_dw(i, j, dx[0], dx[1], dx[2], r); + w = compute_kernel->calc_w(i, j, dx[0], dx[1], dx[2], r); + w0 = compute_kernel->calc_w(i, j, 0, 0, 0, cutthird); // dx, dy, dz irrelevant + w4 = w * w * w * w / (w0 * w0 * w0 * w0); + dr = -2 * cutthird * (1 + 0.2 * w4) * wp * rinv; + + if (mask[i] & groupbit) { + vmag = sqrt(vi[0] * vi[0] + vi[1] * vi[1] + vi[2] * vi[2]); + prefactor = vmag * volj * dr; + vshift[i][0] += prefactor * dx[0]; + vshift[i][1] += prefactor * dx[1]; + vshift[i][2] += prefactor * dx[2]; + } + + if (newton_pair || j < nlocal) { + if (mask[j] & groupbit) { + vmag = sqrt(vj[0] * vj[0] + vj[1] * vj[1] + vj[2] * vj[2]); + prefactor = vmag * voli * dr; + vshift[j][0] -= prefactor * dx[0]; + vshift[j][1] -= prefactor * dx[1]; + vshift[j][2] -= prefactor * dx[2]; + } + } + } + } + } + + if (newton_pair) comm->reverse_comm_compute(this); +} + + +/* ---------------------------------------------------------------------- */ + +void ComputeRHEOVShift::correct_surfaces() +{ + if (!surface_flag) return; + + int *status = atom->status; + int *mask = atom->mask; + int nlocal = atom->nlocal; + int i, a, b; + int dim = domain->dimension; + int *surface = atom->surface; + + double **nsurf; + nsurf = fix_rheo_surface->n_surface; + double nx,ny,nz,vx,vy,vz; + for (i = 0; i < nlocal; i++) { + if (mask[i] & groupbit) { + if (surface[i] == 1 || surface[i] == 2) { + nx = nsurf[i][0]; + ny = nsurf[i][1]; + vx = vshift[i][0]; + vy = vshift[i][1]; + vz = vshift[i][2]; + vshift[i][0] = (1 - nx * nx) * vx - nx * ny * vy; + vshift[i][1] = (1 - ny * ny) * vy - nx * ny * vx; + if (dim > 2) { + nz = nsurf[i][2]; + vshift[i][0] -= nx * nz * vz; + vshift[i][1] -= ny * nz * vz; + vshift[i][2] = (1 - nz * nz) * vz - nz * ny * vy - nx * nz * vx; + } else { + vshift[i][2] = 0.0; + } + } + } + } +} + +/* ---------------------------------------------------------------------- */ + +int ComputeRHEOVShift::pack_reverse_comm(int n, int first, double *buf) +{ + int i,m,last; + + m = 0; + last = first + n; + for (i = first; i < last; i++) { + buf[m++] = vshift[i][0]; + buf[m++] = vshift[i][1]; + buf[m++] = vshift[i][2]; + } + return m; +} + +/* ---------------------------------------------------------------------- */ + +void ComputeRHEOVShift::unpack_reverse_comm(int n, int *list, double *buf) +{ + int i,j,m; + + m = 0; + for (i = 0; i < n; i++) { + j = list[i]; + vshift[j][0] += buf[m++]; + vshift[j][1] += buf[m++]; + vshift[j][2] += buf[m++]; + } +} + +/* ---------------------------------------------------------------------- + memory usage of local atom-based array +------------------------------------------------------------------------- */ + +double ComputeRHEOVShift::memory_usage() +{ + double bytes = 3 * nmax * sizeof(double); + return bytes; +} diff --git a/src/RHEO/compute_rheo_vshift.h b/src/RHEO/compute_rheo_vshift.h new file mode 100644 index 0000000000..fceb287510 --- /dev/null +++ b/src/RHEO/compute_rheo_vshift.h @@ -0,0 +1,57 @@ +/* -*- 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 COMPUTE_CLASS +// clang-format off +ComputeStyle(rheo/vshift,ComputeRHEOVShift) +// clang-format on +#else + +#ifndef LMP_COMPUTE_RHEO_VSHIFT_H +#define LMP_COMPUTE_RHEO_VSHIFT_H + +#include "compute.h" + +namespace LAMMPS_NS { + +class ComputeRHEOVShift : public Compute { + public: + ComputeRHEOVShift(class LAMMPS *, int, char **); + ~ComputeRHEOVShift() override; + void init() override; + void init_list(int, class NeighList *) override; + void compute_peratom() override; + int pack_reverse_comm(int, int, double *) override; + void unpack_reverse_comm(int, int *, double *) override; + double memory_usage() override; + void correct_surfaces(); + + private: + int nmax; + double dtv, cut, cutsq, cutthird; + int surface_flag; + + double **vshift; + + class NeighList *list; + class FixRHEO *fix_rheo; + class FixRHEOSurface *fix_rheo_surface; + class ComputeRHEOInterface *compute_interface ; + class ComputeRHEOKernel *compute_kernel; + class ComputeRHEOGrad *compute_grad; +}; + +} // namespace LAMMPS_NS + +#endif +#endif diff --git a/src/RHEO/fix_rheo.cpp b/src/RHEO/fix_rheo.cpp index e2819ad320..12185b549c 100644 --- a/src/RHEO/fix_rheo.cpp +++ b/src/RHEO/fix_rheo.cpp @@ -132,7 +132,7 @@ FixRHEO::~FixRHEO() void FixRHEO::post_constructor() { - compute_kernel = dynamic_cast(modify->add_compute(fmt::format("rheo_kernel all rheo/kernel {} {} {}", kernel_style, zmin_kernel, h))); + compute_kernel = dynamic_cast(modify->add_compute("rheo_kernel all rheo/kernel")); fix_store_visc = dynamic_cast(modify->add_fix("rheo_store_visc all STORE/PERATOM 0 1")) fix_store_visc->disable = 1; @@ -142,16 +142,18 @@ void FixRHEO::post_constructor() fix_store_pres->disable = 1; - std::string cmd = "rheo_grad all rheo/grad {} velocity rho viscosity"; + std::string cmd = "rheo_grad all rheo/grad velocity rho viscosity"; if (thermal_flag) cmd += "temperature"; - compute_grad = dynamic_cast(modify->add_compute(fmt::format(cmd, h))); + compute_grad = dynamic_cast(modify->add_compute(cmd)); compute_grad->fix_rheo = this; if (rhosum_flag) - compute_rhosum = dynamic_cast(modify->add_compute(fmt::format("rheo_rhosum all rheo/rho/sum {} {}", h, zmin_rhosum))); + compute_rhosum = dynamic_cast(modify->add_compute("rheo_rhosum all rheo/rho/sum")); - if (shift_flag) - compute_vshift = dynamic_cast(modify->add_compute(fmt::format("rheo_vshift all rheo/vshift {}", h))); + if (shift_flag) { + compute_vshift = dynamic_cast(modify->add_compute("rheo_vshift all rheo/vshift")); + compute_vshift->fix_rheo = this; + } if (surface_flag) { fix_store_surf = dynamic_cast(modify->add_fix("rheo_store_surf all STORE/PERATOM 0 1")) @@ -166,7 +168,7 @@ void FixRHEO::post_constructor() } if (interface_flag) { - compute_interface = dynamic_cast(modify->add_compute(fmt::format("rheo_interface all rheo/interface {}", h))); + compute_interface = dynamic_cast(modify->add_compute(fmt::format("rheo_interface all rheo/interface"))); fix_store_fp = dynamic_cast(modify->add_fix("rheo_store_fp all STORE/PERATOM 0 3")) f_pressure = fix_store_fp->astore; @@ -212,7 +214,7 @@ void FixRHEO::setup_pre_force(int /*vflag*/) void FixRHEO::setup() { - // Confirm all accessory fixes are defined, may not cover group all + // Confirm all accessory fixes are defined // Note: these fixes set this flag in setup_pre_force() if (!viscosity_fix_defined) error->all(FLERR, "Missing fix rheo/viscosity"); @@ -231,6 +233,33 @@ void FixRHEO::setup() viscosity_fix_defined = 0; pressure_fix_defined = 0; surface_fix_defined = 0; + + // Check fixes cover all atoms (doesnt ensure user covers atoms created midrun) + // (pressure is currently required to be group all) + auto visc_fixes = modify->get_fix_by_style("rheo/viscosity"); + auto therm_fixes = modify->get_fix_by_style("rheo/thermal"); + + int *mask = atom->mask; + int v_coverage_flag = 1; + int t_coverage_flag = 1; + int covered; + for (int i = 0; i < atom->nlocal; i++) { + covered = 0; + for (auto fix in visc_fixes) + if (mask[i] & fix->groupbit) covered = 1; + if (!covered) v_coverage_flag = 0; + if (thermal_flag) { + covered = 0; + for (auto fix in therm_fixes) + if (mask[i] & fix->groupbit) covered = 1; + if (!covered) v_coverage_flag = 0; + } + } + + if (!v_coverage_flag) + error->one(FLERR, "Fix rheo/viscosity does not fully cover all atoms"); + if (!t_coverage_flag) + error->one(FLERR, "Fix rheo/thermal does not fully cover all atoms"); } /* ---------------------------------------------------------------------- */ diff --git a/src/RHEO/fix_rheo_pressure.cpp b/src/RHEO/fix_rheo_pressure.cpp new file mode 100644 index 0000000000..8f42e22239 --- /dev/null +++ b/src/RHEO/fix_rheo_pressure.cpp @@ -0,0 +1,206 @@ +/* ---------------------------------------------------------------------- + LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator + http://lammps.sandia.gov, 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. + ------------------------------------------------------------------------- */ + +#include "fix_rheo_pressure.h" + +#include "atom.h" +#include "comm.h" +#include "domain.h" +#include "error.h" +#include "fix_rheo.h" +#include "memory.h" +#include "modify.h" +#include "update.h" + +#include + +using namespace LAMMPS_NS; +using namespace FixConst; +enum {NONE, LINEAR, CUBIC, TAITWATER}; + +/* ---------------------------------------------------------------------- */ + +FixRHEOPressure::FixRHEOPressure(LAMMPS *lmp, int narg, char **arg) : + Fix(lmp, narg, arg) +{ + if (narg < 4) error->all(FLERR,"Illegal fix command"); + + pressure_style = NONE; + + comm_forward = 1; + nmax = atom->nmax; + + // Currently can only have one instance of fix rheo/pressure + if (igroup != 0) + error->all(FLERR,"fix rheo/pressure command requires group all"); + + int ntypes = atom->ntypes; + int iarg = 3; + if (strcmp(arg[iarg],"linear") == 0) { + pressure_style = LINEAR; + } else if (strcmp(arg[iarg],"taitwater") == 0) { + pressure_style = TAITWATER; + } else if (strcmp(arg[iarg],"cubic") == 0) { + pressure_style = CUBIC; + if (iarg + 1 >= narg) error->all(FLERR,"Insufficient arguments for pressure option"); + c_cubic = utils::numeric(FLERR,arg[iarg + 1],false,lmp); + } else { + error->all(FLERR,"Illegal fix command, {}", arg[iarg]); + } + + if (pressure_style == NONE) + error->all(FLERR,"Must specify pressure style for fix/rheo/pressure"); +} + +/* ---------------------------------------------------------------------- */ + +FixRHEOPressure::~FixRHEOPressure() {} + +/* ---------------------------------------------------------------------- */ + +int FixRHEOPressure::setmask() +{ + int mask = 0; + mask |= PRE_FORCE; + return mask; +} + +/* ---------------------------------------------------------------------- */ + +void FixRHEOPressure::init() +{ + auto fixes = modify->get_fix_by_style("rheo"); + if (fixes.size() == 0) error->all(FLERR, "Need to define fix rheo to use fix rheo/pressure"); + fix_rheo = dynamic_cast(fixes[0]); + + csq = fix_rheo->csq; + rho0 = fix_rheo->rho0; + rho0inv = 1.0 / rho0; + + // Cannot define multiple as pair rheo cannot currently distinguish + if (modify->get_fix_by_style("rheo/pressure").size() > 1) + error->all(FLERR,"Can only specify one instance of fix rheo/pressure"); +} + +/* ---------------------------------------------------------------------- */ + +void FixRHEOPressure::setup_pre_force(int /*vflag*/) +{ + fix_rheo->pressure_fix_defined = 1; + + // Identify whether this is the first/last instance of fix pressure + // First will handle growing arrays + // Last will handle communication + first_flag = 0 + last_flag = 0; + + int i = 0; + auto fixlist = modify->get_fix_by_style("rheo/pressure"); + for (const auto &ifix : fixlist) { + if (strcmp(ifix->id, id) == 0) break; + i++; + } + + if (i == 0) first_flag = 1; + if ((i + 1) == fixlist.size()) last_flag = 1; + + pre_force(0); +} + +/* ---------------------------------------------------------------------- + Update (and forward) pressure every timestep +------------------------------------------------------------------------- */ + +void FixRHEOPressure::pre_force(int /*vflag*/) +{ + int i; + double dr, rr3, rho_ratio; + + double *p = fix_rheo->pressure; + int *mask = atom->mask; + double *rho = atom->rho; + + int nlocal = atom->nlocal; + int dim = domain->dimension; + + if (first_flag & nmax < atom->nmax) { + nmax = atom->nmax; + fix_rheo->fix_store_visc->grow_arrays(nmax); + } + + if (pressure_style == TAITWATER) inv7 = 1.0 / 7.0; + + for (i = 0; i < nlocal; i++) { + if (mask[i] & groupbit) { + if (pressure_style == LINEAR) { + p[i] = csq * (rho[i] - rho0); + } else if (pressure_style == CUBIC) { + dr = rho[i] - rho0; + p[i] = csq * (dr + c_cubic * dr * dr * dr); + } else if (pressure_style == TAITWATER) { + rho_ratio = rho[i] / rho0inv; + rr3 = rho_ratio * rho_ratio * rho_ratio; + p[i] = csq * rho0 * inv7 * (rr3 * rr3 * rho_ratio - 1.0); + } + } + } + + + if (last_flag && comm_forward) comm->forward_comm(this); +} + +/* ---------------------------------------------------------------------- */ + +int FixRHEOPressure::pack_forward_comm(int n, int *list, double *buf, + int /*pbc_flag*/, int * /*pbc*/) +{ + int i,j,k,m; + double *pressure = fix_rheo->pressure; + m = 0; + + for (i = 0; i < n; i++) { + j = list[i]; + buf[m++] = pressure[j]; + } + return m; +} + +/* ---------------------------------------------------------------------- */ + +void FixRHEOPressure::unpack_forward_comm(int n, int first, double *buf) +{ + int i, k, m, last; + double *pressure = fix_rheo->pressure; + + m = 0; + last = first + n; + for (i = first; i < last; i++) { + pressure[i] = buf[m++]; + } +} + +double FixRHEOPressure::calculate_p(double rho) +{ + double rho; + if (pressure_style == LINEAR) { + p = csq * (rho - rho0); + } else if (pressure_style == CUBIC) { + dr = rho - rho0; + p = csq * (dr + c_cubic * dr * dr * dr); + } else if (pressure_style == TAITWATER) { + rho_ratio = rho / rho0inv; + rr3 = rho_ratio * rho_ratio * rho_ratio; + p = csq * rho0 * inv7 * (rr3 * rr3 * rho_ratio - 1.0); + } + return rho; +} \ No newline at end of file diff --git a/src/RHEO/fix_rheo_pressure.h b/src/RHEO/fix_rheo_pressure.h new file mode 100644 index 0000000000..45217c7f75 --- /dev/null +++ b/src/RHEO/fix_rheo_pressure.h @@ -0,0 +1,49 @@ +/* -*- 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(rheo/pressure,FixRHEOPressure) +// clang-format on +#else + +#ifndef LMP_FIX_RHEO_PRESSURE_H +#define LMP_FIX_RHEO_PRESSURE_H + +#include "fix.h" + +namespace LAMMPS_NS { + +class FixRHEOPressure : public Fix { + public: + FixRHEOPressure(class LAMMPS *, int, char **); + ~FixRHEOPressure() override; + int setmask() override; + void init() override; + void setup_pre_force(int) override; + void pre_force(int) override; + int pack_forward_comm(int, int *, double *, int, int *) override; + void unpack_forward_comm(int, int, double *) override; + double calculate_p(double); + private: + double c_cubic, csq, rho0, rho0inv; + int pressure_style; + int first_flag, last_flag; + int nmax; + class FixRHEO *fix_rheo; +}; + +} // namespace LAMMPS_NS + +#endif +#endif diff --git a/src/RHEO/fix_rheo_thermal.cpp b/src/RHEO/fix_rheo_thermal.cpp index 406439f93e..8f4094527e 100644 --- a/src/RHEO/fix_rheo_thermal.cpp +++ b/src/RHEO/fix_rheo_thermal.cpp @@ -230,7 +230,7 @@ void FixRHEOThermal::post_integrate() if (status[i] == FixRHEO::FLUID_NO_FORCE) continue; cvi = calc_cv(i); - temperature[i] += dtf*heat[i]/cvi; + temperature[i] += dtf * heat[i] / cvi; if (Tc_style != NONE) { Ti = temperature[i]; diff --git a/src/RHEO/fix_rheo_viscosity.cpp b/src/RHEO/fix_rheo_viscosity.cpp index f57410783c..0774eff731 100644 --- a/src/RHEO/fix_rheo_viscosity.cpp +++ b/src/RHEO/fix_rheo_viscosity.cpp @@ -44,13 +44,13 @@ FixRHEOViscosity::FixRHEOViscosity(LAMMPS *lmp, int narg, char **arg) : int ntypes = atom->ntypes; int iarg = 3; if (strcmp(arg[iarg],"constant") == 0) { - if (iarg+1 >= narg) error->all(FLERR,"Insufficient arguments for viscosity option"); + if (iarg + 1 >= narg) error->all(FLERR,"Insufficient arguments for viscosity option"); viscosity_style = CONSTANT; eta = utils::numeric(FLERR,arg[iarg + 1],false,lmp); if (eta < 0.0) error->all(FLERR,"The viscosity must be positive"); iarg += 1; } else if (strcmp(arg[iarg],"type") == 0) { - if(iarg+ntypes >= narg) error->all(FLERR,"Insufficient arguments for viscosity option"); + if (iarg + ntypes >= narg) error->all(FLERR,"Insufficient arguments for viscosity option"); viscosity_style = TYPE; memory->create(eta_type, ntypes + 1, "rheo_thermal:eta_type"); for (int i = 1; i <= ntypes; i++) { @@ -59,7 +59,7 @@ FixRHEOViscosity::FixRHEOViscosity(LAMMPS *lmp, int narg, char **arg) : } iarg += ntypes; } else if (strcmp(arg[iarg],"power") == 0) { - if (iarg+4 >= narg) error->all(FLERR,"Insufficient arguments for viscosity option"); + if (iarg + 4 >= narg) error->all(FLERR,"Insufficient arguments for viscosity option"); viscosity_style = POWER; comm_forward = 1; eta = utils::numeric(FLERR,arg[iarg + 1],false,lmp); diff --git a/src/RHEO/pair_rheo.cpp b/src/RHEO/pair_rheo.cpp index 1bed3f1d3e..edb3bb313e 100644 --- a/src/RHEO/pair_rheo.cpp +++ b/src/RHEO/pair_rheo.cpp @@ -21,6 +21,7 @@ #include "domain.h" #include "error.h" #include "fix_rheo.h" +#include "fix_rheo_pressure.h" #include "force.h" #include "math_extra.h" #include "memory.h" @@ -41,7 +42,7 @@ using namespace MathExtra; PairRHEO::PairRHEO(LAMMPS *lmp) : Pair(lmp), compute_kernel(nullptr), compute_grad(nullptr), - compute_interface(nullptr), fix_rheo(nullptr) + compute_interface(nullptr), fix_rheo(nullptr), fix_rheo_pressure(nullptr) { restartinfo = 0; single_enable = 0; @@ -69,33 +70,15 @@ void PairRHEO::compute(int eflag, int vflag) int error_flag, pair_force_flag, pair_rho_flag, pair_avisc_flag; double xtmp, ytmp, ztmp; int fluidi, fluidj; - - int *ilist, *jlist, *numneigh, **firstneigh; - double imass, jmass, rsq, r, rinv; - + double imass, jmass, rsq, r, rinv, psi_ij, Fij; double w, wp, rhoi, rhoj, voli, volj, Pi, Pj; - double *dWij, *dWji, *d2Wij, *d2Wji, *dW1ij, *dW1ji; - double vijeij, etai, etaj, kappai, kappaj; - double Ti, Tj, dT; - double drho_damp, fmag; - double mu, q, fp_prefactor; - double dx[3] = {0}; - double fv[3] = {0}; - double dfp[3] = {0}; - double fsolid[3] = {0}; - double du[3] = {0}; - double vi[3] = {0}; - double vj[3] = {0}; - double dv[3] = {0}; - double psi_ij = 0.0; - double Fij = 0.0; + double *dWij, *dWji, *d2Wij, *d2Wji; + double Ti, Tj, dT, etai, etaj, kappai, kappaj; + double drho_damp, fmag, mu, q, fp_prefactor; + double dx[3], fv[3], dfp[3], fsolid[3], du[3], vi[3], vj[3]; ev_init(eflag, vflag); - double **gradv = compute_grad->gradv; - double **gradt = compute_grad->gradt; - double **gradr = compute_grad->gradr; - double **gradn = compute_grad->gradn; double **v = atom->v; double **x = atom->x; double **f = atom->f; @@ -104,16 +87,20 @@ void PairRHEO::compute(int eflag, int vflag) double *drho = atom->drho; double *temperature = atom->temperature; double *heatflow = atom->heatflow; + double **gradv = compute_grad->gradv; + double **gradt = compute_grad->gradt; + double **gradr = compute_grad->gradr; + double **gradn = compute_grad->gradn; double *chi = compute_interface->chi; double **f_pressure = fix_rheo->f_pressure; double *viscosity = fix_rheo->viscosity; double *conductivity = fix_rheo->conductivity; double *pressure = fix_rheo->pressure; - double *special_lj = force->special_lj; tagint *tag = atom->tag; int *type = atom->type; int *status = atom->status; + int *ilist, *jlist, *numneigh, **firstneigh; int nlocal = atom->nlocal; int newton_pair = force->newton_pair; int dim = domain->dimension; @@ -142,7 +129,6 @@ void PairRHEO::compute(int eflag, int vflag) for (jj = 0; jj < jnum; jj++) { j = jlist[jj]; - factor_lj = special_lj[sbmask(j)]; j &= NEIGHMASK; dx[0] = xtmp - x[j][0]; @@ -152,7 +138,7 @@ void PairRHEO::compute(int eflag, int vflag) jtype = type[j]; jmass = mass[jtype]; - if (rsq < cutsq[itype][jtype]) { + if (rsq < hsq) { r = sqrt(rsq); rinv = 1 / r; @@ -181,7 +167,6 @@ void PairRHEO::compute(int eflag, int vflag) vj[a] = v[j][a]; } - // TODO: search for fix pressure and add calculate P function // Add corrections for walls rhoi = rho[i]; rhoj = rho[j]; @@ -191,14 +176,14 @@ void PairRHEO::compute(int eflag, int vflag) if (fluidi && (!fluidj)) { compute_interface->correct_v(v[i], v[j], vi, i, j); rhoj = compute_interface->correct_rho(j, i); - Pj = fix_pressure->calculate_P(rhoj); + Pj = fix_rheo_pressure->calculate_p(rhoj); if ((chi[j] > 0.9) && (r < (h * 0.5))) fmag = (chi[j] - 0.9) * (h * 0.5 - r) * rho0 * csq * h * rinv; } else if ((!fluidi) && fluidj) { compute_interface->correct_v(v[j], v[i], vj, j, i); rhoi = compute_interface->correct_rho(i,j); - Pi = fix_pressure->calculate_P(rhoi); + Pi = fix_rheo_pressure->calculate_p(rhoi); if ((chi[i] > 0.9) && (r < (h * 0.5))) fmag = (chi[i] - 0.9) * (h * 0.5 - r) * rho0 * csq * h * rinv; @@ -429,9 +414,13 @@ void PairRHEO::coeff(int narg, char **arg) void PairRHEO::setup() { auto fixes = modify->get_fix_by_style("rheo"); - if (fixes.size() == 0) error->all(FLERR, "Need to define fix rheo to use fix rheo/viscosity"); + if (fixes.size() == 0) error->all(FLERR, "Need to define fix rheo to use pair rheo"); fix_rheo = dynamic_cast(fixes[0]); + fixes = modify->get_fix_by_style("rheo/pressure"); + if (fixes.size() == 0) error->all(FLERR, "Need to define fix rheo/pressure to use pair rheo"); + fix_rheo_pressure = dynamic_cast(fixes[0]); + compute_kernel = fix_rheo->compute_kernel; compute_grad = fix_rheo->compute_grad; compute_interface = fix_rheo->compute_interface; diff --git a/src/RHEO/pair_rheo.h b/src/RHEO/pair_rheo.h index 42172be3a4..ab7d796a74 100644 --- a/src/RHEO/pair_rheo.h +++ b/src/RHEO/pair_rheo.h @@ -50,6 +50,7 @@ class PairRHEO : public Pair { class ComputeRHEOGrad *compute_grad; class ComputeRHEOInterface *compute_interface; class FixRHEO *fix_rheo; + class FixRHEOPressure *fix_rheo_pressure; }; } // namespace LAMMPS_NS From bad1188c526672b2055caf6be5e01da1875c89b6 Mon Sep 17 00:00:00 2001 From: jtclemm Date: Wed, 22 Mar 2023 17:27:51 -0600 Subject: [PATCH 011/158] Reorganizing peratom arrays --- src/RHEO/compute_rheo_grad.cpp | 160 ++++++++++++++++---------------- src/RHEO/compute_rheo_grad.h | 4 +- src/RHEO/fix_rheo.cpp | 2 +- src/RHEO/fix_rheo_thermal.cpp | 49 ++++++---- src/RHEO/fix_rheo_thermal.h | 2 +- src/RHEO/fix_rheo_viscosity.cpp | 44 ++++++--- src/RHEO/fix_rheo_viscosity.h | 6 +- src/RHEO/pair_rheo.cpp | 13 ++- 8 files changed, 162 insertions(+), 118 deletions(-) diff --git a/src/RHEO/compute_rheo_grad.cpp b/src/RHEO/compute_rheo_grad.cpp index e87d39aa53..f963485157 100644 --- a/src/RHEO/compute_rheo_grad.cpp +++ b/src/RHEO/compute_rheo_grad.cpp @@ -23,11 +23,9 @@ #include "force.h" #include "neighbor.h" #include "neigh_list.h" -#include "modify.h" #include "update.h" #include -#include using namespace LAMMPS_NS; enum{COMMGRAD, COMMFIELD}; @@ -35,11 +33,11 @@ enum{COMMGRAD, COMMFIELD}; /* ---------------------------------------------------------------------- */ ComputeRHEOGrad::ComputeRHEOGrad(LAMMPS *lmp, int narg, char **arg) : - Compute(lmp, narg, arg), compute_interface(nullptr), compute_kernel(nullptr) + Compute(lmp, narg, arg), compute_interface(nullptr), compute_kernel(nullptr), + gradv(nullptr), gradr(nullptr), gradt(nullptr), gradn(nullptr) { if (narg < 4) error->all(FLERR,"Illegal compute rheo/grad command"); - velocity_flag = temperature_flag = rho_flag = eta_flag = 0; for (int iarg = 3; iarg < narg; iarg ++) { if (strcmp(arg[iarg],"velocity") == 0) velocity_flag = 1; @@ -53,70 +51,62 @@ ComputeRHEOGrad::ComputeRHEOGrad(LAMMPS *lmp, int narg, char **arg) : ncomm_field = 0; comm_reverse = 0; - std::string fix_cmd = "rheo_grad_property_atom all property/atom" - int dim = domain->dimension; if (velocity_flag) { ncomm_grad += dim * dim; ncomm_field += dim; comm_reverse += dim * dim; - fix_cmd += " d2_gradv 9" + indexv = atom->add_custom("rheo_grad_v", 1, dim * dim); + gradv = atom->darray[indexv]; } if (rho_flag) { ncomm_grad += dim; ncomm_field += 1; comm_reverse += dim; - fix_cmd += " d2_gradr 3" + indexr = atom->add_custom("rheo_grad_rho", 1, dim); + gradr = atom->darray[indexr]; } if (temperature_flag) { ncomm_grad += dim; ncomm_field += 1; comm_reverse += dim; - fix_cmd += " d2_gradt 3" + indext= atom->add_custom("rheo_grad_temp", 1, dim); + gradt = atom->darray[indext]; } if (eta_flag) { ncomm_grad += dim; comm_reverse += dim; - fix_cmd += " d2_gradn 3" + indexn = atom->add_custom("rheo_grad_eta", 1, dim); + gradn = atom->darray[indexn]; } + // Create a custom atom property so it works with compute property/atom + // Do not create grow callback as there's no reason to copy/exchange data + // Manually grow if nmax_old exceeded + comm_forward = ncomm_grad; - - modify->add_fix(fix_cmd); - - int tmp1, tmp2, index; - if (velocity_flag) { - index = atom->find_custom("gradv", tmp1, tmp2); - gradv = atom->darray[index]; - } - - if (rho_flag) { - index = atom->find_custom("gradr", tmp1, tmp2); - gradr = atom->darray[index]; - } - - if (temperature_flag) { - index = atom->find_custom("gradt", tmp1, tmp2); - gradt = atom->darray[index]; - } - - if (eta_flag) { - index = atom->find_custom("gradn", tmp1, tmp2); - gradn = atom->darray[index]; - } + nmax_old = 0; + grow_arrays(atom->nmax); } /* ---------------------------------------------------------------------- */ ComputeRHEOGrad::~ComputeRHEOGrad() { - modify->delete_fix("rheo_grad_property_atom"); + int dim = domain->dimension; + if (velocity_flag) + atom->remove_custom(indexv, 1, dim * dim); + if (rho_flag) + atom->remove_custom(indexr, 1, dim); + if (temperature_flag) + atom->remove_custom(indext, 1, dim); + if (eta_flag) + atom->remove_custom(indexn, 1, dim); } - /* ---------------------------------------------------------------------- */ void ComputeRHEOGrad::init() @@ -169,6 +159,8 @@ void ComputeRHEOGrad::compute_peratom() firstneigh = list->firstneigh; // initialize arrays + if (nmax > nmax_old) grow_arrays(nmax); + for (i = 0; i < nmax; i++) { if (velocity_flag) { for (k = 0; k < dim * dim; k++) @@ -315,39 +307,33 @@ int ComputeRHEOGrad::pack_forward_comm(int n, int *list, double *buf, j = list[i]; if (comm_stage == COMMGRAD) { - if (velocity_flag){ + if (velocity_flag) for (k = 0; k < dim * dim; k++) buf[m++] = gradv[j][k]; - } - if (rho_flag) { + if (rho_flag) for (k = 0; k < dim; k++) buf[m++] = gradr[j][k]; - } - if (temperature_flag) { + if (temperature_flag) for (k = 0; k < dim; k++) buf[m++] = gradt[j][k]; - } - if (eta_flag){ + if (eta_flag) for (k = 0; k < dim; k++) buf[m++] = gradn[j][k]; - } + } else if (comm_stage == COMMFIELD) { - if (velocity_flag) { + if (velocity_flag) for (k = 0; k < dim; k++) buf[m++] = v[j][k]; - } - if (rho_flag) { + if (rho_flag) buf[m++] = rho[j]; - } - if (temperature_flag) { + if (temperature_flag) buf[m++] = temperature[j]; - } } } return m; @@ -367,33 +353,32 @@ void ComputeRHEOGrad::unpack_forward_comm(int n, int first, double *buf) last = first + n; for (i = first; i < last; i++) { if (comm_stage == COMMGRAD) { - if (velocity_flag) { + if (velocity_flag) for (k = 0; k < dim * dim; k++) gradv[i][k] = buf[m++]; - } - if (rho_flag) { + + if (rho_flag) for (k = 0; k < dim; k++) gradr[i][k] = buf[m++]; - } - if (temperature_flag) { + + if (temperature_flag) for (k = 0; k < dim; k++) gradt[i][k] = buf[m++]; - } - if (eta_flag) { + + if (eta_flag) for (k = 0; k < dim; k++) gradn[i][k] = buf[m++]; - } + } else if (comm_stage == COMMFIELD) { - if (velocity_flag) { + if (velocity_flag) for (k = 0; k < dim; k++) v[i][k] = buf[m++]; - } - if (rho_flag) { + + if (rho_flag) rho[i] = buf[m++]; - } - if (temperature_flag) { + + if (temperature_flag) temperature[i] = buf[m++]; - } } } } @@ -408,22 +393,21 @@ int ComputeRHEOGrad::pack_reverse_comm(int n, int first, double *buf) m = 0; last = first + n; for (i = first; i < last; i++) { - if (velocity_flag) { + if (velocity_flag) for (k = 0; k < dim * dim; k++) buf[m++] = gradv[i][k]; - } - if (rho_flag) { + + if (rho_flag) for (k = 0; k < dim; k++) buf[m++] = gradr[i][k]; - } - if (temperature_flag) { + + if (temperature_flag) for (k = 0; k < dim; k++) buf[m++] = gradt[i][k]; - } - if (eta_flag) { + + if (eta_flag) for (k = 0; k < dim; k++) buf[m++] = gradn[i][k]; - } } return m; } @@ -438,21 +422,39 @@ void ComputeRHEOGrad::unpack_reverse_comm(int n, int *list, double *buf) m = 0; for (i = 0; i < n; i++) { j = list[i]; - if (velocity_flag) { + if (velocity_flag) for (k = 0; k < dim * dim; k++) gradv[j][k] += buf[m++]; - } - if (rho_flag) { + + if (rho_flag) for (k = 0; k < dim; k++) gradr[j][k] += buf[m++]; - } - if (temperature_flag) { + + if (temperature_flag) for (k = 0; k < dim; k++) gradt[j][k] += buf[m++]; - } - if (eta_flag) { + + if (eta_flag) for (k = 0; k < dim; k++) gradn[j][k] += buf[m++]; - } } } + +/* ---------------------------------------------------------------------- */ + +void ComputeRHEOGrad::grow_arrays(int nmax) +{ + int dim = domain->dimension; + if (velocity_flag) + memory->grow(gradv, nmax, dim * dim, "atom:rheo_grad_v"); + + if (rho_flag) + memory->grow(gradr, nmax, dim, "atom:rheo_grad_rho"); + + if (temperature_flag) + memory->grow(gradt, nmax, dim, "atom:rheo_grad_temp"); + + if (eta_flag) + memory->grow(gradn, nmax, dim, "atom:rheo_grad_eta"); + nmax_old = nmax; +} \ No newline at end of file diff --git a/src/RHEO/compute_rheo_grad.h b/src/RHEO/compute_rheo_grad.h index 52c5d7c924..220b5813e3 100644 --- a/src/RHEO/compute_rheo_grad.h +++ b/src/RHEO/compute_rheo_grad.h @@ -44,8 +44,8 @@ class ComputeRHEOGrad : public Compute { int stage; private: - int comm_stage; - int ncomm_grad, ncomm_field; + int comm_stage, ncomm_grad, ncomm_field, nmax_old; + int indexv, indexr, indext, indexn; double cut, cutsq, rho0; class NeighList *list; diff --git a/src/RHEO/fix_rheo.cpp b/src/RHEO/fix_rheo.cpp index e2819ad320..d142af6483 100644 --- a/src/RHEO/fix_rheo.cpp +++ b/src/RHEO/fix_rheo.cpp @@ -313,7 +313,7 @@ void FixRHEO::initial_integrate(int /*vflag*/) // Shifting atoms if (shift_flag) { - compute_vshift->correct_surfaces(); + compute_vshift->correct_surfaces(); // COuld this be moved to preforce after the surface fix runs? for (i = 0; i < nlocal; i++) { if (!(status[i] & STATUS_SHIFT)) continue; diff --git a/src/RHEO/fix_rheo_thermal.cpp b/src/RHEO/fix_rheo_thermal.cpp index 406439f93e..f000bf65cc 100644 --- a/src/RHEO/fix_rheo_thermal.cpp +++ b/src/RHEO/fix_rheo_thermal.cpp @@ -32,7 +32,8 @@ enum {NONE, CONSTANT, TYPE}; /* ---------------------------------------------------------------------- */ FixRHEOThermal::FixRHEOThermal(LAMMPS *lmp, int narg, char **arg) : - Fix(lmp, narg, arg), Tc_type(nullptr), kappa_type(nullptr), cv_type(nullptr) + Fix(lmp, narg, arg), Tc_type(nullptr), kappa_type(nullptr), cv_type(nullptr), + conductivity(nullptr) { if (narg < 4) error->all(FLERR,"Illegal fix command"); @@ -40,8 +41,8 @@ FixRHEOThermal::FixRHEOThermal(LAMMPS *lmp, int narg, char **arg) : cv_style = NONE; conductivity_style = NONE; - comm_forward = 0; - nmax = atom->nmax; + comm_forward = 1; + nmax_old = 0; int ntypes = atom->ntypes; int iarg = 3; @@ -123,6 +124,11 @@ FixRHEOThermal::FixRHEOThermal(LAMMPS *lmp, int narg, char **arg) : FixRHEOThermal::~FixRHEOThermal() { + // Remove custom property if it exists + int tmp1, tmp2, index; + index = atom->find_custom("rheo_conductivity", tmp1, tmp2); + if (index != -1) atom->remove_custom(index_cond, 1, 0); + memory->destroy(cv_type); memory->destroy(Tc_type); memory->destroy(kappa_type); @@ -164,8 +170,7 @@ void FixRHEOThermal::setup_pre_force(int /*vflag*/) fix_rheo->thermal_fix_defined = 1; // Identify whether this is the first/last instance of fix thermal - // First will handle growing arrays - // Last will handle communication + // First will grow arrays, last will communicate first_flag = 0 last_flag = 0; @@ -179,6 +184,18 @@ void FixRHEOThermal::setup_pre_force(int /*vflag*/) if (i == 0) first_flag = 1; if ((i + 1) == fixlist.size()) last_flag = 1; + // Create conductivity array if it doesn't already exist + // Create a custom atom property so it works with compute property/atom + // Do not create grow callback as there's no reason to copy/exchange data + // Manually grow if nmax_old exceeded + + int tmp1, tmp2; + index_cond = atom->find_custom("rheo_conductivity", tmp1, tmp2); + if (index_cond == -1) { + index_cond = atom->add_custom("rheo_conductivity", 1, 0); + nmax_old = atom->nmax; + } + post_neighbor(); pre_force(0); } @@ -230,7 +247,7 @@ void FixRHEOThermal::post_integrate() if (status[i] == FixRHEO::FLUID_NO_FORCE) continue; cvi = calc_cv(i); - temperature[i] += dtf*heat[i]/cvi; + temperature[i] += dtf * heat[i] / cvi; if (Tc_style != NONE) { Ti = temperature[i]; @@ -260,15 +277,14 @@ void FixRHEOThermal::post_neighbor() { int i; int *type = atom->type; - double *conductivity = fix_rheo->conductivity; + double *conductivity = atom->dvector[index_cond]; int *mask = atom->mask; int nlocal = atom->nlocal; int nall = nlocal + atom->nghost; - if (first_flag & nmax < atom->nmax) { - nmax = atom->nmax; - fix_rheo->fix_store_cond->grow_arrays(nmax); - } + if (first_flag && (nmax_old < atom->nmax)) + memory->grow(conductivity, atom->nmax, "atom:rheo_conductivity"); + nmax_old = atom->nmax; if (conductivity_style == CONSTANT) { for (i = 0; i < nall; i++) @@ -286,16 +302,15 @@ void FixRHEOThermal::post_neighbor() void FixRHEOThermal::pre_force(int /*vflag*/) { - // So far, none exist + // Not needed yet, when needed add (un)pack_forward_comm() methods //int i; - //double *conductivity = fix_rheo->conductivity; + //double *conductivity = atom->dvector[index_cond]; //int *mask = atom->mask; //int nlocal = atom->nlocal; - //if (first_flag & nmax < atom->nmax) { - // nmax = atom->nmax; - // fix_rheo->fix_store_cond->grow_arrays(nmax); - //} + //if (first_flag && (nmax_old < atom->nmax)) + // memory->grow(conductivity, atom->nmax, "atom:rheo_conductivity"); + //nmax_old = atom->nmax; //if (conductivity_style == TBD) { // for (i = 0; i < nlocal; i++) { diff --git a/src/RHEO/fix_rheo_thermal.h b/src/RHEO/fix_rheo_thermal.h index c0b5255caa..e4ed426fb4 100644 --- a/src/RHEO/fix_rheo_thermal.h +++ b/src/RHEO/fix_rheo_thermal.h @@ -49,7 +49,7 @@ class FixRHEOThermal : public Fix { int cv_style; int conductivity_style; int first_flag, last_flag; - int nmax; + int nmax_old, index_cond; class FixRHEO *fix_rheo; diff --git a/src/RHEO/fix_rheo_viscosity.cpp b/src/RHEO/fix_rheo_viscosity.cpp index f57410783c..3dfbfc1058 100644 --- a/src/RHEO/fix_rheo_viscosity.cpp +++ b/src/RHEO/fix_rheo_viscosity.cpp @@ -39,7 +39,7 @@ FixRHEOViscosity::FixRHEOViscosity(LAMMPS *lmp, int narg, char **arg) : viscosity_style = NONE; comm_forward = 0; - nmax = atom->nmax; + nmax_old = 0; int ntypes = atom->ntypes; int iarg = 3; @@ -81,6 +81,11 @@ FixRHEOViscosity::FixRHEOViscosity(LAMMPS *lmp, int narg, char **arg) : FixRHEOViscosity::~FixRHEOViscosity() { + // Remove custom property if it exists + int tmp1, tmp2, index; + index = atom->find_custom("rheo_viscosity", tmp1, tmp2); + if (index != -1) atom->remove_custom(index_visc, 1, 0); + memory->destroy(eta_type); } @@ -112,8 +117,7 @@ void FixRHEOViscosity::setup_pre_force(int /*vflag*/) fix_rheo->viscosity_fix_defined = 1; // Identify whether this is the first/last instance of fix viscosity - // First will handle growing arrays - // Last will handle communication + // First will grow arrays, last will communicate first_flag = 0 last_flag = 0; @@ -127,6 +131,18 @@ void FixRHEOViscosity::setup_pre_force(int /*vflag*/) if (i == 0) first_flag = 1; if ((i + 1) == fixlist.size()) last_flag = 1; + // Create viscosity array if it doesn't already exist + // Create a custom atom property so it works with compute property/atom + // Do not create grow callback as there's no reason to copy/exchange data + // Manually grow if nmax_old exceeded + + int tmp1, tmp2; + index_visc = atom->find_custom("rheo_viscosity", tmp1, tmp2); + if (index_cond == -1) { + index_visc = atom->add_custom("rheo_viscosity", 1, 0); + nmax_old = atom->nmax; + } + post_neighbor(); pre_force(0); } @@ -140,16 +156,15 @@ void FixRHEOViscosity::post_neighbor() int i; int *type = atom->type; - double *viscosity = fix_rheo->viscosity; + double *viscosity = atom->dvector[index_visc]; int *mask = atom->mask; int nlocal = atom->nlocal; int nall = nlocal + atom->nghost; - if (first_flag & nmax < atom->nmax) { - nmax = atom->nmax; - fix_rheo->fix_store_visc->grow_arrays(nmax); - } + if (first_flag && (nmax_old < atom->nmax)) + memory->grow(viscosity, atom->nmax, "atom:rheo_viscosity"); + nmax_old = atom->nmax; if (viscosity_style == CONSTANT) { for (i = 0; i < nall; i++) @@ -170,17 +185,16 @@ void FixRHEOViscosity::pre_force(int /*vflag*/) int i, a, b; double tmp, gdot; - double *viscosity = fix_rheo->viscosity; + double *viscosity = atom->dvector[index_visc]; int *mask = atom->mask; double **gradv = compute_grad->gradv; int nlocal = atom->nlocal; int dim = domain->dimension; - if (first_flag & nmax < atom->nmax) { - nmax = atom->nmax; - fix_rheo->fix_store_visc->grow_arrays(nmax); - } + if (first_flag && (nmax_old < atom->nmax)) + memory->grow(viscosity, atom->nmax, "atom:rheo_viscosity"); + nmax_old = atom->nmax; if (viscosity_style == POWER) { for (i = 0; i < nlocal; i++) { @@ -213,7 +227,7 @@ int FixRHEOViscosity::pack_forward_comm(int n, int *list, double *buf, int /*pbc_flag*/, int * /*pbc*/) { int i,j,k,m; - double *viscosity = fix_rheo->viscosity; + double *viscosity = atom->dvector[index_visc]; m = 0; for (i = 0; i < n; i++) { @@ -228,7 +242,7 @@ int FixRHEOViscosity::pack_forward_comm(int n, int *list, double *buf, void FixRHEOViscosity::unpack_forward_comm(int n, int first, double *buf) { int i, k, m, last; - double *viscosity = fix_rheo->viscosity; + double *viscosity = atom->dvector[index_visc]; m = 0; last = first + n; diff --git a/src/RHEO/fix_rheo_viscosity.h b/src/RHEO/fix_rheo_viscosity.h index 31c1441e40..d531507a72 100644 --- a/src/RHEO/fix_rheo_viscosity.h +++ b/src/RHEO/fix_rheo_viscosity.h @@ -35,12 +35,14 @@ class FixRHEOViscosity : public Fix { void pre_force(int) override; int pack_forward_comm(int, int *, double *, int, int *) override; void unpack_forward_comm(int, int, double *) override; + private: double *eta_type, eta; - double npow, K, gd0, tau0; + double npow, K, gd0, tau0; int viscosity_style; int first_flag, last_flag; - int nmax; + int nmax_old, index_visc; + class FixRHEO *fix_rheo; class ComputeRHEOGrad *compute_grad; }; diff --git a/src/RHEO/pair_rheo.cpp b/src/RHEO/pair_rheo.cpp index c796db208a..fd4e525b34 100644 --- a/src/RHEO/pair_rheo.cpp +++ b/src/RHEO/pair_rheo.cpp @@ -92,7 +92,6 @@ void PairRHEO::compute(int eflag, int vflag) double **gradv = compute_grad->gradv; double **gradt = compute_grad->gradt; double **gradr = compute_grad->gradr; - double **gradn = compute_grad->gradn; double **v = atom->v; double **x = atom->x; double **f = atom->f; @@ -109,6 +108,18 @@ void PairRHEO::compute(int eflag, int vflag) int *type = atom->type; int *phase = atom->phase; + int tmp1, tmp2; + int index_visc = atom->find_custom("rheo_viscosity", tmp1, tmp2); + if (index_visc == -1) error->all(FLERR, "Cannot find rheo viscosity"); + double *viscosity = atom->dvector[index_visc]; + + double *conductivity; + if (thermal_flag) { + int index_cond = atom->find_custom("rheo_conductivity", tmp1, tmp2); + if (index_cond == -1) error->all(FLERR, "Cannot find rheo conductivity"); + conductivity = atom->dvector[index_cond]; + } + int nlocal = atom->nlocal; int newton_pair = force->newton_pair; int dim = domain->dimension; From 886c642e0155e97bf51d81475978ddcf74526a87 Mon Sep 17 00:00:00 2001 From: jtclemm Date: Wed, 22 Mar 2023 21:15:54 -0600 Subject: [PATCH 012/158] Cleaning up pairstyle --- src/RHEO/pair_rheo.cpp | 291 +++++++++++++++++------------------------ src/RHEO/pair_rheo.h | 2 +- 2 files changed, 119 insertions(+), 174 deletions(-) diff --git a/src/RHEO/pair_rheo.cpp b/src/RHEO/pair_rheo.cpp index fd4e525b34..06913e45e6 100644 --- a/src/RHEO/pair_rheo.cpp +++ b/src/RHEO/pair_rheo.cpp @@ -22,6 +22,7 @@ #include "error.h" #include "fix_rheo.h" #include "force.h" +#include "math_extra.h" #include "memory.h" #include "modify.h" #include "neighbor.h" @@ -32,6 +33,7 @@ #include using namespace LAMMPS_NS; +using namespace MathExtra; #define EPSILON 1e-2 @@ -64,28 +66,15 @@ PairRHEO::~PairRHEO() void PairRHEO::compute(int eflag, int vflag) { int i, j, a, b, ii, jj, inum, jnum, itype, jtype; - int error_flag, pair_force_flag, pair_rho_flag, pair_avisc_flag; - double xtmp, ytmp, ztmp; + int pair_force_flag, pair_rho_flag, pair_avisc_flag; + double xtmp, ytmp, ztmp, w, wp, Ti, Tj, dT; + double rhoi, rhoj, voli, volj, Pi, Pj, etai, etaj, kappai, kappaj; + double mu, q, fp_prefactor, drho_damp, fmag, psi_ij, Fij; + double *dWij, *dWji, *dW1ij, *dW1ji; + double dx[3], du[3], fv[3], dfp[3], fsolid[3], ft[3], vi[3], vj[3]; int *ilist, *jlist, *numneigh, **firstneigh; - double imass, jmass, rsq, r, ir; - - double w, wp, rhoi, rhoj, voli, volj, Pi, Pj; - double *dWij, *dWji, *d2Wij, *d2Wji, *dW1ij, *dW1ji; - double vijeij, etai, etaj, kappai, kappaj; - double Ti, Tj, dT; - double drho_damp, fmag; - double mu, q, cs, fp_prefactor; - double dx[3] = {0}; - double fv[3] = {0}; - double dfp[3] = {0}; - double fsolid[3] = {0}; - double du[3] = {0}; - double vi[3] = {0}; - double vj[3] = {0}; - double dv[3] = {0}; - double psi_ij = 0.0; - double Fij = 0.0; + double imass, jmass, rsq, r, rinv; ev_init(eflag, vflag); @@ -95,18 +84,17 @@ void PairRHEO::compute(int eflag, int vflag) double **v = atom->v; double **x = atom->x; double **f = atom->f; - double **fp = atom->fp; + double **fp = atom->fp; // rewrite later + double *pressure = atom->pressure; // rewrite later double *rho = atom->rho; double *mass = atom->mass; double *drho = atom->drho; double *temp = atom->temp; double *heat = atom->heat; - double *viscosity = atom->viscosity; - double *conductivity = atom->conductivity; double *special_lj = force->special_lj; tagint *tag = atom->tag; int *type = atom->type; - int *phase = atom->phase; + int *status = atom->status; int tmp1, tmp2; int index_visc = atom->find_custom("rheo_viscosity", tmp1, tmp2); @@ -140,10 +128,11 @@ void PairRHEO::compute(int eflag, int vflag) jlist = firstneigh[i]; jnum = numneigh[i]; imass = mass[itype]; - - kappai = conductivity[i]; etai = viscosity[i]; - Ti = temp[i]; + if (thermal_flag) { + kappai = conductivity[i]; + Ti = temp[i]; + } for (jj = 0; jj < jnum; jj++) { j = jlist[jj]; @@ -153,25 +142,27 @@ void PairRHEO::compute(int eflag, int vflag) dx[0] = xtmp - x[j][0]; dx[1] = ytmp - x[j][1]; dx[2] = ztmp - x[j][2]; - rsq = dx[0]*dx[0] + dx[1]*dx[1] + dx[2]*dx[2]; + rsq = lensq3(dx); jtype = type[j]; - jmass = mass[jtype]; if (rsq < cutsq[itype][jtype]) { r = sqrt(rsq); - ir = 1/r; + rinv = 1 / r; - kappaj = conductivity[j]; + jmass = mass[jtype]; etaj = viscosity[j]; - Tj = temp[j]; + if (thermal_flag) { + Tj = temp[j]; + kappaj = conductivity[j]; + } pair_rho_flag = 0; pair_force_flag = 0; pair_avisc_flag = 0; - if (phase[i] <= FixRHEO::FLUID_MAX || phase[j] <= FixRHEO::FLUID_MAX) { + if (status[i] <= FixRHEO::FLUID_MAX || status[j] <= FixRHEO::FLUID_MAX) { pair_force_flag = 1; } - if (phase[i] <= FixRHEO::FLUID_MAX && phase[j] <= FixRHEO::FLUID_MAX) { + if (status[i] <= FixRHEO::FLUID_MAX && status[j] <= FixRHEO::FLUID_MAX) { pair_avisc_flag = 1; pair_rho_flag = 1; } @@ -189,31 +180,31 @@ void PairRHEO::compute(int eflag, int vflag) // Add corrections for walls rhoi = rho[i]; rhoj = rho[j]; - if (phase[i] <= FixRHEO::FLUID_MAX && phase[j] > FixRHEO::FLUID_MAX) { - compute_sinterpolation->correct_v(v[i], v[j], vi, i, j); - rhoj = compute_sinterpolation->correct_rho(j,i); + Pi = pressure[i]; + Pj = pressure[j]; + if ((status[i] & STATUS_FLUID) && !(status[j] & STATUS_FLUID)) { + compute_interface->correct_v(vi, vj, i, j); + rhoj = compute_interface->correct_rho(j, i); + Pj = calc_pressure(rhoj, jtype); // Repel if close to inner solid particle - if (compute_sinterpolation->chi[j] > 0.9 && r < (cut[itype][jtype] * 0.5)) { - fmag = (compute_sinterpolation->chi[j] - 0.9) * (cut[itype][jtype] * 0.5 - r); - fmag *= rho0[itype] * csq[itype] * cut[itype][jtype] * ir; - fsolid[0] = fmag * dx[0]; - fsolid[1] = fmag * dx[1]; - fsolid[2] = fmag * dx[2]; + if (compute_interface->chi[j] > 0.9 && r < (h * 0.5)) { + fmag = (compute_interface->chi[j] - 0.9) * (h * 0.5 - r); + fmag *= rho0 * csq * h * ir; + scale3(fmag, dx, fsolid); } - } else if (phase[i] > FixRHEO::FLUID_MAX && phase[j] <= FixRHEO::FLUID_MAX) { - compute_sinterpolation->correct_v(v[j], v[i], vj, j, i); - rhoi = compute_sinterpolation->correct_rho(i,j); + } else if (!(status[i] & STATUS_FLUID) && (status[j] & STATUS_FLUID)) { + compute_interface->correct_v(vj, vi, j, i); + rhoi = compute_interface->correct_rho(i, j); + Pi = calc_pressure(rhoi, itype); // Repel if close to inner solid particle - if (compute_sinterpolation->chi[i] > 0.9 && r < (cut[itype][jtype] * 0.5)) { - fmag = (compute_sinterpolation->chi[i] - 0.9) * (cut[itype][jtype] * 0.5 - r); - fmag *= rho0[jtype] * csq[jtype] * cut[itype][jtype] * ir; - fsolid[0] = fmag * dx[0]; - fsolid[1] = fmag * dx[1]; - fsolid[2] = fmag * dx[2]; + if (compute_interface->chi[i] > 0.9 && r < (h * 0.5)) { + fmag = (compute_interface->chi[i] - 0.9) * (h * 0.5 - r); + fmag *= rho0 * csq * h * ir; + scale3(fmag, dx, fsolid); } - } else if (phase[i] > FixRHEO::FLUID_MAX && phase[j] > FixRHEO::FLUID_MAX) { + } else if (!(status[i] & STATUS_FLUID) && !(status[j] & STATUS_FLUID)) { rhoi = 1.0; rhoj = 1.0; } @@ -221,26 +212,19 @@ void PairRHEO::compute(int eflag, int vflag) // Compute volume and pressure after reconstructing voli = imass / rhoi; volj = jmass / rhoj; - Pj = calc_pressure(rhoj, jtype); - Pi = calc_pressure(rhoi, itype); - - //Check if Second order kernels will be used for eta*Lap(v) - error_flag = 0; - if (laplacian_order == 2) { - error_flag = compute_kernel->calc_d2w(i, j, dx[0], dx[1], dx[2], r); - d2Wij = compute_kernel->d2Wij; - d2Wji = compute_kernel->d2Wji; - } //Thermal Evolution if (thermal_flag) { - dT = 0.0; - for (a = 0; a < dim; a++) { - dT += (kappai + kappaj) * (Ti-Tj) * dx[a] * dWij[a] * ir * ir; - //Assumes heat capacity and density = 1, needs to be generalized - } - dT *= voli * volj; + dT = dot3(dx, dWij); + dT *= (kappai + kappaj) * (Ti - Tj) * rinv * rinv * voli * volj; + //Assumes heat capacity and density = 1, needs to be generalized heat[i] += dT; + + if (newton_pair || j < nlocal) { + dT = dot3(dx, dWji); + dT *= (kappai + kappaj) * (Tj - Ti) * rinv * rinv * voli * volj; + heat[j] -= dT; + } } // If either particle is fluid, compute hydrostatic and viscous forces @@ -248,133 +232,94 @@ void PairRHEO::compute(int eflag, int vflag) if (pair_force_flag) { //Hydrostatic pressure forces fp_prefactor = voli * volj * (Pj + Pi); + sub3(v1, vj, du); //Add artificial viscous pressure if required if (artificial_visc_flag && pair_avisc_flag){ //Interpolate velocities to midpoint and use this difference for artificial viscosity - for (a = 0; a < dim; a++) { - du[a] = vi[a] - vj[a]; - for (b = 0; b < dim; b++) { + for (a = 0; a < dim; a++) + for (b = 0; b < dim; b++) du[a] -= 0.5 * (gradv[i][a * dim + b] + gradv[j][a * dim + b]) * dx[b]; - } - } - mu = (du[0] * dx[0] + du[1] * dx[1]+ du[2] * dx[2]) * hinv3; + + mu = dot3(du, dx) * hinv3; mu = mu / (rsq * hinv3 * hinv3 + EPSILON); - mu= MIN(0.0, mu); - cs = 0.5 * (sqrt(csq[itype]) + sqrt(csq[jtype])); - // "kinematic viscous pressure" q = Q/rho - q = av*(-2.0*cs*mu + 1.0*mu*mu); - fp_prefactor += voli*volj*q*(rhoj + rhoi); + mu = MIN(0.0, mu); + q = av * (-2.0 * cs * mu + mu * mu); + fp_prefactor += voli * volj * q * (rhoj + rhoi); } // -Grad[P + Q] - dfp[0] = - fp_prefactor*dWij[0]; - dfp[1] = - fp_prefactor*dWij[1]; - dfp[2] = - fp_prefactor*dWij[2]; + scale3(-fp_prefactor, dWij, dfp); // Now compute viscous eta*Lap[v] terms - for (a = 0; a < dim; a ++) { + for (a = 0; a < dim; a++) { fv[a] = 0.0; - for (b = 0; b < dim; b++) { - fv[a] += (etai+etaj)*(vi[a]-vj[a])*dx[b]*dWij[b]*ir*ir; - } - fv[a] *= voli*volj; + for (b = 0; b < dim; b++) + fv[a] += du[a] * dx[b] * dWij[b]; + fv[a] *= (etai + etaj) * voli * volj * rinv * rinv; } - } else { - for (a = 0; a < dim; a ++) { - fv[a] = 0; - dfp[a] = 0; - } - } + add3(fv, dfp, ft); + add3(fsolid, ft, ft); - if (pair_force_flag) { - f[i][0] += fv[0] + dfp[0] + fsolid[0]; - f[i][1] += fv[1] + dfp[1] + fsolid[1]; - f[i][2] += fv[2] + dfp[2] + fsolid[2]; + f[i][0] += ft[0]; + f[i][1] += ft[1]; + f[i][2] += ft[2]; fp[i][0] += dfp[0]; fp[i][1] += dfp[1]; fp[i][2] += dfp[2]; - } - // Density damping - // conventional for low-order h - // interpolated for RK 1 & 2 (Antuono et al, Computers & Fluids 2021) - if (rho_damp_flag && pair_rho_flag) { - if (laplacian_order>=1 && error_flag == 0){ - psi_ij = rhoj-rhoi; - Fij = 0.0; - for (a = 0; a < dim; a++){ - psi_ij += 0.5*(gradr[i][a]+gradr[j][a])*dx[a]; - Fij -= dx[a]*dWij[a]; + if (newton_pair || j < nlocal) { + for (a = 0; a < dim; a ++) { + fv[a] = 0.0; + for (b = 0; b < dim; b++) + fv[a] += (vi[a] - vj[a]) * dx[b] * dWji[b]; + fv[a] *= -(etai + etaj) * voli * volj * rinv * rinv; + // flip sign here b/c -= at accummulator } - Fij *= ir*ir; - drho[i] += 2*rho_damp*psi_ij*Fij*volj; - } - else { - drho_damp = 2*rho_damp*(rhoj-rhoi)*ir*wp; - drho[i] -= drho_damp*volj; - } - } - if (evflag) // Doesn't account for unbalanced forces - ev_tally_xyz(i, j, nlocal, newton_pair, 0.0, 0.0, fv[0]+dfp[0], fv[1]+dfp[1], fv[2]+dfp[2], dx[0], dx[1], dx[2]); + scale3(fp_prefact,r dWji, dfp); - // Newton neighbors - if (newton_pair || j < nlocal) { + add3(fv, dfp, ft); + add3(fsolid, ft, ft); - if (thermal_flag) { - dT = 0.0; - for(a = 0; a < dim; a++){ - //dT += kappai*dWji[a]*gradt[i][a]; - //dT -= kappaj*dWji[a]*gradt[j][a]; - dT += 1/1*(kappai+kappaj)*(Ti-Tj)*dx[a]*dWji[a]*ir*ir; //Assumes heat capacity and density = 1, needs to be generalized - } - dT *= -voli*volj; - heat[j] -= dT; - } - - for (a = 0; a < dim; a ++) { - fv[a] = 0.0; - for (b = 0; b < dim; b++) { - //fv[a] += etai*dWji[b]*(gradv[i][a*dim+b]+gradv[i][b*dim+a]); - //fv[a] -= etaj*dWji[b]*(gradv[j][a*dim+b]+gradv[j][b*dim+a]); - fv[a] += (etai+etaj)*(vi[a]-vj[a])*dx[b]*dWji[b]*ir*ir; - } - fv[a] *= -voli*volj; // flip sign here b/c -= at accummulator - } - - - - if (pair_force_flag) { - for (a = 0; a < dim; a++) - dfp[a] = fp_prefactor*dWji[a]; - } - - if (rho_damp_flag && pair_rho_flag){ - if (laplacian_order>=1 && error_flag == 0){ - Fij = 0.0; - for (a = 0; a < dim; a++){ - Fij += dx[a]*dWji[a]; - } - Fij *= ir*ir; - psi_ij *= -1; - drho[j] += 2*rho_damp*psi_ij*Fij*voli; - } - else { - drho_damp = 2*rho_damp*(rhoj-rhoi)*ir*wp; - drho[j] += drho_damp*voli; - } - } - if (pair_force_flag) { - f[j][0] -= fv[0] + dfp[0] + fsolid[0]; - f[j][1] -= fv[1] + dfp[1] + fsolid[1]; - f[j][2] -= fv[2] + dfp[2] + fsolid[2]; + f[j][0] -= ft[0]; + f[j][1] -= ft[1]; + f[j][2] -= ft[2]; fp[j][0] -= dfp[0]; fp[j][1] -= dfp[1]; fp[j][2] -= dfp[2]; } + + if (evflag) // Doesn't account for unbalanced forces + ev_tally_xyz(i, j, nlocal, newton_pair, 0.0, 0.0, ft[0], ft[1], ft[2], dx[0], dx[1], dx[2]); + } + + // Density damping + // conventional for low-order h + // interpolated for RK 1 & 2 (Antuono et al., Computers & Fluids 2021) + if (rho_damp_flag && pair_rho_flag) { + if (laplacian_order >= 1) { + psi_ij = rhoj - rhoi; + Fij = -rinv * rinv * dot3(dx, dWij); + for (a = 0; a < dim; a++) + psi_ij += 0.5 * (gradr[i][a] + gradr[j][a]) * dx[a]; + drho[i] += 2 * rho_damp * psi_ij * Fij * volj; + } else { + drho_damp = 2 * rho_damp * (rhoj - rhoi) * rinv * wp; + drho[i] -= drho_damp * volj; + } + + if (newton_pair || j < nlocal) { + if (laplacian_order >= 1) { + Fij = rinv * rinv * dot3(dx, dWji); + psi_ij *= -1; + drho[j] += 2 * rho_damp * psi_ij * Fij * voli; + } else { + drho[j] += drho_damp * voli; + } + } } } } @@ -411,15 +356,13 @@ void PairRHEO::settings(int narg, char **arg) while (iarg < narg) { if (strcmp(arg[iarg], "rho/damp") == 0) { if (iarg + 1 >= narg) error->all(FLERR,"Illegal pair_style command"); - rho_damp_flag = 1; rho_damp = utils::numeric(FLERR,arg[iarg + 1],false,lmp); iarg++; } else if (strcmp(arg[iarg], "artificial/visc") == 0) { if (iarg + 1 >= narg) error->all(FLERR,"Illegal pair_style command"); - artificial_visc_flag = 1; - av = utils::numeric(FLERR,arg[iarg+1],false,lmp); + av = utils::numeric(FLERR,arg[iarg + 1],false,lmp); iarg++; } else error->all(FLERR,"Illegal pair_style command, {}", arg[iarg]); iarg++; @@ -438,8 +381,8 @@ void PairRHEO::coeff(int narg, char **arg) allocate(); int ilo, ihi, jlo, jhi; - utils::bounds(FLERR,arg[0],1, atom->ntypes, ilo, ihi,error); - utils::bounds(FLERR,arg[1],1, atom->ntypes, jlo, jhi,error); + utils::bounds(FLERR, arg[0], 1, atom->ntypes, ilo, ihi,error); + utils::bounds(FLERR, arg[1], 1, atom->ntypes, jlo, jhi,error); int count = 0; for (int i = ilo; i <= ihi; i++) { @@ -472,6 +415,8 @@ void PairRHEO::setup() rho0 = fix_rheo->rho0; hinv = 1.0 / h; + hinv3 = hinv * 3.0; + cs = sqrt(csq); laplacian_order = -1; if (comm->ghost_velocity == 0) diff --git a/src/RHEO/pair_rheo.h b/src/RHEO/pair_rheo.h index 026bc16527..18458048f6 100644 --- a/src/RHEO/pair_rheo.h +++ b/src/RHEO/pair_rheo.h @@ -37,7 +37,7 @@ class PairRHEO : public Pair { protected: double h, csq, rho0; // From fix RHEO - double hsq, hinv, av, rho_damp; + double cs, hsq, hinv, hinv3, av, rho_damp; int laplacian_order; int artificial_visc_flag; From beb6f934f8e34a4a5bd55ff057500f095009245d Mon Sep 17 00:00:00 2001 From: jtclemm Date: Wed, 22 Mar 2023 21:44:11 -0600 Subject: [PATCH 013/158] adding new peratom storage to pressure --- src/RHEO/fix_rheo_pressure.cpp | 52 ++++++++++++++++----------------- src/RHEO/fix_rheo_pressure.h | 3 +- src/RHEO/fix_rheo_viscosity.cpp | 2 +- src/RHEO/pair_rheo.cpp | 9 +++--- 4 files changed, 33 insertions(+), 33 deletions(-) diff --git a/src/RHEO/fix_rheo_pressure.cpp b/src/RHEO/fix_rheo_pressure.cpp index 8f42e22239..e4c1c44163 100644 --- a/src/RHEO/fix_rheo_pressure.cpp +++ b/src/RHEO/fix_rheo_pressure.cpp @@ -38,7 +38,7 @@ FixRHEOPressure::FixRHEOPressure(LAMMPS *lmp, int narg, char **arg) : pressure_style = NONE; comm_forward = 1; - nmax = atom->nmax; + nmax_old = 0; // Currently can only have one instance of fix rheo/pressure if (igroup != 0) @@ -64,7 +64,13 @@ FixRHEOPressure::FixRHEOPressure(LAMMPS *lmp, int narg, char **arg) : /* ---------------------------------------------------------------------- */ -FixRHEOPressure::~FixRHEOPressure() {} +FixRHEOPressure::~FixRHEOPressure() +{ + // Remove custom property if it exists + int tmp1, tmp2, index; + index = atom->find_custom("rheo_pressure", tmp1, tmp2); + if (index != -1) atom->remove_custom(index_pres, 1, 0); +} /* ---------------------------------------------------------------------- */ @@ -98,22 +104,18 @@ void FixRHEOPressure::setup_pre_force(int /*vflag*/) { fix_rheo->pressure_fix_defined = 1; - // Identify whether this is the first/last instance of fix pressure - // First will handle growing arrays - // Last will handle communication - first_flag = 0 - last_flag = 0; + // Create pressure array if it doesn't already exist + // Create a custom atom property so it works with compute property/atom + // Do not create grow callback as there's no reason to copy/exchange data + // Manually grow if nmax_old exceeded - int i = 0; - auto fixlist = modify->get_fix_by_style("rheo/pressure"); - for (const auto &ifix : fixlist) { - if (strcmp(ifix->id, id) == 0) break; - i++; + int tmp1, tmp2; + index_pres = atom->find_custom("rheo_pressure", tmp1, tmp2); + if (index_pres == -1) { + index_pres = atom->add_custom("rheo_pressure", 1, 0); + nmax_old = atom->nmax; } - if (i == 0) first_flag = 1; - if ((i + 1) == fixlist.size()) last_flag = 1; - pre_force(0); } @@ -126,16 +128,15 @@ void FixRHEOPressure::pre_force(int /*vflag*/) int i; double dr, rr3, rho_ratio; - double *p = fix_rheo->pressure; + double *pressure = atom->dvector[index_pres]; int *mask = atom->mask; double *rho = atom->rho; int nlocal = atom->nlocal; - int dim = domain->dimension; - if (first_flag & nmax < atom->nmax) { - nmax = atom->nmax; - fix_rheo->fix_store_visc->grow_arrays(nmax); + if (nmax_old < atom->nmax) { + memory->grow(pressure, atom->nmax, "atom:rheo_pressure"); + nmax_old = atom->nmax; } if (pressure_style == TAITWATER) inv7 = 1.0 / 7.0; @@ -143,19 +144,18 @@ void FixRHEOPressure::pre_force(int /*vflag*/) for (i = 0; i < nlocal; i++) { if (mask[i] & groupbit) { if (pressure_style == LINEAR) { - p[i] = csq * (rho[i] - rho0); + pressure[i] = csq * (rho[i] - rho0); } else if (pressure_style == CUBIC) { dr = rho[i] - rho0; - p[i] = csq * (dr + c_cubic * dr * dr * dr); + pressure[i] = csq * (dr + c_cubic * dr * dr * dr); } else if (pressure_style == TAITWATER) { rho_ratio = rho[i] / rho0inv; rr3 = rho_ratio * rho_ratio * rho_ratio; - p[i] = csq * rho0 * inv7 * (rr3 * rr3 * rho_ratio - 1.0); + pressure[i] = csq * rho0 * inv7 * (rr3 * rr3 * rho_ratio - 1.0); } } } - if (last_flag && comm_forward) comm->forward_comm(this); } @@ -165,7 +165,7 @@ int FixRHEOPressure::pack_forward_comm(int n, int *list, double *buf, int /*pbc_flag*/, int * /*pbc*/) { int i,j,k,m; - double *pressure = fix_rheo->pressure; + double *pressure = atom->dvector[index_pres]; m = 0; for (i = 0; i < n; i++) { @@ -180,7 +180,7 @@ int FixRHEOPressure::pack_forward_comm(int n, int *list, double *buf, void FixRHEOPressure::unpack_forward_comm(int n, int first, double *buf) { int i, k, m, last; - double *pressure = fix_rheo->pressure; + double *pressure = atom->dvector[index_pres]; m = 0; last = first + n; diff --git a/src/RHEO/fix_rheo_pressure.h b/src/RHEO/fix_rheo_pressure.h index 45217c7f75..6c7ee73370 100644 --- a/src/RHEO/fix_rheo_pressure.h +++ b/src/RHEO/fix_rheo_pressure.h @@ -39,7 +39,8 @@ class FixRHEOPressure : public Fix { double c_cubic, csq, rho0, rho0inv; int pressure_style; int first_flag, last_flag; - int nmax; + int nmax_old, index_pressure; + class FixRHEO *fix_rheo; }; diff --git a/src/RHEO/fix_rheo_viscosity.cpp b/src/RHEO/fix_rheo_viscosity.cpp index 0fe9c7796e..2b63c7633b 100644 --- a/src/RHEO/fix_rheo_viscosity.cpp +++ b/src/RHEO/fix_rheo_viscosity.cpp @@ -138,7 +138,7 @@ void FixRHEOViscosity::setup_pre_force(int /*vflag*/) int tmp1, tmp2; index_visc = atom->find_custom("rheo_viscosity", tmp1, tmp2); - if (index_cond == -1) { + if (index_visc == -1) { index_visc = atom->add_custom("rheo_viscosity", 1, 0); nmax_old = atom->nmax; } diff --git a/src/RHEO/pair_rheo.cpp b/src/RHEO/pair_rheo.cpp index d3ac28d3d5..d1a30d3b40 100644 --- a/src/RHEO/pair_rheo.cpp +++ b/src/RHEO/pair_rheo.cpp @@ -229,9 +229,8 @@ void PairRHEO::compute(int eflag, int vflag) } } - // If either particle is fluid, compute hydrostatic and viscous forces - // Compute eta*Lap(v) - different forms depending on order of RK correction if (pair_force_flag) { + //Hydrostatic pressure forces fp_prefactor = voli * volj * (Pj + Pi); sub3(v1, vj, du); @@ -271,6 +270,9 @@ void PairRHEO::compute(int eflag, int vflag) fp[i][1] += dfp[1]; fp[i][2] += dfp[2]; + if (evflag) // Does not account for unbalanced forces + ev_tally_xyz(i, j, nlocal, newton_pair, 0.0, 0.0, ft[0], ft[1], ft[2], dx[0], dx[1], dx[2]); + if (newton_pair || j < nlocal) { for (a = 0; a < dim; a ++) { fv[a] = 0.0; @@ -293,9 +295,6 @@ void PairRHEO::compute(int eflag, int vflag) fp[j][1] -= dfp[1]; fp[j][2] -= dfp[2]; } - - if (evflag) // Doesn't account for unbalanced forces - ev_tally_xyz(i, j, nlocal, newton_pair, 0.0, 0.0, ft[0], ft[1], ft[2], dx[0], dx[1], dx[2]); } // Density damping From bf669d526bfcce31d40f7f58ff95ff62dc186c34 Mon Sep 17 00:00:00 2001 From: EricPalermo Date: Fri, 24 Mar 2023 15:38:26 -0400 Subject: [PATCH 014/158] test adding file --- src/RHEO/test.txt | 0 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 src/RHEO/test.txt diff --git a/src/RHEO/test.txt b/src/RHEO/test.txt new file mode 100644 index 0000000000..e69de29bb2 From 0a3a4c527d987c0b250d208d3559fe5849188c5e Mon Sep 17 00:00:00 2001 From: EricPalermo Date: Fri, 24 Mar 2023 16:43:34 -0400 Subject: [PATCH 015/158] generalized density in dT calculation --- src/RHEO/pair_rheo.cpp | 3 +-- src/RHEO/test.txt | 0 2 files changed, 1 insertion(+), 2 deletions(-) delete mode 100644 src/RHEO/test.txt diff --git a/src/RHEO/pair_rheo.cpp b/src/RHEO/pair_rheo.cpp index d1a30d3b40..f03e2b25cd 100644 --- a/src/RHEO/pair_rheo.cpp +++ b/src/RHEO/pair_rheo.cpp @@ -218,8 +218,7 @@ void PairRHEO::compute(int eflag, int vflag) // Thermal Evolution if (thermal_flag) { dT = dot3(dx, dWij); - dT *= (kappai + kappaj) * (Ti - Tj) * rinv * rinv * voli * volj; - //TODO: Assumes heat capacity and density = 1, needs to be generalized + dT *= (kappai + kappaj) * (Ti - Tj) * rinv * rinv * voli * volj / rho0; // Assumes heat capacity = 1 heatflow[i] += dT; if (newton_pair || j < nlocal) { diff --git a/src/RHEO/test.txt b/src/RHEO/test.txt deleted file mode 100644 index e69de29bb2..0000000000 From 29edfc45d7d7c55342b3e4c1f890b27401d869ad Mon Sep 17 00:00:00 2001 From: jtclemm Date: Fri, 24 Mar 2023 21:59:17 -0600 Subject: [PATCH 016/158] Adding heat/temperature checks/zeroing to thermal fix --- src/GRANULAR/fix_heat_flow.cpp | 4 +- src/RHEO/fix_rheo_thermal.cpp | 81 +++++++++++++++++++++++++++++++--- src/RHEO/fix_rheo_thermal.h | 2 + src/RHEO/pair_rheo.cpp | 1 - 4 files changed, 80 insertions(+), 8 deletions(-) diff --git a/src/GRANULAR/fix_heat_flow.cpp b/src/GRANULAR/fix_heat_flow.cpp index a9c110a2e7..1b2e55e673 100644 --- a/src/GRANULAR/fix_heat_flow.cpp +++ b/src/GRANULAR/fix_heat_flow.cpp @@ -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 temp/integrate requires atoms store temperature property"); if (!atom->heatflow_flag) - error->all(FLERR,"Fix temp/integrate requires atom style with heatflow property"); + error->all(FLERR,"Fix temp/integrate requires atoms store heatflow property"); } /* ---------------------------------------------------------------------- */ diff --git a/src/RHEO/fix_rheo_thermal.cpp b/src/RHEO/fix_rheo_thermal.cpp index f000bf65cc..272daf9bd0 100644 --- a/src/RHEO/fix_rheo_thermal.cpp +++ b/src/RHEO/fix_rheo_thermal.cpp @@ -161,6 +161,11 @@ void FixRHEOThermal::init() compute_vshift = fix_rheo->compute_vshift; dtf = 0.5 * update->dt * force->ftm2v; + + if (atom->temperature_flag != 1) + error->all(FLERR,"fix rheo/thermal command requires atoms store temperature property"); + if (atom->heatflow_flag != 1) + error->all(FLERR,"fix rheo/thermal command requires atoms store heatflow property"); } /* ---------------------------------------------------------------------- */ @@ -234,7 +239,7 @@ void FixRHEOThermal::post_integrate() { int *status = atom->status; double *temperature = atom->temperature; - double *heat = atom->heat; + double *heatflow = atom->heatflow; double *rho = atom->rho; int *mask = atom->mask; int *type = aotm->type; @@ -247,7 +252,7 @@ void FixRHEOThermal::post_integrate() if (status[i] == FixRHEO::FLUID_NO_FORCE) continue; cvi = calc_cv(i); - temperature[i] += dtf * heat[i] / cvi; + temperature[i] += dtf * heatflow[i] / cvi; if (Tc_style != NONE) { Ti = temperature[i]; @@ -298,11 +303,20 @@ void FixRHEOThermal::post_neighbor() /* ---------------------------------------------------------------------- Update (and forward) evolving conductivity styles every timestep + Zero heat flow ------------------------------------------------------------------------- */ void FixRHEOThermal::pre_force(int /*vflag*/) { - // Not needed yet, when needed add (un)pack_forward_comm() methods + // send updated temperatures to ghosts if first instance of fix + // then clear heatflow for next force calculation + double *heatflow = atom->heatflow; + if (first_flag) { + comm->forward_comm(this); + for (int i = 0; i < atom->nmax; i++) heatflow[i] = 0.0; + } + + // Not needed yet, when needed add stage check for (un)pack_forward_comm() methods //int i; //double *conductivity = atom->dvector[index_cond]; //int *mask = atom->mask; @@ -327,7 +341,7 @@ void FixRHEOThermal::pre_force(int /*vflag*/) void FixRHEOThermal::final_integrate() { double *temperature = atom->temperature; - double *heat = atom->heat; + double *heatflow = atom->heatflow; int *status = atom->status; int *mask = atom->mask; @@ -339,7 +353,7 @@ void FixRHEOThermal::final_integrate() if (status[i] & FixRHEO::STATUS_NO_FORCE) continue; cvi = calc_cv(i); - temperature[i] += dtf * heat[i] / cvi; + temperature[i] += dtf * heatflow[i] / cvi; } } } @@ -362,3 +376,60 @@ double FixRHEOThermal::calc_cv(int i) return(cv_type[atom->type[i]]); } } + +/* ---------------------------------------------------------------------- */ + +int FixRHEOThermal::pack_forward_comm(int n, int *list, double *buf, int /*pbc_flag*/, int * /*pbc*/) +{ + int i, j, m; + + double *temperature = atom->temperature; + + m = 0; + for (i = 0; i < n; i++) { + j = list[i]; + buf[m++] = temperature[j]; + } + + return m; +} + +/* ---------------------------------------------------------------------- */ + +void FixRHEOThermal::unpack_forward_comm(int n, int first, double *buf) +{ + int i, m, last; + + m = 0; + last = first + n; + + double *temperature = atom->temperature; + + for (i = first; i < last; i++) temperature[i] = buf[m++]; +} + +/* ---------------------------------------------------------------------- */ + +int FixRHEOThermal::pack_reverse_comm(int n, int first, double *buf) +{ + int m = 0; + int last = first + n; + double *heatflow = atom->heatflow; + + for (int i = first; i < last; i++) { + buf[m++] = heatflow[i]; + } + + return m; +} + +/* ---------------------------------------------------------------------- */ + +void FixRHEOThermal::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++]; +} diff --git a/src/RHEO/fix_rheo_thermal.h b/src/RHEO/fix_rheo_thermal.h index e4ed426fb4..d9a17ebd60 100644 --- a/src/RHEO/fix_rheo_thermal.h +++ b/src/RHEO/fix_rheo_thermal.h @@ -39,6 +39,8 @@ class FixRHEOThermal : public Fix { void reset_dt() override; int pack_forward_comm(int, int *, double *, int, int *) override; void unpack_forward_comm(int, int, double *) override; + int pack_reverse_comm(int, int, double *) override; + void unpack_reverse_comm(int, int *, double *) override; private: double *cv_type, cv; diff --git a/src/RHEO/pair_rheo.cpp b/src/RHEO/pair_rheo.cpp index d1a30d3b40..d78af46249 100644 --- a/src/RHEO/pair_rheo.cpp +++ b/src/RHEO/pair_rheo.cpp @@ -219,7 +219,6 @@ void PairRHEO::compute(int eflag, int vflag) if (thermal_flag) { dT = dot3(dx, dWij); dT *= (kappai + kappaj) * (Ti - Tj) * rinv * rinv * voli * volj; - //TODO: Assumes heat capacity and density = 1, needs to be generalized heatflow[i] += dT; if (newton_pair || j < nlocal) { From 908c32788cab5c2f3b7dbeaec208c26577ead8b2 Mon Sep 17 00:00:00 2001 From: jtclemm Date: Sat, 25 Mar 2023 20:17:17 -0600 Subject: [PATCH 017/158] Cleaning up fix rheo, initial sketch of kernel compute --- src/RHEO/compute_rheo_kernel.cpp | 870 +++++++++++++++++++++++++++++++ src/RHEO/compute_rheo_kernel.h | 71 +++ src/RHEO/fix_rheo.cpp | 42 +- src/RHEO/fix_rheo.h | 11 - src/RHEO/fix_rheo_thermal.cpp | 3 +- 5 files changed, 948 insertions(+), 49 deletions(-) create mode 100644 src/RHEO/compute_rheo_kernel.cpp create mode 100644 src/RHEO/compute_rheo_kernel.h diff --git a/src/RHEO/compute_rheo_kernel.cpp b/src/RHEO/compute_rheo_kernel.cpp new file mode 100644 index 0000000000..116ac08745 --- /dev/null +++ b/src/RHEO/compute_rheo_kernel.cpp @@ -0,0 +1,870 @@ +/* ---------------------------------------------------------------------- + LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator + http://lammps.sandia.gov, 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. +------------------------------------------------------------------------- */ + +#include "compute_rheo_kernel.h" + +#include "atom.h" +#include "comm.h" +#include "compute_rheo_solids.h" +#include "domain.h" +#include "error.h" +#include "fix_rheo.h" +#include "force.h" +#include "math_extra.h" +#include "memory.h" +#include "modify.h" +#include "neighbor.h" +#include "neigh_list.h" +#include "neigh_request.h" +#include "pair.h" +#include "update.h" +#include "utils.h" + +#include +#include +#include +#include +#include +#include + +using namespace LAMMPS_NS; +enum {QUINTIC, CRK0, CRK1, CRK2}; +#define DELTA 2000 + +/* ---------------------------------------------------------------------- */ + +ComputeRHEOKernel::ComputeRHEOKernel(LAMMPS *lmp, int narg, char **arg) : + Compute(lmp, narg, arg), + C(nullptr), C0(nullptr), compute_solids(nullptr); +{ + if (narg != 3) error->all(FLERR,"Illegal compute rheo/kernel command"); + + comm_forward = 1; // For coordination + solid_flag = 0; +} + +/* ---------------------------------------------------------------------- */ + +ComputeRHEOKernel::~ComputeRHEOKernel() +{ + // Remove custom property if it exists + int tmp1, tmp2, index; + index = atom->find_custom("rheo_coordination", tmp1, tmp2); + if (index != -1) atom->remove_custom(index_coord, 1, 0); + + memory->destroy(C); + memory->destroy(C0); +} + +/* ---------------------------------------------------------------------- */ + +void ComputeRHEOKernel::init() +{ + neighbor->add_request(this, NeighConst::REQ_FULL); + + auto fixes = modify->get_fix_by_style("rheo"); + if (fixes.size() == 0) error->all(FLERR, "Need to define fix rheo to use compute rheo/kernel"); + fix_rheo = dynamic_cast(fixes[0]); + + int icompute = modify->find_compute("rheo_solids"); + if (icompute != -1) { + compute_solids = ((ComputeRHEOSolids *) modify->compute[icompute]); + solid_flag = 1; + } + + + N2min = utils::inumeric(FLERR,arg[4],false,lmp); + + cutsq = cut*cut; + cutinv = 1.0/cut; + h = cut/3.0; + ih = 1.0/h; + ihsq = ih*ih; + + kernel_type = QUINTIC; + correction_order = -1; + } else if (strcmp(arg[3],"CRK0") == 0) { + kernel_type = CRK0; + correction_order = 0; + } else if (strcmp(arg[3],"CRK1") == 0) { + kernel_type = CRK1; + correction_order = 1; + } else if (strcmp(arg[3],"CRK2") == 0) { + kernel_type = CRK2; + correction_order = 2; + + if (dim == 3) { + pre_w = 0.002652582384864922*ihsq*ih; + pre_wp = pre_w*ih; + } else { + pre_w = 0.004661441847879780*ihsq; + pre_wp = pre_w*ih; + } + + //Use property atom, can fix store save integers? + char **fixarg = new char*[4]; + fixarg[0] = (char *) "PROPERTY_ATOM_RHEO_KERNEL"; + fixarg[1] = (char *) "all"; + fixarg[2] = (char *) "property/atom"; + fixarg[3] = (char *) "i_coordination"; + modify->add_fix(4,fixarg,1); + + + nmax = atom->nmax; + + if (kernel_type == CRK0) { + memory->create(C0, nmax, "rheo/kernel:C0"); + comm_forward = 1; + } + + if (kernel_type == CRK1) { + Mdim = 1 + dim; + ncor = 1 + dim; + memory->create(C, nmax, ncor, Mdim, "rheo/kernel:C"); + comm_forward = ncor*Mdim; + } + + if (kernel_type == CRK2) { + //Polynomial basis size (up to quadratic order) + Mdim = 1 + dim + dim*(dim+1)/2; + //Number of sets of correction coefficients (1 x y xx yy) + z zz (3D) + ncor = 1 + 2*dim; + //variables that require forwarding + memory->create(C, nmax, ncor, Mdim, "rheo/kernel:C"); + comm_forward = ncor*Mdim; + } +} + +/* ---------------------------------------------------------------------- */ + +void ComputeRHEOKernel::init_list(int /*id*/, NeighList *ptr) +{ + list = ptr; +} + +/* ---------------------------------------------------------------------- */ + +int ComputeRHEOKernel::check_corrections(int i) +{ + int corrections = 1; + + if (gsl_error_flag) { + // If there were errors, check to see if it occured for this atom + if (gsl_error_tags.find(atom->tag[i]) != gsl_error_tags.end()) + corrections = 0; + } + + coordination = atom->ivector[index_coord]; + if (coordination[i] < N2min) corrections = 0; + + return corrections; +} + +/* ---------------------------------------------------------------------- */ + +double ComputeRHEOKernel::calc_w(int i, int j, double delx, double dely, double delz, double r) +{ + double w; + + int corrections_i = check_corrections(i); + int corrections_j = check_corrections(j); + int corrections = corrections_i & corrections_j; + + if (memory_flag) { + long long key; + int v_index; + tagint tag1 = atom->tag[i]; + tagint tag2 = atom->tag[j]; + + // Use Szudzik's pairing function to define unique index for two tags + // szudzik.com/elegantpairing.pdf + if (tag1 > tag2) key = (long long) tag1*tag1 + tag2; + else key = (long long) tag2*tag2 + tag1; + + if (locations_w.find(key) != locations_w.end()){ + v_index = locations_w[key]; + w = stored_w[v_index]; + } else { + if (kernel_type == QUINTIC || !corrections) w = calc_w_quintic(i,j,delx,dely,delz,r); + else if (kernel_type == CRK0) w = calc_w_crk0(i,j,delx,dely,delz,r); + else if (kernel_type == CRK1) w = calc_w_crk1(i,j,delx,dely,delz,r); + else if (kernel_type == CRK2) w = calc_w_crk2(i,j,delx,dely,delz,r); + + locations_w[key] = nstored_w; + stored_w[nstored_w] = w; + nstored_w ++; + if (nstored_w >= max_nstored) grow_memory(); + } + } else { + if (kernel_type == QUINTIC || !corrections) w = calc_w_quintic(i,j,delx,dely,delz,r); + else if (kernel_type == CRK0) w = calc_w_crk0(i,j,delx,dely,delz,r); + else if (kernel_type == CRK1) w = calc_w_crk1(i,j,delx,dely,delz,r); + else if (kernel_type == CRK2) w = calc_w_crk2(i,j,delx,dely,delz,r); + } + + return w; +} + +/* ---------------------------------------------------------------------- */ + +double ComputeRHEOKernel::calc_dw(int i, int j, double delx, double dely, double delz, double r) +{ + double wp; + + int corrections_i = check_corrections(i); + int corrections_j = check_corrections(j); + + // Calc wp and default dW's, a bit inefficient but can redo later + wp = calc_dw_quintic(i,j,delx,dely,delz,r,dWij,dWji); + if(kernel_type == CRK1) { + //check if kernel correction calculated successfully. If not, revert to quintic + if (corrections_i) calc_dw_crk1(i,j,delx,dely,delz,r,dWij); + if (corrections_j) calc_dw_crk1(j,i,-delx,-dely,-delz,r,dWji); + } else if(kernel_type == CRK2) { + if (corrections_i) calc_dw_crk2(i,j,delx,dely,delz,r,dWij); + if (corrections_j) calc_dw_crk2(j,i,-delx,-dely,-delz,r,dWji); + } + + return wp; +} + +/* ---------------------------------------------------------------------- */ + +double ComputeRHEOKernel::calc_w_quintic(int i, int j, double delx, double dely, double delz, double r) +{ + double w, tmp1, tmp2, tmp3, tmp1sq, tmp2sq, tmp3sq, s; + s = r*ih; + + if (s>3.0) { + w = 0.0; + } + + if (s <= 3.0) { + tmp3 = 3 - s; + tmp3sq = tmp3*tmp3; + w = tmp3sq*tmp3sq*tmp3; + } + if (s <= 2.0) { + tmp2 = 2 - s; + tmp2sq = tmp2*tmp2; + w -= 6*tmp2sq*tmp2sq*tmp2; + } + if (s <= 1.0) { + tmp1 = 1 - s; + tmp1sq = tmp1*tmp1; + w += 15*tmp1sq*tmp1sq*tmp1; + } + + w *= pre_w; + + Wij = w; + Wji = w; + + return w; +} + +/* ---------------------------------------------------------------------- */ + +double ComputeRHEOKernel::calc_dw_quintic(int i, int j, double delx, double dely, double delz, double r, double *dW1, double *dW2) +{ + double wp, tmp1, tmp2, tmp3, tmp1sq, tmp2sq, tmp3sq, s, wprinv; + double *mass = atom->mass; + int *type = atom->type; + + s = r*ih; + + if (s>3.0) { + wp = 0.0; + } + if (s <= 3.0) { + tmp3 = 3 - s; + tmp3sq = tmp3*tmp3; + wp = -5.0*tmp3sq*tmp3sq; + } + if (s <= 2.0) { + tmp2 = 2 - s; + tmp2sq = tmp2*tmp2; + wp += 30.0*tmp2sq*tmp2sq; + } + if (s <= 1.0) { + tmp1 = 1 - s; + tmp1sq = tmp1*tmp1; + wp -= 75.0*tmp1sq*tmp1sq; + } + + wp *= pre_wp; + wprinv = wp/r; + dW1[0] = delx*wprinv; + dW1[1] = dely*wprinv; + dW1[2] = delz*wprinv; + + dW2[0] = -delx*wprinv; + dW2[1] = -dely*wprinv; + dW2[2] = -delz*wprinv; + + return wp; +} + + +/* ---------------------------------------------------------------------- */ + +double ComputeRHEOKernel::calc_w_crk0(int i, int j, double delx, double dely, double delz, double r) +{ + double w; + + w = calc_w_quintic(i,j,delx,dely,delz,r); + + Wij = C0[i]*w; + Wji = C0[j]*w; + + return w; +} + +/* ---------------------------------------------------------------------- */ + +double ComputeRHEOKernel::calc_w_crk1(int i, int j, double delx, double dely, double delz, double r) +{ + int b; + double w, wR, dx[3], H[Mdim]; + + dx[0] = delx; + dx[1] = dely; + dx[2] = delz; + w = calc_w_quintic(i,j,delx,dely,delz,r); + + if (dim == 2) { + H[0] = 1.0; + H[1] = dx[0]*cutinv; + H[2] = dx[1]*cutinv; + } else { + H[0] = 1.0; + H[1] = dx[0]*cutinv; + H[2] = dx[1]*cutinv; + H[3] = dx[2]*cutinv; + } + Wij = 0; + for (b = 0; b < Mdim; b++) { + Wij += C[i][0][b]*H[b]; // C columns: 1 x y (z) xx yy (zz) + } + Wij *= w; + + //Now compute Wji + H[1] *= -1; + H[2] *= -1; + if (dim == 3) H[3] *= -1; + + Wji = 0; + for (b = 0; b < Mdim; b++) { + Wji += C[j][0][b]*H[b]; // C columns: 1 x y (z) xx yy (zz) + } + Wji *= w; + + return w; +} + +/* ---------------------------------------------------------------------- */ + +double ComputeRHEOKernel::calc_w_crk2(int i, int j, double delx, double dely, double delz, double r) +{ + int b; + double w, wR, dx[3], H[Mdim]; + dx[0] = delx; + dx[1] = dely; + dx[2] = delz; + w = calc_w_quintic(i,j,delx,dely,delz,r); + + + if (dim == 2) { + H[0] = 1.0; + H[1] = dx[0]*cutinv; + H[2] = dx[1]*cutinv; + H[3] = 0.5*dx[0]*dx[0]*cutinv*cutinv; + H[4] = 0.5*dx[1]*dx[1]*cutinv*cutinv; + H[5] = dx[0]*dx[1]*cutinv*cutinv; + } else { + H[0] = 1.0; + H[1] = dx[0]*cutinv; + H[2] = dx[1]*cutinv; + H[3] = dx[2]*cutinv; + H[4] = 0.5*dx[0]*dx[0]*cutinv*cutinv; + H[5] = 0.5*dx[1]*dx[1]*cutinv*cutinv; + H[6] = 0.5*dx[2]*dx[2]*cutinv*cutinv; + H[7] = dx[0]*dx[1]*cutinv*cutinv; + H[8] = dx[0]*dx[2]*cutinv*cutinv; + H[9] = dx[1]*dx[2]*cutinv*cutinv; + } + Wij = 0; + for (b = 0; b < Mdim; b++) { + Wij += C[i][0][b]*H[b]; // C columns: 1 x y (z) xx yy (zz) + } + Wij *= w; + + //Now compute Wji + H[1] *= -1; + H[2] *= -1; + if (dim == 3) H[3] *= -1; + + Wji = 0; + for (b = 0; b < Mdim; b++) { + Wji += C[j][0][b]*H[b]; // C columns: 1 x y (z) xx yy (zz) + } + Wji *= w; + + return w; +} + +/* ---------------------------------------------------------------------- */ + +void ComputeRHEOKernel::calc_dw_crk1(int i, int j, double delx, double dely, double delz, double r, double *dW) +{ + int a, b; + double w, dx[3], H[Mdim]; + dx[0] = delx; + dx[1] = dely; + dx[2] = delz; + + w = calc_w_quintic(i,j,delx,dely,delz,r); + //Populate correction basis + if (dim == 2) { + H[0] = 1.0; + H[1] = dx[0]*cutinv; + H[2] = dx[1]*cutinv; + } else { + H[0] = 1.0; + H[1] = dx[0]*cutinv; + H[2] = dx[1]*cutinv; + H[3] = dx[2]*cutinv; + } + // dWij[] = dWx dWy (dWz) + //compute derivative operators + for (a = 0; a < dim; a++) { + dW[a] = 0.0; + for (b = 0; b < Mdim; b++) { + //First derivative kernels + dW[a] += C[i][1+a][b]*H[b]; // C columns: 1 x y (z) + } + dW[a] *= w; + } +} + + +/* ---------------------------------------------------------------------- */ + +void ComputeRHEOKernel::calc_dw_crk2(int i, int j, double delx, double dely, double delz, double r, double *dW) +{ + int a, b; + double w, dx[3], H[Mdim]; + dx[0] = delx; + dx[1] = dely; + dx[2] = delz; + + w = calc_w_quintic(i,j,delx,dely,delz,r); + + //Populate correction basis + if (dim == 2) { + H[0] = 1.0; + H[1] = dx[0]*cutinv; + H[2] = dx[1]*cutinv; + H[3] = 0.5*dx[0]*dx[0]*cutinv*cutinv; + H[4] = 0.5*dx[1]*dx[1]*cutinv*cutinv; + H[5] = dx[0]*dx[1]*cutinv*cutinv; + } else { + H[0] = 1.0; + H[1] = dx[0]*cutinv; + H[2] = dx[1]*cutinv; + H[3] = dx[2]*cutinv; + H[4] = 0.5*dx[0]*dx[0]*cutinv*cutinv; + H[5] = 0.5*dx[1]*dx[1]*cutinv*cutinv; + H[6] = 0.5*dx[2]*dx[2]*cutinv*cutinv; + H[7] = dx[0]*dx[1]*cutinv*cutinv; + H[8] = dx[0]*dx[2]*cutinv*cutinv; + H[9] = dx[1]*dx[2]*cutinv*cutinv; + } + + // dWij[] = dWx dWy (dWz) + //compute derivative operators + for (a = 0; a < dim; a++) { + dW[a] = 0.0; + for (b = 0; b < Mdim; b++) { + //First derivative kernels + dW[a] += C[i][1+a][b]*H[b]; // C columns: 1 x y (z) xx yy (zz) + } + dW[a] *= w; + } +} + +/* ---------------------------------------------------------------------- */ + +void ComputeRHEOKernel::compute_peratom() +{ + gsl_error_flag = 0; + gsl_error_tags.clear(); + + int i, j, ii, jj, jnum, itype, jtype; + double xtmp, ytmp, ztmp, delx, dely, delz; + double r, rinv, rsq, imass, jmass; + double dx[3]; + double w, wp, s, vi, vj, M, vjw; + double vjdw[3] = {0}; + bool sflag; + + double **x = atom->x; + int *type = atom->type; + double *mass = atom->mass; + double *rho = atom->rho; + int *phase = atom->phase; + tagint *tag = atom->tag; + coordination = atom->ivector[index_coord]; + + int inum, *ilist, *jlist, *numneigh, **firstneigh; + inum = list->inum; + ilist = list->ilist; + numneigh = list->numneigh; + firstneigh = list->firstneigh; + + if (kernel_type == QUINTIC) { + + for (ii = 0; ii < inum; ii++) { + i = ilist[ii]; + xtmp = x[i][0]; + ytmp = x[i][1]; + ztmp = x[i][2]; // Will be ignored in 2D + + jlist = firstneigh[i]; + jnum = numneigh[i]; + itype = type[i]; + coordination[i] = 0; + + for (jj = 0; jj < jnum; jj++) { + j = jlist[jj]; + j &= NEIGHMASK; + + dx[0] = xtmp - x[j][0]; + dx[1] = ytmp - x[j][1]; + dx[2] = ztmp - x[j][2]; + + rsq = dx[0]*dx[0] + dx[1]*dx[1] + dx[2]*dx[2]; + r = sqrt(rsq); + rinv = 1/r; + + if (rsq < cutsq) { + coordination[i] += 1; + } + } + } + + comm->forward_comm_compute(this); + + } else if (kernel_type == CRK0) { + if (atom->nmax > nmax){ + nmax = atom->nmax; + memory->destroy(C0); + memory->create(C0, nmax, "rheo/kernel:C"); + } + + //The moment Matrix array has to be 1D to be compatible with gsl + // Solve linear system for each atom + for (ii = 0; ii < inum; ii++) { + i = ilist[ii]; + xtmp = x[i][0]; + ytmp = x[i][1]; + ztmp = x[i][2]; // Will be ignored in 2D + + jlist = firstneigh[i]; + jnum = numneigh[i]; + itype = type[i]; + + //Initialize M and H to zero: + M = 0; + + //variable for insufficient neighbors + coordination[i] = 0; + + for (jj = 0; jj < jnum; jj++) { + j = jlist[jj]; + j &= NEIGHMASK; + + dx[0] = xtmp - x[j][0]; + dx[1] = ytmp - x[j][1]; + dx[2] = ztmp - x[j][2]; + + rsq = dx[0]*dx[0] + dx[1]*dx[1] + dx[2]*dx[2]; + r = sqrt(rsq); + rinv = 1/r; + + if (rsq < cutsq) { + //Compute Wij + w = calc_w_quintic(i,j,dx[0],dx[1],dx[2],r); + if (phase[j] > FixRHEO::FLUID_MAX && solid_flag) + vj = mass[type[j]]/compute_solids->correct_rho(j,i); + else vj = mass[type[j]]/rho[j]; + coordination[i] += 1; // Increment contributing neighbor + + M += w*vj; + } + } + + if (coordination[i] < N2min) continue; + //Get inverse of 1x1 matrix + M = 1.0/M; + C0[i] = M; + } + + // communicate densities - maybe not needed for ghost atoms but just to be safe + // can remove in future once we determine they aren't necessary + comm->forward_comm_compute(this); + + } else if (correction_order > 0) { + + int i, j, ii, jj, jnum, itype, jtype; + int g, a, b, c, d, ib, ic, id, nperm; + double xtmp, ytmp, ztmp, delx, dely, delz; + double dx[3] = {0}; + + //Turn off GSL error handler so we can check and revert RK to Quintic + //when inssuficient neighbors + gsl_set_error_handler_off(); + + // Create Moment matrix M and polynomial basis vector H + //The moment Matrix array has to be 1D to be compatible with gsl + double H[Mdim], M[Mdim*Mdim]; + + if (atom->nmax > nmax){ + nmax = atom->nmax; + memory->destroy(C); + memory->create(C, nmax,ncor,Mdim, "rheo/kernel:C"); + } + + // Solve linear system for each atom + for (ii = 0; ii < inum; ii++) { + i = ilist[ii]; + xtmp = x[i][0]; + ytmp = x[i][1]; + ztmp = x[i][2]; // Will be ignored in 2D + + jlist = firstneigh[i]; + jnum = numneigh[i]; + itype = type[i]; + + //Initialize M and H to zero: + for (a = 0; a < Mdim; a++) { + for (b = a; b < Mdim; b++) { + //Just zero upper-triangle of M since it will be symmetric + M[a*Mdim+b] = 0; + } + } + //Zero moment + //variables for switching off RK caclulation if insufficient neighbors + sflag = 0; + coordination[i] = 0; + // Loop over neighbors to populate elements of L + //m0[i] = 0.0; + + //Self contribution + //w = calc_w_quintic(i,i,0.,0.,0.,0.); + //m0[i] += w; + //vi = 1/vw[i]; + + vi = mass[type[i]]/rho[i]; // Overwritten if i is solid + + for (jj = 0; jj < jnum; jj++) { + j = jlist[jj]; + j &= NEIGHMASK; + + dx[0] = xtmp - x[j][0]; + dx[1] = ytmp - x[j][1]; + dx[2] = ztmp - x[j][2]; + + rsq = dx[0]*dx[0] + dx[1]*dx[1] + dx[2]*dx[2]; + r = sqrt(rsq); + rinv = 1/r; + + if (rsq < cutsq) { + //Compute Wij + w = calc_w_quintic(i,j,dx[0],dx[1],dx[2],r); + //vj = 1/vw[j]; // + + if (phase[i] > FixRHEO::FLUID_MAX && solid_flag) + vi = mass[type[i]]/compute_solids->correct_rho(i,j); + + if (phase[j] > FixRHEO::FLUID_MAX && solid_flag) + vj = mass[type[j]]/compute_solids->correct_rho(j,i); + else vj = mass[type[j]]/rho[j]; + //m0[i] += w; + + //Populate the H-vector of polynomials (2D) + if (dim == 2) { + H[0] = 1.0; + H[1] = dx[0]*cutinv; + H[2] = dx[1]*cutinv; + if (kernel_type == CRK2) { + H[3] = 0.5*dx[0]*dx[0]*cutinv*cutinv; + H[4] = 0.5*dx[1]*dx[1]*cutinv*cutinv; + H[5] = dx[0]*dx[1]*cutinv*cutinv; + } + } else { + H[0] = 1.0; + H[1] = dx[0]*cutinv; + H[2] = dx[1]*cutinv; + H[3] = dx[2]*cutinv; + if (kernel_type == CRK2) { + H[4] = 0.5*dx[0]*dx[0]*cutinv*cutinv; + H[5] = 0.5*dx[1]*dx[1]*cutinv*cutinv; + H[6] = 0.5*dx[2]*dx[2]*cutinv*cutinv; + H[7] = dx[0]*dx[1]*cutinv*cutinv; + H[8] = dx[0]*dx[2]*cutinv*cutinv; + H[9] = dx[1]*dx[2]*cutinv*cutinv; + } + } + coordination[i] += 1; // Increment contributing neighbor + + //Populate the upper triangle of the + for (a = 0; a < Mdim; a++) { + for (b = a; b < Mdim; b++) { + M[a*Mdim+b] += H[a]*H[b]*w*vj; + } + } + } + } + //Now populate the lower triangle from the symmetric entries of M: + for (a = 0; a < Mdim; a++) { + for (b = a; b < Mdim; b++) { + M[b*Mdim+a] = M[a*Mdim+b]; + } + } + + if (coordination[i] < N2min) continue; + + //Use gsl to get Minv + //Since the polynomials are independent, M is symmetrix & positive-definite + //So we will use a Cholesky decomposition + gsl_matrix_view gM = gsl_matrix_view_array(M,Mdim,Mdim); + int status; + status = 0; + //gsl_linalg_cholesky_decomp1 -> gsl_linalg_cholesky_decomp + //So I don't have to update my gsl (me being lazy, can revert) + status = gsl_linalg_cholesky_decomp(&gM.matrix); //M is now the cholesky decomposition of M + // check if erro in inversion + if (status) { + //Revert to uncorrected SPH for this particle + gsl_error_flag = 1; + gsl_error_tags.insert(tag[i]); + + //check if not positive-definite + if (status != GSL_EDOM) + fprintf(stderr, "failed, gsl_errno=%d.n", status); + + continue; + } else { + gsl_linalg_cholesky_invert(&gM.matrix); //M is now M^-1 + } + + // Correction coefficients are just the columns of M^-1 multiplied by an appropriate coefficient + //Solve the linear system several times to get coefficientns + // M: 1 x y (z) x^2 y^2 (z^2) xy (xz) (yz) + //---------------------------------------------------------- + // 0 1 2 3 4 5 || 2D indexing + // 0 1 2 3 4 5 6 7 8 9 || 3D indexing + // W 1 . . . . . . . . . + // dWx . -1 . . . . . . . . + // dWy . . -1 . . . . . . . + // dWz . . . (-1) . . . . . . + // d2Wx . . . . 2 . . . . . + // d2Wy . . . . . 2 . . . . + // d2Wz . . . . . . (2) . . . + + //0 1 2 3 4 + //0 1 2 3 4 5 6 + + // Use coefficents to compute smoothed density + //Pack coefficients into C + for (a = 0; a < Mdim; a++) { + //W + C[i][0][a] = M[a*Mdim + 0]; // all rows of column 0 + for (b = 0; b < dim; b++) { + //First derivatives + C[i][1+b][a] = -M[a*Mdim + b+1]/cut; // columns 1-2 (2D) or 1-3 (3D) + //Second derivatives + if (kernel_type == CRK2) + C[i][1+dim+b][a] = M[a*Mdim + b+1+dim]/cutsq; // columns 3-4 (2D) or 4-6 (3D) + } + } + } + + // communicate densities - maybe not needed for ghost atoms but just to be safe + // can remove in future once we determine they aren't necessary + comm->forward_comm_compute(this); + } +} + +/* ---------------------------------------------------------------------- */ + +int ComputeRHEOKernel::pack_forward_comm(int n, int *list, double *buf, + int /*pbc_flag*/, int * /*pbc*/) +{ + int i,j,k,m,a,b; + coordination = atom->ivector[index_coord]; + m = 0; + if (correction_order > 0) { + for (i = 0; i < n; i++) { + j = list[i]; + for (a = 0; a < ncor; a++) { + for (b = 0; b < Mdim; b++) { + buf[m++] = C[j][a][b]; + } + } + buf[m++] = coordination[j]; + } + } else if (kernel_type == CRK0) { + for (i = 0; i < n; i++) { + j = list[i]; + buf[m++] = C0[j]; + buf[m++] = coordination[j]; + } + } else { + for (i = 0; i < n; i++) { + j = list[i]; + buf[m++] = coordination[j]; + } + } + return m; +} + +/* ---------------------------------------------------------------------- */ + +void ComputeRHEOKernel::unpack_forward_comm(int n, int first, double *buf) +{ + int i, k, m, last,a,b; + coordination = atom->ivector[index_coord]; + m = 0; + last = first + n; + if (correction_order > 0) { + for (i = first; i < last; i++) { + for (a = 0; a < ncor; a++) { + for (b = 0; b < Mdim; b++) { + C[i][a][b] = buf[m++]; + } + } + coordination[i] = buf[m++]; + } + } else if (kernel_type == CRK0) { + for (i = first; i < last; i++) { + C0[i] = buf[m++]; + coordination[i] = buf[m++]; + } + } else { + for (i = first; i < last; i++) { + coordination[i] = buf[m++]; + } + } +} diff --git a/src/RHEO/compute_rheo_kernel.h b/src/RHEO/compute_rheo_kernel.h new file mode 100644 index 0000000000..114f39e85e --- /dev/null +++ b/src/RHEO/compute_rheo_kernel.h @@ -0,0 +1,71 @@ +/* -*- 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 COMPUTE_CLASS +// clang-format off +ComputeStyle(rheo/kernel,ComputeRHEOKernel) +// clang-format on +#else + +#ifndef LMP_COMPUTE_RHEO_KERNEL_H +#define LMP_COMPUTE_RHEO_KERNEL_H + +#include "compute.h" + +namespace LAMMPS_NS { + +class ComputeRHEOKernel : public Compute { + public: + ComputeRHEOKernel(class LAMMPS *, int, char **); + ~ComputeRHEOKernel() override; + void init() override; + void init_list(int, class NeighList *) override; + void compute_peratom() override; + int pack_forward_comm(int, int *, double *, int, int *) override; + void unpack_forward_comm(int, int, double *) override; + double memory_usage() override; + double calc_w(int,int,double,double,double,double); + double calc_dw(int,int,double,double,double,double); + double calc_w_quintic(int,int,double,double,double,double); + double calc_dw_quintic(int,int,double,double,double,double,double *,double *); + + double dWij[3], dWji[3], Wij, Wji; + int correction_order; + + private: + int solid_flag; + int gsl_error_flag; + + int kernel_type, N2min, nmax, Mdim, ncor; + int nmax_old, index_coord; + double cut, cutsq, cutinv, h, ih, ihsq, pre_w, pre_wp; + double ***C; + double *C0; + + class NeighList *list; + class ComputeRHEOSolids *compute_solids; + class FixRHEO *fix_rheo; + + int check_corrections(int); + + double calc_w_crk0(int,int,double,double,double,double); + double calc_w_crk1(int,int,double,double,double,double); + double calc_w_crk2(int,int,double,double,double,double); + void calc_dw_crk1(int,int,double,double,double,double,double *); + void calc_dw_crk2(int,int,double,double,double,double,double *); +}; + +} // namespace LAMMPS_NS + +#endif +#endif diff --git a/src/RHEO/fix_rheo.cpp b/src/RHEO/fix_rheo.cpp index cccaa792ff..6d16bf2782 100644 --- a/src/RHEO/fix_rheo.cpp +++ b/src/RHEO/fix_rheo.cpp @@ -21,7 +21,6 @@ #include "compute_rheo_vshift.h" #include "domain.h" #include "error.h" -#include "fix_store_peratom.h" #include "force.h" #include "modify.h" #include "update.h" @@ -34,10 +33,7 @@ using namespace FixConst; FixRHEO::FixRHEO(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg), compute_grad(nullptr), compute_kernel(nullptr), - compute_interface(nullptr), compute_rhosum(nullptr), compute_vshift(nullptr), - fix_store_visc(nullptr), fix_store_pres(nullptr), fix_store_cond(nullptr), - fix_store_surf(nullptr), fix_store_fp(nullptr), surface(nullptr), conductivity(nullptr), - viscosity(nullptr), pressure(nullptr), f_pressure(nullptr) + compute_interface(nullptr), compute_rhosum(nullptr), compute_vshift(nullptr) { time_integrate = 1; @@ -112,12 +108,6 @@ FixRHEO::FixRHEO(LAMMPS *lmp, int narg, char **arg) : FixRHEO::~FixRHEO() { - if (fix_store_visc) modify->delete_fix("rheo_store_visc"); - if (fix_store_pres) modify->delete_fix("rheo_store_pres"); - if (fix_store_surf) modify->delete_fix("rheo_store_surf"); - if (fix_store_cond) modify->delete_fix("rheo_store_cond"); - if (fix_store_fp) modify->delete_fix("rheo_store_fp"); - if (compute_kernel) modify->delete_compute("rheo_kernel"); if (compute_grad) modify->delete_compute("rheo_grad"); if (compute_interface) modify->delete_compute("rheo_interface"); @@ -133,46 +123,26 @@ FixRHEO::~FixRHEO() void FixRHEO::post_constructor() { compute_kernel = dynamic_cast(modify->add_compute("rheo_kernel all rheo/kernel")); - - fix_store_visc = dynamic_cast(modify->add_fix("rheo_store_visc all STORE/PERATOM 0 1")) - fix_store_visc->disable = 1; - viscosity = fix_store_visc->vstore; - fix_store_pres = dynamic_cast(modify->add_fix("rheo_store_pres all STORE/PERATOM 0 1")) - pressure = fix_store_pres->vstore; - fix_store_pres->disable = 1; - + compute_kernel->fix_rheo = this; std::string cmd = "rheo_grad all rheo/grad velocity rho viscosity"; if (thermal_flag) cmd += "temperature"; compute_grad = dynamic_cast(modify->add_compute(cmd)); compute_grad->fix_rheo = this; - if (rhosum_flag) + if (rhosum_flag) { compute_rhosum = dynamic_cast(modify->add_compute("rheo_rhosum all rheo/rho/sum")); + compute_rhosum->fix_rheo = this; + } if (shift_flag) { compute_vshift = dynamic_cast(modify->add_compute("rheo_vshift all rheo/vshift")); compute_vshift->fix_rheo = this; } - if (surface_flag) { - fix_store_surf = dynamic_cast(modify->add_fix("rheo_store_surf all STORE/PERATOM 0 1")) - surface = fix_store_surf->vstore; - fix_store_surf->disable = 1; - } - - if (thermal_flag) { - fix_store_cond = dynamic_cast(modify->add_fix("rheo_store_cond all STORE/PERATOM 0 1")) - conductivity = fix_store_cond->vstore; - fix_store_cond->disable = 1; - } - if (interface_flag) { compute_interface = dynamic_cast(modify->add_compute(fmt::format("rheo_interface all rheo/interface"))); - - fix_store_fp = dynamic_cast(modify->add_fix("rheo_store_fp all STORE/PERATOM 0 3")) - f_pressure = fix_store_fp->astore; - fix_store_fp->disable = 1; + compute_interface->fix_rheo = this; } } diff --git a/src/RHEO/fix_rheo.h b/src/RHEO/fix_rheo.h index 3487dd7273..0132f32bcc 100644 --- a/src/RHEO/fix_rheo.h +++ b/src/RHEO/fix_rheo.h @@ -44,11 +44,6 @@ class FixRHEO : public Fix { int kernel_style; enum {QUINTIC, CRK0, CRK1, CRK2}; - // Non-persistent per-atom arrays - int *surface; - double *conductivity, *viscosity, *pressure; - double **f_pressure; - // Status variables enum { // Phase status @@ -83,12 +78,6 @@ class FixRHEO : public Fix { int interface_fix_defined; int surface_fix_defined; - class FixStorePeratom *fix_store_visc; - class FixStorePeratom *fix_store_pres; - class FixStorePeratom *fix_store_cond; - class FixStorePeratom *fix_store_surf; - class FixStorePeratom *fix_store_fp; - class ComputeRHEOGrad *compute_grad; class ComputeRHEOKernel *compute_kernel; class ComputeRHEOInterface *compute_interface; diff --git a/src/RHEO/fix_rheo_thermal.cpp b/src/RHEO/fix_rheo_thermal.cpp index 272daf9bd0..8b0c9e46de 100644 --- a/src/RHEO/fix_rheo_thermal.cpp +++ b/src/RHEO/fix_rheo_thermal.cpp @@ -32,8 +32,7 @@ enum {NONE, CONSTANT, TYPE}; /* ---------------------------------------------------------------------- */ FixRHEOThermal::FixRHEOThermal(LAMMPS *lmp, int narg, char **arg) : - Fix(lmp, narg, arg), Tc_type(nullptr), kappa_type(nullptr), cv_type(nullptr), - conductivity(nullptr) + Fix(lmp, narg, arg), Tc_type(nullptr), kappa_type(nullptr), cv_type(nullptr) { if (narg < 4) error->all(FLERR,"Illegal fix command"); From 98050c96cc132ad8c5e6b6d96cad193eaad22437 Mon Sep 17 00:00:00 2001 From: jtclemm Date: Sun, 26 Mar 2023 14:30:34 -0600 Subject: [PATCH 018/158] Cleaning up kernel compute --- src/RHEO/compute_rheo_kernel.cpp | 534 +++++++++++++------------------ src/RHEO/compute_rheo_kernel.h | 8 +- 2 files changed, 234 insertions(+), 308 deletions(-) diff --git a/src/RHEO/compute_rheo_kernel.cpp b/src/RHEO/compute_rheo_kernel.cpp index 116ac08745..62a4283977 100644 --- a/src/RHEO/compute_rheo_kernel.cpp +++ b/src/RHEO/compute_rheo_kernel.cpp @@ -15,7 +15,7 @@ #include "atom.h" #include "comm.h" -#include "compute_rheo_solids.h" +#include "compute_rheo_interface.h" #include "domain.h" #include "error.h" #include "fix_rheo.h" @@ -31,26 +31,32 @@ #include "utils.h" #include -#include #include #include #include #include using namespace LAMMPS_NS; +using namespace MathExtra; + enum {QUINTIC, CRK0, CRK1, CRK2}; #define DELTA 2000 +Todo: convert delx dely delz to an array +Should vshift be using kernel quintic? +Move away from h notation, use cut? + /* ---------------------------------------------------------------------- */ ComputeRHEOKernel::ComputeRHEOKernel(LAMMPS *lmp, int narg, char **arg) : Compute(lmp, narg, arg), - C(nullptr), C0(nullptr), compute_solids(nullptr); + C(nullptr), C0(nullptr), compute_interface(nullptr); { if (narg != 3) error->all(FLERR,"Illegal compute rheo/kernel command"); - comm_forward = 1; // For coordination + comm_forward = 1; // Always minimum for coordination solid_flag = 0; + dim = domain->dimension; } /* ---------------------------------------------------------------------- */ @@ -76,72 +82,67 @@ void ComputeRHEOKernel::init() if (fixes.size() == 0) error->all(FLERR, "Need to define fix rheo to use compute rheo/kernel"); fix_rheo = dynamic_cast(fixes[0]); - int icompute = modify->find_compute("rheo_solids"); + int icompute = modify->find_compute("rheo_interface"); if (icompute != -1) { - compute_solids = ((ComputeRHEOSolids *) modify->compute[icompute]); + compute_interface = ((ComputeRHEOInterface *) modify->compute[icompute]); solid_flag = 1; } + kernel_style = fix_rheo->kernel_style; + zmin = fix_rheo->zmin_kernel; + h = fix_rheo->h; + hsq = h * h; + hinv = 1.0 / h; + hsqinv = hinv * hinv; - N2min = utils::inumeric(FLERR,arg[4],false,lmp); - - cutsq = cut*cut; - cutinv = 1.0/cut; - h = cut/3.0; - ih = 1.0/h; - ihsq = ih*ih; - - kernel_type = QUINTIC; + if (kernel_style == FixRHEO::QUINTIC) { correction_order = -1; - } else if (strcmp(arg[3],"CRK0") == 0) { - kernel_type = CRK0; + } else if (kernel_style == FixRHEO::CRK0) { correction_order = 0; - } else if (strcmp(arg[3],"CRK1") == 0) { - kernel_type = CRK1; + } else if (kernel_style == FixRHEO::CRK1) { correction_order = 1; - } else if (strcmp(arg[3],"CRK2") == 0) { - kernel_type = CRK2; + } else if (kernel_style == FixRHEO::CRK2) { correction_order = 2; + } if (dim == 3) { - pre_w = 0.002652582384864922*ihsq*ih; - pre_wp = pre_w*ih; + pre_w = 0.002652582384864922 * 27.0 * ihsq * ih; + pre_wp = pre_w * 3.0 * ih; } else { - pre_w = 0.004661441847879780*ihsq; - pre_wp = pre_w*ih; + pre_w = 0.004661441847879780 * 9 * ihsq; + pre_wp = pre_w * 3.0 * ih; } - //Use property atom, can fix store save integers? - char **fixarg = new char*[4]; - fixarg[0] = (char *) "PROPERTY_ATOM_RHEO_KERNEL"; - fixarg[1] = (char *) "all"; - fixarg[2] = (char *) "property/atom"; - fixarg[3] = (char *) "i_coordination"; - modify->add_fix(4,fixarg,1); + // Create coordination array if it doesn't already exist + // Create a custom atom property so it works with compute property/atom + // Do not create grow callback as there's no reason to copy/exchange data + // Manually grow if nmax_old exceeded + int tmp1, tmp2; + int nmax = atom->nmax; + index_coord = atom->find_custom("rheo_coordination", tmp1, tmp2); + if (index_coord == -1) { + index_coord = atom->add_custom("rheo_coordination", 0, 0); + nmax_old = nmax; + } - nmax = atom->nmax; - + comm_forward = 1; + ncor = 0; + Mdim = 0; if (kernel_type == CRK0) { memory->create(C0, nmax, "rheo/kernel:C0"); - comm_forward = 1; - } - - if (kernel_type == CRK1) { + } else if (kernel_type == CRK1) { Mdim = 1 + dim; ncor = 1 + dim; memory->create(C, nmax, ncor, Mdim, "rheo/kernel:C"); - comm_forward = ncor*Mdim; - } - - if (kernel_type == CRK2) { + comm_forward = ncor * Mdim; + } else if (kernel_type == CRK2) { //Polynomial basis size (up to quadratic order) - Mdim = 1 + dim + dim*(dim+1)/2; + Mdim = 1 + dim + dim * (dim + 1) / 2; //Number of sets of correction coefficients (1 x y xx yy) + z zz (3D) - ncor = 1 + 2*dim; - //variables that require forwarding + ncor = 1 + 2 * dim; memory->create(C, nmax, ncor, Mdim, "rheo/kernel:C"); - comm_forward = ncor*Mdim; + comm_forward = ncor * Mdim; } } @@ -164,8 +165,8 @@ int ComputeRHEOKernel::check_corrections(int i) corrections = 0; } - coordination = atom->ivector[index_coord]; - if (coordination[i] < N2min) corrections = 0; + int *coordination = atom->ivector[index_coord]; + if (coordination[i] < zmin) corrections = 0; return corrections; } @@ -180,37 +181,10 @@ double ComputeRHEOKernel::calc_w(int i, int j, double delx, double dely, double int corrections_j = check_corrections(j); int corrections = corrections_i & corrections_j; - if (memory_flag) { - long long key; - int v_index; - tagint tag1 = atom->tag[i]; - tagint tag2 = atom->tag[j]; - - // Use Szudzik's pairing function to define unique index for two tags - // szudzik.com/elegantpairing.pdf - if (tag1 > tag2) key = (long long) tag1*tag1 + tag2; - else key = (long long) tag2*tag2 + tag1; - - if (locations_w.find(key) != locations_w.end()){ - v_index = locations_w[key]; - w = stored_w[v_index]; - } else { - if (kernel_type == QUINTIC || !corrections) w = calc_w_quintic(i,j,delx,dely,delz,r); - else if (kernel_type == CRK0) w = calc_w_crk0(i,j,delx,dely,delz,r); - else if (kernel_type == CRK1) w = calc_w_crk1(i,j,delx,dely,delz,r); - else if (kernel_type == CRK2) w = calc_w_crk2(i,j,delx,dely,delz,r); - - locations_w[key] = nstored_w; - stored_w[nstored_w] = w; - nstored_w ++; - if (nstored_w >= max_nstored) grow_memory(); - } - } else { - if (kernel_type == QUINTIC || !corrections) w = calc_w_quintic(i,j,delx,dely,delz,r); - else if (kernel_type == CRK0) w = calc_w_crk0(i,j,delx,dely,delz,r); - else if (kernel_type == CRK1) w = calc_w_crk1(i,j,delx,dely,delz,r); - else if (kernel_type == CRK2) w = calc_w_crk2(i,j,delx,dely,delz,r); - } + if (kernel_type == QUINTIC || !corrections) w = calc_w_quintic(i,j,delx,dely,delz,r); + else if (kernel_type == CRK0) w = calc_w_crk0(i,j,delx,dely,delz,r); + else if (kernel_type == CRK1) w = calc_w_crk1(i,j,delx,dely,delz,r); + else if (kernel_type == CRK2) w = calc_w_crk2(i,j,delx,dely,delz,r); return w; } @@ -243,26 +217,26 @@ double ComputeRHEOKernel::calc_dw(int i, int j, double delx, double dely, double double ComputeRHEOKernel::calc_w_quintic(int i, int j, double delx, double dely, double delz, double r) { double w, tmp1, tmp2, tmp3, tmp1sq, tmp2sq, tmp3sq, s; - s = r*ih; + s = r * 3.0 * ih; - if (s>3.0) { + if (s > 3.0) { w = 0.0; } if (s <= 3.0) { - tmp3 = 3 - s; - tmp3sq = tmp3*tmp3; - w = tmp3sq*tmp3sq*tmp3; + tmp3 = 3.0 - s; + tmp3sq = tmp3 * tmp3; + w = tmp3sq * tmp3sq * tmp3; } if (s <= 2.0) { - tmp2 = 2 - s; - tmp2sq = tmp2*tmp2; - w -= 6*tmp2sq*tmp2sq*tmp2; + tmp2 = 2.0 - s; + tmp2sq = tmp2 * tmp2; + w -= 6.0 * tmp2sq * tmp2sq * tmp2; } if (s <= 1.0) { - tmp1 = 1 - s; - tmp1sq = tmp1*tmp1; - w += 15*tmp1sq*tmp1sq*tmp1; + tmp1 = 1.0 - s; + tmp1sq = tmp1 * tmp1; + w += 15.0 * tmp1sq * tmp1sq * tmp1; } w *= pre_w; @@ -281,36 +255,36 @@ double ComputeRHEOKernel::calc_dw_quintic(int i, int j, double delx, double dely double *mass = atom->mass; int *type = atom->type; - s = r*ih; + s = r * 3.0 * ih; - if (s>3.0) { + if (s > 3.0) { wp = 0.0; } if (s <= 3.0) { - tmp3 = 3 - s; - tmp3sq = tmp3*tmp3; - wp = -5.0*tmp3sq*tmp3sq; + tmp3 = 3.0 - s; + tmp3sq = tmp3 * tmp3; + wp = -5.0 * tmp3sq * tmp3sq; } if (s <= 2.0) { - tmp2 = 2 - s; - tmp2sq = tmp2*tmp2; - wp += 30.0*tmp2sq*tmp2sq; + tmp2 = 2.0 - s; + tmp2sq = tmp2 * tmp2; + wp += 30.0 * tmp2sq * tmp2sq; } if (s <= 1.0) { - tmp1 = 1 - s; - tmp1sq = tmp1*tmp1; - wp -= 75.0*tmp1sq*tmp1sq; + tmp1 = 1.0 - s; + tmp1sq = tmp1 * tmp1; + wp -= 75.0 * tmp1sq * tmp1sq; } wp *= pre_wp; - wprinv = wp/r; - dW1[0] = delx*wprinv; - dW1[1] = dely*wprinv; - dW1[2] = delz*wprinv; + wprinv = wp / r; + dW1[0] = delx * wprinv; + dW1[1] = dely * wprinv; + dW1[2] = delz * wprinv; - dW2[0] = -delx*wprinv; - dW2[1] = -dely*wprinv; - dW2[2] = -delz*wprinv; + dW2[0] = -delx * wprinv; + dW2[1] = -dely * wprinv; + dW2[2] = -delz * wprinv; return wp; } @@ -324,8 +298,8 @@ double ComputeRHEOKernel::calc_w_crk0(int i, int j, double delx, double dely, do w = calc_w_quintic(i,j,delx,dely,delz,r); - Wij = C0[i]*w; - Wji = C0[j]*w; + Wij = C0[i] * w; + Wji = C0[j] * w; return w; } @@ -344,17 +318,17 @@ double ComputeRHEOKernel::calc_w_crk1(int i, int j, double delx, double dely, do if (dim == 2) { H[0] = 1.0; - H[1] = dx[0]*cutinv; - H[2] = dx[1]*cutinv; + H[1] = dx[0] * hinv; + H[2] = dx[1] * hinv; } else { H[0] = 1.0; - H[1] = dx[0]*cutinv; - H[2] = dx[1]*cutinv; - H[3] = dx[2]*cutinv; + H[1] = dx[0] * hinv; + H[2] = dx[1] * hinv; + H[3] = dx[2] * hinv; } Wij = 0; for (b = 0; b < Mdim; b++) { - Wij += C[i][0][b]*H[b]; // C columns: 1 x y (z) xx yy (zz) + Wij += C[i][0][b] * H[b]; // C columns: 1 x y (z) xx yy (zz) } Wij *= w; @@ -365,7 +339,7 @@ double ComputeRHEOKernel::calc_w_crk1(int i, int j, double delx, double dely, do Wji = 0; for (b = 0; b < Mdim; b++) { - Wji += C[j][0][b]*H[b]; // C columns: 1 x y (z) xx yy (zz) + Wji += C[j][0][b] * H[b]; // C columns: 1 x y (z) xx yy (zz) } Wji *= w; @@ -383,29 +357,28 @@ double ComputeRHEOKernel::calc_w_crk2(int i, int j, double delx, double dely, do dx[2] = delz; w = calc_w_quintic(i,j,delx,dely,delz,r); - if (dim == 2) { H[0] = 1.0; - H[1] = dx[0]*cutinv; - H[2] = dx[1]*cutinv; - H[3] = 0.5*dx[0]*dx[0]*cutinv*cutinv; - H[4] = 0.5*dx[1]*dx[1]*cutinv*cutinv; - H[5] = dx[0]*dx[1]*cutinv*cutinv; + H[1] = dx[0] * hinv; + H[2] = dx[1] * hinv; + H[3] = 0.5 * dx[0] * dx[0] * hsqinv; + H[4] = 0.5 * dx[1] * dx[1] * hsqinv; + H[5] = dx[0] * dx[1] * hsqinv; } else { H[0] = 1.0; - H[1] = dx[0]*cutinv; - H[2] = dx[1]*cutinv; - H[3] = dx[2]*cutinv; - H[4] = 0.5*dx[0]*dx[0]*cutinv*cutinv; - H[5] = 0.5*dx[1]*dx[1]*cutinv*cutinv; - H[6] = 0.5*dx[2]*dx[2]*cutinv*cutinv; - H[7] = dx[0]*dx[1]*cutinv*cutinv; - H[8] = dx[0]*dx[2]*cutinv*cutinv; - H[9] = dx[1]*dx[2]*cutinv*cutinv; + H[1] = dx[0] * hinv; + H[2] = dx[1] * hinv; + H[3] = dx[2] * hinv; + H[4] = 0.5 * dx[0] * dx[0] * hsqinv; + H[5] = 0.5 * dx[1] * dx[1] * hsqinv; + H[6] = 0.5 * dx[2] * dx[2] * hsqinv; + H[7] = dx[0] * dx[1] * hsqinv; + H[8] = dx[0] * dx[2] * hsqinv; + H[9] = dx[1] * dx[2] * hsqinv; } Wij = 0; for (b = 0; b < Mdim; b++) { - Wij += C[i][0][b]*H[b]; // C columns: 1 x y (z) xx yy (zz) + Wij += C[i][0][b] * H[b]; // C columns: 1 x y (z) xx yy (zz) } Wij *= w; @@ -416,7 +389,7 @@ double ComputeRHEOKernel::calc_w_crk2(int i, int j, double delx, double dely, do Wji = 0; for (b = 0; b < Mdim; b++) { - Wji += C[j][0][b]*H[b]; // C columns: 1 x y (z) xx yy (zz) + Wji += C[j][0][b] * H[b]; // C columns: 1 x y (z) xx yy (zz) } Wji *= w; @@ -434,24 +407,26 @@ void ComputeRHEOKernel::calc_dw_crk1(int i, int j, double delx, double dely, dou dx[2] = delz; w = calc_w_quintic(i,j,delx,dely,delz,r); + //Populate correction basis if (dim == 2) { H[0] = 1.0; - H[1] = dx[0]*cutinv; - H[2] = dx[1]*cutinv; + H[1] = dx[0] * hinv; + H[2] = dx[1] * hinv; } else { H[0] = 1.0; - H[1] = dx[0]*cutinv; - H[2] = dx[1]*cutinv; - H[3] = dx[2]*cutinv; + H[1] = dx[0] * hinv; + H[2] = dx[1] * hinv; + H[3] = dx[2] * hinv; } + // dWij[] = dWx dWy (dWz) //compute derivative operators for (a = 0; a < dim; a++) { dW[a] = 0.0; for (b = 0; b < Mdim; b++) { //First derivative kernels - dW[a] += C[i][1+a][b]*H[b]; // C columns: 1 x y (z) + dW[a] += C[i][1 + a][b] * H[b]; // C columns: 1 x y (z) } dW[a] *= w; } @@ -473,22 +448,22 @@ void ComputeRHEOKernel::calc_dw_crk2(int i, int j, double delx, double dely, dou //Populate correction basis if (dim == 2) { H[0] = 1.0; - H[1] = dx[0]*cutinv; - H[2] = dx[1]*cutinv; - H[3] = 0.5*dx[0]*dx[0]*cutinv*cutinv; - H[4] = 0.5*dx[1]*dx[1]*cutinv*cutinv; - H[5] = dx[0]*dx[1]*cutinv*cutinv; + H[1] = dx[0] * hinv; + H[2] = dx[1] * hinv; + H[3] = 0.5 * dx[0] * dx[0] * hsqinv; + H[4] = 0.5 * dx[1] * dx[1] * hsqinv; + H[5] = dx[0] * dx[1] * hsqinv; } else { H[0] = 1.0; - H[1] = dx[0]*cutinv; - H[2] = dx[1]*cutinv; - H[3] = dx[2]*cutinv; - H[4] = 0.5*dx[0]*dx[0]*cutinv*cutinv; - H[5] = 0.5*dx[1]*dx[1]*cutinv*cutinv; - H[6] = 0.5*dx[2]*dx[2]*cutinv*cutinv; - H[7] = dx[0]*dx[1]*cutinv*cutinv; - H[8] = dx[0]*dx[2]*cutinv*cutinv; - H[9] = dx[1]*dx[2]*cutinv*cutinv; + H[1] = dx[0] * hinv; + H[2] = dx[1] * hinv; + H[3] = dx[2] * hinv; + H[4] = 0.5 * dx[0] * dx[0] * hsqinv; + H[5] = 0.5 * dx[1] * dx[1] * hsqinv; + H[6] = 0.5 * dx[2] * dx[2] * hsqinv; + H[7] = dx[0] * dx[1] * hsqinv; + H[8] = dx[0] * dx[2] * hsqinv; + H[9] = dx[1] * dx[2] * hsqinv; } // dWij[] = dWx dWy (dWz) @@ -497,7 +472,7 @@ void ComputeRHEOKernel::calc_dw_crk2(int i, int j, double delx, double dely, dou dW[a] = 0.0; for (b = 0; b < Mdim; b++) { //First derivative kernels - dW[a] += C[i][1+a][b]*H[b]; // C columns: 1 x y (z) xx yy (zz) + dW[a] += C[i][1 + a][b] * H[b]; // C columns: 1 x y (z) xx yy (zz) } dW[a] *= w; } @@ -510,21 +485,21 @@ void ComputeRHEOKernel::compute_peratom() gsl_error_flag = 0; gsl_error_tags.clear(); - int i, j, ii, jj, jnum, itype, jtype; - double xtmp, ytmp, ztmp, delx, dely, delz; - double r, rinv, rsq, imass, jmass; + int i, j, ii, jj, jnum, g, a, b, gsl_error; + double xtmp, ytmp, ztmp, r, rsq, w, vj; double dx[3]; - double w, wp, s, vi, vj, M, vjw; - double vjdw[3] = {0}; - bool sflag; + gsl_matrix_view gM; + + // Turn off GSL error handler, revert RK to Quintic when insufficient neighbors + gsl_set_error_handler_off(); double **x = atom->x; int *type = atom->type; double *mass = atom->mass; double *rho = atom->rho; - int *phase = atom->phase; + int *status = atom->status; + int *coordination = atom->ivector[index_coord]; tagint *tag = atom->tag; - coordination = atom->ivector[index_coord]; int inum, *ilist, *jlist, *numneigh, **firstneigh; inum = list->inum; @@ -532,17 +507,29 @@ void ComputeRHEOKernel::compute_peratom() numneigh = list->numneigh; firstneigh = list->firstneigh; - if (kernel_type == QUINTIC) { + // Grow arrays if necessary + int nmax = atom->nmax; + if (nmax_old < nmax) + memory->grow(coordination, nmax, "atom:rheo_coordination"); + if (kernel_type == FixRHEO::CRK0) { + memory->grow(C0, nmax, "rheo/kernel:C0"); + } else if (correction_order > 0) { + memory->grow(C, nmax, ncor, Mdim, "rheo/kernel:C"); + } + + nmax_old = atom->nmax; + } + + if (kernel_type == FixRHEO::QUINTIC) { for (ii = 0; ii < inum; ii++) { i = ilist[ii]; xtmp = x[i][0]; ytmp = x[i][1]; - ztmp = x[i][2]; // Will be ignored in 2D + ztmp = x[i][2]; jlist = firstneigh[i]; jnum = numneigh[i]; - itype = type[i]; coordination[i] = 0; for (jj = 0; jj < jnum; jj++) { @@ -552,42 +539,28 @@ void ComputeRHEOKernel::compute_peratom() dx[0] = xtmp - x[j][0]; dx[1] = ytmp - x[j][1]; dx[2] = ztmp - x[j][2]; + rsq = lensq(dx); - rsq = dx[0]*dx[0] + dx[1]*dx[1] + dx[2]*dx[2]; - r = sqrt(rsq); - rinv = 1/r; - - if (rsq < cutsq) { + if (rsq < hsq) { coordination[i] += 1; } } } + } else if (kernel_type == FixRHEO::CRK0) { - comm->forward_comm_compute(this); + double M; - } else if (kernel_type == CRK0) { - if (atom->nmax > nmax){ - nmax = atom->nmax; - memory->destroy(C0); - memory->create(C0, nmax, "rheo/kernel:C"); - } - - //The moment Matrix array has to be 1D to be compatible with gsl - // Solve linear system for each atom for (ii = 0; ii < inum; ii++) { i = ilist[ii]; xtmp = x[i][0]; ytmp = x[i][1]; - ztmp = x[i][2]; // Will be ignored in 2D + ztmp = x[i][2]; jlist = firstneigh[i]; jnum = numneigh[i]; - itype = type[i]; - //Initialize M and H to zero: + //Initialize M to zero: M = 0; - - //variable for insufficient neighbors coordination[i] = 0; for (jj = 0; jj < jnum; jj++) { @@ -597,85 +570,45 @@ void ComputeRHEOKernel::compute_peratom() dx[0] = xtmp - x[j][0]; dx[1] = ytmp - x[j][1]; dx[2] = ztmp - x[j][2]; + rsq = lensq(dx); - rsq = dx[0]*dx[0] + dx[1]*dx[1] + dx[2]*dx[2]; - r = sqrt(rsq); - rinv = 1/r; - - if (rsq < cutsq) { - //Compute Wij + if (rsq < hsq) { + r = sqrt(rsq); w = calc_w_quintic(i,j,dx[0],dx[1],dx[2],r); - if (phase[j] > FixRHEO::FLUID_MAX && solid_flag) - vj = mass[type[j]]/compute_solids->correct_rho(j,i); - else vj = mass[type[j]]/rho[j]; - coordination[i] += 1; // Increment contributing neighbor + if (!(status[j] & FixRHEO::STATUS_FLUID) && solid_flag) { + vj = mass[type[j]] / compute_interface->correct_rho(j,i); + } else vj = mass[type[j]] / rho[j]; - M += w*vj; + coordination[i] += 1; + M += w * vj; } } - if (coordination[i] < N2min) continue; - //Get inverse of 1x1 matrix - M = 1.0/M; - C0[i] = M; + // Inverse of 1x1 matrix + if (coordination[i] >= zmin) C0[i] = 1.0 / M; } - - // communicate densities - maybe not needed for ghost atoms but just to be safe - // can remove in future once we determine they aren't necessary - comm->forward_comm_compute(this); - } else if (correction_order > 0) { - int i, j, ii, jj, jnum, itype, jtype; - int g, a, b, c, d, ib, ic, id, nperm; - double xtmp, ytmp, ztmp, delx, dely, delz; - double dx[3] = {0}; + // Moment matrix M and polynomial basis vector H (1d for gsl compatibility) + double H[Mdim], M[Mdim * Mdim]; - //Turn off GSL error handler so we can check and revert RK to Quintic - //when inssuficient neighbors - gsl_set_error_handler_off(); - - // Create Moment matrix M and polynomial basis vector H - //The moment Matrix array has to be 1D to be compatible with gsl - double H[Mdim], M[Mdim*Mdim]; - - if (atom->nmax > nmax){ - nmax = atom->nmax; - memory->destroy(C); - memory->create(C, nmax,ncor,Mdim, "rheo/kernel:C"); - } - - // Solve linear system for each atom for (ii = 0; ii < inum; ii++) { i = ilist[ii]; xtmp = x[i][0]; ytmp = x[i][1]; - ztmp = x[i][2]; // Will be ignored in 2D + ztmp = x[i][2]; jlist = firstneigh[i]; jnum = numneigh[i]; itype = type[i]; - //Initialize M and H to zero: + // Zero upper-triangle M and H (will be symmetric): for (a = 0; a < Mdim; a++) { for (b = a; b < Mdim; b++) { - //Just zero upper-triangle of M since it will be symmetric - M[a*Mdim+b] = 0; + M[a * Mdim + b] = 0; } } - //Zero moment - //variables for switching off RK caclulation if insufficient neighbors - sflag = 0; coordination[i] = 0; - // Loop over neighbors to populate elements of L - //m0[i] = 0.0; - - //Self contribution - //w = calc_w_quintic(i,i,0.,0.,0.,0.); - //m0[i] += w; - //vi = 1/vw[i]; - - vi = mass[type[i]]/rho[i]; // Overwritten if i is solid for (jj = 0; jj < jnum; jj++) { j = jlist[jj]; @@ -685,94 +618,85 @@ void ComputeRHEOKernel::compute_peratom() dx[1] = ytmp - x[j][1]; dx[2] = ztmp - x[j][2]; - rsq = dx[0]*dx[0] + dx[1]*dx[1] + dx[2]*dx[2]; - r = sqrt(rsq); - rinv = 1/r; + rsq = lensq(dx); if (rsq < cutsq) { - //Compute Wij + r = sqrt(rsq); w = calc_w_quintic(i,j,dx[0],dx[1],dx[2],r); - //vj = 1/vw[j]; // - if (phase[i] > FixRHEO::FLUID_MAX && solid_flag) - vi = mass[type[i]]/compute_solids->correct_rho(i,j); - - if (phase[j] > FixRHEO::FLUID_MAX && solid_flag) - vj = mass[type[j]]/compute_solids->correct_rho(j,i); + if (status[j] > FixRHEO::FLUID_MAX && solid_flag) + vj = mass[type[j]]/compute_interface->correct_rho(j,i); else vj = mass[type[j]]/rho[j]; - //m0[i] += w; //Populate the H-vector of polynomials (2D) if (dim == 2) { H[0] = 1.0; - H[1] = dx[0]*cutinv; - H[2] = dx[1]*cutinv; - if (kernel_type == CRK2) { - H[3] = 0.5*dx[0]*dx[0]*cutinv*cutinv; - H[4] = 0.5*dx[1]*dx[1]*cutinv*cutinv; - H[5] = dx[0]*dx[1]*cutinv*cutinv; + H[1] = dx[0] * hinv; + H[2] = dx[1] * hinv; + if (kernel_type == FixRHEO::CRK2) { + H[3] = 0.5 * dx[0] * dx[0] * hsqinv; + H[4] = 0.5 * dx[1] * dx[1] * hsqinv; + H[5] = dx[0] * dx[1] * hsqinv; } } else { H[0] = 1.0; - H[1] = dx[0]*cutinv; - H[2] = dx[1]*cutinv; - H[3] = dx[2]*cutinv; - if (kernel_type == CRK2) { - H[4] = 0.5*dx[0]*dx[0]*cutinv*cutinv; - H[5] = 0.5*dx[1]*dx[1]*cutinv*cutinv; - H[6] = 0.5*dx[2]*dx[2]*cutinv*cutinv; - H[7] = dx[0]*dx[1]*cutinv*cutinv; - H[8] = dx[0]*dx[2]*cutinv*cutinv; - H[9] = dx[1]*dx[2]*cutinv*cutinv; + H[1] = dx[0] * hinv; + H[2] = dx[1] * hinv; + H[3] = dx[2] * hinv; + if (kernel_type == FixRHEO::CRK2) { + H[4] = 0.5 * dx[0] * dx[0] * hsqinv; + H[5] = 0.5 * dx[1] * dx[1] * hsqinv; + H[6] = 0.5 * dx[2] * dx[2] * hsqinv; + H[7] = dx[0] * dx[1] * hsqinv; + H[8] = dx[0] * dx[2] * hsqinv; + H[9] = dx[1] * dx[2] * hsqinv; } } - coordination[i] += 1; // Increment contributing neighbor - //Populate the upper triangle of the + coordination[i] += 1; + + // Populate the upper triangle for (a = 0; a < Mdim; a++) { for (b = a; b < Mdim; b++) { - M[a*Mdim+b] += H[a]*H[b]*w*vj; + M[a * Mdim + b] += H[a] * H[b] * w * vj; } } } } - //Now populate the lower triangle from the symmetric entries of M: + + // Populate the lower triangle from the symmetric entries of M: for (a = 0; a < Mdim; a++) { for (b = a; b < Mdim; b++) { - M[b*Mdim+a] = M[a*Mdim+b]; + M[b * Mdim + a] = M[a * Mdim + b]; } } - if (coordination[i] < N2min) continue; + // Skip if undercoordinated + if (coordination[i] < zmin) continue - //Use gsl to get Minv - //Since the polynomials are independent, M is symmetrix & positive-definite - //So we will use a Cholesky decomposition - gsl_matrix_view gM = gsl_matrix_view_array(M,Mdim,Mdim); - int status; - status = 0; - //gsl_linalg_cholesky_decomp1 -> gsl_linalg_cholesky_decomp - //So I don't have to update my gsl (me being lazy, can revert) - status = gsl_linalg_cholesky_decomp(&gM.matrix); //M is now the cholesky decomposition of M - // check if erro in inversion - if (status) { + // Use gsl to get Minv, use Cholesky decomposition since the + // polynomials are independent, M is symmetrix & positive-definite + gM = gsl_matrix_view_array(M,Mdim,Mdim); + gsl_error = gsl_linalg_cholesky_decomp(&gM.matrix); + + if (gsl_error) { //Revert to uncorrected SPH for this particle gsl_error_flag = 1; gsl_error_tags.insert(tag[i]); //check if not positive-definite - if (status != GSL_EDOM) - fprintf(stderr, "failed, gsl_errno=%d.n", status); + if (gsl_error != GSL_EDOM) + error->warn(FLERR, "Failed decomposition in rheo/kernel, gsl_error = {}", gsl_error); continue; - } else { - gsl_linalg_cholesky_invert(&gM.matrix); //M is now M^-1 } - // Correction coefficients are just the columns of M^-1 multiplied by an appropriate coefficient - //Solve the linear system several times to get coefficientns + gsl_linalg_cholesky_invert(&gM.matrix); //M is now M^-1 + + // Correction coefficients are columns of M^-1 multiplied by an appropriate coefficient + // Solve the linear system several times to get coefficientns // M: 1 x y (z) x^2 y^2 (z^2) xy (xz) (yz) - //---------------------------------------------------------- + // ---------------------------------------------------------- // 0 1 2 3 4 5 || 2D indexing // 0 1 2 3 4 5 6 7 8 9 || 3D indexing // W 1 . . . . . . . . . @@ -786,25 +710,25 @@ void ComputeRHEOKernel::compute_peratom() //0 1 2 3 4 //0 1 2 3 4 5 6 - // Use coefficents to compute smoothed density - //Pack coefficients into C + // Pack coefficients into C for (a = 0; a < Mdim; a++) { - //W - C[i][0][a] = M[a*Mdim + 0]; // all rows of column 0 + C[i][0][a] = M[a * Mdim + 0]; // all rows of column 0 for (b = 0; b < dim; b++) { //First derivatives - C[i][1+b][a] = -M[a*Mdim + b+1]/cut; // columns 1-2 (2D) or 1-3 (3D) + C[i][1 + b][a] = -M[a * Mdim + b + 1] * hinv; + // columns 1-2 (2D) or 1-3 (3D) + //Second derivatives - if (kernel_type == CRK2) - C[i][1+dim+b][a] = M[a*Mdim + b+1+dim]/cutsq; // columns 3-4 (2D) or 4-6 (3D) + if (kernel_type == FixRHEO::CRK2) + C[i][1 + dim + b][a] = M[a * Mdim + b + 1 + dim] * hsqinv; + // columns 3-4 (2D) or 4-6 (3D) } } } - - // communicate densities - maybe not needed for ghost atoms but just to be safe - // can remove in future once we determine they aren't necessary - comm->forward_comm_compute(this); } + + // communicate calculated quantities + comm->forward_comm_compute(this); } /* ---------------------------------------------------------------------- */ @@ -825,7 +749,7 @@ int ComputeRHEOKernel::pack_forward_comm(int n, int *list, double *buf, } buf[m++] = coordination[j]; } - } else if (kernel_type == CRK0) { + } else if (kernel_type == FixRHEO::CRK0) { for (i = 0; i < n; i++) { j = list[i]; buf[m++] = C0[j]; @@ -857,7 +781,7 @@ void ComputeRHEOKernel::unpack_forward_comm(int n, int first, double *buf) } coordination[i] = buf[m++]; } - } else if (kernel_type == CRK0) { + } else if (kernel_type == FixRHEO::CRK0) { for (i = first; i < last; i++) { C0[i] = buf[m++]; coordination[i] = buf[m++]; diff --git a/src/RHEO/compute_rheo_kernel.h b/src/RHEO/compute_rheo_kernel.h index 114f39e85e..346df5a20c 100644 --- a/src/RHEO/compute_rheo_kernel.h +++ b/src/RHEO/compute_rheo_kernel.h @@ -21,6 +21,7 @@ ComputeStyle(rheo/kernel,ComputeRHEOKernel) #define LMP_COMPUTE_RHEO_KERNEL_H #include "compute.h" +#include namespace LAMMPS_NS { @@ -45,15 +46,16 @@ class ComputeRHEOKernel : public Compute { private: int solid_flag; int gsl_error_flag; + std::unordered_set gsl_error_tags; - int kernel_type, N2min, nmax, Mdim, ncor; + int kernel_style, zmin, dim, Mdim, ncor; int nmax_old, index_coord; - double cut, cutsq, cutinv, h, ih, ihsq, pre_w, pre_wp; + double h, hsq, hinv, hsqinv, pre_w, pre_wp; double ***C; double *C0; class NeighList *list; - class ComputeRHEOSolids *compute_solids; + class ComputeRHEOInterface *compute_interface; class FixRHEO *fix_rheo; int check_corrections(int); From bfb3457b9e1dfab7fedd6e4c328318914f38302b Mon Sep 17 00:00:00 2001 From: jtclemm Date: Sun, 26 Mar 2023 14:44:01 -0600 Subject: [PATCH 019/158] Adding memory usage --- src/RHEO/compute_rheo_kernel.cpp | 15 +++++++++++++++ src/RHEO/fix_rheo_pressure.cpp | 11 ++++++++++- src/RHEO/fix_rheo_pressure.h | 1 + src/RHEO/fix_rheo_thermal.cpp | 9 +++++++++ src/RHEO/fix_rheo_thermal.h | 1 + src/RHEO/fix_rheo_viscosity.cpp | 9 +++++++++ src/RHEO/fix_rheo_viscosity.h | 1 + 7 files changed, 46 insertions(+), 1 deletion(-) diff --git a/src/RHEO/compute_rheo_kernel.cpp b/src/RHEO/compute_rheo_kernel.cpp index 62a4283977..a3f7ed3da5 100644 --- a/src/RHEO/compute_rheo_kernel.cpp +++ b/src/RHEO/compute_rheo_kernel.cpp @@ -792,3 +792,18 @@ void ComputeRHEOKernel::unpack_forward_comm(int n, int first, double *buf) } } } + +/* ---------------------------------------------------------------------- */ + +double ComputeRHEOKernel::memory_usage() +{ + double bytes = 0.0; + bytes = (size_t) atom->nmax * sizeof(int); + + if (kernel_type == FixRHEO::CRK0) { + bytes += (size_t) atom->nmax * sizeof(double); + } else if (correction_order > 0) { + bytes += (size_t) atom->nmax * ncor * Mdim * sizeof(double); + } + return bytes; +} diff --git a/src/RHEO/fix_rheo_pressure.cpp b/src/RHEO/fix_rheo_pressure.cpp index e4c1c44163..0a92e10767 100644 --- a/src/RHEO/fix_rheo_pressure.cpp +++ b/src/RHEO/fix_rheo_pressure.cpp @@ -203,4 +203,13 @@ double FixRHEOPressure::calculate_p(double rho) p = csq * rho0 * inv7 * (rr3 * rr3 * rho_ratio - 1.0); } return rho; -} \ No newline at end of file +} + +/* ---------------------------------------------------------------------- */ + +double FixRHEOPressure::memory_usage() +{ + double bytes = 0.0; + bytes += (size_t) atom->nmax * sizeof(double); + return bytes; +} diff --git a/src/RHEO/fix_rheo_pressure.h b/src/RHEO/fix_rheo_pressure.h index 6c7ee73370..8272cc38f5 100644 --- a/src/RHEO/fix_rheo_pressure.h +++ b/src/RHEO/fix_rheo_pressure.h @@ -34,6 +34,7 @@ class FixRHEOPressure : public Fix { void pre_force(int) override; int pack_forward_comm(int, int *, double *, int, int *) override; void unpack_forward_comm(int, int, double *) override; + double memory_usage() override; double calculate_p(double); private: double c_cubic, csq, rho0, rho0inv; diff --git a/src/RHEO/fix_rheo_thermal.cpp b/src/RHEO/fix_rheo_thermal.cpp index 8b0c9e46de..c8171f9beb 100644 --- a/src/RHEO/fix_rheo_thermal.cpp +++ b/src/RHEO/fix_rheo_thermal.cpp @@ -432,3 +432,12 @@ void FixRHEOThermal::unpack_reverse_comm(int n, int *list, double *buf) for (int i = 0; i < n; i++) heatflow[list[i]] += buf[m++]; } + +/* ---------------------------------------------------------------------- */ + +double FixRHEOThermal::memory_usage() +{ + double bytes = 0.0; + bytes += (size_t) atom->nmax * sizeof(double); + return bytes; +} diff --git a/src/RHEO/fix_rheo_thermal.h b/src/RHEO/fix_rheo_thermal.h index d9a17ebd60..3b62e86fa8 100644 --- a/src/RHEO/fix_rheo_thermal.h +++ b/src/RHEO/fix_rheo_thermal.h @@ -41,6 +41,7 @@ class FixRHEOThermal : public Fix { void unpack_forward_comm(int, int, double *) override; int pack_reverse_comm(int, int, double *) override; void unpack_reverse_comm(int, int *, double *) override; + double memory_usage() override; private: double *cv_type, cv; diff --git a/src/RHEO/fix_rheo_viscosity.cpp b/src/RHEO/fix_rheo_viscosity.cpp index 2b63c7633b..d81a1e9b4f 100644 --- a/src/RHEO/fix_rheo_viscosity.cpp +++ b/src/RHEO/fix_rheo_viscosity.cpp @@ -250,3 +250,12 @@ void FixRHEOViscosity::unpack_forward_comm(int n, int first, double *buf) viscosity[i] = buf[m++]; } } + +/* ---------------------------------------------------------------------- */ + +double FixRHEOViscosity::memory_usage() +{ + double bytes = 0.0; + bytes += (size_t) atom->nmax * sizeof(double); + return bytes; +} diff --git a/src/RHEO/fix_rheo_viscosity.h b/src/RHEO/fix_rheo_viscosity.h index d531507a72..407170f668 100644 --- a/src/RHEO/fix_rheo_viscosity.h +++ b/src/RHEO/fix_rheo_viscosity.h @@ -35,6 +35,7 @@ class FixRHEOViscosity : public Fix { void pre_force(int) override; int pack_forward_comm(int, int *, double *, int, int *) override; void unpack_forward_comm(int, int, double *) override; + double memory_usage() override; private: double *eta_type, eta; From 79ddd1445f051fdc7c78bb03123855a94bef2ad9 Mon Sep 17 00:00:00 2001 From: jtclemm Date: Sun, 26 Mar 2023 17:04:56 -0600 Subject: [PATCH 020/158] Misc clean ups, initial draft of interface --- src/RHEO/atom_vec_rheo.cpp | 5 + src/RHEO/compute_rheo_grad.cpp | 27 +- src/RHEO/compute_rheo_grad.h | 1 + src/RHEO/compute_rheo_interface.cpp | 432 ++++++++++++++++++++++++++++ src/RHEO/compute_rheo_interface.h | 61 ++++ src/RHEO/compute_rheo_kernel.cpp | 29 +- src/RHEO/compute_rheo_vshift.cpp | 95 +++--- src/RHEO/compute_rheo_vshift.h | 7 +- src/RHEO/fix_rheo.cpp | 9 +- src/RHEO/fix_rheo_pressure.cpp | 11 +- src/RHEO/fix_rheo_thermal.cpp | 11 +- src/RHEO/fix_rheo_viscosity.cpp | 11 +- src/RHEO/pair_rheo.cpp | 5 + 13 files changed, 634 insertions(+), 70 deletions(-) create mode 100644 src/RHEO/compute_rheo_interface.cpp create mode 100644 src/RHEO/compute_rheo_interface.h diff --git a/src/RHEO/atom_vec_rheo.cpp b/src/RHEO/atom_vec_rheo.cpp index 9effad685c..a8496a18e9 100644 --- a/src/RHEO/atom_vec_rheo.cpp +++ b/src/RHEO/atom_vec_rheo.cpp @@ -11,6 +11,11 @@ See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ +/* ---------------------------------------------------------------------- + Contributing authors: + Joel Clemmer (SNL), Thomas O'Connor (CMU), Eric Palermo (CMU) +----------------------------------------------------------------------- */ + #include "atom_vec_rheo.h" #include "atom.h" diff --git a/src/RHEO/compute_rheo_grad.cpp b/src/RHEO/compute_rheo_grad.cpp index ce351048be..03e76b194a 100644 --- a/src/RHEO/compute_rheo_grad.cpp +++ b/src/RHEO/compute_rheo_grad.cpp @@ -11,6 +11,11 @@ See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ +/* ---------------------------------------------------------------------- + Contributing authors: + Joel Clemmer (SNL), Thomas O'Connor (CMU), Eric Palermo (CMU) +----------------------------------------------------------------------- */ + #include "compute_rheo_grad.h" #include "atom.h" @@ -457,4 +462,24 @@ void ComputeRHEOGrad::grow_arrays(int nmax) if (eta_flag) memory->grow(gradn, nmax, dim, "atom:rheo_grad_eta"); nmax_old = nmax; -} \ No newline at end of file +} + +/* ---------------------------------------------------------------------- */ + +double ComputeRHEOKernel::memory_usage() +{ + double bytes = 0.0; + if (velocity_flag) + bytes = (size_t) nmax_old * dim * dim * sizeof(double); + + if (rho_flag) + bytes = (size_t) nmax_old * dim * sizeof(double); + + if (temperature_flag) + bytes = (size_t) nmax_old * dim * sizeof(double); + + if (eta_flag) + bytes = (size_t) nmax_old * dim * sizeof(double); + + return bytes; +} diff --git a/src/RHEO/compute_rheo_grad.h b/src/RHEO/compute_rheo_grad.h index 220b5813e3..d86efe47ee 100644 --- a/src/RHEO/compute_rheo_grad.h +++ b/src/RHEO/compute_rheo_grad.h @@ -35,6 +35,7 @@ class ComputeRHEOGrad : public Compute { void unpack_forward_comm(int, int, double *) override; int pack_reverse_comm(int, int, double *) override; void unpack_reverse_comm(int, int *, double *) override; + double memory_usage() override; void forward_gradients(); void forward_fields(); double **gradv; diff --git a/src/RHEO/compute_rheo_interface.cpp b/src/RHEO/compute_rheo_interface.cpp new file mode 100644 index 0000000000..e76e46d422 --- /dev/null +++ b/src/RHEO/compute_rheo_interface.cpp @@ -0,0 +1,432 @@ +/* ---------------------------------------------------------------------- + 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 authors: + Joel Clemmer (SNL), Thomas O'Connor (CMU), Eric Palermo (CMU) +----------------------------------------------------------------------- */ + +#include "compute_rheo_interface.h" + +#include "fix_rheo.h" +#include "compute_rheo_kernel.h" +#include "fix_store.h" +#include "fix.h" +#include +#include +#include "atom.h" +#include "update.h" +#include "modify.h" +#include "domain.h" +#include "neighbor.h" +#include "neigh_list.h" +#include "neigh_request.h" +#include "force.h" +#include "pair.h" +#include "comm.h" +#include "memory.h" +#include "error.h" + +using namespace LAMMPS_NS; + +#define EPSILON 1e-1 + +/* ---------------------------------------------------------------------- */ + +ComputeRHEOInterface::ComputeRHEOInterface(LAMMPS *lmp, int narg, char **arg) : + Compute(lmp, narg, arg), + id_fix_chi(nullptr) +{ + if (narg != 4) error->all(FLERR,"Illegal compute RHEO/chi command"); + + cut = utils::numeric(FLERR,arg[3],false,lmp); + cutsq = cut*cut; + + wall_max = sqrt(3)/12.0*cut; + + nmax = 0; + + comm_forward = 3; + comm_reverse = 4; + + fix_chi = nullptr; + norm = nullptr; + normwf = nullptr; + + // new id = fix-ID + FIX_STORE_ATTRIBUTE + // new fix group = group for this fix + + id_fix_chi = nullptr; + std::string fixcmd = id + std::string("_chi"); + id_fix_chi = new char[fixcmd.size()+1]; + strcpy(id_fix_chi,fixcmd.c_str()); + fixcmd += fmt::format(" all STORE peratom 0 {}", 1); + modify->add_fix(fixcmd); + fix_chi = (FixStore *) modify->fix[modify->nfix-1]; + chi = fix_chi->vstore; +} + +/* ---------------------------------------------------------------------- */ + +ComputeRHEOInterface::~ComputeRHEOInterface() +{ + if (id_fix_chi && modify->nfix) modify->delete_fix(id_fix_chi); + if (modify->nfix) modify->delete_fix("PROPERTY_ATOM_COMP_RHEO_SOLIDS"); + + memory->destroy(norm); + memory->destroy(normwf); +} + +/* ---------------------------------------------------------------------- */ + +void ComputeRHEOInterface::init() +{ + // need an occasional full neighbor list + int irequest = neighbor->request(this,instance_me); + neighbor->requests[irequest]->pair = 0; + neighbor->requests[irequest]->compute = 1; + neighbor->requests[irequest]->half = 1; + neighbor->requests[irequest]->full = 0; + //neighbor->requests[irequest]->occasional = 1; //Anticipate needing regulalry + + int icompute = modify->find_compute("rheo_kernel"); + if (icompute == -1) error->all(FLERR, "Using compute/RHEO/chi without compute/RHEO/kernel"); + + compute_kernel = ((ComputeRHEOKernel *) modify->compute[icompute]); + + //Store persistent per atom quantities - need to be exchanged + char **fixarg = new char*[8]; + fixarg[0] = (char *) "PROPERTY_ATOM_COMP_RHEO_SOLIDS"; + fixarg[1] = (char *) "all"; + fixarg[2] = (char *) "property/atom"; + fixarg[3] = (char *) "d_fx"; + fixarg[4] = (char *) "d_fy"; + fixarg[5] = (char *) "d_fz"; + fixarg[6] = (char *) "ghost"; + fixarg[7] = (char *) "yes"; + modify->add_fix(8,fixarg,1); + delete [] fixarg; + + int temp_flag; + index_fx = atom->find_custom("fx", temp_flag); + if ((index_fx < 0) || (temp_flag != 1)) + error->all(FLERR, "Compute rheo/solids can't find fix property/atom fx"); + index_fy = atom->find_custom("fy", temp_flag); + if ((index_fy < 0) || (temp_flag != 1)) + error->all(FLERR, "Compute rheo/solids can't find fix property/atom fy"); + index_fz = atom->find_custom("fz", temp_flag); + if ((index_fz < 0) || (temp_flag != 1)) + error->all(FLERR, "Compute rheo/solids can't find fix property/atom fz"); +} + +/* ---------------------------------------------------------------------- */ + +void ComputeRHEOInterface::init_list(int /*id*/, NeighList *ptr) +{ + list = ptr; +} + +/* ---------------------------------------------------------------------- */ + +void ComputeRHEOInterface::compute_peratom() +{ + int i, j, ii, jj, jnum, itype, jtype, phase_match; + double xtmp, ytmp, ztmp, delx, dely, delz, rsq; + int *jlist; + double w; + + // neighbor list ariables + int inum, *ilist, *numneigh, **firstneigh; + int nlocal = atom->nlocal; + int nall = nlocal + atom->nghost; + + double **x = atom->x; + int *type = atom->type; + int newton = force->newton; + int *phase = atom->phase; + double *rho = atom->rho; + double *fx = atom->dvector[index_fx]; + double *fy = atom->dvector[index_fy]; + double *fz = atom->dvector[index_fz]; + double mi, mj; + + //Declare mass pointer to calculate acceleration from force + double *mass = atom->mass; + + cs2 = 1.0; + + inum = list->inum; + ilist = list->ilist; + numneigh = list->numneigh; + firstneigh = list->firstneigh; + + if (atom->nmax > nmax) { + nmax = atom->nmax; + fix_chi->grow_arrays(nmax); + chi = fix_chi->vstore; + memory->destroy(norm); + memory->destroy(normwf); + memory->create(norm, nmax, "RHEO/chi:norm"); + memory->create(normwf, nmax, "RHEO/chi:normwf"); + } + + for (i = 0; i < nall; i++) { + if (phase[i] > FixRHEO::FLUID_MAX) rho[i] = 0.0; + normwf[i] = 0.0; + norm[i] = 0.0; + chi[i] = 0.0; + } + + for (ii = 0; ii < inum; ii++) { + i = ilist[ii]; + xtmp = x[i][0]; + ytmp = x[i][1]; + ztmp = x[i][2]; + itype = type[i]; + jlist = firstneigh[i]; + jnum = numneigh[i]; + mi = mass[type[i]]; + + for (jj = 0; jj < jnum; jj++) { + j = jlist[jj]; + j &= NEIGHMASK; + + delx = xtmp - x[j][0]; + dely = ytmp - x[j][1]; + delz = ztmp - x[j][2]; + rsq = delx * delx + dely * dely + delz * delz; + + if (rsq < cutsq) { + jtype = type[j]; + mj = mass[type[j]]; + w = compute_kernel->calc_w_quintic(i, j, delx, dely, delz, sqrt(rsq)); + + phase_match = 0; + norm[i] += w; + if ((phase[i] <= FixRHEO::FLUID_MAX && phase[j] <= FixRHEO::FLUID_MAX) + || (phase[i] > FixRHEO::FLUID_MAX && phase[j] > FixRHEO::FLUID_MAX)) { + phase_match = 1; + } + + if (phase_match) { + chi[i] += w; + } else { + if (phase[i] > FixRHEO::FLUID_MAX) { + //speed of sound and rho0 assumed to = 1 (units in density not pressure) + //In general, rho is calculated using the force vector on the wall particle + //fx stores f-fp + rho[i] += w*(cs2*(rho[j] - 1.0) - rho[j]*((-fx[j]/mj+fx[i]/mi)*delx + (-fy[j]/mj+fy[i]/mi)*dely + (-fz[j]/mj+fz[i]/mi)*delz)); + //For the specific taste case whre force on wall particles = 0 + //rho[i] += w*(1.0*(rho[j] - 1.0) + rho[j]*(1e-3*delx)); + normwf[i] += w; + } + } + + if (newton || j < nlocal) { + norm[j] += w; + if (phase_match) { + chi[j] += w; + } else { + if (phase[j] > FixRHEO::FLUID_MAX) { + rho[j] += w*(cs2*(rho[i] - 1.0) + rho[i]*((-fx[i]/mi+fx[j]/mj)*delx + (-fy[i]/mi+fy[j]/mj)*dely + (-fz[i]/mi+fz[j]/mj)*delz)); + normwf[j] += w; + } + } + } + } + } + } + + if (newton) comm->reverse_comm_compute(this); + + for (i = 0; i < nlocal; i++) { + if (norm[i] != 0.0) chi[i] /= norm[i]; + if (normwf[i] != 0.0) { // Only if it's a wall particle + rho[i] = 1.0 + (rho[i] / normwf[i])/cs2; // Stores rho for solid particles 1+Pw in Adami Adams 2012 + if (rho[i] < EPSILON) rho[i] = EPSILON; + } + + if (normwf[i] == 0.0 && phase[i] > FixRHEO::FLUID_MAX) rho[i] = 1.0; + } + + comm_stage = 1; + comm_forward = 2; + comm->forward_comm_compute(this); +} + +/* ---------------------------------------------------------------------- */ + +int ComputeRHEOInterface::pack_forward_comm(int n, int *list, double *buf, + int /*pbc_flag*/, int * /*pbc*/) +{ + int i,j,k,m; + m = 0; + double *rho = atom->rho; + double *fx = atom->dvector[index_fx]; + double *fy = atom->dvector[index_fy]; + double *fz = atom->dvector[index_fz]; + + for (i = 0; i < n; i++) { + j = list[i]; + if (comm_stage == 0) { + buf[m++] = fx[j]; + buf[m++] = fy[j]; + buf[m++] = fz[j]; + } else { + buf[m++] = chi[j]; + buf[m++] = rho[j]; + } + } + return m; +} + +/* ---------------------------------------------------------------------- */ + +void ComputeRHEOInterface::unpack_forward_comm(int n, int first, double *buf) +{ + int i, k, m, last; + double *rho = atom->rho; + double *fx = atom->dvector[index_fx]; + double *fy = atom->dvector[index_fy]; + double *fz = atom->dvector[index_fz]; + + m = 0; + last = first + n; + for (i = first; i < last; i++) { + if (comm_stage == 0) { + fx[i] = buf[m++]; + fy[i] = buf[m++]; + fz[i] = buf[m++]; + } else { + chi[i] = buf[m++]; + rho[i] = buf[m++]; // Won't do anything for fluids + } + } +} + +/* ---------------------------------------------------------------------- */ + +int ComputeRHEOInterface::pack_reverse_comm(int n, int first, double *buf) +{ + int i,k,m,last; + double *rho = atom->rho; + + m = 0; + last = first + n; + for (i = first; i < last; i++) { + buf[m++] = norm[i]; + buf[m++] = chi[i]; + buf[m++] = normwf[i]; + buf[m++] = rho[i]; + } + return m; +} + +/* ---------------------------------------------------------------------- */ + +void ComputeRHEOInterface::unpack_reverse_comm(int n, int *list, double *buf) +{ + int i,k,j,m; + double *rho = atom->rho; + int *phase = atom->phase; + m = 0; + for (i = 0; i < n; i++) { + j = list[i]; + norm[j] += buf[m++]; + chi[j] += buf[m++]; + if (phase[j] > FixRHEO::FLUID_MAX){ + normwf[j] += buf[m++]; + rho[j] += buf[m++]; + } else { + m++; + m++; + } + } +} + +/* ---------------------------------------------------------------------- */ + +void ComputeRHEOInterface::correct_v(double *vi, double *vj, double *vi_out, int i, int j) +{ + double wall_prefactor, wall_denom, wall_numer; + + wall_numer = 2.0*cut*(chi[i]-0.5); + if (wall_numer < 0) wall_numer = 0; + wall_denom = 2.0*cut*(chi[j]-0.5); + if (wall_denom < wall_max) wall_denom = wall_max; + + wall_prefactor = wall_numer / wall_denom; + + vi_out[0] = (vi[0]-vj[0])*wall_prefactor + vi[0]; + vi_out[1] = (vi[1]-vj[1])*wall_prefactor + vi[1]; + vi_out[2] = (vi[2]-vj[2])*wall_prefactor + vi[2]; +} + +/* ---------------------------------------------------------------------- */ + +double ComputeRHEOInterface::correct_rho(int i, int j) // i is wall, j is fluid +{ + //In future may depend on atom type j's pressure equation + return atom->rho[i]; +} + +/* ---------------------------------------------------------------------- */ + +void ComputeRHEOInterface::store_forces() +{ + double *fx = atom->dvector[index_fx]; + double *fy = atom->dvector[index_fy]; + double *fz = atom->dvector[index_fz]; + double **f = atom->f; + double **fp = atom->fp; + int *mask = atom->mask; + + int flag; + int ifix = modify->find_fix_by_style("setforce"); + if (ifix != -1) { + for (int i = 0; i < atom->nlocal; i++) { + if (mask[i] & modify->fix[ifix]->groupbit) { + fx[i] = f[i][0]; + fy[i] = f[i][1]; + fz[i] = f[i][2]; + } else { + fx[i] = f[i][0] - fp[i][0]; + fy[i] = f[i][1] - fp[i][1]; + fz[i] = f[i][2] - fp[i][2]; + } + } + } else { + for (int i = 0; i < atom->nlocal; i++) { + fx[i] = f[i][0] - fp[i][0]; + fy[i] = f[i][1] - fp[i][1]; + fz[i] = f[i][2] - fp[i][2]; + } + } + + //Forward comm forces -note only needed here b/c property atom will forward otherwise + comm_forward = 3; + comm_stage = 0; + comm->forward_comm_compute(this); +} + + +/* ---------------------------------------------------------------------- + memory usage of local atom-based array +------------------------------------------------------------------------- */ + +double ComputeRHEOInterface::memory_usage() +{ + double bytes = nmax * sizeof(double); + return bytes; +} + diff --git a/src/RHEO/compute_rheo_interface.h b/src/RHEO/compute_rheo_interface.h new file mode 100644 index 0000000000..635f190aed --- /dev/null +++ b/src/RHEO/compute_rheo_interface.h @@ -0,0 +1,61 @@ +/* -*- 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 COMPUTE_CLASS +// clang-format off +ComputeStyle(rheo/interface,ComputeRHEOInterface) +// clang-format on +#else + +#ifndef LMP_COMPUTE_RHEO_INTERFACE_H +#define LMP_COMPUTE_RHEO_INTERFACE_H + +#include "compute.h" + +namespace LAMMPS_NS { + +class ComputeRHEOInterface : public Compute { + public: + ComputeRHEOInterface(class LAMMPS *, int, char **); + ~ComputeRHEOInterface(); + void init(); + void init_list(int, class NeighList *); + void compute_peratom(); + int pack_forward_comm(int, int *, double *, int, int *); + void unpack_forward_comm(int, int, double *); + int pack_reverse_comm(int, int, double *); + void unpack_reverse_comm(int, int *, double *); + void correct_v(double *, double *, double *, int, int); + double correct_rho(int, int); + double memory_usage(); + void store_forces(); + double *chi; + + private: + int nmax; + double cut, cutsq, cs2; + class NeighList *list; + double *norm, *normwf, wall_max; + + class ComputeRHEOKernel *compute_kernel; + char *id_fix_chi; + class FixStore *fix_chi; + + int index_fx, index_fy, index_fz; + int comm_stage; +}; + +} + +#endif +#endif diff --git a/src/RHEO/compute_rheo_kernel.cpp b/src/RHEO/compute_rheo_kernel.cpp index a3f7ed3da5..15b5f9568b 100644 --- a/src/RHEO/compute_rheo_kernel.cpp +++ b/src/RHEO/compute_rheo_kernel.cpp @@ -1,15 +1,20 @@ /* ---------------------------------------------------------------------- - LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator - http://lammps.sandia.gov, Sandia National Laboratories - Steve Plimpton, sjplimp@sandia.gov + 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. + 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. -------------------------------------------------------------------------- */ + See the README file in the top-level LAMMPS directory. + ------------------------------------------------------------------------- */ + +/* ---------------------------------------------------------------------- + Contributing authors: + Joel Clemmer (SNL), Thomas O'Connor (CMU), Eric Palermo (CMU) +----------------------------------------------------------------------- */ #include "compute_rheo_kernel.h" @@ -798,12 +803,12 @@ void ComputeRHEOKernel::unpack_forward_comm(int n, int first, double *buf) double ComputeRHEOKernel::memory_usage() { double bytes = 0.0; - bytes = (size_t) atom->nmax * sizeof(int); + bytes = (size_t) nmax_old * sizeof(int); if (kernel_type == FixRHEO::CRK0) { - bytes += (size_t) atom->nmax * sizeof(double); + bytes += (size_t) nmax_old * sizeof(double); } else if (correction_order > 0) { - bytes += (size_t) atom->nmax * ncor * Mdim * sizeof(double); + bytes += (size_t) nmax_old * ncor * Mdim * sizeof(double); } return bytes; } diff --git a/src/RHEO/compute_rheo_vshift.cpp b/src/RHEO/compute_rheo_vshift.cpp index 42fa1e8c82..2b7c9394d3 100644 --- a/src/RHEO/compute_rheo_vshift.cpp +++ b/src/RHEO/compute_rheo_vshift.cpp @@ -1,35 +1,36 @@ /* ---------------------------------------------------------------------- - LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator - http://lammps.sandia.gov, Sandia National Laboratories - Steve Plimpton, sjplimp@sandia.gov + 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. + 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. -------------------------------------------------------------------------- */ + See the README file in the top-level LAMMPS directory. + ------------------------------------------------------------------------- */ + +/* ---------------------------------------------------------------------- + Contributing authors: + Joel Clemmer (SNL), Thomas O'Connor (CMU), Eric Palermo (CMU) +----------------------------------------------------------------------- */ #include "compute_rheo_vshift.h" -#include "fix_rheo.h" -#include "compute_rheo_solids.h" + +#include "atom.h" +#include "comm.h" +#include "compute_rheo_interface.h" #include "compute_rheo_grad.h" #include "compute_rheo_kernel.h" -#include "fix_rheo_surface.h" -#include -#include -#include "atom.h" -#include "modify.h" #include "domain.h" +#include "error.h" +#include "fix_rheo.h" +#include "force.h" +#include "memory.h" #include "neighbor.h" #include "neigh_list.h" #include "neigh_request.h" -#include "force.h" -#include "pair.h" -#include "comm.h" -#include "memory.h" -#include "error.h" using namespace LAMMPS_NS; @@ -44,18 +45,28 @@ ComputeRHEOVShift::ComputeRHEOVShift(LAMMPS *lmp, int narg, char **arg) : comm_reverse = 3; surface_flag = 0; - nmax = atom->nmax; - memory->create(vshift, nmax, 3, "rheo/vshift:vshift"); - array_atom = vshift; - peratom_flag = 1; - size_peratom_cols = 3; + // Create vshift array if it doesn't already exist + // Create a custom atom property so it works with compute property/atom + // Do not create grow callback as there's no reason to copy/exchange data + // Manually grow if nmax_old exceeded + + int tmp1, tmp2; + index_vshift = atom->find_custom("rheo_vshift", tmp1, tmp2); + if (index_vshift == -1) { + index_vshift = atom->add_custom("rheo_vshift", 1, 3); + nmax_old = atom->nmax; + } } /* ---------------------------------------------------------------------- */ ComputeRHEOVShift::~ComputeRHEOVShift() { - memory->destroy(vshift); + // Remove custom property if it exists + int tmp1, tmp2, index; + index = atom->find_custom("rheo_vshift", tmp1, tmp2); + if (index != -1) atom->remove_custom(index_vshift, 1, 3); + } /* ---------------------------------------------------------------------- */ @@ -65,10 +76,8 @@ void ComputeRHEOVShift::init() neighbor->add_request(this, NeighConst::REQ_DEFAULT); surface_flag = 0; - if (fix_rheo->surface_flag) { + if (fix_rheo->surface_flag) surface_flag = 1; - fix_rheo_surface = fix_rheo->fix_rheo_surface; - } compute_kernel = fix_rheo->compute_kernel; compute_grad = fix_rheo->compute_grad; @@ -110,6 +119,7 @@ void ComputeRHEOVShift::compute_peratom() int *surface = atom->surface; double *rho = atom->rho; double *mass = atom->mass; + double **vshift = atom->darray[index_vshift]; int newton_pair = force->newton_pair; inum = list->inum; @@ -117,12 +127,10 @@ void ComputeRHEOVShift::compute_peratom() numneigh = list->numneigh; firstneigh = list->firstneigh; - if (nall > nmax) { - nmax = nall; - memory->destroy(vshift); - memory->create(vshift, nmax, 3, "rheo/vshift:vshift"); - array_atom = vshift; - } + + if (nmax_old < atom->nmax) + memory->grow(vshift, atom->nmax, 3, "atom:rheo_vshift"); + nmax_old = atom->nmax; for (i = 0; i < nall; i++) for (a = 0; a < dim; a++) @@ -224,14 +232,17 @@ void ComputeRHEOVShift::correct_surfaces() int nlocal = atom->nlocal; int i, a, b; int dim = domain->dimension; - int *surface = atom->surface; + double **vshift = atom->darray[index_vshift]; + + int tmp1, tmp2; + int index_nsurf = atom->find_custom("rheo_nsurf", tmp1, tmp2); + if (index_nsurf == -1) error->all(FLERR, "Cannot find rheo nsurf"); + double **nsurf = atom->darray[index_nsurf]; - double **nsurf; - nsurf = fix_rheo_surface->n_surface; double nx,ny,nz,vx,vy,vz; for (i = 0; i < nlocal; i++) { if (mask[i] & groupbit) { - if (surface[i] == 1 || surface[i] == 2) { + if ((surface[i] & FixRHEO::STATUS_SURFACE) || (surface[i] & FixRHEO::STATUS_LAYER)) { nx = nsurf[i][0]; ny = nsurf[i][1]; vx = vshift[i][0]; @@ -257,6 +268,7 @@ void ComputeRHEOVShift::correct_surfaces() int ComputeRHEOVShift::pack_reverse_comm(int n, int first, double *buf) { int i,m,last; + double **vshift = atom->darray[index_vshift]; m = 0; last = first + n; @@ -273,6 +285,7 @@ int ComputeRHEOVShift::pack_reverse_comm(int n, int first, double *buf) void ComputeRHEOVShift::unpack_reverse_comm(int n, int *list, double *buf) { int i,j,m; + double **vshift = atom->darray[index_vshift]; m = 0; for (i = 0; i < n; i++) { @@ -289,6 +302,6 @@ void ComputeRHEOVShift::unpack_reverse_comm(int n, int *list, double *buf) double ComputeRHEOVShift::memory_usage() { - double bytes = 3 * nmax * sizeof(double); + double bytes = 3 * nmax_old * sizeof(double); return bytes; } diff --git a/src/RHEO/compute_rheo_vshift.h b/src/RHEO/compute_rheo_vshift.h index fceb287510..f93cced31c 100644 --- a/src/RHEO/compute_rheo_vshift.h +++ b/src/RHEO/compute_rheo_vshift.h @@ -37,15 +37,12 @@ class ComputeRHEOVShift : public Compute { void correct_surfaces(); private: - int nmax; + int nmax_old; double dtv, cut, cutsq, cutthird; - int surface_flag; - - double **vshift; + int surface_flag, index_vshift; class NeighList *list; class FixRHEO *fix_rheo; - class FixRHEOSurface *fix_rheo_surface; class ComputeRHEOInterface *compute_interface ; class ComputeRHEOKernel *compute_kernel; class ComputeRHEOGrad *compute_grad; diff --git a/src/RHEO/fix_rheo.cpp b/src/RHEO/fix_rheo.cpp index 6d16bf2782..25a97bd52a 100644 --- a/src/RHEO/fix_rheo.cpp +++ b/src/RHEO/fix_rheo.cpp @@ -1,7 +1,7 @@ /* ---------------------------------------------------------------------- LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator - http://lammps.sandia.gov, Sandia National Laboratories - Steve Plimpton, sjplimp@sandia.gov + 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 @@ -11,6 +11,11 @@ See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ +/* ---------------------------------------------------------------------- + Contributing authors: + Joel Clemmer (SNL), Thomas O'Connor (CMU), Eric Palermo (CMU) +----------------------------------------------------------------------- */ + #include "fix_rheo.h" #include "atom.h" diff --git a/src/RHEO/fix_rheo_pressure.cpp b/src/RHEO/fix_rheo_pressure.cpp index 0a92e10767..4fa4ece0f9 100644 --- a/src/RHEO/fix_rheo_pressure.cpp +++ b/src/RHEO/fix_rheo_pressure.cpp @@ -1,7 +1,7 @@ /* ---------------------------------------------------------------------- LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator - http://lammps.sandia.gov, Sandia National Laboratories - Steve Plimpton, sjplimp@sandia.gov + 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 @@ -11,6 +11,11 @@ See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ +/* ---------------------------------------------------------------------- + Contributing authors: + Joel Clemmer (SNL), Thomas O'Connor (CMU), Eric Palermo (CMU) +----------------------------------------------------------------------- */ + #include "fix_rheo_pressure.h" #include "atom.h" @@ -210,6 +215,6 @@ double FixRHEOPressure::calculate_p(double rho) double FixRHEOPressure::memory_usage() { double bytes = 0.0; - bytes += (size_t) atom->nmax * sizeof(double); + bytes += (size_t) nmax_old * sizeof(double); return bytes; } diff --git a/src/RHEO/fix_rheo_thermal.cpp b/src/RHEO/fix_rheo_thermal.cpp index c8171f9beb..3ef9fab853 100644 --- a/src/RHEO/fix_rheo_thermal.cpp +++ b/src/RHEO/fix_rheo_thermal.cpp @@ -1,7 +1,7 @@ /* ---------------------------------------------------------------------- LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator - http://lammps.sandia.gov, Sandia National Laboratories - Steve Plimpton, sjplimp@sandia.gov + 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 @@ -11,6 +11,11 @@ See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ +/* ---------------------------------------------------------------------- + Contributing authors: + Joel Clemmer (SNL), Thomas O'Connor (CMU), Eric Palermo (CMU) +----------------------------------------------------------------------- */ + #include "fix_rheo_thermal.h" #include "atom.h" @@ -438,6 +443,6 @@ void FixRHEOThermal::unpack_reverse_comm(int n, int *list, double *buf) double FixRHEOThermal::memory_usage() { double bytes = 0.0; - bytes += (size_t) atom->nmax * sizeof(double); + bytes += (size_t) nmax_old * sizeof(double); return bytes; } diff --git a/src/RHEO/fix_rheo_viscosity.cpp b/src/RHEO/fix_rheo_viscosity.cpp index d81a1e9b4f..3f779aa3c6 100644 --- a/src/RHEO/fix_rheo_viscosity.cpp +++ b/src/RHEO/fix_rheo_viscosity.cpp @@ -1,7 +1,7 @@ /* ---------------------------------------------------------------------- LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator - http://lammps.sandia.gov, Sandia National Laboratories - Steve Plimpton, sjplimp@sandia.gov + 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 @@ -11,6 +11,11 @@ See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ +/* ---------------------------------------------------------------------- + Contributing authors: + Joel Clemmer (SNL), Thomas O'Connor (CMU), Eric Palermo (CMU) +----------------------------------------------------------------------- */ + #include "fix_rheo_viscosity.h" #include "atom.h" @@ -256,6 +261,6 @@ void FixRHEOViscosity::unpack_forward_comm(int n, int first, double *buf) double FixRHEOViscosity::memory_usage() { double bytes = 0.0; - bytes += (size_t) atom->nmax * sizeof(double); + bytes += (size_t) nmax_old * sizeof(double); return bytes; } diff --git a/src/RHEO/pair_rheo.cpp b/src/RHEO/pair_rheo.cpp index 0fed0297b4..7d5d0f425f 100644 --- a/src/RHEO/pair_rheo.cpp +++ b/src/RHEO/pair_rheo.cpp @@ -11,6 +11,11 @@ See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ +/* ---------------------------------------------------------------------- + Contributing authors: + Joel Clemmer (SNL), Thomas O'Connor (CMU), Eric Palermo (CMU) +----------------------------------------------------------------------- */ + #include "pair_rheo.h" #include "atom.h" From 986cfd66414da8a9cf7cc4a09a19cf1f44a94dae Mon Sep 17 00:00:00 2001 From: jtclemm Date: Wed, 12 Apr 2023 17:05:05 -0600 Subject: [PATCH 021/158] Cleaning up peratom variables, adding peratom variables to fix rheo/interface --- src/RHEO/compute_rheo_grad.cpp | 72 +++++++++++------ src/RHEO/compute_rheo_grad.h | 2 - src/RHEO/compute_rheo_interface.cpp | 121 ++++++++++++---------------- src/RHEO/compute_rheo_interface.h | 39 +++++---- src/RHEO/compute_rheo_kernel.cpp | 16 ++-- src/RHEO/compute_rheo_kernel.h | 3 +- src/RHEO/compute_rheo_vshift.cpp | 21 ++--- src/RHEO/compute_rheo_vshift.h | 4 +- src/RHEO/fix_rheo.cpp | 5 +- src/RHEO/fix_rheo.h | 1 + src/RHEO/fix_rheo_pressure.cpp | 16 ++-- src/RHEO/fix_rheo_pressure.h | 3 +- src/RHEO/fix_rheo_thermal.cpp | 12 +-- src/RHEO/fix_rheo_thermal.h | 3 +- src/RHEO/fix_rheo_viscosity.cpp | 11 +-- src/RHEO/fix_rheo_viscosity.h | 3 +- src/RHEO/pair_rheo.cpp | 30 ++++--- src/RHEO/pair_rheo.h | 2 +- 18 files changed, 184 insertions(+), 180 deletions(-) diff --git a/src/RHEO/compute_rheo_grad.cpp b/src/RHEO/compute_rheo_grad.cpp index 03e76b194a..31f60550c1 100644 --- a/src/RHEO/compute_rheo_grad.cpp +++ b/src/RHEO/compute_rheo_grad.cpp @@ -38,7 +38,7 @@ enum{COMMGRAD, COMMFIELD}; /* ---------------------------------------------------------------------- */ ComputeRHEOGrad::ComputeRHEOGrad(LAMMPS *lmp, int narg, char **arg) : - Compute(lmp, narg, arg), compute_interface(nullptr), compute_kernel(nullptr), + Compute(lmp, narg, arg), fix_rheo(nullptr), compute_interface(nullptr), compute_kernel(nullptr), gradv(nullptr), gradr(nullptr), gradt(nullptr), gradn(nullptr) { if (narg < 4) error->all(FLERR,"Illegal compute rheo/grad command"); @@ -61,40 +61,26 @@ ComputeRHEOGrad::ComputeRHEOGrad(LAMMPS *lmp, int narg, char **arg) : ncomm_grad += dim * dim; ncomm_field += dim; comm_reverse += dim * dim; - indexv = atom->add_custom("rheo_grad_v", 1, dim * dim); - gradv = atom->darray[indexv]; } if (rho_flag) { ncomm_grad += dim; ncomm_field += 1; comm_reverse += dim; - indexr = atom->add_custom("rheo_grad_rho", 1, dim); - gradr = atom->darray[indexr]; } if (temperature_flag) { ncomm_grad += dim; ncomm_field += 1; comm_reverse += dim; - indext= atom->add_custom("rheo_grad_temp", 1, dim); - gradt = atom->darray[indext]; } if (eta_flag) { ncomm_grad += dim; comm_reverse += dim; - indexn = atom->add_custom("rheo_grad_eta", 1, dim); - gradn = atom->darray[indexn]; } - // Create a custom atom property so it works with compute property/atom - // Do not create grow callback as there's no reason to copy/exchange data - // Manually grow if nmax_old exceeded - comm_forward = ncomm_grad; - nmax_old = 0; - grow_arrays(atom->nmax); } /* ---------------------------------------------------------------------- */ @@ -102,14 +88,16 @@ ComputeRHEOGrad::ComputeRHEOGrad(LAMMPS *lmp, int narg, char **arg) : ComputeRHEOGrad::~ComputeRHEOGrad() { int dim = domain->dimension; - if (velocity_flag) - atom->remove_custom(indexv, 1, dim * dim); - if (rho_flag) - atom->remove_custom(indexr, 1, dim); - if (temperature_flag) - atom->remove_custom(indext, 1, dim); - if (eta_flag) - atom->remove_custom(indexn, 1, dim); + int tmp1, tmp2, index; + + index = atom->find_custom("rheo_grad_v", tmp1, tmp2); + if (index != 1) atom->remove_custom(index, 1, dim * dim); + index = atom->find_custom("rheo_grad_rho", tmp1, tmp2); + if (index != 1) atom->remove_custom(index, 1, dim); + index = atom->find_custom("rheo_grad_t", tmp1, tmp2); + if (index != 1) atom->remove_custom(index, 1, dim); + index = atom->find_custom("rheo_grad_eta", tmp1, tmp2); + if (index != 1) atom->remove_custom(index, 1, dim); } /* ---------------------------------------------------------------------- */ @@ -123,6 +111,36 @@ void ComputeRHEOGrad::init() rho0 = fix_rheo->rho0; compute_kernel = fix_rheo->compute_kernel; compute_interface = fix_rheo->compute_interface; + + // Create coordination array if it doesn't already exist + // Create a custom atom property so it works with compute property/atom + // Do not create grow callback as there's no reason to copy/exchange data + // Manually grow if nmax_old exceeded + + int index; + int dim = domain->dimension; + if (velocity_flag) { + index = atom->add_custom("rheo_grad_v", 1, dim * dim); + gradv = atom->darray[index]; + } + + if (rho_flag) { + index = atom->add_custom("rheo_grad_rho", 1, dim); + gradr = atom->darray[index]; + } + + if (temperature_flag) { + index= atom->add_custom("rheo_grad_temp", 1, dim); + gradt = atom->darray[index]; + } + + if (eta_flag) { + index = atom->add_custom("rheo_grad_eta", 1, dim); + gradn = atom->darray[index]; + } + + nmax_old = 0; + grow_arrays(atom->nmax); } /* ---------------------------------------------------------------------- */ @@ -151,13 +169,17 @@ void ComputeRHEOGrad::compute_peratom() double **v = atom->v; double *rho = atom->rho; double *temperature = atom->temperature; - double *eta = atom->viscosity; int *status = atom->status; int *type = atom->type; double *mass = atom->mass; int newton = force->newton; int dim = domain->dimension; + int tmp1, tmp2; + int index_visc = atom->find_custom("rheo_viscosity", tmp1, tmp2); + if (index_visc == -1) error->all(FLERR, "Cannot find rheo viscosity"); + double *viscosity = atom->dvector[index_visc]; + inum = list->inum; ilist = list->ilist; numneigh = list->numneigh; @@ -229,7 +251,7 @@ void ComputeRHEOGrad::compute_peratom() if (rho_flag) drho = rhoi - rhoj; if (temperature_flag) dT = temperature[i] - temperature[j]; - if (eta_flag) deta = eta[i] - eta[j]; + if (eta_flag) deta = viscosity[i] - viscosity[j]; wp = compute_kernel->calc_dw(i, j, delx, dely, delz, sqrt(rsq)); dWij = compute_kernel->dWij; diff --git a/src/RHEO/compute_rheo_grad.h b/src/RHEO/compute_rheo_grad.h index d86efe47ee..7804ee72dd 100644 --- a/src/RHEO/compute_rheo_grad.h +++ b/src/RHEO/compute_rheo_grad.h @@ -42,11 +42,9 @@ class ComputeRHEOGrad : public Compute { double **gradr; double **gradt; double **gradn; - int stage; private: int comm_stage, ncomm_grad, ncomm_field, nmax_old; - int indexv, indexr, indext, indexn; double cut, cutsq, rho0; class NeighList *list; diff --git a/src/RHEO/compute_rheo_interface.cpp b/src/RHEO/compute_rheo_interface.cpp index e76e46d422..ae1bc13831 100644 --- a/src/RHEO/compute_rheo_interface.cpp +++ b/src/RHEO/compute_rheo_interface.cpp @@ -18,24 +18,20 @@ #include "compute_rheo_interface.h" -#include "fix_rheo.h" -#include "compute_rheo_kernel.h" -#include "fix_store.h" -#include "fix.h" -#include -#include #include "atom.h" -#include "update.h" -#include "modify.h" +#include "comm.h" #include "domain.h" +#include "compute_rheo_kernel.h" +#include "error.h" +#include "force.h" +#include "fix_rheo.h" +#include "memory.h" +#include "modify.h" #include "neighbor.h" #include "neigh_list.h" #include "neigh_request.h" -#include "force.h" -#include "pair.h" -#include "comm.h" -#include "memory.h" -#include "error.h" + +#include using namespace LAMMPS_NS; @@ -44,45 +40,29 @@ using namespace LAMMPS_NS; /* ---------------------------------------------------------------------- */ ComputeRHEOInterface::ComputeRHEOInterface(LAMMPS *lmp, int narg, char **arg) : - Compute(lmp, narg, arg), - id_fix_chi(nullptr) + Compute(lmp, narg, arg), fix_rheo(nullptr), compute_kernel(nullptr), fx_m_norm(nullptr), + norm(nullptr), normwf(nullptr), chi(nullptr), f_pressure(nullptr), id_fix_pa(nullptr) { - if (narg != 4) error->all(FLERR,"Illegal compute RHEO/chi command"); - - cut = utils::numeric(FLERR,arg[3],false,lmp); - cutsq = cut*cut; - - wall_max = sqrt(3)/12.0*cut; + if (narg != 3) error->all(FLERR,"Illegal compute rheo/interface command"); nmax = 0; comm_forward = 3; comm_reverse = 4; - - fix_chi = nullptr; - norm = nullptr; - normwf = nullptr; - - // new id = fix-ID + FIX_STORE_ATTRIBUTE - // new fix group = group for this fix - - id_fix_chi = nullptr; - std::string fixcmd = id + std::string("_chi"); - id_fix_chi = new char[fixcmd.size()+1]; - strcpy(id_fix_chi,fixcmd.c_str()); - fixcmd += fmt::format(" all STORE peratom 0 {}", 1); - modify->add_fix(fixcmd); - fix_chi = (FixStore *) modify->fix[modify->nfix-1]; - chi = fix_chi->vstore; } /* ---------------------------------------------------------------------- */ ComputeRHEOInterface::~ComputeRHEOInterface() { - if (id_fix_chi && modify->nfix) modify->delete_fix(id_fix_chi); - if (modify->nfix) modify->delete_fix("PROPERTY_ATOM_COMP_RHEO_SOLIDS"); + // Remove custom property if it exists + int tmp1, tmp2, index; + index = atom->find_custom("rheo_chi", tmp1, tmp2); + if (index != -1) atom->remove_custom(index, 1, 0); + if (id_fix_pa && modify->nfix) modify->delete_fix(id_fix_pa); + + memory->destroy(fx_m_norm); memory->destroy(norm); memory->destroy(normwf); } @@ -91,42 +71,40 @@ ComputeRHEOInterface::~ComputeRHEOInterface() void ComputeRHEOInterface::init() { - // need an occasional full neighbor list - int irequest = neighbor->request(this,instance_me); - neighbor->requests[irequest]->pair = 0; - neighbor->requests[irequest]->compute = 1; - neighbor->requests[irequest]->half = 1; - neighbor->requests[irequest]->full = 0; - //neighbor->requests[irequest]->occasional = 1; //Anticipate needing regulalry + compute_kernel = fix_rheo->compute_kernel; + cut = fix_rheo->cut; + cutsq = cut * cut; + wall_max = sqrt(3.0) / 12.0 * cut; - int icompute = modify->find_compute("rheo_kernel"); - if (icompute == -1) error->all(FLERR, "Using compute/RHEO/chi without compute/RHEO/kernel"); + // Create chi array if it doesn't already exist + // Create a custom atom property so it works with compute property/atom + // Do not create grow callback as there's no reason to copy/exchange data + // Manually grow if nmax_old exceeded - compute_kernel = ((ComputeRHEOKernel *) modify->compute[icompute]); + int create_flag = 0; + int tmp1, tmp2; + int nmax = atom->nmax; + int index = atom->find_custom("rheo_chi", tmp1, tmp2); + if (index == -1) { + index = atom->add_custom("rheo_chi", 1, 0); + nmax_old = nmax; + } + chi = atom->dvector[index]; - //Store persistent per atom quantities - need to be exchanged - char **fixarg = new char*[8]; - fixarg[0] = (char *) "PROPERTY_ATOM_COMP_RHEO_SOLIDS"; - fixarg[1] = (char *) "all"; - fixarg[2] = (char *) "property/atom"; - fixarg[3] = (char *) "d_fx"; - fixarg[4] = (char *) "d_fy"; - fixarg[5] = (char *) "d_fz"; - fixarg[6] = (char *) "ghost"; - fixarg[7] = (char *) "yes"; - modify->add_fix(8,fixarg,1); - delete [] fixarg; + // For fpressure, go ahead and create an instance of fix property atom + // Need restarts + exchanging with neighbors since it needs to persist + // between timesteps (fix property atom will handle callbacks) - int temp_flag; - index_fx = atom->find_custom("fx", temp_flag); - if ((index_fx < 0) || (temp_flag != 1)) - error->all(FLERR, "Compute rheo/solids can't find fix property/atom fx"); - index_fy = atom->find_custom("fy", temp_flag); - if ((index_fy < 0) || (temp_flag != 1)) - error->all(FLERR, "Compute rheo/solids can't find fix property/atom fy"); - index_fz = atom->find_custom("fz", temp_flag); - if ((index_fz < 0) || (temp_flag != 1)) - error->all(FLERR, "Compute rheo/solids can't find fix property/atom fz"); + index = atom->find_custom("rheo_pressure", tmp1, tmp2); + if (index == -1) { + id_fix_pa = utils::strdup(id + std::string("_fix_property_atom")); + modify->add_fix(fmt::format("{} all property/atom d2_f_pressure 3", id_fix_pa))); + index = atom->find_custom("rheo_pressure", tmp1, tmp2); + } + f_pressure = atom->darray[index]; + + // need an occasional half neighbor list + neighbor->add_request(this, NeighConst::REQ_HALF); } /* ---------------------------------------------------------------------- */ @@ -138,6 +116,7 @@ void ComputeRHEOInterface::init_list(int /*id*/, NeighList *ptr) /* ---------------------------------------------------------------------- */ +// Left off here void ComputeRHEOInterface::compute_peratom() { int i, j, ii, jj, jnum, itype, jtype, phase_match; diff --git a/src/RHEO/compute_rheo_interface.h b/src/RHEO/compute_rheo_interface.h index 635f190aed..f314c16aa9 100644 --- a/src/RHEO/compute_rheo_interface.h +++ b/src/RHEO/compute_rheo_interface.h @@ -27,35 +27,34 @@ namespace LAMMPS_NS { class ComputeRHEOInterface : public Compute { public: ComputeRHEOInterface(class LAMMPS *, int, char **); - ~ComputeRHEOInterface(); - void init(); - void init_list(int, class NeighList *); - void compute_peratom(); - int pack_forward_comm(int, int *, double *, int, int *); - void unpack_forward_comm(int, int, double *); - int pack_reverse_comm(int, int, double *); - void unpack_reverse_comm(int, int *, double *); + ~ComputeRHEOInterface() override; + void init() override; + void init_list(int, class NeighList *) override; + void compute_peratom() override; + int pack_forward_comm(int, int *, double *, int, int *) override; + void unpack_forward_comm(int, int, double *) override; + int pack_reverse_comm(int, int, double *) override; + void unpack_reverse_comm(int, int *, double *) override; + double memory_usage() override; void correct_v(double *, double *, double *, int, int); double correct_rho(int, int); - double memory_usage(); void store_forces(); - double *chi; + + double *chi, **f_pressure; private: - int nmax; - double cut, cutsq, cs2; + int nmax_old, comm_stage; + double cut, cutsq, cs, wall_max; + double **fx_m_norm, *norm, *normwf; + + char *id_fix_pa; + class NeighList *list; - double *norm, *normwf, wall_max; - + class FixRHEO *fix_rheo; class ComputeRHEOKernel *compute_kernel; - char *id_fix_chi; - class FixStore *fix_chi; - - int index_fx, index_fy, index_fz; - int comm_stage; }; -} +} // namespace LAMMPS_NS #endif #endif diff --git a/src/RHEO/compute_rheo_kernel.cpp b/src/RHEO/compute_rheo_kernel.cpp index 15b5f9568b..ac9ea75fc4 100644 --- a/src/RHEO/compute_rheo_kernel.cpp +++ b/src/RHEO/compute_rheo_kernel.cpp @@ -55,7 +55,7 @@ Move away from h notation, use cut? ComputeRHEOKernel::ComputeRHEOKernel(LAMMPS *lmp, int narg, char **arg) : Compute(lmp, narg, arg), - C(nullptr), C0(nullptr), compute_interface(nullptr); + C(nullptr), C0(nullptr), coordination(nullptr), compute_interface(nullptr) { if (narg != 3) error->all(FLERR,"Illegal compute rheo/kernel command"); @@ -71,7 +71,7 @@ ComputeRHEOKernel::~ComputeRHEOKernel() // Remove custom property if it exists int tmp1, tmp2, index; index = atom->find_custom("rheo_coordination", tmp1, tmp2); - if (index != -1) atom->remove_custom(index_coord, 1, 0); + if (index != -1) atom->remove_custom(index, 0, 0); memory->destroy(C); memory->destroy(C0); @@ -125,12 +125,14 @@ void ComputeRHEOKernel::init() int tmp1, tmp2; int nmax = atom->nmax; - index_coord = atom->find_custom("rheo_coordination", tmp1, tmp2); - if (index_coord == -1) { - index_coord = atom->add_custom("rheo_coordination", 0, 0); + int index = atom->find_custom("rheo_coordination", tmp1, tmp2); + if (index == -1) { + index = atom->add_custom("rheo_coordination", 0, 0); nmax_old = nmax; } + coordination = atom->ivector[index]; + // Create local arrays for kernel arrays, I can't foresee a reason to print comm_forward = 1; ncor = 0; Mdim = 0; @@ -170,7 +172,6 @@ int ComputeRHEOKernel::check_corrections(int i) corrections = 0; } - int *coordination = atom->ivector[index_coord]; if (coordination[i] < zmin) corrections = 0; return corrections; @@ -503,7 +504,6 @@ void ComputeRHEOKernel::compute_peratom() double *mass = atom->mass; double *rho = atom->rho; int *status = atom->status; - int *coordination = atom->ivector[index_coord]; tagint *tag = atom->tag; int inum, *ilist, *jlist, *numneigh, **firstneigh; @@ -742,7 +742,6 @@ int ComputeRHEOKernel::pack_forward_comm(int n, int *list, double *buf, int /*pbc_flag*/, int * /*pbc*/) { int i,j,k,m,a,b; - coordination = atom->ivector[index_coord]; m = 0; if (correction_order > 0) { for (i = 0; i < n; i++) { @@ -774,7 +773,6 @@ int ComputeRHEOKernel::pack_forward_comm(int n, int *list, double *buf, void ComputeRHEOKernel::unpack_forward_comm(int n, int first, double *buf) { int i, k, m, last,a,b; - coordination = atom->ivector[index_coord]; m = 0; last = first + n; if (correction_order > 0) { diff --git a/src/RHEO/compute_rheo_kernel.h b/src/RHEO/compute_rheo_kernel.h index 346df5a20c..df659c47de 100644 --- a/src/RHEO/compute_rheo_kernel.h +++ b/src/RHEO/compute_rheo_kernel.h @@ -42,6 +42,7 @@ class ComputeRHEOKernel : public Compute { double dWij[3], dWji[3], Wij, Wji; int correction_order; + int *coordination; private: int solid_flag; @@ -49,7 +50,7 @@ class ComputeRHEOKernel : public Compute { std::unordered_set gsl_error_tags; int kernel_style, zmin, dim, Mdim, ncor; - int nmax_old, index_coord; + int nmax_old; double h, hsq, hinv, hsqinv, pre_w, pre_wp; double ***C; double *C0; diff --git a/src/RHEO/compute_rheo_vshift.cpp b/src/RHEO/compute_rheo_vshift.cpp index 2b7c9394d3..dccd3867cd 100644 --- a/src/RHEO/compute_rheo_vshift.cpp +++ b/src/RHEO/compute_rheo_vshift.cpp @@ -21,7 +21,6 @@ #include "atom.h" #include "comm.h" #include "compute_rheo_interface.h" -#include "compute_rheo_grad.h" #include "compute_rheo_kernel.h" #include "domain.h" #include "error.h" @@ -37,8 +36,8 @@ using namespace LAMMPS_NS; /* ---------------------------------------------------------------------- */ ComputeRHEOVShift::ComputeRHEOVShift(LAMMPS *lmp, int narg, char **arg) : - Compute(lmp, narg, arg), vshift(nullptr), fix_rheo(nullptr), compute_kernel(nullptr), - compute_grad(nullptr), compute_surface(nullptr), compute_interface(nullptr) + Compute(lmp, narg, arg), vshift(nullptr), fix_rheo(nullptr), fix_rheo(nullptr), + compute_kernel(nullptr), compute_interface(nullptr) { if (narg != 3) error->all(FLERR,"Illegal compute RHEO/VShift command"); @@ -51,11 +50,12 @@ ComputeRHEOVShift::ComputeRHEOVShift(LAMMPS *lmp, int narg, char **arg) : // Manually grow if nmax_old exceeded int tmp1, tmp2; - index_vshift = atom->find_custom("rheo_vshift", tmp1, tmp2); - if (index_vshift == -1) { - index_vshift = atom->add_custom("rheo_vshift", 1, 3); + int index = atom->find_custom("rheo_vshift", tmp1, tmp2); + if (index == -1) { + index = atom->add_custom("rheo_vshift", 1, 3); nmax_old = atom->nmax; } + vshift = atom->dvector[index]; } /* ---------------------------------------------------------------------- */ @@ -65,7 +65,7 @@ ComputeRHEOVShift::~ComputeRHEOVShift() // Remove custom property if it exists int tmp1, tmp2, index; index = atom->find_custom("rheo_vshift", tmp1, tmp2); - if (index != -1) atom->remove_custom(index_vshift, 1, 3); + if (index != -1) atom->remove_custom(index, 1, 3); } @@ -80,7 +80,6 @@ void ComputeRHEOVShift::init() surface_flag = 1; compute_kernel = fix_rheo->compute_kernel; - compute_grad = fix_rheo->compute_grad; compute_interface = fix_rheo->compute_interface; cut = fix_rheo->cut; @@ -119,7 +118,6 @@ void ComputeRHEOVShift::compute_peratom() int *surface = atom->surface; double *rho = atom->rho; double *mass = atom->mass; - double **vshift = atom->darray[index_vshift]; int newton_pair = force->newton_pair; inum = list->inum; @@ -127,7 +125,6 @@ void ComputeRHEOVShift::compute_peratom() numneigh = list->numneigh; firstneigh = list->firstneigh; - if (nmax_old < atom->nmax) memory->grow(vshift, atom->nmax, 3, "atom:rheo_vshift"); nmax_old = atom->nmax; @@ -232,9 +229,9 @@ void ComputeRHEOVShift::correct_surfaces() int nlocal = atom->nlocal; int i, a, b; int dim = domain->dimension; - double **vshift = atom->darray[index_vshift]; int tmp1, tmp2; + define after surf int index_nsurf = atom->find_custom("rheo_nsurf", tmp1, tmp2); if (index_nsurf == -1) error->all(FLERR, "Cannot find rheo nsurf"); double **nsurf = atom->darray[index_nsurf]; @@ -268,7 +265,6 @@ void ComputeRHEOVShift::correct_surfaces() int ComputeRHEOVShift::pack_reverse_comm(int n, int first, double *buf) { int i,m,last; - double **vshift = atom->darray[index_vshift]; m = 0; last = first + n; @@ -285,7 +281,6 @@ int ComputeRHEOVShift::pack_reverse_comm(int n, int first, double *buf) void ComputeRHEOVShift::unpack_reverse_comm(int n, int *list, double *buf) { int i,j,m; - double **vshift = atom->darray[index_vshift]; m = 0; for (i = 0; i < n; i++) { diff --git a/src/RHEO/compute_rheo_vshift.h b/src/RHEO/compute_rheo_vshift.h index f93cced31c..af5675fd8d 100644 --- a/src/RHEO/compute_rheo_vshift.h +++ b/src/RHEO/compute_rheo_vshift.h @@ -35,17 +35,17 @@ class ComputeRHEOVShift : public Compute { void unpack_reverse_comm(int, int *, double *) override; double memory_usage() override; void correct_surfaces(); + double **vshift; private: int nmax_old; double dtv, cut, cutsq, cutthird; - int surface_flag, index_vshift; + int surface_flag; class NeighList *list; class FixRHEO *fix_rheo; class ComputeRHEOInterface *compute_interface ; class ComputeRHEOKernel *compute_kernel; - class ComputeRHEOGrad *compute_grad; }; } // namespace LAMMPS_NS diff --git a/src/RHEO/fix_rheo.cpp b/src/RHEO/fix_rheo.cpp index 25a97bd52a..e83a95751a 100644 --- a/src/RHEO/fix_rheo.cpp +++ b/src/RHEO/fix_rheo.cpp @@ -21,6 +21,7 @@ #include "atom.h" #include "compute_rheo_grad.h" #include "compute_rheo_interface.h" +#include "compute_rheo_surface.h" #include "compute_rheo_kernel.h" #include "compute_rheo_rhosum.h" #include "compute_rheo_vshift.h" @@ -37,7 +38,7 @@ using namespace FixConst; /* ---------------------------------------------------------------------- */ FixRHEO::FixRHEO(LAMMPS *lmp, int narg, char **arg) : - Fix(lmp, narg, arg), compute_grad(nullptr), compute_kernel(nullptr), + Fix(lmp, narg, arg), compute_grad(nullptr), compute_kernel(nullptr), compute_surface(nullptr), compute_interface(nullptr), compute_rhosum(nullptr), compute_vshift(nullptr) { time_integrate = 1; @@ -258,7 +259,7 @@ void FixRHEO::initial_integrate(int /*vflag*/) double **gradr = compute_grad->gradr; double **gradv = compute_grad->gradv; - double **vshift = compute_vshift->array_atom; + double **vshift = compute_vshift->vshift; int *type = atom->type; int *mask = atom->mask; diff --git a/src/RHEO/fix_rheo.h b/src/RHEO/fix_rheo.h index 0132f32bcc..89304fe22f 100644 --- a/src/RHEO/fix_rheo.h +++ b/src/RHEO/fix_rheo.h @@ -81,6 +81,7 @@ class FixRHEO : public Fix { class ComputeRHEOGrad *compute_grad; class ComputeRHEOKernel *compute_kernel; class ComputeRHEOInterface *compute_interface; + class ComputeRHEOSurface *compute_surface; class ComputeRHEORhoSum *compute_rhosum; class ComputeRHEOVShift *compute_vshift; diff --git a/src/RHEO/fix_rheo_pressure.cpp b/src/RHEO/fix_rheo_pressure.cpp index 4fa4ece0f9..726c44c32b 100644 --- a/src/RHEO/fix_rheo_pressure.cpp +++ b/src/RHEO/fix_rheo_pressure.cpp @@ -36,7 +36,7 @@ enum {NONE, LINEAR, CUBIC, TAITWATER}; /* ---------------------------------------------------------------------- */ FixRHEOPressure::FixRHEOPressure(LAMMPS *lmp, int narg, char **arg) : - Fix(lmp, narg, arg) + Fix(lmp, narg, arg), fix_rheo(nullptr), pressure(nullptr) { if (narg < 4) error->all(FLERR,"Illegal fix command"); @@ -74,7 +74,7 @@ FixRHEOPressure::~FixRHEOPressure() // Remove custom property if it exists int tmp1, tmp2, index; index = atom->find_custom("rheo_pressure", tmp1, tmp2); - if (index != -1) atom->remove_custom(index_pres, 1, 0); + if (index != -1) atom->remove_custom(index, 1, 0); } /* ---------------------------------------------------------------------- */ @@ -115,11 +115,12 @@ void FixRHEOPressure::setup_pre_force(int /*vflag*/) // Manually grow if nmax_old exceeded int tmp1, tmp2; - index_pres = atom->find_custom("rheo_pressure", tmp1, tmp2); - if (index_pres == -1) { - index_pres = atom->add_custom("rheo_pressure", 1, 0); + int index = atom->find_custom("rheo_pressure", tmp1, tmp2); + if (index == -1) { + index = atom->add_custom("rheo_pressure", 1, 0); nmax_old = atom->nmax; } + pressure = atom->dvector[index]; pre_force(0); } @@ -133,7 +134,6 @@ void FixRHEOPressure::pre_force(int /*vflag*/) int i; double dr, rr3, rho_ratio; - double *pressure = atom->dvector[index_pres]; int *mask = atom->mask; double *rho = atom->rho; @@ -170,7 +170,6 @@ int FixRHEOPressure::pack_forward_comm(int n, int *list, double *buf, int /*pbc_flag*/, int * /*pbc*/) { int i,j,k,m; - double *pressure = atom->dvector[index_pres]; m = 0; for (i = 0; i < n; i++) { @@ -185,7 +184,6 @@ int FixRHEOPressure::pack_forward_comm(int n, int *list, double *buf, void FixRHEOPressure::unpack_forward_comm(int n, int first, double *buf) { int i, k, m, last; - double *pressure = atom->dvector[index_pres]; m = 0; last = first + n; @@ -194,6 +192,8 @@ void FixRHEOPressure::unpack_forward_comm(int n, int first, double *buf) } } +/* ---------------------------------------------------------------------- */ + double FixRHEOPressure::calculate_p(double rho) { double rho; diff --git a/src/RHEO/fix_rheo_pressure.h b/src/RHEO/fix_rheo_pressure.h index 8272cc38f5..197cab6e5c 100644 --- a/src/RHEO/fix_rheo_pressure.h +++ b/src/RHEO/fix_rheo_pressure.h @@ -38,9 +38,10 @@ class FixRHEOPressure : public Fix { double calculate_p(double); private: double c_cubic, csq, rho0, rho0inv; + double *pressure; int pressure_style; int first_flag, last_flag; - int nmax_old, index_pressure; + int nmax_old; class FixRHEO *fix_rheo; }; diff --git a/src/RHEO/fix_rheo_thermal.cpp b/src/RHEO/fix_rheo_thermal.cpp index 3ef9fab853..1a5d894ced 100644 --- a/src/RHEO/fix_rheo_thermal.cpp +++ b/src/RHEO/fix_rheo_thermal.cpp @@ -37,7 +37,8 @@ enum {NONE, CONSTANT, TYPE}; /* ---------------------------------------------------------------------- */ FixRHEOThermal::FixRHEOThermal(LAMMPS *lmp, int narg, char **arg) : - Fix(lmp, narg, arg), Tc_type(nullptr), kappa_type(nullptr), cv_type(nullptr) + Fix(lmp, narg, arg), Tc_type(nullptr), kappa_type(nullptr), cv_type(nullptr), + conductivity(nullptr) { if (narg < 4) error->all(FLERR,"Illegal fix command"); @@ -131,7 +132,7 @@ FixRHEOThermal::~FixRHEOThermal() // Remove custom property if it exists int tmp1, tmp2, index; index = atom->find_custom("rheo_conductivity", tmp1, tmp2); - if (index != -1) atom->remove_custom(index_cond, 1, 0); + if (index != -1) atom->remove_custom(index, 1, 0); memory->destroy(cv_type); memory->destroy(Tc_type); @@ -199,11 +200,12 @@ void FixRHEOThermal::setup_pre_force(int /*vflag*/) // Manually grow if nmax_old exceeded int tmp1, tmp2; - index_cond = atom->find_custom("rheo_conductivity", tmp1, tmp2); - if (index_cond == -1) { - index_cond = atom->add_custom("rheo_conductivity", 1, 0); + index = atom->find_custom("rheo_conductivity", tmp1, tmp2); + if (index== -1) { + index = atom->add_custom("rheo_conductivity", 1, 0); nmax_old = atom->nmax; } + conductivity = atom->dvector[index]; post_neighbor(); pre_force(0); diff --git a/src/RHEO/fix_rheo_thermal.h b/src/RHEO/fix_rheo_thermal.h index 3b62e86fa8..4f0e89f17c 100644 --- a/src/RHEO/fix_rheo_thermal.h +++ b/src/RHEO/fix_rheo_thermal.h @@ -48,11 +48,12 @@ class FixRHEOThermal : public Fix { double *Tc_type, Tc; double *kappa_type, kappa; double dtf, dtv; + double *conductivity; int Tc_style; int cv_style; int conductivity_style; int first_flag, last_flag; - int nmax_old, index_cond; + int nmax_old; class FixRHEO *fix_rheo; diff --git a/src/RHEO/fix_rheo_viscosity.cpp b/src/RHEO/fix_rheo_viscosity.cpp index 3f779aa3c6..bb7094c43e 100644 --- a/src/RHEO/fix_rheo_viscosity.cpp +++ b/src/RHEO/fix_rheo_viscosity.cpp @@ -37,7 +37,7 @@ enum {NONE, CONSTANT, TYPE, POWER}; /* ---------------------------------------------------------------------- */ FixRHEOViscosity::FixRHEOViscosity(LAMMPS *lmp, int narg, char **arg) : - Fix(lmp, narg, arg), eta_type(nullptr) + Fix(lmp, narg, arg), fix_rheo(nullptr), eta_type(nullptr), viscosity(nullptr), compute_grad(nullptr) { if (narg < 4) error->all(FLERR,"Illegal fix command"); @@ -142,11 +142,12 @@ void FixRHEOViscosity::setup_pre_force(int /*vflag*/) // Manually grow if nmax_old exceeded int tmp1, tmp2; - index_visc = atom->find_custom("rheo_viscosity", tmp1, tmp2); + int index = atom->find_custom("rheo_viscosity", tmp1, tmp2); if (index_visc == -1) { - index_visc = atom->add_custom("rheo_viscosity", 1, 0); + index = atom->add_custom("rheo_viscosity", 1, 0); nmax_old = atom->nmax; } + viscosity = atom->dvector[index]; post_neighbor(); pre_force(0); @@ -161,7 +162,6 @@ void FixRHEOViscosity::post_neighbor() int i; int *type = atom->type; - double *viscosity = atom->dvector[index_visc]; int *mask = atom->mask; int nlocal = atom->nlocal; @@ -190,7 +190,6 @@ void FixRHEOViscosity::pre_force(int /*vflag*/) int i, a, b; double tmp, gdot; - double *viscosity = atom->dvector[index_visc]; int *mask = atom->mask; double **gradv = compute_grad->gradv; @@ -232,7 +231,6 @@ int FixRHEOViscosity::pack_forward_comm(int n, int *list, double *buf, int /*pbc_flag*/, int * /*pbc*/) { int i,j,k,m; - double *viscosity = atom->dvector[index_visc]; m = 0; for (i = 0; i < n; i++) { @@ -247,7 +245,6 @@ int FixRHEOViscosity::pack_forward_comm(int n, int *list, double *buf, void FixRHEOViscosity::unpack_forward_comm(int n, int first, double *buf) { int i, k, m, last; - double *viscosity = atom->dvector[index_visc]; m = 0; last = first + n; diff --git a/src/RHEO/fix_rheo_viscosity.h b/src/RHEO/fix_rheo_viscosity.h index 407170f668..14f8b70de9 100644 --- a/src/RHEO/fix_rheo_viscosity.h +++ b/src/RHEO/fix_rheo_viscosity.h @@ -40,9 +40,10 @@ class FixRHEOViscosity : public Fix { private: double *eta_type, eta; double npow, K, gd0, tau0; + double *viscosity; int viscosity_style; int first_flag, last_flag; - int nmax_old, index_visc; + int nmax_old; class FixRHEO *fix_rheo; class ComputeRHEOGrad *compute_grad; diff --git a/src/RHEO/pair_rheo.cpp b/src/RHEO/pair_rheo.cpp index 7d5d0f425f..7b9425cf20 100644 --- a/src/RHEO/pair_rheo.cpp +++ b/src/RHEO/pair_rheo.cpp @@ -47,7 +47,7 @@ using namespace MathExtra; PairRHEO::PairRHEO(LAMMPS *lmp) : Pair(lmp), compute_kernel(nullptr), compute_grad(nullptr), - compute_interface(nullptr), fix_rheo(nullptr), fix_rheo_pressure(nullptr) + compute_interface(nullptr), fix_rheo(nullptr), fix_pressure(nullptr) { restartinfo = 0; single_enable = 0; @@ -91,8 +91,7 @@ void PairRHEO::compute(int eflag, int vflag) double **v = atom->v; double **x = atom->x; double **f = atom->f; - double **f_pressure = fix_rheo->f_pressure; // rewrite later - double *pressure = atom->pressure; // rewrite later + double **f_pressure = compute_interface->f_pressure; double *rho = atom->rho; double *mass = atom->mass; double *drho = atom->drho; @@ -105,15 +104,19 @@ void PairRHEO::compute(int eflag, int vflag) int *status = atom->status; int tmp1, tmp2; - int index_visc = atom->find_custom("rheo_viscosity", tmp1, tmp2); - if (index_visc == -1) error->all(FLERR, "Cannot find rheo viscosity"); - double *viscosity = atom->dvector[index_visc]; + int index = atom->find_custom("rheo_viscosity", tmp1, tmp2); + if (index == -1) error->all(FLERR, "Cannot find rheo viscosity"); + double *viscosity = atom->dvector[index]; + + index = atom->find_custom("rheo_pressure", tmp1, tmp2); + if (index == -1) error->all(FLERR, "Cannot find rheo pressure"); + double *pressure = atom->dvector[index]; double *conductivity; if (thermal_flag) { - int index_cond = atom->find_custom("rheo_conductivity", tmp1, tmp2); - if (index_cond == -1) error->all(FLERR, "Cannot find rheo conductivity"); - conductivity = atom->dvector[index_cond]; + index = atom->find_custom("rheo_conductivity", tmp1, tmp2); + if (index == -1) error->all(FLERR, "Cannot find rheo conductivity"); + conductivity = atom->dvector[index]; } int *ilist, *jlist, *numneigh, **firstneigh; @@ -195,7 +198,7 @@ void PairRHEO::compute(int eflag, int vflag) if (fluidi && (!fluidj)) { compute_interface->correct_v(vi, vj, i, j); rhoj = compute_interface->correct_rho(j, i); - Pj = fix_rheo_pressure->calculate_p(rhoj); + Pj = fix_pressure->calculate_p(rhoj); if ((chi[j] > 0.9) && (r < (h * 0.5))) fmag = (chi[j] - 0.9) * (h * 0.5 - r) * rho0 * csq * h * rinv; @@ -413,7 +416,12 @@ void PairRHEO::setup() fixes = modify->get_fix_by_style("rheo/pressure"); if (fixes.size() == 0) error->all(FLERR, "Need to define fix rheo/pressure to use pair rheo"); - fix_rheo_pressure = dynamic_cast(fixes[0]); + fix_pressure = dynamic_cast(fixes[0]); + + int tmp1, tmp2; + index_pressure = atom->find_custom("rheo_pressure", tmp1, tmp2); + if (index_pressure == -1) index_pressure = atom->add_custom("rheo_pressure", 1, 0); + else error->all(FLERR, "Cannot find pressure value in pair rheo"); compute_kernel = fix_rheo->compute_kernel; compute_grad = fix_rheo->compute_grad; diff --git a/src/RHEO/pair_rheo.h b/src/RHEO/pair_rheo.h index aa98e63ddc..49aa1ad025 100644 --- a/src/RHEO/pair_rheo.h +++ b/src/RHEO/pair_rheo.h @@ -49,7 +49,7 @@ class PairRHEO : public Pair { class ComputeRHEOGrad *compute_grad; class ComputeRHEOInterface *compute_interface; class FixRHEO *fix_rheo; - class FixRHEOPressure *fix_rheo_pressure; + class FixRHEOPressure *fix_pressure; }; } // namespace LAMMPS_NS From 5980fdf9fdad22d75a395078a61319f3e453c71e Mon Sep 17 00:00:00 2001 From: jtclemm Date: Sat, 15 Apr 2023 21:15:37 -0600 Subject: [PATCH 022/158] Revising interface compute --- src/RHEO/compute_rheo_interface.cpp | 185 +++++++++++++--------------- src/RHEO/compute_rheo_interface.h | 4 +- src/RHEO/compute_rheo_vshift.cpp | 8 +- src/RHEO/fix_rheo_thermal.cpp | 10 +- src/RHEO/fix_rheo_viscosity.cpp | 10 +- src/RHEO/pair_rheo.cpp | 29 +++-- 6 files changed, 126 insertions(+), 120 deletions(-) diff --git a/src/RHEO/compute_rheo_interface.cpp b/src/RHEO/compute_rheo_interface.cpp index ae1bc13831..ff76b75f77 100644 --- a/src/RHEO/compute_rheo_interface.cpp +++ b/src/RHEO/compute_rheo_interface.cpp @@ -61,8 +61,8 @@ ComputeRHEOInterface::~ComputeRHEOInterface() if (index != -1) atom->remove_custom(index, 1, 0); if (id_fix_pa && modify->nfix) modify->delete_fix(id_fix_pa); + delete[] id_fix_pa; - memory->destroy(fx_m_norm); memory->destroy(norm); memory->destroy(normwf); } @@ -72,7 +72,10 @@ ComputeRHEOInterface::~ComputeRHEOInterface() void ComputeRHEOInterface::init() { compute_kernel = fix_rheo->compute_kernel; + rho0 = fix_rheo->rho0; cut = fix_rheo->cut; + cs = fix_rheo->cs; + cs_inv = 1.0 / cs; cutsq = cut * cut; wall_max = sqrt(3.0) / 12.0 * cut; @@ -87,21 +90,25 @@ void ComputeRHEOInterface::init() int index = atom->find_custom("rheo_chi", tmp1, tmp2); if (index == -1) { index = atom->add_custom("rheo_chi", 1, 0); + memory->destroy(norm); + memory->destroy(normwf); + memory->create(norm, nmax, "rheo/interface:norm"); + memory->create(normwf, nmax, "rheo/interface:normwf"); nmax_old = nmax; } chi = atom->dvector[index]; - // For fpressure, go ahead and create an instance of fix property atom + // For fp_store, go ahead and create an instance of fix property atom // Need restarts + exchanging with neighbors since it needs to persist // between timesteps (fix property atom will handle callbacks) - index = atom->find_custom("rheo_pressure", tmp1, tmp2); + index = atom->find_custom("fp_store", tmp1, tmp2); if (index == -1) { id_fix_pa = utils::strdup(id + std::string("_fix_property_atom")); - modify->add_fix(fmt::format("{} all property/atom d2_f_pressure 3", id_fix_pa))); - index = atom->find_custom("rheo_pressure", tmp1, tmp2); + modify->add_fix(fmt::format("{} all property/atom d2_fp_store 3", id_fix_pa))); + index = atom->find_custom("fp_store", tmp1, tmp2); } - f_pressure = atom->darray[index]; + fp_store = atom->darray[index]; // need an occasional half neighbor list neighbor->add_request(this, NeighConst::REQ_HALF); @@ -116,51 +123,37 @@ void ComputeRHEOInterface::init_list(int /*id*/, NeighList *ptr) /* ---------------------------------------------------------------------- */ -// Left off here void ComputeRHEOInterface::compute_peratom() { - int i, j, ii, jj, jnum, itype, jtype, phase_match; - double xtmp, ytmp, ztmp, delx, dely, delz, rsq; - int *jlist; - double w; + int i, j, ii, jj, jnum, itype, jtype, fluidi, fluidj, status_match; + double xtmp, ytmp, ztmp, delx, dely, delz, rsq, w, dot; - // neighbor list ariables - int inum, *ilist, *numneigh, **firstneigh; + int inum, *ilist, *jlist, *numneigh, **firstneigh; int nlocal = atom->nlocal; int nall = nlocal + atom->nghost; double **x = atom->x; int *type = atom->type; int newton = force->newton; - int *phase = atom->phase; + int *status = atom->status; double *rho = atom->rho; - double *fx = atom->dvector[index_fx]; - double *fy = atom->dvector[index_fy]; - double *fz = atom->dvector[index_fz]; - double mi, mj; - - //Declare mass pointer to calculate acceleration from force - double *mass = atom->mass; - - cs2 = 1.0; inum = list->inum; ilist = list->ilist; numneigh = list->numneigh; firstneigh = list->firstneigh; - if (atom->nmax > nmax) { - nmax = atom->nmax; - fix_chi->grow_arrays(nmax); - chi = fix_chi->vstore; + if (atom->nmax > nmax_old) { + nmax_old = atom->nmax; memory->destroy(norm); memory->destroy(normwf); - memory->create(norm, nmax, "RHEO/chi:norm"); - memory->create(normwf, nmax, "RHEO/chi:normwf"); + memory->create(norm, nmax_old, "rheo/interface:norm"); + memory->create(normwf, nmax_old, "rheo/interface:normwf"); + memory->grow(chi, nmax_old, "rheo/interface:chi"); } for (i = 0; i < nall; i++) { - if (phase[i] > FixRHEO::FLUID_MAX) rho[i] = 0.0; + if (!(status[i] & FixRHEO::STATUS_FLUID)) rho[i] = 0.0; normwf[i] = 0.0; norm[i] = 0.0; chi[i] = 0.0; @@ -172,9 +165,9 @@ void ComputeRHEOInterface::compute_peratom() ytmp = x[i][1]; ztmp = x[i][2]; itype = type[i]; + fluidi = status[i] & FixRHEO::STATUS_FLUID; jlist = firstneigh[i]; jnum = numneigh[i]; - mi = mass[type[i]]; for (jj = 0; jj < jnum; jj++) { j = jlist[jj]; @@ -187,37 +180,36 @@ void ComputeRHEOInterface::compute_peratom() if (rsq < cutsq) { jtype = type[j]; - mj = mass[type[j]]; + fluidj = status[j] & FixRHEO::STATUS_FLUID; w = compute_kernel->calc_w_quintic(i, j, delx, dely, delz, sqrt(rsq)); - phase_match = 0; + status_match = 0; norm[i] += w; - if ((phase[i] <= FixRHEO::FLUID_MAX && phase[j] <= FixRHEO::FLUID_MAX) - || (phase[i] > FixRHEO::FLUID_MAX && phase[j] > FixRHEO::FLUID_MAX)) { - phase_match = 1; - } + if ((fluidi && fluidj) || ((!fluid) && (!fluidj))) + status_match = 1; - if (phase_match) { + if (status_match) { chi[i] += w; } else { - if (phase[i] > FixRHEO::FLUID_MAX) { - //speed of sound and rho0 assumed to = 1 (units in density not pressure) - //In general, rho is calculated using the force vector on the wall particle - //fx stores f-fp - rho[i] += w*(cs2*(rho[j] - 1.0) - rho[j]*((-fx[j]/mj+fx[i]/mi)*delx + (-fy[j]/mj+fy[i]/mi)*dely + (-fz[j]/mj+fz[i]/mi)*delz)); - //For the specific taste case whre force on wall particles = 0 - //rho[i] += w*(1.0*(rho[j] - 1.0) + rho[j]*(1e-3*delx)); + if (!fluidi) { + dot = (-fp_store[0][j] + fp_store[0][i]) * delx; + dot += (-fp_store[1][j] + fp_store[1][i]) * dely; + dot += (-fp_store[2][j] + fp_store[2][i]) * delz; + rho[i] += w * (cs * (rho[j] - rho0) - rho[j] * dot); normwf[i] += w; } } if (newton || j < nlocal) { norm[j] += w; - if (phase_match) { + if (status_match) { chi[j] += w; } else { - if (phase[j] > FixRHEO::FLUID_MAX) { - rho[j] += w*(cs2*(rho[i] - 1.0) + rho[i]*((-fx[i]/mi+fx[j]/mj)*delx + (-fy[i]/mi+fy[j]/mj)*dely + (-fz[i]/mi+fz[j]/mj)*delz)); + if (!fluidj) { + dot = (-fp_store[0][i] + fp_store[0][j]) * delx; + dot += (-fp_store[1][i] + fp_store[1][j]) * dely; + dot += (-fp_store[2][i] + fp_store[2][j]) * delz; + rho[j] += w * (cs * (rho[i] - rho0) + rho[i] * dot); normwf[j] += w; } } @@ -226,41 +218,41 @@ void ComputeRHEOInterface::compute_peratom() } } - if (newton) comm->reverse_comm_compute(this); + if (newton) comm->reverse_comm(this); for (i = 0; i < nlocal; i++) { if (norm[i] != 0.0) chi[i] /= norm[i]; - if (normwf[i] != 0.0) { // Only if it's a wall particle - rho[i] = 1.0 + (rho[i] / normwf[i])/cs2; // Stores rho for solid particles 1+Pw in Adami Adams 2012 - if (rho[i] < EPSILON) rho[i] = EPSILON; - } - if (normwf[i] == 0.0 && phase[i] > FixRHEO::FLUID_MAX) rho[i] = 1.0; + // Recalculate rho for non-fluid particles + if (!(status[i] & FixRHEO::STATUS_FLUID)) { + if (normwf[i] != 0.0) { + // Stores rho for solid particles 1+Pw in Adami Adams 2012 + rho[i] = MAX(EPSILON, rho0 + (rho[i] / normwf[i]) * cs_inv); + } else { + rho[i] = rho0; + } + } } comm_stage = 1; comm_forward = 2; - comm->forward_comm_compute(this); + comm->forward_comm(this); } /* ---------------------------------------------------------------------- */ -int ComputeRHEOInterface::pack_forward_comm(int n, int *list, double *buf, - int /*pbc_flag*/, int * /*pbc*/) +int ComputeRHEOInterface::pack_forward_comm(int n, int *list, double *buf, int /*pbc_flag*/, int * /*pbc*/) { int i,j,k,m; m = 0; double *rho = atom->rho; - double *fx = atom->dvector[index_fx]; - double *fy = atom->dvector[index_fy]; - double *fz = atom->dvector[index_fz]; for (i = 0; i < n; i++) { j = list[i]; if (comm_stage == 0) { - buf[m++] = fx[j]; - buf[m++] = fy[j]; - buf[m++] = fz[j]; + buf[m++] = fp_store[j][0]; + buf[m++] = fp_store[j][1]; + buf[m++] = fp_store[j][2]; } else { buf[m++] = chi[j]; buf[m++] = rho[j]; @@ -275,20 +267,16 @@ void ComputeRHEOInterface::unpack_forward_comm(int n, int first, double *buf) { int i, k, m, last; double *rho = atom->rho; - double *fx = atom->dvector[index_fx]; - double *fy = atom->dvector[index_fy]; - double *fz = atom->dvector[index_fz]; - m = 0; last = first + n; for (i = first; i < last; i++) { if (comm_stage == 0) { - fx[i] = buf[m++]; - fy[i] = buf[m++]; - fz[i] = buf[m++]; + fp_store[i][0] = buf[m++]; + fp_store[i][1] = buf[m++]; + fp_store[i][2] = buf[m++]; } else { chi[i] = buf[m++]; - rho[i] = buf[m++]; // Won't do anything for fluids + rho[i] = buf[m++]; } } } @@ -317,13 +305,13 @@ void ComputeRHEOInterface::unpack_reverse_comm(int n, int *list, double *buf) { int i,k,j,m; double *rho = atom->rho; - int *phase = atom->phase; + int *status = atom->status; m = 0; for (i = 0; i < n; i++) { j = list[i]; norm[j] += buf[m++]; chi[j] += buf[m++]; - if (phase[j] > FixRHEO::FLUID_MAX){ + if (!(status[j] & FixRHEO::STATUS_FLUID)){ normwf[j] += buf[m++]; rho[j] += buf[m++]; } else { @@ -339,22 +327,23 @@ void ComputeRHEOInterface::correct_v(double *vi, double *vj, double *vi_out, int { double wall_prefactor, wall_denom, wall_numer; - wall_numer = 2.0*cut*(chi[i]-0.5); + wall_numer = 2.0 * cut * (chi[i] - 0.5); if (wall_numer < 0) wall_numer = 0; - wall_denom = 2.0*cut*(chi[j]-0.5); + wall_denom = 2.0 * cut * (chi[j] - 0.5); if (wall_denom < wall_max) wall_denom = wall_max; wall_prefactor = wall_numer / wall_denom; - vi_out[0] = (vi[0]-vj[0])*wall_prefactor + vi[0]; - vi_out[1] = (vi[1]-vj[1])*wall_prefactor + vi[1]; - vi_out[2] = (vi[2]-vj[2])*wall_prefactor + vi[2]; + vi_out[0] = (vi[0] - vj[0]) * wall_prefactor + vi[0]; + vi_out[1] = (vi[1] - vj[1]) * wall_prefactor + vi[1]; + vi_out[2] = (vi[2] - vj[2]) * wall_prefactor + vi[2]; } /* ---------------------------------------------------------------------- */ -double ComputeRHEOInterface::correct_rho(int i, int j) // i is wall, j is fluid +double ComputeRHEOInterface::correct_rho(int i, int j) { + // i is wall, j is fluid //In future may depend on atom type j's pressure equation return atom->rho[i]; } @@ -363,42 +352,46 @@ double ComputeRHEOInterface::correct_rho(int i, int j) // i is wall, j is fluid void ComputeRHEOInterface::store_forces() { - double *fx = atom->dvector[index_fx]; - double *fy = atom->dvector[index_fy]; - double *fz = atom->dvector[index_fz]; + double minv; + double mass = atom->mass; + double type = atom->type; double **f = atom->f; - double **fp = atom->fp; int *mask = atom->mask; - int flag; + // When this is called, fp_store stores the pressure force + // After this method, fp_store instead stores non-pressure forces + // and is also normalized by the particles mass + // If forces are overwritten by a fix, there are no pressure forces + // so just normalize int ifix = modify->find_fix_by_style("setforce"); if (ifix != -1) { for (int i = 0; i < atom->nlocal; i++) { + minv = 1.0 / mass[type[i]]; if (mask[i] & modify->fix[ifix]->groupbit) { - fx[i] = f[i][0]; - fy[i] = f[i][1]; - fz[i] = f[i][2]; + fp_store[i][0] = f[i][0] * minv; + fp_store[i][1] = f[i][1] * minv; + fp_store[i][2] = f[i][2] * minv; } else { - fx[i] = f[i][0] - fp[i][0]; - fy[i] = f[i][1] - fp[i][1]; - fz[i] = f[i][2] - fp[i][2]; + fp_store[i][0] = (f[i][0] - fp_store[i][0]) * minv; + fp_store[i][1] = (f[i][1] - fp_store[i][1]) * minv; + fp_store[i][2] = (f[i][2] - fp_store[i][2]) * minv; } } } else { for (int i = 0; i < atom->nlocal; i++) { - fx[i] = f[i][0] - fp[i][0]; - fy[i] = f[i][1] - fp[i][1]; - fz[i] = f[i][2] - fp[i][2]; + minv = 1.0 / mass[type[i]]; + fp_store[i][0] = (f[i][0] - fp_store[i][0]) * minv; + fp_store[i][1] = (f[i][1] - fp_store[i][1]) * minv; + fp_store[i][2] = (f[i][2] - fp_store[i][2]) * minv; } } - //Forward comm forces -note only needed here b/c property atom will forward otherwise + // Forward comm forces comm_forward = 3; comm_stage = 0; - comm->forward_comm_compute(this); + comm->forward_comm(this); } - /* ---------------------------------------------------------------------- memory usage of local atom-based array ------------------------------------------------------------------------- */ diff --git a/src/RHEO/compute_rheo_interface.h b/src/RHEO/compute_rheo_interface.h index f314c16aa9..8e190c5430 100644 --- a/src/RHEO/compute_rheo_interface.h +++ b/src/RHEO/compute_rheo_interface.h @@ -44,8 +44,8 @@ class ComputeRHEOInterface : public Compute { private: int nmax_old, comm_stage; - double cut, cutsq, cs, wall_max; - double **fx_m_norm, *norm, *normwf; + double rho0, cut, cutsq, cs, cs_inv, wall_max; + double *norm, *normwf, **fom_store; char *id_fix_pa; diff --git a/src/RHEO/compute_rheo_vshift.cpp b/src/RHEO/compute_rheo_vshift.cpp index dccd3867cd..6cbd6e96da 100644 --- a/src/RHEO/compute_rheo_vshift.cpp +++ b/src/RHEO/compute_rheo_vshift.cpp @@ -125,9 +125,10 @@ void ComputeRHEOVShift::compute_peratom() numneigh = list->numneigh; firstneigh = list->firstneigh; - if (nmax_old < atom->nmax) + if (nmax_old < atom->nmax) { memory->grow(vshift, atom->nmax, 3, "atom:rheo_vshift"); - nmax_old = atom->nmax; + nmax_old = atom->nmax; + } for (i = 0; i < nall; i++) for (a = 0; a < dim; a++) @@ -231,7 +232,6 @@ void ComputeRHEOVShift::correct_surfaces() int dim = domain->dimension; int tmp1, tmp2; - define after surf int index_nsurf = atom->find_custom("rheo_nsurf", tmp1, tmp2); if (index_nsurf == -1) error->all(FLERR, "Cannot find rheo nsurf"); double **nsurf = atom->darray[index_nsurf]; @@ -239,7 +239,7 @@ void ComputeRHEOVShift::correct_surfaces() double nx,ny,nz,vx,vy,vz; for (i = 0; i < nlocal; i++) { if (mask[i] & groupbit) { - if ((surface[i] & FixRHEO::STATUS_SURFACE) || (surface[i] & FixRHEO::STATUS_LAYER)) { + if ((status[i] & FixRHEO::STATUS_SURFACE) || (status[i] & FixRHEO::STATUS_LAYER)) { nx = nsurf[i][0]; ny = nsurf[i][1]; vx = vshift[i][0]; diff --git a/src/RHEO/fix_rheo_thermal.cpp b/src/RHEO/fix_rheo_thermal.cpp index 1a5d894ced..1912dc9f8c 100644 --- a/src/RHEO/fix_rheo_thermal.cpp +++ b/src/RHEO/fix_rheo_thermal.cpp @@ -293,9 +293,10 @@ void FixRHEOThermal::post_neighbor() int nlocal = atom->nlocal; int nall = nlocal + atom->nghost; - if (first_flag && (nmax_old < atom->nmax)) + if (first_flag && (nmax_old < atom->nmax)) { memory->grow(conductivity, atom->nmax, "atom:rheo_conductivity"); - nmax_old = atom->nmax; + nmax_old = atom->nmax; + } if (conductivity_style == CONSTANT) { for (i = 0; i < nall; i++) @@ -328,9 +329,10 @@ void FixRHEOThermal::pre_force(int /*vflag*/) //int *mask = atom->mask; //int nlocal = atom->nlocal; - //if (first_flag && (nmax_old < atom->nmax)) + //if (first_flag && (nmax_old < atom->nmax)) { // memory->grow(conductivity, atom->nmax, "atom:rheo_conductivity"); - //nmax_old = atom->nmax; + // nmax_old = atom->nmax; + //} //if (conductivity_style == TBD) { // for (i = 0; i < nlocal; i++) { diff --git a/src/RHEO/fix_rheo_viscosity.cpp b/src/RHEO/fix_rheo_viscosity.cpp index bb7094c43e..5ae1b95529 100644 --- a/src/RHEO/fix_rheo_viscosity.cpp +++ b/src/RHEO/fix_rheo_viscosity.cpp @@ -167,9 +167,10 @@ void FixRHEOViscosity::post_neighbor() int nlocal = atom->nlocal; int nall = nlocal + atom->nghost; - if (first_flag && (nmax_old < atom->nmax)) + if (first_flag && (nmax_old < atom->nmax)) { memory->grow(viscosity, atom->nmax, "atom:rheo_viscosity"); - nmax_old = atom->nmax; + nmax_old = atom->nmax; + } if (viscosity_style == CONSTANT) { for (i = 0; i < nall; i++) @@ -196,9 +197,10 @@ void FixRHEOViscosity::pre_force(int /*vflag*/) int nlocal = atom->nlocal; int dim = domain->dimension; - if (first_flag && (nmax_old < atom->nmax)) + if (first_flag && (nmax_old < atom->nmax)) { memory->grow(viscosity, atom->nmax, "atom:rheo_viscosity"); - nmax_old = atom->nmax; + nmax_old = atom->nmax; + } if (viscosity_style == POWER) { for (i = 0; i < nlocal; i++) { diff --git a/src/RHEO/pair_rheo.cpp b/src/RHEO/pair_rheo.cpp index 7b9425cf20..1eb2a43e1a 100644 --- a/src/RHEO/pair_rheo.cpp +++ b/src/RHEO/pair_rheo.cpp @@ -91,17 +91,21 @@ void PairRHEO::compute(int eflag, int vflag) double **v = atom->v; double **x = atom->x; double **f = atom->f; - double **f_pressure = compute_interface->f_pressure; double *rho = atom->rho; double *mass = atom->mass; double *drho = atom->drho; double *temperature = atom->temperature; double *heatflow = atom->heatflow; double *special_lj = force->special_lj; - tagint *tag = atom->tag; - int *chi = compute_interface->chi; int *type = atom->type; int *status = atom->status; + tagint *tag = atom->tag; + + double **fp_store, *chi; + if (compute_interface) { + fp_store = compute_interface->fp_store; + chi = compute_interface->chi; + } int tmp1, tmp2; int index = atom->find_custom("rheo_viscosity", tmp1, tmp2); @@ -273,9 +277,6 @@ void PairRHEO::compute(int eflag, int vflag) f[i][0] += ft[0]; f[i][1] += ft[1]; f[i][2] += ft[2]; - fp[i][0] += dfp[0]; - fp[i][1] += dfp[1]; - fp[i][2] += dfp[2]; if (evflag) // Does not account for unbalanced forces ev_tally_xyz(i, j, nlocal, newton_pair, 0.0, 0.0, ft[0], ft[1], ft[2], dx[0], dx[1], dx[2]); @@ -289,7 +290,7 @@ void PairRHEO::compute(int eflag, int vflag) // flip sign here b/c -= at accummulator } - scale3(fp_prefact,r dWji, dfp); + scale3(fp_prefactor, dWji, dfp); add3(fv, dfp, ft); add3(fsolid, ft, ft); @@ -297,10 +298,18 @@ void PairRHEO::compute(int eflag, int vflag) f[j][0] -= ft[0]; f[j][1] -= ft[1]; f[j][2] -= ft[2]; + } - fp[j][0] -= dfp[0]; - fp[j][1] -= dfp[1]; - fp[j][2] -= dfp[2]; + if (compute_interface) { + fp_store[i][0] += dfp[0]; + fp_store[i][1] += dfp[1]; + fp_store[i][2] += dfp[2]; + + if (newton_pair || j < nlocal) { + fp_store[j][0] -= dfp[0]; + fp_store[j][1] -= dfp[1]; + fp_store[j][2] -= dfp[2]; + } } } From d85ce6a39247254ec64baaf1b8879c15c0aeecef Mon Sep 17 00:00:00 2001 From: jtclemm Date: Wed, 19 Apr 2023 17:15:00 -0600 Subject: [PATCH 023/158] Initial surface compute --- src/RHEO/compute_rheo_grad.h | 2 +- src/RHEO/compute_rheo_interface.cpp | 2 +- src/RHEO/compute_rheo_interface.h | 2 +- src/RHEO/compute_rheo_kernel.h | 2 +- src/RHEO/compute_rheo_surface.cpp | 595 ++++++++++++++++++++++++++++ src/RHEO/compute_rheo_surface.h | 72 ++++ src/RHEO/compute_rheo_vshift.h | 2 +- src/RHEO/fix_rheo.cpp | 54 ++- src/RHEO/fix_rheo.h | 8 +- 9 files changed, 714 insertions(+), 25 deletions(-) create mode 100644 src/RHEO/compute_rheo_surface.cpp create mode 100644 src/RHEO/compute_rheo_surface.h diff --git a/src/RHEO/compute_rheo_grad.h b/src/RHEO/compute_rheo_grad.h index 7804ee72dd..ee4b4a5bd6 100644 --- a/src/RHEO/compute_rheo_grad.h +++ b/src/RHEO/compute_rheo_grad.h @@ -13,7 +13,7 @@ #ifdef COMPUTE_CLASS // clang-format off -ComputeStyle(rheo/grad,ComputeRHEOGrad) +ComputeStyle(RHEO/GRAD,ComputeRHEOGrad) // clang-format on #else diff --git a/src/RHEO/compute_rheo_interface.cpp b/src/RHEO/compute_rheo_interface.cpp index ff76b75f77..55cb81382b 100644 --- a/src/RHEO/compute_rheo_interface.cpp +++ b/src/RHEO/compute_rheo_interface.cpp @@ -398,7 +398,7 @@ void ComputeRHEOInterface::store_forces() double ComputeRHEOInterface::memory_usage() { - double bytes = nmax * sizeof(double); + double bytes = 3 * nmax_old * sizeof(double); return bytes; } diff --git a/src/RHEO/compute_rheo_interface.h b/src/RHEO/compute_rheo_interface.h index 8e190c5430..cdb2eb6c54 100644 --- a/src/RHEO/compute_rheo_interface.h +++ b/src/RHEO/compute_rheo_interface.h @@ -13,7 +13,7 @@ #ifdef COMPUTE_CLASS // clang-format off -ComputeStyle(rheo/interface,ComputeRHEOInterface) +ComputeStyle(RHEO/INTERFACE,ComputeRHEOInterface) // clang-format on #else diff --git a/src/RHEO/compute_rheo_kernel.h b/src/RHEO/compute_rheo_kernel.h index df659c47de..ed2b6ff5f2 100644 --- a/src/RHEO/compute_rheo_kernel.h +++ b/src/RHEO/compute_rheo_kernel.h @@ -13,7 +13,7 @@ #ifdef COMPUTE_CLASS // clang-format off -ComputeStyle(rheo/kernel,ComputeRHEOKernel) +ComputeStyle(RHEO/KERNEL,ComputeRHEOKernel) // clang-format on #else diff --git a/src/RHEO/compute_rheo_surface.cpp b/src/RHEO/compute_rheo_surface.cpp new file mode 100644 index 0000000000..dff5db4cfa --- /dev/null +++ b/src/RHEO/compute_rheo_surface.cpp @@ -0,0 +1,595 @@ +/* ---------------------------------------------------------------------- + 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 authors: + Joel Clemmer (SNL), Thomas O'Connor (CMU), Eric Palermo (CMU) +----------------------------------------------------------------------- */ + +#include "compute_rheo_surface.h" + +#include "fix_rheo.h" +#include "compute_rheo_kernel.h" +#include "compute_rheo_solids.h" +#include "atom.h" +#include "memory.h" +#include "atom.h" +#include "comm.h" +#include "modify.h" +#include "neighbor.h" +#include "neigh_list.h" +#include "neigh_request.h" +#include "error.h" +#include "force.h" +#include "domain.h" + +using namespace LAMMPS_NS; +using namespace FixConst; + +/* ---------------------------------------------------------------------- */ + +ComputeRHEOSurface::ComputeRHEOSurface(LAMMPS *lmp, int narg, char **arg) : + Fix(lmp, narg, arg) +{ + if (narg < 6) error->all(FLERR,"Illegal fix rheo/surface command"); + + cut = utils::numeric(FLERR,arg[3],false,lmp); + divR_limit = utils::numeric(FLERR,arg[4],false,lmp); + coord_limit = utils::inumeric(FLERR,arg[5],false,lmp); + + divr_flag = 1; + if (narg == 7) { + divr_flag = 0; + } + + int dim = domain->dimension; + + peratom_flag = 1; + size_peratom_cols = dim; + peratom_freq = 1; + + + comm_forward = 2; + comm_reverse = dim*dim + 1; + + cutsq = cut*cut; + + B = nullptr; + gradC = nullptr; + n_surface = nullptr; + + int nall = atom->nlocal + atom->nghost; + nmax = nall; + memory->create(B,nmax,dim*dim,"fix/rheo/surface:B"); + memory->create(gradC,nmax,dim*dim,"fix/rheo/surface:gradC"); + memory->create(n_surface,nmax,dim,"fix/rheo/surface:B"); + array_atom = n_surface; + + compute_kernel = nullptr; + compute_solids = NULL; + fix_rheo = nullptr; +} + +/* ---------------------------------------------------------------------- */ + +ComputeRHEOSurface::~ComputeRHEOSurface() +{ + if (modify->nfix) modify->delete_fix("PROPERTY_ATOM_RHEO_SURFACE"); + + memory->destroy(B); + memory->destroy(gradC); + memory->destroy(n_surface); +} + +void ComputeRHEOSurface::post_constructor() +{ + //Store persistent per atom quantities + char **fixarg = new char*[5]; + fixarg[0] = (char *) "PROPERTY_ATOM_RHEO_SURFACE"; + fixarg[1] = (char *) "all"; + fixarg[2] = (char *) "property/atom"; + fixarg[3] = (char *) "d_divr"; + fixarg[4] = (char *) "d_rsurf"; + modify->add_fix(5,fixarg,1); + + int temp_flag; + index_divr = atom->find_custom("divr", temp_flag); + if ((index_divr < 0) || (temp_flag != 1)) + error->all(FLERR, "Pair rheo/surface can't find fix property/atom divr"); + + index_rsurf = atom->find_custom("rsurf", temp_flag); + if ((index_rsurf < 0) || (temp_flag != 1)) + error->all(FLERR, "Pair rheo/surface can't find fix property/atom rsurf"); + + delete [] fixarg; + divr = atom->dvector[index_divr]; +} +/* ---------------------------------------------------------------------- */ + +int ComputeRHEOSurface::setmask() +{ + int mask = 0; + mask |= PRE_FORCE; + return mask; +} + +/* ---------------------------------------------------------------------- */ + +void ComputeRHEOSurface::init() +{ + // need an occasional full neighbor list + int irequest = neighbor->request(this,instance_me); + neighbor->requests[irequest]->pair = 0; + neighbor->requests[irequest]->fix = 1; + neighbor->requests[irequest]->half = 1; + neighbor->requests[irequest]->full = 0; + + int flag; + int ifix = modify->find_fix_by_style("rheo"); + if (ifix == -1) error->all(FLERR, "Need to define fix rheo to use fix rheo/surface"); + fix_rheo = ((FixRHEO *) modify->fix[ifix]); + compute_kernel = fix_rheo->compute_kernel; + compute_solids = fix_rheo->compute_solids; +} + +/* ---------------------------------------------------------------------- */ + +void ComputeRHEOSurface::setup_pre_force(int /*vflag*/) +{ + pre_force(0); +} + +/* ---------------------------------------------------------------------- */ + +void ComputeRHEOSurface::init_list(int /*id*/, NeighList *ptr) +{ + list = ptr; +} + +/* ---------------------------------------------------------------------- */ + +void ComputeRHEOSurface::pre_force(int /*vflag*/) +{ + int i, j, ii, jj, jnum, a, b, itype, jtype; + double xtmp, ytmp, ztmp, delx, dely, delz, rsq, r, wp, Voli, Volj, rhoi, rhoj; + int *jlist; + double *dWij, *dWji; + double dx[3]; + + divr = atom->dvector[index_divr]; + + // neighbor list variables + int inum, *ilist, *numneigh, **firstneigh; + int nlocal = atom->nlocal; + int nall = nlocal + atom->nghost; + + double **x = atom->x; + int *surface = atom->surface; + int *phase = atom->phase; + double *rsurf = atom->dvector[index_rsurf]; + int newton = force->newton; + int dim = domain->dimension; + int *mask = atom->mask; + int *type = atom->type; + double *mass = atom->mass; + double *rho = atom->rho; + double *temp = atom->temp; + + inum = list->inum; + ilist = list->ilist; + numneigh = list->numneigh; + firstneigh = list->firstneigh; + + if (nmax <= nall) { + nmax = nall; + memory->destroy(B); + memory->destroy(gradC); + memory->destroy(n_surface); + + memory->create(B,nmax,dim*dim,"fix/rheo/surface:B"); + memory->create(gradC,nmax,dim*dim,"fix/rheo/surface:gradC"); + memory->create(n_surface,nmax,dim,"fix/rheo/surface:n_surface"); + array_atom = n_surface; + } + + for (i = 0; i < nall; i++) { + for (a = 0; a < dim; a++) { + for (b = 0; b < dim; b++) { + B[i][a*dim + b] = 0.0; + gradC[i][a*dim + b] = 0.0; + } + n_surface[i][a] = 0.0; + } + divr[i] = 0.0; + surface[i] = 0; + } + + // loop over neighbors to calculate the average orientation of neighbors + for (ii = 0; ii < inum; ii++) { + i = ilist[ii]; + xtmp = x[i][0]; + ytmp = x[i][1]; + ztmp = x[i][2]; + + jlist = firstneigh[i]; + jnum = numneigh[i]; + itype = type[i]; + + for (jj = 0; jj < jnum; jj++) { + j = jlist[jj]; + j &= NEIGHMASK; + + delx = xtmp - x[j][0]; + dely = ytmp - x[j][1]; + delz = ztmp - x[j][2]; + dx[0] = delx; + dx[1] = dely; + dx[2] = delz; + rsq = delx * delx + dely * dely + delz * delz; + if (rsq < cutsq) { + jtype = type[j]; + + rhoi = rho[i]; + rhoj = rho[j]; + + // Add corrections for walls + if (phase[i] <= FixRHEO::FLUID_MAX && phase[j] > FixRHEO::FLUID_MAX) { + rhoj = compute_solids->correct_rho(j,i); + } else if (phase[i] > FixRHEO::FLUID_MAX && phase[j] <= FixRHEO::FLUID_MAX) { + rhoi = compute_solids->correct_rho(i,j); + } else if (phase[i] > FixRHEO::FLUID_MAX && phase[j] > FixRHEO::FLUID_MAX) { + rhoi = 1.0; + rhoj = 1.0; + } + + Voli = mass[itype]/rhoi; + Volj = mass[jtype]/rhoj; + + //compute kernel gradient + wp = compute_kernel->calc_dw_quintic(i, j, delx, dely, delz, sqrt(rsq),compute_kernel->dWij,compute_kernel->dWji); + //wp = compute_kernel->calc_dw(i, j, delx, dely, delz, sqrt(rsq));//,compute_kernel->dWij,compute_kernel->dWji); + + dWij = compute_kernel->dWij; + dWji = compute_kernel->dWji; + + for (a=0; areverse_comm_fix(this); + comm->forward_comm_fix(this); + + int *coordination = compute_kernel->coordination; + // Find the free-surface + //0-bulk 1-surf vicinity 2-surface 3-splash + if (divr_flag) { + for (i = 0; i < nall; i++) { + if (mask[i] & groupbit) { + surface[i] = 0; + rsurf[i] = cut; //Maximum range that can be seen + if (divr[i] < divR_limit) { + surface[i] = 2; + rsurf[i] = 0.0; + if (coordination[i] < coord_limit) surface[i] = 3; + } + } + } + } else { + for (i = 0; i < nall; i++) { + if (mask[i] & groupbit) { + surface[i] = 0; + rsurf[i] = cut; //Maximum range that can be seen + if (coordination[i] < divR_limit) { + surface[i] = 2; + rsurf[i] = 0.0; + if (coordination[i] < coord_limit) surface[i] = 3; + } + } + } + } + + //comm_stage = 1; + //comm_forward = 1; + //comm->forward_comm_fix(this); // communicate free surface particles + + for (ii = 0; ii < inum; ii++) { + i = ilist[ii]; + xtmp = x[i][0]; + ytmp = x[i][1]; + ztmp = x[i][2]; + + jlist = firstneigh[i]; + jnum = numneigh[i]; + + for (jj = 0; jj < jnum; jj++) { + j = jlist[jj]; + j &= NEIGHMASK; + + delx = xtmp - x[j][0]; + dely = ytmp - x[j][1]; + delz = ztmp - x[j][2]; + rsq = delx * delx + dely * dely + delz * delz; + if (rsq < cutsq) { + r = sqrt(rsq); + if (surface[i] == 0 && surface[j] == 2) surface[i] = 1; + if (surface[j] == 0 && surface[i] == 2) surface[j] = 1; + if (surface[j] == 2) rsurf[i] = MIN(rsurf[i], r); + if (surface[i] == 2) rsurf[j] = MIN(rsurf[j], r); + } + } + } + + comm_stage = 1; + comm_reverse = 2; + comm_forward = 2; + if (newton) comm->reverse_comm_fix(this); + comm->forward_comm_fix(this); + + //Now loop again and for each surface particle (2) + // find its neighbors that are bulk (0) and convert to surface vicinity (1) + // if the surface particle has no (0) or (1) neighbors then it is a spash (3) + + //for (ii = 0; ii < inum; ii++) { // is this the right i and j loop for this? + // i = ilist[ii]; + // + // if (surface[i]!=2) continue; //Only consider surface particles + // + // bool nobulkneigh = true; // whether we have no bulk neighbors + // xtmp = x[i][0]; + // ytmp = x[i][1]; + // ztmp = x[i][2]; + // jlist = firstneigh[i]; + // jnum = numneigh[i]; + // + // for (jj = 0; jj < jnum; jj++) { + // j = jlist[jj]; + // j &= NEIGHMASK; + // + // //other surface or splash neighbors do not need labeling + // if (surface[j]>=2){ + // continue; + // } + // + // //check distance criterion rij < h = cutsq/9 for quintic kernel + // delx = xtmp - x[j][0]; + // dely = ytmp - x[j][1]; + // delz = ztmp - x[j][2]; + // dx[0] = 3.0*delx; // multiplied by three here to make criterion rreverse_comm_fix(this); +// +// +// // Now need to invert each B +// int status, s; +// //LU requires a permuation matrix +// gsl_permutation * p = gsl_permutation_alloc(dim); +// for (ii = 0; ii < inum; ii++) { +// i = ilist[ii]; +// if ((surface[i]==0)||(surface[i]==3)){ +// continue; +// } +// +// //Use gsl to get Binv +// //B is not symmteric so we will use a LU decomp +// gsl_matrix_view gB = gsl_matrix_view_array(B[i],dim,dim); +// status = 0; +// status = gsl_linalg_LU_decomp(&gB.matrix,p,&s); //B[i] is now the LU decomp +// // check if decomposition failure +// if (status) { +// fprintf(stderr, "failed, gsl_errno=%d.n", status); +// continue; +// } else { +// gsl_linalg_LU_invx(&gB.matrix,p); //B[i] is now inv(B[i]) +// } +// } +// gsl_permutation_free(p); + double maggC = 0.0; + for (i = 0; i < nlocal; i++) { + if (mask[i] & groupbit) { + maggC=0; + for (a=0;adimension; + int *surface = atom->surface; + double *rsurf = atom->dvector[index_rsurf]; + + m = 0; + last = first + n; + for (i = first; i < last; i++) { + if (comm_stage == 0) { + buf[m++] = divr[i]; + for (a = 0; a < dim; a ++ ) + for (b = 0; b < dim; b ++) + buf[m++] = gradC[i][a*dim + b]; + } else if (comm_stage == 1) { + buf[m++] = (double) surface[i]; + buf[m++] = rsurf[i]; + } else if (comm_stage == 2) { + for (a = 0; a < dim; a ++ ) + for (b = 0; b < dim; b ++) + buf[m++] = B[i][a*dim + b]; + } + } + return m; +} + +/* ---------------------------------------------------------------------- */ + +void ComputeRHEOSurface::unpack_reverse_comm(int n, int *list, double *buf) +{ + int i,a,b,k,j,m; + int dim = domain->dimension; + int *surface = atom->surface; + double *rsurf = atom->dvector[index_rsurf]; + + m = 0; + for (i = 0; i < n; i++) { + j = list[i]; + if (comm_stage == 0) { + divr[j] += buf[m++]; + for (a = 0; a < dim; a ++ ) + for (b = 0; b < dim; b ++) + gradC[j][a*dim + b] += buf[m++]; + } else if (comm_stage == 1) { + int temp = (int) buf[m++]; + surface[j] = MAX(surface[j], temp); + double temp2 = buf[m++]; + rsurf[j] = MIN(rsurf[j], temp2); + } else if (comm_stage == 2) { + for (a = 0; a < dim; a ++ ) + for (b = 0; b < dim; b ++) + B[j][a*dim + b] += buf[m++]; + } + } +} + + +/* ---------------------------------------------------------------------- */ + +int ComputeRHEOSurface::pack_forward_comm(int n, int *list, double *buf, + int /*pbc_flag*/, int * /*pbc*/) +{ + int i,j,a,b,k,m; + int *surface = atom->surface; + double *rsurf = atom->dvector[index_rsurf]; + m = 0; + + for (i = 0; i < n; i++) { + j = list[i]; + if (comm_stage == 0) { + buf[m++] = divr[j]; + } else if (comm_stage == 1) { + buf[m++] = (double) surface[j]; + buf[m++] = rsurf[j]; + } + } + return m; +} + +/* ---------------------------------------------------------------------- */ + +void ComputeRHEOSurface::unpack_forward_comm(int n, int first, double *buf) +{ + int i, k, a, b, m, last; + int *surface = atom->surface; + double *rsurf = atom->dvector[index_rsurf]; + + m = 0; + last = first + n; + for (i = first; i < last; i++) { + if (comm_stage == 0) { + divr[i] = buf[m++]; + } else if (comm_stage == 1) { + surface[i] = (int) buf[m++]; + rsurf[i] = buf[m++]; + } + } +} diff --git a/src/RHEO/compute_rheo_surface.h b/src/RHEO/compute_rheo_surface.h new file mode 100644 index 0000000000..480a8cd8ec --- /dev/null +++ b/src/RHEO/compute_rheo_surface.h @@ -0,0 +1,72 @@ +/* -*- 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 COMPUTE_CLASS +// clang-format off +ComputeStyle(RHEO/SURFACE,ComputeRHEOSurface) +// clang-format on +#else + +#ifndef LMP_COMPUTE_RHEO_INTERFACE_H +#define LMP_COMPUTE_RHEO_INTERFACE_H + +#include "compute.h" + +namespace LAMMPS_NS { + +class ComputeRHEOSurface : public Compute { + public: + ComputeRHEOSurface(class LAMMPS *, int, char **); + ~ComputeRHEOSurface(); + void init() override; + void init_list(int, class NeighList *) override; + void compute_peratom() override; + int pack_reverse_comm(int, int, double *) override; + void unpack_reverse_comm(int, int *, double *) override; + int pack_forward_comm(int, int *, double *, int, int *) override; + void unpack_forward_comm(int, int, double *) override; + + double **gradC, **n_surface; + + private: + double cut, cutsq, threshold; + int surface_style, nmax_old; + double **B, *divr; + int comm_stage; + + int index_divr; + int index_rsurf; + + double divR_limit; + int coord_limit; + + class NeighList *list; + class FixRHEO *fix_rheo; + class ComputeRHEOKernel *compute_kernel; + class ComputeRHEOSolids *compute_solids; +}; + +} + +#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. + +*/ diff --git a/src/RHEO/compute_rheo_vshift.h b/src/RHEO/compute_rheo_vshift.h index af5675fd8d..e76476e7fd 100644 --- a/src/RHEO/compute_rheo_vshift.h +++ b/src/RHEO/compute_rheo_vshift.h @@ -13,7 +13,7 @@ #ifdef COMPUTE_CLASS // clang-format off -ComputeStyle(rheo/vshift,ComputeRHEOVShift) +ComputeStyle(RHEO/VSHIFT,ComputeRHEOVShift) // clang-format on #else diff --git a/src/RHEO/fix_rheo.cpp b/src/RHEO/fix_rheo.cpp index e83a95751a..8fc48c0b3b 100644 --- a/src/RHEO/fix_rheo.cpp +++ b/src/RHEO/fix_rheo.cpp @@ -88,12 +88,24 @@ FixRHEO::FixRHEO(LAMMPS *lmp, int narg, char **arg) : thermal_flag = 1; } else if (strcmp(arg[iarg],"surface/detection") == 0) { surface_flag = 1; + if(iarg + 2 >= narg) error->all(FLERR,"Illegal surface/detection option in fix rheo"); + if (strcmp(arg[iarg + 1], "coordination")) { + surface_style = COORDINATION; + zmin_surface = utils::inumeric(FLERR,arg[iarg + 2],false,lmp); + } else if (strcmp(arg[iarg + 1], "divergence")) { + surface_style = DIVR; + divr_surface = utils::numeric(FLERR,arg[iarg + 2],false,lmp); + } else { + error->all(FLERR,"Illegal surface/detection option in fix rheo, {}", arg[iarg + 1]); + } + + iarg += 2; } else if (strcmp(arg[iarg],"interface/reconstruction") == 0) { interface_flag = 1; } else if (strcmp(arg[iarg],"rhosum") == 0) { rhosum_flag = 1; if(iarg + 1 >= narg) error->all(FLERR,"Illegal rhosum option in fix rheo"); - zmin_rhosum = utils::inumeric(FLERR,arg[iarg + 1],false,lmp); + rhosum_zmin = utils::inumeric(FLERR,arg[iarg + 1],false,lmp); iarg += 1; } else if (strcmp(arg[iarg],"rho0") == 0) { if(iarg + 1 >= narg) error->all(FLERR,"Illegal rho0 option in fix rheo"); @@ -117,6 +129,7 @@ FixRHEO::~FixRHEO() if (compute_kernel) modify->delete_compute("rheo_kernel"); if (compute_grad) modify->delete_compute("rheo_grad"); if (compute_interface) modify->delete_compute("rheo_interface"); + if (compute_surface) modify->delete_compute("compute_surface"); if (compute_rhosum) modify->delete_compute("rheo_rhosum"); if (compute_vshift) modify->delete_compute("rheo_vshift"); } @@ -128,28 +141,33 @@ FixRHEO::~FixRHEO() void FixRHEO::post_constructor() { - compute_kernel = dynamic_cast(modify->add_compute("rheo_kernel all rheo/kernel")); + compute_kernel = dynamic_cast(modify->add_compute("rheo_kernel all RHEO/KERNEL")); compute_kernel->fix_rheo = this; - std::string cmd = "rheo_grad all rheo/grad velocity rho viscosity"; + std::string cmd = "rheo_grad all RHEO/GRAD velocity rho viscosity"; if (thermal_flag) cmd += "temperature"; compute_grad = dynamic_cast(modify->add_compute(cmd)); compute_grad->fix_rheo = this; if (rhosum_flag) { - compute_rhosum = dynamic_cast(modify->add_compute("rheo_rhosum all rheo/rho/sum")); + compute_rhosum = dynamic_cast(modify->add_compute("rheo_rhosum all RHEO/RHO/SUM")); compute_rhosum->fix_rheo = this; } if (shift_flag) { - compute_vshift = dynamic_cast(modify->add_compute("rheo_vshift all rheo/vshift")); + compute_vshift = dynamic_cast(modify->add_compute("rheo_vshift all RHEO/VSHIFT")); compute_vshift->fix_rheo = this; } if (interface_flag) { - compute_interface = dynamic_cast(modify->add_compute(fmt::format("rheo_interface all rheo/interface"))); + compute_interface = dynamic_cast(modify->add_compute(fmt::format("rheo_interface all RHEO/INTERFACE"))); compute_interface->fix_rheo = this; } + + if (surface_flag) { + compute_surface = dynamic_cast(modify->add_compute(fmt::format("rheo_surface all RHEO/SURFACE"))); + compute_surface->fix_rheo = this; + } } /* ---------------------------------------------------------------------- */ @@ -180,10 +198,11 @@ void FixRHEO::setup_pre_force(int /*vflag*/) { // Check to confirm accessory fixes do not preceed FixRHEO // Note: these fixes set this flag in setup_pre_force() - if (viscosity_fix_defined || pressure_fix_defined || thermal_fix_defined || surface_fix_defined) + if (viscosity_fix_defined || pressure_fix_defined || thermal_fix_defined) error->all(FLERR, "Fix RHEO must be defined before all other RHEO fixes"); - pre_force(0); + // Calculate surfaces + if (surface_flag) compute_surface->compute_peratom(); } /* ---------------------------------------------------------------------- */ @@ -201,14 +220,10 @@ void FixRHEO::setup() if(!thermal_fix_defined && thermal_flag) error->all(FLERR, "Missing fix rheo/thermal"); - if(!surface_fix_defined && surface_flag) - error->all(FLERR, "Missing fix rheo/surface"); - // Reset to zero for next run thermal_fix_defined = 0; viscosity_fix_defined = 0; pressure_fix_defined = 0; - surface_fix_defined = 0; // Check fixes cover all atoms (doesnt ensure user covers atoms created midrun) // (pressure is currently required to be group all) @@ -259,7 +274,8 @@ void FixRHEO::initial_integrate(int /*vflag*/) double **gradr = compute_grad->gradr; double **gradv = compute_grad->gradv; - double **vshift = compute_vshift->vshift; + double **vshift; + if (shift_flag) compute_vshift->vshift; int *type = atom->type; int *mask = atom->mask; @@ -287,8 +303,11 @@ void FixRHEO::initial_integrate(int /*vflag*/) // Update gradients and interpolate solid properties compute_grad->forward_fields(); // also forwards v and rho for chi - compute_interface->store_forces(); // Need to save, wiped in exchange - compute_interface->compute_peratom(); + if (interface_flag) { + // Need to save, wiped in exchange + compute_interface->store_forces(); + compute_interface->compute_peratom(); + } compute_grad->compute_peratom(); // Position half-step @@ -350,7 +369,7 @@ void FixRHEO::pre_force(int /*vflag*/) compute_grad->forward_fields(); // also forwards v and rho for chi compute_kernel->compute_peratom(); - compute_interface->compute_peratom(); + if (interface_flag) compute_interface->compute_peratom(); compute_grad->compute_peratom(); compute_grad->forward_gradients(); @@ -369,6 +388,9 @@ void FixRHEO::pre_force(int /*vflag*/) status[i] &= ~STATUS_SHIFT; } } + + // Calculate surfaces, update status + if (surface_flag) compute_surface->compute_peratom(); } /* ---------------------------------------------------------------------- */ diff --git a/src/RHEO/fix_rheo.h b/src/RHEO/fix_rheo.h index 89304fe22f..d2097ade71 100644 --- a/src/RHEO/fix_rheo.h +++ b/src/RHEO/fix_rheo.h @@ -40,9 +40,11 @@ class FixRHEO : public Fix { // Model parameters double h, rho0, csq; - int zmin_kernel, rhosum_zmin; - int kernel_style; + int zmin_kernel, zmin_rhosum, zmin_surface; + int kernel_style, surface_style; + double divr_surface; enum {QUINTIC, CRK0, CRK1, CRK2}; + enum {COORDINATION, DIVR}; // Status variables enum { @@ -75,8 +77,6 @@ class FixRHEO : public Fix { int viscosity_fix_defined; int pressure_fix_defined; int thermal_fix_defined; - int interface_fix_defined; - int surface_fix_defined; class ComputeRHEOGrad *compute_grad; class ComputeRHEOKernel *compute_kernel; From a4d971df526e71f04a8de31b642ddd512100e89c Mon Sep 17 00:00:00 2001 From: jtclemm Date: Thu, 20 Apr 2023 14:45:35 -0600 Subject: [PATCH 024/158] Updating surface compute --- src/RHEO/compute_rheo_grad.cpp | 2 +- src/RHEO/compute_rheo_interface.cpp | 1 - src/RHEO/compute_rheo_kernel.cpp | 12 +- src/RHEO/compute_rheo_surface.cpp | 528 ++++++++++------------------ src/RHEO/compute_rheo_surface.h | 13 +- src/RHEO/compute_rheo_vshift.cpp | 2 +- src/RHEO/fix_rheo.cpp | 2 +- src/RHEO/fix_rheo_thermal.cpp | 4 +- src/RHEO/pair_rheo.cpp | 4 +- 9 files changed, 195 insertions(+), 373 deletions(-) diff --git a/src/RHEO/compute_rheo_grad.cpp b/src/RHEO/compute_rheo_grad.cpp index 31f60550c1..add3ed712d 100644 --- a/src/RHEO/compute_rheo_grad.cpp +++ b/src/RHEO/compute_rheo_grad.cpp @@ -38,7 +38,7 @@ enum{COMMGRAD, COMMFIELD}; /* ---------------------------------------------------------------------- */ ComputeRHEOGrad::ComputeRHEOGrad(LAMMPS *lmp, int narg, char **arg) : - Compute(lmp, narg, arg), fix_rheo(nullptr), compute_interface(nullptr), compute_kernel(nullptr), + Compute(lmp, narg, arg), fix_rheo(nullptr), list(nullptr), compute_interface(nullptr), compute_kernel(nullptr), gradv(nullptr), gradr(nullptr), gradt(nullptr), gradn(nullptr) { if (narg < 4) error->all(FLERR,"Illegal compute rheo/grad command"); diff --git a/src/RHEO/compute_rheo_interface.cpp b/src/RHEO/compute_rheo_interface.cpp index 55cb81382b..059f4057f4 100644 --- a/src/RHEO/compute_rheo_interface.cpp +++ b/src/RHEO/compute_rheo_interface.cpp @@ -84,7 +84,6 @@ void ComputeRHEOInterface::init() // Do not create grow callback as there's no reason to copy/exchange data // Manually grow if nmax_old exceeded - int create_flag = 0; int tmp1, tmp2; int nmax = atom->nmax; int index = atom->find_custom("rheo_chi", tmp1, tmp2); diff --git a/src/RHEO/compute_rheo_kernel.cpp b/src/RHEO/compute_rheo_kernel.cpp index ac9ea75fc4..2fd189e1e4 100644 --- a/src/RHEO/compute_rheo_kernel.cpp +++ b/src/RHEO/compute_rheo_kernel.cpp @@ -55,7 +55,7 @@ Move away from h notation, use cut? ComputeRHEOKernel::ComputeRHEOKernel(LAMMPS *lmp, int narg, char **arg) : Compute(lmp, narg, arg), - C(nullptr), C0(nullptr), coordination(nullptr), compute_interface(nullptr) + list(nullptr), C(nullptr), C0(nullptr), coordination(nullptr), compute_interface(nullptr) { if (narg != 3) error->all(FLERR,"Illegal compute rheo/kernel command"); @@ -137,18 +137,18 @@ void ComputeRHEOKernel::init() ncor = 0; Mdim = 0; if (kernel_type == CRK0) { - memory->create(C0, nmax, "rheo/kernel:C0"); + memory->create(C0, nmax_old, "rheo/kernel:C0"); } else if (kernel_type == CRK1) { Mdim = 1 + dim; ncor = 1 + dim; - memory->create(C, nmax, ncor, Mdim, "rheo/kernel:C"); + memory->create(C, nmax_old, ncor, Mdim, "rheo/kernel:C"); comm_forward = ncor * Mdim; } else if (kernel_type == CRK2) { //Polynomial basis size (up to quadratic order) Mdim = 1 + dim + dim * (dim + 1) / 2; //Number of sets of correction coefficients (1 x y xx yy) + z zz (3D) ncor = 1 + 2 * dim; - memory->create(C, nmax, ncor, Mdim, "rheo/kernel:C"); + memory->create(C, nmax_old, ncor, Mdim, "rheo/kernel:C"); comm_forward = ncor * Mdim; } } @@ -491,7 +491,7 @@ void ComputeRHEOKernel::compute_peratom() gsl_error_flag = 0; gsl_error_tags.clear(); - int i, j, ii, jj, jnum, g, a, b, gsl_error; + int i, j, ii, jj, inum, jnum, g, a, b, gsl_error; double xtmp, ytmp, ztmp, r, rsq, w, vj; double dx[3]; gsl_matrix_view gM; @@ -506,7 +506,7 @@ void ComputeRHEOKernel::compute_peratom() int *status = atom->status; tagint *tag = atom->tag; - int inum, *ilist, *jlist, *numneigh, **firstneigh; + int *ilist, *jlist, *numneigh, **firstneigh; inum = list->inum; ilist = list->ilist; numneigh = list->numneigh; diff --git a/src/RHEO/compute_rheo_surface.cpp b/src/RHEO/compute_rheo_surface.cpp index dff5db4cfa..5b3aeabf26 100644 --- a/src/RHEO/compute_rheo_surface.cpp +++ b/src/RHEO/compute_rheo_surface.cpp @@ -18,135 +18,97 @@ #include "compute_rheo_surface.h" -#include "fix_rheo.h" -#include "compute_rheo_kernel.h" -#include "compute_rheo_solids.h" -#include "atom.h" -#include "memory.h" #include "atom.h" #include "comm.h" -#include "modify.h" +#include "compute_rheo_kernel.h" +#include "compute_rheo_solids.h" +#include "domain.h" +#include "error.h" +#include "fix_rheo.h" +#include "force.h" +#include "math_extra.h" +#include "memory.h" #include "neighbor.h" #include "neigh_list.h" #include "neigh_request.h" -#include "error.h" -#include "force.h" -#include "domain.h" using namespace LAMMPS_NS; using namespace FixConst; +using namespace MathExtra; + +#define epsilon 1e-10; /* ---------------------------------------------------------------------- */ ComputeRHEOSurface::ComputeRHEOSurface(LAMMPS *lmp, int narg, char **arg) : - Fix(lmp, narg, arg) + Fix(lmp, narg, arg), fix_rheo(nullptr), list(nullptr), compute_kernel(nullptr), compute_solids(nullptr), + B(nullptr), gradC(nullptr), nsurface(nullptr), divr(nullptr), rsurface(nullptr) { - if (narg < 6) error->all(FLERR,"Illegal fix rheo/surface command"); - - cut = utils::numeric(FLERR,arg[3],false,lmp); - divR_limit = utils::numeric(FLERR,arg[4],false,lmp); - coord_limit = utils::inumeric(FLERR,arg[5],false,lmp); - - divr_flag = 1; - if (narg == 7) { - divr_flag = 0; - } + if (narg != 3) error->all(FLERR,"Illegal fix RHEO/SURFACE command"); int dim = domain->dimension; - - peratom_flag = 1; - size_peratom_cols = dim; - peratom_freq = 1; - - comm_forward = 2; - comm_reverse = dim*dim + 1; - - cutsq = cut*cut; - - B = nullptr; - gradC = nullptr; - n_surface = nullptr; - - int nall = atom->nlocal + atom->nghost; - nmax = nall; - memory->create(B,nmax,dim*dim,"fix/rheo/surface:B"); - memory->create(gradC,nmax,dim*dim,"fix/rheo/surface:gradC"); - memory->create(n_surface,nmax,dim,"fix/rheo/surface:B"); - array_atom = n_surface; - - compute_kernel = nullptr; - compute_solids = NULL; - fix_rheo = nullptr; + comm_reverse = dim * dim + 1; } /* ---------------------------------------------------------------------- */ ComputeRHEOSurface::~ComputeRHEOSurface() { - if (modify->nfix) modify->delete_fix("PROPERTY_ATOM_RHEO_SURFACE"); + // Remove custom property if it exists + int tmp1, tmp2, index; + index = atom->find_custom("rheo_divr", tmp1, tmp2); + if (index != -1) atom->remove_custom(index, 1, 0); + + index = atom->find_custom("rheo_rsurface", tmp1, tmp2); + if (index != -1) atom->remove_custom(index, 1, 0); + + index = atom->find_custom("rheo_nsurface", tmp1, tmp2); + if (index != -1) atom->remove_custom(index, 1, 3); memory->destroy(B); memory->destroy(gradC); - memory->destroy(n_surface); -} - -void ComputeRHEOSurface::post_constructor() -{ - //Store persistent per atom quantities - char **fixarg = new char*[5]; - fixarg[0] = (char *) "PROPERTY_ATOM_RHEO_SURFACE"; - fixarg[1] = (char *) "all"; - fixarg[2] = (char *) "property/atom"; - fixarg[3] = (char *) "d_divr"; - fixarg[4] = (char *) "d_rsurf"; - modify->add_fix(5,fixarg,1); - - int temp_flag; - index_divr = atom->find_custom("divr", temp_flag); - if ((index_divr < 0) || (temp_flag != 1)) - error->all(FLERR, "Pair rheo/surface can't find fix property/atom divr"); - - index_rsurf = atom->find_custom("rsurf", temp_flag); - if ((index_rsurf < 0) || (temp_flag != 1)) - error->all(FLERR, "Pair rheo/surface can't find fix property/atom rsurf"); - - delete [] fixarg; - divr = atom->dvector[index_divr]; -} -/* ---------------------------------------------------------------------- */ - -int ComputeRHEOSurface::setmask() -{ - int mask = 0; - mask |= PRE_FORCE; - return mask; } /* ---------------------------------------------------------------------- */ void ComputeRHEOSurface::init() { - // need an occasional full neighbor list - int irequest = neighbor->request(this,instance_me); - neighbor->requests[irequest]->pair = 0; - neighbor->requests[irequest]->fix = 1; - neighbor->requests[irequest]->half = 1; - neighbor->requests[irequest]->full = 0; - - int flag; - int ifix = modify->find_fix_by_style("rheo"); - if (ifix == -1) error->all(FLERR, "Need to define fix rheo to use fix rheo/surface"); - fix_rheo = ((FixRHEO *) modify->fix[ifix]); compute_kernel = fix_rheo->compute_kernel; compute_solids = fix_rheo->compute_solids; -} + cut = fix_rheo->cut; + rho0 = fix_rheo->rho0; + threshold_style = fix_rheo->surface_style; + threshold_divr = fix_rheo->divrsurface; + threshold_z = fix_rheo->zminsurface; -/* ---------------------------------------------------------------------- */ + cutsq = cut * cut; -void ComputeRHEOSurface::setup_pre_force(int /*vflag*/) -{ - pre_force(0); + // Create rsurface, divr, nsurface arrays if they don't already exist + // Create a custom atom property so it works with compute property/atom + // Do not create grow callback as there's no reason to copy/exchange data + // Manually grow if nmax_old exceeded + // For B and gradC, create a local array since they are unlikely to be printed + + int tmp1, tmp2; + int index = atom->find_custom("rheo_divr", tmp1, tmp2); + if (index == -1) index = atom->add_custom("rheo_divr", 1, 0); + divr = atom->dvector[index]; + + index = atom->find_custom("rheo_rsurface", tmp1, tmp2); + if (index == -1) index = atom->add_custom("rheo_rsurface", 1, 0); + rsurface = atom->dvector[index]; + + index = atom->find_custom("rheo_nsurface", tmp1, tmp2); + if (index == -1) index = atom->add_custom("rheo_nsurface", 1, 3); + nsurface = atom->darray[index]; + + nmax_old = atom->nmax; + memory->create(B, nmax_old, dim * dim, "rheo/surface:B"); + memory->create(gradC, nmax_old, dim * dim, "rheo/surface:gradC"); + + // need an occasional half neighbor list + neighbor->add_request(this, NeighConst::REQ_HALF); } /* ---------------------------------------------------------------------- */ @@ -158,60 +120,56 @@ void ComputeRHEOSurface::init_list(int /*id*/, NeighList *ptr) /* ---------------------------------------------------------------------- */ -void ComputeRHEOSurface::pre_force(int /*vflag*/) +void ComputeRHEOSurface::compute_peratom() { - int i, j, ii, jj, jnum, a, b, itype, jtype; - double xtmp, ytmp, ztmp, delx, dely, delz, rsq, r, wp, Voli, Volj, rhoi, rhoj; - int *jlist; + int i, j, ii, jj, inum, jnum, a, b, itype, jtype, fluidi, fluidj; + double xtmp, ytmp, ztmp, rsq, Voli, Volj, rhoi, rhoj; double *dWij, *dWji; double dx[3]; + int *ilist, *jlist, *numneigh, **firstneigh; - divr = atom->dvector[index_divr]; - - // neighbor list variables - int inum, *ilist, *numneigh, **firstneigh; int nlocal = atom->nlocal; - int nall = nlocal + atom->nghost; double **x = atom->x; - int *surface = atom->surface; - int *phase = atom->phase; - double *rsurf = atom->dvector[index_rsurf]; + int *status = atom->status; int newton = force->newton; int dim = domain->dimension; int *mask = atom->mask; int *type = atom->type; double *mass = atom->mass; double *rho = atom->rho; - double *temp = atom->temp; + int *coordination = compute_kernel->coordination; inum = list->inum; ilist = list->ilist; numneigh = list->numneigh; firstneigh = list->firstneigh; - if (nmax <= nall) { - nmax = nall; - memory->destroy(B); - memory->destroy(gradC); - memory->destroy(n_surface); + int nmax = atom->nmax; + if (nmax_old <= nmax) { + memory->grow(divr, nmax, "atom:rheo_divr"); + memory->grow(rsurface, nmax, "atom:rheo_rsurface"); + memory->grow(nsurface, nmax, 3, "atom:rheo_nsurface"); - memory->create(B,nmax,dim*dim,"fix/rheo/surface:B"); - memory->create(gradC,nmax,dim*dim,"fix/rheo/surface:gradC"); - memory->create(n_surface,nmax,dim,"fix/rheo/surface:n_surface"); - array_atom = n_surface; + memory->grow(B, nmax, dim * dim, "rheo/surface:B"); + memory->grow(gradC, nmax, dim * dim, "rheo/surface:gradC"); + + nmax_old = atom->nmax; } + int nall = nlocal + atom->nghost; for (i = 0; i < nall; i++) { for (a = 0; a < dim; a++) { for (b = 0; b < dim; b++) { - B[i][a*dim + b] = 0.0; - gradC[i][a*dim + b] = 0.0; + B[i][a * dim + b] = 0.0; + gradC[i][a * dim + b] = 0.0; } - n_surface[i][a] = 0.0; + nsurface[i][a] = 0.0; } divr[i] = 0.0; - surface[i] = 0; + + // Remove surface settings + status[i] &= FixRHEO::surfacemask; } // loop over neighbors to calculate the average orientation of neighbors @@ -224,98 +182,105 @@ void ComputeRHEOSurface::pre_force(int /*vflag*/) jlist = firstneigh[i]; jnum = numneigh[i]; itype = type[i]; + fluidi = status[i] & FixRHEO::STATUS_FLUID; for (jj = 0; jj < jnum; jj++) { j = jlist[jj]; j &= NEIGHMASK; - delx = xtmp - x[j][0]; - dely = ytmp - x[j][1]; - delz = ztmp - x[j][2]; - dx[0] = delx; - dx[1] = dely; - dx[2] = delz; - rsq = delx * delx + dely * dely + delz * delz; + dx[0] = xtmp - x[j][0]; + dx[1] = ytmp - x[j][1]; + dx[2] = ztmp - x[j][2]; + + rsq = lensq(dx); if (rsq < cutsq) { jtype = type[j]; + fluidj = status[j] & FixRHEO::STATUS_FLUID; rhoi = rho[i]; rhoj = rho[j]; // Add corrections for walls - if (phase[i] <= FixRHEO::FLUID_MAX && phase[j] > FixRHEO::FLUID_MAX) { - rhoj = compute_solids->correct_rho(j,i); - } else if (phase[i] > FixRHEO::FLUID_MAX && phase[j] <= FixRHEO::FLUID_MAX) { - rhoi = compute_solids->correct_rho(i,j); - } else if (phase[i] > FixRHEO::FLUID_MAX && phase[j] > FixRHEO::FLUID_MAX) { - rhoi = 1.0; - rhoj = 1.0; + if (fluidi && (!fluidj)) { + rhoj = compute_solids->correct_rho(j, i); + } else if ((!fluidi) && fluidj) { + rhoi = compute_solids->correct_rho(i, j); + } else if ((!fluidi) && (!fluidj)) { + rhoi = rho0; + rhoj = rho0; } - Voli = mass[itype]/rhoi; - Volj = mass[jtype]/rhoj; + Voli = mass[itype] / rhoi; + Volj = mass[jtype] / rhoj; - //compute kernel gradient - wp = compute_kernel->calc_dw_quintic(i, j, delx, dely, delz, sqrt(rsq),compute_kernel->dWij,compute_kernel->dWji); - //wp = compute_kernel->calc_dw(i, j, delx, dely, delz, sqrt(rsq));//,compute_kernel->dWij,compute_kernel->dWji); + wp = compute_kernel->calc_dw_quintic(i, j, dx[0], dx[1], dx[2], sqrt(rsq),dWij, dWji); - dWij = compute_kernel->dWij; - dWji = compute_kernel->dWji; - - for (a=0; areverse_comm_fix(this); - comm->forward_comm_fix(this); + comm_reverse = dim * dim + 1; + comm_forward = 1; + if (newton) comm->reverse_comm(this); + comm->forward_comm(this); + + // calculate nsurface for local atoms + // Note, this isn't forwarded to ghosts + double maggC; + for (i = 0; i < nlocal; i++) { + if (mask[i] & groupbit) { + maggC = 0.0; + for (a = 0;a < dim; a++) + maggC += gradC[i][a] * gradC[i][a]; + maggC = sqrt(maggC) + EPSILON; + maggC = 1.0 / maggC; + for (a = 0; a < dim; a++) + nsurface[i][a] = -gradC[i][a] * maggC; + } + } - int *coordination = compute_kernel->coordination; // Find the free-surface - //0-bulk 1-surf vicinity 2-surface 3-splash - if (divr_flag) { + if (threshold_style == FixRHEO::DIVR) { for (i = 0; i < nall; i++) { if (mask[i] & groupbit) { - surface[i] = 0; - rsurf[i] = cut; //Maximum range that can be seen - if (divr[i] < divR_limit) { - surface[i] = 2; - rsurf[i] = 0.0; - if (coordination[i] < coord_limit) surface[i] = 3; + status[i] |= FixRHEO::STATUS_BULK; + rsurface[i] = cut; + if (divr[i] < threshold_divr) { + status[i] |= FixRHEO::STATUS_SURFACE; + rsurface[i] = 0.0; + if (coordination[i] < threshold_z) + status[i] |= FixRHEO::STATUS_SPLASH; } } } } else { for (i = 0; i < nall; i++) { if (mask[i] & groupbit) { - surface[i] = 0; - rsurf[i] = cut; //Maximum range that can be seen + status[i] |= FixRHEO::STATUS_BULK; + rsurface[i] = cut; if (coordination[i] < divR_limit) { - surface[i] = 2; - rsurf[i] = 0.0; - if (coordination[i] < coord_limit) surface[i] = 3; + status[i] |= FixRHEO::STATUS_SURFACE; + rsurface[i] = 0.0; + if (coordination[i] < threshold_z) + status[i] |= FixRHEO::STATUS_SPLASH; } } } } - //comm_stage = 1; - //comm_forward = 1; - //comm->forward_comm_fix(this); // communicate free surface particles - for (ii = 0; ii < inum; ii++) { i = ilist[ii]; xtmp = x[i][0]; @@ -329,167 +294,37 @@ void ComputeRHEOSurface::pre_force(int /*vflag*/) j = jlist[jj]; j &= NEIGHMASK; - delx = xtmp - x[j][0]; - dely = ytmp - x[j][1]; - delz = ztmp - x[j][2]; - rsq = delx * delx + dely * dely + delz * delz; + dx[0] = xtmp - x[j][0]; + dx[1] = ytmp - x[j][1]; + dx[2] = ztmp - x[j][2]; + rsq = lensq(dx); if (rsq < cutsq) { - r = sqrt(rsq); - if (surface[i] == 0 && surface[j] == 2) surface[i] = 1; - if (surface[j] == 0 && surface[i] == 2) surface[j] = 1; - if (surface[j] == 2) rsurf[i] = MIN(rsurf[i], r); - if (surface[i] == 2) rsurf[j] = MIN(rsurf[j], r); + if ((status[i] & FixRHEO::STATUS_BULK) && (status[j] & FixRHEO::STATUS_SURFACE)) { + status[i] &= FixRHEO::surfacemask; + status[i] |= FixRHEO::STATUS_LAYER; + } + + if (status[j] & FixRHEO::STATUS_SURFACE) rsurface[i] = MIN(rsurface[i], sqrt(rsq)); + + + if (j < nlocal || newton) { + if ((status[j] & FixRHEO::STATUS_BULK) && (status[i] & FixRHEO::STATUS_SURFACE)) { + status[j] &= FixRHEO::surfacemask; + status[j] |= FixRHEO::STATUS_LAYER; + } + + if (status[i] & FixRHEO::STATUS_SURFACE) rsurface[j] = MIN(rsurface[j], sqrt(rsq)); + } } } } + // forward/reverse status and rsurface comm_stage = 1; comm_reverse = 2; comm_forward = 2; - if (newton) comm->reverse_comm_fix(this); - comm->forward_comm_fix(this); - - //Now loop again and for each surface particle (2) - // find its neighbors that are bulk (0) and convert to surface vicinity (1) - // if the surface particle has no (0) or (1) neighbors then it is a spash (3) - - //for (ii = 0; ii < inum; ii++) { // is this the right i and j loop for this? - // i = ilist[ii]; - // - // if (surface[i]!=2) continue; //Only consider surface particles - // - // bool nobulkneigh = true; // whether we have no bulk neighbors - // xtmp = x[i][0]; - // ytmp = x[i][1]; - // ztmp = x[i][2]; - // jlist = firstneigh[i]; - // jnum = numneigh[i]; - // - // for (jj = 0; jj < jnum; jj++) { - // j = jlist[jj]; - // j &= NEIGHMASK; - // - // //other surface or splash neighbors do not need labeling - // if (surface[j]>=2){ - // continue; - // } - // - // //check distance criterion rij < h = cutsq/9 for quintic kernel - // delx = xtmp - x[j][0]; - // dely = ytmp - x[j][1]; - // delz = ztmp - x[j][2]; - // dx[0] = 3.0*delx; // multiplied by three here to make criterion rreverse_comm_fix(this); -// -// -// // Now need to invert each B -// int status, s; -// //LU requires a permuation matrix -// gsl_permutation * p = gsl_permutation_alloc(dim); -// for (ii = 0; ii < inum; ii++) { -// i = ilist[ii]; -// if ((surface[i]==0)||(surface[i]==3)){ -// continue; -// } -// -// //Use gsl to get Binv -// //B is not symmteric so we will use a LU decomp -// gsl_matrix_view gB = gsl_matrix_view_array(B[i],dim,dim); -// status = 0; -// status = gsl_linalg_LU_decomp(&gB.matrix,p,&s); //B[i] is now the LU decomp -// // check if decomposition failure -// if (status) { -// fprintf(stderr, "failed, gsl_errno=%d.n", status); -// continue; -// } else { -// gsl_linalg_LU_invx(&gB.matrix,p); //B[i] is now inv(B[i]) -// } -// } -// gsl_permutation_free(p); - double maggC = 0.0; - for (i = 0; i < nlocal; i++) { - if (mask[i] & groupbit) { - maggC=0; - for (a=0;areverse_comm(this); + comm->forward_comm(this); } /* ---------------------------------------------------------------------- */ @@ -498,8 +333,7 @@ int ComputeRHEOSurface::pack_reverse_comm(int n, int first, double *buf) { int i,a,b,k,m,last; int dim = domain->dimension; - int *surface = atom->surface; - double *rsurf = atom->dvector[index_rsurf]; + int *status = atom->status; m = 0; last = first + n; @@ -508,14 +342,10 @@ int ComputeRHEOSurface::pack_reverse_comm(int n, int first, double *buf) buf[m++] = divr[i]; for (a = 0; a < dim; a ++ ) for (b = 0; b < dim; b ++) - buf[m++] = gradC[i][a*dim + b]; + buf[m++] = gradC[i][a * dim + b]; } else if (comm_stage == 1) { - buf[m++] = (double) surface[i]; - buf[m++] = rsurf[i]; - } else if (comm_stage == 2) { - for (a = 0; a < dim; a ++ ) - for (b = 0; b < dim; b ++) - buf[m++] = B[i][a*dim + b]; + buf[m++] = (double) status[i]; + buf[m++] = rsurface[i]; } } return m; @@ -527,8 +357,8 @@ void ComputeRHEOSurface::unpack_reverse_comm(int n, int *list, double *buf) { int i,a,b,k,j,m; int dim = domain->dimension; - int *surface = atom->surface; - double *rsurf = atom->dvector[index_rsurf]; + int *status = atom->status; + int temp; m = 0; for (i = 0; i < n; i++) { @@ -537,16 +367,14 @@ void ComputeRHEOSurface::unpack_reverse_comm(int n, int *list, double *buf) divr[j] += buf[m++]; for (a = 0; a < dim; a ++ ) for (b = 0; b < dim; b ++) - gradC[j][a*dim + b] += buf[m++]; + gradC[j][a * dim + b] += buf[m++]; } else if (comm_stage == 1) { - int temp = (int) buf[m++]; - surface[j] = MAX(surface[j], temp); - double temp2 = buf[m++]; - rsurf[j] = MIN(rsurf[j], temp2); - } else if (comm_stage == 2) { - for (a = 0; a < dim; a ++ ) - for (b = 0; b < dim; b ++) - B[j][a*dim + b] += buf[m++]; + + temp = (int) buf[m++]; + if ((status[j] & FixRHEO::STATUS_BULK) && (temp & FixRHEO::STATUS_LAYER)) + status[j] = temp; + + rsurface[j] = MIN(rsurface[j], buf[m++]); } } } @@ -558,8 +386,7 @@ int ComputeRHEOSurface::pack_forward_comm(int n, int *list, double *buf, int /*pbc_flag*/, int * /*pbc*/) { int i,j,a,b,k,m; - int *surface = atom->surface; - double *rsurf = atom->dvector[index_rsurf]; + int *status = atom->status; m = 0; for (i = 0; i < n; i++) { @@ -567,8 +394,8 @@ int ComputeRHEOSurface::pack_forward_comm(int n, int *list, double *buf, if (comm_stage == 0) { buf[m++] = divr[j]; } else if (comm_stage == 1) { - buf[m++] = (double) surface[j]; - buf[m++] = rsurf[j]; + buf[m++] = (double) status[j]; + buf[m++] = rsurface[j]; } } return m; @@ -579,8 +406,7 @@ int ComputeRHEOSurface::pack_forward_comm(int n, int *list, double *buf, void ComputeRHEOSurface::unpack_forward_comm(int n, int first, double *buf) { int i, k, a, b, m, last; - int *surface = atom->surface; - double *rsurf = atom->dvector[index_rsurf]; + int *status = atom->status; m = 0; last = first + n; @@ -588,8 +414,8 @@ void ComputeRHEOSurface::unpack_forward_comm(int n, int first, double *buf) if (comm_stage == 0) { divr[i] = buf[m++]; } else if (comm_stage == 1) { - surface[i] = (int) buf[m++]; - rsurf[i] = buf[m++]; + status[i] = (int) buf[m++]; + rsurface[i] = buf[m++]; } } } diff --git a/src/RHEO/compute_rheo_surface.h b/src/RHEO/compute_rheo_surface.h index 480a8cd8ec..8d0b681c6f 100644 --- a/src/RHEO/compute_rheo_surface.h +++ b/src/RHEO/compute_rheo_surface.h @@ -36,16 +36,13 @@ class ComputeRHEOSurface : public Compute { int pack_forward_comm(int, int *, double *, int, int *) override; void unpack_forward_comm(int, int, double *) override; - double **gradC, **n_surface; + double **nsurface, **rsurface; private: - double cut, cutsq, threshold; - int surface_style, nmax_old; - double **B, *divr; - int comm_stage; - - int index_divr; - int index_rsurf; + double cut, cutsq, rho0, threshold_divr; + int surface_style, nmax_old, threshold_z; + double **B, **gradC, *divr; + int threshold_style, comm_stage; double divR_limit; int coord_limit; diff --git a/src/RHEO/compute_rheo_vshift.cpp b/src/RHEO/compute_rheo_vshift.cpp index 6cbd6e96da..1b3edcffd8 100644 --- a/src/RHEO/compute_rheo_vshift.cpp +++ b/src/RHEO/compute_rheo_vshift.cpp @@ -36,7 +36,7 @@ using namespace LAMMPS_NS; /* ---------------------------------------------------------------------- */ ComputeRHEOVShift::ComputeRHEOVShift(LAMMPS *lmp, int narg, char **arg) : - Compute(lmp, narg, arg), vshift(nullptr), fix_rheo(nullptr), fix_rheo(nullptr), + Compute(lmp, narg, arg), list(nullptr), vshift(nullptr), fix_rheo(nullptr), compute_kernel(nullptr), compute_interface(nullptr) { if (narg != 3) error->all(FLERR,"Illegal compute RHEO/VShift command"); diff --git a/src/RHEO/fix_rheo.cpp b/src/RHEO/fix_rheo.cpp index 8fc48c0b3b..5358cc4cba 100644 --- a/src/RHEO/fix_rheo.cpp +++ b/src/RHEO/fix_rheo.cpp @@ -377,7 +377,7 @@ void FixRHEO::pre_force(int /*vflag*/) if (shift_flag) compute_vshift->compute_peratom(); - // Remove extra shifting/no force options options + // Remove extra shifting/no force options int *status = atom->status; int nall = atom->nlocal + atom->nghost; for (int i = 0; i < nall; i++) { diff --git a/src/RHEO/fix_rheo_thermal.cpp b/src/RHEO/fix_rheo_thermal.cpp index 1912dc9f8c..fd08f39fd7 100644 --- a/src/RHEO/fix_rheo_thermal.cpp +++ b/src/RHEO/fix_rheo_thermal.cpp @@ -269,10 +269,10 @@ void FixRHEOThermal::post_integrate() } if (Ti > Tci) { - status[i] &= phasemask; + status[i] &= FixRHEO::phasemask; status[i] |= FixRHEO::STATUS_FLUID; } else if (!(status[i] & FixRHEO::STATUS_SOLID)) - status[i] &= phasemask; + status[i] &= FixRHEO::phasemask; status[i] |= FixRHEO::STATUS_FREEZING; } } diff --git a/src/RHEO/pair_rheo.cpp b/src/RHEO/pair_rheo.cpp index 1eb2a43e1a..5974b9b756 100644 --- a/src/RHEO/pair_rheo.cpp +++ b/src/RHEO/pair_rheo.cpp @@ -216,8 +216,8 @@ void PairRHEO::compute(int eflag, int vflag) fmag = (chi[i] - 0.9) * (h * 0.5 - r) * rho0 * csq * h * rinv; } else if ((!fluidi) && (!fluidj)) { - rhoi = 1.0; - rhoj = 1.0; + rhoi = rho0; + rhoj = rho0; } // Repel if close to inner solid particle From de0e4bb170f7a2f7ae59616ca4f4d203e6eccc68 Mon Sep 17 00:00:00 2001 From: jtclemm Date: Thu, 20 Apr 2023 16:17:04 -0600 Subject: [PATCH 025/158] Rho sum compute --- src/RHEO/compute_rheo_kernel.cpp | 234 ++++++++++++++++-------------- src/RHEO/compute_rheo_kernel.h | 3 + src/RHEO/compute_rheo_rho_sum.cpp | 184 +++++++++++++++++++++++ src/RHEO/compute_rheo_rho_sum.h | 50 +++++++ src/RHEO/compute_rheo_surface.cpp | 2 +- src/RHEO/compute_rheo_surface.h | 17 +-- src/RHEO/fix_rheo.cpp | 6 +- 7 files changed, 371 insertions(+), 125 deletions(-) create mode 100644 src/RHEO/compute_rheo_rho_sum.cpp create mode 100644 src/RHEO/compute_rheo_rho_sum.h diff --git a/src/RHEO/compute_rheo_kernel.cpp b/src/RHEO/compute_rheo_kernel.cpp index 2fd189e1e4..c0b61daae3 100644 --- a/src/RHEO/compute_rheo_kernel.cpp +++ b/src/RHEO/compute_rheo_kernel.cpp @@ -47,21 +47,46 @@ using namespace MathExtra; enum {QUINTIC, CRK0, CRK1, CRK2}; #define DELTA 2000 -Todo: convert delx dely delz to an array -Should vshift be using kernel quintic? -Move away from h notation, use cut? - /* ---------------------------------------------------------------------- */ ComputeRHEOKernel::ComputeRHEOKernel(LAMMPS *lmp, int narg, char **arg) : Compute(lmp, narg, arg), list(nullptr), C(nullptr), C0(nullptr), coordination(nullptr), compute_interface(nullptr) { - if (narg != 3) error->all(FLERR,"Illegal compute rheo/kernel command"); + if (narg != 4) error->all(FLERR,"Illegal compute rheo/kernel command"); + + kernel_style = (SubModelType) utils::inumeric(FLERR,arg[3],false,lmp); + + + if (kernel_style == FixRHEO::QUINTIC) { + correction_order = -1; + } else if (kernel_style == FixRHEO::CRK0) { + correction_order = 0; + } else if (kernel_style == FixRHEO::CRK1) { + correction_order = 1; + } else if (kernel_style == FixRHEO::CRK2) { + correction_order = 2; + } - comm_forward = 1; // Always minimum for coordination solid_flag = 0; dim = domain->dimension; + + comm_forward = 1; + ncor = 0; + Mdim = 0; + if (kernel_type == CRK1) { + Mdim = 1 + dim; + ncor = 1 + dim; + comm_forward = ncor * Mdim; + } else if (kernel_type == CRK2) { + //Polynomial basis size (up to quadratic order) + Mdim = 1 + dim + dim * (dim + 1) / 2; + //Number of sets of correction coefficients (1 x y xx yy) + z zz (3D) + ncor = 1 + 2 * dim; + comm_forward = ncor * Mdim; + } + + comm_forward_save = comm_forward; } /* ---------------------------------------------------------------------- */ @@ -93,22 +118,12 @@ void ComputeRHEOKernel::init() solid_flag = 1; } - kernel_style = fix_rheo->kernel_style; zmin = fix_rheo->zmin_kernel; h = fix_rheo->h; hsq = h * h; hinv = 1.0 / h; hsqinv = hinv * hinv; - if (kernel_style == FixRHEO::QUINTIC) { - correction_order = -1; - } else if (kernel_style == FixRHEO::CRK0) { - correction_order = 0; - } else if (kernel_style == FixRHEO::CRK1) { - correction_order = 1; - } else if (kernel_style == FixRHEO::CRK2) { - correction_order = 2; - } if (dim == 3) { pre_w = 0.002652582384864922 * 27.0 * ihsq * ih; @@ -133,23 +148,13 @@ void ComputeRHEOKernel::init() coordination = atom->ivector[index]; // Create local arrays for kernel arrays, I can't foresee a reason to print - comm_forward = 1; - ncor = 0; - Mdim = 0; + if (kernel_type == CRK0) { memory->create(C0, nmax_old, "rheo/kernel:C0"); } else if (kernel_type == CRK1) { - Mdim = 1 + dim; - ncor = 1 + dim; memory->create(C, nmax_old, ncor, Mdim, "rheo/kernel:C"); - comm_forward = ncor * Mdim; } else if (kernel_type == CRK2) { - //Polynomial basis size (up to quadratic order) - Mdim = 1 + dim + dim * (dim + 1) / 2; - //Number of sets of correction coefficients (1 x y xx yy) + z zz (3D) - ncor = 1 + 2 * dim; memory->create(C, nmax_old, ncor, Mdim, "rheo/kernel:C"); - comm_forward = ncor * Mdim; } } @@ -491,6 +496,8 @@ void ComputeRHEOKernel::compute_peratom() gsl_error_flag = 0; gsl_error_tags.clear(); + if (kernel_type == FixRHEO::QUINTIC) return; + int i, j, ii, jj, inum, jnum, g, a, b, gsl_error; double xtmp, ytmp, ztmp, r, rsq, w, vj; double dx[3]; @@ -513,48 +520,11 @@ void ComputeRHEOKernel::compute_peratom() firstneigh = list->firstneigh; // Grow arrays if necessary - int nmax = atom->nmax; - if (nmax_old < nmax) - memory->grow(coordination, nmax, "atom:rheo_coordination"); + if (nmax_old < atom->nmax) grow_arrays(atom->nmax); - if (kernel_type == FixRHEO::CRK0) { - memory->grow(C0, nmax, "rheo/kernel:C0"); - } else if (correction_order > 0) { - memory->grow(C, nmax, ncor, Mdim, "rheo/kernel:C"); - } - - nmax_old = atom->nmax; - } - - if (kernel_type == FixRHEO::QUINTIC) { - for (ii = 0; ii < inum; ii++) { - i = ilist[ii]; - xtmp = x[i][0]; - ytmp = x[i][1]; - ztmp = x[i][2]; - - jlist = firstneigh[i]; - jnum = numneigh[i]; - coordination[i] = 0; - - for (jj = 0; jj < jnum; jj++) { - j = jlist[jj]; - j &= NEIGHMASK; - - dx[0] = xtmp - x[j][0]; - dx[1] = ytmp - x[j][1]; - dx[2] = ztmp - x[j][2]; - rsq = lensq(dx); - - if (rsq < hsq) { - coordination[i] += 1; - } - } - } - } else if (kernel_type == FixRHEO::CRK0) { + if (kernel_type == FixRHEO::CRK0) { double M; - for (ii = 0; ii < inum; ii++) { i = ilist[ii]; xtmp = x[i][0]; @@ -566,7 +536,6 @@ void ComputeRHEOKernel::compute_peratom() //Initialize M to zero: M = 0; - coordination[i] = 0; for (jj = 0; jj < jnum; jj++) { j = jlist[jj]; @@ -584,7 +553,6 @@ void ComputeRHEOKernel::compute_peratom() vj = mass[type[j]] / compute_interface->correct_rho(j,i); } else vj = mass[type[j]] / rho[j]; - coordination[i] += 1; M += w * vj; } } @@ -613,7 +581,6 @@ void ComputeRHEOKernel::compute_peratom() M[a * Mdim + b] = 0; } } - coordination[i] = 0; for (jj = 0; jj < jnum; jj++) { j = jlist[jj]; @@ -658,8 +625,6 @@ void ComputeRHEOKernel::compute_peratom() } } - coordination[i] += 1; - // Populate the upper triangle for (a = 0; a < Mdim; a++) { for (b = a; b < Mdim; b++) { @@ -733,7 +698,74 @@ void ComputeRHEOKernel::compute_peratom() } // communicate calculated quantities - comm->forward_comm_compute(this); + comm_stage = 1; + comm_forward = comm_forward_save; + comm->forward_comm(this); +} + + +/* ---------------------------------------------------------------------- */ + +void ComputeRHEOKernel::compute_coordination() +{ + int i, j, ii, jj, inum, jnum; + double xtmp, ytmp, ztmp, rsq; + double dx[3]; + + double **x = atom->x; + + int *ilist, *jlist, *numneigh, **firstneigh; + inum = list->inum; + ilist = list->ilist; + numneigh = list->numneigh; + firstneigh = list->firstneigh; + + // Grow arrays if necessary + if (nmax_old < atom->nmax) grow_arrays(atom->nmax); + + for (ii = 0; ii < inum; ii++) { + i = ilist[ii]; + xtmp = x[i][0]; + ytmp = x[i][1]; + ztmp = x[i][2]; + + jlist = firstneigh[i]; + jnum = numneigh[i]; + coordination[i] = 0; + + for (jj = 0; jj < jnum; jj++) { + j = jlist[jj]; + j &= NEIGHMASK; + + dx[0] = xtmp - x[j][0]; + dx[1] = ytmp - x[j][1]; + dx[2] = ztmp - x[j][2]; + rsq = lensq(dx); + + if (rsq < hsq) + coordination[i] += 1; + } + } + + // communicate calculated quantities + comm_stage = 0; + comm_forward = 1; + comm->forward_comm(this); +} + +/* ---------------------------------------------------------------------- */ + +void ComputeRHEOKernel::grow_arrays(int nmax) +{ + memory->grow(coordination, nmax, "atom:rheo_coordination"); + + if (kernel_type == FixRHEO::CRK0) { + memory->grow(C0, nmax, "rheo/kernel:C0"); + } else if (correction_order > 0) { + memory->grow(C, nmax, ncor, Mdim, "rheo/kernel:C"); + } + + nmax_old = nmax; } /* ---------------------------------------------------------------------- */ @@ -743,26 +775,19 @@ int ComputeRHEOKernel::pack_forward_comm(int n, int *list, double *buf, { int i,j,k,m,a,b; m = 0; - if (correction_order > 0) { - for (i = 0; i < n; i++) { - j = list[i]; - for (a = 0; a < ncor; a++) { - for (b = 0; b < Mdim; b++) { - buf[m++] = C[j][a][b]; - } + + for (i = 0; i < n; i++) { + j = list[i]; + if (comm_stage == 0) { + buf[m++] = coordination[j]; + } else { + if (kernel_type == FixRHEO::CRK0) { + buf[m++] = C0[j]; + } else { + for (a = 0; a < ncor; a++) + for (b = 0; b < Mdim; b++) + buf[m++] = C[j][a][b]; } - buf[m++] = coordination[j]; - } - } else if (kernel_type == FixRHEO::CRK0) { - for (i = 0; i < n; i++) { - j = list[i]; - buf[m++] = C0[j]; - buf[m++] = coordination[j]; - } - } else { - for (i = 0; i < n; i++) { - j = list[i]; - buf[m++] = coordination[j]; } } return m; @@ -775,23 +800,18 @@ void ComputeRHEOKernel::unpack_forward_comm(int n, int first, double *buf) int i, k, m, last,a,b; m = 0; last = first + n; - if (correction_order > 0) { - for (i = first; i < last; i++) { - for (a = 0; a < ncor; a++) { - for (b = 0; b < Mdim; b++) { - C[i][a][b] = buf[m++]; - } + + for (i = first; i < last; i++) { + if (comm_stage == 0) { + coordination[i] = buf[m++]; + } else { + if (kernel_type == FixRHEO::CRK0) { + C0[i] = buf[m++]; + } else { + for (a = 0; a < ncor; a++) + for (b = 0; b < Mdim; b++) + C[i][a][b] = buf[m++]; } - coordination[i] = buf[m++]; - } - } else if (kernel_type == FixRHEO::CRK0) { - for (i = first; i < last; i++) { - C0[i] = buf[m++]; - coordination[i] = buf[m++]; - } - } else { - for (i = first; i < last; i++) { - coordination[i] = buf[m++]; } } } diff --git a/src/RHEO/compute_rheo_kernel.h b/src/RHEO/compute_rheo_kernel.h index ed2b6ff5f2..4fbdb966b4 100644 --- a/src/RHEO/compute_rheo_kernel.h +++ b/src/RHEO/compute_rheo_kernel.h @@ -35,16 +35,19 @@ class ComputeRHEOKernel : public Compute { int pack_forward_comm(int, int *, double *, int, int *) override; void unpack_forward_comm(int, int, double *) override; double memory_usage() override; + void compute_coordination(); double calc_w(int,int,double,double,double,double); double calc_dw(int,int,double,double,double,double); double calc_w_quintic(int,int,double,double,double,double); double calc_dw_quintic(int,int,double,double,double,double,double *,double *); + void grow_arrays(int); double dWij[3], dWji[3], Wij, Wji; int correction_order; int *coordination; private: + int comm_stage, comm_forward_save; int solid_flag; int gsl_error_flag; std::unordered_set gsl_error_tags; diff --git a/src/RHEO/compute_rheo_rho_sum.cpp b/src/RHEO/compute_rheo_rho_sum.cpp new file mode 100644 index 0000000000..fafd948538 --- /dev/null +++ b/src/RHEO/compute_rheo_rho_sum.cpp @@ -0,0 +1,184 @@ +/* ---------------------------------------------------------------------- + LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator + http://lammps.sandia.gov, 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. +------------------------------------------------------------------------- */ + +#include "compute_rheo_rho_sum.h" + +#include "atom.h" +#include "comm.h" +#include "compute_rheo_kernel.h" +#include "error.h" +#include "fix_rheo.h" +#include "force.h" +#include "neighbor.h" +#include "neigh_list.h" +#include "neigh_request.h" + +using namespace LAMMPS_NS; + +/* ---------------------------------------------------------------------- */ + +ComputeRHEORhoSum::ComputeRHEORhoSum(LAMMPS *lmp, int narg, char **arg) : + Compute(lmp, narg, arg), fix_rheo(nullptr), compute_kernel(nullptr) +{ + if (narg != 3) error->all(FLERR,"Illegal compute RHEO/rho command"); + + comm_forward = 1; + comm_reverse = 1; +} + +/* ---------------------------------------------------------------------- */ + +ComputeRHEORhoSum::~ComputeRHEORhoSum() {} + +/* ---------------------------------------------------------------------- */ + +void ComputeRHEORhoSum::init() +{ + compute_kernel = fix_rheo->compute_kernel; + cut = fix_rheo->cut; + cutsq = cut * cut; + + // need an occasional half neighbor list + neighbor->add_request(this, NeighConst::REQ_HALF); +} + +/* ---------------------------------------------------------------------- */ + +void ComputeRHEORhoSum::init_list(int /*id*/, NeighList *ptr) +{ + list = ptr; +} + +/* ---------------------------------------------------------------------- */ + + +void ComputeRHEORhoSum::compute_peratom() +{ + int i, j, ii, jj, inum, jnum, itype, jtype; + double xtmp, ytmp, ztmp, delx, dely, delz; + int *ilist, *jlist, *numneigh, **firstneigh; + double rsq, w; + + int nlocal = atom->nlocal; + + double **x = atom->x; + double *rho = atom->rho; + int *type = atom->type; + int *status = atom->status; + double *mass = atom->mass; + int newton = force->newton; + + double jmass; + + inum = list->inum; + ilist = list->ilist; + numneigh = list->numneigh; + firstneigh = list->firstneigh; + int nall = nlocal + atom->nghost; + + // initialize arrays, local with quintic self-contribution, ghosts are zeroed + for (i = 0; i < nlocal; i++) { + w = compute_kernel->calc_w_quintic(i, i, 0.0, 0.0, 0.0, 0.0); + rho[i] += w * mass[type[i]]; + } + + for (i = nlocal; i < nall; i++) rho[i] = 0.0; + + for (ii = 0; ii < inum; ii++) { + i = ilist[ii]; + xtmp = x[i][0]; + ytmp = x[i][1]; + ztmp = x[i][2]; + itype = type[i]; + jlist = firstneigh[i]; + jnum = numneigh[i]; + + for (jj = 0; jj < jnum; jj++) { + j = jlist[jj]; + j &= NEIGHMASK; + + delx = xtmp - x[j][0]; + dely = ytmp - x[j][1]; + delz = ztmp - x[j][2]; + rsq = delx * delx + dely * dely + delz * delz; + if (rsq < cutsq) { + w = compute_kernel->calc_w(i, j, delx, dely, delz, sqrt(rsq)); + rho[i] += w * mass[type[i]]; + if (newton || j < nlocal) { + rho[j] += w * mass[type[j]]; + } + } + } + } + + if (newton) comm->reverse_comm(this); + comm->forward_comm(this); +} + +/* ---------------------------------------------------------------------- */ + +int ComputeRHEORhoSum::pack_forward_comm(int n, int *list, double *buf, + int /*pbc_flag*/, int * /*pbc*/) +{ + int i,j,k,m; + double * rho = atom->rho; + m = 0; + + for (i = 0; i < n; i++) { + j = list[i]; + buf[m++] = coordination[j]; + } + return m; +} + +/* ---------------------------------------------------------------------- */ +void ComputeRHEORhoSum::unpack_forward_comm(int n, int first, double *buf) +{ + int i, k, m, last; + double * rho = atom->rho; + + m = 0; + last = first + n; + for (i = first; i < last; i++) { + rho[i] = buf[m++]; + } +} + +/* ---------------------------------------------------------------------- */ + +int ComputeRHEORhoSum::pack_reverse_comm(int n, int first, double *buf) +{ + int i,k,m,last; + double *rho = atom->rho; + + m = 0; + last = first + n; + for (i = first; i < last; i++) { + buf[m++] = rho[i]; + } + return m; +} + +/* ---------------------------------------------------------------------- */ + +void ComputeRHEORhoSum::unpack_reverse_comm(int n, int *list, double *buf) +{ + int i,k,j,m; + double *rho = atom->rho; + + m = 0; + for (i = 0; i < n; i++) { + j = list[i]; + rho[j] += buf[m++]; + } +} diff --git a/src/RHEO/compute_rheo_rho_sum.h b/src/RHEO/compute_rheo_rho_sum.h new file mode 100644 index 0000000000..a411d5ed29 --- /dev/null +++ b/src/RHEO/compute_rheo_rho_sum.h @@ -0,0 +1,50 @@ +/* -*- 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 COMPUTE_CLASS +// clang-format off +ComputeStyle(RHEO/RHO/SUM,ComputeRHEORhoSum) +// clang-format on +#else + +#ifndef LMP_COMPUTE_RHEO_RHO_SUM_H +#define LMP_COMPUTE_RHEO_RHO_SUM_H + +#include "compute.h" + +namespace LAMMPS_NS { + +class ComputeRHEORhoSum : public Compute { + public: + ComputeRHEORhoSum(class LAMMPS *, int, char **); + ~ComputeRHEORhoSum() override; + void init() override; + void init_list(int, class NeighList *) override; + void compute_peratom() override; + int pack_forward_comm(int, int *, double *, int, int *) override; + void unpack_forward_comm(int, int, double *) override; + int pack_reverse_comm(int, int, double *) override; + void unpack_reverse_comm(int, int *, double *) override; + + private: + double cut, cutsq; + + class NeighList *list; + class FixRHEO *fix_rheo; + class ComputeRHEOKernel *compute_kernel; +}; + +} // namespace LAMMPS_NS + +#endif +#endif diff --git a/src/RHEO/compute_rheo_surface.cpp b/src/RHEO/compute_rheo_surface.cpp index 5b3aeabf26..9a94ea6a76 100644 --- a/src/RHEO/compute_rheo_surface.cpp +++ b/src/RHEO/compute_rheo_surface.cpp @@ -36,7 +36,7 @@ using namespace LAMMPS_NS; using namespace FixConst; using namespace MathExtra; -#define epsilon 1e-10; +#define EPSILON 1e-10; /* ---------------------------------------------------------------------- */ diff --git a/src/RHEO/compute_rheo_surface.h b/src/RHEO/compute_rheo_surface.h index 8d0b681c6f..00cfb56b31 100644 --- a/src/RHEO/compute_rheo_surface.h +++ b/src/RHEO/compute_rheo_surface.h @@ -27,7 +27,7 @@ namespace LAMMPS_NS { class ComputeRHEOSurface : public Compute { public: ComputeRHEOSurface(class LAMMPS *, int, char **); - ~ComputeRHEOSurface(); + ~ComputeRHEOSurface() override; void init() override; void init_list(int, class NeighList *) override; void compute_peratom() override; @@ -44,26 +44,13 @@ class ComputeRHEOSurface : public Compute { double **B, **gradC, *divr; int threshold_style, comm_stage; - double divR_limit; - int coord_limit; - class NeighList *list; class FixRHEO *fix_rheo; class ComputeRHEOKernel *compute_kernel; class ComputeRHEOSolids *compute_solids; }; -} +} // 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. - -*/ diff --git a/src/RHEO/fix_rheo.cpp b/src/RHEO/fix_rheo.cpp index 5358cc4cba..e2f9467b34 100644 --- a/src/RHEO/fix_rheo.cpp +++ b/src/RHEO/fix_rheo.cpp @@ -141,7 +141,7 @@ FixRHEO::~FixRHEO() void FixRHEO::post_constructor() { - compute_kernel = dynamic_cast(modify->add_compute("rheo_kernel all RHEO/KERNEL")); + compute_kernel = dynamic_cast(modify->add_compute("rheo_kernel all RHEO/KERNEL {}", kernel_style)); compute_kernel->fix_rheo = this; std::string cmd = "rheo_grad all RHEO/GRAD velocity rho viscosity"; @@ -150,7 +150,7 @@ void FixRHEO::post_constructor() compute_grad->fix_rheo = this; if (rhosum_flag) { - compute_rhosum = dynamic_cast(modify->add_compute("rheo_rhosum all RHEO/RHO/SUM")); + compute_rhosum = dynamic_cast(modify->add_compute("rheo_rho_sum all RHEO/RHO/SUM")); compute_rhosum->fix_rheo = this; } @@ -364,6 +364,8 @@ void FixRHEO::initial_integrate(int /*vflag*/) void FixRHEO::pre_force(int /*vflag*/) { + compute_kernel->compute_coordination(); // Needed for rho sum + if (rhosum_flag) compute_rhosum->compute_peratom(); From 35d1178cfaf29a543ee58e9b230738750966523a Mon Sep 17 00:00:00 2001 From: jtclemm Date: Thu, 20 Apr 2023 20:15:17 -0600 Subject: [PATCH 026/158] Adding cmake options, fixing a few misc errors --- cmake/CMakeLists.txt | 1 + cmake/presets/all_off.cmake | 1 + cmake/presets/all_on.cmake | 1 + cmake/presets/mingw-cross.cmake | 1 + cmake/presets/most.cmake | 1 + cmake/presets/windows.cmake | 1 + src/.gitignore | 25 +++++++++++++++++++++++++ src/RHEO/compute_rheo_grad.h | 2 +- src/RHEO/compute_rheo_interface.h | 2 +- src/RHEO/compute_rheo_kernel.h | 2 +- src/RHEO/compute_rheo_rho_sum.h | 3 ++- src/RHEO/compute_rheo_surface.h | 2 +- src/RHEO/compute_rheo_vshift.h | 3 ++- src/RHEO/fix_rheo.cpp | 8 ++------ src/RHEO/fix_rheo.h | 12 ++++++------ 15 files changed, 47 insertions(+), 18 deletions(-) diff --git a/cmake/CMakeLists.txt b/cmake/CMakeLists.txt index 14961209c8..f4a8b9c1ef 100644 --- a/cmake/CMakeLists.txt +++ b/cmake/CMakeLists.txt @@ -295,6 +295,7 @@ set(STANDARD_PACKAGES REACTION REAXFF REPLICA + RHEO RIGID SCAFACOS SHOCK diff --git a/cmake/presets/all_off.cmake b/cmake/presets/all_off.cmake index 3d5ee95b3d..64cc88d669 100644 --- a/cmake/presets/all_off.cmake +++ b/cmake/presets/all_off.cmake @@ -83,6 +83,7 @@ set(ALL_PACKAGES REACTION REAXFF REPLICA + RHEO RIGID SCAFACOS SHOCK diff --git a/cmake/presets/all_on.cmake b/cmake/presets/all_on.cmake index 474051f6ec..ac721b30fd 100644 --- a/cmake/presets/all_on.cmake +++ b/cmake/presets/all_on.cmake @@ -85,6 +85,7 @@ set(ALL_PACKAGES REACTION REAXFF REPLICA + RHEO RIGID SCAFACOS SHOCK diff --git a/cmake/presets/mingw-cross.cmake b/cmake/presets/mingw-cross.cmake index 6c6170acd3..ec21809edd 100644 --- a/cmake/presets/mingw-cross.cmake +++ b/cmake/presets/mingw-cross.cmake @@ -67,6 +67,7 @@ set(WIN_PACKAGES REACTION REAXFF REPLICA + RHEO RIGID SHOCK SMTBQ diff --git a/cmake/presets/most.cmake b/cmake/presets/most.cmake index 00c74c81b8..2a2cac2755 100644 --- a/cmake/presets/most.cmake +++ b/cmake/presets/most.cmake @@ -58,6 +58,7 @@ set(ALL_PACKAGES REACTION REAXFF REPLICA + RHEO RIGID SHOCK SPH diff --git a/cmake/presets/windows.cmake b/cmake/presets/windows.cmake index aa9a4656af..9253d439a8 100644 --- a/cmake/presets/windows.cmake +++ b/cmake/presets/windows.cmake @@ -56,6 +56,7 @@ set(WIN_PACKAGES REACTION REAXFF REPLICA + RHEO RIGID SHOCK SMTBQ diff --git a/src/.gitignore b/src/.gitignore index ac4a776cfc..d0fcaf495c 100644 --- a/src/.gitignore +++ b/src/.gitignore @@ -197,6 +197,31 @@ /pair_tdpd.cpp /pair_tdpd.h +/atom_vec_rheo.cpp +/atom_vec_rheo.h +/compute_rheo_grad.cpp +/compute_rheo_grad.h +/compute_rheo_interface.cpp +/compute_rheo_interface.h +/compute_rheo_kernel.cpp +/compute_rheo_kernel.h +/compute_rheo_rho_sum.cpp +/compute_rheo_rho_sum.h +/compute_rheo_surface.cpp +/compute_rheo_surface.h +/compute_rheo_vshift.cpp +/compute_rheo_vshift.h +/fix_rheo.cpp +/fix_rheo.h +/fix_rheo_pressure.cpp +/fix_rheo_pressure.h +/fix_rheo_thermal.cpp +/fix_rheo_thermal.h +/fix_rheo_viscosity.cpp +/fix_rheo_viscosity.h +/pair_rheo.cpp +/pair_rheo.h + /compute_grid.cpp /compute_grid.h /compute_grid_local.cpp diff --git a/src/RHEO/compute_rheo_grad.h b/src/RHEO/compute_rheo_grad.h index ee4b4a5bd6..4c2461c73f 100644 --- a/src/RHEO/compute_rheo_grad.h +++ b/src/RHEO/compute_rheo_grad.h @@ -42,13 +42,13 @@ class ComputeRHEOGrad : public Compute { double **gradr; double **gradt; double **gradn; + class FixRHEO *fix_rheo; private: int comm_stage, ncomm_grad, ncomm_field, nmax_old; double cut, cutsq, rho0; class NeighList *list; - class FixRHEO *fix_rheo; class ComputeRHEOKernel *compute_kernel; class ComputeRHEOInterface *compute_interface; diff --git a/src/RHEO/compute_rheo_interface.h b/src/RHEO/compute_rheo_interface.h index cdb2eb6c54..04733ff334 100644 --- a/src/RHEO/compute_rheo_interface.h +++ b/src/RHEO/compute_rheo_interface.h @@ -41,6 +41,7 @@ class ComputeRHEOInterface : public Compute { void store_forces(); double *chi, **f_pressure; + class FixRHEO *fix_rheo; private: int nmax_old, comm_stage; @@ -50,7 +51,6 @@ class ComputeRHEOInterface : public Compute { char *id_fix_pa; class NeighList *list; - class FixRHEO *fix_rheo; class ComputeRHEOKernel *compute_kernel; }; diff --git a/src/RHEO/compute_rheo_kernel.h b/src/RHEO/compute_rheo_kernel.h index 4fbdb966b4..19062e483b 100644 --- a/src/RHEO/compute_rheo_kernel.h +++ b/src/RHEO/compute_rheo_kernel.h @@ -45,6 +45,7 @@ class ComputeRHEOKernel : public Compute { double dWij[3], dWji[3], Wij, Wji; int correction_order; int *coordination; + class FixRHEO *fix_rheo; private: int comm_stage, comm_forward_save; @@ -60,7 +61,6 @@ class ComputeRHEOKernel : public Compute { class NeighList *list; class ComputeRHEOInterface *compute_interface; - class FixRHEO *fix_rheo; int check_corrections(int); diff --git a/src/RHEO/compute_rheo_rho_sum.h b/src/RHEO/compute_rheo_rho_sum.h index a411d5ed29..6ec2547b95 100644 --- a/src/RHEO/compute_rheo_rho_sum.h +++ b/src/RHEO/compute_rheo_rho_sum.h @@ -36,11 +36,12 @@ class ComputeRHEORhoSum : public Compute { int pack_reverse_comm(int, int, double *) override; void unpack_reverse_comm(int, int *, double *) override; + class FixRHEO *fix_rheo; + private: double cut, cutsq; class NeighList *list; - class FixRHEO *fix_rheo; class ComputeRHEOKernel *compute_kernel; }; diff --git a/src/RHEO/compute_rheo_surface.h b/src/RHEO/compute_rheo_surface.h index 00cfb56b31..224b2594a1 100644 --- a/src/RHEO/compute_rheo_surface.h +++ b/src/RHEO/compute_rheo_surface.h @@ -37,6 +37,7 @@ class ComputeRHEOSurface : public Compute { void unpack_forward_comm(int, int, double *) override; double **nsurface, **rsurface; + class FixRHEO *fix_rheo; private: double cut, cutsq, rho0, threshold_divr; @@ -45,7 +46,6 @@ class ComputeRHEOSurface : public Compute { int threshold_style, comm_stage; class NeighList *list; - class FixRHEO *fix_rheo; class ComputeRHEOKernel *compute_kernel; class ComputeRHEOSolids *compute_solids; }; diff --git a/src/RHEO/compute_rheo_vshift.h b/src/RHEO/compute_rheo_vshift.h index e76476e7fd..88a9cdcd1d 100644 --- a/src/RHEO/compute_rheo_vshift.h +++ b/src/RHEO/compute_rheo_vshift.h @@ -37,13 +37,14 @@ class ComputeRHEOVShift : public Compute { void correct_surfaces(); double **vshift; + class FixRHEO *fix_rheo; + private: int nmax_old; double dtv, cut, cutsq, cutthird; int surface_flag; class NeighList *list; - class FixRHEO *fix_rheo; class ComputeRHEOInterface *compute_interface ; class ComputeRHEOKernel *compute_kernel; }; diff --git a/src/RHEO/fix_rheo.cpp b/src/RHEO/fix_rheo.cpp index e2f9467b34..2b55320c4e 100644 --- a/src/RHEO/fix_rheo.cpp +++ b/src/RHEO/fix_rheo.cpp @@ -23,7 +23,7 @@ #include "compute_rheo_interface.h" #include "compute_rheo_surface.h" #include "compute_rheo_kernel.h" -#include "compute_rheo_rhosum.h" +#include "compute_rheo_rho_sum.h" #include "compute_rheo_vshift.h" #include "domain.h" #include "error.h" @@ -46,7 +46,6 @@ FixRHEO::FixRHEO(LAMMPS *lmp, int narg, char **arg) : viscosity_fix_defined = 0; pressure_fix_defined = 0; thermal_fix_defined = 0; - surface_fix_defined = 0; thermal_flag = 0; rhosum_flag = 0; @@ -104,9 +103,6 @@ FixRHEO::FixRHEO(LAMMPS *lmp, int narg, char **arg) : interface_flag = 1; } else if (strcmp(arg[iarg],"rhosum") == 0) { rhosum_flag = 1; - if(iarg + 1 >= narg) error->all(FLERR,"Illegal rhosum option in fix rheo"); - rhosum_zmin = utils::inumeric(FLERR,arg[iarg + 1],false,lmp); - iarg += 1; } else if (strcmp(arg[iarg],"rho0") == 0) { if(iarg + 1 >= narg) error->all(FLERR,"Illegal rho0 option in fix rheo"); rho0 = utils::numeric(FLERR,arg[iarg + 1],false,lmp); @@ -207,7 +203,7 @@ void FixRHEO::setup_pre_force(int /*vflag*/) /* ---------------------------------------------------------------------- */ -void FixRHEO::setup() +void FixRHEO::setup(int /*vflag*/) { // Confirm all accessory fixes are defined // Note: these fixes set this flag in setup_pre_force() diff --git a/src/RHEO/fix_rheo.h b/src/RHEO/fix_rheo.h index d2097ade71..0064f4c90b 100644 --- a/src/RHEO/fix_rheo.h +++ b/src/RHEO/fix_rheo.h @@ -32,7 +32,7 @@ class FixRHEO : public Fix { void post_constructor() override; void init() override; void setup_pre_force(int) override; - void setup() override; + void setup(int) override; void pre_force(int) override; void initial_integrate(int) override; void final_integrate() override; @@ -40,7 +40,7 @@ class FixRHEO : public Fix { // Model parameters double h, rho0, csq; - int zmin_kernel, zmin_rhosum, zmin_surface; + int zmin_kernel, zmin_surface; int kernel_style, surface_style; double divr_surface; enum {QUINTIC, CRK0, CRK1, CRK2}; @@ -52,7 +52,7 @@ class FixRHEO : public Fix { STATUS_FLUID = 1 << 0, STATUS_REACTIVE = 1 << 1, STATUS_SOLID = 1 << 2, - STATUS_FREEZING = 1 << 3 + STATUS_FREEZING = 1 << 3, // Surface status STATUS_BULK = 1 << 4, @@ -62,10 +62,10 @@ class FixRHEO : public Fix { // Temporary status options - reset in preforce STATUS_SHIFT = 1 << 8, - STATUS_NO_FORCE = 1 << 9, + STATUS_NO_FORCE = 1 << 9 }; - int phasemask = FFFFFFF0; - int surfacemask = FFFFFF0F; + int phasemask = 0xFFFFFFF0; + int surfacemask = 0xFFFFFF0F; // Accessory fixes/computes int thermal_flag; From 47b8cdc94fa750bc088225124e1f911d40d63885 Mon Sep 17 00:00:00 2001 From: jtclemm Date: Mon, 24 Apr 2023 19:46:27 -0600 Subject: [PATCH 027/158] Fixing compilation errors --- src/RHEO/atom_vec_rheo.cpp | 2 +- src/RHEO/compute_rheo_grad.cpp | 66 +++++++++------- src/RHEO/compute_rheo_grad.h | 5 +- src/RHEO/compute_rheo_interface.cpp | 91 +++++++++++----------- src/RHEO/compute_rheo_interface.h | 10 +-- src/RHEO/compute_rheo_kernel.cpp | 112 ++++++++++++++-------------- src/RHEO/compute_rheo_kernel.h | 2 +- src/RHEO/compute_rheo_rho_sum.cpp | 13 ++-- src/RHEO/compute_rheo_surface.cpp | 83 +++++++++++---------- src/RHEO/compute_rheo_surface.h | 10 +-- src/RHEO/compute_rheo_vshift.cpp | 38 +++++----- src/RHEO/compute_rheo_vshift.h | 2 +- src/RHEO/fix_rheo.cpp | 79 +++++++++++--------- src/RHEO/fix_rheo.h | 51 +++++++------ src/RHEO/fix_rheo_pressure.cpp | 25 ++++--- src/RHEO/fix_rheo_pressure.h | 5 +- src/RHEO/fix_rheo_thermal.cpp | 57 +++++++------- src/RHEO/fix_rheo_thermal.h | 6 +- src/RHEO/fix_rheo_viscosity.cpp | 27 ++++--- src/RHEO/fix_rheo_viscosity.h | 2 +- src/RHEO/pair_rheo.cpp | 39 ++++------ 21 files changed, 379 insertions(+), 346 deletions(-) diff --git a/src/RHEO/atom_vec_rheo.cpp b/src/RHEO/atom_vec_rheo.cpp index a8496a18e9..de2e2f77ad 100644 --- a/src/RHEO/atom_vec_rheo.cpp +++ b/src/RHEO/atom_vec_rheo.cpp @@ -120,7 +120,7 @@ void AtomVecRHEO::pack_property_atom(int index, double *buf, int nvalues, int gr buf[n] = 0.0; n += nvalues; } - } if else (index == 1) { + } else if (index == 1) { for (int i = 0; i < nlocal; i++) { if (mask[i] & groupbit) buf[n] = rho[i]; diff --git a/src/RHEO/compute_rheo_grad.cpp b/src/RHEO/compute_rheo_grad.cpp index add3ed712d..606cec7dfc 100644 --- a/src/RHEO/compute_rheo_grad.cpp +++ b/src/RHEO/compute_rheo_grad.cpp @@ -21,11 +21,12 @@ #include "atom.h" #include "comm.h" #include "compute_rheo_kernel.h" -#include "compute_rheo_solids.h" +#include "compute_rheo_interface.h" #include "domain.h" #include "error.h" #include "fix_rheo.h" #include "force.h" +#include "memory.h" #include "neighbor.h" #include "neigh_list.h" #include "update.h" @@ -33,6 +34,8 @@ #include using namespace LAMMPS_NS; +using namespace RHEO_NS; + enum{COMMGRAD, COMMFIELD}; /* ---------------------------------------------------------------------- */ @@ -112,10 +115,13 @@ void ComputeRHEOGrad::init() compute_kernel = fix_rheo->compute_kernel; compute_interface = fix_rheo->compute_interface; + int tmp1, tmp2; + index_visc = atom->find_custom("rheo_viscosity", tmp1, tmp2); + // Create coordination array if it doesn't already exist // Create a custom atom property so it works with compute property/atom // Do not create grow callback as there's no reason to copy/exchange data - // Manually grow if nmax_old exceeded + // Manually grow if nmax_store exceeded int index; int dim = domain->dimension; @@ -139,7 +145,7 @@ void ComputeRHEOGrad::init() gradn = atom->darray[index]; } - nmax_old = 0; + nmax_store = 0; grow_arrays(atom->nmax); } @@ -158,7 +164,7 @@ void ComputeRHEOGrad::compute_peratom() double xtmp, ytmp, ztmp, delx, dely, delz; double rsq, imass, jmass; double rhoi, rhoj, Voli, Volj, drho, dT, deta; - double vij[3]; + double vi[3], vj[3], vij[3]; double wp, *dWij, *dWji; int inum, *ilist, *numneigh, **firstneigh; @@ -169,26 +175,22 @@ void ComputeRHEOGrad::compute_peratom() double **v = atom->v; double *rho = atom->rho; double *temperature = atom->temperature; + double *viscosity = atom->dvector[index_visc]; int *status = atom->status; int *type = atom->type; double *mass = atom->mass; int newton = force->newton; int dim = domain->dimension; - int tmp1, tmp2; - int index_visc = atom->find_custom("rheo_viscosity", tmp1, tmp2); - if (index_visc == -1) error->all(FLERR, "Cannot find rheo viscosity"); - double *viscosity = atom->dvector[index_visc]; - inum = list->inum; ilist = list->ilist; numneigh = list->numneigh; firstneigh = list->firstneigh; // initialize arrays - if (nmax > nmax_old) grow_arrays(nmax); + if (atom->nmax > nmax_store) grow_arrays(atom->nmax); - for (i = 0; i < nmax; i++) { + for (i = 0; i < nmax_store; i++) { if (velocity_flag) { for (k = 0; k < dim * dim; k++) gradv[i][k] = 0.0; @@ -212,6 +214,9 @@ void ComputeRHEOGrad::compute_peratom() xtmp = x[i][0]; ytmp = x[i][1]; ztmp = x[i][2]; + vi[0] = v[i][0]; + vi[1] = v[i][1]; + vi[2] = v[i][2]; itype = type[i]; jlist = firstneigh[i]; jnum = numneigh[i]; @@ -230,14 +235,18 @@ void ComputeRHEOGrad::compute_peratom() rhoi = rho[i]; rhoj = rho[j]; + vj[0] = v[j][0]; + vj[1] = v[j][1]; + vj[2] = v[j][2]; + // Add corrections for walls - if ((status[i] & FixRHEO::STATUS_FLUID) && !(status[j] & FixRHEO::STATUS_FLUID)) { - compute_interface->correct_v(v[i], v[j], vi, i, j); - rhoj = compute_interface->correct_rho(j,i); - } else if (!(status[i] & FixRHEO::STATUS_FLUID) && (status[j] & FixRHEO::STATUS_FLUID)) { - compute_interface->correct_v(v[j], v[i], vj, j, i); - rhoi = compute_interface->correct_rho(i,j); - } else if (!(status[i] & FixRHEO::STATUS_FLUID) && !(status[j] & FixRHEO::STATUS_FLUID)) { + if ((status[i] & STATUS_FLUID) && !(status[j] & STATUS_FLUID)) { + compute_interface->correct_v(vi, vj, i, j); + rhoj = compute_interface->correct_rho(j, i); + } else if (!(status[i] & STATUS_FLUID) && (status[j] & STATUS_FLUID)) { + compute_interface->correct_v(vj, vi, j, i); + rhoi = compute_interface->correct_rho(i, j); + } else if (!(status[i] & STATUS_FLUID) && !(status[j] & STATUS_FLUID)) { rhoi = rho0; rhoj = rho0; } @@ -324,7 +333,6 @@ int ComputeRHEOGrad::pack_forward_comm(int n, int *list, double *buf, int i,j,k,m; double *rho = atom->rho; double *temperature = atom->temperature; - double *eta = atom->viscosity; double **v = atom->v; int dim = domain->dimension; @@ -371,9 +379,9 @@ int ComputeRHEOGrad::pack_forward_comm(int n, int *list, double *buf, void ComputeRHEOGrad::unpack_forward_comm(int n, int first, double *buf) { int i, k, m, last; - double * rho = atom->rho; - double * temperature = atom->temperature; - double ** v = atom->v; + double *rho = atom->rho; + double *temperature = atom->temperature; + double **v = atom->v; int dim = domain->dimension; m = 0; @@ -483,25 +491,27 @@ void ComputeRHEOGrad::grow_arrays(int nmax) if (eta_flag) memory->grow(gradn, nmax, dim, "atom:rheo_grad_eta"); - nmax_old = nmax; + nmax_store = nmax; } /* ---------------------------------------------------------------------- */ -double ComputeRHEOKernel::memory_usage() +double ComputeRHEOGrad::memory_usage() { double bytes = 0.0; + int dim = domain->dimension; + if (velocity_flag) - bytes = (size_t) nmax_old * dim * dim * sizeof(double); + bytes = (size_t) nmax_store * dim * dim * sizeof(double); if (rho_flag) - bytes = (size_t) nmax_old * dim * sizeof(double); + bytes = (size_t) nmax_store * dim * sizeof(double); if (temperature_flag) - bytes = (size_t) nmax_old * dim * sizeof(double); + bytes = (size_t) nmax_store * dim * sizeof(double); if (eta_flag) - bytes = (size_t) nmax_old * dim * sizeof(double); + bytes = (size_t) nmax_store * dim * sizeof(double); return bytes; } diff --git a/src/RHEO/compute_rheo_grad.h b/src/RHEO/compute_rheo_grad.h index 4c2461c73f..8c7962a978 100644 --- a/src/RHEO/compute_rheo_grad.h +++ b/src/RHEO/compute_rheo_grad.h @@ -45,7 +45,8 @@ class ComputeRHEOGrad : public Compute { class FixRHEO *fix_rheo; private: - int comm_stage, ncomm_grad, ncomm_field, nmax_old; + int comm_stage, ncomm_grad, ncomm_field, nmax_store; + int index_visc; double cut, cutsq, rho0; class NeighList *list; @@ -53,6 +54,8 @@ class ComputeRHEOGrad : public Compute { class ComputeRHEOInterface *compute_interface; int velocity_flag, temperature_flag, rho_flag, eta_flag; + + void grow_arrays(int); }; } // namespace LAMMPS_NS diff --git a/src/RHEO/compute_rheo_interface.cpp b/src/RHEO/compute_rheo_interface.cpp index 059f4057f4..72dcdc17d7 100644 --- a/src/RHEO/compute_rheo_interface.cpp +++ b/src/RHEO/compute_rheo_interface.cpp @@ -34,18 +34,19 @@ #include using namespace LAMMPS_NS; +using namespace RHEO_NS; -#define EPSILON 1e-1 +static constexpr double EPSILON = 1e-1; /* ---------------------------------------------------------------------- */ ComputeRHEOInterface::ComputeRHEOInterface(LAMMPS *lmp, int narg, char **arg) : - Compute(lmp, narg, arg), fix_rheo(nullptr), compute_kernel(nullptr), fx_m_norm(nullptr), - norm(nullptr), normwf(nullptr), chi(nullptr), f_pressure(nullptr), id_fix_pa(nullptr) + Compute(lmp, narg, arg), fix_rheo(nullptr), compute_kernel(nullptr), fp_store(nullptr), + norm(nullptr), normwf(nullptr), chi(nullptr), id_fix_pa(nullptr) { if (narg != 3) error->all(FLERR,"Illegal compute rheo/interface command"); - nmax = 0; + nmax_store = 0; comm_forward = 3; comm_reverse = 4; @@ -74,15 +75,15 @@ void ComputeRHEOInterface::init() compute_kernel = fix_rheo->compute_kernel; rho0 = fix_rheo->rho0; cut = fix_rheo->cut; - cs = fix_rheo->cs; - cs_inv = 1.0 / cs; + csq = fix_rheo->csq; + csq_inv = 1.0 / csq; cutsq = cut * cut; wall_max = sqrt(3.0) / 12.0 * cut; // Create chi array if it doesn't already exist // Create a custom atom property so it works with compute property/atom // Do not create grow callback as there's no reason to copy/exchange data - // Manually grow if nmax_old exceeded + // Manually grow if nmax_store exceeded int tmp1, tmp2; int nmax = atom->nmax; @@ -93,7 +94,7 @@ void ComputeRHEOInterface::init() memory->destroy(normwf); memory->create(norm, nmax, "rheo/interface:norm"); memory->create(normwf, nmax, "rheo/interface:normwf"); - nmax_old = nmax; + nmax_store = nmax; } chi = atom->dvector[index]; @@ -104,13 +105,13 @@ void ComputeRHEOInterface::init() index = atom->find_custom("fp_store", tmp1, tmp2); if (index == -1) { id_fix_pa = utils::strdup(id + std::string("_fix_property_atom")); - modify->add_fix(fmt::format("{} all property/atom d2_fp_store 3", id_fix_pa))); + modify->add_fix(fmt::format("{} all property/atom d2_fp_store 3", id_fix_pa)); index = atom->find_custom("fp_store", tmp1, tmp2); } fp_store = atom->darray[index]; // need an occasional half neighbor list - neighbor->add_request(this, NeighConst::REQ_HALF); + neighbor->add_request(this, NeighConst::REQ_DEFAULT); } /* ---------------------------------------------------------------------- */ @@ -142,17 +143,17 @@ void ComputeRHEOInterface::compute_peratom() numneigh = list->numneigh; firstneigh = list->firstneigh; - if (atom->nmax > nmax_old) { - nmax_old = atom->nmax; + if (atom->nmax > nmax_store) { + nmax_store = atom->nmax; memory->destroy(norm); memory->destroy(normwf); - memory->create(norm, nmax_old, "rheo/interface:norm"); - memory->create(normwf, nmax_old, "rheo/interface:normwf"); - memory->grow(chi, nmax_old, "rheo/interface:chi"); + memory->create(norm, nmax_store, "rheo/interface:norm"); + memory->create(normwf, nmax_store, "rheo/interface:normwf"); + memory->grow(chi, nmax_store, "rheo/interface:chi"); } for (i = 0; i < nall; i++) { - if (!(status[i] & FixRHEO::STATUS_FLUID)) rho[i] = 0.0; + if (!(status[i] & STATUS_FLUID)) rho[i] = 0.0; normwf[i] = 0.0; norm[i] = 0.0; chi[i] = 0.0; @@ -164,7 +165,7 @@ void ComputeRHEOInterface::compute_peratom() ytmp = x[i][1]; ztmp = x[i][2]; itype = type[i]; - fluidi = status[i] & FixRHEO::STATUS_FLUID; + fluidi = status[i] & STATUS_FLUID; jlist = firstneigh[i]; jnum = numneigh[i]; @@ -179,12 +180,12 @@ void ComputeRHEOInterface::compute_peratom() if (rsq < cutsq) { jtype = type[j]; - fluidj = status[j] & FixRHEO::STATUS_FLUID; + fluidj = status[j] & STATUS_FLUID; w = compute_kernel->calc_w_quintic(i, j, delx, dely, delz, sqrt(rsq)); status_match = 0; norm[i] += w; - if ((fluidi && fluidj) || ((!fluid) && (!fluidj))) + if ((fluidi && fluidj) || ((!fluidi) && (!fluidj))) status_match = 1; if (status_match) { @@ -194,7 +195,7 @@ void ComputeRHEOInterface::compute_peratom() dot = (-fp_store[0][j] + fp_store[0][i]) * delx; dot += (-fp_store[1][j] + fp_store[1][i]) * dely; dot += (-fp_store[2][j] + fp_store[2][i]) * delz; - rho[i] += w * (cs * (rho[j] - rho0) - rho[j] * dot); + rho[i] += w * (csq * (rho[j] - rho0) - rho[j] * dot); normwf[i] += w; } } @@ -208,7 +209,7 @@ void ComputeRHEOInterface::compute_peratom() dot = (-fp_store[0][i] + fp_store[0][j]) * delx; dot += (-fp_store[1][i] + fp_store[1][j]) * dely; dot += (-fp_store[2][i] + fp_store[2][j]) * delz; - rho[j] += w * (cs * (rho[i] - rho0) + rho[i] * dot); + rho[j] += w * (csq * (rho[i] - rho0) + rho[i] * dot); normwf[j] += w; } } @@ -223,10 +224,10 @@ void ComputeRHEOInterface::compute_peratom() if (norm[i] != 0.0) chi[i] /= norm[i]; // Recalculate rho for non-fluid particles - if (!(status[i] & FixRHEO::STATUS_FLUID)) { + if (!(status[i] & STATUS_FLUID)) { if (normwf[i] != 0.0) { // Stores rho for solid particles 1+Pw in Adami Adams 2012 - rho[i] = MAX(EPSILON, rho0 + (rho[i] / normwf[i]) * cs_inv); + rho[i] = MAX(EPSILON, rho0 + (rho[i] / normwf[i]) * csq_inv); } else { rho[i] = rho0; } @@ -310,7 +311,7 @@ void ComputeRHEOInterface::unpack_reverse_comm(int n, int *list, double *buf) j = list[i]; norm[j] += buf[m++]; chi[j] += buf[m++]; - if (!(status[j] & FixRHEO::STATUS_FLUID)){ + if (!(status[j] & STATUS_FLUID)){ normwf[j] += buf[m++]; rho[j] += buf[m++]; } else { @@ -322,7 +323,7 @@ void ComputeRHEOInterface::unpack_reverse_comm(int n, int *list, double *buf) /* ---------------------------------------------------------------------- */ -void ComputeRHEOInterface::correct_v(double *vi, double *vj, double *vi_out, int i, int j) +void ComputeRHEOInterface::correct_v(double *vi, double *vj, int i, int j) { double wall_prefactor, wall_denom, wall_numer; @@ -333,9 +334,9 @@ void ComputeRHEOInterface::correct_v(double *vi, double *vj, double *vi_out, int wall_prefactor = wall_numer / wall_denom; - vi_out[0] = (vi[0] - vj[0]) * wall_prefactor + vi[0]; - vi_out[1] = (vi[1] - vj[1]) * wall_prefactor + vi[1]; - vi_out[2] = (vi[2] - vj[2]) * wall_prefactor + vi[2]; + vi[0] = (vi[0] - vj[0]) * wall_prefactor + vi[0]; + vi[1] = (vi[1] - vj[1]) * wall_prefactor + vi[1]; + vi[2] = (vi[2] - vj[2]) * wall_prefactor + vi[2]; } /* ---------------------------------------------------------------------- */ @@ -352,28 +353,30 @@ double ComputeRHEOInterface::correct_rho(int i, int j) void ComputeRHEOInterface::store_forces() { double minv; - double mass = atom->mass; - double type = atom->type; - double **f = atom->f; + int *type = atom->type; int *mask = atom->mask; + double *mass = atom->mass; + double **f = atom->f; // When this is called, fp_store stores the pressure force // After this method, fp_store instead stores non-pressure forces // and is also normalized by the particles mass // If forces are overwritten by a fix, there are no pressure forces // so just normalize - int ifix = modify->find_fix_by_style("setforce"); - if (ifix != -1) { - for (int i = 0; i < atom->nlocal; i++) { - minv = 1.0 / mass[type[i]]; - if (mask[i] & modify->fix[ifix]->groupbit) { - fp_store[i][0] = f[i][0] * minv; - fp_store[i][1] = f[i][1] * minv; - fp_store[i][2] = f[i][2] * minv; - } else { - fp_store[i][0] = (f[i][0] - fp_store[i][0]) * minv; - fp_store[i][1] = (f[i][1] - fp_store[i][1]) * minv; - fp_store[i][2] = (f[i][2] - fp_store[i][2]) * minv; + auto fixlist = modify->get_fix_by_style("setforce"); + if (fixlist.size() == 0) { + for (const auto &fix : fixlist) { + for (int i = 0; i < atom->nlocal; i++) { + minv = 1.0 / mass[type[i]]; + if (mask[i] & fix->groupbit) { + fp_store[i][0] = f[i][0] * minv; + fp_store[i][1] = f[i][1] * minv; + fp_store[i][2] = f[i][2] * minv; + } else { + fp_store[i][0] = (f[i][0] - fp_store[i][0]) * minv; + fp_store[i][1] = (f[i][1] - fp_store[i][1]) * minv; + fp_store[i][2] = (f[i][2] - fp_store[i][2]) * minv; + } } } } else { @@ -397,7 +400,7 @@ void ComputeRHEOInterface::store_forces() double ComputeRHEOInterface::memory_usage() { - double bytes = 3 * nmax_old * sizeof(double); + double bytes = 3 * nmax_store * sizeof(double); return bytes; } diff --git a/src/RHEO/compute_rheo_interface.h b/src/RHEO/compute_rheo_interface.h index 04733ff334..50cec97790 100644 --- a/src/RHEO/compute_rheo_interface.h +++ b/src/RHEO/compute_rheo_interface.h @@ -36,17 +36,17 @@ class ComputeRHEOInterface : public Compute { int pack_reverse_comm(int, int, double *) override; void unpack_reverse_comm(int, int *, double *) override; double memory_usage() override; - void correct_v(double *, double *, double *, int, int); + void correct_v(double *, double *, int, int); double correct_rho(int, int); void store_forces(); - double *chi, **f_pressure; + double *chi, **fp_store; class FixRHEO *fix_rheo; private: - int nmax_old, comm_stage; - double rho0, cut, cutsq, cs, cs_inv, wall_max; - double *norm, *normwf, **fom_store; + int nmax_store, comm_stage; + double rho0, cut, cutsq, csq, csq_inv, wall_max; + double *norm, *normwf; char *id_fix_pa; diff --git a/src/RHEO/compute_rheo_kernel.cpp b/src/RHEO/compute_rheo_kernel.cpp index c0b61daae3..d96d8d234e 100644 --- a/src/RHEO/compute_rheo_kernel.cpp +++ b/src/RHEO/compute_rheo_kernel.cpp @@ -42,10 +42,10 @@ #include using namespace LAMMPS_NS; +using namespace RHEO_NS; using namespace MathExtra; -enum {QUINTIC, CRK0, CRK1, CRK2}; -#define DELTA 2000 +static constexpr int DELTA = 2000; /* ---------------------------------------------------------------------- */ @@ -55,16 +55,16 @@ ComputeRHEOKernel::ComputeRHEOKernel(LAMMPS *lmp, int narg, char **arg) : { if (narg != 4) error->all(FLERR,"Illegal compute rheo/kernel command"); - kernel_style = (SubModelType) utils::inumeric(FLERR,arg[3],false,lmp); + kernel_style = utils::inumeric(FLERR,arg[3],false,lmp); - if (kernel_style == FixRHEO::QUINTIC) { + if (kernel_style == QUINTIC) { correction_order = -1; - } else if (kernel_style == FixRHEO::CRK0) { + } else if (kernel_style == CRK0) { correction_order = 0; - } else if (kernel_style == FixRHEO::CRK1) { + } else if (kernel_style == CRK1) { correction_order = 1; - } else if (kernel_style == FixRHEO::CRK2) { + } else if (kernel_style == CRK2) { correction_order = 2; } @@ -74,11 +74,11 @@ ComputeRHEOKernel::ComputeRHEOKernel(LAMMPS *lmp, int narg, char **arg) : comm_forward = 1; ncor = 0; Mdim = 0; - if (kernel_type == CRK1) { + if (kernel_style == CRK1) { Mdim = 1 + dim; ncor = 1 + dim; comm_forward = ncor * Mdim; - } else if (kernel_type == CRK2) { + } else if (kernel_style == CRK2) { //Polynomial basis size (up to quadratic order) Mdim = 1 + dim + dim * (dim + 1) / 2; //Number of sets of correction coefficients (1 x y xx yy) + z zz (3D) @@ -126,35 +126,35 @@ void ComputeRHEOKernel::init() if (dim == 3) { - pre_w = 0.002652582384864922 * 27.0 * ihsq * ih; - pre_wp = pre_w * 3.0 * ih; + pre_w = 0.002652582384864922 * 27.0 * hsqinv * hinv; + pre_wp = pre_w * 3.0 * hinv; } else { - pre_w = 0.004661441847879780 * 9 * ihsq; - pre_wp = pre_w * 3.0 * ih; + pre_w = 0.004661441847879780 * 9 * hsqinv; + pre_wp = pre_w * 3.0 * hinv; } // Create coordination array if it doesn't already exist // Create a custom atom property so it works with compute property/atom // Do not create grow callback as there's no reason to copy/exchange data - // Manually grow if nmax_old exceeded + // Manually grow if nmax_store exceeded int tmp1, tmp2; int nmax = atom->nmax; int index = atom->find_custom("rheo_coordination", tmp1, tmp2); if (index == -1) { index = atom->add_custom("rheo_coordination", 0, 0); - nmax_old = nmax; + nmax_store = nmax; } coordination = atom->ivector[index]; // Create local arrays for kernel arrays, I can't foresee a reason to print - if (kernel_type == CRK0) { - memory->create(C0, nmax_old, "rheo/kernel:C0"); - } else if (kernel_type == CRK1) { - memory->create(C, nmax_old, ncor, Mdim, "rheo/kernel:C"); - } else if (kernel_type == CRK2) { - memory->create(C, nmax_old, ncor, Mdim, "rheo/kernel:C"); + if (kernel_style == CRK0) { + memory->create(C0, nmax_store, "rheo/kernel:C0"); + } else if (kernel_style == CRK1) { + memory->create(C, nmax_store, ncor, Mdim, "rheo/kernel:C"); + } else if (kernel_style == CRK2) { + memory->create(C, nmax_store, ncor, Mdim, "rheo/kernel:C"); } } @@ -192,10 +192,10 @@ double ComputeRHEOKernel::calc_w(int i, int j, double delx, double dely, double int corrections_j = check_corrections(j); int corrections = corrections_i & corrections_j; - if (kernel_type == QUINTIC || !corrections) w = calc_w_quintic(i,j,delx,dely,delz,r); - else if (kernel_type == CRK0) w = calc_w_crk0(i,j,delx,dely,delz,r); - else if (kernel_type == CRK1) w = calc_w_crk1(i,j,delx,dely,delz,r); - else if (kernel_type == CRK2) w = calc_w_crk2(i,j,delx,dely,delz,r); + if (kernel_style == QUINTIC || !corrections) w = calc_w_quintic(i,j,delx,dely,delz,r); + else if (kernel_style == CRK0) w = calc_w_crk0(i,j,delx,dely,delz,r); + else if (kernel_style == CRK1) w = calc_w_crk1(i,j,delx,dely,delz,r); + else if (kernel_style == CRK2) w = calc_w_crk2(i,j,delx,dely,delz,r); return w; } @@ -211,11 +211,11 @@ double ComputeRHEOKernel::calc_dw(int i, int j, double delx, double dely, double // Calc wp and default dW's, a bit inefficient but can redo later wp = calc_dw_quintic(i,j,delx,dely,delz,r,dWij,dWji); - if(kernel_type == CRK1) { + if(kernel_style == CRK1) { //check if kernel correction calculated successfully. If not, revert to quintic if (corrections_i) calc_dw_crk1(i,j,delx,dely,delz,r,dWij); if (corrections_j) calc_dw_crk1(j,i,-delx,-dely,-delz,r,dWji); - } else if(kernel_type == CRK2) { + } else if(kernel_style == CRK2) { if (corrections_i) calc_dw_crk2(i,j,delx,dely,delz,r,dWij); if (corrections_j) calc_dw_crk2(j,i,-delx,-dely,-delz,r,dWji); } @@ -228,7 +228,7 @@ double ComputeRHEOKernel::calc_dw(int i, int j, double delx, double dely, double double ComputeRHEOKernel::calc_w_quintic(int i, int j, double delx, double dely, double delz, double r) { double w, tmp1, tmp2, tmp3, tmp1sq, tmp2sq, tmp3sq, s; - s = r * 3.0 * ih; + s = r * 3.0 * hinv; if (s > 3.0) { w = 0.0; @@ -266,7 +266,7 @@ double ComputeRHEOKernel::calc_dw_quintic(int i, int j, double delx, double dely double *mass = atom->mass; int *type = atom->type; - s = r * 3.0 * ih; + s = r * 3.0 * hinv; if (s > 3.0) { wp = 0.0; @@ -496,9 +496,9 @@ void ComputeRHEOKernel::compute_peratom() gsl_error_flag = 0; gsl_error_tags.clear(); - if (kernel_type == FixRHEO::QUINTIC) return; + if (kernel_style == QUINTIC) return; - int i, j, ii, jj, inum, jnum, g, a, b, gsl_error; + int i, j, ii, jj, inum, jnum, itype, g, a, b, gsl_error; double xtmp, ytmp, ztmp, r, rsq, w, vj; double dx[3]; gsl_matrix_view gM; @@ -520,9 +520,9 @@ void ComputeRHEOKernel::compute_peratom() firstneigh = list->firstneigh; // Grow arrays if necessary - if (nmax_old < atom->nmax) grow_arrays(atom->nmax); + if (nmax_store < atom->nmax) grow_arrays(atom->nmax); - if (kernel_type == FixRHEO::CRK0) { + if (kernel_style == CRK0) { double M; for (ii = 0; ii < inum; ii++) { @@ -544,12 +544,12 @@ void ComputeRHEOKernel::compute_peratom() dx[0] = xtmp - x[j][0]; dx[1] = ytmp - x[j][1]; dx[2] = ztmp - x[j][2]; - rsq = lensq(dx); + rsq = lensq3(dx); if (rsq < hsq) { r = sqrt(rsq); w = calc_w_quintic(i,j,dx[0],dx[1],dx[2],r); - if (!(status[j] & FixRHEO::STATUS_FLUID) && solid_flag) { + if (!(status[j] & STATUS_FLUID) && solid_flag) { vj = mass[type[j]] / compute_interface->correct_rho(j,i); } else vj = mass[type[j]] / rho[j]; @@ -590,22 +590,24 @@ void ComputeRHEOKernel::compute_peratom() dx[1] = ytmp - x[j][1]; dx[2] = ztmp - x[j][2]; - rsq = lensq(dx); + rsq = lensq3(dx); - if (rsq < cutsq) { + if (rsq < hsq) { r = sqrt(rsq); w = calc_w_quintic(i,j,dx[0],dx[1],dx[2],r); - if (status[j] > FixRHEO::FLUID_MAX && solid_flag) - vj = mass[type[j]]/compute_interface->correct_rho(j,i); - else vj = mass[type[j]]/rho[j]; + if (solid_flag) + if (!(status[j] & STATUS_FLUID)) + vj = mass[type[j]]/compute_interface->correct_rho(j,i); + else + vj = mass[type[j]]/rho[j]; //Populate the H-vector of polynomials (2D) if (dim == 2) { H[0] = 1.0; H[1] = dx[0] * hinv; H[2] = dx[1] * hinv; - if (kernel_type == FixRHEO::CRK2) { + if (kernel_style == CRK2) { H[3] = 0.5 * dx[0] * dx[0] * hsqinv; H[4] = 0.5 * dx[1] * dx[1] * hsqinv; H[5] = dx[0] * dx[1] * hsqinv; @@ -615,7 +617,7 @@ void ComputeRHEOKernel::compute_peratom() H[1] = dx[0] * hinv; H[2] = dx[1] * hinv; H[3] = dx[2] * hinv; - if (kernel_type == FixRHEO::CRK2) { + if (kernel_style == CRK2) { H[4] = 0.5 * dx[0] * dx[0] * hsqinv; H[5] = 0.5 * dx[1] * dx[1] * hsqinv; H[6] = 0.5 * dx[2] * dx[2] * hsqinv; @@ -642,7 +644,7 @@ void ComputeRHEOKernel::compute_peratom() } // Skip if undercoordinated - if (coordination[i] < zmin) continue + if (coordination[i] < zmin) continue; // Use gsl to get Minv, use Cholesky decomposition since the // polynomials are independent, M is symmetrix & positive-definite @@ -656,7 +658,7 @@ void ComputeRHEOKernel::compute_peratom() //check if not positive-definite if (gsl_error != GSL_EDOM) - error->warn(FLERR, "Failed decomposition in rheo/kernel, gsl_error = {}", gsl_error); + error->warning(FLERR, "Failed decomposition in rheo/kernel, gsl_error = {}", gsl_error); continue; } @@ -689,7 +691,7 @@ void ComputeRHEOKernel::compute_peratom() // columns 1-2 (2D) or 1-3 (3D) //Second derivatives - if (kernel_type == FixRHEO::CRK2) + if (kernel_style == CRK2) C[i][1 + dim + b][a] = M[a * Mdim + b + 1 + dim] * hsqinv; // columns 3-4 (2D) or 4-6 (3D) } @@ -721,7 +723,7 @@ void ComputeRHEOKernel::compute_coordination() firstneigh = list->firstneigh; // Grow arrays if necessary - if (nmax_old < atom->nmax) grow_arrays(atom->nmax); + if (nmax_store < atom->nmax) grow_arrays(atom->nmax); for (ii = 0; ii < inum; ii++) { i = ilist[ii]; @@ -740,7 +742,7 @@ void ComputeRHEOKernel::compute_coordination() dx[0] = xtmp - x[j][0]; dx[1] = ytmp - x[j][1]; dx[2] = ztmp - x[j][2]; - rsq = lensq(dx); + rsq = lensq3(dx); if (rsq < hsq) coordination[i] += 1; @@ -759,13 +761,13 @@ void ComputeRHEOKernel::grow_arrays(int nmax) { memory->grow(coordination, nmax, "atom:rheo_coordination"); - if (kernel_type == FixRHEO::CRK0) { + if (kernel_style == CRK0) { memory->grow(C0, nmax, "rheo/kernel:C0"); } else if (correction_order > 0) { memory->grow(C, nmax, ncor, Mdim, "rheo/kernel:C"); } - nmax_old = nmax; + nmax_store = nmax; } /* ---------------------------------------------------------------------- */ @@ -781,7 +783,7 @@ int ComputeRHEOKernel::pack_forward_comm(int n, int *list, double *buf, if (comm_stage == 0) { buf[m++] = coordination[j]; } else { - if (kernel_type == FixRHEO::CRK0) { + if (kernel_style == CRK0) { buf[m++] = C0[j]; } else { for (a = 0; a < ncor; a++) @@ -805,7 +807,7 @@ void ComputeRHEOKernel::unpack_forward_comm(int n, int first, double *buf) if (comm_stage == 0) { coordination[i] = buf[m++]; } else { - if (kernel_type == FixRHEO::CRK0) { + if (kernel_style == CRK0) { C0[i] = buf[m++]; } else { for (a = 0; a < ncor; a++) @@ -821,12 +823,12 @@ void ComputeRHEOKernel::unpack_forward_comm(int n, int first, double *buf) double ComputeRHEOKernel::memory_usage() { double bytes = 0.0; - bytes = (size_t) nmax_old * sizeof(int); + bytes = (size_t) nmax_store * sizeof(int); - if (kernel_type == FixRHEO::CRK0) { - bytes += (size_t) nmax_old * sizeof(double); + if (kernel_style == CRK0) { + bytes += (size_t) nmax_store * sizeof(double); } else if (correction_order > 0) { - bytes += (size_t) nmax_old * ncor * Mdim * sizeof(double); + bytes += (size_t) nmax_store * ncor * Mdim * sizeof(double); } return bytes; } diff --git a/src/RHEO/compute_rheo_kernel.h b/src/RHEO/compute_rheo_kernel.h index 19062e483b..1842406977 100644 --- a/src/RHEO/compute_rheo_kernel.h +++ b/src/RHEO/compute_rheo_kernel.h @@ -54,7 +54,7 @@ class ComputeRHEOKernel : public Compute { std::unordered_set gsl_error_tags; int kernel_style, zmin, dim, Mdim, ncor; - int nmax_old; + int nmax_store; double h, hsq, hinv, hsqinv, pre_w, pre_wp; double ***C; double *C0; diff --git a/src/RHEO/compute_rheo_rho_sum.cpp b/src/RHEO/compute_rheo_rho_sum.cpp index fafd948538..726d876ea1 100644 --- a/src/RHEO/compute_rheo_rho_sum.cpp +++ b/src/RHEO/compute_rheo_rho_sum.cpp @@ -49,7 +49,7 @@ void ComputeRHEORhoSum::init() cutsq = cut * cut; // need an occasional half neighbor list - neighbor->add_request(this, NeighConst::REQ_HALF); + neighbor->add_request(this, NeighConst::REQ_DEFAULT); } /* ---------------------------------------------------------------------- */ @@ -130,8 +130,9 @@ void ComputeRHEORhoSum::compute_peratom() int ComputeRHEORhoSum::pack_forward_comm(int n, int *list, double *buf, int /*pbc_flag*/, int * /*pbc*/) { - int i,j,k,m; - double * rho = atom->rho; + int i, j, k, m; + double *rho = atom->rho; + int *coordination = compute_kernel->coordination; m = 0; for (i = 0; i < n; i++) { @@ -145,7 +146,7 @@ int ComputeRHEORhoSum::pack_forward_comm(int n, int *list, double *buf, void ComputeRHEORhoSum::unpack_forward_comm(int n, int first, double *buf) { int i, k, m, last; - double * rho = atom->rho; + double *rho = atom->rho; m = 0; last = first + n; @@ -158,7 +159,7 @@ void ComputeRHEORhoSum::unpack_forward_comm(int n, int first, double *buf) int ComputeRHEORhoSum::pack_reverse_comm(int n, int first, double *buf) { - int i,k,m,last; + int i, k, m, last; double *rho = atom->rho; m = 0; @@ -173,7 +174,7 @@ int ComputeRHEORhoSum::pack_reverse_comm(int n, int first, double *buf) void ComputeRHEORhoSum::unpack_reverse_comm(int n, int *list, double *buf) { - int i,k,j,m; + int i, k, j, m; double *rho = atom->rho; m = 0; diff --git a/src/RHEO/compute_rheo_surface.cpp b/src/RHEO/compute_rheo_surface.cpp index 9a94ea6a76..180c430dd1 100644 --- a/src/RHEO/compute_rheo_surface.cpp +++ b/src/RHEO/compute_rheo_surface.cpp @@ -20,8 +20,8 @@ #include "atom.h" #include "comm.h" +#include "compute_rheo_interface.h" #include "compute_rheo_kernel.h" -#include "compute_rheo_solids.h" #include "domain.h" #include "error.h" #include "fix_rheo.h" @@ -33,18 +33,19 @@ #include "neigh_request.h" using namespace LAMMPS_NS; +using namespace RHEO_NS; using namespace FixConst; using namespace MathExtra; -#define EPSILON 1e-10; +static constexpr double EPSILON = 1e-10; /* ---------------------------------------------------------------------- */ ComputeRHEOSurface::ComputeRHEOSurface(LAMMPS *lmp, int narg, char **arg) : - Fix(lmp, narg, arg), fix_rheo(nullptr), list(nullptr), compute_kernel(nullptr), compute_solids(nullptr), + Compute(lmp, narg, arg), fix_rheo(nullptr), list(nullptr), compute_kernel(nullptr), compute_interface(nullptr), B(nullptr), gradC(nullptr), nsurface(nullptr), divr(nullptr), rsurface(nullptr) { - if (narg != 3) error->all(FLERR,"Illegal fix RHEO/SURFACE command"); + if (narg != 3) error->all(FLERR,"Illegal compute RHEO/SURFACE command"); int dim = domain->dimension; comm_forward = 2; @@ -75,19 +76,19 @@ ComputeRHEOSurface::~ComputeRHEOSurface() void ComputeRHEOSurface::init() { compute_kernel = fix_rheo->compute_kernel; - compute_solids = fix_rheo->compute_solids; + compute_interface = fix_rheo->compute_interface; cut = fix_rheo->cut; rho0 = fix_rheo->rho0; threshold_style = fix_rheo->surface_style; - threshold_divr = fix_rheo->divrsurface; - threshold_z = fix_rheo->zminsurface; + threshold_divr = fix_rheo->divr_surface; + threshold_z = fix_rheo->zmin_surface; cutsq = cut * cut; // Create rsurface, divr, nsurface arrays if they don't already exist // Create a custom atom property so it works with compute property/atom // Do not create grow callback as there's no reason to copy/exchange data - // Manually grow if nmax_old exceeded + // Manually grow if nmax_store exceeded // For B and gradC, create a local array since they are unlikely to be printed int tmp1, tmp2; @@ -103,12 +104,13 @@ void ComputeRHEOSurface::init() if (index == -1) index = atom->add_custom("rheo_nsurface", 1, 3); nsurface = atom->darray[index]; - nmax_old = atom->nmax; - memory->create(B, nmax_old, dim * dim, "rheo/surface:B"); - memory->create(gradC, nmax_old, dim * dim, "rheo/surface:gradC"); + nmax_store = atom->nmax; + int dim = domain->dimension; + memory->create(B, nmax_store, dim * dim, "rheo/surface:B"); + memory->create(gradC, nmax_store, dim * dim, "rheo/surface:gradC"); // need an occasional half neighbor list - neighbor->add_request(this, NeighConst::REQ_HALF); + neighbor->add_request(this, NeighConst::REQ_DEFAULT); } /* ---------------------------------------------------------------------- */ @@ -123,9 +125,8 @@ void ComputeRHEOSurface::init_list(int /*id*/, NeighList *ptr) void ComputeRHEOSurface::compute_peratom() { int i, j, ii, jj, inum, jnum, a, b, itype, jtype, fluidi, fluidj; - double xtmp, ytmp, ztmp, rsq, Voli, Volj, rhoi, rhoj; - double *dWij, *dWji; - double dx[3]; + double xtmp, ytmp, ztmp, rsq, Voli, Volj, rhoi, rhoj, wp; + double *dWij, *dWji, dx[3]; int *ilist, *jlist, *numneigh, **firstneigh; int nlocal = atom->nlocal; @@ -146,7 +147,7 @@ void ComputeRHEOSurface::compute_peratom() firstneigh = list->firstneigh; int nmax = atom->nmax; - if (nmax_old <= nmax) { + if (nmax_store <= nmax) { memory->grow(divr, nmax, "atom:rheo_divr"); memory->grow(rsurface, nmax, "atom:rheo_rsurface"); memory->grow(nsurface, nmax, 3, "atom:rheo_nsurface"); @@ -154,7 +155,7 @@ void ComputeRHEOSurface::compute_peratom() memory->grow(B, nmax, dim * dim, "rheo/surface:B"); memory->grow(gradC, nmax, dim * dim, "rheo/surface:gradC"); - nmax_old = atom->nmax; + nmax_store = atom->nmax; } int nall = nlocal + atom->nghost; @@ -169,7 +170,7 @@ void ComputeRHEOSurface::compute_peratom() divr[i] = 0.0; // Remove surface settings - status[i] &= FixRHEO::surfacemask; + status[i] &= SURFACEMASK; } // loop over neighbors to calculate the average orientation of neighbors @@ -182,7 +183,7 @@ void ComputeRHEOSurface::compute_peratom() jlist = firstneigh[i]; jnum = numneigh[i]; itype = type[i]; - fluidi = status[i] & FixRHEO::STATUS_FLUID; + fluidi = status[i] & STATUS_FLUID; for (jj = 0; jj < jnum; jj++) { j = jlist[jj]; @@ -192,19 +193,19 @@ void ComputeRHEOSurface::compute_peratom() dx[1] = ytmp - x[j][1]; dx[2] = ztmp - x[j][2]; - rsq = lensq(dx); + rsq = lensq3(dx); if (rsq < cutsq) { jtype = type[j]; - fluidj = status[j] & FixRHEO::STATUS_FLUID; + fluidj = status[j] & STATUS_FLUID; rhoi = rho[i]; rhoj = rho[j]; // Add corrections for walls if (fluidi && (!fluidj)) { - rhoj = compute_solids->correct_rho(j, i); + rhoj = compute_interface->correct_rho(j, i); } else if ((!fluidi) && fluidj) { - rhoi = compute_solids->correct_rho(i, j); + rhoi = compute_interface->correct_rho(i, j); } else if ((!fluidi) && (!fluidj)) { rhoi = rho0; rhoj = rho0; @@ -253,29 +254,29 @@ void ComputeRHEOSurface::compute_peratom() } // Find the free-surface - if (threshold_style == FixRHEO::DIVR) { + if (threshold_style == DIVR) { for (i = 0; i < nall; i++) { if (mask[i] & groupbit) { - status[i] |= FixRHEO::STATUS_BULK; + status[i] |= STATUS_BULK; rsurface[i] = cut; if (divr[i] < threshold_divr) { - status[i] |= FixRHEO::STATUS_SURFACE; + status[i] |= STATUS_SURFACE; rsurface[i] = 0.0; if (coordination[i] < threshold_z) - status[i] |= FixRHEO::STATUS_SPLASH; + status[i] |= STATUS_SPLASH; } } } } else { for (i = 0; i < nall; i++) { if (mask[i] & groupbit) { - status[i] |= FixRHEO::STATUS_BULK; + status[i] |= STATUS_BULK; rsurface[i] = cut; - if (coordination[i] < divR_limit) { - status[i] |= FixRHEO::STATUS_SURFACE; + if (coordination[i] < threshold_divr) { + status[i] |= STATUS_SURFACE; rsurface[i] = 0.0; if (coordination[i] < threshold_z) - status[i] |= FixRHEO::STATUS_SPLASH; + status[i] |= STATUS_SPLASH; } } } @@ -297,23 +298,23 @@ void ComputeRHEOSurface::compute_peratom() dx[0] = xtmp - x[j][0]; dx[1] = ytmp - x[j][1]; dx[2] = ztmp - x[j][2]; - rsq = lensq(dx); + rsq = lensq3(dx); if (rsq < cutsq) { - if ((status[i] & FixRHEO::STATUS_BULK) && (status[j] & FixRHEO::STATUS_SURFACE)) { - status[i] &= FixRHEO::surfacemask; - status[i] |= FixRHEO::STATUS_LAYER; + if ((status[i] & STATUS_BULK) && (status[j] & STATUS_SURFACE)) { + status[i] &= SURFACEMASK; + status[i] |= STATUS_LAYER; } - if (status[j] & FixRHEO::STATUS_SURFACE) rsurface[i] = MIN(rsurface[i], sqrt(rsq)); + if (status[j] & STATUS_SURFACE) rsurface[i] = MIN(rsurface[i], sqrt(rsq)); if (j < nlocal || newton) { - if ((status[j] & FixRHEO::STATUS_BULK) && (status[i] & FixRHEO::STATUS_SURFACE)) { - status[j] &= FixRHEO::surfacemask; - status[j] |= FixRHEO::STATUS_LAYER; + if ((status[j] & STATUS_BULK) && (status[i] & STATUS_SURFACE)) { + status[j] &= SURFACEMASK; + status[j] |= STATUS_LAYER; } - if (status[i] & FixRHEO::STATUS_SURFACE) rsurface[j] = MIN(rsurface[j], sqrt(rsq)); + if (status[i] & STATUS_SURFACE) rsurface[j] = MIN(rsurface[j], sqrt(rsq)); } } } @@ -371,7 +372,7 @@ void ComputeRHEOSurface::unpack_reverse_comm(int n, int *list, double *buf) } else if (comm_stage == 1) { temp = (int) buf[m++]; - if ((status[j] & FixRHEO::STATUS_BULK) && (temp & FixRHEO::STATUS_LAYER)) + if ((status[j] & STATUS_BULK) && (temp & STATUS_LAYER)) status[j] = temp; rsurface[j] = MIN(rsurface[j], buf[m++]); diff --git a/src/RHEO/compute_rheo_surface.h b/src/RHEO/compute_rheo_surface.h index 224b2594a1..58a3e3b9c4 100644 --- a/src/RHEO/compute_rheo_surface.h +++ b/src/RHEO/compute_rheo_surface.h @@ -17,8 +17,8 @@ ComputeStyle(RHEO/SURFACE,ComputeRHEOSurface) // clang-format on #else -#ifndef LMP_COMPUTE_RHEO_INTERFACE_H -#define LMP_COMPUTE_RHEO_INTERFACE_H +#ifndef LMP_COMPUTE_RHEO_SURFACE_H +#define LMP_COMPUTE_RHEO_SURFACE_H #include "compute.h" @@ -36,18 +36,18 @@ class ComputeRHEOSurface : public Compute { int pack_forward_comm(int, int *, double *, int, int *) override; void unpack_forward_comm(int, int, double *) override; - double **nsurface, **rsurface; + double **nsurface, *rsurface; class FixRHEO *fix_rheo; private: double cut, cutsq, rho0, threshold_divr; - int surface_style, nmax_old, threshold_z; + int surface_style, nmax_store, threshold_z; double **B, **gradC, *divr; int threshold_style, comm_stage; class NeighList *list; class ComputeRHEOKernel *compute_kernel; - class ComputeRHEOSolids *compute_solids; + class ComputeRHEOInterface *compute_interface; }; } // namespace LAMMPS_NS diff --git a/src/RHEO/compute_rheo_vshift.cpp b/src/RHEO/compute_rheo_vshift.cpp index 1b3edcffd8..440bfc7fc7 100644 --- a/src/RHEO/compute_rheo_vshift.cpp +++ b/src/RHEO/compute_rheo_vshift.cpp @@ -32,6 +32,7 @@ #include "neigh_request.h" using namespace LAMMPS_NS; +using namespace RHEO_NS; /* ---------------------------------------------------------------------- */ @@ -47,15 +48,15 @@ ComputeRHEOVShift::ComputeRHEOVShift(LAMMPS *lmp, int narg, char **arg) : // Create vshift array if it doesn't already exist // Create a custom atom property so it works with compute property/atom // Do not create grow callback as there's no reason to copy/exchange data - // Manually grow if nmax_old exceeded + // Manually grow if nmax_store exceeded int tmp1, tmp2; int index = atom->find_custom("rheo_vshift", tmp1, tmp2); if (index == -1) { index = atom->add_custom("rheo_vshift", 1, 3); - nmax_old = atom->nmax; + nmax_store = atom->nmax; } - vshift = atom->dvector[index]; + vshift = atom->darray[index]; } /* ---------------------------------------------------------------------- */ @@ -108,16 +109,17 @@ void ComputeRHEOVShift::compute_peratom() int *jlist; int inum, *ilist, *numneigh, **firstneigh; - int nlocal = atom->nlocal; - int nall = nlocal + atom->nghost; - double **x = atom->x; - double **v = atom->v; int *type = atom->type; int *status = atom->status; - int *surface = atom->surface; + int *mask = atom->mask; + double **x = atom->x; + double **v = atom->v; double *rho = atom->rho; double *mass = atom->mass; + + int nlocal = atom->nlocal; + int nall = nlocal + atom->nghost; int newton_pair = force->newton_pair; inum = list->inum; @@ -125,9 +127,9 @@ void ComputeRHEOVShift::compute_peratom() numneigh = list->numneigh; firstneigh = list->firstneigh; - if (nmax_old < atom->nmax) { + if (nmax_store < atom->nmax) { memory->grow(vshift, atom->nmax, 3, "atom:rheo_vshift"); - nmax_old = atom->nmax; + nmax_store = atom->nmax; } for (i = 0; i < nall; i++) @@ -143,15 +145,15 @@ void ComputeRHEOVShift::compute_peratom() jlist = firstneigh[i]; jnum = numneigh[i]; imass = mass[itype]; - fluidi = status[i] & FixRHEO::STATUS_FLUID; + fluidi = status[i] & STATUS_FLUID; for (jj = 0; jj < jnum; jj++) { j = jlist[jj]; j &= NEIGHMASK; - fluidj = status[j] & FixRHEO::STATUS_FLUID; + fluidj = status[j] & STATUS_FLUID; if ((!fluidi) && (!fluidj)) continue; - if (!(status[i] & FixRHEO::STATUS_SHIFT) && !(status[j] & FixRHEO::STATUS_SHIFT)) continue; + if (!(status[i] & STATUS_SHIFT) && !(status[j] & STATUS_SHIFT)) continue; dx[0] = xtmp - x[j][0]; dx[1] = ytmp - x[j][1]; @@ -175,10 +177,10 @@ void ComputeRHEOVShift::compute_peratom() // Add corrections for walls if (fluidi && (!fluidj)) { - compute_interface->correct_v(v[i], v[j], vi, i, j); + compute_interface->correct_v(vi, vj, i, j); rhoj = compute_interface->correct_rho(j,i); } else if ((!fluidi) && fluidj) { - compute_interface->correct_v(v[j], v[i], vj, j, i); + compute_interface->correct_v(vj, vi, j, i); rhoi = compute_interface->correct_rho(i,j); } else if ((!fluidi) && (!fluidj)) { rhoi = 1.0; @@ -215,7 +217,7 @@ void ComputeRHEOVShift::compute_peratom() } } - if (newton_pair) comm->reverse_comm_compute(this); + if (newton_pair) comm->reverse_comm(this); } @@ -239,7 +241,7 @@ void ComputeRHEOVShift::correct_surfaces() double nx,ny,nz,vx,vy,vz; for (i = 0; i < nlocal; i++) { if (mask[i] & groupbit) { - if ((status[i] & FixRHEO::STATUS_SURFACE) || (status[i] & FixRHEO::STATUS_LAYER)) { + if ((status[i] & STATUS_SURFACE) || (status[i] & STATUS_LAYER)) { nx = nsurf[i][0]; ny = nsurf[i][1]; vx = vshift[i][0]; @@ -297,6 +299,6 @@ void ComputeRHEOVShift::unpack_reverse_comm(int n, int *list, double *buf) double ComputeRHEOVShift::memory_usage() { - double bytes = 3 * nmax_old * sizeof(double); + double bytes = 3 * nmax_store * sizeof(double); return bytes; } diff --git a/src/RHEO/compute_rheo_vshift.h b/src/RHEO/compute_rheo_vshift.h index 88a9cdcd1d..8611e177d1 100644 --- a/src/RHEO/compute_rheo_vshift.h +++ b/src/RHEO/compute_rheo_vshift.h @@ -40,7 +40,7 @@ class ComputeRHEOVShift : public Compute { class FixRHEO *fix_rheo; private: - int nmax_old; + int nmax_store; double dtv, cut, cutsq, cutthird; int surface_flag; diff --git a/src/RHEO/fix_rheo.cpp b/src/RHEO/fix_rheo.cpp index 2b55320c4e..ff804fe007 100644 --- a/src/RHEO/fix_rheo.cpp +++ b/src/RHEO/fix_rheo.cpp @@ -33,6 +33,7 @@ #include "utils.h" using namespace LAMMPS_NS; +using namespace RHEO_NS; using namespace FixConst; /* ---------------------------------------------------------------------- */ @@ -68,6 +69,7 @@ FixRHEO::FixRHEO(LAMMPS *lmp, int narg, char **arg) : error->all(FLERR,"Insufficient arguments for fix rheo command"); h = utils::numeric(FLERR,arg[3],false,lmp); + cut = h; if (strcmp(arg[4],"Quintic") == 0) { kernel_style = QUINTIC; } else if (strcmp(arg[4],"CRK0") == 0) { @@ -101,7 +103,7 @@ FixRHEO::FixRHEO(LAMMPS *lmp, int narg, char **arg) : iarg += 2; } else if (strcmp(arg[iarg],"interface/reconstruction") == 0) { interface_flag = 1; - } else if (strcmp(arg[iarg],"rhosum") == 0) { + } else if (strcmp(arg[iarg],"rho/sum") == 0) { rhosum_flag = 1; } else if (strcmp(arg[iarg],"rho0") == 0) { if(iarg + 1 >= narg) error->all(FLERR,"Illegal rho0 option in fix rheo"); @@ -137,7 +139,8 @@ FixRHEO::~FixRHEO() void FixRHEO::post_constructor() { - compute_kernel = dynamic_cast(modify->add_compute("rheo_kernel all RHEO/KERNEL {}", kernel_style)); + compute_kernel = dynamic_cast(modify->add_compute( + fmt::format("rheo_kernel all RHEO/KERNEL {}", kernel_style))); compute_kernel->fix_rheo = this; std::string cmd = "rheo_grad all RHEO/GRAD velocity rho viscosity"; @@ -146,22 +149,26 @@ void FixRHEO::post_constructor() compute_grad->fix_rheo = this; if (rhosum_flag) { - compute_rhosum = dynamic_cast(modify->add_compute("rheo_rho_sum all RHEO/RHO/SUM")); + compute_rhosum = dynamic_cast(modify->add_compute( + "rheo_rho_sum all RHEO/RHO/SUM")); compute_rhosum->fix_rheo = this; } if (shift_flag) { - compute_vshift = dynamic_cast(modify->add_compute("rheo_vshift all RHEO/VSHIFT")); + compute_vshift = dynamic_cast(modify->add_compute( + "rheo_vshift all RHEO/VSHIFT")); compute_vshift->fix_rheo = this; } if (interface_flag) { - compute_interface = dynamic_cast(modify->add_compute(fmt::format("rheo_interface all RHEO/INTERFACE"))); + compute_interface = dynamic_cast(modify->add_compute( + "rheo_interface all RHEO/INTERFACE")); compute_interface->fix_rheo = this; } if (surface_flag) { - compute_surface = dynamic_cast(modify->add_compute(fmt::format("rheo_surface all RHEO/SURFACE"))); + compute_surface = dynamic_cast(modify->add_compute( + "rheo_surface all RHEO/SURFACE")); compute_surface->fix_rheo = this; } } @@ -193,7 +200,7 @@ void FixRHEO::init() void FixRHEO::setup_pre_force(int /*vflag*/) { // Check to confirm accessory fixes do not preceed FixRHEO - // Note: these fixes set this flag in setup_pre_force() + // Note: fixes set this flag in setup_pre_force() if (viscosity_fix_defined || pressure_fix_defined || thermal_fix_defined) error->all(FLERR, "Fix RHEO must be defined before all other RHEO fixes"); @@ -206,23 +213,23 @@ void FixRHEO::setup_pre_force(int /*vflag*/) void FixRHEO::setup(int /*vflag*/) { // Confirm all accessory fixes are defined - // Note: these fixes set this flag in setup_pre_force() + // Note: fixes set this flag in setup_pre_force() if (!viscosity_fix_defined) error->all(FLERR, "Missing fix rheo/viscosity"); if (!pressure_fix_defined) error->all(FLERR, "Missing fix rheo/pressure"); - if(!thermal_fix_defined && thermal_flag) + if((!thermal_fix_defined) && thermal_flag) error->all(FLERR, "Missing fix rheo/thermal"); - // Reset to zero for next run + // Reset to zero for future runs thermal_fix_defined = 0; viscosity_fix_defined = 0; pressure_fix_defined = 0; - // Check fixes cover all atoms (doesnt ensure user covers atoms created midrun) - // (pressure is currently required to be group all) + // Check fixes cover all atoms (may still fail if atoms are created) + // FixRHEOPressure currently requires group all auto visc_fixes = modify->get_fix_by_style("rheo/viscosity"); auto therm_fixes = modify->get_fix_by_style("rheo/thermal"); @@ -232,12 +239,12 @@ void FixRHEO::setup(int /*vflag*/) int covered; for (int i = 0; i < atom->nlocal; i++) { covered = 0; - for (auto fix in visc_fixes) + for (auto fix : visc_fixes) if (mask[i] & fix->groupbit) covered = 1; if (!covered) v_coverage_flag = 0; if (thermal_flag) { covered = 0; - for (auto fix in therm_fixes) + for (auto fix : therm_fixes) if (mask[i] & fix->groupbit) covered = 1; if (!covered) v_coverage_flag = 0; } @@ -253,11 +260,12 @@ void FixRHEO::setup(int /*vflag*/) void FixRHEO::initial_integrate(int /*vflag*/) { - // update v and x and rho of atoms in group + // update v, x and rho of atoms in group int i, a, b; double dtfm, divu; - int dim = domain->dimension; + int *type = atom->type; + int *mask = atom->mask; int *status = atom->status; double **x = atom->x; double **v = atom->v; @@ -266,16 +274,14 @@ void FixRHEO::initial_integrate(int /*vflag*/) double *drho = atom->drho; double *mass = atom->mass; double *rmass = atom->rmass; - int rmass_flag = atom->rmass_flag; - double **gradr = compute_grad->gradr; double **gradv = compute_grad->gradv; double **vshift; if (shift_flag) compute_vshift->vshift; - int *type = atom->type; - int *mask = atom->mask; int nlocal = atom->nlocal; + int rmass_flag = atom->rmass_flag; + int dim = domain->dimension; if (igroup == atom->firstgroup) nlocal = atom->nfirst; @@ -333,7 +339,7 @@ void FixRHEO::initial_integrate(int /*vflag*/) // Shifting atoms if (shift_flag) { - compute_vshift->correct_surfaces(); // COuld this be moved to preforce after the surface fix runs? + compute_vshift->correct_surfaces(); // Could this be moved to preforce after the surface fix runs? for (i = 0; i < nlocal; i++) { if (!(status[i] & STATUS_SHIFT)) continue; @@ -376,6 +382,7 @@ void FixRHEO::pre_force(int /*vflag*/) compute_vshift->compute_peratom(); // Remove extra shifting/no force options + int *mask = atom->mask; int *status = atom->status; int nall = atom->nlocal + atom->nghost; for (int i = 0; i < nall; i++) { @@ -393,26 +400,28 @@ void FixRHEO::pre_force(int /*vflag*/) /* ---------------------------------------------------------------------- */ -void FixRHEO::final_integrate() { - int *status = atom->status; - double **gradv = compute_grad->gradv; - double **x = atom->x; - double **v = atom->v; - double **f = atom->f; - - double *rho = atom->rho; - double *drho = atom->drho; - int *type = atom->type; - int *mask = atom->mask; - double *mass = atom->mass; +void FixRHEO::final_integrate() +{ int nlocal = atom->nlocal; if (igroup == atom->firstgroup) nlocal = atom->nfirst; + double dtfm, divu; - double *rmass = atom->rmass; - int rmass_flag = atom->rmass_flag; int i, a; + double **x = atom->x; + double **v = atom->v; + double **f = atom->f; + double **gradv = compute_grad->gradv; + double *rho = atom->rho; + double *drho = atom->drho; + double *mass = atom->mass; + double *rmass = atom->rmass; + int *type = atom->type; + int *mask = atom->mask; + int *status = atom->status; + + int rmass_flag = atom->rmass_flag; int dim = domain->dimension; // Update velocity diff --git a/src/RHEO/fix_rheo.h b/src/RHEO/fix_rheo.h index 0064f4c90b..1d8ae06159 100644 --- a/src/RHEO/fix_rheo.h +++ b/src/RHEO/fix_rheo.h @@ -39,33 +39,10 @@ class FixRHEO : public Fix { void reset_dt() override; // Model parameters - double h, rho0, csq; + double h, cut, rho0, csq; int zmin_kernel, zmin_surface; int kernel_style, surface_style; double divr_surface; - enum {QUINTIC, CRK0, CRK1, CRK2}; - enum {COORDINATION, DIVR}; - - // Status variables - enum { - // Phase status - STATUS_FLUID = 1 << 0, - STATUS_REACTIVE = 1 << 1, - STATUS_SOLID = 1 << 2, - STATUS_FREEZING = 1 << 3, - - // Surface status - STATUS_BULK = 1 << 4, - STATUS_LAYER = 1 << 5, - STATUS_SURFACE = 1 << 6, - STATUS_SPLASH = 1 << 7, - - // Temporary status options - reset in preforce - STATUS_SHIFT = 1 << 8, - STATUS_NO_FORCE = 1 << 9 - }; - int phasemask = 0xFFFFFFF0; - int surfacemask = 0xFFFFFF0F; // Accessory fixes/computes int thermal_flag; @@ -89,6 +66,32 @@ class FixRHEO : public Fix { double dtv, dtf; }; +namespace RHEO_NS { + + enum {QUINTIC, CRK0, CRK1, CRK2}; + enum {COORDINATION, DIVR}; + + // Status variables + enum Status{ + // Phase status + STATUS_FLUID = 1 << 0, + STATUS_REACTIVE = 1 << 1, + STATUS_SOLID = 1 << 2, + STATUS_FREEZING = 1 << 3, + // Surface status + STATUS_BULK = 1 << 4, + STATUS_LAYER = 1 << 5, + STATUS_SURFACE = 1 << 6, + STATUS_SPLASH = 1 << 7, + // Temporary status options - reset in preforce + STATUS_SHIFT = 1 << 8, + STATUS_NO_FORCE = 1 << 9 + }; + + int PHASEMASK = 0xFFFFFFF0; + int SURFACEMASK = 0xFFFFFF0F; + +} // namespace RHEO_NS } // namespace LAMMPS_NS #endif diff --git a/src/RHEO/fix_rheo_pressure.cpp b/src/RHEO/fix_rheo_pressure.cpp index 726c44c32b..75edf42572 100644 --- a/src/RHEO/fix_rheo_pressure.cpp +++ b/src/RHEO/fix_rheo_pressure.cpp @@ -33,6 +33,8 @@ using namespace LAMMPS_NS; using namespace FixConst; enum {NONE, LINEAR, CUBIC, TAITWATER}; +static constexpr double SEVENTH = 1.0 / 7.0; + /* ---------------------------------------------------------------------- */ FixRHEOPressure::FixRHEOPressure(LAMMPS *lmp, int narg, char **arg) : @@ -43,7 +45,7 @@ FixRHEOPressure::FixRHEOPressure(LAMMPS *lmp, int narg, char **arg) : pressure_style = NONE; comm_forward = 1; - nmax_old = 0; + nmax_store = 0; // Currently can only have one instance of fix rheo/pressure if (igroup != 0) @@ -112,13 +114,13 @@ void FixRHEOPressure::setup_pre_force(int /*vflag*/) // Create pressure array if it doesn't already exist // Create a custom atom property so it works with compute property/atom // Do not create grow callback as there's no reason to copy/exchange data - // Manually grow if nmax_old exceeded + // Manually grow if nmax_store exceeded int tmp1, tmp2; int index = atom->find_custom("rheo_pressure", tmp1, tmp2); if (index == -1) { index = atom->add_custom("rheo_pressure", 1, 0); - nmax_old = atom->nmax; + nmax_store = atom->nmax; } pressure = atom->dvector[index]; @@ -139,13 +141,11 @@ void FixRHEOPressure::pre_force(int /*vflag*/) int nlocal = atom->nlocal; - if (nmax_old < atom->nmax) { + if (nmax_store < atom->nmax) { memory->grow(pressure, atom->nmax, "atom:rheo_pressure"); - nmax_old = atom->nmax; + nmax_store = atom->nmax; } - if (pressure_style == TAITWATER) inv7 = 1.0 / 7.0; - for (i = 0; i < nlocal; i++) { if (mask[i] & groupbit) { if (pressure_style == LINEAR) { @@ -156,7 +156,7 @@ void FixRHEOPressure::pre_force(int /*vflag*/) } else if (pressure_style == TAITWATER) { rho_ratio = rho[i] / rho0inv; rr3 = rho_ratio * rho_ratio * rho_ratio; - pressure[i] = csq * rho0 * inv7 * (rr3 * rr3 * rho_ratio - 1.0); + pressure[i] = csq * rho0 * SEVENTH * (rr3 * rr3 * rho_ratio - 1.0); } } } @@ -194,9 +194,10 @@ void FixRHEOPressure::unpack_forward_comm(int n, int first, double *buf) /* ---------------------------------------------------------------------- */ -double FixRHEOPressure::calculate_p(double rho) +double FixRHEOPressure::calc_pressure(double rho) { - double rho; + double p, dr, rr3, rho_ratio; + if (pressure_style == LINEAR) { p = csq * (rho - rho0); } else if (pressure_style == CUBIC) { @@ -205,7 +206,7 @@ double FixRHEOPressure::calculate_p(double rho) } else if (pressure_style == TAITWATER) { rho_ratio = rho / rho0inv; rr3 = rho_ratio * rho_ratio * rho_ratio; - p = csq * rho0 * inv7 * (rr3 * rr3 * rho_ratio - 1.0); + p = csq * rho0 * SEVENTH * (rr3 * rr3 * rho_ratio - 1.0); } return rho; } @@ -215,6 +216,6 @@ double FixRHEOPressure::calculate_p(double rho) double FixRHEOPressure::memory_usage() { double bytes = 0.0; - bytes += (size_t) nmax_old * sizeof(double); + bytes += (size_t) nmax_store * sizeof(double); return bytes; } diff --git a/src/RHEO/fix_rheo_pressure.h b/src/RHEO/fix_rheo_pressure.h index 197cab6e5c..c257f1dbfb 100644 --- a/src/RHEO/fix_rheo_pressure.h +++ b/src/RHEO/fix_rheo_pressure.h @@ -35,13 +35,14 @@ class FixRHEOPressure : public Fix { int pack_forward_comm(int, int *, double *, int, int *) override; void unpack_forward_comm(int, int, double *) override; double memory_usage() override; - double calculate_p(double); + double calc_pressure(double); + private: double c_cubic, csq, rho0, rho0inv; double *pressure; int pressure_style; int first_flag, last_flag; - int nmax_old; + int nmax_store; class FixRHEO *fix_rheo; }; diff --git a/src/RHEO/fix_rheo_thermal.cpp b/src/RHEO/fix_rheo_thermal.cpp index fd08f39fd7..5df8c1c506 100644 --- a/src/RHEO/fix_rheo_thermal.cpp +++ b/src/RHEO/fix_rheo_thermal.cpp @@ -22,6 +22,7 @@ #include "comm.h" #include "compute_rheo_grad.h" #include "compute_rheo_vshift.h" +#include "domain.h" #include "error.h" #include "fix_rheo.h" #include "force.h" @@ -31,14 +32,15 @@ #include "update.h" using namespace LAMMPS_NS; +using namespace RHEO_NS; using namespace FixConst; enum {NONE, CONSTANT, TYPE}; /* ---------------------------------------------------------------------- */ FixRHEOThermal::FixRHEOThermal(LAMMPS *lmp, int narg, char **arg) : - Fix(lmp, narg, arg), Tc_type(nullptr), kappa_type(nullptr), cv_type(nullptr), - conductivity(nullptr) + Fix(lmp, narg, arg), fix_rheo(nullptr), compute_grad(nullptr), compute_vshift(nullptr), + Tc_type(nullptr), kappa_type(nullptr), cv_type(nullptr), conductivity(nullptr) { if (narg < 4) error->all(FLERR,"Illegal fix command"); @@ -47,7 +49,7 @@ FixRHEOThermal::FixRHEOThermal(LAMMPS *lmp, int narg, char **arg) : conductivity_style = NONE; comm_forward = 1; - nmax_old = 0; + nmax_store = 0; int ntypes = atom->ntypes; int iarg = 3; @@ -181,13 +183,13 @@ void FixRHEOThermal::setup_pre_force(int /*vflag*/) // Identify whether this is the first/last instance of fix thermal // First will grow arrays, last will communicate - first_flag = 0 + first_flag = 0; last_flag = 0; int i = 0; auto fixlist = modify->get_fix_by_style("rheo/thermal"); - for (const auto &ifix : fixlist) { - if (strcmp(ifix->id, id) == 0) break; + for (const auto &fix : fixlist) { + if (strcmp(fix->id, id) == 0) break; i++; } @@ -197,13 +199,13 @@ void FixRHEOThermal::setup_pre_force(int /*vflag*/) // Create conductivity array if it doesn't already exist // Create a custom atom property so it works with compute property/atom // Do not create grow callback as there's no reason to copy/exchange data - // Manually grow if nmax_old exceeded + // Manually grow if nmax_store exceeded int tmp1, tmp2; - index = atom->find_custom("rheo_conductivity", tmp1, tmp2); + int index = atom->find_custom("rheo_conductivity", tmp1, tmp2); if (index== -1) { index = atom->add_custom("rheo_conductivity", 1, 0); - nmax_old = atom->nmax; + nmax_store = atom->nmax; } conductivity = atom->dvector[index]; @@ -217,13 +219,16 @@ void FixRHEOThermal::initial_integrate(int /*vflag*/) { // update temperature from shifting if (!fix_rheo->shift_flag) return; - int i; + int i, a; + int *status = atom->status; + int *mask = atom->mask; + double *temperature = atom->temperature; double **gradt = compute_grad->gradt; double **vshift = compute_vshift->array_atom; - int *mask = atom->mask; int nlocal = atom->nlocal; + int dim = domain->dimension; if (igroup == atom->firstgroup) nlocal = atom->nfirst; @@ -248,14 +253,14 @@ void FixRHEOThermal::post_integrate() double *heatflow = atom->heatflow; double *rho = atom->rho; int *mask = atom->mask; - int *type = aotm->type; + int *type = atom->type; double cvi, Tci, Ti; //Integrate temperature and check status for (int i = 0; i < atom->nlocal; i++) { if (mask[i] & groupbit) { - if (status[i] == FixRHEO::FLUID_NO_FORCE) continue; + if (status[i] & STATUS_NO_FORCE) continue; cvi = calc_cv(i); temperature[i] += dtf * heatflow[i] / cvi; @@ -265,15 +270,15 @@ void FixRHEOThermal::post_integrate() if (Tc_style == CONSTANT) { Tci = Tc; } else if (Tc_style == TYPE) { - Tci = Tc_type[type[i]]); + Tci = Tc_type[type[i]]; } if (Ti > Tci) { - status[i] &= FixRHEO::phasemask; - status[i] |= FixRHEO::STATUS_FLUID; - } else if (!(status[i] & FixRHEO::STATUS_SOLID)) - status[i] &= FixRHEO::phasemask; - status[i] |= FixRHEO::STATUS_FREEZING; + status[i] &= PHASEMASK; + status[i] |= STATUS_FLUID; + } else if (!(status[i] & STATUS_SOLID)) { + status[i] &= PHASEMASK; + status[i] |= STATUS_FREEZING; } } } @@ -288,14 +293,13 @@ void FixRHEOThermal::post_neighbor() { int i; int *type = atom->type; - double *conductivity = atom->dvector[index_cond]; int *mask = atom->mask; int nlocal = atom->nlocal; int nall = nlocal + atom->nghost; - if (first_flag && (nmax_old < atom->nmax)) { + if (first_flag && (nmax_store < atom->nmax)) { memory->grow(conductivity, atom->nmax, "atom:rheo_conductivity"); - nmax_old = atom->nmax; + nmax_store = atom->nmax; } if (conductivity_style == CONSTANT) { @@ -304,7 +308,6 @@ void FixRHEOThermal::post_neighbor() } else if (conductivity_style == TYPE) { for (i = 0; i < nall; i++) if (mask[i] & groupbit) conductivity[i] = kappa_type[type[i]]; - } } } @@ -329,9 +332,9 @@ void FixRHEOThermal::pre_force(int /*vflag*/) //int *mask = atom->mask; //int nlocal = atom->nlocal; - //if (first_flag && (nmax_old < atom->nmax)) { + //if (first_flag && (nmax_store < atom->nmax)) { // memory->grow(conductivity, atom->nmax, "atom:rheo_conductivity"); - // nmax_old = atom->nmax; + // nmax_store = atom->nmax; //} //if (conductivity_style == TBD) { @@ -358,7 +361,7 @@ void FixRHEOThermal::final_integrate() //Integrate temperature and check status for (int i = 0; i < atom->nlocal; i++) { if (mask[i] & groupbit) { - if (status[i] & FixRHEO::STATUS_NO_FORCE) continue; + if (status[i] & STATUS_NO_FORCE) continue; cvi = calc_cv(i); temperature[i] += dtf * heatflow[i] / cvi; @@ -447,6 +450,6 @@ void FixRHEOThermal::unpack_reverse_comm(int n, int *list, double *buf) double FixRHEOThermal::memory_usage() { double bytes = 0.0; - bytes += (size_t) nmax_old * sizeof(double); + bytes += (size_t) nmax_store * sizeof(double); return bytes; } diff --git a/src/RHEO/fix_rheo_thermal.h b/src/RHEO/fix_rheo_thermal.h index 4f0e89f17c..cf64c0b8d1 100644 --- a/src/RHEO/fix_rheo_thermal.h +++ b/src/RHEO/fix_rheo_thermal.h @@ -31,7 +31,7 @@ class FixRHEOThermal : public Fix { int setmask() override; void init() override; void setup_pre_force(int) override; - void initial_integrate() override; + void initial_integrate(int) override; void post_integrate() override; void post_neighbor() override; void pre_force(int) override; @@ -53,9 +53,11 @@ class FixRHEOThermal : public Fix { int cv_style; int conductivity_style; int first_flag, last_flag; - int nmax_old; + int nmax_store; class FixRHEO *fix_rheo; + class ComputeRHEOGrad *compute_grad; + class ComputeRHEOVShift *compute_vshift; double calc_cv(int); }; diff --git a/src/RHEO/fix_rheo_viscosity.cpp b/src/RHEO/fix_rheo_viscosity.cpp index 5ae1b95529..b15f488370 100644 --- a/src/RHEO/fix_rheo_viscosity.cpp +++ b/src/RHEO/fix_rheo_viscosity.cpp @@ -44,7 +44,7 @@ FixRHEOViscosity::FixRHEOViscosity(LAMMPS *lmp, int narg, char **arg) : viscosity_style = NONE; comm_forward = 0; - nmax_old = 0; + nmax_store = 0; int ntypes = atom->ntypes; int iarg = 3; @@ -89,7 +89,7 @@ FixRHEOViscosity::~FixRHEOViscosity() // Remove custom property if it exists int tmp1, tmp2, index; index = atom->find_custom("rheo_viscosity", tmp1, tmp2); - if (index != -1) atom->remove_custom(index_visc, 1, 0); + if (index != -1) atom->remove_custom(index, 1, 0); memory->destroy(eta_type); } @@ -123,13 +123,13 @@ void FixRHEOViscosity::setup_pre_force(int /*vflag*/) // Identify whether this is the first/last instance of fix viscosity // First will grow arrays, last will communicate - first_flag = 0 + first_flag = 0; last_flag = 0; int i = 0; auto fixlist = modify->get_fix_by_style("rheo/viscosity"); - for (const auto &ifix : fixlist) { - if (strcmp(ifix->id, id) == 0) break; + for (const auto &fix : fixlist) { + if (strcmp(fix->id, id) == 0) break; i++; } @@ -139,13 +139,13 @@ void FixRHEOViscosity::setup_pre_force(int /*vflag*/) // Create viscosity array if it doesn't already exist // Create a custom atom property so it works with compute property/atom // Do not create grow callback as there's no reason to copy/exchange data - // Manually grow if nmax_old exceeded + // Manually grow if nmax_store exceeded int tmp1, tmp2; int index = atom->find_custom("rheo_viscosity", tmp1, tmp2); - if (index_visc == -1) { + if (index == -1) { index = atom->add_custom("rheo_viscosity", 1, 0); - nmax_old = atom->nmax; + nmax_store = atom->nmax; } viscosity = atom->dvector[index]; @@ -167,9 +167,9 @@ void FixRHEOViscosity::post_neighbor() int nlocal = atom->nlocal; int nall = nlocal + atom->nghost; - if (first_flag && (nmax_old < atom->nmax)) { + if (first_flag && (nmax_store < atom->nmax)) { memory->grow(viscosity, atom->nmax, "atom:rheo_viscosity"); - nmax_old = atom->nmax; + nmax_store = atom->nmax; } if (viscosity_style == CONSTANT) { @@ -178,7 +178,6 @@ void FixRHEOViscosity::post_neighbor() } else if (viscosity_style == TYPE) { for (i = 0; i < nall; i++) if (mask[i] & groupbit) viscosity[i] = eta_type[type[i]]; - } } } @@ -197,9 +196,9 @@ void FixRHEOViscosity::pre_force(int /*vflag*/) int nlocal = atom->nlocal; int dim = domain->dimension; - if (first_flag && (nmax_old < atom->nmax)) { + if (first_flag && (nmax_store < atom->nmax)) { memory->grow(viscosity, atom->nmax, "atom:rheo_viscosity"); - nmax_old = atom->nmax; + nmax_store = atom->nmax; } if (viscosity_style == POWER) { @@ -260,6 +259,6 @@ void FixRHEOViscosity::unpack_forward_comm(int n, int first, double *buf) double FixRHEOViscosity::memory_usage() { double bytes = 0.0; - bytes += (size_t) nmax_old * sizeof(double); + bytes += (size_t) nmax_store * sizeof(double); return bytes; } diff --git a/src/RHEO/fix_rheo_viscosity.h b/src/RHEO/fix_rheo_viscosity.h index 14f8b70de9..66df51601e 100644 --- a/src/RHEO/fix_rheo_viscosity.h +++ b/src/RHEO/fix_rheo_viscosity.h @@ -43,7 +43,7 @@ class FixRHEOViscosity : public Fix { double *viscosity; int viscosity_style; int first_flag, last_flag; - int nmax_old; + int nmax_store; class FixRHEO *fix_rheo; class ComputeRHEOGrad *compute_grad; diff --git a/src/RHEO/pair_rheo.cpp b/src/RHEO/pair_rheo.cpp index 5974b9b756..c61d613d82 100644 --- a/src/RHEO/pair_rheo.cpp +++ b/src/RHEO/pair_rheo.cpp @@ -39,9 +39,10 @@ #include using namespace LAMMPS_NS; +using namespace RHEO_NS; using namespace MathExtra; -#define EPSILON 1e-2 +static constexpr double EPSILON = 1e-2; /* ---------------------------------------------------------------------- */ @@ -83,6 +84,10 @@ void PairRHEO::compute(int eflag, int vflag) int *ilist, *jlist, *numneigh, **firstneigh; double imass, jmass, rsq, r, rinv; + int nlocal = atom->nlocal; + int newton_pair = force->newton_pair; + int dim = domain->dimension; + ev_init(eflag, vflag); double **gradv = compute_grad->gradv; @@ -123,11 +128,6 @@ void PairRHEO::compute(int eflag, int vflag) conductivity = atom->dvector[index]; } - int *ilist, *jlist, *numneigh, **firstneigh; - int nlocal = atom->nlocal; - int newton_pair = force->newton_pair; - int dim = domain->dimension; - inum = list->inum; ilist = list->ilist; numneigh = list->numneigh; @@ -145,7 +145,7 @@ void PairRHEO::compute(int eflag, int vflag) jnum = numneigh[i]; imass = mass[itype]; etai = viscosity[i]; - fluidi = status[i] & FixRHEO::STATUS_FLUID; + fluidi = status[i] & STATUS_FLUID; if (thermal_flag) { kappai = conductivity[i]; Ti = temperature[i]; @@ -167,7 +167,7 @@ void PairRHEO::compute(int eflag, int vflag) jmass = mass[jtype]; etaj = viscosity[j]; - fluidj = status[j] & FixRHEO::STATUS_FLUID; + fluidj = status[j] & STATUS_FLUID; if (thermal_flag) { Tj = temperature[j]; kappaj = conductivity[j]; @@ -202,7 +202,7 @@ void PairRHEO::compute(int eflag, int vflag) if (fluidi && (!fluidj)) { compute_interface->correct_v(vi, vj, i, j); rhoj = compute_interface->correct_rho(j, i); - Pj = fix_pressure->calculate_p(rhoj); + Pj = fix_pressure->calc_pressure(rhoj); if ((chi[j] > 0.9) && (r < (h * 0.5))) fmag = (chi[j] - 0.9) * (h * 0.5 - r) * rho0 * csq * h * rinv; @@ -210,9 +210,9 @@ void PairRHEO::compute(int eflag, int vflag) } else if ((!fluidi) && fluidj) { compute_interface->correct_v(vj, vi, j, i); rhoi = compute_interface->correct_rho(i, j); - Pi = calc_pressure(rhoi, itype); + Pi = fix_pressure->calc_pressure(rhoi); - if (chi[i] > 0.9 && r < (h * 0.5)) { + if (chi[i] > 0.9 && r < (h * 0.5)) fmag = (chi[i] - 0.9) * (h * 0.5 - r) * rho0 * csq * h * rinv; } else if ((!fluidi) && (!fluidj)) { @@ -244,7 +244,7 @@ void PairRHEO::compute(int eflag, int vflag) //Hydrostatic pressure forces fp_prefactor = voli * volj * (Pj + Pi); - sub3(v1, vj, du); + sub3(vi, vj, du); //Add artificial viscous pressure if required if (artificial_visc_flag && pair_avisc_flag){ @@ -423,15 +423,11 @@ void PairRHEO::setup() if (fixes.size() == 0) error->all(FLERR, "Need to define fix rheo to use pair rheo"); fix_rheo = dynamic_cast(fixes[0]); + // Currently only allow one instance of fix rheo/pressure fixes = modify->get_fix_by_style("rheo/pressure"); if (fixes.size() == 0) error->all(FLERR, "Need to define fix rheo/pressure to use pair rheo"); fix_pressure = dynamic_cast(fixes[0]); - int tmp1, tmp2; - index_pressure = atom->find_custom("rheo_pressure", tmp1, tmp2); - if (index_pressure == -1) index_pressure = atom->add_custom("rheo_pressure", 1, 0); - else error->all(FLERR, "Cannot find pressure value in pair rheo"); - compute_kernel = fix_rheo->compute_kernel; compute_grad = fix_rheo->compute_grad; compute_interface = fix_rheo->compute_interface; @@ -449,9 +445,9 @@ void PairRHEO::setup() error->all(FLERR,"Pair RHEO requires ghost atoms store velocity"); if (laplacian_order == -1) { - if (fix_rheo->kernel_type == FixRHEO::CRK2) + if (fix_rheo->kernel_style == CRK2) laplacian_order = 2; - else if (fix_rheo->kernel_type == FixRHEO::CRK1) + else if (fix_rheo->kernel_style == CRK1) laplacian_order = 1; else laplacian_order = 0; @@ -468,8 +464,5 @@ double PairRHEO::init_one(int i, int j) error->all(FLERR,"All pair rheo coeffs are not set"); } - cut[i][j] = h; - cut[j][i] = cut[i][j]; - - return cut[i][j]; + return h; } From 7cfe45c00b9da61a911de193b0c3682cff291357 Mon Sep 17 00:00:00 2001 From: jtclemm Date: Tue, 25 Apr 2023 10:29:39 -0600 Subject: [PATCH 028/158] Adding gsl version, cmake options, readme files --- cmake/CMakeLists.txt | 2 +- cmake/Modules/Packages/RHEO.cmake | 2 ++ cmake/presets/mingw-cross.cmake | 1 - cmake/presets/most.cmake | 1 - cmake/presets/windows.cmake | 1 - src/RHEO/README | 7 +++++++ src/RHEO/compute_rheo_kernel.cpp | 2 +- src/RHEO/fix_rheo.h | 4 ++-- 8 files changed, 13 insertions(+), 7 deletions(-) create mode 100644 cmake/Modules/Packages/RHEO.cmake create mode 100644 src/RHEO/README diff --git a/cmake/CMakeLists.txt b/cmake/CMakeLists.txt index f4a8b9c1ef..abcc392263 100644 --- a/cmake/CMakeLists.txt +++ b/cmake/CMakeLists.txt @@ -442,7 +442,7 @@ if(BUILD_OMP) target_link_libraries(lmp PRIVATE OpenMP::OpenMP_CXX) endif() -if(PKG_MSCG OR PKG_ATC OR PKG_AWPMD OR PKG_ML-QUIP OR PKG_ML-POD OR PKG_LATTE OR PKG_ELECTRODE) +if(PKG_MSCG OR PKG_ATC OR PKG_AWPMD OR PKG_ML-QUIP OR PKG_ML-POD OR PKG_LATTE OR PKG_ELECTRODE OR PKG_RHEO) enable_language(C) if (NOT USE_INTERNAL_LINALG) find_package(LAPACK) diff --git a/cmake/Modules/Packages/RHEO.cmake b/cmake/Modules/Packages/RHEO.cmake new file mode 100644 index 0000000000..970a141bbd --- /dev/null +++ b/cmake/Modules/Packages/RHEO.cmake @@ -0,0 +1,2 @@ +find_package(GSL REQUIRED) +target_link_libraries(lammps PRIVATE GSL::gsl) diff --git a/cmake/presets/mingw-cross.cmake b/cmake/presets/mingw-cross.cmake index ec21809edd..6c6170acd3 100644 --- a/cmake/presets/mingw-cross.cmake +++ b/cmake/presets/mingw-cross.cmake @@ -67,7 +67,6 @@ set(WIN_PACKAGES REACTION REAXFF REPLICA - RHEO RIGID SHOCK SMTBQ diff --git a/cmake/presets/most.cmake b/cmake/presets/most.cmake index 2a2cac2755..00c74c81b8 100644 --- a/cmake/presets/most.cmake +++ b/cmake/presets/most.cmake @@ -58,7 +58,6 @@ set(ALL_PACKAGES REACTION REAXFF REPLICA - RHEO RIGID SHOCK SPH diff --git a/cmake/presets/windows.cmake b/cmake/presets/windows.cmake index 9253d439a8..aa9a4656af 100644 --- a/cmake/presets/windows.cmake +++ b/cmake/presets/windows.cmake @@ -56,7 +56,6 @@ set(WIN_PACKAGES REACTION REAXFF REPLICA - RHEO RIGID SHOCK SMTBQ diff --git a/src/RHEO/README b/src/RHEO/README new file mode 100644 index 0000000000..00fff2d694 --- /dev/null +++ b/src/RHEO/README @@ -0,0 +1,7 @@ +RHEO or Reproducing Hydrodynamics and Elastic Objects is a package to model multiphase fluid +systems. The authors include Joel Clemmer (Sandia), Thomas O'Connor (Carnegie Mellon), and +Eric Palermo (Carnegie Mellon). + +This package requires the GNU scientific library (GSL) version 2.7 or later. To build this +package, one must first separately install GSL in a location that can be found by your +environment. diff --git a/src/RHEO/compute_rheo_kernel.cpp b/src/RHEO/compute_rheo_kernel.cpp index d96d8d234e..b7ad1c9b3f 100644 --- a/src/RHEO/compute_rheo_kernel.cpp +++ b/src/RHEO/compute_rheo_kernel.cpp @@ -649,7 +649,7 @@ void ComputeRHEOKernel::compute_peratom() // Use gsl to get Minv, use Cholesky decomposition since the // polynomials are independent, M is symmetrix & positive-definite gM = gsl_matrix_view_array(M,Mdim,Mdim); - gsl_error = gsl_linalg_cholesky_decomp(&gM.matrix); + gsl_error = gsl_linalg_cholesky_decomp1(&gM.matrix); if (gsl_error) { //Revert to uncorrected SPH for this particle diff --git a/src/RHEO/fix_rheo.h b/src/RHEO/fix_rheo.h index 1d8ae06159..f936206811 100644 --- a/src/RHEO/fix_rheo.h +++ b/src/RHEO/fix_rheo.h @@ -88,8 +88,8 @@ namespace RHEO_NS { STATUS_NO_FORCE = 1 << 9 }; - int PHASEMASK = 0xFFFFFFF0; - int SURFACEMASK = 0xFFFFFF0F; + #define PHASEMASK 0xFFFFFFF0; + #define SURFACEMASK 0xFFFFFF0F; } // namespace RHEO_NS } // namespace LAMMPS_NS From 7fc916a1d40d547cf1371b515a4c5e22a441db46 Mon Sep 17 00:00:00 2001 From: jtclemm Date: Tue, 25 Apr 2023 13:38:37 -0600 Subject: [PATCH 029/158] Prototyping example and accessory commands --- src/RHEO/README | 6 +- src/RHEO/compute_rheo_property_atom.cpp | 162 ++++++++++++++++++++++++ src/RHEO/compute_rheo_property_atom.h | 68 ++++++++++ src/RHEO/fix_rheo.h | 4 +- src/set.cpp | 27 +++- 5 files changed, 261 insertions(+), 6 deletions(-) create mode 100644 src/RHEO/compute_rheo_property_atom.cpp create mode 100644 src/RHEO/compute_rheo_property_atom.h diff --git a/src/RHEO/README b/src/RHEO/README index 00fff2d694..7090fc828c 100644 --- a/src/RHEO/README +++ b/src/RHEO/README @@ -2,6 +2,6 @@ RHEO or Reproducing Hydrodynamics and Elastic Objects is a package to model mult systems. The authors include Joel Clemmer (Sandia), Thomas O'Connor (Carnegie Mellon), and Eric Palermo (Carnegie Mellon). -This package requires the GNU scientific library (GSL) version 2.7 or later. To build this -package, one must first separately install GSL in a location that can be found by your -environment. +This package requires the GNU scientific library (GSL). We recommend version 2.7 or later. To +build this package, one must first separately install GSL in a location that can be found by +your environment. diff --git a/src/RHEO/compute_rheo_property_atom.cpp b/src/RHEO/compute_rheo_property_atom.cpp new file mode 100644 index 0000000000..a23ba5a639 --- /dev/null +++ b/src/RHEO/compute_rheo_property_atom.cpp @@ -0,0 +1,162 @@ +// clang-format off +/* ---------------------------------------------------------------------- + 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 authors: + Joel Clemmer (SNL), Thomas O'Connor (CMU), Eric Palermo (CMU) +----------------------------------------------------------------------- */ + +#include "compute_rheo_property_atom.h" + +#include "atom.h" +#include "atom_vec.h" +#include "error.h" +#include "memory.h" +#include "update.h" + +#include +#include + +using namespace LAMMPS_NS; + +/* ---------------------------------------------------------------------- */ + +ComputeRHEOPropertyAtom::ComputeRHEOPropertyAtom(LAMMPS *lmp, int narg, char **arg) : + Compute(lmp, narg, arg), + index(nullptr), colindex(nullptr), pack_choice(nullptr) +{ + if (narg < 4) utils::missing_cmd_args(FLERR, "compute property/atom", error); + + peratom_flag = 1; + nvalues = narg - 3; + if (nvalues == 1) size_peratom_cols = 0; + else size_peratom_cols = nvalues; + + // parse input values + // customize a new keyword by adding to if statement + + pack_choice = new FnPtrPack[nvalues]; + + int i; + for (int iarg = 3; iarg < narg; iarg++) { + i = iarg-3; + + if (strcmp(arg[iarg],"id") == 0) { + pack_choice[i] = &ComputeRHEOPropertyAtom::pack_id; + } else if (strcmp(arg[iarg],"mol") == 0) { + if (!atom->molecule_flag) + error->all(FLERR,"Compute property/atom {} is not available", arg[iarg]); + pack_choice[i] = &ComputeRHEOPropertyAtom::pack_molecule; + } else if (strcmp(arg[iarg],"proc") == 0) { + pack_choice[i] = &ComputeRHEOPropertyAtom::pack_proc; + } else if (strcmp(arg[iarg],"type") == 0) { + pack_choice[i] = &ComputeRHEOPropertyAtom::pack_type; + } else if (strcmp(arg[iarg],"mass") == 0) { + pack_choice[i] = &ComputeRHEOPropertyAtom::pack_mass; + + + } else { + error->all(FLERR,"Invalid keyword {} for compute rheo/property/atom command ", arg[iarg]); + } + } + + nmax = 0; +} + +/* ---------------------------------------------------------------------- */ + +ComputeRHEOPropertyAtom::~ComputeRHEOPropertyAtom() +{ + delete[] pack_choice; + memory->destroy(vector_atom); + memory->destroy(array_atom); +} + +/* ---------------------------------------------------------------------- */ + +void ComputeRHEOPropertyAtom::compute_peratom() +{ + invoked_peratom = update->ntimestep; + + // grow vector or array if necessary + + if (atom->nmax > nmax) { + nmax = atom->nmax; + if (nvalues == 1) { + memory->destroy(vector_atom); + memory->create(vector_atom,nmax,"rheo/property/atom:vector"); + } else { + memory->destroy(array_atom); + memory->create(array_atom,nmax,nvalues,"rheo/property/atom:array"); + } + } + + // fill vector or array with per-atom values + + if (nvalues == 1) { + buf = vector_atom; + (this->*pack_choice[0])(0); + } else { + if (nmax) buf = &array_atom[0][0]; + else buf = nullptr; + for (int n = 0; n < nvalues; n++) + (this->*pack_choice[n])(n); + } +} + +/* ---------------------------------------------------------------------- + memory usage of local atom-based array +------------------------------------------------------------------------- */ + +double ComputeRHEOPropertyAtom::memory_usage() +{ + double bytes = (double)nmax * nvalues * sizeof(double); + return bytes; +} + +/* ---------------------------------------------------------------------- + one method for every keyword compute rheo/property/atom can output + the atom property is packed into buf starting at n with stride nvalues + customize a new keyword by adding a method +------------------------------------------------------------------------- */ + +/* ---------------------------------------------------------------------- */ + +void ComputeRHEOPropertyAtom::pack_rho(int n) +{ + double *rho = atom->rho; + int *mask = atom->mask; + int nlocal = atom->nlocal; + + for (int i = 0; i < nlocal; i++) { + if (mask[i] & groupbit) buf[n] = rho[i]; + else buf[n] = 0.0; + n += nvalues; + } +} + +/* ---------------------------------------------------------------------- */ + +void ComputeRHEOPropertyAtom::pack_status(int n) +{ + int *status = atom->status; + int *mask = atom->mask; + int nlocal = atom->nlocal; + + for (int i = 0; i < nlocal; i++) { + if (mask[i] & groupbit) buf[n] = status[i]; + else buf[n] = 0.0; + n += nvalues; + } +} diff --git a/src/RHEO/compute_rheo_property_atom.h b/src/RHEO/compute_rheo_property_atom.h new file mode 100644 index 0000000000..26ca004da0 --- /dev/null +++ b/src/RHEO/compute_rheo_property_atom.h @@ -0,0 +1,68 @@ +/* -*- 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 COMPUTE_CLASS +// clang-format off +ComputeStyle(rheo/property/atom,ComputeRHEOPropertyAtom); +// clang-format on +#else + +#ifndef LMP_COMPUTE_RHEO_PROPERTY_ATOM_H +#define LMP_COMPUTE_RHEO_PROPERTY_ATOM_H + +#include "compute.h" + +namespace LAMMPS_NS { + +class ComputeRHEOPropertyAtom : public Compute { + public: + ComputeRHEOPropertyAtom(class LAMMPS *, int, char **); + ~ComputeRHEOPropertyAtom() override; + void compute_peratom() override; + double memory_usage() override; + + private: + int nvalues; + int nmax; + double *buf; + + typedef void (ComputeRHEOPropertyAtom::*FnPtrPack)(int); + FnPtrPack *pack_choice; // ptrs to pack functions + + void pack_rho(int); + void pack_drho(int); + void pack_temperature(int); + void pack_heatflow(int); + void pack_status(int); + void pack_phase(int); + void pack_surface(int); + void pack_r_surface(int); + void pack_divr_surface(int); + void pack_nx_surface(int); + void pack_ny_surface(int); + void pack_nz_surface(int); + void pack_coordination(int); + void pack_viscosity(int); + void pack_pressure(int); + void pack_conductivity(int); + void pack_cv(int); + void pack_vx_shift(int); + void pack_vy_shift(int); + void pack_vz_shift(int); + +}; + +} // namespace LAMMPS_NS + +#endif +#endif diff --git a/src/RHEO/fix_rheo.h b/src/RHEO/fix_rheo.h index f936206811..a74696e68c 100644 --- a/src/RHEO/fix_rheo.h +++ b/src/RHEO/fix_rheo.h @@ -75,8 +75,8 @@ namespace RHEO_NS { enum Status{ // Phase status STATUS_FLUID = 1 << 0, - STATUS_REACTIVE = 1 << 1, - STATUS_SOLID = 1 << 2, + STATUS_SOLID = 1 << 1, + STATUS_REACTIVE = 1 << 2, STATUS_FREEZING = 1 << 3, // Surface status STATUS_BULK = 1 << 4, diff --git a/src/set.cpp b/src/set.cpp index 3a175cbfe2..92033b772e 100644 --- a/src/set.cpp +++ b/src/set.cpp @@ -49,7 +49,7 @@ enum{TYPE,TYPE_FRACTION,TYPE_RATIO,TYPE_SUBSET, DIPOLE,DIPOLE_RANDOM,SPIN_ATOM,SPIN_RANDOM,SPIN_ELECTRON,RADIUS_ELECTRON, QUAT,QUAT_RANDOM,THETA,THETA_RANDOM,ANGMOM,OMEGA,TEMPERATURE, DIAMETER,RADIUS_ATOM,DENSITY,VOLUME,IMAGE,BOND,ANGLE,DIHEDRAL,IMPROPER, - SPH_E,SPH_CV,SPH_RHO,EDPD_TEMP,EDPD_CV,CC,SMD_MASS_DENSITY, + RHEO_STATUS,SPH_E,SPH_CV,SPH_RHO,EDPD_TEMP,EDPD_CV,CC,SMD_MASS_DENSITY, SMD_CONTACT_RADIUS,DPDTHETA,EPSILON,IVEC,DVEC,IARRAY,DARRAY}; #define BIG INT_MAX @@ -515,6 +515,24 @@ void Set::command(int narg, char **arg) topology(IMPROPER); iarg += 2; + } else if (strcmp(arg[iarg],"rheo/rho") == 0) { + if (iarg+2 > narg) utils::missing_cmd_args(FLERR, "set rheo/rho", error); + if (utils::strmatch(arg[iarg+1],"^v_")) varparse(arg[iarg+1],1); + else dvalue = utils::numeric(FLERR,arg[iarg+1],false,lmp); + if (!atom->rho_flag) + error->all(FLERR,"Cannot set attribute {} for atom style {}", arg[iarg], atom->get_style()); + set(SPH_RHO); + iarg += 2; + + } else if (strcmp(arg[iarg],"rheo/status") == 0) { + if (iarg+2 > narg) utils::missing_cmd_args(FLERR, "set rheo/status", error); + if (utils::strmatch(arg[iarg+1],"^v_")) varparse(arg[iarg+1],1); + else ivalue = utils::inumeric(FLERR,arg[iarg+1],false,lmp); + if (!atom->status_flag) + error->all(FLERR,"Cannot set attribute {} for atom style {}", arg[iarg], atom->get_style()); + set(RHEO_STATUS); + iarg += 2; + } else if (strcmp(arg[iarg],"sph/e") == 0) { if (iarg+2 > narg) utils::missing_cmd_args(FLERR, "set sph/e", error); if (utils::strmatch(arg[iarg+1],"^v_")) varparse(arg[iarg+1],1); @@ -881,6 +899,13 @@ void Set::set(int keyword) if (dvalue <= 0.0) error->one(FLERR,"Invalid volume in set command"); atom->vfrac[i] = dvalue; } + + else if (keyword == RHEO_STATUS) { + if (ivalue != 0 && ivalue !=2) + error->one(FLERR,"Invalid value {} in set command for rheo/status", ivalue); + atom->status[i] = ivalue; + } + else if (keyword == SPH_E) atom->esph[i] = dvalue; else if (keyword == SPH_CV) atom->cv[i] = dvalue; else if (keyword == SPH_RHO) atom->rho[i] = dvalue; From be568d257d34a7133a1851adf9fce9ddb7c1184c Mon Sep 17 00:00:00 2001 From: jtclemm Date: Tue, 25 Apr 2023 16:29:29 -0600 Subject: [PATCH 030/158] Adding output option for reorganized peratom values --- src/RHEO/atom_vec_rheo.cpp | 36 ++- src/RHEO/atom_vec_rheo.h | 2 +- src/RHEO/atom_vec_rheo_thermal.cpp | 200 ++++++++++++ src/RHEO/atom_vec_rheo_thermal.h | 46 +++ src/RHEO/compute_rheo_grad.cpp | 85 ++--- src/RHEO/compute_rheo_grad.h | 8 +- src/RHEO/compute_rheo_interface.cpp | 66 ++-- src/RHEO/compute_rheo_kernel.cpp | 53 +-- src/RHEO/compute_rheo_kernel.h | 2 +- src/RHEO/compute_rheo_property_atom.cpp | 293 +++++++++++++++-- src/RHEO/compute_rheo_property_atom.h | 39 +-- src/RHEO/compute_rheo_surface.h | 4 +- src/RHEO/compute_rheo_vshift.cpp | 69 ++-- src/RHEO/compute_rheo_vshift.h | 5 +- src/RHEO/fix_rheo.cpp | 4 + src/RHEO/fix_rheo_pressure.cpp | 2 +- src/RHEO/fix_rheo_thermal.cpp | 141 +------- src/RHEO/fix_rheo_thermal.h | 11 +- src/RHEO/fix_rheo_viscosity.cpp | 54 +--- src/RHEO/fix_rheo_viscosity.h | 6 +- src/RHEO/pair_rheo.cpp | 19 +- src/atom.cpp | 14 +- src/atom.h | 5 +- src/atom_vec_rheo_thermal.cpp | 200 ++++++++++++ src/atom_vec_rheo_thermal.h | 46 +++ src/compute_rheo_property_atom.cpp | 411 ++++++++++++++++++++++++ src/compute_rheo_property_atom.h | 71 ++++ 27 files changed, 1443 insertions(+), 449 deletions(-) create mode 100644 src/RHEO/atom_vec_rheo_thermal.cpp create mode 100644 src/RHEO/atom_vec_rheo_thermal.h create mode 100644 src/atom_vec_rheo_thermal.cpp create mode 100644 src/atom_vec_rheo_thermal.h create mode 100644 src/compute_rheo_property_atom.cpp create mode 100644 src/compute_rheo_property_atom.h diff --git a/src/RHEO/atom_vec_rheo.cpp b/src/RHEO/atom_vec_rheo.cpp index de2e2f77ad..ea9e2a3c10 100644 --- a/src/RHEO/atom_vec_rheo.cpp +++ b/src/RHEO/atom_vec_rheo.cpp @@ -33,15 +33,17 @@ AtomVecRHEO::AtomVecRHEO(LAMMPS *lmp) : AtomVec(lmp) forceclearflag = 1; atom->status_flag = 1; + atom->pressure_flag = 1; atom->rho_flag = 1; + atom->viscosity_flag = 1; // strings with peratom variables to include in each AtomVec method // strings cannot contain fields in corresponding AtomVec default strings // order of fields in a string does not matter // except: fields_data_atom & fields_data_vel must match data file - fields_grow = {"status", "rho", "drho"}; - fields_copy = {"status", "rho", "drho"}; + fields_grow = {"status", "rho", "drho", "pressure", "viscosity"}; + fields_copy = {"status", "rho", "drho", "pressure", "viscosity"}; fields_comm = {"status", "rho"}; fields_comm_vel = {"status", "rho"}; fields_reverse = {"drho"}; @@ -49,7 +51,7 @@ AtomVecRHEO::AtomVecRHEO(LAMMPS *lmp) : AtomVec(lmp) fields_border_vel = {"status", "rho"}; fields_exchange = {"status", "rho"}; fields_restart = {"status", "rho"}; - fields_create = {"status", "rho", "drho"}; + fields_create = {"status", "rho", "drho", "pressure", "viscosity"}; fields_data_atom = {"id", "type", "status", "rho", "x"}; fields_data_vel = {"id", "v"}; @@ -64,8 +66,10 @@ AtomVecRHEO::AtomVecRHEO(LAMMPS *lmp) : AtomVec(lmp) void AtomVecRHEO::grow_pointers() { status = atom->status; + pressure = atom->pressure; rho = atom->rho; drho = atom->drho; + viscosity = atom->viscosity; } /* ---------------------------------------------------------------------- @@ -86,6 +90,8 @@ void AtomVecRHEO::force_clear(int n, size_t nbytes) void AtomVecRHEO::data_atom_post(int ilocal) { drho[ilocal] = 0.0; + pressure[ilocal] = 0.0; + viscosity[ilocal] = 0.0; } /* ---------------------------------------------------------------------- @@ -96,8 +102,10 @@ void AtomVecRHEO::data_atom_post(int ilocal) int AtomVecRHEO::property_atom(const std::string &name) { if (name == "status") return 0; - if (name == "rho") return 1; - if (name == "drho") return 2; + if (name == "pressure") return 1; + if (name == "rho") return 2; + if (name == "drho") return 3; + if (name == "viscosity") return 4; return -1; } @@ -123,12 +131,20 @@ void AtomVecRHEO::pack_property_atom(int index, double *buf, int nvalues, int gr } else if (index == 1) { for (int i = 0; i < nlocal; i++) { if (mask[i] & groupbit) - buf[n] = rho[i]; + buf[n] = pressure[i]; else buf[n] = 0.0; n += nvalues; } } else if (index == 2) { + for (int i = 0; i < nlocal; i++) { + if (mask[i] & groupbit) + buf[n] = rho[i]; + else + buf[n] = 0.0; + n += nvalues; + } + } else if (index == 3) { for (int i = 0; i < nlocal; i++) { if (mask[i] & groupbit) buf[n] = drho[i]; @@ -136,5 +152,13 @@ void AtomVecRHEO::pack_property_atom(int index, double *buf, int nvalues, int gr buf[n] = 0.0; n += nvalues; } + } else if (index == 4) { + for (int i = 0; i < nlocal; i++) { + if (mask[i] & groupbit) + buf[n] = viscosity[i]; + else + buf[n] = 0.0; + n += nvalues; + } } } diff --git a/src/RHEO/atom_vec_rheo.h b/src/RHEO/atom_vec_rheo.h index bdd617a01d..68cc224ba5 100644 --- a/src/RHEO/atom_vec_rheo.h +++ b/src/RHEO/atom_vec_rheo.h @@ -36,7 +36,7 @@ class AtomVecRHEO : virtual public AtomVec { private: int *status; - double *rho, *drho; + double *pressure, *rho, *drho, *viscosity; }; } // namespace LAMMPS_NS diff --git a/src/RHEO/atom_vec_rheo_thermal.cpp b/src/RHEO/atom_vec_rheo_thermal.cpp new file mode 100644 index 0000000000..de0c7fa5d7 --- /dev/null +++ b/src/RHEO/atom_vec_rheo_thermal.cpp @@ -0,0 +1,200 @@ +/* ---------------------------------------------------------------------- + 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 authors: + Joel Clemmer (SNL), Thomas O'Connor (CMU), Eric Palermo (CMU) +----------------------------------------------------------------------- */ + +#include "atom_vec_rheo_thermal.h" + +#include "atom.h" + +#include + +using namespace LAMMPS_NS; + +/* ---------------------------------------------------------------------- */ + +AtomVecRHEOThermal::AtomVecRHEOThermal(LAMMPS *lmp) : AtomVec(lmp) +{ + molecular = Atom::ATOMIC; + mass_type = PER_TYPE; + forceclearflag = 1; + + atom->status_flag = 1; + atom->conductivity_flag = 1; + atom->temperature_flag = 1; + atom->heatflow_flag = 1; + atom->pressure_flag = 1; + atom->rho_flag = 1; + atom->viscosity_flag = 1; + + // strings with peratom variables to include in each AtomVec method + // strings cannot contain fields in corresponding AtomVec default strings + // order of fields in a string does not matter + // except: fields_data_atom & fields_data_vel must match data file + + fields_grow = {"status", "rho", "drho", "temperature", "heatflow", "conductivity", "pressure", "viscosity"}; + fields_copy = {"status", "rho", "drho", "temperature", "heatflow", "conductivity", "pressure", "viscosity"}; + fields_comm = {"status", "rho", "temperature"}; + fields_comm_vel = {"status", "rho", "temperature"}; + fields_reverse = {"drho", "heatflow"}; + fields_border = {"status", "rho", "temperature"}; + fields_border_vel = {"status", "rho", "temperature"}; + fields_exchange = {"status", "rho", "temperature"}; + fields_restart = {"status", "rho", "temperature"}; + fields_create = {"status", "rho", "drho", "temperature", "heatflow", "conductivity", "pressure", "viscosity"}; + fields_data_atom = {"id", "type", "status", "rho", "temperature", "x"}; + fields_data_vel = {"id", "v"}; + + setup_fields(); +} + +/* ---------------------------------------------------------------------- + set local copies of all grow ptrs used by this class, except defaults + needed in replicate when 2 atom classes exist and it calls pack_restart() +------------------------------------------------------------------------- */ + +void AtomVecRHEOThermal::grow_pointers() +{ + status = atom->status; + conductivity = atom->conductivity; + temperature = atom->temperature; + heatflow = atom->heatflow; + pressure = atom->pressure; + rho = atom->rho; + drho = atom->drho; + viscosity = atom->viscosity; +} + +/* ---------------------------------------------------------------------- + clear extra forces starting at atom N + nbytes = # of bytes to clear for a per-atom vector +------------------------------------------------------------------------- */ + +void AtomVecRHEOThermal::force_clear(int n, size_t nbytes) +{ + memset(&drho[n], 0, nbytes); + memset(&heatflow[n], 0, nbytes); +} + +/* ---------------------------------------------------------------------- + modify what AtomVec::data_atom() just unpacked + or initialize other atom quantities +------------------------------------------------------------------------- */ + +void AtomVecRHEOThermal::data_atom_post(int ilocal) +{ + drho[ilocal] = 0.0; + heatflow[ilocal] = 0.0; + pressure[ilocal] = 0.0; + viscosity[ilocal] = 0.0; + conductivity[ilocal] = 0.0; +} + +/* ---------------------------------------------------------------------- + assign an index to named atom property and return index + return -1 if name is unknown to this atom style +------------------------------------------------------------------------- */ + +int AtomVecRHEOThermal::property_atom(const std::string &name) +{ + if (name == "status") return 0; + if (name == "rho") return 1; + if (name == "drho") return 2; + if (name == "temperature") return 3; + if (name == "heatflow") return 4; + if (name == "conductivity") return 5; + if (name == "pressure") return 6; + if (name == "viscosity") return 7; + return -1; +} + +/* ---------------------------------------------------------------------- + pack per-atom data into buf for ComputePropertyAtom + index maps to data specific to this atom style +------------------------------------------------------------------------- */ + +void AtomVecRHEOThermal::pack_property_atom(int index, double *buf, int nvalues, int groupbit) +{ + int *mask = atom->mask; + int nlocal = atom->nlocal; + int n = 0; + + if (index == 0) { + for (int i = 0; i < nlocal; i++) { + if (mask[i] & groupbit) + buf[n] = status[i]; + else + buf[n] = 0.0; + n += nvalues; + } + } else if (index == 1) { + for (int i = 0; i < nlocal; i++) { + if (mask[i] & groupbit) + buf[n] = rho[i]; + else + buf[n] = 0.0; + n += nvalues; + } + } else if (index == 2) { + for (int i = 0; i < nlocal; i++) { + if (mask[i] & groupbit) + buf[n] = drho[i]; + else + buf[n] = 0.0; + n += nvalues; + } + } else if (index == 3) { + for (int i = 0; i < nlocal; i++) { + if (mask[i] & groupbit) + buf[n] = temperature[i]; + else + buf[n] = 0.0; + n += nvalues; + } + } else if (index == 4) { + for (int i = 0; i < nlocal; i++) { + if (mask[i] & groupbit) + buf[n] = heatflow[i]; + else + buf[n] = 0.0; + n += nvalues; + } + } else if (index == 5) { + for (int i = 0; i < nlocal; i++) { + if (mask[i] & groupbit) + buf[n] = conductivity[i]; + else + buf[n] = 0.0; + n += nvalues; + } + } else if (index == 6) { + for (int i = 0; i < nlocal; i++) { + if (mask[i] & groupbit) + buf[n] = pressure[i]; + else + buf[n] = 0.0; + n += nvalues; + } + } else if (index == 7) { + for (int i = 0; i < nlocal; i++) { + if (mask[i] & groupbit) + buf[n] = viscosity[i]; + else + buf[n] = 0.0; + n += nvalues; + } + } +} diff --git a/src/RHEO/atom_vec_rheo_thermal.h b/src/RHEO/atom_vec_rheo_thermal.h new file mode 100644 index 0000000000..27c6c3c9b5 --- /dev/null +++ b/src/RHEO/atom_vec_rheo_thermal.h @@ -0,0 +1,46 @@ +/* -*- 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 ATOM_CLASS +// clang-format off +AtomStyle(rheo/thermal,AtomVecRHEOThermal); +// clang-format on +#else + +#ifndef LMP_ATOM_VEC_RHEO_THERMAL_H +#define LMP_ATOM_VEC_RHEO_THERMAL_H + +#include "atom_vec.h" + +namespace LAMMPS_NS { + +class AtomVecRHEOThermal : virtual public AtomVec { + public: + AtomVecRHEOThermal(class LAMMPS *); + + void grow_pointers() override; + void force_clear(int, size_t) override; + void data_atom_post(int) override; + int property_atom(const std::string &) override; + void pack_property_atom(int, double *, int, int) override; + + private: + int *status; + double *conductivity, *temperature, *heatflow; + double *pressure, *rho, *drho, *viscosity; +}; + +} // namespace LAMMPS_NS + +#endif +#endif diff --git a/src/RHEO/compute_rheo_grad.cpp b/src/RHEO/compute_rheo_grad.cpp index 606cec7dfc..b71fb08d78 100644 --- a/src/RHEO/compute_rheo_grad.cpp +++ b/src/RHEO/compute_rheo_grad.cpp @@ -84,69 +84,34 @@ ComputeRHEOGrad::ComputeRHEOGrad(LAMMPS *lmp, int narg, char **arg) : } comm_forward = ncomm_grad; + + nmax_store = 0; + grow_arrays(atom->nmax); + } /* ---------------------------------------------------------------------- */ ComputeRHEOGrad::~ComputeRHEOGrad() { - int dim = domain->dimension; - int tmp1, tmp2, index; - - index = atom->find_custom("rheo_grad_v", tmp1, tmp2); - if (index != 1) atom->remove_custom(index, 1, dim * dim); - index = atom->find_custom("rheo_grad_rho", tmp1, tmp2); - if (index != 1) atom->remove_custom(index, 1, dim); - index = atom->find_custom("rheo_grad_t", tmp1, tmp2); - if (index != 1) atom->remove_custom(index, 1, dim); - index = atom->find_custom("rheo_grad_eta", tmp1, tmp2); - if (index != 1) atom->remove_custom(index, 1, dim); + memory->destroy(gradv); + memory->destroy(gradr); + memory->destroy(gradt); + memory->destroy(gradn); } /* ---------------------------------------------------------------------- */ void ComputeRHEOGrad::init() { - neighbor->add_request(this, NeighConst::REQ_DEFAULT); - cut = fix_rheo->cut; cutsq = cut * cut; rho0 = fix_rheo->rho0; + interface_flag = fix_rheo->interface_flag; compute_kernel = fix_rheo->compute_kernel; compute_interface = fix_rheo->compute_interface; - int tmp1, tmp2; - index_visc = atom->find_custom("rheo_viscosity", tmp1, tmp2); - - // Create coordination array if it doesn't already exist - // Create a custom atom property so it works with compute property/atom - // Do not create grow callback as there's no reason to copy/exchange data - // Manually grow if nmax_store exceeded - - int index; - int dim = domain->dimension; - if (velocity_flag) { - index = atom->add_custom("rheo_grad_v", 1, dim * dim); - gradv = atom->darray[index]; - } - - if (rho_flag) { - index = atom->add_custom("rheo_grad_rho", 1, dim); - gradr = atom->darray[index]; - } - - if (temperature_flag) { - index= atom->add_custom("rheo_grad_temp", 1, dim); - gradt = atom->darray[index]; - } - - if (eta_flag) { - index = atom->add_custom("rheo_grad_eta", 1, dim); - gradn = atom->darray[index]; - } - - nmax_store = 0; - grow_arrays(atom->nmax); + neighbor->add_request(this, NeighConst::REQ_DEFAULT); } /* ---------------------------------------------------------------------- */ @@ -175,7 +140,7 @@ void ComputeRHEOGrad::compute_peratom() double **v = atom->v; double *rho = atom->rho; double *temperature = atom->temperature; - double *viscosity = atom->dvector[index_visc]; + double *viscosity = atom->viscosity; int *status = atom->status; int *type = atom->type; double *mass = atom->mass; @@ -240,15 +205,17 @@ void ComputeRHEOGrad::compute_peratom() vj[2] = v[j][2]; // Add corrections for walls - if ((status[i] & STATUS_FLUID) && !(status[j] & STATUS_FLUID)) { - compute_interface->correct_v(vi, vj, i, j); - rhoj = compute_interface->correct_rho(j, i); - } else if (!(status[i] & STATUS_FLUID) && (status[j] & STATUS_FLUID)) { - compute_interface->correct_v(vj, vi, j, i); - rhoi = compute_interface->correct_rho(i, j); - } else if (!(status[i] & STATUS_FLUID) && !(status[j] & STATUS_FLUID)) { - rhoi = rho0; - rhoj = rho0; + if (interface_flag) { + if ((status[i] & STATUS_FLUID) && !(status[j] & STATUS_FLUID)) { + compute_interface->correct_v(vi, vj, i, j); + rhoj = compute_interface->correct_rho(j, i); + } else if (!(status[i] & STATUS_FLUID) && (status[j] & STATUS_FLUID)) { + compute_interface->correct_v(vj, vi, j, i); + rhoi = compute_interface->correct_rho(i, j); + } else if (!(status[i] & STATUS_FLUID) && !(status[j] & STATUS_FLUID)) { + rhoi = rho0; + rhoj = rho0; + } } Voli = mass[itype] / rhoi; @@ -481,16 +448,16 @@ void ComputeRHEOGrad::grow_arrays(int nmax) { int dim = domain->dimension; if (velocity_flag) - memory->grow(gradv, nmax, dim * dim, "atom:rheo_grad_v"); + memory->grow(gradv, nmax, dim * dim, "rheo:grad_v"); if (rho_flag) - memory->grow(gradr, nmax, dim, "atom:rheo_grad_rho"); + memory->grow(gradr, nmax, dim, "rheo:grad_rho"); if (temperature_flag) - memory->grow(gradt, nmax, dim, "atom:rheo_grad_temp"); + memory->grow(gradt, nmax, dim, "rheo:grad_temp"); if (eta_flag) - memory->grow(gradn, nmax, dim, "atom:rheo_grad_eta"); + memory->grow(gradn, nmax, dim, "rheo:grad_eta"); nmax_store = nmax; } diff --git a/src/RHEO/compute_rheo_grad.h b/src/RHEO/compute_rheo_grad.h index 8c7962a978..af4fecdcfb 100644 --- a/src/RHEO/compute_rheo_grad.h +++ b/src/RHEO/compute_rheo_grad.h @@ -46,14 +46,14 @@ class ComputeRHEOGrad : public Compute { private: int comm_stage, ncomm_grad, ncomm_field, nmax_store; - int index_visc; double cut, cutsq, rho0; - class NeighList *list; + + int velocity_flag, temperature_flag, rho_flag, eta_flag; + int interface_flag; class ComputeRHEOKernel *compute_kernel; class ComputeRHEOInterface *compute_interface; - - int velocity_flag, temperature_flag, rho_flag, eta_flag; + class NeighList *list; void grow_arrays(int); }; diff --git a/src/RHEO/compute_rheo_interface.cpp b/src/RHEO/compute_rheo_interface.cpp index 72dcdc17d7..a3624f9663 100644 --- a/src/RHEO/compute_rheo_interface.cpp +++ b/src/RHEO/compute_rheo_interface.cpp @@ -46,24 +46,35 @@ ComputeRHEOInterface::ComputeRHEOInterface(LAMMPS *lmp, int narg, char **arg) : { if (narg != 3) error->all(FLERR,"Illegal compute rheo/interface command"); - nmax_store = 0; - comm_forward = 3; comm_reverse = 4; + + nmax_store = atom->nmax; + memory->create(chi, nmax_store, "rheo:chi"); + memory->create(norm, nmax_store, "rheo/interface:norm"); + memory->create(normwf, nmax_store, "rheo/interface:normwf"); + + // For fp_store, create an instance of fix property atom + // Need restarts + exchanging with neighbors since it needs to persist + // between timesteps (fix property atom will handle callbacks) + + int tmp1, tmp2; + int index = atom->find_custom("fp_store", tmp1, tmp2); + if (index == -1) { + id_fix_pa = utils::strdup(id + std::string("_fix_property_atom")); + modify->add_fix(fmt::format("{} all property/atom d2_fp_store 3", id_fix_pa)); + index = atom->find_custom("fp_store", tmp1, tmp2); + } + fp_store = atom->darray[index]; } /* ---------------------------------------------------------------------- */ ComputeRHEOInterface::~ComputeRHEOInterface() { - // Remove custom property if it exists - int tmp1, tmp2, index; - index = atom->find_custom("rheo_chi", tmp1, tmp2); - if (index != -1) atom->remove_custom(index, 1, 0); - if (id_fix_pa && modify->nfix) modify->delete_fix(id_fix_pa); delete[] id_fix_pa; - + memory->destroy(chi); memory->destroy(norm); memory->destroy(normwf); } @@ -80,37 +91,6 @@ void ComputeRHEOInterface::init() cutsq = cut * cut; wall_max = sqrt(3.0) / 12.0 * cut; - // Create chi array if it doesn't already exist - // Create a custom atom property so it works with compute property/atom - // Do not create grow callback as there's no reason to copy/exchange data - // Manually grow if nmax_store exceeded - - int tmp1, tmp2; - int nmax = atom->nmax; - int index = atom->find_custom("rheo_chi", tmp1, tmp2); - if (index == -1) { - index = atom->add_custom("rheo_chi", 1, 0); - memory->destroy(norm); - memory->destroy(normwf); - memory->create(norm, nmax, "rheo/interface:norm"); - memory->create(normwf, nmax, "rheo/interface:normwf"); - nmax_store = nmax; - } - chi = atom->dvector[index]; - - // For fp_store, go ahead and create an instance of fix property atom - // Need restarts + exchanging with neighbors since it needs to persist - // between timesteps (fix property atom will handle callbacks) - - index = atom->find_custom("fp_store", tmp1, tmp2); - if (index == -1) { - id_fix_pa = utils::strdup(id + std::string("_fix_property_atom")); - modify->add_fix(fmt::format("{} all property/atom d2_fp_store 3", id_fix_pa)); - index = atom->find_custom("fp_store", tmp1, tmp2); - } - fp_store = atom->darray[index]; - - // need an occasional half neighbor list neighbor->add_request(this, NeighConst::REQ_DEFAULT); } @@ -145,11 +125,9 @@ void ComputeRHEOInterface::compute_peratom() if (atom->nmax > nmax_store) { nmax_store = atom->nmax; - memory->destroy(norm); - memory->destroy(normwf); - memory->create(norm, nmax_store, "rheo/interface:norm"); - memory->create(normwf, nmax_store, "rheo/interface:normwf"); - memory->grow(chi, nmax_store, "rheo/interface:chi"); + memory->grow(norm, nmax_store, "rheo/interface:norm"); + memory->grow(normwf, nmax_store, "rheo/interface:normwf"); + memory->grow(chi, nmax_store, "rheo:chi"); } for (i = 0; i < nall; i++) { diff --git a/src/RHEO/compute_rheo_kernel.cpp b/src/RHEO/compute_rheo_kernel.cpp index b7ad1c9b3f..9cfa86df7e 100644 --- a/src/RHEO/compute_rheo_kernel.cpp +++ b/src/RHEO/compute_rheo_kernel.cpp @@ -68,7 +68,6 @@ ComputeRHEOKernel::ComputeRHEOKernel(LAMMPS *lmp, int narg, char **arg) : correction_order = 2; } - solid_flag = 0; dim = domain->dimension; comm_forward = 1; @@ -93,11 +92,7 @@ ComputeRHEOKernel::ComputeRHEOKernel(LAMMPS *lmp, int narg, char **arg) : ComputeRHEOKernel::~ComputeRHEOKernel() { - // Remove custom property if it exists - int tmp1, tmp2, index; - index = atom->find_custom("rheo_coordination", tmp1, tmp2); - if (index != -1) atom->remove_custom(index, 0, 0); - + memory->destroy(coordination); memory->destroy(C); memory->destroy(C0); } @@ -112,11 +107,8 @@ void ComputeRHEOKernel::init() if (fixes.size() == 0) error->all(FLERR, "Need to define fix rheo to use compute rheo/kernel"); fix_rheo = dynamic_cast(fixes[0]); - int icompute = modify->find_compute("rheo_interface"); - if (icompute != -1) { - compute_interface = ((ComputeRHEOInterface *) modify->compute[icompute]); - solid_flag = 1; - } + interface_flag = fix_rheo->interface_flag; + compute_interface = fix_rheo->compute_interface; zmin = fix_rheo->zmin_kernel; h = fix_rheo->h; @@ -133,22 +125,8 @@ void ComputeRHEOKernel::init() pre_wp = pre_w * 3.0 * hinv; } - // Create coordination array if it doesn't already exist - // Create a custom atom property so it works with compute property/atom - // Do not create grow callback as there's no reason to copy/exchange data - // Manually grow if nmax_store exceeded - - int tmp1, tmp2; - int nmax = atom->nmax; - int index = atom->find_custom("rheo_coordination", tmp1, tmp2); - if (index == -1) { - index = atom->add_custom("rheo_coordination", 0, 0); - nmax_store = nmax; - } - coordination = atom->ivector[index]; - - // Create local arrays for kernel arrays, I can't foresee a reason to print - + nmax_store = atom->nmax; + memory->create(coordination, nmax_store, "rheo:coordination"); if (kernel_style == CRK0) { memory->create(C0, nmax_store, "rheo/kernel:C0"); } else if (kernel_style == CRK1) { @@ -499,7 +477,7 @@ void ComputeRHEOKernel::compute_peratom() if (kernel_style == QUINTIC) return; int i, j, ii, jj, inum, jnum, itype, g, a, b, gsl_error; - double xtmp, ytmp, ztmp, r, rsq, w, vj; + double xtmp, ytmp, ztmp, r, rsq, w, vj, rhoj; double dx[3]; gsl_matrix_view gM; @@ -549,10 +527,12 @@ void ComputeRHEOKernel::compute_peratom() if (rsq < hsq) { r = sqrt(rsq); w = calc_w_quintic(i,j,dx[0],dx[1],dx[2],r); - if (!(status[j] & STATUS_FLUID) && solid_flag) { - vj = mass[type[j]] / compute_interface->correct_rho(j,i); - } else vj = mass[type[j]] / rho[j]; + rhoj = rho[j]; + if (interface_flag) + if (!(status[j] & STATUS_FLUID)) + rhoj = compute_interface->correct_rho(j,i); + vj = mass[type[j]] / rhoj; M += w * vj; } } @@ -596,11 +576,12 @@ void ComputeRHEOKernel::compute_peratom() r = sqrt(rsq); w = calc_w_quintic(i,j,dx[0],dx[1],dx[2],r); - if (solid_flag) + rhoj = rho[j]; + if (interface_flag) if (!(status[j] & STATUS_FLUID)) - vj = mass[type[j]]/compute_interface->correct_rho(j,i); - else - vj = mass[type[j]]/rho[j]; + rhoj = compute_interface->correct_rho(j,i); + + vj = mass[type[j]] / rhoj; //Populate the H-vector of polynomials (2D) if (dim == 2) { @@ -759,7 +740,7 @@ void ComputeRHEOKernel::compute_coordination() void ComputeRHEOKernel::grow_arrays(int nmax) { - memory->grow(coordination, nmax, "atom:rheo_coordination"); + memory->grow(coordination, nmax, "rheo:coordination"); if (kernel_style == CRK0) { memory->grow(C0, nmax, "rheo/kernel:C0"); diff --git a/src/RHEO/compute_rheo_kernel.h b/src/RHEO/compute_rheo_kernel.h index 1842406977..5324199f76 100644 --- a/src/RHEO/compute_rheo_kernel.h +++ b/src/RHEO/compute_rheo_kernel.h @@ -49,7 +49,7 @@ class ComputeRHEOKernel : public Compute { private: int comm_stage, comm_forward_save; - int solid_flag; + int interface_flag; int gsl_error_flag; std::unordered_set gsl_error_tags; diff --git a/src/RHEO/compute_rheo_property_atom.cpp b/src/RHEO/compute_rheo_property_atom.cpp index a23ba5a639..7682552abe 100644 --- a/src/RHEO/compute_rheo_property_atom.cpp +++ b/src/RHEO/compute_rheo_property_atom.cpp @@ -21,20 +21,29 @@ #include "atom.h" #include "atom_vec.h" +#include "compute_rheo_interface.h" +#include "compute_rheo_kernel.h" +#include "compute_rheo_surface.h" +#include "compute_rheo_vshift.h" #include "error.h" +#include "fix_rheo.h" +#include "fix_rheo_thermal.h" #include "memory.h" +#include "modify.h" #include "update.h" #include #include using namespace LAMMPS_NS; +using namespace RHEO_NS; /* ---------------------------------------------------------------------- */ ComputeRHEOPropertyAtom::ComputeRHEOPropertyAtom(LAMMPS *lmp, int narg, char **arg) : - Compute(lmp, narg, arg), - index(nullptr), colindex(nullptr), pack_choice(nullptr) + Compute(lmp, narg, arg), fix_rheo(nullptr), fix_thermal(nullptr), compute_interface(nullptr), + compute_kernel(nullptr), compute_surface(nullptr), compute_vshift(nullptr), + index(nullptr), pack_choice(nullptr) { if (narg < 4) utils::missing_cmd_args(FLERR, "compute property/atom", error); @@ -43,31 +52,66 @@ ComputeRHEOPropertyAtom::ComputeRHEOPropertyAtom(LAMMPS *lmp, int narg, char **a if (nvalues == 1) size_peratom_cols = 0; else size_peratom_cols = nvalues; + thermal_flag, interface_flag, surface_flag, shift_flag = 0; + // parse input values // customize a new keyword by adding to if statement pack_choice = new FnPtrPack[nvalues]; + index = new int[nvalues]; int i; for (int iarg = 3; iarg < narg; iarg++) { i = iarg-3; - if (strcmp(arg[iarg],"id") == 0) { - pack_choice[i] = &ComputeRHEOPropertyAtom::pack_id; - } else if (strcmp(arg[iarg],"mol") == 0) { - if (!atom->molecule_flag) - error->all(FLERR,"Compute property/atom {} is not available", arg[iarg]); - pack_choice[i] = &ComputeRHEOPropertyAtom::pack_molecule; - } else if (strcmp(arg[iarg],"proc") == 0) { - pack_choice[i] = &ComputeRHEOPropertyAtom::pack_proc; - } else if (strcmp(arg[iarg],"type") == 0) { - pack_choice[i] = &ComputeRHEOPropertyAtom::pack_type; - } else if (strcmp(arg[iarg],"mass") == 0) { - pack_choice[i] = &ComputeRHEOPropertyAtom::pack_mass; - - + if (strcmp(arg[iarg],"phase") == 0) { + pack_choice[i] = &ComputeRHEOPropertyAtom::pack_phase; + } else if (strcmp(arg[iarg],"chi") == 0) { + interface_flag = 1; + pack_choice[i] = &ComputeRHEOPropertyAtom::pack_chi; + } else if (strcmp(arg[iarg],"surface") == 0) { + surface_flag = 1; + pack_choice[i] = &ComputeRHEOPropertyAtom::pack_surface; + } else if (strcmp(arg[iarg],"surface/r") == 0) { + surface_flag = 1; + pack_choice[i] = &ComputeRHEOPropertyAtom::pack_surface_r; + } else if (strcmp(arg[iarg],"surface/divr") == 0) { + surface_flag = 1; + pack_choice[i] = &ComputeRHEOPropertyAtom::pack_surface_divr; + } else if (strcmp(arg[iarg],"surface/nx") == 0) { + surface_flag = 1; + pack_choice[i] = &ComputeRHEOPropertyAtom::pack_surface_nx; + } else if (strcmp(arg[iarg],"surface/ny") == 0) { + surface_flag = 1; + pack_choice[i] = &ComputeRHEOPropertyAtom::pack_surface_ny; + } else if (strcmp(arg[iarg],"surface/nz") == 0) { + surface_flag = 1; + pack_choice[i] = &ComputeRHEOPropertyAtom::pack_surface_nz; + } else if (strcmp(arg[iarg],"coordination") == 0) { + pack_choice[i] = &ComputeRHEOPropertyAtom::pack_coordination; + } else if (strcmp(arg[iarg],"cv") == 0) { + thermal_flag = 1; + pack_choice[i] = &ComputeRHEOPropertyAtom::pack_cv; + } else if (strcmp(arg[iarg],"shift/vx") == 0) { + shift_flag = 1; + pack_choice[i] = &ComputeRHEOPropertyAtom::pack_shift_vx; + } else if (strcmp(arg[iarg],"shift/vy") == 0) { + shift_flag = 1; + pack_choice[i] = &ComputeRHEOPropertyAtom::pack_shift_vy; + } else if (strcmp(arg[iarg],"shift/vz") == 0) { + shift_flag = 1; + pack_choice[i] = &ComputeRHEOPropertyAtom::pack_shift_vz; } else { - error->all(FLERR,"Invalid keyword {} for compute rheo/property/atom command ", arg[iarg]); + index[i] = atom->avec->property_atom(arg[iarg]); + if (index[i] < 0) + error->all(FLERR, + "Invalid keyword {} for atom style {} in compute rheo/property/atom command ", + atom->get_style(), arg[iarg]); + pack_choice[i] = &ComputeRHEOPropertyAtom::pack_atom_style; + + if (strcmp(arg[iarg],"temperature") == 0) thermal_flag = 1; + if (strcmp(arg[iarg],"heatflow") == 0) thermal_flag = 1; + if (strcmp(arg[iarg],"conductivity") == 0) thermal_flag = 1; } } @@ -79,12 +123,41 @@ ComputeRHEOPropertyAtom::ComputeRHEOPropertyAtom(LAMMPS *lmp, int narg, char **a ComputeRHEOPropertyAtom::~ComputeRHEOPropertyAtom() { delete[] pack_choice; + delete[] index; memory->destroy(vector_atom); memory->destroy(array_atom); } /* ---------------------------------------------------------------------- */ +void ComputeRHEOPropertyAtom::init() +{ + auto fixes = modify->get_fix_by_style("rheo"); + if (fixes.size() == 0) error->all(FLERR, "Need to define fix rheo to use fix rheo/viscosity"); + fix_rheo = dynamic_cast(fixes[0]); + + if (interface_flag && !(fix_rheo->interface_flag)) + error->all(FLERR, "Cannot request interfacial property without corresponding option in fix rheo"); + if (surface_flag && !(fix_rheo->surface_flag)) + error->all(FLERR, "Cannot request surface property without corresponding option in fix rheo"); + if (shift_flag && !(fix_rheo->shift_flag)) + error->all(FLERR, "Cannot request velocity shifting property without corresponding option in fix rheo"); + if (thermal_flag && !(fix_rheo->thermal_flag)) + error->all(FLERR, "Cannot request thermal property without fix rheo/thermal"); + + compute_interface = fix_rheo->compute_interface; + compute_kernel = fix_rheo->compute_kernel; + compute_surface = fix_rheo->compute_surface; + compute_vshift = fix_rheo->compute_vshift; + + if (thermal_flag) { + fixes = modify->get_fix_by_style("rheo/thermal"); + fix_thermal = dynamic_cast(fixes[0]); + } +} + +/* ---------------------------------------------------------------------- */ + void ComputeRHEOPropertyAtom::compute_peratom() { invoked_peratom = update->ntimestep; @@ -133,14 +206,16 @@ double ComputeRHEOPropertyAtom::memory_usage() /* ---------------------------------------------------------------------- */ -void ComputeRHEOPropertyAtom::pack_rho(int n) +void ComputeRHEOPropertyAtom::pack_phase(int n) { - double *rho = atom->rho; + int *status = atom->status; int *mask = atom->mask; int nlocal = atom->nlocal; + int inverse_mask = ~PHASEMASK; + for (int i = 0; i < nlocal; i++) { - if (mask[i] & groupbit) buf[n] = rho[i]; + if (mask[i] & groupbit) buf[n] = (status[i] & inverse_mask); else buf[n] = 0.0; n += nvalues; } @@ -148,15 +223,189 @@ void ComputeRHEOPropertyAtom::pack_rho(int n) /* ---------------------------------------------------------------------- */ -void ComputeRHEOPropertyAtom::pack_status(int n) +void ComputeRHEOPropertyAtom::pack_chi(int n) +{ + double *chi = compute_interface->chi; + int *mask = atom->mask; + int nlocal = atom->nlocal; + + for (int i = 0; i < nlocal; i++) { + if (mask[i] & groupbit) buf[n] = chi[i]; + else buf[n] = 0.0; + n += nvalues; + } +} + +/* ---------------------------------------------------------------------- */ + +void ComputeRHEOPropertyAtom::pack_surface(int n) { int *status = atom->status; int *mask = atom->mask; int nlocal = atom->nlocal; + int inverse_mask = ~SURFACEMASK; + for (int i = 0; i < nlocal; i++) { - if (mask[i] & groupbit) buf[n] = status[i]; + if (mask[i] & groupbit) buf[n] = (status[i] & inverse_mask); else buf[n] = 0.0; n += nvalues; } } + +/* ---------------------------------------------------------------------- */ + +void ComputeRHEOPropertyAtom::pack_surface_r(int n) +{ + double *rsurface = compute_surface->rsurface; + int *mask = atom->mask; + int nlocal = atom->nlocal; + + for (int i = 0; i < nlocal; i++) { + if (mask[i] & groupbit) buf[n] = rsurface[i]; + else buf[n] = 0.0; + n += nvalues; + } +} + +/* ---------------------------------------------------------------------- */ + +void ComputeRHEOPropertyAtom::pack_surface_divr(int n) +{ + double *divr = compute_surface->divr; + int *mask = atom->mask; + int nlocal = atom->nlocal; + + for (int i = 0; i < nlocal; i++) { + if (mask[i] & groupbit) buf[n] = divr[i]; + else buf[n] = 0.0; + n += nvalues; + } +} + +/* ---------------------------------------------------------------------- */ + +void ComputeRHEOPropertyAtom::pack_surface_nx(int n) +{ + double **nsurface = compute_surface->nsurface; + int *mask = atom->mask; + int nlocal = atom->nlocal; + + for (int i = 0; i < nlocal; i++) { + if (mask[i] & groupbit) buf[n] = nsurface[i][0]; + else buf[n] = 0.0; + n += nvalues; + } +} + +/* ---------------------------------------------------------------------- */ + +void ComputeRHEOPropertyAtom::pack_surface_ny(int n) +{ + double **nsurface = compute_surface->nsurface; + int *mask = atom->mask; + int nlocal = atom->nlocal; + + for (int i = 0; i < nlocal; i++) { + if (mask[i] & groupbit) buf[n] = nsurface[i][1]; + else buf[n] = 0.0; + n += nvalues; + } +} + + +/* ---------------------------------------------------------------------- */ + +void ComputeRHEOPropertyAtom::pack_surface_nz(int n) +{ + double **nsurface = compute_surface->nsurface; + int *mask = atom->mask; + int nlocal = atom->nlocal; + + for (int i = 0; i < nlocal; i++) { + if (mask[i] & groupbit) buf[n] = nsurface[i][2]; + else buf[n] = 0.0; + n += nvalues; + } +} + +/* ---------------------------------------------------------------------- */ + +void ComputeRHEOPropertyAtom::pack_coordination(int n) +{ + int *coordination = compute_kernel->coordination; + int *mask = atom->mask; + int nlocal = atom->nlocal; + + for (int i = 0; i < nlocal; i++) { + if (mask[i] & groupbit) buf[n] = coordination[i]; + else buf[n] = 0.0; + n += nvalues; + } +} + +/* ---------------------------------------------------------------------- */ + +void ComputeRHEOPropertyAtom::pack_cv(int n) +{ + int *mask = atom->mask; + int nlocal = atom->nlocal; + + for (int i = 0; i < nlocal; i++) { + if (mask[i] & groupbit) buf[n] = fix_thermal->calc_cv(i); + else buf[n] = 0.0; + n += nvalues; + } +} + +/* ---------------------------------------------------------------------- */ + +void ComputeRHEOPropertyAtom::pack_shift_vx(int n) +{ + double **vshift = compute_vshift->vshift; + int *mask = atom->mask; + int nlocal = atom->nlocal; + + for (int i = 0; i < nlocal; i++) { + if (mask[i] & groupbit) buf[n] = vshift[i][0]; + else buf[n] = 0.0; + n += nvalues; + } +} + +/* ---------------------------------------------------------------------- */ + +void ComputeRHEOPropertyAtom::pack_shift_vy(int n) +{ + double **vshift = compute_vshift->vshift; + int *mask = atom->mask; + int nlocal = atom->nlocal; + + for (int i = 0; i < nlocal; i++) { + if (mask[i] & groupbit) buf[n] = vshift[i][1]; + else buf[n] = 0.0; + n += nvalues; + } +} + +/* ---------------------------------------------------------------------- */ + +void ComputeRHEOPropertyAtom::pack_shift_vz(int n) +{ + double **vshift = compute_vshift->vshift; + int *mask = atom->mask; + int nlocal = atom->nlocal; + + for (int i = 0; i < nlocal; i++) { + if (mask[i] & groupbit) buf[n] = vshift[i][2]; + else buf[n] = 0.0; + n += nvalues; + } +} + +/* ---------------------------------------------------------------------- */ + +void ComputeRHEOPropertyAtom::pack_atom_style(int n) +{ + atom->avec->pack_property_atom(index[n],&buf[n],nvalues,groupbit); +} diff --git a/src/RHEO/compute_rheo_property_atom.h b/src/RHEO/compute_rheo_property_atom.h index 26ca004da0..accb7e9156 100644 --- a/src/RHEO/compute_rheo_property_atom.h +++ b/src/RHEO/compute_rheo_property_atom.h @@ -28,37 +28,40 @@ class ComputeRHEOPropertyAtom : public Compute { public: ComputeRHEOPropertyAtom(class LAMMPS *, int, char **); ~ComputeRHEOPropertyAtom() override; + void init() override; void compute_peratom() override; double memory_usage() override; private: - int nvalues; - int nmax; + int nvalues, nmax; + int thermal_flag, interface_flag, surface_flag, shift_flag; + int *index; double *buf; typedef void (ComputeRHEOPropertyAtom::*FnPtrPack)(int); FnPtrPack *pack_choice; // ptrs to pack functions - void pack_rho(int); - void pack_drho(int); - void pack_temperature(int); - void pack_heatflow(int); - void pack_status(int); void pack_phase(int); + void pack_chi(int); void pack_surface(int); - void pack_r_surface(int); - void pack_divr_surface(int); - void pack_nx_surface(int); - void pack_ny_surface(int); - void pack_nz_surface(int); + void pack_surface_r(int); + void pack_surface_divr(int); + void pack_surface_nx(int); + void pack_surface_ny(int); + void pack_surface_nz(int); void pack_coordination(int); - void pack_viscosity(int); - void pack_pressure(int); - void pack_conductivity(int); void pack_cv(int); - void pack_vx_shift(int); - void pack_vy_shift(int); - void pack_vz_shift(int); + void pack_shift_vx(int); + void pack_shift_vy(int); + void pack_shift_vz(int); + void pack_atom_style(int); + + class FixRHEO *fix_rheo; + class FixRHEOThermal *fix_thermal; + class ComputeRHEOInterface *compute_interface; + class ComputeRHEOKernel *compute_kernel; + class ComputeRHEOSurface *compute_surface; + class ComputeRHEOVShift *compute_vshift; }; diff --git a/src/RHEO/compute_rheo_surface.h b/src/RHEO/compute_rheo_surface.h index 58a3e3b9c4..220f8beb6d 100644 --- a/src/RHEO/compute_rheo_surface.h +++ b/src/RHEO/compute_rheo_surface.h @@ -36,13 +36,13 @@ class ComputeRHEOSurface : public Compute { int pack_forward_comm(int, int *, double *, int, int *) override; void unpack_forward_comm(int, int, double *) override; - double **nsurface, *rsurface; + double **nsurface, *rsurface, *divr; class FixRHEO *fix_rheo; private: double cut, cutsq, rho0, threshold_divr; int surface_style, nmax_store, threshold_z; - double **B, **gradC, *divr; + double **B, **gradC; int threshold_style, comm_stage; class NeighList *list; diff --git a/src/RHEO/compute_rheo_vshift.cpp b/src/RHEO/compute_rheo_vshift.cpp index 440bfc7fc7..3d3914436e 100644 --- a/src/RHEO/compute_rheo_vshift.cpp +++ b/src/RHEO/compute_rheo_vshift.cpp @@ -22,6 +22,7 @@ #include "comm.h" #include "compute_rheo_interface.h" #include "compute_rheo_kernel.h" +#include "compute_rheo_surface.h" #include "domain.h" #include "error.h" #include "fix_rheo.h" @@ -38,36 +39,22 @@ using namespace RHEO_NS; ComputeRHEOVShift::ComputeRHEOVShift(LAMMPS *lmp, int narg, char **arg) : Compute(lmp, narg, arg), list(nullptr), vshift(nullptr), fix_rheo(nullptr), - compute_kernel(nullptr), compute_interface(nullptr) + compute_kernel(nullptr), compute_interface(nullptr), compute_surface(nullptr) { if (narg != 3) error->all(FLERR,"Illegal compute RHEO/VShift command"); comm_reverse = 3; surface_flag = 0; - // Create vshift array if it doesn't already exist - // Create a custom atom property so it works with compute property/atom - // Do not create grow callback as there's no reason to copy/exchange data - // Manually grow if nmax_store exceeded - - int tmp1, tmp2; - int index = atom->find_custom("rheo_vshift", tmp1, tmp2); - if (index == -1) { - index = atom->add_custom("rheo_vshift", 1, 3); - nmax_store = atom->nmax; - } - vshift = atom->darray[index]; + nmax_store = atom->nmax; + memory->create(vshift, nmax_store, 3, "rheo:vshift"); } /* ---------------------------------------------------------------------- */ ComputeRHEOVShift::~ComputeRHEOVShift() { - // Remove custom property if it exists - int tmp1, tmp2, index; - index = atom->find_custom("rheo_vshift", tmp1, tmp2); - if (index != -1) atom->remove_custom(index, 1, 3); - + memory->destroy(vshift); } /* ---------------------------------------------------------------------- */ @@ -76,12 +63,12 @@ void ComputeRHEOVShift::init() { neighbor->add_request(this, NeighConst::REQ_DEFAULT); - surface_flag = 0; - if (fix_rheo->surface_flag) - surface_flag = 1; + surface_flag = fix_rheo->surface_flag; + interface_flag = fix_rheo->interface_flag; compute_kernel = fix_rheo->compute_kernel; compute_interface = fix_rheo->compute_interface; + compute_surface = fix_rheo->compute_surface; cut = fix_rheo->cut; cutsq = cut * cut; @@ -128,7 +115,7 @@ void ComputeRHEOVShift::compute_peratom() firstneigh = list->firstneigh; if (nmax_store < atom->nmax) { - memory->grow(vshift, atom->nmax, 3, "atom:rheo_vshift"); + memory->grow(vshift, atom->nmax, 3, "rheo:vshift"); nmax_store = atom->nmax; } @@ -176,15 +163,17 @@ void ComputeRHEOVShift::compute_peratom() rhoj = rho[j]; // Add corrections for walls - if (fluidi && (!fluidj)) { - compute_interface->correct_v(vi, vj, i, j); - rhoj = compute_interface->correct_rho(j,i); - } else if ((!fluidi) && fluidj) { - compute_interface->correct_v(vj, vi, j, i); - rhoi = compute_interface->correct_rho(i,j); - } else if ((!fluidi) && (!fluidj)) { - rhoi = 1.0; - rhoj = 1.0; + if (interface_flag) { + if (fluidi && (!fluidj)) { + compute_interface->correct_v(vi, vj, i, j); + rhoj = compute_interface->correct_rho(j,i); + } else if ((!fluidi) && fluidj) { + compute_interface->correct_v(vj, vi, j, i); + rhoi = compute_interface->correct_rho(i,j); + } else if ((!fluidi) && (!fluidj)) { + rhoi = 1.0; + rhoj = 1.0; + } } voli = imass / rhoi; @@ -227,30 +216,28 @@ void ComputeRHEOVShift::correct_surfaces() { if (!surface_flag) return; + int i, a, b; + int *status = atom->status; int *mask = atom->mask; - int nlocal = atom->nlocal; - int i, a, b; - int dim = domain->dimension; + double **nsurface = compute_surface->nsurface; - int tmp1, tmp2; - int index_nsurf = atom->find_custom("rheo_nsurf", tmp1, tmp2); - if (index_nsurf == -1) error->all(FLERR, "Cannot find rheo nsurf"); - double **nsurf = atom->darray[index_nsurf]; + int nlocal = atom->nlocal; + int dim = domain->dimension; double nx,ny,nz,vx,vy,vz; for (i = 0; i < nlocal; i++) { if (mask[i] & groupbit) { if ((status[i] & STATUS_SURFACE) || (status[i] & STATUS_LAYER)) { - nx = nsurf[i][0]; - ny = nsurf[i][1]; + nx = nsurface[i][0]; + ny = nsurface[i][1]; vx = vshift[i][0]; vy = vshift[i][1]; vz = vshift[i][2]; vshift[i][0] = (1 - nx * nx) * vx - nx * ny * vy; vshift[i][1] = (1 - ny * ny) * vy - nx * ny * vx; if (dim > 2) { - nz = nsurf[i][2]; + nz = nsurface[i][2]; vshift[i][0] -= nx * nz * vz; vshift[i][1] -= ny * nz * vz; vshift[i][2] = (1 - nz * nz) * vz - nz * ny * vy - nx * nz * vx; diff --git a/src/RHEO/compute_rheo_vshift.h b/src/RHEO/compute_rheo_vshift.h index 8611e177d1..9d3a0166d6 100644 --- a/src/RHEO/compute_rheo_vshift.h +++ b/src/RHEO/compute_rheo_vshift.h @@ -42,11 +42,12 @@ class ComputeRHEOVShift : public Compute { private: int nmax_store; double dtv, cut, cutsq, cutthird; - int surface_flag; + int surface_flag, interface_flag; class NeighList *list; - class ComputeRHEOInterface *compute_interface ; + class ComputeRHEOInterface *compute_interface; class ComputeRHEOKernel *compute_kernel; + class ComputeRHEOSurface *compute_surface; }; } // namespace LAMMPS_NS diff --git a/src/RHEO/fix_rheo.cpp b/src/RHEO/fix_rheo.cpp index ff804fe007..ac870affd5 100644 --- a/src/RHEO/fix_rheo.cpp +++ b/src/RHEO/fix_rheo.cpp @@ -60,8 +60,12 @@ FixRHEO::FixRHEO(LAMMPS *lmp, int narg, char **arg) : if (igroup != 0) error->all(FLERR,"fix rheo command requires group all"); + if (atom->pressure_flag != 1) + error->all(FLERR,"fix rheo command requires atom_style with pressure"); if (atom->rho_flag != 1) error->all(FLERR,"fix rheo command requires atom_style with density"); + if (atom->viscosity_flag != 1) + error->all(FLERR,"fix rheo command requires atom_style with viscosity"); if (atom->status_flag != 1) error->all(FLERR,"fix rheo command requires atom_style with status"); diff --git a/src/RHEO/fix_rheo_pressure.cpp b/src/RHEO/fix_rheo_pressure.cpp index 75edf42572..45557794cd 100644 --- a/src/RHEO/fix_rheo_pressure.cpp +++ b/src/RHEO/fix_rheo_pressure.cpp @@ -38,7 +38,7 @@ static constexpr double SEVENTH = 1.0 / 7.0; /* ---------------------------------------------------------------------- */ FixRHEOPressure::FixRHEOPressure(LAMMPS *lmp, int narg, char **arg) : - Fix(lmp, narg, arg), fix_rheo(nullptr), pressure(nullptr) + Fix(lmp, narg, arg), fix_rheo(nullptr) { if (narg < 4) error->all(FLERR,"Illegal fix command"); diff --git a/src/RHEO/fix_rheo_thermal.cpp b/src/RHEO/fix_rheo_thermal.cpp index 5df8c1c506..0d8909b908 100644 --- a/src/RHEO/fix_rheo_thermal.cpp +++ b/src/RHEO/fix_rheo_thermal.cpp @@ -40,7 +40,7 @@ enum {NONE, CONSTANT, TYPE}; FixRHEOThermal::FixRHEOThermal(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg), fix_rheo(nullptr), compute_grad(nullptr), compute_vshift(nullptr), - Tc_type(nullptr), kappa_type(nullptr), cv_type(nullptr), conductivity(nullptr) + Tc_type(nullptr), kappa_type(nullptr), cv_type(nullptr) { if (narg < 4) error->all(FLERR,"Illegal fix command"); @@ -48,9 +48,6 @@ FixRHEOThermal::FixRHEOThermal(LAMMPS *lmp, int narg, char **arg) : cv_style = NONE; conductivity_style = NONE; - comm_forward = 1; - nmax_store = 0; - int ntypes = atom->ntypes; int iarg = 3; while (iarg < narg) { @@ -170,9 +167,11 @@ void FixRHEOThermal::init() dtf = 0.5 * update->dt * force->ftm2v; if (atom->temperature_flag != 1) - error->all(FLERR,"fix rheo/thermal command requires atoms store temperature property"); + error->all(FLERR,"fix rheo/thermal command requires atom property temperature"); if (atom->heatflow_flag != 1) - error->all(FLERR,"fix rheo/thermal command requires atoms store heatflow property"); + error->all(FLERR,"fix rheo/thermal command requires atom property heatflow"); + if (atom->conductivity_flag != 1) + error->all(FLERR,"fix rheo/thermal command requires atom property conductivity"); } /* ---------------------------------------------------------------------- */ @@ -181,34 +180,6 @@ void FixRHEOThermal::setup_pre_force(int /*vflag*/) { fix_rheo->thermal_fix_defined = 1; - // Identify whether this is the first/last instance of fix thermal - // First will grow arrays, last will communicate - first_flag = 0; - last_flag = 0; - - int i = 0; - auto fixlist = modify->get_fix_by_style("rheo/thermal"); - for (const auto &fix : fixlist) { - if (strcmp(fix->id, id) == 0) break; - i++; - } - - if (i == 0) first_flag = 1; - if ((i + 1) == fixlist.size()) last_flag = 1; - - // Create conductivity array if it doesn't already exist - // Create a custom atom property so it works with compute property/atom - // Do not create grow callback as there's no reason to copy/exchange data - // Manually grow if nmax_store exceeded - - int tmp1, tmp2; - int index = atom->find_custom("rheo_conductivity", tmp1, tmp2); - if (index== -1) { - index = atom->add_custom("rheo_conductivity", 1, 0); - nmax_store = atom->nmax; - } - conductivity = atom->dvector[index]; - post_neighbor(); pre_force(0); } @@ -294,14 +265,10 @@ void FixRHEOThermal::post_neighbor() int i; int *type = atom->type; int *mask = atom->mask; + double *conductivity = atom->conductivity; int nlocal = atom->nlocal; int nall = nlocal + atom->nghost; - if (first_flag && (nmax_store < atom->nmax)) { - memory->grow(conductivity, atom->nmax, "atom:rheo_conductivity"); - nmax_store = atom->nmax; - } - if (conductivity_style == CONSTANT) { for (i = 0; i < nall; i++) if (mask[i] & groupbit) conductivity[i] = kappa; @@ -312,39 +279,11 @@ void FixRHEOThermal::post_neighbor() } /* ---------------------------------------------------------------------- - Update (and forward) evolving conductivity styles every timestep - Zero heat flow + In the future, update & forward evolving conductivity styles every timestep ------------------------------------------------------------------------- */ void FixRHEOThermal::pre_force(int /*vflag*/) { - // send updated temperatures to ghosts if first instance of fix - // then clear heatflow for next force calculation - double *heatflow = atom->heatflow; - if (first_flag) { - comm->forward_comm(this); - for (int i = 0; i < atom->nmax; i++) heatflow[i] = 0.0; - } - - // Not needed yet, when needed add stage check for (un)pack_forward_comm() methods - //int i; - //double *conductivity = atom->dvector[index_cond]; - //int *mask = atom->mask; - //int nlocal = atom->nlocal; - - //if (first_flag && (nmax_store < atom->nmax)) { - // memory->grow(conductivity, atom->nmax, "atom:rheo_conductivity"); - // nmax_store = atom->nmax; - //} - - //if (conductivity_style == TBD) { - // for (i = 0; i < nlocal; i++) { - // if (mask[i] & groupbit) { - // } - // } - //} - - //if (last_flag && comm_forward) comm->forward_comm(this); } /* ---------------------------------------------------------------------- */ @@ -387,69 +326,3 @@ double FixRHEOThermal::calc_cv(int i) return(cv_type[atom->type[i]]); } } - -/* ---------------------------------------------------------------------- */ - -int FixRHEOThermal::pack_forward_comm(int n, int *list, double *buf, int /*pbc_flag*/, int * /*pbc*/) -{ - int i, j, m; - - double *temperature = atom->temperature; - - m = 0; - for (i = 0; i < n; i++) { - j = list[i]; - buf[m++] = temperature[j]; - } - - return m; -} - -/* ---------------------------------------------------------------------- */ - -void FixRHEOThermal::unpack_forward_comm(int n, int first, double *buf) -{ - int i, m, last; - - m = 0; - last = first + n; - - double *temperature = atom->temperature; - - for (i = first; i < last; i++) temperature[i] = buf[m++]; -} - -/* ---------------------------------------------------------------------- */ - -int FixRHEOThermal::pack_reverse_comm(int n, int first, double *buf) -{ - int m = 0; - int last = first + n; - double *heatflow = atom->heatflow; - - for (int i = first; i < last; i++) { - buf[m++] = heatflow[i]; - } - - return m; -} - -/* ---------------------------------------------------------------------- */ - -void FixRHEOThermal::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++]; -} - -/* ---------------------------------------------------------------------- */ - -double FixRHEOThermal::memory_usage() -{ - double bytes = 0.0; - bytes += (size_t) nmax_store * sizeof(double); - return bytes; -} diff --git a/src/RHEO/fix_rheo_thermal.h b/src/RHEO/fix_rheo_thermal.h index cf64c0b8d1..a27ad98a8c 100644 --- a/src/RHEO/fix_rheo_thermal.h +++ b/src/RHEO/fix_rheo_thermal.h @@ -37,29 +37,22 @@ class FixRHEOThermal : public Fix { void pre_force(int) override; void final_integrate() override; void reset_dt() override; - int pack_forward_comm(int, int *, double *, int, int *) override; - void unpack_forward_comm(int, int, double *) override; - int pack_reverse_comm(int, int, double *) override; - void unpack_reverse_comm(int, int *, double *) override; - double memory_usage() override; + double calc_cv(int); private: double *cv_type, cv; double *Tc_type, Tc; double *kappa_type, kappa; double dtf, dtv; - double *conductivity; int Tc_style; int cv_style; int conductivity_style; - int first_flag, last_flag; - int nmax_store; class FixRHEO *fix_rheo; class ComputeRHEOGrad *compute_grad; class ComputeRHEOVShift *compute_vshift; - double calc_cv(int); + void grow_array(int); }; } // namespace LAMMPS_NS diff --git a/src/RHEO/fix_rheo_viscosity.cpp b/src/RHEO/fix_rheo_viscosity.cpp index b15f488370..4d70ffaca3 100644 --- a/src/RHEO/fix_rheo_viscosity.cpp +++ b/src/RHEO/fix_rheo_viscosity.cpp @@ -37,14 +37,13 @@ enum {NONE, CONSTANT, TYPE, POWER}; /* ---------------------------------------------------------------------- */ FixRHEOViscosity::FixRHEOViscosity(LAMMPS *lmp, int narg, char **arg) : - Fix(lmp, narg, arg), fix_rheo(nullptr), eta_type(nullptr), viscosity(nullptr), compute_grad(nullptr) + Fix(lmp, narg, arg), fix_rheo(nullptr), compute_grad(nullptr), eta_type(nullptr) { if (narg < 4) error->all(FLERR,"Illegal fix command"); viscosity_style = NONE; comm_forward = 0; - nmax_store = 0; int ntypes = atom->ntypes; int iarg = 3; @@ -86,11 +85,6 @@ FixRHEOViscosity::FixRHEOViscosity(LAMMPS *lmp, int narg, char **arg) : FixRHEOViscosity::~FixRHEOViscosity() { - // Remove custom property if it exists - int tmp1, tmp2, index; - index = atom->find_custom("rheo_viscosity", tmp1, tmp2); - if (index != -1) atom->remove_custom(index, 1, 0); - memory->destroy(eta_type); } @@ -121,9 +115,7 @@ void FixRHEOViscosity::setup_pre_force(int /*vflag*/) { fix_rheo->viscosity_fix_defined = 1; - // Identify whether this is the first/last instance of fix viscosity - // First will grow arrays, last will communicate - first_flag = 0; + // Identify whether this is the last instance of fix viscosity last_flag = 0; int i = 0; @@ -133,22 +125,8 @@ void FixRHEOViscosity::setup_pre_force(int /*vflag*/) i++; } - if (i == 0) first_flag = 1; if ((i + 1) == fixlist.size()) last_flag = 1; - // Create viscosity array if it doesn't already exist - // Create a custom atom property so it works with compute property/atom - // Do not create grow callback as there's no reason to copy/exchange data - // Manually grow if nmax_store exceeded - - int tmp1, tmp2; - int index = atom->find_custom("rheo_viscosity", tmp1, tmp2); - if (index == -1) { - index = atom->add_custom("rheo_viscosity", 1, 0); - nmax_store = atom->nmax; - } - viscosity = atom->dvector[index]; - post_neighbor(); pre_force(0); } @@ -163,14 +141,9 @@ void FixRHEOViscosity::post_neighbor() int *type = atom->type; int *mask = atom->mask; + double *viscosity = atom->viscosity; - int nlocal = atom->nlocal; - int nall = nlocal + atom->nghost; - - if (first_flag && (nmax_store < atom->nmax)) { - memory->grow(viscosity, atom->nmax, "atom:rheo_viscosity"); - nmax_store = atom->nmax; - } + int nall = atom->nlocal + atom->nghost; if (viscosity_style == CONSTANT) { for (i = 0; i < nall; i++) @@ -191,16 +164,12 @@ void FixRHEOViscosity::pre_force(int /*vflag*/) double tmp, gdot; int *mask = atom->mask; + double *viscosity = atom->viscosity; double **gradv = compute_grad->gradv; int nlocal = atom->nlocal; int dim = domain->dimension; - if (first_flag && (nmax_store < atom->nmax)) { - memory->grow(viscosity, atom->nmax, "atom:rheo_viscosity"); - nmax_store = atom->nmax; - } - if (viscosity_style == POWER) { for (i = 0; i < nlocal; i++) { if (mask[i] & groupbit) { @@ -231,7 +200,8 @@ void FixRHEOViscosity::pre_force(int /*vflag*/) int FixRHEOViscosity::pack_forward_comm(int n, int *list, double *buf, int /*pbc_flag*/, int * /*pbc*/) { - int i,j,k,m; + int i, j, k, m; + double *viscosity = atom->viscosity; m = 0; for (i = 0; i < n; i++) { @@ -246,6 +216,7 @@ int FixRHEOViscosity::pack_forward_comm(int n, int *list, double *buf, void FixRHEOViscosity::unpack_forward_comm(int n, int first, double *buf) { int i, k, m, last; + double *viscosity = atom->viscosity; m = 0; last = first + n; @@ -253,12 +224,3 @@ void FixRHEOViscosity::unpack_forward_comm(int n, int first, double *buf) viscosity[i] = buf[m++]; } } - -/* ---------------------------------------------------------------------- */ - -double FixRHEOViscosity::memory_usage() -{ - double bytes = 0.0; - bytes += (size_t) nmax_store * sizeof(double); - return bytes; -} diff --git a/src/RHEO/fix_rheo_viscosity.h b/src/RHEO/fix_rheo_viscosity.h index 66df51601e..c681d18c00 100644 --- a/src/RHEO/fix_rheo_viscosity.h +++ b/src/RHEO/fix_rheo_viscosity.h @@ -35,15 +35,11 @@ class FixRHEOViscosity : public Fix { void pre_force(int) override; int pack_forward_comm(int, int *, double *, int, int *) override; void unpack_forward_comm(int, int, double *) override; - double memory_usage() override; private: double *eta_type, eta; double npow, K, gd0, tau0; - double *viscosity; - int viscosity_style; - int first_flag, last_flag; - int nmax_store; + int viscosity_style, last_flag; class FixRHEO *fix_rheo; class ComputeRHEOGrad *compute_grad; diff --git a/src/RHEO/pair_rheo.cpp b/src/RHEO/pair_rheo.cpp index c61d613d82..03e859316f 100644 --- a/src/RHEO/pair_rheo.cpp +++ b/src/RHEO/pair_rheo.cpp @@ -99,6 +99,9 @@ void PairRHEO::compute(int eflag, int vflag) double *rho = atom->rho; double *mass = atom->mass; double *drho = atom->drho; + double *pressure = atom->pressure; + double *viscosity = atom->viscosity; + double *conductivity = atom->conductivity; double *temperature = atom->temperature; double *heatflow = atom->heatflow; double *special_lj = force->special_lj; @@ -112,22 +115,6 @@ void PairRHEO::compute(int eflag, int vflag) chi = compute_interface->chi; } - int tmp1, tmp2; - int index = atom->find_custom("rheo_viscosity", tmp1, tmp2); - if (index == -1) error->all(FLERR, "Cannot find rheo viscosity"); - double *viscosity = atom->dvector[index]; - - index = atom->find_custom("rheo_pressure", tmp1, tmp2); - if (index == -1) error->all(FLERR, "Cannot find rheo pressure"); - double *pressure = atom->dvector[index]; - - double *conductivity; - if (thermal_flag) { - index = atom->find_custom("rheo_conductivity", tmp1, tmp2); - if (index == -1) error->all(FLERR, "Cannot find rheo conductivity"); - conductivity = atom->dvector[index]; - } - inum = list->inum; ilist = list->ilist; numneigh = list->numneigh; diff --git a/src/atom.cpp b/src/atom.cpp index 25023e0d49..cf8cb7468a 100644 --- a/src/atom.cpp +++ b/src/atom.cpp @@ -200,6 +200,9 @@ Atom::Atom(LAMMPS *_lmp) : Pointers(_lmp) // RHEO package status = nullptr; + conductivity = nullptr; + pressure = nullptr; + viscosity = nullptr; // SPH package @@ -533,6 +536,9 @@ void Atom::peratom_create() // RHEO package add_peratom("status",&status,INT,0); + add_peratom("conductivity",&conductivity,DOUBLE,0); + add_peratom("pressure",&pressure,DOUBLE,0); + add_peratom("viscosity",&viscosity,DOUBLE,0); // SPH package @@ -639,7 +645,7 @@ void Atom::set_atomflag_defaults() temperature_flag = heatflow_flag = 0; vfrac_flag = spin_flag = eradius_flag = ervel_flag = erforce_flag = 0; cs_flag = csforce_flag = vforce_flag = ervelforce_flag = etag_flag = 0; - status_flag = 0; + status_flag = conductivity_flag = pressure_flag = viscosity_flag = 0; rho_flag = esph_flag = cv_flag = vest_flag = 0; dpd_flag = edpd_flag = tdpd_flag = 0; sp_flag = 0; @@ -2943,6 +2949,9 @@ void *Atom::extract(const char *name) // RHEO package if (strcmp(name,"status") == 0) return (void *) status; + if (strcmp(name,"conductivity") == 0) return (void *) conductivity; + if (strcmp(name,"pressure") == 0) return (void *) pressure; + if (strcmp(name,"viscosity") == 0) return (void *) viscosity; // SPH package @@ -3069,6 +3078,9 @@ int Atom::extract_datatype(const char *name) // RHEO package if (strcmp(name,"status") == 0) return LAMMPS_INT; + if (strcmp(name,"conductivity") == 0) return LAMMPS_DOUBLE; + if (strcmp(name,"pressure") == 0) return LAMMPS_DOUBLE; + if (strcmp(name,"viscosity") == 0) return LAMMPS_DOUBLE; // SPH package diff --git a/src/atom.h b/src/atom.h index 51665cb0bf..a8ced43b4d 100644 --- a/src/atom.h +++ b/src/atom.h @@ -158,6 +158,9 @@ class Atom : protected Pointers { // RHEO package int *status; + double *conductivity; + double *pressure; + double *viscosity; // SPH package @@ -194,7 +197,7 @@ class Atom : protected Pointers { int temperature_flag, heatflow_flag; int vfrac_flag, spin_flag, eradius_flag, ervel_flag, erforce_flag; int cs_flag, csforce_flag, vforce_flag, ervelforce_flag, etag_flag; - int status_flag; + int status_flag, conductivity_flag, pressure_flag, viscosity_flag; int rho_flag, esph_flag, cv_flag, vest_flag; int dpd_flag, edpd_flag, tdpd_flag; int mesont_flag; diff --git a/src/atom_vec_rheo_thermal.cpp b/src/atom_vec_rheo_thermal.cpp new file mode 100644 index 0000000000..de0c7fa5d7 --- /dev/null +++ b/src/atom_vec_rheo_thermal.cpp @@ -0,0 +1,200 @@ +/* ---------------------------------------------------------------------- + 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 authors: + Joel Clemmer (SNL), Thomas O'Connor (CMU), Eric Palermo (CMU) +----------------------------------------------------------------------- */ + +#include "atom_vec_rheo_thermal.h" + +#include "atom.h" + +#include + +using namespace LAMMPS_NS; + +/* ---------------------------------------------------------------------- */ + +AtomVecRHEOThermal::AtomVecRHEOThermal(LAMMPS *lmp) : AtomVec(lmp) +{ + molecular = Atom::ATOMIC; + mass_type = PER_TYPE; + forceclearflag = 1; + + atom->status_flag = 1; + atom->conductivity_flag = 1; + atom->temperature_flag = 1; + atom->heatflow_flag = 1; + atom->pressure_flag = 1; + atom->rho_flag = 1; + atom->viscosity_flag = 1; + + // strings with peratom variables to include in each AtomVec method + // strings cannot contain fields in corresponding AtomVec default strings + // order of fields in a string does not matter + // except: fields_data_atom & fields_data_vel must match data file + + fields_grow = {"status", "rho", "drho", "temperature", "heatflow", "conductivity", "pressure", "viscosity"}; + fields_copy = {"status", "rho", "drho", "temperature", "heatflow", "conductivity", "pressure", "viscosity"}; + fields_comm = {"status", "rho", "temperature"}; + fields_comm_vel = {"status", "rho", "temperature"}; + fields_reverse = {"drho", "heatflow"}; + fields_border = {"status", "rho", "temperature"}; + fields_border_vel = {"status", "rho", "temperature"}; + fields_exchange = {"status", "rho", "temperature"}; + fields_restart = {"status", "rho", "temperature"}; + fields_create = {"status", "rho", "drho", "temperature", "heatflow", "conductivity", "pressure", "viscosity"}; + fields_data_atom = {"id", "type", "status", "rho", "temperature", "x"}; + fields_data_vel = {"id", "v"}; + + setup_fields(); +} + +/* ---------------------------------------------------------------------- + set local copies of all grow ptrs used by this class, except defaults + needed in replicate when 2 atom classes exist and it calls pack_restart() +------------------------------------------------------------------------- */ + +void AtomVecRHEOThermal::grow_pointers() +{ + status = atom->status; + conductivity = atom->conductivity; + temperature = atom->temperature; + heatflow = atom->heatflow; + pressure = atom->pressure; + rho = atom->rho; + drho = atom->drho; + viscosity = atom->viscosity; +} + +/* ---------------------------------------------------------------------- + clear extra forces starting at atom N + nbytes = # of bytes to clear for a per-atom vector +------------------------------------------------------------------------- */ + +void AtomVecRHEOThermal::force_clear(int n, size_t nbytes) +{ + memset(&drho[n], 0, nbytes); + memset(&heatflow[n], 0, nbytes); +} + +/* ---------------------------------------------------------------------- + modify what AtomVec::data_atom() just unpacked + or initialize other atom quantities +------------------------------------------------------------------------- */ + +void AtomVecRHEOThermal::data_atom_post(int ilocal) +{ + drho[ilocal] = 0.0; + heatflow[ilocal] = 0.0; + pressure[ilocal] = 0.0; + viscosity[ilocal] = 0.0; + conductivity[ilocal] = 0.0; +} + +/* ---------------------------------------------------------------------- + assign an index to named atom property and return index + return -1 if name is unknown to this atom style +------------------------------------------------------------------------- */ + +int AtomVecRHEOThermal::property_atom(const std::string &name) +{ + if (name == "status") return 0; + if (name == "rho") return 1; + if (name == "drho") return 2; + if (name == "temperature") return 3; + if (name == "heatflow") return 4; + if (name == "conductivity") return 5; + if (name == "pressure") return 6; + if (name == "viscosity") return 7; + return -1; +} + +/* ---------------------------------------------------------------------- + pack per-atom data into buf for ComputePropertyAtom + index maps to data specific to this atom style +------------------------------------------------------------------------- */ + +void AtomVecRHEOThermal::pack_property_atom(int index, double *buf, int nvalues, int groupbit) +{ + int *mask = atom->mask; + int nlocal = atom->nlocal; + int n = 0; + + if (index == 0) { + for (int i = 0; i < nlocal; i++) { + if (mask[i] & groupbit) + buf[n] = status[i]; + else + buf[n] = 0.0; + n += nvalues; + } + } else if (index == 1) { + for (int i = 0; i < nlocal; i++) { + if (mask[i] & groupbit) + buf[n] = rho[i]; + else + buf[n] = 0.0; + n += nvalues; + } + } else if (index == 2) { + for (int i = 0; i < nlocal; i++) { + if (mask[i] & groupbit) + buf[n] = drho[i]; + else + buf[n] = 0.0; + n += nvalues; + } + } else if (index == 3) { + for (int i = 0; i < nlocal; i++) { + if (mask[i] & groupbit) + buf[n] = temperature[i]; + else + buf[n] = 0.0; + n += nvalues; + } + } else if (index == 4) { + for (int i = 0; i < nlocal; i++) { + if (mask[i] & groupbit) + buf[n] = heatflow[i]; + else + buf[n] = 0.0; + n += nvalues; + } + } else if (index == 5) { + for (int i = 0; i < nlocal; i++) { + if (mask[i] & groupbit) + buf[n] = conductivity[i]; + else + buf[n] = 0.0; + n += nvalues; + } + } else if (index == 6) { + for (int i = 0; i < nlocal; i++) { + if (mask[i] & groupbit) + buf[n] = pressure[i]; + else + buf[n] = 0.0; + n += nvalues; + } + } else if (index == 7) { + for (int i = 0; i < nlocal; i++) { + if (mask[i] & groupbit) + buf[n] = viscosity[i]; + else + buf[n] = 0.0; + n += nvalues; + } + } +} diff --git a/src/atom_vec_rheo_thermal.h b/src/atom_vec_rheo_thermal.h new file mode 100644 index 0000000000..27c6c3c9b5 --- /dev/null +++ b/src/atom_vec_rheo_thermal.h @@ -0,0 +1,46 @@ +/* -*- 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 ATOM_CLASS +// clang-format off +AtomStyle(rheo/thermal,AtomVecRHEOThermal); +// clang-format on +#else + +#ifndef LMP_ATOM_VEC_RHEO_THERMAL_H +#define LMP_ATOM_VEC_RHEO_THERMAL_H + +#include "atom_vec.h" + +namespace LAMMPS_NS { + +class AtomVecRHEOThermal : virtual public AtomVec { + public: + AtomVecRHEOThermal(class LAMMPS *); + + void grow_pointers() override; + void force_clear(int, size_t) override; + void data_atom_post(int) override; + int property_atom(const std::string &) override; + void pack_property_atom(int, double *, int, int) override; + + private: + int *status; + double *conductivity, *temperature, *heatflow; + double *pressure, *rho, *drho, *viscosity; +}; + +} // namespace LAMMPS_NS + +#endif +#endif diff --git a/src/compute_rheo_property_atom.cpp b/src/compute_rheo_property_atom.cpp new file mode 100644 index 0000000000..7682552abe --- /dev/null +++ b/src/compute_rheo_property_atom.cpp @@ -0,0 +1,411 @@ +// clang-format off +/* ---------------------------------------------------------------------- + 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 authors: + Joel Clemmer (SNL), Thomas O'Connor (CMU), Eric Palermo (CMU) +----------------------------------------------------------------------- */ + +#include "compute_rheo_property_atom.h" + +#include "atom.h" +#include "atom_vec.h" +#include "compute_rheo_interface.h" +#include "compute_rheo_kernel.h" +#include "compute_rheo_surface.h" +#include "compute_rheo_vshift.h" +#include "error.h" +#include "fix_rheo.h" +#include "fix_rheo_thermal.h" +#include "memory.h" +#include "modify.h" +#include "update.h" + +#include +#include + +using namespace LAMMPS_NS; +using namespace RHEO_NS; + +/* ---------------------------------------------------------------------- */ + +ComputeRHEOPropertyAtom::ComputeRHEOPropertyAtom(LAMMPS *lmp, int narg, char **arg) : + Compute(lmp, narg, arg), fix_rheo(nullptr), fix_thermal(nullptr), compute_interface(nullptr), + compute_kernel(nullptr), compute_surface(nullptr), compute_vshift(nullptr), + index(nullptr), pack_choice(nullptr) +{ + if (narg < 4) utils::missing_cmd_args(FLERR, "compute property/atom", error); + + peratom_flag = 1; + nvalues = narg - 3; + if (nvalues == 1) size_peratom_cols = 0; + else size_peratom_cols = nvalues; + + thermal_flag, interface_flag, surface_flag, shift_flag = 0; + + // parse input values + // customize a new keyword by adding to if statement + + pack_choice = new FnPtrPack[nvalues]; + index = new int[nvalues]; + + int i; + for (int iarg = 3; iarg < narg; iarg++) { + i = iarg-3; + + if (strcmp(arg[iarg],"phase") == 0) { + pack_choice[i] = &ComputeRHEOPropertyAtom::pack_phase; + } else if (strcmp(arg[iarg],"chi") == 0) { + interface_flag = 1; + pack_choice[i] = &ComputeRHEOPropertyAtom::pack_chi; + } else if (strcmp(arg[iarg],"surface") == 0) { + surface_flag = 1; + pack_choice[i] = &ComputeRHEOPropertyAtom::pack_surface; + } else if (strcmp(arg[iarg],"surface/r") == 0) { + surface_flag = 1; + pack_choice[i] = &ComputeRHEOPropertyAtom::pack_surface_r; + } else if (strcmp(arg[iarg],"surface/divr") == 0) { + surface_flag = 1; + pack_choice[i] = &ComputeRHEOPropertyAtom::pack_surface_divr; + } else if (strcmp(arg[iarg],"surface/nx") == 0) { + surface_flag = 1; + pack_choice[i] = &ComputeRHEOPropertyAtom::pack_surface_nx; + } else if (strcmp(arg[iarg],"surface/ny") == 0) { + surface_flag = 1; + pack_choice[i] = &ComputeRHEOPropertyAtom::pack_surface_ny; + } else if (strcmp(arg[iarg],"surface/nz") == 0) { + surface_flag = 1; + pack_choice[i] = &ComputeRHEOPropertyAtom::pack_surface_nz; + } else if (strcmp(arg[iarg],"coordination") == 0) { + pack_choice[i] = &ComputeRHEOPropertyAtom::pack_coordination; + } else if (strcmp(arg[iarg],"cv") == 0) { + thermal_flag = 1; + pack_choice[i] = &ComputeRHEOPropertyAtom::pack_cv; + } else if (strcmp(arg[iarg],"shift/vx") == 0) { + shift_flag = 1; + pack_choice[i] = &ComputeRHEOPropertyAtom::pack_shift_vx; + } else if (strcmp(arg[iarg],"shift/vy") == 0) { + shift_flag = 1; + pack_choice[i] = &ComputeRHEOPropertyAtom::pack_shift_vy; + } else if (strcmp(arg[iarg],"shift/vz") == 0) { + shift_flag = 1; + pack_choice[i] = &ComputeRHEOPropertyAtom::pack_shift_vz; + } else { + index[i] = atom->avec->property_atom(arg[iarg]); + if (index[i] < 0) + error->all(FLERR, + "Invalid keyword {} for atom style {} in compute rheo/property/atom command ", + atom->get_style(), arg[iarg]); + pack_choice[i] = &ComputeRHEOPropertyAtom::pack_atom_style; + + if (strcmp(arg[iarg],"temperature") == 0) thermal_flag = 1; + if (strcmp(arg[iarg],"heatflow") == 0) thermal_flag = 1; + if (strcmp(arg[iarg],"conductivity") == 0) thermal_flag = 1; + } + } + + nmax = 0; +} + +/* ---------------------------------------------------------------------- */ + +ComputeRHEOPropertyAtom::~ComputeRHEOPropertyAtom() +{ + delete[] pack_choice; + delete[] index; + memory->destroy(vector_atom); + memory->destroy(array_atom); +} + +/* ---------------------------------------------------------------------- */ + +void ComputeRHEOPropertyAtom::init() +{ + auto fixes = modify->get_fix_by_style("rheo"); + if (fixes.size() == 0) error->all(FLERR, "Need to define fix rheo to use fix rheo/viscosity"); + fix_rheo = dynamic_cast(fixes[0]); + + if (interface_flag && !(fix_rheo->interface_flag)) + error->all(FLERR, "Cannot request interfacial property without corresponding option in fix rheo"); + if (surface_flag && !(fix_rheo->surface_flag)) + error->all(FLERR, "Cannot request surface property without corresponding option in fix rheo"); + if (shift_flag && !(fix_rheo->shift_flag)) + error->all(FLERR, "Cannot request velocity shifting property without corresponding option in fix rheo"); + if (thermal_flag && !(fix_rheo->thermal_flag)) + error->all(FLERR, "Cannot request thermal property without fix rheo/thermal"); + + compute_interface = fix_rheo->compute_interface; + compute_kernel = fix_rheo->compute_kernel; + compute_surface = fix_rheo->compute_surface; + compute_vshift = fix_rheo->compute_vshift; + + if (thermal_flag) { + fixes = modify->get_fix_by_style("rheo/thermal"); + fix_thermal = dynamic_cast(fixes[0]); + } +} + +/* ---------------------------------------------------------------------- */ + +void ComputeRHEOPropertyAtom::compute_peratom() +{ + invoked_peratom = update->ntimestep; + + // grow vector or array if necessary + + if (atom->nmax > nmax) { + nmax = atom->nmax; + if (nvalues == 1) { + memory->destroy(vector_atom); + memory->create(vector_atom,nmax,"rheo/property/atom:vector"); + } else { + memory->destroy(array_atom); + memory->create(array_atom,nmax,nvalues,"rheo/property/atom:array"); + } + } + + // fill vector or array with per-atom values + + if (nvalues == 1) { + buf = vector_atom; + (this->*pack_choice[0])(0); + } else { + if (nmax) buf = &array_atom[0][0]; + else buf = nullptr; + for (int n = 0; n < nvalues; n++) + (this->*pack_choice[n])(n); + } +} + +/* ---------------------------------------------------------------------- + memory usage of local atom-based array +------------------------------------------------------------------------- */ + +double ComputeRHEOPropertyAtom::memory_usage() +{ + double bytes = (double)nmax * nvalues * sizeof(double); + return bytes; +} + +/* ---------------------------------------------------------------------- + one method for every keyword compute rheo/property/atom can output + the atom property is packed into buf starting at n with stride nvalues + customize a new keyword by adding a method +------------------------------------------------------------------------- */ + +/* ---------------------------------------------------------------------- */ + +void ComputeRHEOPropertyAtom::pack_phase(int n) +{ + int *status = atom->status; + int *mask = atom->mask; + int nlocal = atom->nlocal; + + int inverse_mask = ~PHASEMASK; + + for (int i = 0; i < nlocal; i++) { + if (mask[i] & groupbit) buf[n] = (status[i] & inverse_mask); + else buf[n] = 0.0; + n += nvalues; + } +} + +/* ---------------------------------------------------------------------- */ + +void ComputeRHEOPropertyAtom::pack_chi(int n) +{ + double *chi = compute_interface->chi; + int *mask = atom->mask; + int nlocal = atom->nlocal; + + for (int i = 0; i < nlocal; i++) { + if (mask[i] & groupbit) buf[n] = chi[i]; + else buf[n] = 0.0; + n += nvalues; + } +} + +/* ---------------------------------------------------------------------- */ + +void ComputeRHEOPropertyAtom::pack_surface(int n) +{ + int *status = atom->status; + int *mask = atom->mask; + int nlocal = atom->nlocal; + + int inverse_mask = ~SURFACEMASK; + + for (int i = 0; i < nlocal; i++) { + if (mask[i] & groupbit) buf[n] = (status[i] & inverse_mask); + else buf[n] = 0.0; + n += nvalues; + } +} + +/* ---------------------------------------------------------------------- */ + +void ComputeRHEOPropertyAtom::pack_surface_r(int n) +{ + double *rsurface = compute_surface->rsurface; + int *mask = atom->mask; + int nlocal = atom->nlocal; + + for (int i = 0; i < nlocal; i++) { + if (mask[i] & groupbit) buf[n] = rsurface[i]; + else buf[n] = 0.0; + n += nvalues; + } +} + +/* ---------------------------------------------------------------------- */ + +void ComputeRHEOPropertyAtom::pack_surface_divr(int n) +{ + double *divr = compute_surface->divr; + int *mask = atom->mask; + int nlocal = atom->nlocal; + + for (int i = 0; i < nlocal; i++) { + if (mask[i] & groupbit) buf[n] = divr[i]; + else buf[n] = 0.0; + n += nvalues; + } +} + +/* ---------------------------------------------------------------------- */ + +void ComputeRHEOPropertyAtom::pack_surface_nx(int n) +{ + double **nsurface = compute_surface->nsurface; + int *mask = atom->mask; + int nlocal = atom->nlocal; + + for (int i = 0; i < nlocal; i++) { + if (mask[i] & groupbit) buf[n] = nsurface[i][0]; + else buf[n] = 0.0; + n += nvalues; + } +} + +/* ---------------------------------------------------------------------- */ + +void ComputeRHEOPropertyAtom::pack_surface_ny(int n) +{ + double **nsurface = compute_surface->nsurface; + int *mask = atom->mask; + int nlocal = atom->nlocal; + + for (int i = 0; i < nlocal; i++) { + if (mask[i] & groupbit) buf[n] = nsurface[i][1]; + else buf[n] = 0.0; + n += nvalues; + } +} + + +/* ---------------------------------------------------------------------- */ + +void ComputeRHEOPropertyAtom::pack_surface_nz(int n) +{ + double **nsurface = compute_surface->nsurface; + int *mask = atom->mask; + int nlocal = atom->nlocal; + + for (int i = 0; i < nlocal; i++) { + if (mask[i] & groupbit) buf[n] = nsurface[i][2]; + else buf[n] = 0.0; + n += nvalues; + } +} + +/* ---------------------------------------------------------------------- */ + +void ComputeRHEOPropertyAtom::pack_coordination(int n) +{ + int *coordination = compute_kernel->coordination; + int *mask = atom->mask; + int nlocal = atom->nlocal; + + for (int i = 0; i < nlocal; i++) { + if (mask[i] & groupbit) buf[n] = coordination[i]; + else buf[n] = 0.0; + n += nvalues; + } +} + +/* ---------------------------------------------------------------------- */ + +void ComputeRHEOPropertyAtom::pack_cv(int n) +{ + int *mask = atom->mask; + int nlocal = atom->nlocal; + + for (int i = 0; i < nlocal; i++) { + if (mask[i] & groupbit) buf[n] = fix_thermal->calc_cv(i); + else buf[n] = 0.0; + n += nvalues; + } +} + +/* ---------------------------------------------------------------------- */ + +void ComputeRHEOPropertyAtom::pack_shift_vx(int n) +{ + double **vshift = compute_vshift->vshift; + int *mask = atom->mask; + int nlocal = atom->nlocal; + + for (int i = 0; i < nlocal; i++) { + if (mask[i] & groupbit) buf[n] = vshift[i][0]; + else buf[n] = 0.0; + n += nvalues; + } +} + +/* ---------------------------------------------------------------------- */ + +void ComputeRHEOPropertyAtom::pack_shift_vy(int n) +{ + double **vshift = compute_vshift->vshift; + int *mask = atom->mask; + int nlocal = atom->nlocal; + + for (int i = 0; i < nlocal; i++) { + if (mask[i] & groupbit) buf[n] = vshift[i][1]; + else buf[n] = 0.0; + n += nvalues; + } +} + +/* ---------------------------------------------------------------------- */ + +void ComputeRHEOPropertyAtom::pack_shift_vz(int n) +{ + double **vshift = compute_vshift->vshift; + int *mask = atom->mask; + int nlocal = atom->nlocal; + + for (int i = 0; i < nlocal; i++) { + if (mask[i] & groupbit) buf[n] = vshift[i][2]; + else buf[n] = 0.0; + n += nvalues; + } +} + +/* ---------------------------------------------------------------------- */ + +void ComputeRHEOPropertyAtom::pack_atom_style(int n) +{ + atom->avec->pack_property_atom(index[n],&buf[n],nvalues,groupbit); +} diff --git a/src/compute_rheo_property_atom.h b/src/compute_rheo_property_atom.h new file mode 100644 index 0000000000..accb7e9156 --- /dev/null +++ b/src/compute_rheo_property_atom.h @@ -0,0 +1,71 @@ +/* -*- 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 COMPUTE_CLASS +// clang-format off +ComputeStyle(rheo/property/atom,ComputeRHEOPropertyAtom); +// clang-format on +#else + +#ifndef LMP_COMPUTE_RHEO_PROPERTY_ATOM_H +#define LMP_COMPUTE_RHEO_PROPERTY_ATOM_H + +#include "compute.h" + +namespace LAMMPS_NS { + +class ComputeRHEOPropertyAtom : public Compute { + public: + ComputeRHEOPropertyAtom(class LAMMPS *, int, char **); + ~ComputeRHEOPropertyAtom() override; + void init() override; + void compute_peratom() override; + double memory_usage() override; + + private: + int nvalues, nmax; + int thermal_flag, interface_flag, surface_flag, shift_flag; + int *index; + double *buf; + + typedef void (ComputeRHEOPropertyAtom::*FnPtrPack)(int); + FnPtrPack *pack_choice; // ptrs to pack functions + + void pack_phase(int); + void pack_chi(int); + void pack_surface(int); + void pack_surface_r(int); + void pack_surface_divr(int); + void pack_surface_nx(int); + void pack_surface_ny(int); + void pack_surface_nz(int); + void pack_coordination(int); + void pack_cv(int); + void pack_shift_vx(int); + void pack_shift_vy(int); + void pack_shift_vz(int); + void pack_atom_style(int); + + class FixRHEO *fix_rheo; + class FixRHEOThermal *fix_thermal; + class ComputeRHEOInterface *compute_interface; + class ComputeRHEOKernel *compute_kernel; + class ComputeRHEOSurface *compute_surface; + class ComputeRHEOVShift *compute_vshift; + +}; + +} // namespace LAMMPS_NS + +#endif +#endif From 0cd3bd190f9b97507ce953ff6ecdf49283db3c32 Mon Sep 17 00:00:00 2001 From: jtclemm Date: Wed, 26 Apr 2023 12:14:40 -0600 Subject: [PATCH 031/158] Fixing various memory issues --- .../rheo/poiseuille/in.rheo.poiseuille | 83 +++++++++++++++++++ src/RHEO/compute_rheo_kernel.cpp | 46 +++++----- src/RHEO/compute_rheo_property_atom.cpp | 4 +- src/RHEO/fix_rheo.cpp | 4 +- src/RHEO/fix_rheo_pressure.cpp | 4 +- src/RHEO/fix_rheo_pressure.h | 1 - src/RHEO/fix_rheo_thermal.cpp | 2 +- src/RHEO/fix_rheo_viscosity.cpp | 2 +- src/RHEO/pair_rheo.cpp | 11 ++- src/compute_rheo_property_atom.cpp | 4 +- 10 files changed, 127 insertions(+), 34 deletions(-) create mode 100644 examples/PACKAGES/rheo/poiseuille/in.rheo.poiseuille diff --git a/examples/PACKAGES/rheo/poiseuille/in.rheo.poiseuille b/examples/PACKAGES/rheo/poiseuille/in.rheo.poiseuille new file mode 100644 index 0000000000..af5728c1a3 --- /dev/null +++ b/examples/PACKAGES/rheo/poiseuille/in.rheo.poiseuille @@ -0,0 +1,83 @@ +dimension 2 +units lj +atom_style rheo +boundary p p p +comm_modify vel yes + + +# ------ Particle Lattice/Resolution Parameters ------ # + +variable L equal 10 +variable sf equal 0.2 +variable n equal 1.0/(${sf}^2) +variable cut equal 3.5*${sf} + + +# ------ Create simulation box ------ # + +region box block 0 20 -10 10 -0.01 0.01 units box +create_box 2 box +lattice sq ${n} + +region topwall block INF INF 7 10 INF INF units box +region block block INF INF -6.99 6.99 INF INF units box +region botwall block INF INF -10 -7 INF INF units box + +create_atoms 2 region topwall +create_atoms 2 region botwall +create_atoms 1 region block + +group fluid type 1 +group rig type 2 + +variable dr equal 0.1*${sf} +displace_atoms fluid random $(0.1*v_sf) ${dr} 0 135414 units box + + +# ------ Model parameters ------ # + +variable rho0 equal 1.0 +variable cs equal 1.0 +variable mp equal ${rho0}/${n} +variable zeta equal 1.0 +variable kappa equal 1.0*${rho0}/${mp} +variable fext equal 1e-3/${n} +variable eta equal 0.1 +variable dt_max equal 0.1*${cut}/${cs}/3 +variable Dr equal 0.05*${cut}*${cs} + +mass 1 ${mp} +mass 2 ${mp} +set group all rheo/rho ${rho0} +set group all rheo/status 0 +set group rig rheo/status 2 +timestep ${dt_max} + +pair_style rheo ${cut} artificial/visc ${zeta} rho/damp ${Dr} +pair_coeff * * + + +# ------ Fixes & computes ------ # + +fix 1 all rheo ${cut} Quintic 0 shift +fix 2 all rheo/viscosity constant ${eta} +fix 3 all rheo/pressure linear +fix 4 rig setforce 0.0 0.0 0.0 +fix 5 fluid addforce ${fext} 0.0 0.0 + +compute 1 all rheo/property/atom rho phase + + +# ------ Output & Run ------ # + +thermo 200 +thermo_style custom step time temp press + +variable skin equal 0.2*${cut} +neighbor ${skin} bin +neigh_modify one 5000 + +dump 1 all custom 200 atomDump id type x y vx vy fx fy c_1[*] + +run 20000 + diff --git a/src/RHEO/compute_rheo_kernel.cpp b/src/RHEO/compute_rheo_kernel.cpp index 9cfa86df7e..205ae6fb72 100644 --- a/src/RHEO/compute_rheo_kernel.cpp +++ b/src/RHEO/compute_rheo_kernel.cpp @@ -103,10 +103,6 @@ void ComputeRHEOKernel::init() { neighbor->add_request(this, NeighConst::REQ_FULL); - auto fixes = modify->get_fix_by_style("rheo"); - if (fixes.size() == 0) error->all(FLERR, "Need to define fix rheo to use compute rheo/kernel"); - fix_rheo = dynamic_cast(fixes[0]); - interface_flag = fix_rheo->interface_flag; compute_interface = fix_rheo->compute_interface; @@ -147,17 +143,16 @@ void ComputeRHEOKernel::init_list(int /*id*/, NeighList *ptr) int ComputeRHEOKernel::check_corrections(int i) { - int corrections = 1; - - if (gsl_error_flag) { - // If there were errors, check to see if it occured for this atom + // Skip if there were gsl errors for this atom + if (gsl_error_flag) if (gsl_error_tags.find(atom->tag[i]) != gsl_error_tags.end()) - corrections = 0; - } + return 0; - if (coordination[i] < zmin) corrections = 0; + // Skip if undercoordinated + if (coordination[i] < zmin) + return 0; - return corrections; + return 1; } /* ---------------------------------------------------------------------- */ @@ -165,12 +160,17 @@ int ComputeRHEOKernel::check_corrections(int i) double ComputeRHEOKernel::calc_w(int i, int j, double delx, double dely, double delz, double r) { double w; + int corrections_i, corrections_j, corrections; - int corrections_i = check_corrections(i); - int corrections_j = check_corrections(j); - int corrections = corrections_i & corrections_j; + if (kernel_style != QUINTIC) { + corrections_i = check_corrections(i); + corrections_j = check_corrections(j); + corrections = corrections_i & corrections_j; + } else { + corrections = 0; + } - if (kernel_style == QUINTIC || !corrections) w = calc_w_quintic(i,j,delx,dely,delz,r); + if (!corrections) w = calc_w_quintic(i,j,delx,dely,delz,r); else if (kernel_style == CRK0) w = calc_w_crk0(i,j,delx,dely,delz,r); else if (kernel_style == CRK1) w = calc_w_crk1(i,j,delx,dely,delz,r); else if (kernel_style == CRK2) w = calc_w_crk2(i,j,delx,dely,delz,r); @@ -183,17 +183,21 @@ double ComputeRHEOKernel::calc_w(int i, int j, double delx, double dely, double double ComputeRHEOKernel::calc_dw(int i, int j, double delx, double dely, double delz, double r) { double wp; + int corrections_i, corrections_j; - int corrections_i = check_corrections(i); - int corrections_j = check_corrections(j); + if (kernel_style != QUINTIC) { + corrections_i = check_corrections(i); + corrections_j = check_corrections(j); + } // Calc wp and default dW's, a bit inefficient but can redo later wp = calc_dw_quintic(i,j,delx,dely,delz,r,dWij,dWji); - if(kernel_style == CRK1) { - //check if kernel correction calculated successfully. If not, revert to quintic + + // Overwrite if there are corrections + if (kernel_style == CRK1) { if (corrections_i) calc_dw_crk1(i,j,delx,dely,delz,r,dWij); if (corrections_j) calc_dw_crk1(j,i,-delx,-dely,-delz,r,dWji); - } else if(kernel_style == CRK2) { + } else if (kernel_style == CRK2) { if (corrections_i) calc_dw_crk2(i,j,delx,dely,delz,r,dWij); if (corrections_j) calc_dw_crk2(j,i,-delx,-dely,-delz,r,dWji); } diff --git a/src/RHEO/compute_rheo_property_atom.cpp b/src/RHEO/compute_rheo_property_atom.cpp index 7682552abe..3cd5d468b2 100644 --- a/src/RHEO/compute_rheo_property_atom.cpp +++ b/src/RHEO/compute_rheo_property_atom.cpp @@ -52,7 +52,7 @@ ComputeRHEOPropertyAtom::ComputeRHEOPropertyAtom(LAMMPS *lmp, int narg, char **a if (nvalues == 1) size_peratom_cols = 0; else size_peratom_cols = nvalues; - thermal_flag, interface_flag, surface_flag, shift_flag = 0; + thermal_flag = interface_flag = surface_flag = shift_flag = 0; // parse input values // customize a new keyword by adding to if statement @@ -132,7 +132,7 @@ ComputeRHEOPropertyAtom::~ComputeRHEOPropertyAtom() void ComputeRHEOPropertyAtom::init() { - auto fixes = modify->get_fix_by_style("rheo"); + auto fixes = modify->get_fix_by_style("^rheo$"); if (fixes.size() == 0) error->all(FLERR, "Need to define fix rheo to use fix rheo/viscosity"); fix_rheo = dynamic_cast(fixes[0]); diff --git a/src/RHEO/fix_rheo.cpp b/src/RHEO/fix_rheo.cpp index ac870affd5..48eece239a 100644 --- a/src/RHEO/fix_rheo.cpp +++ b/src/RHEO/fix_rheo.cpp @@ -195,7 +195,7 @@ void FixRHEO::init() dtv = update->dt; dtf = 0.5 * update->dt * force->ftm2v; - if (modify->get_fix_by_style("rheo").size() > 1) + if (modify->get_fix_by_style("^rheo$").size() > 1) error->all(FLERR,"Can only specify one instance of fix rheo"); } @@ -258,6 +258,8 @@ void FixRHEO::setup(int /*vflag*/) error->one(FLERR, "Fix rheo/viscosity does not fully cover all atoms"); if (!t_coverage_flag) error->one(FLERR, "Fix rheo/thermal does not fully cover all atoms"); + + pre_force(0); } /* ---------------------------------------------------------------------- */ diff --git a/src/RHEO/fix_rheo_pressure.cpp b/src/RHEO/fix_rheo_pressure.cpp index 45557794cd..63a6995646 100644 --- a/src/RHEO/fix_rheo_pressure.cpp +++ b/src/RHEO/fix_rheo_pressure.cpp @@ -92,7 +92,7 @@ int FixRHEOPressure::setmask() void FixRHEOPressure::init() { - auto fixes = modify->get_fix_by_style("rheo"); + auto fixes = modify->get_fix_by_style("^rheo$"); if (fixes.size() == 0) error->all(FLERR, "Need to define fix rheo to use fix rheo/pressure"); fix_rheo = dynamic_cast(fixes[0]); @@ -161,7 +161,7 @@ void FixRHEOPressure::pre_force(int /*vflag*/) } } - if (last_flag && comm_forward) comm->forward_comm(this); + if (comm_forward) comm->forward_comm(this); } /* ---------------------------------------------------------------------- */ diff --git a/src/RHEO/fix_rheo_pressure.h b/src/RHEO/fix_rheo_pressure.h index c257f1dbfb..e8f7f3cb88 100644 --- a/src/RHEO/fix_rheo_pressure.h +++ b/src/RHEO/fix_rheo_pressure.h @@ -41,7 +41,6 @@ class FixRHEOPressure : public Fix { double c_cubic, csq, rho0, rho0inv; double *pressure; int pressure_style; - int first_flag, last_flag; int nmax_store; class FixRHEO *fix_rheo; diff --git a/src/RHEO/fix_rheo_thermal.cpp b/src/RHEO/fix_rheo_thermal.cpp index 0d8909b908..bd7a22ce1e 100644 --- a/src/RHEO/fix_rheo_thermal.cpp +++ b/src/RHEO/fix_rheo_thermal.cpp @@ -155,7 +155,7 @@ int FixRHEOThermal::setmask() void FixRHEOThermal::init() { - auto fixes = modify->get_fix_by_style("rheo"); + auto fixes = modify->get_fix_by_style("^rheo$"); if (fixes.size() == 0) error->all(FLERR, "Need to define fix rheo to use fix rheo/viscosity"); fix_rheo = dynamic_cast(fixes[0]); diff --git a/src/RHEO/fix_rheo_viscosity.cpp b/src/RHEO/fix_rheo_viscosity.cpp index 4d70ffaca3..7d915c9b93 100644 --- a/src/RHEO/fix_rheo_viscosity.cpp +++ b/src/RHEO/fix_rheo_viscosity.cpp @@ -102,7 +102,7 @@ int FixRHEOViscosity::setmask() void FixRHEOViscosity::init() { - auto fixes = modify->get_fix_by_style("rheo"); + auto fixes = modify->get_fix_by_style("^rheo$"); if (fixes.size() == 0) error->all(FLERR, "Need to define fix rheo to use fix rheo/viscosity"); fix_rheo = dynamic_cast(fixes[0]); diff --git a/src/RHEO/pair_rheo.cpp b/src/RHEO/pair_rheo.cpp index 03e859316f..8e76a6d413 100644 --- a/src/RHEO/pair_rheo.cpp +++ b/src/RHEO/pair_rheo.cpp @@ -356,7 +356,9 @@ void PairRHEO::settings(int narg, char **arg) { if (narg < 1) error->all(FLERR,"Illegal pair_style command"); - int iarg = 0; + h = utils::numeric(FLERR,arg[0],false,lmp); +printf("settings\n"); + int iarg = 1; while (iarg < narg) { if (strcmp(arg[iarg], "rho/damp") == 0) { if (iarg + 1 >= narg) error->all(FLERR,"Illegal pair_style command"); @@ -419,10 +421,13 @@ void PairRHEO::setup() compute_grad = fix_rheo->compute_grad; compute_interface = fix_rheo->compute_interface; thermal_flag = fix_rheo->thermal_flag; - h = fix_rheo->h; csq = fix_rheo->csq; rho0 = fix_rheo->rho0; +printf("setup\n"); + if (h != fix_rheo->h) + error->all(FLERR, "Pair rheo cutoff {} does not agree with fix rheo cutoff {}", h, fix_rheo->h); + hsq = h * h; hinv = 1.0 / h; hinv3 = hinv * 3.0; cs = sqrt(csq); @@ -450,6 +455,6 @@ double PairRHEO::init_one(int i, int j) if (setflag[i][j] == 0) { error->all(FLERR,"All pair rheo coeffs are not set"); } - +printf("init one\n"); return h; } diff --git a/src/compute_rheo_property_atom.cpp b/src/compute_rheo_property_atom.cpp index 7682552abe..3cd5d468b2 100644 --- a/src/compute_rheo_property_atom.cpp +++ b/src/compute_rheo_property_atom.cpp @@ -52,7 +52,7 @@ ComputeRHEOPropertyAtom::ComputeRHEOPropertyAtom(LAMMPS *lmp, int narg, char **a if (nvalues == 1) size_peratom_cols = 0; else size_peratom_cols = nvalues; - thermal_flag, interface_flag, surface_flag, shift_flag = 0; + thermal_flag = interface_flag = surface_flag = shift_flag = 0; // parse input values // customize a new keyword by adding to if statement @@ -132,7 +132,7 @@ ComputeRHEOPropertyAtom::~ComputeRHEOPropertyAtom() void ComputeRHEOPropertyAtom::init() { - auto fixes = modify->get_fix_by_style("rheo"); + auto fixes = modify->get_fix_by_style("^rheo$"); if (fixes.size() == 0) error->all(FLERR, "Need to define fix rheo to use fix rheo/viscosity"); fix_rheo = dynamic_cast(fixes[0]); From 0cd22dd0d2d6c309e75e99470e5035e78a98d098 Mon Sep 17 00:00:00 2001 From: jtclemm Date: Thu, 27 Apr 2023 21:04:04 -0600 Subject: [PATCH 032/158] Creating doc pages and links for rheo --- doc/src/Howto.rst | 1 + doc/src/Howto_rheo.rst | 3 + doc/src/atom_style.rst | 114 +++++++++++++++++---------------- doc/src/compute.rst | 1 + doc/src/fix.rst | 4 ++ doc/src/fix_rheo.rst | 59 +++++++++++++++++ doc/src/fix_rheo_pressure.rst | 59 +++++++++++++++++ doc/src/fix_rheo_thermal.rst | 59 +++++++++++++++++ doc/src/fix_rheo_viscosity.rst | 59 +++++++++++++++++ doc/src/pair_rheo.rst | 86 +++++++++++++++++++++++++ doc/src/read_data.rst | 4 ++ doc/src/set.rst | 6 ++ 12 files changed, 400 insertions(+), 55 deletions(-) create mode 100644 doc/src/Howto_rheo.rst create mode 100644 doc/src/fix_rheo.rst create mode 100644 doc/src/fix_rheo_pressure.rst create mode 100644 doc/src/fix_rheo_thermal.rst create mode 100644 doc/src/fix_rheo_viscosity.rst create mode 100644 doc/src/pair_rheo.rst diff --git a/doc/src/Howto.rst b/doc/src/Howto.rst index 1366ecb839..94a465e6fd 100644 --- a/doc/src/Howto.rst +++ b/doc/src/Howto.rst @@ -89,6 +89,7 @@ Packages howto Howto_drude2 Howto_peri Howto_manifold + Howto_rheo Howto_spins Tutorials howto diff --git a/doc/src/Howto_rheo.rst b/doc/src/Howto_rheo.rst new file mode 100644 index 0000000000..9dac90549c --- /dev/null +++ b/doc/src/Howto_rheo.rst @@ -0,0 +1,3 @@ +Reproducing hydrodynamics and elastic objects (RHEO) +====================== + diff --git a/doc/src/atom_style.rst b/doc/src/atom_style.rst index b5ee0f07ff..98d465a6f3 100644 --- a/doc/src/atom_style.rst +++ b/doc/src/atom_style.rst @@ -78,61 +78,65 @@ coordinates, velocities, atom IDs and types. See the :doc:`set ` commands for info on how to set these various quantities. -+--------------+-----------------------------------------------------+--------------------------------------+ -| *amoeba* | molecular + charge + 1/5 neighbors | AMOEBA/HIPPO polarized force fields | -+--------------+-----------------------------------------------------+--------------------------------------+ -| *angle* | bonds and angles | bead-spring polymers with stiffness | -+--------------+-----------------------------------------------------+--------------------------------------+ -| *atomic* | only the default values | coarse-grain liquids, solids, metals | -+--------------+-----------------------------------------------------+--------------------------------------+ -| *body* | mass, inertia moments, quaternion, angular momentum | arbitrary bodies | -+--------------+-----------------------------------------------------+--------------------------------------+ -| *bond* | bonds | bead-spring polymers | -+--------------+-----------------------------------------------------+--------------------------------------+ -| *charge* | charge | atomic system with charges | -+--------------+-----------------------------------------------------+--------------------------------------+ -| *dielectric* | normx normy normz area/patch ed em epsilon curv | system with surface polarization | -+--------------+-----------------------------------------------------+--------------------------------------+ -| *dipole* | charge and dipole moment | system with dipolar particles | -+--------------+-----------------------------------------------------+--------------------------------------+ -| *dpd* | internal temperature and internal energies | DPD particles | -+--------------+-----------------------------------------------------+--------------------------------------+ -| *edpd* | temperature and heat capacity | eDPD particles | -+--------------+-----------------------------------------------------+--------------------------------------+ -| *electron* | charge and spin and eradius | electronic force field | -+--------------+-----------------------------------------------------+--------------------------------------+ -| *ellipsoid* | shape, quaternion, angular momentum | aspherical particles | -+--------------+-----------------------------------------------------+--------------------------------------+ -| *full* | molecular + charge | bio-molecules | -+--------------+-----------------------------------------------------+--------------------------------------+ -| *line* | end points, angular velocity | rigid bodies | -+--------------+-----------------------------------------------------+--------------------------------------+ -| *mdpd* | density | mDPD particles | -+--------------+-----------------------------------------------------+--------------------------------------+ -| *molecular* | bonds, angles, dihedrals, impropers | uncharged molecules | -+--------------+-----------------------------------------------------+--------------------------------------+ -| *oxdna* | nucleotide polarity | coarse-grained DNA and RNA models | -+--------------+-----------------------------------------------------+--------------------------------------+ -| *peri* | mass, volume | mesoscopic Peridynamic models | -+--------------+-----------------------------------------------------+--------------------------------------+ -| *smd* | volume, kernel diameter, contact radius, mass | solid and fluid SPH particles | -+--------------+-----------------------------------------------------+--------------------------------------+ -| *sph* | rho, esph, cv | SPH particles | -+--------------+-----------------------------------------------------+--------------------------------------+ -| *sphere* | diameter, mass, angular velocity | granular models | -+--------------+-----------------------------------------------------+--------------------------------------+ -| *bpm/sphere* | diameter, mass, angular velocity, quaternion | granular bonded particle models (BPM)| -+--------------+-----------------------------------------------------+--------------------------------------+ -| *spin* | magnetic moment | system with magnetic particles | -+--------------+-----------------------------------------------------+--------------------------------------+ -| *tdpd* | chemical concentration | tDPD particles | -+--------------+-----------------------------------------------------+--------------------------------------+ -| *template* | template index, template atom | small molecules with fixed topology | -+--------------+-----------------------------------------------------+--------------------------------------+ -| *tri* | corner points, angular momentum | rigid bodies | -+--------------+-----------------------------------------------------+--------------------------------------+ -| *wavepacket* | charge, spin, eradius, etag, cs_re, cs_im | AWPMD | -+--------------+-----------------------------------------------------+--------------------------------------+ ++----------------+-----------------------------------------------------+--------------------------------------+ +| *amoeba* | molecular + charge + 1/5 neighbors | AMOEBA/HIPPO polarized force fields | ++----------------+-----------------------------------------------------+--------------------------------------+ +| *angle* | bonds and angles | bead-spring polymers with stiffness | ++----------------+-----------------------------------------------------+--------------------------------------+ +| *atomic* | only the default values | coarse-grain liquids, solids, metals | ++----------------+-----------------------------------------------------+--------------------------------------+ +| *body* | mass, inertia moments, quaternion, angular momentum | arbitrary bodies | ++----------------+-----------------------------------------------------+--------------------------------------+ +| *bond* | bonds | bead-spring polymers | ++----------------+-----------------------------------------------------+--------------------------------------+ +| *charge* | charge | atomic system with charges | ++----------------+-----------------------------------------------------+--------------------------------------+ +| *dielectric* | normx normy normz area/patch ed em epsilon curv | system with surface polarization | ++----------------+-----------------------------------------------------+--------------------------------------+ +| *dipole* | charge and dipole moment | system with dipolar particles | ++----------------+-----------------------------------------------------+--------------------------------------+ +| *dpd* | internal temperature and internal energies | DPD particles | ++----------------+-----------------------------------------------------+--------------------------------------+ +| *edpd* | temperature and heat capacity | eDPD particles | ++----------------+-----------------------------------------------------+--------------------------------------+ +| *electron* | charge and spin and eradius | electronic force field | ++----------------+-----------------------------------------------------+--------------------------------------+ +| *ellipsoid* | shape, quaternion, angular momentum | aspherical particles | ++----------------+-----------------------------------------------------+--------------------------------------+ +| *full* | molecular + charge | bio-molecules | ++----------------+-----------------------------------------------------+--------------------------------------+ +| *line* | end points, angular velocity | rigid bodies | ++----------------+-----------------------------------------------------+--------------------------------------+ +| *mdpd* | density | mDPD particles | ++----------------+-----------------------------------------------------+--------------------------------------+ +| *molecular* | bonds, angles, dihedrals, impropers | uncharged molecules | ++----------------+-----------------------------------------------------+--------------------------------------+ +| *oxdna* | nucleotide polarity | coarse-grained DNA and RNA models | ++----------------+-----------------------------------------------------+--------------------------------------+ +| *peri* | mass, volume | mesoscopic Peridynamic models | ++----------------+-----------------------------------------------------+--------------------------------------+ +| *rheo* | rho, status | solid and fluid RHEO particles | ++----------------+-----------------------------------------------------+--------------------------------------+ +| *rheo/thermal* | rho, status, temperature | RHEO particles with temperature | ++----------------+-----------------------------------------------------+--------------------------------------+ +| *smd* | volume, kernel diameter, contact radius, mass | solid and fluid SPH particles | ++----------------+-----------------------------------------------------+--------------------------------------+ +| *sph* | rho, esph, cv | SPH particles | ++----------------+-----------------------------------------------------+--------------------------------------+ +| *sphere* | diameter, mass, angular velocity | granular models | ++----------------+-----------------------------------------------------+--------------------------------------+ +| *bpm/sphere* | diameter, mass, angular velocity, quaternion | granular bonded particle models (BPM)| ++----------------+-----------------------------------------------------+--------------------------------------+ +| *spin* | magnetic moment | system with magnetic particles | ++----------------+-----------------------------------------------------+--------------------------------------+ +| *tdpd* | chemical concentration | tDPD particles | ++----------------+-----------------------------------------------------+--------------------------------------+ +| *template* | template index, template atom | small molecules with fixed topology | ++----------------+-----------------------------------------------------+--------------------------------------+ +| *tri* | corner points, angular momentum | rigid bodies | ++----------------+-----------------------------------------------------+--------------------------------------+ +| *wavepacket* | charge, spin, eradius, etag, cs_re, cs_im | AWPMD | ++----------------+-----------------------------------------------------+--------------------------------------+ .. note:: diff --git a/doc/src/compute.rst b/doc/src/compute.rst index 880f60a8a6..5e90d78e83 100644 --- a/doc/src/compute.rst +++ b/doc/src/compute.rst @@ -271,6 +271,7 @@ The individual style names on the :doc:`Commands compute ` pag * :doc:`reduce ` - combine per-atom quantities into a single global value * :doc:`reduce/chunk ` - reduce per-atom quantities within each chunk * :doc:`reduce/region ` - same as compute reduce, within a region +* :doc:`rheo/property/atom ` - convert atom attributes in RHEO package to per-atom vectors/arrays * :doc:`rigid/local ` - extract rigid body attributes * :doc:`saed ` - electron diffraction intensity on a mesh of reciprocal lattice nodes * :doc:`slice ` - extract values from global vector or array diff --git a/doc/src/fix.rst b/doc/src/fix.rst index 56c7cde464..8ab202ab38 100644 --- a/doc/src/fix.rst +++ b/doc/src/fix.rst @@ -353,6 +353,10 @@ accelerated styles exist. * :doc:`reaxff/species ` - write out ReaxFF molecule information * :doc:`recenter ` - constrain the center-of-mass position of a group of atoms * :doc:`restrain ` - constrain a bond, angle, dihedral +* :doc:`rheo ` - integrator for the RHEO package +* :doc:`rheo/thermal ` - thermal integrator for the RHEO package +* :doc:`rheo/pressure ` - pressure derivation for the RHEO package +* :doc:`rheo/viscosity ` - viscosity derivation for the RHEO package * :doc:`rhok ` - add bias potential for long-range ordered systems * :doc:`rigid ` - constrain one or more clusters of atoms to move as a rigid body with NVE integration * :doc:`rigid/meso ` - constrain clusters of mesoscopic SPH/SDPD particles to move as a rigid body diff --git a/doc/src/fix_rheo.rst b/doc/src/fix_rheo.rst new file mode 100644 index 0000000000..7200d456dd --- /dev/null +++ b/doc/src/fix_rheo.rst @@ -0,0 +1,59 @@ +.. index:: fix rheo + +fix rheo command +=============== + +Syntax +"""""" + +.. parsed-literal:: + + fix ID group-ID rheo + +* ID, group-ID are documented in :doc:`fix ` command +* rheo = style name of this fix command + +Examples +"""""""" + +.. code-block:: LAMMPS + + fix 1 all rheo 1.0 CRK1 shift + +Description +""""""""""" + +Perform time integration to update position, velocity, internal energy +and local density for atoms in the group each timestep. This fix is +needed to time-integrate SPH systems where particles carry internal +variables such as internal energy. SPH stands for Smoothed Particle +Hydrodynamics. + +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 global or per-atom quantities are stored +by this fix for access by various :doc:`output commands `. +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 `. + +Restrictions +"""""""""""" + +This fix is part of the RHEO package. It is only enabled if +LAMMPS was built with that package. See the :doc:`Build package ` page for more info. + +Related commands +"""""""""""""""" + +:doc:`fix rheo/viscosity `, +:doc:`fix rheo/pressure `, +:doc:`fix rheo/thermal `, +:doc:`pair rheo `, +:doc:`compute rheo/property/atom ` + +Default +""""""" + +none diff --git a/doc/src/fix_rheo_pressure.rst b/doc/src/fix_rheo_pressure.rst new file mode 100644 index 0000000000..7200d456dd --- /dev/null +++ b/doc/src/fix_rheo_pressure.rst @@ -0,0 +1,59 @@ +.. index:: fix rheo + +fix rheo command +=============== + +Syntax +"""""" + +.. parsed-literal:: + + fix ID group-ID rheo + +* ID, group-ID are documented in :doc:`fix ` command +* rheo = style name of this fix command + +Examples +"""""""" + +.. code-block:: LAMMPS + + fix 1 all rheo 1.0 CRK1 shift + +Description +""""""""""" + +Perform time integration to update position, velocity, internal energy +and local density for atoms in the group each timestep. This fix is +needed to time-integrate SPH systems where particles carry internal +variables such as internal energy. SPH stands for Smoothed Particle +Hydrodynamics. + +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 global or per-atom quantities are stored +by this fix for access by various :doc:`output commands `. +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 `. + +Restrictions +"""""""""""" + +This fix is part of the RHEO package. It is only enabled if +LAMMPS was built with that package. See the :doc:`Build package ` page for more info. + +Related commands +"""""""""""""""" + +:doc:`fix rheo/viscosity `, +:doc:`fix rheo/pressure `, +:doc:`fix rheo/thermal `, +:doc:`pair rheo `, +:doc:`compute rheo/property/atom ` + +Default +""""""" + +none diff --git a/doc/src/fix_rheo_thermal.rst b/doc/src/fix_rheo_thermal.rst new file mode 100644 index 0000000000..7200d456dd --- /dev/null +++ b/doc/src/fix_rheo_thermal.rst @@ -0,0 +1,59 @@ +.. index:: fix rheo + +fix rheo command +=============== + +Syntax +"""""" + +.. parsed-literal:: + + fix ID group-ID rheo + +* ID, group-ID are documented in :doc:`fix ` command +* rheo = style name of this fix command + +Examples +"""""""" + +.. code-block:: LAMMPS + + fix 1 all rheo 1.0 CRK1 shift + +Description +""""""""""" + +Perform time integration to update position, velocity, internal energy +and local density for atoms in the group each timestep. This fix is +needed to time-integrate SPH systems where particles carry internal +variables such as internal energy. SPH stands for Smoothed Particle +Hydrodynamics. + +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 global or per-atom quantities are stored +by this fix for access by various :doc:`output commands `. +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 `. + +Restrictions +"""""""""""" + +This fix is part of the RHEO package. It is only enabled if +LAMMPS was built with that package. See the :doc:`Build package ` page for more info. + +Related commands +"""""""""""""""" + +:doc:`fix rheo/viscosity `, +:doc:`fix rheo/pressure `, +:doc:`fix rheo/thermal `, +:doc:`pair rheo `, +:doc:`compute rheo/property/atom ` + +Default +""""""" + +none diff --git a/doc/src/fix_rheo_viscosity.rst b/doc/src/fix_rheo_viscosity.rst new file mode 100644 index 0000000000..7200d456dd --- /dev/null +++ b/doc/src/fix_rheo_viscosity.rst @@ -0,0 +1,59 @@ +.. index:: fix rheo + +fix rheo command +=============== + +Syntax +"""""" + +.. parsed-literal:: + + fix ID group-ID rheo + +* ID, group-ID are documented in :doc:`fix ` command +* rheo = style name of this fix command + +Examples +"""""""" + +.. code-block:: LAMMPS + + fix 1 all rheo 1.0 CRK1 shift + +Description +""""""""""" + +Perform time integration to update position, velocity, internal energy +and local density for atoms in the group each timestep. This fix is +needed to time-integrate SPH systems where particles carry internal +variables such as internal energy. SPH stands for Smoothed Particle +Hydrodynamics. + +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 global or per-atom quantities are stored +by this fix for access by various :doc:`output commands `. +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 `. + +Restrictions +"""""""""""" + +This fix is part of the RHEO package. It is only enabled if +LAMMPS was built with that package. See the :doc:`Build package ` page for more info. + +Related commands +"""""""""""""""" + +:doc:`fix rheo/viscosity `, +:doc:`fix rheo/pressure `, +:doc:`fix rheo/thermal `, +:doc:`pair rheo `, +:doc:`compute rheo/property/atom ` + +Default +""""""" + +none diff --git a/doc/src/pair_rheo.rst b/doc/src/pair_rheo.rst new file mode 100644 index 0000000000..b5c02c41ff --- /dev/null +++ b/doc/src/pair_rheo.rst @@ -0,0 +1,86 @@ +.. index:: pair_style sph/lj + +pair_style sph/lj command +========================= + +Syntax +"""""" + +.. code-block:: LAMMPS + + pair_style sph/lj + +Examples +"""""""" + +.. code-block:: LAMMPS + + pair_style sph/lj + pair_coeff * * 1.0 2.4 + +Description +""""""""""" + +The sph/lj style computes pressure forces between particles according +to the Lennard-Jones equation of state, which is computed according to +Ree's 1980 polynomial fit :ref:`(Ree) `. The Lennard-Jones parameters +epsilon and sigma are set to unity. This pair style also computes +Monaghan's artificial viscosity to prevent particles from +interpenetrating :ref:`(Monaghan) `. + +See `this PDF guide `_ to using SPH in +LAMMPS. + +The following coefficients must be defined for each pair of atoms +types via the :doc:`pair_coeff ` command as in the examples +above. + +* :math:`\nu` artificial viscosity (no units) +* h kernel function cutoff (distance units) + +---------- + +Mixing, shift, table, tail correction, restart, rRESPA info +""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" + +This style does not support mixing. Thus, coefficients for all +I,J pairs must be specified explicitly. + +This style does not support the :doc:`pair_modify ` +shift, table, and tail options. + +This style does not write information to :doc:`binary restart files `. Thus, you need to re-specify the pair_style and +pair_coeff commands in an input script that reads a restart file. + +This style can only be used via the *pair* keyword of the :doc:`run_style respa ` command. It does not support the *inner*, +*middle*, *outer* keywords. + +Restrictions +"""""""""""" + +As noted above, the Lennard-Jones parameters epsilon and sigma are set +to unity. + +This pair style is part of the SPH package. It is only enabled +if LAMMPS was built with that package. See the :doc:`Build package ` page for more info. + +Related commands +"""""""""""""""" + +:doc:`pair_coeff `, pair_sph/rhosum + +Default +""""""" + +none + +---------- + +.. _Ree: + +**(Ree)** Ree, Journal of Chemical Physics, 73, 5401 (1980). + +.. _Monoghan: + +**(Monaghan)** Monaghan and Gingold, Journal of Computational Physics, +52, 374-389 (1983). diff --git a/doc/src/read_data.rst b/doc/src/read_data.rst index 0ecd2b6fa2..4950d8bc25 100644 --- a/doc/src/read_data.rst +++ b/doc/src/read_data.rst @@ -714,6 +714,10 @@ of analysis. - atom-ID molecule-ID atom-type x y z * - peri - atom-ID atom-type volume density x y z + * - rheo + - atom-ID atom-type status rho x y z + * - rheo/thermal + - atom-ID atom-type status rho temperature x y z * - smd - atom-ID atom-type molecule volume mass kradius cradius x0 y0 z0 x y z * - sph diff --git a/doc/src/set.rst b/doc/src/set.rst index 0073e44bf8..96e48a8893 100644 --- a/doc/src/set.rst +++ b/doc/src/set.rst @@ -111,6 +111,8 @@ Syntax *angle* value = angle type for all angles between selected atoms *dihedral* value = dihedral type for all dihedrals between selected atoms *improper* value = improper type for all impropers between selected atoms + *rheo/rho* value = density of RHEO particles (mass/distance\^3) + *rheo/status* value = status or phase of RHEO particles (unitless) *sph/e* value = energy of SPH particles (need units) value can be an atom-style variable (see below) *sph/cv* value = heat capacity of SPH particles (need units) @@ -472,6 +474,10 @@ the *bond types* (\ *angle types*, etc) field in the header of the data file read by the :doc:`read_data ` command. These keywords do not allow use of an atom-style variable. +Keywords *rheo/rho* and *rheo/status* set the density and the status of +rheo particles. In particular, one can only set the phase in the status +as described by the :doc:`RHEO howto page `. + Keywords *sph/e*, *sph/cv*, and *sph/rho* set the energy, heat capacity, and density of smoothed particle hydrodynamics (SPH) particles. See `this PDF guide `_ to using SPH in LAMMPS. From 0b1d393d7817c40d4df9735e96dbdec1093e741b Mon Sep 17 00:00:00 2001 From: jtclemm Date: Mon, 1 May 2023 14:05:47 -0600 Subject: [PATCH 033/158] Adding arguments to doc page --- doc/src/Howto_rheo.rst | 1 + doc/src/fix_rheo.rst | 36 ++++++++++++++----- doc/src/fix_rheo_pressure.rst | 33 +++++++++++------ doc/src/fix_rheo_thermal.rst | 50 ++++++++++++++++++++------ doc/src/fix_rheo_viscosity.rst | 43 ++++++++++++++++------ doc/src/pair_rheo.rst | 66 +++++++++++++--------------------- src/RHEO/fix_rheo.cpp | 6 ++-- src/RHEO/fix_rheo_thermal.cpp | 2 +- src/RHEO/pair_rheo.cpp | 6 ++-- 9 files changed, 154 insertions(+), 89 deletions(-) diff --git a/doc/src/Howto_rheo.rst b/doc/src/Howto_rheo.rst index 9dac90549c..c55631455b 100644 --- a/doc/src/Howto_rheo.rst +++ b/doc/src/Howto_rheo.rst @@ -1,3 +1,4 @@ Reproducing hydrodynamics and elastic objects (RHEO) ====================== +Text diff --git a/doc/src/fix_rheo.rst b/doc/src/fix_rheo.rst index 7200d456dd..e9613e4838 100644 --- a/doc/src/fix_rheo.rst +++ b/doc/src/fix_rheo.rst @@ -8,26 +8,38 @@ Syntax .. parsed-literal:: - fix ID group-ID rheo + fix ID group-ID rheo cut kstyle keyword values... * ID, group-ID are documented in :doc:`fix ` command * rheo = style name of this fix command +* cut = *quintic* or *CRK0* or *CRK1* or *CRK2* +* zero or more keyword/value pairs may be appended to args +* keyword = *shift* or *thermal* or *surface/detection* or *interface/reconstruction* or *rho/sum* or *density* or *sound/squared* + + .. parsed-literal:: + + *shift* values = none, turns on velocity shifting + *thermal* values = none, turns on thermal evolution + *surface/detection* values = *sdstyle* *limit* + *sdstyle* = *coordination* or *divergence* + *limit* = threshold for surface particles (unitless) + *interface/reconstruction* values = none, reconstructs interfaces with solid particles + *rho/sum* values = none, uses the kernel to compute the density of particles + *density* values = *rho0* (density) + *sound/squared* values = *csq* (velocity\^2) Examples """""""" .. code-block:: LAMMPS - fix 1 all rheo 1.0 CRK1 shift + fix 1 all rheo 1.0 quintic thermal density 0.1 sound/squared 10.0 + fix 1 all rheo 1.0 CRK1 shift surface/detection coordination 40 Description """"""""""" -Perform time integration to update position, velocity, internal energy -and local density for atoms in the group each timestep. This fix is -needed to time-integrate SPH systems where particles carry internal -variables such as internal energy. SPH stands for Smoothed Particle -Hydrodynamics. +Fix description... Restart, fix_modify, output, run start/stop, minimize info """"""""""""""""""""""""""""""""""""""""""""""""""""""""""" @@ -41,6 +53,14 @@ the :doc:`run ` command. This fix is not invoked during :doc:`energy minim Restrictions """""""""""" +This fix must be used with an atom style that includes density +such as atom_style rheo or rheo/thermal. This fix must be used in +conjuction with :doc:`fix rheo/pressure `. and +:doc:`fix rheo/viscosity `, If the *thermal* +setting is used, there must also be an instance of +:doc:`fix rheo/thermal `. The fix group must be +set to all. + This fix is part of the RHEO package. It is only enabled if LAMMPS was built with that package. See the :doc:`Build package ` page for more info. @@ -56,4 +76,4 @@ Related commands Default """"""" -none +*rho0* and *csq* are set to 1.0. diff --git a/doc/src/fix_rheo_pressure.rst b/doc/src/fix_rheo_pressure.rst index 7200d456dd..ceb402501a 100644 --- a/doc/src/fix_rheo_pressure.rst +++ b/doc/src/fix_rheo_pressure.rst @@ -1,6 +1,6 @@ -.. index:: fix rheo +.. index:: fix rheo/pressure -fix rheo command +fix rheo/pressure command =============== Syntax @@ -8,26 +8,33 @@ Syntax .. parsed-literal:: - fix ID group-ID rheo + fix ID group-ID rheo/pressure pstyle args * ID, group-ID are documented in :doc:`fix ` command -* rheo = style name of this fix command +* rheo/pressure = style name of this fix command +* pstyle = *linear* or *taitwater* or *cubic* + + .. parsed-literal:: + + *linear* args = none + *taitwater* args = none + *cubic* args = cubic term prefactor :math:`A_3` (pressure/density\^2) Examples """""""" .. code-block:: LAMMPS - fix 1 all rheo 1.0 CRK1 shift + fix 1 all rheo/pressure linear + fix 1 all rheo/pressure cubic 10.0 Description """"""""""" -Perform time integration to update position, velocity, internal energy -and local density for atoms in the group each timestep. This fix is -needed to time-integrate SPH systems where particles carry internal -variables such as internal energy. SPH stands for Smoothed Particle -Hydrodynamics. +This fix... + +Only one instance of fix rheo/pressure can be defined and the fix group must be set to all. + Restart, fix_modify, output, run start/stop, minimize info """"""""""""""""""""""""""""""""""""""""""""""""""""""""""" @@ -41,6 +48,11 @@ the :doc:`run ` command. This fix is not invoked during :doc:`energy minim Restrictions """""""""""" +This fix must be used with an atom style that includes density +such as atom_style rheo or rheo/thermal. This fix must be used in +conjuction with :doc:`fix rheo `. The fix group must be +set to all. + This fix is part of the RHEO package. It is only enabled if LAMMPS was built with that package. See the :doc:`Build package ` page for more info. @@ -48,7 +60,6 @@ Related commands """""""""""""""" :doc:`fix rheo/viscosity `, -:doc:`fix rheo/pressure `, :doc:`fix rheo/thermal `, :doc:`pair rheo `, :doc:`compute rheo/property/atom ` diff --git a/doc/src/fix_rheo_thermal.rst b/doc/src/fix_rheo_thermal.rst index 7200d456dd..01b4820a39 100644 --- a/doc/src/fix_rheo_thermal.rst +++ b/doc/src/fix_rheo_thermal.rst @@ -1,6 +1,6 @@ -.. index:: fix rheo +.. index:: fix rheo/thermal -fix rheo command +fix rheo/thermal command =============== Syntax @@ -8,26 +8,49 @@ Syntax .. parsed-literal:: - fix ID group-ID rheo + fix ID group-ID rheo/thermal keyword values ... * ID, group-ID are documented in :doc:`fix ` command -* rheo = style name of this fix command +* rheo/viscosity = style name of this fix command +* one or more attributes may be appended +* attribute = *conductivity* or *specific/heat* or *Tfreeze* + + .. parsed-literal:: + + *conductivity* args = style param + style = *constant* or *type* + *constant* arg = conductivity (power/temperature) + *type* args = list of conductivity values, one per type (power/temperature) + *specific/heat* args = style param + style = *constant* or *type* + *constant* arg = specific heat (energy/(mass*temperature)) + *type* args = list of specific heat values, one per atom type (energy/(mass*temperature)) + *Tfreeze* args = style param + style = *constant* or *type* + *constant* arg = freezing temperature (temperature) + *type* args = list of freezing temperature values, one per type (temperature) Examples """""""" .. code-block:: LAMMPS - fix 1 all rheo 1.0 CRK1 shift + fix 1 all rheo/thermal conductivity constant 1.0 specific/heat constant 1.0 Tfreeze constant 1.0 + fix 1 all rheo/pressure conductivity constant 1.0 specific/heat type 1.0 2.0 Description """"""""""" -Perform time integration to update position, velocity, internal energy -and local density for atoms in the group each timestep. This fix is -needed to time-integrate SPH systems where particles carry internal -variables such as internal energy. SPH stands for Smoothed Particle -Hydrodynamics. +This fix... + +While the *Tfreeze* keyword is optional, the *conducitivity* and +*specific/heat* keywords are mandatory. + +Multiple instances of this fix may be defined to apply different +properties to different groups. However, the union of fix groups +across all instances of fix rheo/thermal must cover all atoms. +If there are multiple instances of this fix, any intersections in +the fix groups will lead to incorrect thermal integration. Restart, fix_modify, output, run start/stop, minimize info """"""""""""""""""""""""""""""""""""""""""""""""""""""""""" @@ -41,15 +64,20 @@ the :doc:`run ` command. This fix is not invoked during :doc:`energy minim Restrictions """""""""""" +This fix must be used with an atom style that includes temperature, +heatflow, and conductivity such as atom_tyle rheo/thermal This fix +must be used in conjuction with :doc:`fix rheo ` with the +*thermal* setting. + This fix is part of the RHEO package. It is only enabled if LAMMPS was built with that package. See the :doc:`Build package ` page for more info. Related commands """""""""""""""" +:doc:`fix rheo `, :doc:`fix rheo/viscosity `, :doc:`fix rheo/pressure `, -:doc:`fix rheo/thermal `, :doc:`pair rheo `, :doc:`compute rheo/property/atom ` diff --git a/doc/src/fix_rheo_viscosity.rst b/doc/src/fix_rheo_viscosity.rst index 7200d456dd..278c621216 100644 --- a/doc/src/fix_rheo_viscosity.rst +++ b/doc/src/fix_rheo_viscosity.rst @@ -1,6 +1,6 @@ -.. index:: fix rheo +.. index:: fix rheo/viscosity -fix rheo command +fix rheo/viscosity command =============== Syntax @@ -8,26 +8,43 @@ Syntax .. parsed-literal:: - fix ID group-ID rheo + fix ID group-ID rheo/viscosity vstyle args * ID, group-ID are documented in :doc:`fix ` command -* rheo = style name of this fix command +* rheo/viscosity = style name of this fix command +* vstyle = *constant* or *type* or *power* + + .. parsed-literal:: + + *constant* arg = viscosity (mass/(length*time)) + *type* args = list of viscosity values, one per atom type (mass/(length*time)) + *power* args = *eta* *gd0* *K* *npow* *tau0* + *eta* = (units) + *gd0* = (units) + *K* = (units) + *npow* = (units) + *tau0* = (units) Examples """""""" .. code-block:: LAMMPS - fix 1 all rheo 1.0 CRK1 shift + fix 1 all rheo/viscosity constant 1.0 + fix 1 all rheo/viscosity power 0.1 1e-2 0.5 0.01 Description """"""""""" -Perform time integration to update position, velocity, internal energy -and local density for atoms in the group each timestep. This fix is -needed to time-integrate SPH systems where particles carry internal -variables such as internal energy. SPH stands for Smoothed Particle -Hydrodynamics. +This fix... + +Multiple instances of this fix may be defined to apply different +properties to different groups. However, the union of fix groups +across all instances of fix rheo/viscosity must cover all atoms. +If there are multiple instances of this fix, any intersection +between fix groups will cause the viscosity for the affected atoms +to be calculated multiple times. Any such affected atoms will enabled +up with a viscosity calculated by the latest defined fix. Restart, fix_modify, output, run start/stop, minimize info """"""""""""""""""""""""""""""""""""""""""""""""""""""""""" @@ -41,13 +58,17 @@ the :doc:`run ` command. This fix is not invoked during :doc:`energy minim Restrictions """""""""""" +This fix must be used with an atom style that includes viscosity +such as atom_style rheo or rheo/thermal. This fix must be used in +conjuction with :doc:`fix rheo `. + This fix is part of the RHEO package. It is only enabled if LAMMPS was built with that package. See the :doc:`Build package ` page for more info. Related commands """""""""""""""" -:doc:`fix rheo/viscosity `, +:doc:`fix rheo `, :doc:`fix rheo/pressure `, :doc:`fix rheo/thermal `, :doc:`pair rheo `, diff --git a/doc/src/pair_rheo.rst b/doc/src/pair_rheo.rst index b5c02c41ff..7a26755780 100644 --- a/doc/src/pair_rheo.rst +++ b/doc/src/pair_rheo.rst @@ -1,6 +1,6 @@ .. index:: pair_style sph/lj -pair_style sph/lj command +pair_style rheo command ========================= Syntax @@ -8,79 +8,63 @@ Syntax .. code-block:: LAMMPS - pair_style sph/lj + pair_style rheo cut keyword values + +* cut = *quintic* or *CRK0* or *CRK1* or *CRK2* +* zero or more keyword/value pairs may be appended to args +* keyword = *rho/damp* or *artificial/visc* + +.. parsed-literal:: + + *rho/damp* args = density damping prefactor :math:`\xi` (units?) + *artificial/visc* args = artificial viscosity prefactor :math:`\zeta` (units?) Examples """""""" .. code-block:: LAMMPS - pair_style sph/lj - pair_coeff * * 1.0 2.4 + pair_style rheo 1.0 quintic rho/damp 1.0 artificial/visc 2.0 + pair_coeff * * Description """"""""""" -The sph/lj style computes pressure forces between particles according -to the Lennard-Jones equation of state, which is computed according to -Ree's 1980 polynomial fit :ref:`(Ree) `. The Lennard-Jones parameters -epsilon and sigma are set to unity. This pair style also computes -Monaghan's artificial viscosity to prevent particles from -interpenetrating :ref:`(Monaghan) `. +pair style... -See `this PDF guide `_ to using SPH in -LAMMPS. - -The following coefficients must be defined for each pair of atoms -types via the :doc:`pair_coeff ` command as in the examples +No coefficients are defined for each pair of atoms types via the +:doc:`pair_coeff ` command as in the examples above. -* :math:`\nu` artificial viscosity (no units) -* h kernel function cutoff (distance units) - ---------- Mixing, shift, table, tail correction, restart, rRESPA info """"""""""""""""""""""""""""""""""""""""""""""""""""""""""" -This style does not support mixing. Thus, coefficients for all -I,J pairs must be specified explicitly. - This style does not support the :doc:`pair_modify ` shift, table, and tail options. This style does not write information to :doc:`binary restart files `. Thus, you need to re-specify the pair_style and pair_coeff commands in an input script that reads a restart file. -This style can only be used via the *pair* keyword of the :doc:`run_style respa ` command. It does not support the *inner*, -*middle*, *outer* keywords. +This style can only be used via the *pair* keyword of the :doc:`run_style respa ` command. It does not support the *inner*, *middle*, *outer* keywords. Restrictions """""""""""" -As noted above, the Lennard-Jones parameters epsilon and sigma are set -to unity. - -This pair style is part of the SPH package. It is only enabled -if LAMMPS was built with that package. See the :doc:`Build package ` page for more info. +This fix is part of the RHEO package. It is only enabled if +LAMMPS was built with that package. See the :doc:`Build package ` page for more info. Related commands """""""""""""""" -:doc:`pair_coeff `, pair_sph/rhosum +:doc:`fix rheo `, +:doc:`fix rheo/pressure `, +:doc:`fix rheo/thermal `, +:doc:`fix rheo/viscosity `, +:doc:`compute rheo/property/atom ` Default """"""" -none - ----------- - -.. _Ree: - -**(Ree)** Ree, Journal of Chemical Physics, 73, 5401 (1980). - -.. _Monoghan: - -**(Monaghan)** Monaghan and Gingold, Journal of Computational Physics, -52, 374-389 (1983). +No density damping or artificial viscous forces are calculated. diff --git a/src/RHEO/fix_rheo.cpp b/src/RHEO/fix_rheo.cpp index 48eece239a..bacaae074d 100644 --- a/src/RHEO/fix_rheo.cpp +++ b/src/RHEO/fix_rheo.cpp @@ -74,7 +74,7 @@ FixRHEO::FixRHEO(LAMMPS *lmp, int narg, char **arg) : h = utils::numeric(FLERR,arg[3],false,lmp); cut = h; - if (strcmp(arg[4],"Quintic") == 0) { + if (strcmp(arg[4],"quintic") == 0) { kernel_style = QUINTIC; } else if (strcmp(arg[4],"CRK0") == 0) { kernel_style = CRK0; @@ -109,11 +109,11 @@ FixRHEO::FixRHEO(LAMMPS *lmp, int narg, char **arg) : interface_flag = 1; } else if (strcmp(arg[iarg],"rho/sum") == 0) { rhosum_flag = 1; - } else if (strcmp(arg[iarg],"rho0") == 0) { + } else if (strcmp(arg[iarg],"density") == 0) { if(iarg + 1 >= narg) error->all(FLERR,"Illegal rho0 option in fix rheo"); rho0 = utils::numeric(FLERR,arg[iarg + 1],false,lmp); iarg += 1; - } else if (strcmp(arg[iarg],"csq") == 0) { + } else if (strcmp(arg[iarg],"sound/squared") == 0) { if(iarg+1 >= narg) error->all(FLERR,"Illegal csq option in fix rheo"); csq = utils::numeric(FLERR,arg[iarg + 1],false,lmp); iarg += 1; diff --git a/src/RHEO/fix_rheo_thermal.cpp b/src/RHEO/fix_rheo_thermal.cpp index bd7a22ce1e..ec39a13311 100644 --- a/src/RHEO/fix_rheo_thermal.cpp +++ b/src/RHEO/fix_rheo_thermal.cpp @@ -72,7 +72,7 @@ FixRHEOThermal::FixRHEOThermal(LAMMPS *lmp, int narg, char **arg) : } else { error->all(FLERR,"Illegal fix command, {}", arg[iarg + 1]); } - } else if (strcmp(arg[iarg],"cv") == 0) { + } else if (strcmp(arg[iarg],"specific/heat") == 0) { // Cv arguments if (iarg + 1 >= narg) error->all(FLERR,"Insufficient arguments for cv option"); if (strcmp(arg[iarg + 1],"constant") == 0) { diff --git a/src/RHEO/pair_rheo.cpp b/src/RHEO/pair_rheo.cpp index 8e76a6d413..b8b8e5a809 100644 --- a/src/RHEO/pair_rheo.cpp +++ b/src/RHEO/pair_rheo.cpp @@ -357,7 +357,7 @@ void PairRHEO::settings(int narg, char **arg) if (narg < 1) error->all(FLERR,"Illegal pair_style command"); h = utils::numeric(FLERR,arg[0],false,lmp); -printf("settings\n"); + int iarg = 1; while (iarg < narg) { if (strcmp(arg[iarg], "rho/damp") == 0) { @@ -423,7 +423,7 @@ void PairRHEO::setup() thermal_flag = fix_rheo->thermal_flag; csq = fix_rheo->csq; rho0 = fix_rheo->rho0; -printf("setup\n"); + if (h != fix_rheo->h) error->all(FLERR, "Pair rheo cutoff {} does not agree with fix rheo cutoff {}", h, fix_rheo->h); @@ -455,6 +455,6 @@ double PairRHEO::init_one(int i, int j) if (setflag[i][j] == 0) { error->all(FLERR,"All pair rheo coeffs are not set"); } -printf("init one\n"); + return h; } From c81c4cefc07fa0c131a03d497ac58737f7864af8 Mon Sep 17 00:00:00 2001 From: jtclemm Date: Mon, 1 May 2023 14:32:14 -0600 Subject: [PATCH 034/158] Fixing pair label --- doc/src/pair_rheo.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/src/pair_rheo.rst b/doc/src/pair_rheo.rst index 7a26755780..d168f79785 100644 --- a/doc/src/pair_rheo.rst +++ b/doc/src/pair_rheo.rst @@ -1,4 +1,4 @@ -.. index:: pair_style sph/lj +.. index:: pair_style rheo pair_style rheo command ========================= From 4a419b2f006acac80c316b4c216134cb31ae5189 Mon Sep 17 00:00:00 2001 From: jtclemm Date: Mon, 1 May 2023 14:47:52 -0600 Subject: [PATCH 035/158] Adding rheo property/atom compute odc --- doc/src/compute_rheo_property_atom.rst | 101 +++++++++++++++++++++++++ 1 file changed, 101 insertions(+) create mode 100644 doc/src/compute_rheo_property_atom.rst diff --git a/doc/src/compute_rheo_property_atom.rst b/doc/src/compute_rheo_property_atom.rst new file mode 100644 index 0000000000..5476f7f709 --- /dev/null +++ b/doc/src/compute_rheo_property_atom.rst @@ -0,0 +1,101 @@ +.. index:: compute rheo/property/atom + +compute rheo/property/atom command +============================= + +Syntax +"""""" + +.. code-block:: LAMMPS + + compute ID group-ID rheo/property/atom input1 input2 ... + +* ID, group-ID are documented in :doc:`compute ` command +* rheo/property/atom = style name of this compute command +* input = one or more atom attributes + + .. parsed-literal:: + + possible attributes = phase, chi, surface, surface/r, + surface/divr, surface/nx, surface/ny, + surface/nz, coordination, cv, shift/vx, + shift/vy, shift/vz, temperature, heatflow, + conductivity, viscosity, pressure, status, + rho + + .. parsed-literal:: + + *phase* = atom phase status + *chi* = atom phase neighborhood metric + *surface* = atom surface status + *surface/r* = atom distance from the surface + *surface/divr* = divergence of position at atom position + *surface/nx, surface/ny, surface/nz* = surface normal vector + *coordination* = coordination number + *shift/vx, shift/vy, shift/vz* = atom shifting velocity + *temperature* = atom temperature + *heatflow* = atom heat flow + *conductivity* = atom conductivity + *viscosity* = atom viscosity + *pressure* = atom pressure + *status* = atom full status + *rho* = atom density + +Examples +"""""""" + +.. code-block:: LAMMPS + + compute 1 all rheo/property/atom phase surface/r pressure + +Description +""""""""""" + +Define a computation that simply stores atom attributes specific to the +RHEO package for each atom in the group. This is useful so that the +values can be used by other :doc:`output commands ` that +take computes as inputs. See for example, the :doc:`compute reduce +`, :doc:`fix ave/atom `, :doc:`fix +ave/histo `, :doc:`fix ave/chunk `, +and :doc:`atom-style variable ` commands. + +The possible attributes are described in more detail in other RHEO doc +pages include :doc:`fix rheo `, :doc:`pair rheo `, +and :doc:`the RHEO howto page `. + +The values are stored in a per-atom vector or array as discussed +below. Zeroes are stored for atoms not in the specified group or for +quantities that are not defined for a particular particle in the group + +Output info +""""""""""" + +This compute calculates a per-atom vector or per-atom array depending +on the number of input values. If a single input is specified, a +per-atom vector is produced. If two or more inputs are specified, a +per-atom array is produced where the number of columns = the number of +inputs. The vector or array can be accessed by any command that uses +per-atom values from a compute as input. See the :doc:`Howto output +` page for an overview of LAMMPS output options. + +The vector or array values will be in whatever :doc:`units ` the +corresponding attribute is in (e.g., density units for *rho*). + +Restrictions +"""""""""""" + none + +Related commands +"""""""""""""""" + +:doc:`dump custom `, :doc:`compute reduce `, +:doc:`fix ave/atom `, :doc:`fix ave/chunk `, +:doc:`fix rheo/viscosity `, +:doc:`fix rheo/pressure `, +:doc:`fix rheo/thermal `, +:doc:`pair rheo ` + +Default +""""""" + +none From 35418afd6b186eaa1be26a09ea5740573a8a53b1 Mon Sep 17 00:00:00 2001 From: jtclemm Date: Thu, 11 May 2023 14:19:32 -0600 Subject: [PATCH 036/158] Rename CRK -> RK --- doc/src/fix_rheo.rst | 4 +-- src/RHEO/compute_rheo_kernel.cpp | 60 ++++++++++++++++---------------- src/RHEO/compute_rheo_kernel.h | 10 +++--- src/RHEO/fix_rheo.cpp | 12 +++---- src/RHEO/fix_rheo.h | 2 +- src/RHEO/pair_rheo.cpp | 4 +-- 6 files changed, 46 insertions(+), 46 deletions(-) diff --git a/doc/src/fix_rheo.rst b/doc/src/fix_rheo.rst index e9613e4838..7aaab48f54 100644 --- a/doc/src/fix_rheo.rst +++ b/doc/src/fix_rheo.rst @@ -12,7 +12,7 @@ Syntax * ID, group-ID are documented in :doc:`fix ` command * rheo = style name of this fix command -* cut = *quintic* or *CRK0* or *CRK1* or *CRK2* +* cut = *quintic* or *RK0* or *RK1* or *RK2* * zero or more keyword/value pairs may be appended to args * keyword = *shift* or *thermal* or *surface/detection* or *interface/reconstruction* or *rho/sum* or *density* or *sound/squared* @@ -34,7 +34,7 @@ Examples .. code-block:: LAMMPS fix 1 all rheo 1.0 quintic thermal density 0.1 sound/squared 10.0 - fix 1 all rheo 1.0 CRK1 shift surface/detection coordination 40 + fix 1 all rheo 1.0 RK1 shift surface/detection coordination 40 Description """"""""""" diff --git a/src/RHEO/compute_rheo_kernel.cpp b/src/RHEO/compute_rheo_kernel.cpp index 205ae6fb72..09d807d50d 100644 --- a/src/RHEO/compute_rheo_kernel.cpp +++ b/src/RHEO/compute_rheo_kernel.cpp @@ -60,11 +60,11 @@ ComputeRHEOKernel::ComputeRHEOKernel(LAMMPS *lmp, int narg, char **arg) : if (kernel_style == QUINTIC) { correction_order = -1; - } else if (kernel_style == CRK0) { + } else if (kernel_style == RK0) { correction_order = 0; - } else if (kernel_style == CRK1) { + } else if (kernel_style == RK1) { correction_order = 1; - } else if (kernel_style == CRK2) { + } else if (kernel_style == RK2) { correction_order = 2; } @@ -73,11 +73,11 @@ ComputeRHEOKernel::ComputeRHEOKernel(LAMMPS *lmp, int narg, char **arg) : comm_forward = 1; ncor = 0; Mdim = 0; - if (kernel_style == CRK1) { + if (kernel_style == RK1) { Mdim = 1 + dim; ncor = 1 + dim; comm_forward = ncor * Mdim; - } else if (kernel_style == CRK2) { + } else if (kernel_style == RK2) { //Polynomial basis size (up to quadratic order) Mdim = 1 + dim + dim * (dim + 1) / 2; //Number of sets of correction coefficients (1 x y xx yy) + z zz (3D) @@ -123,11 +123,11 @@ void ComputeRHEOKernel::init() nmax_store = atom->nmax; memory->create(coordination, nmax_store, "rheo:coordination"); - if (kernel_style == CRK0) { + if (kernel_style == RK0) { memory->create(C0, nmax_store, "rheo/kernel:C0"); - } else if (kernel_style == CRK1) { + } else if (kernel_style == RK1) { memory->create(C, nmax_store, ncor, Mdim, "rheo/kernel:C"); - } else if (kernel_style == CRK2) { + } else if (kernel_style == RK2) { memory->create(C, nmax_store, ncor, Mdim, "rheo/kernel:C"); } } @@ -171,9 +171,9 @@ double ComputeRHEOKernel::calc_w(int i, int j, double delx, double dely, double } if (!corrections) w = calc_w_quintic(i,j,delx,dely,delz,r); - else if (kernel_style == CRK0) w = calc_w_crk0(i,j,delx,dely,delz,r); - else if (kernel_style == CRK1) w = calc_w_crk1(i,j,delx,dely,delz,r); - else if (kernel_style == CRK2) w = calc_w_crk2(i,j,delx,dely,delz,r); + else if (kernel_style == RK0) w = calc_w_rk0(i,j,delx,dely,delz,r); + else if (kernel_style == RK1) w = calc_w_rk1(i,j,delx,dely,delz,r); + else if (kernel_style == RK2) w = calc_w_rk2(i,j,delx,dely,delz,r); return w; } @@ -194,12 +194,12 @@ double ComputeRHEOKernel::calc_dw(int i, int j, double delx, double dely, double wp = calc_dw_quintic(i,j,delx,dely,delz,r,dWij,dWji); // Overwrite if there are corrections - if (kernel_style == CRK1) { - if (corrections_i) calc_dw_crk1(i,j,delx,dely,delz,r,dWij); - if (corrections_j) calc_dw_crk1(j,i,-delx,-dely,-delz,r,dWji); - } else if (kernel_style == CRK2) { - if (corrections_i) calc_dw_crk2(i,j,delx,dely,delz,r,dWij); - if (corrections_j) calc_dw_crk2(j,i,-delx,-dely,-delz,r,dWji); + if (kernel_style == RK1) { + if (corrections_i) calc_dw_rk1(i,j,delx,dely,delz,r,dWij); + if (corrections_j) calc_dw_rk1(j,i,-delx,-dely,-delz,r,dWji); + } else if (kernel_style == RK2) { + if (corrections_i) calc_dw_rk2(i,j,delx,dely,delz,r,dWij); + if (corrections_j) calc_dw_rk2(j,i,-delx,-dely,-delz,r,dWji); } return wp; @@ -285,7 +285,7 @@ double ComputeRHEOKernel::calc_dw_quintic(int i, int j, double delx, double dely /* ---------------------------------------------------------------------- */ -double ComputeRHEOKernel::calc_w_crk0(int i, int j, double delx, double dely, double delz, double r) +double ComputeRHEOKernel::calc_w_rk0(int i, int j, double delx, double dely, double delz, double r) { double w; @@ -299,7 +299,7 @@ double ComputeRHEOKernel::calc_w_crk0(int i, int j, double delx, double dely, do /* ---------------------------------------------------------------------- */ -double ComputeRHEOKernel::calc_w_crk1(int i, int j, double delx, double dely, double delz, double r) +double ComputeRHEOKernel::calc_w_rk1(int i, int j, double delx, double dely, double delz, double r) { int b; double w, wR, dx[3], H[Mdim]; @@ -341,7 +341,7 @@ double ComputeRHEOKernel::calc_w_crk1(int i, int j, double delx, double dely, do /* ---------------------------------------------------------------------- */ -double ComputeRHEOKernel::calc_w_crk2(int i, int j, double delx, double dely, double delz, double r) +double ComputeRHEOKernel::calc_w_rk2(int i, int j, double delx, double dely, double delz, double r) { int b; double w, wR, dx[3], H[Mdim]; @@ -391,7 +391,7 @@ double ComputeRHEOKernel::calc_w_crk2(int i, int j, double delx, double dely, do /* ---------------------------------------------------------------------- */ -void ComputeRHEOKernel::calc_dw_crk1(int i, int j, double delx, double dely, double delz, double r, double *dW) +void ComputeRHEOKernel::calc_dw_rk1(int i, int j, double delx, double dely, double delz, double r, double *dW) { int a, b; double w, dx[3], H[Mdim]; @@ -428,7 +428,7 @@ void ComputeRHEOKernel::calc_dw_crk1(int i, int j, double delx, double dely, dou /* ---------------------------------------------------------------------- */ -void ComputeRHEOKernel::calc_dw_crk2(int i, int j, double delx, double dely, double delz, double r, double *dW) +void ComputeRHEOKernel::calc_dw_rk2(int i, int j, double delx, double dely, double delz, double r, double *dW) { int a, b; double w, dx[3], H[Mdim]; @@ -504,7 +504,7 @@ void ComputeRHEOKernel::compute_peratom() // Grow arrays if necessary if (nmax_store < atom->nmax) grow_arrays(atom->nmax); - if (kernel_style == CRK0) { + if (kernel_style == RK0) { double M; for (ii = 0; ii < inum; ii++) { @@ -592,7 +592,7 @@ void ComputeRHEOKernel::compute_peratom() H[0] = 1.0; H[1] = dx[0] * hinv; H[2] = dx[1] * hinv; - if (kernel_style == CRK2) { + if (kernel_style == RK2) { H[3] = 0.5 * dx[0] * dx[0] * hsqinv; H[4] = 0.5 * dx[1] * dx[1] * hsqinv; H[5] = dx[0] * dx[1] * hsqinv; @@ -602,7 +602,7 @@ void ComputeRHEOKernel::compute_peratom() H[1] = dx[0] * hinv; H[2] = dx[1] * hinv; H[3] = dx[2] * hinv; - if (kernel_style == CRK2) { + if (kernel_style == RK2) { H[4] = 0.5 * dx[0] * dx[0] * hsqinv; H[5] = 0.5 * dx[1] * dx[1] * hsqinv; H[6] = 0.5 * dx[2] * dx[2] * hsqinv; @@ -676,7 +676,7 @@ void ComputeRHEOKernel::compute_peratom() // columns 1-2 (2D) or 1-3 (3D) //Second derivatives - if (kernel_style == CRK2) + if (kernel_style == RK2) C[i][1 + dim + b][a] = M[a * Mdim + b + 1 + dim] * hsqinv; // columns 3-4 (2D) or 4-6 (3D) } @@ -746,7 +746,7 @@ void ComputeRHEOKernel::grow_arrays(int nmax) { memory->grow(coordination, nmax, "rheo:coordination"); - if (kernel_style == CRK0) { + if (kernel_style == RK0) { memory->grow(C0, nmax, "rheo/kernel:C0"); } else if (correction_order > 0) { memory->grow(C, nmax, ncor, Mdim, "rheo/kernel:C"); @@ -768,7 +768,7 @@ int ComputeRHEOKernel::pack_forward_comm(int n, int *list, double *buf, if (comm_stage == 0) { buf[m++] = coordination[j]; } else { - if (kernel_style == CRK0) { + if (kernel_style == RK0) { buf[m++] = C0[j]; } else { for (a = 0; a < ncor; a++) @@ -792,7 +792,7 @@ void ComputeRHEOKernel::unpack_forward_comm(int n, int first, double *buf) if (comm_stage == 0) { coordination[i] = buf[m++]; } else { - if (kernel_style == CRK0) { + if (kernel_style == RK0) { C0[i] = buf[m++]; } else { for (a = 0; a < ncor; a++) @@ -810,7 +810,7 @@ double ComputeRHEOKernel::memory_usage() double bytes = 0.0; bytes = (size_t) nmax_store * sizeof(int); - if (kernel_style == CRK0) { + if (kernel_style == RK0) { bytes += (size_t) nmax_store * sizeof(double); } else if (correction_order > 0) { bytes += (size_t) nmax_store * ncor * Mdim * sizeof(double); diff --git a/src/RHEO/compute_rheo_kernel.h b/src/RHEO/compute_rheo_kernel.h index 5324199f76..2c9f4768e1 100644 --- a/src/RHEO/compute_rheo_kernel.h +++ b/src/RHEO/compute_rheo_kernel.h @@ -64,11 +64,11 @@ class ComputeRHEOKernel : public Compute { int check_corrections(int); - double calc_w_crk0(int,int,double,double,double,double); - double calc_w_crk1(int,int,double,double,double,double); - double calc_w_crk2(int,int,double,double,double,double); - void calc_dw_crk1(int,int,double,double,double,double,double *); - void calc_dw_crk2(int,int,double,double,double,double,double *); + double calc_w_rk0(int,int,double,double,double,double); + double calc_w_rk1(int,int,double,double,double,double); + double calc_w_rk2(int,int,double,double,double,double); + void calc_dw_rk1(int,int,double,double,double,double,double *); + void calc_dw_rk2(int,int,double,double,double,double,double *); }; } // namespace LAMMPS_NS diff --git a/src/RHEO/fix_rheo.cpp b/src/RHEO/fix_rheo.cpp index bacaae074d..04e6c08917 100644 --- a/src/RHEO/fix_rheo.cpp +++ b/src/RHEO/fix_rheo.cpp @@ -76,12 +76,12 @@ FixRHEO::FixRHEO(LAMMPS *lmp, int narg, char **arg) : cut = h; if (strcmp(arg[4],"quintic") == 0) { kernel_style = QUINTIC; - } else if (strcmp(arg[4],"CRK0") == 0) { - kernel_style = CRK0; - } else if (strcmp(arg[4],"CRK1") == 0) { - kernel_style = CRK1; - } else if (strcmp(arg[4],"CRK2") == 0) { - kernel_style = CRK2; + } else if (strcmp(arg[4],"RK0") == 0) { + kernel_style = RK0; + } else if (strcmp(arg[4],"RK1") == 0) { + kernel_style = RK1; + } else if (strcmp(arg[4],"RK2") == 0) { + kernel_style = RK2; } else error->all(FLERR,"Unknown kernel style {} in fix rheo", arg[4]); zmin_kernel = utils::numeric(FLERR,arg[5],false,lmp); diff --git a/src/RHEO/fix_rheo.h b/src/RHEO/fix_rheo.h index a74696e68c..743e418f9a 100644 --- a/src/RHEO/fix_rheo.h +++ b/src/RHEO/fix_rheo.h @@ -68,7 +68,7 @@ class FixRHEO : public Fix { namespace RHEO_NS { - enum {QUINTIC, CRK0, CRK1, CRK2}; + enum {QUINTIC, RK0, RK1, RK2}; enum {COORDINATION, DIVR}; // Status variables diff --git a/src/RHEO/pair_rheo.cpp b/src/RHEO/pair_rheo.cpp index b8b8e5a809..0d041b1e30 100644 --- a/src/RHEO/pair_rheo.cpp +++ b/src/RHEO/pair_rheo.cpp @@ -437,9 +437,9 @@ void PairRHEO::setup() error->all(FLERR,"Pair RHEO requires ghost atoms store velocity"); if (laplacian_order == -1) { - if (fix_rheo->kernel_style == CRK2) + if (fix_rheo->kernel_style == RK2) laplacian_order = 2; - else if (fix_rheo->kernel_style == CRK1) + else if (fix_rheo->kernel_style == RK1) laplacian_order = 1; else laplacian_order = 0; From dfc47a55010a896c99c661f3e13b525f52242eef Mon Sep 17 00:00:00 2001 From: jtclemm Date: Fri, 12 May 2023 23:33:02 -0600 Subject: [PATCH 037/158] Fixing various errors, reorganizing status variable --- .../rheo/poiseuille/in.rheo.poiseuille | 2 +- src/.gitignore | 2 + src/RHEO/compute_rheo_grad.cpp | 11 ++-- src/RHEO/compute_rheo_interface.cpp | 10 ++-- src/RHEO/compute_rheo_kernel.cpp | 4 +- src/RHEO/compute_rheo_property_atom.cpp | 8 +-- src/RHEO/compute_rheo_rho_sum.cpp | 1 - src/RHEO/compute_rheo_surface.cpp | 4 +- src/RHEO/compute_rheo_vshift.cpp | 15 ++++-- src/RHEO/fix_rheo.cpp | 34 ++++++------- src/RHEO/fix_rheo.h | 29 ++++++----- src/RHEO/fix_rheo_pressure.cpp | 37 ++------------ src/RHEO/fix_rheo_pressure.h | 3 -- src/RHEO/fix_rheo_thermal.cpp | 22 +++++--- src/RHEO/pair_rheo.cpp | 50 ++++++++++++------- src/RHEO/pair_rheo.h | 1 + 16 files changed, 113 insertions(+), 120 deletions(-) diff --git a/examples/PACKAGES/rheo/poiseuille/in.rheo.poiseuille b/examples/PACKAGES/rheo/poiseuille/in.rheo.poiseuille index af5728c1a3..d0f966c2ce 100644 --- a/examples/PACKAGES/rheo/poiseuille/in.rheo.poiseuille +++ b/examples/PACKAGES/rheo/poiseuille/in.rheo.poiseuille @@ -59,7 +59,7 @@ pair_coeff * * # ------ Fixes & computes ------ # -fix 1 all rheo ${cut} Quintic 0 shift +fix 1 all rheo ${cut} quintic 0 shift fix 2 all rheo/viscosity constant ${eta} fix 3 all rheo/pressure linear fix 4 rig setforce 0.0 0.0 0.0 diff --git a/src/.gitignore b/src/.gitignore index d0fcaf495c..f9794ddb82 100644 --- a/src/.gitignore +++ b/src/.gitignore @@ -205,6 +205,8 @@ /compute_rheo_interface.h /compute_rheo_kernel.cpp /compute_rheo_kernel.h +/compute_rheo_property_atom.cpp +/compute_rheo_property_atom.h /compute_rheo_rho_sum.cpp /compute_rheo_rho_sum.h /compute_rheo_surface.cpp diff --git a/src/RHEO/compute_rheo_grad.cpp b/src/RHEO/compute_rheo_grad.cpp index b71fb08d78..92ac108377 100644 --- a/src/RHEO/compute_rheo_grad.cpp +++ b/src/RHEO/compute_rheo_grad.cpp @@ -125,7 +125,7 @@ void ComputeRHEOGrad::init_list(int /*id*/, NeighList *ptr) void ComputeRHEOGrad::compute_peratom() { - int i, j, k, ii, jj, jnum, itype, jtype, a, b; + int i, j, k, ii, jj, jnum, itype, jtype, a, b, fluidi, fluidj; double xtmp, ytmp, ztmp, delx, dely, delz; double rsq, imass, jmass; double rhoi, rhoj, Voli, Volj, drho, dT, deta; @@ -183,6 +183,7 @@ void ComputeRHEOGrad::compute_peratom() vi[1] = v[i][1]; vi[2] = v[i][2]; itype = type[i]; + fluidi = !(status[i] & PHASECHECK); jlist = firstneigh[i]; jnum = numneigh[i]; @@ -197,6 +198,8 @@ void ComputeRHEOGrad::compute_peratom() rsq = delx * delx + dely * dely + delz * delz; if (rsq < cutsq) { + fluidj = !(status[j] & PHASECHECK); + rhoi = rho[i]; rhoj = rho[j]; @@ -206,13 +209,13 @@ void ComputeRHEOGrad::compute_peratom() // Add corrections for walls if (interface_flag) { - if ((status[i] & STATUS_FLUID) && !(status[j] & STATUS_FLUID)) { + if (fluidi && (!fluidj)) { compute_interface->correct_v(vi, vj, i, j); rhoj = compute_interface->correct_rho(j, i); - } else if (!(status[i] & STATUS_FLUID) && (status[j] & STATUS_FLUID)) { + } else if ((!fluidi) && fluidj) { compute_interface->correct_v(vj, vi, j, i); rhoi = compute_interface->correct_rho(i, j); - } else if (!(status[i] & STATUS_FLUID) && !(status[j] & STATUS_FLUID)) { + } else if ((!fluidi) && (!fluidj)) { rhoi = rho0; rhoj = rho0; } diff --git a/src/RHEO/compute_rheo_interface.cpp b/src/RHEO/compute_rheo_interface.cpp index a3624f9663..ea4916087f 100644 --- a/src/RHEO/compute_rheo_interface.cpp +++ b/src/RHEO/compute_rheo_interface.cpp @@ -131,7 +131,7 @@ void ComputeRHEOInterface::compute_peratom() } for (i = 0; i < nall; i++) { - if (!(status[i] & STATUS_FLUID)) rho[i] = 0.0; + if (status[i] & PHASECHECK) rho[i] = 0.0; normwf[i] = 0.0; norm[i] = 0.0; chi[i] = 0.0; @@ -143,7 +143,7 @@ void ComputeRHEOInterface::compute_peratom() ytmp = x[i][1]; ztmp = x[i][2]; itype = type[i]; - fluidi = status[i] & STATUS_FLUID; + fluidi = !(status[i] & PHASECHECK); jlist = firstneigh[i]; jnum = numneigh[i]; @@ -158,7 +158,7 @@ void ComputeRHEOInterface::compute_peratom() if (rsq < cutsq) { jtype = type[j]; - fluidj = status[j] & STATUS_FLUID; + fluidj = !(status[j] & PHASECHECK); w = compute_kernel->calc_w_quintic(i, j, delx, dely, delz, sqrt(rsq)); status_match = 0; @@ -202,7 +202,7 @@ void ComputeRHEOInterface::compute_peratom() if (norm[i] != 0.0) chi[i] /= norm[i]; // Recalculate rho for non-fluid particles - if (!(status[i] & STATUS_FLUID)) { + if (status[i] & PHASECHECK) { if (normwf[i] != 0.0) { // Stores rho for solid particles 1+Pw in Adami Adams 2012 rho[i] = MAX(EPSILON, rho0 + (rho[i] / normwf[i]) * csq_inv); @@ -289,7 +289,7 @@ void ComputeRHEOInterface::unpack_reverse_comm(int n, int *list, double *buf) j = list[i]; norm[j] += buf[m++]; chi[j] += buf[m++]; - if (!(status[j] & STATUS_FLUID)){ + if (status[j] & PHASECHECK){ normwf[j] += buf[m++]; rho[j] += buf[m++]; } else { diff --git a/src/RHEO/compute_rheo_kernel.cpp b/src/RHEO/compute_rheo_kernel.cpp index 09d807d50d..52380a4337 100644 --- a/src/RHEO/compute_rheo_kernel.cpp +++ b/src/RHEO/compute_rheo_kernel.cpp @@ -533,7 +533,7 @@ void ComputeRHEOKernel::compute_peratom() w = calc_w_quintic(i,j,dx[0],dx[1],dx[2],r); rhoj = rho[j]; if (interface_flag) - if (!(status[j] & STATUS_FLUID)) + if (status[j] & PHASECHECK) rhoj = compute_interface->correct_rho(j,i); vj = mass[type[j]] / rhoj; @@ -582,7 +582,7 @@ void ComputeRHEOKernel::compute_peratom() rhoj = rho[j]; if (interface_flag) - if (!(status[j] & STATUS_FLUID)) + if (status[j] & PHASECHECK) rhoj = compute_interface->correct_rho(j,i); vj = mass[type[j]] / rhoj; diff --git a/src/RHEO/compute_rheo_property_atom.cpp b/src/RHEO/compute_rheo_property_atom.cpp index 3cd5d468b2..880ae5d64f 100644 --- a/src/RHEO/compute_rheo_property_atom.cpp +++ b/src/RHEO/compute_rheo_property_atom.cpp @@ -212,10 +212,8 @@ void ComputeRHEOPropertyAtom::pack_phase(int n) int *mask = atom->mask; int nlocal = atom->nlocal; - int inverse_mask = ~PHASEMASK; - for (int i = 0; i < nlocal; i++) { - if (mask[i] & groupbit) buf[n] = (status[i] & inverse_mask); + if (mask[i] & groupbit) buf[n] = (status[i] & PHASECHECK); else buf[n] = 0.0; n += nvalues; } @@ -244,10 +242,8 @@ void ComputeRHEOPropertyAtom::pack_surface(int n) int *mask = atom->mask; int nlocal = atom->nlocal; - int inverse_mask = ~SURFACEMASK; - for (int i = 0; i < nlocal; i++) { - if (mask[i] & groupbit) buf[n] = (status[i] & inverse_mask); + if (mask[i] & groupbit) buf[n] = (status[i] & SURFACECHECK); else buf[n] = 0.0; n += nvalues; } diff --git a/src/RHEO/compute_rheo_rho_sum.cpp b/src/RHEO/compute_rheo_rho_sum.cpp index 726d876ea1..0a2096a2b9 100644 --- a/src/RHEO/compute_rheo_rho_sum.cpp +++ b/src/RHEO/compute_rheo_rho_sum.cpp @@ -74,7 +74,6 @@ void ComputeRHEORhoSum::compute_peratom() double **x = atom->x; double *rho = atom->rho; int *type = atom->type; - int *status = atom->status; double *mass = atom->mass; int newton = force->newton; diff --git a/src/RHEO/compute_rheo_surface.cpp b/src/RHEO/compute_rheo_surface.cpp index 180c430dd1..f6b93ee551 100644 --- a/src/RHEO/compute_rheo_surface.cpp +++ b/src/RHEO/compute_rheo_surface.cpp @@ -183,7 +183,7 @@ void ComputeRHEOSurface::compute_peratom() jlist = firstneigh[i]; jnum = numneigh[i]; itype = type[i]; - fluidi = status[i] & STATUS_FLUID; + fluidi = !(status[i] & PHASECHECK); for (jj = 0; jj < jnum; jj++) { j = jlist[jj]; @@ -196,7 +196,7 @@ void ComputeRHEOSurface::compute_peratom() rsq = lensq3(dx); if (rsq < cutsq) { jtype = type[j]; - fluidj = status[j] & STATUS_FLUID; + fluidj = !(status[j] & PHASECHECK); rhoi = rho[i]; rhoj = rho[j]; diff --git a/src/RHEO/compute_rheo_vshift.cpp b/src/RHEO/compute_rheo_vshift.cpp index 3d3914436e..0521ff16c0 100644 --- a/src/RHEO/compute_rheo_vshift.cpp +++ b/src/RHEO/compute_rheo_vshift.cpp @@ -91,7 +91,7 @@ void ComputeRHEOVShift::compute_peratom() double xtmp, ytmp, ztmp, rsq, r, rinv; double w, wp, dr, w0, w4, vmag, prefactor; double imass, jmass, voli, volj, rhoi, rhoj; - double dx[3], vi[3], vj[3] = {0}; + double dx[3], vi[3], vj[3]; int dim = domain->dimension; int *jlist; @@ -123,6 +123,11 @@ void ComputeRHEOVShift::compute_peratom() for (a = 0; a < dim; a++) vshift[i][a] = 0.0; + for (a = 0; a < 3; a++) { + vi[a] = 0.0; + vj[a] = 0.0; + } + for (ii = 0; ii < inum; ii++) { i = ilist[ii]; xtmp = x[i][0]; @@ -132,15 +137,15 @@ void ComputeRHEOVShift::compute_peratom() jlist = firstneigh[i]; jnum = numneigh[i]; imass = mass[itype]; - fluidi = status[i] & STATUS_FLUID; + fluidi = !(status[i] & PHASECHECK); for (jj = 0; jj < jnum; jj++) { j = jlist[jj]; j &= NEIGHMASK; - fluidj = status[j] & STATUS_FLUID; + fluidj = !(status[j] & PHASECHECK); if ((!fluidi) && (!fluidj)) continue; - if (!(status[i] & STATUS_SHIFT) && !(status[j] & STATUS_SHIFT)) continue; + if ((status[i] & STATUS_NO_SHIFT) && (status[j] & STATUS_NO_SHIFT)) continue; dx[0] = xtmp - x[j][0]; dx[1] = ytmp - x[j][1]; @@ -154,7 +159,7 @@ void ComputeRHEOVShift::compute_peratom() r = sqrt(rsq); rinv = 1 / r; - for (a = 0; a < dim; a ++) { + for (a = 0; a < dim; a++) { vi[a] = v[i][a]; vj[a] = v[j][a]; } diff --git a/src/RHEO/fix_rheo.cpp b/src/RHEO/fix_rheo.cpp index 04e6c08917..fd436cab6e 100644 --- a/src/RHEO/fix_rheo.cpp +++ b/src/RHEO/fix_rheo.cpp @@ -210,6 +210,8 @@ void FixRHEO::setup_pre_force(int /*vflag*/) // Calculate surfaces if (surface_flag) compute_surface->compute_peratom(); + + pre_force(0); } /* ---------------------------------------------------------------------- */ @@ -258,8 +260,6 @@ void FixRHEO::setup(int /*vflag*/) error->one(FLERR, "Fix rheo/viscosity does not fully cover all atoms"); if (!t_coverage_flag) error->one(FLERR, "Fix rheo/thermal does not fully cover all atoms"); - - pre_force(0); } /* ---------------------------------------------------------------------- */ @@ -283,7 +283,8 @@ void FixRHEO::initial_integrate(int /*vflag*/) double **gradr = compute_grad->gradr; double **gradv = compute_grad->gradv; double **vshift; - if (shift_flag) compute_vshift->vshift; + if (shift_flag) + vshift = compute_vshift->vshift; int nlocal = atom->nlocal; int rmass_flag = atom->rmass_flag; @@ -294,7 +295,7 @@ void FixRHEO::initial_integrate(int /*vflag*/) //Density Half-step for (i = 0; i < nlocal; i++) { - if (status[i] & STATUS_NO_FORCE) continue; + if (status[i] & STATUS_NO_INTEGRATION) continue; if (mask[i] & groupbit) { if (rmass_flag) { @@ -331,8 +332,8 @@ void FixRHEO::initial_integrate(int /*vflag*/) if (!rhosum_flag) { for (i = 0; i < nlocal; i++) { if (mask[i] & groupbit) { - if (status[i] & STATUS_NO_FORCE) continue; - if (!(status[i] & STATUS_FLUID)) continue; + if (status[i] & STATUS_NO_INTEGRATION) continue; + if (status[i] & PHASECHECK) continue; divu = 0; for (a = 0; a < dim; a++) { @@ -348,7 +349,7 @@ void FixRHEO::initial_integrate(int /*vflag*/) compute_vshift->correct_surfaces(); // Could this be moved to preforce after the surface fix runs? for (i = 0; i < nlocal; i++) { - if (!(status[i] & STATUS_SHIFT)) continue; + if (status[i] & STATUS_NO_SHIFT) continue; if (mask[i] & groupbit) { for (a = 0; a < dim; a++) { @@ -387,18 +388,13 @@ void FixRHEO::pre_force(int /*vflag*/) if (shift_flag) compute_vshift->compute_peratom(); - // Remove extra shifting/no force options + // Remove temporary options int *mask = atom->mask; int *status = atom->status; int nall = atom->nlocal + atom->nghost; - for (int i = 0; i < nall; i++) { - if (mask[i] & groupbit) { - status[i] &= ~STATUS_NO_FORCE; - - if (status[i] & STATUS_FLUID) - status[i] &= ~STATUS_SHIFT; - } - } + for (int i = 0; i < nall; i++) + if (mask[i] & groupbit) + status[i] &= OPTIONSMASK; // Calculate surfaces, update status if (surface_flag) compute_surface->compute_peratom(); @@ -433,7 +429,7 @@ void FixRHEO::final_integrate() // Update velocity for (i = 0; i < nlocal; i++) { if (mask[i] & groupbit) { - if (status[i] & STATUS_NO_FORCE) continue; + if (status[i] & STATUS_NO_INTEGRATION) continue; if (rmass_flag) { dtfm = dtf / rmass[i]; @@ -451,8 +447,8 @@ void FixRHEO::final_integrate() if (!rhosum_flag) { for (i = 0; i < nlocal; i++) { if (mask[i] & groupbit) { - if (status[i] & STATUS_NO_FORCE) continue; - if (!(status[i] & STATUS_FLUID)) continue; + if (status[i] & STATUS_NO_INTEGRATION) continue; + if (status[i] & PHASECHECK) continue; divu = 0; for (a = 0; a < dim; a++) { diff --git a/src/RHEO/fix_rheo.h b/src/RHEO/fix_rheo.h index 743e418f9a..0dbc8db78b 100644 --- a/src/RHEO/fix_rheo.h +++ b/src/RHEO/fix_rheo.h @@ -74,22 +74,27 @@ namespace RHEO_NS { // Status variables enum Status{ // Phase status - STATUS_FLUID = 1 << 0, - STATUS_SOLID = 1 << 1, - STATUS_REACTIVE = 1 << 2, - STATUS_FREEZING = 1 << 3, + STATUS_SOLID = 1 << 0, + STATUS_REACTIVE = 1 << 1, + // Surface status - STATUS_BULK = 1 << 4, - STATUS_LAYER = 1 << 5, - STATUS_SURFACE = 1 << 6, - STATUS_SPLASH = 1 << 7, + STATUS_BULK = 1 << 2, + STATUS_LAYER = 1 << 3, + STATUS_SURFACE = 1 << 4, + STATUS_SPLASH = 1 << 5, + // Temporary status options - reset in preforce - STATUS_SHIFT = 1 << 8, - STATUS_NO_FORCE = 1 << 9 + STATUS_NO_SHIFT = 1 << 6, + STATUS_NO_INTEGRATION = 1 << 7, + STATUS_FREEZING = 1 << 8 }; - #define PHASEMASK 0xFFFFFFF0; - #define SURFACEMASK 0xFFFFFF0F; + // Masks and their inverses + #define PHASEMASK 0xFFFFFFFC + #define PHASECHECK 0x00000003 + #define SURFACEMASK 0xFFFFFFC3 + #define SURFACECHECK 0x0000003C + #define OPTIONSMASK 0xFFFFFE3F } // namespace RHEO_NS } // namespace LAMMPS_NS diff --git a/src/RHEO/fix_rheo_pressure.cpp b/src/RHEO/fix_rheo_pressure.cpp index 63a6995646..ff206937f4 100644 --- a/src/RHEO/fix_rheo_pressure.cpp +++ b/src/RHEO/fix_rheo_pressure.cpp @@ -43,9 +43,7 @@ FixRHEOPressure::FixRHEOPressure(LAMMPS *lmp, int narg, char **arg) : if (narg < 4) error->all(FLERR,"Illegal fix command"); pressure_style = NONE; - comm_forward = 1; - nmax_store = 0; // Currently can only have one instance of fix rheo/pressure if (igroup != 0) @@ -73,10 +71,6 @@ FixRHEOPressure::FixRHEOPressure(LAMMPS *lmp, int narg, char **arg) : FixRHEOPressure::~FixRHEOPressure() { - // Remove custom property if it exists - int tmp1, tmp2, index; - index = atom->find_custom("rheo_pressure", tmp1, tmp2); - if (index != -1) atom->remove_custom(index, 1, 0); } /* ---------------------------------------------------------------------- */ @@ -110,20 +104,6 @@ void FixRHEOPressure::init() void FixRHEOPressure::setup_pre_force(int /*vflag*/) { fix_rheo->pressure_fix_defined = 1; - - // Create pressure array if it doesn't already exist - // Create a custom atom property so it works with compute property/atom - // Do not create grow callback as there's no reason to copy/exchange data - // Manually grow if nmax_store exceeded - - int tmp1, tmp2; - int index = atom->find_custom("rheo_pressure", tmp1, tmp2); - if (index == -1) { - index = atom->add_custom("rheo_pressure", 1, 0); - nmax_store = atom->nmax; - } - pressure = atom->dvector[index]; - pre_force(0); } @@ -138,14 +118,10 @@ void FixRHEOPressure::pre_force(int /*vflag*/) int *mask = atom->mask; double *rho = atom->rho; + double *pressure = atom->pressure; int nlocal = atom->nlocal; - if (nmax_store < atom->nmax) { - memory->grow(pressure, atom->nmax, "atom:rheo_pressure"); - nmax_store = atom->nmax; - } - for (i = 0; i < nlocal; i++) { if (mask[i] & groupbit) { if (pressure_style == LINEAR) { @@ -170,6 +146,7 @@ int FixRHEOPressure::pack_forward_comm(int n, int *list, double *buf, int /*pbc_flag*/, int * /*pbc*/) { int i,j,k,m; + double *pressure = atom->pressure; m = 0; for (i = 0; i < n; i++) { @@ -184,6 +161,7 @@ int FixRHEOPressure::pack_forward_comm(int n, int *list, double *buf, void FixRHEOPressure::unpack_forward_comm(int n, int first, double *buf) { int i, k, m, last; + double *pressure = atom->pressure; m = 0; last = first + n; @@ -210,12 +188,3 @@ double FixRHEOPressure::calc_pressure(double rho) } return rho; } - -/* ---------------------------------------------------------------------- */ - -double FixRHEOPressure::memory_usage() -{ - double bytes = 0.0; - bytes += (size_t) nmax_store * sizeof(double); - return bytes; -} diff --git a/src/RHEO/fix_rheo_pressure.h b/src/RHEO/fix_rheo_pressure.h index e8f7f3cb88..cbcb495244 100644 --- a/src/RHEO/fix_rheo_pressure.h +++ b/src/RHEO/fix_rheo_pressure.h @@ -34,14 +34,11 @@ class FixRHEOPressure : public Fix { void pre_force(int) override; int pack_forward_comm(int, int *, double *, int, int *) override; void unpack_forward_comm(int, int, double *) override; - double memory_usage() override; double calc_pressure(double); private: double c_cubic, csq, rho0, rho0inv; - double *pressure; int pressure_style; - int nmax_store; class FixRHEO *fix_rheo; }; diff --git a/src/RHEO/fix_rheo_thermal.cpp b/src/RHEO/fix_rheo_thermal.cpp index ec39a13311..de88b4f8d0 100644 --- a/src/RHEO/fix_rheo_thermal.cpp +++ b/src/RHEO/fix_rheo_thermal.cpp @@ -205,7 +205,7 @@ void FixRHEOThermal::initial_integrate(int /*vflag*/) nlocal = atom->nfirst; for (i = 0; i < nlocal; i++) { - if (!(status[i] & STATUS_SHIFT)) continue; + if (status[i] & STATUS_NO_SHIFT) continue; if (mask[i] & groupbit) { for (a = 0; a < dim; a++) { @@ -231,7 +231,7 @@ void FixRHEOThermal::post_integrate() //Integrate temperature and check status for (int i = 0; i < atom->nlocal; i++) { if (mask[i] & groupbit) { - if (status[i] & STATUS_NO_FORCE) continue; + if (status[i] & STATUS_NO_INTEGRATION) continue; cvi = calc_cv(i); temperature[i] += dtf * heatflow[i] / cvi; @@ -245,11 +245,17 @@ void FixRHEOThermal::post_integrate() } if (Ti > Tci) { - status[i] &= PHASEMASK; - status[i] |= STATUS_FLUID; - } else if (!(status[i] & STATUS_SOLID)) { - status[i] &= PHASEMASK; - status[i] |= STATUS_FREEZING; + // If solid, melt + if (status[i] & STATUS_SOLID) { + status[i] &= PHASEMASK; + } + } else { + // If fluid, freeze + if (!(status[i] & STATUS_SOLID)) { + status[i] &= PHASEMASK; + status[i] |= STATUS_SOLID; + status[i] |= STATUS_FREEZING; + } } } } @@ -300,7 +306,7 @@ void FixRHEOThermal::final_integrate() //Integrate temperature and check status for (int i = 0; i < atom->nlocal; i++) { if (mask[i] & groupbit) { - if (status[i] & STATUS_NO_FORCE) continue; + if (status[i] & STATUS_NO_INTEGRATION) continue; cvi = calc_cv(i); temperature[i] += dtf * heatflow[i] / cvi; diff --git a/src/RHEO/pair_rheo.cpp b/src/RHEO/pair_rheo.cpp index 0d041b1e30..0930f28f98 100644 --- a/src/RHEO/pair_rheo.cpp +++ b/src/RHEO/pair_rheo.cpp @@ -120,6 +120,16 @@ void PairRHEO::compute(int eflag, int vflag) numneigh = list->numneigh; firstneigh = list->firstneigh; + for (a = 0; a < 3; a++) { + vi[a] = 0.0; + vj[a] = 0.0; + du[a] = 0.0; + fv[a] = 0.0; + dfp[a] = 0.0; + fsolid[a] = 0.0; + ft[0] = 0.0; + } + // loop over neighbors of my atoms for (ii = 0; ii < inum; ii++) { @@ -132,7 +142,7 @@ void PairRHEO::compute(int eflag, int vflag) jnum = numneigh[i]; imass = mass[itype]; etai = viscosity[i]; - fluidi = status[i] & STATUS_FLUID; + fluidi = !(status[i] & PHASECHECK); if (thermal_flag) { kappai = conductivity[i]; Ti = temperature[i]; @@ -154,7 +164,7 @@ void PairRHEO::compute(int eflag, int vflag) jmass = mass[jtype]; etaj = viscosity[j]; - fluidj = status[j] & STATUS_FLUID; + fluidj = !(status[j] & PHASECHECK); if (thermal_flag) { Tj = temperature[j]; kappaj = conductivity[j]; @@ -186,25 +196,27 @@ void PairRHEO::compute(int eflag, int vflag) Pi = pressure[i]; Pj = pressure[j]; fmag = 0; - if (fluidi && (!fluidj)) { - compute_interface->correct_v(vi, vj, i, j); - rhoj = compute_interface->correct_rho(j, i); - Pj = fix_pressure->calc_pressure(rhoj); + if (interface_flag) { + if (fluidi && (!fluidj)) { + compute_interface->correct_v(vi, vj, i, j); + rhoj = compute_interface->correct_rho(j, i); + Pj = fix_pressure->calc_pressure(rhoj); - if ((chi[j] > 0.9) && (r < (h * 0.5))) - fmag = (chi[j] - 0.9) * (h * 0.5 - r) * rho0 * csq * h * rinv; + if ((chi[j] > 0.9) && (r < (h * 0.5))) + fmag = (chi[j] - 0.9) * (h * 0.5 - r) * rho0 * csq * h * rinv; - } else if ((!fluidi) && fluidj) { - compute_interface->correct_v(vj, vi, j, i); - rhoi = compute_interface->correct_rho(i, j); - Pi = fix_pressure->calc_pressure(rhoi); + } else if ((!fluidi) && fluidj) { + compute_interface->correct_v(vj, vi, j, i); + rhoi = compute_interface->correct_rho(i, j); + Pi = fix_pressure->calc_pressure(rhoi); - if (chi[i] > 0.9 && r < (h * 0.5)) - fmag = (chi[i] - 0.9) * (h * 0.5 - r) * rho0 * csq * h * rinv; + if (chi[i] > 0.9 && r < (h * 0.5)) + fmag = (chi[i] - 0.9) * (h * 0.5 - r) * rho0 * csq * h * rinv; - } else if ((!fluidi) && (!fluidj)) { - rhoi = rho0; - rhoj = rho0; + } else if ((!fluidi) && (!fluidj)) { + rhoi = rho0; + rhoj = rho0; + } } // Repel if close to inner solid particle @@ -234,7 +246,7 @@ void PairRHEO::compute(int eflag, int vflag) sub3(vi, vj, du); //Add artificial viscous pressure if required - if (artificial_visc_flag && pair_avisc_flag){ + if (artificial_visc_flag && pair_avisc_flag) { //Interpolate velocities to midpoint and use this difference for artificial viscosity for (a = 0; a < dim; a++) for (b = 0; b < dim; b++) @@ -328,6 +340,7 @@ void PairRHEO::compute(int eflag, int vflag) } } } + if (vflag_fdotr) virial_fdotr_compute(); } @@ -421,6 +434,7 @@ void PairRHEO::setup() compute_grad = fix_rheo->compute_grad; compute_interface = fix_rheo->compute_interface; thermal_flag = fix_rheo->thermal_flag; + interface_flag = fix_rheo->interface_flag; csq = fix_rheo->csq; rho0 = fix_rheo->rho0; diff --git a/src/RHEO/pair_rheo.h b/src/RHEO/pair_rheo.h index 49aa1ad025..b30b0c3c04 100644 --- a/src/RHEO/pair_rheo.h +++ b/src/RHEO/pair_rheo.h @@ -42,6 +42,7 @@ class PairRHEO : public Pair { int artificial_visc_flag; int rho_damp_flag; int thermal_flag; + int interface_flag; void allocate(); From 55f7e9271c2049a27909858d61a357ee42ddc484 Mon Sep 17 00:00:00 2001 From: jtclemm Date: Fri, 12 May 2023 23:34:26 -0600 Subject: [PATCH 038/158] removing old files --- src/compute_rheo_property_atom.cpp | 411 ----------------------------- src/compute_rheo_property_atom.h | 71 ----- 2 files changed, 482 deletions(-) delete mode 100644 src/compute_rheo_property_atom.cpp delete mode 100644 src/compute_rheo_property_atom.h diff --git a/src/compute_rheo_property_atom.cpp b/src/compute_rheo_property_atom.cpp deleted file mode 100644 index 3cd5d468b2..0000000000 --- a/src/compute_rheo_property_atom.cpp +++ /dev/null @@ -1,411 +0,0 @@ -// clang-format off -/* ---------------------------------------------------------------------- - 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 authors: - Joel Clemmer (SNL), Thomas O'Connor (CMU), Eric Palermo (CMU) ------------------------------------------------------------------------ */ - -#include "compute_rheo_property_atom.h" - -#include "atom.h" -#include "atom_vec.h" -#include "compute_rheo_interface.h" -#include "compute_rheo_kernel.h" -#include "compute_rheo_surface.h" -#include "compute_rheo_vshift.h" -#include "error.h" -#include "fix_rheo.h" -#include "fix_rheo_thermal.h" -#include "memory.h" -#include "modify.h" -#include "update.h" - -#include -#include - -using namespace LAMMPS_NS; -using namespace RHEO_NS; - -/* ---------------------------------------------------------------------- */ - -ComputeRHEOPropertyAtom::ComputeRHEOPropertyAtom(LAMMPS *lmp, int narg, char **arg) : - Compute(lmp, narg, arg), fix_rheo(nullptr), fix_thermal(nullptr), compute_interface(nullptr), - compute_kernel(nullptr), compute_surface(nullptr), compute_vshift(nullptr), - index(nullptr), pack_choice(nullptr) -{ - if (narg < 4) utils::missing_cmd_args(FLERR, "compute property/atom", error); - - peratom_flag = 1; - nvalues = narg - 3; - if (nvalues == 1) size_peratom_cols = 0; - else size_peratom_cols = nvalues; - - thermal_flag = interface_flag = surface_flag = shift_flag = 0; - - // parse input values - // customize a new keyword by adding to if statement - - pack_choice = new FnPtrPack[nvalues]; - index = new int[nvalues]; - - int i; - for (int iarg = 3; iarg < narg; iarg++) { - i = iarg-3; - - if (strcmp(arg[iarg],"phase") == 0) { - pack_choice[i] = &ComputeRHEOPropertyAtom::pack_phase; - } else if (strcmp(arg[iarg],"chi") == 0) { - interface_flag = 1; - pack_choice[i] = &ComputeRHEOPropertyAtom::pack_chi; - } else if (strcmp(arg[iarg],"surface") == 0) { - surface_flag = 1; - pack_choice[i] = &ComputeRHEOPropertyAtom::pack_surface; - } else if (strcmp(arg[iarg],"surface/r") == 0) { - surface_flag = 1; - pack_choice[i] = &ComputeRHEOPropertyAtom::pack_surface_r; - } else if (strcmp(arg[iarg],"surface/divr") == 0) { - surface_flag = 1; - pack_choice[i] = &ComputeRHEOPropertyAtom::pack_surface_divr; - } else if (strcmp(arg[iarg],"surface/nx") == 0) { - surface_flag = 1; - pack_choice[i] = &ComputeRHEOPropertyAtom::pack_surface_nx; - } else if (strcmp(arg[iarg],"surface/ny") == 0) { - surface_flag = 1; - pack_choice[i] = &ComputeRHEOPropertyAtom::pack_surface_ny; - } else if (strcmp(arg[iarg],"surface/nz") == 0) { - surface_flag = 1; - pack_choice[i] = &ComputeRHEOPropertyAtom::pack_surface_nz; - } else if (strcmp(arg[iarg],"coordination") == 0) { - pack_choice[i] = &ComputeRHEOPropertyAtom::pack_coordination; - } else if (strcmp(arg[iarg],"cv") == 0) { - thermal_flag = 1; - pack_choice[i] = &ComputeRHEOPropertyAtom::pack_cv; - } else if (strcmp(arg[iarg],"shift/vx") == 0) { - shift_flag = 1; - pack_choice[i] = &ComputeRHEOPropertyAtom::pack_shift_vx; - } else if (strcmp(arg[iarg],"shift/vy") == 0) { - shift_flag = 1; - pack_choice[i] = &ComputeRHEOPropertyAtom::pack_shift_vy; - } else if (strcmp(arg[iarg],"shift/vz") == 0) { - shift_flag = 1; - pack_choice[i] = &ComputeRHEOPropertyAtom::pack_shift_vz; - } else { - index[i] = atom->avec->property_atom(arg[iarg]); - if (index[i] < 0) - error->all(FLERR, - "Invalid keyword {} for atom style {} in compute rheo/property/atom command ", - atom->get_style(), arg[iarg]); - pack_choice[i] = &ComputeRHEOPropertyAtom::pack_atom_style; - - if (strcmp(arg[iarg],"temperature") == 0) thermal_flag = 1; - if (strcmp(arg[iarg],"heatflow") == 0) thermal_flag = 1; - if (strcmp(arg[iarg],"conductivity") == 0) thermal_flag = 1; - } - } - - nmax = 0; -} - -/* ---------------------------------------------------------------------- */ - -ComputeRHEOPropertyAtom::~ComputeRHEOPropertyAtom() -{ - delete[] pack_choice; - delete[] index; - memory->destroy(vector_atom); - memory->destroy(array_atom); -} - -/* ---------------------------------------------------------------------- */ - -void ComputeRHEOPropertyAtom::init() -{ - auto fixes = modify->get_fix_by_style("^rheo$"); - if (fixes.size() == 0) error->all(FLERR, "Need to define fix rheo to use fix rheo/viscosity"); - fix_rheo = dynamic_cast(fixes[0]); - - if (interface_flag && !(fix_rheo->interface_flag)) - error->all(FLERR, "Cannot request interfacial property without corresponding option in fix rheo"); - if (surface_flag && !(fix_rheo->surface_flag)) - error->all(FLERR, "Cannot request surface property without corresponding option in fix rheo"); - if (shift_flag && !(fix_rheo->shift_flag)) - error->all(FLERR, "Cannot request velocity shifting property without corresponding option in fix rheo"); - if (thermal_flag && !(fix_rheo->thermal_flag)) - error->all(FLERR, "Cannot request thermal property without fix rheo/thermal"); - - compute_interface = fix_rheo->compute_interface; - compute_kernel = fix_rheo->compute_kernel; - compute_surface = fix_rheo->compute_surface; - compute_vshift = fix_rheo->compute_vshift; - - if (thermal_flag) { - fixes = modify->get_fix_by_style("rheo/thermal"); - fix_thermal = dynamic_cast(fixes[0]); - } -} - -/* ---------------------------------------------------------------------- */ - -void ComputeRHEOPropertyAtom::compute_peratom() -{ - invoked_peratom = update->ntimestep; - - // grow vector or array if necessary - - if (atom->nmax > nmax) { - nmax = atom->nmax; - if (nvalues == 1) { - memory->destroy(vector_atom); - memory->create(vector_atom,nmax,"rheo/property/atom:vector"); - } else { - memory->destroy(array_atom); - memory->create(array_atom,nmax,nvalues,"rheo/property/atom:array"); - } - } - - // fill vector or array with per-atom values - - if (nvalues == 1) { - buf = vector_atom; - (this->*pack_choice[0])(0); - } else { - if (nmax) buf = &array_atom[0][0]; - else buf = nullptr; - for (int n = 0; n < nvalues; n++) - (this->*pack_choice[n])(n); - } -} - -/* ---------------------------------------------------------------------- - memory usage of local atom-based array -------------------------------------------------------------------------- */ - -double ComputeRHEOPropertyAtom::memory_usage() -{ - double bytes = (double)nmax * nvalues * sizeof(double); - return bytes; -} - -/* ---------------------------------------------------------------------- - one method for every keyword compute rheo/property/atom can output - the atom property is packed into buf starting at n with stride nvalues - customize a new keyword by adding a method -------------------------------------------------------------------------- */ - -/* ---------------------------------------------------------------------- */ - -void ComputeRHEOPropertyAtom::pack_phase(int n) -{ - int *status = atom->status; - int *mask = atom->mask; - int nlocal = atom->nlocal; - - int inverse_mask = ~PHASEMASK; - - for (int i = 0; i < nlocal; i++) { - if (mask[i] & groupbit) buf[n] = (status[i] & inverse_mask); - else buf[n] = 0.0; - n += nvalues; - } -} - -/* ---------------------------------------------------------------------- */ - -void ComputeRHEOPropertyAtom::pack_chi(int n) -{ - double *chi = compute_interface->chi; - int *mask = atom->mask; - int nlocal = atom->nlocal; - - for (int i = 0; i < nlocal; i++) { - if (mask[i] & groupbit) buf[n] = chi[i]; - else buf[n] = 0.0; - n += nvalues; - } -} - -/* ---------------------------------------------------------------------- */ - -void ComputeRHEOPropertyAtom::pack_surface(int n) -{ - int *status = atom->status; - int *mask = atom->mask; - int nlocal = atom->nlocal; - - int inverse_mask = ~SURFACEMASK; - - for (int i = 0; i < nlocal; i++) { - if (mask[i] & groupbit) buf[n] = (status[i] & inverse_mask); - else buf[n] = 0.0; - n += nvalues; - } -} - -/* ---------------------------------------------------------------------- */ - -void ComputeRHEOPropertyAtom::pack_surface_r(int n) -{ - double *rsurface = compute_surface->rsurface; - int *mask = atom->mask; - int nlocal = atom->nlocal; - - for (int i = 0; i < nlocal; i++) { - if (mask[i] & groupbit) buf[n] = rsurface[i]; - else buf[n] = 0.0; - n += nvalues; - } -} - -/* ---------------------------------------------------------------------- */ - -void ComputeRHEOPropertyAtom::pack_surface_divr(int n) -{ - double *divr = compute_surface->divr; - int *mask = atom->mask; - int nlocal = atom->nlocal; - - for (int i = 0; i < nlocal; i++) { - if (mask[i] & groupbit) buf[n] = divr[i]; - else buf[n] = 0.0; - n += nvalues; - } -} - -/* ---------------------------------------------------------------------- */ - -void ComputeRHEOPropertyAtom::pack_surface_nx(int n) -{ - double **nsurface = compute_surface->nsurface; - int *mask = atom->mask; - int nlocal = atom->nlocal; - - for (int i = 0; i < nlocal; i++) { - if (mask[i] & groupbit) buf[n] = nsurface[i][0]; - else buf[n] = 0.0; - n += nvalues; - } -} - -/* ---------------------------------------------------------------------- */ - -void ComputeRHEOPropertyAtom::pack_surface_ny(int n) -{ - double **nsurface = compute_surface->nsurface; - int *mask = atom->mask; - int nlocal = atom->nlocal; - - for (int i = 0; i < nlocal; i++) { - if (mask[i] & groupbit) buf[n] = nsurface[i][1]; - else buf[n] = 0.0; - n += nvalues; - } -} - - -/* ---------------------------------------------------------------------- */ - -void ComputeRHEOPropertyAtom::pack_surface_nz(int n) -{ - double **nsurface = compute_surface->nsurface; - int *mask = atom->mask; - int nlocal = atom->nlocal; - - for (int i = 0; i < nlocal; i++) { - if (mask[i] & groupbit) buf[n] = nsurface[i][2]; - else buf[n] = 0.0; - n += nvalues; - } -} - -/* ---------------------------------------------------------------------- */ - -void ComputeRHEOPropertyAtom::pack_coordination(int n) -{ - int *coordination = compute_kernel->coordination; - int *mask = atom->mask; - int nlocal = atom->nlocal; - - for (int i = 0; i < nlocal; i++) { - if (mask[i] & groupbit) buf[n] = coordination[i]; - else buf[n] = 0.0; - n += nvalues; - } -} - -/* ---------------------------------------------------------------------- */ - -void ComputeRHEOPropertyAtom::pack_cv(int n) -{ - int *mask = atom->mask; - int nlocal = atom->nlocal; - - for (int i = 0; i < nlocal; i++) { - if (mask[i] & groupbit) buf[n] = fix_thermal->calc_cv(i); - else buf[n] = 0.0; - n += nvalues; - } -} - -/* ---------------------------------------------------------------------- */ - -void ComputeRHEOPropertyAtom::pack_shift_vx(int n) -{ - double **vshift = compute_vshift->vshift; - int *mask = atom->mask; - int nlocal = atom->nlocal; - - for (int i = 0; i < nlocal; i++) { - if (mask[i] & groupbit) buf[n] = vshift[i][0]; - else buf[n] = 0.0; - n += nvalues; - } -} - -/* ---------------------------------------------------------------------- */ - -void ComputeRHEOPropertyAtom::pack_shift_vy(int n) -{ - double **vshift = compute_vshift->vshift; - int *mask = atom->mask; - int nlocal = atom->nlocal; - - for (int i = 0; i < nlocal; i++) { - if (mask[i] & groupbit) buf[n] = vshift[i][1]; - else buf[n] = 0.0; - n += nvalues; - } -} - -/* ---------------------------------------------------------------------- */ - -void ComputeRHEOPropertyAtom::pack_shift_vz(int n) -{ - double **vshift = compute_vshift->vshift; - int *mask = atom->mask; - int nlocal = atom->nlocal; - - for (int i = 0; i < nlocal; i++) { - if (mask[i] & groupbit) buf[n] = vshift[i][2]; - else buf[n] = 0.0; - n += nvalues; - } -} - -/* ---------------------------------------------------------------------- */ - -void ComputeRHEOPropertyAtom::pack_atom_style(int n) -{ - atom->avec->pack_property_atom(index[n],&buf[n],nvalues,groupbit); -} diff --git a/src/compute_rheo_property_atom.h b/src/compute_rheo_property_atom.h deleted file mode 100644 index accb7e9156..0000000000 --- a/src/compute_rheo_property_atom.h +++ /dev/null @@ -1,71 +0,0 @@ -/* -*- 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 COMPUTE_CLASS -// clang-format off -ComputeStyle(rheo/property/atom,ComputeRHEOPropertyAtom); -// clang-format on -#else - -#ifndef LMP_COMPUTE_RHEO_PROPERTY_ATOM_H -#define LMP_COMPUTE_RHEO_PROPERTY_ATOM_H - -#include "compute.h" - -namespace LAMMPS_NS { - -class ComputeRHEOPropertyAtom : public Compute { - public: - ComputeRHEOPropertyAtom(class LAMMPS *, int, char **); - ~ComputeRHEOPropertyAtom() override; - void init() override; - void compute_peratom() override; - double memory_usage() override; - - private: - int nvalues, nmax; - int thermal_flag, interface_flag, surface_flag, shift_flag; - int *index; - double *buf; - - typedef void (ComputeRHEOPropertyAtom::*FnPtrPack)(int); - FnPtrPack *pack_choice; // ptrs to pack functions - - void pack_phase(int); - void pack_chi(int); - void pack_surface(int); - void pack_surface_r(int); - void pack_surface_divr(int); - void pack_surface_nx(int); - void pack_surface_ny(int); - void pack_surface_nz(int); - void pack_coordination(int); - void pack_cv(int); - void pack_shift_vx(int); - void pack_shift_vy(int); - void pack_shift_vz(int); - void pack_atom_style(int); - - class FixRHEO *fix_rheo; - class FixRHEOThermal *fix_thermal; - class ComputeRHEOInterface *compute_interface; - class ComputeRHEOKernel *compute_kernel; - class ComputeRHEOSurface *compute_surface; - class ComputeRHEOVShift *compute_vshift; - -}; - -} // namespace LAMMPS_NS - -#endif -#endif From b4e1effe5f6e11b1d8d758991cf92ad52e522a2d Mon Sep 17 00:00:00 2001 From: jtclemm Date: Fri, 19 May 2023 13:10:39 -0600 Subject: [PATCH 039/158] Improving options for outputting gradients --- src/RHEO/compute_rheo_grad.cpp | 6 +- src/RHEO/compute_rheo_property_atom.cpp | 171 +++++++++++++----------- src/RHEO/compute_rheo_property_atom.h | 17 ++- src/RHEO/pair_rheo.cpp | 4 + 4 files changed, 112 insertions(+), 86 deletions(-) diff --git a/src/RHEO/compute_rheo_grad.cpp b/src/RHEO/compute_rheo_grad.cpp index 92ac108377..d71e7a24ac 100644 --- a/src/RHEO/compute_rheo_grad.cpp +++ b/src/RHEO/compute_rheo_grad.cpp @@ -224,9 +224,9 @@ void ComputeRHEOGrad::compute_peratom() Voli = mass[itype] / rhoi; Volj = mass[jtype] / rhoj; - vij[0] = v[i][0] - v[j][0]; - vij[1] = v[i][1] - v[j][1]; - vij[2] = v[i][2] - v[j][2]; + vij[0] = vi[0] - vj[0]; + vij[1] = vi[1] - vj[1]; + vij[2] = vi[2] - vj[2]; if (rho_flag) drho = rhoi - rhoj; if (temperature_flag) dT = temperature[i] - temperature[j]; diff --git a/src/RHEO/compute_rheo_property_atom.cpp b/src/RHEO/compute_rheo_property_atom.cpp index 880ae5d64f..3afeb03e43 100644 --- a/src/RHEO/compute_rheo_property_atom.cpp +++ b/src/RHEO/compute_rheo_property_atom.cpp @@ -25,12 +25,15 @@ #include "compute_rheo_kernel.h" #include "compute_rheo_surface.h" #include "compute_rheo_vshift.h" +#include "compute_rheo_grad.h" +#include "domain.h" #include "error.h" #include "fix_rheo.h" #include "fix_rheo_thermal.h" #include "memory.h" #include "modify.h" #include "update.h" +#include "utils.h" #include #include @@ -42,8 +45,8 @@ using namespace RHEO_NS; ComputeRHEOPropertyAtom::ComputeRHEOPropertyAtom(LAMMPS *lmp, int narg, char **arg) : Compute(lmp, narg, arg), fix_rheo(nullptr), fix_thermal(nullptr), compute_interface(nullptr), - compute_kernel(nullptr), compute_surface(nullptr), compute_vshift(nullptr), - index(nullptr), pack_choice(nullptr) + compute_kernel(nullptr), compute_surface(nullptr), compute_vshift(nullptr), compute_grad(nullptr), + avec_index(nullptr), pack_choice(nullptr), col_index(nullptr) { if (narg < 4) utils::missing_cmd_args(FLERR, "compute property/atom", error); @@ -58,7 +61,8 @@ ComputeRHEOPropertyAtom::ComputeRHEOPropertyAtom(LAMMPS *lmp, int narg, char **a // customize a new keyword by adding to if statement pack_choice = new FnPtrPack[nvalues]; - index = new int[nvalues]; + avec_index = new int[nvalues]; + col_index = new int[nvalues]; int i; for (int iarg = 3; iarg < narg; iarg++) { @@ -78,32 +82,25 @@ ComputeRHEOPropertyAtom::ComputeRHEOPropertyAtom(LAMMPS *lmp, int narg, char **a } else if (strcmp(arg[iarg],"surface/divr") == 0) { surface_flag = 1; pack_choice[i] = &ComputeRHEOPropertyAtom::pack_surface_divr; - } else if (strcmp(arg[iarg],"surface/nx") == 0) { + } else if (strcmp(arg[iarg],"^surface/n") == 0) { surface_flag = 1; - pack_choice[i] = &ComputeRHEOPropertyAtom::pack_surface_nx; - } else if (strcmp(arg[iarg],"surface/ny") == 0) { - surface_flag = 1; - pack_choice[i] = &ComputeRHEOPropertyAtom::pack_surface_ny; - } else if (strcmp(arg[iarg],"surface/nz") == 0) { - surface_flag = 1; - pack_choice[i] = &ComputeRHEOPropertyAtom::pack_surface_nz; + pack_choice[i] = &ComputeRHEOPropertyAtom::pack_surface_n; + col_index[i] = get_vector_index(arg[iarg]); } else if (strcmp(arg[iarg],"coordination") == 0) { pack_choice[i] = &ComputeRHEOPropertyAtom::pack_coordination; } else if (strcmp(arg[iarg],"cv") == 0) { thermal_flag = 1; pack_choice[i] = &ComputeRHEOPropertyAtom::pack_cv; - } else if (strcmp(arg[iarg],"shift/vx") == 0) { + } else if (strcmp(arg[iarg],"^shift/v") == 0) { shift_flag = 1; - pack_choice[i] = &ComputeRHEOPropertyAtom::pack_shift_vx; - } else if (strcmp(arg[iarg],"shift/vy") == 0) { - shift_flag = 1; - pack_choice[i] = &ComputeRHEOPropertyAtom::pack_shift_vy; - } else if (strcmp(arg[iarg],"shift/vz") == 0) { - shift_flag = 1; - pack_choice[i] = &ComputeRHEOPropertyAtom::pack_shift_vz; + pack_choice[i] = &ComputeRHEOPropertyAtom::pack_shift_v; + col_index[i] = get_vector_index(arg[iarg]); + } else if (utils::strmatch(arg[iarg],"^gradv")) { + pack_choice[i] = &ComputeRHEOPropertyAtom::pack_gradv; + col_index[i] = get_tensor_index(arg[iarg]); } else { - index[i] = atom->avec->property_atom(arg[iarg]); - if (index[i] < 0) + avec_index[i] = atom->avec->property_atom(arg[iarg]); + if (avec_index[i] < 0) error->all(FLERR, "Invalid keyword {} for atom style {} in compute rheo/property/atom command ", atom->get_style(), arg[iarg]); @@ -123,7 +120,8 @@ ComputeRHEOPropertyAtom::ComputeRHEOPropertyAtom(LAMMPS *lmp, int narg, char **a ComputeRHEOPropertyAtom::~ComputeRHEOPropertyAtom() { delete[] pack_choice; - delete[] index; + delete[] avec_index; + delete[] col_index; memory->destroy(vector_atom); memory->destroy(array_atom); } @@ -149,6 +147,7 @@ void ComputeRHEOPropertyAtom::init() compute_kernel = fix_rheo->compute_kernel; compute_surface = fix_rheo->compute_surface; compute_vshift = fix_rheo->compute_vshift; + compute_grad = fix_rheo->compute_grad; if (thermal_flag) { fixes = modify->get_fix_by_style("rheo/thermal"); @@ -281,45 +280,15 @@ void ComputeRHEOPropertyAtom::pack_surface_divr(int n) /* ---------------------------------------------------------------------- */ -void ComputeRHEOPropertyAtom::pack_surface_nx(int n) +void ComputeRHEOPropertyAtom::pack_surface_n(int n) { double **nsurface = compute_surface->nsurface; int *mask = atom->mask; int nlocal = atom->nlocal; + int index = col_index[n]; for (int i = 0; i < nlocal; i++) { - if (mask[i] & groupbit) buf[n] = nsurface[i][0]; - else buf[n] = 0.0; - n += nvalues; - } -} - -/* ---------------------------------------------------------------------- */ - -void ComputeRHEOPropertyAtom::pack_surface_ny(int n) -{ - double **nsurface = compute_surface->nsurface; - int *mask = atom->mask; - int nlocal = atom->nlocal; - - for (int i = 0; i < nlocal; i++) { - if (mask[i] & groupbit) buf[n] = nsurface[i][1]; - else buf[n] = 0.0; - n += nvalues; - } -} - - -/* ---------------------------------------------------------------------- */ - -void ComputeRHEOPropertyAtom::pack_surface_nz(int n) -{ - double **nsurface = compute_surface->nsurface; - int *mask = atom->mask; - int nlocal = atom->nlocal; - - for (int i = 0; i < nlocal; i++) { - if (mask[i] & groupbit) buf[n] = nsurface[i][2]; + if (mask[i] & groupbit) buf[n] = nsurface[i][index]; else buf[n] = 0.0; n += nvalues; } @@ -356,14 +325,15 @@ void ComputeRHEOPropertyAtom::pack_cv(int n) /* ---------------------------------------------------------------------- */ -void ComputeRHEOPropertyAtom::pack_shift_vx(int n) +void ComputeRHEOPropertyAtom::pack_shift_v(int n) { double **vshift = compute_vshift->vshift; int *mask = atom->mask; int nlocal = atom->nlocal; + int index = col_index[n]; for (int i = 0; i < nlocal; i++) { - if (mask[i] & groupbit) buf[n] = vshift[i][0]; + if (mask[i] & groupbit) buf[n] = vshift[i][index]; else buf[n] = 0.0; n += nvalues; } @@ -371,29 +341,15 @@ void ComputeRHEOPropertyAtom::pack_shift_vx(int n) /* ---------------------------------------------------------------------- */ -void ComputeRHEOPropertyAtom::pack_shift_vy(int n) +void ComputeRHEOPropertyAtom::pack_gradv(int n) { - double **vshift = compute_vshift->vshift; + double **gradv = compute_grad->gradv; int *mask = atom->mask; int nlocal = atom->nlocal; + int index = col_index[n]; for (int i = 0; i < nlocal; i++) { - if (mask[i] & groupbit) buf[n] = vshift[i][1]; - else buf[n] = 0.0; - n += nvalues; - } -} - -/* ---------------------------------------------------------------------- */ - -void ComputeRHEOPropertyAtom::pack_shift_vz(int n) -{ - double **vshift = compute_vshift->vshift; - int *mask = atom->mask; - int nlocal = atom->nlocal; - - for (int i = 0; i < nlocal; i++) { - if (mask[i] & groupbit) buf[n] = vshift[i][2]; + if (mask[i] & groupbit) buf[n] = gradv[i][index]; else buf[n] = 0.0; n += nvalues; } @@ -403,5 +359,68 @@ void ComputeRHEOPropertyAtom::pack_shift_vz(int n) void ComputeRHEOPropertyAtom::pack_atom_style(int n) { - atom->avec->pack_property_atom(index[n],&buf[n],nvalues,groupbit); + atom->avec->pack_property_atom(avec_index[n],&buf[n],nvalues,groupbit); +} + +/* ---------------------------------------------------------------------- */ + +int ComputeRHEOPropertyAtom::get_tensor_index(char* option) +{ + int index; + int dim = domain->dimension; + int dim_error = 0; + + if (utils::strmatch(option,"xx$")) { + index = 0; + } else if (utils::strmatch(option,"xy$")) { + index = 1; + } else if (utils::strmatch(option,"xz$")) { + index = 2; + if (dim == 2) dim_error = 1; + } else if (utils::strmatch(option,"yx$")) { + if (dim == 2) index = 2; + else index = 3; + } else if (utils::strmatch(option,"yy$")) { + if (dim == 2) index = 3; + else index = 4; + } else if (utils::strmatch(option,"yz$")) { + index = 5; + if (dim == 2) dim_error = 1; + } else if (utils::strmatch(option,"zx$")) { + index = 6; + if (dim == 2) dim_error = 1; + } else if (utils::strmatch(option,"zy$")) { + index = 7; + if (dim == 2) dim_error = 1; + } else if (utils::strmatch(option,"zz$")) { + index = 8; + if (dim == 2) dim_error = 1; + } else { + error->all(FLERR, "Invalid compute rheo/property/atom property {}", option); + } + + if (dim_error) + error->all(FLERR, "Invalid compute rheo/property/atom property {} in 2D", option); + + return index; +} + +/* ---------------------------------------------------------------------- */ + +int ComputeRHEOPropertyAtom::get_vector_index(char* option) +{ + int index; + if (utils::strmatch(option,"x$")) { + index = 0; + } else if (utils::strmatch(option,"y$")) { + index = 1; + } else if (utils::strmatch(option,"z$")) { + if (domain->dimension == 2) + error->all(FLERR, "Invalid compute rheo/property/atom property {} in 2D", option); + index = 2; + } else { + error->all(FLERR, "Invalid compute rheo/property/atom property {}", option); + } + + return index; } diff --git a/src/RHEO/compute_rheo_property_atom.h b/src/RHEO/compute_rheo_property_atom.h index accb7e9156..344e249d11 100644 --- a/src/RHEO/compute_rheo_property_atom.h +++ b/src/RHEO/compute_rheo_property_atom.h @@ -35,7 +35,8 @@ class ComputeRHEOPropertyAtom : public Compute { private: int nvalues, nmax; int thermal_flag, interface_flag, surface_flag, shift_flag; - int *index; + int *avec_index; + int *col_index; double *buf; typedef void (ComputeRHEOPropertyAtom::*FnPtrPack)(int); @@ -46,22 +47,23 @@ class ComputeRHEOPropertyAtom : public Compute { void pack_surface(int); void pack_surface_r(int); void pack_surface_divr(int); - void pack_surface_nx(int); - void pack_surface_ny(int); - void pack_surface_nz(int); + void pack_surface_n(int); void pack_coordination(int); void pack_cv(int); - void pack_shift_vx(int); - void pack_shift_vy(int); - void pack_shift_vz(int); + void pack_shift_v(int); + void pack_gradv(int); void pack_atom_style(int); + int get_vector_index(char*); + int get_tensor_index(char*); + class FixRHEO *fix_rheo; class FixRHEOThermal *fix_thermal; class ComputeRHEOInterface *compute_interface; class ComputeRHEOKernel *compute_kernel; class ComputeRHEOSurface *compute_surface; class ComputeRHEOVShift *compute_vshift; + class ComputeRHEOGrad *compute_grad; }; @@ -69,3 +71,4 @@ class ComputeRHEOPropertyAtom : public Compute { #endif #endif + diff --git a/src/RHEO/pair_rheo.cpp b/src/RHEO/pair_rheo.cpp index 0930f28f98..8b0e2c2df6 100644 --- a/src/RHEO/pair_rheo.cpp +++ b/src/RHEO/pair_rheo.cpp @@ -257,6 +257,10 @@ void PairRHEO::compute(int eflag, int vflag) mu = MIN(0.0, mu); q = av * (-2.0 * cs * mu + mu * mu); fp_prefactor += voli * volj * q * (rhoj + rhoi); + + if (fabs(fp_prefactor*dWij[0]) > 1e-9) + if (atom->tag[i] == 643 or atom->tag[j] == 643 or atom->tag[i] == 963 or atom->tag[j] == 963) + printf("%d-%d (%d %d) fp_prefactor %g %g %g\n", atom->tag[i], atom->tag[j], i, j, fp_prefactor, dWij[0], -fp_prefactor*dWij[0]); } // -Grad[P + Q] From 6f59b7c5e081e2750dafed7530dad62a09e99fdc Mon Sep 17 00:00:00 2001 From: jtclemm Date: Tue, 23 May 2023 22:12:34 -0600 Subject: [PATCH 040/158] Fixing misc bugs with interfaces --- doc/src/fix_rheo.rst | 2 +- src/RHEO/compute_rheo_grad.cpp | 7 ++-- src/RHEO/compute_rheo_interface.cpp | 16 ++++---- src/RHEO/fix_rheo.cpp | 8 +++- src/RHEO/fix_rheo_pressure.cpp | 19 ++-------- src/RHEO/pair_rheo.cpp | 58 +++++++++++++++++++++++++---- src/RHEO/pair_rheo.h | 2 + 7 files changed, 77 insertions(+), 35 deletions(-) diff --git a/doc/src/fix_rheo.rst b/doc/src/fix_rheo.rst index 7aaab48f54..5eae617419 100644 --- a/doc/src/fix_rheo.rst +++ b/doc/src/fix_rheo.rst @@ -23,7 +23,7 @@ Syntax *surface/detection* values = *sdstyle* *limit* *sdstyle* = *coordination* or *divergence* *limit* = threshold for surface particles (unitless) - *interface/reconstruction* values = none, reconstructs interfaces with solid particles + *interface/reconstruct* values = none, reconstructs interfaces with solid particles *rho/sum* values = none, uses the kernel to compute the density of particles *density* values = *rho0* (density) *sound/squared* values = *csq* (velocity\^2) diff --git a/src/RHEO/compute_rheo_grad.cpp b/src/RHEO/compute_rheo_grad.cpp index d71e7a24ac..7d0b1d5b14 100644 --- a/src/RHEO/compute_rheo_grad.cpp +++ b/src/RHEO/compute_rheo_grad.cpp @@ -179,9 +179,6 @@ void ComputeRHEOGrad::compute_peratom() xtmp = x[i][0]; ytmp = x[i][1]; ztmp = x[i][2]; - vi[0] = v[i][0]; - vi[1] = v[i][1]; - vi[2] = v[i][2]; itype = type[i]; fluidi = !(status[i] & PHASECHECK); jlist = firstneigh[i]; @@ -203,6 +200,10 @@ void ComputeRHEOGrad::compute_peratom() rhoi = rho[i]; rhoj = rho[j]; + vi[0] = v[i][0]; + vi[1] = v[i][1]; + vi[2] = v[i][2]; + vj[0] = v[j][0]; vj[1] = v[j][1]; vj[2] = v[j][2]; diff --git a/src/RHEO/compute_rheo_interface.cpp b/src/RHEO/compute_rheo_interface.cpp index ea4916087f..8cd69b49e3 100644 --- a/src/RHEO/compute_rheo_interface.cpp +++ b/src/RHEO/compute_rheo_interface.cpp @@ -170,9 +170,10 @@ void ComputeRHEOInterface::compute_peratom() chi[i] += w; } else { if (!fluidi) { - dot = (-fp_store[0][j] + fp_store[0][i]) * delx; - dot += (-fp_store[1][j] + fp_store[1][i]) * dely; - dot += (-fp_store[2][j] + fp_store[2][i]) * delz; + dot = (-fp_store[j][0] + fp_store[i][0]) * delx; + dot += (-fp_store[j][1] + fp_store[i][1]) * dely; + dot += (-fp_store[j][2] + fp_store[i][2]) * delz; + rho[i] += w * (csq * (rho[j] - rho0) - rho[j] * dot); normwf[i] += w; } @@ -184,9 +185,10 @@ void ComputeRHEOInterface::compute_peratom() chi[j] += w; } else { if (!fluidj) { - dot = (-fp_store[0][i] + fp_store[0][j]) * delx; - dot += (-fp_store[1][i] + fp_store[1][j]) * dely; - dot += (-fp_store[2][i] + fp_store[2][j]) * delz; + dot = (-fp_store[i][0] + fp_store[j][0]) * delx; + dot += (-fp_store[i][1] + fp_store[j][1]) * dely; + dot += (-fp_store[i][2] + fp_store[j][2]) * delz; + rho[j] += w * (csq * (rho[i] - rho0) + rho[i] * dot); normwf[j] += w; } @@ -342,7 +344,7 @@ void ComputeRHEOInterface::store_forces() // If forces are overwritten by a fix, there are no pressure forces // so just normalize auto fixlist = modify->get_fix_by_style("setforce"); - if (fixlist.size() == 0) { + if (fixlist.size() != 0) { for (const auto &fix : fixlist) { for (int i = 0; i < atom->nlocal; i++) { minv = 1.0 / mass[type[i]]; diff --git a/src/RHEO/fix_rheo.cpp b/src/RHEO/fix_rheo.cpp index fd436cab6e..cecd3183fd 100644 --- a/src/RHEO/fix_rheo.cpp +++ b/src/RHEO/fix_rheo.cpp @@ -105,7 +105,7 @@ FixRHEO::FixRHEO(LAMMPS *lmp, int narg, char **arg) : } iarg += 2; - } else if (strcmp(arg[iarg],"interface/reconstruction") == 0) { + } else if (strcmp(arg[iarg],"interface/reconstruct") == 0) { interface_flag = 1; } else if (strcmp(arg[iarg],"rho/sum") == 0) { rhosum_flag = 1; @@ -360,6 +360,7 @@ void FixRHEO::initial_integrate(int /*vflag*/) } if (!rhosum_flag) { + if (status[i] & PHASECHECK) continue; for (a = 0; a < dim; a++) { rho[i] += dtv * vshift[i][a] * gradr[i][a]; } @@ -380,7 +381,10 @@ void FixRHEO::pre_force(int /*vflag*/) compute_grad->forward_fields(); // also forwards v and rho for chi compute_kernel->compute_peratom(); - if (interface_flag) compute_interface->compute_peratom(); + if (interface_flag) { + // Note on first setup, have no forces for pressure to reference + compute_interface->compute_peratom(); + } compute_grad->compute_peratom(); compute_grad->forward_gradients(); diff --git a/src/RHEO/fix_rheo_pressure.cpp b/src/RHEO/fix_rheo_pressure.cpp index ff206937f4..84d21ee872 100644 --- a/src/RHEO/fix_rheo_pressure.cpp +++ b/src/RHEO/fix_rheo_pressure.cpp @@ -122,20 +122,9 @@ void FixRHEOPressure::pre_force(int /*vflag*/) int nlocal = atom->nlocal; - for (i = 0; i < nlocal; i++) { - if (mask[i] & groupbit) { - if (pressure_style == LINEAR) { - pressure[i] = csq * (rho[i] - rho0); - } else if (pressure_style == CUBIC) { - dr = rho[i] - rho0; - pressure[i] = csq * (dr + c_cubic * dr * dr * dr); - } else if (pressure_style == TAITWATER) { - rho_ratio = rho[i] / rho0inv; - rr3 = rho_ratio * rho_ratio * rho_ratio; - pressure[i] = csq * rho0 * SEVENTH * (rr3 * rr3 * rho_ratio - 1.0); - } - } - } + for (i = 0; i < nlocal; i++) + if (mask[i] & groupbit) + pressure[i] = calc_pressure(rho[i]); if (comm_forward) comm->forward_comm(this); } @@ -186,5 +175,5 @@ double FixRHEOPressure::calc_pressure(double rho) rr3 = rho_ratio * rho_ratio * rho_ratio; p = csq * rho0 * SEVENTH * (rr3 * rr3 * rho_ratio - 1.0); } - return rho; + return p; } diff --git a/src/RHEO/pair_rheo.cpp b/src/RHEO/pair_rheo.cpp index 8b0e2c2df6..0feb6af445 100644 --- a/src/RHEO/pair_rheo.cpp +++ b/src/RHEO/pair_rheo.cpp @@ -56,6 +56,8 @@ PairRHEO::PairRHEO(LAMMPS *lmp) : artificial_visc_flag = 0; rho_damp_flag = 0; thermal_flag = 0; + + comm_reverse = 3; } /* ---------------------------------------------------------------------- */ @@ -79,7 +81,7 @@ void PairRHEO::compute(int eflag, int vflag) double rhoi, rhoj, voli, volj, Pi, Pj, etai, etaj, kappai, kappaj; double mu, q, fp_prefactor, drho_damp, fmag, psi_ij, Fij; double *dWij, *dWji, *dW1ij, *dW1ji; - double dx[3], du[3], fv[3], dfp[3], fsolid[3], ft[3], vi[3], vj[3]; + double dx[3], du[3], dv[3], fv[3], dfp[3], fsolid[3], ft[3], vi[3], vj[3]; int *ilist, *jlist, *numneigh, **firstneigh; double imass, jmass, rsq, r, rinv; @@ -113,6 +115,12 @@ void PairRHEO::compute(int eflag, int vflag) if (compute_interface) { fp_store = compute_interface->fp_store; chi = compute_interface->chi; + + for (i = 0; i < atom->nmax; i++) { + fp_store[i][0] = 0.0; + fp_store[i][1] = 0.0; + fp_store[i][2] = 0.0; + } } inum = list->inum; @@ -243,11 +251,12 @@ void PairRHEO::compute(int eflag, int vflag) //Hydrostatic pressure forces fp_prefactor = voli * volj * (Pj + Pi); - sub3(vi, vj, du); + sub3(vi, vj, dv); //Add artificial viscous pressure if required if (artificial_visc_flag && pair_avisc_flag) { //Interpolate velocities to midpoint and use this difference for artificial viscosity + copy3(dv, du); for (a = 0; a < dim; a++) for (b = 0; b < dim; b++) du[a] -= 0.5 * (gradv[i][a * dim + b] + gradv[j][a * dim + b]) * dx[b]; @@ -257,10 +266,6 @@ void PairRHEO::compute(int eflag, int vflag) mu = MIN(0.0, mu); q = av * (-2.0 * cs * mu + mu * mu); fp_prefactor += voli * volj * q * (rhoj + rhoi); - - if (fabs(fp_prefactor*dWij[0]) > 1e-9) - if (atom->tag[i] == 643 or atom->tag[j] == 643 or atom->tag[i] == 963 or atom->tag[j] == 963) - printf("%d-%d (%d %d) fp_prefactor %g %g %g\n", atom->tag[i], atom->tag[j], i, j, fp_prefactor, dWij[0], -fp_prefactor*dWij[0]); } // -Grad[P + Q] @@ -270,7 +275,7 @@ void PairRHEO::compute(int eflag, int vflag) for (a = 0; a < dim; a++) { fv[a] = 0.0; for (b = 0; b < dim; b++) - fv[a] += du[a] * dx[b] * dWij[b]; + fv[a] += dv[a] * dx[b] * dWij[b]; fv[a] *= (etai + etaj) * voli * volj * rinv * rinv; } @@ -346,6 +351,11 @@ void PairRHEO::compute(int eflag, int vflag) } if (vflag_fdotr) virial_fdotr_compute(); + + if (compute_interface) { + comm->reverse_comm(this); + comm->forward_comm(this); + } } /* ---------------------------------------------------------------------- @@ -476,3 +486,37 @@ double PairRHEO::init_one(int i, int j) return h; } + +/* ---------------------------------------------------------------------- */ + +int PairRHEO::pack_reverse_comm(int n, int first, double *buf) +{ + int i, k, m, last; + double **fp_store = compute_interface->fp_store; + + m = 0; + last = first + n; + for (i = first; i < last; i++) { + buf[m++] = fp_store[i][0]; + buf[m++] = fp_store[i][1]; + buf[m++] = fp_store[i][2]; + } + + return m; +} + +/* ---------------------------------------------------------------------- */ + +void PairRHEO::unpack_reverse_comm(int n, int *list, double *buf) +{ + int i, j, k, m; + double **fp_store = compute_interface->fp_store; + + m = 0; + for (i = 0; i < n; i++) { + j = list[i]; + fp_store[j][0] += buf[m++]; + fp_store[j][1] += buf[m++]; + fp_store[j][2] += buf[m++]; + } +} diff --git a/src/RHEO/pair_rheo.h b/src/RHEO/pair_rheo.h index b30b0c3c04..cb2227c8d6 100644 --- a/src/RHEO/pair_rheo.h +++ b/src/RHEO/pair_rheo.h @@ -33,6 +33,8 @@ class PairRHEO : public Pair { void coeff(int, char **) override; void setup() override; double init_one(int, int) override; + int pack_reverse_comm(int, int, double *) override; + void unpack_reverse_comm(int, int *, double *) override; protected: double h, csq, rho0; // From fix RHEO From 4ae41edee791755613786a91b4058084af5b4332 Mon Sep 17 00:00:00 2001 From: jtclemm Date: Fri, 23 Jun 2023 14:12:59 -0600 Subject: [PATCH 041/158] Fixing order of correct_v --- .../PACKAGES/rheo/dam-break/in.rheo.dam.break | 87 +++++++++++++++++++ .../rheo/poiseuille/in.rheo.poiseuille | 16 ++-- .../rheo/taylor-green/in.rheo.taylor.green | 74 ++++++++++++++++ src/RHEO/compute_rheo_grad.cpp | 2 + src/RHEO/compute_rheo_surface.cpp | 4 +- src/RHEO/compute_rheo_vshift.cpp | 2 + src/RHEO/fix_rheo.cpp | 2 +- src/RHEO/pair_rheo.cpp | 2 + 8 files changed, 177 insertions(+), 12 deletions(-) create mode 100644 examples/PACKAGES/rheo/dam-break/in.rheo.dam.break create mode 100644 examples/PACKAGES/rheo/taylor-green/in.rheo.taylor.green diff --git a/examples/PACKAGES/rheo/dam-break/in.rheo.dam.break b/examples/PACKAGES/rheo/dam-break/in.rheo.dam.break new file mode 100644 index 0000000000..207fd6885e --- /dev/null +++ b/examples/PACKAGES/rheo/dam-break/in.rheo.dam.break @@ -0,0 +1,87 @@ +# ------ 2D dam break ------ # + +dimension 2 +units lj +atom_style rheo +boundary f s p +comm_modify vel yes +newton off +comm_style tiled + + +# ------ Create simulation box ------ # + +variable sf equal 0.05 +variable n equal 1.0/(${sf}^2) +variable cut equal 3.0*${sf} + +region box block -1 55 -1 20 -0.01 0.01 units box +create_box 2 box +lattice sq ${n} + +region left_wall block -1 0 EDGE EDGE -0.01 0.01 units box +region right_wall block 53.66 EDGE EDGE EDGE -0.01 0.01 units box +region bot_wall block 0.01 53.65 -1 0 -0.01 0.01 units box +region interior block 0.01 10 0.01 20 -0.01 0.01 units box + +create_atoms 1 region interior +create_atoms 2 region left_wall +create_atoms 2 region right_wall +create_atoms 2 region bot_wall + +group fluid type 1 +group static_wall type 2 +group dyn_wall type 3 +group rig union static_wall dyn_wall + + +# ------ Model parameters ------ # + +variable rho0 equal 1.0 +variable mp equal ${rho0}/${n} +variable cs equal 10 +variable zeta equal 1 +variable Dr equal 0.1*${cut}*${cs} +variable dt_max equal 0.1*${cut}/${cs}/3 +variable g equal 0.0245 +variable fext equal ${g}/${n} +variable eta equal 0.05 + +mass * ${mp} +variable d0 atom (${rho0}*${g}*(20-y)/${cs}/${cs})+${rho0} +set group all rheo/rho ${rho0} +set group fluid rheo/rho v_d0 + +set group all rheo/status 0 +set group rig rheo/status 2 + +timestep ${dt_max} + +pair_style rheo ${cut} artificial/visc ${zeta} rho/damp ${Dr} +pair_coeff * * + + +# ------ Fixes & computes ------ # + +fix 1 all rheo ${cut} RK1 32 shift surface/detection coordination 26 +fix 2 all rheo/viscosity constant ${eta} +fix 3 all rheo/pressure linear +fix 4 rig setforce 0.0 0.0 0.0 +fix 5 fluid addforce 0.0 -${fext} 0.0 +fix 6 all balance 1000 1.1 rcb + +compute 1 all rheo/property/atom rho phase surface + + +# ------ Output & Run ------ # + +thermo 10 +thermo_style custom step time ke press + +variable skin equal 0.2*${cut} +neighbor ${skin} bin +neigh_modify one 5000 + +dump 1 all custom 200 atomDump id type x y vx vy fx fy c_1[*] + +run 400000 diff --git a/examples/PACKAGES/rheo/poiseuille/in.rheo.poiseuille b/examples/PACKAGES/rheo/poiseuille/in.rheo.poiseuille index d0f966c2ce..6f5ad91e73 100644 --- a/examples/PACKAGES/rheo/poiseuille/in.rheo.poiseuille +++ b/examples/PACKAGES/rheo/poiseuille/in.rheo.poiseuille @@ -1,3 +1,5 @@ +# ------ 2D Poiseuille flow ------ # + dimension 2 units lj atom_style rheo @@ -5,16 +7,12 @@ boundary p p p comm_modify vel yes -# ------ Particle Lattice/Resolution Parameters ------ # +# ------ Create simulation box ------ # -variable L equal 10 variable sf equal 0.2 variable n equal 1.0/(${sf}^2) variable cut equal 3.5*${sf} - -# ------ Create simulation box ------ # - region box block 0 20 -10 10 -0.01 0.01 units box create_box 2 box lattice sq ${n} @@ -46,11 +44,11 @@ variable eta equal 0.1 variable dt_max equal 0.1*${cut}/${cs}/3 variable Dr equal 0.05*${cut}*${cs} -mass 1 ${mp} -mass 2 ${mp} +mass * ${mp} set group all rheo/rho ${rho0} set group all rheo/status 0 set group rig rheo/status 2 + timestep ${dt_max} pair_style rheo ${cut} artificial/visc ${zeta} rho/damp ${Dr} @@ -71,13 +69,13 @@ compute 1 all rheo/property/atom rho phase # ------ Output & Run ------ # thermo 200 -thermo_style custom step time temp press +thermo_style custom step time ke press variable skin equal 0.2*${cut} neighbor ${skin} bin neigh_modify one 5000 -dump 1 all custom 200 atomDump id type x y vx vy fx fy c_1[*] +#dump 1 all custom 200 atomDump id type x y vx vy fx fy c_1[*] run 20000 diff --git a/examples/PACKAGES/rheo/taylor-green/in.rheo.taylor.green b/examples/PACKAGES/rheo/taylor-green/in.rheo.taylor.green new file mode 100644 index 0000000000..5367ceef13 --- /dev/null +++ b/examples/PACKAGES/rheo/taylor-green/in.rheo.taylor.green @@ -0,0 +1,74 @@ +# ------ 2D Taylor Green vortex ------ # + +dimension 2 +units lj +atom_style rheo +boundary p p p +comm_modify vel yes +newton off + + +# ------ Create simulation box ------ # + +variable sf equal 0.1 +variable n equal 1.0/(${sf}^2) +variable cut equal 3.5*${sf} + +region box block 0 10 0 10 -0.01 0.01 units box +create_box 1 box +lattice sq ${n} + +create_atoms 1 region box + +variable dr equal 0.1*${sf} +displace_atoms all random ${dr} ${dr} 0 135414 units box + + +# ------ Model parameters ------ # + +variable rho0 equal 1.0 +variable mp equal ${rho0}/${n} +variable cs equal 1.0 +variable eta equal 0.05 +variable zeta equal 1 +variable dt_max equal 0.1*${cut}/${cs}/3 +variable Dr equal 0.1*${cut}*${cs} + +mass * ${mp} +set group all rheo/rho ${rho0} +set group all rheo/status 0 + +variable u0 equal 0.05 +variable uy atom ${u0}*sin(2*PI*x/lx)*cos(2*PI*y/ly) +variable ux atom -${u0}*sin(2*PI*y/ly)*cos(2*PI*x/ly) +variable d0 atom ${rho0}-${u0}*${u0}*${rho0}*0.25*(cos(4*PI*x/lx)+cos(4*PI*y/ly))/${cs}/${cs} + +velocity all set v_ux v_uy 0.0 units box + +timestep ${dt_max} + +pair_style rheo ${cut} artificial/visc ${zeta} rho/damp ${Dr} +pair_coeff * * + + +# ------ Fixes & computes ------ # + +fix 1 all rheo ${cut} quintic 0 shift +fix 2 all rheo/viscosity constant ${eta} +fix 3 all rheo/pressure linear + +compute 1 all rheo/property/atom rho phase + + +# ------ Output & Run ------ # + +thermo 200 +thermo_style custom step time ke press + +variable skin equal 0.2*${cut} +neighbor ${skin} bin +neigh_modify one 10000 #increase number of allowed neighbors + +#dump 1 all custom 200 atomDump id type x y vx vy fx fy c_1[*] + +run 10000 \ No newline at end of file diff --git a/src/RHEO/compute_rheo_grad.cpp b/src/RHEO/compute_rheo_grad.cpp index 7d0b1d5b14..369bf11e0d 100644 --- a/src/RHEO/compute_rheo_grad.cpp +++ b/src/RHEO/compute_rheo_grad.cpp @@ -212,9 +212,11 @@ void ComputeRHEOGrad::compute_peratom() if (interface_flag) { if (fluidi && (!fluidj)) { compute_interface->correct_v(vi, vj, i, j); + //compute_interface->correct_v(vj, vi, j, i); rhoj = compute_interface->correct_rho(j, i); } else if ((!fluidi) && fluidj) { compute_interface->correct_v(vj, vi, j, i); + //compute_interface->correct_v(vi, vj, i, j); rhoi = compute_interface->correct_rho(i, j); } else if ((!fluidi) && (!fluidj)) { rhoi = rho0; diff --git a/src/RHEO/compute_rheo_surface.cpp b/src/RHEO/compute_rheo_surface.cpp index f6b93ee551..4b0745abd3 100644 --- a/src/RHEO/compute_rheo_surface.cpp +++ b/src/RHEO/compute_rheo_surface.cpp @@ -126,7 +126,7 @@ void ComputeRHEOSurface::compute_peratom() { int i, j, ii, jj, inum, jnum, a, b, itype, jtype, fluidi, fluidj; double xtmp, ytmp, ztmp, rsq, Voli, Volj, rhoi, rhoj, wp; - double *dWij, *dWji, dx[3]; + double dWij[3], dWji[3], dx[3]; int *ilist, *jlist, *numneigh, **firstneigh; int nlocal = atom->nlocal; @@ -214,7 +214,7 @@ void ComputeRHEOSurface::compute_peratom() Voli = mass[itype] / rhoi; Volj = mass[jtype] / rhoj; - wp = compute_kernel->calc_dw_quintic(i, j, dx[0], dx[1], dx[2], sqrt(rsq),dWij, dWji); + wp = compute_kernel->calc_dw_quintic(i, j, dx[0], dx[1], dx[2], sqrt(rsq), dWij, dWji); for (a = 0; a < dim; a++){ divr[i] -= dWij[a] * dx[a] * Volj; diff --git a/src/RHEO/compute_rheo_vshift.cpp b/src/RHEO/compute_rheo_vshift.cpp index 0521ff16c0..9741026324 100644 --- a/src/RHEO/compute_rheo_vshift.cpp +++ b/src/RHEO/compute_rheo_vshift.cpp @@ -171,9 +171,11 @@ void ComputeRHEOVShift::compute_peratom() if (interface_flag) { if (fluidi && (!fluidj)) { compute_interface->correct_v(vi, vj, i, j); + //compute_interface->correct_v(vj, vi, j, i); rhoj = compute_interface->correct_rho(j,i); } else if ((!fluidi) && fluidj) { compute_interface->correct_v(vj, vi, j, i); + //compute_interface->correct_v(vi, vj, i, j); rhoi = compute_interface->correct_rho(i,j); } else if ((!fluidi) && (!fluidj)) { rhoi = 1.0; diff --git a/src/RHEO/fix_rheo.cpp b/src/RHEO/fix_rheo.cpp index cecd3183fd..0420a0f23f 100644 --- a/src/RHEO/fix_rheo.cpp +++ b/src/RHEO/fix_rheo.cpp @@ -154,7 +154,7 @@ void FixRHEO::post_constructor() if (rhosum_flag) { compute_rhosum = dynamic_cast(modify->add_compute( - "rheo_rho_sum all RHEO/RHO/SUM")); + "rheo_rhosum all RHEO/RHO/SUM")); compute_rhosum->fix_rheo = this; } diff --git a/src/RHEO/pair_rheo.cpp b/src/RHEO/pair_rheo.cpp index 0feb6af445..e22715eab1 100644 --- a/src/RHEO/pair_rheo.cpp +++ b/src/RHEO/pair_rheo.cpp @@ -207,6 +207,7 @@ void PairRHEO::compute(int eflag, int vflag) if (interface_flag) { if (fluidi && (!fluidj)) { compute_interface->correct_v(vi, vj, i, j); + //compute_interface->correct_v(vj, vi, j, i); rhoj = compute_interface->correct_rho(j, i); Pj = fix_pressure->calc_pressure(rhoj); @@ -215,6 +216,7 @@ void PairRHEO::compute(int eflag, int vflag) } else if ((!fluidi) && fluidj) { compute_interface->correct_v(vj, vi, j, i); + //compute_interface->correct_v(vi, vj, i, j); rhoi = compute_interface->correct_rho(i, j); Pi = fix_pressure->calc_pressure(rhoi); From 71abebb1d7173a5fe0b1c38903f65a3ebc4b7905 Mon Sep 17 00:00:00 2001 From: jtclemm Date: Sun, 16 Jul 2023 16:26:57 -0600 Subject: [PATCH 042/158] debugging surface compute --- doc/src/fix_rheo.rst | 3 ++- src/RHEO/compute_rheo_surface.cpp | 24 ++++++++++++++---------- src/RHEO/compute_rheo_surface.h | 2 +- src/RHEO/fix_rheo.cpp | 4 +++- src/RHEO/fix_rheo.h | 2 +- 5 files changed, 21 insertions(+), 14 deletions(-) diff --git a/doc/src/fix_rheo.rst b/doc/src/fix_rheo.rst index 5eae617419..25e171a1b9 100644 --- a/doc/src/fix_rheo.rst +++ b/doc/src/fix_rheo.rst @@ -20,9 +20,10 @@ Syntax *shift* values = none, turns on velocity shifting *thermal* values = none, turns on thermal evolution - *surface/detection* values = *sdstyle* *limit* + *surface/detection* values = *sdstyle* *limit* *limit/splash* *sdstyle* = *coordination* or *divergence* *limit* = threshold for surface particles (unitless) + *limit/splash* = threshold for splash particles (unitless) *interface/reconstruct* values = none, reconstructs interfaces with solid particles *rho/sum* values = none, uses the kernel to compute the density of particles *density* values = *rho0* (density) diff --git a/src/RHEO/compute_rheo_surface.cpp b/src/RHEO/compute_rheo_surface.cpp index 4b0745abd3..230bca8219 100644 --- a/src/RHEO/compute_rheo_surface.cpp +++ b/src/RHEO/compute_rheo_surface.cpp @@ -82,6 +82,8 @@ void ComputeRHEOSurface::init() threshold_style = fix_rheo->surface_style; threshold_divr = fix_rheo->divr_surface; threshold_z = fix_rheo->zmin_surface; + threshold_splash = fix_rheo->zmin_splash; + interface_flag = fix_rheo->interface_flag; cutsq = cut * cut; @@ -202,13 +204,15 @@ void ComputeRHEOSurface::compute_peratom() rhoj = rho[j]; // Add corrections for walls - if (fluidi && (!fluidj)) { - rhoj = compute_interface->correct_rho(j, i); - } else if ((!fluidi) && fluidj) { - rhoi = compute_interface->correct_rho(i, j); - } else if ((!fluidi) && (!fluidj)) { - rhoi = rho0; - rhoj = rho0; + if (interface_flag) { + if (fluidi && (!fluidj)) { + rhoj = compute_interface->correct_rho(j, i); + } else if ((!fluidi) && fluidj) { + rhoi = compute_interface->correct_rho(i, j); + } else if ((!fluidi) && (!fluidj)) { + rhoi = rho0; + rhoj = rho0; + } } Voli = mass[itype] / rhoi; @@ -262,7 +266,7 @@ void ComputeRHEOSurface::compute_peratom() if (divr[i] < threshold_divr) { status[i] |= STATUS_SURFACE; rsurface[i] = 0.0; - if (coordination[i] < threshold_z) + if (coordination[i] < threshold_splash) status[i] |= STATUS_SPLASH; } } @@ -272,10 +276,10 @@ void ComputeRHEOSurface::compute_peratom() if (mask[i] & groupbit) { status[i] |= STATUS_BULK; rsurface[i] = cut; - if (coordination[i] < threshold_divr) { + if (coordination[i] < threshold_z) { status[i] |= STATUS_SURFACE; rsurface[i] = 0.0; - if (coordination[i] < threshold_z) + if (coordination[i] < threshold_splash) status[i] |= STATUS_SPLASH; } } diff --git a/src/RHEO/compute_rheo_surface.h b/src/RHEO/compute_rheo_surface.h index 220f8beb6d..1d1cdba3fa 100644 --- a/src/RHEO/compute_rheo_surface.h +++ b/src/RHEO/compute_rheo_surface.h @@ -41,7 +41,7 @@ class ComputeRHEOSurface : public Compute { private: double cut, cutsq, rho0, threshold_divr; - int surface_style, nmax_store, threshold_z; + int surface_style, nmax_store, threshold_z, threshold_splash, interface_flag; double **B, **gradC; int threshold_style, comm_stage; diff --git a/src/RHEO/fix_rheo.cpp b/src/RHEO/fix_rheo.cpp index 0420a0f23f..339d7f5ac8 100644 --- a/src/RHEO/fix_rheo.cpp +++ b/src/RHEO/fix_rheo.cpp @@ -97,14 +97,16 @@ FixRHEO::FixRHEO(LAMMPS *lmp, int narg, char **arg) : if (strcmp(arg[iarg + 1], "coordination")) { surface_style = COORDINATION; zmin_surface = utils::inumeric(FLERR,arg[iarg + 2],false,lmp); + zmin_splash = utils::inumeric(FLERR,arg[iarg + 3],false,lmp); } else if (strcmp(arg[iarg + 1], "divergence")) { surface_style = DIVR; divr_surface = utils::numeric(FLERR,arg[iarg + 2],false,lmp); + zmin_splash = utils::inumeric(FLERR,arg[iarg + 3],false,lmp); } else { error->all(FLERR,"Illegal surface/detection option in fix rheo, {}", arg[iarg + 1]); } - iarg += 2; + iarg += 3; } else if (strcmp(arg[iarg],"interface/reconstruct") == 0) { interface_flag = 1; } else if (strcmp(arg[iarg],"rho/sum") == 0) { diff --git a/src/RHEO/fix_rheo.h b/src/RHEO/fix_rheo.h index 0dbc8db78b..96f4b6f502 100644 --- a/src/RHEO/fix_rheo.h +++ b/src/RHEO/fix_rheo.h @@ -40,7 +40,7 @@ class FixRHEO : public Fix { // Model parameters double h, cut, rho0, csq; - int zmin_kernel, zmin_surface; + int zmin_kernel, zmin_surface, zmin_splash; int kernel_style, surface_style; double divr_surface; From 583917b194a50effe37047db10de2346be9b0562 Mon Sep 17 00:00:00 2001 From: jtclemm Date: Mon, 25 Sep 2023 09:39:29 -0600 Subject: [PATCH 043/158] Drafting structure of solidification bond creation --- src/RHEO/fix_rheo.h | 3 +- src/RHEO/fix_rheo_thermal.cpp | 118 +++++++++++++++++++++++++++++++++- src/RHEO/fix_rheo_thermal.h | 10 +++ 3 files changed, 128 insertions(+), 3 deletions(-) diff --git a/src/RHEO/fix_rheo.h b/src/RHEO/fix_rheo.h index 0dbc8db78b..9acf30e4fc 100644 --- a/src/RHEO/fix_rheo.h +++ b/src/RHEO/fix_rheo.h @@ -86,7 +86,8 @@ namespace RHEO_NS { // Temporary status options - reset in preforce STATUS_NO_SHIFT = 1 << 6, STATUS_NO_INTEGRATION = 1 << 7, - STATUS_FREEZING = 1 << 8 + STATUS_FREEZING = 1 << 8, + STATUS_MELTING = 1 << 9 }; // Masks and their inverses diff --git a/src/RHEO/fix_rheo_thermal.cpp b/src/RHEO/fix_rheo_thermal.cpp index de88b4f8d0..837cea6de4 100644 --- a/src/RHEO/fix_rheo_thermal.cpp +++ b/src/RHEO/fix_rheo_thermal.cpp @@ -29,6 +29,8 @@ #include "math_extra.h" #include "memory.h" #include "modify.h" +#include "neigh_list.h" +#include "pair.h" #include "update.h" using namespace LAMMPS_NS; @@ -47,6 +49,8 @@ FixRHEOThermal::FixRHEOThermal(LAMMPS *lmp, int narg, char **arg) : Tc_style = NONE; cv_style = NONE; conductivity_style = NONE; + cut_bond = 0; + comm_forward = 0; int ntypes = atom->ntypes; int iarg = 3; @@ -95,7 +99,7 @@ FixRHEOThermal::FixRHEOThermal(LAMMPS *lmp, int narg, char **arg) : } } else if (strcmp(arg[iarg],"Tfreeze") == 0) { // T freeze arguments - if (iarg+1 >= narg) error->all(FLERR,"Insufficient arguments for Tfreeze option"); + if (iarg + 1 >= narg) error->all(FLERR,"Insufficient arguments for Tfreeze option"); if (strcmp(arg[iarg + 1],"constant") == 0) { if (iarg + 2 >= narg) error->all(FLERR,"Insufficient arguments for Tfreeze option"); Tc_style = CONSTANT; @@ -105,7 +109,7 @@ FixRHEOThermal::FixRHEOThermal(LAMMPS *lmp, int narg, char **arg) : } else if (strcmp(arg[iarg + 1],"type") == 0) { if (iarg + 1 + ntypes >= narg) error->all(FLERR,"Insufficient arguments for Tfreeze option"); Tc_style = TYPE; - memory->create(Tc_type,ntypes + 1,"rheo_thermal:Tc_type"); + memory->create(Tc_type, ntypes + 1, "rheo_thermal:Tc_type"); for (int i = 1; i <= ntypes; i++) { Tc_type[i] = utils::numeric(FLERR,arg[iarg + 1 + i],false,lmp); if (Tc_type[i] < 0.0) error->all(FLERR,"The melting temperature must be positive"); @@ -114,6 +118,12 @@ FixRHEOThermal::FixRHEOThermal(LAMMPS *lmp, int narg, char **arg) : } else { error->all(FLERR,"Illegal fix command, {}", arg[iarg + 1]); } + } else if (strcmp(arg[iarg],"react") == 0) { + if (iarg + 1 >= narg) error->all(FLERR, "Insufficient arguments for react option"); + cut_bond = utils::numeric(FLERR, arg[iarg + 1], false, lmp); + comm_forward = 1; + if (cut_bond <= 0.0) error->all(FLERR, "Illegal value for bond lengths"); + iarg += 1; } else { error->all(FLERR,"Illegal fix command, {}", arg[iarg]); } @@ -172,6 +182,31 @@ void FixRHEOThermal::init() error->all(FLERR,"fix rheo/thermal command requires atom property heatflow"); if (atom->conductivity_flag != 1) error->all(FLERR,"fix rheo/thermal command requires atom property conductivity"); + + + if (cut_bond > 0.0) { + if (!force->bond) error->all(FLERR,"Must define a bond style to use reactive bond generation with fix rheo/thermal"); + if (!atom->avec->bonds_allow) error->all(FLERR, "Reactive bond generation in fix rheo/thermal requires atom bonds"); + + // all special weights must be 1.0, RHEO pair styles filter by status + if (force->special_lj[0] != 1.0 || force->special_lj[1] != 1.0 || force->special_lj[2] != 1.0 || force->special_lj[3] != 1.0) + error->all(FLERR, "Reactive bond generation in fix rheo/thermal requires special weights of 1.0"); + + // need a half neighbor list, built only when particles freeze + auto req = neighbor->add_request(this, NeighConst::REQ_OCCASIONAL); + req->set_cutoff(cut_bond); + + // find instances of bond history to delete data + histories = modify->get_fix_by_style("BOND_HISTORY"); + n_histories = histories.size(); + } +} + +/* ---------------------------------------------------------------------- */ + +void FixRHEOThermal::init_list(int /*id*/, NeighList *ptr) +{ + list = ptr; } /* ---------------------------------------------------------------------- */ @@ -180,6 +215,9 @@ void FixRHEOThermal::setup_pre_force(int /*vflag*/) { fix_rheo->thermal_fix_defined = 1; + if (modify->get_fix_by_style("rheo/thermal").size() > 1) + error->all(FLERR, "More than one fix rheo/thermal defined"); + post_neighbor(); pre_force(0); } @@ -228,6 +266,8 @@ void FixRHEOThermal::post_integrate() double cvi, Tci, Ti; + int phase_changes = 0; + //Integrate temperature and check status for (int i = 0; i < atom->nlocal; i++) { if (mask[i] & groupbit) { @@ -248,6 +288,8 @@ void FixRHEOThermal::post_integrate() // If solid, melt if (status[i] & STATUS_SOLID) { status[i] &= PHASEMASK; + status[i] |= STATUS_MELTING; + phase_changes += 1; } } else { // If fluid, freeze @@ -255,11 +297,22 @@ void FixRHEOThermal::post_integrate() status[i] &= PHASEMASK; status[i] |= STATUS_SOLID; status[i] |= STATUS_FREEZING; + phase_changes += 1; } } } } } + + if (cut_bond > 0 && phase_changes != 0) { + // Forward status then delete/create bonds + comm->forward_comm(this); + + for (int i = 0; i < atom->nlocal; i++) { + if (status[i] & STATUS_MELTING) delete_bonds(i); + if (status[i] & STATUS_FREEZING) create_bonds(i); + } + } } /* ---------------------------------------------------------------------- @@ -324,6 +377,36 @@ void FixRHEOThermal::reset_dt() /* ---------------------------------------------------------------------- */ +void FixRHEOThermal::break_bonds(int i) +{ + int m, k, j; + + int *status = atom->status; + int **bond_type = atom->bond_type; + tagint **bond_atom = atom->bond_atom; + int *num_bond = atom->num_bond; + + for (m = 0; m < num_bond[i]; m++) { + j = bond_atom[i][k]; + if (n_histories > 0) + for (auto &ihistory: histories) + dynamic_cast(ihistory)->delete_history(i,num_bond[i]-1); + + Search for bond in js list and delete + } + + num_bond[i] = 0; +} + +/* ---------------------------------------------------------------------- */ + +void FixRHEOThermal::create_bonds(int i) +{ + +} + +/* ---------------------------------------------------------------------- */ + double FixRHEOThermal::calc_cv(int i) { if (cv_style == CONSTANT) { @@ -332,3 +415,34 @@ double FixRHEOThermal::calc_cv(int i) return(cv_type[atom->type[i]]); } } + + +/* ---------------------------------------------------------------------- */ + +int FixRHEOThermal::pack_forward_comm(int n, int *list, double *buf, + int /*pbc_flag*/, int * /*pbc*/) +{ + int i, j, k, m; + int *status = atom->status; + m = 0; + + for (i = 0; i < n; i++) { + j = list[i]; + buf[m++] = ubuf(status[j]).d; + } + return m; +} + +/* ---------------------------------------------------------------------- */ + +void FixRHEOThermal::unpack_forward_comm(int n, int first, double *buf) +{ + int i, k, m, last; + int *status = atom->status; + + m = 0; + last = first + n; + for (i = first; i < last; i++) { + status[i] = (int) ubuf(buf[m++]).i + } +} diff --git a/src/RHEO/fix_rheo_thermal.h b/src/RHEO/fix_rheo_thermal.h index a27ad98a8c..f732a2d728 100644 --- a/src/RHEO/fix_rheo_thermal.h +++ b/src/RHEO/fix_rheo_thermal.h @@ -30,12 +30,15 @@ class FixRHEOThermal : public Fix { ~FixRHEOThermal() override; int setmask() override; void init() override; + void init_list(int, class NeighList *) override; void setup_pre_force(int) override; void initial_integrate(int) override; void post_integrate() override; void post_neighbor() override; void pre_force(int) override; void final_integrate() override; + int pack_forward_comm(int, int *, double *, int, int *) override; + void unpack_forward_comm(int, int, double *) override; void reset_dt() override; double calc_cv(int); @@ -44,15 +47,22 @@ class FixRHEOThermal : public Fix { double *Tc_type, Tc; double *kappa_type, kappa; double dtf, dtv; + double cut_bond; int Tc_style; int cv_style; int conductivity_style; + class NeighList *list; + + int n_histories; + const std::vector histories; class FixRHEO *fix_rheo; class ComputeRHEOGrad *compute_grad; class ComputeRHEOVShift *compute_vshift; void grow_array(int); + void break_bonds(int); + void create_bonds(int); }; } // namespace LAMMPS_NS From 3cae238eb5bdc26ade047a4789c7e157fbf33cfa Mon Sep 17 00:00:00 2001 From: jtclemm Date: Tue, 26 Sep 2023 09:07:44 -0600 Subject: [PATCH 044/158] Finish drafting bond creation/deletion --- src/RHEO/fix_rheo_thermal.cpp | 82 ++++++++++++++++++++++++++++++++--- src/RHEO/fix_rheo_thermal.h | 1 + 2 files changed, 76 insertions(+), 7 deletions(-) diff --git a/src/RHEO/fix_rheo_thermal.cpp b/src/RHEO/fix_rheo_thermal.cpp index 837cea6de4..f6fa95b3b7 100644 --- a/src/RHEO/fix_rheo_thermal.cpp +++ b/src/RHEO/fix_rheo_thermal.cpp @@ -25,6 +25,8 @@ #include "domain.h" #include "error.h" #include "fix_rheo.h" +#include "fix_bond_history.h" +#include "fix_update_special_bonds.h" #include "force.h" #include "math_extra.h" #include "memory.h" @@ -42,7 +44,7 @@ enum {NONE, CONSTANT, TYPE}; FixRHEOThermal::FixRHEOThermal(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg), fix_rheo(nullptr), compute_grad(nullptr), compute_vshift(nullptr), - Tc_type(nullptr), kappa_type(nullptr), cv_type(nullptr) + Tc_type(nullptr), kappa_type(nullptr), cv_type(nullptr), fix_update_special_bonds(nullptr) { if (narg < 4) error->all(FLERR,"Illegal fix command"); @@ -188,9 +190,12 @@ void FixRHEOThermal::init() if (!force->bond) error->all(FLERR,"Must define a bond style to use reactive bond generation with fix rheo/thermal"); if (!atom->avec->bonds_allow) error->all(FLERR, "Reactive bond generation in fix rheo/thermal requires atom bonds"); - // all special weights must be 1.0, RHEO pair styles filter by status - if (force->special_lj[0] != 1.0 || force->special_lj[1] != 1.0 || force->special_lj[2] != 1.0 || force->special_lj[3] != 1.0) - error->all(FLERR, "Reactive bond generation in fix rheo/thermal requires special weights of 1.0"); + // all special weights must be 1.0 (no special neighbors) or there must be an instance of fix update/special/bonds + if (force->special_lj[0] != 1.0 || force->special_lj[1] != 1.0 || force->special_lj[2] != 1.0 || force->special_lj[3] != 1.0) { + auto fixes = modify->get_fix_by_style("UPDATE_SPECIAL_BONDS"); + if (fixes.size == 0) error->all(FLERR, "Without fix update/special/bonds, reactive bond generation in fix rheo/thermal requires special weights of 1.0"); + fix_update_special_bonds = dynamic_cast(fixes[0]); + } // need a half neighbor list, built only when particles freeze auto req = neighbor->add_request(this, NeighConst::REQ_OCCASIONAL); @@ -379,20 +384,40 @@ void FixRHEOThermal::reset_dt() void FixRHEOThermal::break_bonds(int i) { - int m, k, j; + int m, n, nmax, j; + tagint *tag = atom->tag; int *status = atom->status; int **bond_type = atom->bond_type; tagint **bond_atom = atom->bond_atom; int *num_bond = atom->num_bond; for (m = 0; m < num_bond[i]; m++) { - j = bond_atom[i][k]; + j = bond_atom[i][m]; if (n_histories > 0) for (auto &ihistory: histories) dynamic_cast(ihistory)->delete_history(i,num_bond[i]-1); - Search for bond in js list and delete + if (fix_update_special_bonds) fix_update_special_bonds->add_broken_bond(i,j); + + if (j >= atom->nlocal) continue; + + for (n = 0; n < num_bond[j]; n++) { + if (bond_atom[j][n] == tag[i]) { + bond_type[j][n] = 0; + nmax = num_bond[j] - 1; + bond_type[j][n] = bond_type[j][nmax]; + bond_atom[j][n] = bond_atom[j][nmax]; + if (n_histories > 0) { + for (auto &ihistory: histories) { + dynamic_cast(ihistory)->shift_history(j, n, nmax); + dynamic_cast(ihistory)->delete_history(j, nmax); + } + } + num_bond[j]--; + break; + } + } } num_bond[i] = 0; @@ -402,7 +427,50 @@ void FixRHEOThermal::break_bonds(int i) void FixRHEOThermal::create_bonds(int i) { + int i1, i2, j, jj, jnum; + int *jlist, *numneigh, **firstneigh; + double rsq; + int nlocal = atom->nlocal; + + tagint *tag = atom->tag; + double *x = atom->x; + numneigh = list->numneigh; + firstneigh = list->firstneigh; + + int *status = atom->status; + int **bond_type = atom->bond_type; + tagint **bond_atom = atom->bond_atom; + int *num_bond = atom->num_bond; + + double xtmp = x[i][0]; + double ytmp = x[i][1]; + double ztmp = x[i][2]; + double delx, dely, delz; + + // Loop through atoms of owned atoms + jlist = firstneigh[i]; + jnum = numneigh[i]; + for (jj = 0; jj < jnum; jj++) { + j = jlist[jj]; + j &= SPECIALMASK; + if (status[j] & STATUS_SOLID) { + delx = xtmp - x[j][0]; + dely = ytmp - x[j][1]; + delz = ztmp - x[j][2]; + rsq = delx * delx + dely * dely + delz * delz; + if (rsq > cut_bond) continue; + + if (!newton_bond || tag[i] < tag[j]) { + if (num_bond[i] == atom->bond_per_atom) + error->one(FLERR,"New bond exceeded bonds per atom in fix rheo/thermal"); + if (fix_update_special_bonds) fix_update_special_bonds->add_created_bond(i,j); + bond_type[i][num_bond[i]] = btype; + bond_atom[i][num_bond[i]] = tag[j]; + num_bond[i]++; + } + } + } } /* ---------------------------------------------------------------------- */ diff --git a/src/RHEO/fix_rheo_thermal.h b/src/RHEO/fix_rheo_thermal.h index f732a2d728..13b743b939 100644 --- a/src/RHEO/fix_rheo_thermal.h +++ b/src/RHEO/fix_rheo_thermal.h @@ -59,6 +59,7 @@ class FixRHEOThermal : public Fix { class FixRHEO *fix_rheo; class ComputeRHEOGrad *compute_grad; class ComputeRHEOVShift *compute_vshift; + class FixUpdateSpecialBonds *fix_update_special_bonds; void grow_array(int); void break_bonds(int); From 1cbe59c254989631df6bffde3a767c98896e3b2a Mon Sep 17 00:00:00 2001 From: jtclemm Date: Thu, 5 Oct 2023 21:19:50 -0600 Subject: [PATCH 045/158] Fixing compile errors --- src/RHEO/fix_rheo_thermal.cpp | 20 +++++++++++++------- src/RHEO/fix_rheo_thermal.h | 8 +++++--- 2 files changed, 18 insertions(+), 10 deletions(-) diff --git a/src/RHEO/fix_rheo_thermal.cpp b/src/RHEO/fix_rheo_thermal.cpp index f6fa95b3b7..48a22a5419 100644 --- a/src/RHEO/fix_rheo_thermal.cpp +++ b/src/RHEO/fix_rheo_thermal.cpp @@ -19,6 +19,7 @@ #include "fix_rheo_thermal.h" #include "atom.h" +#include "atom_vec.h" #include "comm.h" #include "compute_rheo_grad.h" #include "compute_rheo_vshift.h" @@ -31,7 +32,9 @@ #include "math_extra.h" #include "memory.h" #include "modify.h" +#include "neighbor.h" #include "neigh_list.h" +#include "neigh_request.h" #include "pair.h" #include "update.h" @@ -121,11 +124,13 @@ FixRHEOThermal::FixRHEOThermal(LAMMPS *lmp, int narg, char **arg) : error->all(FLERR,"Illegal fix command, {}", arg[iarg + 1]); } } else if (strcmp(arg[iarg],"react") == 0) { - if (iarg + 1 >= narg) error->all(FLERR, "Insufficient arguments for react option"); + if (iarg + 2 >= narg) error->all(FLERR, "Insufficient arguments for react option"); cut_bond = utils::numeric(FLERR, arg[iarg + 1], false, lmp); + btype = utils::numeric(FLERR, arg[iarg + 2], false, lmp); comm_forward = 1; - if (cut_bond <= 0.0) error->all(FLERR, "Illegal value for bond lengths"); - iarg += 1; + if (cut_bond <= 0.0) error->all(FLERR, "Illegal value for bond lengths");\ + if (btype < 1 || btype > atom->nbondtypes) error->all(FLERR, "Illegal value for bond type"); + iarg += 2; } else { error->all(FLERR,"Illegal fix command, {}", arg[iarg]); } @@ -193,7 +198,7 @@ void FixRHEOThermal::init() // all special weights must be 1.0 (no special neighbors) or there must be an instance of fix update/special/bonds if (force->special_lj[0] != 1.0 || force->special_lj[1] != 1.0 || force->special_lj[2] != 1.0 || force->special_lj[3] != 1.0) { auto fixes = modify->get_fix_by_style("UPDATE_SPECIAL_BONDS"); - if (fixes.size == 0) error->all(FLERR, "Without fix update/special/bonds, reactive bond generation in fix rheo/thermal requires special weights of 1.0"); + if (fixes.size() == 0) error->all(FLERR, "Without fix update/special/bonds, reactive bond generation in fix rheo/thermal requires special weights of 1.0"); fix_update_special_bonds = dynamic_cast(fixes[0]); } @@ -314,7 +319,7 @@ void FixRHEOThermal::post_integrate() comm->forward_comm(this); for (int i = 0; i < atom->nlocal; i++) { - if (status[i] & STATUS_MELTING) delete_bonds(i); + if (status[i] & STATUS_MELTING) break_bonds(i); if (status[i] & STATUS_FREEZING) create_bonds(i); } } @@ -434,7 +439,7 @@ void FixRHEOThermal::create_bonds(int i) int nlocal = atom->nlocal; tagint *tag = atom->tag; - double *x = atom->x; + double **x = atom->x; numneigh = list->numneigh; firstneigh = list->firstneigh; @@ -442,6 +447,7 @@ void FixRHEOThermal::create_bonds(int i) int **bond_type = atom->bond_type; tagint **bond_atom = atom->bond_atom; int *num_bond = atom->num_bond; + int newton_bond = force->newton_bond; double xtmp = x[i][0]; double ytmp = x[i][1]; @@ -511,6 +517,6 @@ void FixRHEOThermal::unpack_forward_comm(int n, int first, double *buf) m = 0; last = first + n; for (i = first; i < last; i++) { - status[i] = (int) ubuf(buf[m++]).i + status[i] = (int) ubuf(buf[m++]).i; } } diff --git a/src/RHEO/fix_rheo_thermal.h b/src/RHEO/fix_rheo_thermal.h index 13b743b939..75d32b7bc1 100644 --- a/src/RHEO/fix_rheo_thermal.h +++ b/src/RHEO/fix_rheo_thermal.h @@ -22,6 +22,8 @@ FixStyle(rheo/thermal,FixRHEOThermal) #include "fix.h" +#include + namespace LAMMPS_NS { class FixRHEOThermal : public Fix { @@ -48,13 +50,13 @@ class FixRHEOThermal : public Fix { double *kappa_type, kappa; double dtf, dtv; double cut_bond; - int Tc_style; - int cv_style; + int Tc_style, cv_style; + int btype; int conductivity_style; class NeighList *list; int n_histories; - const std::vector histories; + std::vector histories; class FixRHEO *fix_rheo; class ComputeRHEOGrad *compute_grad; From 63eed5e2301f53848a52557ebb6864cb68e19c3a Mon Sep 17 00:00:00 2001 From: jtclemm Date: Fri, 6 Oct 2023 17:43:54 -0600 Subject: [PATCH 046/158] Drafting tension model --- src/.gitignore | 2 + src/RHEO/pair_rheo_tension.cpp | 369 +++++++++++++++++++++++++++++++++ src/RHEO/pair_rheo_tension.h | 56 +++++ 3 files changed, 427 insertions(+) create mode 100644 src/RHEO/pair_rheo_tension.cpp create mode 100644 src/RHEO/pair_rheo_tension.h diff --git a/src/.gitignore b/src/.gitignore index f9794ddb82..7b645ee347 100644 --- a/src/.gitignore +++ b/src/.gitignore @@ -223,6 +223,8 @@ /fix_rheo_viscosity.h /pair_rheo.cpp /pair_rheo.h +/pair_rheo_tension.cpp +/pair_rheo_tension.h /compute_grid.cpp /compute_grid.h diff --git a/src/RHEO/pair_rheo_tension.cpp b/src/RHEO/pair_rheo_tension.cpp new file mode 100644 index 0000000000..5899c87e3e --- /dev/null +++ b/src/RHEO/pair_rheo_tension.cpp @@ -0,0 +1,369 @@ +/* ---------------------------------------------------------------------- + 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 authors: + Joel Clemmer (SNL) +----------------------------------------------------------------------- */ + +#include "pair_rheo_tension.h" + +#include "atom.h" +#include "comm.h" +#include "compute_rheo_kernel.h" +#include "domain.h" +#include "error.h" +#include "fix_rheo.h" +#include "force.h" +#include "math_extra.h" +#include "memory.h" +#include "modify.h" +#include "neighbor.h" +#include "neigh_list.h" +#include "update.h" +#include "utils.h" + +#include + +using namespace LAMMPS_NS; +using namespace RHEO_NS; +using namespace MathExtra; + +static constexpr double EPSILON = 1e-2; + +/* ---------------------------------------------------------------------- */ + +PairRHEOTension::PairRHEOTension(LAMMPS *lmp) : + Pair(lmp), compute_kernel(nullptr), fix_rheo(nullptr) +{ + restartinfo = 0; + single_enable = 0; + + comm_forward = 3; + comm_reverse = 3; +} + +/* ---------------------------------------------------------------------- */ + +PairRHEOTension::~PairRHEOTension() +{ + // Remove custom property if it exists + int tmp1, tmp2, index; + + index = atom->find_custom("rheo_c_tension", tmp1, tmp2); + if (index != -1) atom->remove_custom(index, 1, 0); + + index = atom->find_custom("rheo_n_tension", tmp1, tmp2); + if (index != -1) atom->remove_custom(index, 1, 3); + + if (allocated) { + memory->destroy(alpha); + memory->destroy(setflag); + memory->destroy(cutsq); + } +} + +/* ---------------------------------------------------------------------- */ + +void PairRHEOTension::compute(int eflag, int vflag) +{ + int i, j, a, b, ii, jj, inum, jnum, itype, jtype; + int fluidi, fluidj; + double xtmp, ytmp, ztmp, w, wp; + double rhoi, rhoj, voli, volj; + double *dWij, *dWji; + double dx[3], ft[3]; + + int *ilist, *jlist, *numneigh, **firstneigh; + double imass, jmass, rsq, r, rinv; + + int nlocal = atom->nlocal; + int newton_pair = force->newton_pair; + int dim = domain->dimension; + + ev_init(eflag, vflag); + + double **x = atom->x; + double **f = atom->f; + double *rho = atom->rho; + double *mass = atom->mass; + double *special_lj = force->special_lj; + int *type = atom->type; + int *status = atom->status; + tagint *tag = atom->tag; + + inum = list->inum; + ilist = list->ilist; + numneigh = list->numneigh; + firstneigh = list->firstneigh; + + int nmax = atom->nmax; + if (nmax_store <= nmax) { + memory->grow(c_tension, nmax, "atom:rheo_c_tension"); + memory->grow(n_tension, nmax, 3, "atom:rheo_n_tension"); + nmax_store = atom->nmax; + } + + // loop over neighbors of my atoms + + for (ii = 0; ii < inum; ii++) { + i = ilist[ii]; + xtmp = x[i][0]; + ytmp = x[i][1]; + ztmp = x[i][2]; + itype = type[i]; + jlist = firstneigh[i]; + jnum = numneigh[i]; + imass = mass[itype]; + rhoi = rho[i]; + voli = imass / rhoi; + fluidi = !(status[i] & PHASECHECK); + + for (jj = 0; jj < jnum; jj++) { + j = jlist[jj]; + j &= NEIGHMASK; + + dx[0] = xtmp - x[j][0]; + dx[1] = ytmp - x[j][1]; + dx[2] = ztmp - x[j][2]; + rsq = lensq3(dx); + jtype = type[j]; + + if (rsq > hsq) continue; + + r = sqrt(rsq); + rinv = 1 / r; + + jmass = mass[jtype]; + rhoj = rho[j]; + volj = jmass / rhoj; + fluidj = !(status[j] & PHASECHECK); + + wp = compute_kernel->calc_dw(i, j, dx[0], dx[1], dx[2],r); + dWij = compute_kernel->dWij; + dWji = compute_kernel->dWji; + + + + f[i][0] += ft[0]; + f[i][1] += ft[1]; + f[i][2] += ft[2]; + + if (evflag) // Does not account for unbalanced forces + ev_tally_xyz(i, j, nlocal, newton_pair, 0.0, 0.0, ft[0], ft[1], ft[2], dx[0], dx[1], dx[2]); + + if (newton_pair || j < nlocal) { + + f[j][0] -= ft[0]; + f[j][1] -= ft[1]; + f[j][2] -= ft[2]; + } + } + } + + if (vflag_fdotr) virial_fdotr_compute(); + + if (compute_interface) { + comm->reverse_comm(this); + comm->forward_comm(this); + } +} + +/* ---------------------------------------------------------------------- + allocate all arrays + ------------------------------------------------------------------------- */ + +void PairRHEOTension::allocate() +{ + allocated = 1; + int n = atom->ntypes; + + memory->create(setflag, n + 1, n + 1, "pair:setflag"); + for (int i = 1; i <= n; i++) + for (int j = i; j <= n; j++) + setflag[i][j] = 0; + + memory->create(alpha, n + 1, n + 1, "pair:alpha"); + memory->create(cutsq, n + 1, n + 1, "pair:cutsq"); +} + +/* ---------------------------------------------------------------------- + set coeffs for one or more type pairs + ------------------------------------------------------------------------- */ + +void PairRHEOTension::coeff(int narg, char **arg) +{ + if (narg != 3) + error->all(FLERR,"Incorrect number of args for pair_style rheo coefficients"); + if (!allocated) + allocate(); + + int ilo, ihi, jlo, jhi; + utils::bounds(FLERR, arg[0], 1, atom->ntypes, ilo, ihi,error); + utils::bounds(FLERR, arg[1], 1, atom->ntypes, jlo, jhi,error); + + alpha_one = utils::numeric(FLERR, arg[2], false, lmp); + + int count = 0; + for (int i = ilo; i <= ihi; i++) { + for (int j = 0; j <= atom->ntypes; j++) { + alpha[i][j] = alpha_one; + setflag[i][j] = 1; + count++; + } + } + + if (count == 0) + error->all(FLERR,"Incorrect args for pair rheo/tension coefficients"); +} + +/* ---------------------------------------------------------------------- + setup specific to this pair style + ------------------------------------------------------------------------- */ + +void PairRHEOTension::setup() +{ + auto fixes = modify->get_fix_by_style("rheo"); + if (fixes.size() == 0) error->all(FLERR, "Need to define fix rheo to use pair rheo"); + fix_rheo = dynamic_cast(fixes[0]); + + compute_kernel = fix_rheo->compute_kernel; + compute_grad = fix_rheo->compute_grad; + compute_interface = fix_rheo->compute_interface; + h = fix_rheo->h; + csq = fix_rheo->csq; + rho0 = fix_rheo->rho0; + + hsq = h * h; + hinv = 1.0 / h; + hinv3 = hinv * 3.0; +} + +/* ---------------------------------------------------------------------- + init specific to this pair style +------------------------------------------------------------------------- */ + +void PairRHEOTension::init_style() +{ + neighbor->add_request(this); + + + // Create c_tension arrays n_tension arrays if they don't already exist + // Create a custom atom property so it works with compute property/atom + // Do not create grow callback as there's no reason to copy/exchange data + // Manually grow if nmax_store exceeded + // For B and gradC, create a local array since they are unlikely to be printed + + int tmp1, tmp2; + int index = atom->find_custom("rheo_c_tension", tmp1, tmp2); + if (index == -1) index = atom->add_custom("rheo_c_tension", 1, 0); + ct = atom->dvector[index]; + + index = atom->find_custom("rheo_n_tension", tmp1, tmp2); + if (index == -1) index = atom->add_custom("rheo_n_tension", 1, 3); + nt = atom->darray[index]; + + nmax_store = atom->nmax; +} + +/* ---------------------------------------------------------------------- + init for one type pair i,j and corresponding j,i + ------------------------------------------------------------------------- */ + +double PairRHEOTension::init_one(int i, int j) +{ + if (setflag[i][j] == 0) + error->all(FLERR,"All pair rheo/tension coeffs are not set"); + + alpha[j][i] = alpha[i][j]; + + return h; +} + + +/* ---------------------------------------------------------------------- */ + +int PairRHEOTension::pack_forward_comm(int n, int *list, double *buf, int /*pbc_flag*/, int * /*pbc*/) +{ + int i,j,k,m; + m = 0; + double *rho = atom->rho; + + for (i = 0; i < n; i++) { + j = list[i]; + if (comm_stage == 0) { + buf[m++] = fp_store[j][0]; + buf[m++] = fp_store[j][1]; + buf[m++] = fp_store[j][2]; + } else { + buf[m++] = chi[j]; + buf[m++] = rho[j]; + } + } + return m; +} + +/* ---------------------------------------------------------------------- */ + +void PairRHEOTension::unpack_forward_comm(int n, int first, double *buf) +{ + int i, k, m, last; + double *rho = atom->rho; + m = 0; + last = first + n; + for (i = first; i < last; i++) { + if (comm_stage == 0) { + fp_store[i][0] = buf[m++]; + fp_store[i][1] = buf[m++]; + fp_store[i][2] = buf[m++]; + } else { + chi[i] = buf[m++]; + rho[i] = buf[m++]; + } + } +} + + +/* ---------------------------------------------------------------------- */ + +int PairRHEOTension::pack_reverse_comm(int n, int first, double *buf) +{ + int i, k, m, last; + double **fp_store = compute_interface->fp_store; + + m = 0; + last = first + n; + for (i = first; i < last; i++) { + buf[m++] = fp_store[i][0]; + buf[m++] = fp_store[i][1]; + buf[m++] = fp_store[i][2]; + } + + return m; +} + +/* ---------------------------------------------------------------------- */ + +void PairRHEOTension::unpack_reverse_comm(int n, int *list, double *buf) +{ + int i, j, k, m; + double **fp_store = compute_interface->fp_store; + + m = 0; + for (i = 0; i < n; i++) { + j = list[i]; + fp_store[j][0] += buf[m++]; + fp_store[j][1] += buf[m++]; + fp_store[j][2] += buf[m++]; + } +} diff --git a/src/RHEO/pair_rheo_tension.h b/src/RHEO/pair_rheo_tension.h new file mode 100644 index 0000000000..9b75b05ebd --- /dev/null +++ b/src/RHEO/pair_rheo_tension.h @@ -0,0 +1,56 @@ +/* -*- 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 PAIR_CLASS +// clang-format off +PairStyle(rheo/tension,PairRHEOTension) +// clang-format on +#else + +#ifndef LMP_PAIR_RHEO_TENSION_H +#define LMP_PAIR_RHEO_TENSION_H + +#include "pair.h" + +namespace LAMMPS_NS { + +class PairRHEOTension : public Pair { + public: + PairRHEOTension(class LAMMPS *); + ~PairRHEOTension() override; + void compute(int, int) override; + void coeff(int, char **) override; + void setup() override; + void init_style() override; + double init_one(int, int) override; + void unpack_forward_comm(int, int, double *) override; + int pack_reverse_comm(int, int, double *) override; + int pack_reverse_comm(int, int, double *) override; + void unpack_reverse_comm(int, int *, double *) override; + + protected: + int nmax_store; + double **nt, *ct; + double *alpha; + double hsq, hinv, hinv3; + + void allocate(); + + class ComputeRHEOKernel *compute_kernel; + class FixRHEO *fix_rheo; +}; + +} // namespace LAMMPS_NS + +#endif +#endif From f28e46d40e5ad5e883849a7412faccd2d58b1d6f Mon Sep 17 00:00:00 2001 From: jtclemm Date: Thu, 19 Oct 2023 11:57:07 -0600 Subject: [PATCH 047/158] Adding support for remap v --- src/RHEO/compute_rheo_grad.cpp | 28 ++++++++++++++++++++++++---- src/RHEO/compute_rheo_grad.h | 2 +- src/RHEO/fix_rheo.cpp | 2 +- 3 files changed, 26 insertions(+), 6 deletions(-) diff --git a/src/RHEO/compute_rheo_grad.cpp b/src/RHEO/compute_rheo_grad.cpp index 369bf11e0d..7fdff41403 100644 --- a/src/RHEO/compute_rheo_grad.cpp +++ b/src/RHEO/compute_rheo_grad.cpp @@ -111,6 +111,8 @@ void ComputeRHEOGrad::init() compute_kernel = fix_rheo->compute_kernel; compute_interface = fix_rheo->compute_interface; + remap_v_flag = domain->deform_vremap; + neighbor->add_request(this, NeighConst::REQ_DEFAULT); } @@ -301,13 +303,23 @@ void ComputeRHEOGrad::forward_fields() /* ---------------------------------------------------------------------- */ int ComputeRHEOGrad::pack_forward_comm(int n, int *list, double *buf, - int /*pbc_flag*/, int * /*pbc*/) + int pbc_flag, int *pbc) { int i,j,k,m; + int *mask = atom->mask; double *rho = atom->rho; double *temperature = atom->temperature; double **v = atom->v; int dim = domain->dimension; + double *h_rate = domain->h_rate; + int deform_groupbit = domain->deform_groupbit; + double dv[3]; + + if (remap_v_flag) { + dv[0] = pbc[0] * h_rate[0] + pbc[5] * h_rate[5] + pbc[4] * h_rate[4]; + dv[1] = pbc[1] * h_rate[1] + pbc[3] * h_rate[3]; + dv[2] = pbc[2] * h_rate[2]; + } m = 0; @@ -333,9 +345,17 @@ int ComputeRHEOGrad::pack_forward_comm(int n, int *list, double *buf, } else if (comm_stage == COMMFIELD) { - if (velocity_flag) - for (k = 0; k < dim; k++) - buf[m++] = v[j][k]; + if (velocity_flag) { + if (remap_v_flag & pbc_flag & (mask[j] & deform_groupbit)) { + for (k = 0; k < dim; k++) + buf[m++] = v[j][k] + dv[k]; + } else { + for (k = 0; k < dim; k++) + buf[m++] = v[j][k]; + } + } + + if (rho_flag) buf[m++] = rho[j]; diff --git a/src/RHEO/compute_rheo_grad.h b/src/RHEO/compute_rheo_grad.h index af4fecdcfb..db5e84d32a 100644 --- a/src/RHEO/compute_rheo_grad.h +++ b/src/RHEO/compute_rheo_grad.h @@ -49,7 +49,7 @@ class ComputeRHEOGrad : public Compute { double cut, cutsq, rho0; int velocity_flag, temperature_flag, rho_flag, eta_flag; - int interface_flag; + int interface_flag, remap_v_flag; class ComputeRHEOKernel *compute_kernel; class ComputeRHEOInterface *compute_interface; diff --git a/src/RHEO/fix_rheo.cpp b/src/RHEO/fix_rheo.cpp index 339d7f5ac8..e26ce8744b 100644 --- a/src/RHEO/fix_rheo.cpp +++ b/src/RHEO/fix_rheo.cpp @@ -381,13 +381,13 @@ void FixRHEO::pre_force(int /*vflag*/) if (rhosum_flag) compute_rhosum->compute_peratom(); - compute_grad->forward_fields(); // also forwards v and rho for chi compute_kernel->compute_peratom(); if (interface_flag) { // Note on first setup, have no forces for pressure to reference compute_interface->compute_peratom(); } + // No need to forward v, rho, or T for compute_grad since already done compute_grad->compute_peratom(); compute_grad->forward_gradients(); From 5986fb90b93c00b11318ec69e96bdeafe83ce55a Mon Sep 17 00:00:00 2001 From: jtclemm Date: Thu, 19 Oct 2023 12:37:59 -0600 Subject: [PATCH 048/158] Few updates to surface tension, add stress fix --- src/.gitignore | 2 + src/RHEO/fix_rheo_stress.cpp | 137 +++++++++++++++++++++++++++++++++ src/RHEO/fix_rheo_stress.h | 48 ++++++++++++ src/RHEO/pair_rheo_tension.cpp | 12 +-- src/RHEO/pair_rheo_tension.h | 2 +- 5 files changed, 192 insertions(+), 9 deletions(-) create mode 100644 src/RHEO/fix_rheo_stress.cpp create mode 100644 src/RHEO/fix_rheo_stress.h diff --git a/src/.gitignore b/src/.gitignore index 7b645ee347..cc792388a6 100644 --- a/src/.gitignore +++ b/src/.gitignore @@ -217,6 +217,8 @@ /fix_rheo.h /fix_rheo_pressure.cpp /fix_rheo_pressure.h +/fix_rheo_stress.cpp +/fix_rheo_stress.h /fix_rheo_thermal.cpp /fix_rheo_thermal.h /fix_rheo_viscosity.cpp diff --git a/src/RHEO/fix_rheo_stress.cpp b/src/RHEO/fix_rheo_stress.cpp new file mode 100644 index 0000000000..b391527f1c --- /dev/null +++ b/src/RHEO/fix_rheo_stress.cpp @@ -0,0 +1,137 @@ +/* ---------------------------------------------------------------------- + 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 authors: Joel Clemmer (SNL) +----------------------------------------------------------------------- */ + +#include "fix_rheo_stress.h" + +#include "atom.h" +#include "comm.h" +#include "compute.h" +#include "domain.h" +#include "fix_store_atom.h" +#include "group.h" +#include "error.h" +#include "modify.h" +#include "update.h" + +#include +#include + +using namespace LAMMPS_NS; +using namespace FixConst; + +/* ---------------------------------------------------------------------- */ + +FixRHEOStress::FixRHEOStress(LAMMPS *lmp, int narg, char **arg) : + id_compute(nullptr), id_fix(nullptr), stress_compute(nullptr), store_fix(nullptr), Fix(lmp, narg, arg) +{ + if (narg != 3) error->all(FLERR,"Illegal fix rheo/stress command"); + comm_forward = 6; +} + +/* ---------------------------------------------------------------------- */ + +FixRHEOStress::~FixRHEOStress() +{ + modify->delete_compute(id_compute); + modify->delete_fix(id_fix); +} + +/* ---------------------------------------------------------------------- */ + +void FixRHEOStress::post_constructor() +{ + id_fix = utils::strdup(std::string(id) + "_store"); + store_fix = dynamic_cast(modify->add_fix(fmt::format("{} {} STORE/ATOM d_pxx d_pyy d_pzz d_pxy d_pxz d_pyz", id_fix, group->names[igroup]))); + array_atom = store_fix->astore; + + id_compute = utils::strdup(std::string(id) + "_compute"); + stress_compute = modify->add_compute(fmt::format("{} {} stress/atom NULL ke pair bond", id_compute, group->names[igroup])); +} + +/* ---------------------------------------------------------------------- */ + +int FixRHEOStress::setmask() +{ + int mask = 0; + mask |= PRE_FORCE; + mask |= END_OF_STEP; + return mask; +} + +/* ---------------------------------------------------------------------- */ + +void FixRHEOStress::init() +{ + stress_compute->addstep(update->ntimestep+1); +} + +/* ---------------------------------------------------------------------- */ + +void FixRHEOStress::pre_force(int vflag) +{ + // add pre-force and forward to ghosts (not done in store/atom) + comm->forward_comm(this); +} + +/* ---------------------------------------------------------------------- */ + +void FixRHEOStress::end_of_step() +{ + stress_compute->compute_peratom(); + + // copy compute to fix property atom + double **saved_stress = store_fix->astore; + double **stress = stress_compute->array_atom; + + int ntotal = atom->nlocal+atom->nghost; + for (int i = 0; i < ntotal; i++) + for (int a = 0; a < 6; a++) + saved_stress[i][a] = stress[i][a]; + + stress_compute->addstep(update->ntimestep + 1); +} + +/* ---------------------------------------------------------------------- */ + +int FixRHEOStress::pack_forward_comm(int n, int *list, double *buf, + int /*pbc_flag*/, int * /*pbc*/) +{ + int i, j, a, m; + double **saved_stress = store_fix->astore; + + m = 0; + for (i = 0; i < n; i++) { + j = list[i]; + for (a = 0; a < 6; a++) + buf[m++] = saved_stress[j][a]; + } + return m; +} + +/* ---------------------------------------------------------------------- */ + +void FixRHEOStress::unpack_forward_comm(int n, int first, double *buf) +{ + int i, a, m, last; + double **saved_stress = store_fix->astore; + + m = 0; + last = first + n; + for (i = first; i < last; i++) + for (a = 0; a < 6; a++) + saved_stress[i][a] = buf[m++]; +} diff --git a/src/RHEO/fix_rheo_stress.h b/src/RHEO/fix_rheo_stress.h new file mode 100644 index 0000000000..4bf522793f --- /dev/null +++ b/src/RHEO/fix_rheo_stress.h @@ -0,0 +1,48 @@ +/* -*- 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(rheo/stress,FixRHEOStress); +// clang-format on +#else + +#ifndef LMP_FIX_RHEO_STRESS_H +#define LMP_FIX_RHEO_STRESS_H + +#include "fix.h" + +namespace LAMMPS_NS { + +class FixRHEOStress : public Fix { + public: + FixRHEOStress(class LAMMPS *, int, char **); + ~FixRHEOStress() override; + void post_constructor() override; + int setmask() override; + void init() override; + void pre_force(int) override; + void end_of_step() override; + int pack_forward_comm(int, int *, double *, int, int *) override; + void unpack_forward_comm(int, int, double *) override; + + private: + char *id_compute, *id_fix; + class Compute *stress_compute; + class FixStoreAtom *store_fix; +}; + +} // namespace LAMMPS_NS + +#endif +#endif diff --git a/src/RHEO/pair_rheo_tension.cpp b/src/RHEO/pair_rheo_tension.cpp index 5899c87e3e..824f496161 100644 --- a/src/RHEO/pair_rheo_tension.cpp +++ b/src/RHEO/pair_rheo_tension.cpp @@ -109,8 +109,8 @@ void PairRHEOTension::compute(int eflag, int vflag) int nmax = atom->nmax; if (nmax_store <= nmax) { - memory->grow(c_tension, nmax, "atom:rheo_c_tension"); - memory->grow(n_tension, nmax, 3, "atom:rheo_n_tension"); + memory->grow(ct, nmax, "atom:rheo_c_tension"); + memory->grow(nnt_tension, nmax, 3, "atom:rheo_n_tension"); nmax_store = atom->nmax; } @@ -153,8 +153,6 @@ void PairRHEOTension::compute(int eflag, int vflag) dWij = compute_kernel->dWij; dWji = compute_kernel->dWji; - - f[i][0] += ft[0]; f[i][1] += ft[1]; f[i][2] += ft[2]; @@ -173,10 +171,8 @@ void PairRHEOTension::compute(int eflag, int vflag) if (vflag_fdotr) virial_fdotr_compute(); - if (compute_interface) { - comm->reverse_comm(this); - comm->forward_comm(this); - } + comm->reverse_comm(this); + comm->forward_comm(this); } /* ---------------------------------------------------------------------- diff --git a/src/RHEO/pair_rheo_tension.h b/src/RHEO/pair_rheo_tension.h index 9b75b05ebd..d1799b65e7 100644 --- a/src/RHEO/pair_rheo_tension.h +++ b/src/RHEO/pair_rheo_tension.h @@ -33,9 +33,9 @@ class PairRHEOTension : public Pair { void setup() override; void init_style() override; double init_one(int, int) override; + int pack_forward_comm(int, int *, double *, int, int *) override; void unpack_forward_comm(int, int, double *) override; int pack_reverse_comm(int, int, double *) override; - int pack_reverse_comm(int, int, double *) override; void unpack_reverse_comm(int, int *, double *) override; protected: From 0d2b3dc51e1bc4c478723a29bb653f0036a92205 Mon Sep 17 00:00:00 2001 From: jtclemm Date: Sun, 22 Oct 2023 14:54:27 -0600 Subject: [PATCH 049/158] Drafting oxide model --- src/.gitignore | 2 + src/RHEO/pair_rheo_react.cpp | 587 +++++++++++++++++++++++++++++++++++ src/RHEO/pair_rheo_react.h | 60 ++++ 3 files changed, 649 insertions(+) create mode 100644 src/RHEO/pair_rheo_react.cpp create mode 100644 src/RHEO/pair_rheo_react.h diff --git a/src/.gitignore b/src/.gitignore index f9794ddb82..099b905eb2 100644 --- a/src/.gitignore +++ b/src/.gitignore @@ -223,6 +223,8 @@ /fix_rheo_viscosity.h /pair_rheo.cpp /pair_rheo.h +/pair_rheo_react.cpp +/pair_rheo_react.h /compute_grid.cpp /compute_grid.h diff --git a/src/RHEO/pair_rheo_react.cpp b/src/RHEO/pair_rheo_react.cpp new file mode 100644 index 0000000000..49c24cf501 --- /dev/null +++ b/src/RHEO/pair_rheo_react.cpp @@ -0,0 +1,587 @@ +/* ---------------------------------------------------------------------- + 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 authors: + Joel Clemmer (SNL) +----------------------------------------------------------------------- */ + +#include "pair_rheo_react.h" + +#include "atom.h" +#include "comm.h" +#include "error.h" +#include "fix.h" +#include "fix_dummy.h" +#include "fix_neigh_history.h" +#include "fix_rheo.h" +#include "force.h" +#include "memory.h" +#include "modify.h" +#include "neighbor.h" +#include "neigh_list.h" +#include "neigh_request.h" +#include "update.h" +#include "utils.h" + +using namespace LAMMPS_NS; + +/* ---------------------------------------------------------------------- */ + +PairRHEOReact::PairRHEOReact(LAMMPS *lmp) : Pair(lmp), + dbond(NULL) +{ + single_enable = 0; + size_history = 2; + beyond_contact = 1; + comm_reverse = 1; + + // create dummy fix as placeholder for FixNeighHistory + // this is so final order of Modify:fix will conform to input script + + fix_history = nullptr; + fix_dummy = dynamic_cast( + modify->add_fix("NEIGH_HISTORY_RHEO_REACT_DUMMY" + std::to_string(instance_me) + " all DUMMY")); + + // For nbond, create an instance of fix property atom + // Need restarts + exchanging with neighbors since it needs to persist + // between timesteps (fix property atom will handle callbacks) + + int tmp1, tmp2; + int index = atom->find_custom("react_nbond", tmp1, tmp2); + if (index == -1) { + id_fix_pa = utils::strdup("pair_rheo_react_fix_property_atom"); + modify->add_fix(fmt::format("{} all property/atom i_react_nbond", id_fix_pa)); + index = atom->find_custom("nbond", tmp1, tmp2); + } + nbond = atom->ivector[index]; + + //Store non-persistent per atom quantities, intermediate + + nmax_store = atom->nmax; + memory->create(dbond, nmax_store, "rheo/react:dbond"); +} + +/* ---------------------------------------------------------------------- */ + +PairRHEOReact::~PairRHEOReact() +{ + if (modify->nfix && fix_history) modify->delete_fix("NEIGH_HISTORY_RHEO_REACT"); + if (modify->nfix && fix_dummy) modify->delete_fix("NEIGH_HISTORY_RHEO_REACT_DUMMY"); + if (modify->nfix) modify->delete_fix("PROPERTY_ATOM_RHEO_REACT"); + + if (allocated) { + memory->destroy(setflag); + memory->destroy(cutsq); + memory->destroy(cutbsq); + + memory->destroy(cut); + memory->destroy(cutbond); + memory->destroy(k); + memory->destroy(eps); + memory->destroy(gamma); + memory->destroy(t_form); + memory->destroy(rlimit); + memory->destroy(sigma); + memory->destroy(krepel); + } + + memory->destroy(dbond); +} + +/* ---------------------------------------------------------------------- */ + +void PairRHEOReact::compute(int eflag, int vflag) +{ + int i,j,ii,jj,inum,jnum; + double xtmp,ytmp,ztmp,delx,dely,delz; + double rsq,r,rinv,r0; + double vxtmp,vytmp,vztmp,delvx,delvy,delvz; + double fpair,dot,evdwl,smooth; + int itype, jtype; + + int *ilist,*jlist,*numneigh,**firstneigh; + int *saved,**firstsaved; + double *data,*alldata,**firstdata; + + ev_init(eflag,vflag); + + int bondupdate = 1; + if (update->setupflag) bondupdate = 0; + + dt = update->dt; + + double **x = atom->x; + double **v = atom->v; + double **f = atom->f; + int *type = atom->type; + int *phase = atom->phase; + int *mask = atom->mask; + int *nbond = atom->ivector[index_nb]; + int *surface = atom->surface; + double *rsurf = atom->dvector[index_rsurf]; + + int nlocal = atom->nlocal; + int newton_pair = force->newton_pair; + + inum = list->inum; + ilist = list->ilist; + numneigh = list->numneigh; + firstneigh = list->firstneigh; + firstsaved = fix_history->firstflag; + firstdata = fix_history->firstvalue; + + if (atom->nmax > nmax){ + nmax = atom->nmax; + memory->destroy(dbond); + memory->create(dbond, nmax, "rheo/react:dbond"); + } + + // Switch to no shift if it has bonds (could have just been changed from reactive) + for(i = 0; i < nmax; i++) { + dbond[i] = 0; + } + + // loop over neighbors of my atoms + for (ii = 0; ii < inum; ii++) { + i = ilist[ii]; + itype = type[i]; + xtmp = x[i][0]; + ytmp = x[i][1]; + ztmp = x[i][2]; + vxtmp = v[i][0]; + vytmp = v[i][1]; + vztmp = v[i][2]; + saved = firstsaved[i]; + alldata = firstdata[i]; + jlist = firstneigh[i]; + jnum = numneigh[i]; + + for (jj = 0; jj < jnum; jj++) { + j = jlist[jj]; + j &= NEIGHMASK; + jtype = type[j]; + data = &alldata[2*jj]; + + // If not bonded and there's an internal fluid particle, unsave any data and skip + if (!(saved[jj] == 1 && data[0] > 0)) { + if ((phase[i] <= FixRHEO::FLUID_MAX && rsurf[i] > rlimit[itype][jtype]) || (phase[j] <= FixRHEO::FLUID_MAX && rsurf[j] > rlimit[itype][jtype])) { + saved[jj] = 0; + continue; + } + } + + // If both are solid, unbond and skip + if ((phase[i] == FixRHEO::SOLID || phase[i] == FixRHEO::FREEZING) && + (phase[j] == FixRHEO::SOLID || phase[j] == FixRHEO::FREEZING)) { + //If bonded, deincrement + if (saved[jj] == 1 && data[0] > 0) { + dbond[i] --; + dbond[j] --; + } + saved[jj] = 0; + continue; + } + + // Remaining options are react+sold, react+react, react+surf/fluid, or surf/fluid+surf/fluid + + delx = xtmp - x[j][0]; + dely = ytmp - x[j][1]; + delz = ztmp - x[j][2]; + rsq = delx*delx + dely*dely + delz*delz; + + // If unbonded and beyond bond distance, unsave and skip + if (data[0] == -1 && rsq > cutbsq[itype][jtype]) { + saved[jj] = 0; + continue; + } + + r = sqrt(rsq); + // Initialize data if not currently saved since all could bond if they are on the surface + if (saved[jj] == 0) { + data[0] = -1; + data[1] = 0; + saved[jj] = 1; + } + + // Check for bond formation (unbonded) or breakage (bonded) + if (data[0] == -1) { + // If unbonded, check if we count down to bonding if both on surface (not given for r or s) + if (bondupdate && rsurf[i] <= rlimit[itype][jtype] && rsurf[j] <= rlimit[itype][jtype]) { + data[1] += dt; + if (data[1] >= t_form[itype][jtype]) { + data[0] = r; + dbond[i] ++; + dbond[j] ++; + data[1] = 0; + } + } + } else { + // If bonded, check if breaks in tension + r0 = data[0]; + if (r > ((1.0+eps[itype][jtype])*r0)) { + saved[jj] = 0; + dbond[i] --; + dbond[j] --; + data[0] = -1; + } + } + + // Apply forces + delvx = vxtmp - v[j][0]; + delvy = vytmp - v[j][1]; + delvz = vztmp - v[j][2]; + rinv = 1.0/r; + + if (data[0] <= 0) { + // Skip if either is fluid (only include r+s or r+r since already skipped s+s) + if (phase[i] <= FixRHEO::FLUID_MAX || phase[j] <= FixRHEO::FLUID_MAX) continue; + + // Skip if out of contact + if (rsq > sigma[itype][jtype]*sigma[itype][jtype]) continue; + + fpair = krepel[itype][jtype]*(sigma[itype][jtype]-r); + if (eflag) + evdwl = -0.5*krepel[itype][jtype]*(sigma[itype][jtype]-r)*(sigma[itype][jtype]-r); + + smooth = rsq/(sigma[itype][jtype]*sigma[itype][jtype]); + smooth *= smooth; + smooth = 1.0 - smooth; + dot = delx*delvx + dely*delvy + delz*delvz; + fpair -= gamma[itype][jtype]*dot*smooth*rinv; + + fpair *= rinv; + + f[i][0] += delx*fpair; + f[i][1] += dely*fpair; + f[i][2] += delz*fpair; + if (newton_pair || j < nlocal) { + f[j][0] -= delx*fpair; + f[j][1] -= dely*fpair; + f[j][2] -= delz*fpair; + } + + if (evflag) ev_tally(i,j,nlocal,newton_pair,evdwl,0.0,fpair,delx,dely,delz); + } else { + // Bonded + r0 = data[0]; + + fpair = k[itype][jtype]*(r0-r); + if (evflag) evdwl = -0.5*fpair*(r0-r); + + dot = delx*delvx + dely*delvy + delz*delvz; + fpair -= gamma[itype][jtype]*dot*rinv; + + smooth = 1.0; + if (r > r0) { + smooth = (r-r0)/(r0*eps[itype][jtype]); + smooth *= smooth; + smooth *= smooth; + smooth = 1 - smooth; + } + + fpair *= rinv*smooth; + + f[i][0] += delx*fpair; + f[i][1] += dely*fpair; + f[i][2] += delz*fpair; + if (newton_pair || j < nlocal) { + f[j][0] -= delx*fpair; + f[j][1] -= dely*fpair; + f[j][2] -= delz*fpair; + } + + if (evflag) ev_tally(i,j,nlocal,newton_pair,evdwl,0.0,fpair,delx,dely,delz); + } + } + } + + // Communicate changes in nbond + if(newton_pair) comm->reverse_comm_pair(this); + + for(i = 0; i < nlocal; i++) { + nbond[i] += dbond[i]; + + // If it has bonds it is reactive (no shifting) + // If a reactive particle breaks all bonds, return to fluid + // Keep it non-shifting for this timestep to be safe + if (nbond[i] != 0 && phase[i] <= FixRHEO::FLUID_MAX) phase[i] = FixRHEO::FLUID_NO_SHIFT; + } + + if (vflag_fdotr) virial_fdotr_compute(); +} + +/* ---------------------------------------------------------------------- + allocate all arrays +------------------------------------------------------------------------- */ + +void PairRHEOReact::allocate() +{ + allocated = 1; + int n = atom->ntypes; + + memory->create(setflag,n+1,n+1,"pair:setflag"); + for (int i = 1; i <= n; i++) + for (int j = i; j <= n; j++) + setflag[i][j] = 0; + + memory->create(cut,n+1,n+1,"pair:cut"); + memory->create(cutbond,n+1,n+1,"pair:cutbond"); + memory->create(cutsq,n+1,n+1,"pair:cutsq"); + memory->create(cutbsq,n+1,n+1,"pair:cutbsq"); + memory->create(k,n+1,n+1,"pair:k"); + memory->create(eps,n+1,n+1,"pair:eps"); + memory->create(gamma,n+1,n+1,"pair:gamma"); + memory->create(t_form,n+1,n+1,"pair:t_form"); + memory->create(rlimit,n+1,n+1,"pair:rlimit"); + memory->create(sigma,n+1,n+1,"pair:sigma"); + memory->create(krepel,n+1,n+1,"pair:krepel"); +} + +/* ---------------------------------------------------------------------- + global settings + ------------------------------------------------------------------------- */ + +void PairRHEOReact::settings(int narg, char **arg) +{ +} + +/* ---------------------------------------------------------------------- + set coeffs for one or more type pairs +------------------------------------------------------------------------- */ + +void PairRHEOReact::coeff(int narg, char **arg) +{ + if (narg != 11) error->all(FLERR,"Incorrect args for pair coefficients"); + if (!allocated) allocate(); + + int ilo,ihi,jlo,jhi; + utils::bounds(FLERR,arg[0],1, atom->ntypes, ilo, ihi,error); + utils::bounds(FLERR,arg[1],1, atom->ntypes, jlo, jhi,error); + + double cut_one = utils::numeric(FLERR,arg[2],false,lmp); + double cutb_one = utils::numeric(FLERR,arg[3],false,lmp); + double k_one = utils::numeric(FLERR,arg[4],false,lmp); + double eps_one = utils::numeric(FLERR,arg[5],false,lmp); + double gamma_one = utils::numeric(FLERR,arg[6],false,lmp); + double t_form_one = utils::numeric(FLERR,arg[7],false,lmp); + double rlimit_one = utils::numeric(FLERR,arg[8],false,lmp); + double sigma_one = utils::numeric(FLERR,arg[9],false,lmp); + double krepel_one = utils::numeric(FLERR,arg[10],false,lmp); + + if (k_one < 0.0 || eps_one < 0.0 || + t_form_one < 0.0 || (1.0+eps_one)*cutb_one > cut_one) + error->all(FLERR,"Illegal pair_style command"); + + int count = 0; + for (int i = ilo; i <= ihi; i++) { + for (int j = MAX(jlo,i); j <= jhi; j++) { + cut[i][j] = cut_one; + cutbond[i][j] = cutb_one; + k[i][j] = k_one; + eps[i][j] = eps_one; + gamma[i][j] = gamma_one; + t_form[i][j] = t_form_one; + rlimit[i][j] = rlimit_one; + sigma[i][j] = sigma_one; + krepel[i][j] = krepel_one; + setflag[i][j] = 1; + count++; + } + } + + if (count == 0) error->all(FLERR,"Incorrect args for pair coefficients"); +} + +/* ---------------------------------------------------------------------- + init specific to this pair style +------------------------------------------------------------------------- */ + +void PairRHEOReact::init_style() +{ + int irequest = neighbor->request(this,instance_me); + neighbor->requests[irequest]->history = 1; + + if (fix_history == nullptr) { + + // Don't want history[i][j] = -history[j][i] + nondefault_history_transfer = 1; + + char dnumstr[16]; + sprintf(dnumstr,"%d",size_history); + char **fixarg = new char*[4]; + fixarg[0] = (char *) "NEIGH_HISTORY_RHEO_REACT"; + fixarg[1] = (char *) "all"; + fixarg[2] = (char *) "NEIGH_HISTORY"; + fixarg[3] = dnumstr; + modify->replace_fix("NEIGH_HISTORY_RHEO_REACT_DUMMY",4,fixarg,1); + delete [] fixarg; + int ifix = modify->find_fix("NEIGH_HISTORY_RHEO_REACT"); + fix_history = (FixNeighHistory *) modify->fix[ifix]; + fix_history->pair = this; + fix_dummy = nullptr; + } + + int temp_flag; + index_rsurf = atom->find_custom("rsurf", temp_flag); + if ((index_rsurf < 0) || (temp_flag != 1)) + error->all(FLERR, "Pair rheo/react can't find fix property/atom rsurf"); +} + +/* ---------------------------------------------------------------------- + setup specific to this pair style + ------------------------------------------------------------------------- */ + +void PairRHEOReact::setup() { + int ifix = modify->find_fix_by_style("rheo"); + if (ifix == -1) error->all(FLERR, "Using pair rheo/react without fix rheo"); + fix_rheo = ((FixRHEO *) modify->fix[ifix]); + + ifix = modify->find_fix_by_style("rheo/surface"); + if (ifix == -1) error->all(FLERR, "Using pair rheo/react without fix rheo/surface"); + + if (force->newton_pair == 0) error->all(FLERR, + "Pair rheo/react needs newton pair on for bond changes to be consistent"); +} + +/* ---------------------------------------------------------------------- + init for one type pair i,j and corresponding j,i +------------------------------------------------------------------------- */ + +double PairRHEOReact::init_one(int i, int j) +{ + if (setflag[i][j] == 0) error->all(FLERR,"All pair coeffs are not set"); + + double einv = 1/eps[i][j]; + + cutbsq[i][j] = cutbond[i][j]*cutbond[i][j]; + + cutbsq[j][i] = cutbsq[i][j]; + cut[j][i] = cut[i][j]; + cutbond[j][i] = cutbond[i][j]; + k[j][i] = k[i][j]; + eps[j][i] = eps[i][j]; + gamma[j][i] = gamma[i][j]; + t_form[j][i] = t_form[i][j]; + rlimit[j][i] = rlimit[i][j]; + sigma[j][i] = sigma[i][j]; + krepel[j][i] = krepel[i][j]; + + return cut[i][j]; +} + +/* ---------------------------------------------------------------------- + proc 0 writes to restart file +------------------------------------------------------------------------- */ + +void PairRHEOReact::write_restart(FILE *fp) +{ + write_restart_settings(fp); + + int i,j; + for (i = 1; i <= atom->ntypes; i++) + for (j = i; j <= atom->ntypes; j++) + fwrite(&setflag[i][j],sizeof(int),1,fp); + if (setflag[i][j]) { + fwrite(&cut[i][j],sizeof(double),1,fp); + fwrite(&cutbond[i][j],sizeof(double),1,fp); + fwrite(&k[i][j],sizeof(double),1,fp); + fwrite(&eps[i][j],sizeof(double),1,fp); + fwrite(&gamma[i][j],sizeof(double),1,fp); + fwrite(&t_form[i][j],sizeof(double),1,fp); + fwrite(&rlimit[i][j],sizeof(double),1,fp); + fwrite(&sigma[i][j],sizeof(double),1,fp); + fwrite(&krepel[i][j],sizeof(double),1,fp); + } +} + +/* ---------------------------------------------------------------------- + proc 0 reads from restart file, bcasts +------------------------------------------------------------------------- */ + +void PairRHEOReact::read_restart(FILE *fp) +{ + read_restart_settings(fp); + allocate(); + + int i,j; + int me = comm->me; + for (i = 1; i <= atom->ntypes; i++) + for (j = i; j <= atom->ntypes; j++) { + if (me == 0) fread(&setflag[i][j],sizeof(int),1,fp); + MPI_Bcast(&setflag[i][j],1,MPI_INT,0,world); + if (setflag[i][j]) { + if (me == 0) { + fread(&cut[i][j],sizeof(double),1,fp); + fread(&cutbond[i][j],sizeof(double),1,fp); + fread(&k[i][j],sizeof(double),1,fp); + fread(&eps[i][j],sizeof(double),1,fp); + fread(&gamma[i][j],sizeof(double),1,fp); + fread(&t_form[i][j],sizeof(double),1,fp); + fread(&rlimit[i][j],sizeof(double),1,fp); + fread(&sigma[i][j],sizeof(double),1,fp); + fread(&krepel[i][j],sizeof(double),1,fp); + } + MPI_Bcast(&cut[i][j],1,MPI_DOUBLE,0,world); + MPI_Bcast(&cutbond[i][j],1,MPI_DOUBLE,0,world); + MPI_Bcast(&k[i][j],1,MPI_DOUBLE,0,world); + MPI_Bcast(&eps[i][j],1,MPI_DOUBLE,0,world); + MPI_Bcast(&gamma[i][j],1,MPI_DOUBLE,0,world); + MPI_Bcast(&t_form[i][j],1,MPI_DOUBLE,0,world); + MPI_Bcast(&rlimit[i][j],1,MPI_DOUBLE,0,world); + MPI_Bcast(&sigma[i][j],1,MPI_DOUBLE,0,world); + MPI_Bcast(&krepel[i][j],1,MPI_DOUBLE,0,world); + } + } +} + + + + +/* ---------------------------------------------------------------------- + transfer history during fix/neigh/history exchange - transfer same sign +------------------------------------------------------------------------- */ + +void PairRHEOReact::transfer_history(double* source, double* target) +{ + for (int i = 0; i < size_history; i++) + target[i] = source[i]; +} + +/* ---------------------------------------------------------------------- */ + +int PairRHEOReact::pack_reverse_comm(int n, int first, double *buf) +{ + int i,m,last; + + m = 0; + last = first + n; + + for (i = first; i < last; i++) { + buf[m++] = dbond[i]; + } + return m; +} + +/* ---------------------------------------------------------------------- */ + +void PairRHEOReact::unpack_reverse_comm(int n, int *list, double *buf) +{ + int i,j,m; + + m = 0; + for (i = 0; i < n; i++) { + j = list[i]; + dbond[j] += buf[m++]; + } +} diff --git a/src/RHEO/pair_rheo_react.h b/src/RHEO/pair_rheo_react.h new file mode 100644 index 0000000000..c2a7f26f03 --- /dev/null +++ b/src/RHEO/pair_rheo_react.h @@ -0,0 +1,60 @@ +/* -*- 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 PAIR_CLASS +// clang-format off +PairStyle(rheo/react,PairRHEOReact) +// clang-format on +#else + +#ifndef LMP_PAIR_RHEO_REACT_H +#define LMP_PAIR_RHEO_REACT_H + +#include "pair.h" + +namespace LAMMPS_NS { + +class PairRHEOReact : public Pair { + public: + PairRHEOReact(class LAMMPS *); + virtual ~PairRHEOReact() override; + virtual void compute(int, int) override; + void settings(int, char **) override; + void coeff(int, char **) override; + void init_style() override; + void setup() override; + double init_one(int, int) override; + void write_restart(FILE *) override; + void read_restart(FILE *) override; + int pack_reverse_comm(int, int, double *) override; + void unpack_reverse_comm(int, int *, double *) override; + + protected: + double **cut,**cutbond,**cutbsq, **k, **eps, **gamma, **t_form, **rlimit, **sigma, **krepel; + + void allocate(); + void transfer_history(double*, double*); + + int size_history, nmax_store; + int *dbond, *nbond; + double dt; + + class FixDummy *fix_dummy; + class FixNeighHistory *fix_history; + class FixRHEO *fix_rheo; +}; + +} // namespace LAMMPS_NS + +#endif +#endif From 0945c3dda850aa6635be7f5aa7124c24ce992a23 Mon Sep 17 00:00:00 2001 From: jtclemm Date: Mon, 30 Oct 2023 20:22:14 -0600 Subject: [PATCH 050/158] Bug in rheo, cleaning up old files --- src/RHEO/fix_rheo.cpp | 4 +- src/atom_vec_rheo_thermal.cpp | 200 ---------------------------------- src/atom_vec_rheo_thermal.h | 46 -------- 3 files changed, 2 insertions(+), 248 deletions(-) delete mode 100644 src/atom_vec_rheo_thermal.cpp delete mode 100644 src/atom_vec_rheo_thermal.h diff --git a/src/RHEO/fix_rheo.cpp b/src/RHEO/fix_rheo.cpp index e26ce8744b..c8dca74d32 100644 --- a/src/RHEO/fix_rheo.cpp +++ b/src/RHEO/fix_rheo.cpp @@ -94,11 +94,11 @@ FixRHEO::FixRHEO(LAMMPS *lmp, int narg, char **arg) : } else if (strcmp(arg[iarg],"surface/detection") == 0) { surface_flag = 1; if(iarg + 2 >= narg) error->all(FLERR,"Illegal surface/detection option in fix rheo"); - if (strcmp(arg[iarg + 1], "coordination")) { + if (strcmp(arg[iarg + 1], "coordination") == 0) { surface_style = COORDINATION; zmin_surface = utils::inumeric(FLERR,arg[iarg + 2],false,lmp); zmin_splash = utils::inumeric(FLERR,arg[iarg + 3],false,lmp); - } else if (strcmp(arg[iarg + 1], "divergence")) { + } else if (strcmp(arg[iarg + 1], "divergence") == 0) { surface_style = DIVR; divr_surface = utils::numeric(FLERR,arg[iarg + 2],false,lmp); zmin_splash = utils::inumeric(FLERR,arg[iarg + 3],false,lmp); diff --git a/src/atom_vec_rheo_thermal.cpp b/src/atom_vec_rheo_thermal.cpp deleted file mode 100644 index de0c7fa5d7..0000000000 --- a/src/atom_vec_rheo_thermal.cpp +++ /dev/null @@ -1,200 +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 authors: - Joel Clemmer (SNL), Thomas O'Connor (CMU), Eric Palermo (CMU) ------------------------------------------------------------------------ */ - -#include "atom_vec_rheo_thermal.h" - -#include "atom.h" - -#include - -using namespace LAMMPS_NS; - -/* ---------------------------------------------------------------------- */ - -AtomVecRHEOThermal::AtomVecRHEOThermal(LAMMPS *lmp) : AtomVec(lmp) -{ - molecular = Atom::ATOMIC; - mass_type = PER_TYPE; - forceclearflag = 1; - - atom->status_flag = 1; - atom->conductivity_flag = 1; - atom->temperature_flag = 1; - atom->heatflow_flag = 1; - atom->pressure_flag = 1; - atom->rho_flag = 1; - atom->viscosity_flag = 1; - - // strings with peratom variables to include in each AtomVec method - // strings cannot contain fields in corresponding AtomVec default strings - // order of fields in a string does not matter - // except: fields_data_atom & fields_data_vel must match data file - - fields_grow = {"status", "rho", "drho", "temperature", "heatflow", "conductivity", "pressure", "viscosity"}; - fields_copy = {"status", "rho", "drho", "temperature", "heatflow", "conductivity", "pressure", "viscosity"}; - fields_comm = {"status", "rho", "temperature"}; - fields_comm_vel = {"status", "rho", "temperature"}; - fields_reverse = {"drho", "heatflow"}; - fields_border = {"status", "rho", "temperature"}; - fields_border_vel = {"status", "rho", "temperature"}; - fields_exchange = {"status", "rho", "temperature"}; - fields_restart = {"status", "rho", "temperature"}; - fields_create = {"status", "rho", "drho", "temperature", "heatflow", "conductivity", "pressure", "viscosity"}; - fields_data_atom = {"id", "type", "status", "rho", "temperature", "x"}; - fields_data_vel = {"id", "v"}; - - setup_fields(); -} - -/* ---------------------------------------------------------------------- - set local copies of all grow ptrs used by this class, except defaults - needed in replicate when 2 atom classes exist and it calls pack_restart() -------------------------------------------------------------------------- */ - -void AtomVecRHEOThermal::grow_pointers() -{ - status = atom->status; - conductivity = atom->conductivity; - temperature = atom->temperature; - heatflow = atom->heatflow; - pressure = atom->pressure; - rho = atom->rho; - drho = atom->drho; - viscosity = atom->viscosity; -} - -/* ---------------------------------------------------------------------- - clear extra forces starting at atom N - nbytes = # of bytes to clear for a per-atom vector -------------------------------------------------------------------------- */ - -void AtomVecRHEOThermal::force_clear(int n, size_t nbytes) -{ - memset(&drho[n], 0, nbytes); - memset(&heatflow[n], 0, nbytes); -} - -/* ---------------------------------------------------------------------- - modify what AtomVec::data_atom() just unpacked - or initialize other atom quantities -------------------------------------------------------------------------- */ - -void AtomVecRHEOThermal::data_atom_post(int ilocal) -{ - drho[ilocal] = 0.0; - heatflow[ilocal] = 0.0; - pressure[ilocal] = 0.0; - viscosity[ilocal] = 0.0; - conductivity[ilocal] = 0.0; -} - -/* ---------------------------------------------------------------------- - assign an index to named atom property and return index - return -1 if name is unknown to this atom style -------------------------------------------------------------------------- */ - -int AtomVecRHEOThermal::property_atom(const std::string &name) -{ - if (name == "status") return 0; - if (name == "rho") return 1; - if (name == "drho") return 2; - if (name == "temperature") return 3; - if (name == "heatflow") return 4; - if (name == "conductivity") return 5; - if (name == "pressure") return 6; - if (name == "viscosity") return 7; - return -1; -} - -/* ---------------------------------------------------------------------- - pack per-atom data into buf for ComputePropertyAtom - index maps to data specific to this atom style -------------------------------------------------------------------------- */ - -void AtomVecRHEOThermal::pack_property_atom(int index, double *buf, int nvalues, int groupbit) -{ - int *mask = atom->mask; - int nlocal = atom->nlocal; - int n = 0; - - if (index == 0) { - for (int i = 0; i < nlocal; i++) { - if (mask[i] & groupbit) - buf[n] = status[i]; - else - buf[n] = 0.0; - n += nvalues; - } - } else if (index == 1) { - for (int i = 0; i < nlocal; i++) { - if (mask[i] & groupbit) - buf[n] = rho[i]; - else - buf[n] = 0.0; - n += nvalues; - } - } else if (index == 2) { - for (int i = 0; i < nlocal; i++) { - if (mask[i] & groupbit) - buf[n] = drho[i]; - else - buf[n] = 0.0; - n += nvalues; - } - } else if (index == 3) { - for (int i = 0; i < nlocal; i++) { - if (mask[i] & groupbit) - buf[n] = temperature[i]; - else - buf[n] = 0.0; - n += nvalues; - } - } else if (index == 4) { - for (int i = 0; i < nlocal; i++) { - if (mask[i] & groupbit) - buf[n] = heatflow[i]; - else - buf[n] = 0.0; - n += nvalues; - } - } else if (index == 5) { - for (int i = 0; i < nlocal; i++) { - if (mask[i] & groupbit) - buf[n] = conductivity[i]; - else - buf[n] = 0.0; - n += nvalues; - } - } else if (index == 6) { - for (int i = 0; i < nlocal; i++) { - if (mask[i] & groupbit) - buf[n] = pressure[i]; - else - buf[n] = 0.0; - n += nvalues; - } - } else if (index == 7) { - for (int i = 0; i < nlocal; i++) { - if (mask[i] & groupbit) - buf[n] = viscosity[i]; - else - buf[n] = 0.0; - n += nvalues; - } - } -} diff --git a/src/atom_vec_rheo_thermal.h b/src/atom_vec_rheo_thermal.h deleted file mode 100644 index 27c6c3c9b5..0000000000 --- a/src/atom_vec_rheo_thermal.h +++ /dev/null @@ -1,46 +0,0 @@ -/* -*- 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 ATOM_CLASS -// clang-format off -AtomStyle(rheo/thermal,AtomVecRHEOThermal); -// clang-format on -#else - -#ifndef LMP_ATOM_VEC_RHEO_THERMAL_H -#define LMP_ATOM_VEC_RHEO_THERMAL_H - -#include "atom_vec.h" - -namespace LAMMPS_NS { - -class AtomVecRHEOThermal : virtual public AtomVec { - public: - AtomVecRHEOThermal(class LAMMPS *); - - void grow_pointers() override; - void force_clear(int, size_t) override; - void data_atom_post(int) override; - int property_atom(const std::string &) override; - void pack_property_atom(int, double *, int, int) override; - - private: - int *status; - double *conductivity, *temperature, *heatflow; - double *pressure, *rho, *drho, *viscosity; -}; - -} // namespace LAMMPS_NS - -#endif -#endif From 89150877a22976808cbd9eeb8ffcddf61aafb44f Mon Sep 17 00:00:00 2001 From: jtclemm Date: Mon, 30 Oct 2023 20:48:20 -0600 Subject: [PATCH 051/158] Hiding compile bugs in temporary files --- src/RHEO/pair_rheo_react.cpp | 35 ++++++++++++++++++---------------- src/RHEO/pair_rheo_react.h | 7 +++++-- src/RHEO/pair_rheo_tension.cpp | 24 ++++++++++++++++++++--- src/RHEO/pair_rheo_tension.h | 5 +++-- 4 files changed, 48 insertions(+), 23 deletions(-) diff --git a/src/RHEO/pair_rheo_react.cpp b/src/RHEO/pair_rheo_react.cpp index 49c24cf501..7ec63bb2a9 100644 --- a/src/RHEO/pair_rheo_react.cpp +++ b/src/RHEO/pair_rheo_react.cpp @@ -60,8 +60,8 @@ PairRHEOReact::PairRHEOReact(LAMMPS *lmp) : Pair(lmp), int tmp1, tmp2; int index = atom->find_custom("react_nbond", tmp1, tmp2); if (index == -1) { - id_fix_pa = utils::strdup("pair_rheo_react_fix_property_atom"); - modify->add_fix(fmt::format("{} all property/atom i_react_nbond", id_fix_pa)); + id_fix = utils::strdup("pair_rheo_react_fix_property_atom"); + modify->add_fix(fmt::format("{} all property/atom i_react_nbond", id_fix)); index = atom->find_custom("nbond", tmp1, tmp2); } nbond = atom->ivector[index]; @@ -125,11 +125,9 @@ void PairRHEOReact::compute(int eflag, int vflag) double **v = atom->v; double **f = atom->f; int *type = atom->type; - int *phase = atom->phase; + int *status = atom->status; int *mask = atom->mask; int *nbond = atom->ivector[index_nb]; - int *surface = atom->surface; - double *rsurf = atom->dvector[index_rsurf]; int nlocal = atom->nlocal; int newton_pair = force->newton_pair; @@ -151,7 +149,7 @@ void PairRHEOReact::compute(int eflag, int vflag) for(i = 0; i < nmax; i++) { dbond[i] = 0; } - +/* // loop over neighbors of my atoms for (ii = 0; ii < inum; ii++) { i = ilist[ii]; @@ -167,23 +165,25 @@ void PairRHEOReact::compute(int eflag, int vflag) jlist = firstneigh[i]; jnum = numneigh[i]; + for (jj = 0; jj < jnum; jj++) { j = jlist[jj]; j &= NEIGHMASK; jtype = type[j]; data = &alldata[2*jj]; + // If not bonded and there's an internal fluid particle, unsave any data and skip if (!(saved[jj] == 1 && data[0] > 0)) { - if ((phase[i] <= FixRHEO::FLUID_MAX && rsurf[i] > rlimit[itype][jtype]) || (phase[j] <= FixRHEO::FLUID_MAX && rsurf[j] > rlimit[itype][jtype])) { + if ((status[i] <= FixRHEO::FLUID_MAX && rsurf[i] > rlimit[itype][jtype]) || (status[j] <= FixRHEO::FLUID_MAX && rsurf[j] > rlimit[itype][jtype])) { saved[jj] = 0; continue; } } // If both are solid, unbond and skip - if ((phase[i] == FixRHEO::SOLID || phase[i] == FixRHEO::FREEZING) && - (phase[j] == FixRHEO::SOLID || phase[j] == FixRHEO::FREEZING)) { + if ((status[i] == FixRHEO::SOLID || status[i] == FixRHEO::FREEZING) && + (status[j] == FixRHEO::SOLID || status[j] == FixRHEO::FREEZING)) { //If bonded, deincrement if (saved[jj] == 1 && data[0] > 0) { dbond[i] --; @@ -245,7 +245,7 @@ void PairRHEOReact::compute(int eflag, int vflag) if (data[0] <= 0) { // Skip if either is fluid (only include r+s or r+r since already skipped s+s) - if (phase[i] <= FixRHEO::FLUID_MAX || phase[j] <= FixRHEO::FLUID_MAX) continue; + if (status[i] <= FixRHEO::FLUID_MAX || status[j] <= FixRHEO::FLUID_MAX) continue; // Skip if out of contact if (rsq > sigma[itype][jtype]*sigma[itype][jtype]) continue; @@ -315,10 +315,11 @@ void PairRHEOReact::compute(int eflag, int vflag) // If it has bonds it is reactive (no shifting) // If a reactive particle breaks all bonds, return to fluid // Keep it non-shifting for this timestep to be safe - if (nbond[i] != 0 && phase[i] <= FixRHEO::FLUID_MAX) phase[i] = FixRHEO::FLUID_NO_SHIFT; + if (nbond[i] != 0 && status[i] <= FixRHEO::FLUID_MAX) status[i] = FixRHEO::FLUID_NO_SHIFT; } if (vflag_fdotr) virial_fdotr_compute(); + */ } /* ---------------------------------------------------------------------- @@ -410,7 +411,7 @@ void PairRHEOReact::coeff(int narg, char **arg) void PairRHEOReact::init_style() { int irequest = neighbor->request(this,instance_me); - neighbor->requests[irequest]->history = 1; + //neighbor->requests[irequest]->history = 1; if (fix_history == nullptr) { @@ -432,10 +433,10 @@ void PairRHEOReact::init_style() fix_dummy = nullptr; } - int temp_flag; - index_rsurf = atom->find_custom("rsurf", temp_flag); - if ((index_rsurf < 0) || (temp_flag != 1)) - error->all(FLERR, "Pair rheo/react can't find fix property/atom rsurf"); + //int temp_flag; + //index_rsurf = atom->find_custom("rsurf", temp_flag); + //if ((index_rsurf < 0) || (temp_flag != 1)) + // error->all(FLERR, "Pair rheo/react can't find fix property/atom rsurf"); } /* ---------------------------------------------------------------------- @@ -443,6 +444,7 @@ void PairRHEOReact::init_style() ------------------------------------------------------------------------- */ void PairRHEOReact::setup() { + /* int ifix = modify->find_fix_by_style("rheo"); if (ifix == -1) error->all(FLERR, "Using pair rheo/react without fix rheo"); fix_rheo = ((FixRHEO *) modify->fix[ifix]); @@ -452,6 +454,7 @@ void PairRHEOReact::setup() { if (force->newton_pair == 0) error->all(FLERR, "Pair rheo/react needs newton pair on for bond changes to be consistent"); + */ } /* ---------------------------------------------------------------------- diff --git a/src/RHEO/pair_rheo_react.h b/src/RHEO/pair_rheo_react.h index c2a7f26f03..b349300f27 100644 --- a/src/RHEO/pair_rheo_react.h +++ b/src/RHEO/pair_rheo_react.h @@ -27,8 +27,8 @@ namespace LAMMPS_NS { class PairRHEOReact : public Pair { public: PairRHEOReact(class LAMMPS *); - virtual ~PairRHEOReact() override; - virtual void compute(int, int) override; + ~PairRHEOReact() override; + void compute(int, int) override; void settings(int, char **) override; void coeff(int, char **) override; void init_style() override; @@ -49,6 +49,9 @@ class PairRHEOReact : public Pair { int *dbond, *nbond; double dt; + int index_nb, nmax; + char *id_fix; + class FixDummy *fix_dummy; class FixNeighHistory *fix_history; class FixRHEO *fix_rheo; diff --git a/src/RHEO/pair_rheo_tension.cpp b/src/RHEO/pair_rheo_tension.cpp index 824f496161..ef0d0b60b4 100644 --- a/src/RHEO/pair_rheo_tension.cpp +++ b/src/RHEO/pair_rheo_tension.cpp @@ -106,7 +106,7 @@ void PairRHEOTension::compute(int eflag, int vflag) ilist = list->ilist; numneigh = list->numneigh; firstneigh = list->firstneigh; - +/* int nmax = atom->nmax; if (nmax_store <= nmax) { memory->grow(ct, nmax, "atom:rheo_c_tension"); @@ -173,6 +173,7 @@ void PairRHEOTension::compute(int eflag, int vflag) comm->reverse_comm(this); comm->forward_comm(this); +*/ } /* ---------------------------------------------------------------------- @@ -193,6 +194,14 @@ void PairRHEOTension::allocate() memory->create(cutsq, n + 1, n + 1, "pair:cutsq"); } +/* ---------------------------------------------------------------------- + global settings + ------------------------------------------------------------------------- */ + +void PairRHEOTension::settings(int narg, char **arg) +{ +} + /* ---------------------------------------------------------------------- set coeffs for one or more type pairs ------------------------------------------------------------------------- */ @@ -208,7 +217,7 @@ void PairRHEOTension::coeff(int narg, char **arg) utils::bounds(FLERR, arg[0], 1, atom->ntypes, ilo, ihi,error); utils::bounds(FLERR, arg[1], 1, atom->ntypes, jlo, jhi,error); - alpha_one = utils::numeric(FLERR, arg[2], false, lmp); + double alpha_one = utils::numeric(FLERR, arg[2], false, lmp); int count = 0; for (int i = ilo; i <= ihi; i++) { @@ -232,7 +241,7 @@ void PairRHEOTension::setup() auto fixes = modify->get_fix_by_style("rheo"); if (fixes.size() == 0) error->all(FLERR, "Need to define fix rheo to use pair rheo"); fix_rheo = dynamic_cast(fixes[0]); - + /* compute_kernel = fix_rheo->compute_kernel; compute_grad = fix_rheo->compute_grad; compute_interface = fix_rheo->compute_interface; @@ -243,6 +252,7 @@ void PairRHEOTension::setup() hsq = h * h; hinv = 1.0 / h; hinv3 = hinv * 3.0; + */ } /* ---------------------------------------------------------------------- @@ -291,6 +301,7 @@ double PairRHEOTension::init_one(int i, int j) int PairRHEOTension::pack_forward_comm(int n, int *list, double *buf, int /*pbc_flag*/, int * /*pbc*/) { + /* int i,j,k,m; m = 0; double *rho = atom->rho; @@ -307,12 +318,14 @@ int PairRHEOTension::pack_forward_comm(int n, int *list, double *buf, int /*pbc_ } } return m; + */ } /* ---------------------------------------------------------------------- */ void PairRHEOTension::unpack_forward_comm(int n, int first, double *buf) { + /* int i, k, m, last; double *rho = atom->rho; m = 0; @@ -327,6 +340,7 @@ void PairRHEOTension::unpack_forward_comm(int n, int first, double *buf) rho[i] = buf[m++]; } } + */ } @@ -334,6 +348,7 @@ void PairRHEOTension::unpack_forward_comm(int n, int first, double *buf) int PairRHEOTension::pack_reverse_comm(int n, int first, double *buf) { + /* int i, k, m, last; double **fp_store = compute_interface->fp_store; @@ -346,12 +361,14 @@ int PairRHEOTension::pack_reverse_comm(int n, int first, double *buf) } return m; + */ } /* ---------------------------------------------------------------------- */ void PairRHEOTension::unpack_reverse_comm(int n, int *list, double *buf) { + /* int i, j, k, m; double **fp_store = compute_interface->fp_store; @@ -362,4 +379,5 @@ void PairRHEOTension::unpack_reverse_comm(int n, int *list, double *buf) fp_store[j][1] += buf[m++]; fp_store[j][2] += buf[m++]; } + */ } diff --git a/src/RHEO/pair_rheo_tension.h b/src/RHEO/pair_rheo_tension.h index d1799b65e7..2a046ff324 100644 --- a/src/RHEO/pair_rheo_tension.h +++ b/src/RHEO/pair_rheo_tension.h @@ -29,6 +29,7 @@ class PairRHEOTension : public Pair { PairRHEOTension(class LAMMPS *); ~PairRHEOTension() override; void compute(int, int) override; + void settings(int, char **) override; void coeff(int, char **) override; void setup() override; void init_style() override; @@ -41,8 +42,8 @@ class PairRHEOTension : public Pair { protected: int nmax_store; double **nt, *ct; - double *alpha; - double hsq, hinv, hinv3; + double **alpha; + double h, hsq, hinv, hinv3; void allocate(); From bf115e5df4718d8e8bb45d639a10c03aa5f3e3ba Mon Sep 17 00:00:00 2001 From: jtclemm Date: Wed, 1 Nov 2023 11:55:07 -0600 Subject: [PATCH 052/158] Fix compiler/memory errors in tension, update properties in surface --- src/.gitignore | 4 +- src/RHEO/compute_rheo_grad.cpp | 2 - src/RHEO/compute_rheo_surface.cpp | 82 ++-- src/RHEO/compute_rheo_surface.h | 8 +- src/RHEO/fix_rheo_tension.cpp | 452 ++++++++++++++++++ ...pair_rheo_tension.h => fix_rheo_tension.h} | 41 +- src/RHEO/pair_rheo_tension.cpp | 383 --------------- 7 files changed, 527 insertions(+), 445 deletions(-) create mode 100644 src/RHEO/fix_rheo_tension.cpp rename src/RHEO/{pair_rheo_tension.h => fix_rheo_tension.h} (60%) delete mode 100644 src/RHEO/pair_rheo_tension.cpp diff --git a/src/.gitignore b/src/.gitignore index ef74318fc7..c7e022797f 100644 --- a/src/.gitignore +++ b/src/.gitignore @@ -219,6 +219,8 @@ /fix_rheo_pressure.h /fix_rheo_stress.cpp /fix_rheo_stress.h +/fix_rheo_tension.cpp +/fix_rheo_tension.h /fix_rheo_thermal.cpp /fix_rheo_thermal.h /fix_rheo_viscosity.cpp @@ -227,8 +229,6 @@ /pair_rheo.h /pair_rheo_react.cpp /pair_rheo_react.h -/pair_rheo_tension.cpp -/pair_rheo_tension.h /compute_grid.cpp /compute_grid.h diff --git a/src/RHEO/compute_rheo_grad.cpp b/src/RHEO/compute_rheo_grad.cpp index 7fdff41403..46c1500556 100644 --- a/src/RHEO/compute_rheo_grad.cpp +++ b/src/RHEO/compute_rheo_grad.cpp @@ -355,8 +355,6 @@ int ComputeRHEOGrad::pack_forward_comm(int n, int *list, double *buf, } } - - if (rho_flag) buf[m++] = rho[j]; diff --git a/src/RHEO/compute_rheo_surface.cpp b/src/RHEO/compute_rheo_surface.cpp index 230bca8219..88b33c09af 100644 --- a/src/RHEO/compute_rheo_surface.cpp +++ b/src/RHEO/compute_rheo_surface.cpp @@ -87,27 +87,26 @@ void ComputeRHEOSurface::init() cutsq = cut * cut; - // Create rsurface, divr, nsurface arrays if they don't already exist - // Create a custom atom property so it works with compute property/atom - // Do not create grow callback as there's no reason to copy/exchange data - // Manually grow if nmax_store exceeded + // Create rsurface, divr, nsurface arrays as custom atom properties, + // can print with compute property/atom + // no grow callback as there's no reason to copy/exchange data, manually grow // For B and gradC, create a local array since they are unlikely to be printed + int dim = domain->dimension; int tmp1, tmp2; - int index = atom->find_custom("rheo_divr", tmp1, tmp2); - if (index == -1) index = atom->add_custom("rheo_divr", 1, 0); - divr = atom->dvector[index]; + index_divr = atom->find_custom("rheo_divr", tmp1, tmp2); + if (index_divr == -1) index_divr = atom->add_custom("rheo_divr", 1, 0); + divr = atom->dvector[index_divr]; - index = atom->find_custom("rheo_rsurface", tmp1, tmp2); - if (index == -1) index = atom->add_custom("rheo_rsurface", 1, 0); - rsurface = atom->dvector[index]; + index_rsurf = atom->find_custom("rheo_rsurface", tmp1, tmp2); + if (index_rsurf == -1) index_rsurf = atom->add_custom("rheo_rsurface", 1, 0); + rsurface = atom->dvector[index_rsurf]; - index = atom->find_custom("rheo_nsurface", tmp1, tmp2); - if (index == -1) index = atom->add_custom("rheo_nsurface", 1, 3); - nsurface = atom->darray[index]; + index_nsurf = atom->find_custom("rheo_nsurface", tmp1, tmp2); + if (index_nsurf == -1) index_nsurf = atom->add_custom("rheo_nsurface", 1, dim); + nsurface = atom->darray[index_nsurf]; nmax_store = atom->nmax; - int dim = domain->dimension; memory->create(B, nmax_store, dim * dim, "rheo/surface:B"); memory->create(gradC, nmax_store, dim * dim, "rheo/surface:gradC"); @@ -148,32 +147,21 @@ void ComputeRHEOSurface::compute_peratom() numneigh = list->numneigh; firstneigh = list->firstneigh; - int nmax = atom->nmax; - if (nmax_store <= nmax) { - memory->grow(divr, nmax, "atom:rheo_divr"); - memory->grow(rsurface, nmax, "atom:rheo_rsurface"); - memory->grow(nsurface, nmax, 3, "atom:rheo_nsurface"); + // Grow and zero arrays + if (nmax_store <= atom->nmax) + grow_arrays(atom->nmax); - memory->grow(B, nmax, dim * dim, "rheo/surface:B"); - memory->grow(gradC, nmax, dim * dim, "rheo/surface:gradC"); - - nmax_store = atom->nmax; - } + size_t nbytes = nmax_store * sizeof(double); + memset(&divr, 0, nbytes); + memset(&rsurface, 0, nbytes); + memset(&nsurface, 0, 3 * nbytes); + memset(&gradC, 0, 3 * 3 * nbytes); + memset(&B, 0, 3 * 3 * nbytes); + // Remove surface settings int nall = nlocal + atom->nghost; - for (i = 0; i < nall; i++) { - for (a = 0; a < dim; a++) { - for (b = 0; b < dim; b++) { - B[i][a * dim + b] = 0.0; - gradC[i][a * dim + b] = 0.0; - } - nsurface[i][a] = 0.0; - } - divr[i] = 0.0; - - // Remove surface settings + for (i = 0; i < nall; i++) status[i] &= SURFACEMASK; - } // loop over neighbors to calculate the average orientation of neighbors for (ii = 0; ii < inum; ii++) { @@ -424,3 +412,25 @@ void ComputeRHEOSurface::unpack_forward_comm(int n, int first, double *buf) } } } + +/* ---------------------------------------------------------------------- */ + +void ComputeRHEOSurface::grow_arrays(int nmax) +{ + int dim = domain->dimension; + + // Grow atom variables and reassign pointers + memory->grow(atom->dvector[index_divr], nmax, "atom:rheo_divr"); + memory->grow(atom->dvector[index_rsurf], nmax, "atom:rheo_rsurface"); + memory->grow(atom->darray[index_nsurf], nmax, dim, "atom:rheo_nsurface"); + + divr = atom->dvector[index_divr]; + rsurface = atom->dvector[index_rsurf]; + nsurface = atom->darray[index_nsurf]; + + // Grow local variables + memory->grow(B, nmax, dim * dim, "rheo/surface:B"); + memory->grow(gradC, nmax, dim * dim, "rheo/surface:gradC"); + + nmax_store = atom->nmax; +} diff --git a/src/RHEO/compute_rheo_surface.h b/src/RHEO/compute_rheo_surface.h index 1d1cdba3fa..f1b1af7742 100644 --- a/src/RHEO/compute_rheo_surface.h +++ b/src/RHEO/compute_rheo_surface.h @@ -40,14 +40,18 @@ class ComputeRHEOSurface : public Compute { class FixRHEO *fix_rheo; private: - double cut, cutsq, rho0, threshold_divr; int surface_style, nmax_store, threshold_z, threshold_splash, interface_flag; - double **B, **gradC; int threshold_style, comm_stage; + int index_divr, index_rsurf, index_nsurf; + + double cut, cutsq, rho0, threshold_divr; + double **B, **gradC; class NeighList *list; class ComputeRHEOKernel *compute_kernel; class ComputeRHEOInterface *compute_interface; + + void grow_arrays(int); }; } // namespace LAMMPS_NS diff --git a/src/RHEO/fix_rheo_tension.cpp b/src/RHEO/fix_rheo_tension.cpp new file mode 100644 index 0000000000..44bc3bf580 --- /dev/null +++ b/src/RHEO/fix_rheo_tension.cpp @@ -0,0 +1,452 @@ +/* ---------------------------------------------------------------------- + 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 authors: + Joel Clemmer (SNL), Thomas O'Connor (CMU), Eric Palermo (CMU) +----------------------------------------------------------------------- */ + +#include "fix_rheo_tension.h" + +#include "atom.h" +#include "comm.h" +#include "compute_rheo_kernel.h" +#include "compute_rheo_interface.h" +#include "domain.h" +#include "error.h" +#include "fix_rheo.h" +#include "force.h" +#include "math_extra.h" +#include "memory.h" +#include "modify.h" +#include "neighbor.h" +#include "neigh_list.h" +#include "update.h" +#include "utils.h" + +#include + +using namespace LAMMPS_NS; +using namespace RHEO_NS; +using namespace MathExtra; +using namespace FixConst; + +/* ---------------------------------------------------------------------- */ + +FixRHEOTension::FixRHEOTension(LAMMPS *lmp, int narg, char **arg) : + Fix(lmp, narg, arg), compute_kernel(nullptr), compute_interface(nullptr), fix_rheo(nullptr) +{ + if (narg != 4) error->all(FLERR,"Illegal fix command"); + alpha = utils::numeric(FLERR,arg[3],false,lmp); + + comm_forward = 3; + comm_reverse = 3; + + // Create cgrad, n, and divr arrays as custom atom properties, + // can print with compute property/atom + // no grow callback as there's no reason to copy/exchange data, manually grow + // For norm, create a local array since they are unlikely to be printed + + int tmp1, tmp2; + index_cgradt = atom->find_custom("cgrad_rheo_tension", tmp1, tmp2); + if (index_cgradt == -1) index_cgradt = atom->add_custom("cgrad_rheo_tension", 1, 3); + cgradt = atom->darray[index_cgradt]; + + index_nt = atom->find_custom("n_rheo_tension", tmp1, tmp2); + if (index_nt == -1) index_nt = atom->add_custom("n_rheo_tension", 1, 3); + nt = atom->darray[index_nt]; + + index_divnt = atom->find_custom("divn_rheo_tension", tmp1, tmp2); + if (index_divnt == -1) index_divnt = atom->add_custom("divn_rheo_tension", 1, 0); + divnt = atom->dvector[index_divnt]; + + norm = nullptr; + nmax_store = 0; +} + +/* ---------------------------------------------------------------------- */ + +FixRHEOTension::~FixRHEOTension() +{ + // Remove custom property if it exists + int tmp1, tmp2, index; + + index = atom->find_custom("cgrad_rheo_tension", tmp1, tmp2); + if (index != -1) atom->remove_custom(index, 1, 3); + + index = atom->find_custom("n_rheo_tension", tmp1, tmp2); + if (index != -1) atom->remove_custom(index, 1, 3); + + index = atom->find_custom("divn_rheo_tension", tmp1, tmp2); + if (index != -1) atom->remove_custom(index, 1, 0); + + memory->destroy(norm); +} + +/* ---------------------------------------------------------------------- */ + +int FixRHEOTension::setmask() +{ + int mask = 0; + mask |= POST_FORCE; + return mask; +} + +/* ---------------------------------------------------------------------- */ + +void FixRHEOTension::init() +{ + auto fixes = modify->get_fix_by_style("^rheo$"); + if (fixes.size() == 0) error->all(FLERR, "Need to define fix rheo to use fix rheo/tension"); + fix_rheo = dynamic_cast(fixes[0]); + + compute_kernel = fix_rheo->compute_kernel; + compute_interface = fix_rheo->compute_interface; + interface_flag = fix_rheo->interface_flag; + h = fix_rheo->h; + rho0 = fix_rheo->rho0; + + hsq = h * h; + + neighbor->add_request(this, NeighConst::REQ_DEFAULT); +} + +/* ---------------------------------------------------------------------- */ + +void FixRHEOTension::init_list(int /*id*/, NeighList *ptr) +{ + list = ptr; +} + + +/* ---------------------------------------------------------------------- */ + +void FixRHEOTension::setup(int vflag) +{ + // Grow and populate arrays + post_force(vflag); +} + +/* ---------------------------------------------------------------------- + Calculate and apply tension forces +------------------------------------------------------------------------- */ + +void FixRHEOTension::post_force(int vflag) +{ + int i, j, a, ii, jj, inum, jnum, itype, jtype; + int fluidi, fluidj; + double xtmp, ytmp, ztmp, w, wp, c; + double rhoi, rhoj, Voli, Volj; + double *dWij, *dWji; + double dx[3], ft[3]; + + int *ilist, *jlist, *numneigh, **firstneigh; + double imass, jmass, rsq, r, rinv; + + int nlocal = atom->nlocal; + int newton = force->newton; + int dim = domain->dimension; + + v_init(vflag); + + double **x = atom->x; + double **f = atom->f; + double *rho = atom->rho; + double *mass = atom->mass; + imageint *image = atom->image; + int *type = atom->type; + int *status = atom->status; + + inum = list->inum; + ilist = list->ilist; + numneigh = list->numneigh; + firstneigh = list->firstneigh; + + if (nmax_store <= atom->nmax) + grow_arrays(atom->nmax); + + for (i = 0; i < nlocal+atom->nghost; i++) { + cgradt[i][0] = 0.0; + cgradt[i][1] = 0.0; + cgradt[i][2] = 0.0; + norm[i] = 0.0; + divnt[i] = 0.0; + } + + // Calculate color gradient + for (ii = 0; ii < inum; ii++) { + i = ilist[ii]; + xtmp = x[i][0]; + ytmp = x[i][1]; + ztmp = x[i][2]; + itype = type[i]; + fluidi = !(status[i] & PHASECHECK); + jlist = firstneigh[i]; + jnum = numneigh[i]; + imass = mass[itype]; + + for (jj = 0; jj < jnum; jj++) { + j = jlist[jj]; + j &= NEIGHMASK; + + dx[0] = xtmp - x[j][0]; + dx[1] = ytmp - x[j][1]; + dx[2] = ztmp - x[j][2]; + rsq = lensq3(dx); + + if (rsq > hsq) continue; + + fluidj = !(status[j] & PHASECHECK); + jtype = type[j]; + r = sqrt(rsq); + rinv = 1 / r; + + rhoi = rho[i]; + rhoj = rho[j]; + + // Add corrections for walls + if (interface_flag) { + if (fluidi && (!fluidj)) { + rhoj = compute_interface->correct_rho(j, i); + } else if ((!fluidi) && fluidj) { + rhoi = compute_interface->correct_rho(i, j); + } else if ((!fluidi) && (!fluidj)) { + rhoi = rho0; + rhoj = rho0; + } + } + + Voli = mass[itype] / rhoi; + Volj = mass[jtype] / rhoj; + + wp = compute_kernel->calc_dw(i, j, dx[0], dx[1], dx[2],r); + dWij = compute_kernel->dWij; + dWji = compute_kernel->dWji; + + c = 0; + if (itype == jtype) c += rhoi; + c /= (rhoi + rhoj); + + for (a = 0; a < 3; a++) { + cgradt[i][a] -= c * Volj * dWij[a]; + if (newton || j < nlocal) + cgradt[j][a] -= c * Voli * dWji[a]; + } + } + } + + comm_stage = 0; + comm_reverse = 3; + if (newton) comm->reverse_comm(this); + + // Calculate normal direction + double minv; + for (i = 0; i < nlocal; i++) { + minv = 1.0 / sqrt(cgradt[i][0] * cgradt[i][0] + cgradt[i][1] * cgradt[i][1] + cgradt[i][2] * cgradt[i][2]); + + for (a = 0; a < 3; a++) + nt[i][a] = cgradt[i][a] * minv; + } + + comm->forward_comm(this); + + // Calculate divergence + for (ii = 0; ii < inum; ii++) { + i = ilist[ii]; + xtmp = x[i][0]; + ytmp = x[i][1]; + ztmp = x[i][2]; + itype = type[i]; + fluidi = !(status[i] & PHASECHECK); + jlist = firstneigh[i]; + jnum = numneigh[i]; + imass = mass[itype]; + + for (jj = 0; jj < jnum; jj++) { + j = jlist[jj]; + j &= NEIGHMASK; + + dx[0] = xtmp - x[j][0]; + dx[1] = ytmp - x[j][1]; + dx[2] = ztmp - x[j][2]; + rsq = lensq3(dx); + + if (rsq > hsq) continue; + + fluidj = !(status[j] & PHASECHECK); + jtype = type[j]; + r = sqrt(rsq); + rinv = 1 / r; + + rhoi = rho[i]; + rhoj = rho[j]; + + // Add corrections for walls + if (interface_flag) { + if (fluidi && (!fluidj)) { + rhoj = compute_interface->correct_rho(j, i); + } else if ((!fluidi) && fluidj) { + rhoi = compute_interface->correct_rho(i, j); + } else if ((!fluidi) && (!fluidj)) { + rhoi = rho0; + rhoj = rho0; + } + } + + Voli = mass[itype] / rhoi; + Volj = mass[jtype] / rhoj; + + wp = compute_kernel->calc_dw(i, j, dx[0], dx[1], dx[2],r); + dWij = compute_kernel->dWij; + dWji = compute_kernel->dWji; + + for (a = 0; a < 3; a++) { + divnt[i] -= nt[i][a] * Volj * dWij[a]; + norm[i] -= dx[a] * Volj * dWij[a]; + if (newton || j < nlocal) { + divnt[j] -= nt[j][a] * Voli * dWji[a]; + norm[j] += dx[a] * Voli * dWji[a]; + } + } + } + } + + comm_stage = 1; + comm_reverse = 2; + if (newton) comm->reverse_comm(this); + + // Skip forces if it's setup + if (update->setupflag) return; + + // apply force + int prefactor; + double unwrap[3]; + double v[6]; + for (i = 0; i < nlocal; i++) { + itype = type[i]; + divnt[i] /= norm[i]; + + prefactor *= -alpha * divnt[i] / mass[itype]; + + for (a = 0; a < 3; a++) + f[i][a] += prefactor * cgradt[i][a]; + + if (evflag) { + domain->unmap(x[i], image[i], unwrap); + v[0] = prefactor * cgradt[i][0] * unwrap[0]; + v[1] = prefactor * cgradt[i][1] * unwrap[1]; + v[2] = prefactor * cgradt[i][2] * unwrap[2]; + v[3] = prefactor * cgradt[i][0] * unwrap[1]; + v[4] = prefactor * cgradt[i][0] * unwrap[2]; + v[5] = prefactor * cgradt[i][1] * unwrap[2]; + v_tally(i, v); + } + } + + + + if (evflag) { + + } + +} + + +/* ---------------------------------------------------------------------- */ + +int FixRHEOTension::pack_forward_comm(int n, int *list, double *buf, int /*pbc_flag*/, int * /*pbc*/) +{ + int i, j, a, m; + m = 0; + + for (i = 0; i < n; i++) { + j = list[i]; + for (a = 0; a < 3; a++) + buf[m++] = nt[j][a]; + } + return m; +} + +/* ---------------------------------------------------------------------- */ + +void FixRHEOTension::unpack_forward_comm(int n, int first, double *buf) +{ + int i, a, m, last; + + m = 0; + last = first + n; + for (i = first; i < last; i++) + for (a = 0; a < 3; a++) + nt[i][a] = buf[m++]; +} + + +/* ---------------------------------------------------------------------- */ + +int FixRHEOTension::pack_reverse_comm(int n, int first, double *buf) +{ + int i, a, m, last; + + m = 0; + last = first + n; + if (comm_stage == 0) + for (i = first; i < last; i++) + for (a = 0; a < 3; a++) + buf[m++] = cgradt[i][a]; + else + for (i = first; i < last; i++) { + buf[m++] = norm[i]; + buf[m++] = divnt[i]; + } + return m; +} + +/* ---------------------------------------------------------------------- */ + +void FixRHEOTension::unpack_reverse_comm(int n, int *list, double *buf) +{ + int i, j, a, m; + + m = 0; + if (comm_stage == 0) + for (i = 0; i < n; i++) { + j = list[i]; + for (a = 0; a < 3; a++) + cgradt[j][a] += buf[m++]; + } + else + for (i = 0; i < n; i++) { + j = list[i]; + norm[j] += buf[m++]; + divnt[j] += buf[m++]; + } +} + +/* ---------------------------------------------------------------------- */ + +void FixRHEOTension::grow_arrays(int nmax) +{ + // Grow atom variables and reassign pointers + memory->grow(atom->darray[index_cgradt], nmax, 3, "atom:rheo_cgradt"); + memory->grow(atom->darray[index_nt], nmax, 3, "atom:rheo_nt"); + memory->grow(atom->dvector[index_divnt], nmax, "atom:rheo_divnt"); + + cgradt = atom->darray[index_cgradt]; + nt = atom->darray[index_nt]; + divnt = atom->dvector[index_divnt]; + + // Grow local variables + memory->grow(norm, nmax, "rheo/tension:norm"); + + nmax_store = atom->nmax; +} \ No newline at end of file diff --git a/src/RHEO/pair_rheo_tension.h b/src/RHEO/fix_rheo_tension.h similarity index 60% rename from src/RHEO/pair_rheo_tension.h rename to src/RHEO/fix_rheo_tension.h index 2a046ff324..74b8b71436 100644 --- a/src/RHEO/pair_rheo_tension.h +++ b/src/RHEO/fix_rheo_tension.h @@ -11,44 +11,45 @@ See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ -#ifdef PAIR_CLASS +#ifdef FIX_CLASS // clang-format off -PairStyle(rheo/tension,PairRHEOTension) +FixStyle(rheo/tension,FixRHEOTension) // clang-format on #else -#ifndef LMP_PAIR_RHEO_TENSION_H -#define LMP_PAIR_RHEO_TENSION_H +#ifndef LMP_FIX_RHEO_TENSION_H +#define LMP_FIX_RHEO_TENSION_H -#include "pair.h" +#include "fix.h" namespace LAMMPS_NS { -class PairRHEOTension : public Pair { +class FixRHEOTension : public Fix { public: - PairRHEOTension(class LAMMPS *); - ~PairRHEOTension() override; - void compute(int, int) override; - void settings(int, char **) override; - void coeff(int, char **) override; - void setup() override; - void init_style() override; - double init_one(int, int) override; + FixRHEOTension(class LAMMPS *, int, char **); + ~FixRHEOTension() override; + int setmask() override; + void init() override; + void init_list(int, class NeighList *) override; + void setup(int) override; + void post_force(int) override; int pack_forward_comm(int, int *, double *, int, int *) override; void unpack_forward_comm(int, int, double *) override; int pack_reverse_comm(int, int, double *) override; void unpack_reverse_comm(int, int *, double *) override; + void grow_arrays(int) override; - protected: - int nmax_store; - double **nt, *ct; - double **alpha; - double h, hsq, hinv, hinv3; + private: + int nmax_store, comm_stage, interface_flag; + int index_nt, index_cgradt, index_divnt; - void allocate(); + double **nt, **cgradt, *divnt, *norm; + double alpha, h, hsq, hinv, hinv3, rho0; class ComputeRHEOKernel *compute_kernel; + class ComputeRHEOInterface *compute_interface; class FixRHEO *fix_rheo; + class NeighList *list; }; } // namespace LAMMPS_NS diff --git a/src/RHEO/pair_rheo_tension.cpp b/src/RHEO/pair_rheo_tension.cpp deleted file mode 100644 index ef0d0b60b4..0000000000 --- a/src/RHEO/pair_rheo_tension.cpp +++ /dev/null @@ -1,383 +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 authors: - Joel Clemmer (SNL) ------------------------------------------------------------------------ */ - -#include "pair_rheo_tension.h" - -#include "atom.h" -#include "comm.h" -#include "compute_rheo_kernel.h" -#include "domain.h" -#include "error.h" -#include "fix_rheo.h" -#include "force.h" -#include "math_extra.h" -#include "memory.h" -#include "modify.h" -#include "neighbor.h" -#include "neigh_list.h" -#include "update.h" -#include "utils.h" - -#include - -using namespace LAMMPS_NS; -using namespace RHEO_NS; -using namespace MathExtra; - -static constexpr double EPSILON = 1e-2; - -/* ---------------------------------------------------------------------- */ - -PairRHEOTension::PairRHEOTension(LAMMPS *lmp) : - Pair(lmp), compute_kernel(nullptr), fix_rheo(nullptr) -{ - restartinfo = 0; - single_enable = 0; - - comm_forward = 3; - comm_reverse = 3; -} - -/* ---------------------------------------------------------------------- */ - -PairRHEOTension::~PairRHEOTension() -{ - // Remove custom property if it exists - int tmp1, tmp2, index; - - index = atom->find_custom("rheo_c_tension", tmp1, tmp2); - if (index != -1) atom->remove_custom(index, 1, 0); - - index = atom->find_custom("rheo_n_tension", tmp1, tmp2); - if (index != -1) atom->remove_custom(index, 1, 3); - - if (allocated) { - memory->destroy(alpha); - memory->destroy(setflag); - memory->destroy(cutsq); - } -} - -/* ---------------------------------------------------------------------- */ - -void PairRHEOTension::compute(int eflag, int vflag) -{ - int i, j, a, b, ii, jj, inum, jnum, itype, jtype; - int fluidi, fluidj; - double xtmp, ytmp, ztmp, w, wp; - double rhoi, rhoj, voli, volj; - double *dWij, *dWji; - double dx[3], ft[3]; - - int *ilist, *jlist, *numneigh, **firstneigh; - double imass, jmass, rsq, r, rinv; - - int nlocal = atom->nlocal; - int newton_pair = force->newton_pair; - int dim = domain->dimension; - - ev_init(eflag, vflag); - - double **x = atom->x; - double **f = atom->f; - double *rho = atom->rho; - double *mass = atom->mass; - double *special_lj = force->special_lj; - int *type = atom->type; - int *status = atom->status; - tagint *tag = atom->tag; - - inum = list->inum; - ilist = list->ilist; - numneigh = list->numneigh; - firstneigh = list->firstneigh; -/* - int nmax = atom->nmax; - if (nmax_store <= nmax) { - memory->grow(ct, nmax, "atom:rheo_c_tension"); - memory->grow(nnt_tension, nmax, 3, "atom:rheo_n_tension"); - nmax_store = atom->nmax; - } - - // loop over neighbors of my atoms - - for (ii = 0; ii < inum; ii++) { - i = ilist[ii]; - xtmp = x[i][0]; - ytmp = x[i][1]; - ztmp = x[i][2]; - itype = type[i]; - jlist = firstneigh[i]; - jnum = numneigh[i]; - imass = mass[itype]; - rhoi = rho[i]; - voli = imass / rhoi; - fluidi = !(status[i] & PHASECHECK); - - for (jj = 0; jj < jnum; jj++) { - j = jlist[jj]; - j &= NEIGHMASK; - - dx[0] = xtmp - x[j][0]; - dx[1] = ytmp - x[j][1]; - dx[2] = ztmp - x[j][2]; - rsq = lensq3(dx); - jtype = type[j]; - - if (rsq > hsq) continue; - - r = sqrt(rsq); - rinv = 1 / r; - - jmass = mass[jtype]; - rhoj = rho[j]; - volj = jmass / rhoj; - fluidj = !(status[j] & PHASECHECK); - - wp = compute_kernel->calc_dw(i, j, dx[0], dx[1], dx[2],r); - dWij = compute_kernel->dWij; - dWji = compute_kernel->dWji; - - f[i][0] += ft[0]; - f[i][1] += ft[1]; - f[i][2] += ft[2]; - - if (evflag) // Does not account for unbalanced forces - ev_tally_xyz(i, j, nlocal, newton_pair, 0.0, 0.0, ft[0], ft[1], ft[2], dx[0], dx[1], dx[2]); - - if (newton_pair || j < nlocal) { - - f[j][0] -= ft[0]; - f[j][1] -= ft[1]; - f[j][2] -= ft[2]; - } - } - } - - if (vflag_fdotr) virial_fdotr_compute(); - - comm->reverse_comm(this); - comm->forward_comm(this); -*/ -} - -/* ---------------------------------------------------------------------- - allocate all arrays - ------------------------------------------------------------------------- */ - -void PairRHEOTension::allocate() -{ - allocated = 1; - int n = atom->ntypes; - - memory->create(setflag, n + 1, n + 1, "pair:setflag"); - for (int i = 1; i <= n; i++) - for (int j = i; j <= n; j++) - setflag[i][j] = 0; - - memory->create(alpha, n + 1, n + 1, "pair:alpha"); - memory->create(cutsq, n + 1, n + 1, "pair:cutsq"); -} - -/* ---------------------------------------------------------------------- - global settings - ------------------------------------------------------------------------- */ - -void PairRHEOTension::settings(int narg, char **arg) -{ -} - -/* ---------------------------------------------------------------------- - set coeffs for one or more type pairs - ------------------------------------------------------------------------- */ - -void PairRHEOTension::coeff(int narg, char **arg) -{ - if (narg != 3) - error->all(FLERR,"Incorrect number of args for pair_style rheo coefficients"); - if (!allocated) - allocate(); - - int ilo, ihi, jlo, jhi; - utils::bounds(FLERR, arg[0], 1, atom->ntypes, ilo, ihi,error); - utils::bounds(FLERR, arg[1], 1, atom->ntypes, jlo, jhi,error); - - double alpha_one = utils::numeric(FLERR, arg[2], false, lmp); - - int count = 0; - for (int i = ilo; i <= ihi; i++) { - for (int j = 0; j <= atom->ntypes; j++) { - alpha[i][j] = alpha_one; - setflag[i][j] = 1; - count++; - } - } - - if (count == 0) - error->all(FLERR,"Incorrect args for pair rheo/tension coefficients"); -} - -/* ---------------------------------------------------------------------- - setup specific to this pair style - ------------------------------------------------------------------------- */ - -void PairRHEOTension::setup() -{ - auto fixes = modify->get_fix_by_style("rheo"); - if (fixes.size() == 0) error->all(FLERR, "Need to define fix rheo to use pair rheo"); - fix_rheo = dynamic_cast(fixes[0]); - /* - compute_kernel = fix_rheo->compute_kernel; - compute_grad = fix_rheo->compute_grad; - compute_interface = fix_rheo->compute_interface; - h = fix_rheo->h; - csq = fix_rheo->csq; - rho0 = fix_rheo->rho0; - - hsq = h * h; - hinv = 1.0 / h; - hinv3 = hinv * 3.0; - */ -} - -/* ---------------------------------------------------------------------- - init specific to this pair style -------------------------------------------------------------------------- */ - -void PairRHEOTension::init_style() -{ - neighbor->add_request(this); - - - // Create c_tension arrays n_tension arrays if they don't already exist - // Create a custom atom property so it works with compute property/atom - // Do not create grow callback as there's no reason to copy/exchange data - // Manually grow if nmax_store exceeded - // For B and gradC, create a local array since they are unlikely to be printed - - int tmp1, tmp2; - int index = atom->find_custom("rheo_c_tension", tmp1, tmp2); - if (index == -1) index = atom->add_custom("rheo_c_tension", 1, 0); - ct = atom->dvector[index]; - - index = atom->find_custom("rheo_n_tension", tmp1, tmp2); - if (index == -1) index = atom->add_custom("rheo_n_tension", 1, 3); - nt = atom->darray[index]; - - nmax_store = atom->nmax; -} - -/* ---------------------------------------------------------------------- - init for one type pair i,j and corresponding j,i - ------------------------------------------------------------------------- */ - -double PairRHEOTension::init_one(int i, int j) -{ - if (setflag[i][j] == 0) - error->all(FLERR,"All pair rheo/tension coeffs are not set"); - - alpha[j][i] = alpha[i][j]; - - return h; -} - - -/* ---------------------------------------------------------------------- */ - -int PairRHEOTension::pack_forward_comm(int n, int *list, double *buf, int /*pbc_flag*/, int * /*pbc*/) -{ - /* - int i,j,k,m; - m = 0; - double *rho = atom->rho; - - for (i = 0; i < n; i++) { - j = list[i]; - if (comm_stage == 0) { - buf[m++] = fp_store[j][0]; - buf[m++] = fp_store[j][1]; - buf[m++] = fp_store[j][2]; - } else { - buf[m++] = chi[j]; - buf[m++] = rho[j]; - } - } - return m; - */ -} - -/* ---------------------------------------------------------------------- */ - -void PairRHEOTension::unpack_forward_comm(int n, int first, double *buf) -{ - /* - int i, k, m, last; - double *rho = atom->rho; - m = 0; - last = first + n; - for (i = first; i < last; i++) { - if (comm_stage == 0) { - fp_store[i][0] = buf[m++]; - fp_store[i][1] = buf[m++]; - fp_store[i][2] = buf[m++]; - } else { - chi[i] = buf[m++]; - rho[i] = buf[m++]; - } - } - */ -} - - -/* ---------------------------------------------------------------------- */ - -int PairRHEOTension::pack_reverse_comm(int n, int first, double *buf) -{ - /* - int i, k, m, last; - double **fp_store = compute_interface->fp_store; - - m = 0; - last = first + n; - for (i = first; i < last; i++) { - buf[m++] = fp_store[i][0]; - buf[m++] = fp_store[i][1]; - buf[m++] = fp_store[i][2]; - } - - return m; - */ -} - -/* ---------------------------------------------------------------------- */ - -void PairRHEOTension::unpack_reverse_comm(int n, int *list, double *buf) -{ - /* - int i, j, k, m; - double **fp_store = compute_interface->fp_store; - - m = 0; - for (i = 0; i < n; i++) { - j = list[i]; - fp_store[j][0] += buf[m++]; - fp_store[j][1] += buf[m++]; - fp_store[j][2] += buf[m++]; - } - */ -} From 5b14b7c86c25d3ff5d522d101f69b998752df486 Mon Sep 17 00:00:00 2001 From: jtclemm Date: Wed, 1 Nov 2023 13:42:33 -0600 Subject: [PATCH 053/158] Fixing gitignore --- src/.gitignore | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/.gitignore b/src/.gitignore index c7e022797f..1e634782dc 100644 --- a/src/.gitignore +++ b/src/.gitignore @@ -199,6 +199,8 @@ /atom_vec_rheo.cpp /atom_vec_rheo.h +/atom_vec_rheo_thermal.cpp +/atom_vec_rheo_thermal.h /compute_rheo_grad.cpp /compute_rheo_grad.h /compute_rheo_interface.cpp From 16a3abdadd53f2e6ec2bd50118db4dfe70a9fb53 Mon Sep 17 00:00:00 2001 From: jtclemm Date: Fri, 3 Nov 2023 13:33:03 -0600 Subject: [PATCH 054/158] Filling in tension and react --- src/RHEO/fix_rheo_tension.cpp | 44 +++-- src/RHEO/fix_rheo_tension.h | 4 +- src/RHEO/pair_rheo_react.cpp | 301 +++++++++++++--------------------- src/RHEO/pair_rheo_react.h | 8 +- 4 files changed, 150 insertions(+), 207 deletions(-) diff --git a/src/RHEO/fix_rheo_tension.cpp b/src/RHEO/fix_rheo_tension.cpp index 44bc3bf580..047f1d217e 100644 --- a/src/RHEO/fix_rheo_tension.cpp +++ b/src/RHEO/fix_rheo_tension.cpp @@ -70,6 +70,10 @@ FixRHEOTension::FixRHEOTension(LAMMPS *lmp, int narg, char **arg) : if (index_divnt == -1) index_divnt = atom->add_custom("divn_rheo_tension", 1, 0); divnt = atom->dvector[index_divnt]; + index_ft = atom->find_custom("f_rheo_tension", tmp1, tmp2); + if (index_ft == -1) index_ft = atom->add_custom("f_rheo_tension", 1, 3); + ft = atom->darray[index_ft]; + norm = nullptr; nmax_store = 0; } @@ -90,6 +94,9 @@ FixRHEOTension::~FixRHEOTension() index = atom->find_custom("divn_rheo_tension", tmp1, tmp2); if (index != -1) atom->remove_custom(index, 1, 0); + index = atom->find_custom("f_rheo_tension", tmp1, tmp2); + if (index != -1) atom->remove_custom(index, 1, 3); + memory->destroy(norm); } @@ -148,7 +155,7 @@ void FixRHEOTension::post_force(int vflag) double xtmp, ytmp, ztmp, w, wp, c; double rhoi, rhoj, Voli, Volj; double *dWij, *dWji; - double dx[3], ft[3]; + double dx[3]; int *ilist, *jlist, *numneigh, **firstneigh; double imass, jmass, rsq, r, rinv; @@ -234,7 +241,7 @@ void FixRHEOTension::post_force(int vflag) dWji = compute_kernel->dWji; c = 0; - if (itype == jtype) c += rhoi; + if (itype != jtype) c += rhoi; c /= (rhoi + rhoj); for (a = 0; a < 3; a++) { @@ -252,7 +259,9 @@ void FixRHEOTension::post_force(int vflag) // Calculate normal direction double minv; for (i = 0; i < nlocal; i++) { - minv = 1.0 / sqrt(cgradt[i][0] * cgradt[i][0] + cgradt[i][1] * cgradt[i][1] + cgradt[i][2] * cgradt[i][2]); + minv = sqrt(cgradt[i][0] * cgradt[i][0] + cgradt[i][1] * cgradt[i][1] + cgradt[i][2] * cgradt[i][2]); + + if (minv != 0) minv = 1 / minv; for (a = 0; a < 3; a++) nt[i][a] = cgradt[i][a] * minv; @@ -310,11 +319,13 @@ void FixRHEOTension::post_force(int vflag) dWij = compute_kernel->dWij; dWji = compute_kernel->dWji; + if (itype != jtype) continue; // have to think about this... + for (a = 0; a < 3; a++) { - divnt[i] -= nt[i][a] * Volj * dWij[a]; + divnt[i] -= (nt[i][a]-nt[j][a]) * Volj * dWij[a]; norm[i] -= dx[a] * Volj * dWij[a]; if (newton || j < nlocal) { - divnt[j] -= nt[j][a] * Voli * dWji[a]; + divnt[j] += (nt[i][a]-nt[j][a]) * Voli * dWji[a]; norm[j] += dx[a] * Voli * dWji[a]; } } @@ -329,17 +340,23 @@ void FixRHEOTension::post_force(int vflag) if (update->setupflag) return; // apply force - int prefactor; + double prefactor; double unwrap[3]; double v[6]; for (i = 0; i < nlocal; i++) { itype = type[i]; - divnt[i] /= norm[i]; - prefactor *= -alpha * divnt[i] / mass[itype]; + if (norm[i] != 0) + divnt[i] /= norm[i]; + else + divnt[i] = 0.0; - for (a = 0; a < 3; a++) + prefactor = -alpha * divnt[i]; + + for (a = 0; a < 3; a++) { f[i][a] += prefactor * cgradt[i][a]; + ft[i][a] = prefactor * cgradt[i][a]; + } if (evflag) { domain->unmap(x[i], image[i], unwrap); @@ -352,13 +369,6 @@ void FixRHEOTension::post_force(int vflag) v_tally(i, v); } } - - - - if (evflag) { - - } - } @@ -440,10 +450,12 @@ void FixRHEOTension::grow_arrays(int nmax) memory->grow(atom->darray[index_cgradt], nmax, 3, "atom:rheo_cgradt"); memory->grow(atom->darray[index_nt], nmax, 3, "atom:rheo_nt"); memory->grow(atom->dvector[index_divnt], nmax, "atom:rheo_divnt"); + memory->grow(atom->darray[index_ft], nmax, 3, "atom:rheo_ft"); cgradt = atom->darray[index_cgradt]; nt = atom->darray[index_nt]; divnt = atom->dvector[index_divnt]; + ft = atom->darray[index_ft]; // Grow local variables memory->grow(norm, nmax, "rheo/tension:norm"); diff --git a/src/RHEO/fix_rheo_tension.h b/src/RHEO/fix_rheo_tension.h index 74b8b71436..11bc209d88 100644 --- a/src/RHEO/fix_rheo_tension.h +++ b/src/RHEO/fix_rheo_tension.h @@ -41,9 +41,9 @@ class FixRHEOTension : public Fix { private: int nmax_store, comm_stage, interface_flag; - int index_nt, index_cgradt, index_divnt; + int index_nt, index_cgradt, index_divnt, index_ft; - double **nt, **cgradt, *divnt, *norm; + double **nt, **cgradt, *divnt, *norm, **ft; double alpha, h, hsq, hinv, hinv3, rho0; class ComputeRHEOKernel *compute_kernel; diff --git a/src/RHEO/pair_rheo_react.cpp b/src/RHEO/pair_rheo_react.cpp index 7ec63bb2a9..4846e077f6 100644 --- a/src/RHEO/pair_rheo_react.cpp +++ b/src/RHEO/pair_rheo_react.cpp @@ -20,6 +20,7 @@ #include "atom.h" #include "comm.h" +#include "compute_rheo_surface.h" #include "error.h" #include "fix.h" #include "fix_dummy.h" @@ -35,6 +36,7 @@ #include "utils.h" using namespace LAMMPS_NS; +using namespace RHEO_NS; /* ---------------------------------------------------------------------- */ @@ -45,6 +47,7 @@ PairRHEOReact::PairRHEOReact(LAMMPS *lmp) : Pair(lmp), size_history = 2; beyond_contact = 1; comm_reverse = 1; + nondefault_history_transfer = 1; // create dummy fix as placeholder for FixNeighHistory // this is so final order of Modify:fix will conform to input script @@ -92,8 +95,6 @@ PairRHEOReact::~PairRHEOReact() memory->destroy(gamma); memory->destroy(t_form); memory->destroy(rlimit); - memory->destroy(sigma); - memory->destroy(krepel); } memory->destroy(dbond); @@ -103,23 +104,21 @@ PairRHEOReact::~PairRHEOReact() void PairRHEOReact::compute(int eflag, int vflag) { - int i,j,ii,jj,inum,jnum; - double xtmp,ytmp,ztmp,delx,dely,delz; - double rsq,r,rinv,r0; - double vxtmp,vytmp,vztmp,delvx,delvy,delvz; - double fpair,dot,evdwl,smooth; + int i, j, ii, jj, inum, jnum, fluidi, fluidj; + double xtmp, ytmp, ztmp, delx, dely, delz; + double vxtmp, vytmp, vztmp, delvx, delvy, delvz; + double rsq, r, rinv, r0, fpair, dot, smooth; int itype, jtype; - int *ilist,*jlist,*numneigh,**firstneigh; - int *saved,**firstsaved; - double *data,*alldata,**firstdata; + int *ilist, *jlist, *numneigh, **firstneigh; + int *saved, **firstsaved; + double *data, *alldata, **firstdata; ev_init(eflag,vflag); int bondupdate = 1; if (update->setupflag) bondupdate = 0; - - dt = update->dt; + double dt = update->dt; double **x = atom->x; double **v = atom->v; @@ -128,6 +127,7 @@ void PairRHEOReact::compute(int eflag, int vflag) int *status = atom->status; int *mask = atom->mask; int *nbond = atom->ivector[index_nb]; + double *rsurf = compute_surface->rsurface; int nlocal = atom->nlocal; int newton_pair = force->newton_pair; @@ -139,17 +139,15 @@ void PairRHEOReact::compute(int eflag, int vflag) firstsaved = fix_history->firstflag; firstdata = fix_history->firstvalue; - if (atom->nmax > nmax){ - nmax = atom->nmax; + if (atom->nmax > nmax_store){ + nmax_store = atom->nmax; memory->destroy(dbond); - memory->create(dbond, nmax, "rheo/react:dbond"); + memory->create(dbond, nmax_store, "rheo/react:dbond"); } - // Switch to no shift if it has bonds (could have just been changed from reactive) - for(i = 0; i < nmax; i++) { - dbond[i] = 0; - } -/* + size_t nbytes = nmax_store * sizeof(int); + memset(&dbond, 0, nbytes); + // loop over neighbors of my atoms for (ii = 0; ii < inum; ii++) { i = ilist[ii]; @@ -160,30 +158,30 @@ void PairRHEOReact::compute(int eflag, int vflag) vxtmp = v[i][0]; vytmp = v[i][1]; vztmp = v[i][2]; + fluidi = !(status[i] & PHASECHECK); + saved = firstsaved[i]; alldata = firstdata[i]; jlist = firstneigh[i]; jnum = numneigh[i]; - for (jj = 0; jj < jnum; jj++) { j = jlist[jj]; j &= NEIGHMASK; jtype = type[j]; + fluidj = !(status[j] & PHASECHECK); data = &alldata[2*jj]; - // If not bonded and there's an internal fluid particle, unsave any data and skip if (!(saved[jj] == 1 && data[0] > 0)) { - if ((status[i] <= FixRHEO::FLUID_MAX && rsurf[i] > rlimit[itype][jtype]) || (status[j] <= FixRHEO::FLUID_MAX && rsurf[j] > rlimit[itype][jtype])) { + if ((fluidi && (rsurf[i] > rlimit[itype][jtype])) || (fluidj && (rsurf[j] > rlimit[itype][jtype]))) { saved[jj] = 0; continue; } } // If both are solid, unbond and skip - if ((status[i] == FixRHEO::SOLID || status[i] == FixRHEO::FREEZING) && - (status[j] == FixRHEO::SOLID || status[j] == FixRHEO::FREEZING)) { + if (!fluidi && !fluidj) { //If bonded, deincrement if (saved[jj] == 1 && data[0] > 0) { dbond[i] --; @@ -193,12 +191,10 @@ void PairRHEOReact::compute(int eflag, int vflag) continue; } - // Remaining options are react+sold, react+react, react+surf/fluid, or surf/fluid+surf/fluid - delx = xtmp - x[j][0]; dely = ytmp - x[j][1]; delz = ztmp - x[j][2]; - rsq = delx*delx + dely*dely + delz*delz; + rsq = delx * delx + dely * dely + delz * delz; // If unbonded and beyond bond distance, unsave and skip if (data[0] == -1 && rsq > cutbsq[itype][jtype]) { @@ -217,7 +213,7 @@ void PairRHEOReact::compute(int eflag, int vflag) // Check for bond formation (unbonded) or breakage (bonded) if (data[0] == -1) { // If unbonded, check if we count down to bonding if both on surface (not given for r or s) - if (bondupdate && rsurf[i] <= rlimit[itype][jtype] && rsurf[j] <= rlimit[itype][jtype]) { + if (bondupdate && (rsurf[i] <= rlimit[itype][jtype]) && (rsurf[j] <= rlimit[itype][jtype])) { data[1] += dt; if (data[1] >= t_form[itype][jtype]) { data[0] = r; @@ -229,7 +225,7 @@ void PairRHEOReact::compute(int eflag, int vflag) } else { // If bonded, check if breaks in tension r0 = data[0]; - if (r > ((1.0+eps[itype][jtype])*r0)) { + if (r > ((1.0 + eps[itype][jtype]) * r0)) { saved[jj] = 0; dbond[i] --; dbond[j] --; @@ -237,89 +233,57 @@ void PairRHEOReact::compute(int eflag, int vflag) } } - // Apply forces + // Skip if unbonded + if (data[0] <= 0) continue; + delvx = vxtmp - v[j][0]; delvy = vytmp - v[j][1]; delvz = vztmp - v[j][2]; - rinv = 1.0/r; + rinv = 1.0 / r; + r0 = data[0]; - if (data[0] <= 0) { - // Skip if either is fluid (only include r+s or r+r since already skipped s+s) - if (status[i] <= FixRHEO::FLUID_MAX || status[j] <= FixRHEO::FLUID_MAX) continue; + fpair = k[itype][jtype] * (r0 - r); - // Skip if out of contact - if (rsq > sigma[itype][jtype]*sigma[itype][jtype]) continue; + dot = delx * delvx + dely * delvy + delz * delvz; + fpair -= gamma[itype][jtype] * dot * rinv; - fpair = krepel[itype][jtype]*(sigma[itype][jtype]-r); - if (eflag) - evdwl = -0.5*krepel[itype][jtype]*(sigma[itype][jtype]-r)*(sigma[itype][jtype]-r); - - smooth = rsq/(sigma[itype][jtype]*sigma[itype][jtype]); + smooth = 1.0; + if (r > r0) { + smooth = (r - r0) / (r0 * eps[itype][jtype]); smooth *= smooth; - smooth = 1.0 - smooth; - dot = delx*delvx + dely*delvy + delz*delvz; - fpair -= gamma[itype][jtype]*dot*smooth*rinv; - - fpair *= rinv; - - f[i][0] += delx*fpair; - f[i][1] += dely*fpair; - f[i][2] += delz*fpair; - if (newton_pair || j < nlocal) { - f[j][0] -= delx*fpair; - f[j][1] -= dely*fpair; - f[j][2] -= delz*fpair; - } - - if (evflag) ev_tally(i,j,nlocal,newton_pair,evdwl,0.0,fpair,delx,dely,delz); - } else { - // Bonded - r0 = data[0]; - - fpair = k[itype][jtype]*(r0-r); - if (evflag) evdwl = -0.5*fpair*(r0-r); - - dot = delx*delvx + dely*delvy + delz*delvz; - fpair -= gamma[itype][jtype]*dot*rinv; - - smooth = 1.0; - if (r > r0) { - smooth = (r-r0)/(r0*eps[itype][jtype]); - smooth *= smooth; - smooth *= smooth; - smooth = 1 - smooth; - } - - fpair *= rinv*smooth; - - f[i][0] += delx*fpair; - f[i][1] += dely*fpair; - f[i][2] += delz*fpair; - if (newton_pair || j < nlocal) { - f[j][0] -= delx*fpair; - f[j][1] -= dely*fpair; - f[j][2] -= delz*fpair; - } - - if (evflag) ev_tally(i,j,nlocal,newton_pair,evdwl,0.0,fpair,delx,dely,delz); + smooth *= smooth; + smooth = 1 - smooth; } + + fpair *= rinv * smooth; + + f[i][0] += delx * fpair; + f[i][1] += dely * fpair; + f[i][2] += delz * fpair; + if (newton_pair || j < nlocal) { + f[j][0] -= delx * fpair; + f[j][1] -= dely * fpair; + f[j][2] -= delz * fpair; + } + + if (evflag) ev_tally(i, j, nlocal, newton_pair, 0.0, 0.0, fpair, delx, dely, delz); } } // Communicate changes in nbond - if(newton_pair) comm->reverse_comm_pair(this); + if (newton_pair) comm->reverse_comm(this); for(i = 0; i < nlocal; i++) { + fluidi = !(status[i] & PHASECHECK); nbond[i] += dbond[i]; // If it has bonds it is reactive (no shifting) // If a reactive particle breaks all bonds, return to fluid // Keep it non-shifting for this timestep to be safe - if (nbond[i] != 0 && status[i] <= FixRHEO::FLUID_MAX) status[i] = FixRHEO::FLUID_NO_SHIFT; + if (nbond[i] != 0 && fluidi) status[i] |= STATUS_NO_SHIFT; } if (vflag_fdotr) virial_fdotr_compute(); - */ } /* ---------------------------------------------------------------------- @@ -331,22 +295,20 @@ void PairRHEOReact::allocate() allocated = 1; int n = atom->ntypes; - memory->create(setflag,n+1,n+1,"pair:setflag"); + memory->create(setflag, n+1, n+1,"pair:setflag"); for (int i = 1; i <= n; i++) for (int j = i; j <= n; j++) setflag[i][j] = 0; - memory->create(cut,n+1,n+1,"pair:cut"); - memory->create(cutbond,n+1,n+1,"pair:cutbond"); - memory->create(cutsq,n+1,n+1,"pair:cutsq"); - memory->create(cutbsq,n+1,n+1,"pair:cutbsq"); - memory->create(k,n+1,n+1,"pair:k"); - memory->create(eps,n+1,n+1,"pair:eps"); - memory->create(gamma,n+1,n+1,"pair:gamma"); - memory->create(t_form,n+1,n+1,"pair:t_form"); - memory->create(rlimit,n+1,n+1,"pair:rlimit"); - memory->create(sigma,n+1,n+1,"pair:sigma"); - memory->create(krepel,n+1,n+1,"pair:krepel"); + memory->create(cut, n+1, n+1,"pair:cut"); + memory->create(cutbond, n+1, n+1,"pair:cutbond"); + memory->create(cutsq, n+1, n+1,"pair:cutsq"); + memory->create(cutbsq, n+1, n+1,"pair:cutbsq"); + memory->create(k, n+1, n+1,"pair:k"); + memory->create(eps, n+1, n+1,"pair:eps"); + memory->create(gamma, n+1, n+1,"pair:gamma"); + memory->create(t_form, n+1, n+1,"pair:t_form"); + memory->create(rlimit, n+1, n+1,"pair:rlimit"); } /* ---------------------------------------------------------------------- @@ -363,25 +325,23 @@ void PairRHEOReact::settings(int narg, char **arg) void PairRHEOReact::coeff(int narg, char **arg) { - if (narg != 11) error->all(FLERR,"Incorrect args for pair coefficients"); + if (narg != 9) error->all(FLERR,"Incorrect args for pair coefficients"); if (!allocated) allocate(); - int ilo,ihi,jlo,jhi; - utils::bounds(FLERR,arg[0],1, atom->ntypes, ilo, ihi,error); - utils::bounds(FLERR,arg[1],1, atom->ntypes, jlo, jhi,error); + int ilo, ihi, jlo, jhi; + utils::bounds(FLERR, arg[0], 1, atom->ntypes, ilo, ihi,error); + utils::bounds(FLERR, arg[1], 1, atom->ntypes, jlo, jhi,error); - double cut_one = utils::numeric(FLERR,arg[2],false,lmp); - double cutb_one = utils::numeric(FLERR,arg[3],false,lmp); - double k_one = utils::numeric(FLERR,arg[4],false,lmp); - double eps_one = utils::numeric(FLERR,arg[5],false,lmp); - double gamma_one = utils::numeric(FLERR,arg[6],false,lmp); - double t_form_one = utils::numeric(FLERR,arg[7],false,lmp); - double rlimit_one = utils::numeric(FLERR,arg[8],false,lmp); - double sigma_one = utils::numeric(FLERR,arg[9],false,lmp); - double krepel_one = utils::numeric(FLERR,arg[10],false,lmp); + double cut_one = utils::numeric(FLERR, arg[2], false, lmp); + double cutb_one = utils::numeric(FLERR, arg[3], false, lmp); + double k_one = utils::numeric(FLERR, arg[4], false, lmp); + double eps_one = utils::numeric(FLERR, arg[5], false, lmp); + double gamma_one = utils::numeric(FLERR, arg[6], false, lmp); + double t_form_one = utils::numeric(FLERR, arg[7], false, lmp); + double rlimit_one = utils::numeric(FLERR, arg[8], false, lmp); if (k_one < 0.0 || eps_one < 0.0 || - t_form_one < 0.0 || (1.0+eps_one)*cutb_one > cut_one) + t_form_one < 0.0 || (1.0 + eps_one) * cutb_one > cut_one) error->all(FLERR,"Illegal pair_style command"); int count = 0; @@ -394,8 +354,6 @@ void PairRHEOReact::coeff(int narg, char **arg) gamma[i][j] = gamma_one; t_form[i][j] = t_form_one; rlimit[i][j] = rlimit_one; - sigma[i][j] = sigma_one; - krepel[i][j] = krepel_one; setflag[i][j] = 1; count++; } @@ -414,47 +372,31 @@ void PairRHEOReact::init_style() //neighbor->requests[irequest]->history = 1; if (fix_history == nullptr) { - - // Don't want history[i][j] = -history[j][i] - nondefault_history_transfer = 1; - - char dnumstr[16]; - sprintf(dnumstr,"%d",size_history); - char **fixarg = new char*[4]; - fixarg[0] = (char *) "NEIGH_HISTORY_RHEO_REACT"; - fixarg[1] = (char *) "all"; - fixarg[2] = (char *) "NEIGH_HISTORY"; - fixarg[3] = dnumstr; - modify->replace_fix("NEIGH_HISTORY_RHEO_REACT_DUMMY",4,fixarg,1); - delete [] fixarg; - int ifix = modify->find_fix("NEIGH_HISTORY_RHEO_REACT"); - fix_history = (FixNeighHistory *) modify->fix[ifix]; + auto cmd = fmt::format("NEIGH_HISTORY_RHEO_REACT {} all NEIGH_HISTORY {}", instance_me, size_history); + fix_history = dynamic_cast( + modify->replace_fix("NEIGH_HISTORY_RHEO_REACT_DUMMY" + std::to_string(instance_me), cmd, 1)); fix_history->pair = this; fix_dummy = nullptr; } - - //int temp_flag; - //index_rsurf = atom->find_custom("rsurf", temp_flag); - //if ((index_rsurf < 0) || (temp_flag != 1)) - // error->all(FLERR, "Pair rheo/react can't find fix property/atom rsurf"); } /* ---------------------------------------------------------------------- setup specific to this pair style ------------------------------------------------------------------------- */ -void PairRHEOReact::setup() { - /* - int ifix = modify->find_fix_by_style("rheo"); - if (ifix == -1) error->all(FLERR, "Using pair rheo/react without fix rheo"); - fix_rheo = ((FixRHEO *) modify->fix[ifix]); +void PairRHEOReact::setup() +{ + auto fixes = modify->get_fix_by_style("^rheo$"); + if (fixes.size() == 0) error->all(FLERR, "Need to define fix rheo to use fix rheo/tension"); + fix_rheo = dynamic_cast(fixes[0]); - ifix = modify->find_fix_by_style("rheo/surface"); - if (ifix == -1) error->all(FLERR, "Using pair rheo/react without fix rheo/surface"); + if (!fix_rheo->surface_flag) error->all(FLERR, + "Pair rheo/react requires surface calculation in fix rheo"); + + compute_surface = fix_rheo->compute_surface; if (force->newton_pair == 0) error->all(FLERR, "Pair rheo/react needs newton pair on for bond changes to be consistent"); - */ } /* ---------------------------------------------------------------------- @@ -465,9 +407,7 @@ double PairRHEOReact::init_one(int i, int j) { if (setflag[i][j] == 0) error->all(FLERR,"All pair coeffs are not set"); - double einv = 1/eps[i][j]; - - cutbsq[i][j] = cutbond[i][j]*cutbond[i][j]; + cutbsq[i][j] = cutbond[i][j] * cutbond[i][j]; cutbsq[j][i] = cutbsq[i][j]; cut[j][i] = cut[i][j]; @@ -477,8 +417,6 @@ double PairRHEOReact::init_one(int i, int j) gamma[j][i] = gamma[i][j]; t_form[j][i] = t_form[i][j]; rlimit[j][i] = rlimit[i][j]; - sigma[j][i] = sigma[i][j]; - krepel[j][i] = krepel[i][j]; return cut[i][j]; } @@ -494,17 +432,15 @@ void PairRHEOReact::write_restart(FILE *fp) int i,j; for (i = 1; i <= atom->ntypes; i++) for (j = i; j <= atom->ntypes; j++) - fwrite(&setflag[i][j],sizeof(int),1,fp); + fwrite(&setflag[i][j], sizeof(int), 1, fp); if (setflag[i][j]) { - fwrite(&cut[i][j],sizeof(double),1,fp); - fwrite(&cutbond[i][j],sizeof(double),1,fp); - fwrite(&k[i][j],sizeof(double),1,fp); - fwrite(&eps[i][j],sizeof(double),1,fp); - fwrite(&gamma[i][j],sizeof(double),1,fp); - fwrite(&t_form[i][j],sizeof(double),1,fp); - fwrite(&rlimit[i][j],sizeof(double),1,fp); - fwrite(&sigma[i][j],sizeof(double),1,fp); - fwrite(&krepel[i][j],sizeof(double),1,fp); + fwrite(&cut[i][j], sizeof(double), 1, fp); + fwrite(&cutbond[i][j], sizeof(double), 1, fp); + fwrite(&k[i][j], sizeof(double), 1, fp); + fwrite(&eps[i][j], sizeof(double), 1, fp); + fwrite(&gamma[i][j], sizeof(double), 1, fp); + fwrite(&t_form[i][j], sizeof(double), 1, fp); + fwrite(&rlimit[i][j], sizeof(double), 1, fp); } } @@ -521,29 +457,25 @@ void PairRHEOReact::read_restart(FILE *fp) int me = comm->me; for (i = 1; i <= atom->ntypes; i++) for (j = i; j <= atom->ntypes; j++) { - if (me == 0) fread(&setflag[i][j],sizeof(int),1,fp); - MPI_Bcast(&setflag[i][j],1,MPI_INT,0,world); + if (me == 0) fread(&setflag[i][j], sizeof(int), 1, fp); + MPI_Bcast(&setflag[i][j], 1, MPI_INT, 0, world); if (setflag[i][j]) { if (me == 0) { - fread(&cut[i][j],sizeof(double),1,fp); - fread(&cutbond[i][j],sizeof(double),1,fp); - fread(&k[i][j],sizeof(double),1,fp); - fread(&eps[i][j],sizeof(double),1,fp); - fread(&gamma[i][j],sizeof(double),1,fp); - fread(&t_form[i][j],sizeof(double),1,fp); - fread(&rlimit[i][j],sizeof(double),1,fp); - fread(&sigma[i][j],sizeof(double),1,fp); - fread(&krepel[i][j],sizeof(double),1,fp); + fread(&cut[i][j], sizeof(double), 1, fp); + fread(&cutbond[i][j], sizeof(double), 1, fp); + fread(&k[i][j], sizeof(double), 1, fp); + fread(&eps[i][j], sizeof(double), 1, fp); + fread(&gamma[i][j], sizeof(double), 1, fp); + fread(&t_form[i][j], sizeof(double), 1, fp); + fread(&rlimit[i][j], sizeof(double), 1, fp); } - MPI_Bcast(&cut[i][j],1,MPI_DOUBLE,0,world); - MPI_Bcast(&cutbond[i][j],1,MPI_DOUBLE,0,world); - MPI_Bcast(&k[i][j],1,MPI_DOUBLE,0,world); - MPI_Bcast(&eps[i][j],1,MPI_DOUBLE,0,world); - MPI_Bcast(&gamma[i][j],1,MPI_DOUBLE,0,world); - MPI_Bcast(&t_form[i][j],1,MPI_DOUBLE,0,world); - MPI_Bcast(&rlimit[i][j],1,MPI_DOUBLE,0,world); - MPI_Bcast(&sigma[i][j],1,MPI_DOUBLE,0,world); - MPI_Bcast(&krepel[i][j],1,MPI_DOUBLE,0,world); + MPI_Bcast(&cut[i][j], 1,MPI_DOUBLE, 0, world); + MPI_Bcast(&cutbond[i][j], 1,MPI_DOUBLE, 0, world); + MPI_Bcast(&k[i][j], 1,MPI_DOUBLE, 0, world); + MPI_Bcast(&eps[i][j], 1,MPI_DOUBLE, 0, world); + MPI_Bcast(&gamma[i][j], 1,MPI_DOUBLE, 0, world); + MPI_Bcast(&t_form[i][j], 1,MPI_DOUBLE, 0, world); + MPI_Bcast(&rlimit[i][j], 1,MPI_DOUBLE, 0, world); } } } @@ -565,8 +497,7 @@ void PairRHEOReact::transfer_history(double* source, double* target) int PairRHEOReact::pack_reverse_comm(int n, int first, double *buf) { - int i,m,last; - + int i, m, last; m = 0; last = first + n; @@ -580,7 +511,7 @@ int PairRHEOReact::pack_reverse_comm(int n, int first, double *buf) void PairRHEOReact::unpack_reverse_comm(int n, int *list, double *buf) { - int i,j,m; + int i, j, m; m = 0; for (i = 0; i < n; i++) { diff --git a/src/RHEO/pair_rheo_react.h b/src/RHEO/pair_rheo_react.h index b349300f27..144859e68b 100644 --- a/src/RHEO/pair_rheo_react.h +++ b/src/RHEO/pair_rheo_react.h @@ -40,21 +40,21 @@ class PairRHEOReact : public Pair { void unpack_reverse_comm(int, int *, double *) override; protected: - double **cut,**cutbond,**cutbsq, **k, **eps, **gamma, **t_form, **rlimit, **sigma, **krepel; + double **cut, **cutbond, **cutbsq, **k, **eps, **gamma, **t_form, **rlimit; void allocate(); void transfer_history(double*, double*); - int size_history, nmax_store; + int size_history; int *dbond, *nbond; - double dt; - int index_nb, nmax; + int index_nb, nmax_store; char *id_fix; class FixDummy *fix_dummy; class FixNeighHistory *fix_history; class FixRHEO *fix_rheo; + class ComputeRHEOSurface *compute_surface; }; } // namespace LAMMPS_NS From 92ff79af0810209c5ac96a31148f79a6e3693b29 Mon Sep 17 00:00:00 2001 From: jtclemm Date: Mon, 6 Nov 2023 16:22:02 -0700 Subject: [PATCH 055/158] Debugging BPM coupling --- src/RHEO/fix_rheo.cpp | 4 +- src/RHEO/fix_rheo.h | 2 +- src/RHEO/fix_rheo_thermal.cpp | 150 +++++++++++++++++++++------------- src/RHEO/fix_rheo_thermal.h | 6 +- src/set.cpp | 2 +- 5 files changed, 101 insertions(+), 63 deletions(-) diff --git a/src/RHEO/fix_rheo.cpp b/src/RHEO/fix_rheo.cpp index c8dca74d32..97b867179e 100644 --- a/src/RHEO/fix_rheo.cpp +++ b/src/RHEO/fix_rheo.cpp @@ -150,7 +150,7 @@ void FixRHEO::post_constructor() compute_kernel->fix_rheo = this; std::string cmd = "rheo_grad all RHEO/GRAD velocity rho viscosity"; - if (thermal_flag) cmd += "temperature"; + if (thermal_flag) cmd += " temperature"; compute_grad = dynamic_cast(modify->add_compute(cmd)); compute_grad->fix_rheo = this; @@ -254,7 +254,7 @@ void FixRHEO::setup(int /*vflag*/) covered = 0; for (auto fix : therm_fixes) if (mask[i] & fix->groupbit) covered = 1; - if (!covered) v_coverage_flag = 0; + if (!covered) t_coverage_flag = 0; } } diff --git a/src/RHEO/fix_rheo.h b/src/RHEO/fix_rheo.h index 0b864bb602..da98f3d09a 100644 --- a/src/RHEO/fix_rheo.h +++ b/src/RHEO/fix_rheo.h @@ -75,7 +75,7 @@ namespace RHEO_NS { enum Status{ // Phase status STATUS_SOLID = 1 << 0, - STATUS_REACTIVE = 1 << 1, + // STATUS_REACTIVE = 1 << 1, // Surface status STATUS_BULK = 1 << 2, diff --git a/src/RHEO/fix_rheo_thermal.cpp b/src/RHEO/fix_rheo_thermal.cpp index 48a22a5419..ba61619594 100644 --- a/src/RHEO/fix_rheo_thermal.cpp +++ b/src/RHEO/fix_rheo_thermal.cpp @@ -51,6 +51,9 @@ FixRHEOThermal::FixRHEOThermal(LAMMPS *lmp, int narg, char **arg) : { if (narg < 4) error->all(FLERR,"Illegal fix command"); + force_reneighbor = 1; + next_reneighbor = -1; + Tc_style = NONE; cv_style = NONE; conductivity_style = NONE; @@ -109,7 +112,6 @@ FixRHEOThermal::FixRHEOThermal(LAMMPS *lmp, int narg, char **arg) : if (iarg + 2 >= narg) error->all(FLERR,"Insufficient arguments for Tfreeze option"); Tc_style = CONSTANT; Tc = utils::numeric(FLERR,arg[iarg + 2],false,lmp); - if (Tc < 0.0) error->all(FLERR,"The melting temperature must be positive"); iarg += 2; } else if (strcmp(arg[iarg + 1],"type") == 0) { if (iarg + 1 + ntypes >= narg) error->all(FLERR,"Insufficient arguments for Tfreeze option"); @@ -130,6 +132,8 @@ FixRHEOThermal::FixRHEOThermal(LAMMPS *lmp, int narg, char **arg) : comm_forward = 1; if (cut_bond <= 0.0) error->all(FLERR, "Illegal value for bond lengths");\ if (btype < 1 || btype > atom->nbondtypes) error->all(FLERR, "Illegal value for bond type"); + + cutsq_bond = cut_bond * cut_bond; iarg += 2; } else { error->all(FLERR,"Illegal fix command, {}", arg[iarg]); @@ -175,6 +179,10 @@ void FixRHEOThermal::init() auto fixes = modify->get_fix_by_style("^rheo$"); if (fixes.size() == 0) error->all(FLERR, "Need to define fix rheo to use fix rheo/viscosity"); fix_rheo = dynamic_cast(fixes[0]); + cut_kernel = fix_rheo->h; + + if (cut_bond > cut_kernel) + error->all(FLERR, "Bonding length exceeds kernel cutoff"); if (!fix_rheo->thermal_flag) error->all(FLERR, "Need to define thermal setting in fix rheo"); @@ -204,7 +212,7 @@ void FixRHEOThermal::init() // need a half neighbor list, built only when particles freeze auto req = neighbor->add_request(this, NeighConst::REQ_OCCASIONAL); - req->set_cutoff(cut_bond); + req->set_cutoff(cut_kernel); // find instances of bond history to delete data histories = modify->get_fix_by_style("BOND_HISTORY"); @@ -276,7 +284,8 @@ void FixRHEOThermal::post_integrate() double cvi, Tci, Ti; - int phase_changes = 0; + int n_melt = 0; + int n_freeze = 0; //Integrate temperature and check status for (int i = 0; i < atom->nlocal; i++) { @@ -299,7 +308,7 @@ void FixRHEOThermal::post_integrate() if (status[i] & STATUS_SOLID) { status[i] &= PHASEMASK; status[i] |= STATUS_MELTING; - phase_changes += 1; + n_melt += 1; } } else { // If fluid, freeze @@ -307,21 +316,21 @@ void FixRHEOThermal::post_integrate() status[i] &= PHASEMASK; status[i] |= STATUS_SOLID; status[i] |= STATUS_FREEZING; - phase_changes += 1; + n_freeze += 1; } } } } } - if (cut_bond > 0 && phase_changes != 0) { + if (cut_bond > 0 && (n_melt || n_freeze)) { // Forward status then delete/create bonds comm->forward_comm(this); - for (int i = 0; i < atom->nlocal; i++) { - if (status[i] & STATUS_MELTING) break_bonds(i); - if (status[i] & STATUS_FREEZING) create_bonds(i); - } + if (n_freeze) create_bonds(); + if (n_melt) break_bonds(); + + next_reneighbor = update->ntimestep; } } @@ -387,9 +396,9 @@ void FixRHEOThermal::reset_dt() /* ---------------------------------------------------------------------- */ -void FixRHEOThermal::break_bonds(int i) +void FixRHEOThermal::break_bonds() { - int m, n, nmax, j; + int m, n, nmax, i, j; tagint *tag = atom->tag; int *status = atom->status; @@ -397,84 +406,113 @@ void FixRHEOThermal::break_bonds(int i) tagint **bond_atom = atom->bond_atom; int *num_bond = atom->num_bond; - for (m = 0; m < num_bond[i]; m++) { - j = bond_atom[i][m]; - if (n_histories > 0) - for (auto &ihistory: histories) - dynamic_cast(ihistory)->delete_history(i,num_bond[i]-1); + int nlocal = atom->nlocal; - if (fix_update_special_bonds) fix_update_special_bonds->add_broken_bond(i,j); + for (int i = 0; i < nlocal; i++) { + if (!(status[i] & STATUS_MELTING)) continue; - if (j >= atom->nlocal) continue; + for (m = 0; m < num_bond[i]; m++) { + j = atom->map(bond_atom[i][m]); + if (n_histories > 0) + for (auto &ihistory: histories) + dynamic_cast(ihistory)->delete_history(i, num_bond[i] - 1); - for (n = 0; n < num_bond[j]; n++) { - if (bond_atom[j][n] == tag[i]) { - bond_type[j][n] = 0; - nmax = num_bond[j] - 1; - bond_type[j][n] = bond_type[j][nmax]; - bond_atom[j][n] = bond_atom[j][nmax]; - if (n_histories > 0) { - for (auto &ihistory: histories) { - dynamic_cast(ihistory)->shift_history(j, n, nmax); - dynamic_cast(ihistory)->delete_history(j, nmax); + if (fix_update_special_bonds) fix_update_special_bonds->add_broken_bond(i, j); + + // For non-melting neighbors, selectively delete bond if necessary + if (j >= nlocal || (status[j] & STATUS_MELTING)) continue; + for (n = 0; n < num_bond[j]; n++) { + if (bond_atom[j][n] == tag[i]) { + bond_type[j][n] = 0; + nmax = num_bond[j] - 1; + bond_type[j][n] = bond_type[j][nmax]; + bond_atom[j][n] = bond_atom[j][nmax]; + if (n_histories > 0) { + for (auto &ihistory: histories) { + dynamic_cast(ihistory)->shift_history(j, n, nmax); + dynamic_cast(ihistory)->delete_history(j, nmax); + } } + num_bond[j]--; + break; } - num_bond[j]--; - break; } } + num_bond[i] = 0; } - - num_bond[i] = 0; } /* ---------------------------------------------------------------------- */ -void FixRHEOThermal::create_bonds(int i) +void FixRHEOThermal::create_bonds() { - int i1, i2, j, jj, jnum; - int *jlist, *numneigh, **firstneigh; - double rsq; + int i, j, ii, jj, inum, jnum; + int *ilist, *jlist, *numneigh, **firstneigh; + double xtmp, ytmp, ztmp, delx, dely, delz, rsq; int nlocal = atom->nlocal; + int newton_bond = force->newton_bond; tagint *tag = atom->tag; + tagint **bond_atom = atom->bond_atom; + int *status = atom->status; + int **bond_type = atom->bond_type; + int *num_bond = atom->num_bond; double **x = atom->x; + + neighbor->build_one(list, 1); + + + inum = list->inum; + ilist = list->ilist; numneigh = list->numneigh; firstneigh = list->firstneigh; - int *status = atom->status; - int **bond_type = atom->bond_type; - tagint **bond_atom = atom->bond_atom; - int *num_bond = atom->num_bond; - int newton_bond = force->newton_bond; + // loop over neighbors of my atoms + // might be faster to do a full list and just act on the atom that freezes + for (ii = 0; ii < inum; ii++) { + i = ilist[ii]; + if (!(status[i] & STATUS_SOLID)) continue; - double xtmp = x[i][0]; - double ytmp = x[i][1]; - double ztmp = x[i][2]; - double delx, dely, delz; + xtmp = x[i][0]; + ytmp = x[i][1]; + ztmp = x[i][2]; + + jlist = firstneigh[i]; + jnum = numneigh[i]; + + for (jj = 0; jj < jnum; jj++) { + j = jlist[jj]; + j &= SPECIALMASK; + + if (!(status[j] & STATUS_SOLID)) continue; + if (!(status[i] & STATUS_FREEZING) && !(status[j] & STATUS_FREEZING)) continue; - // Loop through atoms of owned atoms - jlist = firstneigh[i]; - jnum = numneigh[i]; - for (jj = 0; jj < jnum; jj++) { - j = jlist[jj]; - j &= SPECIALMASK; - if (status[j] & STATUS_SOLID) { delx = xtmp - x[j][0]; dely = ytmp - x[j][1]; delz = ztmp - x[j][2]; rsq = delx * delx + dely * dely + delz * delz; - if (rsq > cut_bond) continue; + if (rsq > cutsq_bond) continue; - if (!newton_bond || tag[i] < tag[j]) { + // Add bonds to owned atoms + // If newton bond, add to both, otherwise add to whichever has a smaller tag + if (i < nlocal && (!newton_bond || tag[i] < tag[j])) { if (num_bond[i] == atom->bond_per_atom) error->one(FLERR,"New bond exceeded bonds per atom in fix rheo/thermal"); - if (fix_update_special_bonds) fix_update_special_bonds->add_created_bond(i,j); + if (fix_update_special_bonds) fix_update_special_bonds->add_created_bond(i, j); bond_type[i][num_bond[i]] = btype; bond_atom[i][num_bond[i]] = tag[j]; num_bond[i]++; } + + if (j < nlocal && (!newton_bond || tag[j] < tag[i])) { + if (num_bond[j] == atom->bond_per_atom) + error->one(FLERR,"New bond exceeded bonds per atom in fix rheo/thermal"); + if (fix_update_special_bonds) fix_update_special_bonds->add_created_bond(i, j); + bond_type[j][num_bond[j]] = btype; + bond_atom[j][num_bond[j]] = tag[i]; + num_bond[j]++; + } } } } diff --git a/src/RHEO/fix_rheo_thermal.h b/src/RHEO/fix_rheo_thermal.h index 75d32b7bc1..da48a59e22 100644 --- a/src/RHEO/fix_rheo_thermal.h +++ b/src/RHEO/fix_rheo_thermal.h @@ -49,7 +49,7 @@ class FixRHEOThermal : public Fix { double *Tc_type, Tc; double *kappa_type, kappa; double dtf, dtv; - double cut_bond; + double cut_kernel, cut_bond, cutsq_bond; int Tc_style, cv_style; int btype; int conductivity_style; @@ -64,8 +64,8 @@ class FixRHEOThermal : public Fix { class FixUpdateSpecialBonds *fix_update_special_bonds; void grow_array(int); - void break_bonds(int); - void create_bonds(int); + void break_bonds(); + void create_bonds(); }; } // namespace LAMMPS_NS diff --git a/src/set.cpp b/src/set.cpp index 92033b772e..3e1058b048 100644 --- a/src/set.cpp +++ b/src/set.cpp @@ -1105,7 +1105,7 @@ void Set::set(int keyword) // set temperature of particle - else if (keyword == ANGMOM) { + else if (keyword == TEMPERATURE) { if (dvalue < 0.0) error->one(FLERR,"Invalid temperature in set command"); atom->temperature[i] = dvalue; } From 44ae758bf5257e1594c59b9bd512371d5929b1bc Mon Sep 17 00:00:00 2001 From: jtclemm Date: Mon, 6 Nov 2023 20:27:18 -0700 Subject: [PATCH 056/158] Parallel support for bond creation/deletion --- src/RHEO/fix_rheo_thermal.cpp | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/src/RHEO/fix_rheo_thermal.cpp b/src/RHEO/fix_rheo_thermal.cpp index ba61619594..7c29e17f93 100644 --- a/src/RHEO/fix_rheo_thermal.cpp +++ b/src/RHEO/fix_rheo_thermal.cpp @@ -323,12 +323,16 @@ void FixRHEOThermal::post_integrate() } } - if (cut_bond > 0 && (n_melt || n_freeze)) { + int n_melt_all, n_freeze_all; + MPI_Allreduce(&n_melt, &n_melt_all, 1, MPI_INT, MPI_SUM, world); + MPI_Allreduce(&n_freeze, &n_freeze_all, 1, MPI_INT, MPI_SUM, world); + + if (cut_bond > 0 && (n_melt_all || n_freeze_all)) { // Forward status then delete/create bonds comm->forward_comm(this); - if (n_freeze) create_bonds(); - if (n_melt) break_bonds(); + if (n_freeze_all) create_bonds(); + if (n_melt_all) break_bonds(); next_reneighbor = update->ntimestep; } @@ -409,10 +413,10 @@ void FixRHEOThermal::break_bonds() int nlocal = atom->nlocal; for (int i = 0; i < nlocal; i++) { - if (!(status[i] & STATUS_MELTING)) continue; - for (m = 0; m < num_bond[i]; m++) { j = atom->map(bond_atom[i][m]); + if (!(status[i] & STATUS_MELTING) && !(status[j] & STATUS_MELTING)) continue; + if (n_histories > 0) for (auto &ihistory: histories) dynamic_cast(ihistory)->delete_history(i, num_bond[i] - 1); @@ -462,7 +466,6 @@ void FixRHEOThermal::create_bonds() neighbor->build_one(list, 1); - inum = list->inum; ilist = list->ilist; numneigh = list->numneigh; From b8b2141993ecdf6383150f512a2223f431f1d21f Mon Sep 17 00:00:00 2001 From: jtclemm Date: Tue, 7 Nov 2023 14:47:46 -0700 Subject: [PATCH 057/158] Fixing errors in oxide model --- src/RHEO/compute_rheo_property_atom.cpp | 2 +- src/RHEO/compute_rheo_surface.cpp | 81 ++++++++++++------------- src/RHEO/fix_rheo.cpp | 7 ++- src/RHEO/pair_rheo_react.cpp | 21 ++++--- 4 files changed, 56 insertions(+), 55 deletions(-) diff --git a/src/RHEO/compute_rheo_property_atom.cpp b/src/RHEO/compute_rheo_property_atom.cpp index 3afeb03e43..615d5ea740 100644 --- a/src/RHEO/compute_rheo_property_atom.cpp +++ b/src/RHEO/compute_rheo_property_atom.cpp @@ -103,7 +103,7 @@ ComputeRHEOPropertyAtom::ComputeRHEOPropertyAtom(LAMMPS *lmp, int narg, char **a if (avec_index[i] < 0) error->all(FLERR, "Invalid keyword {} for atom style {} in compute rheo/property/atom command ", - atom->get_style(), arg[iarg]); + arg[iarg], atom->get_style()); pack_choice[i] = &ComputeRHEOPropertyAtom::pack_atom_style; if (strcmp(arg[iarg],"temperature") == 0) thermal_flag = 1; diff --git a/src/RHEO/compute_rheo_surface.cpp b/src/RHEO/compute_rheo_surface.cpp index 88b33c09af..882977f3e9 100644 --- a/src/RHEO/compute_rheo_surface.cpp +++ b/src/RHEO/compute_rheo_surface.cpp @@ -152,16 +152,12 @@ void ComputeRHEOSurface::compute_peratom() grow_arrays(atom->nmax); size_t nbytes = nmax_store * sizeof(double); - memset(&divr, 0, nbytes); - memset(&rsurface, 0, nbytes); - memset(&nsurface, 0, 3 * nbytes); - memset(&gradC, 0, 3 * 3 * nbytes); - memset(&B, 0, 3 * 3 * nbytes); + memset(&divr[0], 0, nbytes); + memset(&rsurface[0], 0, nbytes); + memset(&nsurface[0][0], 0, dim * nbytes); + memset(&gradC[0][0], 0, dim * dim * nbytes); + memset(&B[0][0], 0, dim * dim * nbytes); - // Remove surface settings - int nall = nlocal + atom->nghost; - for (i = 0; i < nall; i++) - status[i] &= SURFACEMASK; // loop over neighbors to calculate the average orientation of neighbors for (ii = 0; ii < inum; ii++) { @@ -208,7 +204,7 @@ void ComputeRHEOSurface::compute_peratom() wp = compute_kernel->calc_dw_quintic(i, j, dx[0], dx[1], dx[2], sqrt(rsq), dWij, dWji); - for (a = 0; a < dim; a++){ + for (a = 0; a < dim; a++) { divr[i] -= dWij[a] * dx[a] * Volj; gradC[i][a] += dWij[a] * Volj; } @@ -245,35 +241,32 @@ void ComputeRHEOSurface::compute_peratom() } } - // Find the free-surface - if (threshold_style == DIVR) { - for (i = 0; i < nall; i++) { - if (mask[i] & groupbit) { + // Remove surface settings and assign new values + int nall = nlocal + atom->nghost; + int test; + + for (i = 0; i < nall; i++) { + status[i] &= SURFACEMASK; + if (mask[i] & groupbit) { + if (threshold_style == DIVR) + test = divr[i] < threshold_divr; + else + test = coordination[i] < threshold_z; + + if (test) { + if (coordination[i] < threshold_splash) + status[i] |= STATUS_SPLASH; + else + status[i] |= STATUS_SURFACE; + rsurface[i] = 0.0; + } else { status[i] |= STATUS_BULK; rsurface[i] = cut; - if (divr[i] < threshold_divr) { - status[i] |= STATUS_SURFACE; - rsurface[i] = 0.0; - if (coordination[i] < threshold_splash) - status[i] |= STATUS_SPLASH; - } - } - } - } else { - for (i = 0; i < nall; i++) { - if (mask[i] & groupbit) { - status[i] |= STATUS_BULK; - rsurface[i] = cut; - if (coordination[i] < threshold_z) { - status[i] |= STATUS_SURFACE; - rsurface[i] = 0.0; - if (coordination[i] < threshold_splash) - status[i] |= STATUS_SPLASH; - } } } } + for (ii = 0; ii < inum; ii++) { i = ilist[ii]; xtmp = x[i][0]; @@ -297,7 +290,8 @@ void ComputeRHEOSurface::compute_peratom() status[i] |= STATUS_LAYER; } - if (status[j] & STATUS_SURFACE) rsurface[i] = MIN(rsurface[i], sqrt(rsq)); + if (status[j] & STATUS_SURFACE) + rsurface[i] = MIN(rsurface[i], sqrt(rsq)); if (j < nlocal || newton) { @@ -306,7 +300,8 @@ void ComputeRHEOSurface::compute_peratom() status[j] |= STATUS_LAYER; } - if (status[i] & STATUS_SURFACE) rsurface[j] = MIN(rsurface[j], sqrt(rsq)); + if (status[i] & STATUS_SURFACE) + rsurface[j] = MIN(rsurface[j], sqrt(rsq)); } } } @@ -351,7 +346,8 @@ void ComputeRHEOSurface::unpack_reverse_comm(int n, int *list, double *buf) int i,a,b,k,j,m; int dim = domain->dimension; int *status = atom->status; - int temp; + int tmp1; + double tmp2; m = 0; for (i = 0; i < n; i++) { @@ -362,12 +358,13 @@ void ComputeRHEOSurface::unpack_reverse_comm(int n, int *list, double *buf) for (b = 0; b < dim; b ++) gradC[j][a * dim + b] += buf[m++]; } else if (comm_stage == 1) { - - temp = (int) buf[m++]; - if ((status[j] & STATUS_BULK) && (temp & STATUS_LAYER)) - status[j] = temp; - - rsurface[j] = MIN(rsurface[j], buf[m++]); + tmp1 = (int) buf[m++]; + if ((status[j] & STATUS_BULK) && (tmp1 & STATUS_LAYER)) { + status[j] &= SURFACEMASK; + status[j] |= STATUS_LAYER; + } + tmp2 = buf[m++]; + rsurface[j] = MIN(rsurface[j], tmp2); } } } diff --git a/src/RHEO/fix_rheo.cpp b/src/RHEO/fix_rheo.cpp index 97b867179e..b1bc0fe0c0 100644 --- a/src/RHEO/fix_rheo.cpp +++ b/src/RHEO/fix_rheo.cpp @@ -133,7 +133,7 @@ FixRHEO::~FixRHEO() if (compute_kernel) modify->delete_compute("rheo_kernel"); if (compute_grad) modify->delete_compute("rheo_grad"); if (compute_interface) modify->delete_compute("rheo_interface"); - if (compute_surface) modify->delete_compute("compute_surface"); + if (compute_surface) modify->delete_compute("rheo_surface"); if (compute_rhosum) modify->delete_compute("rheo_rhosum"); if (compute_vshift) modify->delete_compute("rheo_vshift"); } @@ -211,7 +211,10 @@ void FixRHEO::setup_pre_force(int /*vflag*/) error->all(FLERR, "Fix RHEO must be defined before all other RHEO fixes"); // Calculate surfaces - if (surface_flag) compute_surface->compute_peratom(); + if (surface_flag) { + compute_kernel->compute_coordination(); + compute_surface->compute_peratom(); + } pre_force(0); } diff --git a/src/RHEO/pair_rheo_react.cpp b/src/RHEO/pair_rheo_react.cpp index 4846e077f6..d7412d5d0e 100644 --- a/src/RHEO/pair_rheo_react.cpp +++ b/src/RHEO/pair_rheo_react.cpp @@ -61,13 +61,13 @@ PairRHEOReact::PairRHEOReact(LAMMPS *lmp) : Pair(lmp), // between timesteps (fix property atom will handle callbacks) int tmp1, tmp2; - int index = atom->find_custom("react_nbond", tmp1, tmp2); - if (index == -1) { + index_nb = atom->find_custom("react_nbond", tmp1, tmp2); + if (index_nb == -1) { id_fix = utils::strdup("pair_rheo_react_fix_property_atom"); modify->add_fix(fmt::format("{} all property/atom i_react_nbond", id_fix)); - index = atom->find_custom("nbond", tmp1, tmp2); + index_nb = atom->find_custom("react_nbond", tmp1, tmp2); } - nbond = atom->ivector[index]; + nbond = atom->ivector[index_nb]; //Store non-persistent per atom quantities, intermediate @@ -79,9 +79,10 @@ PairRHEOReact::PairRHEOReact(LAMMPS *lmp) : Pair(lmp), PairRHEOReact::~PairRHEOReact() { - if (modify->nfix && fix_history) modify->delete_fix("NEIGH_HISTORY_RHEO_REACT"); - if (modify->nfix && fix_dummy) modify->delete_fix("NEIGH_HISTORY_RHEO_REACT_DUMMY"); - if (modify->nfix) modify->delete_fix("PROPERTY_ATOM_RHEO_REACT"); + if (modify->nfix && fix_history) modify->delete_fix("NEIGH_HISTORY_RHEO_REACT" + std::to_string(instance_me)); + if (modify->nfix && fix_dummy) modify->delete_fix("NEIGH_HISTORY_RHEO_REACT_DUMMY" + std::to_string(instance_me)); + if (modify->nfix) modify->delete_fix(id_fix); + delete[] id_fix; if (allocated) { memory->destroy(setflag); @@ -146,7 +147,7 @@ void PairRHEOReact::compute(int eflag, int vflag) } size_t nbytes = nmax_store * sizeof(int); - memset(&dbond, 0, nbytes); + memset(&dbond[0], 0, nbytes); // loop over neighbors of my atoms for (ii = 0; ii < inum; ii++) { @@ -368,11 +369,11 @@ void PairRHEOReact::coeff(int narg, char **arg) void PairRHEOReact::init_style() { - int irequest = neighbor->request(this,instance_me); + int irequest = neighbor->request(this, instance_me); //neighbor->requests[irequest]->history = 1; if (fix_history == nullptr) { - auto cmd = fmt::format("NEIGH_HISTORY_RHEO_REACT {} all NEIGH_HISTORY {}", instance_me, size_history); + auto cmd = fmt::format("NEIGH_HISTORY_RHEO_REACT{} all NEIGH_HISTORY {}", instance_me, size_history); fix_history = dynamic_cast( modify->replace_fix("NEIGH_HISTORY_RHEO_REACT_DUMMY" + std::to_string(instance_me), cmd, 1)); fix_history->pair = this; From c922fcef5a7849cc930f4057973e7460ecb5a7c6 Mon Sep 17 00:00:00 2001 From: jtclemm Date: Wed, 8 Nov 2023 14:30:37 -0700 Subject: [PATCH 058/158] prototyping limit on tension --- src/RHEO/compute_rheo_vshift.cpp | 2 +- src/RHEO/fix_rheo_pressure.cpp | 12 ++-- src/RHEO/fix_rheo_tension.cpp | 112 +++++++++++++++++++++++++------ src/RHEO/fix_rheo_tension.h | 4 +- src/RHEO/fix_rheo_thermal.cpp | 64 +++++++++--------- src/RHEO/fix_rheo_viscosity.cpp | 2 +- 6 files changed, 134 insertions(+), 62 deletions(-) diff --git a/src/RHEO/compute_rheo_vshift.cpp b/src/RHEO/compute_rheo_vshift.cpp index 9741026324..aa59f80ff2 100644 --- a/src/RHEO/compute_rheo_vshift.cpp +++ b/src/RHEO/compute_rheo_vshift.cpp @@ -232,7 +232,7 @@ void ComputeRHEOVShift::correct_surfaces() int nlocal = atom->nlocal; int dim = domain->dimension; - double nx,ny,nz,vx,vy,vz; + double nx, ny, nz, vx, vy, vz; for (i = 0; i < nlocal; i++) { if (mask[i] & groupbit) { if ((status[i] & STATUS_SURFACE) || (status[i] & STATUS_LAYER)) { diff --git a/src/RHEO/fix_rheo_pressure.cpp b/src/RHEO/fix_rheo_pressure.cpp index 84d21ee872..5049ab0a4e 100644 --- a/src/RHEO/fix_rheo_pressure.cpp +++ b/src/RHEO/fix_rheo_pressure.cpp @@ -51,14 +51,14 @@ FixRHEOPressure::FixRHEOPressure(LAMMPS *lmp, int narg, char **arg) : int ntypes = atom->ntypes; int iarg = 3; - if (strcmp(arg[iarg],"linear") == 0) { + if (strcmp(arg[iarg], "linear") == 0) { pressure_style = LINEAR; - } else if (strcmp(arg[iarg],"taitwater") == 0) { + } else if (strcmp(arg[iarg], "taitwater") == 0) { pressure_style = TAITWATER; - } else if (strcmp(arg[iarg],"cubic") == 0) { + } else if (strcmp(arg[iarg], "cubic") == 0) { pressure_style = CUBIC; - if (iarg + 1 >= narg) error->all(FLERR,"Insufficient arguments for pressure option"); - c_cubic = utils::numeric(FLERR,arg[iarg + 1],false,lmp); + if (iarg + 1 >= narg) error->all(FLERR, "Insufficient arguments for pressure option"); + c_cubic = utils::numeric(FLERR, arg[iarg + 1], false, lmp); } else { error->all(FLERR,"Illegal fix command, {}", arg[iarg]); } @@ -96,7 +96,7 @@ void FixRHEOPressure::init() // Cannot define multiple as pair rheo cannot currently distinguish if (modify->get_fix_by_style("rheo/pressure").size() > 1) - error->all(FLERR,"Can only specify one instance of fix rheo/pressure"); + error->all(FLERR, "Can only specify one instance of fix rheo/pressure"); } /* ---------------------------------------------------------------------- */ diff --git a/src/RHEO/fix_rheo_tension.cpp b/src/RHEO/fix_rheo_tension.cpp index 047f1d217e..8b79fcebd6 100644 --- a/src/RHEO/fix_rheo_tension.cpp +++ b/src/RHEO/fix_rheo_tension.cpp @@ -46,8 +46,10 @@ using namespace FixConst; FixRHEOTension::FixRHEOTension(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg), compute_kernel(nullptr), compute_interface(nullptr), fix_rheo(nullptr) { - if (narg != 4) error->all(FLERR,"Illegal fix command"); - alpha = utils::numeric(FLERR,arg[3],false,lmp); + if (narg != 6) error->all(FLERR,"Illegal fix command"); + alpha = utils::numeric(FLERR, arg[3], false, lmp); + alpha = utils::numeric(FLERR, arg[4], false, lmp); + wmin = utils::numeric(FLERR, arg[5], false, lmp); comm_forward = 3; comm_reverse = 3; @@ -75,6 +77,7 @@ FixRHEOTension::FixRHEOTension(LAMMPS *lmp, int narg, char **arg) : ft = atom->darray[index_ft]; norm = nullptr; + wsame = nullptr; nmax_store = 0; } @@ -98,6 +101,7 @@ FixRHEOTension::~FixRHEOTension() if (index != -1) atom->remove_custom(index, 1, 3); memory->destroy(norm); + memory->destroy(wsame); } /* ---------------------------------------------------------------------- */ @@ -182,13 +186,11 @@ void FixRHEOTension::post_force(int vflag) if (nmax_store <= atom->nmax) grow_arrays(atom->nmax); - for (i = 0; i < nlocal+atom->nghost; i++) { - cgradt[i][0] = 0.0; - cgradt[i][1] = 0.0; - cgradt[i][2] = 0.0; - norm[i] = 0.0; - divnt[i] = 0.0; - } + size_t nbytes = nmax_store * sizeof(double); + memset(&norm[0], 0, nbytes); + memset(&wsame[0], 0, nbytes); + memset(&divnt[0], 0, nbytes); + memset(&cgradt[0][0], 0, 3 * nbytes); // Calculate color gradient for (ii = 0; ii < inum; ii++) { @@ -315,17 +317,26 @@ void FixRHEOTension::post_force(int vflag) Voli = mass[itype] / rhoi; Volj = mass[jtype] / rhoj; + w = compute_kernel->calc_w(i, j, dx[0], dx[1], dx[2],r); wp = compute_kernel->calc_dw(i, j, dx[0], dx[1], dx[2],r); dWij = compute_kernel->dWij; dWji = compute_kernel->dWji; - if (itype != jtype) continue; // have to think about this... - for (a = 0; a < 3; a++) { - divnt[i] -= (nt[i][a]-nt[j][a]) * Volj * dWij[a]; + if (itype != jtype) + divnt[i] -= (nt[i][a]+nt[j][a]) * Volj * dWij[a]; + else { + divnt[i] -= (nt[i][a]-nt[j][a]) * Volj * dWij[a]; + wsame[i] += w; + } norm[i] -= dx[a] * Volj * dWij[a]; if (newton || j < nlocal) { - divnt[j] += (nt[i][a]-nt[j][a]) * Voli * dWji[a]; + if (itype != jtype) + divnt[j] -= (nt[j][a]+nt[i][a]) * Voli * dWji[a]; + else { + divnt[j] -= (nt[j][a]-nt[i][a]) * Voli * dWji[a]; + wsame[j] += w; + } norm[j] += dx[a] * Voli * dWji[a]; } } @@ -333,26 +344,28 @@ void FixRHEOTension::post_force(int vflag) } comm_stage = 1; - comm_reverse = 2; + comm_reverse = 3; if (newton) comm->reverse_comm(this); // Skip forces if it's setup if (update->setupflag) return; // apply force - double prefactor; - double unwrap[3]; - double v[6]; + double weight, prefactor, unwrap[3], v[6]; + double wmin_inv = 1.0 / wmin; for (i = 0; i < nlocal; i++) { + + weight = MAX(1.0, (wsame[i] - wmin) * wmin_inv); + //if (wsame[i] < wmin) continue; + itype = type[i]; if (norm[i] != 0) - divnt[i] /= norm[i]; + divnt[i] *= dim * norm[i]; else divnt[i] = 0.0; - prefactor = -alpha * divnt[i]; - + prefactor = -alpha * divnt[i] * weight; for (a = 0; a < 3; a++) { f[i][a] += prefactor * cgradt[i][a]; ft[i][a] = prefactor * cgradt[i][a]; @@ -369,6 +382,62 @@ void FixRHEOTension::post_force(int vflag) v_tally(i, v); } } + + // If there is no lower limit, apply optional pairwise forces + if (wmin == 0 || beta == 0.0) return; + + double fpair, wi, wj; + double cut_two_thirds = 2.0 * h / 3.0; + double h_third_squared = (h / 3.0) * (h / 3.0); + for (ii = 0; ii < inum; ii++) { + i = ilist[ii]; + xtmp = x[i][0]; + ytmp = x[i][1]; + ztmp = x[i][2]; + itype = type[i]; + jlist = firstneigh[i]; + jnum = numneigh[i]; + imass = mass[itype]; + + wi = MIN(1.0, (wsame[i] - wmin) * wmin_inv); + + for (jj = 0; jj < jnum; jj++) { + j = jlist[jj]; + j &= NEIGHMASK; + + if (wsame[i] >= wmin && wsame[j] >= wmin) continue; + + dx[0] = xtmp - x[j][0]; + dx[1] = ytmp - x[j][1]; + dx[2] = ztmp - x[j][2]; + rsq = lensq3(dx); + + if (rsq > hsq) continue; + + wj = MIN(1.0, (wsame[j] - wmin) * wmin_inv); + r = sqrt(rsq); + rinv = 1.0 / r; + + fpair = (r - cut_two_thirds); + fpair *= fpair; + fpair -= h_third_squared; + fpair *= wi * wj * beta * rinv; + + f[i][0] += dx[0] * fpair; + f[i][1] += dx[1] * fpair; + f[i][2] += dx[2] * fpair; + + if (newton || j < nlocal) { + f[j][0] -= dx[0] * fpair; + f[j][1] -= dx[1] * fpair; + f[j][2] -= dx[2] * fpair; + } + + if (evflag) { + // In progress + } + } + } } @@ -417,6 +486,7 @@ int FixRHEOTension::pack_reverse_comm(int n, int first, double *buf) for (i = first; i < last; i++) { buf[m++] = norm[i]; buf[m++] = divnt[i]; + buf[m++] = wsame[i]; } return m; } @@ -439,6 +509,7 @@ void FixRHEOTension::unpack_reverse_comm(int n, int *list, double *buf) j = list[i]; norm[j] += buf[m++]; divnt[j] += buf[m++]; + wsame[j] += buf[m++]; } } @@ -459,6 +530,7 @@ void FixRHEOTension::grow_arrays(int nmax) // Grow local variables memory->grow(norm, nmax, "rheo/tension:norm"); + memory->grow(wsame, nmax, "rheo/tension:wsame"); nmax_store = atom->nmax; } \ No newline at end of file diff --git a/src/RHEO/fix_rheo_tension.h b/src/RHEO/fix_rheo_tension.h index 11bc209d88..f56a61e688 100644 --- a/src/RHEO/fix_rheo_tension.h +++ b/src/RHEO/fix_rheo_tension.h @@ -43,8 +43,8 @@ class FixRHEOTension : public Fix { int nmax_store, comm_stage, interface_flag; int index_nt, index_cgradt, index_divnt, index_ft; - double **nt, **cgradt, *divnt, *norm, **ft; - double alpha, h, hsq, hinv, hinv3, rho0; + double **nt, **cgradt, *divnt, *norm, **ft, *wsame; + double alpha, beta, wmin, h, hsq, hinv, hinv3, rho0; class ComputeRHEOKernel *compute_kernel; class ComputeRHEOInterface *compute_interface; diff --git a/src/RHEO/fix_rheo_thermal.cpp b/src/RHEO/fix_rheo_thermal.cpp index 7c29e17f93..3b38089fad 100644 --- a/src/RHEO/fix_rheo_thermal.cpp +++ b/src/RHEO/fix_rheo_thermal.cpp @@ -65,67 +65,67 @@ FixRHEOThermal::FixRHEOThermal(LAMMPS *lmp, int narg, char **arg) : while (iarg < narg) { if (strcmp(arg[iarg],"conductivity") == 0) { // Conductivity arguments - if (iarg + 1 >= narg) error->all(FLERR,"Insufficient arguments for conductivity option"); - if (strcmp(arg[iarg + 1],"constant") == 0) { - if (iarg + 2 >= narg) error->all(FLERR,"Insufficient arguments for conductivity option"); + if (iarg + 1 >= narg) error->all(FLERR, "Insufficient arguments for conductivity option"); + if (strcmp(arg[iarg + 1], "constant") == 0) { + if (iarg + 2 >= narg) error->all(FLERR, "Insufficient arguments for conductivity option"); conductivity_style = CONSTANT; - kappa = utils::numeric(FLERR,arg[iarg + 2],false,lmp); - if (kappa < 0.0) error->all(FLERR,"The conductivity must be positive"); + kappa = utils::numeric(FLERR, arg[iarg + 2], false, lmp); + if (kappa < 0.0) error->all(FLERR, "The conductivity must be positive"); iarg += 2; - } else if (strcmp(arg[iarg + 1],"type") == 0) { - if (iarg + 1 + ntypes >= narg) error->all(FLERR,"Insufficient arguments for conductivity option"); + } else if (strcmp(arg[iarg + 1], "type") == 0) { + if (iarg + 1 + ntypes >= narg) error->all(FLERR, "Insufficient arguments for conductivity option"); conductivity_style = TYPE; - memory->create(kappa_type,ntypes+1,"rheo_thermal:kappa_type"); + memory->create(kappa_type, ntypes+1, "rheo_thermal:kappa_type"); for (int i = 1; i <= ntypes; i++) { - kappa_type[i] = utils::numeric(FLERR,arg[iarg + 1 + i],false,lmp); - if (kappa_type[i] < 0.0) error->all(FLERR,"The conductivity must be positive"); + kappa_type[i] = utils::numeric(FLERR, arg[iarg + i], false, lmp); + if (kappa_type[i] < 0.0) error->all(FLERR, "The conductivity must be positive"); } iarg += 1 + ntypes; } else { error->all(FLERR,"Illegal fix command, {}", arg[iarg + 1]); } - } else if (strcmp(arg[iarg],"specific/heat") == 0) { + } else if (strcmp(arg[iarg], "specific/heat") == 0) { // Cv arguments - if (iarg + 1 >= narg) error->all(FLERR,"Insufficient arguments for cv option"); - if (strcmp(arg[iarg + 1],"constant") == 0) { - if (iarg + 2 >= narg) error->all(FLERR,"Insufficient arguments for cv option"); + if (iarg + 1 >= narg) error->all(FLERR, "Insufficient arguments for cv option"); + if (strcmp(arg[iarg + 1], "constant") == 0) { + if (iarg + 2 >= narg) error->all(FLERR, "Insufficient arguments for cv option"); cv_style = CONSTANT; - cv = utils::numeric(FLERR,arg[iarg + 2],false,lmp); - if (cv < 0.0) error->all(FLERR,"The specific heat must be positive"); + cv = utils::numeric(FLERR, arg[iarg + 2], false, lmp); + if (cv < 0.0) error->all(FLERR, "The specific heat must be positive"); iarg += 2; - } else if (strcmp(arg[iarg + 1],"type") == 0) { - if (iarg + 1 + ntypes >= narg) error->all(FLERR,"Insufficient arguments for cv option"); + } else if (strcmp(arg[iarg + 1], "type") == 0) { + if (iarg + 1 + ntypes >= narg) error->all(FLERR, "Insufficient arguments for cv option"); cv_style = TYPE; - memory->create(cv_type,ntypes + 1,"rheo_thermal:cv_type"); + memory->create(cv_type,ntypes + 1, "rheo_thermal:cv_type"); for (int i = 1; i <= ntypes; i++) { - cv_type[i] = utils::numeric(FLERR,arg[iarg + 1 + i],false,lmp); - if (cv_type[i] < 0.0) error->all(FLERR,"The specific heat must be positive"); + cv_type[i] = utils::numeric(FLERR, arg[iarg + 1 + i], false, lmp); + if (cv_type[i] < 0.0) error->all(FLERR, "The specific heat must be positive"); } iarg += 1 + ntypes; } else { error->all(FLERR,"Illegal fix command, {}", arg[iarg + 1]); } - } else if (strcmp(arg[iarg],"Tfreeze") == 0) { + } else if (strcmp(arg[iarg], "Tfreeze") == 0) { // T freeze arguments - if (iarg + 1 >= narg) error->all(FLERR,"Insufficient arguments for Tfreeze option"); - if (strcmp(arg[iarg + 1],"constant") == 0) { - if (iarg + 2 >= narg) error->all(FLERR,"Insufficient arguments for Tfreeze option"); + if (iarg + 1 >= narg) error->all(FLERR, "Insufficient arguments for Tfreeze option"); + if (strcmp(arg[iarg + 1], "constant") == 0) { + if (iarg + 2 >= narg) error->all(FLERR, "Insufficient arguments for Tfreeze option"); Tc_style = CONSTANT; - Tc = utils::numeric(FLERR,arg[iarg + 2],false,lmp); + Tc = utils::numeric(FLERR, arg[iarg + 2], false, lmp); iarg += 2; - } else if (strcmp(arg[iarg + 1],"type") == 0) { - if (iarg + 1 + ntypes >= narg) error->all(FLERR,"Insufficient arguments for Tfreeze option"); + } else if (strcmp(arg[iarg + 1], "type") == 0) { + if (iarg + 1 + ntypes >= narg) error->all(FLERR, "Insufficient arguments for Tfreeze option"); Tc_style = TYPE; memory->create(Tc_type, ntypes + 1, "rheo_thermal:Tc_type"); for (int i = 1; i <= ntypes; i++) { - Tc_type[i] = utils::numeric(FLERR,arg[iarg + 1 + i],false,lmp); - if (Tc_type[i] < 0.0) error->all(FLERR,"The melting temperature must be positive"); + Tc_type[i] = utils::numeric(FLERR, arg[iarg + i], false, lmp); + if (Tc_type[i] < 0.0) error->all(FLERR, "The melting temperature must be positive"); } iarg += 1 + ntypes; } else { - error->all(FLERR,"Illegal fix command, {}", arg[iarg + 1]); + error->all(FLERR, "Illegal fix command, {}", arg[iarg + 1]); } - } else if (strcmp(arg[iarg],"react") == 0) { + } else if (strcmp(arg[iarg], "react") == 0) { if (iarg + 2 >= narg) error->all(FLERR, "Insufficient arguments for react option"); cut_bond = utils::numeric(FLERR, arg[iarg + 1], false, lmp); btype = utils::numeric(FLERR, arg[iarg + 2], false, lmp); diff --git a/src/RHEO/fix_rheo_viscosity.cpp b/src/RHEO/fix_rheo_viscosity.cpp index 7d915c9b93..e33bd43244 100644 --- a/src/RHEO/fix_rheo_viscosity.cpp +++ b/src/RHEO/fix_rheo_viscosity.cpp @@ -58,7 +58,7 @@ FixRHEOViscosity::FixRHEOViscosity(LAMMPS *lmp, int narg, char **arg) : viscosity_style = TYPE; memory->create(eta_type, ntypes + 1, "rheo_thermal:eta_type"); for (int i = 1; i <= ntypes; i++) { - eta_type[i] = utils::numeric(FLERR,arg[iarg + 1 + i], false, lmp); + eta_type[i] = utils::numeric(FLERR,arg[iarg + i], false, lmp); if (eta_type[i] < 0.0) error->all(FLERR,"The viscosity must be positive"); } iarg += ntypes; From 73a3ae7602bb16b0308223f46d0ecf99633e9963 Mon Sep 17 00:00:00 2001 From: jtclemm Date: Wed, 8 Nov 2023 15:57:42 -0700 Subject: [PATCH 059/158] Debugging some compute property items, allow surface shifting inward --- src/RHEO/compute_rheo_property_atom.cpp | 45 +++++++++++++++++-------- src/RHEO/compute_rheo_property_atom.h | 1 + src/RHEO/compute_rheo_vshift.cpp | 17 +++++++--- src/RHEO/fix_rheo.cpp | 4 ++- 4 files changed, 48 insertions(+), 19 deletions(-) diff --git a/src/RHEO/compute_rheo_property_atom.cpp b/src/RHEO/compute_rheo_property_atom.cpp index 615d5ea740..ed35484bd5 100644 --- a/src/RHEO/compute_rheo_property_atom.cpp +++ b/src/RHEO/compute_rheo_property_atom.cpp @@ -70,6 +70,8 @@ ComputeRHEOPropertyAtom::ComputeRHEOPropertyAtom(LAMMPS *lmp, int narg, char **a if (strcmp(arg[iarg],"phase") == 0) { pack_choice[i] = &ComputeRHEOPropertyAtom::pack_phase; + } else if (strcmp(arg[iarg],"rho") == 0) { + pack_choice[i] = &ComputeRHEOPropertyAtom::pack_rho; } else if (strcmp(arg[iarg],"chi") == 0) { interface_flag = 1; pack_choice[i] = &ComputeRHEOPropertyAtom::pack_chi; @@ -82,7 +84,7 @@ ComputeRHEOPropertyAtom::ComputeRHEOPropertyAtom(LAMMPS *lmp, int narg, char **a } else if (strcmp(arg[iarg],"surface/divr") == 0) { surface_flag = 1; pack_choice[i] = &ComputeRHEOPropertyAtom::pack_surface_divr; - } else if (strcmp(arg[iarg],"^surface/n") == 0) { + } else if (utils::strmatch(arg[iarg], "^surface/n")) { surface_flag = 1; pack_choice[i] = &ComputeRHEOPropertyAtom::pack_surface_n; col_index[i] = get_vector_index(arg[iarg]); @@ -91,11 +93,11 @@ ComputeRHEOPropertyAtom::ComputeRHEOPropertyAtom(LAMMPS *lmp, int narg, char **a } else if (strcmp(arg[iarg],"cv") == 0) { thermal_flag = 1; pack_choice[i] = &ComputeRHEOPropertyAtom::pack_cv; - } else if (strcmp(arg[iarg],"^shift/v") == 0) { + } else if (utils::strmatch(arg[iarg], "^shift/v")) { shift_flag = 1; pack_choice[i] = &ComputeRHEOPropertyAtom::pack_shift_v; col_index[i] = get_vector_index(arg[iarg]); - } else if (utils::strmatch(arg[iarg],"^gradv")) { + } else if (utils::strmatch(arg[iarg], "^grad/v")) { pack_choice[i] = &ComputeRHEOPropertyAtom::pack_gradv; col_index[i] = get_tensor_index(arg[iarg]); } else { @@ -167,10 +169,10 @@ void ComputeRHEOPropertyAtom::compute_peratom() nmax = atom->nmax; if (nvalues == 1) { memory->destroy(vector_atom); - memory->create(vector_atom,nmax,"rheo/property/atom:vector"); + memory->create(vector_atom, nmax, "rheo/property/atom:vector"); } else { memory->destroy(array_atom); - memory->create(array_atom,nmax,nvalues,"rheo/property/atom:array"); + memory->create(array_atom, nmax, nvalues, "rheo/property/atom:array"); } } @@ -220,6 +222,21 @@ void ComputeRHEOPropertyAtom::pack_phase(int n) /* ---------------------------------------------------------------------- */ +void ComputeRHEOPropertyAtom::pack_rho(int n) +{ + double *rho = atom->rho; + int *mask = atom->mask; + int nlocal = atom->nlocal; + + for (int i = 0; i < nlocal; i++) { + if (mask[i] & groupbit) buf[n] = rho[i]; + else buf[n] = 0.0; + n += nvalues; + } +} + +/* ---------------------------------------------------------------------- */ + void ComputeRHEOPropertyAtom::pack_chi(int n) { double *chi = compute_interface->chi; @@ -370,29 +387,29 @@ int ComputeRHEOPropertyAtom::get_tensor_index(char* option) int dim = domain->dimension; int dim_error = 0; - if (utils::strmatch(option,"xx$")) { + if (utils::strmatch(option, "xx$")) { index = 0; - } else if (utils::strmatch(option,"xy$")) { + } else if (utils::strmatch(option, "xy$")) { index = 1; - } else if (utils::strmatch(option,"xz$")) { + } else if (utils::strmatch(option, "xz$")) { index = 2; if (dim == 2) dim_error = 1; - } else if (utils::strmatch(option,"yx$")) { + } else if (utils::strmatch(option, "yx$")) { if (dim == 2) index = 2; else index = 3; - } else if (utils::strmatch(option,"yy$")) { + } else if (utils::strmatch(option, "yy$")) { if (dim == 2) index = 3; else index = 4; - } else if (utils::strmatch(option,"yz$")) { + } else if (utils::strmatch(option, "yz$")) { index = 5; if (dim == 2) dim_error = 1; - } else if (utils::strmatch(option,"zx$")) { + } else if (utils::strmatch(option, "zx$")) { index = 6; if (dim == 2) dim_error = 1; - } else if (utils::strmatch(option,"zy$")) { + } else if (utils::strmatch(option, "zy$")) { index = 7; if (dim == 2) dim_error = 1; - } else if (utils::strmatch(option,"zz$")) { + } else if (utils::strmatch(option, "zz$")) { index = 8; if (dim == 2) dim_error = 1; } else { diff --git a/src/RHEO/compute_rheo_property_atom.h b/src/RHEO/compute_rheo_property_atom.h index 344e249d11..bfae870ee5 100644 --- a/src/RHEO/compute_rheo_property_atom.h +++ b/src/RHEO/compute_rheo_property_atom.h @@ -43,6 +43,7 @@ class ComputeRHEOPropertyAtom : public Compute { FnPtrPack *pack_choice; // ptrs to pack functions void pack_phase(int); + void pack_rho(int); void pack_chi(int); void pack_surface(int); void pack_surface_r(int); diff --git a/src/RHEO/compute_rheo_vshift.cpp b/src/RHEO/compute_rheo_vshift.cpp index aa59f80ff2..1f9314e99b 100644 --- a/src/RHEO/compute_rheo_vshift.cpp +++ b/src/RHEO/compute_rheo_vshift.cpp @@ -232,7 +232,7 @@ void ComputeRHEOVShift::correct_surfaces() int nlocal = atom->nlocal; int dim = domain->dimension; - double nx, ny, nz, vx, vy, vz; + double nx, ny, nz, vx, vy, vz, dot; for (i = 0; i < nlocal; i++) { if (mask[i] & groupbit) { if ((status[i] & STATUS_SURFACE) || (status[i] & STATUS_LAYER)) { @@ -240,11 +240,20 @@ void ComputeRHEOVShift::correct_surfaces() ny = nsurface[i][1]; vx = vshift[i][0]; vy = vshift[i][1]; - vz = vshift[i][2]; + + dot = nx * vx + ny * vy; + if (dim == 3) { + nz = nsurface[i][2]; + vz = vshift[i][2]; + dot += nz * vz; + } + + // Allowing shifting into the bulk + if (dot < 0.0) continue; + vshift[i][0] = (1 - nx * nx) * vx - nx * ny * vy; vshift[i][1] = (1 - ny * ny) * vy - nx * ny * vx; - if (dim > 2) { - nz = nsurface[i][2]; + if (dim == 3) { vshift[i][0] -= nx * nz * vz; vshift[i][1] -= ny * nz * vz; vshift[i][2] = (1 - nz * nz) * vz - nz * ny * vy - nx * nz * vx; diff --git a/src/RHEO/fix_rheo.cpp b/src/RHEO/fix_rheo.cpp index b1bc0fe0c0..f1f1a1bc4b 100644 --- a/src/RHEO/fix_rheo.cpp +++ b/src/RHEO/fix_rheo.cpp @@ -351,7 +351,6 @@ void FixRHEO::initial_integrate(int /*vflag*/) // Shifting atoms if (shift_flag) { - compute_vshift->correct_surfaces(); // Could this be moved to preforce after the surface fix runs? for (i = 0; i < nlocal; i++) { if (status[i] & STATUS_NO_SHIFT) continue; @@ -407,6 +406,9 @@ void FixRHEO::pre_force(int /*vflag*/) // Calculate surfaces, update status if (surface_flag) compute_surface->compute_peratom(); + + if (shift_flag) + compute_vshift->correct_surfaces(); } /* ---------------------------------------------------------------------- */ From f9b385061b0d2017aec568109f984045c7de8088 Mon Sep 17 00:00:00 2001 From: jtclemm Date: Tue, 14 Nov 2023 12:33:51 -0700 Subject: [PATCH 060/158] Multiphase support --- src/RHEO/compute_rheo_grad.cpp | 6 +- src/RHEO/compute_rheo_grad.h | 2 +- src/RHEO/compute_rheo_interface.cpp | 16 +- src/RHEO/compute_rheo_interface.h | 3 +- src/RHEO/compute_rheo_property_atom.cpp | 3 +- src/RHEO/compute_rheo_surface.cpp | 6 +- src/RHEO/compute_rheo_surface.h | 2 +- src/RHEO/fix_rheo.cpp | 86 +++++---- src/RHEO/fix_rheo.h | 3 +- src/RHEO/fix_rheo_pressure.cpp | 102 +++++++--- src/RHEO/fix_rheo_pressure.h | 7 +- src/RHEO/fix_rheo_thermal.cpp | 246 ++++++++++++------------ src/RHEO/fix_rheo_thermal.h | 9 +- src/RHEO/fix_rheo_viscosity.cpp | 168 ++++++++-------- src/RHEO/fix_rheo_viscosity.h | 5 +- src/RHEO/pair_rheo.cpp | 71 ++++--- src/RHEO/pair_rheo.h | 4 +- src/RHEO/pair_rheo_react.cpp | 28 +-- 18 files changed, 430 insertions(+), 337 deletions(-) diff --git a/src/RHEO/compute_rheo_grad.cpp b/src/RHEO/compute_rheo_grad.cpp index 46c1500556..b2ca0c9dc4 100644 --- a/src/RHEO/compute_rheo_grad.cpp +++ b/src/RHEO/compute_rheo_grad.cpp @@ -41,7 +41,7 @@ enum{COMMGRAD, COMMFIELD}; /* ---------------------------------------------------------------------- */ ComputeRHEOGrad::ComputeRHEOGrad(LAMMPS *lmp, int narg, char **arg) : - Compute(lmp, narg, arg), fix_rheo(nullptr), list(nullptr), compute_interface(nullptr), compute_kernel(nullptr), + Compute(lmp, narg, arg), fix_rheo(nullptr), list(nullptr), rho0(nullptr), compute_interface(nullptr), compute_kernel(nullptr), gradv(nullptr), gradr(nullptr), gradt(nullptr), gradn(nullptr) { if (narg < 4) error->all(FLERR,"Illegal compute rheo/grad command"); @@ -221,8 +221,8 @@ void ComputeRHEOGrad::compute_peratom() //compute_interface->correct_v(vi, vj, i, j); rhoi = compute_interface->correct_rho(i, j); } else if ((!fluidi) && (!fluidj)) { - rhoi = rho0; - rhoj = rho0; + rhoi = rho0[itype]; + rhoj = rho0[jtype]; } } diff --git a/src/RHEO/compute_rheo_grad.h b/src/RHEO/compute_rheo_grad.h index db5e84d32a..489f3c641d 100644 --- a/src/RHEO/compute_rheo_grad.h +++ b/src/RHEO/compute_rheo_grad.h @@ -46,7 +46,7 @@ class ComputeRHEOGrad : public Compute { private: int comm_stage, ncomm_grad, ncomm_field, nmax_store; - double cut, cutsq, rho0; + double cut, cutsq, *rho0; int velocity_flag, temperature_flag, rho_flag, eta_flag; int interface_flag, remap_v_flag; diff --git a/src/RHEO/compute_rheo_interface.cpp b/src/RHEO/compute_rheo_interface.cpp index 8cd69b49e3..001f15a472 100644 --- a/src/RHEO/compute_rheo_interface.cpp +++ b/src/RHEO/compute_rheo_interface.cpp @@ -25,6 +25,7 @@ #include "error.h" #include "force.h" #include "fix_rheo.h" +#include "fix_rheo_pressure.h" #include "memory.h" #include "modify.h" #include "neighbor.h" @@ -42,7 +43,7 @@ static constexpr double EPSILON = 1e-1; ComputeRHEOInterface::ComputeRHEOInterface(LAMMPS *lmp, int narg, char **arg) : Compute(lmp, narg, arg), fix_rheo(nullptr), compute_kernel(nullptr), fp_store(nullptr), - norm(nullptr), normwf(nullptr), chi(nullptr), id_fix_pa(nullptr) + rho0(nullptr), norm(nullptr), normwf(nullptr), chi(nullptr), id_fix_pa(nullptr) { if (narg != 3) error->all(FLERR,"Illegal compute rheo/interface command"); @@ -86,11 +87,12 @@ void ComputeRHEOInterface::init() compute_kernel = fix_rheo->compute_kernel; rho0 = fix_rheo->rho0; cut = fix_rheo->cut; - csq = fix_rheo->csq; - csq_inv = 1.0 / csq; cutsq = cut * cut; wall_max = sqrt(3.0) / 12.0 * cut; + auto fixes = modify->get_fix_by_style("rheo/pressure"); + fix_pressure = dynamic_cast(fixes[0]); + neighbor->add_request(this, NeighConst::REQ_DEFAULT); } @@ -174,7 +176,7 @@ void ComputeRHEOInterface::compute_peratom() dot += (-fp_store[j][1] + fp_store[i][1]) * dely; dot += (-fp_store[j][2] + fp_store[i][2]) * delz; - rho[i] += w * (csq * (rho[j] - rho0) - rho[j] * dot); + rho[i] += w * (fix_pressure->calc_pressure(rho[j], jtype) - rho[j] * dot); normwf[i] += w; } } @@ -189,7 +191,7 @@ void ComputeRHEOInterface::compute_peratom() dot += (-fp_store[i][1] + fp_store[j][1]) * dely; dot += (-fp_store[i][2] + fp_store[j][2]) * delz; - rho[j] += w * (csq * (rho[i] - rho0) + rho[i] * dot); + rho[j] += w * (fix_pressure->calc_pressure(rho[i], itype) + rho[i] * dot); normwf[j] += w; } } @@ -207,9 +209,9 @@ void ComputeRHEOInterface::compute_peratom() if (status[i] & PHASECHECK) { if (normwf[i] != 0.0) { // Stores rho for solid particles 1+Pw in Adami Adams 2012 - rho[i] = MAX(EPSILON, rho0 + (rho[i] / normwf[i]) * csq_inv); + rho[i] = MAX(EPSILON, fix_pressure->calc_rho(rho[i] / normwf[i], type[i])); } else { - rho[i] = rho0; + rho[i] = rho0[itype]; } } } diff --git a/src/RHEO/compute_rheo_interface.h b/src/RHEO/compute_rheo_interface.h index 50cec97790..a8cd448822 100644 --- a/src/RHEO/compute_rheo_interface.h +++ b/src/RHEO/compute_rheo_interface.h @@ -45,13 +45,14 @@ class ComputeRHEOInterface : public Compute { private: int nmax_store, comm_stage; - double rho0, cut, cutsq, csq, csq_inv, wall_max; + double *rho0, cut, cutsq, wall_max; double *norm, *normwf; char *id_fix_pa; class NeighList *list; class ComputeRHEOKernel *compute_kernel; + class FixRHEOPressure *fix_pressure; }; } // namespace LAMMPS_NS diff --git a/src/RHEO/compute_rheo_property_atom.cpp b/src/RHEO/compute_rheo_property_atom.cpp index ed35484bd5..50bcb2a2d0 100644 --- a/src/RHEO/compute_rheo_property_atom.cpp +++ b/src/RHEO/compute_rheo_property_atom.cpp @@ -330,11 +330,12 @@ void ComputeRHEOPropertyAtom::pack_coordination(int n) void ComputeRHEOPropertyAtom::pack_cv(int n) { + int *type = atom->type; int *mask = atom->mask; int nlocal = atom->nlocal; for (int i = 0; i < nlocal; i++) { - if (mask[i] & groupbit) buf[n] = fix_thermal->calc_cv(i); + if (mask[i] & groupbit) buf[n] = fix_thermal->calc_cv(i, type[i]); else buf[n] = 0.0; n += nvalues; } diff --git a/src/RHEO/compute_rheo_surface.cpp b/src/RHEO/compute_rheo_surface.cpp index 882977f3e9..1ef69bb6f0 100644 --- a/src/RHEO/compute_rheo_surface.cpp +++ b/src/RHEO/compute_rheo_surface.cpp @@ -42,7 +42,7 @@ static constexpr double EPSILON = 1e-10; /* ---------------------------------------------------------------------- */ ComputeRHEOSurface::ComputeRHEOSurface(LAMMPS *lmp, int narg, char **arg) : - Compute(lmp, narg, arg), fix_rheo(nullptr), list(nullptr), compute_kernel(nullptr), compute_interface(nullptr), + Compute(lmp, narg, arg), fix_rheo(nullptr), list(nullptr), rho0(nullptr), compute_kernel(nullptr), compute_interface(nullptr), B(nullptr), gradC(nullptr), nsurface(nullptr), divr(nullptr), rsurface(nullptr) { if (narg != 3) error->all(FLERR,"Illegal compute RHEO/SURFACE command"); @@ -194,8 +194,8 @@ void ComputeRHEOSurface::compute_peratom() } else if ((!fluidi) && fluidj) { rhoi = compute_interface->correct_rho(i, j); } else if ((!fluidi) && (!fluidj)) { - rhoi = rho0; - rhoj = rho0; + rhoi = rho0[itype]; + rhoj = rho0[jtype]; } } diff --git a/src/RHEO/compute_rheo_surface.h b/src/RHEO/compute_rheo_surface.h index f1b1af7742..6ef2428499 100644 --- a/src/RHEO/compute_rheo_surface.h +++ b/src/RHEO/compute_rheo_surface.h @@ -44,7 +44,7 @@ class ComputeRHEOSurface : public Compute { int threshold_style, comm_stage; int index_divr, index_rsurf, index_nsurf; - double cut, cutsq, rho0, threshold_divr; + double cut, cutsq, *rho0, threshold_divr; double **B, **gradC; class NeighList *list; diff --git a/src/RHEO/fix_rheo.cpp b/src/RHEO/fix_rheo.cpp index f1f1a1bc4b..d07f0d1a1f 100644 --- a/src/RHEO/fix_rheo.cpp +++ b/src/RHEO/fix_rheo.cpp @@ -28,6 +28,7 @@ #include "domain.h" #include "error.h" #include "force.h" +#include "memory.h" #include "modify.h" #include "update.h" #include "utils.h" @@ -40,7 +41,7 @@ using namespace FixConst; FixRHEO::FixRHEO(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg), compute_grad(nullptr), compute_kernel(nullptr), compute_surface(nullptr), - compute_interface(nullptr), compute_rhosum(nullptr), compute_vshift(nullptr) + compute_interface(nullptr), compute_rhosum(nullptr), compute_vshift(nullptr), rho0(nullptr), csq(nullptr) { time_integrate = 1; @@ -54,71 +55,81 @@ FixRHEO::FixRHEO(LAMMPS *lmp, int narg, char **arg) : interface_flag = 0; surface_flag = 0; - rho0 = 1.0; - csq = 1.0; + int i; + int n = atom->ntypes; + memory->create(rho0, n + 1, "rheo:rho0"); + memory->create(csq, n + 1, "rheo:csq"); + for (i = 1; i <= n; i++) { + rho0[i] = 1.0; + csq[i] = 1.0; + } if (igroup != 0) - error->all(FLERR,"fix rheo command requires group all"); + error->all(FLERR, "fix rheo command requires group all"); if (atom->pressure_flag != 1) - error->all(FLERR,"fix rheo command requires atom_style with pressure"); + error->all(FLERR, "fix rheo command requires atom_style with pressure"); if (atom->rho_flag != 1) - error->all(FLERR,"fix rheo command requires atom_style with density"); + error->all(FLERR, "fix rheo command requires atom_style with density"); if (atom->viscosity_flag != 1) - error->all(FLERR,"fix rheo command requires atom_style with viscosity"); + error->all(FLERR, "fix rheo command requires atom_style with viscosity"); if (atom->status_flag != 1) - error->all(FLERR,"fix rheo command requires atom_style with status"); + error->all(FLERR, "fix rheo command requires atom_style with status"); if (narg < 5) - error->all(FLERR,"Insufficient arguments for fix rheo command"); + error->all(FLERR, "Insufficient arguments for fix rheo command"); - h = utils::numeric(FLERR,arg[3],false,lmp); + h = utils::numeric(FLERR, arg[3], false, lmp); cut = h; - if (strcmp(arg[4],"quintic") == 0) { + if (strcmp(arg[4], "quintic") == 0) { kernel_style = QUINTIC; - } else if (strcmp(arg[4],"RK0") == 0) { + } else if (strcmp(arg[4], "RK0") == 0) { kernel_style = RK0; - } else if (strcmp(arg[4],"RK1") == 0) { + } else if (strcmp(arg[4], "RK1") == 0) { kernel_style = RK1; - } else if (strcmp(arg[4],"RK2") == 0) { + } else if (strcmp(arg[4], "RK2") == 0) { kernel_style = RK2; - } else error->all(FLERR,"Unknown kernel style {} in fix rheo", arg[4]); - zmin_kernel = utils::numeric(FLERR,arg[5],false,lmp); + } else error->all(FLERR, "Unknown kernel style {} in fix rheo", arg[4]); + zmin_kernel = utils::numeric(FLERR, arg[5], false, lmp); int iarg = 6; while (iarg < narg){ - if (strcmp(arg[iarg],"shift") == 0) { + if (strcmp(arg[iarg], "shift") == 0) { shift_flag = 1; - } else if (strcmp(arg[iarg],"thermal") == 0) { + } else if (strcmp(arg[iarg], "thermal") == 0) { thermal_flag = 1; - } else if (strcmp(arg[iarg],"surface/detection") == 0) { + } else if (strcmp(arg[iarg], "surface/detection") == 0) { surface_flag = 1; - if(iarg + 2 >= narg) error->all(FLERR,"Illegal surface/detection option in fix rheo"); + if(iarg + 2 >= narg) error->all(FLERR, "Illegal surface/detection option in fix rheo"); if (strcmp(arg[iarg + 1], "coordination") == 0) { surface_style = COORDINATION; - zmin_surface = utils::inumeric(FLERR,arg[iarg + 2],false,lmp); - zmin_splash = utils::inumeric(FLERR,arg[iarg + 3],false,lmp); + zmin_surface = utils::inumeric(FLERR, arg[iarg + 2], false, lmp); + zmin_splash = utils::inumeric(FLERR, arg[iarg + 3], false, lmp); } else if (strcmp(arg[iarg + 1], "divergence") == 0) { surface_style = DIVR; - divr_surface = utils::numeric(FLERR,arg[iarg + 2],false,lmp); - zmin_splash = utils::inumeric(FLERR,arg[iarg + 3],false,lmp); + divr_surface = utils::numeric(FLERR, arg[iarg + 2], false, lmp); + zmin_splash = utils::inumeric(FLERR, arg[iarg + 3], false, lmp); } else { - error->all(FLERR,"Illegal surface/detection option in fix rheo, {}", arg[iarg + 1]); + error->all(FLERR, "Illegal surface/detection option in fix rheo, {}", arg[iarg + 1]); } iarg += 3; - } else if (strcmp(arg[iarg],"interface/reconstruct") == 0) { + } else if (strcmp(arg[iarg], "interface/reconstruct") == 0) { interface_flag = 1; - } else if (strcmp(arg[iarg],"rho/sum") == 0) { + } else if (strcmp(arg[iarg], "rho/sum") == 0) { rhosum_flag = 1; - } else if (strcmp(arg[iarg],"density") == 0) { - if(iarg + 1 >= narg) error->all(FLERR,"Illegal rho0 option in fix rheo"); - rho0 = utils::numeric(FLERR,arg[iarg + 1],false,lmp); - iarg += 1; - } else if (strcmp(arg[iarg],"sound/squared") == 0) { - if(iarg+1 >= narg) error->all(FLERR,"Illegal csq option in fix rheo"); - csq = utils::numeric(FLERR,arg[iarg + 1],false,lmp); - iarg += 1; + } else if (strcmp(arg[iarg], "density") == 0) { + if (iarg + n >= narg) error->all(FLERR, "Illegal rho0 option in fix rheo"); + for (i = 1; i <= n; i++) + rho0[i] = utils::numeric(FLERR, arg[iarg + i], false, lmp); + iarg += n; + } else if (strcmp(arg[iarg], "speed/sound") == 0) { + if (iarg + n >= narg) error->all(FLERR, "Illegal csq option in fix rheo"); + for (i = 1; i <= n; i++) { + csq[i] = utils::numeric(FLERR, arg[iarg + i], false, lmp); + csq[i] *= csq[i]; + } + iarg += n; } else { error->all(FLERR, "Illegal fix rheo command: {}", arg[iarg]); } @@ -136,6 +147,9 @@ FixRHEO::~FixRHEO() if (compute_surface) modify->delete_compute("rheo_surface"); if (compute_rhosum) modify->delete_compute("rheo_rhosum"); if (compute_vshift) modify->delete_compute("rheo_vshift"); + + memory->destroy(csq); + memory->destroy(rho0); } @@ -198,7 +212,7 @@ void FixRHEO::init() dtf = 0.5 * update->dt * force->ftm2v; if (modify->get_fix_by_style("^rheo$").size() > 1) - error->all(FLERR,"Can only specify one instance of fix rheo"); + error->all(FLERR, "Can only specify one instance of fix rheo"); } /* ---------------------------------------------------------------------- */ diff --git a/src/RHEO/fix_rheo.h b/src/RHEO/fix_rheo.h index da98f3d09a..8ec28c7d0e 100644 --- a/src/RHEO/fix_rheo.h +++ b/src/RHEO/fix_rheo.h @@ -39,7 +39,8 @@ class FixRHEO : public Fix { void reset_dt() override; // Model parameters - double h, cut, rho0, csq; + double h, cut; + double *rho0, *csq; int zmin_kernel, zmin_surface, zmin_splash; int kernel_style, surface_style; double divr_surface; diff --git a/src/RHEO/fix_rheo_pressure.cpp b/src/RHEO/fix_rheo_pressure.cpp index 5049ab0a4e..eac4b34046 100644 --- a/src/RHEO/fix_rheo_pressure.cpp +++ b/src/RHEO/fix_rheo_pressure.cpp @@ -38,39 +38,62 @@ static constexpr double SEVENTH = 1.0 / 7.0; /* ---------------------------------------------------------------------- */ FixRHEOPressure::FixRHEOPressure(LAMMPS *lmp, int narg, char **arg) : - Fix(lmp, narg, arg), fix_rheo(nullptr) + Fix(lmp, narg, arg), fix_rheo(nullptr), rho0(nullptr), csq(nullptr), rho0inv(nullptr), csqinv(nullptr), c_cubic(nullptr), pressure_style(nullptr) { if (narg < 4) error->all(FLERR,"Illegal fix command"); - pressure_style = NONE; comm_forward = 1; // Currently can only have one instance of fix rheo/pressure if (igroup != 0) error->all(FLERR,"fix rheo/pressure command requires group all"); - int ntypes = atom->ntypes; + int i, nlo, nhi; + int n = atom->ntypes; + memory->create(pressure_style, n + 1, "rheo:pressure_style"); + for (i = 1; i <= n; i++) pressure_style[i] = NONE; + int iarg = 3; - if (strcmp(arg[iarg], "linear") == 0) { - pressure_style = LINEAR; - } else if (strcmp(arg[iarg], "taitwater") == 0) { - pressure_style = TAITWATER; - } else if (strcmp(arg[iarg], "cubic") == 0) { - pressure_style = CUBIC; - if (iarg + 1 >= narg) error->all(FLERR, "Insufficient arguments for pressure option"); - c_cubic = utils::numeric(FLERR, arg[iarg + 1], false, lmp); - } else { - error->all(FLERR,"Illegal fix command, {}", arg[iarg]); + while (iarg < narg) { + utils::bounds(FLERR, arg[iarg], 1, n, nlo, nhi, error); + + if (iarg + 1 >= narg) utils::missing_cmd_args(FLERR, "fix rheo/pressure", error); + + if (strcmp(arg[iarg + 1], "linear") == 0) { + for (i = nlo; i <= nhi; i++) + pressure_style[i] = LINEAR; + } else if (strcmp(arg[iarg + 1], "taitwater") == 0) { + for (i = nlo; i <= nhi; i++) + pressure_style[i] = TAITWATER; + } else if (strcmp(arg[iarg + 1], "cubic") == 0) { + if (iarg + 2 >= narg) utils::missing_cmd_args(FLERR, "fix rheo/pressure cubic", error); + + double c_cubic_one = utils::numeric(FLERR, arg[iarg + 2], false, lmp); + iarg += 1; + + for (i = nlo; i <= nhi; i++) { + pressure_style[i] = CUBIC; + c_cubic[i] = c_cubic_one; + } + } else { + error->all(FLERR,"Illegal fix command, {}", arg[iarg]); + } + iarg += 2; } - if (pressure_style == NONE) - error->all(FLERR,"Must specify pressure style for fix/rheo/pressure"); + for (i = 1; i <= n; i++) + if (pressure_style[i] == NONE) + error->all(FLERR,"Must specify pressure for atom type {} in fix/rheo/pressure", i); } /* ---------------------------------------------------------------------- */ FixRHEOPressure::~FixRHEOPressure() { + memory->destroy(pressure_style); + memory->destroy(csqinv); + memory->destroy(rho0inv); + memory->destroy(c_cubic); } /* ---------------------------------------------------------------------- */ @@ -92,9 +115,15 @@ void FixRHEOPressure::init() csq = fix_rheo->csq; rho0 = fix_rheo->rho0; - rho0inv = 1.0 / rho0; - // Cannot define multiple as pair rheo cannot currently distinguish + int n = atom->ntypes; + memory->create(csqinv, n + 1, "rheo:rho0inv"); + memory->create(rho0inv, n + 1, "rheo:rho0inv"); + for (int i = 0; i <= n; i++) { + csqinv[i] = 1.0 / csq[i]; + rho0inv[i] = 1.0 / rho0[i]; + } + if (modify->get_fix_by_style("rheo/pressure").size() > 1) error->all(FLERR, "Can only specify one instance of fix rheo/pressure"); } @@ -117,6 +146,7 @@ void FixRHEOPressure::pre_force(int /*vflag*/) double dr, rr3, rho_ratio; int *mask = atom->mask; + int *type = atom->type; double *rho = atom->rho; double *pressure = atom->pressure; @@ -124,7 +154,7 @@ void FixRHEOPressure::pre_force(int /*vflag*/) for (i = 0; i < nlocal; i++) if (mask[i] & groupbit) - pressure[i] = calc_pressure(rho[i]); + pressure[i] = calc_pressure(rho[i], type[i]); if (comm_forward) comm->forward_comm(this); } @@ -161,19 +191,37 @@ void FixRHEOPressure::unpack_forward_comm(int n, int first, double *buf) /* ---------------------------------------------------------------------- */ -double FixRHEOPressure::calc_pressure(double rho) +double FixRHEOPressure::calc_pressure(double rho, int type) { double p, dr, rr3, rho_ratio; - if (pressure_style == LINEAR) { - p = csq * (rho - rho0); - } else if (pressure_style == CUBIC) { - dr = rho - rho0; - p = csq * (dr + c_cubic * dr * dr * dr); - } else if (pressure_style == TAITWATER) { - rho_ratio = rho / rho0inv; + if (pressure_style[type] == LINEAR) { + p = csq[type] * (rho - rho0[type]); + } else if (pressure_style[type] == CUBIC) { + dr = rho - rho0[type]; + p = csq[type] * (dr + c_cubic[type] * dr * dr * dr); + } else if (pressure_style[type] == TAITWATER) { + rho_ratio = rho * rho0inv[type]; rr3 = rho_ratio * rho_ratio * rho_ratio; - p = csq * rho0 * SEVENTH * (rr3 * rr3 * rho_ratio - 1.0); + p = csq[type] * rho0[type] * SEVENTH * (rr3 * rr3 * rho_ratio - 1.0); } return p; } + +/* ---------------------------------------------------------------------- */ + +double FixRHEOPressure::calc_rho(double p, int type) +{ + double rho, dr, rr3, rho_ratio; + + if (pressure_style[type] == LINEAR) { + rho = csqinv[type] * p + rho0[type]; + } else if (pressure_style[type] == CUBIC) { + error->one(FLERR, "Rho calculation from pressure not yet supported for cubic pressure equation"); + } else if (pressure_style[type] == TAITWATER) { + rho = pow(7.0 * p + csq[type] * rho0[type], SEVENTH); + rho *= pow(rho0[type], 6.0 * SEVENTH); + rho *= pow(csq[type], -SEVENTH); + } + return rho; +} diff --git a/src/RHEO/fix_rheo_pressure.h b/src/RHEO/fix_rheo_pressure.h index cbcb495244..ee86c5e184 100644 --- a/src/RHEO/fix_rheo_pressure.h +++ b/src/RHEO/fix_rheo_pressure.h @@ -34,11 +34,12 @@ class FixRHEOPressure : public Fix { void pre_force(int) override; int pack_forward_comm(int, int *, double *, int, int *) override; void unpack_forward_comm(int, int, double *) override; - double calc_pressure(double); + double calc_pressure(double, int); + double calc_rho(double, int); private: - double c_cubic, csq, rho0, rho0inv; - int pressure_style; + double *c_cubic, *csq, *csqinv, *rho0, *rho0inv; + int *pressure_style; class FixRHEO *fix_rheo; }; diff --git a/src/RHEO/fix_rheo_thermal.cpp b/src/RHEO/fix_rheo_thermal.cpp index 3b38089fad..dd2c6eddbd 100644 --- a/src/RHEO/fix_rheo_thermal.cpp +++ b/src/RHEO/fix_rheo_thermal.cpp @@ -41,108 +41,124 @@ using namespace LAMMPS_NS; using namespace RHEO_NS; using namespace FixConst; -enum {NONE, CONSTANT, TYPE}; +enum {NONE, CONSTANT}; /* ---------------------------------------------------------------------- */ FixRHEOThermal::FixRHEOThermal(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg), fix_rheo(nullptr), compute_grad(nullptr), compute_vshift(nullptr), - Tc_type(nullptr), kappa_type(nullptr), cv_type(nullptr), fix_update_special_bonds(nullptr) + Tc(nullptr), kappa(nullptr), cv(nullptr), Tc_style(nullptr), kappa_style(nullptr), cv_style(nullptr), + fix_update_special_bonds(nullptr) { if (narg < 4) error->all(FLERR,"Illegal fix command"); force_reneighbor = 1; next_reneighbor = -1; - - Tc_style = NONE; - cv_style = NONE; - conductivity_style = NONE; cut_bond = 0; comm_forward = 0; - int ntypes = atom->ntypes; + if (igroup != 0) + error->all(FLERR,"fix rheo/thermal command requires group all"); + + int i, nlo, nhi; + int n = atom->ntypes; + memory->create(Tc_style, n + 1, "rheo:Tc_style"); + memory->create(kappa_style, n + 1, "rheo:kappa_style"); + memory->create(cv_style, n + 1, "rheo:cv_style"); + for (i = 1; i <= n; i++) { + Tc_style[i] = NONE; + kappa_style[i] = NONE; + cv_style[i] = NONE; + } + int iarg = 3; while (iarg < narg) { if (strcmp(arg[iarg],"conductivity") == 0) { + if (iarg + 2 >= narg) utils::missing_cmd_args(FLERR, "fix rheo/thermal conductivity", error); + utils::bounds(FLERR, arg[iarg + 1], 1, n, nlo, nhi, error); + // Conductivity arguments - if (iarg + 1 >= narg) error->all(FLERR, "Insufficient arguments for conductivity option"); - if (strcmp(arg[iarg + 1], "constant") == 0) { - if (iarg + 2 >= narg) error->all(FLERR, "Insufficient arguments for conductivity option"); - conductivity_style = CONSTANT; - kappa = utils::numeric(FLERR, arg[iarg + 2], false, lmp); - if (kappa < 0.0) error->all(FLERR, "The conductivity must be positive"); - iarg += 2; - } else if (strcmp(arg[iarg + 1], "type") == 0) { - if (iarg + 1 + ntypes >= narg) error->all(FLERR, "Insufficient arguments for conductivity option"); - conductivity_style = TYPE; - memory->create(kappa_type, ntypes+1, "rheo_thermal:kappa_type"); - for (int i = 1; i <= ntypes; i++) { - kappa_type[i] = utils::numeric(FLERR, arg[iarg + i], false, lmp); - if (kappa_type[i] < 0.0) error->all(FLERR, "The conductivity must be positive"); + if (strcmp(arg[iarg + 2], "constant") == 0) { + if (iarg + 3 >= narg) utils::missing_cmd_args(FLERR, "fix rheo/thermal conductivity constant", error); + + double kappa_one = utils::numeric(FLERR, arg[iarg + 2], false, lmp); + if (kappa_one < 0.0) error->all(FLERR, "The conductivity must be positive"); + iarg += 1; + + for (i = nlo; i <= nhi; i++) { + kappa_style[i] = CONSTANT; + kappa[i] = kappa_one; } - iarg += 1 + ntypes; } else { - error->all(FLERR,"Illegal fix command, {}", arg[iarg + 1]); + error->all(FLERR,"Illegal fix command, {}", arg[iarg + 2]); } + + iarg += 2; } else if (strcmp(arg[iarg], "specific/heat") == 0) { + if (iarg + 2 >= narg) utils::missing_cmd_args(FLERR, "fix rheo/thermal specific/heat", error); + utils::bounds(FLERR, arg[iarg + 1], 1, n, nlo, nhi, error); + // Cv arguments - if (iarg + 1 >= narg) error->all(FLERR, "Insufficient arguments for cv option"); - if (strcmp(arg[iarg + 1], "constant") == 0) { - if (iarg + 2 >= narg) error->all(FLERR, "Insufficient arguments for cv option"); - cv_style = CONSTANT; - cv = utils::numeric(FLERR, arg[iarg + 2], false, lmp); - if (cv < 0.0) error->all(FLERR, "The specific heat must be positive"); - iarg += 2; - } else if (strcmp(arg[iarg + 1], "type") == 0) { - if (iarg + 1 + ntypes >= narg) error->all(FLERR, "Insufficient arguments for cv option"); - cv_style = TYPE; - memory->create(cv_type,ntypes + 1, "rheo_thermal:cv_type"); - for (int i = 1; i <= ntypes; i++) { - cv_type[i] = utils::numeric(FLERR, arg[iarg + 1 + i], false, lmp); - if (cv_type[i] < 0.0) error->all(FLERR, "The specific heat must be positive"); + if (strcmp(arg[iarg + 2], "constant") == 0) { + if (iarg + 3 >= narg) utils::missing_cmd_args(FLERR, "fix rheo/thermal specific/heat constant", error); + + double cv_one = utils::numeric(FLERR, arg[iarg + 2], false, lmp); + if (cv_one < 0.0) error->all(FLERR, "The specific heat must be positive"); + iarg += 1; + + for (i = nlo; i <= nhi; i++) { + cv_style[i] = CONSTANT; + cv[i] = cv_one; } - iarg += 1 + ntypes; + } else { - error->all(FLERR,"Illegal fix command, {}", arg[iarg + 1]); + error->all(FLERR,"Illegal fix command, {}", arg[iarg + 2]); } + + iarg += 2; } else if (strcmp(arg[iarg], "Tfreeze") == 0) { + if (iarg + 2 >= narg) utils::missing_cmd_args(FLERR, "fix rheo/thermal Tfreeze", error); + utils::bounds(FLERR, arg[iarg + 1], 1, n, nlo, nhi, error); + // T freeze arguments - if (iarg + 1 >= narg) error->all(FLERR, "Insufficient arguments for Tfreeze option"); - if (strcmp(arg[iarg + 1], "constant") == 0) { - if (iarg + 2 >= narg) error->all(FLERR, "Insufficient arguments for Tfreeze option"); - Tc_style = CONSTANT; - Tc = utils::numeric(FLERR, arg[iarg + 2], false, lmp); - iarg += 2; - } else if (strcmp(arg[iarg + 1], "type") == 0) { - if (iarg + 1 + ntypes >= narg) error->all(FLERR, "Insufficient arguments for Tfreeze option"); - Tc_style = TYPE; - memory->create(Tc_type, ntypes + 1, "rheo_thermal:Tc_type"); - for (int i = 1; i <= ntypes; i++) { - Tc_type[i] = utils::numeric(FLERR, arg[iarg + i], false, lmp); - if (Tc_type[i] < 0.0) error->all(FLERR, "The melting temperature must be positive"); + if (strcmp(arg[iarg + 2], "constant") == 0) { + if (iarg + 3 >= narg) utils::missing_cmd_args(FLERR, "fix rheo/thermal Tfreeze constant", error); + + double Tc_one = utils::numeric(FLERR, arg[iarg + 2], false, lmp); + iarg += 1; + + for (i = nlo; i <= nhi; i++) { + Tc_style[i] = CONSTANT; + Tc[i] = Tc_one; } - iarg += 1 + ntypes; + } else { - error->all(FLERR, "Illegal fix command, {}", arg[iarg + 1]); + error->all(FLERR, "Illegal fix command, {}", arg[iarg + 2]); } + + iarg += 2; } else if (strcmp(arg[iarg], "react") == 0) { - if (iarg + 2 >= narg) error->all(FLERR, "Insufficient arguments for react option"); + if (iarg + 2 >= narg) utils::missing_cmd_args(FLERR, "fix rheo/thermal react", error); cut_bond = utils::numeric(FLERR, arg[iarg + 1], false, lmp); btype = utils::numeric(FLERR, arg[iarg + 2], false, lmp); comm_forward = 1; - if (cut_bond <= 0.0) error->all(FLERR, "Illegal value for bond lengths");\ + if (cut_bond <= 0.0) error->all(FLERR, "Illegal max bond length must be greater than zero");\ if (btype < 1 || btype > atom->nbondtypes) error->all(FLERR, "Illegal value for bond type"); cutsq_bond = cut_bond * cut_bond; - iarg += 2; + iarg += 3; } else { error->all(FLERR,"Illegal fix command, {}", arg[iarg]); } - iarg += 1; } - if (cv_style == NONE || conductivity_style == NONE) - error->all(FLERR, "Must specify specific heat and conductivity styles\n"); + + for (i = 1; i <= n; i++) { + if (cv_style[i] == NONE) + error->all(FLERR,"Must specify specific/heat for atom type {} in fix/rheo/thermal", i); + if (kappa_style[i] == NONE) + error->all(FLERR,"Must specify conductivity for atom type {} in fix/rheo/thermal", i); + } } /* ---------------------------------------------------------------------- */ @@ -154,9 +170,12 @@ FixRHEOThermal::~FixRHEOThermal() index = atom->find_custom("rheo_conductivity", tmp1, tmp2); if (index != -1) atom->remove_custom(index, 1, 0); - memory->destroy(cv_type); - memory->destroy(Tc_type); - memory->destroy(kappa_type); + memory->destroy(cv_style); + memory->destroy(Tc_style); + memory->destroy(kappa_style); + memory->destroy(cv); + memory->destroy(Tc); + memory->destroy(kappa); } /* ---------------------------------------------------------------------- */ @@ -198,7 +217,6 @@ void FixRHEOThermal::init() if (atom->conductivity_flag != 1) error->all(FLERR,"fix rheo/thermal command requires atom property conductivity"); - if (cut_bond > 0.0) { if (!force->bond) error->all(FLERR,"Must define a bond style to use reactive bond generation with fix rheo/thermal"); if (!atom->avec->bonds_allow) error->all(FLERR, "Reactive bond generation in fix rheo/thermal requires atom bonds"); @@ -249,7 +267,6 @@ void FixRHEOThermal::initial_integrate(int /*vflag*/) int i, a; int *status = atom->status; - int *mask = atom->mask; double *temperature = atom->temperature; double **gradt = compute_grad->gradt; double **vshift = compute_vshift->array_atom; @@ -263,11 +280,8 @@ void FixRHEOThermal::initial_integrate(int /*vflag*/) for (i = 0; i < nlocal; i++) { if (status[i] & STATUS_NO_SHIFT) continue; - if (mask[i] & groupbit) { - for (a = 0; a < dim; a++) { - temperature[i] += dtv * vshift[i][a] * gradt[i][a]; - } - } + for (a = 0; a < dim; a++) + temperature[i] += dtv * vshift[i][a] * gradt[i][a]; } } @@ -275,52 +289,50 @@ void FixRHEOThermal::initial_integrate(int /*vflag*/) void FixRHEOThermal::post_integrate() { + int i, itype; + double cvi, Tci, Ti; + int *status = atom->status; double *temperature = atom->temperature; double *heatflow = atom->heatflow; double *rho = atom->rho; - int *mask = atom->mask; int *type = atom->type; - double cvi, Tci, Ti; - int n_melt = 0; int n_freeze = 0; //Integrate temperature and check status - for (int i = 0; i < atom->nlocal; i++) { - if (mask[i] & groupbit) { - if (status[i] & STATUS_NO_INTEGRATION) continue; + for (i = 0; i < atom->nlocal; i++) { + if (status[i] & STATUS_NO_INTEGRATION) continue; - cvi = calc_cv(i); - temperature[i] += dtf * heatflow[i] / cvi; + itype = type[i]; + cvi = calc_cv(i, type[i]); + temperature[i] += dtf * heatflow[i] / cvi; - if (Tc_style != NONE) { - Ti = temperature[i]; - if (Tc_style == CONSTANT) { - Tci = Tc; - } else if (Tc_style == TYPE) { - Tci = Tc_type[type[i]]; + if (Tc_style[itype] != NONE) { + Ti = temperature[i]; + if (Tc_style[itype] == CONSTANT) { + Tci = Tc[itype]; + } + + if (Ti > Tci) { + // If solid, melt + if (status[i] & STATUS_SOLID) { + status[i] &= PHASEMASK; + status[i] |= STATUS_MELTING; + n_melt += 1; } - - if (Ti > Tci) { - // If solid, melt - if (status[i] & STATUS_SOLID) { - status[i] &= PHASEMASK; - status[i] |= STATUS_MELTING; - n_melt += 1; - } - } else { - // If fluid, freeze - if (!(status[i] & STATUS_SOLID)) { - status[i] &= PHASEMASK; - status[i] |= STATUS_SOLID; - status[i] |= STATUS_FREEZING; - n_freeze += 1; - } + } else { + // If fluid, freeze + if (!(status[i] & STATUS_SOLID)) { + status[i] &= PHASEMASK; + status[i] |= STATUS_SOLID; + status[i] |= STATUS_FREEZING; + n_freeze += 1; } } } + } int n_melt_all, n_freeze_all; @@ -344,19 +356,16 @@ void FixRHEOThermal::post_integrate() void FixRHEOThermal::post_neighbor() { - int i; + int i, itype; int *type = atom->type; - int *mask = atom->mask; double *conductivity = atom->conductivity; int nlocal = atom->nlocal; int nall = nlocal + atom->nghost; - if (conductivity_style == CONSTANT) { - for (i = 0; i < nall; i++) - if (mask[i] & groupbit) conductivity[i] = kappa; - } else if (conductivity_style == TYPE) { - for (i = 0; i < nall; i++) - if (mask[i] & groupbit) conductivity[i] = kappa_type[type[i]]; + for (i = 0; i < nall; i++) { + itype = type[i]; + if (kappa_style[itype] == CONSTANT) + conductivity[i] = kappa[itype]; } } @@ -372,21 +381,18 @@ void FixRHEOThermal::pre_force(int /*vflag*/) void FixRHEOThermal::final_integrate() { + int *status = atom->status; + int *type = atom->type; double *temperature = atom->temperature; double *heatflow = atom->heatflow; - int *status = atom->status; - int *mask = atom->mask; - double cvi; //Integrate temperature and check status for (int i = 0; i < atom->nlocal; i++) { - if (mask[i] & groupbit) { - if (status[i] & STATUS_NO_INTEGRATION) continue; + if (status[i] & STATUS_NO_INTEGRATION) continue; - cvi = calc_cv(i); - temperature[i] += dtf * heatflow[i] / cvi; - } + cvi = calc_cv(i, type[i]); + temperature[i] += dtf * heatflow[i] / cvi; } } @@ -522,12 +528,10 @@ void FixRHEOThermal::create_bonds() /* ---------------------------------------------------------------------- */ -double FixRHEOThermal::calc_cv(int i) +double FixRHEOThermal::calc_cv(int i, int itype) { - if (cv_style == CONSTANT) { - return cv; - } else if (cv_style == TYPE) { - return(cv_type[atom->type[i]]); + if (cv_style[itype] == CONSTANT) { + return cv[itype]; } } diff --git a/src/RHEO/fix_rheo_thermal.h b/src/RHEO/fix_rheo_thermal.h index da48a59e22..dc412d20b9 100644 --- a/src/RHEO/fix_rheo_thermal.h +++ b/src/RHEO/fix_rheo_thermal.h @@ -42,17 +42,14 @@ class FixRHEOThermal : public Fix { int pack_forward_comm(int, int *, double *, int, int *) override; void unpack_forward_comm(int, int, double *) override; void reset_dt() override; - double calc_cv(int); + double calc_cv(int, int); private: - double *cv_type, cv; - double *Tc_type, Tc; - double *kappa_type, kappa; + double *cv, *Tc, *kappa; double dtf, dtv; double cut_kernel, cut_bond, cutsq_bond; - int Tc_style, cv_style; + int *cv_style, *Tc_style, *kappa_style; int btype; - int conductivity_style; class NeighList *list; int n_histories; diff --git a/src/RHEO/fix_rheo_viscosity.cpp b/src/RHEO/fix_rheo_viscosity.cpp index e33bd43244..91799ccfd0 100644 --- a/src/RHEO/fix_rheo_viscosity.cpp +++ b/src/RHEO/fix_rheo_viscosity.cpp @@ -32,60 +32,87 @@ using namespace LAMMPS_NS; using namespace FixConst; -enum {NONE, CONSTANT, TYPE, POWER}; +enum {NONE, CONSTANT, POWER}; /* ---------------------------------------------------------------------- */ FixRHEOViscosity::FixRHEOViscosity(LAMMPS *lmp, int narg, char **arg) : - Fix(lmp, narg, arg), fix_rheo(nullptr), compute_grad(nullptr), eta_type(nullptr) + Fix(lmp, narg, arg), fix_rheo(nullptr), compute_grad(nullptr), eta(nullptr), + npow(nullptr), K(nullptr), gd0(nullptr), tau0(nullptr), viscosity_style(nullptr) { - if (narg < 4) error->all(FLERR,"Illegal fix command"); - - viscosity_style = NONE; + if (narg < 4) error->all(FLERR, "Illegal fix command"); comm_forward = 0; + constant_flag = 0; + evolve_flag = 0; + + if (igroup != 0) + error->all(FLERR,"fix rheo/viscosity command requires group all"); + + int i, nlo, nhi; + int n = atom->ntypes; + memory->create(viscosity_style, n + 1, "rheo:viscosity_style"); + for (i = 1; i <= n; i++) viscosity_style[i] = NONE; - int ntypes = atom->ntypes; int iarg = 3; - if (strcmp(arg[iarg],"constant") == 0) { - if (iarg + 1 >= narg) error->all(FLERR,"Insufficient arguments for viscosity option"); - viscosity_style = CONSTANT; - eta = utils::numeric(FLERR,arg[iarg + 1],false,lmp); - if (eta < 0.0) error->all(FLERR,"The viscosity must be positive"); - iarg += 1; - } else if (strcmp(arg[iarg],"type") == 0) { - if (iarg + ntypes >= narg) error->all(FLERR,"Insufficient arguments for viscosity option"); - viscosity_style = TYPE; - memory->create(eta_type, ntypes + 1, "rheo_thermal:eta_type"); - for (int i = 1; i <= ntypes; i++) { - eta_type[i] = utils::numeric(FLERR,arg[iarg + i], false, lmp); - if (eta_type[i] < 0.0) error->all(FLERR,"The viscosity must be positive"); + while (iarg < narg) { + utils::bounds(FLERR, arg[iarg], 1, n, nlo, nhi, error); + + if (iarg + 1 >= narg) utils::missing_cmd_args(FLERR, "fix rheo/viscosity", error); + + if (strcmp(arg[iarg + 1], "constant") == 0) { + if (iarg + 2 >= narg) utils::missing_cmd_args(FLERR, "fix rheo/viscosity constant", error); + + constant_flag = 1; + double eta_one = utils::numeric(FLERR, arg[iarg + 2], false, lmp); + if (eta_one < 0.0) error->all(FLERR, "The viscosity must be positive"); + iarg += 1; + + for (i = nlo; i <= nhi; i++) { + viscosity_style[i] = CONSTANT; + eta[i] = eta_one; + } + } else if (strcmp(arg[iarg], "power") == 0) { + if (iarg + 5 >= narg) utils::missing_cmd_args(FLERR, "fix rheo/viscosity power", error); + + comm_forward = 1; + evolve_flag = 1; + double eta_one = utils::numeric(FLERR, arg[iarg + 2], false, lmp); + double gd0_one = utils::numeric(FLERR, arg[iarg + 3], false, lmp); + double K_one = utils::numeric(FLERR, arg[iarg + 4], false, lmp); + double npow_one = utils::numeric(FLERR, arg[iarg + 5], false, lmp); + if (eta_one < 0.0) error->all(FLERR, "The viscosity must be positive"); + iarg += 4; + + for (i = nlo; i <= nhi; i++) { + viscosity_style[i] = POWER; + eta[i] = eta_one; + gd0[i] = gd0_one; + K[i] = K_one; + npow[i] = npow_one; + tau0[i] = eta[i] * gd0[i] - K[i] * pow(gd0[i], npow[i]); + } + } else { + error->all(FLERR, "Illegal fix command, {}", arg[iarg]); } - iarg += ntypes; - } else if (strcmp(arg[iarg],"power") == 0) { - if (iarg + 4 >= narg) error->all(FLERR,"Insufficient arguments for viscosity option"); - viscosity_style = POWER; - comm_forward = 1; - eta = utils::numeric(FLERR,arg[iarg + 1],false,lmp); - gd0 = utils::numeric(FLERR,arg[iarg + 2],false,lmp); - K = utils::numeric(FLERR,arg[iarg + 3],false,lmp); - npow = utils::numeric(FLERR,arg[iarg + 4],false,lmp); - tau0 = eta * gd0 - K * pow(gd0, npow); - if (eta < 0.0) error->all(FLERR,"The viscosity must be positive"); - iarg += 5; - } else { - error->all(FLERR,"Illegal fix command, {}", arg[iarg]); + iarg += 2; } - if (viscosity_style == NONE) - error->all(FLERR,"Must specify viscosity style for fix/rheo/viscosity"); + for (i = 1; i <= n; i++) + if (viscosity_style[i] == NONE) + error->all(FLERR,"Must specify viscosity for atom type {} in fix/rheo/viscosity", i); } /* ---------------------------------------------------------------------- */ FixRHEOViscosity::~FixRHEOViscosity() { - memory->destroy(eta_type); + memory->destroy(viscosity_style); + memory->destroy(eta); + memory->destroy(gd0); + memory->destroy(K); + memory->destroy(npow); + memory->destroy(tau0); } /* ---------------------------------------------------------------------- */ @@ -115,17 +142,8 @@ void FixRHEOViscosity::setup_pre_force(int /*vflag*/) { fix_rheo->viscosity_fix_defined = 1; - // Identify whether this is the last instance of fix viscosity - last_flag = 0; - - int i = 0; - auto fixlist = modify->get_fix_by_style("rheo/viscosity"); - for (const auto &fix : fixlist) { - if (strcmp(fix->id, id) == 0) break; - i++; - } - - if ((i + 1) == fixlist.size()) last_flag = 1; + if (modify->get_fix_by_style("rheo/viscosity").size() > 1) + error->all(FLERR, "More than one fix rheo/viscosity defined"); post_neighbor(); pre_force(0); @@ -137,20 +155,18 @@ void FixRHEOViscosity::setup_pre_force(int /*vflag*/) void FixRHEOViscosity::post_neighbor() { - int i; + if (!constant_flag) return; + int i, itype; int *type = atom->type; - int *mask = atom->mask; double *viscosity = atom->viscosity; int nall = atom->nlocal + atom->nghost; - if (viscosity_style == CONSTANT) { - for (i = 0; i < nall; i++) - if (mask[i] & groupbit) viscosity[i] = eta; - } else if (viscosity_style == TYPE) { - for (i = 0; i < nall; i++) - if (mask[i] & groupbit) viscosity[i] = eta_type[type[i]]; + for (i = 0; i < nall; i++) { + itype = type[i]; + if (viscosity_style[itype]) + viscosity[i] = eta[itype]; } } @@ -160,39 +176,41 @@ void FixRHEOViscosity::post_neighbor() void FixRHEOViscosity::pre_force(int /*vflag*/) { - int i, a, b; + if (!evolve_flag) return; + + int i, itype, a, b; double tmp, gdot; - int *mask = atom->mask; + int *type = atom->type; double *viscosity = atom->viscosity; double **gradv = compute_grad->gradv; int nlocal = atom->nlocal; int dim = domain->dimension; - if (viscosity_style == POWER) { - for (i = 0; i < nlocal; i++) { - if (mask[i] & groupbit) { - gdot = 0.0; - for (a = 0; a < dim; a++) { - for (b = a; b < dim; b++) { - tmp = gradv[i][a * dim + b] + gradv[i][b * dim + a]; - tmp = tmp * tmp; - if (a == b) tmp *= 0.5; - gdot += tmp; - } - } - gdot = sqrt(gdot); - if (gdot <= gd0) { - viscosity[i] = eta; - } else { - viscosity[i] = K * pow(gdot, npow - 1) + tau0 / gdot; + + for (i = 0; i < nlocal; i++) { + itype = type[i]; + if (viscosity_style[itype] == POWER) { + gdot = 0.0; + for (a = 0; a < dim; a++) { + for (b = a; b < dim; b++) { + tmp = gradv[i][a * dim + b] + gradv[i][b * dim + a]; + tmp = tmp * tmp; + if (a == b) tmp *= 0.5; + gdot += tmp; } } + gdot = sqrt(gdot); + if (gdot <= gd0[itype]) { + viscosity[i] = eta[itype]; + } else { + viscosity[i] = K[itype] * pow(gdot, npow[itype] - 1) + tau0[itype] / gdot; + } } } - if (last_flag && comm_forward) comm->forward_comm(this); + if (comm_forward) comm->forward_comm(this); } /* ---------------------------------------------------------------------- */ diff --git a/src/RHEO/fix_rheo_viscosity.h b/src/RHEO/fix_rheo_viscosity.h index c681d18c00..f81feb74b2 100644 --- a/src/RHEO/fix_rheo_viscosity.h +++ b/src/RHEO/fix_rheo_viscosity.h @@ -37,9 +37,8 @@ class FixRHEOViscosity : public Fix { void unpack_forward_comm(int, int, double *) override; private: - double *eta_type, eta; - double npow, K, gd0, tau0; - int viscosity_style, last_flag; + double *eta, *npow, *K, *gd0, *tau0; + int *viscosity_style, constant_flag, evolve_flag; class FixRHEO *fix_rheo; class ComputeRHEOGrad *compute_grad; diff --git a/src/RHEO/pair_rheo.cpp b/src/RHEO/pair_rheo.cpp index e22715eab1..bb3d5c3fda 100644 --- a/src/RHEO/pair_rheo.cpp +++ b/src/RHEO/pair_rheo.cpp @@ -47,8 +47,8 @@ static constexpr double EPSILON = 1e-2; /* ---------------------------------------------------------------------- */ PairRHEO::PairRHEO(LAMMPS *lmp) : - Pair(lmp), compute_kernel(nullptr), compute_grad(nullptr), - compute_interface(nullptr), fix_rheo(nullptr), fix_pressure(nullptr) + Pair(lmp), compute_kernel(nullptr), compute_grad(nullptr), compute_interface(nullptr), fix_rheo(nullptr), + fix_pressure(nullptr), rho0(nullptr), csq(nullptr), cs(nullptr) { restartinfo = 0; single_enable = 0; @@ -68,6 +68,8 @@ PairRHEO::~PairRHEO() memory->destroy(setflag); memory->destroy(cutsq); } + + memory->destroy(cs); } /* ---------------------------------------------------------------------- */ @@ -77,8 +79,8 @@ void PairRHEO::compute(int eflag, int vflag) int i, j, a, b, ii, jj, inum, jnum, itype, jtype; int pair_force_flag, pair_rho_flag, pair_avisc_flag; int fluidi, fluidj; - double xtmp, ytmp, ztmp, w, wp, Ti, Tj, dT; - double rhoi, rhoj, voli, volj, Pi, Pj, etai, etaj, kappai, kappaj; + double xtmp, ytmp, ztmp, w, wp, Ti, Tj, dT, csq_ave, cs_ave; + double rhoi, rhoj, rho0i, rho0j, voli, volj, Pi, Pj, etai, etaj, kappai, kappaj; double mu, q, fp_prefactor, drho_damp, fmag, psi_ij, Fij; double *dWij, *dWji, *dW1ij, *dW1ji; double dx[3], du[3], dv[3], fv[3], dfp[3], fsolid[3], ft[3], vi[3], vj[3]; @@ -178,6 +180,9 @@ void PairRHEO::compute(int eflag, int vflag) kappaj = conductivity[j]; } + cs_ave = 0.5 * (cs[itype] + cs[jtype]); + csq_ave = cs_ave * cs_ave; + pair_rho_flag = 0; pair_force_flag = 0; pair_avisc_flag = 0; @@ -201,31 +206,31 @@ void PairRHEO::compute(int eflag, int vflag) // Add corrections for walls rhoi = rho[i]; rhoj = rho[j]; + rho0i = rho[itype]; + rho0j = rho[jtype]; Pi = pressure[i]; Pj = pressure[j]; fmag = 0; if (interface_flag) { if (fluidi && (!fluidj)) { compute_interface->correct_v(vi, vj, i, j); - //compute_interface->correct_v(vj, vi, j, i); rhoj = compute_interface->correct_rho(j, i); - Pj = fix_pressure->calc_pressure(rhoj); + Pj = fix_pressure->calc_pressure(rhoj, jtype); if ((chi[j] > 0.9) && (r < (h * 0.5))) - fmag = (chi[j] - 0.9) * (h * 0.5 - r) * rho0 * csq * h * rinv; + fmag = (chi[j] - 0.9) * (h * 0.5 - r) * rho0j * csq_ave * h * rinv; } else if ((!fluidi) && fluidj) { compute_interface->correct_v(vj, vi, j, i); - //compute_interface->correct_v(vi, vj, i, j); rhoi = compute_interface->correct_rho(i, j); - Pi = fix_pressure->calc_pressure(rhoi); + Pi = fix_pressure->calc_pressure(rhoi, itype); if (chi[i] > 0.9 && r < (h * 0.5)) - fmag = (chi[i] - 0.9) * (h * 0.5 - r) * rho0 * csq * h * rinv; + fmag = (chi[i] - 0.9) * (h * 0.5 - r) * rho0i * csq_ave * h * rinv; } else if ((!fluidi) && (!fluidj)) { - rhoi = rho0; - rhoj = rho0; + rhoi = rho0i; + rhoj = rho0j; } } @@ -239,12 +244,12 @@ void PairRHEO::compute(int eflag, int vflag) // Thermal Evolution if (thermal_flag) { dT = dot3(dx, dWij); - dT *= (kappai + kappaj) * (Ti - Tj) * rinv * rinv * voli * volj / rho0; + dT *= (kappai + kappaj) * (Ti - Tj) * rinv * rinv * voli * volj * 2.0 / (rhoi + rhoj); heatflow[i] += dT; if (newton_pair || j < nlocal) { dT = dot3(dx, dWji); - dT *= (kappai + kappaj) * (Tj - Ti) * rinv * rinv * voli * volj / rho0; + dT *= (kappai + kappaj) * (Tj - Ti) * rinv * rinv * voli * volj * 2.0 / (rhoi + rhoj); heatflow[j] -= dT; } } @@ -266,7 +271,7 @@ void PairRHEO::compute(int eflag, int vflag) mu = dot3(du, dx) * hinv3; mu /= (rsq * hinv3 * hinv3 + EPSILON); mu = MIN(0.0, mu); - q = av * (-2.0 * cs * mu + mu * mu); + q = av * (-2.0 * cs_ave * mu + mu * mu); fp_prefactor += voli * volj * q * (rhoj + rhoi); } @@ -334,7 +339,7 @@ void PairRHEO::compute(int eflag, int vflag) psi_ij += 0.5 * (gradr[i][a] + gradr[j][a]) * dx[a]; drho[i] += 2 * rho_damp * psi_ij * Fij * volj; } else { - drho_damp = 2 * rho_damp * (rhoj - rhoi) * rinv * wp; + drho_damp = 2 * rho_damp * ((rhoj - rho0[jtype]) - (rhoi - rho0[itype])) * rinv * wp; drho[i] -= drho_damp * volj; } @@ -383,23 +388,23 @@ void PairRHEO::allocate() void PairRHEO::settings(int narg, char **arg) { - if (narg < 1) error->all(FLERR,"Illegal pair_style command"); + if (narg < 1) error->all(FLERR, "Illegal pair_style command"); - h = utils::numeric(FLERR,arg[0],false,lmp); + h = utils::numeric(FLERR, arg[0], false, lmp); int iarg = 1; while (iarg < narg) { if (strcmp(arg[iarg], "rho/damp") == 0) { - if (iarg + 1 >= narg) error->all(FLERR,"Illegal pair_style command"); + if (iarg + 1 >= narg) error->all(FLERR, "Illegal pair_style command"); rho_damp_flag = 1; - rho_damp = utils::numeric(FLERR,arg[iarg + 1],false,lmp); + rho_damp = utils::numeric(FLERR, arg[iarg + 1], false, lmp); iarg++; } else if (strcmp(arg[iarg], "artificial/visc") == 0) { - if (iarg + 1 >= narg) error->all(FLERR,"Illegal pair_style command"); + if (iarg + 1 >= narg) error->all(FLERR, "Illegal pair_style command"); artificial_visc_flag = 1; - av = utils::numeric(FLERR,arg[iarg + 1],false,lmp); + av = utils::numeric(FLERR, arg[iarg + 1], false, lmp); iarg++; - } else error->all(FLERR,"Illegal pair_style command, {}", arg[iarg]); + } else error->all(FLERR, "Illegal pair_style command, {}", arg[iarg]); iarg++; } } @@ -411,13 +416,13 @@ void PairRHEO::settings(int narg, char **arg) void PairRHEO::coeff(int narg, char **arg) { if (narg != 2) - error->all(FLERR,"Incorrect number of args for pair_style rheo coefficients"); + error->all(FLERR, "Incorrect number of args for pair_style rheo coefficients"); if (!allocated) allocate(); int ilo, ihi, jlo, jhi; - utils::bounds(FLERR, arg[0], 1, atom->ntypes, ilo, ihi,error); - utils::bounds(FLERR, arg[1], 1, atom->ntypes, jlo, jhi,error); + utils::bounds(FLERR, arg[0], 1, atom->ntypes, ilo, ihi, error); + utils::bounds(FLERR, arg[1], 1, atom->ntypes, jlo, jhi, error); int count = 0; for (int i = ilo; i <= ihi; i++) { @@ -428,7 +433,7 @@ void PairRHEO::coeff(int narg, char **arg) } if (count == 0) - error->all(FLERR,"Incorrect args for pair rheo coefficients"); + error->all(FLERR, "Incorrect args for pair rheo coefficients"); } /* ---------------------------------------------------------------------- @@ -460,11 +465,14 @@ void PairRHEO::setup() hsq = h * h; hinv = 1.0 / h; hinv3 = hinv * 3.0; - cs = sqrt(csq); laplacian_order = -1; + int n = atom->ntypes; + memory->create(cs, n + 1, "rheo:cs"); + for (int i = 0; i <= n; i++) cs[i] = sqrt(csq[i]); + if (comm->ghost_velocity == 0) - error->all(FLERR,"Pair RHEO requires ghost atoms store velocity"); + error->all(FLERR, "Pair RHEO requires ghost atoms store velocity"); if (laplacian_order == -1) { if (fix_rheo->kernel_style == RK2) @@ -482,9 +490,8 @@ void PairRHEO::setup() double PairRHEO::init_one(int i, int j) { - if (setflag[i][j] == 0) { - error->all(FLERR,"All pair rheo coeffs are not set"); - } + if (setflag[i][j] == 0) + error->all(FLERR, "All pair rheo coeffs are not set"); return h; } diff --git a/src/RHEO/pair_rheo.h b/src/RHEO/pair_rheo.h index cb2227c8d6..c43d450b8b 100644 --- a/src/RHEO/pair_rheo.h +++ b/src/RHEO/pair_rheo.h @@ -37,8 +37,8 @@ class PairRHEO : public Pair { void unpack_reverse_comm(int, int *, double *) override; protected: - double h, csq, rho0; // From fix RHEO - double cs, hsq, hinv, hinv3, av, rho_damp; + double h, *csq, *rho0; // From fix RHEO + double *cs, hsq, hinv, hinv3, av, rho_damp; int laplacian_order; int artificial_visc_flag; diff --git a/src/RHEO/pair_rheo_react.cpp b/src/RHEO/pair_rheo_react.cpp index d7412d5d0e..1d54208792 100644 --- a/src/RHEO/pair_rheo_react.cpp +++ b/src/RHEO/pair_rheo_react.cpp @@ -296,20 +296,20 @@ void PairRHEOReact::allocate() allocated = 1; int n = atom->ntypes; - memory->create(setflag, n+1, n+1,"pair:setflag"); + memory->create(setflag, n + 1, n + 1, "pair:setflag"); for (int i = 1; i <= n; i++) for (int j = i; j <= n; j++) setflag[i][j] = 0; - memory->create(cut, n+1, n+1,"pair:cut"); - memory->create(cutbond, n+1, n+1,"pair:cutbond"); - memory->create(cutsq, n+1, n+1,"pair:cutsq"); - memory->create(cutbsq, n+1, n+1,"pair:cutbsq"); - memory->create(k, n+1, n+1,"pair:k"); - memory->create(eps, n+1, n+1,"pair:eps"); - memory->create(gamma, n+1, n+1,"pair:gamma"); - memory->create(t_form, n+1, n+1,"pair:t_form"); - memory->create(rlimit, n+1, n+1,"pair:rlimit"); + memory->create(cut, n + 1, n + 1, "pair:cut"); + memory->create(cutbond, n + 1, n + 1, "pair:cutbond"); + memory->create(cutsq, n + 1, n + 1, "pair:cutsq"); + memory->create(cutbsq, n + 1, n + 1, "pair:cutbsq"); + memory->create(k, n + 1, n + 1, "pair:k"); + memory->create(eps, n + 1, n + 1, "pair:eps"); + memory->create(gamma, n + 1, n + 1, "pair:gamma"); + memory->create(t_form, n + 1, n + 1, "pair:t_form"); + memory->create(rlimit, n + 1, n + 1, "pair:rlimit"); } /* ---------------------------------------------------------------------- @@ -326,7 +326,7 @@ void PairRHEOReact::settings(int narg, char **arg) void PairRHEOReact::coeff(int narg, char **arg) { - if (narg != 9) error->all(FLERR,"Incorrect args for pair coefficients"); + if (narg != 9) error->all(FLERR, "Incorrect args for pair coefficients"); if (!allocated) allocate(); int ilo, ihi, jlo, jhi; @@ -343,7 +343,7 @@ void PairRHEOReact::coeff(int narg, char **arg) if (k_one < 0.0 || eps_one < 0.0 || t_form_one < 0.0 || (1.0 + eps_one) * cutb_one > cut_one) - error->all(FLERR,"Illegal pair_style command"); + error->all(FLERR, "Illegal pair_style command"); int count = 0; for (int i = ilo; i <= ihi; i++) { @@ -360,7 +360,7 @@ void PairRHEOReact::coeff(int narg, char **arg) } } - if (count == 0) error->all(FLERR,"Incorrect args for pair coefficients"); + if (count == 0) error->all(FLERR, "Incorrect args for pair coefficients"); } /* ---------------------------------------------------------------------- @@ -406,7 +406,7 @@ void PairRHEOReact::setup() double PairRHEOReact::init_one(int i, int j) { - if (setflag[i][j] == 0) error->all(FLERR,"All pair coeffs are not set"); + if (setflag[i][j] == 0) error->all(FLERR, "All pair coeffs are not set"); cutbsq[i][j] = cutbond[i][j] * cutbond[i][j]; From 1e26c6d0c5c344cbb69dea7ca9b24774b6a090c6 Mon Sep 17 00:00:00 2001 From: jtclemm Date: Mon, 27 Nov 2023 15:53:19 -0700 Subject: [PATCH 061/158] Adding multiphase support, new stress --- src/RHEO/compute_rheo_property_atom.cpp | 31 ++++++- src/RHEO/compute_rheo_property_atom.h | 4 +- src/RHEO/compute_rheo_rho_sum.cpp | 5 +- src/RHEO/fix_rheo.cpp | 12 ++- src/RHEO/fix_rheo_pressure.cpp | 32 +++++++- src/RHEO/fix_rheo_pressure.h | 2 +- src/RHEO/fix_rheo_thermal.cpp | 2 +- src/RHEO/fix_rheo_viscosity.cpp | 4 + src/RHEO/pair_rheo.cpp | 52 +++++++++--- src/RHEO/pair_rheo.h | 2 + src/pair.cpp | 102 ++++++++++++++++++++++++ src/pair.h | 2 + 12 files changed, 222 insertions(+), 28 deletions(-) diff --git a/src/RHEO/compute_rheo_property_atom.cpp b/src/RHEO/compute_rheo_property_atom.cpp index 50bcb2a2d0..e450eaaf0b 100644 --- a/src/RHEO/compute_rheo_property_atom.cpp +++ b/src/RHEO/compute_rheo_property_atom.cpp @@ -14,7 +14,7 @@ /* ---------------------------------------------------------------------- Contributing authors: - Joel Clemmer (SNL), Thomas O'Connor (CMU), Eric Palermo (CMU) + Joel Clemmer (SNL) ----------------------------------------------------------------------- */ #include "compute_rheo_property_atom.h" @@ -29,6 +29,7 @@ #include "domain.h" #include "error.h" #include "fix_rheo.h" +#include "fix_rheo_pressure.h" #include "fix_rheo_thermal.h" #include "memory.h" #include "modify.h" @@ -44,7 +45,7 @@ using namespace RHEO_NS; /* ---------------------------------------------------------------------- */ ComputeRHEOPropertyAtom::ComputeRHEOPropertyAtom(LAMMPS *lmp, int narg, char **arg) : - Compute(lmp, narg, arg), fix_rheo(nullptr), fix_thermal(nullptr), compute_interface(nullptr), + Compute(lmp, narg, arg), fix_rheo(nullptr), fix_pressure(nullptr), fix_thermal(nullptr), compute_interface(nullptr), compute_kernel(nullptr), compute_surface(nullptr), compute_vshift(nullptr), compute_grad(nullptr), avec_index(nullptr), pack_choice(nullptr), col_index(nullptr) { @@ -55,7 +56,7 @@ ComputeRHEOPropertyAtom::ComputeRHEOPropertyAtom(LAMMPS *lmp, int narg, char **a if (nvalues == 1) size_peratom_cols = 0; else size_peratom_cols = nvalues; - thermal_flag = interface_flag = surface_flag = shift_flag = 0; + pressure_flag = thermal_flag = interface_flag = surface_flag = shift_flag = 0; // parse input values // customize a new keyword by adding to if statement @@ -90,6 +91,9 @@ ComputeRHEOPropertyAtom::ComputeRHEOPropertyAtom(LAMMPS *lmp, int narg, char **a col_index[i] = get_vector_index(arg[iarg]); } else if (strcmp(arg[iarg],"coordination") == 0) { pack_choice[i] = &ComputeRHEOPropertyAtom::pack_coordination; + } else if (strcmp(arg[iarg],"pressure") == 0) { + pressure_flag = 1; + pack_choice[i] = &ComputeRHEOPropertyAtom::pack_pressure; } else if (strcmp(arg[iarg],"cv") == 0) { thermal_flag = 1; pack_choice[i] = &ComputeRHEOPropertyAtom::pack_cv; @@ -155,6 +159,11 @@ void ComputeRHEOPropertyAtom::init() fixes = modify->get_fix_by_style("rheo/thermal"); fix_thermal = dynamic_cast(fixes[0]); } + + if (pressure_flag) { + fixes = modify->get_fix_by_style("rheo/pressure"); + fix_pressure = dynamic_cast(fixes[0]); + } } /* ---------------------------------------------------------------------- */ @@ -343,6 +352,22 @@ void ComputeRHEOPropertyAtom::pack_cv(int n) /* ---------------------------------------------------------------------- */ +void ComputeRHEOPropertyAtom::pack_pressure(int n) +{ + int *type = atom->type; + int *mask = atom->mask; + double *rho = atom->rho; + int nlocal = atom->nlocal; + + for (int i = 0; i < nlocal; i++) { + if (mask[i] & groupbit) buf[n] = fix_pressure->calc_pressure(rho[i], type[i]); + else buf[n] = 0.0; + n += nvalues; + } +} + +/* ---------------------------------------------------------------------- */ + void ComputeRHEOPropertyAtom::pack_shift_v(int n) { double **vshift = compute_vshift->vshift; diff --git a/src/RHEO/compute_rheo_property_atom.h b/src/RHEO/compute_rheo_property_atom.h index bfae870ee5..f3596fbbf9 100644 --- a/src/RHEO/compute_rheo_property_atom.h +++ b/src/RHEO/compute_rheo_property_atom.h @@ -34,7 +34,7 @@ class ComputeRHEOPropertyAtom : public Compute { private: int nvalues, nmax; - int thermal_flag, interface_flag, surface_flag, shift_flag; + int pressure_flag, thermal_flag, interface_flag, surface_flag, shift_flag; int *avec_index; int *col_index; double *buf; @@ -53,12 +53,14 @@ class ComputeRHEOPropertyAtom : public Compute { void pack_cv(int); void pack_shift_v(int); void pack_gradv(int); + void pack_pressure(int); void pack_atom_style(int); int get_vector_index(char*); int get_tensor_index(char*); class FixRHEO *fix_rheo; + class FixRHEOPressure *fix_pressure; class FixRHEOThermal *fix_thermal; class ComputeRHEOInterface *compute_interface; class ComputeRHEOKernel *compute_kernel; diff --git a/src/RHEO/compute_rheo_rho_sum.cpp b/src/RHEO/compute_rheo_rho_sum.cpp index 0a2096a2b9..82d3aa4bc6 100644 --- a/src/RHEO/compute_rheo_rho_sum.cpp +++ b/src/RHEO/compute_rheo_rho_sum.cpp @@ -88,7 +88,7 @@ void ComputeRHEORhoSum::compute_peratom() // initialize arrays, local with quintic self-contribution, ghosts are zeroed for (i = 0; i < nlocal; i++) { w = compute_kernel->calc_w_quintic(i, i, 0.0, 0.0, 0.0, 0.0); - rho[i] += w * mass[type[i]]; + rho[i] = w * mass[type[i]]; } for (i = nlocal; i < nall; i++) rho[i] = 0.0; @@ -131,12 +131,11 @@ int ComputeRHEORhoSum::pack_forward_comm(int n, int *list, double *buf, { int i, j, k, m; double *rho = atom->rho; - int *coordination = compute_kernel->coordination; m = 0; for (i = 0; i < n; i++) { j = list[i]; - buf[m++] = coordination[j]; + buf[m++] = rho[j]; } return m; } diff --git a/src/RHEO/fix_rheo.cpp b/src/RHEO/fix_rheo.cpp index d07f0d1a1f..f0f380f23a 100644 --- a/src/RHEO/fix_rheo.cpp +++ b/src/RHEO/fix_rheo.cpp @@ -279,6 +279,9 @@ void FixRHEO::setup(int /*vflag*/) error->one(FLERR, "Fix rheo/viscosity does not fully cover all atoms"); if (!t_coverage_flag) error->one(FLERR, "Fix rheo/thermal does not fully cover all atoms"); + + if (rhosum_flag) + compute_rhosum->compute_peratom(); } /* ---------------------------------------------------------------------- */ @@ -419,10 +422,11 @@ void FixRHEO::pre_force(int /*vflag*/) status[i] &= OPTIONSMASK; // Calculate surfaces, update status - if (surface_flag) compute_surface->compute_peratom(); - - if (shift_flag) - compute_vshift->correct_surfaces(); + if (surface_flag) { + compute_surface->compute_peratom(); + if (shift_flag) + compute_vshift->correct_surfaces(); + } } /* ---------------------------------------------------------------------- */ diff --git a/src/RHEO/fix_rheo_pressure.cpp b/src/RHEO/fix_rheo_pressure.cpp index eac4b34046..8c523b2b35 100644 --- a/src/RHEO/fix_rheo_pressure.cpp +++ b/src/RHEO/fix_rheo_pressure.cpp @@ -31,14 +31,14 @@ using namespace LAMMPS_NS; using namespace FixConst; -enum {NONE, LINEAR, CUBIC, TAITWATER}; +enum {NONE, LINEAR, CUBIC, TAITWATER, TAITGENERAL}; static constexpr double SEVENTH = 1.0 / 7.0; /* ---------------------------------------------------------------------- */ FixRHEOPressure::FixRHEOPressure(LAMMPS *lmp, int narg, char **arg) : - Fix(lmp, narg, arg), fix_rheo(nullptr), rho0(nullptr), csq(nullptr), rho0inv(nullptr), csqinv(nullptr), c_cubic(nullptr), pressure_style(nullptr) + Fix(lmp, narg, arg), fix_rheo(nullptr), rho0(nullptr), csq(nullptr), rho0inv(nullptr), csqinv(nullptr), c_cubic(nullptr), tpower(nullptr), pbackground(nullptr), pressure_style(nullptr) { if (narg < 4) error->all(FLERR,"Illegal fix command"); @@ -51,6 +51,9 @@ FixRHEOPressure::FixRHEOPressure(LAMMPS *lmp, int narg, char **arg) : int i, nlo, nhi; int n = atom->ntypes; memory->create(pressure_style, n + 1, "rheo:pressure_style"); + memory->create(c_cubic, n + 1, "rheo:c_cubic"); + memory->create(tpower, n + 1, "rheo:tpower"); + memory->create(pbackground, n + 1, "rheo:pbackground"); for (i = 1; i <= n; i++) pressure_style[i] = NONE; int iarg = 3; @@ -62,9 +65,21 @@ FixRHEOPressure::FixRHEOPressure(LAMMPS *lmp, int narg, char **arg) : if (strcmp(arg[iarg + 1], "linear") == 0) { for (i = nlo; i <= nhi; i++) pressure_style[i] = LINEAR; - } else if (strcmp(arg[iarg + 1], "taitwater") == 0) { + } else if (strcmp(arg[iarg + 1], "tait/water") == 0) { for (i = nlo; i <= nhi; i++) pressure_style[i] = TAITWATER; + } else if (strcmp(arg[iarg + 1], "tait/general") == 0) { + if (iarg + 3 >= narg) utils::missing_cmd_args(FLERR, "fix rheo/pressure tait", error); + + double tpower_one = utils::numeric(FLERR, arg[iarg + 2], false, lmp); + double pbackground_one = utils::numeric(FLERR, arg[iarg + 3], false, lmp); + iarg += 2; + + for (i = nlo; i <= nhi; i++) { + pressure_style[i] = TAITGENERAL; + tpower[i] = tpower_one; + pbackground[i] = pbackground_one; + } } else if (strcmp(arg[iarg + 1], "cubic") == 0) { if (iarg + 2 >= narg) utils::missing_cmd_args(FLERR, "fix rheo/pressure cubic", error); @@ -94,6 +109,8 @@ FixRHEOPressure::~FixRHEOPressure() memory->destroy(csqinv); memory->destroy(rho0inv); memory->destroy(c_cubic); + memory->destroy(tpower); + memory->destroy(pbackground); } /* ---------------------------------------------------------------------- */ @@ -204,6 +221,10 @@ double FixRHEOPressure::calc_pressure(double rho, int type) rho_ratio = rho * rho0inv[type]; rr3 = rho_ratio * rho_ratio * rho_ratio; p = csq[type] * rho0[type] * SEVENTH * (rr3 * rr3 * rho_ratio - 1.0); + } else if (pressure_style[type] == TAITGENERAL) { + rho_ratio = rho * rho0inv[type]; + p = csq[type] * rho0[type] * (pow(rho_ratio, tpower[type]) - 1.0) / tpower[type]; + p += pbackground[type]; } return p; } @@ -222,6 +243,11 @@ double FixRHEOPressure::calc_rho(double p, int type) rho = pow(7.0 * p + csq[type] * rho0[type], SEVENTH); rho *= pow(rho0[type], 6.0 * SEVENTH); rho *= pow(csq[type], -SEVENTH); + } else if (pressure_style[type] == TAITGENERAL) { + p -= pbackground[type]; + rho = pow(tpower[type] * p + csq[type] * rho0[type], 1.0 / tpower[type]); + rho *= pow(rho0[type], 1.0 - 1.0 / tpower[type]); + rho *= pow(csq[type], -1.0 / tpower[type]); } return rho; } diff --git a/src/RHEO/fix_rheo_pressure.h b/src/RHEO/fix_rheo_pressure.h index ee86c5e184..ca165b1ed5 100644 --- a/src/RHEO/fix_rheo_pressure.h +++ b/src/RHEO/fix_rheo_pressure.h @@ -38,7 +38,7 @@ class FixRHEOPressure : public Fix { double calc_rho(double, int); private: - double *c_cubic, *csq, *csqinv, *rho0, *rho0inv; + double *c_cubic, *csq, *csqinv, *rho0, *rho0inv, *tpower, *pbackground; int *pressure_style; class FixRHEO *fix_rheo; diff --git a/src/RHEO/fix_rheo_thermal.cpp b/src/RHEO/fix_rheo_thermal.cpp index dd2c6eddbd..e6c598418b 100644 --- a/src/RHEO/fix_rheo_thermal.cpp +++ b/src/RHEO/fix_rheo_thermal.cpp @@ -13,7 +13,7 @@ /* ---------------------------------------------------------------------- Contributing authors: - Joel Clemmer (SNL), Thomas O'Connor (CMU), Eric Palermo (CMU) + Joel Clemmer (SNL) ----------------------------------------------------------------------- */ #include "fix_rheo_thermal.h" diff --git a/src/RHEO/fix_rheo_viscosity.cpp b/src/RHEO/fix_rheo_viscosity.cpp index 91799ccfd0..2fffa8b29c 100644 --- a/src/RHEO/fix_rheo_viscosity.cpp +++ b/src/RHEO/fix_rheo_viscosity.cpp @@ -52,6 +52,10 @@ FixRHEOViscosity::FixRHEOViscosity(LAMMPS *lmp, int narg, char **arg) : int i, nlo, nhi; int n = atom->ntypes; memory->create(viscosity_style, n + 1, "rheo:viscosity_style"); + memory->create(eta, n + 1, "rheo:eta"); + memory->create(gd0, n + 1, "rheo:gd0"); + memory->create(K, n + 1, "rheo:K"); + memory->create(npow, n + 1, "rheo:npow"); for (i = 1; i <= n; i++) viscosity_style[i] = NONE; int iarg = 3; diff --git a/src/RHEO/pair_rheo.cpp b/src/RHEO/pair_rheo.cpp index bb3d5c3fda..339efed866 100644 --- a/src/RHEO/pair_rheo.cpp +++ b/src/RHEO/pair_rheo.cpp @@ -56,6 +56,7 @@ PairRHEO::PairRHEO(LAMMPS *lmp) : artificial_visc_flag = 0; rho_damp_flag = 0; thermal_flag = 0; + harmonic_means_flag = 0; comm_reverse = 3; } @@ -80,7 +81,7 @@ void PairRHEO::compute(int eflag, int vflag) int pair_force_flag, pair_rho_flag, pair_avisc_flag; int fluidi, fluidj; double xtmp, ytmp, ztmp, w, wp, Ti, Tj, dT, csq_ave, cs_ave; - double rhoi, rhoj, rho0i, rho0j, voli, volj, Pi, Pj, etai, etaj, kappai, kappaj; + double rhoi, rhoj, rho0i, rho0j, voli, volj, Pi, Pj, etai, etaj, kappai, kappaj, eta_ave, kappa_ave,dT_prefactor; double mu, q, fp_prefactor, drho_damp, fmag, psi_ij, Fij; double *dWij, *dWji, *dW1ij, *dW1ji; double dx[3], du[3], dv[3], fv[3], dfp[3], fsolid[3], ft[3], vi[3], vj[3]; @@ -112,6 +113,7 @@ void PairRHEO::compute(int eflag, int vflag) int *type = atom->type; int *status = atom->status; tagint *tag = atom->tag; + double fnorm, ftang[3]; double **fp_store, *chi; if (compute_interface) { @@ -243,14 +245,19 @@ void PairRHEO::compute(int eflag, int vflag) // Thermal Evolution if (thermal_flag) { + if (harmonic_means_flag) { + kappa_ave = 2.0 * kappai * kappaj / (kappai + kappaj); + } else { + kappa_ave = 0.5 * (kappai * kappaj); + } + dT_prefactor = 2.0 * kappa_ave * (Ti - Tj) * rinv * rinv * voli * volj * 2.0 / (rhoi + rhoj); + dT = dot3(dx, dWij); - dT *= (kappai + kappaj) * (Ti - Tj) * rinv * rinv * voli * volj * 2.0 / (rhoi + rhoj); - heatflow[i] += dT; + heatflow[i] += dT * dT_prefactor; if (newton_pair || j < nlocal) { dT = dot3(dx, dWji); - dT *= (kappai + kappaj) * (Tj - Ti) * rinv * rinv * voli * volj * 2.0 / (rhoi + rhoj); - heatflow[j] -= dT; + heatflow[j] += dT * dT_prefactor; } } @@ -260,6 +267,12 @@ void PairRHEO::compute(int eflag, int vflag) fp_prefactor = voli * volj * (Pj + Pi); sub3(vi, vj, dv); + if (harmonic_means_flag) { + eta_ave = 2.0 * etai * etaj / (etai + etaj); + } else { + eta_ave = 0.5 * (etai * etaj); + } + //Add artificial viscous pressure if required if (artificial_visc_flag && pair_avisc_flag) { //Interpolate velocities to midpoint and use this difference for artificial viscosity @@ -283,7 +296,7 @@ void PairRHEO::compute(int eflag, int vflag) fv[a] = 0.0; for (b = 0; b < dim; b++) fv[a] += dv[a] * dx[b] * dWij[b]; - fv[a] *= (etai + etaj) * voli * volj * rinv * rinv; + fv[a] *= 2.0 * eta_ave * voli * volj * rinv * rinv; } add3(fv, dfp, ft); @@ -293,26 +306,38 @@ void PairRHEO::compute(int eflag, int vflag) f[i][1] += ft[1]; f[i][2] += ft[2]; - if (evflag) // Does not account for unbalanced forces - ev_tally_xyz(i, j, nlocal, newton_pair, 0.0, 0.0, ft[0], ft[1], ft[2], dx[0], dx[1], dx[2]); + if (evflag) { + fnorm = dot3(ft, dx) * rinv * rinv * 0.5; + ftang[0] = ft[0] * 0.5 - dx[0] * fnorm; + ftang[1] = ft[1] * 0.5 - dx[1] * fnorm; + ftang[2] = ft[2] * 0.5 - dx[2] * fnorm; + ev_tally_nt(i, j, nlocal, newton_pair, 0.0, 0.0, fnorm, ftang[0], ftang[1], ftang[2], dx[0], dx[1], dx[2]); + } if (newton_pair || j < nlocal) { for (a = 0; a < dim; a ++) { fv[a] = 0.0; for (b = 0; b < dim; b++) fv[a] += (vi[a] - vj[a]) * dx[b] * dWji[b]; - fv[a] *= -(etai + etaj) * voli * volj * rinv * rinv; + fv[a] *= -2.0 * eta_ave * voli * volj * rinv * rinv; // flip sign here b/c -= at accummulator } scale3(fp_prefactor, dWji, dfp); - add3(fv, dfp, ft); add3(fsolid, ft, ft); f[j][0] -= ft[0]; f[j][1] -= ft[1]; f[j][2] -= ft[2]; + + if (evflag) { + fnorm = - dot3(ft, dx) * rinv * rinv * 0.5; + ftang[0] = ft[0] * 0.5 + dx[0] * fnorm; + ftang[1] = ft[1] * 0.5 + dx[1] * fnorm; + ftang[2] = ft[2] * 0.5 + dx[2] * fnorm; + ev_tally_nt(i, j, nlocal, newton_pair, 0.0, 0.0, fnorm, ftang[0], ftang[1], ftang[2], -dx[0], -dx[1], -dx[2]); + } } if (compute_interface) { @@ -360,7 +385,7 @@ void PairRHEO::compute(int eflag, int vflag) if (vflag_fdotr) virial_fdotr_compute(); if (compute_interface) { - comm->reverse_comm(this); + if (newton_pair) comm->reverse_comm(this); comm->forward_comm(this); } } @@ -404,6 +429,8 @@ void PairRHEO::settings(int narg, char **arg) artificial_visc_flag = 1; av = utils::numeric(FLERR, arg[iarg + 1], false, lmp); iarg++; + } else if (strcmp(arg[iarg], "harmonic/means") == 0) { + harmonic_means_flag = 1; } else error->all(FLERR, "Illegal pair_style command, {}", arg[iarg]); iarg++; } @@ -469,7 +496,8 @@ void PairRHEO::setup() int n = atom->ntypes; memory->create(cs, n + 1, "rheo:cs"); - for (int i = 0; i <= n; i++) cs[i] = sqrt(csq[i]); + for (int i = 1; i <= n; i++) + cs[i] = sqrt(csq[i]); if (comm->ghost_velocity == 0) error->all(FLERR, "Pair RHEO requires ghost atoms store velocity"); diff --git a/src/RHEO/pair_rheo.h b/src/RHEO/pair_rheo.h index c43d450b8b..7a47927962 100644 --- a/src/RHEO/pair_rheo.h +++ b/src/RHEO/pair_rheo.h @@ -46,6 +46,8 @@ class PairRHEO : public Pair { int thermal_flag; int interface_flag; + int harmonic_means_flag; + void allocate(); class ComputeRHEOKernel *compute_kernel; diff --git a/src/pair.cpp b/src/pair.cpp index 5d789fbb9b..56a6283afa 100644 --- a/src/pair.cpp +++ b/src/pair.cpp @@ -1246,6 +1246,108 @@ void Pair::ev_tally_xyz(int i, int j, int nlocal, int newton_pair, } } + +/* ---------------------------------------------------------------------- + tally eng_vdwl and virial into global or per-atom accumulators + for virial, have delx,dely,delz and fnormal and ftangential +------------------------------------------------------------------------- */ + +void Pair::ev_tally_nt(int i, int j, int nlocal, int newton_pair, + double evdwl, double ecoul, double fn, + double ftx, double fty, double ftz, + double delx, double dely, double delz) +{ + double evdwlhalf,ecoulhalf,epairhalf,v[6]; + + if (eflag_either) { + if (eflag_global) { + if (newton_pair) { + eng_vdwl += evdwl; + eng_coul += ecoul; + } else { + evdwlhalf = 0.5*evdwl; + ecoulhalf = 0.5*ecoul; + if (i < nlocal) { + eng_vdwl += evdwlhalf; + eng_coul += ecoulhalf; + } + if (j < nlocal) { + eng_vdwl += evdwlhalf; + eng_coul += ecoulhalf; + } + } + } + if (eflag_atom) { + epairhalf = 0.5 * (evdwl + ecoul); + if (newton_pair || i < nlocal) eatom[i] += epairhalf; + if (newton_pair || j < nlocal) eatom[j] += epairhalf; + } + } + + if (vflag_either) { + v[0] = delx*delx*fn; + v[1] = dely*dely*fn; + v[2] = delz*delz*fn; + v[3] = delx*dely*fn; + v[4] = delx*delz*fn; + v[5] = dely*delz*fn; + + v[0] += delx*ftx; + v[1] += dely*fty; + v[2] += delz*ftz; + v[3] += delx*fty + dely*ftx; + v[4] += delx*ftz + delz*ftx; + v[5] += dely*ftz + delz*fty; + + if (vflag_global) { + if (newton_pair) { + virial[0] += v[0]; + virial[1] += v[1]; + virial[2] += v[2]; + virial[3] += v[3]; + virial[4] += v[4]; + virial[5] += v[5]; + } else { + if (i < nlocal) { + virial[0] += 0.5*v[0]; + virial[1] += 0.5*v[1]; + virial[2] += 0.5*v[2]; + virial[3] += 0.5*v[3]; + virial[4] += 0.5*v[4]; + virial[5] += 0.5*v[5]; + } + if (j < nlocal) { + virial[0] += 0.5*v[0]; + virial[1] += 0.5*v[1]; + virial[2] += 0.5*v[2]; + virial[3] += 0.5*v[3]; + virial[4] += 0.5*v[4]; + virial[5] += 0.5*v[5]; + } + } + } + + if (vflag_atom) { + if (newton_pair || i < nlocal) { + vatom[i][0] += 0.5*v[0]; + vatom[i][1] += 0.5*v[1]; + vatom[i][2] += 0.5*v[2]; + vatom[i][3] += 0.5*v[3]; + vatom[i][4] += 0.5*v[4]; + vatom[i][5] += 0.5*v[5]; + } + if (newton_pair || j < nlocal) { + vatom[j][0] += 0.5*v[0]; + vatom[j][1] += 0.5*v[1]; + vatom[j][2] += 0.5*v[2]; + vatom[j][3] += 0.5*v[3]; + vatom[j][4] += 0.5*v[4]; + vatom[j][5] += 0.5*v[5]; + } + } + } +} + /* ---------------------------------------------------------------------- tally eng_vdwl and virial into global or per-atom accumulators for virial, have delx,dely,delz and fx,fy,fz diff --git a/src/pair.h b/src/pair.h index 885a2c45ff..6533c7b124 100644 --- a/src/pair.h +++ b/src/pair.h @@ -295,6 +295,8 @@ class Pair : protected Pointers { void ev_tally_tip4p(int, int *, double *, double, double); void ev_tally_xyz(int, int, int, int, double, double, double, double, double, double, double, double); + void ev_tally_nt(int, int, int, int, double, double, double, double, double, double, double, + double, double); void v_tally2(int, int, double, double *); void v_tally_tensor(int, int, int, int, double, double, double, double, double, double); void virial_fdotr_compute(); From f7aeecd3be03f98182d91d0a8ed50b94a6e9a46e Mon Sep 17 00:00:00 2001 From: jtclemm Date: Fri, 1 Dec 2023 09:58:40 -0700 Subject: [PATCH 062/158] Fixing error in averaging --- src/RHEO/pair_rheo.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/RHEO/pair_rheo.cpp b/src/RHEO/pair_rheo.cpp index 339efed866..4ef0066e93 100644 --- a/src/RHEO/pair_rheo.cpp +++ b/src/RHEO/pair_rheo.cpp @@ -248,7 +248,7 @@ void PairRHEO::compute(int eflag, int vflag) if (harmonic_means_flag) { kappa_ave = 2.0 * kappai * kappaj / (kappai + kappaj); } else { - kappa_ave = 0.5 * (kappai * kappaj); + kappa_ave = 0.5 * (kappai + kappaj); } dT_prefactor = 2.0 * kappa_ave * (Ti - Tj) * rinv * rinv * voli * volj * 2.0 / (rhoi + rhoj); @@ -270,7 +270,7 @@ void PairRHEO::compute(int eflag, int vflag) if (harmonic_means_flag) { eta_ave = 2.0 * etai * etaj / (etai + etaj); } else { - eta_ave = 0.5 * (etai * etaj); + eta_ave = 0.5 * (etai + etaj); } //Add artificial viscous pressure if required From 7403426046c013a1f5c5b17fd4a50bcf59e2714e Mon Sep 17 00:00:00 2001 From: jtclemm Date: Tue, 19 Dec 2023 13:58:22 -0700 Subject: [PATCH 063/158] Argument error in fix rheo --- src/RHEO/fix_rheo.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/RHEO/fix_rheo.cpp b/src/RHEO/fix_rheo.cpp index f0f380f23a..0c74b2bad1 100644 --- a/src/RHEO/fix_rheo.cpp +++ b/src/RHEO/fix_rheo.cpp @@ -100,7 +100,7 @@ FixRHEO::FixRHEO(LAMMPS *lmp, int narg, char **arg) : thermal_flag = 1; } else if (strcmp(arg[iarg], "surface/detection") == 0) { surface_flag = 1; - if(iarg + 2 >= narg) error->all(FLERR, "Illegal surface/detection option in fix rheo"); + if(iarg + 3 >= narg) error->all(FLERR, "Illegal surface/detection option in fix rheo"); if (strcmp(arg[iarg + 1], "coordination") == 0) { surface_style = COORDINATION; zmin_surface = utils::inumeric(FLERR, arg[iarg + 2], false, lmp); From 08d2dd26991dce65f9beee61039952bd3f81ca37 Mon Sep 17 00:00:00 2001 From: jtclemm Date: Fri, 22 Dec 2023 10:46:44 -0700 Subject: [PATCH 064/158] Prototyping latent heat, other misc fixes --- src/.gitignore | 35 +-- src/RHEO/atom_vec_rheo_thermal.cpp | 46 ++-- src/RHEO/atom_vec_rheo_thermal.h | 2 +- src/RHEO/compute_rheo_grad.cpp | 69 +++-- src/RHEO/compute_rheo_grad.h | 4 +- src/RHEO/compute_rheo_kernel.cpp | 15 +- src/RHEO/compute_rheo_kernel.h | 1 + src/RHEO/compute_rheo_property_atom.cpp | 8 + src/RHEO/compute_rheo_vshift.cpp | 4 + src/RHEO/fix_rheo.cpp | 3 +- src/RHEO/fix_rheo_thermal.cpp | 139 ++++++++-- src/RHEO/fix_rheo_thermal.h | 6 +- src/RHEO/pair_rheo.cpp | 1 - src/RHEO/pair_rheo_solid.cpp | 351 ++++++++++++++++++++++++ src/RHEO/pair_rheo_solid.h | 51 ++++ src/set.cpp | 2 +- 16 files changed, 611 insertions(+), 126 deletions(-) create mode 100644 src/RHEO/pair_rheo_solid.cpp create mode 100644 src/RHEO/pair_rheo_solid.h diff --git a/src/.gitignore b/src/.gitignore index 1e634782dc..ccf8072922 100644 --- a/src/.gitignore +++ b/src/.gitignore @@ -197,40 +197,7 @@ /pair_tdpd.cpp /pair_tdpd.h -/atom_vec_rheo.cpp -/atom_vec_rheo.h -/atom_vec_rheo_thermal.cpp -/atom_vec_rheo_thermal.h -/compute_rheo_grad.cpp -/compute_rheo_grad.h -/compute_rheo_interface.cpp -/compute_rheo_interface.h -/compute_rheo_kernel.cpp -/compute_rheo_kernel.h -/compute_rheo_property_atom.cpp -/compute_rheo_property_atom.h -/compute_rheo_rho_sum.cpp -/compute_rheo_rho_sum.h -/compute_rheo_surface.cpp -/compute_rheo_surface.h -/compute_rheo_vshift.cpp -/compute_rheo_vshift.h -/fix_rheo.cpp -/fix_rheo.h -/fix_rheo_pressure.cpp -/fix_rheo_pressure.h -/fix_rheo_stress.cpp -/fix_rheo_stress.h -/fix_rheo_tension.cpp -/fix_rheo_tension.h -/fix_rheo_thermal.cpp -/fix_rheo_thermal.h -/fix_rheo_viscosity.cpp -/fix_rheo_viscosity.h -/pair_rheo.cpp -/pair_rheo.h -/pair_rheo_react.cpp -/pair_rheo_react.h +/*rheo* /compute_grid.cpp /compute_grid.h diff --git a/src/RHEO/atom_vec_rheo_thermal.cpp b/src/RHEO/atom_vec_rheo_thermal.cpp index de0c7fa5d7..4ecb7136a8 100644 --- a/src/RHEO/atom_vec_rheo_thermal.cpp +++ b/src/RHEO/atom_vec_rheo_thermal.cpp @@ -35,6 +35,7 @@ AtomVecRHEOThermal::AtomVecRHEOThermal(LAMMPS *lmp) : AtomVec(lmp) atom->status_flag = 1; atom->conductivity_flag = 1; atom->temperature_flag = 1; + atom->esph_flag = 1; atom->heatflow_flag = 1; atom->pressure_flag = 1; atom->rho_flag = 1; @@ -45,17 +46,17 @@ AtomVecRHEOThermal::AtomVecRHEOThermal(LAMMPS *lmp) : AtomVec(lmp) // order of fields in a string does not matter // except: fields_data_atom & fields_data_vel must match data file - fields_grow = {"status", "rho", "drho", "temperature", "heatflow", "conductivity", "pressure", "viscosity"}; - fields_copy = {"status", "rho", "drho", "temperature", "heatflow", "conductivity", "pressure", "viscosity"}; - fields_comm = {"status", "rho", "temperature"}; - fields_comm_vel = {"status", "rho", "temperature"}; + fields_grow = {"status", "rho", "drho", "temperature", "esph", "heatflow", "conductivity", "pressure", "viscosity"}; + fields_copy = {"status", "rho", "drho", "temperature", "esph", "heatflow", "conductivity", "pressure", "viscosity"}; + fields_comm = {"status", "rho", "esph"}; + fields_comm_vel = {"status", "rho", "esph"}; fields_reverse = {"drho", "heatflow"}; - fields_border = {"status", "rho", "temperature"}; - fields_border_vel = {"status", "rho", "temperature"}; - fields_exchange = {"status", "rho", "temperature"}; - fields_restart = {"status", "rho", "temperature"}; - fields_create = {"status", "rho", "drho", "temperature", "heatflow", "conductivity", "pressure", "viscosity"}; - fields_data_atom = {"id", "type", "status", "rho", "temperature", "x"}; + fields_border = {"status", "rho", "esph"}; + fields_border_vel = {"status", "rho", "esph"}; + fields_exchange = {"status", "rho", "esph"}; + fields_restart = {"status", "rho", "esph"}; + fields_create = {"status", "rho", "drho", "temperature", "esph", "heatflow", "conductivity", "pressure", "viscosity"}; + fields_data_atom = {"id", "type", "status", "rho", "esph", "x"}; fields_data_vel = {"id", "v"}; setup_fields(); @@ -71,6 +72,7 @@ void AtomVecRHEOThermal::grow_pointers() status = atom->status; conductivity = atom->conductivity; temperature = atom->temperature; + esph = atom->esph; heatflow = atom->heatflow; pressure = atom->pressure; rho = atom->rho; @@ -98,6 +100,7 @@ void AtomVecRHEOThermal::data_atom_post(int ilocal) { drho[ilocal] = 0.0; heatflow[ilocal] = 0.0; + temperature[ilocal] = 0.0; pressure[ilocal] = 0.0; viscosity[ilocal] = 0.0; conductivity[ilocal] = 0.0; @@ -114,10 +117,11 @@ int AtomVecRHEOThermal::property_atom(const std::string &name) if (name == "rho") return 1; if (name == "drho") return 2; if (name == "temperature") return 3; - if (name == "heatflow") return 4; - if (name == "conductivity") return 5; - if (name == "pressure") return 6; - if (name == "viscosity") return 7; + if (name == "esph") return 4; + if (name == "heatflow") return 5; + if (name == "conductivity") return 6; + if (name == "pressure") return 7; + if (name == "viscosity") return 8; return -1; } @@ -167,7 +171,7 @@ void AtomVecRHEOThermal::pack_property_atom(int index, double *buf, int nvalues, } else if (index == 4) { for (int i = 0; i < nlocal; i++) { if (mask[i] & groupbit) - buf[n] = heatflow[i]; + buf[n] = esph[i]; else buf[n] = 0.0; n += nvalues; @@ -175,7 +179,7 @@ void AtomVecRHEOThermal::pack_property_atom(int index, double *buf, int nvalues, } else if (index == 5) { for (int i = 0; i < nlocal; i++) { if (mask[i] & groupbit) - buf[n] = conductivity[i]; + buf[n] = heatflow[i]; else buf[n] = 0.0; n += nvalues; @@ -183,12 +187,20 @@ void AtomVecRHEOThermal::pack_property_atom(int index, double *buf, int nvalues, } else if (index == 6) { for (int i = 0; i < nlocal; i++) { if (mask[i] & groupbit) - buf[n] = pressure[i]; + buf[n] = conductivity[i]; else buf[n] = 0.0; n += nvalues; } } else if (index == 7) { + for (int i = 0; i < nlocal; i++) { + if (mask[i] & groupbit) + buf[n] = pressure[i]; + else + buf[n] = 0.0; + n += nvalues; + } + } else if (index == 8) { for (int i = 0; i < nlocal; i++) { if (mask[i] & groupbit) buf[n] = viscosity[i]; diff --git a/src/RHEO/atom_vec_rheo_thermal.h b/src/RHEO/atom_vec_rheo_thermal.h index 27c6c3c9b5..ad467f9de7 100644 --- a/src/RHEO/atom_vec_rheo_thermal.h +++ b/src/RHEO/atom_vec_rheo_thermal.h @@ -36,7 +36,7 @@ class AtomVecRHEOThermal : virtual public AtomVec { private: int *status; - double *conductivity, *temperature, *heatflow; + double *conductivity, *temperature, *heatflow, *esph; double *pressure, *rho, *drho, *viscosity; }; diff --git a/src/RHEO/compute_rheo_grad.cpp b/src/RHEO/compute_rheo_grad.cpp index b2ca0c9dc4..acfc01d793 100644 --- a/src/RHEO/compute_rheo_grad.cpp +++ b/src/RHEO/compute_rheo_grad.cpp @@ -42,16 +42,16 @@ enum{COMMGRAD, COMMFIELD}; ComputeRHEOGrad::ComputeRHEOGrad(LAMMPS *lmp, int narg, char **arg) : Compute(lmp, narg, arg), fix_rheo(nullptr), list(nullptr), rho0(nullptr), compute_interface(nullptr), compute_kernel(nullptr), - gradv(nullptr), gradr(nullptr), gradt(nullptr), gradn(nullptr) + gradv(nullptr), gradr(nullptr), grade(nullptr), gradn(nullptr) { if (narg < 4) error->all(FLERR,"Illegal compute rheo/grad command"); - velocity_flag = temperature_flag = rho_flag = eta_flag = 0; + velocity_flag = energy_flag = rho_flag = eta_flag = 0; for (int iarg = 3; iarg < narg; iarg++) { - if (strcmp(arg[iarg],"velocity") == 0) velocity_flag = 1; - else if (strcmp(arg[iarg],"rho") == 0) rho_flag = 1; - else if (strcmp(arg[iarg],"temperature") == 0) temperature_flag = 1; - else if (strcmp(arg[iarg],"viscosity") == 0) eta_flag = 1; + if (strcmp(arg[iarg], "velocity") == 0) velocity_flag = 1; + else if (strcmp(arg[iarg], "rho") == 0) rho_flag = 1; + else if (strcmp(arg[iarg], "energy") == 0) energy_flag = 1; + else if (strcmp(arg[iarg], "viscosity") == 0) eta_flag = 1; else error->all(FLERR, "Illegal compute rheo/grad command, {}", arg[iarg]); } @@ -72,7 +72,7 @@ ComputeRHEOGrad::ComputeRHEOGrad(LAMMPS *lmp, int narg, char **arg) : comm_reverse += dim; } - if (temperature_flag) { + if (energy_flag) { ncomm_grad += dim; ncomm_field += 1; comm_reverse += dim; @@ -96,7 +96,7 @@ ComputeRHEOGrad::~ComputeRHEOGrad() { memory->destroy(gradv); memory->destroy(gradr); - memory->destroy(gradt); + memory->destroy(grade); memory->destroy(gradn); } @@ -130,7 +130,7 @@ void ComputeRHEOGrad::compute_peratom() int i, j, k, ii, jj, jnum, itype, jtype, a, b, fluidi, fluidj; double xtmp, ytmp, ztmp, delx, dely, delz; double rsq, imass, jmass; - double rhoi, rhoj, Voli, Volj, drho, dT, deta; + double rhoi, rhoj, Voli, Volj, drho, de, deta; double vi[3], vj[3], vij[3]; double wp, *dWij, *dWji; @@ -141,7 +141,7 @@ void ComputeRHEOGrad::compute_peratom() double **x = atom->x; double **v = atom->v; double *rho = atom->rho; - double *temperature = atom->temperature; + double *energy = atom->esph; double *viscosity = atom->viscosity; int *status = atom->status; int *type = atom->type; @@ -166,9 +166,9 @@ void ComputeRHEOGrad::compute_peratom() for (k = 0; k < dim; k++) gradr[i][k] = 0.0; } - if (temperature_flag) { + if (energy_flag) { for (k = 0; k < dim; k++) - gradt[i][k] = 0.0; + grade[i][k] = 0.0; } if (eta_flag) { for (k = 0; k < dim; k++) @@ -234,7 +234,7 @@ void ComputeRHEOGrad::compute_peratom() vij[2] = vi[2] - vj[2]; if (rho_flag) drho = rhoi - rhoj; - if (temperature_flag) dT = temperature[i] - temperature[j]; + if (energy_flag) de = energy[i] - energy[j]; if (eta_flag) deta = viscosity[i] - viscosity[j]; wp = compute_kernel->calc_dw(i, j, delx, dely, delz, sqrt(rsq)); @@ -250,8 +250,8 @@ void ComputeRHEOGrad::compute_peratom() if (rho_flag) // P,x P,y P,z gradr[i][a] -= drho * Volj * dWij[a]; - if (temperature_flag) // T,x T,y T,z - gradt[i][a] -= dT * Volj * dWij[a]; + if (energy_flag) // e,x e,y e,z + grade[i][a] -= de * Volj * dWij[a]; if (eta_flag) // n,x n,y n,z gradn[i][a] -= deta * Volj * dWij[a]; @@ -267,8 +267,8 @@ void ComputeRHEOGrad::compute_peratom() if (rho_flag) // P,x P,y P,z gradr[j][a] += drho * Voli * dWji[a]; - if (temperature_flag) // T,x T,y T,z - gradt[j][a] += dT * Voli * dWji[a]; + if (energy_flag) // e,x e,y e,z + grade[j][a] += de * Voli * dWji[a]; if (eta_flag) // n,x n,y n,z gradn[j][a] += deta * Voli * dWji[a]; @@ -308,7 +308,7 @@ int ComputeRHEOGrad::pack_forward_comm(int n, int *list, double *buf, int i,j,k,m; int *mask = atom->mask; double *rho = atom->rho; - double *temperature = atom->temperature; + double *energy = atom->esph; double **v = atom->v; int dim = domain->dimension; double *h_rate = domain->h_rate; @@ -335,9 +335,9 @@ int ComputeRHEOGrad::pack_forward_comm(int n, int *list, double *buf, for (k = 0; k < dim; k++) buf[m++] = gradr[j][k]; - if (temperature_flag) + if (energy_flag) for (k = 0; k < dim; k++) - buf[m++] = gradt[j][k]; + buf[m++] = grade[j][k]; if (eta_flag) for (k = 0; k < dim; k++) @@ -358,8 +358,8 @@ int ComputeRHEOGrad::pack_forward_comm(int n, int *list, double *buf, if (rho_flag) buf[m++] = rho[j]; - if (temperature_flag) - buf[m++] = temperature[j]; + if (energy_flag) + buf[m++] = energy[j]; } } return m; @@ -371,8 +371,7 @@ void ComputeRHEOGrad::unpack_forward_comm(int n, int first, double *buf) { int i, k, m, last; double *rho = atom->rho; - double *temperature = atom->temperature; - double **v = atom->v; + double *energy = atom->esph; double **v = atom->v; int dim = domain->dimension; m = 0; @@ -387,9 +386,9 @@ void ComputeRHEOGrad::unpack_forward_comm(int n, int first, double *buf) for (k = 0; k < dim; k++) gradr[i][k] = buf[m++]; - if (temperature_flag) + if (energy_flag) for (k = 0; k < dim; k++) - gradt[i][k] = buf[m++]; + grade[i][k] = buf[m++]; if (eta_flag) for (k = 0; k < dim; k++) @@ -403,8 +402,8 @@ void ComputeRHEOGrad::unpack_forward_comm(int n, int first, double *buf) if (rho_flag) rho[i] = buf[m++]; - if (temperature_flag) - temperature[i] = buf[m++]; + if (energy_flag) + energy[i] = buf[m++]; } } } @@ -427,9 +426,9 @@ int ComputeRHEOGrad::pack_reverse_comm(int n, int first, double *buf) for (k = 0; k < dim; k++) buf[m++] = gradr[i][k]; - if (temperature_flag) + if (energy_flag) for (k = 0; k < dim; k++) - buf[m++] = gradt[i][k]; + buf[m++] = grade[i][k]; if (eta_flag) for (k = 0; k < dim; k++) @@ -456,9 +455,9 @@ void ComputeRHEOGrad::unpack_reverse_comm(int n, int *list, double *buf) for (k = 0; k < dim; k++) gradr[j][k] += buf[m++]; - if (temperature_flag) + if (energy_flag) for (k = 0; k < dim; k++) - gradt[j][k] += buf[m++]; + grade[j][k] += buf[m++]; if (eta_flag) for (k = 0; k < dim; k++) @@ -477,8 +476,8 @@ void ComputeRHEOGrad::grow_arrays(int nmax) if (rho_flag) memory->grow(gradr, nmax, dim, "rheo:grad_rho"); - if (temperature_flag) - memory->grow(gradt, nmax, dim, "rheo:grad_temp"); + if (energy_flag) + memory->grow(grade, nmax, dim, "rheo:grad_energy"); if (eta_flag) memory->grow(gradn, nmax, dim, "rheo:grad_eta"); @@ -498,7 +497,7 @@ double ComputeRHEOGrad::memory_usage() if (rho_flag) bytes = (size_t) nmax_store * dim * sizeof(double); - if (temperature_flag) + if (energy_flag) bytes = (size_t) nmax_store * dim * sizeof(double); if (eta_flag) diff --git a/src/RHEO/compute_rheo_grad.h b/src/RHEO/compute_rheo_grad.h index 489f3c641d..2d663a5b07 100644 --- a/src/RHEO/compute_rheo_grad.h +++ b/src/RHEO/compute_rheo_grad.h @@ -40,7 +40,7 @@ class ComputeRHEOGrad : public Compute { void forward_fields(); double **gradv; double **gradr; - double **gradt; + double **grade; double **gradn; class FixRHEO *fix_rheo; @@ -48,7 +48,7 @@ class ComputeRHEOGrad : public Compute { int comm_stage, ncomm_grad, ncomm_field, nmax_store; double cut, cutsq, *rho0; - int velocity_flag, temperature_flag, rho_flag, eta_flag; + int velocity_flag, energy_flag, rho_flag, eta_flag; int interface_flag, remap_v_flag; class ComputeRHEOKernel *compute_kernel; diff --git a/src/RHEO/compute_rheo_kernel.cpp b/src/RHEO/compute_rheo_kernel.cpp index 52380a4337..6f58d79243 100644 --- a/src/RHEO/compute_rheo_kernel.cpp +++ b/src/RHEO/compute_rheo_kernel.cpp @@ -86,6 +86,8 @@ ComputeRHEOKernel::ComputeRHEOKernel(LAMMPS *lmp, int narg, char **arg) : } comm_forward_save = comm_forward; + corrections_calculated = 0; + gsl_error_flag = 0; } /* ---------------------------------------------------------------------- */ @@ -152,6 +154,10 @@ int ComputeRHEOKernel::check_corrections(int i) if (coordination[i] < zmin) return 0; + // Skip if corrections not yet calculated + if (!corrections_calculated) + return 0; + return 1; } @@ -479,6 +485,7 @@ void ComputeRHEOKernel::compute_peratom() gsl_error_tags.clear(); if (kernel_style == QUINTIC) return; + corrections_calculated = 1; int i, j, ii, jj, inum, jnum, itype, g, a, b, gsl_error; double xtmp, ytmp, ztmp, r, rsq, w, vj, rhoj; @@ -530,11 +537,11 @@ void ComputeRHEOKernel::compute_peratom() if (rsq < hsq) { r = sqrt(rsq); - w = calc_w_quintic(i,j,dx[0],dx[1],dx[2],r); + w = calc_w_quintic(i, j, dx[0], dx[1], dx[2], r); rhoj = rho[j]; if (interface_flag) if (status[j] & PHASECHECK) - rhoj = compute_interface->correct_rho(j,i); + rhoj = compute_interface->correct_rho(j, i); vj = mass[type[j]] / rhoj; M += w * vj; @@ -578,12 +585,12 @@ void ComputeRHEOKernel::compute_peratom() if (rsq < hsq) { r = sqrt(rsq); - w = calc_w_quintic(i,j,dx[0],dx[1],dx[2],r); + w = calc_w_quintic(i, j, dx[0], dx[1], dx[2], r); rhoj = rho[j]; if (interface_flag) if (status[j] & PHASECHECK) - rhoj = compute_interface->correct_rho(j,i); + rhoj = compute_interface->correct_rho(j, i); vj = mass[type[j]] / rhoj; diff --git a/src/RHEO/compute_rheo_kernel.h b/src/RHEO/compute_rheo_kernel.h index 2c9f4768e1..ed190c19ce 100644 --- a/src/RHEO/compute_rheo_kernel.h +++ b/src/RHEO/compute_rheo_kernel.h @@ -53,6 +53,7 @@ class ComputeRHEOKernel : public Compute { int gsl_error_flag; std::unordered_set gsl_error_tags; + int corrections_calculated; int kernel_style, zmin, dim, Mdim, ncor; int nmax_store; double h, hsq, hinv, hsqinv, pre_w, pre_wp; diff --git a/src/RHEO/compute_rheo_property_atom.cpp b/src/RHEO/compute_rheo_property_atom.cpp index e450eaaf0b..380ff398d8 100644 --- a/src/RHEO/compute_rheo_property_atom.cpp +++ b/src/RHEO/compute_rheo_property_atom.cpp @@ -104,6 +104,14 @@ ComputeRHEOPropertyAtom::ComputeRHEOPropertyAtom(LAMMPS *lmp, int narg, char **a } else if (utils::strmatch(arg[iarg], "^grad/v")) { pack_choice[i] = &ComputeRHEOPropertyAtom::pack_gradv; col_index[i] = get_tensor_index(arg[iarg]); + } else if (strcmp(arg[iarg], "energy") == 0) { + avec_index[i] = atom->avec->property_atom("esph"); + if (avec_index[i] < 0) + error->all(FLERR, + "Invalid keyword {} for atom style {} in compute rheo/property/atom command ", + arg[iarg], atom->get_style()); + pack_choice[i] = &ComputeRHEOPropertyAtom::pack_atom_style; + thermal_flag = 1; } else { avec_index[i] = atom->avec->property_atom(arg[iarg]); if (avec_index[i] < 0) diff --git a/src/RHEO/compute_rheo_vshift.cpp b/src/RHEO/compute_rheo_vshift.cpp index 1f9314e99b..569c8569f7 100644 --- a/src/RHEO/compute_rheo_vshift.cpp +++ b/src/RHEO/compute_rheo_vshift.cpp @@ -32,6 +32,8 @@ #include "neigh_list.h" #include "neigh_request.h" +#include "update.h" + using namespace LAMMPS_NS; using namespace RHEO_NS; @@ -195,6 +197,7 @@ void ComputeRHEOVShift::compute_peratom() if (mask[i] & groupbit) { vmag = sqrt(vi[0] * vi[0] + vi[1] * vi[1] + vi[2] * vi[2]); prefactor = vmag * volj * dr; + vshift[i][0] += prefactor * dx[0]; vshift[i][1] += prefactor * dx[1]; vshift[i][2] += prefactor * dx[2]; @@ -204,6 +207,7 @@ void ComputeRHEOVShift::compute_peratom() if (mask[j] & groupbit) { vmag = sqrt(vj[0] * vj[0] + vj[1] * vj[1] + vj[2] * vj[2]); prefactor = vmag * voli * dr; + vshift[j][0] -= prefactor * dx[0]; vshift[j][1] -= prefactor * dx[1]; vshift[j][2] -= prefactor * dx[2]; diff --git a/src/RHEO/fix_rheo.cpp b/src/RHEO/fix_rheo.cpp index 0c74b2bad1..beba940174 100644 --- a/src/RHEO/fix_rheo.cpp +++ b/src/RHEO/fix_rheo.cpp @@ -164,7 +164,7 @@ void FixRHEO::post_constructor() compute_kernel->fix_rheo = this; std::string cmd = "rheo_grad all RHEO/GRAD velocity rho viscosity"; - if (thermal_flag) cmd += " temperature"; + if (thermal_flag) cmd += " energy"; compute_grad = dynamic_cast(modify->add_compute(cmd)); compute_grad->fix_rheo = this; @@ -401,6 +401,7 @@ void FixRHEO::pre_force(int /*vflag*/) compute_rhosum->compute_peratom(); compute_kernel->compute_peratom(); + if (interface_flag) { // Note on first setup, have no forces for pressure to reference compute_interface->compute_peratom(); diff --git a/src/RHEO/fix_rheo_thermal.cpp b/src/RHEO/fix_rheo_thermal.cpp index e6c598418b..7b61b9821e 100644 --- a/src/RHEO/fix_rheo_thermal.cpp +++ b/src/RHEO/fix_rheo_thermal.cpp @@ -47,7 +47,8 @@ enum {NONE, CONSTANT}; FixRHEOThermal::FixRHEOThermal(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg), fix_rheo(nullptr), compute_grad(nullptr), compute_vshift(nullptr), - Tc(nullptr), kappa(nullptr), cv(nullptr), Tc_style(nullptr), kappa_style(nullptr), cv_style(nullptr), + Tc(nullptr), kappa(nullptr), cv(nullptr), L(nullptr), + Tc_style(nullptr), kappa_style(nullptr), cv_style(nullptr), L_style(nullptr), fix_update_special_bonds(nullptr) { if (narg < 4) error->all(FLERR,"Illegal fix command"); @@ -62,13 +63,22 @@ FixRHEOThermal::FixRHEOThermal(LAMMPS *lmp, int narg, char **arg) : int i, nlo, nhi; int n = atom->ntypes; + memory->create(Tc_style, n + 1, "rheo:Tc_style"); memory->create(kappa_style, n + 1, "rheo:kappa_style"); memory->create(cv_style, n + 1, "rheo:cv_style"); + memory->create(L_style, n + 1, "rheo:L_style"); + + memory->create(Tc, n + 1, "rheo:Tc"); + memory->create(kappa, n + 1, "rheo:kappa"); + memory->create(cv, n + 1, "rheo:cv"); + memory->create(L, n + 1, "rheo:L"); + for (i = 1; i <= n; i++) { Tc_style[i] = NONE; kappa_style[i] = NONE; cv_style[i] = NONE; + L_style[i] = NONE; } int iarg = 3; @@ -81,9 +91,9 @@ FixRHEOThermal::FixRHEOThermal(LAMMPS *lmp, int narg, char **arg) : if (strcmp(arg[iarg + 2], "constant") == 0) { if (iarg + 3 >= narg) utils::missing_cmd_args(FLERR, "fix rheo/thermal conductivity constant", error); - double kappa_one = utils::numeric(FLERR, arg[iarg + 2], false, lmp); + double kappa_one = utils::numeric(FLERR, arg[iarg + 3], false, lmp); if (kappa_one < 0.0) error->all(FLERR, "The conductivity must be positive"); - iarg += 1; + iarg += 2; for (i = nlo; i <= nhi; i++) { kappa_style[i] = CONSTANT; @@ -102,9 +112,9 @@ FixRHEOThermal::FixRHEOThermal(LAMMPS *lmp, int narg, char **arg) : if (strcmp(arg[iarg + 2], "constant") == 0) { if (iarg + 3 >= narg) utils::missing_cmd_args(FLERR, "fix rheo/thermal specific/heat constant", error); - double cv_one = utils::numeric(FLERR, arg[iarg + 2], false, lmp); + double cv_one = utils::numeric(FLERR, arg[iarg + 3], false, lmp); if (cv_one < 0.0) error->all(FLERR, "The specific heat must be positive"); - iarg += 1; + iarg += 2; for (i = nlo; i <= nhi; i++) { cv_style[i] = CONSTANT; @@ -124,8 +134,8 @@ FixRHEOThermal::FixRHEOThermal(LAMMPS *lmp, int narg, char **arg) : if (strcmp(arg[iarg + 2], "constant") == 0) { if (iarg + 3 >= narg) utils::missing_cmd_args(FLERR, "fix rheo/thermal Tfreeze constant", error); - double Tc_one = utils::numeric(FLERR, arg[iarg + 2], false, lmp); - iarg += 1; + double Tc_one = utils::numeric(FLERR, arg[iarg + 3], false, lmp); + iarg += 2; for (i = nlo; i <= nhi; i++) { Tc_style[i] = CONSTANT; @@ -136,6 +146,28 @@ FixRHEOThermal::FixRHEOThermal(LAMMPS *lmp, int narg, char **arg) : error->all(FLERR, "Illegal fix command, {}", arg[iarg + 2]); } + iarg += 2; + } else if (strcmp(arg[iarg], "latent/heat") == 0) { + if (iarg + 2 >= narg) utils::missing_cmd_args(FLERR, "fix rheo/thermal latent/heat", error); + utils::bounds(FLERR, arg[iarg + 1], 1, n, nlo, nhi, error); + + // Cv arguments + if (strcmp(arg[iarg + 2], "constant") == 0) { + if (iarg + 3 >= narg) utils::missing_cmd_args(FLERR, "fix rheo/thermal latent/heat constant", error); + + double L_one = utils::numeric(FLERR, arg[iarg + 3], false, lmp); + if (L_one < 0.0) error->all(FLERR, "The latent heat must be positive"); + iarg += 2; + + for (i = nlo; i <= nhi; i++) { + L_style[i] = CONSTANT; + L[i] = L_one; + } + + } else { + error->all(FLERR,"Illegal fix command, {}", arg[iarg + 2]); + } + iarg += 2; } else if (strcmp(arg[iarg], "react") == 0) { if (iarg + 2 >= narg) utils::missing_cmd_args(FLERR, "fix rheo/thermal react", error); @@ -155,9 +187,11 @@ FixRHEOThermal::FixRHEOThermal(LAMMPS *lmp, int narg, char **arg) : for (i = 1; i <= n; i++) { if (cv_style[i] == NONE) - error->all(FLERR,"Must specify specific/heat for atom type {} in fix/rheo/thermal", i); + error->all(FLERR, "Must specify specific/heat for atom type {} in fix/rheo/thermal", i); if (kappa_style[i] == NONE) - error->all(FLERR,"Must specify conductivity for atom type {} in fix/rheo/thermal", i); + error->all(FLERR, "Must specify conductivity for atom type {} in fix/rheo/thermal", i); + if (Tc_style[i] == NONE && L_style[i] != NONE) + error->all(FLERR, "Must specify critical temperature for atom type {} to use latent heat in fix rheo/thermal", i); } } @@ -173,9 +207,11 @@ FixRHEOThermal::~FixRHEOThermal() memory->destroy(cv_style); memory->destroy(Tc_style); memory->destroy(kappa_style); + memory->destroy(L_style); memory->destroy(cv); memory->destroy(Tc); memory->destroy(kappa); + memory->destroy(L); } /* ---------------------------------------------------------------------- */ @@ -210,6 +246,8 @@ void FixRHEOThermal::init() dtf = 0.5 * update->dt * force->ftm2v; + if (atom->esph_flag != 1) + error->all(FLERR,"fix rheo/thermal command requires atom property esph"); if (atom->temperature_flag != 1) error->all(FLERR,"fix rheo/thermal command requires atom property temperature"); if (atom->heatflow_flag != 1) @@ -267,9 +305,9 @@ void FixRHEOThermal::initial_integrate(int /*vflag*/) int i, a; int *status = atom->status; - double *temperature = atom->temperature; - double **gradt = compute_grad->gradt; - double **vshift = compute_vshift->array_atom; + double *energy = atom->esph; + double **grade = compute_grad->grade; + double **vshift = compute_vshift->vshift; int nlocal = atom->nlocal; int dim = domain->dimension; @@ -279,9 +317,8 @@ void FixRHEOThermal::initial_integrate(int /*vflag*/) for (i = 0; i < nlocal; i++) { if (status[i] & STATUS_NO_SHIFT) continue; - for (a = 0; a < dim; a++) - temperature[i] += dtv * vshift[i][a] * gradt[i][a]; + energy[i] += dtv * vshift[i][a] * grade[i][a]; } } @@ -290,29 +327,34 @@ void FixRHEOThermal::initial_integrate(int /*vflag*/) void FixRHEOThermal::post_integrate() { int i, itype; - double cvi, Tci, Ti; + double cvi, Tci, Ti, Li; int *status = atom->status; + double *energy = atom->esph; double *temperature = atom->temperature; double *heatflow = atom->heatflow; - double *rho = atom->rho; int *type = atom->type; int n_melt = 0; int n_freeze = 0; - //Integrate temperature and check status + //Integrate energy and check status for (i = 0; i < atom->nlocal; i++) { if (status[i] & STATUS_NO_INTEGRATION) continue; itype = type[i]; - cvi = calc_cv(i, type[i]); - temperature[i] += dtf * heatflow[i] / cvi; + cvi = calc_cv(i, itype); + energy[i] += dtf * heatflow[i]; + temperature[i] = energy[i] / cvi; if (Tc_style[itype] != NONE) { Ti = temperature[i]; - if (Tc_style[itype] == CONSTANT) { - Tci = Tc[itype]; + Tci = calc_Tc(i, itype); + + if (L_style[itype] != NONE) { + Li = calc_L(i, itype); + if (Ti > Tci) Ti = MAX(Tci, (energy[i] - Li) / cvi); + temperature[i] = Ti; } if (Ti > Tci) { @@ -370,11 +412,39 @@ void FixRHEOThermal::post_neighbor() } /* ---------------------------------------------------------------------- + Calculate temperature In the future, update & forward evolving conductivity styles every timestep ------------------------------------------------------------------------- */ void FixRHEOThermal::pre_force(int /*vflag*/) { + int i, itype; + double cvi, Tci, Ti, Li; + + double *energy = atom->esph; + double *temperature = atom->temperature; + int *type = atom->type; + + int nlocal = atom->nlocal; + int nall = nlocal + atom->nghost; + + // Calculate temperature + for (i = 0; i < nall; i++) { + itype = type[i]; + cvi = calc_cv(i, itype); + temperature[i] = energy[i] / cvi; + + if (Tc_style[itype] != NONE) { + Ti = temperature[i]; + Tci = calc_Tc(i, itype); + + if (L_style[itype] != NONE) { + Li = calc_L(i, itype); + if (Ti > Tci) Ti = MAX(Tci, (energy[i] - Li) / cvi); + temperature[i] = Ti; + } + } + } } /* ---------------------------------------------------------------------- */ @@ -382,17 +452,13 @@ void FixRHEOThermal::pre_force(int /*vflag*/) void FixRHEOThermal::final_integrate() { int *status = atom->status; - int *type = atom->type; - double *temperature = atom->temperature; + double *energy = atom->esph; double *heatflow = atom->heatflow; - double cvi; - //Integrate temperature and check status + //Integrate energy for (int i = 0; i < atom->nlocal; i++) { if (status[i] & STATUS_NO_INTEGRATION) continue; - - cvi = calc_cv(i, type[i]); - temperature[i] += dtf * heatflow[i] / cvi; + energy[i] += dtf * heatflow[i]; } } @@ -535,6 +601,23 @@ double FixRHEOThermal::calc_cv(int i, int itype) } } +/* ---------------------------------------------------------------------- */ + +double FixRHEOThermal::calc_Tc(int i, int itype) +{ + if (Tc_style[itype] == CONSTANT) { + return Tc[itype]; + } +} + +/* ---------------------------------------------------------------------- */ + +double FixRHEOThermal::calc_L(int i, int itype) +{ + if (L_style[itype] == CONSTANT) { + return L[itype]; + } +} /* ---------------------------------------------------------------------- */ diff --git a/src/RHEO/fix_rheo_thermal.h b/src/RHEO/fix_rheo_thermal.h index dc412d20b9..c4c26eef6a 100644 --- a/src/RHEO/fix_rheo_thermal.h +++ b/src/RHEO/fix_rheo_thermal.h @@ -43,12 +43,14 @@ class FixRHEOThermal : public Fix { void unpack_forward_comm(int, int, double *) override; void reset_dt() override; double calc_cv(int, int); + double calc_Tc(int, int); + double calc_L(int, int); private: - double *cv, *Tc, *kappa; + double *cv, *Tc, *kappa, *L; double dtf, dtv; double cut_kernel, cut_bond, cutsq_bond; - int *cv_style, *Tc_style, *kappa_style; + int *cv_style, *Tc_style, *kappa_style, *L_style; int btype; class NeighList *list; diff --git a/src/RHEO/pair_rheo.cpp b/src/RHEO/pair_rheo.cpp index 4ef0066e93..b07e914af1 100644 --- a/src/RHEO/pair_rheo.cpp +++ b/src/RHEO/pair_rheo.cpp @@ -96,7 +96,6 @@ void PairRHEO::compute(int eflag, int vflag) ev_init(eflag, vflag); double **gradv = compute_grad->gradv; - double **gradt = compute_grad->gradt; double **gradr = compute_grad->gradr; double **v = atom->v; double **x = atom->x; diff --git a/src/RHEO/pair_rheo_solid.cpp b/src/RHEO/pair_rheo_solid.cpp new file mode 100644 index 0000000000..1068e9b329 --- /dev/null +++ b/src/RHEO/pair_rheo_solid.cpp @@ -0,0 +1,351 @@ +/* ---------------------------------------------------------------------- + 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 "pair_rheo_solid.h" + +#include "atom.h" +#include "comm.h" +#include "error.h" +#include "fix_rheo.h" +#include "force.h" +#include "memory.h" +#include "neigh_list.h" +#include "neighbor.h" + +#include + +using namespace LAMMPS_NS; +using namespace RHEO_NS; + +/* ---------------------------------------------------------------------- */ + +PairRHEOSolid::PairRHEOSolid(LAMMPS *_lmp) : Pair(_lmp) +{ + writedata = 1; +} + +/* ---------------------------------------------------------------------- */ + +PairRHEOSolid::~PairRHEOSolid() +{ + if (allocated) { + memory->destroy(setflag); + memory->destroy(cutsq); + + memory->destroy(k); + memory->destroy(cut); + memory->destroy(gamma); + } +} + +/* ---------------------------------------------------------------------- */ + +void PairRHEOSolid::compute(int eflag, int vflag) +{ + int i, j, ii, jj, inum, jnum, itype, jtype; + double xtmp, ytmp, ztmp, delx, dely, delz, evdwl, fpair; + double r, rsq, rinv, factor_lj; + int *ilist, *jlist, *numneigh, **firstneigh; + double vxtmp, vytmp, vztmp, delvx, delvy, delvz, dot, smooth; + + evdwl = 0.0; + if (eflag || vflag) + ev_setup(eflag, vflag); + else + evflag = vflag_fdotr = 0; + + double **x = atom->x; + double **v = atom->v; + double **f = atom->f; + int *type = atom->type; + int *status = atom->status; + int nlocal = atom->nlocal; + int newton_pair = force->newton_pair; + double *special_lj = force->special_lj; + + inum = list->inum; + ilist = list->ilist; + numneigh = list->numneigh; + firstneigh = list->firstneigh; + + // loop over neighbors of my atoms + + for (ii = 0; ii < inum; ii++) { + i = ilist[ii]; + if (!(status[i] & STATUS_SOLID)) continue; + + xtmp = x[i][0]; + ytmp = x[i][1]; + ztmp = x[i][2]; + vxtmp = v[i][0]; + vytmp = v[i][1]; + vztmp = v[i][2]; + itype = type[i]; + jlist = firstneigh[i]; + jnum = numneigh[i]; + + for (jj = 0; jj < jnum; jj++) { + j = jlist[jj]; + if (!(status[j] & STATUS_SOLID)) continue; + + factor_lj = special_lj[sbmask(j)]; + + if (factor_lj == 0) continue; + + j &= NEIGHMASK; + + delx = xtmp - x[j][0]; + dely = ytmp - x[j][1]; + delz = ztmp - x[j][2]; + rsq = delx * delx + dely * dely + delz * delz; + jtype = type[j]; + + if (rsq < cutsq[itype][jtype]) { + r = sqrt(rsq); + + rinv = 1.0 / r; + fpair = k[itype][jtype] * (cut[itype][jtype] - r); + + smooth = rsq / cutsq[itype][jtype]; + smooth *= smooth; + smooth *= smooth; + smooth = 1.0 - smooth; + delvx = vxtmp - v[j][0]; + delvy = vytmp - v[j][1]; + delvz = vztmp - v[j][2]; + dot = delx * delvx + dely * delvy + delz * delvz; + fpair -= gamma[itype][jtype] * dot * smooth * rinv; + + fpair *= factor_lj * rinv; + if (eflag) evdwl = 0.0; + + f[i][0] += delx * fpair; + f[i][1] += dely * fpair; + f[i][2] += delz * fpair; + + if (newton_pair || j < nlocal) { + f[j][0] -= delx * fpair; + f[j][1] -= dely * fpair; + f[j][2] -= delz * fpair; + } + + if (evflag) ev_tally(i, j, nlocal, newton_pair, evdwl, 0.0, fpair, delx, dely, delz); + } + } + } + + if (vflag_fdotr) virial_fdotr_compute(); +} + +/* ---------------------------------------------------------------------- + allocate all arrays +------------------------------------------------------------------------- */ + +void PairRHEOSolid::allocate() +{ + allocated = 1; + const int np1 = atom->ntypes + 1; + + memory->create(setflag, np1, np1, "pair:setflag"); + for (int i = 1; i < np1; i++) + for (int j = i; j < np1; j++) setflag[i][j] = 0; + + memory->create(cutsq, np1, np1, "pair:cutsq"); + + memory->create(k, np1, np1, "pair:k"); + memory->create(cut, np1, np1, "pair:cut"); + memory->create(gamma, np1, np1, "pair:gamma"); +} + +/* ---------------------------------------------------------------------- + global settings +------------------------------------------------------------------------- */ + +void PairRHEOSolid::settings(int narg, char ** /*arg*/) +{ + if (narg != 0) error->all(FLERR, "Illegal pair_style command"); +} + +/* ---------------------------------------------------------------------- + set coeffs for one or more type pairs +------------------------------------------------------------------------- */ + +void PairRHEOSolid::coeff(int narg, char **arg) +{ + if (narg != 5) error->all(FLERR, "Incorrect args for pair coefficients"); + if (!allocated) allocate(); + + int ilo, ihi, jlo, jhi; + utils::bounds(FLERR, arg[0], 1, atom->ntypes, ilo, ihi, error); + utils::bounds(FLERR, arg[1], 1, atom->ntypes, jlo, jhi, error); + + double k_one = utils::numeric(FLERR, arg[2], false, lmp); + double cut_one = utils::numeric(FLERR, arg[3], false, lmp); + double gamma_one = utils::numeric(FLERR, arg[4], false, lmp); + + if (cut_one <= 0.0) error->all(FLERR, "Incorrect args for pair coefficients"); + + int count = 0; + for (int i = ilo; i <= ihi; i++) { + for (int j = MAX(jlo, i); j <= jhi; j++) { + k[i][j] = k_one; + cut[i][j] = cut_one; + gamma[i][j] = gamma_one; + + setflag[i][j] = 1; + count++; + } + } + + if (count == 0) error->all(FLERR, "Incorrect args for pair coefficients"); +} + +/* ---------------------------------------------------------------------- + init specific to this pair style +------------------------------------------------------------------------- */ + +void PairRHEOSolid::init_style() +{ + if (comm->ghost_velocity == 0) + error->all(FLERR,"Pair rheo/solid requires ghost atoms store velocity"); + + if (!atom->status_flag) + error->all(FLERR,"Pair rheo/solid requires atom_style rheo"); + + neighbor->add_request(this); +} + + +/* ---------------------------------------------------------------------- + init for one type pair i,j and corresponding j,i +------------------------------------------------------------------------- */ + +double PairRHEOSolid::init_one(int i, int j) +{ + if (setflag[i][j] == 0) { + cut[i][j] = mix_distance(cut[i][i], cut[j][j]); + k[i][j] = mix_energy(k[i][i], k[j][j], cut[i][i], cut[j][j]); + gamma[i][j] = mix_energy(gamma[i][i], gamma[j][j], cut[i][i], cut[j][j]); + } + + cut[j][i] = cut[i][j]; + k[j][i] = k[i][j]; + gamma[j][i] = gamma[i][j]; + + return cut[i][j]; +} + +/* ---------------------------------------------------------------------- + proc 0 writes to restart file +------------------------------------------------------------------------- */ + +void PairRHEOSolid::write_restart(FILE *fp) +{ + write_restart_settings(fp); + + int i, j; + for (i = 1; i <= atom->ntypes; i++) + for (j = i; j <= atom->ntypes; j++) { + fwrite(&setflag[i][j], sizeof(int), 1, fp); + if (setflag[i][j]) { + fwrite(&k[i][j], sizeof(double), 1, fp); + fwrite(&cut[i][j], sizeof(double), 1, fp); + fwrite(&gamma[i][j], sizeof(double), 1, fp); + } + } +} + +/* ---------------------------------------------------------------------- + proc 0 reads from restart file, bcasts +------------------------------------------------------------------------- */ + +void PairRHEOSolid::read_restart(FILE *fp) +{ + read_restart_settings(fp); + allocate(); + + int i, j; + int me = comm->me; + for (i = 1; i <= atom->ntypes; i++) + for (j = i; j <= atom->ntypes; j++) { + if (me == 0) utils::sfread(FLERR, &setflag[i][j], sizeof(int), 1, fp, nullptr, error); + MPI_Bcast(&setflag[i][j], 1, MPI_INT, 0, world); + if (setflag[i][j]) { + if (me == 0) { + utils::sfread(FLERR, &k[i][j], sizeof(double), 1, fp, nullptr, error); + utils::sfread(FLERR, &cut[i][j], sizeof(double), 1, fp, nullptr, error); + utils::sfread(FLERR, &gamma[i][j], sizeof(double), 1, fp, nullptr, error); + } + MPI_Bcast(&k[i][j], 1, MPI_DOUBLE, 0, world); + MPI_Bcast(&cut[i][j], 1, MPI_DOUBLE, 0, world); + MPI_Bcast(&gamma[i][j], 1, MPI_DOUBLE, 0, world); + } + } +} + +/* ---------------------------------------------------------------------- + proc 0 writes to data file +------------------------------------------------------------------------- */ + +void PairRHEOSolid::write_data(FILE *fp) +{ + for (int i = 1; i <= atom->ntypes; i++) + fprintf(fp, "%d %g %g %g\n", i, k[i][i], cut[i][i], gamma[i][i]); +} + +/* ---------------------------------------------------------------------- + proc 0 writes all pairs to data file +------------------------------------------------------------------------- */ + +void PairRHEOSolid::write_data_all(FILE *fp) +{ + for (int i = 1; i <= atom->ntypes; i++) + for (int j = i; j <= atom->ntypes; j++) + fprintf(fp, "%d %d %g %g %g\n", i, j, k[i][j], cut[i][j], gamma[i][j]); +} + +/* ---------------------------------------------------------------------- */ + +double PairRHEOSolid::single(int i, int j, int itype, int jtype, double rsq, double /*factor_coul*/, + double factor_lj, double &fforce) +{ + double fpair, r, rinv; + double delx, dely, delz, delvx, delvy, delvz, dot, smooth; + + if (rsq > cutsq[itype][jtype]) return 0.0; + + double **x = atom->x; + double **v = atom->v; + + r = sqrt(rsq); + rinv = 1.0 / r; + + fpair = k[itype][jtype] * (cut[itype][jtype] - r); + + smooth = rsq / cutsq[itype][jtype]; + smooth *= smooth; + smooth = 1.0 - smooth; + delx = x[i][0] - x[j][0]; + dely = x[i][1] - x[j][1]; + delz = x[i][2] - x[j][2]; + delvx = v[i][0] - v[j][0]; + delvy = v[i][1] - v[j][1]; + delvz = v[i][2] - v[j][2]; + dot = delx * delvx + dely * delvy + delz * delvz; + fpair -= gamma[itype][jtype] * dot * rinv * smooth; + + fpair *= factor_lj; + fforce = fpair; + + return 0.0; +} diff --git a/src/RHEO/pair_rheo_solid.h b/src/RHEO/pair_rheo_solid.h new file mode 100644 index 0000000000..66c2ac4bf1 --- /dev/null +++ b/src/RHEO/pair_rheo_solid.h @@ -0,0 +1,51 @@ +/* -*- 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 PAIR_CLASS +// clang-format off +PairStyle(rheo/solid,PairRHEOSolid); +// clang-format on +#else + +#ifndef LMP_PAIR_RHEO_SOLID_H +#define LMP_PAIR_RHEO_SOLID_H + +#include "pair.h" + +namespace LAMMPS_NS { + +class PairRHEOSolid : public Pair { + public: + PairRHEOSolid(class LAMMPS *); + ~PairRHEOSolid() override; + void compute(int, int) override; + void settings(int, char **) override; + void coeff(int, char **) override; + void init_style() override; + double init_one(int, int) override; + void write_restart(FILE *) override; + void read_restart(FILE *) override; + void write_data(FILE *) override; + void write_data_all(FILE *) override; + double single(int, int, int, int, double, double, double, double &) override; + + protected: + double **k, **cut, **gamma; + + void allocate(); +}; + +} // namespace LAMMPS_NS + +#endif +#endif diff --git a/src/set.cpp b/src/set.cpp index 3e1058b048..e0d20f1dc7 100644 --- a/src/set.cpp +++ b/src/set.cpp @@ -901,7 +901,7 @@ void Set::set(int keyword) } else if (keyword == RHEO_STATUS) { - if (ivalue != 0 && ivalue !=2) + if (ivalue != 0 && ivalue != 2) error->one(FLERR,"Invalid value {} in set command for rheo/status", ivalue); atom->status[i] = ivalue; } From 3f677f798ad965e2a875f85f940ee23122e59c10 Mon Sep 17 00:00:00 2001 From: jtclemm Date: Fri, 22 Dec 2023 17:04:56 -0700 Subject: [PATCH 065/158] Fleshing out tension model --- src/RHEO/fix_rheo_tension.cpp | 322 ++++++++++++++++++++++++++-------- src/RHEO/fix_rheo_tension.h | 11 +- 2 files changed, 258 insertions(+), 75 deletions(-) diff --git a/src/RHEO/fix_rheo_tension.cpp b/src/RHEO/fix_rheo_tension.cpp index 8b79fcebd6..8d00c8b988 100644 --- a/src/RHEO/fix_rheo_tension.cpp +++ b/src/RHEO/fix_rheo_tension.cpp @@ -13,15 +13,21 @@ /* ---------------------------------------------------------------------- Contributing authors: - Joel Clemmer (SNL), Thomas O'Connor (CMU), Eric Palermo (CMU) + Joel Clemmer (SNL) ----------------------------------------------------------------------- */ +// Todo: +// add citations +// remove (or fix) pairwise forces on undercoordinated atoms +// add option for vacuum tension (Frustenau 2020?) + #include "fix_rheo_tension.h" #include "atom.h" #include "comm.h" #include "compute_rheo_kernel.h" #include "compute_rheo_interface.h" +#include "compute_rheo_vshift.h" #include "domain.h" #include "error.h" #include "fix_rheo.h" @@ -44,12 +50,14 @@ using namespace FixConst; /* ---------------------------------------------------------------------- */ FixRHEOTension::FixRHEOTension(LAMMPS *lmp, int narg, char **arg) : - Fix(lmp, narg, arg), compute_kernel(nullptr), compute_interface(nullptr), fix_rheo(nullptr) + Fix(lmp, narg, arg), compute_kernel(nullptr), compute_interface(nullptr), compute_vshift(nullptr), fix_rheo(nullptr), rho0(nullptr) { - if (narg != 6) error->all(FLERR,"Illegal fix command"); + if (narg != 8) error->all(FLERR,"Illegal fix command"); alpha = utils::numeric(FLERR, arg[3], false, lmp); - alpha = utils::numeric(FLERR, arg[4], false, lmp); + beta = utils::numeric(FLERR, arg[4], false, lmp); wmin = utils::numeric(FLERR, arg[5], false, lmp); + cmin = utils::numeric(FLERR, arg[6], false, lmp); + vshift_strength = utils::numeric(FLERR, arg[7], false, lmp); comm_forward = 3; comm_reverse = 3; @@ -60,6 +68,10 @@ FixRHEOTension::FixRHEOTension(LAMMPS *lmp, int narg, char **arg) : // For norm, create a local array since they are unlikely to be printed int tmp1, tmp2; + index_ct = atom->find_custom("c_rheo_tension", tmp1, tmp2); + if (index_ct == -1) index_ct = atom->add_custom("c_rheo_tension", 1, 0); + ct = atom->dvector[index_ct]; + index_cgradt = atom->find_custom("cgrad_rheo_tension", tmp1, tmp2); if (index_cgradt == -1) index_cgradt = atom->add_custom("cgrad_rheo_tension", 1, 3); cgradt = atom->darray[index_cgradt]; @@ -72,12 +84,15 @@ FixRHEOTension::FixRHEOTension(LAMMPS *lmp, int narg, char **arg) : if (index_divnt == -1) index_divnt = atom->add_custom("divn_rheo_tension", 1, 0); divnt = atom->dvector[index_divnt]; + index_wsame = atom->find_custom("wsame_rheo_tension", tmp1, tmp2); + if (index_wsame == -1) index_wsame = atom->add_custom("wsame_rheo_tension", 1, 0); + wsame = atom->dvector[index_wsame]; + index_ft = atom->find_custom("f_rheo_tension", tmp1, tmp2); if (index_ft == -1) index_ft = atom->add_custom("f_rheo_tension", 1, 3); ft = atom->darray[index_ft]; norm = nullptr; - wsame = nullptr; nmax_store = 0; } @@ -88,6 +103,9 @@ FixRHEOTension::~FixRHEOTension() // Remove custom property if it exists int tmp1, tmp2, index; + index = atom->find_custom("c_rheo_tension", tmp1, tmp2); + if (index != -1) atom->remove_custom(index, 1, 0); + index = atom->find_custom("cgrad_rheo_tension", tmp1, tmp2); if (index != -1) atom->remove_custom(index, 1, 3); @@ -97,11 +115,13 @@ FixRHEOTension::~FixRHEOTension() index = atom->find_custom("divn_rheo_tension", tmp1, tmp2); if (index != -1) atom->remove_custom(index, 1, 0); + index = atom->find_custom("wsame_rheo_tension", tmp1, tmp2); + if (index != -1) atom->remove_custom(index, 1, 0); + index = atom->find_custom("f_rheo_tension", tmp1, tmp2); if (index != -1) atom->remove_custom(index, 1, 3); memory->destroy(norm); - memory->destroy(wsame); } /* ---------------------------------------------------------------------- */ @@ -109,7 +129,7 @@ FixRHEOTension::~FixRHEOTension() int FixRHEOTension::setmask() { int mask = 0; - mask |= POST_FORCE; + mask |= PRE_FORCE; return mask; } @@ -123,7 +143,9 @@ void FixRHEOTension::init() compute_kernel = fix_rheo->compute_kernel; compute_interface = fix_rheo->compute_interface; + compute_vshift = fix_rheo->compute_vshift; interface_flag = fix_rheo->interface_flag; + shift_flag = fix_rheo->shift_flag; h = fix_rheo->h; rho0 = fix_rheo->rho0; @@ -144,19 +166,29 @@ void FixRHEOTension::init_list(int /*id*/, NeighList *ptr) void FixRHEOTension::setup(int vflag) { - // Grow and populate arrays - post_force(vflag); + // Grow and populate arrays for dump files + if (nmax_store <= atom->nmax) + grow_arrays(atom->nmax); + + size_t nbytes = nmax_store * sizeof(double); + memset(&ct[0], 0, nbytes); + memset(&norm[0], 0, nbytes); + memset(&wsame[0], 0, nbytes); + memset(&divnt[0], 0, nbytes); + memset(&cgradt[0][0], 0, 3 * nbytes); + memset(&ft[0][0], 0, 3 * nbytes); + memset(&nt[0][0], 0, 3 * nbytes); } /* ---------------------------------------------------------------------- Calculate and apply tension forces ------------------------------------------------------------------------- */ -void FixRHEOTension::post_force(int vflag) +void FixRHEOTension::pre_force(int vflag) { int i, j, a, ii, jj, inum, jnum, itype, jtype; int fluidi, fluidj; - double xtmp, ytmp, ztmp, w, wp, c; + double xtmp, ytmp, ztmp, w, wp, ctmp; double rhoi, rhoj, Voli, Volj; double *dWij, *dWji; double dx[3]; @@ -187,10 +219,73 @@ void FixRHEOTension::post_force(int vflag) grow_arrays(atom->nmax); size_t nbytes = nmax_store * sizeof(double); + memset(&ct[0], 0, nbytes); memset(&norm[0], 0, nbytes); memset(&wsame[0], 0, nbytes); memset(&divnt[0], 0, nbytes); memset(&cgradt[0][0], 0, 3 * nbytes); + memset(&ft[0][0], 0, 3 * nbytes); + + // Calculate color gradient + for (ii = 0; ii < inum; ii++) { + i = ilist[ii]; + xtmp = x[i][0]; + ytmp = x[i][1]; + ztmp = x[i][2]; + itype = type[i]; + fluidi = !(status[i] & PHASECHECK); + jlist = firstneigh[i]; + jnum = numneigh[i]; + imass = mass[itype]; + + for (jj = 0; jj < jnum; jj++) { + j = jlist[jj]; + j &= NEIGHMASK; + + dx[0] = xtmp - x[j][0]; + dx[1] = ytmp - x[j][1]; + dx[2] = ztmp - x[j][2]; + + rsq = lensq3(dx); + + if (rsq > hsq) continue; + + fluidj = !(status[j] & PHASECHECK); + jtype = type[j]; + r = sqrt(rsq); + + rhoi = rho[i]; + rhoj = rho[j]; + + // Add corrections for walls + if (interface_flag) { + if (fluidi && (!fluidj)) { + rhoj = compute_interface->correct_rho(j, i); + } else if ((!fluidi) && fluidj) { + rhoi = compute_interface->correct_rho(i, j); + } else if ((!fluidi) && (!fluidj)) { + rhoi = rho0[itype]; + rhoj = rho0[jtype]; + } + } + + Voli = mass[itype] / rhoi; + Volj = mass[jtype] / rhoj; + + w = compute_kernel->calc_w(i, j, dx[0], dx[1], dx[2], r); + + if (itype != jtype) ctmp = 1; + else ctmp = 0; + + ct[i] += ctmp * Volj * w; + if (newton || j < nlocal) + ct[j] += ctmp * Voli * w; + } + } + + comm_stage = 0; + comm_reverse = 1; + if (newton) comm->reverse_comm(this); // Calculate color gradient for (ii = 0; ii < inum; ii++) { @@ -218,7 +313,6 @@ void FixRHEOTension::post_force(int vflag) fluidj = !(status[j] & PHASECHECK); jtype = type[j]; r = sqrt(rsq); - rinv = 1 / r; rhoi = rho[i]; rhoj = rho[j]; @@ -230,45 +324,50 @@ void FixRHEOTension::post_force(int vflag) } else if ((!fluidi) && fluidj) { rhoi = compute_interface->correct_rho(i, j); } else if ((!fluidi) && (!fluidj)) { - rhoi = rho0; - rhoj = rho0; + rhoi = rho0[itype]; + rhoj = rho0[jtype]; } } Voli = mass[itype] / rhoi; Volj = mass[jtype] / rhoj; - wp = compute_kernel->calc_dw(i, j, dx[0], dx[1], dx[2],r); + wp = compute_kernel->calc_dw(i, j, dx[0], dx[1], dx[2], r); dWij = compute_kernel->dWij; dWji = compute_kernel->dWji; - c = 0; - if (itype != jtype) c += rhoi; - c /= (rhoi + rhoj); + //c = 0; + //if (itype != jtype) c += rhoi; + //c /= (rhoi + rhoj); - for (a = 0; a < 3; a++) { - cgradt[i][a] -= c * Volj * dWij[a]; + if (itype != jtype) ctmp = 1; + else ctmp = 0; + + for (a = 0; a < dim; a++) { + cgradt[i][a] -= ctmp * Volj * dWij[a]; if (newton || j < nlocal) - cgradt[j][a] -= c * Voli * dWji[a]; + cgradt[j][a] -= ctmp * Voli * dWji[a]; } } } - comm_stage = 0; + comm_stage = 1; comm_reverse = 3; if (newton) comm->reverse_comm(this); // Calculate normal direction double minv; for (i = 0; i < nlocal; i++) { - minv = sqrt(cgradt[i][0] * cgradt[i][0] + cgradt[i][1] * cgradt[i][1] + cgradt[i][2] * cgradt[i][2]); - + minv = cgradt[i][0] * cgradt[i][0] + cgradt[i][1] * cgradt[i][1]; + if (dim == 3) minv += cgradt[i][2] * cgradt[i][2]; + minv = sqrt(minv); if (minv != 0) minv = 1 / minv; - for (a = 0; a < 3; a++) + for (a = 0; a < dim; a++) nt[i][a] = cgradt[i][a] * minv; } + comm_forward = 3; comm->forward_comm(this); // Calculate divergence @@ -309,33 +408,33 @@ void FixRHEOTension::post_force(int vflag) } else if ((!fluidi) && fluidj) { rhoi = compute_interface->correct_rho(i, j); } else if ((!fluidi) && (!fluidj)) { - rhoi = rho0; - rhoj = rho0; + rhoi = rho0[itype]; + rhoj = rho0[jtype]; } } Voli = mass[itype] / rhoi; Volj = mass[jtype] / rhoj; - w = compute_kernel->calc_w(i, j, dx[0], dx[1], dx[2],r); - wp = compute_kernel->calc_dw(i, j, dx[0], dx[1], dx[2],r); + w = compute_kernel->calc_w(i, j, dx[0], dx[1], dx[2], r); + wp = compute_kernel->calc_dw(i, j, dx[0], dx[1], dx[2], r); dWij = compute_kernel->dWij; dWji = compute_kernel->dWji; - for (a = 0; a < 3; a++) { - if (itype != jtype) - divnt[i] -= (nt[i][a]+nt[j][a]) * Volj * dWij[a]; - else { - divnt[i] -= (nt[i][a]-nt[j][a]) * Volj * dWij[a]; - wsame[i] += w; + for (a = 0; a < dim; a++) { + if (itype != jtype) { + divnt[i] -= (nt[i][a] + nt[j][a]) * Volj * dWij[a]; + } else { + divnt[i] -= (nt[i][a] - nt[j][a]) * Volj * dWij[a]; + wsame[i] += w * r; } norm[i] -= dx[a] * Volj * dWij[a]; if (newton || j < nlocal) { - if (itype != jtype) - divnt[j] -= (nt[j][a]+nt[i][a]) * Voli * dWji[a]; - else { - divnt[j] -= (nt[j][a]-nt[i][a]) * Voli * dWji[a]; - wsame[j] += w; + if (itype != jtype) { + divnt[j] -= (nt[j][a] + nt[i][a]) * Voli * dWji[a]; + } else { + divnt[j] -= (nt[j][a] - nt[i][a]) * Voli * dWji[a]; + wsame[j] += w * r; } norm[j] += dx[a] * Voli * dWji[a]; } @@ -343,21 +442,32 @@ void FixRHEOTension::post_force(int vflag) } } - comm_stage = 1; + comm_stage = 2; comm_reverse = 3; if (newton) comm->reverse_comm(this); + comm_forward = 1; + comm->forward_comm(this); + // Skip forces if it's setup if (update->setupflag) return; - // apply force - double weight, prefactor, unwrap[3], v[6]; - double wmin_inv = 1.0 / wmin; + // apply force, remove normal vshift + + double **vshift; + if (shift_flag) + vshift = compute_vshift->vshift; + double nx, ny, nz, vx, vy, vz, dot; + double wmin_inv, weight, prefactor, unwrap[3], v[6]; + + if (wmin > 0) wmin_inv = 1.0 / wmin; + else wmin_inv = 0.0; + for (i = 0; i < nlocal; i++) { - weight = MAX(1.0, (wsame[i] - wmin) * wmin_inv); - //if (wsame[i] < wmin) continue; + if (wsame[i] < wmin) continue; + weight = MAX(1.0, wsame[i] * wmin_inv); itype = type[i]; if (norm[i] != 0) @@ -365,10 +475,38 @@ void FixRHEOTension::post_force(int vflag) else divnt[i] = 0.0; + // Tension force from Adami, Hu, Adams 2010 prefactor = -alpha * divnt[i] * weight; - for (a = 0; a < 3; a++) { + for (a = 0; a < dim; a++) { f[i][a] += prefactor * cgradt[i][a]; - ft[i][a] = prefactor * cgradt[i][a]; + ft[i][a] += prefactor * cgradt[i][a]; + } + + // remove normal shifting component for interfacial particles + // Based on Yang, Rakhsha, Hu, & Negrut 2022 + if (shift_flag && (vshift_strength != 1.0)) { + if (ct[i] > cmin) { + nx = nt[i][0]; + ny = nt[i][1]; + vx = vshift[i][0]; + vy = vshift[i][1]; + + dot = nx * vx + ny * vy; + if (dim == 3) { + nz = nt[i][2]; + vz = vshift[i][2]; + dot += nz * vz; + } + + // Allowing shifting into the bulk + //if (dot > 0.0) continue; + + vshift[i][0] -= (1.0 - vshift_strength) * nx * dot; + vshift[i][1] -= (1.0 - vshift_strength) * ny * dot; + if (dim == 3) { + vshift[i][2] -= (1.0 - vshift_strength) * nz * dot; + } + } } if (evflag) { @@ -384,11 +522,16 @@ void FixRHEOTension::post_force(int vflag) } // If there is no lower limit, apply optional pairwise forces - if (wmin == 0 || beta == 0.0) return; + // This is totally ad hoc, needs some work + // Attempts to deal with stray single particles + if (wmin <= 0 || beta == 0.0) return; + int newton_pair = force->newton_pair; double fpair, wi, wj; double cut_two_thirds = 2.0 * h / 3.0; - double h_third_squared = (h / 3.0) * (h / 3.0); + double cut_five_sixths = 5.0 * h / 6.0; + double cut_sixth_sq = (h / 6.0) * (h / 6.0); + double cut_third_sq = (h / 3.0) * (h / 3.0); for (ii = 0; ii < inum; ii++) { i = ilist[ii]; xtmp = x[i][0]; @@ -397,9 +540,8 @@ void FixRHEOTension::post_force(int vflag) itype = type[i]; jlist = firstneigh[i]; jnum = numneigh[i]; - imass = mass[itype]; - wi = MIN(1.0, (wsame[i] - wmin) * wmin_inv); + wi = MAX(MIN(1.0, (wmin - wsame[i]) * wmin_inv), 0.0); for (jj = 0; jj < jnum; jj++) { j = jlist[jj]; @@ -414,20 +556,38 @@ void FixRHEOTension::post_force(int vflag) if (rsq > hsq) continue; - wj = MIN(1.0, (wsame[j] - wmin) * wmin_inv); r = sqrt(rsq); - rinv = 1.0 / r; + jtype = type[j]; - fpair = (r - cut_two_thirds); - fpair *= fpair; - fpair -= h_third_squared; - fpair *= wi * wj * beta * rinv; + if (itype == jtype) { + fpair = (r - cut_two_thirds); + fpair *= fpair; + fpair -= cut_third_sq; + } else { + //fpair = 0.0; + + if (r > (0.5*cut_two_thirds)) continue; + fpair = (r - cut_two_thirds); + fpair *= fpair; + fpair -= cut_third_sq; + + //if (r > cut_two_thirds) continue; + //fpair = (r - cut_five_sixths); + //fpair *= fpair; + //fpair -= cut_sixth_sq; + + //fpair = (h - r) * 0.66666666666666; + } + + wj = MAX(MIN(1.0, (wmin - wsame[j]) * wmin_inv), 0.0); + rinv = 1.0 / r; + fpair *= MAX(wi, wj) * beta * rinv; f[i][0] += dx[0] * fpair; f[i][1] += dx[1] * fpair; f[i][2] += dx[2] * fpair; - if (newton || j < nlocal) { + if (newton_pair || j < nlocal) { f[j][0] -= dx[0] * fpair; f[j][1] -= dx[1] * fpair; f[j][2] -= dx[2] * fpair; @@ -448,11 +608,18 @@ int FixRHEOTension::pack_forward_comm(int n, int *list, double *buf, int /*pbc_f int i, j, a, m; m = 0; - for (i = 0; i < n; i++) { - j = list[i]; - for (a = 0; a < 3; a++) - buf[m++] = nt[j][a]; - } + if (comm_stage == 1) + for (i = 0; i < n; i++) { + j = list[i]; + for (a = 0; a < 3; a++) + buf[m++] = nt[j][a]; + } + else if (comm_stage == 2) + for (i = 0; i < n; i++) { + j = list[i]; + buf[m++] = wsame[j]; + } + return m; } @@ -464,9 +631,13 @@ void FixRHEOTension::unpack_forward_comm(int n, int first, double *buf) m = 0; last = first + n; - for (i = first; i < last; i++) - for (a = 0; a < 3; a++) - nt[i][a] = buf[m++]; + if (comm_stage == 1) + for (i = first; i < last; i++) + for (a = 0; a < 3; a++) + nt[i][a] = buf[m++]; + else if (comm_stage == 2) + for (i = first; i < last; i++) + wsame[i] = buf[m++]; } @@ -479,10 +650,13 @@ int FixRHEOTension::pack_reverse_comm(int n, int first, double *buf) m = 0; last = first + n; if (comm_stage == 0) + for (i = first; i < last; i++) + buf[m++] = ct[i]; + else if (comm_stage == 1) for (i = first; i < last; i++) for (a = 0; a < 3; a++) buf[m++] = cgradt[i][a]; - else + else if (comm_stage == 2) for (i = first; i < last; i++) { buf[m++] = norm[i]; buf[m++] = divnt[i]; @@ -499,12 +673,17 @@ void FixRHEOTension::unpack_reverse_comm(int n, int *list, double *buf) m = 0; if (comm_stage == 0) + for (i = 0; i < n; i++) { + j = list[i]; + ct[j] += buf[m++]; + } + else if (comm_stage == 1) for (i = 0; i < n; i++) { j = list[i]; for (a = 0; a < 3; a++) cgradt[j][a] += buf[m++]; } - else + else if (comm_stage == 2) for (i = 0; i < n; i++) { j = list[i]; norm[j] += buf[m++]; @@ -518,19 +697,22 @@ void FixRHEOTension::unpack_reverse_comm(int n, int *list, double *buf) void FixRHEOTension::grow_arrays(int nmax) { // Grow atom variables and reassign pointers + memory->grow(atom->dvector[index_ct], nmax, "atom:rheo_ct"); memory->grow(atom->darray[index_cgradt], nmax, 3, "atom:rheo_cgradt"); memory->grow(atom->darray[index_nt], nmax, 3, "atom:rheo_nt"); memory->grow(atom->dvector[index_divnt], nmax, "atom:rheo_divnt"); + memory->grow(atom->dvector[index_wsame], nmax, "atom:rheo_wsame"); memory->grow(atom->darray[index_ft], nmax, 3, "atom:rheo_ft"); + ct = atom->dvector[index_ct]; cgradt = atom->darray[index_cgradt]; nt = atom->darray[index_nt]; divnt = atom->dvector[index_divnt]; + wsame = atom->dvector[index_wsame]; ft = atom->darray[index_ft]; // Grow local variables memory->grow(norm, nmax, "rheo/tension:norm"); - memory->grow(wsame, nmax, "rheo/tension:wsame"); nmax_store = atom->nmax; } \ No newline at end of file diff --git a/src/RHEO/fix_rheo_tension.h b/src/RHEO/fix_rheo_tension.h index f56a61e688..52d368531f 100644 --- a/src/RHEO/fix_rheo_tension.h +++ b/src/RHEO/fix_rheo_tension.h @@ -32,7 +32,7 @@ class FixRHEOTension : public Fix { void init() override; void init_list(int, class NeighList *) override; void setup(int) override; - void post_force(int) override; + void pre_force(int) override; int pack_forward_comm(int, int *, double *, int, int *) override; void unpack_forward_comm(int, int, double *) override; int pack_reverse_comm(int, int, double *) override; @@ -40,14 +40,15 @@ class FixRHEOTension : public Fix { void grow_arrays(int) override; private: - int nmax_store, comm_stage, interface_flag; - int index_nt, index_cgradt, index_divnt, index_ft; + int nmax_store, comm_stage, interface_flag, shift_flag; + int index_ct, index_nt, index_cgradt, index_divnt, index_ft, index_wsame; - double **nt, **cgradt, *divnt, *norm, **ft, *wsame; - double alpha, beta, wmin, h, hsq, hinv, hinv3, rho0; + double *ct, **nt, **cgradt, *divnt, *norm, **ft, *wsame; + double alpha, beta, wmin, cmin, vshift_strength, h, hsq, hinv, hinv3, *rho0; class ComputeRHEOKernel *compute_kernel; class ComputeRHEOInterface *compute_interface; + class ComputeRHEOVShift *compute_vshift; class FixRHEO *fix_rheo; class NeighList *list; }; From a0cf5191c28054354fd9de7613771d267568d7ca Mon Sep 17 00:00:00 2001 From: jtclemm Date: Fri, 12 Jan 2024 17:00:12 -0700 Subject: [PATCH 066/158] Adding nonzero starting rhos --- src/RHEO/atom_vec_rheo.cpp | 9 +++++++++ src/RHEO/atom_vec_rheo.h | 1 + src/RHEO/atom_vec_rheo_thermal.cpp | 9 +++++++++ src/RHEO/atom_vec_rheo_thermal.h | 1 + 4 files changed, 20 insertions(+) diff --git a/src/RHEO/atom_vec_rheo.cpp b/src/RHEO/atom_vec_rheo.cpp index ea9e2a3c10..ec44a230ec 100644 --- a/src/RHEO/atom_vec_rheo.cpp +++ b/src/RHEO/atom_vec_rheo.cpp @@ -82,6 +82,15 @@ void AtomVecRHEO::force_clear(int n, size_t nbytes) memset(&drho[n], 0, nbytes); } +/* ---------------------------------------------------------------------- + initialize non-zero atom quantities +------------------------------------------------------------------------- */ + +void AtomVecRHEO::create_atom_post(int ilocal) +{ + rho[ilocal] = 1.0; +} + /* ---------------------------------------------------------------------- modify what AtomVec::data_atom() just unpacked or initialize other atom quantities diff --git a/src/RHEO/atom_vec_rheo.h b/src/RHEO/atom_vec_rheo.h index 68cc224ba5..62a7b1a630 100644 --- a/src/RHEO/atom_vec_rheo.h +++ b/src/RHEO/atom_vec_rheo.h @@ -30,6 +30,7 @@ class AtomVecRHEO : virtual public AtomVec { void grow_pointers() override; void force_clear(int, size_t) override; + void create_atom_post(int) override; void data_atom_post(int) override; int property_atom(const std::string &) override; void pack_property_atom(int, double *, int, int) override; diff --git a/src/RHEO/atom_vec_rheo_thermal.cpp b/src/RHEO/atom_vec_rheo_thermal.cpp index 4ecb7136a8..26394c9175 100644 --- a/src/RHEO/atom_vec_rheo_thermal.cpp +++ b/src/RHEO/atom_vec_rheo_thermal.cpp @@ -91,6 +91,15 @@ void AtomVecRHEOThermal::force_clear(int n, size_t nbytes) memset(&heatflow[n], 0, nbytes); } +/* ---------------------------------------------------------------------- + initialize non-zero atom quantities +------------------------------------------------------------------------- */ + +void AtomVecRHEOThermal::create_atom_post(int ilocal) +{ + rho[ilocal] = 1.0; +} + /* ---------------------------------------------------------------------- modify what AtomVec::data_atom() just unpacked or initialize other atom quantities diff --git a/src/RHEO/atom_vec_rheo_thermal.h b/src/RHEO/atom_vec_rheo_thermal.h index ad467f9de7..29a764bea9 100644 --- a/src/RHEO/atom_vec_rheo_thermal.h +++ b/src/RHEO/atom_vec_rheo_thermal.h @@ -30,6 +30,7 @@ class AtomVecRHEOThermal : virtual public AtomVec { void grow_pointers() override; void force_clear(int, size_t) override; + void create_atom_post(int) override; void data_atom_post(int) override; int property_atom(const std::string &) override; void pack_property_atom(int, double *, int, int) override; From 67f06097ee1d71babd2a3edd5654dcd8a3cc6108 Mon Sep 17 00:00:00 2001 From: jtclemm Date: Mon, 15 Jan 2024 22:04:26 -0700 Subject: [PATCH 067/158] Updating utils functions for pair rheo/react --- src/RHEO/pair_rheo_react.cpp | 47 +++++++++++++++--------------------- src/RHEO/pair_rheo_react.h | 2 +- 2 files changed, 21 insertions(+), 28 deletions(-) diff --git a/src/RHEO/pair_rheo_react.cpp b/src/RHEO/pair_rheo_react.cpp index 1d54208792..4709ea169e 100644 --- a/src/RHEO/pair_rheo_react.cpp +++ b/src/RHEO/pair_rheo_react.cpp @@ -89,7 +89,6 @@ PairRHEOReact::~PairRHEOReact() memory->destroy(cutsq); memory->destroy(cutbsq); - memory->destroy(cut); memory->destroy(cutbond); memory->destroy(k); memory->destroy(eps); @@ -301,10 +300,9 @@ void PairRHEOReact::allocate() for (int j = i; j <= n; j++) setflag[i][j] = 0; - memory->create(cut, n + 1, n + 1, "pair:cut"); memory->create(cutbond, n + 1, n + 1, "pair:cutbond"); - memory->create(cutsq, n + 1, n + 1, "pair:cutsq"); memory->create(cutbsq, n + 1, n + 1, "pair:cutbsq"); + memory->create(cutsq, n + 1, n + 1, "pair:cutsq"); memory->create(k, n + 1, n + 1, "pair:k"); memory->create(eps, n + 1, n + 1, "pair:eps"); memory->create(gamma, n + 1, n + 1, "pair:gamma"); @@ -333,24 +331,21 @@ void PairRHEOReact::coeff(int narg, char **arg) utils::bounds(FLERR, arg[0], 1, atom->ntypes, ilo, ihi,error); utils::bounds(FLERR, arg[1], 1, atom->ntypes, jlo, jhi,error); - double cut_one = utils::numeric(FLERR, arg[2], false, lmp); + double k_one = utils::numeric(FLERR, arg[2], false, lmp); double cutb_one = utils::numeric(FLERR, arg[3], false, lmp); - double k_one = utils::numeric(FLERR, arg[4], false, lmp); - double eps_one = utils::numeric(FLERR, arg[5], false, lmp); - double gamma_one = utils::numeric(FLERR, arg[6], false, lmp); - double t_form_one = utils::numeric(FLERR, arg[7], false, lmp); - double rlimit_one = utils::numeric(FLERR, arg[8], false, lmp); + double eps_one = utils::numeric(FLERR, arg[4], false, lmp); + double gamma_one = utils::numeric(FLERR, arg[5], false, lmp); + double t_form_one = utils::numeric(FLERR, arg[6], false, lmp); + double rlimit_one = utils::numeric(FLERR, arg[7], false, lmp); - if (k_one < 0.0 || eps_one < 0.0 || - t_form_one < 0.0 || (1.0 + eps_one) * cutb_one > cut_one) + if (k_one < 0.0 || eps_one < 0.0 || t_form_one < 0.0) error->all(FLERR, "Illegal pair_style command"); int count = 0; for (int i = ilo; i <= ihi; i++) { for (int j = MAX(jlo,i); j <= jhi; j++) { - cut[i][j] = cut_one; - cutbond[i][j] = cutb_one; k[i][j] = k_one; + cutbond[i][j] = cutb_one; eps[i][j] = eps_one; gamma[i][j] = gamma_one; t_form[i][j] = t_form_one; @@ -411,7 +406,6 @@ double PairRHEOReact::init_one(int i, int j) cutbsq[i][j] = cutbond[i][j] * cutbond[i][j]; cutbsq[j][i] = cutbsq[i][j]; - cut[j][i] = cut[i][j]; cutbond[j][i] = cutbond[i][j]; k[j][i] = k[i][j]; eps[j][i] = eps[i][j]; @@ -419,7 +413,9 @@ double PairRHEOReact::init_one(int i, int j) t_form[j][i] = t_form[i][j]; rlimit[j][i] = rlimit[i][j]; - return cut[i][j]; + double cut = cutbond[i][j] * (1.0 + eps[i][j]); + + return cut; } /* ---------------------------------------------------------------------- @@ -435,9 +431,8 @@ void PairRHEOReact::write_restart(FILE *fp) for (j = i; j <= atom->ntypes; j++) fwrite(&setflag[i][j], sizeof(int), 1, fp); if (setflag[i][j]) { - fwrite(&cut[i][j], sizeof(double), 1, fp); - fwrite(&cutbond[i][j], sizeof(double), 1, fp); fwrite(&k[i][j], sizeof(double), 1, fp); + fwrite(&cutbond[i][j], sizeof(double), 1, fp); fwrite(&eps[i][j], sizeof(double), 1, fp); fwrite(&gamma[i][j], sizeof(double), 1, fp); fwrite(&t_form[i][j], sizeof(double), 1, fp); @@ -458,21 +453,19 @@ void PairRHEOReact::read_restart(FILE *fp) int me = comm->me; for (i = 1; i <= atom->ntypes; i++) for (j = i; j <= atom->ntypes; j++) { - if (me == 0) fread(&setflag[i][j], sizeof(int), 1, fp); + if (me == 0) utils::sfread(FLERR, &setflag[i][j], sizeof(int), 1, fp, nullptr, error); MPI_Bcast(&setflag[i][j], 1, MPI_INT, 0, world); if (setflag[i][j]) { if (me == 0) { - fread(&cut[i][j], sizeof(double), 1, fp); - fread(&cutbond[i][j], sizeof(double), 1, fp); - fread(&k[i][j], sizeof(double), 1, fp); - fread(&eps[i][j], sizeof(double), 1, fp); - fread(&gamma[i][j], sizeof(double), 1, fp); - fread(&t_form[i][j], sizeof(double), 1, fp); - fread(&rlimit[i][j], sizeof(double), 1, fp); + utils::sfread(FLERR, &k[i][j], sizeof(double), 1, fp, nullptr, error); + utils::sfread(FLERR, &cutbond[i][j], sizeof(double), 1, fp, nullptr, error); + utils::sfread(FLERR, &eps[i][j], sizeof(double), 1, fp, nullptr, error); + utils::sfread(FLERR, &gamma[i][j], sizeof(double), 1, fp, nullptr, error); + utils::sfread(FLERR, &t_form[i][j], sizeof(double), 1, fp, nullptr, error); + utils::sfread(FLERR, &rlimit[i][j], sizeof(double), 1, fp, nullptr, error); } - MPI_Bcast(&cut[i][j], 1,MPI_DOUBLE, 0, world); - MPI_Bcast(&cutbond[i][j], 1,MPI_DOUBLE, 0, world); MPI_Bcast(&k[i][j], 1,MPI_DOUBLE, 0, world); + MPI_Bcast(&cutbond[i][j], 1,MPI_DOUBLE, 0, world); MPI_Bcast(&eps[i][j], 1,MPI_DOUBLE, 0, world); MPI_Bcast(&gamma[i][j], 1,MPI_DOUBLE, 0, world); MPI_Bcast(&t_form[i][j], 1,MPI_DOUBLE, 0, world); diff --git a/src/RHEO/pair_rheo_react.h b/src/RHEO/pair_rheo_react.h index 144859e68b..88d5dbeb0e 100644 --- a/src/RHEO/pair_rheo_react.h +++ b/src/RHEO/pair_rheo_react.h @@ -40,7 +40,7 @@ class PairRHEOReact : public Pair { void unpack_reverse_comm(int, int *, double *) override; protected: - double **cut, **cutbond, **cutbsq, **k, **eps, **gamma, **t_form, **rlimit; + double **cutbond, **cutbsq, **k, **eps, **gamma, **t_form, **rlimit; void allocate(); void transfer_history(double*, double*); From 80861fe1ff0f6ce4e1a00acd2dd3a0b1603fae05 Mon Sep 17 00:00:00 2001 From: jtclemm Date: Fri, 19 Jan 2024 21:24:27 -0700 Subject: [PATCH 068/158] New syntax in doc files --- doc/src/compute_rheo_property_atom.rst | 19 +++++--- doc/src/fix_rheo.rst | 3 +- doc/src/fix_rheo_pressure.rst | 9 ++-- doc/src/fix_rheo_thermal.rst | 47 ++++++++++++------ doc/src/fix_rheo_viscosity.rst | 12 ++--- doc/src/pair_rheo.rst | 9 ++-- doc/src/pair_rheo_react.rst | 67 ++++++++++++++++++++++++++ doc/src/pair_rheo_solid.rst | 58 ++++++++++++++++++++++ 8 files changed, 187 insertions(+), 37 deletions(-) create mode 100644 doc/src/pair_rheo_react.rst create mode 100644 doc/src/pair_rheo_solid.rst diff --git a/doc/src/compute_rheo_property_atom.rst b/doc/src/compute_rheo_property_atom.rst index 5476f7f709..7f5de17c3b 100644 --- a/doc/src/compute_rheo_property_atom.rst +++ b/doc/src/compute_rheo_property_atom.rst @@ -17,11 +17,13 @@ Syntax .. parsed-literal:: possible attributes = phase, chi, surface, surface/r, - surface/divr, surface/nx, surface/ny, - surface/nz, coordination, cv, shift/vx, - shift/vy, shift/vz, temperature, heatflow, - conductivity, viscosity, pressure, status, - rho + surface/divr, surface/n/x, surface/n/y, + surface/n/z, coordination, cv, shift/v/x, + shift/v/y, shift/v/z, energy, temperature, heatflow, + conductivity, cv, viscosity, pressure, + status, rho, grad/v/xx, grad/v/xy, grad/v/xz, + grad/v/yx, grad/v/yy/, grad/v/yz, grad/v/zx, + grad/v/zy, grad/v/zz .. parsed-literal:: @@ -30,16 +32,19 @@ Syntax *surface* = atom surface status *surface/r* = atom distance from the surface *surface/divr* = divergence of position at atom position - *surface/nx, surface/ny, surface/nz* = surface normal vector + *surface/n/\** = surface normal vector *coordination* = coordination number - *shift/vx, shift/vy, shift/vz* = atom shifting velocity + *shift/v/\** = atom shifting velocity + *energy* = atom energy *temperature* = atom temperature *heatflow* = atom heat flow *conductivity* = atom conductivity + *cv* = atom specific heat *viscosity* = atom viscosity *pressure* = atom pressure *status* = atom full status *rho* = atom density + *grad/v/\** = atom velocity gradient Examples """""""" diff --git a/doc/src/fix_rheo.rst b/doc/src/fix_rheo.rst index 25e171a1b9..c61d1939db 100644 --- a/doc/src/fix_rheo.rst +++ b/doc/src/fix_rheo.rst @@ -14,7 +14,8 @@ Syntax * rheo = style name of this fix command * cut = *quintic* or *RK0* or *RK1* or *RK2* * zero or more keyword/value pairs may be appended to args -* keyword = *shift* or *thermal* or *surface/detection* or *interface/reconstruction* or *rho/sum* or *density* or *sound/squared* +* keyword = *shift* or *thermal* or *surface/detection* or *interface/reconstruction* or + *rho/sum* or *density* or *sound/squared* .. parsed-literal:: diff --git a/doc/src/fix_rheo_pressure.rst b/doc/src/fix_rheo_pressure.rst index ceb402501a..d31c305c20 100644 --- a/doc/src/fix_rheo_pressure.rst +++ b/doc/src/fix_rheo_pressure.rst @@ -8,11 +8,12 @@ Syntax .. parsed-literal:: - fix ID group-ID rheo/pressure pstyle args + fix ID group-ID rheo/pressure style args * ID, group-ID are documented in :doc:`fix ` command * rheo/pressure = style name of this fix command -* pstyle = *linear* or *taitwater* or *cubic* +* types = lists of types (see below) +* style = *linear* or *taitwater* or *cubic* .. parsed-literal:: @@ -25,8 +26,8 @@ Examples .. code-block:: LAMMPS - fix 1 all rheo/pressure linear - fix 1 all rheo/pressure cubic 10.0 + fix 1 all rheo/pressure * linear + fix 1 all rheo/pressure 1 linear 2 cubic 10.0 Description """"""""""" diff --git a/doc/src/fix_rheo_thermal.rst b/doc/src/fix_rheo_thermal.rst index 01b4820a39..b73aeb248e 100644 --- a/doc/src/fix_rheo_thermal.rst +++ b/doc/src/fix_rheo_thermal.rst @@ -8,42 +8,59 @@ Syntax .. parsed-literal:: - fix ID group-ID rheo/thermal keyword values ... + fix ID group-ID rheo/thermal attribute values ... * ID, group-ID are documented in :doc:`fix ` command -* rheo/viscosity = style name of this fix command +* rheo/thermal = style name of this fix command * one or more attributes may be appended -* attribute = *conductivity* or *specific/heat* or *Tfreeze* +* attribute = *conductivity* or *specific/heat* or *latent/heat* or *Tfreeze* or *react* .. parsed-literal:: - *conductivity* args = style param - style = *constant* or *type* + *conductivity* args = types style args + types = lists of types (see below) + style = *constant* *constant* arg = conductivity (power/temperature) - *type* args = list of conductivity values, one per type (power/temperature) - *specific/heat* args = style param - style = *constant* or *type* + *specific/heat* args = types style args + types = lists of types (see below) + style = *constant* *constant* arg = specific heat (energy/(mass*temperature)) - *type* args = list of specific heat values, one per atom type (energy/(mass*temperature)) - *Tfreeze* args = style param - style = *constant* or *type* + *latent/heat* args = types style args + types = lists of types (see below) + style = *constant* + *constant* arg = latent heat (energy/mass) + *Tfreeze* args = types style args + types = lists of types (see below) + style = *constant* *constant* arg = freezing temperature (temperature) - *type* args = list of freezing temperature values, one per type (temperature) + *react* args = cut type + cut = maximum bond distance + type = bond type Examples """""""" .. code-block:: LAMMPS - fix 1 all rheo/thermal conductivity constant 1.0 specific/heat constant 1.0 Tfreeze constant 1.0 - fix 1 all rheo/pressure conductivity constant 1.0 specific/heat type 1.0 2.0 + fix 1 all rheo/thermal conductivity * constant 1.0 specific/heat * constant 1.0 Tfreeze * constant 1.0 + fix 1 all rheo/pressure conductivity 1*2 constant 1.0 conductivity 3*4 constant 2.0 specific/heat * constant 1.0 Description """"""""""" This fix... -While the *Tfreeze* keyword is optional, the *conducitivity* and +Each list consists of a series of type +ranges separated by commas. The range can be specified as a +single numeric value, or a wildcard asterisk can be used to specify a range +of values. This takes the form "\*" or "\*n" or "n\*" or "m\*n". For +example, if M = the number of atom types, then an asterisk with no numeric +values means all types from 1 to M. A leading asterisk means all types +from 1 to n (inclusive). A trailing asterisk means all types from n to M +(inclusive). A middle asterisk means all types from m to n (inclusive). +Note that all atom types must be included in exactly one of the N collections. + +While the *Tfreeze* keyword is optional, the *conductivity* and *specific/heat* keywords are mandatory. Multiple instances of this fix may be defined to apply different diff --git a/doc/src/fix_rheo_viscosity.rst b/doc/src/fix_rheo_viscosity.rst index 278c621216..379b002de1 100644 --- a/doc/src/fix_rheo_viscosity.rst +++ b/doc/src/fix_rheo_viscosity.rst @@ -8,16 +8,16 @@ Syntax .. parsed-literal:: - fix ID group-ID rheo/viscosity vstyle args + fix ID group-ID rheo/viscosity types style args ... * ID, group-ID are documented in :doc:`fix ` command * rheo/viscosity = style name of this fix command -* vstyle = *constant* or *type* or *power* +* types = lists of types (see below) +* style = *constant* or *power* .. parsed-literal:: - *constant* arg = viscosity (mass/(length*time)) - *type* args = list of viscosity values, one per atom type (mass/(length*time)) + *constant* args = viscosity (mass/(length*time)) *power* args = *eta* *gd0* *K* *npow* *tau0* *eta* = (units) *gd0* = (units) @@ -30,8 +30,8 @@ Examples .. code-block:: LAMMPS - fix 1 all rheo/viscosity constant 1.0 - fix 1 all rheo/viscosity power 0.1 1e-2 0.5 0.01 + fix 1 all rheo/viscosity * constant 1.0 + fix 1 all rheo/viscosity 1 constant 1.0 2 power 0.1 1e-2 0.5 0.01 Description """"""""""" diff --git a/doc/src/pair_rheo.rst b/doc/src/pair_rheo.rst index d168f79785..6f706a77ac 100644 --- a/doc/src/pair_rheo.rst +++ b/doc/src/pair_rheo.rst @@ -8,16 +8,17 @@ Syntax .. code-block:: LAMMPS - pair_style rheo cut keyword values + pair_style rheo cutoff keyword values -* cut = *quintic* or *CRK0* or *CRK1* or *CRK2* +* cutoff = global cutoff for kernel (distance units) * zero or more keyword/value pairs may be appended to args -* keyword = *rho/damp* or *artificial/visc* +* keyword = *rho/damp* or *artificial/visc* or *harmonic/means* .. parsed-literal:: *rho/damp* args = density damping prefactor :math:`\xi` (units?) *artificial/visc* args = artificial viscosity prefactor :math:`\zeta` (units?) + *harmonic/means* args = none Examples """""""" @@ -67,4 +68,4 @@ Related commands Default """"""" -No density damping or artificial viscous forces are calculated. +Density damping and artificial viscous forces are not calculated. Arithmetic means are used for mixing particle properties. diff --git a/doc/src/pair_rheo_react.rst b/doc/src/pair_rheo_react.rst new file mode 100644 index 0000000000..6e7eb49c9d --- /dev/null +++ b/doc/src/pair_rheo_react.rst @@ -0,0 +1,67 @@ +.. index:: pair_style rheo/react + +pair_style rheo/react command +========================= + +Syntax +"""""" + +.. code-block:: LAMMPS + + pair_style rheo/react + +Examples +"""""""" + +.. code-block:: LAMMPS + + pair_style rheo/react + pair_coeff * * 1.0 1.5 1.0 0.05 1.0 100 2.0 + +Description +""""""""""" + +pair style... + +The following coefficients must be defined for each pair of atom types +via the :doc:`pair_coeff ` command as in the example above, +or in the data file or restart files read by the +:doc:`read_data ` or :doc:`read_restart ` +commands, or by mixing as described below: + +* :math:`k` (force/distance units) +* :math:`r_max` (distance units) +* :math:`\epsilon` (unitless) +* :math:`\gamma` (force/velocity units) +* :math:`t_form` (time units) +* :math:`r_from_surface` (distance units) + +---------- + +Mixing, shift, table, tail correction, restart, rRESPA info +""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" + +This style does not support the :doc:`pair_modify ` +shift, table, and tail options. + +This style does not write information to :doc:`binary restart files `. Thus, you need to re-specify the pair_style and +pair_coeff commands in an input script that reads a restart file. + +This style can only be used via the *pair* keyword of the :doc:`run_style respa ` command. It does not support the *inner*, *middle*, *outer* keywords. + +Restrictions +"""""""""""" + +This fix is part of the RHEO package. It is only enabled if +LAMMPS was built with that package. See the :doc:`Build package ` page for more info. + +Related commands +"""""""""""""""" + +:doc:`fix rheo `, +:doc:`compute rheo/property/atom ` + +Default +""""""" + +none diff --git a/doc/src/pair_rheo_solid.rst b/doc/src/pair_rheo_solid.rst new file mode 100644 index 0000000000..b6ff6d809d --- /dev/null +++ b/doc/src/pair_rheo_solid.rst @@ -0,0 +1,58 @@ +.. index:: pair_style rheo/solid + +pair_style rheo/solid command +========================= + +Syntax +"""""" + +.. code-block:: LAMMPS + + pair_style rheo/solid + +Examples +"""""""" + +.. code-block:: LAMMPS + + pair_style rheo/solid + pair_coeff * * 1.0 1.5 1.0 + +Description +""""""""""" + +pair style... + +* :math:`k` (force/distance units) +* :math:`\sigma` (distance units) +* :math:`\gamma` (force/velocity units) + +---------- + +Mixing, shift, table, tail correction, restart, rRESPA info +""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" + +This style does not support the :doc:`pair_modify ` +shift, table, and tail options. + +This style does not write information to :doc:`binary restart files `. Thus, you need to re-specify the pair_style and +pair_coeff commands in an input script that reads a restart file. + +This style can only be used via the *pair* keyword of the :doc:`run_style respa ` command. It does not support the *inner*, *middle*, *outer* keywords. + +Restrictions +"""""""""""" + +This fix is part of the RHEO package. It is only enabled if +LAMMPS was built with that package. See the :doc:`Build package ` page for more info. + +Related commands +"""""""""""""""" + +:doc:`fix rheo `, +:doc:`pair bpm/spring `, + +Default +""""""" + +none From 574ccc64ebb03a3a13b648a05b8f3e637b0eb7e9 Mon Sep 17 00:00:00 2001 From: jtclemm Date: Tue, 23 Jan 2024 14:04:10 -0700 Subject: [PATCH 069/158] Fixing bugs for solid particles --- src/RHEO/pair_rheo_solid.cpp | 6 ++---- src/set.cpp | 2 +- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/src/RHEO/pair_rheo_solid.cpp b/src/RHEO/pair_rheo_solid.cpp index 1068e9b329..d0a68d5230 100644 --- a/src/RHEO/pair_rheo_solid.cpp +++ b/src/RHEO/pair_rheo_solid.cpp @@ -96,14 +96,12 @@ void PairRHEOSolid::compute(int eflag, int vflag) for (jj = 0; jj < jnum; jj++) { j = jlist[jj]; - if (!(status[j] & STATUS_SOLID)) continue; - factor_lj = special_lj[sbmask(j)]; - if (factor_lj == 0) continue; - j &= NEIGHMASK; + if (!(status[j] & STATUS_SOLID)) continue; + delx = xtmp - x[j][0]; dely = ytmp - x[j][1]; delz = ztmp - x[j][2]; diff --git a/src/set.cpp b/src/set.cpp index 735d3bc831..cf2a053fab 100644 --- a/src/set.cpp +++ b/src/set.cpp @@ -923,7 +923,7 @@ void Set::set(int keyword) } else if (keyword == RHEO_STATUS) { - if (ivalue != 0 && ivalue != 2) + if (ivalue != 0 && ivalue != 1) error->one(FLERR,"Invalid value {} in set command for rheo/status", ivalue); atom->status[i] = ivalue; } From 70ea1dd3525e1decbb1430b65267a2d71a2abffa Mon Sep 17 00:00:00 2001 From: jtclemm Date: Tue, 23 Jan 2024 14:58:31 -0700 Subject: [PATCH 070/158] Refreshing no shift flag for solid particles --- src/RHEO/fix_rheo.cpp | 6 ++++++ src/RHEO/fix_rheo_thermal.cpp | 3 +-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/RHEO/fix_rheo.cpp b/src/RHEO/fix_rheo.cpp index beba940174..3a999e12dd 100644 --- a/src/RHEO/fix_rheo.cpp +++ b/src/RHEO/fix_rheo.cpp @@ -422,6 +422,12 @@ void FixRHEO::pre_force(int /*vflag*/) if (mask[i] & groupbit) status[i] &= OPTIONSMASK; + // Reinstate temporary options + for (int i = 0; i < nall; i++) + if (mask[i] & groupbit) + if (status[i] & STATUS_SOLID) + status[i] |= STATUS_NO_SHIFT; + // Calculate surfaces, update status if (surface_flag) { compute_surface->compute_peratom(); diff --git a/src/RHEO/fix_rheo_thermal.cpp b/src/RHEO/fix_rheo_thermal.cpp index 7b61b9821e..635cf78c85 100644 --- a/src/RHEO/fix_rheo_thermal.cpp +++ b/src/RHEO/fix_rheo_thermal.cpp @@ -374,7 +374,6 @@ void FixRHEOThermal::post_integrate() } } } - } int n_melt_all, n_freeze_all; @@ -558,7 +557,7 @@ void FixRHEOThermal::create_bonds() for (jj = 0; jj < jnum; jj++) { j = jlist[jj]; - j &= SPECIALMASK; + j &= NEIGHMASK; if (!(status[j] & STATUS_SOLID)) continue; if (!(status[i] & STATUS_FREEZING) && !(status[j] & STATUS_FREEZING)) continue; From b3de75da971382b79d8c5b585bb58ace365d48ee Mon Sep 17 00:00:00 2001 From: jtclemm Date: Fri, 23 Feb 2024 13:26:28 -0700 Subject: [PATCH 071/158] Cleaning up math, fixing tension bug, patching bond creation --- src/RHEO/compute_rheo_interface.cpp | 54 ++++++++++--------- src/RHEO/fix_rheo.cpp | 6 --- src/RHEO/fix_rheo_tension.cpp | 2 +- src/RHEO/fix_rheo_thermal.cpp | 80 +++++++++++++++++++++++------ 4 files changed, 90 insertions(+), 52 deletions(-) diff --git a/src/RHEO/compute_rheo_interface.cpp b/src/RHEO/compute_rheo_interface.cpp index 001f15a472..3cb2fcf058 100644 --- a/src/RHEO/compute_rheo_interface.cpp +++ b/src/RHEO/compute_rheo_interface.cpp @@ -26,6 +26,7 @@ #include "force.h" #include "fix_rheo.h" #include "fix_rheo_pressure.h" +#include "math_extra.h" #include "memory.h" #include "modify.h" #include "neighbor.h" @@ -36,6 +37,7 @@ using namespace LAMMPS_NS; using namespace RHEO_NS; +using namespace MathExtra; static constexpr double EPSILON = 1e-1; @@ -107,8 +109,8 @@ void ComputeRHEOInterface::init_list(int /*id*/, NeighList *ptr) void ComputeRHEOInterface::compute_peratom() { - int i, j, ii, jj, jnum, itype, jtype, fluidi, fluidj, status_match; - double xtmp, ytmp, ztmp, delx, dely, delz, rsq, w, dot; + int a, i, j, ii, jj, jnum, itype, jtype, fluidi, fluidj, status_match; + double xtmp, ytmp, ztmp, rsq, w, dot, dx[3]; int inum, *ilist, *jlist, *numneigh, **firstneigh; int nlocal = atom->nlocal; @@ -153,15 +155,15 @@ void ComputeRHEOInterface::compute_peratom() j = jlist[jj]; j &= NEIGHMASK; - delx = xtmp - x[j][0]; - dely = ytmp - x[j][1]; - delz = ztmp - x[j][2]; - rsq = delx * delx + dely * dely + delz * delz; + dx[0] = xtmp - x[j][0]; + dx[1] = ytmp - x[j][1]; + dx[2] = ztmp - x[j][2]; + rsq = lensq3(dx); if (rsq < cutsq) { jtype = type[j]; fluidj = !(status[j] & PHASECHECK); - w = compute_kernel->calc_w_quintic(i, j, delx, dely, delz, sqrt(rsq)); + w = compute_kernel->calc_w_quintic(i, j, dx[0], dx[1], dx[2], sqrt(rsq)); status_match = 0; norm[i] += w; @@ -172,9 +174,9 @@ void ComputeRHEOInterface::compute_peratom() chi[i] += w; } else { if (!fluidi) { - dot = (-fp_store[j][0] + fp_store[i][0]) * delx; - dot += (-fp_store[j][1] + fp_store[i][1]) * dely; - dot += (-fp_store[j][2] + fp_store[i][2]) * delz; + dot = 0; + for (a = 0; a < 3; a++) + dot += (-fp_store[j][a] + fp_store[i][a]) * dx[a]; rho[i] += w * (fix_pressure->calc_pressure(rho[j], jtype) - rho[j] * dot); normwf[i] += w; @@ -187,9 +189,9 @@ void ComputeRHEOInterface::compute_peratom() chi[j] += w; } else { if (!fluidj) { - dot = (-fp_store[i][0] + fp_store[j][0]) * delx; - dot += (-fp_store[i][1] + fp_store[j][1]) * dely; - dot += (-fp_store[i][2] + fp_store[j][2]) * delz; + dot = 0; + for (a = 0; a < 3; a++) + dot += (-fp_store[i][a] + fp_store[j][a]) * dx[a]; rho[j] += w * (fix_pressure->calc_pressure(rho[i], itype) + rho[i] * dot); normwf[j] += w; @@ -225,7 +227,7 @@ void ComputeRHEOInterface::compute_peratom() int ComputeRHEOInterface::pack_forward_comm(int n, int *list, double *buf, int /*pbc_flag*/, int * /*pbc*/) { - int i,j,k,m; + int i, j, k, m; m = 0; double *rho = atom->rho; @@ -267,7 +269,7 @@ void ComputeRHEOInterface::unpack_forward_comm(int n, int first, double *buf) int ComputeRHEOInterface::pack_reverse_comm(int n, int first, double *buf) { - int i,k,m,last; + int i, k, m, last; double *rho = atom->rho; m = 0; @@ -285,7 +287,7 @@ int ComputeRHEOInterface::pack_reverse_comm(int n, int first, double *buf) void ComputeRHEOInterface::unpack_reverse_comm(int n, int *list, double *buf) { - int i,k,j,m; + int i, k, j, m; double *rho = atom->rho; int *status = atom->status; m = 0; @@ -350,23 +352,19 @@ void ComputeRHEOInterface::store_forces() for (const auto &fix : fixlist) { for (int i = 0; i < atom->nlocal; i++) { minv = 1.0 / mass[type[i]]; - if (mask[i] & fix->groupbit) { - fp_store[i][0] = f[i][0] * minv; - fp_store[i][1] = f[i][1] * minv; - fp_store[i][2] = f[i][2] * minv; - } else { - fp_store[i][0] = (f[i][0] - fp_store[i][0]) * minv; - fp_store[i][1] = (f[i][1] - fp_store[i][1]) * minv; - fp_store[i][2] = (f[i][2] - fp_store[i][2]) * minv; - } + if (mask[i] & fix->groupbit) + for (int a = 0; a < 3; a++) + fp_store[i][a] = f[i][a] * minv; + else + for (int a = 0; a < 3; a++) + fp_store[i][a] = (f[i][a] - fp_store[i][a]) * minv; } } } else { for (int i = 0; i < atom->nlocal; i++) { minv = 1.0 / mass[type[i]]; - fp_store[i][0] = (f[i][0] - fp_store[i][0]) * minv; - fp_store[i][1] = (f[i][1] - fp_store[i][1]) * minv; - fp_store[i][2] = (f[i][2] - fp_store[i][2]) * minv; + for (int a = 0; a < 3; a++) + fp_store[i][a] = (f[i][a] - fp_store[i][a]) * minv; } } diff --git a/src/RHEO/fix_rheo.cpp b/src/RHEO/fix_rheo.cpp index 3a999e12dd..beba940174 100644 --- a/src/RHEO/fix_rheo.cpp +++ b/src/RHEO/fix_rheo.cpp @@ -422,12 +422,6 @@ void FixRHEO::pre_force(int /*vflag*/) if (mask[i] & groupbit) status[i] &= OPTIONSMASK; - // Reinstate temporary options - for (int i = 0; i < nall; i++) - if (mask[i] & groupbit) - if (status[i] & STATUS_SOLID) - status[i] |= STATUS_NO_SHIFT; - // Calculate surfaces, update status if (surface_flag) { compute_surface->compute_peratom(); diff --git a/src/RHEO/fix_rheo_tension.cpp b/src/RHEO/fix_rheo_tension.cpp index 8d00c8b988..388b574365 100644 --- a/src/RHEO/fix_rheo_tension.cpp +++ b/src/RHEO/fix_rheo_tension.cpp @@ -467,7 +467,7 @@ void FixRHEOTension::pre_force(int vflag) if (wsame[i] < wmin) continue; - weight = MAX(1.0, wsame[i] * wmin_inv); + weight = MIN(1.0, wsame[i] * wmin_inv); //MAX -> MIN 2/14/24 itype = type[i]; if (norm[i] != 0) diff --git a/src/RHEO/fix_rheo_thermal.cpp b/src/RHEO/fix_rheo_thermal.cpp index 635cf78c85..0640dd6827 100644 --- a/src/RHEO/fix_rheo_thermal.cpp +++ b/src/RHEO/fix_rheo_thermal.cpp @@ -423,6 +423,7 @@ void FixRHEOThermal::pre_force(int /*vflag*/) double *energy = atom->esph; double *temperature = atom->temperature; int *type = atom->type; + int *status = atom->status; int nlocal = atom->nlocal; int nall = nlocal + atom->nghost; @@ -444,6 +445,11 @@ void FixRHEOThermal::pre_force(int /*vflag*/) } } } + + // Add temporary options, wiped by preceding fix rheo preforce + for (int i = 0; i < nall; i++) + if (status[i] & STATUS_SOLID) + status[i] |= STATUS_NO_SHIFT; } /* ---------------------------------------------------------------------- */ @@ -481,39 +487,79 @@ void FixRHEOThermal::break_bonds() tagint **bond_atom = atom->bond_atom; int *num_bond = atom->num_bond; - int nlocal = atom->nlocal; + int **bondlist = neighbor->bondlist; + int nbondlist = neighbor->nbondlist; + int nlocal = atom->nlocal; + int nall = nlocal + atom->nghost; + + // Rapidly delete all bonds for local atoms that melt (no shifting) for (int i = 0; i < nlocal; i++) { + if (!(status[i] & STATUS_MELTING)) continue; for (m = 0; m < num_bond[i]; m++) { j = atom->map(bond_atom[i][m]); - if (!(status[i] & STATUS_MELTING) && !(status[j] & STATUS_MELTING)) continue; + bond_type[i][m] = 0; if (n_histories > 0) for (auto &ihistory: histories) - dynamic_cast(ihistory)->delete_history(i, num_bond[i] - 1); + dynamic_cast(ihistory)->delete_history(i, m); - if (fix_update_special_bonds) fix_update_special_bonds->add_broken_bond(i, j); + if (fix_update_special_bonds) + fix_update_special_bonds->add_broken_bond(i, j); + } + num_bond[i] = 0; + } - // For non-melting neighbors, selectively delete bond if necessary - if (j >= nlocal || (status[j] & STATUS_MELTING)) continue; - for (n = 0; n < num_bond[j]; n++) { - if (bond_atom[j][n] == tag[i]) { - bond_type[j][n] = 0; - nmax = num_bond[j] - 1; - bond_type[j][n] = bond_type[j][nmax]; - bond_atom[j][n] = bond_atom[j][nmax]; - if (n_histories > 0) { + // Update bond list and break solid-melted bonds + for (n = 0; n < nbondlist; n++) { + + // skip bond if already broken + if (bondlist[n][2] <= 0) continue; + i = bondlist[n][0]; + j = bondlist[n][1]; + + if (!(status[i] & STATUS_MELTING) && !(status[j] & STATUS_MELTING)) continue; + + bondlist[n][2] = 0; + + // Delete bonds for non-melted local atoms (shifting) + if (i < nlocal) { + for (m = 0; m < num_bond[i]; m++) { + if (bond_atom[i][m] == tag[j]) { + nmax = num_bond[i] - 1; + bond_type[i][m] = bond_type[i][nmax]; + bond_atom[i][m] = bond_atom[i][nmax]; + if (n_histories > 0) for (auto &ihistory: histories) { - dynamic_cast(ihistory)->shift_history(j, n, nmax); - dynamic_cast(ihistory)->delete_history(j, nmax); + auto fix_bond_history = dynamic_cast (ihistory); + fix_bond_history->shift_history(i, m, nmax); + fix_bond_history->delete_history(i, nmax); } - } + bond_type[i][nmax] = 0; + num_bond[i]--; + break; + } + } + } + + if (j < nlocal) { + for (m = 0; m < num_bond[j]; m++) { + if (bond_atom[j][m] == tag[i]) { + nmax = num_bond[j] - 1; + bond_type[j][m] = bond_type[j][nmax]; + bond_atom[j][m] = bond_atom[j][nmax]; + if (n_histories > 0) + for (auto &ihistory: histories) { + auto fix_bond_history = dynamic_cast (ihistory); + fix_bond_history->shift_history(j, m, nmax); + fix_bond_history->delete_history(j, nmax); + } + bond_type[j][nmax] = 0; num_bond[j]--; break; } } } - num_bond[i] = 0; } } From 010a4c076bf72e5e546d7e9ffc11a62bbaa1b2bb Mon Sep 17 00:00:00 2001 From: jtclemm Date: Thu, 28 Mar 2024 11:31:21 -0600 Subject: [PATCH 072/158] Prototyping oxidation --- doc/src/Commands_bond.rst | 1 + doc/src/Commands_compute.rst | 1 + doc/src/Commands_fix.rst | 5 + doc/src/Commands_pair.rst | 2 + doc/src/bond_rheo_shell.rst | 226 +++++++++++++ doc/src/fix_rheo_oxidation.rst | 81 +++++ src/BPM/bond_bpm.cpp | 4 +- src/RHEO/bond_rheo_shell.cpp | 507 ++++++++++++++++++++++++++++ src/RHEO/bond_rheo_shell.h | 55 +++ src/RHEO/compute_rheo_interface.cpp | 3 +- src/RHEO/fix_rheo_oxidation.cpp | 190 +++++++++++ src/RHEO/fix_rheo_oxidation.h | 49 +++ src/RHEO/fix_rheo_thermal.cpp | 11 + src/bond_hybrid.cpp | 5 + 14 files changed, 1137 insertions(+), 3 deletions(-) create mode 100644 doc/src/bond_rheo_shell.rst create mode 100644 doc/src/fix_rheo_oxidation.rst create mode 100644 src/RHEO/bond_rheo_shell.cpp create mode 100644 src/RHEO/bond_rheo_shell.h create mode 100644 src/RHEO/fix_rheo_oxidation.cpp create mode 100644 src/RHEO/fix_rheo_oxidation.h diff --git a/doc/src/Commands_bond.rst b/doc/src/Commands_bond.rst index aaf706b5df..ee03b7e245 100644 --- a/doc/src/Commands_bond.rst +++ b/doc/src/Commands_bond.rst @@ -54,6 +54,7 @@ OPT. * :doc:`oxdna2/fene ` * :doc:`oxrna2/fene ` * :doc:`quartic (o) ` + * :doc:`rheo/shell ` * :doc:`special ` * :doc:`table (o) ` diff --git a/doc/src/Commands_compute.rst b/doc/src/Commands_compute.rst index 0352ad5374..394a5bee3a 100644 --- a/doc/src/Commands_compute.rst +++ b/doc/src/Commands_compute.rst @@ -122,6 +122,7 @@ KOKKOS, o = OPENMP, t = OPT. * :doc:`reduce ` * :doc:`reduce/chunk ` * :doc:`reduce/region ` + * :doc:`rheo/property/atom ` * :doc:`rigid/local ` * :doc:`saed ` * :doc:`slcsa/atom ` diff --git a/doc/src/Commands_fix.rst b/doc/src/Commands_fix.rst index e89e302673..7053c4809a 100644 --- a/doc/src/Commands_fix.rst +++ b/doc/src/Commands_fix.rst @@ -203,6 +203,11 @@ OPT. * :doc:`reaxff/species (k) ` * :doc:`recenter ` * :doc:`restrain ` + * :doc:`rheo ` + * :doc:`rheo/oxidation ` + * :doc:`rheo/pressure ` + * :doc:`rheo/thermal ` + * :doc:`rheo/viscosity ` * :doc:`rhok ` * :doc:`rigid (o) ` * :doc:`rigid/meso ` diff --git a/doc/src/Commands_pair.rst b/doc/src/Commands_pair.rst index e7761e7bee..9b56e92819 100644 --- a/doc/src/Commands_pair.rst +++ b/doc/src/Commands_pair.rst @@ -257,6 +257,8 @@ OPT. * :doc:`reaxff (ko) ` * :doc:`rebo (io) ` * :doc:`resquared (go) ` + * :doc:`rheo ` + * :doc:`rheo/solid ` * :doc:`saip/metal (t) ` * :doc:`sdpd/taitwater/isothermal ` * :doc:`smatb ` diff --git a/doc/src/bond_rheo_shell.rst b/doc/src/bond_rheo_shell.rst new file mode 100644 index 0000000000..7f6bab1eab --- /dev/null +++ b/doc/src/bond_rheo_shell.rst @@ -0,0 +1,226 @@ +.. index:: bond_style rheo/shell + +bond_style rheo/shell command +============================= + +Syntax +"""""" + +.. code-block:: LAMMPS + + bond_style rheo/shell keyword value attribute1 attribute2 ... + +* optional keyword = *overlay/pair* or *store/local* or *smooth* or *break* + + .. parsed-literal:: + + *store/local* values = fix_ID N attributes ... + * fix_ID = ID of associated internal fix to store data + * N = prepare data for output every this many timesteps + * attributes = zero or more of the below attributes may be appended + + *id1, id2* = IDs of 2 atoms in the bond + *time* = the timestep the bond broke + *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 = *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 the reference length + + *break* value = *yes* or *no* + indicates whether bonds break during a run + +Examples +"""""""" + +.. code-block:: LAMMPS + + bond_style bpm/spring + bond_coeff 1 1.0 0.05 0.1 + + bond_style bpm/spring myfix 1000 time id1 id2 + dump 1 all local 1000 dump.broken f_myfix[1] f_myfix[2] f_myfix[3] + dump_modify 1 write_header no + +Description +""""""""""" + +.. versionadded:: 4May2022 + +The *bpm/spring* bond style computes forces based on +deviations from the initial reference state of the two atoms. The +reference state is stored by each bond when it is first computed in +the setup of a run. Data is then preserved across run commands and is +written to :doc:`binary restart files ` such that restarting +the system will not reset the reference state of a bond. + +This bond style only applies central-body forces which conserve the +translational and rotational degrees of freedom of a bonded set of +particles based on a model described by Clemmer and Robbins +:ref:`(Clemmer) `. The force has a magnitude of + +.. math:: + + F = k (r - r_0) w + +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 +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) `: + +.. math:: + + F_D = - \gamma w (\hat{r} \bullet \vec{v}) + +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 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:: + + w = 1.0 - \left( \frac{r - r_0}{r_0 \epsilon_c} \right)^8 . + +The following coefficients must be defined for each bond type via the +:doc:`bond_coeff ` command as in the example above, or in +the data file or restart files read by the :doc:`read_data +` or :doc:`read_restart ` commands: + +* :math:`k` (force/distance units) +* :math:`\epsilon_c` (unit less) +* :math:`\gamma` (force/velocity units) + +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 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. + +.. versionadded:: 28Mar2023 + +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 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 +and transferred to an internal fix labeled *fix_ID*. This allows the +local data to be accessed by other LAMMPS commands. Following this optional +keyword, a list of one or more attributes is specified. These include the +IDs of the two atoms in the bond. The other attributes for the two atoms +include the timestep during which the bond broke and the current/initial +center of mass position of the two atoms. + +Data is continuously accumulated over intervals of *N* +timesteps. At the end of each interval, all of the saved accumulated +data is deleted to make room for new data. Individual datum may +therefore persist anywhere between *1* to *N* timesteps depending on +when they are saved. This data can be accessed using the *fix_ID* and a +:doc:`dump local ` command. To ensure all data is output, +the dump frequency should correspond to the same interval of *N* +timesteps. A dump frequency of an integer multiple of *N* can be used +to regularly output a sample of the accumulated data. + +Note that when unbroken bonds are dumped to a file via the +:doc:`dump local ` command, bonds with type 0 (broken bonds) +are not included. +The :doc:`delete_bonds ` command can also be used to +query the status of broken bonds or permanently delete them, e.g.: + +.. code-block:: LAMMPS + + delete_bonds all stats + delete_bonds all bond 0 remove + +---------- + +Restart and other info +""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" + +This bond style writes the reference state of each bond to +:doc:`binary restart files `. Loading a restart +file will properly restore bonds. However, the reference state is NOT +written to data files. Therefore reading a data file will not +restore bonds and will cause their reference states to be redefined. + +If the *store/local* option is used, an internal fix will calculate +a local vector or local array depending on the number of input values. +The length of the vector or number of rows in the array is the number +of recorded, broken bonds. If a single input is specified, a local +vector is produced. If two or more inputs are specified, a local array +is produced where the number of columns = the number of inputs. The +vector or array can be accessed by any command that uses local values +from a compute as input. See the :doc:`Howto output ` page +for an overview of LAMMPS output options. + +The vector or array will be floating point values that correspond to +the specified attribute. + +The single() function of this bond style returns 0.0 for the energy +of a bonded interaction, since energy is not conserved in these +dissipative potentials. The single() function also calculates an +extra bond quantity, the initial distance :math:`r_0`. This +extra quantity can be accessed by the +:doc:`compute bond/local ` command as *b1*\ . + +Restrictions +"""""""""""" + +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 between bonded atoms are to be disabled, +this bond style requires setting + +.. code-block:: LAMMPS + + special_bonds lj 0 1 1 coul 1 1 1 + +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 + + special_bonds lj/coul 1 1 1 + +Related commands +"""""""""""""""" + +:doc:`bond_coeff `, :doc:`pair bpm/spring ` + +Default +""""""" + +The option defaults are *overlay/pair* = *no*, *smooth* = *yes*, *normalize* = *no*, and *break* = *yes* + +---------- + +.. _fragment-Clemmer: + +**(Clemmer)** Clemmer and Robbins, Phys. Rev. Lett. (2022). + +.. _Groot4: + +**(Groot)** Groot and Warren, J Chem Phys, 107, 4423-35 (1997). diff --git a/doc/src/fix_rheo_oxidation.rst b/doc/src/fix_rheo_oxidation.rst new file mode 100644 index 0000000000..a747ec582f --- /dev/null +++ b/doc/src/fix_rheo_oxidation.rst @@ -0,0 +1,81 @@ +.. index:: fix rheo/oxidation + +fix rheo/oxidation command +========================== + +Syntax +"""""" + +.. parsed-literal:: + + fix ID group-ID rheo/oxidation cut btype + +* ID, group-ID are documented in :doc:`fix ` command +* rheo/oxidation = style name of this fix command +* cut = maximum bond length (distance units) +* btype = type of bonds created + +Examples +"""""""" + +.. code-block:: LAMMPS + + fix 1 all rheo/oxidation 1.5 2 + +Description +""""""""""" + +This fix... + +Each list consists of a series of type +ranges separated by commas. The range can be specified as a +single numeric value, or a wildcard asterisk can be used to specify a range +of values. This takes the form "\*" or "\*n" or "n\*" or "m\*n". For +example, if M = the number of atom types, then an asterisk with no numeric +values means all types from 1 to M. A leading asterisk means all types +from 1 to n (inclusive). A trailing asterisk means all types from n to M +(inclusive). A middle asterisk means all types from m to n (inclusive). +Note that all atom types must be included in exactly one of the N collections. + +While the *Tfreeze* keyword is optional, the *conductivity* and +*specific/heat* keywords are mandatory. + +Multiple instances of this fix may be defined to apply different +properties to different groups. However, the union of fix groups +across all instances of fix rheo/thermal must cover all atoms. +If there are multiple instances of this fix, any intersections in +the fix groups will lead to incorrect thermal integration. + +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 global or per-atom quantities are stored +by this fix for access by various :doc:`output commands `. +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 `. + +Restrictions +"""""""""""" + +This fix must be used with an atom style that includes temperature, +heatflow, and conductivity such as atom_tyle rheo/thermal This fix +must be used in conjuction with :doc:`fix rheo ` with the +*thermal* setting. + +This fix is part of the RHEO package. It is only enabled if +LAMMPS was built with that package. See the :doc:`Build package ` page for more info. + +Related commands +"""""""""""""""" + +:doc:`fix rheo `, +:doc:`fix rheo/viscosity `, +:doc:`fix rheo/pressure `, +:doc:`pair rheo `, +:doc:`compute rheo/property/atom ` + +Default +""""""" + +none diff --git a/src/BPM/bond_bpm.cpp b/src/BPM/bond_bpm.cpp index b484df7fab..34554497ad 100644 --- a/src/BPM/bond_bpm.cpp +++ b/src/BPM/bond_bpm.cpp @@ -50,10 +50,10 @@ BondBPM::BondBPM(LAMMPS *_lmp) : // this is so final order of Modify:fix will conform to input script // BondHistory technically only needs this if updateflag = 1 - id_fix_dummy = utils::strdup("BPM_DUMMY"); + id_fix_dummy = utils::strdup(fmt::format("BPM_DUMMY_{}", instance_total)); modify->add_fix(fmt::format("{} all DUMMY ", id_fix_dummy)); - id_fix_dummy2 = utils::strdup("BPM_DUMMY2"); + id_fix_dummy2 = utils::strdup(fmt::format("BPM_DUMMY2_{}", instance_total)); modify->add_fix(fmt::format("{} all DUMMY ", id_fix_dummy2)); } diff --git a/src/RHEO/bond_rheo_shell.cpp b/src/RHEO/bond_rheo_shell.cpp new file mode 100644 index 0000000000..6a9f99d8b1 --- /dev/null +++ b/src/RHEO/bond_rheo_shell.cpp @@ -0,0 +1,507 @@ +/* ---------------------------------------------------------------------- + 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 "bond_rheo_shell.h" + +#include "atom.h" +#include "comm.h" +#include "domain.h" +#include "error.h" +#include "fix_bond_history.h" +#include "fix_rheo.h" +#include "fix_store_local.h" +#include "force.h" +#include "memory.h" +#include "modify.h" +#include "neighbor.h" +#include "update.h" + +#include +#include + +#define EPSILON 1e-10 + +using namespace LAMMPS_NS; +using namespace RHEO_NS; + +/* ---------------------------------------------------------------------- */ + +BondRHEOShell::BondRHEOShell(LAMMPS *_lmp) : + BondBPM(_lmp), k(nullptr), ecrit(nullptr), gamma(nullptr) +{ + partial_flag = 1; + + tform = rmax = -1; + + single_extra = 1; + svector = new double[1]; +} + +/* ---------------------------------------------------------------------- */ + +BondRHEOShell::~BondRHEOShell() +{ + delete[] svector; + + if (allocated) { + memory->destroy(setflag); + memory->destroy(k); + memory->destroy(ecrit); + memory->destroy(gamma); + } +} + +/* ---------------------------------------------------------------------- + Store data for a single bond - if bond added after LAMMPS init (e.g. pour) +------------------------------------------------------------------------- */ + +double BondRHEOShell::store_bond(int n, int i, int j) +{ + double **bondstore = fix_bond_history->bondstore; + tagint *tag = atom->tag; + + bondstore[n][0] = 0.0; + bondstore[n][1] = 0.0; + + if (i < atom->nlocal) { + for (int m = 0; m < atom->num_bond[i]; m++) { + if (atom->bond_atom[i][m] == tag[j]) { + fix_bond_history->update_atom_value(i, m, 0, 0.0); + fix_bond_history->update_atom_value(i, m, 1, 0.0); + } + } + } + + if (j < atom->nlocal) { + for (int m = 0; m < atom->num_bond[j]; m++) { + if (atom->bond_atom[j][m] == tag[i]) { + fix_bond_history->update_atom_value(j, m, 0, 0.0); + fix_bond_history->update_atom_value(j, m, 1, 0.0); + } + } + } + + return 0.0; +} + +/* ---------------------------------------------------------------------- + Store data for all bonds called once +------------------------------------------------------------------------- */ + +void BondRHEOShell::store_data() +{ + int i, j, m, type; + int **bond_type = atom->bond_type; + + for (i = 0; i < atom->nlocal; i++) { + for (m = 0; m < atom->num_bond[i]; m++) { + type = bond_type[i][m]; + + //Skip if bond was turned off + if (type < 0) continue; + + // map to find index n + j = atom->map(atom->bond_atom[i][m]); + if (j == -1) error->one(FLERR, "Atom missing in BPM bond"); + + fix_bond_history->update_atom_value(i, m, 0, 0.0); + fix_bond_history->update_atom_value(i, m, 1, 0.0); + } + } + + fix_bond_history->post_neighbor(); +} + +/* ---------------------------------------------------------------------- */ + +void BondRHEOShell::compute(int eflag, int vflag) +{ + + if (!fix_bond_history->stored_flag) { + fix_bond_history->stored_flag = true; + store_data(); + } + + int i1, i2, itmp, n, type; + double delx, dely, delz, delvx, delvy, delvz; + double e, rsq, r, r0, rinv, dr, fbond, dot, t; + double dt = update->dt; + + ev_init(eflag, vflag); + + double **x = atom->x; + double **v = atom->v; + double **f = atom->f; + tagint *tag = atom->tag; + int *status = atom->status; + int **bondlist = neighbor->bondlist; + int nbondlist = neighbor->nbondlist; + int nlocal = atom->nlocal; + int newton_bond = force->newton_bond; + + double **bondstore = fix_bond_history->bondstore; + + for (n = 0; n < nbondlist; n++) { + + // skip bond if already broken + if (bondlist[n][2] <= 0) continue; + + i1 = bondlist[n][0]; + i2 = bondlist[n][1]; + type = bondlist[n][2]; + r0 = bondstore[n][0]; + t = bondstore[n][1]; + + // Ensure pair is always ordered to ensure numerical operations + // are identical to minimize the possibility that a bond straddling + // an mpi grid (newton off) doesn't break on one proc but not the other + if (tag[i2] < tag[i1]) { + itmp = i1; + i1 = i2; + i2 = itmp; + } + + // If bond hasn't been set - set timer to zero + if (t < EPSILON || std::isnan(t)) r0 = store_bond(n, i1, i2); + + delx = x[i1][0] - x[i2][0]; + dely = x[i1][1] - x[i2][1]; + delz = x[i1][2] - x[i2][2]; + + rsq = delx * delx + dely * dely + delz * delz; + r = sqrt(rsq); + + // Bond has not yet formed, check if in range + update timer + if (t < tform) { + + // Check if eligible + if (r > rmax || !(status[i1] & STATUS_SURFACE) || !(status[i2] & STATUS_SURFACE)) { + bondlist[n][2] = 0; + process_ineligibility(i1, i2); + continue; + } + + // Check ellapsed time + bondstore[n][1] += dt; + if (bondstore[n][1] >= tform) { + bondstore[n][0] = r; + r0 = r; + } else { + continue; + } + } + + e = (r - r0) / r0; + if (fabs(e) > ecrit[type]) { + bondlist[n][2] = 0; + process_broken(i1, i2); + continue; + } + + rinv = 1.0 / r; + dr = r - r0; + fbond = 2 * k[type] * (-dr + dr * dr * dr / (r0 * r0 * ecrit[type] * ecrit[type])); + + delvx = v[i1][0] - v[i2][0]; + delvy = v[i1][1] - v[i2][1]; + delvz = v[i1][2] - v[i2][2]; + dot = delx * delvx + dely * delvy + delz * delvz; + fbond -= gamma[type] * dot * rinv; + fbond *= rinv; + + if (newton_bond || i1 < nlocal) { + f[i1][0] += delx * fbond; + f[i1][1] += dely * fbond; + f[i1][2] += delz * fbond; + } + + if (newton_bond || i2 < nlocal) { + f[i2][0] -= delx * fbond; + f[i2][1] -= dely * fbond; + f[i2][2] -= delz * fbond; + } + + if (evflag) ev_tally(i1, i2, nlocal, newton_bond, 0.0, fbond, delx, dely, delz); + } +} + +/* ---------------------------------------------------------------------- */ + +void BondRHEOShell::allocate() +{ + allocated = 1; + const int np1 = atom->nbondtypes + 1; + + memory->create(k, np1, "bond:k"); + memory->create(ecrit, np1, "bond:ecrit"); + memory->create(gamma, np1, "bond:gamma"); + + memory->create(setflag, np1, "bond:setflag"); + for (int i = 1; i < np1; i++) setflag[i] = 0; +} + +/* ---------------------------------------------------------------------- + set coeffs for one or more types +------------------------------------------------------------------------- */ + +void BondRHEOShell::coeff(int narg, char **arg) +{ + if (narg != 4) error->all(FLERR, "Incorrect args for bond coefficients"); + if (!allocated) allocate(); + + int ilo, ihi; + utils::bounds(FLERR, arg[0], 1, atom->nbondtypes, ilo, ihi, error); + + double k_one = utils::numeric(FLERR, arg[1], false, lmp); + double ecrit_one = utils::numeric(FLERR, arg[2], false, lmp); + double gamma_one = utils::numeric(FLERR, arg[3], false, lmp); + + int count = 0; + for (int i = ilo; i <= ihi; i++) { + k[i] = k_one; + ecrit[i] = ecrit_one; + gamma[i] = gamma_one; + setflag[i] = 1; + count++; + + if (1.0 + ecrit[i] > max_stretch) max_stretch = 1.0 + ecrit[i]; + } + + if (count == 0) error->all(FLERR, "Incorrect args for bond coefficients"); +} + +/* ---------------------------------------------------------------------- + check for correct settings and create fix +------------------------------------------------------------------------- */ + +void BondRHEOShell::init_style() +{ + if (comm->ghost_velocity == 0) + error->all(FLERR, "Bond rheo/shell requires ghost atoms store velocity"); + + if (!id_fix_bond_history) { + id_fix_bond_history = utils::strdup("HISTORY_RHEO_SHELL"); + fix_bond_history = dynamic_cast(modify->replace_fix( + id_fix_dummy2, fmt::format("{} all BOND_HISTORY 1 2", id_fix_bond_history), 1)); + delete[] id_fix_dummy2; + id_fix_dummy2 = nullptr; + } + + // Reproduce standard functions of BondBPM, removing special restrictions + // Since this bond is intended to be created by fix rheo/oxidation, it + // ignores special statuses + + if (id_fix_store_local) { + auto ifix = modify->get_fix_by_id(id_fix_store_local); + if (!ifix) error->all(FLERR, "Cannot find fix STORE/LOCAL id {}", id_fix_store_local); + if (strcmp(ifix->style, "STORE/LOCAL") != 0) + error->all(FLERR, "Incorrect fix style matched, not STORE/LOCAL: {}", ifix->style); + fix_store_local = dynamic_cast(ifix); + fix_store_local->nvalues = nvalues; + } + + id_fix_update = nullptr; + + if (force->angle || force->dihedral || force->improper) + error->all(FLERR, "Bond style rheo/shell cannot be used with 3,4-body interactions"); + if (atom->molecular == 2) + error->all(FLERR, "Bond style rheo/shell cannot be used with atom style template"); +} + +/* ---------------------------------------------------------------------- */ + +void BondRHEOShell::settings(int narg, char **arg) +{ + BondBPM::settings(narg, arg); + + int iarg; + for (std::size_t i = 0; i < leftover_iarg.size(); i++) { + iarg = leftover_iarg[i]; + if (strcmp(arg[iarg], "t/form") == 0) { + if (iarg + 1 > narg) error->all(FLERR, "Illegal bond rheo/shell command, missing option for t/form"); + tform = utils::numeric(FLERR, arg[iarg + 1], false, lmp); + if (tform < 0.0) error->all(FLERR, "Illegal bond rheo/shell value for t/form, {}", tform); + i += 1; + } else if (strcmp(arg[iarg], "r/max") == 0) { + if (iarg + 1 > narg) error->all(FLERR, "Illegal bond rheo/shell command, missing option for r/max"); + rmax = utils::numeric(FLERR, arg[iarg + 1], false, lmp); + if (rmax < 0.0) error->all(FLERR, "Illegal bond rheo/shell value for r/max, {}", rmax); + i += 1; + } else { + error->all(FLERR, "Illegal bond rheo/shell command, invalid argument {}", arg[iarg]); + } + } + + if (tform < 0.0) + error->all(FLERR, "Illegal bond rheo/shell command, must specify t/form"); + if (rmax < 0.0) + error->all(FLERR, "Illegal bond rheo/shell command, must specify r/max"); +} + + +/* ---------------------------------------------------------------------- + used to check bond communiction cutoff - not perfect, estimates based on local-local only +------------------------------------------------------------------------- */ + +double BondRHEOShell::equilibrium_distance(int /*i*/) +{ + // Divide out heuristic prefactor added in comm class + return max_stretch * rmax / 1.5; +} + +/* ---------------------------------------------------------------------- + proc 0 writes out coeffs to restart file +------------------------------------------------------------------------- */ + +void BondRHEOShell::write_restart(FILE *fp) +{ + BondBPM::write_restart(fp); + write_restart_settings(fp); + + fwrite(&k[1], sizeof(double), atom->nbondtypes, fp); + fwrite(&ecrit[1], sizeof(double), atom->nbondtypes, fp); + fwrite(&gamma[1], sizeof(double), atom->nbondtypes, fp); +} + +/* ---------------------------------------------------------------------- + proc 0 reads coeffs from restart file, bcasts them +------------------------------------------------------------------------- */ + +void BondRHEOShell::read_restart(FILE *fp) +{ + BondBPM::read_restart(fp); + read_restart_settings(fp); + allocate(); + + if (comm->me == 0) { + utils::sfread(FLERR, &k[1], sizeof(double), atom->nbondtypes, fp, nullptr, error); + utils::sfread(FLERR, &ecrit[1], sizeof(double), atom->nbondtypes, fp, nullptr, error); + utils::sfread(FLERR, &gamma[1], sizeof(double), atom->nbondtypes, fp, nullptr, error); + } + MPI_Bcast(&k[1], atom->nbondtypes, MPI_DOUBLE, 0, world); + MPI_Bcast(&ecrit[1], atom->nbondtypes, MPI_DOUBLE, 0, world); + MPI_Bcast(&gamma[1], atom->nbondtypes, MPI_DOUBLE, 0, world); + + for (int i = 1; i <= atom->nbondtypes; i++) setflag[i] = 1; +} + +/* ---------------------------------------------------------------------- + proc 0 writes to restart file + ------------------------------------------------------------------------- */ + +void BondRHEOShell::write_restart_settings(FILE *fp) +{ + fwrite(&tform, sizeof(double), 1, fp); + fwrite(&rmax, sizeof(double), 1, fp); +} + +/* ---------------------------------------------------------------------- + proc 0 reads from restart file, bcasts + ------------------------------------------------------------------------- */ + +void BondRHEOShell::read_restart_settings(FILE *fp) +{ + if (comm->me == 0) { + utils::sfread(FLERR, &tform, sizeof(double), 1, fp, nullptr, error); + utils::sfread(FLERR, &rmax, sizeof(double), 1, fp, nullptr, error); + } + MPI_Bcast(&tform, 1, MPI_DOUBLE, 0, world); + MPI_Bcast(&rmax, 1, MPI_DOUBLE, 0, world); +} + +/* ---------------------------------------------------------------------- */ + +double BondRHEOShell::single(int type, double rsq, int i, int j, double &fforce) +{ + if (type <= 0) return 0.0; + + double r0, t; + for (int n = 0; n < atom->num_bond[i]; n++) { + if (atom->bond_atom[i][n] == atom->tag[j]) { + r0 = fix_bond_history->get_atom_value(i, n, 0); + t = fix_bond_history->get_atom_value(i, n, 1); + } + } + + svector[1] = t; + if (t < tform) return 0.0; + + double r = sqrt(rsq); + double rinv = 1.0 / r; + double dr = r0 - r; + fforce = 2 * k[type] * (dr + dr * dr * dr / (r0 * r0 * ecrit[type] * ecrit[type])); + + double **x = atom->x; + double **v = atom->v; + double delx = x[i][0] - x[j][0]; + double dely = x[i][1] - x[j][1]; + double delz = x[i][2] - x[j][2]; + double delvx = v[i][0] - v[j][0]; + double delvy = v[i][1] - v[j][1]; + double delvz = v[i][2] - v[j][2]; + double dot = delx * delvx + dely * delvy + delz * delvz; + fforce -= gamma[type] * dot * rinv; + fforce *= rinv; + + // set single_extra quantities + + svector[0] = r0; + + return 0.0; +} + +/* ---------------------------------------------------------------------- + Similar to BondBPM->process_broken(), but don't send to FixStoreLocal + ------------------------------------------------------------------------- */ + +void BondRHEOShell::process_ineligibility(int i, int j) +{ + // Manually search and remove from atom arrays + int m, n; + int nlocal = atom->nlocal; + + tagint *tag = atom->tag; + tagint **bond_atom = atom->bond_atom; + int **bond_type = atom->bond_type; + int *num_bond = atom->num_bond; + + if (i < nlocal) { + for (m = 0; m < num_bond[i]; m++) { + if (bond_atom[i][m] == tag[j]) { + bond_type[i][m] = 0; + n = num_bond[i]; + bond_type[i][m] = bond_type[i][n - 1]; + bond_atom[i][m] = bond_atom[i][n - 1]; + fix_bond_history->shift_history(i, m, n - 1); + fix_bond_history->delete_history(i, n - 1); + num_bond[i]--; + break; + } + } + } + + if (j < nlocal) { + for (m = 0; m < num_bond[j]; m++) { + if (bond_atom[j][m] == tag[i]) { + bond_type[j][m] = 0; + n = num_bond[j]; + bond_type[j][m] = bond_type[j][n - 1]; + bond_atom[j][m] = bond_atom[j][n - 1]; + fix_bond_history->shift_history(j, m, n - 1); + fix_bond_history->delete_history(j, n - 1); + num_bond[j]--; + break; + } + } + } +} diff --git a/src/RHEO/bond_rheo_shell.h b/src/RHEO/bond_rheo_shell.h new file mode 100644 index 0000000000..562be6d9a6 --- /dev/null +++ b/src/RHEO/bond_rheo_shell.h @@ -0,0 +1,55 @@ +/* -*- 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 BOND_CLASS +// clang-format off +BondStyle(rheo/shell,BondRHEOShell); +// clang-format on +#else + +#ifndef LMP_BOND_RHEO_SHELL_H +#define LMP_BOND_RHEO_SHELL_H + +#include "bond_bpm.h" + +namespace LAMMPS_NS { + +class BondRHEOShell : public BondBPM { + public: + BondRHEOShell(class LAMMPS *); + ~BondRHEOShell() override; + void compute(int, int) override; + void coeff(int, char **) override; + void init_style() override; + void settings(int, char **) override; + double equilibrium_distance(int) override; + void write_restart(FILE *) override; + void read_restart(FILE *) override; + void write_restart_settings(FILE *) override; + void read_restart_settings(FILE *) override; + double single(int, double, int, int, double &) override; + + protected: + double *k, *ecrit, *gamma; + double tform, rmax; + + void process_ineligibility(int, int); + void allocate(); + void store_data(); + double store_bond(int, int, int); +}; + +} // namespace LAMMPS_NS + +#endif +#endif diff --git a/src/RHEO/compute_rheo_interface.cpp b/src/RHEO/compute_rheo_interface.cpp index 3cb2fcf058..31930d655d 100644 --- a/src/RHEO/compute_rheo_interface.cpp +++ b/src/RHEO/compute_rheo_interface.cpp @@ -329,7 +329,8 @@ double ComputeRHEOInterface::correct_rho(int i, int j) { // i is wall, j is fluid //In future may depend on atom type j's pressure equation - return atom->rho[i]; + int itype = atom->type[i]; + return MAX(rho0[itype], atom->rho[i]); } /* ---------------------------------------------------------------------- */ diff --git a/src/RHEO/fix_rheo_oxidation.cpp b/src/RHEO/fix_rheo_oxidation.cpp new file mode 100644 index 0000000000..bd7babedbb --- /dev/null +++ b/src/RHEO/fix_rheo_oxidation.cpp @@ -0,0 +1,190 @@ +/* ---------------------------------------------------------------------- + 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 authors: + Joel Clemmer (SNL) +----------------------------------------------------------------------- */ + +#include "fix_rheo_oxidation.h" + +#include "atom.h" +#include "atom_vec.h" +#include "error.h" +#include "fix_rheo.h" +#include "force.h" +#include "modify.h" +#include "neighbor.h" +#include "neigh_list.h" +#include "neigh_request.h" + +using namespace LAMMPS_NS; +using namespace RHEO_NS; +using namespace FixConst; +enum {NONE, CONSTANT}; + +/* ---------------------------------------------------------------------- */ + +FixRHEOOxidation::FixRHEOOxidation(LAMMPS *lmp, int narg, char **arg) : + Fix(lmp, narg, arg) //, fix_bond_history(nullptr) +{ + if (narg != 5) error->all(FLERR,"Illegal fix command"); + + cut = utils::numeric(FLERR, arg[3], false, lmp); + if (cut <= 0.0) error->all(FLERR, "Illegal bond cutoff {} in fix rheo/oxidation", cut); + + btype = utils::inumeric(FLERR, arg[4], false, lmp); + if (btype < 1 || btype > atom->nbondtypes) error->all(FLERR, "Illegal value {} for bond type in fix rheo/oxidation", btype); + + cutsq = cut * cut; +} + +/* ---------------------------------------------------------------------- */ + +FixRHEOOxidation::~FixRHEOOxidation() +{ +} + +/* ---------------------------------------------------------------------- */ + +int FixRHEOOxidation::setmask() +{ + int mask = 0; + mask |= POST_INTEGRATE; + return mask; +} + +/* ---------------------------------------------------------------------- */ + +void FixRHEOOxidation::init() +{ + auto fixes = modify->get_fix_by_style("^rheo$"); + if (fixes.size() == 0) error->all(FLERR, "Need to define fix rheo to use fix rheo/oxidation"); + class FixRHEO *fix_rheo = dynamic_cast(fixes[0]); + double cut_kernel = fix_rheo->h; + + if (cut > cut_kernel) + error->all(FLERR, "Bonding length exceeds kernel cutoff"); + + if (!force->bond) error->all(FLERR, "Must define a bond style with fix rheo/oxidation"); + if (!atom->avec->bonds_allow) error->all(FLERR, "Fix rheo/oxidation requires atom bonds"); + + //// find instances of bond history to delete data + //histories = modify->get_fix_by_style("BOND_HISTORY"); + //for (auto &ihistory: histories) + // if (strcmp(histories[i]->id, "HISTORY_RHEO_SHELL") == 0) + // fix_bond_history = dynamic_cast(ihistory); +// + //if (!fix_bond_history) + // error->all(FLERR, "Must define bond style rheo/shell to use fix rheo/oxidation"); + + // need a half neighbor list + auto req = neighbor->add_request(this, NeighConst::REQ_DEFAULT); + req->set_cutoff(cut); +} + +/* ---------------------------------------------------------------------- */ + +void FixRHEOOxidation::init_list(int /*id*/, NeighList *ptr) +{ + list = ptr; +} + +/* ---------------------------------------------------------------------- */ + +void FixRHEOOxidation::post_integrate() +{ + int i, j, n, ii, jj, inum, jnum, bflag; + int *ilist, *jlist, *numneigh, **firstneigh; + double xtmp, ytmp, ztmp, delx, dely, delz, rsq; + tagint tagi, tagj; + + int nlocal = atom->nlocal; + int newton_bond = force->newton_bond; + + tagint *tag = atom->tag; + tagint **bond_atom = atom->bond_atom; + int *status = atom->status; + int **bond_type = atom->bond_type; + int *num_bond = atom->num_bond; + double **x = atom->x; + + inum = list->inum; + ilist = list->ilist; + numneigh = list->numneigh; + firstneigh = list->firstneigh; + + // loop over neighbors of my atoms + for (ii = 0; ii < inum; ii++) { + i = ilist[ii]; + if (!(status[i] & STATUS_SURFACE)) continue; + + tagi = tag[i]; + xtmp = x[i][0]; + ytmp = x[i][1]; + ztmp = x[i][2]; + + jlist = firstneigh[i]; + jnum = numneigh[i]; + + for (jj = 0; jj < jnum; jj++) { + j = jlist[jj]; + j &= NEIGHMASK; + + if (!(status[j] & STATUS_SURFACE)) continue; + + tagj = tag[j]; + delx = xtmp - x[j][0]; + dely = ytmp - x[j][1]; + delz = ztmp - x[j][2]; + rsq = delx * delx + dely * dely + delz * delz; + if (rsq > cutsq) continue; + + // Check if already have an oxide bond + bflag = 0; + for (n = 0; n < num_bond[i]; n++) { + if (bond_type[i][n] == btype && bond_atom[i][n] == tagj) { + bflag = 1; + break; + } + } + if (bflag) continue; + + for (n = 0; n < num_bond[j]; n++) { + if (bond_type[j][n] == btype && bond_atom[j][n] == tagi) { + bflag = 1; + break; + } + } + if (bflag) continue; + + // Add bonds to owned atoms + // If newton bond, add to both, otherwise add to whichever has a smaller tag + if (i < nlocal && (!newton_bond || tagi < tagj)) { + if (num_bond[i] == atom->bond_per_atom) + error->one(FLERR,"New bond exceeded bonds per atom in fix rheo/oxidation for atom {}", tagi); + bond_type[i][num_bond[i]] = btype; + bond_atom[i][num_bond[i]] = tagj; + num_bond[i]++; + } + + if (j < nlocal && (!newton_bond || tagj < tagi)) { + if (num_bond[j] == atom->bond_per_atom) + error->one(FLERR,"New bond exceeded bonds per atom in fix rheo/oxidation for atom {}", tagj); + bond_type[j][num_bond[j]] = btype; + bond_atom[j][num_bond[j]] = tagi; + num_bond[j]++; + } + } + } +} diff --git a/src/RHEO/fix_rheo_oxidation.h b/src/RHEO/fix_rheo_oxidation.h new file mode 100644 index 0000000000..4c81605611 --- /dev/null +++ b/src/RHEO/fix_rheo_oxidation.h @@ -0,0 +1,49 @@ +/* -*- 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(rheo/oxidation,FixRHEOOxidation) +// clang-format on +#else + +#ifndef LMP_FIX_RHEO_OXIDATION_H +#define LMP_FIX_RHEO_OXIDATION_H + +#include "fix.h" + +#include + +namespace LAMMPS_NS { + +class FixRHEOOxidation : public Fix { + public: + FixRHEOOxidation(class LAMMPS *, int, char **); + ~FixRHEOOxidation() override; + int setmask() override; + void init() override; + void init_list(int, class NeighList *) override; + void post_integrate() override; + + private: + int btype; + double cut, cutsq; + class NeighList *list; + + //class FixBondHistory *fix_bond_history; +}; + +} // namespace LAMMPS_NS + +#endif +#endif diff --git a/src/RHEO/fix_rheo_thermal.cpp b/src/RHEO/fix_rheo_thermal.cpp index 0640dd6827..c6d10bcc79 100644 --- a/src/RHEO/fix_rheo_thermal.cpp +++ b/src/RHEO/fix_rheo_thermal.cpp @@ -271,7 +271,12 @@ void FixRHEOThermal::init() req->set_cutoff(cut_kernel); // find instances of bond history to delete data + // skip history for shell, only exception histories = modify->get_fix_by_style("BOND_HISTORY"); + if (n_histories > 0) + for (int i = 0; i < histories.size(); i++) + if (strcmp(histories[i]->id, "HISTORY_RHEO_SHELL") == 0) + histories.erase(histories.begin() + i); n_histories = histories.size(); } } @@ -644,6 +649,8 @@ double FixRHEOThermal::calc_cv(int i, int itype) if (cv_style[itype] == CONSTANT) { return cv[itype]; } + + return 0.0; } /* ---------------------------------------------------------------------- */ @@ -653,6 +660,8 @@ double FixRHEOThermal::calc_Tc(int i, int itype) if (Tc_style[itype] == CONSTANT) { return Tc[itype]; } + + return 0.0; } /* ---------------------------------------------------------------------- */ @@ -662,6 +671,8 @@ double FixRHEOThermal::calc_L(int i, int itype) if (L_style[itype] == CONSTANT) { return L[itype]; } + + return 0.0; } /* ---------------------------------------------------------------------- */ diff --git a/src/bond_hybrid.cpp b/src/bond_hybrid.cpp index 4e477ab3a6..5f84db1886 100644 --- a/src/bond_hybrid.cpp +++ b/src/bond_hybrid.cpp @@ -259,8 +259,13 @@ void BondHybrid::flags() if (styles[m]) comm_forward = MAX(comm_forward, styles[m]->comm_forward); if (styles[m]) comm_reverse = MAX(comm_reverse, styles[m]->comm_reverse); if (styles[m]) comm_reverse_off = MAX(comm_reverse_off, styles[m]->comm_reverse_off); + if (styles[m]) partial_flag = MAX(partial_flag, styles[m]->partial_flag); } + for (m = 0; m < nstyles; m++) + if (styles[m]->partial_flag != partial_flag) + error->all(FLERR, "Cannot hybridize bond styles with different topology settings"); + init_svector(); } From 7ea0dc3996db3e9315d06fae83162ec2990ad114 Mon Sep 17 00:00:00 2001 From: jtclemm Date: Fri, 29 Mar 2024 19:00:14 -0600 Subject: [PATCH 073/158] Adding more oxidation features + doc pages --- doc/src/Howto_rheo.rst | 99 +++++++++++++++++++++- doc/src/Packages_details.rst | 36 ++++++++ doc/src/Packages_list.rst | 5 ++ doc/src/fix_rheo.rst | 108 ++++++++++++++++++++---- doc/src/pair_rheo.rst | 26 +++++- src/RHEO/atom_vec_rheo.cpp | 2 +- src/RHEO/atom_vec_rheo_thermal.cpp | 2 +- src/RHEO/bond_rheo_shell.cpp | 80 ++++++++++++++++++ src/RHEO/bond_rheo_shell.h | 6 ++ src/RHEO/compute_rheo_grad.cpp | 2 +- src/RHEO/compute_rheo_kernel.cpp | 2 +- src/RHEO/compute_rheo_property_atom.cpp | 7 +- src/RHEO/compute_rheo_property_atom.h | 3 +- src/RHEO/compute_rheo_rho_sum.cpp | 5 ++ src/RHEO/compute_rheo_vshift.cpp | 2 + src/RHEO/fix_rheo.cpp | 2 +- src/RHEO/fix_rheo.h | 1 + src/RHEO/fix_rheo_oxidation.cpp | 29 ++++++- src/RHEO/fix_rheo_oxidation.h | 3 + src/RHEO/fix_rheo_pressure.cpp | 2 +- src/RHEO/fix_rheo_thermal.cpp | 35 +++++--- src/RHEO/fix_rheo_viscosity.cpp | 2 +- src/RHEO/pair_rheo.cpp | 2 +- src/RHEO/pair_rheo_solid.cpp | 5 ++ 24 files changed, 423 insertions(+), 43 deletions(-) diff --git a/doc/src/Howto_rheo.rst b/doc/src/Howto_rheo.rst index c55631455b..146716ba18 100644 --- a/doc/src/Howto_rheo.rst +++ b/doc/src/Howto_rheo.rst @@ -1,4 +1,99 @@ Reproducing hydrodynamics and elastic objects (RHEO) -====================== +==================================================== -Text +The RHEO package is built around an implementation of smoothed particle +hydrodynamics (SPH) coupled to the :doc:`BPM package ` to model +solid elements of a system. The SPH solver supports many advanced options +including reproducing kernels, particle shifting, free surface identification, +and solid surface reconstruction. To model fluid-solid systems, the status of +particles can dynamically change between a fluid and solid state, e.g. during +melting/solidification, which determines how they interact and their physical +behavior. The package is designed with modularity in mind, so one can easily +turn various features on/off, adjust physical details of the system, or +develop new capabilities. Additional numerical details can be found in +:ref:`(Palermo) ` and :ref:`(Clemmer) `. + +---------- + +At the core of the package is :doc:`fix rheo ` which integrates +particle trajectories and controls many optional features (e.g. the use +of reproducing kernels). In conjunction to fix rheo, one must specify an +instance of :doc:`fix rheo/pressure ` and +:doc:`fix rheo/viscosity ` to define a pressure equation +of state and viscosity model, respectively. Optionally, one can model +a heat equation with :doc:`fix rheo/thermal`, which also allows the user +to specify equations for a particle's thermal conductivity, specific heat, +latent heat, and melting temperature. Fix rheo must be defined prior to all +other RHEO fixes. + +Typically, RHEO requires atom style rheo. In addition to typical atom +properties like positions and forces, particles store a local density, +viscosity, pressure, and status. If thermal evolution is modeled, one must +use atom style rheo/thermal which also include a local temperature and +conductivity. The status variable uses bitmasking to track various +properties of a particle such as its current phase (fluid or solid) and its +location relative to a surface. Many of these properties (and others) can +be easily accessed using +:doc:`compute rheo/property/atom `. + +Fluid interactions, including pressure forces, viscous forces, and heat exchange, +are calculated using :doc:`pair rheo `. Unlike typical pair styles, +pair rheo ignores the :doc:`special bond ` settings. Instead, +it determines whether to calculate forces based on the status of particles: +hydrodynamic forces are only calculated if a fluid particle is involved. + +---------- + +To model elastic objects, there are current two mechanisms in RHEO, one designed +for bulk solid bodies and the other for thin shells. Both mechanisms rely on +overlaying bonds and therefore require a hybrid of atom style bond and rheo +(or rheo/thermal). + +To create an elastic solid body, one has to (a) change the status of constituent +particles to solid (e.g. with the :doc:`set ` command), (b) create bpm +bonds between the particles (see the :doc:`bpm howto ` page for +more details), and (c) use :doc:`pair rheo/solid ` to +apply repulsive contact forces between distinct solid bodies. Akin to pair rheo, +looks at a particles fluid/solid status to determine whether to apply forces. +However, unlike pair rheo, pair rheo/solid does obey special bond settings such +that contact forces do not have to be calculated between two bonded solid particles +in the same elastic body. + +In systems with thermal evolution, fix rheo/thermal can optionally set a +melting/solidification temperature allowing particles to dynamically swap their +state between fluid and solid. Using the *react* option, one can specify a maximum +bond length and a bond type. Then, when solidifying, particles will search their +local neighbors and automatically create bonds with any neighboring solid particles +in range. For BPM bond styles, bonds will then use the immediate position of the two +particles to calculate a reference state. When melting, particles will then delete +any bonds of the specified type when reverting to a fluid state. Special bonds are +updated as bonds are created/broken. + +The other option for elastic objects is an elastic shell that is nominally much +thinner than a particle diameter, e.g. a oxide skin which gradually forms over time +on the surface of a fluid. Currently, this is implemented using +:doc:`fix rheo/oxidaton ` and bond style +:doc:`rheo/shell `. Essentially, fix rheo/oxidaton creates candidate +bonds of a specified type between surface fluid particles within a specified distance. +a newly created rheo/shell bond will then start a timer. While the timer is counting +down, the bond will delete itself if particles move too far apart or move away from the +surface. However, if the timer reaches a user-defined threshold, then the bond will +activate and apply additional forces to the fluid particles. Bond style rheo/shell +then operates very similarly to a BPM bond style, storing a reference length and +breaking if stretched too far. Unlike the above method, this option does not remove +the underlying fluid interactions (although particle shifting is turned off) and does +not modify special bond settings of particles. + +While these two options are not expected to be appropriate for every multiphase system, +either framework can be modified to create more suitable models (e.g. by changing the +criteria for creating/deleting a bond or altering force calculations). + +---------- + +.. _howto-howto_rheo_palermo: + +**(Palermo)** Palermo, Clemmer, Wolf, O'Connor, in preparation. + +.. _howto-howto_rheo_clemmer: + +**(Clemmer)** Clemmer, Pierce, O'Connor, Nevins, Jones, Lechman, Tencer, Appl. Math. Model., 130, 310-326 (2024). diff --git a/doc/src/Packages_details.rst b/doc/src/Packages_details.rst index a3d65d9d65..39a9deef63 100644 --- a/doc/src/Packages_details.rst +++ b/doc/src/Packages_details.rst @@ -101,6 +101,7 @@ page gives those details. * :ref:`QEQ ` * :ref:`QMMM ` * :ref:`QTB ` + * :ref:`RHEO ` * :ref:`REACTION ` * :ref:`REAXFF ` * :ref:`REPLICA ` @@ -2571,6 +2572,41 @@ another set. ---------- +.. _PKG-RHEO: + +RHEO package +------------ + +**Contents:** + +Pair styles, bond styles, fixes, and computes for reproducing +hydrodynamics and elastic objects. See the +:doc:`Howto rheo ` page for an overview. + +**Authors:** Joel T. Clemmer (Sandia National Labs), +Thomas C. O'Connor (Carnegie Mellon University) + +.. versionadded:: TBD + +**Supporting info:** + +* src/RHEO filenames -> commands +* :doc:`Howto_rheo ` +* :doc:`atom_style rheo ` +* :doc:`atom_style rheo/thermal ` +* :doc:`bond_style rheo/shell ` +* :doc:`compute rheo/property/atom ` +* :doc:`fix rheo ` +* :doc:`fix rheo/oxidation ` +* :doc:`fix rheo/pressure ` +* :doc:`fix rheo/thermal ` +* :doc:`fix rheo/viscosity ` +* :doc:`pair_style rheo ` +* :doc:`pair_style rheo/solid ` +* examples/rheo + +---------- + .. _PKG-RIGID: RIGID package diff --git a/doc/src/Packages_list.rst b/doc/src/Packages_list.rst index c0a1164513..4e1d32385f 100644 --- a/doc/src/Packages_list.rst +++ b/doc/src/Packages_list.rst @@ -403,6 +403,11 @@ whether an extra library is needed to build and use the package: - :doc:`fix qtb ` :doc:`fix qbmsst ` - qtb - no + * - :ref:`RHEO ` + - reproducing hydrodynamics and elastic objects + - :doc:`Howto rheo ` + - rheo + - no * - :ref:`REACTION ` - chemical reactions in classical MD - :doc:`fix bond/react ` diff --git a/doc/src/fix_rheo.rst b/doc/src/fix_rheo.rst index c61d1939db..76d4ae3972 100644 --- a/doc/src/fix_rheo.rst +++ b/doc/src/fix_rheo.rst @@ -8,40 +8,107 @@ Syntax .. parsed-literal:: - fix ID group-ID rheo cut kstyle keyword values... + fix ID group-ID rheo cut kstyle zmin keyword values... * ID, group-ID are documented in :doc:`fix ` command * rheo = style name of this fix command -* cut = *quintic* or *RK0* or *RK1* or *RK2* +* cut = cutoff for the kernel (distance) +* kstyle = *quintic* or *RK0* or *RK1* or *RK2* +* zmin = minimal number of neighbors for reproducing kernels * zero or more keyword/value pairs may be appended to args -* keyword = *shift* or *thermal* or *surface/detection* or *interface/reconstruction* or - *rho/sum* or *density* or *sound/squared* +* keyword = *thermal* or *interface/reconstruct* or *surface/detection* or + *shift* or *rho/sum* or *density* or *speed/sound* .. parsed-literal:: - *shift* values = none, turns on velocity shifting *thermal* values = none, turns on thermal evolution + *interface/reconstruct* values = none, reconstructs interfaces with solid particles *surface/detection* values = *sdstyle* *limit* *limit/splash* *sdstyle* = *coordination* or *divergence* - *limit* = threshold for surface particles (unitless) - *limit/splash* = threshold for splash particles (unitless) - *interface/reconstruct* values = none, reconstructs interfaces with solid particles + *limit* = threshold for surface particles + *limit/splash* = threshold for splash particles + *shift* values = none, turns on velocity shifting *rho/sum* values = none, uses the kernel to compute the density of particles - *density* values = *rho0* (density) - *sound/squared* values = *csq* (velocity\^2) + *density* values = *rho01*, ... *rho0N* (density) + *speed/sound* values = *cs0*, ... *csN* (velocity) Examples """""""" .. code-block:: LAMMPS - fix 1 all rheo 1.0 quintic thermal density 0.1 sound/squared 10.0 + fix 1 all rheo 1.0 quintic thermal density 0.1 speed/sound 10.0 fix 1 all rheo 1.0 RK1 shift surface/detection coordination 40 Description """"""""""" -Fix description... +Perform time integration for RHEO particles, updating positions, velocities, +and densities. For a detailed breakdown of the integration timestep and +numerical details, see :ref:`(Palermo) `. For an +overview of other features available in the RHEO package, see +:doc:`the RHEO howto `. + +The type of kernel is specified using *kstyle* and the cutoff is *cut*. Four +kernels are currently available. The *quintic* kernel is a standard quintic +spline function commonly used in SPH. The other options, *RK0*, *RK1*, and +*RK2*, are zeroth, first, and second order reproducing. To generate a reproducing kernel, a particle must have sufficient neighbors inside the +kernel cutoff distance (a coordination number) to accurately calculate +moments. This threshold is set by *zmin*. If reproducing kernels are +requested but a particle has fewer neighbors, then it will revert to a +non-reproducing quintic kernel until it gains more neighbors. + +To model temperature evolution, one must specify the *thermal* keyword, +define a separate instance of :doc:`fix rheo/thermal `, +and use atom style rheo/thermal. + +By default, the density of solid RHEO particles does not evolve and forces +with fluid particles are calculated using the current velocity of the solid +particle. If the *interface/reconstruct* keyword is used, then the density +and velocity of solid particles are alternatively reconstructed for every +fluid-solid interaction to ensure no-slip and pressure-balanced boundaries. +This is done by estimating the location of the fluid-solid interface and +extrapolating fluid particle properties across the interface to calculate a +temporary apparent density and velocity for a solid particle. The numerical +details are the same as those described in +:ref:`(Palermo) ` except there is an additional +restriction that the reconstructed solid density cannot be less than the +equilibrium density. This prevents fluid particles from sticking to solid +surfaces. + +A modified form of Fickian particle shifting can be enabled with the +*shift* keyword. This effectively shifts particle positions to generate a +more uniform spatial distribution. In systems with free surfaces, the +*surface/detection* keyword can be used to classify the location of +particles as being within the bulk fluid, on a free surface, or isolated +from other particles in a splash or droplet. Shifting is then disabled in +the direction away from the free surface to prevent it from diffusing +particles away from the bulk fluid. Surface detection can also be used +to control surface-nucleated effects like oxidation when used in combination +with :doc:`fix rheo/oxidation `. + +The *surface/detection* keyword takes three arguments: *sdstyle*, *limit*, +and *limi/splash*. The first, *sdstyle*, specifies whether surface particles +are identified using a coordination number (*coordination*) or the divergence +of the local particle positions (*divergence*). The threshold value for a +surface particle for either of these criteria is set by the numerical value +of *limit*. Additionally, if a particle's coordination number is too low, +i.e. if it has separated off from the bulk in a droplet, it is not possible +to define surfaces and a particle is classified as a splash. The coordination +threshold for this classification is set by the numerical value of +*limit/splash*. + +By default, RHEO integrates particles' densities using a mass diffusion +equation. Alternatively, one can update densities every timestep by performing +a kernel summation of the masses of neighboring particles by specifying the *rho/sum* keyword. + +The *density* is used to specify the equilbrium density of each of the N +particle types. It must be followed by N numerical values specifying each +type's equilibrium density *rho0*. + +The *density* is used to specify the speed of sound of each of the N particle +types. It must be followed by N numerical values specifying each type's speed +of sound *cs*. Restart, fix_modify, output, run start/stop, minimize info """"""""""""""""""""""""""""""""""""""""""""""""""""""""""" @@ -55,13 +122,14 @@ the :doc:`run ` command. This fix is not invoked during :doc:`energy minim Restrictions """""""""""" -This fix must be used with an atom style that includes density -such as atom_style rheo or rheo/thermal. This fix must be used in -conjuction with :doc:`fix rheo/pressure `. and +This fix must be used with atom style rheo or rheo/thermal. +This fix must be used in conjuction with +:doc:`fix rheo/pressure `. and :doc:`fix rheo/viscosity `, If the *thermal* setting is used, there must also be an instance of :doc:`fix rheo/thermal `. The fix group must be -set to all. +set to all. Only one instance of fix rheo may be defined and it +must be defined prior to all other RHEO fixes. This fix is part of the RHEO package. It is only enabled if LAMMPS was built with that package. See the :doc:`Build package ` page for more info. @@ -78,4 +146,10 @@ Related commands Default """"""" -*rho0* and *csq* are set to 1.0. +*rho0* and *cs* are set to 1.0 for all atom types. + +---------- + +.. _howto-howto_rheo_palermo: + +**(Palermo)** Palermo, Clemmer, Wolf, O'Connor, in preparation. diff --git a/doc/src/pair_rheo.rst b/doc/src/pair_rheo.rst index 6f706a77ac..f6c3d9e3ba 100644 --- a/doc/src/pair_rheo.rst +++ b/doc/src/pair_rheo.rst @@ -16,8 +16,8 @@ Syntax .. parsed-literal:: - *rho/damp* args = density damping prefactor :math:`\xi` (units?) - *artificial/visc* args = artificial viscosity prefactor :math:`\zeta` (units?) + *rho/damp* args = density damping prefactor :math:`\xi` + *artificial/visc* args = artificial viscosity prefactor :math:`\zeta` *harmonic/means* args = none Examples @@ -31,7 +31,27 @@ Examples Description """"""""""" -pair style... +Pair style *rheo* computes pressure and viscous forces between particles +in the :doc:`rheo package `. If thermal evolution is turned +on in :doc:`fix rheo `, then the pair style also calculates +heat exchanged between particles. + +The *artificial/viscosity* keyword is used to specify the magnitude +:math:`\zeta` of an optional artificial viscosity contribution to forces. +This factor can help stabilize simulations by smoothing out small length +scale variations in velocity fields. + +The *rho/damp* keyword is used to specify the magnitude :math:`\xi` of +an optional pairwise damping term between the density of particles. This +factor can help stabilize simulations by smoothing out small length +scale variations in density fields. + +If particles have different viscosities or conductivities, the +*harmonic/means* keyword changes how they are averaged before calculating +pairwise forces or heat exchanges. By default, an arithmetic averaged is +used, however, a harmonic mean may improve stability in multiphase systems +with large disparities in viscosities. This keyword has no effect on +results if viscosities and conductivities are constant. No coefficients are defined for each pair of atoms types via the :doc:`pair_coeff ` command as in the examples diff --git a/src/RHEO/atom_vec_rheo.cpp b/src/RHEO/atom_vec_rheo.cpp index ec44a230ec..843269a717 100644 --- a/src/RHEO/atom_vec_rheo.cpp +++ b/src/RHEO/atom_vec_rheo.cpp @@ -13,7 +13,7 @@ /* ---------------------------------------------------------------------- Contributing authors: - Joel Clemmer (SNL), Thomas O'Connor (CMU), Eric Palermo (CMU) + Joel Clemmer (SNL) ----------------------------------------------------------------------- */ #include "atom_vec_rheo.h" diff --git a/src/RHEO/atom_vec_rheo_thermal.cpp b/src/RHEO/atom_vec_rheo_thermal.cpp index 26394c9175..7174d4cb66 100644 --- a/src/RHEO/atom_vec_rheo_thermal.cpp +++ b/src/RHEO/atom_vec_rheo_thermal.cpp @@ -13,7 +13,7 @@ /* ---------------------------------------------------------------------- Contributing authors: - Joel Clemmer (SNL), Thomas O'Connor (CMU), Eric Palermo (CMU) + Joel Clemmer (SNL) ----------------------------------------------------------------------- */ #include "atom_vec_rheo_thermal.h" diff --git a/src/RHEO/bond_rheo_shell.cpp b/src/RHEO/bond_rheo_shell.cpp index 6a9f99d8b1..6a71136d9d 100644 --- a/src/RHEO/bond_rheo_shell.cpp +++ b/src/RHEO/bond_rheo_shell.cpp @@ -11,6 +11,11 @@ See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ +/* ---------------------------------------------------------------------- + Contributing authors: + Joel Clemmer (SNL) +----------------------------------------------------------------------- */ + #include "bond_rheo_shell.h" #include "atom.h" @@ -40,17 +45,38 @@ BondRHEOShell::BondRHEOShell(LAMMPS *_lmp) : BondBPM(_lmp), k(nullptr), ecrit(nullptr), gamma(nullptr) { partial_flag = 1; + comm_reverse = 1; tform = rmax = -1; single_extra = 1; svector = new double[1]; + + // For nbond, create an instance of fix property atom + // Need restarts + exchanging with neighbors since it needs to persist + // between timesteps (fix property atom will handle callbacks) + + int tmp1, tmp2; + index_nb = atom->find_custom("shell_nbond", tmp1, tmp2); + if (index_nb == -1) { + id_fix = utils::strdup("bond_rheo_shell_fix_property_atom"); + modify->add_fix(fmt::format("{} all property/atom i_shell_nbond", id_fix)); + index_nb = atom->find_custom("shell_nbond", tmp1, tmp2); + } + nbond = atom->ivector[index_nb]; + + //Store non-persistent per atom quantities, intermediate + + nmax_store = atom->nmax; + memory->create(dbond, nmax_store, "rheo/react:dbond"); } /* ---------------------------------------------------------------------- */ BondRHEOShell::~BondRHEOShell() { + if (modify->nfix) modify->delete_fix(id_fix); + delete[] id_fix; delete[] svector; if (allocated) { @@ -59,6 +85,8 @@ BondRHEOShell::~BondRHEOShell() memory->destroy(ecrit); memory->destroy(gamma); } + + memory->destroy(dbond); } /* ---------------------------------------------------------------------- @@ -151,6 +179,15 @@ void BondRHEOShell::compute(int eflag, int vflag) double **bondstore = fix_bond_history->bondstore; + if (atom->nmax > nmax_store){ + nmax_store = atom->nmax; + memory->destroy(dbond); + memory->create(dbond, nmax_store, "rheo/shell:dbond"); + } + + size_t nbytes = nmax_store * sizeof(int); + memset(&dbond[0], 0, nbytes); + for (n = 0; n < nbondlist; n++) { // skip bond if already broken @@ -196,6 +233,8 @@ void BondRHEOShell::compute(int eflag, int vflag) if (bondstore[n][1] >= tform) { bondstore[n][0] = r; r0 = r; + if (newton_bond || i1 < nlocal) dbond[i1] ++; + if (newton_bond || i2 < nlocal) dbond[i2] ++; } else { continue; } @@ -205,6 +244,8 @@ void BondRHEOShell::compute(int eflag, int vflag) if (fabs(e) > ecrit[type]) { bondlist[n][2] = 0; process_broken(i1, i2); + if (newton_bond || i1 < nlocal) dbond[i1] --; + if (newton_bond || i2 < nlocal) dbond[i2] --; continue; } @@ -233,6 +274,17 @@ void BondRHEOShell::compute(int eflag, int vflag) if (evflag) ev_tally(i1, i2, nlocal, newton_bond, 0.0, fbond, delx, dely, delz); } + + + // Communicate changes in nbond + if (newton_bond) comm->reverse_comm(this); + + for(i = 0; i < nlocal; i++) { + nbond[i] += dbond[i]; + + // If it has bonds, no shifting + if (nbond[i] != 0) status[i] |= STATUS_NO_SHIFT; + } } /* ---------------------------------------------------------------------- */ @@ -419,6 +471,34 @@ void BondRHEOShell::read_restart_settings(FILE *fp) MPI_Bcast(&rmax, 1, MPI_DOUBLE, 0, world); } + +/* ---------------------------------------------------------------------- */ + +int BondRHEOShell::pack_reverse_comm(int n, int first, double *buf) +{ + int i, m, last; + m = 0; + last = first + n; + + for (i = first; i < last; i++) { + buf[m++] = dbond[i]; + } + return m; +} + +/* ---------------------------------------------------------------------- */ + +void BondRHEOShell::unpack_reverse_comm(int n, int *list, double *buf) +{ + int i, j, m; + + m = 0; + for (i = 0; i < n; i++) { + j = list[i]; + dbond[j] += buf[m++]; + } +} + /* ---------------------------------------------------------------------- */ double BondRHEOShell::single(int type, double rsq, int i, int j, double &fforce) diff --git a/src/RHEO/bond_rheo_shell.h b/src/RHEO/bond_rheo_shell.h index 562be6d9a6..513d481eeb 100644 --- a/src/RHEO/bond_rheo_shell.h +++ b/src/RHEO/bond_rheo_shell.h @@ -37,12 +37,18 @@ class BondRHEOShell : public BondBPM { void read_restart(FILE *) override; void write_restart_settings(FILE *) override; void read_restart_settings(FILE *) override; + int pack_reverse_comm(int, int, double *) override; + void unpack_reverse_comm(int, int *, double *) override; double single(int, double, int, int, double &) override; protected: double *k, *ecrit, *gamma; double tform, rmax; + int *dbond, *nbond; + int index_nb, nmax_store; + char *id_fix; + void process_ineligibility(int, int); void allocate(); void store_data(); diff --git a/src/RHEO/compute_rheo_grad.cpp b/src/RHEO/compute_rheo_grad.cpp index acfc01d793..5ed43a421a 100644 --- a/src/RHEO/compute_rheo_grad.cpp +++ b/src/RHEO/compute_rheo_grad.cpp @@ -13,7 +13,7 @@ /* ---------------------------------------------------------------------- Contributing authors: - Joel Clemmer (SNL), Thomas O'Connor (CMU), Eric Palermo (CMU) + Joel Clemmer (SNL), Thomas O'Connor (CMU) ----------------------------------------------------------------------- */ #include "compute_rheo_grad.h" diff --git a/src/RHEO/compute_rheo_kernel.cpp b/src/RHEO/compute_rheo_kernel.cpp index 6f58d79243..bd16a89b6a 100644 --- a/src/RHEO/compute_rheo_kernel.cpp +++ b/src/RHEO/compute_rheo_kernel.cpp @@ -13,7 +13,7 @@ /* ---------------------------------------------------------------------- Contributing authors: - Joel Clemmer (SNL), Thomas O'Connor (CMU), Eric Palermo (CMU) + Joel Clemmer (SNL), Thomas O'Connor (CMU) ----------------------------------------------------------------------- */ #include "compute_rheo_kernel.h" diff --git a/src/RHEO/compute_rheo_property_atom.cpp b/src/RHEO/compute_rheo_property_atom.cpp index 380ff398d8..2d6ff1e55a 100644 --- a/src/RHEO/compute_rheo_property_atom.cpp +++ b/src/RHEO/compute_rheo_property_atom.cpp @@ -56,7 +56,7 @@ ComputeRHEOPropertyAtom::ComputeRHEOPropertyAtom(LAMMPS *lmp, int narg, char **a if (nvalues == 1) size_peratom_cols = 0; else size_peratom_cols = nvalues; - pressure_flag = thermal_flag = interface_flag = surface_flag = shift_flag = 0; + pressure_flag = thermal_flag = interface_flag = surface_flag = shift_flag = shell_flag = 0; // parse input values // customize a new keyword by adding to if statement @@ -112,6 +112,9 @@ ComputeRHEOPropertyAtom::ComputeRHEOPropertyAtom(LAMMPS *lmp, int narg, char **a arg[iarg], atom->get_style()); pack_choice[i] = &ComputeRHEOPropertyAtom::pack_atom_style; thermal_flag = 1; + } else if (strcmp(arg[iarg],"nbond/shell") == 0) { + shell_flag = 1; + pack_choice[i] = &ComputeRHEOPropertyAtom::pack_nbond_shell; } else { avec_index[i] = atom->avec->property_atom(arg[iarg]); if (avec_index[i] < 0) @@ -156,6 +159,8 @@ void ComputeRHEOPropertyAtom::init() error->all(FLERR, "Cannot request velocity shifting property without corresponding option in fix rheo"); if (thermal_flag && !(fix_rheo->thermal_flag)) error->all(FLERR, "Cannot request thermal property without fix rheo/thermal"); + if (shell_flag && !(fix_rheo->oxidation_flag)) + error->all(FLERR, "Cannot request number of shell bonds without fix rheo/oxidation"); compute_interface = fix_rheo->compute_interface; compute_kernel = fix_rheo->compute_kernel; diff --git a/src/RHEO/compute_rheo_property_atom.h b/src/RHEO/compute_rheo_property_atom.h index f3596fbbf9..fd73b5883f 100644 --- a/src/RHEO/compute_rheo_property_atom.h +++ b/src/RHEO/compute_rheo_property_atom.h @@ -34,7 +34,7 @@ class ComputeRHEOPropertyAtom : public Compute { private: int nvalues, nmax; - int pressure_flag, thermal_flag, interface_flag, surface_flag, shift_flag; + int pressure_flag, thermal_flag, interface_flag, surface_flag, shift_flag, shell_flag; int *avec_index; int *col_index; double *buf; @@ -54,6 +54,7 @@ class ComputeRHEOPropertyAtom : public Compute { void pack_shift_v(int); void pack_gradv(int); void pack_pressure(int); + void pack_nbond_shell(int); void pack_atom_style(int); int get_vector_index(char*); diff --git a/src/RHEO/compute_rheo_rho_sum.cpp b/src/RHEO/compute_rheo_rho_sum.cpp index 82d3aa4bc6..8322ad4ad4 100644 --- a/src/RHEO/compute_rheo_rho_sum.cpp +++ b/src/RHEO/compute_rheo_rho_sum.cpp @@ -11,6 +11,11 @@ See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ +/* ---------------------------------------------------------------------- + Contributing authors: + Joel Clemmer (SNL) +----------------------------------------------------------------------- */ + #include "compute_rheo_rho_sum.h" #include "atom.h" diff --git a/src/RHEO/compute_rheo_vshift.cpp b/src/RHEO/compute_rheo_vshift.cpp index 569c8569f7..533287911a 100644 --- a/src/RHEO/compute_rheo_vshift.cpp +++ b/src/RHEO/compute_rheo_vshift.cpp @@ -147,6 +147,8 @@ void ComputeRHEOVShift::compute_peratom() fluidj = !(status[j] & PHASECHECK); if ((!fluidi) && (!fluidj)) continue; + + // Will skip shifting in FixRHEO initial integrate, but also skip here to save time if ((status[i] & STATUS_NO_SHIFT) && (status[j] & STATUS_NO_SHIFT)) continue; dx[0] = xtmp - x[j][0]; diff --git a/src/RHEO/fix_rheo.cpp b/src/RHEO/fix_rheo.cpp index beba940174..b0cb1513fc 100644 --- a/src/RHEO/fix_rheo.cpp +++ b/src/RHEO/fix_rheo.cpp @@ -221,7 +221,7 @@ void FixRHEO::setup_pre_force(int /*vflag*/) { // Check to confirm accessory fixes do not preceed FixRHEO // Note: fixes set this flag in setup_pre_force() - if (viscosity_fix_defined || pressure_fix_defined || thermal_fix_defined) + if (viscosity_fix_defined || pressure_fix_defined || thermal_fix_defined || oxidation_fix_defined) error->all(FLERR, "Fix RHEO must be defined before all other RHEO fixes"); // Calculate surfaces diff --git a/src/RHEO/fix_rheo.h b/src/RHEO/fix_rheo.h index 8ec28c7d0e..33fd0084db 100644 --- a/src/RHEO/fix_rheo.h +++ b/src/RHEO/fix_rheo.h @@ -55,6 +55,7 @@ class FixRHEO : public Fix { int viscosity_fix_defined; int pressure_fix_defined; int thermal_fix_defined; + int oxidation_fix_defined; class ComputeRHEOGrad *compute_grad; class ComputeRHEOKernel *compute_kernel; diff --git a/src/RHEO/fix_rheo_oxidation.cpp b/src/RHEO/fix_rheo_oxidation.cpp index bd7babedbb..1628cef13f 100644 --- a/src/RHEO/fix_rheo_oxidation.cpp +++ b/src/RHEO/fix_rheo_oxidation.cpp @@ -60,6 +60,7 @@ FixRHEOOxidation::~FixRHEOOxidation() int FixRHEOOxidation::setmask() { int mask = 0; + mask |= PRE_FORCE; mask |= POST_INTEGRATE; return mask; } @@ -70,7 +71,7 @@ void FixRHEOOxidation::init() { auto fixes = modify->get_fix_by_style("^rheo$"); if (fixes.size() == 0) error->all(FLERR, "Need to define fix rheo to use fix rheo/oxidation"); - class FixRHEO *fix_rheo = dynamic_cast(fixes[0]); + fix_rheo = dynamic_cast(fixes[0]); double cut_kernel = fix_rheo->h; if (cut > cut_kernel) @@ -102,6 +103,26 @@ void FixRHEOOxidation::init_list(int /*id*/, NeighList *ptr) /* ---------------------------------------------------------------------- */ +void FixRHEOOxidation::setup_pre_force(int /*vflag*/) +{ + // Not strictly required that this fix be after FixRHEO, + // but enforce to be consistent with other RHEO fixes + fix_rheo->oxidation_fix_defined = 1; + + if (!fix_rheo->surface_flag) error->all(FLERR, + "fix rheo/oxidation requires surface calculation in fix rheo"); + + pre_force(0); +} + +/* ---------------------------------------------------------------------- */ + +void FixRHEOThermal::pre_force(int /*vflag*/) +{ +} + +/* ---------------------------------------------------------------------- */ + void FixRHEOOxidation::post_integrate() { int i, j, n, ii, jj, inum, jnum, bflag; @@ -187,4 +208,10 @@ void FixRHEOOxidation::post_integrate() } } } + + //todo: + // allow option to create near-surface bonds + // extract # of bonds in property/atom + // check bond style shell used, get index to bonds, share with compute property atom + // add type option to compute nbond/atom } diff --git a/src/RHEO/fix_rheo_oxidation.h b/src/RHEO/fix_rheo_oxidation.h index 4c81605611..ca36a6fdf9 100644 --- a/src/RHEO/fix_rheo_oxidation.h +++ b/src/RHEO/fix_rheo_oxidation.h @@ -33,6 +33,8 @@ class FixRHEOOxidation : public Fix { int setmask() override; void init() override; void init_list(int, class NeighList *) override; + void setup_pre_force(int) override; + void pre_force(int) override; void post_integrate() override; private: @@ -40,6 +42,7 @@ class FixRHEOOxidation : public Fix { double cut, cutsq; class NeighList *list; + class FixRHEO *fix_rheo; //class FixBondHistory *fix_bond_history; }; diff --git a/src/RHEO/fix_rheo_pressure.cpp b/src/RHEO/fix_rheo_pressure.cpp index 8c523b2b35..d6dea8aa1a 100644 --- a/src/RHEO/fix_rheo_pressure.cpp +++ b/src/RHEO/fix_rheo_pressure.cpp @@ -13,7 +13,7 @@ /* ---------------------------------------------------------------------- Contributing authors: - Joel Clemmer (SNL), Thomas O'Connor (CMU), Eric Palermo (CMU) + Joel Clemmer (SNL), Thomas O'Connor (CMU) ----------------------------------------------------------------------- */ #include "fix_rheo_pressure.h" diff --git a/src/RHEO/fix_rheo_thermal.cpp b/src/RHEO/fix_rheo_thermal.cpp index c6d10bcc79..7d9aff5424 100644 --- a/src/RHEO/fix_rheo_thermal.cpp +++ b/src/RHEO/fix_rheo_thermal.cpp @@ -498,21 +498,36 @@ void FixRHEOThermal::break_bonds() int nlocal = atom->nlocal; int nall = nlocal + atom->nghost; - // Rapidly delete all bonds for local atoms that melt (no shifting) + // Rapidly delete all bonds for local atoms that melt of a given type for (int i = 0; i < nlocal; i++) { if (!(status[i] & STATUS_MELTING)) continue; - for (m = 0; m < num_bond[i]; m++) { - j = atom->map(bond_atom[i][m]); - bond_type[i][m] = 0; + for (m = (num_bond[i] - 1); m >= 0; m--) { + if (bond_type[i][m] != btype) continue; - if (n_histories > 0) - for (auto &ihistory: histories) - dynamic_cast(ihistory)->delete_history(i, m); + j = atom->map(bond_atom[i][m]); + + nmax = num_bond[i] - 1; + if (m == nmax) { + if (n_histories > 0) + for (auto &ihistory: histories) + dynamic_cast(ihistory)->delete_history(i, m); + } else { + bond_type[i][m] = bond_type[i][nmax]; + bond_atom[i][m] = bond_atom[i][nmax]; + if (n_histories > 0) { + for (auto &ihistory: histories) { + auto fix_bond_history = dynamic_cast (ihistory); + fix_bond_history->shift_history(i, m, nmax); + fix_bond_history->delete_history(i, nmax); + } + } + } + bond_type[i][nmax] = 0; + num_bond[i]--; if (fix_update_special_bonds) fix_update_special_bonds->add_broken_bond(i, j); } - num_bond[i] = 0; } // Update bond list and break solid-melted bonds @@ -530,7 +545,7 @@ void FixRHEOThermal::break_bonds() // Delete bonds for non-melted local atoms (shifting) if (i < nlocal) { for (m = 0; m < num_bond[i]; m++) { - if (bond_atom[i][m] == tag[j]) { + if (bond_atom[i][m] == tag[j] && bond_type[i][m] == btype) { nmax = num_bond[i] - 1; bond_type[i][m] = bond_type[i][nmax]; bond_atom[i][m] = bond_atom[i][nmax]; @@ -549,7 +564,7 @@ void FixRHEOThermal::break_bonds() if (j < nlocal) { for (m = 0; m < num_bond[j]; m++) { - if (bond_atom[j][m] == tag[i]) { + if (bond_atom[j][m] == tag[i] && bond_type[j][m] == btype) { nmax = num_bond[j] - 1; bond_type[j][m] = bond_type[j][nmax]; bond_atom[j][m] = bond_atom[j][nmax]; diff --git a/src/RHEO/fix_rheo_viscosity.cpp b/src/RHEO/fix_rheo_viscosity.cpp index 2fffa8b29c..abaa55ca70 100644 --- a/src/RHEO/fix_rheo_viscosity.cpp +++ b/src/RHEO/fix_rheo_viscosity.cpp @@ -13,7 +13,7 @@ /* ---------------------------------------------------------------------- Contributing authors: - Joel Clemmer (SNL), Thomas O'Connor (CMU), Eric Palermo (CMU) + Joel Clemmer (SNL), Thomas O'Connor (CMU) ----------------------------------------------------------------------- */ #include "fix_rheo_viscosity.h" diff --git a/src/RHEO/pair_rheo.cpp b/src/RHEO/pair_rheo.cpp index b07e914af1..fe5a1d6dec 100644 --- a/src/RHEO/pair_rheo.cpp +++ b/src/RHEO/pair_rheo.cpp @@ -13,7 +13,7 @@ /* ---------------------------------------------------------------------- Contributing authors: - Joel Clemmer (SNL), Thomas O'Connor (CMU), Eric Palermo (CMU) + Joel Clemmer (SNL), Thomas O'Connor (CMU) ----------------------------------------------------------------------- */ #include "pair_rheo.h" diff --git a/src/RHEO/pair_rheo_solid.cpp b/src/RHEO/pair_rheo_solid.cpp index d0a68d5230..f6dcd95879 100644 --- a/src/RHEO/pair_rheo_solid.cpp +++ b/src/RHEO/pair_rheo_solid.cpp @@ -11,6 +11,11 @@ See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ +/* ---------------------------------------------------------------------- + Contributing authors: + Joel Clemmer (SNL) +----------------------------------------------------------------------- */ + #include "pair_rheo_solid.h" #include "atom.h" From 08db64c27fbe30b5dd2ab342f5606cdfeb73697b Mon Sep 17 00:00:00 2001 From: jtclemm Date: Sun, 31 Mar 2024 21:40:34 -0600 Subject: [PATCH 074/158] More updates for oxidation, more doc pages --- doc/src/compute_nbond_atom.rst | 13 ++++++- doc/src/fix_rheo_pressure.rst | 45 ++++++++++++++++++---- doc/src/fix_rheo_thermal.rst | 51 +++++++++++++++---------- doc/src/fix_rheo_viscosity.rst | 44 +++++++++++---------- src/BPM/compute_nbond_atom.cpp | 16 +++++++- src/BPM/compute_nbond_atom.h | 2 +- src/RHEO/bond_rheo_shell.cpp | 17 ++++++++- src/RHEO/bond_rheo_shell.h | 2 + src/RHEO/compute_rheo_property_atom.cpp | 23 ++++++++++- src/RHEO/compute_rheo_property_atom.h | 1 + src/RHEO/fix_rheo.cpp | 3 ++ src/RHEO/fix_rheo.h | 1 + src/RHEO/fix_rheo_oxidation.cpp | 42 ++++++++++---------- src/RHEO/fix_rheo_oxidation.h | 7 ++-- 14 files changed, 188 insertions(+), 79 deletions(-) diff --git a/doc/src/compute_nbond_atom.rst b/doc/src/compute_nbond_atom.rst index f438836534..274d958a10 100644 --- a/doc/src/compute_nbond_atom.rst +++ b/doc/src/compute_nbond_atom.rst @@ -8,10 +8,17 @@ Syntax .. code-block:: LAMMPS - compute ID group-ID nbond/atom + compute ID group-ID nbond/atom keyword value * ID, group-ID are documented in :doc:`compute ` command * nbond/atom = style name of this compute command +* zero or more keyword/value pairs may be appended +* keyword = *bond/type* + + .. parsed-literal:: + + *bond/type* value = *btype* + *btype* = bond type included in count Examples """""""" @@ -19,6 +26,7 @@ Examples .. code-block:: LAMMPS compute 1 all nbond/atom + compute 1 all nbond/atom bond/type 2 Description """"""""""" @@ -31,6 +39,9 @@ the :doc:`Howto broken bonds ` page for more information. The number of bonds will be zero for atoms not in the specified compute group. This compute does not depend on Newton bond settings. +If the keyword *bond/type* is specified, only bonds of *btype* are +counted. + Output info """"""""""" diff --git a/doc/src/fix_rheo_pressure.rst b/doc/src/fix_rheo_pressure.rst index d31c305c20..2edd703299 100644 --- a/doc/src/fix_rheo_pressure.rst +++ b/doc/src/fix_rheo_pressure.rst @@ -8,12 +8,13 @@ Syntax .. parsed-literal:: - fix ID group-ID rheo/pressure style args + fix ID group-ID rheo/pressure type1 pstyle1 args1 ... typeN pstyleN argsN * ID, group-ID are documented in :doc:`fix ` command * rheo/pressure = style name of this fix command +* one or more types and pressure styles must be appended * types = lists of types (see below) -* style = *linear* or *taitwater* or *cubic* +* pstyle = *linear* or *taitwater* or *cubic* .. parsed-literal:: @@ -32,10 +33,41 @@ Examples Description """"""""""" -This fix... +This fix defines a pressure equation of state for RHEO particles. One can +define different equations of state for different atom types, but an +equation must be specified for every atom type. -Only one instance of fix rheo/pressure can be defined and the fix group must be set to all. +One first defines the atom *types*. A wild-card asterisk can be used in place +of or in conjunction with the *types* argument to set the coefficients for +multiple pairs of atom types. This takes the form "\*" or "\*n" or "m\*" +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 m to :math:`N` (inclusive). A middle asterisk means all types from m to n +(inclusive). +The *types* definition is followed by the pressure style, *pstyle*. Current +options *linear*, *taitwater*, and *cubic*. Style *linear* is a linear +equation of state with a particle pressure :math:`P` calculated as + +.. math:: + + P = c (\rho - \rho_0) + +where :math:`c` is the speed of sound, :math:`\rho_0` is the equilibrium density, +and :math:`\rho` is the current density of a particle. The numerical values of +:math:`c` and :math:`\rho_0` are set in :doc:`fix rheo `. Style *cubic* +is a cubic equation of state which has an extra argument :math:`A_3`, + +.. math:: + + P = c ((\rho - \rho_0) + A_3 (\rho - \rho_0)^3) . + +Style *taitwater* is Tait's equation of state: + +.. math:: + + P = \frac{c^2 \rho_0}{7} \biggl[\left(\frac{\rho}{\rho_0}\right)^{7} - 1\biggr]. Restart, fix_modify, output, run start/stop, minimize info """"""""""""""""""""""""""""""""""""""""""""""""""""""""""" @@ -52,7 +84,7 @@ Restrictions This fix must be used with an atom style that includes density such as atom_style rheo or rheo/thermal. This fix must be used in conjuction with :doc:`fix rheo `. The fix group must be -set to all. +set to all. Only one instance of fix rheo/pressure can be defined. This fix is part of the RHEO package. It is only enabled if LAMMPS was built with that package. See the :doc:`Build package ` page for more info. @@ -60,8 +92,7 @@ LAMMPS was built with that package. See the :doc:`Build package Related commands """""""""""""""" -:doc:`fix rheo/viscosity `, -:doc:`fix rheo/thermal `, +:doc:`fix rheo `, :doc:`pair rheo `, :doc:`compute rheo/property/atom ` diff --git a/doc/src/fix_rheo_thermal.rst b/doc/src/fix_rheo_thermal.rst index b73aeb248e..2ece5521bc 100644 --- a/doc/src/fix_rheo_thermal.rst +++ b/doc/src/fix_rheo_thermal.rst @@ -48,26 +48,38 @@ Examples Description """"""""""" -This fix... +This fix performs time integration of temperature evolution for atom style +rheo/thermal. In addition, it defines multiple thermal properties of +particles and handles melting/solidification, if applicable. For more details +on phase transitions in RHEO, see :doc:`the RHEO howto `. -Each list consists of a series of type -ranges separated by commas. The range can be specified as a -single numeric value, or a wildcard asterisk can be used to specify a range -of values. This takes the form "\*" or "\*n" or "n\*" or "m\*n". For -example, if M = the number of atom types, then an asterisk with no numeric -values means all types from 1 to M. A leading asterisk means all types -from 1 to n (inclusive). A trailing asterisk means all types from n to M -(inclusive). A middle asterisk means all types from m to n (inclusive). -Note that all atom types must be included in exactly one of the N collections. +For each atom type, one can define attributes for the *conductivity*, +*specific/heat*, *latent/heat*, and critical temperature (*Tfreeze*). +The conductivity and specific heat must be defined for all atom types. +The latent heat and critical temperature are optional. However, a +critical temperature must be defined to specify a latent heat. -While the *Tfreeze* keyword is optional, the *conductivity* and -*specific/heat* keywords are mandatory. +For each property, one must first define a list of atom types. A wild-card +asterisk can be used in place of or in conjunction with the *types* argument +to set the coefficients for multiple pairs of atom types. This takes the +form "\*" or "\*n" or "m\*" 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 m to :math:`N` (inclusive). A +middle asterisk means all types from m to n (inclusive). -Multiple instances of this fix may be defined to apply different -properties to different groups. However, the union of fix groups -across all instances of fix rheo/thermal must cover all atoms. -If there are multiple instances of this fix, any intersections in -the fix groups will lead to incorrect thermal integration. +The *types* definition for each property is followed by the style. Currently, +the only option is *constant*. Style *constant* simply applies a constant value +of respective property to each particle of the assigned type. + +The *react* keyword controls whether bonds are created/deleted when particles +transition between a fluid and solid state. This option only applies to atom +types that have a defined value of *Tfreeze*. When a fluid particle's +temperature drops below *Tfreeze*, bonds of type *btype* are created between +nearby solid particles within a distance of *cut*. The particle's status also +swaps to a solid state. When a solid particle's temperature rises above +*Tfreeze*, all bonds of type *btype* are broken and the particle's tatus swaps +to a fluid state. Restart, fix_modify, output, run start/stop, minimize info """"""""""""""""""""""""""""""""""""""""""""""""""""""""""" @@ -84,7 +96,8 @@ Restrictions This fix must be used with an atom style that includes temperature, heatflow, and conductivity such as atom_tyle rheo/thermal This fix must be used in conjuction with :doc:`fix rheo ` with the -*thermal* setting. +*thermal* setting. The fix group must be set to all. Only one +instance of fix rheo/pressure can be defined. This fix is part of the RHEO package. It is only enabled if LAMMPS was built with that package. See the :doc:`Build package ` page for more info. @@ -93,8 +106,6 @@ Related commands """""""""""""""" :doc:`fix rheo `, -:doc:`fix rheo/viscosity `, -:doc:`fix rheo/pressure `, :doc:`pair rheo `, :doc:`compute rheo/property/atom ` diff --git a/doc/src/fix_rheo_viscosity.rst b/doc/src/fix_rheo_viscosity.rst index 379b002de1..64c6539acc 100644 --- a/doc/src/fix_rheo_viscosity.rst +++ b/doc/src/fix_rheo_viscosity.rst @@ -8,22 +8,18 @@ Syntax .. parsed-literal:: - fix ID group-ID rheo/viscosity types style args ... + fix ID group-ID rheo/viscosity type1 pstyle1 args1 ... typeN pstyleN argsN * ID, group-ID are documented in :doc:`fix ` command * rheo/viscosity = style name of this fix command +* one or more types and viscosity styles must be appended * types = lists of types (see below) -* style = *constant* or *power* +* vstyle = *constant* .. parsed-literal:: - *constant* args = viscosity (mass/(length*time)) - *power* args = *eta* *gd0* *K* *npow* *tau0* - *eta* = (units) - *gd0* = (units) - *K* = (units) - *npow* = (units) - *tau0* = (units) + *constant* args = *eta* + *eta* = viscosity Examples """""""" @@ -31,20 +27,27 @@ Examples .. code-block:: LAMMPS fix 1 all rheo/viscosity * constant 1.0 - fix 1 all rheo/viscosity 1 constant 1.0 2 power 0.1 1e-2 0.5 0.01 + fix 1 all rheo/viscosity 1 constant 1.0 2 constant 2.0 Description """"""""""" -This fix... +This fix defines a viscosity for RHEO particles. One can define different +viscosities for different atom types, but a viscosity must be specified for +every atom type. -Multiple instances of this fix may be defined to apply different -properties to different groups. However, the union of fix groups -across all instances of fix rheo/viscosity must cover all atoms. -If there are multiple instances of this fix, any intersection -between fix groups will cause the viscosity for the affected atoms -to be calculated multiple times. Any such affected atoms will enabled -up with a viscosity calculated by the latest defined fix. +One first defines the atom *types*. A wild-card asterisk can be used in place +of or in conjunction with the *types* argument to set the coefficients for +multiple pairs of atom types. This takes the form "\*" or "\*n" or "m\*" +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 m to :math:`N` (inclusive). A middle asterisk means all types from m to n +(inclusive). + +The *types* definition is followed by the viscosity style, *vstyle*. Currently, +the only option is *constant*. Style *constant* simply applies a constant value +of the viscosity *eta* to each particle of the assigned type. Restart, fix_modify, output, run start/stop, minimize info """"""""""""""""""""""""""""""""""""""""""""""""""""""""""" @@ -60,7 +63,8 @@ Restrictions This fix must be used with an atom style that includes viscosity such as atom_style rheo or rheo/thermal. This fix must be used in -conjuction with :doc:`fix rheo `. +conjuction with :doc:`fix rheo `. The fix group must be +set to all. Only one instance of fix rheo/viscosity can be defined. This fix is part of the RHEO package. It is only enabled if LAMMPS was built with that package. See the :doc:`Build package ` page for more info. @@ -69,8 +73,6 @@ Related commands """""""""""""""" :doc:`fix rheo `, -:doc:`fix rheo/pressure `, -:doc:`fix rheo/thermal `, :doc:`pair rheo `, :doc:`compute rheo/property/atom ` diff --git a/src/BPM/compute_nbond_atom.cpp b/src/BPM/compute_nbond_atom.cpp index 4f0fc4c3f0..af1cc2b9bc 100644 --- a/src/BPM/compute_nbond_atom.cpp +++ b/src/BPM/compute_nbond_atom.cpp @@ -25,7 +25,20 @@ using namespace LAMMPS_NS; ComputeNBondAtom::ComputeNBondAtom(LAMMPS *_lmp, int narg, char **arg) : Compute(_lmp, narg, arg), nbond(nullptr) { - if (narg < 3) utils::missing_cmd_args(FLERR, "compute nbond/atom", error); + if (narg < 4) utils::missing_cmd_args(FLERR, "compute nbond/atom", error); + + btype = -1; + + iarg = 3; + while (iarg < narg) { + if (strcmp(arg[iarg], "bond/type") == 0) { + if (iarg + 2 > narg) utils::missing_cmd_args(FLERR, "compute nbond/atom bond/type", error); + btype = utils::inumeric(FLERR, arg[iarg + 1], false, lmp); + iarg += 2; + } else { + error->all(FLERR, "Unknown compute nbond/type command {}", arg[iarg]); + } + } peratom_flag = 1; size_peratom_cols = 0; @@ -78,6 +91,7 @@ void ComputeNBondAtom::compute_peratom() for (i = 0; i < nlocal; i++) { for (j = 0; j < num_bond[i]; j++) { if (bond_type[i][j] <= 0) continue; + if (btype != -1 && bond_type[i][j] != btype) continue; k = atom->map(bond_atom[i][j]); if (k < 0) continue; diff --git a/src/BPM/compute_nbond_atom.h b/src/BPM/compute_nbond_atom.h index e0c2d7ce01..b55ef91e5d 100644 --- a/src/BPM/compute_nbond_atom.h +++ b/src/BPM/compute_nbond_atom.h @@ -35,7 +35,7 @@ class ComputeNBondAtom : public Compute { double memory_usage() override; private: - int nmax; + int nmax, btype; double *nbond; }; diff --git a/src/RHEO/bond_rheo_shell.cpp b/src/RHEO/bond_rheo_shell.cpp index 6a71136d9d..d366163459 100644 --- a/src/RHEO/bond_rheo_shell.cpp +++ b/src/RHEO/bond_rheo_shell.cpp @@ -20,6 +20,7 @@ #include "atom.h" #include "comm.h" +#include "compute_rheo_surface.h" #include "domain.h" #include "error.h" #include "fix_bond_history.h" @@ -42,7 +43,7 @@ using namespace RHEO_NS; /* ---------------------------------------------------------------------- */ BondRHEOShell::BondRHEOShell(LAMMPS *_lmp) : - BondBPM(_lmp), k(nullptr), ecrit(nullptr), gamma(nullptr) + BondBPM(_lmp), compute_surface(nullptr), k(nullptr), ecrit(nullptr), gamma(nullptr) { partial_flag = 1; comm_reverse = 1; @@ -279,7 +280,7 @@ void BondRHEOShell::compute(int eflag, int vflag) // Communicate changes in nbond if (newton_bond) comm->reverse_comm(this); - for(i = 0; i < nlocal; i++) { + for(int i = 0; i < nlocal; i++) { nbond[i] += dbond[i]; // If it has bonds, no shifting @@ -341,6 +342,18 @@ void BondRHEOShell::init_style() if (comm->ghost_velocity == 0) error->all(FLERR, "Bond rheo/shell requires ghost atoms store velocity"); + auto fixes = modify->get_fix_by_style("^rheo$"); + if (fixes.size() == 0) error->all(FLERR, "Need to define fix rheo to use bond rheo/shell"); + class FixRHEO *fix_rheo = dynamic_cast(fixes[0]); + + if (!fix_rheo->surface_flag) error->all(FLERR, + "Bond rheo/shell requires surface calculation in fix rheo"); + compute_surface = fix_rheo->compute_surface; + + if (fix_rheo->oxidation_fix_defined != 1) + error->all(FLERR, "Need to define fix rheo/oxdiation to use bond rheo/shell"); + // check consistency in values (copy?), swap conditions to rsurf + if (!id_fix_bond_history) { id_fix_bond_history = utils::strdup("HISTORY_RHEO_SHELL"); fix_bond_history = dynamic_cast(modify->replace_fix( diff --git a/src/RHEO/bond_rheo_shell.h b/src/RHEO/bond_rheo_shell.h index 513d481eeb..a6a747a3f1 100644 --- a/src/RHEO/bond_rheo_shell.h +++ b/src/RHEO/bond_rheo_shell.h @@ -49,6 +49,8 @@ class BondRHEOShell : public BondBPM { int index_nb, nmax_store; char *id_fix; + class ComputeRHEOSurface *compute_surface; + void process_ineligibility(int, int); void allocate(); void store_data(); diff --git a/src/RHEO/compute_rheo_property_atom.cpp b/src/RHEO/compute_rheo_property_atom.cpp index 2d6ff1e55a..bdc9951f90 100644 --- a/src/RHEO/compute_rheo_property_atom.cpp +++ b/src/RHEO/compute_rheo_property_atom.cpp @@ -29,6 +29,7 @@ #include "domain.h" #include "error.h" #include "fix_rheo.h" +#include "fix_rheo_oxidation.h" #include "fix_rheo_pressure.h" #include "fix_rheo_thermal.h" #include "memory.h" @@ -177,6 +178,11 @@ void ComputeRHEOPropertyAtom::init() fixes = modify->get_fix_by_style("rheo/pressure"); fix_pressure = dynamic_cast(fixes[0]); } + + if (shell_flag) { + fixes = modify->get_fix_by_style("rheo/oxidation"); + fix_oxidation = dynamic_cast(fixes[0]); + } } /* ---------------------------------------------------------------------- */ @@ -381,6 +387,21 @@ void ComputeRHEOPropertyAtom::pack_pressure(int n) /* ---------------------------------------------------------------------- */ +void ComputeRHEOPropertyAtom::pack_nbond_shell(int n) +{ + int *nbond = fix_oxidation->nbond; + int *mask = atom->mask; + int nlocal = atom->nlocal; + + for (int i = 0; i < nlocal; i++) { + if (mask[i] & groupbit) buf[n] = nbond[i]; + else buf[n] = 0.0; + n += nvalues; + } +} + +/* ---------------------------------------------------------------------- */ + void ComputeRHEOPropertyAtom::pack_shift_v(int n) { double **vshift = compute_vshift->vshift; @@ -415,7 +436,7 @@ void ComputeRHEOPropertyAtom::pack_gradv(int n) void ComputeRHEOPropertyAtom::pack_atom_style(int n) { - atom->avec->pack_property_atom(avec_index[n],&buf[n],nvalues,groupbit); + atom->avec->pack_property_atom(avec_index[n], &buf[n], nvalues, groupbit); } /* ---------------------------------------------------------------------- */ diff --git a/src/RHEO/compute_rheo_property_atom.h b/src/RHEO/compute_rheo_property_atom.h index fd73b5883f..a66ef4ece6 100644 --- a/src/RHEO/compute_rheo_property_atom.h +++ b/src/RHEO/compute_rheo_property_atom.h @@ -63,6 +63,7 @@ class ComputeRHEOPropertyAtom : public Compute { class FixRHEO *fix_rheo; class FixRHEOPressure *fix_pressure; class FixRHEOThermal *fix_thermal; + class FixRHEOOxidation *fix_oxidation; class ComputeRHEOInterface *compute_interface; class ComputeRHEOKernel *compute_kernel; class ComputeRHEOSurface *compute_surface; diff --git a/src/RHEO/fix_rheo.cpp b/src/RHEO/fix_rheo.cpp index b0cb1513fc..04b7d33541 100644 --- a/src/RHEO/fix_rheo.cpp +++ b/src/RHEO/fix_rheo.cpp @@ -48,12 +48,14 @@ FixRHEO::FixRHEO(LAMMPS *lmp, int narg, char **arg) : viscosity_fix_defined = 0; pressure_fix_defined = 0; thermal_fix_defined = 0; + oxidation_fix_defined = 0; thermal_flag = 0; rhosum_flag = 0; shift_flag = 0; interface_flag = 0; surface_flag = 0; + oxidation_flag = 0; int i; int n = atom->ntypes; @@ -252,6 +254,7 @@ void FixRHEO::setup(int /*vflag*/) thermal_fix_defined = 0; viscosity_fix_defined = 0; pressure_fix_defined = 0; + oxidation_fix_defined = 0; // Check fixes cover all atoms (may still fail if atoms are created) // FixRHEOPressure currently requires group all diff --git a/src/RHEO/fix_rheo.h b/src/RHEO/fix_rheo.h index 33fd0084db..45f74ed4cd 100644 --- a/src/RHEO/fix_rheo.h +++ b/src/RHEO/fix_rheo.h @@ -51,6 +51,7 @@ class FixRHEO : public Fix { int shift_flag; int interface_flag; int surface_flag; + int oxidation_flag; int viscosity_fix_defined; int pressure_fix_defined; diff --git a/src/RHEO/fix_rheo_oxidation.cpp b/src/RHEO/fix_rheo_oxidation.cpp index 1628cef13f..f536df7842 100644 --- a/src/RHEO/fix_rheo_oxidation.cpp +++ b/src/RHEO/fix_rheo_oxidation.cpp @@ -20,6 +20,7 @@ #include "atom.h" #include "atom_vec.h" +#include "compute_rheo_surface.h" #include "error.h" #include "fix_rheo.h" #include "force.h" @@ -36,9 +37,9 @@ enum {NONE, CONSTANT}; /* ---------------------------------------------------------------------- */ FixRHEOOxidation::FixRHEOOxidation(LAMMPS *lmp, int narg, char **arg) : - Fix(lmp, narg, arg) //, fix_bond_history(nullptr) + Fix(lmp, narg, arg), compute_surface(nullptr), fix_rheo(nullptr) { - if (narg != 5) error->all(FLERR,"Illegal fix command"); + if (narg != 6) error->all(FLERR,"Illegal fix command"); cut = utils::numeric(FLERR, arg[3], false, lmp); if (cut <= 0.0) error->all(FLERR, "Illegal bond cutoff {} in fix rheo/oxidation", cut); @@ -46,6 +47,9 @@ FixRHEOOxidation::FixRHEOOxidation(LAMMPS *lmp, int narg, char **arg) : btype = utils::inumeric(FLERR, arg[4], false, lmp); if (btype < 1 || btype > atom->nbondtypes) error->all(FLERR, "Illegal value {} for bond type in fix rheo/oxidation", btype); + rsurf = utils::numeric(FLERR, arg[5], false, lmp); + if (rsurf <= 0.0) error->all(FLERR, "Illegal surface distance {} in fix rheo/oxidation", cut); + cutsq = cut * cut; } @@ -72,22 +76,21 @@ void FixRHEOOxidation::init() auto fixes = modify->get_fix_by_style("^rheo$"); if (fixes.size() == 0) error->all(FLERR, "Need to define fix rheo to use fix rheo/oxidation"); fix_rheo = dynamic_cast(fixes[0]); - double cut_kernel = fix_rheo->h; - if (cut > cut_kernel) + if (cut > fix_rheo->h) error->all(FLERR, "Bonding length exceeds kernel cutoff"); + if (rsurf >= fix_rheo->h) + error->all(FLERR, "Surface distance must be less than kernel cutoff"); + if (!force->bond) error->all(FLERR, "Must define a bond style with fix rheo/oxidation"); if (!atom->avec->bonds_allow) error->all(FLERR, "Fix rheo/oxidation requires atom bonds"); - //// find instances of bond history to delete data - //histories = modify->get_fix_by_style("BOND_HISTORY"); - //for (auto &ihistory: histories) - // if (strcmp(histories[i]->id, "HISTORY_RHEO_SHELL") == 0) - // fix_bond_history = dynamic_cast(ihistory); -// - //if (!fix_bond_history) - // error->all(FLERR, "Must define bond style rheo/shell to use fix rheo/oxidation"); + int tmp1, tmp2; + index_nb = atom->find_custom("shell_nbond", tmp1, tmp2); + if (index_nb == -1) + error->all(FLERR, "Must use bond style rheo/shell to use fix rheo/oxidation"); + nbond = atom->ivector[index_nb]; // need a half neighbor list auto req = neighbor->add_request(this, NeighConst::REQ_DEFAULT); @@ -111,13 +114,14 @@ void FixRHEOOxidation::setup_pre_force(int /*vflag*/) if (!fix_rheo->surface_flag) error->all(FLERR, "fix rheo/oxidation requires surface calculation in fix rheo"); + compute_surface = fix_rheo->compute_surface; pre_force(0); } /* ---------------------------------------------------------------------- */ -void FixRHEOThermal::pre_force(int /*vflag*/) +void FixRHEOOxidation::pre_force(int /*vflag*/) { } @@ -135,9 +139,9 @@ void FixRHEOOxidation::post_integrate() tagint *tag = atom->tag; tagint **bond_atom = atom->bond_atom; - int *status = atom->status; int **bond_type = atom->bond_type; int *num_bond = atom->num_bond; + double *rsurface = compute_surface->rsurface; double **x = atom->x; inum = list->inum; @@ -148,7 +152,7 @@ void FixRHEOOxidation::post_integrate() // loop over neighbors of my atoms for (ii = 0; ii < inum; ii++) { i = ilist[ii]; - if (!(status[i] & STATUS_SURFACE)) continue; + if (rsurface[i] > rsurf) continue; tagi = tag[i]; xtmp = x[i][0]; @@ -162,7 +166,7 @@ void FixRHEOOxidation::post_integrate() j = jlist[jj]; j &= NEIGHMASK; - if (!(status[j] & STATUS_SURFACE)) continue; + if (rsurface[j] > rsurf) continue; tagj = tag[j]; delx = xtmp - x[j][0]; @@ -208,10 +212,4 @@ void FixRHEOOxidation::post_integrate() } } } - - //todo: - // allow option to create near-surface bonds - // extract # of bonds in property/atom - // check bond style shell used, get index to bonds, share with compute property atom - // add type option to compute nbond/atom } diff --git a/src/RHEO/fix_rheo_oxidation.h b/src/RHEO/fix_rheo_oxidation.h index ca36a6fdf9..5242d24460 100644 --- a/src/RHEO/fix_rheo_oxidation.h +++ b/src/RHEO/fix_rheo_oxidation.h @@ -36,14 +36,15 @@ class FixRHEOOxidation : public Fix { void setup_pre_force(int) override; void pre_force(int) override; void post_integrate() override; + int *nbond; private: - int btype; - double cut, cutsq; + int btype, index_nb; + double rsurf, cut, cutsq; class NeighList *list; + class ComputeRHEOSurface *compute_surface; class FixRHEO *fix_rheo; - //class FixBondHistory *fix_bond_history; }; } // namespace LAMMPS_NS From ceec24d50b353527d8ff52d85e916fcb103a1475 Mon Sep 17 00:00:00 2001 From: jtclemm Date: Thu, 4 Apr 2024 09:42:10 -0600 Subject: [PATCH 075/158] Adding hybrid support to BPM, more doc pages --- doc/src/pair_rheo_solid.rst | 76 +++++++++++++--- src/BPM/bond_bpm.cpp | 112 +++++++++++++++--------- src/BPM/bond_bpm.h | 11 ++- src/BPM/bond_bpm_rotational.cpp | 17 ++-- src/BPM/bond_bpm_spring.cpp | 19 ++-- src/BPM/compute_nbond_atom.cpp | 12 ++- src/RHEO/bond_rheo_shell.cpp | 85 ++++++++---------- src/RHEO/bond_rheo_shell.h | 2 +- src/RHEO/compute_rheo_property_atom.cpp | 13 +-- src/RHEO/compute_rheo_property_atom.h | 1 + src/RHEO/fix_rheo_oxidation.h | 5 +- src/RHEO/fix_rheo_thermal.cpp | 13 +-- src/RHEO/pair_rheo_solid.cpp | 4 + src/fix_bond_history.cpp | 96 ++++++++++++++++---- src/fix_bond_history.h | 13 ++- 15 files changed, 322 insertions(+), 157 deletions(-) diff --git a/doc/src/pair_rheo_solid.rst b/doc/src/pair_rheo_solid.rst index b6ff6d809d..ee86992776 100644 --- a/doc/src/pair_rheo_solid.rst +++ b/doc/src/pair_rheo_solid.rst @@ -21,36 +21,88 @@ Examples Description """"""""""" -pair style... +Style *rheo/solid* is effectively a copy of pair style +:doc:`bpm/spring ` except it only applies forces +between solid RHEO particles, determined by checking the status of +each pair of neighboring particles before calculating forces. + +The style computes pairwise forces with the formula + +.. math:: + + F = k (r - r_c) + +where :math:`k` is a stiffness and :math:`r_c` is the cutoff length. +An additional damping force is also applied to interacting +particles. The force is proportional to the difference in the +normal velocity of particles + +.. math:: + + F_D = - \gamma w (\hat{r} \bullet \vec{v}) + +where :math:`\gamma` is the damping strength, :math:`\hat{r}` is the +radial normal vector, :math:`\vec{v}` is the velocity difference +between the two particles, and :math:`w` is a smoothing factor. +This smoothing factor is constructed such that damping forces go to zero +as particles come out of contact to avoid discontinuities. It is +given by + +.. math:: + + w = 1.0 - \left( \frac{r}{r_c} \right)^8 . + +The following coefficients must be defined for each pair of atom types +via the :doc:`pair_coeff ` command as in the examples +above, or in the data file or restart files read by the +:doc:`read_data ` or :doc:`read_restart ` +commands, or by mixing as described below: + +* :math:`k` (force/distance units) +* :math:`r_c` (distance units) +* :math:`\gamma` (force/velocity units) -* :math:`k` (force/distance units) -* :math:`\sigma` (distance units) -* :math:`\gamma` (force/velocity units) ---------- Mixing, shift, table, tail correction, restart, rRESPA info """"""""""""""""""""""""""""""""""""""""""""""""""""""""""" -This style does not support the :doc:`pair_modify ` -shift, table, and tail options. +For atom type pairs I,J and I != J, the A coefficient and cutoff +distance for this pair style can be mixed. A is always mixed via a +*geometric* rule. The cutoff is mixed according to the pair_modify +mix value. The default mix value is *geometric*\ . See the +"pair_modify" command for details. -This style does not write information to :doc:`binary restart files `. Thus, you need to re-specify the pair_style and -pair_coeff commands in an input script that reads a restart file. +This pair style does not support the :doc:`pair_modify ` +shift option, since the pair interaction goes to 0.0 at the cutoff. -This style can only be used via the *pair* keyword of the :doc:`run_style respa ` command. It does not support the *inner*, *middle*, *outer* keywords. +The :doc:`pair_modify ` table and tail options are not +relevant for this pair style. + +This pair style writes its information to :doc:`binary restart files +`, so pair_style and pair_coeff commands do not need to be +specified in an input script that reads a restart file. + +This pair style can only be used via the *pair* keyword of the +:doc:`run_style respa ` command. It does not support the +*inner*, *middle*, *outer* keywords. + +---------- Restrictions """""""""""" -This fix is part of the RHEO package. It is only enabled if -LAMMPS was built with that package. See the :doc:`Build package ` page for more info. +This pair 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. Related commands """""""""""""""" :doc:`fix rheo `, -:doc:`pair bpm/spring `, +:doc:`fix rheo/thermal `, +:doc:`pair bpm/spring ` Default """"""" diff --git a/src/BPM/bond_bpm.cpp b/src/BPM/bond_bpm.cpp index 34554497ad..351cff1420 100644 --- a/src/BPM/bond_bpm.cpp +++ b/src/BPM/bond_bpm.cpp @@ -17,6 +17,7 @@ #include "comm.h" #include "domain.h" #include "error.h" +#include "fix.h" #include "fix_bond_history.h" #include "fix_store_local.h" #include "fix_update_special_bonds.h" @@ -39,10 +40,14 @@ BondBPM::BondBPM(LAMMPS *_lmp) : pack_choice(nullptr), output_data(nullptr) { overlay_flag = 0; + ignore_special_flag = 0; prop_atom_flag = 0; break_flag = 1; nvalues = 0; + nhistory = 0; + update_flag = 0; + r0_max_estimate = 0.0; max_stretch = 1.0; @@ -93,39 +98,46 @@ void BondBPM::init_style() fix_store_local->nvalues = nvalues; } - if (overlay_flag) { - 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 a value of 1.0 for all special_bonds weights"); - if (id_fix_update) { - modify->delete_fix(id_fix_update); - delete[] id_fix_update; - id_fix_update = nullptr; - } - } 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 yes, BPM bond styles require Newton bond off"); + if (!ignore_special_flag) { + if (overlay_flag) { + 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 a value of 1.0 for all special_bonds weights"); + if (id_fix_update) { + modify->delete_fix(id_fix_update); + delete[] id_fix_update; + id_fix_update = nullptr; + } + } 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 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) - error->all(FLERR, - "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, - "With overlay/pair no, and break yes, BPM bond styles requires special Coulomb weights = 1,1,1"); + // 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) + error->all(FLERR, + "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, + "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"); - fix_update_special_bonds = dynamic_cast(modify->replace_fix( - id_fix_dummy, fmt::format("{} all UPDATE_SPECIAL_BONDS", id_fix_update), 1)); - delete[] id_fix_dummy; - id_fix_dummy = nullptr; + if (id_fix_dummy && break_flag) { + id_fix_update = utils::strdup("BPM_UPDATE_SPECIAL_BONDS"); + fix_update_special_bonds = dynamic_cast(modify->replace_fix( + id_fix_dummy, fmt::format("{} all UPDATE_SPECIAL_BONDS", id_fix_update), 1)); + delete[] id_fix_dummy; + id_fix_dummy = nullptr; + } } + + // special 1-3 and 1-4 weights must be 1 to prevent building 1-3 and 1-4 special bond lists + if (force->special_lj[2] != 1.0 || force->special_lj[3] != 1.0 || force->special_coul[2] != 1.0 || + force->special_coul[3] != 1.0) + error->all(FLERR, "Bond style bpm requires 1-3 and 1-4 special weights of 1.0"); } if (force->angle || force->dihedral || force->improper) @@ -133,10 +145,16 @@ void BondBPM::init_style() if (atom->molecular == 2) error->all(FLERR, "Bond style bpm cannot be used with atom style template"); - // special 1-3 and 1-4 weights must be 1 to prevent building 1-3 and 1-4 special bond lists - if (force->special_lj[2] != 1.0 || force->special_lj[3] != 1.0 || force->special_coul[2] != 1.0 || - force->special_coul[3] != 1.0) - error->all(FLERR, "Bond style bpm requires 1-3 and 1-4 special weights of 1.0"); + // find all instances of bond history to delete/shift data + // (bond hybrid may create multiple) + histories = modify->get_fix_by_style("BOND_HISTORY"); + n_histories = histories.size(); + + // If a bond type isn't set, must be using bond style hybrid + hybrid_flag = 0; + for (int i = 1; i <= atom->nbondtypes; i++) + if (!setflag[i]) hybrid_flag = 1; + fix_bond_history->setflag = setflag; } /* ---------------------------------------------------------------------- @@ -253,6 +271,14 @@ void BondBPM::settings(int narg, char **arg) } } } + + // Set up necessary history fix + if (!fix_bond_history) { + fix_bond_history = dynamic_cast(modify->replace_fix( + id_fix_dummy2, fmt::format("{} all BOND_HISTORY {} {}", id_fix_bond_history, update_flag, nhistory), 1)); + delete[] id_fix_dummy2; + id_fix_dummy2 = nullptr; + } } /* ---------------------------------------------------------------------- @@ -356,13 +382,16 @@ void BondBPM::process_broken(int i, int j) if (i < nlocal) { for (m = 0; m < num_bond[i]; m++) { - if (bond_atom[i][m] == tag[j]) { + if (bond_atom[i][m] == tag[j] && setflag[bond_type[i][m]]) { bond_type[i][m] = 0; n = num_bond[i]; bond_type[i][m] = bond_type[i][n - 1]; bond_atom[i][m] = bond_atom[i][n - 1]; - fix_bond_history->shift_history(i, m, n - 1); - fix_bond_history->delete_history(i, n - 1); + for (auto &ihistory: histories) { + auto fix_bond_history2 = dynamic_cast (ihistory); + fix_bond_history2->shift_history(i, m, n - 1); + fix_bond_history2->delete_history(i, n - 1); + } num_bond[i]--; break; } @@ -371,13 +400,16 @@ void BondBPM::process_broken(int i, int j) if (j < nlocal) { for (m = 0; m < num_bond[j]; m++) { - if (bond_atom[j][m] == tag[i]) { + if (bond_atom[j][m] == tag[i] && setflag[bond_type[j][m]]) { bond_type[j][m] = 0; n = num_bond[j]; bond_type[j][m] = bond_type[j][n - 1]; bond_atom[j][m] = bond_atom[j][n - 1]; - fix_bond_history->shift_history(j, m, n - 1); - fix_bond_history->delete_history(j, n - 1); + for (auto &ihistory: histories) { + auto fix_bond_history2 = dynamic_cast (ihistory); + fix_bond_history2->shift_history(j, m, n - 1); + fix_bond_history2->delete_history(j, n - 1); + } num_bond[j]--; break; } diff --git a/src/BPM/bond_bpm.h b/src/BPM/bond_bpm.h index 815b3b751f..28e4e7187e 100644 --- a/src/BPM/bond_bpm.h +++ b/src/BPM/bond_bpm.h @@ -16,8 +16,12 @@ #include "bond.h" +#include + namespace LAMMPS_NS { +class Fix; + class BondBPM : public Bond { public: BondBPM(class LAMMPS *); @@ -34,7 +38,7 @@ class BondBPM : public Bond { protected: double r0_max_estimate; double max_stretch; - int store_local_freq; + int store_local_freq, nhistory, update_flag, hybrid_flag; std::vector leftover_iarg; @@ -50,9 +54,12 @@ class BondBPM : public Bond { FnPtrPack *pack_choice; // ptrs to pack functions double *output_data; - int prop_atom_flag, nvalues, overlay_flag, break_flag; + int prop_atom_flag, nvalues, overlay_flag, break_flag, ignore_special_flag; int index_x_ref, index_y_ref, index_z_ref; + int n_histories; + std::vector histories; + void pack_id1(int, int, int); void pack_id2(int, int, int); void pack_time(int, int, int); diff --git a/src/BPM/bond_bpm_rotational.cpp b/src/BPM/bond_bpm_rotational.cpp index ffb0d9521d..b904a2ac07 100644 --- a/src/BPM/bond_bpm_rotational.cpp +++ b/src/BPM/bond_bpm_rotational.cpp @@ -52,6 +52,9 @@ BondBPMRotational::BondBPMRotational(LAMMPS *_lmp) : smooth_flag = 1; normalize_flag = 0; + nhistory = 4; + id_fix_bond_history = utils::strdup("HISTORY_BPM_ROTATIONAL"); + single_extra = 7; svector = new double[7]; } @@ -458,6 +461,9 @@ void BondBPMRotational::compute(int eflag, int vflag) store_data(); } + if (hybrid_flag) + fix_bond_history->compress_history(); + int i1, i2, itmp, n, type; double r[3], r0[3], rhat[3]; double rsq, r0_mag, r_mag, r_mag_inv; @@ -563,6 +569,9 @@ void BondBPMRotational::compute(int eflag, int vflag) ev_tally_xyz(i1, i2, nlocal, newton_bond, 0.0, -force1on2[0] * smooth, -force1on2[1] * smooth, -force1on2[2] * smooth, r[0], r[1], r[2]); } + + if (hybrid_flag) + fix_bond_history->uncompress_history(); } /* ---------------------------------------------------------------------- */ @@ -652,14 +661,6 @@ void BondBPMRotational::init_style() if (domain->dimension == 2) error->warning(FLERR, "Bond style bpm/rotational not intended for 2d use"); - - if (!id_fix_bond_history) { - id_fix_bond_history = utils::strdup("HISTORY_BPM_ROTATIONAL"); - fix_bond_history = dynamic_cast(modify->replace_fix( - id_fix_dummy2, fmt::format("{} all BOND_HISTORY 0 4", id_fix_bond_history), 1)); - delete[] id_fix_dummy2; - id_fix_dummy2 = nullptr; - } } /* ---------------------------------------------------------------------- */ diff --git a/src/BPM/bond_bpm_spring.cpp b/src/BPM/bond_bpm_spring.cpp index 37b79f93fb..0c882ae6c6 100644 --- a/src/BPM/bond_bpm_spring.cpp +++ b/src/BPM/bond_bpm_spring.cpp @@ -23,6 +23,8 @@ #include "modify.h" #include "neighbor.h" +#include "update.h" + #include #include @@ -39,6 +41,9 @@ BondBPMSpring::BondBPMSpring(LAMMPS *_lmp) : smooth_flag = 1; normalize_flag = 0; + nhistory = 1; + id_fix_bond_history = utils::strdup("HISTORY_BPM_SPRING"); + single_extra = 1; svector = new double[1]; } @@ -137,6 +142,9 @@ void BondBPMSpring::compute(int eflag, int vflag) store_data(); } + if (hybrid_flag) + fix_bond_history->compress_history(); + int i1, i2, itmp, n, type; double delx, dely, delz, delvx, delvy, delvz; double e, rsq, r, r0, rinv, smooth, fbond, dot; @@ -226,6 +234,9 @@ void BondBPMSpring::compute(int eflag, int vflag) if (evflag) ev_tally(i1, i2, nlocal, newton_bond, 0.0, fbond, delx, dely, delz); } + + if (hybrid_flag) + fix_bond_history->uncompress_history(); } /* ---------------------------------------------------------------------- */ @@ -283,14 +294,6 @@ void BondBPMSpring::init_style() if (comm->ghost_velocity == 0) error->all(FLERR, "Bond bpm/spring requires ghost atoms store velocity"); - - if (!id_fix_bond_history) { - id_fix_bond_history = utils::strdup("HISTORY_BPM_SPRING"); - fix_bond_history = dynamic_cast(modify->replace_fix( - id_fix_dummy2, fmt::format("{} all BOND_HISTORY 0 1", id_fix_bond_history), 1)); - delete[] id_fix_dummy2; - id_fix_dummy2 = nullptr; - } } /* ---------------------------------------------------------------------- */ diff --git a/src/BPM/compute_nbond_atom.cpp b/src/BPM/compute_nbond_atom.cpp index af1cc2b9bc..b6e7b0139f 100644 --- a/src/BPM/compute_nbond_atom.cpp +++ b/src/BPM/compute_nbond_atom.cpp @@ -14,7 +14,9 @@ #include "compute_nbond_atom.h" #include "atom.h" +#include "atom_vec.h" #include "comm.h" +#include "error.h" #include "force.h" #include "memory.h" @@ -25,18 +27,20 @@ using namespace LAMMPS_NS; ComputeNBondAtom::ComputeNBondAtom(LAMMPS *_lmp, int narg, char **arg) : Compute(_lmp, narg, arg), nbond(nullptr) { - if (narg < 4) utils::missing_cmd_args(FLERR, "compute nbond/atom", error); + if (narg < 3) utils::missing_cmd_args(FLERR, "compute nbond/atom", error); + + if (atom->avec->bonds_allow == 0) + error->all(FLERR,"Compute nbond/atom used when bonds are not allowed"); btype = -1; - - iarg = 3; + int iarg = 3; while (iarg < narg) { if (strcmp(arg[iarg], "bond/type") == 0) { if (iarg + 2 > narg) utils::missing_cmd_args(FLERR, "compute nbond/atom bond/type", error); btype = utils::inumeric(FLERR, arg[iarg + 1], false, lmp); iarg += 2; } else { - error->all(FLERR, "Unknown compute nbond/type command {}", arg[iarg]); + error->all(FLERR, "Unknown compute nbond/atom command {}", arg[iarg]); } } diff --git a/src/RHEO/bond_rheo_shell.cpp b/src/RHEO/bond_rheo_shell.cpp index d366163459..0a3caa1b4f 100644 --- a/src/RHEO/bond_rheo_shell.cpp +++ b/src/RHEO/bond_rheo_shell.cpp @@ -25,6 +25,7 @@ #include "error.h" #include "fix_bond_history.h" #include "fix_rheo.h" +#include "fix_rheo_oxidation.h" #include "fix_store_local.h" #include "force.h" #include "memory.h" @@ -48,7 +49,12 @@ BondRHEOShell::BondRHEOShell(LAMMPS *_lmp) : partial_flag = 1; comm_reverse = 1; - tform = rmax = -1; + nhistory = 2; + update_flag = 1; + id_fix_bond_history = utils::strdup("HISTORY_RHEO_SHELL"); + ignore_special_flag = 1; + + tform = -1; single_extra = 1; svector = new double[1]; @@ -155,12 +161,14 @@ void BondRHEOShell::store_data() void BondRHEOShell::compute(int eflag, int vflag) { - if (!fix_bond_history->stored_flag) { fix_bond_history->stored_flag = true; store_data(); } + if (hybrid_flag) + fix_bond_history->compress_history(); + int i1, i2, itmp, n, type; double delx, dely, delz, delvx, delvy, delvz; double e, rsq, r, r0, rinv, dr, fbond, dot, t; @@ -168,6 +176,7 @@ void BondRHEOShell::compute(int eflag, int vflag) ev_init(eflag, vflag); + double *rsurface = compute_surface->rsurface; double **x = atom->x; double **v = atom->v; double **f = atom->f; @@ -223,7 +232,7 @@ void BondRHEOShell::compute(int eflag, int vflag) if (t < tform) { // Check if eligible - if (r > rmax || !(status[i1] & STATUS_SURFACE) || !(status[i2] & STATUS_SURFACE)) { + if (r > rmax || rsurface[i1] > rsurf || rsurface[i2] > rsurf) { bondlist[n][2] = 0; process_ineligibility(i1, i2); continue; @@ -286,6 +295,9 @@ void BondRHEOShell::compute(int eflag, int vflag) // If it has bonds, no shifting if (nbond[i] != 0) status[i] |= STATUS_NO_SHIFT; } + + if (hybrid_flag) + fix_bond_history->uncompress_history(); } /* ---------------------------------------------------------------------- */ @@ -339,6 +351,8 @@ void BondRHEOShell::coeff(int narg, char **arg) void BondRHEOShell::init_style() { + BondBPM::init_style(); + if (comm->ghost_velocity == 0) error->all(FLERR, "Bond rheo/shell requires ghost atoms store velocity"); @@ -350,37 +364,12 @@ void BondRHEOShell::init_style() "Bond rheo/shell requires surface calculation in fix rheo"); compute_surface = fix_rheo->compute_surface; - if (fix_rheo->oxidation_fix_defined != 1) - error->all(FLERR, "Need to define fix rheo/oxdiation to use bond rheo/shell"); - // check consistency in values (copy?), swap conditions to rsurf + fixes = modify->get_fix_by_style("^rheo/oxidation$"); + if (fixes.size() == 0) error->all(FLERR, "Need to define fix rheo/oxidation to use bond rheo/shell"); + class FixRHEOOxidation *fix_rheo_oxidation = dynamic_cast(fixes[0]); - if (!id_fix_bond_history) { - id_fix_bond_history = utils::strdup("HISTORY_RHEO_SHELL"); - fix_bond_history = dynamic_cast(modify->replace_fix( - id_fix_dummy2, fmt::format("{} all BOND_HISTORY 1 2", id_fix_bond_history), 1)); - delete[] id_fix_dummy2; - id_fix_dummy2 = nullptr; - } - - // Reproduce standard functions of BondBPM, removing special restrictions - // Since this bond is intended to be created by fix rheo/oxidation, it - // ignores special statuses - - if (id_fix_store_local) { - auto ifix = modify->get_fix_by_id(id_fix_store_local); - if (!ifix) error->all(FLERR, "Cannot find fix STORE/LOCAL id {}", id_fix_store_local); - if (strcmp(ifix->style, "STORE/LOCAL") != 0) - error->all(FLERR, "Incorrect fix style matched, not STORE/LOCAL: {}", ifix->style); - fix_store_local = dynamic_cast(ifix); - fix_store_local->nvalues = nvalues; - } - - id_fix_update = nullptr; - - if (force->angle || force->dihedral || force->improper) - error->all(FLERR, "Bond style rheo/shell cannot be used with 3,4-body interactions"); - if (atom->molecular == 2) - error->all(FLERR, "Bond style rheo/shell cannot be used with atom style template"); + rsurf = fix_rheo_oxidation->rsurf; + rmax = fix_rheo_oxidation->cut; } /* ---------------------------------------------------------------------- */ @@ -397,20 +386,13 @@ void BondRHEOShell::settings(int narg, char **arg) tform = utils::numeric(FLERR, arg[iarg + 1], false, lmp); if (tform < 0.0) error->all(FLERR, "Illegal bond rheo/shell value for t/form, {}", tform); i += 1; - } else if (strcmp(arg[iarg], "r/max") == 0) { - if (iarg + 1 > narg) error->all(FLERR, "Illegal bond rheo/shell command, missing option for r/max"); - rmax = utils::numeric(FLERR, arg[iarg + 1], false, lmp); - if (rmax < 0.0) error->all(FLERR, "Illegal bond rheo/shell value for r/max, {}", rmax); - i += 1; } else { error->all(FLERR, "Illegal bond rheo/shell command, invalid argument {}", arg[iarg]); } } if (tform < 0.0) - error->all(FLERR, "Illegal bond rheo/shell command, must specify t/form"); - if (rmax < 0.0) - error->all(FLERR, "Illegal bond rheo/shell command, must specify r/max"); + error->all(FLERR, "Illegal bond rheo/shell command, must specify formation time"); } @@ -467,7 +449,6 @@ void BondRHEOShell::read_restart(FILE *fp) void BondRHEOShell::write_restart_settings(FILE *fp) { fwrite(&tform, sizeof(double), 1, fp); - fwrite(&rmax, sizeof(double), 1, fp); } /* ---------------------------------------------------------------------- @@ -478,10 +459,8 @@ void BondRHEOShell::read_restart_settings(FILE *fp) { if (comm->me == 0) { utils::sfread(FLERR, &tform, sizeof(double), 1, fp, nullptr, error); - utils::sfread(FLERR, &rmax, sizeof(double), 1, fp, nullptr, error); } MPI_Bcast(&tform, 1, MPI_DOUBLE, 0, world); - MPI_Bcast(&rmax, 1, MPI_DOUBLE, 0, world); } @@ -570,13 +549,16 @@ void BondRHEOShell::process_ineligibility(int i, int j) if (i < nlocal) { for (m = 0; m < num_bond[i]; m++) { - if (bond_atom[i][m] == tag[j]) { + if (bond_atom[i][m] == tag[j] && setflag[bond_type[i][m]]) { bond_type[i][m] = 0; n = num_bond[i]; bond_type[i][m] = bond_type[i][n - 1]; bond_atom[i][m] = bond_atom[i][n - 1]; - fix_bond_history->shift_history(i, m, n - 1); - fix_bond_history->delete_history(i, n - 1); + for (auto &ihistory: histories) { + auto fix_bond_history2 = dynamic_cast (ihistory); + fix_bond_history2->shift_history(i, m, n - 1); + fix_bond_history2->delete_history(i, n - 1); + } num_bond[i]--; break; } @@ -585,13 +567,16 @@ void BondRHEOShell::process_ineligibility(int i, int j) if (j < nlocal) { for (m = 0; m < num_bond[j]; m++) { - if (bond_atom[j][m] == tag[i]) { + if (bond_atom[j][m] == tag[i] && setflag[bond_type[j][m]]) { bond_type[j][m] = 0; n = num_bond[j]; bond_type[j][m] = bond_type[j][n - 1]; bond_atom[j][m] = bond_atom[j][n - 1]; - fix_bond_history->shift_history(j, m, n - 1); - fix_bond_history->delete_history(j, n - 1); + for (auto &ihistory: histories) { + auto fix_bond_history2 = dynamic_cast (ihistory); + fix_bond_history2->shift_history(j, m, n - 1); + fix_bond_history2->delete_history(j, n - 1); + } num_bond[j]--; break; } diff --git a/src/RHEO/bond_rheo_shell.h b/src/RHEO/bond_rheo_shell.h index a6a747a3f1..828f693ea3 100644 --- a/src/RHEO/bond_rheo_shell.h +++ b/src/RHEO/bond_rheo_shell.h @@ -43,7 +43,7 @@ class BondRHEOShell : public BondBPM { protected: double *k, *ecrit, *gamma; - double tform, rmax; + double tform, rmax, rsurf; int *dbond, *nbond; int index_nb, nmax_store; diff --git a/src/RHEO/compute_rheo_property_atom.cpp b/src/RHEO/compute_rheo_property_atom.cpp index bdc9951f90..61b83a4542 100644 --- a/src/RHEO/compute_rheo_property_atom.cpp +++ b/src/RHEO/compute_rheo_property_atom.cpp @@ -160,27 +160,30 @@ void ComputeRHEOPropertyAtom::init() error->all(FLERR, "Cannot request velocity shifting property without corresponding option in fix rheo"); if (thermal_flag && !(fix_rheo->thermal_flag)) error->all(FLERR, "Cannot request thermal property without fix rheo/thermal"); - if (shell_flag && !(fix_rheo->oxidation_flag)) - error->all(FLERR, "Cannot request number of shell bonds without fix rheo/oxidation"); compute_interface = fix_rheo->compute_interface; compute_kernel = fix_rheo->compute_kernel; compute_surface = fix_rheo->compute_surface; compute_vshift = fix_rheo->compute_vshift; compute_grad = fix_rheo->compute_grad; +} +/* ---------------------------------------------------------------------- */ + +void ComputeRHEOPropertyAtom::setup() +{ if (thermal_flag) { - fixes = modify->get_fix_by_style("rheo/thermal"); + auto fixes = modify->get_fix_by_style("rheo/thermal"); fix_thermal = dynamic_cast(fixes[0]); } if (pressure_flag) { - fixes = modify->get_fix_by_style("rheo/pressure"); + auto fixes = modify->get_fix_by_style("rheo/pressure"); fix_pressure = dynamic_cast(fixes[0]); } if (shell_flag) { - fixes = modify->get_fix_by_style("rheo/oxidation"); + auto fixes = modify->get_fix_by_style("rheo/oxidation"); fix_oxidation = dynamic_cast(fixes[0]); } } diff --git a/src/RHEO/compute_rheo_property_atom.h b/src/RHEO/compute_rheo_property_atom.h index a66ef4ece6..fc5c5d1bd0 100644 --- a/src/RHEO/compute_rheo_property_atom.h +++ b/src/RHEO/compute_rheo_property_atom.h @@ -29,6 +29,7 @@ class ComputeRHEOPropertyAtom : public Compute { ComputeRHEOPropertyAtom(class LAMMPS *, int, char **); ~ComputeRHEOPropertyAtom() override; void init() override; + void setup() override; void compute_peratom() override; double memory_usage() override; diff --git a/src/RHEO/fix_rheo_oxidation.h b/src/RHEO/fix_rheo_oxidation.h index 5242d24460..be95efbf2c 100644 --- a/src/RHEO/fix_rheo_oxidation.h +++ b/src/RHEO/fix_rheo_oxidation.h @@ -37,12 +37,13 @@ class FixRHEOOxidation : public Fix { void pre_force(int) override; void post_integrate() override; int *nbond; + double rsurf, cut; private: int btype, index_nb; - double rsurf, cut, cutsq; - class NeighList *list; + double cutsq; + class NeighList *list; class ComputeRHEOSurface *compute_surface; class FixRHEO *fix_rheo; }; diff --git a/src/RHEO/fix_rheo_thermal.cpp b/src/RHEO/fix_rheo_thermal.cpp index 7d9aff5424..a133428d4a 100644 --- a/src/RHEO/fix_rheo_thermal.cpp +++ b/src/RHEO/fix_rheo_thermal.cpp @@ -270,13 +270,8 @@ void FixRHEOThermal::init() auto req = neighbor->add_request(this, NeighConst::REQ_OCCASIONAL); req->set_cutoff(cut_kernel); - // find instances of bond history to delete data - // skip history for shell, only exception + // find instances of bond history to delete/shift data histories = modify->get_fix_by_style("BOND_HISTORY"); - if (n_histories > 0) - for (int i = 0; i < histories.size(); i++) - if (strcmp(histories[i]->id, "HISTORY_RHEO_SHELL") == 0) - histories.erase(histories.begin() + i); n_histories = histories.size(); } } @@ -498,7 +493,7 @@ void FixRHEOThermal::break_bonds() int nlocal = atom->nlocal; int nall = nlocal + atom->nghost; - // Rapidly delete all bonds for local atoms that melt of a given type + // Delete all bonds for local atoms that melt of a given type for (int i = 0; i < nlocal; i++) { if (!(status[i] & STATUS_MELTING)) continue; for (m = (num_bond[i] - 1); m >= 0; m--) { @@ -543,7 +538,7 @@ void FixRHEOThermal::break_bonds() bondlist[n][2] = 0; // Delete bonds for non-melted local atoms (shifting) - if (i < nlocal) { + if (i < nlocal && !(status[i] & STATUS_MELTING)) { for (m = 0; m < num_bond[i]; m++) { if (bond_atom[i][m] == tag[j] && bond_type[i][m] == btype) { nmax = num_bond[i] - 1; @@ -562,7 +557,7 @@ void FixRHEOThermal::break_bonds() } } - if (j < nlocal) { + if (j < nlocal && !(status[j] & STATUS_MELTING)) { for (m = 0; m < num_bond[j]; m++) { if (bond_atom[j][m] == tag[i] && bond_type[j][m] == btype) { nmax = num_bond[j] - 1; diff --git a/src/RHEO/pair_rheo_solid.cpp b/src/RHEO/pair_rheo_solid.cpp index f6dcd95879..9b358420d2 100644 --- a/src/RHEO/pair_rheo_solid.cpp +++ b/src/RHEO/pair_rheo_solid.cpp @@ -327,6 +327,10 @@ double PairRHEOSolid::single(int i, int j, int itype, int jtype, double rsq, dou if (rsq > cutsq[itype][jtype]) return 0.0; + int *status = atom->status; + if (!(status[i] & STATUS_SOLID)) return 0.0; + if (!(status[j] & STATUS_SOLID)) return 0.0; + double **x = atom->x; double **v = atom->v; diff --git a/src/fix_bond_history.cpp b/src/fix_bond_history.cpp index 277df75085..461f91bd52 100644 --- a/src/fix_bond_history.cpp +++ b/src/fix_bond_history.cpp @@ -33,7 +33,7 @@ using namespace FixConst; /* ---------------------------------------------------------------------- */ FixBondHistory::FixBondHistory(LAMMPS *lmp, int narg, char **arg) : - Fix(lmp, narg, arg), bondstore(nullptr), id_fix(nullptr), id_array(nullptr) + Fix(lmp, narg, arg), bondstore(nullptr), bondtype_orig(nullptr), bondstore_comp(nullptr), bondstore_orig(nullptr), id_fix(nullptr), id_array(nullptr) { if (narg != 5) error->all(FLERR, "Illegal fix bond/history command"); @@ -53,7 +53,6 @@ FixBondHistory::FixBondHistory(LAMMPS *lmp, int narg, char **arg) : updated_bond_flag = 0; maxbond = 0; - allocate(); } /* ---------------------------------------------------------------------- */ @@ -65,6 +64,8 @@ FixBondHistory::~FixBondHistory() delete[] id_array; memory->destroy(bondstore); + memory->destroy(bondstore_comp); + memory->destroy(bondtype_orig); } /* ---------------------------------------------------------------------- */ @@ -135,6 +136,7 @@ void FixBondHistory::pre_exchange() int nlocal = atom->nlocal; tagint **bond_atom = atom->bond_atom; + int **bond_type = atom->bond_type; int *num_bond = atom->num_bond; tagint *tag = atom->tag; @@ -142,12 +144,12 @@ void FixBondHistory::pre_exchange() i1 = bondlist[n][0]; i2 = bondlist[n][1]; - // skip bond if already broken - if (bondlist[n][2] <= 0) { continue; } + // skip bond if already broken or not allocated + if (bondlist[n][2] <= 0 || !setflag[bondlist[n][2]]) { continue; } if (i1 < nlocal) { for (m = 0; m < num_bond[i1]; m++) { - if (bond_atom[i1][m] == tag[i2]) { + if (bond_atom[i1][m] == tag[i2] && setflag[bond_type[i1][m]]) { for (idata = 0; idata < ndata; idata++) { stored[i1][m * ndata + idata] = bondstore[n][idata]; } @@ -157,7 +159,7 @@ void FixBondHistory::pre_exchange() if (i2 < nlocal) { for (m = 0; m < num_bond[i2]; m++) { - if (bond_atom[i2][m] == tag[i1]) { + if (bond_atom[i2][m] == tag[i1] && setflag[bond_type[i2][m]]) { for (idata = 0; idata < ndata; idata++) { stored[i2][m * ndata + idata] = bondstore[n][idata]; } @@ -179,17 +181,21 @@ void FixBondHistory::allocate() else maxbond = static_cast(LB_FACTOR * atom->nbonds / comm->nprocs); memory->create(bondstore, maxbond, ndata, "fix_bond_store:bondstore"); + if (hybrid_flag) { + memory->create(bondstore_comp, maxbond, ndata, "fix_bond_store:bondstore_comp"); + memory->create(bondtype_orig, maxbond, "fix_bond_store:bondtype_orig"); + } } /* ---------------------------------------------------------------------- */ void FixBondHistory::setup_post_neighbor() { - //Grow array if number of bonds has increased - while (neighbor->nbondlist >= maxbond) { - maxbond += DELTA; - memory->grow(bondstore, maxbond, ndata, "fix_bond_store:bondstore"); - } + hybrid_flag = 0; + for (int i = 1; i <= atom->nbondtypes; i++) + if (!setflag[i]) hybrid_flag = 1; + + if (maxbond == 0) allocate(); pre_exchange(); post_neighbor(); @@ -206,6 +212,10 @@ void FixBondHistory::post_neighbor() while (neighbor->nbondlist >= maxbond) { maxbond += DELTA; memory->grow(bondstore, maxbond, ndata, "fix_bond_store:bondstore"); + if (hybrid_flag) { + memory->grow(bondstore_comp, maxbond, ndata, "fix_bond_store:bondstore_comp"); + memory->grow(bondtype_orig, maxbond, "fix_bond_store:bondtype_orig"); + } } int i1, i2, n, m, idata; @@ -215,6 +225,7 @@ void FixBondHistory::post_neighbor() int nlocal = atom->nlocal; tagint **bond_atom = atom->bond_atom; + int **bond_type = atom->bond_type; int *num_bond = atom->num_bond; tagint *tag = atom->tag; @@ -222,12 +233,12 @@ void FixBondHistory::post_neighbor() i1 = bondlist[n][0]; i2 = bondlist[n][1]; - // skip bond if already broken - if (bondlist[n][2] <= 0) { continue; } + // skip bond if already broken or not allocated + if (bondlist[n][2] <= 0 || !setflag[bondlist[n][2]]) { continue; } if (i1 < nlocal) { for (m = 0; m < num_bond[i1]; m++) { - if (bond_atom[i1][m] == tag[i2]) { + if (bond_atom[i1][m] == tag[i2] && setflag[bond_type[i1][m]]) { for (idata = 0; idata < ndata; idata++) { bondstore[n][idata] = stored[i1][m * ndata + idata]; } @@ -237,7 +248,7 @@ void FixBondHistory::post_neighbor() if (i2 < nlocal) { for (m = 0; m < num_bond[i2]; m++) { - if (bond_atom[i2][m] == tag[i1]) { + if (bond_atom[i2][m] == tag[i1] && setflag[bond_type[i2][m]]) { for (idata = 0; idata < ndata; idata++) { bondstore[n][idata] = stored[i2][m * ndata + idata]; } @@ -246,6 +257,12 @@ void FixBondHistory::post_neighbor() } } + if (hybrid_flag) { + nbondlist_orig = nbondlist; + for (n = 0; n < nbondlist; n++) + bondtype_orig[n] = bondlist[n][2]; + } + updated_bond_flag = 1; } @@ -294,6 +311,55 @@ void FixBondHistory::set_arrays(int i) for (int idata = 0; idata < ndata; idata++) stored[i][m * ndata + idata] = 0.0; } +/* ---------------------------------------------------------------------- + Compress history arrays, cutting out unused types, for bond hybrid +------------------------------------------------------------------------- */ + +void FixBondHistory::compress_history() +{ + // if this is a re-neighbor step or updating, compress bondstore + + int type; + int ncomp = 0; + if (update_flag || (neighbor->ago == 0)) { + for (int n = 0; n < nbondlist_orig; n++) { + type = bondtype_orig[n]; + if (type <= 0) continue; + if (setflag[type]) { + for (int m = 0; m < ndata; m++) + bondstore_comp[ncomp][m] = bondstore[n][m]; + ncomp += 1; + } + } + } + + // replace ptr to original array + bondstore_orig = bondstore; + bondstore = bondstore_comp; +} + +/* ---------------------------------------------------------------------- */ + +void FixBondHistory::uncompress_history() +{ + if (update_flag) { + int ncomp = 0; + for (int n = 0; n < nbondlist_orig; n++) { + type = bondtype_orig[n]; + + if (type <= 0) continue; + if (!setflag[type]) continue; + + for (int m = 0; m < ndata; m++) + bondstore[n][m] = bondstore_comp[ncomp][m]; + ncomp += 1; + } + } + + // restore ptr to original array + bondstore = bondstore_orig; +} + /* ---------------------------------------------------------------------- Delete bond by zeroing data ------------------------------------------------------------------------- */ diff --git a/src/fix_bond_history.h b/src/fix_bond_history.h index fafcf52bd9..8ee3132ab1 100644 --- a/src/fix_bond_history.h +++ b/src/fix_bond_history.h @@ -52,18 +52,29 @@ class FixBondHistory : public Fix { void check_cache(int, int); void clear_cache(); + // methods for bond style hybrid + void compress_history(); + void uncompress_history(); + // if data is temporarily stored while the bond_atom array // is being reordered, use map of vectors with pairs for keys // to enable quick look up std::map, std::vector> cached_histories; + int *setflag; // Set by BondBPM, which bond types are used double **bondstore; int stored_flag; protected: void allocate(); - int update_flag; //Flag whether history values can evolve + int hybrid_flag; + int nbondlist_orig; + int *bondtype_orig; + double **bondstore_comp; + double **bondstore_orig; + + int update_flag; // Flag whether history values can evolve int updated_bond_flag; int nbond, maxbond, ndata; int index; From c63c1856ec5c4300cb7e892d035d69c6d03b12ad Mon Sep 17 00:00:00 2001 From: jtclemm Date: Thu, 4 Apr 2024 11:21:42 -0600 Subject: [PATCH 076/158] Fix compilation error, edit artificial visc toggle --- src/RHEO/pair_rheo.cpp | 3 ++- src/fix_bond_history.cpp | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/RHEO/pair_rheo.cpp b/src/RHEO/pair_rheo.cpp index fe5a1d6dec..cb33b20bea 100644 --- a/src/RHEO/pair_rheo.cpp +++ b/src/RHEO/pair_rheo.cpp @@ -189,10 +189,11 @@ void PairRHEO::compute(int eflag, int vflag) pair_avisc_flag = 0; if (fluidi || fluidj) { pair_force_flag = 1; + if (interface_flag) pair_avisc_flag = 1; } if (fluidi && fluidj) { - pair_avisc_flag = 1; pair_rho_flag = 1; + pair_avisc_flag = 1; } wp = compute_kernel->calc_dw(i, j, dx[0], dx[1], dx[2], r); diff --git a/src/fix_bond_history.cpp b/src/fix_bond_history.cpp index 461f91bd52..8fa0b3f923 100644 --- a/src/fix_bond_history.cpp +++ b/src/fix_bond_history.cpp @@ -343,6 +343,7 @@ void FixBondHistory::compress_history() void FixBondHistory::uncompress_history() { if (update_flag) { + int type; int ncomp = 0; for (int n = 0; n < nbondlist_orig; n++) { type = bondtype_orig[n]; From 5383bd26139bb0a2584ee96a9f7ff1e9ba1735e5 Mon Sep 17 00:00:00 2001 From: jtclemm Date: Wed, 10 Apr 2024 09:47:55 -0600 Subject: [PATCH 077/158] More doc files, misc clean ups --- doc/src/Howto_rheo.rst | 4 +- doc/src/bond_rheo_shell.rst | 119 ++---- doc/src/compute_rheo_property_atom.rst | 39 +- doc/src/fix_rheo.rst | 2 + doc/src/fix_rheo_oxidation.rst | 53 +-- doc/src/fix_rheo_pressure.rst | 2 + doc/src/fix_rheo_thermal.rst | 2 + doc/src/fix_rheo_viscosity.rst | 2 + doc/src/pair_rheo.rst | 2 + doc/src/pair_rheo_react.rst | 67 --- doc/src/pair_rheo_solid.rst | 2 + src/RHEO/compute_rheo_property_atom.cpp | 54 ++- src/RHEO/compute_rheo_property_atom.h | 4 +- src/RHEO/fix_rheo.cpp | 6 + src/RHEO/fix_rheo_oxidation.cpp | 15 + src/RHEO/fix_rheo_stress.cpp | 137 ------- src/RHEO/fix_rheo_stress.h | 48 --- src/RHEO/fix_rheo_thermal.cpp | 15 + src/RHEO/pair_rheo_react.cpp | 515 ------------------------ src/RHEO/pair_rheo_react.h | 63 --- 20 files changed, 187 insertions(+), 964 deletions(-) delete mode 100644 doc/src/pair_rheo_react.rst delete mode 100644 src/RHEO/fix_rheo_stress.cpp delete mode 100644 src/RHEO/fix_rheo_stress.h delete mode 100644 src/RHEO/pair_rheo_react.cpp delete mode 100644 src/RHEO/pair_rheo_react.h diff --git a/doc/src/Howto_rheo.rst b/doc/src/Howto_rheo.rst index 146716ba18..db710d2366 100644 --- a/doc/src/Howto_rheo.rst +++ b/doc/src/Howto_rheo.rst @@ -90,10 +90,10 @@ criteria for creating/deleting a bond or altering force calculations). ---------- -.. _howto-howto_rheo_palermo: +.. _howto_rheo_palermo: **(Palermo)** Palermo, Clemmer, Wolf, O'Connor, in preparation. -.. _howto-howto_rheo_clemmer: +.. _howto_rheo_clemmer: **(Clemmer)** Clemmer, Pierce, O'Connor, Nevins, Jones, Lechman, Tencer, Appl. Math. Model., 130, 310-326 (2024). diff --git a/doc/src/bond_rheo_shell.rst b/doc/src/bond_rheo_shell.rst index 7f6bab1eab..713bd84136 100644 --- a/doc/src/bond_rheo_shell.rst +++ b/doc/src/bond_rheo_shell.rst @@ -10,10 +10,13 @@ Syntax bond_style rheo/shell keyword value attribute1 attribute2 ... -* optional keyword = *overlay/pair* or *store/local* or *smooth* or *break* +* required keyword = *t/form* +* optional keyword = *store/local* .. parsed-literal:: + *t/form* value = formation time for a bond (time units) + *store/local* values = fix_ID N attributes ... * fix_ID = ID of associated internal fix to store data * N = prepare data for output every this many timesteps @@ -24,56 +27,56 @@ 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 = *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 the reference length - - *break* value = *yes* or *no* - indicates whether bonds break during a run - Examples """""""" .. code-block:: LAMMPS - bond_style bpm/spring + bond_style rheo/shell t/form 10.0 bond_coeff 1 1.0 0.05 0.1 - bond_style bpm/spring myfix 1000 time id1 id2 - dump 1 all local 1000 dump.broken f_myfix[1] f_myfix[2] f_myfix[3] - dump_modify 1 write_header no - Description """"""""""" -.. versionadded:: 4May2022 +.. versionadded:: TBD -The *bpm/spring* bond style computes forces based on -deviations from the initial reference state of the two atoms. The -reference state is stored by each bond when it is first computed in +The *rheo/shell* bond style is designed to work with +:doc:`fix rheo/oxidation ` which creates candidate +bonds between eligible surface or near-surface particles. When a bond +is first created, it computes no forces and starts a timer. Forces are +not computed until the timer reaches the specified bond formation time +and the bond is fully enabled. If the two particles move outside of the +maximum bond distance or move into the bulk before the timer reaches +the formation time, the bond automatically deletes itself. Not that +this deletion does not generate any broken bond data saved to a +*store/local* fix. + +Before bonds are enabled, they are still treated as regular bonds by +all other parts of LAMMPS. This means they are written to data files +and counted in computes such as :doc:`nbond/atom `. +To only count enabled bonds, use the *nbond/shell* attribute in +:doc:`compute property/atom/rheo `. + +When enabled, the bond then computes forces based on deviations from +the initial reference state of the two atoms much like a BPM style +bond (as further discussed in the :doc:`BPM howto page `). +The reference state is stored by each bond when it is first enabled the setup of a run. Data is then preserved across run commands and is written to :doc:`binary restart files ` such that restarting -the system will not reset the reference state of a bond. +the system will not reset the reference state of a bond or the timer. -This bond style only applies central-body forces which conserve the -translational and rotational degrees of freedom of a bonded set of -particles based on a model described by Clemmer and Robbins -:ref:`(Clemmer) `. The force has a magnitude of +This bond style is based on a model described in Ref. +:ref:`(Clemmer) `. The force has a magnitude of .. math:: - F = k (r - r_0) w + F = 2 k (r - r_0) + \frac{2 * k}{r_0^2 \epsilon_c^2} (r - r_0)^3 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 -the bond type to 0 such that forces are no longer computed. +:math:`\epsilon_c` is maximum strain beyond which a bond breaks. 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 @@ -88,15 +91,6 @@ 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 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:: - - w = 1.0 - \left( \frac{r - r_0}{r_0 \epsilon_c} \right)^8 . - The following coefficients must be defined for each bond type via the :doc:`bond_coeff ` command as in the example above, or in the data file or restart files read by the :doc:`read_data @@ -106,22 +100,11 @@ the data file or restart files read by the :doc:`read_data * :math:`\epsilon_c` (unit less) * :math:`\gamma` (force/velocity units) -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 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. - -.. versionadded:: 28Mar2023 - -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 reaches a strain greater than :math:`\epsilon_c`, -it will trigger an error. +Unlike other BPM-style bonds, this bond style does not update special +bond settings when bonds are created or deleted. This bond style also +does not enforce specific :doc:`special_bonds ` settings. +This behavior is purposeful such :doc:`RHEO pair forces ` +and heat flows are still calculated. 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 @@ -187,39 +170,25 @@ extra quantity can be accessed by the Restrictions """""""""""" -This bond style is part of the BPM package. It is only enabled if +This bond style is part of the RHEO 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 between bonded atoms are to be disabled, -this bond style requires setting - -.. code-block:: LAMMPS - - special_bonds lj 0 1 1 coul 1 1 1 - -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 - - special_bonds lj/coul 1 1 1 - Related commands """""""""""""""" -:doc:`bond_coeff `, :doc:`pair bpm/spring ` +:doc:`bond_coeff `, :doc:`fix rheo/oxidation ` Default """"""" -The option defaults are *overlay/pair* = *no*, *smooth* = *yes*, *normalize* = *no*, and *break* = *yes* +NA ---------- -.. _fragment-Clemmer: +.. _howto_rheo_clemmer: -**(Clemmer)** Clemmer and Robbins, Phys. Rev. Lett. (2022). +**(Clemmer)** Clemmer, Pierce, O'Connor, Nevins, Jones, Lechman, Tencer, Appl. Math. Model., 130, 310-326 (2024). .. _Groot4: diff --git a/doc/src/compute_rheo_property_atom.rst b/doc/src/compute_rheo_property_atom.rst index 7f5de17c3b..8d1cf47f58 100644 --- a/doc/src/compute_rheo_property_atom.rst +++ b/doc/src/compute_rheo_property_atom.rst @@ -27,8 +27,8 @@ Syntax .. parsed-literal:: - *phase* = atom phase status - *chi* = atom phase neighborhood metric + *phase* = atom phase state + *chi* = atom local phase metric *surface* = atom surface status *surface/r* = atom distance from the surface *surface/divr* = divergence of position at atom position @@ -45,6 +45,7 @@ Syntax *status* = atom full status *rho* = atom density *grad/v/\** = atom velocity gradient + *nbond/shell* = number of oxide bonds Examples """""""" @@ -52,21 +53,34 @@ Examples .. code-block:: LAMMPS compute 1 all rheo/property/atom phase surface/r pressure + compute 2 all rheo/property/atom shift/v/x grad/v/xx Description """"""""""" -Define a computation that simply stores atom attributes specific to the -RHEO package for each atom in the group. This is useful so that the -values can be used by other :doc:`output commands ` that -take computes as inputs. See for example, the :doc:`compute reduce -`, :doc:`fix ave/atom `, :doc:`fix -ave/histo `, :doc:`fix ave/chunk `, -and :doc:`atom-style variable ` commands. +.. versionadded:: TBD + +Define a computation that stores atom attributes specific to the RHEO +package for each atom in the group. This is useful so that the values +can be used by other :doc:`output commands ` that take +computes as inputs. See for example, the +:doc:`compute reduce `, +:doc:`fix ave/atom `, +:doc:`fix ave/histo `, +:doc:`fix ave/chunk `, and +:doc:`atom-style variable ` commands. The possible attributes are described in more detail in other RHEO doc -pages include :doc:`fix rheo `, :doc:`pair rheo `, -and :doc:`the RHEO howto page `. +pages including :doc:`the RHEO howto page `. Many +properties require their respective fixes, listed below in related +commands, be defined. + +The *surface/n/\** and *shift/v/\** attributes are vectors that require +specification of the *x*, *y*, or *z* component, e.g. *surface/n/x*. + +The *grad/v/\** attribute is a tensor and requires specification of +the *xx*, *yy*, *zz*, *xy*, *xz*, *yx*, *yz*, *zx*, or *zy* component, +e.g. *grad/v/xy*. The values are stored in a per-atom vector or array as discussed below. Zeroes are stored for atoms not in the specified group or for @@ -98,7 +112,8 @@ Related commands :doc:`fix rheo/viscosity `, :doc:`fix rheo/pressure `, :doc:`fix rheo/thermal `, -:doc:`pair rheo ` +:doc:`fix rheo/oxdiation `, +:doc:`fix rheo ` Default """"""" diff --git a/doc/src/fix_rheo.rst b/doc/src/fix_rheo.rst index 76d4ae3972..f48dd3fcde 100644 --- a/doc/src/fix_rheo.rst +++ b/doc/src/fix_rheo.rst @@ -43,6 +43,8 @@ Examples Description """"""""""" +.. versionadded:: TBD + Perform time integration for RHEO particles, updating positions, velocities, and densities. For a detailed breakdown of the integration timestep and numerical details, see :ref:`(Palermo) `. For an diff --git a/doc/src/fix_rheo_oxidation.rst b/doc/src/fix_rheo_oxidation.rst index a747ec582f..42e2b6d59e 100644 --- a/doc/src/fix_rheo_oxidation.rst +++ b/doc/src/fix_rheo_oxidation.rst @@ -8,43 +8,42 @@ Syntax .. parsed-literal:: - fix ID group-ID rheo/oxidation cut btype + fix ID group-ID rheo/oxidation cut btype rsurf * ID, group-ID are documented in :doc:`fix ` command * rheo/oxidation = style name of this fix command * cut = maximum bond length (distance units) * btype = type of bonds created +* rsurf = distance from surface to create bonds (distance units) Examples """""""" .. code-block:: LAMMPS - fix 1 all rheo/oxidation 1.5 2 + fix 1 all rheo/oxidation 1.5 2 0.0 + fix 1 all rheo/oxidation 1.0 1 2.0 Description """"""""""" -This fix... +.. versionadded:: TBD -Each list consists of a series of type -ranges separated by commas. The range can be specified as a -single numeric value, or a wildcard asterisk can be used to specify a range -of values. This takes the form "\*" or "\*n" or "n\*" or "m\*n". For -example, if M = the number of atom types, then an asterisk with no numeric -values means all types from 1 to M. A leading asterisk means all types -from 1 to n (inclusive). A trailing asterisk means all types from n to M -(inclusive). A middle asterisk means all types from m to n (inclusive). -Note that all atom types must be included in exactly one of the N collections. +This fix dynamically creates bonds on the surface of fluids to +represent physical processes such as oxidation. It is intended +for use with bond style :doc:`bond rheo/shell `. -While the *Tfreeze* keyword is optional, the *conductivity* and -*specific/heat* keywords are mandatory. +Every timestep, particles check neighbors within a distance of *cut*. +This distance must be smaller than the kernel length defined in +:doc:`fix rheo `. If both particles are on the fluid surface, +or within a distance of *rsurf* from the surface, a bond of type +*btype* is created between the two particles. This process is +further described in Ref. :ref:`(Clemmer) `. -Multiple instances of this fix may be defined to apply different -properties to different groups. However, the union of fix groups -across all instances of fix rheo/thermal must cover all atoms. -If there are multiple instances of this fix, any intersections in -the fix groups will lead to incorrect thermal integration. +If used in conjunction with solid bodies, such as those generated +by the *react* option of :doc:`fix rheo/thermal `, +it is recommended that one uses a :doc:`hybrid bond style ` +with different bond types for solid and oxide bonds. Restart, fix_modify, output, run start/stop, minimize info """"""""""""""""""""""""""""""""""""""""""""""""""""""""""" @@ -58,10 +57,8 @@ the :doc:`run ` command. This fix is not invoked during :doc:`energy minim Restrictions """""""""""" -This fix must be used with an atom style that includes temperature, -heatflow, and conductivity such as atom_tyle rheo/thermal This fix -must be used in conjuction with :doc:`fix rheo ` with the -*thermal* setting. +This fix must be used with an bond style :doc:`rheo/shell ` +and :doc:`fix rheo ` with surface detection enabled. This fix is part of the RHEO package. It is only enabled if LAMMPS was built with that package. See the :doc:`Build package ` page for more info. @@ -70,12 +67,16 @@ Related commands """""""""""""""" :doc:`fix rheo `, -:doc:`fix rheo/viscosity `, -:doc:`fix rheo/pressure `, -:doc:`pair rheo `, +:doc:`bond rheo/shell `, :doc:`compute rheo/property/atom ` Default """"""" none + +---------- + +.. _howto_rheo_clemmer: + +**(Clemmer)** Clemmer, Pierce, O'Connor, Nevins, Jones, Lechman, Tencer, Appl. Math. Model., 130, 310-326 (2024). diff --git a/doc/src/fix_rheo_pressure.rst b/doc/src/fix_rheo_pressure.rst index 2edd703299..f2a994da88 100644 --- a/doc/src/fix_rheo_pressure.rst +++ b/doc/src/fix_rheo_pressure.rst @@ -33,6 +33,8 @@ Examples Description """"""""""" +.. versionadded:: TBD + This fix defines a pressure equation of state for RHEO particles. One can define different equations of state for different atom types, but an equation must be specified for every atom type. diff --git a/doc/src/fix_rheo_thermal.rst b/doc/src/fix_rheo_thermal.rst index 2ece5521bc..63d9f817ad 100644 --- a/doc/src/fix_rheo_thermal.rst +++ b/doc/src/fix_rheo_thermal.rst @@ -48,6 +48,8 @@ Examples Description """"""""""" +.. versionadded:: TBD + This fix performs time integration of temperature evolution for atom style rheo/thermal. In addition, it defines multiple thermal properties of particles and handles melting/solidification, if applicable. For more details diff --git a/doc/src/fix_rheo_viscosity.rst b/doc/src/fix_rheo_viscosity.rst index 64c6539acc..8c403f8d0b 100644 --- a/doc/src/fix_rheo_viscosity.rst +++ b/doc/src/fix_rheo_viscosity.rst @@ -32,6 +32,8 @@ Examples Description """"""""""" +.. versionadded:: TBD + This fix defines a viscosity for RHEO particles. One can define different viscosities for different atom types, but a viscosity must be specified for every atom type. diff --git a/doc/src/pair_rheo.rst b/doc/src/pair_rheo.rst index f6c3d9e3ba..9ad5586b97 100644 --- a/doc/src/pair_rheo.rst +++ b/doc/src/pair_rheo.rst @@ -31,6 +31,8 @@ Examples Description """"""""""" +.. versionadded:: TBD + Pair style *rheo* computes pressure and viscous forces between particles in the :doc:`rheo package `. If thermal evolution is turned on in :doc:`fix rheo `, then the pair style also calculates diff --git a/doc/src/pair_rheo_react.rst b/doc/src/pair_rheo_react.rst deleted file mode 100644 index 6e7eb49c9d..0000000000 --- a/doc/src/pair_rheo_react.rst +++ /dev/null @@ -1,67 +0,0 @@ -.. index:: pair_style rheo/react - -pair_style rheo/react command -========================= - -Syntax -"""""" - -.. code-block:: LAMMPS - - pair_style rheo/react - -Examples -"""""""" - -.. code-block:: LAMMPS - - pair_style rheo/react - pair_coeff * * 1.0 1.5 1.0 0.05 1.0 100 2.0 - -Description -""""""""""" - -pair style... - -The following coefficients must be defined for each pair of atom types -via the :doc:`pair_coeff ` command as in the example above, -or in the data file or restart files read by the -:doc:`read_data ` or :doc:`read_restart ` -commands, or by mixing as described below: - -* :math:`k` (force/distance units) -* :math:`r_max` (distance units) -* :math:`\epsilon` (unitless) -* :math:`\gamma` (force/velocity units) -* :math:`t_form` (time units) -* :math:`r_from_surface` (distance units) - ----------- - -Mixing, shift, table, tail correction, restart, rRESPA info -""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" - -This style does not support the :doc:`pair_modify ` -shift, table, and tail options. - -This style does not write information to :doc:`binary restart files `. Thus, you need to re-specify the pair_style and -pair_coeff commands in an input script that reads a restart file. - -This style can only be used via the *pair* keyword of the :doc:`run_style respa ` command. It does not support the *inner*, *middle*, *outer* keywords. - -Restrictions -"""""""""""" - -This fix is part of the RHEO package. It is only enabled if -LAMMPS was built with that package. See the :doc:`Build package ` page for more info. - -Related commands -"""""""""""""""" - -:doc:`fix rheo `, -:doc:`compute rheo/property/atom ` - -Default -""""""" - -none diff --git a/doc/src/pair_rheo_solid.rst b/doc/src/pair_rheo_solid.rst index ee86992776..4bac9b726f 100644 --- a/doc/src/pair_rheo_solid.rst +++ b/doc/src/pair_rheo_solid.rst @@ -21,6 +21,8 @@ Examples Description """"""""""" +.. versionadded:: TBD + Style *rheo/solid* is effectively a copy of pair style :doc:`bpm/spring ` except it only applies forces between solid RHEO particles, determined by checking the status of diff --git a/src/RHEO/compute_rheo_property_atom.cpp b/src/RHEO/compute_rheo_property_atom.cpp index 61b83a4542..11b03623b1 100644 --- a/src/RHEO/compute_rheo_property_atom.cpp +++ b/src/RHEO/compute_rheo_property_atom.cpp @@ -57,7 +57,8 @@ ComputeRHEOPropertyAtom::ComputeRHEOPropertyAtom(LAMMPS *lmp, int narg, char **a if (nvalues == 1) size_peratom_cols = 0; else size_peratom_cols = nvalues; - pressure_flag = thermal_flag = interface_flag = surface_flag = shift_flag = shell_flag = 0; + pressure_flag = thermal_flag = interface_flag = 0; + surface_flag = shift_flag = shell_flag = 0; // parse input values // customize a new keyword by adding to if statement @@ -70,32 +71,34 @@ ComputeRHEOPropertyAtom::ComputeRHEOPropertyAtom(LAMMPS *lmp, int narg, char **a for (int iarg = 3; iarg < narg; iarg++) { i = iarg-3; - if (strcmp(arg[iarg],"phase") == 0) { + if (strcmp(arg[iarg], "phase") == 0) { pack_choice[i] = &ComputeRHEOPropertyAtom::pack_phase; - } else if (strcmp(arg[iarg],"rho") == 0) { + } else if (strcmp(arg[iarg], "rho") == 0) { pack_choice[i] = &ComputeRHEOPropertyAtom::pack_rho; - } else if (strcmp(arg[iarg],"chi") == 0) { + } else if (strcmp(arg[iarg], "chi") == 0) { interface_flag = 1; pack_choice[i] = &ComputeRHEOPropertyAtom::pack_chi; - } else if (strcmp(arg[iarg],"surface") == 0) { + } else if (strcmp(arg[iarg], "surface") == 0) { surface_flag = 1; pack_choice[i] = &ComputeRHEOPropertyAtom::pack_surface; - } else if (strcmp(arg[iarg],"surface/r") == 0) { + } else if (strcmp(arg[iarg], "surface/r") == 0) { surface_flag = 1; pack_choice[i] = &ComputeRHEOPropertyAtom::pack_surface_r; - } else if (strcmp(arg[iarg],"surface/divr") == 0) { + } else if (strcmp(arg[iarg], "surface/divr") == 0) { surface_flag = 1; pack_choice[i] = &ComputeRHEOPropertyAtom::pack_surface_divr; } else if (utils::strmatch(arg[iarg], "^surface/n")) { surface_flag = 1; pack_choice[i] = &ComputeRHEOPropertyAtom::pack_surface_n; col_index[i] = get_vector_index(arg[iarg]); - } else if (strcmp(arg[iarg],"coordination") == 0) { + } else if (strcmp(arg[iarg], "coordination") == 0) { pack_choice[i] = &ComputeRHEOPropertyAtom::pack_coordination; - } else if (strcmp(arg[iarg],"pressure") == 0) { + } else if (strcmp(arg[iarg], "pressure") == 0) { pressure_flag = 1; pack_choice[i] = &ComputeRHEOPropertyAtom::pack_pressure; - } else if (strcmp(arg[iarg],"cv") == 0) { + } else if (strcmp(arg[iarg], "viscosity") == 0) { + pack_choice[i] = &ComputeRHEOPropertyAtom::pack_viscosity; + } else if (strcmp(arg[iarg], "cv") == 0) { thermal_flag = 1; pack_choice[i] = &ComputeRHEOPropertyAtom::pack_cv; } else if (utils::strmatch(arg[iarg], "^shift/v")) { @@ -113,7 +116,7 @@ ComputeRHEOPropertyAtom::ComputeRHEOPropertyAtom(LAMMPS *lmp, int narg, char **a arg[iarg], atom->get_style()); pack_choice[i] = &ComputeRHEOPropertyAtom::pack_atom_style; thermal_flag = 1; - } else if (strcmp(arg[iarg],"nbond/shell") == 0) { + } else if (strcmp(arg[iarg], "nbond/shell") == 0) { shell_flag = 1; pack_choice[i] = &ComputeRHEOPropertyAtom::pack_nbond_shell; } else { @@ -124,9 +127,9 @@ ComputeRHEOPropertyAtom::ComputeRHEOPropertyAtom(LAMMPS *lmp, int narg, char **a arg[iarg], atom->get_style()); pack_choice[i] = &ComputeRHEOPropertyAtom::pack_atom_style; - if (strcmp(arg[iarg],"temperature") == 0) thermal_flag = 1; - if (strcmp(arg[iarg],"heatflow") == 0) thermal_flag = 1; - if (strcmp(arg[iarg],"conductivity") == 0) thermal_flag = 1; + if (strcmp(arg[iarg], "temperature") == 0) thermal_flag = 1; + if (strcmp(arg[iarg], "heatflow") == 0) thermal_flag = 1; + if (strcmp(arg[iarg], "conductivity") == 0) thermal_flag = 1; } } @@ -149,7 +152,7 @@ ComputeRHEOPropertyAtom::~ComputeRHEOPropertyAtom() void ComputeRHEOPropertyAtom::init() { auto fixes = modify->get_fix_by_style("^rheo$"); - if (fixes.size() == 0) error->all(FLERR, "Need to define fix rheo to use fix rheo/viscosity"); + if (fixes.size() == 0) error->all(FLERR, "Need to define fix rheo to use compute rheo/property/atom"); fix_rheo = dynamic_cast(fixes[0]); if (interface_flag && !(fix_rheo->interface_flag)) @@ -390,6 +393,21 @@ void ComputeRHEOPropertyAtom::pack_pressure(int n) /* ---------------------------------------------------------------------- */ +void ComputeRHEOPropertyAtom::pack_viscosity(int n) +{ + int *mask = atom->mask; + double *viscosity = atom->viscosity; + int nlocal = atom->nlocal; + + for (int i = 0; i < nlocal; i++) { + if (mask[i] & groupbit) buf[n] = viscosity[i]; + else buf[n] = 0.0; + n += nvalues; + } +} + +/* ---------------------------------------------------------------------- */ + void ComputeRHEOPropertyAtom::pack_nbond_shell(int n) { int *nbond = fix_oxidation->nbond; @@ -490,11 +508,11 @@ int ComputeRHEOPropertyAtom::get_tensor_index(char* option) int ComputeRHEOPropertyAtom::get_vector_index(char* option) { int index; - if (utils::strmatch(option,"x$")) { + if (utils::strmatch(option, "x$")) { index = 0; - } else if (utils::strmatch(option,"y$")) { + } else if (utils::strmatch(option, "y$")) { index = 1; - } else if (utils::strmatch(option,"z$")) { + } else if (utils::strmatch(option, "z$")) { if (domain->dimension == 2) error->all(FLERR, "Invalid compute rheo/property/atom property {} in 2D", option); index = 2; diff --git a/src/RHEO/compute_rheo_property_atom.h b/src/RHEO/compute_rheo_property_atom.h index fc5c5d1bd0..a61455f0c5 100644 --- a/src/RHEO/compute_rheo_property_atom.h +++ b/src/RHEO/compute_rheo_property_atom.h @@ -35,7 +35,8 @@ class ComputeRHEOPropertyAtom : public Compute { private: int nvalues, nmax; - int pressure_flag, thermal_flag, interface_flag, surface_flag, shift_flag, shell_flag; + int pressure_flag, thermal_flag, interface_flag; + int surface_flag, shift_flag, shell_flag; int *avec_index; int *col_index; double *buf; @@ -55,6 +56,7 @@ class ComputeRHEOPropertyAtom : public Compute { void pack_shift_v(int); void pack_gradv(int); void pack_pressure(int); + void pack_viscosity(int); void pack_nbond_shell(int); void pack_atom_style(int); diff --git a/src/RHEO/fix_rheo.cpp b/src/RHEO/fix_rheo.cpp index 04b7d33541..98382b07b5 100644 --- a/src/RHEO/fix_rheo.cpp +++ b/src/RHEO/fix_rheo.cpp @@ -19,6 +19,7 @@ #include "fix_rheo.h" #include "atom.h" +#include "citeme.h" #include "compute_rheo_grad.h" #include "compute_rheo_interface.h" #include "compute_rheo_surface.h" @@ -37,6 +38,9 @@ using namespace LAMMPS_NS; using namespace RHEO_NS; using namespace FixConst; +static const char cite_rheo[] = + "TBD\n\n"; + /* ---------------------------------------------------------------------- */ FixRHEO::FixRHEO(LAMMPS *lmp, int narg, char **arg) : @@ -137,6 +141,8 @@ FixRHEO::FixRHEO(LAMMPS *lmp, int narg, char **arg) : } iarg += 1; } + + if (lmp->citeme) lmp->citeme->add(cite_rheo); } /* ---------------------------------------------------------------------- */ diff --git a/src/RHEO/fix_rheo_oxidation.cpp b/src/RHEO/fix_rheo_oxidation.cpp index f536df7842..bc31593653 100644 --- a/src/RHEO/fix_rheo_oxidation.cpp +++ b/src/RHEO/fix_rheo_oxidation.cpp @@ -20,6 +20,7 @@ #include "atom.h" #include "atom_vec.h" +#include "citeme.h" #include "compute_rheo_surface.h" #include "error.h" #include "fix_rheo.h" @@ -34,6 +35,18 @@ using namespace RHEO_NS; using namespace FixConst; enum {NONE, CONSTANT}; +static const char cite_rheo_oxide[] = + "@article{ApplMathModel.130.310,\n" + " title = {A hybrid smoothed-particle hydrodynamics model of oxide skins on molten aluminum},\n" + " journal = {Applied Mathematical Modelling},\n" + " volume = {130},\n" + " pages = {310-326},\n" + " year = {2024},\n" + " issn = {0307-904X},\n" + " doi = {https://doi.org/10.1016/j.apm.2024.02.027},\n" + " author = {Joel T. Clemmer and Flint Pierce and Thomas C. O'Connor and Thomas D. Nevins and Elizabeth M.C. Jones and Jeremy B. Lechman and John Tencer},\n" + "}\n\n"; + /* ---------------------------------------------------------------------- */ FixRHEOOxidation::FixRHEOOxidation(LAMMPS *lmp, int narg, char **arg) : @@ -51,6 +64,8 @@ FixRHEOOxidation::FixRHEOOxidation(LAMMPS *lmp, int narg, char **arg) : if (rsurf <= 0.0) error->all(FLERR, "Illegal surface distance {} in fix rheo/oxidation", cut); cutsq = cut * cut; + + if (lmp->citeme) lmp->citeme->add(cite_rheo_oxide); } /* ---------------------------------------------------------------------- */ diff --git a/src/RHEO/fix_rheo_stress.cpp b/src/RHEO/fix_rheo_stress.cpp deleted file mode 100644 index b391527f1c..0000000000 --- a/src/RHEO/fix_rheo_stress.cpp +++ /dev/null @@ -1,137 +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 authors: Joel Clemmer (SNL) ------------------------------------------------------------------------ */ - -#include "fix_rheo_stress.h" - -#include "atom.h" -#include "comm.h" -#include "compute.h" -#include "domain.h" -#include "fix_store_atom.h" -#include "group.h" -#include "error.h" -#include "modify.h" -#include "update.h" - -#include -#include - -using namespace LAMMPS_NS; -using namespace FixConst; - -/* ---------------------------------------------------------------------- */ - -FixRHEOStress::FixRHEOStress(LAMMPS *lmp, int narg, char **arg) : - id_compute(nullptr), id_fix(nullptr), stress_compute(nullptr), store_fix(nullptr), Fix(lmp, narg, arg) -{ - if (narg != 3) error->all(FLERR,"Illegal fix rheo/stress command"); - comm_forward = 6; -} - -/* ---------------------------------------------------------------------- */ - -FixRHEOStress::~FixRHEOStress() -{ - modify->delete_compute(id_compute); - modify->delete_fix(id_fix); -} - -/* ---------------------------------------------------------------------- */ - -void FixRHEOStress::post_constructor() -{ - id_fix = utils::strdup(std::string(id) + "_store"); - store_fix = dynamic_cast(modify->add_fix(fmt::format("{} {} STORE/ATOM d_pxx d_pyy d_pzz d_pxy d_pxz d_pyz", id_fix, group->names[igroup]))); - array_atom = store_fix->astore; - - id_compute = utils::strdup(std::string(id) + "_compute"); - stress_compute = modify->add_compute(fmt::format("{} {} stress/atom NULL ke pair bond", id_compute, group->names[igroup])); -} - -/* ---------------------------------------------------------------------- */ - -int FixRHEOStress::setmask() -{ - int mask = 0; - mask |= PRE_FORCE; - mask |= END_OF_STEP; - return mask; -} - -/* ---------------------------------------------------------------------- */ - -void FixRHEOStress::init() -{ - stress_compute->addstep(update->ntimestep+1); -} - -/* ---------------------------------------------------------------------- */ - -void FixRHEOStress::pre_force(int vflag) -{ - // add pre-force and forward to ghosts (not done in store/atom) - comm->forward_comm(this); -} - -/* ---------------------------------------------------------------------- */ - -void FixRHEOStress::end_of_step() -{ - stress_compute->compute_peratom(); - - // copy compute to fix property atom - double **saved_stress = store_fix->astore; - double **stress = stress_compute->array_atom; - - int ntotal = atom->nlocal+atom->nghost; - for (int i = 0; i < ntotal; i++) - for (int a = 0; a < 6; a++) - saved_stress[i][a] = stress[i][a]; - - stress_compute->addstep(update->ntimestep + 1); -} - -/* ---------------------------------------------------------------------- */ - -int FixRHEOStress::pack_forward_comm(int n, int *list, double *buf, - int /*pbc_flag*/, int * /*pbc*/) -{ - int i, j, a, m; - double **saved_stress = store_fix->astore; - - m = 0; - for (i = 0; i < n; i++) { - j = list[i]; - for (a = 0; a < 6; a++) - buf[m++] = saved_stress[j][a]; - } - return m; -} - -/* ---------------------------------------------------------------------- */ - -void FixRHEOStress::unpack_forward_comm(int n, int first, double *buf) -{ - int i, a, m, last; - double **saved_stress = store_fix->astore; - - m = 0; - last = first + n; - for (i = first; i < last; i++) - for (a = 0; a < 6; a++) - saved_stress[i][a] = buf[m++]; -} diff --git a/src/RHEO/fix_rheo_stress.h b/src/RHEO/fix_rheo_stress.h deleted file mode 100644 index 4bf522793f..0000000000 --- a/src/RHEO/fix_rheo_stress.h +++ /dev/null @@ -1,48 +0,0 @@ -/* -*- 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(rheo/stress,FixRHEOStress); -// clang-format on -#else - -#ifndef LMP_FIX_RHEO_STRESS_H -#define LMP_FIX_RHEO_STRESS_H - -#include "fix.h" - -namespace LAMMPS_NS { - -class FixRHEOStress : public Fix { - public: - FixRHEOStress(class LAMMPS *, int, char **); - ~FixRHEOStress() override; - void post_constructor() override; - int setmask() override; - void init() override; - void pre_force(int) override; - void end_of_step() override; - int pack_forward_comm(int, int *, double *, int, int *) override; - void unpack_forward_comm(int, int, double *) override; - - private: - char *id_compute, *id_fix; - class Compute *stress_compute; - class FixStoreAtom *store_fix; -}; - -} // namespace LAMMPS_NS - -#endif -#endif diff --git a/src/RHEO/fix_rheo_thermal.cpp b/src/RHEO/fix_rheo_thermal.cpp index a133428d4a..9fbdb8c8f6 100644 --- a/src/RHEO/fix_rheo_thermal.cpp +++ b/src/RHEO/fix_rheo_thermal.cpp @@ -20,6 +20,7 @@ #include "atom.h" #include "atom_vec.h" +#include "citeme.h" #include "comm.h" #include "compute_rheo_grad.h" #include "compute_rheo_vshift.h" @@ -43,6 +44,18 @@ using namespace RHEO_NS; using namespace FixConst; enum {NONE, CONSTANT}; +static const char cite_rheo_oxide[] = + "@article{ApplMathModel.130.310,\n" + " title = {A hybrid smoothed-particle hydrodynamics model of oxide skins on molten aluminum},\n" + " journal = {Applied Mathematical Modelling},\n" + " volume = {130},\n" + " pages = {310-326},\n" + " year = {2024},\n" + " issn = {0307-904X},\n" + " doi = {https://doi.org/10.1016/j.apm.2024.02.027},\n" + " author = {Joel T. Clemmer and Flint Pierce and Thomas C. O'Connor and Thomas D. Nevins and Elizabeth M.C. Jones and Jeremy B. Lechman and John Tencer},\n" + "}\n\n"; + /* ---------------------------------------------------------------------- */ FixRHEOThermal::FixRHEOThermal(LAMMPS *lmp, int narg, char **arg) : @@ -193,6 +206,8 @@ FixRHEOThermal::FixRHEOThermal(LAMMPS *lmp, int narg, char **arg) : if (Tc_style[i] == NONE && L_style[i] != NONE) error->all(FLERR, "Must specify critical temperature for atom type {} to use latent heat in fix rheo/thermal", i); } + + if (lmp->citeme) lmp->citeme->add(cite_rheo_oxide); } /* ---------------------------------------------------------------------- */ diff --git a/src/RHEO/pair_rheo_react.cpp b/src/RHEO/pair_rheo_react.cpp deleted file mode 100644 index 4709ea169e..0000000000 --- a/src/RHEO/pair_rheo_react.cpp +++ /dev/null @@ -1,515 +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 authors: - Joel Clemmer (SNL) ------------------------------------------------------------------------ */ - -#include "pair_rheo_react.h" - -#include "atom.h" -#include "comm.h" -#include "compute_rheo_surface.h" -#include "error.h" -#include "fix.h" -#include "fix_dummy.h" -#include "fix_neigh_history.h" -#include "fix_rheo.h" -#include "force.h" -#include "memory.h" -#include "modify.h" -#include "neighbor.h" -#include "neigh_list.h" -#include "neigh_request.h" -#include "update.h" -#include "utils.h" - -using namespace LAMMPS_NS; -using namespace RHEO_NS; - -/* ---------------------------------------------------------------------- */ - -PairRHEOReact::PairRHEOReact(LAMMPS *lmp) : Pair(lmp), - dbond(NULL) -{ - single_enable = 0; - size_history = 2; - beyond_contact = 1; - comm_reverse = 1; - nondefault_history_transfer = 1; - - // create dummy fix as placeholder for FixNeighHistory - // this is so final order of Modify:fix will conform to input script - - fix_history = nullptr; - fix_dummy = dynamic_cast( - modify->add_fix("NEIGH_HISTORY_RHEO_REACT_DUMMY" + std::to_string(instance_me) + " all DUMMY")); - - // For nbond, create an instance of fix property atom - // Need restarts + exchanging with neighbors since it needs to persist - // between timesteps (fix property atom will handle callbacks) - - int tmp1, tmp2; - index_nb = atom->find_custom("react_nbond", tmp1, tmp2); - if (index_nb == -1) { - id_fix = utils::strdup("pair_rheo_react_fix_property_atom"); - modify->add_fix(fmt::format("{} all property/atom i_react_nbond", id_fix)); - index_nb = atom->find_custom("react_nbond", tmp1, tmp2); - } - nbond = atom->ivector[index_nb]; - - //Store non-persistent per atom quantities, intermediate - - nmax_store = atom->nmax; - memory->create(dbond, nmax_store, "rheo/react:dbond"); -} - -/* ---------------------------------------------------------------------- */ - -PairRHEOReact::~PairRHEOReact() -{ - if (modify->nfix && fix_history) modify->delete_fix("NEIGH_HISTORY_RHEO_REACT" + std::to_string(instance_me)); - if (modify->nfix && fix_dummy) modify->delete_fix("NEIGH_HISTORY_RHEO_REACT_DUMMY" + std::to_string(instance_me)); - if (modify->nfix) modify->delete_fix(id_fix); - delete[] id_fix; - - if (allocated) { - memory->destroy(setflag); - memory->destroy(cutsq); - memory->destroy(cutbsq); - - memory->destroy(cutbond); - memory->destroy(k); - memory->destroy(eps); - memory->destroy(gamma); - memory->destroy(t_form); - memory->destroy(rlimit); - } - - memory->destroy(dbond); -} - -/* ---------------------------------------------------------------------- */ - -void PairRHEOReact::compute(int eflag, int vflag) -{ - int i, j, ii, jj, inum, jnum, fluidi, fluidj; - double xtmp, ytmp, ztmp, delx, dely, delz; - double vxtmp, vytmp, vztmp, delvx, delvy, delvz; - double rsq, r, rinv, r0, fpair, dot, smooth; - int itype, jtype; - - int *ilist, *jlist, *numneigh, **firstneigh; - int *saved, **firstsaved; - double *data, *alldata, **firstdata; - - ev_init(eflag,vflag); - - int bondupdate = 1; - if (update->setupflag) bondupdate = 0; - double dt = update->dt; - - double **x = atom->x; - double **v = atom->v; - double **f = atom->f; - int *type = atom->type; - int *status = atom->status; - int *mask = atom->mask; - int *nbond = atom->ivector[index_nb]; - double *rsurf = compute_surface->rsurface; - - int nlocal = atom->nlocal; - int newton_pair = force->newton_pair; - - inum = list->inum; - ilist = list->ilist; - numneigh = list->numneigh; - firstneigh = list->firstneigh; - firstsaved = fix_history->firstflag; - firstdata = fix_history->firstvalue; - - if (atom->nmax > nmax_store){ - nmax_store = atom->nmax; - memory->destroy(dbond); - memory->create(dbond, nmax_store, "rheo/react:dbond"); - } - - size_t nbytes = nmax_store * sizeof(int); - memset(&dbond[0], 0, nbytes); - - // loop over neighbors of my atoms - for (ii = 0; ii < inum; ii++) { - i = ilist[ii]; - itype = type[i]; - xtmp = x[i][0]; - ytmp = x[i][1]; - ztmp = x[i][2]; - vxtmp = v[i][0]; - vytmp = v[i][1]; - vztmp = v[i][2]; - fluidi = !(status[i] & PHASECHECK); - - saved = firstsaved[i]; - alldata = firstdata[i]; - jlist = firstneigh[i]; - jnum = numneigh[i]; - - for (jj = 0; jj < jnum; jj++) { - j = jlist[jj]; - j &= NEIGHMASK; - jtype = type[j]; - fluidj = !(status[j] & PHASECHECK); - data = &alldata[2*jj]; - - // If not bonded and there's an internal fluid particle, unsave any data and skip - if (!(saved[jj] == 1 && data[0] > 0)) { - if ((fluidi && (rsurf[i] > rlimit[itype][jtype])) || (fluidj && (rsurf[j] > rlimit[itype][jtype]))) { - saved[jj] = 0; - continue; - } - } - - // If both are solid, unbond and skip - if (!fluidi && !fluidj) { - //If bonded, deincrement - if (saved[jj] == 1 && data[0] > 0) { - dbond[i] --; - dbond[j] --; - } - saved[jj] = 0; - continue; - } - - delx = xtmp - x[j][0]; - dely = ytmp - x[j][1]; - delz = ztmp - x[j][2]; - rsq = delx * delx + dely * dely + delz * delz; - - // If unbonded and beyond bond distance, unsave and skip - if (data[0] == -1 && rsq > cutbsq[itype][jtype]) { - saved[jj] = 0; - continue; - } - - r = sqrt(rsq); - // Initialize data if not currently saved since all could bond if they are on the surface - if (saved[jj] == 0) { - data[0] = -1; - data[1] = 0; - saved[jj] = 1; - } - - // Check for bond formation (unbonded) or breakage (bonded) - if (data[0] == -1) { - // If unbonded, check if we count down to bonding if both on surface (not given for r or s) - if (bondupdate && (rsurf[i] <= rlimit[itype][jtype]) && (rsurf[j] <= rlimit[itype][jtype])) { - data[1] += dt; - if (data[1] >= t_form[itype][jtype]) { - data[0] = r; - dbond[i] ++; - dbond[j] ++; - data[1] = 0; - } - } - } else { - // If bonded, check if breaks in tension - r0 = data[0]; - if (r > ((1.0 + eps[itype][jtype]) * r0)) { - saved[jj] = 0; - dbond[i] --; - dbond[j] --; - data[0] = -1; - } - } - - // Skip if unbonded - if (data[0] <= 0) continue; - - delvx = vxtmp - v[j][0]; - delvy = vytmp - v[j][1]; - delvz = vztmp - v[j][2]; - rinv = 1.0 / r; - r0 = data[0]; - - fpair = k[itype][jtype] * (r0 - r); - - dot = delx * delvx + dely * delvy + delz * delvz; - fpair -= gamma[itype][jtype] * dot * rinv; - - smooth = 1.0; - if (r > r0) { - smooth = (r - r0) / (r0 * eps[itype][jtype]); - smooth *= smooth; - smooth *= smooth; - smooth = 1 - smooth; - } - - fpair *= rinv * smooth; - - f[i][0] += delx * fpair; - f[i][1] += dely * fpair; - f[i][2] += delz * fpair; - if (newton_pair || j < nlocal) { - f[j][0] -= delx * fpair; - f[j][1] -= dely * fpair; - f[j][2] -= delz * fpair; - } - - if (evflag) ev_tally(i, j, nlocal, newton_pair, 0.0, 0.0, fpair, delx, dely, delz); - } - } - - // Communicate changes in nbond - if (newton_pair) comm->reverse_comm(this); - - for(i = 0; i < nlocal; i++) { - fluidi = !(status[i] & PHASECHECK); - nbond[i] += dbond[i]; - - // If it has bonds it is reactive (no shifting) - // If a reactive particle breaks all bonds, return to fluid - // Keep it non-shifting for this timestep to be safe - if (nbond[i] != 0 && fluidi) status[i] |= STATUS_NO_SHIFT; - } - - if (vflag_fdotr) virial_fdotr_compute(); -} - -/* ---------------------------------------------------------------------- - allocate all arrays -------------------------------------------------------------------------- */ - -void PairRHEOReact::allocate() -{ - allocated = 1; - int n = atom->ntypes; - - memory->create(setflag, n + 1, n + 1, "pair:setflag"); - for (int i = 1; i <= n; i++) - for (int j = i; j <= n; j++) - setflag[i][j] = 0; - - memory->create(cutbond, n + 1, n + 1, "pair:cutbond"); - memory->create(cutbsq, n + 1, n + 1, "pair:cutbsq"); - memory->create(cutsq, n + 1, n + 1, "pair:cutsq"); - memory->create(k, n + 1, n + 1, "pair:k"); - memory->create(eps, n + 1, n + 1, "pair:eps"); - memory->create(gamma, n + 1, n + 1, "pair:gamma"); - memory->create(t_form, n + 1, n + 1, "pair:t_form"); - memory->create(rlimit, n + 1, n + 1, "pair:rlimit"); -} - -/* ---------------------------------------------------------------------- - global settings - ------------------------------------------------------------------------- */ - -void PairRHEOReact::settings(int narg, char **arg) -{ -} - -/* ---------------------------------------------------------------------- - set coeffs for one or more type pairs -------------------------------------------------------------------------- */ - -void PairRHEOReact::coeff(int narg, char **arg) -{ - if (narg != 9) error->all(FLERR, "Incorrect args for pair coefficients"); - if (!allocated) allocate(); - - int ilo, ihi, jlo, jhi; - utils::bounds(FLERR, arg[0], 1, atom->ntypes, ilo, ihi,error); - utils::bounds(FLERR, arg[1], 1, atom->ntypes, jlo, jhi,error); - - double k_one = utils::numeric(FLERR, arg[2], false, lmp); - double cutb_one = utils::numeric(FLERR, arg[3], false, lmp); - double eps_one = utils::numeric(FLERR, arg[4], false, lmp); - double gamma_one = utils::numeric(FLERR, arg[5], false, lmp); - double t_form_one = utils::numeric(FLERR, arg[6], false, lmp); - double rlimit_one = utils::numeric(FLERR, arg[7], false, lmp); - - if (k_one < 0.0 || eps_one < 0.0 || t_form_one < 0.0) - error->all(FLERR, "Illegal pair_style command"); - - int count = 0; - for (int i = ilo; i <= ihi; i++) { - for (int j = MAX(jlo,i); j <= jhi; j++) { - k[i][j] = k_one; - cutbond[i][j] = cutb_one; - eps[i][j] = eps_one; - gamma[i][j] = gamma_one; - t_form[i][j] = t_form_one; - rlimit[i][j] = rlimit_one; - setflag[i][j] = 1; - count++; - } - } - - if (count == 0) error->all(FLERR, "Incorrect args for pair coefficients"); -} - -/* ---------------------------------------------------------------------- - init specific to this pair style -------------------------------------------------------------------------- */ - -void PairRHEOReact::init_style() -{ - int irequest = neighbor->request(this, instance_me); - //neighbor->requests[irequest]->history = 1; - - if (fix_history == nullptr) { - auto cmd = fmt::format("NEIGH_HISTORY_RHEO_REACT{} all NEIGH_HISTORY {}", instance_me, size_history); - fix_history = dynamic_cast( - modify->replace_fix("NEIGH_HISTORY_RHEO_REACT_DUMMY" + std::to_string(instance_me), cmd, 1)); - fix_history->pair = this; - fix_dummy = nullptr; - } -} - -/* ---------------------------------------------------------------------- - setup specific to this pair style - ------------------------------------------------------------------------- */ - -void PairRHEOReact::setup() -{ - auto fixes = modify->get_fix_by_style("^rheo$"); - if (fixes.size() == 0) error->all(FLERR, "Need to define fix rheo to use fix rheo/tension"); - fix_rheo = dynamic_cast(fixes[0]); - - if (!fix_rheo->surface_flag) error->all(FLERR, - "Pair rheo/react requires surface calculation in fix rheo"); - - compute_surface = fix_rheo->compute_surface; - - if (force->newton_pair == 0) error->all(FLERR, - "Pair rheo/react needs newton pair on for bond changes to be consistent"); -} - -/* ---------------------------------------------------------------------- - init for one type pair i,j and corresponding j,i -------------------------------------------------------------------------- */ - -double PairRHEOReact::init_one(int i, int j) -{ - if (setflag[i][j] == 0) error->all(FLERR, "All pair coeffs are not set"); - - cutbsq[i][j] = cutbond[i][j] * cutbond[i][j]; - - cutbsq[j][i] = cutbsq[i][j]; - cutbond[j][i] = cutbond[i][j]; - k[j][i] = k[i][j]; - eps[j][i] = eps[i][j]; - gamma[j][i] = gamma[i][j]; - t_form[j][i] = t_form[i][j]; - rlimit[j][i] = rlimit[i][j]; - - double cut = cutbond[i][j] * (1.0 + eps[i][j]); - - return cut; -} - -/* ---------------------------------------------------------------------- - proc 0 writes to restart file -------------------------------------------------------------------------- */ - -void PairRHEOReact::write_restart(FILE *fp) -{ - write_restart_settings(fp); - - int i,j; - for (i = 1; i <= atom->ntypes; i++) - for (j = i; j <= atom->ntypes; j++) - fwrite(&setflag[i][j], sizeof(int), 1, fp); - if (setflag[i][j]) { - fwrite(&k[i][j], sizeof(double), 1, fp); - fwrite(&cutbond[i][j], sizeof(double), 1, fp); - fwrite(&eps[i][j], sizeof(double), 1, fp); - fwrite(&gamma[i][j], sizeof(double), 1, fp); - fwrite(&t_form[i][j], sizeof(double), 1, fp); - fwrite(&rlimit[i][j], sizeof(double), 1, fp); - } -} - -/* ---------------------------------------------------------------------- - proc 0 reads from restart file, bcasts -------------------------------------------------------------------------- */ - -void PairRHEOReact::read_restart(FILE *fp) -{ - read_restart_settings(fp); - allocate(); - - int i,j; - int me = comm->me; - for (i = 1; i <= atom->ntypes; i++) - for (j = i; j <= atom->ntypes; j++) { - if (me == 0) utils::sfread(FLERR, &setflag[i][j], sizeof(int), 1, fp, nullptr, error); - MPI_Bcast(&setflag[i][j], 1, MPI_INT, 0, world); - if (setflag[i][j]) { - if (me == 0) { - utils::sfread(FLERR, &k[i][j], sizeof(double), 1, fp, nullptr, error); - utils::sfread(FLERR, &cutbond[i][j], sizeof(double), 1, fp, nullptr, error); - utils::sfread(FLERR, &eps[i][j], sizeof(double), 1, fp, nullptr, error); - utils::sfread(FLERR, &gamma[i][j], sizeof(double), 1, fp, nullptr, error); - utils::sfread(FLERR, &t_form[i][j], sizeof(double), 1, fp, nullptr, error); - utils::sfread(FLERR, &rlimit[i][j], sizeof(double), 1, fp, nullptr, error); - } - MPI_Bcast(&k[i][j], 1,MPI_DOUBLE, 0, world); - MPI_Bcast(&cutbond[i][j], 1,MPI_DOUBLE, 0, world); - MPI_Bcast(&eps[i][j], 1,MPI_DOUBLE, 0, world); - MPI_Bcast(&gamma[i][j], 1,MPI_DOUBLE, 0, world); - MPI_Bcast(&t_form[i][j], 1,MPI_DOUBLE, 0, world); - MPI_Bcast(&rlimit[i][j], 1,MPI_DOUBLE, 0, world); - } - } -} - - - - -/* ---------------------------------------------------------------------- - transfer history during fix/neigh/history exchange - transfer same sign -------------------------------------------------------------------------- */ - -void PairRHEOReact::transfer_history(double* source, double* target) -{ - for (int i = 0; i < size_history; i++) - target[i] = source[i]; -} - -/* ---------------------------------------------------------------------- */ - -int PairRHEOReact::pack_reverse_comm(int n, int first, double *buf) -{ - int i, m, last; - m = 0; - last = first + n; - - for (i = first; i < last; i++) { - buf[m++] = dbond[i]; - } - return m; -} - -/* ---------------------------------------------------------------------- */ - -void PairRHEOReact::unpack_reverse_comm(int n, int *list, double *buf) -{ - int i, j, m; - - m = 0; - for (i = 0; i < n; i++) { - j = list[i]; - dbond[j] += buf[m++]; - } -} diff --git a/src/RHEO/pair_rheo_react.h b/src/RHEO/pair_rheo_react.h deleted file mode 100644 index 88d5dbeb0e..0000000000 --- a/src/RHEO/pair_rheo_react.h +++ /dev/null @@ -1,63 +0,0 @@ -/* -*- 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 PAIR_CLASS -// clang-format off -PairStyle(rheo/react,PairRHEOReact) -// clang-format on -#else - -#ifndef LMP_PAIR_RHEO_REACT_H -#define LMP_PAIR_RHEO_REACT_H - -#include "pair.h" - -namespace LAMMPS_NS { - -class PairRHEOReact : public Pair { - public: - PairRHEOReact(class LAMMPS *); - ~PairRHEOReact() override; - void compute(int, int) override; - void settings(int, char **) override; - void coeff(int, char **) override; - void init_style() override; - void setup() override; - double init_one(int, int) override; - void write_restart(FILE *) override; - void read_restart(FILE *) override; - int pack_reverse_comm(int, int, double *) override; - void unpack_reverse_comm(int, int *, double *) override; - - protected: - double **cutbond, **cutbsq, **k, **eps, **gamma, **t_form, **rlimit; - - void allocate(); - void transfer_history(double*, double*); - - int size_history; - int *dbond, *nbond; - - int index_nb, nmax_store; - char *id_fix; - - class FixDummy *fix_dummy; - class FixNeighHistory *fix_history; - class FixRHEO *fix_rheo; - class ComputeRHEOSurface *compute_surface; -}; - -} // namespace LAMMPS_NS - -#endif -#endif From 1135d6be64b7b2bd2fb1c0ffbebca2f6f7283197 Mon Sep 17 00:00:00 2001 From: jtclemm Date: Wed, 10 Apr 2024 10:44:41 -0600 Subject: [PATCH 078/158] Noting artificial/visc exception in doc --- doc/src/pair_rheo.rst | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/doc/src/pair_rheo.rst b/doc/src/pair_rheo.rst index f6c3d9e3ba..be7311c480 100644 --- a/doc/src/pair_rheo.rst +++ b/doc/src/pair_rheo.rst @@ -39,7 +39,10 @@ heat exchanged between particles. The *artificial/viscosity* keyword is used to specify the magnitude :math:`\zeta` of an optional artificial viscosity contribution to forces. This factor can help stabilize simulations by smoothing out small length -scale variations in velocity fields. +scale variations in velocity fields. Artificial viscous forces are only +exchanged by fluid particles unless interfaces are not reconstructed in +fix rheo, in which fluid particles will also exchange artificial viscous +forces with solid particles to improve stability. The *rho/damp* keyword is used to specify the magnitude :math:`\xi` of an optional pairwise damping term between the density of particles. This From 4220be380c3b4aa487dc85710d08d7cafa3dbbbd Mon Sep 17 00:00:00 2001 From: jtclemm Date: Wed, 24 Apr 2024 11:48:44 -0600 Subject: [PATCH 079/158] Finishing oxidation, adding hybrid compatability for BPM --- doc/src/Howto_rheo.rst | 8 +- doc/src/fix_rheo.rst | 20 +++-- src/.gitignore | 2 + src/BPM/bond_bpm.cpp | 2 +- src/GRANULAR/fix_add_heat.cpp | 138 ++++++++++++++++++++++++++++++++ src/GRANULAR/fix_add_heat.h | 45 +++++++++++ src/RHEO/bond_rheo_shell.cpp | 23 ++++-- src/RHEO/fix_rheo_oxidation.cpp | 21 +---- src/RHEO/fix_rheo_thermal.cpp | 6 +- src/RHEO/pair_rheo.cpp | 2 +- src/bond_hybrid.cpp | 26 ++++++ src/bond_hybrid.h | 1 + src/fix_bond_history.cpp | 13 +-- src/fix_bond_history.h | 3 +- 14 files changed, 260 insertions(+), 50 deletions(-) create mode 100644 src/GRANULAR/fix_add_heat.cpp create mode 100644 src/GRANULAR/fix_add_heat.h diff --git a/doc/src/Howto_rheo.rst b/doc/src/Howto_rheo.rst index db710d2366..748c91845b 100644 --- a/doc/src/Howto_rheo.rst +++ b/doc/src/Howto_rheo.rst @@ -31,9 +31,9 @@ properties like positions and forces, particles store a local density, viscosity, pressure, and status. If thermal evolution is modeled, one must use atom style rheo/thermal which also include a local temperature and conductivity. The status variable uses bitmasking to track various -properties of a particle such as its current phase (fluid or solid) and its -location relative to a surface. Many of these properties (and others) can -be easily accessed using +properties of a particle such as its current state of matter (fluid or solid) +and its location relative to a surface. Many of these properties (and others) +can be easily accessed using :doc:`compute rheo/property/atom `. Fluid interactions, including pressure forces, viscous forces, and heat exchange, @@ -84,7 +84,7 @@ breaking if stretched too far. Unlike the above method, this option does not rem the underlying fluid interactions (although particle shifting is turned off) and does not modify special bond settings of particles. -While these two options are not expected to be appropriate for every multiphase system, +While these two options are not expected to be appropriate for every system, either framework can be modified to create more suitable models (e.g. by changing the criteria for creating/deleting a bond or altering force calculations). diff --git a/doc/src/fix_rheo.rst b/doc/src/fix_rheo.rst index f48dd3fcde..5c46ad892e 100644 --- a/doc/src/fix_rheo.rst +++ b/doc/src/fix_rheo.rst @@ -80,14 +80,18 @@ surfaces. A modified form of Fickian particle shifting can be enabled with the *shift* keyword. This effectively shifts particle positions to generate a -more uniform spatial distribution. In systems with free surfaces, the -*surface/detection* keyword can be used to classify the location of -particles as being within the bulk fluid, on a free surface, or isolated -from other particles in a splash or droplet. Shifting is then disabled in -the direction away from the free surface to prevent it from diffusing -particles away from the bulk fluid. Surface detection can also be used -to control surface-nucleated effects like oxidation when used in combination -with :doc:`fix rheo/oxidation `. +more uniform spatial distribution. Shifting currently does consider the +type of a particle and therefore may be inappropriate in systems consisting +of multiple materials. + +In systems with free surfaces, the *surface/detection* keyword can be used +to classify the location of particles as being within the bulk fluid, on a +free surface, or isolated from other particles in a splash or droplet. +Shifting is then disabled in the direction away from the free surface to +prevent it from diffusing particles away from the bulk fluid. Surface +detection can also be used to control surface-nucleated effects like +oxidation when used in combination with +:doc:`fix rheo/oxidation `. The *surface/detection* keyword takes three arguments: *sdstyle*, *limit*, and *limi/splash*. The first, *sdstyle*, specifies whether surface particles diff --git a/src/.gitignore b/src/.gitignore index a77c6c58a6..1bf840cf31 100644 --- a/src/.gitignore +++ b/src/.gitignore @@ -765,6 +765,8 @@ /fix_acks2_reaxff.h /fix_adapt_fep.cpp /fix_adapt_fep.h +/fix_add_heat.cpp +/fix_add_heat.h /fix_addtorque.cpp /fix_addtorque.h /fix_append_atoms.cpp diff --git a/src/BPM/bond_bpm.cpp b/src/BPM/bond_bpm.cpp index 351cff1420..b0ebc37257 100644 --- a/src/BPM/bond_bpm.cpp +++ b/src/BPM/bond_bpm.cpp @@ -71,7 +71,7 @@ BondBPM::~BondBPM() if (id_fix_dummy) modify->delete_fix(id_fix_dummy); if (id_fix_dummy2) modify->delete_fix(id_fix_dummy2); if (id_fix_update) modify->delete_fix(id_fix_update); - if (id_fix_bond_history) modify->delete_fix(id_fix_bond_history); + if (fix_bond_history) modify->delete_fix(id_fix_bond_history); if (id_fix_store_local) modify->delete_fix(id_fix_store_local); if (id_fix_prop_atom) modify->delete_fix(id_fix_prop_atom); diff --git a/src/GRANULAR/fix_add_heat.cpp b/src/GRANULAR/fix_add_heat.cpp new file mode 100644 index 0000000000..2db3389560 --- /dev/null +++ b/src/GRANULAR/fix_add_heat.cpp @@ -0,0 +1,138 @@ +/* -*- 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. +------------------------------------------------------------------------- */ + +/* ---------------------------------------------------------------------- + Contributing author: Joel Clemmer (SNL) +------------------------------------------------------------------------- */ + +#include "fix_add_heat.h" + +#include "atom.h" +#include "error.h" +#include "input.h" +#include "memory.h" +#include "update.h" +#include "variable.h" + +using namespace LAMMPS_NS; +using namespace FixConst; + +enum { NONE, CONSTANT, EQUAL, ATOM }; + +/* ---------------------------------------------------------------------- */ + +FixAddHeat::FixAddHeat(LAMMPS *lmp, int narg, char **arg) : + Fix(lmp, narg, arg), varstr(nullptr), qatom(nullptr) +{ + if (narg < 4) utils::missing_cmd_args(FLERR, "fix add/heat", error); + dynamic_group_allow = 1; + overwrite_flag = 0; + + style = NONE; + if (utils::strmatch(arg[3], "^v_")) { + varstr = utils::strdup(arg[3] + 2); + } else { + value = utils::numeric(FLERR, arg[3], false, lmp); + style = CONSTANT; + } + + // optional args + + int iarg = 4; + while (iarg < narg) { + if (strcmp(arg[iarg], "overwrite") == 0) { + overwrite_flag = 1; + iarg += 1; + } else + error->all(FLERR, "Illegal fix viscous command"); + } + + maxatom = -1; +} + +/* ---------------------------------------------------------------------- */ + +FixAddHeat::~FixAddHeat() +{ + delete[] varstr; + memory->destroy(qatom); +} + +/* ---------------------------------------------------------------------- */ + +int FixAddHeat::setmask() +{ + int mask = 0; + mask |= POST_FORCE; + return mask; +} + +/* ---------------------------------------------------------------------- */ + +void FixAddHeat::init() +{ + if (!atom->temperature_flag) + error->all(FLERR, "Fix add/heat requires atom style with temperature property"); + if (!atom->heatflow_flag) + error->all(FLERR, "Fix add/heat requires atom style with heatflow property"); + + // check variable + + if (varstr) { + var = input->variable->find(varstr); + if (var < 0) error->all(FLERR, "Variable {} for fix addforce does not exist", varstr); + if (input->variable->equalstyle(var)) + style = EQUAL; + else if (input->variable->atomstyle(var)) + style = ATOM; + else + error->all(FLERR, "Variable {} for fix addforce is invalid style", varstr); + } +} + +/* ---------------------------------------------------------------------- */ + +void FixAddHeat::post_force(int /*vflag*/) +{ + int *mask = atom->mask; + double *heatflow = atom->heatflow; + double dtinv = 1.0 / update->dt; + + if (overwrite_flag) { + for (int i = 0; i < atom->nlocal; i++) + if (mask[i] & groupbit) + heatflow[i] = 0.0; + } + + if (style == CONSTANT) { + for (int i = 0; i < atom->nlocal; i++) + if (mask[i] & groupbit) + heatflow[i] += value * dtinv; + } else if (style == EQUAL) { + value = input->variable->compute_equal(var); + for (int i = 0; i < atom->nlocal; i++) + if (mask[i] & groupbit) + heatflow[i] += value * dtinv; + } else if (style == ATOM) { + + if (atom->nmax > maxatom) { + maxatom = atom->nmax; + memory->destroy(qatom); + memory->create(qatom, maxatom, "addheat:qatom"); + } + input->variable->compute_atom(var, igroup, &qatom[0], 1, 0); + for (int i = 0; i < atom->nlocal; i++) + if (mask[i] & groupbit) + heatflow[i] += qatom[i] * dtinv; + } +} diff --git a/src/GRANULAR/fix_add_heat.h b/src/GRANULAR/fix_add_heat.h new file mode 100644 index 0000000000..8a51f13ee4 --- /dev/null +++ b/src/GRANULAR/fix_add_heat.h @@ -0,0 +1,45 @@ +/* -*- 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(add/heat,FixAddHeat); +// clang-format on +#else + +#ifndef LMP_FIX_ADD_HEAT_H +#define LMP_FIX_ADD_HEAT_H + +#include "fix.h" + +namespace LAMMPS_NS { + +class FixAddHeat : public Fix { + public: + FixAddHeat(class LAMMPS *, int, char **); + ~FixAddHeat() override; + int setmask() override; + void init() override; + void post_force(int) override; + + protected: + double value; + int var, style, maxatom, overwrite_flag; + char *varstr; + double *qatom; +}; + +} // namespace LAMMPS_NS + +#endif +#endif diff --git a/src/RHEO/bond_rheo_shell.cpp b/src/RHEO/bond_rheo_shell.cpp index 0a3caa1b4f..6b464c4000 100644 --- a/src/RHEO/bond_rheo_shell.cpp +++ b/src/RHEO/bond_rheo_shell.cpp @@ -199,7 +199,6 @@ void BondRHEOShell::compute(int eflag, int vflag) memset(&dbond[0], 0, nbytes); for (n = 0; n < nbondlist; n++) { - // skip bond if already broken if (bondlist[n][2] <= 0) continue; @@ -218,8 +217,16 @@ void BondRHEOShell::compute(int eflag, int vflag) i2 = itmp; } - // If bond hasn't been set - set timer to zero - if (t < EPSILON || std::isnan(t)) r0 = store_bond(n, i1, i2); + delx = x[i1][0] - x[i2][0]; + dely = x[i1][1] - x[i2][1]; + delz = x[i1][2] - x[i2][2]; + rsq = delx * delx + dely * dely + delz * delz; + r = sqrt(rsq); + + // If bond hasn't been set - zero data + if (t < EPSILON || std::isnan(t)) + t = store_bond(n, i1, i2); + delx = x[i1][0] - x[i2][0]; dely = x[i1][1] - x[i2][1]; @@ -239,8 +246,9 @@ void BondRHEOShell::compute(int eflag, int vflag) } // Check ellapsed time - bondstore[n][1] += dt; - if (bondstore[n][1] >= tform) { + t += dt; + bondstore[n][1] = t; + if (t >= tform) { bondstore[n][0] = r; r0 = r; if (newton_bond || i1 < nlocal) dbond[i1] ++; @@ -285,7 +293,6 @@ void BondRHEOShell::compute(int eflag, int vflag) if (evflag) ev_tally(i1, i2, nlocal, newton_bond, 0.0, fbond, delx, dely, delz); } - // Communicate changes in nbond if (newton_bond) comm->reverse_comm(this); @@ -555,7 +562,7 @@ void BondRHEOShell::process_ineligibility(int i, int j) bond_type[i][m] = bond_type[i][n - 1]; bond_atom[i][m] = bond_atom[i][n - 1]; for (auto &ihistory: histories) { - auto fix_bond_history2 = dynamic_cast (ihistory); + auto fix_bond_history2 = dynamic_cast (ihistory); fix_bond_history2->shift_history(i, m, n - 1); fix_bond_history2->delete_history(i, n - 1); } @@ -573,7 +580,7 @@ void BondRHEOShell::process_ineligibility(int i, int j) bond_type[j][m] = bond_type[j][n - 1]; bond_atom[j][m] = bond_atom[j][n - 1]; for (auto &ihistory: histories) { - auto fix_bond_history2 = dynamic_cast (ihistory); + auto fix_bond_history2 = dynamic_cast (ihistory); fix_bond_history2->shift_history(j, m, n - 1); fix_bond_history2->delete_history(j, n - 1); } diff --git a/src/RHEO/fix_rheo_oxidation.cpp b/src/RHEO/fix_rheo_oxidation.cpp index bc31593653..46eaab3bf1 100644 --- a/src/RHEO/fix_rheo_oxidation.cpp +++ b/src/RHEO/fix_rheo_oxidation.cpp @@ -108,7 +108,7 @@ void FixRHEOOxidation::init() nbond = atom->ivector[index_nb]; // need a half neighbor list - auto req = neighbor->add_request(this, NeighConst::REQ_DEFAULT); + auto req = neighbor->add_request(this, NeighConst::REQ_FULL); req->set_cutoff(cut); } @@ -200,31 +200,16 @@ void FixRHEOOxidation::post_integrate() } if (bflag) continue; - for (n = 0; n < num_bond[j]; n++) { - if (bond_type[j][n] == btype && bond_atom[j][n] == tagi) { - bflag = 1; - break; - } - } - if (bflag) continue; - // Add bonds to owned atoms // If newton bond, add to both, otherwise add to whichever has a smaller tag - if (i < nlocal && (!newton_bond || tagi < tagj)) { + + if (!newton_bond || tagi < tagj) { if (num_bond[i] == atom->bond_per_atom) error->one(FLERR,"New bond exceeded bonds per atom in fix rheo/oxidation for atom {}", tagi); bond_type[i][num_bond[i]] = btype; bond_atom[i][num_bond[i]] = tagj; num_bond[i]++; } - - if (j < nlocal && (!newton_bond || tagj < tagi)) { - if (num_bond[j] == atom->bond_per_atom) - error->one(FLERR,"New bond exceeded bonds per atom in fix rheo/oxidation for atom {}", tagj); - bond_type[j][num_bond[j]] = btype; - bond_atom[j][num_bond[j]] = tagi; - num_bond[j]++; - } } } } diff --git a/src/RHEO/fix_rheo_thermal.cpp b/src/RHEO/fix_rheo_thermal.cpp index 9fbdb8c8f6..3a39bbe596 100644 --- a/src/RHEO/fix_rheo_thermal.cpp +++ b/src/RHEO/fix_rheo_thermal.cpp @@ -543,8 +543,8 @@ void FixRHEOThermal::break_bonds() // Update bond list and break solid-melted bonds for (n = 0; n < nbondlist; n++) { - // skip bond if already broken - if (bondlist[n][2] <= 0) continue; + // skip bond if not correct type + if (bondlist[n][2] != btype) continue; i = bondlist[n][0]; j = bondlist[n][1]; @@ -561,7 +561,7 @@ void FixRHEOThermal::break_bonds() bond_atom[i][m] = bond_atom[i][nmax]; if (n_histories > 0) for (auto &ihistory: histories) { - auto fix_bond_history = dynamic_cast (ihistory); + auto fix_bond_history = dynamic_cast (ihistory); fix_bond_history->shift_history(i, m, nmax); fix_bond_history->delete_history(i, nmax); } diff --git a/src/RHEO/pair_rheo.cpp b/src/RHEO/pair_rheo.cpp index cb33b20bea..6e8c20a5d8 100644 --- a/src/RHEO/pair_rheo.cpp +++ b/src/RHEO/pair_rheo.cpp @@ -189,7 +189,7 @@ void PairRHEO::compute(int eflag, int vflag) pair_avisc_flag = 0; if (fluidi || fluidj) { pair_force_flag = 1; - if (interface_flag) pair_avisc_flag = 1; + if (!interface_flag) pair_avisc_flag = 1; } if (fluidi && fluidj) { pair_rho_flag = 1; diff --git a/src/bond_hybrid.cpp b/src/bond_hybrid.cpp index 5f84db1886..910e9a5574 100644 --- a/src/bond_hybrid.cpp +++ b/src/bond_hybrid.cpp @@ -34,6 +34,7 @@ BondHybrid::BondHybrid(LAMMPS *lmp) : Bond(lmp) nstyles = 0; has_quartic = -1; nbondlist = nullptr; + orig_map = nullptr; maxbond = nullptr; bondlist = nullptr; } @@ -55,6 +56,7 @@ BondHybrid::~BondHybrid() memory->destroy(setflag); memory->destroy(map); delete[] nbondlist; + delete[] orig_map; delete[] maxbond; for (int i = 0; i < nstyles; i++) memory->destroy(bondlist[i]); delete[] bondlist; @@ -88,6 +90,10 @@ void BondHybrid::compute(int eflag, int vflag) memory->destroy(bondlist[m]); maxbond[m] = nbondlist[m] + EXTRA; memory->create(bondlist[m], maxbond[m], 3, "bond_hybrid:bondlist"); + if (partial_flag) { + memory->destroy(orig_map[m]); + memory->create(orig_map[m], maxbond[m], "bond_hybrid:orig_map"); + } } nbondlist[m] = 0; } @@ -98,6 +104,8 @@ void BondHybrid::compute(int eflag, int vflag) bondlist[m][n][0] = bondlist_orig[i][0]; bondlist[m][n][1] = bondlist_orig[i][1]; bondlist[m][n][2] = bondlist_orig[i][2]; + if (partial_flag) + orig_map[m][n] = i; nbondlist[m]++; } } @@ -142,6 +150,19 @@ void BondHybrid::compute(int eflag, int vflag) } } + // if bond type can be set to zero and deleted, update bondlist_orig + tagint *tag = atom->tag; + if (partial_flag) { + for (m = 0; m < nstyles; m++) { + for (i = 0; i < nbondlist[m]; i++) { + if (bondlist[m][i][2] <= 0) { + n = orig_map[m][i]; + bondlist_orig[n][2] = bondlist[m][i][2]; + } + } + } + } + // restore ptrs to original bondlist neighbor->nbondlist = nbondlist_orig; @@ -161,9 +182,11 @@ void BondHybrid::allocate() nbondlist = new int[nstyles]; maxbond = new int[nstyles]; + orig_map = new int *[nstyles]; bondlist = new int **[nstyles]; for (int m = 0; m < nstyles; m++) maxbond[m] = 0; for (int m = 0; m < nstyles; m++) bondlist[m] = nullptr; + for (int m = 0; m < nstyles; m++) orig_map[m] = nullptr; } /* ---------------------------------------------------------------------- @@ -191,6 +214,8 @@ void BondHybrid::settings(int narg, char **arg) memory->destroy(map); delete[] nbondlist; delete[] maxbond; + for (i = 0; i < nstyles; i++) memory->destroy(orig_map[i]); + delete[] orig_map; for (i = 0; i < nstyles; i++) memory->destroy(bondlist[i]); delete[] bondlist; } @@ -355,6 +380,7 @@ void BondHybrid::init_style() // to create an entry for it in the bond type to sub-style map if (has_quartic >= 0) map[0] = has_quartic; + else map[0] = -1; } /* ---------------------------------------------------------------------- diff --git a/src/bond_hybrid.h b/src/bond_hybrid.h index df1437c038..282a719be5 100644 --- a/src/bond_hybrid.h +++ b/src/bond_hybrid.h @@ -50,6 +50,7 @@ class BondHybrid : public Bond { int *nbondlist; // # of bonds in sub-style bondlists int *maxbond; // max # of bonds sub-style lists can store int ***bondlist; // bondlist for each sub-style + int **orig_map; // location of substyle bond in original bondlist void allocate(); void flags(); diff --git a/src/fix_bond_history.cpp b/src/fix_bond_history.cpp index 8fa0b3f923..c2be1d481c 100644 --- a/src/fix_bond_history.cpp +++ b/src/fix_bond_history.cpp @@ -324,12 +324,13 @@ void FixBondHistory::compress_history() if (update_flag || (neighbor->ago == 0)) { for (int n = 0; n < nbondlist_orig; n++) { type = bondtype_orig[n]; + if (type <= 0) continue; - if (setflag[type]) { - for (int m = 0; m < ndata; m++) - bondstore_comp[ncomp][m] = bondstore[n][m]; - ncomp += 1; - } + if (!setflag[type]) continue; + + for (int m = 0; m < ndata; m++) + bondstore_comp[ncomp][m] = bondstore[n][m]; + ncomp += 1; } } @@ -352,7 +353,7 @@ void FixBondHistory::uncompress_history() if (!setflag[type]) continue; for (int m = 0; m < ndata; m++) - bondstore[n][m] = bondstore_comp[ncomp][m]; + bondstore_orig[n][m] = bondstore[ncomp][m]; ncomp += 1; } } diff --git a/src/fix_bond_history.h b/src/fix_bond_history.h index 8ee3132ab1..880a31eb35 100644 --- a/src/fix_bond_history.h +++ b/src/fix_bond_history.h @@ -64,6 +64,7 @@ class FixBondHistory : public Fix { int *setflag; // Set by BondBPM, which bond types are used double **bondstore; int stored_flag; + int ndata; protected: void allocate(); @@ -76,7 +77,7 @@ class FixBondHistory : public Fix { int update_flag; // Flag whether history values can evolve int updated_bond_flag; - int nbond, maxbond, ndata; + int nbond, maxbond; int index; char *id_fix; char *id_array; From 21cae39d140c94e08fead15cff6a142c217a81f0 Mon Sep 17 00:00:00 2001 From: jtclemm Date: Wed, 24 Apr 2024 13:04:51 -0600 Subject: [PATCH 080/158] Documentation for fix add/heat --- doc/src/fix_add_heat.rst | 87 ++++++++++++++++++++++++++++++++++++ doc/src/fix_heat_flow.rst | 10 ++++- doc/src/fix_rheo_thermal.rst | 3 +- 3 files changed, 97 insertions(+), 3 deletions(-) create mode 100644 doc/src/fix_add_heat.rst diff --git a/doc/src/fix_add_heat.rst b/doc/src/fix_add_heat.rst new file mode 100644 index 0000000000..3964c96b27 --- /dev/null +++ b/doc/src/fix_add_heat.rst @@ -0,0 +1,87 @@ +.. index:: fix add/heat + +fix add/heat command +==================== + +Syntax +"""""" + +.. code-block:: LAMMPS + + fix ID group-ID add/heat rate values ... + +* ID, group-ID are documented in :doc:`fix ` command +* add/heat = style name of this fix command +* rate = rate of heat flow (energy/time units) +* zero or more keyword/value pairs may be appended to args +* keyword = *overwrite* + + .. parsed-literal:: + + *overwrite* = sets the heat flow instead of adding it + +Examples +"""""""" + +.. code-block:: LAMMPS + + fix 1 all add/heat v_heat + fix 1 all add/heat 1.0 overwrite + +Description +""""""""""" + +This fix adds heat to particles every timestep at a given rate. The rate +can be can be specified as an equal-style or atom-style +:doc:`variable `. If the value is a variable, it should be +specified as v_name, where name is the variable name. In this case, the +variable will be evaluated each time step, and its value will be used to +determine the rate of heat added. + +Equal-style variables can specify formulas with various mathematical +functions and include :doc:`thermo_style ` command +keywords for the simulation box parameters, time step, and elapsed time. +Thus, it is easy to specify time-dependent heating. + +Atom-style variables can specify the same formulas as equal-style +variables but can also include per-atom values, such as atom +coordinates. Thus, it is easy to specify a spatially-dependent heating +field with optional time-dependence as well. + +If the *overwrite* keyword is specified, this fix will effectively set +the total heat flow on a particle, overwriting contributions from other +pair styles. + +---------- + +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 global or per-atom quantities are stored by this fix for access by various +:doc:`output commands `. 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 `. + +Restrictions +"""""""""""" + +This pair style is part of the GRANULAR package. It is +only enabled if LAMMPS was built with that package. +See the :doc:`Build package ` page for more info. + +This fix requires that atoms store temperature and heat flow +as defined by the :doc:`fix property/atom ` command. + +Related commands +"""""""""""""""" + +:doc:`fix heat/flow `, +:doc:`fix property/atom `, +:doc:`fix rheo/thermal ` + +Default +""""""" + +none diff --git a/doc/src/fix_heat_flow.rst b/doc/src/fix_heat_flow.rst index 1ca99a1686..aa2b3fbc06 100644 --- a/doc/src/fix_heat_flow.rst +++ b/doc/src/fix_heat_flow.rst @@ -1,7 +1,7 @@ .. index:: fix heat/flow fix heat/flow command -========================== +===================== Syntax """""" @@ -56,13 +56,19 @@ not invoked during :doc:`energy minimization `. Restrictions """""""""""" +This pair style is part of the GRANULAR package. It is +only enabled if LAMMPS was built with that package. +See the :doc:`Build package ` page for more info. + This fix requires that atoms store temperature and heat flow as defined by the :doc:`fix property/atom ` command. Related commands """""""""""""""" -:doc:`pair granular `, :doc:`fix property/atom ` +:doc:`pair granular `, +:doc:`fix add/heat `, +:doc:`fix property/atom ` Default """"""" diff --git a/doc/src/fix_rheo_thermal.rst b/doc/src/fix_rheo_thermal.rst index 63d9f817ad..2ffb665bb7 100644 --- a/doc/src/fix_rheo_thermal.rst +++ b/doc/src/fix_rheo_thermal.rst @@ -109,7 +109,8 @@ Related commands :doc:`fix rheo `, :doc:`pair rheo `, -:doc:`compute rheo/property/atom ` +:doc:`compute rheo/property/atom `, +:doc:`fix add/heat ` Default """"""" From 7ad74ffbd8eba648d9cbf2cbbb183ea13904ea36 Mon Sep 17 00:00:00 2001 From: jtclemm Date: Wed, 24 Apr 2024 13:10:44 -0600 Subject: [PATCH 081/158] Removing unused files --- src/RHEO/fix_rheo_tension.cpp | 718 ---------------------------------- src/RHEO/fix_rheo_tension.h | 59 --- 2 files changed, 777 deletions(-) delete mode 100644 src/RHEO/fix_rheo_tension.cpp delete mode 100644 src/RHEO/fix_rheo_tension.h diff --git a/src/RHEO/fix_rheo_tension.cpp b/src/RHEO/fix_rheo_tension.cpp deleted file mode 100644 index 388b574365..0000000000 --- a/src/RHEO/fix_rheo_tension.cpp +++ /dev/null @@ -1,718 +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 authors: - Joel Clemmer (SNL) ------------------------------------------------------------------------ */ - -// Todo: -// add citations -// remove (or fix) pairwise forces on undercoordinated atoms -// add option for vacuum tension (Frustenau 2020?) - -#include "fix_rheo_tension.h" - -#include "atom.h" -#include "comm.h" -#include "compute_rheo_kernel.h" -#include "compute_rheo_interface.h" -#include "compute_rheo_vshift.h" -#include "domain.h" -#include "error.h" -#include "fix_rheo.h" -#include "force.h" -#include "math_extra.h" -#include "memory.h" -#include "modify.h" -#include "neighbor.h" -#include "neigh_list.h" -#include "update.h" -#include "utils.h" - -#include - -using namespace LAMMPS_NS; -using namespace RHEO_NS; -using namespace MathExtra; -using namespace FixConst; - -/* ---------------------------------------------------------------------- */ - -FixRHEOTension::FixRHEOTension(LAMMPS *lmp, int narg, char **arg) : - Fix(lmp, narg, arg), compute_kernel(nullptr), compute_interface(nullptr), compute_vshift(nullptr), fix_rheo(nullptr), rho0(nullptr) -{ - if (narg != 8) error->all(FLERR,"Illegal fix command"); - alpha = utils::numeric(FLERR, arg[3], false, lmp); - beta = utils::numeric(FLERR, arg[4], false, lmp); - wmin = utils::numeric(FLERR, arg[5], false, lmp); - cmin = utils::numeric(FLERR, arg[6], false, lmp); - vshift_strength = utils::numeric(FLERR, arg[7], false, lmp); - - comm_forward = 3; - comm_reverse = 3; - - // Create cgrad, n, and divr arrays as custom atom properties, - // can print with compute property/atom - // no grow callback as there's no reason to copy/exchange data, manually grow - // For norm, create a local array since they are unlikely to be printed - - int tmp1, tmp2; - index_ct = atom->find_custom("c_rheo_tension", tmp1, tmp2); - if (index_ct == -1) index_ct = atom->add_custom("c_rheo_tension", 1, 0); - ct = atom->dvector[index_ct]; - - index_cgradt = atom->find_custom("cgrad_rheo_tension", tmp1, tmp2); - if (index_cgradt == -1) index_cgradt = atom->add_custom("cgrad_rheo_tension", 1, 3); - cgradt = atom->darray[index_cgradt]; - - index_nt = atom->find_custom("n_rheo_tension", tmp1, tmp2); - if (index_nt == -1) index_nt = atom->add_custom("n_rheo_tension", 1, 3); - nt = atom->darray[index_nt]; - - index_divnt = atom->find_custom("divn_rheo_tension", tmp1, tmp2); - if (index_divnt == -1) index_divnt = atom->add_custom("divn_rheo_tension", 1, 0); - divnt = atom->dvector[index_divnt]; - - index_wsame = atom->find_custom("wsame_rheo_tension", tmp1, tmp2); - if (index_wsame == -1) index_wsame = atom->add_custom("wsame_rheo_tension", 1, 0); - wsame = atom->dvector[index_wsame]; - - index_ft = atom->find_custom("f_rheo_tension", tmp1, tmp2); - if (index_ft == -1) index_ft = atom->add_custom("f_rheo_tension", 1, 3); - ft = atom->darray[index_ft]; - - norm = nullptr; - nmax_store = 0; -} - -/* ---------------------------------------------------------------------- */ - -FixRHEOTension::~FixRHEOTension() -{ - // Remove custom property if it exists - int tmp1, tmp2, index; - - index = atom->find_custom("c_rheo_tension", tmp1, tmp2); - if (index != -1) atom->remove_custom(index, 1, 0); - - index = atom->find_custom("cgrad_rheo_tension", tmp1, tmp2); - if (index != -1) atom->remove_custom(index, 1, 3); - - index = atom->find_custom("n_rheo_tension", tmp1, tmp2); - if (index != -1) atom->remove_custom(index, 1, 3); - - index = atom->find_custom("divn_rheo_tension", tmp1, tmp2); - if (index != -1) atom->remove_custom(index, 1, 0); - - index = atom->find_custom("wsame_rheo_tension", tmp1, tmp2); - if (index != -1) atom->remove_custom(index, 1, 0); - - index = atom->find_custom("f_rheo_tension", tmp1, tmp2); - if (index != -1) atom->remove_custom(index, 1, 3); - - memory->destroy(norm); -} - -/* ---------------------------------------------------------------------- */ - -int FixRHEOTension::setmask() -{ - int mask = 0; - mask |= PRE_FORCE; - return mask; -} - -/* ---------------------------------------------------------------------- */ - -void FixRHEOTension::init() -{ - auto fixes = modify->get_fix_by_style("^rheo$"); - if (fixes.size() == 0) error->all(FLERR, "Need to define fix rheo to use fix rheo/tension"); - fix_rheo = dynamic_cast(fixes[0]); - - compute_kernel = fix_rheo->compute_kernel; - compute_interface = fix_rheo->compute_interface; - compute_vshift = fix_rheo->compute_vshift; - interface_flag = fix_rheo->interface_flag; - shift_flag = fix_rheo->shift_flag; - h = fix_rheo->h; - rho0 = fix_rheo->rho0; - - hsq = h * h; - - neighbor->add_request(this, NeighConst::REQ_DEFAULT); -} - -/* ---------------------------------------------------------------------- */ - -void FixRHEOTension::init_list(int /*id*/, NeighList *ptr) -{ - list = ptr; -} - - -/* ---------------------------------------------------------------------- */ - -void FixRHEOTension::setup(int vflag) -{ - // Grow and populate arrays for dump files - if (nmax_store <= atom->nmax) - grow_arrays(atom->nmax); - - size_t nbytes = nmax_store * sizeof(double); - memset(&ct[0], 0, nbytes); - memset(&norm[0], 0, nbytes); - memset(&wsame[0], 0, nbytes); - memset(&divnt[0], 0, nbytes); - memset(&cgradt[0][0], 0, 3 * nbytes); - memset(&ft[0][0], 0, 3 * nbytes); - memset(&nt[0][0], 0, 3 * nbytes); -} - -/* ---------------------------------------------------------------------- - Calculate and apply tension forces -------------------------------------------------------------------------- */ - -void FixRHEOTension::pre_force(int vflag) -{ - int i, j, a, ii, jj, inum, jnum, itype, jtype; - int fluidi, fluidj; - double xtmp, ytmp, ztmp, w, wp, ctmp; - double rhoi, rhoj, Voli, Volj; - double *dWij, *dWji; - double dx[3]; - - int *ilist, *jlist, *numneigh, **firstneigh; - double imass, jmass, rsq, r, rinv; - - int nlocal = atom->nlocal; - int newton = force->newton; - int dim = domain->dimension; - - v_init(vflag); - - double **x = atom->x; - double **f = atom->f; - double *rho = atom->rho; - double *mass = atom->mass; - imageint *image = atom->image; - int *type = atom->type; - int *status = atom->status; - - inum = list->inum; - ilist = list->ilist; - numneigh = list->numneigh; - firstneigh = list->firstneigh; - - if (nmax_store <= atom->nmax) - grow_arrays(atom->nmax); - - size_t nbytes = nmax_store * sizeof(double); - memset(&ct[0], 0, nbytes); - memset(&norm[0], 0, nbytes); - memset(&wsame[0], 0, nbytes); - memset(&divnt[0], 0, nbytes); - memset(&cgradt[0][0], 0, 3 * nbytes); - memset(&ft[0][0], 0, 3 * nbytes); - - // Calculate color gradient - for (ii = 0; ii < inum; ii++) { - i = ilist[ii]; - xtmp = x[i][0]; - ytmp = x[i][1]; - ztmp = x[i][2]; - itype = type[i]; - fluidi = !(status[i] & PHASECHECK); - jlist = firstneigh[i]; - jnum = numneigh[i]; - imass = mass[itype]; - - for (jj = 0; jj < jnum; jj++) { - j = jlist[jj]; - j &= NEIGHMASK; - - dx[0] = xtmp - x[j][0]; - dx[1] = ytmp - x[j][1]; - dx[2] = ztmp - x[j][2]; - - rsq = lensq3(dx); - - if (rsq > hsq) continue; - - fluidj = !(status[j] & PHASECHECK); - jtype = type[j]; - r = sqrt(rsq); - - rhoi = rho[i]; - rhoj = rho[j]; - - // Add corrections for walls - if (interface_flag) { - if (fluidi && (!fluidj)) { - rhoj = compute_interface->correct_rho(j, i); - } else if ((!fluidi) && fluidj) { - rhoi = compute_interface->correct_rho(i, j); - } else if ((!fluidi) && (!fluidj)) { - rhoi = rho0[itype]; - rhoj = rho0[jtype]; - } - } - - Voli = mass[itype] / rhoi; - Volj = mass[jtype] / rhoj; - - w = compute_kernel->calc_w(i, j, dx[0], dx[1], dx[2], r); - - if (itype != jtype) ctmp = 1; - else ctmp = 0; - - ct[i] += ctmp * Volj * w; - if (newton || j < nlocal) - ct[j] += ctmp * Voli * w; - } - } - - comm_stage = 0; - comm_reverse = 1; - if (newton) comm->reverse_comm(this); - - // Calculate color gradient - for (ii = 0; ii < inum; ii++) { - i = ilist[ii]; - xtmp = x[i][0]; - ytmp = x[i][1]; - ztmp = x[i][2]; - itype = type[i]; - fluidi = !(status[i] & PHASECHECK); - jlist = firstneigh[i]; - jnum = numneigh[i]; - imass = mass[itype]; - - for (jj = 0; jj < jnum; jj++) { - j = jlist[jj]; - j &= NEIGHMASK; - - dx[0] = xtmp - x[j][0]; - dx[1] = ytmp - x[j][1]; - dx[2] = ztmp - x[j][2]; - rsq = lensq3(dx); - - if (rsq > hsq) continue; - - fluidj = !(status[j] & PHASECHECK); - jtype = type[j]; - r = sqrt(rsq); - - rhoi = rho[i]; - rhoj = rho[j]; - - // Add corrections for walls - if (interface_flag) { - if (fluidi && (!fluidj)) { - rhoj = compute_interface->correct_rho(j, i); - } else if ((!fluidi) && fluidj) { - rhoi = compute_interface->correct_rho(i, j); - } else if ((!fluidi) && (!fluidj)) { - rhoi = rho0[itype]; - rhoj = rho0[jtype]; - } - } - - Voli = mass[itype] / rhoi; - Volj = mass[jtype] / rhoj; - - wp = compute_kernel->calc_dw(i, j, dx[0], dx[1], dx[2], r); - dWij = compute_kernel->dWij; - dWji = compute_kernel->dWji; - - //c = 0; - //if (itype != jtype) c += rhoi; - //c /= (rhoi + rhoj); - - if (itype != jtype) ctmp = 1; - else ctmp = 0; - - for (a = 0; a < dim; a++) { - cgradt[i][a] -= ctmp * Volj * dWij[a]; - if (newton || j < nlocal) - cgradt[j][a] -= ctmp * Voli * dWji[a]; - } - } - } - - comm_stage = 1; - comm_reverse = 3; - if (newton) comm->reverse_comm(this); - - // Calculate normal direction - double minv; - for (i = 0; i < nlocal; i++) { - minv = cgradt[i][0] * cgradt[i][0] + cgradt[i][1] * cgradt[i][1]; - if (dim == 3) minv += cgradt[i][2] * cgradt[i][2]; - minv = sqrt(minv); - if (minv != 0) minv = 1 / minv; - - for (a = 0; a < dim; a++) - nt[i][a] = cgradt[i][a] * minv; - } - - comm_forward = 3; - comm->forward_comm(this); - - // Calculate divergence - for (ii = 0; ii < inum; ii++) { - i = ilist[ii]; - xtmp = x[i][0]; - ytmp = x[i][1]; - ztmp = x[i][2]; - itype = type[i]; - fluidi = !(status[i] & PHASECHECK); - jlist = firstneigh[i]; - jnum = numneigh[i]; - imass = mass[itype]; - - for (jj = 0; jj < jnum; jj++) { - j = jlist[jj]; - j &= NEIGHMASK; - - dx[0] = xtmp - x[j][0]; - dx[1] = ytmp - x[j][1]; - dx[2] = ztmp - x[j][2]; - rsq = lensq3(dx); - - if (rsq > hsq) continue; - - fluidj = !(status[j] & PHASECHECK); - jtype = type[j]; - r = sqrt(rsq); - rinv = 1 / r; - - rhoi = rho[i]; - rhoj = rho[j]; - - // Add corrections for walls - if (interface_flag) { - if (fluidi && (!fluidj)) { - rhoj = compute_interface->correct_rho(j, i); - } else if ((!fluidi) && fluidj) { - rhoi = compute_interface->correct_rho(i, j); - } else if ((!fluidi) && (!fluidj)) { - rhoi = rho0[itype]; - rhoj = rho0[jtype]; - } - } - - Voli = mass[itype] / rhoi; - Volj = mass[jtype] / rhoj; - - w = compute_kernel->calc_w(i, j, dx[0], dx[1], dx[2], r); - wp = compute_kernel->calc_dw(i, j, dx[0], dx[1], dx[2], r); - dWij = compute_kernel->dWij; - dWji = compute_kernel->dWji; - - for (a = 0; a < dim; a++) { - if (itype != jtype) { - divnt[i] -= (nt[i][a] + nt[j][a]) * Volj * dWij[a]; - } else { - divnt[i] -= (nt[i][a] - nt[j][a]) * Volj * dWij[a]; - wsame[i] += w * r; - } - norm[i] -= dx[a] * Volj * dWij[a]; - if (newton || j < nlocal) { - if (itype != jtype) { - divnt[j] -= (nt[j][a] + nt[i][a]) * Voli * dWji[a]; - } else { - divnt[j] -= (nt[j][a] - nt[i][a]) * Voli * dWji[a]; - wsame[j] += w * r; - } - norm[j] += dx[a] * Voli * dWji[a]; - } - } - } - } - - comm_stage = 2; - comm_reverse = 3; - if (newton) comm->reverse_comm(this); - - comm_forward = 1; - comm->forward_comm(this); - - // Skip forces if it's setup - if (update->setupflag) return; - - // apply force, remove normal vshift - - double **vshift; - if (shift_flag) - vshift = compute_vshift->vshift; - double nx, ny, nz, vx, vy, vz, dot; - double wmin_inv, weight, prefactor, unwrap[3], v[6]; - - if (wmin > 0) wmin_inv = 1.0 / wmin; - else wmin_inv = 0.0; - - for (i = 0; i < nlocal; i++) { - - if (wsame[i] < wmin) continue; - - weight = MIN(1.0, wsame[i] * wmin_inv); //MAX -> MIN 2/14/24 - itype = type[i]; - - if (norm[i] != 0) - divnt[i] *= dim * norm[i]; - else - divnt[i] = 0.0; - - // Tension force from Adami, Hu, Adams 2010 - prefactor = -alpha * divnt[i] * weight; - for (a = 0; a < dim; a++) { - f[i][a] += prefactor * cgradt[i][a]; - ft[i][a] += prefactor * cgradt[i][a]; - } - - // remove normal shifting component for interfacial particles - // Based on Yang, Rakhsha, Hu, & Negrut 2022 - if (shift_flag && (vshift_strength != 1.0)) { - if (ct[i] > cmin) { - nx = nt[i][0]; - ny = nt[i][1]; - vx = vshift[i][0]; - vy = vshift[i][1]; - - dot = nx * vx + ny * vy; - if (dim == 3) { - nz = nt[i][2]; - vz = vshift[i][2]; - dot += nz * vz; - } - - // Allowing shifting into the bulk - //if (dot > 0.0) continue; - - vshift[i][0] -= (1.0 - vshift_strength) * nx * dot; - vshift[i][1] -= (1.0 - vshift_strength) * ny * dot; - if (dim == 3) { - vshift[i][2] -= (1.0 - vshift_strength) * nz * dot; - } - } - } - - if (evflag) { - domain->unmap(x[i], image[i], unwrap); - v[0] = prefactor * cgradt[i][0] * unwrap[0]; - v[1] = prefactor * cgradt[i][1] * unwrap[1]; - v[2] = prefactor * cgradt[i][2] * unwrap[2]; - v[3] = prefactor * cgradt[i][0] * unwrap[1]; - v[4] = prefactor * cgradt[i][0] * unwrap[2]; - v[5] = prefactor * cgradt[i][1] * unwrap[2]; - v_tally(i, v); - } - } - - // If there is no lower limit, apply optional pairwise forces - // This is totally ad hoc, needs some work - // Attempts to deal with stray single particles - if (wmin <= 0 || beta == 0.0) return; - - int newton_pair = force->newton_pair; - double fpair, wi, wj; - double cut_two_thirds = 2.0 * h / 3.0; - double cut_five_sixths = 5.0 * h / 6.0; - double cut_sixth_sq = (h / 6.0) * (h / 6.0); - double cut_third_sq = (h / 3.0) * (h / 3.0); - for (ii = 0; ii < inum; ii++) { - i = ilist[ii]; - xtmp = x[i][0]; - ytmp = x[i][1]; - ztmp = x[i][2]; - itype = type[i]; - jlist = firstneigh[i]; - jnum = numneigh[i]; - - wi = MAX(MIN(1.0, (wmin - wsame[i]) * wmin_inv), 0.0); - - for (jj = 0; jj < jnum; jj++) { - j = jlist[jj]; - j &= NEIGHMASK; - - if (wsame[i] >= wmin && wsame[j] >= wmin) continue; - - dx[0] = xtmp - x[j][0]; - dx[1] = ytmp - x[j][1]; - dx[2] = ztmp - x[j][2]; - rsq = lensq3(dx); - - if (rsq > hsq) continue; - - r = sqrt(rsq); - jtype = type[j]; - - if (itype == jtype) { - fpair = (r - cut_two_thirds); - fpair *= fpair; - fpair -= cut_third_sq; - } else { - //fpair = 0.0; - - if (r > (0.5*cut_two_thirds)) continue; - fpair = (r - cut_two_thirds); - fpair *= fpair; - fpair -= cut_third_sq; - - //if (r > cut_two_thirds) continue; - //fpair = (r - cut_five_sixths); - //fpair *= fpair; - //fpair -= cut_sixth_sq; - - //fpair = (h - r) * 0.66666666666666; - } - - wj = MAX(MIN(1.0, (wmin - wsame[j]) * wmin_inv), 0.0); - rinv = 1.0 / r; - fpair *= MAX(wi, wj) * beta * rinv; - - f[i][0] += dx[0] * fpair; - f[i][1] += dx[1] * fpair; - f[i][2] += dx[2] * fpair; - - if (newton_pair || j < nlocal) { - f[j][0] -= dx[0] * fpair; - f[j][1] -= dx[1] * fpair; - f[j][2] -= dx[2] * fpair; - } - - if (evflag) { - // In progress - } - } - } -} - - -/* ---------------------------------------------------------------------- */ - -int FixRHEOTension::pack_forward_comm(int n, int *list, double *buf, int /*pbc_flag*/, int * /*pbc*/) -{ - int i, j, a, m; - m = 0; - - if (comm_stage == 1) - for (i = 0; i < n; i++) { - j = list[i]; - for (a = 0; a < 3; a++) - buf[m++] = nt[j][a]; - } - else if (comm_stage == 2) - for (i = 0; i < n; i++) { - j = list[i]; - buf[m++] = wsame[j]; - } - - return m; -} - -/* ---------------------------------------------------------------------- */ - -void FixRHEOTension::unpack_forward_comm(int n, int first, double *buf) -{ - int i, a, m, last; - - m = 0; - last = first + n; - if (comm_stage == 1) - for (i = first; i < last; i++) - for (a = 0; a < 3; a++) - nt[i][a] = buf[m++]; - else if (comm_stage == 2) - for (i = first; i < last; i++) - wsame[i] = buf[m++]; -} - - -/* ---------------------------------------------------------------------- */ - -int FixRHEOTension::pack_reverse_comm(int n, int first, double *buf) -{ - int i, a, m, last; - - m = 0; - last = first + n; - if (comm_stage == 0) - for (i = first; i < last; i++) - buf[m++] = ct[i]; - else if (comm_stage == 1) - for (i = first; i < last; i++) - for (a = 0; a < 3; a++) - buf[m++] = cgradt[i][a]; - else if (comm_stage == 2) - for (i = first; i < last; i++) { - buf[m++] = norm[i]; - buf[m++] = divnt[i]; - buf[m++] = wsame[i]; - } - return m; -} - -/* ---------------------------------------------------------------------- */ - -void FixRHEOTension::unpack_reverse_comm(int n, int *list, double *buf) -{ - int i, j, a, m; - - m = 0; - if (comm_stage == 0) - for (i = 0; i < n; i++) { - j = list[i]; - ct[j] += buf[m++]; - } - else if (comm_stage == 1) - for (i = 0; i < n; i++) { - j = list[i]; - for (a = 0; a < 3; a++) - cgradt[j][a] += buf[m++]; - } - else if (comm_stage == 2) - for (i = 0; i < n; i++) { - j = list[i]; - norm[j] += buf[m++]; - divnt[j] += buf[m++]; - wsame[j] += buf[m++]; - } -} - -/* ---------------------------------------------------------------------- */ - -void FixRHEOTension::grow_arrays(int nmax) -{ - // Grow atom variables and reassign pointers - memory->grow(atom->dvector[index_ct], nmax, "atom:rheo_ct"); - memory->grow(atom->darray[index_cgradt], nmax, 3, "atom:rheo_cgradt"); - memory->grow(atom->darray[index_nt], nmax, 3, "atom:rheo_nt"); - memory->grow(atom->dvector[index_divnt], nmax, "atom:rheo_divnt"); - memory->grow(atom->dvector[index_wsame], nmax, "atom:rheo_wsame"); - memory->grow(atom->darray[index_ft], nmax, 3, "atom:rheo_ft"); - - ct = atom->dvector[index_ct]; - cgradt = atom->darray[index_cgradt]; - nt = atom->darray[index_nt]; - divnt = atom->dvector[index_divnt]; - wsame = atom->dvector[index_wsame]; - ft = atom->darray[index_ft]; - - // Grow local variables - memory->grow(norm, nmax, "rheo/tension:norm"); - - nmax_store = atom->nmax; -} \ No newline at end of file diff --git a/src/RHEO/fix_rheo_tension.h b/src/RHEO/fix_rheo_tension.h deleted file mode 100644 index 52d368531f..0000000000 --- a/src/RHEO/fix_rheo_tension.h +++ /dev/null @@ -1,59 +0,0 @@ -/* -*- 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(rheo/tension,FixRHEOTension) -// clang-format on -#else - -#ifndef LMP_FIX_RHEO_TENSION_H -#define LMP_FIX_RHEO_TENSION_H - -#include "fix.h" - -namespace LAMMPS_NS { - -class FixRHEOTension : public Fix { - public: - FixRHEOTension(class LAMMPS *, int, char **); - ~FixRHEOTension() override; - int setmask() override; - void init() override; - void init_list(int, class NeighList *) override; - void setup(int) override; - void pre_force(int) override; - int pack_forward_comm(int, int *, double *, int, int *) override; - void unpack_forward_comm(int, int, double *) override; - int pack_reverse_comm(int, int, double *) override; - void unpack_reverse_comm(int, int *, double *) override; - void grow_arrays(int) override; - - private: - int nmax_store, comm_stage, interface_flag, shift_flag; - int index_ct, index_nt, index_cgradt, index_divnt, index_ft, index_wsame; - - double *ct, **nt, **cgradt, *divnt, *norm, **ft, *wsame; - double alpha, beta, wmin, cmin, vshift_strength, h, hsq, hinv, hinv3, *rho0; - - class ComputeRHEOKernel *compute_kernel; - class ComputeRHEOInterface *compute_interface; - class ComputeRHEOVShift *compute_vshift; - class FixRHEO *fix_rheo; - class NeighList *list; -}; - -} // namespace LAMMPS_NS - -#endif -#endif From 4886678619aa9daf9d31346422821a6a69e8072f Mon Sep 17 00:00:00 2001 From: jtclemm Date: Mon, 29 Apr 2024 16:14:53 -0600 Subject: [PATCH 082/158] Updating masks, cleaning up special bond handling --- src/BPM/fix_update_special_bonds.cpp | 33 ++++++++++++++-------- src/RHEO/fix_rheo.h | 10 +++---- src/RHEO/fix_rheo_thermal.cpp | 42 ++++++++++++++++++++++------ 3 files changed, 59 insertions(+), 26 deletions(-) diff --git a/src/BPM/fix_update_special_bonds.cpp b/src/BPM/fix_update_special_bonds.cpp index b6bf8b433f..b21de90b52 100644 --- a/src/BPM/fix_update_special_bonds.cpp +++ b/src/BPM/fix_update_special_bonds.cpp @@ -93,16 +93,19 @@ void FixUpdateSpecialBonds::pre_exchange() for (auto const &it : broken_pairs) { tagi = it.first; tagj = it.second; + i = atom->map(tagi); j = atom->map(tagj); // remove i from special bond list for atom j and vice versa // ignore n2, n3 since 1-3, 1-4 special factors required to be 1.0 + // assume ghosts don't need special information if (i < nlocal) { slist = special[i]; n1 = nspecial[i][0]; for (m = 0; m < n1; m++) if (slist[m] == tagj) break; + if (m == n1) error->one(FLERR, "Special bond {} {} not found", tagi, tagj); for (; m < n1 - 1; m++) slist[m] = slist[m + 1]; nspecial[i][0]--; nspecial[i][1] = nspecial[i][2] = nspecial[i][0]; @@ -113,6 +116,7 @@ void FixUpdateSpecialBonds::pre_exchange() n1 = nspecial[j][0]; for (m = 0; m < n1; m++) if (slist[m] == tagi) break; + if (m == n1) error->one(FLERR, "Special bond {} {} not found", tagi, tagj); for (; m < n1 - 1; m++) slist[m] = slist[m + 1]; nspecial[j][0]--; nspecial[j][1] = nspecial[j][2] = nspecial[j][0]; @@ -127,19 +131,24 @@ void FixUpdateSpecialBonds::pre_exchange() // add i to special bond list for atom j and vice versa // ignore n2, n3 since 1-3, 1-4 special factors required to be 1.0 - n1 = nspecial[i][0]; - if (n1 >= atom->maxspecial) - error->one(FLERR, "Special list size exceeded in fix update/special/bond"); - special[i][n1] = tagj; - nspecial[i][0] += 1; - nspecial[i][1] = nspecial[i][2] = nspecial[i][0]; + // assume ghosts don't need special information + if (i < nlocal) { + n1 = nspecial[i][0]; + if (n1 >= atom->maxspecial) + error->one(FLERR, "Special list size exceeded for atom {}", tagi); + special[i][n1] = tagj; + nspecial[i][0] += 1; + nspecial[i][1] = nspecial[i][2] = nspecial[i][0]; + } - n1 = nspecial[j][0]; - if (n1 >= atom->maxspecial) - error->one(FLERR, "Special list size exceeded in fix update/special/bond"); - special[j][n1] = tagi; - nspecial[j][0] += 1; - nspecial[j][1] = nspecial[j][2] = nspecial[j][0]; + if (j < nlocal) { + n1 = nspecial[j][0]; + if (n1 >= atom->maxspecial) + error->one(FLERR, "Special list size exceeded for atom {}", tagj); + special[j][n1] = tagi; + nspecial[j][0] += 1; + nspecial[j][1] = nspecial[j][2] = nspecial[j][0]; + } } broken_pairs.clear(); diff --git a/src/RHEO/fix_rheo.h b/src/RHEO/fix_rheo.h index 45f74ed4cd..51e0962000 100644 --- a/src/RHEO/fix_rheo.h +++ b/src/RHEO/fix_rheo.h @@ -94,11 +94,11 @@ namespace RHEO_NS { }; // Masks and their inverses - #define PHASEMASK 0xFFFFFFFC - #define PHASECHECK 0x00000003 - #define SURFACEMASK 0xFFFFFFC3 - #define SURFACECHECK 0x0000003C - #define OPTIONSMASK 0xFFFFFE3F + #define PHASEMASK 0xFFFFFFFC // 11111111111111111111111111111100 + #define PHASECHECK 0x00000003 // 00000000000000000000000000000011 + #define SURFACEMASK 0xFFFFFFC3 // 11111111111111111111111111000011 + #define SURFACECHECK 0x0000003C // 00000000000000000000000000111100 + #define OPTIONSMASK 0xFFFFFC3F // 11111111111111111111110000111111 } // namespace RHEO_NS } // namespace LAMMPS_NS diff --git a/src/RHEO/fix_rheo_thermal.cpp b/src/RHEO/fix_rheo_thermal.cpp index 3a39bbe596..f2dbd6c8bb 100644 --- a/src/RHEO/fix_rheo_thermal.cpp +++ b/src/RHEO/fix_rheo_thermal.cpp @@ -281,6 +281,10 @@ void FixRHEOThermal::init() fix_update_special_bonds = dynamic_cast(fixes[0]); } + // must have newton off so both processors will search nlist to build bonds + if (force->newton_pair) + error->all(FLERR, "Need Newton off for reactive bond generation"); + // need a half neighbor list, built only when particles freeze auto req = neighbor->add_request(this, NeighConst::REQ_OCCASIONAL); req->set_cutoff(cut_kernel); @@ -494,7 +498,7 @@ void FixRHEOThermal::reset_dt() void FixRHEOThermal::break_bonds() { - int m, n, nmax, i, j; + int m, n, nmax, i, j, melti, meltj; tagint *tag = atom->tag; int *status = atom->status; @@ -510,11 +514,13 @@ void FixRHEOThermal::break_bonds() // Delete all bonds for local atoms that melt of a given type for (int i = 0; i < nlocal; i++) { - if (!(status[i] & STATUS_MELTING)) continue; + melti = status[i] & STATUS_MELTING; + if (!melti) continue; for (m = (num_bond[i] - 1); m >= 0; m--) { if (bond_type[i][m] != btype) continue; j = atom->map(bond_atom[i][m]); + meltj = status[j] & STATUS_MELTING; nmax = num_bond[i] - 1; if (m == nmax) { @@ -535,8 +541,17 @@ void FixRHEOThermal::break_bonds() bond_type[i][nmax] = 0; num_bond[i]--; - if (fix_update_special_bonds) - fix_update_special_bonds->add_broken_bond(i, j); + // Update special unless two owned atoms melt simultaneously then + // only update for atom with lower tag + if (fix_update_special_bonds) { + if (i < nlocal && j < nlocal && melti && meltj) { + if (tag[i] < tag[j]) { + fix_update_special_bonds->add_broken_bond(i, j); + } + } else { + fix_update_special_bonds->add_broken_bond(i, j); + } + } } } @@ -548,12 +563,15 @@ void FixRHEOThermal::break_bonds() i = bondlist[n][0]; j = bondlist[n][1]; - if (!(status[i] & STATUS_MELTING) && !(status[j] & STATUS_MELTING)) continue; + melti = status[i] & STATUS_MELTING; + meltj = status[j] & STATUS_MELTING; + + if (!melti && !meltj) continue; bondlist[n][2] = 0; // Delete bonds for non-melted local atoms (shifting) - if (i < nlocal && !(status[i] & STATUS_MELTING)) { + if (i < nlocal && !melti) { for (m = 0; m < num_bond[i]; m++) { if (bond_atom[i][m] == tag[j] && bond_type[i][m] == btype) { nmax = num_bond[i] - 1; @@ -572,7 +590,7 @@ void FixRHEOThermal::break_bonds() } } - if (j < nlocal && !(status[j] & STATUS_MELTING)) { + if (j < nlocal && !meltj) { for (m = 0; m < num_bond[j]; m++) { if (bond_atom[j][m] == tag[i] && bond_type[j][m] == btype) { nmax = num_bond[j] - 1; @@ -590,6 +608,12 @@ void FixRHEOThermal::break_bonds() } } } + + // Unless both atoms melt simultaneously, need to remove special bond if the melted atom is a ghost + if (melti && meltj) continue; + if (fix_update_special_bonds) + if (((i >= nlocal) && melti) || ((j >= nlocal) && meltj)) + fix_update_special_bonds->add_broken_bond(i, j); } } @@ -649,7 +673,6 @@ void FixRHEOThermal::create_bonds() if (i < nlocal && (!newton_bond || tag[i] < tag[j])) { if (num_bond[i] == atom->bond_per_atom) error->one(FLERR,"New bond exceeded bonds per atom in fix rheo/thermal"); - if (fix_update_special_bonds) fix_update_special_bonds->add_created_bond(i, j); bond_type[i][num_bond[i]] = btype; bond_atom[i][num_bond[i]] = tag[j]; num_bond[i]++; @@ -658,11 +681,12 @@ void FixRHEOThermal::create_bonds() if (j < nlocal && (!newton_bond || tag[j] < tag[i])) { if (num_bond[j] == atom->bond_per_atom) error->one(FLERR,"New bond exceeded bonds per atom in fix rheo/thermal"); - if (fix_update_special_bonds) fix_update_special_bonds->add_created_bond(i, j); bond_type[j][num_bond[j]] = btype; bond_atom[j][num_bond[j]] = tag[i]; num_bond[j]++; } + + if (fix_update_special_bonds) fix_update_special_bonds->add_created_bond(i, j); } } } From da7459c80562724e900e82024c9c82db90df89bd Mon Sep 17 00:00:00 2001 From: jtclemm Date: Fri, 3 May 2024 15:13:45 -0600 Subject: [PATCH 083/158] Adding heat options, prevent asynchronous mpi bond creation/deletion --- doc/src/fix_add_heat.rst | 44 +++++++++++---- src/GRANULAR/fix_add_heat.cpp | 95 ++++++++++++++++++++------------- src/GRANULAR/fix_add_heat.h | 6 +-- src/RHEO/fix_rheo_oxidation.cpp | 61 ++++++++++++++++++--- src/RHEO/fix_rheo_oxidation.h | 2 + src/RHEO/fix_rheo_thermal.cpp | 34 ++++++++---- 6 files changed, 174 insertions(+), 68 deletions(-) diff --git a/doc/src/fix_add_heat.rst b/doc/src/fix_add_heat.rst index 3964c96b27..2a2d855927 100644 --- a/doc/src/fix_add_heat.rst +++ b/doc/src/fix_add_heat.rst @@ -8,31 +8,53 @@ Syntax .. code-block:: LAMMPS - fix ID group-ID add/heat rate values ... + fix ID group-ID add/heat style args keyword values ... * ID, group-ID are documented in :doc:`fix ` command * add/heat = style name of this fix command -* rate = rate of heat flow (energy/time units) +* style = *constant* or *linear* or *quartic* + + .. parsed-literal:: + + *constant* args = rate + rate = rate of heat flow (energy/time units) + *linear* args = t_target k + t_target = target temperature (temperature units) + k = prefactor (energy/(time*temperature) units) + *quartic* args = t_target k + t_target = target temperature (temperature units) + k = prefactor (energy/(time*temperature^4) units) + * zero or more keyword/value pairs may be appended to args * keyword = *overwrite* .. parsed-literal:: - *overwrite* = sets the heat flow instead of adding it + *overwrite* value = *yes* or *no* + *yes* = sets current heat flow of particle + *no* = adds to current heat flow of particle Examples """""""" .. code-block:: LAMMPS - fix 1 all add/heat v_heat - fix 1 all add/heat 1.0 overwrite + fix 1 all add/heat constant v_heat + fix 1 all add/heat linear 10.0 1.0 overwrite yes Description """"""""""" -This fix adds heat to particles every timestep at a given rate. The rate -can be can be specified as an equal-style or atom-style +This fix adds heat to particles every timestep. + +For the *constant* style, heat is added at the specified rate. For the *linear* style, +heat is added at a rate of :math:`k (T_{target} - T)` where :math:`k` is the +specified prefactor, :math:`T_{target}` is the specified target temperature, and +:math:`T` is the temperature of the atom. This may be more representative of a +conductive process. For the *quartic* style, heat is added at a rate of +:math:`k (T_{target}^4 - T^4)`, akin to radiative heat transfer. + +The rate or temperature can be can be specified as an equal-style or atom-style :doc:`variable `. If the value is a variable, it should be specified as v_name, where name is the variable name. In this case, the variable will be evaluated each time step, and its value will be used to @@ -48,9 +70,9 @@ variables but can also include per-atom values, such as atom coordinates. Thus, it is easy to specify a spatially-dependent heating field with optional time-dependence as well. -If the *overwrite* keyword is specified, this fix will effectively set -the total heat flow on a particle, overwriting contributions from other -pair styles. +If the *overwrite* keyword is set to *yes*, this fix will effectively set +the total heat flow on a particle, overwriting contributions from pair +styles or other fixes. ---------- @@ -84,4 +106,4 @@ Related commands Default """"""" -none +The default for the *overwrite* keyword is *no* diff --git a/src/GRANULAR/fix_add_heat.cpp b/src/GRANULAR/fix_add_heat.cpp index 2db3389560..7109ffb01c 100644 --- a/src/GRANULAR/fix_add_heat.cpp +++ b/src/GRANULAR/fix_add_heat.cpp @@ -27,34 +27,52 @@ using namespace LAMMPS_NS; using namespace FixConst; -enum { NONE, CONSTANT, EQUAL, ATOM }; +enum { CONSTANT, EQUAL, ATOM }; +enum { ADD, LINEAR, QUARTIC }; /* ---------------------------------------------------------------------- */ FixAddHeat::FixAddHeat(LAMMPS *lmp, int narg, char **arg) : - Fix(lmp, narg, arg), varstr(nullptr), qatom(nullptr) + Fix(lmp, narg, arg), varstr(nullptr), vatom(nullptr) { - if (narg < 4) utils::missing_cmd_args(FLERR, "fix add/heat", error); + if (narg < 5) utils::missing_cmd_args(FLERR, "fix add/heat", error); dynamic_group_allow = 1; overwrite_flag = 0; - style = NONE; - if (utils::strmatch(arg[3], "^v_")) { - varstr = utils::strdup(arg[3] + 2); + if (strcmp(arg[3], "constant") == 0) { + style = ADD; + } else if (strcmp(arg[3], "linear") == 0) { + style = LINEAR; + } else if (strcmp(arg[3], "quartic") == 0) { + style = QUARTIC; } else { - value = utils::numeric(FLERR, arg[3], false, lmp); - style = CONSTANT; + error->all(FLERR, "Invalid option {}", arg[3]); + } + + if (utils::strmatch(arg[4], "^v_")) { + varstr = utils::strdup(arg[4] + 2); + } else { + value = utils::numeric(FLERR, arg[4], false, lmp); + vstyle = CONSTANT; + } + + int iarg = 5; + if (style != ADD) { + if (narg != 6) utils::missing_cmd_args(FLERR, "fix add/heat", error); + prefactor = utils::numeric(FLERR, arg[5], false, lmp); + iarg = 6; } // optional args - int iarg = 4; while (iarg < narg) { if (strcmp(arg[iarg], "overwrite") == 0) { - overwrite_flag = 1; - iarg += 1; - } else - error->all(FLERR, "Illegal fix viscous command"); + if (iarg + 1 >= narg) utils::missing_cmd_args(FLERR, "fix add/heat", error); + overwrite_flag = utils::bnumeric(FLERR, arg[iarg + 1], false, lmp); + iarg += 2; + } else { + error->all(FLERR, "Illegal fix add/heat command, invalid argument {}", arg[iarg]); + } } maxatom = -1; @@ -65,7 +83,7 @@ FixAddHeat::FixAddHeat(LAMMPS *lmp, int narg, char **arg) : FixAddHeat::~FixAddHeat() { delete[] varstr; - memory->destroy(qatom); + memory->destroy(vatom); } /* ---------------------------------------------------------------------- */ @@ -92,9 +110,9 @@ void FixAddHeat::init() var = input->variable->find(varstr); if (var < 0) error->all(FLERR, "Variable {} for fix addforce does not exist", varstr); if (input->variable->equalstyle(var)) - style = EQUAL; + vstyle = EQUAL; else if (input->variable->atomstyle(var)) - style = ATOM; + vstyle = ATOM; else error->all(FLERR, "Variable {} for fix addforce is invalid style", varstr); } @@ -106,33 +124,38 @@ void FixAddHeat::post_force(int /*vflag*/) { int *mask = atom->mask; double *heatflow = atom->heatflow; + double *temperature = atom->temperature; double dtinv = 1.0 / update->dt; - if (overwrite_flag) { + if (vstyle == ATOM) { + if (atom->nmax > maxatom) { + maxatom = atom->nmax; + memory->destroy(vatom); + memory->create(vatom, maxatom, "addheat:vatom"); + } + + input->variable->compute_atom(var, igroup, &vatom[0], 1, 0); + } + + if (overwrite_flag) for (int i = 0; i < atom->nlocal; i++) if (mask[i] & groupbit) heatflow[i] = 0.0; - } - if (style == CONSTANT) { - for (int i = 0; i < atom->nlocal; i++) - if (mask[i] & groupbit) - heatflow[i] += value * dtinv; - } else if (style == EQUAL) { - value = input->variable->compute_equal(var); - for (int i = 0; i < atom->nlocal; i++) - if (mask[i] & groupbit) - heatflow[i] += value * dtinv; - } else if (style == ATOM) { + double vtmp, dt; + if (vstyle == CONSTANT) vtmp = value; + if (vstyle == EQUAL) vtmp = input->variable->compute_equal(var); + for (int i = 0; i < atom->nlocal; i++) { + if (mask[i] & groupbit) { + if (vstyle == ATOM) vtmp = vatom[i]; - if (atom->nmax > maxatom) { - maxatom = atom->nmax; - memory->destroy(qatom); - memory->create(qatom, maxatom, "addheat:qatom"); + if (style == ADD) { + heatflow[i] += dtinv * vtmp; + } else if (style == LINEAR) { + heatflow[i] += dtinv * prefactor * (vtmp - temperature[i]); + } else if (style == QUARTIC) { + heatflow[i] += dtinv * prefactor * (pow(vtmp, 4.0) - pow(temperature[i], 4.0)); + } } - input->variable->compute_atom(var, igroup, &qatom[0], 1, 0); - for (int i = 0; i < atom->nlocal; i++) - if (mask[i] & groupbit) - heatflow[i] += qatom[i] * dtinv; } } diff --git a/src/GRANULAR/fix_add_heat.h b/src/GRANULAR/fix_add_heat.h index 8a51f13ee4..4fa8adf42e 100644 --- a/src/GRANULAR/fix_add_heat.h +++ b/src/GRANULAR/fix_add_heat.h @@ -33,10 +33,10 @@ class FixAddHeat : public Fix { void post_force(int) override; protected: - double value; - int var, style, maxatom, overwrite_flag; + double value, prefactor; + int var, vstyle, maxatom, style, overwrite_flag; char *varstr; - double *qatom; + double *vatom; }; } // namespace LAMMPS_NS diff --git a/src/RHEO/fix_rheo_oxidation.cpp b/src/RHEO/fix_rheo_oxidation.cpp index 46eaab3bf1..8539f04277 100644 --- a/src/RHEO/fix_rheo_oxidation.cpp +++ b/src/RHEO/fix_rheo_oxidation.cpp @@ -21,6 +21,7 @@ #include "atom.h" #include "atom_vec.h" #include "citeme.h" +#include "comm.h" #include "compute_rheo_surface.h" #include "error.h" #include "fix_rheo.h" @@ -54,6 +55,8 @@ FixRHEOOxidation::FixRHEOOxidation(LAMMPS *lmp, int narg, char **arg) : { if (narg != 6) error->all(FLERR,"Illegal fix command"); + comm_forward = 3; + cut = utils::numeric(FLERR, arg[3], false, lmp); if (cut <= 0.0) error->all(FLERR, "Illegal bond cutoff {} in fix rheo/oxidation", cut); @@ -146,7 +149,7 @@ void FixRHEOOxidation::post_integrate() { int i, j, n, ii, jj, inum, jnum, bflag; int *ilist, *jlist, *numneigh, **firstneigh; - double xtmp, ytmp, ztmp, delx, dely, delz, rsq; + double delx, dely, delz, rsq; tagint tagi, tagj; int nlocal = atom->nlocal; @@ -164,15 +167,16 @@ void FixRHEOOxidation::post_integrate() numneigh = list->numneigh; firstneigh = list->firstneigh; + // Forward positions (after inititial integrate, before comm) + // Note: surface designation lags one timestep, acceptable error + comm->forward_comm(this); + // loop over neighbors of my atoms for (ii = 0; ii < inum; ii++) { i = ilist[ii]; if (rsurface[i] > rsurf) continue; tagi = tag[i]; - xtmp = x[i][0]; - ytmp = x[i][1]; - ztmp = x[i][2]; jlist = firstneigh[i]; jnum = numneigh[i]; @@ -184,9 +188,19 @@ void FixRHEOOxidation::post_integrate() if (rsurface[j] > rsurf) continue; tagj = tag[j]; - delx = xtmp - x[j][0]; - dely = ytmp - x[j][1]; - delz = ztmp - x[j][2]; + + // Ensure pair is always ordered to ensure numerical operations + // are identical to minimize the possibility that a bond straddling + // an mpi grid (newton off) isn't created on one proc but not the other + if (tagi < tagj) { + delx = x[i][0] - x[j][0]; + dely = x[i][1] - x[j][1]; + delz = x[i][2] - x[j][2]; + } else { + delx = x[j][0] - x[i][0]; + dely = x[j][1] - x[i][1]; + delz = x[j][2] - x[i][2]; + } rsq = delx * delx + dely * dely + delz * delz; if (rsq > cutsq) continue; @@ -213,3 +227,36 @@ void FixRHEOOxidation::post_integrate() } } } + +/* ---------------------------------------------------------------------- */ + +int FixRHEOOxidation::pack_forward_comm(int n, int *list, double *buf, + int /*pbc_flag*/, int * /*pbc*/) +{ + int i, j, k, m; + double **x = atom->x; + m = 0; + + for (i = 0; i < n; i++) { + j = list[i]; + buf[m++] = x[j][0]; + buf[m++] = x[j][1]; + buf[m++] = x[j][2]; + } + return m; +} + +/* ---------------------------------------------------------------------- */ + +void FixRHEOOxidation::unpack_forward_comm(int n, int first, double *buf) +{ + int i, k, m, last; + double **x = atom->x; + m = 0; + last = first + n; + for (i = first; i < last; i++) { + x[i][0] = buf[m++]; + x[i][1] = buf[m++]; + x[i][2] = buf[m++]; + } +} diff --git a/src/RHEO/fix_rheo_oxidation.h b/src/RHEO/fix_rheo_oxidation.h index be95efbf2c..5991a830c0 100644 --- a/src/RHEO/fix_rheo_oxidation.h +++ b/src/RHEO/fix_rheo_oxidation.h @@ -36,6 +36,8 @@ class FixRHEOOxidation : public Fix { void setup_pre_force(int) override; void pre_force(int) override; void post_integrate() override; + int pack_forward_comm(int, int *, double *, int, int *) override; + void unpack_forward_comm(int, int, double *) override; int *nbond; double rsurf, cut; diff --git a/src/RHEO/fix_rheo_thermal.cpp b/src/RHEO/fix_rheo_thermal.cpp index f2dbd6c8bb..5d4134a461 100644 --- a/src/RHEO/fix_rheo_thermal.cpp +++ b/src/RHEO/fix_rheo_thermal.cpp @@ -186,7 +186,7 @@ FixRHEOThermal::FixRHEOThermal(LAMMPS *lmp, int narg, char **arg) : if (iarg + 2 >= narg) utils::missing_cmd_args(FLERR, "fix rheo/thermal react", error); cut_bond = utils::numeric(FLERR, arg[iarg + 1], false, lmp); btype = utils::numeric(FLERR, arg[iarg + 2], false, lmp); - comm_forward = 1; + comm_forward = 4; if (cut_bond <= 0.0) error->all(FLERR, "Illegal max bond length must be greater than zero");\ if (btype < 1 || btype > atom->nbondtypes) error->all(FLERR, "Illegal value for bond type"); @@ -400,7 +400,7 @@ void FixRHEOThermal::post_integrate() MPI_Allreduce(&n_freeze, &n_freeze_all, 1, MPI_INT, MPI_SUM, world); if (cut_bond > 0 && (n_melt_all || n_freeze_all)) { - // Forward status then delete/create bonds + // Forward status + positions (after inititial integrate, before comm) comm->forward_comm(this); if (n_freeze_all) create_bonds(); @@ -623,7 +623,7 @@ void FixRHEOThermal::create_bonds() { int i, j, ii, jj, inum, jnum; int *ilist, *jlist, *numneigh, **firstneigh; - double xtmp, ytmp, ztmp, delx, dely, delz, rsq; + double delx, dely, delz, rsq; int nlocal = atom->nlocal; int newton_bond = force->newton_bond; @@ -648,10 +648,6 @@ void FixRHEOThermal::create_bonds() i = ilist[ii]; if (!(status[i] & STATUS_SOLID)) continue; - xtmp = x[i][0]; - ytmp = x[i][1]; - ztmp = x[i][2]; - jlist = firstneigh[i]; jnum = numneigh[i]; @@ -662,9 +658,18 @@ void FixRHEOThermal::create_bonds() if (!(status[j] & STATUS_SOLID)) continue; if (!(status[i] & STATUS_FREEZING) && !(status[j] & STATUS_FREEZING)) continue; - delx = xtmp - x[j][0]; - dely = ytmp - x[j][1]; - delz = ztmp - x[j][2]; + // Ensure pair is always ordered to ensure numerical operations + // are identical to minimize the possibility that a bond straddling + // an mpi grid (newton off) isn't created on one proc but not the other + if (tag[i] < tag[j]) { + delx = x[i][0] - x[j][0]; + dely = x[i][1] - x[j][1]; + delz = x[i][2] - x[j][2]; + } else { + delx = x[j][0] - x[i][0]; + dely = x[j][1] - x[i][1]; + delz = x[j][2] - x[i][2]; + } rsq = delx * delx + dely * dely + delz * delz; if (rsq > cutsq_bond) continue; @@ -731,11 +736,15 @@ int FixRHEOThermal::pack_forward_comm(int n, int *list, double *buf, { int i, j, k, m; int *status = atom->status; + double **x = atom->x; m = 0; for (i = 0; i < n; i++) { j = list[i]; buf[m++] = ubuf(status[j]).d; + buf[m++] = x[j][0]; + buf[m++] = x[j][1]; + buf[m++] = x[j][2]; } return m; } @@ -746,10 +755,13 @@ void FixRHEOThermal::unpack_forward_comm(int n, int first, double *buf) { int i, k, m, last; int *status = atom->status; - + double **x = atom->x; m = 0; last = first + n; for (i = first; i < last; i++) { status[i] = (int) ubuf(buf[m++]).i; + x[i][0] = buf[m++]; + x[i][1] = buf[m++]; + x[i][2] = buf[m++]; } } From e5d687528766a15857bd35b9393c2ca00ab237cc Mon Sep 17 00:00:00 2001 From: Thomas O'Connor Date: Thu, 9 May 2024 11:52:16 -0400 Subject: [PATCH 084/158] Update Howto_rheo.rst Typos and wording. --- doc/src/Howto_rheo.rst | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/doc/src/Howto_rheo.rst b/doc/src/Howto_rheo.rst index 748c91845b..e9e0861dc3 100644 --- a/doc/src/Howto_rheo.rst +++ b/doc/src/Howto_rheo.rst @@ -1,9 +1,9 @@ Reproducing hydrodynamics and elastic objects (RHEO) ==================================================== -The RHEO package is built around an implementation of smoothed particle -hydrodynamics (SPH) coupled to the :doc:`BPM package ` to model -solid elements of a system. The SPH solver supports many advanced options +The RHEO package is a hybrid implementation of smoothed particle +hydrodynamics (SPH) for fluid flow, coupled to the :doc:`BPM package ` to model +solid elements. RHEO combines these methods to enable mesh-free modeling of multiphase material systems. The SPH solver supports many advanced options including reproducing kernels, particle shifting, free surface identification, and solid surface reconstruction. To model fluid-solid systems, the status of particles can dynamically change between a fluid and solid state, e.g. during @@ -23,14 +23,14 @@ instance of :doc:`fix rheo/pressure ` and of state and viscosity model, respectively. Optionally, one can model a heat equation with :doc:`fix rheo/thermal`, which also allows the user to specify equations for a particle's thermal conductivity, specific heat, -latent heat, and melting temperature. Fix rheo must be defined prior to all +latent heat, and melting temperature. The ordering of these fixes in an an input script matters. Fix rheo must be defined prior to all other RHEO fixes. Typically, RHEO requires atom style rheo. In addition to typical atom properties like positions and forces, particles store a local density, viscosity, pressure, and status. If thermal evolution is modeled, one must use atom style rheo/thermal which also include a local temperature and -conductivity. The status variable uses bitmasking to track various +thermal conductivity. RHEO style atoms also have a status variable which uses bitmasking to track various properties of a particle such as its current state of matter (fluid or solid) and its location relative to a surface. Many of these properties (and others) can be easily accessed using @@ -39,14 +39,14 @@ can be easily accessed using Fluid interactions, including pressure forces, viscous forces, and heat exchange, are calculated using :doc:`pair rheo `. Unlike typical pair styles, pair rheo ignores the :doc:`special bond ` settings. Instead, -it determines whether to calculate forces based on the status of particles: +it determines whether to calculate forces based on the status of particles: e.g., hydrodynamic forces are only calculated if a fluid particle is involved. ---------- -To model elastic objects, there are current two mechanisms in RHEO, one designed +To model elastic objects, there are currently two mechanisms in RHEO, one designed for bulk solid bodies and the other for thin shells. Both mechanisms rely on -overlaying bonds and therefore require a hybrid of atom style bond and rheo +introducing bonded forces between particles and therefore require a hybrid of atom style bond and rheo (or rheo/thermal). To create an elastic solid body, one has to (a) change the status of constituent From 343f8afbf6548e3b454174a5353c9cc17a37ad12 Mon Sep 17 00:00:00 2001 From: jtclemm Date: Tue, 14 May 2024 14:47:11 -0600 Subject: [PATCH 085/158] Many minor tweaks, adding self/mass + oxide noshift --- doc/src/fix_rheo.rst | 40 ++++++++++++++++++------- doc/src/fix_rheo_viscosity.rst | 49 ++++++++++++++++++++++++++----- src/RHEO/compute_rheo_rho_sum.cpp | 16 +++++++--- src/RHEO/compute_rheo_rho_sum.h | 1 + src/RHEO/fix_rheo.cpp | 8 ++++- src/RHEO/fix_rheo.h | 1 + src/RHEO/fix_rheo_oxidation.cpp | 6 +++- src/RHEO/fix_rheo_thermal.cpp | 2 +- src/RHEO/fix_rheo_viscosity.cpp | 3 +- 9 files changed, 100 insertions(+), 26 deletions(-) diff --git a/doc/src/fix_rheo.rst b/doc/src/fix_rheo.rst index 5c46ad892e..556d683c72 100644 --- a/doc/src/fix_rheo.rst +++ b/doc/src/fix_rheo.rst @@ -17,7 +17,7 @@ Syntax * zmin = minimal number of neighbors for reproducing kernels * zero or more keyword/value pairs may be appended to args * keyword = *thermal* or *interface/reconstruct* or *surface/detection* or - *shift* or *rho/sum* or *density* or *speed/sound* + *shift* or *rho/sum* or *density* or *self/mass* or *speed/sound* .. parsed-literal:: @@ -29,6 +29,7 @@ Syntax *limit/splash* = threshold for splash particles *shift* values = none, turns on velocity shifting *rho/sum* values = none, uses the kernel to compute the density of particles + *self/mass* values = none, a particle uses its own mass in a rho summation *density* values = *rho01*, ... *rho0N* (density) *speed/sound* values = *cs0*, ... *csN* (velocity) @@ -106,24 +107,38 @@ threshold for this classification is set by the numerical value of By default, RHEO integrates particles' densities using a mass diffusion equation. Alternatively, one can update densities every timestep by performing -a kernel summation of the masses of neighboring particles by specifying the *rho/sum* keyword. +a kernel summation of the masses of neighboring particles by specifying the *rho/sum* +keyword. -The *density* is used to specify the equilbrium density of each of the N +The *self/mass* keyword modifies the behavior of the density summation in *rho/sum*. +Typically, the density :math:`\rho` of a particle is calculated as the sum + +.. math:: + \rho_i = \Sum_{j} W_{ij} M_j + +where the summation is over neighbors, :math:`W_{ij}` is the kernel, and :math:`M_j` +is the mass of particle :math:`j`. The *self/mass* keyword augments this expression +by replacing :math:`M_j` with :math:`M_i`. This may be useful in simulations of +multiple fluid phases with large differences in density, :ref:`(Hu) `. + +The *density* keyword is used to specify the equilbrium density of each of the N particle types. It must be followed by N numerical values specifying each type's equilibrium density *rho0*. -The *density* is used to specify the speed of sound of each of the N particle -types. It must be followed by N numerical values specifying each type's speed -of sound *cs*. +The *speed/sound* keyword is used to specify the speed of sound of each of the +N particle types. It must be followed by N numerical values specifying each +type's speed of sound *cs*. 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 +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 global or per-atom quantities are stored by this fix for access by various :doc:`output commands `. 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 """""""""""" @@ -138,7 +153,8 @@ set to all. Only one instance of fix rheo may be defined and it must be defined prior to all other RHEO fixes. This fix is part of the RHEO package. It is only enabled if -LAMMPS was built with that package. See the :doc:`Build package ` page for more info. +LAMMPS was built with that package. See the +:doc:`Build package ` page for more info. Related commands """""""""""""""" @@ -156,6 +172,10 @@ Default ---------- -.. _howto-howto_rheo_palermo: +.. _howto_rheo_palermo: **(Palermo)** Palermo, Clemmer, Wolf, O'Connor, in preparation. + +.. _fix_rheo_hu: + +**(Hu)** Hu, and Adams J. Comp. Physics, 213, 844-861 (2006). diff --git a/doc/src/fix_rheo_viscosity.rst b/doc/src/fix_rheo_viscosity.rst index 8c403f8d0b..8175178787 100644 --- a/doc/src/fix_rheo_viscosity.rst +++ b/doc/src/fix_rheo_viscosity.rst @@ -14,20 +14,26 @@ Syntax * rheo/viscosity = style name of this fix command * one or more types and viscosity styles must be appended * types = lists of types (see below) -* vstyle = *constant* +* vstyle = *constant* or *power* .. parsed-literal:: *constant* args = *eta* *eta* = viscosity + *power* args = *eta*, *gd0*, *K*, *n* + *eta* = viscosity + *gd0* = critical strain rate + *K* = consistency index + *n* = power-law exponent + Examples """""""" .. code-block:: LAMMPS fix 1 all rheo/viscosity * constant 1.0 - fix 1 all rheo/viscosity 1 constant 1.0 2 constant 2.0 + fix 1 all rheo/viscosity 1 constant 1.0 2 power 0.1 5e-4 0.001 0.5 Description """"""""""" @@ -47,18 +53,38 @@ means all types from 1 to n (inclusive). A trailing asterisk means all types from m to :math:`N` (inclusive). A middle asterisk means all types from m to n (inclusive). -The *types* definition is followed by the viscosity style, *vstyle*. Currently, -the only option is *constant*. Style *constant* simply applies a constant value -of the viscosity *eta* to each particle of the assigned type. +The *types* definition is followed by the viscosity style, *vstyle*. Two +options are available, *constant* and *power*. Style *constant* simply +applies a constant value of the viscosity *eta* to each particle of the +assigned type. Style *power* is a Hershchel-Bulkley constitutive equation +for the stress :math:`\tau` + +.. math:: + + \tau = \left(\frac{\tau_0}{\dot{\gamma}} + K \dot{\gamma}^{n - 1}\right) \dot{\gamma}, \tau \ge \tau_0 + +where :math:`\dot{\gamma}` is the strain rate and :math:`tau_0` is the critical +yield stress, below which :math:`\dot{\gamma} = 0.0`. To avoid divergences, this +expression is regularized by defining a critical strain rate *gd0*. If the local +strain rate on a particle falls below this limit, a constant viscosity of *eta* +is assigned. This implies a value of + +.. math:: + \tau_0 = \eta * \dot{\gamma}_0 - K \dot{\gamma}_0^N + +as further discussed in :ref:`(Palermo) `. + 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 +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 global or per-atom quantities are stored by this fix for access by various :doc:`output commands `. 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 """""""""""" @@ -69,7 +95,8 @@ conjuction with :doc:`fix rheo `. The fix group must be set to all. Only one instance of fix rheo/viscosity can be defined. This fix is part of the RHEO package. It is only enabled if -LAMMPS was built with that package. See the :doc:`Build package ` page for more info. +LAMMPS was built with that package. See the +:doc:`Build package ` page for more info. Related commands """""""""""""""" @@ -82,3 +109,9 @@ Default """"""" none + +---------- + +.. _howto_rheo_palermo: + +**(Palermo)** Palermo, Clemmer, Wolf, O'Connor, in preparation. diff --git a/src/RHEO/compute_rheo_rho_sum.cpp b/src/RHEO/compute_rheo_rho_sum.cpp index 8322ad4ad4..c7270897a4 100644 --- a/src/RHEO/compute_rheo_rho_sum.cpp +++ b/src/RHEO/compute_rheo_rho_sum.cpp @@ -35,7 +35,9 @@ using namespace LAMMPS_NS; ComputeRHEORhoSum::ComputeRHEORhoSum(LAMMPS *lmp, int narg, char **arg) : Compute(lmp, narg, arg), fix_rheo(nullptr), compute_kernel(nullptr) { - if (narg != 3) error->all(FLERR,"Illegal compute RHEO/rho command"); + if (narg != 4) error->all(FLERR,"Illegal compute RHEO/rho command"); + + self_mass_flag = utils::bnumeric(FLERR, arg[3], false, lmp); comm_forward = 1; comm_reverse = 1; @@ -117,9 +119,15 @@ void ComputeRHEORhoSum::compute_peratom() rsq = delx * delx + dely * dely + delz * delz; if (rsq < cutsq) { w = compute_kernel->calc_w(i, j, delx, dely, delz, sqrt(rsq)); - rho[i] += w * mass[type[i]]; - if (newton || j < nlocal) { - rho[j] += w * mass[type[j]]; + + if (self_mass_flag) { + rho[i] += w * mass[type[i]]; + if (newton || j < nlocal) + rho[j] += w * mass[type[j]]; + } else { + rho[i] += w * mass[type[j]]; + if (newton || j < nlocal) + rho[j] += w * mass[type[i]]; } } } diff --git a/src/RHEO/compute_rheo_rho_sum.h b/src/RHEO/compute_rheo_rho_sum.h index 6ec2547b95..491e61ea81 100644 --- a/src/RHEO/compute_rheo_rho_sum.h +++ b/src/RHEO/compute_rheo_rho_sum.h @@ -39,6 +39,7 @@ class ComputeRHEORhoSum : public Compute { class FixRHEO *fix_rheo; private: + int self_mass_flag; double cut, cutsq; class NeighList *list; diff --git a/src/RHEO/fix_rheo.cpp b/src/RHEO/fix_rheo.cpp index 98382b07b5..a355aee5d8 100644 --- a/src/RHEO/fix_rheo.cpp +++ b/src/RHEO/fix_rheo.cpp @@ -60,6 +60,7 @@ FixRHEO::FixRHEO(LAMMPS *lmp, int narg, char **arg) : interface_flag = 0; surface_flag = 0; oxidation_flag = 0; + self_mass_flag = 0; int i; int n = atom->ntypes; @@ -124,6 +125,8 @@ FixRHEO::FixRHEO(LAMMPS *lmp, int narg, char **arg) : interface_flag = 1; } else if (strcmp(arg[iarg], "rho/sum") == 0) { rhosum_flag = 1; + } else if (strcmp(arg[iarg], "self/mass")) { + self_mass_flag = 1; } else if (strcmp(arg[iarg], "density") == 0) { if (iarg + n >= narg) error->all(FLERR, "Illegal rho0 option in fix rheo"); for (i = 1; i <= n; i++) @@ -142,6 +145,9 @@ FixRHEO::FixRHEO(LAMMPS *lmp, int narg, char **arg) : iarg += 1; } + if (self_mass_flag && !rhosum_flag) + error->all(FLERR, "Cannot use self/mass setting without rho/sum"); + if (lmp->citeme) lmp->citeme->add(cite_rheo); } @@ -178,7 +184,7 @@ void FixRHEO::post_constructor() if (rhosum_flag) { compute_rhosum = dynamic_cast(modify->add_compute( - "rheo_rhosum all RHEO/RHO/SUM")); + fmt::format("rheo_rhosum all RHEO/RHO/SUM {}", self_mass_flag))); compute_rhosum->fix_rheo = this; } diff --git a/src/RHEO/fix_rheo.h b/src/RHEO/fix_rheo.h index 51e0962000..89a0591824 100644 --- a/src/RHEO/fix_rheo.h +++ b/src/RHEO/fix_rheo.h @@ -41,6 +41,7 @@ class FixRHEO : public Fix { // Model parameters double h, cut; double *rho0, *csq; + int self_mass_flag; int zmin_kernel, zmin_surface, zmin_splash; int kernel_style, surface_style; double divr_surface; diff --git a/src/RHEO/fix_rheo_oxidation.cpp b/src/RHEO/fix_rheo_oxidation.cpp index 8539f04277..9f19d4f4da 100644 --- a/src/RHEO/fix_rheo_oxidation.cpp +++ b/src/RHEO/fix_rheo_oxidation.cpp @@ -141,6 +141,10 @@ void FixRHEOOxidation::setup_pre_force(int /*vflag*/) void FixRHEOOxidation::pre_force(int /*vflag*/) { + int *status = atom->status; + for (int i = 0; i < atom->nlocal; i++) + if (num_bond[i] != 0) + status[i] |= STATUS_NO_SHIFT; } /* ---------------------------------------------------------------------- */ @@ -215,7 +219,7 @@ void FixRHEOOxidation::post_integrate() if (bflag) continue; // Add bonds to owned atoms - // If newton bond, add to both, otherwise add to whichever has a smaller tag + // If newton bond off, add to both, otherwise add to whichever has a smaller tag if (!newton_bond || tagi < tagj) { if (num_bond[i] == atom->bond_per_atom) diff --git a/src/RHEO/fix_rheo_thermal.cpp b/src/RHEO/fix_rheo_thermal.cpp index 5d4134a461..24a6a73021 100644 --- a/src/RHEO/fix_rheo_thermal.cpp +++ b/src/RHEO/fix_rheo_thermal.cpp @@ -674,7 +674,7 @@ void FixRHEOThermal::create_bonds() if (rsq > cutsq_bond) continue; // Add bonds to owned atoms - // If newton bond, add to both, otherwise add to whichever has a smaller tag + // If newton bond off, add to both, otherwise add to whichever has a smaller tag if (i < nlocal && (!newton_bond || tag[i] < tag[j])) { if (num_bond[i] == atom->bond_per_atom) error->one(FLERR,"New bond exceeded bonds per atom in fix rheo/thermal"); diff --git a/src/RHEO/fix_rheo_viscosity.cpp b/src/RHEO/fix_rheo_viscosity.cpp index abaa55ca70..2d5d58d494 100644 --- a/src/RHEO/fix_rheo_viscosity.cpp +++ b/src/RHEO/fix_rheo_viscosity.cpp @@ -56,6 +56,7 @@ FixRHEOViscosity::FixRHEOViscosity(LAMMPS *lmp, int narg, char **arg) : memory->create(gd0, n + 1, "rheo:gd0"); memory->create(K, n + 1, "rheo:K"); memory->create(npow, n + 1, "rheo:npow"); + memory->create(tau0, n + 1, "rheo:tau0"); for (i = 1; i <= n; i++) viscosity_style[i] = NONE; int iarg = 3; @@ -76,7 +77,7 @@ FixRHEOViscosity::FixRHEOViscosity(LAMMPS *lmp, int narg, char **arg) : viscosity_style[i] = CONSTANT; eta[i] = eta_one; } - } else if (strcmp(arg[iarg], "power") == 0) { + } else if (strcmp(arg[iarg + 1], "power") == 0) { if (iarg + 5 >= narg) utils::missing_cmd_args(FLERR, "fix rheo/viscosity power", error); comm_forward = 1; From 8d25c510c11cdbd538f8b29d391b5be8b7a7f551 Mon Sep 17 00:00:00 2001 From: jtclemm Date: Sun, 19 May 2024 11:22:52 -0600 Subject: [PATCH 086/158] Draft examples, patches, clarify interface reconstruct in RHEO --- doc/src/Examples.rst | 2 + doc/src/Howto_rheo.rst | 28 +- doc/src/bond_rheo_shell.rst | 2 +- doc/src/compute_rheo_property_atom.rst | 32 +- doc/src/fix_rheo.rst | 3 +- doc/src/fix_rheo_oxidation.rst | 10 +- doc/src/fix_rheo_thermal.rst | 8 + doc/src/read_data.rst | 2 +- .../PACKAGES/rheo/dam-break/in.rheo.dam.break | 87 --- examples/rheo/balloon/in.rheo.balloon | 74 ++ examples/rheo/dam-break/in.rheo.dam.break | 81 +++ examples/rheo/ice-cubes/in.rheo.ice.cubes | 80 +++ examples/rheo/ice-cubes/square.mol | 658 ++++++++++++++++++ examples/rheo/oxidation/in.rheo.oxidation | 102 +++ .../rheo/poiseuille/in.rheo.poiseuille | 44 +- .../rheo/taylor-green/in.rheo.taylor.green | 26 +- src/GRANULAR/fix_add_heat.cpp | 2 +- src/RHEO/bond_rheo_shell.cpp | 1 - src/RHEO/compute_rheo_grad.cpp | 8 +- src/RHEO/compute_rheo_interface.cpp | 26 +- src/RHEO/compute_rheo_property_atom.cpp | 9 +- src/RHEO/compute_rheo_surface.cpp | 93 +-- src/RHEO/compute_rheo_surface.h | 1 - src/RHEO/compute_rheo_vshift.cpp | 29 +- src/RHEO/compute_rheo_vshift.h | 1 + src/RHEO/fix_rheo.cpp | 25 +- src/RHEO/fix_rheo.h | 2 +- src/RHEO/fix_rheo_oxidation.cpp | 49 +- src/RHEO/fix_rheo_oxidation.h | 3 +- src/RHEO/fix_rheo_thermal.cpp | 41 +- src/RHEO/fix_rheo_thermal.h | 2 +- src/RHEO/pair_rheo.cpp | 8 +- 32 files changed, 1265 insertions(+), 274 deletions(-) delete mode 100644 examples/PACKAGES/rheo/dam-break/in.rheo.dam.break create mode 100644 examples/rheo/balloon/in.rheo.balloon create mode 100644 examples/rheo/dam-break/in.rheo.dam.break create mode 100644 examples/rheo/ice-cubes/in.rheo.ice.cubes create mode 100644 examples/rheo/ice-cubes/square.mol create mode 100644 examples/rheo/oxidation/in.rheo.oxidation rename examples/{PACKAGES => }/rheo/poiseuille/in.rheo.poiseuille (55%) rename examples/{PACKAGES => }/rheo/taylor-green/in.rheo.taylor.green (68%) diff --git a/doc/src/Examples.rst b/doc/src/Examples.rst index c5da4a498b..3d2103fd6f 100644 --- a/doc/src/Examples.rst +++ b/doc/src/Examples.rst @@ -134,6 +134,8 @@ Lowercase directories +-------------+------------------------------------------------------------------+ | rerun | use of rerun and read_dump commands | +-------------+------------------------------------------------------------------+ +| rheo | RHEO simulations of fluid flows and phase transitions | ++-------------+------------------------------------------------------------------+ | rigid | rigid bodies modeled as independent or coupled | +-------------+------------------------------------------------------------------+ | shear | sideways shear applied to 2d solid, with and without a void | diff --git a/doc/src/Howto_rheo.rst b/doc/src/Howto_rheo.rst index 748c91845b..b09925d6ac 100644 --- a/doc/src/Howto_rheo.rst +++ b/doc/src/Howto_rheo.rst @@ -10,8 +10,12 @@ particles can dynamically change between a fluid and solid state, e.g. during melting/solidification, which determines how they interact and their physical behavior. The package is designed with modularity in mind, so one can easily turn various features on/off, adjust physical details of the system, or -develop new capabilities. Additional numerical details can be found in -:ref:`(Palermo) ` and :ref:`(Clemmer) `. +develop new capabilities. For instance, the numerics associated with +calculating gradients, reproducing kernels, etc. are separated into distinct +classes to simplify the development of new integration schemes which can call +these calculations. Additional numerical details can be found in +:ref:`(Palermo) ` and +:ref:`(Clemmer) `. ---------- @@ -29,12 +33,17 @@ other RHEO fixes. Typically, RHEO requires atom style rheo. In addition to typical atom properties like positions and forces, particles store a local density, viscosity, pressure, and status. If thermal evolution is modeled, one must -use atom style rheo/thermal which also include a local temperature and -conductivity. The status variable uses bitmasking to track various -properties of a particle such as its current state of matter (fluid or solid) -and its location relative to a surface. Many of these properties (and others) -can be easily accessed using -:doc:`compute rheo/property/atom `. +use atom style rheo/thermal which also includes a local energy, temperature, and +conductivity. Note that the temperature is always derived from the energy. +This implies the *temperature* attribute of :doc:`the set command ` does not +affect particles. Instead, one should use the *sph/e* attribute. + +The status variable uses bitmasking to track various properties of a particle +such as its current state of matter (fluid or solid) and its location relative +to a surface. Some of these properties (and others) can be accessed using +:doc:`compute rheo/property/atom `. The *status* attribute +in :doc:`the set command ` only allows control over the first bit which sets +the state of matter, 0 is fluid and 1 is solid. Fluid interactions, including pressure forces, viscous forces, and heat exchange, are calculated using :doc:`pair rheo `. Unlike typical pair styles, @@ -61,7 +70,8 @@ in the same elastic body. In systems with thermal evolution, fix rheo/thermal can optionally set a melting/solidification temperature allowing particles to dynamically swap their -state between fluid and solid. Using the *react* option, one can specify a maximum +state between fluid and solid when the temperature exceeds or drops below the +critical temperature, respectively. Using the *react* option, one can specify a maximum bond length and a bond type. Then, when solidifying, particles will search their local neighbors and automatically create bonds with any neighboring solid particles in range. For BPM bond styles, bonds will then use the immediate position of the two diff --git a/doc/src/bond_rheo_shell.rst b/doc/src/bond_rheo_shell.rst index 713bd84136..3b5cfa6a49 100644 --- a/doc/src/bond_rheo_shell.rst +++ b/doc/src/bond_rheo_shell.rst @@ -65,7 +65,7 @@ the setup of a run. Data is then preserved across run commands and is written to :doc:`binary restart files ` such that restarting the system will not reset the reference state of a bond or the timer. -This bond style is based on a model described in Ref. +This bond style is based on a model described in :ref:`(Clemmer) `. The force has a magnitude of .. math:: diff --git a/doc/src/compute_rheo_property_atom.rst b/doc/src/compute_rheo_property_atom.rst index 8d1cf47f58..a7e1bff383 100644 --- a/doc/src/compute_rheo_property_atom.rst +++ b/doc/src/compute_rheo_property_atom.rst @@ -16,19 +16,18 @@ Syntax .. parsed-literal:: - possible attributes = phase, chi, surface, surface/r, + possible attributes = phase, surface, surface/r, surface/divr, surface/n/x, surface/n/y, surface/n/z, coordination, cv, shift/v/x, shift/v/y, shift/v/z, energy, temperature, heatflow, conductivity, cv, viscosity, pressure, - status, rho, grad/v/xx, grad/v/xy, grad/v/xz, + rho, grad/v/xx, grad/v/xy, grad/v/xz, grad/v/yx, grad/v/yy/, grad/v/yz, grad/v/zx, grad/v/zy, grad/v/zz .. parsed-literal:: *phase* = atom phase state - *chi* = atom local phase metric *surface* = atom surface status *surface/r* = atom distance from the surface *surface/divr* = divergence of position at atom position @@ -42,7 +41,6 @@ Syntax *cv* = atom specific heat *viscosity* = atom viscosity *pressure* = atom pressure - *status* = atom full status *rho* = atom density *grad/v/\** = atom velocity gradient *nbond/shell* = number of oxide bonds @@ -70,14 +68,32 @@ computes as inputs. See for example, the :doc:`fix ave/chunk `, and :doc:`atom-style variable ` commands. -The possible attributes are described in more detail in other RHEO doc -pages including :doc:`the RHEO howto page `. Many -properties require their respective fixes, listed below in related -commands, be defined. +Many properties require their respective fixes, listed below in related +commands, be defined. For instance, the *viscosity* attribute is the +viscosity of a particle calculated by +:doc:`fix rheo/viscous `. The meaning of less obvious +properties is described below. + +The *phase* property indicates whether the particle is in a fluid state, +a value of 0, or a solid state, a value of 1. + +The *surface* property indicates the surface designation produced by +the *interface/reconstruct* option of :doc:`fix rheo `. Bulk +particles have a value of 0, surface particles have a value of 1, and +splash particles have a value of 2. The *surface/r* property is the +distance from the surface, up to the kernel cutoff length. Surface particles +have a value of 0. The *surface/n* properties are the components of the +surface normal vector. + +The *shift/v* properties are the components of the shifting velocity +produced by the *shift* option of :doc:`fix rheo `. The *surface/n/\** and *shift/v/\** attributes are vectors that require specification of the *x*, *y*, or *z* component, e.g. *surface/n/x*. +The *nbond/shell* property is the number of shell bonds that have been +activated from :doc:`bond style rheo/shell `. + The *grad/v/\** attribute is a tensor and requires specification of the *xx*, *yy*, *zz*, *xy*, *xz*, *yx*, *yz*, *zx*, or *zy* component, e.g. *grad/v/xy*. diff --git a/doc/src/fix_rheo.rst b/doc/src/fix_rheo.rst index 556d683c72..978691db41 100644 --- a/doc/src/fix_rheo.rst +++ b/doc/src/fix_rheo.rst @@ -92,7 +92,8 @@ Shifting is then disabled in the direction away from the free surface to prevent it from diffusing particles away from the bulk fluid. Surface detection can also be used to control surface-nucleated effects like oxidation when used in combination with -:doc:`fix rheo/oxidation `. +:doc:`fix rheo/oxidation `. Surface detection is not +performed on solid bodies. The *surface/detection* keyword takes three arguments: *sdstyle*, *limit*, and *limi/splash*. The first, *sdstyle*, specifies whether surface particles diff --git a/doc/src/fix_rheo_oxidation.rst b/doc/src/fix_rheo_oxidation.rst index 42e2b6d59e..3043291c60 100644 --- a/doc/src/fix_rheo_oxidation.rst +++ b/doc/src/fix_rheo_oxidation.rst @@ -35,10 +35,12 @@ for use with bond style :doc:`bond rheo/shell `. Every timestep, particles check neighbors within a distance of *cut*. This distance must be smaller than the kernel length defined in -:doc:`fix rheo `. If both particles are on the fluid surface, -or within a distance of *rsurf* from the surface, a bond of type -*btype* is created between the two particles. This process is -further described in Ref. :ref:`(Clemmer) `. +:doc:`fix rheo `. Bonds of type *btype* are created between +pairs of particles that satisfy one of two conditions. First, if both +particles are on the fluid surface, or within a distance of *rsurf* +from the surface. Secondly, if one particle is on the fluid surface +and the other bond is solid. This process is further described in +:ref:`(Clemmer) `. If used in conjunction with solid bodies, such as those generated by the *react* option of :doc:`fix rheo/thermal `, diff --git a/doc/src/fix_rheo_thermal.rst b/doc/src/fix_rheo_thermal.rst index 2ffb665bb7..1ceb1259c0 100644 --- a/doc/src/fix_rheo_thermal.rst +++ b/doc/src/fix_rheo_thermal.rst @@ -55,12 +55,20 @@ rheo/thermal. In addition, it defines multiple thermal properties of particles and handles melting/solidification, if applicable. For more details on phase transitions in RHEO, see :doc:`the RHEO howto `. +Note that the temperature of a particle is always derived from the energy. +This implies the *temperature* attribute of :doc:`the set command ` does +not affect particles. Instead, one should use the *sph/e* attribute. + For each atom type, one can define attributes for the *conductivity*, *specific/heat*, *latent/heat*, and critical temperature (*Tfreeze*). The conductivity and specific heat must be defined for all atom types. The latent heat and critical temperature are optional. However, a critical temperature must be defined to specify a latent heat. +Note, if shifting is turned on in :doc:`fix rheo `, the gradient +of the energy is used to shift energies. This may be inappropriate in systems +with multiple atom types with different specific heats. + For each property, one must first define a list of atom types. A wild-card asterisk can be used in place of or in conjunction with the *types* argument to set the coefficients for multiple pairs of atom types. This takes the diff --git a/doc/src/read_data.rst b/doc/src/read_data.rst index 4950d8bc25..5ebb34dcab 100644 --- a/doc/src/read_data.rst +++ b/doc/src/read_data.rst @@ -717,7 +717,7 @@ of analysis. * - rheo - atom-ID atom-type status rho x y z * - rheo/thermal - - atom-ID atom-type status rho temperature x y z + - atom-ID atom-type status rho energy x y z * - smd - atom-ID atom-type molecule volume mass kradius cradius x0 y0 z0 x y z * - sph diff --git a/examples/PACKAGES/rheo/dam-break/in.rheo.dam.break b/examples/PACKAGES/rheo/dam-break/in.rheo.dam.break deleted file mode 100644 index 207fd6885e..0000000000 --- a/examples/PACKAGES/rheo/dam-break/in.rheo.dam.break +++ /dev/null @@ -1,87 +0,0 @@ -# ------ 2D dam break ------ # - -dimension 2 -units lj -atom_style rheo -boundary f s p -comm_modify vel yes -newton off -comm_style tiled - - -# ------ Create simulation box ------ # - -variable sf equal 0.05 -variable n equal 1.0/(${sf}^2) -variable cut equal 3.0*${sf} - -region box block -1 55 -1 20 -0.01 0.01 units box -create_box 2 box -lattice sq ${n} - -region left_wall block -1 0 EDGE EDGE -0.01 0.01 units box -region right_wall block 53.66 EDGE EDGE EDGE -0.01 0.01 units box -region bot_wall block 0.01 53.65 -1 0 -0.01 0.01 units box -region interior block 0.01 10 0.01 20 -0.01 0.01 units box - -create_atoms 1 region interior -create_atoms 2 region left_wall -create_atoms 2 region right_wall -create_atoms 2 region bot_wall - -group fluid type 1 -group static_wall type 2 -group dyn_wall type 3 -group rig union static_wall dyn_wall - - -# ------ Model parameters ------ # - -variable rho0 equal 1.0 -variable mp equal ${rho0}/${n} -variable cs equal 10 -variable zeta equal 1 -variable Dr equal 0.1*${cut}*${cs} -variable dt_max equal 0.1*${cut}/${cs}/3 -variable g equal 0.0245 -variable fext equal ${g}/${n} -variable eta equal 0.05 - -mass * ${mp} -variable d0 atom (${rho0}*${g}*(20-y)/${cs}/${cs})+${rho0} -set group all rheo/rho ${rho0} -set group fluid rheo/rho v_d0 - -set group all rheo/status 0 -set group rig rheo/status 2 - -timestep ${dt_max} - -pair_style rheo ${cut} artificial/visc ${zeta} rho/damp ${Dr} -pair_coeff * * - - -# ------ Fixes & computes ------ # - -fix 1 all rheo ${cut} RK1 32 shift surface/detection coordination 26 -fix 2 all rheo/viscosity constant ${eta} -fix 3 all rheo/pressure linear -fix 4 rig setforce 0.0 0.0 0.0 -fix 5 fluid addforce 0.0 -${fext} 0.0 -fix 6 all balance 1000 1.1 rcb - -compute 1 all rheo/property/atom rho phase surface - - -# ------ Output & Run ------ # - -thermo 10 -thermo_style custom step time ke press - -variable skin equal 0.2*${cut} -neighbor ${skin} bin -neigh_modify one 5000 - -dump 1 all custom 200 atomDump id type x y vx vy fx fy c_1[*] - -run 400000 diff --git a/examples/rheo/balloon/in.rheo.balloon b/examples/rheo/balloon/in.rheo.balloon new file mode 100644 index 0000000000..d24573b0fb --- /dev/null +++ b/examples/rheo/balloon/in.rheo.balloon @@ -0,0 +1,74 @@ +# ------ 2D water balloon ------ # + +dimension 2 +units lj +atom_style hybrid rheo bond +boundary m m p +comm_modify vel yes +newton off + +region box block -40 40 0 80 -0.01 0.01 units box +create_box 1 box bond/types 1 extra/bond/per/atom 15 extra/special/per/atom 50 + +region fluid sphere -10 40 0 30 units box side in +lattice hex 1.0 +create_atoms 1 region fluid + +region shell sphere -10 40 0 27 units box side out +group shell region shell + +set group shell rheo/status 1 +set group all vx 0.005 vy -0.04 + +# ------ Model parameters ------# + +variable cut equal 3.0 +variable n equal 1.0 +variable rho0 equal 1.0 +variable cs equal 1.0 +variable mp equal ${rho0}/${n} +variable zeta equal 0.05 +variable kappa equal 0.01*${rho0}/${mp} +variable dt_max equal 0.1*${cut}/${cs}/3 +variable eta equal 0.05 +variable Cv equal 1.0 +variable L equal 1.0 +variable Tf equal 1.0 + +mass * ${mp} +timestep 0.1 + +pair_style hybrid/overlay rheo ${cut} artificial/visc ${zeta} rheo/solid +pair_coeff * * rheo +pair_coeff * * rheo/solid 1.0 1.0 1.0 + +special_bonds lj 0.0 1.0 1.0 coul 0.0 1.0 1.0 +create_bonds many shell shell 1 0 1.5 +special_bonds lj 0.0 1.0 1.0 coul 1.0 1.0 1.0 + +bond_style bpm/spring +bond_coeff 1 1.0 1.0 1.0 + +# A lower critical strain allows the balloon to pop +#bond_coeff 1 1.0 0.05 1.0 + +# ------ Drop balloon ------# + +fix 1 all rheo ${cut} quintic 0 & + shift & + surface/detection coordination 22 8 +fix 2 all rheo/viscosity * constant ${eta} +fix 3 all rheo/pressure * linear +fix 4 all wall/harmonic ylo EDGE 2.0 1.0 1.0 + +compute rho all rheo/property/atom rho +compute phase all rheo/property/atom phase +compute nbond all nbond/atom + +# ------ Output & Run ------ # + +thermo 200 +thermo_style custom step time ke press atoms + +dump 1 all custom 200 atomDump id type x y vx vy fx fy c_phase c_nbond c_rho +run 30000 diff --git a/examples/rheo/dam-break/in.rheo.dam.break b/examples/rheo/dam-break/in.rheo.dam.break new file mode 100644 index 0000000000..b59b710451 --- /dev/null +++ b/examples/rheo/dam-break/in.rheo.dam.break @@ -0,0 +1,81 @@ +# ------ 2D dam break ------ # + +dimension 2 +units lj +atom_style rheo +boundary f f p +comm_modify vel yes +newton off + +# ------ Create simulation box ------ # + +variable n equal 1.0 +variable cut equal 3.0 +variable dx equal 4.0 + +region box block -1 200 -1 80 -0.1 0.1 units box +#region box block -1 100 -1 40 -0.1 0.1 units box +create_box 2 box +lattice hex ${n} + +region fluid block $(xlo+v_dx) $(xlo+44.0) $(ylo+v_dx) $(yhi-16.0) EDGE EDGE units box +#region fluid block $(xlo+v_dx) $(xlo+20.0) $(ylo+v_dx) $(yhi-10.0) EDGE EDGE units box +region walls block $(xlo+v_dx) $(xhi-v_dx) $(ylo+v_dx) $(yhi-v_dx) EDGE EDGE units box side out + +create_atoms 1 region fluid +create_atoms 2 region walls + +group fluid type 1 +group rig type 2 + +# ------ Model parameters ------ # + +variable rho0 equal 1.0 +variable mp equal ${rho0}/${n} +variable cs equal 1.0 +variable zeta equal 0.05 +variable dt_max equal 0.1*${cut}/${cs}/3 +variable eta equal 0.05 +variable Dr equal 0.05 + +mass * ${mp} +set group all rheo/rho ${rho0} + +set group all rheo/status 0 +set group rig rheo/status 1 + +timestep ${dt_max} + +pair_style rheo ${cut} artificial/visc ${zeta} rho/damp ${Dr} +pair_coeff * * + + +# ------ Fixes & computes ------ # + +fix 1 all rheo ${cut} quintic 10 & + shift & + surface/detection coordination 22 8 & + interface/reconstruct +#fix 1 all rheo ${cut} RK1 10 surface/detection coordination 36 10 interface/reconstruct shift +fix 2 all rheo/viscosity * constant ${eta} +fix 3 all rheo/pressure * linear +fix 4 all gravity 5e-4 vector 0 -1 0 +fix 5 rig setforce 0.0 0.0 0.0 + +compute rho all rheo/property/atom rho +compute phase all rheo/property/atom phase +compute p all rheo/property/atom pressure +compute surf all rheo/property/atom surface +compute sn all rheo/property/atom surface/n/x surface/n/y +compute vshift all rheo/property/atom shift/v/x shift/v/y + + +# ------ Output & Run ------ # + +thermo 100 +thermo_style custom step time ke press + +dump 1 all custom 20 atomDump id type x y vx vy fx fy c_rho c_phase c_surf c_p c_vshift[*] c_sn[*] + +#thermo 1 +run 300000 # 400000 diff --git a/examples/rheo/ice-cubes/in.rheo.ice.cubes b/examples/rheo/ice-cubes/in.rheo.ice.cubes new file mode 100644 index 0000000000..12eb54c32e --- /dev/null +++ b/examples/rheo/ice-cubes/in.rheo.ice.cubes @@ -0,0 +1,80 @@ +# ------ 2D Ice Cube Pour ------ # + +dimension 2 +units lj +atom_style hybrid rheo/thermal bond +boundary m m p +comm_modify vel yes +newton off +special_bonds lj 0.0 1.0 1.0 coul 1.0 1.0 1.0 + +region box block -25 25 0 100 -0.01 0.01 units box +create_box 1 box bond/types 1 extra/bond/per/atom 15 extra/special/per/atom 50 + +region fluid block $(xlo+1) $(xhi-1) $(ylo+1) $(ylo+30) EDGE EDGE units box +lattice sq 1.0 +create_atoms 1 region fluid + +set group all sph/e 8.0 + +# ------ Model parameters ------# + +variable cut equal 3.0 +variable n equal 1.0 +variable rho0 equal 1.0 +variable cs equal 1.0 +variable mp equal ${rho0}/${n} +variable zeta equal 0.05 +variable kappa equal 0.01*${rho0}/${mp} +variable dt_max equal 0.1*${cut}/${cs}/3 +variable eta equal 0.05 +variable Cv equal 1.0 +variable L equal 1.0 +variable Tf equal 1.0 + +mass * ${mp} +timestep 0.1 + +pair_style hybrid/overlay rheo ${cut} artificial/visc ${zeta} rheo/solid +pair_coeff * * rheo +pair_coeff * * rheo/solid 1.0 1.0 1.0 + +bond_style bpm/spring +bond_coeff 1 1.0 1.0 1.0 + +# ------ Pour particles ------# + +molecule my_mol "square.mol" + +# Wall region extends far enough in z to avoid contact +region wall block EDGE EDGE EDGE EDGE -5 5 side in open 4 units box +region drop block -16 16 70 90 EDGE EDGE side in units box + +fix 1 all rheo ${cut} quintic 0 & + thermal & + shift & + surface/detection coordination 22 8 +fix 2 all rheo/viscosity * constant ${eta} +fix 3 all rheo/pressure * linear +fix 4 all rheo/thermal conductivity * constant ${kappa} & + specific/heat * constant ${Cv} & + Tfreeze * constant ${Tf} & + latent/heat * constant ${L} & + react 1.5 1 +fix 5 all wall/region wall harmonic 1.0 1.0 1.0 +fix 6 all gravity 5e-4 vector 0 -1 0 +fix 7 all deposit 8 0 1000 37241459 mol my_mol region drop near 2.0 vy -0.02 -0.02 + +compute rho all rheo/property/atom rho +compute phase all rheo/property/atom phase +compute temp all rheo/property/atom temperature +compute eng all rheo/property/atom energy +compute nbond all nbond/atom + +# ------ Output & Run ------ # + +thermo 200 +thermo_style custom step time ke press atoms + +dump 1 all custom 200 atomDump id type x y vx vy fx fy c_phase c_temp c_eng c_nbond c_rho +run 30000 diff --git a/examples/rheo/ice-cubes/square.mol b/examples/rheo/ice-cubes/square.mol new file mode 100644 index 0000000000..0344be7244 --- /dev/null +++ b/examples/rheo/ice-cubes/square.mol @@ -0,0 +1,658 @@ +#Made with create_mol.py + +100 atoms +342 bonds + +Coords +#ID x y z +1 -4 -4 0 +2 -3 -4 0 +3 -2 -4 0 +4 -1 -4 0 +5 0 -4 0 +6 1 -4 0 +7 2 -4 0 +8 3 -4 0 +9 4 -4 0 +10 5 -4 0 +11 -4 -3 0 +12 -3 -3 0 +13 -2 -3 0 +14 -1 -3 0 +15 0 -3 0 +16 1 -3 0 +17 2 -3 0 +18 3 -3 0 +19 4 -3 0 +20 5 -3 0 +21 -4 -2 0 +22 -3 -2 0 +23 -2 -2 0 +24 -1 -2 0 +25 0 -2 0 +26 1 -2 0 +27 2 -2 0 +28 3 -2 0 +29 4 -2 0 +30 5 -2 0 +31 -4 -1 0 +32 -3 -1 0 +33 -2 -1 0 +34 -1 -1 0 +35 0 -1 0 +36 1 -1 0 +37 2 -1 0 +38 3 -1 0 +39 4 -1 0 +40 5 -1 0 +41 -4 0 0 +42 -3 0 0 +43 -2 0 0 +44 -1 0 0 +45 0 0 0 +46 1 0 0 +47 2 0 0 +48 3 0 0 +49 4 0 0 +50 5 0 0 +51 -4 1 0 +52 -3 1 0 +53 -2 1 0 +54 -1 1 0 +55 0 1 0 +56 1 1 0 +57 2 1 0 +58 3 1 0 +59 4 1 0 +60 5 1 0 +61 -4 2 0 +62 -3 2 0 +63 -2 2 0 +64 -1 2 0 +65 0 2 0 +66 1 2 0 +67 2 2 0 +68 3 2 0 +69 4 2 0 +70 5 2 0 +71 -4 3 0 +72 -3 3 0 +73 -2 3 0 +74 -1 3 0 +75 0 3 0 +76 1 3 0 +77 2 3 0 +78 3 3 0 +79 4 3 0 +80 5 3 0 +81 -4 4 0 +82 -3 4 0 +83 -2 4 0 +84 -1 4 0 +85 0 4 0 +86 1 4 0 +87 2 4 0 +88 3 4 0 +89 4 4 0 +90 5 4 0 +91 -4 5 0 +92 -3 5 0 +93 -2 5 0 +94 -1 5 0 +95 0 5 0 +96 1 5 0 +97 2 5 0 +98 3 5 0 +99 4 5 0 +100 5 5 0 + +Types +#ID type +1 1 +2 1 +3 1 +4 1 +5 1 +6 1 +7 1 +8 1 +9 1 +10 1 +11 1 +12 1 +13 1 +14 1 +15 1 +16 1 +17 1 +18 1 +19 1 +20 1 +21 1 +22 1 +23 1 +24 1 +25 1 +26 1 +27 1 +28 1 +29 1 +30 1 +31 1 +32 1 +33 1 +34 1 +35 1 +36 1 +37 1 +38 1 +39 1 +40 1 +41 1 +42 1 +43 1 +44 1 +45 1 +46 1 +47 1 +48 1 +49 1 +50 1 +51 1 +52 1 +53 1 +54 1 +55 1 +56 1 +57 1 +58 1 +59 1 +60 1 +61 1 +62 1 +63 1 +64 1 +65 1 +66 1 +67 1 +68 1 +69 1 +70 1 +71 1 +72 1 +73 1 +74 1 +75 1 +76 1 +77 1 +78 1 +79 1 +80 1 +81 1 +82 1 +83 1 +84 1 +85 1 +86 1 +87 1 +88 1 +89 1 +90 1 +91 1 +92 1 +93 1 +94 1 +95 1 +96 1 +97 1 +98 1 +99 1 +100 1 + +Masses +#ID mass +1 1 +2 1 +3 1 +4 1 +5 1 +6 1 +7 1 +8 1 +9 1 +10 1 +11 1 +12 1 +13 1 +14 1 +15 1 +16 1 +17 1 +18 1 +19 1 +20 1 +21 1 +22 1 +23 1 +24 1 +25 1 +26 1 +27 1 +28 1 +29 1 +30 1 +31 1 +32 1 +33 1 +34 1 +35 1 +36 1 +37 1 +38 1 +39 1 +40 1 +41 1 +42 1 +43 1 +44 1 +45 1 +46 1 +47 1 +48 1 +49 1 +50 1 +51 1 +52 1 +53 1 +54 1 +55 1 +56 1 +57 1 +58 1 +59 1 +60 1 +61 1 +62 1 +63 1 +64 1 +65 1 +66 1 +67 1 +68 1 +69 1 +70 1 +71 1 +72 1 +73 1 +74 1 +75 1 +76 1 +77 1 +78 1 +79 1 +80 1 +81 1 +82 1 +83 1 +84 1 +85 1 +86 1 +87 1 +88 1 +89 1 +90 1 +91 1 +92 1 +93 1 +94 1 +95 1 +96 1 +97 1 +98 1 +99 1 +100 1 + +Bonds +#ID type atom1 atom2 +1 1 1 2 +2 1 1 11 +3 1 1 12 +4 1 2 3 +5 1 2 11 +6 1 2 12 +7 1 2 13 +8 1 3 4 +9 1 3 12 +10 1 3 13 +11 1 3 14 +12 1 4 5 +13 1 4 13 +14 1 4 14 +15 1 4 15 +16 1 5 6 +17 1 5 14 +18 1 5 15 +19 1 5 16 +20 1 6 7 +21 1 6 15 +22 1 6 16 +23 1 6 17 +24 1 7 8 +25 1 7 16 +26 1 7 17 +27 1 7 18 +28 1 8 9 +29 1 8 17 +30 1 8 18 +31 1 8 19 +32 1 9 10 +33 1 9 18 +34 1 9 19 +35 1 9 20 +36 1 10 19 +37 1 10 20 +38 1 11 21 +39 1 11 12 +40 1 11 22 +41 1 12 21 +42 1 12 13 +43 1 12 22 +44 1 12 23 +45 1 13 22 +46 1 13 23 +47 1 13 14 +48 1 13 24 +49 1 14 23 +50 1 14 24 +51 1 14 15 +52 1 14 25 +53 1 15 24 +54 1 15 16 +55 1 15 25 +56 1 15 26 +57 1 16 25 +58 1 16 26 +59 1 16 17 +60 1 16 27 +61 1 17 26 +62 1 17 18 +63 1 17 27 +64 1 17 28 +65 1 18 27 +66 1 18 28 +67 1 18 19 +68 1 18 29 +69 1 19 28 +70 1 19 29 +71 1 19 20 +72 1 19 30 +73 1 20 29 +74 1 20 30 +75 1 21 22 +76 1 21 31 +77 1 21 32 +78 1 22 23 +79 1 22 31 +80 1 22 32 +81 1 22 33 +82 1 23 24 +83 1 23 32 +84 1 23 33 +85 1 23 34 +86 1 24 25 +87 1 24 33 +88 1 24 34 +89 1 24 35 +90 1 25 26 +91 1 25 34 +92 1 25 35 +93 1 25 36 +94 1 26 27 +95 1 26 35 +96 1 26 36 +97 1 26 37 +98 1 27 28 +99 1 27 36 +100 1 27 37 +101 1 27 38 +102 1 28 29 +103 1 28 37 +104 1 28 38 +105 1 28 39 +106 1 29 30 +107 1 29 38 +108 1 29 39 +109 1 29 40 +110 1 30 39 +111 1 30 40 +112 1 31 32 +113 1 31 41 +114 1 31 42 +115 1 32 33 +116 1 32 41 +117 1 32 42 +118 1 32 43 +119 1 33 34 +120 1 33 42 +121 1 33 43 +122 1 33 44 +123 1 34 35 +124 1 34 43 +125 1 34 44 +126 1 34 45 +127 1 35 36 +128 1 35 44 +129 1 35 45 +130 1 35 46 +131 1 36 37 +132 1 36 45 +133 1 36 46 +134 1 36 47 +135 1 37 38 +136 1 37 46 +137 1 37 47 +138 1 37 48 +139 1 38 39 +140 1 38 47 +141 1 38 48 +142 1 38 49 +143 1 39 40 +144 1 39 48 +145 1 39 49 +146 1 39 50 +147 1 40 49 +148 1 40 50 +149 1 41 51 +150 1 41 42 +151 1 41 52 +152 1 42 51 +153 1 42 43 +154 1 42 52 +155 1 42 53 +156 1 43 52 +157 1 43 53 +158 1 43 44 +159 1 43 54 +160 1 44 53 +161 1 44 54 +162 1 44 45 +163 1 44 55 +164 1 45 54 +165 1 45 46 +166 1 45 55 +167 1 45 56 +168 1 46 55 +169 1 46 56 +170 1 46 47 +171 1 46 57 +172 1 47 56 +173 1 47 48 +174 1 47 57 +175 1 47 58 +176 1 48 57 +177 1 48 58 +178 1 48 49 +179 1 48 59 +180 1 49 58 +181 1 49 59 +182 1 49 50 +183 1 49 60 +184 1 50 59 +185 1 50 60 +186 1 51 52 +187 1 51 61 +188 1 51 62 +189 1 52 53 +190 1 52 61 +191 1 52 62 +192 1 52 63 +193 1 53 54 +194 1 53 62 +195 1 53 63 +196 1 53 64 +197 1 54 55 +198 1 54 63 +199 1 54 64 +200 1 54 65 +201 1 55 56 +202 1 55 64 +203 1 55 65 +204 1 55 66 +205 1 56 57 +206 1 56 65 +207 1 56 66 +208 1 56 67 +209 1 57 58 +210 1 57 66 +211 1 57 67 +212 1 57 68 +213 1 58 59 +214 1 58 67 +215 1 58 68 +216 1 58 69 +217 1 59 60 +218 1 59 68 +219 1 59 69 +220 1 59 70 +221 1 60 69 +222 1 60 70 +223 1 61 71 +224 1 61 62 +225 1 61 72 +226 1 62 71 +227 1 62 63 +228 1 62 72 +229 1 62 73 +230 1 63 72 +231 1 63 73 +232 1 63 64 +233 1 63 74 +234 1 64 73 +235 1 64 74 +236 1 64 65 +237 1 64 75 +238 1 65 74 +239 1 65 66 +240 1 65 75 +241 1 65 76 +242 1 66 75 +243 1 66 76 +244 1 66 67 +245 1 66 77 +246 1 67 76 +247 1 67 68 +248 1 67 77 +249 1 67 78 +250 1 68 77 +251 1 68 78 +252 1 68 69 +253 1 68 79 +254 1 69 78 +255 1 69 79 +256 1 69 70 +257 1 69 80 +258 1 70 79 +259 1 70 80 +260 1 71 72 +261 1 71 81 +262 1 71 82 +263 1 72 73 +264 1 72 81 +265 1 72 82 +266 1 72 83 +267 1 73 74 +268 1 73 82 +269 1 73 83 +270 1 73 84 +271 1 74 75 +272 1 74 83 +273 1 74 84 +274 1 74 85 +275 1 75 76 +276 1 75 84 +277 1 75 85 +278 1 75 86 +279 1 76 77 +280 1 76 85 +281 1 76 86 +282 1 76 87 +283 1 77 78 +284 1 77 86 +285 1 77 87 +286 1 77 88 +287 1 78 79 +288 1 78 87 +289 1 78 88 +290 1 78 89 +291 1 79 80 +292 1 79 88 +293 1 79 89 +294 1 79 90 +295 1 80 89 +296 1 80 90 +297 1 81 82 +298 1 81 91 +299 1 81 92 +300 1 82 83 +301 1 82 91 +302 1 82 92 +303 1 82 93 +304 1 83 84 +305 1 83 92 +306 1 83 93 +307 1 83 94 +308 1 84 85 +309 1 84 93 +310 1 84 94 +311 1 84 95 +312 1 85 86 +313 1 85 94 +314 1 85 95 +315 1 85 96 +316 1 86 87 +317 1 86 95 +318 1 86 96 +319 1 86 97 +320 1 87 88 +321 1 87 96 +322 1 87 97 +323 1 87 98 +324 1 88 89 +325 1 88 97 +326 1 88 98 +327 1 88 99 +328 1 89 90 +329 1 89 98 +330 1 89 99 +331 1 89 100 +332 1 90 99 +333 1 90 100 +334 1 91 92 +335 1 92 93 +336 1 93 94 +337 1 94 95 +338 1 95 96 +339 1 96 97 +340 1 97 98 +341 1 98 99 +342 1 99 100 diff --git a/examples/rheo/oxidation/in.rheo.oxidation b/examples/rheo/oxidation/in.rheo.oxidation new file mode 100644 index 0000000000..5c1456ad5a --- /dev/null +++ b/examples/rheo/oxidation/in.rheo.oxidation @@ -0,0 +1,102 @@ +# ------ 2D oxidizing bar ------ # + +dimension 2 +units lj +atom_style hybrid rheo/thermal bond +boundary m m p +comm_modify vel yes +newton off + +region box block -60 60 0 80 -0.01 0.01 units box +create_box 3 box bond/types 2 extra/bond/per/atom 20 extra/special/per/atom 50 + + +region lbar block -15 0 3 80 EDGE EDGE units box +region rbar block 0 15 3 80 EDGE EDGE units box +region bar union 2 lbar rbar +region floor block EDGE EDGE EDGE 3.0 EDGE EDGE units box + +lattice hex 1.0 +create_atoms 1 region bar +create_atoms 3 region floor + +set region rbar type 2 +group bar type 1 2 +group rbar type 2 +group floor type 3 + +set group all sph/e 0.0 +set group all rheo/status 1 + +# ------ Model parameters ------# + +variable cut equal 3.0 +variable n equal 1.0 +variable rho0 equal 1.0 +variable cs equal 1.0 +variable mp equal ${rho0}/${n} +variable zeta equal 0.05 +variable kappa equal 0.1*${rho0}/${mp} +variable dt_max equal 0.1*${cut}/${cs}/3 +variable eta equal 0.05 +variable Cv equal 1.0 +variable L equal 0.1 +variable Tf equal 1.0 + +mass * ${mp} +timestep 0.1 + +pair_style hybrid/overlay rheo ${cut} artificial/visc ${zeta} rheo/solid +pair_coeff * * rheo +pair_coeff * * rheo/solid 1.0 1.0 1.0 + +special_bonds lj 0.0 1.0 1.0 coul 0.0 1.0 1.0 +create_bonds many bar bar 1 0 1.5 +special_bonds lj 0.0 1.0 1.0 coul 1.0 1.0 1.0 + +bond_style hybrid bpm/spring rheo/shell t/form 100 +bond_coeff 1 bpm/spring 1.0 1.0 1.0 +bond_coeff 2 rheo/shell 0.2 0.2 0.1 + +# ------ Apply dynamics ------# + +# Note: surface detection is not performed on solid bodies, so cannot use surface property +compute coord all rheo/property/atom coordination +variable surf atom c_coord<22 +group surf dynamic all var surf every 10 + +fix 1 all rheo ${cut} quintic 0 & + thermal & + shift & + surface/detection coordination 22 8 +fix 2 all rheo/viscosity * constant ${eta} +fix 3 all rheo/pressure * linear +fix 4 all rheo/thermal conductivity * constant ${kappa} & + specific/heat * constant ${Cv} & + Tfreeze * constant ${Tf} & + latent/heat * constant ${L} & + react 1.5 1 + +fix 5 rbar rheo/oxidation 1.5 2 1.0 +fix 6 all wall/harmonic ylo EDGE 2.0 1.0 1.0 +fix 7 all gravity 5e-5 vector 0 -1 0 +fix 8 floor setforce 0.0 0.0 0.0 +fix 9 surf add/heat linear 1.1 0.05 +fix 10 floor add/heat constant 0 overwrite yes # fix the temperature of the floor + +compute surf all rheo/property/atom surface +compute rho all rheo/property/atom rho +compute phase all rheo/property/atom phase +compute status all rheo/property/atom status +compute temp all rheo/property/atom temperature +compute eng all rheo/property/atom energy +compute nbond_shell all rheo/property/atom nbond/shell +compute nbond_solid all nbond/atom bond/type 1 + +# ------ Output & Run ------ # + +thermo 200 +thermo_style custom step time ke press atoms + +dump 1 all custom 200 atomDump id type x y vx vy fx fy c_phase c_temp c_eng c_nbond_solid c_nbond_shell c_rho c_surf c_status +run 40000 diff --git a/examples/PACKAGES/rheo/poiseuille/in.rheo.poiseuille b/examples/rheo/poiseuille/in.rheo.poiseuille similarity index 55% rename from examples/PACKAGES/rheo/poiseuille/in.rheo.poiseuille rename to examples/rheo/poiseuille/in.rheo.poiseuille index 6f5ad91e73..ee8ad5523c 100644 --- a/examples/PACKAGES/rheo/poiseuille/in.rheo.poiseuille +++ b/examples/rheo/poiseuille/in.rheo.poiseuille @@ -9,28 +9,23 @@ comm_modify vel yes # ------ Create simulation box ------ # -variable sf equal 0.2 -variable n equal 1.0/(${sf}^2) -variable cut equal 3.5*${sf} +variable n equal 1.0 +variable cut equal 3.0 -region box block 0 20 -10 10 -0.01 0.01 units box +region box block 0 20 -10 10 -0.01 0.01 create_box 2 box lattice sq ${n} -region topwall block INF INF 7 10 INF INF units box -region block block INF INF -6.99 6.99 INF INF units box -region botwall block INF INF -10 -7 INF INF units box +region inner block INF INF -7.5 7.5 INF INF units box +region walls block INF INF -7.5 7.5 INF INF units box side out -create_atoms 2 region topwall -create_atoms 2 region botwall -create_atoms 1 region block +create_atoms 2 region walls +create_atoms 1 region inner group fluid type 1 group rig type 2 -variable dr equal 0.1*${sf} -displace_atoms fluid random $(0.1*v_sf) ${dr} 0 135414 units box - +displace_atoms fluid random 0.1 0.1 0 135414 units box # ------ Model parameters ------ # @@ -39,15 +34,19 @@ variable cs equal 1.0 variable mp equal ${rho0}/${n} variable zeta equal 1.0 variable kappa equal 1.0*${rho0}/${mp} -variable fext equal 1e-3/${n} -variable eta equal 0.1 +variable fext equal 1e-4/${n} variable dt_max equal 0.1*${cut}/${cs}/3 variable Dr equal 0.05*${cut}*${cs} +variable eta equal 0.1 +variable gd0 equal 5e-4 +variable npow equal 0.5 +variable K equal 0.001 + mass * ${mp} set group all rheo/rho ${rho0} set group all rheo/status 0 -set group rig rheo/status 2 +set group rig rheo/status 1 timestep ${dt_max} @@ -58,12 +57,13 @@ pair_coeff * * # ------ Fixes & computes ------ # fix 1 all rheo ${cut} quintic 0 shift -fix 2 all rheo/viscosity constant ${eta} -fix 3 all rheo/pressure linear +fix 2 all rheo/viscosity * constant ${eta} +#fix 2 all rheo/viscosity * power ${eta} ${gd0} ${K} ${npow} +fix 3 all rheo/pressure * linear fix 4 rig setforce 0.0 0.0 0.0 fix 5 fluid addforce ${fext} 0.0 0.0 -compute 1 all rheo/property/atom rho phase +compute rho all rheo/property/atom rho # ------ Output & Run ------ # @@ -71,11 +71,7 @@ compute 1 all rheo/property/atom rho phase thermo 200 thermo_style custom step time ke press -variable skin equal 0.2*${cut} -neighbor ${skin} bin -neigh_modify one 5000 - -#dump 1 all custom 200 atomDump id type x y vx vy fx fy c_1[*] +dump 1 all custom 200 atomDump id type x y vx vy fx fy c_rho run 20000 diff --git a/examples/PACKAGES/rheo/taylor-green/in.rheo.taylor.green b/examples/rheo/taylor-green/in.rheo.taylor.green similarity index 68% rename from examples/PACKAGES/rheo/taylor-green/in.rheo.taylor.green rename to examples/rheo/taylor-green/in.rheo.taylor.green index 5367ceef13..e386d8262c 100644 --- a/examples/PACKAGES/rheo/taylor-green/in.rheo.taylor.green +++ b/examples/rheo/taylor-green/in.rheo.taylor.green @@ -10,19 +10,16 @@ newton off # ------ Create simulation box ------ # -variable sf equal 0.1 -variable n equal 1.0/(${sf}^2) -variable cut equal 3.5*${sf} +variable n equal 1.0 +variable cut equal 3.0 -region box block 0 10 0 10 -0.01 0.01 units box +region box block 0 40 0 40 -0.01 0.01 create_box 1 box lattice sq ${n} create_atoms 1 region box -variable dr equal 0.1*${sf} -displace_atoms all random ${dr} ${dr} 0 135414 units box - +displace_atoms all random 0.1 0.1 0 135414 units box # ------ Model parameters ------ # @@ -53,22 +50,17 @@ pair_coeff * * # ------ Fixes & computes ------ # -fix 1 all rheo ${cut} quintic 0 shift -fix 2 all rheo/viscosity constant ${eta} -fix 3 all rheo/pressure linear - -compute 1 all rheo/property/atom rho phase +fix 1 all rheo ${cut} RK1 8 shift +fix 2 all rheo/viscosity * constant ${eta} +fix 3 all rheo/pressure * linear +compute rho all rheo/property/atom rho # ------ Output & Run ------ # thermo 200 thermo_style custom step time ke press -variable skin equal 0.2*${cut} -neighbor ${skin} bin -neigh_modify one 10000 #increase number of allowed neighbors - -#dump 1 all custom 200 atomDump id type x y vx vy fx fy c_1[*] +#dump 1 all custom 200 atomDump id type x y vx vy fx fy c_rho run 10000 \ No newline at end of file diff --git a/src/GRANULAR/fix_add_heat.cpp b/src/GRANULAR/fix_add_heat.cpp index 7109ffb01c..a68c9c2b95 100644 --- a/src/GRANULAR/fix_add_heat.cpp +++ b/src/GRANULAR/fix_add_heat.cpp @@ -68,7 +68,7 @@ FixAddHeat::FixAddHeat(LAMMPS *lmp, int narg, char **arg) : while (iarg < narg) { if (strcmp(arg[iarg], "overwrite") == 0) { if (iarg + 1 >= narg) utils::missing_cmd_args(FLERR, "fix add/heat", error); - overwrite_flag = utils::bnumeric(FLERR, arg[iarg + 1], false, lmp); + overwrite_flag = utils::logical(FLERR, arg[iarg + 1], false, lmp); iarg += 2; } else { error->all(FLERR, "Illegal fix add/heat command, invalid argument {}", arg[iarg]); diff --git a/src/RHEO/bond_rheo_shell.cpp b/src/RHEO/bond_rheo_shell.cpp index 6b464c4000..c8eee29438 100644 --- a/src/RHEO/bond_rheo_shell.cpp +++ b/src/RHEO/bond_rheo_shell.cpp @@ -227,7 +227,6 @@ void BondRHEOShell::compute(int eflag, int vflag) if (t < EPSILON || std::isnan(t)) t = store_bond(n, i1, i2); - delx = x[i1][0] - x[i2][0]; dely = x[i1][1] - x[i2][1]; delz = x[i1][2] - x[i2][2]; diff --git a/src/RHEO/compute_rheo_grad.cpp b/src/RHEO/compute_rheo_grad.cpp index 5ed43a421a..8b618e6e04 100644 --- a/src/RHEO/compute_rheo_grad.cpp +++ b/src/RHEO/compute_rheo_grad.cpp @@ -213,12 +213,10 @@ void ComputeRHEOGrad::compute_peratom() // Add corrections for walls if (interface_flag) { if (fluidi && (!fluidj)) { - compute_interface->correct_v(vi, vj, i, j); - //compute_interface->correct_v(vj, vi, j, i); + compute_interface->correct_v(vj, vi, j, i); rhoj = compute_interface->correct_rho(j, i); } else if ((!fluidi) && fluidj) { - compute_interface->correct_v(vj, vi, j, i); - //compute_interface->correct_v(vi, vj, i, j); + compute_interface->correct_v(vi, vj, i, j); rhoi = compute_interface->correct_rho(i, j); } else if ((!fluidi) && (!fluidj)) { rhoi = rho0[itype]; @@ -346,7 +344,7 @@ int ComputeRHEOGrad::pack_forward_comm(int n, int *list, double *buf, } else if (comm_stage == COMMFIELD) { if (velocity_flag) { - if (remap_v_flag & pbc_flag & (mask[j] & deform_groupbit)) { + if (remap_v_flag && pbc_flag && (mask[j] & deform_groupbit)) { for (k = 0; k < dim; k++) buf[m++] = v[j][k] + dv[k]; } else { diff --git a/src/RHEO/compute_rheo_interface.cpp b/src/RHEO/compute_rheo_interface.cpp index 31930d655d..672c63ba29 100644 --- a/src/RHEO/compute_rheo_interface.cpp +++ b/src/RHEO/compute_rheo_interface.cpp @@ -165,11 +165,11 @@ void ComputeRHEOInterface::compute_peratom() fluidj = !(status[j] & PHASECHECK); w = compute_kernel->calc_w_quintic(i, j, dx[0], dx[1], dx[2], sqrt(rsq)); - status_match = 0; norm[i] += w; + + status_match = 0; if ((fluidi && fluidj) || ((!fluidi) && (!fluidj))) status_match = 1; - if (status_match) { chi[i] += w; } else { @@ -307,30 +307,26 @@ void ComputeRHEOInterface::unpack_reverse_comm(int n, int *list, double *buf) /* ---------------------------------------------------------------------- */ -void ComputeRHEOInterface::correct_v(double *vi, double *vj, int i, int j) +void ComputeRHEOInterface::correct_v(double *v_solid, double *v_fluid, int i_solid, int i_fluid) { double wall_prefactor, wall_denom, wall_numer; - wall_numer = 2.0 * cut * (chi[i] - 0.5); - if (wall_numer < 0) wall_numer = 0; - wall_denom = 2.0 * cut * (chi[j] - 0.5); - if (wall_denom < wall_max) wall_denom = wall_max; + wall_numer = MAX(2.0 * cut * (chi[i_solid] - 0.5), 0.0); + wall_denom = MAX(2.0 * cut * (chi[i_fluid] - 0.5), wall_max); wall_prefactor = wall_numer / wall_denom; - vi[0] = (vi[0] - vj[0]) * wall_prefactor + vi[0]; - vi[1] = (vi[1] - vj[1]) * wall_prefactor + vi[1]; - vi[2] = (vi[2] - vj[2]) * wall_prefactor + vi[2]; + v_solid[0] = (v_solid[0] - v_fluid[0]) * wall_prefactor; + v_solid[1] = (v_solid[1] - v_fluid[1]) * wall_prefactor; + v_solid[2] = (v_solid[2] - v_fluid[2]) * wall_prefactor; } /* ---------------------------------------------------------------------- */ -double ComputeRHEOInterface::correct_rho(int i, int j) +double ComputeRHEOInterface::correct_rho(int i_solid, int i_fluid) { - // i is wall, j is fluid - //In future may depend on atom type j's pressure equation - int itype = atom->type[i]; - return MAX(rho0[itype], atom->rho[i]); + int itype = atom->type[i_solid]; + return MAX(rho0[itype], atom->rho[i_solid]); } /* ---------------------------------------------------------------------- */ diff --git a/src/RHEO/compute_rheo_property_atom.cpp b/src/RHEO/compute_rheo_property_atom.cpp index 11b03623b1..d6d8c2a07a 100644 --- a/src/RHEO/compute_rheo_property_atom.cpp +++ b/src/RHEO/compute_rheo_property_atom.cpp @@ -292,9 +292,14 @@ void ComputeRHEOPropertyAtom::pack_surface(int n) int *mask = atom->mask; int nlocal = atom->nlocal; + double label; for (int i = 0; i < nlocal; i++) { - if (mask[i] & groupbit) buf[n] = (status[i] & SURFACECHECK); - else buf[n] = 0.0; + label = 0; + if (mask[i] & groupbit) { + if (status[i] & STATUS_SURFACE) label = 1.0; + if (status[i] & STATUS_SPLASH) label = 2.0; + } + buf[n] = label; n += nvalues; } } diff --git a/src/RHEO/compute_rheo_surface.cpp b/src/RHEO/compute_rheo_surface.cpp index 1ef69bb6f0..bf2f2a3297 100644 --- a/src/RHEO/compute_rheo_surface.cpp +++ b/src/RHEO/compute_rheo_surface.cpp @@ -50,23 +50,18 @@ ComputeRHEOSurface::ComputeRHEOSurface(LAMMPS *lmp, int narg, char **arg) : int dim = domain->dimension; comm_forward = 2; comm_reverse = dim * dim + 1; + + nmax_store = 0; + grow_arrays(atom->nmax); } /* ---------------------------------------------------------------------- */ ComputeRHEOSurface::~ComputeRHEOSurface() { - // Remove custom property if it exists - int tmp1, tmp2, index; - index = atom->find_custom("rheo_divr", tmp1, tmp2); - if (index != -1) atom->remove_custom(index, 1, 0); - - index = atom->find_custom("rheo_rsurface", tmp1, tmp2); - if (index != -1) atom->remove_custom(index, 1, 0); - - index = atom->find_custom("rheo_nsurface", tmp1, tmp2); - if (index != -1) atom->remove_custom(index, 1, 3); - + memory->destroy(divr); + memory->destroy(rsurface); + memory->destroy(nsurface); memory->destroy(B); memory->destroy(gradC); } @@ -87,29 +82,6 @@ void ComputeRHEOSurface::init() cutsq = cut * cut; - // Create rsurface, divr, nsurface arrays as custom atom properties, - // can print with compute property/atom - // no grow callback as there's no reason to copy/exchange data, manually grow - // For B and gradC, create a local array since they are unlikely to be printed - - int dim = domain->dimension; - int tmp1, tmp2; - index_divr = atom->find_custom("rheo_divr", tmp1, tmp2); - if (index_divr == -1) index_divr = atom->add_custom("rheo_divr", 1, 0); - divr = atom->dvector[index_divr]; - - index_rsurf = atom->find_custom("rheo_rsurface", tmp1, tmp2); - if (index_rsurf == -1) index_rsurf = atom->add_custom("rheo_rsurface", 1, 0); - rsurface = atom->dvector[index_rsurf]; - - index_nsurf = atom->find_custom("rheo_nsurface", tmp1, tmp2); - if (index_nsurf == -1) index_nsurf = atom->add_custom("rheo_nsurface", 1, dim); - nsurface = atom->darray[index_nsurf]; - - nmax_store = atom->nmax; - memory->create(B, nmax_store, dim * dim, "rheo/surface:B"); - memory->create(gradC, nmax_store, dim * dim, "rheo/surface:gradC"); - // need an occasional half neighbor list neighbor->add_request(this, NeighConst::REQ_DEFAULT); } @@ -148,7 +120,7 @@ void ComputeRHEOSurface::compute_peratom() firstneigh = list->firstneigh; // Grow and zero arrays - if (nmax_store <= atom->nmax) + if (nmax_store < atom->nmax) grow_arrays(atom->nmax); size_t nbytes = nmax_store * sizeof(double); @@ -253,6 +225,10 @@ void ComputeRHEOSurface::compute_peratom() else test = coordination[i] < threshold_z; + // Treat nonfluid particles as bulk + if (status[i] & PHASECHECK) + test = 0; + if (test) { if (coordination[i] < threshold_splash) status[i] |= STATUS_SPLASH; @@ -272,6 +248,7 @@ void ComputeRHEOSurface::compute_peratom() xtmp = x[i][0]; ytmp = x[i][1]; ztmp = x[i][2]; + fluidi = !(status[i] & PHASECHECK); jlist = firstneigh[i]; jnum = numneigh[i]; @@ -280,22 +257,25 @@ void ComputeRHEOSurface::compute_peratom() j = jlist[jj]; j &= NEIGHMASK; + fluidj = !(status[j] & PHASECHECK); + dx[0] = xtmp - x[j][0]; dx[1] = ytmp - x[j][1]; dx[2] = ztmp - x[j][2]; rsq = lensq3(dx); if (rsq < cutsq) { - if ((status[i] & STATUS_BULK) && (status[j] & STATUS_SURFACE)) { - status[i] &= SURFACEMASK; - status[i] |= STATUS_LAYER; + if (fluidi) { + if ((status[i] & STATUS_BULK) && (status[j] & STATUS_SURFACE)) { + status[i] &= SURFACEMASK; + status[i] |= STATUS_LAYER; + } + + if (status[j] & STATUS_SURFACE) + rsurface[i] = MIN(rsurface[i], sqrt(rsq)); } - if (status[j] & STATUS_SURFACE) - rsurface[i] = MIN(rsurface[i], sqrt(rsq)); - - - if (j < nlocal || newton) { - if ((status[j] & STATUS_BULK) && (status[i] & STATUS_SURFACE)) { + if (fluidj && (j < nlocal || newton)) { + if ((status[j] & STATUS_BULK) && (status[j] & PHASECHECK) && (status[i] & STATUS_SURFACE)) { status[j] &= SURFACEMASK; status[j] |= STATUS_LAYER; } @@ -307,6 +287,16 @@ void ComputeRHEOSurface::compute_peratom() } } + // clear normal vectors for non surface particles + + for (i = 0; i < nall; i++) { + if (mask[i] & groupbit) { + if (!(status[i] & STATUS_SURFACE)) + for (a = 0; a < dim; a++) + nsurface[i][a] = 0.0; + } + } + // forward/reverse status and rsurface comm_stage = 1; comm_reverse = 2; @@ -416,18 +406,11 @@ void ComputeRHEOSurface::grow_arrays(int nmax) { int dim = domain->dimension; - // Grow atom variables and reassign pointers - memory->grow(atom->dvector[index_divr], nmax, "atom:rheo_divr"); - memory->grow(atom->dvector[index_rsurf], nmax, "atom:rheo_rsurface"); - memory->grow(atom->darray[index_nsurf], nmax, dim, "atom:rheo_nsurface"); - - divr = atom->dvector[index_divr]; - rsurface = atom->dvector[index_rsurf]; - nsurface = atom->darray[index_nsurf]; - - // Grow local variables + memory->grow(divr, nmax, "rheo/surface:divr"); + memory->grow(rsurface, nmax, "rheo/surface:rsurface"); + memory->grow(nsurface, nmax, dim, "rheo/surface:nsurface"); memory->grow(B, nmax, dim * dim, "rheo/surface:B"); memory->grow(gradC, nmax, dim * dim, "rheo/surface:gradC"); - nmax_store = atom->nmax; + nmax_store = nmax; } diff --git a/src/RHEO/compute_rheo_surface.h b/src/RHEO/compute_rheo_surface.h index 6ef2428499..044ff470c6 100644 --- a/src/RHEO/compute_rheo_surface.h +++ b/src/RHEO/compute_rheo_surface.h @@ -42,7 +42,6 @@ class ComputeRHEOSurface : public Compute { private: int surface_style, nmax_store, threshold_z, threshold_splash, interface_flag; int threshold_style, comm_stage; - int index_divr, index_rsurf, index_nsurf; double cut, cutsq, *rho0, threshold_divr; double **B, **gradC; diff --git a/src/RHEO/compute_rheo_vshift.cpp b/src/RHEO/compute_rheo_vshift.cpp index 533287911a..6e858ca207 100644 --- a/src/RHEO/compute_rheo_vshift.cpp +++ b/src/RHEO/compute_rheo_vshift.cpp @@ -72,6 +72,7 @@ void ComputeRHEOVShift::init() compute_interface = fix_rheo->compute_interface; compute_surface = fix_rheo->compute_surface; + rho0 = fix_rheo->rho0; cut = fix_rheo->cut; cutsq = cut * cut; cutthird = cut / 3.0; @@ -174,16 +175,14 @@ void ComputeRHEOVShift::compute_peratom() // Add corrections for walls if (interface_flag) { if (fluidi && (!fluidj)) { - compute_interface->correct_v(vi, vj, i, j); - //compute_interface->correct_v(vj, vi, j, i); - rhoj = compute_interface->correct_rho(j,i); - } else if ((!fluidi) && fluidj) { compute_interface->correct_v(vj, vi, j, i); - //compute_interface->correct_v(vi, vj, i, j); - rhoi = compute_interface->correct_rho(i,j); + rhoj = compute_interface->correct_rho(j, i); + } else if ((!fluidi) && fluidj) { + compute_interface->correct_v(vi, vj, i, j); + rhoi = compute_interface->correct_rho(i, j); } else if ((!fluidi) && (!fluidj)) { - rhoi = 1.0; - rhoj = 1.0; + rhoi = rho0[itype]; + rhoj = rho0[jtype]; } } @@ -196,7 +195,7 @@ void ComputeRHEOVShift::compute_peratom() w4 = w * w * w * w / (w0 * w0 * w0 * w0); dr = -2 * cutthird * (1 + 0.2 * w4) * wp * rinv; - if (mask[i] & groupbit) { + if ((mask[i] & groupbit) && fluidi) { vmag = sqrt(vi[0] * vi[0] + vi[1] * vi[1] + vi[2] * vi[2]); prefactor = vmag * volj * dr; @@ -206,7 +205,7 @@ void ComputeRHEOVShift::compute_peratom() } if (newton_pair || j < nlocal) { - if (mask[j] & groupbit) { + if ((mask[j] & groupbit) && fluidj) { vmag = sqrt(vj[0] * vj[0] + vj[1] * vj[1] + vj[2] * vj[2]); prefactor = vmag * voli * dr; @@ -241,7 +240,11 @@ void ComputeRHEOVShift::correct_surfaces() double nx, ny, nz, vx, vy, vz, dot; for (i = 0; i < nlocal; i++) { if (mask[i] & groupbit) { - if ((status[i] & STATUS_SURFACE) || (status[i] & STATUS_LAYER)) { + + if (status[i] & PHASECHECK) continue; + + //if ((status[i] & STATUS_SURFACE) || (status[i] & STATUS_LAYER)) { + if (status[i] & STATUS_SURFACE) { nx = nsurface[i][0]; ny = nsurface[i][1]; vx = vshift[i][0]; @@ -266,6 +269,10 @@ void ComputeRHEOVShift::correct_surfaces() } else { vshift[i][2] = 0.0; } + } else if (status[i] & STATUS_SPLASH) { + vshift[i][0] = 0.0; + vshift[i][1] = 0.0; + vshift[i][2] = 0.0; } } } diff --git a/src/RHEO/compute_rheo_vshift.h b/src/RHEO/compute_rheo_vshift.h index 9d3a0166d6..485c6525f3 100644 --- a/src/RHEO/compute_rheo_vshift.h +++ b/src/RHEO/compute_rheo_vshift.h @@ -43,6 +43,7 @@ class ComputeRHEOVShift : public Compute { int nmax_store; double dtv, cut, cutsq, cutthird; int surface_flag, interface_flag; + double *rho0; class NeighList *list; class ComputeRHEOInterface *compute_interface; diff --git a/src/RHEO/fix_rheo.cpp b/src/RHEO/fix_rheo.cpp index a355aee5d8..cb2abfb938 100644 --- a/src/RHEO/fix_rheo.cpp +++ b/src/RHEO/fix_rheo.cpp @@ -125,7 +125,7 @@ FixRHEO::FixRHEO(LAMMPS *lmp, int narg, char **arg) : interface_flag = 1; } else if (strcmp(arg[iarg], "rho/sum") == 0) { rhosum_flag = 1; - } else if (strcmp(arg[iarg], "self/mass")) { + } else if (strcmp(arg[iarg], "self/mass") == 0) { self_mass_flag = 1; } else if (strcmp(arg[iarg], "density") == 0) { if (iarg + n >= narg) error->all(FLERR, "Illegal rho0 option in fix rheo"); @@ -145,7 +145,7 @@ FixRHEO::FixRHEO(LAMMPS *lmp, int narg, char **arg) : iarg += 1; } - if (self_mass_flag && !rhosum_flag) + if (self_mass_flag && (!rhosum_flag)) error->all(FLERR, "Cannot use self/mass setting without rho/sum"); if (lmp->citeme) lmp->citeme->add(cite_rheo); @@ -227,6 +227,26 @@ void FixRHEO::init() if (modify->get_fix_by_style("^rheo$").size() > 1) error->all(FLERR, "Can only specify one instance of fix rheo"); + + if (atom->status_flag != 1) + error->all(FLERR,"fix rheo command requires atom property status"); + if (atom->rho_flag != 1) + error->all(FLERR,"fix rheo command requires atom property rho"); + if (atom->pressure_flag != 1) + error->all(FLERR,"fix rheo command requires atom property pressure"); + if (atom->viscosity_flag != 1) + error->all(FLERR,"fix rheo command requires atom property viscosity"); + + if (thermal_flag) { + if (atom->esph_flag != 1) + error->all(FLERR,"fix rheo command requires atom property esph with thermal setting"); + if (atom->temperature_flag != 1) + error->all(FLERR,"fix rheo command requires atom property temperature with thermal setting"); + if (atom->heatflow_flag != 1) + error->all(FLERR,"fix rheo command requires atom property heatflow with thermal setting"); + if (atom->conductivity_flag != 1) + error->all(FLERR,"fix rheo command requires atom property conductivity with thermal setting"); + } } /* ---------------------------------------------------------------------- */ @@ -386,6 +406,7 @@ void FixRHEO::initial_integrate(int /*vflag*/) for (i = 0; i < nlocal; i++) { if (status[i] & STATUS_NO_SHIFT) continue; + if (status[i] & PHASECHECK) continue; if (mask[i] & groupbit) { for (a = 0; a < dim; a++) { diff --git a/src/RHEO/fix_rheo.h b/src/RHEO/fix_rheo.h index 89a0591824..0af9fa8d01 100644 --- a/src/RHEO/fix_rheo.h +++ b/src/RHEO/fix_rheo.h @@ -79,7 +79,7 @@ namespace RHEO_NS { enum Status{ // Phase status STATUS_SOLID = 1 << 0, - // STATUS_REACTIVE = 1 << 1, + // Gap for future phase: STATUS_ = 1 << 1, // Surface status STATUS_BULK = 1 << 2, diff --git a/src/RHEO/fix_rheo_oxidation.cpp b/src/RHEO/fix_rheo_oxidation.cpp index 9f19d4f4da..5b0a50b4a5 100644 --- a/src/RHEO/fix_rheo_oxidation.cpp +++ b/src/RHEO/fix_rheo_oxidation.cpp @@ -30,6 +30,7 @@ #include "neighbor.h" #include "neigh_list.h" #include "neigh_request.h" +#include "update.h" using namespace LAMMPS_NS; using namespace RHEO_NS; @@ -55,6 +56,8 @@ FixRHEOOxidation::FixRHEOOxidation(LAMMPS *lmp, int narg, char **arg) : { if (narg != 6) error->all(FLERR,"Illegal fix command"); + force_reneighbor = 1; + next_reneighbor = -1; comm_forward = 3; cut = utils::numeric(FLERR, arg[3], false, lmp); @@ -82,8 +85,9 @@ FixRHEOOxidation::~FixRHEOOxidation() int FixRHEOOxidation::setmask() { int mask = 0; - mask |= PRE_FORCE; mask |= POST_INTEGRATE; + mask |= PRE_FORCE; + mask |= POST_FORCE; return mask; } @@ -133,25 +137,19 @@ void FixRHEOOxidation::setup_pre_force(int /*vflag*/) if (!fix_rheo->surface_flag) error->all(FLERR, "fix rheo/oxidation requires surface calculation in fix rheo"); compute_surface = fix_rheo->compute_surface; - - pre_force(0); } /* ---------------------------------------------------------------------- */ void FixRHEOOxidation::pre_force(int /*vflag*/) { - int *status = atom->status; - for (int i = 0; i < atom->nlocal; i++) - if (num_bond[i] != 0) - status[i] |= STATUS_NO_SHIFT; } /* ---------------------------------------------------------------------- */ void FixRHEOOxidation::post_integrate() { - int i, j, n, ii, jj, inum, jnum, bflag; + int i, j, n, ii, jj, inum, jnum, bflag, fluidi, fluidj; int *ilist, *jlist, *numneigh, **firstneigh; double delx, dely, delz, rsq; tagint tagi, tagj; @@ -163,6 +161,8 @@ void FixRHEOOxidation::post_integrate() tagint **bond_atom = atom->bond_atom; int **bond_type = atom->bond_type; int *num_bond = atom->num_bond; + int *mask = atom->mask; + int *status = atom->status; double *rsurface = compute_surface->rsurface; double **x = atom->x; @@ -175,10 +175,15 @@ void FixRHEOOxidation::post_integrate() // Note: surface designation lags one timestep, acceptable error comm->forward_comm(this); + int added_bonds = 0; // loop over neighbors of my atoms for (ii = 0; ii < inum; ii++) { i = ilist[ii]; - if (rsurface[i] > rsurf) continue; + if (!(mask[i] & groupbit)) continue; + + // Exclude particles that aren't solid or surface + fluidi = !(status[i] & PHASECHECK); + if (fluidi && (rsurface[i] > rsurf)) continue; tagi = tag[i]; @@ -188,8 +193,13 @@ void FixRHEOOxidation::post_integrate() for (jj = 0; jj < jnum; jj++) { j = jlist[jj]; j &= NEIGHMASK; + if (!(mask[j] & groupbit)) continue; - if (rsurface[j] > rsurf) continue; + fluidj = !(status[j] & PHASECHECK); + if (fluidj && (rsurface[j] > rsurf)) continue; + + // Skip solid-solid, leaves surface-surface or surface-solid + if ((!fluidi) && (!fluidj)) continue; tagj = tag[j]; @@ -218,6 +228,8 @@ void FixRHEOOxidation::post_integrate() } if (bflag) continue; + added_bonds += 1; + // Add bonds to owned atoms // If newton bond off, add to both, otherwise add to whichever has a smaller tag @@ -230,6 +242,23 @@ void FixRHEOOxidation::post_integrate() } } } + + int added_bonds_all; + MPI_Allreduce(&added_bonds, &added_bonds_all, 1, MPI_INT, MPI_SUM, world); + + if (added_bonds_all > 0) + next_reneighbor = update->ntimestep; +} + +/* ---------------------------------------------------------------------- */ + +void FixRHEOOxidation::post_force(int /*vflag*/) +{ + int *status = atom->status; + int *num_bond = atom->num_bond; + for (int i = 0; i < atom->nlocal; i++) + if (num_bond[i] != 0) + status[i] |= STATUS_NO_SHIFT; } /* ---------------------------------------------------------------------- */ diff --git a/src/RHEO/fix_rheo_oxidation.h b/src/RHEO/fix_rheo_oxidation.h index 5991a830c0..6dddea867a 100644 --- a/src/RHEO/fix_rheo_oxidation.h +++ b/src/RHEO/fix_rheo_oxidation.h @@ -34,8 +34,9 @@ class FixRHEOOxidation : public Fix { void init() override; void init_list(int, class NeighList *) override; void setup_pre_force(int) override; - void pre_force(int) override; void post_integrate() override; + void pre_force(int) override; + void post_force(int) override; int pack_forward_comm(int, int *, double *, int, int *) override; void unpack_forward_comm(int, int, double *) override; int *nbond; diff --git a/src/RHEO/fix_rheo_thermal.cpp b/src/RHEO/fix_rheo_thermal.cpp index 24a6a73021..321fee07e7 100644 --- a/src/RHEO/fix_rheo_thermal.cpp +++ b/src/RHEO/fix_rheo_thermal.cpp @@ -259,7 +259,8 @@ void FixRHEOThermal::init() compute_grad = fix_rheo->compute_grad; compute_vshift = fix_rheo->compute_vshift; - dtf = 0.5 * update->dt * force->ftm2v; + dt = update->dt; + dth = 0.5 * update->dt; if (atom->esph_flag != 1) error->all(FLERR,"fix rheo/thermal command requires atom property esph"); @@ -337,7 +338,7 @@ void FixRHEOThermal::initial_integrate(int /*vflag*/) for (i = 0; i < nlocal; i++) { if (status[i] & STATUS_NO_SHIFT) continue; for (a = 0; a < dim; a++) - energy[i] += dtv * vshift[i][a] * grade[i][a]; + energy[i] += dt * vshift[i][a] * grade[i][a]; } } @@ -363,7 +364,7 @@ void FixRHEOThermal::post_integrate() itype = type[i]; cvi = calc_cv(i, itype); - energy[i] += dtf * heatflow[i]; + energy[i] += dth * heatflow[i]; temperature[i] = energy[i] / cvi; if (Tc_style[itype] != NONE) { @@ -376,6 +377,8 @@ void FixRHEOThermal::post_integrate() temperature[i] = Ti; } + // Check phase change if Ti != Tci + if (Ti > Tci) { // If solid, melt if (status[i] & STATUS_SOLID) { @@ -383,7 +386,9 @@ void FixRHEOThermal::post_integrate() status[i] |= STATUS_MELTING; n_melt += 1; } - } else { + } + + if (Ti < Tci) { // If fluid, freeze if (!(status[i] & STATUS_SOLID)) { status[i] &= PHASEMASK; @@ -400,6 +405,23 @@ void FixRHEOThermal::post_integrate() MPI_Allreduce(&n_freeze, &n_freeze_all, 1, MPI_INT, MPI_SUM, world); if (cut_bond > 0 && (n_melt_all || n_freeze_all)) { + + // If a particle freezes, check if it already has bonds of that type + // If so, assume it was inserted as a solid particle + // Note: inserted solid particle may still shift one timestep + int *num_bond = atom->num_bond; + int **bond_type = atom->bond_type; + for (i = 0; i < atom->nlocal; i++) { + if (status[i] & STATUS_FREEZING) { + for (int n = 0; n < num_bond[i]; n++) { + if (bond_type[i][n] == btype) { + status[i] &= ~STATUS_FREEZING; + break; + } + } + } + } + // Forward status + positions (after inititial integrate, before comm) comm->forward_comm(this); @@ -464,11 +486,6 @@ void FixRHEOThermal::pre_force(int /*vflag*/) } } } - - // Add temporary options, wiped by preceding fix rheo preforce - for (int i = 0; i < nall; i++) - if (status[i] & STATUS_SOLID) - status[i] |= STATUS_NO_SHIFT; } /* ---------------------------------------------------------------------- */ @@ -482,7 +499,7 @@ void FixRHEOThermal::final_integrate() //Integrate energy for (int i = 0; i < atom->nlocal; i++) { if (status[i] & STATUS_NO_INTEGRATION) continue; - energy[i] += dtf * heatflow[i]; + energy[i] += dth * heatflow[i]; } } @@ -490,8 +507,8 @@ void FixRHEOThermal::final_integrate() void FixRHEOThermal::reset_dt() { - dtv = update->dt; - dtf = 0.5 * update->dt * force->ftm2v; + dt = update->dt; + dth = 0.5 * update->dt; } /* ---------------------------------------------------------------------- */ diff --git a/src/RHEO/fix_rheo_thermal.h b/src/RHEO/fix_rheo_thermal.h index c4c26eef6a..264bbdbce3 100644 --- a/src/RHEO/fix_rheo_thermal.h +++ b/src/RHEO/fix_rheo_thermal.h @@ -48,7 +48,7 @@ class FixRHEOThermal : public Fix { private: double *cv, *Tc, *kappa, *L; - double dtf, dtv; + double dt, dth; double cut_kernel, cut_bond, cutsq_bond; int *cv_style, *Tc_style, *kappa_style, *L_style; int btype; diff --git a/src/RHEO/pair_rheo.cpp b/src/RHEO/pair_rheo.cpp index 6e8c20a5d8..0a52bd53bc 100644 --- a/src/RHEO/pair_rheo.cpp +++ b/src/RHEO/pair_rheo.cpp @@ -208,14 +208,14 @@ void PairRHEO::compute(int eflag, int vflag) // Add corrections for walls rhoi = rho[i]; rhoj = rho[j]; - rho0i = rho[itype]; - rho0j = rho[jtype]; + rho0i = rho0[itype]; + rho0j = rho0[jtype]; Pi = pressure[i]; Pj = pressure[j]; fmag = 0; if (interface_flag) { if (fluidi && (!fluidj)) { - compute_interface->correct_v(vi, vj, i, j); + compute_interface->correct_v(vj, vi, j, i); rhoj = compute_interface->correct_rho(j, i); Pj = fix_pressure->calc_pressure(rhoj, jtype); @@ -223,7 +223,7 @@ void PairRHEO::compute(int eflag, int vflag) fmag = (chi[j] - 0.9) * (h * 0.5 - r) * rho0j * csq_ave * h * rinv; } else if ((!fluidi) && fluidj) { - compute_interface->correct_v(vj, vi, j, i); + compute_interface->correct_v(vi, vj, i, j); rhoi = compute_interface->correct_rho(i, j); Pi = fix_pressure->calc_pressure(rhoi, itype); From fc0b155de9829003c18ea6040e63f17f306a4a57 Mon Sep 17 00:00:00 2001 From: jtclemm Date: Mon, 3 Jun 2024 15:04:24 -0600 Subject: [PATCH 087/158] Dam example, generalizing non-quintic kernels --- doc/src/Howto_rheo.rst | 4 + examples/rheo/balloon/in.rheo.balloon | 1 + examples/rheo/dam-break/in.rheo.dam.break | 45 ++++---- examples/rheo/ice-cubes/in.rheo.ice.cubes | 1 + examples/rheo/oxidation/in.rheo.oxidation | 2 +- examples/rheo/poiseuille/in.rheo.poiseuille | 4 +- .../rheo/taylor-green/in.rheo.taylor.green | 3 +- src/RHEO/compute_rheo_kernel.cpp | 100 ++++++++++++++++-- src/RHEO/compute_rheo_kernel.h | 3 + src/RHEO/compute_rheo_rho_sum.cpp | 2 +- src/RHEO/fix_rheo.cpp | 2 + src/RHEO/fix_rheo.h | 2 +- 12 files changed, 129 insertions(+), 40 deletions(-) diff --git a/doc/src/Howto_rheo.rst b/doc/src/Howto_rheo.rst index b09925d6ac..939754aa95 100644 --- a/doc/src/Howto_rheo.rst +++ b/doc/src/Howto_rheo.rst @@ -17,6 +17,10 @@ these calculations. Additional numerical details can be found in :ref:`(Palermo) ` and :ref:`(Clemmer) `. +Note, if you simply want to run a traditional SPH simulation, the SPH package +is likely better suited for your application. It has fewer advanced features +and therefore benefits from improved performance. + ---------- At the core of the package is :doc:`fix rheo ` which integrates diff --git a/examples/rheo/balloon/in.rheo.balloon b/examples/rheo/balloon/in.rheo.balloon index d24573b0fb..c82fa39df3 100644 --- a/examples/rheo/balloon/in.rheo.balloon +++ b/examples/rheo/balloon/in.rheo.balloon @@ -60,6 +60,7 @@ fix 1 all rheo ${cut} quintic 0 & fix 2 all rheo/viscosity * constant ${eta} fix 3 all rheo/pressure * linear fix 4 all wall/harmonic ylo EDGE 2.0 1.0 1.0 +fix 5 all enforce2d compute rho all rheo/property/atom rho compute phase all rheo/property/atom phase diff --git a/examples/rheo/dam-break/in.rheo.dam.break b/examples/rheo/dam-break/in.rheo.dam.break index b59b710451..870b3529b6 100644 --- a/examples/rheo/dam-break/in.rheo.dam.break +++ b/examples/rheo/dam-break/in.rheo.dam.break @@ -3,24 +3,24 @@ dimension 2 units lj atom_style rheo -boundary f f p +boundary f s p comm_modify vel yes newton off # ------ Create simulation box ------ # variable n equal 1.0 -variable cut equal 3.0 -variable dx equal 4.0 +variable cut equal 2.2 +variable dx equal 3.0 -region box block -1 200 -1 80 -0.1 0.1 units box -#region box block -1 100 -1 40 -0.1 0.1 units box +region box block -1 150 -1 80 -0.1 0.1 units box create_box 2 box lattice hex ${n} -region fluid block $(xlo+v_dx) $(xlo+44.0) $(ylo+v_dx) $(yhi-16.0) EDGE EDGE units box -#region fluid block $(xlo+v_dx) $(xlo+20.0) $(ylo+v_dx) $(yhi-10.0) EDGE EDGE units box -region walls block $(xlo+v_dx) $(xhi-v_dx) $(ylo+v_dx) $(yhi-v_dx) EDGE EDGE units box side out +region fluid block $(xlo+v_dx+1.0) $(xlo+40.0) $(ylo+v_dx+1.0) $(yhi-20.0) EDGE EDGE units box +region walls1 block $(xlo+v_dx) $(xhi-v_dx) $(ylo+v_dx) $(yhi-v_dx) EDGE EDGE side out units box +region walls2 block EDGE EDGE EDGE $(yhi-v_dx) EDGE EDGE side in units box +region walls intersect 2 walls1 walls2 create_atoms 1 region fluid create_atoms 2 region walls @@ -33,12 +33,13 @@ group rig type 2 variable rho0 equal 1.0 variable mp equal ${rho0}/${n} variable cs equal 1.0 -variable zeta equal 0.05 +variable zeta equal 0.1 variable dt_max equal 0.1*${cut}/${cs}/3 -variable eta equal 0.05 -variable Dr equal 0.05 +variable eta equal 0.1 +variable Dr equal 0.1 -mass * ${mp} +mass 1 ${mp} +mass 2 $(2*v_mp) set group all rheo/rho ${rho0} set group all rheo/status 0 @@ -46,36 +47,30 @@ set group rig rheo/status 1 timestep ${dt_max} -pair_style rheo ${cut} artificial/visc ${zeta} rho/damp ${Dr} +pair_style rheo ${cut} artificial/visc ${zeta} #rho/damp ${Dr} pair_coeff * * - # ------ Fixes & computes ------ # fix 1 all rheo ${cut} quintic 10 & - shift & surface/detection coordination 22 8 & - interface/reconstruct -#fix 1 all rheo ${cut} RK1 10 surface/detection coordination 36 10 interface/reconstruct shift + rho/sum fix 2 all rheo/viscosity * constant ${eta} fix 3 all rheo/pressure * linear -fix 4 all gravity 5e-4 vector 0 -1 0 +fix 4 all gravity 1e-3 vector 0 -1 0 fix 5 rig setforce 0.0 0.0 0.0 +fix 6 all enforce2d compute rho all rheo/property/atom rho -compute phase all rheo/property/atom phase compute p all rheo/property/atom pressure compute surf all rheo/property/atom surface compute sn all rheo/property/atom surface/n/x surface/n/y -compute vshift all rheo/property/atom shift/v/x shift/v/y - # ------ Output & Run ------ # -thermo 100 +thermo 20 thermo_style custom step time ke press -dump 1 all custom 20 atomDump id type x y vx vy fx fy c_rho c_phase c_surf c_p c_vshift[*] c_sn[*] +#dump 1 all custom 200 atomDump id type x y vx vy fx fy c_rho c_surf c_p c_sn[*] -#thermo 1 -run 300000 # 400000 +run 30000 diff --git a/examples/rheo/ice-cubes/in.rheo.ice.cubes b/examples/rheo/ice-cubes/in.rheo.ice.cubes index 12eb54c32e..b023a8bac9 100644 --- a/examples/rheo/ice-cubes/in.rheo.ice.cubes +++ b/examples/rheo/ice-cubes/in.rheo.ice.cubes @@ -64,6 +64,7 @@ fix 4 all rheo/thermal conductivity * constant ${kappa} & fix 5 all wall/region wall harmonic 1.0 1.0 1.0 fix 6 all gravity 5e-4 vector 0 -1 0 fix 7 all deposit 8 0 1000 37241459 mol my_mol region drop near 2.0 vy -0.02 -0.02 +fix 8 all enforce2d compute rho all rheo/property/atom rho compute phase all rheo/property/atom phase diff --git a/examples/rheo/oxidation/in.rheo.oxidation b/examples/rheo/oxidation/in.rheo.oxidation index 5c1456ad5a..d26b379adb 100644 --- a/examples/rheo/oxidation/in.rheo.oxidation +++ b/examples/rheo/oxidation/in.rheo.oxidation @@ -10,7 +10,6 @@ newton off region box block -60 60 0 80 -0.01 0.01 units box create_box 3 box bond/types 2 extra/bond/per/atom 20 extra/special/per/atom 50 - region lbar block -15 0 3 80 EDGE EDGE units box region rbar block 0 15 3 80 EDGE EDGE units box region bar union 2 lbar rbar @@ -83,6 +82,7 @@ fix 7 all gravity 5e-5 vector 0 -1 0 fix 8 floor setforce 0.0 0.0 0.0 fix 9 surf add/heat linear 1.1 0.05 fix 10 floor add/heat constant 0 overwrite yes # fix the temperature of the floor +fix 11 all enforce2d compute surf all rheo/property/atom surface compute rho all rheo/property/atom rho diff --git a/examples/rheo/poiseuille/in.rheo.poiseuille b/examples/rheo/poiseuille/in.rheo.poiseuille index ee8ad5523c..7c38c8a6e0 100644 --- a/examples/rheo/poiseuille/in.rheo.poiseuille +++ b/examples/rheo/poiseuille/in.rheo.poiseuille @@ -6,7 +6,6 @@ atom_style rheo boundary p p p comm_modify vel yes - # ------ Create simulation box ------ # variable n equal 1.0 @@ -53,7 +52,6 @@ timestep ${dt_max} pair_style rheo ${cut} artificial/visc ${zeta} rho/damp ${Dr} pair_coeff * * - # ------ Fixes & computes ------ # fix 1 all rheo ${cut} quintic 0 shift @@ -62,10 +60,10 @@ fix 2 all rheo/viscosity * constant ${eta} fix 3 all rheo/pressure * linear fix 4 rig setforce 0.0 0.0 0.0 fix 5 fluid addforce ${fext} 0.0 0.0 +fix 6 all enforce2d compute rho all rheo/property/atom rho - # ------ Output & Run ------ # thermo 200 diff --git a/examples/rheo/taylor-green/in.rheo.taylor.green b/examples/rheo/taylor-green/in.rheo.taylor.green index e386d8262c..4485387440 100644 --- a/examples/rheo/taylor-green/in.rheo.taylor.green +++ b/examples/rheo/taylor-green/in.rheo.taylor.green @@ -7,7 +7,6 @@ boundary p p p comm_modify vel yes newton off - # ------ Create simulation box ------ # variable n equal 1.0 @@ -47,12 +46,12 @@ timestep ${dt_max} pair_style rheo ${cut} artificial/visc ${zeta} rho/damp ${Dr} pair_coeff * * - # ------ Fixes & computes ------ # fix 1 all rheo ${cut} RK1 8 shift fix 2 all rheo/viscosity * constant ${eta} fix 3 all rheo/pressure * linear +fix 4 all enforce2d compute rho all rheo/property/atom rho diff --git a/src/RHEO/compute_rheo_kernel.cpp b/src/RHEO/compute_rheo_kernel.cpp index bd16a89b6a..d0f24850bd 100644 --- a/src/RHEO/compute_rheo_kernel.cpp +++ b/src/RHEO/compute_rheo_kernel.cpp @@ -25,6 +25,7 @@ #include "error.h" #include "fix_rheo.h" #include "force.h" +#include "math_const.h" #include "math_extra.h" #include "memory.h" #include "modify.h" @@ -43,6 +44,7 @@ using namespace LAMMPS_NS; using namespace RHEO_NS; +using namespace MathConst; using namespace MathExtra; static constexpr int DELTA = 2000; @@ -57,8 +59,7 @@ ComputeRHEOKernel::ComputeRHEOKernel(LAMMPS *lmp, int narg, char **arg) : kernel_style = utils::inumeric(FLERR,arg[3],false,lmp); - - if (kernel_style == QUINTIC) { + if (kernel_style == QUINTIC || kernel_style == WENDLANDC4) { correction_order = -1; } else if (kernel_style == RK0) { correction_order = 0; @@ -115,12 +116,22 @@ void ComputeRHEOKernel::init() hsqinv = hinv * hinv; - if (dim == 3) { - pre_w = 0.002652582384864922 * 27.0 * hsqinv * hinv; - pre_wp = pre_w * 3.0 * hinv; + if (kernel_style != WENDLANDC4) { + if (dim == 3) { + pre_w = 1.0 / (120.0 * MY_PI) * 27.0 * hsqinv * hinv; + pre_wp = pre_w * 3.0 * hinv; + } else { + pre_w = 7.0 / (478.0 * MY_PI) * 9 * hsqinv; + pre_wp = pre_w * 3.0 * hinv; + } } else { - pre_w = 0.004661441847879780 * 9 * hsqinv; - pre_wp = pre_w * 3.0 * hinv; + if (dim == 3) { + pre_w = 495.0 / (32.0 * MY_PI * hsq * h); + pre_wp = pre_w * hinv; + } else { + pre_w = 9.0 / (MY_PI * hsq); + pre_wp = pre_w * hinv; + } } nmax_store = atom->nmax; @@ -163,11 +174,27 @@ int ComputeRHEOKernel::check_corrections(int i) /* ---------------------------------------------------------------------- */ +double ComputeRHEOKernel::calc_w_self(int i, int j) +{ + double w; + if (kernel_style == WENDLANDC4) + w = calc_w_wendlandc4(i, j, 0.0, 0.0, 0.0, 0.0); + else + w = calc_w_quintic(i, j, 0.0, 0.0, 0.0, 0.0); + + return w; +} + +/* ---------------------------------------------------------------------- */ + double ComputeRHEOKernel::calc_w(int i, int j, double delx, double dely, double delz, double r) { double w; int corrections_i, corrections_j, corrections; + if (kernel_style == WENDLANDC4) + return calc_w_wendlandc4(i,j,delx,dely,delz,r); + if (kernel_style != QUINTIC) { corrections_i = check_corrections(i); corrections_j = check_corrections(j); @@ -191,6 +218,9 @@ double ComputeRHEOKernel::calc_dw(int i, int j, double delx, double dely, double double wp; int corrections_i, corrections_j; + if (kernel_style == WENDLANDC4) + return calc_dw_wendlandc4(i,j,delx,dely,delz,r,dWij,dWji); + if (kernel_style != QUINTIC) { corrections_i = check_corrections(i); corrections_j = check_corrections(j); @@ -288,6 +318,62 @@ double ComputeRHEOKernel::calc_dw_quintic(int i, int j, double delx, double dely return wp; } +/* ---------------------------------------------------------------------- */ + +double ComputeRHEOKernel::calc_w_wendlandc4(int i, int j, double delx, double dely, double delz, double r) +{ + double w, tmp6, s; + s = r * hinv; + + if (s > 1.0) { + w = 0.0; + } else { + tmp6 = (1.0 - s) * (1.0 - s); + tmp6 *= tmp6 * tmp6; + w = tmp6 * (1.0 + 6.0 * s + 35.0 * THIRD * s * s); + } + + w *= pre_w; + + Wij = w; + Wji = w; + + return w; +} + +/* ---------------------------------------------------------------------- */ + +double ComputeRHEOKernel::calc_dw_wendlandc4(int i, int j, double delx, double dely, double delz, double r, double *dW1, double *dW2) +{ + double wp, tmp1, tmp5, tmp6, s, wprinv; + double *mass = atom->mass; + int *type = atom->type; + + s = r * hinv; + + if (s > 1.0) { + wp = 0.0; + } else { + tmp1 = 1.0 - s; + tmp5 = tmp1 * tmp1; + tmp5 = tmp5 * tmp5 * tmp1; + tmp6 = tmp5 * tmp1; + wp = tmp6 * (6.0 + 70.0 * THIRD * s); + wp -= 6 * tmp5 * (1.0 + 6.0 * s + 35.0 * THIRD * s * s); + } + + wp *= pre_wp; + wprinv = wp / r; + dW1[0] = delx * wprinv; + dW1[1] = dely * wprinv; + dW1[2] = delz * wprinv; + + dW2[0] = -delx * wprinv; + dW2[1] = -dely * wprinv; + dW2[2] = -delz * wprinv; + + return wp; +} /* ---------------------------------------------------------------------- */ diff --git a/src/RHEO/compute_rheo_kernel.h b/src/RHEO/compute_rheo_kernel.h index ed190c19ce..543e5d88c0 100644 --- a/src/RHEO/compute_rheo_kernel.h +++ b/src/RHEO/compute_rheo_kernel.h @@ -36,10 +36,13 @@ class ComputeRHEOKernel : public Compute { void unpack_forward_comm(int, int, double *) override; double memory_usage() override; void compute_coordination(); + double calc_w_self(int,int); double calc_w(int,int,double,double,double,double); double calc_dw(int,int,double,double,double,double); double calc_w_quintic(int,int,double,double,double,double); double calc_dw_quintic(int,int,double,double,double,double,double *,double *); + double calc_w_wendlandc4(int,int,double,double,double,double); + double calc_dw_wendlandc4(int,int,double,double,double,double,double *,double *); void grow_arrays(int); double dWij[3], dWji[3], Wij, Wji; diff --git a/src/RHEO/compute_rheo_rho_sum.cpp b/src/RHEO/compute_rheo_rho_sum.cpp index c7270897a4..d7f432a03d 100644 --- a/src/RHEO/compute_rheo_rho_sum.cpp +++ b/src/RHEO/compute_rheo_rho_sum.cpp @@ -94,7 +94,7 @@ void ComputeRHEORhoSum::compute_peratom() // initialize arrays, local with quintic self-contribution, ghosts are zeroed for (i = 0; i < nlocal; i++) { - w = compute_kernel->calc_w_quintic(i, i, 0.0, 0.0, 0.0, 0.0); + w = compute_kernel->calc_w_self(i, i); rho[i] = w * mass[type[i]]; } diff --git a/src/RHEO/fix_rheo.cpp b/src/RHEO/fix_rheo.cpp index cb2abfb938..c704677bec 100644 --- a/src/RHEO/fix_rheo.cpp +++ b/src/RHEO/fix_rheo.cpp @@ -90,6 +90,8 @@ FixRHEO::FixRHEO(LAMMPS *lmp, int narg, char **arg) : cut = h; if (strcmp(arg[4], "quintic") == 0) { kernel_style = QUINTIC; + } else if (strcmp(arg[4], "wendland/c4") == 0) { + kernel_style = WENDLANDC4; } else if (strcmp(arg[4], "RK0") == 0) { kernel_style = RK0; } else if (strcmp(arg[4], "RK1") == 0) { diff --git a/src/RHEO/fix_rheo.h b/src/RHEO/fix_rheo.h index 0af9fa8d01..251f82a99a 100644 --- a/src/RHEO/fix_rheo.h +++ b/src/RHEO/fix_rheo.h @@ -72,7 +72,7 @@ class FixRHEO : public Fix { namespace RHEO_NS { - enum {QUINTIC, RK0, RK1, RK2}; + enum {QUINTIC, WENDLANDC4, RK0, RK1, RK2}; enum {COORDINATION, DIVR}; // Status variables From 2aacc017cbdb93ee8c461605da05f63f9c5e7c1e Mon Sep 17 00:00:00 2001 From: jtclemm Date: Wed, 12 Jun 2024 17:29:30 -0600 Subject: [PATCH 088/158] Changes to CMake to hopefully match Sachith's suggestions --- cmake/CMakeLists.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cmake/CMakeLists.txt b/cmake/CMakeLists.txt index dd5fac30c6..d80e7df46c 100644 --- a/cmake/CMakeLists.txt +++ b/cmake/CMakeLists.txt @@ -440,7 +440,7 @@ if((CMAKE_CXX_COMPILER_ID STREQUAL "Intel") AND (CMAKE_CXX_STANDARD GREATER_EQUA PROPERTIES COMPILE_OPTIONS "-std=c++14") endif() -if(PKG_ATC OR PKG_AWPMD OR PKG_ML-QUIP OR PKG_ML-POD OR PKG_ELECTRODE OR BUILD_TOOLS OR PKG_RHEO) +if(PKG_ATC OR PKG_AWPMD OR PKG_ML-QUIP OR PKG_ML-POD OR PKG_ELECTRODE OR BUILD_TOOLS) enable_language(C) if (NOT USE_INTERNAL_LINALG) find_package(LAPACK) @@ -515,7 +515,7 @@ else() endif() foreach(PKG_WITH_INCL KSPACE PYTHON ML-IAP VORONOI COLVARS ML-HDNNP MDI MOLFILE NETCDF - PLUMED QMMM ML-QUIP SCAFACOS MACHDYN VTK KIM COMPRESS ML-PACE LEPTON) + PLUMED QMMM ML-QUIP SCAFACOS MACHDYN VTK KIM COMPRESS ML-PACE LEPTON RHEO) if(PKG_${PKG_WITH_INCL}) include(Packages/${PKG_WITH_INCL}) endif() From 80e96d8c9b8bcdf2df7bc5605c17e7b9de37a1df Mon Sep 17 00:00:00 2001 From: Ludwig Ahrens-Iwers Date: Thu, 13 Jun 2024 17:00:01 +0200 Subject: [PATCH 089/158] Bugfix electrode piston example --- .../electrode/piston/data.piston.final | 4064 ++++++++--------- examples/PACKAGES/electrode/piston/in.piston | 6 +- ...iston.g++.1 => log.22May2024.piston.g++.1} | 97 +- ...iston.g++.4 => log.22May2024.piston.g++.4} | 109 +- 4 files changed, 2147 insertions(+), 2129 deletions(-) rename examples/PACKAGES/electrode/piston/{log.1Dec2022.piston.g++.1 => log.22May2024.piston.g++.1} (64%) rename examples/PACKAGES/electrode/piston/{log.1Dec2022.piston.g++.4 => log.22May2024.piston.g++.4} (61%) diff --git a/examples/PACKAGES/electrode/piston/data.piston.final b/examples/PACKAGES/electrode/piston/data.piston.final index 8549261a3f..60570ec163 100644 --- a/examples/PACKAGES/electrode/piston/data.piston.final +++ b/examples/PACKAGES/electrode/piston/data.piston.final @@ -1,4 +1,4 @@ -LAMMPS data file via write_data, version 3 Nov 2022, timestep = 100000 +LAMMPS data file via write_data, version 7 Feb 2024, timestep = 100000, units = real 726 atoms 4 atom types @@ -35,732 +35,732 @@ Angle Coeffs # harmonic Atoms # full -49 25 2 0.008543040314262548 0 0 2.4018 0 0 0 -50 25 2 0.0160448240953976 1.4708 2.5475 2.4018 0 0 0 -51 26 2 -0.0079256875305239 0 5.0949 2.4018 0 0 0 -57 29 2 -0.005227878579680007 2.9416 0 2.4018 0 0 0 -58 29 2 0.01534182829253148 4.4124 2.5475 2.4018 0 0 0 -59 30 2 0.005249625623138609 2.9416 5.0949 2.4018 0 0 0 -676 242 3 -0.8476 2.819460981381933 5.027845836373835 5.552858700712285 1 0 0 -677 242 4 0.4238 3.6237064095951212 5.498057979630644 5.1894159030362905 1 0 0 -678 242 4 0.4238 3.0474931330566792 4.071918834795528 5.737806475295655 1 0 0 -709 253 3 -0.8476 3.326005069719568 2.1405935467748485 5.508189818283542 1 1 0 -195 81 4 0.4238 0.9649465875607126 4.340812162842168 5.657183047543541 0 0 0 -193 81 3 -0.8476 0.07822017262197362 3.9629228426194305 5.3908801998879925 0 0 0 -194 81 4 0.4238 0.11965319368873736 2.964163951647319 5.41854519664211 0 0 0 -103 51 3 -0.8476 6.804813198264613 5.084871250040471 11.277692419576146 1 0 0 -710 253 4 0.4238 2.3404190574558714 1.9714070000250485 5.508878140894409 1 1 0 -713 254 4 0.4238 9.064078450490644 2.446520257897097 5.3348626027546535 0 1 0 -65 33 2 0.01159205120014908 5.8832 0 2.4018 0 0 0 -66 33 2 0.01814012345205012 7.354000000000001 2.5475 2.4018 0 0 0 -67 34 2 0.001406594129736151 5.8832 5.0949 2.4018 0 0 0 -73 37 2 0.007725405338865237 8.8248 0 2.4018 0 0 0 -74 37 2 0.01259870480846824 10.2956 2.5475 2.4018 0 0 0 -75 38 2 -0.0004634638718638646 8.8248 5.0949 2.4018 0 0 0 -712 254 3 -0.8476 8.802633903527065 3.406390680517518 5.233373245990451 0 1 0 -714 254 4 0.4238 9.596656647074049 3.988446812598421 5.408709008648956 0 1 0 -604 218 3 -0.8476 10.053718350737668 0.9458152116350096 5.395407376762871 0 0 0 -189 79 4 0.4238 7.4156883111781475 3.478062124305858 6.469061899326572 -1 1 0 -170 73 4 0.4238 11.80947244959249 4.900763207760851 5.38132073658318 -1 0 0 -315 121 4 0.4238 12.776759773328315 8.761973185109612 12.512691519633954 0 0 0 -605 218 4 0.4238 11.02536148980741 0.7580225920428326 5.251723453806732 0 0 0 -116 55 4 0.4238 6.860405297106715 1.6714006503015966 5.673388843698673 -1 0 0 -388 146 3 -0.8476 13.766836983830515 3.9827224990972567 5.330985943540624 0 -1 0 -389 146 4 0.4238 13.425795558197045 3.8960741688633775 6.267033057995917 0 -1 0 -586 212 3 -0.8476 12.99172583601213 0.9627880677417303 5.186804494815568 0 1 0 -81 41 2 -0.006484897416350773 11.7664 0 2.4018 0 0 0 -82 41 2 0.008703081094077752 13.237200000000001 2.5475 2.4018 0 0 0 -83 42 2 0.00416546498595383 11.7664 5.0949 2.4018 0 0 0 -89 45 2 -0.01428117869162144 14.708000000000002 0 2.4018 0 0 0 -90 45 2 0.008098914705004666 16.178800000000003 2.5475 2.4018 0 0 0 -91 46 2 -0.02631301835063423 14.708000000000002 5.0949 2.4018 0 0 0 -601 217 3 -0.8476 14.580700057086469 2.470074704951404 9.549553516230905 0 0 0 -602 217 4 0.4238 13.852177407353523 2.485606699806581 10.234399813568656 0 0 0 -107 52 4 0.4238 1.7753325684361263 5.260464281758941 12.927518370297552 0 0 0 -603 217 4 0.4238 15.320102605212748 3.0795550665438127 9.835591885333054 0 0 0 -378 142 4 0.4238 15.457095569986127 9.173371129323348 12.171458596416667 0 -1 0 -422 157 4 0.4238 4.786861348572543 7.318978962263422 5.502857747714512 0 0 0 -52 26 2 -0.01097199601095499 1.4708 7.6424 2.4018 0 0 0 -53 27 2 0.01511923962052951 0 10.1898 2.4018 0 0 0 -60 30 2 -0.006773385603520778 4.4124 7.6424 2.4018 0 0 0 -61 31 2 -0.0006618884891667937 2.9416 10.1898 2.4018 0 0 0 -316 122 3 -0.8476 13.376991964874126 9.733980167782747 5.2443510947274685 -1 0 0 -423 157 4 0.4238 6.118596559257136 6.376695231617992 5.575034452052516 0 0 0 -421 157 3 -0.8476 5.134517216890271 6.414178710640228 5.748768298079106 0 0 0 -643 231 3 -0.8476 3.1763474635956395 8.886111555148053 5.282080436718036 1 0 0 -644 231 4 0.4238 2.513118087318634 8.218141042299745 4.944523274214661 1 0 0 -581 210 4 0.4238 1.9210593488372454 5.953179684029002 6.41990460669887 1 2 0 -426 158 4 0.4238 15.617845693245721 0.24896899149304588 12.27982548992809 0 0 0 -582 210 4 0.4238 0.738973409880735 7.079488872493541 6.392936823978947 1 2 0 -299 116 4 0.4238 1.8742478531098932 0.3995180953106482 9.934219884593341 0 0 0 -691 247 3 -0.8476 7.689714173805594 6.217320019017989 5.258073041482447 0 0 0 -693 247 4 0.4238 8.37284176321211 6.235548870214623 5.9881454257142686 0 0 0 -369 139 4 0.4238 8.495516986476424 8.433565798354097 5.028752451013381 0 0 0 -300 116 4 0.4238 2.911599743969392 1.5040316802567835 10.542971525540692 0 0 0 -367 139 3 -0.8476 8.981733107973055 8.98237922473984 5.708751536331027 0 0 0 -368 139 4 0.4238 9.966826030721563 8.844561146157186 5.605781099266854 0 0 0 -68 34 2 -0.005353421945912079 7.354000000000001 7.6424 2.4018 0 0 0 -69 35 2 -0.02242224817485722 5.8832 10.1898 2.4018 0 0 0 -76 38 2 -0.008749553110635829 10.2956 7.6424 2.4018 0 0 0 -77 39 2 -0.001587975150694571 8.8248 10.1898 2.4018 0 0 0 -169 73 3 -0.8476 10.86775468338433 5.19328586965271 5.547456960295855 -1 0 0 -171 73 4 0.4238 10.800651355284717 6.183975873079292 5.42898775849054 -1 0 0 -425 158 4 0.4238 16.365686839954538 1.6918548567498142 12.120323120019671 0 0 0 -543 197 4 0.4238 15.74455376269356 5.985972014656273 4.244902593730374 1 -1 0 -522 190 4 0.4238 12.358773694396177 8.241027948029787 5.4342692843409335 0 0 0 -541 197 3 -0.8476 15.948040102134595 5.877893730968188 5.217997046194076 1 -1 0 -520 190 3 -0.8476 11.521538237363735 7.820855042448146 5.784258984209179 0 0 0 -521 190 4 0.4238 11.640196773280092 7.596913910660865 6.751612100022279 0 0 0 -213 87 4 0.4238 16.94869795729418 7.658694530040734 4.96211922323137 -1 1 0 -84 42 2 -0.02253342595559467 13.237200000000001 7.6424 2.4018 0 0 0 -85 43 2 -0.02386325442458492 11.7664 10.1898 2.4018 0 0 0 -92 46 2 -0.03395260336333754 16.178800000000003 7.6424 2.4018 0 0 0 -93 47 2 -0.02530118571584997 14.708000000000002 10.1898 2.4018 0 0 0 -211 87 3 -0.8476 17.523577595505472 8.373665168921514 5.360027780919543 -1 1 0 -212 87 4 0.4238 17.0831513845729 9.262879118182907 5.236238106470797 -1 1 0 -205 85 3 -0.8476 5.522367248324516 5.082933874779558 8.132800488002275 0 0 0 -207 85 4 0.4238 4.856839636565012 5.040433764778345 8.877963749174969 0 0 0 -206 85 4 0.4238 5.248881626300537 5.7908645558964675 7.4816162727356925 0 0 0 -188 79 4 0.4238 6.497322905499542 3.778149013994996 7.785564626115502 -1 1 0 -104 51 4 0.4238 6.975223059984354 6.057718294907826 11.434323932547846 1 0 0 -240 96 4 0.4238 15.907149183138676 1.5390029324335393 8.501706376153551 0 0 0 -186 78 4 0.4238 10.809679491055352 4.82920260257931 12.234285165918621 -1 0 0 -627 225 4 0.4238 1.142311523721859 0.5701072346557061 5.407977967350236 1 0 0 -679 243 3 -0.8476 14.388344112145468 5.895841187409739 12.553492598002434 0 0 0 -298 116 3 -0.8476 2.249658462135075 0.7910692719529153 10.774314024535329 0 0 0 -498 182 4 0.4238 3.1782299333534842 4.421584435342713 10.843305251025729 0 0 0 -242 97 4 0.4238 0.11372454909840307 4.5608406751586585 8.512959914844476 1 0 0 -497 182 4 0.4238 3.635093197649102 3.6372270746257795 9.485847319495857 0 0 0 -496 182 3 -0.8476 3.891719288381077 4.3420728032109785 10.147162657393025 0 0 0 -243 97 4 0.4238 1.166929713515916 3.3148448925475837 8.443094046894181 1 0 0 -653 234 4 0.4238 7.986724447375092 9.58663088134249 7.078331051080797 0 -1 0 -291 113 4 0.4238 1.3902648936489443 6.574700931558314 8.627083040419217 2 0 0 -476 175 4 0.4238 10.873396710796088 3.7503648821895377 7.099886667034369 0 0 0 -626 225 4 0.4238 17.341387780659073 1.3131579087511918 5.302792549204005 0 0 0 -187 79 3 -0.8476 6.972728954372332 3.0679623101137263 7.266310623507446 -1 1 0 -198 82 4 0.4238 11.676864533923228 2.4008557059764484 11.887821076968272 0 1 0 -477 175 4 0.4238 11.028257394545655 2.35049554258184 6.2734372961507034 0 0 0 -385 145 3 -0.8476 9.464341047888412 3.3817188372167357 10.216775935923458 0 0 0 -432 160 4 0.4238 7.4158023596883 5.242602008656209 8.911704625300178 1 0 0 -386 145 4 0.4238 9.834023311752183 3.1577521519269993 11.118538449130567 0 0 0 -387 145 4 0.4238 8.839522007452976 2.6580907515237095 9.923575914839613 0 0 0 -431 160 4 0.4238 8.97937772550123 4.855861822733754 9.180574759645397 1 0 0 -430 160 3 -0.8476 8.360641109810988 5.4265820345806866 8.640716144277553 1 0 0 -475 175 3 -0.8476 11.185122253842481 2.80161992224134 7.152006656534362 0 0 0 -577 209 3 -0.8476 11.892138326574036 4.606875557740573 8.77639055263619 0 0 0 -578 209 4 0.4238 11.15205283743665 4.662613397329064 9.446591004081876 0 0 0 -579 209 4 0.4238 11.806616036319609 3.757706369789849 8.255238997490805 0 0 0 -282 110 4 0.4238 11.993978725584078 0.6955935520855357 10.362669416358116 1 -1 0 -281 110 4 0.4238 13.246870870022725 0.7932688823507881 11.405429138463369 1 -1 0 -280 110 3 -0.8476 12.399897412926068 1.230819260076083 11.103456814170583 1 -1 0 -576 208 4 0.4238 7.424477420107739 1.9205433206111677 8.347065650914391 0 0 0 -115 55 3 -0.8476 6.566829197641645 0.7852168728409362 5.314930190030221 -1 0 0 -117 55 4 0.4238 7.3699037409564365 0.24315040972892277 5.0674680046309595 -1 0 0 -654 234 4 0.4238 6.5231563540652955 9.334766916189148 7.757419217563333 0 -1 0 -196 82 3 -0.8476 11.325205678636125 3.0960265761644146 12.514778502806406 0 1 0 -353 134 4 0.4238 10.34648669613546 9.717097284025227 12.21531953491664 1 -1 0 -575 208 4 0.4238 6.8621106467674515 0.6153612624236356 9.151348490167914 0 0 0 -390 146 4 0.4238 14.71592873372509 4.297162424310161 5.349801109951233 0 -1 0 -468 172 4 0.4238 14.334820367346975 9.458375422451784 9.389857451086156 0 1 0 -680 243 4 0.4238 14.420209860242771 5.620779336744502 11.592592717412877 0 0 0 -401 150 4 0.4238 13.58439176144119 5.20555361726743 9.602450324228725 0 0 0 -241 97 3 -0.8476 0.3452523216688656 3.6651747745441994 8.892669971959721 1 0 0 -400 150 3 -0.8476 14.455722458405065 5.628055139668128 9.852004866869082 0 0 0 -562 204 3 -0.8476 16.641350343283886 4.083296189715342 10.989056663280612 0 0 0 -563 204 4 0.4238 16.037770379422128 4.850987807509285 10.773784577109874 0 0 0 -564 204 4 0.4238 17.178401412678653 3.844498107566038 10.180011679572727 0 0 0 -687 245 4 0.4238 16.714761709756484 4.337732009968187 12.639387839102408 0 0 0 -467 172 4 0.4238 13.346114040811248 9.313588789790407 10.681417293752048 0 1 0 -666 238 4 0.4238 4.34126756117676 8.905137414158627 6.516509692747207 0 0 0 -664 238 3 -0.8476 4.751093055532058 9.063792850376354 7.414773021734108 0 0 0 -637 229 3 -0.8476 0.7471877141074242 8.354301697005937 11.535489275372338 1 -1 0 -290 113 4 0.4238 1.5797294433316216 5.599705770675408 9.923275349951421 2 0 0 -652 234 3 -0.8476 7.361488829472968 9.878076947823384 7.802307315600979 0 -1 0 -402 150 4 0.4238 14.817635634485477 6.133309514160487 9.068590593856563 0 0 0 -257 102 4 0.4238 2.654784049830047 9.360773717063745 10.840199367879586 1 0 0 -256 102 3 -0.8476 2.7861525988520546 9.125527207512318 9.87717977353219 1 0 0 -424 158 3 -0.8476 16.282645750155215 0.8737366464771422 12.689346105039219 0 0 0 -665 238 4 0.4238 4.161382545837657 8.676258785766425 8.123335852134215 0 0 0 -122 57 4 0.4238 7.825760402756952 0.4118083408578644 10.770069138315867 0 0 0 -258 102 4 0.4238 2.6507626673715956 8.142581237775797 9.752715909565804 1 0 0 -466 172 3 -0.8476 13.51508294943025 9.818693918214702 9.83505984792318 0 1 0 -377 142 4 0.4238 17.080578433321772 9.22752863551317 12.004131277448275 0 -1 0 -105 51 4 0.4238 5.853746057457844 4.953910172266563 10.997832121722793 1 0 0 -580 210 3 -0.8476 1.3210642970676016 6.5207610408534675 6.98369360583625 1 2 0 -638 229 4 0.4238 0.9970176405359414 7.548196505367084 10.999036348164699 1 -1 0 -717 255 4 0.4238 12.39024162854418 0.28840285676654837 6.591412796748799 1 1 0 -352 134 3 -0.8476 11.226526547688243 9.242192984029268 12.216220312698256 1 -1 0 -137 62 4 0.4238 2.027815877839267 1.8732362417553365 7.987025431651223 0 0 0 -692 247 4 0.4238 7.786529711776536 5.3723882747118985 4.732032313657794 0 0 0 -645 231 4 0.4238 2.8214978665553723 9.809957726487395 5.138560233155634 1 0 0 -185 78 4 0.4238 10.316334741569422 6.044854419256892 11.261952987588222 -1 0 0 -292 114 3 -0.8476 5.67656046565693 9.596732521658042 10.995975339349497 0 0 0 -294 114 4 0.4238 4.789939140622079 9.742378050555555 11.434941355604284 0 0 0 -574 208 3 -0.8476 7.516492206466037 1.3710743960569696 9.177498905408314 0 0 0 -711 253 4 0.4238 3.810396593432228 1.2880838486682353 5.311739399800884 1 1 0 -437 162 4 0.4238 6.860466827809697 8.422553075168016 11.337314477776795 1 0 0 -436 162 3 -0.8476 7.571135241081482 7.730803749388945 11.465517092648946 1 0 0 -588 212 4 0.4238 13.498663213828278 0.38996264096399363 4.542687820493753 0 1 0 -438 162 4 0.4238 8.31154777226707 7.888534002434359 10.812132835679304 1 0 0 -701 250 4 0.4238 9.286513797831446 6.646575924029509 9.147658317438076 2 -1 0 -700 250 3 -0.8476 9.643385938511667 7.47449461758298 9.580320183736939 2 -1 0 -513 187 4 0.4238 1.8185112493161812 10.053298043923604 8.893843011592004 1 0 0 -106 52 3 -0.8476 2.266275159877156 4.688670030017356 12.270229177579722 0 0 0 -702 250 4 0.4238 10.60077224354893 7.600272590312019 9.32033378097907 2 -1 0 -138 62 4 0.4238 3.3080664559545965 2.543423811679406 7.226477171885048 0 0 0 -542 197 4 0.4238 16.61438869395917 5.142214492766869 5.339474575210934 1 -1 0 -376 142 3 -0.8476 16.267806197381876 9.752608027087469 12.256508250931114 0 -1 0 -639 229 4 0.4238 1.2657862555275905 8.359520313997795 12.390492314175315 1 -1 0 -524 191 4 0.4238 13.000197848284115 7.591623195457351 8.231720539306574 0 -1 0 -360 136 4 0.4238 16.927450088881905 9.623013099606048 8.250041448548666 0 0 0 -359 136 4 0.4238 16.11845308444977 9.867127694636144 6.852701508709072 0 0 0 -358 136 3 -0.8476 16.050165493006663 9.508888830997453 7.78383224839627 0 0 0 -289 113 3 -0.8476 1.4110503224699262 6.539558634958015 9.626249498776556 2 0 0 -384 144 4 0.4238 2.493028840280995 9.719794300761412 12.910496964228098 0 -1 0 -406 152 3 -0.8476 15.247929159060655 7.012234071819868 7.773022011622398 0 0 0 -408 152 4 0.4238 15.48816222034174 6.532006856700564 6.929416156188867 0 0 0 -523 191 3 -0.8476 12.082020144652011 7.21880883213217 8.365736806678662 0 -1 0 -407 152 4 0.4238 15.63244454689617 7.93511971351192 7.752267289359093 0 0 0 -525 191 4 0.4238 12.142278624301815 6.233249103608379 8.523992954763008 0 -1 0 -625 225 3 -0.8476 0.6808462683385743 1.4551937786169056 5.347366251301949 1 0 0 -136 62 3 -0.8476 2.697762074389062 2.615104290660337 8.015394827891544 0 0 0 -587 212 4 0.4238 13.566186954572455 1.7288682835758 5.475103447756109 0 1 0 -184 78 3 -0.8476 10.806213490399747 5.820732453607262 12.104443472749216 -1 0 0 -404 151 4 0.4238 0.19226097555573238 0.6070051864264498 8.178840137751594 1 0 0 -313 121 3 -0.8476 13.713176980186857 8.464536347918953 12.326518306939699 0 0 0 -238 96 3 -0.8476 16.147179753895433 0.6588013419307613 8.092271913343968 0 0 0 -461 170 4 0.4238 9.724872597026858 0.5544258850846108 9.053145916541903 0 0 0 -354 134 4 0.4238 11.073991971501862 8.257853428140294 12.30459990822289 1 -1 0 -314 121 4 0.4238 13.814688248066297 7.503222137375749 12.582601723500172 0 0 0 -403 151 3 -0.8476 1.1872556285218714 0.5093445341888718 8.200033176326532 1 0 0 -698 249 4 0.4238 15.55803239857769 0.7459365278981882 6.259847956511043 0 1 0 -114 54 4 0.4238 7.782158286850564 4.869601692703211 12.807668425470919 0 -1 0 -697 249 3 -0.8476 15.855429109033778 0.4369326727389228 5.356480411028421 0 1 0 -606 218 4 0.4238 9.544775439662294 0.08501982626141869 5.398561718648435 0 0 0 -317 122 4 0.4238 13.333479801593976 9.740943665116738 4.24532200523119 -1 0 0 -108 52 4 0.4238 2.6709587275475806 3.9072302649054578 12.745192231166719 0 0 0 -382 144 3 -0.8476 3.147429286024961 10.109636142426924 12.262589634326233 0 -1 0 -219 89 4 0.4238 6.364020207274239 2.520405553770681 12.99540340928131 0 1 0 -670 240 3 -0.8476 6.773533755134105 3.717038175159099 16.491590206755482 1 1 0 -396 148 4 0.4238 5.803462923264418 5.197637234493128 18.99743460565577 1 0 0 -395 148 4 0.4238 6.231119807997449 5.430041501948986 17.438676906564567 1 0 0 -394 148 3 -0.8476 5.703165163684741 5.798066954915367 18.20406962093302 1 0 0 -204 84 4 0.4238 0.9285041127500067 6.081115753960207 17.765142563298816 0 0 0 -608 219 4 0.4238 3.4847098211944805 4.983851303239975 16.51022523448973 2 0 0 -203 84 4 0.4238 2.239308631405881 6.936298376846396 18.23106240529696 0 0 0 -202 84 3 -0.8476 1.7977361263740537 6.4724758132065725 17.4630234950725 0 0 0 -486 178 4 0.4238 1.5196084362896762 6.12225022226849 15.824399106036145 2 -1 0 -347 132 4 0.4238 3.6682462328407848 1.7981456998993772 14.104840128555262 0 0 0 -45 23 1 0.006123381361742108 14.708000000000002 10.1898 23.449863020791625 0 0 0 -471 173 4 0.4238 1.169657196352889 2.3243122122885453 14.225856073802426 1 0 0 -348 132 4 0.4238 3.2986057185518605 3.2227066069571335 14.81238521553265 0 0 0 -275 108 4 0.4238 3.030667138719297 2.590837305059514 17.506935704777117 0 1 0 -346 132 3 -0.8476 3.0631397880047393 2.5935970488364877 14.071588140230032 0 0 0 -572 207 4 0.4238 5.938146311728662 1.1988717244542944 18.449373741134067 2 0 0 -338 129 4 0.4238 3.072928503496896 1.7841590474751556 19.542649762121915 1 1 0 -485 178 4 0.4238 0.47678333061827677 5.47396748641097 14.747888473867437 2 -1 0 -571 207 3 -0.8476 5.4801718917026605 1.015513120679157 17.579521025148217 2 0 0 -591 213 4 0.4238 1.6285162972905645 3.4120124953752153 19.93620754678186 1 0 0 -589 213 3 -0.8476 0.8251068536873744 3.8954462084678685 20.28381032825206 1 0 0 -607 219 3 -0.8476 3.867930772442749 4.066191566694831 16.405134372982015 2 0 0 -609 219 4 0.4238 4.806032103818568 4.055085076366629 16.75132234398619 2 0 0 -180 76 4 0.4238 6.828372582015677 7.87413160734309 14.827932072927481 1 0 0 -274 108 3 -0.8476 2.2754290519199434 2.0804855419940176 17.918224542873194 0 1 0 -686 245 4 0.4238 17.05951378440882 3.718092322788279 14.110381025997988 0 0 0 -671 240 4 0.4238 7.723844896306422 3.5324942522771177 16.240882591061286 1 1 0 -672 240 4 0.4238 6.164914683475686 3.1703614971042993 15.916500506334968 1 1 0 -112 54 3 -0.8476 8.040671566798173 4.854493140691428 13.773559856960954 0 -1 0 -681 243 4 0.4238 14.923807986964198 5.253612199100808 13.101965411111607 0 0 0 -113 54 4 0.4238 7.6698060149863725 5.662965420048592 14.230545447349645 0 -1 0 -344 131 4 0.4238 10.95474300812148 4.0896914619293145 14.970342975126565 1 0 0 -343 131 3 -0.8476 10.063394350235356 3.7363576006086254 15.254338082590541 1 0 0 -345 131 4 0.4238 9.34090547780924 4.213383582128138 14.753881815078818 1 0 0 -255 101 4 0.4238 10.85824303556981 3.0901798958905475 17.415063203472258 1 1 0 -254 101 4 0.4238 10.431165704841273 2.7912121126124174 18.962593602768095 1 1 0 -309 119 4 0.4238 9.657908807892223 1.9712599592283588 15.351618323136861 0 0 0 -253 101 3 -0.8476 11.154265512428617 3.1439882841524334 18.368727773437268 1 1 0 -479 176 4 0.4238 5.403795086006659 1.4149877692142259 20.021771864299765 0 -1 0 -109 53 3 -0.8476 8.600205030653099 2.2462808893047232 19.821549314151852 -1 -1 0 -480 176 4 0.4238 6.258921142430334 0.1412548703721989 20.581229029437516 0 -1 0 -375 141 4 0.4238 9.117868061991976 1.036566241068436 18.751587159762384 1 0 0 -44 22 1 -0.0001812904321965569 16.178800000000003 7.6424 23.449863020791625 0 0 0 -110 53 4 0.4238 7.727663154061957 1.8390933537663159 20.091493343399456 -1 -1 0 -307 119 3 -0.8476 9.343792417931972 1.0220586309221074 15.332862776937171 0 0 0 -685 245 3 -0.8476 16.514983914712488 4.396701916152739 13.617453660612183 0 0 0 -635 228 4 0.4238 14.934439265290866 2.288341571568405 19.356194526021124 -1 1 0 -636 228 4 0.4238 16.2158222895273 2.6797206531874846 18.422648696940644 -1 1 0 -271 107 3 -0.8476 14.384906263459381 5.231528110011023 18.211019803516685 0 0 0 -722 257 4 0.4238 0.7841546606140447 3.2030543524924195 17.73657679021505 1 0 0 -481 177 3 -0.8476 12.581138481752648 4.859708235311564 14.646852856409735 0 -1 0 -721 257 3 -0.8476 17.60844845622247 3.454378290202139 17.230572913673747 0 0 0 -483 177 4 0.4238 13.160238723845719 4.100628436368969 14.944244840432273 0 -1 0 -723 257 4 0.4238 17.606644439674373 2.9907645897973025 16.344535049328133 0 0 0 -482 177 4 0.4238 13.012070955214067 5.324546157865892 13.873402918227042 0 -1 0 -210 86 4 0.4238 15.870038382436055 6.148820952871613 19.006015180550836 0 0 0 -208 86 3 -0.8476 16.865547237935143 6.098380167171903 19.086141002575904 0 0 0 -469 173 3 -0.8476 0.24099730438873146 2.3625139757391653 14.594820907791535 1 0 0 -209 86 4 0.4238 17.139292025421696 5.150302069211487 19.248054676505525 0 0 0 -688 246 3 -0.8476 14.623886499778722 3.6932990280304163 15.732807373833925 0 0 0 -690 246 4 0.4238 14.619196195132695 3.9139495349394897 16.70815146361856 0 0 0 -634 228 3 -0.8476 15.93174987773314 2.3544851495071337 19.324605678443945 -1 1 0 -689 246 4 0.4238 15.265375999751216 4.295738562336769 15.257869634602969 0 0 0 -662 237 4 0.4238 4.978031757165134 0.7547617838359337 14.20344931791269 0 0 0 -149 66 4 0.4238 6.142925343814942 8.825398894478063 19.325397902096977 1 -1 0 -590 213 4 0.4238 0.07861235173383108 3.2446527141465413 20.422437871943448 1 0 0 -433 161 3 -0.8476 13.453174159881309 1.2429493424526434 18.58612891404859 1 0 0 -435 161 4 0.4238 13.569356144672101 0.9791538990920698 17.628571988252272 1 0 0 -102 50 4 0.4238 6.712168198770753 6.861720337029987 19.24687390403485 2 0 0 -140 63 4 0.4238 14.018366924616625 9.69491277775119 14.008138262339143 -2 -1 0 -417 155 4 0.4238 5.208444868460392 7.220217558553598 16.73639408130369 0 0 0 -415 155 3 -0.8476 5.290910423508213 8.090179521588407 16.250219145720393 0 0 0 -416 155 4 0.4238 4.571517941560458 8.713170942042227 16.557394543089575 0 0 0 -459 169 4 0.4238 1.274864904832181 9.57147587035769 16.73714616564885 1 0 0 -217 89 3 -0.8476 6.03252642387316 1.682543967490432 13.429110083925117 0 1 0 -478 176 3 -0.8476 6.321181520041977 1.0326296477116548 20.13225702561793 0 -1 0 -361 137 3 -0.8476 1.6007303313238133 8.59744641622387 14.087757338010231 1 -1 0 -197 82 4 0.4238 11.189299229444917 2.6912260959037098 13.419027842857094 0 1 0 -650 233 4 0.4238 14.003306552648727 1.5742686356038393 16.043690746479285 1 0 0 -488 179 4 0.4238 14.200182875506746 9.953534892777244 19.839371915250766 1 -1 0 -484 178 3 -0.8476 1.310019783094791 6.016938649674422 14.852293828373476 2 -1 0 -661 237 3 -0.8476 4.352879610820145 0.25944931473696636 14.80665155844631 0 0 0 -363 137 4 0.4238 1.959463608305586 9.151048377028488 14.839313627996184 1 -1 0 -100 50 3 -0.8476 7.520229491829531 7.3048366120870165 19.635059688498004 2 0 0 -707 252 4 0.4238 11.76043130595752 9.939320694789002 19.71667383739911 0 1 0 -178 76 3 -0.8476 7.517489493276682 7.333706134334132 14.345168774847096 1 0 0 -684 244 4 0.4238 17.28192914942711 9.812564778400814 18.086534426021203 0 1 0 -36 18 1 -0.0179910439504863 13.237200000000001 7.6424 23.449863020791625 0 0 0 -276 108 4 0.4238 2.207595987778979 1.1805886699543764 17.487427077013713 0 1 0 -214 88 3 -0.8476 8.637264772060341 8.061628662502454 16.90108297131685 -1 0 0 -216 88 4 0.4238 9.630438446102557 8.174027520932198 16.932331381504746 -1 0 0 -539 196 4 0.4238 9.695497532266977 6.886264199273172 14.189789226002413 2 0 0 -538 196 3 -0.8476 10.563020232995258 6.775061520800534 14.674598753985302 2 0 0 -252 100 4 0.4238 7.685168241584919 9.610566187163585 16.889892309335206 0 0 0 -228 92 4 0.4238 11.050503228858997 8.010373029173316 15.663121686944693 0 -1 0 -226 92 3 -0.8476 11.28429273467671 8.543911989710573 16.475943851978776 0 -1 0 -227 92 4 0.4238 11.344287050217062 9.512148354407193 16.233205016457113 0 -1 0 -540 196 4 0.4238 11.161666855372657 6.168261200879016 14.151701557933738 2 0 0 -596 215 4 0.4238 12.771065336519738 7.748494590220643 16.220536748708703 1 -1 0 -215 88 4 0.4238 8.374011229887373 7.6671090745462545 16.020711214547347 -1 0 0 -234 94 4 0.4238 16.576430424719607 0.5062309843763978 19.13844592766813 0 0 0 -706 252 3 -0.8476 12.36193947812822 9.160747667168573 19.537751621413815 0 1 0 -708 252 4 0.4238 11.865171027143662 8.469425792189265 19.01306505088366 0 1 0 -373 141 3 -0.8476 9.412620718118959 0.35565490575707015 18.08114998455027 1 0 0 -272 107 4 0.4238 13.96923862413299 5.521984167683582 19.072911164078484 0 0 0 -273 107 4 0.4238 14.169684339674113 5.896953089438392 17.496254328798827 0 0 0 -362 137 4 0.4238 1.6305502404987111 7.6307855704072995 14.342077627004548 1 -1 0 -597 215 4 0.4238 13.155595108591708 6.281716998754621 15.614461099800554 1 -1 0 -519 189 4 0.4238 0.25052520571656256 7.410000747569126 19.453385808828934 1 0 0 -682 244 3 -0.8476 17.37568243426495 9.11353756111006 17.377610598188703 0 1 0 -161 70 4 0.4238 0.4276393931068581 9.645404130294276 19.94966591203612 1 0 0 -683 244 4 0.4238 16.762775639163923 8.349640967386419 17.579621185009074 0 1 0 -339 129 4 0.4238 2.953255533740337 0.7273765470433621 20.781809824703732 1 1 0 -470 173 4 0.4238 17.313495807482283 1.701791190164049 14.11457782420363 0 0 0 -595 215 3 -0.8476 13.434254199843643 7.000670331013912 16.25121582144323 1 -1 0 -649 233 3 -0.8476 13.730521799815536 0.614769911259436 16.114057992895944 1 0 0 -179 76 4 0.4238 7.376399341193584 7.418181342250472 13.358780560554386 1 0 0 -308 119 4 0.4238 9.328524040796328 0.6575663281326254 16.263946795393448 0 0 0 -663 237 4 0.4238 4.505521910089192 0.5457888494359412 15.752543276886664 0 0 0 -337 129 3 -0.8476 3.514575860727707 1.4477360756662245 20.37437556806391 1 1 0 -327 125 4 0.4238 4.963020305736973 4.844213183983858 21.800104413199907 0 1 0 -325 125 3 -0.8476 5.413526513655491 4.683300538459343 20.92195188291159 0 1 0 -326 125 4 0.4238 6.356823537007404 4.39129241653594 21.079824846511343 0 1 0 -535 195 3 -0.8476 2.983237344424761 5.852992742968334 19.86140129850823 1 0 0 -537 195 4 0.4238 3.8877052935337013 5.573139871228802 20.183303829725734 1 0 0 -2 1 1 0.01681964573718448 1.4708000000000014 2.5475000000000003 23.449863020791625 0 0 0 -1 1 1 0.009530892217576416 1.7763568394002505e-15 1.7763568394002505e-15 23.449863020791625 0 0 0 -11 6 1 -0.01524214201230506 2.941600000000001 5.094900000000001 23.449863020791625 0 0 0 -3 2 1 0.01449029221643637 1.7763568394002505e-15 5.094900000000001 23.449863020791625 0 0 0 -10 5 1 0.00691884776850595 4.4124 2.5474999999999994 23.449863020791625 0 0 0 -9 5 1 0.0195314219644623 2.9415999999999993 1.7763568394002505e-15 23.449863020791625 0 0 0 -536 195 4 0.4238 2.319795753718221 5.1326684425952385 20.063837216279858 1 0 0 -516 188 4 0.4238 8.108138722594667 5.927016819163718 20.411810376184487 1 -1 0 -111 53 4 0.4238 8.496355497036129 3.238090310367132 19.747187863764335 -1 -1 0 -515 188 4 0.4238 9.362944894589518 4.883962319684104 20.47605173012904 1 -1 0 -514 188 3 -0.8476 8.36740867133632 4.961263964951319 20.421886089225346 1 -1 0 -168 72 4 0.4238 11.376288543712512 4.443050222600666 19.712926478310834 0 0 0 -166 72 3 -0.8476 11.119316529543537 5.1744679228851975 20.344587376759364 0 0 0 -17 9 1 -0.0001196702448092049 5.8832 0 23.449863020791625 0 0 0 -19 10 1 -0.04577843504398507 5.8832 5.094900000000001 23.449863020791625 0 0 0 -18 9 1 0.005448749793554232 7.354000000000001 2.5474999999999994 23.449863020791625 0 0 0 -27 14 1 0.01621780275369726 8.8248 5.094900000000001 23.449863020791625 0 0 0 -26 13 1 0.009139377486030886 10.2956 2.5474999999999994 23.449863020791625 0 0 0 -25 13 1 0.005843126768876098 8.8248 0 23.449863020791625 0 0 0 -434 161 4 0.4238 12.577274249871005 1.7121343654934205 18.69868691361602 1 0 0 -41 21 1 -0.0175826914366148 14.708 0 23.449863020791625 0 0 0 -42 21 1 0.003543843405838151 16.178800000000003 2.5474999999999994 23.449863020791625 0 0 0 -43 22 1 -0.008930438763612256 14.708000000000002 5.0949 23.449863020791625 0 0 0 -33 17 1 -0.01319754578259268 11.7664 1.7763568394002505e-15 23.449863020791625 0 0 0 -35 18 1 0.005624883561307313 11.7664 5.094900000000001 23.449863020791625 0 0 0 -34 17 1 -0.001833361793814021 13.237200000000001 2.5474999999999994 23.449863020791625 0 0 0 -518 189 4 0.4238 1.7262219883909424 7.436086788297749 20.15214607725663 1 0 0 -101 50 4 0.4238 8.106166655216015 7.636318994291072 18.895600145997378 2 0 0 -517 189 3 -0.8476 0.8975282537764131 7.9667901703236526 19.974321127200675 1 0 0 -150 66 4 0.4238 4.649148498694868 8.243938426512141 19.63710700967118 1 -1 0 -37 19 1 0.008059123604893179 11.7664 10.1898 23.449863020791625 0 0 0 -13 7 1 0.003562500361631949 2.941600000000001 10.1898 23.449863020791625 0 0 0 -4 2 1 0.01118045101209775 1.4708000000000006 7.6424 23.449863020791625 0 0 0 -12 6 1 -0.008187862475270539 4.4124 7.6424 23.449863020791625 0 0 0 -148 66 3 -0.8476 5.168232450516505 9.047906137187535 19.346953256748833 1 -1 0 -5 3 1 0.01564426943939494 1.7763568394002505e-15 10.1898 23.449863020791625 0 0 0 -167 72 4 0.4238 11.942045323115195 5.649130151908711 20.657340273077285 0 0 0 -328 126 3 -0.8476 13.536656944721523 6.706920305720269 20.30923123396737 0 1 0 -329 126 4 0.4238 14.033035625445095 6.901107759295683 21.155340398492882 0 1 0 -330 126 4 0.4238 13.32248868402487 7.565726120598325 19.84383926291113 0 1 0 -28 14 1 0.005135353479473132 10.2956 7.6424 23.449863020791625 0 0 0 -29 15 1 -0.01709114553122559 8.8248 10.1898 23.449863020791625 0 0 0 -20 10 1 0.004420735120240576 7.354000000000001 7.6424 23.449863020791625 0 0 0 -21 11 1 -8.295950892680149e-05 5.8832 10.1898 23.449863020791625 0 0 0 -457 169 3 -0.8476 2.137690785024048 9.831264578841258 16.303498875411698 1 0 0 -573 207 4 0.4238 5.848305837212314 0.1762190034544807 17.17943778184179 2 0 0 -651 233 4 0.4238 14.491471777300028 0.03037914374267814 15.83219648354528 1 0 0 -218 89 4 0.4238 6.5919786085182075 0.9091158018046296 13.131077697911964 0 1 0 -54 27 2 0.009538003210554242 1.4708 12.7373 2.4018 0 0 0 -55 28 2 -0.003172379929243049 0 15.2847 2.4018 0 0 0 -62 31 2 -0.00186117057999337 4.4124 12.7373 2.4018 0 0 0 -63 32 2 0.00758887481169554 2.9416 15.2847 2.4018 0 0 0 -192 80 4 0.4238 4.794387147708667 14.909075171120765 5.419182095600811 0 0 0 -119 56 4 0.4238 3.2500817867314398 11.832800805491306 6.2682928485004785 0 -1 0 -118 56 3 -0.8476 2.709695006424336 11.627182945371326 5.452384520275485 0 -1 0 -191 80 4 0.4238 3.8571863060224443 13.57325796518277 5.356927851433144 0 0 0 -190 80 3 -0.8476 3.8530200194608413 14.572485850889231 5.396004384825564 0 0 0 -98 49 4 0.4238 2.2766564815872377 15.778957767705766 5.556621305001019 1 0 0 -120 56 4 0.4238 1.8997669381619913 12.21338080817393 5.432566828266767 0 -1 0 -97 49 3 -0.8476 1.6582359104391984 16.291326734509507 6.152472357053496 1 0 0 -244 98 3 -0.8476 0.3924528377280096 13.052383693685869 5.275030660375085 0 -1 0 -99 49 4 0.4238 1.9764418005425044 16.22605313800913 7.098245454454695 1 0 0 -631 227 3 -0.8476 8.778943735028687 10.474788944453667 12.685594012363595 -1 0 0 -295 115 3 -0.8476 6.836426798704437 14.252095160705379 5.316785643293747 0 0 0 -296 115 4 0.4238 6.3380790395823565 13.385929350133972 5.27926186731909 0 0 0 -336 128 4 0.4238 9.504568664514785 15.01506830678913 4.725006859909346 0 0 0 -70 35 2 0.01569918460207732 7.354000000000001 12.7373 2.4018 0 0 0 -71 36 2 0.01622723354682065 5.8832 15.2847 2.4018 0 0 0 -78 39 2 0.01233699237017652 10.2956 12.7373 2.4018 0 0 0 -79 40 2 -0.0123167339477786 8.8248 15.2847 2.4018 0 0 0 -334 128 3 -0.8476 9.804960251945063 14.585282143844777 5.576505038341256 0 0 0 -335 128 4 0.4238 10.764689305944286 14.811244909035093 5.743428161519318 0 0 0 -656 235 4 0.4238 11.274876877297288 11.589128799416661 6.812142647899859 0 0 0 -655 235 3 -0.8476 11.388256990917405 11.907831882964768 5.871092838018554 0 0 0 -657 235 4 0.4238 10.511574676431575 12.241068556600506 5.524131235030396 0 0 0 -331 127 3 -0.8476 8.647876026470513 11.72968917644971 5.372752090789252 0 0 0 -225 91 4 0.4238 13.252704815948258 12.484966119923902 5.4991907056523175 -1 -1 0 -223 91 3 -0.8476 14.108667496093203 12.961787209464076 5.699123243872336 -1 -1 0 -86 43 2 0.004517062113848894 13.237200000000001 12.7373 2.4018 0 0 0 -87 44 2 0.001691435347730985 11.7664 15.2847 2.4018 0 0 0 -94 47 2 0.00685931941051703 16.178800000000003 12.7373 2.4018 0 0 0 -95 48 2 0.006949345406057055 14.708000000000002 15.2847 2.4018 0 0 0 -246 98 4 0.4238 0.38146479586720616 13.911666462643149 4.763645752254332 0 -1 0 -224 91 4 0.4238 14.421312095518909 12.71496419083952 6.616368538934622 -1 -1 0 -283 111 3 -0.8476 15.628193884175449 15.67958654625237 5.712183668752193 -1 0 0 -285 111 4 0.4238 15.20823137338435 14.77263604396369 5.744946721536371 -1 0 0 -284 111 4 0.4238 15.39730073469381 16.18406388803546 6.544167099225616 -1 0 0 -135 61 4 0.4238 17.181734297894028 11.50938194605289 5.376919239592664 -1 0 0 -128 59 4 0.4238 12.510696850559 13.400814682569763 12.12154569673403 0 0 0 -641 230 4 0.4238 16.460174864867515 11.555259291722754 11.513987660535511 1 0 0 -694 248 3 -0.8476 5.646664121771563 12.003829343647613 5.265517005823366 1 0 0 -508 186 3 -0.8476 11.874631242554559 19.183954362495257 12.757848230170808 -1 0 0 -365 138 4 0.4238 6.888120955508712 13.350278100146872 11.983484682294058 0 -1 0 -56 28 2 -0.007346483191423765 1.4708 17.8322 2.4018 0 0 0 -64 32 2 -0.007040366496871621 4.4124 17.8322 2.4018 0 0 0 -264 104 4 0.4238 2.890774254525348 19.395952063865504 5.416360014788498 0 -1 0 -262 104 3 -0.8476 1.9229167571391381 19.551713032251147 5.613835629405332 0 -1 0 -303 117 4 0.4238 12.119648008726836 10.348886671661969 8.982817094596912 0 0 0 -263 104 4 0.4238 1.3632164588516946 19.027705040806982 4.971845369641502 0 -1 0 -696 248 4 0.4238 4.931090248366684 11.920720405779006 5.959093966041219 1 0 0 -555 201 4 0.4238 0.1476370801517249 17.587643965474964 5.9820586175388515 1 -1 0 -460 170 3 -0.8476 10.511653292375941 20.36092252510843 9.28183703745981 0 -1 0 -357 135 4 0.4238 5.30802705175001 20.077669929184395 5.47750029282528 0 -1 0 -355 135 3 -0.8476 4.502197418039438 19.485574693167184 5.469578450808493 0 -1 0 -642 230 4 0.4238 17.59514938340467 12.494288109655482 10.809223899354208 1 0 0 -440 163 4 0.4238 6.746420411262218 15.956533676323577 5.22022015080474 0 0 0 -441 163 4 0.4238 5.7446670540994935 16.848265237800078 6.151849013066668 0 0 0 -248 99 4 0.4238 0.19491065621647194 15.263151600771593 12.384493561505723 1 0 0 -439 163 3 -0.8476 6.316582565899266 16.852550879871938 5.331546912613838 0 0 0 -72 36 2 0.007179830066346712 7.354000000000001 17.8322 2.4018 0 0 0 -80 40 2 0.009767193963479517 10.2956 17.8322 2.4018 0 0 0 -593 214 4 0.4238 7.884845767551953 18.242346210560054 5.215564680586794 1 0 0 -592 214 3 -0.8476 8.441708788539396 19.06278952840712 5.34509407825288 1 0 0 -594 214 4 0.4238 9.407518236319975 18.806924915027857 5.3868767845437215 1 0 0 -229 93 3 -0.8476 11.002931909959898 17.85349899482245 5.534832624443298 -1 -1 0 -356 135 4 0.4238 4.727932098205787 18.62143419085674 5.019794724809724 0 -1 0 -443 164 4 0.4238 12.40229864797583 14.881890635527546 6.532324378182912 -1 0 0 -230 93 4 0.4238 11.272239561806135 18.40387542301247 6.325124179849419 -1 -1 0 -442 164 3 -0.8476 12.249392559907344 15.43317503022671 5.712134600968626 -1 0 0 -444 164 4 0.4238 13.129546035940322 15.725685437724305 5.338276770112374 -1 0 0 -231 93 4 0.4238 11.438767335047864 16.955174113268875 5.59016816824532 -1 -1 0 -88 44 2 -0.004661733698708054 13.237200000000001 17.8322 2.4018 0 0 0 -96 48 2 0.004146602187371051 16.178800000000003 17.8322 2.4018 0 0 0 -553 201 3 -0.8476 17.01816778562073 17.995397600438885 5.50550827227041 0 -1 0 -554 201 4 0.4238 16.440634429393626 17.270603716767287 5.129835074976055 0 -1 0 -699 249 4 0.4238 15.700109015732405 19.83239470687886 5.2730815881929605 0 0 0 -247 99 3 -0.8476 17.336782813381703 15.9758100387841 12.86878129068549 0 0 0 -527 192 4 0.4238 8.400400049346944 19.554495577047934 12.685963916073062 0 -1 0 -245 98 4 0.4238 0.14624632377865007 13.228544728434645 6.228106595314394 0 -1 0 -633 227 4 0.4238 7.8446313240677465 10.215293497567252 12.929977075896192 -1 0 0 -123 57 4 0.4238 7.0746556208220435 19.34524620318107 10.872591375491558 0 -1 0 -724 258 3 -0.8476 4.234176441183506 12.039368920513985 7.672701195843418 1 -1 0 -725 258 4 0.4238 4.137223358179028 11.154093396315286 8.127551251299957 1 -1 0 -342 130 4 0.4238 3.3490444756314663 14.507070913866091 7.917816047124389 1 0 0 -340 130 3 -0.8476 2.475251769304553 14.763988319874148 8.330709130564067 1 0 0 -341 130 4 0.4238 2.5667527473696508 14.772232456574866 9.326480518807314 1 0 0 -364 138 3 -0.8476 6.231328463002679 12.764543730928395 11.508572517819397 0 -1 0 -726 258 4 0.4238 4.70687708932946 12.676759931947513 8.28121621344766 1 -1 0 -503 184 4 0.4238 0.626740782878561 12.112155305683151 8.36175181603283 2 0 0 -502 184 3 -0.8476 0.3530019095059348 13.026562250348038 8.063539643828118 2 0 0 -504 184 4 0.4238 1.1590491426400296 13.616383360322493 8.014514200238665 2 0 0 -413 154 4 0.4238 10.310246047781114 12.645425170155443 9.649734635743975 -1 -1 0 -278 109 4 0.4238 2.0689926172355833 13.226423725069202 11.044416560097394 1 0 0 -270 106 4 0.4238 14.518258075018746 16.25012768269104 11.329980010628349 -1 0 0 -719 256 4 0.4238 14.442688875729713 18.00809488214158 8.65135922354247 0 0 0 -132 60 4 0.4238 13.719412563278548 19.25471490200023 12.012858419540821 0 -1 0 -297 115 4 0.4238 7.758248037390944 14.09126118228873 5.669459107658047 0 0 0 -392 147 4 0.4238 8.440775970159434 10.837303720059037 8.832462502385212 1 -1 0 -260 103 4 0.4238 6.064521948562677 13.07373599605862 9.675228220765085 1 0 0 -548 199 4 0.4238 8.329731669573114 16.02435016298476 8.300652493750043 0 0 0 -302 117 4 0.4238 10.534927101610386 10.641668809892366 8.71905928310815 0 0 0 -259 103 3 -0.8476 6.039295026524322 13.683249827267247 8.882849726337565 1 0 0 -261 103 4 0.4238 6.968645563455479 13.97585610861691 8.65769716313075 1 0 0 -640 230 3 -0.8476 16.65021625418278 12.46084907650203 11.134783599664194 1 0 0 -532 194 3 -0.8476 8.625524965508806 14.111716138349044 7.926539176924266 1 -1 0 -235 95 3 -0.8476 2.8058865877200936 17.909202481046883 10.86408017002096 1 -1 0 -533 194 4 0.4238 9.285608328477988 13.74349101780916 8.581291434167639 1 -1 0 -534 194 4 0.4238 9.031378094953077 14.119395432885998 7.012632675162272 1 -1 0 -621 223 4 0.4238 11.759447009759235 16.637770265234245 8.125266626319792 0 -1 0 -121 57 3 -0.8476 7.405164265328445 20.132366073683155 11.393370019265204 0 -1 0 -269 106 4 0.4238 15.69906664349124 15.938606379638701 12.414079729103287 -1 0 0 -265 105 3 -0.8476 13.858511390467266 12.2257643539824 11.862964948226105 1 -1 0 -547 199 3 -0.8476 8.479300024438404 16.994101102650657 8.493567490661286 0 0 0 -619 223 3 -0.8476 11.181389829059919 17.28631938477271 8.620479805635687 0 -1 0 -279 109 4 0.4238 2.3342044958643817 11.616099100570484 10.98832580613683 1 0 0 -293 114 4 0.4238 5.974133299119694 10.444262483041067 10.556494238721228 0 0 0 -695 248 4 0.4238 5.440253808833983 11.395549814498784 4.499102405585278 1 0 0 -494 181 4 0.4238 14.091170402355985 15.83372339966198 8.056796739388613 0 -1 0 -131 60 4 0.4238 14.375504558444222 19.40171818823153 10.52471778468597 0 -1 0 -715 255 3 -0.8476 12.148806693669629 19.94644025668999 7.2400816171341615 1 0 0 -239 96 4 0.4238 15.531142815012778 20.3309642839673 8.438322792523895 0 -1 0 -414 154 4 0.4238 10.783851523474887 13.801560969805426 10.70124633178135 -1 -1 0 -648 232 4 0.4238 13.545815145696485 13.70677775084171 8.047430920645967 1 -1 0 -646 232 3 -0.8476 12.89354184562956 14.45291909331316 8.180909241857698 1 -1 0 -565 205 3 -0.8476 16.571290714132587 15.380788191495872 9.978390686128293 0 0 0 -566 205 4 0.4238 16.486697788555325 14.396887548242892 10.135820192964106 0 0 0 -544 198 3 -0.8476 14.802744123952923 12.494905050684105 8.220714343430616 0 0 0 -546 198 4 0.4238 15.69958392914293 12.648272017127166 8.635636336988226 0 0 0 -545 198 4 0.4238 14.327341303672132 11.766564694345089 8.71418549827662 0 0 0 -495 181 4 0.4238 15.64406667138792 16.008563289169672 8.530685968345766 0 -1 0 -647 232 4 0.4238 12.174548141627941 14.158466532425988 8.81047248263604 1 -1 0 -493 181 3 -0.8476 14.888021746634598 16.43755314652351 8.036353729476255 0 -1 0 -301 117 3 -0.8476 11.444178994842403 10.634235762851835 8.302874111374269 0 0 0 -127 59 3 -0.8476 11.835398099674071 14.130588554568469 12.228336617000755 0 0 0 -266 105 4 0.4238 13.437837209675466 11.718053793881642 11.111124693406984 1 -1 0 -391 147 3 -0.8476 9.099036309266321 11.055510230198061 9.552934514493218 1 -1 0 -465 171 4 0.4238 4.507962365618935 16.739930651989027 12.02419305834093 1 1 0 -333 127 4 0.4238 7.671719130956259 11.719916025379499 5.589601145029327 0 0 0 -366 138 4 0.4238 5.3810066147385625 12.723574451940152 12.033239886655569 0 -1 0 -267 105 4 0.4238 14.695595476843678 12.667206008724747 11.539822065683758 1 -1 0 -157 69 3 -0.8476 5.628213484046431 19.7062241141079 8.476653698924062 0 -1 0 -412 154 3 -0.8476 10.588274339586592 13.60163970345705 9.74115068987977 -1 -1 0 -393 147 4 0.4238 8.752170977546312 10.727795337016143 10.43173357510416 1 -1 0 -405 151 4 0.4238 1.4893493439895436 20.379210451086568 7.3946095610145495 1 -1 0 -448 166 3 -0.8476 2.31094841939137 15.22894706649686 11.40418724815192 1 -1 0 -449 166 4 0.4238 2.4578750502157516 15.152016401940413 12.390338787322065 1 -1 0 -584 211 4 0.4238 7.457640650200761 17.192133224007062 11.208629944424919 0 0 0 -585 211 4 0.4238 7.4183339086411015 17.350678325691767 9.583838609015473 0 0 0 -318 122 4 0.4238 12.677059363876626 10.345851943535926 5.612738242773594 -1 0 0 -450 166 4 0.4238 2.5278285080124174 16.1586189746941 11.106405599802631 1 -1 0 -159 69 4 0.4238 5.396739043963939 19.542646637149865 7.517663044565708 0 -1 0 -277 109 3 -0.8476 1.9668284394083102 12.400955373279421 10.489290044953318 1 0 0 -174 74 4 0.4238 2.093131136233991 20.2908531347256 12.509936900888619 1 -1 0 -158 69 4 0.4238 5.72722641111533 18.830742461490534 8.949654740651088 0 -1 0 -236 95 4 0.4238 2.955886959156451 18.56642796559528 10.125462919315872 1 -1 0 -332 127 4 0.4238 8.992796984842672 10.791435697737592 5.34607589753084 0 0 0 -567 205 4 0.4238 17.492436254495992 15.680156746258747 10.227126720885458 0 0 0 -268 106 3 -0.8476 14.72205779127257 15.84637768385046 12.22186102297119 -1 0 0 -144 64 4 0.4238 11.609867542673534 17.63780259318367 11.964952217223086 0 -1 0 -143 64 4 0.4238 10.437547809860437 16.53467569974479 11.690352189869234 0 -1 0 -620 223 4 0.4238 11.248363625488201 17.110068003656618 9.60254814088919 0 -1 0 -142 64 3 -0.8476 11.326107809904766 16.875494366073085 11.383255826277036 0 -1 0 -129 59 4 0.4238 12.300763358612933 15.015557263662124 12.2446824789516 0 0 0 -549 199 4 0.4238 9.422230282072096 17.23756950681282 8.266389738781958 0 0 0 -583 211 3 -0.8476 6.97427468797035 17.61248426688647 10.440734635242483 0 0 0 -718 256 3 -0.8476 13.966610727938773 18.787186536259128 9.059246432430188 0 0 0 -237 95 4 0.4238 2.482978017919997 18.391152324186773 11.678608951138568 1 -1 0 -462 170 4 0.4238 10.307703252681602 19.40879670268801 9.05410643052076 0 -1 0 -130 60 3 -0.8476 14.46327699006248 19.66514390094484 11.485397145457227 0 -1 0 -720 256 4 0.4238 13.217661837076776 19.070863155758513 8.460408162150607 0 0 0 -383 144 4 0.4238 3.5533021915261043 10.935137256889309 12.654783731389125 0 -1 0 -133 61 3 -0.8476 16.51149780470187 10.788229938237286 5.201627541800947 -1 0 0 -511 187 3 -0.8476 1.1543831961823052 10.310487624376274 8.191850041914243 1 0 0 -134 61 4 0.4238 15.632698323193418 11.200996122194294 4.9621749152925725 -1 0 0 -716 255 4 0.4238 11.626630842918797 20.339515205022618 7.996935994482277 1 0 0 -512 187 4 0.4238 1.567722559344666 10.205106901475968 7.287390743726031 1 0 0 -509 186 4 0.4238 10.912595818989244 19.417924622524666 12.89837775340388 -1 0 0 -568 206 3 -0.8476 6.485313610696203 14.44523352047762 16.559346762808755 1 0 0 -569 206 4 0.4238 5.877025478161448 14.853591461355627 17.239958916387955 1 0 0 -304 118 3 -0.8476 3.972168127351238 15.654660056945955 17.403540948690193 1 -1 0 -305 118 4 0.4238 3.3854131498127042 14.920622411377614 17.06162240739048 1 -1 0 -418 156 3 -0.8476 2.2734537776824832 13.394090298029402 17.756318894272294 0 0 0 -306 118 4 0.4238 3.723466580375299 16.51489113835542 16.958399519713794 1 -1 0 -501 183 4 0.4238 2.8455782661452247 12.338053980852902 14.176040664713545 0 -1 0 -445 165 3 -0.8476 5.729110891648391 12.122083027826067 15.433974986322738 1 -1 0 -463 171 3 -0.8476 4.549155758711698 16.77122254564855 13.022854621887307 1 1 0 -172 74 3 -0.8476 2.0677673094230764 19.527911145364634 13.155909715455525 1 -1 0 -489 179 4 0.4238 14.886763033339717 10.902943702023924 18.70189284494204 1 -1 0 -419 156 4 0.4238 1.6504734693675003 13.234408025086623 18.52208606851008 0 0 0 -446 165 4 0.4238 5.710179429818999 13.041573185918448 15.82663266450181 1 -1 0 -420 156 4 0.4238 3.1335652597928223 12.910968687196343 17.92004363905744 0 0 0 -499 183 3 -0.8476 3.6979504775468945 12.369149009344994 13.654029663057878 0 -1 0 -500 183 4 0.4238 4.473726698288414 12.401810668166792 14.284194212701715 0 -1 0 -250 100 3 -0.8476 7.609604863953975 10.606171102951322 16.945230673113805 0 0 0 -147 65 4 0.4238 13.61668681394621 19.964324916590904 19.533511237350798 0 -1 0 -146 65 4 0.4238 12.536466740647986 19.339889174664197 20.586997674791956 0 -1 0 -570 206 4 0.4238 7.376196607403398 14.262759769403841 16.97532363052286 1 0 0 -323 124 4 0.4238 8.730985930270878 15.01364577963519 18.921207974437056 1 1 0 -324 124 4 0.4238 9.459353552713571 15.212836705232725 17.473301605982858 1 1 0 -322 124 3 -0.8476 8.813624638926065 14.65274321341759 17.992272333045058 1 1 0 -200 83 4 0.4238 10.388442485410472 11.91097015701038 16.806022211892135 -1 0 0 -623 224 4 0.4238 6.927586929691289 14.247240193752283 14.41222893771625 1 -1 0 -551 200 4 0.4238 12.247394341229853 11.259529069604119 14.84681275368594 1 0 0 -201 83 4 0.4238 9.71192070215314 12.977793729481439 17.840834618671714 -1 0 0 -199 83 3 -0.8476 9.899149161698215 12.010006135076521 17.672503104553247 -1 0 0 -312 120 4 0.4238 11.79495765458046 13.369509996222956 18.772893074029064 -1 0 0 -624 224 4 0.4238 7.897178590463072 15.319195662378577 13.652340180508801 1 -1 0 -350 133 4 0.4238 16.208874637827858 18.83362085868009 21.47129005078417 0 -1 0 -126 58 4 0.4238 8.88511907083734 13.272142299537386 13.66818822412786 0 -1 0 -622 224 3 -0.8476 7.593373444769949 14.366747565469286 13.67571894110038 1 -1 0 -550 200 3 -0.8476 11.432996415804167 11.567553927000933 15.33862353821482 1 0 0 -552 200 4 0.4238 10.76952107398665 11.935576775479335 14.687194082211969 1 0 0 -124 58 3 -0.8476 9.764955887504145 12.797152211212811 13.684703994662227 0 -1 0 -145 65 3 -0.8476 13.361959064058402 19.150230676335642 20.05540166992056 0 -1 0 -40 20 1 -0.006425533623795996 13.237200000000001 17.832199999999997 23.449863020791625 0 0 0 -599 216 4 0.4238 15.202481084467259 12.24900078170297 16.690922642575146 0 1 0 -251 100 4 0.4238 8.439342401574516 10.980938867010675 17.358856275145612 0 0 0 -704 251 4 0.4238 16.305154322814072 16.042350718561647 17.631988502422384 1 0 0 -703 251 3 -0.8476 16.0883225484333 16.255856181651623 16.67941162794245 1 0 0 -705 251 4 0.4238 15.715587557055152 15.442833175152185 16.232124973929633 1 0 0 -48 24 1 -0.02029044178834072 16.178800000000003 17.8322 23.449863020791625 0 0 0 -559 203 3 -0.8476 15.105531419639098 13.835234878317607 15.170664799706675 0 -1 0 -561 203 4 0.4238 14.406014847882542 14.34932009538237 14.674283203645347 0 -1 0 -675 241 4 0.4238 17.437788579674944 14.421546806543976 19.79224658208944 1 -1 0 -222 90 4 0.4238 15.365101969084085 15.332074787573918 19.959893780942252 0 0 0 -598 216 3 -0.8476 14.485446191543312 11.647768322089009 17.04360100536762 0 1 0 -177 75 4 0.4238 3.61134855335209 11.579252278014556 19.453192026472223 0 -1 0 -310 120 3 -0.8476 12.381985872710548 13.80369947515285 18.089607987476125 -1 0 0 -458 169 4 0.4238 2.6933087112285694 10.351514807091242 16.952058213771583 1 0 0 -139 63 3 -0.8476 13.691362264873232 10.627931433301129 14.158294798087477 -2 -1 0 -614 221 4 0.4238 11.61650220566129 15.485182333983216 17.966722851607205 1 -1 0 -600 216 4 0.4238 13.914747640475733 11.329877307455188 16.286467756847514 0 1 0 -617 222 4 0.4238 13.259523186751528 14.51825781874507 19.356416644998088 0 -1 0 -311 120 4 0.4238 12.776789012062968 13.102786397427105 17.495594179094766 -1 0 0 -530 193 4 0.4238 1.6281735604033576 12.886011322673935 16.268039063851113 1 0 0 -141 63 4 0.4238 13.630765327041322 11.105034290734396 13.28153613591018 -2 -1 0 -531 193 4 0.4238 0.4467031724535419 12.527812716084183 15.199183538889944 1 0 0 -399 149 4 0.4238 6.486830695241165 16.029581701860693 15.666779418386291 0 -1 0 -380 143 4 0.4238 3.5853869202872657 18.660092474563687 18.603647711199425 1 -1 0 -464 171 4 0.4238 4.023461569086171 16.009792558697868 13.40215734502378 1 1 0 -428 159 4 0.4238 9.469055750500404 10.667524387442267 20.937661270126558 1 -1 0 -397 149 3 -0.8476 6.413895340325838 16.8360319627653 15.07998984725994 0 -1 0 -319 123 3 -0.8476 0.7829907556311054 16.744941337967973 15.272421110502437 1 0 0 -398 149 4 0.4238 5.749127839593244 16.66081301160753 14.353776938898731 0 -1 0 -528 192 4 0.4238 8.975850745071186 20.350056923475165 13.990790392092903 0 -1 0 -321 123 4 0.4238 0.12521342288041218 16.277401530292295 15.862964127879662 1 0 0 -490 180 3 -0.8476 3.125563432540245 18.468684529246257 16.74556745319216 1 -1 0 -491 180 4 0.4238 3.575636793388386 18.624126139932855 15.8662072375943 1 -1 0 -492 180 4 0.4238 2.578632077563288 19.27047397837691 16.986406012030017 1 -1 0 -659 236 4 0.4238 1.0298389225267837 20.168025384298502 20.026919057347232 2 -1 0 -249 99 4 0.4238 0.16814848071124128 16.21206933125259 13.713202558066024 1 0 0 -164 71 4 0.4238 0.5299522359953556 20.257624996360576 17.55648066935482 0 -1 0 -162 70 4 0.4238 16.66913392996693 10.45829253707763 19.795901801640834 0 0 0 -371 140 4 0.4238 11.056255566760345 16.598270748160388 15.718911806822456 0 -1 0 -370 140 3 -0.8476 11.298560558575987 16.404137638756527 14.768331949474652 0 -1 0 -610 220 3 -0.8476 9.182998099495135 16.844324083314575 13.063635808058317 1 -1 0 -154 68 3 -0.8476 9.372552675513472 16.050092330482723 20.09128772182719 0 0 0 -155 68 4 0.4238 9.045313534743997 16.990624622451623 20.000103598074276 0 0 0 -156 68 4 0.4238 10.11796075622463 15.89226417482912 19.443632058888397 0 0 0 -612 220 4 0.4238 9.912940585757283 16.62881769597969 13.71228285972464 1 -1 0 -183 77 4 0.4238 7.463961847985207 18.60237515839614 19.98843047486115 0 -1 0 -629 226 4 0.4238 6.710399312260268 18.123336806911855 16.079630988721004 1 -1 0 -182 77 4 0.4238 7.757164552671424 18.810844945497134 18.395570465863837 0 -1 0 -181 77 3 -0.8476 8.125126014517141 18.452044538789227 19.253401321364763 0 -1 0 -611 220 4 0.4238 8.931884466842028 17.808185361298875 13.152595651819967 1 -1 0 -628 226 3 -0.8476 6.9796091824851425 18.952004521134636 16.570383047183572 1 -1 0 -630 226 4 0.4238 7.708609412032784 19.4156379445819 16.06679113644326 1 -1 0 -487 179 3 -0.8476 15.066619024936566 10.249951535799466 19.437593400150895 1 -1 0 -526 192 3 -0.8476 9.129233109396537 19.581112471942753 13.37014199224269 0 -1 0 -151 67 3 -0.8476 17.426283060222275 19.58522448708249 14.435121464885997 -2 -2 0 -160 70 3 -0.8476 0.01506610403255687 10.548473719534147 19.830294631268465 1 0 0 -351 133 4 0.4238 15.056477500508233 18.63959592950024 20.330692470756837 0 -1 0 -372 140 4 0.4238 12.170052868259033 16.843340153646995 14.550139731531836 0 -1 0 -473 174 4 0.4238 14.26517035940876 17.98252701799394 14.507717382131688 0 -1 0 -669 239 4 0.4238 15.647005666799474 17.715015917343795 16.152341030706786 1 0 0 -220 90 3 -0.8476 16.219792055920426 15.707023482600887 19.60084001936226 0 0 0 -221 90 4 0.4238 16.33803818547856 16.64326825776226 19.931693947174367 0 0 0 -349 133 3 -0.8476 16.000726312606744 18.426710693303725 20.581851466927844 0 -1 0 -176 75 4 0.4238 4.728802867281302 10.760075907012997 18.588971835799967 0 -1 0 -472 174 3 -0.8476 13.537149582394218 17.542196784550853 13.982262808143558 0 -1 0 -286 112 3 -0.8476 12.565689798467716 18.517223262424135 17.37055509192227 0 -1 0 -287 112 4 0.4238 12.767092649586525 18.693595832778726 18.334054128623215 0 -1 0 -288 112 4 0.4238 13.312023375950227 18.86734630158713 16.80451492455031 0 -1 0 -667 239 3 -0.8476 15.34738402069065 18.575704886300255 15.74070654907211 1 0 0 -557 202 4 0.4238 2.0877847893502692 15.917637143334856 14.598779519777349 1 0 0 -668 239 4 0.4238 16.102271316982648 18.97804359363653 15.222758820554837 1 0 0 -233 94 4 0.4238 16.939408664150182 19.300736366917782 19.285818625681394 0 -1 0 -232 94 3 -0.8476 17.251185745369266 20.17960735549295 18.92473073318461 0 -1 0 -556 202 3 -0.8476 2.5142033450925534 15.10859384094593 14.194283647198105 1 0 0 -613 221 3 -0.8476 11.029798398400157 16.24252383347896 17.67998671968566 1 -1 0 -615 221 4 0.4238 11.597398207517758 17.002005745636787 17.362143868985218 1 -1 0 -447 165 4 0.4238 6.2756188615712825 11.521571558695248 16.017683721626977 1 -1 0 -453 167 4 0.4238 3.215029455130721 15.987095453067399 19.079850682663047 0 0 0 -452 167 4 0.4238 2.0544632500236664 15.323519686230991 20.017604338312154 0 0 0 -451 167 3 -0.8476 2.772338132809199 16.01844856447551 19.975979335062384 0 0 0 -427 159 3 -0.8476 10.261611448686569 11.049130758551382 20.462021892602714 1 -1 0 -429 159 4 0.4238 10.007428161019474 11.279799732432494 19.52277538343466 1 -1 0 -14 7 1 0.003164654221259076 4.4124 12.7373 23.449863020791625 0 0 0 -7 4 1 0.009893054359739757 1.7763568394002505e-15 15.2847 23.449863020791625 0 0 0 -6 3 1 0.007054820838538483 1.4708000000000014 12.7373 23.449863020791625 0 0 0 -15 8 1 0.01742682861283385 2.941600000000001 15.2847 23.449863020791625 0 0 0 -410 153 4 0.4238 10.111531319873574 14.412553872150411 20.82849386163515 1 -1 0 -411 153 4 0.4238 10.469141456583753 12.84237118855151 21.09917747701026 1 -1 0 -23 12 1 0.002267061274119069 5.8832 15.2847 23.449863020791625 0 0 0 -22 11 1 -0.00588542885415537 7.354000000000001 12.7373 23.449863020791625 0 0 0 -31 16 1 0.004565600593305302 8.8248 15.2847 23.449863020791625 0 0 0 -30 15 1 -0.005925222637524864 10.2956 12.737299999999998 23.449863020791625 0 0 0 -409 153 3 -0.8476 10.837769824697997 13.725395752659518 20.80869263231772 1 -1 0 -674 241 4 0.4238 0.39525518297454587 12.95332622295135 20.169962624276398 2 -1 0 -673 241 3 -0.8476 0.6270046999503937 13.886923561797822 19.896670228457296 2 -1 0 -616 222 3 -0.8476 13.68828360729474 14.607480608256637 20.25542035696146 0 -1 0 -618 222 4 0.4238 12.980122773618541 14.639356060980928 20.960754364272496 0 -1 0 -47 24 1 0.007459299037120008 14.708000000000002 15.284699999999999 23.449863020791625 0 0 0 -39 20 1 0.003376862325317847 11.7664 15.2847 23.449863020791625 0 0 0 -46 23 1 0.009768162996603134 16.178800000000003 12.737299999999998 23.449863020791625 0 0 0 -38 19 1 0.011451708519644 13.237200000000001 12.7373 23.449863020791625 0 0 0 -529 193 3 -0.8476 1.4045836747088354 12.797677923854442 15.297364918402971 1 0 0 -379 143 3 -0.8476 3.6479330411961883 18.493128836123883 19.58762503197076 1 -1 0 -165 71 4 0.4238 0.6364380304987282 20.088673926904107 15.935757183747858 0 -1 0 -660 236 4 0.4238 2.12389322021301 19.263967819272075 20.834602549240042 2 -1 0 -658 236 3 -0.8476 1.5737386108979707 20.098541840243776 20.86318845039298 2 -1 0 -560 203 4 0.4238 15.394781076902573 13.050765407651904 14.622081620313322 0 -1 0 -381 143 4 0.4238 3.2550133288406142 17.598298120219788 19.799504375422842 1 -1 0 -125 58 4 0.4238 10.47743096516406 13.402844176984058 13.330419032611076 0 -1 0 -506 185 4 0.4238 17.00798692793307 10.56073453324316 15.263209711132241 -1 0 0 -8 4 1 0.007878856031568425 1.4708000000000023 17.8322 23.449863020791625 0 0 0 -16 8 1 -0.02162051739161995 4.412400000000001 17.8322 23.449863020791625 0 0 0 -454 168 3 -0.8476 6.1211530914480035 18.877217060758102 21.057303091018483 1 0 0 -455 168 4 0.4238 6.016004433060814 18.378364098649328 21.91758892263117 1 0 0 -456 168 4 0.4238 5.249585193480707 18.883650340743063 20.567064277406875 1 0 0 -24 12 1 -0.02105358127656316 7.354000000000001 17.8322 23.449863020791625 0 0 0 -32 16 1 -8.633878219141563e-05 10.2956 17.8322 23.449863020791625 0 0 0 -474 174 4 0.4238 13.940539993728047 16.977316374214087 13.262406896868265 0 -1 0 -320 123 4 0.4238 0.45185935575146113 17.666250404746776 15.068591299890938 1 0 0 -173 74 4 0.4238 2.7498380997441414 19.67489584208449 13.872273730507478 1 -1 0 -175 75 3 -0.8476 4.212203814165672 11.613788132755259 18.65457863001542 0 -1 0 -152 67 4 0.4238 0.6848929361146843 19.37421734773228 14.07318618999465 -1 -2 0 -505 185 3 -0.8476 16.758143951478264 11.211629355559246 14.546329703315896 -1 0 0 -558 202 4 0.4238 2.2322174055594726 14.29431286166049 14.701660067407344 1 0 0 -510 186 4 0.4238 12.208040730030191 18.659648620639253 13.541393467576771 -1 0 0 -374 141 4 0.4238 9.497589320200765 19.8441690425366 18.526563503706242 1 -1 0 -153 67 4 0.4238 16.840552768523775 19.914595574397616 13.694556413474471 -2 -2 0 -163 71 3 -0.8476 1.137603810251879 20.333101852965335 16.765870695643105 0 -1 0 -507 185 4 0.4238 16.68943419233681 10.7331700931247 13.670909273297896 -1 0 0 -632 227 4 0.4238 9.059492914790276 11.263838240899624 13.232125352935022 -1 0 0 +49 25 2 0.01313937832121366 0 0 2.4018 0 0 0 +50 25 2 0.01865462761144026 1.4708 2.5475 2.4018 0 0 0 +51 26 2 0.01215067828938248 0 5.0949 2.4018 0 0 0 +57 29 2 -0.003610807073483032 2.9416 0 2.4018 0 0 0 +58 29 2 0.005703013773218414 4.4124 2.5475 2.4018 0 0 0 +59 30 2 0.01492950075159763 2.9416 5.0949 2.4018 0 0 0 +170 73 4 0.4238 1.1970063131417725 4.448138656468396 5.466951657599895 0 0 0 +65 33 2 -0.01336008416568608 5.8832 0 2.4018 0 0 0 +66 33 2 0.008131464922511046 7.354000000000001 2.5475 2.4018 0 0 0 +67 34 2 0.006428627158081519 5.8832 5.0949 2.4018 0 0 0 +73 37 2 0.01530290922280649 8.8248 0 2.4018 0 0 0 +74 37 2 0.0178705863531212 10.2956 2.5475 2.4018 0 0 0 +75 38 2 0.01605820740803012 8.8248 5.0949 2.4018 0 0 0 +339 129 4 0.4238 6.215143407565153 1.5981782348074796 4.622256839105766 0 1 0 +655 235 3 -0.8476 8.476564900511942 1.2821844087742245 5.337051952010723 0 0 0 +219 89 4 0.4238 10.502021333726653 3.7021423103868947 5.7312543103421625 0 0 0 +81 41 2 0.003821352996929769 11.7664 0 2.4018 0 0 0 +82 41 2 0.0122499340344385 13.237200000000001 2.5475 2.4018 0 0 0 +83 42 2 0.02008338572547091 11.7664 5.0949 2.4018 0 0 0 +89 45 2 -0.00220016637598902 14.708000000000002 0 2.4018 0 0 0 +90 45 2 0.01916344106292139 16.178800000000003 2.5475 2.4018 0 0 0 +91 46 2 0.01585713186018216 14.708000000000002 5.0949 2.4018 0 0 0 +422 157 4 0.4238 12.182185463466961 1.5623973821830206 4.952119670183798 -1 0 0 +311 120 4 0.4238 16.230200660164634 0.5697212073154095 5.261903478511206 -1 1 0 +121 57 3 -0.8476 14.928965974853021 3.8320491507582126 5.646357258624189 -1 0 0 +122 57 4 0.4238 15.663742089675145 4.504768415478503 5.559442077530576 -1 0 0 +52 26 2 0.009929698685546195 1.4708 7.6424 2.4018 0 0 0 +53 27 2 0.01070160392393697 0 10.1898 2.4018 0 0 0 +60 30 2 0.002065168034918851 4.4124 7.6424 2.4018 0 0 0 +61 31 2 0.008604633418259809 2.9416 10.1898 2.4018 0 0 0 +279 109 4 0.4238 4.3692626624440685 8.41895331852646 5.3396246864177614 0 0 0 +371 140 4 0.4238 2.4486062593013034 6.793479221771884 5.5865046284837065 0 0 0 +68 34 2 0.004714971778387275 7.354000000000001 7.6424 2.4018 0 0 0 +69 35 2 0.003924637444139914 5.8832 10.1898 2.4018 0 0 0 +76 38 2 0.007917285397572442 10.2956 7.6424 2.4018 0 0 0 +77 39 2 -0.01808660951169254 8.8248 10.1898 2.4018 0 0 0 +485 178 4 0.4238 10.14363196358318 10.102798405663004 4.167302462597097 0 -1 0 +408 152 4 0.4238 9.38291263437119 5.564927602775459 5.045183595795903 0 0 0 +84 42 2 0.01241966874518944 13.237200000000001 7.6424 2.4018 0 0 0 +85 43 2 -0.01817868841189527 11.7664 10.1898 2.4018 0 0 0 +92 46 2 0.009203470152072506 16.178800000000003 7.6424 2.4018 0 0 0 +93 47 2 0.01207830870567194 14.708000000000002 10.1898 2.4018 0 0 0 +693 247 4 0.4238 11.759233893108473 9.14080805374956 4.994613485874183 0 0 0 +691 247 3 -0.8476 12.619729421525784 8.811154786831024 5.383042455327591 0 0 0 +54 27 2 0.005629728388362503 1.4708 12.7373 2.4018 0 0 0 +55 28 2 0.002513408296186064 0 15.2847 2.4018 0 0 0 +62 31 2 0.003092652587940009 4.4124 12.7373 2.4018 0 0 0 +63 32 2 0.008508558468704444 2.9416 15.2847 2.4018 0 0 0 +537 195 4 0.4238 1.534381720252049 11.860861719269268 6.542947084634663 1 0 0 +536 195 4 0.4238 2.676602707730869 11.479113232811624 5.440118771886036 1 0 0 +70 35 2 0.02093416092812059 7.354000000000001 12.7373 2.4018 0 0 0 +71 36 2 0.0162835107880356 5.8832 15.2847 2.4018 0 0 0 +78 39 2 0.005658666939466993 10.2956 12.7373 2.4018 0 0 0 +79 40 2 0.01444653211523109 8.8248 15.2847 2.4018 0 0 0 +212 87 4 0.4238 9.17689647437603 12.056181317800215 5.899700054352701 -1 0 0 +197 82 4 0.4238 10.811203724884162 14.938620779548806 5.143521101460397 -1 0 0 +213 87 4 0.4238 9.916127809741116 13.253540453299259 5.071149368154535 -1 0 0 +211 87 3 -0.8476 9.032071730946864 12.857093231537508 5.318694103871617 -1 0 0 +531 193 4 0.4238 12.030992283922586 12.605823554960878 5.100034965099747 0 0 0 +86 43 2 0.005023636657948909 13.237200000000001 12.7373 2.4018 0 0 0 +87 44 2 -0.008143953810172733 11.7664 15.2847 2.4018 0 0 0 +94 47 2 0.01565233889388304 16.178800000000003 12.7373 2.4018 0 0 0 +95 48 2 -0.0009568931481186349 14.708000000000002 15.2847 2.4018 0 0 0 +173 74 4 0.4238 14.607048329829912 14.709369240727511 5.225217921443813 -1 0 0 +529 193 3 -0.8476 11.686238647240836 13.533907397787061 5.240770699213196 0 0 0 +56 28 2 0.02451397099577675 1.4708 17.8322 2.4018 0 0 0 +64 32 2 0.0004346307116607769 4.4124 17.8322 2.4018 0 0 0 +549 199 4 0.4238 2.8035257638796756 19.94451746271372 5.290160967083597 0 -1 0 +547 199 3 -0.8476 3.220242278418862 19.03563378790663 5.306889171843751 0 -1 0 +425 158 4 0.4238 2.2192904250669567 17.674274362104903 5.45770242867776 0 0 0 +72 36 2 -0.01170623458315166 7.354000000000001 17.8322 2.4018 0 0 0 +80 40 2 -0.003752064366203554 10.2956 17.8322 2.4018 0 0 0 +584 211 4 0.4238 11.447564153441556 19.671954191394008 5.093755855325763 0 0 0 +512 187 4 0.4238 8.000288495265798 18.140951857955233 4.574866834804232 0 -1 0 +351 133 4 0.4238 7.438947477451015 14.722835533994202 5.283284390297782 0 -1 0 +350 133 4 0.4238 8.678274881612676 15.784894198802297 5.335518060454404 0 -1 0 +88 44 2 -0.01375822979594546 13.237200000000001 17.8322 2.4018 0 0 0 +96 48 2 -0.002740917165010555 16.178800000000003 17.8322 2.4018 0 0 0 +458 169 4 0.4238 3.421534555503742 1.4200532895040254 5.205718648604084 -1 1 0 +683 244 4 0.4238 3.567476599791179 4.781786128581657 5.5628705767985975 0 1 0 +337 129 3 -0.8476 5.3595063418125735 1.756185300491631 5.115126186134353 0 1 0 +338 129 4 0.4238 5.103160503829063 2.7196512122815215 5.037493926885174 0 1 0 +682 244 3 -0.8476 4.375390642381924 4.307521060869852 5.213087037727385 0 1 0 +348 132 4 0.4238 3.382593086797166 2.6582649725340324 8.899394163639482 -1 0 0 +457 169 3 -0.8476 2.5460133336841064 1.2725516181617833 5.665834465490807 -1 1 0 +459 169 4 0.4238 2.589096641757538 1.6467500485588584 6.592182668049703 -1 1 0 +561 203 4 0.4238 5.34134772960545 2.295447087726068 9.507163619354456 1 1 0 +477 175 4 0.4238 1.1383794820837874 2.252829548411057 5.551788680212561 0 0 0 +346 132 3 -0.8476 2.621854939654064 2.2807187162263123 8.371434688851567 -1 0 0 +347 132 4 0.4238 1.7577917835720536 2.6237577368523186 8.739836673923394 -1 0 0 +383 144 4 0.4238 2.013751021656296 5.7853836770492775 8.820622894619671 0 0 0 +559 203 3 -0.8476 4.88356003957368 3.182230159728057 9.570778035270529 1 1 0 +475 175 3 -0.8476 0.4441306060454029 2.969095805500066 5.4811598260455865 0 0 0 +684 244 4 0.4238 5.088994528516322 4.975670185205686 5.002495896526019 0 1 0 +384 144 4 0.4238 0.5852422497137534 5.010166403151444 8.97882465943909 0 0 0 +446 165 4 0.4238 16.969963796078353 2.624650344678554 9.438794114735915 0 1 0 +445 165 3 -0.8476 17.46800479622538 3.4190272308822935 9.786532112927045 0 1 0 +133 61 3 -0.8476 4.876806410111092 0.32439160649893634 11.376006535574295 0 0 0 +169 73 3 -0.8476 1.674583456761345 5.262162719784211 5.7975370973848515 0 0 0 +382 144 3 -0.8476 1.069182487281893 5.739688687583618 8.495501784676557 0 0 0 +171 73 4 0.4238 1.3106640973137187 5.521867623412742 6.69202978450027 0 0 0 +187 79 3 -0.8476 16.62720577119881 0.930326042887631 8.54479026588559 0 0 0 +497 182 4 0.4238 7.839378997418928 3.3814437841168177 6.16452533621845 0 0 0 +657 235 4 0.4238 9.272031090332927 1.83712209050886 5.580522819358505 0 0 0 +496 182 3 -0.8476 8.158502438157697 4.1808456808602115 5.655489718055916 0 0 0 +560 203 4 0.4238 5.558544167193662 3.9135595468724897 9.473032422600387 1 1 0 +134 61 4 0.4238 5.572966567570519 0.36773706388079447 10.659428961782988 0 0 0 +320 123 4 0.4238 6.060161805639105 0.42325179488669523 8.102448068005529 -1 0 0 +100 50 3 -0.8476 6.756557578146551 5.071855368999333 9.86032571931797 0 -1 0 +319 123 3 -0.8476 6.2976701265986375 0.9111688382417715 8.94240786444143 -1 0 0 +218 89 4 0.4238 11.919622768934 3.042196618470905 6.201897890908077 0 0 0 +217 89 3 -0.8476 11.091533855644208 2.897504314620502 5.660292882238534 0 0 0 +498 182 4 0.4238 7.39235181929264 4.804271861585367 5.499427861231793 0 0 0 +673 241 3 -0.8476 8.72132440503013 2.982111010693392 8.479197221282682 0 0 0 +675 241 4 0.4238 9.472560847985294 3.63799712476457 8.553089388517241 0 0 0 +315 121 4 0.4238 9.783618797865904 1.3565381734610216 8.142854277918985 -1 0 0 +313 121 3 -0.8476 10.641087985568811 0.8450915924487797 8.199185616935535 -1 0 0 +656 235 4 0.4238 8.705311185196425 0.3130981855681743 5.429503199432064 0 0 0 +321 123 4 0.4238 7.291857043575641 0.9958524437618977 9.008915498770374 -1 0 0 +314 121 4 0.4238 11.392357550719073 1.4165705546620657 7.869018352891692 -1 0 0 +101 50 4 0.4238 7.602696291781229 5.018646345700789 10.390630557572885 0 -1 0 +428 159 4 0.4238 13.536294651585951 5.130827955800905 5.52874090365456 0 0 0 +476 175 4 0.4238 17.183591503992144 2.557510755197463 5.532274212078341 -1 0 0 +423 157 4 0.4238 12.915229636213642 0.7721644033966159 6.178824792641202 -1 0 0 +421 157 3 -0.8476 12.792647828079465 0.8059591347522885 5.186940887095969 -1 0 0 +501 183 4 0.4238 13.941179643749352 5.35062707289763 10.498878569878066 -1 0 0 +312 120 4 0.4238 14.692034430136435 0.8895962070881698 4.816534411636045 -1 1 0 +591 213 4 0.4238 13.351071847481165 2.941187861887174 8.418048382553936 -1 1 0 +310 120 3 -0.8476 15.567234528236744 1.2957664610552069 5.07931259036294 -1 1 0 +589 213 3 -0.8476 13.12753273250181 2.720571025556741 7.46864676879339 -1 1 0 +590 213 4 0.4238 13.75501355893383 3.203248562648256 6.857668437181667 -1 1 0 +123 57 4 0.4238 15.254810307885181 2.9401558436833777 5.332733604019717 -1 0 0 +462 170 4 0.4238 13.399880789358258 0.5612397722346458 8.301937028492524 0 1 0 +460 170 3 -0.8476 13.830254350542669 20.21339558773755 7.767789683970099 0 0 0 +500 183 4 0.4238 15.139101303003244 5.143764226309559 9.408548650472385 -1 0 0 +499 183 3 -0.8476 14.313107519347962 4.738870829320874 9.800718744114604 -1 0 0 +461 170 4 0.4238 13.806841757790728 19.35964290602946 8.287945657181965 0 0 0 +642 230 4 0.4238 13.924828446037314 3.192103166011166 10.042815337098027 0 0 0 +188 79 4 0.4238 15.651878359345202 0.7202970936706271 8.476773709300652 0 0 0 +189 79 4 0.4238 17.119731934741303 0.46913940826563705 7.806733913984351 0 0 0 +372 140 4 0.4238 2.1559098027054806 8.390680329253254 5.759435884286429 0 0 0 +277 109 3 -0.8476 5.251725056849934 8.853277180020518 5.159004549432832 0 0 0 +370 140 3 -0.8476 2.8628007492845517 7.683568349352478 5.7767294855350775 0 0 0 +156 68 4 0.4238 2.8150852986677677 8.399635697634759 8.775609296767776 -1 0 0 +155 68 4 0.4238 3.5682284865582092 7.799323343928108 7.456885546869966 -1 0 0 +154 68 3 -0.8476 3.6941121125704357 8.105231498558357 8.400588181078405 -1 0 0 +344 131 4 0.4238 5.851495590776306 7.610268020195233 8.303410633066342 -1 1 0 +276 108 4 0.4238 0.6295214161994077 7.955800732747191 9.476625658579314 0 0 0 +278 109 4 0.4238 5.108434652534757 9.815403980808044 4.927098708630241 0 0 0 +316 122 3 -0.8476 0.6785550047344096 9.233352412166546 5.294545132789045 0 0 0 +317 122 4 0.4238 17.343772536332082 9.247243955744489 5.117929828541656 -1 0 0 +274 108 3 -0.8476 1.151091478343952 8.802133590012104 9.584730954699129 0 0 0 +254 101 4 0.4238 1.4047672246121385 10.402717047765396 8.849432253625244 -2 -1 0 +404 151 4 0.4238 4.348339388021353 9.732964506609658 8.16305825421071 0 0 0 +253 101 3 -0.8476 1.5634005715993873 11.349547396690783 8.56951677399392 -2 -1 0 +296 115 4 0.4238 6.049974642770434 7.005961379640421 4.760383889102717 1 0 0 +407 152 4 0.4238 10.893684166125988 6.183904655316318 5.0778448895518 0 0 0 +406 152 3 -0.8476 9.92212042239337 6.395593944326714 5.18392681258845 0 0 0 +695 248 4 0.4238 7.072663419111676 8.755492401905604 5.307222408462379 0 0 0 +295 115 3 -0.8476 6.42489326521015 6.192180884716901 5.204455031976987 1 0 0 +153 67 4 0.4238 8.779210794637798 8.625421447058493 9.803957094562449 0 0 0 +151 67 3 -0.8476 8.660365397175308 8.533072250541817 8.815347887838605 0 0 0 +102 50 4 0.4238 6.676968470482932 5.980291172533071 9.449942413306985 0 -1 0 +343 131 3 -0.8476 6.6877815390881965 7.227331943962429 7.910999439459834 -1 1 0 +345 131 4 0.4238 7.4737844847511195 7.770043673650436 8.20708275884543 -1 1 0 +297 115 4 0.4238 6.548167486855295 6.371956103800878 6.180408248088382 1 0 0 +696 248 4 0.4238 8.407631718052315 7.937841760258333 5.771911245838207 0 0 0 +266 105 4 0.4238 10.125527147142027 5.899881907831837 7.700846235464896 0 -1 0 +694 248 3 -0.8476 8.021629398317938 8.84590763177934 5.6093675780004055 0 0 0 +152 67 4 0.4238 8.930290303293235 9.384773358194789 8.366185469432219 0 0 0 +486 178 4 0.4238 9.673896467385871 9.736202026628838 5.687691405424343 0 -1 0 +479 176 4 0.4238 6.671283907606323 10.929283909165283 7.536694131524121 0 -1 0 +108 52 4 0.4238 15.689686278000234 9.852886126152223 5.073893956070031 -1 -1 0 +318 122 4 0.4238 1.04516399602464 10.160036886043383 5.211735941197096 0 0 0 +429 159 4 0.4238 13.04775836664228 6.686508044310339 5.44031754428302 0 0 0 +265 105 3 -0.8476 10.636090713378708 5.1967298416607415 8.195726948026525 0 -1 0 +267 105 4 0.4238 11.616401875422898 5.375514677179539 8.111892329040971 0 -1 0 +104 51 4 0.4238 17.29639938634143 6.658767486997808 5.41697244336261 -1 -1 0 +106 52 3 -0.8476 15.312852705388183 8.952159621375953 5.289971412067087 -1 -1 0 +107 52 4 0.4238 14.314625041523152 8.988401490112066 5.242720370467341 -1 -1 0 +427 159 3 -0.8476 12.76581221568869 5.734250348907851 5.323218772008595 0 0 0 +563 204 4 0.4238 13.048980959535292 7.888697741575689 8.480878050559213 1 0 0 +562 204 3 -0.8476 12.227040593668018 8.000330933842479 7.922350810547911 1 0 0 +564 204 4 0.4238 11.732672557134151 8.818271900064063 8.216584527290978 1 0 0 +692 247 4 0.4238 12.439249191460995 8.35687647064915 6.255429527858298 0 0 0 +105 51 4 0.4238 15.7644057782206 7.2206968932244315 5.479087533550543 -1 -1 0 +103 51 3 -0.8476 16.34172803824704 6.410609804322348 5.581353946690772 -1 -1 0 +233 94 4 0.4238 15.831459483890962 6.3443425412232815 7.506676348102655 -1 -1 0 +234 94 4 0.4238 17.207197138288947 6.58665183662654 8.352406396337843 -1 -1 0 +232 94 3 -0.8476 16.237496094503037 6.821730002360146 8.285930002143425 -1 -1 0 +568 206 3 -0.8476 14.436802869756018 8.066379237357582 9.656320010860052 0 1 0 +570 206 4 0.4238 15.171464425763704 7.7573845547850455 9.052336493827966 0 1 0 +206 85 4 0.4238 13.135819254007934 10.504053706053634 5.840839099898824 -1 0 0 +569 206 4 0.4238 14.82053541511776 8.63463863870175 10.384216696867258 0 1 0 +449 166 4 0.4238 4.0285958260301316 15.343584351945665 5.674729337450389 1 0 0 +535 195 3 -0.8476 1.7311902045688985 11.779756585356743 5.565865309159913 1 0 0 +111 53 4 0.4238 0.5647210915819924 13.356388391731127 5.427024712740609 0 -1 0 +713 254 4 0.4238 5.114864454323739 12.17254541331872 5.344615097885859 0 0 0 +450 166 4 0.4238 3.321354127455215 13.96810057745761 5.1508197883186915 1 0 0 +712 254 3 -0.8476 4.420471355693568 11.461671518193928 5.456320210128772 0 0 0 +405 151 4 0.4238 4.529002172190804 11.144785520432174 8.963526376822028 0 0 0 +448 166 3 -0.8476 3.1614736111076764 14.853064880509136 5.58817173281572 1 0 0 +403 151 3 -0.8476 4.618417094929696 10.69190038264696 8.076452136710195 0 0 0 +714 254 4 0.4238 4.306261868188604 11.257121809283122 6.428491588117838 0 0 0 +650 233 4 0.4238 0.8261337305710591 15.272855563227955 11.422916396063492 0 0 0 +651 233 4 0.4238 1.66943487046593 14.509581557091455 10.251214842599271 0 0 0 +175 75 3 -0.8476 17.172315219972358 13.599797919951236 8.480240037975031 -1 0 0 +255 101 4 0.4238 2.111601727879556 11.815127535788964 9.264292189404564 -2 -1 0 +669 239 4 0.4238 1.32441182429345 14.440534331535007 8.119698252001108 0 -1 0 +176 75 4 0.4238 16.919992058996513 13.7590598745656 7.525792869934411 -1 0 0 +177 75 4 0.4238 0.14212439820882036 12.816487336818591 8.535057539477759 0 0 0 +426 158 4 0.4238 2.0148349179214744 16.05958673041296 5.325003286853482 0 0 0 +667 239 3 -0.8476 2.1848064397683484 14.772802155555862 8.50611755159529 0 -1 0 +668 239 4 0.4238 2.826360435363054 14.975159669662883 7.766211372331817 0 -1 0 +484 178 3 -0.8476 10.357631689874177 10.215682706838484 5.137593326285856 0 -1 0 +515 188 4 0.4238 7.237271230821362 13.016850696588378 6.291233855537184 0 -1 0 +514 188 3 -0.8476 6.302362345803112 13.314909166429452 6.098601687369539 0 -1 0 +516 188 4 0.4238 5.9159319591680255 13.747530614580732 6.913164684522444 0 -1 0 +478 176 3 -0.8476 7.649517829269427 10.723084115514967 7.513436353460663 0 -1 0 +480 176 4 0.4238 7.821442293527245 9.997393515338612 6.84724073071097 0 -1 0 +375 141 4 0.4238 8.262201775857786 12.681244389980177 7.985174959835936 -1 -1 0 +373 141 3 -0.8476 8.351343481979528 13.360278166139022 8.713854172750194 -1 -1 0 +127 59 3 -0.8476 9.725571949589012 15.799965406891792 8.639971492004653 -1 -1 0 +129 59 4 0.4238 9.383943626176912 14.910368743084565 8.943138729244842 -1 -1 0 +128 59 4 0.4238 9.78187897329827 15.812796452465063 7.641639904254624 -1 -1 0 +670 240 3 -0.8476 10.876081158438845 10.214147348206216 8.664462055509786 0 0 0 +716 255 4 0.4238 6.5227205557849794 14.51639237254202 9.157695237319166 0 1 0 +715 255 3 -0.8476 5.656410068931462 14.74288667317751 8.712490382023443 0 1 0 +717 255 4 0.4238 5.396715203220265 15.679952244365603 8.945875797043128 0 1 0 +374 141 4 0.4238 8.147095087998556 12.932874656872187 9.594542632899609 -1 -1 0 +690 246 4 0.4238 16.316627758868375 12.417272105899405 5.609830556023115 1 -1 0 +688 246 3 -0.8476 15.88450022727728 11.563228829395056 5.3202165565601955 1 -1 0 +110 53 4 0.4238 17.403222143019665 14.771437036588974 5.50894993304906 -1 -1 0 +530 193 4 0.4238 12.455252864940926 14.171237812645117 5.290056431143296 0 0 0 +672 240 4 0.4238 10.93446456953076 11.130757013043066 8.268964586777383 0 0 0 +606 218 4 0.4238 13.696925311062042 12.016193744415892 9.42033448199557 0 -1 0 +604 218 3 -0.8476 13.199097784370716 12.175725911474224 8.567856309628706 0 -1 0 +689 246 4 0.4238 14.951805886784305 11.52332053618768 5.678670862924324 1 -1 0 +109 53 3 -0.8476 17.44518184821449 13.833335825788478 5.852765063356562 -1 -1 0 +205 85 3 -0.8476 13.408638554629501 11.443690849497175 6.047363985992727 -1 0 0 +207 85 4 0.4238 13.219352634578524 11.642002996511048 7.009051887823537 -1 0 0 +605 218 4 0.4238 12.764432567986548 13.075775194143777 8.599132109124211 0 -1 0 +113 54 4 0.4238 11.526752853301545 15.360710840693375 9.023317467071111 -2 -1 0 +503 184 4 0.4238 14.318784694441247 15.15739959317121 8.815434883619313 0 -1 0 +112 54 3 -0.8476 12.463653527967322 15.164318472108 9.31253609220812 -2 -1 0 +719 256 4 0.4238 16.762922728615607 13.882542054852971 10.562472020809135 0 -1 0 +114 54 4 0.4238 12.555583410102484 15.34717931689137 10.291367658555105 -2 -1 0 +618 222 4 0.4238 6.148311559852576 16.02626161022556 5.608753804443583 0 -1 0 +548 199 4 0.4238 4.155001768830376 19.091027507803666 4.955952128009002 0 -1 0 +711 253 4 0.4238 0.956245615044033 20.16155734765175 5.837829871650892 0 0 0 +125 58 4 0.4238 3.7327483205332106 19.623338975867025 7.74099072648916 0 -2 0 +124 58 3 -0.8476 3.0946065332880934 19.44476887418889 8.489916040495311 0 -2 0 +126 58 4 0.4238 2.6716481257293134 20.30346156454942 8.779319328513571 0 -2 0 +617 222 4 0.4238 5.234073045261178 17.301463815054312 6.0611421474634195 0 -1 0 +534 194 4 0.4238 5.69636760733354 0.22016688690531758 5.87928032633577 0 1 0 +467 172 4 0.4238 4.410552940319404 18.162358205230102 8.85743528851177 0 -1 0 +616 222 3 -0.8476 5.231395482139811 16.317768569195522 5.881315846511935 0 -1 0 +575 208 4 0.4238 2.177620897192864 16.64982393435223 8.761554745053633 0 1 0 +576 208 4 0.4238 2.094574505181361 18.21985639375971 9.202835736910075 0 1 0 +574 208 3 -0.8476 1.5873217943892133 17.359983182573774 9.145250259424412 0 1 0 +424 158 3 -0.8476 1.564206785445587 16.948839460798485 5.246489063063134 0 0 0 +578 209 4 0.4238 0.2760161314354884 17.459253764508798 7.916581117516428 1 -1 0 +709 253 3 -0.8476 17.62184604917465 20.114099005680494 6.010710031072736 -1 0 0 +242 97 4 0.4238 17.40984948086816 16.699345430262625 10.164071784489389 -1 -1 0 +513 187 4 0.4238 9.115189452617253 18.724168298812177 5.6157709754579 0 -1 0 +468 172 4 0.4238 6.034258727738924 17.988689189495606 8.85060717294741 0 -1 0 +466 172 3 -0.8476 5.166589027853813 17.544989350665965 9.074843606247345 0 -1 0 +381 143 4 0.4238 4.1591214489581345 15.524908809046764 10.990269722350863 0 -1 0 +532 194 3 -0.8476 5.834562824802455 19.887060730724258 6.566790661757808 0 0 0 +511 187 3 -0.8476 8.188668075061216 18.845091881965207 5.259485027693011 0 -1 0 +196 82 3 -0.8476 10.527262376382927 15.867880764509227 5.379864060368958 -1 0 0 +623 224 4 0.4238 8.528221169678154 19.31113215754156 7.824261629619986 0 -1 0 +198 82 4 0.4238 11.062901638987622 16.525094673686695 4.849617314139471 -1 0 0 +533 194 4 0.4238 6.631147177486181 19.33543163284572 6.319477694784791 0 0 0 +349 133 3 -0.8476 7.69607689524864 15.683400937910493 5.177437140121121 0 -1 0 +622 224 3 -0.8476 7.888478893752487 18.75285961396988 8.352524879091089 0 -1 0 +643 231 3 -0.8476 10.764609330931004 18.70078929569158 9.368107024446358 0 -1 0 +645 231 4 0.4238 11.38443546601623 18.224272161997142 8.74461050411629 0 -1 0 +644 231 4 0.4238 10.714600259975864 19.666844993781993 9.114653652940364 0 -1 0 +624 224 4 0.4238 8.318616297804342 17.87963305837006 8.581561676244952 0 -1 0 +583 211 3 -0.8476 10.923680387277354 18.90106219271726 5.456073631082404 0 0 0 +174 74 4 0.4238 13.812701589520023 16.099993367558167 5.544291418876141 -1 0 0 +504 184 4 0.4238 15.88399643967493 14.722614317395516 8.648992333485126 0 -1 0 +172 74 3 -0.8476 13.713001428124947 15.11276340618361 5.420040747545721 -1 0 0 +502 184 3 -0.8476 15.256633354866155 15.496055548019697 8.739580218641269 0 -1 0 +585 211 4 0.4238 11.40414286428808 18.511473583820692 6.241809732636211 0 0 0 +387 145 4 0.4238 12.265671546558718 16.380737435742297 7.1686513413536215 0 -1 0 +369 139 4 0.4238 14.681121882135567 18.628753446505907 6.59440054246881 -1 -1 0 +611 220 4 0.4238 17.481802587326232 16.639709214951562 4.903714531175374 0 -1 0 +612 220 4 0.4238 15.918553047167078 17.11175795529572 4.910655987581638 0 -1 0 +579 209 4 0.4238 16.78201906894718 17.325920408163103 6.758352457087368 0 -1 0 +385 145 3 -0.8476 12.331377756083219 17.368242490786933 7.311891787604915 0 -1 0 +386 145 4 0.4238 12.970558936772463 17.555028613004016 8.057921957800264 0 -1 0 +710 253 4 0.4238 17.433607789783785 19.383368605771306 6.6669116430518915 -1 0 0 +368 139 4 0.4238 14.227107778925602 18.993012948194856 5.068683005163068 -1 -1 0 +259 103 3 -0.8476 14.329652787283667 18.053325372164224 9.13418399297064 -1 -1 0 +610 220 3 -0.8476 16.550451245609086 16.37625019023457 5.15506039199796 0 -1 0 +367 139 3 -0.8476 14.838696244695667 18.432110772478424 5.626669643597806 -1 -1 0 +577 209 3 -0.8476 17.1798101180517 17.93211878211929 7.447037188901601 0 -1 0 +447 165 4 0.4238 0.1812793845060234 3.2133495020905416 10.695468049934293 1 1 0 +357 135 4 0.4238 1.847556029739268 4.750019700352974 15.001767737024641 0 0 0 +97 49 3 -0.8476 4.740821103384455 20.304436935423432 14.92515435856283 -1 -2 0 +99 49 4 0.4238 4.178373693671055 0.6308790673370844 14.495182679676672 -1 -1 0 +168 72 4 0.4238 4.092559755070765 1.9726288450981528 11.723644946206903 0 -1 0 +435 161 4 0.4238 1.8652049665647261 2.529104882577933 11.972384220967834 0 0 0 +558 202 4 0.4238 0.4787023196380537 0.9784172030698345 11.983674757347728 0 1 0 +166 72 3 -0.8476 3.722204957330288 2.6872039330909865 12.317129443300917 0 -1 0 +394 148 3 -0.8476 3.600129810223536 5.711189886722592 9.91127897374719 0 0 0 +433 161 3 -0.8476 0.9775133011806281 2.984419097499584 12.0408888299802 0 0 0 +434 161 4 0.4238 0.9453105758914859 3.527438181538437 12.879992426286092 0 0 0 +167 72 4 0.4238 4.256504961433037 3.5248456706327174 12.20361853529446 0 -1 0 +396 148 4 0.4238 4.369323942225964 5.074189350069953 9.962000089090727 0 0 0 +355 135 3 -0.8476 1.1940316851586277 4.732773898353678 14.245054728005904 0 0 0 +647 232 4 0.4238 1.8279553613860204 1.0549182196346443 15.03870664516926 1 1 0 +654 234 4 0.4238 2.7123045598750704 3.03126732097064 15.384352990991019 0 0 0 +652 234 3 -0.8476 3.043853077556617 2.221473163587609 14.900296754255706 0 0 0 +653 234 4 0.4238 3.443501871147192 2.496242346441958 14.02577780630131 0 0 0 +674 241 4 0.4238 7.892284873018967 3.379123004272847 8.87299414189215 0 0 0 +246 98 4 0.4238 6.174705839105568 0.8103733560375688 15.585953552731109 0 0 0 +245 98 4 0.4238 7.7059877558665955 0.7048163707072558 16.143323425074527 0 0 0 +244 98 3 -0.8476 6.8553461484756175 1.2287134080244495 16.187385937552218 0 0 0 +697 249 3 -0.8476 10.83831761471495 1.52057398500823 14.182581980610884 0 1 0 +698 249 4 0.4238 10.210242664416823 0.8231989403443087 14.5278259235526 0 1 0 +629 226 4 0.4238 9.662909714901263 4.794365531285398 11.375689970627544 1 -1 0 +593 214 4 0.4238 10.40807559412412 3.1534573657689107 13.657275086695144 0 1 0 +592 214 3 -0.8476 9.922606001827361 3.9489839075095747 13.29470320203831 0 1 0 +210 86 4 0.4238 7.277002837073857 4.1094452089125735 15.493029225132387 0 1 0 +209 86 4 0.4238 7.286164061287226 2.6881361742965186 14.689024342262156 0 1 0 +594 214 4 0.4238 8.938734710948083 3.8273333316116873 13.425851125247322 0 1 0 +663 237 4 0.4238 5.827808807325225 4.62753019272002 13.404417702965164 0 0 0 +208 86 3 -0.8476 7.383014424746107 3.679135358090266 14.596591722696116 0 1 0 +419 156 4 0.4238 0.3607084943625497 6.098316380765166 11.804799703813217 0 1 0 +641 230 4 0.4238 14.353180736024825 1.7906609315646662 10.763301969550975 0 0 0 +640 230 3 -0.8476 13.840489913902166 2.1963234981178763 10.006607544167009 0 0 0 +137 62 4 0.4238 12.072289781940233 0.35299104460048664 11.012586562998269 -1 -1 0 +699 249 4 0.4238 11.2862135608659 1.1848898153830811 13.353902530381527 0 1 0 +136 62 3 -0.8476 12.23072292639147 0.397665446037911 11.998945478595864 -1 -1 0 +140 63 4 0.4238 14.867607209668295 1.938752709182049 13.08463832223618 -1 0 0 +139 63 3 -0.8476 14.78021627607108 1.1486224670575256 12.477960031682642 -1 0 0 +138 62 4 0.4238 13.213575802526444 0.4463785851081826 12.176792489424273 -1 -1 0 +286 112 3 -0.8476 15.394577876326938 3.1059264031945113 14.329682330157693 0 0 0 +141 63 4 0.4238 15.393986285992415 0.42194716963361606 12.786553485765614 -1 0 0 +356 135 4 0.4238 0.3581533842113541 5.210392233397551 14.5155921820269 0 0 0 +395 148 4 0.4238 3.856603538115896 6.499626022756107 9.352180381061403 0 0 0 +224 91 4 0.4238 3.665540131628934 8.766822079901068 13.52560383146032 -1 -1 0 +275 108 4 0.4238 0.7921354634518165 9.317805682629903 10.362699912662606 0 0 0 +223 91 3 -0.8476 3.1475931393099716 8.798963862485444 12.67079496023714 -1 -1 0 +389 146 4 0.4238 4.678784160455236 8.294957402231551 15.253203116408447 -1 -1 0 +216 88 4 0.4238 3.9959639352096077 10.178590384900206 11.243371748278841 0 0 0 +257 102 4 0.4238 2.9767178037344864 6.102184067402138 11.44667157530849 -1 -1 0 +225 91 4 0.4238 2.793289630849297 7.887606052634235 12.461279975706473 -1 -1 0 +258 102 4 0.4238 2.1426164777900727 5.507280901940478 12.718282585374252 -1 -1 0 +256 102 3 -0.8476 2.288629921057995 6.311084043070111 12.141582956180768 -1 -1 0 +269 106 4 0.4238 6.145338047857415 6.587211058381091 14.096023407757173 0 -1 0 +284 111 4 0.4238 1.6547649730419856 9.615458094132954 12.360533668396412 1 -1 0 +388 146 3 -0.8476 4.1336175160828486 9.01706227616198 15.679065669504851 -1 -1 0 +390 146 4 0.4238 3.278752062602154 8.62968447460259 16.02423850482696 -1 -1 0 +686 245 4 0.4238 0.050473204555478116 8.33233481867503 15.35489007150469 0 0 0 +630 226 4 0.4238 9.804119270073283 5.686472363021448 10.015236700422788 1 -1 0 +628 226 3 -0.8476 9.256514915435922 5.53293526442516 10.837768251306391 1 -1 0 +662 237 4 0.4238 6.055655244038911 5.5127515886593095 12.051237698943496 0 0 0 +661 237 3 -0.8476 5.39645715645333 4.966977086843131 12.568527627928479 0 0 0 +158 69 4 0.4238 8.239784129603814 6.518295232953348 11.762767465452137 0 1 0 +157 69 3 -0.8476 7.525721427365336 7.099872414593089 12.152493487393517 0 1 0 +331 127 3 -0.8476 9.940292101697922 6.820709072068782 14.168909743748504 0 0 0 +333 127 4 0.4238 10.9222641824768 6.811258108109765 14.357704544221606 0 0 0 +332 127 4 0.4238 9.588248841650607 5.884912383557486 14.187665406873634 0 0 0 +159 69 4 0.4238 7.941296904021835 7.9208242176348564 12.544078932702808 0 1 0 +443 164 4 0.4238 9.257282573896715 8.236146821821395 13.82644901446346 -1 0 0 +702 250 4 0.4238 8.944556842035203 4.460477944048146 17.220028746753886 -1 1 0 +418 156 3 -0.8476 17.04244166005861 5.998736304556262 11.57305385987536 -1 1 0 +420 156 4 0.4238 16.929542275845908 5.239054047369782 10.932633742526257 -1 1 0 +306 118 4 0.4238 15.054721929761767 6.1988663198682445 12.195550287825709 0 0 0 +725 258 4 0.4238 11.763315259015506 4.675923827711252 13.938998247166115 0 0 0 +285 111 4 0.4238 0.47886486086631647 10.687324505395337 12.727942385254115 1 -1 0 +305 118 4 0.4238 14.247100207506463 7.1072870676606525 11.105070468321909 0 0 0 +304 118 3 -0.8476 14.149275445987765 6.481969740029936 11.879287885340991 0 0 0 +726 258 4 0.4238 12.960718425168919 5.660168858219739 13.425076283647144 0 0 0 +724 258 3 -0.8476 12.468338574375162 5.323652974482742 14.227772092043644 0 0 0 +638 229 4 0.4238 12.05956539715828 10.864161281925869 13.802323315521988 -1 -1 0 +399 149 4 0.4238 16.750473304787647 9.530503152154038 11.418317259828266 0 1 0 +397 149 3 -0.8476 15.763166233431196 9.425157842686454 11.537182449361275 0 1 0 +283 111 3 -0.8476 0.820922338317977 10.057794191068144 12.03031158296465 1 -1 0 +163 71 3 -0.8476 15.162496118240178 9.870657051117623 14.110440538494784 -1 0 0 +164 71 4 0.4238 15.645588456789435 10.715622587912256 13.880969343781755 -1 0 0 +685 245 3 -0.8476 16.737395452628256 8.13331549974446 15.539361115979883 -1 0 0 +687 245 4 0.4238 16.587379737429536 8.099923479195049 16.527481394265017 -1 0 0 +649 233 3 -0.8476 1.3588313009098396 14.456362531344404 11.200264748731371 0 0 0 +215 88 4 0.4238 3.5126588937641405 11.73786546709177 11.202089685116377 0 0 0 +587 212 4 0.4238 2.2171274427421794 11.308020818373768 14.408963587129238 0 0 0 +586 212 3 -0.8476 3.200811418785457 11.452264392873431 14.516484383241018 0 0 0 +588 212 4 0.4238 3.6188421074861963 10.627827313402745 14.898004157725504 0 0 0 +539 196 4 0.4238 17.370847511142472 12.473840831402779 14.354545058816383 -1 -1 0 +214 88 3 -0.8476 3.7263785710719746 10.934315254340394 10.646543487573023 0 0 0 +380 143 4 0.4238 4.83223071836321 14.206968779399421 11.680622544421002 0 -1 0 +191 80 4 0.4238 2.634895605896023 13.532265477504726 11.89540521982074 0 -1 0 +192 80 4 0.4238 3.5341925623469734 12.960851287636022 13.1328946454657 0 -1 0 +190 80 3 -0.8476 3.4485200177145052 13.003668076064319 12.137491132459456 0 -1 0 +538 196 3 -0.8476 0.1998118507190113 11.598384594819466 14.42343364564352 0 -1 0 +671 240 4 0.4238 10.419939259027254 10.262962738121466 9.553030055557315 0 0 0 +262 104 3 -0.8476 7.382624766578302 12.090860349556454 11.21002162235012 0 0 0 +263 104 4 0.4238 6.397935592185901 12.157149760289094 11.371247837235982 0 0 0 +264 104 4 0.4238 7.875171242026451 12.409626820057237 12.019829693455922 0 0 0 +614 221 4 0.4238 8.56240323068188 10.7496696662053 10.831178941272759 1 -1 0 +442 164 3 -0.8476 8.700375825935984 9.011931818299498 13.52977847188488 -1 0 0 +613 221 3 -0.8476 9.416954282026312 10.299467264220647 11.090140080600808 1 -1 0 +615 221 4 0.4238 9.289091051191704 9.813815389086011 11.954890873003347 1 -1 0 +238 96 3 -0.8476 8.063535417845607 13.825205891587308 13.355505940484326 0 -1 0 +240 96 4 0.4238 7.110550789673944 13.69051190534572 13.626946955335905 0 -1 0 +444 164 4 0.4238 8.650889599910359 9.687403844292913 14.265502263239682 -1 0 0 +398 149 4 0.4238 15.539622010653874 9.45549971647298 12.511406165959794 0 1 0 +438 162 4 0.4238 16.34550689895525 14.042303121150413 13.215768931198447 0 0 0 +436 162 3 -0.8476 16.370275386771294 13.763035604635466 14.175664210056159 0 0 0 +437 162 4 0.4238 16.296354933000924 14.571220389567156 14.759938421613354 0 0 0 +718 256 3 -0.8476 16.185204308293734 14.193675912341332 11.317085379662494 0 -1 0 +720 256 4 0.4238 15.94977871330843 15.156098767140222 11.181729380736286 0 -1 0 +119 56 4 0.4238 12.0427416973315 12.029763013766948 11.110158074645799 -1 -1 0 +118 56 3 -0.8476 11.432374799819748 12.039882357165899 11.902213132638838 -1 -1 0 +120 56 4 0.4238 10.727244194532929 11.339965743413659 11.788592316430185 -1 -1 0 +301 117 3 -0.8476 14.485076610417329 11.996229174502563 10.837416919864094 0 1 0 +302 117 4 0.4238 15.163601977583083 12.707930544200536 11.019321482233156 0 1 0 +303 117 4 0.4238 14.884023759502458 11.099078067355505 11.02705377313857 0 1 0 +165 71 4 0.4238 15.800206222252266 9.226148688473826 14.53226881689346 -1 0 0 +379 143 3 -0.8476 4.964606912131187 15.175261574473684 11.468749797049503 0 -1 0 +98 49 4 0.4238 4.921449415179219 19.574795232809254 14.265611581334724 -1 -2 0 +135 61 4 0.4238 4.776915758368173 19.759021395862487 11.68693405197857 0 -1 0 +441 163 4 0.4238 1.9351451019676944 17.810262754350813 13.855350901711349 1 -1 0 +439 163 3 -0.8476 2.3968917687887275 18.36237607994476 13.161114984632775 1 -1 0 +440 163 4 0.4238 1.7483468435780378 19.014200867634028 12.768029827752589 1 -1 0 +241 97 3 -0.8476 16.87510404175997 16.99501892831403 10.955668267021162 -1 -1 0 +142 64 3 -0.8476 4.978218715970766 18.003139583189803 12.73273931719706 0 -1 0 +144 64 4 0.4238 5.071803553446059 17.0267051264412 12.927210467166335 0 -1 0 +143 64 4 0.4238 4.015521476811523 18.265451459404645 12.799137950654782 0 -1 0 +180 76 4 0.4238 15.512872196801505 16.252950464244147 14.820082384125504 -1 0 0 +472 174 3 -0.8476 1.2742457978033506 16.56205800584485 14.895996687575648 1 0 0 +473 174 4 0.4238 1.7096564617644439 15.705257719780878 15.17224729633624 1 0 0 +506 185 4 0.4238 6.823327693130979 18.663437128415826 12.684689753490513 1 -1 0 +505 185 3 -0.8476 7.777055812692833 18.761555507512135 12.968905430156887 1 -1 0 +507 185 4 0.4238 8.37216510962521 18.321063652267217 12.296732893458284 1 -1 0 +365 138 4 0.4238 8.015724365992902 15.339188239200784 11.973621131278675 0 -1 0 +366 138 4 0.4238 6.661835125589007 15.522086977430543 11.079104620814839 0 -1 0 +364 138 3 -0.8476 7.645088578296798 15.700175956054876 11.117863800626324 0 -1 0 +660 236 4 0.4238 8.979207486352824 16.70505321395575 11.054160054895618 0 -1 0 +658 236 3 -0.8476 9.570262170022627 17.431653565334543 11.404457081728449 0 -1 0 +659 236 4 0.4238 10.08742436484279 17.8339100043106 10.648987499442617 0 -1 0 +704 251 4 0.4238 8.473215883829688 19.510640813911238 14.263676778007913 0 -1 0 +703 251 3 -0.8476 8.776192673660734 19.901447031621075 15.132859426903634 0 -1 0 +359 136 4 0.4238 11.051537950639599 17.350243474212757 16.068712189222182 0 0 0 +470 173 4 0.4238 10.76441001086064 18.073330110832174 12.467224302186365 0 -1 0 +239 96 4 0.4238 8.508542866435485 14.448033390567616 13.998979240873444 0 -1 0 +360 136 4 0.4238 11.598748952515562 18.256517242858383 14.825387360343209 0 0 0 +358 136 3 -0.8476 11.275556526609193 18.278394528773564 15.771469774850447 0 0 0 +261 103 4 0.4238 14.652123948741334 17.14841245921013 8.856431310351903 -1 -1 0 +260 103 4 0.4238 14.830063048937909 18.35037138224516 9.947421934004115 -1 -1 0 +556 202 3 -0.8476 0.6451634932785091 0.08612058957410944 12.403314711368045 0 1 0 +557 202 4 0.4238 0.7705800276817398 0.19949478758276096 13.388919878352045 0 1 0 +243 97 4 0.4238 16.648631090570646 17.96448680244335 10.861632499169296 -1 -1 0 +452 167 4 0.4238 16.320072793421065 20.26278000968495 10.014885064756477 -1 -1 0 +453 167 4 0.4238 17.10698081722232 19.78697457015618 11.364334136186669 -1 -1 0 +451 167 3 -0.8476 16.28128072015691 19.662897475548206 10.814034290253536 -1 -1 0 +249 99 4 0.4238 12.811870600520288 14.966040923006444 12.612254155376286 0 -1 0 +378 142 4 0.4238 13.864097722276158 13.369472687627342 13.658656095537358 0 -1 0 +469 173 3 -0.8476 11.581595523986602 18.239940681502915 13.01899796347378 0 -1 0 +471 173 4 0.4238 11.958183091686623 19.138581414646616 12.793986536425175 0 -1 0 +247 99 3 -0.8476 12.876116783439823 15.746834294738138 11.990772724238388 0 -1 0 +248 99 4 0.4238 12.217138825237507 16.446894626362194 12.265849833084124 0 -1 0 +361 137 3 -0.8476 15.13727009687457 16.90165414469196 13.223153761736725 -1 -1 0 +362 137 4 0.4238 14.470451489983892 16.44380220380938 12.635168635911581 -1 -1 0 +363 137 4 0.4238 15.932868898604944 17.169056583231026 12.679536691827476 -1 -1 0 +492 180 4 0.4238 0.43743422645945185 4.5906269933473665 18.587621435257972 1 -1 0 +490 180 3 -0.8476 0.7538552615552045 3.741012408657575 18.165674020330567 1 -1 0 +292 114 3 -0.8476 6.779237475248931 2.5855973221897752 18.742314354584874 -1 1 0 +293 114 4 0.4238 5.782974477885699 2.665690105600376 18.774671827300182 -1 1 0 +543 197 4 0.4238 2.261683519266417 18.956286129295005 17.516517444173967 0 -1 0 +294 114 4 0.4238 7.041384117522155 1.9923415303923404 17.981177212709813 -1 1 0 +648 232 4 0.4238 1.2840185943369538 20.027487564337527 15.663576384325069 1 0 0 +646 232 3 -0.8476 1.035833673325263 0.4501108958548825 15.120877926941924 1 1 0 +289 113 3 -0.8476 3.5694615540602066 3.9557007985544073 18.892473225882544 -1 0 0 +290 113 4 0.4238 3.9007473345866632 4.846501971064104 18.58146458496819 -1 0 0 +634 228 3 -0.8476 2.0548959172216112 1.4885500264873104 19.846198245709125 1 0 0 +635 228 4 0.4238 2.9628766537025832 1.9045281700166616 19.795858546975285 1 0 0 +299 116 4 0.4238 2.171952214244551 4.633689704374672 16.985315368019506 0 0 0 +291 113 4 0.4238 2.6481656653101635 3.799781565594691 18.536236986216945 -1 0 0 +393 147 4 0.4238 4.348351463424381 19.061632161699574 17.883086170554588 0 -1 0 +636 228 4 0.4238 1.3782409041190875 2.118028733596981 19.46423579740044 1 0 0 +149 66 4 0.4238 10.058819394907307 3.0688181389053097 19.210862966210907 0 1 0 +325 125 3 -0.8476 10.74828334198565 4.322936964736242 17.57185541428758 0 0 0 +326 125 4 0.4238 11.425688586961753 3.656912809840247 17.259547991077014 0 0 0 +327 125 4 0.4238 11.140117164858376 5.241979252441542 17.529066927007428 0 0 0 +488 179 4 0.4238 10.350157062795372 0.2420626451877226 21.92631989941215 1 0 0 +148 66 3 -0.8476 9.537226432172295 2.5429363057164167 19.88271855735622 0 1 0 +150 66 4 0.4238 8.560229252221008 2.711870615751354 19.75256698710486 0 1 0 +707 252 4 0.4238 11.740110463186003 1.776348015109221 15.53086302864974 0 0 0 +706 252 3 -0.8476 12.198096570724744 1.8904670385576847 16.412467842603686 0 0 0 +708 252 4 0.4238 12.571862151067574 1.0119896957090955 16.710088672419115 0 0 0 +481 177 3 -0.8476 9.315276994339321 18.510963695713393 19.342025103756953 0 -1 0 +483 177 4 0.4238 9.422623982664092 19.209702688095064 20.04930314789335 0 -1 0 +482 177 4 0.4238 9.988811289898274 17.785763007329415 19.484984290912223 0 -1 0 +288 112 4 0.4238 15.471449713112566 2.8488298385283906 15.293007007266988 0 0 0 +287 112 4 0.4238 15.516107836695687 4.09424959615854 14.237750379319154 0 0 0 +491 180 4 0.4238 17.64496292035689 3.3085743846428177 17.67782963384906 0 -1 0 +309 119 4 0.4238 13.582283027599846 2.6353512461283666 17.34240140650764 -1 0 0 +307 119 3 -0.8476 14.343622662449947 2.966429642204021 17.899854712193406 -1 0 0 +495 181 4 0.4238 17.43274891004834 1.5087555488754918 16.215207616573853 0 0 0 +308 119 4 0.4238 15.20818961662623 2.678545913791243 17.487968923154984 -1 0 0 +229 93 3 -0.8476 14.344885450355205 0.7111805793204466 20.537565280186016 -1 0 0 +465 171 4 0.4238 14.311096036256034 4.047018967431671 19.16592080772689 0 1 0 +494 181 4 0.4238 16.24079039258795 0.9996458541668086 17.208520508456573 0 0 0 +493 181 3 -0.8476 16.619064945220725 1.7887900548853854 16.724619451647936 0 0 0 +185 78 4 0.4238 12.823282507193017 6.351770580905416 20.083457041313054 -1 0 0 +463 171 3 -0.8476 14.179508428091005 4.717580926865845 19.896014275607744 0 1 0 +270 106 4 0.4238 6.032468062116908 7.155526539301534 15.622753627061442 0 -1 0 +268 106 3 -0.8476 5.657810510464103 7.219793323360017 14.697818677953899 0 -1 0 +298 116 3 -0.8476 2.818422477899985 4.939880429917721 16.286511307998115 0 0 0 +680 243 4 0.4238 4.206367111153776 7.357182675152206 18.457428435583857 0 0 0 +334 128 3 -0.8476 1.4174345103786654 8.190935790107671 19.4900782394972 0 0 0 +335 128 4 0.4238 1.0010926992929934 9.046505146618708 19.797750119178264 0 0 0 +679 243 3 -0.8476 4.384215592438126 6.497743117254143 17.97812275252637 0 0 0 +456 168 4 0.4238 1.4547159295169854 7.96221128068873 17.469762961216215 0 1 0 +681 243 4 0.4238 5.262112071440925 6.556612702721318 17.502904009616717 0 0 0 +573 207 4 0.4238 7.2650142005940035 7.6086751010873 17.74198610111241 -1 0 0 +336 128 4 0.4238 2.397074513938586 8.206080435611778 19.6902728582061 0 0 0 +454 168 3 -0.8476 1.7321156971839582 8.543693209618814 16.704956222386965 0 1 0 +271 107 3 -0.8476 4.087574069629593 9.129323818676124 19.48021356815156 -1 -1 0 +300 116 4 0.4238 3.5500184500427867 5.467928404881992 16.717714103309124 0 0 0 +280 110 3 -0.8476 6.414874336555821 9.928443784453252 16.808359567446605 0 0 0 +272 107 4 0.4238 3.653665561817695 10.029220473914936 19.523966349859798 -1 -1 0 +116 55 4 0.4238 0.0723261427341601 6.970688135061237 19.45119017600495 0 -1 0 +581 210 4 0.4238 11.115101941015714 9.669097525259048 16.97608379349732 0 0 0 +700 250 3 -0.8476 7.951324048838638 4.507019114114237 17.113591427548194 -1 1 0 +701 250 4 0.4238 7.518815989634965 3.8495736320843488 17.73060492219878 -1 1 0 +580 210 3 -0.8476 10.489708859215067 8.908706454507964 16.800898362124844 0 0 0 +571 207 3 -0.8476 6.876526326487497 6.854145263283054 17.213055418586528 -1 0 0 +186 78 4 0.4238 12.276769507558853 6.982996982936812 18.680066735842384 -1 0 0 +184 78 3 -0.8476 12.229018908956789 7.045751225223292 19.67695394058582 -1 0 0 +723 257 4 0.4238 11.554579899201622 7.466152123138789 16.791653001025573 -1 1 0 +721 257 3 -0.8476 12.07052187358629 6.609563755245322 16.79963694089583 -1 1 0 +609 219 4 0.4238 8.650803366971875 7.61928606613244 19.271292272849085 -1 0 0 +608 219 4 0.4238 9.166062533392942 8.732739969731657 18.19362940326139 -1 0 0 +607 219 3 -0.8476 8.394806459926999 8.438458175553992 18.758044165956715 -1 0 0 +572 207 4 0.4238 7.468410774949949 6.052032470496192 17.29239859654011 -1 0 0 +161 70 4 0.4238 9.737907903821842 5.686564739227311 20.517408312071204 0 -1 0 +582 210 4 0.4238 9.902510744294325 9.13252755652863 16.02301379324525 0 0 0 +282 110 4 0.4238 5.975197133623462 10.669659986067497 17.315593194480346 0 0 0 +639 229 4 0.4238 13.219121632761292 9.970188622986985 14.525420510553294 -1 -1 0 +637 229 3 -0.8476 12.400731795859281 10.524051175890197 14.678640191793187 -1 -1 0 +722 257 4 0.4238 12.539550953814611 6.49479219401724 15.923942648950579 -1 1 0 +510 186 4 0.4238 11.287628312760472 9.398714217255213 19.519112317260827 -1 -1 0 +222 90 4 0.4238 15.937034254451548 5.640752915151805 15.671658019394947 -1 0 0 +220 90 3 -0.8476 16.308887888331522 5.590975428109702 14.744700548019777 -1 0 0 +221 90 4 0.4238 16.571741636418928 6.506894589151454 14.44138371581618 -1 0 0 +194 81 4 0.4238 12.75368231744947 10.752721407362513 16.425169074232862 -1 0 0 +195 81 4 0.4238 12.71140708501866 10.750250283312678 18.05760167752052 -1 0 0 +193 81 3 -0.8476 13.253688156531002 10.503329403105685 17.254506434193278 -1 0 0 +432 160 4 0.4238 14.561267636598071 5.317977222991033 17.730025349380618 -1 0 0 +431 160 4 0.4238 15.03866372011643 6.789122067501419 17.206141993385756 -1 0 0 +430 160 3 -0.8476 15.26623621703309 5.815535381499027 17.224598071379116 -1 0 0 +544 198 3 -0.8476 0.6114163714340954 10.422427507789719 20.759093077200042 1 0 0 +115 55 3 -0.8476 17.335575147083638 6.085970670681771 19.19010513950838 -1 -1 0 +117 55 4 0.4238 16.62864657877149 6.222571151340762 18.496135953606725 -1 -1 0 +545 198 4 0.4238 17.385110185671635 10.717184621385705 21.141530864904997 0 0 0 +182 77 4 0.4238 4.775987467397462 12.501881710927542 14.958355156555413 -1 -1 0 +540 196 4 0.4238 0.37050159087522283 11.386645019643359 15.385739254435364 0 -1 0 +602 217 4 0.4238 2.877091840194542 13.464366499134016 15.558945208444463 0 0 0 +603 217 4 0.4238 2.969586552771944 14.499684055252724 16.818385363959177 0 0 0 +455 168 4 0.4238 1.369396484122558 9.465935894269819 16.83876422312793 0 1 0 +201 83 4 0.4238 2.671037056829991 12.406467556922887 19.346315858245593 0 -1 0 +199 83 3 -0.8476 3.2625773832214624 11.698316447863316 18.96082513336595 0 -1 0 +200 83 4 0.4238 4.100557971867599 12.11769488133759 18.611667090961166 0 -1 0 +599 216 4 0.4238 1.8893584169093294 14.35428360513243 20.05147404139672 -1 0 0 +598 216 3 -0.8476 1.5649431232930577 13.416630818672424 20.176224312691144 -1 0 0 +600 216 4 0.4238 0.5683002528537319 13.416872997825863 20.258099525254817 -1 0 0 +281 110 4 0.4238 5.804304259236728 9.613996628517596 16.081495363106505 0 0 0 +324 124 4 0.4238 0.043659843874497825 11.700549431435512 17.548783471249404 0 0 0 +322 124 3 -0.8476 0.6986180999032698 10.969146709178826 17.358832885092397 0 0 0 +323 124 4 0.4238 1.5437602904086145 11.138573552128177 17.86581552014627 0 0 0 +520 190 3 -0.8476 16.497913500683367 13.608830531340717 20.099224242174998 -2 -1 0 +183 77 4 0.4238 6.061108779415605 13.35100663171201 15.500644142396819 -1 -1 0 +181 77 3 -0.8476 5.432852358019868 13.221576145595803 14.733479278991409 -1 -1 0 +528 192 4 0.4238 7.947908460965703 10.415144237551592 16.017452267881904 -1 0 0 +527 192 4 0.4238 8.693810029330587 11.679749716859721 15.302586746464218 -1 0 0 +526 192 3 -0.8476 8.723815386797254 10.691157629577742 15.450190140921961 -1 0 0 +413 154 4 0.4238 8.47629321139097 9.924837900824734 19.765923633588624 0 -1 0 +551 200 4 0.4238 6.295140628612961 13.0811562212512 18.595381699645387 0 -1 0 +352 134 3 -0.8476 7.421716948050476 13.052200283352796 19.864348347568836 0 -1 0 +353 134 4 0.4238 8.102450866164704 12.320106124247694 19.838998054827613 0 -1 0 +227 92 4 0.4238 9.529976846550452 13.300151576381868 16.226718397521843 -1 -1 0 +228 92 4 0.4238 8.58524448668043 13.865491623869215 17.432744650799876 -1 -1 0 +226 92 3 -0.8476 8.58726918461898 13.46732542687426 16.515432680586017 -1 -1 0 +354 134 4 0.4238 7.8556697820960695 13.919448291047914 19.620279543432734 0 -1 0 +550 200 3 -0.8476 5.420440329517178 13.080782052941927 18.110716314441905 0 -1 0 +524 191 4 0.4238 11.884868441493689 14.448712932136393 15.081249372531165 0 0 0 +523 191 3 -0.8476 11.50361661998975 15.067119970952685 15.76843547762266 0 0 0 +525 191 4 0.4238 10.635428893494353 15.437655673235382 15.438349657119135 0 0 0 +519 189 4 0.4238 16.12596399656808 9.713127165378456 18.774089973722194 -1 -1 0 +517 189 3 -0.8476 15.575253587195496 9.20267771394846 18.11366575383574 -1 -1 0 +518 189 4 0.4238 14.797935848983123 9.761696645097231 17.825082898206848 -1 -1 0 +508 186 3 -0.8476 11.36032110607987 10.395500955326444 19.485415246824253 -1 -1 0 +509 186 4 0.4238 10.574909438442395 10.802916738502745 19.951406129255314 -1 -1 0 +625 225 3 -0.8476 13.431373674817415 12.360229415324964 20.046821494380612 0 -1 0 +626 225 4 0.4238 12.815658302976129 11.572267924143482 20.04324286856607 0 -1 0 +132 60 4 0.4238 13.973033764300695 13.370819921016986 17.597892066875374 -1 0 0 +252 100 4 0.4238 14.626947965687904 11.458256675553198 20.594723533070734 -1 -1 0 +250 100 3 -0.8476 15.446910706815945 10.985490885337827 20.91745283601959 -1 -1 0 +521 190 4 0.4238 16.708490712860183 13.560658918372258 19.12283207188856 -2 -1 0 +251 100 4 0.4238 15.28278621296645 10.621734288846643 21.834373973684016 -1 -1 0 +130 60 3 -0.8476 14.678369605079089 12.957802124288227 17.021768263766795 -1 0 0 +131 60 4 0.4238 14.458348330319499 11.995153975026893 16.86397133682681 -1 0 0 +203 84 4 0.4238 0.33763023117752755 14.034931383383197 16.80850588241971 0 0 0 +202 84 3 -0.8476 17.280677882219976 13.944722872415943 17.510595617565976 -1 0 0 +204 84 4 0.4238 16.38038455006987 14.080495208212355 17.097025000411602 -1 0 0 +627 225 4 0.4238 12.895998920515487 13.20189858279176 19.976338825971638 0 -1 0 +542 197 4 0.4238 0.7514357233548431 18.409811166527543 17.22131458532548 0 -1 0 +541 197 3 -0.8476 1.6321891678483407 18.639355403189736 16.807086616186705 0 -1 0 +391 147 3 -0.8476 4.491135944425146 18.24495480864346 17.323933884799132 0 -1 0 +392 147 4 0.4238 4.35867572061232 18.473941006167053 16.359556499968285 0 -1 0 +601 217 3 -0.8476 2.401796289847322 14.19076268037919 16.055376271388944 0 0 0 +179 76 4 0.4238 17.097847191102588 16.180629654501978 15.206412710169566 -1 0 0 +178 76 3 -0.8476 16.16763103793032 16.039085275960307 15.545032905740433 -1 0 0 +552 200 4 0.4238 4.921378705613509 13.920936803256845 18.323031860347246 0 -1 0 +235 95 3 -0.8476 3.8179023582749987 15.626245156567531 18.280442798179074 0 -1 0 +236 95 4 0.4238 3.9015889607236156 16.56041975973048 17.9335779875284 0 -1 0 +474 174 4 0.4238 1.3938281099787186 17.244378381710156 15.61720555921285 1 0 0 +417 155 4 0.4238 16.829213900498775 17.86385263709467 19.17468317954824 0 0 0 +664 238 3 -0.8476 16.31330980781755 16.489937600377882 20.11050236537085 0 -1 0 +665 238 4 0.4238 16.286507352436093 16.770533199811723 21.06995549510748 0 -1 0 +666 238 4 0.4238 16.36964604463261 15.492998348354005 20.056238228791614 0 -1 0 +237 95 4 0.4238 3.173112662693499 15.61096420027613 19.044650970042266 0 -1 0 +415 155 3 -0.8476 17.22802140468305 18.537375488433902 18.552332663713077 0 0 0 +705 251 4 0.4238 9.342662276321002 19.23551765587517 15.618297870694642 0 -1 0 +566 205 4 0.4238 13.181146270356484 19.36562603507473 20.289515940498255 -1 0 0 +565 205 3 -0.8476 12.315921540981028 18.962773541675908 19.99102173948854 -1 0 0 +567 205 4 0.4238 11.555026103750892 19.500332980563563 20.354434978126818 -1 0 0 +411 153 4 0.4238 12.630285403347742 19.2153458441829 16.63075507902968 0 -1 0 +410 153 4 0.4238 12.651895714100402 19.507371433526508 18.23726711474267 0 -1 0 +596 215 4 0.4238 6.6514078093810145 17.757519545906224 17.131726952309517 -1 0 0 +621 223 4 0.4238 9.32094779449351 16.89261159883148 13.964094343456331 0 -1 0 +597 215 4 0.4238 8.13320198651832 18.265654411012385 17.592933954665543 -1 0 0 +595 215 3 -0.8476 7.634367947932014 17.59815575684757 17.04011269845976 -1 0 0 +330 126 4 0.4238 9.706965875463291 15.583293645125334 19.213496685030627 -1 0 0 +328 126 3 -0.8476 8.837667391066828 15.233920832767678 18.863840186279532 -1 0 0 +329 126 4 0.4238 8.379052771415251 15.949000543126097 18.33626624707152 -1 0 0 +620 223 4 0.4238 8.86418018229449 16.466922123871992 15.472994396666568 0 -1 0 +619 223 3 -0.8476 9.191474593370469 16.125190194404134 14.592029230830551 0 -1 0 +677 242 4 0.4238 11.606354518062112 17.4135854015012 19.509290617242318 -2 -1 0 +376 142 3 -0.8476 12.910170234041873 13.669280959087763 13.670410604783452 0 -1 0 +342 130 4 0.4238 15.099355043551732 15.7895013741819 17.14729243749143 0 -1 0 +340 130 3 -0.8476 14.691352665896357 15.671573647682955 18.05262685485254 0 -1 0 +409 153 3 -0.8476 12.934070775997657 19.850129404667392 17.341223260208253 0 -1 0 +341 130 4 0.4238 15.300574406606136 16.0571625967734 18.745571691918716 0 -1 0 +678 242 4 0.4238 11.697820011038054 15.820826603277476 19.16089332874788 -2 -1 0 +676 242 3 -0.8476 11.085760395622547 16.563145453357837 19.433558232820836 -2 -1 0 +377 142 4 0.4238 12.389327721957683 13.150393614646125 12.992558137112923 0 -1 0 +633 227 4 0.4238 12.150975050009347 14.58692603804811 17.3320178342166 -1 -1 0 +631 227 3 -0.8476 12.563624593567864 14.439408482448403 18.23088427417809 -1 -1 0 +632 227 4 0.4238 13.407238305522702 14.971665072902693 18.301764553117142 -1 -1 0 +401 150 4 0.4238 14.428996277987272 20.00194102350041 17.727272883257537 -2 -1 0 +400 150 3 -0.8476 15.319708893239577 20.19041269993394 18.140928720505386 -2 -1 0 +402 150 4 0.4238 15.18982517096631 0.14146099953284744 19.075632215078734 -2 0 0 +2 1 1 0.004217334499211409 1.4708000000000006 2.5474999999999977 23.511674200062604 0 0 0 +1 1 1 -0.009646358641736526 0 0 23.511674200062604 0 0 0 +11 6 1 0.008218030684364237 2.9416 5.094899999999999 23.511674200062604 0 0 0 +3 2 1 0.001033549197079144 0 5.094899999999999 23.511674200062604 0 0 0 +10 5 1 0.00518887606701035 4.4124 2.5474999999999985 23.511674200062604 0 0 0 +487 179 3 -0.8476 10.236653495137274 0.145864427872912 20.93745027852826 1 0 0 +489 179 4 0.4238 9.828066097123468 0.9796565535099634 20.56617177499297 1 0 0 +19 10 1 0.005324823179772448 5.8832 5.094899999999999 23.511674200062604 0 0 0 +18 9 1 0.002880544028719106 7.354000000000001 2.5474999999999977 23.511674200062604 0 0 0 +27 14 1 -0.00457765761153277 8.8248 5.094899999999999 23.511674200062604 0 0 0 +26 13 1 -0.009572738618142772 10.2956 2.5474999999999985 23.511674200062604 0 0 0 +230 93 4 0.4238 13.928563556680734 1.5055446074937315 20.095227719319016 -1 0 0 +464 171 4 0.4238 15.045155051420673 4.862866706743665 20.375126707934175 0 1 0 +34 17 1 -0.01553742137562577 13.237200000000001 2.5474999999999985 23.511674200062604 0 0 0 +35 18 1 -0.002400379063516555 11.7664 5.0949 23.511674200062604 0 0 0 +41 21 1 -0.02896905738507962 14.708000000000004 0 23.511674200062604 0 0 0 +33 17 1 -0.0363745952158159 11.7664 0 23.511674200062604 0 0 0 +42 21 1 -0.02420540570462749 16.178800000000003 2.5474999999999994 23.511674200062604 0 0 0 +43 22 1 -0.007948234293211202 14.708000000000002 5.094899999999999 23.511674200062604 0 0 0 +273 107 4 0.4238 5.0753239133404575 9.229382676896916 19.59996240932027 -1 -1 0 +5 3 1 -0.005693638015952107 0 10.1898 23.511674200062604 0 0 0 +13 7 1 0.009501309380865988 2.9416 10.1898 23.511674200062604 0 0 0 +12 6 1 0.004203404930459461 4.4124 7.642399999999999 23.511674200062604 0 0 0 +4 2 1 0.01251408387036118 1.4707999999999997 7.642399999999999 23.511674200062604 0 0 0 +162 70 4 0.4238 10.49626201731352 6.799815098606447 19.594261077861322 0 -1 0 +160 70 3 -0.8476 9.605787134419803 6.445564649029472 19.879861827728533 0 -1 0 +20 10 1 -0.008607284016686766 7.354000000000001 7.6424 23.511674200062604 0 0 0 +21 11 1 -0.004896191756267181 5.8831999999999995 10.1898 23.511674200062604 0 0 0 +29 15 1 -0.02813825825945993 8.8248 10.1898 23.511674200062604 0 0 0 +28 14 1 -0.005579254270553642 10.2956 7.6424 23.511674200062604 0 0 0 +546 198 4 0.4238 1.1579498075131722 11.22511062551035 20.52034359271027 1 0 0 +44 22 1 -0.001308966881307358 16.178800000000003 7.6424 23.511674200062604 0 0 0 +45 23 1 -0.0566626999288059 14.708000000000002 10.189800000000002 23.511674200062604 0 0 0 +37 19 1 -0.005877766889753366 11.7664 10.1898 23.511674200062604 0 0 0 +36 18 1 0.0001157691193102936 13.237200000000001 7.6424 23.511674200062604 0 0 0 +14 7 1 0.005848521348572336 4.412399999999999 12.7373 23.511674200062604 0 0 0 +7 4 1 -0.01090660504939763 0 15.2847 23.511674200062604 0 0 0 +6 3 1 0.003727512893892018 1.4707999999999997 12.7373 23.511674200062604 0 0 0 +15 8 1 -0.02615871378048023 2.9415999999999984 15.2847 23.511674200062604 0 0 0 +414 154 4 0.4238 8.618799900704422 9.929833758208787 21.392667183756693 0 -1 0 +412 154 3 -0.8476 8.888565594412722 10.392171148935295 20.547994386549856 0 -1 0 +23 12 1 0.003038043205112527 5.8831999999999995 15.2847 23.511674200062604 0 0 0 +22 11 1 0.0119720834206347 7.354000000000001 12.737300000000001 23.511674200062604 0 0 0 +30 15 1 -0.0004640159590853481 10.2956 12.737300000000001 23.511674200062604 0 0 0 +31 16 1 0.007270268763850805 8.8248 15.284700000000003 23.511674200062604 0 0 0 +522 190 4 0.4238 16.06546508942164 12.755155831821405 20.38944688158725 -2 -1 0 +38 19 1 -0.005817166430377722 13.237200000000001 12.737300000000001 23.511674200062604 0 0 0 +46 23 1 -0.01105048584332794 16.178800000000003 12.737300000000001 23.511674200062604 0 0 0 +47 24 1 -0.00899474344889325 14.708000000000002 15.2847 23.511674200062604 0 0 0 +39 20 1 0.0003381839543199087 11.7664 15.2847 23.511674200062604 0 0 0 +553 201 3 -0.8476 2.352480003313166 16.235506117690385 20.496795756680786 0 0 0 +554 201 4 0.4238 2.075014408980979 17.17478517923389 20.2948805334894 0 0 0 +145 65 3 -0.8476 2.0491389692751447 19.147925155655606 19.86618701962954 -1 -1 0 +147 65 4 0.4238 2.1057321900381294 20.08004855757078 20.223884530204927 -1 -1 0 +146 65 4 0.4238 1.1682593704719069 19.018552992048466 19.410866059436394 -1 -1 0 +9 5 1 0.002797560954409141 2.9416 20.379799999999996 23.511674200062604 0 -1 0 +16 8 1 -0.00898908154146778 4.412399999999998 17.8322 23.511674200062604 0 0 0 +8 4 1 -0.01523070185408367 1.4707999999999997 17.8322 23.511674200062604 0 0 0 +416 155 4 0.4238 16.5271394385928 19.197417604787603 18.281944374175474 0 0 0 +555 201 4 0.4238 2.776284397029487 16.20040204569084 21.401869691047523 0 0 0 +17 9 1 0.002683529706333287 5.8832 20.379799999999996 23.511674200062604 0 -1 0 +25 13 1 -0.02370656583241818 8.8248 20.379799999999996 23.511674200062604 0 -1 0 +24 12 1 0.004229835349690803 7.354 17.8322 23.511674200062604 0 0 0 +32 16 1 -0.001928890613042939 10.2956 17.8322 23.511674200062604 0 0 0 +231 93 4 0.4238 14.85513137299608 1.0083962689014228 21.344604479273965 -1 0 0 +48 24 1 -0.02799231331453521 16.178800000000003 17.8322 23.511674200062604 0 0 0 +40 20 1 -0.005168906099793637 13.237200000000001 17.8322 23.511674200062604 0 0 0 Velocities @@ -770,1359 +770,1359 @@ Velocities 57 0 0 0 58 0 0 0 59 0 0 0 -676 0.0021411732266066546 -0.0031466597050466686 0.006950385069113567 -677 0.00471300605204294 -0.010676608272384733 0.0027534373566423364 -678 -0.008823855984279599 -0.007959499471369818 -0.004534651421080043 -709 0.005380424876014373 0.006307583340186229 -0.0018881938332245358 -195 0.0035011066672069953 -0.018982633794167522 0.013387657244058954 -193 -0.0016243730866856681 -0.0009043410307212374 0.00442651336838353 -194 -0.016844359613345537 -0.0020052459554273784 -0.01311294231282549 -103 0.0015806838149129447 0.002560824201124871 0.0047168491592377345 -710 0.007830390266471615 -0.009204470955483884 0.04052260106336803 -713 -0.011412032208487173 -0.0013968159548142917 -0.01011897403656863 +170 -0.015565801323246945 0.011553923587055334 0.00011655885423701334 65 0 0 0 66 0 0 0 67 0 0 0 73 0 0 0 74 0 0 0 75 0 0 0 -712 0.00439112600296801 0.00360710731488533 -0.0039525073869872964 -714 0.014803144807230072 -0.010674744767348688 -0.003430825293082879 -604 -0.00011827390695045583 -0.006806704613944644 0.0027321887706147296 -189 0.008154941183069432 0.00402238852258463 0.006084124951427027 -170 0.0013361044299764954 -0.00017168208250770554 -0.006118458408511565 -315 0.0037328380509703343 0.017096489497345373 0.013207513139570021 -605 0.003503171355645862 0.00393175960965181 0.01269038834140635 -116 -0.009757167707959114 0.010598646892323519 -0.010231402748289127 -388 0.001747370305520368 0.0018503925217209565 -0.0005923969541604404 -389 -0.02015066489450734 -0.008493989807482257 -0.009473043666461643 -586 0.0050721953206553675 -0.002995629227084019 -0.0022560086328735564 +339 0.009050739203913844 0.0013966839274111471 0.0018201686444279928 +655 0.008427072647088075 0.0006319785638995712 0.0038333297014463124 +219 0.004936273877479474 0.014881086295152265 -0.026501890988539768 81 0 0 0 82 0 0 0 83 0 0 0 89 0 0 0 90 0 0 0 91 0 0 0 -601 0.0013661096020166409 -0.003796167035264375 0.0063671190647323125 -602 -0.008528174022195655 0.008966924162453272 -0.0044782466696049895 -107 0.002028194218827179 -0.012365773885091972 0.011299553506975946 -603 -0.0030874748643350066 0.0020597842518737266 0.005359799428542693 -378 -0.009420735022443168 0.009599931914543234 -0.009184011191465311 -422 0.0010193233677437787 0.005769570923430941 -0.0006033266822692004 +422 -0.006013872800717573 -0.014299169073987292 0.011787290530609689 +311 -0.0035005696212290246 -0.0025619143601447055 -0.020644600964886833 +121 0.0033895387366071708 0.0029511322370656483 0.002475063911206653 +122 0.006429509891969969 -0.0022696133618547894 -0.011704037009368165 52 0 0 0 53 0 0 0 60 0 0 0 61 0 0 0 -316 0.002099526043199114 -0.0045408329717682855 -0.0028575294101176726 -423 -0.0017639729433514052 0.002384599378075939 0.006405279839456641 -421 -0.0026843238108787987 0.0046959324815539945 0.0006610392109797653 -643 -0.003182764168498806 -0.002245164669701677 -0.0020501158160216556 -644 -0.02278045268171879 0.008802300249148224 0.014781779450300365 -581 0.014810628036019674 0.0056131550207308666 0.001138473889555862 -426 -0.01183599814307284 -0.0030118119812299515 0.011634339637079983 -582 0.011911283072524504 0.002506814749779835 -0.001888380076239702 -299 0.00994979834473168 -0.0096597572982869 0.006175710613675385 -691 -0.0026712809298204015 0.005580991440600302 -0.005608206061799583 -693 -0.014851955236401738 0.019823950564919104 0.005329652535995544 -369 -0.014885149160620455 0.006101800275190467 0.006812320026047257 -300 0.0008158139232951453 0.00232745268131941 0.00015792455194356278 -367 -0.0049456849226559435 0.008314528563211335 -0.002138833331259298 -368 -0.005849586902335537 0.016404409742447917 -0.023365351477116908 +279 -0.004503246475321911 -0.0019896359221923837 -0.012622036989509512 +371 -0.008396587696531819 0.0055149451013554035 -0.01218971454894145 68 0 0 0 69 0 0 0 76 0 0 0 77 0 0 0 -169 0.005590524540675908 0.007794464783479033 0.003654628816346811 -171 0.012286139005426607 0.008057541351814898 0.0020922247023472014 -425 -0.016526775746840687 -0.0019895804930743877 -0.0012848640610859466 -543 -0.008403263122905095 -0.010110530886943685 0.0016250745100911436 -522 -0.00235343490059379 -0.005821725621201975 -0.014831986110216069 -541 -0.002052849658527383 0.001446847447984322 0.0015600130792332112 -520 0.0005441812914655316 0.0020611556729780707 0.0017969804508576564 -521 0.01905794717342043 -0.002386834191950047 -0.0014130319315243112 -213 -0.0036990379004162195 0.008707625631414345 -0.019663536410738924 +485 0.011178139277846433 -0.021617084858181413 -0.005247077888543972 +408 0.0016835580349242782 0.010384878087276615 -0.011894462536384614 84 0 0 0 85 0 0 0 92 0 0 0 93 0 0 0 -211 -0.005623424343732137 0.00041450752084430637 -0.00187652360271947 -212 0.006534163449200209 0.005670602877114846 -0.0069945707656233055 -205 0.008555811513959347 -0.002709371287039603 0.0014234983072410974 -207 0.01677499159222979 -0.003385261115317942 0.008761159144685641 -206 -0.0001887616937573145 -0.004069535594198049 0.0036374306485813203 -188 0.0030565470233890027 0.008303749761324268 0.0014899500510024226 -104 0.0036813924474077115 0.007994502590776614 -0.03313731805992863 -240 0.010056751094400922 -0.013332457722194798 0.036809456838136606 -186 -0.0012950439927692653 0.002894648277169305 0.006583342682271782 -627 -0.011158521584990703 -0.0009662710867750767 0.006042395691770004 -679 0.006444076291197415 -0.0014424205891745063 -0.0014998614075233054 -298 0.001415424120738642 0.003068364998106709 0.004182110752503899 -498 0.0015425122749562377 0.016719318190993645 -0.007505001561501574 -242 -0.02456132712089157 -0.00499984312835767 -0.017843586754103514 -497 0.007139149173339814 -0.0145879096307924 0.012441864775946854 -496 0.0010186556613462456 0.005655575482822908 -0.006762667135991682 -243 -0.007715796816331542 0.008719348744647202 -0.007300486873615359 -653 0.010449033256064723 0.004309437854212114 0.000935271957518078 -291 0.004183977929022222 0.0034791720281195566 0.008654935223702453 -476 0.016439414220948263 -0.0010854446635568742 -0.046096342306847136 -626 -0.004396560653690805 0.010758464422674686 -0.0049427779061986445 -187 -0.004442223772804815 0.0047589723343784175 -0.0006148440280884378 -198 -0.017122202248149542 0.004671830831065398 -0.021591592448874278 -477 0.0040737641278782745 -0.04058404020647128 0.019242920253909494 -385 0.007886786472273232 0.0013311289547582469 -0.006409370965421947 -432 -0.005112477606678751 0.009856086607739475 0.0027357065631810756 -386 0.02463926635147559 0.016683088148706424 -0.009438473091688007 -387 -0.00010606347230315728 -0.0020318345731269952 0.018980717561988752 -431 -0.007493012343989028 -0.00807857236319325 -0.009881982085251819 -430 -0.004524910755669161 0.0069218123924701105 0.0028532664656262 -475 0.0005240789999880052 -0.0036600642125827463 0.0005837376117434307 -577 -0.00039257654752591074 0.006216233007986547 0.002821290791104702 -578 0.020057630069978766 -0.004246264624556574 0.02613706699373874 -579 -0.007622100966699831 0.0073994147205036324 0.0020110299310591565 -282 0.0008362717929222001 0.0042467846601403755 0.0027792731068598457 -281 -0.0022527029426062414 0.003975642769665842 0.006531907364618286 -280 -0.0020932155844553303 0.003303421993385573 0.005106114099904367 -576 -0.021795680954640875 0.00033248379966947404 0.0035909079681866697 -115 0.0009651319566518861 0.001613687366934229 0.0031050301198059047 -117 0.007092275821736963 0.016601328333389103 -0.010174399596936017 -654 0.006666123396093453 0.0034820782549897476 -0.007548491071939311 -196 -0.007724650614744938 -0.004434335618261068 -0.006100969448446816 -353 0.0012893706598156962 -0.003696189678514886 0.006810683602718142 -575 -0.00015451142420669985 -0.007903206226872591 0.0053590040277165804 -390 0.0019318952353184432 -3.915485612460652e-05 0.02512946163532081 -468 -0.02149606396352213 -0.014627346139848459 -0.02322137074184742 -680 0.0021316175435442384 -0.006654962178855455 -0.0001873582646005704 -401 0.010401215314564395 -0.01960362072239097 -0.01515973547470601 -241 -0.005230192439982171 0.007020204461620798 -0.0013500646300778566 -400 -0.006812157761295941 0.009089711854151245 -0.0036543826545893435 -562 0.0019804650115473567 -0.00028603596969985575 0.005858052848098717 -563 -0.01218620597672023 -0.015524824921392979 -0.008793186490164185 -564 -0.008935569769710614 -0.019371477501039753 0.004169465211802351 -687 -0.02132702946477968 0.002624497943599152 -0.009338031127366477 -467 0.012537198784621843 0.002965885297784254 0.004720391558890157 -666 0.00798795194024716 -0.030319685798422914 -0.0020188158019839183 -664 0.004749322796011822 -0.0043766561886238765 -0.0049774737380464725 -637 0.00588099891901965 -0.001216339123192569 -0.0026242446564109594 -290 0.014516979272844701 0.0015897248385656547 0.005707976744589011 -652 0.006850034980395777 0.0026782797648557486 -0.0015069280546491383 -402 -0.0034976084774069804 0.004535202116435988 -0.005087829093657203 -257 0.0012607025312018137 -0.009368212646836838 0.006968118390459642 -256 -0.0018478117849684223 0.002025941765796813 0.003727441819147934 -424 -0.006901245522197137 -0.0013303335985025966 0.0011059441800063592 -665 -0.004108673022343136 0.02756341408187244 0.004998477269975495 -122 0.03325733328895117 -0.009837145275822285 0.010300807091427751 -258 0.02352477625978478 -0.000800587290288175 -0.002937467081773502 -466 0.0008211706166287764 0.0037786952682420934 0.0028864889717026224 -377 -0.006791525954268541 -0.012741664603392176 0.008960836876523243 -105 0.0075254897454936276 -0.004097719399251073 -0.012147216735037885 -580 0.0037274873834820628 -0.00451385869218868 -0.0005479283373083121 -638 0.02378979194655618 0.01258017180535563 -0.014888606022849447 -717 0.0008536852916907268 0.00758135276550789 0.00866904087809462 -352 0.0013677093267280443 -0.0035327394727749832 -0.0021756600763700967 -137 -0.004025571305218045 -0.0011771198658975714 -0.0028210853387310437 -692 0.0019285659783500123 -0.007498396388372936 0.016327933902900025 -645 -0.006334167147176737 0.0026932034532357765 0.03810632174272965 -185 -0.0258016499999917 0.002966337289661987 0.0192775032868555 -292 0.0032239529951158365 -0.002940539950527776 0.005128379648619589 -294 -0.002882030968976172 -0.009999674767135671 -0.004996218559394716 -574 -0.0017098010265335615 -0.006233341003337626 -0.003130881298453147 -711 0.011550634037340288 0.005661405841651928 0.016230520184342886 -437 0.016623543237673673 0.021126526281754876 0.01525697145973429 -436 0.0011580833433645576 0.001866769096270803 -0.0020668982892715054 -588 0.003788053246840207 0.004318290540820436 -0.009756708962759054 -438 0.002778859820834817 -0.0006615532270598109 -0.0008258015725774891 -701 -0.0077340127867783545 -0.0012750504303974512 -0.0015549160015513451 -700 0.0003771746026641942 -0.005971056101101204 0.00048713541643599623 -513 -0.007685562035241124 -0.003451884123490726 0.011140761717829488 -106 0.0012167401758591842 0.0005190446916700595 -0.0005689566549062379 -702 0.0012360073361495057 -0.014010782072965118 -0.00023435212022074399 -138 -0.00844580607399001 0.002622106272118458 -0.006828542248324802 -542 0.004462053398768184 0.00798739986184309 0.005271563844807477 -376 -0.002635850208642133 -0.0009250576279445919 -0.0022212103610827097 -639 -0.009436328867848297 -0.013749239756427646 0.006593851052360545 -524 -0.005123725178539699 0.015426884373031625 -0.01834347769166834 -360 -0.004178590839375953 0.012772866811974804 0.009637982488128747 -359 0.001703407707272143 0.009108089839648342 0.0055708198881699615 -358 -0.00036687245580791145 0.005831964931051857 0.004159047388106057 -289 -0.001595283063915116 -0.00038607006533445217 0.008644630517419101 -384 -0.0025783811970427543 -0.010842560568130202 0.0002485575154442456 -406 0.008334788236422419 0.0010503441284235345 -0.0023800280127281867 -408 -0.008249724433327414 0.0125860312627397 -0.013608031710222075 -523 0.002630732510263263 0.003918200827993626 0.002970183260485006 -407 0.0010126932985940003 0.004105264448148497 -0.0008185914388617361 -525 0.015007331123588413 -0.002998296737147837 -0.044921726699770494 -625 -0.003508771931501176 0.0027372555782873113 0.0013339734432499892 -136 -0.005107835457616012 -0.00017978248743965154 -0.003988644887833829 -587 0.0006181639400713768 0.001490404492305943 -0.005441807772501442 -184 0.006119642789751914 0.002129260802961511 0.000355130366432989 -404 0.0055448536095734375 0.0007743654867219097 0.016037969196716063 -313 -0.004078044888590166 0.0008247081419541478 -0.0005316362965100083 -238 0.0018177803681502889 0.001226893367767893 0.0007423981284663952 -461 0.0009318635511549625 -4.928350118386009e-05 0.0045466223791930825 -354 0.001972954579596857 -0.0043780296240654385 -0.01077371477183407 -314 -0.009623735019970261 0.00665798742211111 0.02408146022132393 -403 0.006589710410456089 0.007960810210289698 -0.0020320127654004315 -698 0.00031058122010607815 -0.010174080916795681 0.006501436501535736 -114 0.013755765119664892 -0.013815807900815349 -0.008433355002016293 -697 0.0007293039474806055 -0.0017923216167614411 0.003822203247328284 -606 0.008037094668825863 -0.011716121615248383 -0.01219235266766627 -317 -0.014708949199744841 0.009643525399184418 -0.0020141933611741514 -108 0.03603925575757461 0.012858477843299815 -0.009808108963212754 -382 -0.0028195334564676882 -0.0005791679751282715 0.00626241480650448 -219 -0.01247120825189971 0.0030987939456600623 -0.01140054054306225 -670 -0.0009417370514361473 -0.00047014470829927983 -0.002823228428905164 -396 -0.005706783431449613 -0.011306512585110057 -0.009211332176758109 -395 -0.023204652307578223 -0.011850758133780951 -0.014161496708519091 -394 0.0029623638021562065 -7.495431979780323e-05 -0.0017703271435133582 -204 -0.009868889536072716 0.02769142115737454 0.0017278949223337818 -608 -0.00450536239188671 0.002161396364473985 -0.014865545157464521 -203 0.0030390793343812923 0.007253293998996769 0.002638515417395934 -202 0.002472172566760438 0.0031112304950174172 0.005448652165971851 -486 0.0032226946473274958 0.027815340414288316 -0.0050285190432157985 -347 0.011618224126060037 0.010964925075023732 -0.006653010163344175 -45 0 0 2.5892839001447932e-05 -471 -0.007037423015746189 -0.003782108828722424 -0.011604084450051443 -348 -0.007877981592598695 0.00414031561501778 -0.0030371587615563864 -275 0.0027899592485585616 -0.011786738734745311 0.0008697111063236321 -346 0.0014770373743619686 0.003355855691268311 -0.005340974682633985 -572 -0.0025855405956535737 -0.007377959785635259 0.005585381444125606 -338 -0.0070240134955776665 0.004933198476666814 0.0002829725739334517 -485 -0.005851182975421713 0.013136051886263062 0.012654523591979782 -571 0.00834830199522675 -0.0009831706646230961 -0.0015188720646701576 -591 -0.014367954804647138 -0.0282607848831299 -0.0021645959273891365 -589 0.004702184319895896 0.0032133515813428256 -0.002238551119579548 -607 -0.0077765081012144705 -0.000563208567949008 -0.0033449827357436538 -609 0.00272424910864701 0.008195494864301909 -0.03137225773080429 -180 0.0008690738597768954 0.005018713025200337 -0.002945938694498902 -274 -0.005699313791818707 -0.004759962610832066 -0.005872756565232799 -686 0.008217894207660833 -0.0100983629438411 -0.021635270384703958 -671 -0.00024128230687570196 -0.021572647010253177 0.015357674519379468 -672 -0.0012462607034635857 -0.007069689753832631 0.00381563953963042 -112 0.005190774999806905 -0.005729811432305558 -0.0060176087276321245 -681 0.0007714432326670715 -0.004259570858526994 0.0008648677556282801 -113 0.0043631901827183815 7.2629853515748496e-06 -0.016906736065202134 -344 0.0006884579264700855 0.010742221645104114 0.011459152479148704 -343 0.0008499678995289771 -0.0009767427603578425 -0.0031023296178217664 -345 0.0020361124741315505 -0.0003990095428137886 -0.004264505629606172 -255 -0.007269101324618613 0.011421184414796655 0.003680445929695058 -254 0.006698925536045348 -0.0016114719270781995 0.005001912184894123 -309 0.0026873735966253492 -0.003516917240483255 -0.017190081722208775 -253 0.0010722910362563373 0.004038576864854738 0.0014868195441214305 -479 -0.013992183831219059 -0.02537860894898881 -0.00897013602536543 -109 0.002777209346426365 -0.001936144063141461 -0.0069405893687318095 -480 0.018491401867564334 -0.003446569057091999 -0.009085032649696024 -375 0.01146247831539809 -0.002217879718471049 0.0033766238753439658 -44 0 0 2.5892839001447936e-05 -110 0.0019920646548702734 -0.006687944878399153 -0.016768903427213912 -307 -0.0002242679944927341 -0.0028719408963667494 0.001806513745984584 -685 -0.0005070695650422137 -0.004796427068777599 -0.004675336978463182 -635 -0.006874160125070285 -0.0014608020876715408 -0.02409078032412396 -636 0.010895677030626532 -0.0037324590359100168 -0.00047381957852790586 -271 -0.0006627518310477532 -0.0006417588443855544 -0.000925908330851208 -722 -0.008255845250114668 0.00023297165630569398 0.0024535094545625113 -481 -0.005629526983345739 -0.0031242149927506956 0.0037214577831749165 -721 -0.001593152923256278 -0.0007609137655317765 -0.008921595727198363 -483 0.0018748021123651613 -0.0041152897635225805 -0.013180944449052353 -723 0.014252615954590953 0.004118554178258352 -0.011499683175531865 -482 -0.007456018443800531 0.022105815174257835 0.017712618439186752 -210 -0.0015471256324352317 -0.013597641088573208 -0.006216934372877166 -208 -0.0014177674098368779 0.0004455926366301616 0.00017918089607261745 -469 -0.0005997161956485187 0.004690227452983195 0.003880946509081852 -209 0.012946439616943303 0.0003010845740829233 -0.024955441077315038 -688 0.004244333938104657 0.00088687279816499 0.00042834367934795574 -690 -0.01615279858740688 0.013008480696852221 -0.002485959767769533 -634 -0.006715643473882907 0.005128315157175796 -0.0028461075943380623 -689 -0.02883305567581292 0.033940126886677344 -0.002767256806642573 -662 -0.01022324961652937 0.02459966582402962 0.007784567790126536 -149 0.003448328041689386 -0.006877133198457014 0.003969592342967052 -590 -0.02195059781319254 0.033237536847323716 -0.006017526921710795 -433 0.00272180042867418 0.005464940336619222 -0.007183585266666167 -435 -0.00997731338770566 0.018353157147169678 -0.012308600735794373 -102 -0.004933393112589753 -0.0014184896165212457 0.00282315695425379 -140 0.0037442461642616855 0.0008981125403190698 0.017717716926278767 -417 0.008997384653293916 -0.0007344093814239228 0.006883529345814865 -415 0.0010928032033067465 -0.005899521475255703 -0.0035861446547572782 -416 0.010512486392201103 -0.00010648666874990137 0.006727460050107925 -459 0.019803011405952094 -0.03588714256147905 0.008839860703799078 -217 0.0019975096609847784 0.007198832692135352 0.007528959939583509 -478 -0.003112488499603424 0.003929662738660447 0.0028623819844919673 -361 0.0006999918066639268 -0.004357350629198427 0.00022328947844429584 -197 0.0056318114382033204 -0.01769689459774823 -0.010011278507051987 -650 -0.013351051426644498 0.005724197454670781 -0.007295403538761586 -488 -0.0020278193298860344 -0.014631550395182694 0.006454598682826132 -484 0.0007862864811946282 0.005692991164955517 -0.0020259406411123064 -661 0.0014175655249771993 0.002025210035311634 0.0015878833296731276 -363 0.005742013891446284 -0.008837413122760119 0.0011588715258481145 -100 -0.0018359970011427253 -0.0034868726137758537 -0.0012239581668545684 -707 -0.009434545254390386 0.004083690301746898 1.2720907411063185e-05 -178 0.0002213341038015743 0.00042280505641683046 0.0012455284523796245 -684 -0.0016857583723109088 0.01457015268967376 -0.01248668591187947 -36 0 0 2.5892839001447932e-05 -276 -0.01288304297198337 -0.0024180918894788875 -0.009445007106884281 -214 0.0040375473866697525 0.004832098072512322 -0.0011350282263338225 -216 0.003281923037182911 0.012991080014267777 -0.00640293960536805 -539 0.005431350013191119 -0.02106556848906726 -0.00764575525773749 -538 0.004112938902306128 -0.002290109903302108 -0.0010714133951981704 -252 0.014720479077525389 -0.004278515844677452 0.00617407962447848 -228 -0.02651274201810521 0.006169895153203455 0.0026039557167579757 -226 -0.005986759492118269 -0.002624851477283382 0.002437497167111253 -227 0.037359535164647996 -0.005692341539956028 0.0007690705251742958 -540 0.029556683797969833 0.028216009622947624 -0.007637203209894227 -596 -0.000697425483047941 0.001418504974987797 0.0025860571290182237 -215 0.0019872688713270963 0.009030373521039053 -0.0024074898093308073 -234 -0.013734641718106119 -0.006668468740782935 -0.01326772362636071 -706 -0.0074752312033302334 0.005036319412231939 0.0023954321652624308 -708 -0.0008425953758246843 0.009181695196824482 -0.009248661735532846 -373 0.004422144964975159 -0.0017838198122578036 -0.00018027826543031534 -272 0.013275855183390188 0.014396950748917418 0.0007514222935930509 -273 0.005974305377988905 -0.0017929350389151585 -0.004011080458908929 -362 0.005928696718884773 -0.0061635334731560834 -0.0070875384379755196 -597 -0.011587275738507787 -0.0026775845755159858 0.005599952012635736 -519 -0.010602493961103342 0.01561109572005503 -0.004366769028339268 -682 0.001983241531391707 0.0001436343494854703 0.002165088698424475 -161 0.009978689554182 0.001974367386088278 -0.005346935314707327 -683 -0.011175053949123178 0.011604486671463417 0.005680469507150669 -339 0.011317559380578967 -0.013840330482369045 -0.013807747849132778 -470 -0.012260116006234724 0.0029555761306863846 0.02022738168370677 -595 -0.0012887047489432875 0.0007223671835801802 -0.0028794772050928733 -649 -0.001959620111970716 0.0027086652664905795 -0.004508497780011865 -179 -0.008134269078556558 -0.018166688138021095 0.0007578460469746819 -308 0.0220712849298707 0.00809270514744733 0.0063544521946541635 -663 -0.018587653237992264 0.008058025396004323 0.003021049320538634 -337 0.0009033685485476928 -0.0015102179823566727 -0.0064849412993145715 -327 0.00783068755116193 -0.006919671129723819 0.007255760426290675 -325 0.0014839226012046617 -0.004293646082977329 0.003541697150309064 -326 0.009138500341898103 0.016222223033475605 -0.004576555598052157 -535 0.005511650342351115 0.003976008787370079 -0.0035332740014495886 -537 0.00039714859735720515 -0.0034221246954245044 0.004417018509094299 -2 0 0 2.5892839001447915e-05 -1 0 0 2.5892839001447912e-05 -11 0 0 2.5892839001447912e-05 -3 0 0 2.589283900144791e-05 -10 0 0 2.589283900144792e-05 -9 0 0 2.5892839001447915e-05 -536 -0.008139619366591666 0.023305802200695613 0.020099395824835317 -516 -0.01472371433290118 -0.00947034405699238 -0.006759743057624231 -111 -0.0005643300911320225 -0.00203649367262994 -0.0031700572161786175 -515 0.0021658009569283476 0.013002309599111122 0.023091810824977285 -514 0.002194248370768298 -0.00477869990315876 -0.001376235961931239 -168 -0.007642051948728814 0.0025148703254984145 -0.0010089913229547366 -166 -0.0018884353605177553 0.00853020828258679 -0.005584376923825304 -17 0 0 2.5892839001447922e-05 -19 0 0 2.589283900144792e-05 -18 0 0 2.5892839001447925e-05 -27 0 0 2.5892839001447922e-05 -26 0 0 2.589283900144793e-05 -25 0 0 2.5892839001447925e-05 -434 -0.0131141501224289 -0.029735168306092356 0.018069386056516087 -41 0 0 2.5892839001447936e-05 -42 0 0 2.589283900144794e-05 -43 0 0 2.5892839001447932e-05 -33 0 0 2.5892839001447932e-05 -35 0 0 2.589283900144793e-05 -34 0 0 2.5892839001447936e-05 -518 -0.003364650601080657 -0.0025510701028415793 -0.019031077701915526 -101 0.0066056761815660925 -0.025335359921442018 -0.0042522676779589135 -517 -0.0042150036150125966 0.003039265084075177 0.001234238912865041 -150 -0.003263779481471764 -0.006968079925877713 -0.0285427305003533 -37 0 0 2.589283900144793e-05 -13 0 0 2.5892839001447912e-05 -4 0 0 2.5892839001447912e-05 -12 0 0 2.5892839001447915e-05 -148 0.004337680509183382 -0.0024120213706328784 -0.0023459000779718947 -5 0 0 2.589283900144791e-05 -167 0.0022761530768332797 0.0009747010232492098 -0.004993243345757521 -328 0.004462110300378782 0.003171460897117234 0.0013533076822872438 -329 -0.0028078357210696643 0.0006206344128711716 0.006200475106646407 -330 0.030738960581955917 0.003287330484129426 -0.010708188876434703 -28 0 0 2.5892839001447925e-05 -29 0 0 2.5892839001447922e-05 -20 0 0 2.5892839001447922e-05 -21 0 0 2.589283900144792e-05 -457 0.006550818533058792 -0.001884276384381016 0.003039243394733296 -573 0.013975969924696937 0.0024199182318704903 -0.0034702509100560364 -651 0.015420309153338693 0.010283570358113264 0.02634159883149936 -218 -0.003395956296838163 0.00547325260028855 0.0019942972776871965 +693 0.0016850498482422836 0.012795588923833173 0.008819177076982475 +691 0.0006659466365485686 -0.004801790379394271 -0.004167147629911888 54 0 0 0 55 0 0 0 62 0 0 0 63 0 0 0 -192 -0.004363758761444326 0.00951161221484961 0.017129944705041603 -119 -0.004701077453742114 -8.296328219091687e-05 -0.0009688745560292821 -118 -0.0009314150513423432 0.00027605062629613427 -0.0035150783233501826 -191 0.00680583753605197 0.003167173243801115 -0.015417719909486413 -190 -0.0014967223491699952 0.0025908878048932016 -0.002402175301537957 -98 -0.009260175858086675 -0.028226198550552986 0.007567183856183354 -120 -0.0034806697031884997 -0.003298183743718096 -0.004362434174689871 -97 0.005989233619364602 0.0023803823609934273 -0.0030417661760985806 -244 0.0017880362939288001 0.00422352421710819 0.0005606753077441453 -99 -0.006220115534110591 -0.002045805635333923 0.0006476194511692398 -631 -0.0033826096876896855 -0.002181941878393241 0.0025269093094629474 -295 0.0006648861314364348 -0.003931280096251278 -0.0026803518350101033 -296 0.0062929742791497266 -0.006194372009187594 -0.024124245716887833 -336 -2.5155253934298795e-05 -0.00267261595791318 -0.014156428435828225 +537 0.01468949321341597 0.0002955070862203851 -0.0005770601442394362 +536 -0.013636100182219493 -0.03966146462346522 -0.016320795623323316 70 0 0 0 71 0 0 0 78 0 0 0 79 0 0 0 -334 0.0001249108228848411 0.009592140759049824 -0.008055311762730182 -335 -0.008933120836296046 0.03861648264199437 0.005139262991883574 -656 -0.012795486572600556 0.01001730917412183 0.010504777975066928 -655 0.0002453631990046368 -0.008270009402721512 0.005790081828127683 -657 0.0059063953119072934 -0.011220436899447496 -0.011461093784466869 -331 -0.001861800330708783 -0.004080943128134591 -0.006024367439539751 -225 0.008847588531356471 -0.005432354583684017 -0.017291462941727266 -223 0.0018512701070779799 0.002105046598030068 -0.0050342839053457425 +212 0.01705537091061074 -0.004886408006080845 -0.003352178696340439 +197 -0.016828593668849028 -0.006738778640958227 0.014672615750273036 +213 -0.006844285828259031 0.0005504793122972704 -0.01690321699919477 +211 0.00047763896071806983 -0.0032200506515021304 0.0031358523377286716 +531 0.008315679787373681 -0.0029449319799378826 0.02301150358070123 86 0 0 0 87 0 0 0 94 0 0 0 95 0 0 0 -246 0.019304488124036106 0.012412888772496453 0.01389232978530525 -224 0.011417823406336933 -0.02584104798241233 -0.01586969560916166 -283 -0.000656343011071711 0.0008016291011868049 -0.003620593475455601 -285 0.0051281146563605 -0.002140065887603185 -0.011749359473630993 -284 0.002108917603863087 -0.010745428739586635 0.004067661946326833 -135 -0.0019613502216042204 0.0060261613203991815 -0.005145175930284868 -128 -0.01091600795889493 -0.005359155172554258 0.0011735199042172864 -641 -0.0047721234085586475 -0.00089548417111443 -0.02881249647727017 -694 0.004306853434289274 -0.0003461190629024837 0.002613610137021579 -508 0.0038336193257742066 0.004428638671902145 -0.002578190874375256 -365 -0.0008789666156448981 -0.01647416448186925 0.005405726875929458 +173 0.0018108173359719039 -0.02194729107444219 0.03303638780801747 +529 0.0018196663303762268 -0.0019337872361304407 -0.0004951331903322852 56 0 0 0 64 0 0 0 -264 -0.005069066816637629 0.008594012902267328 -0.004896454013501075 -262 -0.00411559201856892 0.0055846035307135136 0.0022939832937934027 -303 -0.012248995229285456 -0.02038598577770783 -0.0067506409467423655 -263 -0.007203606603798386 0.00015673233657838596 0.009479088778907655 -696 -0.002403944998986855 0.012547542006427242 -0.0025721085279788183 -555 0.010313716462669934 0.017093518256946594 -0.0007535353716470382 -460 0.004762464388993355 0.0035128765813662345 0.0002544426222686458 -357 0.0026975244838181372 0.0006296683369134417 -0.004187815650450881 -355 0.0009889367525614406 0.0028571604624972836 0.0044422297391537215 -642 0.011684188963247771 0.02173040302358248 0.027637684910990796 -440 0.004733172069375852 -0.0006744085975210469 0.015964767016019198 -441 0.019273424633345186 0.02031857101103021 0.01136636551406023 -248 0.005408140991082604 0.01948553192838653 -0.01769576815856515 -439 0.0021888008868001167 0.00022281918895093757 -0.0005699233777872146 +549 -0.001085187706420696 -0.00574725337910797 -0.016056269313645996 +547 0.004373179305666361 -0.003029062157355542 -0.0017211998966215611 +425 0.010010309618889898 -0.004056891961561442 -0.025365538726182652 72 0 0 0 80 0 0 0 -593 -0.010764868078727771 0.0004632189843140992 0.03371192356674729 -592 -0.0012510047155927621 -0.0013228538172386057 0.0030004231674896093 -594 -0.003138799668445178 -0.009265431891145101 -0.0035030936801646703 -229 -0.004015308077517968 0.002304541027168982 0.0018452763612786536 -356 -0.00439289027906843 -0.0003181501233854808 0.007804079534610549 -443 0.01501004287837676 0.01274826059103139 -0.0008103413168549527 -230 -0.0033363552955116165 0.0011395679198842948 0.002421577058286637 -442 0.004590428851528285 -0.00016647082324879346 -0.007536939151246863 -444 -0.0004709522261627252 0.0007916817345592208 -0.01857710544198639 -231 -0.005563876064052946 0.001516515443061688 0.0011917788782933065 +584 -0.02113256914273244 0.00879913545422227 0.005306119166035373 +512 -0.009668620362088287 0.0057211811089109554 0.003791885288692614 +351 0.013871895197824322 0.0037677016362735807 0.03166326938297827 +350 0.0004693304380701279 0.02107627618636817 -0.0018376988073814104 88 0 0 0 96 0 0 0 -553 0.002310850563285711 0.0038622245684212407 0.001063744581887175 -554 0.020520241141740107 -0.005768318995011451 -0.008503556427794993 -699 0.009769647936468813 -0.0026398354232907723 -0.0019420937862542735 -247 -0.0005440687793801106 0.00533274551270155 -0.003116117624827588 -527 0.0018514500777837737 -0.009230378273878258 -0.0060158525133069156 -245 0.005556414067735625 -0.0055651124084785675 0.0033327958619201684 -633 -0.006228493799001829 -0.0025536564906557587 -0.008694681481617547 -123 -0.0013254634442550768 0.0063472029134561585 -0.011594854053242773 -724 0.009989087181242503 -0.005372152351255475 -0.0018551724238006096 -725 0.028063127915331425 0.0036594616018658425 0.019379030908003192 -342 0.0006491711315738201 0.016203183514455405 0.0023688436726023014 -340 -0.00433735839176797 -0.000495918764211808 0.002257318744322688 -341 -0.0006929018962787288 0.015189606179435388 0.0018137275128837062 -364 -0.00882244249614916 0.0034576704590505883 -0.00811983159685899 -726 -0.01855210191687358 0.024009648567330344 -0.010178733951576051 -503 0.014134059605139943 -0.004326106316946778 -0.001926850902735659 -502 0.003759520085920061 -0.005572417624353865 0.0038047544622829043 -504 -0.003935710721857757 0.005577813760648028 0.013790854542965157 -413 -0.021593565939491674 0.003234704353097422 0.011974405473584714 -278 0.00883327301294058 -0.013449834793822607 0.020644593756055547 -270 0.00781868067364934 0.002754459504676058 -0.0010544004588571533 -719 0.006398783376387078 0.001946288912145545 0.022229144951245915 -132 0.007832425765429163 0.011404797448368427 0.015400661765000056 -297 0.0038792006849247243 -0.007593554626325106 -0.012809257149632622 -392 -0.011715180257929931 -1.176189615249834e-05 0.009633360116141418 -260 -0.009423773124827882 -0.023186194647239755 -0.02190022720812517 -548 0.009629883272752136 0.006774886139507993 -0.020907198728238808 -302 -0.007841165533640462 0.003026014956910295 -0.00703538244890269 -259 -0.003426942147231846 0.0014749707614869303 -0.003444717877250437 -261 0.0006945604695285328 -0.010576783124679686 -0.0020734669000596877 -640 -0.0008886178358934431 0.0060434330372213935 -0.010383480842809305 -532 8.241792411033156e-05 0.006040661450994054 -0.002463893772382022 -235 0.0007038770519582305 0.0067292095538841615 -0.0028443681465380494 -533 -0.0002129926328668816 0.00488451374048223 -0.0028066827071909287 -534 0.007064961280930333 0.025232242617842127 0.0008574875214082739 -621 0.011287366443141251 -0.003449176508228183 0.017928382611092662 -121 0.0007022815589027053 -0.000892538811671254 -0.0018627823896997114 -269 0.00469009840256279 0.0015241035513903975 0.001984306143110744 -265 -0.0054586758884403105 0.002131291238446908 0.001153323924828889 -547 -0.0011175811849537705 0.004103087625132249 0.00078716134613171 -619 0.0003632578854721528 0.005362253640767787 -0.006417849782413687 -279 0.011624081133984786 -0.011774327315428757 -0.014995684102348524 -293 -0.0017466342827571289 -0.002552253740249767 0.002528434692005852 -695 -0.004911630333401857 0.008651651256560356 -0.0020402912967414214 -494 0.005776310030291935 -0.000219217384465697 -0.0012280489592709103 -131 -0.018436321747528253 -0.021208301175051184 0.0006884707536230596 -715 0.006546258488425628 -0.005755050576697564 -0.0039883518170252905 -239 0.011588133086593538 -0.011846815428878082 -0.00881463043856705 -414 0.010325867114536506 -0.0006113612193524784 0.0017105622669241444 -648 -0.0026558023935934014 -0.009616362543538188 0.010264407433954103 -646 -0.0003042619186802288 -0.006311024166021424 0.0031010083811757994 -565 0.0007394748342163842 0.004516477559592657 0.00033539363242210933 -566 0.002090696563890277 0.0033273332142688904 -0.006266252541019348 -544 0.0007700118900610095 -0.001389627444945187 -0.004115546441642321 -546 -0.008050688006328074 0.023127963394541477 0.006164274038600667 -545 0.005924140141637715 0.001350652630120117 0.004941780161927939 -495 0.0069079619862543245 -0.007627704476709708 -0.0021154124154080375 -647 -0.00017732064807360345 0.002645796003071014 0.007429648590994952 -493 0.008654158253716833 -0.004029112678793171 -0.0016991226950217582 -301 -0.00533271211616937 0.007677255432536089 -0.0016339575663828834 -127 -0.0017719186381853886 0.003534213331123468 -0.0014256780429603613 -266 -0.0005212803553580399 -0.010749716358853169 0.007192928429952392 -391 -0.002578132714595172 0.0014365390200574261 0.0008211021077538514 -465 0.016880882832760326 -0.01067083624985097 -0.00022780999411606596 -333 -0.002918705357704968 -0.01118788463028499 -0.011006638219927969 -366 -0.0034141036467909827 -0.01084067671589307 -0.0004984580617246783 -267 0.006279258266850698 -0.018295845749178304 0.003999927664413487 -157 -0.0032474639721635297 -0.002071067218862699 0.005146248544668708 -412 0.0010230248589894202 -0.002669542251526284 0.004046648042845933 -393 0.003984235524416656 0.01206305025975438 0.007338917088694135 -405 -0.0055971864668224415 -0.001835879479675777 -0.0003608610575552909 -448 0.004430595048261473 -0.005005222921986947 -0.0018506673587511161 -449 0.01637776697980032 -0.014127790377349642 -0.00434461965343095 -584 0.013793791431671172 -0.009326091804055824 -0.01747981576570497 -585 -0.008359394537154218 0.009831653490172253 -0.015131425117590833 -318 0.014260723165817455 -0.002876736345312385 0.01741120858595613 -450 0.016867039987388758 -0.006826024777415599 0.0014250845205727915 -159 -0.0020686816783562546 0.023218708679260347 0.0005679898884230374 -277 -0.00031624432316685767 -0.003276417788006159 0.007206583965036211 -174 0.02232250253907675 -0.01231852993148094 -0.010546896918912205 -158 0.009085924338852294 -0.014728147944420766 -0.020912169525047947 -236 0.006765120985488478 0.005926831661173007 -0.002318291635240894 -332 0.0042747818750445725 -0.0017899782198140476 -0.007971038141225751 -567 0.002235629448123555 0.003016503143010697 -0.003392544405989525 -268 0.004011420131944795 0.008377084166031164 0.002316053989518986 -144 -0.012024612981489083 0.005361811091711969 -0.0014672866723572583 -143 -0.0073730174733633545 0.0040880726939264795 -0.0165900644982253 -620 -0.0065142327069454865 0.035190802650504636 -0.0006640427681044298 -142 0.0028419016591640558 -0.004087187698190576 0.0037294719979222247 -129 0.008463487923697903 -0.0015510850454567688 -0.015170037898573475 -549 -0.0025830067012953825 0.01852116530899133 0.010385008510639499 -583 0.004268963968694046 0.0010471359047598279 -0.005851219475190436 -718 0.0006430494717885148 0.007923101925764318 0.004010379569037137 -237 0.014352864654346011 0.01020811390215342 0.00047127720322738515 -462 0.005064298161311936 0.0015423027868889188 0.008335104423218753 -130 0.004406284567008871 -0.00860513254615911 -0.004879385522234749 -720 0.00393831447904276 -0.006119628459627095 -0.006764066218979042 -383 0.004218653914705313 -0.01202327645784736 0.022980672819351747 -133 -0.00102039624254495 0.002371407198966068 0.0067364713751238425 -511 0.003912741513012298 0.00101552438914296 0.0018958766721141054 -134 -0.0033610434450266286 -0.0026284616742153787 0.00674072004379062 -716 0.010566057481285352 -0.02176428147337611 0.007168160969202919 -512 0.01634597212601708 -0.0002926570645188546 0.007738629495829494 -509 0.0011140510641293316 0.0007182760943427564 -0.014628144005186052 -568 -0.0039044314646687196 -0.006830451357868171 -0.0022373549345757774 -569 -0.0013290493571988461 0.004839537419246563 -0.006910692862670655 -304 0.0054736539006658485 -0.004960430228645577 -0.001968166657216059 -305 -0.012109090513145905 0.00577200024652643 0.005396896203310628 -418 -2.437543145425559e-05 -0.005689015414779892 -0.002258568108083334 -306 0.011459516326170439 0.0007872800806459576 0.005803298963212287 -501 -0.009350152887850311 0.003677986993344379 -0.011989987989375296 -445 -0.0008290701903718754 0.005643282980849799 0.0002485307221862214 -463 0.0004729541684906896 -0.0009865037215842994 0.0002106726307666064 -172 0.004731719855505472 -0.0030321314569809483 -0.0003530081265682011 -489 -0.014429505694453698 0.009455042753152534 0.01903652416959836 -419 0.0025409339530107623 -0.002879625146716656 0.0003702102460500956 -446 -0.00021411000691779435 0.00955825379875846 -0.00885753338160607 -420 0.007536051380740864 0.010381989365120456 0.005336366205111886 -499 -0.0006342662881036965 -0.00023501992000385272 0.0020560303434147245 -500 -0.01195099663304182 0.028212202950552916 0.014770929928671189 -250 0.007361035395654199 -0.004690688159251201 0.003061239445099873 -147 -0.009310962727936977 0.020391157953635785 0.03074647165589922 -146 -3.6811505540478325e-05 -0.017980254752765046 0.017302450341036273 -570 -0.0017712854514889199 0.0019656582840076615 -0.002982248494982292 -323 0.02025520719624794 0.00437956264756661 -0.0018309996628302016 -324 -0.014124442777214079 0.011549999461420518 -0.018237952404482057 -322 0.0016068916953904174 0.006306614444237204 -0.004315464210736402 -200 0.021753072613096884 0.018573023333333702 0.004427859217421257 -623 0.011452678250841558 -0.007224569524583359 0.0027236085578886244 -551 -0.014919499049456707 -0.01686470199682272 -0.009390344835571803 -201 -0.023111043546362873 0.00020560246955362896 -0.006295323851049318 -199 0.0004815918368625051 0.004853422247417755 -0.006061618709908838 -312 0.0008481996440953347 -0.006155473605828348 -0.0017282663370451403 -624 0.001586490607358962 0.004010243402294628 0.0059810887166708345 -350 -0.009760147323275311 -0.016632875743950715 0.016528153602606437 -126 -0.006532699294053725 -0.012656386469316777 0.0068195173267290715 -622 0.0024139583689417247 0.003498498050067583 -0.003655007006662313 -550 -0.0012162513220406828 -0.0033011033267567416 0.004819001835822252 -552 -0.00924649718960619 0.0013741774004242453 0.015653387667881418 -124 0.0001705708408269096 -0.000550279279659424 -0.0013377042655839796 -145 -0.002334830495624088 0.002793853156377406 0.006506801380971504 -40 0 0 2.589283900144793e-05 -599 0.0023217932209911667 -0.01835053819969972 -0.013463199934529201 -251 0.002581923394498151 0.0023298657256145133 0.006255129412513726 -704 -0.005296929928288727 0.01607189461778198 0.010179684267012322 -703 0.0034655840261788758 0.005574906464163651 0.005889701146370732 -705 0.010861930940493255 -0.0003350694921833778 0.01044180291497366 -48 0 0 2.5892839001447932e-05 -559 -0.005483933645194205 -0.0012780353966408038 0.0023721586219114825 -561 0.01337950290190957 0.0044607660522192946 -0.01823291897146361 -675 0.0031193771284579496 0.00217714638874969 7.001676744408073e-06 -222 -0.006345175465281138 0.004820356905560499 0.023282345551168215 -598 -0.0007217641988605089 -0.007385715555506205 -0.0009079271908534197 -177 -0.01851185003563661 -0.00016629752608533365 -0.012976887019520758 -310 0.0012985833227644886 -0.001566855158339641 0.001579031386051685 -458 0.0039239799167950645 -0.007481014210507378 0.009788403085109105 -139 0.00033494528818851267 0.0024585397677852625 0.000660401833580898 -614 -0.0009389256816982662 0.011828643953531368 0.018676419298217065 -600 -0.018094474476051486 0.00023445740586081488 0.008899796958011633 -617 -0.009036194427037533 -0.0025641807901169078 0.005251509094796726 -311 0.0010927413625261679 0.0024725292678410946 -0.0033258539523485773 -530 -0.009543198468485899 0.009194738162092713 0.002932821352048649 -141 0.007530076713547185 -0.010772382425474793 -0.007049312864075332 -531 0.01346275911311354 -0.015519264000711233 -0.013983233267324877 -399 -0.015794023221716955 0.013361754155793227 0.023184548477482157 -380 -0.00016532393637421034 0.005396941650961916 0.003706037154930361 -464 -0.009720016666000888 0.005508521851143906 -0.0010447395388278984 -428 -0.0032295145570997628 0.0073242509948272215 -0.008762443779130127 -397 -0.0019383749400236328 -0.004608215655716036 -0.0033540348251192864 -319 -0.0009038475895158715 0.0004032373568885917 -0.0008893950154038688 -398 0.0008784454978576588 -0.019930509233584276 -0.0023402740275860765 -528 -0.017149344935718215 0.0053125553694975455 -0.0062739095024969055 -321 0.011291342491685402 0.011778478494356572 0.02157510722031055 -490 0.003460299667122343 0.0005008872223548776 -0.003928509480568708 -491 -0.02042787598151604 0.009606293972625789 -0.014609420256501925 -492 -0.01179479155292874 -0.013123603914816054 0.006317741927870814 -659 -0.0069325446438758135 0.001872758468936734 -0.001820683375806924 -249 -0.003689403614427041 -0.009541231217973603 0.0028290387567211457 -164 -0.006400690048675919 -0.013877760093602321 -0.002977622020994794 -162 -0.004855407125325768 -0.01879111496764322 0.020518095513515515 -371 0.0186329030963466 -0.0030361600806192253 0.01127947927515273 -370 -0.006645327540014044 0.0013620044066288777 0.0040028544483149825 -610 0.002198658185540671 -0.005517799631155318 -0.0021977580020232164 -154 -0.0040921640552195535 0.004469932541531453 -0.004074017062258021 -155 0.00946262378435491 0.008912303180476127 -0.007853976504644958 -156 -0.007160039514904957 -0.009309817752610663 -0.004347645837647768 -612 -0.01853211573078728 -0.01727473985951407 0.017215191641891617 -183 -0.004442865646352574 -0.003400423991540166 -0.0018621889463709465 -629 0.020458137445744262 -0.0005441012285127372 -0.016121405666884327 -182 0.010414879082570251 0.030332837986610725 0.005191185967407049 -181 -0.004080198053479511 -0.0019011724834973821 -0.001840667647736802 -611 0.012212859606390776 -0.0026124264131294 -0.005669832465189566 -628 0.0001792339331808534 -0.002433089326052819 -0.001805358970649801 -630 -0.015366679651799057 0.027336154517751083 0.0030786076245146897 -487 -0.006612908041425593 -0.010557716751849671 -0.0004398534728532736 -526 -0.0028150615039515803 0.004044411001066752 -0.0013644193865672359 -151 -0.008568566244765728 0.0059744557184639255 -0.000627104807162225 -160 -0.005288304762918362 -0.004980091259974818 -0.0052020664728392955 -351 -0.014050712299375443 -0.02358677864502768 0.022078468617912066 -372 -0.010000271327845013 -0.0017495788438303597 -0.015743229425643938 -473 -0.008545742194336561 0.03299533080814433 -0.006554398847784694 -669 0.009323919846092737 -0.005503137113750206 -0.01757154792744392 -220 -0.010802030745763268 -0.003946674830891448 0.003347466106919407 -221 0.0031078719584793097 -0.0026986854685907176 -0.005051678138139105 -349 -0.0028467913154277976 0.00619549728782877 0.004513308653347061 -176 0.014573690185444051 0.005701141194454324 0.02429670540436278 -472 0.0034704444931731564 -0.0004223936528461586 0.004682456493386929 -286 -0.0007227944529852624 0.0002044846821905628 0.0005275546923425382 -287 -0.013787536809725281 0.0027725652215363646 0.0028043383019355616 -288 0.013467067943699075 -0.013607004090118587 0.010562692707514431 -667 -0.0033231615840826375 -0.0026754997278682718 -0.0025810158998434453 -557 0.00480046414868641 0.0036381648364985485 0.011568695731040347 -668 -0.010354343669844574 0.01551276249617225 0.001263283616141959 -233 0.018175533457414624 0.0017013730890884599 -0.000542455897216258 -232 0.0005655337868856603 0.005109144050052834 -0.0075456339065252485 -556 -0.002652573873678528 0.0017686267932879897 0.007383198916898972 -613 -0.0015918424196763945 0.004086688266801507 -0.0008860298641209033 -615 -0.0020836681424838757 -0.0005735018872513953 -0.013310568326146311 -447 0.01139703322386246 0.014688114003843386 -0.0018920048987641955 -453 -0.004830305681658932 0.02052395365578583 -0.006460118140426627 -452 -0.006659826339694623 0.0003543348655607981 -0.022845001543426367 -451 -0.005502850804956584 0.00025572828917443384 -0.005940030711587164 -427 0.006878068518221622 -0.00885399992822085 -0.004941337405656671 -429 0.016310095429692206 -0.004246153250381018 -0.0063539068368046086 -14 0 0 2.5892839001447915e-05 -7 0 0 2.5892839001447905e-05 -6 0 0 2.5892839001447912e-05 -15 0 0 2.589283900144791e-05 -410 0.0036773579068940594 0.005088334412447784 -0.00010670193844646754 -411 -0.013294041272967414 0.0018927422415192015 0.004022854780372532 -23 0 0 2.5892839001447915e-05 -22 0 0 2.5892839001447922e-05 -31 0 0 2.589283900144792e-05 -30 0 0 2.5892839001447925e-05 -409 -0.0033332525225770564 -0.00245864319500691 0.003352617057588178 -674 -0.0020876963116493253 0.0012720696117521837 0.004777046069219144 -673 0.001440207298745793 0.0006711067607754656 0.005750751000129193 -616 0.0034399261571874833 -0.0006771518251561286 -0.0008689301882926043 -618 0.011960174137895753 0.02757908212908868 0.006623095130093759 -47 0 0 2.589283900144793e-05 -39 0 0 2.5892839001447925e-05 -46 0 0 2.5892839001447936e-05 -38 0 0 2.5892839001447932e-05 -529 0.005442778008874495 0.007503881077571631 -0.00033589800355411745 -379 -0.001314351775643973 0.002379695621041653 0.003275885323478339 -165 0.00884464006202344 0.015924976929959245 -0.005078073570798919 -660 0.011025274705486485 0.007784764248372991 -0.019723554911707096 -658 -0.0017037660488597379 -0.0011580239500757668 -0.005506394723447372 -560 0.005991317348670128 -0.0022661168537082676 0.009892255799050512 -381 0.012417376249213864 -0.004828502113807977 -0.0018726878888628074 -125 -0.013873333040961978 0.004406736093524685 -0.021053266887589718 -506 -0.026262892601657484 -0.0021543522170194944 0.00442906465538162 -8 0 0 2.589283900144791e-05 -16 0 0 2.5892839001447912e-05 -454 -0.00010663947966301035 -0.005040601246033902 -0.0006922370547977346 -455 0.02289550486644541 -0.006075060916417402 0.0014647034106781431 -456 -0.0058551014431358 -0.028688264965094145 0.009412476538204347 -24 0 0 2.589283900144792e-05 -32 0 0 2.5892839001447922e-05 -474 0.018709003929338164 0.009713859155058282 0.005249922845235266 -320 0.020360034496335867 0.014864835586975439 0.030731515192935176 -173 -0.00013434925230160102 -0.003339721540542993 0.004399850614784226 -175 0.00477366431159889 0.0011728150452943586 0.0044527343392776805 -152 0.0025786212815767234 0.029696509429575725 0.013830328539275497 -505 -0.0004092230325628855 0.007490307555796668 0.004255257179335567 -558 -0.008265759925745195 0.00204552967410164 0.004668247385046733 -510 -0.0053380401606728245 0.0015521061958218008 -0.0005550030486493117 -374 0.02765868826006261 0.0017903292061302555 0.0026621329108467906 -153 -0.001037157082329749 0.005658079883762745 -0.006765436155795196 -163 2.534136430269839e-06 0.0043915276877542625 0.003615456878949748 -507 0.011440010041486237 0.01571871212288878 -0.001231948945091482 -632 -0.009407051140085434 -0.003481475839385426 0.0075372754448969695 +458 -0.004453454965741803 0.01151693825664599 -0.010677660778466836 +683 0.002006864592312675 -0.001932521592507294 0.007967958666679225 +337 0.00532298379239138 -0.00034751751662949557 -0.004166857667771256 +338 0.0016603629103229818 -0.0017397865762328161 -0.00957999859365969 +682 0.0016698034672263812 0.0030447891443300653 0.00044039408065769313 +348 -0.00021294094328660476 0.004583093099033796 -0.01001005910658855 +457 -0.0008224593908121431 -0.003314830306122345 -0.008635784615367802 +459 -0.012681503296362846 0.017812642118668884 -0.016635395617074823 +561 0.0009899334077360467 0.0001731424251618538 -0.01709685733786313 +477 0.017890991540560605 0.023044744293627708 0.01727164269957498 +346 -0.0024113500657761194 -0.0008915681397560844 -0.002866933909544417 +347 -0.00030907946139983243 0.012783515883529635 -0.010760262556093735 +383 0.00026978824638441295 -0.019120299882000577 -0.0053299741104955965 +559 0.0033527725124898465 0.00020920032069335958 -0.001421057700036272 +475 -0.004256602913319302 -0.0003820330120655169 -0.0016705935643949825 +684 0.009507995365094076 0.0040975189770988945 0.030681047245827025 +384 -0.003905065619279562 -0.015693306964610326 -0.026976836972692333 +446 -0.01314179281467131 0.010457284942415785 0.010342490806609185 +445 0.007370602560563622 0.0014877549887467316 0.0016554736956000077 +133 -0.004815017443186935 0.004933367632827598 0.002315306354333984 +169 -0.0016675845196929258 0.0034982453839532803 5.010082749011566e-05 +382 -0.0042602430014256525 0.004979405394323485 0.004287321951494137 +171 0.017489355050716793 -0.0027203439883894246 0.009533976138272483 +187 -0.0067021967344908255 -0.005140391493350062 -0.006739825554255354 +497 -0.0031329388973170137 -0.006870381148723759 -0.009174379123775899 +657 0.009094953874608123 -0.003997316248161227 0.012273025417327945 +496 -0.004018506073186678 -6.0250991078757223e-05 0.0010066456796113128 +560 0.005447947528153172 4.133899569079479e-05 0.012554326660939728 +134 -0.010468953197208536 -0.00141301566854465 -0.0035247336294485466 +320 0.010939719894873903 -0.006111308158447991 0.005510705669252292 +100 -0.006439631792275104 -0.0032604637575588367 0.006157843710305989 +319 0.0004586613107352609 0.00017512609741341151 0.004817206529500011 +218 -0.005861590499754354 0.006035174198167904 -0.006565358518448605 +217 -0.00927802735438625 0.0021411613416093722 -0.00035979020888794 +498 -0.009486138130747779 -0.009962568406838904 -0.011530771353931733 +673 -0.0032156185044286568 -0.00679244674598604 3.673566499860575e-05 +675 -0.0018401625404214392 -0.009727201298305973 0.013087668250224976 +315 -0.009707301914168692 -0.01721237483266019 0.008190693397883272 +313 0.000660323108037615 -0.0008435203791766024 -0.001201442668921443 +656 0.006032271063424584 -0.0009272461863311166 -0.007071956888250187 +321 -0.00020763811907399712 -0.0028938601093705524 0.018645114744037974 +314 -0.008049405263549107 0.02687740660879731 0.026979163799824374 +101 -0.003674543768142281 0.0020827789890460052 0.002260400570604653 +428 0.01084666748215117 0.005054808316931713 -0.014902105812815402 +476 0.008690481584713904 -0.02556846300271008 0.026160686020666322 +423 0.013910777481462026 -0.009511411008047801 0.0028540211424456356 +421 0.011612188198561385 -0.0026694223132784126 0.0033818470417945386 +501 0.015468220636970655 0.010438080393780974 -0.004945516275020853 +312 -0.002462545536414188 0.005876126527338993 -0.018135227561746684 +591 -0.01743483911663255 0.021455065412819035 -0.002183686492698431 +310 -0.0053773678841329406 0.0008674927506035782 -0.0004528722070173591 +589 -0.0012386485417616904 -0.0017282138306678712 -0.0008107377930330979 +590 0.002544170501886611 -0.008266546200100906 -0.002022768967224619 +123 0.004406306552695398 -0.008628826739600838 0.036456556616297355 +462 -0.012625780944026596 0.0012049271716172516 -0.004740855094449574 +460 -0.004602918945460055 0.0033419215840180864 -0.0012471064742344696 +500 0.0005745946112979287 -0.010833932565970476 -0.017234060323223555 +499 0.0039492868236109735 -0.0015522341395646803 -0.000580538309911011 +461 0.009903067749885548 0.006977098057675356 0.0051409212872263665 +642 -0.000572996104770346 -0.0038045280007246215 0.014722330820255243 +188 -0.005224055855005964 -0.010894208422402782 -0.010279011090773036 +189 -0.004059987018326752 0.015241647611207772 -0.017542363604050676 +372 0.0076175418650568155 0.006690596012820997 0.005010167361633111 +277 -0.0021953241214581758 -0.0008056617482451926 0.001429030788825389 +370 2.5618989179768052e-05 -0.0010745088188778996 0.0005190260361002789 +156 0.015908363280927384 0.04400099608067517 0.006820875880862751 +155 -0.026263460243542095 -0.005175555697363144 0.005233067464083874 +154 -0.0010052716041452881 0.0039545195890971305 -0.0011563452326712777 +344 0.011569513758106227 0.006595839522526619 0.010675357213637276 +276 0.0008902438004065535 0.006052118815589002 -0.016549391586186648 +278 0.001391648560168012 0.002754545283931772 0.01420704331285283 +316 0.0026386735229622766 -0.007259833641903415 -0.006735865315450437 +317 0.0008181583165255741 -0.0035049423729615597 0.003854089866584615 +274 0.003053657617358038 0.0018903039329490662 0.006074212569318248 +254 -0.00788095253568809 -0.003433836193123793 0.0030623796223154215 +404 -0.0049975851272486506 0.003207863270533685 -0.0046150272104852445 +253 0.002951741049391973 -0.004649439530868783 0.005054002099742331 +296 -0.037484521576817614 -0.011169130251698519 0.0027717903835696766 +407 0.0034135986321024835 0.004117840206286595 0.028522435572281245 +406 0.0015928936353108761 0.0077451384525304675 0.004491851058267775 +695 0.0026309354834312573 -0.012541984824922494 0.0027759746470715197 +295 -0.006166708890638161 0.0003866585495679127 -0.0024300733345666067 +153 0.019839326987494552 -0.006772161305622675 -0.0038316797962868326 +151 0.007378532055436394 0.0030180910772137507 -0.003228365014435173 +102 -0.0016579727186046321 -0.012121334087903685 -0.014096550825863318 +343 0.0006668380663333271 -0.0017942453065758163 -0.004385951649646588 +345 0.01164883135257315 -0.010951061738589838 -0.01685804900204048 +297 -0.007046341786616999 0.001097330555490314 -0.0024506035298995973 +696 0.017941635117438074 0.008063335474430777 -0.005018028281043851 +266 0.0026926906391473993 0.021374028107235286 0.0274284090331457 +694 0.0028450053423469132 0.0021229606019702507 -0.0022650737882021037 +152 -0.0027320320443689782 0.009085599329626944 0.002194910540824997 +486 0.008361849340413518 -0.013932226428787811 -0.004239444092447094 +479 -0.0004568924463957023 0.007861851582971901 -0.010254773571358275 +108 -0.010757495257343624 0.0027634611708688334 -0.002328970505069851 +318 0.006683022671607315 -0.009871222554567079 -0.01853285509406727 +429 0.0016997829431884698 0.002221213284056755 -0.014320857994167128 +265 0.002858674657937485 -0.000675627050954645 -0.0039084822530039065 +267 0.0025685568390093477 0.007664586210567926 0.010495462494921063 +104 -0.0032248795502721295 0.00477597402308894 0.016728337391690745 +106 0.008955114296811506 -0.0037801259301121735 0.004615860144598737 +107 0.009937444375192441 -0.036561615670364096 -0.03896712350154343 +427 0.002325966105687794 2.8396790669121446e-06 0.00262928512425263 +563 0.008960191925149656 0.0085972921677278 -0.0025751151558926245 +562 0.0027708995692783942 0.007178457942004565 0.006198218244171755 +564 0.003945339492516061 0.005730333339729568 0.012214970111968404 +692 0.0063770981430429155 0.010478020852484268 0.004848510110302704 +105 -0.008798062238208587 -0.008800318212964366 0.00346429968419937 +103 -0.003658142329813034 -0.005784579997167098 -0.0014671438010710129 +233 0.009090526271257277 -0.0062184695742560706 -0.001382677008349951 +234 -0.004221311422288912 -0.0002634133978307307 0.01846918510869164 +232 -0.0019428684489130065 0.0035530807084943167 -0.0015601629497799723 +568 -0.007672837661046987 0.0034112379306174096 0.006511831807789499 +570 -0.02069843625309144 -0.0021434803047988087 -0.006436211340190207 +206 0.018091561297447486 -0.011360475249371652 0.010771343422362996 +569 0.01385510438247273 -0.02824461222278443 0.02000817191701117 +449 -0.0062640201398862306 -0.004083880093706949 0.028264673928104996 +535 0.0002865299360108159 -0.0007091050153554685 -0.003379389599651852 +111 0.0031161313297533564 0.008818355528919599 0.004266550516884637 +713 -0.01374487522776186 0.008049698122091492 -0.012640814194472251 +450 0.004558588424108884 -0.0030889721561236897 0.011149959134927282 +712 -0.0012927532655562502 -0.003088934282594988 -0.0060105712594504595 +405 0.007133977588298567 0.0001635829611879496 -0.0019377217333525977 +448 -0.005273244033613063 -0.0015875839538786653 0.00446427062590491 +403 0.0016510428734420783 0.0014578044868035023 -0.003176578744653797 +714 -0.0023927059963184966 0.008785831579292806 -0.003581739748272074 +650 -0.016777098219426117 -0.004871075620600777 -0.0033774440510938564 +651 0.008519959597897217 0.010919193116972568 0.004569724434992854 +175 -0.006507740244653674 0.0023759619886788144 -0.004086362207230259 +255 0.005154657337248301 -0.011397299623934072 0.007796115715503526 +669 -0.0016770330388842546 0.00354195871084712 -0.0035223516202826963 +176 0.007854497797246245 0.007717151853201273 -0.006910836940798514 +177 -0.011040243716354028 -0.0007863004086489343 0.0012708101697725337 +426 -0.0007247776228948145 -0.00431766218174726 -0.005379200384703384 +667 0.00012300592297947112 0.003225812199644846 -0.0072679512581600774 +668 0.002661739040800462 -0.012651691727378778 -0.009293723873900877 +484 -0.0014183622367791116 -0.000613263702517418 -0.004804169148019453 +515 -0.006283868398267181 0.000790335608025519 -0.019444851544692835 +514 -0.0065821918199453835 0.010120165636838653 -0.003279060305969966 +516 0.0051923068414418 -0.0031679326573676803 0.009334928167008058 +478 -0.0022404381369582516 -0.0025032027851029067 0.0026177665036015135 +480 -0.004378955980298465 -0.022360428255072194 0.02371841500684581 +375 0.05161582552322043 -0.004739446395703063 0.0007236992839865241 +373 -0.0016646762874427128 0.000671379520776821 0.0022426040754076567 +127 -0.0008587937359666531 -0.0050069752991833555 -0.0016805787753368408 +129 -0.0013378481324512878 -0.005437872981490404 -0.003505537216444466 +128 -0.013827482145947348 0.0019439077936375575 -0.0022691818031355523 +670 0.0014166114686243747 9.189141459454448e-05 0.002329817750207777 +716 -0.007201051591719847 -0.004137150401581088 0.008628289475298697 +715 -0.002752602147124547 -0.0014738963744180945 0.0012732303905940907 +717 -0.001623638165314303 -0.0005412460650906025 -0.0012523252731872275 +374 -0.010720609375437756 -0.006840066101110374 -0.003488977404359839 +690 0.011731759537966135 -0.011680413214369936 -0.0032902381686339176 +688 -0.0023432526695829512 -0.005024207900308995 -0.0017992360394882845 +110 -0.027269877807471907 -0.0071249087135035645 -0.02271578221783141 +530 -0.0014545894711619914 0.0008549404321642921 0.013454283055939566 +672 0.006126580559770528 -0.0008299295300290445 0.0009215722575751014 +606 -0.0217602946725711 0.006423491093320408 0.016502930502986252 +604 0.0009371064061770097 -0.0021618327483940887 0.0015352022686043073 +689 0.0016500371723412138 0.004827672044018651 0.0096581934244938 +109 -0.0018356030600717753 0.0030878192102232406 0.0017357958143820603 +205 0.0004901963103920081 -0.004632374784987575 0.0036249981754071722 +207 0.00249538864182957 -0.002789578550669558 0.0036278161641520794 +605 -0.0037278101005000794 -0.0037391736920209554 -0.017195798709130735 +113 0.004202100839877966 0.00869037985549106 0.005737861091520882 +503 -0.005306460311046992 0.010832666840458556 0.016195438221236737 +112 0.005303589864178431 0.002587055451150015 -0.002103199293261842 +719 -0.021705208241774108 0.01797380776302394 -0.011478720275444904 +114 0.01389067167986877 -0.0009017440405471921 -0.0022864095930127176 +618 -0.0049266883701859585 -0.005969697820787827 -0.01308764555877832 +548 0.008219237188495402 -0.0008468110823799887 0.008894882644208648 +711 -0.0031295266853400864 0.02670222993771611 0.022060368649107705 +125 0.01083027713442555 -0.007043193303965716 0.0025025300050564385 +124 0.003263969048198798 -0.0019027285335452002 -0.0027054069888999693 +126 0.017099162347119654 0.003254011304238645 0.002127223362941016 +617 0.018680001577968623 0.009699939146537261 -0.00941566458839324 +534 0.034649079552431204 0.013330207039807017 0.010201392642925146 +467 -0.013892363759942683 -0.007351378919065869 0.00335784613947279 +616 0.00483428547003395 0.006774576548038284 0.0062860892069377125 +575 0.00027383445008849976 0.004016583094381818 -0.00829709451939129 +576 -0.008783216142550267 0.0040588636044731315 -0.010128419370098281 +574 -0.0016775969865822865 -0.0005968248788895583 -0.0026578911497726816 +424 -0.0002301922741549244 -0.0032175881637252803 0.004287613469297561 +578 0.009352734961645504 0.013672106889858487 -0.0009227929306399907 +709 -0.00496763073201381 0.0025027611182727853 0.00510235429818515 +242 -0.003418377167466765 0.016349818602040267 -0.0059902113564397974 +513 0.00397390267204268 0.00039374600345536836 -0.007973982771314087 +468 -0.012814486435939909 0.0040755521071130126 -0.026192943103455563 +466 -0.005299429397025371 0.0007501109317838154 -0.0035689246352978497 +381 -0.019629981695059813 -0.011756570952302245 0.01548910289706504 +532 0.0050526709923365025 -0.003421079885955213 -0.0015514226285473455 +511 0.0003307789612163611 0.003889085381026343 0.002881587074617484 +196 -0.00298297869248531 0.001388768050577565 -0.0005186534865380335 +623 -0.004957425002636128 0.009238105774759022 0.006918342220338828 +198 0.005242159970877225 -0.015318837226863235 -0.012999411375481502 +533 -0.01662847865550599 -0.03144497177091214 -0.009732768777825314 +349 0.0024981024230554434 0.003098959014501823 -0.0028727407879502484 +622 0.001862241541174783 -0.002773140520188012 0.00247465509654927 +643 0.0026910555372190556 0.002841809902343435 0.0005036863975762087 +645 -0.0005984784025519541 0.0031729186888958664 -0.00297806404901472 +644 0.008094203532835017 0.0047546653425713705 0.006562927282045607 +624 0.013044992727950242 0.001253085542446464 -0.003175579191024189 +583 -0.0007762128232164069 -0.006071863656441967 0.003123488997495697 +174 0.018305101923410987 -0.002331359500814445 -0.011556053327268835 +504 -0.014352028342715453 -0.017586422090584135 0.005017015913177833 +172 0.004116241446700985 -0.002838933839490376 0.003931819220934917 +502 -0.00036524779416289514 -0.005919776268394231 0.0025192173783630564 +585 0.000915259730989566 0.015459601003072553 0.012918672662256776 +387 0.008322512910613152 0.004268254367316691 -0.01708955772213072 +369 -0.008255395239693646 -0.005479645633396753 -0.00043990456955236303 +611 0.005548994298900594 -0.012546487352569155 0.005149258644725324 +612 0.01159428062300361 0.007640328803396829 -0.0008741638987789488 +579 0.004041723720307483 -0.01111279086628263 0.0072616837143763165 +385 -0.0009939381015497582 0.0030571781780153605 -0.004456790743997918 +386 -0.008946661149132614 -0.0007819151339354976 0.0033544619495802807 +710 0.0033147082010021225 0.005770806573503135 0.011238620384591214 +368 0.012173584067324118 0.010910852525158018 -0.00266879178359736 +259 0.0023368952297790147 -0.00449400172894597 0.0029559257987906836 +610 0.0014078658509803987 0.0002880667624082518 0.003387331565643165 +367 -0.0005480390088553384 -0.0005002212199953024 -0.00024733010086139143 +577 0.0008060129854294495 0.00017166457742740494 -0.0008561048368534674 +447 0.003110957816921685 0.0015870878646037617 0.003386466414046228 +357 -0.0013244089599512006 0.005682671719952686 -0.004077476907937305 +97 -0.005026548186247709 -0.0006228876009151483 0.0004994507575806001 +99 0.005542039722938562 0.008122195408200614 0.0010263987452825713 +168 -0.006406524125311867 -0.0009283795569643392 -0.010643871191766763 +435 0.002889094957647671 0.0032927184201963135 0.001985253422501464 +558 0.0020818684609235747 0.0013315752509750725 0.006682483396265906 +166 -0.002065917856391013 -1.8249357674565548e-05 -0.009004884427339106 +394 -0.006360340809251226 -0.004631764271186644 -0.0019896860235148264 +433 9.970226124664633e-06 -0.002264497137209541 0.0008963874951089408 +434 0.006722578729253475 0.022022987226261097 -0.014639523717312426 +167 0.012515868958607925 -0.007511932947545252 0.004407940287593755 +396 0.009639020471542682 0.015868844961723555 0.013645724634258357 +355 -0.0038423729832386556 -0.0020561485875147108 -0.0016482325146477514 +647 0.004515614005214671 0.0017631585437073692 0.009255840750581872 +654 -0.01803488108298581 -0.007334531874327409 0.00459546203605296 +652 0.006030985366321212 0.0007332802633593123 0.007333157742779 +653 -0.0032441734777585614 0.00942657943550517 0.00584145591984073 +674 -0.003063583537461951 -0.01179763732350847 0.005449621699469662 +246 -0.0039032258650524136 0.00916267461274836 0.0018688989063795432 +245 -0.006070147810085611 -0.019008826019418862 0.0024655493377629028 +244 0.004443349950521421 -0.001779929667884385 -4.905759538203217e-05 +697 -0.0025146598747406235 0.0014003494787741707 -0.004127061259552191 +698 -0.025149580283357193 0.016768457434997528 -0.0144874983514177 +629 0.002917587732020283 -0.00302708571348339 -0.015068833185973202 +593 0.016860656902253475 0.0041945813998550295 -0.01617254723971546 +592 -0.001640088107429323 0.00034608752630003016 0.00011980474314306386 +210 0.0030620525927574876 0.0020231482000474155 -0.0014920669498859548 +209 0.008438167474285975 0.004612415869938766 -0.006076132368139379 +594 0.0017124075137155519 -0.02127883088608897 0.005679571176231625 +663 -0.0071037256920369884 -0.010590622746788847 -0.0028775474570157606 +208 -0.0016181190895891118 0.005810040655836568 -0.003826524601371058 +419 0.011294433056168247 -0.017192082764488414 -0.0025606502852209465 +641 -0.004309159782487541 -0.01134836619343387 0.0022868440923617607 +640 0.002131003674685546 -0.0035958906763722434 0.0021177994536453588 +137 0.020658105646024473 0.012654733274768187 -0.00524475187829765 +699 -0.002477011112569179 -0.006702064320336806 -0.0008102910909585382 +136 0.001655832574839628 -0.002984834230620339 -0.001550205551684509 +140 -0.002367894732144384 -0.013808356771113755 0.017259877217538223 +139 0.00016545955503963347 0.0028593878711222643 -0.00478898861830347 +138 -0.0007610917048126984 -0.024371966075808788 0.018889687917347905 +286 0.003806028815510772 0.006261665048891517 0.0015881399248088724 +141 -0.0003801668371515948 -0.005163807555196016 -0.022783710942608122 +356 -0.005238652081677789 -0.004610568940166292 -0.0015244708376905992 +395 -0.02253772726868896 -0.0066753490126988365 -0.01245377865903734 +224 -0.004896812910925297 0.01440078235599339 -0.0006724244527572224 +275 -0.010232624432234884 -0.007454174697705406 0.00623684314856214 +223 0.0017215886489852711 0.007433190657071842 -0.004983932946528752 +389 0.0027526981973249394 -0.001328853955471207 0.0045250522716830935 +216 0.001787315873539206 -0.00045360496846752864 0.0009049669331300801 +257 0.004261296558828503 -0.004570633213125906 0.003979725407423219 +225 0.008965912786139717 0.004349498544950998 -0.003737598024944121 +258 -0.004362134593197381 -0.0003247086962529744 0.00034366732486023645 +256 -0.00015823427705910544 -0.0021266545747713815 -0.0011024089803532344 +269 -0.008319123826978143 0.01404268958108163 -0.004439694163606073 +284 0.012850295238607095 0.022727051758484697 0.005093359609976458 +388 -0.003985316056547339 -0.003730455938671166 -1.4913129519033464e-05 +390 -0.006437774483409439 -0.006993671208969723 -0.009592841732820665 +686 0.0027469127614133133 -0.015502593601850094 0.001259923639666192 +630 -0.021173457216339363 -0.0011091433180805937 -0.016290614505972585 +628 -0.004175936326702936 0.0007462313786508353 -0.004601394892569226 +662 0.005642944025171392 -0.0010430524868843781 0.0055280836934935235 +661 -0.0023700931074827777 0.003907110120279919 0.0005913461637964844 +158 0.0007308264358153039 0.010201557032771416 -0.03163567305652864 +157 0.006691459995734248 0.0012902862126745063 -0.007480597572720153 +331 -0.0008817642329219822 0.0021584436857335553 -0.0046638279071666506 +333 -0.004696558133178527 0.0031739435533363293 0.015407996341362732 +332 -0.0034562633997387384 0.0032977621258542494 0.005072135984805667 +159 0.011866957645876842 -0.0033390008407883547 -0.0033111627735487627 +443 -0.0037867595690661946 -0.00871115359911764 -0.006211571371266589 +702 0.0005157925210920148 -0.01862237120048761 -0.02126567931023984 +418 0.009026113380609373 -0.001456993412540531 2.531740961391944e-05 +420 -0.003075346520981788 0.010824922293772271 -0.012527321684136915 +306 0.004513714971309221 0.011303997850601849 0.003190686418946394 +725 0.007345564115088602 -0.007636316783418212 0.01995868814081767 +285 -0.005609283443382429 0.004834271673657035 -0.001514895510926504 +305 -0.002263828369054366 -0.0002202671962814671 -0.0013693734272154441 +304 0.0023625778647756784 0.0007478600013689276 -1.5320980596256273e-05 +726 -0.008627073993775911 -0.003007502632529877 -0.008473947349688779 +724 0.004696955107297542 0.003126541722569592 0.0022891407019057916 +638 -0.0002886107944268399 -0.002939033404521495 0.001082909508838736 +399 0.0015588620175107902 0.008426107228068429 0.013311928846194672 +397 0.000720917424337885 -0.001220682695428885 -0.002757667354356934 +283 -0.0015852605159438105 -0.0029492054997196024 0.007467971709415989 +163 0.0034197098660175623 -0.008623759234314979 0.0033894754736908893 +164 -0.0036430886268036746 -0.009889353036581797 -0.016905603994354437 +685 -0.0004072452236383633 7.326234779933795e-05 0.0014849854340800745 +687 -0.002739165377375687 0.012852384595407756 0.001475285594107675 +649 0.0014134044984482012 0.005542430982887621 0.001928425623653205 +215 0.0008248133702686463 -0.000711839082931538 0.0022444015571633498 +587 -0.00090343187438489 0.0057465020808828635 -0.003124562227116467 +586 -0.0013758332769409187 0.0066525027443663665 -0.00011532120794506751 +588 0.0017245969503470826 -0.0008104661763823836 -0.019712623118666575 +539 0.01065062249850665 0.007827874290134467 0.008909353411428827 +214 1.1165073159270163e-05 -0.0004998991917670403 0.0016292722157333316 +380 0.005271609947690949 0.008510623968010896 0.03016417682914827 +191 -0.010024017672764255 0.008435955357775526 0.0014203923305754962 +192 -0.0005634006302245232 0.002844594940623796 -0.008061642993686067 +190 -0.0113311474598216 0.002504068480918772 -0.0071637988085077545 +538 -0.003914815120454294 -0.0010599684145957344 -0.0019251398636633387 +671 -0.008604964853957753 0.0022601681803426296 -0.002917330408581408 +262 0.005651090143362061 -0.00512272946210163 -0.003691328865025109 +263 0.007201535443275555 0.00399129299903444 0.0021333236289320097 +264 0.013427149538806868 -0.01601168652829063 -0.004041915850761532 +614 0.0002707557590391042 0.0026091616822172554 0.010802883842087075 +442 0.005226368024101791 -0.0005695316462469665 -0.0016155579148242594 +613 0.0026048179177820814 0.000989099002428112 0.00015975554562322683 +615 0.013192848347887254 0.0033089182068860644 0.003037575696524861 +238 -0.0005870292048445432 0.0006514557861283215 -0.0019838483618029763 +240 -0.002724161266270134 -0.008890016938576486 -0.014122848675880794 +444 0.003184028086041916 -0.00969592308061097 0.006605107677339591 +398 -0.012700825129448581 -0.027199099438541145 -0.00517811816842186 +438 0.012850198883246046 0.01254350896533728 0.0008985858090579044 +436 -0.0031691400803140935 -0.0006296353491016456 -0.002516909475513795 +437 0.016350370845538566 -0.005888923943516664 0.007322595965500486 +718 -0.008202093937232093 0.0006798356147457872 0.006084460335497779 +720 -0.017383939897128695 0.001547555597627774 0.02813026643925475 +119 0.012904495443845528 -0.005803951008063301 0.0057169642915285415 +118 -8.916791816294511e-05 0.002839921457979148 -0.004429120787058283 +120 0.0024458285457822767 0.0008570225072119515 -0.00797171583646973 +301 0.004488477270898401 -0.002382353791932725 -0.00503113533793492 +302 -0.014531938953658154 0.006169284631177108 0.03198258656151703 +303 0.011269697663660844 0.0016258321215055099 -0.00033779321643985125 +165 0.010544246432356527 0.0041906490881375436 0.012092698752189768 +379 -0.002237444080661589 0.0021776798197609536 -0.0032771686001432693 +98 -0.001797292289119333 0.005336617607509462 -0.005171911836470949 +135 -0.013489435087016732 0.005274005479841612 0.0005834971857759355 +441 -0.003619860188541455 -0.009877099432817072 -0.016734607567403022 +439 0.0032162625844592064 0.006131533085952244 0.0007794677889147138 +440 -0.0015247454955621903 -0.00847194524210127 -0.0155283189330647 +241 0.0002945523997109585 0.00392985227554616 0.0011371210593021828 +142 -0.004091375383694248 -0.0016351522843879743 0.005389850700728547 +144 -0.00519971551432377 0.001514283314589748 0.02239720321565925 +143 -0.00024269769818795135 0.006517652063452855 0.02991554524096922 +180 -0.00260043894652495 0.005661456277089602 0.004899405120415125 +472 -0.010385072091518802 0.000793619552976975 -0.0025644198832336447 +473 0.0038612261633057367 0.006776939875983214 -0.0065105414163708734 +506 0.002563136031921645 -0.018826103005989525 0.012821459377573856 +505 0.0048905756144497275 0.0031674562591624744 -0.002943038158444379 +507 0.0020402703806653324 -0.010304947986340164 0.003356477351540788 +365 0.009162151172310935 -0.018017936907596357 -0.014922459670158063 +366 0.004788991496382441 0.011526484663629892 -0.0019277315697965043 +364 0.005274226393635851 0.008738558274226052 -0.0018124040481897084 +660 0.011256763151592844 -0.013937460154994532 0.00047620736388687113 +658 -0.002060812958994976 -0.002967001511991565 0.0004188223197400222 +659 -0.0003146377724438938 -0.00197449430694 0.0021276918212970054 +704 0.026040983883360194 0.00900571078277188 -0.018728389329774334 +703 -0.00018274917247401183 -0.004489677456144546 -0.0032681822747904704 +359 -0.019216573251564978 0.004020034964137674 -0.0001220713197680691 +470 0.002151458971045023 -0.01691547094683232 -0.010096527585238893 +239 -0.00955336944238779 -0.010459588551473485 0.0150838573154403 +360 0.0009520175378620087 -0.007749755357701786 6.621489298128217e-05 +358 -0.0005688410126172113 -0.0005560941009629876 -0.0006166527963073808 +261 0.007769959654076087 0.0030896685845212177 -0.015356352591330839 +260 0.03415303140098265 0.0029601298994195455 -0.01936888681418142 +556 -0.00430632092548708 -0.0008430104911118851 0.004546252381393538 +557 0.0024234183721920884 -0.0033865183224814676 0.003988433760516458 +243 -0.013129238813343694 0.001636317301929463 0.009990259161298299 +452 -0.0048729457305857135 0.0020911007888309986 0.00579974498517894 +453 0.003281786789083938 -0.00391762740915676 -0.0010299028840426564 +451 0.001696422880212693 -0.004207545061251571 0.0013962319224258603 +249 -0.012591732409175688 0.007546760090260216 0.0137881393833657 +378 0.002331585205254201 0.0006976292805448998 0.004955162912278944 +469 -0.0026805771897719993 -0.0004716405230935708 -0.008019044858007272 +471 -0.008460133069352805 -0.0015272472151962614 -0.021744863895656705 +247 0.0013791656440794587 -0.0011986359225498989 0.004267660592504868 +248 -0.005492572492239919 0.002279136422665246 -0.02080148750991538 +361 -0.0018411763976671437 -0.0005942530984883047 -0.0013685452755333152 +362 -0.014903366862021108 0.015416563800979116 0.0011815377189573692 +363 -0.006263153757945177 -0.001634641152650846 -0.008304299117032699 +492 -0.009898853143303972 0.0009278981396767927 -0.014424409776254043 +490 0.0030354599548929177 -0.0008554763542258207 -0.0011355049674150834 +292 0.0031516174366246715 -0.0034225721474031405 -0.005529159904321513 +293 0.002956735836415312 -0.011094674280821152 0.006854195142517166 +543 -0.005179278891860961 0.0026890023203280946 0.0041019845447431095 +294 -0.002312663234381566 -0.011632491191280908 -0.0009731604446443048 +648 -0.018524887249069276 0.006747341097991656 0.00043721584014796364 +646 -0.002780716802849935 0.00974551105182296 -0.0023362746862546223 +289 0.0036761718858090257 -0.0059189286326507325 -0.004563750705311 +290 0.01353516337391623 0.002362528393466273 0.030156212537971756 +634 -0.0017400413269816654 0.002599808052717143 -0.006852060617433577 +635 -0.005260474970488028 0.011607443674202134 0.0046228516301874125 +299 0.013814353869601373 -0.035337010958565944 -0.007626054539468647 +291 -0.00040482137834702974 0.020661299343451334 -0.005508713299764413 +393 0.0020839193661128506 -0.008987122251911292 0.010285149255378918 +636 -0.00542331246063746 0.002573690502472132 -0.00035983248231242967 +149 -7.151452506110975e-05 0.0014155855562804176 0.003799179036068636 +325 -0.0031994445410817333 0.0016898813402218538 5.610008907901808e-05 +326 -0.005879386883584325 0.00043078787020088007 -0.0029994617796312204 +327 0.0012732578320217578 0.00011695372302210944 0.006412070349906606 +488 -0.013340276229246531 0.0026358421255856974 -0.002233047173904977 +148 -0.004283396524559887 0.002188703362873204 0.0011359262815233196 +150 -0.0025488005052485218 0.017339969676634374 0.0074911477667229855 +707 0.01170571152298231 -0.02001987373660686 -0.00649732243702941 +706 -0.006734793193523193 -0.009471687918984308 0.0018134332088678151 +708 0.01043771884133765 -0.0004986882167179219 0.007123800182616495 +481 -0.0012496095279962473 -0.0050170088381964045 0.007176809560570978 +483 0.021757811291607868 0.0013571015551912197 -0.002778434524506408 +482 -0.002579975740967915 -0.008193215752828985 -0.002787668411750772 +288 -0.015499272855390864 0.02647484837809114 0.008661371031580349 +287 0.022614602307564537 0.001992062236812065 -0.018683135121062983 +491 0.011544297921842946 -0.016137896705660435 -0.0007621990951202092 +309 -0.005697804934448254 0.013257801661920787 -0.010593091026444944 +307 -0.007946332515966098 0.0011127287367364927 -0.0003225430486488365 +495 0.009728921694623846 0.007093458815640433 0.01411663616256105 +308 -0.006426796104180803 0.005473885485853239 -0.00019725665823820638 +229 -0.007248324751437849 -0.0010717876561419583 0.004254945302504692 +465 9.648842741707659e-05 0.0021202771007501993 0.004485009307726672 +494 -0.0102115961744896 0.002913741214401282 -0.011844630854205436 +493 -0.0029408278389643668 0.0040799464304130464 -0.004200241440017398 +185 -0.0162521258515417 -0.003685671464587334 0.004252604004205645 +463 -0.0006999574156701651 -9.169572366832186e-05 0.006389211866440561 +270 0.002706342445250265 -0.000854151667256604 0.0017919561417045185 +268 -0.006092356100129407 0.005763642048150651 0.005898323411350319 +298 0.011090916008125465 -0.0003158165688766036 0.005085093481222366 +680 -0.003710788712911898 -0.0028345736383161707 -0.0016624377420180994 +334 -0.001646965710106046 0.0022952123315555578 -0.005169634426126912 +335 -0.015980387033825646 8.854938274220335e-05 -0.01816618074336612 +679 0.0037391767248099186 -0.003515059947549784 0.002341736983001597 +456 -0.01622360318359218 -0.009805071213118452 -0.005972719999234521 +681 0.0033464206369857178 0.0018593520182910504 0.0022724593212495423 +573 0.035914631236689136 -0.0119450800550804 -0.0005747405297846915 +336 -0.007825800627969271 0.00768337399894178 0.024983641796735002 +454 -0.003382449833344251 -0.002794494300327384 0.0038418937537501117 +271 0.002357274245352879 -0.0018963943881007829 0.000991809005344159 +300 -0.0052930292674167306 0.006440731283902526 0.024507768165554684 +280 0.0013933865484831655 -0.0056835891176652 -0.0010178666073674726 +272 -0.009893878493973465 -0.008053032005096978 0.007321975230124151 +116 0.01777842565618712 -0.015798889517793326 0.010648066257965523 +581 0.006493419994287206 0.004175731808528304 -0.0038075898663124212 +700 -0.00012801211667683082 0.007213135818384868 -0.0037645643440806908 +701 -0.005371061254240965 0.003171280714125679 -0.011736177812528347 +580 0.0003965496667819459 0.008510042009669427 -0.0008206198182428773 +571 0.0030796331163622714 0.0010922813181917584 0.00524294147881322 +186 0.010106710411003167 0.0028669093917835296 -0.0030228885462384846 +184 0.000618234423049718 0.006116502214680637 -0.0037038602699089123 +723 -0.009190811612737318 -0.00301916681174666 0.003972501122494039 +721 0.002690608751407624 0.004111192795013688 -0.0012263556087446698 +609 -0.004723013294901941 -0.006444730696396147 -0.009982421727072349 +608 0.009553631086994486 0.011356526861422163 0.015033675506505733 +607 6.878304909532546e-05 -0.0013649477213774353 -0.004264282499395178 +572 -0.019023378141821975 -0.016470971915217122 -0.008966007164307524 +161 -0.01101279624639333 -0.0066850105706026805 0.004125450036755977 +582 -0.00895123408997298 0.01696868369163429 0.008724383650402278 +282 0.020129534503988602 0.015622889175302647 -0.015780339990325423 +639 0.00019098000205755987 0.009329257692273055 0.015462469035938337 +637 -0.010268419254502795 -0.0033204995293100513 0.004825941131879525 +722 -0.0040299164143823875 0.010756206409579352 -0.005712198723390781 +510 0.003123806615529003 -0.00420910976538542 0.026586924692775488 +222 0.033926342655610085 0.01796722743346109 0.013820988662122058 +220 0.00027715920489089225 0.0023419707048865914 0.0010301488406650949 +221 0.008938815675509696 -0.005656320360971094 -0.015802209820795506 +194 -0.004034010927275597 -0.015213890966131708 -0.005116856789652635 +195 -0.004214713771335041 -0.012168642805439635 -0.005121574934093348 +193 0.0017790822671230166 -0.001136511971243534 -0.004426554512205668 +432 0.0038236345714522707 -0.018543114978359542 -0.015677964046018428 +431 -0.001025663331694761 -0.005782973744011068 0.01596264261815661 +430 0.007571718701576313 -0.003970543920835715 0.004061428354918659 +544 0.006145853680925427 -0.003558625527309057 0.004712623206101515 +115 0.006044175448204818 -0.005276926085181493 -0.0075267052304545425 +117 0.00851173197882058 0.01829515292881661 -0.005325223451614053 +545 -0.008987292170970546 -0.011842376582473897 -0.02384083346814782 +182 0.010231945925816907 -0.015304728776994486 -0.0006673263213082153 +540 0.009830578561175666 -0.0063710477146009725 -0.0054897712631665485 +602 -0.010904597547356062 -0.01840056375777756 0.009633868126302703 +603 -0.006108645207167538 -0.003919618874412859 -0.002654737241541606 +455 -0.024093029885638655 -0.009662727140350397 -0.004505470448928953 +201 -0.01616960988967848 -0.0106889072942792 0.0072211424288129615 +199 -0.003106260580334742 0.006411349276864501 -0.004044187049429534 +200 -0.007268877343038796 0.026377331525558375 0.009973629248552236 +599 0.016596982966255714 -0.0009207102351199662 0.011239739375562326 +598 0.0029310155213707117 0.0017987730979994118 -0.004743561210319109 +600 0.002549722461997752 0.014429204695832242 -0.009458295897154157 +281 0.002347019290833369 0.010971558742722405 -0.00923509940399437 +324 -0.0037059211296033463 -0.004396986063014179 -0.0060247317044738605 +322 0.003356679576227343 -0.0007637645843901782 0.00431510981022623 +323 -0.0056516057252608 0.003828963776626326 0.017783104019150522 +520 -0.0004117712789830727 0.0020758360785791312 -0.0010373147373874843 +183 -0.003651025803848668 0.0032929972079473687 0.0030004101428539012 +181 -0.0019150084723164162 -0.0031908425462716336 0.002677742267628704 +528 0.009253953756286579 -0.022726699813356732 -0.008302610390435353 +527 -0.026051717388651065 0.0010053188608434838 -0.003041253415411715 +526 0.0049574251594706395 0.0021165055564693483 -0.0020102383692291764 +413 -0.004106465956088772 -0.016318859510594166 -0.002457950382972751 +551 0.005621772762354192 0.0007387800134147048 -0.015994151313742468 +352 0.0051614128129068215 0.004194102342547428 0.002561364532637018 +353 -0.009582724186439616 -0.008705468211864518 -0.02897310442665479 +227 -0.002425607567560221 -0.0010255491124715665 -0.011817554243112533 +228 0.01572585383089693 -0.010614358678638441 0.006968797918117437 +226 0.0020948934110851477 0.0010118620094589947 0.001820602983352382 +354 0.02003265634395509 0.0036127832130803165 0.027605578310224345 +550 -0.003036402506396888 0.004150436699143066 -0.0005610332460767217 +524 -0.008980992467545346 -0.0031730732527052575 -0.005568066520151137 +523 -0.00010365859952221227 0.006353406764959096 -0.009077836112708546 +525 -0.00561652956069597 -0.00016947777707923228 -0.001970220558665862 +519 -0.013125003087740398 -0.011469194804316914 0.013505541673611496 +517 -0.0021159457672736944 -0.004412964989577972 -0.0010413335515586267 +518 0.017717698088592727 0.00909383617404767 -0.028545170133511853 +508 -9.334096172175459e-05 -0.004984656557281299 -0.0017741402555035252 +509 -0.00807954896343497 0.005779725364890536 -0.024610848258642945 +625 0.00011123981380908182 -0.003090808816089336 0.0075573728171250245 +626 0.0026673769851397406 -0.005017498161826362 -0.002425342613874514 +132 0.0015243373893186207 -0.0027646883306819323 -0.003221623582970257 +252 -0.0013259149625935549 0.009976918967493387 -0.003732686159493943 +250 -0.005605206832166627 0.0005297374721552324 -0.006757497850740153 +521 0.00970751081752297 0.013610439017695028 0.0005680707944436813 +251 -0.006993440926208339 0.0010222689560330947 -0.0068145312109414045 +130 0.0026838499920701655 6.702371206137205e-05 -0.0038430739297824227 +131 0.006424327384534665 -0.0008290582942547853 -0.003633462837194579 +203 0.01976027158742386 -0.0030070040964846564 0.013531402987002398 +202 0.003722121963012622 0.00015221250364814748 -0.002188938222165091 +204 0.013775519865558814 0.008467491865954293 -0.02140990942257068 +627 -0.001241750835653223 -0.004773998318539809 -0.0016148153442508185 +542 0.0040385576615968605 -0.0236794923228312 0.00531029427452055 +541 -0.0044262706386558525 0.004325702009483897 0.002700620213851568 +391 -0.0036280169383852046 -0.0026385466357123663 -0.00035216914986367686 +392 0.03994550165719566 0.020318388875604797 -0.0007932428205112993 +601 -0.0030679532557834894 -0.0030977948768668414 -0.005257290455915788 +179 0.0009873232779685616 0.0150955222182782 -0.007871483113870962 +178 0.004964972319261251 -0.0015981668901900738 -0.0041670093710039924 +552 0.006485514253259603 0.008699222840167432 0.0037510563686783617 +235 0.00506871602421843 -0.004086331699518592 -0.008587091653006933 +236 -0.004525226123458464 -0.005764403803617883 -0.015631958239905368 +474 -0.004742466401950209 0.005419182312857254 -0.007895183087680703 +417 -0.003992217731448409 0.00471471491227651 0.005575507084397644 +664 -0.001470104926409589 -0.004799539523296164 -0.0018785513064097103 +665 0.014771918301999913 0.012233594121569095 -0.006419805396723815 +666 -0.016064115068593825 -0.006541236112892163 0.01467853889731523 +237 -0.010721208694025012 -0.008265464412263886 -0.021817776048870266 +415 0.0019835285499536274 -0.0006382734049118419 0.003555718302091666 +705 0.006748710932874935 -0.0024289881322456758 -0.008541878588213401 +566 0.0035570139632815174 -0.01594775034404742 0.033204469911536603 +565 0.006857925902164734 0.005002808848358231 -0.004513258813589546 +567 0.003181874699909625 -0.00924395086885147 0.008880406857908165 +411 0.0024046862441890133 -0.006714458691938653 0.0049164786877966184 +410 -0.0050363826944832555 0.0058218872665497185 0.0027513549821143995 +596 0.001901078088678023 0.00490390977209901 0.00038685323891390026 +621 0.001976086534825697 0.00705420867885171 0.004011231628401452 +597 0.003145095476668829 -0.008305202055624638 0.010789768782981374 +595 0.0014439023253207408 0.0029590199421347775 -0.0011479555839940955 +330 -0.000454105678768917 0.008216820015035884 0.011628436633000498 +328 0.0066591275275407966 0.008310975892370648 -0.0060667992873991265 +329 0.017017016154807146 0.008652068731291183 -0.014679876782369922 +620 0.005144158070704658 -0.013314861626627391 -0.0007373733114238566 +619 0.002431401800346778 -0.001562059500319066 -0.006362047382968646 +677 0.0016833693507279774 -0.002878844060484389 -0.026035855009943563 +376 0.0009064195179465892 -0.003689607748901142 0.00042659566418980867 +342 -0.008722516752092775 -0.01813523558140053 -0.006517638122909407 +340 -0.0025943587604086195 0.0003205205769993526 -0.0013478220706903822 +409 -0.0034768010049023718 0.0003696469494390196 0.0011794583078781075 +341 0.01173657937587064 -0.00415297106778066 -0.011425635722426684 +678 -0.0052315803501361965 -0.0067072042594158625 -0.010510577417418582 +676 0.0012606310408806672 -0.005003835259145005 -0.0006656129032826617 +377 0.009291690772008664 0.0029659788632332255 -0.011218601401370447 +633 0.016838292034210285 -0.002773894853685203 -0.011578170743232821 +631 -0.0004151454548796269 -0.00048078689460954413 -0.0032615663914959997 +632 -0.009643725697380543 0.011621211216499307 0.01722187923853953 +401 0.004081680411837688 0.012757999123689634 -0.003690938434444669 +400 0.0023240152313725193 0.00015111448571084632 0.005748278487826584 +402 -0.0033958888414351786 0.012895292958925782 0.00044643445949813453 +2 5.031892850696456e-35 -7.855971130891077e-35 5.904453902322438e-05 +1 4.912224382206865e-35 -7.879614271110834e-35 5.904453902322439e-05 +11 5.151555499231424e-35 -7.832332373097226e-35 5.9044539023224377e-05 +3 5.208745250310379e-35 -7.656334053677772e-35 5.904453902322437e-05 +10 4.9747030996175e-35 -8.031969450310532e-35 5.904453902322439e-05 +487 -0.001145132860847261 0.002632147874097856 -0.0036232402676173725 +489 -0.006832646046318302 -0.0016267479538157937 -0.007006356048374049 +19 5.094365748152468e-35 -8.008330692516679e-35 5.904453902322438e-05 +18 4.917513348538544e-35 -8.207967769729985e-35 5.9044539023224404e-05 +27 5.037175997073512e-35 -8.184329011936133e-35 5.90445390232244e-05 +26 4.860323597459588e-35 -8.383966089149439e-35 5.904453902322441e-05 +230 0.003849353330259815 0.0036684074545651124 0.0022775018198492644 +464 0.002790472591310625 0.011293591164403627 -0.0033838193904728326 +34 4.803133846380632e-35 -8.559964408568892e-35 5.904453902322442e-05 +35 4.979986245994556e-35 -8.360327331355587e-35 5.9044539023224404e-05 +41 4.626275626812085e-35 -8.759605868208104e-35 5.904453902322443e-05 +33 4.683465377891041e-35 -8.58360754878865e-35 5.9044539023224424e-05 +42 4.745944095301675e-35 -8.735962727988346e-35 5.9044539023224424e-05 +43 4.922796494915599e-35 -8.536325650775041e-35 5.904453902322441e-05 +273 2.6773924918426488e-05 0.009862360798364158 0.010528137597319824 +5 5.505266118413894e-35 -7.43305383624471e-35 5.904453902322435e-05 +13 5.448076367334938e-35 -7.609052155664162e-35 5.9044539023224356e-05 +12 5.271223967721014e-35 -7.808689232877467e-35 5.904453902322437e-05 +4 5.32841371879997e-35 -7.632690913458015e-35 5.904453902322436e-05 +162 0.002600825628699585 -0.026498774387345964 -0.008572244027850005 +160 -0.0019141019315674125 -0.0022742553608968326 0.00756817001187433 +20 5.214034216642059e-35 -7.984687552296922e-35 5.9044539023224377e-05 +21 5.390886616255982e-35 -7.785050475083616e-35 5.904453902322436e-05 +29 5.333696865177026e-35 -7.961048794503069e-35 5.9044539023224377e-05 +28 5.156844465563103e-35 -8.160685871716377e-35 5.904453902322439e-05 +546 0.0012914591513626381 0.0016435905724560078 0.011210878468393162 +44 5.04246496340519e-35 -8.512682510555283e-35 5.9044539023224404e-05 +45 5.219317363019115e-35 -8.313045433341979e-35 5.904453902322439e-05 +37 5.276507114098071e-35 -8.137047113922525e-35 5.904453902322438e-05 +36 5.099654714484147e-35 -8.336684191135829e-35 5.90445390232244e-05 +14 5.56774483582453e-35 -7.585409015444406e-35 5.904453902322435e-05 +7 5.801786986517408e-35 -7.209773618811645e-35 5.904453902322433e-05 +6 5.624934586903485e-35 -7.409410696024952e-35 5.904453902322434e-05 +15 5.744597235438452e-35 -7.3857719382311e-35 5.9044539023224336e-05 +414 -0.003708147781576237 0.0119246471818512 -0.0026955388878462396 +412 -0.002143339343591569 -0.00406550791610511 -0.010899053221742722 +23 5.687407484359497e-35 -7.561770257650554e-35 5.904453902322434e-05 +22 5.510555084745573e-35 -7.76140733486386e-35 5.9044539023224356e-05 +30 5.453365333666617e-35 -7.937405654283313e-35 5.904453902322437e-05 +31 5.630217733280541e-35 -7.737768577070007e-35 5.904453902322435e-05 +522 -0.004517142308117002 -0.0008358029532284763 -0.015871308751386683 +38 5.39617558258766e-35 -8.113403973702766e-35 5.9044539023224377e-05 +46 5.338985831508707e-35 -8.289402293122222e-35 5.904453902322438e-05 +47 5.515838231122628e-35 -8.089765215908915e-35 5.904453902322437e-05 +39 5.573027982201585e-35 -7.913766896489462e-35 5.904453902322436e-05 +553 -0.0040430614584178615 -0.0017027478479088745 0.0013631323055172994 +554 -0.0046472364280754465 -0.0016038689694341643 0.002641643372539294 +145 0.0005734290816721687 -0.003411175879249019 0.0011735571895808842 +147 0.007400185640321636 -0.0006254559473139159 -0.007341801259477273 +146 0.0038951241842126575 0.0020875887784956933 -0.006835347713886058 +9 4.855034631127909e-35 -8.055612590530289e-35 5.90445390232244e-05 +16 5.864265703928043e-35 -7.362128798011342e-35 5.904453902322433e-05 +8 5.921455455006999e-35 -7.186130478591888e-35 5.904453902322432e-05 +416 0.008458867444241406 0.0063709018588346145 0.003787591538194493 +555 -0.020250627732704033 -0.005798271708231511 0.008792666418850497 +17 4.7978448800489525e-35 -8.231610909949741e-35 5.904453902322441e-05 +25 4.7406551289699957e-35 -8.407609229369195e-35 5.904453902322442e-05 +24 5.807075952849089e-35 -7.538127117430798e-35 5.9044539023224336e-05 +32 5.749886201770132e-35 -7.71412543685025e-35 5.904453902322434e-05 +231 -0.001540153496547131 -0.0059338989830543054 0.0024465947155016443 +48 5.63550669961222e-35 -8.066122075689159e-35 5.904453902322436e-05 +40 5.692696450691175e-35 -7.890123756269704e-35 5.9044539023224356e-05 Bonds -1 1 676 677 -2 1 676 678 -3 1 709 710 -4 1 709 711 -5 1 193 194 -6 1 193 195 -7 1 103 104 -8 1 103 105 -9 1 712 713 -10 1 712 714 -11 1 604 605 -12 1 604 606 -13 1 388 389 -14 1 388 390 -15 1 586 587 -16 1 586 588 -17 1 601 602 -18 1 601 603 -19 1 316 317 -20 1 316 318 -21 1 421 422 -22 1 421 423 -23 1 643 644 -24 1 643 645 -25 1 691 692 -26 1 691 693 -27 1 367 368 -28 1 367 369 +1 1 655 656 +2 1 655 657 +3 1 121 122 +4 1 121 123 +5 1 691 692 +6 1 691 693 +7 1 211 212 +8 1 211 213 +9 1 529 530 +10 1 529 531 +11 1 547 548 +12 1 547 549 +13 1 337 338 +14 1 337 339 +15 1 682 683 +16 1 682 684 +17 1 457 458 +18 1 457 459 +19 1 346 347 +20 1 346 348 +21 1 559 560 +22 1 559 561 +23 1 475 476 +24 1 475 477 +25 1 445 446 +26 1 445 447 +27 1 133 134 +28 1 133 135 29 1 169 170 30 1 169 171 -31 1 541 542 -32 1 541 543 -33 1 520 521 -34 1 520 522 -35 1 211 212 -36 1 211 213 -37 1 205 206 -38 1 205 207 -39 1 679 680 -40 1 679 681 -41 1 298 299 -42 1 298 300 -43 1 496 497 -44 1 496 498 -45 1 187 188 -46 1 187 189 -47 1 385 386 -48 1 385 387 -49 1 430 431 -50 1 430 432 -51 1 475 476 -52 1 475 477 -53 1 577 578 -54 1 577 579 -55 1 280 281 -56 1 280 282 -57 1 115 116 -58 1 115 117 -59 1 196 197 -60 1 196 198 -61 1 241 242 -62 1 241 243 -63 1 400 401 -64 1 400 402 -65 1 562 563 -66 1 562 564 -67 1 664 665 -68 1 664 666 -69 1 637 638 -70 1 637 639 -71 1 652 653 -72 1 652 654 -73 1 256 257 -74 1 256 258 -75 1 424 425 -76 1 424 426 -77 1 466 467 -78 1 466 468 -79 1 580 581 -80 1 580 582 -81 1 352 353 -82 1 352 354 -83 1 292 293 -84 1 292 294 -85 1 574 575 -86 1 574 576 -87 1 436 437 -88 1 436 438 -89 1 700 701 -90 1 700 702 -91 1 106 107 -92 1 106 108 -93 1 376 377 -94 1 376 378 -95 1 358 359 -96 1 358 360 -97 1 289 290 -98 1 289 291 -99 1 406 407 -100 1 406 408 -101 1 523 524 -102 1 523 525 -103 1 625 626 -104 1 625 627 -105 1 136 137 -106 1 136 138 -107 1 184 185 -108 1 184 186 -109 1 313 314 -110 1 313 315 -111 1 238 239 -112 1 238 240 -113 1 403 404 -114 1 403 405 -115 1 697 698 -116 1 697 699 -117 1 382 383 -118 1 382 384 -119 1 670 671 -120 1 670 672 -121 1 394 395 -122 1 394 396 -123 1 202 203 -124 1 202 204 -125 1 346 347 -126 1 346 348 -127 1 571 572 -128 1 571 573 -129 1 589 590 -130 1 589 591 -131 1 607 608 -132 1 607 609 -133 1 274 275 -134 1 274 276 -135 1 112 113 -136 1 112 114 -137 1 343 344 -138 1 343 345 -139 1 253 254 -140 1 253 255 -141 1 109 110 -142 1 109 111 -143 1 307 308 -144 1 307 309 -145 1 685 686 -146 1 685 687 -147 1 271 272 -148 1 271 273 -149 1 481 482 -150 1 481 483 -151 1 721 722 -152 1 721 723 -153 1 208 209 -154 1 208 210 -155 1 469 470 -156 1 469 471 -157 1 688 689 -158 1 688 690 -159 1 634 635 -160 1 634 636 -161 1 433 434 -162 1 433 435 -163 1 415 416 -164 1 415 417 -165 1 217 218 -166 1 217 219 -167 1 478 479 -168 1 478 480 -169 1 361 362 -170 1 361 363 -171 1 484 485 -172 1 484 486 -173 1 661 662 -174 1 661 663 -175 1 100 101 -176 1 100 102 -177 1 178 179 -178 1 178 180 -179 1 214 215 -180 1 214 216 -181 1 538 539 -182 1 538 540 -183 1 226 227 -184 1 226 228 -185 1 706 707 -186 1 706 708 -187 1 373 374 -188 1 373 375 -189 1 682 683 -190 1 682 684 -191 1 595 596 -192 1 595 597 -193 1 649 650 -194 1 649 651 -195 1 337 338 -196 1 337 339 -197 1 325 326 -198 1 325 327 -199 1 535 536 -200 1 535 537 -201 1 514 515 -202 1 514 516 -203 1 166 167 -204 1 166 168 -205 1 517 518 -206 1 517 519 -207 1 148 149 -208 1 148 150 -209 1 328 329 -210 1 328 330 -211 1 457 458 -212 1 457 459 -213 1 118 119 -214 1 118 120 -215 1 190 191 -216 1 190 192 -217 1 97 98 -218 1 97 99 -219 1 244 245 -220 1 244 246 -221 1 631 632 -222 1 631 633 -223 1 295 296 -224 1 295 297 -225 1 334 335 -226 1 334 336 -227 1 655 656 -228 1 655 657 -229 1 331 332 -230 1 331 333 -231 1 223 224 -232 1 223 225 -233 1 283 284 -234 1 283 285 -235 1 694 695 -236 1 694 696 -237 1 508 509 -238 1 508 510 -239 1 262 263 -240 1 262 264 -241 1 460 461 -242 1 460 462 -243 1 355 356 -244 1 355 357 -245 1 439 440 -246 1 439 441 -247 1 592 593 -248 1 592 594 -249 1 229 230 -250 1 229 231 -251 1 442 443 -252 1 442 444 -253 1 553 554 -254 1 553 555 -255 1 247 248 -256 1 247 249 -257 1 724 725 -258 1 724 726 -259 1 340 341 -260 1 340 342 -261 1 364 365 -262 1 364 366 -263 1 502 503 -264 1 502 504 -265 1 259 260 -266 1 259 261 -267 1 640 641 -268 1 640 642 -269 1 532 533 -270 1 532 534 -271 1 235 236 -272 1 235 237 -273 1 121 122 -274 1 121 123 -275 1 265 266 -276 1 265 267 -277 1 547 548 -278 1 547 549 -279 1 619 620 -280 1 619 621 -281 1 715 716 -282 1 715 717 -283 1 646 647 -284 1 646 648 -285 1 565 566 -286 1 565 567 -287 1 544 545 -288 1 544 546 -289 1 493 494 -290 1 493 495 -291 1 301 302 -292 1 301 303 -293 1 127 128 -294 1 127 129 -295 1 391 392 -296 1 391 393 -297 1 157 158 -298 1 157 159 -299 1 412 413 -300 1 412 414 -301 1 448 449 -302 1 448 450 -303 1 277 278 -304 1 277 279 -305 1 268 269 -306 1 268 270 -307 1 142 143 -308 1 142 144 -309 1 583 584 -310 1 583 585 -311 1 718 719 -312 1 718 720 -313 1 130 131 -314 1 130 132 -315 1 133 134 -316 1 133 135 -317 1 511 512 -318 1 511 513 -319 1 568 569 -320 1 568 570 -321 1 304 305 -322 1 304 306 -323 1 418 419 -324 1 418 420 -325 1 445 446 -326 1 445 447 -327 1 463 464 -328 1 463 465 -329 1 172 173 -330 1 172 174 -331 1 499 500 -332 1 499 501 -333 1 250 251 -334 1 250 252 -335 1 322 323 -336 1 322 324 -337 1 199 200 -338 1 199 201 -339 1 622 623 -340 1 622 624 -341 1 550 551 -342 1 550 552 -343 1 124 125 -344 1 124 126 -345 1 145 146 -346 1 145 147 -347 1 703 704 -348 1 703 705 -349 1 559 560 -350 1 559 561 -351 1 598 599 -352 1 598 600 -353 1 310 311 -354 1 310 312 -355 1 139 140 -356 1 139 141 -357 1 397 398 -358 1 397 399 -359 1 319 320 -360 1 319 321 -361 1 490 491 -362 1 490 492 -363 1 370 371 -364 1 370 372 -365 1 610 611 -366 1 610 612 -367 1 154 155 -368 1 154 156 -369 1 181 182 -370 1 181 183 -371 1 628 629 -372 1 628 630 -373 1 487 488 -374 1 487 489 -375 1 526 527 -376 1 526 528 -377 1 151 152 -378 1 151 153 -379 1 160 161 -380 1 160 162 -381 1 220 221 -382 1 220 222 -383 1 349 350 -384 1 349 351 -385 1 472 473 -386 1 472 474 -387 1 286 287 -388 1 286 288 -389 1 667 668 -390 1 667 669 -391 1 232 233 -392 1 232 234 -393 1 556 557 -394 1 556 558 -395 1 613 614 -396 1 613 615 -397 1 451 452 -398 1 451 453 -399 1 427 428 -400 1 427 429 -401 1 409 410 -402 1 409 411 -403 1 673 674 -404 1 673 675 -405 1 616 617 -406 1 616 618 -407 1 529 530 -408 1 529 531 -409 1 379 380 -410 1 379 381 -411 1 658 659 -412 1 658 660 -413 1 454 455 -414 1 454 456 -415 1 175 176 -416 1 175 177 -417 1 505 506 -418 1 505 507 -419 1 163 164 -420 1 163 165 +31 1 382 383 +32 1 382 384 +33 1 187 188 +34 1 187 189 +35 1 496 497 +36 1 496 498 +37 1 100 101 +38 1 100 102 +39 1 319 320 +40 1 319 321 +41 1 217 218 +42 1 217 219 +43 1 673 674 +44 1 673 675 +45 1 313 314 +46 1 313 315 +47 1 421 422 +48 1 421 423 +49 1 310 311 +50 1 310 312 +51 1 589 590 +52 1 589 591 +53 1 460 461 +54 1 460 462 +55 1 499 500 +56 1 499 501 +57 1 277 278 +58 1 277 279 +59 1 370 371 +60 1 370 372 +61 1 154 155 +62 1 154 156 +63 1 316 317 +64 1 316 318 +65 1 274 275 +66 1 274 276 +67 1 253 254 +68 1 253 255 +69 1 406 407 +70 1 406 408 +71 1 295 296 +72 1 295 297 +73 1 151 152 +74 1 151 153 +75 1 343 344 +76 1 343 345 +77 1 694 695 +78 1 694 696 +79 1 265 266 +80 1 265 267 +81 1 106 107 +82 1 106 108 +83 1 427 428 +84 1 427 429 +85 1 562 563 +86 1 562 564 +87 1 103 104 +88 1 103 105 +89 1 232 233 +90 1 232 234 +91 1 568 569 +92 1 568 570 +93 1 535 536 +94 1 535 537 +95 1 712 713 +96 1 712 714 +97 1 448 449 +98 1 448 450 +99 1 403 404 +100 1 403 405 +101 1 175 176 +102 1 175 177 +103 1 667 668 +104 1 667 669 +105 1 484 485 +106 1 484 486 +107 1 514 515 +108 1 514 516 +109 1 478 479 +110 1 478 480 +111 1 373 374 +112 1 373 375 +113 1 127 128 +114 1 127 129 +115 1 670 671 +116 1 670 672 +117 1 715 716 +118 1 715 717 +119 1 688 689 +120 1 688 690 +121 1 604 605 +122 1 604 606 +123 1 109 110 +124 1 109 111 +125 1 205 206 +126 1 205 207 +127 1 112 113 +128 1 112 114 +129 1 124 125 +130 1 124 126 +131 1 616 617 +132 1 616 618 +133 1 574 575 +134 1 574 576 +135 1 424 425 +136 1 424 426 +137 1 709 710 +138 1 709 711 +139 1 466 467 +140 1 466 468 +141 1 532 533 +142 1 532 534 +143 1 511 512 +144 1 511 513 +145 1 196 197 +146 1 196 198 +147 1 349 350 +148 1 349 351 +149 1 622 623 +150 1 622 624 +151 1 643 644 +152 1 643 645 +153 1 583 584 +154 1 583 585 +155 1 172 173 +156 1 172 174 +157 1 502 503 +158 1 502 504 +159 1 385 386 +160 1 385 387 +161 1 259 260 +162 1 259 261 +163 1 610 611 +164 1 610 612 +165 1 367 368 +166 1 367 369 +167 1 577 578 +168 1 577 579 +169 1 97 98 +170 1 97 99 +171 1 166 167 +172 1 166 168 +173 1 394 395 +174 1 394 396 +175 1 433 434 +176 1 433 435 +177 1 355 356 +178 1 355 357 +179 1 652 653 +180 1 652 654 +181 1 244 245 +182 1 244 246 +183 1 697 698 +184 1 697 699 +185 1 592 593 +186 1 592 594 +187 1 208 209 +188 1 208 210 +189 1 640 641 +190 1 640 642 +191 1 136 137 +192 1 136 138 +193 1 139 140 +194 1 139 141 +195 1 286 287 +196 1 286 288 +197 1 223 224 +198 1 223 225 +199 1 256 257 +200 1 256 258 +201 1 388 389 +202 1 388 390 +203 1 628 629 +204 1 628 630 +205 1 661 662 +206 1 661 663 +207 1 157 158 +208 1 157 159 +209 1 331 332 +210 1 331 333 +211 1 418 419 +212 1 418 420 +213 1 304 305 +214 1 304 306 +215 1 724 725 +216 1 724 726 +217 1 397 398 +218 1 397 399 +219 1 283 284 +220 1 283 285 +221 1 163 164 +222 1 163 165 +223 1 685 686 +224 1 685 687 +225 1 649 650 +226 1 649 651 +227 1 586 587 +228 1 586 588 +229 1 214 215 +230 1 214 216 +231 1 190 191 +232 1 190 192 +233 1 538 539 +234 1 538 540 +235 1 262 263 +236 1 262 264 +237 1 442 443 +238 1 442 444 +239 1 613 614 +240 1 613 615 +241 1 238 239 +242 1 238 240 +243 1 436 437 +244 1 436 438 +245 1 718 719 +246 1 718 720 +247 1 118 119 +248 1 118 120 +249 1 301 302 +250 1 301 303 +251 1 379 380 +252 1 379 381 +253 1 439 440 +254 1 439 441 +255 1 241 242 +256 1 241 243 +257 1 142 143 +258 1 142 144 +259 1 472 473 +260 1 472 474 +261 1 505 506 +262 1 505 507 +263 1 364 365 +264 1 364 366 +265 1 658 659 +266 1 658 660 +267 1 703 704 +268 1 703 705 +269 1 358 359 +270 1 358 360 +271 1 556 557 +272 1 556 558 +273 1 451 452 +274 1 451 453 +275 1 469 470 +276 1 469 471 +277 1 247 248 +278 1 247 249 +279 1 361 362 +280 1 361 363 +281 1 490 491 +282 1 490 492 +283 1 292 293 +284 1 292 294 +285 1 646 647 +286 1 646 648 +287 1 289 290 +288 1 289 291 +289 1 634 635 +290 1 634 636 +291 1 325 326 +292 1 325 327 +293 1 148 149 +294 1 148 150 +295 1 706 707 +296 1 706 708 +297 1 481 482 +298 1 481 483 +299 1 307 308 +300 1 307 309 +301 1 229 230 +302 1 229 231 +303 1 493 494 +304 1 493 495 +305 1 463 464 +306 1 463 465 +307 1 268 269 +308 1 268 270 +309 1 298 299 +310 1 298 300 +311 1 334 335 +312 1 334 336 +313 1 679 680 +314 1 679 681 +315 1 454 455 +316 1 454 456 +317 1 271 272 +318 1 271 273 +319 1 280 281 +320 1 280 282 +321 1 700 701 +322 1 700 702 +323 1 580 581 +324 1 580 582 +325 1 571 572 +326 1 571 573 +327 1 184 185 +328 1 184 186 +329 1 721 722 +330 1 721 723 +331 1 607 608 +332 1 607 609 +333 1 637 638 +334 1 637 639 +335 1 220 221 +336 1 220 222 +337 1 193 194 +338 1 193 195 +339 1 430 431 +340 1 430 432 +341 1 544 545 +342 1 544 546 +343 1 115 116 +344 1 115 117 +345 1 199 200 +346 1 199 201 +347 1 598 599 +348 1 598 600 +349 1 322 323 +350 1 322 324 +351 1 520 521 +352 1 520 522 +353 1 181 182 +354 1 181 183 +355 1 526 527 +356 1 526 528 +357 1 352 353 +358 1 352 354 +359 1 226 227 +360 1 226 228 +361 1 550 551 +362 1 550 552 +363 1 523 524 +364 1 523 525 +365 1 517 518 +366 1 517 519 +367 1 508 509 +368 1 508 510 +369 1 625 626 +370 1 625 627 +371 1 250 251 +372 1 250 252 +373 1 130 131 +374 1 130 132 +375 1 202 203 +376 1 202 204 +377 1 541 542 +378 1 541 543 +379 1 391 392 +380 1 391 393 +381 1 601 602 +382 1 601 603 +383 1 178 179 +384 1 178 180 +385 1 235 236 +386 1 235 237 +387 1 664 665 +388 1 664 666 +389 1 415 416 +390 1 415 417 +391 1 565 566 +392 1 565 567 +393 1 595 596 +394 1 595 597 +395 1 328 329 +396 1 328 330 +397 1 619 620 +398 1 619 621 +399 1 376 377 +400 1 376 378 +401 1 340 341 +402 1 340 342 +403 1 409 410 +404 1 409 411 +405 1 676 677 +406 1 676 678 +407 1 631 632 +408 1 631 633 +409 1 400 401 +410 1 400 402 +411 1 487 488 +412 1 487 489 +413 1 160 161 +414 1 160 162 +415 1 412 413 +416 1 412 414 +417 1 553 554 +418 1 553 555 +419 1 145 146 +420 1 145 147 Angles -1 1 677 676 678 -2 1 710 709 711 -3 1 194 193 195 -4 1 104 103 105 -5 1 713 712 714 -6 1 605 604 606 -7 1 389 388 390 -8 1 587 586 588 -9 1 602 601 603 -10 1 317 316 318 -11 1 422 421 423 -12 1 644 643 645 -13 1 692 691 693 -14 1 368 367 369 +1 1 656 655 657 +2 1 122 121 123 +3 1 692 691 693 +4 1 212 211 213 +5 1 530 529 531 +6 1 548 547 549 +7 1 338 337 339 +8 1 683 682 684 +9 1 458 457 459 +10 1 347 346 348 +11 1 560 559 561 +12 1 476 475 477 +13 1 446 445 447 +14 1 134 133 135 15 1 170 169 171 -16 1 542 541 543 -17 1 521 520 522 -18 1 212 211 213 -19 1 206 205 207 -20 1 680 679 681 -21 1 299 298 300 -22 1 497 496 498 -23 1 188 187 189 -24 1 386 385 387 -25 1 431 430 432 -26 1 476 475 477 -27 1 578 577 579 -28 1 281 280 282 -29 1 116 115 117 -30 1 197 196 198 -31 1 242 241 243 -32 1 401 400 402 -33 1 563 562 564 -34 1 665 664 666 -35 1 638 637 639 -36 1 653 652 654 -37 1 257 256 258 -38 1 425 424 426 -39 1 467 466 468 -40 1 581 580 582 -41 1 353 352 354 -42 1 293 292 294 -43 1 575 574 576 -44 1 437 436 438 -45 1 701 700 702 -46 1 107 106 108 -47 1 377 376 378 -48 1 359 358 360 -49 1 290 289 291 -50 1 407 406 408 -51 1 524 523 525 -52 1 626 625 627 -53 1 137 136 138 -54 1 185 184 186 -55 1 314 313 315 -56 1 239 238 240 -57 1 404 403 405 -58 1 698 697 699 -59 1 383 382 384 -60 1 671 670 672 -61 1 395 394 396 -62 1 203 202 204 -63 1 347 346 348 -64 1 572 571 573 -65 1 590 589 591 -66 1 608 607 609 -67 1 275 274 276 -68 1 113 112 114 -69 1 344 343 345 -70 1 254 253 255 -71 1 110 109 111 -72 1 308 307 309 -73 1 686 685 687 -74 1 272 271 273 -75 1 482 481 483 -76 1 722 721 723 -77 1 209 208 210 -78 1 470 469 471 -79 1 689 688 690 -80 1 635 634 636 -81 1 434 433 435 -82 1 416 415 417 -83 1 218 217 219 -84 1 479 478 480 -85 1 362 361 363 -86 1 485 484 486 -87 1 662 661 663 -88 1 101 100 102 -89 1 179 178 180 -90 1 215 214 216 -91 1 539 538 540 -92 1 227 226 228 -93 1 707 706 708 -94 1 374 373 375 -95 1 683 682 684 -96 1 596 595 597 -97 1 650 649 651 -98 1 338 337 339 -99 1 326 325 327 -100 1 536 535 537 -101 1 515 514 516 -102 1 167 166 168 -103 1 518 517 519 -104 1 149 148 150 -105 1 329 328 330 -106 1 458 457 459 -107 1 119 118 120 -108 1 191 190 192 -109 1 98 97 99 -110 1 245 244 246 -111 1 632 631 633 -112 1 296 295 297 -113 1 335 334 336 -114 1 656 655 657 -115 1 332 331 333 -116 1 224 223 225 -117 1 284 283 285 -118 1 695 694 696 -119 1 509 508 510 -120 1 263 262 264 -121 1 461 460 462 -122 1 356 355 357 -123 1 440 439 441 -124 1 593 592 594 -125 1 230 229 231 -126 1 443 442 444 -127 1 554 553 555 -128 1 248 247 249 -129 1 725 724 726 -130 1 341 340 342 -131 1 365 364 366 -132 1 503 502 504 -133 1 260 259 261 -134 1 641 640 642 -135 1 533 532 534 -136 1 236 235 237 -137 1 122 121 123 -138 1 266 265 267 -139 1 548 547 549 -140 1 620 619 621 -141 1 716 715 717 -142 1 647 646 648 -143 1 566 565 567 -144 1 545 544 546 -145 1 494 493 495 -146 1 302 301 303 -147 1 128 127 129 -148 1 392 391 393 -149 1 158 157 159 -150 1 413 412 414 -151 1 449 448 450 -152 1 278 277 279 -153 1 269 268 270 -154 1 143 142 144 -155 1 584 583 585 -156 1 719 718 720 -157 1 131 130 132 -158 1 134 133 135 -159 1 512 511 513 -160 1 569 568 570 -161 1 305 304 306 -162 1 419 418 420 -163 1 446 445 447 -164 1 464 463 465 -165 1 173 172 174 -166 1 500 499 501 -167 1 251 250 252 -168 1 323 322 324 -169 1 200 199 201 -170 1 623 622 624 -171 1 551 550 552 -172 1 125 124 126 -173 1 146 145 147 -174 1 704 703 705 -175 1 560 559 561 -176 1 599 598 600 -177 1 311 310 312 -178 1 140 139 141 -179 1 398 397 399 -180 1 320 319 321 -181 1 491 490 492 -182 1 371 370 372 -183 1 611 610 612 -184 1 155 154 156 -185 1 182 181 183 -186 1 629 628 630 -187 1 488 487 489 -188 1 527 526 528 -189 1 152 151 153 -190 1 161 160 162 -191 1 221 220 222 -192 1 350 349 351 -193 1 473 472 474 -194 1 287 286 288 -195 1 668 667 669 -196 1 233 232 234 -197 1 557 556 558 -198 1 614 613 615 -199 1 452 451 453 -200 1 428 427 429 -201 1 410 409 411 -202 1 674 673 675 -203 1 617 616 618 -204 1 530 529 531 -205 1 380 379 381 -206 1 659 658 660 -207 1 455 454 456 -208 1 176 175 177 -209 1 506 505 507 -210 1 164 163 165 +16 1 383 382 384 +17 1 188 187 189 +18 1 497 496 498 +19 1 101 100 102 +20 1 320 319 321 +21 1 218 217 219 +22 1 674 673 675 +23 1 314 313 315 +24 1 422 421 423 +25 1 311 310 312 +26 1 590 589 591 +27 1 461 460 462 +28 1 500 499 501 +29 1 278 277 279 +30 1 371 370 372 +31 1 155 154 156 +32 1 317 316 318 +33 1 275 274 276 +34 1 254 253 255 +35 1 407 406 408 +36 1 296 295 297 +37 1 152 151 153 +38 1 344 343 345 +39 1 695 694 696 +40 1 266 265 267 +41 1 107 106 108 +42 1 428 427 429 +43 1 563 562 564 +44 1 104 103 105 +45 1 233 232 234 +46 1 569 568 570 +47 1 536 535 537 +48 1 713 712 714 +49 1 449 448 450 +50 1 404 403 405 +51 1 176 175 177 +52 1 668 667 669 +53 1 485 484 486 +54 1 515 514 516 +55 1 479 478 480 +56 1 374 373 375 +57 1 128 127 129 +58 1 671 670 672 +59 1 716 715 717 +60 1 689 688 690 +61 1 605 604 606 +62 1 110 109 111 +63 1 206 205 207 +64 1 113 112 114 +65 1 125 124 126 +66 1 617 616 618 +67 1 575 574 576 +68 1 425 424 426 +69 1 710 709 711 +70 1 467 466 468 +71 1 533 532 534 +72 1 512 511 513 +73 1 197 196 198 +74 1 350 349 351 +75 1 623 622 624 +76 1 644 643 645 +77 1 584 583 585 +78 1 173 172 174 +79 1 503 502 504 +80 1 386 385 387 +81 1 260 259 261 +82 1 611 610 612 +83 1 368 367 369 +84 1 578 577 579 +85 1 98 97 99 +86 1 167 166 168 +87 1 395 394 396 +88 1 434 433 435 +89 1 356 355 357 +90 1 653 652 654 +91 1 245 244 246 +92 1 698 697 699 +93 1 593 592 594 +94 1 209 208 210 +95 1 641 640 642 +96 1 137 136 138 +97 1 140 139 141 +98 1 287 286 288 +99 1 224 223 225 +100 1 257 256 258 +101 1 389 388 390 +102 1 629 628 630 +103 1 662 661 663 +104 1 158 157 159 +105 1 332 331 333 +106 1 419 418 420 +107 1 305 304 306 +108 1 725 724 726 +109 1 398 397 399 +110 1 284 283 285 +111 1 164 163 165 +112 1 686 685 687 +113 1 650 649 651 +114 1 587 586 588 +115 1 215 214 216 +116 1 191 190 192 +117 1 539 538 540 +118 1 263 262 264 +119 1 443 442 444 +120 1 614 613 615 +121 1 239 238 240 +122 1 437 436 438 +123 1 719 718 720 +124 1 119 118 120 +125 1 302 301 303 +126 1 380 379 381 +127 1 440 439 441 +128 1 242 241 243 +129 1 143 142 144 +130 1 473 472 474 +131 1 506 505 507 +132 1 365 364 366 +133 1 659 658 660 +134 1 704 703 705 +135 1 359 358 360 +136 1 557 556 558 +137 1 452 451 453 +138 1 470 469 471 +139 1 248 247 249 +140 1 362 361 363 +141 1 491 490 492 +142 1 293 292 294 +143 1 647 646 648 +144 1 290 289 291 +145 1 635 634 636 +146 1 326 325 327 +147 1 149 148 150 +148 1 707 706 708 +149 1 482 481 483 +150 1 308 307 309 +151 1 230 229 231 +152 1 494 493 495 +153 1 464 463 465 +154 1 269 268 270 +155 1 299 298 300 +156 1 335 334 336 +157 1 680 679 681 +158 1 455 454 456 +159 1 272 271 273 +160 1 281 280 282 +161 1 701 700 702 +162 1 581 580 582 +163 1 572 571 573 +164 1 185 184 186 +165 1 722 721 723 +166 1 608 607 609 +167 1 638 637 639 +168 1 221 220 222 +169 1 194 193 195 +170 1 431 430 432 +171 1 545 544 546 +172 1 116 115 117 +173 1 200 199 201 +174 1 599 598 600 +175 1 323 322 324 +176 1 521 520 522 +177 1 182 181 183 +178 1 527 526 528 +179 1 353 352 354 +180 1 227 226 228 +181 1 551 550 552 +182 1 524 523 525 +183 1 518 517 519 +184 1 509 508 510 +185 1 626 625 627 +186 1 251 250 252 +187 1 131 130 132 +188 1 203 202 204 +189 1 542 541 543 +190 1 392 391 393 +191 1 602 601 603 +192 1 179 178 180 +193 1 236 235 237 +194 1 665 664 666 +195 1 416 415 417 +196 1 566 565 567 +197 1 596 595 597 +198 1 329 328 330 +199 1 620 619 621 +200 1 377 376 378 +201 1 341 340 342 +202 1 410 409 411 +203 1 677 676 678 +204 1 632 631 633 +205 1 401 400 402 +206 1 488 487 489 +207 1 161 160 162 +208 1 413 412 414 +209 1 554 553 555 +210 1 146 145 147 diff --git a/examples/PACKAGES/electrode/piston/in.piston b/examples/PACKAGES/electrode/piston/in.piston index 35b4790935..f277e7cebd 100644 --- a/examples/PACKAGES/electrode/piston/in.piston +++ b/examples/PACKAGES/electrode/piston/in.piston @@ -42,7 +42,11 @@ fix fxforce_au gold setforce 0.0 0.0 0.0 # equilibrate z-coordinate of upper electrode while keeping the electrode rigid fix fxforce_wa wall setforce 0.0 0.0 NULL -fix fxpressure wall aveforce 0 0 -0.005246 # atomspheric pressure: area/force->nktv2p +variable atm equal 1/68568.415 # 1/force->nktv2p +variable area equal (xhi-xlo)*(yhi-ylo) +variable wall_force equal -v_atm*v_area/count(wall) +print "Wall force per atom: ${wall_force}" +fix fxpressure wall aveforce 0 0 ${wall_force} # atomspheric pressure: area/force->nktv2p fix fxdrag wall viscous 100 fix fxrigid wall rigid/nve single diff --git a/examples/PACKAGES/electrode/piston/log.1Dec2022.piston.g++.1 b/examples/PACKAGES/electrode/piston/log.22May2024.piston.g++.1 similarity index 64% rename from examples/PACKAGES/electrode/piston/log.1Dec2022.piston.g++.1 rename to examples/PACKAGES/electrode/piston/log.22May2024.piston.g++.1 index a5b6d4cd4f..a52061a57b 100644 --- a/examples/PACKAGES/electrode/piston/log.1Dec2022.piston.g++.1 +++ b/examples/PACKAGES/electrode/piston/log.22May2024.piston.g++.1 @@ -1,4 +1,5 @@ -LAMMPS (3 Nov 2022) +LAMMPS (7 Feb 2024 - Development - patch_7Feb2024_update1-217-g1909233c69-modified) + using 1 OpenMP thread(s) per MPI task # The intention is to find the average position of one wall at atmospheric # pressure. The output is the wall position over time which can be used to # find the average position for a run with fixed wall position. @@ -40,8 +41,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.001 seconds - read_data CPU = 0.011 seconds + special bonds CPU = 0.000 seconds + read_data CPU = 0.012 seconds # ----------------- Settings Section ----------------- @@ -77,7 +78,13 @@ fix fxforce_au gold setforce 0.0 0.0 0.0 # equilibrate z-coordinate of upper electrode while keeping the electrode rigid fix fxforce_wa wall setforce 0.0 0.0 NULL -fix fxpressure wall aveforce 0 0 -0.005246 # atomspheric pressure: area/force->nktv2p +variable atm equal 1/68568.415 # 1/force->nktv2p +variable area equal (xhi-xlo)*(yhi-ylo) +variable wall_force equal -v_atm*v_area/count(wall) +print "Wall force per atom: ${wall_force}" +Wall force per atom: -0.000109285996244287 +fix fxpressure wall aveforce 0 0 ${wall_force} # atomspheric pressure: area/force->nktv2p +fix fxpressure wall aveforce 0 0 -0.000109285996244287 fix fxdrag wall viscous 100 fix fxrigid wall rigid/nve single 1 rigid bodies with 48 atoms @@ -134,7 +141,7 @@ PPPM/electrode initialization ... stencil order = 5 estimated absolute RMS force accuracy = 0.02930901 estimated relative force accuracy = 8.8263214e-05 - using double precision MKL FFT + using double precision FFTW3 3d grid and FFT values/proc = 15884 6480 Generated 6 of 6 mixed pair_coeff terms from arithmetic mixing rule Neighbor list info ... @@ -157,54 +164,54 @@ Neighbor list info ... Per MPI rank memory allocation (min/avg/max) = 11.7 | 11.7 | 11.7 Mbytes Step c_temp_mobile c_qwa c_qau v_top_wall 0 303.38967 -0.042963484 0.042963484 21.4018 - 5000 285.08828 -0.26105255 0.26105255 25.155629 - 10000 323.19176 -0.26264003 0.26264003 24.541676 - 15000 310.479 -0.27318148 0.27318148 23.141522 - 20000 295.18544 -0.11313444 0.11313444 23.828735 - 25000 295.38607 -0.25433086 0.25433086 23.673314 - 30000 288.0613 -0.30099901 0.30099901 23.438086 - 35000 278.5591 -0.15823576 0.15823576 24.311915 - 40000 303.95751 -0.19941381 0.19941381 23.69594 - 45000 279.026 -0.1659962 0.1659962 23.588604 - 50000 298.79278 -0.28866703 0.28866703 23.372508 - 55000 301.03353 -0.078370381 0.078370381 23.192985 - 60000 306.77965 -0.12807205 0.12807205 23.968574 - 65000 309.86008 -0.27162663 0.27162663 23.616704 - 70000 287.31116 -0.029751882 0.029751882 23.667495 - 75000 312.48654 -0.10759866 0.10759866 23.504105 - 80000 309.94267 -0.2558548 0.2558548 23.810576 - 85000 328.04389 -0.1575471 0.1575471 24.013437 - 90000 302.9806 -0.032002164 0.032002164 24.264432 - 95000 294.20804 -0.27797238 0.27797238 23.291758 - 100000 307.63019 -0.19047448 0.19047448 23.632147 -Loop time of 530.844 on 1 procs for 100000 steps with 726 atoms + 5000 311.85363 0.03543775 -0.03543775 24.79665 + 10000 285.91321 -0.16873703 0.16873703 23.103088 + 15000 295.39476 -0.44424612 0.44424612 23.767107 + 20000 296.12969 -0.14120993 0.14120993 23.96361 + 25000 306.59629 -0.29333182 0.29333182 23.884488 + 30000 297.98559 -0.10749684 0.10749684 23.73316 + 35000 297.98503 -0.11809975 0.11809975 23.984669 + 40000 300.26292 -0.32784184 0.32784184 23.462748 + 45000 295.68441 -0.25940165 0.25940165 23.516403 + 50000 315.12883 -0.36037614 0.36037614 23.627879 + 55000 290.55151 -0.0032838106 0.0032838106 23.684931 + 60000 316.4625 -0.17245368 0.17245368 24.126883 + 65000 296.79343 -0.054061851 0.054061851 23.695094 + 70000 305.99923 -0.11363801 0.11363801 23.55476 + 75000 297.40131 -0.27054153 0.27054153 23.928994 + 80000 306.54811 -0.25409719 0.25409719 23.869448 + 85000 303.95231 -0.17895561 0.17895561 23.658833 + 90000 313.43739 -0.059036514 0.059036514 23.36056 + 95000 290.3077 -0.31394478 0.31394478 23.885538 + 100000 297.5156 -0.30730083 0.30730083 23.511674 +Loop time of 1586.06 on 1 procs for 100000 steps with 726 atoms -Performance: 32.552 ns/day, 0.737 hours/ns, 188.379 timesteps/s, 136.763 katom-step/s -100.0% CPU use with 1 MPI tasks x no OpenMP threads +Performance: 10.895 ns/day, 2.203 hours/ns, 63.049 timesteps/s, 45.774 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 | 190.47 | 190.47 | 190.47 | 0.0 | 35.88 -Bond | 0.10754 | 0.10754 | 0.10754 | 0.0 | 0.02 -Kspace | 73.179 | 73.179 | 73.179 | 0.0 | 13.79 -Neigh | 24.209 | 24.209 | 24.209 | 0.0 | 4.56 -Comm | 1.6857 | 1.6857 | 1.6857 | 0.0 | 0.32 -Output | 0.0016861 | 0.0016861 | 0.0016861 | 0.0 | 0.00 -Modify | 240.23 | 240.23 | 240.23 | 0.0 | 45.26 -Other | | 0.9595 | | | 0.18 +Pair | 460.91 | 460.91 | 460.91 | 0.0 | 29.06 +Bond | 0.047873 | 0.047873 | 0.047873 | 0.0 | 0.00 +Kspace | 341.4 | 341.4 | 341.4 | 0.0 | 21.53 +Neigh | 52.868 | 52.868 | 52.868 | 0.0 | 3.33 +Comm | 5.2321 | 5.2321 | 5.2321 | 0.0 | 0.33 +Output | 0.00099102 | 0.00099102 | 0.00099102 | 0.0 | 0.00 +Modify | 724.63 | 724.63 | 724.63 | 0.0 | 45.69 +Other | | 0.9741 | | | 0.06 Nlocal: 726 ave 726 max 726 min Histogram: 1 0 0 0 0 0 0 0 0 0 -Nghost: 2335 ave 2335 max 2335 min +Nghost: 2336 ave 2336 max 2336 min Histogram: 1 0 0 0 0 0 0 0 0 0 -Neighs: 120271 ave 120271 max 120271 min +Neighs: 120321 ave 120321 max 120321 min Histogram: 1 0 0 0 0 0 0 0 0 0 -Total # of neighbors = 120271 -Ave neighs/atom = 165.66253 +Total # of neighbors = 120321 +Ave neighs/atom = 165.7314 Ave special neighs/atom = 1.7355372 -Neighbor list builds = 7722 +Neighbor list builds = 7670 Dangerous builds = 0 write_data "data.piston.final" System init for write_data ... @@ -213,11 +220,11 @@ PPPM/electrode initialization ... G vector (1/distance) = 0.32814871 grid = 12 15 36 stencil order = 5 - estimated absolute RMS force accuracy = 0.029311365 - estimated relative force accuracy = 8.8270304e-05 - using double precision MKL FFT + estimated absolute RMS force accuracy = 0.029311329 + estimated relative force accuracy = 8.8270197e-05 + using double precision FFTW3 3d grid and FFT values/proc = 15884 6480 Generated 6 of 6 mixed pair_coeff terms from arithmetic mixing rule Average conjugate gradient steps: 1.981 -Total wall time: 0:08:50 +Total wall time: 0:26:26 diff --git a/examples/PACKAGES/electrode/piston/log.1Dec2022.piston.g++.4 b/examples/PACKAGES/electrode/piston/log.22May2024.piston.g++.4 similarity index 61% rename from examples/PACKAGES/electrode/piston/log.1Dec2022.piston.g++.4 rename to examples/PACKAGES/electrode/piston/log.22May2024.piston.g++.4 index ffb6bcc61c..2534176dc6 100644 --- a/examples/PACKAGES/electrode/piston/log.1Dec2022.piston.g++.4 +++ b/examples/PACKAGES/electrode/piston/log.22May2024.piston.g++.4 @@ -1,4 +1,5 @@ -LAMMPS (3 Nov 2022) +LAMMPS (7 Feb 2024 - Development - patch_7Feb2024_update1-217-g1909233c69-modified) + using 1 OpenMP thread(s) per MPI task # The intention is to find the average position of one wall at atmospheric # pressure. The output is the wall position over time which can be used to # find the average position for a run with fixed wall position. @@ -41,8 +42,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.001 seconds - read_data CPU = 0.017 seconds + special bonds CPU = 0.000 seconds + read_data CPU = 0.012 seconds # ----------------- Settings Section ----------------- @@ -66,7 +67,7 @@ Finding SHAKE clusters ... 0 = # of size 3 clusters 0 = # of size 4 clusters 210 = # of frozen angles - find clusters CPU = 0.002 seconds + find clusters CPU = 0.000 seconds pair_modify mix arithmetic # ----------------- Run Section ----------------- @@ -78,7 +79,13 @@ fix fxforce_au gold setforce 0.0 0.0 0.0 # equilibrate z-coordinate of upper electrode while keeping the electrode rigid fix fxforce_wa wall setforce 0.0 0.0 NULL -fix fxpressure wall aveforce 0 0 -0.005246 # atomspheric pressure: area/force->nktv2p +variable atm equal 1/68568.415 # 1/force->nktv2p +variable area equal (xhi-xlo)*(yhi-ylo) +variable wall_force equal -v_atm*v_area/count(wall) +print "Wall force per atom: ${wall_force}" +Wall force per atom: -0.000109285996244287 +fix fxpressure wall aveforce 0 0 ${wall_force} # atomspheric pressure: area/force->nktv2p +fix fxpressure wall aveforce 0 0 -0.000109285996244287 fix fxdrag wall viscous 100 fix fxrigid wall rigid/nve single 1 rigid bodies with 48 atoms @@ -135,7 +142,7 @@ PPPM/electrode initialization ... stencil order = 5 estimated absolute RMS force accuracy = 0.02930901 estimated relative force accuracy = 8.8263214e-05 - using double precision MKL FFT + using double precision FFTW3 3d grid and FFT values/proc = 8512 2880 Generated 6 of 6 mixed pair_coeff terms from arithmetic mixing rule Neighbor list info ... @@ -158,54 +165,54 @@ Neighbor list info ... Per MPI rank memory allocation (min/avg/max) = 10.06 | 10.22 | 10.41 Mbytes Step c_temp_mobile c_qwa c_qau v_top_wall 0 303.38967 -0.042963484 0.042963484 21.4018 - 5000 292.03027 -0.19040435 0.19040435 24.581338 - 10000 309.52764 -0.48308301 0.48308301 23.776985 - 15000 295.00243 -0.16591109 0.16591109 23.672038 - 20000 293.5536 -0.086669084 0.086669084 23.426455 - 25000 303.0079 -0.16488112 0.16488112 23.862966 - 30000 306.31463 -0.23192653 0.23192653 23.819882 - 35000 303.66268 -0.2317907 0.2317907 23.495344 - 40000 301.39435 -0.34661329 0.34661329 23.657835 - 45000 291.61205 -0.30539427 0.30539427 23.437303 - 50000 298.65319 -0.096107034 0.096107034 23.57809 - 55000 282.65069 -0.14943539 0.14943539 23.823728 - 60000 310.64182 -0.17418813 0.17418813 23.286959 - 65000 308.47141 -0.02075662 0.02075662 23.91313 - 70000 292.5186 -0.080163162 0.080163162 23.96283 - 75000 270.13928 -0.029528648 0.029528648 23.488972 - 80000 322.10914 0.030761045 -0.030761045 23.47592 - 85000 310.60347 -0.24069996 0.24069996 23.987091 - 90000 294.35695 -0.070458235 0.070458235 23.397929 - 95000 308.69043 -0.2652581 0.2652581 23.473813 - 100000 318.71883 0.024035956 -0.024035956 23.449863 -Loop time of 590.232 on 4 procs for 100000 steps with 726 atoms + 5000 291.6303 -0.1820085 0.1820085 24.641399 + 10000 299.42886 -0.19823095 0.19823095 23.820522 + 15000 288.23071 -0.065261869 0.065261869 23.360845 + 20000 299.4644 -0.042993777 0.042993777 23.987554 + 25000 304.26497 -0.15665293 0.15665293 23.729006 + 30000 292.29674 -0.25142779 0.25142779 23.960725 + 35000 295.57492 -0.01269228 0.01269228 23.445383 + 40000 303.38438 -0.13941727 0.13941727 23.517483 + 45000 302.211 -0.19589892 0.19589892 23.704043 + 50000 281.64939 -0.18057298 0.18057298 23.542137 + 55000 274.90565 -0.15453379 0.15453379 23.734347 + 60000 290.70459 -0.27977436 0.27977436 23.835365 + 65000 293.42241 -0.2454241 0.2454241 23.59269 + 70000 295.20229 -0.041314995 0.041314995 23.73856 + 75000 297.79519 -0.11231755 0.11231755 23.57262 + 80000 285.17858 -0.070796508 0.070796508 23.817135 + 85000 311.71609 -0.068920177 0.068920177 23.861127 + 90000 287.80446 -0.19183387 0.19183387 23.369393 + 95000 309.43345 -0.15238671 0.15238671 23.597792 + 100000 294.12422 -0.14284353 0.14284353 23.526286 +Loop time of 876.546 on 4 procs for 100000 steps with 726 atoms -Performance: 29.277 ns/day, 0.820 hours/ns, 169.425 timesteps/s, 123.003 katom-step/s -72.5% CPU use with 4 MPI tasks x no OpenMP threads +Performance: 19.714 ns/day, 1.217 hours/ns, 114.084 timesteps/s, 82.825 katom-step/s +98.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 | 57.391 | 75.867 | 96.292 | 212.1 | 12.85 -Bond | 0.10177 | 0.11042 | 0.12415 | 2.7 | 0.02 -Kspace | 102.79 | 123.16 | 141.5 | 165.7 | 20.87 -Neigh | 12.808 | 12.895 | 12.982 | 2.3 | 2.18 -Comm | 18.885 | 19.973 | 21.064 | 24.0 | 3.38 -Output | 0.0022573 | 0.0022749 | 0.0023225 | 0.1 | 0.00 -Modify | 355.89 | 356.74 | 357.61 | 4.2 | 60.44 -Other | | 1.478 | | | 0.25 +Pair | 123.63 | 171.23 | 215.73 | 336.6 | 19.53 +Bond | 0.068261 | 0.075883 | 0.081822 | 1.9 | 0.01 +Kspace | 187.59 | 231.71 | 279.01 | 287.1 | 26.43 +Neigh | 29.28 | 29.462 | 29.637 | 2.5 | 3.36 +Comm | 12.544 | 13.731 | 14.929 | 29.1 | 1.57 +Output | 0.0010182 | 0.0014585 | 0.0016071 | 0.7 | 0.00 +Modify | 428.74 | 429.25 | 429.74 | 2.3 | 48.97 +Other | | 1.092 | | | 0.12 -Nlocal: 181.5 ave 207 max 169 min -Histogram: 2 0 1 0 0 0 0 0 0 1 -Nghost: 1961.5 ave 1984 max 1926 min -Histogram: 1 0 0 0 0 0 1 0 1 1 -Neighs: 30051 ave 41646 max 20775 min -Histogram: 1 1 0 0 0 0 1 0 0 1 +Nlocal: 181.5 ave 195 max 166 min +Histogram: 1 1 0 0 0 0 0 0 0 2 +Nghost: 1955.5 ave 1978 max 1931 min +Histogram: 1 0 0 0 1 0 1 0 0 1 +Neighs: 30343 ave 39847 max 20428 min +Histogram: 2 0 0 0 0 0 0 0 0 2 -Total # of neighbors = 120204 -Ave neighs/atom = 165.57025 +Total # of neighbors = 121372 +Ave neighs/atom = 167.17906 Ave special neighs/atom = 1.7355372 -Neighbor list builds = 7663 +Neighbor list builds = 7698 Dangerous builds = 0 write_data "data.piston.final" System init for write_data ... @@ -214,11 +221,11 @@ PPPM/electrode initialization ... G vector (1/distance) = 0.32814871 grid = 12 15 36 stencil order = 5 - estimated absolute RMS force accuracy = 0.029311028 - estimated relative force accuracy = 8.8269289e-05 - using double precision MKL FFT + estimated absolute RMS force accuracy = 0.029310954 + estimated relative force accuracy = 8.8269069e-05 + using double precision FFTW3 3d grid and FFT values/proc = 8512 2880 Generated 6 of 6 mixed pair_coeff terms from arithmetic mixing rule -Average conjugate gradient steps: 1.982 -Total wall time: 0:09:50 +Average conjugate gradient steps: 1.981 +Total wall time: 0:14:36 From 37f32330404a80c674470596cb3d2c42ce31385f Mon Sep 17 00:00:00 2001 From: Ludwig Ahrens-Iwers Date: Thu, 13 Jun 2024 17:14:13 +0200 Subject: [PATCH 090/158] Check the atom style has an atom map --- src/ELECTRODE/fix_electrode_conp.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/ELECTRODE/fix_electrode_conp.cpp b/src/ELECTRODE/fix_electrode_conp.cpp index 94c085de5c..14cc8fb119 100644 --- a/src/ELECTRODE/fix_electrode_conp.cpp +++ b/src/ELECTRODE/fix_electrode_conp.cpp @@ -79,6 +79,9 @@ FixElectrodeConp::FixElectrodeConp(LAMMPS *lmp, int narg, char **arg) : potential_i(nullptr), potential_iele(nullptr) { if (lmp->citeme) lmp->citeme->add(cite_fix_electrode); + if (!atom->map_style) + error->all(FLERR, + "Atom style does not have an atom map. Use 'atom_modify map yes' to activate it."); // fix.h output flags scalar_flag = 1; vector_flag = 1; From 4bb71195aa8157cbdd49ac80546f0e93318c63f4 Mon Sep 17 00:00:00 2001 From: Ludwig Ahrens-Iwers Date: Wed, 26 Jun 2024 12:08:45 +0200 Subject: [PATCH 091/158] Allow NULL for eta in fix electrode --- doc/src/fix_electrode.rst | 2 +- examples/PACKAGES/electrode/madelung/in.eta_cg | 2 +- examples/PACKAGES/electrode/madelung/in.eta_mix | 2 +- src/ELECTRODE/fix_electrode_conp.cpp | 17 +++++++++-------- 4 files changed, 12 insertions(+), 11 deletions(-) diff --git a/doc/src/fix_electrode.rst b/doc/src/fix_electrode.rst index 3759ff23ca..1a28f88bc1 100644 --- a/doc/src/fix_electrode.rst +++ b/doc/src/fix_electrode.rst @@ -38,7 +38,7 @@ Syntax *electrode/thermo* args = potential eta *temp* values potential = electrode potential charge = electrode charge - eta = reciprocal width of electrode charge smearing + eta = reciprocal width of electrode charge smearing (can be NULL if eta keyword is used) *temp* values = T_v tau_v rng_v T_v = temperature of thermo-potentiostat tau_v = time constant of thermo-potentiostat diff --git a/examples/PACKAGES/electrode/madelung/in.eta_cg b/examples/PACKAGES/electrode/madelung/in.eta_cg index 5ac8cddf17..c36f56bd82 100644 --- a/examples/PACKAGES/electrode/madelung/in.eta_cg +++ b/examples/PACKAGES/electrode/madelung/in.eta_cg @@ -8,7 +8,7 @@ thermo_style custom step pe c_qbot c_qtop fix feta all property/atom d_eta ghost on set group bot d_eta 0.5 set group top d_eta 3.0 -fix conp bot electrode/conp 0 2 couple top 1 symm on eta d_eta algo cg 1e-6 +fix conp bot electrode/conp 0 NULL couple top 1 symm on eta d_eta algo cg 1e-6 run 0 diff --git a/examples/PACKAGES/electrode/madelung/in.eta_mix b/examples/PACKAGES/electrode/madelung/in.eta_mix index d00e008fa4..3176dddcf8 100644 --- a/examples/PACKAGES/electrode/madelung/in.eta_mix +++ b/examples/PACKAGES/electrode/madelung/in.eta_mix @@ -8,7 +8,7 @@ thermo_style custom step pe c_qbot c_qtop fix feta all property/atom d_eta ghost on set group bot d_eta 0.5 set group top d_eta 3.0 -fix conp bot electrode/conp 0 2 couple top 1 symm on eta d_eta write_inv inv.csv write_vec vec.csv +fix conp bot electrode/conp 0 NULL couple top 1 symm on eta d_eta write_inv inv.csv write_vec vec.csv run 0 diff --git a/src/ELECTRODE/fix_electrode_conp.cpp b/src/ELECTRODE/fix_electrode_conp.cpp index 14cc8fb119..a4b9d5b3b9 100644 --- a/src/ELECTRODE/fix_electrode_conp.cpp +++ b/src/ELECTRODE/fix_electrode_conp.cpp @@ -126,7 +126,8 @@ FixElectrodeConp::FixElectrodeConp(LAMMPS *lmp, int narg, char **arg) : } else group_psi_const[0] = utils::numeric(FLERR, arg[3], false, lmp); char *eta_str = arg[4]; - eta = utils::numeric(FLERR, eta_str, false, lmp); + bool etanull = (strcmp(eta_str, "NULL") == 0); + if (!etanull) eta = utils::numeric(FLERR, eta_str, false, lmp); int iarg = 5; while (iarg < narg) { if ((strcmp(arg[iarg], "couple") == 0)) { @@ -217,7 +218,7 @@ FixElectrodeConp::FixElectrodeConp(LAMMPS *lmp, int narg, char **arg) : qtotal_var_style = VarStyle::CONST; } } else if ((strcmp(arg[iarg], "eta") == 0)) { - if (iarg + 2 > narg) error->all(FLERR, "Need two arguments after eta command"); + if (iarg + 2 > narg) error->all(FLERR, "Need one argument after eta command"); etaflag = true; int is_double, cols, ghost; eta_index = atom->find_custom_ghost(arg[++iarg] + 2, is_double, cols, ghost); @@ -243,6 +244,7 @@ FixElectrodeConp::FixElectrodeConp(LAMMPS *lmp, int narg, char **arg) : if (qtotal_var_style != VarStyle::UNSET) { if (symm) error->all(FLERR, "{} cannot use qtotal keyword with symm on", this->style); } + if (etanull && !etaflag) error->all(FLERR, "If eta is NULL the eta keyword must be used"); // computatonal potential group_psi = std::vector(groups.size()); @@ -430,12 +432,11 @@ void FixElectrodeConp::init() } if (comm->me == 0) for (char *fix_id : integrate_ids) - error->warning( - FLERR, - "Electrode atoms are integrated by fix {}, but fix electrode is using a matrix method. " - "For " - "mobile electrodes use the conjugate gradient algorithm without matrix ('algo cg').", - fix_id); + error->warning(FLERR, + "Electrode atoms are integrated by fix {}, but fix electrode is using a " + "matrix method. For mobile electrodes use the conjugate gradient algorithm " + "without matrix ('algo cg').", + fix_id); } // check for package intel From 3c0eaf6870d59e72a81191f50a7198b160af45be Mon Sep 17 00:00:00 2001 From: jtclemm Date: Thu, 27 Jun 2024 16:57:53 -0600 Subject: [PATCH 092/158] Moving stress calculation to rheo/prop/atom --- doc/src/compute_rheo_property_atom.rst | 53 +++--- src/RHEO/compute_rheo_property_atom.cpp | 221 +++++++++++++++++------- src/RHEO/compute_rheo_property_atom.h | 8 +- src/RHEO/pair_rheo.cpp | 19 +- src/bond_hybrid.cpp | 2 +- src/pair.cpp | 102 ----------- src/pair.h | 2 - 7 files changed, 202 insertions(+), 205 deletions(-) diff --git a/doc/src/compute_rheo_property_atom.rst b/doc/src/compute_rheo_property_atom.rst index a7e1bff383..861fd04688 100644 --- a/doc/src/compute_rheo_property_atom.rst +++ b/doc/src/compute_rheo_property_atom.rst @@ -17,13 +17,11 @@ Syntax .. parsed-literal:: possible attributes = phase, surface, surface/r, - surface/divr, surface/n/x, surface/n/y, - surface/n/z, coordination, cv, shift/v/x, - shift/v/y, shift/v/z, energy, temperature, heatflow, - conductivity, cv, viscosity, pressure, - rho, grad/v/xx, grad/v/xy, grad/v/xz, - grad/v/yx, grad/v/yy/, grad/v/yz, grad/v/zx, - grad/v/zy, grad/v/zz + surface/divr, surface/n/:math:`\alpha`, coordination, + shift/v/:math:`\alpha`, energy, temperature, heatflow, + conductivity, cv, viscosity, pressure, rho, + grad/v/:math:`\alpha \beta`, stress/v/:math:`\alpha \beta`, + stress/t/:math:`\alpha \beta`, nbond/shell .. parsed-literal:: @@ -31,9 +29,9 @@ Syntax *surface* = atom surface status *surface/r* = atom distance from the surface *surface/divr* = divergence of position at atom position - *surface/n/\** = surface normal vector + *surface/n/:math:`\alpha`* = surface normal vector *coordination* = coordination number - *shift/v/\** = atom shifting velocity + *shift/v/:math:`\alpha`* = atom shifting velocity *energy* = atom energy *temperature* = atom temperature *heatflow* = atom heat flow @@ -42,7 +40,9 @@ Syntax *viscosity* = atom viscosity *pressure* = atom pressure *rho* = atom density - *grad/v/\** = atom velocity gradient + *grad/v/:math:`\alpha \beta`* = atom velocity gradient + *stress/v/:math:`\alpha \beta`* = atom viscous stress + *stress/t/:math:`\alpha \beta`* = atom total stress (pressure and viscous) *nbond/shell* = number of oxide bonds Examples @@ -50,8 +50,8 @@ Examples .. code-block:: LAMMPS - compute 1 all rheo/property/atom phase surface/r pressure - compute 2 all rheo/property/atom shift/v/x grad/v/xx + compute 1 all rheo/property/atom phase surface/r surface/n/* pressure + compute 2 all rheo/property/atom shift/v/x grad/v/xx stress/v/* Description """"""""""" @@ -68,6 +68,17 @@ computes as inputs. See for example, the :doc:`fix ave/chunk `, and :doc:`atom-style variable ` commands. +For vector attributes, e.g. *shift/v/:math:`\alpha`*, one must specify +:math:`\alpha` as the *x*, *y*, or *z* component, e.g. *shift/v/x*. +Alternatively, a wild card \* will include all components, *x* and *y* in +2D or *x*, *y*, and *z* in 3D. + +For tensor attributes, e.g. *grad/v/:math:`\alpha \beta`*, one must specify +both :math:`\alpha` and :math:`\beta` as *x*, *y*, or *z*, e.g. *grad/v/xy*. +Alternatively, a wild card \* will include all components. In 2D, this +includes *xx*, *xy*, *yx*, and *yy*. In 3D, this includes *xx*, *xy*, *xz*, +*yx*, *yy*, *yz*, *zx*, *zy*, and *zz*. + Many properties require their respective fixes, listed below in related commands, be defined. For instance, the *viscosity* attribute is the viscosity of a particle calculated by @@ -85,19 +96,12 @@ distance from the surface, up to the kernel cutoff length. Surface particles have a value of 0. The *surface/n* properties are the components of the surface normal vector. -The *shift/v* properties are the components of the shifting velocity +The *shift/v/:math:`\alpha`* properties are the components of the shifting velocity produced by the *shift* option of :doc:`fix rheo `. -The *surface/n/\** and *shift/v/\** attributes are vectors that require -specification of the *x*, *y*, or *z* component, e.g. *surface/n/x*. - The *nbond/shell* property is the number of shell bonds that have been activated from :doc:`bond style rheo/shell `. -The *grad/v/\** attribute is a tensor and requires specification of -the *xx*, *yy*, *zz*, *xy*, *xz*, *yx*, *yz*, *zx*, or *zy* component, -e.g. *grad/v/xy*. - The values are stored in a per-atom vector or array as discussed below. Zeroes are stored for atoms not in the specified group or for quantities that are not defined for a particular particle in the group @@ -109,9 +113,12 @@ This compute calculates a per-atom vector or per-atom array depending on the number of input values. If a single input is specified, a per-atom vector is produced. If two or more inputs are specified, a per-atom array is produced where the number of columns = the number of -inputs. The vector or array can be accessed by any command that uses -per-atom values from a compute as input. See the :doc:`Howto output -` page for an overview of LAMMPS output options. +inputs. If a wild card \* is used for a vector or tensor, then the number +of inputs is considered to be incremented by the dimensiod or dimension +squared, respectively. The vector or array can be accessed by any command +that uses per-atom values from a compute as input. See the +:doc:`Howto output ` page for an overview of LAMMPS output +options. The vector or array values will be in whatever :doc:`units ` the corresponding attribute is in (e.g., density units for *rho*). diff --git a/src/RHEO/compute_rheo_property_atom.cpp b/src/RHEO/compute_rheo_property_atom.cpp index d6d8c2a07a..533822bbdd 100644 --- a/src/RHEO/compute_rheo_property_atom.cpp +++ b/src/RHEO/compute_rheo_property_atom.cpp @@ -53,7 +53,26 @@ ComputeRHEOPropertyAtom::ComputeRHEOPropertyAtom(LAMMPS *lmp, int narg, char **a if (narg < 4) utils::missing_cmd_args(FLERR, "compute property/atom", error); peratom_flag = 1; - nvalues = narg - 3; + int dim = domain->dimension; + + // Determine number of values + nvalues = 0; + for (int iarg = 3; iarg < narg; iarg++) { + if (strcmp(arg[iarg], "surface/n/*") == 0) { + nvalues += dim; + } else if (strcmp(arg[iarg], "shift/v/*") == 0) { + nvalues += dim; + } else if (strcmp(arg[iarg], "grad/v/*") == 0) { + nvalues += dim * dim; + } else if (strcmp(arg[iarg], "stress/v/*") == 0) { + nvalues += dim * dim; + } else if (strcmp(arg[iarg], "stress/t/*") == 0) { + nvalues += dim * dim; + } else { + nvalues += 1; + } + } + if (nvalues == 1) size_peratom_cols = 0; else size_peratom_cols = nvalues; @@ -66,11 +85,11 @@ ComputeRHEOPropertyAtom::ComputeRHEOPropertyAtom(LAMMPS *lmp, int narg, char **a pack_choice = new FnPtrPack[nvalues]; avec_index = new int[nvalues]; col_index = new int[nvalues]; + col_t_index = new int[nvalues]; - int i; + int i = 0; + int index, a, b; for (int iarg = 3; iarg < narg; iarg++) { - i = iarg-3; - if (strcmp(arg[iarg], "phase") == 0) { pack_choice[i] = &ComputeRHEOPropertyAtom::pack_phase; } else if (strcmp(arg[iarg], "rho") == 0) { @@ -87,10 +106,6 @@ ComputeRHEOPropertyAtom::ComputeRHEOPropertyAtom(LAMMPS *lmp, int narg, char **a } else if (strcmp(arg[iarg], "surface/divr") == 0) { surface_flag = 1; pack_choice[i] = &ComputeRHEOPropertyAtom::pack_surface_divr; - } else if (utils::strmatch(arg[iarg], "^surface/n")) { - surface_flag = 1; - pack_choice[i] = &ComputeRHEOPropertyAtom::pack_surface_n; - col_index[i] = get_vector_index(arg[iarg]); } else if (strcmp(arg[iarg], "coordination") == 0) { pack_choice[i] = &ComputeRHEOPropertyAtom::pack_coordination; } else if (strcmp(arg[iarg], "pressure") == 0) { @@ -101,13 +116,18 @@ ComputeRHEOPropertyAtom::ComputeRHEOPropertyAtom(LAMMPS *lmp, int narg, char **a } else if (strcmp(arg[iarg], "cv") == 0) { thermal_flag = 1; pack_choice[i] = &ComputeRHEOPropertyAtom::pack_cv; - } else if (utils::strmatch(arg[iarg], "^shift/v")) { + } else if (utils::strmatch(arg[iarg], "^surface/n/")) { + surface_flag = 1; + i += add_vector_component(arg[iarg], i, &ComputeRHEOPropertyAtom::pack_surface_n) - 1; + } else if (utils::strmatch(arg[iarg], "^shift/v/")) { shift_flag = 1; - pack_choice[i] = &ComputeRHEOPropertyAtom::pack_shift_v; - col_index[i] = get_vector_index(arg[iarg]); - } else if (utils::strmatch(arg[iarg], "^grad/v")) { - pack_choice[i] = &ComputeRHEOPropertyAtom::pack_gradv; - col_index[i] = get_tensor_index(arg[iarg]); + i += add_vector_component(arg[iarg], i, &ComputeRHEOPropertyAtom::pack_shift_v) - 1; + } else if (utils::strmatch(arg[iarg], "^grad/v/")) { + i += add_tensor_component(arg[iarg], i, &ComputeRHEOPropertyAtom::pack_gradv) - 1; + } else if (utils::strmatch(arg[iarg], "^stress/v/")) { + i += add_tensor_component(arg[iarg], i, &ComputeRHEOPropertyAtom::pack_viscous_stress) - 1; + } else if (utils::strmatch(arg[iarg], "^stress/t/")) { + i += add_tensor_component(arg[iarg], i, &ComputeRHEOPropertyAtom::pack_total_stress) - 1; } else if (strcmp(arg[iarg], "energy") == 0) { avec_index[i] = atom->avec->property_atom("esph"); if (avec_index[i] < 0) @@ -131,6 +151,7 @@ ComputeRHEOPropertyAtom::ComputeRHEOPropertyAtom(LAMMPS *lmp, int narg, char **a if (strcmp(arg[iarg], "heatflow") == 0) thermal_flag = 1; if (strcmp(arg[iarg], "conductivity") == 0) thermal_flag = 1; } + i++; } nmax = 0; @@ -143,6 +164,7 @@ ComputeRHEOPropertyAtom::~ComputeRHEOPropertyAtom() delete[] pack_choice; delete[] avec_index; delete[] col_index; + delete[] col_t_index; memory->destroy(vector_atom); memory->destroy(array_atom); } @@ -413,6 +435,56 @@ void ComputeRHEOPropertyAtom::pack_viscosity(int n) /* ---------------------------------------------------------------------- */ +void ComputeRHEOPropertyAtom::pack_viscous_stress(int n) +{ + double **gradv = compute_grad->gradv; + double *viscosity = atom->viscosity; + int *mask = atom->mask; + int nlocal = atom->nlocal; + int index = col_index[n]; + int dim = domain->dimension; + int a = index / dim; + int b = index % dim; + int index_transpose = b * dim + a; + + for (int i = 0; i < nlocal; i++) { + if (mask[i] & groupbit) buf[n] = viscosity[i] * (gradv[i][index] + gradv[i][index_transpose]); + else buf[n] = 0.0; + n += nvalues; + } +} + +/* ---------------------------------------------------------------------- */ + +void ComputeRHEOPropertyAtom::pack_total_stress(int n) +{ + double **gradv = compute_grad->gradv; + double *viscosity = atom->viscosity; + double *rho = atom->rho; + int *type = atom->type; + int *mask = atom->mask; + int nlocal = atom->nlocal; + int index = col_index[n]; + int dim = domain->dimension; + int a = index / dim; + int b = index % dim; + int index_transpose = b * dim + a; + double p; + + for (int i = 0; i < nlocal; i++) { + if (mask[i] & groupbit) { + if (index == index_transpose) + p = fix_pressure->calc_pressure(rho[i], type[i]); + else + p = 0.0; + buf[n] = viscosity[i] * (gradv[i][index] + gradv[i][index_transpose]) + p; + } else buf[n] = 0.0; + n += nvalues; + } +} + +/* ---------------------------------------------------------------------- */ + void ComputeRHEOPropertyAtom::pack_nbond_shell(int n) { int *nbond = fix_oxidation->nbond; @@ -467,63 +539,92 @@ void ComputeRHEOPropertyAtom::pack_atom_style(int n) /* ---------------------------------------------------------------------- */ -int ComputeRHEOPropertyAtom::get_tensor_index(char* option) +int ComputeRHEOPropertyAtom::add_tensor_component(char* option, int i, FnPtrPack pack_function) { - int index; + int shift; int dim = domain->dimension; - int dim_error = 0; - - if (utils::strmatch(option, "xx$")) { - index = 0; - } else if (utils::strmatch(option, "xy$")) { - index = 1; - } else if (utils::strmatch(option, "xz$")) { - index = 2; - if (dim == 2) dim_error = 1; - } else if (utils::strmatch(option, "yx$")) { - if (dim == 2) index = 2; - else index = 3; - } else if (utils::strmatch(option, "yy$")) { - if (dim == 2) index = 3; - else index = 4; - } else if (utils::strmatch(option, "yz$")) { - index = 5; - if (dim == 2) dim_error = 1; - } else if (utils::strmatch(option, "zx$")) { - index = 6; - if (dim == 2) dim_error = 1; - } else if (utils::strmatch(option, "zy$")) { - index = 7; - if (dim == 2) dim_error = 1; - } else if (utils::strmatch(option, "zz$")) { - index = 8; - if (dim == 2) dim_error = 1; + if (((std::string) option).back() == '*') { + for (int a = 0; a < dim; a++) { + for (int b = 0; b < dim; b++) { + pack_choice[i + a * dim + b] = pack_function; + col_index[i + a * dim + b] = a * dim + b; + } + } + shift = dim * dim; } else { - error->all(FLERR, "Invalid compute rheo/property/atom property {}", option); + int index; + int dim_error = 0; + + if (utils::strmatch(option, "xx$")) { + index = 0; + } else if (utils::strmatch(option, "xy$")) { + index = 1; + } else if (utils::strmatch(option, "xz$")) { + index = 2; + if (dim == 2) dim_error = 1; + } else if (utils::strmatch(option, "yx$")) { + if (dim == 2) index = 2; + else index = 3; + } else if (utils::strmatch(option, "yy$")) { + if (dim == 2) index = 3; + else index = 4; + } else if (utils::strmatch(option, "yz$")) { + index = 5; + if (dim == 2) dim_error = 1; + } else if (utils::strmatch(option, "zx$")) { + index = 6; + if (dim == 2) dim_error = 1; + } else if (utils::strmatch(option, "zy$")) { + index = 7; + if (dim == 2) dim_error = 1; + } else if (utils::strmatch(option, "zz$")) { + index = 8; + if (dim == 2) dim_error = 1; + } else { + error->all(FLERR, "Invalid compute rheo/property/atom property {}", option); + } + + if (dim_error) + error->all(FLERR, "Invalid compute rheo/property/atom property {} in 2D", option); + + pack_choice[i] = pack_function; + col_index[i] = index; + shift = 1; } - if (dim_error) - error->all(FLERR, "Invalid compute rheo/property/atom property {} in 2D", option); - - return index; + return shift; } /* ---------------------------------------------------------------------- */ -int ComputeRHEOPropertyAtom::get_vector_index(char* option) +int ComputeRHEOPropertyAtom::add_vector_component(char* option, int i, FnPtrPack pack_function) { - int index; - if (utils::strmatch(option, "x$")) { - index = 0; - } else if (utils::strmatch(option, "y$")) { - index = 1; - } else if (utils::strmatch(option, "z$")) { - if (domain->dimension == 2) - error->all(FLERR, "Invalid compute rheo/property/atom property {} in 2D", option); - index = 2; + int shift; + int dim = domain->dimension; + if (((std::string) option).back() == '*') { + for (int a = 0; a < dim; a++) { + pack_choice[i + a] = pack_function; + col_index[i + a] = a; + } + shift = dim; } else { - error->all(FLERR, "Invalid compute rheo/property/atom property {}", option); + int index; + if (utils::strmatch(option, "x$")) { + index = 0; + } else if (utils::strmatch(option, "y$")) { + index = 1; + } else if (utils::strmatch(option, "z$")) { + if (dim == 2) + error->all(FLERR, "Invalid compute rheo/property/atom property {} in 2D", option); + index = 2; + } else { + error->all(FLERR, "Invalid compute rheo/property/atom property {}", option); + } + + pack_choice[i] = pack_function; + col_index[i] = index; + shift = 1; } - return index; + return shift; } diff --git a/src/RHEO/compute_rheo_property_atom.h b/src/RHEO/compute_rheo_property_atom.h index a61455f0c5..b3d247b102 100644 --- a/src/RHEO/compute_rheo_property_atom.h +++ b/src/RHEO/compute_rheo_property_atom.h @@ -38,7 +38,7 @@ class ComputeRHEOPropertyAtom : public Compute { int pressure_flag, thermal_flag, interface_flag; int surface_flag, shift_flag, shell_flag; int *avec_index; - int *col_index; + int *col_index, *col_t_index; double *buf; typedef void (ComputeRHEOPropertyAtom::*FnPtrPack)(int); @@ -57,11 +57,13 @@ class ComputeRHEOPropertyAtom : public Compute { void pack_gradv(int); void pack_pressure(int); void pack_viscosity(int); + void pack_viscous_stress(int); + void pack_total_stress(int); void pack_nbond_shell(int); void pack_atom_style(int); - int get_vector_index(char*); - int get_tensor_index(char*); + int add_vector_component(char*, int, FnPtrPack); + int add_tensor_component(char*, int, FnPtrPack); class FixRHEO *fix_rheo; class FixRHEOPressure *fix_pressure; diff --git a/src/RHEO/pair_rheo.cpp b/src/RHEO/pair_rheo.cpp index 0a52bd53bc..f206512950 100644 --- a/src/RHEO/pair_rheo.cpp +++ b/src/RHEO/pair_rheo.cpp @@ -306,13 +306,9 @@ void PairRHEO::compute(int eflag, int vflag) f[i][1] += ft[1]; f[i][2] += ft[2]; - if (evflag) { - fnorm = dot3(ft, dx) * rinv * rinv * 0.5; - ftang[0] = ft[0] * 0.5 - dx[0] * fnorm; - ftang[1] = ft[1] * 0.5 - dx[1] * fnorm; - ftang[2] = ft[2] * 0.5 - dx[2] * fnorm; - ev_tally_nt(i, j, nlocal, newton_pair, 0.0, 0.0, fnorm, ftang[0], ftang[1], ftang[2], dx[0], dx[1], dx[2]); - } + // Note the virial's definition is hazy, e.g. viscous contributions will depend on rotation + if (evflag) + ev_tally_xyz(i, j, nlocal, newton_pair, 0.0, 0.0, ft[0], ft[1], ft[2], dx[0], dx[1], dx[2]); if (newton_pair || j < nlocal) { for (a = 0; a < dim; a ++) { @@ -331,13 +327,8 @@ void PairRHEO::compute(int eflag, int vflag) f[j][1] -= ft[1]; f[j][2] -= ft[2]; - if (evflag) { - fnorm = - dot3(ft, dx) * rinv * rinv * 0.5; - ftang[0] = ft[0] * 0.5 + dx[0] * fnorm; - ftang[1] = ft[1] * 0.5 + dx[1] * fnorm; - ftang[2] = ft[2] * 0.5 + dx[2] * fnorm; - ev_tally_nt(i, j, nlocal, newton_pair, 0.0, 0.0, fnorm, ftang[0], ftang[1], ftang[2], -dx[0], -dx[1], -dx[2]); - } + if (evflag) + ev_tally_xyz(i, j, nlocal, newton_pair, 0.0, 0.0, ft[0], ft[1], ft[2], -dx[0], -dx[1], -dx[2]); } if (compute_interface) { diff --git a/src/bond_hybrid.cpp b/src/bond_hybrid.cpp index 555ded4469..1e3e3c66f9 100644 --- a/src/bond_hybrid.cpp +++ b/src/bond_hybrid.cpp @@ -195,7 +195,7 @@ void BondHybrid::deallocate() delete[] maxbond; for (int i = 0; i < nstyles; i++) memory->destroy(bondlist[i]); delete[] bondlist; - for (i = 0; i < nstyles; i++) memory->destroy(orig_map[i]); + for (int i = 0; i < nstyles; i++) memory->destroy(orig_map[i]); delete[] orig_map; } diff --git a/src/pair.cpp b/src/pair.cpp index 896cfda29d..34c8e4978e 100644 --- a/src/pair.cpp +++ b/src/pair.cpp @@ -1247,108 +1247,6 @@ void Pair::ev_tally_xyz(int i, int j, int nlocal, int newton_pair, } } - -/* ---------------------------------------------------------------------- - tally eng_vdwl and virial into global or per-atom accumulators - for virial, have delx,dely,delz and fnormal and ftangential -------------------------------------------------------------------------- */ - -void Pair::ev_tally_nt(int i, int j, int nlocal, int newton_pair, - double evdwl, double ecoul, double fn, - double ftx, double fty, double ftz, - double delx, double dely, double delz) -{ - double evdwlhalf,ecoulhalf,epairhalf,v[6]; - - if (eflag_either) { - if (eflag_global) { - if (newton_pair) { - eng_vdwl += evdwl; - eng_coul += ecoul; - } else { - evdwlhalf = 0.5*evdwl; - ecoulhalf = 0.5*ecoul; - if (i < nlocal) { - eng_vdwl += evdwlhalf; - eng_coul += ecoulhalf; - } - if (j < nlocal) { - eng_vdwl += evdwlhalf; - eng_coul += ecoulhalf; - } - } - } - if (eflag_atom) { - epairhalf = 0.5 * (evdwl + ecoul); - if (newton_pair || i < nlocal) eatom[i] += epairhalf; - if (newton_pair || j < nlocal) eatom[j] += epairhalf; - } - } - - if (vflag_either) { - v[0] = delx*delx*fn; - v[1] = dely*dely*fn; - v[2] = delz*delz*fn; - v[3] = delx*dely*fn; - v[4] = delx*delz*fn; - v[5] = dely*delz*fn; - - v[0] += delx*ftx; - v[1] += dely*fty; - v[2] += delz*ftz; - v[3] += delx*fty + dely*ftx; - v[4] += delx*ftz + delz*ftx; - v[5] += dely*ftz + delz*fty; - - if (vflag_global) { - if (newton_pair) { - virial[0] += v[0]; - virial[1] += v[1]; - virial[2] += v[2]; - virial[3] += v[3]; - virial[4] += v[4]; - virial[5] += v[5]; - } else { - if (i < nlocal) { - virial[0] += 0.5*v[0]; - virial[1] += 0.5*v[1]; - virial[2] += 0.5*v[2]; - virial[3] += 0.5*v[3]; - virial[4] += 0.5*v[4]; - virial[5] += 0.5*v[5]; - } - if (j < nlocal) { - virial[0] += 0.5*v[0]; - virial[1] += 0.5*v[1]; - virial[2] += 0.5*v[2]; - virial[3] += 0.5*v[3]; - virial[4] += 0.5*v[4]; - virial[5] += 0.5*v[5]; - } - } - } - - if (vflag_atom) { - if (newton_pair || i < nlocal) { - vatom[i][0] += 0.5*v[0]; - vatom[i][1] += 0.5*v[1]; - vatom[i][2] += 0.5*v[2]; - vatom[i][3] += 0.5*v[3]; - vatom[i][4] += 0.5*v[4]; - vatom[i][5] += 0.5*v[5]; - } - if (newton_pair || j < nlocal) { - vatom[j][0] += 0.5*v[0]; - vatom[j][1] += 0.5*v[1]; - vatom[j][2] += 0.5*v[2]; - vatom[j][3] += 0.5*v[3]; - vatom[j][4] += 0.5*v[4]; - vatom[j][5] += 0.5*v[5]; - } - } - } -} - /* ---------------------------------------------------------------------- tally eng_vdwl and virial into global or per-atom accumulators for virial, have delx,dely,delz and fx,fy,fz diff --git a/src/pair.h b/src/pair.h index 153250260a..d36b48f340 100644 --- a/src/pair.h +++ b/src/pair.h @@ -297,8 +297,6 @@ class Pair : protected Pointers { void ev_tally_tip4p(int, int *, double *, double, double); void ev_tally_xyz(int, int, int, int, double, double, double, double, double, double, double, double); - void ev_tally_nt(int, int, int, int, double, double, double, double, double, double, double, - double, double); void v_tally2(int, int, double, double *); void v_tally_tensor(int, int, int, int, double, double, double, double, double, double); void virial_fdotr_compute(); From 1326592f237b86730b9988f7ba1dde5733979c12 Mon Sep 17 00:00:00 2001 From: jtclemm Date: Fri, 28 Jun 2024 17:07:23 -0600 Subject: [PATCH 093/158] Proofing RHEO package --- doc/src/Commands_fix.rst | 1 + doc/src/Howto_rheo.rst | 38 +- doc/src/atom_style.rst | 2 +- doc/src/bond_rheo_shell.rst | 47 +- doc/src/bond_style.rst | 1 + doc/src/compute_rheo_property_atom.rst | 43 +- doc/src/fix.rst | 6 +- doc/src/fix_add_heat.rst | 36 +- doc/src/fix_rheo.rst | 74 +- doc/src/fix_rheo_oxidation.rst | 21 +- doc/src/fix_rheo_pressure.rst | 14 +- doc/src/fix_rheo_thermal.rst | 20 +- doc/src/fix_rheo_viscosity.rst | 12 +- doc/src/pair_rheo.rst | 36 +- doc/src/pair_rheo_solid.rst | 6 +- doc/src/pair_style.rst | 2 + examples/rheo/balloon/in.rheo.balloon | 2 +- .../rheo/balloon/log.17Apr2024.balloon.g++.4 | 382 ++++ .../rheo/dam-break/log.17Apr2024.dam.g++.4 | 1694 +++++++++++++++++ examples/rheo/ice-cubes/in.rheo.ice.cubes | 3 +- .../rheo/ice-cubes/log.17Apr2024.ice.g++.4 | 379 ++++ examples/rheo/oxidation/in.rheo.oxidation | 3 +- .../oxidation/log.17Apr2024.oxidation.g++.4 | 488 +++++ examples/rheo/poiseuille/in.rheo.poiseuille | 2 +- .../poiseuille/log.17Apr2024.poiseuille.g++.4 | 288 +++ .../log.17Apr2024.taylor.green.g++.4 | 224 +++ src/BPM/bond_bpm_spring.cpp | 2 - src/BPM/compute_nbond_atom.cpp | 2 +- src/BPM/fix_update_special_bonds.cpp | 2 +- src/RHEO/bond_rheo_shell.cpp | 13 +- src/RHEO/compute_rheo_kernel.cpp | 184 +- src/RHEO/compute_rheo_kernel.h | 2 +- src/RHEO/compute_rheo_surface.cpp | 4 +- src/RHEO/fix_rheo.cpp | 47 +- src/RHEO/fix_rheo.h | 2 +- src/RHEO/fix_rheo_oxidation.cpp | 6 +- src/RHEO/fix_rheo_thermal.cpp | 23 +- src/RHEO/fix_rheo_viscosity.cpp | 1 + src/RHEO/pair_rheo.cpp | 36 +- src/RHEO/pair_rheo.h | 4 +- 40 files changed, 3797 insertions(+), 355 deletions(-) create mode 100644 examples/rheo/balloon/log.17Apr2024.balloon.g++.4 create mode 100644 examples/rheo/dam-break/log.17Apr2024.dam.g++.4 create mode 100644 examples/rheo/ice-cubes/log.17Apr2024.ice.g++.4 create mode 100644 examples/rheo/oxidation/log.17Apr2024.oxidation.g++.4 create mode 100644 examples/rheo/poiseuille/log.17Apr2024.poiseuille.g++.4 create mode 100644 examples/rheo/taylor-green/log.17Apr2024.taylor.green.g++.4 diff --git a/doc/src/Commands_fix.rst b/doc/src/Commands_fix.rst index f2771f0c50..4350a98b31 100644 --- a/doc/src/Commands_fix.rst +++ b/doc/src/Commands_fix.rst @@ -28,6 +28,7 @@ OPT. * :doc:`adapt ` * :doc:`adapt/fep ` * :doc:`addforce ` + * :doc:`add/heat ` * :doc:`addtorque ` * :doc:`alchemy ` * :doc:`amoeba/bitorsion ` diff --git a/doc/src/Howto_rheo.rst b/doc/src/Howto_rheo.rst index 9d70bf074f..4c0f069d92 100644 --- a/doc/src/Howto_rheo.rst +++ b/doc/src/Howto_rheo.rst @@ -2,8 +2,9 @@ Reproducing hydrodynamics and elastic objects (RHEO) ==================================================== The RHEO package is a hybrid implementation of smoothed particle -hydrodynamics (SPH) for fluid flow, coupled to the :doc:`BPM package ` to model -solid elements. RHEO combines these methods to enable mesh-free modeling of multiphase material systems. The SPH solver supports many advanced options +hydrodynamics (SPH) for fluid flow, coupled to the :doc:`BPM package ` +to model solid elements. RHEO combines these methods to enable mesh-free modeling +of multiphase material systems. The SPH solver supports many advanced options including reproducing kernels, particle shifting, free surface identification, and solid surface reconstruction. To model fluid-solid systems, the status of particles can dynamically change between a fluid and solid state, e.g. during @@ -29,9 +30,10 @@ of reproducing kernels). In conjunction to fix rheo, one must specify an instance of :doc:`fix rheo/pressure ` and :doc:`fix rheo/viscosity ` to define a pressure equation of state and viscosity model, respectively. Optionally, one can model -a heat equation with :doc:`fix rheo/thermal`, which also allows the user -to specify equations for a particle's thermal conductivity, specific heat, -latent heat, and melting temperature. The ordering of these fixes in an an input script matters. Fix rheo must be defined prior to all +a heat equation with :doc:`fix rheo/thermal `, which also +allows the user to specify equations for a particle's thermal conductivity, +specific heat, latent heat, and melting temperature. The ordering of these +fixes in an an input script matters. Fix rheo must be defined prior to all other RHEO fixes. Typically, RHEO requires atom style rheo. In addition to typical atom @@ -45,9 +47,9 @@ affect particles. Instead, one should use the *sph/e* attribute. The status variable uses bitmasking to track various properties of a particle such as its current state of matter (fluid or solid) and its location relative to a surface. Some of these properties (and others) can be accessed using -:doc:`compute rheo/property/atom `. The *status* attribute -in :doc:`the set command ` only allows control over the first bit which sets -the state of matter, 0 is fluid and 1 is solid. +:doc:`compute rheo/property/atom `. The *status* +attribute in :doc:`the set command ` only allows control over the first bit +which sets the state of matter, 0 is fluid and 1 is solid. Fluid interactions, including pressure forces, viscous forces, and heat exchange, are calculated using :doc:`pair rheo `. Unlike typical pair styles, @@ -59,18 +61,18 @@ hydrodynamic forces are only calculated if a fluid particle is involved. To model elastic objects, there are currently two mechanisms in RHEO, one designed for bulk solid bodies and the other for thin shells. Both mechanisms rely on -introducing bonded forces between particles and therefore require a hybrid of atom style bond and rheo -(or rheo/thermal). +introducing bonded forces between particles and therefore require a hybrid of atom +style bond and rheo (or rheo/thermal). To create an elastic solid body, one has to (a) change the status of constituent particles to solid (e.g. with the :doc:`set ` command), (b) create bpm bonds between the particles (see the :doc:`bpm howto ` page for more details), and (c) use :doc:`pair rheo/solid ` to apply repulsive contact forces between distinct solid bodies. Akin to pair rheo, -looks at a particles fluid/solid status to determine whether to apply forces. -However, unlike pair rheo, pair rheo/solid does obey special bond settings such -that contact forces do not have to be calculated between two bonded solid particles -in the same elastic body. +pair rheo/solid considers a particles fluid/solid phase to determine whether to +apply forces. However, unlike pair rheo, pair rheo/solid does obey special bond +settings such that contact forces do not have to be calculated between two bonded +solid particles in the same elastic body. In systems with thermal evolution, fix rheo/thermal can optionally set a melting/solidification temperature allowing particles to dynamically swap their @@ -79,9 +81,9 @@ critical temperature, respectively. Using the *react* option, one can specify a bond length and a bond type. Then, when solidifying, particles will search their local neighbors and automatically create bonds with any neighboring solid particles in range. For BPM bond styles, bonds will then use the immediate position of the two -particles to calculate a reference state. When melting, particles will then delete -any bonds of the specified type when reverting to a fluid state. Special bonds are -updated as bonds are created/broken. +particles to calculate a reference state. When melting, particles will delete any +bonds of the specified type when reverting to a fluid state. Special bonds are updated +as bonds are created/broken. The other option for elastic objects is an elastic shell that is nominally much thinner than a particle diameter, e.g. a oxide skin which gradually forms over time @@ -106,7 +108,7 @@ criteria for creating/deleting a bond or altering force calculations). .. _howto_rheo_palermo: -**(Palermo)** Palermo, Clemmer, Wolf, O'Connor, in preparation. +**(Palermo)** Palermo, Wolf, Clemmer, O'Connor, in preparation. .. _howto_rheo_clemmer: diff --git a/doc/src/atom_style.rst b/doc/src/atom_style.rst index 0a3cb642be..2e6a6e1cbe 100644 --- a/doc/src/atom_style.rst +++ b/doc/src/atom_style.rst @@ -194,7 +194,7 @@ the Additional Information section below. - :ref:`RHEO ` - solid and fluid RHEO particles * - *rheo/thermal* - - *atomic* + rho, status, temperature + - *atomic* + rho, status, energy, temperature - :ref:`RHEO ` - RHEO particles with temperature * - *sph* diff --git a/doc/src/bond_rheo_shell.rst b/doc/src/bond_rheo_shell.rst index 3b5cfa6a49..439f88ec8e 100644 --- a/doc/src/bond_rheo_shell.rst +++ b/doc/src/bond_rheo_shell.rst @@ -44,12 +44,11 @@ The *rheo/shell* bond style is designed to work with :doc:`fix rheo/oxidation ` which creates candidate bonds between eligible surface or near-surface particles. When a bond is first created, it computes no forces and starts a timer. Forces are -not computed until the timer reaches the specified bond formation time -and the bond is fully enabled. If the two particles move outside of the -maximum bond distance or move into the bulk before the timer reaches -the formation time, the bond automatically deletes itself. Not that -this deletion does not generate any broken bond data saved to a -*store/local* fix. +not computed until the timer reaches the specified bond formation time, +*t/form*, and the bond is enabled and applies forces. If the two particles +move outside of the maximum bond distance or move into the bulk before +the timer reaches *t/form*, the bond automatically deletes itself. This +deletion is not recorded as a broken bond in the optional *store/local* fix. Before bonds are enabled, they are still treated as regular bonds by all other parts of LAMMPS. This means they are written to data files @@ -60,17 +59,17 @@ To only count enabled bonds, use the *nbond/shell* attribute in When enabled, the bond then computes forces based on deviations from the initial reference state of the two atoms much like a BPM style bond (as further discussed in the :doc:`BPM howto page `). -The reference state is stored by each bond when it is first enabled -the setup of a run. Data is then preserved across run commands and is -written to :doc:`binary restart files ` such that restarting -the system will not reset the reference state of a bond or the timer. +The reference state is stored by each bond when it is first enabled. +Data is then preserved across run commands and is written to +:doc:`binary restart files ` such that restarting the system +will not reset the reference state of a bond or the timer. This bond style is based on a model described in -:ref:`(Clemmer) `. The force has a magnitude of +:ref:`(Clemmer) `. The force has a magnitude of .. math:: - F = 2 k (r - r_0) + \frac{2 * k}{r_0^2 \epsilon_c^2} (r - r_0)^3 + F = 2 k (r - r_0) + \frac{2 k}{r_0^2 \epsilon_c^2} (r - r_0)^3 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 @@ -78,17 +77,15 @@ and :math:`r_0` is the initial distance between the two particles, and 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) `: +A damping force proportional to the difference in the normal velocity +of particles is also applied to bonded particles: .. math:: F_D = - \gamma w (\hat{r} \bullet \vec{v}) where :math:`\gamma` is the damping strength, :math:`\hat{r}` is the -radial normal vector, and :math:`\vec{v}` is the velocity difference +displacement normal vector, and :math:`\vec{v}` is the velocity difference between the two particles. The following coefficients must be defined for each bond type via the @@ -103,7 +100,7 @@ the data file or restart files read by the :doc:`read_data Unlike other BPM-style bonds, this bond style does not update special bond settings when bonds are created or deleted. This bond style also does not enforce specific :doc:`special_bonds ` settings. -This behavior is purposeful such :doc:`RHEO pair forces ` +This behavior is purposeful such :doc:`RHEO pair ` forces and heat flows are still calculated. If the *store/local* keyword is used, an internal fix will track bonds that @@ -162,10 +159,10 @@ the specified attribute. The single() function of this bond style returns 0.0 for the energy of a bonded interaction, since energy is not conserved in these -dissipative potentials. The single() function also calculates an -extra bond quantity, the initial distance :math:`r_0`. This -extra quantity can be accessed by the -:doc:`compute bond/local ` command as *b1*\ . +dissipative potentials. The single() function also calculates two +extra bond quantities, the initial distance :math:`r_0` and a time. +These extra quantities can be accessed by the +:doc:`compute bond/local ` command as *b1* and *b2*\ . Restrictions """""""""""" @@ -186,10 +183,6 @@ NA ---------- -.. _howto_rheo_clemmer: +.. _rheo_clemmer: **(Clemmer)** Clemmer, Pierce, O'Connor, Nevins, Jones, Lechman, Tencer, Appl. Math. Model., 130, 310-326 (2024). - -.. _Groot4: - -**(Groot)** Groot and Warren, J Chem Phys, 107, 4423-35 (1997). diff --git a/doc/src/bond_style.rst b/doc/src/bond_style.rst index 95f463e695..da56fe7fbb 100644 --- a/doc/src/bond_style.rst +++ b/doc/src/bond_style.rst @@ -105,6 +105,7 @@ accelerated styles exist. * :doc:`oxdna2/fene ` - same as oxdna but used with different pair styles * :doc:`oxrna2/fene ` - modified FENE bond suitable for RNA modeling * :doc:`quartic ` - breakable quartic bond +* :doc:`rheo/shell ` - shell bond for oxidation modeling in RHEO * :doc:`special ` - enable special bond exclusions for 1-5 pairs and beyond * :doc:`table ` - tabulated by bond length diff --git a/doc/src/compute_rheo_property_atom.rst b/doc/src/compute_rheo_property_atom.rst index 861fd04688..f34b2225f5 100644 --- a/doc/src/compute_rheo_property_atom.rst +++ b/doc/src/compute_rheo_property_atom.rst @@ -1,7 +1,7 @@ .. index:: compute rheo/property/atom compute rheo/property/atom command -============================= +================================== Syntax """""" @@ -17,11 +17,10 @@ Syntax .. parsed-literal:: possible attributes = phase, surface, surface/r, - surface/divr, surface/n/:math:`\alpha`, coordination, - shift/v/:math:`\alpha`, energy, temperature, heatflow, + surface/divr, surface/n/a, coordination, + shift/v/a, energy, temperature, heatflow, conductivity, cv, viscosity, pressure, rho, - grad/v/:math:`\alpha \beta`, stress/v/:math:`\alpha \beta`, - stress/t/:math:`\alpha \beta`, nbond/shell + grad/v/ab, stress/v/ab, stress/t/ab, nbond/shell .. parsed-literal:: @@ -29,9 +28,9 @@ Syntax *surface* = atom surface status *surface/r* = atom distance from the surface *surface/divr* = divergence of position at atom position - *surface/n/:math:`\alpha`* = surface normal vector + *surface/n/a* = a-component of surface normal vector *coordination* = coordination number - *shift/v/:math:`\alpha`* = atom shifting velocity + *shift/v/a* = a-component of atom shifting velocity *energy* = atom energy *temperature* = atom temperature *heatflow* = atom heat flow @@ -40,9 +39,9 @@ Syntax *viscosity* = atom viscosity *pressure* = atom pressure *rho* = atom density - *grad/v/:math:`\alpha \beta`* = atom velocity gradient - *stress/v/:math:`\alpha \beta`* = atom viscous stress - *stress/t/:math:`\alpha \beta`* = atom total stress (pressure and viscous) + *grad/v/ab* = ab-component of atom velocity gradient tensor + *stress/v/ab* = ab-component of atom viscous stress tensor + *stress/t/ab* = ab-component of atom total stress tensor (pressure and viscous) *nbond/shell* = number of oxide bonds Examples @@ -68,12 +67,12 @@ computes as inputs. See for example, the :doc:`fix ave/chunk `, and :doc:`atom-style variable ` commands. -For vector attributes, e.g. *shift/v/:math:`\alpha`*, one must specify +For vector attributes, e.g. *shift/v/*:math:`\alpha`, one must specify :math:`\alpha` as the *x*, *y*, or *z* component, e.g. *shift/v/x*. Alternatively, a wild card \* will include all components, *x* and *y* in 2D or *x*, *y*, and *z* in 3D. -For tensor attributes, e.g. *grad/v/:math:`\alpha \beta`*, one must specify +For tensor attributes, e.g. *grad/v/*:math:`\alpha \beta`, one must specify both :math:`\alpha` and :math:`\beta` as *x*, *y*, or *z*, e.g. *grad/v/xy*. Alternatively, a wild card \* will include all components. In 2D, this includes *xx*, *xy*, *yx*, and *yy*. In 3D, this includes *xx*, *xy*, *xz*, @@ -93,11 +92,11 @@ the *interface/reconstruct* option of :doc:`fix rheo `. Bulk particles have a value of 0, surface particles have a value of 1, and splash particles have a value of 2. The *surface/r* property is the distance from the surface, up to the kernel cutoff length. Surface particles -have a value of 0. The *surface/n* properties are the components of the -surface normal vector. +have a value of 0. The *surface/n/*:math:`\alpha` properties are the +components of the surface normal vector. -The *shift/v/:math:`\alpha`* properties are the components of the shifting velocity -produced by the *shift* option of :doc:`fix rheo `. +The *shift/v/*:math:`\alpha` properties are the components of the shifting +velocity produced by the *shift* option of :doc:`fix rheo `. The *nbond/shell* property is the number of shell bonds that have been activated from :doc:`bond style rheo/shell `. @@ -110,13 +109,13 @@ Output info """"""""""" This compute calculates a per-atom vector or per-atom array depending -on the number of input values. If a single input is specified, a -per-atom vector is produced. If two or more inputs are specified, a +on the number of input values. Generally, if a single input is specified, +a per-atom vector is produced. If two or more inputs are specified, a per-atom array is produced where the number of columns = the number of -inputs. If a wild card \* is used for a vector or tensor, then the number -of inputs is considered to be incremented by the dimensiod or dimension -squared, respectively. The vector or array can be accessed by any command -that uses per-atom values from a compute as input. See the +inputs. However, if a wild card \* is used for a vector or tensor, then +the number of inputs is considered to be incremented by the dimension or +the dimension squared, respectively. The vector or array can be accessed +by any command that uses per-atom values from a compute as input. See the :doc:`Howto output ` page for an overview of LAMMPS output options. diff --git a/doc/src/fix.rst b/doc/src/fix.rst index 42f7bcff6b..4919c226fd 100644 --- a/doc/src/fix.rst +++ b/doc/src/fix.rst @@ -193,6 +193,7 @@ accelerated styles exist. * :doc:`adapt ` - change a simulation parameter over time * :doc:`adapt/fep ` - enhanced version of fix adapt * :doc:`addforce ` - add a force to each atom +* :doc:`add/heat ` - add a heat flux to each atom * :doc:`addtorque ` - add a torque to a group of atoms * :doc:`alchemy ` - perform an "alchemical transformation" between two partitions * :doc:`amoeba/bitorsion ` - torsion/torsion terms in AMOEBA force field @@ -371,8 +372,9 @@ accelerated styles exist. * :doc:`restrain ` - constrain a bond, angle, dihedral * :doc:`rheo ` - integrator for the RHEO package * :doc:`rheo/thermal ` - thermal integrator for the RHEO package -* :doc:`rheo/pressure ` - pressure derivation for the RHEO package -* :doc:`rheo/viscosity ` - viscosity derivation for the RHEO package +* :doc:`rheo/oxidation ` - create oxidation bonds for the RHEO package +* :doc:`rheo/pressure ` - pressure calculation for the RHEO package +* :doc:`rheo/viscosity ` - viscosity calculation for the RHEO package * :doc:`rhok ` - add bias potential for long-range ordered systems * :doc:`rigid ` - constrain one or more clusters of atoms to move as a rigid body with NVE integration * :doc:`rigid/meso ` - constrain clusters of mesoscopic SPH/SDPD particles to move as a rigid body diff --git a/doc/src/fix_add_heat.rst b/doc/src/fix_add_heat.rst index 2a2d855927..5b67bd4e15 100644 --- a/doc/src/fix_add_heat.rst +++ b/doc/src/fix_add_heat.rst @@ -16,14 +16,14 @@ Syntax .. parsed-literal:: - *constant* args = rate - rate = rate of heat flow (energy/time units) - *linear* args = t_target k - t_target = target temperature (temperature units) - k = prefactor (energy/(time*temperature) units) - *quartic* args = t_target k - t_target = target temperature (temperature units) - k = prefactor (energy/(time*temperature^4) units) + *constant* args = *rate* + *rate* = rate of heat flow (energy/time units) + *linear* args = :math:`T_{target}` *k* + :math:`T_{target}` = target temperature (temperature units) + *k* = prefactor (energy/(time*temperature) units) + *quartic* args = :math:`T_{target}` *k* + :math:`T_{target}` = target temperature (temperature units) + *k* = prefactor (energy/(time*temperature^4) units) * zero or more keyword/value pairs may be appended to args * keyword = *overwrite* @@ -45,7 +45,9 @@ Examples Description """"""""""" -This fix adds heat to particles every timestep. +This fix adds heat to particles with the temperature attribute every timestep. +Note that this is an internal temperature of a particle intended for use with +non-atomistic models like the discrete element method. For the *constant* style, heat is added at the specified rate. For the *linear* style, heat is added at a rate of :math:`k (T_{target} - T)` where :math:`k` is the @@ -62,22 +64,22 @@ determine the rate of heat added. Equal-style variables can specify formulas with various mathematical functions and include :doc:`thermo_style ` command -keywords for the simulation box parameters, time step, and elapsed time. -Thus, it is easy to specify time-dependent heating. +keywords for the simulation box parameters, time step, and elapsed time +to specify time-dependent heating. Atom-style variables can specify the same formulas as equal-style variables but can also include per-atom values, such as atom -coordinates. Thus, it is easy to specify a spatially-dependent heating -field with optional time-dependence as well. +coordinates to specify spatially-dependent heating. -If the *overwrite* keyword is set to *yes*, this fix will effectively set -the total heat flow on a particle, overwriting contributions from pair -styles or other fixes. +If the *overwrite* keyword is set to *yes*, this fix will set the total +heat flow on a particle every timestep, overwriting contributions from pair +styles or other fixes. If *overwrite* is *no*, this fix will add heat on +top of other contributions. ---------- 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. diff --git a/doc/src/fix_rheo.rst b/doc/src/fix_rheo.rst index 978691db41..d69b52d751 100644 --- a/doc/src/fix_rheo.rst +++ b/doc/src/fix_rheo.rst @@ -1,7 +1,7 @@ .. index:: fix rheo fix rheo command -=============== +================ Syntax """""" @@ -38,8 +38,8 @@ Examples .. code-block:: LAMMPS - fix 1 all rheo 1.0 quintic thermal density 0.1 speed/sound 10.0 - fix 1 all rheo 1.0 RK1 shift surface/detection coordination 40 + fix 1 all rheo 3.0 quintic 0 thermal density 0.1 0.1 speed/sound 10.0 1.0 + fix 1 all rheo 3.0 RK1 10 shift surface/detection coordination 40 Description """"""""""" @@ -48,14 +48,15 @@ Description Perform time integration for RHEO particles, updating positions, velocities, and densities. For a detailed breakdown of the integration timestep and -numerical details, see :ref:`(Palermo) `. For an +numerical details, see :ref:`(Palermo) `. For an overview of other features available in the RHEO package, see :doc:`the RHEO howto `. The type of kernel is specified using *kstyle* and the cutoff is *cut*. Four kernels are currently available. The *quintic* kernel is a standard quintic spline function commonly used in SPH. The other options, *RK0*, *RK1*, and -*RK2*, are zeroth, first, and second order reproducing. To generate a reproducing kernel, a particle must have sufficient neighbors inside the +*RK2*, are zeroth, first, and second order reproducing. To generate a +reproducing kernel, a particle must have sufficient neighbors inside the kernel cutoff distance (a coordination number) to accurately calculate moments. This threshold is set by *zmin*. If reproducing kernels are requested but a particle has fewer neighbors, then it will revert to a @@ -81,28 +82,27 @@ surfaces. A modified form of Fickian particle shifting can be enabled with the *shift* keyword. This effectively shifts particle positions to generate a -more uniform spatial distribution. Shifting currently does consider the +more uniform spatial distribution. Shifting currently does not consider the type of a particle and therefore may be inappropriate in systems consisting -of multiple materials. +of multiple fluid phases. In systems with free surfaces, the *surface/detection* keyword can be used to classify the location of particles as being within the bulk fluid, on a free surface, or isolated from other particles in a splash or droplet. -Shifting is then disabled in the direction away from the free surface to -prevent it from diffusing particles away from the bulk fluid. Surface -detection can also be used to control surface-nucleated effects like -oxidation when used in combination with -:doc:`fix rheo/oxidation `. Surface detection is not +Shifting is then disabled in the normal direction away from the free surface +to prevent particles from difusing away. Surface detection can also be used +to control surface-nucleated effects like oxidation when used in combination +with :doc:`fix rheo/oxidation `. Surface detection is not performed on solid bodies. The *surface/detection* keyword takes three arguments: *sdstyle*, *limit*, -and *limi/splash*. The first, *sdstyle*, specifies whether surface particles +and *limit/splash*. The first, *sdstyle*, specifies whether surface particles are identified using a coordination number (*coordination*) or the divergence of the local particle positions (*divergence*). The threshold value for a surface particle for either of these criteria is set by the numerical value of *limit*. Additionally, if a particle's coordination number is too low, i.e. if it has separated off from the bulk in a droplet, it is not possible -to define surfaces and a particle is classified as a splash. The coordination +to define surfaces and the particle is classified as a splash. The coordination threshold for this classification is set by the numerical value of *limit/splash*. @@ -112,23 +112,23 @@ a kernel summation of the masses of neighboring particles by specifying the *rho keyword. The *self/mass* keyword modifies the behavior of the density summation in *rho/sum*. -Typically, the density :math:`\rho` of a particle is calculated as the sum +Typically, the density :math:`\rho` of a particle is calculated as the sum over neighbors .. math:: - \rho_i = \Sum_{j} W_{ij} M_j + \rho_i = \sum_{j} W_{ij} M_j -where the summation is over neighbors, :math:`W_{ij}` is the kernel, and :math:`M_j` -is the mass of particle :math:`j`. The *self/mass* keyword augments this expression -by replacing :math:`M_j` with :math:`M_i`. This may be useful in simulations of -multiple fluid phases with large differences in density, :ref:`(Hu) `. +where :math:`W_{ij}` is the kernel, and :math:`M_j` is the mass of particle :math:`j`. +The *self/mass* keyword augments this expression by replacing :math:`M_j` with +:math:`M_i`. This may be useful in simulations of multiple fluid phases with large +differences in density, :ref:`(Hu) `. -The *density* keyword is used to specify the equilbrium density of each of the N -particle types. It must be followed by N numerical values specifying each -type's equilibrium density *rho0*. +The *density* keyword is used to specify the equilibrium density of each of the N +particle types. It must be followed by N numerical values specifying each type's +equilibrium density *rho0*. The *speed/sound* keyword is used to specify the speed of sound of each of the -N particle types. It must be followed by N numerical values specifying each -type's speed of sound *cs*. +N particle types. It must be followed by N numerical values specifying each type's +speed of sound *cs*. Restart, fix_modify, output, run start/stop, minimize info """"""""""""""""""""""""""""""""""""""""""""""""""""""""""" @@ -144,18 +144,16 @@ the :doc:`run ` command. This fix is not invoked during Restrictions """""""""""" -This fix must be used with atom style rheo or rheo/thermal. -This fix must be used in conjuction with -:doc:`fix rheo/pressure `. and -:doc:`fix rheo/viscosity `, If the *thermal* -setting is used, there must also be an instance of -:doc:`fix rheo/thermal `. The fix group must be -set to all. Only one instance of fix rheo may be defined and it -must be defined prior to all other RHEO fixes. +This fix must be used with atom style rheo or rheo/thermal. This fix must +be used in conjuction with :doc:`fix rheo/pressure `. +and :doc:`fix rheo/viscosity `. If the *thermal* setting +is used, there must also be an instance of +:doc:`fix rheo/thermal `. The fix group must be set to all. +Only one instance of fix rheo may be defined and it must be defined prior +to all other RHEO fixes in the input script. -This fix is part of the RHEO package. It is only enabled if -LAMMPS was built with that package. See the -:doc:`Build package ` page for more info. +This fix is part of the RHEO package. It is only enabled if LAMMPS was built +with that package. See the :doc:`Build package ` page for more info. Related commands """""""""""""""" @@ -173,9 +171,9 @@ Default ---------- -.. _howto_rheo_palermo: +.. _rheo_palermo: -**(Palermo)** Palermo, Clemmer, Wolf, O'Connor, in preparation. +**(Palermo)** Palermo, Wolf, Clemmer, O'Connor, in preparation. .. _fix_rheo_hu: diff --git a/doc/src/fix_rheo_oxidation.rst b/doc/src/fix_rheo_oxidation.rst index 3043291c60..ba3ead3f1f 100644 --- a/doc/src/fix_rheo_oxidation.rst +++ b/doc/src/fix_rheo_oxidation.rst @@ -36,21 +36,21 @@ for use with bond style :doc:`bond rheo/shell `. Every timestep, particles check neighbors within a distance of *cut*. This distance must be smaller than the kernel length defined in :doc:`fix rheo `. Bonds of type *btype* are created between -pairs of particles that satisfy one of two conditions. First, if both -particles are on the fluid surface, or within a distance of *rsurf* -from the surface. Secondly, if one particle is on the fluid surface -and the other bond is solid. This process is further described in -:ref:`(Clemmer) `. +a fluid particle and either a fluid or solid neighbor. The fluid particles +must also be on the fluid surface, or within a distance of *rsurf* from +the surface. This process is further described in +:ref:`(Clemmer) `. If used in conjunction with solid bodies, such as those generated by the *react* option of :doc:`fix rheo/thermal `, -it is recommended that one uses a :doc:`hybrid bond style ` +it is recommended to use a :doc:`hybrid bond style ` with different bond types for solid and oxide bonds. 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 +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 global or per-atom quantities are stored by this fix for access by various :doc:`output commands `. No parameter of this fix can be used with the *start/stop* keywords of @@ -59,11 +59,12 @@ the :doc:`run ` command. This fix is not invoked during :doc:`energy minim Restrictions """""""""""" -This fix must be used with an bond style :doc:`rheo/shell ` +This fix must be used with the bond style :doc:`rheo/shell ` and :doc:`fix rheo ` with surface detection enabled. This fix is part of the RHEO package. It is only enabled if -LAMMPS was built with that package. See the :doc:`Build package ` page for more info. +LAMMPS was built with that package. See the :doc:`Build package ` +page for more info. Related commands """""""""""""""" @@ -79,6 +80,6 @@ none ---------- -.. _howto_rheo_clemmer: +.. _howto_rheo_clemmer2: **(Clemmer)** Clemmer, Pierce, O'Connor, Nevins, Jones, Lechman, Tencer, Appl. Math. Model., 130, 310-326 (2024). diff --git a/doc/src/fix_rheo_pressure.rst b/doc/src/fix_rheo_pressure.rst index f2a994da88..e01aebf90f 100644 --- a/doc/src/fix_rheo_pressure.rst +++ b/doc/src/fix_rheo_pressure.rst @@ -1,7 +1,7 @@ .. index:: fix rheo/pressure fix rheo/pressure command -=============== +========================= Syntax """""" @@ -20,7 +20,7 @@ Syntax *linear* args = none *taitwater* args = none - *cubic* args = cubic term prefactor :math:`A_3` (pressure/density\^2) + *cubic* args = cubic prefactor :math:`A_3` (pressure/density\^2) Examples """""""" @@ -36,8 +36,8 @@ Description .. versionadded:: TBD This fix defines a pressure equation of state for RHEO particles. One can -define different equations of state for different atom types, but an -equation must be specified for every atom type. +define different equations of state for different atom types. An equation +must be specified for every atom type. One first defines the atom *types*. A wild-card asterisk can be used in place of or in conjunction with the *types* argument to set the coefficients for @@ -74,7 +74,8 @@ Style *taitwater* is Tait's equation of state: 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 +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 global or per-atom quantities are stored by this fix for access by various :doc:`output commands `. No parameter of this fix can be used with the *start/stop* keywords of @@ -89,7 +90,8 @@ conjuction with :doc:`fix rheo `. The fix group must be set to all. Only one instance of fix rheo/pressure can be defined. This fix is part of the RHEO package. It is only enabled if -LAMMPS was built with that package. See the :doc:`Build package ` page for more info. +LAMMPS was built with that package. See the :doc:`Build package ` +page for more info. Related commands """""""""""""""" diff --git a/doc/src/fix_rheo_thermal.rst b/doc/src/fix_rheo_thermal.rst index 1ceb1259c0..e116325091 100644 --- a/doc/src/fix_rheo_thermal.rst +++ b/doc/src/fix_rheo_thermal.rst @@ -1,7 +1,7 @@ .. index:: fix rheo/thermal fix rheo/thermal command -=============== +======================== Syntax """""" @@ -50,16 +50,16 @@ Description .. versionadded:: TBD -This fix performs time integration of temperature evolution for atom style -rheo/thermal. In addition, it defines multiple thermal properties of -particles and handles melting/solidification, if applicable. For more details -on phase transitions in RHEO, see :doc:`the RHEO howto `. +This fix performs time integration of temperature for atom style rheo/thermal. +In addition, it defines multiple thermal properties of particles and handles +melting/solidification, if applicable. For more details on phase transitions +in RHEO, see :doc:`the RHEO howto `. Note that the temperature of a particle is always derived from the energy. This implies the *temperature* attribute of :doc:`the set command ` does not affect particles. Instead, one should use the *sph/e* attribute. -For each atom type, one can define attributes for the *conductivity*, +For each atom type, one can define expressions for the *conductivity*, *specific/heat*, *latent/heat*, and critical temperature (*Tfreeze*). The conductivity and specific heat must be defined for all atom types. The latent heat and critical temperature are optional. However, a @@ -88,13 +88,14 @@ types that have a defined value of *Tfreeze*. When a fluid particle's temperature drops below *Tfreeze*, bonds of type *btype* are created between nearby solid particles within a distance of *cut*. The particle's status also swaps to a solid state. When a solid particle's temperature rises above -*Tfreeze*, all bonds of type *btype* are broken and the particle's tatus swaps +*Tfreeze*, all bonds of type *btype* are broken and the particle's status swaps to a fluid state. 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 +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 global or per-atom quantities are stored by this fix for access by various :doc:`output commands `. No parameter of this fix can be used with the *start/stop* keywords of @@ -110,7 +111,8 @@ must be used in conjuction with :doc:`fix rheo ` with the instance of fix rheo/pressure can be defined. This fix is part of the RHEO package. It is only enabled if -LAMMPS was built with that package. See the :doc:`Build package ` page for more info. +LAMMPS was built with that package. See the :doc:`Build package ` +page for more info. Related commands """""""""""""""" diff --git a/doc/src/fix_rheo_viscosity.rst b/doc/src/fix_rheo_viscosity.rst index 8175178787..912de584c2 100644 --- a/doc/src/fix_rheo_viscosity.rst +++ b/doc/src/fix_rheo_viscosity.rst @@ -1,7 +1,7 @@ .. index:: fix rheo/viscosity fix rheo/viscosity command -=============== +========================== Syntax """""" @@ -63,16 +63,16 @@ for the stress :math:`\tau` \tau = \left(\frac{\tau_0}{\dot{\gamma}} + K \dot{\gamma}^{n - 1}\right) \dot{\gamma}, \tau \ge \tau_0 -where :math:`\dot{\gamma}` is the strain rate and :math:`tau_0` is the critical +where :math:`\dot{\gamma}` is the strain rate and :math:`\tau_0` is the critical yield stress, below which :math:`\dot{\gamma} = 0.0`. To avoid divergences, this expression is regularized by defining a critical strain rate *gd0*. If the local strain rate on a particle falls below this limit, a constant viscosity of *eta* is assigned. This implies a value of .. math:: - \tau_0 = \eta * \dot{\gamma}_0 - K \dot{\gamma}_0^N + \tau_0 = \eta \dot{\gamma}_0 - K \dot{\gamma}_0^N -as further discussed in :ref:`(Palermo) `. +as further discussed in :ref:`(Palermo) `. Restart, fix_modify, output, run start/stop, minimize info @@ -112,6 +112,6 @@ none ---------- -.. _howto_rheo_palermo: +.. _rheo_palermo2: -**(Palermo)** Palermo, Clemmer, Wolf, O'Connor, in preparation. +**(Palermo)** Palermo, Wolf, Clemmer, O'Connor, in preparation. diff --git a/doc/src/pair_rheo.rst b/doc/src/pair_rheo.rst index a530444f36..993ec3cee3 100644 --- a/doc/src/pair_rheo.rst +++ b/doc/src/pair_rheo.rst @@ -1,7 +1,7 @@ .. index:: pair_style rheo pair_style rheo command -========================= +======================= Syntax """""" @@ -25,7 +25,7 @@ Examples .. code-block:: LAMMPS - pair_style rheo 1.0 quintic rho/damp 1.0 artificial/visc 2.0 + pair_style rheo 3.0 rho/damp 1.0 artificial/visc 2.0 pair_coeff * * Description @@ -41,22 +41,23 @@ heat exchanged between particles. The *artificial/viscosity* keyword is used to specify the magnitude :math:`\zeta` of an optional artificial viscosity contribution to forces. This factor can help stabilize simulations by smoothing out small length -scale variations in velocity fields. Artificial viscous forces are only -exchanged by fluid particles unless interfaces are not reconstructed in -fix rheo, in which fluid particles will also exchange artificial viscous -forces with solid particles to improve stability. +scale variations in velocity fields. Artificial viscous forces typically +are only exchanged by fluid particles. However, if interfaces are not +reconstructed in fix rheo, fluid particles will also exchange artificial +viscous forces with solid particles to improve stability. The *rho/damp* keyword is used to specify the magnitude :math:`\xi` of an optional pairwise damping term between the density of particles. This factor can help stabilize simulations by smoothing out small length -scale variations in density fields. +scale variations in density fields. However, in systems that develop +a density gradient in equilibrium (e.g. in a hydrostatic column underlying +gravity), this option may be inappropriate. If particles have different viscosities or conductivities, the *harmonic/means* keyword changes how they are averaged before calculating pairwise forces or heat exchanges. By default, an arithmetic averaged is -used, however, a harmonic mean may improve stability in multiphase systems -with large disparities in viscosities. This keyword has no effect on -results if viscosities and conductivities are constant. +used, however, a harmonic mean may improve stability in systems with multiple +fluid phases with large disparities in viscosities. No coefficients are defined for each pair of atoms types via the :doc:`pair_coeff ` command as in the examples @@ -70,16 +71,20 @@ Mixing, shift, table, tail correction, restart, rRESPA info This style does not support the :doc:`pair_modify ` shift, table, and tail options. -This style does not write information to :doc:`binary restart files `. Thus, you need to re-specify the pair_style and -pair_coeff commands in an input script that reads a restart file. +This style does not write information to :doc:`binary restart files `. +Thus, you need to re-specify the pair_style and pair_coeff commands in an input +script that reads a restart file. -This style can only be used via the *pair* keyword of the :doc:`run_style respa ` command. It does not support the *inner*, *middle*, *outer* keywords. +This style can only be used via the *pair* keyword of the +:doc:`run_style respa ` command. It does not support the *inner*, +*middle*, *outer* keywords. Restrictions """""""""""" This fix is part of the RHEO package. It is only enabled if -LAMMPS was built with that package. See the :doc:`Build package ` page for more info. +LAMMPS was built with that package. See the +:doc:`Build package ` page for more info. Related commands """""""""""""""" @@ -93,4 +98,5 @@ Related commands Default """"""" -Density damping and artificial viscous forces are not calculated. Arithmetic means are used for mixing particle properties. +Density damping and artificial viscous forces are not calculated. +Arithmetic means are used for mixing particle properties. diff --git a/doc/src/pair_rheo_solid.rst b/doc/src/pair_rheo_solid.rst index 4bac9b726f..0b1ed47fb8 100644 --- a/doc/src/pair_rheo_solid.rst +++ b/doc/src/pair_rheo_solid.rst @@ -1,7 +1,7 @@ .. index:: pair_style rheo/solid pair_style rheo/solid command -========================= +============================= Syntax """""" @@ -44,7 +44,7 @@ normal velocity of particles F_D = - \gamma w (\hat{r} \bullet \vec{v}) where :math:`\gamma` is the damping strength, :math:`\hat{r}` is the -radial normal vector, :math:`\vec{v}` is the velocity difference +displacement normal vector, :math:`\vec{v}` is the velocity difference between the two particles, and :math:`w` is a smoothing factor. This smoothing factor is constructed such that damping forces go to zero as particles come out of contact to avoid discontinuities. It is @@ -95,7 +95,7 @@ This pair style can only be used via the *pair* keyword of the Restrictions """""""""""" -This pair style is part of the BPM package. It is only enabled if +This pair style is part of the RHEO package. It is only enabled if LAMMPS was built with that package. See the :doc:`Build package ` page for more info. diff --git a/doc/src/pair_style.rst b/doc/src/pair_style.rst index 75157d6127..1cb85ff739 100644 --- a/doc/src/pair_style.rst +++ b/doc/src/pair_style.rst @@ -337,6 +337,8 @@ accelerated styles exist. * :doc:`reaxff ` - ReaxFF potential * :doc:`rebo ` - Second generation REBO potential of Brenner * :doc:`rebomos ` - REBOMoS potential for MoS2 +* :doc:`rheo ` - fluid interactions in RHEO package +* :doc:`rheo/solid ` - solid interactions in RHEO package * :doc:`resquared ` - Everaers RE-Squared ellipsoidal potential * :doc:`saip/metal ` - Interlayer potential for hetero-junctions formed with hexagonal 2D materials and metal surfaces * :doc:`sdpd/taitwater/isothermal ` - Smoothed dissipative particle dynamics for water at isothermal conditions diff --git a/examples/rheo/balloon/in.rheo.balloon b/examples/rheo/balloon/in.rheo.balloon index c82fa39df3..24e400f40f 100644 --- a/examples/rheo/balloon/in.rheo.balloon +++ b/examples/rheo/balloon/in.rheo.balloon @@ -71,5 +71,5 @@ compute nbond all nbond/atom thermo 200 thermo_style custom step time ke press atoms -dump 1 all custom 200 atomDump id type x y vx vy fx fy c_phase c_nbond c_rho +#dump 1 all custom 200 atomDump id type x y vx vy fx fy c_phase c_nbond c_rho run 30000 diff --git a/examples/rheo/balloon/log.17Apr2024.balloon.g++.4 b/examples/rheo/balloon/log.17Apr2024.balloon.g++.4 new file mode 100644 index 0000000000..28fcc4b590 --- /dev/null +++ b/examples/rheo/balloon/log.17Apr2024.balloon.g++.4 @@ -0,0 +1,382 @@ +LAMMPS (17 Apr 2024 - Development - patch_5May2020-18508-g3c0eaf6870-modified) +# ------ 2D water balloon ------ # + +dimension 2 +units lj +atom_style hybrid rheo bond +boundary m m p +comm_modify vel yes +newton off + +region box block -40 40 0 80 -0.01 0.01 units box +create_box 1 box bond/types 1 extra/bond/per/atom 15 extra/special/per/atom 50 +Created orthogonal box = (-40 0 -0.01) to (40 80 0.01) + 2 by 2 by 1 MPI processor grid + +region fluid sphere -10 40 0 30 units box side in +lattice hex 1.0 +Lattice spacing in x,y,z = 1.0745699 1.8612097 1.0745699 +create_atoms 1 region fluid +Created 2830 atoms + using lattice units in orthogonal box = (-40 0 -0.01) to (40 80 0.01) + create_atoms CPU = 0.001 seconds + +region shell sphere -10 40 0 27 units box side out +group shell region shell +544 atoms in group shell + +set group shell rheo/status 1 +Setting atom values ... + 544 settings made for rheo/status +set group all vx 0.005 vy -0.04 +Setting atom values ... + 2830 settings made for vx + 2830 settings made for vy + +# ------ Model parameters ------# + +variable cut equal 3.0 +variable n equal 1.0 +variable rho0 equal 1.0 +variable cs equal 1.0 +variable mp equal ${rho0}/${n} +variable mp equal 1/${n} +variable mp equal 1/1 +variable zeta equal 0.05 +variable kappa equal 0.01*${rho0}/${mp} +variable kappa equal 0.01*1/${mp} +variable kappa equal 0.01*1/1 +variable dt_max equal 0.1*${cut}/${cs}/3 +variable dt_max equal 0.1*3/${cs}/3 +variable dt_max equal 0.1*3/1/3 +variable eta equal 0.05 +variable Cv equal 1.0 +variable L equal 1.0 +variable Tf equal 1.0 + +mass * ${mp} +mass * 1 +timestep 0.1 + +pair_style hybrid/overlay rheo ${cut} artificial/visc ${zeta} rheo/solid +pair_style hybrid/overlay rheo 3 artificial/visc ${zeta} rheo/solid +pair_style hybrid/overlay rheo 3 artificial/visc 0.05 rheo/solid +pair_coeff * * rheo +pair_coeff * * rheo/solid 1.0 1.0 1.0 + +special_bonds lj 0.0 1.0 1.0 coul 0.0 1.0 1.0 +Finding 1-2 1-3 1-4 neighbors ... + special bond factors lj: 0 1 1 + special bond factors coul: 0 1 1 + 0 = max # of 1-2 neighbors + 101 = max # of special neighbors + special bonds CPU = 0.000 seconds +create_bonds many shell shell 1 0 1.5 +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 = 3.3 + ghost atom cutoff = 3.3 + binsize = 1.65, bins = 49 49 1 + 3 neighbor lists, perpetual/occasional/extra = 2 1 0 + (1) command create_bonds, occasional + attributes: full, newton off + pair build: full/bin + stencil: full/bin/2d + bin: standard + (2) pair rheo, perpetual + attributes: half, newton off + pair build: half/bin/newtoff + stencil: full/bin/2d + bin: standard + (3) pair rheo/solid, perpetual, trim from (2) + attributes: half, newton off, cut 1.3 + pair build: trim + stencil: none + bin: none +Added 1263 bonds, new total = 1263 +Finding 1-2 1-3 1-4 neighbors ... + special bond factors lj: 0 1 1 + special bond factors coul: 0 1 1 + 6 = max # of 1-2 neighbors + 101 = max # of special neighbors + special bonds CPU = 0.000 seconds +special_bonds lj 0.0 1.0 1.0 coul 1.0 1.0 1.0 + +bond_style bpm/spring +bond_coeff 1 1.0 1.0 1.0 + +# A lower critical strain allows the balloon to pop +#bond_coeff 1 1.0 0.05 1.0 + +# ------ Drop balloon ------# + +fix 1 all rheo ${cut} quintic 0 shift surface/detection coordination 22 8 +fix 1 all rheo 3 quintic 0 shift surface/detection coordination 22 8 +fix 2 all rheo/viscosity * constant ${eta} +fix 2 all rheo/viscosity * constant 0.05 +fix 3 all rheo/pressure * linear +fix 4 all wall/harmonic ylo EDGE 2.0 1.0 1.0 +fix 5 all enforce2d + +compute rho all rheo/property/atom rho +compute phase all rheo/property/atom phase +compute nbond all nbond/atom + +# ------ Output & Run ------ # + +thermo 200 +thermo_style custom step time ke press atoms + +dump 1 all custom 200 atomDump id type x y vx vy fx fy c_phase c_nbond c_rho +run 30000 + +CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE + +Your simulation uses code contributions which should be cited: + +- BPM bond style: doi:10.1039/D3SM01373A + +@Article{Clemmer2024, + author = {Clemmer, Joel T. and Monti, Joseph M. and Lechman, Jeremy B.}, + title = {A soft departure from jamming: the compaction of deformable + granular matter under high pressures}, + journal = {Soft Matter}, + year = 2024, + volume = 20, + number = 8, + pages = {1702--1718} +} + +- @article{PalermoInPrep, + journal = {in prep}, + title = {RHEO: A Hybrid Mesh-Free Model Framework for Dynamic Multi-Phase Flows}, + year = {2024}, + author = {Eric T. Palermo and Ki T. Wolf and Joel T. Clemmer and Thomas C. O'Connor}, +} + +CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE + +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 = 3.3 + ghost atom cutoff = 3.3 + binsize = 1.65, bins = 49 49 1 + 6 neighbor lists, perpetual/occasional/extra = 6 0 0 + (1) pair rheo, perpetual, half/full from (3) + attributes: half, newton off + pair build: halffull/newtoff + stencil: none + bin: none + (2) pair rheo/solid, perpetual, trim from (1) + attributes: half, newton off, cut 1.3 + pair build: trim + stencil: none + bin: none + (3) compute RHEO/KERNEL, perpetual + attributes: full, newton off + pair build: full/bin + stencil: full/bin/2d + bin: standard + (4) compute RHEO/GRAD, perpetual, copy from (1) + attributes: half, newton off + pair build: copy + stencil: none + bin: none + (5) compute RHEO/VSHIFT, perpetual, copy from (1) + attributes: half, newton off + pair build: copy + stencil: none + bin: none + (6) compute RHEO/SURFACE, perpetual, copy from (1) + attributes: half, newton off + pair build: copy + stencil: none + bin: none +Per MPI rank memory allocation (min/avg/max) = 17.63 | 17.64 | 17.65 Mbytes + Step Time KinEng Press Atoms + 0 0 0.0008125 0.00035927734 2830 + 200 20 0.0008125 0.00035927734 2830 + 400 40 0.0008125 0.00035927734 2830 + 600 60 0.0008125 0.00035927734 2830 + 800 80 0.0008125 0.00035927734 2830 + 1000 100 0.0008125 0.00035927734 2830 + 1200 120 0.0008125 0.00035927734 2830 + 1400 140 0.0008125 0.00035927734 2830 + 1600 160 0.0008125 0.00035927734 2830 + 1800 180 0.0008125 0.00035927734 2830 + 2000 200 0.0008125 0.00035927734 2830 + 2200 220 0.0008125 0.00035927734 2830 + 2400 240 0.00079033569 0.00043037861 2830 + 2600 260 0.0007549229 0.00045188383 2830 + 2800 280 0.00072808836 0.00031695003 2830 + 3000 300 0.0007017958 1.6121754e-05 2830 + 3200 320 0.00067479047 -0.00015725514 2830 + 3400 340 0.00064762254 -0.00023361314 2830 + 3600 360 0.00061960255 -0.00033837679 2830 + 3800 380 0.0005857206 -0.00051770716 2830 + 4000 400 0.00055061733 -0.00070309251 2830 + 4200 420 0.00051884719 -0.0008247795 2830 + 4400 440 0.00049022236 -0.00099918413 2830 + 4600 460 0.00046060011 -0.0010923159 2830 + 4800 480 0.00042900173 -0.0011524571 2830 + 5000 500 0.00039751503 -0.0012586358 2830 + 5200 520 0.00036620054 -0.0013973543 2830 + 5400 540 0.00033130023 -0.0015185231 2830 + 5600 560 0.00030565892 -0.0016159836 2830 + 5800 580 0.00028209836 -0.0016925198 2830 + 6000 600 0.00024695044 -0.0017796892 2830 + 6200 620 0.00021190635 -0.0018706272 2830 + 6400 640 0.0001947093 -0.0019146643 2830 + 6600 660 0.00018903936 -0.0019146199 2830 + 6800 680 0.00017753371 -0.0019390155 2830 + 7000 700 0.00015170593 -0.0020247472 2830 + 7200 720 0.00011509692 -0.0021222209 2830 + 7400 740 7.9861785e-05 -0.0022033181 2830 + 7600 760 6.1350463e-05 -0.0022511971 2830 + 7800 780 6.5269523e-05 -0.0022222806 2830 + 8000 800 8.5709569e-05 -0.0021089664 2830 + 8200 820 0.00011746348 -0.0019351493 2830 + 8400 840 0.00015698134 -0.0017079928 2830 + 8600 860 0.00019758065 -0.0014618965 2830 + 8800 880 0.00023338199 -0.0012365832 2830 + 9000 900 0.00026282353 -0.0010348527 2830 + 9200 920 0.00028604776 -0.00085287884 2830 + 9400 940 0.00030388767 -0.000681122 2830 + 9600 960 0.000317589 -0.00052203521 2830 + 9800 980 0.00032716728 -0.00037501187 2830 + 10000 1000 0.00033270692 -0.00025576132 2830 + 10200 1020 0.00033485986 -0.00016554207 2830 + 10400 1040 0.00033476763 -9.8525417e-05 2830 + 10600 1060 0.00033351922 -5.1166347e-05 2830 + 10800 1080 0.00033161645 -2.0773965e-05 2830 + 11000 1100 0.00032913022 2.2384421e-07 2830 + 11200 1120 0.00032618376 1.2304773e-05 2830 + 11400 1140 0.00032310409 1.3725982e-05 2830 + 11600 1160 0.0003202128 9.0431945e-06 2830 + 11800 1180 0.00031760386 -5.3537879e-07 2830 + 12000 1200 0.00031518884 -1.331708e-05 2830 + 12200 1220 0.00031283958 -3.0838612e-05 2830 + 12400 1240 0.0003104901 -5.0038548e-05 2830 + 12600 1260 0.00030811597 -6.9699925e-05 2830 + 12800 1280 0.00030555782 -8.9972287e-05 2830 + 13000 1300 0.00030256671 -0.00011712941 2830 + 13200 1320 0.00029907961 -0.00015495826 2830 + 13400 1340 0.00029504656 -0.00020292633 2830 + 13600 1360 0.0002905184 -0.00024892421 2830 + 13800 1380 0.00028564542 -0.000295085 2830 + 14000 1400 0.00028073246 -0.00034571956 2830 + 14200 1420 0.00027611457 -0.00039341977 2830 + 14400 1440 0.00027217382 -0.0004281012 2830 + 14600 1460 0.00026919129 -0.00045342545 2830 + 14800 1480 0.00026727674 -0.00047323419 2830 + 15000 1500 0.0002663482 -0.00048423944 2830 + 15200 1520 0.00026616663 -0.0004816085 2830 + 15400 1540 0.00026634862 -0.00047573486 2830 + 15600 1560 0.0002664314 -0.00046803192 2830 + 15800 1580 0.00026603348 -0.00045753668 2830 + 16000 1600 0.00026511015 -0.00044676105 2830 + 16200 1620 0.00026373403 -0.00044075794 2830 + 16400 1640 0.00026217342 -0.00043684036 2830 + 16600 1660 0.0002607038 -0.00042774771 2830 + 16800 1680 0.00025951097 -0.00041603026 2830 + 17000 1700 0.00025869088 -0.00040302996 2830 + 17200 1720 0.00025825588 -0.00038415247 2830 + 17400 1740 0.00025818373 -0.00035742127 2830 + 17600 1760 0.00025843381 -0.00032854722 2830 + 17800 1780 0.00025897836 -0.00029821183 2830 + 18000 1800 0.00025981472 -0.00026108907 2830 + 18200 1820 0.00026095775 -0.00021731058 2830 + 18400 1840 0.00026239688 -0.00017030825 2830 + 18600 1860 0.00026404432 -0.00011868778 2830 + 18800 1880 0.00026574247 -5.9556286e-05 2830 + 19000 1900 0.00026729563 2.3014881e-06 2830 + 19200 1920 0.00026852418 6.2100169e-05 2830 + 19400 1940 0.00026929086 0.00012090325 2830 + 19600 1960 0.0002695407 0.00017904223 2830 + 19800 1980 0.00026929677 0.00023112254 2830 + 20000 2000 0.00026863577 0.0002756697 2830 + 20200 2020 0.00026765699 0.0003158399 2830 + 20400 2040 0.00026646841 0.00035200747 2830 + 20600 2060 0.00026516938 0.00038018442 2830 + 20800 2080 0.00026383495 0.00040179111 2830 + 21000 2100 0.00026252489 0.00042030921 2830 + 21200 2120 0.00026128616 0.00043466976 2830 + 21400 2140 0.00026014896 0.00044221445 2830 + 21600 2160 0.00025912325 0.00044531883 2830 + 21800 2180 0.00025821515 0.00044661709 2830 + 22000 2200 0.00025742576 0.00044409089 2830 + 22200 2220 0.00025674938 0.00043634999 2830 + 22400 2240 0.00025617111 0.00042630344 2830 + 22600 2260 0.0002556791 0.00041561603 2830 + 22800 2280 0.00025525963 0.00040166735 2830 + 23000 2300 0.00025489538 0.00038430419 2830 + 23200 2320 0.00025456861 0.0003669402 2830 + 23400 2340 0.00025426747 0.00034972373 2830 + 23600 2360 0.00025398353 0.0003302242 2830 + 23800 2380 0.00025370842 0.00030993088 2830 + 24000 2400 0.00025344084 0.00029143258 2830 + 24200 2420 0.00025318683 0.00027421708 2830 + 24400 2440 0.0002529591 0.00025603123 2830 + 24600 2460 0.0002527713 0.00023950245 2830 + 24800 2480 0.00025264228 0.00022644812 2830 + 25000 2500 0.00025259021 0.00021540748 2830 + 25200 2520 0.00025262892 0.00020544201 2830 + 25400 2540 0.00025276229 0.00019845807 2830 + 25600 2560 0.0002529876 0.00019449958 2830 + 25800 2580 0.00025329374 0.00019082606 2830 + 26000 2600 0.00025366066 0.00018700064 2830 + 26200 2620 0.00025406164 0.00018426061 2830 + 26400 2640 0.00025446737 0.00018098339 2830 + 26600 2660 0.00025484714 0.00017471869 2830 + 26800 2680 0.00025516604 0.00016565557 2830 + 27000 2700 0.00025538911 0.00015493626 2830 + 27200 2720 0.00025548177 0.00014075592 2830 + 27400 2740 0.00025541168 0.00012205573 2830 + 27600 2760 0.00025514889 0.00010039772 2830 + 27800 2780 0.00025467547 7.7069215e-05 2830 + 28000 2800 0.0002539915 5.1158042e-05 2830 + 28200 2820 0.00025312083 2.3468384e-05 2830 + 28400 2840 0.00025211323 -3.2184465e-06 2830 + 28600 2860 0.00025104366 -2.7726301e-05 2830 + 28800 2880 0.00025000263 -5.0202987e-05 2830 + 29000 2900 0.00024907814 -6.9244776e-05 2830 + 29200 2920 0.00024833815 -8.2874516e-05 2830 + 29400 2940 0.0002478155 -9.1854992e-05 2830 + 29600 2960 0.00024750313 -9.766055e-05 2830 + 29800 2980 0.00024735538 -9.9681291e-05 2830 + 30000 3000 0.00024730191 -9.818759e-05 2830 +Loop time of 177.982 on 4 procs for 30000 steps with 2830 atoms + +Performance: 1456330.235 tau/day, 168.557 timesteps/s, 477.016 katom-step/s +99.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 | 22.913 | 27.061 | 34.594 | 87.2 | 15.20 +Bond | 0.22386 | 0.26159 | 0.30792 | 6.0 | 0.15 +Neigh | 0.84412 | 0.84509 | 0.8462 | 0.1 | 0.47 +Comm | 0.50015 | 0.55579 | 0.60346 | 5.2 | 0.31 +Output | 0.65854 | 0.69412 | 0.72473 | 2.8 | 0.39 +Modify | 133.13 | 136 | 137.38 | 14.5 | 76.41 +Other | | 12.57 | | | 7.06 + +Nlocal: 707.5 ave 1576 max 53 min +Histogram: 2 0 0 0 0 0 1 0 0 1 +Nghost: 164.75 ave 239 max 94 min +Histogram: 1 0 1 0 0 0 0 1 0 1 +Neighs: 12307.8 ave 27380 max 983 min +Histogram: 2 0 0 0 0 0 1 0 0 1 +FullNghs: 23517 ave 53040 max 1502 min +Histogram: 2 0 0 0 0 0 1 0 0 1 + +Total # of neighbors = 94068 +Ave neighs/atom = 33.239576 +Ave special neighs/atom = 0.89257951 +Neighbor list builds = 783 +Dangerous builds = 0 +Total wall time: 0:02:58 diff --git a/examples/rheo/dam-break/log.17Apr2024.dam.g++.4 b/examples/rheo/dam-break/log.17Apr2024.dam.g++.4 new file mode 100644 index 0000000000..6388d9e478 --- /dev/null +++ b/examples/rheo/dam-break/log.17Apr2024.dam.g++.4 @@ -0,0 +1,1694 @@ +LAMMPS (17 Apr 2024 - Development - patch_5May2020-18508-g3c0eaf6870-modified) +# ------ 2D dam break ------ # + +dimension 2 +units lj +atom_style rheo +boundary f s p +comm_modify vel yes +newton off + +# ------ Create simulation box ------ # + +variable n equal 1.0 +variable cut equal 2.2 +variable dx equal 3.0 + +region box block -1 150 -1 80 -0.1 0.1 units box +create_box 2 box +Created orthogonal box = (-1 -1 -0.1) to (150 80 0.1) + 2 by 2 by 1 MPI processor grid +lattice hex ${n} +lattice hex 1 +Lattice spacing in x,y,z = 1.0745699 1.8612097 1.0745699 + +region fluid block $(xlo+v_dx+1.0) $(xlo+40.0) $(ylo+v_dx+1.0) $(yhi-20.0) EDGE EDGE units box +region fluid block 3 $(xlo+40.0) $(ylo+v_dx+1.0) $(yhi-20.0) EDGE EDGE units box +region fluid block 3 39 $(ylo+v_dx+1.0) $(yhi-20.0) EDGE EDGE units box +region fluid block 3 39 2.991900000000000226 $(yhi-20.0) EDGE EDGE units box +region fluid block 3 39 2.991900000000000226 60.008099999999998886 EDGE EDGE units box +region walls1 block $(xlo+v_dx) $(xhi-v_dx) $(ylo+v_dx) $(yhi-v_dx) EDGE EDGE side out units box +region walls1 block 2 $(xhi-v_dx) $(ylo+v_dx) $(yhi-v_dx) EDGE EDGE side out units box +region walls1 block 2 147 $(ylo+v_dx) $(yhi-v_dx) EDGE EDGE side out units box +region walls1 block 2 147 1.9919000000000000039 $(yhi-v_dx) EDGE EDGE side out units box +region walls1 block 2 147 1.9919000000000000039 77.008099999999998886 EDGE EDGE side out units box +region walls2 block EDGE EDGE EDGE $(yhi-v_dx) EDGE EDGE side in units box +region walls2 block EDGE EDGE EDGE 77.008099999999998886 EDGE EDGE side in units box +region walls intersect 2 walls1 walls2 + +create_atoms 1 region fluid +Created 2044 atoms + using lattice units in orthogonal box = (-1 -1.0081 -0.1) to (150 80.0081 0.1) + create_atoms CPU = 0.001 seconds +create_atoms 2 region walls +Created 1002 atoms + using lattice units in orthogonal box = (-1 -1.0081 -0.1) to (150 80.0081 0.1) + create_atoms CPU = 0.000 seconds + +group fluid type 1 +2044 atoms in group fluid +group rig type 2 +1002 atoms in group rig + +# ------ Model parameters ------ # + +variable rho0 equal 1.0 +variable mp equal ${rho0}/${n} +variable mp equal 1/${n} +variable mp equal 1/1 +variable cs equal 1.0 +variable zeta equal 0.1 +variable dt_max equal 0.1*${cut}/${cs}/3 +variable dt_max equal 0.1*2.2/${cs}/3 +variable dt_max equal 0.1*2.2/1/3 +variable eta equal 0.1 +variable Dr equal 0.1 + +mass 1 ${mp} +mass 1 1 +mass 2 $(2*v_mp) +mass 2 2 +set group all rheo/rho ${rho0} +set group all rheo/rho 1 +Setting atom values ... + 3046 settings made for rheo/rho + +set group all rheo/status 0 +Setting atom values ... + 3046 settings made for rheo/status +set group rig rheo/status 1 +Setting atom values ... + 1002 settings made for rheo/status + +timestep ${dt_max} +timestep 0.0733333333333333 + +pair_style rheo ${cut} artificial/visc ${zeta} #rho/damp ${Dr} +pair_style rheo 2.2 artificial/visc ${zeta} +pair_style rheo 2.2 artificial/visc 0.1 +pair_coeff * * + +# ------ Fixes & computes ------ # + +fix 1 all rheo ${cut} quintic 10 surface/detection coordination 22 8 rho/sum +fix 1 all rheo 2.2 quintic 10 surface/detection coordination 22 8 rho/sum +fix 2 all rheo/viscosity * constant ${eta} +fix 2 all rheo/viscosity * constant 0.1 +fix 3 all rheo/pressure * linear +fix 4 all gravity 1e-3 vector 0 -1 0 +fix 5 rig setforce 0.0 0.0 0.0 +fix 6 all enforce2d + +compute rho all rheo/property/atom rho +compute p all rheo/property/atom pressure +compute surf all rheo/property/atom surface +compute sn all rheo/property/atom surface/n/x surface/n/y + +# ------ Output & Run ------ # + +thermo 20 +thermo_style custom step time ke press + +dump 1 all custom 200 atomDump id type x y vx vy fx fy c_rho c_surf c_p c_sn[*] + +run 30000 + +CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE + +Your simulation uses code contributions which should be cited: + +- @article{PalermoInPrep, + journal = {in prep}, + title = {RHEO: A Hybrid Mesh-Free Model Framework for Dynamic Multi-Phase Flows}, + year = {2024}, + author = {Eric T. Palermo and Ki T. Wolf and Joel T. Clemmer and Thomas C. O'Connor}, +} + +CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE + +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 = 2.5 + ghost atom cutoff = 2.5 + binsize = 1.25, bins = 121 65 1 + 5 neighbor lists, perpetual/occasional/extra = 5 0 0 + (1) pair rheo, perpetual, half/full from (2) + attributes: half, newton off + pair build: halffull/newtoff + stencil: none + bin: none + (2) compute RHEO/KERNEL, perpetual + attributes: full, newton off + pair build: full/bin/atomonly + stencil: full/bin/2d + bin: standard + (3) compute RHEO/GRAD, perpetual, copy from (1) + attributes: half, newton off + pair build: copy + stencil: none + bin: none + (4) compute RHEO/RHO/SUM, perpetual, copy from (1) + attributes: half, newton off + pair build: copy + stencil: none + bin: none + (5) compute RHEO/SURFACE, perpetual, copy from (1) + attributes: half, newton off + pair build: copy + stencil: none + bin: none +Per MPI rank memory allocation (min/avg/max) = 5.707 | 5.721 | 5.736 Mbytes + Step Time KinEng Press + 0 0 0 -8.9662357e-06 + 20 1.4666667 0.00034058796 8.9684994e-05 + 40 2.9333333 6.9365611e-05 2.3675864e-05 + 60 4.4 6.1074185e-05 1.6680783e-05 + 80 5.8666667 5.0534793e-05 1.2623473e-05 + 100 7.3333333 4.1073516e-05 1.1708742e-05 + 120 8.8 4.9303871e-05 1.3714304e-05 + 140 10.266667 5.1669035e-05 1.3579535e-05 + 160 11.733333 6.0107096e-05 1.606084e-05 + 180 13.2 6.9154593e-05 1.8429091e-05 + 200 14.666667 8.0009963e-05 2.0757671e-05 + 220 16.133333 9.1883493e-05 2.3542955e-05 + 240 17.6 0.00010524584 2.6786532e-05 + 260 19.066667 0.00011982479 3.0390295e-05 + 280 20.533333 0.00013474016 3.4766566e-05 + 300 22 0.00015081777 4.0596983e-05 + 320 23.466667 0.00016922091 4.7811202e-05 + 340 24.933333 0.00018746472 5.436563e-05 + 360 26.4 0.00020594739 5.8634772e-05 + 380 27.866667 0.00022673738 6.0759081e-05 + 400 29.333333 0.00024754656 6.1922882e-05 + 420 30.8 0.00026882061 6.4956859e-05 + 440 32.266667 0.00029203 7.2311959e-05 + 460 33.733333 0.00031627032 8.1297842e-05 + 480 35.2 0.00034113307 8.9913587e-05 + 500 36.666667 0.00036599396 9.7909338e-05 + 520 38.133333 0.00039120212 0.0001055925 + 540 39.6 0.00041728537 0.00011265914 + 560 41.066667 0.00044402713 0.00011842088 + 580 42.533333 0.00047160578 0.00012321574 + 600 44 0.00050005372 0.00012842455 + 620 45.466667 0.00052908365 0.00013533445 + 640 46.933333 0.00055833314 0.00014412684 + 660 48.4 0.00058760766 0.00015385416 + 680 49.866667 0.00061704537 0.00016323184 + 700 51.333333 0.00064676026 0.0001720558 + 720 52.8 0.00067674239 0.00018065137 + 740 54.266667 0.00070699735 0.00018906348 + 760 55.733333 0.00073745009 0.00019856234 + 780 57.2 0.00076805806 0.00020874484 + 800 58.666667 0.00079892632 0.00021905295 + 820 60.133333 0.00083019385 0.00022890532 + 840 61.6 0.00086204047 0.00023806257 + 860 63.066667 0.00089463638 0.00024675987 + 880 64.533333 0.0009280011 0.00025519683 + 900 66 0.00096201218 0.00026350368 + 920 67.466667 0.00099657113 0.00027166253 + 940 68.933333 0.0010317502 0.00027992975 + 960 70.4 0.0010676863 0.00028790134 + 980 71.866667 0.0011043796 0.00029680468 + 1000 73.333333 0.0011417187 0.00030600061 + 1020 74.8 0.001179618 0.00031551941 + 1040 76.266667 0.0012180222 0.00032540799 + 1060 77.733333 0.0012568886 0.00033557079 + 1080 79.2 0.0012962727 0.00034616068 + 1100 80.666667 0.0013363417 0.00035717164 + 1120 82.133333 0.0013772784 0.00036920892 + 1140 83.6 0.0014192183 0.00038068516 + 1160 85.066667 0.0014621933 0.00039223594 + 1180 86.533333 0.0015061045 0.00040532576 + 1200 88 0.001550789 0.00041895976 + 1220 89.466667 0.0015961278 0.00043309673 + 1240 90.933333 0.0016420919 0.0004476234 + 1260 92.4 0.001688693 0.00046248791 + 1280 93.866667 0.0017358804 0.00047764479 + 1300 95.333333 0.0017834857 0.0004929783 + 1320 96.8 0.0018313096 0.00050814477 + 1340 98.266667 0.0018793086 0.00052401678 + 1360 99.733333 0.0019277217 0.00053716885 + 1380 101.2 0.0019769204 0.00055180327 + 1400 102.66667 0.0020270711 0.0005656469 + 1420 104.13333 0.0020779701 0.00057917022 + 1440 105.6 0.0021293579 0.00059160854 + 1460 107.06667 0.0021813213 0.00060392999 + 1480 108.53333 0.0022341025 0.00061636071 + 1500 110 0.00228757 0.00062924749 + 1520 111.46667 0.0023412951 0.00064266414 + 1540 112.93333 0.0023952355 0.0006565177 + 1560 114.4 0.0024498098 0.00067063291 + 1580 115.86667 0.0025051272 0.00068509378 + 1600 117.33333 0.0025608522 0.00069926059 + 1620 118.8 0.0026168714 0.000713059 + 1640 120.26667 0.0026733349 0.00072675496 + 1660 121.73333 0.0027302055 0.00074010812 + 1680 123.2 0.0027874761 0.00075390199 + 1700 124.66667 0.0028453711 0.00076786487 + 1720 126.13333 0.0029038156 0.0007820191 + 1740 127.6 0.0029624061 0.00079619745 + 1760 129.06667 0.0030211707 0.00081053823 + 1780 130.53333 0.0030802801 0.00082493927 + 1800 132 0.0031393313 0.00083943639 + 1820 133.46667 0.0031981476 0.00085389118 + 1840 134.93333 0.0032572803 0.00086793469 + 1860 136.4 0.0033167316 0.00088219559 + 1880 137.86667 0.0033757606 0.00089612646 + 1900 139.33333 0.0034343394 0.00090982709 + 1920 140.8 0.0034930349 0.00092382861 + 1940 142.26667 0.0035518482 0.00093805745 + 1960 143.73333 0.0036105788 0.00095257985 + 1980 145.2 0.0036693157 0.00096734041 + 2000 146.66667 0.0037279206 0.00098228262 + 2020 148.13333 0.0037863272 0.00099753272 + 2040 149.6 0.0038448977 0.0010129675 + 2060 151.06667 0.0039035631 0.0010289263 + 2080 152.53333 0.0039618021 0.001044226 + 2100 154 0.0040196981 0.001059823 + 2120 155.46667 0.0040776598 0.0010754207 + 2140 156.93333 0.0041356267 0.0010912489 + 2160 158.4 0.0041933707 0.0011068916 + 2180 159.86667 0.0042506844 0.001122462 + 2200 161.33333 0.0043076551 0.0011378276 + 2220 162.8 0.004364899 0.0011531367 + 2240 164.26667 0.0044223607 0.0011685928 + 2260 165.73333 0.0044790909 0.001183629 + 2280 167.2 0.0045350513 0.0011983147 + 2300 168.66667 0.0045910698 0.0012128941 + 2320 170.13333 0.0046473036 0.0012274902 + 2340 171.6 0.0047034572 0.0012420483 + 2360 173.06667 0.0047594904 0.001256434 + 2380 174.53333 0.0048154857 0.0012710526 + 2400 176 0.0048713579 0.0012854643 + 2420 177.46667 0.0049268461 0.0012999539 + 2440 178.93333 0.0049821065 0.0013141319 + 2460 180.4 0.0050376352 0.0013286044 + 2480 181.86667 0.0050932684 0.0013428647 + 2500 183.33333 0.0051487541 0.0013573039 + 2520 184.8 0.0052041856 0.001371655 + 2540 186.26667 0.005259265 0.0013858701 + 2560 187.73333 0.0053140412 0.0014000303 + 2580 189.2 0.0053687577 0.0014142597 + 2600 190.66667 0.0054226172 0.0014281564 + 2620 192.13333 0.0054756639 0.0014420369 + 2640 193.6 0.0055290419 0.0014559949 + 2660 195.06667 0.0055821088 0.0014698039 + 2680 196.53333 0.0056340694 0.0014837338 + 2700 198 0.0056859198 0.0014973779 + 2720 199.46667 0.0057376404 0.0015110075 + 2740 200.93333 0.0057882397 0.0015247587 + 2760 202.4 0.0058380714 0.0015376559 + 2780 203.86667 0.0058874524 0.0015511804 + 2800 205.33333 0.0059360376 0.0015643594 + 2820 206.8 0.0059840503 0.0015776406 + 2840 208.26667 0.0060315172 0.0015904895 + 2860 209.73333 0.0060778724 0.0016030297 + 2880 211.2 0.0061232681 0.0016153868 + 2900 212.66667 0.0061684129 0.0016276456 + 2920 214.13333 0.0062133058 0.0016395859 + 2940 215.6 0.0062576324 0.0016507189 + 2960 217.06667 0.0063013566 0.0016623583 + 2980 218.53333 0.0063443506 0.0016735007 + 3000 220 0.0063871542 0.001684583 + 3020 221.46667 0.006430519 0.001697154 + 3040 222.93333 0.0064740424 0.0017087524 + 3060 224.4 0.0065176616 0.0017189916 + 3080 225.86667 0.0065615555 0.0017301805 + 3100 227.33333 0.006605039 0.0017410152 + 3120 228.8 0.0066482973 0.0017517164 + 3140 230.26667 0.0066915406 0.0017619713 + 3160 231.73333 0.0067344437 0.0017722386 + 3180 233.2 0.006777227 0.0017824734 + 3200 234.66667 0.006819344 0.0017926386 + 3220 236.13333 0.0068607536 0.0018023968 + 3240 237.6 0.0069026957 0.0018127097 + 3260 239.06667 0.0069450313 0.0018236711 + 3280 240.53333 0.0069865151 0.0018341375 + 3300 242 0.0070275294 0.0018448641 + 3320 243.46667 0.0070688646 0.0018561596 + 3340 244.93333 0.0071092014 0.0018662927 + 3360 246.4 0.0071487936 0.0018770385 + 3380 247.86667 0.0071890814 0.001886802 + 3400 249.33333 0.0072281891 0.0018972625 + 3420 250.8 0.0072657267 0.0019062877 + 3440 252.26667 0.0073033651 0.0019160172 + 3460 253.73333 0.0073406213 0.0019254146 + 3480 255.2 0.0073773312 0.0019343899 + 3500 256.66667 0.0074135814 0.0019431867 + 3520 258.13333 0.0074488904 0.0019521168 + 3540 259.6 0.0074841693 0.0019611895 + 3560 261.06667 0.0075194817 0.0019697561 + 3580 262.53333 0.0075540131 0.0019782744 + 3600 264 0.0075880612 0.0019869585 + 3620 265.46667 0.0076217162 0.0019954264 + 3640 266.93333 0.0076541332 0.0020048511 + 3660 268.4 0.0076854774 0.0020121513 + 3680 269.86667 0.0077170032 0.002020407 + 3700 271.33333 0.0077479535 0.002028555 + 3720 272.8 0.0077778112 0.002035829 + 3740 274.26667 0.0078075791 0.0020445579 + 3760 275.73333 0.0078373125 0.002051243 + 3780 277.2 0.0078671935 0.0020596139 + 3800 278.66667 0.0078966016 0.0020667611 + 3820 280.13333 0.0079259829 0.0020737998 + 3840 281.6 0.0079561144 0.0020823896 + 3860 283.06667 0.0079856022 0.0020898018 + 3880 284.53333 0.0080155451 0.0020975877 + 3900 286 0.008045725 0.0021058637 + 3920 287.46667 0.00807515 0.0021132131 + 3940 288.93333 0.0081055524 0.0021220937 + 3960 290.4 0.0081357323 0.0021293745 + 3980 291.86667 0.0081660373 0.0021372148 + 4000 293.33333 0.0081969984 0.0021452255 + 4020 294.8 0.0082267987 0.0021525847 + 4040 296.26667 0.0082567948 0.0021608073 + 4060 297.73333 0.0082871434 0.0021682544 + 4080 299.2 0.0083173455 0.0021769568 + 4100 300.66667 0.0083480923 0.0021843095 + 4120 302.13333 0.008377833 0.0021919136 + 4140 303.6 0.0084065176 0.0022000503 + 4160 305.06667 0.0084359624 0.0022072124 + 4180 306.53333 0.0084657862 0.0022153288 + 4200 308 0.008494679 0.0022227735 + 4220 309.46667 0.008523307 0.002229996 + 4240 310.93333 0.008553561 0.0022382672 + 4260 312.4 0.0085842107 0.0022462238 + 4280 313.86667 0.0086124223 0.0022536478 + 4300 315.33333 0.0086404396 0.0022608951 + 4320 316.8 0.0086693991 0.0022683957 + 4340 318.26667 0.0086973954 0.0022764575 + 4360 319.73333 0.0087253957 0.0022829952 + 4380 321.2 0.0087529268 0.0022901779 + 4400 322.66667 0.0087798869 0.0022970351 + 4420 324.13333 0.0088070731 0.0023035923 + 4440 325.6 0.0088336854 0.0023108163 + 4460 327.06667 0.00886034 0.002317611 + 4480 328.53333 0.008886686 0.0023244292 + 4500 330 0.0089126796 0.0023323098 + 4520 331.46667 0.0089380439 0.002338006 + 4540 332.93333 0.0089625802 0.0023439698 + 4560 334.4 0.0089876608 0.0023508279 + 4580 335.86667 0.0090119764 0.0023567519 + 4600 337.33333 0.0090358053 0.0023630419 + 4620 338.8 0.0090597056 0.0023696207 + 4640 340.26667 0.0090827564 0.0023757413 + 4660 341.73333 0.0091057102 0.0023825055 + 4680 343.2 0.0091280804 0.0023880185 + 4700 344.66667 0.0091501664 0.0023938041 + 4720 346.13333 0.0091724992 0.0024006288 + 4740 347.6 0.0091940571 0.0024066505 + 4760 349.06667 0.0092145857 0.0024118199 + 4780 350.53333 0.0092353995 0.0024187452 + 4800 352 0.0092558703 0.0024235776 + 4820 353.46667 0.009275219 0.0024285703 + 4840 354.93333 0.0092944603 0.0024339815 + 4860 356.4 0.0093126366 0.0024385746 + 4880 357.86667 0.0093312838 0.0024434876 + 4900 359.33333 0.0093497163 0.0024488983 + 4920 360.8 0.009365989 0.0024527436 + 4940 362.26667 0.0093829249 0.0024572285 + 4960 363.73333 0.0093999951 0.0024620002 + 4980 365.2 0.0094162511 0.0024654432 + 5000 366.66667 0.009432966 0.0024696871 + 5020 368.13333 0.0094491728 0.0024752768 + 5040 369.6 0.0094654395 0.0024791774 + 5060 371.06667 0.0094822028 0.0024833783 + 5080 372.53333 0.0094987002 0.0024876159 + 5100 374 0.0095154669 0.0024916919 + 5120 375.46667 0.0095317268 0.0024971427 + 5140 376.93333 0.0095488298 0.0025012162 + 5160 378.4 0.0095659696 0.0025049341 + 5180 379.86667 0.0095824397 0.0025092752 + 5200 381.33333 0.0096000959 0.0025131409 + 5220 382.8 0.0096178056 0.0025171802 + 5240 384.26667 0.0096358075 0.0025217474 + 5260 385.73333 0.0096536841 0.0025259115 + 5280 387.2 0.0096720374 0.0025307756 + 5300 388.66667 0.0096903176 0.0025371145 + 5320 390.13333 0.0097081278 0.002540216 + 5340 391.6 0.0097268941 0.0025456853 + 5360 393.06667 0.009745217 0.0025499166 + 5380 394.53333 0.0097634815 0.0025546822 + 5400 396 0.0097813844 0.0025591351 + 5420 397.46667 0.0097989874 0.0025645654 + 5440 398.93333 0.0098165651 0.0025681155 + 5460 400.4 0.0098343876 0.0025724122 + 5480 401.86667 0.0098522329 0.0025783873 + 5500 403.33333 0.0098691009 0.0025818597 + 5520 404.8 0.0098860184 0.0025857495 + 5540 406.26667 0.0099028987 0.002590578 + 5560 407.73333 0.0099197309 0.0025942164 + 5580 409.2 0.0099359956 0.0025983095 + 5600 410.66667 0.0099524424 0.0026024035 + 5620 412.13333 0.0099690162 0.0026067584 + 5640 413.6 0.0099843964 0.002611251 + 5660 415.06667 0.010000092 0.0026151565 + 5680 416.53333 0.010015971 0.0026189738 + 5700 418 0.01003088 0.0026226851 + 5720 419.46667 0.010046448 0.0026266212 + 5740 420.93333 0.010061779 0.0026305773 + 5760 422.4 0.010077085 0.002634556 + 5780 423.86667 0.010092596 0.0026403454 + 5800 425.33333 0.010107214 0.0026431069 + 5820 426.8 0.010122323 0.0026467806 + 5840 428.26667 0.010136615 0.0026505801 + 5860 429.73333 0.0101514 0.0026545146 + 5880 431.2 0.010165938 0.0026575254 + 5900 432.66667 0.010180061 0.0026611852 + 5920 434.13333 0.010193978 0.0026651517 + 5940 435.6 0.010207399 0.0026700025 + 5960 437.06667 0.010221274 0.0026724013 + 5980 438.53333 0.0102342 0.002675843 + 6000 440 0.010246851 0.0026796139 + 6020 441.46667 0.010259615 0.0026826456 + 6040 442.93333 0.010271994 0.0026856149 + 6060 444.4 0.010284566 0.0026891263 + 6080 445.86667 0.01029697 0.0026934663 + 6100 447.33333 0.010297087 0.0026929648 + 6120 448.8 0.01026953 0.0026859415 + 6140 450.26667 0.010241322 0.0026788232 + 6160 451.73333 0.010201572 0.0026685955 + 6180 453.2 0.010167529 0.0026596809 + 6200 454.66667 0.010140751 0.0026523585 + 6220 456.13333 0.010096077 0.002641072 + 6240 457.6 0.010043217 0.0026282922 + 6260 459.06667 0.0099830892 0.0026127228 + 6280 460.53333 0.0099406642 0.0026021682 + 6300 462 0.0099151275 0.002595732 + 6320 463.46667 0.0098900642 0.0025891145 + 6340 464.93333 0.0098560891 0.0025805017 + 6360 466.4 0.0098293518 0.0025741231 + 6380 467.86667 0.0098089665 0.0025692332 + 6400 469.33333 0.0097886264 0.0025633005 + 6420 470.8 0.0097672621 0.0025580882 + 6440 472.26667 0.0097438543 0.0025530359 + 6460 473.73333 0.0097156792 0.0025441423 + 6480 475.2 0.0096824023 0.0025359007 + 6500 476.66667 0.0096556854 0.0025282404 + 6520 478.13333 0.0096245146 0.0025200185 + 6540 479.6 0.0095942888 0.0025112709 + 6560 481.06667 0.0095630005 0.0025029005 + 6580 482.53333 0.0095307546 0.0024945223 + 6600 484 0.0094979676 0.0024851442 + 6620 485.46667 0.0094678543 0.0024768078 + 6640 486.93333 0.009440454 0.0024694763 + 6660 488.4 0.0094144007 0.0024632333 + 6680 489.86667 0.0093906089 0.0024562358 + 6700 491.33333 0.0093653494 0.0024490631 + 6720 492.8 0.0093388466 0.0024421324 + 6740 494.26667 0.0093068273 0.0024334756 + 6760 495.73333 0.0092747153 0.0024247141 + 6780 497.2 0.0092468798 0.0024172005 + 6800 498.66667 0.0092160816 0.002409021 + 6820 500.13333 0.0091844109 0.0024010176 + 6840 501.6 0.0091543943 0.0023931861 + 6860 503.06667 0.0091225364 0.00238459 + 6880 504.53333 0.009091163 0.0023764251 + 6900 506 0.0090620145 0.0023688628 + 6920 507.46667 0.0090327696 0.0023610683 + 6940 508.93333 0.0090043995 0.0023537352 + 6960 510.4 0.0089749557 0.0023459457 + 6980 511.86667 0.0089447271 0.0023385936 + 7000 513.33333 0.0089161633 0.0023311311 + 7020 514.8 0.008888379 0.002323798 + 7040 516.26667 0.0088597051 0.0023162749 + 7060 517.73333 0.0088314196 0.0023094901 + 7080 519.2 0.0088032697 0.0023017143 + 7100 520.66667 0.0087764174 0.0022945937 + 7120 522.13333 0.0087493465 0.0022878231 + 7140 523.6 0.0087208106 0.0022805679 + 7160 525.06667 0.0086901023 0.0022726678 + 7180 526.53333 0.0086602781 0.0022649995 + 7200 528 0.0086338883 0.0022581858 + 7220 529.46667 0.0086086121 0.002252324 + 7240 530.93333 0.0085801758 0.0022441934 + 7260 532.4 0.0085495659 0.0022361561 + 7280 533.86667 0.0085199727 0.0022288965 + 7300 535.33333 0.0084891254 0.0022216958 + 7320 536.8 0.0084557275 0.0022130525 + 7340 538.26667 0.0084218841 0.002203592 + 7360 539.73333 0.0083899168 0.0021958184 + 7380 541.2 0.0083585487 0.002188024 + 7400 542.66667 0.0083279264 0.0021795695 + 7420 544.13333 0.0082956611 0.0021711337 + 7440 545.6 0.0082600396 0.0021620937 + 7460 547.06667 0.008222435 0.0021524246 + 7480 548.53333 0.0081847492 0.0021422603 + 7500 550 0.0081480769 0.0021324926 + 7520 551.46667 0.0081129495 0.0021237168 + 7540 552.93333 0.0080794573 0.0021154414 + 7560 554.4 0.0080465003 0.0021057182 + 7580 555.86667 0.0080134857 0.0020967731 + 7600 557.33333 0.0079807769 0.0020882759 + 7620 558.8 0.007949081 0.0020799016 + 7640 560.26667 0.0079178914 0.0020720038 + 7660 561.73333 0.0078871135 0.0020650346 + 7680 563.2 0.007856599 0.0020563039 + 7700 564.66667 0.0078260839 0.002048286 + 7720 566.13333 0.007796051 0.0020402506 + 7740 567.6 0.0077667325 0.0020324247 + 7760 569.06667 0.0077368975 0.0020242564 + 7780 570.53333 0.0077063146 0.002016025 + 7800 572 0.0076756813 0.0020076974 + 7820 573.46667 0.0076444658 0.0019992537 + 7840 574.93333 0.0076122527 0.0019912246 + 7860 576.4 0.00757938 0.0019824601 + 7880 577.86667 0.0075457657 0.0019739889 + 7900 579.33333 0.0075114496 0.0019644524 + 7920 580.8 0.0074775871 0.0019556077 + 7940 582.26667 0.0074449114 0.0019470595 + 7960 583.73333 0.0074125826 0.0019386798 + 7980 585.2 0.0073795946 0.0019298994 + 8000 586.66667 0.0073460046 0.0019208737 + 8020 588.13333 0.0073122744 0.0019120703 + 8040 589.6 0.0072783913 0.0019033047 + 8060 591.06667 0.0072440775 0.0018943414 + 8080 592.53333 0.0072092735 0.0018852102 + 8100 594 0.0071736521 0.0018758623 + 8120 595.46667 0.0071373132 0.0018664102 + 8140 596.93333 0.0071013244 0.0018569886 + 8160 598.4 0.0070657891 0.0018477343 + 8180 599.86667 0.0070299646 0.0018383955 + 8200 601.33333 0.0069940522 0.001829006 + 8220 602.8 0.0069586108 0.0018197189 + 8240 604.26667 0.0069231457 0.0018112586 + 8260 605.73333 0.0068871373 0.0018016096 + 8280 607.2 0.0068512951 0.0017928173 + 8300 608.66667 0.006816413 0.0017834399 + 8320 610.13333 0.0067820205 0.0017745017 + 8340 611.6 0.0067473828 0.0017654991 + 8360 613.06667 0.0067124905 0.0017569034 + 8380 614.53333 0.0066773905 0.0017474775 + 8400 616 0.0066417638 0.0017387333 + 8420 617.46667 0.0066057074 0.0017293058 + 8440 618.93333 0.0065700041 0.0017200093 + 8460 620.4 0.0065351174 0.0017110662 + 8480 621.86667 0.0065006001 0.0017017664 + 8500 623.33333 0.0064659553 0.0016926237 + 8520 624.8 0.0064314284 0.0016834464 + 8540 626.26667 0.0063972759 0.0016730222 + 8560 627.73333 0.006363104 0.0016535358 + 8580 629.2 0.0063283374 0.0016341308 + 8600 630.66667 0.0062929939 0.0016145833 + 8620 632.13333 0.0062575534 0.0015952196 + 8640 633.6 0.0062223967 0.0015767924 + 8660 635.06667 0.0061876077 0.0015584021 + 8680 636.53333 0.0061531388 0.0015432462 + 8700 638 0.0061189895 0.0015255547 + 8720 639.46667 0.0060849843 0.0015087078 + 8740 640.93333 0.0060508603 0.0014912511 + 8760 642.4 0.0060166368 0.0014741414 + 8780 643.86667 0.0059825217 0.0014570326 + 8800 645.33333 0.0059487275 0.0014404208 + 8820 646.8 0.005915195 0.001427214 + 8840 648.26667 0.0058815506 0.0014108717 + 8860 649.73333 0.0058475012 0.001394823 + 8880 651.2 0.005813175 0.0013791763 + 8900 652.66667 0.0057788055 0.0013635495 + 8920 654.13333 0.0057442301 0.0013485291 + 8940 655.6 0.0057092563 0.0013329993 + 8960 657.06667 0.0056742445 0.0013200488 + 8980 658.53333 0.0056395856 0.0013052312 + 9000 660 0.005604919 0.0012908181 + 9020 661.46667 0.0055697452 0.001276258 + 9040 662.93333 0.0055345006 0.0012617179 + 9060 664.4 0.0054999699 0.0012488732 + 9080 665.86667 0.0054658705 0.0012342743 + 9100 667.33333 0.0054312056 0.0012219265 + 9120 668.8 0.0053958845 0.0012069595 + 9140 670.26667 0.0053607107 0.0011946481 + 9160 671.73333 0.0053258562 0.0011805403 + 9180 673.2 0.005290634 0.0011685879 + 9200 674.66667 0.0052548527 0.0011548258 + 9220 676.13333 0.0052191394 0.0011431756 + 9240 677.6 0.0051838155 0.0011292222 + 9260 679.06667 0.0051486178 0.0011177695 + 9280 680.53333 0.0051136287 0.0011043218 + 9300 682 0.0050793517 0.001093456 + 9320 683.46667 0.0050458249 0.00108072 + 9340 684.93333 0.0050124909 0.0010699656 + 9360 686.4 0.0049790841 0.0010577503 + 9380 687.86667 0.0049458438 0.0010471846 + 9400 689.33333 0.0049128193 0.0010353066 + 9420 690.8 0.0048796878 0.0010250736 + 9440 692.26667 0.0048463678 0.0010133357 + 9460 693.73333 0.0048130621 0.0010034192 + 9480 695.2 0.0047797612 0.00099181501 + 9500 696.66667 0.0047463058 0.00098192704 + 9520 698.13333 0.0047129773 0.00097114316 + 9540 699.6 0.0046802695 0.0009614797 + 9560 701.06667 0.0046481303 0.00095001935 + 9580 702.53333 0.0046159995 0.00094018625 + 9600 704 0.0045836057 0.00093048866 + 9620 705.46667 0.0045513113 0.00092093431 + 9640 706.93333 0.0045195288 0.00091163732 + 9660 708.4 0.0044881214 0.00090108788 + 9680 709.86667 0.0044565522 0.00089178586 + 9700 711.33333 0.0044245471 0.00088289706 + 9720 712.8 0.0043923571 0.00087366447 + 9740 714.26667 0.0043603446 0.00086340815 + 9760 715.73333 0.0043285042 0.00085450195 + 9780 717.2 0.0042965444 0.00084545827 + 9800 718.66667 0.0042643896 0.00083689129 + 9820 720.13333 0.0042323768 0.00082818681 + 9840 721.6 0.0042008631 0.00081834996 + 9860 723.06667 0.0041697784 0.00081001308 + 9880 724.53333 0.0041387393 0.00080132405 + 9900 726 0.0041075523 0.00079289302 + 9920 727.46667 0.0040764684 0.00078371229 + 9940 728.93333 0.004045842 0.00077617702 + 9960 730.4 0.0040156553 0.00076786882 + 9980 731.86667 0.0039855818 0.00075942893 + 10000 733.33333 0.0039554481 0.0007511838 + 10020 734.8 0.0039255002 0.00074338609 + 10040 736.26667 0.0038961167 0.0007357845 + 10060 737.73333 0.0038673423 0.00072863577 + 10080 739.2 0.0038388258 0.00072101271 + 10100 740.66667 0.0038101889 0.00071325927 + 10120 742.13333 0.0037813579 0.00070577634 + 10140 743.6 0.0037524894 0.00069840857 + 10160 745.06667 0.0037236699 0.0006912217 + 10180 746.53333 0.0036948382 0.00068398999 + 10200 748 0.0036659574 0.0006765938 + 10220 749.46667 0.003637161 0.00066944812 + 10240 750.93333 0.0036086524 0.00066246958 + 10260 752.4 0.0035804876 0.00065555896 + 10280 753.86667 0.0035525249 0.00064877214 + 10300 755.33333 0.003524549 0.00064262835 + 10320 756.8 0.0034964925 0.0006359586 + 10340 758.26667 0.0034685139 0.00062899447 + 10360 759.73333 0.0034408225 0.00062253344 + 10380 761.2 0.0034134787 0.00061569541 + 10400 762.66667 0.0033863357 0.00061002091 + 10420 764.13333 0.0033591874 0.00060376799 + 10440 765.6 0.0033319865 0.00059696082 + 10460 767.06667 0.0033049023 0.00059041399 + 10480 768.53333 0.0032781346 0.00058417754 + 10500 770 0.0032516844 0.0005781413 + 10520 771.46667 0.0032253297 0.00057280542 + 10540 772.93333 0.0031988384 0.00056654214 + 10560 774.4 0.0031722162 0.00056022576 + 10580 775.86667 0.0031457039 0.0005547685 + 10600 777.33333 0.0031195399 0.00054891424 + 10620 778.8 0.003093753 0.00054282948 + 10640 780.26667 0.0030681782 0.0005378126 + 10660 781.73333 0.0030426412 0.00053187104 + 10680 783.2 0.0030171127 0.00052598426 + 10700 784.66667 0.0029917103 0.00052087104 + 10720 786.13333 0.0029665734 0.00051521228 + 10740 787.6 0.0029417486 0.00050965329 + 10760 789.06667 0.0029171964 0.000504914 + 10780 790.53333 0.0028928685 0.00049932491 + 10800 792 0.0028687686 0.00049451045 + 10820 793.46667 0.0028449566 0.00048905426 + 10840 794.93333 0.0028215175 0.00048442583 + 10860 796.4 0.0027985141 0.00047942674 + 10880 797.86667 0.0027759233 0.00047495434 + 10900 799.33333 0.0027536322 0.00046989793 + 10920 800.8 0.0027315039 0.00046490714 + 10940 802.26667 0.0027094846 0.00046064051 + 10960 803.73333 0.0026876651 0.00045602046 + 10980 805.2 0.002666198 0.00045168389 + 11000 806.66667 0.0026451664 0.00044707481 + 11020 808.13333 0.0026244819 0.00044301025 + 11040 809.6 0.0026039186 0.00043882304 + 11060 811.06667 0.0025833111 0.00043484293 + 11080 812.53333 0.0025627062 0.0004302122 + 11100 814 0.0025423309 0.00042635689 + 11120 815.46667 0.0025223953 0.00042237706 + 11140 816.93333 0.002502881 0.00041811928 + 11160 818.4 0.002483558 0.00041427004 + 11180 819.86667 0.0024642 0.00041016131 + 11200 821.33333 0.002444785 0.00040680079 + 11220 822.8 0.0024255271 0.00040255216 + 11240 824.26667 0.0024066719 0.0003989581 + 11260 825.73333 0.0023882699 0.00039531616 + 11280 827.2 0.0023701608 0.00039149232 + 11300 828.66667 0.0023521641 0.00038812202 + 11320 830.13333 0.0023342875 0.00038432826 + 11340 831.6 0.0023167154 0.00038122373 + 11360 833.06667 0.0022996036 0.00037780451 + 11380 834.53333 0.0022829198 0.00037461979 + 11400 836 0.0022664799 0.00037151931 + 11420 837.46667 0.0022501566 0.00036807932 + 11440 838.93333 0.0022340312 0.00036508287 + 11460 840.4 0.0022183033 0.00036190422 + 11480 841.86667 0.0022030817 0.00035916212 + 11500 843.33333 0.0021882572 0.00035628429 + 11520 844.8 0.0021735959 0.00035351859 + 11540 846.26667 0.0021589553 0.00035088484 + 11560 847.73333 0.002144383 0.00034780033 + 11580 849.2 0.0021300334 0.00034517904 + 11600 850.66667 0.0021160134 0.00034238069 + 11620 852.13333 0.0021022646 0.00034000514 + 11640 853.6 0.0020886207 0.00033719824 + 11660 855.06667 0.0020749807 0.00033475998 + 11680 856.53333 0.0020613877 0.0003323936 + 11700 858 0.002047954 0.0003295216 + 11720 859.46667 0.0020347589 0.00032713228 + 11740 860.93333 0.0020218117 0.00032474079 + 11760 862.4 0.0020091095 0.00032239213 + 11780 863.86667 0.0019966993 0.00031989799 + 11800 865.33333 0.0019846286 0.00031771663 + 11820 866.8 0.0019728573 0.0003157215 + 11840 868.26667 0.0019612776 0.00031355627 + 11860 869.73333 0.0019498221 0.00031127816 + 11880 871.2 0.0019385448 0.00030917103 + 11900 872.66667 0.0019275959 0.00030717234 + 11920 874.13333 0.0019170876 0.00030529115 + 11940 875.6 0.0019069791 0.00030345863 + 11960 877.06667 0.0018971139 0.00030170128 + 11980 878.53333 0.0018873555 0.0003001492 + 12000 880 0.0018776861 0.000298125 + 12020 881.46667 0.0018681863 0.0002963477 + 12040 882.93333 0.0018589294 0.00029463961 + 12060 884.4 0.0018499098 0.00029287916 + 12080 885.86667 0.0018410776 0.00029127697 + 12100 887.33333 0.0018324309 0.00028984289 + 12120 888.8 0.0018240594 0.00028840492 + 12140 890.26667 0.0018160961 0.00028702304 + 12160 891.73333 0.0018086145 0.00028549007 + 12180 893.2 0.0018015575 0.00028402955 + 12200 894.66667 0.0017947657 0.00028282399 + 12220 896.13333 0.0017880903 0.00028154717 + 12240 897.6 0.0017814942 0.00028017139 + 12260 899.06667 0.0017750529 0.00027900454 + 12280 900.53333 0.0017688698 0.00027808648 + 12300 902 0.0017629899 0.00027685309 + 12320 903.46667 0.0017573722 0.00027580637 + 12340 904.93333 0.0017519364 0.00027485838 + 12360 906.4 0.0017466397 0.00027394007 + 12380 907.86667 0.001741517 0.00027291856 + 12400 909.33333 0.0017366544 0.00027203238 + 12420 910.8 0.0017321325 0.00027110163 + 12440 912.26667 0.0017279827 0.00027027898 + 12460 913.73333 0.0017241867 0.00026956597 + 12480 915.2 0.0017207028 0.00026893832 + 12500 916.66667 0.0017174942 0.0002684279 + 12520 918.13333 0.0017145473 0.00026791943 + 12540 919.6 0.0017118647 0.00026744382 + 12560 921.06667 0.0017094489 0.00026685887 + 12580 922.53333 0.0017072871 0.00026638424 + 12600 924 0.0017053649 0.00026597657 + 12620 925.46667 0.0017036738 0.00026563478 + 12640 926.93333 0.0017022202 0.00026540665 + 12660 928.4 0.0017010329 0.00026520386 + 12680 929.86667 0.0017001522 0.00026507626 + 12700 931.33333 0.0016995942 0.00026477717 + 12720 932.8 0.0016993235 0.0002646703 + 12740 934.26667 0.0016992705 0.00026461169 + 12760 935.73333 0.0016993774 0.00026456725 + 12780 937.2 0.0016996306 0.00026455988 + 12800 938.66667 0.001700059 0.0002646213 + 12820 940.13333 0.0017007039 0.00026482076 + 12840 941.6 0.0017015791 0.00026487824 + 12860 943.06667 0.0017026482 0.00026493272 + 12880 944.53333 0.0017038391 0.00026510172 + 12900 946 0.0017050887 0.00026529547 + 12920 947.46667 0.0017063854 0.00026551572 + 12940 948.93333 0.001707774 0.00026599737 + 12960 950.4 0.0017093344 0.00026611126 + 12980 951.86667 0.0017111446 0.00026624827 + 13000 953.33333 0.0017132414 0.00026655284 + 13020 954.8 0.0017156029 0.00026692012 + 13040 956.26667 0.0017181728 0.00026731624 + 13060 957.73333 0.001720904 0.00026783066 + 13080 959.2 0.0017237902 0.00026836703 + 13100 960.66667 0.0017268644 0.0002689476 + 13120 962.13333 0.0017301659 0.0002694946 + 13140 963.6 0.0017336967 0.00026985524 + 13160 965.06667 0.0017374153 0.00027047141 + 13180 966.53333 0.0017412627 0.00027116583 + 13200 968 0.0017451982 0.00027186788 + 13220 969.46667 0.0017492157 0.00027241441 + 13240 970.93333 0.0017533345 0.00027303315 + 13260 972.4 0.001757579 0.00027374363 + 13280 973.86667 0.0017619627 0.00027451986 + 13300 975.33333 0.0017664863 0.00027525007 + 13320 976.8 0.0017711394 0.00027591661 + 13340 978.26667 0.0017759051 0.00027671531 + 13360 979.73333 0.0017807725 0.00027754179 + 13380 981.2 0.0017857381 0.00027848699 + 13400 982.66667 0.0017907994 0.00027931598 + 13420 984.13333 0.0017959473 0.00028027815 + 13440 985.6 0.0018011601 0.00028113792 + 13460 987.06667 0.0018064143 0.00028211623 + 13480 988.53333 0.0018117101 0.00028327908 + 13500 990 0.0018170864 0.00028409026 + 13520 991.46667 0.0018225918 0.00028501376 + 13540 992.93333 0.0018282476 0.00028596031 + 13560 994.4 0.0018340585 0.00028716447 + 13580 995.86667 0.0018400197 0.00028805463 + 13600 997.33333 0.0018461017 0.00028921664 + 13620 998.8 0.0018522484 0.00029037184 + 13640 1000.2667 0.0018583764 0.00029143019 + 13660 1001.7333 0.001864373 0.00029269198 + 13680 1003.2 0.0018701272 0.0002936223 + 13700 1004.6667 0.001875598 0.00029471055 + 13720 1006.1333 0.0018808354 0.00029567952 + 13740 1007.6 0.0018859376 0.00029685882 + 13760 1009.0667 0.0018910107 0.00029796198 + 13780 1010.5333 0.0018961401 0.00029897911 + 13800 1012 0.0019013893 0.0002998773 + 13820 1013.4667 0.0019068286 0.00030092291 + 13840 1014.9333 0.0019125242 0.00030190868 + 13860 1016.4 0.0019185061 0.00030309941 + 13880 1017.8667 0.001924749 0.00030441051 + 13900 1019.3333 0.0019311778 0.00030560739 + 13920 1020.8 0.001937711 0.00030711748 + 13940 1022.2667 0.0019442933 0.00030842988 + 13960 1023.7333 0.0019508956 0.00030970219 + 13980 1025.2 0.0019575153 0.00031088886 + 14000 1026.6667 0.0019641693 0.00031199334 + 14020 1028.1333 0.0019708823 0.00031333167 + 14040 1029.6 0.0019776662 0.0003147189 + 14060 1031.0667 0.0019845097 0.0003161484 + 14080 1032.5333 0.0019913915 0.00031776661 + 14100 1034 0.0019983071 0.00031912667 + 14120 1035.4667 0.0020052807 0.00032037968 + 14140 1036.9333 0.0020123438 0.00032176152 + 14160 1038.4 0.002019523 0.00032328697 + 14180 1039.8667 0.0020268687 0.00032480224 + 14200 1041.3333 0.0020344454 0.0003263506 + 14220 1042.8 0.0020422702 0.00032803708 + 14240 1044.2667 0.0020503074 0.00032950555 + 14260 1045.7333 0.0020584954 0.00033107602 + 14280 1047.2 0.0020667453 0.00033272838 + 14300 1048.6667 0.0020749518 0.00033440292 + 14320 1050.1333 0.0020830298 0.00033616301 + 14340 1051.6 0.0020909561 0.00033777436 + 14360 1053.0667 0.002098763 0.00033939304 + 14380 1054.5333 0.0021064571 0.00034108867 + 14400 1056 0.0021139812 0.00034279091 + 14420 1057.4667 0.0021212743 0.00034442447 + 14440 1058.9333 0.0021283312 0.00034608006 + 14460 1060.4 0.0021351913 0.00034766535 + 14480 1061.8667 0.0021418558 0.00034931633 + 14500 1063.3333 0.0021482781 0.00035065187 + 14520 1064.8 0.0021544661 0.00035206483 + 14540 1066.2667 0.0021605274 0.00035349517 + 14560 1067.7333 0.0021666138 0.00035497387 + 14580 1069.2 0.002172775 0.00035650749 + 14600 1070.6667 0.0021789434 0.00035816361 + 14620 1072.1333 0.0021850567 0.00035981347 + 14640 1073.6 0.0021911017 0.00036119002 + 14660 1075.0667 0.0021970459 0.00036263527 + 14680 1076.5333 0.002202891 0.00036408979 + 14700 1078 0.0022086678 0.00036558706 + 14720 1079.4667 0.0022143659 0.00036708363 + 14740 1080.9333 0.0022200095 0.00036872316 + 14760 1082.4 0.0022256795 0.00037031852 + 14780 1083.8667 0.0022314598 0.00037172104 + 14800 1085.3333 0.0022373988 0.00037326473 + 14820 1086.8 0.0022435042 0.00037481567 + 14840 1088.2667 0.0022497418 0.0003767171 + 14860 1089.7333 0.0022560684 0.00037860978 + 14880 1091.2 0.002262451 0.00038015024 + 14900 1092.6667 0.0022688473 0.00038171512 + 14920 1094.1333 0.0022751666 0.00038333305 + 14940 1095.6 0.0022812118 0.00038546448 + 14960 1097.0667 0.0022867513 0.00038693328 + 14980 1098.5333 0.0022917745 0.00038844788 + 15000 1100 0.002296287 0.00038988563 + 15020 1101.4667 0.0022999653 0.00039138878 + 15040 1102.9333 0.0023028622 0.00039244167 + 15060 1104.4 0.002305798 0.00039349216 + 15080 1105.8667 0.0023089263 0.00039463979 + 15100 1107.3333 0.0023120599 0.00039582741 + 15120 1108.8 0.0023154124 0.00039746408 + 15140 1110.2667 0.0023192069 0.00039877981 + 15160 1111.7333 0.0023234403 0.00040024924 + 15180 1113.2 0.0023275332 0.00040194985 + 15200 1114.6667 0.0023309379 0.00040319063 + 15220 1116.1333 0.0023333104 0.0004046024 + 15240 1117.6 0.0023350271 0.00040564766 + 15260 1119.0667 0.0023370916 0.00040733425 + 15280 1120.5333 0.0023395929 0.00040838933 + 15300 1122 0.0023424998 0.00040987095 + 15320 1123.4667 0.0023453536 0.00041107287 + 15340 1124.9333 0.0023473165 0.00041242318 + 15360 1126.4 0.0023477134 0.00041322951 + 15380 1127.8667 0.0023491753 0.0004146031 + 15400 1129.3333 0.0023509302 0.00041566144 + 15420 1130.8 0.0023529326 0.00041714975 + 15440 1132.2667 0.0023554779 0.00041837505 + 15460 1133.7333 0.0023580661 0.00042017965 + 15480 1135.2 0.0023607312 0.0004213224 + 15500 1136.6667 0.0023635957 0.00042300666 + 15520 1138.1333 0.0023666602 0.00042436098 + 15540 1139.6 0.0023691001 0.0004260457 + 15560 1141.0667 0.0023700594 0.00042714685 + 15580 1142.5333 0.0023705741 0.00042853206 + 15600 1144 0.0023711825 0.00042951675 + 15620 1145.4667 0.002371987 0.00043109076 + 15640 1146.9333 0.0023732281 0.00043221551 + 15660 1148.4 0.0023749382 0.00043370865 + 15680 1149.8667 0.0023770404 0.00043490458 + 15700 1151.3333 0.0023793818 0.0004365297 + 15720 1152.8 0.0023816701 0.00043819097 + 15740 1154.2667 0.0023836808 0.00043980236 + 15760 1155.7333 0.0023856065 0.00044146758 + 15780 1157.2 0.0023876705 0.0004433163 + 15800 1158.6667 0.0023898905 0.00044465376 + 15820 1160.1333 0.0023918799 0.00044645614 + 15840 1161.6 0.0023914238 0.00044759356 + 15860 1163.0667 0.0023885514 0.00044839265 + 15880 1164.5333 0.0023867062 0.00044939387 + 15900 1166 0.0023853424 0.00045041476 + 15920 1167.4667 0.0023837839 0.00045152066 + 15940 1168.9333 0.0023823865 0.00045222801 + 15960 1170.4 0.0023800327 0.00045327302 + 15980 1171.8667 0.0023735917 0.00045357981 + 16000 1173.3333 0.0023643861 0.00045337685 + 16020 1174.8 0.0023565577 0.00045352436 + 16040 1176.2667 0.0023484436 0.00045344895 + 16060 1177.7333 0.0023408376 0.00045346696 + 16080 1179.2 0.0023326737 0.00045286966 + 16100 1180.6667 0.0023236531 0.00045261832 + 16120 1182.1333 0.0023169178 0.00045293394 + 16140 1183.6 0.0023111828 0.00045311831 + 16160 1185.0667 0.0023064172 0.00045378709 + 16180 1186.5333 0.002302184 0.00045455946 + 16200 1188 0.0022983621 0.00045539262 + 16220 1189.4667 0.0022953512 0.00045591645 + 16240 1190.9333 0.0022929801 0.00045712856 + 16260 1192.4 0.0022909009 0.00045847159 + 16280 1193.8667 0.0022885525 0.00045961196 + 16300 1195.3333 0.0022855688 0.00046061347 + 16320 1196.8 0.002282828 0.00046188788 + 16340 1198.2667 0.0022802183 0.00046302244 + 16360 1199.7333 0.0022773774 0.00046375719 + 16380 1201.2 0.0022731903 0.00046492183 + 16400 1202.6667 0.0022645201 0.00046516447 + 16420 1204.1333 0.0022568251 0.00046542882 + 16440 1205.6 0.0022422695 0.00046437586 + 16460 1207.0667 0.0022155713 0.00046051887 + 16480 1208.5333 0.0022035759 0.00046001297 + 16500 1210 0.002190894 0.00045893493 + 16520 1211.4667 0.0021802322 0.00045942457 + 16540 1212.9333 0.0021704133 0.000459471 + 16560 1214.4 0.0021615234 0.00045918488 + 16580 1215.8667 0.0021529915 0.00045936006 + 16600 1217.3333 0.0021451373 0.00045959338 + 16620 1218.8 0.0021383906 0.0004600505 + 16640 1220.2667 0.0021325315 0.00046005064 + 16660 1221.7333 0.0021277429 0.00046108228 + 16680 1223.2 0.0021237755 0.00046243368 + 16700 1224.6667 0.0021203172 0.00046394738 + 16720 1226.1333 0.0021172137 0.00046532716 + 16740 1227.6 0.0021142084 0.00046719106 + 16760 1229.0667 0.0021110689 0.00046854799 + 16780 1230.5333 0.0021077864 0.00046991776 + 16800 1232 0.0021045002 0.00047183286 + 16820 1233.4667 0.0021013226 0.00047317989 + 16840 1234.9333 0.002098386 0.0004747552 + 16860 1236.4 0.0020957505 0.00047738008 + 16880 1237.8667 0.0020931882 0.0004792455 + 16900 1239.3333 0.0020905705 0.00048104549 + 16920 1240.8 0.0020878895 0.00048403265 + 16940 1242.2667 0.0020853857 0.00048573735 + 16960 1243.7333 0.0020831358 0.00048728108 + 16980 1245.2 0.0020808323 0.00048952128 + 17000 1246.6667 0.0020784817 0.00049099168 + 17020 1248.1333 0.0020761732 0.00049278614 + 17040 1249.6 0.0020739063 0.00049556886 + 17060 1251.0667 0.0020717239 0.00049826766 + 17080 1252.5333 0.0020697361 0.00050040771 + 17100 1254 0.0020679208 0.00050266159 + 17120 1255.4667 0.0020661569 0.00050465637 + 17140 1256.9333 0.0020645102 0.00050644859 + 17160 1258.4 0.002063175 0.00050945115 + 17180 1259.8667 0.0020620744 0.00051135072 + 17200 1261.3333 0.0020578831 0.00051271416 + 17220 1262.8 0.002036801 0.00051070868 + 17240 1264.2667 0.0020246474 0.0005105671 + 17260 1265.7333 0.0020154083 0.00051056266 + 17280 1267.2 0.0020081398 0.00051203914 + 17300 1268.6667 0.0020033592 0.00051368703 + 17320 1270.1333 0.0019993325 0.00051565203 + 17340 1271.6 0.0019965177 0.00051918806 + 17360 1273.0667 0.0019938276 0.000522221 + 17380 1274.5333 0.0019914867 0.00052433401 + 17400 1276 0.0019892544 0.0005278718 + 17420 1277.4667 0.0019871107 0.00052787286 + 17440 1278.9333 0.0019850499 0.00052722809 + 17460 1280.4 0.0019830428 0.0005263569 + 17480 1281.8667 0.0019811987 0.00052588328 + 17500 1283.3333 0.0019795831 0.00052534586 + 17520 1284.8 0.0019781827 0.00052537295 + 17540 1286.2667 0.0019770664 0.00052509105 + 17560 1287.7333 0.0019762397 0.00052445472 + 17580 1289.2 0.0019755625 0.0005240242 + 17600 1290.6667 0.001974964 0.00052397078 + 17620 1292.1333 0.0019744966 0.00052447005 + 17640 1293.6 0.0019741078 0.00052446447 + 17660 1295.0667 0.0019735916 0.0005241986 + 17680 1296.5333 0.001972809 0.00052362297 + 17700 1298 0.0019718021 0.00052322362 + 17720 1299.4667 0.0019707205 0.00052316488 + 17740 1300.9333 0.0019696972 0.00052280952 + 17760 1302.4 0.0019687912 0.00052267588 + 17780 1303.8667 0.0019679901 0.00052231283 + 17800 1305.3333 0.0019672622 0.00052253006 + 17820 1306.8 0.0019665862 0.00052301876 + 17840 1308.2667 0.0019659299 0.00052301364 + 17860 1309.7333 0.00196528 0.0005229424 + 17880 1311.2 0.0019646495 0.00052264866 + 17900 1312.6667 0.0019640476 0.00052292066 + 17920 1314.1333 0.0019634587 0.0005229915 + 17940 1315.6 0.0019628594 0.00052284877 + 17960 1317.0667 0.0019622352 0.00052292872 + 17980 1318.5333 0.0019612399 0.00052337341 + 18000 1320 0.0019519628 0.00052094399 + 18020 1321.4667 0.0019343509 0.00051533063 + 18040 1322.9333 0.0019199585 0.00051174103 + 18060 1324.4 0.001905945 0.00050822167 + 18080 1325.8667 0.0018954044 0.00050571386 + 18100 1327.3333 0.0018867099 0.0005045138 + 18120 1328.8 0.0018790423 0.00050281498 + 18140 1330.2667 0.0018724677 0.00050092806 + 18160 1331.7333 0.0018669293 0.00049977801 + 18180 1333.2 0.0018621946 0.0004988236 + 18200 1334.6667 0.0018581668 0.00049860903 + 18220 1336.1333 0.0018546088 0.00049734989 + 18240 1337.6 0.001851507 0.00049612125 + 18260 1339.0667 0.0018488437 0.00049539768 + 18280 1340.5333 0.0018464974 0.00049462331 + 18300 1342 0.0018441554 0.00049419987 + 18320 1343.4667 0.0018418357 0.00049359519 + 18340 1344.9333 0.0018400699 0.00049361929 + 18360 1346.4 0.0018391163 0.0004934397 + 18380 1347.8667 0.0018386451 0.00049401695 + 18400 1349.3333 0.0018382434 0.00049404913 + 18420 1350.8 0.0018377762 0.00049284789 + 18440 1352.2667 0.0018373163 0.00049253988 + 18460 1353.7333 0.0018368769 0.00049170154 + 18480 1355.2 0.00183642 0.00049134218 + 18500 1356.6667 0.0018359651 0.00049049622 + 18520 1358.1333 0.0018355476 0.00049018604 + 18540 1359.6 0.0018351502 0.00049009857 + 18560 1361.0667 0.0018347415 0.00049034975 + 18580 1362.5333 0.0018343456 0.00048962734 + 18600 1364 0.0018340032 0.00048910267 + 18620 1365.4667 0.0018337131 0.000489678 + 18640 1366.9333 0.0018334434 0.00048942363 + 18660 1368.4 0.0018331908 0.00048883791 + 18680 1369.8667 0.0018330003 0.00048842189 + 18700 1371.3333 0.0018328613 0.00048778042 + 18720 1372.8 0.0018326423 0.0004879605 + 18740 1374.2667 0.0018322085 0.00048760414 + 18760 1375.7333 0.0018316466 0.00048749865 + 18780 1377.2 0.0018311569 0.00048717362 + 18800 1378.6667 0.0018307322 0.0004871375 + 18820 1380.1333 0.0018303267 0.00048680704 + 18840 1381.6 0.0018299711 0.00048676556 + 18860 1383.0667 0.0018296776 0.00048663795 + 18880 1384.5333 0.0018294387 0.00048659964 + 18900 1386 0.0018292809 0.00048698663 + 18920 1387.4667 0.0018292225 0.00048709797 + 18940 1388.9333 0.0018292283 0.0004870647 + 18960 1390.4 0.0018292259 0.00048674819 + 18980 1391.8667 0.0018291569 0.00048679582 + 19000 1393.3333 0.0018290098 0.00048689638 + 19020 1394.8 0.001828716 0.00048714893 + 19040 1396.2667 0.0018281487 0.00048793626 + 19060 1397.7333 0.0018274368 0.00048766312 + 19080 1399.2 0.0018267859 0.00048800122 + 19100 1400.6667 0.0018262357 0.00048767989 + 19120 1402.1333 0.001825769 0.0004870923 + 19140 1403.6 0.001825325 0.00048705214 + 19160 1405.0667 0.0018249161 0.00048807286 + 19180 1406.5333 0.0018245622 0.0004872987 + 19200 1408 0.001824239 0.00048742747 + 19220 1409.4667 0.0018239467 0.00048750738 + 19240 1410.9333 0.0018230912 0.00048779822 + 19260 1412.4 0.0018134463 0.00048497862 + 19280 1413.8667 0.0018021878 0.00048230785 + 19300 1415.3333 0.0017955735 0.00048083973 + 19320 1416.8 0.0017872753 0.0004788259 + 19340 1418.2667 0.0017779883 0.00047646403 + 19360 1419.7333 0.0017738211 0.00047574559 + 19380 1421.2 0.0017704561 0.00047501448 + 19400 1422.6667 0.0017677224 0.00047433091 + 19420 1424.1333 0.0017653706 0.00047260445 + 19440 1425.6 0.0017632679 0.00047170106 + 19460 1427.0667 0.0017613642 0.00047105927 + 19480 1428.5333 0.001759646 0.00047082774 + 19500 1430 0.001758063 0.00047009269 + 19520 1431.4667 0.0017566191 0.00046954867 + 19540 1432.9333 0.0017551775 0.00046892643 + 19560 1434.4 0.0017536259 0.00046842898 + 19580 1435.8667 0.0017521006 0.00046822248 + 19600 1437.3333 0.0017508378 0.00046758045 + 19620 1438.8 0.0017499266 0.0004680761 + 19640 1440.2667 0.0017492698 0.00046815863 + 19660 1441.7333 0.0017486531 0.00046811847 + 19680 1443.2 0.0017479735 0.00046864003 + 19700 1444.6667 0.0017472425 0.00046795012 + 19720 1446.1333 0.0017465091 0.0004669531 + 19740 1447.6 0.0017458236 0.00046666543 + 19760 1449.0667 0.0017452108 0.00046610386 + 19780 1450.5333 0.0017446777 0.00046578676 + 19800 1452 0.0017442315 0.00046559966 + 19820 1453.4667 0.0017438755 0.00046570962 + 19840 1454.9333 0.0017435917 0.00046591684 + 19860 1456.4 0.0017433538 0.00046605781 + 19880 1457.8667 0.0017431368 0.0004662092 + 19900 1459.3333 0.0017429113 0.00046639344 + 19920 1460.8 0.0017426466 0.00046609654 + 19940 1462.2667 0.0017423307 0.00046558461 + 19960 1463.7333 0.0017419767 0.00046538275 + 19980 1465.2 0.0017416057 0.00046473626 + 20000 1466.6667 0.0017412248 0.00046427697 + 20020 1468.1333 0.0017408365 0.00046360441 + 20040 1469.6 0.0017404537 0.00046250116 + 20060 1471.0667 0.0017400878 0.00046219676 + 20080 1472.5333 0.0017397348 0.0004620366 + 20100 1474 0.0017393906 0.00046142035 + 20120 1475.4667 0.0017390634 0.00046119888 + 20140 1476.9333 0.0017387599 0.00046114118 + 20160 1478.4 0.0017384654 0.00046119273 + 20180 1479.8667 0.0017381599 0.00046112037 + 20200 1481.3333 0.001737838 0.00046085119 + 20220 1482.8 0.0017374971 0.00046088054 + 20240 1484.2667 0.0017371388 0.00046097027 + 20260 1485.7333 0.0017368201 0.00046112449 + 20280 1487.2 0.0017365948 0.00046064697 + 20300 1488.6667 0.0017364148 0.00046068874 + 20320 1490.1333 0.001736224 0.00046068502 + 20340 1491.6 0.0017360297 0.00046057861 + 20360 1493.0667 0.0017358482 0.00046044137 + 20380 1494.5333 0.0017356781 0.00046043159 + 20400 1496 0.0017355222 0.00046062752 + 20420 1497.4667 0.0017353902 0.00046067799 + 20440 1498.9333 0.0017352915 0.00046071384 + 20460 1500.4 0.0017352299 0.00046111809 + 20480 1501.8667 0.0017352025 0.0004613299 + 20500 1503.3333 0.0017352027 0.00046183541 + 20520 1504.8 0.0017352278 0.00046106542 + 20540 1506.2667 0.0017352815 0.00046149717 + 20560 1507.7333 0.0017353649 0.00046105371 + 20580 1509.2 0.0017354697 0.00046104238 + 20600 1510.6667 0.0017355805 0.00046116932 + 20620 1512.1333 0.001735681 0.00046162233 + 20640 1513.6 0.001735758 0.00046178245 + 20660 1515.0667 0.0017358047 0.00046196886 + 20680 1516.5333 0.0017358199 0.00046215457 + 20700 1518 0.0017358084 0.00046228161 + 20720 1519.4667 0.0017357806 0.00046261955 + 20740 1520.9333 0.0017357486 0.00046271037 + 20760 1522.4 0.0017357257 0.00046257919 + 20780 1523.8667 0.0017357263 0.00046250064 + 20800 1525.3333 0.0017357658 0.00046146349 + 20820 1526.8 0.0017358584 0.00046138905 + 20840 1528.2667 0.0017360144 0.00046135266 + 20860 1529.7333 0.0017362378 0.00046136088 + 20880 1531.2 0.0017365251 0.00046203214 + 20900 1532.6667 0.0017368656 0.00046240805 + 20920 1534.1333 0.0017372463 0.00046245586 + 20940 1535.6 0.0017376552 0.00046233017 + 20960 1537.0667 0.0017380838 0.00046211905 + 20980 1538.5333 0.0017385273 0.00046221175 + 21000 1540 0.0017389813 0.0004623322 + 21020 1541.4667 0.0017394408 0.00046248895 + 21040 1542.9333 0.0017399011 0.00046262683 + 21060 1544.4 0.0017403582 0.0004628631 + 21080 1545.8667 0.0017408086 0.00046287413 + 21100 1547.3333 0.0017412486 0.00046253863 + 21120 1548.8 0.0017416739 0.00046239188 + 21140 1550.2667 0.0017420824 0.00046252093 + 21160 1551.7333 0.0017424775 0.00046243663 + 21180 1553.2 0.0017428687 0.00046231674 + 21200 1554.6667 0.0017432678 0.00046228047 + 21220 1556.1333 0.0017436835 0.00046205345 + 21240 1557.6 0.0017441181 0.00046191794 + 21260 1559.0667 0.001744567 0.00046187817 + 21280 1560.5333 0.00174502 0.00046195933 + 21300 1562 0.0017454629 0.00046207568 + 21320 1563.4667 0.0017458791 0.00046237686 + 21340 1564.9333 0.0017462532 0.00046251185 + 21360 1566.4 0.00174658 0.00046256338 + 21380 1567.8667 0.0017468761 0.00046258103 + 21400 1569.3333 0.0017471787 0.00046203359 + 21420 1570.8 0.0017475092 0.00046236915 + 21440 1572.2667 0.0017478285 0.00046240886 + 21460 1573.7333 0.0017480488 0.00046268024 + 21480 1575.2 0.0017481357 0.00046249851 + 21500 1576.6667 0.0017481758 0.00046252177 + 21520 1578.1333 0.0017482237 0.00046224255 + 21540 1579.6 0.0017482326 0.00046244066 + 21560 1581.0667 0.0017481857 0.0004626825 + 21580 1582.5333 0.0017481066 0.00046272441 + 21600 1584 0.0017480121 0.00046281669 + 21620 1585.4667 0.0017479031 0.0004630027 + 21640 1586.9333 0.0017477655 0.00046237554 + 21660 1588.4 0.0017475794 0.00046236536 + 21680 1589.8667 0.0017473246 0.00046234947 + 21700 1591.3333 0.0017469863 0.00046229056 + 21720 1592.8 0.0017465596 0.00046226293 + 21740 1594.2667 0.0017460487 0.00046221488 + 21760 1595.7333 0.0017454604 0.00046228835 + 21780 1597.2 0.0017447972 0.00046224033 + 21800 1598.6667 0.0017440567 0.00046196921 + 21820 1600.1333 0.0017432373 0.00046193024 + 21840 1601.6 0.0017423442 0.00046190113 + 21860 1603.0667 0.0017413885 0.00046182645 + 21880 1604.5333 0.0017403804 0.00046153595 + 21900 1606 0.0017393239 0.00046141594 + 21920 1607.4667 0.0017382204 0.00046059163 + 21940 1608.9333 0.0017370711 0.00046011476 + 21960 1610.4 0.0017358772 0.00045995874 + 21980 1611.8667 0.001734638 0.00045946276 + 22000 1613.3333 0.0017333523 0.00045909152 + 22020 1614.8 0.0017320214 0.00045871657 + 22040 1616.2667 0.0017306506 0.00045875126 + 22060 1617.7333 0.001729244 0.00045851969 + 22080 1619.2 0.0017277891 0.00045815 + 22100 1620.6667 0.0017262472 0.00045800503 + 22120 1622.1333 0.0017245557 0.00045722613 + 22140 1623.6 0.0017226312 0.00045612428 + 22160 1625.0667 0.0017203846 0.00045558148 + 22180 1626.5333 0.0017177538 0.00045493102 + 22200 1628 0.0017147219 0.00045354235 + 22220 1629.4667 0.0017113235 0.00045252377 + 22240 1630.9333 0.0017076396 0.00045148679 + 22260 1632.4 0.0017037869 0.00045053035 + 22280 1633.8667 0.0016998953 0.0004495377 + 22300 1635.3333 0.0016960489 0.00044816777 + 22320 1636.8 0.0016922401 0.00044714973 + 22340 1638.2667 0.0016884053 0.00044610277 + 22360 1639.7333 0.0016844703 0.00044568763 + 22380 1641.2 0.0016803511 0.00044439173 + 22400 1642.6667 0.0016759401 0.00044314089 + 22420 1644.1333 0.0016711286 0.00044193566 + 22440 1645.6 0.0016658281 0.0004406589 + 22460 1647.0667 0.0016599393 0.00043844661 + 22480 1648.5333 0.001653471 0.00043656014 + 22500 1650 0.0016466439 0.00043470146 + 22520 1651.4667 0.0016396283 0.00043288723 + 22540 1652.9333 0.0016322717 0.00043091896 + 22560 1654.4 0.0016242406 0.00042878807 + 22580 1655.8667 0.0016143541 0.00042598276 + 22600 1657.3333 0.0015984531 0.00042184208 + 22620 1658.8 0.0015774545 0.00041639723 + 22640 1660.2667 0.0015581678 0.00041151234 + 22660 1661.7333 0.0015392455 0.0004074519 + 22680 1663.2 0.0015238703 0.0004031907 + 22700 1664.6667 0.0015082033 0.00039905746 + 22720 1666.1333 0.0014910701 0.00039410593 + 22740 1667.6 0.0014773215 0.00039023578 + 22760 1669.0667 0.0014646054 0.00038693028 + 22780 1670.5333 0.0014509254 0.00038338321 + 22800 1672 0.0014387044 0.00038022989 + 22820 1673.4667 0.0014276038 0.00037738369 + 22840 1674.9333 0.0014165206 0.00037467759 + 22860 1676.4 0.0014054416 0.00037186956 + 22880 1677.8667 0.0013942654 0.00036919292 + 22900 1679.3333 0.0013833555 0.00036666326 + 22920 1680.8 0.0013733025 0.00036390292 + 22940 1682.2667 0.001364207 0.00036143657 + 22960 1683.7333 0.001355472 0.00035947361 + 22980 1685.2 0.0013467462 0.00035649775 + 23000 1686.6667 0.0013381467 0.00035425964 + 23020 1688.1333 0.0013298724 0.00035194314 + 23040 1689.6 0.0013219998 0.0003499467 + 23060 1691.0667 0.0013145189 0.00034806194 + 23080 1692.5333 0.0013073428 0.00034626601 + 23100 1694 0.0013004081 0.00034470285 + 23120 1695.4667 0.0012935813 0.00034306885 + 23140 1696.9333 0.0012865972 0.0003412658 + 23160 1698.4 0.0012792092 0.00033945219 + 23180 1699.8667 0.0012712869 0.00033750315 + 23200 1701.3333 0.0012627886 0.0003353201 + 23220 1702.8 0.001253784 0.00033296654 + 23240 1704.2667 0.0012445082 0.00033053745 + 23260 1705.7333 0.001235266 0.00032759425 + 23280 1707.2 0.0012261717 0.000325215 + 23300 1708.6667 0.0012168943 0.00032279239 + 23320 1710.1333 0.0012071081 0.00032042001 + 23340 1711.6 0.0011971594 0.00031782638 + 23360 1713.0667 0.0011876725 0.00031524799 + 23380 1714.5333 0.0011786269 0.00031289556 + 23400 1716 0.001169404 0.00031049786 + 23420 1717.4667 0.0011595669 0.00030723977 + 23440 1718.9333 0.001149266 0.00030443096 + 23460 1720.4 0.001138992 0.00030161041 + 23480 1721.8667 0.001129081 0.00029923744 + 23500 1723.3333 0.0011195152 0.00029668379 + 23520 1724.8 0.0011100863 0.00029417354 + 23540 1726.2667 0.0011005982 0.00029164586 + 23560 1727.7333 0.0010910778 0.0002889626 + 23580 1729.2 0.0010816854 0.00028655072 + 23600 1730.6667 0.001072494 0.00028419823 + 23620 1732.1333 0.0010634481 0.00028189699 + 23640 1733.6 0.0010544699 0.00027928614 + 23660 1735.0667 0.0010455565 0.00027694249 + 23680 1736.5333 0.0010367472 0.00027466258 + 23700 1738 0.0010280561 0.00027240232 + 23720 1739.4667 0.0010194696 0.00027014395 + 23740 1740.9333 0.0010109726 0.00026815472 + 23760 1742.4 0.0010025582 0.00026636602 + 23780 1743.8667 0.00099420961 0.0002639384 + 23800 1745.3333 0.00098589439 0.00026185788 + 23820 1746.8 0.00097758322 0.00025980082 + 23840 1748.2667 0.00096925998 0.00025767237 + 23860 1749.7333 0.00096092015 0.00025564227 + 23880 1751.2 0.00095256615 0.0002533114 + 23900 1752.6667 0.00094419511 0.00025115421 + 23920 1754.1333 0.00093579195 0.00024903122 + 23940 1755.6 0.00092733111 0.00024683875 + 23960 1757.0667 0.00091878509 0.00024461091 + 23980 1758.5333 0.00091013147 0.00024236826 + 24000 1760 0.00090135324 0.0002404806 + 24020 1761.4667 0.00089243423 0.0002380936 + 24040 1762.9333 0.00088336053 0.00023549546 + 24060 1764.4 0.00087412784 0.00023319301 + 24080 1765.8667 0.00086474945 0.00023084155 + 24100 1767.3333 0.00085525774 0.00022851664 + 24120 1768.8 0.0008456963 0.00022615872 + 24140 1770.2667 0.00083610859 0.00022375601 + 24160 1771.7333 0.00082652908 0.00022120807 + 24180 1773.2 0.00081698057 0.00021815795 + 24200 1774.6667 0.00080747609 0.00021555543 + 24220 1776.1333 0.00079802183 0.00021298564 + 24240 1777.6 0.00078862131 0.00021045545 + 24260 1779.0667 0.00077927933 0.00020806904 + 24280 1780.5333 0.00077000523 0.0002058181 + 24300 1782 0.00076081568 0.00020320246 + 24320 1783.4667 0.00075173462 0.00020084308 + 24340 1784.9333 0.0007427896 0.00019868422 + 24360 1786.4 0.00073400423 0.00019651532 + 24380 1787.8667 0.00072538996 0.00019445357 + 24400 1789.3333 0.00071694344 0.00019222062 + 24420 1790.8 0.00070865664 0.0001900288 + 24440 1792.2667 0.00070053087 0.00018789961 + 24460 1793.7333 0.00069258266 0.0001848306 + 24480 1795.2 0.00068483291 0.00018274366 + 24500 1796.6667 0.00067729047 0.00018074446 + 24520 1798.1333 0.00066994193 0.00017882986 + 24540 1799.6 0.00066275021 0.00017698882 + 24560 1801.0667 0.00065565627 0.00017510426 + 24580 1802.5333 0.00064858738 0.00017328965 + 24600 1804 0.00064147322 0.00017147388 + 24620 1805.4667 0.00063426805 0.00016964736 + 24640 1806.9333 0.0006269663 0.00016781232 + 24660 1808.4 0.00061960354 0.00016597943 + 24680 1809.8667 0.00061223634 0.00016419561 + 24700 1811.3333 0.00060491662 0.00016237355 + 24720 1812.8 0.00059767953 0.00016075431 + 24740 1814.2667 0.00059053949 0.00015905558 + 24760 1815.7333 0.00058349084 0.00015739614 + 24780 1817.2 0.0005765115 0.00015502575 + 24800 1818.6667 0.0005695693 0.00015330761 + 24820 1820.1333 0.00056263283 0.00015162196 + 24840 1821.6 0.00055568243 0.00014995088 + 24860 1823.0667 0.00054871692 0.00014819243 + 24880 1824.5333 0.00054175223 0.00014652991 + 24900 1826 0.00053481455 0.00014490663 + 24920 1827.4667 0.00052793142 0.00014324987 + 24940 1828.9333 0.00052112566 0.00014156756 + 24960 1830.4 0.00051441308 0.0001397807 + 24980 1831.8667 0.00050780341 0.00013808181 + 25000 1833.3333 0.0005013017 0.00013637046 + 25020 1834.8 0.00049490926 0.00013464589 + 25040 1836.2667 0.00048862482 0.00013292356 + 25060 1837.7333 0.0004824453 0.0001314188 + 25080 1839.2 0.00047636617 0.0001293314 + 25100 1840.6667 0.00047038116 0.00012754146 + 25120 1842.1333 0.00046448251 0.00012554913 + 25140 1843.6 0.0004586615 0.00012383425 + 25160 1845.0667 0.00045290921 0.00012215229 + 25180 1846.5333 0.00044721746 0.00012074608 + 25200 1848 0.00044157971 0.0001189818 + 25220 1849.4667 0.00043599245 0.00011737642 + 25240 1850.9333 0.00043045564 0.00011575387 + 25260 1852.4 0.00042497205 0.00011421704 + 25280 1853.8667 0.00041954608 0.00011269281 + 25300 1855.3333 0.00041418267 0.00011124707 + 25320 1856.8 0.0004088869 0.00010985539 + 25340 1858.2667 0.00040366377 0.00010856688 + 25360 1859.7333 0.0003985179 0.00010747086 + 25380 1861.2 0.00039345294 0.00010624143 + 25400 1862.6667 0.00038847115 0.00010464611 + 25420 1864.1333 0.00038357328 0.00010342367 + 25440 1865.6 0.00037875866 0.00010197951 + 25460 1867.0667 0.0003740255 0.00010083387 + 25480 1868.5333 0.00036937131 9.9727459e-05 + 25500 1870 0.00036479358 9.8715792e-05 + 25520 1871.4667 0.00036029053 9.7693667e-05 + 25540 1872.9333 0.00035586162 9.6659947e-05 + 25560 1874.4 0.00035150779 9.5730365e-05 + 25580 1875.8667 0.000347231 9.4850676e-05 + 25600 1877.3333 0.00034303359 9.4132269e-05 + 25620 1878.8 0.00033891749 9.3355928e-05 + 25640 1880.2667 0.00033488372 9.282199e-05 + 25660 1881.7333 0.00033093187 9.2101633e-05 + 25680 1883.2 0.00032705982 9.1331225e-05 + 25700 1884.6667 0.00032326391 8.9490029e-05 + 25720 1886.1333 0.0003195392 8.8603192e-05 + 25740 1887.6 0.00031588037 8.7694411e-05 + 25760 1889.0667 0.0003122828 8.6761483e-05 + 25780 1890.5333 0.00030874312 8.5806827e-05 + 25800 1892 0.00030525908 8.4835735e-05 + 25820 1893.4667 0.00030182927 8.402954e-05 + 25840 1894.9333 0.00029845296 8.3049666e-05 + 25860 1896.4 0.00029512991 8.211056e-05 + 25880 1897.8667 0.00029186078 8.1134374e-05 + 25900 1899.3333 0.00028864743 8.0199975e-05 + 25920 1900.8 0.00028549282 7.9325687e-05 + 25940 1902.2667 0.0002824008 7.8437438e-05 + 25960 1903.7333 0.00027937535 7.7544386e-05 + 25980 1905.2 0.00027642007 7.6706594e-05 + 26000 1906.6667 0.00027353814 7.579826e-05 + 26020 1908.1333 0.00027073244 7.5008665e-05 + 26040 1909.6 0.00026800557 7.4544912e-05 + 26060 1911.0667 0.00026535971 7.3786981e-05 + 26080 1912.5333 0.00026279611 7.2166049e-05 + 26100 1914 0.00026031456 7.1403392e-05 + 26120 1915.4667 0.00025791305 7.0702466e-05 + 26140 1916.9333 0.00025558794 7.0006351e-05 + 26160 1918.4 0.00025333488 6.9317329e-05 + 26180 1919.8667 0.00025115003 6.8688062e-05 + 26200 1921.3333 0.00024903038 6.8122851e-05 + 26220 1922.8 0.00024697358 6.7568833e-05 + 26240 1924.2667 0.00024497771 6.6968209e-05 + 26260 1925.7333 0.00024304157 6.6501986e-05 + 26280 1927.2 0.0002411651 6.6088755e-05 + 26300 1928.6667 0.00023934939 6.5705322e-05 + 26320 1930.1333 0.00023759592 6.5362857e-05 + 26340 1931.6 0.00023590514 6.5049803e-05 + 26360 1933.0667 0.00023427484 6.473807e-05 + 26380 1934.5333 0.00023269956 6.4466061e-05 + 26400 1936 0.00023117121 6.4080253e-05 + 26420 1937.4667 0.0002296809 6.3752394e-05 + 26440 1938.9333 0.00022822123 6.3357126e-05 + 26460 1940.4 0.00022678837 6.3049852e-05 + 26480 1941.8667 0.00022538306 6.2753673e-05 + 26500 1943.3333 0.00022400995 6.2294535e-05 + 26520 1944.8 0.00022267608 6.2038117e-05 + 26540 1946.2667 0.00022138844 6.1782883e-05 + 26560 1947.7333 0.00022015168 6.1574119e-05 + 26580 1949.2 0.00021896802 6.1384003e-05 + 26600 1950.6667 0.00021783788 6.1156768e-05 + 26620 1952.1333 0.00021676111 6.0986244e-05 + 26640 1953.6 0.0002157381 6.0849325e-05 + 26660 1955.0667 0.00021477001 6.0683878e-05 + 26680 1956.5333 0.00021385807 6.0516059e-05 + 26700 1958 0.00021300223 6.0329517e-05 + 26720 1959.4667 0.00021220038 6.0110922e-05 + 26740 1960.9333 0.0002114485 5.9940604e-05 + 26760 1962.4 0.00021074077 5.977174e-05 + 26780 1963.8667 0.00021007047 5.9606511e-05 + 26800 1965.3333 0.00020943091 5.9060466e-05 + 26820 1966.8 0.00020881619 5.8839697e-05 + 26840 1968.2667 0.00020822134 5.8633638e-05 + 26860 1969.7333 0.00020764269 5.8541664e-05 + 26880 1971.2 0.0002070779 5.83276e-05 + 26900 1972.6667 0.00020652606 5.8076903e-05 + 26920 1974.1333 0.00020598762 5.7951516e-05 + 26940 1975.6 0.00020546407 5.7793633e-05 + 26960 1977.0667 0.00020495767 5.7642438e-05 + 26980 1978.5333 0.00020447095 5.7497463e-05 + 27000 1980 0.00020400643 5.7358967e-05 + 27020 1981.4667 0.00020356638 5.7197798e-05 + 27040 1982.9333 0.00020315297 5.7081118e-05 + 27060 1984.4 0.00020276878 5.6970958e-05 + 27080 1985.8667 0.0002024165 5.6875439e-05 + 27100 1987.3333 0.00020209914 5.6749323e-05 + 27120 1988.8 0.00020182082 5.6684087e-05 + 27140 1990.2667 0.0002015866 5.6665814e-05 + 27160 1991.7333 0.00020140121 5.6663183e-05 + 27180 1993.2 0.0002012666 5.6636454e-05 + 27200 1994.6667 0.00020117997 5.6723443e-05 + 27220 1996.1333 0.00020113417 5.6708615e-05 + 27240 1997.6 0.00020111982 5.6574526e-05 + 27260 1999.0667 0.00020112751 5.6159e-05 + 27280 2000.5333 0.00020114945 5.612955e-05 + 27300 2002 0.00020118054 5.607577e-05 + 27320 2003.4667 0.00020121792 5.6026534e-05 + 27340 2004.9333 0.00020125939 5.5904818e-05 + 27360 2006.4 0.0002013021 5.5872498e-05 + 27380 2007.8667 0.00020134272 5.5850226e-05 + 27400 2009.3333 0.00020137844 5.5792845e-05 + 27420 2010.8 0.0002014071 5.5793502e-05 + 27440 2012.2667 0.00020142601 5.5834389e-05 + 27460 2013.7333 0.00020143246 5.5853674e-05 + 27480 2015.2 0.00020142475 5.5879946e-05 + 27500 2016.6667 0.00020140167 5.5911328e-05 + 27520 2018.1333 0.000201362 5.5946112e-05 + 27540 2019.6 0.00020130361 5.5982457e-05 + 27560 2021.0667 0.00020122365 5.6018854e-05 + 27580 2022.5333 0.00020111911 5.6199876e-05 + 27600 2024 0.00020098676 5.6207908e-05 + 27620 2025.4667 0.00020082461 5.6235125e-05 + 27640 2026.9333 0.00020063251 5.6261668e-05 + 27660 2028.4 0.00020041288 5.6264024e-05 + 27680 2029.8667 0.00020017135 5.6292857e-05 + 27700 2031.3333 0.00019991548 5.6350987e-05 + 27720 2032.8 0.00019965421 5.6386525e-05 + 27740 2034.2667 0.00019939714 5.6330983e-05 + 27760 2035.7333 0.00019915264 5.6315529e-05 + 27780 2037.2 0.00019892685 5.6357912e-05 + 27800 2038.6667 0.00019872342 5.6400674e-05 + 27820 2040.1333 0.00019854343 5.592942e-05 + 27840 2041.6 0.00019838552 5.5933967e-05 + 27860 2043.0667 0.00019824625 5.5937495e-05 + 27880 2044.5333 0.00019812108 5.5939048e-05 + 27900 2046 0.00019800547 5.5938225e-05 + 27920 2047.4667 0.00019789596 5.5934984e-05 + 27940 2048.9333 0.00019779049 5.5998316e-05 + 27960 2050.4 0.00019768847 5.5990459e-05 + 27980 2051.8667 0.00019759007 5.5934942e-05 + 28000 2053.3333 0.00019749517 5.5921371e-05 + 28020 2054.8 0.00019740272 5.5903442e-05 + 28040 2056.2667 0.00019731052 5.5860176e-05 + 28060 2057.7333 0.00019721613 5.58009e-05 + 28080 2059.2 0.00019711761 5.576013e-05 + 28100 2060.6667 0.00019701413 5.5709878e-05 + 28120 2062.1333 0.00019690592 5.5650013e-05 + 28140 2063.6 0.00019679371 5.549438e-05 + 28160 2065.0667 0.00019667803 5.5419813e-05 + 28180 2066.5333 0.00019655854 5.5339684e-05 + 28200 2068 0.0001964341 5.5255642e-05 + 28220 2069.4667 0.00019630305 5.516945e-05 + 28240 2070.9333 0.00019616373 5.5082892e-05 + 28260 2072.4 0.00019601462 5.4997644e-05 + 28280 2073.8667 0.00019585462 5.4915059e-05 + 28300 2075.3333 0.00019568308 5.4836332e-05 + 28320 2076.8 0.00019549977 5.4945429e-05 + 28340 2078.2667 0.00019530501 5.4861235e-05 + 28360 2079.7333 0.00019509987 5.46661e-05 + 28380 2081.2 0.00019488603 5.4604902e-05 + 28400 2082.6667 0.00019466562 5.4548672e-05 + 28420 2084.1333 0.00019444125 5.4495481e-05 + 28440 2085.6 0.00019421575 5.4450188e-05 + 28460 2087.0667 0.00019399217 5.441163e-05 + 28480 2088.5333 0.00019377343 5.4375395e-05 + 28500 2090 0.00019356194 5.4441594e-05 + 28520 2091.4667 0.00019335923 5.4431527e-05 + 28540 2092.9333 0.00019316575 5.4433248e-05 + 28560 2094.4 0.00019298088 5.4331854e-05 + 28580 2095.8667 0.00019280294 5.4731573e-05 + 28600 2097.3333 0.00019262915 5.4763809e-05 + 28620 2098.8 0.00019245592 5.4802719e-05 + 28640 2100.2667 0.00019227949 5.4072056e-05 + 28660 2101.7333 0.00019209613 5.4088674e-05 + 28680 2103.2 0.00019190237 5.4104871e-05 + 28700 2104.6667 0.00019169556 5.4118777e-05 + 28720 2106.1333 0.00019147409 5.4129434e-05 + 28740 2107.6 0.00019123755 5.4109248e-05 + 28760 2109.0667 0.00019098676 5.4095416e-05 + 28780 2110.5333 0.00019072352 5.40944e-05 + 28800 2112 0.0001904505 5.4089923e-05 + 28820 2113.4667 0.00019017109 5.4081987e-05 + 28840 2114.9333 0.00018988915 5.4070363e-05 + 28860 2116.4 0.00018960886 5.4054643e-05 + 28880 2117.8667 0.00018933429 5.4034314e-05 + 28900 2119.3333 0.00018906938 5.4008966e-05 + 28920 2120.8 0.00018881786 5.3978254e-05 + 28940 2122.2667 0.00018858319 5.3942187e-05 + 28960 2123.7333 0.00018836835 5.3901318e-05 + 28980 2125.2 0.00018817583 5.4169759e-05 + 29000 2126.6667 0.00018800763 5.4121319e-05 + 29020 2128.1333 0.00018786525 5.4070295e-05 + 29040 2129.6 0.00018774951 5.4018165e-05 + 29060 2131.0667 0.00018766058 5.3884893e-05 + 29080 2132.5333 0.00018759795 5.3876376e-05 + 29100 2134 0.00018756047 5.3823317e-05 + 29120 2135.4667 0.00018754627 5.3770657e-05 + 29140 2136.9333 0.00018755268 5.3718045e-05 + 29160 2138.4 0.00018757627 5.3665402e-05 + 29180 2139.8667 0.00018761287 5.3612408e-05 + 29200 2141.3333 0.00018765753 5.3558506e-05 + 29220 2142.8 0.0001877046 5.3503291e-05 + 29240 2144.2667 0.00018774817 5.3446796e-05 + 29260 2145.7333 0.00018778315 5.3389512e-05 + 29280 2147.2 0.00018780643 5.3332431e-05 + 29300 2148.6667 0.00018781742 5.3277223e-05 + 29320 2150.1333 0.00018781793 5.3226314e-05 + 29340 2151.6 0.00018781143 5.3176641e-05 + 29360 2153.0667 0.00018780238 5.3141246e-05 + 29380 2154.5333 0.00018779594 5.3117607e-05 + 29400 2156 0.00018779765 5.310825e-05 + 29420 2157.4667 0.0001878128 5.3115468e-05 + 29440 2158.9333 0.00018784561 5.3139946e-05 + 29460 2160.4 0.00018789868 5.288786e-05 + 29480 2161.8667 0.00018797309 5.294168e-05 + 29500 2163.3333 0.00018806883 5.3008359e-05 + 29520 2164.8 0.0001881852 5.3085712e-05 + 29540 2166.2667 0.000188321 5.317109e-05 + 29560 2167.7333 0.00018847475 5.3261964e-05 + 29580 2169.2 0.00018864479 5.3217461e-05 + 29600 2170.6667 0.00018882945 5.3313718e-05 + 29620 2172.1333 0.00018902706 5.3374367e-05 + 29640 2173.6 0.00018923607 5.347584e-05 + 29660 2175.0667 0.00018945509 5.3579085e-05 + 29680 2176.5333 0.000189683 5.3683544e-05 + 29700 2178 0.00018991893 5.3789562e-05 + 29720 2179.4667 0.00019016223 5.3898155e-05 + 29740 2180.9333 0.00019041244 5.4010173e-05 + 29760 2182.4 0.00019066923 5.4125994e-05 + 29780 2183.8667 0.00019093232 5.4245712e-05 + 29800 2185.3333 0.00019120142 5.436933e-05 + 29820 2186.8 0.00019147625 5.449677e-05 + 29840 2188.2667 0.00019175653 5.4627812e-05 + 29860 2189.7333 0.00019204205 5.476186e-05 + 29880 2191.2 0.00019233262 5.4897917e-05 + 29900 2192.6667 0.00019262806 5.5034988e-05 + 29920 2194.1333 0.00019292829 5.5172428e-05 + 29940 2195.6 0.00019323338 5.5309532e-05 + 29960 2197.0667 0.0001935435 5.5445368e-05 + 29980 2198.5333 0.00019385897 5.5579065e-05 + 30000 2200 0.00019418014 5.5710007e-05 +Loop time of 120.806 on 4 procs for 30000 steps with 3046 atoms + +Performance: 1573425.361 tau/day, 248.331 timesteps/s, 756.416 katom-step/s +99.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 | 0.89764 | 12.463 | 25.361 | 316.2 | 10.32 +Neigh | 0.083839 | 0.94363 | 1.8654 | 87.4 | 0.78 +Comm | 0.23436 | 0.25427 | 0.27244 | 2.9 | 0.21 +Output | 1.2745 | 2.0289 | 2.7205 | 46.3 | 1.68 +Modify | 88.101 | 92.266 | 95.765 | 34.6 | 76.38 +Other | | 12.85 | | | 10.64 + +Nlocal: 761.5 ave 1685 max 105 min +Histogram: 2 0 0 0 0 0 1 0 0 1 +Nghost: 28.5 ave 51 max 7 min +Histogram: 2 0 0 0 0 0 0 0 0 2 +Neighs: 6128.5 ave 14174 max 567 min +Histogram: 2 0 0 0 0 0 1 0 0 1 +FullNghs: 12164 ave 28184 max 1117 min +Histogram: 2 0 0 0 0 0 1 0 0 1 + +Total # of neighbors = 48656 +Ave neighs/atom = 15.973736 +Neighbor list builds = 3012 +Dangerous builds = 0 + +Total wall time: 0:02:00 diff --git a/examples/rheo/ice-cubes/in.rheo.ice.cubes b/examples/rheo/ice-cubes/in.rheo.ice.cubes index b023a8bac9..91e02c780d 100644 --- a/examples/rheo/ice-cubes/in.rheo.ice.cubes +++ b/examples/rheo/ice-cubes/in.rheo.ice.cubes @@ -77,5 +77,6 @@ compute nbond all nbond/atom thermo 200 thermo_style custom step time ke press atoms -dump 1 all custom 200 atomDump id type x y vx vy fx fy c_phase c_temp c_eng c_nbond c_rho +#dump 1 all custom 200 atomDump id type x y vx vy fx fy c_phase c_temp c_eng c_nbond c_rho + run 30000 diff --git a/examples/rheo/ice-cubes/log.17Apr2024.ice.g++.4 b/examples/rheo/ice-cubes/log.17Apr2024.ice.g++.4 new file mode 100644 index 0000000000..98fc2e7540 --- /dev/null +++ b/examples/rheo/ice-cubes/log.17Apr2024.ice.g++.4 @@ -0,0 +1,379 @@ +LAMMPS (17 Apr 2024 - Development - patch_5May2020-18508-g3c0eaf6870-modified) +# ------ 2D Ice Cube Pour ------ # + +dimension 2 +units lj +atom_style hybrid rheo/thermal bond +boundary m m p +comm_modify vel yes +newton off +special_bonds lj 0.0 1.0 1.0 coul 1.0 1.0 1.0 + +region box block -25 25 0 100 -0.01 0.01 units box +create_box 1 box bond/types 1 extra/bond/per/atom 15 extra/special/per/atom 50 +Created orthogonal box = (-25 0 -0.01) to (25 100 0.01) + 2 by 2 by 1 MPI processor grid + +region fluid block $(xlo+1) $(xhi-1) $(ylo+1) $(ylo+30) EDGE EDGE units box +region fluid block -24 $(xhi-1) $(ylo+1) $(ylo+30) EDGE EDGE units box +region fluid block -24 24 $(ylo+1) $(ylo+30) EDGE EDGE units box +region fluid block -24 24 1 $(ylo+30) EDGE EDGE units box +region fluid block -24 24 1 30 EDGE EDGE units box +lattice sq 1.0 +Lattice spacing in x,y,z = 1 1 1 +create_atoms 1 region fluid +Created 1470 atoms + using lattice units in orthogonal box = (-25 0 -0.01) to (25 100 0.01) + create_atoms CPU = 0.001 seconds + +set group all sph/e 8.0 +Setting atom values ... + 1470 settings made for sph/e + +# ------ Model parameters ------# + +variable cut equal 3.0 +variable n equal 1.0 +variable rho0 equal 1.0 +variable cs equal 1.0 +variable mp equal ${rho0}/${n} +variable mp equal 1/${n} +variable mp equal 1/1 +variable zeta equal 0.05 +variable kappa equal 0.01*${rho0}/${mp} +variable kappa equal 0.01*1/${mp} +variable kappa equal 0.01*1/1 +variable dt_max equal 0.1*${cut}/${cs}/3 +variable dt_max equal 0.1*3/${cs}/3 +variable dt_max equal 0.1*3/1/3 +variable eta equal 0.05 +variable Cv equal 1.0 +variable L equal 1.0 +variable Tf equal 1.0 + +mass * ${mp} +mass * 1 +timestep 0.1 + +pair_style hybrid/overlay rheo ${cut} artificial/visc ${zeta} rheo/solid +pair_style hybrid/overlay rheo 3 artificial/visc ${zeta} rheo/solid +pair_style hybrid/overlay rheo 3 artificial/visc 0.05 rheo/solid +pair_coeff * * rheo +pair_coeff * * rheo/solid 1.0 1.0 1.0 + +bond_style bpm/spring +bond_coeff 1 1.0 1.0 1.0 + +# ------ Pour particles ------# + +molecule my_mol "square.mol" +Read molecule template my_mol: +#Made with create_mol.py + 1 molecules + 0 fragments + 100 atoms with max type 1 + 342 bonds with max type 1 + 0 angles with max type 0 + 0 dihedrals with max type 0 + 0 impropers with max type 0 + +# Wall region extends far enough in z to avoid contact +region wall block EDGE EDGE EDGE EDGE -5 5 side in open 4 units box +region drop block -16 16 70 90 EDGE EDGE side in units box + +fix 1 all rheo ${cut} quintic 0 thermal shift surface/detection coordination 22 8 +fix 1 all rheo 3 quintic 0 thermal shift surface/detection coordination 22 8 +fix 2 all rheo/viscosity * constant ${eta} +fix 2 all rheo/viscosity * constant 0.05 +fix 3 all rheo/pressure * linear +fix 4 all rheo/thermal conductivity * constant ${kappa} specific/heat * constant ${Cv} Tfreeze * constant ${Tf} latent/heat * constant ${L} react 1.5 1 +fix 4 all rheo/thermal conductivity * constant 0.01 specific/heat * constant ${Cv} Tfreeze * constant ${Tf} latent/heat * constant ${L} react 1.5 1 +fix 4 all rheo/thermal conductivity * constant 0.01 specific/heat * constant 1 Tfreeze * constant ${Tf} latent/heat * constant ${L} react 1.5 1 +fix 4 all rheo/thermal conductivity * constant 0.01 specific/heat * constant 1 Tfreeze * constant 1 latent/heat * constant ${L} react 1.5 1 +fix 4 all rheo/thermal conductivity * constant 0.01 specific/heat * constant 1 Tfreeze * constant 1 latent/heat * constant 1 react 1.5 1 +fix 5 all wall/region wall harmonic 1.0 1.0 1.0 +fix 6 all gravity 5e-4 vector 0 -1 0 +fix 7 all deposit 8 0 1000 37241459 mol my_mol region drop near 2.0 vy -0.02 -0.02 +WARNING: Molecule attributes do not match system attributes (../molecule.cpp:1881) +fix 8 all enforce2d + +compute rho all rheo/property/atom rho +compute phase all rheo/property/atom phase +compute temp all rheo/property/atom temperature +compute eng all rheo/property/atom energy +compute nbond all nbond/atom + +# ------ Output & Run ------ # + +thermo 200 +thermo_style custom step time ke press atoms + +dump 1 all custom 200 atomDump id type x y vx vy fx fy c_phase c_temp c_eng c_nbond c_rho + +run 30000 + +CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE + +Your simulation uses code contributions which should be cited: + +- BPM bond style: doi:10.1039/D3SM01373A + +@Article{Clemmer2024, + author = {Clemmer, Joel T. and Monti, Joseph M. and Lechman, Jeremy B.}, + title = {A soft departure from jamming: the compaction of deformable + granular matter under high pressures}, + journal = {Soft Matter}, + year = 2024, + volume = 20, + number = 8, + pages = {1702--1718} +} + +- @article{PalermoInPrep, + journal = {in prep}, + title = {RHEO: A Hybrid Mesh-Free Model Framework for Dynamic Multi-Phase Flows}, + year = {2024}, + author = {Eric T. Palermo and Ki T. Wolf and Joel T. Clemmer and Thomas C. O'Connor}, +} + +- @article{ApplMathModel.130.310, + title = {A hybrid smoothed-particle hydrodynamics model of oxide skins on molten aluminum}, + journal = {Applied Mathematical Modelling}, + volume = {130}, + pages = {310-326}, + year = {2024}, + issn = {0307-904X}, + doi = {https://doi.org/10.1016/j.apm.2024.02.027}, + author = {Joel T. Clemmer and Flint Pierce and Thomas C. O'Connor and Thomas D. Nevins and Elizabeth M.C. Jones and Jeremy B. Lechman and John Tencer}, +} + +CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE + +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 = 3.3 + ghost atom cutoff = 3.3 + binsize = 1.65, bins = 31 61 1 + 7 neighbor lists, perpetual/occasional/extra = 6 1 0 + (1) pair rheo, perpetual, half/full from (3) + attributes: half, newton off + pair build: halffull/newtoff + stencil: none + bin: none + (2) pair rheo/solid, perpetual, trim from (4) + attributes: half, newton off, cut 1.3 + pair build: trim + stencil: none + bin: none + (3) compute RHEO/KERNEL, perpetual + attributes: full, newton off + pair build: full/bin + stencil: full/bin/2d + bin: standard + (4) compute RHEO/GRAD, perpetual, copy from (1) + attributes: half, newton off + pair build: copy + stencil: none + bin: none + (5) compute RHEO/VSHIFT, perpetual, copy from (1) + attributes: half, newton off + pair build: copy + stencil: none + bin: none + (6) compute RHEO/SURFACE, perpetual, copy from (1) + attributes: half, newton off + pair build: copy + stencil: none + bin: none + (7) fix rheo/thermal, occasional, trim from (4) + attributes: half, newton off, cut 3 + pair build: trim + stencil: none + bin: none +Per MPI rank memory allocation (min/avg/max) = 15.53 | 15.61 | 15.69 Mbytes + Step Time KinEng Press Atoms + 0 0 0 0 1470 + 200 20 5.6002982e-05 3.4434234e-05 1570 + 400 40 8.2173099e-05 8.6171768e-05 1570 + 600 60 8.019018e-05 0.00010750355 1570 + 800 80 0.00013866953 0.00010265608 1570 + 1000 100 0.00018965028 8.1985605e-05 1570 + 1200 120 0.00022033242 7.4736443e-05 1670 + 1400 140 0.00030767062 0.00011264333 1670 + 1600 160 0.00040770127 0.00018779992 1670 + 1800 180 0.00047476332 0.00023153009 1670 + 2000 200 0.00059116774 0.00027200445 1670 + 2200 220 0.0007151733 0.0002919963 1770 + 2400 240 0.00083392135 0.00029757889 1770 + 2600 260 0.00099653466 0.00036547269 1770 + 2800 280 0.0011964069 0.00045983458 1770 + 3000 300 0.0013716953 0.00055013647 1770 + 3200 320 0.0015174096 0.00064203572 1870 + 3400 340 0.0016539743 0.00086671622 1870 + 3600 360 0.0015887858 0.00066353749 1870 + 3800 380 0.0016451684 0.00070551483 1870 + 4000 400 0.0017330971 0.00080722283 1870 + 4200 420 0.001812193 0.00073573903 1970 + 4400 440 0.001755871 0.0010621909 1970 + 4600 460 0.0016190772 0.00072913706 1970 + 4800 480 0.0015741931 0.00073524088 1970 + 5000 500 0.0016488815 0.00088684275 1970 + 5200 520 0.0017213288 0.00077042378 2070 + 5400 540 0.0018509598 0.0010219434 2070 + 5600 560 0.0020251064 0.00083182483 2070 + 5800 580 0.0022473255 0.00095076144 2070 + 6000 600 0.0024843519 0.0011247014 2070 + 6200 620 0.0022282321 0.0018105932 2170 + 6400 640 0.0020289063 0.0014158497 2170 + 6600 660 0.002145241 0.0011359383 2170 + 6800 680 0.0024313937 0.0016475504 2170 + 7000 700 0.0021000599 0.0020983745 2170 + 7200 720 0.0019137235 0.0010439152 2270 + 7400 740 0.0018801367 0.00095436448 2270 + 7600 760 0.0017979449 0.0011184039 2270 + 7800 780 0.0018005205 0.0009243205 2270 + 8000 800 0.0017827073 0.0013671228 2270 + 8200 820 0.0018387108 0.0015426012 2270 + 8400 840 0.0016000788 0.0016751514 2270 + 8600 860 0.0013954964 0.0016884335 2270 + 8800 880 0.0013283728 0.0012399398 2270 + 9000 900 0.001389385 0.0012968496 2270 + 9200 920 0.0012295438 0.0012995821 2270 + 9400 940 0.0010522655 0.00082245528 2270 + 9600 960 0.00097085496 0.00053833131 2270 + 9800 980 0.0009398987 0.00063467387 2270 + 10000 1000 0.00092710392 0.00059494446 2270 + 10200 1020 0.00095545471 0.00074560644 2270 + 10400 1040 0.0009645841 0.00085429807 2270 + 10600 1060 0.00064037148 0.0017222246 2270 + 10800 1080 0.00046790978 0.00088204234 2270 + 11000 1100 0.00030106229 0.00074950209 2270 + 11200 1120 0.00027746016 0.00052831745 2270 + 11400 1140 0.0002533348 0.0006272715 2270 + 11600 1160 0.00021825085 0.00029691552 2270 + 11800 1180 0.0001451308 0.00015037478 2270 + 12000 1200 0.0001314823 0.00017227174 2270 + 12200 1220 0.00013693632 0.00017791384 2270 + 12400 1240 0.00014987347 0.0002286677 2270 + 12600 1260 0.00015092598 0.0003698436 2270 + 12800 1280 0.0001291653 0.00047229532 2270 + 13000 1300 0.00011949988 0.00049560375 2270 + 13200 1320 0.00011694665 0.00057542084 2270 + 13400 1340 9.6164519e-05 0.00062714755 2270 + 13600 1360 8.4517591e-05 0.00044156913 2270 + 13800 1380 0.00019140516 0.0003264745 2270 + 14000 1400 0.00013868599 0.00037753497 2270 + 14200 1420 9.3701636e-05 0.00031517848 2270 + 14400 1440 6.7389077e-05 0.0002946861 2270 + 14600 1460 5.3640086e-05 0.00026650711 2270 + 14800 1480 4.2699992e-05 0.00023789279 2270 + 15000 1500 5.3012016e-05 0.00019933234 2270 + 15200 1520 5.8834197e-05 0.00022407007 2270 + 15400 1540 5.0899982e-05 0.00029695531 2270 + 15600 1560 3.0476742e-05 0.00039119066 2270 + 15800 1580 1.6633264e-05 0.00033770401 2270 + 16000 1600 1.098906e-05 0.00036684894 2270 + 16200 1620 1.464848e-05 0.00036449759 2270 + 16400 1640 1.9598429e-05 0.00021056689 2270 + 16600 1660 1.2644955e-05 0.00020781781 2270 + 16800 1680 8.8428553e-06 0.000165 2270 + 17000 1700 8.8971439e-06 0.00012266475 2270 + 17200 1720 1.7032781e-05 0.00019873443 2270 + 17400 1740 1.9448563e-05 0.00025661663 2270 + 17600 1760 1.3714713e-05 0.000324022 2270 + 17800 1780 9.1326468e-06 0.00031392513 2270 + 18000 1800 9.2464802e-06 0.00029729527 2270 + 18200 1820 1.5553042e-05 0.00027488475 2270 + 18400 1840 1.4132933e-05 0.00019565459 2270 + 18600 1860 9.4734832e-06 0.00016716988 2270 + 18800 1880 5.5115145e-06 0.00013728033 2270 + 19000 1900 8.268812e-06 0.00015119605 2270 + 19200 1920 1.2470136e-05 0.00020222131 2270 + 19400 1940 9.9387775e-06 0.00024503373 2270 + 19600 1960 5.4241999e-06 0.00026921858 2270 + 19800 1980 2.7987348e-06 0.00026201267 2270 + 20000 2000 6.272538e-06 0.00025626323 2270 + 20200 2020 8.0157781e-06 0.000220139 2270 + 20400 2040 6.1652093e-06 0.00017089058 2270 + 20600 2060 2.9967592e-06 0.00014582864 2270 + 20800 2080 3.016678e-06 0.000148629 2270 + 21000 2100 7.287645e-06 0.00016486102 2270 + 21200 2120 8.6905277e-06 0.00020276916 2270 + 21400 2140 6.8453018e-06 0.00023156153 2270 + 21600 2160 3.3853799e-06 0.0002432462 2270 + 21800 2180 4.1241209e-06 0.00022829024 2270 + 22000 2200 7.0802396e-06 0.00020784823 2270 + 22200 2220 7.3361691e-06 0.00018114134 2270 + 22400 2240 5.0764593e-06 0.00014351106 2270 + 22600 2260 2.7487537e-06 0.00012919872 2270 + 22800 2280 4.620167e-06 0.00013746218 2270 + 23000 2300 6.9819357e-06 0.00015985102 2270 + 23200 2320 6.8923916e-06 0.00018713045 2270 + 23400 2340 4.1795088e-06 0.00019846682 2270 + 23600 2360 2.2871028e-06 0.00021068421 2270 + 23800 2380 3.862046e-06 0.00019553306 2270 + 24000 2400 5.2448555e-06 0.00017398041 2270 + 24200 2420 4.7565441e-06 0.00015008142 2270 + 24400 2440 2.2952135e-06 0.00012747106 2270 + 24600 2460 2.1575617e-06 0.00012516996 2270 + 24800 2480 4.1777868e-06 0.0001331902 2270 + 25000 2500 5.5679133e-06 0.00015504562 2270 + 25200 2520 4.5758741e-06 0.00017146032 2270 + 25400 2540 2.3403277e-06 0.00017611666 2270 + 25600 2560 2.7029302e-06 0.00016850788 2270 + 25800 2580 4.3601102e-06 0.00015884642 2270 + 26000 2600 5.2244249e-06 0.00013793898 2270 + 26200 2620 3.4577672e-06 0.00012395875 2270 + 26400 2640 2.361577e-06 0.00011600057 2270 + 26600 2660 2.8515644e-06 0.00011277063 2270 + 26800 2680 4.0851213e-06 0.0001290832 2270 + 27000 2700 4.2579644e-06 0.0001476495 2270 + 27200 2720 2.6593858e-06 0.00015977745 2270 + 27400 2740 1.990115e-06 0.00015612787 2270 + 27600 2760 2.6756835e-06 0.00014913772 2270 + 27800 2780 3.9032806e-06 0.00014014763 2270 + 28000 2800 3.2729446e-06 0.00012216846 2270 + 28200 2820 1.9357278e-06 0.00011078621 2270 + 28400 2840 1.7094832e-06 0.00010910509 2270 + 28600 2860 2.8731406e-06 0.00011179644 2270 + 28800 2880 3.7062354e-06 0.00012254091 2270 + 29000 2900 2.7844262e-06 0.00013060331 2270 + 29200 2920 1.7680655e-06 0.00013797514 2270 + 29400 2940 1.706873e-06 0.0001350685 2270 + 29600 2960 2.8764562e-06 0.00012428508 2270 + 29800 2980 3.1502029e-06 0.00011456718 2270 + 30000 3000 2.1833409e-06 0.00010317469 2270 +Loop time of 165.611 on 4 procs for 30000 steps with 2270 atoms + +Performance: 1565111.240 tau/day, 181.147 timesteps/s, 411.204 katom-step/s +99.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 | 0.63183 | 21.226 | 42.266 | 444.6 | 12.82 +Bond | 0.095073 | 0.17799 | 0.27877 | 17.0 | 0.11 +Neigh | 2.0745 | 2.0781 | 2.0822 | 0.2 | 1.25 +Comm | 0.32024 | 0.38703 | 0.45564 | 8.1 | 0.23 +Output | 0.60459 | 0.76798 | 0.93724 | 18.6 | 0.46 +Modify | 119.85 | 140.76 | 161.36 | 172.2 | 85.00 +Other | | 0.2124 | | | 0.13 + +Nlocal: 567.5 ave 1139 max 0 min +Histogram: 2 0 0 0 0 0 0 0 0 2 +Nghost: 75.5 ave 152 max 0 min +Histogram: 2 0 0 0 0 0 0 0 0 2 +Neighs: 9238.25 ave 18490 max 0 min +Histogram: 2 0 0 0 0 0 0 0 0 2 +FullNghs: 17945 ave 35917 max 0 min +Histogram: 2 0 0 0 0 0 0 0 0 2 + +Total # of neighbors = 71780 +Ave neighs/atom = 31.621145 +Ave special neighs/atom = 0.22026432 +Neighbor list builds = 2071 +Dangerous builds = 0 + +Total wall time: 0:02:45 diff --git a/examples/rheo/oxidation/in.rheo.oxidation b/examples/rheo/oxidation/in.rheo.oxidation index d26b379adb..d8b4b1a464 100644 --- a/examples/rheo/oxidation/in.rheo.oxidation +++ b/examples/rheo/oxidation/in.rheo.oxidation @@ -98,5 +98,6 @@ compute nbond_solid all nbond/atom bond/type 1 thermo 200 thermo_style custom step time ke press atoms -dump 1 all custom 200 atomDump id type x y vx vy fx fy c_phase c_temp c_eng c_nbond_solid c_nbond_shell c_rho c_surf c_status +#dump 1 all custom 200 atomDump id type x y vx vy fx fy c_phase c_temp c_eng c_nbond_solid c_nbond_shell c_rho c_surf c_status + run 40000 diff --git a/examples/rheo/oxidation/log.17Apr2024.oxidation.g++.4 b/examples/rheo/oxidation/log.17Apr2024.oxidation.g++.4 new file mode 100644 index 0000000000..92eb4aa94a --- /dev/null +++ b/examples/rheo/oxidation/log.17Apr2024.oxidation.g++.4 @@ -0,0 +1,488 @@ +LAMMPS (17 Apr 2024 - Development - patch_5May2020-18508-g3c0eaf6870-modified) +# ------ 2D oxidizing bar ------ # + +dimension 2 +units lj +atom_style hybrid rheo/thermal bond +boundary m m p +comm_modify vel yes +newton off + +region box block -60 60 0 80 -0.01 0.01 units box +create_box 3 box bond/types 2 extra/bond/per/atom 20 extra/special/per/atom 50 +Created orthogonal box = (-60 0 -0.01) to (60 80 0.01) + 2 by 2 by 1 MPI processor grid + +region lbar block -15 0 3 80 EDGE EDGE units box +region rbar block 0 15 3 80 EDGE EDGE units box +region bar union 2 lbar rbar +region floor block EDGE EDGE EDGE 3.0 EDGE EDGE units box + +lattice hex 1.0 +Lattice spacing in x,y,z = 1.0745699 1.8612097 1.0745699 +create_atoms 1 region bar +Created 2255 atoms + using lattice units in orthogonal box = (-60 0 -0.01) to (60 80 0.01) + create_atoms CPU = 0.001 seconds +create_atoms 3 region floor +Created 446 atoms + using lattice units in orthogonal box = (-60 0 -0.01) to (60 80 0.01) + create_atoms CPU = 0.000 seconds + +set region rbar type 2 +Setting atom values ... + 1148 settings made for type +group bar type 1 2 +2255 atoms in group bar +group rbar type 2 +1148 atoms in group rbar +group floor type 3 +446 atoms in group floor + +set group all sph/e 0.0 +Setting atom values ... + 2701 settings made for sph/e +set group all rheo/status 1 +Setting atom values ... + 2701 settings made for rheo/status + +# ------ Model parameters ------# + +variable cut equal 3.0 +variable n equal 1.0 +variable rho0 equal 1.0 +variable cs equal 1.0 +variable mp equal ${rho0}/${n} +variable mp equal 1/${n} +variable mp equal 1/1 +variable zeta equal 0.05 +variable kappa equal 0.1*${rho0}/${mp} +variable kappa equal 0.1*1/${mp} +variable kappa equal 0.1*1/1 +variable dt_max equal 0.1*${cut}/${cs}/3 +variable dt_max equal 0.1*3/${cs}/3 +variable dt_max equal 0.1*3/1/3 +variable eta equal 0.05 +variable Cv equal 1.0 +variable L equal 0.1 +variable Tf equal 1.0 + +mass * ${mp} +mass * 1 +timestep 0.1 + +pair_style hybrid/overlay rheo ${cut} artificial/visc ${zeta} rheo/solid +pair_style hybrid/overlay rheo 3 artificial/visc ${zeta} rheo/solid +pair_style hybrid/overlay rheo 3 artificial/visc 0.05 rheo/solid +pair_coeff * * rheo +pair_coeff * * rheo/solid 1.0 1.0 1.0 + +special_bonds lj 0.0 1.0 1.0 coul 0.0 1.0 1.0 +Finding 1-2 1-3 1-4 neighbors ... + special bond factors lj: 0 1 1 + special bond factors coul: 0 1 1 + 0 = max # of 1-2 neighbors + 101 = max # of special neighbors + special bonds CPU = 0.000 seconds +create_bonds many bar bar 1 0 1.5 +Generated 0 of 3 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 = 3.3 + ghost atom cutoff = 3.3 + binsize = 1.65, bins = 73 49 1 + 3 neighbor lists, perpetual/occasional/extra = 2 1 0 + (1) command create_bonds, occasional + attributes: full, newton off + pair build: full/bin + stencil: full/bin/2d + bin: standard + (2) pair rheo, perpetual + attributes: half, newton off + pair build: half/bin/newtoff + stencil: full/bin/2d + bin: standard + (3) pair rheo/solid, perpetual, trim from (2) + attributes: half, newton off, cut 1.3 + pair build: trim + stencil: none + bin: none +Added 6547 bonds, new total = 6547 +Finding 1-2 1-3 1-4 neighbors ... + special bond factors lj: 0 1 1 + special bond factors coul: 0 1 1 + 6 = max # of 1-2 neighbors + 101 = max # of special neighbors + special bonds CPU = 0.000 seconds +special_bonds lj 0.0 1.0 1.0 coul 1.0 1.0 1.0 + +bond_style hybrid bpm/spring rheo/shell t/form 100 +bond_coeff 1 bpm/spring 1.0 1.0 1.0 +bond_coeff 2 rheo/shell 0.2 0.2 0.1 + +# ------ Apply dynamics ------# + +# Note: surface detection is not performed on solid bodies, so cannot use surface property +compute coord all rheo/property/atom coordination +variable surf atom c_coord<22 +group surf dynamic all var surf every 10 +dynamic group surf defined + +fix 1 all rheo ${cut} quintic 0 thermal shift surface/detection coordination 22 8 +fix 1 all rheo 3 quintic 0 thermal shift surface/detection coordination 22 8 +fix 2 all rheo/viscosity * constant ${eta} +fix 2 all rheo/viscosity * constant 0.05 +fix 3 all rheo/pressure * linear +fix 4 all rheo/thermal conductivity * constant ${kappa} specific/heat * constant ${Cv} Tfreeze * constant ${Tf} latent/heat * constant ${L} react 1.5 1 +fix 4 all rheo/thermal conductivity * constant 0.1 specific/heat * constant ${Cv} Tfreeze * constant ${Tf} latent/heat * constant ${L} react 1.5 1 +fix 4 all rheo/thermal conductivity * constant 0.1 specific/heat * constant 1 Tfreeze * constant ${Tf} latent/heat * constant ${L} react 1.5 1 +fix 4 all rheo/thermal conductivity * constant 0.1 specific/heat * constant 1 Tfreeze * constant 1 latent/heat * constant ${L} react 1.5 1 +fix 4 all rheo/thermal conductivity * constant 0.1 specific/heat * constant 1 Tfreeze * constant 1 latent/heat * constant 0.1 react 1.5 1 + +fix 5 rbar rheo/oxidation 1.5 2 1.0 +fix 6 all wall/harmonic ylo EDGE 2.0 1.0 1.0 +fix 7 all gravity 5e-5 vector 0 -1 0 +fix 8 floor setforce 0.0 0.0 0.0 +fix 9 surf add/heat linear 1.1 0.05 +fix 10 floor add/heat constant 0 overwrite yes # fix the temperature of the floor +fix 11 all enforce2d + +compute surf all rheo/property/atom surface +compute rho all rheo/property/atom rho +compute phase all rheo/property/atom phase +compute status all rheo/property/atom status +compute temp all rheo/property/atom temperature +compute eng all rheo/property/atom energy +compute nbond_shell all rheo/property/atom nbond/shell +compute nbond_solid all nbond/atom bond/type 1 + +# ------ Output & Run ------ # + +thermo 200 +thermo_style custom step time ke press atoms + +dump 1 all custom 200 atomDump id type x y vx vy fx fy c_phase c_temp c_eng c_nbond_solid c_nbond_shell c_rho c_surf c_status + +run 40000 + +CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE + +Your simulation uses code contributions which should be cited: + +- BPM bond style: doi:10.1039/D3SM01373A + +@Article{Clemmer2024, + author = {Clemmer, Joel T. and Monti, Joseph M. and Lechman, Jeremy B.}, + title = {A soft departure from jamming: the compaction of deformable + granular matter under high pressures}, + journal = {Soft Matter}, + year = 2024, + volume = 20, + number = 8, + pages = {1702--1718} +} + +- @article{PalermoInPrep, + journal = {in prep}, + title = {RHEO: A Hybrid Mesh-Free Model Framework for Dynamic Multi-Phase Flows}, + year = {2024}, + author = {Eric T. Palermo and Ki T. Wolf and Joel T. Clemmer and Thomas C. O'Connor}, +} + +- @article{ApplMathModel.130.310, + title = {A hybrid smoothed-particle hydrodynamics model of oxide skins on molten aluminum}, + journal = {Applied Mathematical Modelling}, + volume = {130}, + pages = {310-326}, + year = {2024}, + issn = {0307-904X}, + doi = {https://doi.org/10.1016/j.apm.2024.02.027}, + author = {Joel T. Clemmer and Flint Pierce and Thomas C. O'Connor and Thomas D. Nevins and Elizabeth M.C. Jones and Jeremy B. Lechman and John Tencer}, +} + +CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE + +Generated 0 of 3 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 = 3.3 + ghost atom cutoff = 3.3 + binsize = 1.65, bins = 73 49 1 + 8 neighbor lists, perpetual/occasional/extra = 7 1 0 + (1) pair rheo, perpetual, half/full from (3) + attributes: half, newton off + pair build: halffull/newtoff + stencil: none + bin: none + (2) pair rheo/solid, perpetual, trim from (4) + attributes: half, newton off, cut 1.3 + pair build: trim + stencil: none + bin: none + (3) compute RHEO/KERNEL, perpetual + attributes: full, newton off + pair build: full/bin + stencil: full/bin/2d + bin: standard + (4) compute RHEO/GRAD, perpetual, copy from (1) + attributes: half, newton off + pair build: copy + stencil: none + bin: none + (5) compute RHEO/VSHIFT, perpetual, copy from (1) + attributes: half, newton off + pair build: copy + stencil: none + bin: none + (6) compute RHEO/SURFACE, perpetual, copy from (1) + attributes: half, newton off + pair build: copy + stencil: none + bin: none + (7) fix rheo/thermal, occasional, trim from (4) + attributes: half, newton off, cut 3 + pair build: trim + stencil: none + bin: none + (8) fix rheo/oxidation, perpetual, trim from (3) + attributes: full, newton off, cut 1.8 + pair build: trim + stencil: none + bin: none +Per MPI rank memory allocation (min/avg/max) = 25.96 | 25.96 | 25.96 Mbytes + Step Time KinEng Press Atoms + 0 0 0 0 2701 + 200 20 4.1743799e-07 1.1743617e-07 2701 + 400 40 1.6697519e-06 4.6974469e-07 2701 + 600 60 3.7127333e-06 1.0646825e-05 2701 + 800 80 4.6683656e-06 0.00015182605 2701 + 1000 100 4.7368707e-06 0.00028128761 2701 + 1200 120 3.4384322e-06 0.00045913378 2701 + 1400 140 1.4119866e-06 0.00055627091 2701 + 1600 160 4.4114517e-07 0.00058247308 2701 + 1800 180 4.8289229e-07 0.0005510948 2701 + 2000 200 1.8494183e-06 0.00048386222 2701 + 2200 220 3.3319816e-06 0.00037903264 2701 + 2400 240 3.8128922e-06 0.00024115906 2701 + 2600 260 3.1943401e-06 9.727407e-05 2701 + 2800 280 1.6172816e-06 -2.632162e-05 2701 + 3000 300 3.6100709e-07 -8.5761867e-05 2701 + 3200 320 1.4745502e-07 -5.9204127e-05 2701 + 3400 340 8.3369782e-07 8.8312464e-07 2701 + 3600 360 2.0484052e-06 5.8521477e-05 2701 + 3800 380 3.1639387e-06 0.0001685663 2701 + 4000 400 3.1692907e-06 0.00026875988 2701 + 4200 420 2.391933e-06 0.00038621787 2701 + 4400 440 1.1964404e-06 0.00048901286 2701 + 4600 460 4.0508824e-07 0.00051863639 2701 + 4800 480 5.4908507e-07 0.00049263754 2701 + 5000 500 1.3139665e-06 0.00041984264 2701 + 5200 520 2.1939161e-06 0.00033095351 2701 + 5400 540 2.3687031e-06 0.00022422981 2701 + 5600 560 1.8280882e-06 0.00011544328 2701 + 5800 580 8.8610517e-07 2.9307791e-05 2701 + 6000 600 2.0989359e-07 -1.7340941e-05 2701 + 6200 620 2.8658301e-07 -8.1237835e-06 2701 + 6400 640 9.7636239e-07 4.3755922e-05 2701 + 6600 660 1.891303e-06 0.0001185719 2701 + 6800 680 2.4149904e-06 0.00020830273 2701 + 7000 700 2.3174953e-06 0.00030114767 2701 + 7200 720 1.7918612e-06 0.00037821537 2701 + 7400 740 1.2114987e-06 0.0004233475 2701 + 7600 760 9.9661553e-07 0.00042958263 2701 + 7800 780 1.1552559e-06 0.00039944618 2701 + 8000 800 1.5249138e-06 0.00034034478 2701 + 8200 820 1.7453861e-06 0.00026826463 2701 + 8400 840 1.6259021e-06 0.00019131768 2701 + 8600 860 1.2612805e-06 0.0001162957 2701 + 8800 880 8.6964518e-07 7.1771506e-05 2701 + 9000 900 7.6892472e-07 5.6170687e-05 2701 + 9200 920 1.0780045e-06 7.1925995e-05 2701 + 9400 940 1.6514902e-06 0.00011635293 2701 + 9600 960 2.1891377e-06 0.00017599885 2701 + 9800 980 2.4551701e-06 0.00024127934 2701 + 10000 1000 2.4277051e-06 0.00029918622 2701 + 10200 1020 2.2655987e-06 0.00034067996 2701 + 10400 1040 2.1767207e-06 0.00035598133 2701 + 10600 1060 2.2796719e-06 0.00034359076 2701 + 10800 1080 2.4884225e-06 0.00030749714 2701 + 11000 1100 2.6387215e-06 0.00025725198 2701 + 11200 1120 2.5968908e-06 0.00020170699 2701 + 11400 1140 2.4108931e-06 0.00015185858 2701 + 11600 1160 2.2375166e-06 0.00011800349 2701 + 11800 1180 2.2407196e-06 0.00010646971 2701 + 12000 1200 2.4845263e-06 0.00011817498 2701 + 12200 1220 2.8733204e-06 0.00015013186 2701 + 12400 1240 3.2437087e-06 0.00019211975 2701 + 12600 1260 3.4732728e-06 0.00023620276 2701 + 12800 1280 3.5836611e-06 0.00027352269 2701 + 13000 1300 3.6592211e-06 0.00029533734 2701 + 13200 1320 3.782506e-06 0.00030032559 2701 + 13400 1340 3.9807086e-06 0.00028395722 2701 + 13600 1360 4.2023176e-06 0.00025390325 2701 + 13800 1380 4.3559781e-06 0.00021794236 2701 + 14000 1400 4.4273371e-06 0.00018026034 2701 + 14200 1420 4.49867e-06 0.0001526569 2701 + 14400 1440 4.6591574e-06 0.00013707051 2701 + 14600 1460 4.9589583e-06 0.00013803875 2701 + 14800 1480 5.3859375e-06 0.00015455425 2701 + 15000 1500 5.8639557e-06 0.00017954785 2701 + 15200 1520 6.3075561e-06 0.0002084257 2701 + 15400 1540 6.7022179e-06 0.0002347669 2701 + 15600 1560 7.0789688e-06 0.00025020766 2701 + 15800 1580 7.4734777e-06 0.00025394845 2701 + 16000 1600 7.8884743e-06 0.00024571725 2701 + 16200 1620 8.3224059e-06 0.00022706648 2701 + 16400 1640 8.7337783e-06 0.00020320706 2701 + 16600 1660 9.1454649e-06 0.00017824346 2701 + 16800 1680 9.5948793e-06 0.00015961835 2701 + 17000 1700 1.0106407e-05 0.00015135471 2701 + 17200 1720 1.0707273e-05 0.00015166884 2701 + 17400 1740 1.1392597e-05 0.0001645916 2701 + 17600 1760 1.2118829e-05 0.00018119729 2701 + 17800 1780 1.2846056e-05 0.0002003616 2701 + 18000 1800 1.3555288e-05 0.00021585952 2701 + 18200 1820 1.4301024e-05 0.00022290158 2701 + 18400 1840 1.5089217e-05 0.00021970192 2701 + 18600 1860 1.5902351e-05 0.00020911128 2701 + 18800 1880 1.6753175e-05 0.00019278718 2701 + 19000 1900 1.7602996e-05 0.00017584076 2701 + 19200 1920 1.8479378e-05 0.00016206226 2701 + 19400 1940 1.9421603e-05 0.00015575677 2701 + 19600 1960 2.0477421e-05 0.00015687558 2701 + 19800 1980 2.1617288e-05 0.00016424998 2701 + 20000 2000 2.2814347e-05 0.00017466664 2701 + 20200 2020 2.4029097e-05 0.00018647149 2701 + 20400 2040 2.5255953e-05 0.00019516077 2701 + 20600 2060 2.649418e-05 0.00019906384 2701 + 20800 2080 2.7755897e-05 0.00019630586 2701 + 21000 2100 2.9067854e-05 0.00018674721 2701 + 21200 2120 3.0396477e-05 0.0001758048 2701 + 21400 2140 3.1759719e-05 0.00016782801 2701 + 21600 2160 3.3193597e-05 0.00016324138 2701 + 21800 2180 3.4729384e-05 0.00016124274 2701 + 22000 2200 3.6367594e-05 0.00016437457 2701 + 22200 2220 3.8095131e-05 0.00017015573 2701 + 22400 2240 3.9867003e-05 0.00017649465 2701 + 22600 2260 4.169511e-05 0.00018111374 2701 + 22800 2280 4.3566134e-05 0.00018104136 2701 + 23000 2300 4.5461538e-05 0.00017822707 2701 + 23200 2320 4.7377333e-05 0.00017285066 2701 + 23400 2340 4.9354403e-05 0.00016826524 2701 + 23600 2360 5.1399791e-05 0.00016517913 2701 + 23800 2380 5.3510931e-05 0.00016299649 2701 + 24000 2400 5.5681048e-05 0.00016256674 2701 + 24200 2420 5.7902429e-05 0.00016513449 2701 + 24400 2440 6.0216049e-05 0.00016895109 2701 + 24600 2460 6.270982e-05 0.00016946227 2701 + 24800 2480 6.5390117e-05 0.00016589426 2701 + 25000 2500 6.8121899e-05 0.00016241676 2701 + 25200 2520 7.0947331e-05 0.00015624292 2701 + 25400 2540 7.4304148e-05 0.0001449537 2701 + 25600 2560 7.7745077e-05 0.00013179658 2701 + 25800 2580 8.0739829e-05 0.00013098838 2701 + 26000 2600 8.3827874e-05 0.00014278841 2701 + 26200 2620 8.7060677e-05 0.00015381649 2701 + 26400 2640 9.0266508e-05 0.00016130999 2701 + 26600 2660 9.3339049e-05 0.00016908268 2701 + 26800 2680 9.6347013e-05 0.00016771087 2701 + 27000 2700 9.9294711e-05 0.00016577315 2701 + 27200 2720 0.00010230007 0.0001670893 2701 + 27400 2740 0.00010547172 0.00016569077 2701 + 27600 2760 0.00010872426 0.00016506303 2701 + 27800 2780 0.00011201844 0.00016482702 2701 + 28000 2800 0.00011532129 0.00016694886 2701 + 28200 2820 0.00011869854 0.00016163005 2701 + 28400 2840 0.00012209747 0.00015339281 2701 + 28600 2860 0.00012549322 0.00014765883 2701 + 28800 2880 0.00012898685 0.00014241765 2701 + 29000 2900 0.00013259039 0.00014215724 2701 + 29200 2920 0.00013628209 0.00014881155 2701 + 29400 2940 0.00014001213 0.00015671333 2701 + 29600 2960 0.00014379216 0.00016446215 2701 + 29800 2980 0.00014764687 0.0001639602 2701 + 30000 3000 0.00015142301 0.00015664816 2701 + 30200 3020 0.00015496407 0.00015545099 2701 + 30400 3040 0.00015797338 0.00015368625 2701 + 30600 3060 0.00016042141 0.00015679918 2701 + 30800 3080 0.00016244716 0.00016093678 2701 + 31000 3100 0.00016202247 0.00016066954 2701 + 31200 3120 0.0001613312 0.00015932059 2701 + 31400 3140 0.00016274961 0.00015988567 2701 + 31600 3160 0.00016541518 0.00015724809 2701 + 31800 3180 0.00016809362 0.00015498827 2701 + 32000 3200 0.00017067801 0.00014830489 2701 + 32200 3220 0.00017333906 0.00014371345 2701 + 32400 3240 0.0001759011 0.00014421259 2701 + 32600 3260 0.00017849952 0.00014228443 2701 + 32800 3280 0.00017801812 0.00014117391 2701 + 33000 3300 0.00017718857 0.00014644675 2701 + 33200 3320 0.00017833666 0.0001291286 2701 + 33400 3340 0.000178576 0.00014878558 2701 + 33600 3360 0.00017846711 0.00013905481 2701 + 33800 3380 0.00017822937 0.00015535996 2701 + 34000 3400 0.00017899663 0.00016094303 2701 + 34200 3420 0.00017924661 0.00015017553 2701 + 34400 3440 0.00018024855 0.00014723549 2701 + 34600 3460 0.00018143865 0.00013903131 2701 + 34800 3480 0.00018258173 0.00013722112 2701 + 35000 3500 0.00018404873 0.00014675949 2701 + 35200 3520 0.00018538521 0.00015108242 2701 + 35400 3540 0.00018669649 0.00014564852 2701 + 35600 3560 0.00018814608 0.00013762161 2701 + 35800 3580 0.00018967415 0.00014602307 2701 + 36000 3600 0.00019146735 0.000126909 2701 + 36200 3620 0.00019414036 0.00012384379 2701 + 36400 3640 0.00019613057 0.00011059573 2701 + 36600 3660 0.00019897104 0.00013621801 2701 + 36800 3680 0.00020169688 0.00013665462 2701 + 37000 3700 0.00020447655 0.00013929258 2701 + 37200 3720 0.00020711105 0.0001363895 2701 + 37400 3740 0.00021077854 0.00013610672 2701 + 37600 3760 0.00021303084 0.00015051235 2701 + 37800 3780 0.00021619561 0.00012664801 2701 + 38000 3800 0.0002194018 0.00012808247 2701 + 38200 3820 0.00022242646 0.0001360174 2701 + 38400 3840 0.00022531568 0.00013311221 2701 + 38600 3860 0.00022821731 0.00013523939 2701 + 38800 3880 0.000231228 0.00014090695 2701 + 39000 3900 0.00023404038 0.00013661835 2701 + 39200 3920 0.00023755044 0.00013659469 2701 + 39400 3940 0.00024009059 0.00012097907 2701 + 39600 3960 0.0002432098 9.7877876e-05 2701 + 39800 3980 0.00024475294 0.0001164688 2701 + 40000 4000 0.00024171274 0.00012432219 2701 +Loop time of 192.659 on 4 procs for 40000 steps with 2701 atoms + +Performance: 1793840.118 tau/day, 207.620 timesteps/s, 560.783 katom-step/s +99.6% CPU use with 4 MPI tasks x no OpenMP threads + +MPI task timing breakdown: +Section | min time | avg time | max time |%varavg| %total +--------------------------------------------------------------- +Pair | 16.881 | 24.402 | 30.74 | 114.6 | 12.67 +Bond | 1.1126 | 1.8917 | 2.6935 | 43.3 | 0.98 +Neigh | 35.387 | 35.508 | 35.625 | 1.5 | 18.43 +Comm | 1.5499 | 1.6694 | 1.8006 | 7.4 | 0.87 +Output | 0.99755 | 1.0072 | 1.0165 | 0.8 | 0.52 +Modify | 120.6 | 127.43 | 135.54 | 54.8 | 66.14 +Other | | 0.7553 | | | 0.39 + +Nlocal: 675.25 ave 1373 max 7 min +Histogram: 2 0 0 0 0 0 0 0 0 2 +Nghost: 103 ave 163 max 50 min +Histogram: 2 0 0 0 0 0 0 0 1 1 +Neighs: 10509 ave 21592 max 126 min +Histogram: 2 0 0 0 0 0 0 0 0 2 +FullNghs: 20367 ave 41981 max 141 min +Histogram: 2 0 0 0 0 0 0 0 0 2 + +Total # of neighbors = 81468 +Ave neighs/atom = 30.162162 +Ave special neighs/atom = 1.6593854 +Neighbor list builds = 39932 +Dangerous builds = 0 + +Total wall time: 0:03:12 diff --git a/examples/rheo/poiseuille/in.rheo.poiseuille b/examples/rheo/poiseuille/in.rheo.poiseuille index 7c38c8a6e0..ec283d9a00 100644 --- a/examples/rheo/poiseuille/in.rheo.poiseuille +++ b/examples/rheo/poiseuille/in.rheo.poiseuille @@ -69,7 +69,7 @@ compute rho all rheo/property/atom rho thermo 200 thermo_style custom step time ke press -dump 1 all custom 200 atomDump id type x y vx vy fx fy c_rho +#dump 1 all custom 200 atomDump id type x y vx vy fx fy c_rho run 20000 diff --git a/examples/rheo/poiseuille/log.17Apr2024.poiseuille.g++.4 b/examples/rheo/poiseuille/log.17Apr2024.poiseuille.g++.4 new file mode 100644 index 0000000000..1fd8377b7a --- /dev/null +++ b/examples/rheo/poiseuille/log.17Apr2024.poiseuille.g++.4 @@ -0,0 +1,288 @@ +LAMMPS (17 Apr 2024 - Development - patch_5May2020-18508-g3c0eaf6870-modified) +# ------ 2D Poiseuille flow ------ # + +dimension 2 +units lj +atom_style rheo +boundary p p p +comm_modify vel yes + +# ------ Create simulation box ------ # + +variable n equal 1.0 +variable cut equal 3.0 + +region box block 0 20 -10 10 -0.01 0.01 +create_box 2 box +Created orthogonal box = (0 -10 -0.01) to (20 10 0.01) + 2 by 2 by 1 MPI processor grid +lattice sq ${n} +lattice sq 1 +Lattice spacing in x,y,z = 1 1 1 + +region inner block INF INF -7.5 7.5 INF INF units box +region walls block INF INF -7.5 7.5 INF INF units box side out + +create_atoms 2 region walls +Created 100 atoms + using lattice units in orthogonal box = (0 -10 -0.01) to (20 10 0.01) + create_atoms CPU = 0.000 seconds +create_atoms 1 region inner +Created 300 atoms + using lattice units in orthogonal box = (0 -10 -0.01) to (20 10 0.01) + create_atoms CPU = 0.000 seconds + +group fluid type 1 +300 atoms in group fluid +group rig type 2 +100 atoms in group rig + +displace_atoms fluid random 0.1 0.1 0 135414 units box +Displacing atoms ... + +# ------ Model parameters ------ # + +variable rho0 equal 1.0 +variable cs equal 1.0 +variable mp equal ${rho0}/${n} +variable mp equal 1/${n} +variable mp equal 1/1 +variable zeta equal 1.0 +variable kappa equal 1.0*${rho0}/${mp} +variable kappa equal 1.0*1/${mp} +variable kappa equal 1.0*1/1 +variable fext equal 1e-4/${n} +variable fext equal 1e-4/1 +variable dt_max equal 0.1*${cut}/${cs}/3 +variable dt_max equal 0.1*3/${cs}/3 +variable dt_max equal 0.1*3/1/3 +variable Dr equal 0.05*${cut}*${cs} +variable Dr equal 0.05*3*${cs} +variable Dr equal 0.05*3*1 + +variable eta equal 0.1 +variable gd0 equal 5e-4 +variable npow equal 0.5 +variable K equal 0.001 + +mass * ${mp} +mass * 1 +set group all rheo/rho ${rho0} +set group all rheo/rho 1 +Setting atom values ... + 400 settings made for rheo/rho +set group all rheo/status 0 +Setting atom values ... + 400 settings made for rheo/status +set group rig rheo/status 1 +Setting atom values ... + 100 settings made for rheo/status + +timestep ${dt_max} +timestep 0.1 + +pair_style rheo ${cut} artificial/visc ${zeta} rho/damp ${Dr} +pair_style rheo 3 artificial/visc ${zeta} rho/damp ${Dr} +pair_style rheo 3 artificial/visc 1 rho/damp ${Dr} +pair_style rheo 3 artificial/visc 1 rho/damp 0.15 +pair_coeff * * + +# ------ Fixes & computes ------ # + +fix 1 all rheo ${cut} quintic 0 shift +fix 1 all rheo 3 quintic 0 shift +fix 2 all rheo/viscosity * constant ${eta} +fix 2 all rheo/viscosity * constant 0.1 +#fix 2 all rheo/viscosity * power ${eta} ${gd0} ${K} ${npow} +fix 3 all rheo/pressure * linear +fix 4 rig setforce 0.0 0.0 0.0 +fix 5 fluid addforce ${fext} 0.0 0.0 +fix 5 fluid addforce 0.0001 0.0 0.0 +fix 6 all enforce2d + +compute rho all rheo/property/atom rho + +# ------ Output & Run ------ # + +thermo 200 +thermo_style custom step time ke press + +dump 1 all custom 200 atomDump id type x y vx vy fx fy c_rho + +run 20000 + +CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE + +Your simulation uses code contributions which should be cited: + +- @article{PalermoInPrep, + journal = {in prep}, + title = {RHEO: A Hybrid Mesh-Free Model Framework for Dynamic Multi-Phase Flows}, + year = {2024}, + author = {Eric T. Palermo and Ki T. Wolf and Joel T. Clemmer and Thomas C. O'Connor}, +} + +CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE + +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 = 3.3 + ghost atom cutoff = 3.3 + binsize = 1.65, bins = 13 13 1 + 4 neighbor lists, perpetual/occasional/extra = 4 0 0 + (1) pair rheo, perpetual, half/full from (2) + attributes: half, newton on + pair build: halffull/newton + stencil: none + bin: none + (2) compute RHEO/KERNEL, perpetual + attributes: full, newton on + pair build: full/bin/atomonly + stencil: full/bin/2d + bin: standard + (3) compute RHEO/GRAD, perpetual, copy from (1) + attributes: half, newton on + pair build: copy + stencil: none + bin: none + (4) compute RHEO/VSHIFT, perpetual, copy from (1) + attributes: half, newton on + pair build: copy + stencil: none + bin: none +Per MPI rank memory allocation (min/avg/max) = 5.693 | 5.693 | 5.693 Mbytes + Step Time KinEng Press + 0 0 0 0 + 200 20 1.2220462e-06 3.7383146e-05 + 400 40 4.345762e-06 7.5866885e-05 + 600 60 8.8559433e-06 0.00011353743 + 800 80 1.4370506e-05 0.00015135634 + 1000 100 2.0576198e-05 0.00018903722 + 1200 120 2.721926e-05 0.00022533997 + 1400 140 3.4099653e-05 0.00026016069 + 1600 160 4.1064175e-05 0.00029445207 + 1800 180 4.8001225e-05 0.00032893763 + 2000 200 5.4832849e-05 0.00036402396 + 2200 220 6.1508431e-05 0.00039945249 + 2400 240 6.8000141e-05 0.00043534411 + 2600 260 7.430136e-05 0.00046943441 + 2800 280 8.0415328e-05 0.00049807225 + 3000 300 8.6335032e-05 0.00051815375 + 3200 320 9.2021626e-05 0.00052618224 + 3400 340 9.7387936e-05 0.00051877918 + 3600 360 0.00010231526 0.00048650828 + 3800 380 0.00010676617 0.00044578079 + 4000 400 0.00011080098 0.00044777126 + 4200 420 0.00011448127 0.00047047629 + 4400 440 0.00011787852 0.00050280249 + 4600 460 0.00012106805 0.0005397213 + 4800 480 0.00012412056 0.00057885539 + 5000 500 0.0001271078 0.00061396896 + 5200 520 0.00013006637 0.00063981812 + 5400 540 0.00013295039 0.00065094073 + 5600 560 0.00013561487 0.00063918847 + 5800 580 0.00013791796 0.00059087656 + 6000 600 0.00013983422 0.00052171998 + 6200 620 0.00014144833 0.00050658002 + 6400 640 0.00014286538 0.0005248626 + 6600 660 0.00014417734 0.00055826606 + 6800 680 0.00014546931 0.00060063748 + 7000 700 0.00014682553 0.00064421411 + 7200 720 0.0001482833 0.00068252242 + 7400 740 0.00014977996 0.00070671308 + 7600 760 0.00015114829 0.00069774026 + 7800 780 0.0001522719 0.00064408311 + 8000 800 0.00015312897 0.00055977044 + 8200 820 0.00015375669 0.0005225573 + 8400 840 0.00015425683 0.00053833691 + 8600 860 0.00015471278 0.00057447427 + 8800 880 0.0001552059 0.00061980921 + 9000 900 0.00015581593 0.0006659836 + 9200 920 0.0001565564 0.00070813532 + 9400 940 0.00015733573 0.00073378551 + 9600 960 0.00015802107 0.00071560835 + 9800 980 0.00015855339 0.00065636189 + 10000 1000 0.00015890743 0.0005699855 + 10200 1020 0.00015908095 0.00053138971 + 10400 1040 0.00015915523 0.00054790708 + 10600 1060 0.00015921254 0.00058899454 + 10800 1080 0.00015934193 0.00063964906 + 11000 1100 0.00015959891 0.00069241358 + 11200 1120 0.0001599636 0.00073734651 + 11400 1140 0.00016036526 0.00074477329 + 11600 1160 0.00016075471 0.00071047555 + 11800 1180 0.00016109516 0.00064173183 + 12000 1200 0.00016131524 0.00055500553 + 12200 1220 0.00016136366 0.0005290215 + 12400 1240 0.0001613025 0.00055124296 + 12600 1260 0.00016123023 0.00059758627 + 12800 1280 0.00016123043 0.00065488735 + 13000 1300 0.00016132935 0.0007140876 + 13200 1320 0.00016152165 0.00074795629 + 13400 1340 0.00016180372 0.00074730778 + 13600 1360 0.00016216585 0.00071370995 + 13800 1380 0.0001625339 0.00065176323 + 14000 1400 0.00016274999 0.00057515371 + 14200 1420 0.00016271295 0.00055878258 + 14400 1440 0.00016249768 0.00058448193 + 14600 1460 0.00016223675 0.00063096229 + 14800 1480 0.00016201846 0.00068639548 + 15000 1500 0.00016190593 0.00072444357 + 15200 1520 0.00016194466 0.00073830636 + 15400 1540 0.00016216164 0.00072773256 + 15600 1560 0.00016253174 0.00069215481 + 15800 1580 0.00016290895 0.00063239408 + 16000 1600 0.00016306463 0.00057466273 + 16200 1620 0.00016292218 0.00057951567 + 16400 1640 0.00016261117 0.00061504156 + 16600 1660 0.00016225906 0.00066066637 + 16800 1680 0.00016197993 0.00069751908 + 17000 1700 0.0001618568 0.00072202303 + 17200 1720 0.00016194264 0.00073255034 + 17400 1740 0.00016225911 0.0007231031 + 17600 1760 0.00016270465 0.00068931224 + 17800 1780 0.00016304053 0.00062934836 + 18000 1800 0.00016302624 0.00058060272 + 18200 1820 0.00016274847 0.00058859513 + 18400 1840 0.00016236893 0.00061804803 + 18600 1860 0.00016202777 0.00065393237 + 18800 1880 0.0001618184 0.00068747094 + 19000 1900 0.0001618044 0.00071352541 + 19200 1920 0.00016204402 0.00072351769 + 19400 1940 0.00016249999 0.00071330322 + 19600 1960 0.00016297924 0.00067984167 + 19800 1980 0.00016317435 0.00061634142 + 20000 2000 0.00016301186 0.00057234115 +Loop time of 15.6198 on 4 procs for 20000 steps with 400 atoms + +Performance: 11062881.511 tau/day, 1280.426 timesteps/s, 512.170 katom-step/s +99.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 | 2.1979 | 2.4473 | 2.6992 | 15.7 | 15.67 +Neigh | 0.024709 | 0.027006 | 0.029223 | 1.3 | 0.17 +Comm | 0.4657 | 0.71686 | 0.9662 | 29.0 | 4.59 +Output | 0.033698 | 0.036781 | 0.039359 | 1.1 | 0.24 +Modify | 12.306 | 12.313 | 12.319 | 0.2 | 78.83 +Other | | 0.07916 | | | 0.51 + +Nlocal: 100 ave 107 max 93 min +Histogram: 1 0 0 1 0 0 1 0 0 1 +Nghost: 185.5 ave 192 max 179 min +Histogram: 1 0 0 1 0 0 1 0 0 1 +Neighs: 1712 ave 1848 max 1598 min +Histogram: 1 0 1 0 0 1 0 0 0 1 +FullNghs: 3424 ave 3682 max 3174 min +Histogram: 1 0 1 0 0 0 1 0 0 1 + +Total # of neighbors = 13696 +Ave neighs/atom = 34.24 +Neighbor list builds = 331 +Dangerous builds = 0 + + +Total wall time: 0:00:15 diff --git a/examples/rheo/taylor-green/log.17Apr2024.taylor.green.g++.4 b/examples/rheo/taylor-green/log.17Apr2024.taylor.green.g++.4 new file mode 100644 index 0000000000..6daf4a6eee --- /dev/null +++ b/examples/rheo/taylor-green/log.17Apr2024.taylor.green.g++.4 @@ -0,0 +1,224 @@ +LAMMPS (17 Apr 2024 - Development - patch_5May2020-18508-g3c0eaf6870-modified) +# ------ 2D Taylor Green vortex ------ # + +dimension 2 +units lj +atom_style rheo +boundary p p p +comm_modify vel yes +newton off + +# ------ Create simulation box ------ # + +variable n equal 1.0 +variable cut equal 3.0 + +region box block 0 40 0 40 -0.01 0.01 +create_box 1 box +Created orthogonal box = (0 0 -0.01) to (40 40 0.01) + 2 by 2 by 1 MPI processor grid +lattice sq ${n} +lattice sq 1 +Lattice spacing in x,y,z = 1 1 1 + +create_atoms 1 region box +Created 1600 atoms + using lattice units in orthogonal box = (0 0 -0.01) to (40 40 0.01) + create_atoms CPU = 0.001 seconds + +displace_atoms all random 0.1 0.1 0 135414 units box +Displacing atoms ... + +# ------ Model parameters ------ # + +variable rho0 equal 1.0 +variable mp equal ${rho0}/${n} +variable mp equal 1/${n} +variable mp equal 1/1 +variable cs equal 1.0 +variable eta equal 0.05 +variable zeta equal 1 +variable dt_max equal 0.1*${cut}/${cs}/3 +variable dt_max equal 0.1*3/${cs}/3 +variable dt_max equal 0.1*3/1/3 +variable Dr equal 0.1*${cut}*${cs} +variable Dr equal 0.1*3*${cs} +variable Dr equal 0.1*3*1 + +mass * ${mp} +mass * 1 +set group all rheo/rho ${rho0} +set group all rheo/rho 1 +Setting atom values ... + 1600 settings made for rheo/rho +set group all rheo/status 0 +Setting atom values ... + 1600 settings made for rheo/status + +variable u0 equal 0.05 +variable uy atom ${u0}*sin(2*PI*x/lx)*cos(2*PI*y/ly) +variable uy atom 0.05*sin(2*PI*x/lx)*cos(2*PI*y/ly) +variable ux atom -${u0}*sin(2*PI*y/ly)*cos(2*PI*x/ly) +variable ux atom -0.05*sin(2*PI*y/ly)*cos(2*PI*x/ly) +variable d0 atom ${rho0}-${u0}*${u0}*${rho0}*0.25*(cos(4*PI*x/lx)+cos(4*PI*y/ly))/${cs}/${cs} +variable d0 atom 1-${u0}*${u0}*${rho0}*0.25*(cos(4*PI*x/lx)+cos(4*PI*y/ly))/${cs}/${cs} +variable d0 atom 1-0.05*${u0}*${rho0}*0.25*(cos(4*PI*x/lx)+cos(4*PI*y/ly))/${cs}/${cs} +variable d0 atom 1-0.05*0.05*${rho0}*0.25*(cos(4*PI*x/lx)+cos(4*PI*y/ly))/${cs}/${cs} +variable d0 atom 1-0.05*0.05*1*0.25*(cos(4*PI*x/lx)+cos(4*PI*y/ly))/${cs}/${cs} +variable d0 atom 1-0.05*0.05*1*0.25*(cos(4*PI*x/lx)+cos(4*PI*y/ly))/1/${cs} +variable d0 atom 1-0.05*0.05*1*0.25*(cos(4*PI*x/lx)+cos(4*PI*y/ly))/1/1 + +velocity all set v_ux v_uy 0.0 units box + +timestep ${dt_max} +timestep 0.1 + +pair_style rheo ${cut} artificial/visc ${zeta} rho/damp ${Dr} +pair_style rheo 3 artificial/visc ${zeta} rho/damp ${Dr} +pair_style rheo 3 artificial/visc 1 rho/damp ${Dr} +pair_style rheo 3 artificial/visc 1 rho/damp 0.3 +pair_coeff * * + +# ------ Fixes & computes ------ # + +fix 1 all rheo ${cut} RK1 8 shift +fix 1 all rheo 3 RK1 8 shift +fix 2 all rheo/viscosity * constant ${eta} +fix 2 all rheo/viscosity * constant 0.05 +fix 3 all rheo/pressure * linear +fix 4 all enforce2d + +compute rho all rheo/property/atom rho + +# ------ Output & Run ------ # + +thermo 200 +thermo_style custom step time ke press + +dump 1 all custom 200 atomDump id type x y vx vy fx fy c_rho + +run 10000 + +CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE + +Your simulation uses code contributions which should be cited: + +- @article{PalermoInPrep, + journal = {in prep}, + title = {RHEO: A Hybrid Mesh-Free Model Framework for Dynamic Multi-Phase Flows}, + year = {2024}, + author = {Eric T. Palermo and Ki T. Wolf and Joel T. Clemmer and Thomas C. O'Connor}, +} + +CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE + +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 = 3.3 + ghost atom cutoff = 3.3 + binsize = 1.65, bins = 25 25 1 + 4 neighbor lists, perpetual/occasional/extra = 4 0 0 + (1) pair rheo, perpetual, half/full from (2) + attributes: half, newton off + pair build: halffull/newtoff + stencil: none + bin: none + (2) compute RHEO/KERNEL, perpetual + attributes: full, newton off + pair build: full/bin/atomonly + stencil: full/bin/2d + bin: standard + (3) compute RHEO/GRAD, perpetual, copy from (1) + attributes: half, newton off + pair build: copy + stencil: none + bin: none + (4) compute RHEO/VSHIFT, perpetual, copy from (1) + attributes: half, newton off + pair build: copy + stencil: none + bin: none +Per MPI rank memory allocation (min/avg/max) = 6.835 | 6.835 | 6.835 Mbytes + Step Time KinEng Press + 0 0 0.00062497276 0.00062607301 + 200 20 0.00056200647 0.00056633785 + 400 40 0.00050570968 0.00051098771 + 600 60 0.00045586684 0.00046081672 + 800 80 0.00041124523 0.00041549607 + 1000 100 0.00037065341 0.00037412741 + 1200 120 0.00033391585 0.00033580899 + 1400 140 0.00030078316 0.00030057307 + 1600 160 0.00027093231 0.00026842603 + 1800 180 0.00024403239 0.00023839026 + 2000 200 0.0002197865 0.00021148941 + 2200 220 0.0001979269 0.00018659386 + 2400 240 0.00017822267 0.00016430442 + 2600 260 0.00016047141 0.00014408514 + 2800 280 0.00014448504 0.00012574125 + 3000 300 0.00013009159 0.00010869938 + 3200 320 0.00011713578 9.414951e-05 + 3400 340 0.00010547564 8.1900579e-05 + 3600 360 9.4982139e-05 7.1285649e-05 + 3800 380 8.5538983e-05 6.1571123e-05 + 4000 400 7.7040171e-05 5.3462572e-05 + 4200 420 6.9390317e-05 4.6338308e-05 + 4400 440 6.2503763e-05 3.9697323e-05 + 4600 460 5.6303766e-05 3.4234465e-05 + 4800 480 5.0721595e-05 3.0841338e-05 + 5000 500 4.5695301e-05 2.7788566e-05 + 5200 520 4.1169161e-05 2.5744409e-05 + 5400 540 3.7093059e-05 2.3912739e-05 + 5600 560 3.3421819e-05 2.2494185e-05 + 5800 580 3.0114735e-05 2.1594384e-05 + 6000 600 2.7135224e-05 2.1164421e-05 + 6200 620 2.4450446e-05 2.0979349e-05 + 6400 640 2.2030925e-05 2.0858567e-05 + 6600 660 1.9850196e-05 2.098115e-05 + 6800 680 1.7884553e-05 2.1134827e-05 + 7000 700 1.6112763e-05 2.1242242e-05 + 7200 720 1.4515783e-05 2.1312763e-05 + 7400 740 1.3076456e-05 2.1370947e-05 + 7600 760 1.1779327e-05 2.1332126e-05 + 7800 780 1.0610469e-05 2.1156562e-05 + 8000 800 9.5573298e-06 2.0898126e-05 + 8200 820 8.6085799e-06 2.0517958e-05 + 8400 840 7.7539888e-06 1.9841551e-05 + 8600 860 6.9843033e-06 1.9114769e-05 + 8800 880 6.2911575e-06 1.8362959e-05 + 9000 900 5.6669785e-06 1.7473404e-05 + 9200 920 5.1049208e-06 1.6452745e-05 + 9400 940 4.5987908e-06 1.5578629e-05 + 9600 960 4.1429972e-06 1.4427274e-05 + 9800 980 3.7324962e-06 1.3169649e-05 + 10000 1000 3.3627455e-06 1.1938723e-05 +Loop time of 38.2006 on 4 procs for 10000 steps with 1600 atoms + +Performance: 2261743.875 tau/day, 261.776 timesteps/s, 418.841 katom-step/s +99.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 | 8.2958 | 8.7273 | 9.3582 | 15.2 | 22.85 +Neigh | 0.034282 | 0.035689 | 0.037115 | 0.7 | 0.09 +Comm | 0.16788 | 0.17018 | 0.17278 | 0.4 | 0.45 +Output | 0.066977 | 0.06882 | 0.071704 | 0.7 | 0.18 +Modify | 28.483 | 28.793 | 28.962 | 3.6 | 75.37 +Other | | 0.4053 | | | 1.06 + +Nlocal: 400 ave 402 max 399 min +Histogram: 2 0 0 1 0 0 0 0 0 1 +Nghost: 307.25 ave 308 max 305 min +Histogram: 1 0 0 0 0 0 0 0 0 3 +Neighs: 7618.25 ave 7697 max 7564 min +Histogram: 1 0 1 1 0 0 0 0 0 1 +FullNghs: 13343 ave 13497 max 13258 min +Histogram: 1 1 1 0 0 0 0 0 0 1 + +Total # of neighbors = 53372 +Ave neighs/atom = 33.3575 +Neighbor list builds = 123 +Dangerous builds = 0 +Total wall time: 0:00:38 diff --git a/src/BPM/bond_bpm_spring.cpp b/src/BPM/bond_bpm_spring.cpp index 775d8d1597..2863bbf317 100644 --- a/src/BPM/bond_bpm_spring.cpp +++ b/src/BPM/bond_bpm_spring.cpp @@ -23,8 +23,6 @@ #include "modify.h" #include "neighbor.h" -#include "update.h" - #include #include diff --git a/src/BPM/compute_nbond_atom.cpp b/src/BPM/compute_nbond_atom.cpp index 98263f3b4d..31428b1912 100644 --- a/src/BPM/compute_nbond_atom.cpp +++ b/src/BPM/compute_nbond_atom.cpp @@ -30,7 +30,7 @@ ComputeNBondAtom::ComputeNBondAtom(LAMMPS *_lmp, int narg, char **arg) : if (narg < 3) utils::missing_cmd_args(FLERR, "compute nbond/atom", error); if (atom->avec->bonds_allow == 0) - error->all(FLERR,"Compute nbond/atom used when bonds are not allowed"); + error->all(FLERR,"Compute nbond/atom used in system without bonds"); btype = -1; int iarg = 3; diff --git a/src/BPM/fix_update_special_bonds.cpp b/src/BPM/fix_update_special_bonds.cpp index 5dddbdd55e..c71f6973d0 100644 --- a/src/BPM/fix_update_special_bonds.cpp +++ b/src/BPM/fix_update_special_bonds.cpp @@ -169,7 +169,7 @@ void FixUpdateSpecialBonds::pre_force(int /*vflag*/) tagint *tag = atom->tag; // In theory could communicate a list of broken bonds to neighboring processors here - // to remove restriction that users use Newton bond off + // to remove restriction on Newton bond off for (int ilist = 0; ilist < neighbor->nlist; ilist++) { list = neighbor->lists[ilist]; diff --git a/src/RHEO/bond_rheo_shell.cpp b/src/RHEO/bond_rheo_shell.cpp index c8eee29438..9c198364d6 100644 --- a/src/RHEO/bond_rheo_shell.cpp +++ b/src/RHEO/bond_rheo_shell.cpp @@ -250,8 +250,8 @@ void BondRHEOShell::compute(int eflag, int vflag) if (t >= tform) { bondstore[n][0] = r; r0 = r; - if (newton_bond || i1 < nlocal) dbond[i1] ++; - if (newton_bond || i2 < nlocal) dbond[i2] ++; + if (newton_bond || i1 < nlocal) dbond[i1]++; + if (newton_bond || i2 < nlocal) dbond[i2]++; } else { continue; } @@ -261,8 +261,8 @@ void BondRHEOShell::compute(int eflag, int vflag) if (fabs(e) > ecrit[type]) { bondlist[n][2] = 0; process_broken(i1, i2); - if (newton_bond || i1 < nlocal) dbond[i1] --; - if (newton_bond || i2 < nlocal) dbond[i2] --; + if (newton_bond || i1 < nlocal) dbond[i1]--; + if (newton_bond || i2 < nlocal) dbond[i2]--; continue; } @@ -388,9 +388,8 @@ void BondRHEOShell::settings(int narg, char **arg) for (std::size_t i = 0; i < leftover_iarg.size(); i++) { iarg = leftover_iarg[i]; if (strcmp(arg[iarg], "t/form") == 0) { - if (iarg + 1 > narg) error->all(FLERR, "Illegal bond rheo/shell command, missing option for t/form"); + if (iarg + 1 > narg) utils::missing_cmd_args(FLERR, "bond rheo/shell t/form", error); tform = utils::numeric(FLERR, arg[iarg + 1], false, lmp); - if (tform < 0.0) error->all(FLERR, "Illegal bond rheo/shell value for t/form, {}", tform); i += 1; } else { error->all(FLERR, "Illegal bond rheo/shell command, invalid argument {}", arg[iarg]); @@ -398,7 +397,7 @@ void BondRHEOShell::settings(int narg, char **arg) } if (tform < 0.0) - error->all(FLERR, "Illegal bond rheo/shell command, must specify formation time"); + error->all(FLERR, "Illegal bond rheo/shell command, must specify positive formation time"); } diff --git a/src/RHEO/compute_rheo_kernel.cpp b/src/RHEO/compute_rheo_kernel.cpp index d0f24850bd..cb9a42323b 100644 --- a/src/RHEO/compute_rheo_kernel.cpp +++ b/src/RHEO/compute_rheo_kernel.cpp @@ -57,7 +57,7 @@ ComputeRHEOKernel::ComputeRHEOKernel(LAMMPS *lmp, int narg, char **arg) : { if (narg != 4) error->all(FLERR,"Illegal compute rheo/kernel command"); - kernel_style = utils::inumeric(FLERR,arg[3],false,lmp); + kernel_style = utils::inumeric(FLERR, arg[3], false, lmp); if (kernel_style == QUINTIC || kernel_style == WENDLANDC4) { correction_order = -1; @@ -110,27 +110,27 @@ void ComputeRHEOKernel::init() compute_interface = fix_rheo->compute_interface; zmin = fix_rheo->zmin_kernel; - h = fix_rheo->h; - hsq = h * h; - hinv = 1.0 / h; - hsqinv = hinv * hinv; + cut = fix_rheo->cut; + cutsq = cut * cut; + cutinv = 1.0 / cut; + cutsqinv = cutinv * cutinv; if (kernel_style != WENDLANDC4) { if (dim == 3) { - pre_w = 1.0 / (120.0 * MY_PI) * 27.0 * hsqinv * hinv; - pre_wp = pre_w * 3.0 * hinv; + pre_w = 1.0 / (120.0 * MY_PI) * 27.0 * cutsqinv * cutinv; + pre_wp = pre_w * 3.0 * cutinv; } else { - pre_w = 7.0 / (478.0 * MY_PI) * 9 * hsqinv; - pre_wp = pre_w * 3.0 * hinv; + pre_w = 7.0 / (478.0 * MY_PI) * 9 * cutsqinv; + pre_wp = pre_w * 3.0 * cutinv; } } else { if (dim == 3) { - pre_w = 495.0 / (32.0 * MY_PI * hsq * h); - pre_wp = pre_w * hinv; + pre_w = 495.0 / (32.0 * MY_PI * cutsq * cut); + pre_wp = pre_w * cutinv; } else { - pre_w = 9.0 / (MY_PI * hsq); - pre_wp = pre_w * hinv; + pre_w = 9.0 / (MY_PI * cutsq); + pre_wp = pre_w * cutinv; } } @@ -193,7 +193,7 @@ double ComputeRHEOKernel::calc_w(int i, int j, double delx, double dely, double int corrections_i, corrections_j, corrections; if (kernel_style == WENDLANDC4) - return calc_w_wendlandc4(i,j,delx,dely,delz,r); + return calc_w_wendlandc4(i, j, delx, dely, delz, r); if (kernel_style != QUINTIC) { corrections_i = check_corrections(i); @@ -203,10 +203,10 @@ double ComputeRHEOKernel::calc_w(int i, int j, double delx, double dely, double corrections = 0; } - if (!corrections) w = calc_w_quintic(i,j,delx,dely,delz,r); - else if (kernel_style == RK0) w = calc_w_rk0(i,j,delx,dely,delz,r); - else if (kernel_style == RK1) w = calc_w_rk1(i,j,delx,dely,delz,r); - else if (kernel_style == RK2) w = calc_w_rk2(i,j,delx,dely,delz,r); + if (!corrections) w = calc_w_quintic(i, j, delx, dely, delz, r); + else if (kernel_style == RK0) w = calc_w_rk0(i, j, delx, dely, delz, r); + else if (kernel_style == RK1) w = calc_w_rk1(i, j, delx, dely, delz, r); + else if (kernel_style == RK2) w = calc_w_rk2(i, j, delx, dely, delz, r); return w; } @@ -219,7 +219,7 @@ double ComputeRHEOKernel::calc_dw(int i, int j, double delx, double dely, double int corrections_i, corrections_j; if (kernel_style == WENDLANDC4) - return calc_dw_wendlandc4(i,j,delx,dely,delz,r,dWij,dWji); + return calc_dw_wendlandc4(i, j, delx, dely, delz, r, dWij, dWji); if (kernel_style != QUINTIC) { corrections_i = check_corrections(i); @@ -227,15 +227,15 @@ double ComputeRHEOKernel::calc_dw(int i, int j, double delx, double dely, double } // Calc wp and default dW's, a bit inefficient but can redo later - wp = calc_dw_quintic(i,j,delx,dely,delz,r,dWij,dWji); + wp = calc_dw_quintic(i, j, delx, dely, delz, r, dWij, dWji); // Overwrite if there are corrections if (kernel_style == RK1) { - if (corrections_i) calc_dw_rk1(i,j,delx,dely,delz,r,dWij); - if (corrections_j) calc_dw_rk1(j,i,-delx,-dely,-delz,r,dWji); + if (corrections_i) calc_dw_rk1(i, j, delx, dely, delz, r, dWij); + if (corrections_j) calc_dw_rk1(j, i, -delx, -dely, -delz, r, dWji); } else if (kernel_style == RK2) { - if (corrections_i) calc_dw_rk2(i,j,delx,dely,delz,r,dWij); - if (corrections_j) calc_dw_rk2(j,i,-delx,-dely,-delz,r,dWji); + if (corrections_i) calc_dw_rk2(i, j, delx, dely, delz, r, dWij); + if (corrections_j) calc_dw_rk2(j, i, -delx, -dely, -delz, r, dWji); } return wp; @@ -246,7 +246,7 @@ double ComputeRHEOKernel::calc_dw(int i, int j, double delx, double dely, double double ComputeRHEOKernel::calc_w_quintic(int i, int j, double delx, double dely, double delz, double r) { double w, tmp1, tmp2, tmp3, tmp1sq, tmp2sq, tmp3sq, s; - s = r * 3.0 * hinv; + s = r * 3.0 * cutinv; if (s > 3.0) { w = 0.0; @@ -284,7 +284,7 @@ double ComputeRHEOKernel::calc_dw_quintic(int i, int j, double delx, double dely double *mass = atom->mass; int *type = atom->type; - s = r * 3.0 * hinv; + s = r * 3.0 * cutinv; if (s > 3.0) { wp = 0.0; @@ -323,7 +323,7 @@ double ComputeRHEOKernel::calc_dw_quintic(int i, int j, double delx, double dely double ComputeRHEOKernel::calc_w_wendlandc4(int i, int j, double delx, double dely, double delz, double r) { double w, tmp6, s; - s = r * hinv; + s = r * cutinv; if (s > 1.0) { w = 0.0; @@ -349,7 +349,7 @@ double ComputeRHEOKernel::calc_dw_wendlandc4(int i, int j, double delx, double d double *mass = atom->mass; int *type = atom->type; - s = r * hinv; + s = r * cutinv; if (s > 1.0) { wp = 0.0; @@ -381,7 +381,7 @@ double ComputeRHEOKernel::calc_w_rk0(int i, int j, double delx, double dely, dou { double w; - w = calc_w_quintic(i,j,delx,dely,delz,r); + w = calc_w_quintic(i, j, delx, dely, delz, r); Wij = C0[i] * w; Wji = C0[j] * w; @@ -399,17 +399,17 @@ double ComputeRHEOKernel::calc_w_rk1(int i, int j, double delx, double dely, dou dx[0] = delx; dx[1] = dely; dx[2] = delz; - w = calc_w_quintic(i,j,delx,dely,delz,r); + w = calc_w_quintic(i, j, delx, dely, delz, r); if (dim == 2) { H[0] = 1.0; - H[1] = dx[0] * hinv; - H[2] = dx[1] * hinv; + H[1] = dx[0] * cutinv; + H[2] = dx[1] * cutinv; } else { H[0] = 1.0; - H[1] = dx[0] * hinv; - H[2] = dx[1] * hinv; - H[3] = dx[2] * hinv; + H[1] = dx[0] * cutinv; + H[2] = dx[1] * cutinv; + H[3] = dx[2] * cutinv; } Wij = 0; for (b = 0; b < Mdim; b++) { @@ -440,26 +440,26 @@ double ComputeRHEOKernel::calc_w_rk2(int i, int j, double delx, double dely, dou dx[0] = delx; dx[1] = dely; dx[2] = delz; - w = calc_w_quintic(i,j,delx,dely,delz,r); + w = calc_w_quintic(i, j, delx, dely, delz, r); if (dim == 2) { H[0] = 1.0; - H[1] = dx[0] * hinv; - H[2] = dx[1] * hinv; - H[3] = 0.5 * dx[0] * dx[0] * hsqinv; - H[4] = 0.5 * dx[1] * dx[1] * hsqinv; - H[5] = dx[0] * dx[1] * hsqinv; + H[1] = dx[0] * cutinv; + H[2] = dx[1] * cutinv; + H[3] = 0.5 * dx[0] * dx[0] * cutsqinv; + H[4] = 0.5 * dx[1] * dx[1] * cutsqinv; + H[5] = dx[0] * dx[1] * cutsqinv; } else { H[0] = 1.0; - H[1] = dx[0] * hinv; - H[2] = dx[1] * hinv; - H[3] = dx[2] * hinv; - H[4] = 0.5 * dx[0] * dx[0] * hsqinv; - H[5] = 0.5 * dx[1] * dx[1] * hsqinv; - H[6] = 0.5 * dx[2] * dx[2] * hsqinv; - H[7] = dx[0] * dx[1] * hsqinv; - H[8] = dx[0] * dx[2] * hsqinv; - H[9] = dx[1] * dx[2] * hsqinv; + H[1] = dx[0] * cutinv; + H[2] = dx[1] * cutinv; + H[3] = dx[2] * cutinv; + H[4] = 0.5 * dx[0] * dx[0] * cutsqinv; + H[5] = 0.5 * dx[1] * dx[1] * cutsqinv; + H[6] = 0.5 * dx[2] * dx[2] * cutsqinv; + H[7] = dx[0] * dx[1] * cutsqinv; + H[8] = dx[0] * dx[2] * cutsqinv; + H[9] = dx[1] * dx[2] * cutsqinv; } Wij = 0; for (b = 0; b < Mdim; b++) { @@ -491,18 +491,18 @@ void ComputeRHEOKernel::calc_dw_rk1(int i, int j, double delx, double dely, doub dx[1] = dely; dx[2] = delz; - w = calc_w_quintic(i,j,delx,dely,delz,r); + w = calc_w_quintic(i, j, delx, dely, delz, r); //Populate correction basis if (dim == 2) { H[0] = 1.0; - H[1] = dx[0] * hinv; - H[2] = dx[1] * hinv; + H[1] = dx[0] * cutinv; + H[2] = dx[1] * cutinv; } else { H[0] = 1.0; - H[1] = dx[0] * hinv; - H[2] = dx[1] * hinv; - H[3] = dx[2] * hinv; + H[1] = dx[0] * cutinv; + H[2] = dx[1] * cutinv; + H[3] = dx[2] * cutinv; } // dWij[] = dWx dWy (dWz) @@ -528,27 +528,27 @@ void ComputeRHEOKernel::calc_dw_rk2(int i, int j, double delx, double dely, doub dx[1] = dely; dx[2] = delz; - w = calc_w_quintic(i,j,delx,dely,delz,r); + w = calc_w_quintic(i, j, delx, dely, delz, r); //Populate correction basis if (dim == 2) { H[0] = 1.0; - H[1] = dx[0] * hinv; - H[2] = dx[1] * hinv; - H[3] = 0.5 * dx[0] * dx[0] * hsqinv; - H[4] = 0.5 * dx[1] * dx[1] * hsqinv; - H[5] = dx[0] * dx[1] * hsqinv; + H[1] = dx[0] * cutinv; + H[2] = dx[1] * cutinv; + H[3] = 0.5 * dx[0] * dx[0] * cutsqinv; + H[4] = 0.5 * dx[1] * dx[1] * cutsqinv; + H[5] = dx[0] * dx[1] * cutsqinv; } else { H[0] = 1.0; - H[1] = dx[0] * hinv; - H[2] = dx[1] * hinv; - H[3] = dx[2] * hinv; - H[4] = 0.5 * dx[0] * dx[0] * hsqinv; - H[5] = 0.5 * dx[1] * dx[1] * hsqinv; - H[6] = 0.5 * dx[2] * dx[2] * hsqinv; - H[7] = dx[0] * dx[1] * hsqinv; - H[8] = dx[0] * dx[2] * hsqinv; - H[9] = dx[1] * dx[2] * hsqinv; + H[1] = dx[0] * cutinv; + H[2] = dx[1] * cutinv; + H[3] = dx[2] * cutinv; + H[4] = 0.5 * dx[0] * dx[0] * cutsqinv; + H[5] = 0.5 * dx[1] * dx[1] * cutsqinv; + H[6] = 0.5 * dx[2] * dx[2] * cutsqinv; + H[7] = dx[0] * dx[1] * cutsqinv; + H[8] = dx[0] * dx[2] * cutsqinv; + H[9] = dx[1] * dx[2] * cutsqinv; } // dWij[] = dWx dWy (dWz) @@ -621,7 +621,7 @@ void ComputeRHEOKernel::compute_peratom() dx[2] = ztmp - x[j][2]; rsq = lensq3(dx); - if (rsq < hsq) { + if (rsq < cutsq) { r = sqrt(rsq); w = calc_w_quintic(i, j, dx[0], dx[1], dx[2], r); rhoj = rho[j]; @@ -639,7 +639,7 @@ void ComputeRHEOKernel::compute_peratom() } } else if (correction_order > 0) { - // Moment matrix M and polynomial basis vector H (1d for gsl compatibility) + // Moment matrix M and polynomial basis vector cut (1d for gsl compatibility) double H[Mdim], M[Mdim * Mdim]; for (ii = 0; ii < inum; ii++) { @@ -652,7 +652,7 @@ void ComputeRHEOKernel::compute_peratom() jnum = numneigh[i]; itype = type[i]; - // Zero upper-triangle M and H (will be symmetric): + // Zero upper-triangle M and cut (will be symmetric): for (a = 0; a < Mdim; a++) { for (b = a; b < Mdim; b++) { M[a * Mdim + b] = 0; @@ -669,7 +669,7 @@ void ComputeRHEOKernel::compute_peratom() rsq = lensq3(dx); - if (rsq < hsq) { + if (rsq < cutsq) { r = sqrt(rsq); w = calc_w_quintic(i, j, dx[0], dx[1], dx[2], r); @@ -683,25 +683,25 @@ void ComputeRHEOKernel::compute_peratom() //Populate the H-vector of polynomials (2D) if (dim == 2) { H[0] = 1.0; - H[1] = dx[0] * hinv; - H[2] = dx[1] * hinv; + H[1] = dx[0] * cutinv; + H[2] = dx[1] * cutinv; if (kernel_style == RK2) { - H[3] = 0.5 * dx[0] * dx[0] * hsqinv; - H[4] = 0.5 * dx[1] * dx[1] * hsqinv; - H[5] = dx[0] * dx[1] * hsqinv; + H[3] = 0.5 * dx[0] * dx[0] * cutsqinv; + H[4] = 0.5 * dx[1] * dx[1] * cutsqinv; + H[5] = dx[0] * dx[1] * cutsqinv; } } else { H[0] = 1.0; - H[1] = dx[0] * hinv; - H[2] = dx[1] * hinv; - H[3] = dx[2] * hinv; + H[1] = dx[0] * cutinv; + H[2] = dx[1] * cutinv; + H[3] = dx[2] * cutinv; if (kernel_style == RK2) { - H[4] = 0.5 * dx[0] * dx[0] * hsqinv; - H[5] = 0.5 * dx[1] * dx[1] * hsqinv; - H[6] = 0.5 * dx[2] * dx[2] * hsqinv; - H[7] = dx[0] * dx[1] * hsqinv; - H[8] = dx[0] * dx[2] * hsqinv; - H[9] = dx[1] * dx[2] * hsqinv; + H[4] = 0.5 * dx[0] * dx[0] * cutsqinv; + H[5] = 0.5 * dx[1] * dx[1] * cutsqinv; + H[6] = 0.5 * dx[2] * dx[2] * cutsqinv; + H[7] = dx[0] * dx[1] * cutsqinv; + H[8] = dx[0] * dx[2] * cutsqinv; + H[9] = dx[1] * dx[2] * cutsqinv; } } @@ -765,12 +765,12 @@ void ComputeRHEOKernel::compute_peratom() C[i][0][a] = M[a * Mdim + 0]; // all rows of column 0 for (b = 0; b < dim; b++) { //First derivatives - C[i][1 + b][a] = -M[a * Mdim + b + 1] * hinv; + C[i][1 + b][a] = -M[a * Mdim + b + 1] * cutinv; // columns 1-2 (2D) or 1-3 (3D) //Second derivatives if (kernel_style == RK2) - C[i][1 + dim + b][a] = M[a * Mdim + b + 1 + dim] * hsqinv; + C[i][1 + dim + b][a] = M[a * Mdim + b + 1 + dim] * cutsqinv; // columns 3-4 (2D) or 4-6 (3D) } } @@ -822,7 +822,7 @@ void ComputeRHEOKernel::compute_coordination() dx[2] = ztmp - x[j][2]; rsq = lensq3(dx); - if (rsq < hsq) + if (rsq < cutsq) coordination[i] += 1; } } diff --git a/src/RHEO/compute_rheo_kernel.h b/src/RHEO/compute_rheo_kernel.h index 543e5d88c0..d15e8e210a 100644 --- a/src/RHEO/compute_rheo_kernel.h +++ b/src/RHEO/compute_rheo_kernel.h @@ -59,7 +59,7 @@ class ComputeRHEOKernel : public Compute { int corrections_calculated; int kernel_style, zmin, dim, Mdim, ncor; int nmax_store; - double h, hsq, hinv, hsqinv, pre_w, pre_wp; + double cut, cutsq, cutinv, cutsqinv, pre_w, pre_wp; double ***C; double *C0; diff --git a/src/RHEO/compute_rheo_surface.cpp b/src/RHEO/compute_rheo_surface.cpp index bf2f2a3297..284afcd992 100644 --- a/src/RHEO/compute_rheo_surface.cpp +++ b/src/RHEO/compute_rheo_surface.cpp @@ -181,7 +181,7 @@ void ComputeRHEOSurface::compute_peratom() gradC[i][a] += dWij[a] * Volj; } - if (j < nlocal || newton) { + if ((j < nlocal) || newton) { for (a = 0; a < dim; a++){ divr[j] += dWji[a] * dx[a] * Voli; gradC[j][a] += dWji[a] * Voli; @@ -287,7 +287,7 @@ void ComputeRHEOSurface::compute_peratom() } } - // clear normal vectors for non surface particles + // clear normal vectors for non-surface particles for (i = 0; i < nall; i++) { if (mask[i] & groupbit) { diff --git a/src/RHEO/fix_rheo.cpp b/src/RHEO/fix_rheo.cpp index c704677bec..f12d10b8c5 100644 --- a/src/RHEO/fix_rheo.cpp +++ b/src/RHEO/fix_rheo.cpp @@ -39,7 +39,12 @@ using namespace RHEO_NS; using namespace FixConst; static const char cite_rheo[] = - "TBD\n\n"; + "@article{PalermoInPrep,\n" + " journal = {in prep},\n" + " title = {RHEO: A Hybrid Mesh-Free Model Framework for Dynamic Multi-Phase Flows},\n" + " year = {2024},\n" + " author = {Eric T. Palermo and Ki T. Wolf and Joel T. Clemmer and Thomas C. O'Connor},\n" + "}\n\n"; /* ---------------------------------------------------------------------- */ @@ -84,10 +89,9 @@ FixRHEO::FixRHEO(LAMMPS *lmp, int narg, char **arg) : error->all(FLERR, "fix rheo command requires atom_style with status"); if (narg < 5) - error->all(FLERR, "Insufficient arguments for fix rheo command"); + utils::missing_cmd_args(FLERR, "fix rheo", error); - h = utils::numeric(FLERR, arg[3], false, lmp); - cut = h; + cut = utils::numeric(FLERR, arg[3], false, lmp); if (strcmp(arg[4], "quintic") == 0) { kernel_style = QUINTIC; } else if (strcmp(arg[4], "wendland/c4") == 0) { @@ -109,7 +113,7 @@ FixRHEO::FixRHEO(LAMMPS *lmp, int narg, char **arg) : thermal_flag = 1; } else if (strcmp(arg[iarg], "surface/detection") == 0) { surface_flag = 1; - if(iarg + 3 >= narg) error->all(FLERR, "Illegal surface/detection option in fix rheo"); + if(iarg + 3 >= narg) utils::missing_cmd_args(FLERR, "fix rheo surface/detection", error); if (strcmp(arg[iarg + 1], "coordination") == 0) { surface_style = COORDINATION; zmin_surface = utils::inumeric(FLERR, arg[iarg + 2], false, lmp); @@ -130,12 +134,12 @@ FixRHEO::FixRHEO(LAMMPS *lmp, int narg, char **arg) : } else if (strcmp(arg[iarg], "self/mass") == 0) { self_mass_flag = 1; } else if (strcmp(arg[iarg], "density") == 0) { - if (iarg + n >= narg) error->all(FLERR, "Illegal rho0 option in fix rheo"); + if (iarg + n >= narg) utils::missing_cmd_args(FLERR, "fix rheo density", error); for (i = 1; i <= n; i++) rho0[i] = utils::numeric(FLERR, arg[iarg + i], false, lmp); iarg += n; } else if (strcmp(arg[iarg], "speed/sound") == 0) { - if (iarg + n >= narg) error->all(FLERR, "Illegal csq option in fix rheo"); + if (iarg + n >= narg) utils::missing_cmd_args(FLERR, "fix rheo speed/sound", error); for (i = 1; i <= n; i++) { csq[i] = utils::numeric(FLERR, arg[iarg + i], false, lmp); csq[i] *= csq[i]; @@ -281,7 +285,7 @@ void FixRHEO::setup(int /*vflag*/) if (!pressure_fix_defined) error->all(FLERR, "Missing fix rheo/pressure"); - if((!thermal_fix_defined) && thermal_flag) + if(thermal_flag && !thermal_fix_defined) error->all(FLERR, "Missing fix rheo/thermal"); // Reset to zero for future runs @@ -290,33 +294,6 @@ void FixRHEO::setup(int /*vflag*/) pressure_fix_defined = 0; oxidation_fix_defined = 0; - // Check fixes cover all atoms (may still fail if atoms are created) - // FixRHEOPressure currently requires group all - auto visc_fixes = modify->get_fix_by_style("rheo/viscosity"); - auto therm_fixes = modify->get_fix_by_style("rheo/thermal"); - - int *mask = atom->mask; - int v_coverage_flag = 1; - int t_coverage_flag = 1; - int covered; - for (int i = 0; i < atom->nlocal; i++) { - covered = 0; - for (auto fix : visc_fixes) - if (mask[i] & fix->groupbit) covered = 1; - if (!covered) v_coverage_flag = 0; - if (thermal_flag) { - covered = 0; - for (auto fix : therm_fixes) - if (mask[i] & fix->groupbit) covered = 1; - if (!covered) t_coverage_flag = 0; - } - } - - if (!v_coverage_flag) - error->one(FLERR, "Fix rheo/viscosity does not fully cover all atoms"); - if (!t_coverage_flag) - error->one(FLERR, "Fix rheo/thermal does not fully cover all atoms"); - if (rhosum_flag) compute_rhosum->compute_peratom(); } diff --git a/src/RHEO/fix_rheo.h b/src/RHEO/fix_rheo.h index 251f82a99a..8c62197fcd 100644 --- a/src/RHEO/fix_rheo.h +++ b/src/RHEO/fix_rheo.h @@ -39,7 +39,7 @@ class FixRHEO : public Fix { void reset_dt() override; // Model parameters - double h, cut; + double cut; double *rho0, *csq; int self_mass_flag; int zmin_kernel, zmin_surface, zmin_splash; diff --git a/src/RHEO/fix_rheo_oxidation.cpp b/src/RHEO/fix_rheo_oxidation.cpp index 5b0a50b4a5..acd833dfda 100644 --- a/src/RHEO/fix_rheo_oxidation.cpp +++ b/src/RHEO/fix_rheo_oxidation.cpp @@ -99,10 +99,10 @@ void FixRHEOOxidation::init() if (fixes.size() == 0) error->all(FLERR, "Need to define fix rheo to use fix rheo/oxidation"); fix_rheo = dynamic_cast(fixes[0]); - if (cut > fix_rheo->h) + if (cut > fix_rheo->cut) error->all(FLERR, "Bonding length exceeds kernel cutoff"); - if (rsurf >= fix_rheo->h) + if (rsurf >= fix_rheo->cut) error->all(FLERR, "Surface distance must be less than kernel cutoff"); if (!force->bond) error->all(FLERR, "Must define a bond style with fix rheo/oxidation"); @@ -233,7 +233,7 @@ void FixRHEOOxidation::post_integrate() // Add bonds to owned atoms // If newton bond off, add to both, otherwise add to whichever has a smaller tag - if (!newton_bond || tagi < tagj) { + if (!newton_bond || (tagi < tagj)) { if (num_bond[i] == atom->bond_per_atom) error->one(FLERR,"New bond exceeded bonds per atom in fix rheo/oxidation for atom {}", tagi); bond_type[i][num_bond[i]] = btype; diff --git a/src/RHEO/fix_rheo_thermal.cpp b/src/RHEO/fix_rheo_thermal.cpp index 321fee07e7..c1cda67500 100644 --- a/src/RHEO/fix_rheo_thermal.cpp +++ b/src/RHEO/fix_rheo_thermal.cpp @@ -71,6 +71,7 @@ FixRHEOThermal::FixRHEOThermal(LAMMPS *lmp, int narg, char **arg) : cut_bond = 0; comm_forward = 0; + // Currently can only have one instance of fix rheo/thermal if (igroup != 0) error->all(FLERR,"fix rheo/thermal command requires group all"); @@ -249,7 +250,7 @@ void FixRHEOThermal::init() auto fixes = modify->get_fix_by_style("^rheo$"); if (fixes.size() == 0) error->all(FLERR, "Need to define fix rheo to use fix rheo/viscosity"); fix_rheo = dynamic_cast(fixes[0]); - cut_kernel = fix_rheo->h; + cut_kernel = fix_rheo->cut; if (cut_bond > cut_kernel) error->all(FLERR, "Bonding length exceeds kernel cutoff"); @@ -263,16 +264,16 @@ void FixRHEOThermal::init() dth = 0.5 * update->dt; if (atom->esph_flag != 1) - error->all(FLERR,"fix rheo/thermal command requires atom property esph"); + error->all(FLERR, "fix rheo/thermal command requires atom property esph"); if (atom->temperature_flag != 1) - error->all(FLERR,"fix rheo/thermal command requires atom property temperature"); + error->all(FLERR, "fix rheo/thermal command requires atom property temperature"); if (atom->heatflow_flag != 1) - error->all(FLERR,"fix rheo/thermal command requires atom property heatflow"); + error->all(FLERR, "fix rheo/thermal command requires atom property heatflow"); if (atom->conductivity_flag != 1) - error->all(FLERR,"fix rheo/thermal command requires atom property conductivity"); + error->all(FLERR, "fix rheo/thermal command requires atom property conductivity"); if (cut_bond > 0.0) { - if (!force->bond) error->all(FLERR,"Must define a bond style to use reactive bond generation with fix rheo/thermal"); + if (!force->bond) error->all(FLERR, "Must define a bond style to use reactive bond generation with fix rheo/thermal"); if (!atom->avec->bonds_allow) error->all(FLERR, "Reactive bond generation in fix rheo/thermal requires atom bonds"); // all special weights must be 1.0 (no special neighbors) or there must be an instance of fix update/special/bonds @@ -561,7 +562,7 @@ void FixRHEOThermal::break_bonds() // Update special unless two owned atoms melt simultaneously then // only update for atom with lower tag if (fix_update_special_bonds) { - if (i < nlocal && j < nlocal && melti && meltj) { + if ((i < nlocal) && (j < nlocal) && melti && meltj) { if (tag[i] < tag[j]) { fix_update_special_bonds->add_broken_bond(i, j); } @@ -590,7 +591,7 @@ void FixRHEOThermal::break_bonds() // Delete bonds for non-melted local atoms (shifting) if (i < nlocal && !melti) { for (m = 0; m < num_bond[i]; m++) { - if (bond_atom[i][m] == tag[j] && bond_type[i][m] == btype) { + if ((bond_atom[i][m] == tag[j]) && (bond_type[i][m] == btype)) { nmax = num_bond[i] - 1; bond_type[i][m] = bond_type[i][nmax]; bond_atom[i][m] = bond_atom[i][nmax]; @@ -609,7 +610,7 @@ void FixRHEOThermal::break_bonds() if (j < nlocal && !meltj) { for (m = 0; m < num_bond[j]; m++) { - if (bond_atom[j][m] == tag[i] && bond_type[j][m] == btype) { + if ((bond_atom[j][m] == tag[i]) && (bond_type[j][m] == btype)) { nmax = num_bond[j] - 1; bond_type[j][m] = bond_type[j][nmax]; bond_atom[j][m] = bond_atom[j][nmax]; @@ -692,7 +693,7 @@ void FixRHEOThermal::create_bonds() // Add bonds to owned atoms // If newton bond off, add to both, otherwise add to whichever has a smaller tag - if (i < nlocal && (!newton_bond || tag[i] < tag[j])) { + if ((i < nlocal) && (!newton_bond || (tag[i] < tag[j]))) { if (num_bond[i] == atom->bond_per_atom) error->one(FLERR,"New bond exceeded bonds per atom in fix rheo/thermal"); bond_type[i][num_bond[i]] = btype; @@ -700,7 +701,7 @@ void FixRHEOThermal::create_bonds() num_bond[i]++; } - if (j < nlocal && (!newton_bond || tag[j] < tag[i])) { + if ((j < nlocal) && (!newton_bond || (tag[j] < tag[i]))) { if (num_bond[j] == atom->bond_per_atom) error->one(FLERR,"New bond exceeded bonds per atom in fix rheo/thermal"); bond_type[j][num_bond[j]] = btype; diff --git a/src/RHEO/fix_rheo_viscosity.cpp b/src/RHEO/fix_rheo_viscosity.cpp index 2d5d58d494..5cb1e7c4d0 100644 --- a/src/RHEO/fix_rheo_viscosity.cpp +++ b/src/RHEO/fix_rheo_viscosity.cpp @@ -46,6 +46,7 @@ FixRHEOViscosity::FixRHEOViscosity(LAMMPS *lmp, int narg, char **arg) : constant_flag = 0; evolve_flag = 0; + // Currently can only have one instance of fix rheo/viscosity if (igroup != 0) error->all(FLERR,"fix rheo/viscosity command requires group all"); diff --git a/src/RHEO/pair_rheo.cpp b/src/RHEO/pair_rheo.cpp index f206512950..731047201c 100644 --- a/src/RHEO/pair_rheo.cpp +++ b/src/RHEO/pair_rheo.cpp @@ -33,7 +33,6 @@ #include "modify.h" #include "neighbor.h" #include "neigh_list.h" -#include "update.h" #include "utils.h" #include @@ -81,7 +80,7 @@ void PairRHEO::compute(int eflag, int vflag) int pair_force_flag, pair_rho_flag, pair_avisc_flag; int fluidi, fluidj; double xtmp, ytmp, ztmp, w, wp, Ti, Tj, dT, csq_ave, cs_ave; - double rhoi, rhoj, rho0i, rho0j, voli, volj, Pi, Pj, etai, etaj, kappai, kappaj, eta_ave, kappa_ave,dT_prefactor; + double rhoi, rhoj, rho0i, rho0j, voli, volj, Pi, Pj, etai, etaj, kappai, kappaj, eta_ave, kappa_ave, dT_prefactor; double mu, q, fp_prefactor, drho_damp, fmag, psi_ij, Fij; double *dWij, *dWji, *dW1ij, *dW1ji; double dx[3], du[3], dv[3], fv[3], dfp[3], fsolid[3], ft[3], vi[3], vj[3]; @@ -112,7 +111,6 @@ void PairRHEO::compute(int eflag, int vflag) int *type = atom->type; int *status = atom->status; tagint *tag = atom->tag; - double fnorm, ftang[3]; double **fp_store, *chi; if (compute_interface) { @@ -169,7 +167,7 @@ void PairRHEO::compute(int eflag, int vflag) rsq = lensq3(dx); jtype = type[j]; - if (rsq < hsq) { + if (rsq < cutksq) { r = sqrt(rsq); rinv = 1 / r; @@ -219,16 +217,16 @@ void PairRHEO::compute(int eflag, int vflag) rhoj = compute_interface->correct_rho(j, i); Pj = fix_pressure->calc_pressure(rhoj, jtype); - if ((chi[j] > 0.9) && (r < (h * 0.5))) - fmag = (chi[j] - 0.9) * (h * 0.5 - r) * rho0j * csq_ave * h * rinv; + if ((chi[j] > 0.9) && (r < (cutk * 0.5))) + fmag = (chi[j] - 0.9) * (cutk * 0.5 - r) * rho0j * csq_ave * cutk * rinv; } else if ((!fluidi) && fluidj) { compute_interface->correct_v(vi, vj, i, j); rhoi = compute_interface->correct_rho(i, j); Pi = fix_pressure->calc_pressure(rhoi, itype); - if (chi[i] > 0.9 && r < (h * 0.5)) - fmag = (chi[i] - 0.9) * (h * 0.5 - r) * rho0i * csq_ave * h * rinv; + if (chi[i] > 0.9 && r < (cutk * 0.5)) + fmag = (chi[i] - 0.9) * (cutk * 0.5 - r) * rho0i * csq_ave * cutk * rinv; } else if ((!fluidi) && (!fluidj)) { rhoi = rho0i; @@ -281,8 +279,8 @@ void PairRHEO::compute(int eflag, int vflag) for (b = 0; b < dim; b++) du[a] -= 0.5 * (gradv[i][a * dim + b] + gradv[j][a * dim + b]) * dx[b]; - mu = dot3(du, dx) * hinv3; - mu /= (rsq * hinv3 * hinv3 + EPSILON); + mu = dot3(du, dx) * cutkinv3; + mu /= (rsq * cutkinv3 * cutkinv3 + EPSILON); mu = MIN(0.0, mu); q = av * (-2.0 * cs_ave * mu + mu * mu); fp_prefactor += voli * volj * q * (rhoj + rhoi); @@ -406,17 +404,17 @@ void PairRHEO::settings(int narg, char **arg) { if (narg < 1) error->all(FLERR, "Illegal pair_style command"); - h = utils::numeric(FLERR, arg[0], false, lmp); + cutk = utils::numeric(FLERR, arg[0], false, lmp); int iarg = 1; while (iarg < narg) { if (strcmp(arg[iarg], "rho/damp") == 0) { - if (iarg + 1 >= narg) error->all(FLERR, "Illegal pair_style command"); + if (iarg + 1 >= narg) utils::missing_cmd_args(FLERR, "pair rheo rho/damp", error); rho_damp_flag = 1; rho_damp = utils::numeric(FLERR, arg[iarg + 1], false, lmp); iarg++; } else if (strcmp(arg[iarg], "artificial/visc") == 0) { - if (iarg + 1 >= narg) error->all(FLERR, "Illegal pair_style command"); + if (iarg + 1 >= narg) utils::missing_cmd_args(FLERR, "pair rheo artificial/visc", error); artificial_visc_flag = 1; av = utils::numeric(FLERR, arg[iarg + 1], false, lmp); iarg++; @@ -477,12 +475,12 @@ void PairRHEO::setup() csq = fix_rheo->csq; rho0 = fix_rheo->rho0; - if (h != fix_rheo->h) - error->all(FLERR, "Pair rheo cutoff {} does not agree with fix rheo cutoff {}", h, fix_rheo->h); + if (cutk != fix_rheo->cut) + error->all(FLERR, "Pair rheo cutoff {} does not agree with fix rheo cutoff {}", cutk, fix_rheo->cut); - hsq = h * h; - hinv = 1.0 / h; - hinv3 = hinv * 3.0; + cutksq = cutk * cutk; + cutkinv = 1.0 / cutk; + cutkinv3 = cutkinv * 3.0; laplacian_order = -1; int n = atom->ntypes; @@ -512,7 +510,7 @@ double PairRHEO::init_one(int i, int j) if (setflag[i][j] == 0) error->all(FLERR, "All pair rheo coeffs are not set"); - return h; + return cutk; } /* ---------------------------------------------------------------------- */ diff --git a/src/RHEO/pair_rheo.h b/src/RHEO/pair_rheo.h index 7a47927962..eba3a70eea 100644 --- a/src/RHEO/pair_rheo.h +++ b/src/RHEO/pair_rheo.h @@ -37,8 +37,8 @@ class PairRHEO : public Pair { void unpack_reverse_comm(int, int *, double *) override; protected: - double h, *csq, *rho0; // From fix RHEO - double *cs, hsq, hinv, hinv3, av, rho_damp; + double cutk, *csq, *rho0; // From fix RHEO + double *cs, cutksq, cutkinv, cutkinv3, av, rho_damp; int laplacian_order; int artificial_visc_flag; From d5c90eebfd0b59c78b8588ab993dd2749f789e13 Mon Sep 17 00:00:00 2001 From: jtclemm Date: Fri, 28 Jun 2024 17:27:13 -0600 Subject: [PATCH 094/158] Flipping doc reference name --- doc/src/bond_rheo_shell.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/src/bond_rheo_shell.rst b/doc/src/bond_rheo_shell.rst index 439f88ec8e..f83219b9f3 100644 --- a/doc/src/bond_rheo_shell.rst +++ b/doc/src/bond_rheo_shell.rst @@ -54,7 +54,7 @@ Before bonds are enabled, they are still treated as regular bonds by all other parts of LAMMPS. This means they are written to data files and counted in computes such as :doc:`nbond/atom `. To only count enabled bonds, use the *nbond/shell* attribute in -:doc:`compute property/atom/rheo `. +:doc:`compute rheo/property/atom `. When enabled, the bond then computes forces based on deviations from the initial reference state of the two atoms much like a BPM style From 49c84dbe1eb9f57c422f7d0e177df6031ba0d22e Mon Sep 17 00:00:00 2001 From: Ludwig Ahrens-Iwers Date: Mon, 1 Jul 2024 10:05:28 +0200 Subject: [PATCH 095/158] Bugfix virial with fix electrode --- .../PACKAGES/electrode/madelung/.gitignore | 1 + examples/PACKAGES/electrode/madelung/eval.py | 18 +++- .../PACKAGES/electrode/madelung/plate_cap.py | 98 +++++++++++++++-- .../PACKAGES/electrode/madelung/settings.mod | 6 +- src/ELECTRODE/fix_electrode_conp.cpp | 100 +++++++++++++++--- src/ELECTRODE/fix_electrode_conp.h | 3 +- 6 files changed, 197 insertions(+), 29 deletions(-) diff --git a/examples/PACKAGES/electrode/madelung/.gitignore b/examples/PACKAGES/electrode/madelung/.gitignore index 89d8d1a065..f222840fd6 100644 --- a/examples/PACKAGES/electrode/madelung/.gitignore +++ b/examples/PACKAGES/electrode/madelung/.gitignore @@ -1,2 +1,3 @@ *.csv *.txt +*.lammpstrj diff --git a/examples/PACKAGES/electrode/madelung/eval.py b/examples/PACKAGES/electrode/madelung/eval.py index feda0e384e..8f3675a741 100644 --- a/examples/PACKAGES/electrode/madelung/eval.py +++ b/examples/PACKAGES/electrode/madelung/eval.py @@ -17,14 +17,22 @@ q_ref = float(ref_line[3]) inv11_ref = float(ref_line[4]) inv12_ref = float(ref_line[5]) b1_ref = float(ref_line[6]) +felec1_ref = float(ref_line[8]) +felyt1_ref = float(ref_line[10]) +press_ref = float(ref_line[12]) # out.csv with open(sys.argv[2]) as f: out_line = f.readlines()[-1].split(", ") e_out = float(out_line[0]) q_out = float(out_line[1]) +press_out = float(out_line[2]) -out_lines = [("energy", e_ref, e_out), ("charge", q_ref, q_out)] +out_lines = [ + ("energy", e_ref, e_out), + ("charge", q_ref, q_out), + ("pressure", press_ref, press_out), +] # vec.csv vec_file = "vec.csv" @@ -44,6 +52,14 @@ if op.isfile(inv_file): inv12_out = float(inv_line[1]) out_lines.append(("inv11", inv11_ref, inv11_out)) +# forces.lammpstrj +force_file = "forces.lammpstrj" +with open(force_file) as f: + lines = f.readlines()[9:] + for name, i, f_ref in [("felec1", "1", felec1_ref), ("felyt1", "3", felyt1_ref)]: + f_out = next(float(y[3]) for x in lines if (y := x.split()) and y[0] == i) + out_lines.append((name, f_ref, f_out)) + lines = [] for label, ref, out in out_lines: error = rel_error(out, ref) diff --git a/examples/PACKAGES/electrode/madelung/plate_cap.py b/examples/PACKAGES/electrode/madelung/plate_cap.py index fcca166869..37aad47f51 100755 --- a/examples/PACKAGES/electrode/madelung/plate_cap.py +++ b/examples/PACKAGES/electrode/madelung/plate_cap.py @@ -1,12 +1,17 @@ #!/usr/bin/env python3 +import time + import numpy as np from scipy.special import erf SQRT2 = np.sqrt(2) +SQRTPI_INV = 1 / np.sqrt(np.pi) COULOMB = 332.06371 # Coulomb constant in Lammps 'real' units QE2F = 23.060549 +NKTV2P = 68568.415 # pressure in 'real' units LENGTH = 10000 # convergence parameter +LZ = 20 def lattice(length): @@ -26,6 +31,25 @@ def b_element(r, q, eta): return q * erf(eta * r) / r +def force_gauss(r, qq, eta): + etar = eta * r + return (qq / np.square(r)) * ( + erf(etar) - 2 * etar * SQRTPI_INV * np.exp(-np.square(etar)) + ) + + +def force_point(r, qq): + return qq / np.square(r) + + +def force_component(dx, d, qq, eta=None): + if eta: + return np.sum(dx / d * force_gauss(d, qq, eta)) + else: + return np.sum(dx / d * force_point(d, qq)) + + +time_start = time.perf_counter() a = 1 # nearest neighbor distance i.e. lattice constant / sqrt(2) x_elec = [-2, 2] x_elyt = [-1, 1] @@ -36,8 +60,20 @@ v = np.array([-0.5, 0.5]) * (QE2F / COULOMB) # distances to images within electrode and to opposite electrode distances = a * np.linalg.norm(lattice(LENGTH), axis=1) opposite_distances = np.sqrt(np.square(distances) + distance_plates**2) +image_distances = [] +for x in x_elec: + image_distances.append([]) + for y in x_elyt: + image_distances[-1].append(np.sqrt(np.square(distances) + np.abs(y - x) ** 2)) +image_elyt_distances = [[None for _ in range(len(x_elyt))] for _ in range(len(x_elyt))] +for i, (xi, qi) in enumerate(zip(x_elyt, q_elyt)): + for j, (xj, qj) in list(enumerate(zip(x_elyt, q_elyt)))[i + 1 :]: + image_elyt_distances[i][j] = np.sqrt( + np.square(distances) + np.abs(xj - xi) ** 2 + ) for name, eta_elec in [("", [2.0, 2.0]), ("_eta_mix", [0.5, 3.0])]: + # for name, eta_elec in [("", [2.0, 2.0])]: eta_mix = np.prod(eta_elec) / np.sqrt(np.sum(np.square(eta_elec))) # self interaction and within original box A_11 = np.sqrt(2 / np.pi) * eta_elec[0] @@ -55,22 +91,18 @@ for name, eta_elec in [("", [2.0, 2.0]), ("_eta_mix", [0.5, 3.0])]: # electrode-electrolyte interaction b = [] - for x, eta in zip(x_elec, eta_elec): + for i, (x, eta) in enumerate(zip(x_elec, eta_elec)): bi = 0 - for y, q in zip(x_elyt, q_elyt): - d = abs(y - x) - bi += b_element(d, q, eta) - image_distances = np.sqrt(np.square(distances) + d**2) - bi += 4 * np.sum(b_element(image_distances, q, eta)) + for j, (y, q) in enumerate(zip(x_elyt, q_elyt)): + bi += b_element(np.abs(y - x), q, eta) + bi += 4 * np.sum(b_element(image_distances[i][j], q, eta)) b.append(bi) b = np.array(b) # electrolyte-electrolyte energy elyt_11 = 4 * np.sum(1 / distances) distance_elyt = x_elyt[1] - x_elyt[0] - elyt_12 = 1 / distance_elyt + 4 * np.sum( - 1 / np.sqrt(np.square(distances) + distance_elyt**2) - ) + elyt_12 = 1 / distance_elyt + 4 * np.sum(1 / image_elyt_distances[0][1]) elyt = np.array([[elyt_11, elyt_12], [elyt_12, elyt_11]]) energy_elyt = 0.5 * np.dot(q_elyt, np.dot(elyt, q_elyt)) @@ -78,9 +110,48 @@ for name, eta_elec in [("", [2.0, 2.0]), ("_eta_mix", [0.5, 3.0])]: q = np.dot(inv, v - b) energy = COULOMB * (0.5 * np.dot(q, np.dot(A, q)) + np.dot(b, q) + energy_elyt) + # forces in out-of-plane direction + f_elec = np.zeros(len(x_elec)) + f_elyt = np.zeros(len(x_elyt)) + # electrode-electrode + dx = x_elec[1] - x_elec[0] + fij_box = force_component(dx, np.abs(dx), q[0] * q[1], eta_mix) + fij_img = 4 * force_component(dx, opposite_distances, q[0] * q[1], eta_mix) + f_elec[0] -= fij_box + fij_img + f_elec[1] += fij_box + fij_img + # electrode-electrolyte + for i, (xi, qi, etai) in enumerate(zip(x_elec, q, eta_elec)): + for j, (xj, qj) in enumerate(zip(x_elyt, q_elyt)): + dx = xj - xi + fij_box = force_component(dx, np.abs(dx), qi * qj, etai) + fij_img = 4 * force_component(dx, image_distances[i][j], qi * qj, etai) + f_elec[i] -= fij_box + fij_img + f_elyt[j] += fij_box + fij_img + # electrolyte-electrolyte + for i, (xi, qi) in enumerate(zip(x_elyt, q_elyt)): + for j, (xj, qj) in list(enumerate(zip(x_elyt, q_elyt)))[i + 1 :]: + dx = xj - xi + fij_box = force_component(dx, np.abs(dx), qi * qj) + fij_img = 4 * force_component(dx, image_elyt_distances[i][j], qi * qj) + f_elyt[i] -= fij_img + fij_box + f_elyt[j] += fij_img + fij_box + # force units + assert np.abs(np.sum(f_elec) + np.sum(f_elyt)) < 1e-8 + f_elec *= COULOMB + f_elyt *= COULOMB + + # Virial + volume = a**2 * LZ + virial = 0.0 + for x, f in [(x_elec, f_elec), (x_elyt, f_elyt)]: + virial += np.dot(x, f) + pressure = NKTV2P * virial / volume + with open(f"plate_cap{name}.csv", "w") as f: f.write( - "length, energy / kcal/mol, q1 / e, q2 / e, inv11 / A, inv12 / A, b1 / e/A, b2 / e/A\n" + "length, energy / kcal/mol, q1 / e, q2 / e, inv11 / A, inv12 / A" + + ", b1 / e/A, b2 / e/A, felec1 / kcal/mol/A, felec2 / kcal/mol/A" + + ", felyt1 / kcal/mol/A, felyt2 / kcal/mol/A, press\n" ) f.write( ", ".join( @@ -93,7 +164,14 @@ for name, eta_elec in [("", [2.0, 2.0]), ("_eta_mix", [0.5, 3.0])]: f"{inv[0, 1]:.10f}", f"{b[0]:.8f}", f"{b[1]:.8f}", + f"{f_elec[0]:.5f}", + f"{f_elec[1]:.5f}", + f"{f_elyt[0]:.5f}", + f"{f_elyt[1]:.5f}", + f"{pressure:.2f}", ] ) + "\n" ) +time_end = time.perf_counter() +print(f"{time_end - time_start:0.4f} seconds") diff --git a/examples/PACKAGES/electrode/madelung/settings.mod b/examples/PACKAGES/electrode/madelung/settings.mod index aa1096ea81..bb5c8e42ae 100644 --- a/examples/PACKAGES/electrode/madelung/settings.mod +++ b/examples/PACKAGES/electrode/madelung/settings.mod @@ -19,4 +19,8 @@ compute qtop top reduce sum v_q compute compute_pe all pe variable vpe equal c_compute_pe variable charge equal c_qtop -fix fxprint all print 1 "${vpe}, ${charge}" file "out.csv" +compute press all pressure NULL virial +variable p3 equal c_press[3] +fix fxprint all print 1 "${vpe}, ${charge}, ${p3}" file "out.csv" + +dump dump_forces all custom 1 forces.lammpstrj id fx fy fz diff --git a/src/ELECTRODE/fix_electrode_conp.cpp b/src/ELECTRODE/fix_electrode_conp.cpp index a4b9d5b3b9..aaa7f2fb99 100644 --- a/src/ELECTRODE/fix_electrode_conp.cpp +++ b/src/ELECTRODE/fix_electrode_conp.cpp @@ -89,6 +89,9 @@ FixElectrodeConp::FixElectrodeConp(LAMMPS *lmp, int narg, char **arg) : extvector = 0; extarray = 0; + virial_global_flag = 1; // use virials of this fix + thermo_virial = 1; // set vflags for v_tally + bool default_algo = true; algo = Algo::MATRIX_INV; matrix_algo = true; @@ -642,13 +645,15 @@ void FixElectrodeConp::setup_post_neighbor() /* ---------------------------------------------------------------------- */ -void FixElectrodeConp::setup_pre_reverse(int eflag, int /*vflag*/) +void FixElectrodeConp::setup_pre_reverse(int eflag, int vflag) { + if (pair->did_tally_callback()) + error->warning(FLERR, + "Computation of Virials in fix electrode is incompatible with TALLY package"); // correct forces for initial timestep - gausscorr(eflag, true); + ev_init(eflag, vflag); + gausscorr(eflag, vflag, true); self_energy(eflag); - // potential_energy(eflag); // not always part of the energy, depending on ensemble, therefore - // removed } /* ---------------------------------------------------------------------- */ @@ -775,12 +780,11 @@ void FixElectrodeConp::pre_force(int) /* ---------------------------------------------------------------------- */ -void FixElectrodeConp::pre_reverse(int eflag, int /*vflag*/) +void FixElectrodeConp::pre_reverse(int eflag, int vflag) { - gausscorr(eflag, true); + ev_init(eflag, vflag); + gausscorr(eflag, vflag, true); self_energy(eflag); - //potential_energy(eflag); // not always part of the energy, depending on ensemble, therefore - // removed } /* ---------------------------------------------------------------------- */ @@ -1228,11 +1232,10 @@ double FixElectrodeConp::self_energy(int eflag) /* ---------------------------------------------------------------------- */ -double FixElectrodeConp::gausscorr(int eflag, bool fflag) +double FixElectrodeConp::gausscorr(int eflag, int vflag, bool fflag) { // correction to short range interaction due to eta - int evflag = pair->evflag; double const qqrd2e = force->qqrd2e; int const nlocal = atom->nlocal; int *mask = atom->mask; @@ -1298,13 +1301,11 @@ double FixElectrodeConp::gausscorr(int eflag, bool fflag) f[j][2] -= delz * fpair; } } - - double ecoul = 0.; - if (eflag) ecoul = -prefactor * erfc_etar; - - if (evflag) { - force->pair->ev_tally(i, j, nlocal, newton_pair, 0., ecoul, fpair, delx, dely, delz); + if (eflag) { + double ecoul = -prefactor * erfc_etar; + force->pair->ev_tally(i, j, nlocal, newton_pair, 0., ecoul, 0., 0., 0., 0.); } + if (vflag) v_tally(i, j, nlocal, newton_pair, fpair, delx, dely, delz); } } } @@ -1625,3 +1626,70 @@ void FixElectrodeConp::unpack_forward_comm(int n, int first, double *buf) int const last = first + n; for (int i = first, m = 0; i < last; i++) atom->q[i] = buf[m++]; } + +/* ---------------------------------------------------------------------- + Tally virial of pair interactions in pre_reverse. This cannot be done with pair->ev_tally() + because compute_fdotr is called before pre_reverse, i.e. Virials need to be tallied even if fdotr + is used. +------------------------------------------------------------------------- */ + +void FixElectrodeConp::v_tally(int i, int j, int nlocal, int newton_pair, double fpair, double delx, + double dely, double delz) +{ + double v[6]; + if (vflag_either) { + v[0] = delx * delx * fpair; + v[1] = dely * dely * fpair; + v[2] = delz * delz * fpair; + v[3] = delx * dely * fpair; + v[4] = delx * delz * fpair; + v[5] = dely * delz * fpair; + + if (vflag_global) { + if (newton_pair) { + virial[0] += v[0]; + virial[1] += v[1]; + virial[2] += v[2]; + virial[3] += v[3]; + virial[4] += v[4]; + virial[5] += v[5]; + } else { + if (i < nlocal) { + virial[0] += 0.5 * v[0]; + virial[1] += 0.5 * v[1]; + virial[2] += 0.5 * v[2]; + virial[3] += 0.5 * v[3]; + virial[4] += 0.5 * v[4]; + virial[5] += 0.5 * v[5]; + } + if (j < nlocal) { + virial[0] += 0.5 * v[0]; + virial[1] += 0.5 * v[1]; + virial[2] += 0.5 * v[2]; + virial[3] += 0.5 * v[3]; + virial[4] += 0.5 * v[4]; + virial[5] += 0.5 * v[5]; + } + } + } + + if (vflag_atom) { + if (newton_pair || i < nlocal) { + vatom[i][0] += 0.5 * v[0]; + vatom[i][1] += 0.5 * v[1]; + vatom[i][2] += 0.5 * v[2]; + vatom[i][3] += 0.5 * v[3]; + vatom[i][4] += 0.5 * v[4]; + vatom[i][5] += 0.5 * v[5]; + } + if (newton_pair || j < nlocal) { + vatom[j][0] += 0.5 * v[0]; + vatom[j][1] += 0.5 * v[1]; + vatom[j][2] += 0.5 * v[2]; + vatom[j][3] += 0.5 * v[3]; + vatom[j][4] += 0.5 * v[4]; + vatom[j][5] += 0.5 * v[5]; + } + } + } +} diff --git a/src/ELECTRODE/fix_electrode_conp.h b/src/ELECTRODE/fix_electrode_conp.h index a1d7530bd1..b0b4a1fd46 100644 --- a/src/ELECTRODE/fix_electrode_conp.h +++ b/src/ELECTRODE/fix_electrode_conp.h @@ -119,10 +119,11 @@ class FixElectrodeConp : public Fix { void create_taglist(); void invert(); void symmetrize(); - double gausscorr(int, bool); + double gausscorr(int, int, bool); void update_charges(); double potential_energy(); double self_energy(int); + void v_tally(int, int, int, int, double, double, double, double); void write_to_file(FILE *, const std::vector &, const std::vector> &); void read_from_file(const std::string &input_file, double **, const std::string &); void compute_sd_vectors(); From b8360631e1448f109195d3242e2d9136bf16dde3 Mon Sep 17 00:00:00 2001 From: Shern Tee Date: Mon, 1 Jul 2024 10:35:54 +0200 Subject: [PATCH 096/158] Fix typos and add TF definitions to fix_electrode.rst --- doc/src/fix_electrode.rst | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/doc/src/fix_electrode.rst b/doc/src/fix_electrode.rst index 1a28f88bc1..99e098db31 100644 --- a/doc/src/fix_electrode.rst +++ b/doc/src/fix_electrode.rst @@ -110,7 +110,7 @@ electrostatic configurations: :ref:`(Deissenbeck)` between two electrodes * (resulting in changing charges and potentials with appropriate - average potential difference and thermal variance) + average potential difference and thermal variance) The first group-ID provided to each fix specifies the first electrode group, and more group(s) are added using the *couple* keyword for each @@ -284,8 +284,18 @@ The *fix_modify tf* option enables the Thomas-Fermi metallicity model fix_modify ID tf type length voronoi -If this option is used parameters must be set for all atom types of the -electrode. +If this option is used, these two parameters must be set for +all atom types of the electrode: + +* `tf` is the Thomas-Fermi length :math:`l_{TF}` +* `voronoi` is the Voronoi volume per atom in units of length cubed + +Different types may have different `tf` and `voronoi` values. +The following self-energy term is then added for all electrode atoms: + +.. math:: + + A_{ii} += \frac{1}{4 \pi \epsilon_0} \times \frac{4 \pi l_{TF}^2}{\mathrm{Voronoi volume}} The *fix_modify timer* option turns on (off) additional timer outputs in the log file, for code developers to track optimization. @@ -318,9 +328,11 @@ The global array has *N* rows and *2N+1* columns, where the fix manages array, the elements are: * array[I][1] = total charge that group *I* would have had *if it were - at 0 V applied potential* * array[I][2 to *N* + 1] = the *N* entries + at 0 V applied potential* +* array[I][2 to *N* + 1] = the *N* entries of the *I*-th row of the electrode capacitance matrix (definition - follows) * array[I][*N* + 2 to *2N* + 1] = the *N* entries of the + follows) +* array[I][*N* + 2 to *2N* + 1] = the *N* entries of the *I*-th row of the electrode elastance matrix (the inverse of the electrode capacitance matrix) From 4b8f961098102120e6dc41322e9df66932f73e95 Mon Sep 17 00:00:00 2001 From: jtclemm Date: Tue, 2 Jul 2024 14:00:37 -0600 Subject: [PATCH 097/158] Updating headers --- src/GRANULAR/fix_add_heat.cpp | 2 +- src/RHEO/atom_vec_rheo.cpp | 19 ++++++++++--------- src/RHEO/atom_vec_rheo_thermal.cpp | 19 ++++++++++--------- src/RHEO/bond_rheo_shell.cpp | 1 + src/RHEO/compute_rheo_grad.cpp | 1 + src/RHEO/compute_rheo_interface.cpp | 19 ++++++++++--------- src/RHEO/compute_rheo_kernel.cpp | 19 ++++++++++--------- src/RHEO/compute_rheo_rho_sum.cpp | 5 +++-- src/RHEO/compute_rheo_surface.cpp | 19 ++++++++++--------- src/RHEO/compute_rheo_vshift.cpp | 19 ++++++++++--------- src/RHEO/fix_rheo.cpp | 19 ++++++++++--------- src/RHEO/fix_rheo_oxidation.cpp | 19 ++++++++++--------- src/RHEO/fix_rheo_pressure.cpp | 19 ++++++++++--------- src/RHEO/fix_rheo_thermal.cpp | 19 ++++++++++--------- src/RHEO/fix_rheo_viscosity.cpp | 19 ++++++++++--------- src/RHEO/pair_rheo.cpp | 19 ++++++++++--------- src/RHEO/pair_rheo_solid.cpp | 1 + 17 files changed, 127 insertions(+), 111 deletions(-) diff --git a/src/GRANULAR/fix_add_heat.cpp b/src/GRANULAR/fix_add_heat.cpp index a68c9c2b95..01bc22cdf4 100644 --- a/src/GRANULAR/fix_add_heat.cpp +++ b/src/GRANULAR/fix_add_heat.cpp @@ -1,4 +1,4 @@ -/* -*- c++ -*- ---------------------------------------------------------- +/* ---------------------------------------------------------------------- LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator https://www.lammps.org/, Sandia National Laboratories LAMMPS development team: developers@lammps.org diff --git a/src/RHEO/atom_vec_rheo.cpp b/src/RHEO/atom_vec_rheo.cpp index 843269a717..92f5ca05a4 100644 --- a/src/RHEO/atom_vec_rheo.cpp +++ b/src/RHEO/atom_vec_rheo.cpp @@ -1,15 +1,16 @@ +// clang-format off /* ---------------------------------------------------------------------- - LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator - https://www.lammps.org/, Sandia National Laboratories - LAMMPS development team: developers@lammps.org + 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. + 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. - ------------------------------------------------------------------------- */ + See the README file in the top-level LAMMPS directory. +------------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- Contributing authors: diff --git a/src/RHEO/atom_vec_rheo_thermal.cpp b/src/RHEO/atom_vec_rheo_thermal.cpp index 7174d4cb66..f541e2a0cb 100644 --- a/src/RHEO/atom_vec_rheo_thermal.cpp +++ b/src/RHEO/atom_vec_rheo_thermal.cpp @@ -1,15 +1,16 @@ +// clang-format off /* ---------------------------------------------------------------------- - LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator - https://www.lammps.org/, Sandia National Laboratories - LAMMPS development team: developers@lammps.org + 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. + 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. - ------------------------------------------------------------------------- */ + See the README file in the top-level LAMMPS directory. +------------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- Contributing authors: diff --git a/src/RHEO/bond_rheo_shell.cpp b/src/RHEO/bond_rheo_shell.cpp index 9c198364d6..81e5ba02d1 100644 --- a/src/RHEO/bond_rheo_shell.cpp +++ b/src/RHEO/bond_rheo_shell.cpp @@ -1,3 +1,4 @@ +// clang-format off /* ---------------------------------------------------------------------- LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator https://www.lammps.org/, Sandia National Laboratories diff --git a/src/RHEO/compute_rheo_grad.cpp b/src/RHEO/compute_rheo_grad.cpp index 8b618e6e04..216fcb1978 100644 --- a/src/RHEO/compute_rheo_grad.cpp +++ b/src/RHEO/compute_rheo_grad.cpp @@ -1,3 +1,4 @@ +// clang-format off /* ---------------------------------------------------------------------- LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator https://www.lammps.org/, Sandia National Laboratories diff --git a/src/RHEO/compute_rheo_interface.cpp b/src/RHEO/compute_rheo_interface.cpp index 672c63ba29..ec8c10f276 100644 --- a/src/RHEO/compute_rheo_interface.cpp +++ b/src/RHEO/compute_rheo_interface.cpp @@ -1,15 +1,16 @@ +// clang-format off /* ---------------------------------------------------------------------- - LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator - https://www.lammps.org/, Sandia National Laboratories - LAMMPS development team: developers@lammps.org + 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. + 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. - ------------------------------------------------------------------------- */ + See the README file in the top-level LAMMPS directory. +------------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- Contributing authors: diff --git a/src/RHEO/compute_rheo_kernel.cpp b/src/RHEO/compute_rheo_kernel.cpp index cb9a42323b..77733f9716 100644 --- a/src/RHEO/compute_rheo_kernel.cpp +++ b/src/RHEO/compute_rheo_kernel.cpp @@ -1,15 +1,16 @@ +// clang-format off /* ---------------------------------------------------------------------- - LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator - https://www.lammps.org/, Sandia National Laboratories - LAMMPS development team: developers@lammps.org + 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. + 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. - ------------------------------------------------------------------------- */ + See the README file in the top-level LAMMPS directory. +------------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- Contributing authors: diff --git a/src/RHEO/compute_rheo_rho_sum.cpp b/src/RHEO/compute_rheo_rho_sum.cpp index d7f432a03d..6e25b35374 100644 --- a/src/RHEO/compute_rheo_rho_sum.cpp +++ b/src/RHEO/compute_rheo_rho_sum.cpp @@ -1,7 +1,8 @@ +// clang-format off /* ---------------------------------------------------------------------- LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator - http://lammps.sandia.gov, Sandia National Laboratories - Steve Plimpton, sjplimp@sandia.gov + 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 diff --git a/src/RHEO/compute_rheo_surface.cpp b/src/RHEO/compute_rheo_surface.cpp index 284afcd992..69b0ebd108 100644 --- a/src/RHEO/compute_rheo_surface.cpp +++ b/src/RHEO/compute_rheo_surface.cpp @@ -1,15 +1,16 @@ +// clang-format off /* ---------------------------------------------------------------------- - LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator - https://www.lammps.org/, Sandia National Laboratories - LAMMPS development team: developers@lammps.org + 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. + 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. - ------------------------------------------------------------------------- */ + See the README file in the top-level LAMMPS directory. +------------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- Contributing authors: diff --git a/src/RHEO/compute_rheo_vshift.cpp b/src/RHEO/compute_rheo_vshift.cpp index 6e858ca207..b01912111f 100644 --- a/src/RHEO/compute_rheo_vshift.cpp +++ b/src/RHEO/compute_rheo_vshift.cpp @@ -1,15 +1,16 @@ +// clang-format off /* ---------------------------------------------------------------------- - LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator - https://www.lammps.org/, Sandia National Laboratories - LAMMPS development team: developers@lammps.org + 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. + 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. - ------------------------------------------------------------------------- */ + See the README file in the top-level LAMMPS directory. +------------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- Contributing authors: diff --git a/src/RHEO/fix_rheo.cpp b/src/RHEO/fix_rheo.cpp index f12d10b8c5..cd0ca1069a 100644 --- a/src/RHEO/fix_rheo.cpp +++ b/src/RHEO/fix_rheo.cpp @@ -1,15 +1,16 @@ +// clang-format off /* ---------------------------------------------------------------------- - LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator - https://www.lammps.org/, Sandia National Laboratories - LAMMPS development team: developers@lammps.org + 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. + 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. - ------------------------------------------------------------------------- */ + See the README file in the top-level LAMMPS directory. +------------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- Contributing authors: diff --git a/src/RHEO/fix_rheo_oxidation.cpp b/src/RHEO/fix_rheo_oxidation.cpp index acd833dfda..74d1bbab57 100644 --- a/src/RHEO/fix_rheo_oxidation.cpp +++ b/src/RHEO/fix_rheo_oxidation.cpp @@ -1,15 +1,16 @@ +// clang-format off /* ---------------------------------------------------------------------- - LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator - https://www.lammps.org/, Sandia National Laboratories - LAMMPS development team: developers@lammps.org + 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. + 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. - ------------------------------------------------------------------------- */ + See the README file in the top-level LAMMPS directory. +------------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- Contributing authors: diff --git a/src/RHEO/fix_rheo_pressure.cpp b/src/RHEO/fix_rheo_pressure.cpp index d6dea8aa1a..82adf52012 100644 --- a/src/RHEO/fix_rheo_pressure.cpp +++ b/src/RHEO/fix_rheo_pressure.cpp @@ -1,15 +1,16 @@ +// clang-format off /* ---------------------------------------------------------------------- - LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator - https://www.lammps.org/, Sandia National Laboratories - LAMMPS development team: developers@lammps.org + 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. + 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. - ------------------------------------------------------------------------- */ + See the README file in the top-level LAMMPS directory. +------------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- Contributing authors: diff --git a/src/RHEO/fix_rheo_thermal.cpp b/src/RHEO/fix_rheo_thermal.cpp index c1cda67500..dbb59f12f7 100644 --- a/src/RHEO/fix_rheo_thermal.cpp +++ b/src/RHEO/fix_rheo_thermal.cpp @@ -1,15 +1,16 @@ +// clang-format off /* ---------------------------------------------------------------------- - LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator - https://www.lammps.org/, Sandia National Laboratories - LAMMPS development team: developers@lammps.org + 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. + 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. - ------------------------------------------------------------------------- */ + See the README file in the top-level LAMMPS directory. +------------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- Contributing authors: diff --git a/src/RHEO/fix_rheo_viscosity.cpp b/src/RHEO/fix_rheo_viscosity.cpp index 5cb1e7c4d0..3ca7fd8d13 100644 --- a/src/RHEO/fix_rheo_viscosity.cpp +++ b/src/RHEO/fix_rheo_viscosity.cpp @@ -1,15 +1,16 @@ +// clang-format off /* ---------------------------------------------------------------------- - LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator - https://www.lammps.org/, Sandia National Laboratories - LAMMPS development team: developers@lammps.org + 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. + 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. - ------------------------------------------------------------------------- */ + See the README file in the top-level LAMMPS directory. +------------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- Contributing authors: diff --git a/src/RHEO/pair_rheo.cpp b/src/RHEO/pair_rheo.cpp index 731047201c..b9beaf8383 100644 --- a/src/RHEO/pair_rheo.cpp +++ b/src/RHEO/pair_rheo.cpp @@ -1,15 +1,16 @@ +// clang-format off /* ---------------------------------------------------------------------- - LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator - https://www.lammps.org/, Sandia National Laboratories - LAMMPS development team: developers@lammps.org + 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. + 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. - ------------------------------------------------------------------------- */ + See the README file in the top-level LAMMPS directory. +------------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- Contributing authors: diff --git a/src/RHEO/pair_rheo_solid.cpp b/src/RHEO/pair_rheo_solid.cpp index 9b358420d2..1c8654b3c4 100644 --- a/src/RHEO/pair_rheo_solid.cpp +++ b/src/RHEO/pair_rheo_solid.cpp @@ -1,3 +1,4 @@ +// clang-format off /* ---------------------------------------------------------------------- LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator https://www.lammps.org/, Sandia National Laboratories From 3385198b51b5555a9565b2844aa0ee95e504582c Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Wed, 3 Jul 2024 00:51:32 -0400 Subject: [PATCH 098/158] fix typo --- doc/src/atom_modify.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/src/atom_modify.rst b/doc/src/atom_modify.rst index 0d750f1755..9091626feb 100644 --- a/doc/src/atom_modify.rst +++ b/doc/src/atom_modify.rst @@ -190,7 +190,7 @@ Default By default, *id* is yes. By default, atomic systems (no bond topology info) do not use a map. For molecular systems (with bond topology info), the default is to use a map of either *array* or *hash* style -depending on the size of the sustem, as explained above for the *map +depending on the size of the system, as explained above for the *map yes* keyword/value option. By default, a *first* group is not defined. By default, sorting is enabled with a frequency of 1000 and a binsize of 0.0, which means the neighbor cutoff will be used to set From 0a6fd5b097b7f9ad372ac7ac7afb7ba6c9c52205 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Wed, 3 Jul 2024 03:41:57 -0400 Subject: [PATCH 099/158] get rid of some evil tabs --- src/RHEO/compute_rheo_kernel.cpp | 42 ++++++++++++++++---------------- 1 file changed, 21 insertions(+), 21 deletions(-) diff --git a/src/RHEO/compute_rheo_kernel.cpp b/src/RHEO/compute_rheo_kernel.cpp index 77733f9716..a5865b894a 100644 --- a/src/RHEO/compute_rheo_kernel.cpp +++ b/src/RHEO/compute_rheo_kernel.cpp @@ -249,25 +249,25 @@ double ComputeRHEOKernel::calc_w_quintic(int i, int j, double delx, double dely, double w, tmp1, tmp2, tmp3, tmp1sq, tmp2sq, tmp3sq, s; s = r * 3.0 * cutinv; - if (s > 3.0) { - w = 0.0; - } + if (s > 3.0) { + w = 0.0; + } - if (s <= 3.0) { - tmp3 = 3.0 - s; - tmp3sq = tmp3 * tmp3; - w = tmp3sq * tmp3sq * tmp3; - } - if (s <= 2.0) { + if (s <= 3.0) { + tmp3 = 3.0 - s; + tmp3sq = tmp3 * tmp3; + w = tmp3sq * tmp3sq * tmp3; + } + if (s <= 2.0) { tmp2 = 2.0 - s; tmp2sq = tmp2 * tmp2; w -= 6.0 * tmp2sq * tmp2sq * tmp2; - } - if (s <= 1.0) { - tmp1 = 1.0 - s; - tmp1sq = tmp1 * tmp1; - w += 15.0 * tmp1sq * tmp1sq * tmp1; - } + } + if (s <= 1.0) { + tmp1 = 1.0 - s; + tmp1sq = tmp1 * tmp1; + w += 15.0 * tmp1sq * tmp1sq * tmp1; + } w *= pre_w; @@ -326,9 +326,9 @@ double ComputeRHEOKernel::calc_w_wendlandc4(int i, int j, double delx, double de double w, tmp6, s; s = r * cutinv; - if (s > 1.0) { - w = 0.0; - } else { + if (s > 1.0) { + w = 0.0; + } else { tmp6 = (1.0 - s) * (1.0 - s); tmp6 *= tmp6 * tmp6; w = tmp6 * (1.0 + 6.0 * s + 35.0 * THIRD * s * s); @@ -352,9 +352,9 @@ double ComputeRHEOKernel::calc_dw_wendlandc4(int i, int j, double delx, double d s = r * cutinv; - if (s > 1.0) { - wp = 0.0; - } else { + if (s > 1.0) { + wp = 0.0; + } else { tmp1 = 1.0 - s; tmp5 = tmp1 * tmp1; tmp5 = tmp5 * tmp5 * tmp1; From 1f021782634e3ce346bb54f37346cbcccf9daba6 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Wed, 3 Jul 2024 09:32:37 -0400 Subject: [PATCH 100/158] make exclusion more specific --- src/.gitignore | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/.gitignore b/src/.gitignore index 39c5de7555..5b13a7d55a 100644 --- a/src/.gitignore +++ b/src/.gitignore @@ -245,7 +245,8 @@ /pair_tdpd.cpp /pair_tdpd.h -/*rheo* +/*rheo*.cpp +/*rheo*.h /compute_grid.cpp /compute_grid.h From 33490fc402ee0c8637c9ccd9b1ba06226031e13f Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Wed, 3 Jul 2024 15:09:25 -0400 Subject: [PATCH 101/158] align with other similar tests in LAMMPS --- src/ELECTRODE/fix_electrode_conp.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/ELECTRODE/fix_electrode_conp.cpp b/src/ELECTRODE/fix_electrode_conp.cpp index aaa7f2fb99..6fa3722320 100644 --- a/src/ELECTRODE/fix_electrode_conp.cpp +++ b/src/ELECTRODE/fix_electrode_conp.cpp @@ -79,9 +79,9 @@ FixElectrodeConp::FixElectrodeConp(LAMMPS *lmp, int narg, char **arg) : potential_i(nullptr), potential_iele(nullptr) { if (lmp->citeme) lmp->citeme->add(cite_fix_electrode); - if (!atom->map_style) - error->all(FLERR, - "Atom style does not have an atom map. Use 'atom_modify map yes' to activate it."); + if (atom->map_style == Atom::MAP_NONE) + error->all(FLERR, "Fix {} requires an atom map, see atom_modify", style); + // fix.h output flags scalar_flag = 1; vector_flag = 1; From 01502f70a45ff903c3306df569df511e53fdf641 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Wed, 3 Jul 2024 15:16:08 -0400 Subject: [PATCH 102/158] print warnings only on MPI rank 0 --- src/ELECTRODE/fix_electrode_conp.cpp | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/src/ELECTRODE/fix_electrode_conp.cpp b/src/ELECTRODE/fix_electrode_conp.cpp index 6fa3722320..18e65b2baf 100644 --- a/src/ELECTRODE/fix_electrode_conp.cpp +++ b/src/ELECTRODE/fix_electrode_conp.cpp @@ -354,7 +354,7 @@ int FixElectrodeConp::modify_param(int narg, char **arg) MPI_Allreduce(MPI_IN_PLACE, &in_ele, 1, MPI_INT, MPI_SUM, world); if (in_ele == 0) error->all(FLERR, "No atoms of type in electrode"); MPI_Allreduce(MPI_IN_PLACE, ¬_in_ele, 1, MPI_INT, MPI_SUM, world); - if (not_in_ele) + if (not_in_ele && (comm->me == 0)) error->warning(FLERR, "Not all atoms of type in electrode; Thomas-Fermi parameters will be ignored " "for electrolyte"); @@ -485,7 +485,7 @@ void FixElectrodeConp::post_constructor() input->variable->set(fmt::format("{} equal f_{}[{}]", var_vtop, fixname, 1 + top_group)); input->variable->set(fmt::format("{} equal (v_{}-v_{})/lz", var_efield, var_vbot, var_vtop)); // check for other efields and warn if found - if (modify->get_fix_by_style("^efield").size() > 0 && comm->me == 0) + if ((modify->get_fix_by_style("^efield").size() > 0) && (comm->me == 0)) error->warning(FLERR, "Other efield fixes found -- please make sure this is intended!"); // call fix command: // fix [varstem]_efield all efield 0.0 0.0 [var_vdiff]/lz @@ -647,9 +647,8 @@ void FixElectrodeConp::setup_post_neighbor() void FixElectrodeConp::setup_pre_reverse(int eflag, int vflag) { - if (pair->did_tally_callback()) - error->warning(FLERR, - "Computation of Virials in fix electrode is incompatible with TALLY package"); + if (pair->did_tally_callback() && (comm->me == 0)) + error->warning(FLERR, "Computation of virials in fix {} is incompatible with TALLY package", style); // correct forces for initial timestep ev_init(eflag, vflag); gausscorr(eflag, vflag, true); @@ -683,7 +682,7 @@ void FixElectrodeConp::invert() void FixElectrodeConp::symmetrize() { // S matrix to enforce charge neutrality constraint - if (read_inv && comm->me == 0) + if (read_inv && (comm->me == 0)) error->warning(FLERR, "Symmetrizing matrix from file. Make sure the provided matrix has not been " "symmetrized yet."); @@ -764,11 +763,11 @@ void FixElectrodeConp::setup_pre_exchange() // create_taglist // if memory_usage > 0.5 GiB, warn with expected usage double mem_needed = memory_usage(); mem_needed /= (1024 * 1024 * 1024); // convert to GiB - if (mem_needed > 0.5 && comm->me == 0) + if ((mem_needed > 0.5) && (comm->me == 0)) error->warning(FLERR, - "Please ensure there is sufficient memory for fix electrode " + "Please ensure there is sufficient memory for fix {} " "(anticipated usage is at least {:.1f} GiB per proc)", - mem_needed); + style, mem_needed); } /* ---------------------------------------------------------------------- */ @@ -932,7 +931,7 @@ void FixElectrodeConp::update_charges() dot_old = dot_new; } recompute_potential(b, q_local); - if (delta > cg_threshold && comm->me == 0) error->warning(FLERR, "CG threshold not reached"); + if ((delta > cg_threshold) && (comm->me == 0)) error->warning(FLERR, "CG threshold not reached"); } else { error->all(FLERR, "This algorithm is not implemented, yet"); } From ece17cf56fc3e238d7d5944ce2b00abbea7f9a88 Mon Sep 17 00:00:00 2001 From: jtclemm Date: Wed, 3 Jul 2024 15:30:33 -0600 Subject: [PATCH 103/158] Adding rheo make support --- lib/rheo/Makefile.lammps | 7 +++ lib/rheo/README | 5 ++ src/Depend.sh | 4 ++ src/Makefile | 3 ++ src/RHEO/Install.sh | 103 +++++++++++++++++++++++++++++++++++++++ src/RHEO/README | 2 + 6 files changed, 124 insertions(+) create mode 100644 lib/rheo/Makefile.lammps create mode 100644 lib/rheo/README create mode 100644 src/RHEO/Install.sh diff --git a/lib/rheo/Makefile.lammps b/lib/rheo/Makefile.lammps new file mode 100644 index 0000000000..46f6dc7b96 --- /dev/null +++ b/lib/rheo/Makefile.lammps @@ -0,0 +1,7 @@ +# Settings that the LAMMPS build will import when this package is installed + +# change this to -I/path/to/your/lib/gsl/include/ +rheo_SYSINC = -I../../lib/rheo/gsl/include/ + +# change this to -L/path/to/your/lib/gsl/lib/ +rheo_SYSLIB = -L../../lib/rheo/gsl/lib/ -lgslcblas diff --git a/lib/rheo/README b/lib/rheo/README new file mode 100644 index 0000000000..8219d6e21a --- /dev/null +++ b/lib/rheo/README @@ -0,0 +1,5 @@ +This directory has a Makefile.lammps file with settings that allows +LAMMPS to dynamically link to the GSL library. This is +required to use the RHEO package in a LAMMPS input script. + +See the header of Makefile.lammps for more info. diff --git a/src/Depend.sh b/src/Depend.sh index e55b100975..fcd4a20d6f 100755 --- a/src/Depend.sh +++ b/src/Depend.sh @@ -56,6 +56,10 @@ if (test $1 = "ASPHERE") then depend INTEL fi +if (test $1 = "BPM") then + depend RHEO +fi + if (test $1 = "CLASS2") then depend GPU depend KOKKOS diff --git a/src/Makefile b/src/Makefile index 805b950112..4d8b02458a 100644 --- a/src/Makefile +++ b/src/Makefile @@ -124,6 +124,7 @@ PACKAGE = \ reaction \ reaxff \ replica \ + rheo \ rigid \ scafacos \ shock \ @@ -233,6 +234,7 @@ PACKLIB = \ plumed \ qmmm \ ml-quip \ + rheo \ scafacos \ machdyn \ vtk \ @@ -254,6 +256,7 @@ PACKEXT = \ netcdf \ plumed \ qmmm \ + rheo \ scafacos \ voronoi \ vtk \ diff --git a/src/RHEO/Install.sh b/src/RHEO/Install.sh new file mode 100644 index 0000000000..3e3ba75e32 --- /dev/null +++ b/src/RHEO/Install.sh @@ -0,0 +1,103 @@ +# Install/unInstall package files in LAMMPS +# mode = 0/1/2 for uninstall/install/update + +mode=$1 + +# enforce using portable C locale +LC_ALL=C +export LC_ALL + +# arg1 = file, arg2 = file it depends on + +action () { + if (test $mode = 0) then + rm -f ../$1 + elif (! cmp -s $1 ../$1) then + if (test -z "$2" || test -e ../$2) then + cp $1 .. + if (test $mode = 2) then + echo " updating src/$1" + fi + fi + elif (test -n "$2") then + if (test ! -e ../$2) then + rm -f ../$1 + fi + fi +} + +# package files without dependencies +action atom_vec_rheo_thermal.h +action atom_vec_rheo_thermal.cpp +action atom_vec_rheo.h +action atom_vec_rheo.cpp +action compute_rheo_grad.h +action compute_rheo_grad.cpp +action compute_rheo_interface.h +action compute_rheo_interface.cpp +action compute_rheo_kernel.h +action compute_rheo_kernel.cpp +action compute_rheo_rho_sum.h +action compute_rheo_rho_sum.cpp +action compute_rheo_surface.h +action compute_rheo_surface.cpp +action compute_rheo_vshift.h +action compute_rheo_vshift.cpp +action fix_rheo_oxidation.h +action fix_rheo_oxidation.cpp +action fix_rheo_pressure.h +action fix_rheo_pressure.cpp +action fix_rheo_viscosity.h +action fix_rheo_viscosity.cpp +action fix_rheo.h +action fix_rheo.cpp +action pair_rheo.h +action pair_rheo.cpp +action pair_rheo_solid.h +action pair_rheo_solid.cpp + +# package files with dependencies +action bond_rheo_shell.h bond_bpm.h +action bond_rheo_shell.cpp bond_bpm.h +action compute_rheo_property_atom.h fix_update_special_bonds.h +action compute_rheo_property_atom.cpp fix_update_special_bonds.h +action fix_rheo_thermal.h fix_update_special_bonds.h +action fix_rheo_thermal.cpp fix_update_special_bonds.h + +# Warn that some styles in RHEO have base classes in BPM + +if (test $1 = 1) then + if (test ! -e ../bond_bpm.cpp) then + echo "Must install BPM package to use all features of RHEO package" + fi +fi + +# edit 2 Makefile.package files to include/exclude package info + +if (test $1 = 1) then + + if (test -e ../Makefile.package) then + sed -i -e 's/[^ \t]*rheo[^ \t]* //' ../Makefile.package + sed -i -e 's|^PKG_SYSINC =[ \t]*|&$(rheo_SYSINC) |' ../Makefile.package + sed -i -e 's|^PKG_SYSLIB =[ \t]*|&$(rheo_SYSLIB) |' ../Makefile.package + fi + + if (test -e ../Makefile.package.settings) then + sed -i -e '/^[ \t]*include.*rheo.*$/d' ../Makefile.package.settings + # multiline form needed for BSD sed on Macs + sed -i -e '4 i \ +include ..\/..\/lib\/rheo\/Makefile.lammps +' ../Makefile.package.settings + fi + +elif (test $1 = 0) then + + if (test -e ../Makefile.package) then + sed -i -e 's/[^ \t]*rheo[^ \t]* //' ../Makefile.package + fi + + if (test -e ../Makefile.package.settings) then + sed -i -e '/^[ \t]*include.*rheo.*$/d' ../Makefile.package.settings + fi + +fi diff --git a/src/RHEO/README b/src/RHEO/README index 7090fc828c..6e8dcfb856 100644 --- a/src/RHEO/README +++ b/src/RHEO/README @@ -2,6 +2,8 @@ RHEO or Reproducing Hydrodynamics and Elastic Objects is a package to model mult systems. The authors include Joel Clemmer (Sandia), Thomas O'Connor (Carnegie Mellon), and Eric Palermo (Carnegie Mellon). +Bond style rheo/shell, compute style rheo/property/atom, and fix style rheo/temperature all depend on the BPM package. + This package requires the GNU scientific library (GSL). We recommend version 2.7 or later. To build this package, one must first separately install GSL in a location that can be found by your environment. From 9b52888e531c09c4e8deef707d06039ec31d554b Mon Sep 17 00:00:00 2001 From: jtclemm Date: Wed, 3 Jul 2024 15:53:38 -0600 Subject: [PATCH 104/158] Adding RHEO dependency to cmake --- cmake/CMakeLists.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/cmake/CMakeLists.txt b/cmake/CMakeLists.txt index e66b6b17a7..77f1610064 100644 --- a/cmake/CMakeLists.txt +++ b/cmake/CMakeLists.txt @@ -411,6 +411,7 @@ pkg_depends(CG-DNA ASPHERE) pkg_depends(ELECTRODE KSPACE) pkg_depends(EXTRA-MOLECULE MOLECULE) pkg_depends(MESONT MOLECULE) +pkg_depends(RHEO BPM) # detect if we may enable OpenMP support by default set(BUILD_OMP_DEFAULT OFF) From e1232af8677e78b116506e26b23093d2ac1f4640 Mon Sep 17 00:00:00 2001 From: jtclemm Date: Wed, 3 Jul 2024 16:12:17 -0600 Subject: [PATCH 105/158] Missing flag and changing dependencies --- lib/rheo/Makefile.lammps | 2 +- src/RHEO/Install.sh | 47 ++++++---------------------------------- 2 files changed, 8 insertions(+), 41 deletions(-) diff --git a/lib/rheo/Makefile.lammps b/lib/rheo/Makefile.lammps index 46f6dc7b96..3372e9463c 100644 --- a/lib/rheo/Makefile.lammps +++ b/lib/rheo/Makefile.lammps @@ -4,4 +4,4 @@ rheo_SYSINC = -I../../lib/rheo/gsl/include/ # change this to -L/path/to/your/lib/gsl/lib/ -rheo_SYSLIB = -L../../lib/rheo/gsl/lib/ -lgslcblas +rheo_SYSLIB = -L../../lib/rheo/gsl/lib/ -lgsl -lgslcblas diff --git a/src/RHEO/Install.sh b/src/RHEO/Install.sh index 3e3ba75e32..e34ca3a555 100644 --- a/src/RHEO/Install.sh +++ b/src/RHEO/Install.sh @@ -26,52 +26,19 @@ action () { fi } -# package files without dependencies -action atom_vec_rheo_thermal.h -action atom_vec_rheo_thermal.cpp -action atom_vec_rheo.h -action atom_vec_rheo.cpp -action compute_rheo_grad.h -action compute_rheo_grad.cpp -action compute_rheo_interface.h -action compute_rheo_interface.cpp -action compute_rheo_kernel.h -action compute_rheo_kernel.cpp -action compute_rheo_rho_sum.h -action compute_rheo_rho_sum.cpp -action compute_rheo_surface.h -action compute_rheo_surface.cpp -action compute_rheo_vshift.h -action compute_rheo_vshift.cpp -action fix_rheo_oxidation.h -action fix_rheo_oxidation.cpp -action fix_rheo_pressure.h -action fix_rheo_pressure.cpp -action fix_rheo_viscosity.h -action fix_rheo_viscosity.cpp -action fix_rheo.h -action fix_rheo.cpp -action pair_rheo.h -action pair_rheo.cpp -action pair_rheo_solid.h -action pair_rheo_solid.cpp - -# package files with dependencies -action bond_rheo_shell.h bond_bpm.h -action bond_rheo_shell.cpp bond_bpm.h -action compute_rheo_property_atom.h fix_update_special_bonds.h -action compute_rheo_property_atom.cpp fix_update_special_bonds.h -action fix_rheo_thermal.h fix_update_special_bonds.h -action fix_rheo_thermal.cpp fix_update_special_bonds.h - -# Warn that some styles in RHEO have base classes in BPM +# some styles in RHEO have base classes in BPM if (test $1 = 1) then if (test ! -e ../bond_bpm.cpp) then - echo "Must install BPM package to use all features of RHEO package" + echo "Must install BPM package with RHEO" + exit 1 fi fi +for file in *.cpp *.h; do + action ${file} +done + # edit 2 Makefile.package files to include/exclude package info if (test $1 = 1) then From feba9640afc74b2a95b2d9e3c9bbe470d013f707 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Wed, 3 Jul 2024 18:22:27 -0400 Subject: [PATCH 106/158] not needed anymore --- src/Depend.sh | 4 ---- 1 file changed, 4 deletions(-) diff --git a/src/Depend.sh b/src/Depend.sh index fcd4a20d6f..e55b100975 100755 --- a/src/Depend.sh +++ b/src/Depend.sh @@ -56,10 +56,6 @@ if (test $1 = "ASPHERE") then depend INTEL fi -if (test $1 = "BPM") then - depend RHEO -fi - if (test $1 = "CLASS2") then depend GPU depend KOKKOS From 96d58bb03e0fc87d0ca6c4b299347143c5f7f3a8 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Wed, 3 Jul 2024 18:32:42 -0400 Subject: [PATCH 107/158] automatically set include/libs flags for GSL, if pkg-config is available --- lib/rheo/Makefile.lammps | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/lib/rheo/Makefile.lammps b/lib/rheo/Makefile.lammps index 3372e9463c..ec58740370 100644 --- a/lib/rheo/Makefile.lammps +++ b/lib/rheo/Makefile.lammps @@ -1,7 +1,14 @@ # Settings that the LAMMPS build will import when this package is installed -# change this to -I/path/to/your/lib/gsl/include/ -rheo_SYSINC = -I../../lib/rheo/gsl/include/ +ifeq ($(strip $(shell pkg-config --version)),) + # manual configuration w/o pkg-config/pkgconf + # change this to -I/path/to/your/lib/gsl/include/ + rheo_SYSINC = -I../../lib/rheo/gsl/include/ -# change this to -L/path/to/your/lib/gsl/lib/ -rheo_SYSLIB = -L../../lib/rheo/gsl/lib/ -lgsl -lgslcblas + # change this to -L/path/to/your/lib/gsl/lib/ + rheo_SYSLIB = -L../../lib/rheo/gsl/lib/ -lgsl -lgslcblas +else + # autodetect GSL settings from pkg-config/pkgconf + rheo_SYSINC = $(shell pkg-config --cflags gsl) + rheo_SYSLIB = $(shell pkg-config --libs gsl) +endif From b6d11b5902e3d4357d52aa2c8358ce4086551027 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Wed, 3 Jul 2024 19:07:19 -0400 Subject: [PATCH 108/158] document GSL dependency and provide build instructions for RHEO package --- cmake/Modules/Packages/RHEO.cmake | 2 +- doc/src/Build_extras.rst | 40 +++++++++++++++++++++++++++---- doc/src/Packages_details.rst | 20 +++++++++------- lib/rheo/README | 8 ++++--- src/RHEO/README | 15 ++++++------ 5 files changed, 62 insertions(+), 23 deletions(-) diff --git a/cmake/Modules/Packages/RHEO.cmake b/cmake/Modules/Packages/RHEO.cmake index 970a141bbd..be8c22877b 100644 --- a/cmake/Modules/Packages/RHEO.cmake +++ b/cmake/Modules/Packages/RHEO.cmake @@ -1,2 +1,2 @@ -find_package(GSL REQUIRED) +find_package(GSL 2.7 REQUIRED) target_link_libraries(lammps PRIVATE GSL::gsl) diff --git a/doc/src/Build_extras.rst b/doc/src/Build_extras.rst index f66238c3c9..4802c67420 100644 --- a/doc/src/Build_extras.rst +++ b/doc/src/Build_extras.rst @@ -59,6 +59,7 @@ This is the list of packages that may require additional steps. * :ref:`POEMS ` * :ref:`PYTHON ` * :ref:`QMMM ` + * :ref:`RHEO ` * :ref:`SCAFACOS ` * :ref:`VORONOI ` * :ref:`VTK ` @@ -1566,10 +1567,11 @@ LAMMPS build. .. tab:: CMake build When the ``-D PKG_PLUMED=yes`` flag is included in the cmake - command you must ensure that GSL is installed in locations that - are specified in your environment. There are then two additional - variables that control the manner in which PLUMED is obtained and - linked into LAMMPS. + command you must ensure that `the GNU Scientific Library (GSL) + ` is installed in locations + that are accessible in your environment. There are then two + additional variables that control the manner in which PLUMED is + obtained and linked into LAMMPS. .. code-block:: bash @@ -2040,6 +2042,36 @@ verified to work in February 2020 with Quantum Espresso versions 6.3 to ---------- +.. _rheo: + +RHEO package +------------ + +To build with this package you must have the `GNU Scientific Library +(GSL) ` installed in locations that +are accessible in your environment. The GSL library should be at least +version 2.7. + +.. tabs:: + + .. tab:: CMake build + + If CMake cannot find the GSL library or include files, you can set: + + .. code-block:: bash + + -D GSL_ROOT_DIR=path # path to root of GSL installation + + .. tab:: Traditional make + + LAMMPS will try to auto-detect the GSL compiler and linker flags + from the corresponding ``pkg-config`` file (``gsl.pc``), otherwise + you can edit the file ``lib/rheo/Makefile.lammps`` + to specify the paths and library names where indicated by comments. + This must be done **before** the package is installed. + +---------- + .. _scafacos: SCAFACOS package diff --git a/doc/src/Packages_details.rst b/doc/src/Packages_details.rst index 860ae24489..f3cf086d88 100644 --- a/doc/src/Packages_details.rst +++ b/doc/src/Packages_details.rst @@ -8,12 +8,12 @@ info on how to download or build any extra library it requires. It also gives links to documentation, example scripts, and pictures/movies (if available) that illustrate use of the package. -The majority of packages can be included in a LAMMPS build with a -single setting (``-D PKG_=on`` for CMake) or command -(``make yes-`` for make). See the :doc:`Build package ` -page for more info. A few packages may require additional steps; -this is indicated in the descriptions below. The :doc:`Build extras ` -page gives those details. +The majority of packages can be included in a LAMMPS build with a single +setting (``-D PKG_=on`` for CMake) or command (``make yes-`` +for make). See the :doc:`Build package ` page for more +info. A few packages may require additional steps; this is indicated in +the descriptions below. The :doc:`Build extras ` page +gives those details. .. note:: @@ -2630,8 +2630,12 @@ RHEO package **Contents:** Pair styles, bond styles, fixes, and computes for reproducing -hydrodynamics and elastic objects. See the -:doc:`Howto rheo ` page for an overview. +hydrodynamics and elastic objects. See the :doc:`Howto rheo +` page for an overview. + +**Install:** + +This package has :ref:`specific installation instructions ` on the :doc:`Build extras ` page. **Authors:** Joel T. Clemmer (Sandia National Labs), Thomas C. O'Connor (Carnegie Mellon University) diff --git a/lib/rheo/README b/lib/rheo/README index 8219d6e21a..ae421b6e80 100644 --- a/lib/rheo/README +++ b/lib/rheo/README @@ -1,5 +1,7 @@ -This directory has a Makefile.lammps file with settings that allows -LAMMPS to dynamically link to the GSL library. This is -required to use the RHEO package in a LAMMPS input script. +This directory has a Makefile.lammps file with settings that allows LAMMPS to +dynamically link to the GSL library. This is required to use the RHEO package +in a LAMMPS input script. If you have the pkg-config command available, it +will automatically import the GSL settings. Otherwise they will have to be +added manually. See the header of Makefile.lammps for more info. diff --git a/src/RHEO/README b/src/RHEO/README index 6e8dcfb856..4b6f2a162a 100644 --- a/src/RHEO/README +++ b/src/RHEO/README @@ -1,9 +1,10 @@ -RHEO or Reproducing Hydrodynamics and Elastic Objects is a package to model multiphase fluid -systems. The authors include Joel Clemmer (Sandia), Thomas O'Connor (Carnegie Mellon), and -Eric Palermo (Carnegie Mellon). +RHEO or Reproducing Hydrodynamics and Elastic Objects is a package to model +multiphase fluid systems. The authors include Joel Clemmer (Sandia), Thomas +O'Connor (Carnegie Mellon), and Eric Palermo (Carnegie Mellon). -Bond style rheo/shell, compute style rheo/property/atom, and fix style rheo/temperature all depend on the BPM package. +Bond style rheo/shell, compute style rheo/property/atom, and fix style +rheo/temperature all depend on the BPM package. -This package requires the GNU scientific library (GSL). We recommend version 2.7 or later. To -build this package, one must first separately install GSL in a location that can be found by -your environment. +This package requires the GNU scientific library (GSL). We recommend version +2.7 or later. To build this package, one must first separately install GSL in +a location that can be found by your environment. From 0fb74936582fe6ac14e417d50f106d0ba351e3e7 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Wed, 3 Jul 2024 19:10:37 -0400 Subject: [PATCH 109/158] spelling fixes --- doc/src/Howto_rheo.rst | 10 +++++----- doc/src/atom_modify.rst | 2 +- doc/src/fix_rheo.rst | 4 ++-- doc/src/fix_rheo_pressure.rst | 2 +- doc/src/fix_rheo_thermal.rst | 4 ++-- doc/src/fix_rheo_viscosity.rst | 2 +- doc/utils/sphinx-config/false_positives.txt | 12 ++++++++++++ 7 files changed, 24 insertions(+), 12 deletions(-) diff --git a/doc/src/Howto_rheo.rst b/doc/src/Howto_rheo.rst index 4c0f069d92..7c62d09ab1 100644 --- a/doc/src/Howto_rheo.rst +++ b/doc/src/Howto_rheo.rst @@ -4,7 +4,7 @@ Reproducing hydrodynamics and elastic objects (RHEO) The RHEO package is a hybrid implementation of smoothed particle hydrodynamics (SPH) for fluid flow, coupled to the :doc:`BPM package ` to model solid elements. RHEO combines these methods to enable mesh-free modeling -of multiphase material systems. The SPH solver supports many advanced options +of multi-phase material systems. The SPH solver supports many advanced options including reproducing kernels, particle shifting, free surface identification, and solid surface reconstruction. To model fluid-solid systems, the status of particles can dynamically change between a fluid and solid state, e.g. during @@ -30,7 +30,7 @@ of reproducing kernels). In conjunction to fix rheo, one must specify an instance of :doc:`fix rheo/pressure ` and :doc:`fix rheo/viscosity ` to define a pressure equation of state and viscosity model, respectively. Optionally, one can model -a heat equation with :doc:`fix rheo/thermal `, which also +a heat equation with :doc:`fix rheo/thermal `, which also allows the user to specify equations for a particle's thermal conductivity, specific heat, latent heat, and melting temperature. The ordering of these fixes in an an input script matters. Fix rheo must be defined prior to all @@ -44,7 +44,7 @@ conductivity. Note that the temperature is always derived from the energy. This implies the *temperature* attribute of :doc:`the set command ` does not affect particles. Instead, one should use the *sph/e* attribute. -The status variable uses bitmasking to track various properties of a particle +The status variable uses bit-masking to track various properties of a particle such as its current state of matter (fluid or solid) and its location relative to a surface. Some of these properties (and others) can be accessed using :doc:`compute rheo/property/atom `. The *status* @@ -88,8 +88,8 @@ as bonds are created/broken. The other option for elastic objects is an elastic shell that is nominally much thinner than a particle diameter, e.g. a oxide skin which gradually forms over time on the surface of a fluid. Currently, this is implemented using -:doc:`fix rheo/oxidaton ` and bond style -:doc:`rheo/shell `. Essentially, fix rheo/oxidaton creates candidate +:doc:`fix rheo/oxidation ` and bond style +:doc:`rheo/shell `. Essentially, fix rheo/oxidation creates candidate bonds of a specified type between surface fluid particles within a specified distance. a newly created rheo/shell bond will then start a timer. While the timer is counting down, the bond will delete itself if particles move too far apart or move away from the diff --git a/doc/src/atom_modify.rst b/doc/src/atom_modify.rst index 0d750f1755..9091626feb 100644 --- a/doc/src/atom_modify.rst +++ b/doc/src/atom_modify.rst @@ -190,7 +190,7 @@ Default By default, *id* is yes. By default, atomic systems (no bond topology info) do not use a map. For molecular systems (with bond topology info), the default is to use a map of either *array* or *hash* style -depending on the size of the sustem, as explained above for the *map +depending on the size of the system, as explained above for the *map yes* keyword/value option. By default, a *first* group is not defined. By default, sorting is enabled with a frequency of 1000 and a binsize of 0.0, which means the neighbor cutoff will be used to set diff --git a/doc/src/fix_rheo.rst b/doc/src/fix_rheo.rst index d69b52d751..c9bf0a7aa0 100644 --- a/doc/src/fix_rheo.rst +++ b/doc/src/fix_rheo.rst @@ -90,7 +90,7 @@ In systems with free surfaces, the *surface/detection* keyword can be used to classify the location of particles as being within the bulk fluid, on a free surface, or isolated from other particles in a splash or droplet. Shifting is then disabled in the normal direction away from the free surface -to prevent particles from difusing away. Surface detection can also be used +to prevent particles from diffusing away. Surface detection can also be used to control surface-nucleated effects like oxidation when used in combination with :doc:`fix rheo/oxidation `. Surface detection is not performed on solid bodies. @@ -145,7 +145,7 @@ Restrictions """""""""""" This fix must be used with atom style rheo or rheo/thermal. This fix must -be used in conjuction with :doc:`fix rheo/pressure `. +be used in conjunction with :doc:`fix rheo/pressure `. and :doc:`fix rheo/viscosity `. If the *thermal* setting is used, there must also be an instance of :doc:`fix rheo/thermal `. The fix group must be set to all. diff --git a/doc/src/fix_rheo_pressure.rst b/doc/src/fix_rheo_pressure.rst index e01aebf90f..40d623ae07 100644 --- a/doc/src/fix_rheo_pressure.rst +++ b/doc/src/fix_rheo_pressure.rst @@ -86,7 +86,7 @@ Restrictions This fix must be used with an atom style that includes density such as atom_style rheo or rheo/thermal. This fix must be used in -conjuction with :doc:`fix rheo `. The fix group must be +conjunction with :doc:`fix rheo `. The fix group must be set to all. Only one instance of fix rheo/pressure can be defined. This fix is part of the RHEO package. It is only enabled if diff --git a/doc/src/fix_rheo_thermal.rst b/doc/src/fix_rheo_thermal.rst index e116325091..cf245cbdca 100644 --- a/doc/src/fix_rheo_thermal.rst +++ b/doc/src/fix_rheo_thermal.rst @@ -105,8 +105,8 @@ Restrictions """""""""""" This fix must be used with an atom style that includes temperature, -heatflow, and conductivity such as atom_tyle rheo/thermal This fix -must be used in conjuction with :doc:`fix rheo ` with the +heatflow, and conductivity such as atom_style rheo/thermal This fix +must be used in conjunction with :doc:`fix rheo ` with the *thermal* setting. The fix group must be set to all. Only one instance of fix rheo/pressure can be defined. diff --git a/doc/src/fix_rheo_viscosity.rst b/doc/src/fix_rheo_viscosity.rst index 912de584c2..5eca39dcdd 100644 --- a/doc/src/fix_rheo_viscosity.rst +++ b/doc/src/fix_rheo_viscosity.rst @@ -91,7 +91,7 @@ Restrictions This fix must be used with an atom style that includes viscosity such as atom_style rheo or rheo/thermal. This fix must be used in -conjuction with :doc:`fix rheo `. The fix group must be +conjunction with :doc:`fix rheo `. The fix group must be set to all. Only one instance of fix rheo/viscosity can be defined. This fix is part of the RHEO package. It is only enabled if diff --git a/doc/utils/sphinx-config/false_positives.txt b/doc/utils/sphinx-config/false_positives.txt index c300cf608d..babe66d27d 100644 --- a/doc/utils/sphinx-config/false_positives.txt +++ b/doc/utils/sphinx-config/false_positives.txt @@ -393,6 +393,7 @@ buf builtin Bulacu Bulatov +Bulkley Bureekaew burlywood Bussi @@ -564,6 +565,7 @@ cond conda Conda Condens +conductivities conf config configfile @@ -1440,6 +1442,7 @@ henrich Henrich Hermitian Herrmann +Hershchel Hertizian hertzian Hertzsch @@ -1831,6 +1834,7 @@ Kspace KSpace KSpaceStyle Kspring +kstyle kT kTequil kth @@ -2271,6 +2275,7 @@ modelled modelling Modelling Modine +modularity moduli mofff MOFFF @@ -2488,6 +2493,7 @@ Neumann Nevent nevery Nevery +Nevins newfile Newns newtype @@ -3067,6 +3073,7 @@ quatw queryargs Queteschiner quickmin +quintic qw qx qy @@ -3078,6 +3085,7 @@ radialscreenedspin radialspin radian radians +radiative radj Rafferty rahman @@ -3181,6 +3189,7 @@ rg Rg Rhaphson Rhe +rheo rheological rheology rhodo @@ -3268,6 +3277,7 @@ rsort rsq rst rstyle +rsurf Rubensson Rubia Rud @@ -3651,6 +3661,7 @@ Telsa tempCorrCoeff templated Templeton +Tencer Tequil ters tersoff @@ -3997,6 +4008,7 @@ Vries Vsevolod Vsmall Vstream +vstyle vtarget vtk VTK From f94b0789364daf9e7fd5bebf39a436ad642fba19 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Wed, 3 Jul 2024 21:21:35 -0400 Subject: [PATCH 110/158] use pkg-config instead of pkgconf consistently, since the latter comes with compatibility to the former --- doc/src/Build_link.rst | 8 ++++---- doc/src/Tools.rst | 6 +++--- lib/qmmm/Makefile.gfortran-cmake | 4 ++-- lib/qmmm/README | 2 +- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/doc/src/Build_link.rst b/doc/src/Build_link.rst index 3800e41e21..efd6691d30 100644 --- a/doc/src/Build_link.rst +++ b/doc/src/Build_link.rst @@ -45,8 +45,8 @@ executable code from the library is copied into the calling executable. .. code-block:: bash - mpicc -c -O $(pkgconf liblammps --cflags) caller.c - mpicxx -o caller caller.o -$(pkgconf liblammps --libs) + mpicc -c -O $(pkg-config --cflags liblammps) caller.c + mpicxx -o caller caller.o -$(pkg-config --libs liblammps) .. tab:: Traditional make @@ -155,8 +155,8 @@ POEMS package installed becomes: .. code-block:: bash - mpicc -c -O $(pkgconf liblammps --cflags) caller.c - mpicxx -o caller caller.o -$(pkgconf --libs) + mpicc -c -O $(pkg-config --cflags liblammps) caller.c + mpicxx -o caller caller.o -$(pkg-config --libs liblammps) .. tab:: Traditional make diff --git a/doc/src/Tools.rst b/doc/src/Tools.rst index 0732398e53..9bc9c935a7 100644 --- a/doc/src/Tools.rst +++ b/doc/src/Tools.rst @@ -1329,7 +1329,7 @@ for Tcl with: .. code-block:: bash swig -tcl -module tcllammps lammps.i - gcc -fPIC -shared $(pkgconf --cflags tcl) -o tcllammps.so \ + gcc -fPIC -shared $(pkg-config tcl --cflags) -o tcllammps.so \ lammps_wrap.c -L ../src/ -llammps tclsh @@ -1340,8 +1340,8 @@ functions included with: swig -tcl -module tcllmps lammps_shell.i gcc -o tcllmpsh lammps_wrap.c -Xlinker -export-dynamic \ - -DHAVE_CONFIG_H $(pkgconf --cflags tcl) \ - $(pkgconf --libs tcl) -L ../src -llammps + -DHAVE_CONFIG_H $(pkg-config tcl --cflags) \ + $(pkg-config tcl --libs) -L ../src -llammps In both cases it is assumed that the LAMMPS library was compiled as a shared library in the ``src`` folder. Otherwise the last diff --git a/lib/qmmm/Makefile.gfortran-cmake b/lib/qmmm/Makefile.gfortran-cmake index 7a467a5e1c..36cb04617b 100644 --- a/lib/qmmm/Makefile.gfortran-cmake +++ b/lib/qmmm/Makefile.gfortran-cmake @@ -46,8 +46,8 @@ QELIBS += -lgfortran -lmpi_mpifh # part 3: add-on libraries and main library for LAMMPS sinclude ../../src/Makefile.package -LAMMPSFLAGS = $(shell pkgconf liblammps --cflags) -LAMMPSLIB = $(shell pkgconf liblammps --libs) +LAMMPSFLAGS = $(shell pkg-config --cflags liblammps) +LAMMPSLIB = $(shell pkg-config --libs liblammps) # part 4: local QM/MM library and progams SRC=pwqmmm.c libqmmm.c diff --git a/lib/qmmm/README b/lib/qmmm/README index 02401e3293..9e2b7e72f5 100644 --- a/lib/qmmm/README +++ b/lib/qmmm/README @@ -101,7 +101,7 @@ Makefile.gfortran-cmake and make adjustments to the makefile variables according to the comments in the file. You probably need to adjust the QETOPDIR variable to point to the location of your QE compilation/installation. -Please also check that the command "pkgconf liblammps --libs" works. +Please also check that the command "pkg-config --libs liblammps" works. Then you should be able to compile the QM/MM executable with: make -f Makefile.gfortran-cmake pwqmmm.x From a4d69878fa58ba59a1bc913bfaf37bf5c9f47524 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Wed, 3 Jul 2024 22:00:26 -0400 Subject: [PATCH 111/158] update list of available sanitizers for Fedora 40 and GCC 14 --- cmake/Modules/Testing.cmake | 4 ++-- doc/src/Build_development.rst | 5 +++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/cmake/Modules/Testing.cmake b/cmake/Modules/Testing.cmake index ff595d3c8f..a72ce17e1b 100644 --- a/cmake/Modules/Testing.cmake +++ b/cmake/Modules/Testing.cmake @@ -102,9 +102,9 @@ endif() ####################################### # select code sanitizer options ####################################### -set(ENABLE_SANITIZER "none" CACHE STRING "Select a code sanitizer option (none (default), address, leak, thread, undefined)") +set(ENABLE_SANITIZER "none" CACHE STRING "Select a code sanitizer option (none (default), address, hwaddress, leak, thread, undefined)") mark_as_advanced(ENABLE_SANITIZER) -set(ENABLE_SANITIZER_VALUES none address leak thread undefined) +set(ENABLE_SANITIZER_VALUES none address hwaddress leak thread undefined) set_property(CACHE ENABLE_SANITIZER PROPERTY STRINGS ${ENABLE_SANITIZER_VALUES}) validate_option(ENABLE_SANITIZER ENABLE_SANITIZER_VALUES) string(TOLOWER ${ENABLE_SANITIZER} ENABLE_SANITIZER) diff --git a/doc/src/Build_development.rst b/doc/src/Build_development.rst index 4d8bf0d07f..8e103b089a 100644 --- a/doc/src/Build_development.rst +++ b/doc/src/Build_development.rst @@ -88,8 +88,8 @@ on recording all commands required to do the compilation. .. _sanitizer: -Address, Undefined Behavior, and Thread Sanitizer Support (CMake only) ----------------------------------------------------------------------- +Address, Leak, Undefined Behavior, and Thread Sanitizer Support (CMake only) +---------------------------------------------------------------------------- Compilers such as GCC and Clang support generating instrumented binaries which use different sanitizer libraries to detect problems in the code @@ -110,6 +110,7 @@ compilation and linking stages. This is done through setting the -D ENABLE_SANITIZER=none # no sanitizer active (default) -D ENABLE_SANITIZER=address # enable address sanitizer / memory leak checker + -D ENABLE_SANITIZER=hwaddress # enable hardware assisted address sanitizer / memory leak checker -D ENABLE_SANITIZER=leak # enable memory leak checker (only) -D ENABLE_SANITIZER=undefined # enable undefined behavior sanitizer -D ENABLE_SANITIZER=thread # enable thread sanitizer From 10e3595b5798e42bcace44a7d6197410bbbde4fe Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Wed, 3 Jul 2024 22:20:06 -0400 Subject: [PATCH 112/158] separately catch exceptions thrown by new --- src/main.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/main.cpp b/src/main.cpp index caf1d4d53c..da80d66b52 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -19,6 +19,7 @@ #include #include +#include #if defined(LAMMPS_TRAP_FPE) && defined(_GNU_SOURCE) #include @@ -89,6 +90,11 @@ int main(int argc, char **argv) finalize(); MPI_Abort(MPI_COMM_WORLD, 1); exit(1); + } catch (std::bad_alloc &ae) { + fprintf(stderr, "C++ memory allocation failed: %s\n", ae.what()); + finalize(); + MPI_Abort(MPI_COMM_WORLD, 1); + exit(1); } catch (std::exception &e) { fprintf(stderr, "Exception: %s\n", e.what()); finalize(); From cefe76919c76bff3d6a52786fd6a12297e5bb8cf Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Thu, 4 Jul 2024 11:12:40 -0400 Subject: [PATCH 113/158] make more use of auto and thus avoid having to specify the same type twice --- tools/lammps-gui/chartviewer.cpp | 2 +- tools/lammps-gui/codeeditor.cpp | 20 ++++++++++---------- tools/lammps-gui/helpers.cpp | 2 +- tools/lammps-gui/imageviewer.cpp | 22 +++++++++++----------- tools/lammps-gui/lammpsgui.cpp | 12 ++++++------ tools/lammps-gui/logwindow.cpp | 6 +++--- tools/lammps-gui/preferences.cpp | 26 +++++++++++++------------- tools/lammps-gui/slideshow.cpp | 4 ++-- 8 files changed, 47 insertions(+), 47 deletions(-) diff --git a/tools/lammps-gui/chartviewer.cpp b/tools/lammps-gui/chartviewer.cpp index 0150133954..919a3bf5fe 100644 --- a/tools/lammps-gui/chartviewer.cpp +++ b/tools/lammps-gui/chartviewer.cpp @@ -253,7 +253,7 @@ void ChartWindow::closeEvent(QCloseEvent *event) bool ChartWindow::eventFilter(QObject *watched, QEvent *event) { if (event->type() == QEvent::ShortcutOverride) { - QKeyEvent *keyEvent = dynamic_cast(event); + auto *keyEvent = dynamic_cast(event); if (!keyEvent) return QWidget::eventFilter(watched, event); if (keyEvent->modifiers().testFlag(Qt::ControlModifier) && keyEvent->key() == '/') { stop_run(); diff --git a/tools/lammps-gui/codeeditor.cpp b/tools/lammps-gui/codeeditor.cpp index ab8007805a..1762b0e496 100644 --- a/tools/lammps-gui/codeeditor.cpp +++ b/tools/lammps-gui/codeeditor.cpp @@ -620,7 +620,7 @@ void CodeEditor::dropEvent(QDropEvent *event) if (event->mimeData()->hasUrls()) { event->accept(); auto file = event->mimeData()->urls()[0].toLocalFile(); - auto gui = dynamic_cast(parent()); + auto *gui = dynamic_cast(parent()); if (gui) { moveCursor(QTextCursor::Start, QTextCursor::MoveAnchor); gui->open_file(file); @@ -687,17 +687,17 @@ void CodeEditor::contextMenuEvent(QContextMenuEvent *event) auto *menu = createStandardContextMenu(); menu->addSeparator(); if (textCursor().hasSelection()) { - auto action1 = menu->addAction("Comment out selection"); + auto *action1 = menu->addAction("Comment out selection"); action1->setIcon(QIcon(":/icons/expand-text.png")); connect(action1, &QAction::triggered, this, &CodeEditor::comment_selection); - auto action2 = menu->addAction("Uncomment selection"); + auto *action2 = menu->addAction("Uncomment selection"); action2->setIcon(QIcon(":/icons/expand-text.png")); connect(action2, &QAction::triggered, this, &CodeEditor::uncomment_selection); } else { - auto action1 = menu->addAction("Comment out line"); + auto *action1 = menu->addAction("Comment out line"); action1->setIcon(QIcon(":/icons/expand-text.png")); connect(action1, &QAction::triggered, this, &CodeEditor::comment_line); - auto action2 = menu->addAction("Uncomment line"); + auto *action2 = menu->addAction("Uncomment line"); action2->setIcon(QIcon(":/icons/expand-text.png")); connect(action2, &QAction::triggered, this, &CodeEditor::uncomment_line); } @@ -705,14 +705,14 @@ void CodeEditor::contextMenuEvent(QContextMenuEvent *event) // print augmented context menu if an entry was found if (!help.isEmpty()) { - auto action = menu->addAction(QString("Display available completions for '%1'").arg(help)); + auto *action = menu->addAction(QString("Display available completions for '%1'").arg(help)); action->setIcon(QIcon(":/icons/expand-text.png")); connect(action, &QAction::triggered, this, &CodeEditor::runCompletion); menu->addSeparator(); } if (!page.isEmpty()) { - auto action = menu->addAction(QString("Reformat '%1' command").arg(help)); + auto *action = menu->addAction(QString("Reformat '%1' command").arg(help)); action->setIcon(QIcon(":/icons/format-indent-less-3.png")); connect(action, &QAction::triggered, this, &CodeEditor::reformatCurrentLine); @@ -728,13 +728,13 @@ void CodeEditor::contextMenuEvent(QContextMenuEvent *event) help = words.at(0); page = words.at(0); page += ".html"; - auto action2 = menu->addAction(QString("View Documentation for '%1'").arg(help)); + auto *action2 = menu->addAction(QString("View Documentation for '%1'").arg(help)); action2->setIcon(QIcon(":/icons/system-help.png")); action2->setData(page); connect(action2, &QAction::triggered, this, &CodeEditor::open_help); } } - auto action = menu->addAction(QString("LAMMPS Manual")); + auto *action = menu->addAction(QString("LAMMPS Manual")); action->setIcon(QIcon(":/icons/help-browser.png")); action->setData(QString()); connect(action, &QAction::triggered, this, &CodeEditor::open_help); @@ -1166,7 +1166,7 @@ void CodeEditor::find_help(QString &page, QString &help) void CodeEditor::open_help() { - QAction *act = qobject_cast(sender()); + auto *act = qobject_cast(sender()); QDesktopServices::openUrl( QUrl(QString("https://docs.lammps.org/%1").arg(act->data().toString()))); } diff --git a/tools/lammps-gui/helpers.cpp b/tools/lammps-gui/helpers.cpp index 8db7cd0d68..bc158f3bb5 100644 --- a/tools/lammps-gui/helpers.cpp +++ b/tools/lammps-gui/helpers.cpp @@ -21,7 +21,7 @@ // duplicate string, STL version char *mystrdup(const std::string &text) { - auto tmp = new char[text.size() + 1]; + auto *tmp = new char[text.size() + 1]; memcpy(tmp, text.c_str(), text.size() + 1); return tmp; } diff --git a/tools/lammps-gui/imageviewer.cpp b/tools/lammps-gui/imageviewer.cpp index 1d00dd7c1d..faa18d7faf 100644 --- a/tools/lammps-gui/imageviewer.cpp +++ b/tools/lammps-gui/imageviewer.cpp @@ -143,7 +143,7 @@ ImageViewer::ImageViewer(const QString &fileName, LammpsWrapper *_lammps, QWidge scrollArea->setWidget(imageLabel); scrollArea->setVisible(false); - QVBoxLayout *mainLayout = new QVBoxLayout; + auto *mainLayout = new QVBoxLayout; QSettings settings; @@ -223,7 +223,7 @@ ImageViewer::ImageViewer(const QString &fileName, LammpsWrapper *_lammps, QWidge combo->addItem(gname); } - QHBoxLayout *menuLayout = new QHBoxLayout; + auto *menuLayout = new QHBoxLayout; menuLayout->addWidget(menuBar); menuLayout->addWidget(renderstatus); menuLayout->addWidget(new QLabel(" Width: ")); @@ -324,7 +324,7 @@ void ImageViewer::reset_view() void ImageViewer::edit_size() { - QSpinBox *field = qobject_cast(sender()); + auto *field = qobject_cast(sender()); if (field->objectName() == "xsize") { xsize = field->value(); } else if (field->objectName() == "ysize") { @@ -335,7 +335,7 @@ void ImageViewer::edit_size() void ImageViewer::toggle_ssao() { - QPushButton *button = qobject_cast(sender()); + auto *button = qobject_cast(sender()); usessao = !usessao; button->setChecked(usessao); createImage(); @@ -343,7 +343,7 @@ void ImageViewer::toggle_ssao() void ImageViewer::toggle_anti() { - QPushButton *button = qobject_cast(sender()); + auto *button = qobject_cast(sender()); antialias = !antialias; button->setChecked(antialias); createImage(); @@ -351,7 +351,7 @@ void ImageViewer::toggle_anti() void ImageViewer::toggle_vdw() { - QPushButton *button = qobject_cast(sender()); + auto *button = qobject_cast(sender()); if (vdwfactor > 1.0) vdwfactor = 0.5; else @@ -362,7 +362,7 @@ void ImageViewer::toggle_vdw() void ImageViewer::toggle_box() { - QPushButton *button = qobject_cast(sender()); + auto *button = qobject_cast(sender()); showbox = !showbox; button->setChecked(showbox); createImage(); @@ -370,7 +370,7 @@ void ImageViewer::toggle_box() void ImageViewer::toggle_axes() { - QPushButton *button = qobject_cast(sender()); + auto *button = qobject_cast(sender()); showaxes = !showaxes; button->setChecked(showaxes); createImage(); @@ -420,14 +420,14 @@ void ImageViewer::do_rot_up() void ImageViewer::change_group(int) { - QComboBox *box = findChild("group"); + auto *box = findChild("group"); if (box) group = box->currentText(); createImage(); } void ImageViewer::createImage() { - QLabel *renderstatus = findChild("renderstatus"); + auto *renderstatus = findChild("renderstatus"); if (renderstatus) renderstatus->setEnabled(true); repaint(); @@ -443,7 +443,7 @@ void ImageViewer::createImage() // determine elements from masses and set their covalent radii int ntypes = lammps->extract_setting("ntypes"); int nbondtypes = lammps->extract_setting("nbondtypes"); - double *masses = (double *)lammps->extract_atom("mass"); + auto *masses = (double *)lammps->extract_atom("mass"); QString units = (const char *)lammps->extract_global("units"); QString elements = "element "; QString adiams; diff --git a/tools/lammps-gui/lammpsgui.cpp b/tools/lammps-gui/lammpsgui.cpp index a78d891318..1d132003b2 100644 --- a/tools/lammps-gui/lammpsgui.cpp +++ b/tools/lammps-gui/lammpsgui.cpp @@ -300,14 +300,14 @@ LammpsGui::LammpsGui(QWidget *parent, const char *filename) : const char *varstyles[] = {"delete", "atomfile", "file", "format", "getenv", "index", "internal", "loop", "python", "string", "timer", "uloop", "universe", "world", "equal", "vector", "atom"}; - for (const auto var : varstyles) + for (const auto *const var : varstyles) style_list << var; style_list.sort(); ui->textEdit->setVariableList(style_list); style_list.clear(); const char *unitstyles[] = {"lj", "real", "metal", "si", "cgs", "electron", "micro", "nano"}; - for (const auto unit : unitstyles) + for (const auto *const unit : unitstyles) style_list << unit; style_list.sort(); ui->textEdit->setUnitsList(style_list); @@ -392,14 +392,14 @@ void LammpsGui::open() void LammpsGui::open_recent() { - QAction *act = qobject_cast(sender()); + auto *act = qobject_cast(sender()); if (act) open_file(act->data().toString()); } void LammpsGui::start_exe() { if (!lammps.extract_setting("box_exists")) return; - QAction *act = qobject_cast(sender()); + auto *act = qobject_cast(sender()); if (act) { auto exe = act->data().toString(); QString datacmd = "write_data '"; @@ -1052,7 +1052,7 @@ void LammpsGui::do_run(bool use_buffer) logwindow->document()->setDefaultFont(text_font); logwindow->setLineWrapMode(LogWindow::NoWrap); logwindow->setMinimumSize(400, 300); - QShortcut *shortcut = new QShortcut(QKeySequence(Qt::CTRL | Qt::Key_W), logwindow); + auto *shortcut = new QShortcut(QKeySequence(Qt::CTRL | Qt::Key_W), logwindow); QObject::connect(shortcut, &QShortcut::activated, logwindow, &LogWindow::close); shortcut = new QShortcut(QKeySequence(Qt::CTRL | Qt::Key_Slash), logwindow); QObject::connect(shortcut, &QShortcut::activated, this, &LammpsGui::stop_run); @@ -1244,7 +1244,7 @@ void LammpsGui::about() msg.setFont(font); auto *minwidth = new QSpacerItem(700, 0, QSizePolicy::Minimum, QSizePolicy::Expanding); - QGridLayout *layout = (QGridLayout *)msg.layout(); + auto *layout = (QGridLayout *)msg.layout(); layout->addItem(minwidth, layout->rowCount(), 0, 1, layout->columnCount()); msg.exec(); diff --git a/tools/lammps-gui/logwindow.cpp b/tools/lammps-gui/logwindow.cpp index 73ec81d06c..05887c329c 100644 --- a/tools/lammps-gui/logwindow.cpp +++ b/tools/lammps-gui/logwindow.cpp @@ -35,7 +35,7 @@ LogWindow::LogWindow(const QString &_filename, QWidget *parent) : QSettings settings; resize(settings.value("logx", 500).toInt(), settings.value("logy", 320).toInt()); - auto action = new QShortcut(QKeySequence(Qt::CTRL | Qt::Key_S), this); + auto *action = new QShortcut(QKeySequence(Qt::CTRL | Qt::Key_S), this); connect(action, &QShortcut::activated, this, &LogWindow::save_as); action = new QShortcut(QKeySequence(Qt::CTRL | Qt::Key_Q), this); connect(action, &QShortcut::activated, this, &LogWindow::quit); @@ -99,7 +99,7 @@ void LogWindow::contextMenuEvent(QContextMenuEvent *event) // show augmented context menu auto *menu = createStandardContextMenu(); menu->addSeparator(); - auto action = menu->addAction(QString("Save Log to File ...")); + auto *action = menu->addAction(QString("Save Log to File ...")); action->setIcon(QIcon(":/icons/document-save-as.png")); action->setShortcut(QKeySequence(Qt::CTRL | Qt::Key_S)); connect(action, &QAction::triggered, this, &LogWindow::save_as); @@ -114,7 +114,7 @@ void LogWindow::contextMenuEvent(QContextMenuEvent *event) bool LogWindow::eventFilter(QObject *watched, QEvent *event) { if (event->type() == QEvent::ShortcutOverride) { - QKeyEvent *keyEvent = dynamic_cast(event); + auto *keyEvent = dynamic_cast(event); if (!keyEvent) return QWidget::eventFilter(watched, event); if (keyEvent->modifiers().testFlag(Qt::ControlModifier) && keyEvent->key() == '/') { stop_run(); diff --git a/tools/lammps-gui/preferences.cpp b/tools/lammps-gui/preferences.cpp index 27cc106008..71910346fb 100644 --- a/tools/lammps-gui/preferences.cpp +++ b/tools/lammps-gui/preferences.cpp @@ -93,25 +93,25 @@ void Preferences::accept() // store selected accelerator QList allButtons = tabWidget->findChildren(); - for (int i = 0; i < allButtons.size(); ++i) { - if (allButtons[i]->isChecked()) { - if (allButtons[i]->objectName() == "none") + for (auto & allButton : allButtons) { + if (allButton->isChecked()) { + if (allButton->objectName() == "none") settings->setValue("accelerator", QString::number(AcceleratorTab::None)); - if (allButtons[i]->objectName() == "opt") + if (allButton->objectName() == "opt") settings->setValue("accelerator", QString::number(AcceleratorTab::Opt)); - if (allButtons[i]->objectName() == "openmp") + if (allButton->objectName() == "openmp") settings->setValue("accelerator", QString::number(AcceleratorTab::OpenMP)); - if (allButtons[i]->objectName() == "intel") + if (allButton->objectName() == "intel") settings->setValue("accelerator", QString::number(AcceleratorTab::Intel)); - if (allButtons[i]->objectName() == "kokkos") + if (allButton->objectName() == "kokkos") settings->setValue("accelerator", QString::number(AcceleratorTab::Kokkos)); - if (allButtons[i]->objectName() == "gpu") + if (allButton->objectName() == "gpu") settings->setValue("accelerator", QString::number(AcceleratorTab::Gpu)); } } // store number of threads, reset to 1 for "None" and "Opt" settings - QLineEdit *field = tabWidget->findChild("nthreads"); + auto *field = tabWidget->findChild("nthreads"); if (field) { int accel = settings->value("accelerator", AcceleratorTab::None).toInt(); if ((accel == AcceleratorTab::None) || (accel == AcceleratorTab::Opt)) @@ -132,7 +132,7 @@ void Preferences::accept() field = tabWidget->findChild("zoom"); if (field) if (field->hasAcceptableInput()) settings->setValue("zoom", field->text()); - QCheckBox *box = tabWidget->findChild("anti"); + auto *box = tabWidget->findChild("anti"); if (box) settings->setValue("antialias", box->isChecked()); box = tabWidget->findChild("ssao"); if (box) settings->setValue("ssao", box->isChecked()); @@ -142,7 +142,7 @@ void Preferences::accept() if (box) settings->setValue("axes", box->isChecked()); box = tabWidget->findChild("vdwstyle"); if (box) settings->setValue("vdwstyle", box->isChecked()); - QComboBox *combo = tabWidget->findChild("background"); + auto *combo = tabWidget->findChild("background"); if (combo) settings->setValue("background", combo->currentText()); combo = tabWidget->findChild("boxcolor"); if (combo) settings->setValue("boxcolor", combo->currentText()); @@ -166,7 +166,7 @@ void Preferences::accept() box = tabWidget->findChild("viewslide"); if (box) settings->setValue("viewslide", box->isChecked()); - auto spin = tabWidget->findChild("updfreq"); + auto *spin = tabWidget->findChild("updfreq"); if (spin) settings->setValue("updfreq", spin->value()); if (need_relaunch) { @@ -324,7 +324,7 @@ void GeneralTab::newtextfont() void GeneralTab::pluginpath() { - QLineEdit *field = findChild("pluginedit"); + auto *field = findChild("pluginedit"); QString pluginfile = QFileDialog::getOpenFileName(this, "Select Shared LAMMPS Library to Load", field->text(), "Shared Objects (*.so *.dll *.dylib)"); diff --git a/tools/lammps-gui/slideshow.cpp b/tools/lammps-gui/slideshow.cpp index 140c703ca3..9275842b78 100644 --- a/tools/lammps-gui/slideshow.cpp +++ b/tools/lammps-gui/slideshow.cpp @@ -281,7 +281,7 @@ void SlideShow::play() } // reset push button state. use findChild() if not triggered from button. - QPushButton *button = qobject_cast(sender()); + auto *button = qobject_cast(sender()); if (!button) button = findChild("play"); if (button) button->setChecked(playtimer); } @@ -315,7 +315,7 @@ void SlideShow::prev() void SlideShow::loop() { - QPushButton *button = qobject_cast(sender()); + auto *button = qobject_cast(sender()); do_loop = !do_loop; button->setChecked(do_loop); } From da2bd44b73684ce2eac70218db8f11a750b63542 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Thu, 4 Jul 2024 11:17:54 -0400 Subject: [PATCH 114/158] modernize and reformat with clang-tidy and clang-format --- unittest/c-library/test_library_commands.cpp | 5 +- unittest/c-library/test_library_external.cpp | 14 +- unittest/c-library/test_library_mpi.cpp | 28 +-- unittest/c-library/test_library_objects.cpp | 46 ++-- unittest/c-library/test_library_open.cpp | 17 +- .../c-library/test_library_properties.cpp | 24 +- .../c-library/test_library_scatter_gather.cpp | 16 +- unittest/commands/test_compute_chunk.cpp | 60 ++--- unittest/commands/test_compute_global.cpp | 52 ++--- unittest/commands/test_groups.cpp | 6 +- unittest/commands/test_labelmap.cpp | 4 +- unittest/commands/test_lattice_region.cpp | 24 +- unittest/commands/test_regions.cpp | 24 +- unittest/commands/test_reset_atoms.cpp | 20 +- unittest/commands/test_set_property.cpp | 6 +- unittest/commands/test_variables.cpp | 5 +- unittest/cplusplus/test_input_class.cpp | 6 +- unittest/cplusplus/test_lammps_class.cpp | 24 +- unittest/force-styles/test_angle_style.cpp | 36 +-- unittest/force-styles/test_bond_style.cpp | 39 ++-- unittest/force-styles/test_config.h | 2 +- unittest/force-styles/test_config_reader.h | 4 +- unittest/force-styles/test_dihedral_style.cpp | 33 ++- unittest/force-styles/test_fix_timestep.cpp | 34 +-- unittest/force-styles/test_improper_style.cpp | 30 +-- unittest/force-styles/test_main.cpp | 2 +- unittest/force-styles/test_main.h | 16 +- unittest/force-styles/test_pair_style.cpp | 36 +-- unittest/force-styles/yaml_writer.h | 6 +- unittest/formats/compressed_dump_test.h | 4 +- unittest/formats/test_atom_styles.cpp | 206 +++++++++--------- .../formats/test_dump_atom_compressed.cpp | 102 ++++----- unittest/formats/test_dump_cfg.cpp | 24 +- unittest/formats/test_dump_cfg_compressed.cpp | 114 +++++----- unittest/formats/test_dump_custom.cpp | 50 +++-- .../formats/test_dump_custom_compressed.cpp | 119 +++++----- unittest/formats/test_dump_local.cpp | 20 +- .../formats/test_dump_local_compressed.cpp | 148 ++++++------- unittest/formats/test_dump_netcdf.cpp | 8 +- unittest/formats/test_dump_xyz_compressed.cpp | 90 ++++---- unittest/formats/test_file_operations.cpp | 8 +- unittest/formats/test_image_flags.cpp | 16 +- .../formats/test_potential_file_reader.cpp | 26 +-- unittest/formats/test_text_file_reader.cpp | 16 +- unittest/fortran/wrap_configuration.cpp | 4 +- unittest/fortran/wrap_create.cpp | 16 +- unittest/fortran/wrap_create_atoms.cpp | 158 +++++++------- unittest/fortran/wrap_extract_fix.cpp | 8 +- unittest/fortran/wrap_fixexternal.cpp | 77 +++---- unittest/fortran/wrap_gather_scatter.cpp | 22 +- unittest/fortran/wrap_neighlist.cpp | 63 +++--- unittest/testing/core.h | 2 +- unittest/utils/test_lepton.cpp | 5 +- unittest/utils/test_lmptype.cpp | 10 +- unittest/utils/test_math_eigen_impl.cpp | 16 +- 55 files changed, 980 insertions(+), 971 deletions(-) diff --git a/unittest/c-library/test_library_commands.cpp b/unittest/c-library/test_library_commands.cpp index 31f8268a8f..4abb42cae2 100644 --- a/unittest/c-library/test_library_commands.cpp +++ b/unittest/c-library/test_library_commands.cpp @@ -25,9 +25,8 @@ protected: void SetUp() override { - const char *args[] = {"LAMMPS_test", "-log", "none", "-echo", "screen", "-nocite", - "-var", "x", "2", "-var", "zpos", "1.5", - nullptr}; + const char *args[] = {"LAMMPS_test", "-log", "none", "-echo", "screen", "-nocite", "-var", + "x", "2", "-var", "zpos", "1.5", nullptr}; char **argv = (char **)args; int argc = (sizeof(args) / sizeof(char *)) - 1; diff --git a/unittest/c-library/test_library_external.cpp b/unittest/c-library/test_library_external.cpp index 9011ac19a8..606d53d38b 100644 --- a/unittest/c-library/test_library_external.cpp +++ b/unittest/c-library/test_library_external.cpp @@ -18,8 +18,8 @@ extern "C" { typedef int32_t step_t; typedef int32_t tag_t; #elif LAMMPS_SMALLBIG -typedef int64_t step_t; -typedef int32_t tag_t; +using step_t = int64_t; +using tag_t = int32_t; #else typedef int64_t step_t; typedef int64_t tag_t; @@ -42,10 +42,10 @@ static void callback(void *handle, step_t timestep, int nlocal, tag_t *, double lammps_fix_external_set_vector(handle, "ext", 5, -1.0); lammps_fix_external_set_vector(handle, "ext", 6, 0.25); } - double *eatom = new double[nlocal]; - double **vatom = new double *[nlocal]; - vatom[0] = new double[nlocal * 6]; - eatom[0] = 0.0; + auto *eatom = new double[nlocal]; + auto **vatom = new double *[nlocal]; + vatom[0] = new double[nlocal * 6]; + eatom[0] = 0.0; vatom[0][0] = vatom[0][1] = vatom[0][2] = vatom[0][3] = vatom[0][4] = vatom[0][5] = 0.0; for (int i = 1; i < nlocal; ++i) { @@ -107,7 +107,7 @@ TEST(lammps_external, callback) val += *valp; lammps_free(valp); } - double *reduce = + auto *reduce = (double *)lammps_extract_compute(handle, "sum", LMP_STYLE_GLOBAL, LMP_TYPE_VECTOR); output = ::testing::internal::GetCapturedStdout(); if (verbose) std::cout << output; diff --git a/unittest/c-library/test_library_mpi.cpp b/unittest/c-library/test_library_mpi.cpp index f60105a229..f2e8ba1c8c 100644 --- a/unittest/c-library/test_library_mpi.cpp +++ b/unittest/c-library/test_library_mpi.cpp @@ -97,8 +97,8 @@ TEST(MPI, sub_box) EXPECT_EQ(boxhi[1], 2.0); EXPECT_EQ(boxhi[2], 2.0); - double *sublo = (double *)lammps_extract_global(lmp, "sublo"); - double *subhi = (double *)lammps_extract_global(lmp, "subhi"); + auto *sublo = (double *)lammps_extract_global(lmp, "sublo"); + auto *subhi = (double *)lammps_extract_global(lmp, "subhi"); ASSERT_NE(sublo, nullptr); ASSERT_NE(subhi, nullptr); @@ -172,8 +172,8 @@ TEST(MPI, multi_partition) MPI_Comm_size(MPI_COMM_WORLD, &nprocs); MPI_Comm_rank(MPI_COMM_WORLD, &me); - const char *args[] = {"LAMMPS_test", "-log", "none", "-partition", "4x1", - "-echo", "screen", "-nocite", "-in", "none", nullptr}; + const char *args[] = {"LAMMPS_test", "-log", "none", "-partition", "4x1", "-echo", + "screen", "-nocite", "-in", "none", nullptr}; char **argv = (char **)args; int argc = (sizeof(args) / sizeof(char *)) - 1; void *lmp = lammps_open(argc, argv, MPI_COMM_WORLD, nullptr); @@ -258,7 +258,7 @@ TEST_F(MPITest, size_rank) TEST_F(MPITest, gather) { - int64_t natoms = (int64_t)lammps_get_natoms(lmp); + auto natoms = (int64_t)lammps_get_natoms(lmp); ASSERT_EQ(natoms, 32); int *p_nlocal = (int *)lammps_extract_global(lmp, "nlocal"); int nlocal = *p_nlocal; @@ -266,11 +266,11 @@ TEST_F(MPITest, gather) EXPECT_EQ(nlocal, 8); // get the entire x on all procs - double *x = new double[natoms * 3]; + auto *x = new double[natoms * 3]; lammps_gather(lmp, (char *)"x", 1, 3, x); - int *tag = (int *)lammps_extract_atom(lmp, "id"); - double **x_local = (double **)lammps_extract_atom(lmp, "x"); + int *tag = (int *)lammps_extract_atom(lmp, "id"); + auto **x_local = (double **)lammps_extract_atom(lmp, "x"); // each proc checks its local atoms for (int i = 0; i < nlocal; i++) { @@ -287,10 +287,10 @@ TEST_F(MPITest, gather) TEST_F(MPITest, scatter) { - int *p_nlocal = (int *)lammps_extract_global(lmp, "nlocal"); - int nlocal = *p_nlocal; - double *x_orig = new double[3 * nlocal]; - double **x_local = (double **)lammps_extract_atom(lmp, "x"); + int *p_nlocal = (int *)lammps_extract_global(lmp, "nlocal"); + int nlocal = *p_nlocal; + auto *x_orig = new double[3 * nlocal]; + auto **x_local = (double **)lammps_extract_atom(lmp, "x"); // make copy of original local x vector for (int i = 0; i < nlocal; i++) { @@ -301,8 +301,8 @@ TEST_F(MPITest, scatter) } // get the entire x on all procs - int64_t natoms = (int64_t)lammps_get_natoms(lmp); - double *x = new double[natoms * 3]; + auto natoms = (int64_t)lammps_get_natoms(lmp); + auto *x = new double[natoms * 3]; lammps_gather(lmp, (char *)"x", 1, 3, x); // shift all coordinates by 0.001 diff --git a/unittest/c-library/test_library_objects.cpp b/unittest/c-library/test_library_objects.cpp index d224c76225..9d30492be3 100644 --- a/unittest/c-library/test_library_objects.cpp +++ b/unittest/c-library/test_library_objects.cpp @@ -112,75 +112,75 @@ TEST_F(LibraryObjects, variables) if (verbose) std::cout << output; EXPECT_EQ(lammps_extract_variable_datatype(lmp, "unknown"), -1); - void *ptr = lammps_extract_variable(lmp, "unknown", NULL); + void *ptr = lammps_extract_variable(lmp, "unknown", nullptr); EXPECT_EQ(ptr, nullptr); EXPECT_EQ(lammps_extract_variable_datatype(lmp, "one"), LMP_VAR_STRING); - ptr = lammps_extract_variable(lmp, "one", NULL); + ptr = lammps_extract_variable(lmp, "one", nullptr); EXPECT_NE(ptr, nullptr); EXPECT_THAT((char *)ptr, StrEq("1")); EXPECT_EQ(lammps_extract_variable_datatype(lmp, "two"), LMP_VAR_EQUAL); - ptr = lammps_extract_variable(lmp, "two", NULL); + ptr = lammps_extract_variable(lmp, "two", nullptr); EXPECT_NE(ptr, nullptr); EXPECT_THAT(*(double *)ptr, 2.0); lammps_free(ptr); EXPECT_EQ(lammps_extract_variable_datatype(lmp, "three"), LMP_VAR_STRING); - ptr = lammps_extract_variable(lmp, "three", NULL); + ptr = lammps_extract_variable(lmp, "three", nullptr); EXPECT_THAT((char *)ptr, StrEq("three")); EXPECT_EQ(lammps_extract_variable_datatype(lmp, "four1"), LMP_VAR_STRING); - ptr = lammps_extract_variable(lmp, "four1", NULL); + ptr = lammps_extract_variable(lmp, "four1", nullptr); EXPECT_THAT((char *)ptr, StrEq("1")); EXPECT_EQ(lammps_extract_variable_datatype(lmp, "four2"), LMP_VAR_STRING); - ptr = lammps_extract_variable(lmp, "four2", NULL); + ptr = lammps_extract_variable(lmp, "four2", nullptr); EXPECT_THAT((char *)ptr, StrEq("2")); EXPECT_EQ(lammps_extract_variable_datatype(lmp, "five1"), LMP_VAR_STRING); - ptr = lammps_extract_variable(lmp, "five1", NULL); + ptr = lammps_extract_variable(lmp, "five1", nullptr); EXPECT_THAT((char *)ptr, StrEq("001")); EXPECT_EQ(lammps_extract_variable_datatype(lmp, "five2"), LMP_VAR_STRING); - ptr = lammps_extract_variable(lmp, "five2", NULL); + ptr = lammps_extract_variable(lmp, "five2", nullptr); EXPECT_THAT((char *)ptr, StrEq("010")); EXPECT_EQ(lammps_extract_variable_datatype(lmp, "six"), LMP_VAR_STRING); - ptr = lammps_extract_variable(lmp, "six", NULL); + ptr = lammps_extract_variable(lmp, "six", nullptr); EXPECT_THAT((char *)ptr, StrEq("one")); EXPECT_EQ(lammps_extract_variable_datatype(lmp, "seven"), LMP_VAR_STRING); - ptr = lammps_extract_variable(lmp, "seven", NULL); + ptr = lammps_extract_variable(lmp, "seven", nullptr); EXPECT_THAT((char *)ptr, StrEq(" 2.00")); EXPECT_EQ(lammps_extract_variable_datatype(lmp, "eight"), LMP_VAR_STRING); - ptr = lammps_extract_variable(lmp, "eight", NULL); + ptr = lammps_extract_variable(lmp, "eight", nullptr); EXPECT_THAT((char *)ptr, StrEq("")); EXPECT_EQ(lammps_extract_variable_datatype(lmp, "nine"), LMP_VAR_STRING); - ptr = lammps_extract_variable(lmp, "nine", NULL); + ptr = lammps_extract_variable(lmp, "nine", nullptr); EXPECT_THAT((char *)ptr, StrEq("one")); EXPECT_EQ(lammps_extract_variable_datatype(lmp, "ten"), LMP_VAR_EQUAL); - ptr = lammps_extract_variable(lmp, "ten", NULL); + ptr = lammps_extract_variable(lmp, "ten", nullptr); EXPECT_THAT(*(double *)ptr, 1.0); lammps_free(ptr); variable->internal_set(variable->find("ten"), 2.5); - ptr = lammps_extract_variable(lmp, "ten", NULL); + ptr = lammps_extract_variable(lmp, "ten", nullptr); EXPECT_THAT(*(double *)ptr, 2.5); lammps_free(ptr); EXPECT_EQ(lammps_extract_variable_datatype(lmp, "ten1"), LMP_VAR_STRING); - ptr = lammps_extract_variable(lmp, "ten1", NULL); + ptr = lammps_extract_variable(lmp, "ten1", nullptr); EXPECT_THAT((char *)ptr, StrEq("1")); EXPECT_EQ(lammps_extract_variable_datatype(lmp, "ten2"), LMP_VAR_STRING); - ptr = lammps_extract_variable(lmp, "ten2", NULL); + ptr = lammps_extract_variable(lmp, "ten2", nullptr); EXPECT_THAT((char *)ptr, StrEq("1")); EXPECT_EQ(lammps_extract_variable_datatype(lmp, "ten3"), LMP_VAR_STRING); - ptr = lammps_extract_variable(lmp, "ten3", NULL); + ptr = lammps_extract_variable(lmp, "ten3", nullptr); EXPECT_THAT((char *)ptr, StrEq("1")); EXPECT_EQ(lammps_extract_variable_datatype(lmp, "ten4"), LMP_VAR_VECTOR); - ptr = lammps_extract_variable(lmp, "ten4", (const char *)1); - double *dptr = (double *)lammps_extract_variable(lmp, "ten4", NULL); + ptr = lammps_extract_variable(lmp, "ten4", (const char *)1); + auto *dptr = (double *)lammps_extract_variable(lmp, "ten4", nullptr); EXPECT_EQ((*(int *)ptr), 7); lammps_free(ptr); EXPECT_EQ(dptr[0], 0); EXPECT_EQ(dptr[4], 5); EXPECT_EQ(dptr[6], 11); EXPECT_EQ(lammps_extract_variable_datatype(lmp, "ten5"), LMP_VAR_VECTOR); - ptr = lammps_extract_variable(lmp, "ten5", (const char *)1); - dptr = (double *)lammps_extract_variable(lmp, "ten5", NULL); + ptr = lammps_extract_variable(lmp, "ten5", (const char *)1); + dptr = (double *)lammps_extract_variable(lmp, "ten5", nullptr); EXPECT_EQ((*(int *)ptr), 2); lammps_free(ptr); EXPECT_EQ(dptr[0], 0.5); @@ -196,10 +196,10 @@ TEST_F(LibraryObjects, variables) EXPECT_THAT(*(double *)ptr, 0.0); lammps_free(ptr); #elif defined(__linux__) - ptr = lammps_extract_variable(lmp, "iswin", NULL); + ptr = lammps_extract_variable(lmp, "iswin", nullptr); EXPECT_THAT(*(double *)ptr, 0.0); lammps_free(ptr); - ptr = lammps_extract_variable(lmp, "islin", NULL); + ptr = lammps_extract_variable(lmp, "islin", nullptr); EXPECT_THAT(*(double *)ptr, 1.0); lammps_free(ptr); #else diff --git a/unittest/c-library/test_library_open.cpp b/unittest/c-library/test_library_open.cpp index 267f8e0978..426b2adaa7 100644 --- a/unittest/c-library/test_library_open.cpp +++ b/unittest/c-library/test_library_open.cpp @@ -25,7 +25,7 @@ TEST(lammps_open, null_args) int mpi_init = 0; MPI_Initialized(&mpi_init); EXPECT_GT(mpi_init, 0); - LAMMPS_NS::LAMMPS *lmp = (LAMMPS_NS::LAMMPS *)handle; + auto *lmp = (LAMMPS_NS::LAMMPS *)handle; EXPECT_EQ(lmp->world, MPI_COMM_WORLD); EXPECT_EQ(lmp->infile, stdin); EXPECT_EQ(lmp->screen, stdout); @@ -53,7 +53,7 @@ TEST(lammps_open, with_args) EXPECT_THAT(output, StartsWith("LAMMPS (")); if (verbose) std::cout << output; EXPECT_EQ(handle, alt_ptr); - LAMMPS_NS::LAMMPS *lmp = (LAMMPS_NS::LAMMPS *)handle; + auto *lmp = (LAMMPS_NS::LAMMPS *)handle; // MPI STUBS uses no real communicators #if !defined(MPI_STUBS) @@ -89,7 +89,7 @@ TEST(lammps_open, with_kokkos) EXPECT_THAT(output, StartsWith("LAMMPS (")); if (verbose) std::cout << output; EXPECT_EQ(handle, alt_ptr); - LAMMPS_NS::LAMMPS *lmp = (LAMMPS_NS::LAMMPS *)handle; + auto *lmp = (LAMMPS_NS::LAMMPS *)handle; EXPECT_EQ(lmp->world, MPI_COMM_WORLD); EXPECT_EQ(lmp->infile, stdin); @@ -118,7 +118,7 @@ TEST(lammps_open_no_mpi, no_screen) std::string output = ::testing::internal::GetCapturedStdout(); EXPECT_STREQ(output.c_str(), ""); EXPECT_EQ(handle, alt_ptr); - LAMMPS_NS::LAMMPS *lmp = (LAMMPS_NS::LAMMPS *)handle; + auto *lmp = (LAMMPS_NS::LAMMPS *)handle; EXPECT_EQ(lmp->world, MPI_COMM_WORLD); EXPECT_EQ(lmp->infile, stdin); @@ -138,7 +138,7 @@ TEST(lammps_open_no_mpi, no_screen) TEST(lammps_open_no_mpi, with_omp) { if (!LAMMPS_NS::LAMMPS::is_installed_pkg("OPENMP")) GTEST_SKIP(); - const char *args[] = {"liblammps", "-pk", "omp", "2", "neigh", "no", + const char *args[] = {"liblammps", "-pk", "omp", "2", "neigh", "no", "-sf", "omp", "-log", "none", "-nocite", nullptr}; char **argv = (char **)args; int argc = (sizeof(args) / sizeof(char *)) - 1; @@ -150,7 +150,7 @@ TEST(lammps_open_no_mpi, with_omp) EXPECT_THAT(output, StartsWith("LAMMPS (")); if (verbose) std::cout << output; EXPECT_EQ(handle, alt_ptr); - LAMMPS_NS::LAMMPS *lmp = (LAMMPS_NS::LAMMPS *)handle; + auto *lmp = (LAMMPS_NS::LAMMPS *)handle; EXPECT_EQ(lmp->world, MPI_COMM_WORLD); EXPECT_EQ(lmp->infile, stdin); @@ -179,7 +179,7 @@ TEST(lammps_open_fortran, no_args) std::string output = ::testing::internal::GetCapturedStdout(); EXPECT_THAT(output, StartsWith("LAMMPS (")); if (verbose) std::cout << output; - LAMMPS_NS::LAMMPS *lmp = (LAMMPS_NS::LAMMPS *)handle; + auto *lmp = (LAMMPS_NS::LAMMPS *)handle; // MPI STUBS uses no real communicators #if !defined(MPI_STUBS) @@ -210,7 +210,7 @@ TEST(lammps_open_no_mpi, lammps_error) void *handle = lammps_open_no_mpi(argc, argv, &alt_ptr); std::string output = ::testing::internal::GetCapturedStdout(); EXPECT_EQ(handle, alt_ptr); - LAMMPS_NS::LAMMPS *lmp = (LAMMPS_NS::LAMMPS *)handle; + auto *lmp = (LAMMPS_NS::LAMMPS *)handle; EXPECT_EQ(lmp->world, MPI_COMM_WORLD); EXPECT_EQ(lmp->infile, stdin); @@ -226,4 +226,3 @@ TEST(lammps_open_no_mpi, lammps_error) output = ::testing::internal::GetCapturedStdout(); EXPECT_THAT(output, HasSubstr("WARNING: test_warning")); } - diff --git a/unittest/c-library/test_library_properties.cpp b/unittest/c-library/test_library_properties.cpp index 804853194b..043b6c08d9 100644 --- a/unittest/c-library/test_library_properties.cpp +++ b/unittest/c-library/test_library_properties.cpp @@ -376,18 +376,18 @@ TEST_F(LibraryProperties, global) EXPECT_EQ((*i_ptr), 2); #else EXPECT_EQ(lammps_extract_global_datatype(lmp, "ntimestep"), LAMMPS_INT64); - int64_t *b_ptr = (int64_t *)lammps_extract_global(lmp, "ntimestep"); + auto *b_ptr = (int64_t *)lammps_extract_global(lmp, "ntimestep"); EXPECT_EQ((*b_ptr), 2); #endif EXPECT_EQ(lammps_extract_global_datatype(lmp, "dt"), LAMMPS_DOUBLE); - double *d_ptr = (double *)lammps_extract_global(lmp, "dt"); + auto *d_ptr = (double *)lammps_extract_global(lmp, "dt"); EXPECT_DOUBLE_EQ((*d_ptr), 0.1); 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"); + auto *special_lj = (double *)lammps_extract_global(lmp, "special_lj"); + auto *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); @@ -418,14 +418,14 @@ TEST_F(LibraryProperties, global) EXPECT_EQ(map_style, Atom::MAP_ARRAY); EXPECT_NE(sametag, nullptr); - tagint *tags = (tagint *)lammps_extract_atom(lmp, "id"); + auto *tags = (tagint *)lammps_extract_atom(lmp, "id"); tagint sometags[] = {1, 5, 10, 15, 20}; - for (int i = 0; i < 5; ++i) { - int idx = lammps_map_atom(lmp, (const void *)&sometags[i]); - EXPECT_EQ(sometags[i], tags[idx]); + for (int &sometag : sometags) { + int idx = lammps_map_atom(lmp, (const void *)&sometag); + EXPECT_EQ(sometag, tags[idx]); int nextidx = sametag[idx]; if (nextidx >= 0) { - EXPECT_EQ(sometags[i], tags[nextidx]); + EXPECT_EQ(sometag, tags[nextidx]); } } @@ -655,7 +655,7 @@ TEST_F(AtomProperties, invalid) TEST_F(AtomProperties, mass) { EXPECT_EQ(lammps_extract_atom_datatype(lmp, "mass"), LAMMPS_DOUBLE); - double *mass = (double *)lammps_extract_atom(lmp, "mass"); + auto *mass = (double *)lammps_extract_atom(lmp, "mass"); ASSERT_NE(mass, nullptr); ASSERT_DOUBLE_EQ(mass[1], 3.0); } @@ -663,7 +663,7 @@ TEST_F(AtomProperties, mass) TEST_F(AtomProperties, id) { EXPECT_EQ(lammps_extract_atom_datatype(lmp, "id"), LAMMPS_TAGINT); - tagint *id = (tagint *)lammps_extract_atom(lmp, "id"); + auto *id = (tagint *)lammps_extract_atom(lmp, "id"); ASSERT_NE(id, nullptr); ASSERT_EQ(id[0], 1); ASSERT_EQ(id[1], 2); @@ -681,7 +681,7 @@ TEST_F(AtomProperties, type) TEST_F(AtomProperties, position) { EXPECT_EQ(lammps_extract_atom_datatype(lmp, "x"), LAMMPS_DOUBLE_2D); - double **x = (double **)lammps_extract_atom(lmp, "x"); + auto **x = (double **)lammps_extract_atom(lmp, "x"); ASSERT_NE(x, nullptr); EXPECT_DOUBLE_EQ(x[0][0], 1.0); EXPECT_DOUBLE_EQ(x[0][1], 1.0); diff --git a/unittest/c-library/test_library_scatter_gather.cpp b/unittest/c-library/test_library_scatter_gather.cpp index 0303a47337..62a7ed1d3a 100644 --- a/unittest/c-library/test_library_scatter_gather.cpp +++ b/unittest/c-library/test_library_scatter_gather.cpp @@ -67,7 +67,7 @@ TEST_F(GatherProperties, gather_bonds_newton_on) bigint nbonds = *(bigint *)lammps_extract_global(lmp, "nbonds"); EXPECT_EQ(nbonds, 24); - tagint *bonds = new tagint[3 * nbonds]; + auto *bonds = new tagint[3 * nbonds]; lammps_gather_bonds(lmp, bonds); #define CHECK_BOND(idx, type, atom1, atom2) \ @@ -108,7 +108,7 @@ TEST_F(GatherProperties, gather_bonds_newton_off) bigint nbonds = *(bigint *)lammps_extract_global(lmp, "nbonds"); EXPECT_EQ(nbonds, 24); - tagint *bonds = new tagint[3 * nbonds]; + auto *bonds = new tagint[3 * nbonds]; lammps_gather_bonds(lmp, bonds); #define CHECK_BOND(idx, type, atom1, atom2) \ @@ -149,7 +149,7 @@ TEST_F(GatherProperties, gather_angles_newton_on) bigint nangles = *(bigint *)lammps_extract_global(lmp, "nangles"); EXPECT_EQ(nangles, 30); - tagint *angles = new tagint[4 * nangles]; + auto *angles = new tagint[4 * nangles]; lammps_gather_angles(lmp, angles); #define CHECK_ANGLE(idx, type, atom1, atom2, atom3) \ @@ -192,7 +192,7 @@ TEST_F(GatherProperties, gather_angles_newton_off) bigint nangles = *(bigint *)lammps_extract_global(lmp, "nangles"); EXPECT_EQ(nangles, 30); - tagint *angles = new tagint[4 * nangles]; + auto *angles = new tagint[4 * nangles]; lammps_gather_angles(lmp, angles); #define CHECK_ANGLE(idx, type, atom1, atom2, atom3) \ @@ -235,7 +235,7 @@ TEST_F(GatherProperties, gather_dihedrals_newton_on) bigint ndihedrals = *(bigint *)lammps_extract_global(lmp, "ndihedrals"); EXPECT_EQ(ndihedrals, 31); - tagint *dihedrals = new tagint[5 * ndihedrals]; + auto *dihedrals = new tagint[5 * ndihedrals]; lammps_gather_dihedrals(lmp, dihedrals); #define CHECK_DIHEDRAL(idx, type, atom1, atom2, atom3, atom4) \ @@ -276,7 +276,7 @@ TEST_F(GatherProperties, gather_dihedrals_newton_off) bigint ndihedrals = *(bigint *)lammps_extract_global(lmp, "ndihedrals"); EXPECT_EQ(ndihedrals, 31); - tagint *dihedrals = new tagint[5 * ndihedrals]; + auto *dihedrals = new tagint[5 * ndihedrals]; lammps_gather_dihedrals(lmp, dihedrals); #define CHECK_DIHEDRAL(idx, type, atom1, atom2, atom3, atom4) \ @@ -316,7 +316,7 @@ TEST_F(GatherProperties, gather_impropers_newton_on) bigint nimpropers = *(bigint *)lammps_extract_global(lmp, "nimpropers"); EXPECT_EQ(nimpropers, 2); - tagint *impropers = new tagint[5 * nimpropers]; + auto *impropers = new tagint[5 * nimpropers]; lammps_gather_impropers(lmp, impropers); #define CHECK_IMPROPER(idx, type, atom1, atom2, atom3, atom4) \ @@ -349,7 +349,7 @@ TEST_F(GatherProperties, gather_impropers_newton_off) bigint nimpropers = *(bigint *)lammps_extract_global(lmp, "nimpropers"); EXPECT_EQ(nimpropers, 2); - tagint *impropers = new tagint[5 * nimpropers]; + auto *impropers = new tagint[5 * nimpropers]; lammps_gather_impropers(lmp, impropers); #define CHECK_IMPROPER(idx, type, atom1, atom2, atom3, atom4) \ diff --git a/unittest/commands/test_compute_chunk.cpp b/unittest/commands/test_compute_chunk.cpp index 8e919c0612..2a7f18e706 100644 --- a/unittest/commands/test_compute_chunk.cpp +++ b/unittest/commands/test_compute_chunk.cpp @@ -120,14 +120,14 @@ TEST_F(ComputeChunkTest, ChunkAtom) EXPECT_EQ(get_scalar("mols"), 6); EXPECT_EQ(get_scalar("types"), 5); - auto cbin1d = get_peratom("bin1d"); - auto cbin2d = get_peratom("bin2d"); - auto cbin3d = get_peratom("bin3d"); - auto cbinsph = get_peratom("binsph"); - auto cbincyl = get_peratom("bincyl"); - auto cmols = get_peratom("mols"); - auto ctypes = get_peratom("types"); - auto tag = get_peratom("tags"); + auto *cbin1d = get_peratom("bin1d"); + auto *cbin2d = get_peratom("bin2d"); + auto *cbin3d = get_peratom("bin3d"); + auto *cbinsph = get_peratom("binsph"); + auto *cbincyl = get_peratom("bincyl"); + auto *cmols = get_peratom("mols"); + auto *ctypes = get_peratom("types"); + auto *tag = get_peratom("tags"); for (int i = 0; i < natoms; ++i) { EXPECT_EQ(cbin1d[i], chunk1d[(int)tag[i]]); @@ -180,16 +180,16 @@ TEST_F(ComputeChunkTest, PropertyChunk) command("run 0 post no"); END_HIDE_OUTPUT(); - auto cprop1 = get_vector("prop1"); + auto *cprop1 = get_vector("prop1"); EXPECT_EQ(cprop1[0], 0); EXPECT_EQ(cprop1[1], 7); EXPECT_EQ(cprop1[2], 16); EXPECT_EQ(cprop1[3], 6); EXPECT_EQ(cprop1[4], 0); - auto cprop2 = get_vector("prop2"); - int nempty = 0; - int ncount = 0; + auto *cprop2 = get_vector("prop2"); + int nempty = 0; + int ncount = 0; for (int i = 0; i < 25; ++i) { if (cprop2[i] == 0) ++nempty; @@ -199,7 +199,7 @@ TEST_F(ComputeChunkTest, PropertyChunk) EXPECT_EQ(nempty, 17); EXPECT_EQ(ncount, 29); - auto cprop3 = get_array("prop3"); + auto *cprop3 = get_array("prop3"); EXPECT_EQ(cprop3[0][0], 34); EXPECT_EQ(cprop3[1][0], 38); EXPECT_EQ(cprop3[2][0], 43); @@ -250,15 +250,15 @@ TEST_F(ComputeChunkTest, ChunkComputes) command("fix hist2 all ave/time 1 1 1 c_tmp mode vector"); command("run 0 post no"); END_HIDE_OUTPUT(); - auto cang = get_array("ang"); - auto ccom = get_array("com"); - auto cdip = get_array("dip"); - auto cgyr = get_vector("gyr"); - auto cmom = get_array("mom"); - auto comg = get_array("omg"); - auto ctmp = get_vector("tmp"); - auto ctrq = get_array("trq"); - auto cvcm = get_array("vcm"); + auto *cang = get_array("ang"); + auto *ccom = get_array("com"); + auto *cdip = get_array("dip"); + auto *cgyr = get_vector("gyr"); + auto *cmom = get_array("mom"); + auto *comg = get_array("omg"); + auto *ctmp = get_vector("tmp"); + auto *ctrq = get_array("trq"); + auto *cvcm = get_array("vcm"); EXPECT_NEAR(cang[0][0], -0.01906982, EPSILON); EXPECT_NEAR(cang[0][1], -0.02814532, EPSILON); EXPECT_NEAR(cang[0][2], -0.03357393, EPSILON); @@ -329,7 +329,7 @@ TEST_F(ComputeChunkTest, ChunkTIP4PComputes) command("fix hist1 all ave/time 1 1 1 c_dip[*] mode vector"); command("run 0 post no"); END_HIDE_OUTPUT(); - auto cdip = get_array("dip"); + auto *cdip = get_array("dip"); EXPECT_NEAR(cdip[0][3], 0.35912150, EPSILON); EXPECT_NEAR(cdip[1][3], 0.68453713, EPSILON); EXPECT_NEAR(cdip[2][3], 0.50272643, EPSILON); @@ -358,11 +358,11 @@ TEST_F(ComputeChunkTest, ChunkSpreadGlobal) const int natoms = lammps_get_natoms(lmp); - auto cgyr = get_vector("gyr"); - auto cspr = get_peratom("spr"); - auto cglb = get_peratom("glb"); - auto codd = get_peratom("odd"); - auto ctag = get_peratom("tags"); + auto *cgyr = get_vector("gyr"); + auto *cspr = get_peratom("spr"); + auto *cglb = get_peratom("glb"); + auto *codd = get_peratom("odd"); + auto *ctag = get_peratom("tags"); for (int i = 0; i < natoms; ++i) { EXPECT_EQ(cspr[i], cgyr[chunkmol[(int)ctag[i]] - 1]); @@ -389,8 +389,8 @@ TEST_F(ComputeChunkTest, ChunkReduce) const int nchunks = get_scalar("mols"); - auto cprp = get_vector("prp"); - auto cred = get_vector("red"); + auto *cprp = get_vector("prp"); + auto *cred = get_vector("red"); for (int i = 0; i < nchunks; ++i) EXPECT_EQ(cprp[i], cred[i]); diff --git a/unittest/commands/test_compute_global.cpp b/unittest/commands/test_compute_global.cpp index d3d883a73e..282d1641bf 100644 --- a/unittest/commands/test_compute_global.cpp +++ b/unittest/commands/test_compute_global.cpp @@ -103,9 +103,9 @@ TEST_F(ComputeGlobalTest, Energy) EXPECT_NEAR(get_scalar("pr1"), 1956948.4735454607, 0.000000005); EXPECT_NEAR(get_scalar("pr2"), 1956916.7725807722, 0.000000005); EXPECT_DOUBLE_EQ(get_scalar("pr3"), 0.0); - auto pr1 = get_vector("pr1"); - auto pr2 = get_vector("pr2"); - auto pr3 = get_vector("pr3"); + auto *pr1 = get_vector("pr1"); + auto *pr2 = get_vector("pr2"); + auto *pr3 = get_vector("pr3"); EXPECT_NEAR(pr1[0], 2150600.9207200543, 0.000000005); EXPECT_NEAR(pr1[1], 1466949.7512112649, 0.000000005); EXPECT_NEAR(pr1[2], 2253294.7487050635, 0.000000005); @@ -127,7 +127,7 @@ TEST_F(ComputeGlobalTest, Energy) if (has_tally) { EXPECT_NEAR(get_scalar("pe4"), 15425.840923850392, 0.000000005); - auto pe5 = get_vector("pe5"); + auto *pe5 = get_vector("pe5"); EXPECT_NEAR(pe5[0], 23803.966677151559, 0.000000005); EXPECT_NEAR(pe5[1], -94.210004432380643, 0.000000005); EXPECT_NEAR(pe5[2], 115.58040355478101, 0.000000005); @@ -177,12 +177,12 @@ TEST_F(ComputeGlobalTest, Geometry) command("run 0 post no"); END_HIDE_OUTPUT(); - auto com1 = get_vector("com1"); - auto com2 = get_vector("com2"); - auto mu1 = get_vector("mu1"); - auto mu2 = get_vector("mu2"); - auto rg1 = get_vector("rg1"); - auto rg2 = get_vector("rg2"); + auto *com1 = get_vector("com1"); + auto *com2 = get_vector("com2"); + auto *mu1 = get_vector("mu1"); + auto *mu2 = get_vector("mu2"); + auto *rg1 = get_vector("rg1"); + auto *rg2 = get_vector("rg2"); EXPECT_NEAR(com1[0], 1.4300952724948282, 0.0000000005); EXPECT_NEAR(com1[1], -0.29759806705328351, 0.0000000005); @@ -215,10 +215,10 @@ TEST_F(ComputeGlobalTest, Geometry) EXPECT_NEAR(rg2[4], -5.0315240817290841, 0.0000000005); EXPECT_NEAR(rg2[5], 1.1103378503822141, 0.0000000005); if (has_extra) { - auto mom1 = get_vector("mom1"); - auto mom2 = get_vector("mom2"); - auto mop1 = get_vector("mop1"); - auto mop2 = get_array("mop2"); + auto *mom1 = get_vector("mom1"); + auto *mom2 = get_vector("mom2"); + auto *mop1 = get_vector("mop1"); + auto *mop2 = get_array("mop2"); EXPECT_DOUBLE_EQ(mom1[0], 0.0054219056685341164); EXPECT_DOUBLE_EQ(mom1[1], -0.054897225112275558); EXPECT_DOUBLE_EQ(mom1[2], 0.059097392692385661); @@ -263,11 +263,11 @@ TEST_F(ComputeGlobalTest, Reduction) command("run 0 post no"); END_HIDE_OUTPUT(); - auto min = get_vector("min"); - auto max = get_vector("max"); - auto sum = get_vector("sum"); - auto ave = get_vector("ave"); - auto rep = get_vector("rep"); + auto *min = get_vector("min"); + auto *max = get_vector("max"); + auto *sum = get_vector("sum"); + auto *ave = get_vector("ave"); + auto *rep = get_vector("rep"); EXPECT_DOUBLE_EQ(get_scalar("chg"), 0.51000000000000001); @@ -318,13 +318,13 @@ TEST_F(ComputeGlobalTest, Counts) command("run 0 post no"); END_HIDE_OUTPUT(); - auto tsum = get_vector("tsum"); - auto tcnt = get_vector("tcnt"); - auto bcnt = get_vector("bcnt"); - auto bbrk = get_scalar("bcnt"); - auto acnt = get_vector("acnt"); - auto dcnt = get_vector("dcnt"); - auto icnt = get_vector("icnt"); + auto *tsum = get_vector("tsum"); + auto *tcnt = get_vector("tcnt"); + auto *bcnt = get_vector("bcnt"); + auto bbrk = get_scalar("bcnt"); + auto *acnt = get_vector("acnt"); + auto *dcnt = get_vector("dcnt"); + auto *icnt = get_vector("icnt"); EXPECT_DOUBLE_EQ(tsum[0], tcnt[0]); EXPECT_DOUBLE_EQ(tsum[1], tcnt[1]); diff --git a/unittest/commands/test_groups.cpp b/unittest/commands/test_groups.cpp index 7f0a054c40..efeb00f685 100644 --- a/unittest/commands/test_groups.cpp +++ b/unittest/commands/test_groups.cpp @@ -341,9 +341,9 @@ TEST_F(GroupTest, VariableFunctions) int three = group->find("three"); int four = group->find("four"); - auto right = domain->get_region_by_id("right"); - auto left = domain->get_region_by_id("left"); - auto top = domain->get_region_by_id("top"); + auto *right = domain->get_region_by_id("right"); + auto *left = domain->get_region_by_id("left"); + auto *top = domain->get_region_by_id("top"); EXPECT_EQ(group->count_all(), 64); EXPECT_EQ(group->count(one), 16); diff --git a/unittest/commands/test_labelmap.cpp b/unittest/commands/test_labelmap.cpp index ebdab08ad3..f570facbe8 100644 --- a/unittest/commands/test_labelmap.cpp +++ b/unittest/commands/test_labelmap.cpp @@ -106,7 +106,7 @@ TEST_F(LabelMapTest, Atoms) EXPECT_EQ(utils::expand_type(FLERR, "**", Atom::ATOM, lmp), nullptr); EXPECT_EQ(utils::expand_type(FLERR, "1*2*", Atom::ATOM, lmp), nullptr); - auto expanded = utils::expand_type(FLERR, "C1", Atom::ATOM, lmp); + auto *expanded = utils::expand_type(FLERR, "C1", Atom::ATOM, lmp); EXPECT_THAT(expanded, StrEq("1")); delete[] expanded; expanded = utils::expand_type(FLERR, "O#", Atom::ATOM, lmp); @@ -268,7 +268,7 @@ TEST_F(LabelMapTest, Topology) EXPECT_EQ(atom->lmap->find("N2'-C1\"-N2'", Atom::BOND), -1); platform::unlink("labelmap_topology.inc"); - auto expanded = utils::expand_type(FLERR, "N2'", Atom::ATOM, lmp); + auto *expanded = utils::expand_type(FLERR, "N2'", Atom::ATOM, lmp); EXPECT_THAT(expanded, StrEq("2")); delete[] expanded; expanded = utils::expand_type(FLERR, "[C1][C1]", Atom::BOND, lmp); diff --git a/unittest/commands/test_lattice_region.cpp b/unittest/commands/test_lattice_region.cpp index 6eac1f45df..a76ec3ca1a 100644 --- a/unittest/commands/test_lattice_region.cpp +++ b/unittest/commands/test_lattice_region.cpp @@ -54,7 +54,7 @@ TEST_F(LatticeRegionTest, lattice_none) BEGIN_HIDE_OUTPUT(); command("lattice none 2.0"); END_HIDE_OUTPUT(); - auto lattice = lmp->domain->lattice; + auto *lattice = lmp->domain->lattice; ASSERT_EQ(lattice->style, Lattice::NONE); ASSERT_EQ(lattice->xlattice, 2.0); ASSERT_EQ(lattice->ylattice, 2.0); @@ -84,7 +84,7 @@ TEST_F(LatticeRegionTest, lattice_sc) auto output = END_CAPTURE_OUTPUT(); ASSERT_THAT(output, ContainsRegex(".*Lattice spacing in x,y,z = 1.5.* 2.* 3.*")); - auto lattice = lmp->domain->lattice; + auto *lattice = lmp->domain->lattice; ASSERT_EQ(lattice->xlattice, 1.5); ASSERT_EQ(lattice->ylattice, 2.0); ASSERT_EQ(lattice->zlattice, 3.0); @@ -152,7 +152,7 @@ TEST_F(LatticeRegionTest, lattice_bcc) BEGIN_HIDE_OUTPUT(); command("lattice bcc 4.2 orient x 1 1 0 orient y -1 1 0"); END_HIDE_OUTPUT(); - auto lattice = lmp->domain->lattice; + auto *lattice = lmp->domain->lattice; ASSERT_EQ(lattice->style, Lattice::BCC); ASSERT_DOUBLE_EQ(lattice->xlattice, sqrt(2.0) * 4.2); ASSERT_DOUBLE_EQ(lattice->ylattice, sqrt(2.0) * 4.2); @@ -177,7 +177,7 @@ TEST_F(LatticeRegionTest, lattice_fcc) BEGIN_HIDE_OUTPUT(); command("lattice fcc 3.5 origin 0.5 0.5 0.5"); END_HIDE_OUTPUT(); - auto lattice = lmp->domain->lattice; + auto *lattice = lmp->domain->lattice; ASSERT_EQ(lattice->style, Lattice::FCC); ASSERT_DOUBLE_EQ(lattice->xlattice, 3.5); ASSERT_DOUBLE_EQ(lattice->ylattice, 3.5); @@ -215,7 +215,7 @@ TEST_F(LatticeRegionTest, lattice_hcp) BEGIN_HIDE_OUTPUT(); command("lattice hcp 3.0 orient z 0 0 1"); END_HIDE_OUTPUT(); - auto lattice = lmp->domain->lattice; + auto *lattice = lmp->domain->lattice; ASSERT_EQ(lattice->style, Lattice::HCP); ASSERT_DOUBLE_EQ(lattice->xlattice, 3.0); ASSERT_DOUBLE_EQ(lattice->ylattice, 3.0 * sqrt(3.0)); @@ -259,7 +259,7 @@ TEST_F(LatticeRegionTest, lattice_diamond) BEGIN_HIDE_OUTPUT(); command("lattice diamond 4.1 orient x 1 1 2 orient y -1 1 0 orient z -1 -1 1"); END_HIDE_OUTPUT(); - auto lattice = lmp->domain->lattice; + auto *lattice = lmp->domain->lattice; ASSERT_EQ(lattice->style, Lattice::DIAMOND); ASSERT_DOUBLE_EQ(lattice->xlattice, 6.6952719636073539); ASSERT_DOUBLE_EQ(lattice->ylattice, 5.7982756057296889); @@ -312,7 +312,7 @@ TEST_F(LatticeRegionTest, lattice_sq) command("dimension 2"); command("lattice sq 3.0"); END_HIDE_OUTPUT(); - auto lattice = lmp->domain->lattice; + auto *lattice = lmp->domain->lattice; ASSERT_EQ(lattice->style, Lattice::SQ); ASSERT_DOUBLE_EQ(lattice->xlattice, 3.0); ASSERT_DOUBLE_EQ(lattice->ylattice, 3.0); @@ -338,7 +338,7 @@ TEST_F(LatticeRegionTest, lattice_sq2) command("dimension 2"); command("lattice sq2 2.0"); END_HIDE_OUTPUT(); - auto lattice = lmp->domain->lattice; + auto *lattice = lmp->domain->lattice; ASSERT_EQ(lattice->style, Lattice::SQ2); ASSERT_DOUBLE_EQ(lattice->xlattice, 2.0); ASSERT_DOUBLE_EQ(lattice->ylattice, 2.0); @@ -364,7 +364,7 @@ TEST_F(LatticeRegionTest, lattice_hex) command("dimension 2"); command("lattice hex 2.0"); END_HIDE_OUTPUT(); - auto lattice = lmp->domain->lattice; + auto *lattice = lmp->domain->lattice; ASSERT_EQ(lattice->style, Lattice::HEX); ASSERT_DOUBLE_EQ(lattice->xlattice, 2.0); ASSERT_DOUBLE_EQ(lattice->ylattice, 3.4641016151377544); @@ -414,7 +414,7 @@ TEST_F(LatticeRegionTest, lattice_custom) "basis $t 0.0 0.125 " "basis $f 0.5 0.125 "); END_HIDE_OUTPUT(); - auto lattice = lmp->domain->lattice; + auto *lattice = lmp->domain->lattice; ASSERT_EQ(lattice->style, Lattice::CUSTOM); ASSERT_DOUBLE_EQ(lattice->xlattice, 4.34); ASSERT_DOUBLE_EQ(lattice->ylattice, 4.34 * sqrt(3.0)); @@ -499,7 +499,7 @@ TEST_F(LatticeRegionTest, region_block_lattice) END_HIDE_OUTPUT(); ASSERT_EQ(lmp->domain->triclinic, 0); - auto x = lmp->atom->x; + auto *x = lmp->atom->x; ASSERT_EQ(lmp->atom->natoms, 8); ASSERT_DOUBLE_EQ(x[0][0], 0.0); ASSERT_DOUBLE_EQ(x[0][1], 0.0); @@ -525,7 +525,7 @@ TEST_F(LatticeRegionTest, region_block_box) END_HIDE_OUTPUT(); ASSERT_EQ(lmp->domain->triclinic, 0); - auto x = lmp->atom->x; + auto *x = lmp->atom->x; ASSERT_EQ(lmp->atom->natoms, 1); ASSERT_DOUBLE_EQ(x[0][0], 1.125); ASSERT_DOUBLE_EQ(x[0][1], 1.125); diff --git a/unittest/commands/test_regions.cpp b/unittest/commands/test_regions.cpp index 370799afea..e74637e17c 100644 --- a/unittest/commands/test_regions.cpp +++ b/unittest/commands/test_regions.cpp @@ -80,7 +80,7 @@ TEST_F(RegionTest, NoBox) list = domain->get_region_list(); EXPECT_EQ(list.size(), 9); - auto reg = domain->get_region_by_id("reg1"); + auto *reg = domain->get_region_by_id("reg1"); EXPECT_EQ(reg->interior, 1); EXPECT_EQ(reg->scaleflag, 1); EXPECT_EQ(reg->bboxflag, 1); @@ -231,17 +231,17 @@ TEST_F(RegionTest, Counts) command("region reg10 prism 0 5 0 5 -5 5 0.0 0.0 0.0"); // same as block END_HIDE_OUTPUT(); - auto x = atom->x; - auto reg1 = domain->get_region_by_id("reg1"); - auto reg2 = domain->get_region_by_id("reg2"); - auto reg3 = domain->get_region_by_id("reg3"); - auto reg4 = domain->get_region_by_id("reg4"); - auto reg5 = domain->get_region_by_id("reg5"); - auto reg6 = domain->get_region_by_id("reg6"); - auto reg7 = domain->get_region_by_id("reg7"); - auto reg8 = domain->get_region_by_id("reg8"); - auto reg9 = domain->get_region_by_id("reg9"); - auto reg10 = domain->get_region_by_id("reg10"); + auto *x = atom->x; + auto *reg1 = domain->get_region_by_id("reg1"); + auto *reg2 = domain->get_region_by_id("reg2"); + auto *reg3 = domain->get_region_by_id("reg3"); + auto *reg4 = domain->get_region_by_id("reg4"); + auto *reg5 = domain->get_region_by_id("reg5"); + auto *reg6 = domain->get_region_by_id("reg6"); + auto *reg7 = domain->get_region_by_id("reg7"); + auto *reg8 = domain->get_region_by_id("reg8"); + auto *reg9 = domain->get_region_by_id("reg9"); + auto *reg10 = domain->get_region_by_id("reg10"); int count1, count2, count3, count4, count5, count6, count7, count8, count9, count10; count1 = count2 = count3 = count4 = count5 = count6 = count7 = count8 = count9 = count10 = 0; reg1->prematch(); diff --git a/unittest/commands/test_reset_atoms.cpp b/unittest/commands/test_reset_atoms.cpp index d09a60c886..9054333332 100644 --- a/unittest/commands/test_reset_atoms.cpp +++ b/unittest/commands/test_reset_atoms.cpp @@ -56,7 +56,7 @@ TEST_F(ResetAtomsIDTest, MolIDAll) { if (lmp->atom->natoms == 0) GTEST_SKIP(); - auto molid = lmp->atom->molecule; + auto *molid = lmp->atom->molecule; ASSERT_EQ(molid[GETIDX(1)], 1); ASSERT_EQ(molid[GETIDX(2)], 1); ASSERT_EQ(molid[GETIDX(3)], 1); @@ -128,7 +128,7 @@ TEST_F(ResetAtomsIDTest, DeletePlusAtomID) { if (lmp->atom->natoms == 0) GTEST_SKIP(); - auto molid = lmp->atom->molecule; + auto *molid = lmp->atom->molecule; // delete two water molecules BEGIN_HIDE_OUTPUT(); @@ -206,7 +206,7 @@ TEST_F(ResetAtomsIDTest, PartialOffset) { if (lmp->atom->natoms == 0) GTEST_SKIP(); - auto molid = lmp->atom->molecule; + auto *molid = lmp->atom->molecule; // delete two water molecules BEGIN_HIDE_OUTPUT(); @@ -286,7 +286,7 @@ TEST_F(ResetAtomsIDTest, DeleteAdd) { if (lmp->atom->natoms == 0) GTEST_SKIP(); - auto molid = lmp->atom->molecule; + auto *molid = lmp->atom->molecule; // delete two water molecules BEGIN_HIDE_OUTPUT(); @@ -445,12 +445,12 @@ TEST_F(ResetAtomsIDTest, TopologyData) ASSERT_EQ(lmp->atom->natoms, 23); ASSERT_EQ(lmp->atom->map_tag_max, 26); - auto num_bond = lmp->atom->num_bond; - auto num_angle = lmp->atom->num_angle; - auto bond_atom = lmp->atom->bond_atom; - auto angle_atom1 = lmp->atom->angle_atom1; - auto angle_atom2 = lmp->atom->angle_atom2; - auto angle_atom3 = lmp->atom->angle_atom3; + auto *num_bond = lmp->atom->num_bond; + auto *num_angle = lmp->atom->num_angle; + auto *bond_atom = lmp->atom->bond_atom; + auto *angle_atom1 = lmp->atom->angle_atom1; + auto *angle_atom2 = lmp->atom->angle_atom2; + auto *angle_atom3 = lmp->atom->angle_atom3; ASSERT_EQ(num_bond[GETIDX(1)], 2); ASSERT_EQ(bond_atom[GETIDX(1)][0], 2); ASSERT_EQ(bond_atom[GETIDX(1)][1], 3); diff --git a/unittest/commands/test_set_property.cpp b/unittest/commands/test_set_property.cpp index 36b86b3526..c306ea4739 100644 --- a/unittest/commands/test_set_property.cpp +++ b/unittest/commands/test_set_property.cpp @@ -85,7 +85,7 @@ TEST_F(SetTest, NoBoxNoAtoms) command("create_atoms 1 single 0.5 0.5 0.5"); command("compute 0 all property/atom proc"); END_HIDE_OUTPUT(); - auto compute = lmp->modify->get_compute_by_id("0"); + auto *compute = lmp->modify->get_compute_by_id("0"); compute->compute_peratom(); ASSERT_EQ(compute->vector_atom[0], 0); @@ -119,7 +119,7 @@ TEST_F(SetTest, StylesTypes) command("compute 1 all property/atom id type mol"); END_HIDE_OUTPUT(); - auto compute = lmp->modify->get_compute_by_id("1"); + auto *compute = lmp->modify->get_compute_by_id("1"); ASSERT_NE(compute, nullptr); compute->compute_peratom(); @@ -409,7 +409,7 @@ TEST_F(SetTest, EffPackage) command("compute 2 all property/atom espin eradius"); END_HIDE_OUTPUT(); - auto compute = lmp->modify->get_compute_by_id("2"); + auto *compute = lmp->modify->get_compute_by_id("2"); ASSERT_NE(compute, nullptr); compute->compute_peratom(); diff --git a/unittest/commands/test_variables.cpp b/unittest/commands/test_variables.cpp index 1826263dea..8f2f4ba9d9 100644 --- a/unittest/commands/test_variables.cpp +++ b/unittest/commands/test_variables.cpp @@ -389,8 +389,9 @@ TEST_F(VariableTest, Expressions) command("print \"${err2}\"");); TEST_FAILURE(".*ERROR on proc 0: Variable err3: Invalid power expression in variable formula.*", command("print \"${err3}\"");); - TEST_FAILURE(".*ERROR: Variable one: Mis-matched special function variable in variable formula.*", - command("print \"${isrt}\"");); + TEST_FAILURE( + ".*ERROR: Variable one: Mis-matched special function variable in variable formula.*", + command("print \"${isrt}\"");); TEST_FAILURE(".*ERROR: Variable vec4: index 11 exceeds vector size of 10.*", command("print \"${xxxl}\"");); } diff --git a/unittest/cplusplus/test_input_class.cpp b/unittest/cplusplus/test_input_class.cpp index 708d3f7cae..4061c0071c 100644 --- a/unittest/cplusplus/test_input_class.cpp +++ b/unittest/cplusplus/test_input_class.cpp @@ -22,9 +22,9 @@ protected: LAMMPS *lmp; Input_commands() { - const char * args[] = {"LAMMPS_test", nullptr}; - char ** argv = (char**)args; - int argc = 1; + const char *args[] = {"LAMMPS_test", nullptr}; + char **argv = (char **)args; + int argc = 1; int flag; MPI_Initialized(&flag); diff --git a/unittest/cplusplus/test_lammps_class.cpp b/unittest/cplusplus/test_lammps_class.cpp index 6f279fc96c..23d83c4ecb 100644 --- a/unittest/cplusplus/test_lammps_class.cpp +++ b/unittest/cplusplus/test_lammps_class.cpp @@ -21,9 +21,9 @@ protected: LAMMPS *lmp; LAMMPS_plain() : lmp(nullptr) { - const char * args[] = {"LAMMPS_test", nullptr}; - char ** argv = (char**)args; - int argc = 1; + const char *args[] = {"LAMMPS_test", nullptr}; + char **argv = (char **)args; + int argc = 1; int flag; MPI_Initialized(&flag); @@ -37,7 +37,7 @@ protected: LAMMPS::argv args = {"LAMMPS_test", "-log", "none", "-echo", "both", "-nocite"}; ::testing::internal::CaptureStdout(); - lmp = new LAMMPS(args, MPI_COMM_WORLD); + lmp = new LAMMPS(args, MPI_COMM_WORLD); std::string output = ::testing::internal::GetCapturedStdout(); EXPECT_THAT(output, StartsWith("LAMMPS (")); } @@ -157,9 +157,9 @@ protected: LAMMPS *lmp; LAMMPS_omp() : lmp(nullptr) { - const char * args[] = {"LAMMPS_test", nullptr}; - char ** argv = (char**)args; - int argc = 1; + const char *args[] = {"LAMMPS_test", nullptr}; + char **argv = (char **)args; + int argc = 1; int flag; MPI_Initialized(&flag); @@ -238,9 +238,9 @@ protected: LAMMPS *lmp; LAMMPS_kokkos() : lmp(nullptr) { - const char * args[] = {"LAMMPS_test", nullptr}; - char ** argv = (char**)args; - int argc = 1; + const char *args[] = {"LAMMPS_test", nullptr}; + char **argv = (char **)args; + int argc = 1; int flag; MPI_Initialized(&flag); @@ -330,7 +330,7 @@ TEST(LAMMPS_init, OpenMP) LAMMPS::argv args = {"LAMMPS_init", "-in", "in.lammps_empty", "-log", "none", "-nocite"}; ::testing::internal::CaptureStdout(); - LAMMPS *lmp = new LAMMPS(args, MPI_COMM_WORLD); + auto *lmp = new LAMMPS(args, MPI_COMM_WORLD); std::string output = ::testing::internal::GetCapturedStdout(); EXPECT_THAT(output, ContainsRegex(".*using 2 OpenMP thread.*per MPI task.*")); @@ -361,7 +361,7 @@ TEST(LAMMPS_init, NoOpenMP) LAMMPS::argv args = {"LAMMPS_init", "-in", "in.lammps_class_noomp", "-log", "none", "-nocite"}; ::testing::internal::CaptureStdout(); - LAMMPS *lmp = new LAMMPS(args, MPI_COMM_WORLD); + auto *lmp = new LAMMPS(args, MPI_COMM_WORLD); std::string output = ::testing::internal::GetCapturedStdout(); EXPECT_THAT(output, ContainsRegex( ".*OMP_NUM_THREADS environment is not set.*Defaulting to 1 thread.*")); diff --git a/unittest/force-styles/test_angle_style.cpp b/unittest/force-styles/test_angle_style.cpp index 6e823b32fc..bbacdd8f24 100644 --- a/unittest/force-styles/test_angle_style.cpp +++ b/unittest/force-styles/test_angle_style.cpp @@ -70,7 +70,7 @@ LAMMPS *init_lammps(LAMMPS::argv &args, const TestConfig &cfg, const bool newton // check if prerequisite styles are available Info *info = new Info(lmp); int nfail = 0; - for (auto &prerequisite : cfg.prerequisites) { + for (const auto &prerequisite : cfg.prerequisites) { std::string style = prerequisite.second; // this is a test for angle styles, so if the suffixed @@ -120,7 +120,7 @@ LAMMPS *init_lammps(LAMMPS::argv &args, const TestConfig &cfg, const bool newton command("variable input_dir index " + INPUT_FOLDER); - for (auto &pre_command : cfg.pre_commands) { + for (const auto &pre_command : cfg.pre_commands) { command(pre_command); } @@ -129,11 +129,11 @@ LAMMPS *init_lammps(LAMMPS::argv &args, const TestConfig &cfg, const bool newton command("angle_style " + cfg.angle_style); - for (auto &angle_coeff : cfg.angle_coeff) { + for (const auto &angle_coeff : cfg.angle_coeff) { command("angle_coeff " + angle_coeff); } - for (auto &post_command : cfg.post_commands) { + for (const auto &post_command : cfg.post_commands) { command(post_command); } @@ -176,12 +176,12 @@ void restart_lammps(LAMMPS *lmp, const TestConfig &cfg) } if ((cfg.angle_style.substr(0, 6) == "hybrid") || !lmp->force->angle->writedata) { - for (auto &angle_coeff : cfg.angle_coeff) { + for (const auto &angle_coeff : cfg.angle_coeff) { command("angle_coeff " + angle_coeff); } } - for (auto &post_command : cfg.post_commands) { + for (const auto &post_command : cfg.post_commands) { command(post_command); } @@ -204,7 +204,7 @@ void data_lammps(LAMMPS *lmp, const TestConfig &cfg) command("variable newton_bond delete"); command("variable newton_bond index on"); - for (auto &pre_command : cfg.pre_commands) { + for (const auto &pre_command : cfg.pre_commands) { command(pre_command); } @@ -214,10 +214,10 @@ void data_lammps(LAMMPS *lmp, const TestConfig &cfg) std::string input_file = platform::path_join(INPUT_FOLDER, cfg.input_file); parse_input_script(input_file); - for (auto &angle_coeff : cfg.angle_coeff) { + for (const auto &angle_coeff : cfg.angle_coeff) { command("angle_coeff " + angle_coeff); } - for (auto &post_command : cfg.post_commands) { + for (const auto &post_command : cfg.post_commands) { command(post_command); } command("run 0 post no"); @@ -234,7 +234,7 @@ void generate_yaml_file(const char *outfile, const TestConfig &config) if (!lmp) { std::cerr << "One or more prerequisite styles are not available " "in this LAMMPS configuration:\n"; - for (auto &prerequisite : config.prerequisites) { + for (const auto &prerequisite : config.prerequisites) { std::cerr << prerequisite.first << "_style " << prerequisite.second << "\n"; } return; @@ -253,7 +253,7 @@ void generate_yaml_file(const char *outfile, const TestConfig &config) // angle_coeff block.clear(); - for (auto &angle_coeff : config.angle_coeff) { + for (const auto &angle_coeff : config.angle_coeff) { block += angle_coeff + "\n"; } writer.emit_block("angle_coeff", block); @@ -277,14 +277,14 @@ void generate_yaml_file(const char *outfile, const TestConfig &config) writer.emit("init_energy", lmp->force->angle->energy); // init_stress - auto stress = lmp->force->angle->virial; + auto *stress = lmp->force->angle->virial; block = fmt::format("{:23.16e} {:23.16e} {:23.16e} {:23.16e} {:23.16e} {:23.16e}", stress[0], stress[1], stress[2], stress[3], stress[4], stress[5]); writer.emit_block("init_stress", block); // init_forces block.clear(); - auto f = lmp->atom->f; + auto *f = lmp->atom->f; for (int i = 1; i <= natoms; ++i) { const int j = lmp->atom->map(i); block += fmt::format("{:3} {:23.16e} {:23.16e} {:23.16e}\n", i, f[j][0], f[j][1], f[j][2]); @@ -345,7 +345,7 @@ TEST(AngleStyle, plain) double epsilon = test_config.epsilon; ErrorStats stats; - auto angle = lmp->force->angle; + auto *angle = lmp->force->angle; EXPECT_FORCES("init_forces (newton on)", lmp->atom, test_config.init_forces, epsilon); EXPECT_STRESS("init_stress (newton on)", angle->virial, test_config.init_stress, epsilon); @@ -463,7 +463,7 @@ TEST(AngleStyle, omp) double epsilon = 5.0 * test_config.epsilon; ErrorStats stats; - auto angle = lmp->force->angle; + auto *angle = lmp->force->angle; EXPECT_FORCES("init_forces (newton on)", lmp->atom, test_config.init_forces, epsilon); EXPECT_STRESS("init_stress (newton on)", angle->virial, test_config.init_stress, 10 * epsilon); @@ -746,9 +746,9 @@ TEST(AngleStyle, extract) GTEST_SKIP(); } - auto angle = lmp->force->angle; - void *ptr = nullptr; - int dim = 0; + auto *angle = lmp->force->angle; + void *ptr = nullptr; + int dim = 0; for (auto extract : test_config.extract) { ptr = angle->extract(extract.first.c_str(), dim); EXPECT_NE(ptr, nullptr); diff --git a/unittest/force-styles/test_bond_style.cpp b/unittest/force-styles/test_bond_style.cpp index eb6b0b488d..d2523ff51d 100644 --- a/unittest/force-styles/test_bond_style.cpp +++ b/unittest/force-styles/test_bond_style.cpp @@ -70,7 +70,7 @@ LAMMPS *init_lammps(LAMMPS::argv &args, const TestConfig &cfg, const bool newton // check if prerequisite styles are available Info *info = new Info(lmp); int nfail = 0; - for (auto &prerequisite : cfg.prerequisites) { + for (const auto &prerequisite : cfg.prerequisites) { std::string style = prerequisite.second; // this is a test for bond styles, so if the suffixed @@ -120,7 +120,7 @@ LAMMPS *init_lammps(LAMMPS::argv &args, const TestConfig &cfg, const bool newton command("variable input_dir index " + INPUT_FOLDER); - for (auto &pre_command : cfg.pre_commands) { + for (const auto &pre_command : cfg.pre_commands) { command(pre_command); } @@ -129,11 +129,11 @@ LAMMPS *init_lammps(LAMMPS::argv &args, const TestConfig &cfg, const bool newton command("bond_style " + cfg.bond_style); - for (auto &bond_coeff : cfg.bond_coeff) { + for (const auto &bond_coeff : cfg.bond_coeff) { command("bond_coeff " + bond_coeff); } - for (auto &post_command : cfg.post_commands) { + for (const auto &post_command : cfg.post_commands) { command(post_command); } @@ -176,12 +176,12 @@ void restart_lammps(LAMMPS *lmp, const TestConfig &cfg) } if ((cfg.bond_style.substr(0, 6) == "hybrid") || !lmp->force->bond->writedata) { - for (auto &bond_coeff : cfg.bond_coeff) { + for (const auto &bond_coeff : cfg.bond_coeff) { command("bond_coeff " + bond_coeff); } } - for (auto &post_command : cfg.post_commands) { + for (const auto &post_command : cfg.post_commands) { command(post_command); } @@ -204,7 +204,7 @@ void data_lammps(LAMMPS *lmp, const TestConfig &cfg) command("variable newton_bond delete"); command("variable newton_bond index on"); - for (auto &pre_command : cfg.pre_commands) { + for (const auto &pre_command : cfg.pre_commands) { command(pre_command); } @@ -214,10 +214,10 @@ void data_lammps(LAMMPS *lmp, const TestConfig &cfg) std::string input_file = platform::path_join(INPUT_FOLDER, cfg.input_file); parse_input_script(input_file); - for (auto &bond_coeff : cfg.bond_coeff) { + for (const auto &bond_coeff : cfg.bond_coeff) { command("bond_coeff " + bond_coeff); } - for (auto &post_command : cfg.post_commands) { + for (const auto &post_command : cfg.post_commands) { command(post_command); } command("run 0 post no"); @@ -234,7 +234,7 @@ void generate_yaml_file(const char *outfile, const TestConfig &config) if (!lmp) { std::cerr << "One or more prerequisite styles are not available " "in this LAMMPS configuration:\n"; - for (auto &prerequisite : config.prerequisites) { + for (const auto &prerequisite : config.prerequisites) { std::cerr << prerequisite.first << "_style " << prerequisite.second << "\n"; } return; @@ -253,7 +253,7 @@ void generate_yaml_file(const char *outfile, const TestConfig &config) // bond_coeff block.clear(); - for (auto &bond_coeff : config.bond_coeff) { + for (const auto &bond_coeff : config.bond_coeff) { block += bond_coeff + "\n"; } writer.emit_block("bond_coeff", block); @@ -277,14 +277,14 @@ void generate_yaml_file(const char *outfile, const TestConfig &config) writer.emit("init_energy", lmp->force->bond->energy); // init_stress - auto stress = lmp->force->bond->virial; + auto *stress = lmp->force->bond->virial; block = fmt::format("{:23.16e} {:23.16e} {:23.16e} {:23.16e} {:23.16e} {:23.16e}", stress[0], stress[1], stress[2], stress[3], stress[4], stress[5]); writer.emit_block("init_stress", block); // init_forces block.clear(); - auto f = lmp->atom->f; + auto *f = lmp->atom->f; for (int i = 1; i <= natoms; ++i) { const int j = lmp->atom->map(i); block += fmt::format("{:3} {:23.16e} {:23.16e} {:23.16e}\n", i, f[j][0], f[j][1], f[j][2]); @@ -345,7 +345,7 @@ TEST(BondStyle, plain) double epsilon = test_config.epsilon; ErrorStats stats; - auto bond = lmp->force->bond; + auto *bond = lmp->force->bond; EXPECT_FORCES("init_forces (newton on)", lmp->atom, test_config.init_forces, epsilon); EXPECT_STRESS("init_stress (newton on)", bond->virial, test_config.init_stress, epsilon); @@ -465,7 +465,7 @@ TEST(BondStyle, omp) double epsilon = 5.0 * test_config.epsilon; ErrorStats stats; - auto bond = lmp->force->bond; + auto *bond = lmp->force->bond; EXPECT_FORCES("init_forces (newton on)", lmp->atom, test_config.init_forces, epsilon); EXPECT_STRESS("init_stress (newton on)", bond->virial, test_config.init_stress, 10 * epsilon); @@ -532,7 +532,6 @@ TEST(BondStyle, omp) if (!verbose) ::testing::internal::GetCapturedStdout(); }; - TEST(BondStyle, numdiff) { if (!LAMMPS::is_installed_pkg("EXTRA-FIX")) GTEST_SKIP(); @@ -652,7 +651,7 @@ TEST(BondStyle, single) command("pair_coeff * *"); command("bond_style " + test_config.bond_style); - auto bond = lmp->force->bond; + auto *bond = lmp->force->bond; for (auto &bond_coeff : test_config.bond_coeff) { command("bond_coeff " + bond_coeff); @@ -860,9 +859,9 @@ TEST(BondStyle, extract) GTEST_SKIP(); } - auto bond = lmp->force->bond; - void *ptr = nullptr; - int dim = 0; + auto *bond = lmp->force->bond; + void *ptr = nullptr; + int dim = 0; for (auto extract : test_config.extract) { ptr = bond->extract(extract.first.c_str(), dim); EXPECT_NE(ptr, nullptr); diff --git a/unittest/force-styles/test_config.h b/unittest/force-styles/test_config.h index b284052d6d..09b32f54de 100644 --- a/unittest/force-styles/test_config.h +++ b/unittest/force-styles/test_config.h @@ -96,7 +96,7 @@ public: restart_vel.clear(); global_vector.clear(); } - TestConfig(const TestConfig &) = delete; + TestConfig(const TestConfig &) = delete; TestConfig &operator=(const TestConfig &) = delete; std::string tags_line() const diff --git a/unittest/force-styles/test_config_reader.h b/unittest/force-styles/test_config_reader.h index 1af7589add..0427049bfc 100644 --- a/unittest/force-styles/test_config_reader.h +++ b/unittest/force-styles/test_config_reader.h @@ -22,8 +22,8 @@ class TestConfigReader : public YamlReader { public: TestConfigReader(TestConfig &config); - TestConfigReader() = delete; - const TestConfigReader & operator=(TestConfig &) = delete; + TestConfigReader() = delete; + const TestConfigReader &operator=(TestConfig &) = delete; void skip_tests(const yaml_event_t &event); void prerequisites(const yaml_event_t &event); diff --git a/unittest/force-styles/test_dihedral_style.cpp b/unittest/force-styles/test_dihedral_style.cpp index 060dd040c2..e6c34843c3 100644 --- a/unittest/force-styles/test_dihedral_style.cpp +++ b/unittest/force-styles/test_dihedral_style.cpp @@ -63,12 +63,12 @@ void cleanup_lammps(LAMMPS *lmp, const TestConfig &cfg) LAMMPS *init_lammps(LAMMPS::argv &args, const TestConfig &cfg, const bool newton = true) { - LAMMPS *lmp = new LAMMPS(args, MPI_COMM_WORLD); + auto *lmp = new LAMMPS(args, MPI_COMM_WORLD); // check if prerequisite styles are available Info *info = new Info(lmp); int nfail = 0; - for (auto &prerequisite : cfg.prerequisites) { + for (const auto &prerequisite : cfg.prerequisites) { std::string style = prerequisite.second; // this is a test for dihedral styles, so if the suffixed @@ -118,7 +118,7 @@ LAMMPS *init_lammps(LAMMPS::argv &args, const TestConfig &cfg, const bool newton command("variable input_dir index " + INPUT_FOLDER); - for (auto &pre_command : cfg.pre_commands) { + for (const auto &pre_command : cfg.pre_commands) { command(pre_command); } @@ -127,11 +127,11 @@ LAMMPS *init_lammps(LAMMPS::argv &args, const TestConfig &cfg, const bool newton command("dihedral_style " + cfg.dihedral_style); - for (auto &dihedral_coeff : cfg.dihedral_coeff) { + for (const auto &dihedral_coeff : cfg.dihedral_coeff) { command("dihedral_coeff " + dihedral_coeff); } - for (auto &post_command : cfg.post_commands) { + for (const auto &post_command : cfg.post_commands) { command(post_command); } @@ -174,12 +174,12 @@ void restart_lammps(LAMMPS *lmp, const TestConfig &cfg) } if ((cfg.dihedral_style.substr(0, 6) == "hybrid") || !lmp->force->dihedral->writedata) { - for (auto &dihedral_coeff : cfg.dihedral_coeff) { + for (const auto &dihedral_coeff : cfg.dihedral_coeff) { command("dihedral_coeff " + dihedral_coeff); } } - for (auto &post_command : cfg.post_commands) { + for (const auto &post_command : cfg.post_commands) { command(post_command); } @@ -202,7 +202,7 @@ void data_lammps(LAMMPS *lmp, const TestConfig &cfg) command("variable newton_bond delete"); command("variable newton_bond index on"); - for (auto &pre_command : cfg.pre_commands) { + for (const auto &pre_command : cfg.pre_commands) { command(pre_command); } @@ -221,10 +221,10 @@ void data_lammps(LAMMPS *lmp, const TestConfig &cfg) std::string input_file = platform::path_join(INPUT_FOLDER, cfg.input_file); parse_input_script(input_file); - for (auto &dihedral_coeff : cfg.dihedral_coeff) { + for (const auto &dihedral_coeff : cfg.dihedral_coeff) { command("dihedral_coeff " + dihedral_coeff); } - for (auto &post_command : cfg.post_commands) { + for (const auto &post_command : cfg.post_commands) { command(post_command); } command("run 0 post no"); @@ -241,7 +241,7 @@ void generate_yaml_file(const char *outfile, const TestConfig &config) if (!lmp) { std::cerr << "One or more prerequisite styles are not available " "in this LAMMPS configuration:\n"; - for (auto &prerequisite : config.prerequisites) { + for (const auto &prerequisite : config.prerequisites) { std::cerr << prerequisite.first << "_style " << prerequisite.second << "\n"; } return; @@ -260,7 +260,7 @@ void generate_yaml_file(const char *outfile, const TestConfig &config) // dihedral_coeff block.clear(); - for (auto &dihedral_coeff : config.dihedral_coeff) { + for (const auto &dihedral_coeff : config.dihedral_coeff) { block += dihedral_coeff + "\n"; } writer.emit_block("dihedral_coeff", block); @@ -278,14 +278,14 @@ void generate_yaml_file(const char *outfile, const TestConfig &config) writer.emit("init_energy", lmp->force->dihedral->energy); // init_stress - auto stress = lmp->force->dihedral->virial; + auto *stress = lmp->force->dihedral->virial; block = fmt::format("{:23.16e} {:23.16e} {:23.16e} {:23.16e} {:23.16e} {:23.16e}", stress[0], stress[1], stress[2], stress[3], stress[4], stress[5]); writer.emit_block("init_stress", block); // init_forces block.clear(); - auto f = lmp->atom->f; + auto *f = lmp->atom->f; for (int i = 1; i <= natoms; ++i) { const int j = lmp->atom->map(i); block += fmt::format("{:3} {:23.16e} {:23.16e} {:23.16e}\n", i, f[j][0], f[j][1], f[j][2]); @@ -346,7 +346,7 @@ TEST(DihedralStyle, plain) double epsilon = test_config.epsilon; ErrorStats stats; - auto dihedral = lmp->force->dihedral; + auto *dihedral = lmp->force->dihedral; EXPECT_FORCES("init_forces (newton on)", lmp->atom, test_config.init_forces, epsilon); EXPECT_STRESS("init_stress (newton on)", dihedral->virial, test_config.init_stress, epsilon); @@ -466,7 +466,7 @@ TEST(DihedralStyle, omp) double epsilon = 5.0 * test_config.epsilon; ErrorStats stats; - auto dihedral = lmp->force->dihedral; + auto *dihedral = lmp->force->dihedral; EXPECT_FORCES("init_forces (newton on)", lmp->atom, test_config.init_forces, epsilon); EXPECT_STRESS("init_stress (newton on)", dihedral->virial, test_config.init_stress, @@ -534,7 +534,6 @@ TEST(DihedralStyle, omp) if (!verbose) ::testing::internal::GetCapturedStdout(); }; - TEST(DihedralStyle, numdiff) { if (!LAMMPS::is_installed_pkg("EXTRA-FIX")) GTEST_SKIP(); diff --git a/unittest/force-styles/test_fix_timestep.cpp b/unittest/force-styles/test_fix_timestep.cpp index 64c56f3602..ae1029a3d1 100644 --- a/unittest/force-styles/test_fix_timestep.cpp +++ b/unittest/force-styles/test_fix_timestep.cpp @@ -71,7 +71,7 @@ LAMMPS *init_lammps(LAMMPS::argv &args, const TestConfig &cfg, const bool use_re // check if prerequisite styles are available Info *info = new Info(lmp); int nfail = 0; - for (auto &prerequisite : cfg.prerequisites) { + for (const auto &prerequisite : cfg.prerequisites) { std::string style = prerequisite.second; // this is a test for fix styles, so if the suffixed @@ -97,7 +97,7 @@ LAMMPS *init_lammps(LAMMPS::argv &args, const TestConfig &cfg, const bool use_re }; command("variable input_dir index " + INPUT_FOLDER); - for (auto &pre_command : cfg.pre_commands) + for (const auto &pre_command : cfg.pre_commands) command(pre_command); std::string input_file = platform::path_join(INPUT_FOLDER, cfg.input_file); @@ -128,7 +128,7 @@ LAMMPS *init_lammps(LAMMPS::argv &args, const TestConfig &cfg, const bool use_re command("group solute molecule 1:2"); command("group solvent molecule 3:5"); - for (auto &post_command : cfg.post_commands) + for (const auto &post_command : cfg.post_commands) command(post_command); command("timestep 0.25"); @@ -158,10 +158,10 @@ void restart_lammps(LAMMPS *lmp, const TestConfig &cfg, bool use_rmass, bool use if (use_respa) command("run_style respa 2 1 bond 1 pair 2"); - for (auto &post_command : cfg.post_commands) + for (const auto &post_command : cfg.post_commands) command(post_command); - auto ifix = lmp->modify->get_fix_by_id("test"); + auto *ifix = lmp->modify->get_fix_by_id("test"); if (ifix && !utils::strmatch(ifix->style, "^move")) { // must be set to trigger calling Fix::reset_dt() with timestep lmp->update->first_update = 1; @@ -198,16 +198,16 @@ void generate_yaml_file(const char *outfile, const TestConfig &config) // natoms writer.emit("natoms", natoms); - auto ifix = lmp->modify->get_fix_by_id("test"); + auto *ifix = lmp->modify->get_fix_by_id("test"); if (!ifix) { std::cerr << "ERROR: no fix defined with fix ID 'test'\n"; exit(1); } else { // run_stress, if enabled if (ifix->thermo_virial) { - auto stress = ifix->virial; - block = fmt::format("{:23.16e} {:23.16e} {:23.16e} {:23.16e} {:23.16e} {:23.16e}", - stress[0], stress[1], stress[2], stress[3], stress[4], stress[5]); + auto *stress = ifix->virial; + block = fmt::format("{:23.16e} {:23.16e} {:23.16e} {:23.16e} {:23.16e} {:23.16e}", + stress[0], stress[1], stress[2], stress[3], stress[4], stress[5]); writer.emit_block("run_stress", block); } @@ -229,7 +229,7 @@ void generate_yaml_file(const char *outfile, const TestConfig &config) // run_pos block.clear(); - auto x = lmp->atom->x; + auto *x = lmp->atom->x; for (int i = 1; i <= natoms; ++i) { const int j = lmp->atom->map(i); block += fmt::format("{:3} {:23.16e} {:23.16e} {:23.16e}\n", i, x[j][0], x[j][1], x[j][2]); @@ -238,7 +238,7 @@ void generate_yaml_file(const char *outfile, const TestConfig &config) // run_vel block.clear(); - auto v = lmp->atom->v; + auto *v = lmp->atom->v; for (int i = 1; i <= natoms; ++i) { const int j = lmp->atom->map(i); block += fmt::format("{:3} {:23.16e} {:23.16e} {:23.16e}\n", i, v[j][0], v[j][1], v[j][2]); @@ -289,7 +289,7 @@ TEST(FixTimestep, plain) EXPECT_POSITIONS("run_pos (normal run, verlet)", lmp->atom, test_config.run_pos, epsilon); EXPECT_VELOCITIES("run_vel (normal run, verlet)", lmp->atom, test_config.run_vel, epsilon); - auto ifix = lmp->modify->get_fix_by_id("test"); + auto *ifix = lmp->modify->get_fix_by_id("test"); if (!ifix) { FAIL() << "ERROR: no fix defined with fix ID 'test'\n"; } else { @@ -317,8 +317,8 @@ TEST(FixTimestep, plain) // check t_target for thermostats - int dim = -1; - double *ptr = (double *)ifix->extract("t_target", dim); + int dim = -1; + auto *ptr = (double *)ifix->extract("t_target", dim); if ((ptr != nullptr) && (dim == 0)) { int ivar = lmp->input->variable->find("t_target"); if (ivar >= 0) { @@ -583,7 +583,7 @@ TEST(FixTimestep, omp) EXPECT_POSITIONS("run_pos (normal run, verlet)", lmp->atom, test_config.run_pos, epsilon); EXPECT_VELOCITIES("run_vel (normal run, verlet)", lmp->atom, test_config.run_vel, epsilon); - auto ifix = lmp->modify->get_fix_by_id("test"); + auto *ifix = lmp->modify->get_fix_by_id("test"); if (!ifix) { FAIL() << "ERROR: no fix defined with fix ID 'test'\n"; } else { @@ -611,8 +611,8 @@ TEST(FixTimestep, omp) // check t_target for thermostats - int dim = -1; - double *ptr = (double *)ifix->extract("t_target", dim); + int dim = -1; + auto *ptr = (double *)ifix->extract("t_target", dim); if ((ptr != nullptr) && (dim == 0)) { int ivar = lmp->input->variable->find("t_target"); if (ivar >= 0) { diff --git a/unittest/force-styles/test_improper_style.cpp b/unittest/force-styles/test_improper_style.cpp index c90d30c21a..59028fb1ff 100644 --- a/unittest/force-styles/test_improper_style.cpp +++ b/unittest/force-styles/test_improper_style.cpp @@ -70,7 +70,7 @@ LAMMPS *init_lammps(LAMMPS::argv &args, const TestConfig &cfg, const bool newton // check if prerequisite styles are available Info *info = new Info(lmp); int nfail = 0; - for (auto &prerequisite : cfg.prerequisites) { + for (const auto &prerequisite : cfg.prerequisites) { std::string style = prerequisite.second; // this is a test for improper styles, so if the suffixed @@ -120,7 +120,7 @@ LAMMPS *init_lammps(LAMMPS::argv &args, const TestConfig &cfg, const bool newton command("variable input_dir index " + INPUT_FOLDER); - for (auto &pre_command : cfg.pre_commands) { + for (const auto &pre_command : cfg.pre_commands) { command(pre_command); } @@ -129,11 +129,11 @@ LAMMPS *init_lammps(LAMMPS::argv &args, const TestConfig &cfg, const bool newton command("improper_style " + cfg.improper_style); - for (auto &improper_coeff : cfg.improper_coeff) { + for (const auto &improper_coeff : cfg.improper_coeff) { command("improper_coeff " + improper_coeff); } - for (auto &post_command : cfg.post_commands) { + for (const auto &post_command : cfg.post_commands) { command(post_command); } @@ -176,12 +176,12 @@ void restart_lammps(LAMMPS *lmp, const TestConfig &cfg) } if ((cfg.improper_style.substr(0, 6) == "hybrid") || !lmp->force->improper->writedata) { - for (auto &improper_coeff : cfg.improper_coeff) { + for (const auto &improper_coeff : cfg.improper_coeff) { command("improper_coeff " + improper_coeff); } } - for (auto &post_command : cfg.post_commands) { + for (const auto &post_command : cfg.post_commands) { command(post_command); } @@ -204,7 +204,7 @@ void data_lammps(LAMMPS *lmp, const TestConfig &cfg) command("variable newton_bond delete"); command("variable newton_bond index on"); - for (auto &pre_command : cfg.pre_commands) { + for (const auto &pre_command : cfg.pre_commands) { command(pre_command); } @@ -214,10 +214,10 @@ void data_lammps(LAMMPS *lmp, const TestConfig &cfg) std::string input_file = platform::path_join(INPUT_FOLDER, cfg.input_file); parse_input_script(input_file); - for (auto &improper_coeff : cfg.improper_coeff) { + for (const auto &improper_coeff : cfg.improper_coeff) { command("improper_coeff " + improper_coeff); } - for (auto &post_command : cfg.post_commands) { + for (const auto &post_command : cfg.post_commands) { command(post_command); } command("run 0 post no"); @@ -234,7 +234,7 @@ void generate_yaml_file(const char *outfile, const TestConfig &config) if (!lmp) { std::cerr << "One or more prerequisite styles are not available " "in this LAMMPS configuration:\n"; - for (auto &prerequisite : config.prerequisites) { + for (const auto &prerequisite : config.prerequisites) { std::cerr << prerequisite.first << "_style " << prerequisite.second << "\n"; } return; @@ -253,7 +253,7 @@ void generate_yaml_file(const char *outfile, const TestConfig &config) // improper_coeff block.clear(); - for (auto &improper_coeff : config.improper_coeff) { + for (const auto &improper_coeff : config.improper_coeff) { block += improper_coeff + "\n"; } writer.emit_block("improper_coeff", block); @@ -271,14 +271,14 @@ void generate_yaml_file(const char *outfile, const TestConfig &config) writer.emit("init_energy", lmp->force->improper->energy); // init_stress - auto stress = lmp->force->improper->virial; + auto *stress = lmp->force->improper->virial; block = fmt::format("{:23.16e} {:23.16e} {:23.16e} {:23.16e} {:23.16e} {:23.16e}", stress[0], stress[1], stress[2], stress[3], stress[4], stress[5]); writer.emit_block("init_stress", block); // init_forces block.clear(); - auto f = lmp->atom->f; + auto *f = lmp->atom->f; for (int i = 1; i <= natoms; ++i) { const int j = lmp->atom->map(i); block += fmt::format("{:3} {:23.16e} {:23.16e} {:23.16e}\n", i, f[j][0], f[j][1], f[j][2]); @@ -339,7 +339,7 @@ TEST(ImproperStyle, plain) double epsilon = test_config.epsilon; ErrorStats stats; - auto improper = lmp->force->improper; + auto *improper = lmp->force->improper; EXPECT_FORCES("init_forces (newton on)", lmp->atom, test_config.init_forces, epsilon); EXPECT_STRESS("init_stress (newton on)", improper->virial, test_config.init_stress, epsilon); @@ -459,7 +459,7 @@ TEST(ImproperStyle, omp) double epsilon = 5.0 * test_config.epsilon; ErrorStats stats; - auto improper = lmp->force->improper; + auto *improper = lmp->force->improper; EXPECT_FORCES("init_forces (newton on)", lmp->atom, test_config.init_forces, epsilon); EXPECT_STRESS("init_stress (newton on)", improper->virial, test_config.init_stress, diff --git a/unittest/force-styles/test_main.cpp b/unittest/force-styles/test_main.cpp index 1cf428eee4..da2574a037 100644 --- a/unittest/force-styles/test_main.cpp +++ b/unittest/force-styles/test_main.cpp @@ -130,7 +130,7 @@ void write_yaml_header(YamlWriter *writer, TestConfig *cfg, const char *version) // skip tests block.clear(); - for (auto &skip : cfg->skip_tests) { + for (const auto &skip : cfg->skip_tests) { if (block.empty()) block = skip; else diff --git a/unittest/force-styles/test_main.h b/unittest/force-styles/test_main.h index 36bcd7bdff..8199537c39 100644 --- a/unittest/force-styles/test_main.h +++ b/unittest/force-styles/test_main.h @@ -14,9 +14,9 @@ #ifndef TEST_MAIN_H #define TEST_MAIN_H -#include "test_config.h" -#include "lammps.h" #include "atom.h" +#include "lammps.h" +#include "test_config.h" #include #include @@ -37,9 +37,13 @@ void write_yaml_header(class YamlWriter *writer, TestConfig *cfg, const char *ve EXPECT_PRED_FORMAT2(::testing::DoubleLE, err, eps); \ } while (0); -void EXPECT_STRESS(const std::string & name, double * stress, const stress_t & expected_stress, double epsilon); -void EXPECT_FORCES(const std::string & name, LAMMPS_NS::Atom * atom, const std::vector & f_ref, double epsilon); -void EXPECT_POSITIONS(const std::string & name, LAMMPS_NS::Atom * atom, const std::vector & x_ref, double epsilon); -void EXPECT_VELOCITIES(const std::string & name, LAMMPS_NS::Atom * atom, const std::vector & v_ref, double epsilon); +void EXPECT_STRESS(const std::string &name, double *stress, const stress_t &expected_stress, + double epsilon); +void EXPECT_FORCES(const std::string &name, LAMMPS_NS::Atom *atom, + const std::vector &f_ref, double epsilon); +void EXPECT_POSITIONS(const std::string &name, LAMMPS_NS::Atom *atom, + const std::vector &x_ref, double epsilon); +void EXPECT_VELOCITIES(const std::string &name, LAMMPS_NS::Atom *atom, + const std::vector &v_ref, double epsilon); #endif diff --git a/unittest/force-styles/test_pair_style.cpp b/unittest/force-styles/test_pair_style.cpp index 9db9c7ac8b..884d802aa5 100644 --- a/unittest/force-styles/test_pair_style.cpp +++ b/unittest/force-styles/test_pair_style.cpp @@ -71,7 +71,7 @@ LAMMPS *init_lammps(LAMMPS::argv &args, const TestConfig &cfg, const bool newton // check if prerequisite styles are available Info *info = new Info(lmp); int nfail = 0; - for (auto &prerequisite : cfg.prerequisites) { + for (const auto &prerequisite : cfg.prerequisites) { std::string style = prerequisite.second; // this is a test for pair styles, so if the suffixed @@ -122,7 +122,7 @@ LAMMPS *init_lammps(LAMMPS::argv &args, const TestConfig &cfg, const bool newton command("variable input_dir index " + INPUT_FOLDER); - for (auto &pre_command : cfg.pre_commands) { + for (const auto &pre_command : cfg.pre_commands) { command(pre_command); } @@ -131,7 +131,7 @@ LAMMPS *init_lammps(LAMMPS::argv &args, const TestConfig &cfg, const bool newton command("pair_style " + cfg.pair_style); - for (auto &pair_coeff : cfg.pair_coeff) { + for (const auto &pair_coeff : cfg.pair_coeff) { command("pair_coeff " + pair_coeff); } @@ -142,7 +142,7 @@ LAMMPS *init_lammps(LAMMPS::argv &args, const TestConfig &cfg, const bool newton command("pair_modify table 0"); command("pair_modify table/disp 0"); - for (auto &post_command : cfg.post_commands) { + for (const auto &post_command : cfg.post_commands) { command(post_command); } @@ -188,12 +188,12 @@ void restart_lammps(LAMMPS *lmp, const TestConfig &cfg, bool nofdotr = false, bo command("pair_style " + cfg.pair_style); } if (!lmp->force->pair->restartinfo || !lmp->force->pair->writedata) { - for (auto &pair_coeff : cfg.pair_coeff) { + for (const auto &pair_coeff : cfg.pair_coeff) { command("pair_coeff " + pair_coeff); } } - for (auto &post_command : cfg.post_commands) { + for (const auto &post_command : cfg.post_commands) { command(post_command); } if (nofdotr) command("pair_modify nofdotr"); @@ -217,7 +217,7 @@ void data_lammps(LAMMPS *lmp, const TestConfig &cfg) command("variable newton_pair delete"); command("variable newton_pair index on"); - for (auto &pre_command : cfg.pre_commands) { + for (const auto &pre_command : cfg.pre_commands) { command(pre_command); } @@ -227,10 +227,10 @@ void data_lammps(LAMMPS *lmp, const TestConfig &cfg) std::string input_file = platform::path_join(INPUT_FOLDER, cfg.input_file); parse_input_script(input_file); - for (auto &pair_coeff : cfg.pair_coeff) { + for (const auto &pair_coeff : cfg.pair_coeff) { command("pair_coeff " + pair_coeff); } - for (auto &post_command : cfg.post_commands) { + for (const auto &post_command : cfg.post_commands) { command(post_command); } command("run 0 post no"); @@ -287,7 +287,7 @@ void generate_yaml_file(const char *outfile, const TestConfig &config) writer.emit("init_coul", lmp->force->pair->eng_coul); // init_stress - auto stress = lmp->force->pair->virial; + auto *stress = lmp->force->pair->virial; // avoid false positives on tiny stresses. force to zero instead. for (int i = 0; i < 6; ++i) if (fabs(stress[i]) < 1.0e-13) stress[i] = 0.0; @@ -297,7 +297,7 @@ void generate_yaml_file(const char *outfile, const TestConfig &config) // init_forces block.clear(); - auto f = lmp->atom->f; + auto *f = lmp->atom->f; for (int i = 1; i <= natoms; ++i) { const int j = lmp->atom->map(i); block += fmt::format("{:3} {:23.16e} {:23.16e} {:23.16e}\n", i, f[j][0], f[j][1], f[j][2]); @@ -367,7 +367,7 @@ TEST(PairStyle, plain) if (lmp->force->kspace && lmp->force->kspace->compute_flag) if (utils::strmatch(lmp->force->kspace_style, "^pppm")) epsilon *= 2.0e8; #endif - auto pair = lmp->force->pair; + auto *pair = lmp->force->pair; EXPECT_FORCES("init_forces (newton on)", lmp->atom, test_config.init_forces, epsilon); EXPECT_STRESS("init_stress (newton on)", pair->virial, test_config.init_stress, epsilon); @@ -547,7 +547,7 @@ TEST(PairStyle, omp) if (lmp->force->kspace && lmp->force->kspace->compute_flag) if (utils::strmatch(lmp->force->kspace_style, "^pppm")) epsilon *= 2.0e8; #endif - auto pair = lmp->force->pair; + auto *pair = lmp->force->pair; ErrorStats stats; EXPECT_FORCES("init_forces (newton on)", lmp->atom, test_config.init_forces, epsilon); @@ -679,7 +679,7 @@ TEST(PairStyle, kokkos_omp) if (lmp->force->kspace && lmp->force->kspace->compute_flag) if (utils::strmatch(lmp->force->kspace_style, "^pppm")) epsilon *= 2.0e8; #endif - auto pair = lmp->force->pair; + auto *pair = lmp->force->pair; ErrorStats stats; EXPECT_FORCES("init_forces (newton on)", lmp->atom, test_config.init_forces, epsilon); @@ -821,7 +821,7 @@ TEST(PairStyle, gpu) if (utils::strmatch(lmp->force->kspace_style, "^pppm")) epsilon *= 2.0e8; #endif ErrorStats stats; - auto pair = lmp->force->pair; + auto *pair = lmp->force->pair; EXPECT_FORCES("init_forces (newton off)", lmp->atom, test_config.init_forces, epsilon); EXPECT_STRESS("init_stress (newton off)", pair->virial, test_config.init_stress, 10 * epsilon); @@ -902,7 +902,7 @@ TEST(PairStyle, intel) ASSERT_EQ(lmp->atom->natoms, nlocal); ErrorStats stats; - auto pair = lmp->force->pair; + auto *pair = lmp->force->pair; EXPECT_FORCES("init_forces", lmp->atom, test_config.init_forces, epsilon); EXPECT_STRESS("init_stress", pair->virial, test_config.init_stress, 10 * epsilon); @@ -973,7 +973,7 @@ TEST(PairStyle, opt) if (utils::strmatch(lmp->force->kspace_style, "^pppm")) epsilon *= 2.0e8; #endif ErrorStats stats; - auto pair = lmp->force->pair; + auto *pair = lmp->force->pair; EXPECT_FORCES("init_forces (newton off)", lmp->atom, test_config.init_forces, epsilon); EXPECT_STRESS("init_stress", pair->virial, test_config.init_stress, 10 * epsilon); @@ -1284,7 +1284,7 @@ TEST(PairStyle, extract) GTEST_SKIP(); } - auto pair = lmp->force->pair; + auto *pair = lmp->force->pair; if (!pair->compute_flag) { std::cerr << "Pair style disabled" << std::endl; if (!verbose) ::testing::internal::CaptureStdout(); diff --git a/unittest/force-styles/yaml_writer.h b/unittest/force-styles/yaml_writer.h index be4861fcc0..9a9775881f 100644 --- a/unittest/force-styles/yaml_writer.h +++ b/unittest/force-styles/yaml_writer.h @@ -22,9 +22,9 @@ class YamlWriter { public: YamlWriter(const char *outfile); virtual ~YamlWriter(); - YamlWriter() = delete; - YamlWriter(const YamlWriter &) = delete; - const YamlWriter & operator=(const YamlWriter &) = delete; + YamlWriter() = delete; + YamlWriter(const YamlWriter &) = delete; + const YamlWriter &operator=(const YamlWriter &) = delete; // emitters void emit(const std::string &key, const double value); diff --git a/unittest/formats/compressed_dump_test.h b/unittest/formats/compressed_dump_test.h index 3c4376a5b8..bb238a63a1 100644 --- a/unittest/formats/compressed_dump_test.h +++ b/unittest/formats/compressed_dump_test.h @@ -101,8 +101,8 @@ public: { BEGIN_HIDE_OUTPUT(); std::string converted_file = compressed_file.substr(0, compressed_file.find_last_of('.')); - std::string cmdline = - fmt::format("\"{}\" -d -c {} > {}", COMPRESS_EXECUTABLE, compressed_file, converted_file); + std::string cmdline = fmt::format("\"{}\" -d -c {} > {}", COMPRESS_EXECUTABLE, + compressed_file, converted_file); system(cmdline.c_str()); END_HIDE_OUTPUT(); return converted_file; diff --git a/unittest/formats/test_atom_styles.cpp b/unittest/formats/test_atom_styles.cpp index 1da2dfa33c..68bc0a4437 100644 --- a/unittest/formats/test_atom_styles.cpp +++ b/unittest/formats/test_atom_styles.cpp @@ -553,8 +553,8 @@ TEST_F(AtomStyleTest, atomic) ASSERT_EQ(lmp->atom->molecular, Atom::ATOMIC); ASSERT_EQ(lmp->atom->ntypes, 2); - auto x = lmp->atom->x; - auto v = lmp->atom->v; + auto *x = lmp->atom->x; + auto *v = lmp->atom->v; EXPECT_NEAR(x[GETIDX(1)][0], -2.0, EPSILON); EXPECT_NEAR(x[GETIDX(1)][1], 2.0, EPSILON); EXPECT_NEAR(x[GETIDX(1)][2], 0.1, EPSILON); @@ -642,7 +642,7 @@ TEST_F(AtomStyleTest, atomic) command("replicate 2 2 2"); END_HIDE_OUTPUT(); ASSERT_EQ(lmp->atom->map_tag_max, 16); - x = lmp->atom->x; + x = lmp->atom->x; EXPECT_NEAR(x[GETIDX(1)][0], -2.0, EPSILON); EXPECT_NEAR(x[GETIDX(1)][1], 2.0, EPSILON); EXPECT_NEAR(x[GETIDX(1)][2], 0.1, EPSILON); @@ -870,9 +870,9 @@ TEST_F(AtomStyleTest, charge) ASSERT_EQ(lmp->atom->map_user, 1); ASSERT_EQ(lmp->atom->map_tag_max, 4); - auto x = lmp->atom->x; - auto v = lmp->atom->v; - auto q = lmp->atom->q; + auto *x = lmp->atom->x; + auto *v = lmp->atom->v; + auto *q = lmp->atom->q; EXPECT_NEAR(x[GETIDX(1)][0], -2.0, EPSILON); EXPECT_NEAR(x[GETIDX(1)][1], 2.0, EPSILON); EXPECT_NEAR(x[GETIDX(1)][2], 0.1, EPSILON); @@ -1056,10 +1056,10 @@ TEST_F(AtomStyleTest, sphere) ASSERT_EQ(lmp->atom->map_user, 1); ASSERT_EQ(lmp->atom->map_tag_max, 4); - auto x = lmp->atom->x; - auto v = lmp->atom->v; - auto rmass = lmp->atom->rmass; - auto omega = lmp->atom->omega; + auto *x = lmp->atom->x; + auto *v = lmp->atom->v; + auto *rmass = lmp->atom->rmass; + auto *omega = lmp->atom->omega; EXPECT_NEAR(x[GETIDX(1)][0], -2.0, EPSILON); EXPECT_NEAR(x[GETIDX(1)][1], 2.0, EPSILON); EXPECT_NEAR(x[GETIDX(1)][2], 0.1, EPSILON); @@ -1243,13 +1243,13 @@ TEST_F(AtomStyleTest, ellipsoid) ASSERT_EQ(lmp->atom->map_user, 1); ASSERT_EQ(lmp->atom->map_tag_max, 6); - auto x = lmp->atom->x; - auto v = lmp->atom->v; - auto type = lmp->atom->type; - auto ellipsoid = lmp->atom->ellipsoid; - auto rmass = lmp->atom->rmass; - auto avec = dynamic_cast(lmp->atom->avec); - auto bonus = avec->bonus; + auto *x = lmp->atom->x; + auto *v = lmp->atom->v; + auto *type = lmp->atom->type; + auto *ellipsoid = lmp->atom->ellipsoid; + auto *rmass = lmp->atom->rmass; + auto *avec = dynamic_cast(lmp->atom->avec); + auto *bonus = avec->bonus; EXPECT_NEAR(x[GETIDX(1)][0], -2.0, EPSILON); EXPECT_NEAR(x[GETIDX(1)][1], 2.0, EPSILON); EXPECT_NEAR(x[GETIDX(1)][2], 0.1, EPSILON); @@ -1571,13 +1571,13 @@ TEST_F(AtomStyleTest, line) ASSERT_EQ(lmp->atom->map_user, 1); ASSERT_EQ(lmp->atom->map_tag_max, 6); - auto x = lmp->atom->x; - auto v = lmp->atom->v; - auto type = lmp->atom->type; - auto line = lmp->atom->line; - auto rmass = lmp->atom->rmass; - auto avec = dynamic_cast(lmp->atom->avec); - auto bonus = avec->bonus; + auto *x = lmp->atom->x; + auto *v = lmp->atom->v; + auto *type = lmp->atom->type; + auto *line = lmp->atom->line; + auto *rmass = lmp->atom->rmass; + auto *avec = dynamic_cast(lmp->atom->avec); + auto *bonus = avec->bonus; EXPECT_NEAR(x[GETIDX(1)][0], -2.0, EPSILON); EXPECT_NEAR(x[GETIDX(1)][1], 2.0, EPSILON); EXPECT_NEAR(x[GETIDX(1)][2], 0.0, EPSILON); @@ -1853,14 +1853,14 @@ TEST_F(AtomStyleTest, tri) ASSERT_EQ(lmp->atom->map_user, 1); ASSERT_EQ(lmp->atom->map_tag_max, 6); - auto x = lmp->atom->x; - auto v = lmp->atom->v; - auto type = lmp->atom->type; - auto tri = lmp->atom->tri; - auto rmass = lmp->atom->rmass; - auto radius = lmp->atom->radius; - auto avec = dynamic_cast(lmp->atom->avec); - auto bonus = avec->bonus; + auto *x = lmp->atom->x; + auto *v = lmp->atom->v; + auto *type = lmp->atom->type; + auto *tri = lmp->atom->tri; + auto *rmass = lmp->atom->rmass; + auto *radius = lmp->atom->radius; + auto *avec = dynamic_cast(lmp->atom->avec); + auto *bonus = avec->bonus; EXPECT_NEAR(x[GETIDX(1)][0], -2.0, EPSILON); EXPECT_NEAR(x[GETIDX(1)][1], 2.0, EPSILON); EXPECT_NEAR(x[GETIDX(1)][2], 0.1, EPSILON); @@ -2180,7 +2180,7 @@ TEST_F(AtomStyleTest, body_nparticle) ASSERT_ATOM_STATE_EQ(lmp->atom, expected); - auto avec = dynamic_cast(lmp->atom->avec); + auto *avec = dynamic_cast(lmp->atom->avec); ASSERT_NE(lmp->atom->avec, nullptr); ASSERT_NE(avec->bptr, nullptr); ASSERT_THAT(std::string(avec->bptr->style), Eq("nparticle")); @@ -2265,14 +2265,14 @@ TEST_F(AtomStyleTest, body_nparticle) ASSERT_NE(lmp->atom->radius, nullptr); ASSERT_EQ(lmp->atom->mass_setflag, nullptr); - auto x = lmp->atom->x; - auto v = lmp->atom->v; - auto type = lmp->atom->type; - auto body = lmp->atom->body; - auto rmass = lmp->atom->rmass; - auto radius = lmp->atom->radius; - auto angmom = lmp->atom->angmom; - auto bonus = avec->bonus; + auto *x = lmp->atom->x; + auto *v = lmp->atom->v; + auto *type = lmp->atom->type; + auto *body = lmp->atom->body; + auto *rmass = lmp->atom->rmass; + auto *radius = lmp->atom->radius; + auto *angmom = lmp->atom->angmom; + auto *bonus = avec->bonus; EXPECT_NEAR(x[GETIDX(1)][0], -2.0, EPSILON); EXPECT_NEAR(x[GETIDX(1)][1], 2.0, EPSILON); EXPECT_NEAR(x[GETIDX(1)][2], 0.1, EPSILON); @@ -2832,9 +2832,9 @@ TEST_F(AtomStyleTest, template) ASSERT_EQ(lmp->atom->map_user, 1); ASSERT_EQ(lmp->atom->map_tag_max, 12); - auto molecule = lmp->atom->molecule; - auto molindex = lmp->atom->molindex; - auto molatom = lmp->atom->molatom; + auto *molecule = lmp->atom->molecule; + auto *molindex = lmp->atom->molindex; + auto *molatom = lmp->atom->molatom; ASSERT_EQ(molecule[GETIDX(1)], 1); ASSERT_EQ(molecule[GETIDX(2)], 1); @@ -2933,9 +2933,9 @@ TEST_F(AtomStyleTest, template) ASSERT_EQ(molatom[GETIDX(11)], -1); ASSERT_EQ(molatom[GETIDX(12)], -1); - auto x = lmp->atom->x; - auto v = lmp->atom->v; - auto type = lmp->atom->type; + auto *x = lmp->atom->x; + auto *v = lmp->atom->v; + auto *type = lmp->atom->type; EXPECT_NEAR(x[GETIDX(10)][0], 2.0, EPSILON); EXPECT_NEAR(x[GETIDX(10)][1], -2.0, EPSILON); @@ -3147,7 +3147,7 @@ TEST_F(AtomStyleTest, template_charge) ASSERT_ATOM_STATE_EQ(lmp->atom, expected); - auto hybrid = dynamic_cast(lmp->atom->avec); + auto *hybrid = dynamic_cast(lmp->atom->avec); ASSERT_THAT(std::string(lmp->atom->atom_style), Eq("hybrid")); ASSERT_EQ(hybrid->nstyles, 2); ASSERT_THAT(std::string(hybrid->keywords[0]), Eq("template")); @@ -3247,9 +3247,9 @@ TEST_F(AtomStyleTest, template_charge) ASSERT_EQ(lmp->atom->map_user, 1); ASSERT_EQ(lmp->atom->map_tag_max, 12); - auto molecule = lmp->atom->molecule; - auto molindex = lmp->atom->molindex; - auto molatom = lmp->atom->molatom; + auto *molecule = lmp->atom->molecule; + auto *molindex = lmp->atom->molindex; + auto *molatom = lmp->atom->molatom; ASSERT_EQ(molecule[GETIDX(1)], 1); ASSERT_EQ(molecule[GETIDX(2)], 1); @@ -3348,10 +3348,10 @@ TEST_F(AtomStyleTest, template_charge) ASSERT_EQ(molatom[GETIDX(11)], -1); ASSERT_EQ(molatom[GETIDX(12)], -1); - auto x = lmp->atom->x; - auto v = lmp->atom->v; - auto type = lmp->atom->type; - auto q = lmp->atom->q; + auto *x = lmp->atom->x; + auto *v = lmp->atom->v; + auto *type = lmp->atom->type; + auto *q = lmp->atom->q; EXPECT_NEAR(x[GETIDX(10)][0], 2.0, EPSILON); EXPECT_NEAR(x[GETIDX(10)][1], -2.0, EPSILON); @@ -3655,9 +3655,9 @@ TEST_F(AtomStyleTest, bond) ASSERT_EQ(lmp->atom->map_user, 1); ASSERT_EQ(lmp->atom->map_tag_max, 6); - auto num_bond = lmp->atom->num_bond; - auto bond_type = lmp->atom->bond_type; - auto bond_atom = lmp->atom->bond_atom; + auto *num_bond = lmp->atom->num_bond; + auto *bond_type = lmp->atom->bond_type; + auto *bond_atom = lmp->atom->bond_atom; ASSERT_EQ(num_bond[GETIDX(1)], 2); ASSERT_EQ(num_bond[GETIDX(2)], 0); @@ -3714,12 +3714,12 @@ TEST_F(AtomStyleTest, bond) ASSERT_EQ(lmp->atom->map_user, 1); ASSERT_EQ(lmp->atom->map_tag_max, 6); - auto x = lmp->atom->x; - auto v = lmp->atom->v; - auto type = lmp->atom->type; - num_bond = lmp->atom->num_bond; - bond_type = lmp->atom->bond_type; - bond_atom = lmp->atom->bond_atom; + auto *x = lmp->atom->x; + auto *v = lmp->atom->v; + auto *type = lmp->atom->type; + num_bond = lmp->atom->num_bond; + bond_type = lmp->atom->bond_type; + bond_atom = lmp->atom->bond_atom; EXPECT_NEAR(x[GETIDX(1)][0], -2.0, EPSILON); EXPECT_NEAR(x[GETIDX(1)][1], 2.0, EPSILON); @@ -4013,14 +4013,14 @@ TEST_F(AtomStyleTest, angle) ASSERT_EQ(lmp->atom->map_user, 1); ASSERT_EQ(lmp->atom->map_tag_max, 6); - auto num_bond = lmp->atom->num_bond; - auto bond_type = lmp->atom->bond_type; - auto bond_atom = lmp->atom->bond_atom; - auto num_angle = lmp->atom->num_angle; - auto angle_type = lmp->atom->angle_type; - auto angle_atom1 = lmp->atom->angle_atom1; - auto angle_atom2 = lmp->atom->angle_atom2; - auto angle_atom3 = lmp->atom->angle_atom3; + auto *num_bond = lmp->atom->num_bond; + auto *bond_type = lmp->atom->bond_type; + auto *bond_atom = lmp->atom->bond_atom; + auto *num_angle = lmp->atom->num_angle; + auto *angle_type = lmp->atom->angle_type; + auto *angle_atom1 = lmp->atom->angle_atom1; + auto *angle_atom2 = lmp->atom->angle_atom2; + auto *angle_atom3 = lmp->atom->angle_atom3; ASSERT_EQ(num_bond[GETIDX(1)], 2); ASSERT_EQ(num_bond[GETIDX(2)], 0); @@ -4107,9 +4107,9 @@ TEST_F(AtomStyleTest, angle) ASSERT_EQ(lmp->atom->map_user, 1); ASSERT_EQ(lmp->atom->map_tag_max, 6); - auto x = lmp->atom->x; - auto v = lmp->atom->v; - auto type = lmp->atom->type; + auto *x = lmp->atom->x; + auto *v = lmp->atom->v; + auto *type = lmp->atom->type; num_bond = lmp->atom->num_bond; bond_atom = lmp->atom->bond_atom; num_angle = lmp->atom->num_angle; @@ -4288,7 +4288,7 @@ TEST_F(AtomStyleTest, full_ellipsoid) ASSERT_ATOM_STATE_EQ(lmp->atom, expected); - auto hybrid = dynamic_cast(lmp->atom->avec); + auto *hybrid = dynamic_cast(lmp->atom->avec); ASSERT_THAT(std::string(lmp->atom->atom_style), Eq("hybrid")); ASSERT_EQ(hybrid->nstyles, 2); ASSERT_THAT(std::string(hybrid->keywords[0]), Eq("full")); @@ -4398,15 +4398,15 @@ TEST_F(AtomStyleTest, full_ellipsoid) ASSERT_EQ(lmp->atom->map_user, 1); ASSERT_EQ(lmp->atom->map_tag_max, 6); - auto x = lmp->atom->x; - auto v = lmp->atom->v; - auto q = lmp->atom->q; - auto type = lmp->atom->type; - auto ellipsoid = lmp->atom->ellipsoid; - auto rmass = lmp->atom->rmass; + auto *x = lmp->atom->x; + auto *v = lmp->atom->v; + auto *q = lmp->atom->q; + auto *type = lmp->atom->type; + auto *ellipsoid = lmp->atom->ellipsoid; + auto *rmass = lmp->atom->rmass; - auto avec = dynamic_cast(hybrid->styles[1]); - auto bonus = avec->bonus; + auto *avec = dynamic_cast(hybrid->styles[1]); + auto *bonus = avec->bonus; EXPECT_NEAR(x[GETIDX(1)][0], -2.0, EPSILON); EXPECT_NEAR(x[GETIDX(1)][1], 2.0, EPSILON); EXPECT_NEAR(x[GETIDX(1)][2], 0.1, EPSILON); @@ -4768,9 +4768,9 @@ TEST_F(AtomStyleTest, property_atom) ASSERT_EQ(lmp->atom->map_user, Atom::MAP_ARRAY); ASSERT_EQ(lmp->atom->map_tag_max, 4); - auto x = lmp->atom->x; - auto v = lmp->atom->v; - auto q = lmp->atom->q; + auto *x = lmp->atom->x; + auto *v = lmp->atom->v; + auto *q = lmp->atom->q; EXPECT_NEAR(x[GETIDX(1)][0], -2.0, EPSILON); EXPECT_NEAR(x[GETIDX(1)][1], 2.0, EPSILON); EXPECT_NEAR(x[GETIDX(1)][2], 0.1, EPSILON); @@ -4805,10 +4805,10 @@ TEST_F(AtomStyleTest, property_atom) ASSERT_EQ(lmp->atom->mass_setflag[1], 1); ASSERT_EQ(lmp->atom->mass_setflag[2], 1); - auto rmass = lmp->atom->rmass; - auto one = lmp->atom->ivector[0]; - auto two = lmp->atom->dvector[0]; - auto three = lmp->atom->dvector[1]; + auto *rmass = lmp->atom->rmass; + auto *one = lmp->atom->ivector[0]; + auto *two = lmp->atom->dvector[0]; + auto *three = lmp->atom->dvector[1]; EXPECT_NEAR(rmass[GETIDX(1)], 4.0, EPSILON); EXPECT_NEAR(rmass[GETIDX(2)], 4.0, EPSILON); @@ -4939,7 +4939,7 @@ TEST_F(AtomStyleTest, oxdna) ASSERT_ATOM_STATE_EQ(lmp->atom, expected); - auto hybrid = dynamic_cast(lmp->atom->avec); + auto *hybrid = dynamic_cast(lmp->atom->avec); ASSERT_THAT(std::string(lmp->atom->atom_style), Eq("hybrid")); ASSERT_EQ(hybrid->nstyles, 3); ASSERT_THAT(std::string(hybrid->keywords[0]), Eq("bond")); @@ -5152,14 +5152,14 @@ TEST_F(AtomStyleTest, oxdna) ASSERT_NE(lmp->atom->mass_setflag, nullptr); ASSERT_NE(lmp->atom->id5p, nullptr); - auto x = lmp->atom->x; - auto v = lmp->atom->v; - auto type = lmp->atom->type; - auto ellipsoid = lmp->atom->ellipsoid; - auto rmass = lmp->atom->rmass; + auto *x = lmp->atom->x; + auto *v = lmp->atom->v; + auto *type = lmp->atom->type; + auto *ellipsoid = lmp->atom->ellipsoid; + auto *rmass = lmp->atom->rmass; - auto avec = dynamic_cast(hybrid->styles[1]); - auto bonus = avec->bonus; + auto *avec = dynamic_cast(hybrid->styles[1]); + auto *bonus = avec->bonus; EXPECT_NEAR(x[GETIDX(1)][0], -0.33741452300167507, EPSILON); EXPECT_NEAR(x[GETIDX(1)][1], -0.43708835412476305, EPSILON); @@ -5328,10 +5328,10 @@ TEST_F(AtomStyleTest, oxdna) EXPECT_NEAR(bonus[9].quat[2], 0.9849325709665359, EPSILON); EXPECT_NEAR(bonus[9].quat[3], -0.0516705065113425, EPSILON); - auto num_bond = lmp->atom->num_bond; - auto bond_type = lmp->atom->bond_type; - auto bond_atom = lmp->atom->bond_atom; - auto id5p = lmp->atom->id5p; + auto *num_bond = lmp->atom->num_bond; + auto *bond_type = lmp->atom->bond_type; + auto *bond_atom = lmp->atom->bond_atom; + auto *id5p = lmp->atom->id5p; ASSERT_EQ(num_bond[GETIDX(1)], 1); ASSERT_EQ(num_bond[GETIDX(2)], 1); diff --git a/unittest/formats/test_dump_atom_compressed.cpp b/unittest/formats/test_dump_atom_compressed.cpp index ea240ef4e4..9cf2a45ee6 100644 --- a/unittest/formats/test_dump_atom_compressed.cpp +++ b/unittest/formats/test_dump_atom_compressed.cpp @@ -93,15 +93,15 @@ TEST_F(DumpAtomCompressTest, compressed_multi_file_run1) { if (!COMPRESS_EXECUTABLE) GTEST_SKIP(); - auto base_name = "multi_file_run1_*.melt"; - auto base_name_0 = "multi_file_run1_0.melt"; - auto base_name_1 = "multi_file_run1_1.melt"; - auto text_file = text_dump_filename(base_name); - auto text_file_0 = text_dump_filename(base_name_0); - auto text_file_1 = text_dump_filename(base_name_1); - auto compressed_file = compressed_dump_filename(base_name); - auto compressed_file_0 = compressed_dump_filename(base_name_0); - auto compressed_file_1 = compressed_dump_filename(base_name_1); + const auto *base_name = "multi_file_run1_*.melt"; + const auto *base_name_0 = "multi_file_run1_0.melt"; + const auto *base_name_1 = "multi_file_run1_1.melt"; + auto text_file = text_dump_filename(base_name); + auto text_file_0 = text_dump_filename(base_name_0); + auto text_file_1 = text_dump_filename(base_name_1); + auto compressed_file = compressed_dump_filename(base_name); + auto compressed_file_0 = compressed_dump_filename(base_name_0); + auto compressed_file_1 = compressed_dump_filename(base_name_1); if (compression_style == "atom/zstd") { generate_text_and_compressed_dump(text_file, compressed_file, "", "", "", "checksum no", 1); @@ -133,15 +133,15 @@ TEST_F(DumpAtomCompressTest, compressed_multi_file_with_pad_run1) { if (!COMPRESS_EXECUTABLE) GTEST_SKIP(); - auto base_name = "multi_file_pad_run1_*.melt"; - auto base_name_0 = "multi_file_pad_run1_000.melt"; - auto base_name_1 = "multi_file_pad_run1_001.melt"; - auto text_file = text_dump_filename(base_name); - auto text_file_0 = text_dump_filename(base_name_0); - auto text_file_1 = text_dump_filename(base_name_1); - auto compressed_file = compressed_dump_filename(base_name); - auto compressed_file_0 = compressed_dump_filename(base_name_0); - auto compressed_file_1 = compressed_dump_filename(base_name_1); + const auto *base_name = "multi_file_pad_run1_*.melt"; + const auto *base_name_0 = "multi_file_pad_run1_000.melt"; + const auto *base_name_1 = "multi_file_pad_run1_001.melt"; + auto text_file = text_dump_filename(base_name); + auto text_file_0 = text_dump_filename(base_name_0); + auto text_file_1 = text_dump_filename(base_name_1); + auto compressed_file = compressed_dump_filename(base_name); + auto compressed_file_0 = compressed_dump_filename(base_name_0); + auto compressed_file_1 = compressed_dump_filename(base_name_1); generate_text_and_compressed_dump(text_file, compressed_file, "", "pad 3", 1); @@ -174,18 +174,18 @@ TEST_F(DumpAtomCompressTest, compressed_multi_file_with_maxfiles_run1) { if (!COMPRESS_EXECUTABLE) GTEST_SKIP(); - auto base_name = "multi_file_maxfiles_run1_*.melt"; - auto base_name_0 = "multi_file_maxfiles_run1_0.melt"; - auto base_name_1 = "multi_file_maxfiles_run1_1.melt"; - auto base_name_2 = "multi_file_maxfiles_run1_2.melt"; - auto text_file = text_dump_filename(base_name); - auto text_file_0 = text_dump_filename(base_name_0); - auto text_file_1 = text_dump_filename(base_name_1); - auto text_file_2 = text_dump_filename(base_name_2); - auto compressed_file = compressed_dump_filename(base_name); - auto compressed_file_0 = compressed_dump_filename(base_name_0); - auto compressed_file_1 = compressed_dump_filename(base_name_1); - auto compressed_file_2 = compressed_dump_filename(base_name_2); + const auto *base_name = "multi_file_maxfiles_run1_*.melt"; + const auto *base_name_0 = "multi_file_maxfiles_run1_0.melt"; + const auto *base_name_1 = "multi_file_maxfiles_run1_1.melt"; + const auto *base_name_2 = "multi_file_maxfiles_run1_2.melt"; + auto text_file = text_dump_filename(base_name); + auto text_file_0 = text_dump_filename(base_name_0); + auto text_file_1 = text_dump_filename(base_name_1); + auto text_file_2 = text_dump_filename(base_name_2); + auto compressed_file = compressed_dump_filename(base_name); + auto compressed_file_0 = compressed_dump_filename(base_name_0); + auto compressed_file_1 = compressed_dump_filename(base_name_1); + auto compressed_file_2 = compressed_dump_filename(base_name_2); generate_text_and_compressed_dump(text_file, compressed_file, "", "maxfiles 2", 2); @@ -220,9 +220,9 @@ TEST_F(DumpAtomCompressTest, compressed_with_units_run0) { if (!COMPRESS_EXECUTABLE) GTEST_SKIP(); - auto base_name = "with_units_run0.melt"; - auto text_file = text_dump_filename(base_name); - auto compressed_file = compressed_dump_filename(base_name); + const auto *base_name = "with_units_run0.melt"; + auto text_file = text_dump_filename(base_name); + auto compressed_file = compressed_dump_filename(base_name); generate_text_and_compressed_dump(text_file, compressed_file, "", "scale no units yes", 0); @@ -244,9 +244,9 @@ TEST_F(DumpAtomCompressTest, compressed_with_time_run0) { if (!COMPRESS_EXECUTABLE) GTEST_SKIP(); - auto base_name = "with_time_run0.melt"; - auto text_file = text_dump_filename(base_name); - auto compressed_file = compressed_dump_filename(base_name); + const auto *base_name = "with_time_run0.melt"; + auto text_file = text_dump_filename(base_name); + auto compressed_file = compressed_dump_filename(base_name); generate_text_and_compressed_dump(text_file, compressed_file, "", "scale no time yes", 0); @@ -268,9 +268,9 @@ TEST_F(DumpAtomCompressTest, compressed_triclinic_run0) { if (!COMPRESS_EXECUTABLE) GTEST_SKIP(); - auto base_name = "tri_run0.melt"; - auto text_file = text_dump_filename(base_name); - auto compressed_file = compressed_dump_filename(base_name); + const auto *base_name = "tri_run0.melt"; + auto text_file = text_dump_filename(base_name); + auto compressed_file = compressed_dump_filename(base_name); enable_triclinic(); generate_text_and_compressed_dump(text_file, compressed_file, "", "", 0); @@ -293,9 +293,9 @@ TEST_F(DumpAtomCompressTest, compressed_triclinic_with_units_run0) { if (!COMPRESS_EXECUTABLE) GTEST_SKIP(); - auto base_name = "tri_with_units_run0.melt"; - auto text_file = text_dump_filename(base_name); - auto compressed_file = compressed_dump_filename(base_name); + const auto *base_name = "tri_with_units_run0.melt"; + auto text_file = text_dump_filename(base_name); + auto compressed_file = compressed_dump_filename(base_name); enable_triclinic(); generate_text_and_compressed_dump(text_file, compressed_file, "", "scale no units yes", 0); @@ -318,9 +318,9 @@ TEST_F(DumpAtomCompressTest, compressed_triclinic_with_time_run0) { if (!COMPRESS_EXECUTABLE) GTEST_SKIP(); - auto base_name = "tri_with_time_run0.melt"; - auto text_file = text_dump_filename(base_name); - auto compressed_file = compressed_dump_filename(base_name); + const auto *base_name = "tri_with_time_run0.melt"; + auto text_file = text_dump_filename(base_name); + auto compressed_file = compressed_dump_filename(base_name); enable_triclinic(); generate_text_and_compressed_dump(text_file, compressed_file, "", "scale no time yes", 0); @@ -343,9 +343,9 @@ TEST_F(DumpAtomCompressTest, compressed_triclinic_with_image_run0) { if (!COMPRESS_EXECUTABLE) GTEST_SKIP(); - auto base_name = "tri_with_image_run0.melt"; - auto text_file = text_dump_filename(base_name); - auto compressed_file = compressed_dump_filename(base_name); + const auto *base_name = "tri_with_image_run0.melt"; + auto text_file = text_dump_filename(base_name); + auto compressed_file = compressed_dump_filename(base_name); enable_triclinic(); generate_text_and_compressed_dump(text_file, compressed_file, "", "image yes", 0); @@ -396,9 +396,9 @@ TEST_F(DumpAtomCompressTest, compressed_modify_clevel_run0) { if (!COMPRESS_EXECUTABLE) GTEST_SKIP(); - auto base_name = "modify_clevel_run0.melt"; - auto text_file = text_dump_filename(base_name); - auto compressed_file = compressed_dump_filename(base_name); + const auto *base_name = "modify_clevel_run0.melt"; + auto text_file = text_dump_filename(base_name); + auto compressed_file = compressed_dump_filename(base_name); generate_text_and_compressed_dump(text_file, compressed_file, "", "", "", "compression_level 3", 0); diff --git a/unittest/formats/test_dump_cfg.cpp b/unittest/formats/test_dump_cfg.cpp index fe08485ac4..2e094c3691 100644 --- a/unittest/formats/test_dump_cfg.cpp +++ b/unittest/formats/test_dump_cfg.cpp @@ -51,8 +51,8 @@ TEST_F(DumpCfgTest, invalid_options) TEST_F(DumpCfgTest, require_multifile) { - auto dump_file = "dump.melt.cfg_run.cfg"; - auto fields = + const auto *dump_file = "dump.melt.cfg_run.cfg"; + const auto *fields = "mass type xs ys zs id proc procp1 x y z ix iy iz xu yu zu xsu ysu zsu vx vy vz fx fy fz"; BEGIN_HIDE_OUTPUT(); @@ -64,8 +64,8 @@ TEST_F(DumpCfgTest, require_multifile) TEST_F(DumpCfgTest, run0) { - auto dump_file = "dump_cfg_run*.melt.cfg"; - auto fields = "mass type xs ys zs id proc procp1 x y z ix iy iz vx vy vz fx fy fz"; + const auto *dump_file = "dump_cfg_run*.melt.cfg"; + const auto *fields = "mass type xs ys zs id proc procp1 x y z ix iy iz vx vy vz fx fy fz"; generate_dump(dump_file, fields, "", 0); @@ -78,8 +78,8 @@ TEST_F(DumpCfgTest, run0) TEST_F(DumpCfgTest, write_dump) { - auto dump_file = "dump_cfg_run*.melt.cfg"; - auto fields = "mass type xs ys zs id proc procp1 x y z ix iy iz vx vy vz fx fy fz"; + const auto *dump_file = "dump_cfg_run*.melt.cfg"; + const auto *fields = "mass type xs ys zs id proc procp1 x y z ix iy iz vx vy vz fx fy fz"; BEGIN_HIDE_OUTPUT(); command("run 0 post no"); @@ -105,8 +105,8 @@ TEST_F(DumpCfgTest, write_dump) TEST_F(DumpCfgTest, unwrap_run0) { - auto dump_file = "dump_cfg_unwrap_run*.melt.cfg"; - auto fields = "mass type xsu ysu zsu id proc procp1 x y z ix iy iz vx vy vz fx fy fz"; + const auto *dump_file = "dump_cfg_unwrap_run*.melt.cfg"; + const auto *fields = "mass type xsu ysu zsu id proc procp1 x y z ix iy iz vx vy vz fx fy fz"; generate_dump(dump_file, fields, "", 0); @@ -119,8 +119,8 @@ TEST_F(DumpCfgTest, unwrap_run0) TEST_F(DumpCfgTest, no_buffer_run0) { - auto dump_file = "dump_cfg_no_buffer_run*.melt.cfg"; - auto fields = "mass type xsu ysu zsu id proc procp1 x y z ix iy iz vx vy vz fx fy fz"; + const auto *dump_file = "dump_cfg_no_buffer_run*.melt.cfg"; + const auto *fields = "mass type xsu ysu zsu id proc procp1 x y z ix iy iz vx vy vz fx fy fz"; generate_dump(dump_file, fields, "buffer no", 0); @@ -133,8 +133,8 @@ TEST_F(DumpCfgTest, no_buffer_run0) TEST_F(DumpCfgTest, no_unwrap_no_buffer_run0) { - auto dump_file = "dump_cfg_no_unwrap_no_buffer_run*.melt.cfg"; - auto fields = "mass type xs ys zs id proc procp1 x y z ix iy iz vx vy vz fx fy fz"; + const auto *dump_file = "dump_cfg_no_unwrap_no_buffer_run*.melt.cfg"; + const auto *fields = "mass type xs ys zs id proc procp1 x y z ix iy iz vx vy vz fx fy fz"; generate_dump(dump_file, fields, "buffer no", 0); diff --git a/unittest/formats/test_dump_cfg_compressed.cpp b/unittest/formats/test_dump_cfg_compressed.cpp index 158e8926bf..b152637374 100644 --- a/unittest/formats/test_dump_cfg_compressed.cpp +++ b/unittest/formats/test_dump_cfg_compressed.cpp @@ -35,14 +35,14 @@ TEST_F(DumpCfgCompressTest, compressed_run0) { if (!COMPRESS_EXECUTABLE) GTEST_SKIP(); - auto base_name = "run*.melt.cfg"; + const auto *base_name = "run*.melt.cfg"; auto text_files = text_dump_filename(base_name); auto compressed_files = compressed_dump_filename(base_name); - auto base_name_0 = "run0.melt.cfg"; - auto text_file_0 = text_dump_filename(base_name_0); - auto compressed_file_0 = compressed_dump_filename(base_name_0); - auto fields = "mass type xs ys zs id proc procp1 x y z ix iy iz vx vy vz fx fy fz"; + const auto *base_name_0 = "run0.melt.cfg"; + auto text_file_0 = text_dump_filename(base_name_0); + auto compressed_file_0 = compressed_dump_filename(base_name_0); + const auto *fields = "mass type xs ys zs id proc procp1 x y z ix iy iz vx vy vz fx fy fz"; if (compression_style == "cfg/zstd") { generate_text_and_compressed_dump(text_files, compressed_files, fields, fields, "", @@ -69,14 +69,14 @@ TEST_F(DumpCfgCompressTest, compressed_no_buffer_run0) { if (!COMPRESS_EXECUTABLE) GTEST_SKIP(); - auto base_name = "no_buffer_run*.melt.cfg"; + const auto *base_name = "no_buffer_run*.melt.cfg"; auto text_files = text_dump_filename(base_name); auto compressed_files = compressed_dump_filename(base_name); - auto base_name_0 = "no_buffer_run0.melt.cfg"; - auto text_file_0 = text_dump_filename(base_name_0); - auto compressed_file_0 = compressed_dump_filename(base_name_0); - auto fields = "mass type xs ys zs id proc procp1 x y z ix iy iz vx vy vz fx fy fz"; + const auto *base_name_0 = "no_buffer_run0.melt.cfg"; + auto text_file_0 = text_dump_filename(base_name_0); + auto compressed_file_0 = compressed_dump_filename(base_name_0); + const auto *fields = "mass type xs ys zs id proc procp1 x y z ix iy iz vx vy vz fx fy fz"; if (compression_style == "cfg/zstd") { generate_text_and_compressed_dump(text_files, compressed_files, fields, fields, "buffer no", @@ -103,14 +103,14 @@ TEST_F(DumpCfgCompressTest, compressed_unwrap_run0) { if (!COMPRESS_EXECUTABLE) GTEST_SKIP(); - auto base_name = "unwrap_run*.melt.cfg"; + const auto *base_name = "unwrap_run*.melt.cfg"; auto text_files = text_dump_filename(base_name); auto compressed_files = compressed_dump_filename(base_name); - auto base_name_0 = "unwrap_run0.melt.cfg"; - auto text_file_0 = text_dump_filename(base_name_0); - auto compressed_file_0 = compressed_dump_filename(base_name_0); - auto fields = "mass type xsu ysu zsu id proc procp1 x y z ix iy iz vx vy vz fx fy fz"; + const auto *base_name_0 = "unwrap_run0.melt.cfg"; + auto text_file_0 = text_dump_filename(base_name_0); + auto compressed_file_0 = compressed_dump_filename(base_name_0); + const auto *fields = "mass type xsu ysu zsu id proc procp1 x y z ix iy iz vx vy vz fx fy fz"; generate_text_and_compressed_dump(text_files, compressed_files, fields, "", 0); @@ -132,16 +132,16 @@ TEST_F(DumpCfgCompressTest, compressed_multi_file_run1) { if (!COMPRESS_EXECUTABLE) GTEST_SKIP(); - auto base_name = "multi_file_run1_*.melt.cfg"; - auto base_name_0 = "multi_file_run1_0.melt.cfg"; - auto base_name_1 = "multi_file_run1_1.melt.cfg"; - auto text_file = text_dump_filename(base_name); - auto text_file_0 = text_dump_filename(base_name_0); - auto text_file_1 = text_dump_filename(base_name_1); - auto compressed_file = compressed_dump_filename(base_name); - auto compressed_file_0 = compressed_dump_filename(base_name_0); - auto compressed_file_1 = compressed_dump_filename(base_name_1); - auto fields = "mass type xs ys zs id proc procp1 x y z ix iy iz vx vy vz fx fy fz"; + const auto *base_name = "multi_file_run1_*.melt.cfg"; + const auto *base_name_0 = "multi_file_run1_0.melt.cfg"; + const auto *base_name_1 = "multi_file_run1_1.melt.cfg"; + auto text_file = text_dump_filename(base_name); + auto text_file_0 = text_dump_filename(base_name_0); + auto text_file_1 = text_dump_filename(base_name_1); + auto compressed_file = compressed_dump_filename(base_name); + auto compressed_file_0 = compressed_dump_filename(base_name_0); + auto compressed_file_1 = compressed_dump_filename(base_name_1); + const auto *fields = "mass type xs ys zs id proc procp1 x y z ix iy iz vx vy vz fx fy fz"; if (compression_style == "cfg/zstd") { generate_text_and_compressed_dump(text_file, compressed_file, fields, fields, "", @@ -174,16 +174,16 @@ TEST_F(DumpCfgCompressTest, compressed_multi_file_with_pad_run1) { if (!COMPRESS_EXECUTABLE) GTEST_SKIP(); - auto base_name = "multi_file_pad_run1_*.melt.cfg"; - auto base_name_0 = "multi_file_pad_run1_000.melt.cfg"; - auto base_name_1 = "multi_file_pad_run1_001.melt.cfg"; - auto text_file = text_dump_filename(base_name); - auto text_file_0 = text_dump_filename(base_name_0); - auto text_file_1 = text_dump_filename(base_name_1); - auto compressed_file = compressed_dump_filename(base_name); - auto compressed_file_0 = compressed_dump_filename(base_name_0); - auto compressed_file_1 = compressed_dump_filename(base_name_1); - auto fields = "mass type xs ys zs id proc procp1 x y z ix iy iz vx vy vz fx fy fz"; + const auto *base_name = "multi_file_pad_run1_*.melt.cfg"; + const auto *base_name_0 = "multi_file_pad_run1_000.melt.cfg"; + const auto *base_name_1 = "multi_file_pad_run1_001.melt.cfg"; + auto text_file = text_dump_filename(base_name); + auto text_file_0 = text_dump_filename(base_name_0); + auto text_file_1 = text_dump_filename(base_name_1); + auto compressed_file = compressed_dump_filename(base_name); + auto compressed_file_0 = compressed_dump_filename(base_name_0); + auto compressed_file_1 = compressed_dump_filename(base_name_1); + const auto *fields = "mass type xs ys zs id proc procp1 x y z ix iy iz vx vy vz fx fy fz"; generate_text_and_compressed_dump(text_file, compressed_file, fields, "pad 3", 1); @@ -216,19 +216,19 @@ TEST_F(DumpCfgCompressTest, compressed_multi_file_with_maxfiles_run1) { if (!COMPRESS_EXECUTABLE) GTEST_SKIP(); - auto base_name = "multi_file_maxfiles_run1_*.melt.cfg"; - auto base_name_0 = "multi_file_maxfiles_run1_0.melt.cfg"; - auto base_name_1 = "multi_file_maxfiles_run1_1.melt.cfg"; - auto base_name_2 = "multi_file_maxfiles_run1_2.melt.cfg"; - auto text_file = text_dump_filename(base_name); - auto text_file_0 = text_dump_filename(base_name_0); - auto text_file_1 = text_dump_filename(base_name_1); - auto text_file_2 = text_dump_filename(base_name_2); - auto compressed_file = compressed_dump_filename(base_name); - auto compressed_file_0 = compressed_dump_filename(base_name_0); - auto compressed_file_1 = compressed_dump_filename(base_name_1); - auto compressed_file_2 = compressed_dump_filename(base_name_2); - auto fields = "mass type xs ys zs id proc procp1 x y z ix iy iz vx vy vz fx fy fz"; + const auto *base_name = "multi_file_maxfiles_run1_*.melt.cfg"; + const auto *base_name_0 = "multi_file_maxfiles_run1_0.melt.cfg"; + const auto *base_name_1 = "multi_file_maxfiles_run1_1.melt.cfg"; + const auto *base_name_2 = "multi_file_maxfiles_run1_2.melt.cfg"; + auto text_file = text_dump_filename(base_name); + auto text_file_0 = text_dump_filename(base_name_0); + auto text_file_1 = text_dump_filename(base_name_1); + auto text_file_2 = text_dump_filename(base_name_2); + auto compressed_file = compressed_dump_filename(base_name); + auto compressed_file_0 = compressed_dump_filename(base_name_0); + auto compressed_file_1 = compressed_dump_filename(base_name_1); + auto compressed_file_2 = compressed_dump_filename(base_name_2); + const auto *fields = "mass type xs ys zs id proc procp1 x y z ix iy iz vx vy vz fx fy fz"; generate_text_and_compressed_dump(text_file, compressed_file, fields, "maxfiles 2", 2); @@ -263,7 +263,7 @@ TEST_F(DumpCfgCompressTest, compressed_modify_bad_param) { if (compression_style != "cfg/gz") GTEST_SKIP(); - auto fields = "mass type xs ys zs id proc procp1 x y z ix iy iz vx vy vz fx fy fz"; + const auto *fields = "mass type xs ys zs id proc procp1 x y z ix iy iz vx vy vz fx fy fz"; BEGIN_HIDE_OUTPUT(); command(fmt::format("dump id1 all {} 1 {} {}", compression_style, compressed_dump_filename("modify_bad_param_run0_*.melt.cfg"), fields)); @@ -278,7 +278,7 @@ TEST_F(DumpCfgCompressTest, compressed_modify_multi_bad_param) { if (compression_style != "cfg/gz") GTEST_SKIP(); - auto fields = "mass type xs ys zs id proc procp1 x y z ix iy iz vx vy vz fx fy fz"; + const auto *fields = "mass type xs ys zs id proc procp1 x y z ix iy iz vx vy vz fx fy fz"; BEGIN_HIDE_OUTPUT(); command(fmt::format("dump id1 all {} 1 {} {}", compression_style, compressed_dump_filename("modify_multi_bad_param_run0_*.melt.cfg"), @@ -294,13 +294,13 @@ TEST_F(DumpCfgCompressTest, compressed_modify_clevel_run0) { if (!COMPRESS_EXECUTABLE) GTEST_SKIP(); - auto base_name = "modify_clevel_run*.melt.cfg"; - auto base_name_0 = "modify_clevel_run0.melt.cfg"; - auto text_file = text_dump_filename(base_name); - auto compressed_file = compressed_dump_filename(base_name); - auto text_file_0 = text_dump_filename(base_name_0); - auto compressed_file_0 = compressed_dump_filename(base_name_0); - auto fields = "mass type xs ys zs id proc procp1 x y z ix iy iz vx vy vz fx fy fz"; + const auto *base_name = "modify_clevel_run*.melt.cfg"; + const auto *base_name_0 = "modify_clevel_run0.melt.cfg"; + auto text_file = text_dump_filename(base_name); + auto compressed_file = compressed_dump_filename(base_name); + auto text_file_0 = text_dump_filename(base_name_0); + auto compressed_file_0 = compressed_dump_filename(base_name_0); + const auto *fields = "mass type xs ys zs id proc procp1 x y z ix iy iz vx vy vz fx fy fz"; generate_text_and_compressed_dump(text_file, compressed_file, fields, fields, "", "compression_level 3", 0); diff --git a/unittest/formats/test_dump_custom.cpp b/unittest/formats/test_dump_custom.cpp index 08d5d65695..99693ec088 100644 --- a/unittest/formats/test_dump_custom.cpp +++ b/unittest/formats/test_dump_custom.cpp @@ -111,7 +111,7 @@ public: TEST_F(DumpCustomTest, run1) { auto dump_file = dump_filename("run1"); - auto fields = + const auto *fields = "id type proc procp1 mass x y z ix iy iz xs ys zs xu yu zu xsu ysu zsu vx vy vz fx fy fz"; generate_dump(dump_file, fields, "units yes", 1); @@ -128,8 +128,8 @@ TEST_F(DumpCustomTest, run1) TEST_F(DumpCustomTest, thresh_run0) { - auto dump_file = dump_filename("thresh_run0"); - auto fields = "id type x y z"; + auto dump_file = dump_filename("thresh_run0"); + const auto *fields = "id type x y z"; generate_dump(dump_file, fields, "units yes thresh x < 1 thresh y < 1 thresh z < 1", 0); @@ -149,8 +149,8 @@ TEST_F(DumpCustomTest, compute_run0) command("compute comp all property/atom x y z"); END_HIDE_OUTPUT(); - auto dump_file = dump_filename("compute_run0"); - auto fields = "id type x y z c_comp[1] c_comp[2] c_comp[3]"; + auto dump_file = dump_filename("compute_run0"); + const auto *fields = "id type x y z c_comp[1] c_comp[2] c_comp[3]"; generate_dump(dump_file, fields, "units yes", 0); @@ -172,8 +172,8 @@ TEST_F(DumpCustomTest, fix_run0) command("fix numdiff all numdiff 1 0.0001"); END_HIDE_OUTPUT(); - auto dump_file = dump_filename("fix_run0"); - auto fields = "id x y z f_numdiff[1] f_numdiff[2] f_numdiff[3]"; + auto dump_file = dump_filename("fix_run0"); + const auto *fields = "id x y z f_numdiff[1] f_numdiff[2] f_numdiff[3]"; generate_dump(dump_file, fields, "units yes", 0); @@ -194,8 +194,8 @@ TEST_F(DumpCustomTest, custom_run0) command("compute 1 all property/atom i_flag1 d_flag2"); END_HIDE_OUTPUT(); - auto dump_file = dump_filename("custom_run0"); - auto fields = "id x y z i_flag1 d_flag2"; + auto dump_file = dump_filename("custom_run0"); + const auto *fields = "id x y z i_flag1 d_flag2"; generate_dump(dump_file, fields, "units yes", 0); @@ -215,7 +215,8 @@ TEST_F(DumpCustomTest, binary_run1) auto text_file = text_dump_filename("run1"); auto binary_file = binary_dump_filename("run1"); - auto fields = "id type proc x y z ix iy iz xs ys zs xu yu zu xsu ysu zsu vx vy vz fx fy fz"; + const auto *fields = + "id type proc x y z ix iy iz xs ys zs xu yu zu xsu ysu zsu vx vy vz fx fy fz"; generate_text_and_binary_dump(text_file, binary_file, fields, "units yes", 1); @@ -234,7 +235,8 @@ TEST_F(DumpCustomTest, binary_run1) TEST_F(DumpCustomTest, triclinic_run1) { auto dump_file = dump_filename("tri_run1"); - auto fields = "id type proc x y z ix iy iz xs ys zs xu yu zu xsu ysu zsu vx vy vz fx fy fz"; + const auto *fields = + "id type proc x y z ix iy iz xs ys zs xu yu zu xsu ysu zsu vx vy vz fx fy fz"; enable_triclinic(); @@ -254,9 +256,9 @@ TEST_F(DumpCustomTest, binary_triclinic_run1) { if (!BINARY2TXT_EXECUTABLE) GTEST_SKIP(); - auto text_file = text_dump_filename("tri_run1"); - auto binary_file = binary_dump_filename("tri_run1"); - auto fields = "id type proc x y z xs ys zs xsu ysu zsu vx vy vz fx fy fz"; + auto text_file = text_dump_filename("tri_run1"); + auto binary_file = binary_dump_filename("tri_run1"); + const auto *fields = "id type proc x y z xs ys zs xsu ysu zsu vx vy vz fx fy fz"; enable_triclinic(); @@ -281,8 +283,8 @@ TEST_F(DumpCustomTest, with_variable_run1) command("variable p atom (c_1%10)+1"); END_HIDE_OUTPUT(); - auto dump_file = dump_filename("with_variable_run1"); - auto fields = "id type x y z v_p"; + auto dump_file = dump_filename("with_variable_run1"); + const auto *fields = "id type x y z v_p"; generate_dump(dump_file, fields, "units yes", 1); @@ -298,8 +300,8 @@ TEST_F(DumpCustomTest, with_variable_run1) TEST_F(DumpCustomTest, run1plus1) { - auto dump_file = dump_filename("run1plus1"); - auto fields = "id type x y z"; + auto dump_file = dump_filename("run1plus1"); + const auto *fields = "id type x y z"; generate_dump(dump_file, fields, "units yes", 1); @@ -315,8 +317,8 @@ TEST_F(DumpCustomTest, run1plus1) TEST_F(DumpCustomTest, run2) { - auto dump_file = dump_filename("run2"); - auto fields = "id type x y z"; + auto dump_file = dump_filename("run2"); + const auto *fields = "id type x y z"; generate_dump(dump_file, fields, "", 2); ASSERT_FILE_EXISTS(dump_file); @@ -326,8 +328,8 @@ TEST_F(DumpCustomTest, run2) TEST_F(DumpCustomTest, rerun) { - auto dump_file = dump_filename("rerun"); - auto fields = "id type xs ys zs"; + auto dump_file = dump_filename("rerun"); + const auto *fields = "id type xs ys zs"; HIDE_OUTPUT([&] { command("fix 1 all nve"); @@ -358,8 +360,8 @@ TEST_F(DumpCustomTest, rerun) TEST_F(DumpCustomTest, rerun_bin) { - auto dump_file = binary_dump_filename("rerun"); - auto fields = "id type xs ys zs"; + auto dump_file = binary_dump_filename("rerun"); + const auto *fields = "id type xs ys zs"; HIDE_OUTPUT([&] { command("fix 1 all nve"); diff --git a/unittest/formats/test_dump_custom_compressed.cpp b/unittest/formats/test_dump_custom_compressed.cpp index 91d72e4483..4a3e4b5284 100644 --- a/unittest/formats/test_dump_custom_compressed.cpp +++ b/unittest/formats/test_dump_custom_compressed.cpp @@ -31,10 +31,11 @@ TEST_F(DumpCustomCompressTest, compressed_run1) { if (!COMPRESS_EXECUTABLE) GTEST_SKIP(); - auto base_name = "custom_run1.melt"; - auto text_file = text_dump_filename(base_name); - auto compressed_file = compressed_dump_filename(base_name); - auto fields = "id type proc x y z ix iy iz xs ys zs xu yu zu xsu ysu zsu vx vy vz fx fy fz"; + const auto *base_name = "custom_run1.melt"; + auto text_file = text_dump_filename(base_name); + auto compressed_file = compressed_dump_filename(base_name); + const auto *fields = + "id type proc x y z ix iy iz xs ys zs xu yu zu xsu ysu zsu vx vy vz fx fy fz"; if (compression_style == "custom/zstd") { generate_text_and_compressed_dump(text_file, compressed_file, fields, fields, "units yes", @@ -61,10 +62,11 @@ TEST_F(DumpCustomCompressTest, compressed_with_time_run1) { if (!COMPRESS_EXECUTABLE) GTEST_SKIP(); - auto base_name = "with_time_custom_run1.melt"; - auto text_file = text_dump_filename(base_name); - auto compressed_file = compressed_dump_filename(base_name); - auto fields = "id type proc x y z ix iy iz xs ys zs xu yu zu xsu ysu zsu vx vy vz fx fy fz"; + const auto *base_name = "with_time_custom_run1.melt"; + auto text_file = text_dump_filename(base_name); + auto compressed_file = compressed_dump_filename(base_name); + const auto *fields = + "id type proc x y z ix iy iz xs ys zs xu yu zu xsu ysu zsu vx vy vz fx fy fz"; if (compression_style == "custom/zstd") { generate_text_and_compressed_dump(text_file, compressed_file, fields, fields, "time yes", @@ -91,10 +93,11 @@ TEST_F(DumpCustomCompressTest, compressed_no_buffer_run1) { if (!COMPRESS_EXECUTABLE) GTEST_SKIP(); - auto base_name = "no_buffer_custom_run1.melt"; - auto text_file = text_dump_filename(base_name); - auto compressed_file = compressed_dump_filename(base_name); - auto fields = "id type proc x y z ix iy iz xs ys zs xu yu zu xsu ysu zsu vx vy vz fx fy fz"; + const auto *base_name = "no_buffer_custom_run1.melt"; + auto text_file = text_dump_filename(base_name); + auto compressed_file = compressed_dump_filename(base_name); + const auto *fields = + "id type proc x y z ix iy iz xs ys zs xu yu zu xsu ysu zsu vx vy vz fx fy fz"; if (compression_style == "custom/zstd") { generate_text_and_compressed_dump(text_file, compressed_file, fields, fields, "buffer no", @@ -121,10 +124,10 @@ TEST_F(DumpCustomCompressTest, compressed_triclinic_run1) { if (!COMPRESS_EXECUTABLE) GTEST_SKIP(); - auto base_name = "custom_tri_run1.melt"; - auto text_file = text_dump_filename(base_name); - auto compressed_file = compressed_dump_filename(base_name); - auto fields = "id type proc x y z xs ys zs xsu ysu zsu vx vy vz fx fy fz"; + const auto *base_name = "custom_tri_run1.melt"; + auto text_file = text_dump_filename(base_name); + auto compressed_file = compressed_dump_filename(base_name); + const auto *fields = "id type proc x y z xs ys zs xsu ysu zsu vx vy vz fx fy fz"; enable_triclinic(); @@ -148,16 +151,17 @@ TEST_F(DumpCustomCompressTest, compressed_multi_file_run1) { if (!COMPRESS_EXECUTABLE) GTEST_SKIP(); - auto base_name = "multi_file_run1_*.melt.custom"; - auto base_name_0 = "multi_file_run1_0.melt.custom"; - auto base_name_1 = "multi_file_run1_1.melt.custom"; - auto text_file = text_dump_filename(base_name); - auto text_file_0 = text_dump_filename(base_name_0); - auto text_file_1 = text_dump_filename(base_name_1); - auto compressed_file = compressed_dump_filename(base_name); - auto compressed_file_0 = compressed_dump_filename(base_name_0); - auto compressed_file_1 = compressed_dump_filename(base_name_1); - auto fields = "id type proc x y z ix iy iz xs ys zs xu yu zu xsu ysu zsu vx vy vz fx fy fz"; + const auto *base_name = "multi_file_run1_*.melt.custom"; + const auto *base_name_0 = "multi_file_run1_0.melt.custom"; + const auto *base_name_1 = "multi_file_run1_1.melt.custom"; + auto text_file = text_dump_filename(base_name); + auto text_file_0 = text_dump_filename(base_name_0); + auto text_file_1 = text_dump_filename(base_name_1); + auto compressed_file = compressed_dump_filename(base_name); + auto compressed_file_0 = compressed_dump_filename(base_name_0); + auto compressed_file_1 = compressed_dump_filename(base_name_1); + const auto *fields = + "id type proc x y z ix iy iz xs ys zs xu yu zu xsu ysu zsu vx vy vz fx fy fz"; if (compression_style == "custom/zstd") { generate_text_and_compressed_dump(text_file, compressed_file, fields, fields, "", @@ -190,16 +194,17 @@ TEST_F(DumpCustomCompressTest, compressed_multi_file_with_pad_run1) { if (!COMPRESS_EXECUTABLE) GTEST_SKIP(); - auto base_name = "multi_file_pad_run1_*.melt.custom"; - auto base_name_0 = "multi_file_pad_run1_000.melt.custom"; - auto base_name_1 = "multi_file_pad_run1_001.melt.custom"; - auto text_file = text_dump_filename(base_name); - auto text_file_0 = text_dump_filename(base_name_0); - auto text_file_1 = text_dump_filename(base_name_1); - auto compressed_file = compressed_dump_filename(base_name); - auto compressed_file_0 = compressed_dump_filename(base_name_0); - auto compressed_file_1 = compressed_dump_filename(base_name_1); - auto fields = "id type proc x y z ix iy iz xs ys zs xu yu zu xsu ysu zsu vx vy vz fx fy fz"; + const auto *base_name = "multi_file_pad_run1_*.melt.custom"; + const auto *base_name_0 = "multi_file_pad_run1_000.melt.custom"; + const auto *base_name_1 = "multi_file_pad_run1_001.melt.custom"; + auto text_file = text_dump_filename(base_name); + auto text_file_0 = text_dump_filename(base_name_0); + auto text_file_1 = text_dump_filename(base_name_1); + auto compressed_file = compressed_dump_filename(base_name); + auto compressed_file_0 = compressed_dump_filename(base_name_0); + auto compressed_file_1 = compressed_dump_filename(base_name_1); + const auto *fields = + "id type proc x y z ix iy iz xs ys zs xu yu zu xsu ysu zsu vx vy vz fx fy fz"; generate_text_and_compressed_dump(text_file, compressed_file, fields, "pad 3", 1); @@ -232,19 +237,20 @@ TEST_F(DumpCustomCompressTest, compressed_multi_file_with_maxfiles_run1) { if (!COMPRESS_EXECUTABLE) GTEST_SKIP(); - auto base_name = "multi_file_maxfiles_run1_*.melt.custom"; - auto base_name_0 = "multi_file_maxfiles_run1_0.melt.custom"; - auto base_name_1 = "multi_file_maxfiles_run1_1.melt.custom"; - auto base_name_2 = "multi_file_maxfiles_run1_2.melt.custom"; - auto text_file = text_dump_filename(base_name); - auto text_file_0 = text_dump_filename(base_name_0); - auto text_file_1 = text_dump_filename(base_name_1); - auto text_file_2 = text_dump_filename(base_name_2); - auto compressed_file = compressed_dump_filename(base_name); - auto compressed_file_0 = compressed_dump_filename(base_name_0); - auto compressed_file_1 = compressed_dump_filename(base_name_1); - auto compressed_file_2 = compressed_dump_filename(base_name_2); - auto fields = "id type proc x y z ix iy iz xs ys zs xu yu zu xsu ysu zsu vx vy vz fx fy fz"; + const auto *base_name = "multi_file_maxfiles_run1_*.melt.custom"; + const auto *base_name_0 = "multi_file_maxfiles_run1_0.melt.custom"; + const auto *base_name_1 = "multi_file_maxfiles_run1_1.melt.custom"; + const auto *base_name_2 = "multi_file_maxfiles_run1_2.melt.custom"; + auto text_file = text_dump_filename(base_name); + auto text_file_0 = text_dump_filename(base_name_0); + auto text_file_1 = text_dump_filename(base_name_1); + auto text_file_2 = text_dump_filename(base_name_2); + auto compressed_file = compressed_dump_filename(base_name); + auto compressed_file_0 = compressed_dump_filename(base_name_0); + auto compressed_file_1 = compressed_dump_filename(base_name_1); + auto compressed_file_2 = compressed_dump_filename(base_name_2); + const auto *fields = + "id type proc x y z ix iy iz xs ys zs xu yu zu xsu ysu zsu vx vy vz fx fy fz"; generate_text_and_compressed_dump(text_file, compressed_file, fields, "maxfiles 2", 2); @@ -279,7 +285,8 @@ TEST_F(DumpCustomCompressTest, compressed_modify_bad_param) { if (compression_style != "custom/gz") GTEST_SKIP(); - auto fields = "id type proc x y z ix iy iz xs ys zs xu yu zu xsu ysu zsu vx vy vz fx fy fz"; + const auto *fields = + "id type proc x y z ix iy iz xs ys zs xu yu zu xsu ysu zsu vx vy vz fx fy fz"; command(fmt::format("dump id1 all {} 1 {} {}", compression_style, compressed_dump_filename("modify_bad_param_run0_*.melt.custom"), fields)); @@ -292,7 +299,8 @@ TEST_F(DumpCustomCompressTest, compressed_modify_multi_bad_param) { if (compression_style != "custom/gz") GTEST_SKIP(); - auto fields = "id type proc x y z ix iy iz xs ys zs xu yu zu xsu ysu zsu vx vy vz fx fy fz"; + const auto *fields = + "id type proc x y z ix iy iz xs ys zs xu yu zu xsu ysu zsu vx vy vz fx fy fz"; command(fmt::format("dump id1 all {} 1 {} {}", compression_style, compressed_dump_filename("modify_multi_bad_param_run0_*.melt.custom"), fields)); @@ -306,11 +314,12 @@ TEST_F(DumpCustomCompressTest, compressed_modify_clevel_run0) { if (!COMPRESS_EXECUTABLE) GTEST_SKIP(); - auto base_name = "modify_clevel_run0.melt.custom"; - auto text_file = text_dump_filename(base_name); - auto compressed_file = compressed_dump_filename(base_name); + const auto *base_name = "modify_clevel_run0.melt.custom"; + auto text_file = text_dump_filename(base_name); + auto compressed_file = compressed_dump_filename(base_name); - auto fields = "id type proc x y z ix iy iz xs ys zs xu yu zu xsu ysu zsu vx vy vz fx fy fz"; + const auto *fields = + "id type proc x y z ix iy iz xs ys zs xu yu zu xsu ysu zsu vx vy vz fx fy fz"; generate_text_and_compressed_dump(text_file, compressed_file, fields, fields, "", "compression_level 3", 0); diff --git a/unittest/formats/test_dump_local.cpp b/unittest/formats/test_dump_local.cpp index d138ee3ac3..004a0590cd 100644 --- a/unittest/formats/test_dump_local.cpp +++ b/unittest/formats/test_dump_local.cpp @@ -73,7 +73,7 @@ public: TEST_F(DumpLocalTest, run0) { - auto dump_file = "dump_local_run0.melt"; + const auto *dump_file = "dump_local_run0.melt"; generate_dump(dump_file, "index c_comp[1]", "", 0); ASSERT_FILE_EXISTS(dump_file); @@ -98,7 +98,7 @@ TEST_F(DumpLocalTest, run0) TEST_F(DumpLocalTest, label_run0) { - auto dump_file = "dump_local_label_run0.melt"; + const auto *dump_file = "dump_local_label_run0.melt"; generate_dump(dump_file, "index c_comp[1]", "label ELEMENTS", 0); ASSERT_FILE_EXISTS(dump_file); @@ -110,7 +110,7 @@ TEST_F(DumpLocalTest, label_run0) TEST_F(DumpLocalTest, format_line_run0) { - auto dump_file = "dump_local_format_line_run0.melt"; + const auto *dump_file = "dump_local_format_line_run0.melt"; generate_dump(dump_file, "index c_comp[1]", "format line \"%d %20.8g\"", 0); ASSERT_FILE_EXISTS(dump_file); @@ -123,7 +123,7 @@ TEST_F(DumpLocalTest, format_line_run0) TEST_F(DumpLocalTest, format_int_run0) { - auto dump_file = "dump_local_format_int_run0.melt"; + const auto *dump_file = "dump_local_format_int_run0.melt"; generate_dump(dump_file, "index c_comp[1]", "format int \"%20d\"", 0); ASSERT_FILE_EXISTS(dump_file); @@ -136,7 +136,7 @@ TEST_F(DumpLocalTest, format_int_run0) TEST_F(DumpLocalTest, format_float_run0) { - auto dump_file = "dump_local_format_float_run0.melt"; + const auto *dump_file = "dump_local_format_float_run0.melt"; generate_dump(dump_file, "index c_comp[1]", "format float \"%20.5g\"", 0); ASSERT_FILE_EXISTS(dump_file); @@ -149,7 +149,7 @@ TEST_F(DumpLocalTest, format_float_run0) TEST_F(DumpLocalTest, format_column_run0) { - auto dump_file = "dump_local_format_column_run0.melt"; + const auto *dump_file = "dump_local_format_column_run0.melt"; generate_dump(dump_file, "index c_comp[1]", "format 1 \"%20d\"", 0); ASSERT_FILE_EXISTS(dump_file); @@ -162,7 +162,7 @@ TEST_F(DumpLocalTest, format_column_run0) TEST_F(DumpLocalTest, no_buffer_run0) { - auto dump_file = "dump_local_format_line_run0.melt"; + const auto *dump_file = "dump_local_format_line_run0.melt"; generate_dump(dump_file, "index c_comp[1]", "buffer no", 0); ASSERT_FILE_EXISTS(dump_file); @@ -187,7 +187,7 @@ TEST_F(DumpLocalTest, no_buffer_run0) TEST_F(DumpLocalTest, with_units_run0) { - auto dump_file = "dump_with_units_run0.melt"; + const auto *dump_file = "dump_with_units_run0.melt"; generate_dump(dump_file, "index c_comp[1]", "units yes", 0); ASSERT_FILE_EXISTS(dump_file); @@ -206,7 +206,7 @@ TEST_F(DumpLocalTest, with_units_run0) TEST_F(DumpLocalTest, with_time_run0) { - auto dump_file = "dump_with_time_run0.melt"; + const auto *dump_file = "dump_with_time_run0.melt"; generate_dump(dump_file, "index c_comp[1]", "time yes", 0); ASSERT_FILE_EXISTS(dump_file); @@ -225,7 +225,7 @@ TEST_F(DumpLocalTest, with_time_run0) TEST_F(DumpLocalTest, triclinic_run0) { - auto dump_file = "dump_local_triclinic_run0.melt"; + const auto *dump_file = "dump_local_triclinic_run0.melt"; enable_triclinic(); generate_dump(dump_file, "index c_comp[1]", "", 0); diff --git a/unittest/formats/test_dump_local_compressed.cpp b/unittest/formats/test_dump_local_compressed.cpp index 8523e99a30..dff182013a 100644 --- a/unittest/formats/test_dump_local_compressed.cpp +++ b/unittest/formats/test_dump_local_compressed.cpp @@ -40,13 +40,13 @@ TEST_F(DumpLocalCompressTest, compressed_run0) { if (!COMPRESS_EXECUTABLE) GTEST_SKIP(); - auto base_name = "run*.melt.local"; - auto base_name_0 = "run0.melt.local"; - auto text_files = text_dump_filename(base_name); - auto compressed_files = compressed_dump_filename(base_name); - auto text_file_0 = text_dump_filename(base_name_0); - auto compressed_file_0 = compressed_dump_filename(base_name_0); - auto fields = "index c_comp[1]"; + const auto *base_name = "run*.melt.local"; + const auto *base_name_0 = "run0.melt.local"; + auto text_files = text_dump_filename(base_name); + auto compressed_files = compressed_dump_filename(base_name); + auto text_file_0 = text_dump_filename(base_name_0); + auto compressed_file_0 = compressed_dump_filename(base_name_0); + const auto *fields = "index c_comp[1]"; if (compression_style == "local/zstd") { generate_text_and_compressed_dump(text_files, compressed_files, fields, fields, "", @@ -73,13 +73,13 @@ TEST_F(DumpLocalCompressTest, compressed_no_buffer_run0) { if (!COMPRESS_EXECUTABLE) GTEST_SKIP(); - auto base_name = "no_buffer_run*.melt.local"; - auto base_name_0 = "no_buffer_run0.melt.local"; - auto text_files = text_dump_filename(base_name); - auto compressed_files = compressed_dump_filename(base_name); - auto text_file_0 = text_dump_filename(base_name_0); - auto compressed_file_0 = compressed_dump_filename(base_name_0); - auto fields = "index c_comp[1]"; + const auto *base_name = "no_buffer_run*.melt.local"; + const auto *base_name_0 = "no_buffer_run0.melt.local"; + auto text_files = text_dump_filename(base_name); + auto compressed_files = compressed_dump_filename(base_name); + auto text_file_0 = text_dump_filename(base_name_0); + auto compressed_file_0 = compressed_dump_filename(base_name_0); + const auto *fields = "index c_comp[1]"; if (compression_style == "local/zstd") { generate_text_and_compressed_dump(text_files, compressed_files, fields, fields, "buffer no", @@ -106,13 +106,13 @@ TEST_F(DumpLocalCompressTest, compressed_with_time_run0) { if (!COMPRESS_EXECUTABLE) GTEST_SKIP(); - auto base_name = "with_time_run*.melt.local"; - auto base_name_0 = "with_time_run0.melt.local"; - auto text_files = text_dump_filename(base_name); - auto compressed_files = compressed_dump_filename(base_name); - auto text_file_0 = text_dump_filename(base_name_0); - auto compressed_file_0 = compressed_dump_filename(base_name_0); - auto fields = "index c_comp[1]"; + const auto *base_name = "with_time_run*.melt.local"; + const auto *base_name_0 = "with_time_run0.melt.local"; + auto text_files = text_dump_filename(base_name); + auto compressed_files = compressed_dump_filename(base_name); + auto text_file_0 = text_dump_filename(base_name_0); + auto compressed_file_0 = compressed_dump_filename(base_name_0); + const auto *fields = "index c_comp[1]"; if (compression_style == "local/zstd") { generate_text_and_compressed_dump(text_files, compressed_files, fields, fields, "time yes", @@ -139,13 +139,13 @@ TEST_F(DumpLocalCompressTest, compressed_with_units_run0) { if (!COMPRESS_EXECUTABLE) GTEST_SKIP(); - auto base_name = "with_units_run*.melt.local"; - auto base_name_0 = "with_units_run0.melt.local"; - auto text_files = text_dump_filename(base_name); - auto compressed_files = compressed_dump_filename(base_name); - auto text_file_0 = text_dump_filename(base_name_0); - auto compressed_file_0 = compressed_dump_filename(base_name_0); - auto fields = "index c_comp[1]"; + const auto *base_name = "with_units_run*.melt.local"; + const auto *base_name_0 = "with_units_run0.melt.local"; + auto text_files = text_dump_filename(base_name); + auto compressed_files = compressed_dump_filename(base_name); + auto text_file_0 = text_dump_filename(base_name_0); + auto compressed_file_0 = compressed_dump_filename(base_name_0); + const auto *fields = "index c_comp[1]"; if (compression_style == "local/zstd") { generate_text_and_compressed_dump(text_files, compressed_files, fields, fields, "units yes", @@ -173,13 +173,13 @@ TEST_F(DumpLocalCompressTest, compressed_triclinic_run0) if (!COMPRESS_EXECUTABLE) GTEST_SKIP(); enable_triclinic(); - auto base_name = "triclinic_run*.melt.local"; - auto base_name_0 = "triclinic_run0.melt.local"; - auto text_files = text_dump_filename(base_name); - auto compressed_files = compressed_dump_filename(base_name); - auto text_file_0 = text_dump_filename(base_name_0); - auto compressed_file_0 = compressed_dump_filename(base_name_0); - auto fields = "index c_comp[1]"; + const auto *base_name = "triclinic_run*.melt.local"; + const auto *base_name_0 = "triclinic_run0.melt.local"; + auto text_files = text_dump_filename(base_name); + auto compressed_files = compressed_dump_filename(base_name); + auto text_file_0 = text_dump_filename(base_name_0); + auto compressed_file_0 = compressed_dump_filename(base_name_0); + const auto *fields = "index c_comp[1]"; if (compression_style == "local/zstd") { generate_text_and_compressed_dump(text_files, compressed_files, fields, fields, "", @@ -206,16 +206,16 @@ TEST_F(DumpLocalCompressTest, compressed_multi_file_run1) { if (!COMPRESS_EXECUTABLE) GTEST_SKIP(); - auto base_name = "multi_file_run1_*.melt.local"; - auto base_name_0 = "multi_file_run1_0.melt.local"; - auto base_name_1 = "multi_file_run1_1.melt.local"; - auto text_file = text_dump_filename(base_name); - auto text_file_0 = text_dump_filename(base_name_0); - auto text_file_1 = text_dump_filename(base_name_1); - auto compressed_file = compressed_dump_filename(base_name); - auto compressed_file_0 = compressed_dump_filename(base_name_0); - auto compressed_file_1 = compressed_dump_filename(base_name_1); - auto fields = "index c_comp[1]"; + const auto *base_name = "multi_file_run1_*.melt.local"; + const auto *base_name_0 = "multi_file_run1_0.melt.local"; + const auto *base_name_1 = "multi_file_run1_1.melt.local"; + auto text_file = text_dump_filename(base_name); + auto text_file_0 = text_dump_filename(base_name_0); + auto text_file_1 = text_dump_filename(base_name_1); + auto compressed_file = compressed_dump_filename(base_name); + auto compressed_file_0 = compressed_dump_filename(base_name_0); + auto compressed_file_1 = compressed_dump_filename(base_name_1); + const auto *fields = "index c_comp[1]"; if (compression_style == "local/zstd") { generate_text_and_compressed_dump(text_file, compressed_file, fields, fields, "", @@ -248,16 +248,16 @@ TEST_F(DumpLocalCompressTest, compressed_multi_file_with_pad_run1) { if (!COMPRESS_EXECUTABLE) GTEST_SKIP(); - auto base_name = "multi_file_pad_run1_*.melt.local"; - auto base_name_0 = "multi_file_pad_run1_000.melt.local"; - auto base_name_1 = "multi_file_pad_run1_001.melt.local"; - auto text_file = text_dump_filename(base_name); - auto text_file_0 = text_dump_filename(base_name_0); - auto text_file_1 = text_dump_filename(base_name_1); - auto compressed_file = compressed_dump_filename(base_name); - auto compressed_file_0 = compressed_dump_filename(base_name_0); - auto compressed_file_1 = compressed_dump_filename(base_name_1); - auto fields = "index c_comp[1]"; + const auto *base_name = "multi_file_pad_run1_*.melt.local"; + const auto *base_name_0 = "multi_file_pad_run1_000.melt.local"; + const auto *base_name_1 = "multi_file_pad_run1_001.melt.local"; + auto text_file = text_dump_filename(base_name); + auto text_file_0 = text_dump_filename(base_name_0); + auto text_file_1 = text_dump_filename(base_name_1); + auto compressed_file = compressed_dump_filename(base_name); + auto compressed_file_0 = compressed_dump_filename(base_name_0); + auto compressed_file_1 = compressed_dump_filename(base_name_1); + const auto *fields = "index c_comp[1]"; generate_text_and_compressed_dump(text_file, compressed_file, fields, "pad 3", 1); @@ -290,19 +290,19 @@ TEST_F(DumpLocalCompressTest, compressed_multi_file_with_maxfiles_run1) { if (!COMPRESS_EXECUTABLE) GTEST_SKIP(); - auto base_name = "multi_file_maxfiles_run1_*.melt.local"; - auto base_name_0 = "multi_file_maxfiles_run1_0.melt.local"; - auto base_name_1 = "multi_file_maxfiles_run1_1.melt.local"; - auto base_name_2 = "multi_file_maxfiles_run1_2.melt.local"; - auto text_file = text_dump_filename(base_name); - auto text_file_0 = text_dump_filename(base_name_0); - auto text_file_1 = text_dump_filename(base_name_1); - auto text_file_2 = text_dump_filename(base_name_2); - auto compressed_file = compressed_dump_filename(base_name); - auto compressed_file_0 = compressed_dump_filename(base_name_0); - auto compressed_file_1 = compressed_dump_filename(base_name_1); - auto compressed_file_2 = compressed_dump_filename(base_name_2); - auto fields = "index c_comp[1]"; + const auto *base_name = "multi_file_maxfiles_run1_*.melt.local"; + const auto *base_name_0 = "multi_file_maxfiles_run1_0.melt.local"; + const auto *base_name_1 = "multi_file_maxfiles_run1_1.melt.local"; + const auto *base_name_2 = "multi_file_maxfiles_run1_2.melt.local"; + auto text_file = text_dump_filename(base_name); + auto text_file_0 = text_dump_filename(base_name_0); + auto text_file_1 = text_dump_filename(base_name_1); + auto text_file_2 = text_dump_filename(base_name_2); + auto compressed_file = compressed_dump_filename(base_name); + auto compressed_file_0 = compressed_dump_filename(base_name_0); + auto compressed_file_1 = compressed_dump_filename(base_name_1); + auto compressed_file_2 = compressed_dump_filename(base_name_2); + const auto *fields = "index c_comp[1]"; generate_text_and_compressed_dump(text_file, compressed_file, fields, "maxfiles 2", 2); @@ -337,7 +337,7 @@ TEST_F(DumpLocalCompressTest, compressed_modify_bad_param) { if (compression_style != "local/gz") GTEST_SKIP(); - auto fields = "index c_comp[1]"; + const auto *fields = "index c_comp[1]"; BEGIN_HIDE_OUTPUT(); command(fmt::format("dump id1 all {} 1 {} {}", compression_style, @@ -353,7 +353,7 @@ TEST_F(DumpLocalCompressTest, compressed_modify_multi_bad_param) { if (compression_style != "local/gz") GTEST_SKIP(); - auto fields = "index c_comp[1]"; + const auto *fields = "index c_comp[1]"; BEGIN_HIDE_OUTPUT(); command(fmt::format("dump id1 all {} 1 {} {}", compression_style, @@ -370,10 +370,10 @@ TEST_F(DumpLocalCompressTest, compressed_modify_clevel_run0) { if (!COMPRESS_EXECUTABLE) GTEST_SKIP(); - auto base_name = "modify_clevel_run0.melt.local"; - auto text_file = text_dump_filename(base_name); - auto compressed_file = compressed_dump_filename(base_name); - auto fields = "index c_comp[1]"; + const auto *base_name = "modify_clevel_run0.melt.local"; + auto text_file = text_dump_filename(base_name); + auto compressed_file = compressed_dump_filename(base_name); + const auto *fields = "index c_comp[1]"; generate_text_and_compressed_dump(text_file, compressed_file, fields, fields, "", "compression_level 3", 0); diff --git a/unittest/formats/test_dump_netcdf.cpp b/unittest/formats/test_dump_netcdf.cpp index e7288377ae..d85172c70d 100644 --- a/unittest/formats/test_dump_netcdf.cpp +++ b/unittest/formats/test_dump_netcdf.cpp @@ -91,8 +91,8 @@ public: TEST_F(DumpNetCDFTest, run0_plain) { if (!lammps_has_style(lmp, "dump", "netcdf")) GTEST_SKIP(); - auto dump_file = dump_filename("run0"); - auto fields = "id type proc procp1 mass x y z ix iy iz xu yu zu vx vy vz fx fy fz"; + auto dump_file = dump_filename("run0"); + const auto *fields = "id type proc procp1 mass x y z ix iy iz xu yu zu vx vy vz fx fy fz"; set_style("netcdf"); generate_dump(dump_file, fields, "", 0); @@ -285,8 +285,8 @@ TEST_F(DumpNetCDFTest, run0_plain) TEST_F(DumpNetCDFTest, run0_mpi) { if (!lammps_has_style(lmp, "dump", "netcdf/mpiio")) GTEST_SKIP(); - auto dump_file = dump_filename("mpi0"); - auto fields = "id type proc procp1 mass x y z ix iy iz xu yu zu vx vy vz fx fy fz"; + auto dump_file = dump_filename("mpi0"); + const auto *fields = "id type proc procp1 mass x y z ix iy iz xu yu zu vx vy vz fx fy fz"; set_style("netcdf/mpiio"); generate_dump(dump_file, fields, "", 0); diff --git a/unittest/formats/test_dump_xyz_compressed.cpp b/unittest/formats/test_dump_xyz_compressed.cpp index ec47f0e180..78bc70489a 100644 --- a/unittest/formats/test_dump_xyz_compressed.cpp +++ b/unittest/formats/test_dump_xyz_compressed.cpp @@ -31,12 +31,12 @@ TEST_F(DumpXYZCompressTest, compressed_run0) { if (!COMPRESS_EXECUTABLE) GTEST_SKIP(); - auto base_name = "run*.melt.xyz"; - auto base_name_0 = "run0.melt.xyz"; - auto text_files = text_dump_filename(base_name); - auto compressed_files = compressed_dump_filename(base_name); - auto text_file_0 = text_dump_filename(base_name_0); - auto compressed_file_0 = compressed_dump_filename(base_name_0); + const auto *base_name = "run*.melt.xyz"; + const auto *base_name_0 = "run0.melt.xyz"; + auto text_files = text_dump_filename(base_name); + auto compressed_files = compressed_dump_filename(base_name); + auto text_file_0 = text_dump_filename(base_name_0); + auto compressed_file_0 = compressed_dump_filename(base_name_0); if (compression_style == "xyz/zstd") { generate_text_and_compressed_dump(text_files, compressed_files, "", "", "", "checksum yes", @@ -63,12 +63,12 @@ TEST_F(DumpXYZCompressTest, compressed_no_buffer_run0) { if (!COMPRESS_EXECUTABLE) GTEST_SKIP(); - auto base_name = "no_buffer_run*.melt.xyz"; - auto base_name_0 = "no_buffer_run0.melt.xyz"; - auto text_files = text_dump_filename(base_name); - auto compressed_files = compressed_dump_filename(base_name); - auto text_file_0 = text_dump_filename(base_name_0); - auto compressed_file_0 = compressed_dump_filename(base_name_0); + const auto *base_name = "no_buffer_run*.melt.xyz"; + const auto *base_name_0 = "no_buffer_run0.melt.xyz"; + auto text_files = text_dump_filename(base_name); + auto compressed_files = compressed_dump_filename(base_name); + auto text_file_0 = text_dump_filename(base_name_0); + auto compressed_file_0 = compressed_dump_filename(base_name_0); if (compression_style == "xyz/zstd") { generate_text_and_compressed_dump(text_files, compressed_files, "", "", "buffer no", @@ -95,15 +95,15 @@ TEST_F(DumpXYZCompressTest, compressed_multi_file_run1) { if (!COMPRESS_EXECUTABLE) GTEST_SKIP(); - auto base_name = "multi_file_run1_*.melt.xyz"; - auto base_name_0 = "multi_file_run1_0.melt.xyz"; - auto base_name_1 = "multi_file_run1_1.melt.xyz"; - auto text_file = text_dump_filename(base_name); - auto text_file_0 = text_dump_filename(base_name_0); - auto text_file_1 = text_dump_filename(base_name_1); - auto compressed_file = compressed_dump_filename(base_name); - auto compressed_file_0 = compressed_dump_filename(base_name_0); - auto compressed_file_1 = compressed_dump_filename(base_name_1); + const auto *base_name = "multi_file_run1_*.melt.xyz"; + const auto *base_name_0 = "multi_file_run1_0.melt.xyz"; + const auto *base_name_1 = "multi_file_run1_1.melt.xyz"; + auto text_file = text_dump_filename(base_name); + auto text_file_0 = text_dump_filename(base_name_0); + auto text_file_1 = text_dump_filename(base_name_1); + auto compressed_file = compressed_dump_filename(base_name); + auto compressed_file_0 = compressed_dump_filename(base_name_0); + auto compressed_file_1 = compressed_dump_filename(base_name_1); if (compression_style == "xyz/zstd") { generate_text_and_compressed_dump(text_file, compressed_file, "", "", "", "checksum no", 1); @@ -135,15 +135,15 @@ TEST_F(DumpXYZCompressTest, compressed_multi_file_with_pad_run1) { if (!COMPRESS_EXECUTABLE) GTEST_SKIP(); - auto base_name = "multi_file_pad_run1_*.melt.xyz"; - auto base_name_0 = "multi_file_pad_run1_000.melt.xyz"; - auto base_name_1 = "multi_file_pad_run1_001.melt.xyz"; - auto text_file = text_dump_filename(base_name); - auto text_file_0 = text_dump_filename(base_name_0); - auto text_file_1 = text_dump_filename(base_name_1); - auto compressed_file = compressed_dump_filename(base_name); - auto compressed_file_0 = compressed_dump_filename(base_name_0); - auto compressed_file_1 = compressed_dump_filename(base_name_1); + const auto *base_name = "multi_file_pad_run1_*.melt.xyz"; + const auto *base_name_0 = "multi_file_pad_run1_000.melt.xyz"; + const auto *base_name_1 = "multi_file_pad_run1_001.melt.xyz"; + auto text_file = text_dump_filename(base_name); + auto text_file_0 = text_dump_filename(base_name_0); + auto text_file_1 = text_dump_filename(base_name_1); + auto compressed_file = compressed_dump_filename(base_name); + auto compressed_file_0 = compressed_dump_filename(base_name_0); + auto compressed_file_1 = compressed_dump_filename(base_name_1); generate_text_and_compressed_dump(text_file, compressed_file, "", "pad 3", 1); @@ -176,18 +176,18 @@ TEST_F(DumpXYZCompressTest, compressed_multi_file_with_maxfiles_run1) { if (!COMPRESS_EXECUTABLE) GTEST_SKIP(); - auto base_name = "multi_file_maxfiles_run1_*.melt.xyz"; - auto base_name_0 = "multi_file_maxfiles_run1_0.melt.xyz"; - auto base_name_1 = "multi_file_maxfiles_run1_1.melt.xyz"; - auto base_name_2 = "multi_file_maxfiles_run1_2.melt.xyz"; - auto text_file = text_dump_filename(base_name); - auto text_file_0 = text_dump_filename(base_name_0); - auto text_file_1 = text_dump_filename(base_name_1); - auto text_file_2 = text_dump_filename(base_name_2); - auto compressed_file = compressed_dump_filename(base_name); - auto compressed_file_0 = compressed_dump_filename(base_name_0); - auto compressed_file_1 = compressed_dump_filename(base_name_1); - auto compressed_file_2 = compressed_dump_filename(base_name_2); + const auto *base_name = "multi_file_maxfiles_run1_*.melt.xyz"; + const auto *base_name_0 = "multi_file_maxfiles_run1_0.melt.xyz"; + const auto *base_name_1 = "multi_file_maxfiles_run1_1.melt.xyz"; + const auto *base_name_2 = "multi_file_maxfiles_run1_2.melt.xyz"; + auto text_file = text_dump_filename(base_name); + auto text_file_0 = text_dump_filename(base_name_0); + auto text_file_1 = text_dump_filename(base_name_1); + auto text_file_2 = text_dump_filename(base_name_2); + auto compressed_file = compressed_dump_filename(base_name); + auto compressed_file_0 = compressed_dump_filename(base_name_0); + auto compressed_file_1 = compressed_dump_filename(base_name_1); + auto compressed_file_2 = compressed_dump_filename(base_name_2); generate_text_and_compressed_dump(text_file, compressed_file, "", "maxfiles 2", 2); @@ -250,9 +250,9 @@ TEST_F(DumpXYZCompressTest, compressed_modify_clevel_run0) { if (!COMPRESS_EXECUTABLE) GTEST_SKIP(); - auto base_name = "modify_clevel_run0.melt.xyz"; - auto text_file = text_dump_filename(base_name); - auto compressed_file = compressed_dump_filename(base_name); + const auto *base_name = "modify_clevel_run0.melt.xyz"; + auto text_file = text_dump_filename(base_name); + auto compressed_file = compressed_dump_filename(base_name); generate_text_and_compressed_dump(text_file, compressed_file, "", "", "", "compression_level 3", 0); diff --git a/unittest/formats/test_file_operations.cpp b/unittest/formats/test_file_operations.cpp index 19d7a0999b..cd08650bf8 100644 --- a/unittest/formats/test_file_operations.cpp +++ b/unittest/formats/test_file_operations.cpp @@ -511,10 +511,10 @@ TEST_F(FileOperationsTest, read_data_fix) lmp->atom->molecule[1] = 6; lmp->atom->molecule[2] = 5; lmp->atom->molecule[3] = 6; - lmp->atom->tag[0] = 9; - lmp->atom->tag[1] = 6; - lmp->atom->tag[2] = 7; - lmp->atom->tag[3] = 8; + lmp->atom->tag[0] = 9; + lmp->atom->tag[1] = 6; + lmp->atom->tag[2] = 7; + lmp->atom->tag[3] = 8; lmp->atom->map_init(1); lmp->atom->map_set(); command("write_data test_mol_id_merge.data"); diff --git a/unittest/formats/test_image_flags.cpp b/unittest/formats/test_image_flags.cpp index c915a27c3e..06976e0684 100644 --- a/unittest/formats/test_image_flags.cpp +++ b/unittest/formats/test_image_flags.cpp @@ -61,10 +61,10 @@ protected: TEST_F(ImageFlagsTest, change_box) { - auto image = lmp->atom->image; - int imx = (image[0] & IMGMASK) - IMGMAX; - int imy = (image[0] >> IMGBITS & IMGMASK) - IMGMAX; - int imz = (image[0] >> IMG2BITS) - IMGMAX; + auto *image = lmp->atom->image; + int imx = (image[0] & IMGMASK) - IMGMAX; + int imy = (image[0] >> IMGBITS & IMGMASK) - IMGMAX; + int imz = (image[0] >> IMG2BITS) - IMGMAX; ASSERT_EQ(imx, -1); ASSERT_EQ(imy, 2); @@ -153,10 +153,10 @@ TEST_F(ImageFlagsTest, read_data) command("read_data test_image_flags.data"); END_HIDE_OUTPUT(); - auto image = lmp->atom->image; - int imx = (image[0] & IMGMASK) - IMGMAX; - int imy = (image[0] >> IMGBITS & IMGMASK) - IMGMAX; - int imz = (image[0] >> IMG2BITS) - IMGMAX; + auto *image = lmp->atom->image; + int imx = (image[0] & IMGMASK) - IMGMAX; + int imy = (image[0] >> IMGBITS & IMGMASK) - IMGMAX; + int imz = (image[0] >> IMG2BITS) - IMGMAX; ASSERT_EQ(imx, -1); ASSERT_EQ(imy, 2); diff --git a/unittest/formats/test_potential_file_reader.cpp b/unittest/formats/test_potential_file_reader.cpp index 3d14a73d31..b1ebcbdd7c 100644 --- a/unittest/formats/test_potential_file_reader.cpp +++ b/unittest/formats/test_potential_file_reader.cpp @@ -67,7 +67,7 @@ TEST_F(PotentialFileReaderTest, Sw_native) PotentialFileReader reader(lmp, "Si.sw", "Stillinger-Weber"); END_HIDE_OUTPUT(); - auto line = reader.next_line(PairSW::NPARAMS_PER_LINE); + auto *line = reader.next_line(PairSW::NPARAMS_PER_LINE); ASSERT_EQ(utils::count_words(line), PairSW::NPARAMS_PER_LINE); } @@ -79,7 +79,7 @@ TEST_F(PotentialFileReaderTest, Sw_conv) PotentialFileReader reader(lmp, "Si.sw", "Stillinger-Weber", utils::METAL2REAL); END_HIDE_OUTPUT(); - auto line = reader.next_line(PairSW::NPARAMS_PER_LINE); + auto *line = reader.next_line(PairSW::NPARAMS_PER_LINE); ASSERT_EQ(utils::count_words(line), PairSW::NPARAMS_PER_LINE); } @@ -101,7 +101,7 @@ TEST_F(PotentialFileReaderTest, Comb) PotentialFileReader reader(lmp, "ffield.comb", "COMB"); END_HIDE_OUTPUT(); - auto line = reader.next_line(PairComb::NPARAMS_PER_LINE); + auto *line = reader.next_line(PairComb::NPARAMS_PER_LINE); ASSERT_EQ(utils::count_words(line), PairComb::NPARAMS_PER_LINE); } @@ -112,7 +112,7 @@ TEST_F(PotentialFileReaderTest, Comb3) PotentialFileReader reader(lmp, "ffield.comb3", "COMB3"); END_HIDE_OUTPUT(); - auto line = reader.next_line(PairComb3::NPARAMS_PER_LINE); + auto *line = reader.next_line(PairComb3::NPARAMS_PER_LINE); ASSERT_EQ(utils::count_words(line), PairComb3::NPARAMS_PER_LINE); } @@ -123,7 +123,7 @@ TEST_F(PotentialFileReaderTest, Tersoff) PotentialFileReader reader(lmp, "Si.tersoff", "Tersoff"); END_HIDE_OUTPUT(); - auto line = reader.next_line(PairTersoff::NPARAMS_PER_LINE); + auto *line = reader.next_line(PairTersoff::NPARAMS_PER_LINE); ASSERT_EQ(utils::count_words(line), PairTersoff::NPARAMS_PER_LINE); } @@ -134,7 +134,7 @@ TEST_F(PotentialFileReaderTest, TersoffMod) PotentialFileReader reader(lmp, "Si.tersoff.mod", "Tersoff/Mod"); END_HIDE_OUTPUT(); - auto line = reader.next_line(PairTersoffMOD::NPARAMS_PER_LINE); + auto *line = reader.next_line(PairTersoffMOD::NPARAMS_PER_LINE); ASSERT_EQ(utils::count_words(line), PairTersoffMOD::NPARAMS_PER_LINE); } @@ -145,7 +145,7 @@ TEST_F(PotentialFileReaderTest, TersoffModC) PotentialFileReader reader(lmp, "Si.tersoff.modc", "Tersoff/ModC"); END_HIDE_OUTPUT(); - auto line = reader.next_line(PairTersoffMODC::NPARAMS_PER_LINE); + auto *line = reader.next_line(PairTersoffMODC::NPARAMS_PER_LINE); ASSERT_EQ(utils::count_words(line), PairTersoffMODC::NPARAMS_PER_LINE); } @@ -156,7 +156,7 @@ TEST_F(PotentialFileReaderTest, TersoffTable) PotentialFileReader reader(lmp, "Si.tersoff", "TersoffTable"); END_HIDE_OUTPUT(); - auto line = reader.next_line(PairTersoffTable::NPARAMS_PER_LINE); + auto *line = reader.next_line(PairTersoffTable::NPARAMS_PER_LINE); ASSERT_EQ(utils::count_words(line), PairTersoffTable::NPARAMS_PER_LINE); } @@ -167,7 +167,7 @@ TEST_F(PotentialFileReaderTest, TersoffZBL) PotentialFileReader reader(lmp, "SiC.tersoff.zbl", "Tersoff/ZBL"); END_HIDE_OUTPUT(); - auto line = reader.next_line(PairTersoffZBL::NPARAMS_PER_LINE); + auto *line = reader.next_line(PairTersoffZBL::NPARAMS_PER_LINE); ASSERT_EQ(utils::count_words(line), PairTersoffZBL::NPARAMS_PER_LINE); } @@ -178,7 +178,7 @@ TEST_F(PotentialFileReaderTest, GW) PotentialFileReader reader(lmp, "SiC.gw", "GW"); END_HIDE_OUTPUT(); - auto line = reader.next_line(PairGW::NPARAMS_PER_LINE); + auto *line = reader.next_line(PairGW::NPARAMS_PER_LINE); ASSERT_EQ(utils::count_words(line), PairGW::NPARAMS_PER_LINE); } @@ -189,7 +189,7 @@ TEST_F(PotentialFileReaderTest, GWZBL) PotentialFileReader reader(lmp, "SiC.gw.zbl", "GW/ZBL"); END_HIDE_OUTPUT(); - auto line = reader.next_line(PairGWZBL::NPARAMS_PER_LINE); + auto *line = reader.next_line(PairGWZBL::NPARAMS_PER_LINE); ASSERT_EQ(utils::count_words(line), PairGWZBL::NPARAMS_PER_LINE); } @@ -200,7 +200,7 @@ TEST_F(PotentialFileReaderTest, Nb3bHarmonic) PotentialFileReader reader(lmp, "MOH.nb3b.harmonic", "NB3B Harmonic"); END_HIDE_OUTPUT(); - auto line = reader.next_line(PairNb3bHarmonic::NPARAMS_PER_LINE); + auto *line = reader.next_line(PairNb3bHarmonic::NPARAMS_PER_LINE); ASSERT_EQ(utils::count_words(line), PairNb3bHarmonic::NPARAMS_PER_LINE); } @@ -211,7 +211,7 @@ TEST_F(PotentialFileReaderTest, Vashishta) PotentialFileReader reader(lmp, "SiC.vashishta", "Vashishta"); END_HIDE_OUTPUT(); - auto line = reader.next_line(PairVashishta::NPARAMS_PER_LINE); + auto *line = reader.next_line(PairVashishta::NPARAMS_PER_LINE); ASSERT_EQ(utils::count_words(line), PairVashishta::NPARAMS_PER_LINE); } diff --git a/unittest/formats/test_text_file_reader.cpp b/unittest/formats/test_text_file_reader.cpp index 8615b71b2a..687f6539f0 100644 --- a/unittest/formats/test_text_file_reader.cpp +++ b/unittest/formats/test_text_file_reader.cpp @@ -61,8 +61,8 @@ protected: TEST_F(TextFileReaderTest, nofile) { - ASSERT_THROW({ TextFileReader reader("text_reader_noexist.file", "test"); }, - FileReaderException); + ASSERT_THROW( + { TextFileReader reader("text_reader_noexist.file", "test"); }, FileReaderException); } // this test cannot work on windows due to its non unix-like permission system @@ -76,8 +76,8 @@ TEST_F(TextFileReaderTest, permissions) fputs("word\n", fp); fclose(fp); chmod("text_reader_noperms.file", 0); - ASSERT_THROW({ TextFileReader reader("text_reader_noperms.file", "test"); }, - FileReaderException); + ASSERT_THROW( + { TextFileReader reader("text_reader_noperms.file", "test"); }, FileReaderException); platform::unlink("text_reader_noperms.file"); } #endif @@ -93,8 +93,8 @@ TEST_F(TextFileReaderTest, usefp) FILE *fp = fopen("text_reader_two.file", "r"); ASSERT_NE(fp, nullptr); - auto reader = new TextFileReader(fp, "test"); - auto line = reader->next_line(); + auto *reader = new TextFileReader(fp, "test"); + auto *line = reader->next_line(); ASSERT_STREQ(line, "4 "); line = reader->next_line(1); ASSERT_STREQ(line, "4 0.5 "); @@ -120,7 +120,7 @@ TEST_F(TextFileReaderTest, comments) test_files(); TextFileReader reader("text_reader_two.file", "test"); reader.ignore_comments = true; - auto line = reader.next_line(); + auto *line = reader.next_line(); ASSERT_STREQ(line, "4 "); line = reader.next_line(1); ASSERT_STREQ(line, "4 0.5 "); @@ -141,7 +141,7 @@ TEST_F(TextFileReaderTest, nocomments) test_files(); TextFileReader reader("text_reader_one.file", "test"); reader.ignore_comments = false; - auto line = reader.next_line(); + auto *line = reader.next_line(); ASSERT_STREQ(line, "# test file 1 for text file reader\n"); line = reader.next_line(1); ASSERT_STREQ(line, "one\n"); diff --git a/unittest/fortran/wrap_configuration.cpp b/unittest/fortran/wrap_configuration.cpp index 08974d8a08..0161a80125 100644 --- a/unittest/fortran/wrap_configuration.cpp +++ b/unittest/fortran/wrap_configuration.cpp @@ -136,8 +136,8 @@ TEST_F(LAMMPS_configuration, has_package) }; // clang-format on - for (std::size_t i = 0; i < pkg_name.size(); i++) - EXPECT_EQ(f_lammps_has_package(pkg_name[i].c_str()), Info::has_package(pkg_name[i])); + for (const auto &i : pkg_name) + EXPECT_EQ(f_lammps_has_package(i.c_str()), Info::has_package(i)); } TEST_F(LAMMPS_configuration, package_count) diff --git a/unittest/fortran/wrap_create.cpp b/unittest/fortran/wrap_create.cpp index 260e6ba1f1..81c40f9700 100644 --- a/unittest/fortran/wrap_create.cpp +++ b/unittest/fortran/wrap_create.cpp @@ -34,7 +34,7 @@ TEST(open_no_mpi, no_args) void *handle = f_lammps_no_mpi_no_args(); std::string output = ::testing::internal::GetCapturedStdout(); EXPECT_STREQ(output.substr(0, 6).c_str(), "LAMMPS"); - LAMMPS_NS::LAMMPS *lmp = (LAMMPS_NS::LAMMPS *)handle; + auto *lmp = (LAMMPS_NS::LAMMPS *)handle; EXPECT_EQ(lmp->world, MPI_COMM_WORLD); EXPECT_EQ(lmp->infile, stdin); EXPECT_EQ(lmp->screen, stdout); @@ -51,7 +51,7 @@ TEST(open_no_mpi, with_args) void *handle = f_lammps_no_mpi_with_args(); std::string output = ::testing::internal::GetCapturedStdout(); EXPECT_STREQ(output.substr(0, 6).c_str(), "LAMMPS"); - LAMMPS_NS::LAMMPS *lmp = (LAMMPS_NS::LAMMPS *)handle; + auto *lmp = (LAMMPS_NS::LAMMPS *)handle; EXPECT_EQ(lmp->infile, stdin); EXPECT_EQ(lmp->screen, stdout); EXPECT_EQ(lmp->logfile, nullptr); @@ -70,10 +70,10 @@ TEST(fortran_open, no_args) void *handle = f_lammps_open_no_args(); std::string output = ::testing::internal::GetCapturedStdout(); EXPECT_STREQ(output.substr(0, 6).c_str(), "LAMMPS"); - LAMMPS_NS::LAMMPS *lmp = (LAMMPS_NS::LAMMPS *)handle; + auto *lmp = (LAMMPS_NS::LAMMPS *)handle; - int f_comm = f_lammps_get_comm(); - MPI_Comm mycomm = MPI_Comm_f2c(f_comm); + int f_comm = f_lammps_get_comm(); + auto mycomm = MPI_Comm_f2c(f_comm); EXPECT_EQ(lmp->world, mycomm); EXPECT_EQ(lmp->infile, stdin); EXPECT_EQ(lmp->screen, stdout); @@ -90,10 +90,10 @@ TEST(fortran_open, with_args) void *handle = f_lammps_open_with_args(); std::string output = ::testing::internal::GetCapturedStdout(); EXPECT_STREQ(output.substr(0, 6).c_str(), "LAMMPS"); - LAMMPS_NS::LAMMPS *lmp = (LAMMPS_NS::LAMMPS *)handle; + auto *lmp = (LAMMPS_NS::LAMMPS *)handle; - int f_comm = f_lammps_get_comm(); - MPI_Comm mycomm = MPI_Comm_f2c(f_comm); + int f_comm = f_lammps_get_comm(); + auto mycomm = MPI_Comm_f2c(f_comm); EXPECT_EQ(lmp->world, mycomm); EXPECT_EQ(lmp->infile, stdin); EXPECT_EQ(lmp->screen, stdout); diff --git a/unittest/fortran/wrap_create_atoms.cpp b/unittest/fortran/wrap_create_atoms.cpp index 3addbcf070..4d4692bd5e 100644 --- a/unittest/fortran/wrap_create_atoms.cpp +++ b/unittest/fortran/wrap_create_atoms.cpp @@ -1,8 +1,8 @@ // unit tests for creating atoms in a LAMMPS instance through the Fortran wrapper +#include "atom.h" #include "lammps.h" #include "library.h" -#include "atom.h" #include #include #include @@ -56,39 +56,39 @@ TEST_F(LAMMPS_create_atoms, create_three) #endif double **x, **v; EXPECT_EQ(lmp->atom->nlocal, 3); - tag = lmp->atom->tag; + tag = lmp->atom->tag; image = lmp->atom->image; - x = lmp->atom->x; - v = lmp->atom->v; + x = lmp->atom->x; + v = lmp->atom->v; f_lammps_create_three_atoms(); EXPECT_EQ(lmp->atom->nlocal, 6); for (int i = 0; i < lmp->atom->nlocal; i++) { if (tag[i] == 4) { - EXPECT_EQ(image[i],lammps_encode_image_flags(1,-1,3)); - EXPECT_DOUBLE_EQ(x[i][0],1.0); - EXPECT_DOUBLE_EQ(x[i][1],1.8); - EXPECT_DOUBLE_EQ(x[i][2],2.718281828); - EXPECT_DOUBLE_EQ(v[i][0],0.0); - EXPECT_DOUBLE_EQ(v[i][1],1.0); - EXPECT_DOUBLE_EQ(v[i][2],-1.0); + EXPECT_EQ(image[i], lammps_encode_image_flags(1, -1, 3)); + EXPECT_DOUBLE_EQ(x[i][0], 1.0); + EXPECT_DOUBLE_EQ(x[i][1], 1.8); + EXPECT_DOUBLE_EQ(x[i][2], 2.718281828); + EXPECT_DOUBLE_EQ(v[i][0], 0.0); + EXPECT_DOUBLE_EQ(v[i][1], 1.0); + EXPECT_DOUBLE_EQ(v[i][2], -1.0); } if (tag[i] == 5) { - EXPECT_EQ(image[i],lammps_encode_image_flags(-2,-2,1)); - EXPECT_DOUBLE_EQ(x[i][0],1.8); - EXPECT_DOUBLE_EQ(x[i][1],0.1); - EXPECT_DOUBLE_EQ(x[i][2],1.8); - EXPECT_DOUBLE_EQ(v[i][0],1.0); - EXPECT_DOUBLE_EQ(v[i][1],-1.0); - EXPECT_DOUBLE_EQ(v[i][2],3.0); + EXPECT_EQ(image[i], lammps_encode_image_flags(-2, -2, 1)); + EXPECT_DOUBLE_EQ(x[i][0], 1.8); + EXPECT_DOUBLE_EQ(x[i][1], 0.1); + EXPECT_DOUBLE_EQ(x[i][2], 1.8); + EXPECT_DOUBLE_EQ(v[i][0], 1.0); + EXPECT_DOUBLE_EQ(v[i][1], -1.0); + EXPECT_DOUBLE_EQ(v[i][2], 3.0); } if (tag[i] == 6) { - EXPECT_EQ(image[i],lammps_encode_image_flags(-2,0,0)); - EXPECT_DOUBLE_EQ(x[i][0],0.6); - EXPECT_DOUBLE_EQ(x[i][1],0.8); - EXPECT_DOUBLE_EQ(x[i][2],2.2); - EXPECT_DOUBLE_EQ(v[i][0],0.1); - EXPECT_DOUBLE_EQ(v[i][1],0.2); - EXPECT_DOUBLE_EQ(v[i][2],-0.2); + EXPECT_EQ(image[i], lammps_encode_image_flags(-2, 0, 0)); + EXPECT_DOUBLE_EQ(x[i][0], 0.6); + EXPECT_DOUBLE_EQ(x[i][1], 0.8); + EXPECT_DOUBLE_EQ(x[i][2], 2.2); + EXPECT_DOUBLE_EQ(v[i][0], 0.1); + EXPECT_DOUBLE_EQ(v[i][1], 0.2); + EXPECT_DOUBLE_EQ(v[i][2], -0.2); } } }; @@ -106,30 +106,30 @@ TEST_F(LAMMPS_create_atoms, create_two_more) EXPECT_EQ(lmp->atom->nlocal, 6); f_lammps_create_two_more(); EXPECT_EQ(lmp->atom->nlocal, 8); - tag = lmp->atom->tag; + tag = lmp->atom->tag; image = lmp->atom->image; - x = lmp->atom->x; - v = lmp->atom->v; + x = lmp->atom->x; + v = lmp->atom->v; for (int i = 0; i < lmp->atom->nlocal; i++) { if (tag[i] == 7) { - EXPECT_EQ(image[i],lammps_encode_image_flags(0,0,0)); - EXPECT_DOUBLE_EQ(x[i][0],0.1); - EXPECT_DOUBLE_EQ(x[i][1],1.9); - EXPECT_DOUBLE_EQ(x[i][2],3.8); - EXPECT_DOUBLE_EQ(v[i][0],0.0); - EXPECT_DOUBLE_EQ(v[i][1],0.0); - EXPECT_DOUBLE_EQ(v[i][2],0.0); + EXPECT_EQ(image[i], lammps_encode_image_flags(0, 0, 0)); + EXPECT_DOUBLE_EQ(x[i][0], 0.1); + EXPECT_DOUBLE_EQ(x[i][1], 1.9); + EXPECT_DOUBLE_EQ(x[i][2], 3.8); + EXPECT_DOUBLE_EQ(v[i][0], 0.0); + EXPECT_DOUBLE_EQ(v[i][1], 0.0); + EXPECT_DOUBLE_EQ(v[i][2], 0.0); } if (tag[i] == 8) { - EXPECT_EQ(image[i],lammps_encode_image_flags(0,0,0)); - EXPECT_DOUBLE_EQ(x[i][0],1.2); - EXPECT_DOUBLE_EQ(x[i][1],2.1); - EXPECT_DOUBLE_EQ(x[i][2],1.25); - EXPECT_DOUBLE_EQ(v[i][0],0.0); - EXPECT_DOUBLE_EQ(v[i][1],0.0); - EXPECT_DOUBLE_EQ(v[i][2],0.0); + EXPECT_EQ(image[i], lammps_encode_image_flags(0, 0, 0)); + EXPECT_DOUBLE_EQ(x[i][0], 1.2); + EXPECT_DOUBLE_EQ(x[i][1], 2.1); + EXPECT_DOUBLE_EQ(x[i][2], 1.25); + EXPECT_DOUBLE_EQ(v[i][0], 0.0); + EXPECT_DOUBLE_EQ(v[i][1], 0.0); + EXPECT_DOUBLE_EQ(v[i][2], 0.0); } - } + } }; TEST_F(LAMMPS_create_atoms, create_two_more_bigsmall) @@ -149,30 +149,30 @@ TEST_F(LAMMPS_create_atoms, create_two_more_bigsmall) f_lammps_create_two_more_small(); #endif EXPECT_EQ(lmp->atom->nlocal, 8); - tag = lmp->atom->tag; + tag = lmp->atom->tag; image = lmp->atom->image; - x = lmp->atom->x; - v = lmp->atom->v; + x = lmp->atom->x; + v = lmp->atom->v; for (int i = 0; i < lmp->atom->nlocal; i++) { if (tag[i] == 7) { - EXPECT_EQ(image[i],lammps_encode_image_flags(-1,0,0)); - EXPECT_DOUBLE_EQ(x[i][0],1.2); - EXPECT_DOUBLE_EQ(x[i][1],2.1); - EXPECT_DOUBLE_EQ(x[i][2],1.25); - EXPECT_DOUBLE_EQ(v[i][0],0.0); - EXPECT_DOUBLE_EQ(v[i][1],0.0); - EXPECT_DOUBLE_EQ(v[i][2],0.0); + EXPECT_EQ(image[i], lammps_encode_image_flags(-1, 0, 0)); + EXPECT_DOUBLE_EQ(x[i][0], 1.2); + EXPECT_DOUBLE_EQ(x[i][1], 2.1); + EXPECT_DOUBLE_EQ(x[i][2], 1.25); + EXPECT_DOUBLE_EQ(v[i][0], 0.0); + EXPECT_DOUBLE_EQ(v[i][1], 0.0); + EXPECT_DOUBLE_EQ(v[i][2], 0.0); } if (tag[i] == 8) { - EXPECT_EQ(image[i],lammps_encode_image_flags(1,0,0)); - EXPECT_DOUBLE_EQ(x[i][0],0.1); - EXPECT_DOUBLE_EQ(x[i][1],1.9); - EXPECT_DOUBLE_EQ(x[i][2],3.8); - EXPECT_DOUBLE_EQ(v[i][0],0.0); - EXPECT_DOUBLE_EQ(v[i][1],0.0); - EXPECT_DOUBLE_EQ(v[i][2],0.0); + EXPECT_EQ(image[i], lammps_encode_image_flags(1, 0, 0)); + EXPECT_DOUBLE_EQ(x[i][0], 0.1); + EXPECT_DOUBLE_EQ(x[i][1], 1.9); + EXPECT_DOUBLE_EQ(x[i][2], 3.8); + EXPECT_DOUBLE_EQ(v[i][0], 0.0); + EXPECT_DOUBLE_EQ(v[i][1], 0.0); + EXPECT_DOUBLE_EQ(v[i][2], 0.0); } - } + } }; TEST_F(LAMMPS_create_atoms, create_two_more_bigsmall2) @@ -192,28 +192,28 @@ TEST_F(LAMMPS_create_atoms, create_two_more_bigsmall2) f_lammps_create_two_more_small2(); #endif EXPECT_EQ(lmp->atom->nlocal, 8); - tag = lmp->atom->tag; + tag = lmp->atom->tag; image = lmp->atom->image; - x = lmp->atom->x; - v = lmp->atom->v; + x = lmp->atom->x; + v = lmp->atom->v; for (int i = 0; i < lmp->atom->nlocal; i++) { if (tag[i] == 7) { - EXPECT_EQ(image[i],lammps_encode_image_flags(0,0,0)); - EXPECT_DOUBLE_EQ(x[i][0],1.2); - EXPECT_DOUBLE_EQ(x[i][1],2.1); - EXPECT_DOUBLE_EQ(x[i][2],1.25); - EXPECT_DOUBLE_EQ(v[i][0],0.0); - EXPECT_DOUBLE_EQ(v[i][1],0.0); - EXPECT_DOUBLE_EQ(v[i][2],0.0); + EXPECT_EQ(image[i], lammps_encode_image_flags(0, 0, 0)); + EXPECT_DOUBLE_EQ(x[i][0], 1.2); + EXPECT_DOUBLE_EQ(x[i][1], 2.1); + EXPECT_DOUBLE_EQ(x[i][2], 1.25); + EXPECT_DOUBLE_EQ(v[i][0], 0.0); + EXPECT_DOUBLE_EQ(v[i][1], 0.0); + EXPECT_DOUBLE_EQ(v[i][2], 0.0); } if (tag[i] == 8) { - EXPECT_EQ(image[i],lammps_encode_image_flags(0,0,0)); - EXPECT_DOUBLE_EQ(x[i][0],0.1); - EXPECT_DOUBLE_EQ(x[i][1],1.9); - EXPECT_DOUBLE_EQ(x[i][2],3.8); - EXPECT_DOUBLE_EQ(v[i][0],0.0); - EXPECT_DOUBLE_EQ(v[i][1],0.0); - EXPECT_DOUBLE_EQ(v[i][2],0.0); + EXPECT_EQ(image[i], lammps_encode_image_flags(0, 0, 0)); + EXPECT_DOUBLE_EQ(x[i][0], 0.1); + EXPECT_DOUBLE_EQ(x[i][1], 1.9); + EXPECT_DOUBLE_EQ(x[i][2], 3.8); + EXPECT_DOUBLE_EQ(v[i][0], 0.0); + EXPECT_DOUBLE_EQ(v[i][1], 0.0); + EXPECT_DOUBLE_EQ(v[i][2], 0.0); } - } + } }; diff --git a/unittest/fortran/wrap_extract_fix.cpp b/unittest/fortran/wrap_extract_fix.cpp index bbb535c1e7..ec49e290ac 100644 --- a/unittest/fortran/wrap_extract_fix.cpp +++ b/unittest/fortran/wrap_extract_fix.cpp @@ -51,7 +51,7 @@ protected: TEST_F(LAMMPS_extract_fix, global_scalar) { f_lammps_setup_extract_fix(); - double *scalar = + auto *scalar = (double *)lammps_extract_fix(lmp, "recenter", LMP_STYLE_GLOBAL, LMP_TYPE_SCALAR, -1, -1); EXPECT_DOUBLE_EQ(f_lammps_extract_fix_global_scalar(), *scalar); lammps_free(scalar); @@ -60,11 +60,11 @@ TEST_F(LAMMPS_extract_fix, global_scalar) TEST_F(LAMMPS_extract_fix, global_vector) { f_lammps_setup_extract_fix(); - double *x = + auto *x = (double *)lammps_extract_fix(lmp, "recenter", LMP_STYLE_GLOBAL, LMP_TYPE_VECTOR, 0, -1); - double *y = + auto *y = (double *)lammps_extract_fix(lmp, "recenter", LMP_STYLE_GLOBAL, LMP_TYPE_VECTOR, 1, -1); - double *z = + auto *z = (double *)lammps_extract_fix(lmp, "recenter", LMP_STYLE_GLOBAL, LMP_TYPE_VECTOR, 2, -1); EXPECT_DOUBLE_EQ(f_lammps_extract_fix_global_vector(1), *x); EXPECT_DOUBLE_EQ(f_lammps_extract_fix_global_vector(2), *y); diff --git a/unittest/fortran/wrap_fixexternal.cpp b/unittest/fortran/wrap_fixexternal.cpp index 694aceb009..1a709018c7 100644 --- a/unittest/fortran/wrap_fixexternal.cpp +++ b/unittest/fortran/wrap_fixexternal.cpp @@ -18,7 +18,7 @@ void f_lammps_close(); void f_lammps_setup_fix_external_callback(); void f_lammps_setup_fix_external_array(); void f_lammps_set_fix_external_callbacks(); -void f_lammps_get_force(int, double*); +void f_lammps_get_force(int, double *); void f_lammps_reverse_direction(); void f_lammps_find_forces(); void f_lammps_add_energy(); @@ -59,11 +59,11 @@ TEST_F(LAMMPS_fixexternal, callback) f_lammps_set_fix_external_callbacks(); lammps_command(lmp, "run 0"); double f[3]; - f_lammps_get_force(1,f); + f_lammps_get_force(1, f); EXPECT_DOUBLE_EQ(f[0], 3.0); EXPECT_DOUBLE_EQ(f[1], -3.0); EXPECT_DOUBLE_EQ(f[2], 3.75); - f_lammps_get_force(2,f); + f_lammps_get_force(2, f); EXPECT_DOUBLE_EQ(f[0], -3.0); EXPECT_DOUBLE_EQ(f[1], 3.0); EXPECT_DOUBLE_EQ(f[2], -3.75); @@ -71,11 +71,11 @@ TEST_F(LAMMPS_fixexternal, callback) f_lammps_reverse_direction(); f_lammps_set_fix_external_callbacks(); lammps_command(lmp, "run 0"); - f_lammps_get_force(1,f); + f_lammps_get_force(1, f); EXPECT_DOUBLE_EQ(f[0], -1.0); EXPECT_DOUBLE_EQ(f[1], 1.0); EXPECT_DOUBLE_EQ(f[2], -1.25); - f_lammps_get_force(2,f); + f_lammps_get_force(2, f); EXPECT_DOUBLE_EQ(f[0], 1.0); EXPECT_DOUBLE_EQ(f[1], -1.0); EXPECT_DOUBLE_EQ(f[2], 1.25); @@ -85,7 +85,7 @@ TEST_F(LAMMPS_fixexternal, array) { f_lammps_setup_fix_external_array(); double **f; - f = (double**) lammps_extract_atom(lmp, "f"); + f = (double **)lammps_extract_atom(lmp, "f"); f_lammps_find_forces(); lammps_command(lmp, "run 0"); EXPECT_DOUBLE_EQ(f[0][0], 14.0); @@ -112,19 +112,19 @@ TEST_F(LAMMPS_fixexternal, virial_global) double virial[6], volume; f_lammps_set_virial(); lammps_command(lmp, "run 0"); - volume = lammps_get_thermo(lmp, "vol"); + volume = lammps_get_thermo(lmp, "vol"); virial[0] = lammps_get_thermo(lmp, "pxx"); virial[1] = lammps_get_thermo(lmp, "pyy"); virial[2] = lammps_get_thermo(lmp, "pzz"); virial[3] = lammps_get_thermo(lmp, "pxy"); virial[4] = lammps_get_thermo(lmp, "pxz"); virial[5] = lammps_get_thermo(lmp, "pyz"); - EXPECT_DOUBLE_EQ(virial[0], 1.0/volume); - EXPECT_DOUBLE_EQ(virial[1], 2.0/volume); - EXPECT_DOUBLE_EQ(virial[2], 2.5/volume); - EXPECT_DOUBLE_EQ(virial[3], -1.0/volume); - EXPECT_DOUBLE_EQ(virial[4], -2.25/volume); - EXPECT_DOUBLE_EQ(virial[5], -3.02/volume); + EXPECT_DOUBLE_EQ(virial[0], 1.0 / volume); + EXPECT_DOUBLE_EQ(virial[1], 2.0 / volume); + EXPECT_DOUBLE_EQ(virial[2], 2.5 / volume); + EXPECT_DOUBLE_EQ(virial[3], -1.0 / volume); + EXPECT_DOUBLE_EQ(virial[4], -2.25 / volume); + EXPECT_DOUBLE_EQ(virial[5], -3.02 / volume); }; TEST_F(LAMMPS_fixexternal, energy_peratom) @@ -135,13 +135,12 @@ TEST_F(LAMMPS_fixexternal, energy_peratom) double energy; lammps_command(lmp, "run 0"); int nlocal = lammps_extract_setting(lmp, "nlocal"); - for (int i = 1; i <= nlocal; i++) - { + for (int i = 1; i <= nlocal; i++) { energy = f_lammps_find_peratom_energy(i); if (i == 1) - EXPECT_DOUBLE_EQ(energy, 1.0); + EXPECT_DOUBLE_EQ(energy, 1.0); else - EXPECT_DOUBLE_EQ(energy, 10.0); + EXPECT_DOUBLE_EQ(energy, 10.0); } }; @@ -153,26 +152,22 @@ TEST_F(LAMMPS_fixexternal, virial_peratom) double virial[6]; lammps_command(lmp, "run 0"); int nlocal = lammps_extract_setting(lmp, "nlocal"); - for (int i = 1; i <= nlocal; i++) - { + for (int i = 1; i <= nlocal; i++) { f_lammps_find_peratom_virial(virial, i); - if (i == 1) - { - EXPECT_DOUBLE_EQ(virial[0], -1.0); - EXPECT_DOUBLE_EQ(virial[1], -2.0); - EXPECT_DOUBLE_EQ(virial[2], 1.0); - EXPECT_DOUBLE_EQ(virial[3], 2.0); - EXPECT_DOUBLE_EQ(virial[4], -3.0); - EXPECT_DOUBLE_EQ(virial[5], 3.0); - } - else - { - EXPECT_DOUBLE_EQ(virial[0], -10.0); - EXPECT_DOUBLE_EQ(virial[1], -20.0); - EXPECT_DOUBLE_EQ(virial[2], 10.0); - EXPECT_DOUBLE_EQ(virial[3], 20.0); - EXPECT_DOUBLE_EQ(virial[4], -30.0); - EXPECT_DOUBLE_EQ(virial[5], 30.0); + if (i == 1) { + EXPECT_DOUBLE_EQ(virial[0], -1.0); + EXPECT_DOUBLE_EQ(virial[1], -2.0); + EXPECT_DOUBLE_EQ(virial[2], 1.0); + EXPECT_DOUBLE_EQ(virial[3], 2.0); + EXPECT_DOUBLE_EQ(virial[4], -3.0); + EXPECT_DOUBLE_EQ(virial[5], 3.0); + } else { + EXPECT_DOUBLE_EQ(virial[0], -10.0); + EXPECT_DOUBLE_EQ(virial[1], -20.0); + EXPECT_DOUBLE_EQ(virial[2], 10.0); + EXPECT_DOUBLE_EQ(virial[3], 20.0); + EXPECT_DOUBLE_EQ(virial[4], -30.0); + EXPECT_DOUBLE_EQ(virial[5], 30.0); } } }; @@ -184,11 +179,9 @@ TEST_F(LAMMPS_fixexternal, vector) f_lammps_fixexternal_set_vector(); lammps_command(lmp, "run 0"); double *v; - for (int i = 0; i < 8; i++) - { - v = (double*) lammps_extract_fix(lmp, "ext2", LMP_STYLE_GLOBAL, - LMP_TYPE_VECTOR, i, 1); - EXPECT_DOUBLE_EQ(i+1, *v); - std::free(v); + for (int i = 0; i < 8; i++) { + v = (double *)lammps_extract_fix(lmp, "ext2", LMP_STYLE_GLOBAL, LMP_TYPE_VECTOR, i, 1); + EXPECT_DOUBLE_EQ(i + 1, *v); + std::free(v); } }; diff --git a/unittest/fortran/wrap_gather_scatter.cpp b/unittest/fortran/wrap_gather_scatter.cpp index 1578f0e138..adc01d64b1 100644 --- a/unittest/fortran/wrap_gather_scatter.cpp +++ b/unittest/fortran/wrap_gather_scatter.cpp @@ -277,7 +277,7 @@ TEST_F(LAMMPS_gather_scatter, gather_compute) lammps_command(lmp, "run 0"); int natoms = lmp->atom->natoms; int *tag = lmp->atom->tag; - double *pe = (double *)lammps_extract_compute(lmp, "pe", LMP_STYLE_ATOM, LMP_TYPE_VECTOR); + auto *pe = (double *)lammps_extract_compute(lmp, "pe", LMP_STYLE_ATOM, LMP_TYPE_VECTOR); for (int i = 0; i < natoms; i++) EXPECT_DOUBLE_EQ(f_lammps_gather_pe_atom(tag[i]), pe[i]); #endif @@ -292,7 +292,7 @@ TEST_F(LAMMPS_gather_scatter, gather_compute_concat) lammps_command(lmp, "run 0"); int natoms = lmp->atom->natoms; int *tag = lmp->atom->tag; - double *pe = (double *)lammps_extract_compute(lmp, "pe", LMP_STYLE_ATOM, LMP_TYPE_VECTOR); + auto *pe = (double *)lammps_extract_compute(lmp, "pe", LMP_STYLE_ATOM, LMP_TYPE_VECTOR); for (int i = 0; i < natoms; i++) EXPECT_DOUBLE_EQ(f_lammps_gather_pe_atom(tag[i]), pe[i]); #endif @@ -305,11 +305,11 @@ TEST_F(LAMMPS_gather_scatter, gather_compute_subset) #else f_lammps_setup_gather_scatter(); lammps_command(lmp, "run 0"); - int ids[2] = {3, 1}; - int *tag = lmp->atom->tag; - double pe[2] = {0.0, 0.0}; - int nlocal = lammps_extract_setting(lmp, "nlocal"); - double *pa_pe = (double *)lammps_extract_compute(lmp, "pe", LMP_STYLE_ATOM, LMP_TYPE_VECTOR); + int ids[2] = {3, 1}; + int *tag = lmp->atom->tag; + double pe[2] = {0.0, 0.0}; + int nlocal = lammps_extract_setting(lmp, "nlocal"); + auto *pa_pe = (double *)lammps_extract_compute(lmp, "pe", LMP_STYLE_ATOM, LMP_TYPE_VECTOR); for (int i = 0; i < nlocal; i++) { if (tag[i] == ids[0]) pe[0] = pa_pe[i]; @@ -330,10 +330,10 @@ TEST_F(LAMMPS_gather_scatter, scatter_compute) #else f_lammps_setup_gather_scatter(); int natoms = lmp->atom->natoms; - double *pe = new double[natoms]; + auto *pe = new double[natoms]; lammps_command(lmp, "run 0"); lammps_gather(lmp, "c_pe", 1, 1, pe); - double *old_pe = new double[natoms]; + auto *old_pe = new double[natoms]; for (int i = 0; i < natoms; i++) old_pe[i] = pe[i]; EXPECT_DOUBLE_EQ(pe[0], old_pe[0]); @@ -356,10 +356,10 @@ TEST_F(LAMMPS_gather_scatter, scatter_subset_compute) #else f_lammps_setup_gather_scatter(); int natoms = lmp->atom->natoms; - double *pe = new double[natoms]; + auto *pe = new double[natoms]; lammps_command(lmp, "run 0"); lammps_gather(lmp, "c_pe", 1, 1, pe); - double *old_pe = new double[natoms]; + auto *old_pe = new double[natoms]; for (int i = 0; i < natoms; i++) old_pe[i] = pe[i]; EXPECT_DOUBLE_EQ(pe[0], old_pe[0]); diff --git a/unittest/fortran/wrap_neighlist.cpp b/unittest/fortran/wrap_neighlist.cpp index ce09dcccb6..7a08cd61e5 100644 --- a/unittest/fortran/wrap_neighlist.cpp +++ b/unittest/fortran/wrap_neighlist.cpp @@ -1,14 +1,14 @@ // unit tests for accessing neighbor lists in a LAMMPS instance through the Fortran wrapper +#include "force.h" +#include "info.h" #include "lammps.h" #include "library.h" -#include "force.h" #include "modify.h" -#include "neighbor.h" #include "neigh_list.h" -#include "info.h" -//#include -//#include +#include "neighbor.h" +// #include +// #include #include #include @@ -33,13 +33,15 @@ protected: LAMMPS_neighbors() = default; ~LAMMPS_neighbors() override = default; - void SetUp() override { + void SetUp() override + { ::testing::internal::CaptureStdout(); lmp = (LAMMPS_NS::LAMMPS *)f_lammps_with_args(); std::string output = ::testing::internal::GetCapturedStdout(); EXPECT_STREQ(output.substr(0, 8).c_str(), "LAMMPS ("); } - void TearDown() override { + void TearDown() override + { ::testing::internal::CaptureStdout(); f_lammps_close(); std::string output = ::testing::internal::GetCapturedStdout(); @@ -52,14 +54,13 @@ TEST_F(LAMMPS_neighbors, pair) { f_lammps_setup_neigh_tests(); int pair_neighlist = f_lammps_pair_neighlist_test(); - Pair *pair = lmp->force->pair_match("lj/cut",1,0); - int index = -2; + Pair *pair = lmp->force->pair_match("lj/cut", 1, 0); + int index = -2; if (pair != nullptr) { for (int i = 0; i < lmp->neighbor->nlist; i++) { NeighList *list = lmp->neighbor->lists[i]; - if ((list->requestor_type == NeighList::PAIR) - and (pair == list->requestor) - and (list->id == 0)) { + if ((list->requestor_type == NeighList::PAIR) and (pair == list->requestor) and + (list->id == 0)) { index = i; break; } @@ -72,16 +73,16 @@ TEST_F(LAMMPS_neighbors, fix) { if (not Info::has_package("REPLICA")) GTEST_SKIP(); f_lammps_setup_neigh_tests(); - auto fix = lmp->modify->get_fix_by_id("f"); + auto *fix = lmp->modify->get_fix_by_id("f"); EXPECT_NE(fix, nullptr); int ilist = -2; for (int i = 0; i < lmp->neighbor->nlist; i++) { - NeighList *list = lmp->neighbor->lists[i]; - if ( (list->requestor_type == NeighList::FIX) - and (fix == list->requestor) and (list->id == 0) ) { - ilist = i; - break; - } + NeighList *list = lmp->neighbor->lists[i]; + if ((list->requestor_type == NeighList::FIX) and (fix == list->requestor) and + (list->id == 0)) { + ilist = i; + break; + } } EXPECT_EQ(ilist, f_lammps_fix_neighlist_test()); }; @@ -89,13 +90,13 @@ TEST_F(LAMMPS_neighbors, fix) TEST_F(LAMMPS_neighbors, compute) { f_lammps_setup_neigh_tests(); - auto compute = lmp->modify->get_compute_by_id("c"); - EXPECT_NE(compute,nullptr); + auto *compute = lmp->modify->get_compute_by_id("c"); + EXPECT_NE(compute, nullptr); int ilist = -2; - for (int i=0; i < lmp->neighbor->nlist; i++) { + for (int i = 0; i < lmp->neighbor->nlist; i++) { NeighList *list = lmp->neighbor->lists[i]; - if ( (list->requestor_type == NeighList::COMPUTE) - and (compute == list->requestor) and (list->id == 0) ) { + if ((list->requestor_type == NeighList::COMPUTE) and (compute == list->requestor) and + (list->id == 0)) { ilist = i; break; } @@ -107,17 +108,17 @@ TEST_F(LAMMPS_neighbors, numelements) { f_lammps_setup_neigh_tests(); int num_neigh = 0; - int pair_id = f_lammps_pair_neighlist_test(); - num_neigh = f_lammps_neighlist_num_elements(pair_id); + int pair_id = f_lammps_pair_neighlist_test(); + num_neigh = f_lammps_neighlist_num_elements(pair_id); EXPECT_EQ(num_neigh, lammps_neighlist_num_elements(lmp, pair_id)); if (Info::has_package("REPLICA")) { - int fix_id = f_lammps_fix_neighlist_test(); - num_neigh = f_lammps_neighlist_num_elements(fix_id); - EXPECT_EQ(num_neigh, lammps_neighlist_num_elements(lmp, fix_id)); + int fix_id = f_lammps_fix_neighlist_test(); + num_neigh = f_lammps_neighlist_num_elements(fix_id); + EXPECT_EQ(num_neigh, lammps_neighlist_num_elements(lmp, fix_id)); } int compute_id = f_lammps_compute_neighlist_test(); - num_neigh = f_lammps_neighlist_num_elements(compute_id); + num_neigh = f_lammps_neighlist_num_elements(compute_id); EXPECT_EQ(num_neigh, lammps_neighlist_num_elements(lmp, compute_id)); }; -} // LAMMPS_NS +} // namespace LAMMPS_NS diff --git a/unittest/testing/core.h b/unittest/testing/core.h index 8f1a84d2d8..79a2560fae 100644 --- a/unittest/testing/core.h +++ b/unittest/testing/core.h @@ -107,7 +107,7 @@ public: protected: std::string testbinary = "LAMMPSTest"; - LAMMPS::argv args = {"-log", "none", "-echo", "screen", "-nocite"}; + LAMMPS::argv args = {"-log", "none", "-echo", "screen", "-nocite"}; LAMMPS *lmp; Info *info; diff --git a/unittest/utils/test_lepton.cpp b/unittest/utils/test_lepton.cpp index 55d3bf8351..9e8b75af57 100644 --- a/unittest/utils/test_lepton.cpp +++ b/unittest/utils/test_lepton.cpp @@ -130,7 +130,10 @@ TEST(LeptonCustomFunction, zbl) class ExampleFunction : public Lepton::CustomFunction { int getNumArguments() const override { return 2; } - double evaluate(const double *arguments) const override { return 2.0 * arguments[0] * arguments[1]; } + double evaluate(const double *arguments) const override + { + return 2.0 * arguments[0] * arguments[1]; + } double evaluateDerivative(const double *arguments, const int *derivOrder) const override { if (derivOrder[0] == 1) { diff --git a/unittest/utils/test_lmptype.cpp b/unittest/utils/test_lmptype.cpp index 383c9d4b2c..a14f3a2cab 100644 --- a/unittest/utils/test_lmptype.cpp +++ b/unittest/utils/test_lmptype.cpp @@ -24,7 +24,7 @@ TEST(Types, ubuf) { double buf[3]; double d1 = 0.1; - int i1 = -10; + int i1 = -10; #if defined(LAMMPS_SMALLSMALL) bigint b1 = 2048; #else @@ -43,14 +43,14 @@ TEST(Types, multitype) { multitype m[7]; int64_t b1 = (3L << 48) - 1; - int i1 = 20; - double d1 = 0.1; + int i1 = 20; + double d1 = 0.1; m[0] = b1; m[1] = i1; m[2] = d1; - m[3] = (bigint) -((1L << 40) + (1L << 50)); + m[3] = (bigint) - ((1L << 40) + (1L << 50)); m[4] = -1023; m[5] = -2.225; @@ -72,7 +72,7 @@ TEST(Types, multitype) EXPECT_EQ(m[2].data.d, d1); #if !defined(LAMMPS_SMALLSMALL) - EXPECT_EQ(m[3].data.b, -((1L << 40) + (1L << 50))); + 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); diff --git a/unittest/utils/test_math_eigen_impl.cpp b/unittest/utils/test_math_eigen_impl.cpp index b38438d1f7..497e468ac7 100644 --- a/unittest/utils/test_math_eigen_impl.cpp +++ b/unittest/utils/test_math_eigen_impl.cpp @@ -385,9 +385,9 @@ void TestJacobi(int n, //::SORT_INCREASING_ABS_EVALS); #else ecalc.Diagonalize(M, evals, evecs, - Jacobi::SORT_INCREASING_ABS_EVALS); #endif @@ -488,7 +488,7 @@ void TestJacobi(int n, //::SORT_DECREASING_ABS_EVALS); #else ecalc.Diagonalize(M, evals, evecs, - Jacobi::SORT_DECREASING_ABS_EVALS); #endif @@ -511,7 +511,7 @@ void TestJacobi(int n, //::SORT_INCREASING_EVALS); #else ecalc.Diagonalize(M, evals, evecs, - Jacobi::SORT_INCREASING_EVALS); #endif for (int i = 1; i < n; i++) @@ -533,8 +533,8 @@ void TestJacobi(int n, //::DO_NOT_SORT); #else ecalc.Diagonalize( - M, evals, evecs, - Jacobi::DO_NOT_SORT); + M, evals, evecs, + Jacobi::DO_NOT_SORT); #endif } // if (test_code_coverage) From c0dfccdd6469800c41de9142f8661859505aa4f9 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Thu, 4 Jul 2024 11:18:08 -0400 Subject: [PATCH 115/158] add a few more flags to clang-tidy --- cmake/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmake/CMakeLists.txt b/cmake/CMakeLists.txt index d8b4f0a4f6..617ba7fdb8 100644 --- a/cmake/CMakeLists.txt +++ b/cmake/CMakeLists.txt @@ -204,7 +204,7 @@ option(BUILD_LAMMPS_GUI "Build and install the LAMMPS GUI" OFF) # Support using clang-tidy for C++ files with selected options set(ENABLE_CLANG_TIDY OFF CACHE BOOL "Include clang-tidy processing when compiling") if(ENABLE_CLANG_TIDY) - set(CMAKE_CXX_CLANG_TIDY "clang-tidy;-checks=-*,performance-trivially-destructible,performance-unnecessary-copy-initialization,performance-unnecessary-value-param,readability-redundant-control-flow,readability-redundant-declaration,readability-redundant-function-ptr-dereference,readability-redundant-member-init,readability-redundant-string-cstr,readability-redundant-string-init,readability-simplify-boolean-expr,readability-static-accessed-through-instance,readability-static-definition-in-anonymous-namespace,modernize-use-override,modernize-use-bool-literals,modernize-use-emplace,modernize-return-braced-init-list,modernize-use-equals-default,modernize-use-equals-delete,modernize-replace-random-shuffle,modernize-deprecated-headers,modernize-use-nullptr,modernize-use-noexcept,modernize-redundant-void-arg;-fix;-header-filter=.*,header-filter=library.h,header-filter=fmt/*.h" CACHE STRING "clang-tidy settings") + set(CMAKE_CXX_CLANG_TIDY "clang-tidy;-checks=-*,performance-trivially-destructible,performance-unnecessary-copy-initialization,performance-unnecessary-value-param,readability-redundant-control-flow,readability-redundant-declaration,readability-redundant-function-ptr-dereference,readability-redundant-member-init,readability-redundant-string-cstr,readability-redundant-string-init,readability-simplify-boolean-expr,readability-static-accessed-through-instance,readability-static-definition-in-anonymous-namespace,readability-qualified-auto,misc-unused-parameters,modernize-deprecated-ios-base-aliases,modernize-loop-convert,modernize-shrink-to-fit,modernize-use-auto,modernize-use-using,modernize-use-override,modernize-use-bool-literals,modernize-use-emplace,modernize-return-braced-init-list,modernize-use-equals-default,modernize-use-equals-delete,modernize-replace-random-shuffle,modernize-deprecated-headers,modernize-use-nullptr,modernize-use-noexcept,modernize-redundant-void-arg;-fix;-header-filter=.*,header-filter=library.h,header-filter=fmt/*.h" CACHE STRING "clang-tidy settings") else() unset(CMAKE_CXX_CLANG_TIDY CACHE) endif() From eeaecb3ed355165a53e62a0fc3fb3320db73c794 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Thu, 4 Jul 2024 15:13:06 -0400 Subject: [PATCH 116/158] macOS app bundle requires -D BUILD_TOOLS=yes --- tools/lammps-gui/CMakeLists.txt | 52 ++++++++++++++++++--------------- 1 file changed, 28 insertions(+), 24 deletions(-) diff --git a/tools/lammps-gui/CMakeLists.txt b/tools/lammps-gui/CMakeLists.txt index 951b350edb..141918a319 100644 --- a/tools/lammps-gui/CMakeLists.txt +++ b/tools/lammps-gui/CMakeLists.txt @@ -207,30 +207,34 @@ if(APPLE) ) # additional targets to populate the bundle tree and create the .dmg image file set(APP_CONTENTS ${CMAKE_BINARY_DIR}/lammps-gui.app/Contents) - add_custom_target(complete-bundle - ${CMAKE_COMMAND} -E make_directory ${APP_CONTENTS}/bin - COMMAND ${CMAKE_COMMAND} -E copy_if_different ${CMAKE_BINARY_DIR}/lmp ${APP_CONTENTS}/bin/ - COMMAND ${CMAKE_COMMAND} -E copy_if_different ${CMAKE_BINARY_DIR}/msi2lmp ${APP_CONTENTS}/bin/ - COMMAND ${CMAKE_COMMAND} -E copy_if_different ${CMAKE_BINARY_DIR}/binary2txt ${APP_CONTENTS}/bin/ - COMMAND ${CMAKE_COMMAND} -E copy_if_different ${CMAKE_BINARY_DIR}/stl_bin2txt ${APP_CONTENTS}/bin/ - COMMAND ${CMAKE_COMMAND} -E copy_if_different ${CMAKE_BINARY_DIR}/phana ${APP_CONTENTS}/bin/ - COMMAND ${CMAKE_COMMAND} -E create_symlink ../MacOS/lammps-gui ${APP_CONTENTS}/bin/lammps-gui - COMMAND ${CMAKE_COMMAND} -E make_directory ${APP_CONTENTS}/Resources - COMMAND ${CMAKE_COMMAND} -E copy_if_different ${LAMMPS_DIR}/cmake/packaging/README.macos ${APP_CONTENTS}/Resources/README.txt - COMMAND ${CMAKE_COMMAND} -E copy_if_different ${LAMMPS_DIR}/cmake/packaging/lammps.icns ${APP_CONTENTS}/Resources - COMMAND ${CMAKE_COMMAND} -E copy_if_different ${LAMMPS_DIR}/cmake/packaging/LAMMPS_DMG_Background.png ${APP_CONTENTS}/Resources - COMMAND ${CMAKE_COMMAND} -E make_directory ${APP_CONTENTS}/share/lammps - COMMAND ${CMAKE_COMMAND} -E make_directory ${APP_CONTENTS}/share/lammps/man/man1 - COMMAND ${CMAKE_COMMAND} -E copy_directory ${LAMMPS_DIR}/potentials ${APP_CONTENTS}/share/lammps/potentials - COMMAND ${CMAKE_COMMAND} -E copy_directory ${LAMMPS_DIR}/bench ${APP_CONTENTS}/share/lammps/bench - COMMAND ${CMAKE_COMMAND} -E copy_directory ${LAMMPS_DIR}/tools/msi2lmp/frc_files ${APP_CONTENTS}/share/lammps/frc_files - COMMAND ${CMAKE_COMMAND} -E copy_if_different ${LAMMPS_DIR}/doc/lammps.1 ${APP_CONTENTS}/share/lammps/man/man1/ - COMMAND ${CMAKE_COMMAND} -E create_symlink lammps.1 ${APP_CONTENTS}/share/lammps/man/man1/lmp.1 - COMMAND ${CMAKE_COMMAND} -E copy_if_different ${LAMMPS_DIR}/doc/msi2lmp.1 ${APP_CONTENTS}/share/lammps/man/man1 - DEPENDS lammps-gui lammps lmp binary2txt stl_bin2txt msi2lmp phana - COMMENT "Copying additional files into macOS app bundle tree" - WORKING_DIRECTORY ${CMAKE_BINARY_DIR} - ) + if(BUILD_TOOLS) + add_custom_target(complete-bundle + ${CMAKE_COMMAND} -E make_directory ${APP_CONTENTS}/bin + COMMAND ${CMAKE_COMMAND} -E copy_if_different ${CMAKE_BINARY_DIR}/lmp ${APP_CONTENTS}/bin/ + COMMAND ${CMAKE_COMMAND} -E copy_if_different ${CMAKE_BINARY_DIR}/msi2lmp ${APP_CONTENTS}/bin/ + COMMAND ${CMAKE_COMMAND} -E copy_if_different ${CMAKE_BINARY_DIR}/binary2txt ${APP_CONTENTS}/bin/ + COMMAND ${CMAKE_COMMAND} -E copy_if_different ${CMAKE_BINARY_DIR}/stl_bin2txt ${APP_CONTENTS}/bin/ + COMMAND ${CMAKE_COMMAND} -E copy_if_different ${CMAKE_BINARY_DIR}/phana ${APP_CONTENTS}/bin/ + COMMAND ${CMAKE_COMMAND} -E create_symlink ../MacOS/lammps-gui ${APP_CONTENTS}/bin/lammps-gui + COMMAND ${CMAKE_COMMAND} -E make_directory ${APP_CONTENTS}/Resources + COMMAND ${CMAKE_COMMAND} -E copy_if_different ${LAMMPS_DIR}/cmake/packaging/README.macos ${APP_CONTENTS}/Resources/README.txt + COMMAND ${CMAKE_COMMAND} -E copy_if_different ${LAMMPS_DIR}/cmake/packaging/lammps.icns ${APP_CONTENTS}/Resources + COMMAND ${CMAKE_COMMAND} -E copy_if_different ${LAMMPS_DIR}/cmake/packaging/LAMMPS_DMG_Background.png ${APP_CONTENTS}/Resources + COMMAND ${CMAKE_COMMAND} -E make_directory ${APP_CONTENTS}/share/lammps + COMMAND ${CMAKE_COMMAND} -E make_directory ${APP_CONTENTS}/share/lammps/man/man1 + COMMAND ${CMAKE_COMMAND} -E copy_directory ${LAMMPS_DIR}/potentials ${APP_CONTENTS}/share/lammps/potentials + COMMAND ${CMAKE_COMMAND} -E copy_directory ${LAMMPS_DIR}/bench ${APP_CONTENTS}/share/lammps/bench + COMMAND ${CMAKE_COMMAND} -E copy_directory ${LAMMPS_DIR}/tools/msi2lmp/frc_files ${APP_CONTENTS}/share/lammps/frc_files + COMMAND ${CMAKE_COMMAND} -E copy_if_different ${LAMMPS_DIR}/doc/lammps.1 ${APP_CONTENTS}/share/lammps/man/man1/ + COMMAND ${CMAKE_COMMAND} -E create_symlink lammps.1 ${APP_CONTENTS}/share/lammps/man/man1/lmp.1 + COMMAND ${CMAKE_COMMAND} -E copy_if_different ${LAMMPS_DIR}/doc/msi2lmp.1 ${APP_CONTENTS}/share/lammps/man/man1 + DEPENDS lammps-gui lammps lmp binary2txt stl_bin2txt msi2lmp phana + COMMENT "Copying additional files into macOS app bundle tree" + WORKING_DIRECTORY ${CMAKE_BINARY_DIR} + ) + else() + message(FATAL_ERROR "Must use -D BUILD_TOOLS=yes for building app bundle") + endif() if(FFMPEG_EXECUTABLE) add_custom_target(copy-ffmpeg COMMAND ${CMAKE_COMMAND} -E copy_if_different ${FFMPEG_EXECUTABLE} ${APP_CONTENTS}/bin/ From 8fcde04097482a598cf8178c458e904a80c572d5 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Fri, 5 Jul 2024 15:45:49 -0400 Subject: [PATCH 117/158] add a "matches()" method to the Tokenizer and ValueTokenizer classes using utils::strmatch() --- src/tokenizer.cpp | 32 +++++++++++++++++++++++++ src/tokenizer.h | 2 ++ unittest/utils/test_tokenizer.cpp | 39 +++++++++++++++++++++++++++++++ 3 files changed, 73 insertions(+) diff --git a/src/tokenizer.cpp b/src/tokenizer.cpp index 00f0b0b761..06c0c45bf7 100644 --- a/src/tokenizer.cpp +++ b/src/tokenizer.cpp @@ -99,6 +99,8 @@ void Tokenizer::reset() } /*! Search the text to be processed for a sub-string. + * + * This method does a generic substring match. * * \param str string to be searched for * \return true if string was found, false if not */ @@ -107,6 +109,20 @@ bool Tokenizer::contains(const std::string &str) const return text.find(str) != std::string::npos; } +/*! Search the text to be processed for regular expression match. + * +\verbatim embed:rst +This method matches the current string against a regular expression using +the :cpp:func:`utils::strmatch() ` function. +\endverbatim + * + * \param str regular expression to be matched against + * \return true if string was found, false if not */ +bool Tokenizer::matches(const std::string &str) const +{ + return utils::strmatch(text, str); +} + /*! Skip over a given number of tokens * * \param n number of tokens to skip over */ @@ -233,6 +249,8 @@ bool ValueTokenizer::has_next() const } /*! Search the text to be processed for a sub-string. + * + * This method does a generic substring match. * * \param value string with value to be searched for * \return true if string was found, false if not */ @@ -241,6 +259,20 @@ bool ValueTokenizer::contains(const std::string &value) const return tokens.contains(value); } +/*! Search the text to be processed for regular expression match. + * +\verbatim embed:rst +This method matches the current string against a regular expression using +the :cpp:func:`utils::strmatch() ` function. +\endverbatim + * + * \param str regular expression to be matched against + * \return true if string was found, false if not */ +bool ValueTokenizer::matches(const std::string &str) const +{ + return tokens.matches(str); +} + /*! Retrieve next token * * \return string with next token */ diff --git a/src/tokenizer.h b/src/tokenizer.h index b5d9abf1f7..42a62fefa0 100644 --- a/src/tokenizer.h +++ b/src/tokenizer.h @@ -46,6 +46,7 @@ class Tokenizer { void skip(int n = 1); bool has_next() const; bool contains(const std::string &str) const; + bool matches(const std::string &str) const; std::string next(); size_t count(); @@ -119,6 +120,7 @@ class ValueTokenizer { bool has_next() const; bool contains(const std::string &value) const; + bool matches(const std::string &str) const; void skip(int ntokens = 1); size_t count(); diff --git a/unittest/utils/test_tokenizer.cpp b/unittest/utils/test_tokenizer.cpp index 49cc771a25..4d38bfd14f 100644 --- a/unittest/utils/test_tokenizer.cpp +++ b/unittest/utils/test_tokenizer.cpp @@ -173,6 +173,32 @@ TEST(Tokenizer, default_separators) ASSERT_EQ(t.count(), 2); } +TEST(Tokenizer, contains) +{ + Tokenizer values("test word"); + ASSERT_TRUE(values.contains("test")); + ASSERT_TRUE(values.contains("word")); +} + +TEST(Tokenizer, not_contains) +{ + Tokenizer values("test word"); + ASSERT_FALSE(values.contains("test2")); +} + +TEST(Tokenizer, matches) +{ + Tokenizer values("test word"); + ASSERT_TRUE(values.matches("test")); + ASSERT_TRUE(values.matches("word")); +} + +TEST(Tokenizer, not_matches) +{ + Tokenizer values("test word"); + ASSERT_FALSE(values.matches("test2")); +} + TEST(Tokenizer, as_vector1) { Tokenizer t(" \r\n test \t word \f"); @@ -346,6 +372,19 @@ TEST(ValueTokenizer, not_contains) ASSERT_FALSE(values.contains("test2")); } +TEST(ValueTokenizer, matches) +{ + ValueTokenizer values("test word"); + ASSERT_TRUE(values.matches("test")); + ASSERT_TRUE(values.matches("word")); +} + +TEST(ValueTokenizer, not_matches) +{ + ValueTokenizer values("test word"); + ASSERT_FALSE(values.matches("test2")); +} + TEST(ValueTokenizer, missing_int) { ValueTokenizer values("10"); From caa1b4a891c7d36fd42ada8e9eb42dec8243ce05 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Fri, 5 Jul 2024 16:12:08 -0400 Subject: [PATCH 118/158] promote ndatum to bigint to avoid overflows --- src/my_page.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/my_page.h b/src/my_page.h index ea19dc8e74..1f5c9ad797 100644 --- a/src/my_page.h +++ b/src/my_page.h @@ -29,8 +29,8 @@ struct HyperOneCoeff { template class MyPage { public: - int ndatum; // total # of stored datums - int nchunk; // total # of stored chunks + bigint ndatum; // total # of stored datums + int nchunk; // total # of stored chunks MyPage(); virtual ~MyPage(); @@ -105,7 +105,7 @@ template class MyPage { // 1 = chunk size exceeded maxchunk // 2 = memory allocation error #if defined(_OPENMP) - char pad[64]; // to avoid false sharing with multi-threading + char pad[64]; // to avoid false sharing with multi-threading #endif void allocate(); void deallocate(); From f0a11dbefdb281b7fa83be7b31872ccc8bb2da9a Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Fri, 5 Jul 2024 16:16:04 -0400 Subject: [PATCH 119/158] also promote ndatum in MyPoolChunk class --- src/my_pool_chunk.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/my_pool_chunk.h b/src/my_pool_chunk.h index fa0a4e2506..3a8209eb8d 100644 --- a/src/my_pool_chunk.h +++ b/src/my_pool_chunk.h @@ -18,8 +18,8 @@ namespace LAMMPS_NS { template class MyPoolChunk { public: - int ndatum; // total # of stored datums - int nchunk; // total # of stored chunks + bigint ndatum; // total # of stored datums + int nchunk; // total # of stored chunks MyPoolChunk(int user_minchunk = 1, int user_maxchunk = 1, int user_nbin = 1, int user_chunkperpage = 1024, int user_pagedelta = 1); From dacc55b889927e6837f2fb6d5ec73fb5fecda652 Mon Sep 17 00:00:00 2001 From: Stan Moore Date: Wed, 26 Jun 2024 14:55:36 -0600 Subject: [PATCH 120/158] Prevent overflow in neighbor output --- src/finish.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/finish.cpp b/src/finish.cpp index 554f250fe1..c774f51e58 100644 --- a/src/finish.cpp +++ b/src/finish.cpp @@ -62,7 +62,8 @@ Finish::Finish(LAMMPS *lmp) : Pointers(lmp) {} void Finish::end(int flag) { - int i,nneigh,nneighfull; + int i; + bigint nneigh,nneighfull; int histo[10]; int minflag,prdflag,tadflag,hyperflag; int timeflag,fftflag,histoflag,neighflag; From 880aa40d1ba5d0e202228e2d01e28c28a4ad3d4e Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Fri, 5 Jul 2024 16:23:02 -0400 Subject: [PATCH 121/158] add missing header --- src/my_pool_chunk.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/my_pool_chunk.h b/src/my_pool_chunk.h index 3a8209eb8d..06264884d1 100644 --- a/src/my_pool_chunk.h +++ b/src/my_pool_chunk.h @@ -14,6 +14,8 @@ #ifndef LAMMPS_MY_POOL_CHUNK_H #define LAMMPS_MY_POOL_CHUNK_H +#include "lmptype.h" + namespace LAMMPS_NS { template class MyPoolChunk { From 6fd962e132fbf8c11e333d775e13d1a1fce6b3df Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Fri, 5 Jul 2024 16:44:08 -0400 Subject: [PATCH 122/158] spelling --- src/tokenizer.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/tokenizer.cpp b/src/tokenizer.cpp index 06c0c45bf7..6b87f0c421 100644 --- a/src/tokenizer.cpp +++ b/src/tokenizer.cpp @@ -100,7 +100,7 @@ void Tokenizer::reset() /*! Search the text to be processed for a sub-string. * - * This method does a generic substring match. + * This method does a generic sub-string match. * * \param str string to be searched for * \return true if string was found, false if not */ @@ -250,7 +250,7 @@ bool ValueTokenizer::has_next() const /*! Search the text to be processed for a sub-string. * - * This method does a generic substring match. + * This method does a generic sub-string match. * * \param value string with value to be searched for * \return true if string was found, false if not */ From a3bacfca65a5a3a98e073215340613a1dc6f2618 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Fri, 5 Jul 2024 18:55:55 -0400 Subject: [PATCH 123/158] more unit tests for tokenizer functions constains() and matches() --- unittest/utils/test_tokenizer.cpp | 34 +++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/unittest/utils/test_tokenizer.cpp b/unittest/utils/test_tokenizer.cpp index 4d38bfd14f..6db4a5fe5e 100644 --- a/unittest/utils/test_tokenizer.cpp +++ b/unittest/utils/test_tokenizer.cpp @@ -178,6 +178,9 @@ TEST(Tokenizer, contains) Tokenizer values("test word"); ASSERT_TRUE(values.contains("test")); ASSERT_TRUE(values.contains("word")); + values = Tokenizer("Triangles"); + ASSERT_TRUE(values.contains("angles")); + ASSERT_TRUE(values.contains("Triangles")); } TEST(Tokenizer, not_contains) @@ -190,13 +193,27 @@ TEST(Tokenizer, matches) { Tokenizer values("test word"); ASSERT_TRUE(values.matches("test")); + ASSERT_TRUE(values.matches("^test")); ASSERT_TRUE(values.matches("word")); + ASSERT_TRUE(values.matches("word$")); + ASSERT_TRUE(values.matches("^\\s*\\S+\\s+word")); + values = Tokenizer("Triangles"); + ASSERT_TRUE(values.matches("^\\s*Triangles\\s*$")); + values = Tokenizer("\t20\tatoms"); + ASSERT_TRUE(values.matches("^\\s*\\d+\\s+atoms\\s*$")); } TEST(Tokenizer, not_matches) { Tokenizer values("test word"); ASSERT_FALSE(values.matches("test2")); + ASSERT_FALSE(values.matches("^word")); + ASSERT_FALSE(values.matches("^ ")); + ASSERT_FALSE(values.matches(" $")); + values = Tokenizer("Triangles"); + ASSERT_FALSE(values.matches("^\\s*\\S+\\s+angles")); + values = Tokenizer("\t0x20\tatoms"); + ASSERT_FALSE(values.matches("^\\s*\\d+\\s+atoms\\s*$")); } TEST(Tokenizer, as_vector1) @@ -364,6 +381,9 @@ TEST(ValueTokenizer, contains) ValueTokenizer values("test word"); ASSERT_TRUE(values.contains("test")); ASSERT_TRUE(values.contains("word")); + values = ValueTokenizer("Triangles"); + ASSERT_TRUE(values.contains("angles")); + ASSERT_TRUE(values.contains("Triangles")); } TEST(ValueTokenizer, not_contains) @@ -376,13 +396,27 @@ TEST(ValueTokenizer, matches) { ValueTokenizer values("test word"); ASSERT_TRUE(values.matches("test")); + ASSERT_TRUE(values.matches("^test")); ASSERT_TRUE(values.matches("word")); + ASSERT_TRUE(values.matches("word$")); + ASSERT_TRUE(values.matches("^\\s*\\S+\\s+word")); + values = ValueTokenizer("Triangles"); + ASSERT_TRUE(values.matches("^\\s*Triangles\\s*$")); + values = ValueTokenizer("\t20\tatoms"); + ASSERT_TRUE(values.matches("^\\s*\\d+\\s+atoms\\s*$")); } TEST(ValueTokenizer, not_matches) { ValueTokenizer values("test word"); ASSERT_FALSE(values.matches("test2")); + ASSERT_FALSE(values.matches("^word")); + ASSERT_FALSE(values.matches("^ ")); + ASSERT_FALSE(values.matches(" $")); + values = ValueTokenizer("Triangles"); + ASSERT_FALSE(values.matches("^\\s*\\S+\\s+angles")); + values = ValueTokenizer("\t0x20\tatoms"); + ASSERT_FALSE(values.matches("^\\s*\\d+\\s+atoms\\s*$")); } TEST(ValueTokenizer, missing_int) From b89bc47626aa9e42613124b1bcd6f042b67a6b22 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Fri, 5 Jul 2024 19:10:48 -0400 Subject: [PATCH 124/158] more thorough checks for molecule file header keywords --- src/molecule.cpp | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/src/molecule.cpp b/src/molecule.cpp index d0c8e793b3..88ad22fce6 100644 --- a/src/molecule.cpp +++ b/src/molecule.cpp @@ -447,30 +447,30 @@ void Molecule::read(int flag) int nmatch = values.count(); int nwant = 0; - if (values.contains("atoms")) { + if (values.matches("^\\s*\\d+\\s+atoms")) { natoms = values.next_int(); nwant = 2; - } else if (values.contains("bonds")) { + } else if (values.matches("^\\s*\\d+\\s+bonds")) { nbonds = values.next_int(); nwant = 2; - } else if (values.contains("angles")) { + } else if (values.matches("^\\s*\\d+\\s+angles")) { nangles = values.next_int(); nwant = 2; - } else if (values.contains("dihedrals")) { + } else if (values.matches("^\\s*\\d+\\s+dihedrals")) { ndihedrals = values.next_int(); nwant = 2; - } else if (values.contains("impropers")) { + } else if (values.matches("^\\s*\\d+\\s+impropers")) { nimpropers = values.next_int(); nwant = 2; - } else if (values.contains("fragments")) { + } else if (values.matches("^\\s*\\d+\\s+fragments")) { nfragments = values.next_int(); nwant = 2; - } else if (values.contains("mass")) { + } else if (values.matches("^\\s*\\f+\\s+mass")) { massflag = 1; masstotal = values.next_double(); nwant = 2; masstotal *= sizescale * sizescale * sizescale; - } else if (values.contains("com")) { + } else if (values.matches("^\\s*\\f+\\s+\\f+\\s+\\f+\\s+com")) { comflag = 1; com[0] = values.next_double(); com[1] = values.next_double(); @@ -480,8 +480,8 @@ void Molecule::read(int flag) com[1] *= sizescale; com[2] *= sizescale; if (domain->dimension == 2 && com[2] != 0.0) - error->all(FLERR, "Molecule file z center-of-mass must be 0.0 for 2d"); - } else if (values.contains("inertia")) { + error->all(FLERR, "Molecule file z center-of-mass must be 0.0 for 2d systems"); + } else if (values.matches("^\\s*\\f+\\s+\\f+\\s+\\f+\\s+\\f+\\s+\\f+\\s+\\f+\\s+inertia")) { inertiaflag = 1; itensor[0] = values.next_double(); itensor[1] = values.next_double(); @@ -497,7 +497,7 @@ void Molecule::read(int flag) itensor[3] *= scale5; itensor[4] *= scale5; itensor[5] *= scale5; - } else if (values.contains("body")) { + } else if (values.matches("^\\s*\\d+\\s+\\f+\\s+body")) { bodyflag = 1; avec_body = dynamic_cast(atom->style_match("body")); if (!avec_body) error->all(FLERR, "Molecule file requires atom style body"); @@ -506,7 +506,7 @@ void Molecule::read(int flag) nwant = 3; } else { // unknown header keyword - if (utils::strmatch(text, "^\\d+\\s+\\S+")) { + if (values.matches("^\\s*\\d+\\s+\\S+")) { values.next_int(); auto keyword = values.next_string(); error->one(FLERR, "Invalid header keyword: {}", keyword); From 61e391b4493c8a09b65f8bac032ab8b280876f72 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Fri, 5 Jul 2024 19:28:04 -0400 Subject: [PATCH 125/158] correct check for invalid header keywords --- src/molecule.cpp | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/molecule.cpp b/src/molecule.cpp index 88ad22fce6..b25465ff83 100644 --- a/src/molecule.cpp +++ b/src/molecule.cpp @@ -506,11 +506,9 @@ void Molecule::read(int flag) nwant = 3; } else { // unknown header keyword - if (values.matches("^\\s*\\d+\\s+\\S+")) { - values.next_int(); - auto keyword = values.next_string(); - error->one(FLERR, "Invalid header keyword: {}", keyword); - } else + if (values.matches("^\\s*\\f+\\s+\\S+")) { + error->one(FLERR, "Unknown keyword or incorrectly formatted header line: {}", line); + } else { break; } if (nmatch != nwant) error->one(FLERR, "Invalid header line format in molecule file"); From 96f2e3259164071667344f6b4eb83764f8460d2e Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Fri, 5 Jul 2024 20:15:30 -0400 Subject: [PATCH 126/158] fix typo --- src/molecule.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/molecule.cpp b/src/molecule.cpp index b25465ff83..55dfb4d15d 100644 --- a/src/molecule.cpp +++ b/src/molecule.cpp @@ -508,7 +508,7 @@ void Molecule::read(int flag) // unknown header keyword if (values.matches("^\\s*\\f+\\s+\\S+")) { error->one(FLERR, "Unknown keyword or incorrectly formatted header line: {}", line); - } else { + } else break; } if (nmatch != nwant) error->one(FLERR, "Invalid header line format in molecule file"); From f05c87cd43fda517f664071e0ff8404bc63f8dfc Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Fri, 5 Jul 2024 21:31:52 -0400 Subject: [PATCH 127/158] use proper const qualifier --- unittest/c-library/test_library_properties.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/unittest/c-library/test_library_properties.cpp b/unittest/c-library/test_library_properties.cpp index 043b6c08d9..11c38023ec 100644 --- a/unittest/c-library/test_library_properties.cpp +++ b/unittest/c-library/test_library_properties.cpp @@ -419,8 +419,8 @@ TEST_F(LibraryProperties, global) EXPECT_NE(sametag, nullptr); auto *tags = (tagint *)lammps_extract_atom(lmp, "id"); - tagint sometags[] = {1, 5, 10, 15, 20}; - for (int &sometag : sometags) { + const tagint sometags[] = {1, 5, 10, 15, 20}; + for (const int &sometag : sometags) { int idx = lammps_map_atom(lmp, (const void *)&sometag); EXPECT_EQ(sometag, tags[idx]); int nextidx = sametag[idx]; From 87060b2d3ef0971b136ce30d2ea05ea6be1bf2af Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Fri, 5 Jul 2024 21:37:04 -0400 Subject: [PATCH 128/158] display selected C++ standard as part of the CMake summary output --- cmake/CMakeLists.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/cmake/CMakeLists.txt b/cmake/CMakeLists.txt index 617ba7fdb8..c6cb09f325 100644 --- a/cmake/CMakeLists.txt +++ b/cmake/CMakeLists.txt @@ -940,6 +940,7 @@ message(STATUS "<<< Compilers and Flags: >>> -- C++ Compiler: ${CMAKE_CXX_COMPILER} Type: ${CMAKE_CXX_COMPILER_ID} Version: ${CMAKE_CXX_COMPILER_VERSION} + C++ Standard: ${CMAKE_CXX_STANDARD} C++ Flags: ${CMAKE_CXX_FLAGS} ${CMAKE_CXX_FLAGS_${BTYPE}} Defines: ${DEFINES}") get_target_property(OPTIONS lammps COMPILE_OPTIONS) From 9c8f7854adcbc1d68e8fd42c4473face4ae14d01 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Sat, 6 Jul 2024 00:50:15 -0400 Subject: [PATCH 129/158] avoid out-of-bounds string character access during completion --- tools/lammps-gui/CMakeLists.txt | 2 +- tools/lammps-gui/codeeditor.cpp | 13 ++++++++----- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/tools/lammps-gui/CMakeLists.txt b/tools/lammps-gui/CMakeLists.txt index 141918a319..1e928232f0 100644 --- a/tools/lammps-gui/CMakeLists.txt +++ b/tools/lammps-gui/CMakeLists.txt @@ -1,6 +1,6 @@ cmake_minimum_required(VERSION 3.16) -project(lammps-gui VERSION 1.5.11 LANGUAGES CXX) +project(lammps-gui VERSION 1.5.12 LANGUAGES CXX) set(CMAKE_AUTOUIC ON) set(CMAKE_AUTOMOC ON) diff --git a/tools/lammps-gui/codeeditor.cpp b/tools/lammps-gui/codeeditor.cpp index 1762b0e496..9df2fc0124 100644 --- a/tools/lammps-gui/codeeditor.cpp +++ b/tools/lammps-gui/codeeditor.cpp @@ -582,7 +582,9 @@ void CodeEditor::keyPressEvent(QKeyEvent *event) if (line[begin].isSpace()) break; --begin; } - if (((cursor.positionInBlock() - begin) > 2) || (line[begin + 1] == '$')) runCompletion(); + if (((cursor.positionInBlock() - begin) > 2) || + ((line.length() > begin + 1) && (line[begin + 1] == '$'))) + runCompletion(); if (current_comp && current_comp->popup()->isVisible() && ((cursor.positionInBlock() - begin) < 2)) { current_comp->popup()->hide(); @@ -620,7 +622,7 @@ void CodeEditor::dropEvent(QDropEvent *event) if (event->mimeData()->hasUrls()) { event->accept(); auto file = event->mimeData()->urls()[0].toLocalFile(); - auto *gui = dynamic_cast(parent()); + auto *gui = dynamic_cast(parent()); if (gui) { moveCursor(QTextCursor::Start, QTextCursor::MoveAnchor); gui->open_file(file); @@ -1093,11 +1095,12 @@ void CodeEditor::insertCompletedCommand(const QString &completion) // special characters as part of a word. auto cursor = textCursor(); auto line = cursor.block().text(); - int begin = cursor.positionInBlock(); - do { + int begin = qMin(cursor.positionInBlock(), line.length() - 1); + + while (begin >= 0) { if (line[begin].isSpace()) break; --begin; - } while (begin >= 0); + } int end = begin + 1; while (end < line.length()) { From fdf9ffee739085e247757592b7698dd79d27b95d Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Sat, 6 Jul 2024 00:52:27 -0400 Subject: [PATCH 130/158] use auto for type --- unittest/c-library/test_library_properties.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/unittest/c-library/test_library_properties.cpp b/unittest/c-library/test_library_properties.cpp index 11c38023ec..52460b6b1e 100644 --- a/unittest/c-library/test_library_properties.cpp +++ b/unittest/c-library/test_library_properties.cpp @@ -420,7 +420,7 @@ TEST_F(LibraryProperties, global) auto *tags = (tagint *)lammps_extract_atom(lmp, "id"); const tagint sometags[] = {1, 5, 10, 15, 20}; - for (const int &sometag : sometags) { + for (const auto &sometag : sometags) { int idx = lammps_map_atom(lmp, (const void *)&sometag); EXPECT_EQ(sometag, tags[idx]); int nextidx = sametag[idx]; From f34b6dacaf900ba81e9e28335f341cce08b5bccf Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Sat, 6 Jul 2024 09:55:22 -0400 Subject: [PATCH 131/158] improve fix indent documentation --- doc/src/fix_indent.rst | 39 +++++++++++++++++++++------------------ 1 file changed, 21 insertions(+), 18 deletions(-) diff --git a/doc/src/fix_indent.rst b/doc/src/fix_indent.rst index e041f9f29b..3e269654ac 100644 --- a/doc/src/fix_indent.rst +++ b/doc/src/fix_indent.rst @@ -68,10 +68,10 @@ material or as an obstacle in a flow. Alternatively, it can be used as a constraining wall around a simulation; see the discussion of the *side* keyword below. -The *gstyle* geometry of the indenter can either be a sphere, a -cylinder, a cone, or a plane. +The *gstyle* keyword selects the geometry of the indenter and it can +either have the value of *sphere*, *cylinder*, *cone*, or *plane*\ . -A spherical indenter exerts a force of magnitude +A spherical indenter (*gstyle* = *sphere*) exerts a force of magnitude .. math:: @@ -82,13 +82,16 @@ distance from the atom to the center of the indenter, and *R* is the radius of the indenter. The force is repulsive and F(r) = 0 for *r* > *R*\ . -A cylindrical indenter exerts the same force, except that *r* is the -distance from the atom to the center axis of the cylinder. The -cylinder extends infinitely along its axis. +A cylindrical indenter (*gstyle* = *cylinder*) follows the same formula +for the force as a sphere, except that *r* is defined the distance +from the atom to the center axis of the cylinder. The cylinder extends +infinitely along its axis. -A conical indenter is similar to a cylindrical indenter except that it -has a finite length (between *lo* and *hi*), and that two different -radii (one at each end, *radlo* and *radhi*) can be defined. +.. versionadded:: 17April2024 + +A conical indenter (*gstyle* = *cone*) is similar to a cylindrical indenter +except that it has a finite length (between *lo* and *hi*), and that two +different radii (one at each end, *radlo* and *radhi*) can be defined. Spherical, cylindrical, and conical indenters account for periodic boundaries in two ways. First, the center point of a spherical @@ -101,15 +104,15 @@ or axis accounts for periodic boundaries. Both of these mean that an indenter can effectively move through and straddle one or more periodic boundaries. -A planar indenter is really an axis-aligned infinite-extent wall -exerting the same force on atoms in the system, where *R* is the -position of the plane and *r-R* is the distance from the plane. If -the *side* parameter of the plane is specified as *lo* then it will -indent from the lo end of the simulation box, meaning that atoms with -a coordinate less than the plane's current position will be pushed -towards the hi end of the box and atoms with a coordinate higher than -the plane's current position will feel no force. Vice versa if *side* -is specified as *hi*\ . +A planar indenter (*gstyle* = *plane*) behaves like an axis-aligned +infinite-extent wall with the same force expression on atoms in the +system as before, but where *R* is the position of the plane and *r-R* +is the distance of an from the plane. If the *side* parameter of the +plane is specified as *lo* then it will indent from the lo end of the +simulation box, meaning that atoms with a coordinate less than the +plane's current position will be pushed towards the hi end of the box +and atoms with a coordinate higher than the plane's current position +will feel no force. Vice versa if *side* is specified as *hi*\ . Any of the 4 quantities defining a spherical indenter's geometry can be specified as an equal-style :doc:`variable `, namely *x*, From 54901eb8a43e70a2cf521d95785454b769890d53 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Sat, 6 Jul 2024 09:55:41 -0400 Subject: [PATCH 132/158] remove pointless check --- src/fix_indent.cpp | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/src/fix_indent.cpp b/src/fix_indent.cpp index a8b14940f4..05aaf321a7 100644 --- a/src/fix_indent.cpp +++ b/src/fix_indent.cpp @@ -61,6 +61,7 @@ FixIndent::FixIndent(LAMMPS *lmp, int narg, char **arg) : // read geometry of indenter and optional args + istyle = NONE; int iarg = geometry(narg - 4, &arg[4]) + 4; options(narg - iarg, &arg[iarg]); @@ -474,14 +475,12 @@ int FixIndent::geometry(int narg, char **arg) { if (narg < 0) utils::missing_cmd_args(FLERR, "fix indent", error); - istyle = NONE; xstr = ystr = zstr = rstr = pstr = nullptr; xvalue = yvalue = zvalue = rvalue = pvalue = 0.0; // sphere if (strcmp(arg[0], "sphere") == 0) { - if (istyle != NONE) error->all(FLERR, "Fix indent requires a single geometry keyword"); if (5 > narg) utils::missing_cmd_args(FLERR, "fix indent sphere", error); if (utils::strmatch(arg[1], "^v_")) { @@ -508,7 +507,6 @@ int FixIndent::geometry(int narg, char **arg) // cylinder if (strcmp(arg[0], "cylinder") == 0) { - if (istyle != NONE) error->all(FLERR, "Fix indent requires a single geometry keyword"); if (5 > narg) utils::missing_cmd_args(FLERR, "fix indent cylinder", error); if (strcmp(arg[1], "x") == 0) { @@ -556,7 +554,6 @@ int FixIndent::geometry(int narg, char **arg) // cone if (strcmp(arg[0], "cone") == 0) { - if (istyle != NONE) error->all(FLERR, "Fix indent requires a single geometry keyword"); if (8 > narg) utils::missing_cmd_args(FLERR, "fix indent cone", error); if (strcmp(arg[1], "x") == 0) { @@ -619,7 +616,6 @@ int FixIndent::geometry(int narg, char **arg) // plane if (strcmp(arg[0], "plane") == 0) { - if (istyle != NONE) error->all(FLERR, "Fix indent requires a single geometry keyword"); if (4 > narg) utils::missing_cmd_args(FLERR, "fix indent plane", error); if (strcmp(arg[1], "x") == 0) cdim = 0; @@ -647,7 +643,7 @@ int FixIndent::geometry(int narg, char **arg) // invalid istyle arg - error->all(FLERR, "Unknown fix indent argument: {}", arg[0]); + error->all(FLERR, "Unknown fix indent geometry: {}", arg[0]); return 0; } From b7942ead3fd0765d2992acfab58aa4cbfaaecdba Mon Sep 17 00:00:00 2001 From: Jacob Gissinger Date: Sat, 6 Jul 2024 15:49:46 -0400 Subject: [PATCH 133/158] chunk docs typo --- doc/src/Howto_chunk.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/src/Howto_chunk.rst b/doc/src/Howto_chunk.rst index 858e8241d1..454e58cfa7 100644 --- a/doc/src/Howto_chunk.rst +++ b/doc/src/Howto_chunk.rst @@ -1,7 +1,7 @@ Use chunks to calculate system properties ========================================= -In LAMMS, "chunks" are collections of atoms, as defined by the +In LAMMPS, "chunks" are collections of atoms, as defined by the :doc:`compute chunk/atom ` command, which assigns each atom to a chunk ID (or to no chunk at all). The number of chunks and the assignment of chunk IDs to atoms can be static or change over From b1db2ddb3fd3189849ce97c6a38d160c07cff69b Mon Sep 17 00:00:00 2001 From: Jacob Gissinger Date: Sat, 6 Jul 2024 15:57:18 -0400 Subject: [PATCH 134/158] store 'nchunk for msd' on first pass because nchunk can be modified elsewhere --- src/compute_msd_chunk.cpp | 5 +++-- src/compute_msd_chunk.h | 2 ++ 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/compute_msd_chunk.cpp b/src/compute_msd_chunk.cpp index 6e7436d6ad..59aff980f1 100644 --- a/src/compute_msd_chunk.cpp +++ b/src/compute_msd_chunk.cpp @@ -32,6 +32,7 @@ ComputeMSDChunk::ComputeMSDChunk(LAMMPS *lmp, int narg, char **arg) : { if (narg != 4) error->all(FLERR, "Illegal compute msd/chunk command"); + msdnchunk = 0; array_flag = 1; size_array_cols = 4; size_array_rows = 0; @@ -117,14 +118,14 @@ void ComputeMSDChunk::compute_array() double massone; double unwrap[3]; - int oldnchunk = nchunk; ComputeChunk::compute_array(); int *ichunk = cchunk->ichunk; // first time call, allocate per-chunk arrays // thereafter, require nchunk remain the same - if (!firstflag && (oldnchunk != nchunk)) + if (firstflag) msdnchunk = nchunk; + else if (msdnchunk != nchunk) error->all(FLERR, "Compute msd/chunk nchunk is not static"); // zero local per-chunk values diff --git a/src/compute_msd_chunk.h b/src/compute_msd_chunk.h index aba0c25fcb..38883ee904 100644 --- a/src/compute_msd_chunk.h +++ b/src/compute_msd_chunk.h @@ -35,6 +35,8 @@ class ComputeMSDChunk : public ComputeChunk { double memory_usage() override; private: + int msdnchunk; + char *id_fix; class FixStoreGlobal *fix; From 08cf19955d272ebd8ed5f4ab24ff80fee83f3fea Mon Sep 17 00:00:00 2001 From: Jacob Gissinger Date: Sat, 6 Jul 2024 17:57:18 -0400 Subject: [PATCH 135/158] minor corrections to 'reset_atoms' docs --- doc/src/reset_atoms.rst | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/doc/src/reset_atoms.rst b/doc/src/reset_atoms.rst index 89f9557d7c..0c0bbf43c8 100644 --- a/doc/src/reset_atoms.rst +++ b/doc/src/reset_atoms.rst @@ -32,7 +32,7 @@ Syntax .. code-block:: LAMMPS - reset atoms mol group-ID keyword value ... + reset_atoms mol group-ID keyword value ... * group-ID = ID of group of atoms whose molecule IDs will be reset * zero or more keyword/value pairs can be appended @@ -66,16 +66,16 @@ Description .. versionadded:: 22Dec2022 The *reset_atoms* command resets the values of a specified atom -property. In contrast to the set command, it does this in a +property. In contrast to the *set* command, it does this in a collective manner which resets the values for many atoms in a -self-consistent way. This is often useful when the simulated system -has undergone significant modifications like adding or removing atoms -or molecules, joining data files, changing bonds, or large-scale +self-consistent way. This command is often useful when the simulated +system has undergone significant modifications like adding or removing +atoms or molecules, joining data files, changing bonds, or large-scale diffusion. The new values can be thought of as a *reset*, similar to values atoms would have if a new data file were being read or a new simulation -performed. Note that the set command also resets atom properties to +performed. Note that the *set* command also resets atom properties to new values, but it treats each atom independently. The *property* setting can be *id* or *image* or *mol*. For *id*, the @@ -90,7 +90,7 @@ keyword/value settings are given below. ---------- -*Property id* +Property: *id* Reset atom IDs for the entire system, including all the global IDs stored for bond, angle, dihedral, improper topology data. This will @@ -146,7 +146,7 @@ processor have consecutive IDs, as the :doc:`create_atoms ---------- -*Property image* +Property: *image* Reset the image flags of atoms so that at least one atom in each molecule has an image flag of 0. Molecular topology is respected so @@ -191,7 +191,7 @@ flags. ---------- -*Property mol* +Property: *mol* Reset molecule IDs for a specified group of atoms based on current bond connectivity. This will typically create a new set of molecule @@ -266,7 +266,7 @@ The *image* property can only be used when the atom style supports bonds. Related commands """""""""""""""" -:doc:`compute fragment/atom ` +:doc:`compute fragment/atom `, :doc:`fix bond/react `, :doc:`fix bond/create `, :doc:`fix bond/break `, From 1a30fe53499c579495d370f1fdafeba2dc096ef6 Mon Sep 17 00:00:00 2001 From: Jacob Gissinger Date: Sat, 6 Jul 2024 18:03:43 -0400 Subject: [PATCH 136/158] reset_atoms: one more grammar tweak --- doc/src/reset_atoms.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/src/reset_atoms.rst b/doc/src/reset_atoms.rst index 0c0bbf43c8..3b4ee816d8 100644 --- a/doc/src/reset_atoms.rst +++ b/doc/src/reset_atoms.rst @@ -203,7 +203,7 @@ For purposes of this operation, molecules are identified by the current bond connectivity in the system, which may or may not be consistent with the current molecule IDs. A molecule in this context is a set of atoms connected to each other with explicit bonds. The specific algorithm -used is the one of :doc:`compute fragment/atom ` +used is the one of :doc:`compute fragment/atom `. Once the molecules are identified and a new molecule ID computed for each, this command will update the current molecule ID for all atoms in the group with the new molecule ID. Note that if the group excludes From 8f6cf085e871f4cb1a1aadca6b5f4f7a307b16b3 Mon Sep 17 00:00:00 2001 From: jtclemm Date: Tue, 9 Jul 2024 15:06:18 -0600 Subject: [PATCH 137/158] syncing table in build_packages/extra --- doc/src/Build_package.rst | 1 + 1 file changed, 1 insertion(+) diff --git a/doc/src/Build_package.rst b/doc/src/Build_package.rst index 63ccac534d..b70a1ca4d1 100644 --- a/doc/src/Build_package.rst +++ b/doc/src/Build_package.rst @@ -62,6 +62,7 @@ packages: * :ref:`POEMS ` * :ref:`PYTHON ` * :ref:`QMMM ` + * :ref:`RHEO ` * :ref:`SCAFACOS ` * :ref:`VORONOI ` * :ref:`VTK ` From b9e263b1d1f0df20cb2e56fae1dcc09fe7be871e Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Wed, 10 Jul 2024 16:17:33 -0400 Subject: [PATCH 138/158] re-add empty row between special and regular pair styles --- doc/src/Commands_pair.rst | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/doc/src/Commands_pair.rst b/doc/src/Commands_pair.rst index f83f2539a3..c0747b83d4 100644 --- a/doc/src/Commands_pair.rst +++ b/doc/src/Commands_pair.rst @@ -35,6 +35,10 @@ OPT. * * * + * + * + * + * * :doc:`adp (ko) ` * :doc:`agni (o) ` * :doc:`aip/water/2dm (t) ` From e51e0c1fb7a3729c2dfa5732247d5c5d9d2376b1 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Thu, 11 Jul 2024 11:37:42 -0400 Subject: [PATCH 139/158] re-order entries --- doc/src/pair_coul.rst | 27 ++++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/doc/src/pair_coul.rst b/doc/src/pair_coul.rst index 14cc4851f6..2a011dc2d2 100644 --- a/doc/src/pair_coul.rst +++ b/doc/src/pair_coul.rst @@ -2,6 +2,8 @@ .. index:: pair_style coul/cut/gpu .. index:: pair_style coul/cut/kk .. index:: pair_style coul/cut/omp +.. index:: pair_style coul/cut/global +.. index:: pair_style coul/cut/global/omp .. index:: pair_style coul/debye .. index:: pair_style coul/debye/gpu .. index:: pair_style coul/debye/kk @@ -11,8 +13,6 @@ .. index:: pair_style coul/dsf/kk .. index:: pair_style coul/dsf/omp .. index:: pair_style coul/exclude -.. index:: pair_style coul/cut/global -.. index:: pair_style coul/cut/global/omp .. index:: pair_style coul/long .. index:: pair_style coul/long/omp .. index:: pair_style coul/long/kk @@ -33,6 +33,11 @@ pair_style coul/cut command Accelerator Variants: *coul/cut/gpu*, *coul/cut/kk*, *coul/cut/omp* +pair_style coul/cut/global command +================================== + +Accelerator Variants: *coul/cut/omp* + pair_style coul/debye command ============================= @@ -46,11 +51,6 @@ Accelerator Variants: *coul/dsf/gpu*, *coul/dsf/kk*, *coul/dsf/omp* pair_style coul/exclude command =============================== -pair_style coul/cut/global command -================================== - -Accelerator Variants: *coul/cut/omp* - pair_style coul/long command ============================ @@ -79,16 +79,17 @@ pair_style tip4p/long command Accelerator Variants: *tip4p/long/omp* + Syntax """""" .. code-block:: LAMMPS pair_style coul/cut cutoff + pair_style coul/cut/global cutoff pair_style coul/debye kappa cutoff pair_style coul/dsf alpha cutoff pair_style coul/exclude cutoff - pair_style coul/cut/global cutoff pair_style coul/long cutoff pair_style coul/wolf alpha cutoff pair_style coul/streitz cutoff keyword alpha @@ -152,6 +153,11 @@ the 2 atoms, and :math:`\epsilon` is the dielectric constant which can be set by the :doc:`dielectric ` command. The cutoff :math:`r_c` truncates the interaction distance. +Pair style *coul/cut/global* computes the same Coulombic interactions +as style *coul/cut* except that it allows only a single global cutoff +and thus makes it compatible for use in combination with long-range +coulomb styles in :doc:`hybrid pair styles `. + ---------- Style *coul/debye* adds an additional exp() damping factor to the @@ -262,11 +268,6 @@ Streitz-Mintmire parameterization for the material being modeled. ---------- -Pair style *coul/cut/global* computes the same Coulombic interactions -as style *coul/cut* except that it allows only a single global cutoff -and thus makes it compatible for use in combination with long-range -coulomb styles in :doc:`hybrid pair styles `. - Pair style *coul/exclude* computes Coulombic interactions like *coul/cut* but **only** applies them to excluded pairs using a scaling factor of :math:`\gamma - 1.0` with :math:`\gamma` being the factor assigned From 9e917412c923673428813633f21cb6a7c73a6e8f Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Thu, 11 Jul 2024 12:39:42 -0400 Subject: [PATCH 140/158] fix typo and rewrap lines --- doc/src/Packages_details.rst | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/doc/src/Packages_details.rst b/doc/src/Packages_details.rst index e759e3bd18..a62e7e41b3 100644 --- a/doc/src/Packages_details.rst +++ b/doc/src/Packages_details.rst @@ -1323,18 +1323,19 @@ KSPACE package **Contents:** -A variety of long-range Coulombic solvers, as well as pair styles -which compute the corresponding short-range pairwise Coulombic -interactions. These include Ewald, particle-particle particle-mesh -(PPPM), and multilevel summation method (MSM) solvers. +A variety of long-range Coulombic solvers, as well as pair styles which +compute the corresponding short-range pairwise Coulombic interactions. +These include Ewald, particle-particle particle-mesh (PPPM), and +multilevel summation method (MSM) solvers. **Install:** -Building with this package requires a 1d FFT library be present on -your system for use by the PPPM solvers. This can be the KISS FFT -library provided with LAMMPS, third party libraries like FFTW, or a -vendor-supplied FFT library. See the :doc:`Build settings ` page for details on how to select -different FFT options for your LAMPMS build. +Building with this package requires a 1d FFT library be present on your +system for use by the PPPM solvers. This can be the KISS FFT library +provided with LAMMPS, third party libraries like FFTW, or a +vendor-supplied FFT library. See the :doc:`Build settings +` page for details on how to select different FFT +options for your LAMMPS build. **Supporting info:** From c1c1d32136f3af8242a6ba6417cc9f7c89c38746 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Thu, 11 Jul 2024 13:32:56 -0400 Subject: [PATCH 141/158] The post_force callback should also be called during "setup" --- src/PYTHON/fix_python_invoke.cpp | 7 +++++++ src/PYTHON/fix_python_invoke.h | 1 + 2 files changed, 8 insertions(+) diff --git a/src/PYTHON/fix_python_invoke.cpp b/src/PYTHON/fix_python_invoke.cpp index 786c48568d..281379cda4 100644 --- a/src/PYTHON/fix_python_invoke.cpp +++ b/src/PYTHON/fix_python_invoke.cpp @@ -105,6 +105,13 @@ void FixPythonInvoke::end_of_step() /* ---------------------------------------------------------------------- */ +void FixPythonInvoke::setup(int vflag) +{ + post_force(vflag); +} + +/* ---------------------------------------------------------------------- */ + void FixPythonInvoke::post_force(int vflag) { if (update->ntimestep % nevery != 0) return; diff --git a/src/PYTHON/fix_python_invoke.h b/src/PYTHON/fix_python_invoke.h index 12f463501f..09382e5780 100644 --- a/src/PYTHON/fix_python_invoke.h +++ b/src/PYTHON/fix_python_invoke.h @@ -30,6 +30,7 @@ class FixPythonInvoke : public Fix { FixPythonInvoke(class LAMMPS *, int, char **); ~FixPythonInvoke() override; int setmask() override; + void setup(int) override; void end_of_step() override; void post_force(int) override; From a55092dc26527aa4f4225fcb8f7b05626ff2a393 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Thu, 11 Jul 2024 13:39:44 -0400 Subject: [PATCH 142/158] rewrap docs --- doc/src/fix_store_force.rst | 26 +++++++++++++++----------- 1 file changed, 15 insertions(+), 11 deletions(-) diff --git a/doc/src/fix_store_force.rst b/doc/src/fix_store_force.rst index 487d4f0352..acce05fbf8 100644 --- a/doc/src/fix_store_force.rst +++ b/doc/src/fix_store_force.rst @@ -23,11 +23,12 @@ Examples Description """"""""""" -Store the forces on atoms in the group at the point during each -timestep when the fix is invoked, as described below. This is useful -for storing forces before constraints or other boundary conditions are -computed which modify the forces, so that unmodified forces can be -:doc:`written to a dump file ` or accessed by other :doc:`output commands ` that use per-atom quantities. +Store the forces on atoms in the group at the point during each timestep +when the fix is invoked, as described below. This is useful for storing +forces before constraints or other boundary conditions are computed +which modify the forces, so that unmodified forces can be :doc:`written +to a dump file ` or accessed by other :doc:`output commands +` that use per-atom quantities. This fix is invoked at the point in the velocity-Verlet timestepping immediately after :doc:`pair `, :doc:`bond `, @@ -36,12 +37,13 @@ immediately after :doc:`pair `, :doc:`bond `, forces have been calculated. It is the point in the timestep when various fixes that compute constraint forces are calculated and potentially modify the force on each atom. Examples of such fixes are -:doc:`fix shake `, :doc:`fix wall `, and :doc:`fix indent `. +:doc:`fix shake `, :doc:`fix wall `, and :doc:`fix +indent `. .. note:: - The order in which various fixes are applied which operate at - the same point during the timestep, is the same as the order they are + The order in which various fixes are applied which operate at the + same point during the timestep, is the same as the order they are specified in the input script. Thus normally, if you want to store per-atom forces due to force field interactions, before constraints are applied, you should list this fix first within that set of fixes, @@ -52,8 +54,9 @@ potentially modify the force on each atom. Examples of such fixes are 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 produces a per-atom array which can be accessed by various :doc:`output commands `. The number of columns for each @@ -61,7 +64,8 @@ atom is 3, and the columns store the x,y,z forces on each atom. The per-atom values be accessed on any timestep. 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 """""""""""" From 47af1775c2278c2a4c949ef6cfc7f90f323234c4 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Thu, 11 Jul 2024 15:02:03 -0400 Subject: [PATCH 143/158] update test since we have now one invocation also during setup --- unittest/python/test_python_package.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/unittest/python/test_python_package.cpp b/unittest/python/test_python_package.cpp index f998ebbcd8..7d3382d46f 100644 --- a/unittest/python/test_python_package.cpp +++ b/unittest/python/test_python_package.cpp @@ -342,7 +342,7 @@ TEST_F(FixPythonInvokeTest, post_force) if (line == "PYTHON_POST_FORCE") ++count; } - ASSERT_EQ(count, 5); + ASSERT_EQ(count, 6); } } // namespace LAMMPS_NS From 0e6ff7d70a0aa0c18acd315b0227151f5670b25d Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Thu, 11 Jul 2024 15:02:38 -0400 Subject: [PATCH 144/158] only call post_force() if it was selected as callback. --- src/PYTHON/fix_python_invoke.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/PYTHON/fix_python_invoke.cpp b/src/PYTHON/fix_python_invoke.cpp index 281379cda4..7fd3ad88f7 100644 --- a/src/PYTHON/fix_python_invoke.cpp +++ b/src/PYTHON/fix_python_invoke.cpp @@ -107,7 +107,7 @@ void FixPythonInvoke::end_of_step() void FixPythonInvoke::setup(int vflag) { - post_force(vflag); + if (selected_callback == POST_FORCE) post_force(vflag); } /* ---------------------------------------------------------------------- */ From 06511a6e77442fb1b2421c33202a7ddcd621987f Mon Sep 17 00:00:00 2001 From: Jacob Gissinger Date: Thu, 11 Jul 2024 19:17:09 -0400 Subject: [PATCH 145/158] couple more doc tweaks --- doc/src/Howto_chunk.rst | 16 ++++++++-------- doc/src/read_data.rst | 2 +- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/doc/src/Howto_chunk.rst b/doc/src/Howto_chunk.rst index 454e58cfa7..f8655b745d 100644 --- a/doc/src/Howto_chunk.rst +++ b/doc/src/Howto_chunk.rst @@ -148,14 +148,14 @@ Example calculations with chunks Here are examples using chunk commands to calculate various properties: -(1) Average velocity in each of 1000 2d spatial bins: +1. Average velocity in each of 1000 2d spatial bins: .. code-block:: LAMMPS compute cc1 all chunk/atom bin/2d x 0.0 0.1 y lower 0.01 units reduced fix 1 all ave/chunk 100 10 1000 cc1 vx vy file tmp.out -(2) Temperature in each spatial bin, after subtracting a flow +2. Temperature in each spatial bin, after subtracting a flow velocity: .. code-block:: LAMMPS @@ -164,7 +164,7 @@ velocity: compute vbias all temp/profile 1 0 0 y 10 fix 1 all ave/chunk 100 10 1000 cc1 temp bias vbias file tmp.out -(3) Center of mass of each molecule: +3. Center of mass of each molecule: .. code-block:: LAMMPS @@ -172,7 +172,7 @@ velocity: compute myChunk all com/chunk cc1 fix 1 all ave/time 100 1 100 c_myChunk[*] file tmp.out mode vector -(4) Total force on each molecule and ave/max across all molecules: +4. Total force on each molecule and ave/max across all molecules: .. code-block:: LAMMPS @@ -183,7 +183,7 @@ velocity: thermo 1000 thermo_style custom step temp v_xave v_xmax -(5) Histogram of cluster sizes: +5. Histogram of cluster sizes: .. code-block:: LAMMPS @@ -192,16 +192,16 @@ velocity: compute size all property/chunk cc1 count fix 1 all ave/histo 100 1 100 0 20 20 c_size mode vector ave running beyond ignore file tmp.histo -(6) An example for using a per-chunk value to apply per-atom forces to +6. An example for using a per-chunk value to apply per-atom forces to compress individual polymer chains (molecules) in a mixture, is explained on the :doc:`compute chunk/spread/atom ` command doc page. -(7) An example for using one set of per-chunk values for molecule +7. An example for using one set of per-chunk values for molecule chunks, to create a second set of micelle-scale chunks (clustered molecules, due to hydrophobicity), is explained on the :doc:`compute reduce/chunk ` command doc page. -(8) An example for using one set of per-chunk values (dipole moment +8. An example for using one set of per-chunk values (dipole moment vectors) for molecule chunks, spreading the values to each atom in each chunk, then defining a second set of chunks as spatial bins, and using the :doc:`fix ave/chunk ` command to calculate an diff --git a/doc/src/read_data.rst b/doc/src/read_data.rst index dd2f42e2a8..88060a105b 100644 --- a/doc/src/read_data.rst +++ b/doc/src/read_data.rst @@ -12,7 +12,7 @@ Syntax * file = name of data file to read in * zero or more keyword/arg pairs may be appended -* keyword = *add* or *offset* or *shift* or *extra/atom/types* or *extra/bond/types* or *extra/angle/types* or *extra/dihedral/types* or *extra/improper/types* or *extra/bond/per/atom* or *extra/angle/per/atom* or *extra/dihedral/per/atom* or *extra/improper/per/atom* or *group* or *nocoeff* or *fix* +* keyword = *add* or *offset* or *shift* or *extra/atom/types* or *extra/bond/types* or *extra/angle/types* or *extra/dihedral/types* or *extra/improper/types* or *extra/bond/per/atom* or *extra/angle/per/atom* or *extra/dihedral/per/atom* or *extra/improper/per/atom* or *extra/special/per/atom* or *group* or *nocoeff* or *fix* .. parsed-literal:: From a0fb12c265024b6e05b4c4057b6065be77ef2d1c Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Fri, 12 Jul 2024 23:42:42 -0400 Subject: [PATCH 146/158] disentangle the fix deform and fix deform/pressure pages somewhere for easier reading --- doc/src/fix_deform.rst | 48 ++++++---------------------- doc/src/fix_deform_pressure.rst | 55 ++++++++++++++++++++++++++++++--- 2 files changed, 59 insertions(+), 44 deletions(-) diff --git a/doc/src/fix_deform.rst b/doc/src/fix_deform.rst index 2c76463369..c5832d1729 100644 --- a/doc/src/fix_deform.rst +++ b/doc/src/fix_deform.rst @@ -4,9 +4,6 @@ fix deform command ================== -:doc:`fix deform/pressure ` command -======================================================== - Accelerator Variants: *deform/kk* Syntax @@ -14,12 +11,11 @@ Syntax .. code-block:: LAMMPS - fix ID group-ID fix_style N parameter style args ... keyword value ... + fix ID group-ID deform N parameter style args ... keyword value ... * ID, group-ID are documented in :doc:`fix ` command -* fix_style = *deform* or *deform/pressure* * N = perform box deformation every this many timesteps -* one or more parameter/style/args sequences of arguments may be appended +* one or more parameter/args sequences may be appended .. parsed-literal:: @@ -46,12 +42,6 @@ Syntax *variable* values = v_name1 v_name2 v_name1 = variable with name1 for box length change as function of time v_name2 = variable with name2 for change rate as function of time - *pressure* values = target gain (ONLY available in :doc:`fix deform/pressure ` command) - target = target pressure (pressure units) - gain = proportional gain constant (1/(time * pressure) or 1/time units) - *pressure/mean* values = target gain (ONLY available in :doc:`fix deform/pressure ` command) - target = target pressure (pressure units) - gain = proportional gain constant (1/(time * pressure) or 1/time units) *xy*, *xz*, *yz* args = style value style = *final* or *delta* or *vel* or *erate* or *trate* or *wiggle* or *variable* @@ -64,8 +54,6 @@ Syntax effectively an engineering shear strain rate *erate* value = R R = engineering shear strain rate (1/time units) - *erate/rescale* value = R (ONLY available in :doc:`fix deform/pressure ` command) - R = engineering shear strain rate (1/time units) *trate* value = R R = true shear strain rate (1/time units) *wiggle* values = A Tp @@ -74,9 +62,6 @@ Syntax *variable* values = v_name1 v_name2 v_name1 = variable with name1 for tilt change as function of time v_name2 = variable with name2 for change rate as function of time - *pressure* values = target gain (ONLY available in :doc:`fix deform/pressure ` command) - target = target pressure (pressure units) - gain = proportional gain constant (1/(time * pressure) or 1/time units) * zero or more keyword/value pairs may be appended * keyword = *remap* or *flip* or *units* or *couple* or *vol/balance/p* or *max/rate* or *normalize/pressure* @@ -92,15 +77,6 @@ Syntax *units* value = *lattice* or *box* lattice = distances are defined in lattice units box = distances are defined in simulation box units - *couple* value = *none* or *xyz* or *xy* or *yz* or *xz* (ONLY available in :doc:`fix deform/pressure ` command) - couple pressure values of various dimensions - *vol/balance/p* value = *yes* or *no* (ONLY available in :doc:`fix deform/pressure ` command) - Modifies the behavior of the *volume* option to try and balance pressures - *max/rate* value = *rate* (ONLY available in :doc:`fix deform/pressure ` command) - rate = maximum strain rate for pressure control - *normalize/pressure* value = *yes* or *no* (ONLY available in :doc:`fix deform/pressure ` command) - Modifies pressure controls such that the deviation in pressure is normalized by the target pressure - Examples """""""" @@ -112,8 +88,6 @@ Examples fix 1 all deform 1 xy erate 0.001 remap v fix 1 all deform 10 y delta -0.5 0.5 xz vel 1.0 -See examples for :doc:`fix deform/pressure ` on its doc page - Description """"""""""" @@ -123,17 +97,13 @@ run. Orthogonal simulation boxes have 3 adjustable parameters adjustable parameters (x,y,z,xy,xz,yz). Any or all of them can be adjusted independently and simultaneously. -The fix deform command allows use of all the arguments listed above, -except those flagged as available ONLY for the :doc:`fix -deform/pressure ` command, which are -pressure-based controls. The fix deform/pressure command allows use -of all the arguments listed above. - -The rest of this doc page explains the options common to both -commands. The :doc:`fix deform/pressure ` doc -page explains the options available ONLY with the fix deform/pressure -command. Note that a simulation can define only a single deformation -command: fix deform or fix deform/pressure. +The :doc:`fix deform/pressure ` command extends +this command with additional keywords and arguments. The rest of this +page explains the options common to both commands. The :doc:`fix +deform/pressure ` page explains the options +available ONLY with the fix deform/pressure command. Note that a +simulation can define only a single deformation command: fix deform or +fix deform/pressure. Both these fixes can be used to perform non-equilibrium MD (NEMD) simulations of a continuously strained system. See the :doc:`fix diff --git a/doc/src/fix_deform_pressure.rst b/doc/src/fix_deform_pressure.rst index 25ad5bfeca..d99a7611c4 100644 --- a/doc/src/fix_deform_pressure.rst +++ b/doc/src/fix_deform_pressure.rst @@ -13,29 +13,66 @@ Syntax * ID, group-ID are documented in :doc:`fix ` command * deform/pressure = style name of this fix command * N = perform box deformation every this many timesteps -* one or more parameter/arg sequences may be appended +* one or more parameter/args sequences may be appended .. parsed-literal:: parameter = *x* or *y* or *z* or *xy* or *xz* or *yz* or *box* *x*, *y*, *z* args = style value(s) style = *final* or *delta* or *scale* or *vel* or *erate* or *trate* or *volume* or *wiggle* or *variable* or *pressure* or *pressure/mean* + *final* values = lo hi + lo hi = box boundaries at end of run (distance units) + *delta* values = dlo dhi + dlo dhi = change in box boundaries at end of run (distance units) + *scale* values = factor + factor = multiplicative factor for change in box length at end of run + *vel* value = V + V = change box length at this velocity (distance/time units), + effectively an engineering strain rate + *erate* value = R + R = engineering strain rate (1/time units) + *trate* value = R + R = true strain rate (1/time units) + *volume* value = none = adjust this dim to preserve volume of system + *wiggle* values = A Tp + A = amplitude of oscillation (distance units) + Tp = period of oscillation (time units) + *variable* values = v_name1 v_name2 + v_name1 = variable with name1 for box length change as function of time + v_name2 = variable with name2 for change rate as function of time *pressure* values = target gain target = target pressure (pressure units) gain = proportional gain constant (1/(time * pressure) or 1/time units) *pressure/mean* values = target gain target = target pressure (pressure units) gain = proportional gain constant (1/(time * pressure) or 1/time units) - NOTE: All other styles are documented by the :doc:`fix deform ` command *xy*, *xz*, *yz* args = style value style = *final* or *delta* or *vel* or *erate* or *trate* or *wiggle* or *variable* or *pressure* or *erate/rescale* + *final* value = tilt + tilt = tilt factor at end of run (distance units) + *delta* value = dtilt + dtilt = change in tilt factor at end of run (distance units) + *vel* value = V + V = change tilt factor at this velocity (distance/time units), + effectively an engineering shear strain rate + *erate* value = R + R = engineering shear strain rate (1/time units) + *erate/rescale* value = R + R = engineering shear strain rate (1/time units) + *trate* value = R + R = true shear strain rate (1/time units) + *wiggle* values = A Tp + A = amplitude of oscillation (distance units) + Tp = period of oscillation (time units) + *variable* values = v_name1 v_name2 + v_name1 = variable with name1 for tilt change as function of time + v_name2 = variable with name2 for change rate as function of time *pressure* values = target gain target = target pressure (pressure units) gain = proportional gain constant (1/(time * pressure) or 1/time units) *erate/rescale* value = R R = engineering shear strain rate (1/time units) - NOTE: All other styles are documented by the :doc:`fix deform ` command *box* = style value style = *volume* or *pressure* @@ -49,6 +86,15 @@ Syntax .. parsed-literal:: + *remap* value = *x* or *v* or *none* + x = remap coords of atoms in group into deforming box + v = remap velocities of atoms in group when they cross periodic boundaries + none = no remapping of x or v + *flip* value = *yes* or *no* + allow or disallow box flips when it becomes highly skewed + *units* value = *lattice* or *box* + lattice = distances are defined in lattice units + box = distances are defined in simulation box units *couple* value = *none* or *xyz* or *xy* or *yz* or *xz* couple pressure values of various dimensions *vol/balance/p* value = *yes* or *no* @@ -57,7 +103,6 @@ Syntax rate = maximum strain rate for pressure control *normalize/pressure* value = *yes* or *no* Modifies pressure controls such that the deviation in pressure is normalized by the target pressure - NOTE: All other keywords are documented by the :doc:`fix deform ` command Examples """""""" @@ -79,7 +124,7 @@ pressure-based controls implemented by this command. All arguments described on the :doc:`fix deform ` doc page also apply to this fix unless otherwise noted below. The rest of this -doc page explains the arguments specific to this fix. Note that a +page explains the arguments specific to this fix only. Note that a simulation can define only a single deformation command: fix deform or fix deform/pressure. From 1912083935919792e278d247dfc76e3d7bb2882c Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Fri, 12 Jul 2024 23:43:14 -0400 Subject: [PATCH 147/158] add warning about overflowing image flags and how to prevent that --- doc/src/fix_deform.rst | 18 ++++++++++++++++++ doc/src/fix_deform_pressure.rst | 16 ++++++++++++++++ 2 files changed, 34 insertions(+) diff --git a/doc/src/fix_deform.rst b/doc/src/fix_deform.rst index c5832d1729..829e4947eb 100644 --- a/doc/src/fix_deform.rst +++ b/doc/src/fix_deform.rst @@ -113,6 +113,24 @@ simulation of a continuously extended system (extensional flow) can be modeled using the :ref:`UEF package ` and its :doc:`fix commands `. +.. admonition:: Inconsistent trajectories due to image flags + :class: warning + + When running long simulations while shearing the box or using a high + shearing rate, it is possible that the image flags used for storing + unwrapped atom positions will "wrap around". When LAMMPS is compiled + with the default settings, case image flags are limited to a range of + :math:`-512 \le i \le 511`, which will overflow when atoms starting + at zero image flag value have passed through a periodic box dimension + more than 512 times. + + Changing the :ref:`size of LAMMPS integer types ` to the + "bigbig" setting can make this overflow much less likely, since it + increases the image flag value range to :math:`- 1,048,576 \le i \le + 1\,048\,575` + +---------- + For the *x*, *y*, *z* parameters, the associated dimension cannot be shrink-wrapped. For the *xy*, *yz*, *xz* parameters, the associated second dimension cannot be shrink-wrapped. Dimensions not varied by diff --git a/doc/src/fix_deform_pressure.rst b/doc/src/fix_deform_pressure.rst index d99a7611c4..f2881c5e28 100644 --- a/doc/src/fix_deform_pressure.rst +++ b/doc/src/fix_deform_pressure.rst @@ -128,6 +128,22 @@ page explains the arguments specific to this fix only. Note that a simulation can define only a single deformation command: fix deform or fix deform/pressure. +.. admonition:: Inconsistent trajectories due to image flags + :class: warning + + When running long simulations while shearing the box or using a high + shearing rate, it is possible that the image flags used for storing + unwrapped atom positions will "wrap around". When LAMMPS is compiled + with the default settings, case image flags are limited to a range of + :math:`-512 \le i \le 511`, which will overflow when atoms starting + at zero image flag value have passed through a periodic box dimension + more than 512 times. + + Changing the :ref:`size of LAMMPS integer types ` to the + "bigbig" setting can make this overflow much less likely, since it + increases the image flag value range to :math:`- 1,048,576 \le i \le + 1\,048\,575` + ---------- For the *x*, *y*, and *z* parameters, this is the meaning of the From 58513320d3332a32a0f6ffb330fdce8d56dd6e5e Mon Sep 17 00:00:00 2001 From: Richard Berger Date: Sat, 13 Jul 2024 15:33:56 -0600 Subject: [PATCH 148/158] core files: replace sprintf with snprintf --- src/dump_atom.cpp | 8 ++++-- src/dump_cfg.cpp | 32 ++++++++++++---------- src/dump_custom.cpp | 17 ++++++------ src/dump_grid.cpp | 13 +++++---- src/dump_local.cpp | 15 +++++----- src/dump_xyz.cpp | 4 +-- src/variable.cpp | 2 +- unittest/fortran/wrap_extract_variable.cpp | 6 ++-- 8 files changed, 53 insertions(+), 44 deletions(-) diff --git a/src/dump_atom.cpp b/src/dump_atom.cpp index dfacf8f2da..2238a3a81d 100644 --- a/src/dump_atom.cpp +++ b/src/dump_atom.cpp @@ -674,7 +674,9 @@ int DumpAtom::convert_image(int n, double *mybuf) memory->grow(sbuf,maxsbuf,"dump:sbuf"); } - offset += sprintf(&sbuf[offset],format, + offset += snprintf(&sbuf[offset], + maxsbuf - offset, + format, static_cast (mybuf[m]), static_cast (mybuf[m+1]), mybuf[m+2],mybuf[m+3],mybuf[m+4], @@ -700,7 +702,9 @@ int DumpAtom::convert_noimage(int n, double *mybuf) memory->grow(sbuf,maxsbuf,"dump:sbuf"); } - offset += sprintf(&sbuf[offset],format, + offset += snprintf(&sbuf[offset], + maxsbuf - offset, + format, static_cast (mybuf[m]), static_cast (mybuf[m+1]), mybuf[m+2],mybuf[m+3],mybuf[m+4]); diff --git a/src/dump_cfg.cpp b/src/dump_cfg.cpp index e5af83a3c6..0d22ece2c3 100644 --- a/src/dump_cfg.cpp +++ b/src/dump_cfg.cpp @@ -166,23 +166,24 @@ int DumpCFG::convert_string(int n, double *mybuf) } for (j = 0; j < size_one; j++) { + const auto maxsize = maxsbuf - offset; if (j == 0) { - offset += sprintf(&sbuf[offset],"%f \n",mybuf[m]); + offset += snprintf(&sbuf[offset],maxsize,"%f \n",mybuf[m]); } else if (j == 1) { - offset += sprintf(&sbuf[offset],"%s \n",typenames[(int) mybuf[m]]); + offset += snprintf(&sbuf[offset],maxsize,"%s \n",typenames[(int) mybuf[m]]); } else if (j >= 2) { if (vtype[j] == Dump::INT) - offset += sprintf(&sbuf[offset],vformat[j],static_cast (mybuf[m])); + offset += snprintf(&sbuf[offset],maxsize,vformat[j],static_cast (mybuf[m])); else if (vtype[j] == Dump::DOUBLE) - offset += sprintf(&sbuf[offset],vformat[j],mybuf[m]); + offset += snprintf(&sbuf[offset],maxsize,vformat[j],mybuf[m]); else if (vtype[j] == Dump::STRING) - offset += sprintf(&sbuf[offset],vformat[j],typenames[(int) mybuf[m]]); + offset += snprintf(&sbuf[offset],maxsize,vformat[j],typenames[(int) mybuf[m]]); else if (vtype[j] == Dump::BIGINT) - offset += sprintf(&sbuf[offset],vformat[j],static_cast (mybuf[m])); + offset += snprintf(&sbuf[offset],maxsize,vformat[j],static_cast (mybuf[m])); } m++; } - offset += sprintf(&sbuf[offset],"\n"); + offset += snprintf(&sbuf[offset],maxsbuf-offset,"\n"); } } else if (unwrapflag == 1) { @@ -195,29 +196,30 @@ int DumpCFG::convert_string(int n, double *mybuf) } for (j = 0; j < size_one; j++) { + const auto maxsize = maxsbuf - offset; if (j == 0) { - offset += sprintf(&sbuf[offset],"%f \n",mybuf[m]); + offset += snprintf(&sbuf[offset],maxsize,"%f \n",mybuf[m]); } else if (j == 1) { - offset += sprintf(&sbuf[offset],"%s \n",typenames[(int) mybuf[m]]); + offset += snprintf(&sbuf[offset],maxsize,"%s \n",typenames[(int) mybuf[m]]); } else if (j >= 2 && j <= 4) { unwrap_coord = (mybuf[m] - 0.5)/UNWRAPEXPAND + 0.5; - offset += sprintf(&sbuf[offset],vformat[j],unwrap_coord); + offset += snprintf(&sbuf[offset],maxsize,vformat[j],unwrap_coord); } else if (j >= 5) { if (vtype[j] == Dump::INT) offset += - sprintf(&sbuf[offset],vformat[j],static_cast (mybuf[m])); + snprintf(&sbuf[offset],maxsize,vformat[j],static_cast (mybuf[m])); else if (vtype[j] == Dump::DOUBLE) - offset += sprintf(&sbuf[offset],vformat[j],mybuf[m]); + offset += snprintf(&sbuf[offset],maxsize,vformat[j],mybuf[m]); else if (vtype[j] == Dump::STRING) offset += - sprintf(&sbuf[offset],vformat[j],typenames[(int) mybuf[m]]); + snprintf(&sbuf[offset],maxsize,vformat[j],typenames[(int) mybuf[m]]); else if (vtype[j] == Dump::BIGINT) offset += - sprintf(&sbuf[offset],vformat[j],static_cast (mybuf[m])); + snprintf(&sbuf[offset],maxsize,vformat[j],static_cast (mybuf[m])); } m++; } - offset += sprintf(&sbuf[offset],"\n"); + offset += snprintf(&sbuf[offset],maxsbuf - offset,"\n"); } } diff --git a/src/dump_custom.cpp b/src/dump_custom.cpp index abdc46c55a..fdba2e5477 100644 --- a/src/dump_custom.cpp +++ b/src/dump_custom.cpp @@ -1358,20 +1358,21 @@ int DumpCustom::convert_string(int n, double *mybuf) } for (j = 0; j < nfield; j++) { + const auto maxsize = maxsbuf - offset; if (vtype[j] == Dump::INT) - offset += sprintf(&sbuf[offset],vformat[j],static_cast (mybuf[m])); + offset += snprintf(&sbuf[offset],maxsize,vformat[j],static_cast (mybuf[m])); else if (vtype[j] == Dump::DOUBLE) - offset += sprintf(&sbuf[offset],vformat[j],mybuf[m]); + offset += snprintf(&sbuf[offset],maxsize,vformat[j],mybuf[m]); else if (vtype[j] == Dump::STRING) - offset += sprintf(&sbuf[offset],vformat[j],typenames[(int) mybuf[m]]); + offset += snprintf(&sbuf[offset],maxsize,vformat[j],typenames[(int) mybuf[m]]); else if (vtype[j] == Dump::STRING2) - offset += sprintf(&sbuf[offset],vformat[j],atom->lmap->typelabel[(int) mybuf[m]-1].c_str()); + offset += snprintf(&sbuf[offset],maxsize,vformat[j],atom->lmap->typelabel[(int) mybuf[m]-1].c_str()); else if (vtype[j] == Dump::BIGINT) - offset += sprintf(&sbuf[offset],vformat[j], + offset += snprintf(&sbuf[offset],maxsize,vformat[j], static_cast (mybuf[m])); m++; } - offset += sprintf(&sbuf[offset],"\n"); + offset += snprintf(&sbuf[offset],maxsbuf-offset,"\n"); } return offset; @@ -1909,9 +1910,9 @@ int DumpCustom::modify_param(int narg, char **arg) if (ptr == nullptr) error->all(FLERR,"Dump_modify int format does not contain d character"); char str[8]; - sprintf(str,"%s",BIGINT_FORMAT); + snprintf(str,8,"%s",BIGINT_FORMAT); *ptr = '\0'; - sprintf(format_bigint_user,"%s%s%s",format_int_user,&str[1],ptr+1); + snprintf(format_bigint_user,n,"%s%s%s",format_int_user,&str[1],ptr+1); *ptr = 'd'; } else if (strcmp(arg[1],"float") == 0) { diff --git a/src/dump_grid.cpp b/src/dump_grid.cpp index ac42a85b01..b052712e95 100644 --- a/src/dump_grid.cpp +++ b/src/dump_grid.cpp @@ -590,15 +590,16 @@ int DumpGrid::convert_string(int n, double *mybuf) } for (j = 0; j < nfield; j++) { + const auto maxsize = maxsbuf - offset; if (vtype[j] == Dump::INT) - offset += sprintf(&sbuf[offset],vformat[j],static_cast (mybuf[m])); + offset += snprintf(&sbuf[offset],maxsize,vformat[j],static_cast (mybuf[m])); else if (vtype[j] == Dump::DOUBLE) - offset += sprintf(&sbuf[offset],vformat[j],mybuf[m]); + offset += snprintf(&sbuf[offset],maxsize,vformat[j],mybuf[m]); else if (vtype[j] == Dump::BIGINT) - offset += sprintf(&sbuf[offset],vformat[j], static_cast (mybuf[m])); + offset += snprintf(&sbuf[offset],maxsize,vformat[j], static_cast (mybuf[m])); m++; } - offset += sprintf(&sbuf[offset],"\n"); + offset += snprintf(&sbuf[offset],maxsbuf-offset,"\n"); } return offset; @@ -776,9 +777,9 @@ int DumpGrid::modify_param(int narg, char **arg) if (ptr == nullptr) error->all(FLERR,"Dump_modify int format does not contain d character"); char str[8]; - sprintf(str,"%s",BIGINT_FORMAT); + snprintf(str,8,"%s",BIGINT_FORMAT); *ptr = '\0'; - sprintf(format_bigint_user,"%s%s%s",format_int_user,&str[1],ptr+1); + snprintf(format_bigint_user,n,"%s%s%s",format_int_user,&str[1],ptr+1); *ptr = 'd'; } else if (strcmp(arg[1],"float") == 0) { diff --git a/src/dump_local.cpp b/src/dump_local.cpp index 8d546634b6..bcf2a3a757 100644 --- a/src/dump_local.cpp +++ b/src/dump_local.cpp @@ -264,9 +264,9 @@ int DumpLocal::modify_param(int narg, char **arg) if (ptr == nullptr) error->all(FLERR, "Dump_modify int format does not contain d character"); char str[8]; - sprintf(str,"%s",BIGINT_FORMAT); + snprintf(str,8,"%s",BIGINT_FORMAT); *ptr = '\0'; - sprintf(format_bigint_user,"%s%s%s",format_int_user,&str[1],ptr+1); + snprintf(format_bigint_user,n,"%s%s%s",format_int_user,&str[1],ptr+1); *ptr = 'd'; } else if (strcmp(arg[1],"float") == 0) { @@ -387,17 +387,18 @@ int DumpLocal::convert_string(int n, double *mybuf) } for (j = 0; j < size_one; j++) { + const auto maxsize = maxsbuf - offset; if (vtype[j] == Dump::INT) - offset += sprintf(&sbuf[offset],vformat[j],static_cast (mybuf[m])); + offset += snprintf(&sbuf[offset],maxsize,vformat[j],static_cast (mybuf[m])); else if (vtype[j] == Dump::DOUBLE) - offset += sprintf(&sbuf[offset],vformat[j],mybuf[m]); + offset += snprintf(&sbuf[offset],maxsize,vformat[j],mybuf[m]); else if (vtype[j] == Dump::BIGINT) - offset += sprintf(&sbuf[offset],vformat[j],static_cast (mybuf[m])); + offset += snprintf(&sbuf[offset],maxsize,vformat[j],static_cast (mybuf[m])); else - offset += sprintf(&sbuf[offset],vformat[j],mybuf[m]); + offset += snprintf(&sbuf[offset],maxsize,vformat[j],mybuf[m]); m++; } - offset += sprintf(&sbuf[offset],"\n"); + offset += snprintf(&sbuf[offset],maxsbuf-offset,"\n"); } return offset; diff --git a/src/dump_xyz.cpp b/src/dump_xyz.cpp index 018fa754d7..84a8ead6fd 100644 --- a/src/dump_xyz.cpp +++ b/src/dump_xyz.cpp @@ -85,7 +85,7 @@ void DumpXYZ::init_style() typenames = new char*[ntypes+1]; for (int itype = 1; itype <= ntypes; itype++) { typenames[itype] = new char[12]; - sprintf(typenames[itype],"%d",itype); + snprintf(typenames[itype],12,"%d",itype); } } @@ -206,7 +206,7 @@ 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])], + offset += snprintf(&sbuf[offset], maxsbuf-offset, format, typenames[static_cast (mybuf[m+1])], mybuf[m+2], mybuf[m+3], mybuf[m+4]); m += size_one; } diff --git a/src/variable.cpp b/src/variable.cpp index 823a68a506..f308ed6efc 100644 --- a/src/variable.cpp +++ b/src/variable.cpp @@ -1025,7 +1025,7 @@ char *Variable::retrieve(const char *name) error->all(FLERR, "Variable {}: format variable {} has incompatible style", names[ivar],data[ivar][0]); double answer = compute_equal(jvar); - sprintf(data[ivar][2],data[ivar][1],answer); + snprintf(data[ivar][2],VALUELENGTH,data[ivar][1],answer); str = data[ivar][2]; } else if (style[ivar] == GETENV) { diff --git a/unittest/fortran/wrap_extract_variable.cpp b/unittest/fortran/wrap_extract_variable.cpp index b1f79e149a..cf8b3bd5c0 100644 --- a/unittest/fortran/wrap_extract_variable.cpp +++ b/unittest/fortran/wrap_extract_variable.cpp @@ -121,7 +121,7 @@ TEST_F(LAMMPS_extract_variable, loop_pad) char str[10]; char *fstr; for (i = 1; i <= 10; i++) { - std::sprintf(str, "%02d", i); + std::snprintf(str, 10, "%02d", i); fstr = f_lammps_extract_variable_loop_pad(); EXPECT_STREQ(fstr, str); std::free(fstr); @@ -170,7 +170,7 @@ TEST_F(LAMMPS_extract_variable, format) char str[16]; char *fstr; for (i = 1; i <= 10; i++) { - std::sprintf(str, "%.6G", std::exp(i)); + std::snprintf(str, 16, "%.6G", std::exp(i)); fstr = f_lammps_extract_variable_format(); EXPECT_STREQ(fstr, str); std::free(fstr); @@ -185,7 +185,7 @@ TEST_F(LAMMPS_extract_variable, format_pad) char str[16]; char *fstr; for (i = 1; i <= 10; i++) { - std::sprintf(str, "%08.6G", std::exp(i)); + std::snprintf(str, 16, "%08.6G", std::exp(i)); fstr = f_lammps_extract_variable_format_pad(); EXPECT_STREQ(fstr, str); std::free(fstr); From fb9a36c2f4a7f820408f5c8af89c340190db968b Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Sat, 13 Jul 2024 19:12:46 -0400 Subject: [PATCH 149/158] do not update the chart window when LAMMPS is not in a minimization or run --- tools/lammps-gui/lammpsgui.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/lammps-gui/lammpsgui.cpp b/tools/lammps-gui/lammpsgui.cpp index 1d132003b2..578cdb3876 100644 --- a/tools/lammps-gui/lammpsgui.cpp +++ b/tools/lammps-gui/lammpsgui.cpp @@ -811,8 +811,8 @@ void LammpsGui::logupdate() step = (int)*(int64_t *)ptr; } - // extract cached thermo data - if (chartwindow) { + // extract cached thermo data when LAMMPS is executing a minimize or run command + if (chartwindow && lammps.is_running()) { // thermo data is not yet valid during setup void *ptr = lammps.last_thermo("setup", 0); if (ptr && *(int *)ptr) return; From 970f518939d0f31fb1d0dd1ee5670d961ae2e08d Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Mon, 15 Jul 2024 06:25:03 -0400 Subject: [PATCH 150/158] avoid out of range access --- tools/lammps-gui/chartviewer.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tools/lammps-gui/chartviewer.cpp b/tools/lammps-gui/chartviewer.cpp index 919a3bf5fe..22f8e2f32b 100644 --- a/tools/lammps-gui/chartviewer.cpp +++ b/tools/lammps-gui/chartviewer.cpp @@ -138,7 +138,8 @@ void ChartWindow::quit() void ChartWindow::reset_zoom() { int choice = columns->currentData().toInt(); - charts[choice]->reset_zoom(); + if ((choice >= 0) && (choice < charts.size())) + charts[choice]->reset_zoom(); } void ChartWindow::stop_run() From 6fedb6a1b8d94c4eb0c66ce3746479134d6bab84 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Mon, 15 Jul 2024 06:48:21 -0400 Subject: [PATCH 151/158] fix compilation issue with latest QUIP/libAtoms code --- cmake/Modules/Packages/ML-QUIP.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmake/Modules/Packages/ML-QUIP.cmake b/cmake/Modules/Packages/ML-QUIP.cmake index 5cb5a0967e..9106ff54ef 100644 --- a/cmake/Modules/Packages/ML-QUIP.cmake +++ b/cmake/Modules/Packages/ML-QUIP.cmake @@ -27,7 +27,7 @@ if(DOWNLOAD_QUIP) else() message(FATAL_ERROR "The ${CMAKE_Fortran_COMPILER_ID} Fortran compiler is not (yet) supported for building QUIP") endif() - set(temp "${temp}CFLAGS += -fPIC \nCPLUSPLUSFLAGS += -fPIC\nAR_ADD=src\n") + set(temp "${temp}CFLAGS += -fPIC -Wno-return-mismatch \nCPLUSPLUSFLAGS += -fPIC -Wno-return-mismatch\nAR_ADD=src\n") set(temp "${temp}MATH_LINKOPTS=") foreach(flag ${BLAS_LIBRARIES}) set(temp "${temp} ${flag}") From acd7bd111d833a5109f77d42bca5ee76b001aab8 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Mon, 15 Jul 2024 06:51:58 -0400 Subject: [PATCH 152/158] remove dead code --- src/REAXFF/fix_reaxff_bonds.h | 1 - 1 file changed, 1 deletion(-) diff --git a/src/REAXFF/fix_reaxff_bonds.h b/src/REAXFF/fix_reaxff_bonds.h index 2316bfe171..f36c2c718e 100644 --- a/src/REAXFF/fix_reaxff_bonds.h +++ b/src/REAXFF/fix_reaxff_bonds.h @@ -50,7 +50,6 @@ class FixReaxFFBonds : public Fix { int nint(const double &); double memory_usage() override; - bigint nvalid, nextvalid(); struct _reax_list *lists; class PairReaxFF *reaxff; class NeighList *list; From 1d6959efe637c16df96bd9f860979cde4b8f426b Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Mon, 15 Jul 2024 06:57:37 -0400 Subject: [PATCH 153/158] only print fix reaxff/bonds output during setup the first time --- src/REAXFF/fix_reaxff_bonds.cpp | 6 +++++- src/REAXFF/fix_reaxff_bonds.h | 1 + 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/REAXFF/fix_reaxff_bonds.cpp b/src/REAXFF/fix_reaxff_bonds.cpp index 653f207e90..a5ce478c1d 100644 --- a/src/REAXFF/fix_reaxff_bonds.cpp +++ b/src/REAXFF/fix_reaxff_bonds.cpp @@ -44,6 +44,7 @@ FixReaxFFBonds::FixReaxFFBonds(LAMMPS *lmp, int narg, char **arg) : ntypes = atom->ntypes; nmax = atom->nmax; compressed = 0; + first_flag = true; nevery = utils::inumeric(FLERR,arg[3],false,lmp); @@ -94,7 +95,10 @@ int FixReaxFFBonds::setmask() void FixReaxFFBonds::setup(int /*vflag*/) { - end_of_step(); + // only print output during setup() at the very beginning + // to avoid duplicate outputs when using multiple run statements + if (first_flag) end_of_step(); + first_flag = false; } /* ---------------------------------------------------------------------- */ diff --git a/src/REAXFF/fix_reaxff_bonds.h b/src/REAXFF/fix_reaxff_bonds.h index f36c2c718e..91ce2531bf 100644 --- a/src/REAXFF/fix_reaxff_bonds.h +++ b/src/REAXFF/fix_reaxff_bonds.h @@ -40,6 +40,7 @@ class FixReaxFFBonds : public Fix { tagint **neighid; double **abo; FILE *fp; + bool first_flag; void allocate(); void destroy(); From 1fe1aa06830d5655b9d150f1c8ee22ad76a62939 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Mon, 15 Jul 2024 10:28:22 -0400 Subject: [PATCH 154/158] lower default update interval to 10ms --- doc/src/Howto_lammps_gui.rst | 7 ++++--- tools/lammps-gui/lammpsgui.cpp | 2 +- tools/lammps-gui/preferences.cpp | 2 +- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/doc/src/Howto_lammps_gui.rst b/doc/src/Howto_lammps_gui.rst index 165ed84d95..6faac96ce9 100644 --- a/doc/src/Howto_lammps_gui.rst +++ b/doc/src/Howto_lammps_gui.rst @@ -571,11 +571,12 @@ General Settings: size for the text editor and log font of the application can be set. - *GUI update interval:* Allows to set the time interval between GUI and data updates during a LAMMPS run in milliseconds. The default is - to update the GUI every 100 milliseconds. This is good for most cases. - For LAMMPS runs that run very fast, however, data may be missed and + to update the GUI every 10 milliseconds. This is good for most cases. + For LAMMPS runs that run *very* fast, however, data may be missed and through lowering this interval, this can be corrected. However, this will make the GUI use more resources, which may be a problem on some - computers with slower CPUs. The default value is 100 milliseconds. + computers with slower CPUs and a small number of CPU cores. This + setting may be changed to a value between 1 and 1000 milliseconds. Accelerators: ^^^^^^^^^^^^^ diff --git a/tools/lammps-gui/lammpsgui.cpp b/tools/lammps-gui/lammpsgui.cpp index 578cdb3876..c2000c8969 100644 --- a/tools/lammps-gui/lammpsgui.cpp +++ b/tools/lammps-gui/lammpsgui.cpp @@ -1088,7 +1088,7 @@ void LammpsGui::do_run(bool use_buffer) logupdater = new QTimer(this); connect(logupdater, &QTimer::timeout, this, &LammpsGui::logupdate); - logupdater->start(settings.value("updfreq", "100").toInt()); + logupdater->start(settings.value("updfreq", "10").toInt()); } void LammpsGui::render_image() diff --git a/tools/lammps-gui/preferences.cpp b/tools/lammps-gui/preferences.cpp index 71910346fb..426f2306ea 100644 --- a/tools/lammps-gui/preferences.cpp +++ b/tools/lammps-gui/preferences.cpp @@ -260,7 +260,7 @@ GeneralTab::GeneralTab(QSettings *_settings, LammpsWrapper *_lammps, QWidget *pa auto *freqval = new QSpinBox; freqval->setRange(1, 1000); freqval->setStepType(QAbstractSpinBox::AdaptiveDecimalStepType); - freqval->setValue(settings->value("updfreq", "100").toInt()); + freqval->setValue(settings->value("updfreq", "10").toInt()); freqval->setObjectName("updfreq"); freqlayout->addWidget(freqlabel); freqlayout->addWidget(freqval); From 7cfc34e45d13cba41fa85fb55ab45d3fe4cb95a8 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Mon, 15 Jul 2024 14:08:19 -0400 Subject: [PATCH 155/158] the source_suffix option is supposed to be a map --- doc/utils/sphinx-config/conf.py.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/utils/sphinx-config/conf.py.in b/doc/utils/sphinx-config/conf.py.in index 337485e689..4dda51b09c 100644 --- a/doc/utils/sphinx-config/conf.py.in +++ b/doc/utils/sphinx-config/conf.py.in @@ -69,7 +69,7 @@ images_config = { templates_path = ['_templates'] # The suffix of source filenames. -source_suffix = '.rst' +source_suffix = {'.rst': 'restructuredtext'} # The encoding of source files. #source_encoding = 'utf-8-sig' From 6f8bedd01c852225ea73dcbfdf00eeedef6198ee Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Mon, 15 Jul 2024 14:14:13 -0400 Subject: [PATCH 156/158] sync minimum sphinx version with requirements file --- doc/utils/sphinx-config/conf.py.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/utils/sphinx-config/conf.py.in b/doc/utils/sphinx-config/conf.py.in index 4dda51b09c..e2451cd4f1 100644 --- a/doc/utils/sphinx-config/conf.py.in +++ b/doc/utils/sphinx-config/conf.py.in @@ -41,7 +41,7 @@ sys.path.append(os.path.join(LAMMPS_DOC_DIR, 'utils', 'sphinx-config', '_themes' # -- General configuration ------------------------------------------------ # If your documentation needs a minimal Sphinx version, state it here. -needs_sphinx = '5.2.0' +needs_sphinx = '5.3.0' # Add any Sphinx extension module names here, as strings. They can be # extensions coming with Sphinx (named 'sphinx.ext.*') or your custom From a9a896c6779317fb6bbbfc5313085da6861ea12b Mon Sep 17 00:00:00 2001 From: jtclemm Date: Mon, 15 Jul 2024 17:19:51 -0600 Subject: [PATCH 157/158] Small doc changes, renaming status variable --- doc/src/Howto_rheo.rst | 33 ++++++++++++----------- examples/rheo/oxidation/in.rheo.oxidation | 3 +-- src/RHEO/atom_vec_rheo.cpp | 28 +++++++++---------- src/RHEO/atom_vec_rheo.h | 2 +- src/RHEO/atom_vec_rheo_thermal.cpp | 28 +++++++++---------- src/RHEO/atom_vec_rheo_thermal.h | 2 +- src/RHEO/bond_rheo_shell.cpp | 2 +- src/RHEO/compute_rheo_grad.cpp | 2 +- src/RHEO/compute_rheo_interface.cpp | 4 +-- src/RHEO/compute_rheo_kernel.cpp | 2 +- src/RHEO/compute_rheo_property_atom.cpp | 32 ++++++---------------- src/RHEO/compute_rheo_property_atom.h | 3 +-- src/RHEO/compute_rheo_surface.cpp | 10 +++---- src/RHEO/compute_rheo_vshift.cpp | 4 +-- src/RHEO/fix_rheo.cpp | 10 +++---- src/RHEO/fix_rheo_oxidation.cpp | 4 +-- src/RHEO/fix_rheo_thermal.cpp | 16 +++++------ src/RHEO/pair_rheo.cpp | 2 +- src/RHEO/pair_rheo_solid.cpp | 6 ++--- src/atom.cpp | 10 +++---- src/atom.h | 4 +-- src/set.cpp | 4 +-- 22 files changed, 97 insertions(+), 114 deletions(-) diff --git a/doc/src/Howto_rheo.rst b/doc/src/Howto_rheo.rst index 7c62d09ab1..34c0f7b6a1 100644 --- a/doc/src/Howto_rheo.rst +++ b/doc/src/Howto_rheo.rst @@ -2,25 +2,26 @@ Reproducing hydrodynamics and elastic objects (RHEO) ==================================================== The RHEO package is a hybrid implementation of smoothed particle -hydrodynamics (SPH) for fluid flow, coupled to the :doc:`BPM package ` -to model solid elements. RHEO combines these methods to enable mesh-free modeling -of multi-phase material systems. The SPH solver supports many advanced options -including reproducing kernels, particle shifting, free surface identification, -and solid surface reconstruction. To model fluid-solid systems, the status of -particles can dynamically change between a fluid and solid state, e.g. during -melting/solidification, which determines how they interact and their physical -behavior. The package is designed with modularity in mind, so one can easily -turn various features on/off, adjust physical details of the system, or -develop new capabilities. For instance, the numerics associated with -calculating gradients, reproducing kernels, etc. are separated into distinct -classes to simplify the development of new integration schemes which can call -these calculations. Additional numerical details can be found in +hydrodynamics (SPH) for fluid flow, which can couple to the :doc:`BPM package +` to model solid elements. RHEO combines these methods to enable +mesh-free modeling of multi-phase material systems. Its SPH solver supports +many advanced options including reproducing kernels, particle shifting, free +surface identification, and solid surface reconstruction. To model fluid-solid +systems, the status of particles can dynamically change between a fluid and +solid state, e.g. during melting/solidification, which determines how they +interact and their physical behavior. The package is designed with modularity +in mind, so one can easily turn various features on/off, adjust physical +details of the system, or develop new capabilities. For instance, the numerics +associated with calculating gradients, reproducing kernels, etc. are separated +into distinctclasses to simplify the development of new integration schemes +which can call these calculations. Additional numerical details can be found in :ref:`(Palermo) ` and :ref:`(Clemmer) `. -Note, if you simply want to run a traditional SPH simulation, the SPH package -is likely better suited for your application. It has fewer advanced features -and therefore benefits from improved performance. +Note, if you simply want to run a traditional SPH simulation, the :ref:`SPH package +` package is likely better suited for your application. It has fewer advanced +features and therefore benefits from improved performance. The :ref:`MACHDYN +` package for solids may also be relevant for fluid-solid problems. ---------- diff --git a/examples/rheo/oxidation/in.rheo.oxidation b/examples/rheo/oxidation/in.rheo.oxidation index d8b4b1a464..57bd71b917 100644 --- a/examples/rheo/oxidation/in.rheo.oxidation +++ b/examples/rheo/oxidation/in.rheo.oxidation @@ -87,7 +87,6 @@ fix 11 all enforce2d compute surf all rheo/property/atom surface compute rho all rheo/property/atom rho compute phase all rheo/property/atom phase -compute status all rheo/property/atom status compute temp all rheo/property/atom temperature compute eng all rheo/property/atom energy compute nbond_shell all rheo/property/atom nbond/shell @@ -98,6 +97,6 @@ compute nbond_solid all nbond/atom bond/type 1 thermo 200 thermo_style custom step time ke press atoms -#dump 1 all custom 200 atomDump id type x y vx vy fx fy c_phase c_temp c_eng c_nbond_solid c_nbond_shell c_rho c_surf c_status +#dump 1 all custom 200 atomDump id type x y vx vy fx fy c_phase c_temp c_eng c_nbond_solid c_nbond_shell c_rho c_surf run 40000 diff --git a/src/RHEO/atom_vec_rheo.cpp b/src/RHEO/atom_vec_rheo.cpp index 92f5ca05a4..0cbebff008 100644 --- a/src/RHEO/atom_vec_rheo.cpp +++ b/src/RHEO/atom_vec_rheo.cpp @@ -33,7 +33,7 @@ AtomVecRHEO::AtomVecRHEO(LAMMPS *lmp) : AtomVec(lmp) mass_type = PER_TYPE; forceclearflag = 1; - atom->status_flag = 1; + atom->rheo_status_flag = 1; atom->pressure_flag = 1; atom->rho_flag = 1; atom->viscosity_flag = 1; @@ -43,17 +43,17 @@ AtomVecRHEO::AtomVecRHEO(LAMMPS *lmp) : AtomVec(lmp) // order of fields in a string does not matter // except: fields_data_atom & fields_data_vel must match data file - fields_grow = {"status", "rho", "drho", "pressure", "viscosity"}; - fields_copy = {"status", "rho", "drho", "pressure", "viscosity"}; - fields_comm = {"status", "rho"}; - fields_comm_vel = {"status", "rho"}; + fields_grow = {"rheo_status", "rho", "drho", "pressure", "viscosity"}; + fields_copy = {"rheo_status", "rho", "drho", "pressure", "viscosity"}; + fields_comm = {"rheo_status", "rho"}; + fields_comm_vel = {"rheo_status", "rho"}; fields_reverse = {"drho"}; - fields_border = {"status", "rho"}; - fields_border_vel = {"status", "rho"}; - fields_exchange = {"status", "rho"}; - fields_restart = {"status", "rho"}; - fields_create = {"status", "rho", "drho", "pressure", "viscosity"}; - fields_data_atom = {"id", "type", "status", "rho", "x"}; + fields_border = {"rheo_status", "rho"}; + fields_border_vel = {"rheo_status", "rho"}; + fields_exchange = {"rheo_status", "rho"}; + fields_restart = {"rheo_status", "rho"}; + fields_create = {"rheo_status", "rho", "drho", "pressure", "viscosity"}; + fields_data_atom = {"id", "type", "rheo_status", "rho", "x"}; fields_data_vel = {"id", "v"}; setup_fields(); @@ -66,7 +66,7 @@ AtomVecRHEO::AtomVecRHEO(LAMMPS *lmp) : AtomVec(lmp) void AtomVecRHEO::grow_pointers() { - status = atom->status; + rheo_status = atom->rheo_status; pressure = atom->pressure; rho = atom->rho; drho = atom->drho; @@ -111,7 +111,7 @@ void AtomVecRHEO::data_atom_post(int ilocal) int AtomVecRHEO::property_atom(const std::string &name) { - if (name == "status") return 0; + if (name == "rheo_status") return 0; if (name == "pressure") return 1; if (name == "rho") return 2; if (name == "drho") return 3; @@ -133,7 +133,7 @@ void AtomVecRHEO::pack_property_atom(int index, double *buf, int nvalues, int gr if (index == 0) { for (int i = 0; i < nlocal; i++) { if (mask[i] & groupbit) - buf[n] = status[i]; + buf[n] = rheo_status[i]; else buf[n] = 0.0; n += nvalues; diff --git a/src/RHEO/atom_vec_rheo.h b/src/RHEO/atom_vec_rheo.h index 62a7b1a630..8eaa01f7be 100644 --- a/src/RHEO/atom_vec_rheo.h +++ b/src/RHEO/atom_vec_rheo.h @@ -36,7 +36,7 @@ class AtomVecRHEO : virtual public AtomVec { void pack_property_atom(int, double *, int, int) override; private: - int *status; + int *rheo_status; double *pressure, *rho, *drho, *viscosity; }; diff --git a/src/RHEO/atom_vec_rheo_thermal.cpp b/src/RHEO/atom_vec_rheo_thermal.cpp index f541e2a0cb..426c059570 100644 --- a/src/RHEO/atom_vec_rheo_thermal.cpp +++ b/src/RHEO/atom_vec_rheo_thermal.cpp @@ -33,7 +33,7 @@ AtomVecRHEOThermal::AtomVecRHEOThermal(LAMMPS *lmp) : AtomVec(lmp) mass_type = PER_TYPE; forceclearflag = 1; - atom->status_flag = 1; + atom->rheo_status_flag = 1; atom->conductivity_flag = 1; atom->temperature_flag = 1; atom->esph_flag = 1; @@ -47,17 +47,17 @@ AtomVecRHEOThermal::AtomVecRHEOThermal(LAMMPS *lmp) : AtomVec(lmp) // order of fields in a string does not matter // except: fields_data_atom & fields_data_vel must match data file - fields_grow = {"status", "rho", "drho", "temperature", "esph", "heatflow", "conductivity", "pressure", "viscosity"}; - fields_copy = {"status", "rho", "drho", "temperature", "esph", "heatflow", "conductivity", "pressure", "viscosity"}; - fields_comm = {"status", "rho", "esph"}; - fields_comm_vel = {"status", "rho", "esph"}; + fields_grow = {"rheo_status", "rho", "drho", "temperature", "esph", "heatflow", "conductivity", "pressure", "viscosity"}; + fields_copy = {"rheo_status", "rho", "drho", "temperature", "esph", "heatflow", "conductivity", "pressure", "viscosity"}; + fields_comm = {"rheo_status", "rho", "esph"}; + fields_comm_vel = {"rheo_status", "rho", "esph"}; fields_reverse = {"drho", "heatflow"}; - fields_border = {"status", "rho", "esph"}; - fields_border_vel = {"status", "rho", "esph"}; - fields_exchange = {"status", "rho", "esph"}; - fields_restart = {"status", "rho", "esph"}; - fields_create = {"status", "rho", "drho", "temperature", "esph", "heatflow", "conductivity", "pressure", "viscosity"}; - fields_data_atom = {"id", "type", "status", "rho", "esph", "x"}; + fields_border = {"rheo_status", "rho", "esph"}; + fields_border_vel = {"rheo_status", "rho", "esph"}; + fields_exchange = {"rheo_status", "rho", "esph"}; + fields_restart = {"rheo_status", "rho", "esph"}; + fields_create = {"rheo_status", "rho", "drho", "temperature", "esph", "heatflow", "conductivity", "pressure", "viscosity"}; + fields_data_atom = {"id", "type", "rheo_status", "rho", "esph", "x"}; fields_data_vel = {"id", "v"}; setup_fields(); @@ -70,7 +70,7 @@ AtomVecRHEOThermal::AtomVecRHEOThermal(LAMMPS *lmp) : AtomVec(lmp) void AtomVecRHEOThermal::grow_pointers() { - status = atom->status; + rheo_status = atom->rheo_status; conductivity = atom->conductivity; temperature = atom->temperature; esph = atom->esph; @@ -123,7 +123,7 @@ void AtomVecRHEOThermal::data_atom_post(int ilocal) int AtomVecRHEOThermal::property_atom(const std::string &name) { - if (name == "status") return 0; + if (name == "rheo_status") return 0; if (name == "rho") return 1; if (name == "drho") return 2; if (name == "temperature") return 3; @@ -149,7 +149,7 @@ void AtomVecRHEOThermal::pack_property_atom(int index, double *buf, int nvalues, if (index == 0) { for (int i = 0; i < nlocal; i++) { if (mask[i] & groupbit) - buf[n] = status[i]; + buf[n] = rheo_status[i]; else buf[n] = 0.0; n += nvalues; diff --git a/src/RHEO/atom_vec_rheo_thermal.h b/src/RHEO/atom_vec_rheo_thermal.h index 29a764bea9..eaf944ca96 100644 --- a/src/RHEO/atom_vec_rheo_thermal.h +++ b/src/RHEO/atom_vec_rheo_thermal.h @@ -36,7 +36,7 @@ class AtomVecRHEOThermal : virtual public AtomVec { void pack_property_atom(int, double *, int, int) override; private: - int *status; + int *rheo_status; double *conductivity, *temperature, *heatflow, *esph; double *pressure, *rho, *drho, *viscosity; }; diff --git a/src/RHEO/bond_rheo_shell.cpp b/src/RHEO/bond_rheo_shell.cpp index 81e5ba02d1..258d047086 100644 --- a/src/RHEO/bond_rheo_shell.cpp +++ b/src/RHEO/bond_rheo_shell.cpp @@ -182,7 +182,7 @@ void BondRHEOShell::compute(int eflag, int vflag) double **v = atom->v; double **f = atom->f; tagint *tag = atom->tag; - int *status = atom->status; + int *status = atom->rheo_status; int **bondlist = neighbor->bondlist; int nbondlist = neighbor->nbondlist; int nlocal = atom->nlocal; diff --git a/src/RHEO/compute_rheo_grad.cpp b/src/RHEO/compute_rheo_grad.cpp index 216fcb1978..cdf90e1dc5 100644 --- a/src/RHEO/compute_rheo_grad.cpp +++ b/src/RHEO/compute_rheo_grad.cpp @@ -144,7 +144,7 @@ void ComputeRHEOGrad::compute_peratom() double *rho = atom->rho; double *energy = atom->esph; double *viscosity = atom->viscosity; - int *status = atom->status; + int *status = atom->rheo_status; int *type = atom->type; double *mass = atom->mass; int newton = force->newton; diff --git a/src/RHEO/compute_rheo_interface.cpp b/src/RHEO/compute_rheo_interface.cpp index ec8c10f276..8ccd4e6a3b 100644 --- a/src/RHEO/compute_rheo_interface.cpp +++ b/src/RHEO/compute_rheo_interface.cpp @@ -120,7 +120,7 @@ void ComputeRHEOInterface::compute_peratom() double **x = atom->x; int *type = atom->type; int newton = force->newton; - int *status = atom->status; + int *status = atom->rheo_status; double *rho = atom->rho; inum = list->inum; @@ -290,7 +290,7 @@ void ComputeRHEOInterface::unpack_reverse_comm(int n, int *list, double *buf) { int i, k, j, m; double *rho = atom->rho; - int *status = atom->status; + int *status = atom->rheo_status; m = 0; for (i = 0; i < n; i++) { j = list[i]; diff --git a/src/RHEO/compute_rheo_kernel.cpp b/src/RHEO/compute_rheo_kernel.cpp index a5865b894a..4558ddccc8 100644 --- a/src/RHEO/compute_rheo_kernel.cpp +++ b/src/RHEO/compute_rheo_kernel.cpp @@ -586,7 +586,7 @@ void ComputeRHEOKernel::compute_peratom() int *type = atom->type; double *mass = atom->mass; double *rho = atom->rho; - int *status = atom->status; + int *status = atom->rheo_status; tagint *tag = atom->tag; int *ilist, *jlist, *numneigh, **firstneigh; diff --git a/src/RHEO/compute_rheo_property_atom.cpp b/src/RHEO/compute_rheo_property_atom.cpp index 533822bbdd..7a450e7708 100644 --- a/src/RHEO/compute_rheo_property_atom.cpp +++ b/src/RHEO/compute_rheo_property_atom.cpp @@ -92,8 +92,9 @@ ComputeRHEOPropertyAtom::ComputeRHEOPropertyAtom(LAMMPS *lmp, int narg, char **a for (int iarg = 3; iarg < narg; iarg++) { if (strcmp(arg[iarg], "phase") == 0) { pack_choice[i] = &ComputeRHEOPropertyAtom::pack_phase; - } else if (strcmp(arg[iarg], "rho") == 0) { - pack_choice[i] = &ComputeRHEOPropertyAtom::pack_rho; + } else if (strcmp(arg[iarg], "status") == 0) { + // Short hand for "rheo_status" + pack_choice[i] = &ComputeRHEOPropertyAtom::pack_status; } else if (strcmp(arg[iarg], "chi") == 0) { interface_flag = 1; pack_choice[i] = &ComputeRHEOPropertyAtom::pack_chi; @@ -111,8 +112,6 @@ ComputeRHEOPropertyAtom::ComputeRHEOPropertyAtom(LAMMPS *lmp, int narg, char **a } else if (strcmp(arg[iarg], "pressure") == 0) { pressure_flag = 1; pack_choice[i] = &ComputeRHEOPropertyAtom::pack_pressure; - } else if (strcmp(arg[iarg], "viscosity") == 0) { - pack_choice[i] = &ComputeRHEOPropertyAtom::pack_viscosity; } else if (strcmp(arg[iarg], "cv") == 0) { thermal_flag = 1; pack_choice[i] = &ComputeRHEOPropertyAtom::pack_cv; @@ -265,7 +264,7 @@ double ComputeRHEOPropertyAtom::memory_usage() void ComputeRHEOPropertyAtom::pack_phase(int n) { - int *status = atom->status; + int *status = atom->rheo_status; int *mask = atom->mask; int nlocal = atom->nlocal; @@ -278,14 +277,14 @@ void ComputeRHEOPropertyAtom::pack_phase(int n) /* ---------------------------------------------------------------------- */ -void ComputeRHEOPropertyAtom::pack_rho(int n) +void ComputeRHEOPropertyAtom::pack_status(int n) { - double *rho = atom->rho; + int *status = atom->rheo_status; int *mask = atom->mask; int nlocal = atom->nlocal; for (int i = 0; i < nlocal; i++) { - if (mask[i] & groupbit) buf[n] = rho[i]; + if (mask[i] & groupbit) buf[n] = status[i]; else buf[n] = 0.0; n += nvalues; } @@ -310,7 +309,7 @@ void ComputeRHEOPropertyAtom::pack_chi(int n) void ComputeRHEOPropertyAtom::pack_surface(int n) { - int *status = atom->status; + int *status = atom->rheo_status; int *mask = atom->mask; int nlocal = atom->nlocal; @@ -420,21 +419,6 @@ void ComputeRHEOPropertyAtom::pack_pressure(int n) /* ---------------------------------------------------------------------- */ -void ComputeRHEOPropertyAtom::pack_viscosity(int n) -{ - int *mask = atom->mask; - double *viscosity = atom->viscosity; - int nlocal = atom->nlocal; - - for (int i = 0; i < nlocal; i++) { - if (mask[i] & groupbit) buf[n] = viscosity[i]; - else buf[n] = 0.0; - n += nvalues; - } -} - -/* ---------------------------------------------------------------------- */ - void ComputeRHEOPropertyAtom::pack_viscous_stress(int n) { double **gradv = compute_grad->gradv; diff --git a/src/RHEO/compute_rheo_property_atom.h b/src/RHEO/compute_rheo_property_atom.h index b3d247b102..4b1ebf2313 100644 --- a/src/RHEO/compute_rheo_property_atom.h +++ b/src/RHEO/compute_rheo_property_atom.h @@ -45,7 +45,7 @@ class ComputeRHEOPropertyAtom : public Compute { FnPtrPack *pack_choice; // ptrs to pack functions void pack_phase(int); - void pack_rho(int); + void pack_status(int); void pack_chi(int); void pack_surface(int); void pack_surface_r(int); @@ -56,7 +56,6 @@ class ComputeRHEOPropertyAtom : public Compute { void pack_shift_v(int); void pack_gradv(int); void pack_pressure(int); - void pack_viscosity(int); void pack_viscous_stress(int); void pack_total_stress(int); void pack_nbond_shell(int); diff --git a/src/RHEO/compute_rheo_surface.cpp b/src/RHEO/compute_rheo_surface.cpp index 69b0ebd108..c3a3774cdc 100644 --- a/src/RHEO/compute_rheo_surface.cpp +++ b/src/RHEO/compute_rheo_surface.cpp @@ -106,7 +106,7 @@ void ComputeRHEOSurface::compute_peratom() int nlocal = atom->nlocal; double **x = atom->x; - int *status = atom->status; + int *status = atom->rheo_status; int newton = force->newton; int dim = domain->dimension; int *mask = atom->mask; @@ -312,7 +312,7 @@ int ComputeRHEOSurface::pack_reverse_comm(int n, int first, double *buf) { int i,a,b,k,m,last; int dim = domain->dimension; - int *status = atom->status; + int *status = atom->rheo_status; m = 0; last = first + n; @@ -336,7 +336,7 @@ void ComputeRHEOSurface::unpack_reverse_comm(int n, int *list, double *buf) { int i,a,b,k,j,m; int dim = domain->dimension; - int *status = atom->status; + int *status = atom->rheo_status; int tmp1; double tmp2; @@ -367,7 +367,7 @@ int ComputeRHEOSurface::pack_forward_comm(int n, int *list, double *buf, int /*pbc_flag*/, int * /*pbc*/) { int i,j,a,b,k,m; - int *status = atom->status; + int *status = atom->rheo_status; m = 0; for (i = 0; i < n; i++) { @@ -387,7 +387,7 @@ int ComputeRHEOSurface::pack_forward_comm(int n, int *list, double *buf, void ComputeRHEOSurface::unpack_forward_comm(int n, int first, double *buf) { int i, k, a, b, m, last; - int *status = atom->status; + int *status = atom->rheo_status; m = 0; last = first + n; diff --git a/src/RHEO/compute_rheo_vshift.cpp b/src/RHEO/compute_rheo_vshift.cpp index b01912111f..c06ef533ac 100644 --- a/src/RHEO/compute_rheo_vshift.cpp +++ b/src/RHEO/compute_rheo_vshift.cpp @@ -102,7 +102,7 @@ void ComputeRHEOVShift::compute_peratom() int inum, *ilist, *numneigh, **firstneigh; int *type = atom->type; - int *status = atom->status; + int *status = atom->rheo_status; int *mask = atom->mask; double **x = atom->x; double **v = atom->v; @@ -231,7 +231,7 @@ void ComputeRHEOVShift::correct_surfaces() int i, a, b; - int *status = atom->status; + int *status = atom->rheo_status; int *mask = atom->mask; double **nsurface = compute_surface->nsurface; diff --git a/src/RHEO/fix_rheo.cpp b/src/RHEO/fix_rheo.cpp index cd0ca1069a..f70b9e121f 100644 --- a/src/RHEO/fix_rheo.cpp +++ b/src/RHEO/fix_rheo.cpp @@ -86,7 +86,7 @@ FixRHEO::FixRHEO(LAMMPS *lmp, int narg, char **arg) : error->all(FLERR, "fix rheo command requires atom_style with density"); if (atom->viscosity_flag != 1) error->all(FLERR, "fix rheo command requires atom_style with viscosity"); - if (atom->status_flag != 1) + if (atom->rheo_status_flag != 1) error->all(FLERR, "fix rheo command requires atom_style with status"); if (narg < 5) @@ -235,7 +235,7 @@ void FixRHEO::init() if (modify->get_fix_by_style("^rheo$").size() > 1) error->all(FLERR, "Can only specify one instance of fix rheo"); - if (atom->status_flag != 1) + if (atom->rheo_status_flag != 1) error->all(FLERR,"fix rheo command requires atom property status"); if (atom->rho_flag != 1) error->all(FLERR,"fix rheo command requires atom property rho"); @@ -309,7 +309,7 @@ void FixRHEO::initial_integrate(int /*vflag*/) int *type = atom->type; int *mask = atom->mask; - int *status = atom->status; + int *status = atom->rheo_status; double **x = atom->x; double **v = atom->v; double **f = atom->f; @@ -432,7 +432,7 @@ void FixRHEO::pre_force(int /*vflag*/) // Remove temporary options int *mask = atom->mask; - int *status = atom->status; + int *status = atom->rheo_status; int nall = atom->nlocal + atom->nghost; for (int i = 0; i < nall; i++) if (mask[i] & groupbit) @@ -467,7 +467,7 @@ void FixRHEO::final_integrate() double *rmass = atom->rmass; int *type = atom->type; int *mask = atom->mask; - int *status = atom->status; + int *status = atom->rheo_status; int rmass_flag = atom->rmass_flag; int dim = domain->dimension; diff --git a/src/RHEO/fix_rheo_oxidation.cpp b/src/RHEO/fix_rheo_oxidation.cpp index 74d1bbab57..a51f2feb95 100644 --- a/src/RHEO/fix_rheo_oxidation.cpp +++ b/src/RHEO/fix_rheo_oxidation.cpp @@ -163,7 +163,7 @@ void FixRHEOOxidation::post_integrate() int **bond_type = atom->bond_type; int *num_bond = atom->num_bond; int *mask = atom->mask; - int *status = atom->status; + int *status = atom->rheo_status; double *rsurface = compute_surface->rsurface; double **x = atom->x; @@ -255,7 +255,7 @@ void FixRHEOOxidation::post_integrate() void FixRHEOOxidation::post_force(int /*vflag*/) { - int *status = atom->status; + int *status = atom->rheo_status; int *num_bond = atom->num_bond; for (int i = 0; i < atom->nlocal; i++) if (num_bond[i] != 0) diff --git a/src/RHEO/fix_rheo_thermal.cpp b/src/RHEO/fix_rheo_thermal.cpp index dbb59f12f7..daa5b347a7 100644 --- a/src/RHEO/fix_rheo_thermal.cpp +++ b/src/RHEO/fix_rheo_thermal.cpp @@ -326,7 +326,7 @@ void FixRHEOThermal::initial_integrate(int /*vflag*/) if (!fix_rheo->shift_flag) return; int i, a; - int *status = atom->status; + int *status = atom->rheo_status; double *energy = atom->esph; double **grade = compute_grad->grade; double **vshift = compute_vshift->vshift; @@ -351,7 +351,7 @@ void FixRHEOThermal::post_integrate() int i, itype; double cvi, Tci, Ti, Li; - int *status = atom->status; + int *status = atom->rheo_status; double *energy = atom->esph; double *temperature = atom->temperature; double *heatflow = atom->heatflow; @@ -466,7 +466,7 @@ void FixRHEOThermal::pre_force(int /*vflag*/) double *energy = atom->esph; double *temperature = atom->temperature; int *type = atom->type; - int *status = atom->status; + int *status = atom->rheo_status; int nlocal = atom->nlocal; int nall = nlocal + atom->nghost; @@ -494,7 +494,7 @@ void FixRHEOThermal::pre_force(int /*vflag*/) void FixRHEOThermal::final_integrate() { - int *status = atom->status; + int *status = atom->rheo_status; double *energy = atom->esph; double *heatflow = atom->heatflow; @@ -520,7 +520,7 @@ void FixRHEOThermal::break_bonds() int m, n, nmax, i, j, melti, meltj; tagint *tag = atom->tag; - int *status = atom->status; + int *status = atom->rheo_status; int **bond_type = atom->bond_type; tagint **bond_atom = atom->bond_atom; int *num_bond = atom->num_bond; @@ -649,7 +649,7 @@ void FixRHEOThermal::create_bonds() tagint *tag = atom->tag; tagint **bond_atom = atom->bond_atom; - int *status = atom->status; + int *status = atom->rheo_status; int **bond_type = atom->bond_type; int *num_bond = atom->num_bond; double **x = atom->x; @@ -754,7 +754,7 @@ int FixRHEOThermal::pack_forward_comm(int n, int *list, double *buf, int /*pbc_flag*/, int * /*pbc*/) { int i, j, k, m; - int *status = atom->status; + int *status = atom->rheo_status; double **x = atom->x; m = 0; @@ -773,7 +773,7 @@ int FixRHEOThermal::pack_forward_comm(int n, int *list, double *buf, void FixRHEOThermal::unpack_forward_comm(int n, int first, double *buf) { int i, k, m, last; - int *status = atom->status; + int *status = atom->rheo_status; double **x = atom->x; m = 0; last = first + n; diff --git a/src/RHEO/pair_rheo.cpp b/src/RHEO/pair_rheo.cpp index b9beaf8383..9ebf884b6e 100644 --- a/src/RHEO/pair_rheo.cpp +++ b/src/RHEO/pair_rheo.cpp @@ -110,7 +110,7 @@ void PairRHEO::compute(int eflag, int vflag) double *heatflow = atom->heatflow; double *special_lj = force->special_lj; int *type = atom->type; - int *status = atom->status; + int *status = atom->rheo_status; tagint *tag = atom->tag; double **fp_store, *chi; diff --git a/src/RHEO/pair_rheo_solid.cpp b/src/RHEO/pair_rheo_solid.cpp index 1c8654b3c4..070cabaf86 100644 --- a/src/RHEO/pair_rheo_solid.cpp +++ b/src/RHEO/pair_rheo_solid.cpp @@ -74,7 +74,7 @@ void PairRHEOSolid::compute(int eflag, int vflag) double **v = atom->v; double **f = atom->f; int *type = atom->type; - int *status = atom->status; + int *status = atom->rheo_status; int nlocal = atom->nlocal; int newton_pair = force->newton_pair; double *special_lj = force->special_lj; @@ -223,7 +223,7 @@ void PairRHEOSolid::init_style() if (comm->ghost_velocity == 0) error->all(FLERR,"Pair rheo/solid requires ghost atoms store velocity"); - if (!atom->status_flag) + if (!atom->rheo_status_flag) error->all(FLERR,"Pair rheo/solid requires atom_style rheo"); neighbor->add_request(this); @@ -328,7 +328,7 @@ double PairRHEOSolid::single(int i, int j, int itype, int jtype, double rsq, dou if (rsq > cutsq[itype][jtype]) return 0.0; - int *status = atom->status; + int *status = atom->rheo_status; if (!(status[i] & STATUS_SOLID)) return 0.0; if (!(status[j] & STATUS_SOLID)) return 0.0; diff --git a/src/atom.cpp b/src/atom.cpp index 09aaa4f1d8..9af945367b 100644 --- a/src/atom.cpp +++ b/src/atom.cpp @@ -200,7 +200,7 @@ Atom::Atom(LAMMPS *_lmp) : Pointers(_lmp), atom_style(nullptr), avec(nullptr), a // RHEO package - status = nullptr; + rheo_status = nullptr; conductivity = nullptr; pressure = nullptr; viscosity = nullptr; @@ -538,7 +538,7 @@ void Atom::peratom_create() // RHEO package - add_peratom("status",&status,INT,0); + add_peratom("rheo_status",&rheo_status,INT,0); add_peratom("conductivity",&conductivity,DOUBLE,0); add_peratom("pressure",&pressure,DOUBLE,0); add_peratom("viscosity",&viscosity,DOUBLE,0); @@ -648,7 +648,7 @@ void Atom::set_atomflag_defaults() temperature_flag = heatflow_flag = 0; vfrac_flag = spin_flag = eradius_flag = ervel_flag = erforce_flag = 0; cs_flag = csforce_flag = vforce_flag = ervelforce_flag = etag_flag = 0; - status_flag = conductivity_flag = pressure_flag = viscosity_flag = 0; + rheo_status_flag = conductivity_flag = pressure_flag = viscosity_flag = 0; rho_flag = esph_flag = cv_flag = vest_flag = 0; dpd_flag = edpd_flag = tdpd_flag = 0; sp_flag = 0; @@ -3065,7 +3065,7 @@ void *Atom::extract(const char *name) // RHEO package - if (strcmp(name,"status") == 0) return (void *) status; + if (strcmp(name,"rheo_status") == 0) return (void *) rheo_status; if (strcmp(name,"conductivity") == 0) return (void *) conductivity; if (strcmp(name,"pressure") == 0) return (void *) pressure; if (strcmp(name,"viscosity") == 0) return (void *) viscosity; @@ -3194,7 +3194,7 @@ int Atom::extract_datatype(const char *name) // RHEO package - if (strcmp(name,"status") == 0) return LAMMPS_INT; + if (strcmp(name,"rheo_status") == 0) return LAMMPS_INT; if (strcmp(name,"conductivity") == 0) return LAMMPS_DOUBLE; if (strcmp(name,"pressure") == 0) return LAMMPS_DOUBLE; if (strcmp(name,"viscosity") == 0) return LAMMPS_DOUBLE; diff --git a/src/atom.h b/src/atom.h index 568d78afb2..bd5b352cd0 100644 --- a/src/atom.h +++ b/src/atom.h @@ -157,7 +157,7 @@ class Atom : protected Pointers { // RHEO package - int *status; + int *rheo_status; double *conductivity; double *pressure; double *viscosity; @@ -197,7 +197,7 @@ class Atom : protected Pointers { int temperature_flag, heatflow_flag; int vfrac_flag, spin_flag, eradius_flag, ervel_flag, erforce_flag; int cs_flag, csforce_flag, vforce_flag, ervelforce_flag, etag_flag; - int status_flag, conductivity_flag, pressure_flag, viscosity_flag; + int rheo_status_flag, conductivity_flag, pressure_flag, viscosity_flag; int rho_flag, esph_flag, cv_flag, vest_flag; int dpd_flag, edpd_flag, tdpd_flag; int mesont_flag; diff --git a/src/set.cpp b/src/set.cpp index cd48ba2bfe..93d5068ef3 100644 --- a/src/set.cpp +++ b/src/set.cpp @@ -526,7 +526,7 @@ void Set::command(int narg, char **arg) if (iarg+2 > narg) utils::missing_cmd_args(FLERR, "set rheo/status", error); if (utils::strmatch(arg[iarg+1],"^v_")) varparse(arg[iarg+1],1); else ivalue = utils::inumeric(FLERR,arg[iarg+1],false,lmp); - if (!atom->status_flag) + if (!atom->rheo_status_flag) error->all(FLERR,"Cannot set attribute {} for atom style {}", arg[iarg], atom->get_style()); set(RHEO_STATUS); iarg += 2; @@ -901,7 +901,7 @@ void Set::set(int keyword) else if (keyword == RHEO_STATUS) { if (ivalue != 0 && ivalue != 1) error->one(FLERR,"Invalid value {} in set command for rheo/status", ivalue); - atom->status[i] = ivalue; + atom->rheo_status[i] = ivalue; } else if (keyword == SPH_E) atom->esph[i] = dvalue; From de95eb907af9979519cdfa5a76630b7a22e8b6fd Mon Sep 17 00:00:00 2001 From: jtclemm Date: Wed, 17 Jul 2024 11:53:01 -0600 Subject: [PATCH 158/158] Clarifying comment on breakage in bond hybrid --- src/bond_hybrid.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/bond_hybrid.cpp b/src/bond_hybrid.cpp index 1e3e3c66f9..307cbd72fd 100644 --- a/src/bond_hybrid.cpp +++ b/src/bond_hybrid.cpp @@ -142,8 +142,10 @@ void BondHybrid::compute(int eflag, int vflag) } } - // if bond type can be set to zero and deleted, update bondlist_orig - tagint *tag = atom->tag; + // If bond style can be deleted by setting type to zero (BPM or quartic), update bondlist_orig + // Otherwise, bond type could be restored back to its original value during reneighboring + // Use orig_map to propagate changes from temporary bondlist array back to original array + if (partial_flag) { for (m = 0; m < nstyles; m++) { for (i = 0; i < nbondlist[m]; i++) {