aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--libcrystfel/src/index.c38
-rw-r--r--libcrystfel/src/index.h2
-rw-r--r--src/indexamajig.c24
3 files changed, 56 insertions, 8 deletions
diff --git a/libcrystfel/src/index.c b/libcrystfel/src/index.c
index 8a390d71..89b8c334 100644
--- a/libcrystfel/src/index.c
+++ b/libcrystfel/src/index.c
@@ -993,3 +993,41 @@ IndexingMethod get_indm_from_string(const char *str)
{
return get_indm_from_string_2(str, NULL);
}
+
+
+static void do_probe(const char *(*func)(UnitCell *cell),
+ UnitCell *cell, char *methods)
+{
+ const char *probe;
+ probe = func(cell);
+ if ( probe != NULL ) {
+ if ( methods[0] != '\0' ) {
+ strcat(methods, ",");
+ }
+ strcat(methods, probe);
+ }
+}
+
+
+char *detect_indexing_methods(UnitCell *cell)
+{
+ char *methods;
+
+ methods = malloc(1024);
+ if ( methods == NULL ) return NULL;
+ methods[0] = '\0';
+
+ do_probe(mosflm_probe, cell, methods);
+ do_probe(dirax_probe, cell, methods);
+ do_probe(asdf_probe, cell, methods);
+ do_probe(xds_probe, cell, methods);
+ /* Don't automatically use Felix (yet) */
+ //do_probe(felix_probe, cell, methods);
+
+ if ( strlen(methods) == 0 ) {
+ free(methods);
+ return NULL;
+ }
+
+ return methods;
+}
diff --git a/libcrystfel/src/index.h b/libcrystfel/src/index.h
index ae5185db..4e1f1519 100644
--- a/libcrystfel/src/index.h
+++ b/libcrystfel/src/index.h
@@ -143,6 +143,8 @@ extern IndexingPrivate *setup_indexing(const char *methods, UnitCell *cell,
IndexingFlags flags, const char *options,
struct taketwo_options *ttopts);
+extern char *detect_indexing_methods(UnitCell *cell);
+
extern void index_pattern(struct image *image, IndexingPrivate *ipriv);
extern void index_pattern_2(struct image *image, IndexingPrivate *ipriv,
diff --git a/src/indexamajig.c b/src/indexamajig.c
index 691d6e11..d11663e4 100644
--- a/src/indexamajig.c
+++ b/src/indexamajig.c
@@ -835,17 +835,25 @@ int main(int argc, char *argv[])
}
free(outfile);
+ if ( indm_str == NULL ) {
+
+ STATUS("No indexing methods specified. I will try to ");
+ STATUS("automatically detect the available methods.\n");
+ STATUS("To disable auto-detection of indexing methods, specify ");
+ STATUS("which methods to use with --indexing=<methods>.\n");
+ STATUS("Use --indexing=none to disable indexing and integration.\n");
+ indm_str = detect_indexing_methods(iargs.cell);
+
+ }
+
/* Prepare the indexing system */
if ( indm_str == NULL ) {
- STATUS("You didn't specify an indexing method, so I won't try "
- " to index anything.\n"
- "If that isn't what you wanted, re-run with"
- " --indexing=<methods>.\n");
- if ( iargs.cell != NULL ) {
- STATUS("Ignoring your unit cell.\n");
- }
- iargs.ipriv = NULL;
+ ERROR("No indexing method specified, and no usable indexing ");
+ ERROR("methods auto-detected.\n");
+ ERROR("Install some indexing programs (mosflm,dirax etc), or ");
+ ERROR("try again with --indexing=none.\n");
+ return 1;
} else if ( strcmp(indm_str, "none") == 0 ) {