diff options
author | Thomas White <taw@physics.org> | 2015-05-13 17:25:19 +0200 |
---|---|---|
committer | Thomas White <taw@physics.org> | 2015-05-19 13:57:52 +0200 |
commit | 6a9185eedebc6c2002b7d6ca2467d5e6a7f245f0 (patch) | |
tree | 5cb264d8553afe893345ec919def6900f1acb5a3 /src/post-refinement.c | |
parent | 5f52b9ffdc010e27d5e6b9972e4975dd06a01345 (diff) |
Gradients for logarithmic scaling
Diffstat (limited to 'src/post-refinement.c')
-rw-r--r-- | src/post-refinement.c | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/src/post-refinement.c b/src/post-refinement.c index 9cdb1856..3b584617 100644 --- a/src/post-refinement.c +++ b/src/post-refinement.c @@ -174,7 +174,7 @@ static double volume_fraction(double rlow, double rhigh, double pr, } -/* Return the gradient of pGexp(-Bs^2) wrt parameter 'k' given the current +/* Return the gradient of "fx" wrt parameter 'k' given the current * status of the crystal. */ double gradient(Crystal *cr, int k, Reflection *refl, PartialityModel pmodel) { @@ -185,19 +185,18 @@ double gradient(Crystal *cr, int k, Reflection *refl, PartialityModel pmodel) double osf = crystal_get_osf(cr); double gr; signed int hi, ki, li; - double s, B; + double s; get_indices(refl, &hi, &ki, &li); s = resolution(crystal_get_cell(cr), hi, ki, li); - B = crystal_get_Bfac(cr); get_partial(refl, &rlow, &rhigh, &p); if ( k == GPARAM_OSF ) { - return p*exp(-B*s*s); + return 1.0/osf; } if ( k == GPARAM_BFAC ) { - return -s*s*osf*p*exp(-B*s*s); + return -s*s; } if ( k == GPARAM_R ) { |