45 |
|
|
46 |
|
!! @author Charles F. Vardeman II |
47 |
|
!! @author Matthew Meineke |
48 |
< |
!! @version $Id: doForces.F90,v 1.28 2005-08-09 22:33:37 gezelter Exp $, $Date: 2005-08-09 22:33:37 $, $Name: not supported by cvs2svn $, $Revision: 1.28 $ |
48 |
> |
!! @version $Id: doForces.F90,v 1.32 2005-08-26 21:30:30 chrisfen Exp $, $Date: 2005-08-26 21:30:30 $, $Name: not supported by cvs2svn $, $Revision: 1.32 $ |
49 |
|
|
50 |
|
|
51 |
|
module doForces |
73 |
|
|
74 |
|
#define __FORTRAN90 |
75 |
|
#include "UseTheForce/fSwitchingFunction.h" |
76 |
+ |
#include "UseTheForce/fCutoffPolicy.h" |
77 |
|
#include "UseTheForce/DarkSide/fInteractionMap.h" |
78 |
|
|
79 |
+ |
|
80 |
|
INTEGER, PARAMETER:: PREPAIR_LOOP = 1 |
81 |
|
INTEGER, PARAMETER:: PAIR_LOOP = 2 |
82 |
|
|
100 |
|
logical, save :: SIM_uses_PBC |
101 |
|
|
102 |
|
public :: init_FF |
103 |
+ |
public :: setDefaultCutoffs |
104 |
|
public :: do_force_loop |
105 |
|
public :: createInteractionHash |
106 |
|
public :: createGtypeCutoffMap |
107 |
+ |
public :: getStickyCut |
108 |
+ |
public :: getStickyPowerCut |
109 |
+ |
public :: getGayBerneCut |
110 |
+ |
public :: getEAMCut |
111 |
+ |
public :: getShapeCut |
112 |
|
|
113 |
|
#ifdef PROFILE |
114 |
|
public :: getforcetime |
130 |
|
real(kind=dp) :: rlistsq |
131 |
|
end type gtypeCutoffs |
132 |
|
type(gtypeCutoffs), dimension(:,:), allocatable :: gtypeCutoffMap |
133 |
+ |
|
134 |
+ |
integer, save :: cutoffPolicy = TRADITIONAL_CUTOFF_POLICY |
135 |
+ |
real(kind=dp),save :: defaultRcut, defaultRsw, defaultRlist |
136 |
|
|
137 |
|
contains |
138 |
|
|
157 |
|
logical :: j_is_GB |
158 |
|
logical :: j_is_EAM |
159 |
|
logical :: j_is_Shape |
160 |
< |
|
160 |
> |
real(kind=dp) :: myRcut |
161 |
> |
|
162 |
|
status = 0 |
163 |
|
|
164 |
|
if (.not. associated(atypes)) then |
191 |
|
call getElementProperty(atypes, i, "is_EAM", i_is_EAM) |
192 |
|
call getElementProperty(atypes, i, "is_Shape", i_is_Shape) |
193 |
|
|
182 |
– |
if (i_is_LJ) then |
183 |
– |
thisCut = getDefaultLJCutoff(i) |
184 |
– |
if (thisCut .gt. atypeMaxCutoff(i)) atypeMaxCutoff(i) = thisCut |
185 |
– |
endif |
186 |
– |
|
187 |
– |
|
188 |
– |
|
194 |
|
do j = i, nAtypes |
195 |
|
|
196 |
|
iHash = 0 |
243 |
|
haveInteractionHash = .true. |
244 |
|
end subroutine createInteractionHash |
245 |
|
|
246 |
< |
subroutine createGtypeCutoffMap(defaultRcut, defaultSkinThickness, stat) |
246 |
> |
subroutine createGtypeCutoffMap(stat) |
247 |
|
|
248 |
< |
real(kind=dp), intent(in), optional :: defaultRCut, defaultSkinThickness |
249 |
< |
integer, intent(out) :: stat |
248 |
> |
integer, intent(out), optional :: stat |
249 |
> |
logical :: i_is_LJ |
250 |
> |
logical :: i_is_Elect |
251 |
> |
logical :: i_is_Sticky |
252 |
> |
logical :: i_is_StickyP |
253 |
> |
logical :: i_is_GB |
254 |
> |
logical :: i_is_EAM |
255 |
> |
logical :: i_is_Shape |
256 |
|
|
257 |
< |
integer :: myStatus, nAtypes |
257 |
> |
integer :: myStatus, nAtypes, i, j, istart, iend, jstart, jend |
258 |
> |
integer :: n_in_i |
259 |
> |
real(kind=dp):: thisSigma, bigSigma, thisRcut |
260 |
> |
real(kind=dp) :: biggestAtypeCutoff |
261 |
|
|
262 |
|
stat = 0 |
263 |
|
if (.not. haveInteractionHash) then |
270 |
|
endif |
271 |
|
|
272 |
|
nAtypes = getSize(atypes) |
273 |
< |
|
273 |
> |
|
274 |
|
do i = 1, nAtypes |
275 |
< |
|
276 |
< |
atypeMaxCutoff(i) = |
275 |
> |
if (SimHasAtype(i)) then |
276 |
> |
call getElementProperty(atypes, i, "is_LennardJones", i_is_LJ) |
277 |
> |
call getElementProperty(atypes, i, "is_Electrostatic", i_is_Elect) |
278 |
> |
call getElementProperty(atypes, i, "is_Sticky", i_is_Sticky) |
279 |
> |
call getElementProperty(atypes, i, "is_StickyPower", i_is_StickyP) |
280 |
> |
call getElementProperty(atypes, i, "is_GayBerne", i_is_GB) |
281 |
> |
call getElementProperty(atypes, i, "is_EAM", i_is_EAM) |
282 |
> |
call getElementProperty(atypes, i, "is_Shape", i_is_Shape) |
283 |
> |
|
284 |
> |
if (i_is_LJ) then |
285 |
> |
thisRcut = getSigma(i) * 2.5_dp |
286 |
> |
if (thisRCut .gt. atypeMaxCutoff(i)) atypeMaxCutoff(i) = thisRCut |
287 |
> |
endif |
288 |
> |
if (i_is_Elect) then |
289 |
> |
thisRcut = defaultRcut |
290 |
> |
if (thisRCut .gt. atypeMaxCutoff(i)) atypeMaxCutoff(i) = thisRCut |
291 |
> |
endif |
292 |
> |
if (i_is_Sticky) then |
293 |
> |
thisRcut = getStickyCut(i) |
294 |
> |
if (thisRCut .gt. atypeMaxCutoff(i)) atypeMaxCutoff(i) = thisRCut |
295 |
> |
endif |
296 |
> |
if (i_is_StickyP) then |
297 |
> |
thisRcut = getStickyPowerCut(i) |
298 |
> |
if (thisRCut .gt. atypeMaxCutoff(i)) atypeMaxCutoff(i) = thisRCut |
299 |
> |
endif |
300 |
> |
if (i_is_GB) then |
301 |
> |
thisRcut = getGayBerneCut(i) |
302 |
> |
if (thisRCut .gt. atypeMaxCutoff(i)) atypeMaxCutoff(i) = thisRCut |
303 |
> |
endif |
304 |
> |
if (i_is_EAM) then |
305 |
> |
thisRcut = getEAMCut(i) |
306 |
> |
if (thisRCut .gt. atypeMaxCutoff(i)) atypeMaxCutoff(i) = thisRCut |
307 |
> |
endif |
308 |
> |
if (i_is_Shape) then |
309 |
> |
thisRcut = getShapeCut(i) |
310 |
> |
if (thisRCut .gt. atypeMaxCutoff(i)) atypeMaxCutoff(i) = thisRCut |
311 |
> |
endif |
312 |
> |
|
313 |
> |
if (atypeMaxCutoff(i).gt.biggestAtypeCutoff) then |
314 |
> |
biggestAtypeCutoff = atypeMaxCutoff(i) |
315 |
> |
endif |
316 |
> |
endif |
317 |
> |
enddo |
318 |
|
|
319 |
+ |
istart = 1 |
320 |
+ |
#ifdef IS_MPI |
321 |
+ |
iend = nGroupsInRow |
322 |
+ |
#else |
323 |
+ |
iend = nGroups |
324 |
+ |
#endif |
325 |
+ |
outer: do i = istart, iend |
326 |
+ |
|
327 |
+ |
n_in_i = groupStartRow(i+1) - groupStartRow(i) |
328 |
+ |
|
329 |
+ |
#ifdef IS_MPI |
330 |
+ |
jstart = 1 |
331 |
+ |
jend = nGroupsInCol |
332 |
+ |
#else |
333 |
+ |
jstart = i+1 |
334 |
+ |
jend = nGroups |
335 |
+ |
#endif |
336 |
+ |
|
337 |
+ |
|
338 |
+ |
|
339 |
+ |
|
340 |
+ |
|
341 |
+ |
|
342 |
+ |
enddo outer |
343 |
|
|
265 |
– |
|
266 |
– |
|
267 |
– |
|
344 |
|
haveGtypeCutoffMap = .true. |
345 |
|
end subroutine createGtypeCutoffMap |
346 |
+ |
|
347 |
+ |
subroutine setDefaultCutoffs(defRcut, defRsw, defRlist, cutPolicy) |
348 |
+ |
real(kind=dp),intent(in) :: defRcut, defRsw, defRlist |
349 |
+ |
integer, intent(in) :: cutPolicy |
350 |
+ |
|
351 |
+ |
defaultRcut = defRcut |
352 |
+ |
defaultRsw = defRsw |
353 |
+ |
defaultRlist = defRlist |
354 |
+ |
cutoffPolicy = cutPolicy |
355 |
+ |
end subroutine setDefaultCutoffs |
356 |
|
|
357 |
+ |
subroutine setCutoffPolicy(cutPolicy) |
358 |
+ |
|
359 |
+ |
integer, intent(in) :: cutPolicy |
360 |
+ |
cutoffPolicy = cutPolicy |
361 |
+ |
call createGtypeCutoffMap() |
362 |
+ |
|
363 |
+ |
end subroutine setCutoffPolicy |
364 |
+ |
|
365 |
+ |
|
366 |
|
subroutine setSimVariables() |
367 |
|
SIM_uses_DirectionalAtoms = SimUsesDirectionalAtoms() |
368 |
|
SIM_uses_EAM = SimUsesEAM() |
670 |
|
#endif |
671 |
|
outer: do i = istart, iend |
672 |
|
|
578 |
– |
#ifdef IS_MPI |
579 |
– |
me_i = atid_row(i) |
580 |
– |
#else |
581 |
– |
me_i = atid(i) |
582 |
– |
#endif |
583 |
– |
|
673 |
|
if (update_nlist) point(i) = nlist + 1 |
674 |
|
|
675 |
|
n_in_i = groupStartRow(i+1) - groupStartRow(i) |