This function computes the interaction energy of static electric multipoles
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(ommp_electrostatics_type), | intent(inout) | :: | eel |
Electrostatics data structure |
||
real(kind=rp), | intent(inout) | :: | ene |
Energy (results will be added) |
subroutine energy_MM_pol(eel, ene)
!! This function computes the interaction energy of
!! static electric multipoles
use mod_memory, only: mallocate, mfree
implicit none
type(ommp_electrostatics_type), intent(inout) :: eel
!! Electrostatics data structure
real(rp), intent(inout) :: ene
!! Energy (results will be added)
real(rp) :: eMM
integer(ip) :: i
call prepare_polelec(eel)
if(.not. eel%ipd_done) call fatal_error("IPD should be computed before&
& computing MM-Pol energy.")
eMM = 0.0
if(eel%amoeba) then
do i=1, 3
eMM = eMM - dot_product(eel%ipd(i,:,_amoeba_D_), &
eel%E_M2D(i,:,_amoeba_P_))
end do
else
do i=1, 3
eMM = eMM - dot_product(eel%ipd(i,:,1), eel%E_M2D(i,:,1))
end do
end if
ene = ene + 0.5_rp * eMM
end subroutine energy_MM_pol