From 1b5c5d980742c358debb6cf2783362d847a90230 Mon Sep 17 00:00:00 2001 From: Thomas White Date: Tue, 9 Feb 2010 17:50:22 +0100 Subject: Add compare_hkl utility for working out Lorentz factors --- src/reflections.c | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) (limited to 'src/reflections.c') 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; -- cgit v1.2.3