From 0ef5b571d3acfc24e7234d8b41905ae5440efe10 Mon Sep 17 00:00:00 2001 From: Thomas White Date: Fri, 22 Sep 2017 11:31:45 +0200 Subject: Don't write cell parameters to the stream if we don't have them --- libcrystfel/src/cell-utils.c | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) (limited to 'libcrystfel') 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)); + } } -- cgit v1.2.3