ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/group/trunk/OOPSE-2.0/src/UseTheForce/doForces.F90
(Generate patch)

Comparing trunk/OOPSE-2.0/src/UseTheForce/doForces.F90 (file contents):
Revision 2351 by chuckv, Mon Oct 10 21:34:54 2005 UTC vs.
Revision 2356 by chuckv, Wed Oct 12 19:55:26 2005 UTC

# Line 45 | Line 45
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.55 2005-10-12 19:55:26 chuckv Exp $, $Date: 2005-10-12 19:55:26 $, $Name: not supported by cvs2svn $, $Revision: 1.55 $
49  
50  
51   module doForces
# Line 185 | Line 185 | contains
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
# Line 743 | Line 749 | contains
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
# Line 1082 | Line 1088 | contains
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,POT_ARRAY_SIZE
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:POT_ARRAY_SIZE) = pot_local(1:POT_ARRAY_SIZE &
1098 >               + pot_Temp(1:POT_ARRAY_SIZE,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,POT_ARRAY_SIZE
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:POT_ARRAY_SIZE) = pot_local(1:POT_ARRAY_SIZE)&
1107 >               + pot_Temp(1:POT_ARRAY_SIZE,i)
1108         enddo
1109  
1110      endif
# Line 1133 | Line 1143 | contains
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(RF_POT) = pot_local(RF_POT) + rfpot
1147   #else
1148 <                pot = pot + rfpot
1148 >                pot(RF_POT) = pot(RF_POT) + rfpot
1149  
1150   #endif
1151               endif
# Line 1147 | Line 1157 | contains
1157   #ifdef IS_MPI
1158  
1159      if (do_pot) then
1160 <       pot = pot + pot_local
1160 >       pot(1:SIZE_POT_ARRAY) = pot(1:SIZE_POT_ARRAY) &
1161 >            + pot_local(1:SIZE_POT_ARRAY)
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
# Line 1173 | Line 1184 | contains
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(POT_ARRAY_SIZE) :: pot
1189      real( kind = dp ), dimension(3) :: fpair
1190      real( kind = dp ), dimension(nLocal)   :: mfact
1191      real( kind = dp ), dimension(9,nLocal) :: eFrame
# Line 1205 | Line 1217 | contains
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, pot(LJ_POT), f, do_pot)
1221      endif
1222  
1223      if ( iand(iHash, ELECTROSTATIC_PAIR).ne.0 ) then
1224         call doElectrostaticPair(i, j, d, r, rijsq, sw, vpair, fpair, &
1225 <            pot, eFrame, f, t, do_pot)
1225 >            pot(ELECTROSTATIC_POT), eFrame, f, t, do_pot)
1226  
1227         if (electrostaticSummationMethod == REACTION_FIELD) then
1228  
# Line 1223 | Line 1235 | contains
1235  
1236      if ( iand(iHash, STICKY_PAIR).ne.0 ) then
1237         call do_sticky_pair(i, j, d, r, rijsq, sw, vpair, fpair, &
1238 <            pot, A, f, t, do_pot)
1238 >            pot(STICKY_POT), A, f, t, do_pot)
1239      endif
1240  
1241      if ( iand(iHash, STICKYPOWER_PAIR).ne.0 ) then
1242         call do_sticky_power_pair(i, j, d, r, rijsq, sw, vpair, fpair, &
1243 <            pot, A, f, t, do_pot)
1243 >            pot(STICKYPOWER_POT), A, f, t, do_pot)
1244      endif
1245  
1246      if ( iand(iHash, GAYBERNE_PAIR).ne.0 ) then
1247         call do_gb_pair(i, j, d, r, rijsq, sw, vpair, fpair, &
1248 <            pot, A, f, t, do_pot)
1248 >            pot(GAYBERNE_POT), A, f, t, do_pot)
1249      endif
1250      
1251      if ( iand(iHash, GAYBERNE_LJ).ne.0 ) then
1252   !      call do_gblj_pair(i, j, d, r, rijsq, sw, vpair, fpair, &
1253 < !           pot, A, f, t, do_pot)
1253 > !           pot(GAYBERNE_LJ_POT), A, f, t, do_pot)
1254      endif
1255  
1256      if ( iand(iHash, EAM_PAIR).ne.0 ) then      
1257 <       call do_eam_pair(i, j, d, r, rijsq, sw, vpair, fpair, pot, f, &
1257 >       call do_eam_pair(i, j, d, r, rijsq, sw, vpair, fpair, pot(EAM_POT), f, &
1258              do_pot)
1259      endif
1260  
1261      if ( iand(iHash, SHAPE_PAIR).ne.0 ) then      
1262         call do_shape_pair(i, j, d, r, rijsq, sw, vpair, fpair, &
1263 <            pot, A, f, t, do_pot)
1263 >            pot(SHAPE_POT), A, f, t, do_pot)
1264      endif
1265  
1266      if ( iand(iHash, SHAPE_LJ).ne.0 ) then      
1267         call do_shape_pair(i, j, d, r, rijsq, sw, vpair, fpair, &
1268 <            pot, A, f, t, do_pot)
1268 >            pot(SHAPE_LJ_POT), A, f, t, do_pot)
1269      endif
1270      
1271    end subroutine do_pair
# Line 1261 | Line 1273 | contains
1273    subroutine do_prepair(i, j, rijsq, d, sw, rcijsq, dc, &
1274         do_pot, do_stress, eFrame, A, f, t, pot)
1275  
1276 <    real( kind = dp ) :: pot, sw
1276 >    real( kind = dp ) :: sw
1277 >    real( kind = dp ), dimension(POT_ARRAY_SIZE) :: pot
1278      real( kind = dp ), dimension(9,nLocal) :: eFrame
1279      real (kind=dp), dimension(9,nLocal) :: A
1280      real (kind=dp), dimension(3,nLocal) :: f
# Line 1296 | Line 1309 | contains
1309  
1310    subroutine do_preforce(nlocal,pot)
1311      integer :: nlocal
1312 <    real( kind = dp ) :: pot
1312 >    real( kind = dp ),dimension(POT_ARRAY_SIZE) :: pot
1313  
1314      if (FF_uses_EAM .and. SIM_uses_EAM) then
1315 <       call calc_EAM_preforce_Frho(nlocal,pot)
1315 >       call calc_EAM_preforce_Frho(nlocal,pot(EAM_POT))
1316      endif
1317  
1318  

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines