LCOV - code coverage report
Current view: top level - wannier - wann_tlmw.f (source / functions) Hit Total Coverage
Test: combined.info Lines: 0 118 0.0 %
Date: 2019-09-08 04:53:50 Functions: 0 1 0.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_wann_tlmw
       8             :       use m_juDFT
       9             :       contains
      10           0 :       subroutine wann_tlmw(
      11           0 :      >               nwfs,lwf,mrwf,
      12           0 :      >               l_nocosoc,spi,jspin,
      13           0 :      <               tlmwf)
      14             : c*********************************************************************
      15             : c     Express the angular part of the trial orbital
      16             : c     in terms of spherical harmonics.
      17             : c     Y. Mokrousov
      18             : c*********************************************************************
      19             : c     Modifications for soc and noco.
      20             : c     Tidied-up version. 
      21             : c     Frank Freimuth
      22             : c*********************************************************************
      23             : 
      24             :       implicit none
      25             : 
      26             :       integer, intent (in)  :: nwfs
      27             :       integer, intent (in)  :: lwf(nwfs),mrwf(nwfs)
      28             :       logical, intent (in)  :: l_nocosoc
      29             :       integer, intent (in)  :: spi(nwfs),jspin
      30             :       complex, intent (out) :: tlmwf(0:3,-3:3,nwfs)
      31             : 
      32             :       integer   :: nwf,l,lr,mr,m,i,ii,j,jj
      33             :       complex   :: tlm(0:3,-3:3,1:7)
      34             :       complex   :: ic
      35             :       intrinsic :: cmplx,sqrt,cos,sin
      36             : 
      37           0 :       ic = cmplx(0.,1.)
      38             : 
      39             : c..in this part the 'primary' matrices for the basic non-hybridized
      40             : c..states are constructed, the coefficients are written to the tlm 
      41             : c..these coefficients arise due to the fact that the tws comprise the
      42             : c..real harmonics, while the wave functions operate in terms of normal 
      43             : c..ones
      44             : 
      45           0 :       tlm(:,:,:) = cmplx(0.,0.)
      46             : 
      47           0 :       do l = 0,3
      48             : 
      49           0 :          if (l.eq.0) then
      50             : c..s-state
      51           0 :            tlm(0,0,1) = cmplx(1.,0.)
      52             : 
      53           0 :          elseif (l.eq.1) then
      54             : c..pz-state
      55           0 :            tlm(1,0,1) = cmplx(1.,0.)
      56             : c..px-state
      57           0 :            tlm(1,-1,2) =  cmplx(1.,0.)/(sqrt(2.))
      58           0 :            tlm(1,1,2)  = -cmplx(1.,0.)/(sqrt(2.))
      59             : c..py-state
      60           0 :            tlm(1,-1,3) = ic/(sqrt(2.))              
      61           0 :            tlm(1,1,3)  = ic/(sqrt(2.))
      62             : 
      63           0 :          elseif (l.eq.2) then
      64             : c..dz2-state
      65           0 :            tlm(2,0,1) = cmplx(1.,0.)
      66             : c..dxz-state
      67           0 :            tlm(2,1,2)  = -cmplx(1.,0.)/(sqrt(2.))
      68           0 :            tlm(2,-1,2) = cmplx(1.,0.)/(sqrt(2.))
      69             : c..dyz-state
      70           0 :            tlm(2,1,3)  = ic/(sqrt(2.))
      71           0 :            tlm(2,-1,3) = ic/(sqrt(2.))
      72             : c..dx2-y2-state
      73           0 :            tlm(2,2,4)  =  cmplx(1.,0.)/(sqrt(2.))
      74           0 :            tlm(2,-2,4) =  cmplx(1.,0.)/(sqrt(2.))
      75             : c..dxy-state
      76           0 :            tlm(2,2,5)  = -ic/(sqrt(2.))
      77           0 :            tlm(2,-2,5) =  ic/(sqrt(2.))
      78             : 
      79             :          elseif (l.eq.3)then
      80             : c..
      81           0 :            tlm(3,0,1) = cmplx(1.,0.)
      82             : c..
      83           0 :            tlm(3,1,2)  = -cmplx(1.,0.)/(sqrt(2.))
      84           0 :            tlm(3,-1,2) = cmplx(1.,0.)/(sqrt(2.))
      85             : c..
      86           0 :            tlm(3,1,3)  = ic/(sqrt(2.))
      87           0 :            tlm(3,-1,3) = ic/(sqrt(2.))
      88             : c..
      89           0 :            tlm(3,2,4)  =  cmplx(1.,0.)/(sqrt(2.))
      90           0 :            tlm(3,-2,4) =  cmplx(1.,0.)/(sqrt(2.))
      91             : c..
      92           0 :            tlm(3,2,5)  = -ic/(sqrt(2.))
      93           0 :            tlm(3,-2,5) =  ic/(sqrt(2.))
      94             : c..
      95           0 :            tlm(3,3,6)  = -cmplx(1.,0.)/(sqrt(2.))
      96           0 :            tlm(3,-3,6) =  cmplx(1.,0.)/(sqrt(2.))
      97             : c..
      98           0 :            tlm(3,3,7)  =  ic/(sqrt(2.))
      99           0 :            tlm(3,-3,7) =  ic/(sqrt(2.))
     100             :          else
     101             :             CALL juDFT_error("no tlm for this l",calledby ="wann_tlmw")
     102             :          endif
     103             : 
     104             :       enddo
     105             : 
     106             : c..now we are ready for more complex hybridized states, which
     107             : c..correspond to the negative values of lwf
     108             : 
     109           0 :       tlmwf(:,:,:) = cmplx(0.,0.)
     110             : 
     111           0 :       do nwf = 1,nwfs
     112             :          
     113           0 :          if( ((3-2*jspin).ne.spi(nwf)).and.l_nocosoc ) cycle
     114             : 
     115           0 :          lr = lwf(nwf)
     116           0 :          mr = mrwf(nwf)
     117             : 
     118           0 :          if (lr.ge.0) then
     119           0 :                tlmwf(lr,:,nwf) = tlm(lr,:,mr)  
     120           0 :          elseif (lr.eq.-1) then
     121             : 
     122           0 :             if (mr.eq.1) then
     123             : c..sp-1
     124           0 :               tlmwf(0,:,nwf) =  (1./(sqrt(2.)))*tlm(0,:,1)
     125           0 :               tlmwf(1,:,nwf) =  (1./(sqrt(2.)))*tlm(1,:,2)
     126           0 :             elseif (mr.eq.2) then
     127             : c..sp-2
     128           0 :               tlmwf(0,:,nwf) =  (1./(sqrt(2.)))*tlm(0,:,1)
     129           0 :               tlmwf(1,:,nwf) = -(1./(sqrt(2.)))*tlm(1,:,2)
     130             :             endif 
     131             : 
     132           0 :          elseif (lr.eq.-2) then
     133             :               
     134           0 :             if (mr.eq.1) then
     135             : c..sp2-1
     136           0 :               tlmwf(0,:,nwf) =  (1./(sqrt(3.)))*tlm(0,:,1)
     137             :               tlmwf(1,:,nwf) = -(1./(sqrt(6.)))*tlm(1,:,2) +
     138           0 :      +                          (1./(sqrt(2.)))*tlm(1,:,3)
     139           0 :             elseif (mr.eq.2) then
     140             : c..sp2-2
     141           0 :               tlmwf(0,:,nwf) =  (1./(sqrt(3.)))*tlm(0,:,1)
     142             :               tlmwf(1,:,nwf) = -(1./(sqrt(6.)))*tlm(1,:,2)
     143           0 :      +                         -(1./(sqrt(2.)))*tlm(1,:,3)
     144           0 :             elseif (mr.eq.3) then
     145             : c..sp2-3
     146           0 :               tlmwf(0,:,nwf) =  (1./(sqrt(3.)))*tlm(0,:,1)
     147           0 :               tlmwf(1,:,nwf) =  (2./(sqrt(6.)))*tlm(1,:,2)
     148             :             endif
     149             : 
     150           0 :          elseif (lr.eq.-3) then
     151             : 
     152           0 :             if (mr.eq.1) then
     153             : c..sp3-1
     154           0 :               tlmwf(0,:,nwf) = 0.5*tlm(0,:,1) 
     155           0 :               tlmwf(1,:,nwf) = 0.5*( tlm(1,:,2)+tlm(1,:,3)+tlm(1,:,1) ) 
     156           0 :             elseif (mr.eq.2) then
     157             : c..sp3-2
     158           0 :               tlmwf(0,:,nwf) = 0.5*tlm(0,:,1) 
     159           0 :               tlmwf(1,:,nwf) = 0.5*( tlm(1,:,2)-tlm(1,:,3)-tlm(1,:,1) ) 
     160           0 :             elseif (mr.eq.3) then
     161             : c..sp3-4
     162           0 :               tlmwf(0,:,nwf) = 0.5*tlm(0,:,1) 
     163           0 :               tlmwf(1,:,nwf) = 0.5*(-tlm(1,:,2)+tlm(1,:,3)-tlm(1,:,1) ) 
     164           0 :             elseif (mr.eq.4) then
     165             : c..sp3-4
     166           0 :               tlmwf(0,:,nwf) = 0.5*tlm(0,:,1) 
     167           0 :               tlmwf(1,:,nwf) = 0.5*(-tlm(1,:,2)-tlm(1,:,3)+tlm(1,:,1) ) 
     168             :             endif  
     169             : 
     170           0 :          elseif (lr.eq.-4) then
     171             : 
     172           0 :             if (mr.eq.1) then
     173             : c..sp3d-1
     174           0 :               tlmwf(0,:,nwf) =  (1./(sqrt(3.)))*tlm(0,:,1)
     175             :               tlmwf(1,:,nwf) = -(1./(sqrt(6.)))*tlm(1,:,2) 
     176           0 :      &                         +(1./(sqrt(2.)))*tlm(1,:,3)
     177           0 :             elseif (mr.eq.2) then
     178             : c..sp3d-2
     179           0 :               tlmwf(0,:,nwf) =  (1./(sqrt(3.)))*tlm(0,:,1)
     180             :               tlmwf(1,:,nwf) = -(1./(sqrt(6.)))*tlm(1,:,2)
     181           0 :      &                         -(1./(sqrt(2.)))*tlm(1,:,3)            
     182           0 :             elseif (mr.eq.3) then 
     183             : c..sp3d-3
     184           0 :               tlmwf(0,:,nwf) =  (1./(sqrt(3.)))*tlm(0,:,1)
     185           0 :               tlmwf(1,:,nwf) =  (2./(sqrt(6.)))*tlm(1,:,2)
     186           0 :             elseif (mr.eq.4) then
     187             : c..sp3d-4
     188           0 :               tlmwf(1,:,nwf) =  (1./(sqrt(2.)))*tlm(1,:,1)
     189           0 :               tlmwf(2,:,nwf) =  (1./(sqrt(2.)))*tlm(2,:,1)
     190           0 :             elseif (mr.eq.5) then
     191             : c..sp3d-5
     192           0 :               tlmwf(1,:,nwf) = -(1./(sqrt(2.)))*tlm(1,:,1)
     193           0 :               tlmwf(2,:,nwf) =  (1./(sqrt(2.)))*tlm(2,:,1)
     194             :             endif 
     195             : 
     196           0 :          elseif (lr.eq.-5) then
     197             : 
     198           0 :             if (mr.eq.1) then
     199             : c..sp3d2-1
     200           0 :               tlmwf(0,:,nwf) =  (1./(sqrt(6.)))*tlm(0,:,1)
     201           0 :               tlmwf(1,:,nwf) = -(1./(sqrt(2.)))*tlm(1,:,2)
     202             :               tlmwf(2,:,nwf) = -(1./(sqrt(12.)))*tlm(2,:,1)
     203           0 :      &                         +0.5*tlm(2,:,4) 
     204           0 :             elseif (mr.eq.2) then
     205             : c..sp3d2-2
     206           0 :               tlmwf(0,:,nwf) =  (1./(sqrt(6.)))*tlm(0,:,1)
     207           0 :               tlmwf(1,:,nwf) =  (1./(sqrt(2.)))*tlm(1,:,2)
     208             :               tlmwf(2,:,nwf) = -(1./(sqrt(12.)))*tlm(2,:,1)
     209           0 :      &                         +0.5*tlm(2,:,4) 
     210           0 :             elseif (mr.eq.3) then
     211             : c..sp3d2-3
     212           0 :               tlmwf(0,:,nwf) =  (1./(sqrt(6.)))*tlm(0,:,1)
     213           0 :               tlmwf(1,:,nwf) = -(1./(sqrt(2.)))*tlm(1,:,3)
     214             :               tlmwf(2,:,nwf) = -(1./(sqrt(12.)))*tlm(2,:,1)
     215           0 :      &                         -0.5*tlm(2,:,4) 
     216           0 :             elseif (mr.eq.4) then
     217             : c..sp3d2-4
     218           0 :               tlmwf(0,:,nwf) =  (1./(sqrt(6.)))*tlm(0,:,1)
     219           0 :               tlmwf(1,:,nwf) =  (1./(sqrt(2.)))*tlm(1,:,3)
     220             :               tlmwf(2,:,nwf) = -(1./(sqrt(12.)))*tlm(2,:,1)
     221           0 :      &                         -0.5*tlm(2,:,4) 
     222           0 :             elseif (mr.eq.5) then
     223             : c..sp3d2-5
     224           0 :               tlmwf(0,:,nwf) =  (1./(sqrt(6.)))*tlm(0,:,1)
     225           0 :               tlmwf(1,:,nwf) = -(1./(sqrt(2.)))*tlm(1,:,1)
     226           0 :               tlmwf(2,:,nwf) =  (1./(sqrt(3.)))*tlm(2,:,1)
     227           0 :             elseif (mr.eq.6) then
     228             : c..sp3d2-5
     229           0 :               tlmwf(0,:,nwf) =  (1./(sqrt(6.)))*tlm(0,:,1)
     230           0 :               tlmwf(1,:,nwf) =  (1./(sqrt(2.)))*tlm(1,:,1)
     231           0 :               tlmwf(2,:,nwf) =  (1./(sqrt(3.)))*tlm(2,:,1)
     232             :             endif
     233             : 
     234             :          else
     235           0 :             CALL juDFT_error("no tlmw for this lr",calledby="wann_tlmw")
     236             :          endif
     237             : 
     238             :       enddo
     239             : 
     240           0 :       end subroutine wann_tlmw
     241             :       end module m_wann_tlmw

Generated by: LCOV version 1.13