From 2dae60bc60798c2f44d8e0577ca27767d8e5ed4b Mon Sep 17 00:00:00 2001 From: Thomas White Date: Wed, 2 Dec 2009 14:34:41 +0100 Subject: Add --output-every (-e) option --- src/process_hkl.c | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) (limited to 'src/process_hkl.c') diff --git a/src/process_hkl.c b/src/process_hkl.c index f1325e06..58ad03d5 100644 --- a/src/process_hkl.c +++ b/src/process_hkl.c @@ -42,7 +42,8 @@ static void show_help(const char *s) " --max-only Take the integrated intensity to be equal to the\n" " maximum intensity measured for that reflection.\n" " The default is to use the mean value from all\n" -" measurements.\n"); +" measurements.\n" +" -e, --output-every= Analyse figures of merit after every n patterns.\n"); } @@ -204,17 +205,19 @@ int main(int argc, char *argv[]) char *rval; struct molecule *mol; int config_maxonly = 0; + int config_every = 1000; /* Long options */ const struct option longopts[] = { {"help", 0, NULL, 'h'}, {"input", 1, NULL, 'i'}, {"max-only", 0, &config_maxonly, 1}, + {"output-every", 1, NULL, 'e'}, {0, 0, NULL, 0} }; /* Short options */ - while ((c = getopt_long(argc, argv, "hi:", longopts, NULL)) != -1) { + while ((c = getopt_long(argc, argv, "hi:e:", longopts, NULL)) != -1) { switch (c) { case 'h' : { @@ -227,6 +230,11 @@ int main(int argc, char *argv[]) break; } + case 'e' : { + config_every = atoi(optarg); + break; + } + case 0 : { break; } @@ -243,6 +251,11 @@ int main(int argc, char *argv[]) return 1; } + if ( config_every <= 0 ) { + ERROR("Invalid value for --output-every.\n"); + return 1; + } + mol = load_molecule(); get_reflections_cached(mol, eV_to_J(2.0e3)); @@ -271,7 +284,7 @@ int main(int argc, char *argv[]) rval = fgets(line, 1023, fh); if ( strncmp(line, "New pattern", 11) == 0 ) { n_patterns++; - if ( n_patterns % 1000 == 0 ) { + if ( n_patterns % config_every == 0 ) { process_reflections(ref, trueref, counts, n_patterns, mol->cell); } -- cgit v1.2.3