2 |
|
!! Corresponds to the force field defined in lj_FF.cpp |
3 |
|
!! @author Charles F. Vardeman II |
4 |
|
!! @author Matthew Meineke |
5 |
< |
!! @version $Id: calc_LJ_FF.F90,v 1.19 2004-05-11 21:31:14 gezelter Exp $, $Date: 2004-05-11 21:31:14 $, $Name: not supported by cvs2svn $, $Revision: 1.19 $ |
5 |
> |
!! @version $Id: calc_LJ_FF.F90,v 1.20 2004-05-24 21:03:24 gezelter Exp $, $Date: 2004-05-24 21:03:24 $, $Name: not supported by cvs2svn $, $Revision: 1.20 $ |
6 |
|
|
7 |
|
module lj |
8 |
|
use definitions |
193 |
|
|
194 |
|
end subroutine createMixingList |
195 |
|
|
196 |
< |
subroutine do_lj_pair(atom1, atom2, d, rij, r2, sw, vpair, pot, f, & |
197 |
< |
do_pot, do_stress) |
196 |
> |
subroutine do_lj_pair(atom1, atom2, d, rij, r2, sw, vpair, fpair, & |
197 |
> |
pot, f, do_pot) |
198 |
|
|
199 |
|
integer, intent(in) :: atom1, atom2 |
200 |
|
real( kind = dp ), intent(in) :: rij, r2 |
201 |
|
real( kind = dp ) :: pot, sw, vpair |
202 |
|
real( kind = dp ), dimension(3,nLocal) :: f |
203 |
|
real( kind = dp ), intent(in), dimension(3) :: d |
204 |
< |
logical, intent(in) :: do_pot, do_stress |
204 |
> |
real( kind = dp ), intent(inout), dimension(3) :: fpair |
205 |
> |
logical, intent(in) :: do_pot |
206 |
|
|
207 |
|
! local Variables |
208 |
|
real( kind = dp ) :: drdx, drdy, drdz |
275 |
|
f(2,atom2) = f(2,atom2) - fy |
276 |
|
f(3,atom2) = f(3,atom2) - fz |
277 |
|
#endif |
278 |
< |
|
279 |
< |
if (do_stress) then |
280 |
< |
|
281 |
< |
#ifdef IS_MPI |
281 |
< |
id1 = tagRow(atom1) |
282 |
< |
id2 = tagColumn(atom2) |
278 |
> |
|
279 |
> |
#ifdef IS_MPI |
280 |
> |
id1 = tagRow(atom1) |
281 |
> |
id2 = tagColumn(atom2) |
282 |
|
#else |
283 |
< |
id1 = atom1 |
284 |
< |
id2 = atom2 |
283 |
> |
id1 = atom1 |
284 |
> |
id2 = atom2 |
285 |
|
#endif |
286 |
+ |
|
287 |
+ |
if (molMembershipList(id1) .ne. molMembershipList(id2)) then |
288 |
|
|
289 |
< |
if (molMembershipList(id1) .ne. molMembershipList(id2)) then |
290 |
< |
|
291 |
< |
! because the d vector is the rj - ri vector, and |
292 |
< |
! because fx, fy, fz are the force on atom i, we need a |
292 |
< |
! negative sign here: |
293 |
< |
|
294 |
< |
tau_Temp(1) = tau_Temp(1) - d(1) * fx |
295 |
< |
tau_Temp(2) = tau_Temp(2) - d(1) * fy |
296 |
< |
tau_Temp(3) = tau_Temp(3) - d(1) * fz |
297 |
< |
tau_Temp(4) = tau_Temp(4) - d(2) * fx |
298 |
< |
tau_Temp(5) = tau_Temp(5) - d(2) * fy |
299 |
< |
tau_Temp(6) = tau_Temp(6) - d(2) * fz |
300 |
< |
tau_Temp(7) = tau_Temp(7) - d(3) * fx |
301 |
< |
tau_Temp(8) = tau_Temp(8) - d(3) * fy |
302 |
< |
tau_Temp(9) = tau_Temp(9) - d(3) * fz |
303 |
< |
|
304 |
< |
virial_Temp = virial_Temp + & |
305 |
< |
(tau_Temp(1) + tau_Temp(5) + tau_Temp(9)) |
306 |
< |
|
307 |
< |
endif |
289 |
> |
fpair(1) = fpair(1) + fx |
290 |
> |
fpair(2) = fpair(2) + fy |
291 |
> |
fpair(3) = fpair(3) + fz |
292 |
> |
|
293 |
|
endif |
294 |
< |
|
294 |
> |
|
295 |
|
return |
296 |
|
|
297 |
|
end subroutine do_lj_pair |