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

Don't include 1/d in reflection lists, because it's pointless

parent 3710defb
......@@ -152,23 +152,20 @@ int find_equiv_in_list(RefList *list, signed int h, signed int k,
* write_reflections_to_file:
* @fh: File handle to write to
* @list: The reflection list to write
* @cell: Unit cell to use for generating 1/d values, or NULL.
*
* This function writes the contents of @list to @fh, using @cell to generate
* 1/d values to ease later processing. If @cell is NULL, 1/d values will not
* be included ('-' will be written in their place).
* This function writes the contents of @list to @fh,
*
* Reflections which have a redundancy of zero will not be written.
*
* The resulting list can be read back with read_reflections_from_file().
**/
void write_reflections_to_file(FILE *fh, RefList *list, UnitCell *cell)
void write_reflections_to_file(FILE *fh, RefList *list)
{
Reflection *refl;
RefListIterator *iter;
fprintf(fh, " h k l I phase sigma(I) "
" 1/d(nm^-1) counts fs/px ss/px\n");
" counts fs/px ss/px\n");
for ( refl = first_refl(list, &iter);
refl != NULL;
......@@ -193,13 +190,6 @@ void write_reflections_to_file(FILE *fh, RefList *list, UnitCell *cell)
/* Reflections with redundancy = 0 are not written */
if ( red == 0 ) continue;
if ( cell != NULL ) {
s = 2.0 * resolution(cell, h, k, l);
snprintf(res, 16, "%10.2f", s/1e9);
} else {
strcpy(res, " -");
}
if ( have_phase ) {
snprintf(phs, 16, "%8.2f", rad2deg(ph));
} else {
......@@ -207,9 +197,8 @@ void write_reflections_to_file(FILE *fh, RefList *list, UnitCell *cell)
}
fprintf(fh,
"%3i %3i %3i %10.2f %s %10.2f %s %7i %6.1f %6.1f\n",
h, k, l, intensity, phs, esd_i, res, red,
fs, ss);
"%3i %3i %3i %10.2f %s %10.2f %7i %6.1f %6.1f\n",
h, k, l, intensity, phs, esd_i, red, fs, ss);
}
}
......@@ -219,11 +208,8 @@ void write_reflections_to_file(FILE *fh, RefList *list, UnitCell *cell)
* write_reflist:
* @filename: Filename
* @list: The reflection list to write
* @cell: Unit cell to use for generating 1/d values, or NULL.
*
* This function writes the contents of @list to @file, using @cell to generate
* 1/d values to ease later processing. If @cell is NULL, 1/d values will not
* be included ('-' will be written in their place).
* This function writes the contents of @list to @file,
*
* Reflections which have a redundancy of zero will not be written.
*
......@@ -235,7 +221,7 @@ void write_reflections_to_file(FILE *fh, RefList *list, UnitCell *cell)
*
* Returns: zero on success, non-zero on failure.
**/
int write_reflist(const char *filename, RefList *list, UnitCell *cell)
int write_reflist(const char *filename, RefList *list)
{
FILE *fh;
......@@ -250,7 +236,7 @@ int write_reflist(const char *filename, RefList *list, UnitCell *cell)
return 1;
}
write_reflections_to_file(fh, list, cell);
write_reflections_to_file(fh, list);
fprintf(fh, REFLECTION_END_MARKER"\n");
fclose(fh);
......@@ -284,10 +270,9 @@ RefList *read_reflections_from_file(FILE *fh)
if ( strcmp(line, REFLECTION_END_MARKER) == 0 ) return out;
r = sscanf(line, "%i %i %i %f %s %f %s %i %f %f",
&h, &k, &l, &intensity, phs, &sigma, ress, &cts,
&fs, &ss);
if ( (r != 10) && (!first) ) {
r = sscanf(line, "%i %i %i %f %s %f %i %f %f",
&h, &k, &l, &intensity, phs, &sigma, &cts, &fs, &ss);
if ( (r != 9) && (!first) ) {
reflist_free(out);
return NULL;
}
......
......@@ -38,9 +38,9 @@
#define REFLECTION_END_MARKER "End of reflections"
extern void write_reflections_to_file(FILE *fh, RefList *list, UnitCell *cell);
extern void write_reflections_to_file(FILE *fh, RefList *list);
extern int write_reflist(const char *filename, RefList *list, UnitCell *cell);
extern int write_reflist(const char *filename, RefList *list);
extern RefList *read_reflections_from_file(FILE *fh);
......
......@@ -285,8 +285,7 @@ void write_chunk(FILE *ofh, struct image *i, struct hdfile *hdfile, int f)
if ( i->reflections != NULL ) {
fprintf(ofh, REFLECTION_START_MARKER"\n");
write_reflections_to_file(ofh, i->reflections,
i->indexed_cell);
write_reflections_to_file(ofh, i->reflections);
fprintf(ofh, REFLECTION_END_MARKER"\n");
} else {
......
......@@ -50,8 +50,7 @@ use strict;
my \$line;
open(FILE, "${PDB}-temp.hkl");
printf(" h k l I phase sigma(I) 1/d(nm^-1) ".
"counts fs/px ss/px\\n");
printf(" h k l I phase sigma(I) counts fs/px ss/px\\n");
while ( \$line = <FILE> ) {
......@@ -63,9 +62,8 @@ while ( \$line = <FILE> ) {
my \$intensity = \$4*\$4; # Square to convert F->I
my \$phase = \$5;
printf("%3i %3i %3i %10.2f %8.2f %10.2f %s %7i %6.1f %6.1f\n",
\$h, \$k, \$l, \$intensity, \$phase, 0.0,
" -", 1, 0.0, 0.0);
printf("%3i %3i %3i %10.2f %8.2f %10.2f %7i %6.1f %6.1f\n",
\$h, \$k, \$l, \$intensity, \$phase, 0.0, 1, 0.0, 0.0);
} else {
printf(STDERR "Couldn't understand line '%s'\n", \$line);
......
......@@ -48,8 +48,7 @@ use strict;
my \$line;
open(FILE, "${PDB}-temp1.hkl");
printf(" h k l I phase sigma(I) 1/d(nm^-1) ".
"counts fs/px ss/px\\n");
printf(" h k l I phase sigma(I) counts fs/px ss/px\\n");
while ( \$line = <FILE> ) {
......@@ -62,10 +61,10 @@ while ( \$line = <FILE> ) {
my \$iminus = \$5*\$5;
printf("%3i %3i %3i %10.2f - 0.0 %s %7i %6.1f %6.1f\n",
\$h, \$k, \$l, \$iplus, " -", 1, 0.0, 0.0);
\$h, \$k, \$l, \$iplus, 1, 0.0, 0.0);
printf("%3i %3i %3i %10.2f - 0.0 %s %7i %6.1f %6.1f\n",
-\$h, -\$k, -\$l, \$iminus, " -", 1, 0.0, 0.0);
-\$h, -\$k, -\$l, \$iminus, 1, 0.0, 0.0);
} else {
printf(STDERR "Couldn't understand line '%s'\n", \$line);
......
......@@ -77,8 +77,6 @@ static void show_help(const char *s)
"\n"
"Don't forget to specify the output filename:\n"
" -o, --output=<filename> Output filename (default: stdout).\n"
" -p, --pdb=<filename> Use unit cell parameters from this PDB file to\n"
" generate resolution values in the output file.\n"
);
}
......@@ -364,7 +362,6 @@ int main(int argc, char *argv[])
char *beamfile = NULL;
struct beam_params *beam = NULL;
RefList *input;
UnitCell *cell = NULL;
/* Long options */
const struct option longopts[] = {
......@@ -379,7 +376,6 @@ int main(int argc, char *argv[])
{"intensities", 1, NULL, 'i'},
{"multiplicity", 0, &config_multi, 1},
{"beam", 1, NULL, 'b'},
{"pdb", 1, NULL, 'p'},
{"trim-centrics", 0, &config_trimc, 1},
{0, 0, NULL, 0}
};
......@@ -421,14 +417,6 @@ int main(int argc, char *argv[])
beamfile = strdup(optarg);
break;
case 'p' :
cell = load_cell_from_pdb(optarg);
if ( cell == NULL ) {
ERROR("Failed to get cell from '%s'\n", optarg);
return 1;
}
break;
case 0 :
break;
......@@ -453,11 +441,6 @@ int main(int argc, char *argv[])
}
}
if ( cell == NULL ) {
ERROR("You need to give a PDB file with the unit cell.\n");
return 1;
}
if ( holo_str != NULL ) {
holo = get_pointgroup(holo_str);
free(holo_str);
......@@ -583,7 +566,7 @@ int main(int argc, char *argv[])
}
write_reflist(output, input, cell);
write_reflist(output, input);
reflist_free(input);
......
......@@ -525,7 +525,7 @@ int main(int argc, char *argv[])
if ( random_intensities ) {
STATUS("Writing full intensities to %s\n", save_file);
write_reflist(save_file, full, cell);
write_reflist(save_file, full);
}
if ( phist_file != NULL ) {
......
......@@ -556,7 +556,7 @@ int main(int argc, char *argv[])
STATUS("%i images could not be refined on the last cycle.\n", n_dud);
/* Output results */
write_reflist(outfile, full, images[0].indexed_cell);
write_reflist(outfile, full);
/* Clean up */
for ( i=0; i<n_usable_patterns; i++ ) {
......
......@@ -617,7 +617,7 @@ int main(int argc, char *argv[])
hist_nbins);
}
write_reflist(output, model, NULL);
write_reflist(output, model);
fclose(fh);
......
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