read_ci_coeff Subroutine

private subroutine read_ci_coeff(iCI, idxAlphaBetaOrbs, CI_coeff)

Arguments

Type IntentOptional Attributes Name
integer, intent(in) :: iCI
integer, intent(in) :: idxAlphaBetaOrbs(nbasis)
class(CI_coefficients_t), intent(out), allocatable :: CI_coeff(:)

Contents

Source Code


Source Code

    subroutine read_ci_coeff(iCI, idxAlphaBetaOrbs, CI_coeff)
        integer, intent(in) :: iCI, idxAlphaBetaOrbs(nbasis)
        class(CI_coefficients_t), allocatable, intent(out) :: CI_coeff(:)
        integer :: h, ex(2, n_store_ci_level), signCI, unit_CIav
        integer(n_int) :: hI
        real(dp) :: x

        if (iCI == 1) then
            allocate (singles_t :: CI_coeff(totEntCoeff(iCI, 2)) )
        else if (iCI == 2) then
            allocate (doubles_t :: CI_coeff(totEntCoeff(iCI, 2)) )
        else if (iCI == 3) then
            allocate (triples_t :: CI_coeff(totEntCoeff(iCI, 2)) )
        end if

        open (newunit=unit_CIav, file='ci_coeff_'//str(iCI)//'_av', &
              status='old', action='read')
        do hI = 1_n_int, totEntCoeff(iCI, 2)
            read (unit_CIav, *) x, (ex(1, h), ex(2, h), h=1, iCI)

            call idxPreSort(iCI, idxAlphaBetaOrbs, ex, signCI)

            select type (CI_coeff)
            type is (singles_t)
                CI_coeff(hI) = singles_t(signCI*x, i=ex(1, 1), a=ex(2, 1))
            type is (doubles_t)
                CI_coeff(hI) = doubles_t(signCI*x, i=ex(1, 1), a=ex(2, 1),&
                                                   j=ex(1, 2), b=ex(2, 2))
            type is (triples_t)
                CI_coeff(hI) = triples_t(signCI*x, i=ex(1, 1), a=ex(2, 1),&
                           j=ex(1, 2), b=ex(2, 2), k=ex(1, 3), c=ex(2, 3))
            end select
        end do
        close (unit_CIav)
    end subroutine read_ci_coeff