def remove_imp_segreg(calc, conv, varset): """Creates new calculation with removed impurities for determination of """ calc_list = [] ver = 2 set_T1 = '93kp9' set_T1_m = '83kp9' seg_list_T1 = ['t111gCvOvms', 't111gCi1Ov', 't111gCi2Ov','t111gCi3Ov','t111gCi4Ov','t111gOi1Cv','t111gOi2Cv','t111gOi3Cv','t111gOi4Cv',] seg_list_T1sg = ['t111sgCvOvms', 't111sgCi1Ov', 't111sgCi2Ov', 't111sgCi3Ov', 't111sgCi4Ov', 't111sgCi5Ov', 't111sgCi6Ov', 't111sgCi7Ov', 't111sgOi1Cv', 't111sgOi2Cv', 't111sgOi3Cv', 't111sgOi4Cv', 't111sgOi5Cv', 't111sgOi6Cv', 't111sgOi7Cv', ] for el in seg_list_T1: calc_list.append( (el, set_T1, ver, 'T1/CO/t111g_segreg_m') ) for el in seg_list_T1sg: calc_list.append( (el, set_T1, ver, 'T1/CO/t111sg_segreg_m') ) set_C1 = '93kp7' set_C1_m = '83kp7' seg_list_C1 = ['c1gCvOvms', 'c1gCi1Ov', 'c1gCi2Ov', 'c1gOi1Cv', 'c1gOi2Cv', ] for el in seg_list_C1: calc_list.append( (el, set_C1, ver, 'C1/CO/c1g_segreg_m') ) set_T2_CSL7 = '93' set_T2_CSL7_m = '83' seg_list_T2 = ['t21gCvOvms', 't21gCi1Ov', 't21gCi2Ov', 't21gCi3Ov', 't21gCi4Ov', 't21gOi1Cv', 't21gOi2Cv', 't21gOi3Cv', 't21gOi4Cv', ] seg_list_CSL7 = ['csl71sgCvOvms', 'csl71sgCi1Ov', 'csl71sgCi2Ov', 'csl71sgCi3Ov', 'csl71sgCi4Ov', 'csl71sgCi5Ov', 'csl71sgCi6Ov', 'csl71sgOi1Cv', 'csl71sgOi2Cv', 'csl71sgOi3Cv', 'csl71sgOi4Cv', 'csl71sgOi5Cv', 'csl71sgOi6Cv', ] for el in seg_list_T2: calc_list.append( (el, set_T2_CSL7, ver, 'T2/CO/t21g_segreg_m') ) for el in seg_list_CSL7: calc_list.append( (el, set_T2_CSL7, ver, 'CSL7/CO/csl71sg_segreg_m') ) # print len(calc_list) for el in calc_list: # print "struct_des['{0:s}.m'] = des('{3:s}', 'without imp; made from {0:s}.{1:s}; ver are the same' )".format(el[0],el[1], el[2], el[3]) # print el[0:3] # inherit_icalc('remove_imp', el[0]+'.m', ver, el[0:3], calc) s8 = '8'+el[1][1:]# rename all sets from 93* to 83* # add_loop(el[0]+'.m', s8, ver, calc, conv, varset, 'up1' ) res_loop(el[0]+'.m', s8, ver, calc, conv, varset, ) return
def make_scaled_versions_of_segen(calc, conv, varset): list = [ ('c1gCi1Ov' , '93kp7', 2 , 'c1gCvOvms' ), ('c1gCi2Ov' , '93kp7', 2 , 'c1gCvOvms' ), ('c1gOi2Cv' , '93kp7', 2 , 'c1gCvOvms' ), ('c1gCvOvms' , '93kp7', 2 , 'c1gCvOvms' ), ( 't111sgCi6Ov', '93kp9', 2 , 't111sgCvOvms' ), ( 't111sgOi6Cv', '93kp9', 2 , 't111sgCvOvms' ), ( 't111sgCvOvms', '93kp9', 2 , 't111sgCvOvms' ), ('csl71sgCi4Ov', '93' , 2 , 'csl71sgCvOvms' ), ('csl71sgOi4Cv', '93' , 2 , 'csl71sgCvOvms' ), ('csl71sgCvOvms', '93' , 2 , 'csl71sgCvOvms' ), ('t21gCi4Ov','93', 2 , 't21gCvOvms' ), ('t21gOi4Cv','93', 2 , 't21gCvOvms' ), ('t21gCvOvms','93', 2 , 't21gCvOvms' ), ] suffix = ".r2d"; sr2 = 2; sr3 = 1 # suffix = ".r3d"; sr2 = 1; sr3 = 2 verlist = [1,2,3,4] for id in list[:]: for v in verlist[:]: cl = calc[(id[0], id[1], v)] # cl_doubled = copy.deepcopy(cl) # cl_doubled.init = replic(cl.end, (1,sr2,sr3), only_atoms= "only_matrix") new_name = id[0]+suffix # cl_doubled.des = "The relaxed "+cl.name+" was doubled along "+suffix+" only for matrix; the sizes are the same" # cl_doubled.path["input_geo"] = 'geo/scaled/'+new_name+"/"+new_name+"."+str(v)+".geo" # cl_doubled.write_geometry(geotype = "init") # print "struct_des['{}'] = des('{}', 'scaled only matrix; the sizes are doubled without any manipulations' )".format(new_name, "scaled") # add_loop(new_name,'93',verlist ,calc,conv,varset, 'up1', savefile = 'only_outcar', inherit_option = 'inherit_xred' ) # print calc[] res_loop(new_name,'93',verlist ,calc,conv,varset, 'e_seg', (id[3]+suffix,'93',) ) return
def seg_energy_vs_voronoi(calc, conv, varset, plot = 0): """ Was used to calculate all segregation energies vs voronoi volume to find some dependence plot - if 1: than plot dependence """ aggregate_list = [] if 0: """1. Start processing of calculation specific information""" #base = 't111gCOv2' base = 't111gCvOvms' coseg_list = ['t111gCOi1.4-3', 't111gOCi1.4-3', 't111gCOi2.2-1', 't111gOCi2.2-1', 't111gCOi3.4-1', 't111gOCi3.4-1', \ 't111gCOi4.4-4is','t111gCOi5.2-2is', 't111gCOi6.1-1is', 't111gCOi7.3-3is','t111gCOi8.2-3','t111gOCi8.2-3', \ 't111gCOi9.4-4ms','t111gCOi10.2-2ms','t111gCOi11.4-3', 't111gOCi11.4-3', \ 't111gCOi12.1-3', 't111gOCi12.1-3', 't111gCOi13.4-2', 't111gOCi13.4-2', 't111gCOi14.2-1', 't111gOCi14.2-1', 't111gCOi15.4-4is','t111gCOi16.2-2is'] seg_list = ['t111gCi1Ov', 't111gCi2Ov','t111gCi3Ov','t111gCi4Ov','t111gOi1Cv','t111gOi2Cv','t111gOi3Cv','t111gOi4Cv',] bulk_list = ['t111gCOv2', 't111gCOv5' ] list = res_loop(base,'93kp9',range(2,3),calc,conv,varset, 'coseg', (base,) , voronoi = True ) aggregate_list.append(list) # os._exit(0) for key in seg_list: # print key # if 'Oi' in key: continue list = res_loop(key,'93kp9',range(2,3),calc,conv,varset, 'coseg', (base,) , voronoi = True ) aggregate_list.append(list) pass # res_loop('t112gCOi6.1-1is','93kp9',range(1,5),calc,conv,varset, 'coseg', ('t112gCvOvms',) ) base = 'c1gCvOvms' coseg_list = [ 'c1gCOi1.2-1', 'c1gCOi2.2-1', 'c1gCOi3.1-2', 'c1gCOi4.2-1', 'c1gCOi5.2-1', 'c1gCOi6.1-2', 'c1gCOi7.1-1', 'c1gCOi8.2-2', 'c1gOCi1.2-1', 'c1gOCi2.2-1', 'c1gOCi3.1-2', 'c1gOCi4.2-1', 'c1gOCi5.2-1', 'c1gOCi6.1-2', 'c1gOCi7.1-1', 'c1gOCi8.2-2', 'c1gCOi10.1' ] bulk_list = ['c1gCOv2', 'c1gCOv4', 'c1gCOv7',] seg_list = ['c1gCi1Ov', 'c1gCi2Ov', 'c1gOi1Cv', 'c1gOi2Cv', ] list = res_loop(base,'93kp7',range(2,3),calc,conv,varset, 'coseg', (base,), voronoi = True ) aggregate_list.append(list) for key in seg_list: # print key # if 'Oi' in key: continue list = res_loop(key,'93kp7',range(2,3),calc,conv,varset, 'coseg', (base,) , voronoi = True ) aggregate_list.append(list) pass base = 't111sgCvOvms' seg_list = ['t111sgCi1Ov', 't111sgCi2Ov', 't111sgCi3Ov', 't111sgCi4Ov', 't111sgCi5Ov', 't111sgCi6Ov', 't111sgCi7Ov', 't111sgOi1Cv', 't111sgOi2Cv', 't111sgOi3Cv', 't111sgOi4Cv', 't111sgOi5Cv', 't111sgOi6Cv', 't111sgOi7Cv', ] list = res_loop(base,'93kp9',range(2,3),calc,conv,varset, 'coseg', (base,) , voronoi = True ) aggregate_list.append(list) for key in seg_list: # print key # if 'Oi' in key: continue list = res_loop(key,'93kp9',range(2,3),calc,conv,varset, 'coseg', (base,) , voronoi = True ) aggregate_list.append(list) pass base = 't21gCvOvms' seg_list = ['t21gCi1Ov', 't21gCi2Ov', 't21gCi3Ov', 't21gCi4Ov', 't21gOi1Cv', 't21gOi2Cv', 't21gOi3Cv', 't21gOi4Cv', ] list = res_loop(base,'93',range(2,3),calc,conv,varset, 'coseg', (base,), voronoi = True ) aggregate_list.append(list) for key in seg_list: # print key # if 'Oi' in key: continue list = res_loop(key,'93',range(2,3),calc,conv,varset, 'coseg', (base,) , voronoi = True ) aggregate_list.append(list) write_xyz( replic(calc[(key, '93', 1)].end, (1,2,2)), ) pass base = 'csl71sgCvOvms' seg_list = ['csl71sgCi1Ov', 'csl71sgCi2Ov', 'csl71sgCi3Ov', 'csl71sgCi4Ov', 'csl71sgCi5Ov', 'csl71sgCi6Ov', 'csl71sgOi1Cv', 'csl71sgOi2Cv', 'csl71sgOi3Cv', 'csl71sgOi4Cv', 'csl71sgOi5Cv', 'csl71sgOi6Cv', ] list = res_loop(base,'93',range(2,3),calc,conv,varset, 'coseg', (base,) , voronoi = True ) aggregate_list.append(list) for key in seg_list: # print key # if 'Oi' in key: continue list = res_loop(key,'93',range(2,3),calc,conv,varset, 'coseg', (base,) , voronoi = True ) aggregate_list.append(list) pass calc['voronoi'] = aggregate_list else: aggregate_list = calc['voronoi'] pass if 1: # print res_loop('hs221C','83',101,calc,conv,varset, voronoi = True ) # # print res_loop('hs221.f','83',1,calc,conv,varset, voronoi = True ) # # print res_loop('csl71b_r','83kp8',1,calc,conv,varset, voronoi = True ) # print res_loop('hs221C.f','93',1,calc,conv,varset, voronoi = True ) #9.25 But the sum of Voronoi volume for hexagonal cell is wrong!!! # print res_loop('hs332C.f','93',1,calc,conv,varset, voronoi = True ) #9.18 But volume for internal atoms seems to be OK, # print res_loop('hs443C.f','93',1,calc,conv,varset, voronoi = True ) #9.13 But for edge atoms it is even zero. # print res_loop('hs554C.f','93',1,calc,conv,varset, voronoi = True ) #9.14 It seems that Voronoi module does not recognize oblique cell geometry. """2. Analysis""" esegC = [float(x[1]) for x in aggregate_list if 'Oi' not in x[0]] # C segregation including CvOvms vorovolC = [float(x[2]) for x in aggregate_list if 'Oi' not in x[0]] # print esegC, esegO = [float(x[1]) for x in aggregate_list if 'Ci' not in x[0]] # O segregation including CvOvms vorovolO = [float(x[4]) for x in aggregate_list if 'Ci' not in x[0]] """Plot dependence""" name = 'Voronoi volume - segregation energy' set = 'Eng' fig, (ax1, ax2) = plt.subplots(nrows=2, ncols=1) if set == 'Rus': matplotlib.rcParams.update({'font.size': 16}) xlabel = u'Энергия сегрегации (мэВ)' # print xlabel ylabel = u'Объем Вороного ($\AA^3$)' label1 = u'Рассчет' label2 = u'Аппроксимация' title1 = u'Углерод' title2 = u'Кислород' else: xlabel = 'Segregation energy (meV)' ylabel = 'Voronoi volume ($\AA^3$)' label1 = 'Calculated' label2 = 'Fitted' title1 = 'Carbon' title2 = 'Oxygen' # plt.figure() #plt.title(name) ax1.plot(esegC, vorovolC, 'o',label = label1) k, b = np.polyfit(esegC, vorovolC, 1) ax1.plot(esegC, np.asarray(esegC) * k + b, '-r',label = label2) ax1.set_title(title1) # ax1.legend(loc =4) # image_name = 'eseg_vorovol_C' # plt.savefig('images/'+str(image_name)+'.png',format='png', dpi = 300) # plt.cla() #plt.title(name) # plt.ylabel(ylabel) # plt.xlabel(xlabel) ax2.plot(esegO, vorovolO, 'o',label = label1) k, b = np.polyfit(esegO, vorovolO, 1) ax2.plot(esegO, np.asarray(esegO) * k + b, '-r',label = label2) ax2.set_title(title2) ax2.set_xlabel(xlabel) # ax2.legend(loc =4) # image_name = 'eseg_vorovol_O' plt.figtext(0.03, 0.5, ylabel, ha='center', va='center', rotation='vertical') # fig.set_ylabel(ylabel, va ='center') # plt.yaxis.set_label_coords(0, 0.5) # plt.xlabel(xlabel) plt.tight_layout() plt.subplots_adjust(left=0.15, bottom = 0.15) image_name = 'eseg_vorovol_CandO' plt.savefig('images/'+str(image_name)+'.png',format='png', dpi = 300) return