diff options
author | Thomas White <taw@physics.org> | 2018-04-25 12:06:14 +0200 |
---|---|---|
committer | Thomas White <taw@physics.org> | 2018-04-25 12:11:21 +0200 |
commit | e06097f715b6f935245236bdab1ccc4f63ce5884 (patch) | |
tree | b86c9cf4cf8ee7468091820ea7f135acd906f338 | |
parent | 6718caad7714608de853228e19015515c9c30a07 (diff) |
xds: Check that the vectors make sense
-rw-r--r-- | libcrystfel/src/xds.c | 21 |
1 files changed, 16 insertions, 5 deletions
diff --git a/libcrystfel/src/xds.c b/libcrystfel/src/xds.c index 7e661a4b..4723761b 100644 --- a/libcrystfel/src/xds.c +++ b/libcrystfel/src/xds.c @@ -3,12 +3,12 @@ * * Invoke xds for crystal autoindexing * - * Copyright © 2013-2017 Deutsches Elektronen-Synchrotron DESY, + * Copyright © 2013-2018 Deutsches Elektronen-Synchrotron DESY, * a research centre of the Helmholtz Association. * Copyright © 2013 Cornelius Gati * * Authors: - * 2010-2017 Thomas White <taw@physics.org> + * 2010-2018 Thomas White <taw@physics.org> * 2013 Cornelius Gati <cornelius.gati@cfel.de> * * This file is part of CrystFEL. @@ -233,30 +233,41 @@ static int read_cell(struct image *image, struct xds_private *xp) fclose(fh); return 0; } + + /* Get first vector */ rval = fgets(line, 1023, fh); if ( rval == NULL ) { fclose(fh); return 0; } - + if ( line[4] != '1' ) { + ERROR("No first vector from XDS.\n"); + return 0; + } memcpy(asx, line+7, 10); asx[10] = '\0'; memcpy(asy, line+17, 10); asy[10] = '\0'; memcpy(asz, line+27, 10); asz[10] = '\0'; + /* Get second vector */ rval = fgets(line, 1023, fh); if ( rval == NULL ) { fclose(fh); return 0; } - + if ( line[4] != '2' ) { + ERROR("No second vector from XDS.\n"); + return 0; + } memcpy(bsx, line+7, 10); bsx[10] = '\0'; memcpy(bsy, line+17, 10); bsy[10] = '\0'; memcpy(bsz, line+27, 10); bsz[10] = '\0'; + /* Get third vector */ rval = fgets(line, 1023, fh); fclose(fh); if ( rval == NULL ) return 0; - + if ( line[4] != '3' ) return 0; /* No error message this time + * - happens a lot */ memcpy(csx, line+7, 10); csx[10] = '\0'; memcpy(csy, line+17, 10); csy[10] = '\0'; memcpy(csz, line+27, 10); csz[10] = '\0'; |