mendeleev tutorial

This simple tutorial will illustrate the basic capabilities of the package.

Basic interactive usage

Getting single elements

The simplest way of accessing the elements is importing them directly from mendeleev by symbols

In [6]:
from mendeleev import Si, Fe, O
print("Si's name: ", Si.name)
print("Fe's atomic number:", Fe.atomic_number)
print("O's atomic weight: ", O.atomic_weight)
Si's name:  Silicon
Fe's atomic number: 26
O's atomic weight:  15.999

An alternative interface to the data is through the element function that returns a single Element object or a list of Element object depending on the arguments.

The function can be imported directly from the mendeleev package

In [7]:
from mendeleev import element

The element method accepts unique identifiers: atomic number, atomic symbol or element’s name in English. To retrieve the entries on Silicon by symbol type

In [8]:
si = element('Si')
In [9]:
si
Out[9]:
Element(
    abundance_crust=282000.0,
    abundance_sea=2.2,
    annotation='',
    atomic_number=14,
    atomic_radius=132.0,
    atomic_radius_rahm=231.99999999999997,
    atomic_volume=12.1,
    atomic_weight=28.085,
    atomic_weight_uncertainty=None,
    block='p',
    boiling_point=2628.0,
    c6=305.0,
    c6_gb=308.0,
    cas='7440-21-3',
    covalent_radius_bragg=117.0,
    covalent_radius_cordero=111.00000000000001,
    covalent_radius_pyykko=115.99999999999999,
    covalent_radius_pyykko_double=107.0,
    covalent_radius_pyykko_triple=102.0,
    covalent_radius_slater=110.00000000000001,
    cpk_color='#daa520',
    density=2.33,
    description="Metalloid element belonging to group 14 of the periodic table. It is the second most abundant element in the Earth's crust, making up 25.7% of it by weight. Chemically less reactive than carbon. First identified by Lavoisier in 1787 and first isolated in 1823 by Berzelius.",
    dipole_polarizability=37.31,
    discoverers='Jöns Berzelius',
    discovery_location='Sweden',
    discovery_year=1824,
    ec=<ElectronicConfiguration(conf="1s2 2s2 2p6 3s2 3p2")>,
    econf='[Ne] 3s2 3p2',
    electron_affinity=1.3895211,
    en_allen=11.33,
    en_ghosh=0.178503,
    en_pauling=1.9,
    evaporation_heat=383.0,
    fusion_heat=50.6,
    gas_basicity=814.1,
    geochemical_class='major',
    goldschmidt_class='litophile',
    group=<Group(symbol=IVA, name=Carbon group)>,
    group_id=14,
    heat_of_formation=450.0,
    ionic_radii=[IonicRadius(
    atomic_number=14,
    charge=4,
    coordination='IV',
    crystal_radius=40.0,
    econf='2p6',
    id=379,
    ionic_radius=26.0,
    most_reliable=True,
    origin='',
    spin='',
), IonicRadius(
    atomic_number=14,
    charge=4,
    coordination='VI',
    crystal_radius=54.0,
    econf='2p6',
    id=380,
    ionic_radius=40.0,
    most_reliable=True,
    origin='from r^3 vs V plots, ',
    spin='',
)],
    is_monoisotopic=None,
    is_radioactive=False,
    isotopes=[<Isotope(Z=14, A=28, mass=27.976926535)>, <Isotope(Z=14, A=29, mass=28.976494665)>, <Isotope(Z=14, A=30, mass=29.97377001)>],
    jmol_color='#f0c8a0',
    lattice_constant=5.43,
    lattice_structure='DIA',
    melting_point=1683.0,
    metallic_radius=117.0,
    metallic_radius_c12=138.0,
    molcas_gv_color='#f0c8a0',
    name='Silicon',
    name_origin='Latin: silex, silicus, (flint).',
    period=3,
    proton_affinity=837.0,
    screening_constants=[<ScreeningConstant(Z=  14, n=  1, s=s, screening=    0.4255)>, <ScreeningConstant(Z=  14, n=  2, s=p, screening=    4.0550)>, <ScreeningConstant(Z=  14, n=  2, s=s, screening=    4.9800)>, <ScreeningConstant(Z=  14, n=  3, s=p, screening=    9.7148)>, <ScreeningConstant(Z=  14, n=  3, s=s, screening=    9.0968)>],
    sources='Makes up major portion of clay, granite, quartz (SiO2), and sand. Commercial production depends on a reaction between sand (SiO2) and carbon at a temperature of around 2200 °C.',
    specific_heat=0.703,
    symbol='Si',
    thermal_conductivity=149.0,
    uses='Used in glass as silicon dioxide (SiO2). Silicon carbide (SiC) is one of the hardest substances known and used in polishing. Also the crystalline form is used in semiconductors.',
    vdw_radius=210.0,
    vdw_radius_alvarez=219.0,
    vdw_radius_batsanov=210.0,
    vdw_radius_bondi=210.0,
    vdw_radius_dreiding=426.99999999999994,
    vdw_radius_mm3=229.0,
    vdw_radius_rt=None,
    vdw_radius_truhlar=None,
    vdw_radius_uff=429.5,
)

