#you can add more commads in this list here(like 'command1','command2')# commands_other=\ [ ] commands=commands_other+commands_surface ##############################################end of main setup zone############################################ # # # # # You seldomly need to touch script lines hereafter!!! # # # # # # # ################################################################################################################ #depository path for output files(structure model files(.xyz,.cif), optimized values (CTR,RAXR,E_Density) for plotting output_file_path=output_path.module_path_locator() WT_BV=1#weighting for bond valence constrain (1 recommended) BV_TOLERANCE=[-0.2,0.2]#ideal bv value + or - this value is acceptable, negative side is over-saturation and positive site is under-saturated USE_TOP_ANGLE=True#fit top angle if true otherwise fit the Pb-O bond length (used in bidentate case) #sorbate_el_list is a unique list of sorbate elements being considered in the model system SORBATE_EL_LIST=[] [SORBATE_EL_LIST.append(each_el) for each_el in sum(SORBATE,[]) if each_el not in SORBATE_EL_LIST] FULL_LAYER_PICK_INDEX=domain_creator.make_pick_index(full_layer_pick=full_layer_pick,pick=pickup_index,half_layer_cases=15,full_layer_cases=15) HALF_LAYER_PICK_INDEX=domain_creator.make_pick_index_half_layer(half_layer_pick=half_layer_pick,pick=pickup_index,half_layer_cases=15) N_FL=len([i for i in full_layer_pick if i!=None]) N_HL=len(pickup_index)-N_FL COHERENCE=[{True:range(len(pickup_index))}] #want to add up in coherence? items inside list corresponding to each domain
HL-->0 1 2 3 4 5(Face-sharing) 6 7 CS(O1O2) CS(O2O3) ES(O1O3) ES(O1O4) TD(O1O2O3) TD(O1O3O4) OS Clean TERNARY HL--> 8 9 10 11 12 13 14 M(HO1) M(HO2) M(HO3) B(HO1_HO2) B(HO1_HO3) B(HO2_HO3) T(HO1_HO2_HO3) FL-->15 16 17 18 19 20(Face-sharing) 21 22 CS(O5O6) ES(O5O7) ES(O5O8) CS(O6O7) TD(O5O6O7) TD(O5O7O8) OS Clean TERNARY FL--> 23 24 25 26 27 28 29 M(HO1) M(HO2) M(HO3) B(HO1_HO2) B(HO1_HO3) B(HO2_HO3) T(HO1_HO2_HO3) """ ##############################################main setup zone############################################### #depository path for output files(structure model files(.xyz,.cif), optimized values (CTR,RAXR,E_Density) for plotting batch_path_head=batch_path.module_path_locator() output_file_path=output_path.module_path_locator() #/pick_index/begin# pickup_index=[[7], [19], [19]]#using matching index table above SORBATE=[['Pb'], ['Pb'], ['Pb']]#same shape as pickup_index half_layer=[3]#2 for short slab and 3 for long slab full_layer=[0, 1]#0 for short slab and 1 for long slab N_FL=len(full_layer)#number of full layer domains N_HL=len(half_layer)#number of half layer domains half_layer_pick=half_layer+[None]*N_FL full_layer_pick=[None]*N_HL+full_layer COHERENCE=[{True:range(len(pickup_index))}] #want to add up in coherence? items inside list corresponding to each domain FULL_LAYER_PICK_INDEX=domain_creator.make_pick_index(full_layer_pick=full_layer_pick, pick=pickup_index, half_layer_cases=15, full_layer_cases=15)
import models.sxrd_new1 as model from models.utils import UserVars import batchfile.locate_path as batch_path import dump_files.locate_path as output_path import models.domain_creator as domain_creator import supportive_functions.create_plots as create_plots import pickle ##==========================================<program begins from here>=========================================## run=1 N_el=40 h,k,l,zs=[],[],[],[] water_scaling=None if not run:#do this once to extract all necessary information PATH=output_path.module_path_locator() e_data_file=os.path.join(PATH,"temp_plot_eden_fourier_synthesis_sub") e_data=np.append([pickle.load(open(e_data_file,"rb"))[0]],[pickle.load(open(e_data_file,"rb"))[1]],axis=0).transpose() ctr_data=np.loadtxt(os.path.join(PATH,"temp_full_dataset.dat")) ##formate e density data e_data_formate=np.append(e_data[:,0][:,np.newaxis],np.zeros((len(e_data),3)),axis=1) e_data_formate=np.append(e_data_formate,e_data[:,1][:,np.newaxis],axis=1) e_data_formate=np.append(e_data_formate,np.zeros((len(e_data),3))+0.0001,axis=1) np.savetxt(os.path.join(PATH,"e_data_temp.dat"),e_data_formate) ##extract hkl from ctr_data h,k,l=[],[],[] for i in range(len(ctr_data)): if ctr_data[i,3]!=0: if ctr_data[i,3] not in l: h.append(ctr_data[i,1])
import dump_files.locate_path as output_path import models.domain_creator as domain_creator import accessory_functions.plotting_results.create_plots as create_plots import models.domain_creator_sorbate as domain_creator_sorbate import accessory_functions.make_par_table.make_parameter_table_GenX_5_beta as make_grid import convert_files ##==========================================<program begins from here>=========================================## COUNT_TIME=False if COUNT_TIME:t_0=datetime.now() VERSION=1.2#version number to make easier code update to compatible with gx files based on old version scripts ##<global handles>## running_mode=0 RUN=running_mode BATCH_PATH_HEAD,OUTPUT_FILE_PATH=batch_path.module_path_locator(),output_path.module_path_locator() F1F2_FILE='Zr_K_edge.f1f2' F1F2=np.loadtxt(os.path.join(BATCH_PATH_HEAD,F1F2_FILE))#the energy column should NOT have duplicate values after rounding up to 0 digit. If so, cut off rows of duplicate energy! RAXR_EL='Zr'#resonant element E0=18007#Adsorption edge energy NUMBER_RAXS_SPECTRA=21#total number of RAXR spectra RAXR_FIT_MODE='MI'#'MI' for model-independent, and 'MD' for model-dependent FREEZE=True#FREEZE=True will have resonant el make no influence on the non-resonant structure factor. And it will otherwise. NUMBER_DOMAIN,COHERENCE=2,True HEIGHT_OFFSET=-2.6685#if set to 0, the top atomic layer is at 2.6685 in fractional unit before relaxation (should not be changed) XY_OFFSET=[0,0]#takes effect only for structural atoms (not include Gaussian atoms) GROUP_SCHEME=[[1,0]]#means group Domain1 and Domain2 for inplane and out of plane movement, set Domain2=Domain1 in side sim func ##<setting slabs>## wal=0.7749136#wavelength,set this number right each time (read it from nQc data file) c_lattice=20.04156#correct c each time (use q-corrected c),c_lattice=c_projected/sin(180-beta)
import batchfile.locate_path as batch_path import dump_files.locate_path as output_path import models.domain_creator as domain_creator import supportive_functions.create_plots as create_plots import models.domain_creator_sorbate as domain_creator_sorbate import supportive_functions.make_parameter_table_GenX_5_beta as make_grid import convert_files ##==========================================<program begins from here>=========================================## COUNT_TIME=False if COUNT_TIME:t_0=datetime.now() VERSION=1.2#version number to make easier code update to compatible with gx files based on old version scripts ##<global handles>## RUN=1 BATCH_PATH_HEAD,OUTPUT_FILE_PATH=batch_path.module_path_locator(),output_path.module_path_locator() F1F2=np.loadtxt(os.path.join(BATCH_PATH_HEAD,'Zr_K_edge.f1f2'))#the energy column should NOT have duplicate values after rounding up to 0 digit. If so, cut off rows of duplicate energy! RAXR_EL,E0,NUMBER_RAXS_SPECTRA,RAXR_FIT_MODE,FREEZE='Zr',18007,21,'MI',True#FREEZE=True will have resonant el make no influence on the non-resonant structure factor. And it will otherwise. NUMBER_DOMAIN,COHERENCE=2,True HEIGHT_OFFSET=-2.6685#if set to 0, the top atomic layer is at 2.6685 in fractional unit before relaxation (should not be changed) XY_OFFSET=[0,0]#takes effect only for structural atoms (not include Gaussian atoms) GROUP_SCHEME=[[1,0]]#means group Domain1 and Domain2 for inplane and out of plane movement, set Domain2=Domain1 in side sim func ##<setting slabs>## wal=0.7749136#wavelength,set this number right each time (read it from nQc data file) unitcell = model.UnitCell(5.1988, 9.0266, 20.04156, 90, 95.782, 90)#a,b,c,alpha,beta,gamma, correct c each time (use q-corrected c),c=c_projected/sin(180-beta) inst = model.Instrument(wavel = wal, alpha = 2.0) bulk, Domain1, Domain2 = model.Slab(T_factor='u'), model.Slab(c = 1.0,T_factor='u'), model.Slab(c = 1.0,T_factor='u') domain_creator.add_atom_in_slab(bulk,os.path.join(BATCH_PATH_HEAD,'muscovite_001_bulk_u_corrected_new.str'),height_offset=HEIGHT_OFFSET) domain_creator.add_atom_in_slab(Domain1,os.path.join(BATCH_PATH_HEAD,'muscovite_001_surface_Al_u_corrected_new.str'),attach='_D1',height_offset=HEIGHT_OFFSET) domain_creator.add_atom_in_slab(Domain2,os.path.join(BATCH_PATH_HEAD,'muscovite_001_surface_Si_u_corrected_new.str'),attach='_D2',height_offset=HEIGHT_OFFSET)
import models.sxrd_new1 as model from models.utils import UserVars import batchfile.locate_path as batch_path import dump_files.locate_path as output_path import models.domain_creator as domain_creator import supportive_functions.create_plots as create_plots import pickle ##==========================================<program begins from here>=========================================## run=0 N_el=40 h,k,l,zs=[],[],[],[] water_scaling=None if not run:#do this once to extract all necessary information PATH=output_path.module_path_locator() e_data_file=os.path.join(PATH,"temp_plot_eden_fourier_synthesis") e_data=np.append([pickle.load(open(e_data_file,"rb"))[0]],[pickle.load(open(e_data_file,"rb"))[1]],axis=0).transpose() ctr_data=np.loadtxt(os.path.join(PATH,"temp_full_dataset.dat")) ##formate e density data e_data_formate=np.append(e_data[:,0][:,np.newaxis],np.zeros((len(e_data),3)),axis=1) e_data_formate=np.append(e_data_formate,e_data[:,1][:,np.newaxis],axis=1) e_data_formate=np.append(e_data_formate,np.zeros((len(e_data),3))+0.0001,axis=1) np.savetxt(os.path.join(PATH,"e_data_temp.dat"),e_data_formate) ##formate AP values AP_Q_file=os.path.join(PATH,"temp_plot_raxr_A_P_Q") data_AP_Q=pickle.load(open(AP_Q_file,"rb")) AP_data_formate_A=np.append(np.array(data_AP_Q[1][2])[:,np.newaxis],np.zeros((len(data_AP_Q[1][2]),3)),axis=1) AP_data_formate_A=np.append(AP_data_formate_A,np.array(data_AP_Q[1][0])[:,np.newaxis],axis=1) AP_data_formate_A=np.append(AP_data_formate_A,np.max(data_AP_Q[1][3],axis=1)[:,np.newaxis],axis=1) AP_data_formate_A=np.append(AP_data_formate_A,np.zeros((len(data_AP_Q[1][2]),2))+0.0001,axis=1)