From 0211dd487cf8d4f3815273d993838cd8369a9f83 Mon Sep 17 00:00:00 2001 From: Thomas White Date: Wed, 20 Oct 2021 15:28:19 +0200 Subject: Add "plain" MTZ file layout, distinct from "Bijvoet" layout Closes: https://gitlab.desy.de/thomas.white/crystfel/-/issues/52 --- src/get_hkl.c | 21 +++++++++++++++++---- src/gui_export.c | 9 +++++++-- 2 files changed, 24 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/get_hkl.c b/src/get_hkl.c index e80383e5..82bf5815 100644 --- a/src/get_hkl.c +++ b/src/get_hkl.c @@ -94,9 +94,10 @@ static void show_help(const char *s) " equivalent reflections.\n" "\n" "Don't forget to specify the output filename:\n" -" -o, --output= Output filename (default: stdout).\n" -" --output-format=mtz Output in MTZ format.\n" -" --output-format=xds Output in XDS format.\n" +" -o, --output= Output filename (default: stdout).\n" +" --output-format=mtz Output in MTZ format.\n" +" --output-format=mtz-bij Output in MTZ format, Bijvoet pairs together\n" +" --output-format=xds Output in XDS format.\n" ); } @@ -916,7 +917,19 @@ int main(int argc, char *argv[]) r = 1; } else { r = write_to_mtz(input, mero, cell, 0, INFINITY, output, - "dataset", "crystal", "project"); + "dataset", "crystal", "project", 0); + } + } else if ( strcasecmp(output_format_str, "mtz-bij") == 0 ) { + if ( !libcrystfel_can_write_mtz() ) { + ERROR("Sorry, this version of CrystFEL was compiled " + "without MTZ support (libccp4 is required)\n"); + r = 1; + } else if ( output == NULL ) { + ERROR("You must provide the MTZ output filename.\n"); + r = 1; + } else { + r = write_to_mtz(input, mero, cell, 0, INFINITY, output, + "dataset", "crystal", "project", 1); } } else if ( strcasecmp(output_format_str, "xds") == 0 ) { if ( output == NULL ) { diff --git a/src/gui_export.c b/src/gui_export.c index 44a6ffc1..b0aef972 100644 --- a/src/gui_export.c +++ b/src/gui_export.c @@ -87,7 +87,8 @@ static int export_to_xds(struct gui_merge_result *result, static int export_to_mtz(struct gui_merge_result *result, const char *filename, UnitCell *cell, - double min_res, double max_res) + double min_res, double max_res, + int bij) { RefList *reflist; char *sym_str; @@ -174,7 +175,9 @@ static int export_data(struct export_window *win, char *filename) min_res, max_res); if ( strcmp(format, "mtz") == 0 ) { - r = export_to_mtz(result, filename, cell, min_res, max_res); + r = export_to_mtz(result, filename, cell, min_res, max_res, 0); + } else if ( strcmp(format, "mtz-bij") == 0 ) { + r = export_to_mtz(result, filename, cell, min_res, max_res, 1); } else if ( strcmp(format, "xds") == 0 ) { r = export_to_xds(result, filename, cell, min_res, max_res); } else { @@ -264,6 +267,8 @@ gint export_sig(GtkWidget *widget, struct crystfelproject *proj) if ( libcrystfel_can_write_mtz() ) { gtk_combo_box_text_append(GTK_COMBO_BOX_TEXT(win->format), "mtz", "MTZ"); + gtk_combo_box_text_append(GTK_COMBO_BOX_TEXT(win->format), "mtz-bij", + "MTZ, Bijvoet pairs together"); } gtk_combo_box_text_append(GTK_COMBO_BOX_TEXT(win->format), "xds", "XDS ASCII"); -- cgit v1.2.3