scale_rdm Subroutine

public subroutine scale_rdm(rdm, scale_factor)

Arguments

Type IntentOptional Attributes Name
type(rdm_list_t), intent(inout) :: rdm
real(kind=dp) :: scale_factor(rdm%sign_length)

Contents

Source Code


Source Code

    subroutine scale_rdm(rdm, scale_factor)
        ! rescale all entries of one rdm by a scale factor
        ! required in the adaptive shift correction, where a weighted sum
        ! of two rdms is taken
        implicit none
        type(rdm_list_t), intent(inout) :: rdm
        real(dp) :: scale_factor(rdm%sign_length)

        integer :: i, j
        real(dp) :: tmp_sign(rdm%sign_length)

        do i = 1, rdm%nelements
            call extract_sign_rdm(rdm%elements(:, i), tmp_sign)
            tmp_sign = tmp_sign * scale_factor
            call encode_sign_rdm(rdm%elements(:, i), tmp_sign)
        end do
    end subroutine scale_rdm