From fb42533ca6f9077c6b1a03ad9cc76d73a53fb9f1 Mon Sep 17 00:00:00 2001 From: Thomas White Date: Fri, 20 Nov 2009 15:15:02 +0100 Subject: Tidy up and fix --- src/ewald.c | 23 ++++++++++------------- 1 file changed, 10 insertions(+), 13 deletions(-) (limited to 'src/ewald.c') diff --git a/src/ewald.c b/src/ewald.c index 7a620c42..d1f47da7 100644 --- a/src/ewald.c +++ b/src/ewald.c @@ -55,32 +55,32 @@ void get_ewald(struct image *image) { int x, y; double k; /* Wavenumber */ - + k = 1/image->lambda; - + image->qvecs = malloc(image->width * image->height * sizeof(struct threevec)); - + image->twotheta = malloc(image->width * image->height * sizeof(double)); - + for ( x=0; xwidth; x++ ) { for ( y=0; yheight; y++ ) { - + double rx, ry, r; double twothetax, twothetay, twotheta; double qx, qy, qz; struct threevec q; - + /* Calculate q vectors for Ewald sphere */ rx = ((double)x - image->x_centre) / image->resolution; ry = ((double)y - image->y_centre) / image->resolution; r = sqrt(pow(rx, 2.0) + pow(ry, 2.0)); - + twothetax = atan2(rx, image->camera_len); - twothetay = atan2(ry, image->camera_len); + twothetay = atan2(ry, image->camera_len); twotheta = atan2(r, image->camera_len); - + qx = k * sin(twothetax); qy = k * sin(twothetay); qz = k - k * cos(twotheta); @@ -89,11 +89,8 @@ void get_ewald(struct image *image) image->qvecs[x + image->width*y] = quat_rot(q, image->orientation); - image->qvecs[x + image->width*y].u = qx; - image->qvecs[x + image->width*y].v = qy; - image->qvecs[x + image->width*y].w = qz; image->twotheta[x + image->width*y] = twotheta; - + } } } -- cgit v1.2.3