Similarly to access the data by atomic number or element names type

In [10]:
al = element(13)
print(al.name)
Aluminum
In [11]:
o = element('Oxygen')
print(o.atomic_number)
8

Getting list of elements

The element method also accepts list or tuple of identifiers and then returns a list of Element objects

In [12]:
c, h, o = element(['C', 'Hydrogen', 8])
print(c.name, h.name, o.name)
Carbon Hydrogen Oxygen

Extended attributes

Next to simple attributes returning str, int or float, there are extended attributes

  • oxistates, returns a list of oxidation states
  • ionenergies, returns a dictionary of ionization energies
  • isotopes, returns a list of Isotope objects
  • ionic_radii returns a list of IonicRadius objects
  • ec, electronic configuration object

Oxidation states

oxistates returns a list of most common oxidation states for a given element

In [13]:
fe = element('Fe')
print(fe.oxistates)
[6, 3, 2, 0, -2]

Ionization energies

The ionenergies returns a dictionary with ionization energies in eV as values and degrees of ionization as keys

In [14]:
o = element('O')
o.ionenergies
Out[14]:
{1: 13.618054,
 2: 35.12111,
 3: 54.93554,
 4: 77.4135,
 5: 113.8989,
 6: 138.1189,
 7: 739.32679,
 8: 871.40985}

Isotopes

The isotopes attribute returns a list of Isotope objects with the following attributes per isotope

  • abundance
  • atomic_number
  • half_life
  • half_life_unit
  • is_radioactive
  • mass
  • mass_number
  • mass_uncertainty
In [15]:
print("{0:^4s} {1:^4s} {2:^10s} {3:8s} {4:6s} {5:5s}\n{6}".format("AN", "MN", "Mass", "Unc.", "Abu.", "Rad.", "-"*42))
for iso in fe.isotopes:
    print('{0:4d} {1:4d} {2:10.5f} {3:8.2e} {4:6.2f} {5:}'.format(
        iso.atomic_number, iso.mass_number, iso.mass, iso.mass_uncertainty, iso.abundance * 100.0, iso.is_radioactive))
 AN   MN     Mass    Unc.     Abu.   Rad.
------------------------------------------
  26   54   53.93961 3.00e-06   5.85 False
  26   56   55.93494 3.00e-06  91.75 False
  26   57   56.93539 3.00e-06   2.12 False
  26   58   57.93327 3.00e-06   0.28 False

Ionic radii

Another composite attribute is ionic_radii which returns a list of IonicRadius object with the following attributes

  • atomic_number, atomic number of the ion
  • charge, charge of the ion
  • econf, electronic configuration of the ion
  • coordination, coordination type of the ion
  • spin, spin state of the ion (HS or LS)
  • crystal_radius, crystal radius in pm
  • ionic_radius, ionic radius in pm
  • origin, source of the data
  • most_reliable, recommended value, (see the original paper for more information)
In [16]:
for ir in fe.ionic_radii:
    print(ir)
charge=   2, coordination=IV   , crystal_radius=77.000, ionic_radius=63.000
charge=   2, coordination=IVSQ , crystal_radius=78.000, ionic_radius=64.000
charge=   2, coordination=VI   , crystal_radius=75.000, ionic_radius=61.000
charge=   2, coordination=VI   , crystal_radius=92.000, ionic_radius=78.000
charge=   2, coordination=VIII , crystal_radius=106.000, ionic_radius=92.000
charge=   3, coordination=IV   , crystal_radius=63.000, ionic_radius=49.000
charge=   3, coordination=V    , crystal_radius=72.000, ionic_radius=58.000
charge=   3, coordination=VI   , crystal_radius=69.000, ionic_radius=55.000
charge=   3, coordination=VI   , crystal_radius=78.500, ionic_radius=64.500
charge=   3, coordination=VIII , crystal_radius=92.000, ionic_radius=78.000
charge=   4, coordination=VI   , crystal_radius=72.500, ionic_radius=58.500
charge=   6, coordination=IV   , crystal_radius=39.000, ionic_radius=25.000

electronic configuration

ec attribute is an object from the ElectronicConfiguration class that has additional method for manipulating the configuration. Internally the configuration is represented as a OrderedDict from the collections module where tuples (n, s) (n is the principal quantum number and s is the subshell label) are used as keys and shell occupations are the values

In [17]:
si.ec.conf
Out[17]:
OrderedDict([((1, 's'), 2),
             ((2, 's'), 2),
             ((2, 'p'), 6),
             ((3, 's'), 2),
             ((3, 'p'), 2)])

the occupation of different subshells can be access supplying a proper key

In [18]:
si.ec.conf[(1, 's')]
Out[18]:
2

to calculate the number of electrons per shell type

In [19]:
si.ec.electrons_per_shell()
Out[19]:
{'K': 2, 'L': 8, 'M': 4}

get the largest value of the pricipal quantum number

In [20]:
si.ec.max_n()
Out[20]:
3

