--- trunk/OOPSE/libmdtools/do_Forces.F90 2003/08/07 00:47:33 669 +++ trunk/OOPSE/libmdtools/do_Forces.F90 2003/12/19 17:25:00 887 @@ -4,7 +4,7 @@ !! @author Charles F. Vardeman II !! @author Matthew Meineke -!! @version $Id: do_Forces.F90,v 1.27 2003-08-07 00:47:33 chuckv Exp $, $Date: 2003-08-07 00:47:33 $, $Name: not supported by cvs2svn $, $Revision: 1.27 $ +!! @version $Id: do_Forces.F90,v 1.39 2003-12-19 17:25:00 mmeineke Exp $, $Date: 2003-12-19 17:25:00 $, $Name: not supported by cvs2svn $, $Revision: 1.39 $ module do_Forces use force_globals @@ -45,6 +45,12 @@ contains public :: do_force_loop public :: setRlistDF +#ifdef PROFILE + public :: getforcetime + real, save :: forceTime = 0 + real :: forceTimeInitial, forceTimeFinal +#endif + contains subroutine setRlistDF( this_rlist ) @@ -146,8 +152,9 @@ contains if (FF_uses_EAM) then - call init_EAM_FF(my_status) + call init_EAM_FF(my_status) if (my_status /= 0) then + write(*,*) "init_EAM_FF returned a bad status" thisStat = -1 return end if @@ -206,6 +213,7 @@ contains real( kind = DP ) :: pot_local integer :: nrow integer :: ncol + integer :: nprocs #endif integer :: nlocal integer :: natoms @@ -221,8 +229,7 @@ contains integer :: listerror, error integer :: localError - real(kind=dp) :: listSkin = 1.0 - + real(kind=dp) :: listSkin = 1.0 !! initialize local variables @@ -264,6 +271,12 @@ contains endif #endif + +!! Begin force loop timing: +#ifdef PROFILE + call cpu_time(forceTimeInitial) + nloops = nloops + 1 +#endif if (FF_RequiresPrepairCalc() .and. SimRequiresPrepairCalc()) then !! See if we need to update neighbor lists @@ -272,7 +285,7 @@ contains !! do_prepair_loop_if_needed !! if_mpi_scatter_stuff_from_prepair !! if_mpi_gather_stuff_from_prepair_to_main_loop - + !--------------------PREFORCE LOOP----------->>>>>>>>>>>>>>>>>>>>>>>>>>> #ifdef IS_MPI @@ -348,7 +361,7 @@ contains neighborListSize = size(list) nlist = 0 - + do i = 1, natoms-1 point(i) = nlist + 1 @@ -360,7 +373,8 @@ contains if (rijsq < rlistsq) then - + + nlist = nlist + 1 if (nlist > neighborListSize) then @@ -385,7 +399,7 @@ contains point(natoms) = nlist + 1 else !! (update) - + ! use the list to find the neighbors do i = 1, natoms-1 JBEG = POINT(i) @@ -406,7 +420,10 @@ contains endif #endif !! Do rest of preforce calculations - call do_preforce(nlocal,pot) + !! do necessary preforce calculations + call do_preforce(nlocal,pot) + ! we have already updated the neighbor list set it to false... + update_nlist = .false. else !! See if we need to update neighbor lists for non pre-pair call checkNeighborList(nlocal, q, listSkin, update_nlist) @@ -425,7 +442,6 @@ contains #ifdef IS_MPI if (update_nlist) then - !! save current configuration, construct neighbor list, !! and calculate forces call saveNeighborList(nlocal, q) @@ -491,7 +507,7 @@ contains #else if (update_nlist) then - + ! save current configuration, contruct neighbor list, ! and calculate forces call saveNeighborList(natoms, q) @@ -559,7 +575,14 @@ contains #endif ! phew, done with main loop. - + +!! Do timing +#ifdef PROFILE + call cpu_time(forceTimeFinal) + forceTime = forceTime + forceTimeFinal - forceTimeInitial +#endif + + #ifdef IS_MPI !!distribute forces @@ -671,9 +694,11 @@ contains tau = tau_Temp virial = virial_Temp endif - + #endif + + end subroutine do_force_loop subroutine do_pair(i, j, rijsq, d, do_pot, do_stress, u_l, A, f, t, pot) @@ -726,7 +751,6 @@ contains call getElementProperty(atypes, me_j, "is_DP", is_DP_j) if ( is_DP_i .and. is_DP_j ) then - call do_dipole_pair(i, j, d, r, rijsq, pot, u_l, f, t, & do_pot, do_stress) if (FF_uses_RF .and. SimUsesRF()) then @@ -751,6 +775,7 @@ contains if (FF_uses_GB .and. SimUsesGB()) then + call getElementProperty(atypes, me_i, "is_GB", is_GB_i) call getElementProperty(atypes, me_j, "is_GB", is_GB_j) @@ -811,7 +836,7 @@ contains me_j = atid(j) #endif - + if (FF_uses_EAM .and. SimUsesEAM()) then call getElementProperty(atypes, me_i, "is_EAM", is_EAM_i) call getElementProperty(atypes, me_j, "is_EAM", is_EAM_j) @@ -819,7 +844,8 @@ contains if ( is_EAM_i .and. is_EAM_j ) & call calc_EAM_prepair_rho(i, j, d, r, rijsq ) endif - end subroutine do_prepair + + end subroutine do_prepair @@ -941,6 +967,15 @@ contains #endif + + if (FF_uses_EAM .and. SimUsesEAM()) then + call clean_EAM() + endif + + + + + rf = 0.0_dp tau_Temp = 0.0_dp virial_Temp = 0.0_dp @@ -1053,4 +1088,13 @@ end module do_Forces doesit = FF_uses_RF end function FF_RequiresPostpairCalc +#ifdef PROFILE + function getforcetime() return(totalforcetime) + real(kind=dp) :: totalforcetime + totalforcetime = forcetime + end function getforcetime +#endif + +!! This cleans componets of force arrays belonging only to fortran + end module do_Forces