6 |
|
!! @author Charles F. Vardeman II |
7 |
|
!! @author Matthew Meineke |
8 |
|
!! @author J. Daniel Gezelter |
9 |
< |
!! @version $Id: neighborLists.F90,v 1.1.1.1 2003-03-21 17:42:12 mmeineke Exp $, |
9 |
> |
!! @version $Id: neighborLists.F90,v 1.4 2003-07-16 21:30:56 mmeineke Exp $, |
10 |
|
|
11 |
|
module neighborLists |
12 |
|
|
32 |
|
integer, dimension(:),public, pointer :: list => null() |
33 |
|
!! Position array of previous positions for check. Allocated first time |
34 |
|
!! into saveNeighborList. |
35 |
< |
real( kind = dp ), dimension(:,:), allocatable , save :: q0 |
35 |
> |
real( kind = dp ), dimension(:,:), allocatable, save :: q0 |
36 |
|
!! Current list size |
37 |
|
integer, save :: listSize |
38 |
|
!--------------MODULE ACCESS--------------------------> |
64 |
|
.not. associated(list) ) then |
65 |
|
allocate(point(natoms),stat=alloc_error) |
66 |
|
if (alloc_error /= 0) then |
67 |
+ |
write(default_error,*) & |
68 |
+ |
"ExpandNeighborLists: Error in allocating point" |
69 |
|
error = -1 |
70 |
|
return |
71 |
|
end if |
72 |
|
allocate(list(listMultiplier * natoms),stat=alloc_error) |
73 |
|
if (alloc_error /= 0) then |
74 |
+ |
write(default_error,*) & |
75 |
+ |
"ExpandNeighborLists: Error in allocating list" |
76 |
|
error = -1 |
77 |
|
return |
78 |
|
end if |
85 |
|
.not. associated(list) ) then |
86 |
|
allocate(point(getNRow(plan_row)),stat=alloc_error) |
87 |
|
if (alloc_error /= 0) then |
88 |
< |
error = -1 |
88 |
> |
write(default_error,*) & |
89 |
> |
"ExpandNeighborLists: Error in allocating MPI point" |
90 |
> |
error = -1 |
91 |
|
return |
92 |
|
end if |
93 |
|
allocate(list(listMultiplier * getNCol(plan_col)),stat=alloc_error) |
94 |
|
if (alloc_error /= 0) then |
95 |
+ |
write(default_error,*) & |
96 |
+ |
"ExpandNeighborLists: Error in allocating MPI list" |
97 |
|
error = -1 |
98 |
|
return |
99 |
|
end if |
107 |
|
|
108 |
|
! Check to see if we have exceeded the maximum number of allocations. |
109 |
|
if (nAllocations > maxAllocations) then |
110 |
+ |
write(default_error,*) & |
111 |
+ |
"ExpandNeighborList: exceeded maximum number of re-allocations" |
112 |
|
error = -1 |
113 |
|
return |
114 |
|
else !! Expand the list. |
115 |
|
oldSize = size(list) |
116 |
|
|
117 |
+ |
|
118 |
|
#ifdef IS_MPI !! MPI |
119 |
|
newSize = listMultiplier * getNCol(plan_col) + oldSize |
120 |
|
#else |
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 |
152 |
– |
real( kind = dp ) :: skin_thickness |
163 |
|
integer :: nlocal |
164 |
< |
|
164 |
> |
|
165 |
> |
|
166 |
|
nlocal = natoms |
156 |
– |
skin_thickness = rlist - rcut |
167 |
|
dispmx = 0.0E0_DP |
168 |
|
!! calculate the largest displacement of any atom in any direction |
169 |
|
|
172 |
|
update_nlist = .true. |
173 |
|
return |
174 |
|
end if |
175 |
< |
|
175 |
> |
|
176 |
> |
|
177 |
|
#ifdef MPI |
178 |
|
|
179 |
|
dispmx_tmp = 0.0E0_DP |
199 |
|
!! a conservative test of list skin crossings |
200 |
|
dispmx = 2.0E0_DP * sqrt (3.0E0_DP * dispmx * dispmx) |
201 |
|
|
202 |
< |
update_nlist = (dispmx.gt.(skin_thickness)) |
202 |
> |
update_nlist = (dispmx.gt.listSkin) |
203 |
|
|
204 |
|
end subroutine checkNeighborList |
205 |
|
|
207 |
|
!! Saves neighbor list for comparison in check. |
208 |
|
!! Save_neighborList will work even if the number of |
209 |
|
!! local atoms has changed. |
210 |
< |
subroutine saveNeighborList(q) |
211 |
< |
real(kind = dp ), dimension(:,:), intent(in) :: q |
210 |
> |
subroutine saveNeighborList(natoms, q) |
211 |
> |
|
212 |
> |
integer :: natoms |
213 |
> |
real(kind = dp ), dimension(3,natoms), intent(in) :: q |
214 |
|
integer :: list_size |
215 |
+ |
|
216 |
|
|
217 |
|
!! get size of list |
218 |
< |
list_size = size(q) |
218 |
> |
list_size = natoms |
219 |
|
|
220 |
|
if (.not. allocated(q0)) then |
221 |
|
allocate(q0(3,list_size)) |