Skip to article frontmatterSkip to article content
Site not loading correctly?

This may be due to an incorrect BASE_URL configuration. See the MyST Documentation for reference.

Visualizing Atomic Orbitals Using Programming

Estimated Time: 15-30 minutes
Notebook Developed By: Lan Dinh

Welcome! This notebook will help you understand and visualize atomic orbitals using Python programming. By the end of this lesson, you will be able to plot wave functions of different orbitals and gain insights into their shapes and properties.

The source for this notebook is:

https://weisscharlesj.github.io/SciCompforChemists/notebooks/chapter_03/chap_03_notebook.html

Note: To run a cell, first move your cursor over it and click once. After that, press Ctrl + Enter on your keyboard. Remember to run the cells sequentially from top to bottm of this notebook to avoid errors.

Learning Outcomes

By the end of this notebook, you will:

  • Calculate and visualize the radial wavefunctions Rnl(r)R_{nl}(r) for hyrogen orbitals 1s, 2s, 3s, 2p, 3p, and 3d.

  • Visualize and compare the angular shapes of ss, pxp_{x}, dxyd_{xy}, and dz2d_{z^2} orbitals in polar coordinates.

Table of Contents

  1. Context Background

  2. Radial Wavefunctions
    2.1. Mathematical Definitions
    2.2. Python Implementation

  3. Angular Wavefuncions in Polar Coordinates
    3.1. Mathematical Definitions
    3.2. Python Implementation


Run the cell below to import all our required materials for this notebook!

1. Context Background

Atomic orbitals are fundamental concepts in quantum chemistry and atomic physics, describing the regions in an atom where electrons are most likely to be found. Understanding the shapes and properties of these orbitals is crucial for comprehending chemical bonding, electron configurations, and the behavior of atoms in various chemical reactions.

Traditional methods of teaching atomic orbitals often rely on static images and mathematical equations, which can be abstract and challenging for students to visualize and grasp. However, with the advent of programming and computational tools, we can create dynamic visualizations that bring these abstract concepts to life.

This module aims to leverage the power of Python programming to visualize atomic orbitals, making the learning process more interactive and engaging. By combining theoretical principles with practical coding exercises, students can gain a deeper understanding of the spatial distributions and characteristics of different orbitals.

2. Radial Wavefunctions

2.1. Radial Wavefunctions: Mathematical Definitions

Constants

The following constants are used in the calculations:

  • a0=52.92 pma_0 = 52.92 \, \mathrm{pm}: The Bohr radius, representing the average distance of an electron in the ground state of hydrogen.

  • Z=1Z = 1: The atomic number of hydrogen, which has one proton in the nucleus.

Radial Wavefunctions

The radial wavefunctions Rnl(r)R_{nl}(r) describe the radial part of the wavefunction for hydrogen orbitals. These functions depend on the principal quantum number nn, orbital angular momentum quantum number ll, and the distance rr from the nucleus.

General Formula

Each radial wavefunction has the general form:

Rnl(r)=f(r,Z,a0)⋅e−σ/2,R_{nl}(r) = f(r, Z, a_0) \cdot e^{-\sigma / 2},

where:

  • σ=2Zrna0\sigma = \frac{2Zr}{n a_0}: A dimensionless parameter scaling with the distance rr.

  • f(r,Z,a0)f(r, Z, a_0): A polynomial factor specific to each orbital.

  • e−σ/2e^{-\sigma / 2}: Exponential decay, representing the decrease in wavefunction amplitude as distance increases.

Specific Radial Wavefunctions

The following are the specific radial wavefunctions for hydrogen orbitals:

  • 1s1s Orbital

    R1s(r)=2(Za0)3/2e−σ/2,R_{1s}(r) = 2 \left( \frac{Z}{a_0} \right)^{3/2} e^{-\sigma / 2},

    where σ=2Zra0\sigma = \frac{2Zr}{a_0}.

  • 2s2s Orbital

    R2s(r)=122(Za0)3/2(2−σ)e−σ/2,R_{2s}(r) = \frac{1}{2\sqrt{2}} \left( \frac{Z}{a_0} \right)^{3/2} (2 - \sigma) e^{-\sigma / 2},

    where σ=Zra0\sigma = \frac{Zr}{a_0}.

  • 3s3s Orbital

    R3s(r)=193(Za0)3/2(6−6σ+σ2)e−σ/2,R_{3s}(r) = \frac{1}{9\sqrt{3}} \left( \frac{Z}{a_0} \right)^{3/2} (6 - 6\sigma + \sigma^2) e^{-\sigma / 2},

    where σ=2Zr3a0\sigma = \frac{2Zr}{3a_0}.

  • 2p2p Orbital

    R2p(r)=126(Za0)3/2σe−σ/2,R_{2p}(r) = \frac{1}{2\sqrt{6}} \left( \frac{Z}{a_0} \right)^{3/2} \sigma e^{-\sigma / 2},

    where σ=Zra0\sigma = \frac{Zr}{a_0}.

  • 3p3p Orbital

    R3p(r)=196(Za0)3/2σ(4−σ)e−σ/2,R_{3p}(r) = \frac{1}{9\sqrt{6}} \left( \frac{Z}{a_0} \right)^{3/2} \sigma (4 - \sigma) e^{-\sigma / 2},

    where σ=2Zr3a0\sigma = \frac{2Zr}{3a_0}.

  • 3d3d Orbital

    R3d(r)=1930(Za0)3/2σ2e−σ/2,R_{3d}(r) = \frac{1}{9\sqrt{30}} \left( \frac{Z}{a_0} \right)^{3/2} \sigma^2 e^{-\sigma / 2},

    where σ=2Zr3a0\sigma = \frac{2Zr}{3a_0}.

