LCOV - code coverage report
Current view: top level - eigen - tlmplm_store.F90 (source / functions) Hit Total Coverage
Test: combined.info Lines: 40 46 87.0 %
Date: 2019-09-08 04:53:50 Functions: 3 3 100.0 %

          Line data    Source code
       1             : !--------------------------------------------------------------------------------
       2             : ! Copyright (c) 2016 Peter Grünberg Institut, Forschungszentrum Jülich, Germany
       3             : ! This file is part of FLEUR and available as free software under the conditions
       4             : ! of the MIT license as expressed in the LICENSE file in more detail.
       5             : !--------------------------------------------------------------------------------
       6             : 
       7             : MODULE m_tlmplm_store
       8             : ! Instead of storing data to tmat&tmas files this module stores into module variables
       9             : ! used to transfer the results from tlmplm&density matrix in case of lda+u from eigen
      10             : ! into force_a21
      11             : !      D.W 2014
      12             :     USE m_types_tlmplm
      13             :     IMPLICIT NONE
      14             :     PRIVATE
      15             :     TYPE(t_tlmplm)            :: td_stored
      16             :     COMPLEX,ALLOCATABLE       :: vs_mmp_stored(:,:,:,:)
      17             :     PUBLIC write_tlmplm, read_tlmplm, read_tlmplm_vs_mmp
      18             : CONTAINS
      19           4 :     SUBROUTINE write_tlmplm(td,vs_mmp,ldau,ispin,jspin,jspins)
      20             :         TYPE(t_tlmplm),INTENT(IN) :: td
      21             :         COMPLEX,INTENT(IN)        :: vs_mmp(:,:,:,:)
      22             :         LOGICAL,INTENT(IN)        :: ldau
      23             :         INTEGER,INTENT(IN)        :: ispin,jspin,jspins
      24             : 
      25             :         INTEGER:: llod,lmplmd,ntypd,lmd,mlot_d,mlolot_d
      26             : 
      27           4 :         IF (.NOT.allocated(td_stored%tuu)) THEN
      28           2 :             lmplmd=size(td%tuu,1)-1
      29           2 :             ntypd=size(td%tuu,2)
      30           2 :             ALLOCATE(td_stored%tuu(0:lmplmd,ntypd,jspins))
      31           2 :             ALLOCATE(td_stored%tud(0:lmplmd,ntypd,jspins))
      32           2 :             ALLOCATE(td_stored%tdd(0:lmplmd,ntypd,jspins))
      33           2 :             ALLOCATE(td_stored%tdu(0:lmplmd,ntypd,jspins))
      34           2 :             lmd=size(td%tdulo,1)-1
      35           2 :             llod=size(td%tdulo,2)!not actual llod but -llod:llod
      36           2 :             mlot_d = size(td%tdulo,3)
      37           2 :             mlolot_d = size(td%tuloulo,3)
      38           2 :             ALLOCATE(td_stored%tdulo(0:lmd,llod,mlot_d,jspins))
      39           2 :             ALLOCATE(td_stored%tuulo(0:lmd,llod,mlot_d,jspins))
      40           2 :             ALLOCATE(td_stored%tuloulo(llod,llod,mlolot_d,jspins))
      41           2 :             ALLOCATE(td_stored%ind(0:lmd,0:lmd,ntypd,jspins))
      42           2 :             IF (ldau) &
      43           0 :                 ALLOCATE(vs_mmp_stored(  &
      44           4 :                 size(vs_mmp,1),size(vs_mmp,2),size(vs_mmp,3),jspins))
      45             :         ENDIF
      46             : 
      47           4 :         td_stored%tuu(:,:,jspin) = td%tuu(:,:,ispin)
      48           4 :         td_stored%tud(:,:,jspin) = td%tud(:,:,ispin)
      49           4 :         td_stored%tdu(:,:,jspin) = td%tdu(:,:,ispin)
      50           4 :         td_stored%tdd(:,:,jspin) = td%tdd(:,:,ispin)
      51             : 
      52           4 :         td_stored%tdulo(:,:,:,jspin)   = td%tdulo(:,:,:,ispin)
      53           4 :         td_stored%tuulo(:,:,:,jspin)   = td%tuulo(:,:,:,ispin)
      54           4 :         td_stored%tuloulo(:,:,:,jspin) = td%tuloulo(:,:,:,ispin)
      55           4 :         td_stored%ind(:,:,:,jspin)     = td%ind(:,:,:,ispin)
      56           4 :         IF (ldau) vs_mmp_stored(:,:,:,jspin)=vs_mmp(:,:,:,ispin)
      57             : 
      58             : 
      59           4 :     END SUBROUTINE write_tlmplm
      60             : 
      61          24 :     SUBROUTINE read_tlmplm(n,jspin,nlo,tuu,tud,tdu,tdd,ind,tuulo,tuloulo,tdulo)
      62             :         COMPLEX,INTENT(OUT)::tuu(:),tdd(:),tud(:),tdu(:)
      63             :         INTEGER,INTENT(OUT)::ind(:,:)
      64             :         COMPLEX,INTENT(OUT)::tuulo(:,:,:),tdulo(:,:,:),tuloulo(:,:,:)
      65             :         INTEGER,INTENT(IN) :: n,jspin,nlo(:)
      66             : 
      67             :         INTEGER:: mlo,mlolo
      68          24 :         tuu(1:size(tuu,1))=td_stored%tuu(0:size(tuu,1)-1,n,jspin)
      69          24 :         tud(1:size(tuu,1))=td_stored%tud(0:size(tuu,1)-1,n,jspin)
      70          24 :         tdu(1:size(tuu,1))=td_stored%tdu(0:size(tuu,1)-1,n,jspin)
      71          24 :         tdd(1:size(tuu,1))=td_stored%tdd(0:size(tuu,1)-1,n,jspin)
      72          24 :         ind(1:size(ind,1),1:size(ind,2))=td_stored%ind(0:size(ind,1)-1,0:size(ind,2)-1,n,jspin)
      73             : 
      74          24 :         IF (nlo(n)>0) THEN
      75           0 :             mlo=sum(nlo(:n-1))+1
      76           0 :             mlolo=dot_product(nlo(:n-1),nlo(:n-1)+1)/2+1
      77             :             tuulo(1:size(tuulo,1),:,mlo:(mlo+nlo(n)-1))=&
      78           0 :                td_stored%tuulo(0:size(tuulo,1)-1,:size(tuulo,2),mlo:mlo+nlo(n)-1,jspin)
      79             :             tdulo(1:size(tuulo,1),:,mlo:(mlo+nlo(n)-1))=&
      80           0 :                td_stored%tdulo(0:size(tuulo,1)-1,:size(tuulo,2),mlo:mlo+nlo(n)-1,jspin)
      81             :             tuloulo(:,:,mlolo:mlolo+nlo(n)*(nlo(n)+1)/2-1)=&
      82           0 :                td_stored%tuloulo(:size(tuloulo,1),:size(tuloulo,2),mlolo:mlolo+nlo(n)*(nlo(n)+1)/2-1,jspin)
      83             :         ENDIF
      84             :     
      85          24 :     END SUBROUTINE read_tlmplm
      86             : 
      87          12 :     SUBROUTINE read_tlmplm_vs_mmp(jspin,n_u,vs_mmp)
      88             : 
      89             :        INTEGER, INTENT(IN)  :: jspin, n_u
      90             :        COMPLEX, INTENT(OUT) :: vs_mmp(:,:,:)
      91             : 
      92          12 :        IF(n_u.GT.0) THEN
      93          12 :           vs_mmp(:,:,:) = vs_mmp_stored(:,:,:,jspin)
      94             :        END IF
      95             : 
      96          12 :     END SUBROUTINE read_tlmplm_vs_mmp
      97             : 
      98             : END MODULE m_tlmplm_store

Generated by: LCOV version 1.13