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.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 $ |
5 |
> |
!! @version $Id: calc_LJ_FF.F90,v 1.7 2003-07-15 17:10:50 gezelter Exp $, $Date: 2003-07-15 17:10:50 $, $Name: not supported by cvs2svn $, $Revision: 1.7 $ |
6 |
|
|
7 |
|
module lj |
8 |
|
use definitions |
9 |
|
use atype_module |
10 |
|
use vector_class |
11 |
+ |
use simulation |
12 |
|
#ifdef IS_MPI |
13 |
|
use mpiSimulation |
14 |
|
#endif |
181 |
|
integer, intent(in) :: atom1, atom2 |
182 |
|
real( kind = dp ), intent(in) :: rij, r2 |
183 |
|
real( kind = dp ) :: pot |
184 |
< |
real( kind = dp ), dimension(:,:) :: f |
184 |
> |
real( kind = dp ), dimension(3,getNlocal()) :: f |
185 |
|
real( kind = dp ), intent(in), dimension(3) :: d |
186 |
|
logical, intent(in) :: do_pot, do_stress |
187 |
|
|
195 |
|
real( kind = dp ) :: t6 |
196 |
|
real( kind = dp ) :: t12 |
197 |
|
real( kind = dp ) :: delta |
198 |
+ |
integer :: id1, id2 |
199 |
|
|
200 |
|
|
201 |
|
if (rij.lt.LJ_rcut) then |
220 |
|
|
221 |
|
dudr = 24.0E0_DP * epsilon * (t6 - 2.0E0_DP*t12) / rij |
222 |
|
|
223 |
< |
drdx = -d(1) / rij |
224 |
< |
drdy = -d(2) / rij |
225 |
< |
drdz = -d(3) / rij |
223 |
> |
drdx = d(1) / rij |
224 |
> |
drdy = d(2) / rij |
225 |
> |
drdz = d(3) / rij |
226 |
|
|
227 |
|
fx = dudr * drdx |
228 |
|
fy = dudr * drdy |
255 |
|
#endif |
256 |
|
|
257 |
|
if (do_stress) then |
258 |
< |
tau_Temp(1) = tau_Temp(1) + fx * d(1) |
259 |
< |
tau_Temp(2) = tau_Temp(2) + fx * d(2) |
260 |
< |
tau_Temp(3) = tau_Temp(3) + fx * d(3) |
261 |
< |
tau_Temp(4) = tau_Temp(4) + fy * d(1) |
262 |
< |
tau_Temp(5) = tau_Temp(5) + fy * d(2) |
263 |
< |
tau_Temp(6) = tau_Temp(6) + fy * d(3) |
264 |
< |
tau_Temp(7) = tau_Temp(7) + fz * d(1) |
265 |
< |
tau_Temp(8) = tau_Temp(8) + fz * d(2) |
266 |
< |
tau_Temp(9) = tau_Temp(9) + fz * d(3) |
267 |
< |
virial_Temp = virial_Temp + (tau_Temp(1) + tau_Temp(5) + tau_Temp(9)) |
258 |
> |
|
259 |
> |
#ifdef IS_MPI |
260 |
> |
id1 = tagRow(atom1) |
261 |
> |
id2 = tagColumn(atom2) |
262 |
> |
#else |
263 |
> |
id1 = atom1 |
264 |
> |
id2 = atom2 |
265 |
> |
#endif |
266 |
> |
|
267 |
> |
if (molMembershipList(id1) .ne. molMembershipList(id2)) then |
268 |
> |
|
269 |
> |
! because the d vector is the rj - ri vector, and |
270 |
> |
! because fx, fy, fz are the force on atom i, we need a |
271 |
> |
! negative sign here: |
272 |
> |
|
273 |
> |
tau_Temp(1) = tau_Temp(1) - d(1) * fx |
274 |
> |
tau_Temp(2) = tau_Temp(2) - d(1) * fy |
275 |
> |
tau_Temp(3) = tau_Temp(3) - d(1) * fz |
276 |
> |
tau_Temp(4) = tau_Temp(4) - d(2) * fx |
277 |
> |
tau_Temp(5) = tau_Temp(5) - d(2) * fy |
278 |
> |
tau_Temp(6) = tau_Temp(6) - d(2) * fz |
279 |
> |
tau_Temp(7) = tau_Temp(7) - d(3) * fx |
280 |
> |
tau_Temp(8) = tau_Temp(8) - d(3) * fy |
281 |
> |
tau_Temp(9) = tau_Temp(9) - d(3) * fz |
282 |
> |
|
283 |
> |
virial_Temp = virial_Temp + & |
284 |
> |
(tau_Temp(1) + tau_Temp(5) + tau_Temp(9)) |
285 |
> |
|
286 |
> |
endif |
287 |
|
endif |
288 |
|
|
289 |
|
endif |