From 5083b9a0eb1dc3a018eacb25dc02d29be4d992f5 Mon Sep 17 00:00:00 2001 From: Thomas White Date: Wed, 8 Apr 2009 20:11:54 +0100 Subject: Fix reflections.c, which was comically broken --- src/reflections.c | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/src/reflections.c b/src/reflections.c index 8235391..ce5f7a9 100644 --- a/src/reflections.c +++ b/src/reflections.c @@ -111,6 +111,9 @@ Reflection *reflection_add(ReflectionList *reflectionlist, double x, double y, d new_reflection->x = x; new_reflection->y = y; new_reflection->z = z; + new_reflection->h = 999; + new_reflection->k = 333; + new_reflection->l = 111; new_reflection->intensity = intensity; new_reflection->type = type; new_reflection->found = 0; @@ -243,22 +246,21 @@ ReflectionList *reflection_list_from_cell(Basis *basis) { double x, y, z; - /* Test mode */ - //if ( h != 0 ) continue; - x = h*basis->a.x + k*basis->b.x + l*basis->c.x; y = h*basis->a.y + k*basis->b.y + l*basis->c.y; z = h*basis->a.z + k*basis->b.z + l*basis->c.z; if ( ( x*x + y*y + z*z ) <= max_res*max_res ) { - Reflection *ref; - ref = reflection_add(ordered, x, y, z, 1.0, REFLECTION_GENERATED); - if ( ref ) { /* Check it's not NULL */ - ref->h = h; ref->k = k; ref->l = l; - } if ( (h!=0) || (k!=0) || (l!=0) ) { - // reflection_add(ctx->reflectionlist, x, y, z, 1.0, REFLECTION_GENERATED); - reflection_add(ordered, x, y, z, 1.0, REFLECTION_GENERATED); + Reflection *ref; + ref = reflection_add(ordered, + x, y, z, 1.0, + REFLECTION_GENERATED); + if ( ref ) { + ref->h = h; + ref->k = k; + ref->l = l; + } } } -- cgit v1.2.3