diff options
author | Thomas White <taw@physics.org> | 2013-05-15 14:47:47 +0200 |
---|---|---|
committer | Thomas White <taw@physics.org> | 2013-05-15 14:47:47 +0200 |
commit | 54f704a4458eab9c9266fcdcb0d7d4db5ec69048 (patch) | |
tree | 9a32b99e079e569eb1ed75fbf66c857c2ce9008a /src/process_hkl.c | |
parent | b431c940907e5b9891b8eed7261a4a8bb922146d (diff) |
Move polarisation_correction() to geometry.c
Diffstat (limited to 'src/process_hkl.c')
-rw-r--r-- | src/process_hkl.c | 43 |
1 files changed, 1 insertions, 42 deletions
diff --git a/src/process_hkl.c b/src/process_hkl.c index a4f23021..c2589115 100644 --- a/src/process_hkl.c +++ b/src/process_hkl.c @@ -50,6 +50,7 @@ #include "image.h" #include "crystal.h" #include "thread-pool.h" +#include "geometry.h" static void show_help(const char *s) @@ -172,48 +173,6 @@ static double scale_intensities(RefList *reference, RefList *new, } -void polarisation_correction(RefList *list, UnitCell *cell, struct image *image) -{ - Reflection *refl; - RefListIterator *iter; - double asx, asy, asz; - double bsx, bsy, bsz; - double csx, csy, csz; - - cell_get_reciprocal(cell, &asx, &asy, &asz, - &bsx, &bsy, &bsz, - &csx, &csy, &csz); - - for ( refl = first_refl(list, &iter); - refl != NULL; - refl = next_refl(refl, iter) ) - { - double pol, pa, pb, phi, tt, ool; - double intensity; - double xl, yl, zl; - signed int h, k, l; - - get_indices(refl, &h, &k, &l); - - /* Polarisation correction assuming 100% polarisation - * along the x direction */ - xl = h*asx + k*bsx + l*csx; - yl = h*asy + k*bsy + l*csy; - zl = h*asz + k*bsz + l*csz; - - ool = 1.0 / image->lambda; - tt = angle_between(0.0, 0.0, 1.0, xl, yl, zl+ool); - phi = atan2(yl, xl); - pa = pow(sin(phi)*sin(tt), 2.0); - pb = pow(cos(tt), 2.0); - pol = 1.0 - 2.0*(1.0-pa) + (1.0+pb); - - intensity = get_intensity(refl); - set_intensity(refl, intensity / pol); - } -} - - static int merge_crystal(RefList *model, struct image *image, Crystal *cr, RefList *reference, const SymOpList *sym, double *hist_vals, signed int hist_h, |