diff options
author | Thomas White <taw@physics.org> | 2020-07-06 16:27:20 +0200 |
---|---|---|
committer | Thomas White <taw@physics.org> | 2020-07-29 18:53:45 +0200 |
commit | 25055d3547683604f507c5453781db2723be97c7 (patch) | |
tree | 8fc9758eefd1c8ef27ddb5e40f83f2ca9acebc9b /libcrystfel/src/cell-utils.c | |
parent | ce12bf3b6739a7a149f2cbed62951240dd536cab (diff) |
Add cell_print_oneline
Diffstat (limited to 'libcrystfel/src/cell-utils.c')
-rw-r--r-- | libcrystfel/src/cell-utils.c | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/libcrystfel/src/cell-utils.c b/libcrystfel/src/cell-utils.c index d5662971..482ea111 100644 --- a/libcrystfel/src/cell-utils.c +++ b/libcrystfel/src/cell-utils.c @@ -256,6 +256,48 @@ void cell_print(UnitCell *cell) } +void cell_print_oneline(UnitCell *cell) +{ + LatticeType lt; + char cen; + + if ( cell == NULL ) { + STATUS("(NULL cell)\n"); + return; + } + + lt = cell_get_lattice_type(cell); + cen = cell_get_centering(cell); + + STATUS("%s %c", str_lattice(lt), cen); + + if ( (lt==L_MONOCLINIC) || (lt==L_TETRAGONAL) || ( lt==L_HEXAGONAL) + || ( (lt==L_ORTHORHOMBIC) && (cen=='A') ) + || ( (lt==L_ORTHORHOMBIC) && (cen=='B') ) + || ( (lt==L_ORTHORHOMBIC) && (cen=='C') ) ) + { + STATUS(", unique axis %c", cell_get_unique_axis(cell)); + } + + if ( cell_has_parameters(cell) ) { + + double a, b, c, alpha, beta, gamma; + + if ( !right_handed(cell) ) { + STATUS(" (left handed)"); + } + + cell_get_parameters(cell, &a, &b, &c, &alpha, &beta, &gamma); + + STATUS(" %.2f %.2f %.2f A, %.2f %.2f %.2f deg\n", + a*1e10, b*1e10, c*1e10, + rad2deg(alpha), rad2deg(beta), rad2deg(gamma)); + } else { + STATUS(", no cell parameters.\n"); + } +} + + void cell_print_full(UnitCell *cell) { cell_print(cell); |