diff options
Diffstat (limited to 'libcrystfel/src')
-rw-r--r-- | libcrystfel/src/cell-utils.c | 2 | ||||
-rw-r--r-- | libcrystfel/src/datatemplate.c | 2 | ||||
-rw-r--r-- | libcrystfel/src/filters.c | 5 | ||||
-rw-r--r-- | libcrystfel/src/image.c | 2 | ||||
-rw-r--r-- | libcrystfel/src/index.c | 3 | ||||
-rw-r--r-- | libcrystfel/src/indexers/asdf.c | 21 | ||||
-rw-r--r-- | libcrystfel/src/indexers/felix.c | 2 | ||||
-rw-r--r-- | libcrystfel/src/indexers/fromfile.c | 3 | ||||
-rw-r--r-- | libcrystfel/src/indexers/mosflm.c | 5 | ||||
-rw-r--r-- | libcrystfel/src/indexers/xds.c | 2 | ||||
-rw-r--r-- | libcrystfel/src/integration.c | 3 | ||||
-rw-r--r-- | libcrystfel/src/peaks.c | 4 | ||||
-rw-r--r-- | libcrystfel/src/reflist-utils.c | 2 | ||||
-rw-r--r-- | libcrystfel/src/stream.c | 6 |
14 files changed, 37 insertions, 25 deletions
diff --git a/libcrystfel/src/cell-utils.c b/libcrystfel/src/cell-utils.c index 2f3dfc6b..cdd4156b 100644 --- a/libcrystfel/src/cell-utils.c +++ b/libcrystfel/src/cell-utils.c @@ -1220,7 +1220,6 @@ int cell_is_sensible(UnitCell *cell) int validate_cell(UnitCell *cell) { int err = 0; - char cen, ua; if ( cell_has_parameters(cell) && !cell_is_sensible(cell) ) { ERROR("WARNING: Unit cell parameters are not sensible.\n"); @@ -1241,6 +1240,7 @@ int validate_cell(UnitCell *cell) /* For monoclinic A, B or C centering, the unique axis must be something * other than the centering. */ if ( cell_get_lattice_type(cell) == L_MONOCLINIC ) { + char cen, ua; cen = cell_get_centering(cell); ua = cell_get_unique_axis(cell); if ( ((cen == 'A') && (ua == 'a')) diff --git a/libcrystfel/src/datatemplate.c b/libcrystfel/src/datatemplate.c index 9f8f102c..a2b974a7 100644 --- a/libcrystfel/src/datatemplate.c +++ b/libcrystfel/src/datatemplate.c @@ -646,9 +646,9 @@ static int parse_field_for_panel(struct panel_template *panel, const char *key, reject = 1; } } else if ( strncmp(key, "dim", 3) == 0) { - int dim_entry; char *endptr; if ( key[3] != '\0' ) { + int dim_entry; dim_entry = strtoul(key+3, &endptr, 10); if ( endptr[0] != '\0' ) { ERROR("Invalid dimension number %s\n", diff --git a/libcrystfel/src/filters.c b/libcrystfel/src/filters.c index a9c8737a..5f6a0b2d 100644 --- a/libcrystfel/src/filters.c +++ b/libcrystfel/src/filters.c @@ -99,13 +99,14 @@ void filters_fudge_gslcblas() #define SWAP(a,b) { float t=(a);(a)=(b);(b)=t; } static float kth_smallest(float *a, int n, int k) { - long i, j, l, m; - float x; + long l, m; l = 0; m = n-1; while ( l < m ) { + long i, j; + float x; x=a[k]; i=l; j=m; diff --git a/libcrystfel/src/image.c b/libcrystfel/src/image.c index 3c5af479..9fc647ab 100644 --- a/libcrystfel/src/image.c +++ b/libcrystfel/src/image.c @@ -1140,7 +1140,6 @@ static int create_satmap(struct image *image, * but it isn't this one. Therefore make a fake * saturation map */ - long int j; int p_w, p_h; p_w = p->orig_max_fs - p->orig_min_fs + 1; @@ -1149,6 +1148,7 @@ static int create_satmap(struct image *image, image->sat[i] = malloc(p_w*p_h*sizeof(float)); if ( image->sat[i] != NULL ) { + long int j; for ( j=0; j<p_w*p_h; j++ ) { image->sat[i][j] = INFINITY; } diff --git a/libcrystfel/src/index.c b/libcrystfel/src/index.c index d8a135fc..e7b8b8cf 100644 --- a/libcrystfel/src/index.c +++ b/libcrystfel/src/index.c @@ -922,7 +922,6 @@ void index_pattern_3(struct image *image, IndexingPrivate *ipriv, int *ping, for ( n=0; n<ipriv->n_methods; n++ ) { int done = 0; - int r; int ntry = 0; int success = 0; @@ -932,6 +931,8 @@ void index_pattern_3(struct image *image, IndexingPrivate *ipriv, int *ping, do { + int r; + r = try_indexer(image, ipriv->methods[n], ipriv, ipriv->engine_private[n], last_task); diff --git a/libcrystfel/src/indexers/asdf.c b/libcrystfel/src/indexers/asdf.c index 7030a3e7..a1f8f50d 100644 --- a/libcrystfel/src/indexers/asdf.c +++ b/libcrystfel/src/indexers/asdf.c @@ -364,7 +364,7 @@ static float find_ds_fft(double *projections, int N_projections, double d_max, memcpy(projections_sorted, projections, sizeof(double) * n); qsort(projections_sorted, n, sizeof(double), compare_doubles); - int i, k; + int i; int N = fftw.N; // number of points in fft calculation double *in = fftw.in; @@ -376,6 +376,7 @@ static float find_ds_fft(double *projections, int N_projections, double d_max, } for ( i=0; i<n; i++ ) { + int k; k = (int)((projections_sorted[i] - projections_sorted[0]) / (projections_sorted[n - 1] - projections_sorted[0]) * (N - 1)); @@ -394,8 +395,8 @@ static float find_ds_fft(double *projections, int N_projections, double d_max, int d = 1; double max = 0; - double a; for ( i=1; i<=i_max; i++ ) { + double a; a = sqrt(out[i][0] * out[i][0] + out[i][1] * out[i][1]); if (a > max) { max = a; @@ -581,8 +582,6 @@ static int refine_asdf_cell(struct asdf_cell *c, gsl_vector **reflections, static int reduce_asdf_cell(struct asdf_cell *cl) { - double a, b, c, alpha, beta, gamma, ab, bc, ca, bb, cc; - gsl_vector *va = gsl_vector_alloc(3); gsl_vector *vb = gsl_vector_alloc(3); gsl_vector *vc = gsl_vector_alloc(3); @@ -591,6 +590,9 @@ static int reduce_asdf_cell(struct asdf_cell *cl) int n = 0; while ( changed ) { + + double a, b, c, alpha, beta, gamma, ab, bc, ca; + n += 1; changed = 0; @@ -612,6 +614,8 @@ static int reduce_asdf_cell(struct asdf_cell *cl) if ( changed == 0 ) { + double bb; + if ( gamma < 90 ) { gsl_vector_scale(vb, -1); gamma = 180 - gamma; @@ -634,6 +638,8 @@ static int reduce_asdf_cell(struct asdf_cell *cl) if ( changed == 0 ) { + double cc; + if ( beta < 90 ) { gsl_vector_scale(vc, -1); beta = 180 - beta; @@ -659,6 +665,9 @@ static int reduce_asdf_cell(struct asdf_cell *cl) } if ( changed == 0 ) { + + double cc; + if ( alpha < 90 ) { gsl_vector_scale(vc, -1); beta = 180 - beta; @@ -901,10 +910,12 @@ static int **generate_triplets(int N_reflections, int N_triplets_max, int *N) return 0; } - int is_in_triplets; n = 0; while ( n < N_triplets ) { + + int is_in_triplets; + /* Generate three different integer numbers < N_reflections */ i = rand() % N_reflections; j = i; diff --git a/libcrystfel/src/indexers/felix.c b/libcrystfel/src/indexers/felix.c index b7d2a8a3..db7da8c4 100644 --- a/libcrystfel/src/indexers/felix.c +++ b/libcrystfel/src/indexers/felix.c @@ -131,7 +131,6 @@ static int read_felix(struct felix_private *gp, struct image *image, float mean_ia; int ngv; char line[1024]; - int r; int n_crystals = 0; fh = fopen(filename, "r"); @@ -151,6 +150,7 @@ static int read_felix(struct felix_private *gp, struct image *image, Crystal *cr; UnitCell *cell; + int r; /* One line per grain */ if ( fgets( line, 1024, fh ) == NULL ) { diff --git a/libcrystfel/src/indexers/fromfile.c b/libcrystfel/src/indexers/fromfile.c index d7dfbd09..1716dd66 100644 --- a/libcrystfel/src/indexers/fromfile.c +++ b/libcrystfel/src/indexers/fromfile.c @@ -228,7 +228,6 @@ void *fromfile_prepare(IndexingMethod *indm, struct fromfile_options *opts) float vals[11]; struct fromfile_key key; Crystal *cr; - UnitCell *cell; size_t len; int n_sp; struct fromfile_entry *item = NULL; @@ -286,6 +285,8 @@ void *fromfile_prepare(IndexingMethod *indm, struct fromfile_options *opts) } else { + UnitCell *cell; + cr = crystal_new(); /* mm -> m */ diff --git a/libcrystfel/src/indexers/mosflm.c b/libcrystfel/src/indexers/mosflm.c index 129e6859..e77f6384 100644 --- a/libcrystfel/src/indexers/mosflm.c +++ b/libcrystfel/src/indexers/mosflm.c @@ -481,7 +481,6 @@ static char *mosflm_spacegroup_for_lattice(UnitCell *cell) static void mosflm_send_next(struct image *image, struct mosflm_data *mosflm) { char tmp[256]; - char cen; double wavelength; double a = 0, b = 0, c = 0, alpha = 0, beta = 0, gamma = 0; @@ -548,6 +547,7 @@ static void mosflm_send_next(struct image *image, struct mosflm_data *mosflm) case 9 : if ( mosflm->mp->indm & INDEXING_USE_CELL_PARAMETERS ) { + char cen; cell_get_parameters(mosflm->mp->template, &a, &b, &c, &alpha, &beta, &gamma); cen = cell_get_centering(mosflm->mp->template); @@ -886,9 +886,8 @@ const char *mosflm_probe(UnitCell *cell) fh = fdopen(pty, "r"); for ( l=0; l<10; l++ ) { - char *pos; if ( fgets(line, 1024, fh) != NULL ) { - pos = strstr(line, "Mosflm version "); + char *pos = strstr(line, "Mosflm version "); if ( pos != NULL ) ok = 1; } } diff --git a/libcrystfel/src/indexers/xds.c b/libcrystfel/src/indexers/xds.c index 3936f791..8ef496cf 100644 --- a/libcrystfel/src/indexers/xds.c +++ b/libcrystfel/src/indexers/xds.c @@ -523,8 +523,8 @@ const char *xds_probe(UnitCell *cell) fh = fdopen(pty, "r"); for ( l=0; l<10; l++ ) { - char *pos; if ( fgets(line, 1024, fh) != NULL ) { + char *pos; pos = strstr(line, "** XDS **"); if ( pos != NULL ) { ok = 1; diff --git a/libcrystfel/src/integration.c b/libcrystfel/src/integration.c index 2375388f..e797d26b 100644 --- a/libcrystfel/src/integration.c +++ b/libcrystfel/src/integration.c @@ -340,10 +340,9 @@ static void fit_gradient_bg(struct intcontext *ic, struct peak_box *bx) for ( p=0; p<ic->w; p++ ) { for ( q=0; q<ic->w; q++ ) { - double bi; - if ( bx->bm[p + ic->w*q] == BM_BG ) { + double bi; bi = boxi(ic, bx, p, q); addv(v, 0, bi*p); diff --git a/libcrystfel/src/peaks.c b/libcrystfel/src/peaks.c index 689239e5..d260b66d 100644 --- a/libcrystfel/src/peaks.c +++ b/libcrystfel/src/peaks.c @@ -288,7 +288,6 @@ static void search_peaks_in_panel(struct image *image, float threshold, double grad; int mask_fs, mask_ss; int s_fs, s_ss; - double max; unsigned int did_something; int r; int saturated; @@ -321,6 +320,7 @@ static void search_peaks_in_panel(struct image *image, float threshold, do { + double max; max = data[mask_fs+stride*mask_ss]; did_something = 0; @@ -589,7 +589,6 @@ int indexing_peak_check(struct image *image, Crystal **crystals, int n_cryst, struct imagefeature *f; double q[3]; - double h,k,l,hd,kd,ld; int j; int ok = 0; @@ -604,6 +603,7 @@ int indexing_peak_check(struct image *image, Crystal **crystals, int n_cryst, double bx, by, bz; double cx, cy, cz; double dx, dy; + double h,k,l,hd,kd,ld; crystal_get_det_shift(crystals[j], &dx, &dy); diff --git a/libcrystfel/src/reflist-utils.c b/libcrystfel/src/reflist-utils.c index 2b250eff..4a284c07 100644 --- a/libcrystfel/src/reflist-utils.c +++ b/libcrystfel/src/reflist-utils.c @@ -1099,13 +1099,13 @@ int write_to_mtz(RefList *reflist, { signed int h, k, l; double one_over_d; - int isym; get_indices(refl, &h, &k, &l); one_over_d = 2.0*resolution(cell, h, k, l); if ( (one_over_d > min_res) && (one_over_d < max_res) ) { + int isym; float refldata[7]; signed int nh, nk, nl; signed int fh, fk, fl; diff --git a/libcrystfel/src/stream.c b/libcrystfel/src/stream.c index 8ffaed1a..6c716fda 100644 --- a/libcrystfel/src/stream.c +++ b/libcrystfel/src/stream.c @@ -242,7 +242,6 @@ static RefList *read_stream_reflections_2_3(Stream *st) float intensity, sigma, fs, ss, pk, bg; char pn[32]; int r; - Reflection *refl; rval = fgets(line, 1023, st->fh); st->ln++; @@ -264,6 +263,7 @@ static RefList *read_stream_reflections_2_3(Stream *st) if ( r == 10 ) { + Reflection *refl; refl = add_refl(out, h, k, l); if ( refl == NULL ) { ERROR("Failed to add reflection\n"); @@ -313,7 +313,6 @@ static RefList *read_stream_reflections_2_1(Stream *st) char phs[1024]; int cts; int r; - Reflection *refl; rval = fgets(line, 1023, st->fh); st->ln++; @@ -333,6 +332,7 @@ static RefList *read_stream_reflections_2_1(Stream *st) first = 0; if ( r == 9 ) { + Reflection *refl; double ph; char *v; @@ -388,7 +388,6 @@ static RefList *read_stream_reflections_2_2(Stream *st) signed int h, k, l; float intensity, sigma, fs, ss, pk, bg; int r; - Reflection *refl; rval = fgets(line, 1023, st->fh); st->ln++; @@ -407,6 +406,7 @@ static RefList *read_stream_reflections_2_2(Stream *st) first = 0; if ( r == 9 ) { + Reflection *refl; refl = add_refl(out, h, k, l); if ( refl == NULL ) { ERROR("Failed to add reflection\n"); |