communicate_cc_amps Subroutine

private subroutine communicate_cc_amps(n_excits)

Arguments

Type IntentOptional Attributes Name
integer, intent(in) :: n_excits(cc_order)

Contents

Source Code


Source Code

    subroutine communicate_cc_amps(n_excits)
        integer, intent(in) :: n_excits(cc_order)

        integer :: i, j
        ! only deal with systems with no single excitations, so we just
        ! have to communicate the doubles!
        allocate(all_cc_ops(2))

        do i = 1, 2
            all_cc_ops(i)%order = i
            allocate(all_cc_ops(i)%amplitudes(n_excits(i)))
            allocate(all_cc_ops(i)%operators(n_excits(i), 2, i))
            allocate(all_cc_ops(i)%set_flag(n_excits(i)))

            all_cc_ops(i)%operators = 0
            all_cc_ops(i)%amplitudes = 0.0_dp
            all_cc_ops(i)%set_flag = 0

            all_cc_ops(i)%n_ops = n_excits(i)

            call MPIReduce(cc_ops(i)%amplitudes, MPI_SUM, all_cc_ops(i)%amplitudes)
            do j = 1, i
                call MPIReduce(cc_ops(i)%operators(:, :, j), MPI_SUM, all_cc_ops(i)%operators(:, :, j))
            end do

            call MPIReduce(cc_ops(i)%set_flag, MPI_SUM, all_cc_ops(i)%set_flag)
        end do

        ! i just want to store up to triples or? but for these special
        ! case only consider systems with no single excitations..

    end subroutine communicate_cc_amps