From bf93e606465cb608235f3e71647775776b642111 Mon Sep 17 00:00:00 2001
From: Nicolas Essing <n.essing@fz-juelich.de>
Date: Thu, 21 Oct 2021 14:36:11 +0200
Subject: [PATCH] Remove fix angle modes 4 and 5.

Mode 4 was supposed to fix the direction using constraint magnetic
fields but allowing the moment to change direction as far as the
constraint field does not fullfill this yet. While this is in principle
possible, the current implementation was wrong, as the goal angles
are not stored separately, so a changed moment would also change the
goal.
This mode could be added in the future, but as it converges slower
than mode 2 and to the same result, there is not much reason for that.

Mode 5 was supposed to fix the direction by cancelling the torque,
but allowing the moment to move. This does not depend at all on the
given goal directions and does thus not make any sense.
---
 source/KKRnano/source/NonCollinearMagnetism_mod.F90 | 6 ++----
 source/KKRnano/source/bfield/torque.f90             | 4 ++--
 2 files changed, 4 insertions(+), 6 deletions(-)

diff --git a/source/KKRnano/source/NonCollinearMagnetism_mod.F90 b/source/KKRnano/source/NonCollinearMagnetism_mod.F90
index 07329ec08..b227d1344 100644
--- a/source/KKRnano/source/NonCollinearMagnetism_mod.F90
+++ b/source/KKRnano/source/NonCollinearMagnetism_mod.F90
@@ -866,8 +866,7 @@ deallocate(rhotemp)
 deallocate(rhonewtemp)
 ! calculate new THETA and PHI for non-colinear
 !IF (.NOT.test('FIXMOM  ')) THEN
-if (angle_fixed == 0 .or. &                       ! angle not fixed
-    angle_fixed == 4 .or. angle_fixed == 5 ) then ! use constraining fiels without fixing here
+if (angle_fixed == 0) then ! angle not fixed
   rho2ns_temp(1,1)=rho2int(1)
   rho2ns_temp(2,2)=rho2int(2)
   rho2ns_temp(1,2)=rho2int(3)
@@ -974,8 +973,7 @@ DO lm1=0,lmaxd1
 END DO
 
 ! UPDATE ANGLES
-if (angle_fixed == 0 .or. &                       ! angle not fixed
-    angle_fixed == 4 .or. angle_fixed == 5 ) then ! use constraining fiels without fixing here
+if (angle_fixed == 0) then
 phi   = phinew
 theta = thetanew        
 endif
diff --git a/source/KKRnano/source/bfield/torque.f90 b/source/KKRnano/source/bfield/torque.f90
index 5cb0cd20b..0e8ea2183 100644
--- a/source/KKRnano/source/bfield/torque.f90
+++ b/source/KKRnano/source/bfield/torque.f90
@@ -160,9 +160,9 @@ contains
     
     ! Scf-cycle for constraint fields, based either on torque or on fields alone
     if (lbfield_constr .and. itscf0 <= iteration .and. iteration <= itscf1) then
-      if (constr_mode == 3 .or. constr_mode == 5) then
+      if (constr_mode == 3) then
         bfield%bfield_constr(:) = bfield%bfield_constr(:) - torque(:) / mag_mom_len
-      else if (constr_mode == 2 .or. constr_mode == 4) then
+      else if (constr_mode == 2) then
         old_b_constr = bfield%bfield_constr(:)
         bfield%bfield_constr(:) = old_b_constr - dot_product(old_b_constr,dir)*dir - &
                 (mag_mom_dir - dot_product(mag_mom_dir,dir)*dir)*constraint_bfields_mixing_parameter
-- 
GitLab