From e2cc5dc49e210b6562529b6a33808a18baade466 Mon Sep 17 00:00:00 2001 From: Thomas White Date: Tue, 30 Mar 2010 10:24:59 +0200 Subject: get_hkl: Read intensities from file if requested --- src/get_hkl.c | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) (limited to 'src/get_hkl.c') 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= Only include reflections mentioned in file.\n" " --poisson Simulate Poisson samples.\n" " --twin Generate twinned data.\n" -" -o --output= Output filename (default: stdout).\n" +" -o, --output= Output filename (default: stdout).\n" " --zone-axis Generate hk0 intensities only (and add\n" " Synth2D-style header.\n" +" -i, --intensities= 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(); -- cgit v1.2.3