aboutsummaryrefslogtreecommitdiff
path: root/libcrystfel/src/cell-utils.c
diff options
context:
space:
mode:
authorThomas White <taw@physics.org>2017-09-22 11:31:45 +0200
committerThomas White <taw@physics.org>2017-09-22 11:31:45 +0200
commit0ef5b571d3acfc24e7234d8b41905ae5440efe10 (patch)
treeaa3d3343c14a279e5bfe7b825b21f2902b48d635 /libcrystfel/src/cell-utils.c
parent9f265dd89b1fbb1db5f0d5998a85eebc5514ed5b (diff)
Don't write cell parameters to the stream if we don't have them
Diffstat (limited to 'libcrystfel/src/cell-utils.c')
-rw-r--r--libcrystfel/src/cell-utils.c17
1 files changed, 10 insertions, 7 deletions
diff --git a/libcrystfel/src/cell-utils.c b/libcrystfel/src/cell-utils.c
index 41436bb4..5465052c 100644
--- a/libcrystfel/src/cell-utils.c
+++ b/libcrystfel/src/cell-utils.c
@@ -1258,13 +1258,16 @@ void write_cell(UnitCell *cell, FILE *fh)
fprintf(fh, "unique_axis = %c\n", cell_get_unique_axis(cell));
}
fprintf(fh, "centering = %c\n", cell_get_centering(cell));
- cell_get_parameters(cell, &a, &b, &c, &al, &be, &ga);
- fprintf(fh, "a = %.2f A\n", a*1e10);
- fprintf(fh, "b = %.2f A\n", b*1e10);
- fprintf(fh, "c = %.2f A\n", c*1e10);
- fprintf(fh, "al = %.2f deg\n", rad2deg(al));
- fprintf(fh, "be = %.2f deg\n", rad2deg(be));
- fprintf(fh, "ga = %.2f deg\n", rad2deg(ga));
+
+ if ( cell_has_parameters(cell) ) {
+ cell_get_parameters(cell, &a, &b, &c, &al, &be, &ga);
+ fprintf(fh, "a = %.2f A\n", a*1e10);
+ fprintf(fh, "b = %.2f A\n", b*1e10);
+ fprintf(fh, "c = %.2f A\n", c*1e10);
+ fprintf(fh, "al = %.2f deg\n", rad2deg(al));
+ fprintf(fh, "be = %.2f deg\n", rad2deg(be));
+ fprintf(fh, "ga = %.2f deg\n", rad2deg(ga));
+ }
}