ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/group/trunk/OOPSE/libmdtools/calc_gb.F90
(Generate patch)

Comparing trunk/OOPSE/libmdtools/calc_gb.F90 (file contents):
Revision 460 by chuckv, Fri Apr 4 22:22:30 2003 UTC vs.
Revision 730 by gezelter, Wed Aug 27 16:25:11 2003 UTC

# Line 51 | Line 51 | contains
51         do_pot, do_stress)
52      
53      integer, intent(in) :: atom1, atom2
54 +    integer :: id1, id2
55      real (kind=dp), intent(inout) :: r, r2
56      real (kind=dp), dimension(3), intent(in) :: d
57      real (kind=dp) :: pot
# Line 352 | Line 353 | contains
353   #endif
354      
355      if (do_stress) then          
356 <       tau_Temp(1) = tau_Temp(1) + dUdx * d(1)
357 <       tau_Temp(2) = tau_Temp(2) + dUdx * d(2)
358 <       tau_Temp(3) = tau_Temp(3) + dUdx * d(3)
359 <       tau_Temp(4) = tau_Temp(4) + dUdy * d(1)
360 <       tau_Temp(5) = tau_Temp(5) + dUdy * d(2)
361 <       tau_Temp(6) = tau_Temp(6) + dUdy * d(3)
362 <       tau_Temp(7) = tau_Temp(7) + dUdz * d(1)
363 <       tau_Temp(8) = tau_Temp(8) + dUdz * d(2)
364 <       tau_Temp(9) = tau_Temp(9) + dUdz * d(3)
365 <       virial_Temp = virial_Temp + (tau_Temp(1) + tau_Temp(5) + tau_Temp(9))
356 >
357 > #ifdef IS_MPI
358 >          id1 = tagRow(atom1)
359 >          id2 = tagColumn(atom2)
360 > #else
361 >          id1 = atom1
362 >          id2 = atom2
363 > #endif                
364 >
365 >       if (molMembershipList(id1) .ne. molMembershipList(id2)) then
366 >
367 >          ! because the d vector is the rj - ri vector, and
368 >          ! because dUdx, dUdy, dUdz are the force on atom i, we need a
369 >          ! negative sign here:
370 >          
371 >          tau_Temp(1) = tau_Temp(1) - d(1) * dUdx
372 >          tau_Temp(2) = tau_Temp(2) - d(1) * dUdy
373 >          tau_Temp(3) = tau_Temp(3) - d(1) * dUdz
374 >          tau_Temp(4) = tau_Temp(4) - d(2) * dUdx
375 >          tau_Temp(5) = tau_Temp(5) - d(2) * dUdy
376 >          tau_Temp(6) = tau_Temp(6) - d(2) * dUdz
377 >          tau_Temp(7) = tau_Temp(7) - d(3) * dUdx
378 >          tau_Temp(8) = tau_Temp(8) - d(3) * dUdy
379 >          tau_Temp(9) = tau_Temp(9) - d(3) * dUdz
380 >          
381 >          virial_Temp = virial_Temp + (tau_Temp(1) + tau_Temp(5) + tau_Temp(9))
382 >       endif
383      endif
384          
385      if (do_pot) then

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines