-
-
Notifications
You must be signed in to change notification settings - Fork 61
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversion between kcal/mol and eV #681
Comments
That is possible, but you need to divide by or multiply with
|
Thanks for your reply. This makes sense logically, but it might be difficult or unintuitive for beginners. However, the issue isn’t with numbat itself; rather, it is the longstanding, inconsistent conventions people have been using. I don't have any idea how to improve this. Maybe some casting rules? Another example would be cm-1, which is widely used as an energy unit. |
Electronvolts are also used for temperature in plasma physics. |
I have just pushed two changes to Numbat, one bugfix and one new function fn magic_energy<D: Dim>(q: D) -> Energy =
if is_zero(q)
then 0
else if is_dimensionless(q / K) # q is a temperature: E = k_B T
then k_B quantity_cast(q, K)
else if is_dimensionless(q / m) # q is a wavelength: E = ℎ c / λ
then ℎ c / quantity_cast(q, m)
else if is_dimensionless(q / g) # q is a mass: E = m c²
then quantity_cast(q, g) * c²
else if is_dimensionless(q / (cal/mol)) # q is energy per mole: E = q / N_A
then quantity_cast(q, cal/mol) / N_A
else error("magic_energy: Cannot convert quantity of unit '{unit_name(q)}' to an energy") This could then be used like:
We could provide similar "magic" conversion functions for other target dimensions. |
Let's actually close this in favor of an older ticket #481 |
The kilocalorie per mole is a (kcal/mol) is a unit to measure an amount of energy per number of molecules, atoms, or other similar particles. (https://en.wikipedia.org/wiki/Kilocalorie_per_mole). This unit is commonly used in chemistry and biology. It will be convenient to convert it to other energy units like eV, something like http://wild.life.nctu.edu.tw/class/common/energy-unit-conv-table.html.
Currently, it is impossible to do the conversion:
The text was updated successfully, but these errors were encountered: