aboutsummaryrefslogtreecommitdiff
path: root/src/ewald.c
diff options
context:
space:
mode:
authorThomas White <taw@physics.org>2010-01-15 09:36:04 +0100
committerThomas White <taw@physics.org>2010-01-15 09:36:04 +0100
commit4400739e74b8f4f37c1bdc64ed16022103a2089b (patch)
treef690734f3010a7ef1d3d8f5d96680d1eb84a607c /src/ewald.c
parentbe91dcd68350569a709699867a1c25cf7ea6d15a (diff)
Handle upper and lower CCDs correctly
Diffstat (limited to 'src/ewald.c')
-rw-r--r--src/ewald.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/src/ewald.c b/src/ewald.c
index 82b70df2..b5b61f1c 100644
--- a/src/ewald.c
+++ b/src/ewald.c
@@ -18,6 +18,7 @@
#include "utils.h"
#include "cell.h"
#include "ewald.h"
+#include "detector.h"
static struct rvec quat_rot(struct rvec q, struct quaternion z)
@@ -73,8 +74,15 @@ void get_ewald(struct image *image)
struct rvec q;
/* Calculate q vectors for Ewald sphere */
- rx = ((double)x - image->x_centre) / image->resolution;
- ry = ((double)y - image->y_centre) / image->resolution;
+ if ( y >= 512 ) {
+ /* Top CCD */
+ rx = ((double)x - UPPER_CX) / image->resolution;
+ ry = ((double)y - UPPER_CY) / image->resolution;
+ } else {
+ /* Bottom CCD */
+ rx = ((double)x - LOWER_CX) / image->resolution;
+ ry = ((double)y - LOWER_CY) / image->resolution;
+ }
r = sqrt(pow(rx, 2.0) + pow(ry, 2.0));
twothetax = atan2(rx, image->camera_len);