4 |
|
|
5 |
|
!! @author Charles F. Vardeman II |
6 |
|
!! @author Matthew Meineke |
7 |
< |
!! @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 $ |
7 |
> |
!! @version $Id: do_Forces.F90,v 1.38 2003-12-18 20:46:45 chuckv Exp $, $Date: 2003-12-18 20:46:45 $, $Name: not supported by cvs2svn $, $Revision: 1.38 $ |
8 |
|
|
9 |
|
module do_Forces |
10 |
|
use force_globals |
45 |
|
public :: do_force_loop |
46 |
|
public :: setRlistDF |
47 |
|
|
48 |
+ |
#ifdef PROFILE |
49 |
+ |
public :: getforcetime |
50 |
+ |
real, save :: forceTime = 0 |
51 |
+ |
real :: forceTimeInitial, forceTimeFinal |
52 |
+ |
#endif |
53 |
+ |
|
54 |
|
contains |
55 |
|
|
56 |
|
subroutine setRlistDF( this_rlist ) |
152 |
|
|
153 |
|
|
154 |
|
if (FF_uses_EAM) then |
155 |
< |
call init_EAM_FF(my_status) |
155 |
> |
call init_EAM_FF(my_status) |
156 |
|
if (my_status /= 0) then |
157 |
+ |
write(*,*) "init_EAM_FF returned a bad status" |
158 |
|
thisStat = -1 |
159 |
|
return |
160 |
|
end if |
213 |
|
real( kind = DP ) :: pot_local |
214 |
|
integer :: nrow |
215 |
|
integer :: ncol |
216 |
+ |
integer :: nprocs |
217 |
|
#endif |
218 |
|
integer :: nlocal |
219 |
|
integer :: natoms |
229 |
|
integer :: listerror, error |
230 |
|
integer :: localError |
231 |
|
|
232 |
< |
real(kind=dp) :: listSkin = 1.0 |
225 |
< |
|
232 |
> |
real(kind=dp) :: listSkin = 1.0 |
233 |
|
|
234 |
|
!! initialize local variables |
235 |
|
|
271 |
|
endif |
272 |
|
|
273 |
|
#endif |
274 |
+ |
|
275 |
+ |
!! Begin force loop timing: |
276 |
+ |
#ifdef PROFILE |
277 |
+ |
call cpu_time(forceTimeInitial) |
278 |
+ |
nloops = nloops + 1 |
279 |
+ |
#endif |
280 |
|
|
281 |
|
if (FF_RequiresPrepairCalc() .and. SimRequiresPrepairCalc()) then |
282 |
|
!! See if we need to update neighbor lists |
285 |
|
!! do_prepair_loop_if_needed |
286 |
|
!! if_mpi_scatter_stuff_from_prepair |
287 |
|
!! if_mpi_gather_stuff_from_prepair_to_main_loop |
288 |
< |
|
288 |
> |
|
289 |
|
!--------------------PREFORCE LOOP----------->>>>>>>>>>>>>>>>>>>>>>>>>>> |
290 |
|
#ifdef IS_MPI |
291 |
|
|
361 |
|
neighborListSize = size(list) |
362 |
|
|
363 |
|
nlist = 0 |
364 |
< |
|
364 |
> |
|
365 |
|
do i = 1, natoms-1 |
366 |
|
point(i) = nlist + 1 |
367 |
|
|
373 |
|
|
374 |
|
|
375 |
|
if (rijsq < rlistsq) then |
376 |
< |
|
376 |
> |
|
377 |
> |
|
378 |
|
nlist = nlist + 1 |
379 |
|
|
380 |
|
if (nlist > neighborListSize) then |
399 |
|
point(natoms) = nlist + 1 |
400 |
|
|
401 |
|
else !! (update) |
402 |
< |
|
402 |
> |
|
403 |
|
! use the list to find the neighbors |
404 |
|
do i = 1, natoms-1 |
405 |
|
JBEG = POINT(i) |
420 |
|
endif |
421 |
|
#endif |
422 |
|
!! Do rest of preforce calculations |
423 |
< |
call do_preforce(nlocal,pot) |
423 |
> |
!! do necessary preforce calculations |
424 |
> |
call do_preforce(nlocal,pot) |
425 |
> |
! we have already updated the neighbor list set it to false... |
426 |
> |
update_nlist = .false. |
427 |
|
else |
428 |
|
!! See if we need to update neighbor lists for non pre-pair |
429 |
|
call checkNeighborList(nlocal, q, listSkin, update_nlist) |
442 |
|
#ifdef IS_MPI |
443 |
|
|
444 |
|
if (update_nlist) then |
428 |
– |
|
445 |
|
!! save current configuration, construct neighbor list, |
446 |
|
!! and calculate forces |
447 |
|
call saveNeighborList(nlocal, q) |
507 |
|
#else |
508 |
|
|
509 |
|
if (update_nlist) then |
510 |
< |
|
510 |
> |
|
511 |
|
! save current configuration, contruct neighbor list, |
512 |
|
! and calculate forces |
513 |
|
call saveNeighborList(natoms, q) |
575 |
|
#endif |
576 |
|
|
577 |
|
! phew, done with main loop. |
578 |
< |
|
578 |
> |
|
579 |
> |
!! Do timing |
580 |
> |
#ifdef PROFILE |
581 |
> |
call cpu_time(forceTimeFinal) |
582 |
> |
forceTime = forceTime + forceTimeFinal - forceTimeInitial |
583 |
> |
#endif |
584 |
> |
|
585 |
> |
|
586 |
|
#ifdef IS_MPI |
587 |
|
!!distribute forces |
588 |
|
|
696 |
|
endif |
697 |
|
|
698 |
|
#endif |
699 |
< |
|
699 |
> |
|
700 |
> |
|
701 |
> |
endif |
702 |
> |
|
703 |
> |
#endif |
704 |
> |
|
705 |
|
end subroutine do_force_loop |
706 |
|
|
707 |
|
subroutine do_pair(i, j, rijsq, d, do_pot, do_stress, u_l, A, f, t, pot) |
754 |
|
call getElementProperty(atypes, me_j, "is_DP", is_DP_j) |
755 |
|
|
756 |
|
if ( is_DP_i .and. is_DP_j ) then |
729 |
– |
|
757 |
|
call do_dipole_pair(i, j, d, r, rijsq, pot, u_l, f, t, & |
758 |
|
do_pot, do_stress) |
759 |
|
if (FF_uses_RF .and. SimUsesRF()) then |
778 |
|
|
779 |
|
if (FF_uses_GB .and. SimUsesGB()) then |
780 |
|
|
781 |
+ |
|
782 |
|
call getElementProperty(atypes, me_i, "is_GB", is_GB_i) |
783 |
|
call getElementProperty(atypes, me_j, "is_GB", is_GB_j) |
784 |
|
|
839 |
|
me_j = atid(j) |
840 |
|
|
841 |
|
#endif |
842 |
< |
|
842 |
> |
|
843 |
|
if (FF_uses_EAM .and. SimUsesEAM()) then |
844 |
|
call getElementProperty(atypes, me_i, "is_EAM", is_EAM_i) |
845 |
|
call getElementProperty(atypes, me_j, "is_EAM", is_EAM_j) |
847 |
|
if ( is_EAM_i .and. is_EAM_j ) & |
848 |
|
call calc_EAM_prepair_rho(i, j, d, r, rijsq ) |
849 |
|
endif |
822 |
– |
end subroutine do_prepair |
850 |
|
|
851 |
+ |
end subroutine do_prepair |
852 |
|
|
853 |
|
|
854 |
|
|
855 |
+ |
|
856 |
|
subroutine do_preforce(nlocal,pot) |
857 |
|
integer :: nlocal |
858 |
|
real( kind = dp ) :: pot |
970 |
|
|
971 |
|
#endif |
972 |
|
|
973 |
+ |
|
974 |
+ |
if (FF_uses_EAM .and. SimUsesEAM()) then |
975 |
+ |
call clean_EAM() |
976 |
+ |
endif |
977 |
+ |
|
978 |
+ |
|
979 |
+ |
|
980 |
+ |
|
981 |
+ |
|
982 |
|
rf = 0.0_dp |
983 |
|
tau_Temp = 0.0_dp |
984 |
|
virial_Temp = 0.0_dp |
1091 |
|
doesit = FF_uses_RF |
1092 |
|
end function FF_RequiresPostpairCalc |
1093 |
|
|
1094 |
+ |
#ifdef PROFILE |
1095 |
+ |
function getforcetime() return(totalforcetime) |
1096 |
+ |
real(kind=dp) :: totalforcetime |
1097 |
+ |
totalforcetime = forcetime |
1098 |
+ |
end function getforcetime |
1099 |
+ |
#endif |
1100 |
+ |
|
1101 |
+ |
!! This cleans componets of force arrays belonging only to fortran |
1102 |
+ |
|
1103 |
|
end module do_Forces |