78 |
|
|
79 |
|
real(kind=dp), parameter :: zero = 0.0_dp |
80 |
|
|
81 |
+ |
!! conversions for the simulation box dipole moment |
82 |
+ |
real(kind=dp), parameter :: chargeToC = 1.60217733e-19_dp |
83 |
+ |
real(kind=dp), parameter :: angstromToM = 1.0e-10_dp |
84 |
+ |
real(kind=dp), parameter :: debyeToCm = 3.33564095198e-30_dp |
85 |
+ |
|
86 |
|
!! number of points for electrostatic splines |
87 |
|
integer, parameter :: np = 100 |
88 |
|
|
154 |
|
public :: destroyElectrostaticTypes |
155 |
|
public :: self_self |
156 |
|
public :: rf_self_excludes |
157 |
< |
|
157 |
> |
public :: accumulate_box_dipole |
158 |
|
|
159 |
|
type :: Electrostatic |
160 |
|
integer :: c_ident |
1455 |
|
|
1456 |
|
return |
1457 |
|
end subroutine rf_self_excludes |
1458 |
+ |
|
1459 |
+ |
subroutine accumulate_box_dipole(atom1, eFrame, d, pChg, nChg, pChgPos, & |
1460 |
+ |
nChgPos, dipVec, pChgCount, nChgCount) |
1461 |
+ |
integer, intent(in) :: atom1 |
1462 |
+ |
logical :: i_is_Charge |
1463 |
+ |
logical :: i_is_Dipole |
1464 |
+ |
integer :: atid1 |
1465 |
+ |
integer :: pChgCount |
1466 |
+ |
integer :: nChgCount |
1467 |
+ |
real(kind=dp), intent(in), dimension(3) :: d |
1468 |
+ |
real(kind=dp), dimension(9,nLocal) :: eFrame |
1469 |
+ |
real(kind=dp) :: pChg |
1470 |
+ |
real(kind=dp) :: nChg |
1471 |
+ |
real(kind=dp), dimension(3) :: pChgPos |
1472 |
+ |
real(kind=dp), dimension(3) :: nChgPos |
1473 |
+ |
real(kind=dp), dimension(3) :: dipVec |
1474 |
+ |
real(kind=dp), dimension(3) :: uz_i |
1475 |
+ |
real(kind=dp), dimension(3) :: pos |
1476 |
+ |
real(kind=dp) :: q_i, mu_i |
1477 |
+ |
real(kind=dp) :: pref, preVal |
1478 |
|
|
1479 |
+ |
if (.not.summationMethodChecked) then |
1480 |
+ |
call checkSummationMethod() |
1481 |
+ |
endif |
1482 |
+ |
|
1483 |
+ |
! this is a local only array, so we use the local atom type id's: |
1484 |
+ |
atid1 = atid(atom1) |
1485 |
+ |
i_is_Charge = ElectrostaticMap(atid1)%is_Charge |
1486 |
+ |
i_is_Dipole = ElectrostaticMap(atid1)%is_Dipole |
1487 |
+ |
|
1488 |
+ |
if (i_is_Charge) then |
1489 |
+ |
q_i = ElectrostaticMap(atid1)%charge |
1490 |
+ |
! convert to the proper units |
1491 |
+ |
q_i = q_i * chargeToC |
1492 |
+ |
pos = d * angstromToM |
1493 |
+ |
|
1494 |
+ |
if (q_i.le.0.0_dp) then |
1495 |
+ |
nChg = nChg - q_i |
1496 |
+ |
nChgPos(1) = nChgPos(1) + pos(1) |
1497 |
+ |
nChgPos(2) = nChgPos(2) + pos(2) |
1498 |
+ |
nChgPos(3) = nChgPos(3) + pos(3) |
1499 |
+ |
nChgCount = nChgCount + 1 |
1500 |
+ |
|
1501 |
+ |
else |
1502 |
+ |
pChg = pChg + q_i |
1503 |
+ |
pChgPos(1) = pChgPos(1) + pos(1) |
1504 |
+ |
pChgPos(2) = pChgPos(2) + pos(2) |
1505 |
+ |
pChgPos(3) = pChgPos(3) + pos(3) |
1506 |
+ |
pChgCount = pChgCount + 1 |
1507 |
+ |
|
1508 |
+ |
endif |
1509 |
+ |
|
1510 |
+ |
endif |
1511 |
+ |
|
1512 |
+ |
if (i_is_Dipole) then |
1513 |
+ |
mu_i = ElectrostaticMap(atid1)%dipole_moment |
1514 |
+ |
uz_i(1) = eFrame(3,atom1) |
1515 |
+ |
uz_i(2) = eFrame(6,atom1) |
1516 |
+ |
uz_i(3) = eFrame(9,atom1) |
1517 |
+ |
! convert to the proper units |
1518 |
+ |
mu_i = mu_i * debyeToCm |
1519 |
+ |
|
1520 |
+ |
dipVec(1) = dipVec(1) + uz_i(1)*mu_i |
1521 |
+ |
dipVec(2) = dipVec(2) + uz_i(2)*mu_i |
1522 |
+ |
dipVec(3) = dipVec(3) + uz_i(3)*mu_i |
1523 |
+ |
|
1524 |
+ |
endif |
1525 |
+ |
|
1526 |
+ |
return |
1527 |
+ |
end subroutine accumulate_box_dipole |
1528 |
+ |
|
1529 |
|
end module electrostatic_module |