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 51 52 53 54 55 56 57 58 59 60 61 62 63 64
| def plotAtomsSites(filename,index, radius): numberAtoms, bounds = getSimulationSet(filename) x1 = bounds[0,0] x2 = bounds[0,1] y1 = bounds[1,0] y2 = bounds[1,1] z1 = bounds[2,0] z2 = bounds[2,1]
fig = plt.figure() ax = fig.add_subplot(111, projection='3d') X = [x1, x1, x1, x1, x2, x2, x2, x2] Y = [y1, y1, y2, y2, y1, y1, y2, y2] Z = [z1, z2, z2, z1, z1, z2, z2, z1] edges = [ [0, 1], [1, 2], [2, 3], [3, 0], [0, 4], [1, 5], [2, 6], [3, 7], [4, 5], [5, 6], [6, 7], [7, 4] ] for edge in edges: x_edge = [X[edge[0]], X[edge[1]]] y_edge = [Y[edge[0]], Y[edge[1]]] z_edge = [Z[edge[0]], Z[edge[1]]] ax.plot(x_edge, y_edge, zs=z_edge, color='black')
data = getAtomsInformation(filename, index) x2 = data[:, 2] y2 = data[:, 3] z2 = data[:, 4]
radius = 4
for i in range(len(x2)): ax.scatter(x2[i], y2[i], z2[i], s=radius, c='red')
ax.grid(False) ax.set_xlim([min(X), max(X)]) ax.set_ylim([min(Y), max(Y)]) ax.set_zlim([min(Z), max(Z)]) ax.axis('equal') ax.axis('off') plt.show()
|