correct calls to memset()

This commit is contained in:
Axel Kohlmeyer
2022-01-21 06:55:06 -05:00
parent e73158bd7e
commit 9c8431bf87
6 changed files with 6 additions and 9 deletions

View File

@ -211,6 +211,8 @@ FixGLE::FixGLE(LAMMPS *lmp, int narg, char **arg) :
S = new double[ns1sq];
TT = new double[ns1sq];
ST = new double[ns1sq];
memset(A,0,sizeof(double)*ns1sq);
memset(C,0,sizeof(double)*ns1sq);
// start temperature (t ramp)
t_start = utils::numeric(FLERR,arg[4],false,lmp);
@ -223,7 +225,6 @@ FixGLE::FixGLE(LAMMPS *lmp, int narg, char **arg) :
// LOADING A matrix
char *fname = arg[7];
memset(A, ns1sq, sizeof(double));
if (comm->me == 0) {
PotentialFileReader reader(lmp,fname,"fix gle A matrix");
try {
@ -256,14 +257,12 @@ FixGLE::FixGLE(LAMMPS *lmp, int narg, char **arg) :
if (fnoneq == 0) {
t_target=t_start;
const double kT = t_target * force->boltz / force->mvv2e;
memset(C,0,sizeof(double)*ns1sq);
for (int i=0; i<ns1sq; i+=(ns+2))
C[i]=kT;
} else {
// LOADING C matrix
memset(C, ns1sq, sizeof(double));
if (comm->me == 0) {
PotentialFileReader reader(lmp,fname,"fix gle C matrix");
try {

View File

@ -99,7 +99,7 @@ void PairE3B::compute(int eflag, int vflag)
ev_init(eflag, vflag);
//clear sumExp array
memset(sumExp, 0.0, nbytes);
memset(sumExp, 0, sizeof(double)*maxID);
evdwl = 0.0;
pvector[0] = pvector[1] = pvector[2] = pvector[3] = 0.0;
@ -364,7 +364,6 @@ void PairE3B::allocateE3B()
maxID = find_maxID();
if (!natoms) error->all(FLERR, "No atoms found");
memory->create(sumExp, maxID, "pair:sumExp");
nbytes = sizeof(double) * maxID;
}
/* ----------------------------------------------------------------------

View File

@ -50,7 +50,6 @@ class PairE3B : public Pair {
int **pairO, ***pairH; // pair lists
double ***exps, ****del3, ***fpair3, *sumExp;
int maxID; //size of global sumExp array
size_t nbytes; //size of sumExp array in bytes
int natoms; //to make sure number of atoms is constant
virtual void allocate();

View File

@ -637,7 +637,7 @@ void FixCMAP::read_grid_map(char *cmapfile)
{
if (comm->me == 0) {
try {
memset(&cmapgrid[0][0][0], 6*CMAPDIM*CMAPDIM, sizeof(double));
memset(&cmapgrid[0][0][0], 0, 6*CMAPDIM*CMAPDIM*sizeof(double));
PotentialFileReader reader(lmp, cmapfile, "cmap grid");
// there are six maps in this order.

View File

@ -429,7 +429,7 @@ void FixACKS2ReaxFF::compute_X()
double **x = atom->x;
int *mask = atom->mask;
memset(X_diag,0.0,atom->nmax*sizeof(double));
memset(X_diag,0,atom->nmax*sizeof(double));
// fill in the X matrix
m_fill = 0;

View File

@ -1084,7 +1084,7 @@ void FixQEqReaxFF::vector_add(double* dest, double c, double* v, int k)
void FixQEqReaxFF::get_chi_field()
{
memset(&chi_field[0],0.0,atom->nmax*sizeof(double));
memset(&chi_field[0],0,atom->nmax*sizeof(double));
if (!efield) return;
const double * const *x = (const double * const *)atom->x;