diff --git a/source/api_cc/src/commonPT.cc b/source/api_cc/src/commonPT.cc index 345220323b..4ed3b21fe8 100644 --- a/source/api_cc/src/commonPT.cc +++ b/source/api_cc/src/commonPT.cc @@ -12,7 +12,7 @@ void NeighborListDataPT::copy_from_nlist(const InputNlist& inlist, max_num_neighbors = *max_element; unsigned long nlist_size = (unsigned long)inum * max_num_neighbors; jlist.resize(nlist_size); - memset(&jlist[0], -1, nlist_size * sizeof(int)); + jlist.assign(nlist_size, -1); for (int ii = 0; ii < inum; ++ii) { int jnum = inlist.numneigh[ii]; numneigh[ii] = inlist.numneigh[ii];