reduce compiler warnings, remove dead code, follow LAMMPS conventions more closely

This commit is contained in:
Axel Kohlmeyer
2024-07-30 16:13:06 -04:00
parent 701280a648
commit 1254d579f7
14 changed files with 165 additions and 195 deletions

View File

@ -45,7 +45,8 @@ using namespace RHEO_NS;
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
BondRHEOShell::BondRHEOShell(LAMMPS *_lmp) : BondRHEOShell::BondRHEOShell(LAMMPS *_lmp) :
BondBPM(_lmp), compute_surface(nullptr), k(nullptr), ecrit(nullptr), gamma(nullptr) BondBPM(_lmp), k(nullptr), ecrit(nullptr), gamma(nullptr), dbond(nullptr), nbond(nullptr),
id_fix(nullptr), compute_surface(nullptr)
{ {
partial_flag = 1; partial_flag = 1;
comm_reverse = 1; comm_reverse = 1;

View File

@ -42,8 +42,9 @@ enum{COMMGRAD, COMMFIELD};
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
ComputeRHEOGrad::ComputeRHEOGrad(LAMMPS *lmp, int narg, char **arg) : 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), Compute(lmp, narg, arg), gradv(nullptr), gradr(nullptr), grade(nullptr), gradn(nullptr),
gradv(nullptr), gradr(nullptr), grade(nullptr), gradn(nullptr) fix_rheo(nullptr), rho0(nullptr), compute_kernel(nullptr), compute_interface(nullptr),
list(nullptr)
{ {
if (narg < 4) error->all(FLERR,"Illegal compute rheo/grad command"); if (narg < 4) error->all(FLERR,"Illegal compute rheo/grad command");
@ -130,10 +131,9 @@ void ComputeRHEOGrad::compute_peratom()
{ {
int i, j, k, ii, jj, jnum, itype, jtype, a, b, fluidi, fluidj; int i, j, k, ii, jj, jnum, itype, jtype, a, b, fluidi, fluidj;
double xtmp, ytmp, ztmp, delx, dely, delz; double xtmp, ytmp, ztmp, delx, dely, delz;
double rsq, imass, jmass; double rsq, rhoi, rhoj, Voli, Volj, drho, de, deta;
double rhoi, rhoj, Voli, Volj, drho, de, deta;
double vi[3], vj[3], vij[3]; double vi[3], vj[3], vij[3];
double wp, *dWij, *dWji; double *dWij, *dWji;
int inum, *ilist, *numneigh, **firstneigh; int inum, *ilist, *numneigh, **firstneigh;
int *jlist; int *jlist;
@ -236,7 +236,7 @@ void ComputeRHEOGrad::compute_peratom()
if (energy_flag) de = energy[i] - energy[j]; if (energy_flag) de = energy[i] - energy[j];
if (eta_flag) deta = viscosity[i] - viscosity[j]; if (eta_flag) deta = viscosity[i] - viscosity[j];
wp = compute_kernel->calc_dw(i, j, delx, dely, delz, sqrt(rsq)); compute_kernel->calc_dw(i, j, delx, dely, delz, sqrt(rsq));
dWij = compute_kernel->dWij; dWij = compute_kernel->dWij;
dWji = compute_kernel->dWji; dWji = compute_kernel->dWji;

View File

@ -45,8 +45,10 @@ static constexpr double EPSILON = 1e-1;
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
ComputeRHEOInterface::ComputeRHEOInterface(LAMMPS *lmp, int narg, char **arg) : ComputeRHEOInterface::ComputeRHEOInterface(LAMMPS *lmp, int narg, char **arg) :
Compute(lmp, narg, arg), fix_rheo(nullptr), compute_kernel(nullptr), fp_store(nullptr), Compute(lmp, narg, arg), chi(nullptr), fp_store(nullptr), fix_rheo(nullptr),
rho0(nullptr), norm(nullptr), normwf(nullptr), chi(nullptr), id_fix_pa(nullptr) rho0(nullptr), norm(nullptr), normwf(nullptr), id_fix_pa(nullptr), list(nullptr),
compute_kernel(nullptr), fix_pressure(nullptr)
{ {
if (narg != 3) error->all(FLERR,"Illegal compute rheo/interface command"); if (narg != 3) error->all(FLERR,"Illegal compute rheo/interface command");
@ -228,12 +230,11 @@ void ComputeRHEOInterface::compute_peratom()
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; int m = 0;
m = 0;
double *rho = atom->rho; double *rho = atom->rho;
for (i = 0; i < n; i++) { for (int i = 0; i < n; i++) {
j = list[i]; int j = list[i];
if (comm_stage == 0) { if (comm_stage == 0) {
buf[m++] = fp_store[j][0]; buf[m++] = fp_store[j][0];
buf[m++] = fp_store[j][1]; buf[m++] = fp_store[j][1];
@ -250,11 +251,10 @@ int ComputeRHEOInterface::pack_forward_comm(int n, int *list, double *buf, int /
void ComputeRHEOInterface::unpack_forward_comm(int n, int first, double *buf) void ComputeRHEOInterface::unpack_forward_comm(int n, int first, double *buf)
{ {
int i, k, m, last;
double *rho = atom->rho; double *rho = atom->rho;
m = 0; int m = 0;
last = first + n; int last = first + n;
for (i = first; i < last; i++) { for (int i = first; i < last; i++) {
if (comm_stage == 0) { if (comm_stage == 0) {
fp_store[i][0] = buf[m++]; fp_store[i][0] = buf[m++];
fp_store[i][1] = buf[m++]; fp_store[i][1] = buf[m++];
@ -270,12 +270,10 @@ void ComputeRHEOInterface::unpack_forward_comm(int n, int first, double *buf)
int ComputeRHEOInterface::pack_reverse_comm(int n, int first, double *buf) int ComputeRHEOInterface::pack_reverse_comm(int n, int first, double *buf)
{ {
int i, k, m, last;
double *rho = atom->rho; double *rho = atom->rho;
int m = 0;
m = 0; int last = first + n;
last = first + n; for (int i = first; i < last; i++) {
for (i = first; i < last; i++) {
buf[m++] = norm[i]; buf[m++] = norm[i];
buf[m++] = chi[i]; buf[m++] = chi[i];
buf[m++] = normwf[i]; buf[m++] = normwf[i];
@ -288,12 +286,11 @@ int ComputeRHEOInterface::pack_reverse_comm(int n, int first, double *buf)
void ComputeRHEOInterface::unpack_reverse_comm(int n, int *list, double *buf) void ComputeRHEOInterface::unpack_reverse_comm(int n, int *list, double *buf)
{ {
int i, k, j, m;
double *rho = atom->rho; double *rho = atom->rho;
int *status = atom->rheo_status; int *status = atom->rheo_status;
m = 0; int m = 0;
for (i = 0; i < n; i++) { for (int i = 0; i < n; i++) {
j = list[i]; int j = list[i];
norm[j] += buf[m++]; norm[j] += buf[m++];
chi[j] += buf[m++]; chi[j] += buf[m++];
if (status[j] & PHASECHECK){ if (status[j] & PHASECHECK){

View File

@ -53,8 +53,8 @@ static constexpr int DELTA = 2000;
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
ComputeRHEOKernel::ComputeRHEOKernel(LAMMPS *lmp, int narg, char **arg) : ComputeRHEOKernel::ComputeRHEOKernel(LAMMPS *lmp, int narg, char **arg) :
Compute(lmp, narg, arg), Compute(lmp, narg, arg), coordination(nullptr), fix_rheo(nullptr), C(nullptr), C0(nullptr),
list(nullptr), C(nullptr), C0(nullptr), coordination(nullptr), compute_interface(nullptr) list(nullptr), compute_interface(nullptr)
{ {
if (narg != 4) error->all(FLERR,"Illegal compute rheo/kernel command"); if (narg != 4) error->all(FLERR,"Illegal compute rheo/kernel command");
@ -190,7 +190,7 @@ double ComputeRHEOKernel::calc_w_self(int i, int j)
double ComputeRHEOKernel::calc_w(int i, int j, double delx, double dely, double delz, double r) double ComputeRHEOKernel::calc_w(int i, int j, double delx, double dely, double delz, double r)
{ {
double w; double w = 0.0;
int corrections_i, corrections_j, corrections; int corrections_i, corrections_j, corrections;
if (kernel_style == WENDLANDC4) if (kernel_style == WENDLANDC4)
@ -282,8 +282,6 @@ double ComputeRHEOKernel::calc_w_quintic(int i, int j, double delx, double dely,
double ComputeRHEOKernel::calc_dw_quintic(int i, int j, double delx, double dely, double delz, double r, double *dW1, double *dW2) 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 wp, tmp1, tmp2, tmp3, tmp1sq, tmp2sq, tmp3sq, s, wprinv;
double *mass = atom->mass;
int *type = atom->type;
s = r * 3.0 * cutinv; s = r * 3.0 * cutinv;
@ -347,8 +345,6 @@ double ComputeRHEOKernel::calc_w_wendlandc4(int i, int j, double delx, double de
double ComputeRHEOKernel::calc_dw_wendlandc4(int i, int j, double delx, double dely, double delz, double r, double *dW1, double *dW2) 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 wp, tmp1, tmp5, tmp6, s, wprinv;
double *mass = atom->mass;
int *type = atom->type;
s = r * cutinv; s = r * cutinv;
@ -395,7 +391,7 @@ double ComputeRHEOKernel::calc_w_rk0(int i, int j, double delx, double dely, dou
double ComputeRHEOKernel::calc_w_rk1(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; int b;
double w, wR, dx[3], H[Mdim]; double w, dx[3], H[Mdim];
dx[0] = delx; dx[0] = delx;
dx[1] = dely; dx[1] = dely;
@ -437,7 +433,7 @@ double ComputeRHEOKernel::calc_w_rk1(int i, int j, double delx, double dely, dou
double ComputeRHEOKernel::calc_w_rk2(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; int b;
double w, wR, dx[3], H[Mdim]; double w, dx[3], H[Mdim];
dx[0] = delx; dx[0] = delx;
dx[1] = dely; dx[1] = dely;
dx[2] = delz; dx[2] = delz;
@ -574,7 +570,7 @@ void ComputeRHEOKernel::compute_peratom()
if (kernel_style == QUINTIC) return; if (kernel_style == QUINTIC) return;
corrections_calculated = 1; corrections_calculated = 1;
int i, j, ii, jj, inum, jnum, itype, g, a, b, gsl_error; int i, j, ii, jj, inum, jnum, a, b, gsl_error;
double xtmp, ytmp, ztmp, r, rsq, w, vj, rhoj; double xtmp, ytmp, ztmp, r, rsq, w, vj, rhoj;
double dx[3]; double dx[3];
gsl_matrix_view gM; gsl_matrix_view gM;
@ -854,19 +850,17 @@ void ComputeRHEOKernel::grow_arrays(int nmax)
int ComputeRHEOKernel::pack_forward_comm(int n, int *list, double *buf, int ComputeRHEOKernel::pack_forward_comm(int n, int *list, double *buf,
int /*pbc_flag*/, int * /*pbc*/) int /*pbc_flag*/, int * /*pbc*/)
{ {
int i,j,k,m,a,b; int m = 0;
m = 0; for (int i = 0; i < n; i++) {
int j = list[i];
for (i = 0; i < n; i++) {
j = list[i];
if (comm_stage == 0) { if (comm_stage == 0) {
buf[m++] = coordination[j]; buf[m++] = coordination[j];
} else { } else {
if (kernel_style == RK0) { if (kernel_style == RK0) {
buf[m++] = C0[j]; buf[m++] = C0[j];
} else { } else {
for (a = 0; a < ncor; a++) for (int a = 0; a < ncor; a++)
for (b = 0; b < Mdim; b++) for (int b = 0; b < Mdim; b++)
buf[m++] = C[j][a][b]; buf[m++] = C[j][a][b];
} }
} }
@ -878,19 +872,17 @@ int ComputeRHEOKernel::pack_forward_comm(int n, int *list, double *buf,
void ComputeRHEOKernel::unpack_forward_comm(int n, int first, double *buf) void ComputeRHEOKernel::unpack_forward_comm(int n, int first, double *buf)
{ {
int i, k, m, last,a,b; int m = 0;
m = 0; int last = first + n;
last = first + n; for (int i = first; i < last; i++) {
for (i = first; i < last; i++) {
if (comm_stage == 0) { if (comm_stage == 0) {
coordination[i] = buf[m++]; coordination[i] = buf[m++];
} else { } else {
if (kernel_style == RK0) { if (kernel_style == RK0) {
C0[i] = buf[m++]; C0[i] = buf[m++];
} else { } else {
for (a = 0; a < ncor; a++) for (int a = 0; a < ncor; a++)
for (b = 0; b < Mdim; b++) for (int b = 0; b < Mdim; b++)
C[i][a][b] = buf[m++]; C[i][a][b] = buf[m++];
} }
} }

View File

@ -46,9 +46,10 @@ using namespace RHEO_NS;
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
ComputeRHEOPropertyAtom::ComputeRHEOPropertyAtom(LAMMPS *lmp, int narg, char **arg) : ComputeRHEOPropertyAtom::ComputeRHEOPropertyAtom(LAMMPS *lmp, int narg, char **arg) :
Compute(lmp, narg, arg), fix_rheo(nullptr), fix_pressure(nullptr), fix_thermal(nullptr), compute_interface(nullptr), Compute(lmp, narg, arg), avec_index(nullptr), col_index(nullptr), col_t_index(nullptr),
compute_kernel(nullptr), compute_surface(nullptr), compute_vshift(nullptr), compute_grad(nullptr), buf(nullptr), pack_choice(nullptr), fix_rheo(nullptr), fix_pressure(nullptr),
avec_index(nullptr), pack_choice(nullptr), col_index(nullptr) fix_thermal(nullptr), compute_interface(nullptr), compute_kernel(nullptr),
compute_surface(nullptr), compute_vshift(nullptr), compute_grad(nullptr)
{ {
if (narg < 4) utils::missing_cmd_args(FLERR, "compute property/atom", error); if (narg < 4) utils::missing_cmd_args(FLERR, "compute property/atom", error);
@ -88,7 +89,6 @@ ComputeRHEOPropertyAtom::ComputeRHEOPropertyAtom(LAMMPS *lmp, int narg, char **a
col_t_index = new int[nvalues]; col_t_index = new int[nvalues];
int i = 0; int i = 0;
int index, a, b;
for (int iarg = 3; iarg < narg; iarg++) { for (int iarg = 3; iarg < narg; iarg++) {
if (strcmp(arg[iarg], "phase") == 0) { if (strcmp(arg[iarg], "phase") == 0) {
pack_choice[i] = &ComputeRHEOPropertyAtom::pack_phase; pack_choice[i] = &ComputeRHEOPropertyAtom::pack_phase;
@ -536,7 +536,7 @@ int ComputeRHEOPropertyAtom::add_tensor_component(char* option, int i, FnPtrPack
} }
shift = dim * dim; shift = dim * dim;
} else { } else {
int index; int index = -1;
int dim_error = 0; int dim_error = 0;
if (utils::strmatch(option, "xx$")) { if (utils::strmatch(option, "xx$")) {
@ -592,7 +592,7 @@ int ComputeRHEOPropertyAtom::add_vector_component(char* option, int i, FnPtrPack
} }
shift = dim; shift = dim;
} else { } else {
int index; int index = -1;
if (utils::strmatch(option, "x$")) { if (utils::strmatch(option, "x$")) {
index = 0; index = 0;
} else if (utils::strmatch(option, "y$")) { } else if (utils::strmatch(option, "y$")) {

View File

@ -72,7 +72,7 @@ void ComputeRHEORhoSum::init_list(int /*id*/, NeighList *ptr)
void ComputeRHEORhoSum::compute_peratom() void ComputeRHEORhoSum::compute_peratom()
{ {
int i, j, ii, jj, inum, jnum, itype, jtype; int i, j, ii, jj, inum, jnum;
double xtmp, ytmp, ztmp, delx, dely, delz; double xtmp, ytmp, ztmp, delx, dely, delz;
int *ilist, *jlist, *numneigh, **firstneigh; int *ilist, *jlist, *numneigh, **firstneigh;
double rsq, w; double rsq, w;
@ -81,12 +81,11 @@ void ComputeRHEORhoSum::compute_peratom()
double **x = atom->x; double **x = atom->x;
double *rho = atom->rho; double *rho = atom->rho;
int *type = atom->type;
double *mass = atom->mass; double *mass = atom->mass;
double *rmass = atom->rmass;
int *type = atom->type;
int newton = force->newton; int newton = force->newton;
double jmass;
inum = list->inum; inum = list->inum;
ilist = list->ilist; ilist = list->ilist;
numneigh = list->numneigh; numneigh = list->numneigh;
@ -96,7 +95,8 @@ void ComputeRHEORhoSum::compute_peratom()
// initialize arrays, local with quintic self-contribution, ghosts are zeroed // initialize arrays, local with quintic self-contribution, ghosts are zeroed
for (i = 0; i < nlocal; i++) { for (i = 0; i < nlocal; i++) {
w = compute_kernel->calc_w_self(i, i); w = compute_kernel->calc_w_self(i, i);
rho[i] = w * mass[type[i]]; if (rmass) rho[i] = w * rmass[i];
else rho[i] = w * mass[type[i]];
} }
for (i = nlocal; i < nall; i++) rho[i] = 0.0; for (i = nlocal; i < nall; i++) rho[i] = 0.0;
@ -106,7 +106,6 @@ void ComputeRHEORhoSum::compute_peratom()
xtmp = x[i][0]; xtmp = x[i][0];
ytmp = x[i][1]; ytmp = x[i][1];
ztmp = x[i][2]; ztmp = x[i][2];
itype = type[i];
jlist = firstneigh[i]; jlist = firstneigh[i];
jnum = numneigh[i]; jnum = numneigh[i];
@ -121,6 +120,17 @@ void ComputeRHEORhoSum::compute_peratom()
if (rsq < cutsq) { if (rsq < cutsq) {
w = compute_kernel->calc_w(i, j, delx, dely, delz, sqrt(rsq)); w = compute_kernel->calc_w(i, j, delx, dely, delz, sqrt(rsq));
if (rmass) {
if (self_mass_flag) {
rho[i] += w * rmass[i];
if (newton || j < nlocal)
rho[j] += w * rmass[j];
} else {
rho[i] += w * rmass[j];
if (newton || j < nlocal)
rho[j] += w * rmass[i];
}
} else {
if (self_mass_flag) { if (self_mass_flag) {
rho[i] += w * mass[type[i]]; rho[i] += w * mass[type[i]];
if (newton || j < nlocal) if (newton || j < nlocal)
@ -133,6 +143,7 @@ void ComputeRHEORhoSum::compute_peratom()
} }
} }
} }
}
if (newton) comm->reverse_comm(this); if (newton) comm->reverse_comm(this);
comm->forward_comm(this); comm->forward_comm(this);
@ -143,7 +154,7 @@ void ComputeRHEORhoSum::compute_peratom()
int ComputeRHEORhoSum::pack_forward_comm(int n, int *list, double *buf, int ComputeRHEORhoSum::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 i, j, m;
double *rho = atom->rho; double *rho = atom->rho;
m = 0; m = 0;
@ -157,7 +168,7 @@ int ComputeRHEORhoSum::pack_forward_comm(int n, int *list, double *buf,
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
void ComputeRHEORhoSum::unpack_forward_comm(int n, int first, double *buf) void ComputeRHEORhoSum::unpack_forward_comm(int n, int first, double *buf)
{ {
int i, k, m, last; int i, m, last;
double *rho = atom->rho; double *rho = atom->rho;
m = 0; m = 0;
@ -171,7 +182,7 @@ void ComputeRHEORhoSum::unpack_forward_comm(int n, int first, double *buf)
int ComputeRHEORhoSum::pack_reverse_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, m, last;
double *rho = atom->rho; double *rho = atom->rho;
m = 0; m = 0;
@ -186,7 +197,7 @@ int ComputeRHEORhoSum::pack_reverse_comm(int n, int first, double *buf)
void ComputeRHEORhoSum::unpack_reverse_comm(int n, int *list, double *buf) void ComputeRHEORhoSum::unpack_reverse_comm(int n, int *list, double *buf)
{ {
int i, k, j, m; int i, j, m;
double *rho = atom->rho; double *rho = atom->rho;
m = 0; m = 0;

View File

@ -43,8 +43,9 @@ static constexpr double EPSILON = 1e-10;
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
ComputeRHEOSurface::ComputeRHEOSurface(LAMMPS *lmp, int narg, char **arg) : ComputeRHEOSurface::ComputeRHEOSurface(LAMMPS *lmp, int narg, char **arg) :
Compute(lmp, narg, arg), fix_rheo(nullptr), list(nullptr), rho0(nullptr), compute_kernel(nullptr), compute_interface(nullptr), Compute(lmp, narg, arg), nsurface(nullptr), rsurface(nullptr), divr(nullptr), fix_rheo(nullptr),
B(nullptr), gradC(nullptr), nsurface(nullptr), divr(nullptr), rsurface(nullptr) rho0(nullptr), B(nullptr), gradC(nullptr), list(nullptr), compute_kernel(nullptr),
compute_interface(nullptr)
{ {
if (narg != 3) error->all(FLERR,"Illegal compute RHEO/SURFACE command"); if (narg != 3) error->all(FLERR,"Illegal compute RHEO/SURFACE command");
@ -98,8 +99,8 @@ void ComputeRHEOSurface::init_list(int /*id*/, NeighList *ptr)
void ComputeRHEOSurface::compute_peratom() void ComputeRHEOSurface::compute_peratom()
{ {
int i, j, ii, jj, inum, jnum, a, b, itype, jtype, fluidi, fluidj; int i, j, ii, jj, inum, jnum, a, itype, jtype, fluidi, fluidj;
double xtmp, ytmp, ztmp, rsq, Voli, Volj, rhoi, rhoj, wp; double xtmp, ytmp, ztmp, rsq, Voli, Volj, rhoi, rhoj;
double dWij[3], dWji[3], dx[3]; double dWij[3], dWji[3], dx[3];
int *ilist, *jlist, *numneigh, **firstneigh; int *ilist, *jlist, *numneigh, **firstneigh;
@ -175,7 +176,7 @@ void ComputeRHEOSurface::compute_peratom()
Voli = mass[itype] / rhoi; Voli = mass[itype] / rhoi;
Volj = mass[jtype] / rhoj; Volj = mass[jtype] / rhoj;
wp = compute_kernel->calc_dw_quintic(i, j, dx[0], dx[1], dx[2], sqrt(rsq), dWij, dWji); 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; divr[i] -= dWij[a] * dx[a] * Volj;
@ -310,17 +311,15 @@ void ComputeRHEOSurface::compute_peratom()
int ComputeRHEOSurface::pack_reverse_comm(int n, int first, double *buf) int ComputeRHEOSurface::pack_reverse_comm(int n, int first, double *buf)
{ {
int i,a,b,k,m,last;
int dim = domain->dimension; int dim = domain->dimension;
int *status = atom->rheo_status; int *status = atom->rheo_status;
int m = 0;
m = 0; int last = first + n;
last = first + n; for (int i = first; i < last; i++) {
for (i = first; i < last; i++) {
if (comm_stage == 0) { if (comm_stage == 0) {
buf[m++] = divr[i]; buf[m++] = divr[i];
for (a = 0; a < dim; a ++ ) for (int a = 0; a < dim; a ++ )
for (b = 0; b < dim; b ++) for (int b = 0; b < dim; b ++)
buf[m++] = gradC[i][a * dim + b]; buf[m++] = gradC[i][a * dim + b];
} else if (comm_stage == 1) { } else if (comm_stage == 1) {
buf[m++] = (double) status[i]; buf[m++] = (double) status[i];
@ -334,27 +333,23 @@ int ComputeRHEOSurface::pack_reverse_comm(int n, int first, double *buf)
void ComputeRHEOSurface::unpack_reverse_comm(int n, int *list, double *buf) void ComputeRHEOSurface::unpack_reverse_comm(int n, int *list, double *buf)
{ {
int i,a,b,k,j,m;
int dim = domain->dimension; int dim = domain->dimension;
int *status = atom->rheo_status; int *status = atom->rheo_status;
int tmp1; int m = 0;
double tmp2; for (int i = 0; i < n; i++) {
int j = list[i];
m = 0;
for (i = 0; i < n; i++) {
j = list[i];
if (comm_stage == 0) { if (comm_stage == 0) {
divr[j] += buf[m++]; divr[j] += buf[m++];
for (a = 0; a < dim; a ++ ) for (int a = 0; a < dim; a ++ )
for (b = 0; b < dim; b ++) for (int b = 0; b < dim; b ++)
gradC[j][a * dim + b] += buf[m++]; gradC[j][a * dim + b] += buf[m++];
} else if (comm_stage == 1) { } else if (comm_stage == 1) {
tmp1 = (int) buf[m++]; auto tmp1 = (int) buf[m++];
if ((status[j] & STATUS_BULK) && (tmp1 & STATUS_LAYER)) { if ((status[j] & STATUS_BULK) && (tmp1 & STATUS_LAYER)) {
status[j] &= SURFACEMASK; status[j] &= SURFACEMASK;
status[j] |= STATUS_LAYER; status[j] |= STATUS_LAYER;
} }
tmp2 = buf[m++]; auto tmp2 = buf[m++];
rsurface[j] = MIN(rsurface[j], tmp2); rsurface[j] = MIN(rsurface[j], tmp2);
} }
} }
@ -366,12 +361,10 @@ void ComputeRHEOSurface::unpack_reverse_comm(int n, int *list, double *buf)
int ComputeRHEOSurface::pack_forward_comm(int n, int *list, double *buf, int ComputeRHEOSurface::pack_forward_comm(int n, int *list, double *buf,
int /*pbc_flag*/, int * /*pbc*/) int /*pbc_flag*/, int * /*pbc*/)
{ {
int i,j,a,b,k,m;
int *status = atom->rheo_status; int *status = atom->rheo_status;
m = 0; int m = 0;
for (int i = 0; i < n; i++) {
for (i = 0; i < n; i++) { int j = list[i];
j = list[i];
if (comm_stage == 0) { if (comm_stage == 0) {
buf[m++] = divr[j]; buf[m++] = divr[j];
} else if (comm_stage == 1) { } else if (comm_stage == 1) {
@ -386,12 +379,10 @@ int ComputeRHEOSurface::pack_forward_comm(int n, int *list, double *buf,
void ComputeRHEOSurface::unpack_forward_comm(int n, int first, double *buf) void ComputeRHEOSurface::unpack_forward_comm(int n, int first, double *buf)
{ {
int i, k, a, b, m, last;
int *status = atom->rheo_status; int *status = atom->rheo_status;
int m = 0;
m = 0; int last = first + n;
last = first + n; for (int i = first; i < last; i++) {
for (i = first; i < last; i++) {
if (comm_stage == 0) { if (comm_stage == 0) {
divr[i] = buf[m++]; divr[i] = buf[m++];
} else if (comm_stage == 1) { } else if (comm_stage == 1) {

View File

@ -41,8 +41,8 @@ using namespace RHEO_NS;
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
ComputeRHEOVShift::ComputeRHEOVShift(LAMMPS *lmp, int narg, char **arg) : ComputeRHEOVShift::ComputeRHEOVShift(LAMMPS *lmp, int narg, char **arg) :
Compute(lmp, narg, arg), list(nullptr), vshift(nullptr), fix_rheo(nullptr), Compute(lmp, narg, arg), vshift(nullptr), fix_rheo(nullptr), rho0(nullptr), list(nullptr),
compute_kernel(nullptr), compute_interface(nullptr), compute_surface(nullptr) compute_interface(nullptr), compute_kernel(nullptr), compute_surface(nullptr)
{ {
if (narg != 3) error->all(FLERR,"Illegal compute RHEO/VShift command"); if (narg != 3) error->all(FLERR,"Illegal compute RHEO/VShift command");
@ -90,7 +90,7 @@ void ComputeRHEOVShift::init_list(int /*id*/, NeighList *ptr)
void ComputeRHEOVShift::compute_peratom() void ComputeRHEOVShift::compute_peratom()
{ {
int i, j, a, b, ii, jj, jnum, itype, jtype; int i, j, a, ii, jj, jnum, itype, jtype;
int fluidi, fluidj; int fluidi, fluidj;
double xtmp, ytmp, ztmp, rsq, r, rinv; double xtmp, ytmp, ztmp, rsq, r, rinv;
double w, wp, dr, w0, w4, vmag, prefactor; double w, wp, dr, w0, w4, vmag, prefactor;
@ -229,8 +229,6 @@ void ComputeRHEOVShift::correct_surfaces()
{ {
if (!surface_flag) return; if (!surface_flag) return;
int i, a, b;
int *status = atom->rheo_status; int *status = atom->rheo_status;
int *mask = atom->mask; int *mask = atom->mask;
double **nsurface = compute_surface->nsurface; double **nsurface = compute_surface->nsurface;
@ -239,7 +237,7 @@ void ComputeRHEOVShift::correct_surfaces()
int dim = domain->dimension; int dim = domain->dimension;
double nx, ny, nz, vx, vy, vz, dot; double nx, ny, nz, vx, vy, vz, dot;
for (i = 0; i < nlocal; i++) { for (int i = 0; i < nlocal; i++) {
if (mask[i] & groupbit) { if (mask[i] & groupbit) {
if (status[i] & PHASECHECK) continue; if (status[i] & PHASECHECK) continue;
@ -283,11 +281,11 @@ void ComputeRHEOVShift::correct_surfaces()
int ComputeRHEOVShift::pack_reverse_comm(int n, int first, double *buf) int ComputeRHEOVShift::pack_reverse_comm(int n, int first, double *buf)
{ {
int i,m,last; int m, last;
m = 0; m = 0;
last = first + n; last = first + n;
for (i = first; i < last; i++) { for (int i = first; i < last; i++) {
buf[m++] = vshift[i][0]; buf[m++] = vshift[i][0];
buf[m++] = vshift[i][1]; buf[m++] = vshift[i][1];
buf[m++] = vshift[i][2]; buf[m++] = vshift[i][2];

View File

@ -50,8 +50,9 @@ static const char cite_rheo[] =
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
FixRHEO::FixRHEO(LAMMPS *lmp, int narg, char **arg) : FixRHEO::FixRHEO(LAMMPS *lmp, int narg, char **arg) :
Fix(lmp, narg, arg), compute_grad(nullptr), compute_kernel(nullptr), compute_surface(nullptr), Fix(lmp, narg, arg), rho0(nullptr), csq(nullptr), compute_grad(nullptr), compute_kernel(nullptr),
compute_interface(nullptr), compute_rhosum(nullptr), compute_vshift(nullptr), rho0(nullptr), csq(nullptr) compute_interface(nullptr), compute_surface(nullptr), compute_rhosum(nullptr),
compute_vshift(nullptr)
{ {
time_integrate = 1; time_integrate = 1;
@ -457,7 +458,6 @@ void FixRHEO::final_integrate()
double dtfm, divu; double dtfm, divu;
int i, a; int i, a;
double **x = atom->x;
double **v = atom->v; double **v = atom->v;
double **f = atom->f; double **f = atom->f;
double **gradv = compute_grad->gradv; double **gradv = compute_grad->gradv;

View File

@ -155,7 +155,6 @@ void FixRHEOOxidation::post_integrate()
double delx, dely, delz, rsq; double delx, dely, delz, rsq;
tagint tagi, tagj; tagint tagi, tagj;
int nlocal = atom->nlocal;
int newton_bond = force->newton_bond; int newton_bond = force->newton_bond;
tagint *tag = atom->tag; tagint *tag = atom->tag;
@ -267,7 +266,7 @@ void FixRHEOOxidation::post_force(int /*vflag*/)
int FixRHEOOxidation::pack_forward_comm(int n, int *list, double *buf, int FixRHEOOxidation::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 i, j, m;
double **x = atom->x; double **x = atom->x;
m = 0; m = 0;
@ -284,7 +283,7 @@ int FixRHEOOxidation::pack_forward_comm(int n, int *list, double *buf,
void FixRHEOOxidation::unpack_forward_comm(int n, int first, double *buf) void FixRHEOOxidation::unpack_forward_comm(int n, int first, double *buf)
{ {
int i, k, m, last; int i, m, last;
double **x = atom->x; double **x = atom->x;
m = 0; m = 0;
last = first + n; last = first + n;

View File

@ -39,7 +39,9 @@ static constexpr double SEVENTH = 1.0 / 7.0;
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
FixRHEOPressure::FixRHEOPressure(LAMMPS *lmp, int narg, char **arg) : 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), tpower(nullptr), pbackground(nullptr), pressure_style(nullptr) Fix(lmp, narg, arg), c_cubic(nullptr), csq(nullptr), csqinv(nullptr), rho0(nullptr),
rho0inv(nullptr), tpower(nullptr), pbackground(nullptr), pressure_style(nullptr),
fix_rheo(nullptr)
{ {
if (narg < 4) error->all(FLERR,"Illegal fix command"); if (narg < 4) error->all(FLERR,"Illegal fix command");
@ -160,9 +162,6 @@ void FixRHEOPressure::setup_pre_force(int /*vflag*/)
void FixRHEOPressure::pre_force(int /*vflag*/) void FixRHEOPressure::pre_force(int /*vflag*/)
{ {
int i;
double dr, rr3, rho_ratio;
int *mask = atom->mask; int *mask = atom->mask;
int *type = atom->type; int *type = atom->type;
double *rho = atom->rho; double *rho = atom->rho;
@ -170,7 +169,7 @@ void FixRHEOPressure::pre_force(int /*vflag*/)
int nlocal = atom->nlocal; int nlocal = atom->nlocal;
for (i = 0; i < nlocal; i++) for (int i = 0; i < nlocal; i++)
if (mask[i] & groupbit) if (mask[i] & groupbit)
pressure[i] = calc_pressure(rho[i], type[i]); pressure[i] = calc_pressure(rho[i], type[i]);
@ -182,12 +181,10 @@ void FixRHEOPressure::pre_force(int /*vflag*/)
int FixRHEOPressure::pack_forward_comm(int n, int *list, double *buf, int FixRHEOPressure::pack_forward_comm(int n, int *list, double *buf,
int /*pbc_flag*/, int * /*pbc*/) int /*pbc_flag*/, int * /*pbc*/)
{ {
int i,j,k,m;
double *pressure = atom->pressure; double *pressure = atom->pressure;
m = 0; int m = 0;
for (int i = 0; i < n; i++) {
for (i = 0; i < n; i++) { int j = list[i];
j = list[i];
buf[m++] = pressure[j]; buf[m++] = pressure[j];
} }
return m; return m;
@ -197,12 +194,10 @@ int FixRHEOPressure::pack_forward_comm(int n, int *list, double *buf,
void FixRHEOPressure::unpack_forward_comm(int n, int first, double *buf) void FixRHEOPressure::unpack_forward_comm(int n, int first, double *buf)
{ {
int i, k, m, last;
double *pressure = atom->pressure; double *pressure = atom->pressure;
int m = 0;
m = 0; int last = first + n;
last = first + n; for (int i = first; i < last; i++) {
for (i = first; i < last; i++) {
pressure[i] = buf[m++]; pressure[i] = buf[m++];
} }
} }
@ -211,7 +206,8 @@ void FixRHEOPressure::unpack_forward_comm(int n, int first, double *buf)
double FixRHEOPressure::calc_pressure(double rho, int type) double FixRHEOPressure::calc_pressure(double rho, int type)
{ {
double p, dr, rr3, rho_ratio; double p = 0.0;
double dr, rr3, rho_ratio;
if (pressure_style[type] == LINEAR) { if (pressure_style[type] == LINEAR) {
p = csq[type] * (rho - rho0[type]); p = csq[type] * (rho - rho0[type]);
@ -234,7 +230,7 @@ double FixRHEOPressure::calc_pressure(double rho, int type)
double FixRHEOPressure::calc_rho(double p, int type) double FixRHEOPressure::calc_rho(double p, int type)
{ {
double rho, dr, rr3, rho_ratio; double rho = 0.0;
if (pressure_style[type] == LINEAR) { if (pressure_style[type] == LINEAR) {
rho = csqinv[type] * p + rho0[type]; rho = csqinv[type] * p + rho0[type];

View File

@ -60,10 +60,9 @@ static const char cite_rheo_oxide[] =
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
FixRHEOThermal::FixRHEOThermal(LAMMPS *lmp, int narg, char **arg) : FixRHEOThermal::FixRHEOThermal(LAMMPS *lmp, int narg, char **arg) :
Fix(lmp, narg, arg), fix_rheo(nullptr), compute_grad(nullptr), compute_vshift(nullptr), Fix(lmp, narg, arg), cv(nullptr), Tc(nullptr), kappa(nullptr), L(nullptr), cv_style(nullptr),
Tc(nullptr), kappa(nullptr), cv(nullptr), L(nullptr), Tc_style(nullptr), kappa_style(nullptr), L_style(nullptr), list(nullptr), fix_rheo(nullptr),
Tc_style(nullptr), kappa_style(nullptr), cv_style(nullptr), L_style(nullptr), compute_grad(nullptr), compute_vshift(nullptr), fix_update_special_bonds(nullptr)
fix_update_special_bonds(nullptr)
{ {
if (narg < 4) error->all(FLERR,"Illegal fix command"); if (narg < 4) error->all(FLERR,"Illegal fix command");
@ -189,13 +188,14 @@ FixRHEOThermal::FixRHEOThermal(LAMMPS *lmp, int narg, char **arg) :
cut_bond = utils::numeric(FLERR, arg[iarg + 1], false, lmp); cut_bond = utils::numeric(FLERR, arg[iarg + 1], false, lmp);
btype = utils::numeric(FLERR, arg[iarg + 2], false, lmp); btype = utils::numeric(FLERR, arg[iarg + 2], false, lmp);
comm_forward = 4; comm_forward = 4;
if (cut_bond <= 0.0) error->all(FLERR, "Illegal max bond length must be greater than zero");\ 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"); if ((btype < 1) || (btype > atom->nbondtypes))
error->all(FLERR, "Illegal value {} for bond type", btype);
cutsq_bond = cut_bond * cut_bond; cutsq_bond = cut_bond * cut_bond;
iarg += 3; iarg += 3;
} else { } else {
error->all(FLERR,"Illegal fix command, {}", arg[iarg]); error->all(FLERR,"Unknown fix rheo/thermal keyword: {}", arg[iarg]);
} }
} }
@ -460,20 +460,16 @@ void FixRHEOThermal::post_neighbor()
void FixRHEOThermal::pre_force(int /*vflag*/) void FixRHEOThermal::pre_force(int /*vflag*/)
{ {
int i, itype;
double cvi, Tci, Ti, Li; double cvi, Tci, Ti, Li;
double *energy = atom->esph; double *energy = atom->esph;
double *temperature = atom->temperature; double *temperature = atom->temperature;
int *type = atom->type; int *type = atom->type;
int *status = atom->rheo_status; int nall = atom->nlocal + atom->nghost;
int nlocal = atom->nlocal;
int nall = nlocal + atom->nghost;
// Calculate temperature // Calculate temperature
for (i = 0; i < nall; i++) { for (int i = 0; i < nall; i++) {
itype = type[i]; int itype = type[i];
cvi = calc_cv(i, itype); cvi = calc_cv(i, itype);
temperature[i] = energy[i] / cvi; temperature[i] = energy[i] / cvi;
@ -529,7 +525,6 @@ void FixRHEOThermal::break_bonds()
int nbondlist = neighbor->nbondlist; int nbondlist = neighbor->nbondlist;
int nlocal = atom->nlocal; int nlocal = atom->nlocal;
int nall = nlocal + atom->nghost;
// 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++) { for (int i = 0; i < nlocal; i++) {
@ -753,13 +748,11 @@ double FixRHEOThermal::calc_L(int i, int itype)
int FixRHEOThermal::pack_forward_comm(int n, int *list, double *buf, int FixRHEOThermal::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 *status = atom->rheo_status; int *status = atom->rheo_status;
double **x = atom->x; double **x = atom->x;
m = 0; int m = 0;
for (int i = 0; i < n; i++) {
for (i = 0; i < n; i++) { int j = list[i];
j = list[i];
buf[m++] = ubuf(status[j]).d; buf[m++] = ubuf(status[j]).d;
buf[m++] = x[j][0]; buf[m++] = x[j][0];
buf[m++] = x[j][1]; buf[m++] = x[j][1];
@ -772,12 +765,11 @@ int FixRHEOThermal::pack_forward_comm(int n, int *list, double *buf,
void FixRHEOThermal::unpack_forward_comm(int n, int first, double *buf) void FixRHEOThermal::unpack_forward_comm(int n, int first, double *buf)
{ {
int i, k, m, last;
int *status = atom->rheo_status; int *status = atom->rheo_status;
double **x = atom->x; double **x = atom->x;
m = 0; int m = 0;
last = first + n; int last = first + n;
for (i = first; i < last; i++) { for (int i = first; i < last; i++) {
status[i] = (int) ubuf(buf[m++]).i; status[i] = (int) ubuf(buf[m++]).i;
x[i][0] = buf[m++]; x[i][0] = buf[m++];
x[i][1] = buf[m++]; x[i][1] = buf[m++];

View File

@ -38,8 +38,8 @@ enum {NONE, CONSTANT, POWER};
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
FixRHEOViscosity::FixRHEOViscosity(LAMMPS *lmp, int narg, char **arg) : FixRHEOViscosity::FixRHEOViscosity(LAMMPS *lmp, int narg, char **arg) :
Fix(lmp, narg, arg), fix_rheo(nullptr), compute_grad(nullptr), eta(nullptr), Fix(lmp, narg, arg), eta(nullptr), npow(nullptr), K(nullptr), gd0(nullptr), tau0(nullptr),
npow(nullptr), K(nullptr), gd0(nullptr), tau0(nullptr), viscosity_style(nullptr) viscosity_style(nullptr), fix_rheo(nullptr), compute_grad(nullptr)
{ {
if (narg < 4) error->all(FLERR, "Illegal fix command"); if (narg < 4) error->all(FLERR, "Illegal fix command");
@ -225,12 +225,10 @@ void FixRHEOViscosity::pre_force(int /*vflag*/)
int FixRHEOViscosity::pack_forward_comm(int n, int *list, double *buf, int FixRHEOViscosity::pack_forward_comm(int n, int *list, double *buf,
int /*pbc_flag*/, int * /*pbc*/) int /*pbc_flag*/, int * /*pbc*/)
{ {
int i, j, k, m;
double *viscosity = atom->viscosity; double *viscosity = atom->viscosity;
m = 0; int m = 0;
for (int i = 0; i < n; i++) {
for (i = 0; i < n; i++) { int j = list[i];
j = list[i];
buf[m++] = viscosity[j]; buf[m++] = viscosity[j];
} }
return m; return m;
@ -240,12 +238,10 @@ int FixRHEOViscosity::pack_forward_comm(int n, int *list, double *buf,
void FixRHEOViscosity::unpack_forward_comm(int n, int first, double *buf) void FixRHEOViscosity::unpack_forward_comm(int n, int first, double *buf)
{ {
int i, k, m, last;
double *viscosity = atom->viscosity; double *viscosity = atom->viscosity;
int m = 0;
m = 0; int last = first + n;
last = first + n; for (int i = first; i < last; i++) {
for (i = first; i < last; i++) {
viscosity[i] = buf[m++]; viscosity[i] = buf[m++];
} }
} }

View File

@ -47,8 +47,9 @@ static constexpr double EPSILON = 1e-2;
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
PairRHEO::PairRHEO(LAMMPS *lmp) : PairRHEO::PairRHEO(LAMMPS *lmp) :
Pair(lmp), compute_kernel(nullptr), compute_grad(nullptr), compute_interface(nullptr), fix_rheo(nullptr), Pair(lmp), csq(nullptr), rho0(nullptr), cs(nullptr), compute_kernel(nullptr),
fix_pressure(nullptr), rho0(nullptr), csq(nullptr), cs(nullptr) compute_grad(nullptr), compute_interface(nullptr), fix_rheo(nullptr),
fix_pressure(nullptr)
{ {
restartinfo = 0; restartinfo = 0;
single_enable = 0; single_enable = 0;
@ -80,10 +81,10 @@ void PairRHEO::compute(int eflag, int vflag)
int i, j, a, b, ii, jj, inum, jnum, itype, jtype; int i, j, a, b, ii, jj, inum, jnum, itype, jtype;
int pair_force_flag, pair_rho_flag, pair_avisc_flag; int pair_force_flag, pair_rho_flag, pair_avisc_flag;
int fluidi, fluidj; int fluidi, fluidj;
double xtmp, ytmp, ztmp, w, wp, Ti, Tj, dT, csq_ave, cs_ave; double xtmp, ytmp, ztmp, 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 mu, q, fp_prefactor, drho_damp, fmag, psi_ij, Fij;
double *dWij, *dWji, *dW1ij, *dW1ji; double *dWij, *dWji;
double dx[3], du[3], dv[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; int *ilist, *jlist, *numneigh, **firstneigh;
@ -108,10 +109,8 @@ void PairRHEO::compute(int eflag, int vflag)
double *conductivity = atom->conductivity; double *conductivity = atom->conductivity;
double *temperature = atom->temperature; double *temperature = atom->temperature;
double *heatflow = atom->heatflow; double *heatflow = atom->heatflow;
double *special_lj = force->special_lj;
int *type = atom->type; int *type = atom->type;
int *status = atom->rheo_status; int *status = atom->rheo_status;
tagint *tag = atom->tag;
double **fp_store, *chi; double **fp_store, *chi;
if (compute_interface) { if (compute_interface) {
@ -461,11 +460,13 @@ void PairRHEO::setup()
{ {
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 pair rheo"); if (fixes.size() == 0) error->all(FLERR, "Need to define fix rheo to use pair rheo");
if (fixes.size() > 1) error->all(FLERR, "Must have only one fix rheo defined");
fix_rheo = dynamic_cast<FixRHEO *>(fixes[0]); fix_rheo = dynamic_cast<FixRHEO *>(fixes[0]);
// Currently only allow one instance of fix rheo/pressure // Currently only allow one instance of fix rheo/pressure
fixes = modify->get_fix_by_style("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"); if (fixes.size() == 0) error->all(FLERR, "Need to define fix rheo/pressure to use pair rheo");
if (fixes.size() > 1) error->all(FLERR, "Must have only one fix rheo/pressure defined");
fix_pressure = dynamic_cast<FixRHEOPressure *>(fixes[0]); fix_pressure = dynamic_cast<FixRHEOPressure *>(fixes[0]);
compute_kernel = fix_rheo->compute_kernel; compute_kernel = fix_rheo->compute_kernel;
@ -518,12 +519,10 @@ double PairRHEO::init_one(int i, int j)
int PairRHEO::pack_reverse_comm(int n, int first, double *buf) int PairRHEO::pack_reverse_comm(int n, int first, double *buf)
{ {
int i, k, m, last;
double **fp_store = compute_interface->fp_store; double **fp_store = compute_interface->fp_store;
int m = 0;
m = 0; int last = first + n;
last = first + n; for (int i = first; i < last; i++) {
for (i = first; i < last; i++) {
buf[m++] = fp_store[i][0]; buf[m++] = fp_store[i][0];
buf[m++] = fp_store[i][1]; buf[m++] = fp_store[i][1];
buf[m++] = fp_store[i][2]; buf[m++] = fp_store[i][2];
@ -536,12 +535,10 @@ int PairRHEO::pack_reverse_comm(int n, int first, double *buf)
void PairRHEO::unpack_reverse_comm(int n, int *list, double *buf) void PairRHEO::unpack_reverse_comm(int n, int *list, double *buf)
{ {
int i, j, k, m;
double **fp_store = compute_interface->fp_store; double **fp_store = compute_interface->fp_store;
int m = 0;
m = 0; for (int i = 0; i < n; i++) {
for (i = 0; i < n; i++) { int j = list[i];
j = list[i];
fp_store[j][0] += buf[m++]; fp_store[j][0] += buf[m++];
fp_store[j][1] += buf[m++]; fp_store[j][1] += buf[m++];
fp_store[j][2] += buf[m++]; fp_store[j][2] += buf[m++];