From 2ba424e1a36e46871eda4eec59bcac4bb8772cd3 Mon Sep 17 00:00:00 2001 From: Tim Mattox Date: Mon, 19 Dec 2016 15:11:52 -0500 Subject: [PATCH 1/2] USER-DPD: Whitespace cleanup to pair_dpd_fdt_energy.cpp --- src/USER-DPD/pair_dpd_fdt_energy.cpp | 78 ++++++++++++++-------------- 1 file changed, 39 insertions(+), 39 deletions(-) diff --git a/src/USER-DPD/pair_dpd_fdt_energy.cpp b/src/USER-DPD/pair_dpd_fdt_energy.cpp index 2041405467..558994d35e 100644 --- a/src/USER-DPD/pair_dpd_fdt_energy.cpp +++ b/src/USER-DPD/pair_dpd_fdt_energy.cpp @@ -206,7 +206,7 @@ void PairDPDfdtEnergy::compute(int eflag, int vflag) if (r < EPSILON) continue; // r can be 0.0 in DPD systems rinv = 1.0/r; wr = 1.0 - r/cut[itype][jtype]; - wd = wr*wr; + wd = wr*wr; delvx = vxtmp - v[j][0]; delvy = vytmp - v[j][1]; @@ -214,11 +214,11 @@ void PairDPDfdtEnergy::compute(int eflag, int vflag) dot = delx*delvx + dely*delvy + delz*delvz; randnum = random->gaussian(); - // Compute the current temperature - theta_ij = 0.5*(1.0/dpdTheta[i] + 1.0/dpdTheta[j]); - theta_ij = 1.0/theta_ij; - - gamma_ij = sigma[itype][jtype]*sigma[itype][jtype] + // Compute the current temperature + theta_ij = 0.5*(1.0/dpdTheta[i] + 1.0/dpdTheta[j]); + theta_ij = 1.0/theta_ij; + + gamma_ij = sigma[itype][jtype]*sigma[itype][jtype] / (2.0*force->boltz*theta_ij); // conservative force = a0 * wr @@ -239,44 +239,44 @@ void PairDPDfdtEnergy::compute(int eflag, int vflag) f[j][2] -= delz*fpair; } - if (rmass) { - mass_i = rmass[i]; - mass_j = rmass[j]; - } else { - mass_i = mass[itype]; - mass_j = mass[jtype]; - } - massinv_i = 1.0 / mass_i; - massinv_j = 1.0 / mass_j; + if (rmass) { + mass_i = rmass[i]; + mass_j = rmass[j]; + } else { + mass_i = mass[itype]; + mass_j = mass[jtype]; + } + massinv_i = 1.0 / mass_i; + massinv_j = 1.0 / mass_j; - // Compute the mechanical and conductive energy, uMech and uCond - mu_ij = massinv_i + massinv_j; - mu_ij *= force->ftm2v; + // Compute the mechanical and conductive energy, uMech and uCond + mu_ij = massinv_i + massinv_j; + mu_ij *= force->ftm2v; - uTmp = gamma_ij*wd*rinv*rinv*dot*dot + uTmp = gamma_ij*wd*rinv*rinv*dot*dot - 0.5*sigma[itype][jtype]*sigma[itype][jtype]*mu_ij*wd; - uTmp -= sigma[itype][jtype]*wr*rinv*dot*randnum*dtinvsqrt; - uTmp *= 0.5; + uTmp -= sigma[itype][jtype]*wr*rinv*dot*randnum*dtinvsqrt; + uTmp *= 0.5; - duMech[i] += uTmp; - if (newton_pair || j < nlocal) { - duMech[j] += uTmp; - } - - // Compute uCond - randnum = random->gaussian(); - kappa_ij = kappa[itype][jtype]; - alpha_ij = sqrt(2.0*force->boltz*kappa_ij); - randPair = alpha_ij*wr*randnum*dtinvsqrt; + duMech[i] += uTmp; + if (newton_pair || j < nlocal) { + duMech[j] += uTmp; + } + + // Compute uCond + randnum = random->gaussian(); + kappa_ij = kappa[itype][jtype]; + alpha_ij = sqrt(2.0*force->boltz*kappa_ij); + randPair = alpha_ij*wr*randnum*dtinvsqrt; + + uTmp = kappa_ij*(1.0/dpdTheta[i] - 1.0/dpdTheta[j])*wd; + uTmp += randPair; + + duCond[i] += uTmp; + if (newton_pair || j < nlocal) { + duCond[j] -= uTmp; + } - uTmp = kappa_ij*(1.0/dpdTheta[i] - 1.0/dpdTheta[j])*wd; - uTmp += randPair; - - duCond[i] += uTmp; - if (newton_pair || j < nlocal) { - duCond[j] -= uTmp; - } - if (eflag) { // unshifted eng of conservative term: // evdwl = -a0[itype][jtype]*r * (1.0-0.5*r/cut[itype][jtype]); From c4e02a5d2b609bce4b4fabd1f6be851cd4d12566 Mon Sep 17 00:00:00 2001 From: Tim Mattox Date: Tue, 20 Dec 2016 11:17:11 -0500 Subject: [PATCH 2/2] USER-DPD: more whitespace fixes --- src/USER-DPD/compute_dpd_atom.cpp | 2 +- src/USER-DPD/fix_eos_table_rx.cpp | 2 +- src/USER-DPD/fix_rx.cpp | 22 +++++++++---------- src/USER-DPD/npair_half_bin_newton_ssa.cpp | 6 ++--- src/USER-DPD/npair_halffull_newton_ssa.cpp | 2 +- src/USER-DPD/npair_halffull_newton_ssa.h | 2 +- .../nstencil_half_bin_2d_newton_ssa.cpp | 4 ++-- .../nstencil_half_bin_3d_newton_ssa.cpp | 6 ++--- src/USER-DPD/pair_dpd_fdt.cpp | 2 +- src/USER-DPD/pair_multi_lucy.cpp | 4 ++-- 10 files changed, 26 insertions(+), 26 deletions(-) diff --git a/src/USER-DPD/compute_dpd_atom.cpp b/src/USER-DPD/compute_dpd_atom.cpp index 5770ed451b..c8231ddabc 100644 --- a/src/USER-DPD/compute_dpd_atom.cpp +++ b/src/USER-DPD/compute_dpd_atom.cpp @@ -43,7 +43,7 @@ ComputeDpdAtom::ComputeDpdAtom(LAMMPS *lmp, int narg, char **arg) : size_peratom_cols = 4; nmax = 0; - + if (atom->dpd_flag != 1) error->all(FLERR,"compute dpd requires atom_style with internal temperature and energies (e.g. dpd)"); } diff --git a/src/USER-DPD/fix_eos_table_rx.cpp b/src/USER-DPD/fix_eos_table_rx.cpp index 527c42c1b8..9a67afd72a 100644 --- a/src/USER-DPD/fix_eos_table_rx.cpp +++ b/src/USER-DPD/fix_eos_table_rx.cpp @@ -34,7 +34,7 @@ using namespace FixConst; /* ---------------------------------------------------------------------- */ FixEOStableRX::FixEOStableRX(LAMMPS *lmp, int narg, char **arg) : - Fix(lmp, narg, arg), ntables(0), tables(NULL), + Fix(lmp, narg, arg), ntables(0), tables(NULL), tables2(NULL), dHf(NULL), eosSpecies(NULL) { if (narg != 8) error->all(FLERR,"Illegal fix eos/table/rx command"); diff --git a/src/USER-DPD/fix_rx.cpp b/src/USER-DPD/fix_rx.cpp index 47194cd7bc..e52c032281 100644 --- a/src/USER-DPD/fix_rx.cpp +++ b/src/USER-DPD/fix_rx.cpp @@ -60,12 +60,12 @@ double getElapsedTime( const TimerType &t0, const TimerType &t1) { return t1-t0; /* ---------------------------------------------------------------------- */ FixRX::FixRX(LAMMPS *lmp, int narg, char **arg) : - Fix(lmp, narg, arg), mol2param(NULL), nreactions(0), - params(NULL), Arr(NULL), nArr(NULL), Ea(NULL), tempExp(NULL), - stoich(NULL), stoichReactants(NULL), stoichProducts(NULL), kR(NULL), - pairDPDE(NULL), dpdThetaLocal(NULL), sumWeights(NULL), sparseKinetics_nu(NULL), - sparseKinetics_nuk(NULL), sparseKinetics_inu(NULL), sparseKinetics_isIntegralReaction(NULL), - kineticsFile(NULL), id_fix_species(NULL), + Fix(lmp, narg, arg), mol2param(NULL), nreactions(0), + params(NULL), Arr(NULL), nArr(NULL), Ea(NULL), tempExp(NULL), + stoich(NULL), stoichReactants(NULL), stoichProducts(NULL), kR(NULL), + pairDPDE(NULL), dpdThetaLocal(NULL), sumWeights(NULL), sparseKinetics_nu(NULL), + sparseKinetics_nuk(NULL), sparseKinetics_inu(NULL), sparseKinetics_isIntegralReaction(NULL), + kineticsFile(NULL), id_fix_species(NULL), id_fix_species_old(NULL), fix_species(NULL), fix_species_old(NULL) { if (narg < 7 || narg > 12) error->all(FLERR,"Illegal fix rx command"); @@ -656,7 +656,7 @@ void FixRX::setup_pre_force(int vflag) memset(dpdThetaLocal, 0, sizeof(double)*count); computeLocalTemperature(); } - + for (int id = 0; id < nlocal; id++) for (int ispecies=0; ispeciesdvector[ispecies][id]; @@ -667,14 +667,14 @@ void FixRX::setup_pre_force(int vflag) // Set the reaction rate constants to zero: no reactions occur at step 0 for(int irxn=0;irxnforward_comm_fix(this); if(localTempFlag) delete [] dpdThetaLocal; diff --git a/src/USER-DPD/npair_half_bin_newton_ssa.cpp b/src/USER-DPD/npair_half_bin_newton_ssa.cpp index fa000233a9..25805461b5 100644 --- a/src/USER-DPD/npair_half_bin_newton_ssa.cpp +++ b/src/USER-DPD/npair_half_bin_newton_ssa.cpp @@ -12,7 +12,7 @@ ------------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- - Contributing authors: + Contributing authors: James Larentzos and Timothy I. Mattox (Engility Corporation) ------------------------------------------------------------------------- */ @@ -147,7 +147,7 @@ void NPairHalfBinNewtonSSA::build(NeighList *list) // loop over all local atoms in other bins in "half" stencil for (k = 0; k < nstencil_half; k++) { - for (j = binhead_ssa[ibin+stencil[k]]; j >= 0; + for (j = binhead_ssa[ibin+stencil[k]]; j >= 0; j = bins_ssa[j]) { jtype = type[j]; @@ -183,7 +183,7 @@ void NPairHalfBinNewtonSSA::build(NeighList *list) // Note2: only non-pure locals can have ghosts as neighbors if (ssaAIR[i] == 1) for (k = 0; k < nstencil_full; k++) { - for (j = gbinhead_ssa[ibin+stencil[k]]; j >= 0; + for (j = gbinhead_ssa[ibin+stencil[k]]; j >= 0; j = bins_ssa[j]) { jtype = type[j]; diff --git a/src/USER-DPD/npair_halffull_newton_ssa.cpp b/src/USER-DPD/npair_halffull_newton_ssa.cpp index f09a2c3ae1..3cd0b71879 100644 --- a/src/USER-DPD/npair_halffull_newton_ssa.cpp +++ b/src/USER-DPD/npair_halffull_newton_ssa.cpp @@ -12,7 +12,7 @@ ------------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- - Contributing authors: + Contributing authors: James Larentzos and Timothy I. Mattox (Engility Corporation) ------------------------------------------------------------------------- */ diff --git a/src/USER-DPD/npair_halffull_newton_ssa.h b/src/USER-DPD/npair_halffull_newton_ssa.h index 4935349f77..8608164950 100644 --- a/src/USER-DPD/npair_halffull_newton_ssa.h +++ b/src/USER-DPD/npair_halffull_newton_ssa.h @@ -15,7 +15,7 @@ NPairStyle(halffull/newton/ssa, NPairHalffullNewtonSSA, - NP_HALFFULL | NP_NSQ | NP_BIN | NP_MULTI | NP_NEWTON | + NP_HALFFULL | NP_NSQ | NP_BIN | NP_MULTI | NP_NEWTON | NP_ORTHO | NP_TRI | NP_SSA) #else diff --git a/src/USER-DPD/nstencil_half_bin_2d_newton_ssa.cpp b/src/USER-DPD/nstencil_half_bin_2d_newton_ssa.cpp index 4c548c783c..df379a109a 100644 --- a/src/USER-DPD/nstencil_half_bin_2d_newton_ssa.cpp +++ b/src/USER-DPD/nstencil_half_bin_2d_newton_ssa.cpp @@ -12,7 +12,7 @@ ------------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- - Contributing authors: + Contributing authors: James Larentzos and Timothy I. Mattox (Engility Corporation) ------------------------------------------------------------------------- */ @@ -24,7 +24,7 @@ using namespace LAMMPS_NS; /* ---------------------------------------------------------------------- */ -NStencilHalfBin2dNewtonSSA::NStencilHalfBin2dNewtonSSA(LAMMPS *lmp) : +NStencilHalfBin2dNewtonSSA::NStencilHalfBin2dNewtonSSA(LAMMPS *lmp) : NStencilSSA(lmp) {} /* ---------------------------------------------------------------------- diff --git a/src/USER-DPD/nstencil_half_bin_3d_newton_ssa.cpp b/src/USER-DPD/nstencil_half_bin_3d_newton_ssa.cpp index 4b8bd27016..76c9931ab2 100644 --- a/src/USER-DPD/nstencil_half_bin_3d_newton_ssa.cpp +++ b/src/USER-DPD/nstencil_half_bin_3d_newton_ssa.cpp @@ -12,7 +12,7 @@ ------------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- - Contributing authors: + Contributing authors: James Larentzos and Timothy I. Mattox (Engility Corporation) ------------------------------------------------------------------------- */ @@ -24,7 +24,7 @@ using namespace LAMMPS_NS; /* ---------------------------------------------------------------------- */ -NStencilHalfBin3dNewtonSSA::NStencilHalfBin3dNewtonSSA(LAMMPS *lmp) : +NStencilHalfBin3dNewtonSSA::NStencilHalfBin3dNewtonSSA(LAMMPS *lmp) : NStencilSSA(lmp) {} /* ---------------------------------------------------------------------- @@ -62,7 +62,7 @@ void NStencilHalfBin3dNewtonSSA::create() // For k==0, make sure to skip already included bins - k = 0; + k = 0; for (j = -sy; j <= 0; j++) for (i = -sx; i <= sx; i++) { if (j == 0 && i > 0) continue; diff --git a/src/USER-DPD/pair_dpd_fdt.cpp b/src/USER-DPD/pair_dpd_fdt.cpp index cea5b87404..f2c4c8f099 100644 --- a/src/USER-DPD/pair_dpd_fdt.cpp +++ b/src/USER-DPD/pair_dpd_fdt.cpp @@ -182,7 +182,7 @@ void PairDPDfdt::compute(int eflag, int vflag) wr = 1.0 - r/cut[itype][jtype]; wd = wr*wr; randnum = random->gaussian(); - gamma_ij = sigma[itype][jtype]*sigma[itype][jtype] + gamma_ij = sigma[itype][jtype]*sigma[itype][jtype] / (2.0*force->boltz*temperature); // conservative force = a0 * wd diff --git a/src/USER-DPD/pair_multi_lucy.cpp b/src/USER-DPD/pair_multi_lucy.cpp index 8e94495344..6f4104e93d 100644 --- a/src/USER-DPD/pair_multi_lucy.cpp +++ b/src/USER-DPD/pair_multi_lucy.cpp @@ -182,7 +182,7 @@ void PairMultiLucy::compute(int eflag, int vflag) f[j][2] -= delz*fpair; } if (evflag) ev_tally(i,j,nlocal,newton_pair, - 0.0,0.0,fpair,delx,dely,delz); + 0.0,0.0,fpair,delx,dely,delz); } } @@ -201,7 +201,7 @@ void PairMultiLucy::compute(int eflag, int vflag) evdwl *=(pi*cutsq[itype][itype]*cutsq[itype][itype])/84.0; if (evflag) ev_tally(0,0,nlocal,newton_pair, - evdwl,0.0,0.0,0.0,0.0,0.0); + evdwl,0.0,0.0,0.0,0.0,0.0); } if (vflag_fdotr) virial_fdotr_compute();