mirror of
https://github.com/dnlbauer/WHAM.git
synced 2026-09-10 22:25:31 +00:00
partial io for multidimensional WHAM
This commit is contained in:
22
src/main.rs
22
src/main.rs
@@ -13,17 +13,29 @@ fn cli() -> Result<Config, Box<Error>> {
|
||||
let yaml = load_yaml!("cli.yml");
|
||||
let matches = App::from_yaml(yaml).get_matches();
|
||||
let metadata_file = matches.value_of("metadata").unwrap().to_string();
|
||||
let hist_min: f64 = matches.value_of("min_hist").unwrap().parse()?;
|
||||
let hist_max: f64 = matches.value_of("max_hist").unwrap().parse()?;
|
||||
let num_bins: usize = matches.value_of("bins").unwrap().parse()?;
|
||||
let verbose: bool = matches.is_present("verbose");
|
||||
let temperature: f64 = matches.value_of("temperature").unwrap().parse()?;
|
||||
let tolerance: f64 = matches.value_of("tolerance").unwrap_or("0.000001").parse()?;
|
||||
let max_iterations: usize = matches.value_of("iterations").unwrap_or("100000").parse()?;
|
||||
let cyclic: bool = matches.is_present("cyclic");
|
||||
let output = matches.value_of("output").unwrap_or("wham.out").to_string();
|
||||
let cyclic: bool = matches.is_present("cyclic");
|
||||
|
||||
Ok(wham::Config{metadata_file, hist_min, hist_max, num_bins,
|
||||
let hist_min: Vec<f64> = matches.value_of("min_hist").unwrap()
|
||||
.split(':').map(|x| { x.parse().unwrap() }).collect();
|
||||
let hist_max: Vec<f64> = matches.value_of("max_hist").unwrap()
|
||||
.split(':').map(|x| { x.parse().unwrap() }).collect();
|
||||
let num_bins: Vec<usize> = matches.value_of("bins").unwrap()
|
||||
.split(':').map(|x| { x.parse().unwrap() }).collect();
|
||||
|
||||
if num_bins.len() != hist_max.len() || num_bins.len() != hist_max.len() {
|
||||
eprintln!("Input dimensions do not match (min: {}, max: {}, bins: {})",
|
||||
hist_min.len(), hist_max.len(), num_bins.len());
|
||||
process::exit(1);
|
||||
}
|
||||
|
||||
let dimens = num_bins.len();
|
||||
|
||||
Ok(wham::Config{metadata_file, hist_min, hist_max, num_bins, dimens,
|
||||
verbose, tolerance, max_iterations, temperature, cyclic, output})
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user