45 |
|
|
46 |
|
!! @author Charles F. Vardeman II |
47 |
|
!! @author Matthew Meineke |
48 |
< |
!! @version $Id: doForces.F90,v 1.53 2005-10-11 22:00:30 chuckv Exp $, $Date: 2005-10-11 22:00:30 $, $Name: not supported by cvs2svn $, $Revision: 1.53 $ |
48 |
> |
!! @version $Id: doForces.F90,v 1.58 2005-10-14 15:44:37 kdaily Exp $, $Date: 2005-10-14 15:44:37 $, $Name: not supported by cvs2svn $, $Revision: 1.58 $ |
49 |
|
|
50 |
|
|
51 |
|
module doForces |
749 |
|
|
750 |
|
!! Stress Tensor |
751 |
|
real( kind = dp), dimension(9) :: tau |
752 |
< |
real ( kind = dp ) :: pot |
752 |
> |
real ( kind = dp ),dimension(LR_POT_TYPES) :: 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(LR_POT_TYPES) :: pot_local |
759 |
|
integer :: nAtomsInRow |
760 |
|
integer :: nAtomsInCol |
761 |
|
integer :: nprocs |
1088 |
|
|
1089 |
|
if (do_pot) then |
1090 |
|
! scatter/gather pot_row into the members of my column |
1091 |
< |
call scatter(pot_Row, pot_Temp, plan_atom_row) |
1092 |
< |
|
1091 |
> |
do i = 1,LR_POT_TYPES |
1092 |
> |
call scatter(pot_Row(i,:), pot_Temp(i,:), plan_atom_row) |
1093 |
> |
end do |
1094 |
|
! scatter/gather pot_local into all other procs |
1095 |
|
! add resultant to get total pot |
1096 |
|
do i = 1, nlocal |
1097 |
< |
pot_local = pot_local + pot_Temp(i) |
1097 |
> |
pot_local(1:LR_POT_TYPES) = pot_local(1:LR_POT_TYPES) & |
1098 |
> |
+ pot_Temp(1:LR_POT_TYPES,i) |
1099 |
|
enddo |
1100 |
|
|
1101 |
|
pot_Temp = 0.0_DP |
1102 |
< |
|
1103 |
< |
call scatter(pot_Col, pot_Temp, plan_atom_col) |
1102 |
> |
do i = 1,LR_POT_TYPES |
1103 |
> |
call scatter(pot_Col(i,:), pot_Temp(i,:), plan_atom_col) |
1104 |
> |
end do |
1105 |
|
do i = 1, nlocal |
1106 |
< |
pot_local = pot_local + pot_Temp(i) |
1106 |
> |
pot_local(1:LR_POT_TYPES) = pot_local(1:LR_POT_TYPES)& |
1107 |
> |
+ pot_Temp(1:LR_POT_TYPES,i) |
1108 |
|
enddo |
1109 |
|
|
1110 |
|
endif |
1143 |
|
!! potential and torques: |
1144 |
|
call reaction_field_final(i, mu_i, eFrame, rfpot, t, do_pot) |
1145 |
|
#ifdef IS_MPI |
1146 |
< |
pot_local = pot_local + rfpot |
1146 |
> |
pot_local(ELECTROSTATIC_POT) = pot_local(ELECTROSTATIC_POT) + rfpot |
1147 |
|
#else |
1148 |
< |
pot = pot + rfpot |
1148 |
> |
pot(ELECTROSTATIC_POT) = pot(ELECTROSTATIC_POT) + rfpot |
1149 |
|
|
1150 |
|
#endif |
1151 |
|
endif |
1157 |
|
#ifdef IS_MPI |
1158 |
|
|
1159 |
|
if (do_pot) then |
1160 |
< |
pot = pot + pot_local |
1160 |
> |
pot(1:LR_POT_TYPES) = pot(1:LR_POT_TYPES) & |
1161 |
> |
+ pot_local(1:LR_POT_TYPES) |
1162 |
|
!! we assume the c code will do the allreduce to get the total potential |
1163 |
|
!! we could do it right here if we needed to... |
1164 |
|
endif |
1184 |
|
subroutine do_pair(i, j, rijsq, d, sw, do_pot, & |
1185 |
|
eFrame, A, f, t, pot, vpair, fpair) |
1186 |
|
|
1187 |
< |
real( kind = dp ) :: pot, vpair, sw |
1187 |
> |
real( kind = dp ) :: vpair, sw |
1188 |
> |
real( kind = dp ), dimension(LR_POT_TYPES) :: pot |
1189 |
|
real( kind = dp ), dimension(3) :: fpair |
1190 |
|
real( kind = dp ), dimension(nLocal) :: mfact |
1191 |
|
real( kind = dp ), dimension(9,nLocal) :: eFrame |
1217 |
|
iHash = InteractionHash(me_i, me_j) |
1218 |
|
|
1219 |
|
if ( iand(iHash, LJ_PAIR).ne.0 ) then |
1220 |
< |
call do_lj_pair(i, j, d, r, rijsq, sw, vpair, fpair, pot, f, do_pot) |
1220 |
> |
call do_lj_pair(i, j, d, r, rijsq, sw, vpair, fpair, & |
1221 |
> |
pot(VDW_POT), f, do_pot) |
1222 |
|
endif |
1223 |
|
|
1224 |
|
if ( iand(iHash, ELECTROSTATIC_PAIR).ne.0 ) then |
1225 |
|
call doElectrostaticPair(i, j, d, r, rijsq, sw, vpair, fpair, & |
1226 |
< |
pot, eFrame, f, t, do_pot) |
1226 |
> |
pot(ELECTROSTATIC_POT), eFrame, f, t, do_pot) |
1227 |
|
|
1228 |
|
if (electrostaticSummationMethod == REACTION_FIELD) then |
1229 |
|
|
1236 |
|
|
1237 |
|
if ( iand(iHash, STICKY_PAIR).ne.0 ) then |
1238 |
|
call do_sticky_pair(i, j, d, r, rijsq, sw, vpair, fpair, & |
1239 |
< |
pot, A, f, t, do_pot) |
1239 |
> |
pot(HB_POT), A, f, t, do_pot) |
1240 |
|
endif |
1241 |
|
|
1242 |
|
if ( iand(iHash, STICKYPOWER_PAIR).ne.0 ) then |
1243 |
|
call do_sticky_power_pair(i, j, d, r, rijsq, sw, vpair, fpair, & |
1244 |
< |
pot, A, f, t, do_pot) |
1244 |
> |
pot(HB_POT), A, f, t, do_pot) |
1245 |
|
endif |
1246 |
|
|
1247 |
|
if ( iand(iHash, GAYBERNE_PAIR).ne.0 ) then |
1248 |
|
call do_gb_pair(i, j, d, r, rijsq, sw, vpair, fpair, & |
1249 |
< |
pot, A, f, t, do_pot) |
1249 |
> |
pot(VDW_POT), A, f, t, do_pot) |
1250 |
|
endif |
1251 |
|
|
1252 |
|
if ( iand(iHash, GAYBERNE_LJ).ne.0 ) then |
1253 |
< |
! call do_gblj_pair(i, j, d, r, rijsq, sw, vpair, fpair, & |
1254 |
< |
! pot, A, f, t, do_pot) |
1253 |
> |
call do_gb_lj_pair(i, j, d, r, rijsq, sw, vpair, fpair, & |
1254 |
> |
pot(VDW_POT), A, f, t, do_pot) |
1255 |
|
endif |
1256 |
|
|
1257 |
|
if ( iand(iHash, EAM_PAIR).ne.0 ) then |
1258 |
< |
call do_eam_pair(i, j, d, r, rijsq, sw, vpair, fpair, pot, f, & |
1259 |
< |
do_pot) |
1258 |
> |
call do_eam_pair(i, j, d, r, rijsq, sw, vpair, fpair, & |
1259 |
> |
pot(METALLIC_POT), f, do_pot) |
1260 |
|
endif |
1261 |
|
|
1262 |
|
if ( iand(iHash, SHAPE_PAIR).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(VDW_POT), A, f, t, do_pot) |
1265 |
|
endif |
1266 |
|
|
1267 |
|
if ( iand(iHash, SHAPE_LJ).ne.0 ) then |
1268 |
|
call do_shape_pair(i, j, d, r, rijsq, sw, vpair, fpair, & |
1269 |
< |
pot, A, f, t, do_pot) |
1269 |
> |
pot(VDW_POT), A, f, t, do_pot) |
1270 |
|
endif |
1271 |
|
|
1272 |
|
end subroutine do_pair |
1274 |
|
subroutine do_prepair(i, j, rijsq, d, sw, rcijsq, dc, & |
1275 |
|
do_pot, do_stress, eFrame, A, f, t, pot) |
1276 |
|
|
1277 |
< |
real( kind = dp ) :: pot, sw |
1277 |
> |
real( kind = dp ) :: sw |
1278 |
> |
real( kind = dp ), dimension(LR_POT_TYPES) :: pot |
1279 |
|
real( kind = dp ), dimension(9,nLocal) :: eFrame |
1280 |
|
real (kind=dp), dimension(9,nLocal) :: A |
1281 |
|
real (kind=dp), dimension(3,nLocal) :: f |
1310 |
|
|
1311 |
|
subroutine do_preforce(nlocal,pot) |
1312 |
|
integer :: nlocal |
1313 |
< |
real( kind = dp ) :: pot |
1313 |
> |
real( kind = dp ),dimension(LR_POT_TYPES) :: pot |
1314 |
|
|
1315 |
|
if (FF_uses_EAM .and. SIM_uses_EAM) then |
1316 |
< |
call calc_EAM_preforce_Frho(nlocal,pot) |
1316 |
> |
call calc_EAM_preforce_Frho(nlocal,pot(METALLIC_POT)) |
1317 |
|
endif |
1318 |
|
|
1319 |
|
|