Modified progress bar settings to work for the variational solver.

This commit is contained in:
Karthik 2024-11-17 13:25:06 +01:00
parent df1beb268d
commit e3f9c7b352
4 changed files with 21 additions and 14 deletions

View File

@ -62,10 +62,10 @@ OptionsStruct.TrapPotentialType = 'None';
OptionsStruct.NumberOfGridPoints = [128, 128]; OptionsStruct.NumberOfGridPoints = [128, 128];
OptionsStruct.Dimensions = [7.5, 7.5]; % Critical point: 6.996; Triangular phase: 7.5; Stripe phase: 6.972; Honeycomb phase: 6.239 for both for Atom Number fixed to 1E5 OptionsStruct.Dimensions = [7.5, 7.5]; % Critical point: 6.996; Triangular phase: 7.5; Stripe phase: 6.972; Honeycomb phase: 6.239 for both for Atom Number fixed to 1E5
OptionsStruct.TimeStepSize = 500E-6; % in s OptionsStruct.TimeStepSize = 200E-6; % in s
OptionsStruct.TimeCutOff = 2E6; % in s OptionsStruct.TimeCutOff = 100; % in s
OptionsStruct.EnergyTolerance = 5E-10; OptionsStruct.EnergyTolerance = 5E-10;
OptionsStruct.ResidualTolerance = 1E-04; OptionsStruct.ResidualTolerance = 1E-05;
OptionsStruct.JobNumber = 1; OptionsStruct.JobNumber = 1;
OptionsStruct.RunOnGPU = false; OptionsStruct.RunOnGPU = false;

View File

@ -8,7 +8,7 @@ function [psi] = propagateWavefunction(this, psi, Params, VParams, Transf, VDk,
Observ.res = 1; Observ.res = 1;
AdaptIdx = 0; AdaptIdx = 0;
% Change in Energy % Change in Energy
E = this.Calculator.calculateTotalEnergy(psi,Params,VParams,Transf,VDk,V); E = this.Calculator.calculateTotalEnergy(psi,Params,VParams,Transf,VDk,V);
E = E/Params.N; E = E/Params.N;
@ -21,13 +21,17 @@ function [psi] = propagateWavefunction(this, psi, Params, VParams, Transf, VDk,
% Normalized residuals % Normalized residuals
res = this.Calculator.calculateNormalizedResiduals(psi,Params,VParams,Transf,VDk,V,muchem); res = this.Calculator.calculateNormalizedResiduals(psi,Params,VParams,Transf,VDk,V,muchem);
Observ.residual = [Observ.residual res]; Observ.residual = [Observ.residual res];
g_eff = Params.gs * (1/(sqrt(2*pi)*VParams.ell)); g_eff = Params.gs * (1/(sqrt(2*pi)*VParams.ell));
gamma_eff = Params.gammaQF * (sqrt(2/5)/(pi^(3/4)*VParams.ell^(3/2))); gamma_eff = Params.gammaQF * (sqrt(2/5)/(pi^(3/4)*VParams.ell^(3/2)));
Ez = (0.25*VParams.ell^2) + (0.25*Params.gz*VParams.ell^2); Ez = (0.25*VParams.ell^2) + (0.25*Params.gz*VParams.ell^2);
while t_idx < Params.sim_time_cut_off pb = Helper.ProgressBar();
fprintf('\n')
pb.run('Propagating wavefunction in imaginary time: ');
while t_idx < Params.sim_time_cut_off
% kin % kin
psi = fftn(psi); psi = fftn(psi);
psi = psi.*exp(-0.5*1i*dt*KEop); psi = psi.*exp(-0.5*1i*dt*KEop);
@ -89,6 +93,7 @@ function [psi] = propagateWavefunction(this, psi, Params, VParams, Transf, VDk,
break break
end end
t_idx=t_idx+1; t_idx=t_idx+1;
pb.run(100*t_idx/Params.sim_time_cut_off);
end end
% Change in Energy % Change in Energy
@ -103,4 +108,7 @@ function [psi] = propagateWavefunction(this, psi, Params, VParams, Transf, VDk,
% Chemical potential % Chemical potential
Observ.mucVec = [Observ.mucVec muchem]; Observ.mucVec = [Observ.mucVec muchem];
pb.run(' - Job Completed!');
clear pb.run
end end

View File

@ -30,11 +30,10 @@ function [Params, Transf, psi, V, VDk] = run(this)
E_Var = @(x) this.Calculator.calculateVariationalEnergy(psi, Params, x, Transf, VDk, V)/Params.N; E_Var = @(x) this.Calculator.calculateVariationalEnergy(psi, Params, x, Transf, VDk, V)/Params.N;
E_vs_iter(1) = E_Var(ells(1)); E_vs_iter(1) = E_Var(ells(1));
t_idx = 1; % Start at t = 0;
for nn = 1:Params.SelfConIter for nn = 1:Params.SelfConIter
Observ.EVec = []; Observ.NormVec = []; Observ.PCVec = []; Observ.tVecPlot = []; Observ.mucVec = []; Observ.residual = []; Observ.EVec = []; Observ.NormVec = []; Observ.PCVec = []; Observ.tVecPlot = []; Observ.mucVec = []; Observ.residual = []; Observ.res_idx = 1;
Observ.res_idx = 1;
t_idx = 1; % Start at t = 0;
[~,V,VDk] = this.initialize(Params,VParams,Transf); % Do not overwrite psi, susbequent iterations should use psi generated at the end of the loop to converge faster [~,V,VDk] = this.initialize(Params,VParams,Transf); % Do not overwrite psi, susbequent iterations should use psi generated at the end of the loop to converge faster
% This is still needed however to recalculate VDk with new value % This is still needed however to recalculate VDk with new value
@ -63,12 +62,12 @@ function [Params, Transf, psi, V, VDk] = run(this)
E_vs_iter = [E_vs_iter E_Var(VParams.ell)]; E_vs_iter = [E_vs_iter E_Var(VParams.ell)];
save(sprintf('./Data/Run_%03i/psi_gs_%i.mat',Params.njob),'psi','Observ','Transf','Params','VDk','V','VParams'); save(sprintf('./Data/Run_%03i/psi_gs_%i.mat',Params.njob),'psi','Observ','Transf','Params','VDk','V','VParams');
if relelldiff < Params.ellcutoff if relelldiff < Params.ellcutoff
break break
end end
end end
fprintf('\n')
disp('Saving data...'); disp('Saving data...');
save(sprintf('./Data/Run_%03i/psi_gs.mat',Params.njob),'psi','Observ','Transf','Params','VDk','V','VParams'); save(sprintf('./Data/Run_%03i/psi_gs.mat',Params.njob),'psi','Observ','Transf','Params','VDk','V','VParams');
disp('Save complete!'); disp('Save complete!');

View File

@ -5,8 +5,8 @@
# Request number of nodes and GPU for job # Request number of nodes and GPU for job
#SBATCH --nodes=1 #SBATCH --nodes=1
#SBATCH --ntasks-per-node=1 #SBATCH --ntasks-per-node=1
#SBATCH --gres=gpu:1 #SBATCH --gres=gpu:4
#SBATCH --mem=4G #SBATCH --mem=8G
# Estimated wallclock time for job # Estimated wallclock time for job
#SBATCH --time=04:00:00 #SBATCH --time=04:00:00
#SBATCH --job-name=simulation #SBATCH --job-name=simulation