Calculations/Dipolar-Gas-Simulator/+BdGSolver2D/BdGMatrix.m

35 lines
1.2 KiB
Matlab

function BdGVec = BdGMatrix(gVec, psi, Params, VDk, VParams, Transf, muchem)
gs = Params.gs;
gdd = Params.gdd;
gammaQF = Params.gammaQF;
KEop = 0.5*(Transf.KX.^2+Transf.KY.^2);
g_pf_2D = 1/(sqrt(2*pi)*VParams.ell);
gQF_pf_2D = sqrt(2/5)/(pi^(3/4)*VParams.ell^(3/2));
Ez = (0.25/VParams.ell^2) + (0.25*Params.gz*VParams.ell^2);
muchem_tilde = muchem - Ez;
% eigs only works with column vectors
psi = psi.';
KEop = KEop.';
VDk = VDk.';
% Interaction Potential
frho = fftn(abs(psi).^2);
Phi = real(ifftn(frho.*VDk));
% Operators
H = @(w) real(ifft(KEop.*fft(w)));
C = @(w) (((g_pf_2D*gs*abs(psi).^2) + (g_pf_2D*gdd*Phi)).*w) + (gQF_pf_2D*gammaQF*abs(psi).^3.*w);
muHC = @(w) (-muchem_tilde * w) + H(w) + C(w);
X = @(w) (psi.*real(ifft(VDk.*fft(psi.*w)))) + (3/2)*(gQF_pf_2D*gammaQF*abs(psi).^3).*w;
g = reshape(gVec, size(psi));
% Operate in order on g
BdG = muHC(muHC(g) + (2.*X(g)));
BdGVec = reshape(BdG, [], 1);
end