From 36101613181f24e22d435ce22b788fec96033977 Mon Sep 17 00:00:00 2001 From: Thomas White Date: Tue, 30 Mar 2010 14:22:40 +0200 Subject: Handle Debye-Waller factors correctly --- src/sfac.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'src/sfac.c') 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; jn_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)); -- cgit v1.2.3