This file is indexed.

/usr/lib/python3/dist-packages/periodictable/density.py is in python3-periodictable 1.5.0-3.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
# This program is public domain
# Author: Paul Kienzle
r"""

The following properties are added:

*    density, density_units (|g/cm^3|)
        Densities for solids and liquids are given as specific
        gravities at 20\ |deg| C unless other wise indicated by
        *density_caveat*. Densities for gaseous elements
        are given for the liquids at their boiling points.
        Missing data are represented by *None*.
*   density_caveat
        Comments on the density, if not taken in standard conditions.
*   interatomic_distance, interatomic_distance_units (|Ang|)
        Interatomic distance estimated from element density.
*   number_density, number_density_units (|1/cm^3|)
        Number density estimated from mass and density.

Density for the isotope is computed assuming that the atomic spacing
is the same as that for the element in the natural abundance.

.. doctest::

    >>> from periodictable import D, H
    >>> print("H: %.4f, D: %.4f"%(H.density, D.density))
    H: 0.0708, D: 0.1415
    >>> print((D.density/H.density) / (D.mass/H.mass))
    1.0

The following plot shows density for all elements:

.. plot:: plots/density_plot.py

From the X-ray data book: http://xdb.lbl.gov/Section5/Sec_5-2.html

Data were taken mostly from [#Lide1999]_. These values are reproduced in [#ILL]_.

.. [#Lide1999] Lide. D. R., Ed., CRC Handbook of Chemistry and Physics, 80th ed.
       (CRC Press, Boca Raton, Florida, 1999)
.. [#ILL] The ILL Neutron Data Booklet, Second Edition.
"""

from .core import Element, Isotope
from .constants import avogadro_number

def density(iso_el):

    """
    Element density for natural abundance. For isotopes, return
    the equivalent density assuming identical inter-atomic spacing as the
    naturally occuring material.

    :Parameters:
        *iso_el* : isotope or element
            Name of the element or isotope.

    :Returns:
        *density* : float | |g/cm^3|

    Reference:
        *ILL Neutron Data Booklet, original values from CRC Handbook of Chemistry and Physics,
        80th ed. (1999).*

    """

    if hasattr(iso_el, 'element'):
        return iso_el.element._density * (iso_el.mass/iso_el.element.mass)
    else:
        return iso_el._density

def interatomic_distance(element):
    r"""
    Estimated interatomic distance from atomic weight and density. The
    distance between isotopes is assumed to match that between atoms in
    the natural abundance.

    :Parameters:
        *element* : Element
            The element whose interatomic distance is to be calculated.

    :Returns:
        *distance* : float | |Ang|
            Estimated interatomic distance.

    Interatomic distance is computed using:

    .. math::

        d = (m/(\rho_m N_A 10^{-24}))^{1/3}

    with units:

    .. math::

        (\rm (g\cdot mol^{-1})
        / ( (g\cdot cm^{-3})
            (atoms\cdot mol^{-1})
            (10^{-8} cm\cdot \AA^{-1})^3))^{1/3} = \AA

    """

    if hasattr(element, 'isotope'):
        element = element.element
    if element.density is None or element.mass is None:
        return None
    return (element.mass/(element.density*avogadro_number*1e-24))**(1./3.)

def number_density(element):
    r"""
    Estimate the number density from atomic weight and density. The density
    for isotopes is assumed to match that of between atoms in natural abundance.

    :Parameters:
        *element* : element
            Name of the element whose number density needs to be calculated.

    :Returns:
        *Nb* : float | |1/cm^3|
            Number density of a element.

    Number density is computed using:

    .. math::

        d = N_A \frac{\rho}{m}

    with units:

    .. math::

        \rm (atoms\cdot mol^{-1})  (g\cdot cm^{-3}) / (g\cdot mol^{-1})
            = atoms\cdot cm^{-3}

    """

    if hasattr(element, 'isotope'): element = element.element
    if element.density is None or element.mass is None: return None
    return (element.density/element.mass)*avogadro_number

