orbMagMoms.f90 2.68 KB
Newer Older
1 2 3 4 5 6
!--------------------------------------------------------------------------------
! Copyright (c) 2018 Peter Grünberg Institut, Forschungszentrum Jülich, Germany
! This file is part of FLEUR and available as free software under the conditions
! of the MIT license as expressed in the LICENSE file in more detail.
!--------------------------------------------------------------------------------

7 8 9 10
MODULE m_orbMagMoms

CONTAINS

11
SUBROUTINE orbMagMoms(input,atoms,noco,clmom)
12 13 14 15 16 17

   USE m_types
   USE m_xmlOutput

   IMPLICIT NONE

18
   TYPE(t_input), INTENT(IN) :: input
19 20 21
   TYPE(t_atoms), INTENT(IN)     :: atoms
   TYPE(t_noco), INTENT(IN)      :: noco

22
   REAL, INTENT(INOUT)           :: clmom(3,atoms%ntype,input%jspins)
23 24 25 26 27

   INTEGER                       :: iType, j
   REAL                          :: thetai, phii, slmom, slxmom, slymom
   CHARACTER(LEN=20)             :: attributes(4)

28
   
29 30
   thetai = noco%theta
   phii   = noco%phi
31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71
   WRITE (6,FMT=9020)
   CALL openXMLElement('orbitalMagneticMomentsInMTSpheres',(/'units'/),(/'muBohr'/))
   DO iType = 1, atoms%ntype
      IF (noco%l_noco) THEN
         thetai = noco%beta(iType)
         phii   = noco%alph(iType)
      END IF

      ! magn. moment(-)
      slxmom = clmom(1,iType,1)+clmom(1,iType,2)
      slymom = clmom(2,iType,1)+clmom(2,iType,2)
      slmom =  clmom(3,iType,1)+clmom(3,iType,2)

      ! rotation: orbital moment || spin moment (extended to incude phi - hopefully)
      slmom   = cos(thetai)*slmom + sin(thetai)*(cos(phii)*slxmom + sin(phii)*slymom)
      clmom(3,iType,1) = cos(thetai)*clmom(3,iType,1) + &
                         sin(thetai)*(cos(phii)*clmom(1,iType,1) + &
                         sin(phii)*clmom(2,iType,1))
      clmom(3,iType,2) = cos(thetai)*clmom(3,iType,2) + &
                         sin(thetai)*(cos(phii)*clmom(1,iType,2) + &
                         sin(phii)*clmom(2,iType,2))

      WRITE (6,FMT=8030) iType,slmom,(clmom(3,iType,j),j=1,2)
      attributes = ''
      WRITE(attributes(1),'(i0)') iType
      WRITE(attributes(2),'(f15.10)') slmom
      WRITE(attributes(3),'(f15.10)') clmom(3,iType,1)
      WRITE(attributes(4),'(f15.10)') clmom(3,iType,2)
      CALL writeXMLElementFormPoly('orbMagMoment',(/'atomType      ','moment        ','spinUpCharge  ',&
                                                    'spinDownCharge'/),&
                                   attributes,reshape((/8,6,12,14,6,15,15,15/),(/4,2/)))
   END DO
   CALL closeXMLElement('orbitalMagneticMomentsInMTSpheres')

   9020 FORMAT (/,/,10x,'orb. magnetic moments in the spheres:',/,10x,&
                'type',t22,'moment',t33,'spin-up',t43,'spin-down')
   8030 FORMAT (2x,'--> mm',i8,2x,3f12.5)

END SUBROUTINE orbMagMoms

END MODULE m_orbMagMoms