--- trunk/OOPSE/libmdtools/do_Forces.F90 2004/05/26 16:41:23 1197 +++ trunk/OOPSE/libmdtools/do_Forces.F90 2004/05/27 15:21:20 1199 @@ -4,7 +4,7 @@ !! @author Charles F. Vardeman II !! @author Matthew Meineke -!! @version $Id: do_Forces.F90,v 1.62 2004-05-26 16:41:23 gezelter Exp $, $Date: 2004-05-26 16:41:23 $, $Name: not supported by cvs2svn $, $Revision: 1.62 $ +!! @version $Id: do_Forces.F90,v 1.64 2004-05-27 15:21:20 gezelter Exp $, $Date: 2004-05-27 15:21:20 $, $Name: not supported by cvs2svn $, $Revision: 1.64 $ module do_Forces use force_globals @@ -375,7 +375,7 @@ contains !! Position array provided by C, dimensioned by getNlocal real ( kind = dp ), dimension(3, nLocal) :: q !! molecular center-of-mass position array - real ( kind = dp ), dimension(3, nGroup) :: q_group + real ( kind = dp ), dimension(3, nGroups) :: q_group !! Rotation Matrix for each long range particle in simulation. real( kind = dp), dimension(9, nLocal) :: A !! Unit vectors for dipoles (lab frame) @@ -394,11 +394,11 @@ contains logical :: in_switching_region #ifdef IS_MPI real( kind = DP ) :: pot_local - integer :: nrow - integer :: ncol + integer :: nAtomsInRow + integer :: nAtomsInCol integer :: nprocs - integer :: nrow_group - integer :: ncol_group + integer :: nGroupsInRow + integer :: nGroupsInCol #endif integer :: natoms logical :: update_nlist @@ -424,10 +424,10 @@ contains #ifdef IS_MPI pot_local = 0.0_dp - nrow = getNrow(plan_row) - ncol = getNcol(plan_col) - nrow_group = getNrowGroup(plan_row) - ncol_group = getNcolGroup(plan_col) + nAtomsInRow = getNatomsInRow(plan_atom_row) + nAtomsInCol = getNatomsInCol(plan_atom_col) + nGroupsInRow = getNgroupsInRow(plan_group_row) + nGroupsInCol = getNgroupsInCol(plan_group_col) #else natoms = nlocal #endif @@ -447,18 +447,18 @@ contains #ifdef IS_MPI - call gather(q, q_Row, plan_row3d) - call gather(q, q_Col, plan_col3d) + call gather(q, q_Row, plan_atom_row_3d) + call gather(q, q_Col, plan_atom_col_3d) - call gather(q_group, q_group_Row, plan_row_Group_3d) - call gather(q_group, q_group_Col, plan_col_Group_3d) + call gather(q_group, q_group_Row, plan_group_row_3d) + call gather(q_group, q_group_Col, plan_group_col_3d) if (FF_UsesDirectionalAtoms() .and. SIM_uses_directional_atoms) then - call gather(u_l,u_l_Row,plan_row3d) - call gather(u_l,u_l_Col,plan_col3d) + call gather(u_l, u_l_Row, plan_atom_row_3d) + call gather(u_l, u_l_Col, plan_atom_col_3d) - call gather(A,A_Row,plan_row_rotation) - call gather(A,A_Col,plan_col_rotation) + call gather(A, A_Row, plan_atom_row_rotation) + call gather(A, A_Col, plan_atom_col_rotation) endif #endif @@ -481,35 +481,39 @@ contains ! See if we need to update neighbor lists ! (but only on the first time through): if (loop .eq. loopStart) then - call checkNeighborList(nGroup, q_group, listSkin, update_nlist) + call checkNeighborList(nGroups, q_group, listSkin, update_nlist) endif if (update_nlist) then !! save current configuration and construct neighbor list - call saveNeighborList(nGroup, q_group) +#ifdef IS_MPI + call saveNeighborList(nGroupsInRow, q_group) +#else + call saveNeighborList(nGroups, q_group) +#endif neighborListSize = size(list) nlist = 0 endif istart = 1 #ifdef IS_MPI - iend = nrow_group + iend = nGroupsInRow #else - iend = nGroup - 1 + iend = nGroups - 1 #endif outer: do i = istart, iend if (update_nlist) point(i) = nlist + 1 - n_in_i = groupStart(i+1) - groupStart(i) + n_in_i = groupStartRow(i+1) - groupStartRow(i) if (update_nlist) then #ifdef IS_MPI jstart = 1 - jend = ncol_group + jend = nGroupsInCol #else jstart = i+1 - jend = nGroup + jend = nGroups #endif else jstart = point(i) @@ -524,6 +528,7 @@ contains else j = list(jnab) endif + #ifdef IS_MPI call get_interatomic_vector(q_group_Row(:,i), & q_group_Col(:,j), d_grp, rgrpsq) @@ -531,12 +536,17 @@ contains call get_interatomic_vector(q_group(:,i), & q_group(:,j), d_grp, rgrpsq) #endif + if (rgrpsq < rlistsq) then if (update_nlist) then nlist = nlist + 1 if (nlist > neighborListSize) then - call expandNeighborList(nGroup, listerror) +#ifdef IS_MPI + call expandNeighborList(nGroupsInRow, listerror) +#else + call expandNeighborList(nGroups, listerror) +#endif if (listerror /= 0) then error = -1 write(DEFAULT_ERROR,*) "ERROR: nlist > list size and max allocations exceeded." @@ -556,15 +566,15 @@ contains call get_switch(rgrpsq, sw, dswdr, rgrp, group_switch, & in_switching_region) - n_in_j = groupStart(j+1) - groupStart(j) + n_in_j = groupStartCol(j+1) - groupStartCol(j) - do ia = groupStart(i), groupStart(i+1)-1 + do ia = groupStartRow(i), groupStartRow(i+1)-1 - atom1 = groupList(ia) + atom1 = groupListRow(ia) - inner: do jb = groupStart(j), groupStart(j+1)-1 + inner: do jb = groupStartCol(j), groupStartCol(j+1)-1 - atom2 = groupList(jb) + atom2 = groupListCol(jb) if (skipThisPair(atom1, atom2)) cycle inner @@ -613,9 +623,9 @@ contains fij(2) = fij(2) + swderiv*d_grp(2) fij(3) = fij(3) + swderiv*d_grp(3) - do ia=groupStart(i), groupStart(i+1)-1 - atom1=groupList(ia) - mf = mfact(atom1) + do ia=groupStartRow(i), groupStartRow(i+1)-1 + atom1=groupListRow(ia) + mf = mfactRow(atom1) #ifdef IS_MPI f_Row(1,atom1) = f_Row(1,atom1) + swderiv*d_grp(1)*mf f_Row(2,atom1) = f_Row(2,atom1) + swderiv*d_grp(2)*mf @@ -627,9 +637,9 @@ contains #endif enddo - do jb=groupStart(j), groupStart(j+1)-1 - atom2=groupList(jb) - mf = mfact(atom2) + do jb=groupStartCol(j), groupStartCol(j+1)-1 + atom2=groupListCol(jb) + mf = mfactCol(atom2) #ifdef IS_MPI f_Col(1,atom2) = f_Col(1,atom2) - swderiv*d_grp(1)*mf f_Col(2,atom2) = f_Col(2,atom2) - swderiv*d_grp(2)*mf @@ -650,9 +660,9 @@ contains if (update_nlist) then #ifdef IS_MPI - point(nrow_group + 1) = nlist + 1 + point(nGroupsInRow + 1) = nlist + 1 #else - point(nGroup) = nlist + 1 + point(nGroups) = nlist + 1 #endif if (loop .eq. PREPAIR_LOOP) then ! we just did the neighbor list update on the first @@ -678,25 +688,25 @@ contains !!distribute forces f_temp = 0.0_dp - call scatter(f_Row,f_temp,plan_row3d) + call scatter(f_Row,f_temp,plan_atom_row_3d) do i = 1,nlocal f(1:3,i) = f(1:3,i) + f_temp(1:3,i) end do f_temp = 0.0_dp - call scatter(f_Col,f_temp,plan_col3d) + call scatter(f_Col,f_temp,plan_atom_col_3d) do i = 1,nlocal f(1:3,i) = f(1:3,i) + f_temp(1:3,i) end do if (FF_UsesDirectionalAtoms() .and. SIM_uses_directional_atoms) then t_temp = 0.0_dp - call scatter(t_Row,t_temp,plan_row3d) + call scatter(t_Row,t_temp,plan_atom_row_3d) do i = 1,nlocal t(1:3,i) = t(1:3,i) + t_temp(1:3,i) end do t_temp = 0.0_dp - call scatter(t_Col,t_temp,plan_col3d) + call scatter(t_Col,t_temp,plan_atom_col_3d) do i = 1,nlocal t(1:3,i) = t(1:3,i) + t_temp(1:3,i) @@ -705,7 +715,7 @@ contains if (do_pot) then ! scatter/gather pot_row into the members of my column - call scatter(pot_Row, pot_Temp, plan_row) + call scatter(pot_Row, pot_Temp, plan_atom_row) ! scatter/gather pot_local into all other procs ! add resultant to get total pot @@ -715,7 +725,7 @@ contains pot_Temp = 0.0_DP - call scatter(pot_Col, pot_Temp, plan_col) + call scatter(pot_Col, pot_Temp, plan_atom_col) do i = 1, nlocal pot_local = pot_local + pot_Temp(i) enddo @@ -728,8 +738,8 @@ contains if (FF_uses_RF .and. SIM_uses_RF) then #ifdef IS_MPI - call scatter(rf_Row,rf,plan_row3d) - call scatter(rf_Col,rf_Temp,plan_col3d) + call scatter(rf_Row,rf,plan_atom_row_3d) + call scatter(rf_Col,rf_Temp,plan_atom_col_3d) do i = 1,nlocal rf(1:3,i) = rf(1:3,i) + rf_Temp(1:3,i) end do @@ -815,8 +825,8 @@ contains fpair(1:3) = 0.0d0 #ifdef IS_MPI - if (tagRow(i) .eq. tagColumn(j)) then - write(0,*) 'do_pair is doing', i , j, tagRow(i), tagColumn(j) + if (AtomRowToGlobal(i) .eq. AtomColToGlobal(j)) then + write(0,*) 'do_pair is doing', i , j, AtomRowToGlobal(i), AtomColToGlobal(j) endif me_i = atid_row(i) me_j = atid_col(j) @@ -919,8 +929,8 @@ contains #ifdef IS_MPI - if (tagRow(i) .eq. tagColumn(j)) then - write(0,*) 'do_prepair is doing', i , j, tagRow(i), tagColumn(j) + if (AtomRowToGlobal(i) .eq. AtomColToGlobal(j)) then + write(0,*) 'do_prepair is doing', i , j, AtomRowToGlobal(i), AtomColToGlobal(j) endif me_i = atid_row(i) @@ -1067,7 +1077,7 @@ contains #ifdef IS_MPI !! in MPI, we have to look up the unique IDs for each atom - unique_id_1 = tagRow(atom1) + unique_id_1 = AtomRowToGlobal(atom1) #else !! in the normal loop, the atom numbers are unique unique_id_1 = atom1 @@ -1086,7 +1096,7 @@ contains end if #ifdef IS_MPI - unique_id_2 = tagColumn(atom2) + unique_id_2 = AtomColToGlobal(atom2) #else unique_id_2 = atom2 #endif