use consistent names, avoid memory leaks, fix off-by-1 error in fourier dihedral
This commit is contained in:
@ -363,13 +363,12 @@ void AngleCharmmIntel::pack_force_const(ForceConst<flt_t> &fc,
|
||||
template <class flt_t>
|
||||
void AngleCharmmIntel::ForceConst<flt_t>::set_ntypes(const int nangletypes,
|
||||
Memory *memory) {
|
||||
if (memory != nullptr) _memory = memory;
|
||||
if (nangletypes != _nangletypes) {
|
||||
if (_nangletypes > 0)
|
||||
_memory->destroy(fc);
|
||||
_memory->destroy(fc);
|
||||
|
||||
if (nangletypes > 0)
|
||||
_memory->create(fc,nangletypes,"anglecharmmintel.fc");
|
||||
}
|
||||
_nangletypes = nangletypes;
|
||||
_memory = memory;
|
||||
}
|
||||
|
||||
@ -60,7 +60,7 @@ class AngleCharmmIntel : public AngleCharmm {
|
||||
} fc_packed1;
|
||||
|
||||
fc_packed1 *fc;
|
||||
ForceConst() : _nangletypes(0) {}
|
||||
ForceConst() : fc(nullptr), _nangletypes(0) {}
|
||||
~ForceConst() { set_ntypes(0, nullptr); }
|
||||
|
||||
void set_ntypes(const int nangletypes, Memory *memory);
|
||||
|
||||
@ -343,13 +343,11 @@ void AngleHarmonicIntel::pack_force_const(ForceConst<flt_t> &fc,
|
||||
template <class flt_t>
|
||||
void AngleHarmonicIntel::ForceConst<flt_t>::set_ntypes(const int nangletypes,
|
||||
Memory *memory) {
|
||||
if (memory != nullptr) _memory = memory;
|
||||
if (nangletypes != _nangletypes) {
|
||||
if (_nangletypes > 0)
|
||||
_memory->destroy(fc);
|
||||
|
||||
_memory->destroy(fc);
|
||||
if (nangletypes > 0)
|
||||
_memory->create(fc,nangletypes,"anglecharmmintel.fc");
|
||||
}
|
||||
_nangletypes = nangletypes;
|
||||
_memory = memory;
|
||||
}
|
||||
|
||||
@ -60,7 +60,7 @@ class AngleHarmonicIntel : public AngleHarmonic {
|
||||
} fc_packed1;
|
||||
|
||||
fc_packed1 *fc;
|
||||
ForceConst() : _nangletypes(0) {}
|
||||
ForceConst() : fc(nullptr), _nangletypes(0) {}
|
||||
~ForceConst() { set_ntypes(0, nullptr); }
|
||||
|
||||
void set_ntypes(const int nangletypes, Memory *memory);
|
||||
|
||||
@ -323,13 +323,12 @@ void BondFENEIntel::pack_force_const(ForceConst<flt_t> &fc,
|
||||
template <class flt_t>
|
||||
void BondFENEIntel::ForceConst<flt_t>::set_ntypes(const int nbondtypes,
|
||||
Memory *memory) {
|
||||
if (memory != nullptr) _memory = memory;
|
||||
if (nbondtypes != _nbondtypes) {
|
||||
if (_nbondtypes > 0)
|
||||
_memory->destroy(fc);
|
||||
_memory->destroy(fc);
|
||||
|
||||
if (nbondtypes > 0)
|
||||
_memory->create(fc,nbondtypes,"bondfeneintel.fc");
|
||||
}
|
||||
_nbondtypes = nbondtypes;
|
||||
_memory = memory;
|
||||
}
|
||||
|
||||
@ -60,7 +60,7 @@ class BondFENEIntel : public BondFENE {
|
||||
} fc_packed1;
|
||||
fc_packed1 *fc;
|
||||
|
||||
ForceConst() : _nbondtypes(0) {}
|
||||
ForceConst() : fc(nullptr), _nbondtypes(0) {}
|
||||
~ForceConst() { set_ntypes(0, nullptr); }
|
||||
|
||||
void set_ntypes(const int nbondtypes, Memory *memory);
|
||||
|
||||
@ -291,13 +291,12 @@ void BondHarmonicIntel::pack_force_const(ForceConst<flt_t> &fc,
|
||||
template <class flt_t>
|
||||
void BondHarmonicIntel::ForceConst<flt_t>::set_ntypes(const int nbondtypes,
|
||||
Memory *memory) {
|
||||
if (memory != nullptr) _memory = memory;
|
||||
if (nbondtypes != _nbondtypes) {
|
||||
if (_nbondtypes > 0)
|
||||
_memory->destroy(fc);
|
||||
_memory->destroy(fc);
|
||||
|
||||
if (nbondtypes > 0)
|
||||
_memory->create(fc,nbondtypes,"bondharmonicintel.fc");
|
||||
}
|
||||
_nbondtypes = nbondtypes;
|
||||
_memory = memory;
|
||||
}
|
||||
|
||||
@ -60,7 +60,7 @@ class BondHarmonicIntel : public BondHarmonic {
|
||||
} fc_packed1;
|
||||
fc_packed1 *fc;
|
||||
|
||||
ForceConst() : _nbondtypes(0) {}
|
||||
ForceConst() : fc(nullptr), _nbondtypes(0) {}
|
||||
~ForceConst() { set_ntypes(0, nullptr); }
|
||||
|
||||
void set_ntypes(const int nbondtypes, Memory *memory);
|
||||
|
||||
@ -261,10 +261,10 @@ void DihedralCharmmIntel::eval(const int vflag,
|
||||
if (c > (flt_t)1.0) c = (flt_t)1.0;
|
||||
if (c < (flt_t)-1.0) c = (flt_t)-1.0;
|
||||
|
||||
const flt_t tcos_shift = fc.bp[type].cos_shift;
|
||||
const flt_t tsin_shift = fc.bp[type].sin_shift;
|
||||
const flt_t tk = fc.bp[type].k;
|
||||
const int m = fc.bp[type].multiplicity;
|
||||
const flt_t tcos_shift = fc.fc[type].cos_shift;
|
||||
const flt_t tsin_shift = fc.fc[type].sin_shift;
|
||||
const flt_t tk = fc.fc[type].k;
|
||||
const int m = fc.fc[type].multiplicity;
|
||||
|
||||
flt_t p = (flt_t)1.0;
|
||||
flt_t ddf1, df1;
|
||||
@ -539,10 +539,10 @@ void DihedralCharmmIntel::eval(const int vflag,
|
||||
(int *) neighbor->dihedrallist[0];
|
||||
const flt_t * _noalias const weight = &(fc.weight[0]);
|
||||
const flt_t * _noalias const x_f = &(x[0].x);
|
||||
const flt_t * _noalias const cos_shift = &(fc.bp[0].cos_shift);
|
||||
const flt_t * _noalias const sin_shift = &(fc.bp[0].sin_shift);
|
||||
const flt_t * _noalias const k = &(fc.bp[0].k);
|
||||
const int * _noalias const multiplicity = &(fc.bp[0].multiplicity);
|
||||
const flt_t * _noalias const cos_shift = &(fc.fc[0].cos_shift);
|
||||
const flt_t * _noalias const sin_shift = &(fc.fc[0].sin_shift);
|
||||
const flt_t * _noalias const k = &(fc.fc[0].k);
|
||||
const int * _noalias const multiplicity = &(fc.fc[0].multiplicity);
|
||||
const flt_t * _noalias const plj1 = &(fc.ljp[0][0].lj1);
|
||||
const flt_t * _noalias const plj2 = &(fc.ljp[0][0].lj2);
|
||||
const flt_t * _noalias const plj3 = &(fc.ljp[0][0].lj3);
|
||||
@ -937,8 +937,8 @@ void DihedralCharmmIntel::pack_force_const(ForceConst<flt_t> &fc,
|
||||
{
|
||||
|
||||
const int tp1 = atom->ntypes + 1;
|
||||
const int bp1 = atom->ndihedraltypes + 1;
|
||||
fc.set_ntypes(tp1,bp1,memory);
|
||||
const int dp1 = atom->ndihedraltypes + 1;
|
||||
fc.set_ntypes(tp1,dp1,memory);
|
||||
buffers->set_ntypes(tp1);
|
||||
|
||||
if (weightflag) {
|
||||
@ -952,11 +952,11 @@ void DihedralCharmmIntel::pack_force_const(ForceConst<flt_t> &fc,
|
||||
}
|
||||
}
|
||||
|
||||
for (int i = 1; i < bp1; i++) {
|
||||
fc.bp[i].multiplicity = multiplicity[i];
|
||||
fc.bp[i].cos_shift = cos_shift[i];
|
||||
fc.bp[i].sin_shift = sin_shift[i];
|
||||
fc.bp[i].k = k[i];
|
||||
for (int i = 1; i < dp1; i++) {
|
||||
fc.fc[i].multiplicity = multiplicity[i];
|
||||
fc.fc[i].cos_shift = cos_shift[i];
|
||||
fc.fc[i].sin_shift = sin_shift[i];
|
||||
fc.fc[i].k = k[i];
|
||||
fc.weight[i] = weight[i];
|
||||
}
|
||||
}
|
||||
@ -965,27 +965,24 @@ void DihedralCharmmIntel::pack_force_const(ForceConst<flt_t> &fc,
|
||||
|
||||
template <class flt_t>
|
||||
void DihedralCharmmIntel::ForceConst<flt_t>::set_ntypes(const int npairtypes,
|
||||
const int nbondtypes,
|
||||
const int ndihderaltypes,
|
||||
Memory *memory) {
|
||||
if (memory != nullptr) _memory = memory;
|
||||
if (npairtypes != _npairtypes) {
|
||||
if (_npairtypes > 0)
|
||||
_memory->destroy(ljp);
|
||||
_memory->destroy(ljp);
|
||||
if (npairtypes > 0)
|
||||
memory->create(ljp,npairtypes,npairtypes,"fc.ljp");
|
||||
_memory->create(ljp,npairtypes,npairtypes,"fc.ljp");
|
||||
}
|
||||
|
||||
if (nbondtypes != _nbondtypes) {
|
||||
if (_nbondtypes > 0) {
|
||||
_memory->destroy(bp);
|
||||
_memory->destroy(weight);
|
||||
}
|
||||
if (ndihderaltypes != _ndihderaltypes) {
|
||||
_memory->destroy(fc);
|
||||
_memory->destroy(weight);
|
||||
|
||||
if (nbondtypes > 0) {
|
||||
_memory->create(bp,nbondtypes,"dihedralcharmmintel.bp");
|
||||
_memory->create(weight,nbondtypes,"dihedralcharmmintel.weight");
|
||||
if (ndihderaltypes > 0) {
|
||||
_memory->create(fc,ndihderaltypes,"dihedralcharmmintel.fc");
|
||||
_memory->create(weight,ndihderaltypes,"dihedralcharmmintel.weight");
|
||||
}
|
||||
}
|
||||
_npairtypes = npairtypes;
|
||||
_nbondtypes = nbondtypes;
|
||||
_memory = memory;
|
||||
_ndihderaltypes = ndihderaltypes;
|
||||
}
|
||||
|
||||
@ -64,16 +64,16 @@ class DihedralCharmmIntel : public DihedralCharmm {
|
||||
} fc_packed3;
|
||||
|
||||
fc_packed1 **ljp;
|
||||
fc_packed3 *bp;
|
||||
fc_packed3 *fc;
|
||||
flt_t *weight;
|
||||
|
||||
ForceConst() : _npairtypes(0), _nbondtypes(0) {}
|
||||
ForceConst() : ljp(nullptr), fc(nullptr), _npairtypes(0), _ndihderaltypes(0) {}
|
||||
~ForceConst() { set_ntypes(0, 0, nullptr); }
|
||||
|
||||
void set_ntypes(const int npairtypes, const int nbondtypes, Memory *memory);
|
||||
void set_ntypes(const int npairtypes, const int ndihderaltypes, Memory *memory);
|
||||
|
||||
private:
|
||||
int _npairtypes, _nbondtypes;
|
||||
int _npairtypes, _ndihderaltypes;
|
||||
Memory *_memory;
|
||||
};
|
||||
ForceConst<float> force_const_single;
|
||||
|
||||
@ -225,10 +225,10 @@ void DihedralFourierIntel::eval(const int vflag,
|
||||
if (EFLAG) deng = (flt_t)0.0;
|
||||
|
||||
for (int j = 0; j < nterms[type]; j++) {
|
||||
const flt_t tcos_shift = fc.bp[j][type].cos_shift;
|
||||
const flt_t tsin_shift = fc.bp[j][type].sin_shift;
|
||||
const flt_t tk = fc.bp[j][type].k;
|
||||
const int m = fc.bp[j][type].multiplicity;
|
||||
const flt_t tcos_shift = fc.fc[j][type].cos_shift;
|
||||
const flt_t tsin_shift = fc.fc[j][type].sin_shift;
|
||||
const flt_t tk = fc.fc[j][type].k;
|
||||
const int m = fc.fc[j][type].multiplicity;
|
||||
|
||||
flt_t p = (flt_t)1.0;
|
||||
flt_t ddf1, df1;
|
||||
@ -394,16 +394,16 @@ template <class flt_t, class acc_t>
|
||||
void DihedralFourierIntel::pack_force_const(ForceConst<flt_t> &fc,
|
||||
IntelBuffers<flt_t,acc_t> * /*buffers*/)
|
||||
{
|
||||
const int bp1 = atom->ndihedraltypes + 1;
|
||||
fc.set_ntypes(bp1, setflag, nterms, memory);
|
||||
const int dp1 = atom->ndihedraltypes + 1;
|
||||
fc.set_ntypes(dp1, setflag, nterms, memory);
|
||||
|
||||
for (int i = 1; i < bp1; i++) {
|
||||
for (int i = 1; i < dp1; i++) {
|
||||
if (setflag[i]) {
|
||||
for (int j = 0; j < nterms[i]; j++) {
|
||||
fc.bp[j][i].cos_shift = cos_shift[i][j];
|
||||
fc.bp[j][i].sin_shift = sin_shift[i][j];
|
||||
fc.bp[j][i].k = k[i][j];
|
||||
fc.bp[j][i].multiplicity = multiplicity[i][j];
|
||||
fc.fc[j][i].cos_shift = cos_shift[i][j];
|
||||
fc.fc[j][i].sin_shift = sin_shift[i][j];
|
||||
fc.fc[j][i].k = k[i][j];
|
||||
fc.fc[j][i].multiplicity = multiplicity[i][j];
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -412,22 +412,20 @@ void DihedralFourierIntel::pack_force_const(ForceConst<flt_t> &fc,
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
template <class flt_t>
|
||||
void DihedralFourierIntel::ForceConst<flt_t>::set_ntypes(const int nbondtypes,
|
||||
void DihedralFourierIntel::ForceConst<flt_t>::set_ntypes(const int ndihedraltypes,
|
||||
int *setflag,
|
||||
int *nterms,
|
||||
Memory *memory) {
|
||||
if (nbondtypes != _nbondtypes) {
|
||||
if (_nbondtypes > 0)
|
||||
_memory->destroy(bp);
|
||||
if (memory != nullptr) _memory = memory;
|
||||
if (ndihedraltypes != _ndihedraltypes) {
|
||||
_memory->destroy(fc);
|
||||
|
||||
if (nbondtypes > 0) {
|
||||
if (ndihedraltypes > 0) {
|
||||
_maxnterms = 1;
|
||||
for (int i = 1; i <= nbondtypes; i++)
|
||||
for (int i = 1; i < ndihedraltypes; i++)
|
||||
if (setflag[i]) _maxnterms = MAX(_maxnterms, nterms[i]);
|
||||
|
||||
_memory->create(bp, _maxnterms, nbondtypes, "dihedralfourierintel.bp");
|
||||
_memory->create(fc, _maxnterms, ndihedraltypes, "dihedralfourierintel.fc");
|
||||
}
|
||||
}
|
||||
_nbondtypes = nbondtypes;
|
||||
_memory = memory;
|
||||
_ndihedraltypes = ndihedraltypes;
|
||||
}
|
||||
|
||||
@ -60,15 +60,15 @@ class DihedralFourierIntel : public DihedralFourier {
|
||||
int multiplicity;
|
||||
} fc_packed1;
|
||||
|
||||
fc_packed1 **bp;
|
||||
fc_packed1 **fc;
|
||||
|
||||
ForceConst() : _nbondtypes(0) {}
|
||||
ForceConst() : fc(nullptr), _ndihedraltypes(0) {}
|
||||
~ForceConst() { set_ntypes(0, nullptr, nullptr, nullptr); }
|
||||
|
||||
void set_ntypes(const int nbondtypes, int *setflag, int *nterms, Memory *memory);
|
||||
void set_ntypes(const int ndihedraltypes, int *setflag, int *nterms, Memory *memory);
|
||||
|
||||
private:
|
||||
int _nbondtypes, _maxnterms;
|
||||
int _ndihedraltypes, _maxnterms;
|
||||
Memory *_memory;
|
||||
};
|
||||
ForceConst<float> force_const_single;
|
||||
|
||||
@ -220,10 +220,10 @@ void DihedralHarmonicIntel::eval(const int vflag,
|
||||
if (c > (flt_t)1.0) c = (flt_t)1.0;
|
||||
if (c < (flt_t)-1.0) c = (flt_t)-1.0;
|
||||
|
||||
const flt_t tcos_shift = fc.bp[type].cos_shift;
|
||||
const flt_t tsin_shift = fc.bp[type].sin_shift;
|
||||
const flt_t tk = fc.bp[type].k;
|
||||
const int m = fc.bp[type].multiplicity;
|
||||
const flt_t tcos_shift = fc.fc[type].cos_shift;
|
||||
const flt_t tsin_shift = fc.fc[type].sin_shift;
|
||||
const flt_t tk = fc.fc[type].k;
|
||||
const int m = fc.fc[type].multiplicity;
|
||||
|
||||
flt_t p = (flt_t)1.0;
|
||||
flt_t ddf1, df1;
|
||||
@ -389,29 +389,28 @@ template <class flt_t, class acc_t>
|
||||
void DihedralHarmonicIntel::pack_force_const(ForceConst<flt_t> &fc,
|
||||
IntelBuffers<flt_t,acc_t> * /*buffers*/)
|
||||
{
|
||||
const int bp1 = atom->ndihedraltypes + 1;
|
||||
fc.set_ntypes(bp1,memory);
|
||||
const int dp1 = atom->ndihedraltypes + 1;
|
||||
fc.set_ntypes(dp1,memory);
|
||||
|
||||
for (int i = 1; i < bp1; i++) {
|
||||
fc.bp[i].multiplicity = multiplicity[i];
|
||||
fc.bp[i].cos_shift = cos_shift[i];
|
||||
fc.bp[i].sin_shift = sin_shift[i];
|
||||
fc.bp[i].k = k[i];
|
||||
for (int i = 1; i < dp1; i++) {
|
||||
fc.fc[i].multiplicity = multiplicity[i];
|
||||
fc.fc[i].cos_shift = cos_shift[i];
|
||||
fc.fc[i].sin_shift = sin_shift[i];
|
||||
fc.fc[i].k = k[i];
|
||||
}
|
||||
}
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
template <class flt_t>
|
||||
void DihedralHarmonicIntel::ForceConst<flt_t>::set_ntypes(const int nbondtypes,
|
||||
void DihedralHarmonicIntel::ForceConst<flt_t>::set_ntypes(const int ndihderaltypes,
|
||||
Memory *memory) {
|
||||
if (nbondtypes != _nbondtypes) {
|
||||
if (_nbondtypes > 0)
|
||||
_memory->destroy(bp);
|
||||
if (memory != nullptr) _memory = memory;
|
||||
if (ndihderaltypes != _ndihderaltypes) {
|
||||
_memory->destroy(fc);
|
||||
|
||||
if (nbondtypes > 0)
|
||||
_memory->create(bp,nbondtypes,"dihedralcharmmintel.bp");
|
||||
if (ndihderaltypes > 0)
|
||||
_memory->create(fc,ndihderaltypes,"dihedralcharmmintel.fc");
|
||||
}
|
||||
_nbondtypes = nbondtypes;
|
||||
_memory = memory;
|
||||
_ndihderaltypes = ndihderaltypes;
|
||||
}
|
||||
|
||||
@ -60,15 +60,15 @@ class DihedralHarmonicIntel : public DihedralHarmonic {
|
||||
int multiplicity;
|
||||
} fc_packed1;
|
||||
|
||||
fc_packed1 *bp;
|
||||
fc_packed1 *fc;
|
||||
|
||||
ForceConst() : _nbondtypes(0) {}
|
||||
ForceConst() : fc(nullptr), _ndihderaltypes(0) {}
|
||||
~ForceConst() { set_ntypes(0, nullptr); }
|
||||
|
||||
void set_ntypes(const int nbondtypes, Memory *memory);
|
||||
void set_ntypes(const int ndihderaltypes, Memory *memory);
|
||||
|
||||
private:
|
||||
int _nbondtypes;
|
||||
int _ndihderaltypes;
|
||||
Memory *_memory;
|
||||
};
|
||||
ForceConst<float> force_const_single;
|
||||
|
||||
@ -264,14 +264,14 @@ void DihedralOPLSIntel::eval(const int vflag,
|
||||
const flt_t sin_4phim = (flt_t)2.0 * cos_2phi * sin_2phim;
|
||||
|
||||
flt_t p, pd;
|
||||
p = fc.bp[type].k1*((flt_t)1.0 + c) +
|
||||
fc.bp[type].k2*((flt_t)1.0 - cos_2phi) +
|
||||
fc.bp[type].k3*((flt_t)1.0 + cos_3phi) +
|
||||
fc.bp[type].k4*((flt_t)1.0 - cos_4phi) ;
|
||||
pd = fc.bp[type].k1 -
|
||||
(flt_t)2.0 * fc.bp[type].k2 * sin_2phim +
|
||||
(flt_t)3.0 * fc.bp[type].k3 * sin_3phim -
|
||||
(flt_t)4.0 * fc.bp[type].k4 * sin_4phim;
|
||||
p = fc.fc[type].k1*((flt_t)1.0 + c) +
|
||||
fc.fc[type].k2*((flt_t)1.0 - cos_2phi) +
|
||||
fc.fc[type].k3*((flt_t)1.0 + cos_3phi) +
|
||||
fc.fc[type].k4*((flt_t)1.0 - cos_4phi) ;
|
||||
pd = fc.fc[type].k1 -
|
||||
(flt_t)2.0 * fc.fc[type].k2 * sin_2phim +
|
||||
(flt_t)3.0 * fc.fc[type].k3 * sin_3phim -
|
||||
(flt_t)4.0 * fc.fc[type].k4 * sin_4phim;
|
||||
|
||||
flt_t edihed;
|
||||
if (EFLAG) edihed = p;
|
||||
@ -409,29 +409,28 @@ template <class flt_t, class acc_t>
|
||||
void DihedralOPLSIntel::pack_force_const(ForceConst<flt_t> &fc,
|
||||
IntelBuffers<flt_t,acc_t> * /*buffers*/)
|
||||
{
|
||||
const int bp1 = atom->ndihedraltypes + 1;
|
||||
fc.set_ntypes(bp1,memory);
|
||||
const int dp1 = atom->ndihedraltypes + 1;
|
||||
fc.set_ntypes(dp1,memory);
|
||||
|
||||
for (int i = 1; i < bp1; i++) {
|
||||
fc.bp[i].k1 = k1[i];
|
||||
fc.bp[i].k2 = k2[i];
|
||||
fc.bp[i].k3 = k3[i];
|
||||
fc.bp[i].k4 = k4[i];
|
||||
for (int i = 1; i < dp1; i++) {
|
||||
fc.fc[i].k1 = k1[i];
|
||||
fc.fc[i].k2 = k2[i];
|
||||
fc.fc[i].k3 = k3[i];
|
||||
fc.fc[i].k4 = k4[i];
|
||||
}
|
||||
}
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
template <class flt_t>
|
||||
void DihedralOPLSIntel::ForceConst<flt_t>::set_ntypes(const int nbondtypes,
|
||||
void DihedralOPLSIntel::ForceConst<flt_t>::set_ntypes(const int ndihderaltypes,
|
||||
Memory *memory) {
|
||||
if (nbondtypes != _nbondtypes) {
|
||||
if (_nbondtypes > 0)
|
||||
_memory->destroy(bp);
|
||||
if (memory != nullptr) _memory = memory;
|
||||
if (ndihderaltypes != _ndihderaltypes) {
|
||||
_memory->destroy(fc);
|
||||
|
||||
if (nbondtypes > 0)
|
||||
_memory->create(bp,nbondtypes,"dihedralcharmmintel.bp");
|
||||
if (ndihderaltypes > 0)
|
||||
_memory->create(fc,ndihderaltypes,"dihedralcharmmintel.fc");
|
||||
}
|
||||
_nbondtypes = nbondtypes;
|
||||
_memory = memory;
|
||||
_ndihderaltypes = ndihderaltypes;
|
||||
}
|
||||
|
||||
@ -59,15 +59,15 @@ class DihedralOPLSIntel : public DihedralOPLS {
|
||||
flt_t k1, k2, k3, k4;
|
||||
} fc_packed1;
|
||||
|
||||
fc_packed1 *bp;
|
||||
fc_packed1 *fc;
|
||||
|
||||
ForceConst() : _nbondtypes(0) {}
|
||||
ForceConst() : fc(nullptr), _ndihderaltypes(0) {}
|
||||
~ForceConst() { set_ntypes(0, nullptr); }
|
||||
|
||||
void set_ntypes(const int nbondtypes, Memory *memory);
|
||||
void set_ntypes(const int ndihderaltypes, Memory *memory);
|
||||
|
||||
private:
|
||||
int _nbondtypes;
|
||||
int _ndihderaltypes;
|
||||
Memory *_memory;
|
||||
};
|
||||
ForceConst<float> force_const_single;
|
||||
|
||||
@ -426,10 +426,10 @@ template <class flt_t, class acc_t>
|
||||
void ImproperCvffIntel::pack_force_const(ForceConst<flt_t> &fc,
|
||||
IntelBuffers<flt_t,acc_t> * /*buffers*/)
|
||||
{
|
||||
const int bp1 = atom->nimpropertypes + 1;
|
||||
fc.set_ntypes(bp1,memory);
|
||||
const int ip1 = atom->nimpropertypes + 1;
|
||||
fc.set_ntypes(ip1,memory);
|
||||
|
||||
for (int i = 1; i < bp1; i++) {
|
||||
for (int i = 1; i < ip1; i++) {
|
||||
fc.fc[i].k = k[i];
|
||||
fc.fc[i].sign = sign[i];
|
||||
fc.fc[i].multiplicity = multiplicity[i];
|
||||
@ -439,15 +439,14 @@ void ImproperCvffIntel::pack_force_const(ForceConst<flt_t> &fc,
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
template <class flt_t>
|
||||
void ImproperCvffIntel::ForceConst<flt_t>::set_ntypes(const int nimproper,
|
||||
void ImproperCvffIntel::ForceConst<flt_t>::set_ntypes(const int nimpropertypes,
|
||||
Memory *memory) {
|
||||
if (nimproper != _nimpropertypes) {
|
||||
if (_nimpropertypes > 0)
|
||||
_memory->destroy(fc);
|
||||
if (memory != nullptr) _memory = memory;
|
||||
if (nimpropertypes != _nimpropertypes) {
|
||||
_memory->destroy(fc);
|
||||
|
||||
if (nimproper > 0)
|
||||
_memory->create(fc,nimproper,"improperharmonicintel.fc");
|
||||
if (nimpropertypes > 0)
|
||||
_memory->create(fc,nimpropertypes,"improperharmonicintel.fc");
|
||||
}
|
||||
_nimpropertypes = nimproper;
|
||||
_memory = memory;
|
||||
_nimpropertypes = nimpropertypes;
|
||||
}
|
||||
|
||||
@ -62,7 +62,7 @@ class ImproperCvffIntel : public ImproperCvff {
|
||||
|
||||
fc_packed1 *fc;
|
||||
|
||||
ForceConst() : _nimpropertypes(0) {}
|
||||
ForceConst() : fc(nullptr), _nimpropertypes(0) {}
|
||||
~ForceConst() { set_ntypes(0, nullptr); }
|
||||
|
||||
void set_ntypes(const int nimpropertypes, Memory *memory);
|
||||
|
||||
@ -379,10 +379,10 @@ template <class flt_t, class acc_t>
|
||||
void ImproperHarmonicIntel::pack_force_const(ForceConst<flt_t> &fc,
|
||||
IntelBuffers<flt_t,acc_t> * /*buffers*/)
|
||||
{
|
||||
const int bp1 = atom->nimpropertypes + 1;
|
||||
fc.set_ntypes(bp1,memory);
|
||||
const int ip1 = atom->nimpropertypes + 1;
|
||||
fc.set_ntypes(ip1,memory);
|
||||
|
||||
for (int i = 1; i < bp1; i++) {
|
||||
for (int i = 1; i < ip1; i++) {
|
||||
fc.fc[i].k = k[i];
|
||||
fc.fc[i].chi = chi[i];
|
||||
}
|
||||
@ -391,15 +391,14 @@ void ImproperHarmonicIntel::pack_force_const(ForceConst<flt_t> &fc,
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
template <class flt_t>
|
||||
void ImproperHarmonicIntel::ForceConst<flt_t>::set_ntypes(const int nimproper,
|
||||
void ImproperHarmonicIntel::ForceConst<flt_t>::set_ntypes(const int nimpropertypes,
|
||||
Memory *memory) {
|
||||
if (nimproper != _nimpropertypes) {
|
||||
if (_nimpropertypes > 0)
|
||||
_memory->destroy(fc);
|
||||
if (memory != nullptr) _memory = memory;
|
||||
if (nimpropertypes != _nimpropertypes) {
|
||||
_memory->destroy(fc);
|
||||
|
||||
if (nimproper > 0)
|
||||
_memory->create(fc,nimproper,"improperharmonicintel.fc");
|
||||
if (nimpropertypes > 0)
|
||||
_memory->create(fc,nimpropertypes,"improperharmonicintel.fc");
|
||||
}
|
||||
_nimpropertypes = nimproper;
|
||||
_memory = memory;
|
||||
_nimpropertypes = nimpropertypes;
|
||||
}
|
||||
|
||||
@ -61,7 +61,7 @@ class ImproperHarmonicIntel : public ImproperHarmonic {
|
||||
|
||||
fc_packed1 *fc;
|
||||
|
||||
ForceConst() : _nimpropertypes(0) {}
|
||||
ForceConst() : fc(nullptr), _nimpropertypes(0) {}
|
||||
~ForceConst() { set_ntypes(0, nullptr); }
|
||||
|
||||
void set_ntypes(const int nimpropertypes, Memory *memory);
|
||||
|
||||
Reference in New Issue
Block a user