aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas White <taw@physics.org>2010-07-02 15:10:50 +0200
committerThomas White <taw@physics.org>2012-02-22 15:26:52 +0100
commitc9d6dd115a6a1cd89eafb6cf8e588844017221eb (patch)
tree35ee3c67ddd6262b7b5e179b220389c80267d40b
parentec2040a6bfee076fe277a634acd5fab6e35727d1 (diff)
Handle older reflection list formats as well
-rw-r--r--src/reflections.c23
1 files changed, 22 insertions, 1 deletions
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 ) {