Differences
This shows you the differences between two versions of the page.
Next revision | Previous revision | ||
documentation:tutorials:nio_crystal_field:density_matrix_plot [2016/10/08 21:26] – created Maurits W. Haverkort | documentation:tutorials:nio_crystal_field:density_matrix_plot [2019/06/28 00:27] (current) – Maurits W. Haverkort | ||
---|---|---|---|
Line 1: | Line 1: | ||
+ | {{indexmenu_n> | ||
+ | ====== Density matrix plot ====== | ||
+ | ### | ||
+ | An intuitive way to look at eigenstates is to plot the charge density. For multi-electron wave-functions one can not plot the wave-function (it depends on $3\times n$ coordinates) but the charge density is a well defined simple quantity. We here use the rendering options of \textit{Mathematica} in combination with the package for \textit{Mathematica} (Quanty.nb) to plot the density matrix of the lowest three eigenstates in NiO. | ||
+ | ### | ||
+ | |||
+ | ### | ||
+ | The input script is: | ||
+ | <code Quanty density_matrix_plots_Mathematica.Quanty> | ||
+ | -- It is often nice to make plots of the resulting " | ||
+ | -- simply plot a multi-electron wavefunction \psi(r_1, | ||
+ | -- on 3n coordinates. | ||
+ | -- One can plot the resulting charge density. | ||
+ | |||
+ | -- This example calculates the density matrix of a state and then calls Mathematica to | ||
+ | -- make a density plot of this matrix. | ||
+ | |||
+ | -- the script for mathematica is included in the input file | ||
+ | -- the input string needs calculated data which will be substituted before calling mathematica | ||
+ | |||
+ | Verbosity(0) | ||
+ | |||
+ | -- You need to change the absolute path in the script below | ||
+ | mathematicaInput = [[ | ||
+ | Needs[" | ||
+ | rho=%s; | ||
+ | pl = Table[ Rasterize[ DensityMatrixPlot[IdentityMatrix[10] - rho[ [i] ], PlotRange -> {{-0.4, 0.4}, {-0.4, 0.4}, {-0.4, 0.4}}] ], {i, 1, Length[rho]}]; | ||
+ | For[i = 1, i <= Length[pl], i++, | ||
+ | Export["/ | ||
+ | ]; | ||
+ | Quit[]; | ||
+ | ]] | ||
+ | |||
+ | NF=10 | ||
+ | NB=0 | ||
+ | dIndexDn={0, | ||
+ | dIndexUp={1, | ||
+ | |||
+ | OppSx | ||
+ | OppSy | ||
+ | OppSz | ||
+ | OppSsqr =NewOperator(" | ||
+ | OppSplus=NewOperator(" | ||
+ | OppSmin =NewOperator(" | ||
+ | |||
+ | OppLx | ||
+ | OppLy | ||
+ | OppLz | ||
+ | OppLsqr =NewOperator(" | ||
+ | OppLplus=NewOperator(" | ||
+ | OppLmin =NewOperator(" | ||
+ | |||
+ | OppJx | ||
+ | OppJy | ||
+ | OppJz | ||
+ | OppJsqr =NewOperator(" | ||
+ | OppJplus=NewOperator(" | ||
+ | OppJmin =NewOperator(" | ||
+ | |||
+ | Oppldots=NewOperator(" | ||
+ | |||
+ | -- define the coulomb operator | ||
+ | -- we here define the part depending on F0 seperately from the part depending on F2 | ||
+ | -- when summing we can put in the numerical values of the slater integrals | ||
+ | OppF0 =NewOperator(" | ||
+ | OppF2 =NewOperator(" | ||
+ | OppF4 =NewOperator(" | ||
+ | |||
+ | -- Akm = {{k1, | ||
+ | Akm = PotentialExpandedOnClm(" | ||
+ | OpptenDq = NewOperator(" | ||
+ | |||
+ | Akm = PotentialExpandedOnClm(" | ||
+ | OppNeg = NewOperator(" | ||
+ | Akm = PotentialExpandedOnClm(" | ||
+ | OppNt2g = NewOperator(" | ||
+ | |||
+ | Hamiltonian = 10.0 * OppF2 + 6.25 * OppF4 + 2.0 * OpptenDq + 0.06 * Oppldots + 0.000001 * (2*OppSz + OppLz) | ||
+ | |||
+ | -- we now can create the lowest Npsi eigenstates: | ||
+ | Npsi=3 | ||
+ | -- in order to make sure we have a filling of 2 electrons we need to define some restrictions | ||
+ | StartRestrictions = {NF, NB, {" | ||
+ | |||
+ | psiList = Eigensystem(Hamiltonian, | ||
+ | oppList={Hamiltonian, | ||
+ | |||
+ | print(" | ||
+ | for key,psi in pairs(psiList) do | ||
+ | expvalue = psi * oppList * psi | ||
+ | for k,v in pairs(expvalue) do | ||
+ | io.write(string.format(" | ||
+ | end; | ||
+ | io.write(" | ||
+ | end | ||
+ | io:flush() | ||
+ | |||
+ | function tableToMathematica(t) | ||
+ | local ret = "{ " | ||
+ | for k,v in pairs(t) do | ||
+ | if k~=1 then | ||
+ | ret = ret.." , " | ||
+ | end | ||
+ | if (type(v) == " | ||
+ | ret = ret..tableToMathematica(v) | ||
+ | else | ||
+ | ret = ret..string.format(" | ||
+ | end | ||
+ | end | ||
+ | ret = ret.." }" | ||
+ | return ret | ||
+ | end | ||
+ | |||
+ | rhoList = DensityMatrix(psiList, | ||
+ | rhoListMathematicaForm = tableToMathematica(rhoList) | ||
+ | |||
+ | file = io.open(" | ||
+ | file:write( mathematicaInput: | ||
+ | file: | ||
+ | |||
+ | os.execute("/ | ||
+ | os.execute(" | ||
+ | os.execute(" | ||
+ | os.execute(" | ||
+ | </ | ||
+ | ### | ||
+ | |||
+ | The produced figures are: | ||
+ | ^ $S_z=-1$ ^ $S_z=0$ ^ $S_z=1$ ^ | ||
+ | | {{ : | ||
+ | ^ Density matrix of the ground, first and second excited state of Ni in NiO. ^^^ | ||
+ | |||
+ | |||
+ | ### | ||
+ | The plots can be seen in the figure above. We show the hole density (identity matrix minus the density matrix) which has lobes towards the O atoms. Ni in NiO has a hole in the $x^2-y^2$ and in the $z^2$ orbital. The color represent the spin down, $S_z=0$ and spin up state of the lowest triplet. | ||
+ | ### | ||
+ | |||
+ | ### | ||
+ | The output to the screen is: | ||
+ | <file Quanty_Output density_matrix_plots_Mathematica.out> | ||
+ | < | ||
+ | -18.093 | ||
+ | -18.093 | ||
+ | -18.093 | ||
+ | Mathematica 8.0 for Mac OS X x86 (64-bit) | ||
+ | Copyright 1988-2011 Wolfram Research, Inc. | ||
+ | Loaded the Quanty : Plot Tools Package - version 2016.4.13 | ||
+ | Written by Maurits W. Haverkort | ||
+ | </ | ||
+ | ### | ||
+ | |||
+ | ===== Table of contents ===== | ||
+ | {{indexmenu> |