aboutsummaryrefslogtreecommitdiff
path: root/libcrystfel/src/index.c
diff options
context:
space:
mode:
Diffstat (limited to 'libcrystfel/src/index.c')
-rw-r--r--libcrystfel/src/index.c28
1 files changed, 28 insertions, 0 deletions
diff --git a/libcrystfel/src/index.c b/libcrystfel/src/index.c
index ff84c629..4ff4405a 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;
@@ -945,6 +967,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 +1069,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);