diff --git a/src/FLD/pair_lubricateU.cpp b/src/FLD/pair_lubricateU.cpp index 4fda281140..bb66833242 100644 --- a/src/FLD/pair_lubricateU.cpp +++ b/src/FLD/pair_lubricateU.cpp @@ -108,14 +108,11 @@ PairLubricateU::~PairLubricateU() void PairLubricateU::compute(int eflag, int vflag) { - int i,j,ii,jj,inum,jnum,itype,jtype; + int i,j; double **x = atom->x; - double **v = atom->v; double **f = atom->f; - double **omega = atom->omega; double **torque = atom->torque; - int *type = atom->type; int nlocal = atom->nlocal; int nghost = atom->nghost; int nall = nlocal + nghost; @@ -185,7 +182,7 @@ void PairLubricateU::compute(int eflag, int vflag) void PairLubricateU::stage_one() { - int i,j,ii,jj,inum,jnum,itype,jtype; + int i,j,ii,inum,itype; double **x = atom->x; double **v = atom->v; @@ -193,17 +190,12 @@ void PairLubricateU::stage_one() double **omega = atom->omega; double **torque = atom->torque; double *radius = atom->radius; - double *rmass = atom->rmass; int *type = atom->type; - int nlocal = atom->nlocal; int newton_pair = force->newton_pair; - double vxmu2f = force->vxmu2f; - double inv_inertia,mo_inertia; int *ilist; double radi; - int nprocs = comm->nprocs; inum = list->inum; ilist = list->ilist; @@ -399,23 +391,19 @@ void PairLubricateU::intermediates(int nall, double **xl) void PairLubricateU::stage_two(double **x) { - int i,j,ii,jj,inum,jnum,itype,jtype; + int i,j,ii,inum,jnum,itype; double **v = atom->v; double **f = atom->f; double **omega = atom->omega; double **torque = atom->torque; double *radius = atom->radius; - double *rmass = atom->rmass; int *type = atom->type; int nlocal = atom->nlocal; int newton_pair = force->newton_pair; - double vxmu2f = force->vxmu2f; - double inv_inertia,mo_inertia; int *ilist; double radi; - int nprocs = comm->nprocs; inum = list->inum; ilist = list->ilist; @@ -583,11 +571,10 @@ void PairLubricateU::stage_two(double **x) void PairLubricateU::compute_Fh(double **x) { int i,j,ii,jj,inum,jnum,itype,jtype; - double xtmp,ytmp,ztmp,delx,dely,delz,fpair,fx,fy,fz,tx,ty,tz; - double rsq,r,h_sep,radi,tfmag; + double xtmp,ytmp,ztmp,delx,dely,delz,fx,fy,fz; + double rsq,r,h_sep,radi; double vr1,vr2,vr3,vnnr,vn1,vn2,vn3; - double vt1,vt2,vt3,wdotn,wt1,wt2,wt3; - double inv_inertia; + double vt1,vt2,vt3; int *ilist,*jlist,*numneigh,**firstneigh; double **v = atom->v; @@ -602,7 +589,7 @@ void PairLubricateU::compute_Fh(double **x) double vxmu2f = force->vxmu2f; int overlaps = 0; - double vi[3],vj[3],wi[3],wj[3],xl[3],a_sq,a_sh,a_pu,Fbmag,del,delmin,eta; + double vi[3],vj[3],wi[3],wj[3],xl[3],a_sq,a_sh,a_pu,del; inum = list->inum; ilist = list->ilist; @@ -820,11 +807,10 @@ void PairLubricateU::compute_Fh(double **x) void PairLubricateU::compute_RU() { int i,j,ii,jj,inum,jnum,itype,jtype; - double xtmp,ytmp,ztmp,delx,dely,delz,fpair,fx,fy,fz,tx,ty,tz; - double rsq,r,h_sep,radi,tfmag; + double xtmp,ytmp,ztmp,delx,dely,delz,fx,fy,fz,tx,ty,tz; + double rsq,r,h_sep,radi; double vr1,vr2,vr3,vnnr,vn1,vn2,vn3; double vt1,vt2,vt3,wdotn,wt1,wt2,wt3; - double inv_inertia; int *ilist,*jlist,*numneigh,**firstneigh; double **x = atom->x; @@ -833,7 +819,6 @@ void PairLubricateU::compute_RU() double **omega = atom->omega; double **torque = atom->torque; double *radius = atom->radius; - double *rmass = atom->rmass; int *type = atom->type; int nlocal = atom->nlocal; int nghost = atom->nghost; @@ -841,7 +826,7 @@ void PairLubricateU::compute_RU() double vxmu2f = force->vxmu2f; int overlaps = 0; - double vi[3],vj[3],wi[3],wj[3],xl[3],a_sq,a_sh,a_pu,Fbmag,del,delmin,eta; + double vi[3],vj[3],wi[3],wj[3],xl[3],a_sq,a_sh,a_pu; inum = list->inum; ilist = list->ilist; @@ -1099,8 +1084,8 @@ void PairLubricateU::compute_RU() void PairLubricateU::compute_RU(double **x) { int i,j,ii,jj,inum,jnum,itype,jtype; - double xtmp,ytmp,ztmp,delx,dely,delz,fpair,fx,fy,fz,tx,ty,tz; - double rsq,r,h_sep,radi,tfmag; + double xtmp,ytmp,ztmp,delx,dely,delz,fx,fy,fz,tx,ty,tz; + double rsq,r,h_sep,radi; double vr1,vr2,vr3,vnnr,vn1,vn2,vn3; double vt1,vt2,vt3,wdotn,wt1,wt2,wt3; double inv_inertia; @@ -1118,7 +1103,7 @@ void PairLubricateU::compute_RU(double **x) double vxmu2f = force->vxmu2f; int overlaps = 0; - double vi[3],vj[3],wi[3],wj[3],xl[3],a_sq,a_sh,a_pu,Fbmag,del,delmin,eta; + double vi[3],vj[3],wi[3],wj[3],xl[3],a_sq,a_sh,a_pu; inum = list->inum; ilist = list->ilist; @@ -1379,27 +1364,24 @@ void PairLubricateU::compute_RU(double **x) void PairLubricateU::compute_RE() { int i,j,ii,jj,inum,jnum,itype,jtype; - double xtmp,ytmp,ztmp,delx,dely,delz,fpair,fx,fy,fz,tx,ty,tz; + double xtmp,ytmp,ztmp,delx,dely,delz,fx,fy,fz,tx,ty,tz; double rsq,r,h_sep,radi,tfmag; double vr1,vr2,vr3,vnnr,vn1,vn2,vn3; double vt1,vt2,vt3; - double inv_inertia; int *ilist,*jlist,*numneigh,**firstneigh; double **x = atom->x; - double **v = atom->v; double **f = atom->f; double **omega = atom->omega; double **torque = atom->torque; double *radius = atom->radius; int *type = atom->type; int nlocal = atom->nlocal; - int nghost = atom->nghost; int newton_pair = force->newton_pair; double vxmu2f = force->vxmu2f; int overlaps = 0; - double vi[3],vj[3],wi[3],wj[3],xl[3],a_sq,a_sh,a_pu,Fbmag,del,delmin,eta; + double wi[3],wj[3],xl[3],a_sq,a_sh,a_pu; inum = list->inum; ilist = list->ilist; @@ -1561,26 +1543,23 @@ void PairLubricateU::compute_RE() void PairLubricateU::compute_RE(double **x) { int i,j,ii,jj,inum,jnum,itype,jtype; - double xtmp,ytmp,ztmp,delx,dely,delz,fpair,fx,fy,fz,tx,ty,tz; - double rsq,r,h_sep,radi,tfmag; + double xtmp,ytmp,ztmp,delx,dely,delz,fx,fy,fz,tx,ty,tz; + double rsq,r,h_sep,radi; double vr1,vr2,vr3,vnnr,vn1,vn2,vn3; double vt1,vt2,vt3; double inv_inertia; int *ilist,*jlist,*numneigh,**firstneigh; - double **v = atom->v; double **f = atom->f; - double **omega = atom->omega; double **torque = atom->torque; double *radius = atom->radius; int *type = atom->type; int nlocal = atom->nlocal; - int nghost = atom->nghost; int newton_pair = force->newton_pair; double vxmu2f = force->vxmu2f; int overlaps = 0; - double vi[3],vj[3],wi[3],wj[3],xl[3],a_sq,a_sh,a_pu,Fbmag,del,delmin,eta; + double xl[3],a_sq,a_sh,a_pu; if (!flagHI) return; diff --git a/src/KSPACE/pppm.cpp b/src/KSPACE/pppm.cpp index ff96de54f4..06083b5136 100644 --- a/src/KSPACE/pppm.cpp +++ b/src/KSPACE/pppm.cpp @@ -1316,7 +1316,6 @@ double PPPM::final_accuracy() double xprd = domain->xprd; double yprd = domain->yprd; double zprd = domain->zprd; - double zprd_slab = zprd*slab_volfactor; bigint natoms = atom->natoms; double df_kspace = compute_df_kspace(); @@ -3361,7 +3360,7 @@ void PPPM::poisson_groups(int BA_flag) void PPPM::poisson_groups_triclinic() { - int i,j,k,n; + int i,n; // reuse memory (already declared) diff --git a/src/POEMS/fix_poems.cpp b/src/POEMS/fix_poems.cpp index 7bc3f11e2b..da26048e10 100644 --- a/src/POEMS/fix_poems.cpp +++ b/src/POEMS/fix_poems.cpp @@ -909,7 +909,7 @@ void FixPOEMS::readfile(char *file) if (ptr == NULL || ptr[0] == '#') continue; ptr = strtok(NULL," ,\t\n\0"); - while (ptr = strtok(NULL," ,\t\n\0")) { + while ((ptr = strtok(NULL," ,\t\n\0"))) { id = atoi(ptr); i = atom->map(id); if (i < 0 || i >= nlocal) continue; diff --git a/src/RIGID/fix_rigid_small.cpp b/src/RIGID/fix_rigid_small.cpp index f86a5f1eb3..748a4d4bf8 100644 --- a/src/RIGID/fix_rigid_small.cpp +++ b/src/RIGID/fix_rigid_small.cpp @@ -63,7 +63,7 @@ enum{FULL_BODY,INITIAL,FINAL,FORCE_TORQUE,VCM_ANGMOM,XCM_MASS,ITENSOR,DOF}; FixRigidSmall::FixRigidSmall(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg) { - int i,ibody; + int i; scalar_flag = 1; extscalar = 0; @@ -271,7 +271,7 @@ int FixRigidSmall::setmask() void FixRigidSmall::init() { - int i,ibody; + int i; triclinic = domain->triclinic; @@ -592,7 +592,7 @@ void FixRigidSmall::post_force(int vflag) void FixRigidSmall::final_integrate() { int i,ibody; - double dtfm,xy,xz,yz; + double dtfm; //check(3); @@ -782,7 +782,6 @@ void FixRigidSmall::pre_neighbor() tagint *image = atom->image; int nlocal = atom->nlocal; - int ibody; tagint idim,otherdims; for (int i = 0; i < nlocal; i++) { @@ -939,7 +938,6 @@ void FixRigidSmall::deform(int flag) void FixRigidSmall::set_xv() { - int ibody,itype; int xbox,ybox,zbox; double x0,x1,x2,v0,v1,v2,fc0,fc1,fc2,massone; double ione[3],exone[3],eyone[3],ezone[3],vr[6],p[3][3]; @@ -1107,9 +1105,7 @@ void FixRigidSmall::set_xv() void FixRigidSmall::set_v() { - int ibody,itype; int xbox,ybox,zbox; - double dx,dy,dz; double x0,x1,x2,v0,v1,v2,fc0,fc1,fc2,massone; double ione[3],exone[3],eyone[3],ezone[3],delta[3],vr[6]; @@ -1529,7 +1525,7 @@ void FixRigidSmall::ring_farthest(int n, char *cbuf) void FixRigidSmall::setup_bodies() { - int i,itype,ibody; + int i,ibody; // extended = 1 if any particle in a rigid body is finite size // or has a dipole moment @@ -1679,7 +1675,7 @@ void FixRigidSmall::setup_bodies() for (ibody = 0; ibody < nlocal_body+nghost_body; ibody++) for (i = 0; i < 6; i++) itensor[ibody][i] = 0.0; - double dx,dy,dz,rad; + double dx,dy,dz; double *inertia; for (i = 0; i < nlocal; i++) { @@ -1959,8 +1955,6 @@ void FixRigidSmall::setup_bodies() // error check that re-computed momemts of inertia match diagonalized ones - double *inew; - double norm; for (ibody = 0; ibody < nlocal_body; ibody++) { inertia = body[ibody].inertia; @@ -2172,8 +2166,6 @@ int FixRigidSmall::pack_comm(int n, int *list, double *buf, int i,j; double *xcm,*vcm,*quat,*omega,*ex_space,*ey_space,*ez_space; - int nlocal = atom->nlocal; - int m = 0; if (commflag == INITIAL) { @@ -2248,7 +2240,7 @@ int FixRigidSmall::pack_comm(int n, int *list, double *buf, void FixRigidSmall::unpack_comm(int n, int first, double *buf) { - int i,j,last,flag; + int i,j,last; double *xcm,*vcm,*quat,*omega,*ex_space,*ey_space,*ez_space; int m = 0; @@ -2401,9 +2393,6 @@ void FixRigidSmall::unpack_reverse_comm(int n, int *list, double *buf) int i,j,k; double *fcm,*torque,*vcm,*angmom,*xcm; - int *tag = atom->tag; - int nlocal = atom->nlocal; - int m = 0; if (commflag == FORCE_TORQUE) { diff --git a/src/USER-EFF/fix_nvt_sllod_eff.cpp b/src/USER-EFF/fix_nvt_sllod_eff.cpp index 4aecdd4fde..95e52c1403 100644 --- a/src/USER-EFF/fix_nvt_sllod_eff.cpp +++ b/src/USER-EFF/fix_nvt_sllod_eff.cpp @@ -100,7 +100,7 @@ void FixNVTSllodEff::nh_v_temp() // calculate temperature since some computes require temp // computed on current nlocal atoms to remove bias - if (nondeformbias) double tmp = temperature->compute_scalar(); + if (nondeformbias) temperature->compute_scalar(); double **v = atom->v; double *ervel = atom->ervel; diff --git a/src/USER-MISC/angle_cosine_shift_exp.cpp b/src/USER-MISC/angle_cosine_shift_exp.cpp index ee4c014b10..2941293be7 100644 --- a/src/USER-MISC/angle_cosine_shift_exp.cpp +++ b/src/USER-MISC/angle_cosine_shift_exp.cpp @@ -303,7 +303,6 @@ double AngleCosineShiftExp::single(int type, int i1, int i2, int i3) double s=sqrt(1.0-c*c); double cccpsss=c*cost[type]+s*sint[type]; - double cssmscc=c*sint[type]-s*cost[type]; if (doExpansion[type]) { diff --git a/src/USER-MISC/angle_dipole.cpp b/src/USER-MISC/angle_dipole.cpp index 0762cf24fc..2d1b7eb3ef 100644 --- a/src/USER-MISC/angle_dipole.cpp +++ b/src/USER-MISC/angle_dipole.cpp @@ -52,7 +52,7 @@ void AngleDipole::compute(int eflag, int vflag) int iRef,iDip,iDummy,n,type; double delx,dely,delz; double eangle,tangle,f1[3],f3[3]; - double r,dr,cosGamma,deltaGamma,kdg,rmu; + double r,cosGamma,deltaGamma,kdg,rmu; eangle = 0.0; if (eflag || vflag) ev_setup(eflag,vflag); diff --git a/src/USER-REAXC/reaxc_bond_orders.cpp b/src/USER-REAXC/reaxc_bond_orders.cpp index 297fb8fbfc..cffbb45723 100644 --- a/src/USER-REAXC/reaxc_bond_orders.cpp +++ b/src/USER-REAXC/reaxc_bond_orders.cpp @@ -554,7 +554,6 @@ void Add_dBond_to_Forces( reax_system *system, int i, int pj, int pk, k, j; /* Virial Tallying variables */ - real f_scaler; rvec fi_tmp, fj_tmp, fk_tmp, delij, delji, delki, delkj, temp; /* Initializations */ diff --git a/src/USER-REAXC/reaxc_tool_box.cpp b/src/USER-REAXC/reaxc_tool_box.cpp index bee7bb6efe..46935aa311 100644 --- a/src/USER-REAXC/reaxc_tool_box.cpp +++ b/src/USER-REAXC/reaxc_tool_box.cpp @@ -388,7 +388,7 @@ int Allocate_Tokenizer_Space( char **line, char **backup, char ***tokens ) int Tokenize( char* s, char*** tok ) { char test[MAX_LINE]; - char *sep = "\t \n!="; + const char *sep = (const char *)"\t \n!="; char *word; int count=0; diff --git a/src/USER-SPH/fix_meso_stationary.cpp b/src/USER-SPH/fix_meso_stationary.cpp index 101b2639f1..d61edcfc20 100644 --- a/src/USER-SPH/fix_meso_stationary.cpp +++ b/src/USER-SPH/fix_meso_stationary.cpp @@ -75,7 +75,6 @@ void FixMesoStationary::initial_integrate(int vflag) { double *e = atom->e; double *de = atom->de; - int *type = atom->type; int *mask = atom->mask; int nlocal = atom->nlocal; int i; @@ -99,9 +98,7 @@ void FixMesoStationary::final_integrate() { double *de = atom->de; 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; diff --git a/src/body.h b/src/body.h index 606615e56e..4e36a86155 100644 --- a/src/body.h +++ b/src/body.h @@ -35,10 +35,10 @@ class Body : protected Pointers { // methods implemented by child classes - virtual int pack_comm_body(class AtomVecBody::Bonus *, double *) {return 0;} - virtual int unpack_comm_body(class AtomVecBody::Bonus *, double *) {return 0;} - virtual int pack_border_body(class AtomVecBody::Bonus *, double *) {return 0;} - virtual int unpack_border_body(class AtomVecBody::Bonus *, + virtual int pack_comm_body(struct AtomVecBody::Bonus *, double *) {return 0;} + virtual int unpack_comm_body(struct AtomVecBody::Bonus *, double *) {return 0;} + virtual int pack_border_body(struct AtomVecBody::Bonus *, double *) {return 0;} + virtual int unpack_border_body(struct AtomVecBody::Bonus *, double *) {return 0;} virtual void data_body(int, int, int, char **, char **) = 0; diff --git a/src/compute_pair_local.h b/src/compute_pair_local.h index 593f63ded5..663c3f931c 100644 --- a/src/compute_pair_local.h +++ b/src/compute_pair_local.h @@ -34,7 +34,7 @@ class ComputePairLocal : public Compute { double memory_usage(); private: - int nvalues,dflag,eflag,fflag; + int nvalues; int ncount; int *pstyle; // style of each requested output diff --git a/src/fix_ave_correlate.h b/src/fix_ave_correlate.h index 8a76674d8f..9ab563ab7e 100644 --- a/src/fix_ave_correlate.h +++ b/src/fix_ave_correlate.h @@ -46,7 +46,6 @@ class FixAveCorrelate : public Fix { int type,ave,startstep,overwrite; double prefactor; - char *title1,*title2,*title3; long filepos; int firstindex; // index in values ring of earliest time sample diff --git a/src/fix_nh.cpp b/src/fix_nh.cpp index 5fc51a8e5e..323ad57cef 100644 --- a/src/fix_nh.cpp +++ b/src/fix_nh.cpp @@ -1173,7 +1173,7 @@ void FixNH::write_restart(FILE *fp) double *list; memory->create(list,nsize,"nh:list"); - int n = pack_restart_data(list); + pack_restart_data(list); if (comm->me == 0) { int size = nsize * sizeof(double); diff --git a/src/fix_shake.cpp b/src/fix_shake.cpp index a66c8d554a..584c05a7f2 100644 --- a/src/fix_shake.cpp +++ b/src/fix_shake.cpp @@ -613,11 +613,9 @@ int FixShake::dof(int igroup) void FixShake::find_clusters() { int i,j,m,n; - int flag,flag_all,messtag,loop,nbuf,nbufmax,size; + int flag,flag_all,messtag,nbuf,nbufmax,size; double massone; - int *buf,*bufcopy; - MPI_Request request; - MPI_Status status; + int *buf; if (me == 0 && screen) fprintf(screen,"Finding SHAKE clusters ...\n"); diff --git a/src/irregular.cpp b/src/irregular.cpp index 656aa33870..373a21a518 100644 --- a/src/irregular.cpp +++ b/src/irregular.cpp @@ -193,7 +193,6 @@ int Irregular::migrate_check() // this check needs to observe PBC // cannot check via comm->procneigh since it ignores PBC - AtomVec *avec = atom->avec; double **x = atom->x; int nlocal = atom->nlocal; diff --git a/src/neigh_respa.cpp b/src/neigh_respa.cpp index 8d1ea14ae5..41ee06c9e2 100644 --- a/src/neigh_respa.cpp +++ b/src/neigh_respa.cpp @@ -112,7 +112,7 @@ void Neighbor::respa_nsq_no_newton(NeighList *list) if (molecular) { which = find_special(special[i],nspecial[i],tag[j]); if (which == 0) neighptr[n++] = j; - else if (minchange = domain->minimum_image_check(delx,dely,delz)) + else if ((minchange = domain->minimum_image_check(delx,dely,delz))) neighptr[n++] = j; else if (which > 0) neighptr[n++] = j ^ (which << SBBITS); } else neighptr[n++] = j; @@ -272,7 +272,7 @@ void Neighbor::respa_nsq_newton(NeighList *list) if (molecular) { which = find_special(special[i],nspecial[i],tag[j]); if (which == 0) neighptr[n++] = j; - else if (minchange = domain->minimum_image_check(delx,dely,delz)) + else if ((minchange = domain->minimum_image_check(delx,dely,delz))) neighptr[n++] = j; else if (which > 0) neighptr[n++] = j ^ (which << SBBITS); } else neighptr[n++] = j; @@ -424,7 +424,7 @@ void Neighbor::respa_bin_no_newton(NeighList *list) if (molecular) { which = find_special(special[i],nspecial[i],tag[j]); if (which == 0) neighptr[n++] = j; - else if (minchange = domain->minimum_image_check(delx,dely,delz)) + else if ((minchange = domain->minimum_image_check(delx,dely,delz))) neighptr[n++] = j; else if (which > 0) neighptr[n++] = j ^ (which << SBBITS); } else neighptr[n++] = j; @@ -580,7 +580,7 @@ void Neighbor::respa_bin_newton(NeighList *list) if (molecular) { which = find_special(special[i],nspecial[i],tag[j]); if (which == 0) neighptr[n++] = j; - else if (minchange = domain->minimum_image_check(delx,dely,delz)) + else if ((minchange = domain->minimum_image_check(delx,dely,delz))) neighptr[n++] = j; else if (which > 0) neighptr[n++] = j ^ (which << SBBITS); } else neighptr[n++] = j; @@ -618,7 +618,7 @@ void Neighbor::respa_bin_newton(NeighList *list) if (molecular) { which = find_special(special[i],nspecial[i],tag[j]); if (which == 0) neighptr[n++] = j; - else if (minchange = domain->minimum_image_check(delx,dely,delz)) + else if ((minchange = domain->minimum_image_check(delx,dely,delz))) neighptr[n++] = j; else if (which > 0) neighptr[n++] = j ^ (which << SBBITS); } else neighptr[n++] = j; @@ -779,7 +779,7 @@ void Neighbor::respa_bin_newton_tri(NeighList *list) if (molecular) { which = find_special(special[i],nspecial[i],tag[j]); if (which == 0) neighptr[n++] = j; - else if (minchange = domain->minimum_image_check(delx,dely,delz)) + else if ((minchange = domain->minimum_image_check(delx,dely,delz))) neighptr[n++] = j; else if (which > 0) neighptr[n++] = j ^ (which << SBBITS); } else neighptr[n++] = j; diff --git a/src/neigh_stencil.cpp b/src/neigh_stencil.cpp index a39ebf66bb..4c0320a180 100644 --- a/src/neigh_stencil.cpp +++ b/src/neigh_stencil.cpp @@ -63,7 +63,7 @@ void Neighbor::stencil_half_bin_2d_no_newton(NeighList *list, void Neighbor::stencil_half_ghost_bin_2d_no_newton(NeighList *list, int sx, int sy, int sz) { - int i,j,k; + int i,j; int *stencil = list->stencil; int **stencilxyz = list->stencilxyz; int nstencil = 0; diff --git a/src/pair_coul_dsf.cpp b/src/pair_coul_dsf.cpp index 5cb156ea8d..12c3f58ea5 100644 --- a/src/pair_coul_dsf.cpp +++ b/src/pair_coul_dsf.cpp @@ -298,11 +298,12 @@ double PairCoulDSF::single(int i, int j, int itype, int jtype, double rsq, double factor_coul, double factor_lj, double &fforce) { - double r2inv,r6inv,r,erfcc,erfcd,prefactor,t; - double forcecoul,phicoul,philj; + double r2inv,r,erfcc,erfcd,prefactor,t; + double forcecoul,phicoul; r2inv = 1.0/rsq; + double eng = 0.0; if (rsq < cut_coulsq) { r = sqrt(rsq); prefactor = factor_coul * force->qqrd2e * atom->q[i]*atom->q[j]/r; @@ -312,16 +313,13 @@ double PairCoulDSF::single(int i, int j, int itype, int jtype, double rsq, forcecoul = prefactor * (erfcc/r + 2.0*alpha/MY_PIS*erfcd + r*f_shift) * r; + + phicoul = prefactor * (erfcc - r*e_shift - rsq*f_shift); + eng += phicoul; } else forcecoul = 0.0; fforce = forcecoul * r2inv; - double eng = 0.0; - if (r < cut_coulsq) { - phicoul = prefactor * (erfcc - r*e_shift - rsq*f_shift); - eng += phicoul; - } - return eng; } diff --git a/src/write_restart.cpp b/src/write_restart.cpp index 77f2bed05f..ce6c4b9626 100644 --- a/src/write_restart.cpp +++ b/src/write_restart.cpp @@ -82,7 +82,7 @@ void WriteRestart::command(int narg, char **arg) int n = strlen(arg[0]) + 16; char *file = new char[n]; - if (ptr = strchr(arg[0],'*')) { + if ((ptr = strchr(arg[0],'*'))) { *ptr = '\0'; sprintf(file,"%s" BIGINT_FORMAT "%s",arg[0],update->ntimestep,ptr+1); } else strcpy(file,arg[0]);