mirror of
https://github.com/dnlbauer/WHAM.git
synced 2026-09-10 22:25:31 +00:00
fix multidimensional io
This commit is contained in:
@@ -1,101 +1,101 @@
|
||||
#x Free Energy Probability
|
||||
-3.108600 7.118166 0.003561
|
||||
-3.045800 5.331290 0.007290
|
||||
-2.983000 3.879241 0.013048
|
||||
-2.920200 2.968659 0.018796
|
||||
-2.857400 1.942494 0.028362
|
||||
-2.794600 1.418408 0.034994
|
||||
-2.731800 1.169398 0.038668
|
||||
-2.669000 0.843024 0.044073
|
||||
-2.606200 0.636021 0.047887
|
||||
-2.543400 0.720123 0.046299
|
||||
-2.480600 1.066434 0.040297
|
||||
-2.417800 1.509855 0.033734
|
||||
-2.355000 2.015549 0.027544
|
||||
-2.292200 2.226942 0.025306
|
||||
-2.229400 2.573176 0.022026
|
||||
-2.166600 2.591946 0.021861
|
||||
-2.103800 2.476835 0.022893
|
||||
-2.041000 2.513953 0.022555
|
||||
-1.978200 2.470032 0.022956
|
||||
-1.915400 2.227585 0.025299
|
||||
-1.852600 2.105310 0.026570
|
||||
-1.789800 1.778779 0.030286
|
||||
-1.727000 1.447127 0.034593
|
||||
-1.664200 0.906384 0.042968
|
||||
-1.601400 0.304263 0.054699
|
||||
-1.538600 0.247397 0.055960
|
||||
-1.475800 0.000000 0.061795
|
||||
-1.413000 0.536142 0.049843
|
||||
-1.350200 1.428046 0.034859
|
||||
-1.287400 2.398149 0.023627
|
||||
-1.224600 3.784647 0.013552
|
||||
-1.161800 5.696583 0.006297
|
||||
-1.099000 7.656158 0.002870
|
||||
-1.036200 9.955000 0.001142
|
||||
-0.973400 12.357407 0.000436
|
||||
-0.910600 14.954254 0.000154
|
||||
-0.847800 17.745327 0.000050
|
||||
-0.785000 20.559461 0.000016
|
||||
-0.722200 22.783560 0.000007
|
||||
-0.659400 25.175865 0.000003
|
||||
-0.596600 26.419980 0.000002
|
||||
-0.533800 27.885999 0.000001
|
||||
-0.471000 29.029334 0.000001
|
||||
-0.408200 30.366556 0.000000
|
||||
-0.345400 31.615252 0.000000
|
||||
-0.282600 32.781716 0.000000
|
||||
-0.219800 33.731378 0.000000
|
||||
-0.157000 34.476014 0.000000
|
||||
-0.094200 35.387300 0.000000
|
||||
-0.031400 35.579756 0.000000
|
||||
0.031400 35.520194 0.000000
|
||||
0.094200 35.344763 0.000000
|
||||
0.157000 34.886460 0.000000
|
||||
0.219800 33.633998 0.000000
|
||||
0.282600 32.686511 0.000000
|
||||
0.345400 31.211777 0.000000
|
||||
0.408200 29.680451 0.000000
|
||||
0.471000 28.032242 0.000001
|
||||
0.533800 26.439599 0.000002
|
||||
0.596600 24.432467 0.000003
|
||||
0.659400 22.309893 0.000008
|
||||
0.722200 20.186040 0.000019
|
||||
0.785000 18.295046 0.000040
|
||||
0.847800 16.221232 0.000093
|
||||
0.910600 14.251911 0.000204
|
||||
0.973400 12.562353 0.000402
|
||||
1.036200 11.184029 0.000698
|
||||
1.099000 10.040677 0.001103
|
||||
1.161800 9.369064 0.001444
|
||||
1.224600 9.095392 0.001612
|
||||
1.287400 9.256035 0.001511
|
||||
1.350200 9.814068 0.001208
|
||||
1.413000 10.945207 0.000768
|
||||
1.475800 12.518898 0.000409
|
||||
1.538600 14.409744 0.000191
|
||||
1.601400 16.451965 0.000084
|
||||
1.664200 18.589166 0.000036
|
||||
1.727000 20.669504 0.000016
|
||||
1.789800 22.804791 0.000007
|
||||
1.852600 24.531690 0.000003
|
||||
1.915400 26.182612 0.000002
|
||||
1.978200 27.279439 0.000001
|
||||
2.041000 28.571380 0.000001
|
||||
2.103800 29.328969 0.000000
|
||||
2.166600 29.897739 0.000000
|
||||
2.229400 30.320908 0.000000
|
||||
2.292200 30.065391 0.000000
|
||||
2.355000 29.809137 0.000000
|
||||
2.417800 29.340601 0.000000
|
||||
2.480600 28.473346 0.000001
|
||||
2.543400 27.679353 0.000001
|
||||
2.606200 26.453160 0.000002
|
||||
2.669000 24.424649 0.000003
|
||||
2.731800 22.285933 0.000008
|
||||
2.794600 19.958407 0.000021
|
||||
2.857400 17.606291 0.000053
|
||||
2.920200 15.420138 0.000128
|
||||
2.983000 13.069599 0.000328
|
||||
3.045800 11.036085 0.000740
|
||||
3.108600 9.015657 0.001664
|
||||
#coord1 Free Energy Probability
|
||||
-3.108600 7.118166 0.003561
|
||||
-3.045800 5.331290 0.007290
|
||||
-2.983000 3.879241 0.013048
|
||||
-2.920200 2.968659 0.018796
|
||||
-2.857400 1.942494 0.028362
|
||||
-2.794600 1.418408 0.034994
|
||||
-2.731800 1.169398 0.038668
|
||||
-2.669000 0.843024 0.044073
|
||||
-2.606200 0.636021 0.047887
|
||||
-2.543400 0.720123 0.046299
|
||||
-2.480600 1.066434 0.040297
|
||||
-2.417800 1.509855 0.033734
|
||||
-2.355000 2.015549 0.027544
|
||||
-2.292200 2.226942 0.025306
|
||||
-2.229400 2.573176 0.022026
|
||||
-2.166600 2.591946 0.021861
|
||||
-2.103800 2.476835 0.022893
|
||||
-2.041000 2.513953 0.022555
|
||||
-1.978200 2.470032 0.022956
|
||||
-1.915400 2.227585 0.025299
|
||||
-1.852600 2.105310 0.026570
|
||||
-1.789800 1.778779 0.030286
|
||||
-1.727000 1.447127 0.034593
|
||||
-1.664200 0.906384 0.042968
|
||||
-1.601400 0.304263 0.054699
|
||||
-1.538600 0.247397 0.055960
|
||||
-1.475800 0.000000 0.061795
|
||||
-1.413000 0.536142 0.049843
|
||||
-1.350200 1.428046 0.034859
|
||||
-1.287400 2.398149 0.023627
|
||||
-1.224600 3.784647 0.013552
|
||||
-1.161800 5.696583 0.006297
|
||||
-1.099000 7.656158 0.002870
|
||||
-1.036200 9.955000 0.001142
|
||||
-0.973400 12.357407 0.000436
|
||||
-0.910600 14.954254 0.000154
|
||||
-0.847800 17.745327 0.000050
|
||||
-0.785000 20.559461 0.000016
|
||||
-0.722200 22.783560 0.000007
|
||||
-0.659400 25.175865 0.000003
|
||||
-0.596600 26.419980 0.000002
|
||||
-0.533800 27.885999 0.000001
|
||||
-0.471000 29.029334 0.000001
|
||||
-0.408200 30.366556 0.000000
|
||||
-0.345400 31.615252 0.000000
|
||||
-0.282600 32.781716 0.000000
|
||||
-0.219800 33.731378 0.000000
|
||||
-0.157000 34.476014 0.000000
|
||||
-0.094200 35.387300 0.000000
|
||||
-0.031400 35.579756 0.000000
|
||||
0.031400 35.520194 0.000000
|
||||
0.094200 35.344763 0.000000
|
||||
0.157000 34.886460 0.000000
|
||||
0.219800 33.633998 0.000000
|
||||
0.282600 32.686511 0.000000
|
||||
0.345400 31.211777 0.000000
|
||||
0.408200 29.680451 0.000000
|
||||
0.471000 28.032242 0.000001
|
||||
0.533800 26.439599 0.000002
|
||||
0.596600 24.432467 0.000003
|
||||
0.659400 22.309893 0.000008
|
||||
0.722200 20.186040 0.000019
|
||||
0.785000 18.295046 0.000040
|
||||
0.847800 16.221232 0.000093
|
||||
0.910600 14.251911 0.000204
|
||||
0.973400 12.562353 0.000402
|
||||
1.036200 11.184029 0.000698
|
||||
1.099000 10.040677 0.001103
|
||||
1.161800 9.369064 0.001444
|
||||
1.224600 9.095392 0.001612
|
||||
1.287400 9.256035 0.001511
|
||||
1.350200 9.814068 0.001208
|
||||
1.413000 10.945207 0.000768
|
||||
1.475800 12.518898 0.000409
|
||||
1.538600 14.409744 0.000191
|
||||
1.601400 16.451965 0.000084
|
||||
1.664200 18.589166 0.000036
|
||||
1.727000 20.669504 0.000016
|
||||
1.789800 22.804791 0.000007
|
||||
1.852600 24.531690 0.000003
|
||||
1.915400 26.182612 0.000002
|
||||
1.978200 27.279439 0.000001
|
||||
2.041000 28.571380 0.000001
|
||||
2.103800 29.328969 0.000000
|
||||
2.166600 29.897739 0.000000
|
||||
2.229400 30.320908 0.000000
|
||||
2.292200 30.065391 0.000000
|
||||
2.355000 29.809137 0.000000
|
||||
2.417800 29.340601 0.000000
|
||||
2.480600 28.473346 0.000001
|
||||
2.543400 27.679353 0.000001
|
||||
2.606200 26.453160 0.000002
|
||||
2.669000 24.424649 0.000003
|
||||
2.731800 22.285933 0.000008
|
||||
2.794600 19.958407 0.000021
|
||||
2.857400 17.606291 0.000053
|
||||
2.920200 15.420138 0.000128
|
||||
2.983000 13.069599 0.000328
|
||||
3.045800 11.036085 0.000740
|
||||
3.108600 9.015657 0.001664
|
||||
|
||||
20002
example/2d/wham.out
20002
example/2d/wham.out
File diff suppressed because it is too large
Load Diff
10
src/io.rs
10
src/io.rs
@@ -176,16 +176,18 @@ fn read_window_file(window_file: &str, cfg: &Config) -> Option<Histogram> {
|
||||
Some(Histogram::new(num_points as u32, hist))
|
||||
}
|
||||
|
||||
// TODO multidimensional output
|
||||
pub fn write_results(out_file: &str, ds: &Dataset, free: &Vec<f64>, prob: &Vec<f64>) -> Result<(), Box<Error>> {
|
||||
let output = File::create(out_file)?;
|
||||
let mut buf = BufWriter::new(output);
|
||||
writeln!(buf, "#{}\t{}\t{}", "x", "Free Energy", "Probability"); // TODO better format (coord1, coord2..)
|
||||
|
||||
|
||||
let header: String = (0..ds.dimens_lengths.len()).map(|d| {format!("coord{}", d+1)}).collect::<Vec<String>>().join(" ");
|
||||
writeln!(buf, "#{} {} {}", header, "Free Energy", "Probability");
|
||||
for bin in 0..free.len() {
|
||||
let coords = ds.get_coords_for_bin(bin);
|
||||
let coords_str: String = coords.iter().map(|c| {format!("{:8.6}", c)})
|
||||
let coords_str: String = coords.iter().map(|c| {format!("{:8.6} ", c)})
|
||||
.collect::<Vec<String>>().join("\t");
|
||||
writeln!(buf, "{}\t{:8.6}\t{:8.6}", coords_str, free[bin], prob[bin])?;
|
||||
writeln!(buf, "{}{:8.6} {:8.6}", coords_str, free[bin], prob[bin])?;
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user