aboutsummaryrefslogtreecommitdiff
path: root/libcrystfel/src/index.c
diff options
context:
space:
mode:
authorThomas White <taw@physics.org>2017-10-18 10:23:25 +0200
committerThomas White <taw@physics.org>2017-10-18 10:23:25 +0200
commit0821a7ddae7901b70ea5ae216c71fe41109fec55 (patch)
treeaf0ee22beb0c6fb4b315449c262a595161b27a8f /libcrystfel/src/index.c
parent7f708ef255f068ef9e91941ac3a0a3d0e04e5ff8 (diff)
indexamajig: Auto-detection of available indexing methods
Diffstat (limited to 'libcrystfel/src/index.c')
-rw-r--r--libcrystfel/src/index.c38
1 files changed, 38 insertions, 0 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;
+}