/* * reflections.c * * Utilities for handling reflections * * (c) 2006-2010 Thomas White * * Part of CrystFEL - crystallography with a FEL * */ #include #include #include #include #include #include "utils.h" #include "cell.h" #include "reflections.h" void write_reflections(const char *filename, unsigned int *counts, double *ref, int zone_axis, UnitCell *cell) { FILE *fh; signed int h, k, l; if ( filename == NULL ) { fh = stdout; } else { fh = fopen(filename, "w"); } if ( fh == NULL ) { ERROR("Couldn't open output file!\n"); return; } /* Write spacings and angle if zone axis pattern */ if ( zone_axis ) { double a, b, c, alpha, beta, gamma; cell_get_parameters(cell, &a, &b, &c, &alpha, &beta, &gamma); fprintf(fh, "a %5.3f nm\n", a*1e9); fprintf(fh, "b %5.3f nm\n", b*1e9); fprintf(fh, "angle %5.3f deg\n", rad2deg(gamma)); fprintf(fh, "scale 10\n"); } for ( h=-INDMAX; h