more typecasts to double to avoid 32-bit int overflows when computing memory usage

This commit is contained in:
Axel Kohlmeyer
2021-02-03 20:28:40 -05:00
parent 49ea762300
commit 95e2214d96
147 changed files with 147 additions and 147 deletions

View File

@ -462,6 +462,6 @@ void ComputeAcklandAtom::select2(int k, int n, double *arr, int *iarr)
double ComputeAcklandAtom::memory_usage()
{
double bytes = nmax * sizeof(double);
double bytes = (double)nmax * sizeof(double);
return bytes;
}

View File

@ -323,7 +323,7 @@ void ComputeCNPAtom::compute_peratom()
double ComputeCNPAtom::memory_usage()
{
double bytes = nmax * sizeof(int);
double bytes = (double)nmax * sizeof(int);
bytes += (double)nmax * MAXNEAR * sizeof(int);
bytes += (double)nmax * sizeof(double);
return bytes;

View File

@ -497,6 +497,6 @@ void ComputeHMA::set_arrays(int i)
double ComputeHMA::memory_usage()
{
double bytes = nmax * 3 * sizeof(double);
double bytes = (double)nmax * 3 * sizeof(double);
return bytes;
}

View File

@ -294,6 +294,6 @@ void ComputeTempRotate::restore_bias_all()
double ComputeTempRotate::memory_usage()
{
double bytes = maxbias * sizeof(double);
double bytes = (double)maxbias * sizeof(double);
return bytes;
}

View File

@ -455,7 +455,7 @@ void FixFFL::reset_dt() {
------------------------------------------------------------------------- */
double FixFFL::memory_usage() {
double bytes = atom->nmax*(3*2)*sizeof(double);
double bytes = (double)atom->nmax*(3*2)*sizeof(double);
return bytes;
}

View File

@ -762,7 +762,7 @@ void FixGLE::reset_dt()
double FixGLE::memory_usage()
{
double bytes = atom->nmax*(3*ns+2*3*(ns+1))*sizeof(double);
double bytes = (double)atom->nmax*(3*ns+2*3*(ns+1))*sizeof(double);
return bytes;
}

View File

@ -474,7 +474,7 @@ void FixOrientECO::unpack_forward_comm(int n, int first, double *buf) {
------------------------------------------------------------------------- */
double FixOrientECO::memory_usage() {
double bytes = nmax * sizeof(Nbr);
double bytes = (double)nmax * sizeof(Nbr);
bytes += (double)2 * nmax * sizeof(double);
return bytes;
}

View File

@ -130,7 +130,7 @@ int FixPropelSelf::setmask()
double FixPropelSelf::memory_usage()
{
// magnitude + thermostat_orient + mode + n_types_filter + apply_to_type
double bytes = sizeof(double) + 3*sizeof(int) + sizeof(int*);
double bytes = (double)sizeof(double) + 3*sizeof(int) + sizeof(int*);
bytes += (double)sizeof(int)*atom->ntypes*n_types_filter;
return bytes;

View File

@ -379,7 +379,7 @@ void FixSRP::pre_exchange()
double FixSRP::memory_usage()
{
double bytes = atom->nmax*2 * sizeof(double);
double bytes = (double)atom->nmax*2 * sizeof(double);
return bytes;
}

View File

@ -261,7 +261,7 @@ double FixTISpring::compute_vector(int n)
double FixTISpring::memory_usage()
{
double bytes = atom->nmax*3 * sizeof(double);
double bytes = (double)atom->nmax*3 * sizeof(double);
return bytes;
}

View File

@ -409,7 +409,7 @@ double PairList::init_one(int, int)
double PairList::memory_usage()
{
double bytes = npairs * sizeof(int);
double bytes = (double)npairs * sizeof(int);
bytes += (double)npairs * sizeof(list_parm_t);
const int n = atom->ntypes+1;
bytes += (double)n*(n*sizeof(int) + sizeof(int *));

View File

@ -881,7 +881,7 @@ void PairLocalDensity::unpack_reverse_comm(int n, int *list, double *buf) {
double PairLocalDensity::memory_usage()
{
double bytes = maxeatom * sizeof(double);
double bytes = (double)maxeatom * sizeof(double);
bytes += (double)maxvatom*6 * sizeof(double);
bytes += (double)2 * (nmax*nLD) * sizeof(double);
return bytes;