-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathplot_undistorted_clusters.py
50 lines (34 loc) · 1.25 KB
/
plot_undistorted_clusters.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
#!/usr/bin/env python
import numpy as np
import matplotlib.pyplot as plt
from qcnico.coords_io import read_xyz
from qcnico.qcplots import plot_atoms
from qcnico.plt_utils import get_cm
import pickle
structype = '40x40'
nn = 64
ddir = '/Users/nico/Desktop/simulation_outputs/structural_characteristics_MAC/rho_sites/testing/'
# all_pos = read_xyz(ddir + f'{structype}n{nn}_relaxed_no-dangle.xyz')
all_pos = read_xyz(ddir + f'bigMAC-{nn}_relaxed_no-dangle.xyz')
undisC = np.load(ddir + f'undistorted_atoms_{structype}-{nn}.npy')
with open(ddir + f'undistorted_clusters_{structype}-{nn}.pkl', 'rb') as fo:
clusters = pickle.load(fo)
nclrs = 30
clrs = get_cm(np.arange(nclrs),'turbo',max_val=1.0,min_val=0.0)
N = all_pos.shape[0]
distorted = np.ones(N,dtype='bool')
distorted[undisC] = False
disC = all_pos[distorted,:]
fig, ax = plot_atoms(disC, dotsize=1.0,show=False)
max_cluster_size = 0
for k, c in enumerate(clusters):
size = len(c)
if size == 1: continue
print(size)
if size > max_cluster_size: max_cluster_size = size
clr = clrs[k % nclrs]
pos = all_pos[c]
fig, ax = plot_atoms(pos,colour=clr,dotsize=1.0,show=False,plt_objs=(fig,ax))
plt.show()
print('Total number of atoms = ', N)
print('Max cluster size = ', max_cluster_size)