init_excitgen_test Subroutine

public subroutine init_excitgen_test(ref_det, fcidump_writer, setdefaults)

Uses

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


Source Code

    subroutine init_excitgen_test(ref_det, fcidump_writer, setdefaults)
        use SystemData, only: lms
        ! 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)
        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
        tStoreSpinOrbs = tZeroDelimitedFCIDUMP
        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

        user_input_m_s = sum(merge(1, -1, mod(ref_det, 2) == 0))
        call evaluate_depending_keywords()

        tIgnoreFCIDUMPHeader = .true.
        call initfromfcid(nel, nbasismax, nBasis, lms, .false.)

        nSpatOrbs = nBasis .div. 2
        nSpatOrbs_i8 = int(nBasis .div. 2, int64)
        ij_pairs = fuse_symm_idx(nSpatOrbs_i8, nSpatOrbs_i8)

        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