aboutsummaryrefslogtreecommitdiff
path: root/src/get_hkl.c
diff options
context:
space:
mode:
authorThomas White <taw@physics.org>2010-03-30 10:24:59 +0200
committerThomas White <taw@physics.org>2010-03-30 10:39:47 +0200
commite2cc5dc49e210b6562529b6a33808a18baade466 (patch)
tree56b14df5d5e4f8777b9011c15d0efee8357dc693 /src/get_hkl.c
parent2059ec75d956d1a1a63f4e215de3986502600623 (diff)
get_hkl: Read intensities from file if requested
Diffstat (limited to 'src/get_hkl.c')
-rw-r--r--src/get_hkl.c20
1 files changed, 17 insertions, 3 deletions
diff --git a/src/get_hkl.c b/src/get_hkl.c
index 5e27f2a1..1b69199f 100644
--- a/src/get_hkl.c
+++ b/src/get_hkl.c
@@ -37,9 +37,11 @@ static void show_help(const char *s)
" -t, --template=<filename> Only include reflections mentioned in file.\n"
" --poisson Simulate Poisson samples.\n"
" --twin Generate twinned data.\n"
-" -o --output=<filename> Output filename (default: stdout).\n"
+" -o, --output=<filename> Output filename (default: stdout).\n"
" --zone-axis Generate hk0 intensities only (and add\n"
" Synth2D-style header.\n"
+" -i, --intensities=<file> Read intensities from file instead of\n"
+" calculating them from scratch.\n"
);
}
@@ -110,6 +112,7 @@ int main(int argc, char *argv[])
char *output = NULL;
unsigned int *counts;
unsigned int *cts;
+ char *input = NULL;
signed int h, k, l;
/* Long options */
@@ -120,11 +123,12 @@ int main(int argc, char *argv[])
{"output", 1, NULL, 'o'},
{"twin", 0, &config_twin, 1},
{"zone-axis", 0, &config_za, 1},
+ {"intensities", 1, NULL, 'i'},
{0, 0, NULL, 0}
};
/* Short options */
- while ((c = getopt_long(argc, argv, "ht:o:", longopts, NULL)) != -1) {
+ while ((c = getopt_long(argc, argv, "ht:o:i:", longopts, NULL)) != -1) {
switch (c) {
case 'h' : {
@@ -142,6 +146,11 @@ int main(int argc, char *argv[])
break;
}
+ case 'i' : {
+ input = strdup(optarg);
+ break;
+ }
+
case 0 : {
break;
}
@@ -155,7 +164,12 @@ int main(int argc, char *argv[])
mol = load_molecule();
cts = new_list_count();
- ideal_ref = get_reflections(mol, eV_to_J(1790.0), 1/(0.6e-9), cts);
+ if ( input == NULL ) {
+ ideal_ref = get_reflections(mol, eV_to_J(1790.0), 1/(0.6e-9), cts);
+ } else {
+ ideal_ref = read_reflections(input, cts);
+ free(input);
+ }
counts = new_list_count();