aboutsummaryrefslogtreecommitdiff
path: root/libcrystfel/src
diff options
context:
space:
mode:
authorThomas White <taw@physics.org>2013-02-21 14:48:42 +0100
committerThomas White <taw@physics.org>2013-02-21 14:48:42 +0100
commita817bc04c2b8f38814854ed6e5bd7c8b6a497cd5 (patch)
tree6a75f717ff11720bacc96d59b1234139b176796f /libcrystfel/src
parente0161d8bf8d3a2e86002d34e13a3586ff62ef313 (diff)
Enforce option requirements for XDS
Diffstat (limited to 'libcrystfel/src')
-rw-r--r--libcrystfel/src/xds.c24
1 files changed, 22 insertions, 2 deletions
diff --git a/libcrystfel/src/xds.c b/libcrystfel/src/xds.c
index 5d9d4bfa..887ba108 100644
--- a/libcrystfel/src/xds.c
+++ b/libcrystfel/src/xds.c
@@ -651,8 +651,28 @@ IndexingPrivate *xds_prepare(IndexingMethod *indm, UnitCell *cell,
{
struct xds_private *xp;
- if ( cell == NULL ) {
- ERROR("XDS needs a unit cell.\n");
+ /* Either cell,latt and cell provided, or nocell-nolatt and no cell
+ * - complain about anything else. Could figure this out automatically,
+ * but we'd have to decide whether the user just forgot the cell, or
+ * forgot "-nolatt", or whatever. */
+ if ( ((*indm & INDEXING_USE_LATTICE_TYPE)
+ || (*indm & INDEXING_USE_CELL_PARAMETERS)) && (cell == NULL) ) {
+ ERROR("No cell provided. If you wanted to use XDS without "
+ "prior cell information, use xds-nolatt-nocell.\n");
+ return NULL;
+ }
+
+ if ( (*indm & INDEXING_USE_LATTICE_TYPE)
+ && !(*indm & INDEXING_USE_CELL_PARAMETERS) ) {
+ ERROR("Invalid XDS options (-latt-nocell): "
+ "try xds-nolatt-nocell.\n");
+ return NULL;
+ }
+
+ if ( (*indm & INDEXING_USE_CELL_PARAMETERS)
+ && !(*indm & INDEXING_USE_LATTICE_TYPE) ) {
+ ERROR("Invalid XDS options (-cell-nolatt): "
+ "try xds-nolatt-nocell.\n");
return NULL;
}