aboutsummaryrefslogtreecommitdiff
path: root/src/scaling.c
diff options
context:
space:
mode:
authorThomas White <taw@physics.org>2018-05-02 17:37:12 +0200
committerThomas White <taw@physics.org>2018-05-07 10:08:02 +0200
commit294965d42b309e98c8952d3a5dea753af21713a6 (patch)
tree99bcc1c0b243d1bc2294595aa69f0c0da297fb79 /src/scaling.c
parent73675c8c4cb66245758b705f35255b80b6c8d743 (diff)
Preparation for adjusting B factor during post-refinement
Add --no-Bscale option to partialator, and pass down as far as needed residual() no longer does scaling: call scale_one_crystal() first if necessary scale_one() replaces old linear_scale() function to scale a pair of RefLists (but so far does the same as the old function)
Diffstat (limited to 'src/scaling.c')
-rw-r--r--src/scaling.c27
1 files changed, 22 insertions, 5 deletions
diff --git a/src/scaling.c b/src/scaling.c
index 39541926..5f896e65 100644
--- a/src/scaling.c
+++ b/src/scaling.c
@@ -389,7 +389,7 @@ static double total_log_r(Crystal **crystals, int n_crystals, RefList *full,
/* Perform iterative scaling, all the way to convergence */
-void scale_all(Crystal **crystals, int n_crystals, int nthreads)
+void scale_all(Crystal **crystals, int n_crystals, int nthreads, int no_Bscale)
{
struct scale_args task_defaults;
struct queue_args qargs;
@@ -448,10 +448,11 @@ void scale_all(Crystal **crystals, int n_crystals, int nthreads)
}
-/* Calculates G, by which list2 should be multiplied to fit list1 */
-int linear_scale(const RefList *list1, const RefList *list2, double *G,
- int complain_loudly)
+/* Calculates G and B, by which list2 should be multiplied to fit list1 */
+int scale_one(const RefList *list1, const RefList *list2, int flags,
+ double *G, double *B)
{
+ int complain_loudly = 0;
const Reflection *refl1;
const Reflection *refl2;
RefListIterator *iter;
@@ -474,6 +475,8 @@ int linear_scale(const RefList *list1, const RefList *list2, double *G,
int n_part = 0;
int n_nom = 0;
+ *B = 0.0; /* FIXME */
+
x = malloc(max_n*sizeof(double));
w = malloc(max_n*sizeof(double));
y = malloc(max_n*sizeof(double));
@@ -556,6 +559,7 @@ int linear_scale(const RefList *list1, const RefList *list2, double *G,
if ( r ) {
ERROR("Scaling failed.\n");
+ *G = 1.0;
return 1;
}
@@ -567,7 +571,7 @@ int linear_scale(const RefList *list1, const RefList *list2, double *G,
int i;
for ( i=0; i<n; i++ ) {
STATUS("%i %e %e %e\n", i, x[i], y[i], w[n]);
- }
+ }
}
}
@@ -582,3 +586,16 @@ int linear_scale(const RefList *list1, const RefList *list2, double *G,
return 0;
}
+
+int scale_one_crystal(Crystal *cr, const RefList *list2, int flags)
+{
+ double G, B;
+ int r;
+
+ r = scale_one(crystal_get_reflections(cr), list2, flags, &G, &B);
+ if ( r ) return r;
+
+ crystal_set_osf(cr, G);
+ crystal_set_Bfac(cr, B);
+ return 0;
+}