aboutsummaryrefslogtreecommitdiff
path: root/libcrystfel/src/cell-utils.c
diff options
context:
space:
mode:
Diffstat (limited to 'libcrystfel/src/cell-utils.c')
-rw-r--r--libcrystfel/src/cell-utils.c19
1 files changed, 14 insertions, 5 deletions
diff --git a/libcrystfel/src/cell-utils.c b/libcrystfel/src/cell-utils.c
index 5fc885e5..75419c99 100644
--- a/libcrystfel/src/cell-utils.c
+++ b/libcrystfel/src/cell-utils.c
@@ -3,13 +3,13 @@
*
* Unit Cell utility functions
*
- * Copyright © 2012-2014 Deutsches Elektronen-Synchrotron DESY,
+ * Copyright © 2012-2015 Deutsches Elektronen-Synchrotron DESY,
* a research centre of the Helmholtz Association.
* Copyright © 2012 Lorenzo Galli
*
* Authors:
- * 2009-2012,2014 Thomas White <taw@physics.org>
- * 2012 Lorenzo Galli
+ * 2009-2012,2014-2015 Thomas White <taw@physics.org>
+ * 2012 Lorenzo Galli
*
* This file is part of CrystFEL.
*
@@ -606,10 +606,12 @@ UnitCell *match_cell(UnitCell *cell_in, UnitCell *template_in, int verbose,
/* "Un-center" the template unit cell to make the comparison easier */
template = uncenter_cell(template_in, &uncentering);
+ if ( template == NULL ) return NULL;
/* The candidate cell is also uncentered, because it might be centered
* if it came from (e.g.) MOSFLM */
cell = uncenter_cell(cell_in, NULL);
+ if ( cell == NULL ) return NULL;
if ( cell_get_reciprocal(template, &asx, &asy, &asz,
&bsx, &bsy, &bsz,
@@ -1090,8 +1092,9 @@ static void determine_lattice(UnitCell *cell,
/**
* load_cell_from_pdb:
+ * @filename: The filename from which to load the cell
*
- * Loads a unit cell from a PDB file.
+ * Loads a unit cell from the CRYST1 line of a PDB file.
*
* Returns: a newly allocated %UnitCell.
*
@@ -1161,7 +1164,12 @@ UnitCell *load_cell_from_pdb(const char *filename)
fclose(fh);
- validate_cell(cell);
+ if ( cell != NULL ) {
+ validate_cell(cell);
+ } else {
+ ERROR("Failed to load cell from %s\n", filename);
+ }
+
return cell;
}
@@ -1225,6 +1233,7 @@ static int get_angle_rad(char **bits, int nbits, double *pl)
/**
* load_cell_from_file:
+ * @filename: The filename from which to load the cell
*
* Loads a unit cell from a file of any type (PDB or CrystFEL format)
*