231 |
|
return |
232 |
|
end subroutine reaction_field_final |
233 |
|
|
234 |
< |
subroutine rf_correct_forces(atom1, atom2, d, rij, u_l, taper, 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, 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 |
320 |
|
f(2,atom2) = f(2,atom2) - dudy |
321 |
|
f(3,atom2) = f(3,atom2) - dudz |
322 |
|
#endif |
323 |
– |
|
324 |
– |
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 |
343 |
< |
tau_Temp(3) = tau_Temp(3) - d(1) * dudz |
344 |
< |
tau_Temp(4) = tau_Temp(4) - d(2) * dudx |
345 |
< |
tau_Temp(5) = tau_Temp(5) - d(2) * dudy |
346 |
< |
tau_Temp(6) = tau_Temp(6) - d(2) * dudz |
347 |
< |
tau_Temp(7) = tau_Temp(7) - d(3) * dudx |
348 |
< |
tau_Temp(8) = tau_Temp(8) - d(3) * dudy |
349 |
< |
tau_Temp(9) = tau_Temp(9) - d(3) * dudz |
350 |
< |
virial_Temp = virial_Temp + & |
351 |
< |
(tau_Temp(1) + tau_Temp(5) + tau_Temp(9)) |
352 |
< |
endif |
353 |
< |
endif |
354 |
< |
endif |
355 |
< |
|
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 |