def compute(self): fn = "dop_{}/r_{}/output_job_0" # ugly depl_length, mobile_fraction = np.zeros(self.n_r), np.zeros(self.n_r) for i_d in range(0, self.n_d): for i_r in range(0, self.n_r): print("read-in i_dop = {}, i_r = {}".format(i_d, i_r)) depl_length[i_r] = extract.extract_float( fn.format(i_d, i_r), "depletion length: ") mobile_fraction[i_r] = extract.extract_float( fn.format(i_d, i_r), "mobile carrier fraction: ") #self.depl_length[i_d] = gmean(-depl_length) #self.mobile_fraction[i_d] = gmean(mobile_fraction) self.depl_length[i_d] = np.mean(-depl_length) self.mobile_fraction[i_d] = np.mean(mobile_fraction) self.std_err_de[i_d] = np.std(depl_length) / self.n_r self.std_err_mo[i_d] = np.std(mobile_fraction) / self.n_r np.savetxt('postprocessing/depl_length.dat', self.depl_length) np.savetxt('postprocessing/mobile_fraction.dat', self.mobile_fraction) np.savetxt('postprocessing/std_err_de.dat', self.std_err_de) np.savetxt('postprocessing/std_err_mo.dat', self.std_err_mo)
def compute(self): fn = "dop_{}/r_{}/output_job_0" # ugly depl_length, mobile_fraction = np.zeros(self.n_r).tolist(), np.zeros( self.n_r).tolist() for i_d in range(0, self.n_d): for i_r in range(0, self.n_r): print("read-in i_dop = {}, i_r = {}".format(i_d, i_r)) depl_length[i_r] = extract.extract_float( fn.format(i_d, i_r), "depletion length: ") mobile_fraction[i_r] = extract.extract_float( fn.format(i_d, i_r), "mobile carrier fraction: ") #self.depl_length[i_d] = gmean(-depl_length) #self.mobile_fraction[i_d] = gmean(mobile_fraction) self.depl_length[i_d] = np.mean(-np.array(depl_length)).tolist() self.mobile_fraction[i_d] = np.mean( np.array(mobile_fraction)).tolist() self.std_err_de[i_d] = (np.std(np.array(depl_length)) / self.n_r).tolist() self.std_err_mo[i_d] = (np.std(np.array(mobile_fraction)) / self.n_r).tolist() self.dop = np.loadtxt( 'doping.txt').tolist() # TODO read from the yaml of r_0
IPIP_0_0 = np.zeros(NE) EA_plus_0_0 = np.zeros([nr,NE]) EAEA_plus_0_0 = np.zeros(NE) EA_1_0 = np.zeros([nr,NE]) EAEA_1_0 = np.zeros(NE) IP_minus_1_0 = np.zeros([nr,NE]) IPIP_minus_1_0 = np.zeros(NE) for i_r in range(0,nr): fn = 'jobs/r_{}/output_job_0'.format(i_r) print(fn) J[i_r] = extract.extract_float(fn, "Ionized dopant fraction: ") if np.log(J[i_r])>=0: J[i_r] = extract.extract_e(fn, "Ionized dopant fraction: ") IP_0_0[i_r,:] = np.loadtxt("jobs/r_{}/experiments/tmp/IP_0_0.dat".format(i_r)) EA_1_0[i_r,:] = np.loadtxt("jobs/r_{}/experiments/tmp/EA_1_0.dat".format(i_r)) EA_plus_0_0[i_r,:] = np.loadtxt("jobs/r_{}/experiments/tmp/EA_plus_0_0.dat".format(i_r)) IP_minus_1_0[i_r,:] = np.loadtxt("jobs/r_{}/experiments/tmp/IP_minus_1_0.dat".format(i_r)) JJ = np.mean(J[:]) IPIP_0_0[:]= np.mean(IP_0_0[:,:], 0) EAEA_1_0[:]= np.mean(EA_1_0[:,:], 0) EAEA_plus_0_0[:]= np.mean(EA_plus_0_0[:,:], 0) IPIP_minus_1_0[:]= np.mean(IP_minus_1_0[:,:], 0) print("Av. ionized dopant fraction: {}".format(JJ)) # Plot DOS vs. Energy to see if smooth enough PlotDOSPreview(IPIP_0_0,EAEA_plus_0_0,IPIP_minus_1_0,EAEA_1_0,Energy,figname)
if count_nan: savename = 'ion_dop_frac_fig5a_withnan.txt' else: savename = 'ion_dop_frac_fig5a.txt' if not os.path.exists(savename): ion_dop_frac_av = np.zeros((n_dis, n_temp)) std_ion_dop_frac = np.zeros((n_dis, n_temp)) for i_dis in range(n_dis): for i_temp in range(n_temp): ion_dop_frac_r = [] num_nan = 0 for i_r in range(n_replica): fn = 'jobs/dis_{}/temp_{}/r_{}/output_job_0'.format( i_dis, i_temp, i_r) print(fn) extract_ion_dop_frac = extract.extract_float( fn, "Ionized dopant fraction: ") if type(extract_ion_dop_frac) == float: if np.log(extract_ion_dop_frac) >= 0: ion_dop_frac_r.append( extract.extract_e(fn, "Ionized dopant fraction: ")) else: ion_dop_frac_r.append(extract_ion_dop_frac) else: num_nan += 1 if count_nan: ion_dop_frac_r.append(0.0) print(ion_dop_frac_r) print('{} times nan encountered in {}'.format(num_nan, fn)) ion_dop_frac_av[i_dis, i_temp] = np.mean(ion_dop_frac_r) std_ion_dop_frac[i_dis, i_temp] = np.std(ion_dop_frac_r) / np.sqrt(