diff options
Diffstat (limited to 'libcrystfel/src/index.c')
-rw-r--r-- | libcrystfel/src/index.c | 41 |
1 files changed, 38 insertions, 3 deletions
diff --git a/libcrystfel/src/index.c b/libcrystfel/src/index.c index ff84c629..1476304d 100644 --- a/libcrystfel/src/index.c +++ b/libcrystfel/src/index.c @@ -57,6 +57,7 @@ #include "felix.h" #include "predict-refine.h" #include "taketwo.h" +#include "xgandalf.h" struct _indexingprivate @@ -66,6 +67,7 @@ struct _indexingprivate float tolerance[4]; struct taketwo_options *ttopts; + struct xgandalf_options *xgandalf_opts; int n_methods; IndexingMethod *methods; @@ -182,6 +184,10 @@ static char *base_indexer_str(IndexingMethod indm) strcpy(str, "taketwo"); break; + case INDEXING_XGANDALF: + strcpy(str, "xgandalf"); + break; + case INDEXING_SIMULATION : strcpy(str, "simulation"); break; @@ -219,6 +225,7 @@ static char *friendly_indexer_name(IndexingMethod m) static void *prepare_method(IndexingMethod *m, UnitCell *cell, + struct xgandalf_options *xgandalf_opts, struct felix_options *felix_opts) { char *str; @@ -259,6 +266,10 @@ static void *prepare_method(IndexingMethod *m, UnitCell *cell, priv = taketwo_prepare(m, cell); break; + case INDEXING_XGANDALF : + priv = xgandalf_prepare(m, cell, xgandalf_opts); + break; + default : ERROR("Don't know how to prepare indexing method %i\n", *m); break; @@ -290,6 +301,7 @@ IndexingPrivate *setup_indexing(const char *method_list, UnitCell *cell, struct detector *det, float *ltl, IndexingFlags flags, struct taketwo_options *ttopts, + struct xgandalf_options *xgandalf_opts, struct felix_options *felix_opts) { int i, n; @@ -386,6 +398,7 @@ IndexingPrivate *setup_indexing(const char *method_list, UnitCell *cell, int j; ipriv->engine_private[i] = prepare_method(&methods[i], cell, + xgandalf_opts, felix_opts); if ( ipriv->engine_private[i] == NULL ) return NULL; @@ -411,6 +424,7 @@ IndexingPrivate *setup_indexing(const char *method_list, UnitCell *cell, for ( i=0; i<4; i++ ) ipriv->tolerance[i] = ltl[i]; ipriv->ttopts = ttopts; + ipriv->xgandalf_opts = xgandalf_opts; STATUS("List of indexing methods:\n"); for ( i=0; i<n; i++ ) { @@ -467,6 +481,10 @@ void cleanup_indexing(IndexingPrivate *ipriv) taketwo_cleanup(ipriv->engine_private[n]); break; + case INDEXING_XGANDALF : + xgandalf_cleanup(ipriv->engine_private[n]); + break; + default : ERROR("Don't know how to clean up indexing method %i\n", ipriv->methods[n]); @@ -577,6 +595,10 @@ static int try_indexer(struct image *image, IndexingMethod indm, r = taketwo_index(image, ipriv->ttopts, mpriv); break; + case INDEXING_XGANDALF : + r = run_xgandalf(image, mpriv); + break; + default : ERROR("Unrecognised indexing method: %i\n", indm); return 0; @@ -584,7 +606,11 @@ static int try_indexer(struct image *image, IndexingMethod indm, } /* Stop a really difficult to debug situation in its tracks */ - assert(image->n_crystals - n_before == r); + if ( image->n_crystals - n_before != r ) { + ERROR("Whoops, indexer didn't return the right number " + "of crystals!\n"); + exit(1); + } /* For all the crystals found this time ... */ for ( i=0; i<r; i++ ) { @@ -649,7 +675,7 @@ static int try_indexer(struct image *image, IndexingMethod indm, if ( compare_cells(crystal_get_cell(cr), crystal_get_cell(that_cr), - 0.1, deg2rad(5.0), NULL) ) + 0.1, deg2rad(0.5), NULL) ) { crystal_set_user_flag(cr, 1); } @@ -829,7 +855,10 @@ void index_pattern_2(struct image *image, IndexingPrivate *ipriv, int *ping) /* Stop now if the pattern is indexed (don't try again for more * crystals with a different indexing method) */ - if ( success ) break; + if ( success ) { + image->n_indexing_tries = ntry; + break; + } } @@ -945,6 +974,11 @@ IndexingMethod get_indm_from_string_2(const char *str, int *err) method = INDEXING_DEFAULTS_TAKETWO; have_method = 1; + } else if ( strcmp(bits[i], "xgandalf") == 0) { + if ( have_method ) return warn_method(str); + method = INDEXING_DEFAULTS_XGANDALF; + have_method = 1; + } else if ( strcmp(bits[i], "none") == 0) { if ( have_method ) return warn_method(str); method = INDEXING_NONE; @@ -1042,6 +1076,7 @@ char *detect_indexing_methods(UnitCell *cell) do_probe(dirax_probe, cell, methods); do_probe(asdf_probe, cell, methods); do_probe(xds_probe, cell, methods); + do_probe(xgandalf_probe, cell, methods); /* Don't automatically use TakeTwo or Felix (yet) */ //do_probe(taketwo_probe, cell, methods); //do_probe(felix_probe, cell, methods); |