LCOV - code coverage report
Current view: top level - ldaX - hubbard1Distance.f90 (source / functions) Hit Total Coverage
Test: FLEUR test coverage Lines: 0 23 0.0 %
Date: 2024-05-15 04:28:08 Functions: 0 1 0.0 %

          Line data    Source code
       1             : MODULE m_hubbard1Distance
       2             : 
       3             :    USE m_types
       4             :    USE m_constants
       5             : 
       6             :    IMPLICIT NONE
       7             : 
       8             :    CONTAINS
       9           0 :    SUBROUTINE hubbard1Distance(n_mmp_in,n_mmp_out,results)
      10             : 
      11             :       COMPLEX,             INTENT(IN)     :: n_mmp_in (-lmaxU_const:,-lmaxU_const:,:)
      12             :       COMPLEX,             INTENT(IN)     :: n_mmp_out(-lmaxU_const:,-lmaxU_const:,:)
      13             :       TYPE(t_results),     INTENT(INOUT)  :: results
      14             : 
      15           0 :       REAL    :: elementDistance(SIZE(n_mmp_in,3))
      16             :       INTEGER :: ispin,m,mp
      17             :       REAL    :: n_in,n_out
      18             : 
      19             :       !Calculates the distance for two density matrices (maximum distance between two elements)
      20           0 :       n_out = 0.0
      21           0 :       n_in = 0.0
      22           0 :       elementDistance = 0.0
      23           0 :       DO ispin = 1, SIZE(n_mmp_in,3)
      24           0 :          DO m = -lmaxU_const,lmaxU_const
      25           0 :             DO mp = -lmaxU_const,lmaxU_const
      26             :                !Distance between individual elements
      27           0 :                IF((ABS(n_mmp_out(m,mp,ispin) - n_mmp_in(m,mp,ispin))).GT.elementDistance(ispin)) THEN
      28           0 :                   elementDistance(ispin) = ABS(n_mmp_out(m,mp,ispin) - n_mmp_in(m,mp,ispin))
      29             :                ENDIF
      30             :                !Distance of the spin diagonal trace
      31           0 :                IF(m.EQ.mp.AND.ispin<3) THEN
      32           0 :                   n_out = n_out + REAL(n_mmp_out(m,m,ispin))
      33           0 :                   n_in  = n_in  + REAL(n_mmp_in (m,m,ispin))
      34             :                ENDIF
      35             :             END DO
      36             :          END DO
      37             :       ENDDO
      38           0 :       results%last_occdistance    = MAX(results%last_occdistance   ,ABS(n_out-n_in))
      39           0 :       results%last_mmpMatdistance = MAX(results%last_mmpMatdistance,MAXVAL(elementDistance))
      40             : 
      41             :       !IO to out file
      42           0 :       WRITE(oUnit,'(A)') "Hubbard 1 Distances:"
      43           0 :       WRITE(oUnit,'(A)') "-------------------------------"
      44           0 :       WRITE(oUnit,*) "  Occupation distance:     ", ABS(n_out-n_in)
      45           0 :       WRITE(oUnit,*) "  Density matrix distance: ", MAXVAL(elementDistance)
      46           0 :       DO ispin = 1, SIZE(n_mmp_in,3)
      47           0 :          WRITE(oUnit,'(/,A,I1,A,f14.8)') "Delta Spin ", ispin, ": ", elementDistance(ispin)
      48             :          WRITE(oUnit,'(7f12.7)') REAL(  n_mmp_out(-lmaxU_const:,-lmaxU_const:,ispin) &
      49           0 :                                       - n_mmp_in (-lmaxU_const:,-lmaxU_const:,ispin)  )
      50             :       ENDDO
      51             : 
      52           0 :    END SUBROUTINE hubbard1Distance
      53             : END MODULE m_hubbard1Distance

Generated by: LCOV version 1.14