LCOV - code coverage report
Current view: top level - mix - pulay.F90 (source / functions) Hit Total Coverage
Test: combined.info Lines: 0 30 0.0 %
Date: 2019-09-08 04:53:50 Functions: 0 1 0.0 %

          Line data    Source code
       1             : MODULE m_pulay
       2             :   USE m_juDFT
       3             : 
       4             : CONTAINS
       5           0 :   SUBROUTINE pulay(alpha,fm,sm,simple_steps)
       6             :     USE m_types_mat
       7             :     USE m_types_mixvector
       8             :     USE m_mixing_history
       9             :     IMPLICIT NONE
      10             :     TYPE(t_mixvector),INTENT(IN)    :: fm(:)
      11             :     TYPE(t_mixvector),INTENT(INOUT) :: sm(:)
      12             :     INTEGER,INTENT(IN)              :: simple_steps
      13             :     REAL,INTENT(IN)                 :: alpha
      14             :     ! Locals
      15             :     INTEGER           :: h_len,n,nn
      16           0 :     REAL,ALLOCATABLE  :: b(:)
      17           0 :     TYPE(t_mat)       :: a
      18           0 :     TYPE(t_mixvector),ALLOCATABLE :: df(:),ds(:)
      19           0 :     TYPE(t_mixvector) ::mdf
      20             : 
      21             : 
      22           0 :     h_len=SIZE(fm)-1
      23             :     
      24           0 :     IF (h_len==0) THEN
      25           0 :        sm(h_len+1)=sm(h_len+1)+alpha*fm(h_len+1) !Simple mixing
      26           0 :        RETURN !No history present
      27             :     ENDIF
      28           0 :     IF (simple_steps>0) THEN
      29           0 :        IF (MOD(h_len,simple_steps).NE.0) THEN
      30             :           !Simple mixing step of periodic Pulay
      31           0 :           sm(h_len+1)=sm(h_len+1)+alpha*fm(h_len+1) 
      32           0 :           RETURN 
      33             :        ENDIF
      34             :     ENDIF
      35           0 :     CALL a%alloc(.TRUE.,h_len,h_len)
      36             : 
      37           0 :     ALLOCATE(df(h_len),ds(h_len),b(h_len))
      38             : 
      39           0 :     DO n=1,h_len
      40           0 :        df(n)=fm(n+1)-fm(n)
      41           0 :        ds(n)=sm(n+1)-sm(n)
      42           0 :        mdf=df(n)%apply_metric()
      43           0 :        b(n)=mdf.dot.fm(h_len+1)
      44           0 :        DO nn=1,n
      45           0 :           a%data_r(n,nn)=mdf.dot.df(nn)
      46           0 :           a%data_r(nn,n)=a%data_r(n,nn)
      47             :        ENDDO
      48             :     ENDDO
      49             :     
      50           0 :     call a%inverse()
      51             : 
      52           0 :     b=MATMUL(a%data_r,b)
      53           0 :     sm(h_len+1)=sm(h_len+1)+alpha*fm(h_len+1) !Simple mixing
      54           0 :     DO n=1,h_len
      55           0 :        sm(h_len+1)=sm(h_len+1)-b(n)*(ds(n)+alpha*df(n))
      56             :     ENDDO
      57             :    
      58           0 :     IF (simple_steps>0) CALL mixing_history_limit(0)
      59           0 :   END SUBROUTINE pulay
      60             : END MODULE m_pulay

Generated by: LCOV version 1.13