ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/group/trunk/OOPSE-3.0/src/UseTheForce/doForces.F90
(Generate patch)

Comparing trunk/OOPSE-3.0/src/UseTheForce/doForces.F90 (file contents):
Revision 2279 by chrisfen, Tue Aug 30 18:23:50 2005 UTC vs.
Revision 2280 by gezelter, Thu Sep 1 20:17:55 2005 UTC

# Line 45 | Line 45
45  
46   !! @author Charles F. Vardeman II
47   !! @author Matthew Meineke
48 < !! @version $Id: doForces.F90,v 1.33 2005-08-30 18:23:29 chrisfen Exp $, $Date: 2005-08-30 18:23:29 $, $Name: not supported by cvs2svn $, $Revision: 1.33 $
48 > !! @version $Id: doForces.F90,v 1.34 2005-09-01 20:17:55 gezelter Exp $, $Date: 2005-09-01 20:17:55 $, $Name: not supported by cvs2svn $, $Revision: 1.34 $
49  
50  
51   module doForces
# Line 85 | Line 85 | module doForces
85    logical, save :: haveSaneForceField = .false.
86    logical, save :: haveInteractionHash = .false.
87    logical, save :: haveGtypeCutoffMap = .false.
88 +  logical, save :: haveRlist = .false.
89  
90    logical, save :: FF_uses_DirectionalAtoms
91    logical, save :: FF_uses_Dipoles
# Line 257 | Line 258 | contains
258      logical :: i_is_Shape
259  
260      integer :: myStatus, nAtypes,  i, j, istart, iend, jstart, jend
261 <    integer :: n_in_i
262 <    real(kind=dp):: thisSigma, bigSigma, thisRcut
261 >    integer :: n_in_i, me_i, ia, g, atom1, nGroupTypes
262 >    real(kind=dp):: thisSigma, bigSigma, thisRcut, tol, skin
263      real(kind=dp) :: biggestAtypeCutoff
264  
265      stat = 0
# Line 317 | Line 318 | contains
318            endif
319         endif
320      enddo
321 <
321 >  
322 >    nGroupTypes = 0
323 >    
324      istart = 1
325   #ifdef IS_MPI
326      iend = nGroupsInRow
327   #else
328      iend = nGroups
329   #endif
330 <    outer: do i = istart, iend
331 <      
330 >
331 >    !! allocate the groupToGtype and gtypeMaxCutoff here.
332 >    
333 >    !! first we do a single loop over the cutoff groups to find the largest cutoff for any atypes
334 >    !! present in this group.   We also create gtypes at this point.
335 >    tol = 1.0d-6
336 >    
337 >    do i = istart, iend      
338         n_in_i = groupStartRow(i+1) - groupStartRow(i)
339 <      
339 >       groupMaxCutoff(i) = 0.0_dp
340 >       do ia = groupStartRow(i), groupStartRow(i+1)-1
341 >          atom1 = groupListRow(ia)
342   #ifdef IS_MPI
343 <       jstart = 1
333 <       jend = nGroupsInCol
343 >          me_i = atid_row(atom1)
344   #else
345 <       jstart = i+1
346 <       jend = nGroups
347 < #endif
348 <      
349 <      
350 <      
351 <      
352 <      
353 <      
354 <    enddo outer        
345 >          me_i = atid(atom1)
346 > #endif          
347 >          if (atypeMaxCutoff(me_i).gt.groupMaxCutoff(i)) then
348 >             groupMaxCutoff(i)=atypeMaxCutoff(me_i)
349 >          endif
350 >       enddo
351 >       if (nGroupTypes.eq.0) then
352 >          nGroupTypes = nGroupTypes + 1
353 >          gtypeMaxCutoff(nGroupTypes) = groupMaxCutoff(i)
354 >          groupToGtype(i) = nGroupTypes
355 >       else
356 >          do g = 1, nGroupTypes
357 >             if ( abs(groupMaxCutoff(i) - gtypeMaxCutoff(g)).gt.tol) then
358 >                nGroupTypes = nGroupTypes + 1
359 >                gtypeMaxCutoff(nGroupTypes) = groupMaxCutoff(i)
360 >                groupToGtype(i) = nGroupTypes
361 >             else
362 >                groupToGtype(i) = g
363 >             endif
364 >          enddo
365 >       endif
366 >    enddo
367      
368 <     haveGtypeCutoffMap = .true.
368 >    !! allocate the gtypeCutoffMap here.
369 >
370 >    !! then we do a double loop over all the group TYPES to find the cutoff
371 >    !! map between groups of two types
372 >    
373 >    do i = 1, nGroupTypes
374 >       do j = 1, nGroupTypes
375 >      
376 >          select case(cutoffPolicy)
377 >             case(TRADITIONAL_CUTOFF_POLICY)
378 >                thisRcut = maxval(gtypeMaxCutoff)
379 >             case(MIX_CUTOFF_POLICY)
380 >                thisRcut = 0.5_dp * (gtypeMaxCutoff(i) + gtypeMaxCutoff(j))
381 >             case(MAX_CUTOFF_POLICY)
382 >                thisRcut = max(gtypeMaxCutoff(i), gtypeMaxCutoff(j))
383 >             case default
384 >                call handleError("createGtypeCutoffMap", "Unknown Cutoff Policy")
385 >                return
386 >          end select      
387 >         gtypeCutoffMap(i,j)%rcut = thisRcut
388 >         gtypeCutoffMap(i,j)%rcutsq = thisRcut*thisRcut
389 >         skin = defaultRlist - defaultRcut
390 >         gtypeCutoffMap(i,j)%rlistsq = (thisRcut + skin)**2
391 >       enddo
392 >    enddo
393 >    
394 >    haveGtypeCutoffMap = .true.
395     end subroutine createGtypeCutoffMap
396  
397     subroutine setDefaultCutoffs(defRcut, defRsw, defRlist, cutPolicy)
# Line 438 | Line 486 | contains
486    end subroutine doReadyCheck
487  
488  
489 <  subroutine init_FF(use_RF_c, use_UW_c, use_DW_c, thisStat)
489 >  subroutine init_FF(use_RF, use_UW, use_DW, thisStat)
490  
491 <    logical, intent(in) :: use_RF_c
492 <    logical, intent(in) :: use_UW_c
493 <    logical, intent(in) :: use_DW_c
491 >    logical, intent(in) :: use_RF
492 >    logical, intent(in) :: use_UW
493 >    logical, intent(in) :: use_DW
494      integer, intent(out) :: thisStat  
495      integer :: my_status, nMatches
496      integer :: corrMethod
# Line 453 | Line 501 | contains
501      thisStat = 0
502  
503      !! Fortran's version of a cast:
504 <    FF_uses_RF = use_RF_c
504 >    FF_uses_RF = use_RF
505  
506      !! set the electrostatic correction method
507 <    if (use_UW_c .eq. .true.) then
507 >    if (use_UW) then
508         corrMethod = 1
509 <    elseif (use_DW_c .eq. .true.) then
509 >    elseif (use_DW) then
510         corrMethod = 2
511      else
512         corrMethod = 0
# Line 719 | Line 767 | contains
767                    q_group(:,j), d_grp, rgrpsq)
768   #endif
769  
770 <             if (rgrpsq < InteractionHash(me_i,me_j)%rListsq) then
770 >             if (rgrpsq < gtypeCutoffMap(groupToGtype(i),groupToGtype(j))%rListsq) then
771                  if (update_nlist) then
772                     nlist = nlist + 1
773  

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines