@@ -24,7 +24,6 @@ subroutine cluster
24
24
use inform
25
25
use iounit
26
26
use keys
27
- use limits
28
27
use molcul
29
28
implicit none
30
29
integer i,j,k
@@ -154,37 +153,67 @@ subroutine cluster
154
153
c
155
154
c pack atoms of each group into a contiguous indexed list
156
155
c
157
- do i = 1 , n
158
- list(i) = grplist(i)
159
- end do
160
- call sort3 (n,list,kgrp)
156
+ if (use_group) then
157
+ do i = 1 , n
158
+ list(i) = grplist(i)
159
+ end do
160
+ call sort3 (n,list,kgrp)
161
161
c
162
162
c find the first and last atom in each of the groups
163
163
c
164
- k = list(1 )
165
- igrp(1 ,k) = 1
166
- do i = 1 , n
167
- j = list(i)
168
- if (j .ne. k) then
169
- igrp(2 ,k) = i - 1
170
- igrp(1 ,j) = i
171
- k = j
172
- end if
173
- ngrp = max (j,ngrp)
174
- end do
175
- igrp(2 ,j) = n
164
+ k = list(1 )
165
+ igrp(1 ,k) = 1
166
+ do i = 1 , n
167
+ j = list(i)
168
+ if (j .ne. k) then
169
+ igrp(2 ,k) = i - 1
170
+ igrp(1 ,j) = i
171
+ k = j
172
+ end if
173
+ ngrp = max (j,ngrp)
174
+ end do
175
+ igrp(2 ,j) = n
176
176
c
177
177
c sort the list of atoms in each group by atom number
178
178
c
179
- do i = 0 , ngrp
180
- size = igrp(2 ,i) - igrp(1 ,i) + 1
181
- if (igrp(1 ,i) .ne. 0 ) call sort (size,kgrp(igrp(1 ,i)))
182
- end do
179
+ do i = 0 , ngrp
180
+ size = igrp(2 ,i) - igrp(1 ,i) + 1
181
+ if (igrp(1 ,i) .ne. 0 ) call sort (size,kgrp(igrp(1 ,i)))
182
+ end do
183
+ c
184
+ c if groups are not used, put full system in default group
185
+ c
186
+ else
187
+ ngrp = 0
188
+ igrp(1 ,0 ) = 1
189
+ igrp(2 ,0 ) = n
190
+ do i = 1 , n
191
+ kgrp(i) = i
192
+ grplist(i) = 0
193
+ end do
194
+ end if
183
195
c
184
196
c perform deallocation of some local arrays
185
197
c
186
198
deallocate (list)
187
199
c
200
+ c compute the total mass of all atoms in each group
201
+ c
202
+ do i = 0 , ngrp
203
+ grpmass(i) = 0.0d0
204
+ do j = igrp(1 ,i), igrp(2 ,i)
205
+ grpmass(i) = grpmass(i) + mass(kgrp(j))
206
+ end do
207
+ end do
208
+ c
209
+ c turn off bounds and replicas for intragroup calculations
210
+ c
211
+ if (use_intra) then
212
+ use_bounds = .false.
213
+ use_replica = .false.
214
+ call cutoffs
215
+ end if
216
+ c
188
217
c use only intragroup or intergroup interactions if selected
189
218
c
190
219
if (use_intra) then
@@ -204,7 +233,7 @@ subroutine cluster
204
233
end do
205
234
end if
206
235
c
207
- c disable consideration of interactions with any empty groups
236
+ c disable consideration of interactions with empty groups
208
237
c
209
238
do i = 0 , ngrp
210
239
size = igrp(2 ,i) - igrp(1 ,i) + 1
@@ -216,27 +245,10 @@ subroutine cluster
216
245
end if
217
246
end do
218
247
c
219
- c turn off bounds and replicas for intragroup calculations
220
- c
221
- if (use_intra) then
222
- use_bounds = .false.
223
- use_replica = .false.
224
- call cutoffs
225
- end if
226
- c
227
- c compute the total mass of all atoms in each group
228
- c
229
- do i = 0 , ngrp
230
- grpmass(i) = 0.0d0
231
- do j = igrp(1 ,i), igrp(2 ,i)
232
- grpmass(i) = grpmass(i) + mass(kgrp(j))
233
- end do
234
- end do
235
- c
236
248
c output the final list of atoms in each group
237
249
c
238
250
if (use_group .and. debug) then
239
- do i = 0 , ngrp
251
+ do i = 1 , ngrp
240
252
size = igrp(2 ,i) - igrp(1 ,i) + 1
241
253
if (size .ne. 0 ) then
242
254
write (iout,50 ) i
0 commit comments