 Tensor Network Theory Library  Beta release 1.2.1 A library of routines for performing TNT-based operations
init_harm_sf.m

Creates an initialisation file suitable for running with tntEvolve_if.c.

This creates the same system as the template Harmonically trapped superfluid on TNTgo.

%% Creating an initialisation file for TNT library functions
clear all;
% matlab filename for input file
savename = 'harm_sf.mat';
% Initialise all variables required
%% Create n-species operators
ns = 1; % Number of species
nmax = 3; % Maximum number of bosons per site
[bdag,b,n] = tntMatBosonOps(nmax,ns); % Creating boson operators
d = size(n{1},1);% Physical dimension
%% Defining the physical basis and symmetry information
% Now give the quantum number(s) for each index of the operator.
% For a single species system it should be a row vector having the same
% number of elements as the physical dimension.
qnums = transpose(diag(n{1}));
tntSystem.basisOp = tntMatAppendBasisOp(n{1},qnums); %Set the basis operator for the system
tntSystem.symm_type = 1; % U(1) symmetry type (0 for no symmetries)
tntSystem.symm_num_qn = ns; % The number of quantum number labels
%% Set up the system
chi = 20;
L = 40;
%% Parameters for finding the ground state: Bose-Hubbard Hamiltonian with a harmonic trap
qn_tot = 30;
precision = 1e-5;
% Hamiltonian
% Onsite terms: Interaction Harmonic trap
osg = tntMatCreateOpArray({0.5*n{1}*(n{1}-eye(d)), n{1}});
osparamg = [ 0.2*ones(1,L); 0.75 + 0.01*(-((L-1)/2):1:((L-1)/2)).^2];
% Nearest-neighbour terms: Hopping
nnlg = tntMatCreateOpArray({bdag{1},b{1}});
nnrg = tntMatCreateOpArray({b{1},bdag{1}});
nnparamg = -1*ones(2,L-1);
%% Expectation values to take
ExOp.os_operators = tntMatCreateOpArray({n{1}});
ExOp.os_labels = {'density'};
ExOp.nn_operators = tntMatCreateOpArray({});
ExOp.nn_labels = {};
ExOp.cs_operators = tntMatCreateOpArray({});
ExOp.cs_labels = {};
ExOp.ap_operators = tntMatCreateOpArray({b{1},bdag{1}});
ExOp.ap_labels = {'single_particle_density_matrix'};
%% Save all the parameters
save(savename);