init_GugaAliasSampler_t Subroutine

private subroutine init_GugaAliasSampler_t(this)

Type Bound



Type IntentOptional Attributes Name
class(GugaAliasSampler_t), intent(inout) :: this


Source Code

    subroutine init_GugaAliasSampler_t(this)
        class(GugaAliasSampler_t), intent(inout) :: this
        integer :: a, b
        integer(int64) :: memCost, ijMax, abMax, ab

        ! also set some more strict defaults for the PCHB implo:
        root_print "Setting reasonable defaults for GUGA-PCHB:"
        if (tau_search_method == possible_tau_search_methods%HISTOGRAMMING) then
            if (frq_ratio_cutoff < 0.999999) then
                root_print "setting frequency cutoff to 0.999999"
                frq_ratio_cutoff = 0.999999
            end if
            if (max_frequency_bound < 1e5) then
                root_print "setting  max_frequency_bound to 1e5"
                max_frequency_bound = 1e5
            end if
            if (n_frequency_bins < 1e5) then
                root_print "setting n_frequency_bins to 1e5"
                n_frequency_bins = 1e5
            end if
        end if

        if (.not. t_truncate_spawns) then
            root_print "'truncate-spawns' not activated! consider turning it &
                &on if too many blooms happen!"
        end if

        write(stdout,*) "Allocating GUGA PCHB excitation generator objects"
        ! initialize the mapping ab -> (a,b)
        abMax = fuseIndex(nSpatOrbs,nSpatOrbs)
        allocate(this%tgtOrbs(2,0:abMax), source = 0)
        do a = 1, nSpatOrbs
            do b = a, nSpatOrbs
                ab = fuseIndex(a,b)
                this%tgtOrbs(1,ab) = a
                this%tgtOrbs(2,ab) = b
            end do
        end do

        ! enable catching exceptions
        this%tgtOrbs(:,0) = 0

        ijMax = fuseIndex(nSpatOrbs, nSpatOrbs)
        memCost = abMax*ijMax*24*2
        write(stdout,*) "Excitation generator requires", &
            real(memCost,dp)/2.0_dp**30, "GB of memory"
        write(stdout,*) "Generating samplers for PCHB excitation generator"

        call this%setup_pchb_sampler_conditional()

        write(stdout,*) "Finished GUGA PCHB excitation generator initialization"
    end subroutine init_GugaAliasSampler_t