aboutsummaryrefslogtreecommitdiff
path: root/libcrystfel
diff options
context:
space:
mode:
authorThomas White <taw@physics.org>2017-09-08 11:41:51 +0200
committerThomas White <taw@physics.org>2017-09-15 14:31:01 +0200
commit60c48f3876b0d3c30bf729ce691dbd3f56665c4c (patch)
tree44868373d7053924a3de614568cdc148e01de61e /libcrystfel
parent3f1c6a1fbc241721aafeb9e1e6c0cbdb1eb810b5 (diff)
Simplify indexing options
mosflm-cell-nolatt-multi-refine-bad-retry.... it's all getting a bit too much. This commit removes all the options from the indexing methods except for the prior information flags (cell/nocell and latt/nolatt). All the other options are now given at the top level with new indexamajig options, e.g. --no-multi and --no-retry. They are applied to all the methods, with no option to (say) use retry for one method and not for another. This also makes the "peak alignment test" default to OFF, and multi-lattice indexing ON. I think that the prediction refinement does a good enough job of checking the validity of indexing solutions, allowing us to turn off the alignment check which filters out most multi-lattice solutions.
Diffstat (limited to 'libcrystfel')
-rw-r--r--libcrystfel/src/asdf.c42
-rw-r--r--libcrystfel/src/dirax.c31
-rw-r--r--libcrystfel/src/felix.c16
-rw-r--r--libcrystfel/src/index.c198
-rw-r--r--libcrystfel/src/index.h77
-rw-r--r--libcrystfel/src/mosflm.c63
-rw-r--r--libcrystfel/src/taketwo.c19
-rw-r--r--libcrystfel/src/xds.c52
8 files changed, 133 insertions, 365 deletions
diff --git a/libcrystfel/src/asdf.c b/libcrystfel/src/asdf.c
index 0c43fe7a..bbfd1a56 100644
--- a/libcrystfel/src/asdf.c
+++ b/libcrystfel/src/asdf.c
@@ -272,39 +272,14 @@ static int calc_reciprocal(gsl_vector **direct, gsl_vector **reciprocal)
static int check_cell(struct asdf_private *dp, struct image *image,
UnitCell *cell)
{
- UnitCell *out;
Crystal *cr;
- if ( dp->indm & INDEXING_CHECK_CELL_COMBINATIONS ) {
-
- out = match_cell(cell, dp->template, 0, dp->ltl, 1);
- if ( out == NULL ) return 0;
-
- } else if ( dp->indm & INDEXING_CHECK_CELL_AXES ) {
-
- out = match_cell(cell, dp->template, 0, dp->ltl, 0);
- if ( out == NULL ) return 0;
-
- } else {
- out = cell_new_from_cell(cell);
- }
-
cr = crystal_new();
if ( cr == NULL ) {
ERROR("Failed to allocate crystal.\n");
return 0;
}
-
- crystal_set_cell(cr, out);
-
- if ( dp->indm & INDEXING_CHECK_PEAKS ) {
- if ( !peak_sanity_check(image, &cr, 1) ) {
- crystal_free(cr); /* Frees the cell as well */
- cell_free(out);
- return 0;
- }
- }
-
+ crystal_set_cell(cr, cell);
image_add_crystal(image, cr);
return 1;
@@ -1206,22 +1181,9 @@ void *asdf_prepare(IndexingMethod *indm, UnitCell *cell,
struct detector *det, float *ltl)
{
struct asdf_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_has_parameters(cell) ) {
- ERROR("Altering your asdf flags because cell parameters were"
- " not provided.\n");
- *indm &= ~INDEXING_CHECK_CELL_COMBINATIONS;
- *indm &= ~INDEXING_CHECK_CELL_AXES;
- }
/* Flags that asdf knows about */
- *indm &= INDEXING_METHOD_MASK | INDEXING_CHECK_CELL_COMBINATIONS
- | INDEXING_CHECK_CELL_AXES | INDEXING_CHECK_PEAKS
- | INDEXING_CONTROL_FLAGS;
+ *indm &= INDEXING_METHOD_MASK;
dp = malloc(sizeof(struct asdf_private));
if ( dp == NULL ) return NULL;
diff --git a/libcrystfel/src/dirax.c b/libcrystfel/src/dirax.c
index b263eea0..29b735ad 100644
--- a/libcrystfel/src/dirax.c
+++ b/libcrystfel/src/dirax.c
@@ -108,39 +108,14 @@ struct dirax_data {
static int check_cell(struct dirax_private *dp, struct image *image,
UnitCell *cell)
{
- UnitCell *out;
Crystal *cr;
- if ( dp->indm & INDEXING_CHECK_CELL_COMBINATIONS ) {
-
- out = match_cell(cell, dp->template, 0, dp->ltl, 1);
- if ( out == NULL ) return 0;
-
- } else if ( dp->indm & INDEXING_CHECK_CELL_AXES ) {
-
- out = match_cell(cell, dp->template, 0, dp->ltl, 0);
- if ( out == NULL ) return 0;
-
- } else {
- out = cell_new_from_cell(cell);
- }
-
cr = crystal_new();
if ( cr == NULL ) {
ERROR("Failed to allocate crystal.\n");
return 0;
}
-
- crystal_set_cell(cr, out);
-
- if ( dp->indm & INDEXING_CHECK_PEAKS ) {
- if ( !peak_sanity_check(image, &cr, 1) ) {
- crystal_free(cr); /* Frees the cell as well */
- cell_free(out);
- return 0;
- }
- }
-
+ crystal_set_cell(cr, cell);
image_add_crystal(image, cr);
return 1;
@@ -655,9 +630,7 @@ void *dirax_prepare(IndexingMethod *indm, UnitCell *cell,
}
/* Flags that DirAx knows about */
- *indm &= INDEXING_METHOD_MASK | INDEXING_CHECK_CELL_COMBINATIONS
- | INDEXING_CHECK_CELL_AXES | INDEXING_CHECK_PEAKS
- | INDEXING_CONTROL_FLAGS;
+ *indm &= INDEXING_METHOD_MASK;
dp = malloc(sizeof(struct dirax_private));
if ( dp == NULL ) return NULL;
diff --git a/libcrystfel/src/felix.c b/libcrystfel/src/felix.c
index 6daf4408..4c12778b 100644
--- a/libcrystfel/src/felix.c
+++ b/libcrystfel/src/felix.c
@@ -222,16 +222,7 @@ static int read_felix(struct felix_private *gp, struct image *image,
fclose(fh);
- if ( gp->indm & INDEXING_CHECK_PEAKS ) {
- if ( !peak_sanity_check(image, image->crystals,
- image->n_crystals) )
- {
- free_all_crystals(image);
- return 0;
- }
- }
-
- return n_crystals;
+ return n_crystals;
}
@@ -672,9 +663,8 @@ void *felix_prepare(IndexingMethod *indm, UnitCell *cell,
if ( gp == NULL ) return NULL;
/* Flags that Felix knows about */
- *indm &= INDEXING_METHOD_MASK | INDEXING_CHECK_PEAKS
- | INDEXING_USE_LATTICE_TYPE | INDEXING_USE_CELL_PARAMETERS
- | INDEXING_CONTROL_FLAGS;
+ *indm &= INDEXING_METHOD_MASK
+ | INDEXING_USE_LATTICE_TYPE | INDEXING_USE_CELL_PARAMETERS;
gp->cell = cell;
gp->indm = *indm;
diff --git a/libcrystfel/src/index.c b/libcrystfel/src/index.c
index 36f99995..e7ae7a37 100644
--- a/libcrystfel/src/index.c
+++ b/libcrystfel/src/index.c
@@ -61,6 +61,7 @@
struct _indexingprivate
{
+ IndexingFlags flags;
UnitCell *target_cell;
float tolerance[4];
@@ -72,6 +73,30 @@ struct _indexingprivate
};
+static const char *onoff(int a)
+{
+ if ( a ) return "on";
+ return "off";
+}
+
+
+static void show_indexing_flags(IndexingFlags flags)
+{
+ STATUS(" Check unit cell (combinations): %s\n",
+ onoff(flags & INDEXING_CHECK_CELL_COMBINATIONS));
+ STATUS(" Check unit cell (axis permutations only): %s\n",
+ onoff(flags & INDEXING_CHECK_CELL_AXES));
+ STATUS(" Check peak alignment: %s\n",
+ onoff(flags & INDEXING_CHECK_PEAKS));
+ STATUS(" Refine indexing solutions: %s\n",
+ onoff(flags & INDEXING_REFINE));
+ STATUS(" Multi-lattice indexing (\"delete and retry\"): %s\n",
+ onoff(flags & INDEXING_MULTI));
+ STATUS(" Retry indexing: %s\n",
+ onoff(flags & INDEXING_RETRY));
+}
+
+
static int debug_index(struct image *image)
{
Crystal *cr = crystal_new();
@@ -159,7 +184,7 @@ static void *prepare_method(IndexingMethod *m, UnitCell *cell,
IndexingPrivate *setup_indexing(const char *method_list, UnitCell *cell,
struct detector *det, float *ltl,
- int no_refine, const char *options,
+ IndexingFlags flags, const char *options,
struct taketwo_options *ttopts)
{
int i, n;
@@ -178,10 +203,30 @@ IndexingPrivate *setup_indexing(const char *method_list, UnitCell *cell,
for ( i=0; i<n; i++ ) {
methods[i] = get_indm_from_string(method_strings[i]);
if ( methods[i] == INDEXING_ERROR ) {
+ ERROR("----- Notice -----\n");
+ ERROR("The way indexing options are used has changed in this CrystFEL version.\n");
+ ERROR("To disable prediction refinement ('norefine'), use --no-refine.\n");
+ ERROR("To check cell axes only ('axes'), use --no-cell-combinations.\n");
+ ERROR("To disable all unit cell checks ('raw'), use --no-check-cell.\n");
+ ERROR("To disable indexing retry ('noretry'), use --no-retry.\n");
+ ERROR("Multi-lattice indexing ('multi') is now the default: "
+ "use --no-multi to disable it.\n");
+ ERROR("------------------\n");
free(methods);
return NULL;
}
- if ( no_refine ) methods[i] &= ~INDEXING_REFINE;
+ }
+
+ if ( cell == NULL ) {
+ if ( (flags & INDEXING_CHECK_CELL_COMBINATIONS)
+ || (flags & INDEXING_CHECK_CELL_COMBINATIONS) )
+ {
+ ERROR("WARNING: Forcing --no-cell-combinations "
+ "and --no-check-cell because you didn't "
+ "provide a unit cell.\n");
+ flags &= ~INDEXING_CHECK_CELL_COMBINATIONS;
+ flags &= ~INDEXING_CHECK_CELL_AXES;
+ }
}
ipriv = malloc(sizeof(struct _indexingprivate));
@@ -212,6 +257,7 @@ IndexingPrivate *setup_indexing(const char *method_list, UnitCell *cell,
ipriv->methods = methods;
ipriv->n_methods = n;
+ ipriv->flags = flags;
if ( cell != NULL ) {
ipriv->target_cell = cell_new_from_cell(cell);
@@ -222,6 +268,8 @@ IndexingPrivate *setup_indexing(const char *method_list, UnitCell *cell,
ipriv->ttopts = ttopts;
+ show_indexing_flags(flags);
+
return ipriv;
}
@@ -369,34 +417,43 @@ static int try_indexer(struct image *image, IndexingMethod indm,
crystal_set_mosaicity(cr, 0.0);
/* Prediction refinement if requested */
- if ( indm & INDEXING_REFINE ) {
-
- UnitCell *out;
-
+ if ( ipriv->flags & INDEXING_REFINE )
+ {
if ( refine_prediction(image, cr) ) {
crystal_set_user_flag(cr, 1);
n_bad++;
continue;
}
+ }
- if ( (indm & INDEXING_CHECK_CELL_COMBINATIONS)
- || (indm & INDEXING_CHECK_CELL_AXES) )
- {
-
- /* Check that the cell parameters are still
- * within the tolerance */
- out = match_cell(crystal_get_cell(cr),
- ipriv->target_cell, 0,
- ipriv->tolerance, 0);
+ /* Unit cell check if requested */
+ assert( !((ipriv->flags & INDEXING_CHECK_CELL_COMBINATIONS)
+ && (ipriv->flags & INDEXING_CHECK_CELL_AXES)) );
+ if ( (ipriv->flags & INDEXING_CHECK_CELL_COMBINATIONS)
+ || (ipriv->flags & INDEXING_CHECK_CELL_AXES) )
+ {
+ UnitCell *out;
+ int reduce;
- if ( out == NULL ) {
- crystal_set_user_flag(cr, 1);
- }
+ if ( ipriv->flags & INDEXING_CHECK_CELL_COMBINATIONS )
+ {
+ reduce = 1;
+ } else {
+ reduce = 0;
+ }
- cell_free(out);
+ out = match_cell(crystal_get_cell(cr),
+ ipriv->target_cell, 0,
+ ipriv->tolerance, reduce);
+ if ( out == NULL ) {
+ crystal_set_user_flag(cr, 1);
+ n_bad++;
+ continue;
}
+ cell_free(crystal_get_cell(cr));
+ crystal_set_cell(cr, out);
}
/* Don't do similarity check if this crystal is bad */
@@ -514,14 +571,15 @@ static int delete_explained_peaks(struct image *image, Crystal *cr)
*
* Returns false for "try again", true for "no, stop now"
*/
-static int finished_retry(IndexingMethod indm, int r, struct image *image)
+static int finished_retry(IndexingMethod indm, IndexingFlags flags,
+ int r, struct image *image)
{
if ( r == 0 ) {
/* Indexing failed on the previous attempt. Maybe try again
* after poking the peak list a bit */
- if ( indm & INDEXING_RETRY ) {
+ if ( flags & INDEXING_RETRY ) {
/* Retry with fewer peaks */
return delete_weakest_peaks(image->features);
} else {
@@ -534,7 +592,7 @@ static int finished_retry(IndexingMethod indm, int r, struct image *image)
/* Indexing succeeded on previous attempt. Maybe try again
* after deleting the explained peaks */
- if ( indm & INDEXING_MULTI ) {
+ if ( flags & INDEXING_MULTI ) {
/* Remove "used" spots and try for another lattice */
Crystal *cr;
cr = image->crystals[image->n_crystals-1];
@@ -581,7 +639,8 @@ void index_pattern_2(struct image *image, IndexingPrivate *ipriv, int *ping)
ipriv, ipriv->engine_private[n]);
success += r;
ntry++;
- done = finished_retry(ipriv->methods[n], r, image);
+ done = finished_retry(ipriv->methods[n], ipriv->flags,
+ r, image);
if ( ntry > 5 ) done = 1;
if ( ping != NULL ) (*ping)++;
@@ -605,39 +664,6 @@ void index_pattern_2(struct image *image, IndexingPrivate *ipriv, int *ping)
}
-/* Set the indexer flags for "raw mode" ("--cell-reduction=none") */
-static IndexingMethod set_raw(IndexingMethod a)
-{
- /* Disable all unit cell checks */
- a &= ~(INDEXING_CHECK_CELL_COMBINATIONS | INDEXING_CHECK_CELL_AXES);
- return a;
-}
-
-
-/* Set the indexer flags for "bad mode" ("--insane) */
-static IndexingMethod set_bad(IndexingMethod a)
-{
- /* Disable the peak check */
- return a & ~INDEXING_CHECK_PEAKS;
-}
-
-
-/* Set the indexer flags for "axes mode" ("--cell-reduction=compare") */
-static IndexingMethod set_axes(IndexingMethod a)
-{
- return (a & ~INDEXING_CHECK_CELL_COMBINATIONS)
- | INDEXING_CHECK_CELL_AXES;
-}
-
-
-/* Set the indexer flags for "combination mode" ("--cell-reduction=reduce") */
-static IndexingMethod set_comb(IndexingMethod a)
-{
- return (a & ~INDEXING_CHECK_CELL_AXES)
- | INDEXING_CHECK_CELL_COMBINATIONS;
-}
-
-
/* Set the indexer flags for "use no lattice type information" */
static IndexingMethod set_nolattice(IndexingMethod a)
{
@@ -725,18 +751,6 @@ char *indexer_str(IndexingMethod indm)
if ( (indm & INDEXING_METHOD_MASK) == INDEXING_SIMULATION ) return str;
- if ( indm & INDEXING_CHECK_CELL_COMBINATIONS ) {
- strcat(str, "-comb");
- } else if ( indm & INDEXING_CHECK_CELL_AXES ) {
- strcat(str, "-axes");
- } else {
- strcat(str, "-raw");
- }
-
- if ( !(indm & INDEXING_CHECK_PEAKS) ) {
- strcat(str, "-bad");
- }
-
if ( indm & INDEXING_USE_LATTICE_TYPE ) {
strcat(str, "-latt");
} else {
@@ -749,24 +763,6 @@ char *indexer_str(IndexingMethod indm)
strcat(str, "-nocell");
}
- if ( indm & INDEXING_RETRY ) {
- strcat(str, "-retry");
- } else {
- strcat(str, "-noretry");
- }
-
- if ( indm & INDEXING_MULTI ) {
- strcat(str, "-multi");
- } else {
- strcat(str, "-nomulti");
- }
-
- if ( indm & INDEXING_REFINE ) {
- strcat(str, "-refine");
- } else {
- strcat(str, "-norefine");
- }
-
return str;
}
@@ -835,18 +831,6 @@ IndexingMethod get_indm_from_string(const char *str)
method = INDEXING_DEBUG;
return method;
- } else if ( strcmp(bits[i], "raw") == 0) {
- method = set_raw(method);
-
- } else if ( strcmp(bits[i], "bad") == 0) {
- method = set_bad(method);
-
- } else if ( strcmp(bits[i], "comb") == 0) {
- method = set_comb(method); /* Default */
-
- } else if ( strcmp(bits[i], "axes") == 0) {
- method = set_axes(method);
-
} else if ( strcmp(bits[i], "latt") == 0) {
method = set_lattice(method);
@@ -859,24 +843,6 @@ IndexingMethod get_indm_from_string(const char *str)
} else if ( strcmp(bits[i], "nocell") == 0) {
method = set_nocellparams(method);
- } else if ( strcmp(bits[i], "retry") == 0) {
- method |= INDEXING_RETRY;
-
- } else if ( strcmp(bits[i], "noretry") == 0) {
- method &= ~INDEXING_RETRY;
-
- } else if ( strcmp(bits[i], "multi") == 0) {
- method |= INDEXING_MULTI;
-
- } else if ( strcmp(bits[i], "nomulti") == 0) {
- method &= ~INDEXING_MULTI;
-
- } else if ( strcmp(bits[i], "refine") == 0) {
- method |= INDEXING_REFINE;
-
- } else if ( strcmp(bits[i], "norefine") == 0) {
- method &= ~INDEXING_REFINE;
-
} else {
ERROR("Bad list of indexing methods: '%s'\n", str);
return INDEXING_ERROR;
diff --git a/libcrystfel/src/index.h b/libcrystfel/src/index.h
index 8b3aadeb..2aad377b 100644
--- a/libcrystfel/src/index.h
+++ b/libcrystfel/src/index.h
@@ -39,36 +39,22 @@
#endif
-#define INDEXING_DEFAULTS_DIRAX (INDEXING_DIRAX | INDEXING_CHECK_PEAKS \
- | INDEXING_CHECK_CELL_COMBINATIONS \
- | INDEXING_RETRY | INDEXING_REFINE)
-
-#define INDEXING_DEFAULTS_ASDF (INDEXING_ASDF | INDEXING_CHECK_PEAKS \
- | INDEXING_CHECK_CELL_COMBINATIONS \
- | INDEXING_RETRY | INDEXING_REFINE)
-
-#define INDEXING_DEFAULTS_MOSFLM (INDEXING_MOSFLM | INDEXING_CHECK_PEAKS \
- | INDEXING_CHECK_CELL_COMBINATIONS \
- | INDEXING_USE_LATTICE_TYPE \
- | INDEXING_USE_CELL_PARAMETERS \
- | INDEXING_RETRY | INDEXING_REFINE)
-
-#define INDEXING_DEFAULTS_FELIX (INDEXING_FELIX \
- | INDEXING_USE_LATTICE_TYPE \
- | INDEXING_USE_CELL_PARAMETERS \
- | INDEXING_RETRY | INDEXING_REFINE)
-
-#define INDEXING_DEFAULTS_TAKETWO (INDEXING_TAKETWO | INDEXING_CHECK_PEAKS \
- | INDEXING_USE_CELL_PARAMETERS \
- | INDEXING_USE_LATTICE_TYPE \
- | INDEXING_RETRY | INDEXING_REFINE)
-
-/* Axis check is needed for XDS, because it likes to permute the axes */
-#define INDEXING_DEFAULTS_XDS (INDEXING_XDS | INDEXING_USE_LATTICE_TYPE \
- | INDEXING_USE_CELL_PARAMETERS \
- | INDEXING_CHECK_CELL_AXES \
- | INDEXING_CHECK_PEAKS \
- | INDEXING_RETRY | INDEXING_REFINE)
+#define INDEXING_DEFAULTS_DIRAX (INDEXING_DIRAX)
+
+#define INDEXING_DEFAULTS_ASDF (INDEXING_ASDF)
+
+#define INDEXING_DEFAULTS_MOSFLM (INDEXING_MOSFLM | INDEXING_USE_LATTICE_TYPE \
+ | INDEXING_USE_CELL_PARAMETERS)
+
+#define INDEXING_DEFAULTS_FELIX (INDEXING_FELIX | INDEXING_USE_LATTICE_TYPE \
+ | INDEXING_USE_CELL_PARAMETERS)
+
+#define INDEXING_DEFAULTS_TAKETWO (INDEXING_TAKETWO \
+ | INDEXING_USE_CELL_PARAMETERS \
+ | INDEXING_USE_LATTICE_TYPE)
+
+#define INDEXING_DEFAULTS_XDS (INDEXING_XDS | INDEXING_USE_LATTICE_TYPE \
+ | INDEXING_USE_CELL_PARAMETERS)
/**
* IndexingMethod:
@@ -82,21 +68,10 @@
* @INDEXING_ASDF: Use in-built "asdf" indexer
* @INDEXING_TAKETWO: Use in-built "taketwo" indexer
* @INDEXING_ERROR: Special value for unrecognised indexing engine name
- * @INDEXING_CHECK_CELL_COMBINATIONS: Check linear combinations of unit cell
- * axes for agreement with given cell.
- * @INDEXING_CHECK_CELL_AXES: Check unit cell axes for agreement with given
- * cell, and permute them if necessary.
- * @INDEXING_CHECK_PEAKS: Check that the peaks can be explained by the indexing
- * result.
* @INDEXING_USE_LATTICE_TYPE: Use lattice type and centering information to
* guide the indexing process.
* @INDEXING_USE_CELL_PARAMETERS: Use the unit cell parameters to guide the
* indexing process.
- * @INDEXING_RETRY: If the indexer doesn't succeed, delete the weakest peaks
- * and try again.
- * @INDEXING_MULTI: If the indexer succeeds, delete the peaks explained by the
- * lattice and try again in the hope of finding another crystal.
- * @INDEXING_REFINE: Perform "prediction refinement" after indexing.
*
* An enumeration of all the available indexing methods. The dummy value
* @INDEXING_SIMULATION is used by partial_sim to indicate that no indexing was
@@ -120,14 +95,8 @@ typedef enum {
/* Bits at the top of the IndexingMethod are flags which modify the
* behaviour of the indexer. */
- INDEXING_CHECK_CELL_COMBINATIONS = 256,
- INDEXING_CHECK_CELL_AXES = 512,
- INDEXING_CHECK_PEAKS = 1024,
INDEXING_USE_LATTICE_TYPE = 2048,
INDEXING_USE_CELL_PARAMETERS = 4096,
- INDEXING_RETRY = 8192,
- INDEXING_MULTI = 16384,
- INDEXING_REFINE = 32768,
} IndexingMethod;
@@ -135,8 +104,16 @@ typedef enum {
* core of the indexing method */
#define INDEXING_METHOD_MASK (0xff)
-/* Indexing flags which the indexing method does not need to know about */
-#define INDEXING_CONTROL_FLAGS (INDEXING_RETRY | INDEXING_MULTI | INDEXING_REFINE)
+typedef enum {
+
+ INDEXING_RETRY = 1,
+ INDEXING_MULTI = 2,
+ INDEXING_REFINE = 4,
+ INDEXING_CHECK_CELL_COMBINATIONS = 8,
+ INDEXING_CHECK_CELL_AXES = 16,
+ INDEXING_CHECK_PEAKS = 32,
+
+} IndexingFlags;
#ifdef __cplusplus
extern "C" {
@@ -162,7 +139,7 @@ extern IndexingMethod get_indm_from_string(const char *method);
extern IndexingPrivate *setup_indexing(const char *methods, UnitCell *cell,
struct detector *det, float *ltl,
- int no_refine, const char *options,
+ IndexingFlags flags, const char *options,
struct taketwo_options *ttopts);
extern void index_pattern(struct image *image, IndexingPrivate *ipriv);
diff --git a/libcrystfel/src/mosflm.c b/libcrystfel/src/mosflm.c
index edf8524e..110243cb 100644
--- a/libcrystfel/src/mosflm.c
+++ b/libcrystfel/src/mosflm.c
@@ -128,7 +128,6 @@ struct mosflm_data {
static int check_cell(struct mosflm_private *mp, struct image *image,
UnitCell *cell)
{
- UnitCell *out;
Crystal *cr;
/* If we sent lattice information, make sure that we got back what we
@@ -163,35 +162,13 @@ static int check_cell(struct mosflm_private *mp, struct image *image,
}
- if ( mp->indm & INDEXING_CHECK_CELL_COMBINATIONS ) {
-
- out = match_cell(cell, mp->template, 0, mp->ltl, 1);
- if ( out == NULL ) return 0;
-
- } else if ( mp->indm & INDEXING_CHECK_CELL_AXES ) {
-
- out = match_cell(cell, mp->template, 0, mp->ltl, 0);
- if ( out == NULL ) return 0;
-
- } else {
- out = cell_new_from_cell(cell);
- }
-
cr = crystal_new();
if ( cr == NULL ) {
ERROR("Failed to allocate crystal.\n");
return 0;
}
- crystal_set_cell(cr, out);
-
- if ( mp->indm & INDEXING_CHECK_PEAKS ) {
- if ( !peak_sanity_check(image, &cr, 1) ) {
- cell_free(out);
- crystal_free(cr);
- return 0;
- }
- }
+ crystal_set_cell(cr, cell);
image_add_crystal(image, cr);
@@ -340,8 +317,6 @@ static int read_newmat(struct mosflm_data *mosflm, const char *filename,
mosflm->done = 1;
}
- cell_free(cell);
-
return 0;
}
@@ -850,14 +825,10 @@ void *mosflm_prepare(IndexingMethod *indm, UnitCell *cell,
int need_cell = 0;
/* Check if cell parameters are needed/provided */
- if ( *indm & INDEXING_CHECK_CELL_COMBINATIONS ) need_cell = 1;
- if ( *indm & INDEXING_CHECK_CELL_AXES ) need_cell = 1;
if ( *indm & INDEXING_USE_CELL_PARAMETERS ) need_cell = 1;
if ( need_cell && !cell_has_parameters(cell) ) {
ERROR("Altering your MOSFLM flags because cell parameters were"
" not provided.\n");
- *indm &= ~INDEXING_CHECK_CELL_COMBINATIONS;
- *indm &= ~INDEXING_CHECK_CELL_AXES;
*indm &= ~INDEXING_USE_CELL_PARAMETERS;
}
@@ -869,36 +840,8 @@ void *mosflm_prepare(IndexingMethod *indm, UnitCell *cell,
}
/* Flags that MOSFLM knows about */
- *indm &= INDEXING_METHOD_MASK | INDEXING_CHECK_CELL_COMBINATIONS
- | INDEXING_CHECK_CELL_AXES | INDEXING_CHECK_PEAKS
- | INDEXING_USE_LATTICE_TYPE| INDEXING_USE_CELL_PARAMETERS
- | INDEXING_CONTROL_FLAGS;
-
- if ( (*indm & INDEXING_USE_LATTICE_TYPE)
- && !((*indm & INDEXING_CHECK_CELL_COMBINATIONS)
- || (*indm & INDEXING_CHECK_CELL_AXES))
- && (cell_has_parameters(cell)
- || (cell_get_unique_axis(cell) == 'a')
- || (cell_get_unique_axis(cell) == 'b')
- || (cell_get_unique_axis(cell) == 'c')) )
- {
- ERROR("WARNING: The unit cell from %s might have had "
- "its axes permuted from the unit cell you gave.\n"
- "If this is a problem, consider using "
- "mosflm-axes-latt or mosflm-comb-latt instead of "
- "mosflm-raw-latt.\n", indexer_str(*indm));
- /* It'll be OK if INDEXING_CHECK_CELL_PARAMETERS and
- * MOSFLM 7.2.0 or later, but that's getting a bit too
- * complicated to explain to the user. */
- }
-
- if ( (*indm & INDEXING_USE_CELL_PARAMETERS)
- && !((*indm & INDEXING_CHECK_CELL_COMBINATIONS)
- || (*indm & INDEXING_CHECK_CELL_AXES)) )
- {
- ERROR("WARNING: Using 'mosflm-raw' but providing cell "
- "parameters as prior information to mosflm.\n");
- }
+ *indm &= INDEXING_METHOD_MASK
+ | INDEXING_USE_LATTICE_TYPE | INDEXING_USE_CELL_PARAMETERS;
mp = malloc(sizeof(struct mosflm_private));
if ( mp == NULL ) return NULL;
diff --git a/libcrystfel/src/taketwo.c b/libcrystfel/src/taketwo.c
index 87da44a1..f7a2fda9 100644
--- a/libcrystfel/src/taketwo.c
+++ b/libcrystfel/src/taketwo.c
@@ -1460,7 +1460,7 @@ static void cleanup_taketwo_cell(struct TakeTwoCell *ttCell)
* successful.
**/
static UnitCell *run_taketwo(UnitCell *cell, const struct taketwo_options *opts,
- struct rvec *rlps, int rlp_count)
+ struct rvec *rlps, int rlp_count)
{
int cell_vec_count = 0;
int asym_vec_count = 0;
@@ -1581,18 +1581,6 @@ int taketwo_index(struct image *image, const struct taketwo_options *opts,
crystal_set_cell(cr, cell);
- if ( tp->indm & INDEXING_CHECK_PEAKS ) {
- if ( !peak_sanity_check(image, &cr, 1) ) {
- cell_free(cell);
- crystal_free(cr);
- // STATUS("Rubbish!!\n");
-
- return 0;
- } else {
- // STATUS("That's good!\n");
- }
- }
-
image_add_crystal(image, cr);
return 1;
@@ -1605,9 +1593,8 @@ void *taketwo_prepare(IndexingMethod *indm, UnitCell *cell,
struct taketwo_private *tp;
/* Flags that TakeTwo knows about */
- *indm &= INDEXING_METHOD_MASK | INDEXING_CHECK_PEAKS
- | INDEXING_USE_LATTICE_TYPE | INDEXING_USE_CELL_PARAMETERS
- | INDEXING_CONTROL_FLAGS;
+ *indm &= INDEXING_METHOD_MASK | INDEXING_USE_LATTICE_TYPE
+ | INDEXING_USE_CELL_PARAMETERS;
if ( !( (*indm & INDEXING_USE_LATTICE_TYPE)
&& (*indm & INDEXING_USE_CELL_PARAMETERS)) )
diff --git a/libcrystfel/src/xds.c b/libcrystfel/src/xds.c
index 093b9160..39578c60 100644
--- a/libcrystfel/src/xds.c
+++ b/libcrystfel/src/xds.c
@@ -187,39 +187,14 @@ static int xds_readable(struct image *image, struct xds_data *xds)
static int check_cell(struct xds_private *xp, struct image *image,
UnitCell *cell)
{
- UnitCell *out;
Crystal *cr;
- if ( xp->indm & INDEXING_CHECK_CELL_COMBINATIONS ) {
-
- out = match_cell(cell, xp->cell, 0, xp->ltl, 1);
- if ( out == NULL ) return 0;
-
- } else if ( xp->indm & INDEXING_CHECK_CELL_AXES ) {
-
- out = match_cell(cell, xp->cell, 0, xp->ltl, 0);
- if ( out == NULL ) return 0;
-
- } else {
- out = cell_new_from_cell(cell);
- }
-
cr = crystal_new();
if ( cr == NULL ) {
ERROR("Failed to allocate crystal.\n");
return 0;
}
-
- crystal_set_cell(cr, out);
-
- if ( xp->indm & INDEXING_CHECK_PEAKS ) {
- if ( !peak_sanity_check(image, &cr, 1) ) {
- cell_free(out);
- crystal_free(cr);
- return 0;
- }
- }
-
+ crystal_set_cell(cr, cell);
image_add_crystal(image, cr);
return 1;
@@ -626,14 +601,10 @@ void *xds_prepare(IndexingMethod *indm, UnitCell *cell,
int need_cell = 0;
/* Check if cell parameters are needed/provided */
- if ( *indm & INDEXING_CHECK_CELL_COMBINATIONS ) need_cell = 1;
- if ( *indm & INDEXING_CHECK_CELL_AXES ) need_cell = 1;
if ( *indm & INDEXING_USE_CELL_PARAMETERS ) need_cell = 1;
if ( need_cell && !cell_has_parameters(cell) ) {
ERROR("Altering your XDS flags because cell parameters were"
" not provided.\n");
- *indm &= ~INDEXING_CHECK_CELL_COMBINATIONS;
- *indm &= ~INDEXING_CHECK_CELL_AXES;
*indm &= ~INDEXING_USE_CELL_PARAMETERS;
}
@@ -652,36 +623,35 @@ void *xds_prepare(IndexingMethod *indm, UnitCell *cell,
}
if ( (*indm & INDEXING_USE_LATTICE_TYPE)
- && !(*indm & INDEXING_USE_CELL_PARAMETERS) ) {
+ && !(*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) ) {
+ && !(*indm & INDEXING_USE_LATTICE_TYPE) )
+ {
ERROR("Invalid XDS options (-cell-nolatt): "
"try xds-nolatt-nocell.\n");
return NULL;
}
if ( ((*indm & INDEXING_USE_CELL_PARAMETERS)
- || (*indm & INDEXING_USE_LATTICE_TYPE))
- && !(*indm & INDEXING_CHECK_CELL_AXES)
- && !(*indm & INDEXING_CHECK_CELL_COMBINATIONS) ) {
- ERROR("The cell from xds-raw-cell or xds-raw-latt may have had"
+ || (*indm & INDEXING_USE_LATTICE_TYPE)))
+ {
+ ERROR("The cell from xds-cell or xds-latt may have had"
" its axes permuted from the cell you provided. If this"
- " is a problem, consider using xds-axes-cell.\n");
+ " is a problem, consider using xds-cell.\n");
}
xp = calloc(1, sizeof(*xp));
if ( xp == NULL ) return NULL;
/* Flags that XDS knows about */
- *indm &= INDEXING_METHOD_MASK | INDEXING_CHECK_CELL_COMBINATIONS
- | INDEXING_CHECK_CELL_AXES | INDEXING_USE_LATTICE_TYPE
- | INDEXING_CHECK_PEAKS | INDEXING_USE_CELL_PARAMETERS
- | INDEXING_CONTROL_FLAGS;
+ *indm &= INDEXING_METHOD_MASK | INDEXING_USE_LATTICE_TYPE
+ | INDEXING_USE_CELL_PARAMETERS;
xp->ltl = ltl;
xp->cell = cell;