45 |
|
|
46 |
|
!! @author Charles F. Vardeman II |
47 |
|
!! @author Matthew Meineke |
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 $ |
48 |
> |
!! @version $Id: doForces.F90,v 1.60 2005-10-18 15:01:42 chrisfen Exp $, $Date: 2005-10-18 15:01:42 $, $Name: not supported by cvs2svn $, $Revision: 1.60 $ |
49 |
|
|
50 |
|
|
51 |
|
module doForces |
58 |
|
use lj |
59 |
|
use sticky |
60 |
|
use electrostatic_module |
61 |
< |
use reaction_field_module |
62 |
< |
use gb_pair |
61 |
> |
use gayberne |
62 |
|
use shapes |
63 |
|
use vector_class |
64 |
|
use eam |
679 |
|
|
680 |
|
|
681 |
|
haveSaneForceField = .true. |
683 |
– |
|
684 |
– |
!! check to make sure the reaction field setting makes sense |
685 |
– |
|
686 |
– |
if (FF_uses_Dipoles) then |
687 |
– |
if (electrostaticSummationMethod == REACTION_FIELD) then |
688 |
– |
dielect = getDielect() |
689 |
– |
call initialize_rf(dielect) |
690 |
– |
endif |
691 |
– |
else |
692 |
– |
if (electrostaticSummationMethod == REACTION_FIELD) then |
693 |
– |
write(default_error,*) 'Using Reaction Field with no dipoles? Huh?' |
694 |
– |
thisStat = -1 |
695 |
– |
haveSaneForceField = .false. |
696 |
– |
return |
697 |
– |
endif |
698 |
– |
endif |
682 |
|
|
683 |
|
if (FF_uses_EAM) then |
684 |
|
call init_EAM_FF(my_status) |
688 |
|
haveSaneForceField = .false. |
689 |
|
return |
690 |
|
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 |
691 |
|
endif |
692 |
|
|
693 |
|
if (.not. haveNeighborList) then |
723 |
|
|
724 |
|
!! Stress Tensor |
725 |
|
real( kind = dp), dimension(9) :: tau |
726 |
< |
real ( kind = dp ),dimension(POT_ARRAY_SIZE) :: pot |
726 |
> |
real ( kind = dp ),dimension(LR_POT_TYPES) :: pot |
727 |
|
logical ( kind = 2) :: do_pot_c, do_stress_c |
728 |
|
logical :: do_pot |
729 |
|
logical :: do_stress |
730 |
|
logical :: in_switching_region |
731 |
|
#ifdef IS_MPI |
732 |
< |
real( kind = DP ), dimension(POT_ARRAY_SIZE) :: pot_local |
732 |
> |
real( kind = DP ), dimension(LR_POT_TYPES) :: pot_local |
733 |
|
integer :: nAtomsInRow |
734 |
|
integer :: nAtomsInCol |
735 |
|
integer :: nprocs |
1062 |
|
|
1063 |
|
if (do_pot) then |
1064 |
|
! scatter/gather pot_row into the members of my column |
1065 |
< |
call scatter(pot_Row, pot_Temp, plan_atom_row) |
1066 |
< |
|
1065 |
> |
do i = 1,LR_POT_TYPES |
1066 |
> |
call scatter(pot_Row(i,:), pot_Temp(i,:), plan_atom_row) |
1067 |
> |
end do |
1068 |
|
! scatter/gather pot_local into all other procs |
1069 |
|
! add resultant to get total pot |
1070 |
|
do i = 1, nlocal |
1071 |
< |
pot_local = pot_local + pot_Temp(i) |
1071 |
> |
pot_local(1:LR_POT_TYPES) = pot_local(1:LR_POT_TYPES) & |
1072 |
> |
+ pot_Temp(1:LR_POT_TYPES,i) |
1073 |
|
enddo |
1074 |
|
|
1075 |
|
pot_Temp = 0.0_DP |
1076 |
< |
|
1077 |
< |
call scatter(pot_Col, pot_Temp, plan_atom_col) |
1076 |
> |
do i = 1,LR_POT_TYPES |
1077 |
> |
call scatter(pot_Col(i,:), pot_Temp(i,:), plan_atom_col) |
1078 |
> |
end do |
1079 |
|
do i = 1, nlocal |
1080 |
< |
pot_local = pot_local + pot_Temp(i) |
1080 |
> |
pot_local(1:LR_POT_TYPES) = pot_local(1:LR_POT_TYPES)& |
1081 |
> |
+ pot_Temp(1:LR_POT_TYPES,i) |
1082 |
|
enddo |
1083 |
|
|
1084 |
|
endif |
1117 |
|
!! potential and torques: |
1118 |
|
call reaction_field_final(i, mu_i, eFrame, rfpot, t, do_pot) |
1119 |
|
#ifdef IS_MPI |
1120 |
< |
pot_local(RF_POT) = pot_local(RF_POT) + rfpot |
1120 |
> |
pot_local(ELECTROSTATIC_POT) = pot_local(ELECTROSTATIC_POT) + rfpot |
1121 |
|
#else |
1122 |
< |
pot(RF_POT) = pot(RF_POT) + rfpot |
1122 |
> |
pot(ELECTROSTATIC_POT) = pot(ELECTROSTATIC_POT) + rfpot |
1123 |
|
|
1124 |
|
#endif |
1125 |
|
endif |
1131 |
|
#ifdef IS_MPI |
1132 |
|
|
1133 |
|
if (do_pot) then |
1134 |
< |
pot(1:SIZE_POT_ARRAY) = pot(1:SIZE_POT_ARRAY) & |
1135 |
< |
+ pot_local(1:SIZE_POT_ARRAY) |
1134 |
> |
pot(1:LR_POT_TYPES) = pot(1:LR_POT_TYPES) & |
1135 |
> |
+ pot_local(1:LR_POT_TYPES) |
1136 |
|
!! we assume the c code will do the allreduce to get the total potential |
1137 |
|
!! we could do it right here if we needed to... |
1138 |
|
endif |
1159 |
|
eFrame, A, f, t, pot, vpair, fpair) |
1160 |
|
|
1161 |
|
real( kind = dp ) :: vpair, sw |
1162 |
< |
real( kind = dp ), dimension(POT_ARRAY_SIZE) :: pot |
1162 |
> |
real( kind = dp ), dimension(LR_POT_TYPES) :: pot |
1163 |
|
real( kind = dp ), dimension(3) :: fpair |
1164 |
|
real( kind = dp ), dimension(nLocal) :: mfact |
1165 |
|
real( kind = dp ), dimension(9,nLocal) :: eFrame |
1191 |
|
iHash = InteractionHash(me_i, me_j) |
1192 |
|
|
1193 |
|
if ( iand(iHash, LJ_PAIR).ne.0 ) then |
1194 |
< |
call do_lj_pair(i, j, d, r, rijsq, sw, vpair, fpair, pot(LJ_POT), f, do_pot) |
1194 |
> |
call do_lj_pair(i, j, d, r, rijsq, sw, vpair, fpair, & |
1195 |
> |
pot(VDW_POT), f, do_pot) |
1196 |
|
endif |
1197 |
|
|
1198 |
|
if ( iand(iHash, ELECTROSTATIC_PAIR).ne.0 ) then |
1210 |
|
|
1211 |
|
if ( iand(iHash, STICKY_PAIR).ne.0 ) then |
1212 |
|
call do_sticky_pair(i, j, d, r, rijsq, sw, vpair, fpair, & |
1213 |
< |
pot(STICKY_POT), A, f, t, do_pot) |
1213 |
> |
pot(HB_POT), A, f, t, do_pot) |
1214 |
|
endif |
1215 |
|
|
1216 |
|
if ( iand(iHash, STICKYPOWER_PAIR).ne.0 ) then |
1217 |
|
call do_sticky_power_pair(i, j, d, r, rijsq, sw, vpair, fpair, & |
1218 |
< |
pot(STICKYPOWER_POT), A, f, t, do_pot) |
1218 |
> |
pot(HB_POT), A, f, t, do_pot) |
1219 |
|
endif |
1220 |
|
|
1221 |
|
if ( iand(iHash, GAYBERNE_PAIR).ne.0 ) then |
1222 |
|
call do_gb_pair(i, j, d, r, rijsq, sw, vpair, fpair, & |
1223 |
< |
pot(GAYBERNE_POT), A, f, t, do_pot) |
1223 |
> |
pot(VDW_POT), A, f, t, do_pot) |
1224 |
|
endif |
1225 |
|
|
1226 |
|
if ( iand(iHash, GAYBERNE_LJ).ne.0 ) then |
1227 |
< |
! call do_gblj_pair(i, j, d, r, rijsq, sw, vpair, fpair, & |
1228 |
< |
! pot(GAYBERNE_LJ_POT), A, f, t, do_pot) |
1227 |
> |
call do_gb_lj_pair(i, j, d, r, rijsq, sw, vpair, fpair, & |
1228 |
> |
pot(VDW_POT), A, f, t, do_pot) |
1229 |
|
endif |
1230 |
|
|
1231 |
|
if ( iand(iHash, EAM_PAIR).ne.0 ) then |
1232 |
< |
call do_eam_pair(i, j, d, r, rijsq, sw, vpair, fpair, pot(EAM_POT), f, & |
1233 |
< |
do_pot) |
1232 |
> |
call do_eam_pair(i, j, d, r, rijsq, sw, vpair, fpair, & |
1233 |
> |
pot(METALLIC_POT), f, do_pot) |
1234 |
|
endif |
1235 |
|
|
1236 |
|
if ( iand(iHash, SHAPE_PAIR).ne.0 ) then |
1237 |
|
call do_shape_pair(i, j, d, r, rijsq, sw, vpair, fpair, & |
1238 |
< |
pot(SHAPE_POT), A, f, t, do_pot) |
1238 |
> |
pot(VDW_POT), A, f, t, do_pot) |
1239 |
|
endif |
1240 |
|
|
1241 |
|
if ( iand(iHash, SHAPE_LJ).ne.0 ) then |
1242 |
|
call do_shape_pair(i, j, d, r, rijsq, sw, vpair, fpair, & |
1243 |
< |
pot(SHAPE_LJ_POT), A, f, t, do_pot) |
1243 |
> |
pot(VDW_POT), A, f, t, do_pot) |
1244 |
|
endif |
1245 |
|
|
1246 |
|
end subroutine do_pair |
1249 |
|
do_pot, do_stress, eFrame, A, f, t, pot) |
1250 |
|
|
1251 |
|
real( kind = dp ) :: sw |
1252 |
< |
real( kind = dp ), dimension(POT_ARRAY_SIZE) :: pot |
1252 |
> |
real( kind = dp ), dimension(LR_POT_TYPES) :: pot |
1253 |
|
real( kind = dp ), dimension(9,nLocal) :: eFrame |
1254 |
|
real (kind=dp), dimension(9,nLocal) :: A |
1255 |
|
real (kind=dp), dimension(3,nLocal) :: f |
1284 |
|
|
1285 |
|
subroutine do_preforce(nlocal,pot) |
1286 |
|
integer :: nlocal |
1287 |
< |
real( kind = dp ),dimension(POT_ARRAY_SIZE) :: pot |
1287 |
> |
real( kind = dp ),dimension(LR_POT_TYPES) :: pot |
1288 |
|
|
1289 |
|
if (FF_uses_EAM .and. SIM_uses_EAM) then |
1290 |
< |
call calc_EAM_preforce_Frho(nlocal,pot(EAM_POT)) |
1290 |
> |
call calc_EAM_preforce_Frho(nlocal,pot(METALLIC_POT)) |
1291 |
|
endif |
1292 |
|
|
1293 |
|
|