PropVec_doubles_PCHB_spinorb_init Subroutine

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

initalises the spinorb-resolved PCHB doubles excitation generator

more specifically, sets up a lookup table for ab -> (a,b) and sets up the alias table for picking ab given ij with prob ~ Hijab

Type Bound

PropVec_PCHB_DoublesSpinOrbFastWeightExcGen_t

Arguments

Type IntentOptional Attributes Name
class(PropVec_PCHB_DoublesSpinOrbFastWeightExcGen_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_spinorb_init(this, indexer, use_lookup, &
                            create_lookup, PCHB_particle_selection)
        !! initalises the spinorb-resolved PCHB doubles excitation generator
        !!
        !! more specifically, sets up a lookup table for ab -> (a,b) and
        !! sets up the alias table for picking ab given ij with prob ~ Hijab
        class(PropVec_PCHB_DoublesSpinOrbFastWeightExcGen_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_spinorb_init'

        integer :: AB, A, B, abMax, 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 supergroup lookup.')
            else
                write(stdout, *) 'PropVec PCHB (spinorb) doubles is creating and managing the supergroup lookup'
                allocate(lookup_property_indexer, source=this%indexer)
            end if
        end if
        if (this%use_lookup) write(stdout, *) 'PropVec PCHB doubles is using the supergroup lookup'

        write(stdout, *) "Allocating PCHB excitation generator objects"
        ! number of *spin* orbs
        nBI = nBasis
        ! 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)
                ! b comes first as this is an ordered list
                this%tgtOrbs(1, AB) = B
                this%tgtOrbs(2, AB) = A
            end do
        end do

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

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

    end subroutine PropVec_doubles_PCHB_spinorb_init