From 2a0a5f149c9c3f4f42351ea5079ba21ebda387bc Mon Sep 17 00:00:00 2001
From: Giovanni La Mura <giovanni.lamura@inaf.it>
Date: Mon, 6 Nov 2023 11:37:28 +0100
Subject: [PATCH] Fix harmonic indexing in wmamp()

---
 src/include/sph_subs.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/include/sph_subs.h b/src/include/sph_subs.h
index c01d90d7..50ea288d 100644
--- a/src/include/sph_subs.h
+++ b/src/include/sph_subs.h
@@ -1239,7 +1239,7 @@ void wmamp(
 ) {
 	std::complex<double> *ylm = new std::complex<double>[1682];
 	int nlmp = lm * (lm + 2) + 2;
-	ylm[nlmp] = std::complex<double>(0.0, 0.0);
+	ylm[nlmp - 1] = std::complex<double>(0.0, 0.0);
 	if (idot != 0) {
 		if (idot != 1) {
 			for (int n40 = 0; n40 < nsph; n40++) {
-- 
GitLab