Skip to content
Snippets Groups Projects
Commit 345c2128 authored by Axel Kohlmeyer's avatar Axel Kohlmeyer
Browse files

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

parent 477d9feb
No related branches found
No related tags found
No related merge requests found
......@@ -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] +
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment