aboutsummaryrefslogtreecommitdiff
path: root/libcrystfel
diff options
context:
space:
mode:
authorThomas White <taw@physics.org>2020-07-06 16:27:20 +0200
committerThomas White <taw@physics.org>2020-07-29 18:53:45 +0200
commit25055d3547683604f507c5453781db2723be97c7 (patch)
tree8fc9758eefd1c8ef27ddb5e40f83f2ca9acebc9b /libcrystfel
parentce12bf3b6739a7a149f2cbed62951240dd536cab (diff)
Add cell_print_oneline
Diffstat (limited to 'libcrystfel')
-rw-r--r--libcrystfel/src/cell-utils.c42
-rw-r--r--libcrystfel/src/cell-utils.h1
2 files changed, 43 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);
diff --git a/libcrystfel/src/cell-utils.h b/libcrystfel/src/cell-utils.h
index 05618385..e98c8da2 100644
--- a/libcrystfel/src/cell-utils.h
+++ b/libcrystfel/src/cell-utils.h
@@ -57,6 +57,7 @@ extern UnitCell *rotate_cell(UnitCell *in, double omega, double phi,
double rot);
extern void cell_print(UnitCell *cell);
+extern void cell_print_oneline(UnitCell *cell);
extern void cell_print_full(UnitCell *cell);
extern UnitCell *load_cell_from_pdb(const char *filename);