Skip to main content

A Python library for simulating Bohr atoms

Project description

BohrSolver

BohrSolver is a Python library to model hydrogen-like atoms using the Bohr model. It allows you to calculate energy levels, orbit radii, electronic transitions, and generate visualizations for both individual energy levels and electronic transitions.

The library is designed to be intuitive, providing a class-based interface (BohrAtom) that wraps all calculations and plotting functionalities.


Features

  • Compute energy levels of electrons in hydrogen-like atoms.
  • Calculate the radius of electron orbits for given quantum numbers.
  • Calculate photon properties (energy, wavelength, frequency) during electronic transitions.
  • Generate schematic or physically scaled plots of Bohr atoms.
  • Visualize electronic transitions with annotated energy differences.

Installation

You can install the library locally by cloning the repository and installing dependencies:

git clone <your-repo-url>
cd BohrSolver
pip install -e .

Dependencies:

  • Python >= 3.8
  • numpy
  • matplotlib

Usage

from bohr_solver import BohrAtom

# Create a Bohr atom instance for Hydrogen (Z=1)
atom = BohrAtom(Z=1)

# Calculate energy levels
energy_n1 = atom.calculate_energy_level(1)   # default in eV
energy_n2 = atom.calculate_energy_level(2, unit='J')

# Calculate orbit radius
r_n1 = atom.calculate_orbit_radius(1)
r_n2 = atom.calculate_orbit_radius(2)

# Calculate transition properties
transition = atom.calculate_transition(n_initial=2, n_final=1)
print(transition)
# Output: {'wavelength_nm': ..., 'frequency_Hz': ..., 'energy_eV': ..., 'type': 'Emission'}

# Plot Bohr atom with scaled orbits
atom.plot_bohr_atom(n=3, mode='scaled')

# Plot electronic transition
atom.plot_energy_transition(n_initial=2, n_final=1)

Classes & Methods

BohrAtom(Z: int = 1)

Main class representing a hydrogen-like atom.

Calculation Methods

  • calculate_energy_level(n: int, unit: str = 'eV') -> float
  • calculate_orbit_radius(n: int) -> float
  • calculate_transition(n_initial: int, n_final: int) -> dict

Visualization Methods

  • plot_bohr_atom(n: int, mode: str = 'scaled')
  • plot_energy_transition(n_initial: int, n_final: int)

Examples

1. Energy Levels

atom = BohrAtom(Z=2)  # Helium ion
for n in range(1, 4):
    print(f"n={n}: {atom.calculate_energy_level(n)} eV")

2. Orbit Radii

radii = [atom.calculate_orbit_radius(n) for n in range(1, 4)]
print(radii)

3. Electronic Transition

transition = atom.calculate_transition(3, 1)
print(f"Transition energy: {transition['energy_eV']} eV")

4. Visualization

atom.plot_bohr_atom(n=3, mode='schematic')
atom.plot_energy_transition(3, 1)

License

This project is licensed under the MIT License. See the LICENSE file for details.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

bohr_solver-0.1.0.tar.gz (8.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

bohr_solver-0.1.0-py3-none-any.whl (8.2 kB view details)

Uploaded Python 3

File details

Details for the file bohr_solver-0.1.0.tar.gz.

File metadata

  • Download URL: bohr_solver-0.1.0.tar.gz
  • Upload date:
  • Size: 8.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.3

File hashes

Hashes for bohr_solver-0.1.0.tar.gz
Algorithm Hash digest
SHA256 f16726cf5d2373935a3c540a7b5737f13b0f211a6ce04a23949b92edefbd2962
MD5 fc213efea5a0594d19c8deeb5599720c
BLAKE2b-256 01aa9572230d26a38e03c1516d67c7ad3549da7da39b32d191499afe1bcd1742

See more details on using hashes here.

File details

Details for the file bohr_solver-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: bohr_solver-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 8.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.3

File hashes

Hashes for bohr_solver-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 0b886de67d7bbbd2f9d3f50d5f2490d09f12adffb633dcba97da233698652a18
MD5 b610ef29be2209fb3f3c87471c1151f5
BLAKE2b-256 4df06c8dac06ca7ec146fea37dc017fcc1927fe0fb5492ce7f4e6c7e858e6b12

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page