# Recreate DensityMatrixPlot

asked by David Tam (2022/03/27 19:10)

In Mathematica, I define the basis according to the documentation for DensityMatrixPlot:

lbasisF =   With[{l = 3},    Flatten[Table[{SphericalHarmonicY[l, m, \[Theta], \[Phi]],       SphericalHarmonicY[l, m, \[Theta], \[Phi]]}, {m, -l, l}]]];

Now I can construct a density matrix with some randomly chosen numbers, and make a plot:

dmF = CFDensityMatrix[3, 1,   With[{vv = {0.7, 0, 0.3, 0, 0, 0.3, 0, 0, 0.1, 0.5, 0.1, 0, 0.2, 0}}, vv/Sqrt@Total[vv^2]]]

DensityMatrixPlot[dmF]

However, the following superposition shows that directly plotting in the orbital basis doesn't make the same plot:

Show[  dmplot,  SphericalPlot3D[ Conjugate[lbasisF].dmF.lbasisF, {\[Theta], 0, Pi}, {\[Phi], 0,(*2 Pi*)Pi}   , PlotRange → All, AspectRatio → Automatic, AxesLabel → {“x”, “y”, “z”}]  ]

What is the right way to find the angular function as function of theta and phi, and how does DensityMatrixPlot avoid this problem?

, 2022/04/09 21:14

Hello David,

Which version of Mathematica are you using?

, 2022/04/10 09:12

Dear David

There is a difference between the wave function $\sqrt{1/2} (p_x + p_y)$ and the charge density of the $p_x$ and $p_y$ orbital. I here used $p$ orbitals as they are simpler than the $f$ orbitals. Have a look at the tutorial at Quanty/tutorial/wavefunctions_and_density to see the difference.

You find this tutorial in the Mathematica Help files. Go to Help → Documentation → Add ons and packages (bottom) → Quanty → Documentation → Tutorials: Wave functions and density

This might solve your question Maurits

Workshops

Script versions External programs Privacy

##### Tools 