10 |
|
#endif |
11 |
|
implicit none |
12 |
|
|
13 |
+ |
PRIVATE |
14 |
|
real(kind=dp), save :: rrf = 0.0 |
15 |
|
real(kind=dp), save :: rt = 0.0 |
16 |
< |
real(kind=dp), save :: rrfsq = 0.0 |
16 |
< |
real(kind=dp), save :: pre = 0.0 |
16 |
> |
real(kind=dp), save :: pre = 0.0 |
17 |
|
logical, save :: dipole_initialized = .false. |
18 |
|
|
19 |
+ |
|
20 |
+ |
public::setCutoffsDipole |
21 |
+ |
public::do_dipole_pair |
22 |
+ |
|
23 |
|
contains |
24 |
|
|
25 |
< |
subroutine initialize_dipole(this_rrf, this_rt) |
25 |
> |
subroutine setCutoffsDipole(this_rrf, this_rt) |
26 |
|
real(kind=dp), intent(in) :: this_rrf, this_rt |
27 |
|
rrf = this_rrf |
28 |
|
rt = this_rt |
29 |
< |
rrfsq = rrf * rrf |
30 |
< |
! pre converts from mu in units of debye to kcal/mol |
29 |
> |
|
30 |
> |
! pre converts from mu in units of debye to kcal/mol |
31 |
|
pre = 14.38362_dp |
32 |
|
|
33 |
|
dipole_initialized = .true. |
34 |
|
|
35 |
|
return |
36 |
< |
end subroutine initialize_dipole |
36 |
> |
end subroutine setCutoffsDipole |
37 |
|
|
34 |
– |
|
38 |
|
subroutine do_dipole_pair(atom1, atom2, d, rij, r2, pot, u_l, f, t, & |
39 |
|
do_pot, do_stress) |
40 |
|
|
41 |
|
logical :: do_pot, do_stress |
42 |
|
|
43 |
< |
integer atom1, atom2, me1, me2 |
43 |
> |
integer atom1, atom2, me1, me2, id1, id2 |
44 |
|
real(kind=dp) :: rij, mu1, mu2 |
45 |
|
real(kind=dp) :: dfact1, dfact2, dip2, r2, r3, r5 |
46 |
|
real(kind=dp) :: dudx, dudy, dudz, dudu1x, dudu1y, dudu1z |
87 |
|
call getElementProperty(atypes, me1, "dipole_moment", mu1) |
88 |
|
call getElementProperty(atypes, me2, "dipole_moment", mu2) |
89 |
|
|
87 |
– |
|
90 |
|
if (rij.le.rrf) then |
89 |
– |
|
91 |
|
|
91 |
– |
|
92 |
|
if (rij.lt.rt) then |
93 |
|
taper = 1.0d0 |
94 |
|
dtdr = 0.0d0 |
176 |
|
t(2,atom2) = t(2,atom2) - ul2(3)*dudu2x + ul2(1)*dudu2z |
177 |
|
t(3,atom2) = t(3,atom2) - ul2(1)*dudu2y + ul2(2)*dudu2x |
178 |
|
#endif |
179 |
< |
|
179 |
> |
|
180 |
|
if (do_stress) then |
181 |
|
|
182 |
< |
if (molMembershipList(atom1) .ne. molMembershipList(atom2)) then |
182 |
> |
#ifdef IS_MPI |
183 |
> |
id1 = tagRow(atom1) |
184 |
> |
id2 = tagColumn(atom2) |
185 |
> |
#else |
186 |
> |
id1 = atom1 |
187 |
> |
id2 = atom2 |
188 |
> |
#endif |
189 |
> |
if (molMembershipList(id1) .ne. molMembershipList(id2)) then |
190 |
|
|
191 |
|
! because the d vector is the rj - ri vector, and |
192 |
|
! because dudx, dudy, dudz are the (positive) force on |