aboutsummaryrefslogtreecommitdiff
path: root/src/partial_sim.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/partial_sim.c')
-rw-r--r--src/partial_sim.c46
1 files changed, 32 insertions, 14 deletions
diff --git a/src/partial_sim.c b/src/partial_sim.c
index c5084955..2f0a0277 100644
--- a/src/partial_sim.c
+++ b/src/partial_sim.c
@@ -3,11 +3,11 @@
*
* Generate partials for testing scaling
*
- * Copyright © 2012-2016 Deutsches Elektronen-Synchrotron DESY,
+ * Copyright © 2012-2017 Deutsches Elektronen-Synchrotron DESY,
* a research centre of the Helmholtz Association.
*
* Authors:
- * 2011-2016 Thomas White <taw@physics.org>
+ * 2011-2017 Thomas White <taw@physics.org>
* 2014 Valerio Mariani
*
* This file is part of CrystFEL.
@@ -763,23 +763,35 @@ int main(int argc, char *argv[])
}
fixup_geom(det);
- if ( sym_str == NULL ) sym_str = strdup("1");
- sym = get_pointgroup(sym_str);
- free(sym_str);
-
if ( save_file == NULL ) save_file = strdup("partial_sim.hkl");
/* Load (full) reflections */
if ( input_file != NULL ) {
RefList *as;
+ char *sym_str_fromfile = NULL;
- full = read_reflections(input_file);
+ full = read_reflections_2(input_file, &sym_str_fromfile);
if ( full == NULL ) {
ERROR("Failed to read reflections from '%s'\n",
input_file);
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 ( check_list_symmetry(full, sym) ) {
ERROR("The input reflection list does not appear to"
" have symmetry %s\n", symmetry_name(sym));
@@ -798,6 +810,8 @@ int main(int argc, char *argv[])
} else {
random_intensities = 1;
+ if ( sym_str == NULL ) sym_str = strdup("1");
+ sym = get_pointgroup(sym_str);
}
if ( n < 1 ) {
@@ -852,10 +866,11 @@ int main(int argc, char *argv[])
noise_stddev);
if ( random_intensities ) {
STATUS(" Full intensities: randomly generated: "
- "abs(Gaussian(sigma=%.2f))\n", full_stddev);
+ "abs(Gaussian(sigma=%.2f)), symmetry %s\n",
+ full_stddev, sym_str);
} else {
- STATUS(" Full intensities: from %s\n",
- input_file);
+ STATUS(" Full intensities: from %s (symmetry %s)\n",
+ input_file, sym_str);
}
STATUS(" Max error in cell components: %.2f %%\n", cnoise);
@@ -902,10 +917,13 @@ int main(int argc, char *argv[])
for ( i=0; i<n_threads; i++ ) {
unsigned long int seed;
-
- fread(&seed, sizeof(seed), 1, fh);
qargs.rngs[i] = gsl_rng_alloc(gsl_rng_mt19937);
- gsl_rng_set(qargs.rngs[i], seed);
+
+ if ( fread(&seed, sizeof(seed), 1, fh) == 1 ) {
+ gsl_rng_set(qargs.rngs[i], seed);
+ } else {
+ ERROR("Failed to seed RNG %i\n", i);
+ }
}
@@ -931,7 +949,7 @@ int main(int argc, char *argv[])
if ( random_intensities ) {
STATUS("Writing full intensities to %s\n", save_file);
- write_reflist(save_file, full);
+ write_reflist_2(save_file, full, sym);
}
if ( phist_file != NULL ) {