2024-11-13 18:36:50 +01:00
|
|
|
function muchem = calculateChemicalPotential(~,psi,Params,VParams,Transf,VDk,V)
|
|
|
|
|
2024-11-15 14:33:46 +01:00
|
|
|
g_eff = Params.gs * (1/(sqrt(2*pi)*VParams.ell));
|
|
|
|
gamma_eff = Params.gammaQF * (sqrt(2/5)/(pi^(3/4)*VParams.ell^(3/2)));
|
2024-11-18 13:25:09 +01:00
|
|
|
Ez = (0.25/VParams.ell^2) + (0.25*Params.gz*VParams.ell^2);
|
2024-11-13 18:36:50 +01:00
|
|
|
|
|
|
|
% Parameters
|
|
|
|
normfac = Params.Lx*Params.Ly/numel(psi);
|
|
|
|
KEop = 0.5*(Transf.KX.^2+Transf.KY.^2);
|
|
|
|
|
|
|
|
% DDIs
|
|
|
|
frho = fftn(abs(psi).^2);
|
|
|
|
Phi = real(ifftn(frho.*VDk));
|
2024-11-15 14:33:46 +01:00
|
|
|
Eddi = (Params.gdd*Phi.*abs(psi).^2)/(sqrt(2*pi)*VParams.ell);
|
2024-11-13 18:36:50 +01:00
|
|
|
|
2024-11-22 00:04:27 +01:00
|
|
|
% Kinetic energy
|
2024-11-13 18:36:50 +01:00
|
|
|
Ekin = KEop.*abs(fftn(psi)*normfac).^2;
|
2024-11-30 08:26:12 +01:00
|
|
|
Ekin = sum(Ekin(:))*Transf.dkx*Transf.dky/(2*pi)^2;
|
2024-11-13 18:36:50 +01:00
|
|
|
|
2024-11-22 00:04:27 +01:00
|
|
|
% Potential energy
|
2024-11-13 18:36:50 +01:00
|
|
|
Epot = V.*abs(psi).^2;
|
|
|
|
|
2024-11-22 00:04:27 +01:00
|
|
|
% Contact interactions
|
2024-11-13 18:36:50 +01:00
|
|
|
Eint = g_eff*abs(psi).^4;
|
|
|
|
|
2024-11-22 00:04:27 +01:00
|
|
|
% Quantum fluctuations
|
2024-11-13 18:36:50 +01:00
|
|
|
Eqf = gamma_eff*abs(psi).^5;
|
|
|
|
|
2024-11-22 00:04:27 +01:00
|
|
|
% Total energy
|
2024-11-30 08:26:12 +01:00
|
|
|
muchem = Ekin + Ez*Params.N + sum(Epot(:) + Eint(:) + Eddi(:) + Eqf(:))*Transf.dx*Transf.dy;
|
|
|
|
muchem = muchem / Params.N; % Only use if psi is normalized to N
|
|
|
|
|
2024-11-13 18:36:50 +01:00
|
|
|
end
|