27 |
|
integer, public, save :: nExcludes_Global = 0 |
28 |
|
integer, public, save :: nExcludes_Local = 0 |
29 |
|
integer, allocatable, dimension(:,:), public :: excludesLocal |
30 |
< |
integer, allocatable, dimension(:), public :: excludesGlobal |
31 |
< |
integer, allocatable, dimension(:), public :: molMembershipList |
32 |
< |
integer, allocatable, dimension(:), public :: groupList |
33 |
< |
integer, allocatable, dimension(:), public :: groupStart |
30 |
> |
integer, allocatable, dimension(:), public :: excludesGlobal |
31 |
> |
integer, allocatable, dimension(:), public :: molMembershipList |
32 |
> |
integer, allocatable, dimension(:), public :: groupList |
33 |
> |
integer, allocatable, dimension(:), public :: groupStart |
34 |
> |
integer, allocatable, dimension(:), public :: nSkipsForAtom |
35 |
> |
integer, allocatable, dimension(:,:), public :: skipsForAtom |
36 |
|
real(kind=dp), allocatable, dimension(:), public :: mfact |
37 |
|
|
38 |
|
real(kind=dp), public, dimension(3,3), save :: Hmat, HmatInv |
72 |
|
integer, dimension(CnGlobal),intent(in) :: CmolMembership |
73 |
|
!! Result status, success = 0, status = -1 |
74 |
|
integer, intent(out) :: status |
75 |
< |
integer :: i, me, thisStat, alloc_stat, myNode |
75 |
> |
integer :: i, j, me, thisStat, alloc_stat, myNode, id1, id2 |
76 |
|
integer :: gStart, gEnd, groupSize, biggestGroupSize, ia |
77 |
|
|
78 |
|
!! mass factors used for molecular cutoffs |
80 |
|
integer, intent(in):: CnGroup |
81 |
|
integer, dimension(CnLocal),intent(in) :: CgroupList |
82 |
|
integer, dimension(CnGroup),intent(in) :: CgroupStart |
83 |
+ |
integer :: maxSkipsForAtom |
84 |
|
|
85 |
|
#ifdef IS_MPI |
86 |
|
integer, allocatable, dimension(:) :: c_idents_Row |
175 |
|
excludesLocal(1,i) = CexcludesLocal(1,i) |
176 |
|
excludesLocal(2,i) = CexcludesLocal(2,i) |
177 |
|
enddo |
178 |
+ |
|
179 |
+ |
maxSkipsForAtom = 0 |
180 |
+ |
do j = 1, nLocal |
181 |
+ |
nSkipsForAtom(j) = 0 |
182 |
+ |
#ifdef IS_MPI |
183 |
+ |
id1 = tagRow(j) |
184 |
+ |
#else |
185 |
+ |
id1 = j |
186 |
+ |
#endif |
187 |
+ |
do i = 1, nExcludes_Local |
188 |
+ |
if (excludesLocal(1,i) .eq. id1 ) then |
189 |
+ |
nSkipsForAtom(j) = nSkipsForAtom(j) + 1 |
190 |
+ |
|
191 |
+ |
if (nSkipsForAtom(j) .gt. maxSkipsForAtom) then |
192 |
+ |
maxSkipsForAtom = nSkipsForAtom(j) |
193 |
+ |
endif |
194 |
+ |
endif |
195 |
+ |
if (excludesLocal(2,i) .eq. id1 ) then |
196 |
+ |
nSkipsForAtom(j) = nSkipsForAtom(j) + 1 |
197 |
+ |
|
198 |
+ |
if (nSkipsForAtom(j) .gt. maxSkipsForAtom) then |
199 |
+ |
maxSkipsForAtom = nSkipsForAtom(j) |
200 |
+ |
endif |
201 |
+ |
endif |
202 |
+ |
end do |
203 |
+ |
enddo |
204 |
+ |
|
205 |
+ |
allocate(skipsForAtom(nLocal, maxSkipsForAtom), stat=alloc_stat) |
206 |
+ |
if (alloc_stat /= 0 ) then |
207 |
+ |
write(*,*) 'Could not allocate skipsForAtom array' |
208 |
+ |
return |
209 |
+ |
endif |
210 |
+ |
|
211 |
+ |
do j = 1, nLocal |
212 |
+ |
nSkipsForAtom(j) = 0 |
213 |
+ |
#ifdef IS_MPI |
214 |
+ |
id1 = tagRow(j) |
215 |
+ |
#else |
216 |
+ |
id1 = j |
217 |
+ |
#endif |
218 |
+ |
do i = 1, nExcludes_Local |
219 |
+ |
if (excludesLocal(1,i) .eq. id1 ) then |
220 |
+ |
nSkipsForAtom(j) = nSkipsForAtom(j) + 1 |
221 |
+ |
#ifdef IS_MPI |
222 |
+ |
id2 = tagColumn(excludesLocal(2,i)) |
223 |
+ |
#else |
224 |
+ |
id2 = excludesLocal(2,i) |
225 |
+ |
#endif |
226 |
+ |
skipsForAtom(j, nSkipsForAtom(j)) = id2 |
227 |
+ |
endif |
228 |
+ |
if (excludesLocal(2, i) .eq. id2 ) then |
229 |
+ |
nSkipsForAtom(j) = nSkipsForAtom(j) + 1 |
230 |
+ |
#ifdef IS_MPI |
231 |
+ |
id2 = tagColumn(excludesLocal(1,i)) |
232 |
+ |
#else |
233 |
+ |
id2 = excludesLocal(1,i) |
234 |
+ |
#endif |
235 |
+ |
skipsForAtom(j, nSkipsForAtom(j)) = id2 |
236 |
+ |
endif |
237 |
+ |
end do |
238 |
+ |
enddo |
239 |
|
|
240 |
|
do i = 1, nExcludes_Global |
241 |
|
excludesGlobal(i) = CexcludesGlobal(i) |
355 |
|
thisStat = 0 |
356 |
|
|
357 |
|
call FreeSimGlobals() |
358 |
+ |
|
359 |
+ |
allocate(nSkipsForAtom(nLocal), stat=alloc_stat) |
360 |
+ |
if (alloc_stat /= 0 ) then |
361 |
+ |
thisStat = -1 |
362 |
+ |
return |
363 |
+ |
endif |
364 |
|
|
365 |
|
allocate(excludesLocal(2,nExcludes_Local), stat=alloc_stat) |
366 |
|
if (alloc_stat /= 0 ) then |
404 |
|
|
405 |
|
!We free in the opposite order in which we allocate in. |
406 |
|
|
407 |
+ |
if (allocated(skipsForAtom)) deallocate(skipsForAtom) |
408 |
|
if (allocated(mfact)) deallocate(mfact) |
409 |
|
if (allocated(groupList)) deallocate(groupList) |
410 |
|
if (allocated(groupStart)) deallocate(groupStart) |