small tweaks from static code analysis

This commit is contained in:
Axel Kohlmeyer
2021-09-15 19:50:52 -04:00
parent fef8f51d80
commit 7196a295a6
3 changed files with 11 additions and 9 deletions

View File

@ -54,7 +54,7 @@ int PPPMT::bytes_per_atom() const {
}
template <class numtyp, class acctyp, class grdtyp, class grdtyp4>
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;

View File

@ -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);

View File

@ -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