PropVec_doubles_PCHB_init Subroutine

private subroutine PropVec_doubles_PCHB_init(this, indexer, use_lookup, create_lookup, PCHB_particle_selection)

@brief Initialize the pchb excitation generator

@details This does two things: 1. setup the lookup table for the mapping ab -> (a,b) 2. setup the alias table for picking ab given ij with probability ~

Type Bound

PropVec_PCHB_DoublesSpatOrbFastWeightExcGen_t

Arguments

Type IntentOptional Attributes Name
class(PropVec_PCHB_DoublesSpatOrbFastWeightExcGen_t), intent(inout) :: this
class(PropertyIndexer_t), intent(in) :: indexer
logical, intent(in) :: use_lookup
logical, intent(in) :: create_lookup
type(PCHB_ParticleSelection_t), intent(in) :: PCHB_particle_selection

Source Code

    subroutine PropVec_doubles_PCHB_init(this, indexer, &
            use_lookup, create_lookup, PCHB_particle_selection)
        class(PropVec_PCHB_DoublesSpatOrbFastWeightExcGen_t), intent(inout) :: this
        class(PropertyIndexer_t), intent(in) :: indexer
        logical, intent(in) :: use_lookup, create_lookup
        type(PCHB_ParticleSelection_t), intent(in) :: PCHB_particle_selection
        character(*), parameter :: this_routine = 'PropVec_doubles_PCHB_init'

        integer :: ab, a, b, abMax
        integer :: nBI

        this%indexer = indexer
        this%create_lookup = create_lookup
        this%use_lookup = use_lookup

        if (this%create_lookup) then
            if (allocated(lookup_property_indexer)) then
                call stop_all(this_routine, 'Someone else is already managing the prop_vec lookup.')
            else
                write(stdout, *) 'PropVec PCHB (RHF) doubles is creating and managing the prop_vec lookup'
                allocate(lookup_property_indexer, source=this%indexer)
            end if
        end if
        if (this%use_lookup) write(stdout, *) 'PropVec PCHB doubles is using the prop_vec lookup'

        write(stdout, *) "Allocating PCHB excitation generator objects"
        ! number of spatial orbs
        nBI = numBasisIndices(this%indexer%n_spin_orbs())
        ! initialize the mapping ab -> (a, b)
        abMax = fuse_symm_idx(nBI, nBI)
        allocate(this%tgtOrbs(2, 0 : abMax), source=0)
        do a = 1, nBI
            do b = 1, a
                ab = fuse_symm_idx(a, b)
                this%tgtOrbs(1, ab) = b
                this%tgtOrbs(2, ab) = a
            end do
        end do

        ! setup the alias table
        call this%compute_samplers(nBI, PCHB_particle_selection)

        write(stdout, *) "Finished excitation generator initialization"

        ! this is some bias used internally by CreateSingleExcit - not used here
        pDoubNew = 0.0
    end subroutine PropVec_doubles_PCHB_init