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 2722 by gezelter, Thu Apr 20 18:24:24 2006 UTC vs.
Revision 2787 by gezelter, Mon Jun 5 18:24:45 2006 UTC

# Line 45 | Line 45
45  
46   !! @author Charles F. Vardeman II
47   !! @author Matthew Meineke
48 < !! @version $Id: doForces.F90,v 1.79 2006-04-20 18:24:24 gezelter Exp $, $Date: 2006-04-20 18:24:24 $, $Name: not supported by cvs2svn $, $Revision: 1.79 $
48 > !! @version $Id: doForces.F90,v 1.83 2006-06-05 18:24:45 gezelter Exp $, $Date: 2006-06-05 18:24:45 $, $Name: not supported by cvs2svn $, $Revision: 1.83 $
49  
50  
51   module doForces
# Line 64 | Line 64 | module doForces
64    use eam
65    use suttonchen
66    use status
67  use interpolation
67   #ifdef IS_MPI
68    use mpiSimulation
69   #endif
# Line 79 | Line 78 | module doForces
78  
79    INTEGER, PARAMETER:: PREPAIR_LOOP = 1
80    INTEGER, PARAMETER:: PAIR_LOOP    = 2
82  INTEGER, PARAMETER:: np = 500
81  
82    logical, save :: haveNeighborList = .false.
83    logical, save :: haveSIMvariables = .false.
# Line 91 | Line 89 | module doForces
89    logical, save :: haveElectrostaticSummationMethod = .false.
90    logical, save :: haveCutoffPolicy = .false.
91    logical, save :: VisitCutoffsAfterComputing = .false.
94  logical, save :: haveSplineSqrt = .false.
92  
93    logical, save :: FF_uses_DirectionalAtoms
94    logical, save :: FF_uses_Dipoles
# Line 150 | Line 147 | module doForces
147    end type gtypeCutoffs
148    type(gtypeCutoffs), dimension(:,:), allocatable :: gtypeCutoffMap
149  
153  ! variables for the spline of the sqrt
154  type(cubicSpline), save :: splineSqrt
155  logical, save :: useSpline = .true.
156  
150  
151   contains
152  
# Line 430 | Line 423 | contains
423      !! largest cutoff for any atypes present in this group.  We also
424      !! create gtypes at this point.
425      
426 <    tol = 1.0d-6
426 >    tol = 1.0e-6_dp
427      nGroupTypesRow = 0
428      nGroupTypesCol = 0
429      do i = istart, iend      
# Line 594 | Line 587 | contains
587       call setCutoffSC( defaultRcut )
588       call set_switch(defaultRsw, defaultRcut)
589       call setHmatDangerousRcutValue(defaultRcut)
597     call setupSplineSqrt(defaultRcut)
590          
591       haveDefaultCutoffs = .true.
592       haveGtypeCutoffMap = .false.
# Line 667 | Line 659 | contains
659      if (VisitCutoffsAfterComputing) then
660         call set_switch(largestRcut, largestRcut)      
661         call setHmatDangerousRcutValue(largestRcut)
670       call setLJsplineRmax(largestRcut)
662         call setCutoffEAM(largestRcut)
663         call setCutoffSC(largestRcut)
664         VisitCutoffsAfterComputing = .false.
674    endif
675
676    if (.not. haveSplineSqrt) then
677       call setupSplineSqrt(largestRcut)
665      endif
666  
667      if (.not. haveSIMvariables) then
# Line 975 | Line 962 | contains
962  
963                     rCut = gtypeCutoffMap(groupToGtypeRow(i),groupToGtypeCol(j))%rCut
964                     if (loop .eq. PAIR_LOOP) then
965 <                      vij = 0.0d0
965 >                      vij = 0.0_dp
966                        fij(1) = 0.0_dp
967                        fij(2) = 0.0_dp
968                        fij(3) = 0.0_dp
# Line 1195 | Line 1182 | contains
1182                  ! prevent overcounting of the skips
1183                  if (i.lt.j) then
1184                     call get_interatomic_vector(q(:,i), q(:,j), d_atm, ratmsq)
1185 <                   rVal = dsqrt(ratmsq)
1185 >                   rVal = sqrt(ratmsq)
1186                     call get_switch(ratmsq, sw, dswdr, rVal,in_switching_region)
1187   #ifdef IS_MPI
1188                     call rf_self_excludes(i, j, sw, eFrame, d_atm, rVal, &
# Line 1213 | Line 1200 | contains
1200   #ifdef IS_MPI
1201      
1202      if (do_pot) then
1203 + #ifdef SINGLE_PRECISION
1204 +       call mpi_allreduce(pot_local, pot, LR_POT_TYPES,mpi_real,mpi_sum, &
1205 +            mpi_comm_world,mpi_err)            
1206 + #else
1207         call mpi_allreduce(pot_local, pot, LR_POT_TYPES,mpi_double_precision,mpi_sum, &
1208              mpi_comm_world,mpi_err)            
1209 + #endif
1210      endif
1211      
1212      if (do_stress) then
1213 + #ifdef SINGLE_PRECISION
1214 +       call mpi_allreduce(tau_Temp, tau, 9,mpi_real,mpi_sum, &
1215 +            mpi_comm_world,mpi_err)
1216 +       call mpi_allreduce(virial_Temp, virial,1,mpi_real,mpi_sum, &
1217 +            mpi_comm_world,mpi_err)
1218 + #else
1219         call mpi_allreduce(tau_Temp, tau, 9,mpi_double_precision,mpi_sum, &
1220              mpi_comm_world,mpi_err)
1221         call mpi_allreduce(virial_Temp, virial,1,mpi_double_precision,mpi_sum, &
1222              mpi_comm_world,mpi_err)
1223 + #endif
1224      endif
1225      
1226   #else
# Line 1261 | Line 1260 | contains
1260  
1261      integer :: iHash
1262  
1263 <    if (useSpline) then
1264 <       call lookupUniformSpline(splineSqrt, rijsq, r)
1265 <    else
1266 <       r = sqrt(rijsq)
1268 <    endif
1263 >    r = sqrt(rijsq)
1264 >    
1265 >    vpair = 0.0_dp
1266 >    fpair(1:3) = 0.0_dp
1267  
1270    vpair = 0.0d0
1271    fpair(1:3) = 0.0d0
1272
1268   #ifdef IS_MPI
1269      me_i = atid_row(i)
1270      me_j = atid_col(j)
# Line 1306 | Line 1301 | contains
1301      endif
1302      
1303      if ( iand(iHash, GAYBERNE_LJ).ne.0 ) then
1304 <       call do_gb_lj_pair(i, j, d, r, rijsq, rcut, sw, vpair, fpair, &
1304 >       call do_gb_pair(i, j, d, r, rijsq, sw, vpair, fpair, &
1305              pot(VDW_POT), A, f, t, do_pot)
1306      endif
1307      
# Line 1350 | Line 1345 | contains
1345  
1346      integer :: me_i, me_j, iHash
1347  
1348 <    if (useSpline) then
1349 <       call lookupUniformSpline(splineSqrt, rijsq, r)
1355 <    else
1356 <       r = sqrt(rijsq)
1357 <    endif
1358 <
1348 >    r = sqrt(rijsq)
1349 >    
1350   #ifdef IS_MPI  
1351      me_i = atid_row(i)
1352      me_j = atid_col(j)  
# Line 1415 | Line 1406 | contains
1406            
1407            ! wrap the scaled coordinates
1408  
1409 <          scaled(1) = scaled(1) - dnint(scaled(1))
1410 <          scaled(2) = scaled(2) - dnint(scaled(2))
1411 <          scaled(3) = scaled(3) - dnint(scaled(3))
1409 >          scaled(1) = scaled(1) - anint(scaled(1), kind=dp)
1410 >          scaled(2) = scaled(2) - anint(scaled(2), kind=dp)
1411 >          scaled(3) = scaled(3) - anint(scaled(3), kind=dp)
1412  
1413            ! calc the wrapped real coordinates from the wrapped scaled
1414            ! coordinates
# Line 1435 | Line 1426 | contains
1426            
1427            ! wrap the scaled coordinates
1428            
1429 <          scaled(1) = scaled(1) - dnint(scaled(1))
1430 <          scaled(2) = scaled(2) - dnint(scaled(2))
1431 <          scaled(3) = scaled(3) - dnint(scaled(3))
1429 >          scaled(1) = scaled(1) - anint(scaled(1), kind=dp)
1430 >          scaled(2) = scaled(2) - anint(scaled(2), kind=dp)
1431 >          scaled(3) = scaled(3) - anint(scaled(3), kind=dp)
1432  
1433            ! calc the wrapped real coordinates from the wrapped scaled
1434            ! coordinates
# Line 1617 | Line 1608 | contains
1608  
1609    end subroutine add_stress_tensor
1610  
1620  subroutine setupSplineSqrt(rmax)
1621    real(kind=dp), intent(in) :: rmax
1622    real(kind=dp), dimension(np) :: xvals, yvals
1623    real(kind=dp) :: r2_1, r2_n, dx, r2
1624    integer :: i
1625
1626    r2_1 = 0.5d0
1627    r2_n = rmax*rmax
1628
1629    dx = (r2_n-r2_1) / dble(np-1)
1630    
1631    do i = 1, np
1632       r2 = r2_1 + dble(i-1)*dx
1633       xvals(i) = r2
1634       yvals(i) = dsqrt(r2)
1635    enddo
1636
1637    call newSpline(splineSqrt, xvals, yvals, .true.)
1638    
1639    haveSplineSqrt = .true.
1640    return
1641  end subroutine setupSplineSqrt
1642
1643  subroutine deleteSplineSqrt()
1644    call deleteSpline(splineSqrt)
1645    haveSplineSqrt = .false.
1646    return
1647  end subroutine deleteSplineSqrt
1648
1611   end module doForces

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines