create_overlap_pert_vec Subroutine

private subroutine create_overlap_pert_vec()




Source Code

    subroutine create_overlap_pert_vec()

        ! Read in the popsfile and apply perturbation operator overlap_pert.

        use FciMCData, only: TotWalkers, CurrentDets
        use PopsfileMod, only: read_popsfile_wrapper
        use util_mod, only: int_fmt

        integer :: mem_reqd, ierr
        character(len=*), parameter :: t_r = "create_overlap_pert_vec"

        if (allocated(perturbed_ground)) deallocate(perturbed_ground)

        ! Once this is finished, the vector that we want will be stored in
        ! CurrentDets. The total number of determinants will be TotWalkers.
        call read_popsfile_wrapper(overlap_pert)

        ! Print info about memory usage to the user.
        ! Memory required in MB.
        mem_reqd = int(TotWalkers / 1000000_int64) * (NIfTotKP + 1) * size_n_int

        write(stdout, '(a73,'//int_fmt(mem_reqd, 1)//')') "About to allocate array to hold the perturbed &
                                           &ground state. Memory required (MB):", mem_reqd
        write(stdout, '(a13)', advance='no') "Allocating..."
        call neci_flush(stdout)
        allocate(perturbed_ground(0:NIfTot, TotWalkers), stat=ierr)
        if (ierr /= 0) then
            write(stdout, '(1x,a11,1x,i5)') "Error code:", ierr
            call stop_all(t_r, "Error allocating array.")
            write(stdout, '(1x,a5)') "Done."
        end if
        call neci_flush(stdout)

        perturbed_ground = CurrentDets(0:NIfTot, 1:TotWalkers)

    end subroutine create_overlap_pert_vec