FlipSign Subroutine

public subroutine FlipSign(part_type)

Arguments

Type IntentOptional Attributes Name
integer, intent(in) :: part_type

Contents

Source Code


Source Code

    subroutine FlipSign(part_type)

        ! This routine flips the sign of all particles on the node with a
        ! given particle type. This allows us to keep multiple parallel
        ! simulations sign coherent.

        integer, intent(in) :: part_type
        character(*), parameter :: t_r = 'FlipSign'
        integer :: i
        real(dp) :: sgn

        do i = 1, int(TotWalkers)

            sgn = extract_part_sign(CurrentDets(:, i), part_type)
            sgn = -sgn
            call encode_part_sign(CurrentDets(:, i), sgn, part_type)

            ! Flip average signs too.
            if (tFillingStochRDMOnFly) then
                if (lenof_sign /= 1) &
                    call stop_all(t_r, 'Not yet implemented')
                call set_av_sgn_tot(i, -get_av_sgn_tot(i))
            end if

        end do

        ! Reverse the flag for whether the sign of the particles has been
        ! flipped so the ACF can be correctly calculated
        tFlippedSign = .not. tFlippedSign

    end subroutine FlipSign