function E = calculateEnergyComponents(~,psi,Params,Transf,VDk,V,VParams) % Parameters KEop = 0.5*(Transf.KX.^2+Transf.KY.^2); normfac = Params.Lx*Params.Ly/numel(psi); % DDIs frho = fftn(abs(psi).^2); Phi = (ifftn(frho.*VDk)); Eddi = 0.5*Params.gdd*Phi.*abs(psi).^2/(sqrt(2*pi)*VParams.ell);% E.Eddi = trapz(Eddi(:))*Transf.dx*Transf.dy; % Kinetic energy Ekin = KEop.*abs(fftn(psi)*normfac).^2; E.Ekin = trapz(Ekin(:))*Transf.dkx*Transf.dky/(2*pi)^2 + 0.25*(1/VParams.ell^2)*Params.N; % Potential energy Epot = V.*abs(psi).^2; E.Epot = trapz(Epot(:))*Transf.dx*Transf.dy + 0.25*Params.gz*VParams.ell^2*Params.N; % Contact interactions Eint = 0.5*Params.gs*abs(psi).^4/(sqrt(2*pi)*VParams.ell); E.Eint = trapz(Eint(:))*Transf.dx*Transf.dy; % Quantum fluctuations Eqf = 0.4*Params.gammaQF*abs(psi).^5*sqrt(2/(5*VParams.ell^3*pi^(3/2))); E.Eqf = trapz(Eqf(:))*Transf.dx*Transf.dy; end