From f2d53ec0f0912178a7ec9748a899ed09b59a7cb5 Mon Sep 17 00:00:00 2001 From: Thomas White Date: Fri, 20 Nov 2009 19:56:16 +0100 Subject: Clarify lattice transform calculation --- src/diffraction.c | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/diffraction.c b/src/diffraction.c index d8ffd108..ce4e47ee 100644 --- a/src/diffraction.c +++ b/src/diffraction.c @@ -48,28 +48,34 @@ static double lattice_factor(struct threevec q, double ax, double ay, double az, int nb = 4; int nc = 30; - Udotq.u = (ax*q.u + ay*q.v + az*q.w)/2.0; - Udotq.v = (bx*q.u + by*q.v + bz*q.w)/2.0; - Udotq.w = (cx*q.u + cy*q.v + cz*q.w)/2.0; + Udotq.u = ax*q.u + ay*q.v + az*q.w; + Udotq.v = bx*q.u + by*q.v + bz*q.w; + Udotq.w = cx*q.u + cy*q.v + cz*q.w; + /* At exact Bragg condition, f1 = na */ if ( na > 1 ) { - f1 = sin(2.0*M_PI*(double)na*Udotq.u) / sin(2.0*M_PI*Udotq.u); + f1 = sin(M_PI*(double)na*Udotq.u) / sin(M_PI*Udotq.u); } else { f1 = 1.0; } + /* At exact Bragg condition, f2 = nb */ if ( nb > 1 ) { - f2 = sin(2.0*M_PI*(double)nb*Udotq.v) / sin(2.0*M_PI*Udotq.v); + f2 = sin(M_PI*(double)nb*Udotq.v) / sin(M_PI*Udotq.v); } else { f2 = 1.0; } + /* At exact Bragg condition, f3 = nc */ if ( nc > 1 ) { - f3 = sin(2.0*M_PI*(double)nc*Udotq.w) / sin(2.0*M_PI*Udotq.w); + f3 = sin(M_PI*(double)nc*Udotq.w) / sin(M_PI*Udotq.w); } else { f3 = 1.0; } + /* At exact Bragg condition, this will multiply the molecular + * part of the structure factor by the number of unit cells, + * as desired (more scattering from bigger crystal!) */ return f1 * f2 * f3; } -- cgit v1.2.3