From b36b1aeb7356c18fc9de1441fa225953856fe7c4 Mon Sep 17 00:00:00 2001 From: Thomas White Date: Fri, 5 Oct 2012 17:42:15 +0200 Subject: compare_hkl: Add --shell-file, update documentation --- src/compare_hkl.c | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/compare_hkl.c b/src/compare_hkl.c index e25b4746..c6f46be4 100644 --- a/src/compare_hkl.c +++ b/src/compare_hkl.c @@ -86,6 +86,7 @@ static void show_help(const char *s) " CCF, CCI, CCFstar, CCIstar.\n" " --nshells= Use resolution shells.\n" " -u Force scale factor to 1.\n" +" --shell-file= Write resolution shells to .\n" "\n" "You can control which reflections are included in the calculation:\n" "\n" @@ -316,7 +317,7 @@ static double fom_shell(struct fom_context *fctx, int i) static void do_fom(RefList *list1, RefList *list2, UnitCell *cell, double rmin, double rmax, enum fom fom, - int config_unity, int nshells) + int config_unity, int nshells, const char *filename) { int *cts; double *rmins; @@ -436,9 +437,9 @@ static void do_fom(RefList *list1, RefList *list2, UnitCell *cell, } - fh = fopen("shells.dat", "w"); + fh = fopen(filename, "w"); if ( fh == NULL ) { - ERROR("Couldn't open 'shells.dat'\n"); + ERROR("Couldn't open '%s'\n", filename); return; } @@ -530,6 +531,7 @@ int main(int argc, char *argv[]) int config_zeronegs = 0; int config_unity = 0; int nshells = 10; + char *shell_file = NULL; /* Long options */ const struct option longopts[] = { @@ -541,6 +543,7 @@ int main(int argc, char *argv[]) {"fom", 1, NULL, 4}, {"sigma-cutoff", 1, NULL, 5}, {"nshells", 1, NULL, 6}, + {"shell-file", 1, NULL, 7}, {"ignore-negs", 0, &config_ignorenegs, 1}, {"zero-negs", 0, &config_zeronegs, 1}, {0, 0, NULL, 0} @@ -604,6 +607,10 @@ int main(int argc, char *argv[]) } break; + case 7 : + shell_file = strdup(optarg); + break; + default : ERROR("Unhandled option '%c'\n", c); break; @@ -652,6 +659,8 @@ int main(int argc, char *argv[]) exit(1); } + if ( shell_file == NULL ) shell_file = strdup("shells.dat"); + cell = load_cell_from_pdb(pdb); free(pdb); @@ -812,8 +821,9 @@ int main(int argc, char *argv[]) reflist_free(list2); do_fom(list1_acc, list2_acc, cell, rmin, rmax, fom, config_unity, - nshells); + nshells, shell_file); + free(shell_file); reflist_free(list1_acc); reflist_free(list2_acc); -- cgit v1.2.3