Major modifications to plotting routines and execution scripts.
This commit is contained in:
parent
a097c9adb0
commit
dbb4e24b94
@ -14,54 +14,62 @@ function plotLive2D(psi, Params, Transf, Observ, vrun)
|
||||
|
||||
% Plotting
|
||||
figure(1);
|
||||
clf
|
||||
set(gcf, 'Name', ['Variational Run: ', num2str(vrun)])
|
||||
set(gcf,'Position', [100, 100, 1600, 900])
|
||||
clf
|
||||
t = tiledlayout(2, 3, 'TileSpacing', 'compact', 'Padding', 'compact'); % 2x3 grid
|
||||
|
||||
% Plot |psi(x,y)|^2 (density in x and y plane)
|
||||
ax1 = subplot('Position', [0.05, 0.55, 0.28, 0.4]);
|
||||
nexttile; % Equivalent to subplot('Position', [0.05, 0.55, 0.28, 0.4]);
|
||||
plotxy = pcolor(x,y,nxyScaled');
|
||||
set(plotxy, 'EdgeColor', 'none');
|
||||
% shading interp; % Smooth shading
|
||||
clim(ax1,[0.00,0.3]);
|
||||
cbar1 = colorbar;
|
||||
cbar1.Label.Interpreter = 'latex';
|
||||
colormap('turbo')
|
||||
% clim(ax1,[0.00,0.3]);
|
||||
ylabel(cbar1,'$na_{dd}^2$','FontSize',16,'Rotation',270)
|
||||
xlabel('$x$ ($\mu$m)', 'Interpreter', 'latex', 'FontSize', 14)
|
||||
ylabel('$y$ ($\mu$m)', 'Interpreter', 'latex', 'FontSize', 14)
|
||||
title('$|\Psi(x,y)|^2$', 'Interpreter', 'latex', 'FontSize', 14)
|
||||
|
||||
% Plot real part of psi in the x-y plane
|
||||
subplot('Position', [0.36, 0.55, 0.28, 0.4])
|
||||
pcolor(x, y, real(psi)');
|
||||
shading interp;
|
||||
colorbar;
|
||||
xlabel('$x$ [$\mu$m]', 'FontSize', 14); ylabel('$y$ [$\mu$m]', 'FontSize', 14);
|
||||
title('Re$\{\Psi_{xy}\}$', 'FontSize', 14);
|
||||
|
||||
% Plot imaginary part of psi in the x-y plane
|
||||
subplot('Position', [0.67, 0.55, 0.28, 0.4])
|
||||
pcolor(x, y, imag(psi)');
|
||||
shading interp;
|
||||
colorbar;
|
||||
xlabel('$x$ [$\mu$m]', 'FontSize', 14); ylabel('$y$ [$\mu$m]', 'FontSize', 14);
|
||||
title('Im$\{\Psi_{xy}\}$', 'FontSize', 14);
|
||||
% Plot phase psi
|
||||
nexttile; % Equivalent to subplot('Position', [0.36, 0.55, 0.28, 0.4]);
|
||||
plotxy = pcolor(x, y, angle(psi)');
|
||||
set(plotxy, 'EdgeColor', 'none');
|
||||
cbar2 = colorbar;
|
||||
cbar2.Label.Interpreter = 'latex';
|
||||
colormap('hsv')
|
||||
clim([-pi,pi])
|
||||
ylabel(cbar2,'$\phi$','FontSize',16,'Rotation',270)
|
||||
xlabel('$x$ ($\mu$m)', 'Interpreter', 'latex', 'FontSize', 14)
|
||||
ylabel('$y$ ($\mu$m)', 'Interpreter', 'latex', 'FontSize', 14)
|
||||
title('Phase', 'FontSize', 14);
|
||||
|
||||
% Plot residual (time steps vs -log10(residual))
|
||||
subplot('Position', [0.05, 0.05, 0.26, 0.4]);
|
||||
nexttile; % Equivalent to subplot('Position', [0.67, 0.55, 0.28, 0.4])
|
||||
plot(-log10(Observ.residual), '-b')
|
||||
ylabel('$-\mathrm{log}_{10}(r)$', 'FontSize', 14); xlabel('Time steps', 'FontSize', 14);
|
||||
title('Residual', 'FontSize', 14);
|
||||
|
||||
grid on
|
||||
|
||||
% Plot total energy over time
|
||||
subplot('Position', [0.36, 0.05, 0.26, 0.4]);
|
||||
nexttile; % Equivalent to subplot('Position', [0.05, 0.05, 0.26, 0.4]);
|
||||
plot(Observ.EVec, '-b')
|
||||
ylabel('$E_{tot}$', 'FontSize', 14); xlabel('Time steps', 'FontSize', 14);
|
||||
title('Total Energy', 'FontSize', 14);
|
||||
|
||||
grid on
|
||||
|
||||
% Plot chemical potential over time
|
||||
subplot('Position', [0.67, 0.05, 0.26, 0.4]);
|
||||
nexttile; % Equivalent to subplot('Position', [0.36, 0.05, 0.26, 0.4]);
|
||||
plot(Observ.mucVec, '-b')
|
||||
ylabel('$\mu$', 'FontSize', 14); xlabel('Time steps', 'FontSize', 14);
|
||||
title('Chemical Potential', 'FontSize', 14);
|
||||
grid on
|
||||
|
||||
% Plot variational width
|
||||
nexttile; % Equivalent to subplot('Position', [0.67, 0.05, 0.26, 0.4]);
|
||||
xlabel('$\ell$', 'FontSize', 14)
|
||||
ylabel('$E_{var}$', 'FontSize', 14)
|
||||
title('Variational Energy', 'FontSize', 14);
|
||||
grid on
|
||||
end
|
@ -4,11 +4,13 @@ function visualizeGSWavefunction2D(folder_path, run_index)
|
||||
set(groot, 'defaultAxesTickLabelInterpreter','latex'); set(groot, 'defaultLegendInterpreter','latex');
|
||||
|
||||
% Load data
|
||||
Data = load(sprintf(horzcat(folder_path, '/Run_%03i/psi_gs.mat'),run_index),'psi','Params','Transf','Observ');
|
||||
Data = load(sprintf(horzcat(folder_path, '/Run_%03i/psi_gs.mat'),run_index),'psi','Transf','Observ','Params','VParams');
|
||||
|
||||
Params = Data.Params;
|
||||
Transf = Data.Transf;
|
||||
Observ = Data.Observ;
|
||||
Transf = Data.Transf;
|
||||
Observ = Data.Observ;
|
||||
Params = Data.Params;
|
||||
VParams = Data.VParams;
|
||||
|
||||
if isgpuarray(Data.psi)
|
||||
psi = gather(Data.psi);
|
||||
else
|
||||
@ -31,55 +33,64 @@ function visualizeGSWavefunction2D(folder_path, run_index)
|
||||
% Plotting
|
||||
figure('Position', [100, 100, 1600, 900]);
|
||||
clf
|
||||
t = tiledlayout(2, 3, 'TileSpacing', 'compact', 'Padding', 'compact'); % 2x3 grid
|
||||
|
||||
% Compute probability density |psi|^2
|
||||
nxy = abs(psi).^2;
|
||||
nxyScaled = nxy*(Params.add*10^6)^2;
|
||||
|
||||
% Plot |psi(x,y)|^2 (density in x and y plane)
|
||||
ax1 = subplot('Position', [0.05, 0.55, 0.28, 0.4]);
|
||||
nexttile; % Equivalent to subplot('Position', [0.05, 0.55, 0.28, 0.4]);
|
||||
plotxy = pcolor(x,y,nxyScaled');
|
||||
set(plotxy, 'EdgeColor', 'none');
|
||||
% shading interp; % Smooth shading
|
||||
clim(ax1,[0.00,0.3]);
|
||||
cbar1 = colorbar;
|
||||
cbar1.Label.Interpreter = 'latex';
|
||||
colormap('turbo')
|
||||
% clim(ax1,[0.00,0.3]);
|
||||
ylabel(cbar1,'$na_{dd}^2$','FontSize',16,'Rotation',270)
|
||||
xlabel('$x$ ($\mu$m)', 'Interpreter', 'latex', 'FontSize', 14)
|
||||
ylabel('$y$ ($\mu$m)', 'Interpreter', 'latex', 'FontSize', 14)
|
||||
title('$|\Psi(x,y)|^2$', 'Interpreter', 'latex', 'FontSize', 14)
|
||||
|
||||
% Plot real part of psi in the x-y plane
|
||||
subplot('Position', [0.36, 0.55, 0.28, 0.4])
|
||||
pcolor(x, y, real(psi)');
|
||||
shading interp;
|
||||
colorbar;
|
||||
xlabel('$x$ [$\mu$m]', 'FontSize', 14); ylabel('$y$ [$\mu$m]', 'FontSize', 14);
|
||||
title('Re$\{\Psi_{xy}\}$', 'FontSize', 14);
|
||||
|
||||
% Plot imaginary part of psi in the x-y plane
|
||||
subplot('Position', [0.67, 0.55, 0.28, 0.4])
|
||||
pcolor(x, y, imag(psi)');
|
||||
shading interp;
|
||||
colorbar;
|
||||
xlabel('$x$ [$\mu$m]', 'FontSize', 14); ylabel('$y$ [$\mu$m]', 'FontSize', 14);
|
||||
title('Im$\{\Psi_{xy}\}$', 'FontSize', 14);
|
||||
% Plot phase psi
|
||||
nexttile; % Equivalent to subplot('Position', [0.36, 0.55, 0.28, 0.4]);
|
||||
plotxy = pcolor(x, y, angle(psi)');
|
||||
set(plotxy, 'EdgeColor', 'none');
|
||||
cbar2 = colorbar;
|
||||
cbar2.Label.Interpreter = 'latex';
|
||||
colormap('hsv')
|
||||
clim([-pi,pi])
|
||||
ylabel(cbar2,'$\phi$','FontSize',16,'Rotation',270)
|
||||
xlabel('$x$ ($\mu$m)', 'Interpreter', 'latex', 'FontSize', 14)
|
||||
ylabel('$y$ ($\mu$m)', 'Interpreter', 'latex', 'FontSize', 14)
|
||||
title('Phase', 'FontSize', 14);
|
||||
|
||||
% Plot residual (time steps vs -log10(residual))
|
||||
subplot('Position', [0.05, 0.05, 0.26, 0.4]);
|
||||
nexttile; % Equivalent to subplot('Position', [0.67, 0.55, 0.28, 0.4])
|
||||
plot(-log10(Observ.residual), '-b')
|
||||
ylabel('$-\mathrm{log}_{10}(r)$', 'FontSize', 14); xlabel('Time steps', 'FontSize', 14);
|
||||
title('Residual', 'FontSize', 14);
|
||||
grid on
|
||||
|
||||
% Plot total energy over time
|
||||
subplot('Position', [0.36, 0.05, 0.26, 0.4]);
|
||||
nexttile; % Equivalent to subplot('Position', [0.05, 0.05, 0.26, 0.4]);
|
||||
plot(Observ.EVec, '-b')
|
||||
ylabel('$E$', 'FontSize', 14); xlabel('Time steps', 'FontSize', 14);
|
||||
title('Total Energy', 'FontSize', 14);
|
||||
grid on
|
||||
|
||||
% Plot chemical potential over time
|
||||
subplot('Position', [0.67, 0.05, 0.26, 0.4]);
|
||||
nexttile; % Equivalent to subplot('Position', [0.36, 0.05, 0.26, 0.4]);
|
||||
plot(Observ.mucVec, '-b')
|
||||
ylabel('$\mu$', 'FontSize', 14); xlabel('Time steps', 'FontSize', 14);
|
||||
title('Chemical Potential', 'FontSize', 14);
|
||||
grid on
|
||||
|
||||
% Plot variational width
|
||||
nexttile; % Equivalent to subplot('Position', [0.67, 0.05, 0.26, 0.4]);
|
||||
plot(VParams.ells,VParams.E_vs_iter,'LineStyle','none','Marker','o','MarkerSize',3,'Color','b','MarkerFaceColor','b')
|
||||
xlabel('$\ell$', 'FontSize', 14)
|
||||
ylabel('$E_{var}$', 'FontSize', 14)
|
||||
title('Variational Energy', 'FontSize', 14);
|
||||
grid on
|
||||
end
|
||||
|
@ -1,86 +1,3 @@
|
||||
function analyzeRun2D(folder_path, run_index)
|
||||
set(0,'defaulttextInterpreter','latex')
|
||||
set(groot, 'defaultAxesTickLabelInterpreter','latex'); set(groot, 'defaultLegendInterpreter','latex');
|
||||
|
||||
% Load data
|
||||
Data = load(sprintf(horzcat(folder_path, '/Run_%03i/psi_gs.mat'),run_index),'psi','Transf','Observ','Params','VParams');
|
||||
|
||||
Transf = Data.Transf;
|
||||
Observ = Data.Observ;
|
||||
Params = Data.Params;
|
||||
VParams = Data.VParams;
|
||||
|
||||
if isgpuarray(Data.psi)
|
||||
psi = gather(Data.psi);
|
||||
else
|
||||
psi = Data.psi;
|
||||
end
|
||||
|
||||
if isgpuarray(Data.Observ.residual)
|
||||
Observ.residual = gather(Data.Observ.residual);
|
||||
else
|
||||
Observ.residual = Data.Observ.residual;
|
||||
end
|
||||
|
||||
% Set long format for output
|
||||
format long
|
||||
|
||||
% Coordinates in micrometers
|
||||
x = Transf.x * Params.l0 * 1e6;
|
||||
y = Transf.y * Params.l0 * 1e6;
|
||||
|
||||
% Plotting
|
||||
figure('Position', [100, 100, 1600, 900]);
|
||||
clf
|
||||
|
||||
% Compute probability density |psi|^2
|
||||
nxy = abs(psi).^2;
|
||||
nxyScaled = nxy*(Params.add*10^6)^2;
|
||||
|
||||
% 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');
|
||||
set(plotxy, 'EdgeColor', 'none');
|
||||
% shading interp; % Smooth shading
|
||||
clim(ax1,[0.00,0.3]);
|
||||
cbar1 = colorbar;
|
||||
cbar1.Label.Interpreter = 'latex';
|
||||
ylabel(cbar1,'$na_{dd}^2$','FontSize',16,'Rotation',270)
|
||||
xlabel('$x$ ($\mu$m)', 'Interpreter', 'latex', 'FontSize', 14)
|
||||
ylabel('$y$ ($\mu$m)', 'Interpreter', 'latex', 'FontSize', 14)
|
||||
title('$|\Psi(x,y)|^2$', 'Interpreter', 'latex', 'FontSize', 14)
|
||||
|
||||
% Plot real part of psi in the x-y plane
|
||||
subplot('Position', [0.36, 0.55, 0.28, 0.4])
|
||||
pcolor(x, y, real(psi)');
|
||||
shading interp;
|
||||
colorbar;
|
||||
xlabel('$x$ [$\mu$m]', 'FontSize', 14); ylabel('$y$ [$\mu$m]', 'FontSize', 14);
|
||||
title('Re$\{\Psi_{xy}\}$', 'FontSize', 14);
|
||||
|
||||
% Plot imaginary part of psi in the x-y plane
|
||||
subplot('Position', [0.67, 0.55, 0.28, 0.4])
|
||||
plot(-log10(Observ.residual), '-b')
|
||||
ylabel('$-\mathrm{log}_{10}(r)$', 'FontSize', 14); xlabel('Time steps', 'FontSize', 14);
|
||||
title('Residual', 'FontSize', 14);
|
||||
|
||||
% Plot residual (time steps vs -log10(residual))
|
||||
subplot('Position', [0.05, 0.05, 0.26, 0.4]);
|
||||
plot(Observ.EVec, '-b')
|
||||
ylabel('$E$', 'FontSize', 14); xlabel('Time steps', 'FontSize', 14);
|
||||
title('Total Energy', 'FontSize', 14);
|
||||
|
||||
% Plot total energy over time
|
||||
subplot('Position', [0.36, 0.05, 0.26, 0.4]);
|
||||
plot(Observ.mucVec, '-b')
|
||||
ylabel('$\mu$', 'FontSize', 14); xlabel('Time steps', 'FontSize', 14);
|
||||
title('Chemical Potential', 'FontSize', 14);
|
||||
|
||||
% Plot chemical potential over time
|
||||
subplot('Position', [0.67, 0.05, 0.26, 0.4]);
|
||||
plot(VParams.ells,VParams.E_vs_iter,'LineStyle','none','Marker','o','MarkerSize',3,'Color','b','MarkerFaceColor','b')
|
||||
xlabel('$\ell$', 'FontSize', 14)
|
||||
ylabel('$E_{var}$', 'FontSize', 14)
|
||||
title('Variational Energy', 'FontSize', 14);
|
||||
|
||||
end
|
@ -20,7 +20,7 @@ OptionsStruct.NumberOfGridPoints = [256, 512, 256];
|
||||
OptionsStruct.Dimensions = [50, 120, 150];
|
||||
OptionsStruct.CutoffType = 'Cylindrical';
|
||||
OptionsStruct.SimulationMode = 'ImaginaryTimeEvolution'; % 'ImaginaryTimeEvolution' | 'RealTimeEvolution'
|
||||
OptionsStruct.TimeStepSize = 500E-6; % in s
|
||||
OptionsStruct.TimeStepSize = 0.005; % in s
|
||||
OptionsStruct.NumberOfTimeSteps = 2E6; % in s
|
||||
OptionsStruct.EnergyTolerance = 5E-10;
|
||||
OptionsStruct.ResidualTolerance = 1E-05;
|
||||
@ -74,7 +74,7 @@ OptionsStruct.TrapPotentialType = 'None';
|
||||
|
||||
OptionsStruct.NumberOfGridPoints = [128, 128];
|
||||
OptionsStruct.Dimensions = [100, 100];
|
||||
OptionsStruct.TimeStepSize = 500E-6; % in s
|
||||
OptionsStruct.TimeStepSize = 0.005; % in s
|
||||
OptionsStruct.MinimumTimeStepSize = 1E-5; % in s
|
||||
OptionsStruct.TimeCutOff = 2E6; % in s
|
||||
OptionsStruct.EnergyTolerance = 5E-10;
|
||||
@ -142,7 +142,7 @@ OptionsStruct.TrapPotentialType = 'None';
|
||||
|
||||
OptionsStruct.NumberOfGridPoints = [128, 128];
|
||||
OptionsStruct.Dimensions = [100, 100];
|
||||
OptionsStruct.TimeStepSize = 500E-6; % in s
|
||||
OptionsStruct.TimeStepSize = 0.005; % in s
|
||||
OptionsStruct.MinimumTimeStepSize = 1E-5; % in s
|
||||
OptionsStruct.TimeCutOff = 2E6; % in s
|
||||
OptionsStruct.EnergyTolerance = 5E-10;
|
||||
@ -184,7 +184,7 @@ OptionsStruct.TrapPotentialType = 'None';
|
||||
|
||||
OptionsStruct.NumberOfGridPoints = [256, 256];
|
||||
OptionsStruct.Dimensions = [100, 100];
|
||||
OptionsStruct.TimeStepSize = 500E-6; % in s
|
||||
OptionsStruct.TimeStepSize = 0.005; % in s
|
||||
OptionsStruct.MinimumTimeStepSize = 1E-5; % in s
|
||||
OptionsStruct.TimeCutOff = 2E6; % in s
|
||||
OptionsStruct.EnergyTolerance = 5E-10;
|
||||
@ -221,21 +221,18 @@ Plotter.visualizeWavefunction2D(psi,Params,Transf)
|
||||
%% - Plot GS wavefunction
|
||||
Plotter.visualizeGSWavefunction2D(solver.SaveDirectory, solver.JobNumber)
|
||||
|
||||
%% - Cluster Runs - Analysis
|
||||
%% - Analysis
|
||||
SaveDirectory = './Data_TriangularPhase';
|
||||
JobNumber = 1;
|
||||
% Plotter.visualizeGSWavefunction2D(SaveDirectory, JobNumber)
|
||||
Scripts.analyzeRun2D(SaveDirectory, JobNumber)
|
||||
Plotter.visualizeGSWavefunction2D(SaveDirectory, JobNumber)
|
||||
|
||||
%% - Cluster Runs - Analysis
|
||||
%% - Analysis
|
||||
SaveDirectory = './Data_StripePhase';
|
||||
JobNumber = 2;
|
||||
% Plotter.visualizeGSWavefunction2D(SaveDirectory, JobNumber)
|
||||
Scripts.analyzeRun2D(SaveDirectory, JobNumber)
|
||||
Plotter.visualizeGSWavefunction2D(SaveDirectory, JobNumber)
|
||||
|
||||
%% - Cluster Runs - Analysis
|
||||
%% - Analysis
|
||||
SaveDirectory = './Data_HoneycombPhase';
|
||||
JobNumber = 3;
|
||||
% Plotter.visualizeGSWavefunction2D(SaveDirectory, JobNumber)
|
||||
Scripts.analyzeRun2D(SaveDirectory, JobNumber)
|
||||
Plotter.visualizeGSWavefunction2D(SaveDirectory, JobNumber)
|
||||
|
||||
|
@ -9,7 +9,7 @@
|
||||
|
||||
% as = ((as/add)*Params.add)/Params.a0
|
||||
% Critical point: 102.5133; Triangular phase: 98.0676; Stripe phase: 100.0289; Honeycomb phase: 101.9903
|
||||
|
||||
%{
|
||||
%% - Create Variational2D and Calculator object with specified options
|
||||
|
||||
OptionsStruct = struct;
|
||||
@ -93,22 +93,22 @@ solver.Potential = pot.trap();
|
||||
|
||||
%-% Run Solver %-%
|
||||
[Params, Transf, psi, V, VDk] = solver.run();
|
||||
|
||||
%}
|
||||
%% - Create Variational2D and Calculator object with specified options
|
||||
|
||||
OptionsStruct = struct;
|
||||
|
||||
OptionsStruct.NumberOfAtoms = 4.0102e+07;
|
||||
OptionsStruct.NumberOfAtoms = 4.148e+07;
|
||||
OptionsStruct.DipolarPolarAngle = 0;
|
||||
OptionsStruct.DipolarAzimuthAngle = 0;
|
||||
OptionsStruct.ScatteringLength = 101.9903;
|
||||
OptionsStruct.ScatteringLength = 101.35;
|
||||
|
||||
OptionsStruct.TrapFrequencies = [0, 0, 72.4];
|
||||
OptionsStruct.TrapPotentialType = 'None';
|
||||
|
||||
OptionsStruct.NumberOfGridPoints = [256, 256];
|
||||
OptionsStruct.Dimensions = [100, 100];
|
||||
OptionsStruct.TimeStepSize = 500E-6; % in s
|
||||
OptionsStruct.TimeStepSize = 0.005; % in s
|
||||
OptionsStruct.MinimumTimeStepSize = 1E-5; % in s
|
||||
OptionsStruct.TimeCutOff = 2E6; % in s
|
||||
OptionsStruct.EnergyTolerance = 5E-10;
|
||||
@ -116,7 +116,7 @@ OptionsStruct.ResidualTolerance = 1E-05;
|
||||
OptionsStruct.NoiseScaleFactor = 0.05;
|
||||
|
||||
OptionsStruct.MaxIterations = 10;
|
||||
OptionsStruct.VariationalWidth = 5;
|
||||
OptionsStruct.VariationalWidth = 6;
|
||||
OptionsStruct.WidthLowerBound = 1;
|
||||
OptionsStruct.WidthUpperBound = 12;
|
||||
OptionsStruct.WidthCutoff = 5e-3;
|
||||
|
@ -73,11 +73,12 @@ function [Params, Transf, psi, V, VDk] = run(this)
|
||||
|
||||
%Plotting
|
||||
if this.PlotLive
|
||||
figure(2);
|
||||
figure(1);
|
||||
subplots = findobj(gcf, 'Type', 'axes'); % Find all axes (subplots) in figure 1
|
||||
subplots = flipud(subplots); % Reverse the order to match the subplot layout
|
||||
last_subplot_handle = subplots(end); % Grab the handle of the last subplot
|
||||
axes(last_subplot_handle); % Set the last subplot as the current axes
|
||||
plot(ells,E_vs_iter,'LineStyle','none','Marker','o','MarkerSize',3,'Color','b','MarkerFaceColor','b')
|
||||
xlabel('$\ell$', 'FontSize', 14)
|
||||
ylabel('$E_{var}$', 'FontSize', 14)
|
||||
title('Variational Energy', 'FontSize', 14);
|
||||
drawnow
|
||||
end
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user