From 59b99486be3865a53049d0c6317157d9f22bc0e1 Mon Sep 17 00:00:00 2001 From: Thomas White Date: Tue, 19 Feb 2013 18:13:13 +0100 Subject: Add -cell and -nocell to indexing methods --- libcrystfel/src/dirax.c | 6 ++++-- libcrystfel/src/grainspotter.c | 6 ++---- libcrystfel/src/index.c | 25 +++++++++++++++++++++++++ libcrystfel/src/index.h | 4 ++++ libcrystfel/src/mosflm.c | 7 +++++-- libcrystfel/src/xds.c | 2 +- 6 files changed, 41 insertions(+), 9 deletions(-) (limited to 'libcrystfel/src') diff --git a/libcrystfel/src/dirax.c b/libcrystfel/src/dirax.c index e6ff36b1..fb60656a 100644 --- a/libcrystfel/src/dirax.c +++ b/libcrystfel/src/dirax.c @@ -637,8 +637,10 @@ IndexingPrivate *dirax_prepare(IndexingMethod *indm, UnitCell *cell, if ( *indm & INDEXING_CHECK_CELL_AXES ) need_cell = 1; if ( need_cell && (cell == NULL) ) { - ERROR("DirAx needs a unit cell for this set of flags.\n"); - return NULL; + ERROR("Altering your DirAx flags because no PDB file was" + " provided.\n"); + *indm &= ~INDEXING_CHECK_CELL_COMBINATIONS; + *indm &= ~INDEXING_CHECK_CELL_AXES; } /* Flags that DirAx knows about */ diff --git a/libcrystfel/src/grainspotter.c b/libcrystfel/src/grainspotter.c index 8bdb03aa..8def8091 100644 --- a/libcrystfel/src/grainspotter.c +++ b/libcrystfel/src/grainspotter.c @@ -482,10 +482,8 @@ IndexingPrivate *grainspotter_prepare(IndexingMethod *indm, UnitCell *cell, if ( gp == NULL ) return NULL; /* Flags that GrainSpotter knows about */ - *indm &= INDEXING_METHOD_MASK | INDEXING_CHECK_PEAKS; - - /* Flags that GrainSpotter requires */ - *indm |= INDEXING_USE_LATTICE_TYPE; + *indm &= INDEXING_METHOD_MASK | INDEXING_CHECK_PEAKS + | INDEXING_USE_LATTICE_TYPE | INDEXING_USE_CELL_PARAMETERS; gp->cell = cell; gp->indm = *indm; diff --git a/libcrystfel/src/index.c b/libcrystfel/src/index.c index 0ab467a6..311dc2ce 100644 --- a/libcrystfel/src/index.c +++ b/libcrystfel/src/index.c @@ -316,6 +316,19 @@ static IndexingMethod set_lattice(IndexingMethod a) } +/* Set the indexer flags for "use no unit cell parameters" */ +static IndexingMethod set_nocellparams(IndexingMethod a) +{ + return a & ~INDEXING_USE_CELL_PARAMETERS; +} + + +/* Set the indexer flags for "use unit cell parameters" */ +static IndexingMethod set_cellparams(IndexingMethod a) +{ + return a | INDEXING_USE_CELL_PARAMETERS; +} + char *indexer_str(IndexingMethod indm) { char *str; @@ -379,6 +392,12 @@ char *indexer_str(IndexingMethod indm) strcat(str, "-nolatt"); } + if ( indm & INDEXING_USE_CELL_PARAMETERS ) { + strcat(str, "-cell"); + } else { + strcat(str, "-nocell"); + } + return str; } @@ -433,6 +452,12 @@ IndexingMethod *build_indexer_list(const char *str) } else if ( strcmp(methods[i], "nolatt") == 0) { list[nmeth] = set_nolattice(list[nmeth]); + } else if ( strcmp(methods[i], "cell") == 0) { + list[nmeth] = set_cellparams(list[nmeth]); + + } else if ( strcmp(methods[i], "nocell") == 0) { + list[nmeth] = set_nocellparams(list[nmeth]); + } else { ERROR("Bad list of indexing methods: '%s'\n", str); return NULL; diff --git a/libcrystfel/src/index.h b/libcrystfel/src/index.h index 94b0d457..f60bb18f 100644 --- a/libcrystfel/src/index.h +++ b/libcrystfel/src/index.h @@ -52,13 +52,16 @@ | INDEXING_USE_LATTICE_TYPE) #define INDEXING_DEFAULTS_REAX (INDEXING_REAX | INDEXING_USE_LATTICE_TYPE \ + | INDEXING_USE_CELL_PARAMETERS \ | INDEXING_CHECK_PEAKS) #define INDEXING_DEFAULTS_GRAINSPOTTER (INDEXING_GRAINSPOTTER \ | INDEXING_USE_LATTICE_TYPE \ + | INDEXING_USE_CELL_PARAMETERS \ | INDEXING_CHECK_PEAKS) #define INDEXING_DEFAULTS_XDS (INDEXING_XDS | INDEXING_USE_LATTICE_TYPE \ + | INDEXING_USE_CELL_PARAMETERS \ | INDEXING_CHECK_PEAKS) /** @@ -87,6 +90,7 @@ typedef enum { INDEXING_CHECK_CELL_AXES = 512, INDEXING_CHECK_PEAKS = 1024, INDEXING_USE_LATTICE_TYPE = 2048, + INDEXING_USE_CELL_PARAMETERS = 4096, } IndexingMethod; diff --git a/libcrystfel/src/mosflm.c b/libcrystfel/src/mosflm.c index a03e621d..187d0c9b 100644 --- a/libcrystfel/src/mosflm.c +++ b/libcrystfel/src/mosflm.c @@ -817,8 +817,11 @@ IndexingPrivate *mosflm_prepare(IndexingMethod *indm, UnitCell *cell, if ( *indm & INDEXING_USE_LATTICE_TYPE ) need_cell = 1; if ( need_cell && (cell == NULL) ) { - ERROR("MOSFLM needs a unit cell for this set of flags.\n"); - return NULL; + ERROR("Altering your MOSFLM flags because no PDB file was" + " provided.\n"); + *indm &= ~INDEXING_CHECK_CELL_COMBINATIONS; + *indm &= ~INDEXING_CHECK_CELL_AXES; + *indm &= ~INDEXING_USE_LATTICE_TYPE; } /* Flags that MOSFLM knows about */ diff --git a/libcrystfel/src/xds.c b/libcrystfel/src/xds.c index 786e2ae0..9660b5bc 100644 --- a/libcrystfel/src/xds.c +++ b/libcrystfel/src/xds.c @@ -577,7 +577,7 @@ IndexingPrivate *xds_prepare(IndexingMethod *indm, UnitCell *cell, /* Flags that XDS knows about */ *indm &= INDEXING_METHOD_MASK | INDEXING_CHECK_CELL_COMBINATIONS | INDEXING_CHECK_CELL_AXES | INDEXING_USE_LATTICE_TYPE - | INDEXING_CHECK_PEAKS; + | INDEXING_CHECK_PEAKS | INDEXING_USE_CELL_PARAMETERS; xp->ltl = ltl; xp->cell = cell; -- cgit v1.2.3