bootstrapping

This commit is contained in:
Daniel Bauer
2018-11-12 15:16:06 +01:00
parent b86a9df7fb
commit fc776fd40e
12 changed files with 20449 additions and 10133 deletions

78
Cargo.lock generated
View File

@@ -1,3 +1,13 @@
[[package]]
name = "GSL"
version = "1.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"c_vec 1.0.12 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)",
"pkg-config 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]] [[package]]
name = "ansi_term" name = "ansi_term"
version = "0.11.0" version = "0.11.0"
@@ -42,6 +52,11 @@ name = "bitflags"
version = "1.0.4" version = "1.0.4"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "c_vec"
version = "1.0.12"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]] [[package]]
name = "cc" name = "cc"
version = "1.0.25" version = "1.0.25"
@@ -67,6 +82,14 @@ dependencies = [
"yaml-rust 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)", "yaml-rust 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)",
] ]
[[package]]
name = "cloudabi"
version = "0.0.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"bitflags 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]] [[package]]
name = "error-chain" name = "error-chain"
version = "0.12.0" version = "0.12.0"
@@ -75,11 +98,55 @@ dependencies = [
"backtrace 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", "backtrace 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)",
] ]
[[package]]
name = "fuchsia-zircon"
version = "0.3.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"bitflags 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)",
"fuchsia-zircon-sys 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "fuchsia-zircon-sys"
version = "0.3.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]] [[package]]
name = "libc" name = "libc"
version = "0.2.43" version = "0.2.43"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "pkg-config"
version = "0.3.14"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "rand"
version = "0.5.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"cloudabi 0.0.3 (registry+https://github.com/rust-lang/crates.io-index)",
"fuchsia-zircon 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)",
"rand_core 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
"winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "rand_core"
version = "0.2.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"rand_core 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "rand_core"
version = "0.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]] [[package]]
name = "redox_syscall" name = "redox_syscall"
version = "0.1.40" version = "0.1.40"
@@ -135,8 +202,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
name = "wham" name = "wham"
version = "0.9.0" version = "0.9.0"
dependencies = [ dependencies = [
"GSL 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
"clap 2.32.0 (registry+https://github.com/rust-lang/crates.io-index)", "clap 2.32.0 (registry+https://github.com/rust-lang/crates.io-index)",
"error-chain 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)", "error-chain 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)",
"rand 0.5.5 (registry+https://github.com/rust-lang/crates.io-index)",
] ]
[[package]] [[package]]
@@ -164,16 +233,25 @@ version = "0.3.5"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
[metadata] [metadata]
"checksum GSL 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "2e70167131757876cda6ab95869b57ad6b55c627ff28421f5935f55f9b97d85c"
"checksum ansi_term 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ee49baf6cb617b853aa8d93bf420db2383fab46d314482ca2803b40d5fde979b" "checksum ansi_term 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ee49baf6cb617b853aa8d93bf420db2383fab46d314482ca2803b40d5fde979b"
"checksum atty 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)" = "9a7d5b8723950951411ee34d271d99dddcc2035a16ab25310ea2c8cfd4369652" "checksum atty 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)" = "9a7d5b8723950951411ee34d271d99dddcc2035a16ab25310ea2c8cfd4369652"
"checksum backtrace 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)" = "89a47830402e9981c5c41223151efcced65a0510c13097c769cede7efb34782a" "checksum backtrace 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)" = "89a47830402e9981c5c41223151efcced65a0510c13097c769cede7efb34782a"
"checksum backtrace-sys 0.1.24 (registry+https://github.com/rust-lang/crates.io-index)" = "c66d56ac8dabd07f6aacdaf633f4b8262f5b3601a810a0dcddffd5c22c69daa0" "checksum backtrace-sys 0.1.24 (registry+https://github.com/rust-lang/crates.io-index)" = "c66d56ac8dabd07f6aacdaf633f4b8262f5b3601a810a0dcddffd5c22c69daa0"
"checksum bitflags 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)" = "228047a76f468627ca71776ecdebd732a3423081fcf5125585bcd7c49886ce12" "checksum bitflags 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)" = "228047a76f468627ca71776ecdebd732a3423081fcf5125585bcd7c49886ce12"
"checksum c_vec 1.0.12 (registry+https://github.com/rust-lang/crates.io-index)" = "aa9e1d9f7d49e289f36f19effbf3d5a5e30163ecf9c7a3c9be94d5374dec5b9a"
"checksum cc 1.0.25 (registry+https://github.com/rust-lang/crates.io-index)" = "f159dfd43363c4d08055a07703eb7a3406b0dac4d0584d96965a3262db3c9d16" "checksum cc 1.0.25 (registry+https://github.com/rust-lang/crates.io-index)" = "f159dfd43363c4d08055a07703eb7a3406b0dac4d0584d96965a3262db3c9d16"
"checksum cfg-if 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "082bb9b28e00d3c9d39cc03e64ce4cea0f1bb9b3fde493f0cbc008472d22bdf4" "checksum cfg-if 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "082bb9b28e00d3c9d39cc03e64ce4cea0f1bb9b3fde493f0cbc008472d22bdf4"
"checksum clap 2.32.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b957d88f4b6a63b9d70d5f454ac8011819c6efa7727858f458ab71c756ce2d3e" "checksum clap 2.32.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b957d88f4b6a63b9d70d5f454ac8011819c6efa7727858f458ab71c756ce2d3e"
"checksum cloudabi 0.0.3 (registry+https://github.com/rust-lang/crates.io-index)" = "ddfc5b9aa5d4507acaf872de71051dfd0e309860e88966e1051e462a077aac4f"
"checksum error-chain 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)" = "07e791d3be96241c77c43846b665ef1384606da2cd2a48730abe606a12906e02" "checksum error-chain 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)" = "07e791d3be96241c77c43846b665ef1384606da2cd2a48730abe606a12906e02"
"checksum fuchsia-zircon 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "2e9763c69ebaae630ba35f74888db465e49e259ba1bc0eda7d06f4a067615d82"
"checksum fuchsia-zircon-sys 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "3dcaa9ae7725d12cdb85b3ad99a434db70b468c09ded17e012d86b5c1010f7a7"
"checksum libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)" = "76e3a3ef172f1a0b9a9ff0dd1491ae5e6c948b94479a3021819ba7d860c8645d" "checksum libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)" = "76e3a3ef172f1a0b9a9ff0dd1491ae5e6c948b94479a3021819ba7d860c8645d"
"checksum pkg-config 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)" = "676e8eb2b1b4c9043511a9b7bea0915320d7e502b0a079fb03f9635a5252b18c"
"checksum rand 0.5.5 (registry+https://github.com/rust-lang/crates.io-index)" = "e464cd887e869cddcae8792a4ee31d23c7edd516700695608f5b98c67ee0131c"
"checksum rand_core 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "1961a422c4d189dfb50ffa9320bf1f2a9bd54ecb92792fb9477f99a1045f3372"
"checksum rand_core 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "0905b6b7079ec73b314d4c748701f6931eb79fd97c668caa3f1899b22b32c6db"
"checksum redox_syscall 0.1.40 (registry+https://github.com/rust-lang/crates.io-index)" = "c214e91d3ecf43e9a4e41e578973adeb14b474f2bee858742d127af75a0112b1" "checksum redox_syscall 0.1.40 (registry+https://github.com/rust-lang/crates.io-index)" = "c214e91d3ecf43e9a4e41e578973adeb14b474f2bee858742d127af75a0112b1"
"checksum redox_termios 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "7e891cfe48e9100a70a3b6eb652fef28920c117d366339687bd5576160db0f76" "checksum redox_termios 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "7e891cfe48e9100a70a3b6eb652fef28920c117d366339687bd5576160db0f76"
"checksum rustc-demangle 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)" = "bcfe5b13211b4d78e5c2cadfebd7769197d95c639c35a50057eb4c05de811395" "checksum rustc-demangle 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)" = "bcfe5b13211b4d78e5c2cadfebd7769197d95c639c35a50057eb4c05de811395"

View File

@@ -6,6 +6,11 @@ authors = ["D. Bauer <bauer@bio.tu-darmstadt.de>"]
[dependencies] [dependencies]
clap = {version="2.32.0", features=['yaml']} clap = {version="2.32.0", features=['yaml']}
error-chain = "0.12.0" error-chain = "0.12.0"
rand = "0.5.5"
GSL = "1.0.0"
[profile.release] [profile.release]
opt-level = 2 opt-level = 2
[features]
default = ["GSL/v2"]

101
example/1d/wham.bs.out Normal file
View File

@@ -0,0 +1,101 @@
#coord1 Free Energy +/- Probability +/-
-3.108600 7.118166 0.726345 0.003561 0.001037
-3.045800 5.331290 0.691401 0.007290 0.002021
-2.983000 3.879241 0.633161 0.013048 0.003312
-2.920200 2.968659 0.559868 0.018796 0.004219
-2.857400 1.942494 0.521451 0.028362 0.005929
-2.794600 1.418408 0.511798 0.034994 0.007180
-2.731800 1.169398 0.500131 0.038668 0.007753
-2.669000 0.843024 0.423166 0.044073 0.007477
-2.606200 0.636021 0.402194 0.047887 0.007721
-2.543400 0.720123 0.392284 0.046299 0.007281
-2.480600 1.066434 0.364394 0.040297 0.005887
-2.417800 1.509855 0.373071 0.033734 0.005046
-2.355000 2.015549 0.340702 0.027544 0.003762
-2.292200 2.226942 0.187837 0.025306 0.001906
-2.229400 2.573176 0.163733 0.022026 0.001446
-2.166600 2.591946 0.202599 0.021861 0.001776
-2.103800 2.476835 0.162230 0.022893 0.001489
-2.041000 2.513953 0.187976 0.022555 0.001700
-1.978200 2.470032 0.209922 0.022956 0.001932
-1.915400 2.227585 0.394195 0.025299 0.003998
-1.852600 2.105310 0.366411 0.026570 0.003903
-1.789800 1.778779 0.308002 0.030286 0.003740
-1.727000 1.447127 0.237757 0.034593 0.003297
-1.664200 0.906384 0.265618 0.042968 0.004576
-1.601400 0.304263 0.299905 0.054699 0.006577
-1.538600 0.247397 0.297414 0.055960 0.006672
-1.475800 0.000000 0.341807 0.061795 0.008468
-1.413000 0.536142 0.333929 0.049843 0.006673
-1.350200 1.428046 0.415679 0.034859 0.005809
-1.287400 2.398149 0.471062 0.023627 0.004462
-1.224600 3.784647 0.480677 0.013552 0.002612
-1.161800 5.696583 0.487364 0.006297 0.001230
-1.099000 7.656158 0.485095 0.002870 0.000558
-1.036200 9.955000 0.474531 0.001142 0.000217
-0.973400 12.357407 0.521858 0.000436 0.000091
-0.910600 14.954254 0.679423 0.000154 0.000042
-0.847800 17.745327 0.899097 0.000050 0.000018
-0.785000 20.559461 1.400584 0.000016 0.000009
-0.722200 22.783560 1.935739 0.000007 0.000005
-0.659400 25.175865 2.554685 0.000003 0.000003
-0.596600 26.419980 2.707057 0.000002 0.000002
-0.533800 27.885999 2.680865 0.000001 0.000001
-0.471000 29.029334 2.560557 0.000001 0.000001
-0.408200 30.366556 2.474396 0.000000 0.000000
-0.345400 31.615252 2.511599 0.000000 0.000000
-0.282600 32.781716 2.693705 0.000000 0.000000
-0.219800 33.731378 2.784522 0.000000 0.000000
-0.157000 34.476014 2.815101 0.000000 0.000000
-0.094200 35.387300 3.060738 0.000000 0.000000
-0.031400 35.579756 3.074545 0.000000 0.000000
0.031400 35.520194 2.997314 0.000000 0.000000
0.094200 35.344763 2.909572 0.000000 0.000000
0.157000 34.886460 3.099746 0.000000 0.000000
0.219800 33.633998 3.094506 0.000000 0.000000
0.282600 32.686511 3.077967 0.000000 0.000000
0.345400 31.211777 3.305545 0.000000 0.000000
0.408200 29.680451 4.240068 0.000000 0.000001
0.471000 28.032242 4.472562 0.000001 0.000001
0.533800 26.439599 4.654827 0.000002 0.000003
0.596600 24.432467 4.574666 0.000003 0.000006
0.659400 22.309893 4.862061 0.000008 0.000016
0.722200 20.186040 4.828795 0.000019 0.000037
0.785000 18.295046 5.011677 0.000040 0.000081
0.847800 16.221232 4.936856 0.000093 0.000183
0.910600 14.251911 5.036745 0.000204 0.000412
0.973400 12.562353 5.358431 0.000402 0.000863
1.036200 11.184029 5.447495 0.000698 0.001524
1.099000 10.040677 5.503065 0.001103 0.002434
1.161800 9.369064 5.732528 0.001444 0.003320
1.224600 9.095392 5.840210 0.001612 0.003774
1.287400 9.256035 6.090900 0.001511 0.003691
1.350200 9.814068 6.280131 0.001208 0.003042
1.413000 10.945207 6.508250 0.000768 0.002003
1.475800 12.518898 6.775260 0.000409 0.001110
1.538600 14.409744 6.965926 0.000191 0.000535
1.601400 16.451965 7.139771 0.000084 0.000242
1.664200 18.589166 7.587443 0.000036 0.000109
1.727000 20.669504 7.985190 0.000016 0.000050
1.789800 22.804791 7.785886 0.000007 0.000021
1.852600 24.531690 10.770791 0.000003 0.000014
1.915400 26.182612 7.778636 0.000002 0.000005
1.978200 27.279439 7.317796 0.000001 0.000003
2.041000 28.571380 3.941626 0.000001 0.000001
2.103800 29.328969 1.086686 0.000000 0.000000
2.166600 29.897739 1.065982 0.000000 0.000000
2.229400 30.320908 1.012561 0.000000 0.000000
2.292200 30.065391 1.072001 0.000000 0.000000
2.355000 29.809137 1.325516 0.000000 0.000000
2.417800 29.340601 1.292456 0.000000 0.000000
2.480600 28.473346 1.537744 0.000001 0.000000
2.543400 27.679353 1.333735 0.000001 0.000001
2.606200 26.453160 1.365382 0.000002 0.000001
2.669000 24.424649 1.046594 0.000003 0.000001
2.731800 22.285933 0.947041 0.000008 0.000003
2.794600 19.958407 0.926797 0.000021 0.000008
2.857400 17.606291 0.905871 0.000053 0.000019
2.920200 15.420138 0.930646 0.000128 0.000048
2.983000 13.069599 0.868684 0.000328 0.000114
3.045800 11.036085 0.791301 0.000740 0.000235
3.108600 9.015657 0.747120 0.001664 0.000498

View File

@@ -1,101 +1,101 @@
#coord1 Free Energy Probability #coord1 Free Energy +/- Probability +/-
-3.108600 7.118166 0.003561 -3.108600 7.118166 0.000000 0.003561 0.000000
-3.045800 5.331290 0.007290 -3.045800 5.331290 0.000000 0.007290 0.000000
-2.983000 3.879241 0.013048 -2.983000 3.879241 0.000000 0.013048 0.000000
-2.920200 2.968659 0.018796 -2.920200 2.968659 0.000000 0.018796 0.000000
-2.857400 1.942494 0.028362 -2.857400 1.942494 0.000000 0.028362 0.000000
-2.794600 1.418408 0.034994 -2.794600 1.418408 0.000000 0.034994 0.000000
-2.731800 1.169398 0.038668 -2.731800 1.169398 0.000000 0.038668 0.000000
-2.669000 0.843024 0.044073 -2.669000 0.843024 0.000000 0.044073 0.000000
-2.606200 0.636021 0.047887 -2.606200 0.636021 0.000000 0.047887 0.000000
-2.543400 0.720123 0.046299 -2.543400 0.720123 0.000000 0.046299 0.000000
-2.480600 1.066434 0.040297 -2.480600 1.066434 0.000000 0.040297 0.000000
-2.417800 1.509855 0.033734 -2.417800 1.509855 0.000000 0.033734 0.000000
-2.355000 2.015549 0.027544 -2.355000 2.015549 0.000000 0.027544 0.000000
-2.292200 2.226942 0.025306 -2.292200 2.226942 0.000000 0.025306 0.000000
-2.229400 2.573176 0.022026 -2.229400 2.573176 0.000000 0.022026 0.000000
-2.166600 2.591946 0.021861 -2.166600 2.591946 0.000000 0.021861 0.000000
-2.103800 2.476835 0.022893 -2.103800 2.476835 0.000000 0.022893 0.000000
-2.041000 2.513953 0.022555 -2.041000 2.513953 0.000000 0.022555 0.000000
-1.978200 2.470032 0.022956 -1.978200 2.470032 0.000000 0.022956 0.000000
-1.915400 2.227585 0.025299 -1.915400 2.227585 0.000000 0.025299 0.000000
-1.852600 2.105310 0.026570 -1.852600 2.105310 0.000000 0.026570 0.000000
-1.789800 1.778779 0.030286 -1.789800 1.778779 0.000000 0.030286 0.000000
-1.727000 1.447127 0.034593 -1.727000 1.447127 0.000000 0.034593 0.000000
-1.664200 0.906384 0.042968 -1.664200 0.906384 0.000000 0.042968 0.000000
-1.601400 0.304263 0.054699 -1.601400 0.304263 0.000000 0.054699 0.000000
-1.538600 0.247397 0.055960 -1.538600 0.247397 0.000000 0.055960 0.000000
-1.475800 0.000000 0.061795 -1.475800 0.000000 0.000000 0.061795 0.000000
-1.413000 0.536142 0.049843 -1.413000 0.536142 0.000000 0.049843 0.000000
-1.350200 1.428046 0.034859 -1.350200 1.428046 0.000000 0.034859 0.000000
-1.287400 2.398149 0.023627 -1.287400 2.398149 0.000000 0.023627 0.000000
-1.224600 3.784647 0.013552 -1.224600 3.784647 0.000000 0.013552 0.000000
-1.161800 5.696583 0.006297 -1.161800 5.696583 0.000000 0.006297 0.000000
-1.099000 7.656158 0.002870 -1.099000 7.656158 0.000000 0.002870 0.000000
-1.036200 9.955000 0.001142 -1.036200 9.955000 0.000000 0.001142 0.000000
-0.973400 12.357407 0.000436 -0.973400 12.357407 0.000000 0.000436 0.000000
-0.910600 14.954254 0.000154 -0.910600 14.954254 0.000000 0.000154 0.000000
-0.847800 17.745327 0.000050 -0.847800 17.745327 0.000000 0.000050 0.000000
-0.785000 20.559461 0.000016 -0.785000 20.559461 0.000000 0.000016 0.000000
-0.722200 22.783560 0.000007 -0.722200 22.783560 0.000000 0.000007 0.000000
-0.659400 25.175865 0.000003 -0.659400 25.175865 0.000000 0.000003 0.000000
-0.596600 26.419980 0.000002 -0.596600 26.419980 0.000000 0.000002 0.000000
-0.533800 27.885999 0.000001 -0.533800 27.885999 0.000000 0.000001 0.000000
-0.471000 29.029334 0.000001 -0.471000 29.029334 0.000000 0.000001 0.000000
-0.408200 30.366556 0.000000 -0.408200 30.366556 0.000000 0.000000 0.000000
-0.345400 31.615252 0.000000 -0.345400 31.615252 0.000000 0.000000 0.000000
-0.282600 32.781716 0.000000 -0.282600 32.781716 0.000000 0.000000 0.000000
-0.219800 33.731378 0.000000 -0.219800 33.731378 0.000000 0.000000 0.000000
-0.157000 34.476014 0.000000 -0.157000 34.476014 0.000000 0.000000 0.000000
-0.094200 35.387300 0.000000 -0.094200 35.387300 0.000000 0.000000 0.000000
-0.031400 35.579756 0.000000 -0.031400 35.579756 0.000000 0.000000 0.000000
0.031400 35.520194 0.000000 0.031400 35.520194 0.000000 0.000000 0.000000
0.094200 35.344763 0.000000 0.094200 35.344763 0.000000 0.000000 0.000000
0.157000 34.886460 0.000000 0.157000 34.886460 0.000000 0.000000 0.000000
0.219800 33.633998 0.000000 0.219800 33.633998 0.000000 0.000000 0.000000
0.282600 32.686511 0.000000 0.282600 32.686511 0.000000 0.000000 0.000000
0.345400 31.211777 0.000000 0.345400 31.211777 0.000000 0.000000 0.000000
0.408200 29.680451 0.000000 0.408200 29.680451 0.000000 0.000000 0.000000
0.471000 28.032242 0.000001 0.471000 28.032242 0.000000 0.000001 0.000000
0.533800 26.439599 0.000002 0.533800 26.439599 0.000000 0.000002 0.000000
0.596600 24.432467 0.000003 0.596600 24.432467 0.000000 0.000003 0.000000
0.659400 22.309893 0.000008 0.659400 22.309893 0.000000 0.000008 0.000000
0.722200 20.186040 0.000019 0.722200 20.186040 0.000000 0.000019 0.000000
0.785000 18.295046 0.000040 0.785000 18.295046 0.000000 0.000040 0.000000
0.847800 16.221232 0.000093 0.847800 16.221232 0.000000 0.000093 0.000000
0.910600 14.251911 0.000204 0.910600 14.251911 0.000000 0.000204 0.000000
0.973400 12.562353 0.000402 0.973400 12.562353 0.000000 0.000402 0.000000
1.036200 11.184029 0.000698 1.036200 11.184029 0.000000 0.000698 0.000000
1.099000 10.040677 0.001103 1.099000 10.040677 0.000000 0.001103 0.000000
1.161800 9.369064 0.001444 1.161800 9.369064 0.000000 0.001444 0.000000
1.224600 9.095392 0.001612 1.224600 9.095392 0.000000 0.001612 0.000000
1.287400 9.256035 0.001511 1.287400 9.256035 0.000000 0.001511 0.000000
1.350200 9.814068 0.001208 1.350200 9.814068 0.000000 0.001208 0.000000
1.413000 10.945207 0.000768 1.413000 10.945207 0.000000 0.000768 0.000000
1.475800 12.518898 0.000409 1.475800 12.518898 0.000000 0.000409 0.000000
1.538600 14.409744 0.000191 1.538600 14.409744 0.000000 0.000191 0.000000
1.601400 16.451965 0.000084 1.601400 16.451965 0.000000 0.000084 0.000000
1.664200 18.589166 0.000036 1.664200 18.589166 0.000000 0.000036 0.000000
1.727000 20.669504 0.000016 1.727000 20.669504 0.000000 0.000016 0.000000
1.789800 22.804791 0.000007 1.789800 22.804791 0.000000 0.000007 0.000000
1.852600 24.531690 0.000003 1.852600 24.531690 0.000000 0.000003 0.000000
1.915400 26.182612 0.000002 1.915400 26.182612 0.000000 0.000002 0.000000
1.978200 27.279439 0.000001 1.978200 27.279439 0.000000 0.000001 0.000000
2.041000 28.571380 0.000001 2.041000 28.571380 0.000000 0.000001 0.000000
2.103800 29.328969 0.000000 2.103800 29.328969 0.000000 0.000000 0.000000
2.166600 29.897739 0.000000 2.166600 29.897739 0.000000 0.000000 0.000000
2.229400 30.320908 0.000000 2.229400 30.320908 0.000000 0.000000 0.000000
2.292200 30.065391 0.000000 2.292200 30.065391 0.000000 0.000000 0.000000
2.355000 29.809137 0.000000 2.355000 29.809137 0.000000 0.000000 0.000000
2.417800 29.340601 0.000000 2.417800 29.340601 0.000000 0.000000 0.000000
2.480600 28.473346 0.000001 2.480600 28.473346 0.000000 0.000001 0.000000
2.543400 27.679353 0.000001 2.543400 27.679353 0.000000 0.000001 0.000000
2.606200 26.453160 0.000002 2.606200 26.453160 0.000000 0.000002 0.000000
2.669000 24.424649 0.000003 2.669000 24.424649 0.000000 0.000003 0.000000
2.731800 22.285933 0.000008 2.731800 22.285933 0.000000 0.000008 0.000000
2.794600 19.958407 0.000021 2.794600 19.958407 0.000000 0.000021 0.000000
2.857400 17.606291 0.000053 2.857400 17.606291 0.000000 0.000053 0.000000
2.920200 15.420138 0.000128 2.920200 15.420138 0.000000 0.000128 0.000000
2.983000 13.069599 0.000328 2.983000 13.069599 0.000000 0.000328 0.000000
3.045800 11.036085 0.000740 3.045800 11.036085 0.000000 0.000740 0.000000
3.108600 9.015657 0.001664 3.108600 9.015657 0.000000 0.001664 0.000000

10001
example/2d/wham.bs.out Normal file

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -61,6 +61,7 @@ args:
required: false required: false
help: Stop WHAM after this many iterations without convergence (defaults to 100,000). help: Stop WHAM after this many iterations without convergence (defaults to 100,000).
- cyclic: - cyclic:
short: c
long: cyclic long: cyclic
help: For periodic reaction coordinates. If this is set, the first and last coordinate bin in each dimension are treated as neighbors for the bias calculation. help: For periodic reaction coordinates. If this is set, the first and last coordinate bin in each dimension are treated as neighbors for the bias calculation.
- verbose: - verbose:
@@ -71,12 +72,17 @@ args:
- temperature: - temperature:
short: T short: T
long: temperature long: temperature
help: WHAM temperature in Kelvin help: WHAM temperature in Kelvin.
takes_value: true takes_value: true
required: true required: true
- output: - output:
short: o short: o
long: output long: output
help: Free energy output file (defaults to wham.out) help: Free energy output file (defaults to wham.out).
takes_value: true
required: false
- bootstrap:
long: bt
help: Number of bayesian bootstrapping runs for error analysis by assigning random weights (defaults to 0).
takes_value: true takes_value: true
required: false required: false

95
src/error_analysis.rs Normal file
View File

@@ -0,0 +1,95 @@
use rand;
use super::histogram::{Dataset,Histogram};
use super::k_B;
use super::perform_wham;
use super::Config;
use rgsl::statistics;
fn generate_random_weights(num_windows: usize) -> Vec<f64> {
// TODO this is ugly.
// create a list of num_windows - 1 sorted random numbers and append/prepend 0 and 1
let mut tmp = (0..num_windows-1).map(|_| rand::random::<f64>()).collect::<Vec<f64>>();
tmp.sort_by(|a,b| { a.partial_cmp(b).unwrap() });
let mut rnds = vec![0.0];
rnds.append(&mut tmp);
rnds.append(&mut vec![1.0]);
// weights of window i is the difference between rnd[i+1] and rnd[i]
let mut weights = vec![0.0; num_windows];
for i in 0..num_windows {
weights[i] = rnds[i+1] - rnds[i]
}
return weights
}
fn generate_random_weighted_dataset(ds: Dataset) -> Dataset {
let weights = generate_random_weights(ds.num_windows);
Dataset::new_weighted(ds, weights )
}
pub fn run_bootstrap(cfg: &Config, ds: Dataset, P: &[f64], num_runs: usize) -> (Vec<f64>,Vec<f64>) {
let Ps: Vec<Vec<f64>> = (0..num_runs).map(|x| {
println!("Bootstrap run {}/{}", x, num_runs);
let rnd_weighted_dataset = generate_random_weighted_dataset(ds.clone());
perform_wham(cfg, &rnd_weighted_dataset).unwrap().0
}).collect();
let mut P_std = vec![0.0; ds.num_bins];
for bin in 0..ds.num_bins {
let Ps = Ps.iter().map(|window| window[bin]).collect::<Vec<f64>>();
P_std[bin] = statistics::sd(&Ps, 1, num_runs);
}
let A_std = P_std.iter().zip(P.iter()).map(|(std,P)| ds.kT*1.0/P*std).collect();
(P_std, A_std)
}
mod tests {
use super::*;
fn build_hist() -> Histogram {
Histogram::new(
22, // num_points
vec![1.0, 1.0, 3.0, 5.0, 12.0] // bins
)
}
fn build_hist_set() -> Dataset {
let h1 = build_hist();
let h2 = build_hist();
let h3 = build_hist();
Dataset::new(
5, // num bins
vec![3],
vec![1.0], // bin width
vec![0.0], // hist min
vec![9.0], // hist max
vec![4.5, 4.5, 4.5], // x0
vec![10.0, 10.0, 10.0], // fc
300.0*k_B, // kT
vec![h1, h2, h3], // hists
false // cyclic
)
}
#[test]
fn random_weights() {
let num_windows = 5;
let weights = generate_random_weights(num_windows);
assert_eq!(num_windows, weights.len());
for w in weights {
assert!(0.0 < w && w < 1.0);
}
}
#[test]
fn random_weighted_dataset() {
let ds = build_hist_set();
let rnd_weights_ds = generate_random_weighted_dataset(ds);
println!("{:?}", rnd_weights_ds.weights);
for w in rnd_weights_ds.weights {
assert!(w > 0.0);
assert!(w < 1.0);
}
}
}

View File

@@ -2,7 +2,7 @@ use std::fmt;
use std::cell::RefCell; use std::cell::RefCell;
// One histogram // One histogram
#[derive(Debug)] #[derive(Debug,Clone)]
pub struct Histogram { pub struct Histogram {
// total number of data points stored in the histogram // total number of data points stored in the histogram
pub num_points: u32, pub num_points: u32,
@@ -18,7 +18,7 @@ impl Histogram {
} }
// a set of histograms // a set of histograms
#[derive(Debug)] #[derive(Debug,Clone)]
pub struct Dataset { pub struct Dataset {
// number of histogram windows (number of simulations) // number of histogram windows (number of simulations)
pub num_windows: usize, pub num_windows: usize,
@@ -56,8 +56,8 @@ pub struct Dataset {
// bias value cache // bias value cache
bias: RefCell<Vec<Option<f64>>>, bias: RefCell<Vec<Option<f64>>>,
// sum of bin count for windows // histogram weight
pub bin_count: Vec<f64> pub weights: Vec<f64>,
} }
impl Dataset { impl Dataset {
@@ -65,9 +65,7 @@ impl Dataset {
pub fn new(num_bins: usize, dimens_lengths: Vec<usize>, bin_width: Vec<f64>, hist_min: Vec<f64>, hist_max: Vec<f64>, bias_pos: Vec<f64>, bias_fc: Vec<f64>, kT: f64, histograms: Vec<Histogram>, cyclic: bool) -> Dataset { pub fn new(num_bins: usize, dimens_lengths: Vec<usize>, bin_width: Vec<f64>, hist_min: Vec<f64>, hist_max: Vec<f64>, bias_pos: Vec<f64>, bias_fc: Vec<f64>, kT: f64, histograms: Vec<Histogram>, cyclic: bool) -> Dataset {
let num_windows = histograms.len(); let num_windows = histograms.len();
let bias: RefCell<Vec<Option<f64>>> = RefCell::new(vec![None; num_bins*num_windows]); let bias: RefCell<Vec<Option<f64>>> = RefCell::new(vec![None; num_bins*num_windows]);
let bin_count = (0..num_bins).map(|bin| { let weights = vec![1.0; num_windows];
histograms.iter().map(|h| h.bins[bin]).sum()
}).collect();
Dataset{ Dataset{
num_windows, num_windows,
num_bins, num_bins,
@@ -81,10 +79,21 @@ impl Dataset {
bias_pos, bias_pos,
bias_fc, bias_fc,
bias, bias,
bin_count, weights
} }
} }
pub fn new_weighted(ds: Dataset, weights: Vec<f64>) -> Dataset {
Dataset {
weights: weights,
..ds
}
}
pub fn get_weighted_bin_count(&self, bin: usize) -> f64 {
self.histograms.iter().enumerate().map(|(idx,h)| self.weights[idx]*h.bins[bin]).sum()
}
fn expand_index(&self, bin: usize, lengths: &[usize]) -> Vec<usize> { fn expand_index(&self, bin: usize, lengths: &[usize]) -> Vec<usize> {
let mut tmp = bin; let mut tmp = bin;
let mut idx = vec![0; lengths.len()]; let mut idx = vec![0; lengths.len()];
@@ -247,10 +256,10 @@ mod tests {
vec![build_hist(), build_hist()], // hists vec![build_hist(), build_hist()], // hists
false // cyclic false // cyclic
); );
assert_delta!(2.0, ds.bin_count[0], 0.0000000001); assert_delta!(2.0, ds.get_weighted_bin_count(0), 0.0000000001);
assert_delta!(2.0, ds.bin_count[1], 0.0000000001); assert_delta!(2.0, ds.get_weighted_bin_count(1), 0.0000000001);
assert_delta!(6.0, ds.bin_count[2], 0.0000000001); assert_delta!(6.0, ds.get_weighted_bin_count(2), 0.0000000001);
assert_delta!(10.0, ds.bin_count[3], 0.0000000001); assert_delta!(10.0, ds.get_weighted_bin_count(3), 0.0000000001);
assert_delta!(24.0, ds.bin_count[4], 0.0000000001); assert_delta!(24.0, ds.get_weighted_bin_count(4), 0.0000000001);
} }
} }

View File

@@ -158,20 +158,20 @@ fn read_window_file(window_file: &str, cfg: &Config) -> Result<Histogram> {
} }
// Write WHAM calculation results to out_file. // Write WHAM calculation results to out_file.
pub fn write_results(out_file: &str, ds: &Dataset, free: &Vec<f64>, prob: &Vec<f64>) -> Result<()> { pub fn write_results(out_file: &str, ds: &Dataset, free: &Vec<f64>, free_std: &Vec<f64>, prob: &Vec<f64>, prob_std: &Vec<f64>) -> Result<()> {
let output = File::create(out_file) let output = File::create(out_file)
.chain_err(|| format!("Failed to create file with path {}", out_file))?; .chain_err(|| format!("Failed to create file with path {}", out_file))?;
let mut buf = BufWriter::new(output); let mut buf = BufWriter::new(output);
let header: String = (0..ds.dimens_lengths.len()).map(|d| format!("coord{}", d+1)) let header: String = (0..ds.dimens_lengths.len()).map(|d| format!("coord{}", d+1))
.collect::<Vec<String>>().join(" "); .collect::<Vec<String>>().join(" ");
writeln!(buf, "#{} {} {}", header, "Free Energy", "Probability"); writeln!(buf, "#{} {} {} {} {}", header, "Free Energy", "+/-", "Probability", "+/-");
for bin in 0..free.len() { for bin in 0..free.len() {
let coords = ds.get_coords_for_bin(bin); 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"); .collect::<Vec<String>>().join("\t");
writeln!(buf, "{}{:8.6} {:8.6}", coords_str, free[bin], prob[bin]) writeln!(buf, "{}{:8.6} {:8.6} {:8.6} {:8.6}", coords_str, free[bin], free_std[bin], prob[bin], prob_std[bin])
.chain_err(|| "Failed to write to file.")?; .chain_err(|| "Failed to write to file.")?;
} }
Ok(()) Ok(())
@@ -194,6 +194,7 @@ mod tests {
temperature: 300.0, temperature: 300.0,
cyclic: false, cyclic: false,
output: "qwert".to_string(), output: "qwert".to_string(),
bootstrap: 0,
} }
} }

View File

@@ -2,9 +2,12 @@
#[macro_use] #[macro_use]
extern crate error_chain; extern crate error_chain;
extern crate rand;
extern crate rgsl;
pub mod io; pub mod io;
pub mod histogram; pub mod histogram;
pub mod error_analysis;
use histogram::Dataset; use histogram::Dataset;
use std::f64; use std::f64;
@@ -32,12 +35,13 @@ pub struct Config {
pub temperature: f64, pub temperature: f64,
pub cyclic: bool, pub cyclic: bool,
pub output: String, pub output: String,
pub bootstrap: usize,
} }
impl fmt::Display for Config { impl fmt::Display for Config {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "Metadata={}, hist_min={:?}, hist_max={:?}, bins={:?} verbose={}, tolerance={}, iterations={}, temperature={}, cyclic={:?}", self.metadata_file, self.hist_min, self.hist_max, self.num_bins, write!(f, "Metadata={}, hist_min={:?}, hist_max={:?}, bins={:?} verbose={}, tolerance={}, iterations={}, temperature={}, cyclic={:?}, bootstrap={:?}", self.metadata_file, self.hist_min, self.hist_max, self.num_bins,
self.verbose, self.tolerance, self.max_iterations, self.temperature, self.cyclic) self.verbose, self.tolerance, self.max_iterations, self.temperature, self.cyclic, self.bootstrap)
} }
} }
@@ -54,11 +58,12 @@ fn is_converged(old_F: &[f64], new_F: &[f64], tolerance: f64) -> bool {
// This evaluates the first WHAM equation for each bin. // This evaluates the first WHAM equation for each bin.
fn calc_bin_probability(bin: usize, dataset: &Dataset, F: &[f64]) -> f64 { fn calc_bin_probability(bin: usize, dataset: &Dataset, F: &[f64]) -> f64 {
let mut denom_sum: f64 = 0.0; let mut denom_sum: f64 = 0.0;
let bin_count: f64 = dataset.get_weighted_bin_count(bin);
for (window, h) in dataset.histograms.iter().enumerate() { for (window, h) in dataset.histograms.iter().enumerate() {
let bias = dataset.calc_bias(bin, window); let bias = dataset.calc_bias(bin, window);
denom_sum += (h.num_points as f64) * bias * F[window]; denom_sum += (dataset.weights[window] * h.num_points as f64) * bias * F[window];
} }
dataset.bin_count[bin] / denom_sum bin_count / denom_sum
} }
// estimate the bias offset F of the histogram based on given probabilities. // estimate the bias offset F of the histogram based on given probabilities.
@@ -150,12 +155,23 @@ pub fn run(cfg: &Config) -> Result<()>{
let (P, F, F_prev) = perform_wham(&cfg, &dataset)?; let (P, F, F_prev) = perform_wham(&cfg, &dataset)?;
let P_std: Vec<f64>;
let free_energy_std: Vec<f64>;
if cfg.bootstrap > 0 {
let error_est = error_analysis::run_bootstrap(&cfg, dataset.clone(), &P, cfg.bootstrap);
P_std = error_est.0;
free_energy_std = error_est.1;
} else {
P_std = vec![0.0; P.len()];
free_energy_std = vec![0.0; P.len()];
}
// calculate free energy and dump state // calculate free energy and dump state
println!("Finished. Dumping final PMF"); println!("Finished. Dumping final PMF");
let free_energy = calc_free_energy(&dataset, &P); let free_energy = calc_free_energy(&dataset, &P);
dump_state(&dataset, &F, &F_prev, &P, &free_energy); dump_state(&dataset, &F, &F_prev, &P, &P_std, &free_energy, &free_energy_std);
io::write_results(&cfg.output, &dataset, &free_energy, &P) io::write_results(&cfg.output, &dataset, &free_energy, &free_energy_std, &P, &P_std)
.chain_err(|| "Could not write results to output file")?; .chain_err(|| "Could not write results to output file")?;
Ok(()) Ok(())
@@ -191,16 +207,17 @@ fn calc_free_energy(dataset: &Dataset, P: &[f64]) -> Vec<f64> {
free_energy free_energy
} }
fn dump_state(dataset: &Dataset, F: &[f64], F_prev: &[f64], P: &[f64], A: &[f64]) { fn dump_state(dataset: &Dataset, F: &[f64], F_prev: &[f64], P: &[f64], P_std: &[f64], A: &[f64], A_std: &[f64]) {
// TODO fix output of F/F_prev
let out = std::io::stdout(); let out = std::io::stdout();
let mut lock = out.lock(); let mut lock = out.lock();
writeln!(lock, "# PMF"); writeln!(lock, "# PMF");
writeln!(lock, "#bin\t\tFree Energy\t\tP(x)"); writeln!(lock, "#bin\t\tFree Energy\t\t+/-\t\tP(x)\t\t+/-");
for bin in 0..dataset.num_bins { for bin in 0..dataset.num_bins {
writeln!(lock, "{:9.5}\t{:9.5}\t{:9.5}", bin, A[bin], P[bin]); writeln!(lock, "{:9.5}\t{:9.5}\t{:9.5}\t{:9.5}\t{:9.5}", bin, A[bin], A_std[bin], P[bin], P_std[bin]);
} }
writeln!(lock, "# Bias offsets"); writeln!(lock, "# Bias offsets");
writeln!(lock, "#Window\t\tF\t\tdF"); writeln!(lock, "#Window\t\tF\t\tF_prev");
for window in 0..dataset.num_windows { for window in 0..dataset.num_windows {
writeln!(lock, "{}\t{:9.5}\t{:8.8}", window, F[window], (F[window]-F_prev[window]).abs()); writeln!(lock, "{}\t{:9.5}\t{:8.8}", window, F[window], (F[window]-F_prev[window]).abs());
} }

View File

@@ -28,6 +28,8 @@ fn cli() -> Result<Config> {
.split(',').map(|x| { x.parse().unwrap() }).collect(); .split(',').map(|x| { x.parse().unwrap() }).collect();
let num_bins: Vec<usize> = matches.value_of("bins").unwrap() let num_bins: Vec<usize> = matches.value_of("bins").unwrap()
.split(',').map(|x| { x.parse().unwrap() }).collect(); .split(',').map(|x| { x.parse().unwrap() }).collect();
let bootstrap: usize = matches.value_of("bootstrap").unwrap_or("0").parse()
.chain_err(|| "Cannot parse bootstrap iteration.")?;
if num_bins.len() != hist_max.len() || num_bins.len() != hist_max.len() { if num_bins.len() != hist_max.len() || num_bins.len() != hist_max.len() {
eprintln!("Input dimensions do not match (min: {}, max: {}, bins: {})", eprintln!("Input dimensions do not match (min: {}, max: {}, bins: {})",
@@ -38,7 +40,8 @@ fn cli() -> Result<Config> {
let dimens = num_bins.len(); let dimens = num_bins.len();
Ok(wham::Config{metadata_file, hist_min, hist_max, num_bins, dimens, Ok(wham::Config{metadata_file, hist_min, hist_max, num_bins, dimens,
verbose, tolerance, max_iterations, temperature, cyclic, output}) verbose, tolerance, max_iterations, temperature, cyclic, output,
bootstrap})
} }
fn main() { fn main() {