aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas White <taw27@cam.ac.uk>2008-11-10 13:26:45 +0000
committerThomas White <taw27@cam.ac.uk>2008-11-10 13:26:45 +0000
commit60e003f6f6007cab0a99164080637dcbe2fc9bf8 (patch)
treecd6a505e3ac5c95f336f6d1fd2e7a2062fd899fd
parentcd6e6ec86756756a5cbe8138c79e7d4c7bd3dc3a (diff)
Intelligently choose maximum resolution for generating reflections
-rw-r--r--src/reflections.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/src/reflections.c b/src/reflections.c
index 3a8c271..4809438 100644
--- a/src/reflections.c
+++ b/src/reflections.c
@@ -222,13 +222,17 @@ ReflectionList *reflection_list_from_cell(Basis *basis) {
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);
+ max_res = 21e9;
+ do {
+ 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);
+ max_res -= 1e9;
+ } while ( (max_order_a * max_order_b * max_order_c * 8) > 1e4 );
+ printf("Selected maximum resolution %8.5f nm^-1\n", max_res/1e9);
+
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++ ) {