LCOV - code coverage report
Current view: top level - eigen - hs_int.F90 (source / functions) Hit Total Coverage
Test: combined.info Lines: 33 37 89.2 %
Date: 2019-09-08 04:53:50 Functions: 2 2 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_hs_int
       8             : CONTAINS
       9             :   !Subroutine to construct the interstitial Hamiltonian and overlap matrix
      10        2376 :   SUBROUTINE hs_int(input,noco,stars,lapw,mpi,cell,isp,vpw,&
      11        2376 :        smat,hmat)
      12             :     USE m_types
      13             :     IMPLICIT NONE
      14             :     TYPE(t_input),INTENT(IN)      :: input
      15             :     TYPE(t_noco),INTENT(IN)       :: noco
      16             :     TYPE(t_stars),INTENT(IN)      :: stars
      17             :     TYPE(t_cell),INTENT(IN)       :: cell
      18             :     TYPE(t_lapw),INTENT(IN)       :: lapw
      19             :     TYPE(t_mpi),INTENT(IN)        :: mpi
      20             :     INTEGER,INTENT(IN)            :: isp
      21             :     COMPLEX,INTENT(IN)            :: vpw(:,:)
      22             :     CLASS(t_mat),INTENT(INOUT)     :: smat(:,:),hmat(:,:)
      23             : 
      24             : 
      25             :     INTEGER :: ispin,jspin !spin indices
      26             :     INTEGER :: i,j,ii(3),iispin,jjspin,i0
      27             :     INTEGER :: in
      28             :     COMPLEX :: th,ts,phase
      29             :     REAL    :: b1(3),b2(3),r2
      30             : 
      31        1188 :     IF (noco%l_noco.AND.isp==2) RETURN !was done already
      32        3040 :     DO ispin=MERGE(1,isp,noco%l_noco),MERGE(2,isp,noco%l_noco)
      33        1852 :        iispin=MIN(ispin,SIZE(smat,1))
      34        6220 :        DO jspin=MERGE(1,isp,noco%l_noco),MERGE(2,isp,noco%l_noco)
      35        3180 :           jjspin=MIN(jspin,SIZE(smat,1))
      36             :         
      37             :           !$OMP PARALLEL DO SCHEDULE(dynamic) DEFAULT(none) &
      38             :           !$OMP SHARED(mpi,lapw,stars,input,cell,vpw) &
      39             :           !$OMP SHARED(jjspin,iispin,ispin,jspin)&
      40             :           !$OMP SHARED(hmat,smat)&
      41      249030 :           !$OMP PRIVATE(ii,i0,i,j,in,phase,b1,b2,r2,th,ts)
      42             :           DO  i = mpi%n_rank+1,lapw%nv(ispin),mpi%n_size
      43      243998 :              i0=(i-1)/mpi%n_size+1
      44             :              !--->    loop over (k+g)
      45    30377850 :              DO  j = 1,MIN(i,lapw%nv(jspin))  
      46   120509968 :                 ii = lapw%gvec(:,i,ispin) - lapw%gvec(:,j,jspin)
      47    30127492 :                 IF (ispin==1.AND.jspin==2) THEN
      48    11942140 :                    ii=-1*ii
      49     1706020 :                    in = stars%ig(ii(1),ii(2),ii(3))
      50     1706020 :                    IF (in.EQ.0) CYCLE
      51     1706020 :                    th = stars%rgphs(ii(1),ii(2),ii(3))*conjg(vpw(in,3))           
      52     1706020 :                    ts=0.0
      53    28421472 :                 ELSEIF(ispin==2.and.jspin==1) THEN
      54             :                 !   ii = -1*ii
      55     1706020 :                    in = stars%ig(ii(1),ii(2),ii(3))
      56     1706020 :                    IF (in.EQ.0) CYCLE
      57     1706020 :                    th = stars%rgphs(ii(1),ii(2),ii(3))*vpw(in,3)        
      58     1706020 :                    ts=0.0
      59             :                 ELSE
      60             :                    !-->     determine index and phase factor
      61    26715452 :                    in = stars%ig(ii(1),ii(2),ii(3))
      62    26715452 :                    IF (in.EQ.0) CYCLE
      63    26715452 :                    phase = stars%rgphs(ii(1),ii(2),ii(3))
      64    26715452 :                    ts = phase*stars%ustep(in)
      65    26715452 :                    IF (input%l_useapw) THEN
      66           0 :                       b1=lapw%bkpt+lapw%gvec(:,i,ispin)
      67           0 :                       b2=lapw%bkpt+lapw%gvec(:,j,jspin)
      68           0 :                       r2 = DOT_PRODUCT(MATMUL(b2,cell%bbmat),b1)   
      69           0 :                       th = phase*(0.5*r2*stars%ustep(in)+vpw(in,ispin))
      70             :                    ELSE
      71    26715452 :                       th = phase* (0.25* (lapw%rk(i,ispin)**2+lapw%rk(j,jspin)**2)*stars%ustep(in) + vpw(in,ispin))
      72             :                    ENDIF
      73             :                 ENDIF
      74             :                 !--->    determine matrix element and store
      75    30371490 :                 IF (hmat(1,1)%l_real) THEN
      76    18380308 :                    hmat(jjspin,iispin)%data_r(j,i0) = REAL(th)
      77    18380308 :                    smat(jjspin,iispin)%data_r(j,i0) = REAL(ts)
      78             :                 else
      79    11747184 :                    hmat(jjspin,iispin)%data_c(j,i0) = th
      80    11747184 :                    smat(jjspin,iispin)%data_c(j,i0) = ts
      81             :                 endif
      82             :              ENDDO
      83             :           ENDDO
      84             :           !$OMP END PARALLEL DO
      85             :        ENDDO
      86             :     ENDDO
      87             :   END SUBROUTINE hs_int
      88             : END MODULE m_hs_int

Generated by: LCOV version 1.13