1 |
|
!! Module neighborLists |
2 |
< |
!! Impliments verlet neighbor lists for force modules. |
2 |
> |
!! Implements verlet neighbor lists for force modules. |
3 |
|
!! Automagically expands neighbor list if size too small |
4 |
|
!! up to maxAllocations times. If after maxAllocations we try to |
5 |
|
!! expand the neighbor list, we get an error message and quit. |
6 |
|
!! @author Charles F. Vardeman II |
7 |
|
!! @author Matthew Meineke |
8 |
|
!! @author J. Daniel Gezelter |
9 |
< |
!! @version $Id: neighborLists.F90,v 1.8 2003-10-30 18:59:20 gezelter Exp $, |
9 |
> |
!! @version $Id: neighborLists.F90,v 1.10 2004-05-07 21:35:05 gezelter Exp $, |
10 |
|
|
11 |
|
module neighborLists |
12 |
|
|
44 |
|
contains |
45 |
|
|
46 |
|
|
47 |
< |
subroutine expandNeighborList(natoms, error) |
47 |
> |
subroutine expandNeighborList(nGroup, error) |
48 |
|
integer, intent(out) :: error |
49 |
< |
integer :: natoms |
49 |
> |
integer :: nGroup |
50 |
|
integer :: alloc_error |
51 |
|
integer :: oldSize = 0 |
52 |
|
integer :: newSize = 0 |
61 |
|
#ifdef IS_MPI !! // MPI |
62 |
|
if (.not. associated(point) .and. & |
63 |
|
.not. associated(list) ) then |
64 |
< |
allocate(point(getNRow(plan_row)),stat=alloc_error) |
64 |
> |
allocate(point(getNRowGroup(plan_row)),stat=alloc_error) |
65 |
|
if (alloc_error /= 0) then |
66 |
|
write(default_error,*) & |
67 |
|
"ExpandNeighborLists: Error in allocating MPI point" |
68 |
|
error = -1 |
69 |
|
return |
70 |
|
end if |
71 |
< |
allocate(list(listMultiplier * getNCol(plan_col)),stat=alloc_error) |
71 |
> |
allocate(list(listMultiplier * getNColGroup(plan_col)),stat=alloc_error) |
72 |
|
if (alloc_error /= 0) then |
73 |
|
write(default_error,*) & |
74 |
|
"ExpandNeighborLists: Error in allocating MPI list" |
82 |
|
#else !! // NONMPI |
83 |
|
if (.not. associated(point) .and. & |
84 |
|
.not. associated(list) ) then |
85 |
< |
allocate(point(natoms),stat=alloc_error) |
85 |
> |
allocate(point(nGroup),stat=alloc_error) |
86 |
|
if (alloc_error /= 0) then |
87 |
|
write(default_error,*) & |
88 |
|
"ExpandNeighborLists: Error in allocating point" |
89 |
|
error = -1 |
90 |
|
return |
91 |
|
end if |
92 |
< |
allocate(list(listMultiplier * natoms),stat=alloc_error) |
92 |
> |
allocate(list(listMultiplier * nGroup),stat=alloc_error) |
93 |
|
if (alloc_error /= 0) then |
94 |
|
write(default_error,*) & |
95 |
|
"ExpandNeighborLists: Error in allocating list" |
117 |
|
#ifdef IS_MPI !! MPI |
118 |
|
newSize = listMultiplier * getNCol(plan_col) + oldSize |
119 |
|
#else |
120 |
< |
newSize = listMultiplier * natoms + oldSize |
120 |
> |
newSize = listMultiplier * nGroup + oldSize |
121 |
|
#endif !! MPI |
122 |
|
|
123 |
|
|
151 |
|
|
152 |
|
!! checks to see if any long range particle has moved |
153 |
|
!! through the neighbor list skin thickness. |
154 |
< |
subroutine checkNeighborList(natoms, q, listSkin, update_nlist) |
155 |
< |
integer :: natoms |
154 |
> |
subroutine checkNeighborList(nGroup, q, listSkin, update_nlist) |
155 |
> |
integer :: nGroup |
156 |
|
real(kind = dp), intent(in) :: listSkin |
157 |
|
real( kind = dp ), dimension(:,:) :: q |
158 |
|
integer :: i |
161 |
|
real( kind = DP ) :: dispmx_tmp |
162 |
|
integer :: nlocal |
163 |
|
|
164 |
< |
nlocal = natoms |
164 |
> |
nlocal = nGroup |
165 |
|
dispmx = 0.0E0_DP |
166 |
|
!! calculate the largest displacement of any atom in any direction |
167 |
|
|
203 |
|
dispmx = 2.0E0_DP * sqrt (3.0E0_DP * dispmx * dispmx) |
204 |
|
|
205 |
|
update_nlist = (dispmx.gt.listSkin) |
206 |
< |
|
206 |
> |
|
207 |
|
end subroutine checkNeighborList |
208 |
|
|
209 |
|
|
210 |
|
!! Saves neighbor list for comparison in check. |
211 |
|
!! Save_neighborList will work even if the number of |
212 |
|
!! local atoms has changed. |
213 |
< |
subroutine saveNeighborList(natoms, q) |
213 |
> |
subroutine saveNeighborList(nGroup, q) |
214 |
|
|
215 |
< |
integer :: natoms |
216 |
< |
real(kind = dp ), dimension(3,natoms), intent(in) :: q |
215 |
> |
integer :: nGroup |
216 |
> |
real(kind = dp ), dimension(3,nGroup), intent(in) :: q |
217 |
|
integer :: list_size |
218 |
|
|
219 |
|
!! get size of list |
220 |
< |
list_size = natoms |
220 |
> |
list_size = nGroup |
221 |
|
|
222 |
|
if (.not. allocated(q0)) then |
223 |
|
allocate(q0(3,list_size)) |