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 --- src/check_hkl.c | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) (limited to 'src/check_hkl.c') 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