This subroutine computes the potential generated by the static multipoles to a set of arbitrary coordinates, without applying any screening rules.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(ommp_electrostatics_type), | intent(in) | :: | eel |
Electrostatics data structure |
||
real(kind=rp), | intent(in) | :: | cpt(:,:) |
Coordinates at which the electric field is requested |
||
real(kind=rp), | intent(inout) | :: | E(:,:) |
Electric field (results will be added) |
subroutine field_M2E(eel, cpt, E)
!! This subroutine computes the potential generated by the static
!! multipoles to a set of arbitrary coordinates, without applying
!! any screening rules.
implicit none
type(ommp_electrostatics_type), intent(in) :: eel
!! Electrostatics data structure
real(rp), intent(inout) :: E(:,:)
!! Electric field (results will be added)
real(rp), intent(in) :: cpt(:,:)
!! Coordinates at which the electric field is requested
integer(ip) :: i, j, n_cpt
real(rp) :: kernel(5), dr(3), tmpV, tmpE(3), tmpEgr(6), tmpHE(10)
n_cpt = size(cpt, 2)
if(eel%amoeba) then
!$omp parallel do default(shared) schedule(dynamic) &
!$omp private(i,j,dr,kernel,tmpE,tmpV,tmpEgr,tmpHE) reduction(+:E)
do i=1, eel%top%mm_atoms
do j=1, n_cpt
dr = cpt(:,j) - eel%top%cmm(:,i)
call coulomb_kernel(dr, 4, kernel)
tmpE = 0.0_rp
call q_elec_prop(eel%q(1,i), dr, kernel, .false., tmpV, &
.true., tmpE, .false., tmpEgr, &
.false., tmpHE)
call mu_elec_prop(eel%q(2:4,i), dr, kernel, .false., tmpV, &
.true., tmpE, .false., tmpEgr, &
.false., tmpHE)
call quad_elec_prop(eel%q(5:10,i), dr, kernel, .false., tmpV, &
.true., tmpE, .false., tmpEgr, &
.false., tmpHE)
E(:,j) = E(:,j) + tmpE
end do
end do
else
!$omp parallel do default(shared) schedule(dynamic) &
!$omp private(i,j,dr,kernel,tmpE,tmpV,tmpEgr,tmpHE) reduction(+:E)
do i=1, eel%top%mm_atoms
! loop on sources
do j=1, n_cpt
dr = cpt(:,j) - eel%top%cmm(:,i)
call coulomb_kernel(dr, 2, kernel)
tmpE = 0.0_rp
call q_elec_prop(eel%q(1,i), dr, kernel, .false., tmpV, &
.true., tmpE, .false., tmpEgr, &
.false., tmpHE)
E(:,j) = E(:,j) + tmpE
end do
end do
end if
end subroutine field_M2E