From 7a63a072a17ca1b22613e27aa858db026944b9a3 Mon Sep 17 00:00:00 2001
From: Giovanni La Mura <giovanni.lamura@inaf.it>
Date: Fri, 19 Apr 2024 17:08:53 +0200
Subject: [PATCH] Always use a proprietary vector to define configuration
 scales

---
 src/libnptm/Configuration.cpp | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/src/libnptm/Configuration.cpp b/src/libnptm/Configuration.cpp
index ac5d7531..70e51d07 100644
--- a/src/libnptm/Configuration.cpp
+++ b/src/libnptm/Configuration.cpp
@@ -297,9 +297,10 @@ ScattererConfiguration::ScattererConfiguration(
   exdc = ex;
   wp = w;
   xip = x;
-  if (variable_name == "XIV") scale_vec = scale_vector;
-  else {
-    scale_vec = new double[number_of_scales]();
+  scale_vec = new double[number_of_scales]();
+  if (variable_name == "XIV") {
+    for (int xi = 0; xi < nxi; xi++) scale_vec[xi] = scale_vector[xi];
+  } else {
     const double pi2 = 2.0 * acos(-1.0);
     const double evc = 6.5821188e-16;
     for (int si = 0; si < number_of_scales; si++) {
@@ -312,6 +313,7 @@ ScattererConfiguration::ScattererConfiguration(
     }
   }
 }
+
 ScattererConfiguration::ScattererConfiguration(const  ScattererConfiguration& rhs)
 {
   number_of_spheres = rhs.number_of_spheres;
@@ -642,6 +644,7 @@ ScattererConfiguration* ScattererConfiguration::from_dedfb(string dedfb_file_nam
 							      _xip
   );
   delete[] file_lines;
+  delete[] variable_vector;
   return config;
 }
 
-- 
GitLab