Fixed issue with creation of save directories.

This commit is contained in:
Karthik 2025-04-07 21:44:03 +02:00
parent 178350bdc2
commit 5053e3ffba
2 changed files with 9 additions and 8 deletions

View File

@ -82,6 +82,7 @@ OptionsStruct.PlotLive = true;
OptionsStruct.JobNumber = 0;
OptionsStruct.RunOnGPU = false;
OptionsStruct.SaveData = false;
OptionsStruct.SaveDirectory = './Results/Data_3D/RealTimeDynamics';
options = Helper.convertstruct2cell(OptionsStruct);
sim = Simulator.DipolarGas(options{:});
@ -91,7 +92,8 @@ sim.Potential = pot.trap();
%-% Run Simulation %-%
[Params, Transf, psi, V, VDk] = sim.run();
SaveDirectory = './Results/Data_3D/RealTimeDynamics';
% Save only final state as initial wavefunction for real-time propagation
mkdir(sprintf(OptionsStruct.SaveDirectory))
save(sprintf(strcat(SaveDirectory, '/psi_init.mat'),Params.njob),'psi','Transf','Params','VDk','V');
close all
clear

View File

@ -3,17 +3,12 @@ function [Params, Transf, psi,V,VDk] = run(this)
[Params] = this.setupParameters();
this.SimulationParameters = Params;
if strcmp(this.SimulationMode, 'RealTimeEvolution')
this.QuenchSettings = this.setupQuenchSettings(Params);
end
% --- Set up spatial grids and transforms ---
[Transf] = this.setupSpace(Params);
[TransfRad] = this.setupSpaceRadial(Params);
% --- Initialize ---
mkdir(sprintf(this.SaveDirectory))
[psi,V,VDk] = this.initialize(Params,Transf,TransfRad);
Observ.EVec = []; Observ.NormVec = []; Observ.PCVec = []; Observ.tVecPlot = []; Observ.mucVec = [];
@ -21,11 +16,15 @@ function [Params, Transf, psi,V,VDk] = run(this)
Observ.res_idx = 1;
% --- Run Simulation ---
mkdir(sprintf(this.SaveDirectory))
mkdir(sprintf(strcat(this.SaveDirectory, '/Run_%03i'),Params.njob))
if this.DoSave
mkdir(sprintf(strcat(this.SaveDirectory, '/Run_%03i'),Params.njob))
end
if strcmp(this.SimulationMode, 'EnergyMinimization')
[psi] = this.runGradientDescent(psi,Params,Transf,VDk,V,Observ);
else
if strcmp(this.SimulationMode, 'RealTimeEvolution')
this.QuenchSettings = this.setupQuenchSettings(Params);
end
[psi] = this.propagateWavefunction(psi,Params,Transf,VDk,V,t_idx,Observ);
end
end