From cb5ad70ca8ba8796f276bad7e80f5cf345f00639 Mon Sep 17 00:00:00 2001 From: Alexandra Tolstikova Date: Wed, 5 Aug 2015 16:55:50 +0200 Subject: Change d_max according to the provided cell --- libcrystfel/src/asdf.c | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) (limited to 'libcrystfel/src/asdf.c') diff --git a/libcrystfel/src/asdf.c b/libcrystfel/src/asdf.c index df20f7ef..a8c8b0f3 100644 --- a/libcrystfel/src/asdf.c +++ b/libcrystfel/src/asdf.c @@ -322,6 +322,15 @@ static int compare_doubles(const void *a, const void *b) } +static double max(double a, double b, double c) +{ + double m = a; + if ( m < b ) m = b; + if ( m < c ) m = c; + return m; +} + + /* Compares tvectors by length */ static int compare_tvectors(const void *a, const void *b) { @@ -889,12 +898,14 @@ static int find_cell(struct tvector *tvectors, int N_tvectors, double IndexFit, return 0; } + void swap(int *a, int *b) { int c = *a; *a = *b; *b = c; } + /* Generate triplets of integers < N_reflections in random sequence */ static int **generate_triplets(int N_reflections, int N_triplets_max, int *N) { @@ -962,6 +973,7 @@ static int **generate_triplets(int N_reflections, int N_triplets_max, int *N) return triplets; } + static int index_refls(gsl_vector **reflections, int N_reflections, double d_max, double volume_min, double volume_max, double LevelFit, double IndexFit, int N_triplets_max, @@ -1094,7 +1106,7 @@ int run_asdf(struct image *image, IndexingPrivate *ipriv) double LevelFit = 1./1000; double IndexFit = 1./500; - double d_max = 220.; // thrice the maximum expected axis length + double d_max = 400.; // thrice the maximum expected axis length double volume_min = 100.; double volume_max = 1000000.; @@ -1103,6 +1115,12 @@ int run_asdf(struct image *image, IndexingPrivate *ipriv) struct asdf_private *dp = (struct asdf_private *)ipriv; if ( dp->indm & INDEXING_CHECK_CELL_AXES ) { + double a, b, c, gamma, beta, alpha; + cell_get_parameters(dp->template, &a, &b, &c, + &alpha, &beta, &gamma); + + d_max = max(a, b, c) * 3 * 1e10; + double volume = cell_get_volume(dp->template); double vtol = (dp->ltl[0] + dp->ltl[1] + dp->ltl[2]) / 100 + dp->ltl[3] / 180 * M_PI; -- cgit v1.2.3 From d03c456a838bdebf30e8b508885f0f0907618c00 Mon Sep 17 00:00:00 2001 From: Alexandra Tolstikova Date: Fri, 30 Oct 2015 11:55:30 +0100 Subject: Change volume_min, volume_max and d_max when indexing=asdf-comb --- libcrystfel/src/asdf.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'libcrystfel/src/asdf.c') diff --git a/libcrystfel/src/asdf.c b/libcrystfel/src/asdf.c index a8c8b0f3..94d993cf 100644 --- a/libcrystfel/src/asdf.c +++ b/libcrystfel/src/asdf.c @@ -1106,15 +1106,16 @@ int run_asdf(struct image *image, IndexingPrivate *ipriv) double LevelFit = 1./1000; double IndexFit = 1./500; - double d_max = 400.; // thrice the maximum expected axis length + double d_max = 1000.; // thrice the maximum expected axis length double volume_min = 100.; - double volume_max = 1000000.; + double volume_max = 100000000.; int N_triplets_max = 10000; // maximum number of triplets struct asdf_private *dp = (struct asdf_private *)ipriv; - if ( dp->indm & INDEXING_CHECK_CELL_AXES ) { + if ( dp->indm & INDEXING_CHECK_CELL_AXES || + dp->indm & INDEXING_CHECK_CELL_COMBINATIONS) { double a, b, c, gamma, beta, alpha; cell_get_parameters(dp->template, &a, &b, &c, &alpha, &beta, &gamma); -- cgit v1.2.3 From 91ba89c68c263daaa7bd903cdf33de0b11c1642b Mon Sep 17 00:00:00 2001 From: Alexandra Tolstikova Date: Fri, 30 Oct 2015 13:39:53 +0100 Subject: Fix malloc fail due to integer overflow in N_triplets --- libcrystfel/src/asdf.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'libcrystfel/src/asdf.c') diff --git a/libcrystfel/src/asdf.c b/libcrystfel/src/asdf.c index 94d993cf..bf2ce342 100644 --- a/libcrystfel/src/asdf.c +++ b/libcrystfel/src/asdf.c @@ -915,10 +915,13 @@ static int **generate_triplets(int N_reflections, int N_triplets_max, int *N) int N_triplets = N_reflections * (N_reflections - 1) * (N_reflections - 2) / 6; - if ( N_triplets > N_triplets_max ) N_triplets = N_triplets_max; + if ( N_triplets > N_triplets_max || N_reflections > 1000 ) { + N_triplets = N_triplets_max; + } *N = N_triplets; int **triplets = malloc(N_triplets * sizeof(int *)); + if (triplets == NULL) { ERROR("Failed to allocate triplets in generate_triplets!\n"); return 0; -- cgit v1.2.3 From c1cc621eae93e96184693d94f07c9a389aa14192 Mon Sep 17 00:00:00 2001 From: Alexandra Tolstikova Date: Fri, 26 Feb 2016 17:50:10 +0100 Subject: asdf.c: Divide volume constraints by number of lattice points per unit cell since asdf always finds primitive cell --- libcrystfel/src/asdf.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'libcrystfel/src/asdf.c') diff --git a/libcrystfel/src/asdf.c b/libcrystfel/src/asdf.c index bf2ce342..9c917523 100644 --- a/libcrystfel/src/asdf.c +++ b/libcrystfel/src/asdf.c @@ -1128,8 +1128,18 @@ int run_asdf(struct image *image, IndexingPrivate *ipriv) double volume = cell_get_volume(dp->template); double vtol = (dp->ltl[0] + dp->ltl[1] + dp->ltl[2]) / 100 + dp->ltl[3] / 180 * M_PI; - volume_min = volume * (1 - vtol); - volume_max = volume * (1 + vtol); + + /* Divide volume constraints by number of lattice points per + * unit cell since asdf always finds primitive cell */ + int latt_points_per_uc = 1; + char centering = cell_get_centering(dp->template); + if ( centering == 'A' || + centering == 'B' || + centering == 'C' || + centering == 'I') latt_points_per_uc = 2; + + volume_min = volume * (1 - vtol)/latt_points_per_uc; + volume_max = volume * (1 + vtol)/latt_points_per_uc; } int n = image_feature_count(image->features); -- cgit v1.2.3 From dae4cf373c3cea2a3ccc4ea64aa9abca14e4feda Mon Sep 17 00:00:00 2001 From: Alexandra Tolstikova Date: Mon, 29 Feb 2016 13:56:03 +0100 Subject: asdf.c: Divide volume constraints by number of lattice points per unit cell. Add F centering --- libcrystfel/src/asdf.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'libcrystfel/src/asdf.c') diff --git a/libcrystfel/src/asdf.c b/libcrystfel/src/asdf.c index 9c917523..49917ad9 100644 --- a/libcrystfel/src/asdf.c +++ b/libcrystfel/src/asdf.c @@ -1136,7 +1136,8 @@ int run_asdf(struct image *image, IndexingPrivate *ipriv) if ( centering == 'A' || centering == 'B' || centering == 'C' || - centering == 'I') latt_points_per_uc = 2; + centering == 'I' ) latt_points_per_uc = 2; + else if ( centering == 'F' ) latt_points_per_uc = 4; volume_min = volume * (1 - vtol)/latt_points_per_uc; volume_max = volume * (1 + vtol)/latt_points_per_uc; -- cgit v1.2.3