def plot_posits(atoms, edge, bond, vecs=None): positions = atoms.positions pos_used = [] n_set = make_neighSet(15, edge, bond) for i, r in enumerate(positions): if atoms[i].number == 6: norms = [np.linalg.norm(x) for x in positions[pos_used] - r] if len(norms) != 0: if 12 < np.min([np.linalg.norm(x) for x in positions[pos_used] - r]): neigh_set = get_setOrig(r, edge, bond) + n_set pos_used.append(i) plt.scatter(neigh_set[:,0], neigh_set[:,1], color = 'red', alpha = .5) else: neigh_set = get_setOrig(r, edge, bond) + n_set pos_used.append(i) plt.scatter(neigh_set[:,0], neigh_set[:,1], color = 'red', alpha = .5) plt.scatter(positions[:,0], positions[:,1], color = 'black') if vecs != None: for vec in vecs: plot_vec = np.array([positions[0], positions[0] + vec]) plt.plot(plot_vec[:,0], plot_vec[:,1]) plt.axis('equal') plt.show()
def plot_posits(atoms, edge, bond, vecs=None): positions = atoms.positions pos_used = [] n_set = make_neighSet(15, edge, bond) for i, r in enumerate(positions): if atoms[i].number == 6: norms = [np.linalg.norm(x) for x in positions[pos_used] - r] if len(norms) != 0: if 12 < np.min( [np.linalg.norm(x) for x in positions[pos_used] - r]): neigh_set = get_setOrig(r, edge, bond) + n_set pos_used.append(i) plt.scatter(neigh_set[:, 0], neigh_set[:, 1], color='red', alpha=.5) else: neigh_set = get_setOrig(r, edge, bond) + n_set pos_used.append(i) plt.scatter(neigh_set[:, 0], neigh_set[:, 1], color='red', alpha=.5) plt.scatter(positions[:, 0], positions[:, 1], color='black') if vecs != None: for vec in vecs: plot_vec = np.array([positions[0], positions[0] + vec]) plt.plot(plot_vec[:, 0], plot_vec[:, 1]) plt.axis('equal') plt.show()
[bond/2, y2], [bond/2 + bond, y2], [bond/2 + 2*bond, y2], [0, y1], [bond, y1], [2*bond, y1], [3*bond, y1]]) traj = PickleTrajectory(pathf + 'w=%i/r=%i/' %(width, ratio) + filen) xmin, xmax = np.min(traj[0].positions[:,0]), np.max(traj[0].positions[:,0]) ymin, ymax = np.min(traj[0].positions[:,1]), np.max(traj[0].positions[:,1]) for j in range(len(traj)): if j%10 == 0: atoms = traj[j] coll_ids= [] r_ids = [] for i, r in enumerate(atoms.positions): if atoms[i].number == 6: ro = get_setOrig(r, edge, bond)[:2] + asum_dev alset = np.array(ro) + nset for dev in alset - r[:2]: if np.linalg.norm(dev) < rlim: coll_ids.append(i) r_ids.append(np.linalg.norm(dev)) ''' if np.abs(ro[1] - r[1]) < rlim or \ np.abs(ro[1] + np.sqrt(3)/2*bond - r[1]) < rlim: if np.abs(ro[0] - r[0]) < rlim or \ np.abs(ro[0] + bond - r[0]) < rlim or \
traj = PickleTrajectory(pathf + 'w=%i/r=%i/' % (width, ratio) + filen) xmin, xmax = np.min(traj[0].positions[:, 0]), np.max( traj[0].positions[:, 0]) ymin, ymax = np.min(traj[0].positions[:, 1]), np.max( traj[0].positions[:, 1]) for j in range(len(traj)): if j % 10 == 0: atoms = traj[j] coll_ids = [] r_ids = [] for i, r in enumerate(atoms.positions): if atoms[i].number == 6: ro = get_setOrig(r, edge, bond)[:2] + asum_dev alset = np.array(ro) + nset for dev in alset - r[:2]: if np.linalg.norm(dev) < rlim: coll_ids.append(i) r_ids.append(np.linalg.norm(dev)) ''' if np.abs(ro[1] - r[1]) < rlim or \ np.abs(ro[1] + np.sqrt(3)/2*bond - r[1]) < rlim: if np.abs(ro[0] - r[0]) < rlim or \ np.abs(ro[0] + bond - r[0]) < rlim or \ np.abs(ro[0] + 2*bond - r[0]) < rlim or \ np.abs(ro[0] + bond/2 - r[0]) < rlim or \ np.abs(ro[0] + (1./2 + np.sqrt(3))*bond - r[0]) < rlim: