aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas White <taw@physics.org>2009-12-07 16:54:42 +0100
committerThomas White <taw@physics.org>2009-12-07 16:54:42 +0100
commitfc8ba89ffff7c8620f64c52ef0d27bd434879869 (patch)
tree397ab1044e05900a94a85a56dd3f1479d74090b2
parent64acc8cd7bcade6fd6ed4958c21580bb94c98d04 (diff)
Random particle sizes
-rw-r--r--src/diffraction.c8
-rw-r--r--src/diffraction.h2
-rw-r--r--src/pattern_sim.c11
3 files changed, 8 insertions, 13 deletions
diff --git a/src/diffraction.c b/src/diffraction.c
index 9a35d565..2284909b 100644
--- a/src/diffraction.c
+++ b/src/diffraction.c
@@ -31,9 +31,6 @@ static double lattice_factor(struct threevec q, double ax, double ay, double az,
{
struct threevec Udotq;
double f1, f2, f3;
- int na = 4;
- int nb = 4;
- int nc = 30;
Udotq.u = ax*q.u + ay*q.v + az*q.w;
Udotq.v = bx*q.u + by*q.v + bz*q.w;
@@ -136,7 +133,7 @@ double water_intensity(struct threevec q, double en,
}
-void get_diffraction(struct image *image)
+void get_diffraction(struct image *image, int na, int nb, int nc)
{
int x, y;
double ax, ay, az;
@@ -172,7 +169,8 @@ void get_diffraction(struct image *image)
q = image->qvecs[x + image->width*y];
- f_lattice = lattice_factor(q, ax,ay,az,bx,by,bz,cx,cy,cz);
+ f_lattice = lattice_factor(q, ax,ay,az,bx,by,bz,cx,cy,cz,
+ na, nb, nc);
f_molecule = molecule_factor(image->molecule, q,
ax,ay,az,bx,by,bz,cx,cy,cz);
diff --git a/src/diffraction.h b/src/diffraction.h
index 1e08e116..6a39ee93 100644
--- a/src/diffraction.h
+++ b/src/diffraction.h
@@ -19,7 +19,7 @@
#include "image.h"
#include "cell.h"
-extern void get_diffraction(struct image *image);
+extern void get_diffraction(struct image *image, int na, int nb, int nc);
extern double water_intensity(struct threevec q, double en,
double beam_r, double water_r);
diff --git a/src/pattern_sim.c b/src/pattern_sim.c
index 765b348d..a8e2a250 100644
--- a/src/pattern_sim.c
+++ b/src/pattern_sim.c
@@ -225,12 +225,9 @@ int main(int argc, char *argv[])
int na, nb, nc;
- //na = 8*random()/RAND_MAX + 4;
- //nb = 8*random()/RAND_MAX + 4;
- //nc = 16*random()/RAND_MAX + 30;
- na = 4;
- nb = 4;
- nc = 30;
+ na = 8*random()/RAND_MAX + 4;
+ nb = 8*random()/RAND_MAX + 4;
+ nc = 16*random()/RAND_MAX + 30;
STATUS("Particle size = %i x %i x %i\n", na, nb, nc);
/* Read quaternion from stdin */
@@ -256,7 +253,7 @@ int main(int argc, char *argv[])
image.twotheta = NULL;
image.hdr = NULL;
- get_diffraction(&image);
+ get_diffraction(&image, na, nb, nc);
record_image(&image, !config_nowater, !config_nonoise,
!config_nobloom);