replace variable length array in fix drude/transform with new/delete

This commit is contained in:
Axel Kohlmeyer 2018-05-04 21:45:17 -04:00
parent c83fedf100
commit 974ea3420b
1 changed files with 2 additions and 1 deletions

View File

@ -75,7 +75,7 @@ void FixDrudeTransform<inverse>::setup(int) {
if (!rmass) {
if (!mcoeff) mcoeff = new double[ntypes+1];
double mcoeff_loc[ntypes+1];
double *mcoeff_loc = new double[ntypes+1];
for (int itype=0; itype<=ntypes; itype++) mcoeff_loc[itype] = 2.; // an impossible value: mcoeff is at most 1.
for (int i=0; i<nlocal; i++) {
if (drudetype[type[i]] == DRUDE_TYPE) {
@ -95,6 +95,7 @@ void FixDrudeTransform<inverse>::setup(int) {
// mcoeff is 2 for non polarizable
// 0 < mcoeff < 1 for drude
// mcoeff < 0 for core
delete[] mcoeff_loc;
}
}