Some useful functions

Next to stored attributes there is a number of useful functions

In [21]:
si = element('Si')
In [22]:
# get the number of valence electrons
si.nvalence()
Out[22]:
4
In [23]:
# calculate softness for an ion
si.softness(charge=2)
Out[23]:
0.058318712346158874
In [24]:
# calcualte hardness for an ion
si.hardness(charge=4)
Out[24]:
60.812605
In [25]:
# calculate mulliken electronegativity for a neutral atom or ion
si.en_mulliken(charge=1)
Out[25]:
8.1729225
In [26]:
# calculate the effective nuclear charge for a subshell using Slater's rules
si.zeff(n=3, o='s')
Out[26]:
4.149999999999999
In [27]:
# calculate the effective nuclear charge for a subshell using Clemneti's and Raimondi's exponents
si.zeff(n=3, o='s', method='clementi')
Out[27]:
4.9032

Electronegativity

Currently there are 9 electronagativity scales implemented that can me accessed though the common electronegativity method, the scales are:

  • allen
  • allred-rochow
  • cottrell-sutton
  • gordy
  • li-xue
  • mulliken
  • nagle
  • pauling
  • sanderson

More information can be found in the documentation.

In [28]:
si.electronegativity(scale='pauling')
Out[28]:
1.9
In [29]:
si.electronegativity(scale='allen')
Out[29]:
11.33

CLI utility

For those who work in the terminal there is a simple command line interface (CLI) for printing the information about a given element. The script name is element.py and it accepts either the symbol or name of the element as an argument and prints the data about it. For example, to print the properties of silicon type

In [31]:
!element.py Si
   _  _  _  _      _
 _(_)(_)(_)(_)_   (_)
(_)          (_)_  _
(_)_  _  _  _  (_)(_)
  (_)(_)(_)(_)_   (_)
 _           (_)  (_)
(_)_  _  _  _(_)_ (_) _
  (_)(_)(_)(_) (_)(_)(_)



Description
===========

  Metalloid element belonging to group 14 of the periodic table. It is
  the second most abundant element in the Earth's crust, making up 25.7%
  of it by weight. Chemically less reactive than carbon. First
  identified by Lavoisier in 1787 and first isolated in 1823 by
  Berzelius.

Properties
==========

Abundance crust                                                           282000
Abundance sea                                                                2.2
Annotation
Atomic number                                                                 14
Atomic radius                                                                132
Atomic radius rahm                                                           232
Atomic volume                                                               12.1
Atomic weight                                                             28.085
Atomic weight uncertainty                                                    NaN
Block                                                                          p
Boiling point                                                               2628
C6                                                                           305
C6 gb                                                                        308
Cas                                                                    7440-21-3
Covalent radius bragg                                                        117
Covalent radius cordero                                                      111
Covalent radius pyykko                                                       116
Covalent radius pyykko double                                                107
Covalent radius pyykko triple                                                102
Covalent radius slater                                                       110
Cpk color                                                                #daa520
Density                                                                     2.33
Dipole polarizability                                                      37.31
Discoverers                                                       Jöns Berzelius
Discovery location                                                        Sweden
Discovery year                                                              1824
Electron affinity                                                        1.38952
Electronic configuration                                            [Ne] 3s2 3p2
En allen                                                                   11.33
En ghosh                                                                0.178503
En pauling                                                                   1.9
Evaporation heat                                                             383
Fusion heat                                                                 50.6
Gas basicity                                                               814.1
Geochemical class                                                          major
Goldschmidt class                                                      litophile
Group id                                                                      14
Heat of formation                                                            450
Is monoisotopic                                                             None
Is radioactive                                                             False
Jmol color                                                               #f0c8a0
Lattice constant                                                            5.43
Lattice structure                                                            DIA
Melting point                                                               1683
Metallic radius                                                              117
Metallic radius c12                                                          138
Molcas gv color                                                          #f0c8a0
Name                                                                     Silicon
Name origin                                      Latin: silex, silicus, (flint).
Period                                                                         3
Proton affinity                                                              837
Series id                                                                      5
Sources                        Makes up major portion of clay, granite, quart...
Specific heat                                                              0.703
Symbol                                                                        Si
Thermal conductivity                                                         149
Uses                           Used in glass as silicon dioxide (SiO2). Silic...
Vdw radius                                                                   210
Vdw radius alvarez                                                           219
Vdw radius batsanov                                                          210
Vdw radius bondi                                                             210
Vdw radius dreiding                                                          427
Vdw radius mm3                                                               229
Vdw radius rt                                                                NaN
Vdw radius truhlar                                                           NaN
Vdw radius uff                                                             429.5
In [33]:
%version_information mendeleev, sqlalchemy
Out[33]:
SoftwareVersion
Python3.6.3 64bit [GCC 7.2.0]
IPython6.2.1
OSLinux 4.9.0 4 amd64 x86_64 with debian 9.1
mendeleev0.3.6
sqlalchemy1.1.13
Wed Nov 01 14:28:45 2017 CET