aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/partial_sim.c34
1 files changed, 18 insertions, 16 deletions
diff --git a/src/partial_sim.c b/src/partial_sim.c
index d6b5fb98..da7566d5 100644
--- a/src/partial_sim.c
+++ b/src/partial_sim.c
@@ -515,29 +515,31 @@ int main(int argc, char *argv[])
}
if ( phist_file != NULL ) {
+
fh = fopen(phist_file, "w");
- } else {
- fh = NULL;
- }
- if ( fh != NULL ) {
- for ( i=0; i<NBINS; i++ ) {
+ if ( fh != NULL ) {
- double rcen;
+ for ( i=0; i<NBINS; i++ ) {
- rcen = i/(double)NBINS*qargs.max_q
- + qargs.max_q/(2.0*NBINS);
- fprintf(fh, "%.2f %7li %.3f %.3f\n", rcen/1.0e9,
- qargs.n_ref[i],
- qargs.p_hist[i]/qargs.n_ref[i],
- qargs.p_max[i]);
+ double rcen;
- }
+ rcen = i/(double)NBINS*qargs.max_q
+ + qargs.max_q/(2.0*NBINS);
+ fprintf(fh, "%.2f %7li %.3f %.3f\n", rcen/1.0e9,
+ qargs.n_ref[i],
+ qargs.p_hist[i]/qargs.n_ref[i],
+ qargs.p_max[i]);
+
+ }
- fclose(fh);
+ fclose(fh);
+
+ } else {
+ ERROR("Failed to open file '%s' for writing.\n",
+ phist_file);
+ }
- } else {
- ERROR("Failed to open file '%s' for writing.\n", phist_file);
}
fclose(ofh);