4 |
|
|
5 |
|
!! @author Charles F. Vardeman II |
6 |
|
!! @author Matthew Meineke |
7 |
< |
!! @version $Id: do_Forces.F90,v 1.35 2003-10-29 20:41:39 mmeineke Exp $, $Date: 2003-10-29 20:41:39 $, $Name: not supported by cvs2svn $, $Revision: 1.35 $ |
7 |
> |
!! @version $Id: do_Forces.F90,v 1.41 2004-01-05 21:00:05 chuckv Exp $, $Date: 2004-01-05 21:00:05 $, $Name: not supported by cvs2svn $, $Revision: 1.41 $ |
8 |
|
|
9 |
|
module do_Forces |
10 |
|
use force_globals |
46 |
|
public :: setRlistDF |
47 |
|
|
48 |
|
#ifdef PROFILE |
49 |
< |
real(kind = dp) :: forceTime |
50 |
< |
real(kind = dp) :: forceTimeInitial, forceTimeFinal |
51 |
< |
real(kind = dp) :: globalForceTime |
52 |
< |
real(kind = dp) :: maxForceTime |
53 |
< |
integer, save :: nloops = 0 |
49 |
> |
public :: getforcetime |
50 |
> |
real, save :: forceTime = 0 |
51 |
> |
real :: forceTimeInitial, forceTimeFinal |
52 |
> |
integer :: nLoops |
53 |
|
#endif |
54 |
|
|
55 |
|
contains |
230 |
|
integer :: listerror, error |
231 |
|
integer :: localError |
232 |
|
|
233 |
< |
real(kind=dp) :: listSkin = 1.0 |
235 |
< |
|
233 |
> |
real(kind=dp) :: listSkin = 1.0 |
234 |
|
|
235 |
|
!! initialize local variables |
236 |
|
|
443 |
|
#ifdef IS_MPI |
444 |
|
|
445 |
|
if (update_nlist) then |
448 |
– |
|
446 |
|
!! save current configuration, construct neighbor list, |
447 |
|
!! and calculate forces |
448 |
|
call saveNeighborList(nlocal, q) |
508 |
|
#else |
509 |
|
|
510 |
|
if (update_nlist) then |
511 |
< |
|
511 |
> |
|
512 |
|
! save current configuration, contruct neighbor list, |
513 |
|
! and calculate forces |
514 |
|
call saveNeighborList(natoms, q) |
695 |
|
tau = tau_Temp |
696 |
|
virial = virial_Temp |
697 |
|
endif |
698 |
< |
|
702 |
< |
#endif |
703 |
< |
|
704 |
< |
#ifdef PROFILE |
705 |
< |
if (do_pot) then |
706 |
< |
|
707 |
< |
#ifdef IS_MPI |
708 |
< |
|
709 |
< |
|
710 |
< |
call printCommTime() |
711 |
< |
|
712 |
< |
call mpi_allreduce(forceTime,globalForceTime,1,MPI_DOUBLE_PRECISION, & |
713 |
< |
mpi_sum,mpi_comm_world,mpi_err) |
714 |
< |
|
715 |
< |
call mpi_allreduce(forceTime,maxForceTime,1,MPI_DOUBLE_PRECISION, & |
716 |
< |
MPI_MAX,mpi_comm_world,mpi_err) |
717 |
< |
|
718 |
< |
call mpi_comm_size( MPI_COMM_WORLD, nprocs,mpi_err) |
719 |
< |
|
720 |
< |
if (getMyNode() == 0) then |
721 |
< |
write(*,*) "Total processor time spent in force calculations is: ", globalForceTime |
722 |
< |
write(*,*) "Total Time spent in force loop per processor is: ", globalforceTime/nprocs |
723 |
< |
write(*,*) "Maximum force time on any processor is: ", maxForceTime |
724 |
< |
end if |
725 |
< |
#else |
726 |
< |
write(*,*) "Time spent in force loop is: ", forceTime |
698 |
> |
|
699 |
|
#endif |
700 |
< |
|
701 |
< |
|
702 |
< |
endif |
731 |
< |
|
732 |
< |
#endif |
733 |
< |
|
700 |
> |
|
701 |
> |
|
702 |
> |
|
703 |
|
end subroutine do_force_loop |
704 |
|
|
705 |
|
subroutine do_pair(i, j, rijsq, d, do_pot, do_stress, u_l, A, f, t, pot) |
721 |
|
logical :: is_EAM_i,is_EAM_j |
722 |
|
logical :: is_Sticky_i, is_Sticky_j |
723 |
|
integer :: me_i, me_j |
724 |
< |
|
724 |
> |
integer :: propPack_i |
725 |
> |
integer :: propPack_j |
726 |
|
r = sqrt(rijsq) |
727 |
|
|
728 |
|
#ifdef IS_MPI |
740 |
|
|
741 |
|
#endif |
742 |
|
|
743 |
+ |
call getElementProperty(atypes, me_i, "propertyPack", propPack_i) |
744 |
+ |
call getElementProperty(atypes, me_j, "propertyPack", propPack_j) |
745 |
+ |
|
746 |
+ |
! unpack the properties |
747 |
+ |
|
748 |
+ |
if (iand(propPack_i, LJ_PROPERTY_MASK) .eq. LJ_PROPERTY_MASK) is_LJ_i = .true. |
749 |
+ |
if (iand(propPack_i, DP_PROPERTY_MASK) .eq. DP_PROPERTY_MASK) is_DP_i = .true. |
750 |
+ |
if (iand(propPack_i, STICKY_PROPERTY_MASK) .eq. STICKY_PROPERTY_MASK) is_Sticky_i = .true. |
751 |
+ |
if (iand(propPack_i, GB_PROPERTY_MASK) .eq. GB_PROPERTY_MASK) is_GB_i = .true. |
752 |
+ |
if (iand(propPack_i, EAM_PROPERTY_MASK) .eq. EAM_PROPERTY_MASK) is_EAM_i = .true. |
753 |
+ |
|
754 |
+ |
if (iand(propPack_j, LJ_PROPERTY_MASK) .eq. LJ_PROPERTY_MASK) is_LJ_j = .true. |
755 |
+ |
if (iand(propPack_j, DP_PROPERTY_MASK) .eq. DP_PROPERTY_MASK) is_DP_j = .true. |
756 |
+ |
if (iand(propPack_j, STICKY_PROPERTY_MASK) .eq. STICKY_PROPERTY_MASK) is_Sticky_j = .true. |
757 |
+ |
if (iand(propPack_j, GB_PROPERTY_MASK) .eq. GB_PROPERTY_MASK) is_GB_j = .true. |
758 |
+ |
if (iand(propPack_j, EAM_PROPERTY_MASK) .eq. EAM_PROPERTY_MASK) is_EAM_j = .true. |
759 |
+ |
|
760 |
+ |
|
761 |
|
if (FF_uses_LJ .and. SimUsesLJ()) then |
774 |
– |
call getElementProperty(atypes, me_i, "is_LJ", is_LJ_i) |
775 |
– |
call getElementProperty(atypes, me_j, "is_LJ", is_LJ_j) |
762 |
|
|
763 |
|
if ( is_LJ_i .and. is_LJ_j ) & |
764 |
|
call do_lj_pair(i, j, d, r, rijsq, pot, f, do_pot, do_stress) |
765 |
+ |
|
766 |
|
endif |
767 |
|
|
768 |
|
if (FF_uses_dipoles .and. SimUsesDipoles()) then |
782 |
– |
call getElementProperty(atypes, me_i, "is_DP", is_DP_i) |
783 |
– |
call getElementProperty(atypes, me_j, "is_DP", is_DP_j) |
769 |
|
|
770 |
|
if ( is_DP_i .and. is_DP_j ) then |
771 |
|
call do_dipole_pair(i, j, d, r, rijsq, pot, u_l, f, t, & |
780 |
|
|
781 |
|
if (FF_uses_Sticky .and. SimUsesSticky()) then |
782 |
|
|
798 |
– |
call getElementProperty(atypes, me_i, "is_Sticky", is_Sticky_i) |
799 |
– |
call getElementProperty(atypes, me_j, "is_Sticky", is_Sticky_j) |
800 |
– |
|
783 |
|
if ( is_Sticky_i .and. is_Sticky_j ) then |
784 |
|
call do_sticky_pair(i, j, d, r, rijsq, A, pot, f, t, & |
785 |
|
do_pot, do_stress) |
788 |
|
|
789 |
|
|
790 |
|
if (FF_uses_GB .and. SimUsesGB()) then |
809 |
– |
|
810 |
– |
|
811 |
– |
call getElementProperty(atypes, me_i, "is_GB", is_GB_i) |
812 |
– |
call getElementProperty(atypes, me_j, "is_GB", is_GB_j) |
791 |
|
|
792 |
|
if ( is_GB_i .and. is_GB_j ) then |
793 |
|
call do_gb_pair(i, j, d, r, rijsq, u_l, pot, f, t, & |
794 |
|
do_pot, do_stress) |
795 |
|
endif |
796 |
+ |
|
797 |
|
endif |
798 |
|
|
799 |
|
|
800 |
|
|
801 |
|
if (FF_uses_EAM .and. SimUsesEAM()) then |
823 |
– |
call getElementProperty(atypes, me_i, "is_EAM", is_EAM_i) |
824 |
– |
call getElementProperty(atypes, me_j, "is_EAM", is_EAM_j) |
802 |
|
|
803 |
|
if ( is_EAM_i .and. is_EAM_j ) & |
804 |
|
call do_eam_pair(i, j, d, r, rijsq, pot, f, do_pot, do_stress) |
828 |
– |
endif |
829 |
– |
|
805 |
|
|
806 |
< |
|
806 |
> |
endif |
807 |
|
|
808 |
|
end subroutine do_pair |
809 |
|
|
1095 |
|
doesit = FF_uses_RF |
1096 |
|
end function FF_RequiresPostpairCalc |
1097 |
|
|
1098 |
+ |
#ifdef PROFILE |
1099 |
+ |
function getforcetime() result(totalforcetime) |
1100 |
+ |
real(kind=dp) :: totalforcetime |
1101 |
+ |
totalforcetime = forcetime |
1102 |
+ |
end function getforcetime |
1103 |
+ |
#endif |
1104 |
+ |
|
1105 |
|
!! This cleans componets of force arrays belonging only to fortran |
1106 |
|
|
1107 |
|
end module do_Forces |