diff options
Diffstat (limited to 'libcrystfel/src/index.c')
-rw-r--r-- | libcrystfel/src/index.c | 71 |
1 files changed, 67 insertions, 4 deletions
diff --git a/libcrystfel/src/index.c b/libcrystfel/src/index.c index f6e81109..049c3ba0 100644 --- a/libcrystfel/src/index.c +++ b/libcrystfel/src/index.c @@ -58,6 +58,7 @@ #include "predict-refine.h" #include "taketwo.h" #include "xgandalf.h" +#include "pinkindexer.h" /** \file index.h */ @@ -71,6 +72,7 @@ struct _indexingprivate struct taketwo_options *ttopts; struct xgandalf_options *xgandalf_opts; + struct pinkIndexer_options *pinkIndexer_opts; int n_methods; IndexingMethod *methods; @@ -195,6 +197,10 @@ static char *base_indexer_str(IndexingMethod indm) strcpy(str, "xgandalf"); break; + case INDEXING_PINKINDEXER: + strcpy(str, "pinkIndexer"); + break; + case INDEXING_SIMULATION : strcpy(str, "simulation"); break; @@ -232,7 +238,9 @@ static char *friendly_indexer_name(IndexingMethod m) static void *prepare_method(IndexingMethod *m, UnitCell *cell, + struct detector *det, struct beam_params *beam, struct xgandalf_options *xgandalf_opts, + struct pinkIndexer_options* pinkIndexer_opts, struct felix_options *felix_opts) { char *str; @@ -277,6 +285,11 @@ static void *prepare_method(IndexingMethod *m, UnitCell *cell, priv = xgandalf_prepare(m, cell, xgandalf_opts); break; + case INDEXING_PINKINDEXER : + priv = pinkIndexer_prepare(m, cell, pinkIndexer_opts, + det, beam); + break; + default : ERROR("Don't know how to prepare indexing method %i\n", *m); break; @@ -305,10 +318,11 @@ static void *prepare_method(IndexingMethod *m, UnitCell *cell, IndexingPrivate *setup_indexing(const char *method_list, UnitCell *cell, - struct detector *det, float *tols, - IndexingFlags flags, + struct detector *det, struct beam_params *beam, + float *tols, IndexingFlags flags, struct taketwo_options *ttopts, struct xgandalf_options *xgandalf_opts, + struct pinkIndexer_options *pinkIndexer_opts, struct felix_options *felix_opts) { int i, n; @@ -333,7 +347,6 @@ IndexingPrivate *setup_indexing(const char *method_list, UnitCell *cell, ERROR("The indexing method should contain only the method itself and "); ERROR("prior information modifiers ('cell' or 'latt')\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 peak alignment check ('bad'), use --no-check-peaks.\n"); ERROR("To disable indexing retry ('noretry'), use --no-retry.\n"); @@ -403,11 +416,36 @@ IndexingPrivate *setup_indexing(const char *method_list, UnitCell *cell, int j; ipriv->engine_private[i] = prepare_method(&methods[i], cell, + det, beam, xgandalf_opts, + pinkIndexer_opts, felix_opts); if ( ipriv->engine_private[i] == NULL ) return NULL; + if ( (methods[i] & INDEXING_METHOD_MASK) == INDEXING_PINKINDEXER ) { + if ( n > 1 ) { + ERROR("WARNING: Using PinkIndexer at the same " + "time as other indexers is not " + "recommended.\n"); + } + + if ( flags & INDEXING_CHECK_PEAKS ) { + ERROR("WARNING: Setting --no-check-peaks " + "because PinkIndexer is in use.\n"); + } + flags |= INDEXING_CHECK_PEAKS; + flags ^= INDEXING_CHECK_PEAKS; + + if ( flags & INDEXING_REFINE ) { + ERROR("WARNING: Setting --no-refine because " + "PinkIndexer is in use.\n"); + } + flags |= INDEXING_REFINE; + flags ^= INDEXING_REFINE; + } + + for ( j=0; j<i; j++ ) { if ( methods[i] == methods[j] ) { ERROR("Duplicate indexing method.\n"); @@ -430,6 +468,7 @@ IndexingPrivate *setup_indexing(const char *method_list, UnitCell *cell, ipriv->ttopts = ttopts; ipriv->xgandalf_opts = xgandalf_opts; + ipriv->pinkIndexer_opts = pinkIndexer_opts; STATUS("List of indexing methods:\n"); for ( i=0; i<n; i++ ) { @@ -445,6 +484,13 @@ IndexingPrivate *setup_indexing(const char *method_list, UnitCell *cell, } +const IndexingMethod *indexing_methods(IndexingPrivate *p, int *n) +{ + *n = p->n_methods; + return p->methods; +} + + void cleanup_indexing(IndexingPrivate *ipriv) { int n; @@ -490,6 +536,10 @@ void cleanup_indexing(IndexingPrivate *ipriv) xgandalf_cleanup(ipriv->engine_private[n]); break; + case INDEXING_PINKINDEXER : + pinkIndexer_cleanup(ipriv->engine_private[n]); + break; + default : ERROR("Don't know how to clean up indexing method %i\n", ipriv->methods[n]); @@ -602,6 +652,11 @@ static int try_indexer(struct image *image, IndexingMethod indm, r = taketwo_index(image, ipriv->ttopts, mpriv); break; + case INDEXING_PINKINDEXER : + set_last_task(last_task, "indexing:pinkindexer"); + r = run_pinkIndexer(image, mpriv); + break; + case INDEXING_XGANDALF : set_last_task(last_task, "indexing:xgandalf"); r = run_xgandalf(image, mpriv); @@ -1000,6 +1055,13 @@ IndexingMethod get_indm_from_string_2(const char *str, int *err) method = INDEXING_DEFAULTS_XGANDALF; have_method = 1; + } else if ( (strcmp(bits[i], "pinkIndexer") == 0) + || (strcmp(bits[i], "pinkindexer") == 0) ) + { + if ( have_method ) return warn_method(str); + method = INDEXING_DEFAULTS_PINKINDEXER; + have_method = 1; + } else if ( strcmp(bits[i], "none") == 0) { if ( have_method ) return warn_method(str); method = INDEXING_NONE; @@ -1098,9 +1160,10 @@ char *detect_indexing_methods(UnitCell *cell) 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) */ + /* Don't automatically use TakeTwo, Felix or PinkIndexer (yet) */ //do_probe(taketwo_probe, cell, methods); //do_probe(felix_probe, cell, methods); + //do_probe(pinkIndexer_probe, cell, methods); if ( strlen(methods) == 0 ) { free(methods); |