45 |
|
|
46 |
|
!! @author Charles F. Vardeman II |
47 |
|
!! @author Matthew Meineke |
48 |
< |
!! @version $Id: doForces.F90,v 1.52 2005-10-10 21:34:54 chuckv Exp $, $Date: 2005-10-10 21:34:54 $, $Name: not supported by cvs2svn $, $Revision: 1.52 $ |
48 |
> |
!! @version $Id: doForces.F90,v 1.54 2005-10-12 18:59:16 chuckv Exp $, $Date: 2005-10-12 18:59:16 $, $Name: not supported by cvs2svn $, $Revision: 1.54 $ |
49 |
|
|
50 |
|
|
51 |
|
module doForces |
185 |
|
|
186 |
|
if (.not. allocated(InteractionHash)) then |
187 |
|
allocate(InteractionHash(nAtypes,nAtypes)) |
188 |
+ |
else |
189 |
+ |
deallocate(InteractionHash) |
190 |
+ |
allocate(InteractionHash(nAtypes,nAtypes)) |
191 |
|
endif |
192 |
|
|
193 |
|
if (.not. allocated(atypeMaxCutoff)) then |
194 |
|
allocate(atypeMaxCutoff(nAtypes)) |
195 |
+ |
else |
196 |
+ |
deallocate(atypeMaxCutoff) |
197 |
+ |
allocate(atypeMaxCutoff(nAtypes)) |
198 |
|
endif |
199 |
|
|
200 |
|
do i = 1, nAtypes |
749 |
|
|
750 |
|
!! Stress Tensor |
751 |
|
real( kind = dp), dimension(9) :: tau |
752 |
< |
real ( kind = dp ) :: pot |
752 |
> |
real ( kind = dp ),dimension(POT_ARRAY_SIZE) :: pot |
753 |
|
logical ( kind = 2) :: do_pot_c, do_stress_c |
754 |
|
logical :: do_pot |
755 |
|
logical :: do_stress |
756 |
|
logical :: in_switching_region |
757 |
|
#ifdef IS_MPI |
758 |
< |
real( kind = DP ) :: pot_local |
758 |
> |
real( kind = DP ), dimension(POT_ARRAY_SIZE) :: pot_local |
759 |
|
integer :: nAtomsInRow |
760 |
|
integer :: nAtomsInCol |
761 |
|
integer :: nprocs |
1139 |
|
!! potential and torques: |
1140 |
|
call reaction_field_final(i, mu_i, eFrame, rfpot, t, do_pot) |
1141 |
|
#ifdef IS_MPI |
1142 |
< |
pot_local = pot_local + rfpot |
1142 |
> |
pot_local(RF_POT) = pot_local(RF_POT) + rfpot |
1143 |
|
#else |
1144 |
< |
pot = pot + rfpot |
1144 |
> |
pot(RF_POT) = pot(RF_POT) + rfpot |
1145 |
|
|
1146 |
|
#endif |
1147 |
|
endif |
1153 |
|
#ifdef IS_MPI |
1154 |
|
|
1155 |
|
if (do_pot) then |
1156 |
< |
pot = pot + pot_local |
1156 |
> |
pot(1:SIZE_POT_ARRAY) = pot(1:SIZE_POT_ARRAY) & |
1157 |
> |
+ pot_local(1:SIZE_POT_ARRAY) |
1158 |
|
!! we assume the c code will do the allreduce to get the total potential |
1159 |
|
!! we could do it right here if we needed to... |
1160 |
|
endif |
1180 |
|
subroutine do_pair(i, j, rijsq, d, sw, do_pot, & |
1181 |
|
eFrame, A, f, t, pot, vpair, fpair) |
1182 |
|
|
1183 |
< |
real( kind = dp ) :: pot, vpair, sw |
1183 |
> |
real( kind = dp ) :: vpair, sw |
1184 |
> |
real( kind = dp ), dimension(POT_ARRAY_SIZE) :: pot |
1185 |
|
real( kind = dp ), dimension(3) :: fpair |
1186 |
|
real( kind = dp ), dimension(nLocal) :: mfact |
1187 |
|
real( kind = dp ), dimension(9,nLocal) :: eFrame |
1213 |
|
iHash = InteractionHash(me_i, me_j) |
1214 |
|
|
1215 |
|
if ( iand(iHash, LJ_PAIR).ne.0 ) then |
1216 |
< |
call do_lj_pair(i, j, d, r, rijsq, sw, vpair, fpair, pot, f, do_pot) |
1216 |
> |
call do_lj_pair(i, j, d, r, rijsq, sw, vpair, fpair, pot(LJ_POT), f, do_pot) |
1217 |
|
endif |
1218 |
|
|
1219 |
|
if ( iand(iHash, ELECTROSTATIC_PAIR).ne.0 ) then |
1220 |
|
call doElectrostaticPair(i, j, d, r, rijsq, sw, vpair, fpair, & |
1221 |
< |
pot, eFrame, f, t, do_pot) |
1221 |
> |
pot(ELECTROSTATIC_POT), eFrame, f, t, do_pot) |
1222 |
|
|
1223 |
|
if (electrostaticSummationMethod == REACTION_FIELD) then |
1224 |
|
|
1231 |
|
|
1232 |
|
if ( iand(iHash, STICKY_PAIR).ne.0 ) then |
1233 |
|
call do_sticky_pair(i, j, d, r, rijsq, sw, vpair, fpair, & |
1234 |
< |
pot, A, f, t, do_pot) |
1234 |
> |
pot(STICKY_POT), A, f, t, do_pot) |
1235 |
|
endif |
1236 |
|
|
1237 |
|
if ( iand(iHash, STICKYPOWER_PAIR).ne.0 ) then |
1238 |
|
call do_sticky_power_pair(i, j, d, r, rijsq, sw, vpair, fpair, & |
1239 |
< |
pot, A, f, t, do_pot) |
1239 |
> |
pot(STICKYPOWER_POT), A, f, t, do_pot) |
1240 |
|
endif |
1241 |
|
|
1242 |
|
if ( iand(iHash, GAYBERNE_PAIR).ne.0 ) then |
1243 |
|
call do_gb_pair(i, j, d, r, rijsq, sw, vpair, fpair, & |
1244 |
< |
pot, A, f, t, do_pot) |
1244 |
> |
pot(GAYBERNE_POT), A, f, t, do_pot) |
1245 |
|
endif |
1246 |
|
|
1247 |
|
if ( iand(iHash, GAYBERNE_LJ).ne.0 ) then |
1248 |
|
! call do_gblj_pair(i, j, d, r, rijsq, sw, vpair, fpair, & |
1249 |
< |
! pot, A, f, t, do_pot) |
1249 |
> |
! pot(GAYBERNE_LJ_POT), A, f, t, do_pot) |
1250 |
|
endif |
1251 |
|
|
1252 |
|
if ( iand(iHash, EAM_PAIR).ne.0 ) then |
1253 |
< |
call do_eam_pair(i, j, d, r, rijsq, sw, vpair, fpair, pot, f, & |
1253 |
> |
call do_eam_pair(i, j, d, r, rijsq, sw, vpair, fpair, pot(EAM_POT), f, & |
1254 |
|
do_pot) |
1255 |
|
endif |
1256 |
|
|
1257 |
|
if ( iand(iHash, SHAPE_PAIR).ne.0 ) then |
1258 |
|
call do_shape_pair(i, j, d, r, rijsq, sw, vpair, fpair, & |
1259 |
< |
pot, A, f, t, do_pot) |
1259 |
> |
pot(SHAPE_POT), A, f, t, do_pot) |
1260 |
|
endif |
1261 |
|
|
1262 |
|
if ( iand(iHash, SHAPE_LJ).ne.0 ) then |
1263 |
|
call do_shape_pair(i, j, d, r, rijsq, sw, vpair, fpair, & |
1264 |
< |
pot, A, f, t, do_pot) |
1264 |
> |
pot(SHAPE_LJ_POT), A, f, t, do_pot) |
1265 |
|
endif |
1266 |
|
|
1267 |
|
end subroutine do_pair |
1269 |
|
subroutine do_prepair(i, j, rijsq, d, sw, rcijsq, dc, & |
1270 |
|
do_pot, do_stress, eFrame, A, f, t, pot) |
1271 |
|
|
1272 |
< |
real( kind = dp ) :: pot, sw |
1272 |
> |
real( kind = dp ) :: sw |
1273 |
> |
real( kind = dp ), dimension(POT_ARRAY_SIZE) :: pot |
1274 |
|
real( kind = dp ), dimension(9,nLocal) :: eFrame |
1275 |
|
real (kind=dp), dimension(9,nLocal) :: A |
1276 |
|
real (kind=dp), dimension(3,nLocal) :: f |
1305 |
|
|
1306 |
|
subroutine do_preforce(nlocal,pot) |
1307 |
|
integer :: nlocal |
1308 |
< |
real( kind = dp ) :: pot |
1308 |
> |
real( kind = dp ),dimension(POT_ARRAY_SIZE) :: pot |
1309 |
|
|
1310 |
|
if (FF_uses_EAM .and. SIM_uses_EAM) then |
1311 |
< |
call calc_EAM_preforce_Frho(nlocal,pot) |
1311 |
> |
call calc_EAM_preforce_Frho(nlocal,pot(EAM_POT)) |
1312 |
|
endif |
1313 |
|
|
1314 |
|
|