From 3132451eb2a3c88202078177f84c9c8fc96372fe Mon Sep 17 00:00:00 2001 From: Thomas White Date: Mon, 22 Feb 2010 10:24:35 +0100 Subject: Tidy some things up: s convention detector geometry comments, help messages --- src/cell.c | 1 + src/compare_hkl.c | 2 +- src/detector.c | 1 + src/geometry-lcls.tmp | 23 +++++++++++++++++++++++ src/indexamajig.c | 23 +---------------------- src/pattern_sim.c | 26 ++++---------------------- src/process_hkl.c | 4 ++-- src/reflections.c | 3 +-- src/sfac.c | 1 + 9 files changed, 35 insertions(+), 49 deletions(-) create mode 100644 src/geometry-lcls.tmp diff --git a/src/cell.c b/src/cell.c index acbab635..c6d64af0 100644 --- a/src/cell.c +++ b/src/cell.c @@ -554,6 +554,7 @@ done: } +/* Return sin(theta)/lambda = 1/2d. Multiply by two if you want 1/d */ double resolution(UnitCell *cell, signed int h, signed int k, signed int l) { const double a = cell->a; diff --git a/src/compare_hkl.c b/src/compare_hkl.c index 00b8bfc1..2d7dd284 100644 --- a/src/compare_hkl.c +++ b/src/compare_hkl.c @@ -28,7 +28,7 @@ static void show_help(const char *s) { - printf("Syntax: %s [options] \n\n", s); + printf("Syntax: %s [options] -a -b \n\n", s); printf( "Compare intensity lists.\n" "\n" diff --git a/src/detector.c b/src/detector.c index 5a7407c9..f4810a1b 100644 --- a/src/detector.c +++ b/src/detector.c @@ -191,6 +191,7 @@ void record_image(struct image *image, int do_water, int do_poisson, return; } + /* FIXME: Move to diffraction.c somehow */ if ( do_water ) { struct rvec q; diff --git a/src/geometry-lcls.tmp b/src/geometry-lcls.tmp new file mode 100644 index 00000000..da0b0c55 --- /dev/null +++ b/src/geometry-lcls.tmp @@ -0,0 +1,23 @@ +/* Set up detector configuration */ +image.det.n_panels = 2; +image.det.panels = malloc(2*sizeof(struct panel)); + +/* Upper panel */ +image.det.panels[0].min_x = 0; +image.det.panels[0].max_x = 1023; +image.det.panels[0].min_y = 512; +image.det.panels[0].max_y = 1023; +image.det.panels[0].cx = 491.9; +image.det.panels[0].cy = 440.7; +image.det.panels[0].clen = 67.0e-3; +image.det.panels[0].res = 13333.3; /* 75 micron pixel size */ + +/* Lower panel */ +image.det.panels[1].min_x = 0; +image.det.panels[1].max_x = 1023; +image.det.panels[1].min_y = 0; +image.det.panels[1].max_y = 511; +image.det.panels[1].cx = 492.0; +image.det.panels[1].cy = 779.7; +image.det.panels[1].clen = 75.0e-3; +image.det.panels[1].res = 13333.3; /* 75 micron pixel size */ diff --git a/src/indexamajig.c b/src/indexamajig.c index 6915802a..9408f9a3 100644 --- a/src/indexamajig.c +++ b/src/indexamajig.c @@ -170,28 +170,7 @@ int main(int argc, char *argv[]) image.data = NULL; image.indexed_cell = NULL; - /* Set up detector configuration */ - image.det.n_panels = 2; - image.det.panels = malloc(2*sizeof(struct panel)); - /* Upper panel */ - image.det.panels[0].min_x = 0; - image.det.panels[0].max_x = 1023; - image.det.panels[0].min_y = 512; - image.det.panels[0].max_y = 1023; - image.det.panels[0].cx = 491.9; - image.det.panels[0].cy = 440.7; - image.det.panels[0].clen = 67.0e-3; - image.det.panels[0].res = 13333.3; /* 75 micron pixel size */ - - /* Lower panel */ - image.det.panels[1].min_x = 0; - image.det.panels[1].max_x = 1023; - image.det.panels[1].min_y = 0; - image.det.panels[1].max_y = 511; - image.det.panels[1].cx = 492.0; - image.det.panels[1].cy = 779.7; - image.det.panels[1].clen = 75.0e-3; - image.det.panels[1].res = 13333.3; /* 75 micron pixel size */ + #include "geometry-lcls.tmp" STATUS("Processing '%s'\n", line); diff --git a/src/pattern_sim.c b/src/pattern_sim.c index 56826ed9..26b863cf 100644 --- a/src/pattern_sim.c +++ b/src/pattern_sim.c @@ -1,5 +1,7 @@ /* - * main.c + * pattern_sim.c + * + * Simulate diffraction patterns from small crystals * * (c) 2006-2010 Thomas White * @@ -227,27 +229,7 @@ int main(int argc, char *argv[]) image.lambda = ph_en_to_lambda(eV_to_J(2.0e3)); /* Wavelength */ image.molecule = load_molecule(); - /* Set up detector configuration */ - image.det.n_panels = 2; - image.det.panels = malloc(2*sizeof(struct panel)); - /* Upper panel */ - image.det.panels[0].min_x = 0; - image.det.panels[0].max_x = 1023; - image.det.panels[0].min_y = 512; - image.det.panels[0].max_y = 1023; - image.det.panels[0].cx = 491.9; - image.det.panels[0].cy = 440.7; - image.det.panels[0].clen = 67.0e-3; - image.det.panels[0].res = 13333.3; /* 75 micron pixel size */ - /* Lower panel */ - image.det.panels[1].min_x = 0; - image.det.panels[1].max_x = 1023; - image.det.panels[1].min_y = 0; - image.det.panels[1].max_y = 511; - image.det.panels[1].cx = 492.0; - image.det.panels[1].cy = 779.7; - image.det.panels[1].clen = 75.0e-3; - image.det.panels[1].res = 13333.3; /* 75 micron pixel size */ + #include "geometry-lcls.tmp" powder = calloc(image.width*image.height, sizeof(*powder)); diff --git a/src/process_hkl.c b/src/process_hkl.c index 0a4db33d..12427a1a 100644 --- a/src/process_hkl.c +++ b/src/process_hkl.c @@ -78,7 +78,7 @@ static void write_RvsQ(const char *name, double *ref, double *trueref, for ( h=-INDMAX; h 0) && (s > smax) ) { smax = s; } @@ -105,7 +105,7 @@ static void write_RvsQ(const char *name, double *ref, double *trueref, if ( (h==0) && (k==0) && (l==0) ) continue; c = lookup_count(counts, h, k, l); - s = resolution(cell, h, k, l); + s = 2.0*resolution(cell, h, k, l); if ((s>=sbracket) && (s0)) { double obs, calc, obsi; diff --git a/src/reflections.c b/src/reflections.c index ab7738e4..c9d83710 100644 --- a/src/reflections.c +++ b/src/reflections.c @@ -45,7 +45,6 @@ void write_reflections(const char *filename, unsigned int *counts, fprintf(fh, "a %5.3f nm\n", a*1e9); fprintf(fh, "b %5.3f nm\n", b*1e9); fprintf(fh, "angle %5.3f deg\n", rad2deg(gamma)); - fprintf(fh, "scale 10\n"); } for ( h=-INDMAX; hcell, h, k, l); /* Atoms are grouped by species for faster calculation */ -- cgit v1.2.3