avoid integer overflow when computing memory usage
This commit is contained in:
@ -289,6 +289,5 @@ void PairVashishtaTable::create_tables()
|
|||||||
|
|
||||||
double PairVashishtaTable::memory_usage()
|
double PairVashishtaTable::memory_usage()
|
||||||
{
|
{
|
||||||
double bytes = 2*nelements*nelements*sizeof(double)*ntable;
|
return (double)2*nelements*nelements*sizeof(double)*ntable;
|
||||||
return bytes;
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -2452,8 +2452,8 @@ double FixRigid::memory_usage()
|
|||||||
bytes += (double)maxvatom*6 * sizeof(double); // vatom
|
bytes += (double)maxvatom*6 * sizeof(double); // vatom
|
||||||
if (extended) {
|
if (extended) {
|
||||||
bytes += (double)nmax * sizeof(int);
|
bytes += (double)nmax * sizeof(int);
|
||||||
if (orientflag) bytes = nmax*orientflag * sizeof(double);
|
if (orientflag) bytes = (double)nmax*orientflag * sizeof(double);
|
||||||
if (dorientflag) bytes = nmax*3 * sizeof(double);
|
if (dorientflag) bytes = (double)nmax*3 * sizeof(double);
|
||||||
}
|
}
|
||||||
return bytes;
|
return bytes;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -3564,8 +3564,8 @@ double FixRigidSmall::memory_usage()
|
|||||||
bytes += (double)maxvatom*6 * sizeof(double); // vatom
|
bytes += (double)maxvatom*6 * sizeof(double); // vatom
|
||||||
if (extended) {
|
if (extended) {
|
||||||
bytes += (double)nmax * sizeof(int);
|
bytes += (double)nmax * sizeof(int);
|
||||||
if (orientflag) bytes = nmax*orientflag * sizeof(double);
|
if (orientflag) bytes = (double)nmax*orientflag * sizeof(double);
|
||||||
if (dorientflag) bytes = nmax*3 * sizeof(double);
|
if (dorientflag) bytes = (double)nmax*3 * sizeof(double);
|
||||||
}
|
}
|
||||||
bytes += (double)nmax_body * sizeof(Body);
|
bytes += (double)nmax_body * sizeof(Body);
|
||||||
return bytes;
|
return bytes;
|
||||||
|
|||||||
@ -702,8 +702,8 @@ double FixAveCorrelateLong::memory_usage() {
|
|||||||
// f: npair x numcorrelators x p
|
// f: npair x numcorrelators x p
|
||||||
double bytes = (4*npair*numcorrelators*p + 2*npair*numcorrelators
|
double bytes = (4*npair*numcorrelators*p + 2*npair*numcorrelators
|
||||||
+ numcorrelators*p)*sizeof(double)
|
+ numcorrelators*p)*sizeof(double)
|
||||||
+ numcorrelators*p*sizeof(unsigned long int)
|
+ (double)numcorrelators*p*sizeof(unsigned long int)
|
||||||
+ 2*numcorrelators*sizeof(unsigned int);
|
+ 2.0*numcorrelators*sizeof(unsigned int);
|
||||||
return bytes;
|
return bytes;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -726,9 +726,7 @@ void FixPIMD::unpack_forward_comm(int n, int first, double *buf)
|
|||||||
|
|
||||||
double FixPIMD::memory_usage()
|
double FixPIMD::memory_usage()
|
||||||
{
|
{
|
||||||
double bytes = 0;
|
return (double)atom->nmax * size_peratom_cols * sizeof(double);
|
||||||
bytes = atom->nmax * size_peratom_cols * sizeof(double);
|
|
||||||
return bytes;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ---------------------------------------------------------------------- */
|
/* ---------------------------------------------------------------------- */
|
||||||
|
|||||||
Reference in New Issue
Block a user