From 48477c86c4fae48d581ee6614615152b6e61ee3f Mon Sep 17 00:00:00 2001 From: Thomas White Date: Wed, 25 Nov 2009 00:39:05 +0100 Subject: Progress bar improvements and tidy-up --- src/sfac.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src/sfac.c') diff --git a/src/sfac.c b/src/sfac.c index 7bf30f82..0c82eb2f 100644 --- a/src/sfac.c +++ b/src/sfac.c @@ -447,10 +447,9 @@ double complex *get_reflections(struct molecule *mol, double en) //} } + progress_bar((k+INDMAX)+IDIM*(h+INDMAX), IDIM*IDIM-1); } - progress_bar((h+INDMAX+1), 2*INDMAX); } - printf("\n"); //printf("Total scattered = %f, F000 = %f\n", tscat, F00); return reflections; @@ -463,7 +462,8 @@ void get_reflections_cached(struct molecule *mol, double en) FILE *fh; size_t r; - snprintf(s, 1023, "reflections-%ieV.cache", (int)J_to_eV(en)); + /* Add 0.5 to improve rounding */ + snprintf(s, 1023, "reflections-%ieV.cache", (int)(J_to_eV(en)+0.5)); fh = fopen(s, "rb"); if ( fh == NULL ) { printf("No cache file found (looked for %s)\n", s); @@ -491,7 +491,7 @@ calc: r = fwrite(mol->reflections, sizeof(double complex), IDIM*IDIM*IDIM, fh); - if ( r < IDIM*IDIM*IDIM ) { + if ( r < IDIM*IDIM*IDIM ) { printf("Failed to write cache file (%s)\n", s); return; } -- cgit v1.2.3