From 1958c15d63555cc5c17f26a586e39d6d00dbcaca Mon Sep 17 00:00:00 2001 From: Thomas White Date: Wed, 6 Nov 2013 17:07:46 +0100 Subject: check_hkl: Add --shell-file --- doc/man/check_hkl.1 | 5 +++++ src/check_hkl.c | 17 ++++++++++++++--- 2 files changed, 19 insertions(+), 3 deletions(-) diff --git a/doc/man/check_hkl.1 b/doc/man/check_hkl.1 index 39dd97ac..a0c77566 100644 --- a/doc/man/check_hkl.1 +++ b/doc/man/check_hkl.1 @@ -46,6 +46,11 @@ Fix the lower resolution limit for the resolutions shells, as 1/d in m^-1. .PD Fix the upper resolution limit for the resolutions shells, as 1/d in m^-1. +.PD 0 +.IP \fB--shell-file=\fR\fIfilename\fR +.PD +Write the statistics in resolution shells to \fIfilename\fR. + .SH AUTHOR This page was written by Thomas White. diff --git a/src/check_hkl.c b/src/check_hkl.c index 71f107da..c2ab0788 100644 --- a/src/check_hkl.c +++ b/src/check_hkl.c @@ -59,12 +59,14 @@ static void show_help(const char *s) " --rmax= Fix upper resolution limit for resolution shells. (m^-1).\n" " --sigma-cutoff= Discard reflections with I/sigma(I) < n.\n" " --nshells= Use resolution shells.\n" +" --shell-file= Write resolution shells to .\n" "\n"); } static void plot_shells(RefList *list, UnitCell *cell, const SymOpList *sym, - double rmin_fix, double rmax_fix, int nshells) + double rmin_fix, double rmax_fix, int nshells, + const char *shell_file) { int *possible; unsigned int *measurements; @@ -127,7 +129,7 @@ static void plot_shells(RefList *list, UnitCell *cell, const SymOpList *sym, return; } - fh = fopen("shells.dat", "w"); + fh = fopen(shell_file, "w"); if ( fh == NULL ) { ERROR("Couldn't open 'shells.dat'\n"); return; @@ -371,6 +373,7 @@ int main(int argc, char *argv[]) float rmax_fix = -1.0; float sigma_cutoff = -INFINITY; int nshells = 10; + char *shell_file = NULL; /* Long options */ const struct option longopts[] = { @@ -381,6 +384,7 @@ int main(int argc, char *argv[]) {"rmax", 1, NULL, 3}, {"sigma-cutoff", 1, NULL, 4}, {"nshells", 1, NULL, 5}, + {"shell-file", 1, NULL, 6}, {0, 0, NULL, 0} }; @@ -432,6 +436,10 @@ int main(int argc, char *argv[]) } break; + case 6 : + shell_file = strdup(optarg); + break; + case '?' : break; @@ -470,6 +478,8 @@ int main(int argc, char *argv[]) } free(file); + if ( shell_file == NULL ) shell_file = strdup("shells.dat"); + /* Check that the intensities have the correct symmetry */ if ( check_list_symmetry(raw_list, sym) ) { ERROR("The input reflection list does not appear to" @@ -508,11 +518,12 @@ int main(int argc, char *argv[]) rej, num_reflections(raw_list), sigma_cutoff); reflist_free(raw_list); - plot_shells(list, cell, sym, rmin_fix, rmax_fix, nshells); + plot_shells(list, cell, sym, rmin_fix, rmax_fix, nshells, shell_file); free_symoplist(sym); reflist_free(list); cell_free(cell); + free(shell_file); return 0; } -- cgit v1.2.3