%% Tilting of the dipoles
% With an in-plane harmonic trap

%% v_z = 500, theta = 0

OptionsStruct = struct;

OptionsStruct.NumberOfAtoms           = 101250;     
OptionsStruct.DipolarPolarAngle       = 0;
OptionsStruct.DipolarAzimuthAngle     = 0;
OptionsStruct.ScatteringLength        = 70.00;        

OptionsStruct.TrapFrequencies         = [100, 100, 500];
OptionsStruct.TrapPotentialType       = 'Harmonic';

OptionsStruct.NumberOfGridPoints      = [256, 256];
OptionsStruct.Dimensions              = [35, 35];      
OptionsStruct.TimeStepSize            = 0.005;           % in s
OptionsStruct.MinimumTimeStepSize     = 1E-5;            % in s
OptionsStruct.TimeCutOff              = 1E6;             % in s
OptionsStruct.EnergyTolerance         = 5E-10;
OptionsStruct.ResidualTolerance       = 1E-05;
OptionsStruct.NoiseScaleFactor        = 0.05;

OptionsStruct.MaxIterations           = 10;      
OptionsStruct.VariationalWidth        = 1.2;       
OptionsStruct.WidthLowerBound         = 0.01;
OptionsStruct.WidthUpperBound         = 12;
OptionsStruct.WidthCutoff             = 5e-3;

OptionsStruct.PlotLive                = false;
OptionsStruct.JobNumber               = 0;
OptionsStruct.RunOnGPU                = true;
OptionsStruct.SaveData                = true;
OptionsStruct.SaveDirectory           = './Results/Data_TiltingOfDipoles/HarmonicTrap/Hz500';
options                               = Helper.convertstruct2cell(OptionsStruct);
clear OptionsStruct

solver                                = VariationalSolver2D.DipolarGas(options{:});
pot                                   = VariationalSolver2D.Potentials(options{:});
solver.Potential                      = pot.trap();

%-% Run Solver %-%
[Params, Transf, psi, V, VDk]         = solver.run();

%% v_z = 500, theta = 15

OptionsStruct = struct;

OptionsStruct.NumberOfAtoms           = 101250;     
OptionsStruct.DipolarPolarAngle       = deg2rad(15);
OptionsStruct.DipolarAzimuthAngle     = 0;
OptionsStruct.ScatteringLength        = 70.00;        

OptionsStruct.TrapFrequencies         = [100, 100, 500];
OptionsStruct.TrapPotentialType       = 'Harmonic';

OptionsStruct.NumberOfGridPoints      = [256, 256];
OptionsStruct.Dimensions              = [35, 35];      
OptionsStruct.TimeStepSize            = 0.005;           % in s
OptionsStruct.MinimumTimeStepSize     = 1E-5;            % in s
OptionsStruct.TimeCutOff              = 1E6;             % in s
OptionsStruct.EnergyTolerance         = 5E-10;
OptionsStruct.ResidualTolerance       = 1E-05;
OptionsStruct.NoiseScaleFactor        = 0.05;

OptionsStruct.MaxIterations           = 10;      
OptionsStruct.VariationalWidth        = 1.2;       
OptionsStruct.WidthLowerBound         = 0.01;
OptionsStruct.WidthUpperBound         = 12;
OptionsStruct.WidthCutoff             = 5e-3;

OptionsStruct.PlotLive                = false;
OptionsStruct.JobNumber               = 1;
OptionsStruct.RunOnGPU                = true;
OptionsStruct.SaveData                = true;
OptionsStruct.SaveDirectory           = './Results/Data_TiltingOfDipoles/HarmonicTrap/Hz500';
options                               = Helper.convertstruct2cell(OptionsStruct);
clear OptionsStruct

solver                                = VariationalSolver2D.DipolarGas(options{:});
pot                                   = VariationalSolver2D.Potentials(options{:});
solver.Potential                      = pot.trap();

%-% Run Solver %-%
[Params, Transf, psi, V, VDk]         = solver.run();

