replace variable length arrays in compute basal/atom with new/delete

This commit is contained in:
Axel Kohlmeyer 2018-05-04 18:55:22 -04:00
parent 477d9feb5c
commit 345c212828
1 changed files with 11 additions and 5 deletions

View File

@ -204,8 +204,11 @@ void ComputeBasalAtom::compute_peratom()
double bond_angle;
double norm_j, norm_k;
chi[0] = chi[1] = chi[2] = chi[3] = chi[4] = chi[5] = chi[6] = chi[7] = 0;
double x_ij, y_ij, z_ij, x_ik, y_ik, z_ik,x3[n0],y3[n0],z3[n0],
xmean5, ymean5, zmean5, xmean6, ymean6, zmean6, xmean7, ymean7, zmean7;
double x_ij, y_ij, z_ij, x_ik, y_ik, z_ik, xmean5, ymean5, zmean5,
xmean6, ymean6, zmean6, xmean7, ymean7, zmean7;
double *x3 = new double[n0];
double *y3 = new double[n0];
double *z3 = new double[n0];
for (j = 0; j < n0; j++) {
x_ij = x[i][0]-x[nearest_n0[j]][0];
y_ij = x[i][1]-x[nearest_n0[j]][1];
@ -411,9 +414,12 @@ void ComputeBasalAtom::compute_peratom()
}
}
}
}
//if there are less than two ~180 degree bond angles, the algorithm returns null
else BPV[i][0] = BPV[i][1] = BPV[i][2] = 0.0;
//if there are less than two ~180 degree bond angles, the algorithm returns null
} else BPV[i][0] = BPV[i][1] = BPV[i][2] = 0.0;
delete[] x3;
delete[] y3;
delete[] z3;
//normalize BPV:
double Mag = sqrt(BPV[i][0]*BPV[i][0] +