From 4228e4424caef4b220e2f8bcddce3f47193a1144 Mon Sep 17 00:00:00 2001
From: Rudolf Zeller <ru.zeller@fz-juelich.de>
Date: Wed, 13 Jan 2021 18:59:26 +0100
Subject: [PATCH] Implementation of updating the semi-core normalization in the
 self-consistency steps

---
 source/KKRnano/source/ProcessKKRresults_mod.F90 | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/source/KKRnano/source/ProcessKKRresults_mod.F90 b/source/KKRnano/source/ProcessKKRresults_mod.F90
index 35814f530..a9a84435d 100644
--- a/source/KKRnano/source/ProcessKKRresults_mod.F90
+++ b/source/KKRnano/source/ProcessKKRresults_mod.F90
@@ -451,6 +451,7 @@ module ProcessKKRresults_mod
     double precision :: chrgNt_local
     double precision :: new_fermi
     double precision :: CHRGSEMICORE !< total semicore charge over all atoms
+    double precision :: fsemicore_in
     integer :: ila, r1fu
     integer :: num_local_atoms
 
@@ -659,7 +660,12 @@ module ProcessKKRresults_mod
       ! --> Sum up semicore charges from different MPI ranks
       call sumChargeSemi_com(CHRGSEMICORE, mp%mySEComm)
       ! --> Recalculate the semicore contour factor FSEMICORE
-      if (mp%isMasterRank) call calcFactorSemi(CHRGSEMICORE, emesh%FSEMICORE, params%fsemicore)
+      if(iter==1) then
+      fsemicore_in = params%fsemicore
+      else
+      fsemicore_in = emesh%FSEMICORE
+      endif
+      if (mp%isMasterRank) call calcFactorSemi(CHRGSEMICORE, emesh%FSEMICORE, fsemicore_in)
     endif
 
     emesh%E2 = new_fermi  ! Assumes that for every atom the same Fermi correction
-- 
GitLab