31 lines
929 B
Matlab
31 lines
929 B
Matlab
function E = calculateEnergyComponents(~,psi,Params,Transf,VDk,V)
|
|
|
|
% Parameters
|
|
KEop = 0.5*(Transf.KX.^2+Transf.KY.^2+Transf.KZ.^2);
|
|
normfac = Params.Lx*Params.Ly*Params.Lz/numel(psi);
|
|
|
|
% DDIs
|
|
frho = fftn(abs(psi).^2);
|
|
Phi = real(ifftn(frho.*VDk));
|
|
|
|
Eddi = 0.5*Params.gdd*Phi.*abs(psi).^2;
|
|
E.Eddi = sum(Eddi(:))*Transf.dx*Transf.dy*Transf.dz;
|
|
|
|
% Kinetic energy
|
|
Ekin = KEop.*abs(fftn(psi)*normfac).^2;
|
|
E.Ekin = sum(Ekin(:))*Transf.dkx*Transf.dky*Transf.dkz/(2*pi)^3;
|
|
|
|
% Potential energy
|
|
Epot = V.*abs(psi).^2;
|
|
E.Epot = sum(Epot(:))*Transf.dx*Transf.dy*Transf.dz;
|
|
|
|
%Contact interactions
|
|
Eint = 0.5*Params.gs*abs(psi).^4;
|
|
E.Eint = sum(Eint(:))*Transf.dx*Transf.dy*Transf.dz;
|
|
|
|
%Quantum fluctuations
|
|
Eqf = 0.4*Params.gammaQF*abs(psi).^5;
|
|
E.Eqf = sum(Eqf(:))*Transf.dx*Transf.dy*Transf.dz;
|
|
|
|
end
|