rescale_spawns Subroutine

public subroutine rescale_spawns(ValidSpawned, proj_energy, iter_data)

Arguments

Type IntentOptional Attributes Name
integer, intent(in) :: ValidSpawned
real(kind=dp), intent(in) :: proj_energy(lenof_sign)
type(fcimc_iter_data), intent(inout) :: iter_data

Contents

Source Code


Source Code

    subroutine rescale_spawns(ValidSpawned, proj_energy, iter_data)

        integer, intent(in) :: ValidSpawned
        real(dp), intent(in) :: proj_energy(lenof_sign)
        type(fcimc_iter_data), intent(inout) :: iter_data

        integer :: i, run
        real(dp) :: spwnsign(lenof_sign), hdiag

        ! Find the weight spawned on the Hartree--Fock determinant.
        if (tSemiStochastic) then
            do run = 1, size(cs_replicas)
                associate(rep => cs_replicas(run))
                    do i = 1, rep%determ_sizes(iProcIndex)
                        rep%partial_determ_vecs(:, i) = rep%partial_determ_vecs(:, i) / &
                                                        (rep%core_ham_diag(i) - proj_energy - proje_ref_energy_offsets)
                    end do
                end associate
            end do
        end if

        do i = 1, ValidSpawned
            hdiag = extract_spawn_hdiag(SpawnedParts(:, i))

            call extract_sign(SpawnedParts(:, i), spwnsign)
            spwnsign = spwnsign / (hdiag - proj_energy - proje_ref_energy_offsets - Hii)
            call encode_sign(SpawnedParts(:, i), spwnsign)

            iter_data%nborn = iter_data%nborn + abs(spwnsign)
        end do

    end subroutine rescale_spawns