aboutsummaryrefslogtreecommitdiff
path: root/src/dirax.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/dirax.c')
-rw-r--r--src/dirax.c50
1 files changed, 49 insertions, 1 deletions
diff --git a/src/dirax.c b/src/dirax.c
index 19a6e26..6e97d21 100644
--- a/src/dirax.c
+++ b/src/dirax.c
@@ -165,7 +165,7 @@ static void dirax_send_next(ControlContext *ctx)
}
case 4 : {
- dirax_sendline("indexfit 6\n", ctx);
+ dirax_sendline("indexfit 2\n", ctx);
ctx->dirax_step++;
break;
}
@@ -351,6 +351,54 @@ void dirax_rerun(ControlContext *ctx)
ctx->dirax_step = 7;
}
+static void dirax_send_random_selection(ReflectionList *r, int n, FILE *fh)
+{
+ char *used;
+ int i;
+
+ used = malloc(n*sizeof(char));
+
+ for ( i=0; i<n; i++ ) {
+ used[i] = '-';
+ }
+
+ i = 0;
+ while ( i < 1000 ) {
+
+ Reflection *ref;
+ int j;
+ long long int ra;
+
+ ra = ((long long int)random() * (long long int)n);
+ ra /= RAND_MAX;
+ if ( used[ra] == 'U' ) {
+ continue;
+ }
+
+
+ /* Dig out the correct reflection. A little faffy
+ * because of the linked list */
+ ref = r->reflections;
+ for ( j=0; j<ra; j++ ) {
+ ref = ref->next;
+ }
+
+ /* Limit resolution of reflections */
+// if ( ( (ref->x/1e9)*(ref->x/1e9)
+// + (ref->y/1e9)*(ref->y/1e9)
+// + (ref->z/1e9)*(ref->z/1e9) ) > (20e9)*(20e9) )
+// continue;
+
+ fprintf(fh, "%10f %10f %10f %8f\n",
+ ref->x/1e10, ref->y/1e10,
+ ref->z/1e10, ref->intensity);
+ used[ra] = 'U';
+
+ i++;
+
+ }
+}
+
void dirax_invoke(ControlContext *ctx)
{
FILE *fh;