Skip to main content

Crate use_quantum

Crate use_quantum 

Source
Expand description

§use-quantum

Small quantum physics scalar helpers for RustUse.

§Install

[dependencies]
use-quantum = "0.0.1"

§Foundation

use-quantum provides small quantum physics scalar helpers for photon energy, matter waves, uncertainty estimates, simple Bohr-model relations, and quantum number validation.

Inputs are expected to be SI-style numeric values unless a function name explicitly says electron volts.

The crate keeps only a few local convenience constants. Broader physical constants belong in the top-level use-constants set. Unit abstractions belong in use-units. Wave abstractions belong in use-wave. Particle classification belongs in use-particle.

§Example

use use_quantum::{Photon, QuantumNumbers, RYDBERG_ENERGY_EV, hydrogen_energy_level_ev};

let photon = Photon::from_wavelength(500.0e-9).ok_or("expected valid wavelength")?;
let quantum_numbers = QuantumNumbers::new(2, 1, 0, 1).ok_or("expected valid quantum numbers")?;

assert!(photon.energy_joules() > 0.0);
assert_eq!(quantum_numbers.spin_projection(), 0.5);
assert_eq!(hydrogen_energy_level_ev(1), Some(-RYDBERG_ENERGY_EV));

§When to use directly

Choose use-quantum when you only need small reusable scalar quantum formulas or validation helpers.

§Scope

  • APIs stay f64-first and unit-agnostic.
  • This crate is not a quantum simulator, quantum computing library, Hilbert-space library, matrix mechanics library, optics system, wave system, unit system, or full atomic physics package.
  • General constants belong in use-constants.
  • Unit abstractions belong in use-units.
  • Wave abstractions belong in use-wave.
  • Particle classification belongs in use-particle.

§Status

use-quantum is a pre-1.0 crate with a deliberately small scalar API. Small quantum physics scalar helpers.

Modules§

prelude

Structs§

MatterWave
A lightweight matter-wave wrapper stored by momentum magnitude.
Photon
A lightweight photon wrapper stored by energy in joules.
QuantumNumbers
Quantum numbers for a single-electron atomic-state style validation helper.

Constants§

BOHR_RADIUS
Bohr radius a0, in meters.
ELECTRON_MASS
Electron rest mass, in kilograms.
ELEMENTARY_CHARGE
Elementary charge, in coulombs.
PLANCK_CONSTANT
Planck constant h, in joule seconds.
REDUCED_PLANCK_CONSTANT
Reduced Planck constant hbar, in joule seconds.
RYDBERG_ENERGY_EV
Hydrogen Rydberg energy magnitude, in electron volts.
SPEED_OF_LIGHT
Speed of light in vacuum, in meters per second.

Functions§

angular_frequency_from_energy
Computes angular frequency from energy using omega = E / hbar.
bohr_orbit_radius
Computes the hydrogen-like Bohr orbit radius for Z = 1 using r_n = a0 * n^2.
de_broglie_wavelength
Computes de Broglie wavelength from momentum magnitude using lambda = h / p.
de_broglie_wavelength_from_mass_velocity
Computes de Broglie wavelength from mass and velocity using lambda = h / (m * |v|).
electron_volts_to_joules
Converts electron volts to joules using J = eV * e.
energy_from_angular_frequency
Computes energy from angular frequency using E = hbar * omega.
frequency_from_photon_energy
Computes frequency from photon energy using f = E / h.
hydrogen_energy_level_ev
Computes the hydrogen energy level in electron volts using E_n = -Ry / n^2.
hydrogen_transition_energy_ev
Computes the absolute transition energy between two hydrogen energy levels in electron volts.
hydrogen_transition_wavelength
Computes the photon wavelength for a hydrogen transition in meters.
is_valid_azimuthal_quantum_number
Returns true when n >= 1 and l < n.
is_valid_magnetic_quantum_number
Returns true when -l <= m_l <= l.
is_valid_principal_quantum_number
Returns true when n >= 1.
is_valid_quantum_numbers
Returns true when the supplied quantum-number combination is valid.
is_valid_spin_twice
Returns true when the spin projection is one of -1 or 1.
joules_to_electron_volts
Converts joules to electron volts using eV = J / e.
minimum_energy_uncertainty
Computes the minimum energy uncertainty estimate from delta E >= hbar / (2 * delta t).
minimum_momentum_uncertainty
Computes the minimum momentum uncertainty estimate from delta p >= hbar / (2 * delta x).
minimum_position_uncertainty
Computes the minimum position uncertainty estimate from delta x >= hbar / (2 * delta p).
minimum_time_uncertainty
Computes the minimum time uncertainty estimate from delta t >= hbar / (2 * delta E).
momentum_from_de_broglie_wavelength
Computes momentum magnitude from a de Broglie wavelength using p = h / lambda.
photon_energy_from_frequency
Computes photon energy from frequency using E = h * f.
photon_energy_from_wavelength
Computes photon energy from wavelength using E = h * c / lambda.
photon_momentum_from_energy
Computes photon momentum from energy using p = E / c.
photon_momentum_from_wavelength
Computes photon momentum from wavelength using p = h / lambda.
wavelength_from_photon_energy
Computes wavelength from photon energy using lambda = h * c / E.