Skip to main content

Python package to calculate energy levels, orbital radii, and electronic transitions for the Bohr model of hydrogen and hydrogen-like atoms, with educational visualizations.

Project description

Bohr Library

Description

Bohr Library is a compact educational Python package that implements the Bohr model for hydrogen and hydrogen-like atoms. It provides simple, well-documented tools to compute electron energy levels (eV), orbital radii (Å), and properties of electronic transitions (ΔE, photon frequency and wavelength). The package also includes utilities to generate visualizations (PNG) of energy levels and electron orbits for teaching and demonstration purposes.

Current state

Version: 0.1.0.

The repository contains readable, pedagogical scripts under src/: energy.py (energy-level calculator), radius.py (Bohr radii), transition.py (transition energies and photon properties), and plot_orbits.py (visualizer that saves PNG files). A simple main.py dispatches those scripts via an interactive menu. Several functions are already usable programmatically (for example RadiusCalculator.calculate(...) and ModeloBohrTransiciones.calcular_energia_nivel(...)).

Note: the radius module uses scipy.constants for physical constants. If you plan to install the package from PyPI or use it as a library, ensure scipy is available.

Objectives

Short-term: keep the code readable and educational, provide a stable programmatic API (non-interactive wrappers), and publish the package on PyPI so users can install it with a single command.

Usage (primary installation method: PyPI)

The recommended installation path is via PyPI. Install the package with pip and import the library from your Python scripts. This README provides a single, minimal example showing the PyPI installation method and one short usage snippet.

Install from PyPI:

pip install bohr-library

Single example after installing from PyPI (minimal, non-interactive):

# simple_example.py
# After installing via: pip install bohr-library
from src.transition import ModeloBohrTransiciones
from src.radius import RadiusCalculator


Z = 1 # Hydrogen
n = 1 # ground state


trans = ModeloBohrTransiciones()
energy_ev = trans.calcular_energia_nivel(Z, n)


radius_calc = RadiusCalculator()
radius_A = radius_calc.calculate(Z, n)


print(f"Hydrogen n={n} energy: {energy_ev:.4f} eV")
print(f"Hydrogen n={n} Bohr radius: {radius_A:.4f} Å")

Minimal API reference

RadiusCalculator.calculate(Z, n) — returns the Bohr radius for a hydrogen-like ion in Angstroms (Å).

ModeloBohrTransiciones.calcular_energia_nivel(Z, n) — returns the energy of level n in electronvolts (eV).

AtomVisualizer.plot_energy_levels(energies, transitions=None, filename=None) — saves an energy-level plot to filename if provided.

AtomVisualizer.plot_orbits(radii, filename=None) — saves an orbit plot to filename if provided.

Requirements and compatibility

  • Python: >= 3.8
  • Required packages: numpy, matplotlib, and scipy (for scipy.constants) — install these before or while installing the package:
pip install numpy matplotlib scipy

Known issues and recommendations

  • Many scripts use interactive input() calls. For automation and testing, call the non-interactive methods directly (e.g., calculate, calcular_energia_nivel) or add small wrapper functions that accept arguments instead of reading from STDIN.
  • Update pyproject.toml to include scipy in dependencies before publishing to PyPI.

Contributing & License

The project metadata indicates an MIT license. Contributions are welcome via cloning the repository, creating a branch, and opening a pull request. Suggested improvements: add unit tests, provide non-interactive API wrappers, tidy packaging so installed import paths are consistent, and add documentation pages or notebooks.


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_library-0.1.1.tar.gz (9.2 kB view details)

Uploaded Source

Built Distribution

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

bohr_library-0.1.1-py3-none-any.whl (11.5 kB view details)

Uploaded Python 3

File details

Details for the file bohr_library-0.1.1.tar.gz.

File metadata

  • Download URL: bohr_library-0.1.1.tar.gz
  • Upload date:
  • Size: 9.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.11

File hashes

Hashes for bohr_library-0.1.1.tar.gz
Algorithm Hash digest
SHA256 c2885cfdec0567ff4e830922f7f545bb82f93ad12659095d7c4df5a56ba043e2
MD5 ad37a6573b503f75cc6e3d514239c5db
BLAKE2b-256 beaed29fc3d660821d73002d3892df2d73bd7a1e323c8995c947a3946e323188

See more details on using hashes here.

File details

Details for the file bohr_library-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: bohr_library-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 11.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.11

File hashes

Hashes for bohr_library-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 3a64477c1b6f1364cc80abeac2c947d8129fa938705fc0c945cbd3124b1097f8
MD5 2f1616610582a3124f495357c5aa260e
BLAKE2b-256 326d68fe261603e6015cb9c10f405e74d1ac3671954387abb53ad7823e85da63

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