aboutsummaryrefslogtreecommitdiff
path: root/src/ewald.c
diff options
context:
space:
mode:
authorThomas White <taw@physics.org>2009-11-20 15:15:02 +0100
committerThomas White <taw@physics.org>2009-11-20 15:15:02 +0100
commitfb42533ca6f9077c6b1a03ad9cc76d73a53fb9f1 (patch)
tree45e50ffa8afec07c00b8cfb6ec740d53d85a242c /src/ewald.c
parentc72fcf4bc2a9f46daf6cbcb14ac2fc388696de09 (diff)
Tidy up and fix
Diffstat (limited to 'src/ewald.c')
-rw-r--r--src/ewald.c23
1 files changed, 10 insertions, 13 deletions
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; x<image->width; x++ ) {
for ( y=0; y<image->height; 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;
-
+
}
}
}