mimic_compute_energy Subroutine

public subroutine mimic_compute_energy(subsystems, quantum_fragment, energy, sr_atom_start, sr_atom_end, tensor_sums)

compute interaction energy

Arguments

TypeIntentOptionalAttributesName
type(subsystem_type), intent(inout), dimension(:):: subsystems

array of subsystems associated with client codes

type(quantum_fragment_type), intent(inout) :: quantum_fragment

quantum subsystem

real(kind=dp), intent(out) :: energy

interaction energy

integer, intent(in), dimension(:):: sr_atom_start

index of the first short-range atom for this process

integer, intent(in), dimension(:):: sr_atom_end

index of the last short-range atom for this process

real(kind=dp), intent(in), dimension(:,:), allocatable:: tensor_sums

Array stroing tensor sums


Contents

Source Code


Source Code

subroutine mimic_compute_energy(subsystems, &
                              quantum_fragment, &
                              energy, &
                              sr_atom_start, &
                              sr_atom_end, &
                              tensor_sums)

    !> array of subsystems associated with client codes
    type(subsystem_type), dimension(:), intent(inout) :: subsystems
    !> quantum subsystem
    type(quantum_fragment_type), intent(inout) :: quantum_fragment
    !> interaction energy
    real(dp), intent(out) :: energy
    !> index of the first short-range atom for this process
    integer, dimension(:), intent(in) :: sr_atom_start
    !> index of the last short-range atom for this process
    integer, dimension(:), intent(in) :: sr_atom_end
    !> Array stroing tensor sums
    real(dp), dimension(:,:), intent(in), allocatable :: tensor_sums

    integer :: i
    real(dp) :: temp_energy

    call timer_start("mimic_compute_energy")

    energy = 0.0_dp

    do i = 1, size(subsystems)
        temp_energy = 0.0_dp
        call compute_sr_energy_ions(subsystems(i)%sr_atoms, &
                                    quantum_fragment%nuclei, &
                                    temp_energy, &
                                    sr_atom_start(i), &
                                    sr_atom_end(i))
        energy = energy + temp_energy
        if (subsystems(i)%num_lr_atoms > 0) then
            temp_energy = 0.0_dp
            call compute_lr_energy(quantum_fragment, &
                                   temp_energy, &
                                   tensor_sums(:,i))
            energy = energy + temp_energy
        end if
    end do

    call timer_stop

end subroutine mimic_compute_energy