diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/diffraction.c | 8 | ||||
-rw-r--r-- | src/pattern_sim.c | 11 |
2 files changed, 11 insertions, 8 deletions
diff --git a/src/diffraction.c b/src/diffraction.c index 6383a8b4..8a50e115 100644 --- a/src/diffraction.c +++ b/src/diffraction.c @@ -146,25 +146,23 @@ static double sym_lookup_phase(const double *phases, signed int h, signed int k, signed int l) { int i; - double ret = 0.0; for ( i=0; i<num_equivs(sym, NULL); i++ ) { signed int he; signed int ke; signed int le; - double f, val; + double f; get_equiv(sym, NULL, i, h, k, l, &he, &ke, &le); f = (double)lookup_arr_flag(flags, he, ke, le); - val = lookup_arr_phase(phases, he, ke, le); - ret += f*val; + if ( f ) return lookup_arr_phase(phases, he, ke, le); } - return ret; + return 0.0; } diff --git a/src/pattern_sim.c b/src/pattern_sim.c index 2cbb616e..0889697d 100644 --- a/src/pattern_sim.c +++ b/src/pattern_sim.c @@ -100,22 +100,27 @@ static void show_help(const char *s) } -static double *intensities_from_list(RefList *list) +static double *intensities_from_list(RefList *list, SymOpList *sym) { Reflection *refl; RefListIterator *iter; double *out = new_arr_intensity(); + SymOpMask *m = new_symopmask(sym); + int neq = num_equivs(sym, NULL); for ( refl = first_refl(list, &iter); refl != NULL; refl = next_refl(refl, iter) ) { signed int h, k, l; + int eps; double intensity = get_intensity(refl); get_indices(refl, &h, &k, &l); + special_position(sym, m, h, k, l); + eps = neq / num_equivs(sym, m); - set_arr_intensity(out, h, k, l, intensity); + set_arr_intensity(out, h, k, l, intensity / eps); } @@ -529,7 +534,7 @@ int main(int argc, char *argv[]) } else { phases = NULL; } - intensities = intensities_from_list(reflections); + intensities = intensities_from_list(reflections, sym); phases = phases_from_list(reflections); flags = flags_from_list(reflections); |