From d21f2eb608431cd11b93aa96de3c792713829b44 Mon Sep 17 00:00:00 2001 From: Thomas White Date: Tue, 6 Mar 2012 16:10:53 +0100 Subject: Don't include 1/d in reflection lists, because it's pointless --- libcrystfel/src/reflist-utils.c | 37 +++++++++++-------------------------- libcrystfel/src/reflist-utils.h | 4 ++-- libcrystfel/src/stream.c | 3 +-- scripts/gen-sfs | 8 +++----- scripts/gen-sfs-ano | 7 +++---- src/get_hkl.c | 19 +------------------ src/partial_sim.c | 2 +- src/partialator.c | 2 +- src/process_hkl.c | 2 +- 9 files changed, 24 insertions(+), 60 deletions(-) diff --git a/libcrystfel/src/reflist-utils.c b/libcrystfel/src/reflist-utils.c index 8f445ff4..f8d14d7a 100644 --- a/libcrystfel/src/reflist-utils.c +++ b/libcrystfel/src/reflist-utils.c @@ -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; } diff --git a/libcrystfel/src/reflist-utils.h b/libcrystfel/src/reflist-utils.h index f03be906..b12b8dfa 100644 --- a/libcrystfel/src/reflist-utils.h +++ b/libcrystfel/src/reflist-utils.h @@ -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); diff --git a/libcrystfel/src/stream.c b/libcrystfel/src/stream.c index 7f2e341e..486049bf 100644 --- a/libcrystfel/src/stream.c +++ b/libcrystfel/src/stream.c @@ -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 { diff --git a/scripts/gen-sfs b/scripts/gen-sfs index bf86fb01..619ac08f 100755 --- a/scripts/gen-sfs +++ b/scripts/gen-sfs @@ -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 = ) { @@ -63,9 +62,8 @@ while ( \$line = ) { 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); diff --git a/scripts/gen-sfs-ano b/scripts/gen-sfs-ano index 522e0a6d..05eb69d2 100755 --- a/scripts/gen-sfs-ano +++ b/scripts/gen-sfs-ano @@ -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 = ) { @@ -62,10 +61,10 @@ while ( \$line = ) { 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); diff --git a/src/get_hkl.c b/src/get_hkl.c index c1310418..905da569 100644 --- a/src/get_hkl.c +++ b/src/get_hkl.c @@ -77,8 +77,6 @@ static void show_help(const char *s) "\n" "Don't forget to specify the output filename:\n" " -o, --output= Output filename (default: stdout).\n" -" -p, --pdb= 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); diff --git a/src/partial_sim.c b/src/partial_sim.c index b9cb69e5..90e29ce4 100644 --- a/src/partial_sim.c +++ b/src/partial_sim.c @@ -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 ) { diff --git a/src/partialator.c b/src/partialator.c index a834aeb3..eb2a8e52 100644 --- a/src/partialator.c +++ b/src/partialator.c @@ -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