diff options
author | Thomas White <taw@physics.org> | 2013-02-09 22:16:25 -0800 |
---|---|---|
committer | Thomas White <taw@physics.org> | 2013-02-09 22:16:25 -0800 |
commit | 00d4c6ce684b1352d585a287f8ef31c1c30a7c35 (patch) | |
tree | 90a8442ff28aa1a64e9840043ee7b72faa6081da /libcrystfel/src | |
parent | 11fe97d53a627fd5caf067bd9fe8f967cf3a72df (diff) |
Complain if a unit cell is needed and not provided
Diffstat (limited to 'libcrystfel/src')
-rw-r--r-- | libcrystfel/src/dirax.c | 15 | ||||
-rw-r--r-- | libcrystfel/src/index.c | 2 | ||||
-rw-r--r-- | libcrystfel/src/mosflm.c | 10 | ||||
-rw-r--r-- | libcrystfel/src/reax.c | 11 |
4 files changed, 32 insertions, 6 deletions
diff --git a/libcrystfel/src/dirax.c b/libcrystfel/src/dirax.c index 414e6406..b7fc68ea 100644 --- a/libcrystfel/src/dirax.c +++ b/libcrystfel/src/dirax.c @@ -3,11 +3,11 @@ * * Invoke the DirAx auto-indexing program * - * Copyright © 2012 Deutsches Elektronen-Synchrotron DESY, - * a research centre of the Helmholtz Association. + * Copyright © 2012-2013 Deutsches Elektronen-Synchrotron DESY, + * a research centre of the Helmholtz Association. * * Authors: - * 2010-2012 Thomas White <taw@physics.org> + * 2010-2013 Thomas White <taw@physics.org> * * This file is part of CrystFEL. * @@ -631,6 +631,15 @@ IndexingPrivate *dirax_prepare(IndexingMethod indm, UnitCell *cell, struct beam_params *beam, float *ltl) { struct dirax_private *dp; + int need_cell = 0; + + if ( indm & INDEXING_CHECK_CELL_COMBINATIONS ) need_cell = 1; + if ( indm & INDEXING_CHECK_CELL_AXES ) need_cell = 1; + + if ( need_cell && (cell == NULL) ) { + ERROR("DirAx needs a unit cell for this set of flags.\n"); + return NULL; + } dp = malloc(sizeof(struct dirax_private)); if ( dp == NULL ) return NULL; diff --git a/libcrystfel/src/index.c b/libcrystfel/src/index.c index 949be146..cb3639e4 100644 --- a/libcrystfel/src/index.c +++ b/libcrystfel/src/index.c @@ -88,6 +88,8 @@ IndexingPrivate **prepare_indexing(IndexingMethod *indm, UnitCell *cell, } + if ( iprivs[n] == NULL ) return NULL; + } iprivs[n] = NULL; diff --git a/libcrystfel/src/mosflm.c b/libcrystfel/src/mosflm.c index 28aca7ee..f4f45d40 100644 --- a/libcrystfel/src/mosflm.c +++ b/libcrystfel/src/mosflm.c @@ -733,6 +733,16 @@ IndexingPrivate *mosflm_prepare(IndexingMethod indm, UnitCell *cell, struct beam_params *beam, float *ltl) { struct mosflm_private *mp; + int need_cell = 0; + + if ( indm & INDEXING_CHECK_CELL_COMBINATIONS ) need_cell = 1; + if ( indm & INDEXING_CHECK_CELL_AXES ) need_cell = 1; + if ( indm & INDEXING_USE_LATTICE_TYPE ) need_cell = 1; + + if ( need_cell && (cell == NULL) ) { + ERROR("MOSFLM needs a unit cell for this set of flags.\n"); + return NULL; + } mp = malloc(sizeof(struct mosflm_private)); if ( mp == NULL ) return NULL; diff --git a/libcrystfel/src/reax.c b/libcrystfel/src/reax.c index 4717dcb4..f454503c 100644 --- a/libcrystfel/src/reax.c +++ b/libcrystfel/src/reax.c @@ -3,11 +3,11 @@ * * A new auto-indexer * - * Copyright © 2012 Deutsches Elektronen-Synchrotron DESY, - * a research centre of the Helmholtz Association. + * Copyright © 2012-2013 Deutsches Elektronen-Synchrotron DESY, + * a research centre of the Helmholtz Association. * * Authors: - * 2011-2012 Thomas White <taw@physics.org> + * 2011-2013 Thomas White <taw@physics.org> * * This file is part of CrystFEL. * @@ -1092,6 +1092,11 @@ IndexingPrivate *reax_prepare(IndexingMethod indm, UnitCell *cell, int samp; double th; + if ( cell == NULL ) { + ERROR("ReAx needs a unit cell.\n"); + return NULL; + } + p = calloc(1, sizeof(*p)); if ( p == NULL ) return NULL; |