aboutsummaryrefslogtreecommitdiff
path: root/src/reflections.c
diff options
context:
space:
mode:
authorThomas White <taw@physics.org>2010-02-09 17:50:22 +0100
committerThomas White <taw@physics.org>2010-02-17 10:33:25 +0100
commit1b5c5d980742c358debb6cf2783362d847a90230 (patch)
treebea5c5c3050a6d08edcf1749d157940dfc59384e /src/reflections.c
parent203bba5bb8d6723c9706867b2a7ad1f94fd5f7d0 (diff)
Add compare_hkl utility for working out Lorentz factors
Diffstat (limited to 'src/reflections.c')
-rw-r--r--src/reflections.c34
1 files changed, 34 insertions, 0 deletions
diff --git a/src/reflections.c b/src/reflections.c
index 88b2ab59..ab7738e4 100644
--- a/src/reflections.c
+++ b/src/reflections.c
@@ -77,6 +77,40 @@ void write_reflections(const char *filename, unsigned int *counts,
}
+double *read_reflections(const char *filename)
+{
+ double *ref;
+ FILE *fh;
+ char *rval;
+
+ fh = fopen(filename, "r");
+ if ( fh == NULL ) {
+ ERROR("Failed to open input file\n");
+ return NULL;
+ }
+
+ ref = new_list_intensity();
+
+ do {
+
+ char line[1024];
+ signed int h, k, l, intensity;
+ int r;
+
+ rval = fgets(line, 1023, fh);
+ r = sscanf(line, "%i %i %i %i", &h, &k, &l, &intensity);
+ if ( r != 4 ) continue;
+
+ set_intensity(ref, h, k, l, intensity);
+
+ } while ( rval != NULL );
+
+ fclose(fh);
+
+ return ref;
+}
+
+
double *ideal_intensities(double complex *sfac)
{
double *ref;