diff options
author | Thomas White <taw@physics.org> | 2016-01-30 20:22:56 +0100 |
---|---|---|
committer | Thomas White <taw@physics.org> | 2016-01-30 20:22:56 +0100 |
commit | 4b2cc069a16bf564404d9f1020733dd2ec0b2275 (patch) | |
tree | 825b3b5031264f2ca54ccfd4cd7fb640952b52d3 /libcrystfel | |
parent | c9c756db807f3ea22dcf2d01401a4ce69f73f4df (diff) |
indexamajig: Restore --no-refine
Adds yet another indexing option...
Diffstat (limited to 'libcrystfel')
-rw-r--r-- | libcrystfel/src/asdf.c | 2 | ||||
-rw-r--r-- | libcrystfel/src/dirax.c | 2 | ||||
-rw-r--r-- | libcrystfel/src/felix.c | 2 | ||||
-rw-r--r-- | libcrystfel/src/index.c | 47 | ||||
-rw-r--r-- | libcrystfel/src/index.h | 17 | ||||
-rw-r--r-- | libcrystfel/src/mosflm.c | 2 | ||||
-rw-r--r-- | libcrystfel/src/xds.c | 2 |
7 files changed, 48 insertions, 26 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; |