Commit a48a07c1 authored by Thomas White's avatar Thomas White
Browse files

process_hkl: Add another type of scaling

parent 237f0f65
...@@ -304,6 +304,13 @@ static void merge_pattern(double *model, ReflItemList *observed, ...@@ -304,6 +304,13 @@ static void merge_pattern(double *model, ReflItemList *observed,
} }
enum {
SCALE_NONE,
SCALE_CONSTINT,
SCALE_TWOPASS
};
static void scale_intensities(const double *model, ReflItemList *model_items, static void scale_intensities(const double *model, ReflItemList *model_items,
double *new_pattern, ReflItemList *new_items, double *new_pattern, ReflItemList *new_items,
double f0, int f0_valid, const char *sym) double f0, int f0_valid, const char *sym)
...@@ -312,6 +319,7 @@ static void scale_intensities(const double *model, ReflItemList *model_items, ...@@ -312,6 +319,7 @@ static void scale_intensities(const double *model, ReflItemList *model_items,
double top = 0.0; double top = 0.0;
double bot = 0.0; double bot = 0.0;
unsigned int i; unsigned int i;
const int scaling = SCALE_CONSTINT;
for ( i=0; i<num_items(new_items); i++ ) { for ( i=0; i<num_items(new_items); i++ ) {
...@@ -322,20 +330,43 @@ static void scale_intensities(const double *model, ReflItemList *model_items, ...@@ -322,20 +330,43 @@ static void scale_intensities(const double *model, ReflItemList *model_items,
/* Get the next item in the list of new reflections */ /* Get the next item in the list of new reflections */
it = get_item(new_items, i); it = get_item(new_items, i);
/* Find the (only) partner in the model */ switch ( scaling ) {
find_unique_equiv(model_items, it->h, it->k, it->l, sym, case SCALE_TWOPASS :
&hu, &ku, &lu);
/* Find the (only) partner in the model */
find_unique_equiv(model_items, it->h, it->k, it->l, sym,
&hu, &ku, &lu);
i1 = lookup_intensity(model, hu, ku, lu);
i2 = lookup_intensity(new_pattern, it->h, it->k, it->l);
/* Calculate LSQ estimate of scaling factor */
top += i1 * i2;
bot += i2 * i2;
break;
case SCALE_CONSTINT :
/* Sum up the intensity in the pattern */
i2 = lookup_intensity(new_pattern, it->h, it->k, it->l);
top += i2;
i1 = lookup_intensity(model, hu, ku, lu); break;
i2 = lookup_intensity(new_pattern, it->h, it->k, it->l);
top += i1 * i2; }
bot += i2 * i2;
} }
s = top / bot; switch ( scaling ) {
if ( f0_valid ) printf("%f %f\n", s, f0); case SCALE_TWOPASS :
s = top / bot;
break;
case SCALE_CONSTINT :
s = 1000.0 / top;
break;
}
//if ( f0_valid ) printf("%f %f\n", s, f0);
/* Multiply the new pattern up by "s" */ /* Multiply the new pattern up by "s" */
for ( i=0; i<LIST_SIZE; i++ ) { for ( i=0; i<LIST_SIZE; i++ ) {
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment