dnlbauer / WHAM

An efficient, multithreaded weighted histogram analysis (WHAM) implementation for the post-processing of umbrella MD simulations.
GNU General Public License v3.0
24 stars 5 forks source link

Make units of force constant configurable #16

Open tgmaxson opened 1 month ago

tgmaxson commented 1 month ago

What are the units of the force constant? From reading the src I cannot tell if this should be in kcal/mol or kT units etc.

It would be nice if we could supply the value of kB on the CLI such that we can use whatever unit we would like (or have a table to lookup from such as https://en.wikipedia.org/wiki/Boltzmann_constant#Value_in_different_units)

tgmaxson commented 1 month ago

Nevermind, I found the unit. Can we make this configurable? I am not familiar with Rust in general but I think this is an easy change.

static k_B: f64 = 0.008_314_462_1; // kJ/mol*K

dnlbauer commented 4 weeks ago

You're correct that the force constant is currently set in kJ/mol*K. This was what I typically worked with when writing the tool.

One thing to consider is that if we change the constant to be in any unit, the meaning of temperature also changes from "Temperature is always in Kelvin" to "in the format of k_B". But this is just a semantic issue.

If someone is interested in submitting a pull request to implement this feature, it should be a relatively simple change. kJ/mol*K should stay the default value to be backward compatible, though.