This is an old revision of the document!
Definition of density matrix
asked by David Tam (2024/08/06 03:21)
The Mathematica documentation states that the density matrix is constructed from
Subscript[B, \[Rho]]=Flatten[Table[{SphericalHarmonicY[l,m,\[Theta],\[Phi]],SphericalHarmonicY[l,m,\[Theta],\[Phi]]},{m,-l,l}]] r[\[Theta],\[Phi]]== Subscript[B, \[Rho]]\[Conjugate] \[CenterDot] M \[CenterDot] Subscript[B, \[Rho]]
I defined this basis using: basis3 = With[{l = 3},
Flatten[Table[{SphericalHarmonicY[l, m, \[Theta], \[Phi]], SphericalHarmonicY[l, m, \[Theta], \[Phi]]}, {m, -l, l}]]]
which is exactly as written on the help page for Hydrogen wavefunctions, and then I calculated B* as basis3conj = Simplify[
Conjugate[#], \[Theta] \[Element] Reals && \[Phi] \[Element] Reals] & /@ basis3
I then looked at the real part of the density matrix given for CeRu2Al10 in the help files, using at the real and imaginary parts of the charge density (with some tricks to simplify the expressions): Chop@Simplify@Chop@ComplexExpand@Re[basis3conj . dm1 . basis3] Chop@Simplify@Chop@ComplexExpand@Im[basis3conj . dm1 . basis3] which gives 0 for the imaginary part as I expected.
I then tried to plot the real part of the charge density using SphericalPlot3D[ Chop@Simplify@
Chop@ComplexExpand@Re[basis3conj . dm1 . basis3], {\[Theta], 0, \[Pi]}, {\[Phi], 0, 2 \[Pi]}, PlotRange -> All, Axes -> False,
Boxed -> False, PlotStyle -> Lighter@Gray]
The result looks similar to the shape given in the help, but not exactly. Moreover, repeating the exercise for the simple p-shell wavefunction in the “Quanty/tutorial/wavefunctions_and_density” page also reflects the orientation around the xy plane compared to the result you show. Some kind of phase problem is appearing in both these cases.
Is there a different definition of the spherical harmonics used inside the DensityMatrixPlot function? Could you otherwise shed some light on how to understand why this problem occurs?
Answers
Dear Tam,
You seem to be on the right track, but need to get the phases correct. Here it makes indeed sense to first look at plotting charge densities for electrons in the $p$-shell. Quanty works internally standardly with the spherical harmonics using the same phase as Mathematica. At this page |https://www.quanty.org/physics_chemistry/orbitals/z you can find the definitions of the real Tesseral harmonics. Try plotting the charge density of a $p_x$, $p_y$ and $p_x + p_y$ orbital. These should be in the correct direction. The last one rotated by 45 degree.
I will have a look on the internal functions and the latest version of Mathematica, might take a few days though
Maurits