angularsen / UnitsNet

Makes life working with units of measurement just a little bit better.
https://www.nuget.org/packages/UnitsNet/
MIT No Attribution
2.19k stars 380 forks source link

New Units - Molecular Mass (Dalton) #1397

Closed rogerfydp closed 1 month ago

rogerfydp commented 3 months ago

Is your feature request related to a problem? Please describe. Within existing quantity Mass there is no units often used for "Molecular mass"

Describe the solution you'd like Molecular mass (m) is the mass of a given molecule. The unit dalton (Da) is often used.

Will be nice to extend the quantity mass (if it's the proper one) to include Dalton (unit) such as,

Describe alternatives you've considered None. Using other mass units for 'molecular mass' is not common.

angularsen commented 3 months ago

Hi, sure this sounds reasonable to add. Would you be interested in attempting a pull request? I'm happy to assist.

Detailed steps here: https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit

rogerfydp commented 3 months ago

Hi, thanks for accepting it!

I can do a pull request, no problem.

I was adding the quantity mass.json in the following way,

{
  "SingularName": "Dalton",
  "PluralName": "Daltons",
  "BaseUnits": {
    "M": "Dalton"
  },
  "FromUnitToBaseFunc": "{x} * 1.66053906660e-27",
  "FromBaseToUnitFunc": "{x} / 1.66053906660e-27",
  "Prefixes": ["Kilo", "Mega", "Giga"],
  "Localization": [
    {
      "Culture": "en-US",
      "Abbreviations": ["Da"]
    }
  ],
  "XmlDocSummary": "A Dalton, also known as the unified atomic mass unit, is a unit of mass commonly used to express the mass of atoms and molecules. It is defined as one twelfth of the mass of an unbound neutral atom of carbon-12 in its nuclear and electronic ground state.",
  "XmlDocRemarks": "https://en.wikipedia.org/wiki/Dalton_(unit)"
}

Taking initially the value from Wikipedia. But when double checking with other sources I see variations, here some examples.

Source Value
Wikipedia 1.66053906892(52)×10−27 kg
CODATA (2018) (page 50) 1.66053906660(50)x10−27
UCLA 1.660538921x10−27 kg
chemeurope.com 1.660538782(83)×10−27 kg

On the other hand, on Wikipedia's article, in the references we can find

Therefor I would like your opinion on the value to take, to comply with your project. Do you have any other reference or source?

Thanks!

angularsen commented 2 months ago

@rogerfydp Sorry for the late reply. I don't have any domain knowledge here, but generally I would follow SI definitions.

The wiki article seems quite thorough, but I'm confused why the wiki constant differs from CODATA/SI and I can't see any reference to where they got their value.

Until we learn otherwise, I'd say use CODATA/SI. They seem fairly up to date at least.

github-actions[bot] commented 1 month ago

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 7 days.

github-actions[bot] commented 1 month ago

This issue was automatically closed due to inactivity.