aboutsummaryrefslogtreecommitdiff
path: root/src/partial_sim.c
diff options
context:
space:
mode:
authorThomas White <taw@physics.org>2021-07-21 13:26:37 +0200
committerThomas White <taw@physics.org>2021-07-21 15:34:33 +0200
commit7e5536832b22036a634a74e16073b4762a416e29 (patch)
tree25799eb139d235f524a80c53fb25d0c9f64eb6f1 /src/partial_sim.c
parent760f17f56b7f79f67a9029cbe7cc55a0acccd3b9 (diff)
Reduce variable scope where possible
Diffstat (limited to 'src/partial_sim.c')
-rw-r--r--src/partial_sim.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/src/partial_sim.c b/src/partial_sim.c
index efba8ebd..ff9a73ac 100644
--- a/src/partial_sim.c
+++ b/src/partial_sim.c
@@ -98,7 +98,6 @@ static void calculate_partials(Crystal *cr,
{
Reflection *refl;
RefListIterator *iter;
- double res;
for ( refl = first_refl(crystal_get_reflections(cr), &iter);
refl != NULL;
@@ -108,6 +107,7 @@ static void calculate_partials(Crystal *cr,
Reflection *rfull;
double L, p, Ip, If;
int bin;
+ double res;
get_indices(refl, &h, &k, &l);
get_asymm(sym, h, k, l, &h, &k, &l);
@@ -515,9 +515,7 @@ int main(int argc, char *argv[])
int n_threads = 1;
char *rval;
int i;
- FILE *fh;
char *phist_file = NULL;
- gsl_rng *rng_for_seeds;
int config_random = 0;
char *image_prefix = NULL;
Stream *template_stream = NULL;
@@ -969,6 +967,7 @@ int main(int argc, char *argv[])
fclose(fh);
} else {
+ gsl_rng *rng_for_seeds;
rng_for_seeds = gsl_rng_alloc(gsl_rng_mt19937);
for ( i=0; i<n_threads; i++ ) {
qargs.rngs[i] = gsl_rng_alloc(gsl_rng_mt19937);
@@ -993,14 +992,16 @@ int main(int argc, char *argv[])
if ( phist_file != NULL ) {
- double overall_max = 0.0;
- double overall_mean = 0.0;
- long long int overall_total = 0;
+ FILE *fh;
fh = fopen(phist_file, "w");
if ( fh != NULL ) {
+ double overall_max = 0.0;
+ double overall_mean = 0.0;
+ long long int overall_total = 0;
+
for ( i=0; i<NBINS; i++ ) {
double rcen;