diff --git a/examples/Cu/AMR-xy/AMR_rhoT.py b/examples/Cu/AMR-xy/AMR_rhoT.py new file mode 100644 index 00000000..d23f98b0 --- /dev/null +++ b/examples/Cu/AMR-xy/AMR_rhoT.py @@ -0,0 +1,53 @@ +# Merge data of the same temperature from different folders. +import os +import re + +def extract_different_temp_data(f, ca_num, output_dir): + """ + :param f: + :param ca_num + :return: + """ + with open(f, 'r', encoding='utf-8') as data_file: + line = data_file.readline() + while line: + if '# T' in line: + line=line.strip() + tmp = line.split(' ')[-2] + output_file = './{}/{}K.dat'.format(output_dir, tmp) + with open(output_file, 'a+', encoding='utf-8') as out: + out.write('# {}\n'.format(ca_num)) + line = data_file.readline() + while line: + if '# T' not in line: + out.write(line) + line = data_file.readline() + else: + break + else: + line = data_file.readline() + + +if __name__ == '__main__': + number=1 #Btheta as the variable, number=0; Bphi as the variable, number=1 + dirs = os.listdir('.') + if not os.path.exists('./rho'): + os.mkdir('./rho') + files= os.listdir('./rho') + for file in files: + if file.endswith('K.dat'): + file_path = os.path.join('./rho', file) + os.remove(file_path) + + tmp_list = [] + for dir_name in dirs: + if 'Btheta' in dir_name: + angle=re.findall(r'\d+',dir_name) + tmp=int(angle[number]) + tmp_list.append(tmp) + tmp_list.sort() + for dir_name_num in tmp_list: + ca_num = str(int(dir_name_num)) + #dir_name = 'Btheta' + str(dir_name_num) + 'Bphi90' + dir_name = 'Btheta90'+ 'Bphi' + str(dir_name_num) + extract_different_temp_data('./{}/rho_total_mu_0.00eV.dat'.format(dir_name), ca_num=ca_num, output_dir='rho') diff --git a/examples/Cu/AMR-xy/AMR_rhotheta.py b/examples/Cu/AMR-xy/AMR_rhotheta.py new file mode 100644 index 00000000..86a16209 --- /dev/null +++ b/examples/Cu/AMR-xy/AMR_rhotheta.py @@ -0,0 +1,54 @@ +import os +import re +import numpy as np +def extract_rho_theta(f,dtheta,num_show,interval_line,choose,output_file, output_dir): + index = -1 + for _ in range(num_show): + theta=-dtheta + index = index+1 + with open(f, 'r', encoding='utf-8') as data_file: + line = data_file.readline() + outfile = './{}/{}'.format(output_dir,output_file) + with open(outfile, 'a+', encoding='utf-8') as out: + out.write('#Btau = {:.2f}\n'.format(choose[index])) + out.write('\n') + while line: + if 'BTau' in line: + theta=theta+dtheta + for __ in range(index*interval_line+1): + line=data_file.readline() + parts=line.split() + formparts=['{:>14}'.format(part) for part in parts] + formparts[0]='{:>5}'.format(str(theta)) + line=' '.join(formparts)+'\n' + out.write(line) + line = data_file.readline() + else: + line = data_file.readline() + + +if __name__ == '__main__': + theta_interval=5 + Btau_show=6 + Btau_num=101 + Btau_max=10 + Btau_list=np.linspace(0,Btau_max,Btau_num) + Btau_interval=int((Btau_num-1)/(Btau_show-1)) + Btau_choose=Btau_list[::Btau_interval] + dirs = os.listdir('.') + if not os.path.exists('./rhotheta'): + os.mkdir('./rhotheta') + files= os.listdir('./rhotheta') + for file in files: + if file.endswith('K_Btau.dat'): + file_path = os.path.join('./rhotheta', file) + os.remove(file_path) + tmp_list = [] + for dir_name in dirs: + if 'K.dat' in dir_name: + number=re.findall(r'\d+\.\d+',dir_name) + tmp_list.append(number[0]) + for temperature_name in tmp_list: + temperature_name = str(temperature_name) + extract_rho_theta('./{}K.dat'.format(temperature_name),dtheta=theta_interval,num_show=Btau_show, interval_line=Btau_interval,choose=Btau_choose,output_file='./{}K_Btau.dat'.format(temperature_name), output_dir='rhotheta') + diff --git a/examples/Cu/AMR-xy/AMR_rhoxx.gnu b/examples/Cu/AMR-xy/AMR_rhoxx.gnu new file mode 100644 index 00000000..260ba0bd --- /dev/null +++ b/examples/Cu/AMR-xy/AMR_rhoxx.gnu @@ -0,0 +1,41 @@ +set encoding iso_8859_1 +set terminal pdfcairo enhanced color font "Arial,20" size 8, 6 +set output 'rhoxx.pdf' +set border lw 10 +set autoscale fix +set ylabel '{/Symbol r}_{xx}*{/Symbol t} ({/Symbol W}*m*s)' +set format y "%1.1e" +set xlabel '{/Symbol \161}' +set xrange [0:180] +set yrange [1.2e-21:2.5e-21] +set xtics 30 +set key outside +#unset key +set palette defined (0 'red', 1 'green') +unset colorbox + +set lmargin at screen 0.25 # 左边距占页面宽度的10% +set rmargin at screen 0.80 # 右边距占页面宽度的90% +set bmargin at screen 0.2 # 下边距占页面高度的10% +set tmargin at screen 0.9 # 上边距占页面高度的90% + +set ylabel offset -5,0 +set xlabel offset 0,-1 +set key right vertical spacing 5 +set xtics font ",33" +set ytics font ",33" +set ylabel font ",40" +set xlabel font ",40" +set key font ",27" +set key spacing 1.2 +set key samplen 1.0 +set xtics 30 +set ytics 0.3e-21 + + +Bmin = 2.00 +Bmax = 10.00 +NumB = 6 +lw = 10 + +plot for [i=0:NumB-1] '90.0000K_Btau.dat' every :::i::i+1 u 1:2 w l lw lw title sprintf('B=%.0f T',2*i) diff --git a/examples/Cu/AMR-xy/AMR_rhozz.gnu b/examples/Cu/AMR-xy/AMR_rhozz.gnu new file mode 100644 index 00000000..9e6f558c --- /dev/null +++ b/examples/Cu/AMR-xy/AMR_rhozz.gnu @@ -0,0 +1,41 @@ +set encoding iso_8859_1 +set terminal pdfcairo enhanced color font "Arial,20" size 8, 6 +set output 'rhozz.pdf' +set border lw 10 +set autoscale fix +set ylabel '{/Symbol r}_{zz}*{/Symbol t} ({/Symbol W}*m*s)' +set format y "%1.1e" +set xlabel '{/Symbol \161}' +set xrange [0:180] +set yrange [1.2e-21:2.7e-21] +set xtics 30 +set key outside +#unset key +set palette defined (0 'red', 1 'green') +unset colorbox + +set lmargin at screen 0.25 # 左边距占页面宽度的10% +set rmargin at screen 0.80 # 右边距占页面宽度的90% +set bmargin at screen 0.2 # 下边距占页面高度的10% +set tmargin at screen 0.9 # 上边距占页面高度的90% + +set ylabel offset -5,0 +set xlabel offset 0,-1 +set key right vertical spacing 5 +set xtics font ",33" +set ytics font ",33" +set ylabel font ",40" +set xlabel font ",40" +set key font ",27" +set key spacing 1.2 +set key samplen 1.0 +set xtics 30 +set ytics 0.3e-21 + + +Bmin = 2.00 +Bmax = 10.00 +NumB = 6 +lw = 10 + +plot for [i=0:NumB-1] '90.0000K_Btau.dat' every :::i::i+1 u 1:10 w l lw lw title sprintf('B=%.0f T',2*i) diff --git a/examples/Cu/AMR-xy/xyplane.sh b/examples/Cu/AMR-xy/xyplane.sh new file mode 100755 index 00000000..69bb1893 --- /dev/null +++ b/examples/Cu/AMR-xy/xyplane.sh @@ -0,0 +1,121 @@ +#!/bin/bash + +# alpha is the angle between the magnetic field and the z' axis in the z'-b plane, where z' axis is +# perpendicular to a and b axis. + +for ((iphi=0; iphi<=36; iphi++)) +do + +theta=90 +phi=`echo "$iphi*5"|bc` +dir='Btheta'$theta'Bphi'$phi +echo $theta $phi $dir +mkdir $dir + +cat >$dir/wt.in <$dir/wt-theta.sh<