Skip to content

Conversation

@chselz
Copy link

@chselz chselz commented Oct 17, 2025

I implemented the atomic masses. This helps to assimilate tad-mctc (https://github.com/tad-mctc/tad-mctc/tree/main) and mctc-lib. the code is covered by tests.
The masses are taken from the xtb repository (commit 7618f60). build with fpm 0.11.0 and gfortran 11.4.0.

I found differences between the masses implemented in xtb and tad-mctc. this will likely lead to small differences in e.g. mass-weighted hessians between dxtb and xtb.

Christian Selzer added 2 commits October 17, 2025 14:28
Signed-off-by: Christian Selzer <[email protected]>
Signed-off-by: Christian Selzer <[email protected]>
@codecov
Copy link

codecov bot commented Oct 17, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 11.96%. Comparing base (fc096d6) to head (7d7b1f3).

❗ There is a different number of reports uploaded between BASE (fc096d6) and HEAD (7d7b1f3). Click for more details.

HEAD has 1 upload less than BASE
Flag BASE (fc096d6) HEAD (7d7b1f3)
2 1
Additional details and impacted files
@@             Coverage Diff             @@
##             main     #101       +/-   ##
===========================================
- Coverage   72.46%   11.96%   -60.51%     
===========================================
  Files          86        5       -81     
  Lines       12944      209    -12735     
  Branches     3783       95     -3688     
===========================================
- Hits         9380       25     -9355     
+ Misses        776      174      -602     
+ Partials     2788       10     -2778     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@awvwgk
Copy link
Member

awvwgk commented Oct 20, 2025

Maybe we can find a better ground truth for the atomic masses than the xtb source code like example codata. While I like to stay consistent with xtb having properly verified values in mctc-lib has higher priority.

@chselz
Copy link
Author

chselz commented Oct 24, 2025

Hi @awvwgk, thank you for looking into my PR. I agree with you that the xTB source code itself is probably not the best source for such information.

I took some time to look a little bit closer at this topic, and it is a little bit more complex than I hoped it to be. (as always XD) The main problem seems to me that there is not one single defined value for the isotopic composition of an element, as abundances vary for different terrestrial sources.

  1. In DFTB+ (https://github.com/dftbplus/dftbplus/blob/main/src/dftbp/common/atomicmass.F90), there is no source given at all.
  2. The source in tad-mctc (https://www.angelo.edu/faculty/kboudrea/periodic/structure_mass.htm.) is not available anymore.
  3. ASE (https://ase-lib.org/ase/data.html#ase.data.atomic_masses) provides two sources for atomic masses. The first one is an array with values taken from several IUPAC publications (https://gitlab.com/ase/ase/-/blob/master/ase/data/__init__.py?ref_type=heads) Here however, here for several elements the "conventional atomic weights" are taken, which have way less significant digits than what is currently used in xTB. The other source in ASE is pulling data directly from NIST (https://gitlab.com/ase/ase/-/blob/master/ase/data/isotopes.py?ref_type=heads)

As for several elements (many of the radioactive ones), no "standard atomic weight" can be given IUPAC has not published any values for them (https://www.ciaaw.org/atomic-weights.htm).

My best idea going forward is to use these values by NIST (https://www.nist.gov/pml/atomic-weights-and-isotopic-compositions-relative-atomic-masses) and calculate an isotope-averaged value based on the isotopic composition values given there, i.e.

$$ \text{Average atomic mass} = \sum_{i=1}^{n} (m_i \times a_i) $$

Where:

  • ( $$m_i$$ ) — mass of isotope i
  • ( $$a_i$$ ) — fractional (decimal) abundance of isotope i
  • ( $$n$$ ) — total number of isotopes considered
    For the heavy radioactive elements, the values in xTB and NIST seem to be consistent given that only one of the possible isotopes is used.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants