diff options
author | Thomas White <taw@physics.org> | 2021-03-15 16:53:21 +0100 |
---|---|---|
committer | Thomas White <taw@physics.org> | 2021-03-16 13:59:37 +0100 |
commit | e6c26cfd40f0a372a530380ec8b7817645265681 (patch) | |
tree | 00f883b911c6a7a0f7dcc223aded49c7cccc5fff /src | |
parent | b8ebe9370c6d7df3e2c71665881608bf519276eb (diff) |
get_hkl: Add options to export to MTZ and XDS
Diffstat (limited to 'src')
-rw-r--r-- | src/get_hkl.c | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/src/get_hkl.c b/src/get_hkl.c index ea632cbb..ed3d7c39 100644 --- a/src/get_hkl.c +++ b/src/get_hkl.c @@ -95,6 +95,8 @@ static void show_help(const char *s) "\n" "Don't forget to specify the output filename:\n" " -o, --output=<filename> Output filename (default: stdout).\n" +" --output-format=mtz Output in MTZ format.\n" +" --output-format=xds Output in XDS format.\n" ); } @@ -469,6 +471,7 @@ int main(int argc, char *argv[]) float lowres = 0.0; /* 1/d value */ double highres = INFINITY; /* 1/d value */ UnitCell *cell = NULL; + char *output_format_str = NULL; /* Long options */ const struct option longopts[] = { @@ -491,6 +494,7 @@ int main(int argc, char *argv[]) {"highres", 1, NULL, 3}, {"reindex", 1, NULL, 4}, {"lowres", 1, NULL, 6}, + {"output-format", 1, NULL, 7}, {0, 0, NULL, 0} }; @@ -561,6 +565,10 @@ int main(int argc, char *argv[]) lowres = 1.0/lowres; /* m -> m^-1 */ break; + case 7 : + output_format_str = strdup(optarg); + break; + case 0 : break; @@ -883,7 +891,16 @@ int main(int argc, char *argv[]) } reflist_add_command_and_version(input, argc, argv); /* Yes, really! */ - write_reflist(output, input); + + if ( output_format_str == NULL ) { + write_reflist(output, input); + } else if ( cell == NULL ) { + ERROR("You must provide a unit cell to use MTZ or XDS output.\n"); + } else if ( strcasecmp(output_format_str, "mtz") == 0 ) { + write_to_mtz(input, mero, cell, 0, INFINITY, output, "dataset"); + } else if ( strcasecmp(output_format_str, "xds") == 0 ) { + write_to_xds(input, mero, cell, 0, INFINITY, output); + } reflist_free(input); |