diff --git a/Dipolar-Gas-Simulator/+VariationalSolver2D/@Calculator/calculateVariationalEnergy.m b/Dipolar-Gas-Simulator/+VariationalSolver2D/@Calculator/calculateVariationalEnergy.m index cd16eec..81f984b 100644 --- a/Dipolar-Gas-Simulator/+VariationalSolver2D/@Calculator/calculateVariationalEnergy.m +++ b/Dipolar-Gas-Simulator/+VariationalSolver2D/@Calculator/calculateVariationalEnergy.m @@ -1,4 +1,4 @@ -function E = calculateVariationalEnergy(~, psi, Params, ell, Transf, V) +function E = calculateVariationalEnergy(this, psi, Params, ell, Transf, V) g_eff = Params.gs * (1/(sqrt(2*pi)*ell)); gamma_eff = Params.gammaQF * (sqrt(2/5)/(pi^(3/4)*ell^(3/2))); @@ -10,7 +10,7 @@ function E = calculateVariationalEnergy(~, psi, Params, ell, Transf, V) % DDIs VParams.ell = ell; - VDk = this.Calculator.calculateVDkWithCutoff(Transf, Params, VParams); % VDk depends on the variational parameters. THIS HAS TO BE RECALCULATED HERE FOR THE CONSTRAINED OPTIMIZATION TO WORK! + VDk = this.calculateVDkWithCutoff(Transf, Params, VParams); % VDk depends on the variational parameters. THIS HAS TO BE RECALCULATED HERE FOR THE CONSTRAINED OPTIMIZATION TO WORK! frho = fftn(abs(psi).^2); Phi = real(ifftn(frho.*VDk)); Eddi = 0.5*Params.gdd*Phi.*abs(psi).^2/(sqrt(2*pi)*ell);% diff --git a/Dipolar-Gas-Simulator/+VariationalSolver2D/@DipolarGas/run.m b/Dipolar-Gas-Simulator/+VariationalSolver2D/@DipolarGas/run.m index 987e2f1..2de0b36 100644 --- a/Dipolar-Gas-Simulator/+VariationalSolver2D/@DipolarGas/run.m +++ b/Dipolar-Gas-Simulator/+VariationalSolver2D/@DipolarGas/run.m @@ -26,7 +26,7 @@ function [Params, Transf, psi, V, VDk] = run(this) [psi,V,VDk] = this.initialize(Params,VParams,Transf); ells(1) = VParams.ell; - E_Var = @(x) this.Calculator.calculateVariationalEnergy(psi, Params, x, Transf, VDk, V)/Params.N; + E_Var = @(x) this.Calculator.calculateVariationalEnergy(psi, Params, x, Transf, V)/Params.N; E_vs_iter(1) = E_Var(ells(1)); for nn = 1:Params.SelfConIter @@ -50,7 +50,7 @@ function [Params, Transf, psi, V, VDk] = run(this) psi = gather(psi); % --- Constrained minimization --- - E_Var = @(x) this.Calculator.calculateVariationalEnergy(psi, Params, x, Transf, VDk, V)/Params.N; + E_Var = @(x) this.Calculator.calculateVariationalEnergy(psi, Params, x, Transf, V)/Params.N; VParams.ell = fmincon(E_Var,VParams.ell,[],[],[],[],Params.ell_lower,Params.ell_upper,[],fminconoptions); % --- Convergence check ---