- Timestamp:
- 12/15/11 17:03:38 (5 months ago)
- Files:
-
- 1 modified
-
trunk/xlib/samples/Perfect_crystal.comp (modified) (8 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/xlib/samples/Perfect_crystal.comp
r3231 r3232 38 38 * width [m] width of the crystal (along x-axis) 39 39 * Material Si, Ge (maybe also GaAs?) 40 <<<<<<< HEAD41 * V [Ã42 ^3] unit cell volume43 * h,k,l indices of reflection (111)(220)(400)44 =======45 40 * V [Ã 46 41 ^3] unit cell volume160.1826 … … 48 43 * k [] Miller index of reflection 49 44 * l [] Miller index of reflection 50 >>>>>>> Perfect crystal now works for any hkl51 45 * alpha [rad] asymmetry angle (alpha=0 for symmetric reflection, ie the Bragg planes are parallel to the crystal surface) 52 46 * R0 [] Reflectivity. Overrides the computed Darwin reflectivity. Probably only useful for debugging. … … 86 80 theta = asin(lambda/(2*d)); /* kinematical bragg angle (rad) */ 87 81 b = sin(theta - alpha)/sin(theta + alpha); /* asymmetry factor */ 88 89 <<<<<<< HEAD90 *Theta0 = Thetain + alpha; /* (rad) angle between Bragg planes and incident ray */91 *Thetah = b*(*Theta0 - theta) + theta; /* (rad) Angle betweeb Bragg planes and reflected ray */92 =======93 b = sin(theta + alpha)/sin(theta - alpha); /* asymmetry factor */94 82 95 83 *Theta0 = Thetain - alpha; /* (rad) angle between Bragg planes and incident ray */ … … 100 88 *DeltaTheta0 = -1; /*to mark it irrelevant*/ 101 89 } 102 >>>>>>> Perfect crystal now works for any hkl103 90 104 91 /* Define polarization factor: */ … … 248 235 PROP_DL(dist); /* now the photon is on the mirror surface, ready to be reflected... */ 249 236 SCATTER; 250 <<<<<<< HEAD251 252 Thetain = atan(kyu/kzu); /* (rad )The angle of incidence*/253 254 =======255 237 /*Check which quadrant the k vector is in to determine sense of alpha. This to allow for hitting the crystal from behind.*/ 256 238 int quadrant; 257 239 Thetain=fabs(atan(ky/kz)); 258 >>>>>>> Perfect crystal now works for any hkl259 240 /* for a start, just define the value of atomic form factors for Si(111) at E = 8.04778keV */ 260 241 double d=cbrt(V)/(sqrt(h*h+k*k+l*l));/*this is valid only for cubic structures*/ … … 264 245 fpp = Table_Value(prms.m_t,E,2); 265 246 // printf("%g %g %g %g\n",f00,f0h,fp,fpp); 266 <<<<<<< HEAD267 /* printf("Thetain for this ray is: %g: \n",Thetain);*/268 DarwinReflectivity(&R, &Thetah, &Theta0, &DeltaTheta0, f00, f0h, fp, fpp, V, alpha, h, k, l, M, E, Thetain,pol);269 Thetaout = Thetah + alpha; /* (rad) the angle between the crystal surface and the reflected ray */270 /* printf("Thetaout for this ray is: %g: \n", Thetaout);*/271 272 =======273 247 //printf("Thetain for this ray is: %g: \n",Thetain); 274 248 if (ky<0 && kz>0){ … … 301 275 kz=kz-2*vnz; 302 276 }while(0); 303 >>>>>>> Perfect crystal now works for any hkl304 277 /* The direction of the reflected ray: */ 305 278 // printf("kout: %g %g %g\n",kx,ky,kz); 306 279 307 <<<<<<< HEAD308 NORM(kxout,kyout,kzout);309 kx=K*kxout;310 ky=K*kyout;311 kz=K*kzout;312 313 /* apply reflectivity */314 p*=R;315 316 =======317 280 /* apply Darwin reflectivity if not is supplied from outside*/ 318 281 if (!R0){ … … 323 286 /*catch dead rays*/ 324 287 if (p==0) ABSORB; 325 >>>>>>> Perfect crystal now works for any hkl 326 } else { 327 RESTORE_XRAY(INDEX_CURRENT_COMP, x, y, z, kx, ky, kz, phi, t, Ex, Ey, Ez, p); 328 } 288 } else { 289 RESTORE_XRAY(INDEX_CURRENT_COMP, x, y, z, kx, ky, kz, phi, t, Ex, Ey, Ez, p); 290 } 329 291 } 330 292
