-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathplot_biggest_crystallite.py
44 lines (26 loc) · 1.1 KB
/
plot_biggest_crystallite.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
#!/usr/bin/env python
import pickle
import numpy as np
import matplotlib.pyplot as plt
from qcnico.coords_io import read_xyz
from qcnico.graph_tools import adjacency_matrix_sparse
from qcnico.plt_utils import get_cm
from qcnico.qcplots import plot_atoms
rCC = 1.8
ddir = '/Users/nico/Desktop/simulation_outputs/structural_characteristics_MAC/crystallite_sizes/tempdot5/most_crystalline_structure_data/'
pos = read_xyz(ddir + 'tempdot5n15_relaxed_no-dangle.xyz')
pos = pos[:,:2]
M = adjacency_matrix_sparse(pos,rCC)
with open(ddir + 'clusters-15.pkl', 'rb') as fo:
clusters = pickle.load(fo)
with open(ddir + 'centres_hashmap-15.pkl', 'rb') as fo:
centres_dict = pickle.load(fo)
hex_centres = np.zeros((len(centres_dict),2))
for r, k in centres_dict.items():
hex_centres[k] = r
cluster_centres = [np.array([hex_centres[i] for i in c]) for c in clusters]
cluster_clrs = get_cm(np.arange(len(clusters)),'rainbow',min_val=0.0,max_val=1.0)
fig, ax = plot_atoms(pos,dotsize=1.0,show=False)
for cc, clr in zip(cluster_centres, cluster_clrs):
ax.scatter(*cc.T,c=clr,s=5.0,zorder=4)
plt.show()