From 84d601ff6b9bc6f1d7fb9578be3aaa0f2d4a5fb4 Mon Sep 17 00:00:00 2001
From: Philipp Ruessmann <p.ruessmann@fz-juelich.de>
Date: Thu, 3 Feb 2022 13:20:59 +0100
Subject: [PATCH] Add <soc_no_spinflip> test option

Sets the spin-flip terms of the SOC Hamiltonian to zero in spinorbit_ham.
Usage: Set '<soc_no_spinflip>= True' in the inputcard
---
 source/common/runoptions.F90    | 4 ++++
 source/common/spinorbit_ham.f90 | 9 ++++++++-
 2 files changed, 12 insertions(+), 1 deletion(-)

diff --git a/source/common/runoptions.F90 b/source/common/runoptions.F90
index bb874a85c..4d3e4ae03 100644
--- a/source/common/runoptions.F90
+++ b/source/common/runoptions.F90
@@ -124,6 +124,7 @@ module mod_runoptions
   logical :: write_angles_alliter= .false.             !! write out noncollinear angles for all iterations
   logical :: write_tmat_all= .false.                   !! write out the tmat for all atoms and energies
   logical :: write_double_precision= .false.           !! write out kkrflex files in double precision
+  logical :: soc_no_spinflip= .false.                  !! set spin-flip components of the SOC Hamiltonian to zero
 
   !some old run and test options have been removed:
   !  'atptshft': replaced by presence or absence of IVSHIFT in inputcard
@@ -251,6 +252,7 @@ module mod_runoptions
     call set_runoption(write_double_precision        , '<write_double_precision>')
     call set_runoption(calc_onsite_only              , '<calc_onsite_only>')
     call set_runoption(use_gmat_unity                , '<use_gmat_unity>')
+    call set_runoption(soc_no_spinflip               , '<soc_no_spinflip>')
 
   end subroutine read_runoptions
 
@@ -799,6 +801,7 @@ module mod_runoptions
     call mpi_bcast(write_double_precision        , 1, mpi_logical, master, mpi_comm_world, ierr)
     call mpi_bcast(calc_onsite_only              , 1, mpi_logical, master, mpi_comm_world, ierr)
     call mpi_bcast(use_gmat_unity                , 1, mpi_logical, master, mpi_comm_world, ierr)
+    call mpi_bcast(soc_no_spinflip               , 1, mpi_logical, master, mpi_comm_world, ierr)
 
   end subroutine bcast_runoptions
 #endif
@@ -919,6 +922,7 @@ module mod_runoptions
     write(iounit, '(A35,1x,1L,3x,A)') '<write_double_precision>=', write_double_precision, "write out kkrflex files in double precision"
     write(iounit, '(A35,1x,1L,3x,A)') '<calc_onsite_only>=', calc_onsite_only, "calculate not the full Green function for the density but take the onsite part alone"
     write(iounit, '(A35,1x,1L,3x,A)') '<use_gmat_unity>=', use_gmat_unity, "set the structural GF to the unity matrix for test purposes"
+    write(iounit, '(A35,1x,1L,3x,A)') '<soc_no_spinflip>=', soc_no_spinflip, "set spin-flip components of the SOC Hamiltonian to zero"
 
   end subroutine print_runoptions
 
diff --git a/source/common/spinorbit_ham.f90 b/source/common/spinorbit_ham.f90
index 5f08e33e3..a167ecda1 100644
--- a/source/common/spinorbit_ham.f90
+++ b/source/common/spinorbit_ham.f90
@@ -33,7 +33,7 @@ contains
 
     use :: mod_datatypes, only: dp
     use :: mod_constants, only: czero
-    use :: mod_runoptions, only: set_cheby_nosoc, decouple_spin_cheby
+    use :: mod_runoptions, only: set_cheby_nosoc, decouple_spin_cheby, soc_no_spinflip
     use :: mod_cheb, only: getclambdacinv
     use :: mod_spin_orbit_compl, only: spin_orbit_compl
     use :: mod_rotatespinframe, only: rotatematrix
@@ -134,6 +134,13 @@ contains
       ! do nothing
     end if
 
+    ! test option that deactivates the spin-flip terms of the SOC Hamiltonian
+    if (soc_no_spinflip) then
+      ! set off-diagonal lm blocks in spin space to zero
+      lsmh(1+lmmaxd:2*lmmaxd, 1:lmmaxd) = czero
+      lsmh(1:lmmaxd, 1+lmmaxd:2*lmmaxd) = czero
+    end if
+
     ! contruct prefactor of spin-orbit hamiltonian
     hsofac = 0e0_dp
     vnspll1 = (0e0_dp, 0e0_dp)
-- 
GitLab