zero out fix external local data when allocated to avoid uninitialized data access
This commit is contained in:
@ -65,6 +65,7 @@ FixExternal::FixExternal(LAMMPS *lmp, int narg, char **arg) :
|
||||
atom->add_callback(Atom::GROW);
|
||||
|
||||
user_energy = 0.0;
|
||||
memset(user_virial, 0, sizeof(user_virial));
|
||||
|
||||
// optional vector of values provided by caller
|
||||
// vector_flag and size_vector are setup via set_vector_length()
|
||||
@ -321,6 +322,7 @@ double FixExternal::memory_usage()
|
||||
void FixExternal::grow_arrays(int nmax)
|
||||
{
|
||||
memory->grow(fexternal,nmax,3,"external:fexternal");
|
||||
memset(&fexternal[0][0], 0, sizeof(double)*3*nmax);
|
||||
}
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
|
||||
Reference in New Issue
Block a user