aboutsummaryrefslogtreecommitdiff
path: root/src/pattern_sim.c
diff options
context:
space:
mode:
authorThomas White <taw@physics.org>2012-12-14 11:51:57 +0100
committerThomas White <taw@physics.org>2012-12-14 11:59:23 +0100
commitb22b9de18152c917d4e9f733c41402d9935ae93d (patch)
treece3019e93ef0c40e5d6988956bb1f1b894540847 /src/pattern_sim.c
parente745af481e176834e804b2eec59b7170e260ce81 (diff)
Beam and detector geometry don't need to be copied
The did when this was all done with threads, but with separate processes each worker has its own copy of the structure already. It can be updated after every image and freed at the end.
Diffstat (limited to 'src/pattern_sim.c')
-rw-r--r--src/pattern_sim.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/pattern_sim.c b/src/pattern_sim.c
index 17aa8030..89413a07 100644
--- a/src/pattern_sim.c
+++ b/src/pattern_sim.c
@@ -493,19 +493,21 @@ int main(int argc, char *argv[])
ERROR("Failed to read beam parameters from '%s'\n", beamfile);
return 1;
}
- free(beamfile);
/* Define image parameters */
image.width = image.det->max_fs + 1;
image.height = image.det->max_ss + 1;
- if (image.beam->photon_energy == 0) {
- ERROR("Invalid photon_energy format in beam file\n")
+ if ( image.beam->photon_energy_from != NULL ) {
+ ERROR("Photon energy must be specified, not taken from the"
+ " HDF5 file. Please alter %s accordingly.\n", beamfile)
return 1;
} else {
- image.lambda = ph_en_to_lambda(eV_to_J(image.beam->photon_energy));
+ double wl = ph_en_to_lambda(eV_to_J(image.beam->photon_energy));
+ image.lambda = wl;
}
image.bw = image.beam->bandwidth;
image.div = image.beam->divergence;
+ free(beamfile);
/* Load unit cell */
input_cell = load_cell_from_pdb(filename);