Skip to content

ADSIC in Casida is not correct

ADSIC in Casida is using spin unpolarized evaluation of the fxc. This is not correct and inconsistent with the definition of the energy and the potential. The change should look like this.

diff --git a/src/main/casida.F90 b/src/main/casida.F90
index bf294937d0..b33c85e4df 100644
--- a/src/main/casida.F90
+++ b/src/main/casida.F90
@@ -1072,14 +1072,16 @@ contains
         call messages_fatal(1, namespace=sys%namespace)
       end if
 
-      SAFE_ALLOCATE(fxc_sic(1:mesh%np, 1:st%d%nspin, 1:st%d%nspin))
-      SAFE_ALLOCATE(rho(1:mesh%np, 1:st%d%nspin))
+      ! This needs always to be called for the spin-polarized case
+      SAFE_ALLOCATE(fxc_sic(1:mesh%np, 1:2, 1:2))
+      SAFE_ALLOCATE(rho(1:mesh%np, 1:2))
       fxc_sic = M_ZERO
-      rho = cas%rho/st%qtot
+      rho(:, 1) = cas%rho(:, 1)/st%qtot
+      rho(:, 2) = M_ZERO
 
-      call xc_get_fxc(ks%xc, mesh, namespace, rho, 1, fxc_sic)
+      call xc_get_fxc(ks%xc, mesh, namespace, rho, SPIN_POLARIZED, fxc_sic)
 
-      cas%fxc = cas%fxc - fxc_sic/st%qtot
+      cas%fxc = cas%fxc - fxc_sic(:, 1, 1)/st%qtot
 
       SAFE_DEALLOCATE_A(rho)
       SAFE_DEALLOCATE_A(fxc_sic)