--- trunk/OOPSE/libmdtools/neighborLists.F90 2003/04/08 17:16:22 480 +++ trunk/OOPSE/libmdtools/neighborLists.F90 2003/09/05 21:28:52 747 @@ -6,7 +6,7 @@ !! @author Charles F. Vardeman II !! @author Matthew Meineke !! @author J. Daniel Gezelter -!! @version $Id: neighborLists.F90,v 1.3 2003-04-08 17:16:22 chuckv Exp $, +!! @version $Id: neighborLists.F90,v 1.6 2003-09-05 21:28:19 gezelter Exp $, module neighborLists @@ -59,20 +59,20 @@ contains !! If one is associated and one is not, something is wrong !! and return a error. -#ifndef IS_MPI !!/Non MPI +#ifdef IS_MPI !! // MPI if (.not. associated(point) .and. & .not. associated(list) ) then - allocate(point(natoms),stat=alloc_error) + allocate(point(getNRow(plan_row)),stat=alloc_error) if (alloc_error /= 0) then write(default_error,*) & - "ExpandNeighborLists: Error in allocating point" - error = -1 + "ExpandNeighborLists: Error in allocating MPI point" + error = -1 return end if - allocate(list(listMultiplier * natoms),stat=alloc_error) + allocate(list(listMultiplier * getNCol(plan_col)),stat=alloc_error) if (alloc_error /= 0) then write(default_error,*) & - "ExpandNeighborLists: Error in allocating list" + "ExpandNeighborLists: Error in allocating MPI list" error = -1 return end if @@ -80,20 +80,20 @@ contains nAllocations = nAllocations + 1 return end if -#else !!// MPI +#else !! // NONMPI if (.not. associated(point) .and. & .not. associated(list) ) then - allocate(point(getNRow(plan_row)),stat=alloc_error) + allocate(point(natoms),stat=alloc_error) if (alloc_error /= 0) then write(default_error,*) & - "ExpandNeighborLists: Error in allocating MPI point" - error = -1 + "ExpandNeighborLists: Error in allocating point" + error = -1 return end if - allocate(list(listMultiplier * getNCol(plan_col)),stat=alloc_error) + allocate(list(listMultiplier * natoms),stat=alloc_error) if (alloc_error /= 0) then write(default_error,*) & - "ExpandNeighborLists: Error in allocating MPI list" + "ExpandNeighborLists: Error in allocating list" error = -1 return end if @@ -152,25 +152,23 @@ contains !! checks to see if any long range particle has moved !! through the neighbor list skin thickness. - subroutine checkNeighborList(natoms, q, rcut, rlist, update_nlist) + subroutine checkNeighborList(natoms, q, listSkin, update_nlist) integer :: natoms - real(kind = dp), intent(in) :: rcut, rlist + real(kind = dp), intent(in) :: listSkin real( kind = dp ), dimension(:,:) :: q integer :: i real( kind = DP ) :: dispmx logical, intent(out) :: update_nlist real( kind = DP ) :: dispmx_tmp - real( kind = dp ) :: skin_thickness integer :: nlocal nlocal = natoms - skin_thickness = rlist - rcut dispmx = 0.0E0_DP !! calculate the largest displacement of any atom in any direction !! If we have changed the particle idents, then we need to update - if (.not. allocated(q0) .or. size(q0) /= nlocal) then + if (.not. allocated(q0) .or. size(q0,2) /= nlocal) then update_nlist = .true. return end if @@ -198,12 +196,13 @@ contains #endif + !! a conservative test of list skin crossings dispmx = 2.0E0_DP * sqrt (3.0E0_DP * dispmx * dispmx) - update_nlist = (dispmx.gt.(skin_thickness)) + update_nlist = (dispmx.gt.listSkin) - end subroutine checkNeighborList + end subroutine checkNeighborList !! Saves neighbor list for comparison in check. @@ -215,13 +214,14 @@ contains real(kind = dp ), dimension(3,natoms), intent(in) :: q integer :: list_size + !! get size of list list_size = natoms if (.not. allocated(q0)) then allocate(q0(3,list_size)) - else if( list_size > size(q0)) then + else if( list_size > size(q0,2)) then deallocate(q0) allocate(q0(3,list_size)) endif