diff options
author | Thomas White <taw@physics.org> | 2015-03-19 17:56:37 +0100 |
---|---|---|
committer | Thomas White <taw@physics.org> | 2015-04-20 15:50:39 +0200 |
commit | 52fc1532ba4a93f63b82ed4f5382d637dccac3c5 (patch) | |
tree | 49656dc8a4787732f076294a69cab7961f398aca | |
parent | 254c019a28b7be2b39674cb84e293be16f68ff4c (diff) |
Factorise dr/da part of gradient calculation for PR and prediction
-rw-r--r-- | libcrystfel/src/geometry.c | 81 | ||||
-rw-r--r-- | libcrystfel/src/geometry.h | 19 | ||||
-rw-r--r-- | src/post-refinement.c | 127 | ||||
-rw-r--r-- | src/post-refinement.h | 18 | ||||
-rw-r--r-- | src/predict-refine.c | 118 | ||||
-rw-r--r-- | tests/pr_p_gradient_check.c | 64 | ||||
-rw-r--r-- | tests/prediction_gradient_check.c | 54 |
7 files changed, 209 insertions, 272 deletions
diff --git a/libcrystfel/src/geometry.c b/libcrystfel/src/geometry.c index 35492fde..66786cdb 100644 --- a/libcrystfel/src/geometry.c +++ b/libcrystfel/src/geometry.c @@ -297,6 +297,87 @@ static Reflection *check_reflection(struct image *image, Crystal *cryst, } +double r_gradient(UnitCell *cell, int k, Reflection *refl, struct image *image) +{ + double azi; + double asx, asy, asz; + double bsx, bsy, bsz; + double csx, csy, csz; + double xl, yl, zl; + signed int hs, ks, ls; + double rlow, rhigh, p; + double philow, phihigh, phi; + double khigh, klow; + double tl, cet, cez; + + get_partial(refl, &rlow, &rhigh, &p); + + get_symmetric_indices(refl, &hs, &ks, &ls); + + cell_get_reciprocal(cell, &asx, &asy, &asz, + &bsx, &bsy, &bsz, + &csx, &csy, &csz); + xl = hs*asx + ks*bsx + ls*csx; + yl = hs*asy + ks*bsy + ls*csy; + zl = hs*asz + ks*bsz + ls*csz; + + /* "low" gives the largest Ewald sphere (wavelength short => k large) + * "high" gives the smallest Ewald sphere (wavelength long => k small) + */ + klow = 1.0/(image->lambda - image->lambda*image->bw/2.0); + khigh = 1.0/(image->lambda + image->lambda*image->bw/2.0); + + tl = sqrt(xl*xl + yl*yl); + + cet = -sin(image->div/2.0) * klow; + cez = -cos(image->div/2.0) * klow; + philow = angle_between_2d(tl-cet, zl-cez, 0.0, 1.0); + + cet = -sin(image->div/2.0) * khigh; + cez = -cos(image->div/2.0) * khigh; + phihigh = angle_between_2d(tl-cet, zl-cez, 0.0, 1.0); + + /* Approximation: philow and phihigh are very similar */ + phi = (philow + phihigh) / 2.0; + + azi = atan2(yl, xl); + + switch ( k ) { + + case GPARAM_ASX : + return - hs * sin(phi) * cos(azi); + + case GPARAM_BSX : + return - ks * sin(phi) * cos(azi); + + case GPARAM_CSX : + return - ls * sin(phi) * cos(azi); + + case GPARAM_ASY : + return - hs * sin(phi) * sin(azi); + + case GPARAM_BSY : + return - ks * sin(phi) * sin(azi); + + case GPARAM_CSY : + return - ls * sin(phi) * sin(azi); + + case GPARAM_ASZ : + return - hs * cos(phi); + + case GPARAM_BSZ : + return - ks * cos(phi); + + case GPARAM_CSZ : + return - ls * cos(phi); + + } + + ERROR("No r gradient defined for parameter %i\n", k); + abort(); +} + + RefList *find_intersections(struct image *image, Crystal *cryst, PartialityModel pmodel) { diff --git a/libcrystfel/src/geometry.h b/libcrystfel/src/geometry.h index 162c0355..e0d21dda 100644 --- a/libcrystfel/src/geometry.h +++ b/libcrystfel/src/geometry.h @@ -61,12 +61,31 @@ typedef enum { } PartialityModel; + +/* Enumeration of parameters which may want to be refined */ +enum { + GPARAM_ASX, + GPARAM_ASY, + GPARAM_ASZ, + GPARAM_BSX, + GPARAM_BSY, + GPARAM_BSZ, + GPARAM_CSX, + GPARAM_CSY, + GPARAM_CSZ, + GPARAM_R, + GPARAM_DIV, +}; + + extern RefList *find_intersections(struct image *image, Crystal *cryst, PartialityModel pmodel); extern RefList *find_intersections_to_res(struct image *image, Crystal *cryst, PartialityModel pmodel, double max_res); +extern double r_gradient(UnitCell *cell, int k, Reflection *refl, + struct image *image); extern void update_partialities(Crystal *cryst, PartialityModel pmodel); extern void polarisation_correction(RefList *list, UnitCell *cell, struct image *image); diff --git a/src/post-refinement.c b/src/post-refinement.c index 745e5bd7..a532cd07 100644 --- a/src/post-refinement.c +++ b/src/post-refinement.c @@ -54,6 +54,8 @@ /* Maximum number of iterations of NLSq to do for each image per macrocycle. */ #define MAX_CYCLES (10) +/* Number of parameters to refine, in the order they appear in the enum */ +#define NUM_PARAMS (9) /* Returns dp(gauss)/dr at "r" */ static double gaussian_fraction_gradient(double r, double R) @@ -179,27 +181,17 @@ static double volume_fraction(double rlow, double rhigh, double pr, * of 'image'. */ double p_gradient(Crystal *cr, int k, Reflection *refl, PartialityModel pmodel) { - double azi; double glow, ghigh; - double asx, asy, asz; - double bsx, bsy, bsz; - double csx, csy, csz; - double xl, yl, zl; - double ds; - signed int hs, ks, ls; double rlow, rhigh, p; - double philow, phihigh, phi; - double khigh, klow; - double tl, cet, cez; struct image *image = crystal_get_image(cr); double R = crystal_get_profile_radius(cr); - double D, psph; get_partial(refl, &rlow, &rhigh, &p); - if ( k == REF_R ) { + if ( k == GPARAM_R ) { double Rglow, Rghigh; + double D, psph; D = rlow - rhigh; psph = volume_fraction(rlow, rhigh, R, pmodel); @@ -215,78 +207,21 @@ double p_gradient(Crystal *cr, int k, Reflection *refl, PartialityModel pmodel) glow = partiality_gradient(rlow, R, pmodel, rlow, rhigh); ghigh = partiality_gradient(rhigh, R, pmodel, rlow, rhigh); - get_symmetric_indices(refl, &hs, &ks, &ls); - ds = 2.0 * resolution(crystal_get_cell(cr), hs, ks, ls); - - cell_get_reciprocal(crystal_get_cell(cr), &asx, &asy, &asz, - &bsx, &bsy, &bsz, - &csx, &csy, &csz); - xl = hs*asx + ks*bsx + ls*csx; - yl = hs*asy + ks*bsy + ls*csy; - zl = hs*asz + ks*bsz + ls*csz; - - /* "low" gives the largest Ewald sphere (wavelength short => k large) - * "high" gives the smallest Ewald sphere (wavelength long => k small) - */ - klow = 1.0/(image->lambda - image->lambda*image->bw/2.0); - khigh = 1.0/(image->lambda + image->lambda*image->bw/2.0); - - tl = sqrt(xl*xl + yl*yl); + if ( k == GPARAM_DIV ) { - cet = -sin(image->div/2.0) * klow; - cez = -cos(image->div/2.0) * klow; - philow = angle_between_2d(tl-cet, zl-cez, 0.0, 1.0); - - cet = -sin(image->div/2.0) * khigh; - cez = -cos(image->div/2.0) * khigh; - phihigh = angle_between_2d(tl-cet, zl-cez, 0.0, 1.0); - - /* Approximation: philow and phihigh are very similar */ - phi = (philow + phihigh) / 2.0; - - azi = atan2(yl, xl); - - /* For many gradients, just multiply the above number by the gradient - * of excitation error wrt whatever. */ - switch ( k ) { + double D, psph, ds; + signed int hs, ks, ls; - /* Cell parameters and orientation */ - case REF_ASX : - return - hs * sin(phi) * cos(azi) * (glow-ghigh); - - case REF_BSX : - return - ks * sin(phi) * cos(azi) * (glow-ghigh); - - case REF_CSX : - return - ls * sin(phi) * cos(azi) * (glow-ghigh); - - case REF_ASY : - return - hs * sin(phi) * sin(azi) * (glow-ghigh); - - case REF_BSY : - return - ks * sin(phi) * sin(azi) * (glow-ghigh); - - case REF_CSY : - return - ls * sin(phi) * sin(azi) * (glow-ghigh); - - case REF_ASZ : - return - hs * cos(phi) * (glow-ghigh); - - case REF_BSZ : - return - ks * cos(phi) * (glow-ghigh); - - case REF_CSZ : - return - ls * cos(phi) * (glow-ghigh); - - case REF_DIV : D = rlow - rhigh; psph = volume_fraction(rlow, rhigh, R, pmodel); + get_symmetric_indices(refl, &hs, &ks, &ls); + ds = 2.0 * resolution(crystal_get_cell(cr), hs, ks, ls); + return (ds/2.0)*(glow+ghigh) - 4.0*R*psph*ds/(3.0*D*D); } - ERROR("No gradient defined for parameter %i\n", k); - abort(); + return r_gradient(crystal_get_cell(cr), k, refl, image) * (glow-ghigh); } @@ -302,15 +237,15 @@ static void apply_cell_shift(UnitCell *cell, int k, double shift) switch ( k ) { - case REF_ASX : asx += shift; break; - case REF_ASY : asy += shift; break; - case REF_ASZ : asz += shift; break; - case REF_BSX : bsx += shift; break; - case REF_BSY : bsy += shift; break; - case REF_BSZ : bsz += shift; break; - case REF_CSX : csx += shift; break; - case REF_CSY : csy += shift; break; - case REF_CSZ : csz += shift; break; + case GPARAM_ASX : asx += shift; break; + case GPARAM_ASY : asy += shift; break; + case GPARAM_ASZ : asz += shift; break; + case GPARAM_BSX : bsx += shift; break; + case GPARAM_BSY : bsy += shift; break; + case GPARAM_BSZ : bsz += shift; break; + case GPARAM_CSX : csx += shift; break; + case GPARAM_CSY : csy += shift; break; + case GPARAM_CSZ : csz += shift; break; } cell_set_reciprocal(cell, asx, asy, asz, @@ -327,7 +262,7 @@ static void apply_shift(Crystal *cr, int k, double shift) switch ( k ) { - case REF_DIV : + case GPARAM_DIV : if ( isnan(shift) ) { ERROR("NaN divergence shift\n"); } else { @@ -336,21 +271,21 @@ static void apply_shift(Crystal *cr, int k, double shift) } break; - case REF_R : + case GPARAM_R : t = crystal_get_profile_radius(cr); t += shift; crystal_set_profile_radius(cr, t); break; - case REF_ASX : - case REF_ASY : - case REF_ASZ : - case REF_BSX : - case REF_BSY : - case REF_BSZ : - case REF_CSX : - case REF_CSY : - case REF_CSZ : + case GPARAM_ASX : + case GPARAM_ASY : + case GPARAM_ASZ : + case GPARAM_BSX : + case GPARAM_BSY : + case GPARAM_BSZ : + case GPARAM_CSX : + case GPARAM_CSY : + case GPARAM_CSZ : apply_cell_shift(crystal_get_cell(cr), k, shift); break; diff --git a/src/post-refinement.h b/src/post-refinement.h index a9c79ed6..caf5f9af 100644 --- a/src/post-refinement.h +++ b/src/post-refinement.h @@ -43,24 +43,6 @@ #include "geometry.h" -/* Refineable parameters. - * Don't forget to add new things to backup_crystal() et al.! */ -enum { - REF_ASX, - REF_ASY, - REF_ASZ, - REF_BSX, - REF_BSY, - REF_BSZ, - REF_CSX, - REF_CSY, - REF_CSZ, - NUM_PARAMS, - REF_R, - REF_DIV, -}; - - struct prdata { int refined; diff --git a/src/predict-refine.c b/src/predict-refine.c index 6af9211f..a2a4ce53 100644 --- a/src/predict-refine.c +++ b/src/predict-refine.c @@ -37,7 +37,7 @@ #include <gsl/gsl_vector.h> #include "image.h" -#include "post-refinement.h" +#include "geometry.h" #include "cell-utils.h" @@ -127,86 +127,6 @@ static void twod_mapping(double fs, double ss, double *px, double *py, } -static double r_gradient(UnitCell *cell, int k, Reflection *refl, - struct image *image) -{ - double azi; - double asx, asy, asz; - double bsx, bsy, bsz; - double csx, csy, csz; - double xl, yl, zl; - signed int hs, ks, ls; - double rlow, rhigh, p; - double philow, phihigh, phi; - double khigh, klow; - double tl, cet, cez; - - get_partial(refl, &rlow, &rhigh, &p); - - get_symmetric_indices(refl, &hs, &ks, &ls); - - cell_get_reciprocal(cell, &asx, &asy, &asz, - &bsx, &bsy, &bsz, - &csx, &csy, &csz); - xl = hs*asx + ks*bsx + ls*csx; - yl = hs*asy + ks*bsy + ls*csy; - zl = hs*asz + ks*bsz + ls*csz; - - /* "low" gives the largest Ewald sphere (wavelength short => k large) - * "high" gives the smallest Ewald sphere (wavelength long => k small) - */ - klow = 1.0/(image->lambda - image->lambda*image->bw/2.0); - khigh = 1.0/(image->lambda + image->lambda*image->bw/2.0); - - tl = sqrt(xl*xl + yl*yl); - - cet = -sin(image->div/2.0) * klow; - cez = -cos(image->div/2.0) * klow; - philow = angle_between_2d(tl-cet, zl-cez, 0.0, 1.0); - - cet = -sin(image->div/2.0) * khigh; - cez = -cos(image->div/2.0) * khigh; - phihigh = angle_between_2d(tl-cet, zl-cez, 0.0, 1.0); - - /* Approximation: philow and phihigh are very similar */ - phi = (philow + phihigh) / 2.0; - - azi = atan2(yl, xl); - - switch ( k ) { - - case REF_ASX : - return - hs * sin(phi) * cos(azi); - - case REF_BSX : - return - ks * sin(phi) * cos(azi); - - case REF_CSX : - return - ls * sin(phi) * cos(azi); - - case REF_ASY : - return - hs * sin(phi) * sin(azi); - - case REF_BSY : - return - ks * sin(phi) * sin(azi); - - case REF_CSY : - return - ls * sin(phi) * sin(azi); - - case REF_ASZ : - return - hs * cos(phi); - - case REF_BSZ : - return - ks * cos(phi); - - case REF_CSZ : - return - ls * cos(phi); - - } - - ERROR("No gradient defined for parameter %i\n", k); - abort(); -} /* Returns d(xh-xpk)/dP + d(yh-ypk)/dP, where P = any parameter */ @@ -230,31 +150,31 @@ static double x_gradient(int param, struct reflpeak *rp, struct detector *det, switch ( param ) { - case REF_ASX : + case GPARAM_ASX : return h * lambda * clen / cos(tt); - case REF_BSX : + case GPARAM_BSX : return k * lambda * clen / cos(tt); - case REF_CSX : + case GPARAM_CSX : return l * lambda * clen / cos(tt); - case REF_ASY : + case GPARAM_ASY : return 0.0; - case REF_BSY : + case GPARAM_BSY : return 0.0; - case REF_CSY : + case GPARAM_CSY : return 0.0; - case REF_ASZ : + case GPARAM_ASZ : return -h * lambda * clen * azf * sin(tt) / (cos(tt)*cos(tt)); - case REF_BSZ : + case GPARAM_BSZ : return -k * lambda * clen * azf * sin(tt) / (cos(tt)*cos(tt)); - case REF_CSZ : + case GPARAM_CSZ : return -l * lambda * clen * azf * sin(tt) / (cos(tt)*cos(tt)); } @@ -285,31 +205,31 @@ static double y_gradient(int param, struct reflpeak *rp, struct detector *det, switch ( param ) { - case REF_ASX : + case GPARAM_ASX : return 0.0; - case REF_BSX : + case GPARAM_BSX : return 0.0; - case REF_CSX : + case GPARAM_CSX : return 0.0; - case REF_ASY : + case GPARAM_ASY : return h * lambda * clen / cos(tt); - case REF_BSY : + case GPARAM_BSY : return k * lambda * clen / cos(tt); - case REF_CSY : + case GPARAM_CSY : return l * lambda * clen / cos(tt); - case REF_ASZ : + case GPARAM_ASZ : return -h * lambda * clen * azf * sin(tt) / (cos(tt)*cos(tt)); - case REF_BSZ : + case GPARAM_BSZ : return -k * lambda * clen * azf * sin(tt) / (cos(tt)*cos(tt)); - case REF_CSZ : + case GPARAM_CSZ : return -l * lambda * clen * azf * sin(tt) / (cos(tt)*cos(tt)); } diff --git a/tests/pr_p_gradient_check.c b/tests/pr_p_gradient_check.c index cedfc9dc..affddeab 100644 --- a/tests/pr_p_gradient_check.c +++ b/tests/pr_p_gradient_check.c @@ -93,15 +93,15 @@ static UnitCell *new_shifted_cell(UnitCell *input, int k, double shift) &csx, &csy, &csz); switch ( k ) { - case REF_ASX : asx += shift; break; - case REF_ASY : asy += shift; break; - case REF_ASZ : asz += shift; break; - case REF_BSX : bsx += shift; break; - case REF_BSY : bsy += shift; break; - case REF_BSZ : bsz += shift; break; - case REF_CSX : csx += shift; break; - case REF_CSY : csy += shift; break; - case REF_CSZ : csz += shift; break; + case GPARAM_ASX : asx += shift; break; + case GPARAM_ASY : asy += shift; break; + case GPARAM_ASZ : asz += shift; break; + case GPARAM_BSX : bsx += shift; break; + case GPARAM_BSY : bsy += shift; break; + case GPARAM_BSZ : bsz += shift; break; + case GPARAM_CSX : csx += shift; break; + case GPARAM_CSY : csy += shift; break; + case GPARAM_CSZ : csz += shift; break; } cell_set_reciprocal(cell, asx, asy, asz, bsx, bsy, bsz, csx, csy, csz); @@ -113,7 +113,7 @@ static void shift_parameter(struct image *image, int k, double shift) { switch ( k ) { - case REF_DIV : image->div += shift; break; + case GPARAM_DIV : image->div += shift; break; } } @@ -135,21 +135,21 @@ static Crystal *new_shifted_crystal(Crystal *cr, int refine, double incr_val) switch ( refine ) { - case REF_ASX : - case REF_ASY : - case REF_ASZ : - case REF_BSX : - case REF_BSY : - case REF_BSZ : - case REF_CSX : - case REF_CSY : - case REF_CSZ : + case GPARAM_ASX : + case GPARAM_ASY : + case GPARAM_ASZ : + case GPARAM_BSX : + case GPARAM_BSY : + case GPARAM_BSZ : + case GPARAM_CSX : + case GPARAM_CSY : + case GPARAM_CSZ : cell = new_shifted_cell(crystal_get_cell(cr), refine, incr_val); crystal_set_cell(cr_new, cell); break; - case REF_R : + case GPARAM_R : cell = cell_new_from_cell(crystal_get_cell(cr)); crystal_set_cell(cr_new, cell); crystal_set_profile_radius(cr_new, r + incr_val); @@ -172,7 +172,7 @@ static void calc_either_side(Crystal *cr, double incr_val, RefList *compare; struct image *image = crystal_get_image(cr); - if ( (refine != REF_DIV) ) { + if ( (refine != GPARAM_DIV) ) { Crystal *cr_new; @@ -465,51 +465,51 @@ int main(int argc, char *argv[]) &bz, &cx, &cy, &cz); incr_val = incr_frac * image.div; - val = test_gradients(cr, incr_val, REF_DIV, "div", "div", + val = test_gradients(cr, incr_val, GPARAM_DIV, "div", "div", pmodel, quiet, plot); if ( val < 0.99 ) fail = 1; incr_val = incr_frac * crystal_get_profile_radius(cr); - val = test_gradients(cr, incr_val, REF_R, "R", "R", pmodel, + val = test_gradients(cr, incr_val, GPARAM_R, "R", "R", pmodel, quiet, plot); if ( val < 0.99 ) fail = 1; incr_val = incr_frac * ax; - val = test_gradients(cr, incr_val, REF_ASX, "ax*", "x", pmodel, + val = test_gradients(cr, incr_val, GPARAM_ASX, "ax*", "x", pmodel, quiet, plot); if ( val < 0.99 ) fail = 1; incr_val = incr_frac * bx; - val = test_gradients(cr, incr_val, REF_BSX, "bx*", "x", pmodel, + val = test_gradients(cr, incr_val, GPARAM_BSX, "bx*", "x", pmodel, quiet, plot); if ( val < 0.99 ) fail = 1; incr_val = incr_frac * cx; - val = test_gradients(cr, incr_val, REF_CSX, "cx*", "x", pmodel, + val = test_gradients(cr, incr_val, GPARAM_CSX, "cx*", "x", pmodel, quiet, plot); if ( val < 0.99 ) fail = 1; incr_val = incr_frac * ay; - val = test_gradients(cr, incr_val, REF_ASY, "ay*", "y", pmodel, + val = test_gradients(cr, incr_val, GPARAM_ASY, "ay*", "y", pmodel, quiet, plot); if ( val < 0.99 ) fail = 1; incr_val = incr_frac * by; - val = test_gradients(cr, incr_val, REF_BSY, "by*", "y", pmodel, + val = test_gradients(cr, incr_val, GPARAM_BSY, "by*", "y", pmodel, quiet, plot); if ( val < 0.99 ) fail = 1; incr_val = incr_frac * cy; - val = test_gradients(cr, incr_val, REF_CSY, "cy*", "y", pmodel, + val = test_gradients(cr, incr_val, GPARAM_CSY, "cy*", "y", pmodel, quiet, plot); if ( val < 0.99 ) fail = 1; incr_val = incr_frac * az; - val = test_gradients(cr, incr_val, REF_ASZ, "az*", "z", pmodel, + val = test_gradients(cr, incr_val, GPARAM_ASZ, "az*", "z", pmodel, quiet, plot); if ( val < 0.99 ) fail = 1; incr_val = incr_frac * bz; - val = test_gradients(cr, incr_val, REF_BSZ, "bz*", "z", pmodel, + val = test_gradients(cr, incr_val, GPARAM_BSZ, "bz*", "z", pmodel, quiet, plot); if ( val < 0.99 ) fail = 1; incr_val = incr_frac * cz; - val = test_gradients(cr, incr_val, REF_CSZ, "cz*", "z", pmodel, + val = test_gradients(cr, incr_val, GPARAM_CSZ, "cz*", "z", pmodel, quiet, plot); if ( val < 0.99 ) fail = 1; diff --git a/tests/prediction_gradient_check.c b/tests/prediction_gradient_check.c index 486e4ce1..21c4088e 100644 --- a/tests/prediction_gradient_check.c +++ b/tests/prediction_gradient_check.c @@ -110,15 +110,15 @@ static UnitCell *new_shifted_cell(UnitCell *input, int k, double shift) &csx, &csy, &csz); switch ( k ) { - case REF_ASX : asx += shift; break; - case REF_ASY : asy += shift; break; - case REF_ASZ : asz += shift; break; - case REF_BSX : bsx += shift; break; - case REF_BSY : bsy += shift; break; - case REF_BSZ : bsz += shift; break; - case REF_CSX : csx += shift; break; - case REF_CSY : csy += shift; break; - case REF_CSZ : csz += shift; break; + case GPARAM_ASX : asx += shift; break; + case GPARAM_ASY : asy += shift; break; + case GPARAM_ASZ : asz += shift; break; + case GPARAM_BSX : bsx += shift; break; + case GPARAM_BSY : bsy += shift; break; + case GPARAM_BSZ : bsz += shift; break; + case GPARAM_CSX : csx += shift; break; + case GPARAM_CSY : csy += shift; break; + case GPARAM_CSZ : csz += shift; break; } cell_set_reciprocal(cell, asx, asy, asz, bsx, bsy, bsz, csx, csy, csz); @@ -141,15 +141,15 @@ static Crystal *new_shifted_crystal(Crystal *cr, int refine, double incr_val) switch ( refine ) { - case REF_ASX : - case REF_ASY : - case REF_ASZ : - case REF_BSX : - case REF_BSY : - case REF_BSZ : - case REF_CSX : - case REF_CSY : - case REF_CSZ : + case GPARAM_ASX : + case GPARAM_ASY : + case GPARAM_ASZ : + case GPARAM_BSX : + case GPARAM_BSY : + case GPARAM_BSZ : + case GPARAM_CSX : + case GPARAM_CSY : + case GPARAM_CSZ : cell = new_shifted_cell(crystal_get_cell(cr), refine, incr_val); crystal_set_cell(cr_new, cell); @@ -468,41 +468,41 @@ int main(int argc, char *argv[]) &bx, &by, &bz, &cx, &cy, &cz); incr_val = incr_frac * ax; - val = test_gradients(cr, incr_val, REF_ASX, "ax*", "ax", + val = test_gradients(cr, incr_val, GPARAM_ASX, "ax*", "ax", quiet, plot); if ( val < 0.99 ) fail = 1; incr_val = incr_frac * bx; - val = test_gradients(cr, incr_val, REF_BSX, "bx*", "bx", + val = test_gradients(cr, incr_val, GPARAM_BSX, "bx*", "bx", quiet, plot); if ( val < 0.99 ) fail = 1; incr_val = incr_frac * cx; - val = test_gradients(cr, incr_val, REF_CSX, "cx*", "cx", + val = test_gradients(cr, incr_val, GPARAM_CSX, "cx*", "cx", quiet, plot); if ( val < 0.99 ) fail = 1; incr_val = incr_frac * ay; - val = test_gradients(cr, incr_val, REF_ASY, "ay*", "ay", + val = test_gradients(cr, incr_val, GPARAM_ASY, "ay*", "ay", quiet, plot); if ( val < 0.99 ) fail = 1; incr_val = incr_frac * by; - val = test_gradients(cr, incr_val, REF_BSY, "by*", "by", + val = test_gradients(cr, incr_val, GPARAM_BSY, "by*", "by", quiet, plot); if ( val < 0.99 ) fail = 1; incr_val = incr_frac * cy; - val = test_gradients(cr, incr_val, REF_CSY, "cy*", "cy", + val = test_gradients(cr, incr_val, GPARAM_CSY, "cy*", "cy", quiet, plot); if ( val < 0.99 ) fail = 1; incr_val = incr_frac * az; - val = test_gradients(cr, incr_val, REF_ASZ, "az*", "az", + val = test_gradients(cr, incr_val, GPARAM_ASZ, "az*", "az", quiet, plot); if ( val < 0.99 ) fail = 1; incr_val = incr_frac * bz; - val = test_gradients(cr, incr_val, REF_BSZ, "bz*", "bz", + val = test_gradients(cr, incr_val, GPARAM_BSZ, "bz*", "bz", quiet, plot); if ( val < 0.99 ) fail = 1; incr_val = incr_frac * cz; - val = test_gradients(cr, incr_val, REF_CSZ, "cz*", "cz", + val = test_gradients(cr, incr_val, GPARAM_CSZ, "cz*", "cz", quiet, plot); if ( val < 0.99 ) fail = 1; |