LCOV - code coverage report
Current view: top level - cdn_mt - orbMagMoms.f90 (source / functions) Hit Total Coverage
Test: combined.info Lines: 25 26 96.2 %
Date: 2019-09-08 04:53:50 Functions: 1 2 50.0 %

          Line data    Source code
       1             : !--------------------------------------------------------------------------------
       2             : ! Copyright (c) 2018 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_orbMagMoms
       8             : 
       9             : CONTAINS
      10             : 
      11          44 : SUBROUTINE orbMagMoms(input,atoms,noco,clmom)
      12             : 
      13             :    USE m_types
      14             :    USE m_xmlOutput
      15             : 
      16             :    IMPLICIT NONE
      17             : 
      18             :    TYPE(t_input), INTENT(IN) :: input
      19             :    TYPE(t_atoms), INTENT(IN)     :: atoms
      20             :    TYPE(t_noco), INTENT(IN)      :: noco
      21             : 
      22             :    REAL, INTENT(INOUT)           :: clmom(3,atoms%ntype,input%jspins)
      23             : 
      24             :    INTEGER                       :: iType, j
      25             :    REAL                          :: thetai, phii, slmom, slxmom, slymom
      26             :    CHARACTER(LEN=20)             :: attributes(4)
      27             : 
      28             :    
      29          44 :    thetai = noco%theta
      30          44 :    phii   = noco%phi
      31          44 :    WRITE (6,FMT=9020)
      32          44 :    CALL openXMLElement('orbitalMagneticMomentsInMTSpheres',(/'units'/),(/'muBohr'/))
      33         130 :    DO iType = 1, atoms%ntype
      34             :       ! magn. moment(-)
      35          86 :       slxmom = clmom(1,iType,1)+clmom(1,iType,2)
      36          86 :       slymom = clmom(2,iType,1)+clmom(2,iType,2)
      37          86 :       slmom =  clmom(3,iType,1)+clmom(3,iType,2)
      38             : 
      39          86 :       IF (noco%l_noco) THEN
      40          80 :          thetai = noco%beta(iType)
      41          80 :          phii   = noco%alph(iType)
      42             : 
      43             :          !Fix of sign of moment in first variation calculations. Perhaps it would be better to understand this :-(
      44             :          !slxmom=-1*slxmom
      45          80 :          slymom=-1*slymom
      46             :          !slmom=-1*slmom
      47             :       END IF
      48             : 
      49             :       ! rotation: orbital moment || spin moment (extended to incude phi - hopefully)
      50          86 :       slmom   = cos(thetai)*slmom + sin(thetai)*(cos(phii)*slxmom + sin(phii)*slymom)
      51             :       clmom(3,iType,1) = cos(thetai)*clmom(3,iType,1) + &
      52             :                          sin(thetai)*(cos(phii)*clmom(1,iType,1) + &
      53          86 :                          sin(phii)*clmom(2,iType,1))
      54             :       clmom(3,iType,2) = cos(thetai)*clmom(3,iType,2) + &
      55             :                          sin(thetai)*(cos(phii)*clmom(1,iType,2) + &
      56          86 :                          sin(phii)*clmom(2,iType,2))
      57             : 
      58          86 :       WRITE (6,FMT=8030) iType,slmom,(clmom(3,iType,j),j=1,2)
      59         430 :       attributes = ''
      60          86 :       WRITE(attributes(1),'(i0)') iType
      61          86 :       WRITE(attributes(2),'(f15.10)') slmom
      62          86 :       WRITE(attributes(3),'(f15.10)') clmom(3,iType,1)
      63          86 :       WRITE(attributes(4),'(f15.10)') clmom(3,iType,2)
      64             :       CALL writeXMLElementFormPoly('orbMagMoment',(/'atomType      ','moment        ','spinUpCharge  ',&
      65             :                                                     'spinDownCharge'/),&
      66         130 :                                    attributes,reshape((/8,6,12,14,6,15,15,15/),(/4,2/)))
      67             :    END DO
      68          44 :    CALL closeXMLElement('orbitalMagneticMomentsInMTSpheres')
      69             : 
      70             :    9020 FORMAT (/,/,10x,'orb. magnetic moments in the spheres:',/,10x,&
      71             :                 'type',t22,'moment',t33,'spin-up',t43,'spin-down')
      72             :    8030 FORMAT (2x,'--> mm',i8,2x,3f12.5)
      73             : 
      74          44 : END SUBROUTINE orbMagMoms
      75             : 
      76           0 : END MODULE m_orbMagMoms

Generated by: LCOV version 1.13