add_trial_energy_contrib Subroutine

public subroutine add_trial_energy_contrib(ilut, RealwSign, ireplica)

Arguments

Type IntentOptional Attributes Name
integer(kind=n_int), intent(in) :: ilut(0:)
real(kind=dp), intent(in) :: RealwSign
integer, intent(in) :: ireplica

Contents


Source Code

    subroutine add_trial_energy_contrib(ilut, RealwSign, ireplica)

        integer(n_int), intent(in) :: ilut(0:)
        real(dp), intent(in) :: RealwSign
        integer, intent(in) :: ireplica

        integer :: i, hash_val
        integer :: nI(nel)
        real(dp) :: amp(ntrial_excits)

        call decode_bit_det(nI, ilut)

        ! First search the trial space.
        if (trial_space_size > 0) then
            hash_val = FindWalkerHash(nI, trial_space_size)
            do i = 1, trial_ht(hash_val)%nclash
                if (DetBitEq(trial_ht(hash_val)%states(0:nifd, i), ilut)) then
                    amp = transfer(trial_ht(hash_val)%states(IlutBits%ind_pop:, i), amp)
                    if (ntrial_excits == 1) then
                        trial_denom(ireplica) = trial_denom(ireplica) + amp(1) * RealwSign
                    else if (ntrial_excits == lenof_sign) then
                        trial_denom(ireplica) = trial_denom(ireplica) + amp(ireplica) * RealwSign
                    end if
                    return
                end if
            end do
        end if

        ! If not in the trial space, search the connected space.
        if (con_space_size > 0) then
            hash_val = FindWalkerHash(nI, con_space_size)
            do i = 1, con_ht(hash_val)%nclash
                if (DetBitEq(con_ht(hash_val)%states(0:nifd, i), ilut)) then
                    amp = transfer(con_ht(hash_val)%states(IlutBits%ind_pop:, i), amp)
                    if (ntrial_excits == 1) then
                        trial_numerator(ireplica) = trial_numerator(ireplica) + amp(1) * RealwSign
                    else if (ntrial_excits == lenof_sign) then
                        trial_numerator(ireplica) = trial_numerator(ireplica) + amp(ireplica) * RealwSign
                    end if
                    return
                end if
            end do
        end if

    end subroutine add_trial_energy_contrib