sointg.f90 1.88 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43
MODULE m_sointg
  !*********************************************************************
  !     compute radial spin-orbit integrant
  !*********************************************************************
CONTAINS
  SUBROUTINE sointg(ntyp,e,vr,v0,atoms,input, vso)
    !
    USE m_differentiate,ONLY:diff3
    USE m_constants,ONLY: c_light
    USE m_types
    IMPLICIT NONE

    TYPE(t_input),INTENT(IN)   :: input
    TYPE(t_atoms),INTENT(IN)   :: atoms
    !     ..
    !     .. Scalar Arguments ..
    INTEGER,INTENT(IN)   :: ntyp
    REAL,    INTENT (IN) :: e
    !     ..
    !     .. Array Arguments ..
    REAL, INTENT (IN)  ::  v0(atoms%jri(ntyp))
    REAL, INTENT (IN)  ::  vr(atoms%jmtd,input%jspins)
    REAL, INTENT (OUT) :: vso(atoms%jmtd,2)
    !     ..
    !     .. Local Scalars ..
    REAL dr,dxv,r,cin2
    INTEGER i,jspin
    !     ..
    !     .. Local Arrays ..
    REAL dv(atoms%jri(ntyp)),xmrel(atoms%jri(ntyp))
    !     ..
    !     ..
    cin2 = 1.0/c_light(1.0)**2
    dr = EXP(atoms%dx(ntyp))
    r = atoms%rmsh(1,ntyp)
    !
    !---> relativistic mass:
    DO i = 1,atoms%jri(ntyp)
       xmrel(i) = 1. + (e-v0(i)/r)/2.*cin2
       r = r*dr
    END DO
    !---> potential derivative (on logarithmic mesh) : v0 := r*v

Daniel Wortmann's avatar
Daniel Wortmann committed
44
    CALL diff3(vr(:atoms%jri(ntyp),1),atoms%dx(ntyp),dv)
45 46 47 48 49 50 51 52 53
    !
    r = atoms%rmsh(1,ntyp)
    DO i = 1,atoms%jri(ntyp)
       dxv = (dv(i) - vr(i,1))/(r**3)
       vso(i,2) = cin2*dxv/(4.*xmrel(i)**2)
       r = r*dr
    END DO

    IF (input%jspins.EQ.2) THEN
Daniel Wortmann's avatar
Daniel Wortmann committed
54
       CALL diff3(vr(:atoms%jri(ntyp),input%jspins),atoms%dx(ntyp), dv)
55 56 57 58 59 60 61 62 63 64 65 66 67 68 69
       !
       r = atoms%rmsh(1,ntyp)
       DO i = 1,atoms%jri(ntyp)
          dxv = (dv(i) - vr(i,input%jspins))/(r**3)
          vso(i,1) = cin2*dxv/(4.*xmrel(i)**2)
          r = r*dr
       END DO
    ELSE 
       DO i = 1,atoms%jri(ntyp)
          vso(i,1) =  vso(i,2)
       END DO
    ENDIF

  END SUBROUTINE sointg
END MODULE m_sointg