Computes the electric field of a trial set of induced point dipoles at polarizable sites. This is intended to be used as matrix-vector routine in the solution of the linear system.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(ommp_electrostatics_type), | intent(in) | :: | eel |
Data structure for electrostatic part of the system |
||
real(kind=rp), | intent(in) | :: | ext_ipd(3,eel%pol_atoms) |
External induced point dipoles at polarizable sites |
||
real(kind=rp), | intent(inout) | :: | E(3,eel%pol_atoms) |
Electric field (results will be added) |
subroutine field_extD2D(eel, ext_ipd, E)
!! Computes the electric field of a trial set of induced point dipoles
!! at polarizable sites. This is intended to be used as matrix-vector
!! routine in the solution of the linear system.
implicit none
type(ommp_electrostatics_type), intent(in) :: eel
!! Data structure for electrostatic part of the system
real(rp), intent(in) :: ext_ipd(3, eel%pol_atoms)
!! External induced point dipoles at polarizable sites
real(rp), intent(inout) :: E(3, eel%pol_atoms)
!! Electric field (results will be added)
integer(ip) :: i, j, idx
logical :: to_scale, to_do
real(rp) :: kernel(5), dr(3), tmpV, tmpE(3), tmpEgr(6), tmpHE(10), scalf
!$omp parallel do default(shared) schedule(dynamic) &
!$omp private(i,j,to_do,to_scale,scalf,idx,tmpV,tmpE,tmpEgr,tmpHE,kernel,dr)
do j=1, eel%pol_atoms
do i=1, eel%pol_atoms
if(j == i) cycle
!loop on target
to_do = .true.
to_scale = .false.
scalf = 1.0
! Check if the element should be scaled
do idx=eel%list_P_P%ri(i), eel%list_P_P%ri(i+1)-1
if(eel%list_P_P%ci(idx) == j) then
to_scale = .true.
exit
end if
end do
!If it should set the correct variables
if(to_scale) then
to_do = eel%todo_P_P(idx)
scalf = eel%scalef_P_P(idx)
end if
if(to_do) then
call damped_coulomb_kernel(eel, eel%polar_mm(i), &
eel%polar_mm(j),&
2, kernel(1:3), dr)
tmpE = 0.0_rp
call mu_elec_prop(ext_ipd(:,i), dr, kernel, .false., tmpV, &
.true., tmpE, .false., tmpEgr, &
.false., tmpHE)
if(to_scale) then
E(:, j) = E(:, j) + tmpE * scalf
else
E(:, j) = E(:, j) + tmpE
end if
end if
end do
end do
end subroutine field_extD2D