fix segfault with pair style sw/intel

This commit is contained in:
Axel Kohlmeyer
2021-08-02 15:49:26 -04:00
parent 50e8d7c36b
commit b7be9415de

View File

@ -1277,6 +1277,7 @@ template <class flt_t>
void PairSWIntel::ForceConst<flt_t>::set_ntypes(const int ntypes,
Memory *memory,
const int cop) {
if (memory != nullptr) _memory = memory;
if (ntypes != _ntypes) {
if (_ntypes > 0) {
fc_packed0 *op2 = p2[0];
@ -1293,19 +1294,19 @@ void PairSWIntel::ForceConst<flt_t>::set_ntypes(const int ntypes,
}
#endif
memory->destroy(p2);
memory->destroy(p2f);
memory->destroy(p2f2);
memory->destroy(p2e);
memory->destroy(p3);
_memory->destroy(p2);
_memory->destroy(p2f);
_memory->destroy(p2f2);
_memory->destroy(p2e);
_memory->destroy(p3);
}
if (ntypes > 0) {
_cop = cop;
memory->create(p2,ntypes,ntypes,"fc.p2");
memory->create(p2f,ntypes,ntypes,"fc.p2f");
memory->create(p2f2,ntypes,ntypes,"fc.p2f2");
memory->create(p2e,ntypes,ntypes,"fc.p2e");
memory->create(p3,ntypes,ntypes,ntypes,"fc.p3");
_memory->create(p2,ntypes,ntypes,"fc.p2");
_memory->create(p2f,ntypes,ntypes,"fc.p2f");
_memory->create(p2f2,ntypes,ntypes,"fc.p2f2");
_memory->create(p2e,ntypes,ntypes,"fc.p2e");
_memory->create(p3,ntypes,ntypes,ntypes,"fc.p3");
#ifdef _LMP_INTEL_OFFLOAD
fc_packed0 *op2 = p2[0];
@ -1325,5 +1326,4 @@ void PairSWIntel::ForceConst<flt_t>::set_ntypes(const int ntypes,
}
}
_ntypes = ntypes;
_memory = memory;
}