VASPInitIntegrals Subroutine

subroutine VASPInitIntegrals(nOrbUsed, ECore, tOrder)

Arguments

Type IntentOptional Attributes Name
integer :: nOrbUsed
real(kind=dp) :: ECore
logical :: tOrder

Contents

Source Code


Source Code

subroutine VASPInitIntegrals(nOrbUsed, ECore, tOrder)
    use constants, only: dp, stdout
    use SystemData, only: BasisFN, nEl
    use OneEInts, only: TMatSym, TMatInd
    use vasp_interface
    use util_mod, only: stop_all
    use UMatCache, only: SetupUMatCache, UMat2D
    use global_utilities
    use constants, only: dp
    implicit none
    integer :: nOrbUsed
    real(dp) ::  ECore
    logical :: tOrder
    type(timer), save :: proc_timer
    integer :: I, J, II, A, B, nStatesUsed
    HElement_t(dp) :: HarXC, HarXCSum

    proc_timer%timer_name = 'VASPInitInts'
    call set_timer(proc_timer)
    ! ECore=EIonIon???
    ECore = 0.0_dp
    write(stdout, *) 'Core Energy: ', ECORE
    nStatesUsed = nOrbUsed / 2

    call SetupUMatCache(nStatesUsed, NSTATESUSED /= NSTATES)

#ifdef CMPLX_
    HarXCSum = cmplx(0.0_dp, 0.0_dp, dp)
#else
    HarXCSum = 0.0_dp
#endif
    write(stdout, *) "Calculating TMAT"
    open(10, file='TMAT', status='unknown')
    do I = 1, nStatesUsed
        ! Subtract out the double counting. Assume closed-shell.
#ifdef CMPLX_
        HarXC = cmplx(0.0_dp, 0.0_dp, dp)
#else
        HarXC = 0.0_dp
#endif
        do J = 1, nEl / 2
            if (I /= J) then
                A = min(I, J)
                B = max(I, J)
                HarXC = HarXC - (2) * UMat2D(A, B) + UMat2D(B, A)
            end if
            if (i <= j) HarXCSum = HarXCSum + HarXC
        end do
        II = I * 2 - 1
        TMATSYM(TMatInd(II + 1, II + 1)) = (eigv(I)) - HarXC
        write(10, *) I, J, TMATSYM(TMatInd(II + 1, II + 1))
    end do

    if (tOrder) then
        call Stop_All('VASPInitIntegrals', 'tOrder not implemented in VASP interface yet.')
    end if
    write(stdout, *) "Finished TMAT"
    close(10)

    call halt_timer(proc_timer)

    return
end subroutine VASPInitIntegrals