Code Monkey home page Code Monkey logo

quantummechanicsvisualized's Introduction

QuantumMechanicsVisualized

This repository contains functions to calculate and visualize the probability density of hydrogen atom orbitals in both 2D and 3D.

Theoretical Background

The probability density $|\Psi|^2$ of the hydrogen atom's electron is calculated using the wave function $\Psi$, which is a product of the radial and angular parts. The radial part depends on the principal and azimuthal quantum numbers n and l, while the angular part depends on the azimuthal and magnetic quantum numbers l and m.

Radial Part

The radial part of the wave function is given by:

$$ R_{nl}(r) = \sqrt{\left(\frac{2}{n a_0}\right)^3 \frac{(n-l-1)!}{2n[(n+l)!]^3}} e^{- \frac{r}{n a_0}} \left(\frac{2r}{n a_0}\right)^l L_{n-l-1}^{2l+1}\left(\frac{2r}{n a_0}\right) $$

where L are the generalized Laguerre polynomials and $a_0$ is the Bohr radius.

Angular Part

The angular part of the wave function is given by the spherical harmonics:

$$ Y_{lm}(\theta, \phi) = (-1)^{\frac{m + |m|}{2}} \sqrt{\frac{(2l + 1)}{4\pi} \frac{(l - |m|)!}{(l + |m|)!}} P_l^{|m|}(\cos \theta) e^{im\phi} $$

where $P_l^m$ are the associated Legendre polynomials.

Probability Density

The probability density $|\Psi|^2$ is the product of the square of the radial part and the square of the absolute value of the angular part:

$$ |\Psi|^2 = |R_{nl}(r) Y_{lm}(\theta, \phi)|^2 $$

Sample Visualizations

Below are some sample visualizations generated by the functions in this repository.

2D Probability Density Plots

2D Probability Density Plot

2D Probability Density Plot

Examples of a 2D probability density plot for hydrogen atom orbital.

3D Probability Density Plots

3D Probability Density Plot

3D Probability Density Plot

3D Probability Density Plot

3D Probability Density Plot

Examples of a 3D probability density plot for hydrogen atom orbital.

Functions

calculate_hydrogen_density_2d

Calculates the 2D probability density of a hydrogen atom orbital.

Parameters

  • n (int): Principal quantum number, defines the energy level.
  • l (int): Azimuthal quantum number, defines the shape of the orbital.
  • m (int): Magnetic quantum number, defines the orientation of the orbital.
  • $a_0$ (float): Bohr radius, default is 1.0.
  • grid_size (int): Resolution of the grid for calculations.

Returns

  • X, Y, density: 2D arrays representing the X, Y coordinates and the corresponding probability density.

Usage

X, Y, density = calculate_hydrogen_density_2d(n, l, m, a0, grid_size)

calculate_hydrogen_density_3d

Calculates the 3D probability density of a hydrogen atom orbital.

Parameters

  • n (int): Principal quantum number, defines the energy level.
  • l (int): Azimuthal quantum number, defines the shape of the orbital.
  • m (int): Magnetic quantum number, defines the orientation of the orbital.
  • $a_0$ (float): Bohr radius, default is 1.0.
  • grid_size (int): Resolution of the grid for calculations.

Returns

  • X, Y, Z, density: 3D arrays representing the X, Y, Z coordinates and the corresponding probability density.

Usage

X, Y, Z, density = calculate_hydrogen_density_3d(n, l, m, a0, grid_size)

Dependencies

  • Numpy
  • Scipy (for special functions like sph_harm)

License

This project is open-source and available under the MIT License.

quantummechanicsvisualized's People

Contributors

hitthecodelabs avatar hittheflash avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.