aboutsummaryrefslogtreecommitdiff
path: root/src/reflist-utils.c
diff options
context:
space:
mode:
authorThomas White <taw@physics.org>2011-10-12 12:24:51 +0200
committerThomas White <taw@physics.org>2012-02-22 15:27:39 +0100
commit13257c9d5e5c0d06df4ed0bdcdbc2ba6c7acc6cd (patch)
tree7e4307d5fbf6dc49c26ada1a555e21e892ecf743 /src/reflist-utils.c
parentc479780bc2b15e2d095cdb13d69f372933a06597 (diff)
Rationalise handling of phases in RefList
Diffstat (limited to 'src/reflist-utils.c')
-rw-r--r--src/reflist-utils.c17
1 files changed, 13 insertions, 4 deletions
diff --git a/src/reflist-utils.c b/src/reflist-utils.c
index 4ad5fa1c..b64e9979 100644
--- a/src/reflist-utils.c
+++ b/src/reflist-utils.c
@@ -68,7 +68,7 @@ double *phases_from_list(RefList *list)
refl = next_refl(refl, iter) ) {
signed int h, k, l;
- double phase = get_phase(refl);
+ double phase = get_phase(refl, NULL);
get_indices(refl, &h, &k, &l);
@@ -230,16 +230,19 @@ void write_reflections_to_file(FILE *fh, RefList *list, UnitCell *cell)
refl = next_refl(refl, iter) ) {
signed int h, k, l;
- double intensity, esd_i, s;
+ double intensity, esd_i, s, ph;
int red;
double fs, ss;
char res[16];
+ char phs[16];
+ int have_phase;
get_indices(refl, &h, &k, &l);
get_detector_pos(refl, &fs, &ss);
intensity = get_intensity(refl);
esd_i = get_esd_intensity(refl);
red = get_redundancy(refl);
+ ph = get_phase(refl, &have_phase);
/* Reflections with redundancy = 0 are not written */
if ( red == 0 ) continue;
@@ -251,9 +254,15 @@ void write_reflections_to_file(FILE *fh, RefList *list, UnitCell *cell)
strcpy(res, " -");
}
+ if ( have_phase ) {
+ snprintf(phs, 16, "%8.2f", rad2deg(ph));
+ } else {
+ strncpy(phs, " -", 15);
+ }
+
fprintf(fh,
"%3i %3i %3i %10.2f %s %10.2f %s %7i %6.1f %6.1f\n",
- h, k, l, intensity, " -", esd_i, res, red,
+ h, k, l, intensity, phs, esd_i, res, red,
fs, ss);
}
@@ -350,7 +359,7 @@ RefList *read_reflections_from_file(FILE *fh)
set_redundancy(refl, cts);
ph = strtod(phs, &v);
- if ( v != NULL ) set_ph(refl, ph);
+ if ( v != NULL ) set_ph(refl, deg2rad(ph));
/* The 1/d value is actually ignored. */