def run_method(self): from method import defects_sub_donet temp = self.types.text() if re.match('None', temp): types = None else: types = [i.strip() for i in temp.split(',')] temp = self.subs.text() if re.match('None', temp): subs = None else: subs = [i.strip() for i in temp.split(',')] temp = self.center.text() if re.match('None', temp): center = None else: center = temp.split('[')[1].split(']')[0].split(',') center = [float(x) for x in center] tolerance = float(self.tolerance.text()) view_result = defects_sub_donet.exec(self.path.open_path, self.path.save_path, types, subs, center, tolerance) self.figure.clear() ax = self.figure.add_subplot(111, projection='3d') draw_crystal_in_ax(ax, view_result) self.canvas.draw()
def readdoped(self): from method import read file_name, file_type = QFileDialog.getOpenFileName(None, 'Open', './', 'All Files (*)') self.path.open_path = file_name self.doped.setText(file_name) self.figure.clear() self.structure = read.poscar(self.path.open_path, types=poscar_is_vasp5(self.path.open_path)) ax = self.figure.add_subplot(111, projection='3d') draw_crystal_in_ax(ax, self.structure) self.canvas.draw()
def time_stop(self): self.bar.setValue(100) self.timer.stop() self.status.setText('Finished.') self.run_btn.setText('Run') self.figure.clear() ax = self.figure.add_subplot(111, projection='3d') draw_crystal_in_ax(ax, self.work_thread.view_structure) self.canvas.draw() with open('interstitial log.txt', 'w') as file: file.writelines('0%')
def time_stop(self): from method import read self.bar.setValue(100) self.timer.stop() self.status.setText('Finished.') self.run_btn.setText('Run') self.structure = read.poscar(self.write_path, types=poscar_is_vasp5(self.write_path)) self.figure.clear() ax = self.figure.add_subplot(111, projection='3d') draw_crystal_in_ax(ax, self.structure) self.canvas.draw() with open('interstitial log.txt', 'w') as file: file.writelines('0%')
def __init__(self, *args): super().__init__() default = args[0] self.structure = read_poscar(default) self.input_file = QLineEdit('POSCAR') self.output_file = QLineEdit() self.path = FilePath('POSCAR', '') self.figure = plt.figure() self.canvas = FigureCanvas(self.figure) ax = self.figure.add_subplot(111, projection='3d') draw_crystal_in_ax(ax, self.structure) self.canvas.draw() self.mpl_ntb = NavigationToolbar(self.canvas, self) self.initUI()
def run_method(self): from method import structure_compare_donet from method import read from method.plot_crystal import plot_atoms tolerance = float(self.tolerance.text()) percent = float(self.percent.text()) arrow_location, arrow = structure_compare_donet.exec(self.path.save_path, self.host.text(), self.doped.text(), tolerance, percent) self.figure.clear() ax = self.figure.add_subplot(111, projection='3d') structure = read.poscar(self.host.text()) draw_crystal_in_ax(ax, structure) structure = read.poscar(self.doped.text()) plot_atoms(ax, structure) ax.quiver(arrow_location[0], arrow_location[1], arrow_location[2], arrow[0], arrow[1], arrow[2]) self.canvas.draw()
doped_structure = poscar(doped_crystal) substrate_structure = poscar(substrate) arrow_location, arrow, doped_atoms = structure_compare(save, substrate_structure, doped_structure, tolerance=1, percent=10) write_compare_result_in_json(doped_atoms) doped_cluster, doped_center = build_cluster(doped_structure, c_r, tolerance=0.5) discard = cluster_from_substrate(substrate_structure, doped_center, c_r) if len(doped_cluster) != len(discard): print( 'WARNING: \n' 'The number of atoms in cluster is different with the discard cluster of substrate.\n' 'If there isn\'t any intersitial or vacancy in doped structure, this disagreement may caused by the ' 'choose of radius.\n' 'The radius of cluster may be too small. Some atoms at the edge of sphere may be move out of the sphere' 'after the relaxed doped structure\n') figure = plt.figure() ax = figure.add_subplot(111, projection='3d') draw_crystal_in_ax(ax, substrate_structure, atoms_plot=False) plot_sphere(ax, doped_center, c_r) ax.quiver(arrow_location[0], arrow_location[1], arrow_location[2], arrow[0], arrow[1], arrow[2]) plt.show()