aboutsummaryrefslogtreecommitdiff
path: root/src/reflections.c
diff options
context:
space:
mode:
authortaw27 <taw27@bf6ca9ba-c028-0410-8290-897cf20841d1>2007-10-03 14:01:12 +0000
committertaw27 <taw27@bf6ca9ba-c028-0410-8290-897cf20841d1>2007-10-03 14:01:12 +0000
commit585ca628920b5eba3f6addddabcec9ca90527f19 (patch)
treea1c4d5735ed59e2af08f238e2d827c822728145f /src/reflections.c
parent80828d43d4959122c549be8e44b26815bdb61519 (diff)
UI and reprojection stuff
git-svn-id: svn://cook.msm.cam.ac.uk:745/diff-tomo/dtr@144 bf6ca9ba-c028-0410-8290-897cf20841d1
Diffstat (limited to 'src/reflections.c')
-rw-r--r--src/reflections.c46
1 files changed, 46 insertions, 0 deletions
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;
+
+}
+