aboutsummaryrefslogtreecommitdiff
path: root/src/sfac.c
diff options
context:
space:
mode:
authorThomas White <taw@physics.org>2010-03-30 14:22:40 +0200
committerThomas White <taw@physics.org>2010-03-30 14:22:40 +0200
commit36101613181f24e22d435ce22b788fec96033977 (patch)
tree58f6ac437bcb107dd97a42470a2d68f9331f3530 /src/sfac.c
parent8e0e3dc86acec616429fc2333fc8352fb6a8748e (diff)
Handle Debye-Waller factors correctly
Diffstat (limited to 'src/sfac.c')
-rw-r--r--src/sfac.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/src/sfac.c b/src/sfac.c
index 3d39fa42..dda1901e 100644
--- a/src/sfac.c
+++ b/src/sfac.c
@@ -532,6 +532,7 @@ double *get_reflections(struct molecule *mol, double en, double res,
for ( j=0; j<spec->n_atoms; j++ ) {
double ph, u, v, w;
+ double complex cpart;
u = h*asx + k*bsx + l*csx;
v = h*asy + k*bsy + l*csy;
@@ -540,17 +541,17 @@ double *get_reflections(struct molecule *mol, double en, double res,
ph = u*spec->x[j] + v*spec->y[j] + w*spec->z[j];
/* Conversion from revolutions to radians */
- contrib += cexp(-2.0*M_PI*I*ph);
+ cpart = cexp(-2.0*M_PI*I*ph);
+ if ( do_thermal ) {
+ cpart *= exp(-2.0 * spec->B[j] * s * s);
+ }
+ contrib += cpart;
}
sfac = get_sfac(spec->species, s, en);
F += sfac * contrib;
- if ( do_thermal ) {
- F *= exp(-2.0 * spec->B[j] * s);
- }
-
}
set_intensity(reflections, h, k, l, pow(cabs(F), 2.0));