From 585ca628920b5eba3f6addddabcec9ca90527f19 Mon Sep 17 00:00:00 2001 From: taw27 Date: Wed, 3 Oct 2007 14:01:12 +0000 Subject: UI and reprojection stuff git-svn-id: svn://cook.msm.cam.ac.uk:745/diff-tomo/dtr@144 bf6ca9ba-c028-0410-8290-897cf20841d1 --- src/reflections.c | 46 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) (limited to 'src/reflections.c') diff --git a/src/reflections.c b/src/reflections.c index dc3ce2f..0005332 100644 --- a/src/reflections.c +++ b/src/reflections.c @@ -351,3 +351,49 @@ ReflectionList *reflectionlist_sort_lfom(ReflectionList *in) { } +/* Generate a list of reflections from a unit cell */ +ReflectionList *reflection_list_from_cell(Basis *basis) { + + ReflectionList *ordered; + double max_res; + signed int h, k, l; + int max_order_a, max_order_b, max_order_c; + + + max_res = 20e9; + + ordered = reflectionlist_new(); + + max_order_a = max_res/modulus(basis->a.x, basis->a.y, basis->a.z); + max_order_b = max_res/modulus(basis->b.x, basis->b.y, basis->b.z); + max_order_c = max_res/modulus(basis->c.x, basis->c.y, basis->c.z); + for ( h=-max_order_a; h<=max_order_a; h++ ) { + for ( k=-max_order_b; k<=max_order_b; k++ ) { + for ( l=-max_order_c; l<=max_order_c; l++ ) { + + double x, y, z; + + x = h*basis->a.x + k*basis->b.x + l*basis->c.x; + y = h*basis->a.y + k*basis->b.y + l*basis->c.y; + z = h*basis->a.z + k*basis->b.z + l*basis->c.z; + + if ( ( x*x + y*y + z*z ) <= max_res*max_res ) { + Reflection *ref; + ref = reflection_add(ordered, x, y, z, 1, REFLECTION_GENERATED); + if ( ref ) { /* Check it's not NULL */ + ref->h = h; ref->k = k; ref->l = l; + } + if ( (h!=0) || (k!=0) || (l!=0) ) { + // reflection_add(ctx->reflectionlist, x, y, z, 1, REFLECTION_GENERATED); + reflection_add(ordered, x, y, z, 1, REFLECTION_GENERATED); + } + } + + } + } + } + + return ordered; + +} + -- cgit v1.2.3