aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorThomas White <taw@physics.org>2014-08-14 14:34:40 +0200
committerThomas White <taw@physics.org>2014-09-25 10:53:56 +0200
commita06a3f67f57de0bc85982976b9ea6d598598e014 (patch)
tree6eab60a0a40acacc27f5e07264043bfd617c859f /tests
parent4ad4127092681a2190c682a736d8baecb1554328 (diff)
WIP on gradients for scsphere
Diffstat (limited to 'tests')
-rw-r--r--tests/pr_p_gradient_check.c20
1 files changed, 12 insertions, 8 deletions
diff --git a/tests/pr_p_gradient_check.c b/tests/pr_p_gradient_check.c
index b88380eb..82ed2b02 100644
--- a/tests/pr_p_gradient_check.c
+++ b/tests/pr_p_gradient_check.c
@@ -45,7 +45,8 @@
static void scan_partialities(RefList *reflections, RefList *compare,
- int *valid, long double *vals[3], int idx)
+ int *valid, long double *vals[3], int idx,
+ PartialityModel pmodel)
{
int i;
Reflection *refl;
@@ -70,7 +71,7 @@ static void scan_partialities(RefList *reflections, RefList *compare,
}
get_partial(refl2, &r1, &r2, &p, &clamp_low, &clamp_high);
- if ( clamp_low && clamp_high ) {
+ if ( clamp_low && clamp_high && (pmodel != PMODEL_SCSPHERE) ) {
if ( !within_tolerance(p, 1.0, 0.001) ) {
signed int h, k, l;
@@ -190,7 +191,7 @@ static void calc_either_side(Crystal *cr, double incr_val,
cr_new = new_shifted_crystal(cr, refine, -incr_val);
compare = find_intersections(image, cr_new, pmodel);
scan_partialities(crystal_get_reflections(cr), compare, valid,
- vals, 0);
+ vals, 0, pmodel);
cell_free(crystal_get_cell(cr_new));
crystal_free(cr_new);
reflist_free(compare);
@@ -198,7 +199,7 @@ static void calc_either_side(Crystal *cr, double incr_val,
cr_new = new_shifted_crystal(cr, refine, +incr_val);
compare = find_intersections(image, cr_new, pmodel);
scan_partialities(crystal_get_reflections(cr), compare, valid,
- vals, 2);
+ vals, 2, pmodel);
cell_free(crystal_get_cell(cr_new));
crystal_free(cr_new);
reflist_free(compare);
@@ -212,14 +213,14 @@ static void calc_either_side(Crystal *cr, double incr_val,
shift_parameter(&im_moved, refine, -incr_val);
compare = find_intersections(&im_moved, cr, pmodel);
scan_partialities(crystal_get_reflections(cr), compare,
- valid, vals, 0);
+ valid, vals, 0, pmodel);
reflist_free(compare);
im_moved = *image;
shift_parameter(&im_moved, refine, +incr_val);
compare = find_intersections(&im_moved, cr, pmodel);
scan_partialities(crystal_get_reflections(cr), compare,
- valid, vals, 2);
+ valid, vals, 2, pmodel);
reflist_free(compare);
}
@@ -271,7 +272,7 @@ static double test_gradients(Crystal *cr, double incr_val, int refine,
}
for ( i=0; i<nref; i++ ) valid[i] = 1;
- scan_partialities(reflections, reflections, valid, vals, 1);
+ scan_partialities(reflections, reflections, valid, vals, 1, pmodel);
calc_either_side(cr, incr_val, valid, vals, refine, pmodel);
@@ -450,7 +451,7 @@ int main(int argc, char *argv[])
rng = gsl_rng_alloc(gsl_rng_mt19937);
- for ( i=0; i<3; i++ ) {
+ for ( i=0; i<4; i++ ) {
UnitCell *rot;
double val;
@@ -467,6 +468,9 @@ int main(int argc, char *argv[])
} else if ( i == 2 ) {
pmodel = PMODEL_THIN;
STATUS("Testing Thin Ewald Sphere model:\n");
+ } else if ( i == 3 ) {
+ pmodel = PMODEL_SCSPHERE;
+ STATUS("Testing SCSphere model:\n");
} else {
ERROR("WTF?\n");
return 1;