def init(table, reload=False):
    if 'density' in table.properties and not reload: return
    table.properties.append('density')
    Isotope.density \
        = property(density, "density using inter-atomic spacing from naturally occurring form")
    Element.density \
        = property(density, "density using inter-atomic spacing from naturally occurring form")
    Element.density_units = "g/cm^3"

    Element.interatomic_distance \
        = property(interatomic_distance,
                   "interatomic distance estimated from density")
    Element.interatomic_distance_units = "angstrom"
    Element.number_density \
        = property(number_density,
                   "number density estimated from mass and density")
    Element.number_density_units = "1/cm^3"

    for k, v in element_densities.items():
        el = getattr(table, k)
        if isinstance(v, tuple):
            el._density = v[0]
            el.density_caveat = v[1]
        elif v is None:
            el._density = None
            el.density_caveat = "unavailable"
        else:
            el._density = v
            el.density_caveat = ""

element_densities = dict(
    n=None, # Unless someone wants to look up neutron star densities...
    H=(0.0708, "T=-252.87"),
    He=(0.122, "T=-268.93"),
    Li=0.534,
    Be=1.848,
    B=2.34,
    C=(2.1, "1.9-2.3 (graphite)"),
    N=(0.808, "T=-195.79"),
    O=(1.14, "T=-182.95"),
    F=(1.50, "T=-188.12"),
    Ne=(1.207, "T=-246.08"),
    Na=0.971,
    Mg=1.738,
    Al=2.6989,
    Si=(2.33, "T=25"),
    P=1.82,
    S=2.07,
    Cl=(1.56, "T=-33.6, 0.44 C above boiling point"),
    Ar=(1.40, "T=-185.85"),
    K=0.862,
    Ca=1.55,
    Sc=(2.989, "T=25"),
    Ti=4.54,
    V=(6.11, "T=18.7"),
    Cr=(7.19, "7.18-7.20"),
    Mn=(7.33, "7.21-7.44"),
    Fe=7.874,
    Co=8.9,
    Ni=(8.902, "T=25"),
    Cu=8.96,
    Zn=(7.133, "T=25"),
    Ga=(5.904, "T=29.6"),
    Ge=(5.323, "T=25"),
    As=5.73,
    Se=4.79,
    Br=3.12,
    Kr=(2.16, "T=-153.22"),
    Rb=1.532,
    Sr=2.54,
    Y=(4.469, "T=25"),
    Zr=6.506,
    Nb=8.57,
    Mo=10.22,
    Tc=(11.50, "calculated"),
    Ru=12.41,
    Rh=12.41,
    Pd=12.02,
    Ag=10.50,
    Cd=8.65,
    In=7.31,
    Sn=7.31,
    Sb=6.691,
    Te=6.24,
    I=4.93,
    Xe=(3.52, "T=-108.12"),
    Cs=1.873,
    Ba=3.5,
    La=(6.145, "T=25"),
    Ce=(6.770, "T=25"),
    Pr=6.773,
    Nd=(7.008, "T=25"),
    Pm=(7.264, "T=25"),
    Sm=(7.520, "T=25"),
    Eu=(5.244, "T=25"),
    Gd=(7.901, "T=25"),
    Tb=8.230,
    Dy=(8.551, "T=25"),
    Ho=(8.795, "T=25"),
    Er=(9.066, "T=25"),
    Tm=(9.321, "T=25"),
    Yb=6.966,
    Lu=(9.841, "T=25"),
    Hf=13.31,
    Ta=16.654,
    W=19.3,
    Re=21.02,
    Os=22.57,
    Ir=(22.42, "T=17"),
    Pt=21.45,
    Au=(19.3, "approximate"),
    Hg=13.546,
    Tl=11.85,
    Pb=11.35,
    Bi=9.747,
    Po=9.32,
    At=None,
    Rn=None,
    Fr=None,
    Ra=None,
    Ac=None,
    Th=11.72,
    Pa=(15.37, "calculated"),
    U=(18.95, "approximate"),
    Np=20.25,
    Pu=(19.84, "T=25"),
    Am=13.67,
    Cm=(13.51, "calculated"),
    Bk=(14, "estimated"),
    Cf=None,
    Es=None,
    Fm=None,
    Md=None,
    No=None,
    Lr=None,
    Rf=None,
    Db=None,
    Sg=None,
    Bh=None,
    Hs=None,
    Mt=None,
    Ds=None,
    Rg=None,
    Cn=None,
    Nh=None,
    Fl=None,
    Mc=None,
    Lv=None,
    Ts=None,
    Og=None,
    )