From 526e497f6a7266dbdf6750c1b23f1e000df1c402 Mon Sep 17 00:00:00 2001 From: Thomas White Date: Fri, 5 Feb 2010 18:41:10 +0100 Subject: Fix obvious problems --- src/ewald.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) (limited to 'src/ewald.c') diff --git a/src/ewald.c b/src/ewald.c index f24e9273..a72f9dc6 100644 --- a/src/ewald.c +++ b/src/ewald.c @@ -57,7 +57,7 @@ static struct rvec quat_rot(struct rvec q, struct quaternion z) } -static void add_sphere(struct image *image, double k) +static void add_sphere(struct image *image, double k, int soffs) { int x, y; @@ -139,7 +139,7 @@ static void add_sphere(struct image *image, double k) /* Now interpolate between the values to get * the sampling points */ - i = 0; + i = soffs; for ( sx=0; sxlambda; /* Centre */ - image->qvecs = malloc(image->width * image->height - * sizeof(struct rvec *)); - image->twotheta = malloc(image->width * image->height * sizeof(double)); /* Create the spheres */ image->nspheres = SAMPLING*SAMPLING*BWSAMPLING; + image->qvecs = malloc(image->nspheres * sizeof(struct rvec *)); + for ( i=0; inspheres; i++ ) { + mtotal += image->width * image->height * sizeof(struct rvec); image->qvecs[i] = malloc(image->width * image->height * sizeof(struct rvec)); } + STATUS("%i spheres, %i Mbytes\n", image->nspheres, mtotal/(1024*1024)); for ( kstep=0; kstep