File tree 1 file changed +10
-5
lines changed
1 file changed +10
-5
lines changed Original file line number Diff line number Diff line change @@ -340,12 +340,17 @@ def find_largest_cluster(system):
340
340
341
341
clusterlist = [x for x in system .atoms ["cluster" ] if x != - 1 ]
342
342
xx , xxcounts = np .unique (clusterlist , return_counts = True )
343
- arg = np .argsort (xxcounts )[- 1 ]
344
- largest_cluster_size = xxcounts [arg ]
345
- largest_cluster_id = xx [arg ]
346
343
347
- system .atoms ["largest_cluster" ] = [True if system .atoms ["cluster" ][x ]== largest_cluster_id else False for x in range (len (system .atoms ["cluster" ]))]
348
-
344
+ if len (xx )> 0 :
345
+ arg = np .argsort (xxcounts )[- 1 ]
346
+ largest_cluster_size = xxcounts [arg ]
347
+ largest_cluster_id = xx [arg ]
348
+
349
+ system .atoms ["largest_cluster" ] = [True if system .atoms ["cluster" ][x ]== largest_cluster_id else False for x in range (len (system .atoms ["cluster" ]))]
350
+ else :
351
+ system .atoms ["largest_cluster" ] = [False for x in range (len (system .atoms ["cluster" ]))]
352
+ largest_cluster_size = 0
353
+
349
354
mapdict = {}
350
355
mapdict ["cluster" ] = {}
351
356
mapdict ["cluster" ]["largest" ] = "largest_cluster"
You can’t perform that action at this time.
0 commit comments