45 |
|
|
46 |
|
!! @author Charles F. Vardeman II |
47 |
|
!! @author Matthew Meineke |
48 |
< |
!! @version $Id: doForces.F90,v 1.18 2005-05-18 18:31:40 chrisfen Exp $, $Date: 2005-05-18 18:31:40 $, $Name: not supported by cvs2svn $, $Revision: 1.18 $ |
48 |
> |
!! @version $Id: doForces.F90,v 1.21 2005-06-27 22:21:37 chuckv Exp $, $Date: 2005-06-27 22:21:37 $, $Name: not supported by cvs2svn $, $Revision: 1.21 $ |
49 |
|
|
50 |
|
|
51 |
|
module doForces |
73 |
|
|
74 |
|
#define __FORTRAN90 |
75 |
|
#include "UseTheForce/fSwitchingFunction.h" |
76 |
+ |
#include "UseTheForce/DarkSide/fInteractionMap.h" |
77 |
|
|
78 |
|
INTEGER, PARAMETER:: PREPAIR_LOOP = 1 |
79 |
|
INTEGER, PARAMETER:: PAIR_LOOP = 2 |
116 |
|
logical, save :: SIM_uses_PBC |
117 |
|
logical, save :: SIM_uses_molecular_cutoffs |
118 |
|
|
119 |
< |
real(kind=dp), save :: rlist, rlistsq |
119 |
> |
!!!GO AWAY--------- |
120 |
> |
!!!!!real(kind=dp), save :: rlist, rlistsq |
121 |
|
|
122 |
|
public :: init_FF |
123 |
|
public :: do_force_loop |
124 |
< |
public :: setRlistDF |
124 |
> |
! public :: setRlistDF |
125 |
|
|
126 |
|
#ifdef PROFILE |
127 |
|
public :: getforcetime |
147 |
|
|
148 |
|
type(Properties), dimension(:),allocatable :: PropertyMap |
149 |
|
|
148 |
– |
contains |
150 |
|
|
151 |
< |
subroutine setRlistDF( this_rlist ) |
151 |
> |
|
152 |
> |
type, public :: Interaction |
153 |
> |
integer :: InteractionHash |
154 |
> |
real(kind=dp) :: rCut |
155 |
> |
end type Interaction |
156 |
> |
|
157 |
> |
type(Interaction), public, dimension(:,:), allocatable :: InteractionMap |
158 |
> |
|
159 |
> |
!public :: addInteraction |
160 |
> |
!public :: setInteractionHash |
161 |
> |
!public :: getInteractionHash |
162 |
> |
public :: createInteractionMap |
163 |
|
|
164 |
< |
real(kind=dp) :: this_rlist |
164 |
> |
contains |
165 |
|
|
166 |
< |
rlist = this_rlist |
167 |
< |
rlistsq = rlist * rlist |
166 |
> |
|
167 |
> |
subroutine createInteractionMap(status) |
168 |
> |
integer :: nAtypes |
169 |
> |
integer :: status |
170 |
> |
integer :: i |
171 |
> |
integer :: j |
172 |
> |
integer :: ihash |
173 |
> |
real(kind=dp) :: myRcut |
174 |
> |
! Test Types |
175 |
> |
logical :: i_is_LJ |
176 |
> |
logical :: i_is_Elect |
177 |
> |
logical :: i_is_Sticky |
178 |
> |
logical :: i_is_StickyP |
179 |
> |
logical :: i_is_GB |
180 |
> |
logical :: i_is_EAM |
181 |
> |
logical :: i_is_Shape |
182 |
> |
logical :: j_is_LJ |
183 |
> |
logical :: j_is_Elect |
184 |
> |
logical :: j_is_Sticky |
185 |
> |
logical :: j_is_StickyP |
186 |
> |
logical :: j_is_GB |
187 |
> |
logical :: j_is_EAM |
188 |
> |
logical :: j_is_Shape |
189 |
> |
|
190 |
> |
|
191 |
> |
if (.not. associated(atypes)) then |
192 |
> |
call handleError("atype", "atypes was not present before call of createDefaultInteractionMap!") |
193 |
> |
status = -1 |
194 |
> |
return |
195 |
> |
endif |
196 |
> |
|
197 |
> |
nAtypes = getSize(atypes) |
198 |
> |
|
199 |
> |
if (nAtypes == 0) then |
200 |
> |
status = -1 |
201 |
> |
return |
202 |
> |
end if |
203 |
|
|
204 |
< |
haveRlist = .true. |
204 |
> |
if (.not. allocated(InteractionMap)) then |
205 |
> |
allocate(InteractionMap(nAtypes,nAtypes)) |
206 |
> |
endif |
207 |
> |
|
208 |
> |
do i = 1, nAtypes |
209 |
> |
call getElementProperty(atypes, i, "is_LennardJones", i_is_LJ) |
210 |
> |
call getElementProperty(atypes, i, "is_Electrostatic", i_is_Elect) |
211 |
> |
call getElementProperty(atypes, i, "is_Sticky", i_is_Sticky) |
212 |
> |
call getElementProperty(atypes, i, "is_StickyPower", i_is_StickyP) |
213 |
> |
call getElementProperty(atypes, i, "is_GayBerne", i_is_GB) |
214 |
> |
call getElementProperty(atypes, i, "is_EAM", i_is_EAM) |
215 |
> |
call getElementProperty(atypes, i, "is_Shape", i_is_Shape) |
216 |
|
|
217 |
< |
end subroutine setRlistDF |
217 |
> |
do j = i, nAtypes |
218 |
> |
|
219 |
> |
iHash = 0 |
220 |
> |
myRcut = 0.0_dp |
221 |
> |
|
222 |
> |
call getElementProperty(atypes, j, "is_LennardJones", j_is_LJ) |
223 |
> |
call getElementProperty(atypes, j, "is_Electrostatic", j_is_Elect) |
224 |
> |
call getElementProperty(atypes, j, "is_Sticky", j_is_Sticky) |
225 |
> |
call getElementProperty(atypes, j, "is_StickyPower", j_is_StickyP) |
226 |
> |
call getElementProperty(atypes, j, "is_GayBerne", j_is_GB) |
227 |
> |
call getElementProperty(atypes, j, "is_EAM", j_is_EAM) |
228 |
> |
call getElementProperty(atypes, j, "is_Shape", j_is_Shape) |
229 |
> |
|
230 |
> |
if (i_is_LJ .and. j_is_LJ) then |
231 |
> |
iHash = ior(iHash, LJ_PAIR) |
232 |
> |
|
233 |
> |
|
234 |
> |
|
235 |
> |
endif |
236 |
> |
|
237 |
> |
|
238 |
> |
|
239 |
> |
if (i_is_Elect .and. j_is_Elect) iHash = ior(iHash, ELECTROSTATIC_PAIR) |
240 |
> |
if (i_is_Sticky .and. j_is_Sticky) iHash = ior(iHash, STICKY_PAIR) |
241 |
> |
if (i_is_StickyP .and. j_is_StickyP) iHash = ior(iHash, STICKYPOWER_PAIR) |
242 |
> |
|
243 |
> |
if (i_is_EAM .and. j_is_EAM) iHash = ior(iHash, EAM_PAIR) |
244 |
> |
|
245 |
> |
if (i_is_GB .and. j_is_GB) iHash = ior(iHash, GAYBERNE_PAIR) |
246 |
> |
if (i_is_GB .and. j_is_LJ) iHash = ior(iHash, GAYBERNE_LJ) |
247 |
> |
if (i_is_LJ .and. j_is_GB) iHash = ior(iHash, GAYBERNE_LJ) |
248 |
|
|
249 |
+ |
if (i_is_Shape .and. j_is_Shape) iHash = ior(iHash, SHAPE_PAIR) |
250 |
+ |
if (i_is_Shape .and. j_is_LJ) iHash = ior(iHash, SHAPE_LJ) |
251 |
+ |
if (i_is_LJ .and. j_is_Shape) iHash = ior(iHash, SHAPE_LJ) |
252 |
+ |
|
253 |
+ |
|
254 |
+ |
InteractionMap(i,j)%InteractionHash = iHash |
255 |
+ |
InteractionMap(j,i)%InteractionHash = iHash |
256 |
+ |
|
257 |
+ |
end do |
258 |
+ |
|
259 |
+ |
end do |
260 |
+ |
end subroutine createInteractionMap |
261 |
+ |
|
262 |
+ |
|
263 |
+ |
|
264 |
+ |
!!! THIS GOES AWAY FOR SIZE DEPENDENT CUTOFF |
265 |
+ |
!!$ subroutine setRlistDF( this_rlist ) |
266 |
+ |
!!$ |
267 |
+ |
!!$ real(kind=dp) :: this_rlist |
268 |
+ |
!!$ |
269 |
+ |
!!$ rlist = this_rlist |
270 |
+ |
!!$ rlistsq = rlist * rlist |
271 |
+ |
!!$ |
272 |
+ |
!!$ haveRlist = .true. |
273 |
+ |
!!$ |
274 |
+ |
!!$ end subroutine setRlistDF |
275 |
+ |
|
276 |
|
subroutine createPropertyMap(status) |
277 |
|
integer :: nAtypes |
278 |
|
integer :: status |
1041 |
|
real ( kind = dp ) :: ebalance |
1042 |
|
integer :: me_i, me_j |
1043 |
|
|
1044 |
+ |
integer :: iMap |
1045 |
+ |
|
1046 |
|
r = sqrt(rijsq) |
1047 |
|
vpair = 0.0d0 |
1048 |
|
fpair(1:3) = 0.0d0 |
1055 |
|
me_j = atid(j) |
1056 |
|
#endif |
1057 |
|
|
1058 |
< |
! write(*,*) i, j, me_i, me_j |
1058 |
> |
iMap = InteractionMap(me_i, me_j)%InteractionHash |
1059 |
|
|
1060 |
< |
if (FF_uses_LennardJones .and. SIM_uses_LennardJones) then |
1061 |
< |
|
945 |
< |
if ( PropertyMap(me_i)%is_LennardJones .and. & |
946 |
< |
PropertyMap(me_j)%is_LennardJones ) then |
947 |
< |
call do_lj_pair(i, j, d, r, rijsq, sw, vpair, fpair, pot, f, do_pot) |
948 |
< |
endif |
949 |
< |
|
1060 |
> |
if ( iand(iMap, LJ_PAIR).ne.0 ) then |
1061 |
> |
call do_lj_pair(i, j, d, r, rijsq, sw, vpair, fpair, pot, f, do_pot) |
1062 |
|
endif |
1063 |
|
|
1064 |
< |
if (FF_uses_Electrostatics .and. SIM_uses_Electrostatics) then |
1064 |
> |
if ( iand(iMap, ELECTROSTATIC_PAIR).ne.0 ) then |
1065 |
> |
call doElectrostaticPair(i, j, d, r, rijsq, sw, vpair, fpair, & |
1066 |
> |
pot, eFrame, f, t, do_pot) |
1067 |
|
|
1068 |
< |
if (PropertyMap(me_i)%is_Electrostatic .and. & |
955 |
< |
PropertyMap(me_j)%is_Electrostatic) then |
956 |
< |
call doElectrostaticPair(i, j, d, r, rijsq, sw, vpair, fpair, & |
957 |
< |
pot, eFrame, f, t, do_pot, ebalance) |
958 |
< |
endif |
959 |
< |
|
960 |
< |
if (FF_uses_dipoles .and. SIM_uses_dipoles) then |
1068 |
> |
if (FF_uses_dipoles .and. SIM_uses_dipoles) then |
1069 |
|
if ( PropertyMap(me_i)%is_Dipole .and. & |
1070 |
|
PropertyMap(me_j)%is_Dipole) then |
1071 |
|
if (FF_uses_RF .and. SIM_uses_RF) then |
1076 |
|
endif |
1077 |
|
endif |
1078 |
|
|
1079 |
+ |
if ( iand(iMap, STICKY_PAIR).ne.0 ) then |
1080 |
+ |
call do_sticky_pair(i, j, d, r, rijsq, sw, vpair, fpair, & |
1081 |
+ |
pot, A, f, t, do_pot) |
1082 |
+ |
endif |
1083 |
|
|
1084 |
< |
if (FF_uses_Sticky .and. SIM_uses_sticky) then |
1085 |
< |
|
1086 |
< |
if ( PropertyMap(me_i)%is_Sticky .and. PropertyMap(me_j)%is_Sticky) then |
975 |
< |
call do_sticky_pair(i, j, d, r, rijsq, sw, vpair, fpair, & |
976 |
< |
pot, A, f, t, do_pot) |
977 |
< |
endif |
978 |
< |
|
1084 |
> |
if ( iand(iMap, STICKYPOWER_PAIR).ne.0 ) then |
1085 |
> |
call do_sticky_power_pair(i, j, d, r, rijsq, sw, vpair, fpair, & |
1086 |
> |
pot, A, f, t, do_pot) |
1087 |
|
endif |
1088 |
|
|
1089 |
< |
if (FF_uses_StickyPower .and. SIM_uses_stickypower) then |
1090 |
< |
if ( PropertyMap(me_i)%is_StickyPower .and. & |
1091 |
< |
PropertyMap(me_j)%is_StickyPower) then |
984 |
< |
call do_sticky_power_pair(i, j, d, r, rijsq, sw, vpair, fpair, & |
985 |
< |
pot, A, f, t, do_pot, ebalance) |
986 |
< |
endif |
1089 |
> |
if ( iand(iMap, GAYBERNE_PAIR).ne.0 ) then |
1090 |
> |
call do_gb_pair(i, j, d, r, rijsq, sw, vpair, fpair, & |
1091 |
> |
pot, A, f, t, do_pot) |
1092 |
|
endif |
1093 |
|
|
1094 |
< |
if (FF_uses_GayBerne .and. SIM_uses_GayBerne) then |
1095 |
< |
|
1096 |
< |
if ( PropertyMap(me_i)%is_GayBerne .and. & |
992 |
< |
PropertyMap(me_j)%is_GayBerne) then |
993 |
< |
call do_gb_pair(i, j, d, r, rijsq, sw, vpair, fpair, & |
994 |
< |
pot, A, f, t, do_pot) |
995 |
< |
endif |
996 |
< |
|
1094 |
> |
if ( iand(iMap, GAYBERNE_LJ).ne.0 ) then |
1095 |
> |
call do_gblj_pair(i, j, d, r, rijsq, sw, vpair, fpair, & |
1096 |
> |
pot, A, f, t, do_pot) |
1097 |
|
endif |
1098 |
|
|
1099 |
< |
if (FF_uses_EAM .and. SIM_uses_EAM) then |
1100 |
< |
|
1101 |
< |
if ( PropertyMap(me_i)%is_EAM .and. PropertyMap(me_j)%is_EAM) then |
1002 |
< |
call do_eam_pair(i, j, d, r, rijsq, sw, vpair, fpair, pot, f, & |
1003 |
< |
do_pot) |
1004 |
< |
endif |
1005 |
< |
|
1099 |
> |
if ( iand(iMap, EAM_PAIR).ne.0 ) then |
1100 |
> |
call do_eam_pair(i, j, d, r, rijsq, sw, vpair, fpair, pot, f, & |
1101 |
> |
do_pot) |
1102 |
|
endif |
1103 |
|
|
1104 |
< |
|
1105 |
< |
! write(*,*) PropertyMap(me_i)%is_Shape,PropertyMap(me_j)%is_Shape |
1106 |
< |
|
1011 |
< |
if (FF_uses_Shapes .and. SIM_uses_Shapes) then |
1012 |
< |
if ( PropertyMap(me_i)%is_Shape .and. & |
1013 |
< |
PropertyMap(me_j)%is_Shape ) then |
1014 |
< |
call do_shape_pair(i, j, d, r, rijsq, sw, vpair, fpair, & |
1015 |
< |
pot, A, f, t, do_pot) |
1016 |
< |
endif |
1017 |
< |
if ( (PropertyMap(me_i)%is_Shape .and. & |
1018 |
< |
PropertyMap(me_j)%is_LennardJones) .or. & |
1019 |
< |
(PropertyMap(me_i)%is_LennardJones .and. & |
1020 |
< |
PropertyMap(me_j)%is_Shape) ) then |
1021 |
< |
call do_shape_pair(i, j, d, r, rijsq, sw, vpair, fpair, & |
1022 |
< |
pot, A, f, t, do_pot) |
1023 |
< |
endif |
1104 |
> |
if ( iand(iMap, SHAPE_PAIR).ne.0 ) then |
1105 |
> |
call do_shape_pair(i, j, d, r, rijsq, sw, vpair, fpair, & |
1106 |
> |
pot, A, f, t, do_pot) |
1107 |
|
endif |
1108 |
|
|
1109 |
+ |
if ( iand(iMap, SHAPE_LJ).ne.0 ) then |
1110 |
+ |
call do_shape_pair(i, j, d, r, rijsq, sw, vpair, fpair, & |
1111 |
+ |
pot, A, f, t, do_pot) |
1112 |
+ |
endif |
1113 |
+ |
|
1114 |
|
end subroutine do_pair |
1115 |
|
|
1116 |
|
subroutine do_prepair(i, j, rijsq, d, sw, rcijsq, dc, & |
1128 |
|
real ( kind = dp ) :: r, rc |
1129 |
|
real ( kind = dp ), intent(inout) :: d(3), dc(3) |
1130 |
|
|
1131 |
< |
logical :: is_EAM_i, is_EAM_j |
1131 |
> |
integer :: me_i, me_j, iMap |
1132 |
|
|
1045 |
– |
integer :: me_i, me_j |
1046 |
– |
|
1047 |
– |
|
1048 |
– |
r = sqrt(rijsq) |
1049 |
– |
if (SIM_uses_molecular_cutoffs) then |
1050 |
– |
rc = sqrt(rcijsq) |
1051 |
– |
else |
1052 |
– |
rc = r |
1053 |
– |
endif |
1054 |
– |
|
1055 |
– |
|
1133 |
|
#ifdef IS_MPI |
1134 |
|
me_i = atid_row(i) |
1135 |
|
me_j = atid_col(j) |
1138 |
|
me_j = atid(j) |
1139 |
|
#endif |
1140 |
|
|
1141 |
< |
if (FF_uses_EAM .and. SIM_uses_EAM) then |
1141 |
> |
iMap = InteractionMap(me_i, me_j)%InteractionHash |
1142 |
|
|
1143 |
< |
if (PropertyMap(me_i)%is_EAM .and. PropertyMap(me_j)%is_EAM) & |
1143 |
> |
if ( iand(iMap, EAM_PAIR).ne.0 ) then |
1144 |
|
call calc_EAM_prepair_rho(i, j, d, r, rijsq ) |
1068 |
– |
|
1145 |
|
endif |
1146 |
< |
|
1146 |
> |
|
1147 |
|
end subroutine do_prepair |
1148 |
|
|
1149 |
|
|