init_excitgen_test Subroutine

public subroutine init_excitgen_test(ref_det, fcidump_writer, setdefaults)

Arguments

Type IntentOptional Attributes Name
integer, intent(in) :: ref_det(:)
class(FciDumpWriter_t), intent(in) :: fcidump_writer
logical, intent(in), optional :: setdefaults

whether or not to set the default flags in this function IMO this should be done using test fixtures and not in this function, but much of the existing tests rely on it being here


Contents

Source Code


Source Code

    subroutine init_excitgen_test(ref_det, fcidump_writer, setdefaults)
        ! mimic the initialization of an FCIQMC calculation to the point where we can generate
        ! excitations with a weighted excitgen
        ! This requires setup of the basis, the symmetries and the integrals
        integer, intent(in) :: ref_det(:)
        class(FciDumpWriter_t), intent(in) :: fcidump_writer
        logical, optional, intent(in) :: setdefaults
            !! whether or not to set the default flags in this function
            !! IMO this should be done using test fixtures and not in this function,
            !! but much of the existing tests rely on it being here
        logical :: setdefaults_
        integer :: nBasisMax(5, 3), lms
        integer(int64) :: umatsize
        real(dp) :: ecore
        character(*), parameter :: this_routine = 'init_excitgen_test'
        integer, parameter :: seed = 25

        def_default(setdefaults_, setdefaults, .true.)

        umatsize = 0
        nel = size(ref_det)

        IlutBits%len_orb = 0
        IlutBits%ind_pop = 1
        IlutBits%len_pop = 1
        IlutBits%len_tot = 2

        nifd = 0
        NIfTot = 2

        fcidump_name = "FCIDUMP"
        UMatEps = 1.0e-8
        if (tUHF .and. tMolpro) then
            tStoreSpinOrbs = .true.
        else
            tStoreSpinOrbs = .false.
        end if
        tTransGTID = .false.
        tReadFreeFormat = .true.

        call dSFMT_init(seed)

        if (setdefaults_) then
            call SetCalcDefaults()
            call SetSysDefaults()
        end if
        tReadInt = .true.

        call fcidump_writer%write()

        get_umat_el => get_umat_el_normal

        call initfromfcid(nel, nbasismax, nBasis, lms, .false.)

        call GetUMatSize(nBasis, umatsize)

        allocate(TMat2d(nBasis, nBasis))

        call shared_allocate_mpi(umat_win, umat, [umatsize])

        UMat = h_cast(0._dp)
        call readfciint(UMat, umat_win, nBasis, ecore)

        ! init the umat2d storage
        call setupUMat2d_dense(nBasis)

        call SysInit()
        ! required: set up the spin info

        call DetInit()
        ! call SpinOrbSymSetup()

        tDefineDet = .true.
        DefDet = ref_det
        call DetPreFreezeInit()

        call CalcInit()

        call set_ref()

        t_pcpp_excitgen = .true.
        call init_excit_gen_store(fcimc_excit_gen_store)

        call init_bit_rep()
    end subroutine init_excitgen_test