12 |
|
implicit none |
13 |
|
|
14 |
|
PRIVATE |
15 |
< |
real(kind=dp), save :: ecr = 0.0 |
16 |
< |
real(kind=dp), save :: rt = 0.0 |
17 |
< |
real(kind=dp), save :: pre = 0.0 |
18 |
< |
logical, save :: haveCutoffs = .false. |
15 |
> |
|
16 |
> |
real(kind=dp), parameter :: pre = 14.38362_dp |
17 |
|
logical, save :: haveMomentMap = .false. |
18 |
|
|
21 |
– |
public::setCutoffsDipole |
19 |
|
public::do_dipole_pair |
20 |
|
|
21 |
|
type :: MomentList |
25 |
|
type(MomentList), dimension(:),allocatable :: MomentMap |
26 |
|
|
27 |
|
contains |
31 |
– |
|
32 |
– |
subroutine setCutoffsDipole(this_ecr, this_rt) |
33 |
– |
real(kind=dp), intent(in) :: this_ecr, this_rt |
34 |
– |
ecr = this_ecr |
35 |
– |
rt = this_rt |
28 |
|
|
37 |
– |
! pre converts from mu in units of debye to kcal/mol |
38 |
– |
pre = 14.38362_dp |
39 |
– |
|
40 |
– |
haveCutoffs = .true. |
41 |
– |
|
42 |
– |
return |
43 |
– |
end subroutine setCutoffsDipole |
44 |
– |
|
29 |
|
subroutine createMomentMap(status) |
30 |
|
integer :: nAtypes |
31 |
|
integer :: status |
61 |
|
|
62 |
|
end subroutine createMomentMap |
63 |
|
|
64 |
< |
subroutine do_dipole_pair(atom1, atom2, d, rij, r2, sw, vpair, pot, & |
65 |
< |
u_l, f, t, do_pot, do_stress) |
64 |
> |
subroutine do_dipole_pair(atom1, atom2, d, rij, r2, sw, vpair, fpair, & |
65 |
> |
pot, u_l, f, t, do_pot) |
66 |
|
|
67 |
< |
logical :: do_pot, do_stress |
67 |
> |
logical :: do_pot |
68 |
|
|
69 |
|
integer atom1, atom2, me1, me2, id1, id2 |
70 |
|
integer :: localError |
75 |
|
real(kind=dp) :: sw, vpair, vterm |
76 |
|
|
77 |
|
real( kind = dp ) :: pot |
78 |
< |
real( kind = dp ), dimension(3) :: d |
78 |
> |
real( kind = dp ), dimension(3) :: d, fpair |
79 |
|
real( kind = dp ), dimension(3,nLocal) :: u_l |
80 |
|
real( kind = dp ), dimension(3,nLocal) :: f |
81 |
|
real( kind = dp ), dimension(3,nLocal) :: t |
83 |
|
real (kind = dp), dimension(3) :: ul1 |
84 |
|
real (kind = dp), dimension(3) :: ul2 |
85 |
|
|
102 |
– |
if (.not. haveCutoffs) then |
103 |
– |
write(default_error,*) 'Dipole-dipole does not have cutoffs set!' |
104 |
– |
return |
105 |
– |
endif |
106 |
– |
|
86 |
|
if (.not.haveMomentMap) then |
87 |
|
localError = 0 |
88 |
|
call createMomentMap(localError) |
130 |
|
|
131 |
|
vterm = dip2*((u1dotu2/r3) - 3.0d0*(rdotu1*rdotu2/r5)) |
132 |
|
|
133 |
< |
vpair = vpair + vterm*sw |
133 |
> |
vpair = vpair + vterm |
134 |
|
|
135 |
|
if (do_pot) then |
136 |
|
#ifdef IS_MPI |
196 |
|
t(3,atom2) = t(3,atom2) - ul2(1)*dudu2y + ul2(2)*dudu2x |
197 |
|
#endif |
198 |
|
|
220 |
– |
if (do_stress) then |
221 |
– |
|
199 |
|
#ifdef IS_MPI |
200 |
< |
id1 = tagRow(atom1) |
201 |
< |
id2 = tagColumn(atom2) |
200 |
> |
id1 = tagRow(atom1) |
201 |
> |
id2 = tagColumn(atom2) |
202 |
|
#else |
203 |
< |
id1 = atom1 |
204 |
< |
id2 = atom2 |
205 |
< |
#endif |
206 |
< |
if (molMembershipList(id1) .ne. molMembershipList(id2)) then |
207 |
< |
|
208 |
< |
! because the d vector is the rj - ri vector, and |
209 |
< |
! because dudx, dudy, dudz are the (positive) force on |
210 |
< |
! atom i (negative on atom j) we need a negative sign here: |
211 |
< |
|
212 |
< |
tau_Temp(1) = tau_Temp(1) - d(1) * dudx |
236 |
< |
tau_Temp(2) = tau_Temp(2) - d(1) * dudy |
237 |
< |
tau_Temp(3) = tau_Temp(3) - d(1) * dudz |
238 |
< |
tau_Temp(4) = tau_Temp(4) - d(2) * dudx |
239 |
< |
tau_Temp(5) = tau_Temp(5) - d(2) * dudy |
240 |
< |
tau_Temp(6) = tau_Temp(6) - d(2) * dudz |
241 |
< |
tau_Temp(7) = tau_Temp(7) - d(3) * dudx |
242 |
< |
tau_Temp(8) = tau_Temp(8) - d(3) * dudy |
243 |
< |
tau_Temp(9) = tau_Temp(9) - d(3) * dudz |
244 |
< |
|
245 |
< |
virial_Temp = virial_Temp + & |
246 |
< |
(tau_Temp(1) + tau_Temp(5) + tau_Temp(9)) |
247 |
< |
|
248 |
< |
endif |
203 |
> |
id1 = atom1 |
204 |
> |
id2 = atom2 |
205 |
> |
#endif |
206 |
> |
|
207 |
> |
if (molMembershipList(id1) .ne. molMembershipList(id2)) then |
208 |
> |
|
209 |
> |
fpair(1) = fpair(1) + dudx |
210 |
> |
fpair(2) = fpair(2) + dudy |
211 |
> |
fpair(3) = fpair(3) + dudz |
212 |
> |
|
213 |
|
endif |
214 |
< |
|
214 |
> |
|
215 |
|
return |
216 |
|
end subroutine do_dipole_pair |
217 |
|
|