aboutsummaryrefslogtreecommitdiff
path: root/src/diffraction.c
diff options
context:
space:
mode:
authorThomas White <taw@physics.org>2009-11-20 19:56:16 +0100
committerThomas White <taw@physics.org>2009-11-20 19:56:16 +0100
commitf2d53ec0f0912178a7ec9748a899ed09b59a7cb5 (patch)
tree70b511c0b68d907230e2a5439d7a1f1bca5e0c1e /src/diffraction.c
parentf0a9bc268244b4538e909d0b4f2ca84fbf196a90 (diff)
Clarify lattice transform calculation
Diffstat (limited to 'src/diffraction.c')
-rw-r--r--src/diffraction.c18
1 files changed, 12 insertions, 6 deletions
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;
}