From 0699322f993df4319f09af717ee6cd3c1038d6a0 Mon Sep 17 00:00:00 2001 From: Thomas White Date: Thu, 19 Oct 2017 13:39:33 +0200 Subject: pattern_sim: Use symmetry from file --- src/pattern_sim.c | 26 ++++++++++++++++++++------ 1 file changed, 20 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/pattern_sim.c b/src/pattern_sim.c index 347dd618..ca7862da 100644 --- a/src/pattern_sim.c +++ b/src/pattern_sim.c @@ -633,11 +633,6 @@ int main(int argc, char *argv[]) free(template_file); } - if ( sym_str == NULL ) sym_str = strdup("1"); - pointgroup_warning(sym_str); - sym = get_pointgroup(sym_str); - /* sym_str is used below */ - if ( grad_str == NULL ) { STATUS("You didn't specify a gradient calculation method, so" " I'm using the 'mosaic' method, which is fastest.\n"); @@ -720,16 +715,35 @@ int main(int argc, char *argv[]) phases = NULL; flags = NULL; + if ( sym_str == NULL ) sym_str = strdup("1"); + pointgroup_warning(sym_str); + sym = get_pointgroup(sym_str); + } else { RefList *reflections; + char *sym_str_fromfile = NULL; - reflections = read_reflections(intfile); + reflections = read_reflections_2(intfile, &sym_str_fromfile); if ( reflections == NULL ) { ERROR("Problem reading input file %s\n", intfile); return 1; } + /* If we don't have a point group yet, and if the file provides + * one, use the one from the file */ + if ( (sym_str == NULL) && (sym_str_fromfile != NULL) ) { + sym_str = sym_str_fromfile; + STATUS("Using symmetry from reflection file: %s\n", + sym_str); + } + + /* If we still don't have a point group, use "1" */ + if ( sym_str == NULL ) sym_str = strdup("1"); + + pointgroup_warning(sym_str); + sym = get_pointgroup(sym_str); + if ( grad == GRADIENT_PHASED ) { phases = phases_from_list(reflections); } else { -- cgit v1.2.3