From c9d6dd115a6a1cd89eafb6cf8e588844017221eb Mon Sep 17 00:00:00 2001 From: Thomas White Date: Fri, 2 Jul 2010 15:10:50 +0200 Subject: Handle older reflection list formats as well --- src/reflections.c | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/src/reflections.c b/src/reflections.c index e93433d6..a2d94662 100644 --- a/src/reflections.c +++ b/src/reflections.c @@ -123,7 +123,28 @@ double *read_reflections(const char *filename, unsigned int *counts, rval = fgets(line, 1023, fh); r = sscanf(line, "%i %i %i %f %s %f %f %i", &h, &k, &l, &intensity, phs, &sigma, &res, &cts); - if ( r != 8 ) continue; + if ( r >= 8 ) { + /* Woohoo */ + } else if ( r >= 7 ) { + /* No "counts", that's fine.. */ + cts = 1; + } else if ( r >= 6 ) { + /* No resolution. Didn't want it anyway. */ + res = 0.0; + } else if ( r >= 5 ) { + /* No sigma. It's OK today, but one + * day I'll get you... */ + sigma = 0.0; + } else if ( r >= 4 ) { + /* No phase. Better not need it.. */ + if ( phases != NULL ) { + ERROR("Need phases and none were specified!\n"); + abort(); + } + } else { + /* You lose. */ + continue; + } set_intensity(ref, h, k, l, intensity); if ( phases != NULL ) { -- cgit v1.2.3