2.2. Radial Wavefunctions: Python

Now, let’s translate the mathematical formulas into Python code. The code cell below implements the radial wavefunctions for each orbital using the equations presented earlier.

Each function corresponds to the formula provided above (e.g., radial_1s for R1s(r)R_{1s}(r)) and calculates the value of the radial wavefunction at a given distance r.

Run the cell below to define these functions

What Does This Code Do?

This code calculates mathematical functions called radial wave-functions for the hydrogen atom. These functions describe the shape of an electron's wave in different energy levels around a hydrogen atom.


Imagine an electron’s position as a "cloud" around the nucleus of the atom. These functions help us calculate:
  • How far the electron is likely to be from the nucleus.

  • What shape the "cloud" will have for different electron orbitals.

The goal is to use math to represent the electron cloud and understand its structure.

What the Code Does

  • np.linspace(0, 2000, 500): Creates an array of 50 values, evenly spaced from 0 to 2000 pm.

  • Radial Functions (radial_1s, etc.): Calculate the wave-function value for each distance r in the array.

  • Result Variables: R_1s, R_2s, etc., store the output of the calculations for the respective orbitals.

Now, let’s explore and visualize each radial wavefunction individually. Run the cell below and use the dropdown menu to select and visualize different orbital levels.

Let’s visualize all the radial wavefunctions together in a single plot for comparison.

3. Angular Wavefuncions in Polar Coordinates

3.1. Angular Wavefuncions in Polar Coordinates: Mathematical Definitions

The angular wavefunctions Ylm(θ,ϕ)Y_{lm}(\theta, \phi) describe the angular dependence of the wavefunction for hydrogen orbitals. These depend on the angular momentum quantum numbers ll and mlm_l, and the spherical coordinates θ\theta (polar angle) and ϕ\phi (azimuthal angle).

Angular Wavefunctions

The following are the angular wavefunctions for selected hydrogen orbitals:

  • ss Orbital

    Ys(θ,ϕ)=14πY_s(\theta, \phi) = \frac{1}{\sqrt{4\pi}}

    The ss orbital is spherically symmetric, meaning its angular component is independent of θ\theta and ϕ\phi.

  • pxp_x Orbital

    Ypx(θ,ϕ)=34πsin⁡θcos⁡ϕY_{p_x}(\theta, \phi) = \sqrt{\frac{3}{4\pi}} \sin\theta \cos\phi

    The pxp_x orbital has a directional dependence, with lobes along the xx-axis determined by sin⁡θ\sin\theta and cos⁡ϕ\cos\phi.

  • dxyd_{xy} Orbital

    Ydxy(θ,ϕ)=1516πsin⁡2θsin⁡(2ϕ)Y_{d_{xy}}(\theta, \phi) = \sqrt{\frac{15}{16\pi}} \sin^2\theta \sin(2\phi)

    The dxyd_{xy} orbital exhibits a cloverleaf shape in the xyxy-plane, influenced by sin⁡2θ\sin^2\theta and sin⁡(2ϕ)\sin(2\phi).

  • dz2d_{z^2} Orbital

    Ydz2(θ,ϕ)=516π(3cos⁡2θ−1)Y_{d_{z^2}}(\theta, \phi) = \sqrt{\frac{5}{16\pi}} \left( 3\cos^2\theta - 1 \right)

    The dz2d_{z^2} orbital has a unique shape with a “donut-like” region around the zz-axis, determined by cos⁡2θ\cos^2\theta.

Conversion to Cartesian Coordinates

To plot these angular wavefunctions in three dimensions, the spherical coordinates (r,θ,ϕ)(r, \theta, \phi) are converted to Cartesian coordinates (x,y,z)(x, y, z) using the following equations:

  • xx-coordinate

    x=rsin⁡θcos⁡ϕx = r \sin\theta \cos\phi
  • yy-coordinate

    y=rsin⁡θsin⁡ϕy = r \sin\theta \sin\phi
  • zz-coordinate

    z=rcos⁡θz = r \cos\theta

Summary

  • Angular wavefunctions define the shape and orientation of orbitals.

  • Cartesian conversion allows visualization in 3D space by transforming spherical coordinates to Cartesian coordinates.

3.2. Angular Wavefuncions in Polar Coordinates: Python Implementation

What Does This Code Do?

This code calculates the angular wave-functions of hydrogen atom orbitals, which describe the shape and orientation of the "electron cloud" around the nucleus. These wave-functions depend on the angles $\theta$ (polar) and $\phi$ (azimuthal), and they help us determine the specific patterns or lobes of electron probability in 3D space.
Think of the electron cloud as a 3D shape around the nucleus, where these angular wave-functions determine:

  • How the electron cloud spreads in different directions.

  • The specific symmetries and shapes of orbitals like s, px, dxy, and dz2.

The code also includes a conversion function to transform these angular patterns into Cartesian coordinates (x, y, z), which are essential for plotting the shapes of orbitals in 3D space.

What The Code Does

  • theta (Polar Angle): Ranges from 0 (north pole) to π (south pole). This controls the "vertical" spread of the orbital.

  • phi (Azimuthal Angle): Ranges from 0 to 2 π, covering a full circle around the z-axis. This controls the "horizontal" rotation of the orbital.

  • np.meshgrid: Creates a grid of θ and φ, so the wave-functions can be evaluated at all combinations of these angles.


Congratulations! You Have Completed the Notebook!