4
$\begingroup$

I was asked by a high school chemistry teacher to visualize electron orbitals of hydrogen atom for various quantum numbers. This is trivial and one can find a worked out example in the DensityPlot3D function documentation, as well as here.

The next step was: create an animation that simulates "diving" into the $|\psi|^2$ clouds. I tried ViewPoint->d{a,b,c} with suitably chosen a, b, c, and animated/manipulated d, and with some carefully selected coloring and opacity. However, the result was far from satisfactory. I am aware of other methods such as restricting the plotted volume with PlotRange, shrinking the whole plotted volume, and the stuff in the link mentioned above. But she insists on diving into the orbital, first approaching and later being surrounded by the color-coded orbital cloud.

$\endgroup$
3
  • 1
    $\begingroup$ (1) I highly recommend this post simulated 3D camera (2) Learn new video tools (3) I think you will also enjoy these perfectly made educational orbitals. $\endgroup$ Commented Apr 24 at 22:55
  • 1
    $\begingroup$ @VitaliyKaurov - thank you very much for your highly inspirational comment and answer! $\endgroup$ Commented Apr 25 at 6:47
  • 1
    $\begingroup$ @ hlediks - my pleasure. For a bit more detailed walkthrough on simulated camera there is also this guide: Glam-ifying 3D graphics: simple video animations and techniques $\endgroup$ Commented Apr 25 at 19:31

1 Answer 1

8
$\begingroup$

This is a toy example -- you can use any 3D plotting functions to do these camera tricks. GIFs here must be less than 2MB, so this is bad quality that is also sped up -- relative to high quality video you get with the code below. SEE VIDEO HERE

enter image description here

Plot hydrogen orbital densities for quantum numbers n, m, l. You could use:

Quantity["BohrRadius"]/Quantity["Meters"]

5.29177211*10^-11

But I recommend working in rescaled coordinates

a0 = 1;

ψ[{n_,l_,m_},{r_,θ_,ϕ_}]:=With[{ρ=2r/(n a0)},
Sqrt[(2/(n a0))^3 (n-l-1)!/(2n (n+l)!)]Exp[-ρ/2]ρ^l LaguerreL[n-l-1,2l+1,��]SphericalHarmonicY[l,m,θ,ϕ]]

ψ[{n, l, m}, {r, θ, ϕ}] // TeXForm

$$2^{l+1} e^{-\frac{r}{n}} \sqrt{\frac{(-l+n-1)!}{n^4 (l+n)!}} \left(\frac{r}{n}\right)^l L_{-l+n-1}^{2 l+1}\left(\frac{2 r}{n}\right) Y_l^m(\theta ,\phi )$$

Plot $ψ_{2,1,0}(x,y,z)$:

orb=DensityPlot3D[(Abs@ψ[{2,1,0},{Sqrt[x^2+y^2+z^2],ArcTan[z,Sqrt[x^2+y^2]],ArcTan[x,y]}])^2,
{x,-5 a0,5 a0},{y,-5 a0,5 a0},{z,-5 a0,5 a0},Axes->False]

enter image description here

Decide trajectory for where from and where to camera is looking:

f[t_]:=5{2Sin[t],0,2Sin[2t]}
g[t_]:=5{Sin[t],Sin[2t],0}
Show[orb,ParametricPlot3D[{f[t],g[t]},{t,0,2Pi}],
PlotRange->All,BoxRatios->Automatic]

enter image description here

Get the basics of the Wolfram 3D simulated camera:

enter image description here

Define a function that returns an association that fully specifies the scene:

fullPosition[t_]:=<|
"CameraPosition"->f[t],
"SubjectPosition"->g[t],
"ViewAngle"->100Degree|>

Parallelize over CPU cores and create a Tour3DVideo / camera flight video:

Parallelize@Tour3DVideo[orb,fullPosition[2Pi #/20+Pi/2]&,DefaultDuration->20]
$\endgroup$
2
  • $\begingroup$ You mean 2 MB 😅 $\endgroup$ Commented Apr 25 at 6:02
  • $\begingroup$ @ВалерийЗаподовников - thanks, corrected. $\endgroup$ Commented Apr 25 at 6:37

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.