aboutsummaryrefslogtreecommitdiff
path: root/libcrystfel
diff options
context:
space:
mode:
authorThomas White <taw@physics.org>2017-09-22 11:13:30 +0200
committerThomas White <taw@physics.org>2017-09-22 11:13:30 +0200
commit9f265dd89b1fbb1db5f0d5998a85eebc5514ed5b (patch)
tree31369e68ab5224d6d157d1b079ec6237a8dd4584 /libcrystfel
parent855be9e57a660473ae43a189d6e8f2cb792321b3 (diff)
If no cell params or lattice type, set nocell/nolatt at top level
Another thing that the indexing engines don't need to be repsonsible for.
Diffstat (limited to 'libcrystfel')
-rw-r--r--libcrystfel/src/dirax.c11
-rw-r--r--libcrystfel/src/index.c33
-rw-r--r--libcrystfel/src/mosflm.c16
-rw-r--r--libcrystfel/src/xds.c19
4 files changed, 30 insertions, 49 deletions
diff --git a/libcrystfel/src/dirax.c b/libcrystfel/src/dirax.c
index ecf8a4fd..764a6be1 100644
--- a/libcrystfel/src/dirax.c
+++ b/libcrystfel/src/dirax.c
@@ -605,17 +605,6 @@ void *dirax_prepare(IndexingMethod *indm, UnitCell *cell,
struct detector *det, float *ltl)
{
struct dirax_private *dp;
- int need_cell = 0;
-
- if ( *indm & INDEXING_CHECK_CELL_COMBINATIONS ) need_cell = 1;
- if ( *indm & INDEXING_CHECK_CELL_AXES ) need_cell = 1;
-
- if ( need_cell && !cell_has_parameters(cell) ) {
- ERROR("Altering your DirAx flags because cell parameters were"
- " not provided.\n");
- *indm &= ~INDEXING_CHECK_CELL_COMBINATIONS;
- *indm &= ~INDEXING_CHECK_CELL_AXES;
- }
/* Flags that DirAx knows about */
*indm &= INDEXING_METHOD_MASK;
diff --git a/libcrystfel/src/index.c b/libcrystfel/src/index.c
index 17153976..3e50b664 100644
--- a/libcrystfel/src/index.c
+++ b/libcrystfel/src/index.c
@@ -301,6 +301,9 @@ IndexingPrivate *setup_indexing(const char *method_list, UnitCell *cell,
}
if ( cell == NULL ) {
+
+ int warn = 0;
+
if ( (flags & INDEXING_CHECK_CELL_COMBINATIONS)
|| (flags & INDEXING_CHECK_CELL_COMBINATIONS) )
{
@@ -310,6 +313,33 @@ IndexingPrivate *setup_indexing(const char *method_list, UnitCell *cell,
flags &= ~INDEXING_CHECK_CELL_COMBINATIONS;
flags &= ~INDEXING_CHECK_CELL_AXES;
}
+
+ for ( i=0; i<n; i++ ) {
+ if ( methods[i] & INDEXING_USE_LATTICE_TYPE ) {
+ methods[i] &= ~INDEXING_USE_LATTICE_TYPE;
+ warn = 1;
+ }
+ }
+ if ( warn ) {
+ ERROR("WARNING: Forcing all indexing methods to use "
+ "\"-nolatt\", because reference Bravais lattice "
+ "type was not given.\n");
+ }
+ }
+
+ if ( !cell_has_parameters(cell) ) {
+ int warn = 0;
+ for ( i=0; i<n; i++ ) {
+ if ( methods[i] & INDEXING_USE_CELL_PARAMETERS ) {
+ methods[i] &= ~INDEXING_USE_CELL_PARAMETERS;
+ warn = 1;
+ }
+ }
+ if ( warn ) {
+ ERROR("WARNING: Forcing all indexing methods to use "
+ "\"-nocell\", because reference cell parameters "
+ "were not given.\n");
+ }
}
ipriv = malloc(sizeof(struct _indexingprivate));
@@ -332,9 +362,6 @@ IndexingPrivate *setup_indexing(const char *method_list, UnitCell *cell,
for ( j=0; j<i; j++ ) {
if ( methods[i] == methods[j] ) {
ERROR("Duplicate indexing method.\n");
- ERROR("Have you specified some flags which "
- "aren't accepted by one of your "
- "chosen indexing methods?\n");
return NULL;
}
}
diff --git a/libcrystfel/src/mosflm.c b/libcrystfel/src/mosflm.c
index 110243cb..262f20b2 100644
--- a/libcrystfel/src/mosflm.c
+++ b/libcrystfel/src/mosflm.c
@@ -822,22 +822,6 @@ void *mosflm_prepare(IndexingMethod *indm, UnitCell *cell,
struct detector *det, float *ltl)
{
struct mosflm_private *mp;
- int need_cell = 0;
-
- /* Check if cell parameters are needed/provided */
- if ( *indm & INDEXING_USE_CELL_PARAMETERS ) need_cell = 1;
- if ( need_cell && !cell_has_parameters(cell) ) {
- ERROR("Altering your MOSFLM flags because cell parameters were"
- " not provided.\n");
- *indm &= ~INDEXING_USE_CELL_PARAMETERS;
- }
-
- /* Check if lattice type information is needed/provided */
- if ( (*indm & INDEXING_USE_LATTICE_TYPE) && (cell == NULL) ) {
- ERROR("Altering your MOSFLM flags because lattice type "
- "information was not provided.\n");
- *indm &= ~INDEXING_USE_LATTICE_TYPE;
- }
/* Flags that MOSFLM knows about */
*indm &= INDEXING_METHOD_MASK
diff --git a/libcrystfel/src/xds.c b/libcrystfel/src/xds.c
index 646561ca..e6309eb6 100644
--- a/libcrystfel/src/xds.c
+++ b/libcrystfel/src/xds.c
@@ -597,30 +597,11 @@ void *xds_prepare(IndexingMethod *indm, UnitCell *cell,
struct detector *det, float *ltl)
{
struct xds_private *xp;
- int need_cell = 0;
-
- /* Check if cell parameters are needed/provided */
- if ( *indm & INDEXING_USE_CELL_PARAMETERS ) need_cell = 1;
- if ( need_cell && !cell_has_parameters(cell) ) {
- ERROR("Altering your XDS flags because cell parameters were"
- " not provided.\n");
- *indm &= ~INDEXING_USE_CELL_PARAMETERS;
- }
/* Either cell,latt and cell provided, or nocell-nolatt and no cell
* - complain about anything else. Could figure this out automatically,
* but we'd have to decide whether the user just forgot the cell, or
* forgot "-nolatt", or whatever. */
- if ( ((*indm & INDEXING_USE_LATTICE_TYPE)
- || (*indm & INDEXING_USE_CELL_PARAMETERS))
- && !cell_has_parameters(cell) )
- {
- ERROR("No cell parameters provided. If you wanted to use XDS "
- "without prior cell information, use "
- "xds-nolatt-nocell.\n");
- return NULL;
- }
-
if ( (*indm & INDEXING_USE_LATTICE_TYPE)
&& !(*indm & INDEXING_USE_CELL_PARAMETERS) )
{