Hot-keys on this page
r m x p toggle line displays
j k next/prev highlighted chunk
0 (zero) top of page
1 (one) first highlighted chunk
1"""Isotope data extracted from NIST public website.
3Source data has been compiled by NIST:
5 https://www.nist.gov/pml/atomic-weights-and-isotopic-compositions-relative-atomic-masses
7The atomic weights data were published in:
9 J. Meija et al, Atomic weights of the elements 2013,
10 Pure and Applied Chemistry 88, 265-291 (2016).
11 https://doi.org/10.1515/pac-2015-0305
12 http://www.ciaaw.org/atomic-weights.htm
14Isotopic compositions data were published in:
16 Michael Berglund and Michael E. Wieser,
17 Isotopic compositions of the elements 2009 (IUPAC Technical Report)
18 Pure Appl. Chem., 2011, Vol. 83, No. 2, pp. 397-410
19 https://doi.org/10.1351/PAC-REP-10-06-02
21The relative atomic masses of the isotopes data were published in:
23 M. Wang, G. Audi, A.H. Wapstra, F.G. Kondev, M. MacCormick, X. Xu,
24 and B. Pfeiffer, The AME2012 Atomic Mass Evaluation,
25 Chinese Phys. C 36 1603
26 https://doi.org/10.1088/1674-1137/36/12/003
27 http://amdc.impcas.ac.cn/evaluation/data2012/ame.html
28"""
29from urllib import request
32def download_isotope_data():
33 """Download isotope data from NIST public website.
35 Relative atomic masses of individual isotopes their abundance
36 (mole fraction) are compiled into a dictionary. Individual items can be
37 indexed by the atomic number and mass number, e.g. titanium-48:
39 >>> from ase.data.isotopes import download_isotope_data
40 >>> isotopes = download_isotope_data()
41 >>> isotopes[22][48]['mass']
42 47.94794198
43 >>> isotopes[22][48]['composition']
44 0.7372
45 """
47 url = 'http://physics.nist.gov/cgi-bin/Compositions/stand_alone.pl' \
48 '?ele=&ascii=ascii&isotype=all'
50 with request.urlopen(url) as fd:
51 txt = fd.read()
53 raw_data = txt.decode().splitlines()
55 return parse_isotope_data(raw_data)
58def parse_isotope_data(raw_data):
59 # In the list of raw data, a string containing only a series of underscores
60 # preceeds the data for each element. So by getting the indexes of these
61 # strings, we are recording where in the data each element starts
62 indexes = [idx for (idx, line) in enumerate(raw_data) if "_____" in line]
64 isotopes = {}
65 for idx1, idx2 in zip(indexes, indexes[1:]):
66 atomic_number = int(raw_data[idx1 + 1].split()[0])
67 isotopes[atomic_number] = dct = {}
68 for isotope_idx in range(idx1 + 1, idx2):
69 mass_number = int(raw_data[isotope_idx][8:12])
70 # drop uncertainty
71 mass = float(raw_data[isotope_idx][13:31].split('(')[0])
72 try:
73 composition = float(raw_data[isotope_idx][32:46].split('(')[0])
74 except ValueError:
75 composition = 0.0
76 dct[mass_number] = {'mass': mass, 'composition': composition}
78 return isotopes