# macros concerning UB-matrix # # hp 21.10.1999 # hp 14.12.1999 added the program theta0 # hp 04.05.2001 added the program richt # # # ################################################################################ # # richt # # hp 17.12.1999 # hp 26.01.2001 # # call program richt (written by Oliver Seeck) # ################################################################################ # def richt ' unix("/export/home/hupfeld/common/richt") ' # # # # ################################################################################ # # theta0 # # hp 14.12.1999 # # calculates two_theta correction for cubic systems, based on the fortran program # C ****************************************************** # C * THETA0 VERSION 25/11/94 BRUECKEL * # C ****************************************************** # ################################################################################ # def theta0 ' local xt1,xt2,xb1,xb2,xb,xttttz,xttttn,xtet0,xlah,a01,a02,zt1,zt2 printf("\nprogram theta0 (TB) 25.11.1994\n\n") # printf("1st reflection (%g %g %g) at tth %g measured at wavelength %g Angstroem\n",g_h0,g_k0,g_l0,g_u00,g_lambda0) printf("2nd reflection (%g %g %g) at tth %g measured at wavelength %g Angstroem\n",g_h1,g_k1,g_l1,g_u10,g_lambda1) if (g_lambda0 != g_lambda1) { printf("\nYou can not run this program using two reflections measured at different wavelength!\n\n") exit } printf("using wavelength %g Angstroem (%g keV)\n",g_lambda0,hc_over_e/g_lambda0) printf("actual wavelength %g Angstroem (%g keV)\n\n",LAMBDA,hc_over_e/LAMBDA) # xt1 = g_u00/2 xt2 = g_u01/2 xb1 = pow(g_h0,2)+pow(g_k0,2)+pow(g_l0,2) xb2 = pow(g_h1,2)+pow(g_k1,2)+pow(g_l1,2) xb = sqrt(xb2/xb1) xttttz = xb*sin(rad(xt1))-sin(rad(xt2)) xttttn = xb*cos(rad(xt1))-cos(rad(xt2)) xtet0 = deg(atan(xttttz/xttttn)) xlah = g_lambda0/2 a01 = xlah*sqrt(xb1)/sin(rad(xt1-xtet0)) a02 = xlah*sqrt(xb2)/sin(rad(xt2-xtet0)) zt1 = g_u00-2*xtet0 zt2 = g_u10-2*xtet0 # printf("2*theta zeroshift = %g\n",2*xtet0) printf("a0 = %g %g\n",a01,a02) printf("New 2*theta values = %g %g\n\n",zt1,zt2) # if ($# != 0) { printf("1. Type setlat and enter the corrected lattice spacing %g\n",a01) printf("2. Drive your tth motor to the position %g (enough absorber?)\n",g_u00) printf("3. Calibrate tth to the new value with the command set tth %g\n",zt1) printf("4. Test your new UB-matrix by typing ca %g %g %g and compare it\n",g_h0,g_k0,g_l0) printf(" to the actual values (command wh), tth should be identical\n") printf("5. Type ca %g %g %g and compare the value of tth to your old one %g\n",g_h1,g_k1,g_l1,g_u10) printf(" The difference between the new (%g) and the old (%g)\n value should be %g\n",zt2,g_u10,2*xtet0) } else { printf("If you do not know what to do with this numbers type: theta0 help\n\n") } ' # # # # ################################################################################ # # hp_read_ubm # # hp 21.10.1999 # # # ################################################################################ # def hp_read_ubm ' _hp_read_ubm $* showUB ' # # # # ################################################################################ # # _hp_read_ubm # # hp 21.10.1999 # # reads UB-matrix from rafin, called by hp_read_ubm # ################################################################################ # def _hp_read_ubm ' local filename,i,text,n,v[] if ($# >= 2) { eprint "Usage: _hp_read_ubm filename" exit } if ($# == 1) { filename = "$1" } else { filename = "ubfrom.raf" } if (file_info(filename)-1) { eprint "File", filename, "does not exist!" exit } eprint "loading UB-matrix from file", filename if (getline(filename, "open")) { eprint "Error opening", filename, "!" exit } for (i=0;i<3;i++) { text = getline(filename) if (text==-1) { eprint "Error, reading beyond end of file", filename, "!" exit } n = split(text,v) if (i==0) { UB[0] = 2*PI*v[0] UB[1] = 2*PI*v[1] UB[2] = 2*PI*v[2] } if (i==1) { UB[3] = 2*PI*v[0] UB[4] = 2*PI*v[1] UB[5] = 2*PI*v[2] } if (i==2) { UB[6] = 2*PI*v[0] UB[7] = 2*PI*v[1] UB[8] = 2*PI*v[2] } } if (getline(filename, "close")) { eprint "Error closing", filename, "!" exit } ' # # # #