diff options
author | Thomas White <taw@physics.org> | 2010-03-30 14:22:40 +0200 |
---|---|---|
committer | Thomas White <taw@physics.org> | 2010-03-30 14:22:40 +0200 |
commit | 36101613181f24e22d435ce22b788fec96033977 (patch) | |
tree | 58f6ac437bcb107dd97a42470a2d68f9331f3530 /src/sfac.c | |
parent | 8e0e3dc86acec616429fc2333fc8352fb6a8748e (diff) |
Handle Debye-Waller factors correctly
Diffstat (limited to 'src/sfac.c')
-rw-r--r-- | src/sfac.c | 11 |
1 files changed, 6 insertions, 5 deletions
@@ -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)); |