From 9bb0d608b82f731356a58c24637522a61105ba29 Mon Sep 17 00:00:00 2001 From: Thomas White Date: Tue, 4 Mar 2014 15:26:03 +0100 Subject: Report the number of assignments changed since the start --- src/ambigator.c | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/ambigator.c b/src/ambigator.c index d86dc63c..8a3879e3 100644 --- a/src/ambigator.c +++ b/src/ambigator.c @@ -221,10 +221,13 @@ int main(int argc, char *argv[]) SymOpList *amb; int n_iter = 1; int n_crystals, n_chunks, max_crystals; + int n_dif; Crystal **crystals; Stream *st; int i; int *assignments; + int *orig_assignments; + gsl_rng *rng; /* Long options */ const struct option longopts[] = { @@ -384,22 +387,38 @@ int main(int argc, char *argv[]) } - assignments = calloc(n_crystals, sizeof(int)); + assignments = malloc(n_crystals*sizeof(int)); if ( assignments == NULL ) { ERROR("Couldn't allocate memory for assignments.\n"); return 1; } + orig_assignments = malloc(n_crystals*sizeof(int)); + if ( orig_assignments == NULL ) { + ERROR("Couldn't allocate memory for original assignments.\n"); + return 1; + } + + rng = gsl_rng_alloc(gsl_rng_mt19937); for ( i=0; i 0.5); + orig_assignments[i] = assignments[i]; } for ( i=0; i