From 8ef64b4a897f0e9e216227b7e8929049478b60fd Mon Sep 17 00:00:00 2001
From: Nicolas Essing <n.essing@fz-juelich.de>
Date: Thu, 28 Oct 2021 11:45:16 +0200
Subject: [PATCH] Small bugfix regarding torque calculation.

Calculating torque and magnetic moment only inside the muffin tin
region, the point at the muffin tin radius was set to zero. This was
not consistent with the convention on this in the rest of the code
and introduced a (small) deviation from the desired result.
---
 source/KKRnano/source/bfield/torque.f90 | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/source/KKRnano/source/bfield/torque.f90 b/source/KKRnano/source/bfield/torque.f90
index 485515e17..b80eb32f7 100644
--- a/source/KKRnano/source/bfield/torque.f90
+++ b/source/KKRnano/source/bfield/torque.f90
@@ -108,7 +108,7 @@ contains
           call intcheb_cell(integrand,integrate_result,rpan_intervall,ipan_intervall,npan_tot,ncheb,irmd)
           mag(ilm,i) = real(integrate_result * rfpi)    
           ! Same for only the muffin tin: Set to zero outside, integrate again
-          integrand(imt:) = (0., 0.)
+          integrand(imt+1:) = (0., 0.)
           call intcheb_cell(integrand(:),integrate_result,rpan_intervall,ipan_intervall,npan_tot,ncheb,irmd)
           mag_mt(ilm,i) = real(integrate_result * rfpi)    
       end do
@@ -135,7 +135,7 @@ contains
         call intcheb_cell(integrand(:),integrate_result,rpan_intervall,ipan_intervall,npan_tot,ncheb,irmd)
         torque(i) = torque(i) + real(integrate_result * rfpi) ! rfpi only contained in convoluted quantities
         ! Same for mt
-        integrand(imt:) = 0.
+        integrand(imt+1:) = 0.
         call intcheb_cell(integrand(:),integrate_result,rpan_intervall,ipan_intervall,npan_tot,ncheb,irmd)
         torque_mt(i) = torque_mt(i) + real(integrate_result * rfpi)
       end do
-- 
GitLab