97 |
|
|
98 |
|
end subroutine createMomentMap |
99 |
|
|
100 |
< |
subroutine accumulate_rf(atom1, atom2, rij, u_l) |
100 |
> |
subroutine accumulate_rf(atom1, atom2, rij, u_l, taper) |
101 |
|
|
102 |
|
integer, intent(in) :: atom1, atom2 |
103 |
|
real (kind = dp), intent(in) :: rij |
104 |
|
real (kind = dp), dimension(3,nLocal) :: u_l |
105 |
|
|
106 |
|
integer :: me1, me2 |
107 |
< |
real (kind = dp) :: taper, mu1, mu2 |
107 |
> |
real (kind = dp), intent(in) :: taper |
108 |
> |
real (kind = dp):: mu1, mu2 |
109 |
|
real (kind = dp), dimension(3) :: ul1 |
110 |
|
real (kind = dp), dimension(3) :: ul2 |
111 |
|
|
125 |
|
end if |
126 |
|
endif |
127 |
|
|
127 |
– |
if (rij.le.rrf) then |
128 |
– |
|
129 |
– |
if (rij.lt.rt) then |
130 |
– |
taper = 1.0d0 |
131 |
– |
else |
132 |
– |
write(*,*) 'rf in taper region' |
133 |
– |
taper = (rrf + 2.0d0*rij - 3.0d0*rt)*(rrf-rij)**2/ ((rrf-rt)**3) |
134 |
– |
endif |
128 |
|
|
129 |
|
#ifdef IS_MPI |
130 |
< |
me1 = atid_Row(atom1) |
131 |
< |
ul1(1) = u_l_Row(1,atom1) |
132 |
< |
ul1(2) = u_l_Row(2,atom1) |
133 |
< |
ul1(3) = u_l_Row(3,atom1) |
134 |
< |
|
135 |
< |
me2 = atid_Col(atom2) |
136 |
< |
ul2(1) = u_l_Col(1,atom2) |
137 |
< |
ul2(2) = u_l_Col(2,atom2) |
138 |
< |
ul2(3) = u_l_Col(3,atom2) |
130 |
> |
me1 = atid_Row(atom1) |
131 |
> |
ul1(1) = u_l_Row(1,atom1) |
132 |
> |
ul1(2) = u_l_Row(2,atom1) |
133 |
> |
ul1(3) = u_l_Row(3,atom1) |
134 |
> |
|
135 |
> |
me2 = atid_Col(atom2) |
136 |
> |
ul2(1) = u_l_Col(1,atom2) |
137 |
> |
ul2(2) = u_l_Col(2,atom2) |
138 |
> |
ul2(3) = u_l_Col(3,atom2) |
139 |
|
#else |
140 |
< |
me1 = atid(atom1) |
141 |
< |
ul1(1) = u_l(1,atom1) |
142 |
< |
ul1(2) = u_l(2,atom1) |
143 |
< |
ul1(3) = u_l(3,atom1) |
144 |
< |
|
145 |
< |
me2 = atid(atom2) |
146 |
< |
ul2(1) = u_l(1,atom2) |
147 |
< |
ul2(2) = u_l(2,atom2) |
148 |
< |
ul2(3) = u_l(3,atom2) |
140 |
> |
me1 = atid(atom1) |
141 |
> |
ul1(1) = u_l(1,atom1) |
142 |
> |
ul1(2) = u_l(2,atom1) |
143 |
> |
ul1(3) = u_l(3,atom1) |
144 |
> |
|
145 |
> |
me2 = atid(atom2) |
146 |
> |
ul2(1) = u_l(1,atom2) |
147 |
> |
ul2(2) = u_l(2,atom2) |
148 |
> |
ul2(3) = u_l(3,atom2) |
149 |
|
#endif |
150 |
< |
|
151 |
< |
mu1 = MomentMap(me1)%dipole_moment |
152 |
< |
mu2 = MomentMap(me2)%dipole_moment |
153 |
< |
|
150 |
> |
|
151 |
> |
mu1 = MomentMap(me1)%dipole_moment |
152 |
> |
mu2 = MomentMap(me2)%dipole_moment |
153 |
> |
|
154 |
|
#ifdef IS_MPI |
155 |
< |
rf_Row(1,atom1) = rf_Row(1,atom1) + ul2(1)*mu2*taper |
156 |
< |
rf_Row(2,atom1) = rf_Row(2,atom1) + ul2(2)*mu2*taper |
157 |
< |
rf_Row(3,atom1) = rf_Row(3,atom1) + ul2(3)*mu2*taper |
158 |
< |
|
159 |
< |
rf_Col(1,atom2) = rf_Col(1,atom2) + ul1(1)*mu1*taper |
160 |
< |
rf_Col(2,atom2) = rf_Col(2,atom2) + ul1(2)*mu1*taper |
161 |
< |
rf_Col(3,atom2) = rf_Col(3,atom2) + ul1(3)*mu1*taper |
162 |
< |
#else |
163 |
< |
rf(1,atom1) = rf(1,atom1) + ul2(1)*mu2*taper |
164 |
< |
rf(2,atom1) = rf(2,atom1) + ul2(2)*mu2*taper |
165 |
< |
rf(3,atom1) = rf(3,atom1) + ul2(3)*mu2*taper |
166 |
< |
|
167 |
< |
rf(1,atom2) = rf(1,atom2) + ul1(1)*mu1*taper |
168 |
< |
rf(2,atom2) = rf(2,atom2) + ul1(2)*mu1*taper |
169 |
< |
rf(3,atom2) = rf(3,atom2) + ul1(3)*mu1*taper |
155 |
> |
rf_Row(1,atom1) = rf_Row(1,atom1) + ul2(1)*mu2*taper |
156 |
> |
rf_Row(2,atom1) = rf_Row(2,atom1) + ul2(2)*mu2*taper |
157 |
> |
rf_Row(3,atom1) = rf_Row(3,atom1) + ul2(3)*mu2*taper |
158 |
> |
|
159 |
> |
rf_Col(1,atom2) = rf_Col(1,atom2) + ul1(1)*mu1*taper |
160 |
> |
rf_Col(2,atom2) = rf_Col(2,atom2) + ul1(2)*mu1*taper |
161 |
> |
rf_Col(3,atom2) = rf_Col(3,atom2) + ul1(3)*mu1*taper |
162 |
> |
#else |
163 |
> |
rf(1,atom1) = rf(1,atom1) + ul2(1)*mu2*taper |
164 |
> |
rf(2,atom1) = rf(2,atom1) + ul2(2)*mu2*taper |
165 |
> |
rf(3,atom1) = rf(3,atom1) + ul2(3)*mu2*taper |
166 |
> |
|
167 |
> |
rf(1,atom2) = rf(1,atom2) + ul1(1)*mu1*taper |
168 |
> |
rf(2,atom2) = rf(2,atom2) + ul1(2)*mu1*taper |
169 |
> |
rf(3,atom2) = rf(3,atom2) + ul1(3)*mu1*taper |
170 |
|
#endif |
171 |
< |
|
172 |
< |
endif |
171 |
> |
|
172 |
> |
|
173 |
|
return |
174 |
|
end subroutine accumulate_rf |
175 |
|
|
227 |
|
rfpot = rfpot - 0.5d0 * pre * mu1 * & |
228 |
|
(rf(1,a1)*u_l(1,a1) + rf(2,a1)*u_l(2,a1) + rf(3,a1)*u_l(3,a1)) |
229 |
|
endif |
230 |
< |
|
230 |
> |
|
231 |
|
return |
232 |
|
end subroutine reaction_field_final |
233 |
|
|
234 |
< |
subroutine rf_correct_forces(atom1, atom2, d, rij, u_l, f, do_stress) |
234 |
> |
subroutine rf_correct_forces(atom1, atom2, d, rij, u_l, taper, f, fpair) |
235 |
|
|
236 |
|
integer, intent(in) :: atom1, atom2 |
237 |
|
real(kind=dp), dimension(3), intent(in) :: d |
238 |
< |
real(kind=dp), intent(in) :: rij |
238 |
> |
real(kind=dp), intent(in) :: rij, taper |
239 |
|
real( kind = dp ), dimension(3,nLocal) :: u_l |
240 |
|
real( kind = dp ), dimension(3,nLocal) :: f |
241 |
< |
logical, intent(in) :: do_stress |
241 |
> |
real( kind = dp ), dimension(3), intent(inout) :: fpair |
242 |
|
|
243 |
|
real (kind = dp), dimension(3) :: ul1 |
244 |
|
real (kind = dp), dimension(3) :: ul2 |
268 |
|
if (rij.lt.rt) then |
269 |
|
dtdr = 0.0d0 |
270 |
|
else |
271 |
< |
write(*,*) 'rf correct in taper region' |
271 |
> |
! write(*,*) 'rf correct in taper region' |
272 |
|
dtdr = 6.0d0*(rij*rij - rij*rt - rij*rrf +rrf*rt)/((rrf-rt)**3) |
273 |
|
endif |
274 |
|
|
320 |
|
f(2,atom2) = f(2,atom2) - dudy |
321 |
|
f(3,atom2) = f(3,atom2) - dudz |
322 |
|
#endif |
330 |
– |
|
331 |
– |
if (do_stress) then |
323 |
|
|
324 |
|
#ifdef IS_MPI |
325 |
< |
id1 = tagRow(atom1) |
326 |
< |
id2 = tagColumn(atom2) |
325 |
> |
id1 = AtomRowToGlobal(atom1) |
326 |
> |
id2 = AtomColToGlobal(atom2) |
327 |
|
#else |
328 |
< |
id1 = atom1 |
329 |
< |
id2 = atom2 |
328 |
> |
id1 = atom1 |
329 |
> |
id2 = atom2 |
330 |
|
#endif |
331 |
< |
|
332 |
< |
if (molMembershipList(id1) .ne. molMembershipList(id2)) then |
333 |
< |
|
334 |
< |
! because the d vector is the rj - ri vector, and |
335 |
< |
! because dudx, dudy, and dudz are the |
336 |
< |
! (positive) force on atom i (negative on atom j) we need |
337 |
< |
! a negative sign here: |
338 |
< |
|
339 |
< |
tau_Temp(1) = tau_Temp(1) - d(1) * dudx |
340 |
< |
tau_Temp(2) = tau_Temp(2) - d(1) * dudy |
350 |
< |
tau_Temp(3) = tau_Temp(3) - d(1) * dudz |
351 |
< |
tau_Temp(4) = tau_Temp(4) - d(2) * dudx |
352 |
< |
tau_Temp(5) = tau_Temp(5) - d(2) * dudy |
353 |
< |
tau_Temp(6) = tau_Temp(6) - d(2) * dudz |
354 |
< |
tau_Temp(7) = tau_Temp(7) - d(3) * dudx |
355 |
< |
tau_Temp(8) = tau_Temp(8) - d(3) * dudy |
356 |
< |
tau_Temp(9) = tau_Temp(9) - d(3) * dudz |
357 |
< |
virial_Temp = virial_Temp + & |
358 |
< |
(tau_Temp(1) + tau_Temp(5) + tau_Temp(9)) |
359 |
< |
endif |
360 |
< |
endif |
361 |
< |
endif |
362 |
< |
|
331 |
> |
|
332 |
> |
if (molMembershipList(id1) .ne. molMembershipList(id2)) then |
333 |
> |
|
334 |
> |
fpair(1) = fpair(1) + dudx |
335 |
> |
fpair(2) = fpair(2) + dudy |
336 |
> |
fpair(3) = fpair(3) + dudz |
337 |
> |
|
338 |
> |
endif |
339 |
> |
|
340 |
> |
end if |
341 |
|
return |
342 |
|
end subroutine rf_correct_forces |
343 |
|
end module reaction_field |