diff --git a/src/libnptm/Commons.cpp b/src/libnptm/Commons.cpp index 4a29057c1c0e3f23adf6780ae3d686f64f4774d3..29bf18b637b149e7d3d6b9fa71ae8433c7e135cd 100644 --- a/src/libnptm/Commons.cpp +++ b/src/libnptm/Commons.cpp @@ -1222,8 +1222,8 @@ ParticleDescriptorInclusion::ParticleDescriptorInclusion(const mixMPI *mpidata) // >>> ParticleDescriptorSphere class implementation. <<< // ParticleDescriptorSphere::ParticleDescriptorSphere(GeometryConfiguration *gconf, ScattererConfiguration *sconf) : ParticleDescriptor(gconf, sconf) { _class_type = SPHERE_TYPE; - vec_sas = new dcomplex[4 * (_nsph + 1)](); - vec_vints = new dcomplex[16 * (_nsph + 1)](); + vec_sas = new dcomplex[4 * _nsph](); + vec_vints = new dcomplex[16 * _nsph](); fsas = new dcomplex[_nsph]; sscs = new double[_nsph](); @@ -1236,7 +1236,7 @@ ParticleDescriptorSphere::ParticleDescriptorSphere(GeometryConfiguration *gconf, sas = new dcomplex**[_nsph]; vints = new dcomplex*[_nsph]; for (int vi = 0; vi < _nsph; vi++) { - vints[vi] = vec_vints + (16 * _nsph); + vints[vi] = vec_vints + (16 * vi); sas[vi] = new dcomplex*[2]; sas[vi][0] = vec_sas + (4 * vi); sas[vi][1] = vec_sas + (4 * vi) + 2; @@ -1249,6 +1249,14 @@ ParticleDescriptorSphere::ParticleDescriptorSphere(const ParticleDescriptorSpher for (int vsi = 0; vsi < 4 * _nsph; vsi++) vec_sas[vsi] = rhs.vec_sas[vsi]; vec_vints = new dcomplex[16 * _nsph]; for (int vvi = 0; vvi < 16 * _nsph; vvi++) vec_vints[vvi] = rhs.vec_vints[vvi]; + sas = new dcomplex**[_nsph]; + vints = new dcomplex*[_nsph]; + for (int vi = 0; vi < _nsph; vi++) { + vints[vi] = vec_vints + (16 * vi); + sas[vi] = new dcomplex*[2]; + sas[vi][0] = vec_sas + (4 * vi); + sas[vi][1] = vec_sas + (4 * vi) + 2; + } fsas = new dcomplex[_nsph]; sscs = new double[_nsph]; @@ -1268,14 +1276,6 @@ ParticleDescriptorSphere::ParticleDescriptorSphere(const ParticleDescriptorSpher sqabs[gi] = rhs.sqabs[gi]; gcsv[gi] = rhs.gcsv[gi]; } - sas = new dcomplex**[_nsph]; - vints = new dcomplex*[_nsph]; - for (int vi = 0; vi < nsph; vi++) { - vints[vi] = vec_vints + (16 * nsph); - sas[vi] = new dcomplex*[2]; - sas[vi][0] = vec_sas + (4 * vi); - sas[vi][1] = vec_sas + (4 * vi) + 2; - } } #ifdef MPI_VERSION @@ -1305,7 +1305,7 @@ ParticleDescriptorSphere::ParticleDescriptorSphere(const mixMPI *mpidata) : Part sas = new dcomplex**[_nsph]; vints = new dcomplex*[_nsph]; for (int vi = 0; vi < nsph; vi++) { - vints[vi] = vec_vints + (16 * nsph); + vints[vi] = vec_vints + (16 * vi); sas[vi] = new dcomplex*[2]; sas[vi][0] = vec_sas + (4 * vi); sas[vi][1] = vec_sas + (4 * vi) + 2;