gather_energies Subroutine

public subroutine gather_energies(this, energy, frag_code)

gather MM energies from clients

Arguments

TypeIntentOptionalAttributesName
class(mimic_communicator), intent(inout) :: this
real(kind=dp), intent(out) :: energy

resulting total MM energy

type(subsystem_type), intent(in), dimension(:):: frag_code

mapping of fragments per code


Contents

Source Code


Source Code

subroutine gather_energies(this, energy, frag_code)

    class(mimic_communicator), intent(inout) :: this
    !> resulting total MM energy
    real(dp), intent(out) :: energy
    !> mapping of fragments per code
    type(subsystem_type), dimension(:), intent(in) :: frag_code

    integer :: n_code
    real(kind=dp), target :: temp_energy

    temp_energy = 0.0_dp
    energy = 0.0_dp
    do n_code = 1, this%num_clients
        temp_energy = 0.0_dp
        call this%send_command(MCL_SEND_ENERGY, n_code)
        call mcl_receive(temp_energy, 1, MCL_DATA, n_code)
        energy = energy + frag_code(n_code)%factor * temp_energy
    end do

end subroutine gather_energies