Visualization of the electron cloud of the hydrogen atom

Implementations

<< 
      RealTime3D`
(Subscript[R, n_, l_])[
        r_] := (2/((n^2) (2  l + 
                    1)!)) (Sqrt[(((n + l)!)/((n - l - 
                      1)!))]) Exp[-r/n] ((((2/n) r))^l) 
        Hypergeometric1F1[-n + l + 1, 
          2  l + 2, (2/n) 
            r]
(Subscript[Ψ, n_, l_, m_])[
        r_, θ_, φ_] := 
      (Subscript[R, n, l])[r] 
        SphericalHarmonicY[l, 
          m, θ, φ]
pro[{n_, l_, m_}, r_, θ_, φ_] := 
        N[Abs[(Subscript[Ψ, n, l, m])[r, θ, φ]]^2]

slicelevel[{n_Integer, l_Integer, m_Integer}, r_?Positive, 
          z_]:=
ContourPlot[-N[(Sqrt[(x^2) + (y^2) + (z^2)])(Sqrt[(x^2) + (y^2)])Abs[(Subscript[Ψ, n, l, m])[(Sqrt[(x^2) + (y^2) + (z^2)]), ArcCos[(z/(Sqrt[(x^2) + (y^2) + (z^2)]))], 
                          ArcCos[(x/(Sqrt[(x^2) + (y^2)]))]]]^2],{y, -r, r},{x, -r, r},PlotPoints -> 30,ContourLines -> False]

slicevertical[{n_Integer, l_Integer, m_Integer}, r_?Positive, 
          x_]:=
ContourPlot[-N[(Sqrt[(x^2) + (y^2) + (z^2)])(Sqrt[(x^2) + 
                        (y^2)])Abs[(Subscript[Ψ, n, l, m])[(Sqrt[(x^2) + (y^2) + (z^2)]), ArcCos[(z/(Sqrt[(x^2) + (y^2) + (z^2)]))], 
                          ArcCos[(x/(Sqrt[(x^2) + (y^2)]))]]]^2],{y, -r, r},{z, -r, r},PlotPoints -> 30,ContourLines -> False]

\(pointsgenerator[{n_, l_, m_}, range_, 
          sections_] := 
Module[
{δr = 
              N[range/sections], δθ = N[π/sections], tocar, 
            pts}, 
tocar[{r_, θ_, φ_}] := {r\ Sin[θ] Cos[φ], r\ Sin[θ] Sin[φ], 
              r\ Cos[θ]}; 
pts = 
            Flatten
[
	
              Table[
		Table[
			tocar[
					{Random[Real, {r, r + δr}], 
                      Random[Real, {θ, θ + δθ}], 
                      Random[Real, {0, 
                          2  π}]}
				], {8000\ δr\ δθ\ 2  π\ \(r\^2\) 
                      Sin[θ]\ pro[{n, l, m}, r, θ, 
                        0]}
			], {r, 0.0001, 
                  range, δr}, {θ, 
                  0, π, δθ}
		]
]; 
pts = 
            Partition[pts, 3]; 
pts = 
            Map[Point, 
              pts]; 
Print[\(Dimensions[
                pts]\)[\([1]\)], " Points generated."]; 
Return[pts];
]\)

eCloud[{n_Integer, 
          l_Integer, m_Integer}, range_, 
        sections_Integer:  30] := 
Show[
        Graphics3D[pointsgenerator[{n, l, m}, range, sections], 
          Boxed -> False]]

Tryouts

This shows the electron density along the r direction, giving us a reasonable max r.

Plot[Abs[(Subscript[R, 4, 1])[r]]^2, {r, 0, 40}];

slicelevel[{n, l, m}, maxr, z], a section on the x-y plane at z. Note maxr is obtained by the above plot.

Timing[slicelevel[{4, 1, 0}, 40, 0];]

slicevertical[{n, l, m}, rmax, x]

Timing[slicevertical[{4, 1, 0}, 40, 0];]

eCloud[{n, l, m}, rmax] visualizes the electron cloud. This may take some time. Algorithm is straightforward. See Implementation and alter it as you like.

Timing[eCloud[{4, 1, 0}, 40];]