diff options
Diffstat (limited to 'libcrystfel/src/index.c')
-rw-r--r-- | libcrystfel/src/index.c | 81 |
1 files changed, 77 insertions, 4 deletions
diff --git a/libcrystfel/src/index.c b/libcrystfel/src/index.c index 03bd6ae3..62f22c13 100644 --- a/libcrystfel/src/index.c +++ b/libcrystfel/src/index.c @@ -284,10 +284,13 @@ IndexingPrivate *setup_indexing(const char *method_list, UnitCell *cell, } for ( i=0; i<n; i++ ) { - methods[i] = get_indm_from_string(method_strings[i]); - if ( methods[i] == INDEXING_ERROR ) { + int err = 0; + methods[i] = get_indm_from_string_2(method_strings[i], &err); + if ( err ) { ERROR("----- Notice -----\n"); - ERROR("The way indexing options are used has changed in this CrystFEL version.\n"); + ERROR("The way indexing options are given has changed in this CrystFEL version.\n"); + 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"); @@ -298,6 +301,7 @@ IndexingPrivate *setup_indexing(const char *method_list, UnitCell *cell, free(methods); return NULL; } + } /* No cell parameters -> no cell checking, no prior cell */ @@ -878,13 +882,15 @@ static IndexingMethod warn_method(const char *str) } -IndexingMethod get_indm_from_string(const char *str) +IndexingMethod get_indm_from_string_2(const char *str, int *err) { int n, i; char **bits; IndexingMethod method = INDEXING_NONE; int have_method = 0; + if ( err != NULL ) *err = 0; + n = assplode(str, "-", &bits, ASSPLODE_NONE); for ( i=0; i<n; i++ ) { @@ -946,6 +952,28 @@ IndexingMethod get_indm_from_string(const char *str) } else if ( strcmp(bits[i], "nocell") == 0) { method = set_nocellparams(method); + /* Deprecated options */ + } else if ( strcmp(bits[i], "retry") == 0) { + if ( err != NULL ) *err = 1; + } else if ( strcmp(bits[i], "noretry") == 0) { + if ( err != NULL ) *err = 1; + } else if ( strcmp(bits[i], "multi") == 0) { + if ( err != NULL ) *err = 1; + } else if ( strcmp(bits[i], "nomulti") == 0) { + if ( err != NULL ) *err = 1; + } else if ( strcmp(bits[i], "refine") == 0) { + if ( err != NULL ) *err = 1; + } else if ( strcmp(bits[i], "norefine") == 0) { + if ( err != NULL ) *err = 1; + } else if ( strcmp(bits[i], "raw") == 0) { + if ( err != NULL ) *err = 1; + } else if ( strcmp(bits[i], "bad") == 0) { + if ( err != NULL ) *err = 1; + } else if ( strcmp(bits[i], "comb") == 0) { + if ( err != NULL ) *err = 1; + } else if ( strcmp(bits[i], "axes") == 0) { + if ( err != NULL ) *err = 1; + } else { ERROR("Bad list of indexing methods: '%s'\n", str); return INDEXING_ERROR; @@ -960,3 +988,48 @@ IndexingMethod get_indm_from_string(const char *str) return method; } + + +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); + do_probe(taketwo_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; +} |