From b089ba6815faafc2ccf374d70d73890783d843ca Mon Sep 17 00:00:00 2001
From: Giovanni La Mura <giovanni.lamura@inaf.it>
Date: Mon, 16 Oct 2023 17:23:51 +0200
Subject: [PATCH] Resize the dielectric constant matrix.

---
 src/sphere/edfb.cpp | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/src/sphere/edfb.cpp b/src/sphere/edfb.cpp
index e632b797..c7f4bd51 100644
--- a/src/sphere/edfb.cpp
+++ b/src/sphere/edfb.cpp
@@ -46,7 +46,6 @@ int main(int argc, char **argv) {
   double *xiv, *wns, *wls, *pus, *evs, *vss;
   string vns[5];
 
-  int max_nsh = 0; // A helper variable to set the size of dc0m
   int ici;
 
   // Input file reading section
@@ -380,7 +379,6 @@ int main(int argc, char **argv) {
     ros[i113 - 1] = ros_val * pow(10.0, ros_val_exp);
     nsh = nshl[i113 -1];
     if (i113 == 1) nsh += ies;
-    if ((nsh + 1) / 2 + ies > max_nsh) max_nsh = (nsh + 1) / 2 + ies;
     rcf[i113 - 1] = new double[nsh];
     for (int ns = 0; ns < nsh; ns++) {
       double ns_rcf;
@@ -415,8 +413,8 @@ int main(int argc, char **argv) {
       write_double_(&uid, (rcf[i115 - 1] + ins));
   }
   // Remake the dc0m matrix.
-  dc0m = new complex<double>**[max_nsh];
-  for (int dim1 = 0; dim1 < max_nsh; dim1++) {
+  dc0m = new complex<double>**[nsph];
+  for (int dim1 = 0; dim1 < nsph; dim1++) {
     dc0m[dim1] = new complex<double>*[nsph];
     for (int dim2 = 0; dim2 < nxi; dim2++) {
       dc0m[dim1][dim2] = new complex<double>[nxi];
-- 
GitLab