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

Comparing trunk/OOPSE-4/src/UseTheForce/doForces.F90 (file contents):
Revision 2290 by gezelter, Wed Sep 14 20:28:05 2005 UTC vs.
Revision 2301 by gezelter, Thu Sep 15 22:05:21 2005 UTC

# Line 45 | Line 45
45  
46   !! @author Charles F. Vardeman II
47   !! @author Matthew Meineke
48 < !! @version $Id: doForces.F90,v 1.41 2005-09-14 20:28:05 gezelter Exp $, $Date: 2005-09-14 20:28:05 $, $Name: not supported by cvs2svn $, $Revision: 1.41 $
48 > !! @version $Id: doForces.F90,v 1.44 2005-09-15 22:05:17 gezelter Exp $, $Date: 2005-09-15 22:05:17 $, $Name: not supported by cvs2svn $, $Revision: 1.44 $
49  
50  
51   module doForces
# Line 58 | Line 58 | module doForces
58    use lj
59    use sticky
60    use electrostatic_module
61 <  use reaction_field
61 >  use reaction_field_module
62    use gb_pair
63    use shapes
64    use vector_class
# Line 136 | Line 136 | module doForces
136  
137    integer, save :: cutoffPolicy = TRADITIONAL_CUTOFF_POLICY
138    real(kind=dp),save :: defaultRcut, defaultRsw, defaultRlist
139 +  real(kind=dp),save :: rcuti
140    
141   contains
142  
# Line 277 | Line 278 | contains
278      nGroupsInRow = getNgroupsInRow(plan_group_row)
279   #endif
280      nAtypes = getSize(atypes)
281 <    
281 > ! Set all of the initial cutoffs to zero.
282 >    atypeMaxCutoff = 0.0_dp
283      do i = 1, nAtypes
284         if (SimHasAtype(i)) then    
285            call getElementProperty(atypes, i, "is_LennardJones", i_is_LJ)
# Line 288 | Line 290 | contains
290            call getElementProperty(atypes, i, "is_EAM", i_is_EAM)
291            call getElementProperty(atypes, i, "is_Shape", i_is_Shape)
292            
293 <          atypeMaxCutoff(i) = 0.0_dp
293 >
294            if (i_is_LJ) then
295               thisRcut = getSigma(i) * 2.5_dp
296               if (thisRCut .gt. atypeMaxCutoff(i)) atypeMaxCutoff(i) = thisRCut
# Line 338 | Line 340 | contains
340         allocate(groupToGtype(iend))
341         allocate(groupMaxCutoff(iend))
342         allocate(gtypeMaxCutoff(iend))
343 +       groupMaxCutoff = 0.0_dp
344 +       gtypeMaxCutoff = 0.0_dp
345      endif
346      !! first we do a single loop over the cutoff groups to find the
347      !! largest cutoff for any atypes present in this group.  We also
# Line 408 | Line 412 | contains
412      enddo
413      
414      haveGtypeCutoffMap = .true.
415 <    
412 <  end subroutine createGtypeCutoffMap
413 <  
414 <  subroutine setDefaultCutoffs(defRcut, defRsw, defRlist, cutPolicy)
415 <    real(kind=dp),intent(in) :: defRcut, defRsw, defRlist
416 <    integer, intent(in) :: cutPolicy
417 <    
418 <    defaultRcut = defRcut
419 <    defaultRsw = defRsw
420 <    defaultRlist = defRlist
421 <    cutoffPolicy = cutPolicy
422 <  end subroutine setDefaultCutoffs
423 <  
424 <  subroutine setCutoffPolicy(cutPolicy)
415 >   end subroutine createGtypeCutoffMap
416  
417 +   subroutine setDefaultCutoffs(defRcut, defRsw, defRlist, cutPolicy)
418 +     real(kind=dp),intent(in) :: defRcut, defRsw, defRlist
419       integer, intent(in) :: cutPolicy
420 +
421 +     defaultRcut = defRcut
422 +     defaultRsw = defRsw
423 +     defaultRlist = defRlist
424       cutoffPolicy = cutPolicy
425 <     call createGtypeCutoffMap()
425 >     rcuti = 1.0_dp / defaultRcut
426 >   end subroutine setDefaultCutoffs
427 >
428 >   subroutine setCutoffPolicy(cutPolicy)
429  
430 +     integer, intent(in) :: cutPolicy
431 +     cutoffPolicy = cutPolicy
432 +     call createGtypeCutoffMap()
433     end subroutine setCutoffPolicy
434      
435      
436    subroutine setSimVariables()
437      SIM_uses_DirectionalAtoms = SimUsesDirectionalAtoms()
438      SIM_uses_EAM = SimUsesEAM()
436    SIM_uses_RF = SimUsesRF()
439      SIM_requires_postpair_calc = SimRequiresPostpairCalc()
440      SIM_requires_prepair_calc = SimRequiresPrepairCalc()
441      SIM_uses_PBC = SimUsesPBC()
442 +    SIM_uses_RF = SimUsesRF()
443  
444      haveSIMvariables = .true.
445  
# Line 503 | Line 506 | contains
506    end subroutine doReadyCheck
507  
508  
509 <  subroutine init_FF(use_RF, use_UW, use_DW, thisStat)
509 >  subroutine init_FF(use_RF, correctionMethod, dampingAlpha, thisStat)
510  
511      logical, intent(in) :: use_RF
512 <    logical, intent(in) :: use_UW
513 <    logical, intent(in) :: use_DW
512 >    integer, intent(in) :: correctionMethod
513 >    real(kind=dp), intent(in) :: dampingAlpha
514      integer, intent(out) :: thisStat  
515      integer :: my_status, nMatches
513    integer :: corrMethod
516      integer, pointer :: MatchList(:) => null()
517      real(kind=dp) :: rcut, rrf, rt, dielect
518  
# Line 520 | Line 522 | contains
522      !! Fortran's version of a cast:
523      FF_uses_RF = use_RF
524  
525 <    !! set the electrostatic correction method
524 <    if (use_UW) then
525 <       corrMethod = 1
526 <    elseif (use_DW) then
527 <       corrMethod = 2
528 <    else
529 <       corrMethod = 0
530 <    endif
531 <    
525 >        
526      !! init_FF is called *after* all of the atom types have been
527      !! defined in atype_module using the new_atype subroutine.
528      !!
# Line 566 | Line 560 | contains
560            call initialize_rf(dielect)
561         endif
562      else
563 <       if (FF_uses_RF) then          
563 >       if ((corrMethod == 3) .or. FF_uses_RF) then
564            write(default_error,*) 'Using Reaction Field with no dipoles?  Huh?'
565            thisStat = -1
566            haveSaneForceField = .false.
# Line 984 | Line 978 | contains
978  
979      if (FF_RequiresPostpairCalc() .and. SIM_requires_postpair_calc) then
980  
981 <       if (FF_uses_RF .and. SIM_uses_RF) then
981 >       if ((FF_uses_RF .and. SIM_uses_RF) .or. (corrMethod == 3)) then
982  
983   #ifdef IS_MPI
984            call scatter(rf_Row,rf,plan_atom_row_3d)
# Line 1068 | Line 1062 | contains
1062      real ( kind = dp ), intent(inout) :: rijsq
1063      real ( kind = dp )                :: r
1064      real ( kind = dp ), intent(inout) :: d(3)
1071    real ( kind = dp ) :: ebalance
1065      integer :: me_i, me_j
1066  
1067      integer :: iHash
# Line 1093 | Line 1086 | contains
1086  
1087      if ( iand(iHash, ELECTROSTATIC_PAIR).ne.0 ) then
1088         call doElectrostaticPair(i, j, d, r, rijsq, sw, vpair, fpair, &
1089 <            pot, eFrame, f, t, do_pot, corrMethod)
1089 >            pot, eFrame, f, t, do_pot, corrMethod, rcuti)
1090  
1091 <       if (FF_uses_RF .and. SIM_uses_RF) then
1091 >       if ((FF_uses_RF .and. SIM_uses_RF) .or. (corrMethod == 3)) then
1092  
1093            ! CHECK ME (RF needs to know about all electrostatic types)
1094            call accumulate_rf(i, j, r, eFrame, sw)
# Line 1378 | Line 1371 | contains
1371    function FF_RequiresPostpairCalc() result(doesit)
1372      logical :: doesit
1373      doesit = FF_uses_RF
1374 +    if (corrMethod == 3) doesit = .true.
1375    end function FF_RequiresPostpairCalc
1376  
1377   #ifdef PROFILE

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines