def read_responses(self, out_dir, hw_idx): # hw_idx = hw_idx + 1 # Fortran index starts at 1 id_str = '{:07d}'.format(hw_idx) print('read_responses by identyfing with id_str ="' + id_str + "'") # # HALL LIKE ahc_tens = read_real_tens_file(out_dir + '/ahc/ahc_tens.dat', 'ahc') ahc_kubo_tens = read_cmplx_tens_file( out_dir + '/ahc/ahc_velo.hw' + id_str, 'ahcVELO') ohc_kubo_tens = read_cmplx_tens_file( out_dir + '/ahc/ohc_kubo.hw' + id_str, 'ohcVELO') #------- # # OPTICAL SeCnd_opt_tens = read_real_tens_file( out_dir + '/opt/2nd_photo.hw' + id_str, '2phC') optA_tens = read_cmplx_tens_file( out_dir + '/opt/opt_Asymm.hw' + id_str, 'optA') optS_tens = read_cmplx_tens_file( out_dir + '/opt/opt_Ssymm.hw' + id_str, 'optS') #------- # # GYROTROPIC #------- # # # return ahc_tens, ahc_kubo_tens, ohc_kubo_tens, SeCnd_opt_tens, optA_tens, optS_tens
def get_mep_tens(self): #TOTAL mep_file_path = self.work_dir+'/out/mep/mep_tens.dat' mep_tens = read_real_tens_file(mep_file_path, 'mep') #CHERN-SIMONS mep_file_path = self.work_dir+'/out/mep/mep_cs.dat' mep_cs = read_real_tens_file(mep_file_path, 'mep') #LOCAL mep_file_path = self.work_dir+'/out/mep/mep_lc.dat' mep_lc = read_real_tens_file(mep_file_path, 'mep') #ITINERANT mep_file_path = self.work_dir+'/out/mep/mep_ic.dat' mep_ic = read_real_tens_file(mep_file_path, 'mep') # # #BAND RESOLVED mep_bands = [] for n in range(1,self.val_bands+1): mep_file_path = self.work_dir+'/out/mep/mep_band.'+"{:07d}".format(n) tmp = read_real_tens_file(mep_file_path, 'mep') mep_bands.append(tmp) return mep_tens, mep_cs, mep_lc, mep_ic, mep_bands
def collect_data(self): for subdir, dirs, files in os.walk(self.root_dir): if "nK" in subdir and "w90files" not in subdir and "out" not in subdir and "raw" not in subdir: nK_new = int(subdir.split("nK")[1]) print("interpreted nK=",nK_new) # self.dir_lst.append(subdir) self.nK_lst.append(nK_new) # #self.mep_2014_lst.append( 0.0) #self.mep_2014_lst.append( read_real_tens_file( subdir + '/out/mep/mep_14.dat' , 'mep' ) ) self.mep_tot_lst.append( read_real_tens_file( subdir + '/out/mep/mep_tens.dat' , 'mep' ) ) self.mep_cs_lst.append( read_real_tens_file( subdir + '/out/mep/mep_cs.dat' , 'mep' ) ) self.mep_ic_lst.append( read_real_tens_file( subdir + '/out/mep/mep_ic.dat' , 'mep' ) ) self.mep_lc_lst.append( read_real_tens_file( subdir + '/out/mep/mep_lc.dat' , 'mep' ) ) # self.ahc_lst.append( read_real_tens_file( subdir + '/out/ahc/ahc_tens.dat' , 'ahc' ) ) self.ahc_velo_lst.append( read_cmplx_tens_file( subdir + '/out/ahc/ahc_velo.dat' , 'ahcVELO' ) ) self.ohc_lst.append( read_cmplx_tens_file( subdir + '/out/ahc/ohc_kubo.dat' , 'ohcVELO' ) ) # self.optS_lst.append( read_cmplx_tens_file( subdir + '/out/opt/opt_Ssymm.dat' , 'optS' ) ) self.optA_lst.append( read_cmplx_tens_file( subdir + '/out/opt/opt_Asymm.dat' , 'optA' ) ) #sort by number of kpts used\ print("raw nK_lst=" + str(self.nK_lst)) zipped = zip(self.nK_lst, self.mep_tot_lst, self.mep_cs_lst, self.mep_ic_lst, self.mep_lc_lst, self.ahc_lst) sort = sorted(zipped) self.nK_lst, self.mep_tot_lst, self.mep_cs_lst, self.mep_ic_lst, self.mep_lc_lst, self.ahc_lst = map(list,zip(*sort)) print("sorted nK_lst=" + str(self.nK_lst)) nK_per_dim_lst = self.get_nK_plot(False) print("sorted nK_per_dim_lst=" + str(nK_per_dim_lst))
def get_opt_tens(self): # symmetric contribution Ssymm_file_path = self.work_dir+'out/opt/opt_Ssymm.dat' Ssymm_tens = read_real_tens_file(Ssymm_file_path, 'optS') # # a symmetric contribution Asymm_file_path = self.work_dir+'out/opt/opt_Asymm.dat' Asymm_tens = read_real_tens_file(Asymm_file_path, 'optA') # # return Ssymm_tens, Asymm_tens
def get_absmax_mep(self, mep_file): mep_id = 'mep' mep_tens = read_real_tens_file( mep_file, mep_id) mep_abs = abs( mep_tens ) # #print("[get_absmax_mep]: mep_tens:",mep_tens) #print("[get_absmax_mep]: abs_max=",mep_abs.max()) # return mep_abs.max()
def get_ahc_tens(self): ahc_file_path = self.work_dir+'out/ahc/ahc_tens.dat' ahc_tens = read_real_tens_file(ahc_file_path, 'ahc') return ahc_tens
def read_phi(self): print("~") print("~") print("~") print(" TRAVERSE SUBDIRECOTRIES - COLLECT THE DATA ") print("-------------------------------------------------------------------------------") # # self.phi_tot_data = [] self.phi_bands_data = [] self.phi_cs_data = [] self.phi_lc_data = [] self.phi_ic_data = [] # for entry in os.scandir(self.root_dir): if entry.is_dir and 'plots' not in entry.path: # # work_dir = entry.path phi = work_dir.split("phi")[1] print("found subdir ="+str(entry.path)+' assoc. phi='+phi) # # mep_file_path = work_dir+'/out/mep/mep_tens.dat' mep_tens = read_real_tens_file(mep_file_path, 'mep') #CHERN-SIMONS mep_file_path = work_dir+'/out/mep/mep_cs.dat' mep_cs = read_real_tens_file(mep_file_path, 'mep') #LOCAL mep_file_path = work_dir+'/out/mep/mep_lc.dat' mep_lc = read_real_tens_file(mep_file_path, 'mep') #ITINERANT mep_file_path = work_dir+'/out/mep/mep_ic.dat' mep_ic = read_real_tens_file(mep_file_path, 'mep') # search = True band = 1 mep_bands = [] while search: mep_file_path = work_dir+'/out/mep/mep_band.'+"{:07d}".format(band) tmp = read_real_tens_file(mep_file_path, 'mep') if len(tmp)>0: #print('#band=',band, ' mep=',tmp) mep_bands.append( tmp ) band = band + 1 else: search = False self.n_bands = band -1 print("detected n_bands=",self.n_bands) print("phi=",phi," mep_bands=",mep_bands) # # #only record if the container is not empty (i.e. the file was found and had good behaviour) if len(mep_tens) is 3: self.phi_tot_data.append( [phi, mep_tens ] ) else: print("skip mep_tens for phi="+str(phi)) print("len(mep_tens)="+str(len(mep_tens))) if len(mep_cs) is 3: self.phi_cs_data.append( [phi, mep_cs ] ) if len(mep_lc) is 3: self.phi_lc_data.append( [phi, mep_lc ] ) if len(mep_ic) is 3: self.phi_ic_data.append( [phi, mep_ic ] ) if len(mep_bands) >0: self.phi_bands_data.append( [phi, mep_bands ] ) print("----------------------------------------------------------------------") print("") # self.phi_tot_data = sorted(self.phi_tot_data) self.phi_cs_data = sorted(self.phi_cs_data) self.phi_lc_data = sorted(self.phi_lc_data) self.phi_ic_data = sorted(self.phi_ic_data) self.phi_bands_data = sorted(self.phi_bands_data)