--- trunk/OOPSE/libmdtools/calc_LJ_FF.F90 2003/03/21 17:42:12 378 +++ trunk/OOPSE/libmdtools/calc_LJ_FF.F90 2003/04/11 15:16:59 490 @@ -2,12 +2,13 @@ !! Corresponds to the force field defined in lj_FF.cpp !! @author Charles F. Vardeman II !! @author Matthew Meineke -!! @version $Id: calc_LJ_FF.F90,v 1.1.1.1 2003-03-21 17:42:12 mmeineke Exp $, $Date: 2003-03-21 17:42:12 $, $Name: not supported by cvs2svn $, $Revision: 1.1.1.1 $ +!! @version $Id: calc_LJ_FF.F90,v 1.5 2003-04-11 15:16:59 gezelter Exp $, $Date: 2003-04-11 15:16:59 $, $Name: not supported by cvs2svn $, $Revision: 1.5 $ module lj use definitions use atype_module use vector_class + use simulation #ifdef IS_MPI use mpiSimulation #endif @@ -180,7 +181,7 @@ contains integer, intent(in) :: atom1, atom2 real( kind = dp ), intent(in) :: rij, r2 real( kind = dp ) :: pot - real( kind = dp ), dimension(:,:) :: f + real( kind = dp ), dimension(3,getNlocal()) :: f real( kind = dp ), intent(in), dimension(3) :: d logical, intent(in) :: do_pot, do_stress @@ -194,6 +195,7 @@ contains real( kind = dp ) :: t6 real( kind = dp ) :: t12 real( kind = dp ) :: delta + integer :: id1, id2 if (rij.lt.LJ_rcut) then @@ -218,9 +220,9 @@ contains dudr = 24.0E0_DP * epsilon * (t6 - 2.0E0_DP*t12) / rij - drdx = -d(1) / rij - drdy = -d(2) / rij - drdz = -d(3) / rij + drdx = d(1) / rij + drdy = d(2) / rij + drdz = d(3) / rij fx = dudr * drdx fy = dudr * drdy @@ -253,16 +255,31 @@ contains #endif if (do_stress) then - tau_Temp(1) = tau_Temp(1) + fx * d(1) - tau_Temp(2) = tau_Temp(2) + fx * d(2) - tau_Temp(3) = tau_Temp(3) + fx * d(3) - tau_Temp(4) = tau_Temp(4) + fy * d(1) - tau_Temp(5) = tau_Temp(5) + fy * d(2) - tau_Temp(6) = tau_Temp(6) + fy * d(3) - tau_Temp(7) = tau_Temp(7) + fz * d(1) - tau_Temp(8) = tau_Temp(8) + fz * d(2) - tau_Temp(9) = tau_Temp(9) + fz * d(3) - virial_Temp = virial_Temp + (tau_Temp(1) + tau_Temp(5) + tau_Temp(9)) + +#ifdef IS_MPI + id1 = tagRow(atom1) + id2 = tagColumn(atom2) +#else + id1 = atom1 + id2 = atom2 +#endif + + if (molMembershipList(id1) .ne. molMembershipList(id2)) then + tau_Temp(1) = tau_Temp(1) + fx * d(1) + tau_Temp(2) = tau_Temp(2) + fx * d(2) + tau_Temp(3) = tau_Temp(3) + fx * d(3) + tau_Temp(4) = tau_Temp(4) + fy * d(1) + tau_Temp(5) = tau_Temp(5) + fy * d(2) + tau_Temp(6) = tau_Temp(6) + fy * d(3) + tau_Temp(7) = tau_Temp(7) + fz * d(1) + tau_Temp(8) = tau_Temp(8) + fz * d(2) + tau_Temp(9) = tau_Temp(9) + fz * d(3) + virial_Temp = virial_Temp + & + (tau_Temp(1) + tau_Temp(5) + tau_Temp(9)) + else + write(0,*) 'skipping ', id1, id2, molMembershipList(id1), molMembershipList(id2) + endif + endif endif