Modified live plotting.

This commit is contained in:
Karthik 2024-11-18 11:43:09 +01:00
parent 8b2732cad5
commit 0b726756ef
4 changed files with 11 additions and 11 deletions

View File

@ -1,4 +1,4 @@
function plotLive2D(psi, Params, Transf, Observ)
function plotLive2D(psi, Params, Transf, Observ, vrun)
set(0,'defaulttextInterpreter','latex')
set(groot, 'defaultAxesTickLabelInterpreter','latex'); set(groot, 'defaultLegendInterpreter','latex');
@ -14,9 +14,10 @@ function plotLive2D(psi, Params, Transf, Observ)
% Plotting
figure(1);
set(gcf, 'Name', ['Variational Run: ', num2str(vrun)])
set(gcf,'Position', [100, 100, 1600, 900])
clf
% Plot |psi(x,y)|^2 (density in x and y plane)
ax1 = subplot('Position', [0.05, 0.55, 0.28, 0.4]);
plotxy = pcolor(x,y,nxyScaled');
@ -46,7 +47,6 @@ function plotLive2D(psi, Params, Transf, Observ)
xlabel('$x$ [$\mu$m]', 'FontSize', 14); ylabel('$y$ [$\mu$m]', 'FontSize', 14);
title('Im$\{\Psi_{xy}\}$', 'FontSize', 14);
% Plot residual (time steps vs -log10(residual))
subplot('Position', [0.05, 0.05, 0.26, 0.4]);
plot(-log10(Observ.residual), '-b')

View File

@ -60,10 +60,10 @@ OptionsStruct.ScatteringLength = 98.0676; % Critical point: 102.515;
OptionsStruct.TrapFrequencies = [10, 10, 72.4];
OptionsStruct.TrapPotentialType = 'None';
OptionsStruct.NumberOfGridPoints = [256, 256];
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.TimeStepSize = 200E-6; % in s
OptionsStruct.TimeCutOff = 100; % in s
OptionsStruct.TimeStepSize = 500E-6; % in s
OptionsStruct.TimeCutOff = 1E4; % in s
OptionsStruct.EnergyTolerance = 5E-10;
OptionsStruct.ResidualTolerance = 1E-05;

View File

@ -1,4 +1,4 @@
function [psi, Observ] = propagateWavefunction(this, psi, Params, VParams, Transf, VDk, V, t_idx, Observ)
function [psi, Observ] = propagateWavefunction(this, psi, Params, VParams, Transf, VDk, V, t_idx, Observ, vrun)
set(0,'defaulttextInterpreter','latex')
set(groot, 'defaultAxesTickLabelInterpreter','latex'); set(groot, 'defaultLegendInterpreter','latex');
@ -23,7 +23,7 @@ function [psi, Observ] = propagateWavefunction(this, psi, Params, VParams, Trans
Observ.residual = [Observ.residual res];
if this.PlotLive
Plotter.plotLive2D(psi,Params,Transf,Observ)
Plotter.plotLive2D(psi,Params,Transf,Observ,vrun)
drawnow
end
@ -61,7 +61,7 @@ function [psi, Observ] = propagateWavefunction(this, psi, Params, VParams, Trans
muchem = this.Calculator.calculateChemicalPotential(psi,Params,VParams,Transf,VDk,V);
%Plotting loop
if mod(t_idx,500) == 0
if mod(t_idx,250) == 0
% Change in Energy
E = this.Calculator.calculateTotalEnergy(psi,Params,VParams,Transf,VDk,V);
@ -78,7 +78,7 @@ function [psi, Observ] = propagateWavefunction(this, psi, Params, VParams, Trans
% Plotting
if this.PlotLive
Plotter.plotLive2D(psi,Params,Transf,Observ)
Plotter.plotLive2D(psi,Params,Transf,Observ,vrun)
drawnow
end
%

View File

@ -48,7 +48,7 @@ function [Params, Transf, psi, V, VDk] = run(this)
psi = psi + 0.25*noise;
% --- Run ---
[psi, Observ] = this.propagateWavefunction(psi, Params, VParams, Transf, VDk, V, t_idx, Observ);
[psi, Observ] = this.propagateWavefunction(psi, Params, VParams, Transf, VDk, V, t_idx, Observ, nn);
psi = gather(psi);
% --- Constrained minimization ---