aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--libcrystfel/src/asdf.c2
-rw-r--r--libcrystfel/src/dirax.c2
-rw-r--r--libcrystfel/src/felix.c2
-rw-r--r--libcrystfel/src/index.c47
-rw-r--r--libcrystfel/src/index.h17
-rw-r--r--libcrystfel/src/mosflm.c2
-rw-r--r--libcrystfel/src/xds.c2
-rw-r--r--src/indexamajig.c14
-rw-r--r--src/process_image.h1
9 files changed, 60 insertions, 29 deletions
diff --git a/libcrystfel/src/asdf.c b/libcrystfel/src/asdf.c
index 39a574ae..c52b04ff 100644
--- a/libcrystfel/src/asdf.c
+++ b/libcrystfel/src/asdf.c
@@ -1181,7 +1181,7 @@ IndexingPrivate *asdf_prepare(IndexingMethod *indm, UnitCell *cell,
/* Flags that asdf knows about */
*indm &= INDEXING_METHOD_MASK | INDEXING_CHECK_CELL_COMBINATIONS
| INDEXING_CHECK_CELL_AXES | INDEXING_CHECK_PEAKS
- | INDEXING_RETRY | INDEXING_MULTI;
+ | INDEXING_CONTROL_FLAGS;
dp = malloc(sizeof(struct asdf_private));
if ( dp == NULL ) return NULL;
diff --git a/libcrystfel/src/dirax.c b/libcrystfel/src/dirax.c
index 014a4790..79b6d1ac 100644
--- a/libcrystfel/src/dirax.c
+++ b/libcrystfel/src/dirax.c
@@ -655,7 +655,7 @@ IndexingPrivate *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_RETRY | INDEXING_MULTI;
+ | INDEXING_CONTROL_FLAGS;
dp = malloc(sizeof(struct dirax_private));
if ( dp == NULL ) return NULL;
diff --git a/libcrystfel/src/felix.c b/libcrystfel/src/felix.c
index 18f60345..8a978957 100644
--- a/libcrystfel/src/felix.c
+++ b/libcrystfel/src/felix.c
@@ -679,7 +679,7 @@ IndexingPrivate *felix_prepare(IndexingMethod *indm, UnitCell *cell,
/* Flags that Felix knows about */
*indm &= INDEXING_METHOD_MASK | INDEXING_CHECK_PEAKS
| INDEXING_USE_LATTICE_TYPE | INDEXING_USE_CELL_PARAMETERS
- | INDEXING_RETRY | INDEXING_MULTI;
+ | INDEXING_CONTROL_FLAGS;
gp->cell = cell;
gp->indm = *indm;
diff --git a/libcrystfel/src/index.c b/libcrystfel/src/index.c
index 6a74a958..11931b01 100644
--- a/libcrystfel/src/index.c
+++ b/libcrystfel/src/index.c
@@ -235,7 +235,7 @@ void map_all_peaks(struct image *image)
static int try_indexer(struct image *image, IndexingMethod indm,
IndexingPrivate *ipriv)
{
- int i, r, n_bad;
+ int i, r;
switch ( indm & INDEXING_METHOD_MASK ) {
@@ -272,23 +272,28 @@ static int try_indexer(struct image *image, IndexingMethod indm,
}
- /* Attempt prediction refinement */
- n_bad = 0;
- for ( i=0; i<r; i++ ) {
- Crystal *cr = image->crystals[image->n_crystals-i-1];
- crystal_set_image(cr, image);
- crystal_set_user_flag(cr, 0);
- crystal_set_profile_radius(cr, 0.02e9);
- crystal_set_mosaicity(cr, 0.0);
- if ( refine_prediction(image, cr) != 0 ) {
- crystal_set_user_flag(cr, 1);
- n_bad++;
+ if ( indm & INDEXING_REFINE ) {
+
+ /* Attempt prediction refinement */
+ int n_bad = 0;
+ for ( i=0; i<r; i++ ) {
+ Crystal *cr = image->crystals[image->n_crystals-i-1];
+ crystal_set_image(cr, image);
+ crystal_set_user_flag(cr, 0);
+ crystal_set_profile_radius(cr, 0.02e9);
+ crystal_set_mosaicity(cr, 0.0);
+ if ( refine_prediction(image, cr) != 0 ) {
+ crystal_set_user_flag(cr, 1);
+ n_bad++;
+ }
}
- }
- remove_flagged_crystals(image);
+ remove_flagged_crystals(image);
+
+ if ( n_bad == r ) return 0;
+
+ }
- if ( n_bad == r ) return 0;
return r;
}
@@ -614,6 +619,12 @@ char *indexer_str(IndexingMethod indm)
strcat(str, "-nomulti");
}
+ if ( indm & INDEXING_REFINE ) {
+ strcat(str, "-refine");
+ } else {
+ strcat(str, "-norefine");
+ }
+
return str;
}
@@ -693,6 +704,12 @@ IndexingMethod *build_indexer_list(const char *str)
} else if ( strcmp(methods[i], "nomulti") == 0) {
list[nmeth] &= ~INDEXING_MULTI;
+ } else if ( strcmp(methods[i], "refine") == 0) {
+ list[nmeth] |= INDEXING_REFINE;
+
+ } else if ( strcmp(methods[i], "norefine") == 0) {
+ list[nmeth] &= ~INDEXING_REFINE;
+
} else {
ERROR("Bad list of indexing methods: '%s'\n", str);
return NULL;
diff --git a/libcrystfel/src/index.h b/libcrystfel/src/index.h
index fc2477da..2fb5a13d 100644
--- a/libcrystfel/src/index.h
+++ b/libcrystfel/src/index.h
@@ -41,29 +41,29 @@
#define INDEXING_DEFAULTS_DIRAX (INDEXING_DIRAX | INDEXING_CHECK_PEAKS \
| INDEXING_CHECK_CELL_COMBINATIONS \
- | INDEXING_RETRY)
+ | INDEXING_RETRY | INDEXING_REFINE)
#define INDEXING_DEFAULTS_ASDF (INDEXING_ASDF | INDEXING_CHECK_PEAKS \
| INDEXING_CHECK_CELL_COMBINATIONS \
- | INDEXING_RETRY)
+ | 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_RETRY | INDEXING_REFINE)
#define INDEXING_DEFAULTS_FELIX (INDEXING_FELIX \
| INDEXING_USE_LATTICE_TYPE \
| INDEXING_USE_CELL_PARAMETERS \
- | INDEXING_RETRY)
+ | 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_RETRY | INDEXING_REFINE)
/**
* IndexingMethod:
@@ -89,6 +89,7 @@
* 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
@@ -115,7 +116,8 @@ typedef enum {
INDEXING_USE_LATTICE_TYPE = 2048,
INDEXING_USE_CELL_PARAMETERS = 4096,
INDEXING_RETRY = 8192,
- INDEXING_MULTI = 16384
+ INDEXING_MULTI = 16384,
+ INDEXING_REFINE = 32768,
} IndexingMethod;
@@ -123,6 +125,9 @@ 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)
+
#ifdef __cplusplus
extern "C" {
#endif
diff --git a/libcrystfel/src/mosflm.c b/libcrystfel/src/mosflm.c
index 5b4b623f..8a546630 100644
--- a/libcrystfel/src/mosflm.c
+++ b/libcrystfel/src/mosflm.c
@@ -872,7 +872,7 @@ IndexingPrivate *mosflm_prepare(IndexingMethod *indm, UnitCell *cell,
*indm &= INDEXING_METHOD_MASK | INDEXING_CHECK_CELL_COMBINATIONS
| INDEXING_CHECK_CELL_AXES | INDEXING_CHECK_PEAKS
| INDEXING_USE_LATTICE_TYPE| INDEXING_USE_CELL_PARAMETERS
- | INDEXING_RETRY | INDEXING_MULTI;
+ | INDEXING_CONTROL_FLAGS;
if ( (*indm & INDEXING_USE_LATTICE_TYPE)
&& !((*indm & INDEXING_CHECK_CELL_COMBINATIONS)
diff --git a/libcrystfel/src/xds.c b/libcrystfel/src/xds.c
index ea0fc836..bda60d89 100644
--- a/libcrystfel/src/xds.c
+++ b/libcrystfel/src/xds.c
@@ -677,7 +677,7 @@ IndexingPrivate *xds_prepare(IndexingMethod *indm, UnitCell *cell,
*indm &= INDEXING_METHOD_MASK | INDEXING_CHECK_CELL_COMBINATIONS
| INDEXING_CHECK_CELL_AXES | INDEXING_USE_LATTICE_TYPE
| INDEXING_CHECK_PEAKS | INDEXING_USE_CELL_PARAMETERS
- | INDEXING_RETRY | INDEXING_MULTI;
+ | INDEXING_CONTROL_FLAGS;
xp->ltl = ltl;
xp->cell = cell;
diff --git a/src/indexamajig.c b/src/indexamajig.c
index a726c1b2..afc41a17 100644
--- a/src/indexamajig.c
+++ b/src/indexamajig.c
@@ -198,6 +198,7 @@ int main(int argc, char *argv[])
struct beam_params beam;
int have_push_res = 0;
int len;
+ int no_refine = 0;
/* Defaults */
iargs.cell = NULL;
@@ -241,7 +242,6 @@ int main(int argc, char *argv[])
iargs.fix_profile_r = -1.0;
iargs.fix_bandwidth = -1.0;
iargs.fix_divergence = -1.0;
- iargs.predict_refine = 1;
iargs.felix_options = NULL;
/* Long options */
@@ -269,7 +269,7 @@ int main(int argc, char *argv[])
{"no-use-saturated", 0, &iargs.use_saturated, 0},
{"no-revalidate", 0, &iargs.no_revalidate, 1},
{"check-hdf5-snr", 0, &iargs.check_hdf5_snr, 1},
- {"no-refine", 0, &iargs.predict_refine, 0},
+ {"no-refine", 0, &no_refine, 1},
/* Long-only options which don't actually do anything */
{"no-sat-corr", 0, &iargs.satcorr, 0},
@@ -589,12 +589,22 @@ int main(int argc, char *argv[])
} else {
+ int i = 0;
+
indm = build_indexer_list(indm_str);
if ( indm == NULL ) {
ERROR("Invalid indexer list '%s'\n", indm_str);
return 1;
}
free(indm_str);
+
+ /* If --no-refine, unset the refinement flag on all methods */
+ if ( no_refine ) {
+ while ( indm[i] != INDEXING_NONE ) {
+ indm[i] &= ~INDEXING_REFINE;
+ i++;
+ }
+ }
}
/* Parse integration method */
diff --git a/src/process_image.h b/src/process_image.h
index 60da7cb8..f474725c 100644
--- a/src/process_image.h
+++ b/src/process_image.h
@@ -88,7 +88,6 @@ struct index_args
float fix_profile_r;
float fix_bandwidth;
float fix_divergence;
- int predict_refine;
char *felix_options;
};