Skip to content

Instantly share code, notes, and snippets.

@Lucacalderaro
Created February 2, 2016 11:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Lucacalderaro/4bf51c7ca2b0603174b4 to your computer and use it in GitHub Desktop.
Save Lucacalderaro/4bf51c7ca2b0603174b4 to your computer and use it in GitHub Desktop.
Find the ground state of the harmonic potential using GPELab
%% Setting the method and geometry
Computation = 'Ground';
Ncomponents = 1;
Type = 'BESP';
Deltat = 1e-4;
Stop_time = [];
Stop_crit = {'MaxNorm',1e-4};
Max_iter = 40000;
Method = Method_Var2d(Computation,Ncomponents, Type, Deltat, Stop_time , Stop_crit, Max_iter);
xmin = -7.07;
xmax = 7.07;
ymin = -7.07;
ymax = 7.07;
Nx = 2^8+1;
Ny = 2^8+1;
Geometry2D = Geometry2D_Var2d(xmin,xmax, ymin,ymax, Nx, Ny);
%% Setting the Hamiltonian
Delta = 0.5;
Beta = 0;
Omega = 0;
Physics2D = Physics2D_Var2d(Method,Delta,Beta);
Physics2D = Dispersion_Var2d(Method, Physics2D, @(fftx,ffty) Delta*(fftx.^2+ffty.^2));
Physics2D = Potential_Var2d(Method, Physics2D, @(x,y) (1/2)*(x.^2+y.^2));
Physics2D = Nonlinearity_Var2d(Method, Physics2D, @(phi,x,y) abs(phi).^2 );
Physics2D = Gradientx_Var2d(Method, Physics2D,@(x,y) 1i*Omega*y);
Physics2D = Gradienty_Var2d(Method, Physics2D,@(x,y) -1i*Omega*x);
%% Setting the initial state
InitialData_choice = 1;
Phi_0 = InitialData_Var2d(Method, Geometry2D, Physics2D,InitialData_choice,0,0,3,3);
%% Set output structure
Evo = 1000;
Outputs = OutputsINI_Var2d(Method,Evo);
Printing = 1;
Draw = 0;
Print = Print_Var2d(Printing,Evo,Draw);
%% Launch evolution
[Phi,Outputs]= GPELab2d(Phi_0,Method,Geometry2D,Physics2D,Outputs,[],Print);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment