Merge branch 'fix-valgrind-issues' of github.com:akohlmey/lammps into fix-valgrind-issues

This commit is contained in:
Axel Kohlmeyer
2021-08-04 12:25:12 -04:00
6 changed files with 37 additions and 12 deletions

View File

@ -30,6 +30,7 @@ class Pair : protected Pointers {
friend class FixOMP;
friend class FixQEq;
friend class PairHybrid;
friend class PairHybridScaled;
friend class ThrOMP;
friend class Info;

View File

@ -569,7 +569,7 @@ void PairHybrid::init_style()
// same style must not be used multiple times
for (istyle = 0; istyle < nstyles; istyle++) {
bool is_gpu = (((PairHybrid *)styles[istyle])->suffix_flag & Suffix::GPU);
bool is_gpu = styles[istyle]->suffix_flag & Suffix::GPU;
if (multiple[istyle] && is_gpu)
error->all(FLERR,"GPU package styles must not be used multiple times");
}

View File

@ -340,8 +340,7 @@ void PairHybridScaled::settings(int narg, char **arg)
special_lj[nstyles] = special_coul[nstyles] = nullptr;
compute_tally[nstyles] = 1;
if ((((PairHybridScaled *)styles[nstyles])->suffix_flag
& (Suffix::INTEL|Suffix::GPU|Suffix::OMP)) != 0)
if ((styles[nstyles]->suffix_flag & (Suffix::INTEL|Suffix::GPU|Suffix::OMP)) != 0)
error->all(FLERR,"Pair style hybrid/scaled does not support "
"accelerator styles");

View File

@ -5122,7 +5122,7 @@ int VarReader::read_scalar(char *str)
if (n == 1) continue; // skip if blank line
break;
}
memmove(str,ptr,n); // move trimmed string back
if (n > 0) memmove(str,ptr,n); // move trimmed string back
}
MPI_Bcast(&n,1,MPI_INT,0,world);
if (n == 0) return 1;