DEFINE INSTRUMENT DMC_diff(lambda,Det_start, char *samplefile, char *monfile) DECLARE %{ double mono_q; double dm; double OMA; double RV; double NV = 5; double TKOFF; double sample_radius = 0.005; double sample_height = 0.03; double lambda; double ldiff=0.5; double Det_start; double Det_end; char option_list[150]; %} INITIALIZE %{ dm = 3.3537; TKOFF = lambda/(2.*dm); TKOFF = 2.*asin(TKOFF)*57.29577951308232087679815481410517; printf("TKOFF = %f\n", TKOFF); OMA = TKOFF/2; RV = fabs(2*2.82*sin(DEG2RAD*OMA)); Det_end= Det_start + 80; sprintf(option_list,"banana theta limits [%f %f] bins=400, file=det9.dat",Det_start,Det_end); printf("%s \n",option_list); %} TRACE COMPONENT source_arm = Arm() AT (0, 0, 0) ABSOLUTE COMPONENT progress = Progress_bar(percent=5,flag_save=1) AT (0,0,0) ABSOLUTE /* values for guide side window RNR12 */ COMPONENT csource = Source_gen( radius = 0.08,xw = 0.02, yh = 0.12, dist = 1.5, Lambda0 = lambda, dLambda = ldiff, T1=150.42,I1=5.98e11, T2=37.23,I2=5.637e11,T3=14.9,I3=0.962e11) AT (0,0,0) RELATIVE source_arm ROTATED (0,0,0) RELATIVE source_arm /* guide segment 1, m=2, 4.66 m */ COMPONENT guide1 = Guide(w1=0.02, h1=0.12, w2=0.02, h2=0.12, l=4.66, R0=0.995, Qc=0.0217, alpha = 5.76, m = 2.0, W = 0.0033) AT (0,0,1.5) RELATIVE source_arm ROTATED (0,0,0) RELATIVE source_arm /* guide segment 2, curved, m=2, 24.5 m */ COMPONENT guide2 = Bender( w = 0.02, h = 0.12, r = 3612, R0a = 0.995, Qca = 0.0217, alphaa = 5.76, ma = 2, Wa = 0.0033, R0i = 0.995, Qci = 0.0217, alphai = 5.76, mi = 2, Wi = 0.0033, R0s = 0.995, Qcs = 0.0217, alphas = 5.76, ms = 2, Ws = 0.0033, l = 24.5) AT (0,0,6.16) RELATIVE source_arm ROTATED (0,0,0) RELATIVE source_arm /* bunker wall, m=2, 3.0 m */ COMPONENT bunker = Guide( w1=0.02, h1=.12, w2=0.02, h2=.12, l=3.0, R0=0.995, Qc=0.0217, alpha = 5.76, m = 2.0, W = 0.0033) AT (0,0,30.66) RELATIVE source_arm ROTATED (0,0,0) RELATIVE source_arm /* guide segment 3, m=2, 8.84 m */ COMPONENT guide3 = Guide( w1=0.02, h1=.12, w2=0.02, h2=.12, l=8.84, R0=0.995,Qc=0.0217, alpha = 5.76, m = 2.0, W = 0.0033) AT (0,0,33.66) RELATIVE source_arm ROTATED (0,0,0) RELATIVE source_arm /* guide exit at 42.5 m - measured flux 2.46 10e8 cm-2 s-1 mA-1 */ COMPONENT in_slit = Slit( xmin = -0.01, xmax=0.01 , ymin = -0.06, ymax = 0.06) AT (0,0,42.5) RELATIVE source_arm ROTATED (0,0,0) RELATIVE source_arm /* Monochromator description */ COMPONENT sma = Arm() /* source - monochromator arm */ AT (0, 0, 43.15) RELATIVE source_arm ROTATED (0,OMA,0) RELATIVE source_arm COMPONENT foc_mono = Monochromator_curved( zwidth = 0.05, yheight = 0.025, gap = 0.0005, NH = 1, NV = 5, mosaich = 38, mosaicv = 38, r0 = 0.7, DM=dm, RV = RV, RH = 0) AT (0, 0, 0) RELATIVE sma COMPONENT msa = Arm() /* monochromator - sample arm */ AT (0, 0, 0) RELATIVE sma ROTATED (0, TKOFF, 0) RELATIVE source_arm COMPONENT out1_slit = Slit( xmin=-0.01, xmax=0.01, ymin=-0.06, ymax=0.06) AT (0,0,0.2) RELATIVE msa ROTATED (0,0,0) RELATIVE msa COMPONENT Amoin_slit = Slit( xmin=-0.01, xmax=0.01, ymin=-0.06, ymax=0.06) AT (0,0,0.325) RELATIVE msa ROTATED (0,0,0) RELATIVE msa COMPONENT Bmoin_slit = Slit( xmin=-0.01, xmax=0.01, ymin=-0.06, ymax=0.06) AT (0,0,0.525) RELATIVE msa ROTATED (0,0,0) RELATIVE msa COMPONENT out2_slit = Slit( xmin=-0.01, xmax=0.01, ymin=-0.06, ymax=0.06) AT (0,0,0.65) RELATIVE msa ROTATED (0,0,0) RELATIVE msa COMPONENT PSD_sample = MKMonitor( xmin=-0.05, xmax=0.05, ymin=-0.07, ymax=0.07,controlfile=monfile) AT ( 0, 0, 1.5) RELATIVE msa /* COMPONENT PSD_sample = PSD_monitor( xmin=-0.05, xmax=0.05, ymin=-0.07, ymax=0.07, nx=80, ny=80, filename="PSD_sample.dat",controlfile=monfile,dumpCount=1000) AT ( 0, 0, 1.5) RELATIVE msa COMPONENT PSD_sample = PSD_monitor( xmin=-0.05, xmax=0.05, ymin=-0.07, ymax=0.07, nx=80, ny=80, filename="PSD_sample.dat") AT ( 0, 0, 1.5) RELATIVE msa */ COMPONENT sa_arm = Arm() AT (0, 0, 2.82) RELATIVE msa ROTATED (0, 0, 0) RELATIVE msa COMPONENT sample = PowderN ( d_phi0=0, radius=sample_radius, h=sample_height, pack=1, Vc=1076.98, reflections = samplefile, sigma_a=0.2, focus_aw=80, focus_ah=3.5, target_index=+1) AT ( 0, 0, 0) RELATIVE sa_arm COMPONENT Det9 = Monitor_nD( xwidth=3.0,yheight=0.09, options=option_list) AT (0,0,0.000001) RELATIVE sa_arm ROTATED (0, 0, 180) RELATIVE sa_arm END