%% v_z = 750, theta = 0

OptionsStruct = struct;

OptionsStruct.NumberOfAtoms           = 61250;     
OptionsStruct.DipolarPolarAngle       = 0;
OptionsStruct.DipolarAzimuthAngle     = 0;
OptionsStruct.ScatteringLength        = 60.0;        

OptionsStruct.TrapFrequencies         = [100, 100, 750];
OptionsStruct.TrapPotentialType       = 'Harmonic';

OptionsStruct.NumberOfGridPoints      = [256, 256];
OptionsStruct.Dimensions              = [35, 35];      
OptionsStruct.TimeStepSize            = 0.005;           % in s
OptionsStruct.MinimumTimeStepSize     = 1E-5;            % in s
OptionsStruct.TimeCutOff              = 1E6;             % in s
OptionsStruct.EnergyTolerance         = 5E-10;
OptionsStruct.ResidualTolerance       = 1E-05;
OptionsStruct.NoiseScaleFactor        = 0.05;

OptionsStruct.MaxIterations           = 10;      
OptionsStruct.VariationalWidth        = 0.8;       
OptionsStruct.WidthLowerBound         = 0.01;
OptionsStruct.WidthUpperBound         = 12;
OptionsStruct.WidthCutoff             = 5e-3;

OptionsStruct.PlotLive                = false;
OptionsStruct.JobNumber               = 0;
OptionsStruct.RunOnGPU                = true;
OptionsStruct.SaveData                = true;
OptionsStruct.SaveDirectory           = './Results/Data_TiltingOfDipoles/HarmonicTrap/Hz750';
options                               = Helper.convertstruct2cell(OptionsStruct);
clear OptionsStruct

solver                                = VariationalSolver2D.DipolarGas(options{:});
pot                                   = VariationalSolver2D.Potentials(options{:});
solver.Potential                      = pot.trap();

%-% Run Solver %-%
[Params, Transf, psi, V, VDk]         = solver.run();

%% v_z = 750, theta = 15

OptionsStruct = struct;

OptionsStruct.NumberOfAtoms           = 61250;     
OptionsStruct.DipolarPolarAngle       = deg2rad(15);
OptionsStruct.DipolarAzimuthAngle     = 0;
OptionsStruct.ScatteringLength        = 60.0;        

OptionsStruct.TrapFrequencies         = [100, 100, 750];
OptionsStruct.TrapPotentialType       = 'Harmonic';

OptionsStruct.NumberOfGridPoints      = [256, 256];
OptionsStruct.Dimensions              = [35, 35];      
OptionsStruct.TimeStepSize            = 0.005;           % in s
OptionsStruct.MinimumTimeStepSize     = 1E-5;            % in s
OptionsStruct.TimeCutOff              = 1E6;             % in s
OptionsStruct.EnergyTolerance         = 5E-10;
OptionsStruct.ResidualTolerance       = 1E-05;
OptionsStruct.NoiseScaleFactor        = 0.05;

OptionsStruct.MaxIterations           = 10;      
OptionsStruct.VariationalWidth        = 0.8;       
OptionsStruct.WidthLowerBound         = 0.01;
OptionsStruct.WidthUpperBound         = 12;
OptionsStruct.WidthCutoff             = 5e-3;

OptionsStruct.PlotLive                = false;
OptionsStruct.JobNumber               = 1;
OptionsStruct.RunOnGPU                = true;
OptionsStruct.SaveData                = true;
OptionsStruct.SaveDirectory           = './Results/Data_TiltingOfDipoles/HarmonicTrap/Hz750';
options                               = Helper.convertstruct2cell(OptionsStruct);
clear OptionsStruct

solver                                = VariationalSolver2D.DipolarGas(options{:});
pot                                   = VariationalSolver2D.Potentials(options{:});
solver.Potential                      = pot.trap();

%-% Run Solver %-%
[Params, Transf, psi, V, VDk]         = solver.run();