def w_def_rv_at(num_vac_list, num_int_list, int_mass_at, rv_at_dict, name_rv_at_def): d_def = copy.deepcopy(rv_at_dict) d_def_visual = copy.deepcopy(rv_at_dict) list_at_vac = [] list_at_int = [] d_def['i_sort_at'] = [2 for a in d_def['i_sort_at']] for i in num_int_list: if num_int_list == []: break list_at_int.append(d_def['r_at'][i-1]) d_def['mass_at'][i-1] = int_mass_at d_def['i_sort_at'][i-1] = 1 count = 0 for i in num_vac_list: if num_vac_list == []: break j = i - count list_at_vac.append(d_def['r_at'][j-1]) d_def['r_at'].remove(d_def['r_at'][j-1]) d_def['n_at'] -= 1 d_def['v_at'].remove(d_def['v_at'][j-1]) d_def['mass_at'].remove(d_def['mass_at'][j-1]) d_def['num_at_r'].remove(d_def['num_at_r'][-1]) d_def['mark_green'].remove(d_def['mark_green'][-1]) d_def['mark_at'].remove(d_def['mark_at'][j-1]) d_def['i_sort_at'].remove(d_def['i_sort_at'][-1]) count += 1 a2 = RW() a2.w_rv_at(name_rv_at_def, d_def) w_def_rv_at.list_at = d_def['r_at'] w_def_rv_at.list_at_vac = list_at_vac w_def_rv_at.list_at_int = list_at_int
# Считывание входного файла f = open('manual_at_structure.in') number_vacancy_list = [] number_interstitial_list = [] for line in f: if line[0]=='#' or len(line)==0 or len(line)==1: continue line1 = line.split() if 'number_vacancy_list' in line1: number_vacancy_list = [int(i) for i in line1[1:]] elif 'number_interstitial_list' in line1: number_interstitial_list = [int(i) for i in line1[1:]] elif 'file_lattice_at' in line1: file_lattice_at = line1[1] elif 'interstitial_mass_at' in line1: interstitial_mass_at = float(line1[1]) elif 'name_final_structure' in line1: name_final_structure = line1[1] # Считывание идеальной решетки в словарь d a1 = RW() a1.r_rv_at(file_lattice_at) d = a1.r_rv_at_dict # Построение ячейки с нужным количеством вакансий в заданных # позициях и её визуализация в *.xyz формате w_def_rv_at(number_vacancy_list, number_interstitial_list, interstitial_mass_at, d, name_final_structure+'.at') xyz_format(w_def_rv_at.list_at, w_def_rv_at.list_at_vac, w_def_rv_at.list_at_int, name_final_structure+'.xyz')