Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
real(kind=rp), | intent(in) | :: | mu(3) |
point dipole |
||
real(kind=rp), | intent(in) | :: | dr(3) |
Distance vector |
||
real(kind=rp), | intent(in) | :: | kernel(:) |
Array of coulomb kernel (either damped or undamped) |
||
logical, | intent(in) | :: | do_V |
Flags to enable/disable calculation of different electrostatic properties |
||
real(kind=rp), | intent(inout) | :: | V |
Electric potential |
||
logical, | intent(in) | :: | do_E |
Flags to enable/disable calculation of different electrostatic properties |
||
real(kind=rp), | intent(inout) | :: | E(3) |
Electric potential |
||
logical, | intent(in) | :: | do_grdE |
Flags to enable/disable calculation of different electrostatic properties |
||
real(kind=rp), | intent(inout) | :: | grdE(6) |
Electric potential |
||
logical, | intent(in) | :: | do_HE |
Flags to enable/disable calculation of different electrostatic properties |
||
real(kind=rp), | intent(inout) | :: | HE(10) |
Electric potential |
subroutine mu_elec_prop(mu, dr, kernel, &
do_V, V, do_E, E, do_grdE, grdE, do_HE, HE)
implicit none
real(rp), intent(in) :: mu(3)
!! point dipole
real(rp), intent(in) :: dr(3)
!! Distance vector
real(rp), intent(in) :: kernel(:)
!! Array of coulomb kernel (either damped or undamped)
logical, intent(in) :: do_V, do_E, do_grdE, do_HE
!! Flags to enable/disable calculation of different electrostatic
!! properties
real(rp), intent(inout) :: V, E(3), grdE(6), HE(10)
!! Electric potential
real(rp) :: mu_dot_dr
mu_dot_dr = dot_product(mu, dr)
if(do_V) then
V = V + mu_dot_dr * kernel(2)
end if
if(do_E) then
E = E + 3.0_rp * mu_dot_dr * dr * kernel(3) - mu * kernel(2)
end if
if(do_grdE) then
! xx
grdE(1) = grdE(1) + mu_dot_dr * kernel(4) * 15.0 * dr(1) * dr(1) - &
(mu_dot_dr + 2.0 * mu(1) * dr(1)) * 3.0 * kernel(3)
! xy
grdE(2) = grdE(2) + mu_dot_dr * kernel(4) * 15.0 * dr(1) * dr(2) - &
(mu(1)*dr(2) + mu(2)*dr(1)) * 3.0 * kernel(3)
! yy
grdE(3) = grdE(3) + mu_dot_dr * kernel(4) * 15.0 * dr(2) * dr(2) - &
(mu_dot_dr + 2.0 * mu(2) * dr(2)) * 3.0 * kernel(3)
! xz
grdE(4) = grdE(4) + mu_dot_dr * kernel(4) * 15.0 * dr(1) * dr(3) - &
(mu(1)*dr(3) + mu(3)*dr(1)) * 3.0 * kernel(3)
! yz
grdE(5) = grdE(5) + mu_dot_dr * kernel(4) * 15.0 * dr(2) * dr(3) - &
(mu(2)*dr(3) + mu(3)*dr(2)) * 3.0 * kernel(3)
! zz
grdE(6) = grdE(6) + mu_dot_dr * kernel(4) * 15.0 * dr(3) * dr(3) - &
(mu_dot_dr + 2.0 * mu(3) * dr(3)) * 3.0 * kernel(3)
end if
if(do_HE) then
! xxx
HE(1) = HE(1) + 105.0_rp * mu_dot_dr * kernel(5) * dr(1)*dr(1)*dr(1) &
- 45.0_rp * kernel(4) * dr(1) * (mu(1)*dr(1) + mu_dot_dr) &
+ 9.0_rp * kernel(3) * mu(1)
! xxy
HE(2) = HE(2) + 105.0_rp * kernel(5) * mu_dot_dr * dr(1)*dr(1)*dr(2) &
- 15.0_rp * kernel(4) * (mu(2)*dr(1)*dr(1) + &
2.0_rp *mu(1)*dr(1)*dr(2) + &
mu_dot_dr*dr(2)) &
+ 3.0_rp * kernel(3) * mu(2)
! xxz
HE(3) = HE(3) + 105.0_rp * kernel(5) * mu_dot_dr * dr(1)*dr(1)*dr(3) &
- 15.0_rp * kernel(4) * (mu(3)*dr(1)*dr(1) + &
2.0_rp *mu(1)*dr(1)*dr(3) + &
mu_dot_dr*dr(3)) &
+ 3.0_rp * kernel(3) * mu(3)
! xyy
HE(4) = HE(4) + 105.0_rp * kernel(5) * mu_dot_dr * dr(2)*dr(2)*dr(1) &
- 15.0_rp * kernel(4) * (mu(1)*dr(2)*dr(2) + &
2.0_rp *mu(2)*dr(2)*dr(1) + &
mu_dot_dr*dr(1)) &
+ 3.0_rp * kernel(3) * mu(1)
! xyz
HE(5) = HE(5) + 105.0_rp * mu_dot_dr * kernel(5) * dr(1)*dr(2)*dr(3) &
- 15.0_rp * kernel(4) * (mu(1)*dr(2)*dr(3) + &
dr(1)*mu(2)*dr(3) + &
dr(1)*dr(2)*mu(3))
! xzz
HE(6) = HE(6) + 105.0_rp * kernel(5) * mu_dot_dr * dr(3)*dr(3)*dr(1) &
- 15.0_rp * kernel(4) * (mu(1)*dr(3)*dr(3) + &
2.0_rp *mu(3)*dr(3)*dr(1) + &
mu_dot_dr*dr(1)) &
+ 3.0_rp * kernel(3) * mu(1)
! yyy
HE(7) = HE(7) + 105.0_rp * mu_dot_dr * kernel(5) * dr(2)*dr(2)*dr(2) &
- 45.0_rp * kernel(4) * dr(2) * (mu(2)*dr(2) + mu_dot_dr) &
+ 9.0_rp * kernel(3) * mu(2)
! yyz
HE(8) = HE(8) + 105.0_rp * kernel(5) * mu_dot_dr * dr(2)*dr(2)*dr(3) &
- 15.0_rp * kernel(4) * (mu(3)*dr(2)*dr(2) + &
2.0_rp *mu(2)*dr(2)*dr(3) + &
mu_dot_dr*dr(3)) &
+ 3.0_rp * kernel(3) * mu(3)
! yzz
HE(9) = HE(9) + 105.0_rp * kernel(5) * mu_dot_dr * dr(3)*dr(3)*dr(2) &
- 15.0_rp * kernel(4) * (mu(2)*dr(3)*dr(3) + &
2.0_rp *mu(3)*dr(3)*dr(2) + &
mu_dot_dr*dr(2)) &
+ 3.0_rp * kernel(3) * mu(2)
! zzz
HE(10) = HE(10) + 105.0_rp * mu_dot_dr * kernel(5) * dr(3)*dr(3)*dr(3) &
- 45.0_rp * kernel(4) * dr(3) * (mu(3)*dr(3) + mu_dot_dr) &
+ 9.0_rp * kernel(3) * mu(3)
end if
end subroutine mu_elec_prop