Skip to content
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

Open
AllanChain opened this issue Jan 17, 2025 · 3 comments
Open

Conversion between kcal/mol and eV #681

AllanChain opened this issue Jan 17, 2025 · 3 comments
Labels

Comments

@AllanChain
Copy link

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:

>>> 1 kcal/mol -> eV
error: while type checking
  ┌─ <input:28>:1:1
  │
1 │ 1 kcal/mol -> eV
  │ ^^^^^^^^^^ -- ^^ Energy or Torque
  │ │          │
  │ │          incompatible dimensions in unit conversion
  │ ChemicalPotential or MolarEnthalpyOfVaporization
  │
  =  left hand side: Length² × Mass × Time⁻² × AmountOfSubstance⁻¹    [= ChemicalPotential, MolarEnthalpyOfVaporization]
    right hand side: Length² × Mass × Time⁻²                          [= Energy, Torque]

    Suggested fix: divide the expression on the right hand side by a `AmountOfSubstance` factor
@sharkdp
Copy link
Owner

sharkdp commented Jan 17, 2025

That is possible, but you need to divide by or multiply with N_A accordingly, as the error message suggests:

>>> 1 kcal/mol/N_A -> eV

    = 0.0433641 eV    [Energy or Torque]

>>> 1 eV*N_A -> kcal/mol

    = 23.0605 kcal/mol    [ChemicalPotential or MolarEnthalpyOfVaporization]

@AllanChain
Copy link
Author

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.

@suhr
Copy link

suhr commented Feb 7, 2025

Electronvolts are also used for temperature in plasma physics.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants