aboutsummaryrefslogtreecommitdiff
path: root/src/process_hkl.c
diff options
context:
space:
mode:
authorThomas White <taw@physics.org>2009-12-02 14:34:41 +0100
committerThomas White <taw@physics.org>2009-12-02 14:36:22 +0100
commit2dae60bc60798c2f44d8e0577ca27767d8e5ed4b (patch)
tree65d84bc9c3718ee0a17e86c0154b943a218a3948 /src/process_hkl.c
parent6ee719ca5d1cdbf63883c06a7d64b11622807c59 (diff)
Add --output-every (-e) option
Diffstat (limited to 'src/process_hkl.c')
-rw-r--r--src/process_hkl.c19
1 files changed, 16 insertions, 3 deletions
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=<n> 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);
}