get_off_diagonal_matel Function

public function get_off_diagonal_matel(det, ilut) result(offdiagH)


Type IntentOptional Attributes Name
integer, intent(in) :: det(nel)
integer(kind=n_int), intent(in) :: ilut(0:NIfTot)

Return Value real(kind=dp)


Source Code

    function get_off_diagonal_matel(det, ilut) result(offdiagH)
        ! Get the off-diagonal element between the reference determinant
        ! a determinant det with ilut representation ilut, but only if it
        ! would contribute to the projected energy.

        ! In:  det       - The determinant to evaluate
        !      ilut      - Bit representation
        ! Ret: offdiagH  - The off-diagonal matrix element
        integer, intent(in) :: det(nel)
        integer(n_int), intent(in) :: ilut(0:NIfTot)
        HElement_t(dp) :: offdiagH
        integer(n_int) :: ilut0(0:NIfTot)
        integer :: exlevel, det0(nel)

        ! We operate with the reference for run=1 here, which works for
        ! inum_runs==1 and inum_runs>1 with a common reference.  The projected
        ! energy for inum_runs>1 with different references is calculated
        ! separately anyway, so the return value does not get used.
        ilut0 = ilutRef(:,1)

        ! Get reference and excitation level with respect to it.
        call decode_bit_det(det0, ilut0)
        exlevel = FindBitExcitLevel(ilut0, ilut, t_hphf_ic=.true.)

        ! Compute matrix element depending on the calculation type.
        offdiagH = h_cast(0_dp)
        if (tGUGA) then
            ! TODO(@Oskar): Perhaps keep csf_i calculated?
            if (exlevel/=0) offdiagH = calc_off_diag_guga_ref(ilut, &
                CSF_Info_t(ilut), exlevel=exlevel)
            if (  exlevel==2 .or. &
                ( exlevel==1 .and. tNoBrillouin ) .or. &
                ( exlevel==3 .and. (t_3_body_excits .or. &
                                    t_ueg_3_body .or. &
                                    t_mol_3_body) ) ) then
                if (tHPHF) then
                    offdiagH = hphf_off_diag_helement(det0, det, ilut0, ilut)
                    offdiagH = get_helement(det, det0, exlevel, ilut, ilut0)
                end if
            end if
        end if

    end function get_off_diagonal_matel