aboutsummaryrefslogtreecommitdiff
path: root/src/diffraction.c
diff options
context:
space:
mode:
authorThomas White <taw@physics.org>2009-11-25 16:19:31 +0100
committerThomas White <taw@physics.org>2009-11-25 16:19:31 +0100
commit3a895d677389fa4d5048d9ebc0f9c2496ac1faca (patch)
tree66886f7a08c877ec0dff0c9567dbce2f4fb9b675 /src/diffraction.c
parent76cbb192f4abdd5f5c280cee964357c64364c783 (diff)
Water fixes
Diffstat (limited to 'src/diffraction.c')
-rw-r--r--src/diffraction.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/diffraction.c b/src/diffraction.c
index 6351042d..8cf3f4ed 100644
--- a/src/diffraction.c
+++ b/src/diffraction.c
@@ -103,7 +103,7 @@ double water_intensity(struct threevec q, double en)
{
double complex fH, fO;
double s, modq;
- double intensity;
+ double complex ifac;
/* Interatomic distances in water molecule */
const double rOH = 0.09584e-9;
@@ -128,15 +128,15 @@ double water_intensity(struct threevec q, double en)
fO = get_sfac("O", s, en);
/* Four O-H cross terms */
- intensity = 4.0*fH*fO * sin(modq*rOH)/(modq*rOH);
+ ifac = 4.0*fH*fO * sin(2.0*M_PI*modq*rOH)/(2.0*M_PI*modq*rOH);
/* Three H-H cross terms */
- intensity += 3.0*fH*fH * sin(modq*rHH)/(modq*rHH);
+ ifac += 3.0*fH*fH * sin(2.0*M_PI*modq*rHH)/(2.0*M_PI*modq*rHH);
/* Three diagonal terms */
- intensity += 2.0*fH*fH + fO*fO;
+ ifac += 2.0*fH*fH + fO*fO;
- return intensity * n_water;
+ return cabs(ifac) * n_water;
}