Ground state wave function plot

asked by Stefano Agrestini (2024/07/11 22:49)

Hi Maurits

I have calculated the ground state (GS) of a 5d1 system with SOC and hybridization included. The ground state is the four fold degenerate J_eff = 3/2 state. I have been able to calculate the density matrix and I have plotted the orbitals, using your Mathematica package with the Quanty PlotTools.

However, I would like to plot the wave function of the GS. I guess I would need to sum up the orbitals. But I am not sure how to do it properly and plot it. Could you please help me? Thank you very much

Please, find below the final part of the lua file I used to calculate the density matrix

function TableToMathematica(t)
  Chop(t)
  local ret = "{ "
  for k,v in pairs(t) do
    if k~=1 then
      ret = ret.." , "
    end
    if (type(v) == "table") then
      ret = ret..TableToMathematica(v)
    else
      if( Complex.Re(v) < 0) then
        ret = ret..string.format("- %18.15f ",Abs(Complex.Re(v)))
      else
        ret = ret..string.format("+ %18.15f ",Abs(Complex.Re(v)))
      end
      if( Complex.Im(v) < 0) then
        ret = ret..string.format("- I %18.15f ",Abs(Complex.Im(v)))
      else
        ret = ret..string.format("+ I %18.15f ",Abs(Complex.Im(v)))
      end
    end
  end
  ret = ret.." }"
  return ret
end

Npsi=4
psiList = Eigensystem(Hamiltonian, StartRestrictions, Npsi, GRDOptions)

Density=DensityMatrix(psiList,{0,1,2,3,4,5,6,7,8,9})
RealDensity={}
for i = 1,Npsi,1 do
 RealDensity[i]=ToRealbse(Density[i])
end
SocDensity={}
for i = 1,Npsi,1 do
 SocDensity[i]=ToSOCbse(Density[i])
end


-- Plotting 

outputname = debug.getinfo(1,"S")
outputname = string.gsub(outputname.source,"@","")
outputname = string.gsub(outputname,".lua","")

  
	mathematicaInput = [[
	 Needs["Quanty`PlotTools`"];
	 rho=%s;
	 pl = Table[ Rasterize[ DensityMatrixPlot[ rho[ [i] ],QuantizationAxes->"x", PlotRange -> {{-1, 1}, {-1, 1}, {-1, 1}}] ], {i, 1, Length[rho]}];
	 For[i = 1, i <= Length[pl], i++,
	     Export[",." <> ToString[i] <> ".png", pl[ [i] ] ];
	    ];
	 Quit[];
	 ]]
	-- Plotting density plots:
	rhoList1 = Density
	rhoListMathematicaForm1 = TableToMathematica(rhoList1)
	file = io.open(outputname.."_.nb","w")
	file:write( mathematicaInput:format(rhoListMathematicaForm1 ) )
	file:close()
print('Finished the density matrix')