All MicroEvals
You are an expert in computational quantum mechanics and sci...
Create MicroEval
Header image for You are an expert in computational quantum mechanics and sci...

You are an expert in computational quantum mechanics and sci...

Prompt

You are an expert in computational quantum mechanics and scientific Python. TASK Write a COMPLETE, runnable Python program that numerically solves the radial Dirac equation for a hydrogen-like atom in its standard 2-component radial form: dG/dr = -(kappa/r) G + (1/(hbar*c)) * (E + 2*m*c^2 - V(r)) * F dF/dr = (kappa/r) F - (1/(hbar*c)) * (E - V(r)) * G where G(r) and F(r) are the large and small radial components, V(r) = -Z*e^2/r (Coulomb potential), and kappa is the relativistic quantum number. PHYSICS REQUIREMENTS 1. Use atomic units internally (hbar = m = e = 1, c = 1/alpha, alpha = 1/137.035999084). State this explicitly in code comments. 2. Solve for at least these states: 1s1/2 (kappa=-1), 2s1/2 (kappa=-1), 2p1/2 (kappa=+1), 2p3/2 (kappa=-2), for Z given as a parameter (default Z=1, must also work for Z=80 to show relativistic effects). 3. Compute bound-state energies via shooting method with outward and inward integration and matching at the classical turning point (or an equivalent robust method — justify your choice in comments). 4. Use a logarithmic (or otherwise graded) radial grid; handle the r -> 0 behavior with the correct power-series start G, F ~ r^gamma, gamma = sqrt(kappa^2 - (Z*alpha)^2). 5. Normalize solutions: integral of (G^2 + F^2) dr = 1. 6. VALIDATION: compare each computed energy to the exact Sommerfeld (Dirac) formula and print a table with columns: state | kappa | E_numeric | E_exact | relative_error. Relative error must be printed in scientific notation. SOFTWARE REQUIREMENTS 7. Only numpy, scipy, matplotlib. No other dependencies. 8. Structure the code as these components in ONE file: - class RadialGrid - class CoulombPotential - class DiracShooting (integration + eigenvalue search) - function exact_dirac_energy(n, kappa, Z) - function run_validation() producing the table - function plot_states() plotting G(r), F(r) for computed states - main() with argparse for Z and grid parameters 9. ABSOLUTELY NO placeholders, no "..." , no "left as exercise", no pseudocode, no omitted functions. Every function fully implemented. 10. The program must run end-to-end with: python dirac.py --Z 1 11. Keep comments concise and mathematical; do not narrate. OUTPUT FORMAT - First: a short (max 10 lines) summary of your numerical strategy. - Then: the single complete code file in one code block. - Nothing after the code block.