aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas White <taw@physics.org>2010-02-22 10:24:35 +0100
committerThomas White <taw@physics.org>2010-02-22 10:25:02 +0100
commit3132451eb2a3c88202078177f84c9c8fc96372fe (patch)
tree08104e9c2df2c3a8fe98a1f97dd358fd5fc22535
parentcc0db0054d76474e55393c05806f715a0e2f6d08 (diff)
Tidy some things up:
s convention detector geometry comments, help messages
-rw-r--r--src/cell.c1
-rw-r--r--src/compare_hkl.c2
-rw-r--r--src/detector.c1
-rw-r--r--src/geometry-lcls.tmp23
-rw-r--r--src/indexamajig.c23
-rw-r--r--src/pattern_sim.c26
-rw-r--r--src/process_hkl.c4
-rw-r--r--src/reflections.c3
-rw-r--r--src/sfac.c1
9 files changed, 35 insertions, 49 deletions
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] <file1.hkl> <file2.hkl>\n\n", s);
+ printf("Syntax: %s [options] -a <file1.hkl> -b <file2.hkl>\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 <taw@physics.org>
*
@@ -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<INDMAX; h++ ) {
for ( k=-INDMAX; k<INDMAX; k++ ) {
for ( l=-INDMAX; l<INDMAX; l++ ) {
- double s = resolution(cell, h, k, l);
+ double s = 2.0*resolution(cell, h, k, l);
if ( (lookup_count(counts, h, k, l) > 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) && (s<sbracket+smax/RVQDV) && (c>0)) {
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; h<INDMAX; h++ ) {
@@ -65,7 +64,7 @@ void write_reflections(const char *filename, unsigned int *counts,
F = lookup_intensity(ref, h, k, l) / N;
if ( zone_axis && (l != 0) ) continue;
- s = resolution(cell, h, k, l);
+ s = 2.0*resolution(cell, h, k, l);
/* h, k, l, I, sigma(I), s */
fprintf(fh, "%3i %3i %3i %f %f %f\n", h, k, l, F, 0.0, s/1.0e9);
diff --git a/src/sfac.c b/src/sfac.c
index 37b57ace..b0b02b45 100644
--- a/src/sfac.c
+++ b/src/sfac.c
@@ -456,6 +456,7 @@ double complex *get_reflections(struct molecule *mol, double en)
int i;
double s;
+ /* We need sin(theta)/lambda = 1/2d */
s = resolution(mol->cell, h, k, l);
/* Atoms are grouped by species for faster calculation */