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.59 2005-10-17 19:12:34 gezelter Exp $, $Date: 2005-10-17 19:12:34 $, $Name: not supported by cvs2svn $, $Revision: 1.59 $ |
49 |
|
|
50 |
|
|
51 |
|
module doForces |
59 |
|
use sticky |
60 |
|
use electrostatic_module |
61 |
|
use reaction_field_module |
62 |
< |
use gb_pair |
62 |
> |
use gayberne |
63 |
|
use shapes |
64 |
|
use vector_class |
65 |
|
use eam |
705 |
|
haveSaneForceField = .false. |
706 |
|
return |
707 |
|
end if |
708 |
– |
endif |
709 |
– |
|
710 |
– |
if (FF_uses_GayBerne) then |
711 |
– |
call check_gb_pair_FF(my_status) |
712 |
– |
if (my_status .ne. 0) then |
713 |
– |
thisStat = -1 |
714 |
– |
haveSaneForceField = .false. |
715 |
– |
return |
716 |
– |
endif |
708 |
|
endif |
709 |
|
|
710 |
|
if (.not. haveNeighborList) then |
740 |
|
|
741 |
|
!! Stress Tensor |
742 |
|
real( kind = dp), dimension(9) :: tau |
743 |
< |
real ( kind = dp ) :: pot |
743 |
> |
real ( kind = dp ),dimension(LR_POT_TYPES) :: pot |
744 |
|
logical ( kind = 2) :: do_pot_c, do_stress_c |
745 |
|
logical :: do_pot |
746 |
|
logical :: do_stress |
747 |
|
logical :: in_switching_region |
748 |
|
#ifdef IS_MPI |
749 |
< |
real( kind = DP ) :: pot_local |
749 |
> |
real( kind = DP ), dimension(LR_POT_TYPES) :: pot_local |
750 |
|
integer :: nAtomsInRow |
751 |
|
integer :: nAtomsInCol |
752 |
|
integer :: nprocs |
1079 |
|
|
1080 |
|
if (do_pot) then |
1081 |
|
! scatter/gather pot_row into the members of my column |
1082 |
< |
call scatter(pot_Row, pot_Temp, plan_atom_row) |
1083 |
< |
|
1082 |
> |
do i = 1,LR_POT_TYPES |
1083 |
> |
call scatter(pot_Row(i,:), pot_Temp(i,:), plan_atom_row) |
1084 |
> |
end do |
1085 |
|
! scatter/gather pot_local into all other procs |
1086 |
|
! add resultant to get total pot |
1087 |
|
do i = 1, nlocal |
1088 |
< |
pot_local = pot_local + pot_Temp(i) |
1088 |
> |
pot_local(1:LR_POT_TYPES) = pot_local(1:LR_POT_TYPES) & |
1089 |
> |
+ pot_Temp(1:LR_POT_TYPES,i) |
1090 |
|
enddo |
1091 |
|
|
1092 |
|
pot_Temp = 0.0_DP |
1093 |
< |
|
1094 |
< |
call scatter(pot_Col, pot_Temp, plan_atom_col) |
1093 |
> |
do i = 1,LR_POT_TYPES |
1094 |
> |
call scatter(pot_Col(i,:), pot_Temp(i,:), plan_atom_col) |
1095 |
> |
end do |
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 |
|
endif |
1134 |
|
!! potential and torques: |
1135 |
|
call reaction_field_final(i, mu_i, eFrame, rfpot, t, do_pot) |
1136 |
|
#ifdef IS_MPI |
1137 |
< |
pot_local = pot_local + rfpot |
1137 |
> |
pot_local(ELECTROSTATIC_POT) = pot_local(ELECTROSTATIC_POT) + rfpot |
1138 |
|
#else |
1139 |
< |
pot = pot + rfpot |
1139 |
> |
pot(ELECTROSTATIC_POT) = pot(ELECTROSTATIC_POT) + rfpot |
1140 |
|
|
1141 |
|
#endif |
1142 |
|
endif |
1148 |
|
#ifdef IS_MPI |
1149 |
|
|
1150 |
|
if (do_pot) then |
1151 |
< |
pot = pot + pot_local |
1151 |
> |
pot(1:LR_POT_TYPES) = pot(1:LR_POT_TYPES) & |
1152 |
> |
+ pot_local(1:LR_POT_TYPES) |
1153 |
|
!! we assume the c code will do the allreduce to get the total potential |
1154 |
|
!! we could do it right here if we needed to... |
1155 |
|
endif |
1175 |
|
subroutine do_pair(i, j, rijsq, d, sw, do_pot, & |
1176 |
|
eFrame, A, f, t, pot, vpair, fpair) |
1177 |
|
|
1178 |
< |
real( kind = dp ) :: pot, vpair, sw |
1178 |
> |
real( kind = dp ) :: vpair, sw |
1179 |
> |
real( kind = dp ), dimension(LR_POT_TYPES) :: pot |
1180 |
|
real( kind = dp ), dimension(3) :: fpair |
1181 |
|
real( kind = dp ), dimension(nLocal) :: mfact |
1182 |
|
real( kind = dp ), dimension(9,nLocal) :: eFrame |
1208 |
|
iHash = InteractionHash(me_i, me_j) |
1209 |
|
|
1210 |
|
if ( iand(iHash, LJ_PAIR).ne.0 ) then |
1211 |
< |
call do_lj_pair(i, j, d, r, rijsq, sw, vpair, fpair, pot, f, do_pot) |
1211 |
> |
call do_lj_pair(i, j, d, r, rijsq, sw, vpair, fpair, & |
1212 |
> |
pot(VDW_POT), f, do_pot) |
1213 |
|
endif |
1214 |
|
|
1215 |
|
if ( iand(iHash, ELECTROSTATIC_PAIR).ne.0 ) then |
1216 |
|
call doElectrostaticPair(i, j, d, r, rijsq, sw, vpair, fpair, & |
1217 |
< |
pot, eFrame, f, t, do_pot) |
1217 |
> |
pot(ELECTROSTATIC_POT), eFrame, f, t, do_pot) |
1218 |
|
|
1219 |
|
if (electrostaticSummationMethod == REACTION_FIELD) then |
1220 |
|
|
1227 |
|
|
1228 |
|
if ( iand(iHash, STICKY_PAIR).ne.0 ) then |
1229 |
|
call do_sticky_pair(i, j, d, r, rijsq, sw, vpair, fpair, & |
1230 |
< |
pot, A, f, t, do_pot) |
1230 |
> |
pot(HB_POT), A, f, t, do_pot) |
1231 |
|
endif |
1232 |
|
|
1233 |
|
if ( iand(iHash, STICKYPOWER_PAIR).ne.0 ) then |
1234 |
|
call do_sticky_power_pair(i, j, d, r, rijsq, sw, vpair, fpair, & |
1235 |
< |
pot, A, f, t, do_pot) |
1235 |
> |
pot(HB_POT), A, f, t, do_pot) |
1236 |
|
endif |
1237 |
|
|
1238 |
|
if ( iand(iHash, GAYBERNE_PAIR).ne.0 ) then |
1239 |
|
call do_gb_pair(i, j, d, r, rijsq, sw, vpair, fpair, & |
1240 |
< |
pot, A, f, t, do_pot) |
1240 |
> |
pot(VDW_POT), A, f, t, do_pot) |
1241 |
|
endif |
1242 |
|
|
1243 |
|
if ( iand(iHash, GAYBERNE_LJ).ne.0 ) then |
1244 |
< |
! call do_gblj_pair(i, j, d, r, rijsq, sw, vpair, fpair, & |
1245 |
< |
! pot, A, f, t, do_pot) |
1244 |
> |
call do_gb_lj_pair(i, j, d, r, rijsq, sw, vpair, fpair, & |
1245 |
> |
pot(VDW_POT), A, f, t, do_pot) |
1246 |
|
endif |
1247 |
|
|
1248 |
|
if ( iand(iHash, EAM_PAIR).ne.0 ) then |
1249 |
< |
call do_eam_pair(i, j, d, r, rijsq, sw, vpair, fpair, pot, f, & |
1250 |
< |
do_pot) |
1249 |
> |
call do_eam_pair(i, j, d, r, rijsq, sw, vpair, fpair, & |
1250 |
> |
pot(METALLIC_POT), f, do_pot) |
1251 |
|
endif |
1252 |
|
|
1253 |
|
if ( iand(iHash, SHAPE_PAIR).ne.0 ) then |
1254 |
|
call do_shape_pair(i, j, d, r, rijsq, sw, vpair, fpair, & |
1255 |
< |
pot, A, f, t, do_pot) |
1255 |
> |
pot(VDW_POT), A, f, t, do_pot) |
1256 |
|
endif |
1257 |
|
|
1258 |
|
if ( iand(iHash, SHAPE_LJ).ne.0 ) then |
1259 |
|
call do_shape_pair(i, j, d, r, rijsq, sw, vpair, fpair, & |
1260 |
< |
pot, A, f, t, do_pot) |
1260 |
> |
pot(VDW_POT), A, f, t, do_pot) |
1261 |
|
endif |
1262 |
|
|
1263 |
|
end subroutine do_pair |
1265 |
|
subroutine do_prepair(i, j, rijsq, d, sw, rcijsq, dc, & |
1266 |
|
do_pot, do_stress, eFrame, A, f, t, pot) |
1267 |
|
|
1268 |
< |
real( kind = dp ) :: pot, sw |
1268 |
> |
real( kind = dp ) :: sw |
1269 |
> |
real( kind = dp ), dimension(LR_POT_TYPES) :: pot |
1270 |
|
real( kind = dp ), dimension(9,nLocal) :: eFrame |
1271 |
|
real (kind=dp), dimension(9,nLocal) :: A |
1272 |
|
real (kind=dp), dimension(3,nLocal) :: f |
1301 |
|
|
1302 |
|
subroutine do_preforce(nlocal,pot) |
1303 |
|
integer :: nlocal |
1304 |
< |
real( kind = dp ) :: pot |
1304 |
> |
real( kind = dp ),dimension(LR_POT_TYPES) :: pot |
1305 |
|
|
1306 |
|
if (FF_uses_EAM .and. SIM_uses_EAM) then |
1307 |
< |
call calc_EAM_preforce_Frho(nlocal,pot) |
1307 |
> |
call calc_EAM_preforce_Frho(nlocal,pot(METALLIC_POT)) |
1308 |
|
endif |
1309 |
|
|
1310 |
|
|