Commit 3132451e authored by Thomas White's avatar Thomas White
Browse files

Tidy some things up:

	s convention
	detector geometry
	comments, help messages
parent cc0db005
......@@ -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;
......
......@@ -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"
......
......@@ -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;
......
/* 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 */
......@@ -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);
......
/*
* 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));
......
......@@ -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;
......
......@@ -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);
......
......@@ -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 */
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment