aboutsummaryrefslogtreecommitdiff
path: root/src/main.c
diff options
context:
space:
mode:
authorThomas White <taw@physics.org>2009-11-20 15:15:02 +0100
committerThomas White <taw@physics.org>2009-11-20 15:15:02 +0100
commitfb42533ca6f9077c6b1a03ad9cc76d73a53fb9f1 (patch)
tree45e50ffa8afec07c00b8cfb6ec740d53d85a242c /src/main.c
parentc72fcf4bc2a9f46daf6cbcb14ac2fc388696de09 (diff)
Tidy up and fix
Diffstat (limited to 'src/main.c')
-rw-r--r--src/main.c40
1 files changed, 26 insertions, 14 deletions
diff --git a/src/main.c b/src/main.c
index d26bea7c..54876718 100644
--- a/src/main.c
+++ b/src/main.c
@@ -67,6 +67,21 @@ int main(int argc, char *argv[])
deg2rad(90.0),
deg2rad(120.0));
+ /* Define image parameters */
+ image.width = 512;
+ image.height = 512;
+ image.fmode = FORMULATION_CLEN;
+ image.x_centre = 255.5;
+ image.y_centre = 255.5;
+ image.camera_len = 0.2; /* 20 cm */
+ image.resolution = 5120; /* 512 pixels in 10 cm */
+ image.xray_energy = eV_to_J(2.0e3); /* 2 keV energy */
+ image.lambda = ph_en_to_lambda(image.xray_energy); /* Wavelength */
+ image.molecule = NULL;
+
+ /* Splurge a few useful numbers */
+ printf("Wavelength is %f nm\n", image.lambda/1.0e-9);
+
again:
/* Read quaternion from stdin */
@@ -102,23 +117,12 @@ again:
} while ( !done );
- /* Define image parameters */
- image.width = 512;
- image.height = 512;
- image.fmode = FORMULATION_CLEN;
- image.x_centre = 255.5;
- image.y_centre = 255.5;
- image.camera_len = 0.2; /* 20 cm */
- image.resolution = 5120; /* 512 pixels in 10 cm */
- image.xray_energy = eV_to_J(2.0e3); /* 2 keV energy */
- image.lambda = ph_en_to_lambda(image.xray_energy); /* Wavelength */
+ /* Ensure no residual information */
image.qvecs = NULL;
image.sfacs = NULL;
image.data = NULL;
image.twotheta = NULL;
-
- /* Splurge a few useful numbers */
- printf("Wavelength is %f nm\n", image.lambda/1.0e-9);
+ image.hdr = NULL;
get_diffraction(&image, cell);
record_image(&image);
@@ -128,6 +132,14 @@ again:
/* Write the output file */
hdf5_write(filename, image.data, image.width, image.height);
- printf("Mock write: %i\n", number-1);
+
+ /* Clean up */
+ free(image.data);
+ free(image.qvecs);
+ free(image.hdr);
+ free(image.sfacs);
+ free(image.twotheta);
+
+ /* Do it all again */
goto again;
}