ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/group/trunk/OOPSE/libmdtools/neighborLists.F90
(Generate patch)

Comparing trunk/OOPSE/libmdtools/neighborLists.F90 (file contents):
Revision 480 by chuckv, Tue Apr 8 17:16:22 2003 UTC vs.
Revision 844 by gezelter, Thu Oct 30 14:11:28 2003 UTC

# Line 6 | Line 6
6   !! @author Charles F. Vardeman II
7   !! @author Matthew Meineke
8   !! @author J. Daniel Gezelter
9 < !! @version $Id: neighborLists.F90,v 1.3 2003-04-08 17:16:22 chuckv Exp $,
9 > !! @version $Id: neighborLists.F90,v 1.7 2003-10-30 14:11:28 gezelter Exp $,
10  
11   module neighborLists
12    
# Line 59 | Line 59 | contains
59      !! If one is associated and one is not, something is wrong
60      !! and return a error.
61  
62 < #ifndef IS_MPI !!/Non MPI
62 > #ifdef IS_MPI !! // MPI
63      if (.not. associated(point) .and. &
64           .not. associated(list) ) then
65 <       allocate(point(natoms),stat=alloc_error)
65 >       allocate(point(getNRow(plan_row)),stat=alloc_error)
66         if (alloc_error /= 0) then
67            write(default_error,*) &
68 <               "ExpandNeighborLists: Error in allocating point"
69 <          error = -1
68 >               "ExpandNeighborLists: Error in allocating MPI point"
69 >           error = -1
70            return
71         end if
72 <       allocate(list(listMultiplier * natoms),stat=alloc_error)
72 >       allocate(list(listMultiplier * getNCol(plan_col)),stat=alloc_error)
73         if (alloc_error /= 0) then
74            write(default_error,*) &
75 <               "ExpandNeighborLists: Error in allocating list"
75 >               "ExpandNeighborLists: Error in allocating MPI list"
76            error = -1
77            return
78         end if
# Line 80 | Line 80 | contains
80         nAllocations = nAllocations + 1
81         return
82      end if
83 < #else !!// MPI
83 > #else !! // NONMPI
84      if (.not. associated(point) .and. &
85           .not. associated(list) ) then
86 <       allocate(point(getNRow(plan_row)),stat=alloc_error)
86 >       allocate(point(natoms),stat=alloc_error)
87         if (alloc_error /= 0) then
88            write(default_error,*) &
89 <               "ExpandNeighborLists: Error in allocating MPI point"
90 <           error = -1
89 >               "ExpandNeighborLists: Error in allocating point"
90 >          error = -1
91            return
92         end if
93 <       allocate(list(listMultiplier * getNCol(plan_col)),stat=alloc_error)
93 >       allocate(list(listMultiplier * natoms),stat=alloc_error)
94         if (alloc_error /= 0) then
95            write(default_error,*) &
96 <               "ExpandNeighborLists: Error in allocating MPI list"
96 >               "ExpandNeighborLists: Error in allocating list"
97            error = -1
98            return
99         end if
# Line 152 | Line 152 | contains
152    
153    !! checks to see if any long range particle has moved
154    !! through the neighbor list skin thickness.
155 <  subroutine checkNeighborList(natoms, q, rcut, rlist, update_nlist)
155 >  subroutine checkNeighborList(natoms, q, listSkin, update_nlist)
156      integer :: natoms
157 <    real(kind = dp), intent(in) :: rcut, rlist
157 >    real(kind = dp), intent(in) :: listSkin
158      real( kind = dp ), dimension(:,:)  :: q
159      integer :: i
160      real( kind = DP ) :: dispmx
161      logical, intent(out) :: update_nlist
162      real( kind = DP ) :: dispmx_tmp
163    real( kind = dp ) :: skin_thickness
163      integer :: nlocal
164  
165  
166      nlocal = natoms
168    skin_thickness = rlist - rcut
167      dispmx = 0.0E0_DP
168      !! calculate the largest displacement of any atom in any direction
169      
170      !! If we have changed the particle idents, then we need to update    
171 <    if (.not. allocated(q0) .or. size(q0) /= nlocal) then
171 >    if (.not. allocated(q0)) then      
172         update_nlist = .true.
173         return
174      end if
175  
176 +    if (size(q0,2) /= nlocal) then
177 +       update_nlist = .true.
178 +       return
179 +    end if
180  
181 +
182   #ifdef MPI
183      
184      dispmx_tmp = 0.0E0_DP
# Line 198 | Line 201 | contains
201  
202   #endif
203      
204 +
205      !! a conservative test of list skin crossings
206      dispmx = 2.0E0_DP * sqrt (3.0E0_DP * dispmx * dispmx)
207      
208 <    update_nlist = (dispmx.gt.(skin_thickness))
208 >    update_nlist = (dispmx.gt.listSkin)
209      
210 <  end subroutine checkNeighborList
210 >   end subroutine checkNeighborList
211    
212    
213    !! Saves neighbor list for comparison in check.
# Line 215 | Line 219 | contains
219      real(kind = dp ), dimension(3,natoms), intent(in)  :: q
220      integer :: list_size
221  
222 +
223      
224      !! get size of list
225      list_size = natoms
226      
227      if (.not. allocated(q0)) then
228         allocate(q0(3,list_size))
229 <    else if( list_size > size(q0)) then
229 >    else if( list_size > size(q0,2)) then
230         deallocate(q0)
231         allocate(q0(3,list_size))
232      endif

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines