diff --git a/src/INTEL/pair_buck_coul_cut_intel.cpp b/src/INTEL/pair_buck_coul_cut_intel.cpp index 9181b15aae..2633fd4ab2 100644 --- a/src/INTEL/pair_buck_coul_cut_intel.cpp +++ b/src/INTEL/pair_buck_coul_cut_intel.cpp @@ -504,7 +504,8 @@ void PairBuckCoulCutIntel::ForceConst::set_ntypes(const int ntypes, const int ntable, Memory *memory, const int cop) { - if ((ntypes != _ntypes || ntable != _ntable)) { + if (memory != nullptr) _memory = memory; + if ((ntypes != _ntypes) || (ntable != _ntable)) { if (_ntypes > 0) { #ifdef _LMP_INTEL_OFFLOAD flt_t * ospecial_lj = special_lj; @@ -526,13 +527,12 @@ void PairBuckCoulCutIntel::ForceConst::set_ntypes(const int ntypes, _memory->destroy(c_force); _memory->destroy(c_energy); _memory->destroy(c_cut); - } if (ntypes > 0) { _cop = cop; - memory->create(c_force,ntypes,ntypes,"fc.c_force"); - memory->create(c_energy,ntypes,ntypes,"fc.c_energy"); - memory->create(c_cut,ntypes,ntypes,"fc.c_cut"); + _memory->create(c_force,ntypes,ntypes,"fc.c_force"); + _memory->create(c_energy,ntypes,ntypes,"fc.c_energy"); + _memory->create(c_cut,ntypes,ntypes,"fc.c_cut"); #ifdef _LMP_INTEL_OFFLOAD @@ -558,5 +558,4 @@ void PairBuckCoulCutIntel::ForceConst::set_ntypes(const int ntypes, } _ntypes=ntypes; _ntable=ntable; - _memory=memory; } diff --git a/src/INTEL/pair_buck_coul_long_intel.cpp b/src/INTEL/pair_buck_coul_long_intel.cpp index fdf78ff5d9..d9d618e4a8 100644 --- a/src/INTEL/pair_buck_coul_long_intel.cpp +++ b/src/INTEL/pair_buck_coul_long_intel.cpp @@ -615,7 +615,8 @@ void PairBuckCoulLongIntel::ForceConst::set_ntypes(const int ntypes, const int ntable, Memory *memory, const int cop) { - if ((ntypes != _ntypes || ntable != _ntable)) { + if (memory != nullptr) _memory = memory; + if ((ntypes != _ntypes) || (ntable != _ntable)) { if (_ntypes > 0) { #ifdef _LMP_INTEL_OFFLOAD flt_t * ospecial_lj = special_lj; @@ -652,14 +653,14 @@ void PairBuckCoulLongIntel::ForceConst::set_ntypes(const int ntypes, } if (ntypes > 0) { _cop = cop; - memory->create(c_force,ntypes,ntypes,"fc.c_force"); - memory->create(c_energy,ntypes,ntypes,"fc.c_energy"); - memory->create(rho_inv,ntypes,ntypes,"fc.rho_inv"); - memory->create(table,ntable,"pair:fc.table"); - memory->create(etable,ntable,"pair:fc.etable"); - memory->create(detable,ntable,"pair:fc.detable"); - memory->create(ctable,ntable,"pair:fc.ctable"); - memory->create(dctable,ntable,"pair:fc.dctable"); + _memory->create(c_force,ntypes,ntypes,"fc.c_force"); + _memory->create(c_energy,ntypes,ntypes,"fc.c_energy"); + _memory->create(rho_inv,ntypes,ntypes,"fc.rho_inv"); + _memory->create(table,ntable,"pair:fc.table"); + _memory->create(etable,ntable,"pair:fc.etable"); + _memory->create(detable,ntable,"pair:fc.detable"); + _memory->create(ctable,ntable,"pair:fc.ctable"); + _memory->create(dctable,ntable,"pair:fc.dctable"); #ifdef _LMP_INTEL_OFFLOAD flt_t * ospecial_lj = special_lj; @@ -692,7 +693,6 @@ void PairBuckCoulLongIntel::ForceConst::set_ntypes(const int ntypes, } _ntypes=ntypes; _ntable=ntable; - _memory=memory; } diff --git a/src/INTEL/pair_buck_intel.cpp b/src/INTEL/pair_buck_intel.cpp index f15669e1d3..9bad314fcf 100644 --- a/src/INTEL/pair_buck_intel.cpp +++ b/src/INTEL/pair_buck_intel.cpp @@ -455,6 +455,7 @@ template void PairBuckIntel::ForceConst::set_ntypes(const int ntypes, Memory *memory, const int cop) { + if (memory != nullptr) _memory = memory; if ((ntypes != _ntypes )) { if (_ntypes > 0) { #ifdef _LMP_INTEL_OFFLOAD @@ -477,9 +478,8 @@ void PairBuckIntel::ForceConst::set_ntypes(const int ntypes, } if (ntypes > 0) { _cop = cop; - memory->create(c_force,ntypes,ntypes,"fc.c_force"); - memory->create(c_energy,ntypes,ntypes,"fc.c_energy"); - + _memory->create(c_force,ntypes,ntypes,"fc.c_force"); + _memory->create(c_energy,ntypes,ntypes,"fc.c_energy"); #ifdef _LMP_INTEL_OFFLOAD flt_t * ospecial_lj = special_lj; @@ -499,7 +499,6 @@ void PairBuckIntel::ForceConst::set_ntypes(const int ntypes, } } _ntypes=ntypes; - _memory=memory; } diff --git a/src/INTEL/pair_dpd_intel.cpp b/src/INTEL/pair_dpd_intel.cpp index b69473fbbf..e6ffd1ca44 100644 --- a/src/INTEL/pair_dpd_intel.cpp +++ b/src/INTEL/pair_dpd_intel.cpp @@ -558,6 +558,7 @@ void PairDPDIntel::ForceConst::set_ntypes(const int ntypes, const int max_nbors, Memory *memory, const int cop) { + if (memory != nullptr) _memory = memory; if (ntypes != _ntypes) { if (_ntypes > 0) { _memory->destroy(param); @@ -566,15 +567,14 @@ void PairDPDIntel::ForceConst::set_ntypes(const int ntypes, } if (ntypes > 0) { _cop = cop; - memory->create(param,ntypes,ntypes,"fc.param"); - memory->create(rand_buffer_thread, nthreads, max_nbors, + _memory->create(param,ntypes,ntypes,"fc.param"); + _memory->create(rand_buffer_thread, nthreads, max_nbors, "fc.rand_buffer_thread"); - memory->create(rngi,nthreads,"fc.param"); + _memory->create(rngi,nthreads,"fc.param"); for (int i = 0; i < nthreads; i++) rngi[i] = max_nbors; } } _ntypes = ntypes; - _memory = memory; } /* ---------------------------------------------------------------------- diff --git a/src/INTEL/pair_eam_intel.cpp b/src/INTEL/pair_eam_intel.cpp index 911a623d6d..8a42e6bbaa 100644 --- a/src/INTEL/pair_eam_intel.cpp +++ b/src/INTEL/pair_eam_intel.cpp @@ -781,7 +781,8 @@ void PairEAMIntel::ForceConst::set_ntypes(const int ntypes, const int nr, const int nrho, Memory *memory, const int cop) { - if (ntypes != _ntypes || nr + 1 > _nr || nrho + 1 > _nrho) { + if (memory != nullptr) _memory = memory; + if ((ntypes != _ntypes) || (nr + 1 > _nr) || (nrho + 1 > _nrho)) { if (_ntypes > 0) { _memory->destroy(rhor_spline_f); _memory->destroy(rhor_spline_e); @@ -794,18 +795,17 @@ void PairEAMIntel::ForceConst::set_ntypes(const int ntypes, _cop = cop; _nr = nr + 1; IP_PRE_edge_align(_nr, sizeof(flt_t)); - memory->create(rhor_spline_f,ntypes*ntypes*_nr,"fc.rhor_spline_f"); - memory->create(rhor_spline_e,ntypes*ntypes*_nr,"fc.rhor_spline_e"); - memory->create(z2r_spline_t,ntypes*ntypes*_nr,"fc.z2r_spline_t"); + _memory->create(rhor_spline_f,ntypes*ntypes*_nr,"fc.rhor_spline_f"); + _memory->create(rhor_spline_e,ntypes*ntypes*_nr,"fc.rhor_spline_e"); + _memory->create(z2r_spline_t,ntypes*ntypes*_nr,"fc.z2r_spline_t"); _nrho = nrho + 1; IP_PRE_edge_align(_nrho, sizeof(flt_t)); - memory->create(frho_spline_f,ntypes*_nrho,"fc.frho_spline_f"); - memory->create(frho_spline_e,ntypes*_nrho,"fc.frho_spline_e"); - memory->create(scale_f,ntypes,ntypes,"fc.scale_f"); + _memory->create(frho_spline_f,ntypes*_nrho,"fc.frho_spline_f"); + _memory->create(frho_spline_e,ntypes*_nrho,"fc.frho_spline_e"); + _memory->create(scale_f,ntypes,ntypes,"fc.scale_f"); } } _ntypes = ntypes; - _memory = memory; } /* ---------------------------------------------------------------------- */ diff --git a/src/INTEL/pair_gayberne_intel.cpp b/src/INTEL/pair_gayberne_intel.cpp index 285dd9661b..139792e543 100644 --- a/src/INTEL/pair_gayberne_intel.cpp +++ b/src/INTEL/pair_gayberne_intel.cpp @@ -990,6 +990,7 @@ void PairGayBerneIntel::ForceConst::set_ntypes(const int ntypes, const int nthreads, Memory *memory, const int cop) { + if (memory != nullptr) _memory = memory; if (ntypes != _ntypes) { if (_ntypes > 0) { fc_packed3 *oic = ic; @@ -1029,15 +1030,15 @@ void PairGayBerneIntel::ForceConst::set_ntypes(const int ntypes, if (ntypes > 0) { _cop = cop; - memory->create(ijc, ntypes, ntypes, "fc.ijc"); - memory->create(lj34, ntypes, ntypes, "fc.lj34"); - memory->create(ic, ntypes, "fc.ic"); - memory->create(rsq_form, nthreads, one_length, "rsq_form"); - memory->create(delx_form, nthreads, one_length, "delx_form"); - memory->create(dely_form, nthreads, one_length, "dely_form"); - memory->create(delz_form, nthreads, one_length, "delz_form"); - memory->create(jtype_form, nthreads, one_length, "jtype_form"); - memory->create(jlist_form, nthreads, one_length, "jlist_form"); + _memory->create(ijc, ntypes, ntypes, "fc.ijc"); + _memory->create(lj34, ntypes, ntypes, "fc.lj34"); + _memory->create(ic, ntypes, "fc.ic"); + _memory->create(rsq_form, nthreads, one_length, "rsq_form"); + _memory->create(delx_form, nthreads, one_length, "delx_form"); + _memory->create(dely_form, nthreads, one_length, "dely_form"); + _memory->create(delz_form, nthreads, one_length, "delz_form"); + _memory->create(jtype_form, nthreads, one_length, "jtype_form"); + _memory->create(jlist_form, nthreads, one_length, "jlist_form"); for (int zn = 0; zn < nthreads; zn++) for (int zo = 0; zo < one_length; zo++) { @@ -1082,5 +1083,4 @@ void PairGayBerneIntel::ForceConst::set_ntypes(const int ntypes, } } _ntypes = ntypes; - _memory = memory; } diff --git a/src/INTEL/pair_lj_charmm_coul_charmm_intel.cpp b/src/INTEL/pair_lj_charmm_coul_charmm_intel.cpp index 3a7ab5276e..23e357516f 100644 --- a/src/INTEL/pair_lj_charmm_coul_charmm_intel.cpp +++ b/src/INTEL/pair_lj_charmm_coul_charmm_intel.cpp @@ -559,6 +559,7 @@ void PairLJCharmmCoulCharmmIntel::pack_force_const(ForceConst &fc, template void PairLJCharmmCoulCharmmIntel::ForceConst::set_ntypes( const int ntypes, Memory *memory, const int cop) { + if (memory != nullptr) _memory = memory; if (ntypes != _ntypes) { if (_ntypes > 0) { #ifdef _LMP_INTEL_OFFLOAD @@ -579,8 +580,8 @@ void PairLJCharmmCoulCharmmIntel::ForceConst::set_ntypes( } if (ntypes > 0) { _cop = cop; - memory->create(cutsq,ntypes,ntypes,"fc.cutsq"); - memory->create(lj,ntypes,ntypes,"fc.lj"); + _memory->create(cutsq,ntypes,ntypes,"fc.cutsq"); + _memory->create(lj,ntypes,ntypes,"fc.lj"); #ifdef _LMP_INTEL_OFFLOAD flt_t * ospecial_lj = special_lj; @@ -599,5 +600,4 @@ void PairLJCharmmCoulCharmmIntel::ForceConst::set_ntypes( } } _ntypes=ntypes; - _memory=memory; } diff --git a/src/INTEL/pair_lj_charmm_coul_long_intel.cpp b/src/INTEL/pair_lj_charmm_coul_long_intel.cpp index 8a4595dd99..696f5948ac 100644 --- a/src/INTEL/pair_lj_charmm_coul_long_intel.cpp +++ b/src/INTEL/pair_lj_charmm_coul_long_intel.cpp @@ -654,7 +654,8 @@ void PairLJCharmmCoulLongIntel::ForceConst::set_ntypes(const int ntypes, const int ntable, Memory *memory, const int cop) { - if ((ntypes != _ntypes || ntable != _ntable)) { + if (memory != nullptr) _memory = memory; + if ((ntypes != _ntypes) || (ntable != _ntable)) { if (_ntypes > 0) { #ifdef _LMP_INTEL_OFFLOAD flt_t * ospecial_lj = special_lj; @@ -688,13 +689,13 @@ void PairLJCharmmCoulLongIntel::ForceConst::set_ntypes(const int ntypes, } if (ntypes > 0) { _cop = cop; - memory->create(cutsq,ntypes,ntypes,"fc.cutsq"); - memory->create(lj,ntypes,ntypes,"fc.lj"); - memory->create(table,ntable,"pair:fc.table"); - memory->create(etable,ntable,"pair:fc.etable"); - memory->create(detable,ntable,"pair:fc.detable"); - memory->create(ctable,ntable,"pair:fc.ctable"); - memory->create(dctable,ntable,"pair:fc.dctable"); + _memory->create(cutsq,ntypes,ntypes,"fc.cutsq"); + _memory->create(lj,ntypes,ntypes,"fc.lj"); + _memory->create(table,ntable,"pair:fc.table"); + _memory->create(etable,ntable,"pair:fc.etable"); + _memory->create(detable,ntable,"pair:fc.detable"); + _memory->create(ctable,ntable,"pair:fc.ctable"); + _memory->create(dctable,ntable,"pair:fc.dctable"); #ifdef _LMP_INTEL_OFFLOAD flt_t * ospecial_lj = special_lj; @@ -724,5 +725,4 @@ void PairLJCharmmCoulLongIntel::ForceConst::set_ntypes(const int ntypes, } _ntypes=ntypes; _ntable=ntable; - _memory=memory; } diff --git a/src/INTEL/pair_lj_cut_coul_long_intel.cpp b/src/INTEL/pair_lj_cut_coul_long_intel.cpp index a53d74f72a..f78f579a9a 100644 --- a/src/INTEL/pair_lj_cut_coul_long_intel.cpp +++ b/src/INTEL/pair_lj_cut_coul_long_intel.cpp @@ -610,7 +610,8 @@ void PairLJCutCoulLongIntel::ForceConst::set_ntypes(const int ntypes, const int ntable, Memory *memory, const int cop) { - if ((ntypes != _ntypes || ntable != _ntable)) { + if (memory != nullptr) _memory = memory; + if ((ntypes != _ntypes) || (ntable != _ntable)) { if (_ntypes > 0) { #ifdef _LMP_INTEL_OFFLOAD flt_t * ospecial_lj = special_lj; @@ -644,13 +645,13 @@ void PairLJCutCoulLongIntel::ForceConst::set_ntypes(const int ntypes, } if (ntypes > 0) { _cop = cop; - memory->create(c_force,ntypes,ntypes,"fc.c_force"); - memory->create(c_energy,ntypes,ntypes,"fc.c_energy"); - memory->create(table,ntable,"pair:fc.table"); - memory->create(etable,ntable,"pair:fc.etable"); - memory->create(detable,ntable,"pair:fc.detable"); - memory->create(ctable,ntable,"pair:fc.ctable"); - memory->create(dctable,ntable,"pair:fc.dctable"); + _memory->create(c_force,ntypes,ntypes,"fc.c_force"); + _memory->create(c_energy,ntypes,ntypes,"fc.c_energy"); + _memory->create(table,ntable,"pair:fc.table"); + _memory->create(etable,ntable,"pair:fc.etable"); + _memory->create(detable,ntable,"pair:fc.detable"); + _memory->create(ctable,ntable,"pair:fc.ctable"); + _memory->create(dctable,ntable,"pair:fc.dctable"); #ifdef _LMP_INTEL_OFFLOAD flt_t * ospecial_lj = special_lj; @@ -681,5 +682,4 @@ void PairLJCutCoulLongIntel::ForceConst::set_ntypes(const int ntypes, } _ntypes=ntypes; _ntable=ntable; - _memory=memory; } diff --git a/src/INTEL/pair_lj_cut_intel.cpp b/src/INTEL/pair_lj_cut_intel.cpp index 133b6079a1..afd01e9919 100644 --- a/src/INTEL/pair_lj_cut_intel.cpp +++ b/src/INTEL/pair_lj_cut_intel.cpp @@ -471,6 +471,7 @@ template void PairLJCutIntel::ForceConst::set_ntypes(const int ntypes, Memory *memory, const int cop) { + if (memory != nullptr) _memory = memory; if (ntypes != _ntypes) { if (_ntypes > 0) { _memory->destroy(ljc12o); @@ -478,10 +479,9 @@ void PairLJCutIntel::ForceConst::set_ntypes(const int ntypes, } if (ntypes > 0) { _cop = cop; - memory->create(ljc12o,ntypes,ntypes,"fc.c12o"); - memory->create(lj34,ntypes,ntypes,"fc.lj34"); + _memory->create(ljc12o,ntypes,ntypes,"fc.c12o"); + _memory->create(lj34,ntypes,ntypes,"fc.lj34"); } } _ntypes = ntypes; - _memory = memory; } diff --git a/src/INTEL/pair_tersoff_intel.cpp b/src/INTEL/pair_tersoff_intel.cpp index 732d100927..3c963cb850 100644 --- a/src/INTEL/pair_tersoff_intel.cpp +++ b/src/INTEL/pair_tersoff_intel.cpp @@ -550,6 +550,7 @@ template void PairTersoffIntel::ForceConst::set_ntypes(const int ntypes, Memory *memory, const int cop) { + if (memory != nullptr) _memory = memory; if ((ntypes != _ntypes)) { if (_ntypes > 0) { #ifdef _LMP_INTEL_OFFLOAD @@ -581,13 +582,13 @@ void PairTersoffIntel::ForceConst::set_ntypes(const int ntypes, _cop = cop; size_t VL = 512 / 8 / sizeof(flt_t); int ntypes_pad = ntypes + VL - ntypes % VL; - memory->create(c_first_loop,ntypes,ntypes,"fc.c_first_loop"); - memory->create(c_second_loop,ntypes,ntypes,"fc.c_second_loop"); - memory->create(c_cutoff_outer,ntypes,ntypes,"fc.c_cutoff_outer"); - memory->create(c_inner_loop,ntypes,ntypes,ntypes,"fc.c_inner_loop"); - memory->create(c_cutoff_inner,ntypes,ntypes,ntypes_pad,"fc.c_cutoff_inner"); - memory->create(c_inner,ntypes,ntypes,ntypes,"fc.c_inner"); - memory->create(c_outer,ntypes,ntypes,"fc.c_outer"); + _memory->create(c_first_loop,ntypes,ntypes,"fc.c_first_loop"); + _memory->create(c_second_loop,ntypes,ntypes,"fc.c_second_loop"); + _memory->create(c_cutoff_outer,ntypes,ntypes,"fc.c_cutoff_outer"); + _memory->create(c_inner_loop,ntypes,ntypes,ntypes,"fc.c_inner_loop"); + _memory->create(c_cutoff_inner,ntypes,ntypes,ntypes_pad,"fc.c_cutoff_inner"); + _memory->create(c_inner,ntypes,ntypes,ntypes,"fc.c_inner"); + _memory->create(c_outer,ntypes,ntypes,"fc.c_outer"); #ifdef _LMP_INTEL_OFFLOAD c_first_loop_t * oc_first_loop = c_first_loop[0]; c_second_loop_t * oc_second_loop = c_second_loop[0]; @@ -614,7 +615,6 @@ void PairTersoffIntel::ForceConst::set_ntypes(const int ntypes, } } _ntypes=ntypes; - _memory=memory; } #ifdef _LMP_INTEL_OFFLOAD