diff --git a/lib/gpu/lal_pppm.cpp b/lib/gpu/lal_pppm.cpp index 87ab6fe775..bbdaf76036 100644 --- a/lib/gpu/lal_pppm.cpp +++ b/lib/gpu/lal_pppm.cpp @@ -54,7 +54,7 @@ int PPPMT::bytes_per_atom() const { } template -grdtyp * PPPMT::init(const int nlocal, const int nall, FILE *_screen, +grdtyp *PPPMT::init(const int nlocal, const int nall, FILE *_screen, const int order, const int nxlo_out, const int nylo_out, const int nzlo_out, const int nxhi_out, const int nyhi_out, @@ -69,14 +69,14 @@ grdtyp * PPPMT::init(const int nlocal, const int nall, FILE *_screen, flag=device->init(*ans,nlocal,nall); if (flag!=0) - return 0; + return nullptr; if (sizeof(grdtyp)==sizeof(double) && device->double_precision()==false) { flag=-15; - return 0; + return nullptr; } if (device->ptx_arch()>0.0 && device->ptx_arch()<1.1) { flag=-4; - return 0; + return nullptr; } ucl_device=device->gpu; diff --git a/src/compute_bond_local.cpp b/src/compute_bond_local.cpp index 275924d0e5..8818f15fb7 100644 --- a/src/compute_bond_local.cpp +++ b/src/compute_bond_local.cpp @@ -221,7 +221,7 @@ void ComputeBondLocal::compute_local() int ComputeBondLocal::compute_bonds(int flag) { - int i,m,n,nb,atom1,atom2,imol,iatom,btype,ivar; + int i,m,nb,atom1,atom2,imol,iatom,btype,ivar; tagint tagprev; double dx,dy,dz,rsq; double mass1,mass2,masstotal,invmasstotal; @@ -261,7 +261,7 @@ int ComputeBondLocal::compute_bonds(int flag) // loop over all atoms and their bonds - m = n = 0; + m = 0; for (atom1 = 0; atom1 < nlocal; atom1++) { if (!(mask[atom1] & groupbit)) continue; @@ -304,6 +304,8 @@ int ComputeBondLocal::compute_bonds(int flag) } else { if (singleflag) engpot = bond->single(btype,rsq,atom1,atom2,fbond); + else fbond = engpot = 0.0; + engvib = engrot = engtrans = omegasq = vvib = 0.0; if (velflag) { if (rmass) { @@ -383,7 +385,7 @@ int ComputeBondLocal::compute_bonds(int flag) if (dstr) input->variable->internal_set(dvar,sqrt(rsq)); } - for (n = 0; n < nvalues; n++) { + for (int n = 0; n < nvalues; n++) { switch (bstyle[n]) { case DIST: ptr[n] = sqrt(rsq); diff --git a/src/utils.cpp b/src/utils.cpp index 7262cf8afd..866b3773d1 100644 --- a/src/utils.cpp +++ b/src/utils.cpp @@ -583,8 +583,8 @@ int utils::expand_args(const char *file, int line, int narg, char **arg, int mod // split off the compute/fix/property ID, the wildcard and trailing text - size_t first = word.find("["); - size_t second = word.find("]", first + 1); + size_t first = word.find('['); + size_t second = word.find(']', first + 1); if (word[1] == '2') id = word.substr(3, first - 3); else