├── GS_high_order_corr.m ├── GS_high_order_corr.m~ ├── GnData6Site.mat ├── Hamiltonians ├── 101_sites_1_bosons_0_pb_1_jn_loadme.mat ├── 101_sites_1_bosons_1_pb_1_jn_loadme.mat ├── 10_sites_1_bosons_0_pb_1_jn_loadme.mat ├── 11_sites_1_bosons_0_pb_1_jn_loadme.mat ├── 2_sites_2_bosons_0_pb_1_jn_loadme.mat ├── 2_sites_2_bosons_1_pb_1_jn_loadme.mat ├── 2_sites_3_bosons_0_pb_1_jn_loadme.mat ├── 2_sites_3_bosons_1_pb_1_jn_loadme.mat ├── 2_sites_4_bosons_0_pb_1_jn_loadme.mat ├── 2_sites_4_bosons_1_pb_1_jn_loadme.mat ├── 2_sites_5_bosons_0_pb_1_jn_loadme.mat ├── 2_sites_5_bosons_1_pb_1_jn_loadme.mat ├── 2_sites_6_bosons_0_pb_1_jn_loadme.mat ├── 2_sites_6_bosons_1_pb_1_jn_loadme.mat ├── 2_sites_7_bosons_0_pb_1_jn_loadme.mat ├── 2_sites_7_bosons_1_pb_1_jn_loadme.mat ├── 2_sites_8_bosons_0_pb_1_jn_loadme.mat ├── 2_sites_8_bosons_1_pb_1_jn_loadme.mat ├── 31_sites_1_bosons_0_pb_1_jn_loadme.mat ├── 3_sites_2_bosons_0_pb_1_jn_loadme.mat ├── 3_sites_2_bosons_1_pb_1_jn_loadme.mat ├── 3_sites_3_bosons_0_pb_1_jn_loadme.mat ├── 3_sites_3_bosons_1_pb_1_jn_loadme.mat ├── 3_sites_4_bosons_0_pb_1_jn_loadme.mat ├── 3_sites_4_bosons_1_pb_1_jn_loadme.mat ├── 3_sites_5_bosons_0_pb_1_jn_loadme.mat ├── 3_sites_5_bosons_1_pb_1_jn_loadme.mat ├── 3_sites_6_bosons_0_pb_1_jn_loadme.mat ├── 3_sites_6_bosons_1_pb_1_jn_loadme.mat ├── 3_sites_7_bosons_0_pb_1_jn_loadme.mat ├── 3_sites_7_bosons_1_pb_1_jn_loadme.mat ├── 3_sites_8_bosons_0_pb_1_jn_loadme.mat ├── 3_sites_8_bosons_1_pb_1_jn_loadme.mat ├── 4_sites_2_bosons_0_pb_1_jn_loadme.mat ├── 4_sites_2_bosons_1_pb_1_jn_loadme.mat ├── 4_sites_3_bosons_0_pb_1_jn_loadme.mat ├── 4_sites_3_bosons_1_pb_1_jn_loadme.mat ├── 4_sites_4_bosons_0_pb_1_jn_loadme.mat ├── 4_sites_4_bosons_1_pb_1_jn_loadme.mat ├── 4_sites_5_bosons_0_pb_1_jn_loadme.mat ├── 4_sites_5_bosons_1_pb_1_jn_loadme.mat ├── 4_sites_6_bosons_0_pb_1_jn_loadme.mat ├── 4_sites_6_bosons_1_pb_1_jn_loadme.mat ├── 4_sites_7_bosons_0_pb_1_jn_loadme.mat ├── 4_sites_7_bosons_1_pb_1_jn_loadme.mat ├── 4_sites_8_bosons_0_pb_1_jn_loadme.mat ├── 4_sites_8_bosons_1_pb_1_jn_loadme.mat ├── 51_sites_1_bosons_1_pb_1_jn_loadme.mat ├── 5_sites_2_bosons_0_pb_1_jn_loadme.mat ├── 5_sites_2_bosons_1_pb_1_jn_loadme.mat ├── 5_sites_3_bosons_0_pb_1_jn_loadme.mat ├── 5_sites_3_bosons_1_pb_1_jn_loadme.mat ├── 5_sites_4_bosons_0_pb_1_jn_loadme.mat ├── 5_sites_4_bosons_1_pb_1_jn_loadme.mat ├── 5_sites_5_bosons_0_pb_1_jn_loadme.mat ├── 5_sites_5_bosons_1_pb_1_jn_loadme.mat ├── 5_sites_6_bosons_0_pb_1_jn_loadme.mat ├── 5_sites_6_bosons_1_pb_1_jn_loadme.mat ├── 5_sites_7_bosons_0_pb_1_jn_loadme.mat ├── 5_sites_7_bosons_1_pb_1_jn_loadme.mat ├── 5_sites_8_bosons_0_pb_1_jn_loadme.mat ├── 5_sites_8_bosons_1_pb_1_jn_loadme.mat ├── 6_sites_2_bosons_0_pb_1_jn_loadme.mat ├── 6_sites_2_bosons_1_pb_1_jn_loadme.mat ├── 6_sites_3_bosons_0_pb_1_jn_loadme.mat ├── 6_sites_3_bosons_1_pb_1_jn_loadme.mat ├── 6_sites_4_bosons_0_pb_1_jn_loadme.mat ├── 6_sites_4_bosons_1_pb_1_jn_loadme.mat ├── 6_sites_5_bosons_0_pb_1_jn_loadme.mat ├── 6_sites_5_bosons_1_pb_1_jn_loadme.mat ├── 6_sites_6_bosons_0_pb_1_jn_loadme.mat ├── 6_sites_6_bosons_1_pb_1_jn_loadme.mat ├── 6_sites_7_bosons_0_pb_1_jn_loadme.mat ├── 6_sites_7_bosons_1_pb_1_jn_loadme.mat ├── 6_sites_8_bosons_0_pb_1_jn_loadme.mat ├── 6_sites_8_bosons_1_pb_1_jn_loadme.mat ├── 7_sites_2_bosons_0_pb_1_jn_loadme.mat ├── 7_sites_2_bosons_1_pb_1_jn_loadme.mat ├── 7_sites_3_bosons_0_pb_1_jn_loadme.mat ├── 7_sites_3_bosons_1_pb_1_jn_loadme.mat ├── 7_sites_4_bosons_0_pb_1_jn_loadme.mat ├── 7_sites_4_bosons_1_pb_1_jn_loadme.mat ├── 7_sites_5_bosons_0_pb_1_jn_loadme.mat ├── 7_sites_5_bosons_1_pb_1_jn_loadme.mat ├── 7_sites_6_bosons_0_pb_1_jn_loadme.mat ├── 7_sites_6_bosons_1_pb_1_jn_loadme.mat ├── 7_sites_7_bosons_0_pb_1_jn_loadme.mat ├── 7_sites_7_bosons_1_pb_1_jn_loadme.mat ├── 7_sites_8_bosons_0_pb_1_jn_loadme.mat ├── 7_sites_8_bosons_1_pb_1_jn_loadme.mat ├── 8_sites_2_bosons_0_pb_1_jn_loadme.mat ├── 8_sites_2_bosons_1_pb_1_jn_loadme.mat ├── 8_sites_3_bosons_0_pb_1_jn_loadme.mat ├── 8_sites_3_bosons_1_pb_1_jn_loadme.mat ├── 8_sites_4_bosons_0_pb_1_jn_loadme.mat ├── 8_sites_4_bosons_1_pb_1_jn_loadme.mat ├── 8_sites_5_bosons_0_pb_1_jn_loadme.mat ├── 8_sites_5_bosons_1_pb_1_jn_loadme.mat ├── 8_sites_6_bosons_0_pb_1_jn_loadme.mat ├── 8_sites_6_bosons_1_pb_1_jn_loadme.mat ├── 8_sites_7_bosons_0_pb_1_jn_loadme.mat ├── 8_sites_7_bosons_1_pb_1_jn_loadme.mat ├── 8_sites_8_bosons_0_pb_1_jn_loadme.mat ├── 8_sites_8_bosons_1_pb_1_jn_loadme.mat └── ExpDisorder.mat ├── README.md ├── andersonLocalizationScript.m ├── dynBldGnPdfFx.m ├── functions ├── BasisMake.m ├── DensityEval.m ├── DisorderAvgPsi.m ├── ExactDiagTimeFx.m ├── FindTunnelingTerms.m ├── GnConn.m ├── GnCorrDatFx.m ├── HilbDim.m ├── MakeDisorderHam.m ├── MakeHamiltoniansAndBasis.m ├── MonteCarloSmp.m ├── cabFx.asv ├── cabFx.m ├── dynBldGnFx.m ├── dynBldGnFxFs.m ├── dynBldGnFxFsPP.m ├── dynBldGnFxFsPPMap.m ├── dynBldGnFxFsPPMap.m~ ├── dynBldGnFxFsPPMapPDF.m ├── dynBldGnFxFsPPMapPDF.m~ ├── dynBldGnFxFsPPMapPF.m └── permIndsProd.m ├── imgs_for_readme └── AL_IPR.PNG ├── infTData.mat ├── infT_high_order_corr.m ├── manybodyLocalizationScript.m ├── mbl_8site_function_red.m ├── mbl_8site_function_red_sr.m ├── meanAbsGn6Sites.gif ├── meanGn6Sites.gif ├── non_eq_high_order_corr.asv ├── non_eq_high_order_corr.m ├── plot_colormaps └── alex_cmap.mat ├── plots_high_gn_heidelberg ├── 6SiteGS.fig ├── 6SiteGS.svg ├── 6SiteUvary.fig ├── 6siteUVaryMean13.fig ├── 6siteUVaryMean24.fig ├── 6siteUVaryMeanAbs12.fig ├── 6siteUVaryMeanAbs23.fig ├── 6siteUVaryStd11.fig ├── 6siteUVaryStd22.fig ├── 6siteWscan_MeanAbsGn.fig ├── 6siteWscan_MeanAbsGn_avg.fig ├── 6siteWscan_MeanGn.fig ├── 6siteWscan_MeanGn_avg.fig ├── 6siteWscan_StdGn.fig ├── 6siteWscan_StdGn_avg.fig ├── 8site_absMeanGn_Avgmbl.fig ├── 8site_absMeanGn_mbl.fig ├── 8site_absMeanGn_mbl.svg ├── 8site_meanAbsGn_Avgmbl.fig ├── 8site_meanAbsGn_Wscan.fig ├── 8site_meanAbsGn_Wscan_avg.fig ├── 8site_meanAbsGn_mbl.fig ├── 8site_meanAbsGn_mbl.svg ├── 8site_meanGn_Wscan.fig ├── 8site_meanGn_Wscan_Avg.fig ├── 8site_stdGn_Avgmbl.fig ├── 8site_stdGn_Wscan_avg.fig ├── 8site_stdGn_mbl.fig ├── 8site_stdGn_mbl.svg ├── AAGS_6Site.fig ├── AAGS_6Site.svg ├── SF_vs_corr.fig ├── SF_vs_corr.svg ├── TInftyMeanGn.fig ├── TInftyMeanGn.svg ├── TInftyMeanGn2.fig ├── TInftyMeanGn2.svg ├── TInfty_powerLaw.fig ├── TInfty_powerLaw.svg ├── gs_sf_6site.fig ├── gs_sf_6site.svg ├── meanAbsGn6Sites.gif ├── meanGn6Sites.gif ├── sfVsCorr.fig ├── sfVsCorr.svg ├── stdGn6Sites.gif └── svn_sf_init_State.fig ├── quenchHamUJ.m ├── quenchHamUJ.m~ ├── scriptEDbhm.m ├── stdGn6Sites.gif └── subSystemsEP_small_half_only.m /GS_high_order_corr.m: -------------------------------------------------------------------------------- 1 | % general ED bose-hubbard code 2 | % last cleaned up 9/24/2018 3 | % author: Matthew Rispoli 4 | 5 | addpath('functions') 6 | 7 | close all 8 | clear all 9 | clc 10 | 11 | 12 | % tunneling 13 | J=38.1911/1000; %8Er tunneling rate; defined in Hz/(2 pi) 14 | 15 | % disorder strengths 16 | NW=1; 17 | Ws=linspace(0.3,22,NW).*0.*J % units of J 18 | Ws=[1 4 8 12 16 20] 19 | % tupe of disorder 20 | isQP=1; % 0 = uniform random, 1 = FFT of disorder from exp, 2 = actual QP 21 | 22 | % interaction strengths 23 | Uo=2.7*J % units of J 24 | Us=ones(size(Ws)).*Uo; %make them all the same 25 | Us=linspace(0,10,NW).*J; 26 | 27 | % system size parameters 28 | NPart=8 % number of bosons 29 | NSites=8 % number of sites 30 | 31 | % num of disorders and time scans 32 | ND=51; %disorder number 33 | DisordN=ND 34 | NT=151; % time steps 35 | tau=(1./(2.*pi.*J)); 36 | Ts=linspace(0,1000,NT) %actual times for ED evaluation 37 | Ts=logspace(-1,4,NT).*tau; 38 | % periodic boundary conditions 39 | isPB = 0; % 0 = open boundary; 1 = periodic boundary 40 | jn = 1; % order of neighbor tunnelings 41 | 42 | %% 43 | 44 | % folder for storing all matrix files 45 | folderName = 'Hamiltonians/' 46 | % hamiltonian and basis parameters 47 | edFileName=[folderName sprintf('%i_sites_%i_bosons_%i_pb_%i_jn_loadme.mat',NSites,NPart,isPB,jn)] %format for Hamiltonian filename 48 | 49 | % find hilbert space dimension 50 | HilbD=HilbDim(NSites,NPart) 51 | 52 | % check if we've already made the basis and hamiltonians 53 | if exist(edFileName,'file')==2 54 | % if it exists then load 55 | load(edFileName); 56 | else 57 | % if it doesn't exist then make them all 58 | [Hi,Hj,basis] = MakeHamiltoniansAndBasis(NSites,NPart,jn,isPB); 59 | save(edFileName,'Hi','Hj','basis','NPart','NSites','jn','isPB') 60 | end 61 | 62 | %% 63 | % make giant dataStruct to save wavefunction for all disorders 64 | psiAllW=cell(NW,ND); 65 | 66 | % find initial state in basis 67 | psiInit=zeros(1,HilbD); 68 | psiInit(find(ismember(basis,ones(1,NSites),'rows')==1))=1; 69 | %% 70 | gnPDFStoreStd=zeros(NT,ND,NSites,NW); 71 | gnPDFStoreMAbs=zeros(NT,ND,NSites,NW); 72 | for ww=1:length(Ws) 73 | ww 74 | for dd=1:ND 75 | dd 76 | 77 | %bose hubbard parameters 78 | 79 | %Disorder Hamiltonian 80 | isQP=2; 81 | beta=1.618; 82 | Hd=MakeDisorderHam(basis,isQP,2*pi*dd/ND,beta); 83 | 84 | W=Ws(ww)*J; 85 | %W=2*J; 86 | U=Us(1).*J; 87 | Ham = Hj.*J+Hi.*U+Hd.*W; 88 | 89 | [psiAll, PhiN, En, Cn] = ExactDiagTimeFx(psiInit,Ts,Ham); 90 | 91 | %{ 92 | PhiNSave{ww}=PhiN; 93 | EnSave{ww}=En; 94 | CnSave{ww}=Cn; 95 | %} 96 | 97 | 98 | pdf = abs(psiAll(:,:)).^2; 99 | %NSamp=1E6 100 | %[dataSmpl] = MonteCarloSmp(pdf,tind,NSamp); 101 | 102 | nord=NSites 103 | inds=1:nord; 104 | %[sn2k,S2kInds,indsNKStore,corrn,gn] = dynBldGnFxFsPPMap(basis(dataSmpl,:),nord,inds,1) 105 | for tind=1:NT 106 | pn=pdf(:,tind); 107 | %gnDat=gn; 108 | [sn2k,S2kInds,indsNKStore,corrn,gn] = dynBldGnFxFsPPMapPDF(pn,basis,nord,inds,0); 109 | 110 | for nn=1:length(gn) 111 | gnPDFStoreStd(tind,dd,nn,ww)=std(((cell2mat(values(gn{nn}))))); 112 | gnPDFStoreMAbs(tind,dd,nn,ww)=mean(abs((cell2mat(values(gn{nn}))))); 113 | end 114 | end 115 | 116 | 117 | 118 | %[tt,psiAll,Deig]=mbl_8site_function_red(J,U,W,DisordN,NT,isQP); 119 | %{ 120 | TT{ww}=tt; 121 | DeigS{ww}=Deig; 122 | 123 | for dd=1:DisordN 124 | psiAllW{ww,dd}=psiAll{dd}; 125 | end 126 | %} 127 | 128 | end 129 | end 130 | 131 | %% 132 | 133 | figure(11) 134 | for ww=1:length(Ws) 135 | for nn=1:NSites 136 | subplot(3,3,nn) 137 | semilogx(Ts./tau,mean(gnPDFStoreStd(:,:,nn,ww),2)) 138 | hold on 139 | end 140 | end 141 | 142 | %% 143 | 144 | figure(22) 145 | for ww=NW 146 | for nn=1:NSites 147 | subplot(3,3,nn) 148 | semilogx(Ts./tau,mean(gnPDFStoreStd(:,:,nn,ww),2)) 149 | hold on 150 | end 151 | end 152 | 153 | %% 154 | %{ 155 | 156 | for ww=1:NW 157 | tempE(ww,:)=EnSave{ww}./J; 158 | gapsW(ww,:)=tempE(ww,2:end)-tempE(ww,1:end-1); 159 | tempC(ww,:)=CnSave{ww}; 160 | pn=tempC(ww,:).^2; 161 | pns(ww,:)=(pn(2:end).*pn(1:end-1)).*4; 162 | HL=round(HilbD/3); 163 | HH=round(HilbD.*2./3); 164 | tempGap=[gapsW(ww,HL:HH+1); gapsW(ww,HL-1:HH)]; 165 | rspec(ww)=mean(min(tempGap,[],1)./max(tempGap,[],1),2); 166 | 167 | [ii,jj]=sort(pn,'descend'); 168 | 169 | end 170 | %} 171 | %% 172 | %load('8site_loadme.mat'); 173 | %% 174 | %{ 175 | nhalf=sum(basis(:,1:size(basis,2)/2),2); 176 | ND=DisordN; 177 | 178 | 179 | Sp=zeros(NT,length(Ws),ND); 180 | SPM=zeros(NT,length(Ws)); 181 | 182 | NS=size(basis,2); 183 | rhon=zeros(NT,NS+1,length(Ws),ND); 184 | nbar=zeros(NS,NT,ND,length(Ws)); 185 | 186 | for ww=1:length(Ws) 187 | for dd=1:ND 188 | rho=abs(psiAllW{ww,dd}).^2; 189 | nbar(:,:,dd,ww)=(rho*basis)'; 190 | 191 | for nn=1:NS+1 192 | indsn=find(nhalf==(nn-1)); 193 | rhon(:,nn,ww,dd)=sum(rho(:,indsn),2); 194 | end 195 | temp=reshape(rhon(:,:,ww,dd),[NT NS+1]); 196 | 197 | Sp(:,ww,dd)=-sum(temp.*log(temp),2); 198 | end 199 | SPM=mean(Sp,3); 200 | nbarM=reshape(mean(nbar,3),[NS,NT,length(Ws)]); 201 | end 202 | %} 203 | 204 | %% 205 | %tj=TT{1}.*J.*2.*pi; 206 | 207 | %cab_corr_red; 208 | 209 | %subSystemsEP_small_half_only; 210 | 211 | %% Correlation length section 212 | %{ 213 | 214 | % Okay so this is looking at the old data 215 | 216 | %NN=size(prSitesW{1},1); 217 | NN=8; 218 | %NS=size(prSitesW{1},2); 219 | NS=9; 220 | NT=size(psiAllW{1},1); 221 | ND=size(psiAllW,2); 222 | % find long time indices 223 | indsLongTime=find(tt.*2.*pi.*J>100); 224 | 225 | 226 | % create g2matrices. Need to redo simulation to keep psi 227 | g2mats=zeros(size(basis,2),size(basis,2),size(basis,1)); 228 | nImats=zeros(size(basis,2),size(basis,2),size(basis,1)); 229 | nJmats=zeros(size(basis,2),size(basis,2),size(basis,1)); 230 | disN=zeros(NSites,size(basis,1)); 231 | g2dMats=zeros(NSites,size(basis,1)); 232 | 233 | for zz=1:size(basis,1) 234 | zz 235 | for ii=1:size(basis,2) 236 | for jj=ii:size(basis,2) 237 | if ii==jj 238 | g2mat(ii,jj,zz)=basis(zz,ii).^2-basis(zz,ii); 239 | 240 | else 241 | g2mat(ii,jj,zz)=basis(zz,ii).*basis(zz,jj); 242 | end 243 | nImat(ii,jj,zz)=basis(zz,ii); 244 | nJmat(ii,jj,zz)=basis(zz,jj); 245 | 246 | dd=abs(ii-jj); 247 | disN(dd+1,zz)=disN(dd+1,zz)+1; 248 | g2dMats(dd+1,zz)=g2mat(ii,jj,zz)+g2dMats(dd+1,zz); 249 | 250 | end 251 | end 252 | end 253 | 254 | 255 | 256 | 257 | %% 258 | tempOp=g2dMats./disN; 259 | 260 | for ww=1:length(Ws) 261 | temp=zeros(size(psiAllW{ww,1})); 262 | ww 263 | %psiAllW{ww,: 264 | 265 | 266 | for dd=1:DisordN 267 | g2dWD{ww,dd}=(abs(psiAllW{ww,dd}).^2)*tempOp'; 268 | temp=temp+abs(psiAllW{ww,dd}).^2; 269 | nbarWD{ww,dd}=(abs(psiAllW{ww,dd}).^2)*basis; 270 | nbar2WD{ww,dd}=(abs(psiAllW{ww,dd}).^2)*(basis.^2); 271 | end 272 | 273 | tempG2=zeros(size(g2dWD{ww,1})); 274 | for dd=1:DisordN 275 | tempG2=g2dWD{ww,dd}+tempG2; 276 | end 277 | tempG2=tempG2./DisordN; 278 | g2dWDMean{ww}=tempG2; 279 | 280 | temp=temp./DisordN; 281 | g2dW{ww}=temp*tempOp' 282 | nbarW{ww}=temp*basis; 283 | nbar2W{ww}=temp*(basis.^2) 284 | end 285 | 286 | %% 287 | 288 | avgRho=cell(length(Ws),1); 289 | for ww=1:length(Ws) 290 | temp=zeros(size(psiAllW{ww,1})); 291 | 292 | for dd=1:DisordN 293 | temp=temp+abs(psiAllW{ww,dd}).^2; 294 | end 295 | avgRho{ww}=temp./DisordN; 296 | end 297 | 298 | 299 | %% 300 | 301 | G2DNt=cell(size(basis,2),length(Ws)); 302 | G2IJN=cell(size(basis,2),length(Ws)); 303 | G2DNW=cell(length(Ws),1); 304 | for ww=1:length(Ws) 305 | ww 306 | temp=zeros(size(basis,2),NT); 307 | for ii=1:size(basis,2) 308 | %for ii=1:size(basis,2)-dd+1 309 | for jj=ii:size(basis,2) 310 | dd=abs(jj-ii)+1 311 | %jj=ii+dd-1; 312 | G2DNt{dd,ww}=[G2DNt{dd,ww}; reshape(g2mat(ii,jj,:),[1 size(basis,1)])*avgRho{ww}';]; 313 | G2IJN{dd,ww}=[G2IJN{dd,ww}; (reshape(nImat(ii,jj,:),[1 size(basis,1)])*avgRho{ww}').*(reshape(nJmat(ii,jj,:),[1 size(basis,1)])*avgRho{ww}');]; 314 | end 315 | %G2DNt{dd,ww}=mean(G2DNt{dd,ww},1); 316 | %G2IJN{dd,ww}=mean(G2IJN{dd,ww},1); 317 | %temp(dd,:)=G2DNt{dd,ww}./G2IJN{dd,ww}; 318 | 319 | G2DNtt{dd,ww}=mean(G2DNt{dd,ww}./G2IJN{dd,ww},1); 320 | G2IJN{dd,ww}=mean(G2IJN{dd,ww},1); 321 | %temp(dd,:)=G2DNt{dd,ww}./G2IJN{dd,ww}; 322 | temp(dd,:)=G2DNtt{dd,ww}; 323 | end 324 | G2DNW{ww}=temp; 325 | end 326 | 327 | 328 | %% 329 | tt=TT{1}; 330 | 331 | czz_un=zeros(NSites,NSites,length(Ws),length(tt)); 332 | czz=zeros(NSites,NSites,length(Ws),length(tt)); 333 | 334 | for ii=1:size(basis,2) 335 | for jj=ii:size(basis,2) 336 | if ii==jj 337 | optr=basis(:,ii).*basis(:,jj)-basis(:,ii); 338 | normrii=basis(:,ii); 339 | normrjj=basis(:,jj); 340 | 341 | else 342 | optr=basis(:,ii).*basis(:,jj); 343 | normrii=basis(:,ii); 344 | normrjj=basis(:,jj); 345 | 346 | end 347 | 348 | for ww=1:length(Ws) 349 | czz(ii,jj,ww,:)=avgRho{ww}*optr-(avgRho{ww}*normrii).*(avgRho{ww}*normrjj); 350 | 351 | czz_un(ii,jj,ww,:)=avgRho{ww}*optr; 352 | 353 | end 354 | 355 | end 356 | end 357 | 358 | %% 359 | czz_r=zeros([size(czz,1) size(czz,4) size(czz,3)]); 360 | for ww=1:length(Ws) 361 | for tti=1:length(tj) 362 | for dd=1:size(czz_r,1) 363 | czz_r(dd,tti,ww)=mean(diag( ... 364 | reshape(czz(:,:,ww,tti),[size(czz_r,1) size(czz_r,1)]), ... 365 | dd-1)); 366 | end 367 | xd(tti,ww)=-sum(czz_r(:,tti,ww).*([0:7]')); 368 | end 369 | end 370 | %% 371 | save('corrzz.mat','czz','czz_r','czz_un','Ws','tj','xd') 372 | xdLow=xd; 373 | tjLow=tj; 374 | WsLow=Ws; 375 | xd100jtLow=xd(67,:); 376 | save('LowWXDat.mat','WsLow','tjLow','xdLow','xd100jtLow') 377 | %} -------------------------------------------------------------------------------- /GS_high_order_corr.m~: -------------------------------------------------------------------------------- 1 | % general ED bose-hubbard code 2 | % last cleaned up 9/24/2018 3 | % author: Matthew Rispoli 4 | 5 | addpath('functions') 6 | 7 | close all 8 | clear all 9 | clc 10 | 11 | 12 | % tunneling 13 | J=38.1911/1000; %8Er tunneling rate; defined in Hz/(2 pi) 14 | 15 | % disorder strengths 16 | NW=1; 17 | Ws=linspace(0.3,22,NW).*0.*J % units of J 18 | Ws=[18] 19 | % tupe of disorder 20 | isQP=1; % 0 = uniform random, 1 = FFT of disorder from exp, 2 = actual QP 21 | 22 | % interaction strengths 23 | Uo=2.7*J % units of J 24 | Us=ones(size(Ws)).*Uo; %make them all the same 25 | Us=linspace(0,10,NW).*J; 26 | 27 | % system size parameters 28 | NPart=8 % number of bosons 29 | NSites=8 % number of sites 30 | 31 | % num of disorders and time scans 32 | ND=7; %disorder number 33 | DisordN=ND 34 | NT=51; % time steps 35 | tau=(1./(2.*pi.*J)); 36 | Ts=linspace(0,1000,NT) %actual times for ED evaluation 37 | Ts=logspace(-1,4,NT).*tau; 38 | % periodic boundary conditions 39 | isPB = 0; % 0 = open boundary; 1 = periodic boundary 40 | jn = 1; % order of neighbor tunnelings 41 | 42 | %% 43 | 44 | % folder for storing all matrix files 45 | folderName = 'Hamiltonians/' 46 | % hamiltonian and basis parameters 47 | edFileName=[folderName sprintf('%i_sites_%i_bosons_%i_pb_%i_jn_loadme.mat',NSites,NPart,isPB,jn)] %format for Hamiltonian filename 48 | 49 | % find hilbert space dimension 50 | HilbD=HilbDim(NSites,NPart) 51 | 52 | % check if we've already made the basis and hamiltonians 53 | if exist(edFileName,'file')==2 54 | % if it exists then load 55 | load(edFileName); 56 | else 57 | % if it doesn't exist then make them all 58 | [Hi,Hj,basis] = MakeHamiltoniansAndBasis(NSites,NPart,jn,isPB); 59 | save(edFileName,'Hi','Hj','basis','NPart','NSites','jn','isPB') 60 | end 61 | 62 | %% 63 | % make giant dataStruct to save wavefunction for all disorders 64 | psiAllW=cell(NW,ND); 65 | 66 | % find initial state in basis 67 | psiInit=zeros(1,HilbD); 68 | psiInit(find(ismember(basis,ones(1,NSites),'rows')==1))=1; 69 | %% 70 | gnPDFStoreStd=zeros(NT,ND,NSites,NW); 71 | gnPDFStoreMAbs=zeros(NT,ND,NSites,NW); 72 | for ww=1:length(Ws) 73 | ww 74 | for dd=1:ND 75 | dd 76 | 77 | %bose hubbard parameters 78 | 79 | %Disorder Hamiltonian 80 | isQP=2; 81 | beta=1.618; 82 | Hd=MakeDisorderHam(basis,isQP,2*pi*dd/ND,beta); 83 | 84 | W=Ws(ww)*J; 85 | %W=2*J; 86 | U=Us(1).*J; 87 | Ham = Hj.*J+Hi.*U+Hd.*W; 88 | 89 | [psiAll, PhiN, En, Cn] = ExactDiagTimeFx(psiInit,Ts,Ham); 90 | 91 | %{ 92 | PhiNSave{ww}=PhiN; 93 | EnSave{ww}=En; 94 | CnSave{ww}=Cn; 95 | %} 96 | 97 | 98 | pdf = abs(psiAll(:,:)).^2; 99 | %NSamp=1E6 100 | %[dataSmpl] = MonteCarloSmp(pdf,tind,NSamp); 101 | 102 | nord=6 103 | inds=1:6 104 | %[sn2k,S2kInds,indsNKStore,corrn,gn] = dynBldGnFxFsPPMap(basis(dataSmpl,:),nord,inds,1) 105 | for tind=1:NT 106 | pn=pdf(:,tind); 107 | %gnDat=gn; 108 | [sn2k,S2kInds,indsNKStore,corrn,gn] = dynBldGnFxFsPPMapPDF(pn,basis,nord,inds,0); 109 | 110 | for nn=1:length(gn) 111 | gnPDFStoreStd(tind,dd,nn,ww)=std(((cell2mat(values(gn{nn}))))); 112 | gnPDFStoreMAbs(tind,dd,nn,ww)=mean(abs((cell2mat(values(gn{nn}))))); 113 | end 114 | end 115 | 116 | 117 | 118 | %[tt,psiAll,Deig]=mbl_8site_function_red(J,U,W,DisordN,NT,isQP); 119 | %{ 120 | TT{ww}=tt; 121 | DeigS{ww}=Deig; 122 | 123 | for dd=1:DisordN 124 | psiAllW{ww,dd}=psiAll{dd}; 125 | end 126 | %} 127 | 128 | end 129 | end 130 | 131 | %% 132 | 133 | figure(11) 134 | for ww=1:length(Ws) 135 | for nn=1:NSites 136 | subplot(2,3,nn) 137 | semilogx(Ts./tau,mean(gnPDFStore(:,:,nn,ww),2)) 138 | hold on 139 | end 140 | end 141 | 142 | %% 143 | 144 | figure(22) 145 | for ww=1 146 | for nn=1:NSites 147 | subplot(2,3,nn) 148 | semilogx(Ts./tau,mean(gnPDFStore(:,:,nn,ww),2)) 149 | hold on 150 | end 151 | end 152 | 153 | %% 154 | %{ 155 | 156 | for ww=1:NW 157 | tempE(ww,:)=EnSave{ww}./J; 158 | gapsW(ww,:)=tempE(ww,2:end)-tempE(ww,1:end-1); 159 | tempC(ww,:)=CnSave{ww}; 160 | pn=tempC(ww,:).^2; 161 | pns(ww,:)=(pn(2:end).*pn(1:end-1)).*4; 162 | HL=round(HilbD/3); 163 | HH=round(HilbD.*2./3); 164 | tempGap=[gapsW(ww,HL:HH+1); gapsW(ww,HL-1:HH)]; 165 | rspec(ww)=mean(min(tempGap,[],1)./max(tempGap,[],1),2); 166 | 167 | [ii,jj]=sort(pn,'descend'); 168 | 169 | end 170 | %} 171 | %% 172 | %load('8site_loadme.mat'); 173 | %% 174 | %{ 175 | nhalf=sum(basis(:,1:size(basis,2)/2),2); 176 | ND=DisordN; 177 | 178 | 179 | Sp=zeros(NT,length(Ws),ND); 180 | SPM=zeros(NT,length(Ws)); 181 | 182 | NS=size(basis,2); 183 | rhon=zeros(NT,NS+1,length(Ws),ND); 184 | nbar=zeros(NS,NT,ND,length(Ws)); 185 | 186 | for ww=1:length(Ws) 187 | for dd=1:ND 188 | rho=abs(psiAllW{ww,dd}).^2; 189 | nbar(:,:,dd,ww)=(rho*basis)'; 190 | 191 | for nn=1:NS+1 192 | indsn=find(nhalf==(nn-1)); 193 | rhon(:,nn,ww,dd)=sum(rho(:,indsn),2); 194 | end 195 | temp=reshape(rhon(:,:,ww,dd),[NT NS+1]); 196 | 197 | Sp(:,ww,dd)=-sum(temp.*log(temp),2); 198 | end 199 | SPM=mean(Sp,3); 200 | nbarM=reshape(mean(nbar,3),[NS,NT,length(Ws)]); 201 | end 202 | %} 203 | 204 | %% 205 | %tj=TT{1}.*J.*2.*pi; 206 | 207 | %cab_corr_red; 208 | 209 | %subSystemsEP_small_half_only; 210 | 211 | %% Correlation length section 212 | %{ 213 | 214 | % Okay so this is looking at the old data 215 | 216 | %NN=size(prSitesW{1},1); 217 | NN=8; 218 | %NS=size(prSitesW{1},2); 219 | NS=9; 220 | NT=size(psiAllW{1},1); 221 | ND=size(psiAllW,2); 222 | % find long time indices 223 | indsLongTime=find(tt.*2.*pi.*J>100); 224 | 225 | 226 | % create g2matrices. Need to redo simulation to keep psi 227 | g2mats=zeros(size(basis,2),size(basis,2),size(basis,1)); 228 | nImats=zeros(size(basis,2),size(basis,2),size(basis,1)); 229 | nJmats=zeros(size(basis,2),size(basis,2),size(basis,1)); 230 | disN=zeros(NSites,size(basis,1)); 231 | g2dMats=zeros(NSites,size(basis,1)); 232 | 233 | for zz=1:size(basis,1) 234 | zz 235 | for ii=1:size(basis,2) 236 | for jj=ii:size(basis,2) 237 | if ii==jj 238 | g2mat(ii,jj,zz)=basis(zz,ii).^2-basis(zz,ii); 239 | 240 | else 241 | g2mat(ii,jj,zz)=basis(zz,ii).*basis(zz,jj); 242 | end 243 | nImat(ii,jj,zz)=basis(zz,ii); 244 | nJmat(ii,jj,zz)=basis(zz,jj); 245 | 246 | dd=abs(ii-jj); 247 | disN(dd+1,zz)=disN(dd+1,zz)+1; 248 | g2dMats(dd+1,zz)=g2mat(ii,jj,zz)+g2dMats(dd+1,zz); 249 | 250 | end 251 | end 252 | end 253 | 254 | 255 | 256 | 257 | %% 258 | tempOp=g2dMats./disN; 259 | 260 | for ww=1:length(Ws) 261 | temp=zeros(size(psiAllW{ww,1})); 262 | ww 263 | %psiAllW{ww,: 264 | 265 | 266 | for dd=1:DisordN 267 | g2dWD{ww,dd}=(abs(psiAllW{ww,dd}).^2)*tempOp'; 268 | temp=temp+abs(psiAllW{ww,dd}).^2; 269 | nbarWD{ww,dd}=(abs(psiAllW{ww,dd}).^2)*basis; 270 | nbar2WD{ww,dd}=(abs(psiAllW{ww,dd}).^2)*(basis.^2); 271 | end 272 | 273 | tempG2=zeros(size(g2dWD{ww,1})); 274 | for dd=1:DisordN 275 | tempG2=g2dWD{ww,dd}+tempG2; 276 | end 277 | tempG2=tempG2./DisordN; 278 | g2dWDMean{ww}=tempG2; 279 | 280 | temp=temp./DisordN; 281 | g2dW{ww}=temp*tempOp' 282 | nbarW{ww}=temp*basis; 283 | nbar2W{ww}=temp*(basis.^2) 284 | end 285 | 286 | %% 287 | 288 | avgRho=cell(length(Ws),1); 289 | for ww=1:length(Ws) 290 | temp=zeros(size(psiAllW{ww,1})); 291 | 292 | for dd=1:DisordN 293 | temp=temp+abs(psiAllW{ww,dd}).^2; 294 | end 295 | avgRho{ww}=temp./DisordN; 296 | end 297 | 298 | 299 | %% 300 | 301 | G2DNt=cell(size(basis,2),length(Ws)); 302 | G2IJN=cell(size(basis,2),length(Ws)); 303 | G2DNW=cell(length(Ws),1); 304 | for ww=1:length(Ws) 305 | ww 306 | temp=zeros(size(basis,2),NT); 307 | for ii=1:size(basis,2) 308 | %for ii=1:size(basis,2)-dd+1 309 | for jj=ii:size(basis,2) 310 | dd=abs(jj-ii)+1 311 | %jj=ii+dd-1; 312 | G2DNt{dd,ww}=[G2DNt{dd,ww}; reshape(g2mat(ii,jj,:),[1 size(basis,1)])*avgRho{ww}';]; 313 | G2IJN{dd,ww}=[G2IJN{dd,ww}; (reshape(nImat(ii,jj,:),[1 size(basis,1)])*avgRho{ww}').*(reshape(nJmat(ii,jj,:),[1 size(basis,1)])*avgRho{ww}');]; 314 | end 315 | %G2DNt{dd,ww}=mean(G2DNt{dd,ww},1); 316 | %G2IJN{dd,ww}=mean(G2IJN{dd,ww},1); 317 | %temp(dd,:)=G2DNt{dd,ww}./G2IJN{dd,ww}; 318 | 319 | G2DNtt{dd,ww}=mean(G2DNt{dd,ww}./G2IJN{dd,ww},1); 320 | G2IJN{dd,ww}=mean(G2IJN{dd,ww},1); 321 | %temp(dd,:)=G2DNt{dd,ww}./G2IJN{dd,ww}; 322 | temp(dd,:)=G2DNtt{dd,ww}; 323 | end 324 | G2DNW{ww}=temp; 325 | end 326 | 327 | 328 | %% 329 | tt=TT{1}; 330 | 331 | czz_un=zeros(NSites,NSites,length(Ws),length(tt)); 332 | czz=zeros(NSites,NSites,length(Ws),length(tt)); 333 | 334 | for ii=1:size(basis,2) 335 | for jj=ii:size(basis,2) 336 | if ii==jj 337 | optr=basis(:,ii).*basis(:,jj)-basis(:,ii); 338 | normrii=basis(:,ii); 339 | normrjj=basis(:,jj); 340 | 341 | else 342 | optr=basis(:,ii).*basis(:,jj); 343 | normrii=basis(:,ii); 344 | normrjj=basis(:,jj); 345 | 346 | end 347 | 348 | for ww=1:length(Ws) 349 | czz(ii,jj,ww,:)=avgRho{ww}*optr-(avgRho{ww}*normrii).*(avgRho{ww}*normrjj); 350 | 351 | czz_un(ii,jj,ww,:)=avgRho{ww}*optr; 352 | 353 | end 354 | 355 | end 356 | end 357 | 358 | %% 359 | czz_r=zeros([size(czz,1) size(czz,4) size(czz,3)]); 360 | for ww=1:length(Ws) 361 | for tti=1:length(tj) 362 | for dd=1:size(czz_r,1) 363 | czz_r(dd,tti,ww)=mean(diag( ... 364 | reshape(czz(:,:,ww,tti),[size(czz_r,1) size(czz_r,1)]), ... 365 | dd-1)); 366 | end 367 | xd(tti,ww)=-sum(czz_r(:,tti,ww).*([0:7]')); 368 | end 369 | end 370 | %% 371 | save('corrzz.mat','czz','czz_r','czz_un','Ws','tj','xd') 372 | xdLow=xd; 373 | tjLow=tj; 374 | WsLow=Ws; 375 | xd100jtLow=xd(67,:); 376 | save('LowWXDat.mat','WsLow','tjLow','xdLow','xd100jtLow') 377 | %} -------------------------------------------------------------------------------- /GnData6Site.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mnrispoli/MATLAB_ED_BHM/ec1770fb3d73d4bb68a50e9ce57889dcbca8c7b9/GnData6Site.mat -------------------------------------------------------------------------------- /Hamiltonians/101_sites_1_bosons_0_pb_1_jn_loadme.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mnrispoli/MATLAB_ED_BHM/ec1770fb3d73d4bb68a50e9ce57889dcbca8c7b9/Hamiltonians/101_sites_1_bosons_0_pb_1_jn_loadme.mat -------------------------------------------------------------------------------- /Hamiltonians/101_sites_1_bosons_1_pb_1_jn_loadme.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mnrispoli/MATLAB_ED_BHM/ec1770fb3d73d4bb68a50e9ce57889dcbca8c7b9/Hamiltonians/101_sites_1_bosons_1_pb_1_jn_loadme.mat -------------------------------------------------------------------------------- /Hamiltonians/10_sites_1_bosons_0_pb_1_jn_loadme.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mnrispoli/MATLAB_ED_BHM/ec1770fb3d73d4bb68a50e9ce57889dcbca8c7b9/Hamiltonians/10_sites_1_bosons_0_pb_1_jn_loadme.mat -------------------------------------------------------------------------------- /Hamiltonians/11_sites_1_bosons_0_pb_1_jn_loadme.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mnrispoli/MATLAB_ED_BHM/ec1770fb3d73d4bb68a50e9ce57889dcbca8c7b9/Hamiltonians/11_sites_1_bosons_0_pb_1_jn_loadme.mat -------------------------------------------------------------------------------- /Hamiltonians/2_sites_2_bosons_0_pb_1_jn_loadme.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mnrispoli/MATLAB_ED_BHM/ec1770fb3d73d4bb68a50e9ce57889dcbca8c7b9/Hamiltonians/2_sites_2_bosons_0_pb_1_jn_loadme.mat -------------------------------------------------------------------------------- /Hamiltonians/2_sites_2_bosons_1_pb_1_jn_loadme.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mnrispoli/MATLAB_ED_BHM/ec1770fb3d73d4bb68a50e9ce57889dcbca8c7b9/Hamiltonians/2_sites_2_bosons_1_pb_1_jn_loadme.mat -------------------------------------------------------------------------------- /Hamiltonians/2_sites_3_bosons_0_pb_1_jn_loadme.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mnrispoli/MATLAB_ED_BHM/ec1770fb3d73d4bb68a50e9ce57889dcbca8c7b9/Hamiltonians/2_sites_3_bosons_0_pb_1_jn_loadme.mat -------------------------------------------------------------------------------- /Hamiltonians/2_sites_3_bosons_1_pb_1_jn_loadme.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mnrispoli/MATLAB_ED_BHM/ec1770fb3d73d4bb68a50e9ce57889dcbca8c7b9/Hamiltonians/2_sites_3_bosons_1_pb_1_jn_loadme.mat -------------------------------------------------------------------------------- /Hamiltonians/2_sites_4_bosons_0_pb_1_jn_loadme.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mnrispoli/MATLAB_ED_BHM/ec1770fb3d73d4bb68a50e9ce57889dcbca8c7b9/Hamiltonians/2_sites_4_bosons_0_pb_1_jn_loadme.mat -------------------------------------------------------------------------------- /Hamiltonians/2_sites_4_bosons_1_pb_1_jn_loadme.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mnrispoli/MATLAB_ED_BHM/ec1770fb3d73d4bb68a50e9ce57889dcbca8c7b9/Hamiltonians/2_sites_4_bosons_1_pb_1_jn_loadme.mat -------------------------------------------------------------------------------- /Hamiltonians/2_sites_5_bosons_0_pb_1_jn_loadme.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mnrispoli/MATLAB_ED_BHM/ec1770fb3d73d4bb68a50e9ce57889dcbca8c7b9/Hamiltonians/2_sites_5_bosons_0_pb_1_jn_loadme.mat -------------------------------------------------------------------------------- /Hamiltonians/2_sites_5_bosons_1_pb_1_jn_loadme.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mnrispoli/MATLAB_ED_BHM/ec1770fb3d73d4bb68a50e9ce57889dcbca8c7b9/Hamiltonians/2_sites_5_bosons_1_pb_1_jn_loadme.mat -------------------------------------------------------------------------------- /Hamiltonians/2_sites_6_bosons_0_pb_1_jn_loadme.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mnrispoli/MATLAB_ED_BHM/ec1770fb3d73d4bb68a50e9ce57889dcbca8c7b9/Hamiltonians/2_sites_6_bosons_0_pb_1_jn_loadme.mat -------------------------------------------------------------------------------- /Hamiltonians/2_sites_6_bosons_1_pb_1_jn_loadme.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mnrispoli/MATLAB_ED_BHM/ec1770fb3d73d4bb68a50e9ce57889dcbca8c7b9/Hamiltonians/2_sites_6_bosons_1_pb_1_jn_loadme.mat -------------------------------------------------------------------------------- /Hamiltonians/2_sites_7_bosons_0_pb_1_jn_loadme.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mnrispoli/MATLAB_ED_BHM/ec1770fb3d73d4bb68a50e9ce57889dcbca8c7b9/Hamiltonians/2_sites_7_bosons_0_pb_1_jn_loadme.mat -------------------------------------------------------------------------------- /Hamiltonians/2_sites_7_bosons_1_pb_1_jn_loadme.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mnrispoli/MATLAB_ED_BHM/ec1770fb3d73d4bb68a50e9ce57889dcbca8c7b9/Hamiltonians/2_sites_7_bosons_1_pb_1_jn_loadme.mat -------------------------------------------------------------------------------- /Hamiltonians/2_sites_8_bosons_0_pb_1_jn_loadme.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mnrispoli/MATLAB_ED_BHM/ec1770fb3d73d4bb68a50e9ce57889dcbca8c7b9/Hamiltonians/2_sites_8_bosons_0_pb_1_jn_loadme.mat -------------------------------------------------------------------------------- /Hamiltonians/2_sites_8_bosons_1_pb_1_jn_loadme.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mnrispoli/MATLAB_ED_BHM/ec1770fb3d73d4bb68a50e9ce57889dcbca8c7b9/Hamiltonians/2_sites_8_bosons_1_pb_1_jn_loadme.mat -------------------------------------------------------------------------------- /Hamiltonians/31_sites_1_bosons_0_pb_1_jn_loadme.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mnrispoli/MATLAB_ED_BHM/ec1770fb3d73d4bb68a50e9ce57889dcbca8c7b9/Hamiltonians/31_sites_1_bosons_0_pb_1_jn_loadme.mat -------------------------------------------------------------------------------- /Hamiltonians/3_sites_2_bosons_0_pb_1_jn_loadme.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mnrispoli/MATLAB_ED_BHM/ec1770fb3d73d4bb68a50e9ce57889dcbca8c7b9/Hamiltonians/3_sites_2_bosons_0_pb_1_jn_loadme.mat -------------------------------------------------------------------------------- /Hamiltonians/3_sites_2_bosons_1_pb_1_jn_loadme.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mnrispoli/MATLAB_ED_BHM/ec1770fb3d73d4bb68a50e9ce57889dcbca8c7b9/Hamiltonians/3_sites_2_bosons_1_pb_1_jn_loadme.mat -------------------------------------------------------------------------------- /Hamiltonians/3_sites_3_bosons_0_pb_1_jn_loadme.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mnrispoli/MATLAB_ED_BHM/ec1770fb3d73d4bb68a50e9ce57889dcbca8c7b9/Hamiltonians/3_sites_3_bosons_0_pb_1_jn_loadme.mat -------------------------------------------------------------------------------- /Hamiltonians/3_sites_3_bosons_1_pb_1_jn_loadme.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mnrispoli/MATLAB_ED_BHM/ec1770fb3d73d4bb68a50e9ce57889dcbca8c7b9/Hamiltonians/3_sites_3_bosons_1_pb_1_jn_loadme.mat -------------------------------------------------------------------------------- /Hamiltonians/3_sites_4_bosons_0_pb_1_jn_loadme.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mnrispoli/MATLAB_ED_BHM/ec1770fb3d73d4bb68a50e9ce57889dcbca8c7b9/Hamiltonians/3_sites_4_bosons_0_pb_1_jn_loadme.mat -------------------------------------------------------------------------------- /Hamiltonians/3_sites_4_bosons_1_pb_1_jn_loadme.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mnrispoli/MATLAB_ED_BHM/ec1770fb3d73d4bb68a50e9ce57889dcbca8c7b9/Hamiltonians/3_sites_4_bosons_1_pb_1_jn_loadme.mat -------------------------------------------------------------------------------- /Hamiltonians/3_sites_5_bosons_0_pb_1_jn_loadme.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mnrispoli/MATLAB_ED_BHM/ec1770fb3d73d4bb68a50e9ce57889dcbca8c7b9/Hamiltonians/3_sites_5_bosons_0_pb_1_jn_loadme.mat -------------------------------------------------------------------------------- /Hamiltonians/3_sites_5_bosons_1_pb_1_jn_loadme.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mnrispoli/MATLAB_ED_BHM/ec1770fb3d73d4bb68a50e9ce57889dcbca8c7b9/Hamiltonians/3_sites_5_bosons_1_pb_1_jn_loadme.mat -------------------------------------------------------------------------------- /Hamiltonians/3_sites_6_bosons_0_pb_1_jn_loadme.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mnrispoli/MATLAB_ED_BHM/ec1770fb3d73d4bb68a50e9ce57889dcbca8c7b9/Hamiltonians/3_sites_6_bosons_0_pb_1_jn_loadme.mat -------------------------------------------------------------------------------- /Hamiltonians/3_sites_6_bosons_1_pb_1_jn_loadme.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mnrispoli/MATLAB_ED_BHM/ec1770fb3d73d4bb68a50e9ce57889dcbca8c7b9/Hamiltonians/3_sites_6_bosons_1_pb_1_jn_loadme.mat -------------------------------------------------------------------------------- /Hamiltonians/3_sites_7_bosons_0_pb_1_jn_loadme.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mnrispoli/MATLAB_ED_BHM/ec1770fb3d73d4bb68a50e9ce57889dcbca8c7b9/Hamiltonians/3_sites_7_bosons_0_pb_1_jn_loadme.mat -------------------------------------------------------------------------------- /Hamiltonians/3_sites_7_bosons_1_pb_1_jn_loadme.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mnrispoli/MATLAB_ED_BHM/ec1770fb3d73d4bb68a50e9ce57889dcbca8c7b9/Hamiltonians/3_sites_7_bosons_1_pb_1_jn_loadme.mat -------------------------------------------------------------------------------- /Hamiltonians/3_sites_8_bosons_0_pb_1_jn_loadme.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mnrispoli/MATLAB_ED_BHM/ec1770fb3d73d4bb68a50e9ce57889dcbca8c7b9/Hamiltonians/3_sites_8_bosons_0_pb_1_jn_loadme.mat -------------------------------------------------------------------------------- /Hamiltonians/3_sites_8_bosons_1_pb_1_jn_loadme.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mnrispoli/MATLAB_ED_BHM/ec1770fb3d73d4bb68a50e9ce57889dcbca8c7b9/Hamiltonians/3_sites_8_bosons_1_pb_1_jn_loadme.mat -------------------------------------------------------------------------------- /Hamiltonians/4_sites_2_bosons_0_pb_1_jn_loadme.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mnrispoli/MATLAB_ED_BHM/ec1770fb3d73d4bb68a50e9ce57889dcbca8c7b9/Hamiltonians/4_sites_2_bosons_0_pb_1_jn_loadme.mat -------------------------------------------------------------------------------- /Hamiltonians/4_sites_2_bosons_1_pb_1_jn_loadme.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mnrispoli/MATLAB_ED_BHM/ec1770fb3d73d4bb68a50e9ce57889dcbca8c7b9/Hamiltonians/4_sites_2_bosons_1_pb_1_jn_loadme.mat -------------------------------------------------------------------------------- /Hamiltonians/4_sites_3_bosons_0_pb_1_jn_loadme.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mnrispoli/MATLAB_ED_BHM/ec1770fb3d73d4bb68a50e9ce57889dcbca8c7b9/Hamiltonians/4_sites_3_bosons_0_pb_1_jn_loadme.mat -------------------------------------------------------------------------------- /Hamiltonians/4_sites_3_bosons_1_pb_1_jn_loadme.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mnrispoli/MATLAB_ED_BHM/ec1770fb3d73d4bb68a50e9ce57889dcbca8c7b9/Hamiltonians/4_sites_3_bosons_1_pb_1_jn_loadme.mat -------------------------------------------------------------------------------- /Hamiltonians/4_sites_4_bosons_0_pb_1_jn_loadme.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mnrispoli/MATLAB_ED_BHM/ec1770fb3d73d4bb68a50e9ce57889dcbca8c7b9/Hamiltonians/4_sites_4_bosons_0_pb_1_jn_loadme.mat -------------------------------------------------------------------------------- /Hamiltonians/4_sites_4_bosons_1_pb_1_jn_loadme.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mnrispoli/MATLAB_ED_BHM/ec1770fb3d73d4bb68a50e9ce57889dcbca8c7b9/Hamiltonians/4_sites_4_bosons_1_pb_1_jn_loadme.mat -------------------------------------------------------------------------------- /Hamiltonians/4_sites_5_bosons_0_pb_1_jn_loadme.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mnrispoli/MATLAB_ED_BHM/ec1770fb3d73d4bb68a50e9ce57889dcbca8c7b9/Hamiltonians/4_sites_5_bosons_0_pb_1_jn_loadme.mat -------------------------------------------------------------------------------- /Hamiltonians/4_sites_5_bosons_1_pb_1_jn_loadme.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mnrispoli/MATLAB_ED_BHM/ec1770fb3d73d4bb68a50e9ce57889dcbca8c7b9/Hamiltonians/4_sites_5_bosons_1_pb_1_jn_loadme.mat -------------------------------------------------------------------------------- /Hamiltonians/4_sites_6_bosons_0_pb_1_jn_loadme.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mnrispoli/MATLAB_ED_BHM/ec1770fb3d73d4bb68a50e9ce57889dcbca8c7b9/Hamiltonians/4_sites_6_bosons_0_pb_1_jn_loadme.mat -------------------------------------------------------------------------------- /Hamiltonians/4_sites_6_bosons_1_pb_1_jn_loadme.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mnrispoli/MATLAB_ED_BHM/ec1770fb3d73d4bb68a50e9ce57889dcbca8c7b9/Hamiltonians/4_sites_6_bosons_1_pb_1_jn_loadme.mat -------------------------------------------------------------------------------- /Hamiltonians/4_sites_7_bosons_0_pb_1_jn_loadme.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mnrispoli/MATLAB_ED_BHM/ec1770fb3d73d4bb68a50e9ce57889dcbca8c7b9/Hamiltonians/4_sites_7_bosons_0_pb_1_jn_loadme.mat -------------------------------------------------------------------------------- /Hamiltonians/4_sites_7_bosons_1_pb_1_jn_loadme.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mnrispoli/MATLAB_ED_BHM/ec1770fb3d73d4bb68a50e9ce57889dcbca8c7b9/Hamiltonians/4_sites_7_bosons_1_pb_1_jn_loadme.mat -------------------------------------------------------------------------------- /Hamiltonians/4_sites_8_bosons_0_pb_1_jn_loadme.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mnrispoli/MATLAB_ED_BHM/ec1770fb3d73d4bb68a50e9ce57889dcbca8c7b9/Hamiltonians/4_sites_8_bosons_0_pb_1_jn_loadme.mat -------------------------------------------------------------------------------- /Hamiltonians/4_sites_8_bosons_1_pb_1_jn_loadme.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mnrispoli/MATLAB_ED_BHM/ec1770fb3d73d4bb68a50e9ce57889dcbca8c7b9/Hamiltonians/4_sites_8_bosons_1_pb_1_jn_loadme.mat -------------------------------------------------------------------------------- /Hamiltonians/51_sites_1_bosons_1_pb_1_jn_loadme.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mnrispoli/MATLAB_ED_BHM/ec1770fb3d73d4bb68a50e9ce57889dcbca8c7b9/Hamiltonians/51_sites_1_bosons_1_pb_1_jn_loadme.mat -------------------------------------------------------------------------------- /Hamiltonians/5_sites_2_bosons_0_pb_1_jn_loadme.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mnrispoli/MATLAB_ED_BHM/ec1770fb3d73d4bb68a50e9ce57889dcbca8c7b9/Hamiltonians/5_sites_2_bosons_0_pb_1_jn_loadme.mat -------------------------------------------------------------------------------- /Hamiltonians/5_sites_2_bosons_1_pb_1_jn_loadme.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mnrispoli/MATLAB_ED_BHM/ec1770fb3d73d4bb68a50e9ce57889dcbca8c7b9/Hamiltonians/5_sites_2_bosons_1_pb_1_jn_loadme.mat -------------------------------------------------------------------------------- /Hamiltonians/5_sites_3_bosons_0_pb_1_jn_loadme.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mnrispoli/MATLAB_ED_BHM/ec1770fb3d73d4bb68a50e9ce57889dcbca8c7b9/Hamiltonians/5_sites_3_bosons_0_pb_1_jn_loadme.mat -------------------------------------------------------------------------------- /Hamiltonians/5_sites_3_bosons_1_pb_1_jn_loadme.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mnrispoli/MATLAB_ED_BHM/ec1770fb3d73d4bb68a50e9ce57889dcbca8c7b9/Hamiltonians/5_sites_3_bosons_1_pb_1_jn_loadme.mat -------------------------------------------------------------------------------- /Hamiltonians/5_sites_4_bosons_0_pb_1_jn_loadme.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mnrispoli/MATLAB_ED_BHM/ec1770fb3d73d4bb68a50e9ce57889dcbca8c7b9/Hamiltonians/5_sites_4_bosons_0_pb_1_jn_loadme.mat -------------------------------------------------------------------------------- /Hamiltonians/5_sites_4_bosons_1_pb_1_jn_loadme.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mnrispoli/MATLAB_ED_BHM/ec1770fb3d73d4bb68a50e9ce57889dcbca8c7b9/Hamiltonians/5_sites_4_bosons_1_pb_1_jn_loadme.mat -------------------------------------------------------------------------------- /Hamiltonians/5_sites_5_bosons_0_pb_1_jn_loadme.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mnrispoli/MATLAB_ED_BHM/ec1770fb3d73d4bb68a50e9ce57889dcbca8c7b9/Hamiltonians/5_sites_5_bosons_0_pb_1_jn_loadme.mat -------------------------------------------------------------------------------- /Hamiltonians/5_sites_5_bosons_1_pb_1_jn_loadme.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mnrispoli/MATLAB_ED_BHM/ec1770fb3d73d4bb68a50e9ce57889dcbca8c7b9/Hamiltonians/5_sites_5_bosons_1_pb_1_jn_loadme.mat -------------------------------------------------------------------------------- /Hamiltonians/5_sites_6_bosons_0_pb_1_jn_loadme.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mnrispoli/MATLAB_ED_BHM/ec1770fb3d73d4bb68a50e9ce57889dcbca8c7b9/Hamiltonians/5_sites_6_bosons_0_pb_1_jn_loadme.mat -------------------------------------------------------------------------------- /Hamiltonians/5_sites_6_bosons_1_pb_1_jn_loadme.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mnrispoli/MATLAB_ED_BHM/ec1770fb3d73d4bb68a50e9ce57889dcbca8c7b9/Hamiltonians/5_sites_6_bosons_1_pb_1_jn_loadme.mat -------------------------------------------------------------------------------- /Hamiltonians/5_sites_7_bosons_0_pb_1_jn_loadme.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mnrispoli/MATLAB_ED_BHM/ec1770fb3d73d4bb68a50e9ce57889dcbca8c7b9/Hamiltonians/5_sites_7_bosons_0_pb_1_jn_loadme.mat -------------------------------------------------------------------------------- /Hamiltonians/5_sites_7_bosons_1_pb_1_jn_loadme.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mnrispoli/MATLAB_ED_BHM/ec1770fb3d73d4bb68a50e9ce57889dcbca8c7b9/Hamiltonians/5_sites_7_bosons_1_pb_1_jn_loadme.mat -------------------------------------------------------------------------------- /Hamiltonians/5_sites_8_bosons_0_pb_1_jn_loadme.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mnrispoli/MATLAB_ED_BHM/ec1770fb3d73d4bb68a50e9ce57889dcbca8c7b9/Hamiltonians/5_sites_8_bosons_0_pb_1_jn_loadme.mat -------------------------------------------------------------------------------- /Hamiltonians/5_sites_8_bosons_1_pb_1_jn_loadme.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mnrispoli/MATLAB_ED_BHM/ec1770fb3d73d4bb68a50e9ce57889dcbca8c7b9/Hamiltonians/5_sites_8_bosons_1_pb_1_jn_loadme.mat -------------------------------------------------------------------------------- /Hamiltonians/6_sites_2_bosons_0_pb_1_jn_loadme.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mnrispoli/MATLAB_ED_BHM/ec1770fb3d73d4bb68a50e9ce57889dcbca8c7b9/Hamiltonians/6_sites_2_bosons_0_pb_1_jn_loadme.mat -------------------------------------------------------------------------------- /Hamiltonians/6_sites_2_bosons_1_pb_1_jn_loadme.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mnrispoli/MATLAB_ED_BHM/ec1770fb3d73d4bb68a50e9ce57889dcbca8c7b9/Hamiltonians/6_sites_2_bosons_1_pb_1_jn_loadme.mat -------------------------------------------------------------------------------- /Hamiltonians/6_sites_3_bosons_0_pb_1_jn_loadme.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mnrispoli/MATLAB_ED_BHM/ec1770fb3d73d4bb68a50e9ce57889dcbca8c7b9/Hamiltonians/6_sites_3_bosons_0_pb_1_jn_loadme.mat -------------------------------------------------------------------------------- /Hamiltonians/6_sites_3_bosons_1_pb_1_jn_loadme.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mnrispoli/MATLAB_ED_BHM/ec1770fb3d73d4bb68a50e9ce57889dcbca8c7b9/Hamiltonians/6_sites_3_bosons_1_pb_1_jn_loadme.mat -------------------------------------------------------------------------------- /Hamiltonians/6_sites_4_bosons_0_pb_1_jn_loadme.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mnrispoli/MATLAB_ED_BHM/ec1770fb3d73d4bb68a50e9ce57889dcbca8c7b9/Hamiltonians/6_sites_4_bosons_0_pb_1_jn_loadme.mat -------------------------------------------------------------------------------- /Hamiltonians/6_sites_4_bosons_1_pb_1_jn_loadme.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mnrispoli/MATLAB_ED_BHM/ec1770fb3d73d4bb68a50e9ce57889dcbca8c7b9/Hamiltonians/6_sites_4_bosons_1_pb_1_jn_loadme.mat -------------------------------------------------------------------------------- /Hamiltonians/6_sites_5_bosons_0_pb_1_jn_loadme.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mnrispoli/MATLAB_ED_BHM/ec1770fb3d73d4bb68a50e9ce57889dcbca8c7b9/Hamiltonians/6_sites_5_bosons_0_pb_1_jn_loadme.mat -------------------------------------------------------------------------------- /Hamiltonians/6_sites_5_bosons_1_pb_1_jn_loadme.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mnrispoli/MATLAB_ED_BHM/ec1770fb3d73d4bb68a50e9ce57889dcbca8c7b9/Hamiltonians/6_sites_5_bosons_1_pb_1_jn_loadme.mat -------------------------------------------------------------------------------- /Hamiltonians/6_sites_6_bosons_0_pb_1_jn_loadme.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mnrispoli/MATLAB_ED_BHM/ec1770fb3d73d4bb68a50e9ce57889dcbca8c7b9/Hamiltonians/6_sites_6_bosons_0_pb_1_jn_loadme.mat -------------------------------------------------------------------------------- /Hamiltonians/6_sites_6_bosons_1_pb_1_jn_loadme.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mnrispoli/MATLAB_ED_BHM/ec1770fb3d73d4bb68a50e9ce57889dcbca8c7b9/Hamiltonians/6_sites_6_bosons_1_pb_1_jn_loadme.mat -------------------------------------------------------------------------------- /Hamiltonians/6_sites_7_bosons_0_pb_1_jn_loadme.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mnrispoli/MATLAB_ED_BHM/ec1770fb3d73d4bb68a50e9ce57889dcbca8c7b9/Hamiltonians/6_sites_7_bosons_0_pb_1_jn_loadme.mat -------------------------------------------------------------------------------- /Hamiltonians/6_sites_7_bosons_1_pb_1_jn_loadme.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mnrispoli/MATLAB_ED_BHM/ec1770fb3d73d4bb68a50e9ce57889dcbca8c7b9/Hamiltonians/6_sites_7_bosons_1_pb_1_jn_loadme.mat -------------------------------------------------------------------------------- /Hamiltonians/6_sites_8_bosons_0_pb_1_jn_loadme.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mnrispoli/MATLAB_ED_BHM/ec1770fb3d73d4bb68a50e9ce57889dcbca8c7b9/Hamiltonians/6_sites_8_bosons_0_pb_1_jn_loadme.mat -------------------------------------------------------------------------------- /Hamiltonians/6_sites_8_bosons_1_pb_1_jn_loadme.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mnrispoli/MATLAB_ED_BHM/ec1770fb3d73d4bb68a50e9ce57889dcbca8c7b9/Hamiltonians/6_sites_8_bosons_1_pb_1_jn_loadme.mat -------------------------------------------------------------------------------- /Hamiltonians/7_sites_2_bosons_0_pb_1_jn_loadme.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mnrispoli/MATLAB_ED_BHM/ec1770fb3d73d4bb68a50e9ce57889dcbca8c7b9/Hamiltonians/7_sites_2_bosons_0_pb_1_jn_loadme.mat -------------------------------------------------------------------------------- /Hamiltonians/7_sites_2_bosons_1_pb_1_jn_loadme.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mnrispoli/MATLAB_ED_BHM/ec1770fb3d73d4bb68a50e9ce57889dcbca8c7b9/Hamiltonians/7_sites_2_bosons_1_pb_1_jn_loadme.mat -------------------------------------------------------------------------------- /Hamiltonians/7_sites_3_bosons_0_pb_1_jn_loadme.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mnrispoli/MATLAB_ED_BHM/ec1770fb3d73d4bb68a50e9ce57889dcbca8c7b9/Hamiltonians/7_sites_3_bosons_0_pb_1_jn_loadme.mat -------------------------------------------------------------------------------- /Hamiltonians/7_sites_3_bosons_1_pb_1_jn_loadme.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mnrispoli/MATLAB_ED_BHM/ec1770fb3d73d4bb68a50e9ce57889dcbca8c7b9/Hamiltonians/7_sites_3_bosons_1_pb_1_jn_loadme.mat -------------------------------------------------------------------------------- /Hamiltonians/7_sites_4_bosons_0_pb_1_jn_loadme.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mnrispoli/MATLAB_ED_BHM/ec1770fb3d73d4bb68a50e9ce57889dcbca8c7b9/Hamiltonians/7_sites_4_bosons_0_pb_1_jn_loadme.mat -------------------------------------------------------------------------------- /Hamiltonians/7_sites_4_bosons_1_pb_1_jn_loadme.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mnrispoli/MATLAB_ED_BHM/ec1770fb3d73d4bb68a50e9ce57889dcbca8c7b9/Hamiltonians/7_sites_4_bosons_1_pb_1_jn_loadme.mat -------------------------------------------------------------------------------- /Hamiltonians/7_sites_5_bosons_0_pb_1_jn_loadme.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mnrispoli/MATLAB_ED_BHM/ec1770fb3d73d4bb68a50e9ce57889dcbca8c7b9/Hamiltonians/7_sites_5_bosons_0_pb_1_jn_loadme.mat -------------------------------------------------------------------------------- /Hamiltonians/7_sites_5_bosons_1_pb_1_jn_loadme.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mnrispoli/MATLAB_ED_BHM/ec1770fb3d73d4bb68a50e9ce57889dcbca8c7b9/Hamiltonians/7_sites_5_bosons_1_pb_1_jn_loadme.mat -------------------------------------------------------------------------------- /Hamiltonians/7_sites_6_bosons_0_pb_1_jn_loadme.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mnrispoli/MATLAB_ED_BHM/ec1770fb3d73d4bb68a50e9ce57889dcbca8c7b9/Hamiltonians/7_sites_6_bosons_0_pb_1_jn_loadme.mat -------------------------------------------------------------------------------- /Hamiltonians/7_sites_6_bosons_1_pb_1_jn_loadme.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mnrispoli/MATLAB_ED_BHM/ec1770fb3d73d4bb68a50e9ce57889dcbca8c7b9/Hamiltonians/7_sites_6_bosons_1_pb_1_jn_loadme.mat -------------------------------------------------------------------------------- /Hamiltonians/7_sites_7_bosons_0_pb_1_jn_loadme.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mnrispoli/MATLAB_ED_BHM/ec1770fb3d73d4bb68a50e9ce57889dcbca8c7b9/Hamiltonians/7_sites_7_bosons_0_pb_1_jn_loadme.mat -------------------------------------------------------------------------------- /Hamiltonians/7_sites_7_bosons_1_pb_1_jn_loadme.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mnrispoli/MATLAB_ED_BHM/ec1770fb3d73d4bb68a50e9ce57889dcbca8c7b9/Hamiltonians/7_sites_7_bosons_1_pb_1_jn_loadme.mat -------------------------------------------------------------------------------- /Hamiltonians/7_sites_8_bosons_0_pb_1_jn_loadme.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mnrispoli/MATLAB_ED_BHM/ec1770fb3d73d4bb68a50e9ce57889dcbca8c7b9/Hamiltonians/7_sites_8_bosons_0_pb_1_jn_loadme.mat -------------------------------------------------------------------------------- /Hamiltonians/7_sites_8_bosons_1_pb_1_jn_loadme.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mnrispoli/MATLAB_ED_BHM/ec1770fb3d73d4bb68a50e9ce57889dcbca8c7b9/Hamiltonians/7_sites_8_bosons_1_pb_1_jn_loadme.mat -------------------------------------------------------------------------------- /Hamiltonians/8_sites_2_bosons_0_pb_1_jn_loadme.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mnrispoli/MATLAB_ED_BHM/ec1770fb3d73d4bb68a50e9ce57889dcbca8c7b9/Hamiltonians/8_sites_2_bosons_0_pb_1_jn_loadme.mat -------------------------------------------------------------------------------- /Hamiltonians/8_sites_2_bosons_1_pb_1_jn_loadme.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mnrispoli/MATLAB_ED_BHM/ec1770fb3d73d4bb68a50e9ce57889dcbca8c7b9/Hamiltonians/8_sites_2_bosons_1_pb_1_jn_loadme.mat -------------------------------------------------------------------------------- /Hamiltonians/8_sites_3_bosons_0_pb_1_jn_loadme.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mnrispoli/MATLAB_ED_BHM/ec1770fb3d73d4bb68a50e9ce57889dcbca8c7b9/Hamiltonians/8_sites_3_bosons_0_pb_1_jn_loadme.mat -------------------------------------------------------------------------------- /Hamiltonians/8_sites_3_bosons_1_pb_1_jn_loadme.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mnrispoli/MATLAB_ED_BHM/ec1770fb3d73d4bb68a50e9ce57889dcbca8c7b9/Hamiltonians/8_sites_3_bosons_1_pb_1_jn_loadme.mat -------------------------------------------------------------------------------- /Hamiltonians/8_sites_4_bosons_0_pb_1_jn_loadme.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mnrispoli/MATLAB_ED_BHM/ec1770fb3d73d4bb68a50e9ce57889dcbca8c7b9/Hamiltonians/8_sites_4_bosons_0_pb_1_jn_loadme.mat -------------------------------------------------------------------------------- /Hamiltonians/8_sites_4_bosons_1_pb_1_jn_loadme.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mnrispoli/MATLAB_ED_BHM/ec1770fb3d73d4bb68a50e9ce57889dcbca8c7b9/Hamiltonians/8_sites_4_bosons_1_pb_1_jn_loadme.mat -------------------------------------------------------------------------------- /Hamiltonians/8_sites_5_bosons_0_pb_1_jn_loadme.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mnrispoli/MATLAB_ED_BHM/ec1770fb3d73d4bb68a50e9ce57889dcbca8c7b9/Hamiltonians/8_sites_5_bosons_0_pb_1_jn_loadme.mat -------------------------------------------------------------------------------- /Hamiltonians/8_sites_5_bosons_1_pb_1_jn_loadme.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mnrispoli/MATLAB_ED_BHM/ec1770fb3d73d4bb68a50e9ce57889dcbca8c7b9/Hamiltonians/8_sites_5_bosons_1_pb_1_jn_loadme.mat -------------------------------------------------------------------------------- /Hamiltonians/8_sites_6_bosons_0_pb_1_jn_loadme.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mnrispoli/MATLAB_ED_BHM/ec1770fb3d73d4bb68a50e9ce57889dcbca8c7b9/Hamiltonians/8_sites_6_bosons_0_pb_1_jn_loadme.mat -------------------------------------------------------------------------------- /Hamiltonians/8_sites_6_bosons_1_pb_1_jn_loadme.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mnrispoli/MATLAB_ED_BHM/ec1770fb3d73d4bb68a50e9ce57889dcbca8c7b9/Hamiltonians/8_sites_6_bosons_1_pb_1_jn_loadme.mat -------------------------------------------------------------------------------- /Hamiltonians/8_sites_7_bosons_0_pb_1_jn_loadme.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mnrispoli/MATLAB_ED_BHM/ec1770fb3d73d4bb68a50e9ce57889dcbca8c7b9/Hamiltonians/8_sites_7_bosons_0_pb_1_jn_loadme.mat -------------------------------------------------------------------------------- /Hamiltonians/8_sites_7_bosons_1_pb_1_jn_loadme.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mnrispoli/MATLAB_ED_BHM/ec1770fb3d73d4bb68a50e9ce57889dcbca8c7b9/Hamiltonians/8_sites_7_bosons_1_pb_1_jn_loadme.mat -------------------------------------------------------------------------------- /Hamiltonians/8_sites_8_bosons_0_pb_1_jn_loadme.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mnrispoli/MATLAB_ED_BHM/ec1770fb3d73d4bb68a50e9ce57889dcbca8c7b9/Hamiltonians/8_sites_8_bosons_0_pb_1_jn_loadme.mat -------------------------------------------------------------------------------- /Hamiltonians/8_sites_8_bosons_1_pb_1_jn_loadme.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mnrispoli/MATLAB_ED_BHM/ec1770fb3d73d4bb68a50e9ce57889dcbca8c7b9/Hamiltonians/8_sites_8_bosons_1_pb_1_jn_loadme.mat -------------------------------------------------------------------------------- /Hamiltonians/ExpDisorder.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mnrispoli/MATLAB_ED_BHM/ec1770fb3d73d4bb68a50e9ce57889dcbca8c7b9/Hamiltonians/ExpDisorder.mat -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # MATLAB_ED_BHM 2 | 3 | This project compiles some functions written in MATLAB and are used for exact diagonalization simulation of 1D, bose-hubbard systems to compare with exeperiments of bosonic atoms in optical lattices in quantum gas microscopes. Note that this then implies all simulations performed by the basic functions in this code are inherently for closed systems since they will have only unitary dynamics. 4 | 5 | 6 | 7 | ## Example Script for single-particle physics 8 | 9 | ### andersonLocalizationScript.m 10 | 11 | Uses exact diagonalization functions to compare single-particle localization in the bose-hubbard model for varius disorders strength and types. 12 | 13 | ![IPR of andrson localiation](https://github.com/mnrispoli/MATLAB_ED_BHM/blob/master/imgs_for_readme/AL_IPR.PNG) 14 | 15 | ## Example Script for many-body physics 16 | 17 | ### manybodyLocalizationScript.m 18 | 19 | Uses exact diagonalization functions to compare many-body localization in the bose-hubbard model for varius disorders strengths, types, and interactions. 20 | 21 | [ ] Add larger system size comparisons 22 | 23 | [ ] Add many-body to anderson localization comparisons 24 | 25 | 26 | 27 | ## Contained Functions/Uses 28 | 29 | [ ] Add n-point correlation functions to be called 30 | 31 | [ ] Add monte-carlo sampling for fast and comparable data sampling 32 | 33 | ### BasisMake.m 34 | 35 | This efficiently constructs the bose-hubbard basis states for a given number of particles "NPart" and number of lattice sites "NSites" 36 | 37 | ### cabFx.m 38 | 39 | This calcultes the configurational correlation function for a many-body state in a bose-hubbard system projected onto the Fock state basis. For details of physical use and importance look in SI of https://arxiv.org/abs/1805.09819 40 | 41 | ### DensityEval.m 42 | 43 | Returns the on-site density average and on-site density variance from the wave function evaluated. 44 | 45 | ### ExactDiagTimeFx.m 46 | 47 | Input of the initial state, evaluation times, and hamiltonian to compute exact diagonalization for efficient calculation of long-time dynamics and eigenstates. Output is time evolved wave function, eigenstates, and eigenenergies. 48 | 49 | ### FindTunnelingTerms.m 50 | 51 | Deprecated function 52 | 53 | ### HilbDim.m 54 | 55 | Returns hilbert space dimension from number of particles (NPart) and sites (NSites) in the bose-hubbard hamiltonian 56 | 57 | ### MakeDisorderHam.m 58 | 59 | Constructs the disorder hamiltonian given different desired disorder distributions and basis states. 60 | 61 | ### MakeHamiltoniansAndBasis.m 62 | 63 | If it doesn't already exist, this computes the interaction and tunneling hamiltonian matrices for a given bose-hubbard 1-D system given number of lattice sites, number of particles, boundary conditions, and tunneling (nearest neighbor, next-nearest neighbor, etc.). 64 | 65 | ## Hamiltonians 66 | 67 | This simply saves all previously constructed hamiltonians to save time for future exact diagonalization calculations 68 | -------------------------------------------------------------------------------- /andersonLocalizationScript.m: -------------------------------------------------------------------------------- 1 | % general ED bose-hubbard code 2 | % last cleaned up 9/24/2018 3 | % author: Matthew Rispoli 4 | 5 | close all 6 | clear all 7 | clc 8 | 9 | addpath('functions'); 10 | %load('plot_colormaps\alex_cmap.mat'); 11 | %cmapAlex=ccs; clear ccs; 12 | 13 | % tunneling 14 | J=38.1911/1000; %8Er tunneling rate; defined in Hz/(2 pi) 15 | 16 | % disorder strengths 17 | NW=100; 18 | Ws=linspace(0,4,NW).*J % units of J 19 | % tupe of disorder 20 | isQP=1; % 0 = uniform random, 1 = FFT of disorder from exp, 2 = actual QP 21 | NB=500; 22 | BetaS=linspace(1,2,NB); 23 | 24 | 25 | % interaction strengths 26 | Uo=2.7*J % units of J 27 | Us=ones(size(Ws)).*Uo; %make them all the same 28 | 29 | 30 | % system size parameters 31 | NPart=1 % number of bosons 32 | NSites=51 % number of sites 33 | 34 | % num of disorders and time scans 35 | ND=99; %disorder number 36 | NT=3; % time steps 37 | Ts=linspace(0,420,NT) %actual times for ED evaluation 38 | 39 | % periodic boundary conditions 40 | isPB = 1; % 0 = open boundary; 1 = periodic boundary 41 | jn = 1; % order of neighbor tunnelings 42 | 43 | %% 44 | 45 | % folder for storing all matrix files 46 | folderName = 'Hamiltonians/' 47 | % hamiltonian and basis parameters 48 | edFileName=[folderName sprintf('%i_sites_%i_bosons_%i_pb_%i_jn_loadme.mat',NSites,NPart,isPB,jn)] %format for Hamiltonian filename 49 | 50 | % find hilbert space dimension 51 | HilbD=HilbDim(NSites,NPart) 52 | 53 | % check if we've already made the basis and hamiltonians 54 | if exist(edFileName,'file')==2 55 | % if it exists then load 56 | load(edFileName); 57 | else 58 | % if it doesn't exist then make them all 59 | [Hi,Hj,basis] = MakeHamiltoniansAndBasis(NSites,NPart,jn,isPB); 60 | save(edFileName,'Hi','Hj','basis','NPart','NSites','jn','isPB') 61 | end 62 | 63 | %% 64 | % make giant dataStruct to save wavefunction for all disorders 65 | psiAllSave=cell(NW,ND,NB); 66 | nbarAllSave=cell(NW,ND,NB); 67 | IPRSave=zeros(NW,ND,NB); 68 | 69 | % find initial state in basis 70 | psiInit=zeros(1,HilbD); 71 | 72 | indInit = floor(NSites/2); %single-particle initial state 73 | %indInit = find(ismember(basis,ones(1,NSites),'rows')==1) % uniform density initial state 74 | psiInit(indInit) = 1; 75 | 76 | 77 | %% Dynamics from ED 78 | for ww=1:NW 79 | ww 80 | for dd=1:ND 81 | for bb=1:NB 82 | 83 | 84 | %bose hubbard parameters 85 | W=Ws(ww); 86 | U=Us(ww); 87 | 88 | %Disorder Hamiltonian 89 | isQP=2; 90 | beta=BetaS(bb); 91 | Hd=MakeDisorderHam(basis,isQP,2*pi*dd/ND,beta); 92 | 93 | Ham=J.*Hj+(U/2).*Hi+W.*Hd; 94 | try 95 | [psiAll, PhiN, En] = ExactDiagTimeFx(psiInit,Ts,Ham); 96 | catch 97 | %incase diagonalization fails it tries again with new phase 98 | Hd=MakeDisorderHam(basis,isQP,2*pi*dd/ND+0.1,beta); 99 | Ham=J.*Hj+(U/2).*Hi+W.*Hd; 100 | [psiAll, PhiN, En] = ExactDiagTimeFx(psiInit,Ts,Ham); 101 | end 102 | 103 | %save psi's from all parameters 104 | %psiAllSave{ww,dd,bb}=psiAll; 105 | 106 | %evaluate for on-site density, variance, and fluctuations 107 | [nbar,nvar,nfluc]=DensityEval(psiAll,basis); 108 | 109 | %save density stuff 110 | nbarAllSave{ww,dd,bb}=nbar; 111 | %inverse participation ratio 112 | IPRSave(ww,dd,bb)=sum(nbar(:,end).^2,1); 113 | 114 | end 115 | end 116 | end 117 | %% 118 | figure(1) 119 | 120 | imagesc(BetaS,Ws./J,reshape(mean(IPRSave,2),[NW NB])) 121 | 122 | set(gcf,'color','white') 123 | xlabel('\beta (sites)') 124 | ylabel('Disorder W(J)') 125 | colormap('jet') 126 | title('IPR: Single-Particle, Anderson Localization Example') 127 | colorbar() 128 | %% 129 | %{ 130 | load('8site_loadme.mat'); 131 | %% 132 | nhalf=sum(basis(:,1:size(basis,2)/2),2); 133 | ND=DisordN; 134 | 135 | 136 | Sp=zeros(NT,length(Ws),ND); 137 | SPM=zeros(NT,length(Ws)); 138 | 139 | NS=size(basis,2); 140 | rhon=zeros(NT,NS+1,length(Ws),ND); 141 | nbar=zeros(NS,NT,ND,length(Ws)); 142 | 143 | for ww=1:length(Ws) 144 | for dd=1:ND 145 | rho=abs(psiAllW{ww,dd}).^2; 146 | nbar(:,:,dd,ww)=(rho*basis)'; 147 | 148 | for nn=1:NS+1 149 | indsn=find(nhalf==(nn-1)); 150 | rhon(:,nn,ww,dd)=sum(rho(:,indsn),2); 151 | end 152 | temp=reshape(rhon(:,:,ww,dd),[NT NS+1]); 153 | 154 | Sp(:,ww,dd)=-sum(temp.*log(temp),2); 155 | end 156 | SPM=mean(Sp,3); 157 | nbarM=reshape(mean(nbar,3),[NS,NT,length(Ws)]); 158 | end 159 | 160 | %% 161 | tj=TT{1}.*J.*2.*pi; 162 | 163 | %cab_corr_red; 164 | 165 | %subSystemsEP_small_half_only; 166 | 167 | %% Correlation length section 168 | 169 | 170 | % Okay so this is looking at the old data 171 | 172 | %NN=size(prSitesW{1},1); 173 | NN=8; 174 | %NS=size(prSitesW{1},2); 175 | NS=9; 176 | NT=size(psiAllW{1},1); 177 | ND=size(psiAllW,2); 178 | % find long time indices 179 | indsLongTime=find(tt.*2.*pi.*J>100); 180 | 181 | 182 | % create g2matrices. Need to redo simulation to keep psi 183 | g2mats=zeros(size(basis,2),size(basis,2),size(basis,1)); 184 | nImats=zeros(size(basis,2),size(basis,2),size(basis,1)); 185 | nJmats=zeros(size(basis,2),size(basis,2),size(basis,1)); 186 | disN=zeros(NSites,size(basis,1)); 187 | g2dMats=zeros(NSites,size(basis,1)); 188 | 189 | for zz=1:size(basis,1) 190 | zz 191 | for ii=1:size(basis,2) 192 | for jj=ii:size(basis,2) 193 | if ii==jj 194 | g2mat(ii,jj,zz)=basis(zz,ii).^2-basis(zz,ii); 195 | 196 | else 197 | g2mat(ii,jj,zz)=basis(zz,ii).*basis(zz,jj); 198 | end 199 | nImat(ii,jj,zz)=basis(zz,ii); 200 | nJmat(ii,jj,zz)=basis(zz,jj); 201 | 202 | dd=abs(ii-jj); 203 | disN(dd+1,zz)=disN(dd+1,zz)+1; 204 | g2dMats(dd+1,zz)=g2mat(ii,jj,zz)+g2dMats(dd+1,zz); 205 | 206 | end 207 | end 208 | end 209 | 210 | 211 | 212 | 213 | %% 214 | tempOp=g2dMats./disN; 215 | 216 | for ww=1:length(Ws) 217 | temp=zeros(size(psiAllW{ww,1})); 218 | ww 219 | %psiAllW{ww,: 220 | 221 | 222 | for dd=1:DisordN 223 | g2dWD{ww,dd}=(abs(psiAllW{ww,dd}).^2)*tempOp'; 224 | temp=temp+abs(psiAllW{ww,dd}).^2; 225 | nbarWD{ww,dd}=(abs(psiAllW{ww,dd}).^2)*basis; 226 | nbar2WD{ww,dd}=(abs(psiAllW{ww,dd}).^2)*(basis.^2); 227 | end 228 | 229 | tempG2=zeros(size(g2dWD{ww,1})); 230 | for dd=1:DisordN 231 | tempG2=g2dWD{ww,dd}+tempG2; 232 | end 233 | tempG2=tempG2./DisordN; 234 | g2dWDMean{ww}=tempG2; 235 | 236 | temp=temp./DisordN; 237 | g2dW{ww}=temp*tempOp' 238 | nbarW{ww}=temp*basis; 239 | nbar2W{ww}=temp*(basis.^2) 240 | end 241 | 242 | %% 243 | 244 | avgRho=cell(length(Ws),1); 245 | for ww=1:length(Ws) 246 | temp=zeros(size(psiAllW{ww,1})); 247 | 248 | for dd=1:DisordN 249 | temp=temp+abs(psiAllW{ww,dd}).^2; 250 | end 251 | avgRho{ww}=temp./DisordN; 252 | end 253 | 254 | 255 | %% 256 | 257 | G2DNt=cell(size(basis,2),length(Ws)); 258 | G2IJN=cell(size(basis,2),length(Ws)); 259 | G2DNW=cell(length(Ws),1); 260 | for ww=1:length(Ws) 261 | ww 262 | temp=zeros(size(basis,2),NT); 263 | for ii=1:size(basis,2) 264 | %for ii=1:size(basis,2)-dd+1 265 | for jj=ii:size(basis,2) 266 | dd=abs(jj-ii)+1 267 | %jj=ii+dd-1; 268 | G2DNt{dd,ww}=[G2DNt{dd,ww}; reshape(g2mat(ii,jj,:),[1 size(basis,1)])*avgRho{ww}';]; 269 | G2IJN{dd,ww}=[G2IJN{dd,ww}; (reshape(nImat(ii,jj,:),[1 size(basis,1)])*avgRho{ww}').*(reshape(nJmat(ii,jj,:),[1 size(basis,1)])*avgRho{ww}');]; 270 | end 271 | %G2DNt{dd,ww}=mean(G2DNt{dd,ww},1); 272 | %G2IJN{dd,ww}=mean(G2IJN{dd,ww},1); 273 | %temp(dd,:)=G2DNt{dd,ww}./G2IJN{dd,ww}; 274 | 275 | G2DNtt{dd,ww}=mean(G2DNt{dd,ww}./G2IJN{dd,ww},1); 276 | G2IJN{dd,ww}=mean(G2IJN{dd,ww},1); 277 | %temp(dd,:)=G2DNt{dd,ww}./G2IJN{dd,ww}; 278 | temp(dd,:)=G2DNtt{dd,ww}; 279 | end 280 | G2DNW{ww}=temp; 281 | end 282 | 283 | 284 | %% 285 | tt=TT{1}; 286 | 287 | czz_un=zeros(NSites,NSites,length(Ws),length(tt)); 288 | czz=zeros(NSites,NSites,length(Ws),length(tt)); 289 | 290 | for ii=1:size(basis,2) 291 | for jj=ii:size(basis,2) 292 | if ii==jj 293 | optr=basis(:,ii).*basis(:,jj)-basis(:,ii); 294 | normrii=basis(:,ii); 295 | normrjj=basis(:,jj); 296 | 297 | else 298 | optr=basis(:,ii).*basis(:,jj); 299 | normrii=basis(:,ii); 300 | normrjj=basis(:,jj); 301 | 302 | end 303 | 304 | for ww=1:length(Ws) 305 | czz(ii,jj,ww,:)=avgRho{ww}*optr-(avgRho{ww}*normrii).*(avgRho{ww}*normrjj); 306 | 307 | czz_un(ii,jj,ww,:)=avgRho{ww}*optr; 308 | 309 | end 310 | 311 | end 312 | end 313 | 314 | %% 315 | czz_r=zeros([size(czz,1) size(czz,4) size(czz,3)]); 316 | for ww=1:length(Ws) 317 | for tti=1:length(tj) 318 | for dd=1:size(czz_r,1) 319 | czz_r(dd,tti,ww)=mean(diag( ... 320 | reshape(czz(:,:,ww,tti),[size(czz_r,1) size(czz_r,1)]), ... 321 | dd-1)); 322 | end 323 | xd(tti,ww)=-sum(czz_r(:,tti,ww).*([0:7]')); 324 | end 325 | end 326 | %% 327 | save('corrzz.mat','czz','czz_r','czz_un','Ws','tj','xd') 328 | xdLow=xd; 329 | tjLow=tj; 330 | WsLow=Ws; 331 | xd100jtLow=xd(67,:); 332 | save('LowWXDat.mat','WsLow','tjLow','xdLow','xd100jtLow') 333 | %} 334 | -------------------------------------------------------------------------------- /dynBldGnPdfFx.m: -------------------------------------------------------------------------------- 1 | function [sn2k,S2kInds,indsNKStore,corrn,gn] = dynBldGnPdfFx(pdf,basis,n,inds) 2 | 3 | %inds=1:nsites; % set the inds over which to find the correlations from the ground up 4 | %basis=BasisMake(nsites,nsites); % example data set that is the infinite temperature ensemble for BH 5 | %{ 6 | nsep=6; 7 | if nsites>nsep 8 | basis=BasisMake(nsep,nsep); % example data set that is the infinite temperature ensemble for BH 9 | basis2=BasisMake(nsites-nsep,nsites-nsep); 10 | data=[]; 11 | for bb=1:size(basis,1) 12 | data=[data; ones(size(basis2,1),1)*basis(bb,:) basis2]; 13 | end 14 | else 15 | data=BasisMake(nsites,nsites); 16 | end 17 | %} 18 | %{ 19 | data=zeros(3,n); 20 | data(1,1:2:end)=2; 21 | data(2,2:2:end)=2; 22 | data(3,:)=1; 23 | %} 24 | 25 | S2kInds=cell(n,n); % create cell structure to find all groupings as following the Stirling Numbers of the second kind 26 | gn=cell(1,n); % create a cell to save high n-order correlation functions 27 | sn2k=zeros(n,n); % just the number of unique partitions for nparts into k groups 28 | 29 | for ni=1:n 30 | tic %timing check 31 | sn2k(ni,1)=1; %initialize for 1 unique grouping of n parts into 1 group 32 | sn2k(ni,ni)=1; % initialize for 1 unique grouping of n parts into n groups 33 | 34 | S2kInds{ni,1}{1,1}=[1:ni]; 35 | 36 | for ki=2:ni 37 | %number of permutations at given Stirling's number of the second 38 | %kind 39 | 40 | sn2k(ni,ki)=sn2k(ni-1,ki-1)+ki*sn2k(ni-1,ki); 41 | 42 | temp=cell(sn2k(ni,ki),ki); 43 | 44 | ref1=S2kInds{ni-1,ki-1}; 45 | [nx1,ny1]=size(ref1); 46 | ref2=S2kInds{ni-1,ki}; 47 | [nx2,ny2]=size(ref2); 48 | 49 | for ii=1:nx1 50 | for jj=1:ki-1 51 | temp{ii,jj}=ref1{ii,jj}; 52 | end 53 | temp{ii,ki}=[ni]; 54 | end 55 | 56 | for ii=1:nx2 57 | for rr=1:ki 58 | for jj=1:ki 59 | if jj==rr 60 | temp{nx1+(ii-1)*ki+rr,jj}=[ref2{ii,jj} ni]; 61 | else 62 | temp{nx1+(ii-1)*ki+rr,jj}=ref2{ii,jj}; 63 | end 64 | end 65 | end 66 | end 67 | 68 | 69 | 70 | S2kInds{ni,ki}=temp; 71 | 72 | 73 | 74 | end 75 | 76 | indsNK=sort(nchoosek(inds,ni),2); 77 | indsNKStore{ni}=indsNK; 78 | if ni==1 79 | gntemp=zeros([1 n]); 80 | ontemp=zeros([1 n]); 81 | 82 | for aa=1:size(indsNK,1) 83 | cellInds=cell(1,ni); 84 | for ii=1:ni 85 | cellInds{ii}=indsNK(aa,ii); 86 | end 87 | gntemp(cellInds{:})=sum(pdf.*prod(basis(:,indsNK(aa,:)),2),1); 88 | ontemp(cellInds{:})=sum(pdf.*prod(basis(:,indsNK(aa,:)),2),1); 89 | end 90 | gn{ni}=gntemp; 91 | corrn{ni}=ontemp; 92 | 93 | else 94 | gntemp=zeros(ones(1,ni).*n); 95 | ontemp=zeros(ones(1,ni).*n); 96 | 97 | for aa=1:size(indsNK,1) 98 | cellInds=cell(1,ni); 99 | for ii=1:ni 100 | cellInds{ii}=indsNK(aa,ii); 101 | end 102 | 103 | gntemp(cellInds{:})=sum(pdf.*prod(basis(:,indsNK(aa,:)),2),1); 104 | ontemp(cellInds{:})=sum(pdf.*prod(basis(:,indsNK(aa,:)),2),1); 105 | %gn{ni}=gntemp; 106 | 107 | for s2ni=2:ni 108 | tempCell=S2kInds{ni,s2ni}; 109 | [nterms, nmult]=size(tempCell); 110 | for nti=1:nterms 111 | tempVal=1; 112 | for nmi=1:nmult 113 | indTerms=tempCell{nti,nmi}; 114 | refGn=gn{length(indTerms)}; 115 | 116 | cellInds2=cell(1,length(indTerms)); 117 | for ii=1:length(indTerms) 118 | cellInds2{ii}=indsNK(aa,indTerms(ii)); 119 | end 120 | 121 | tempVal=tempVal.*refGn(cellInds2{:}); 122 | end 123 | 124 | gntemp(cellInds{:})=gntemp(cellInds{:})-tempVal; 125 | end 126 | 127 | end 128 | end 129 | 130 | gn{ni}=gntemp; 131 | corrn{ni}=ontemp; 132 | end 133 | 134 | toc 135 | end 136 | 137 | 138 | end 139 | %% 140 | 141 | -------------------------------------------------------------------------------- /functions/BasisMake.m: -------------------------------------------------------------------------------- 1 | function [basis] = BasisMake(NSites,NPart) 2 | 3 | %find hilbert space size 4 | HilbD=HilbDim(NSites,NPart); 5 | 6 | % creates a basis set that is written as a vector that is the hilbert space 7 | % dimension x number of sites (way of writing down the many-body fock 8 | % state) 9 | 10 | basis=zeros(HilbD,NSites); 11 | 12 | % initial state for the function to make all other basis states from 13 | % starts with all the bosons on the edge-most site 14 | basis(1,1)=NPart; 15 | 16 | 17 | cc=1; 18 | for k=1:NSites-1 19 | 20 | %find states where site-k has an atom 21 | kset=find(basis(:,k)~=0)'; 22 | 23 | %iterate through all states where site-k has an atom 24 | for kk=kset 25 | %number of atoms on site-k in basis state kk 26 | bb=basis(kk,k); 27 | 28 | %mask for moving all of the atoms off of this site to the 29 | %neighboring one 30 | mask=[bb-1:-1:0;1:bb]'; 31 | 32 | %set the y size from the mask 33 | maskY=size(mask,1); 34 | 35 | %add this basis of moved particles by one to the basis to the left 36 | %of site-k 37 | basis(cc+1:cc+maskY,1:(k-1))=ones(maskY,1)*basis(kk,1:(k-1)); 38 | 39 | %add on the particles moved to the right of the basis 40 | basis(cc+1:cc+maskY,k:k+1)=mask; 41 | 42 | %number of basis states moved down (unique ones were made above) 43 | cc=cc+bb; 44 | end 45 | 46 | end 47 | 48 | 49 | end -------------------------------------------------------------------------------- /functions/DensityEval.m: -------------------------------------------------------------------------------- 1 | function [nbar,nvar,nfluc] = DensityEval(psiAll,basis); 2 | 3 | 4 | nbar=basis'*abs(psiAll).^2; 5 | nvar=(basis.^2)'*abs(psiAll).^2; 6 | nfluc=nvar-nbar; 7 | 8 | 9 | end -------------------------------------------------------------------------------- /functions/DisorderAvgPsi.m: -------------------------------------------------------------------------------- 1 | function [pdfAllDisAvg] = DisorderAvgPsi(varargin) 2 | 3 | %This exists to simply go through all the disorder realizations and average 4 | %them. It should (physically anyway) inherently produce a probability 5 | %distribution function since we will lose all the phase information upon 6 | %averaging the different disorders. 7 | 8 | % psiAllSave is the saved wave function outputs 9 | psiAllSave = varargin{1}; 10 | % ww is the disorder depth index value 11 | ww=varargin{2}; 12 | % bb is the incommensurate ratio index value 13 | bb=varargin{3}; 14 | 15 | % get all dimensions 16 | [NW,ND,NB]=size(psiAllSave); 17 | 18 | %initialize pdf 19 | pdfAllDisAvg=zeros(size(psiAllSave{ww,1,bb})); 20 | 21 | % average over disorder realizations 22 | for dd=1:ND 23 | pdfAllDisAvg=pdfAllDisAvg+(abs(psiAllSave{ww,dd,bb}).^2)./ND; 24 | end 25 | 26 | 27 | end -------------------------------------------------------------------------------- /functions/ExactDiagTimeFx.m: -------------------------------------------------------------------------------- 1 | function [psiAll, PhiN, En, Cn] = ExactDiagTimeFx(psiInit,Ts,Ham) 2 | 3 | %this function just takes the Hamiltonian "Ham" and calculates the dynamics 4 | %of the initial state PsiInit 5 | 6 | %find column eigenvectors PhiN from V(:,index) and eigenvalues En from diag(D) 7 | [V,D]=eig(Ham); 8 | %eigenvalues 9 | En=diag(D); 10 | %eigenvectors 11 | PhiN=V; 12 | 13 | %overlap amplitudes with initial state 14 | Cn=conj(psiInit)*PhiN; 15 | %make it a matrix 16 | cnsMat=Cn'*ones(1,length(Ts)); 17 | 18 | %compute time dynamics from phase wrapping of eigenvalues for each 19 | %eigenstate and taking care of the projection with the matrix cnsMat 20 | 21 | psiAll(:,:)=(PhiN* ... 22 | (cnsMat.* ... 23 | exp(i.*2.*pi.*(En*Ts)) ... 24 | ) ... 25 | ); 26 | 27 | end -------------------------------------------------------------------------------- /functions/FindTunnelingTerms.m: -------------------------------------------------------------------------------- 1 | function [jterms] = FindTunnelingTerms(NSites,isPB) 2 | 3 | jterm=zeros([1 NSites]); 4 | jterm(1:2)=[1,-1]; 5 | jterm=jterm(toeplitz(1:numel(jterm),[1 numel(jterm):-1:2])); 6 | 7 | if isPB == 0 8 | %makes open boundary condition 9 | jterms=jterm(2:end,:); 10 | else 11 | %makes periodic boundary conditions 12 | jterms=jterm; 13 | end 14 | 15 | %make hermitian terms 16 | jterms=vertcat(jterms,fliplr(jterms)); 17 | 18 | 19 | end -------------------------------------------------------------------------------- /functions/GnConn.m: -------------------------------------------------------------------------------- 1 | function [gnConn, gnDisConn] = GnConn(varargin) 2 | 3 | % find connected vs disconnected correlation functions 4 | % monte carlo data 5 | dataRaw=varargin{1}; 6 | inds=varargin{2}; 7 | NInd=length(inds); 8 | 9 | % the basis produced for unity filling is actually a convenient way to find 10 | % all unique integer partitions. Will fail for very large system sizes due 11 | % to tryting to make the enormous basis 12 | intParts=flipud( ... 13 | unique( ... 14 | sort( BasisMake(NInd,NInd),2,'descend' ) ... 15 | ,'rows') ... 16 | ); 17 | 18 | % initialize disconnected and connected correlators 19 | gnDisConn=GnCorrDatFx(dataRaw,inds); 20 | gnConn=gnDisConn; 21 | 22 | % find number of unique integer partitions. we skip the first one below 23 | % because it is already the disconnected part+connected part 24 | intParts=intParts(2:end,:); 25 | NIntPrt=size(intParts,1); 26 | 27 | for ni=1:NIntPrt 28 | 29 | gnConn=gnConn-permIndsProd(dataRaw,1,intParts(ni,:),inds); 30 | 31 | end 32 | 33 | gnDisConn=gnDisConn-gnConn; 34 | gnDisConn=mean(prod(dataRaw(:,inds),2),1)-gnConn; 35 | 36 | end -------------------------------------------------------------------------------- /functions/GnCorrDatFx.m: -------------------------------------------------------------------------------- 1 | function [gn] = GnCorrDatFx(varargin) 2 | 3 | % This is to calculate the correlation of non-overlapping indices in the 4 | % data structure. This is, as of now, just for the density-density... 5 | % correlations and so overlapping indices could be fixed with commutation 6 | % rules. Fix this stuff later if it comes up 7 | 8 | %define varagin 9 | %sampled data (in fock basis, but generally whatever the basis states are) 10 | dataStruct=varargin{1}; 11 | %indices -- this determines the "order" of the correlator 12 | inds=varargin{2}; 13 | 14 | %find the dimensions of sampled monte carlo data 15 | [NSmp NSites]=size(dataStruct); 16 | 17 | %on-site mean values to find differences from 18 | meanVals=mean(dataStruct(:,inds),1); 19 | deltaValsInds=dataStruct(:,inds)-ones(NSmp,1)*meanVals; 20 | gn=mean(prod(deltaValsInds,2),1); 21 | 22 | end -------------------------------------------------------------------------------- /functions/HilbDim.m: -------------------------------------------------------------------------------- 1 | function [HilbD] = HilbDim(NSites,NPart) 2 | 3 | % combinatorics for choosing how to split up NPart Bosons on NSites 4 | % also sometimes thought of as the balls and sticks sorting, where the 5 | % balls are the bosons and the sticks are the way they separated into 6 | % lattice sites. So for NSites you have NSites-1 dividers, hence the 7 | % choosing by NSites-1 = numer of sticks 8 | 9 | HilbD = round(factorial(NPart+NSites-1)/factorial(NPart)/factorial(NSites-1)); 10 | 11 | end 12 | -------------------------------------------------------------------------------- /functions/MakeDisorderHam.m: -------------------------------------------------------------------------------- 1 | function [Hd] = MakeDisorderHam(varargin) 2 | 3 | % arg 1 is the basis for the disorder hamiltonian 4 | % arg 2 is the QP disorder boolean that determines the type of disorder 5 | % isQP = 0 - random, 1 - exp disorder, 2 - quasiperiodic, o.w. 6 | % nothing else 7 | % arg 3 either offset in experimental samples or phi offset for qp 8 | % arg 4 quasiperiodicity 9 | 10 | basis=varargin{1}; 11 | isQP=varargin{2}; 12 | 13 | NSites=size(basis,2); 14 | HilbD=size(basis,1); 15 | 16 | 17 | if isQP == 0 18 | 19 | % make random disorder vector 20 | Rvec=2.*rand(NSites,1)'; 21 | Hd=diag( ... 22 | sum((ones(HilbD,1)*Rvec).*basis,2) ... 23 | ); 24 | 25 | elseif isQP == 1 26 | 27 | % load experimental disorder 28 | load('Hamiltonians/ExpDisorder.mat'); 29 | 30 | % normalize disorder 31 | siteSave=savedData{3}; 32 | siteSave=siteSave./max(max(siteSave)); 33 | 34 | % create vector to multiply disorder by 35 | PhiOff=varargin{3}; 36 | 37 | Rvec=siteSave(8-(round(NSites/2)-1):9+(round(NSites/2)-1),round(PhiOff))'; 38 | Hd=diag( ... 39 | sum((ones(HilbD,1)*Rvec).*basis,2) ... 40 | ); 41 | 42 | elseif isQP == 2 43 | 44 | beta=varargin{4}; 45 | 46 | % make quasiperiodic disorder vector 47 | PhiOff=varargin{3}; 48 | 49 | Rvec=cos((beta*2*pi).*[0:NSites-1]+PhiOff); 50 | Hd=diag( ... 51 | sum((ones(HilbD,1)*Rvec).*basis,2) ... 52 | ); 53 | 54 | else 55 | 56 | Hd=zeros(size(basis,1)); 57 | 58 | end -------------------------------------------------------------------------------- /functions/MakeHamiltoniansAndBasis.m: -------------------------------------------------------------------------------- 1 | function [Hi,Hj,basis] = MakeHamiltoniansAndBasis(NSites,NPart,jn,isPB) 2 | 3 | %NSites = Number of sites in bose hubbard chain 4 | %NPart = Number of bosons in total 5 | %jn order of the tunneling, nearest neighbor = 1 6 | %isPB determines boundary conditions: isPB = 1 means periodic boundary 7 | %conditions 8 | 9 | %find hilbert space size 10 | HilbD=HilbDim(NSites,NPart); 11 | 12 | % tunneling matrix 13 | Hj=zeros(HilbD,HilbD); 14 | Hi=Hj; 15 | 16 | % creates a basis set that is written as a vector that is the hilbert space 17 | % dimension x number of sites (way of writing down the many-body fock 18 | % state) 19 | 20 | basis=BasisMake(NSites,NPart); 21 | 22 | 23 | %find elements coupled between sites for tunneling hamiltonian 24 | %depends on boundary conditions 25 | if isPB == 1 26 | %periodic boundary conditions 27 | EndSite=NSites; 28 | else 29 | %open boundary conditions 30 | EndSite=NSites-jn; 31 | end 32 | 33 | for ss=1:EndSite 34 | 35 | %look at the pairs of sites coupled by the order (jn) of tunneling we 36 | %care about. Will make two 2D planes that are the hilbert space size 37 | %and find all pairs of sites i and j that differ by +/- 1 and also have 38 | %all other sites the same 39 | 40 | %site i for coupling 41 | si=ss; 42 | %site j for coupling 43 | sj=mod(si+jn-1,NSites)+1; 44 | 45 | %array initial states for sites i and j 46 | vbi=basis(:,[si,sj]); 47 | vi=cat(3,vbi(:,1)*ones(1,HilbD),vbi(:,2)*ones(1,HilbD)); 48 | 49 | %array of final states for states i and j 50 | vbj=basis(:,[si,sj]); 51 | vj=cat(3,ones(HilbD,1)*vbj(:,1)',ones(HilbD,1)*vbj(:,2)'); 52 | dvij=vi-vj; 53 | temp=dvij(:,:,1).*dvij(:,:,2); 54 | temp(find(temp~=-1))=0; 55 | dfij=abs(temp); % make all values 1 56 | 57 | % check now if all other sites are the same 58 | NSList=1:NSites; 59 | inds=intersect(find(NSList~=si),find(NSList~=sj)); % all remaining sites 60 | 61 | % go through remaining sites and make masks for when they don't change 62 | for ii=inds 63 | vii=basis(:,ii); 64 | dfii=abs(vii*ones(1,HilbD)-ones(HilbD,1)*vii'); 65 | dfi=zeros(size(dfii)); 66 | dfi(find(dfii==0))=1; 67 | dfij=dfij.*dfi; 68 | end 69 | 70 | %zero out bases elements that have more than one change 71 | dfij=abs(dfij); 72 | Hj=Hj+dfij; 73 | end 74 | 75 | %find linear list of elements 76 | ijIndList=find(Hj>0); 77 | for ijInd=1:length(ijIndList); 78 | ijElem=ijIndList(ijInd); 79 | [ii,jj]=ind2sub(size(Hj),ijElem); 80 | 81 | %only do upper right of matrix 82 | if ii>jj 83 | statei=basis(ii,:); 84 | statej=basis(jj,:); 85 | dstate=statei-statej; 86 | Hj(ii,jj)=-sqrt(statej(find(dstate==-1))).*sqrt(statei(find(dstate==1))); 87 | else 88 | 89 | statei=basis(ii,:); 90 | statej=basis(jj,:); 91 | dstate=statei-statej; 92 | Hj(ii,jj)=-sqrt(statej(find(dstate==-1))).*sqrt(statei(find(dstate==1))); 93 | end 94 | 95 | end 96 | 97 | %fix lower half with the transpose; 98 | %Hj=Hj+ctranspose(Hj); 99 | 100 | % make interaction hamiltonian (it's diagonal so it's super easy) 101 | for hh=1:HilbD 102 | Hi(hh,hh)=sum(basis(hh,:).*(basis(hh,:)-1)); 103 | end 104 | 105 | end -------------------------------------------------------------------------------- /functions/MonteCarloSmp.m: -------------------------------------------------------------------------------- 1 | function [dataSmpl] = MonteCarloSmp(pdf,tind,NSamp) 2 | 3 | % both in the spirit of how data is taken in the experiment and sometimes 4 | % for the sake of not saving the entire computed wave functions for all 5 | % parameter regimes, we can do some montecarlo sampling for fast and 6 | % experimentally similar methods of computation 7 | 8 | %input is assumed to be the probability distribution function in the basis 9 | %of interest. So in this case pdf is pdf=abs(psi).^2; 10 | 11 | %determine dimension sizes 12 | [HilbD NT]=size(pdf); 13 | 14 | %make sure sampled time point is valid 15 | assert(tind<=NT && tind>0,'Time point invalid for sampling') 16 | 17 | %initialize cumulative distribution function 18 | cdfMsk=tril(ones(HilbD)); 19 | cdf=cdfMsk*pdf; 20 | 21 | %to use the cdf backwards to randomly sample data points 22 | cdfIntp=@(x) ceil(interp1(cdf(:,tind),1:HilbD,x)); 23 | 24 | %random vector for sampling 25 | randVec=rand(1,NSamp).*(1-cdf(1,tind))+cdf(1,tind); 26 | 27 | dataSmpl=cdfIntp(randVec); 28 | 29 | 30 | end -------------------------------------------------------------------------------- /functions/cabFx.asv: -------------------------------------------------------------------------------- 1 | function [CAB] = cabFx(varargin) 2 | 3 | %take in all inputs and make definitions 4 | [ND NW NB NT] = varargin{1} 5 | [NPart NSites] = varargin{2} 6 | basis = varargin{3} 7 | psiAllSave = varargin{4} 8 | 9 | % subsystems only the half system subsystem 10 | subss=[0]; 11 | ss=1; 12 | 13 | % create bounds and basis 14 | halfS=floor(size(basis,2)/2)+subss(ss); 15 | fullS=floor(size(basis,2)); 16 | HilbD=size(basis,1); 17 | expon=(fullS:-1:1)-1; 18 | 19 | 20 | % loop for finding all correlators CAB 21 | 22 | for ww=1:NW 23 | for dd=1:ND 24 | for bb=1:NB 25 | 26 | %find rho for given parameters of W,D,B 27 | temp_rho=abs(psiAllSave{ww,dd,bb}).^2; 28 | 29 | %make bases for finding unique configurations 30 | bases=ones(size(basis,1),1)*(10.^(expon)); 31 | baseKey=sum(basis.*bases,2); 32 | unqKey=unique(baseKey); 33 | 34 | %make base for left half and right half 35 | baseHalfKeyL=sum(basis(:,1:halfS).*bases(:,1:halfS),2); 36 | baseHalfKeyR=sum(basis(:,halfS+1:end).*bases(:,halfS+1:end),2); 37 | halfNKey=sum(basis(:,1:halfS),2); 38 | 39 | 40 | for nn=1:NPart+1 41 | 42 | %declare bases for two halfs of system to find separability 43 | %distribution 44 | bases=ones(size(basis,1),1)*(10.^(expon)); 45 | baseKey=sum(basis.*bases,2); 46 | unqKey=unique(baseKey); 47 | halfS=floor(size(basis,2)/2)+subss(ss); 48 | 49 | %b 50 | baseHalfKeyL=sum(basis(:,1:halfS).*bases(:,1:halfS),2); 51 | baseHalfKeyR=sum(basis(:,halfS+1:end).*bases(:,halfS+1:end),2); 52 | halfNKey=sum(basis(:,1:halfS),2); 53 | 54 | inds=find(halfNKey==(nn-1)); 55 | binTemp=zeros(length(inds),3,NT); 56 | 57 | rhoAgB=zeros(length(unique(baseHalfKeyL(inds))),NT); 58 | unqAKey=unique(baseHalfKeyL(inds)); 59 | unqBKey=unique(baseHalfKeyR(inds)); 60 | 61 | normP=sum(temp_rho(:,inds),2); 62 | rhoABJ=zeros(length(unique(baseHalfKeyL(inds))), ... 63 | length(unique(baseHalfKeyR(inds))), ... 64 | NT); 65 | 66 | rhoAs=zeros(length(unique(baseHalfKeyL(inds))), NT); 67 | rhoBs=zeros(length(unique(baseHalfKeyR(inds))), NT); 68 | 69 | for ii=1:length(inds) 70 | 71 | %joint distribution 72 | binTemp(ii,1,:)=reshape(temp_rho(:,inds(ii)),[1 NT])./normP'; 73 | 74 | %marginal dist 1 75 | inds2=find(baseHalfKeyL(inds(ii))==baseHalfKeyL); 76 | binTemp(ii,2,:)=reshape(sum(temp_rho(:,inds2),2),[1 NT])./normP'; 77 | 78 | %marginal dist 2 79 | inds3=find(baseHalfKeyR(inds(ii))==baseHalfKeyR); 80 | binTemp(ii,3,:)=reshape(sum(temp_rho(:,inds3),2),[1 NT])./normP'; 81 | 82 | 83 | end 84 | 85 | % test separability of joint distribution 86 | cab_elem=reshape((binTemp(:,1,:)-binTemp(:,2,:).*binTemp(:,3,:)),[size(binTemp,1),NT]); 87 | 88 | % compute correlator for different number sectors 89 | for nt=1:NT 90 | testCorrSaveTH(nn,nt)=normP(nt)'.*sum(abs(cab_elem(:,nt))); 91 | end 92 | 93 | end 94 | 95 | corrThStruct{ww,dd,bb}=testCorrSaveTH; 96 | 97 | end 98 | end 99 | end 100 | 101 | 102 | 103 | % just reorganization for output of CAB 104 | tempAllTh=zeros(NT,NPart+1,ND,NW); 105 | CAB=zeros(NT,NB,NW); 106 | 107 | for ww=1:NW 108 | for bb=1:NB 109 | for dd=1:ND 110 | tempAllTh(:,:,ww,bb,dd)=corrThStruct{ww,ii}'; 111 | end 112 | end 113 | end 114 | 115 | %sum across different particle sectors and average over disorders 116 | CAB=reshape(mean(sum(tempAllTh,2),5),[NT NW NB]); 117 | 118 | end 119 | 120 | -------------------------------------------------------------------------------- /functions/cabFx.m: -------------------------------------------------------------------------------- 1 | function [CAB] = cabFx(varargin) 2 | 3 | %take in all inputs and make definitions 4 | [ND NW NB NT] = varargin{1} 5 | [NPart NSites] = varargin{2} 6 | basis = varargin{3} 7 | psiAllSave = varargin{4} 8 | 9 | % subsystems only the half system subsystem 10 | subss=[0]; 11 | ss=1; 12 | 13 | % create bounds and basis 14 | halfS=floor(size(basis,2)/2)+subss(ss); 15 | fullS=floor(size(basis,2)); 16 | HilbD=size(basis,1); 17 | expon=(fullS:-1:1)-1; 18 | 19 | 20 | % loop for finding all correlators CAB 21 | 22 | for ww=1:NW 23 | for dd=1:ND 24 | for bb=1:NB 25 | 26 | %find rho for given parameters of W,D,B 27 | temp_rho=abs(psiAllSave{ww,dd,bb}).^2; 28 | 29 | for nn=1:NPart+1 30 | 31 | %declare bases for two halfs of system to find separability 32 | %distribution for different particle sectors "nn" 33 | bases=ones(size(basis,1),1)*(10.^(expon)); 34 | baseKey=sum(basis.*bases,2); 35 | unqKey=unique(baseKey); 36 | halfS=floor(size(basis,2)/2)+subss(ss); 37 | 38 | %left half base 39 | baseHalfKeyL=sum(basis(:,1:halfS).*bases(:,1:halfS),2); 40 | baseHalfKeyR=sum(basis(:,halfS+1:end).*bases(:,halfS+1:end),2); 41 | halfNKey=sum(basis(:,1:halfS),2); 42 | 43 | %find indices of contributing states in particle number basis 44 | inds=find(halfNKey==(nn-1)); 45 | binTemp=zeros(length(inds),3,NT); 46 | 47 | %find keys for looking at joint versus marginal distribution 48 | rhoAgB=zeros(length(unique(baseHalfKeyL(inds))),NT); 49 | unqAKey=unique(baseHalfKeyL(inds)); 50 | unqBKey=unique(baseHalfKeyR(inds)); 51 | 52 | %particle number normalization 53 | normP=sum(temp_rho(:,inds),2); 54 | 55 | for ii=1:length(inds) 56 | %joint distribution 57 | binTemp(ii,1,:)=reshape(temp_rho(:,inds(ii)),[1 NT])./normP'; 58 | 59 | %marginal dist 1 60 | inds2=find(baseHalfKeyL(inds(ii))==baseHalfKeyL); 61 | binTemp(ii,2,:)=reshape(sum(temp_rho(:,inds2),2),[1 NT])./normP'; 62 | 63 | %marginal dist 2 64 | inds3=find(baseHalfKeyR(inds(ii))==baseHalfKeyR); 65 | binTemp(ii,3,:)=reshape(sum(temp_rho(:,inds3),2),[1 NT])./normP'; 66 | end 67 | 68 | % test separability of joint distribution 69 | cab_elem=reshape((binTemp(:,1,:)-binTemp(:,2,:).*binTemp(:,3,:)),[size(binTemp,1),NT]); 70 | 71 | % compute correlator for different number sectors 72 | for nt=1:NT 73 | testCorrSaveTH(nn,nt)=normP(nt)'.*sum(abs(cab_elem(:,nt))); 74 | end 75 | 76 | end 77 | 78 | corrThStruct{ww,dd,bb}=testCorrSaveTH; 79 | 80 | end 81 | end 82 | end 83 | 84 | 85 | 86 | % just reorganization for output of CAB 87 | tempAllTh=zeros(NT,NPart+1,ND,NW); 88 | CAB=zeros(NT,NB,NW); 89 | 90 | for ww=1:NW 91 | for bb=1:NB 92 | for dd=1:ND 93 | tempAllTh(:,:,ww,bb,dd)=corrThStruct{ww,ii}'; 94 | end 95 | end 96 | end 97 | 98 | %sum across different particle sectors and average over disorders 99 | CAB=reshape(mean(sum(tempAllTh,2),5),[NT NW NB]); 100 | 101 | end 102 | 103 | -------------------------------------------------------------------------------- /functions/dynBldGnFx.m: -------------------------------------------------------------------------------- 1 | function [sn2k,S2kInds,indsNKStore,corrn,gn] = dynBldGnFx(data,n,inds) 2 | 3 | %inds=1:nsites; % set the inds over which to find the correlations from the ground up 4 | %basis=BasisMake(nsites,nsites); % example data set that is the infinite temperature ensemble for BH 5 | %{ 6 | nsep=6; 7 | if nsites>nsep 8 | basis=BasisMake(nsep,nsep); % example data set that is the infinite temperature ensemble for BH 9 | basis2=BasisMake(nsites-nsep,nsites-nsep); 10 | data=[]; 11 | for bb=1:size(basis,1) 12 | data=[data; ones(size(basis2,1),1)*basis(bb,:) basis2]; 13 | end 14 | else 15 | data=BasisMake(nsites,nsites); 16 | end 17 | %} 18 | %{ 19 | data=zeros(3,n); 20 | data(1,1:2:end)=2; 21 | data(2,2:2:end)=2; 22 | data(3,:)=1; 23 | %} 24 | 25 | S2kInds=cell(n,n); % create cell structure to find all groupings as following the Stirling Numbers of the second kind 26 | gn=cell(1,n); % create a cell to save high n-order correlation functions 27 | sn2k=zeros(n,n); % just the number of unique partitions for nparts into k groups 28 | 29 | for ni=1:n 30 | tic %timing check 31 | sn2k(ni,1)=1; %initialize for 1 unique grouping of n parts into 1 group 32 | sn2k(ni,ni)=1; % initialize for 1 unique grouping of n parts into n groups 33 | 34 | S2kInds{ni,1}{1,1}=[1:ni]; 35 | 36 | for ki=2:ni 37 | %number of permutations at given Stirling's number of the second 38 | %kind 39 | 40 | sn2k(ni,ki)=sn2k(ni-1,ki-1)+ki*sn2k(ni-1,ki); 41 | 42 | temp=cell(sn2k(ni,ki),ki); 43 | 44 | ref1=S2kInds{ni-1,ki-1}; 45 | [nx1,ny1]=size(ref1); 46 | ref2=S2kInds{ni-1,ki}; 47 | [nx2,ny2]=size(ref2); 48 | 49 | for ii=1:nx1 50 | for jj=1:ki-1 51 | temp{ii,jj}=ref1{ii,jj}; 52 | end 53 | temp{ii,ki}=[ni]; 54 | end 55 | 56 | for ii=1:nx2 57 | for rr=1:ki 58 | for jj=1:ki 59 | if jj==rr 60 | temp{nx1+(ii-1)*ki+rr,jj}=[ref2{ii,jj} ni]; 61 | else 62 | temp{nx1+(ii-1)*ki+rr,jj}=ref2{ii,jj}; 63 | end 64 | end 65 | end 66 | end 67 | 68 | 69 | 70 | S2kInds{ni,ki}=temp; 71 | 72 | 73 | 74 | end 75 | 76 | indsNK=sort(nchoosek(inds,ni),2); 77 | indsNKStore{ni}=indsNK; 78 | if ni==1 79 | gntemp=zeros([1 n]); 80 | ontemp=zeros([1 n]); 81 | 82 | for aa=1:size(indsNK,1) 83 | cellInds=cell(1,ni); 84 | for ii=1:ni 85 | cellInds{ii}=indsNK(aa,ii); 86 | end 87 | gntemp(cellInds{:})=mean(prod(data(:,indsNK(aa,:)),2),1); 88 | ontemp(cellInds{:})=mean(prod(data(:,indsNK(aa,:)),2),1); 89 | end 90 | gn{ni}=gntemp; 91 | corrn{ni}=ontemp; 92 | 93 | else 94 | gntemp=zeros(ones(1,ni).*n); 95 | ontemp=zeros(ones(1,ni).*n); 96 | 97 | for aa=1:size(indsNK,1) 98 | cellInds=cell(1,ni); 99 | for ii=1:ni 100 | cellInds{ii}=indsNK(aa,ii); 101 | end 102 | 103 | gntemp(cellInds{:})=mean(prod(data(:,indsNK(aa,:)),2),1); 104 | ontemp(cellInds{:})=mean(prod(data(:,indsNK(aa,:)),2),1); 105 | %gn{ni}=gntemp; 106 | 107 | for s2ni=2:ni 108 | tempCell=S2kInds{ni,s2ni}; 109 | [nterms, nmult]=size(tempCell); 110 | for nti=1:nterms 111 | tempVal=1; 112 | for nmi=1:nmult 113 | indTerms=tempCell{nti,nmi}; 114 | refGn=gn{length(indTerms)}; 115 | 116 | cellInds2=cell(1,length(indTerms)); 117 | for ii=1:length(indTerms) 118 | cellInds2{ii}=indsNK(aa,indTerms(ii)); 119 | end 120 | 121 | tempVal=tempVal.*refGn(cellInds2{:}); 122 | end 123 | 124 | gntemp(cellInds{:})=gntemp(cellInds{:})-tempVal; 125 | end 126 | 127 | end 128 | end 129 | 130 | gn{ni}=gntemp; 131 | corrn{ni}=ontemp; 132 | end 133 | 134 | toc 135 | end 136 | 137 | 138 | end 139 | %% 140 | 141 | -------------------------------------------------------------------------------- /functions/dynBldGnFxFs.m: -------------------------------------------------------------------------------- 1 | %function [sn2k,S2kInds,indsNKStore,corrn,gn] = dynBldGnFxFs(data,n,inds,PP) 2 | 3 | %inds=1:nsites; % set the inds over which to find the correlations from the ground up 4 | %basis=BasisMake(nsites,nsites); % example data set that is the infinite temperature ensemble for BH 5 | %{ 6 | nsep=6; 7 | if nsites>nsep 8 | basis=BasisMake(nsep,nsep); % example data set that is the infinite temperature ensemble for BH 9 | basis2=BasisMake(nsites-nsep,nsites-nsep); 10 | data=[]; 11 | for bb=1:size(basis,1) 12 | data=[data; ones(size(basis2,1),1)*basis(bb,:) basis2]; 13 | end 14 | else 15 | data=BasisMake(nsites,nsites); 16 | end 17 | %} 18 | %{ 19 | data=zeros(3,n); 20 | data(1,1:2:end)=2; 21 | data(2,2:2:end)=2; 22 | data(3,:)=1; 23 | %} 24 | 25 | %{ 26 | nconsv=[2E1 1E2 1E3 1E4 1E5]; 27 | for nc=1:length(nconsv) 28 | clearvars -except nconsv nc gnmean 29 | test=randi([1 12],12,nconsv(nc)); 30 | size(test) 31 | datatest=zeros(size(test)); 32 | for jj=1:size(test,2) 33 | for ii=1:size(test,1) 34 | datatest(test(ii,jj),jj)=datatest(test(ii,jj),jj)+1; 35 | end 36 | end 37 | %} 38 | 39 | %data=datanew; 40 | data=basis; 41 | n=8 42 | inds=1:8 43 | NPart=mean(sum(data,2),1); 44 | PP=0 45 | 46 | S2kInds=cell(n,n); % create cell structure to find all groupings as following the Stirling Numbers of the second kind 47 | gn=cell(1,n); % create a cell to save high n-order correlation functions 48 | sn2k=zeros(n,n); % just the number of unique partitions for nparts into k groups 49 | 50 | for ni=1:n 51 | tic %timing check 52 | sn2k(ni,1)=1; %initialize for 1 unique grouping of n parts into 1 group 53 | sn2k(ni,ni)=1; % initialize for 1 unique grouping of n parts into n groups 54 | 55 | S2kInds{ni,1}{1,1}=[1:ni]; 56 | 57 | for ki=2:ni 58 | %number of permutations at given Stirling's number of the second 59 | %kind 60 | 61 | sn2k(ni,ki)=sn2k(ni-1,ki-1)+ki*sn2k(ni-1,ki); 62 | 63 | temp=cell(sn2k(ni,ki),ki); 64 | 65 | ref1=S2kInds{ni-1,ki-1}; 66 | [nx1,ny1]=size(ref1); 67 | ref2=S2kInds{ni-1,ki}; 68 | [nx2,ny2]=size(ref2); 69 | 70 | for ii=1:nx1 71 | for jj=1:ki-1 72 | temp{ii,jj}=ref1{ii,jj}; 73 | end 74 | temp{ii,ki}=[ni]; 75 | end 76 | 77 | for ii=1:nx2 78 | for rr=1:ki 79 | for jj=1:ki 80 | if jj==rr 81 | temp{nx1+(ii-1)*ki+rr,jj}=[ref2{ii,jj} ni]; 82 | else 83 | temp{nx1+(ii-1)*ki+rr,jj}=ref2{ii,jj}; 84 | end 85 | end 86 | end 87 | end 88 | 89 | 90 | 91 | S2kInds{ni,ki}=temp; 92 | 93 | 94 | 95 | end 96 | 97 | indsNK=sort(nchoosek(inds,ni),2); 98 | indsNKStore{ni}=indsNK; 99 | 100 | if ni==1 101 | gntemp=zeros([1 n]); 102 | ontemp=zeros([1 n]); 103 | 104 | for aa=1:size(indsNK,1) 105 | cellInds=cell(1,ni); 106 | for ii=1:ni 107 | cellInds{ii}=indsNK(aa,ii); 108 | end 109 | 110 | 111 | 112 | if PP==1 113 | gntemp(cellInds{:})=mean(prod(data(:,indsNK(aa,:)),2),1)./NPart; 114 | ontemp(cellInds{:})=mean(prod(data(:,indsNK(aa,:)),2),1)./NPart; 115 | else 116 | gntemp(cellInds{:})=mean(prod(data(:,indsNK(aa,:)),2),1); 117 | ontemp(cellInds{:})=mean(prod(data(:,indsNK(aa,:)),2),1); 118 | end 119 | 120 | end 121 | gn{ni}=gntemp; 122 | corrn{ni}=ontemp; 123 | 124 | else 125 | gntemp=zeros(ones(1,ni).*n); 126 | ontemp=zeros(ones(1,ni).*n); 127 | 128 | for aa=1:size(indsNK,1) 129 | cellInds=cell(1,ni); 130 | for ii=1:ni 131 | cellInds{ii}=indsNK(aa,ii); 132 | end 133 | 134 | ppF=factorial(NPart)/factorial(NPart-length(indsNK(aa,:))); 135 | if PP==1 136 | gntemp(cellInds{:})=mean(prod(data(:,indsNK(aa,:)),2),1)./ppF; 137 | ontemp(cellInds{:})=mean(prod(data(:,indsNK(aa,:)),2),1)./ppF; 138 | else 139 | gntemp(cellInds{:})=mean(prod(data(:,indsNK(aa,:)),2),1); 140 | ontemp(cellInds{:})=mean(prod(data(:,indsNK(aa,:)),2),1); 141 | end 142 | %gn{ni}=gntemp; 143 | 144 | for s2ni=2:ni 145 | tempCell=S2kInds{ni,s2ni}; 146 | [nterms, nmult]=size(tempCell); 147 | for nti=1:nterms 148 | tempVal=1; 149 | %smult=13; 150 | for nmi=1:nmult 151 | indTerms=tempCell{nti,nmi}; 152 | refGn=gn{length(indTerms)}; 153 | %smult=smult-length(indTerms); % from philipp's paper if I'm doing it right 154 | 155 | cellInds2=cell(1,length(indTerms)); 156 | for ii=1:length(indTerms) 157 | cellInds2{ii}=indsNK(aa,indTerms(ii)); 158 | end 159 | 160 | 161 | tempVal=tempVal.*refGn(cellInds2{:}); 162 | 163 | %tempVal=tempVal.*refGn(cellInds2{:}); 164 | 165 | end 166 | 167 | gntemp(cellInds{:})=gntemp(cellInds{:})-tempVal; 168 | end 169 | 170 | end 171 | end 172 | 173 | gn{ni}=gntemp; 174 | corrn{ni}=ontemp; 175 | end 176 | 177 | toc 178 | end 179 | 180 | 181 | %end 182 | %% 183 | 184 | for nn=1:n 185 | ppF=factorial(NPart)/factorial(NPart-nn); 186 | if PP==1 187 | temp=gn{nn}.*ppF; 188 | else 189 | temp=gn{nn}.*1; 190 | end 191 | % tempPP=gnPP{nn}.*ppF; 192 | 193 | gnmean(1,nn)=mean(abs(temp(find(abs(temp)>0)))); 194 | % gnmeanPP(ff,nn)=mean(abs(tempPP(find(abs(tempPP)>0)))); 195 | end 196 | %end -------------------------------------------------------------------------------- /functions/dynBldGnFxFsPP.m: -------------------------------------------------------------------------------- 1 | function [sn2k,S2kInds,indsNKStore,corrn,gn] = dynBldGnFxFsPP(data,n,inds,PP) 2 | 3 | %inds=1:nsites; % set the inds over which to find the correlations from the ground up 4 | %basis=BasisMake(nsites,nsites); % example data set that is the infinite temperature ensemble for BH 5 | %{ 6 | nsep=6; 7 | if nsites>nsep 8 | basis=BasisMake(nsep,nsep); % example data set that is the infinite temperature ensemble for BH 9 | basis2=BasisMake(nsites-nsep,nsites-nsep); 10 | data=[]; 11 | for bb=1:size(basis,1) 12 | data=[data; ones(size(basis2,1),1)*basis(bb,:) basis2]; 13 | end 14 | else 15 | data=BasisMake(nsites,nsites); 16 | end 17 | %} 18 | %{ 19 | data=zeros(3,n); 20 | data(1,1:2:end)=2; 21 | data(2,2:2:end)=2; 22 | data(3,:)=1; 23 | %} 24 | %{ 25 | nconsv=[2E1 1E2 1E3 1E4 1E5]; 26 | for nc=1:length(nconsv) 27 | clearvars -except nconsv nc gnmean 28 | test=randi([1 12],12,nconsv(nc)); 29 | size(test) 30 | datatest=zeros(size(test)); 31 | for jj=1:size(test,2) 32 | for ii=1:size(test,1) 33 | datatest(test(ii,jj),jj)=datatest(test(ii,jj),jj)+1; 34 | end 35 | end 36 | 37 | 38 | %data=datanew; 39 | data=datatest'; 40 | n=8 41 | inds=1:12 42 | %} 43 | NPart=mean(sum(data,2),1); 44 | %PP=1 45 | 46 | S2kInds=cell(n,n); % create cell structure to find all groupings as following the Stirling Numbers of the second kind 47 | gn=cell(1,n); % create a cell to save high n-order correlation functions 48 | sn2k=zeros(n,n); % just the number of unique partitions for nparts into k groups 49 | 50 | for ni=1:n 51 | tic %timing check 52 | sn2k(ni,1)=1; %initialize for 1 unique grouping of n parts into 1 group 53 | sn2k(ni,ni)=1; % initialize for 1 unique grouping of n parts into n groups 54 | 55 | S2kInds{ni,1}{1,1}=[1:ni]; 56 | 57 | for ki=2:ni 58 | %number of permutations at given Stirling's number of the second 59 | %kind 60 | 61 | sn2k(ni,ki)=sn2k(ni-1,ki-1)+ki*sn2k(ni-1,ki); 62 | 63 | temp=cell(sn2k(ni,ki),ki); 64 | 65 | ref1=S2kInds{ni-1,ki-1}; 66 | [nx1,ny1]=size(ref1); 67 | ref2=S2kInds{ni-1,ki}; 68 | [nx2,ny2]=size(ref2); 69 | 70 | for ii=1:nx1 71 | for jj=1:ki-1 72 | temp{ii,jj}=ref1{ii,jj}; 73 | end 74 | temp{ii,ki}=[ni]; 75 | end 76 | 77 | for ii=1:nx2 78 | for rr=1:ki 79 | for jj=1:ki 80 | if jj==rr 81 | temp{nx1+(ii-1)*ki+rr,jj}=[ref2{ii,jj} ni]; 82 | else 83 | temp{nx1+(ii-1)*ki+rr,jj}=ref2{ii,jj}; 84 | end 85 | end 86 | end 87 | end 88 | 89 | 90 | 91 | S2kInds{ni,ki}=temp; 92 | 93 | 94 | 95 | end 96 | 97 | indsNK=sort(nchoosek(inds,ni),2); 98 | indsNKStore{ni}=indsNK; 99 | 100 | if ni==1 101 | gntemp=zeros([1 n]); 102 | ontemp=zeros([1 n]); 103 | 104 | for aa=1:size(indsNK,1) 105 | cellInds=cell(1,ni); 106 | for ii=1:ni 107 | cellInds{ii}=indsNK(aa,ii); 108 | end 109 | 110 | 111 | 112 | if PP==1 113 | gntemp(cellInds{:})=mean(prod(data(:,indsNK(aa,:)),2),1)./NPart; 114 | ontemp(cellInds{:})=mean(prod(data(:,indsNK(aa,:)),2),1)./NPart; 115 | else 116 | gntemp(cellInds{:})=mean(prod(data(:,indsNK(aa,:)),2),1); 117 | ontemp(cellInds{:})=mean(prod(data(:,indsNK(aa,:)),2),1); 118 | end 119 | 120 | end 121 | gn{ni}=gntemp; 122 | corrn{ni}=ontemp; 123 | 124 | else 125 | gntemp=zeros(ones(1,ni).*n); 126 | ontemp=zeros(ones(1,ni).*n); 127 | 128 | for aa=1:size(indsNK,1) 129 | cellInds=cell(1,ni); 130 | for ii=1:ni 131 | cellInds{ii}=indsNK(aa,ii); 132 | end 133 | 134 | ppF=factorial(NPart)/factorial(NPart-length(indsNK(aa,:))); 135 | if PP==1 136 | gntemp(cellInds{:})=mean(prod(data(:,indsNK(aa,:)),2),1)./ppF; 137 | ontemp(cellInds{:})=mean(prod(data(:,indsNK(aa,:)),2),1)./ppF; 138 | else 139 | gntemp(cellInds{:})=mean(prod(data(:,indsNK(aa,:)),2),1); 140 | ontemp(cellInds{:})=mean(prod(data(:,indsNK(aa,:)),2),1); 141 | end 142 | %gn{ni}=gntemp; 143 | 144 | for s2ni=2:ni 145 | tempCell=S2kInds{ni,s2ni}; 146 | [nterms, nmult]=size(tempCell); 147 | for nti=1:nterms 148 | tempVal=1; 149 | %smult=13; 150 | for nmi=1:nmult 151 | indTerms=tempCell{nti,nmi}; 152 | refGn=gn{length(indTerms)}; 153 | %smult=smult-length(indTerms); % from philipp's paper if I'm doing it right 154 | 155 | cellInds2=cell(1,length(indTerms)); 156 | for ii=1:length(indTerms) 157 | cellInds2{ii}=indsNK(aa,indTerms(ii)); 158 | end 159 | 160 | 161 | tempVal=tempVal.*refGn(cellInds2{:}); 162 | 163 | %tempVal=tempVal.*refGn(cellInds2{:}); 164 | 165 | end 166 | 167 | gntemp(cellInds{:})=gntemp(cellInds{:})-tempVal; 168 | end 169 | 170 | end 171 | end 172 | 173 | gn{ni}=gntemp; 174 | corrn{ni}=ontemp; 175 | end 176 | 177 | toc 178 | end 179 | 180 | 181 | %end 182 | %% 183 | %{ 184 | for nn=1:n 185 | ppF=factorial(NPart)/factorial(NPart-nn); 186 | if PP==1 187 | temp=gn{nn}.*ppF; 188 | else 189 | temp=gn{nn}.*1; 190 | end 191 | % tempPP=gnPP{nn}.*ppF; 192 | 193 | gnmean(nc,nn)=mean(abs(temp(find(abs(temp)>0)))); 194 | % gnmeanPP(ff,nn)=mean(abs(tempPP(find(abs(tempPP)>0)))); 195 | end 196 | %} 197 | end -------------------------------------------------------------------------------- /functions/dynBldGnFxFsPPMap.m: -------------------------------------------------------------------------------- 1 | function [sn2k,S2kInds,indsNKStore,corrn,gn] = dynBldGnFxFsPPMap(data,n,inds,PP) 2 | 3 | NPart=mean(sum(data,2),1); 4 | %PP=1 5 | 6 | S2kInds=cell(n,n); % create cell structure to find all groupings as following the Stirling Numbers of the second kind 7 | gn=cell(1,n); % create a cell to save high n-order correlation functions 8 | sn2k=zeros(n,n); % just the number of unique partitions for nparts into k groups 9 | 10 | for ni=1:n 11 | tic %timing check 12 | sn2k(ni,1)=1; %initialize for 1 unique grouping of n parts into 1 group 13 | sn2k(ni,ni)=1; % initialize for 1 unique grouping of n parts into n groups 14 | 15 | S2kInds{ni,1}{1,1}=[1:ni]; 16 | 17 | for ki=2:ni 18 | %number of permutations at given Stirling's number of the second 19 | %kind 20 | 21 | sn2k(ni,ki)=sn2k(ni-1,ki-1)+ki*sn2k(ni-1,ki); 22 | 23 | temp=cell(sn2k(ni,ki),ki); 24 | 25 | ref1=S2kInds{ni-1,ki-1}; 26 | [nx1,ny1]=size(ref1); 27 | ref2=S2kInds{ni-1,ki}; 28 | [nx2,ny2]=size(ref2); 29 | 30 | for ii=1:nx1 31 | for jj=1:ki-1 32 | temp{ii,jj}=ref1{ii,jj}; 33 | end 34 | temp{ii,ki}=[ni]; 35 | end 36 | 37 | for ii=1:nx2 38 | for rr=1:ki 39 | for jj=1:ki 40 | if jj==rr 41 | temp{nx1+(ii-1)*ki+rr,jj}=[ref2{ii,jj} ni]; 42 | else 43 | temp{nx1+(ii-1)*ki+rr,jj}=ref2{ii,jj}; 44 | end 45 | end 46 | end 47 | end 48 | 49 | 50 | 51 | S2kInds{ni,ki}=temp; 52 | 53 | 54 | 55 | end 56 | 57 | indsNK=sort(nchoosek(inds,ni),2); 58 | indsNKStore{ni}=indsNK; 59 | 60 | if ni==1 61 | %gntemp=zeros([1 n]); 62 | %ontemp=zeros([1 n]); 63 | gnTemp=containers.Map(); 64 | onTemp=containers.Map(); 65 | 66 | for aa=1:size(indsNK,1) 67 | 68 | cellIndsStr=num2str(indsNK(aa,:)); 69 | 70 | %gnTemp(cellIndsStr)=mean(prod(data(:,indsNK(aa,:)),2),1); 71 | %onTemp(cellIndsStr)=mean(prod(data(:,indsNK(aa,:)),2),1); 72 | 73 | if PP==1 74 | gnTemp(cellIndsStr)=mean(prod(data(:,indsNK(aa,:)),2),1)./NPart; 75 | onTemp(cellIndsStr)=mean(prod(data(:,indsNK(aa,:)),2),1)./NPart; 76 | else 77 | gnTemp(cellIndsStr)=mean(prod(data(:,indsNK(aa,:)),2),1); 78 | onTemp(cellIndsStr)=mean(prod(data(:,indsNK(aa,:)),2),1); 79 | end 80 | end 81 | %gn{ni}=gntemp; 82 | %corrn{ni}=ontemp; 83 | 84 | gn{ni}=gnTemp; 85 | corrn{ni}=onTemp; 86 | 87 | else 88 | %gntemp=zeros(ones(1,ni).*n); 89 | %ontemp=zeros(ones(1,ni).*n); 90 | 91 | gnTemp=containers.Map(); 92 | onTemp=containers.Map(); 93 | 94 | 95 | for aa=1:size(indsNK,1) 96 | 97 | cellIndsStr=num2str(indsNK(aa,:)); 98 | 99 | %gnTemp(cellIndsStr)=mean(prod(data(:,indsNK(aa,:)),2),1); 100 | %onTemp(cellIndsStr)=mean(prod(data(:,indsNK(aa,:)),2),1); 101 | 102 | ppF=factorial(NPart)/factorial(NPart-length(indsNK(aa,:))); 103 | if PP==1 104 | gnTemp(cellIndsStr)=mean(prod(data(:,indsNK(aa,:)),2),1)./ppF; 105 | onTemp(cellIndsStr)=mean(prod(data(:,indsNK(aa,:)),2),1)./ppF; 106 | else 107 | gnTemp(cellIndsStr)=mean(prod(data(:,indsNK(aa,:)),2),1); 108 | onTemp(cellIndsStr)=mean(prod(data(:,indsNK(aa,:)),2),1); 109 | end 110 | 111 | 112 | for s2ni=2:ni 113 | tempCell=S2kInds{ni,s2ni}; 114 | [nterms, nmult]=size(tempCell); 115 | for nti=1:nterms 116 | tempVal=1; 117 | 118 | for nmi=1:nmult 119 | indTerms=tempCell{nti,nmi}; 120 | refGn=gn{length(indTerms)}; 121 | 122 | cellIndsStr2=num2str(indsNK(aa,indTerms(:))); 123 | 124 | tempVal=tempVal.*refGn(cellIndsStr2); 125 | end 126 | 127 | %gntemp(cellInds{:})=gntemp(cellInds{:})-tempVal; 128 | gnTemp(cellIndsStr)=gnTemp(cellIndsStr)-tempVal; 129 | end 130 | 131 | end 132 | end 133 | 134 | gn{ni}=gnTemp; 135 | corrn{ni}=onTemp; 136 | end 137 | 138 | toc 139 | end 140 | 141 | 142 | end 143 | %% 144 | %{ 145 | for nn=1:n 146 | ppF=factorial(NPart)/factorial(NPart-nn); 147 | if PP==1 148 | temp=gn{nn}.*ppF; 149 | else 150 | temp=gn{nn}.*1; 151 | end 152 | % tempPP=gnPP{nn}.*ppF; 153 | 154 | gnmean(nc,nn)=mean(abs(temp(find(abs(temp)>0)))); 155 | % gnmeanPP(ff,nn)=mean(abs(tempPP(find(abs(tempPP)>0)))); 156 | end 157 | %} 158 | %end -------------------------------------------------------------------------------- /functions/dynBldGnFxFsPPMap.m~: -------------------------------------------------------------------------------- 1 | function [sn2k,S2kInds,indsNKStore,corrn,gn] = dynBldGnFxFsPPMap(data,n,inds,PP) 2 | 3 | NPart=mean(sum(data,2),1); 4 | %PP=1 5 | 6 | S2kInds=cell(n,n); % create cell structure to find all groupings as following the Stirling Numbers of the second kind 7 | gn=cell(1,n); % create a cell to save high n-order correlation functions 8 | sn2k=zeros(n,n); % just the number of unique partitions for nparts into k groups 9 | 10 | for ni=1:n 11 | tic %timing check 12 | sn2k(ni,1)=1; %initialize for 1 unique grouping of n parts into 1 group 13 | sn2k(ni,ni)=1; % initialize for 1 unique grouping of n parts into n groups 14 | 15 | S2kInds{ni,1}{1,1}=[1:ni]; 16 | 17 | for ki=2:ni 18 | %number of permutations at given Stirling's number of the second 19 | %kind 20 | 21 | sn2k(ni,ki)=sn2k(ni-1,ki-1)+ki*sn2k(ni-1,ki); 22 | 23 | temp=cell(sn2k(ni,ki),ki); 24 | 25 | ref1=S2kInds{ni-1,ki-1}; 26 | [nx1,ny1]=size(ref1); 27 | ref2=S2kInds{ni-1,ki}; 28 | [nx2,ny2]=size(ref2); 29 | 30 | for ii=1:nx1 31 | for jj=1:ki-1 32 | temp{ii,jj}=ref1{ii,jj}; 33 | end 34 | temp{ii,ki}=[ni]; 35 | end 36 | 37 | for ii=1:nx2 38 | for rr=1:ki 39 | for jj=1:ki 40 | if jj==rr 41 | temp{nx1+(ii-1)*ki+rr,jj}=[ref2{ii,jj} ni]; 42 | else 43 | temp{nx1+(ii-1)*ki+rr,jj}=ref2{ii,jj}; 44 | end 45 | end 46 | end 47 | end 48 | 49 | 50 | 51 | S2kInds{ni,ki}=temp; 52 | 53 | 54 | 55 | end 56 | 57 | indsNK=sort(nchoosek(inds,ni),2); 58 | indsNKStore{ni}=indsNK; 59 | 60 | if ni==1 61 | %gntemp=zeros([1 n]); 62 | %ontemp=zeros([1 n]); 63 | gnTemp=containers.Map(); 64 | onTemp=containers.Map(); 65 | 66 | for aa=1:size(indsNK,1) 67 | 68 | cellIndsStr=num2str(indsNK(aa,:)); 69 | 70 | %gnTemp(cellIndsStr)=mean(prod(data(:,indsNK(aa,:)),2),1); 71 | %onTemp(cellIndsStr)=mean(prod(data(:,indsNK(aa,:)),2),1); 72 | 73 | if PP==1 74 | gnTemp(cellIndsStr)=mean(prod(data(:,indsNK(aa,:)),2),1)./NPart; 75 | onTemp(cellIndsStr)=mean(prod(data(:,indsNK(aa,:)),2),1)./NPart; 76 | else 77 | gnTemp(cellIndsStr)=mean(prod(data(:,indsNK(aa,:)),2),1); 78 | onTemp(cellIndsStr)=mean(prod(data(:,indsNK(aa,:)),2),1); 79 | end 80 | end 81 | %gn{ni}=gntemp; 82 | %corrn{ni}=ontemp; 83 | 84 | gn{ni}=gnTemp; 85 | corrn{ni}=onTemp; 86 | 87 | else 88 | %gntemp=zeros(ones(1,ni).*n); 89 | %ontemp=zeros(ones(1,ni).*n); 90 | 91 | gnTemp=containers.Map(); 92 | onTemp=containers.Map(); 93 | 94 | 95 | for aa=1:size(indsNK,1) 96 | 97 | cellIndsStr=num2str(indsNK(aa,:)); 98 | 99 | gnTemp(cellIndsStr)=mean(prod(data(:,indsNK(aa,:)),2),1); 100 | onTemp(cellIndsStr)=mean(prod(data(:,indsNK(aa,:)),2),1); 101 | 102 | ppF=factorial(NPart)/factorial(NPart-length(indsNK(aa,:))); 103 | if PP==1 104 | gntemp(cellInds{:})=mean(prod(data(:,indsNK(aa,:)),2),1)./ppF; 105 | ontemp(cellInds{:})=mean(prod(data(:,indsNK(aa,:)),2),1)./ppF; 106 | else 107 | gntemp(cellInds{:})=mean(prod(data(:,indsNK(aa,:)),2),1); 108 | ontemp(cellInds{:})=mean(prod(data(:,indsNK(aa,:)),2),1); 109 | end 110 | 111 | 112 | for s2ni=2:ni 113 | tempCell=S2kInds{ni,s2ni}; 114 | [nterms, nmult]=size(tempCell); 115 | for nti=1:nterms 116 | tempVal=1; 117 | 118 | for nmi=1:nmult 119 | indTerms=tempCell{nti,nmi}; 120 | refGn=gn{length(indTerms)}; 121 | 122 | cellIndsStr2=num2str(indsNK(aa,indTerms(:))); 123 | 124 | tempVal=tempVal.*refGn(cellIndsStr2); 125 | end 126 | 127 | %gntemp(cellInds{:})=gntemp(cellInds{:})-tempVal; 128 | gnTemp(cellIndsStr)=gnTemp(cellIndsStr)-tempVal; 129 | end 130 | 131 | end 132 | end 133 | 134 | gn{ni}=gnTemp; 135 | corrn{ni}=onTemp; 136 | end 137 | 138 | toc 139 | end 140 | 141 | 142 | end 143 | %% 144 | %{ 145 | for nn=1:n 146 | ppF=factorial(NPart)/factorial(NPart-nn); 147 | if PP==1 148 | temp=gn{nn}.*ppF; 149 | else 150 | temp=gn{nn}.*1; 151 | end 152 | % tempPP=gnPP{nn}.*ppF; 153 | 154 | gnmean(nc,nn)=mean(abs(temp(find(abs(temp)>0)))); 155 | % gnmeanPP(ff,nn)=mean(abs(tempPP(find(abs(tempPP)>0)))); 156 | end 157 | %} 158 | %end -------------------------------------------------------------------------------- /functions/dynBldGnFxFsPPMapPDF.m: -------------------------------------------------------------------------------- 1 | function [sn2k,S2kInds,indsNKStore,corrn,gn] = dynBldGnFxFsPPMapPDF(pdf,basis,n,inds,PP) 2 | 3 | NPart=mean(sum(basis,2),1); 4 | %PP=1 5 | 6 | S2kInds=cell(n,n); % create cell structure to find all groupings as following the Stirling Numbers of the second kind 7 | gn=cell(1,n); % create a cell to save high n-order correlation functions 8 | sn2k=zeros(n,n); % just the number of unique partitions for nparts into k groups 9 | 10 | for ni=1:n 11 | %tic %timing check 12 | sn2k(ni,1)=1; %initialize for 1 unique grouping of n parts into 1 group 13 | sn2k(ni,ni)=1; % initialize for 1 unique grouping of n parts into n groups 14 | 15 | S2kInds{ni,1}{1,1}=[1:ni]; 16 | 17 | for ki=2:ni 18 | %number of permutations at given Stirling's number of the second 19 | %kind 20 | 21 | sn2k(ni,ki)=sn2k(ni-1,ki-1)+ki*sn2k(ni-1,ki); 22 | 23 | temp=cell(sn2k(ni,ki),ki); 24 | 25 | ref1=S2kInds{ni-1,ki-1}; 26 | [nx1,ny1]=size(ref1); 27 | ref2=S2kInds{ni-1,ki}; 28 | [nx2,ny2]=size(ref2); 29 | 30 | for ii=1:nx1 31 | for jj=1:ki-1 32 | temp{ii,jj}=ref1{ii,jj}; 33 | end 34 | temp{ii,ki}=[ni]; 35 | end 36 | 37 | for ii=1:nx2 38 | for rr=1:ki 39 | for jj=1:ki 40 | if jj==rr 41 | temp{nx1+(ii-1)*ki+rr,jj}=[ref2{ii,jj} ni]; 42 | else 43 | temp{nx1+(ii-1)*ki+rr,jj}=ref2{ii,jj}; 44 | end 45 | end 46 | end 47 | end 48 | 49 | 50 | 51 | S2kInds{ni,ki}=temp; 52 | 53 | 54 | 55 | end 56 | 57 | indsNK=sort(nchoosek(inds,ni),2); 58 | indsNKStore{ni}=indsNK; 59 | 60 | if ni==1 61 | %gntemp=zeros([1 n]); 62 | %ontemp=zeros([1 n]); 63 | gnTemp=containers.Map(); 64 | onTemp=containers.Map(); 65 | 66 | for aa=1:size(indsNK,1) 67 | 68 | cellIndsStr=num2str(indsNK(aa,:)); 69 | 70 | %gnTemp(cellIndsStr)=sum(pdf.*prod(basis(:,indsNK(aa,:)),2),1); 71 | %onTemp(cellIndsStr)=sum(pdf.*prod(basis(:,indsNK(aa,:)),2),1); 72 | 73 | if PP==1 74 | gnTemp(cellIndsStr)=sum(pdf.*prod(basis(:,indsNK(aa,:)),2),1)./NPart; 75 | onTemp(cellIndsStr)=sum(pdf.*prod(basis(:,indsNK(aa,:)),2),1)./NPart; 76 | else 77 | gnTemp(cellIndsStr)=sum(pdf.*prod(basis(:,indsNK(aa,:)),2),1); 78 | onTemp(cellIndsStr)=sum(pdf.*prod(basis(:,indsNK(aa,:)),2),1); 79 | end 80 | end 81 | %gn{ni}=gntemp; 82 | %corrn{ni}=ontemp; 83 | 84 | gn{ni}=gnTemp; 85 | corrn{ni}=onTemp; 86 | 87 | else 88 | %gntemp=zeros(ones(1,ni).*n); 89 | %ontemp=zeros(ones(1,ni).*n); 90 | 91 | gnTemp=containers.Map(); 92 | onTemp=containers.Map(); 93 | 94 | 95 | for aa=1:size(indsNK,1) 96 | 97 | cellIndsStr=num2str(indsNK(aa,:)); 98 | 99 | %gnTemp(cellIndsStr)=sum(pdf.*prod(basis(:,indsNK(aa,:)),2),1); 100 | %onTemp(cellIndsStr)=sum(pdf.*prod(basis(:,indsNK(aa,:)),2),1); 101 | 102 | ppF=factorial(NPart)/factorial(NPart-length(indsNK(aa,:))); 103 | if PP==1 104 | gnTemp(cellIndsStr)=sum(pdf.*prod(basis(:,indsNK(aa,:)),2),1)./ppF; 105 | onTemp(cellIndsStr)=sum(pdf.*prod(basis(:,indsNK(aa,:)),2),1)./ppF; 106 | else 107 | gnTemp(cellIndsStr)=sum(pdf.*prod(basis(:,indsNK(aa,:)),2),1); 108 | onTemp(cellIndsStr)=sum(pdf.*prod(basis(:,indsNK(aa,:)),2),1); 109 | end 110 | 111 | for s2ni=2:ni 112 | tempCell=S2kInds{ni,s2ni}; 113 | [nterms, nmult]=size(tempCell); 114 | for nti=1:nterms 115 | tempVal=1; 116 | %smult=13; 117 | for nmi=1:nmult 118 | indTerms=tempCell{nti,nmi}; 119 | refGn=gn{length(indTerms)}; 120 | 121 | cellIndsStr2=num2str(indsNK(aa,indTerms(:))); 122 | 123 | tempVal=tempVal.*refGn(cellIndsStr2); 124 | end 125 | 126 | %gntemp(cellInds{:})=gntemp(cellInds{:})-tempVal; 127 | gnTemp(cellIndsStr)=gnTemp(cellIndsStr)-tempVal; 128 | end 129 | 130 | end 131 | end 132 | 133 | gn{ni}=gnTemp; 134 | corrn{ni}=onTemp; 135 | end 136 | 137 | %toc 138 | end 139 | 140 | end -------------------------------------------------------------------------------- /functions/dynBldGnFxFsPPMapPDF.m~: -------------------------------------------------------------------------------- 1 | function [sn2k,S2kInds,indsNKStore,corrn,gn] = dynBldGnFxFsPPMapPDF(pdf,basis,n,inds,PP) 2 | 3 | NPart=mean(sum(basis,2),1); 4 | %PP=1 5 | 6 | S2kInds=cell(n,n); % create cell structure to find all groupings as following the Stirling Numbers of the second kind 7 | gn=cell(1,n); % create a cell to save high n-order correlation functions 8 | sn2k=zeros(n,n); % just the number of unique partitions for nparts into k groups 9 | 10 | for ni=1:n 11 | tic %timing check 12 | sn2k(ni,1)=1; %initialize for 1 unique grouping of n parts into 1 group 13 | sn2k(ni,ni)=1; % initialize for 1 unique grouping of n parts into n groups 14 | 15 | S2kInds{ni,1}{1,1}=[1:ni]; 16 | 17 | for ki=2:ni 18 | %number of permutations at given Stirling's number of the second 19 | %kind 20 | 21 | sn2k(ni,ki)=sn2k(ni-1,ki-1)+ki*sn2k(ni-1,ki); 22 | 23 | temp=cell(sn2k(ni,ki),ki); 24 | 25 | ref1=S2kInds{ni-1,ki-1}; 26 | [nx1,ny1]=size(ref1); 27 | ref2=S2kInds{ni-1,ki}; 28 | [nx2,ny2]=size(ref2); 29 | 30 | for ii=1:nx1 31 | for jj=1:ki-1 32 | temp{ii,jj}=ref1{ii,jj}; 33 | end 34 | temp{ii,ki}=[ni]; 35 | end 36 | 37 | for ii=1:nx2 38 | for rr=1:ki 39 | for jj=1:ki 40 | if jj==rr 41 | temp{nx1+(ii-1)*ki+rr,jj}=[ref2{ii,jj} ni]; 42 | else 43 | temp{nx1+(ii-1)*ki+rr,jj}=ref2{ii,jj}; 44 | end 45 | end 46 | end 47 | end 48 | 49 | 50 | 51 | S2kInds{ni,ki}=temp; 52 | 53 | 54 | 55 | end 56 | 57 | indsNK=sort(nchoosek(inds,ni),2); 58 | indsNKStore{ni}=indsNK; 59 | 60 | if ni==1 61 | %gntemp=zeros([1 n]); 62 | %ontemp=zeros([1 n]); 63 | gnTemp=containers.Map(); 64 | onTemp=containers.Map(); 65 | 66 | for aa=1:size(indsNK,1) 67 | 68 | cellIndsStr=num2str(indsNK(aa,:)); 69 | 70 | %gnTemp(cellIndsStr)=sum(pdf.*prod(basis(:,indsNK(aa,:)),2),1); 71 | %onTemp(cellIndsStr)=sum(pdf.*prod(basis(:,indsNK(aa,:)),2),1); 72 | 73 | if PP==1 74 | gnTemp(cellIndsStr)=mean(prod(data(:,indsNK(aa,:)),2),1)./NPart; 75 | onTemp(cellIndsStr)=mean(prod(data(:,indsNK(aa,:)),2),1)./NPart; 76 | else 77 | gnTemp(cellIndsStr)=sum(pdf.*prod(basis(:,indsNK(aa,:)),2),1); 78 | onTemp(cellIndsStr)=sum(pdf.*prod(basis(:,indsNK(aa,:)),2),1); 79 | end 80 | end 81 | %gn{ni}=gntemp; 82 | %corrn{ni}=ontemp; 83 | 84 | gn{ni}=gnTemp; 85 | corrn{ni}=onTemp; 86 | 87 | else 88 | %gntemp=zeros(ones(1,ni).*n); 89 | %ontemp=zeros(ones(1,ni).*n); 90 | 91 | gnTemp=containers.Map(); 92 | onTemp=containers.Map(); 93 | 94 | 95 | for aa=1:size(indsNK,1) 96 | 97 | cellIndsStr=num2str(indsNK(aa,:)); 98 | 99 | %gnTemp(cellIndsStr)=sum(pdf.*prod(basis(:,indsNK(aa,:)),2),1); 100 | %onTemp(cellIndsStr)=sum(pdf.*prod(basis(:,indsNK(aa,:)),2),1); 101 | 102 | ppF=factorial(NPart)/factorial(NPart-length(indsNK(aa,:))); 103 | if PP==1 104 | gnTemp(cellIndsStr)=sum(pdf.*prod(basis(:,indsNK(aa,:)),2),1)./ppF; 105 | onTemp(cellIndsStr)=sum(pdf.*prod(basis(:,indsNK(aa,:)),2),1)./ppF; 106 | else 107 | gnTemp(cellIndsStr)=sum(pdf.*prod(basis(:,indsNK(aa,:)),2),1); 108 | onTemp(cellIndsStr)=sum(pdf.*prod(basis(:,indsNK(aa,:)),2),1); 109 | end 110 | 111 | for s2ni=2:ni 112 | tempCell=S2kInds{ni,s2ni}; 113 | [nterms, nmult]=size(tempCell); 114 | for nti=1:nterms 115 | tempVal=1; 116 | %smult=13; 117 | for nmi=1:nmult 118 | indTerms=tempCell{nti,nmi}; 119 | refGn=gn{length(indTerms)}; 120 | 121 | cellIndsStr2=num2str(indsNK(aa,indTerms(:))); 122 | 123 | tempVal=tempVal.*refGn(cellIndsStr2); 124 | end 125 | 126 | %gntemp(cellInds{:})=gntemp(cellInds{:})-tempVal; 127 | gnTemp(cellIndsStr)=gnTemp(cellIndsStr)-tempVal; 128 | end 129 | 130 | end 131 | end 132 | 133 | gn{ni}=gnTemp; 134 | corrn{ni}=onTemp; 135 | end 136 | 137 | toc 138 | end 139 | 140 | end -------------------------------------------------------------------------------- /functions/dynBldGnFxFsPPMapPF.m: -------------------------------------------------------------------------------- 1 | function gn = dynBldGnFxFsPPMap(data,n,inds,PP) 2 | 3 | %inds=1:nsites; % set the inds over which to find the correlations from the ground up 4 | %basis=BasisMake(nsites,nsites); % example data set that is the infinite temperature ensemble for BH 5 | %{ 6 | nsep=6; 7 | if nsites>nsep 8 | basis=BasisMake(nsep,nsep); % example data set that is the infinite temperature ensemble for BH 9 | basis2=BasisMake(nsites-nsep,nsites-nsep); 10 | data=[]; 11 | for bb=1:size(basis,1) 12 | data=[data; ones(size(basis2,1),1)*basis(bb,:) basis2]; 13 | end 14 | else 15 | data=BasisMake(nsites,nsites); 16 | end 17 | %} 18 | %{ 19 | data=zeros(3,n); 20 | data(1,1:2:end)=2; 21 | data(2,2:2:end)=2; 22 | data(3,:)=1; 23 | %} 24 | 25 | %nconsv=[2E1 1E2 1E3 1E4 1E5]; 26 | %for nc=1:length(nconsv) 27 | % clearvars -except nconsv nc gnmean 28 | %test=randi([1 12],12,nconsv(nc)); 29 | 30 | %{ 31 | test=randi([1 12],12,[2E2]); 32 | size(test) 33 | datatest=zeros(size(test)); 34 | for jj=1:size(test,2) 35 | for ii=1:size(test,1) 36 | datatest(test(ii,jj),jj)=datatest(test(ii,jj),jj)+1; 37 | end 38 | end 39 | PP=0 40 | 41 | 42 | data=datanew; 43 | data=datatest'; 44 | n=8 45 | inds=1:12 46 | %} 47 | 48 | NPart=mean(sum(data,2),1); 49 | %PP=1 50 | 51 | S2kInds=cell(n,n); % create cell structure to find all groupings as following the Stirling Numbers of the second kind 52 | gn=cell(1,n); % create a cell to save high n-order correlation functions 53 | sn2k=zeros(n,n); % just the number of unique partitions for nparts into k groups 54 | 55 | for ni=1:n 56 | tic %timing check 57 | sn2k(ni,1)=1; %initialize for 1 unique grouping of n parts into 1 group 58 | sn2k(ni,ni)=1; % initialize for 1 unique grouping of n parts into n groups 59 | 60 | S2kInds{ni,1}{1,1}=[1:ni]; 61 | 62 | for ki=2:ni 63 | %number of permutations at given Stirling's number of the second 64 | %kind 65 | 66 | sn2k(ni,ki)=sn2k(ni-1,ki-1)+ki*sn2k(ni-1,ki); 67 | 68 | temp=cell(sn2k(ni,ki),ki); 69 | 70 | ref1=S2kInds{ni-1,ki-1}; 71 | [nx1,ny1]=size(ref1); 72 | ref2=S2kInds{ni-1,ki}; 73 | [nx2,ny2]=size(ref2); 74 | 75 | for ii=1:nx1 76 | for jj=1:ki-1 77 | temp{ii,jj}=ref1{ii,jj}; 78 | end 79 | temp{ii,ki}=[ni]; 80 | end 81 | 82 | for ii=1:nx2 83 | for rr=1:ki 84 | for jj=1:ki 85 | if jj==rr 86 | temp{nx1+(ii-1)*ki+rr,jj}=[ref2{ii,jj} ni]; 87 | else 88 | temp{nx1+(ii-1)*ki+rr,jj}=ref2{ii,jj}; 89 | end 90 | end 91 | end 92 | end 93 | 94 | 95 | 96 | S2kInds{ni,ki}=temp; 97 | 98 | 99 | 100 | end 101 | 102 | indsNK=sort(nchoosek(inds,ni),2); 103 | indsNKStore{ni}=indsNK; 104 | 105 | if ni==1 106 | %gntemp=zeros([1 n]); 107 | %ontemp=zeros([1 n]); 108 | gnTemp=containers.Map(); 109 | onTemp=containers.Map(); 110 | 111 | for aa=1:size(indsNK,1) 112 | %{ 113 | cellInds=cell(1,ni); 114 | 115 | for ii=1:ni 116 | cellInds{ii}=indsNK(aa,ii); 117 | end 118 | %} 119 | cellIndsStr=num2str(indsNK(aa,:)); 120 | 121 | %{ 122 | if PP==1 123 | %gntemp(cellInds{:})=mean(prod(data(:,indsNK(aa,:)),2),1)./NPart; 124 | %ontemp(cellInds{:})=mean(prod(data(:,indsNK(aa,:)),2),1)./NPart; 125 | gnTemp(cellIndsStr)=mean(prod(data(:,indsNK(aa,:)),2),1)./NPart; 126 | onTemp(cellIndsStr)=mean(prod(data(:,indsNK(aa,:)),2),1)./NPart; 127 | else 128 | %gntemp(cellInds{:})=mean(prod(data(:,indsNK(aa,:)),2),1); 129 | %ontemp(cellInds{:})=mean(prod(data(:,indsNK(aa,:)),2),1); 130 | 131 | gnTemp(cellIndsStr)=mean(prod(data(:,indsNK(aa,:)),2),1); 132 | onTemp(cellIndsStr)=mean(prod(data(:,indsNK(aa,:)),2),1); 133 | end 134 | %} 135 | gnTemp(cellIndsStr)=mean(prod(data(:,indsNK(aa,:)),2),1); 136 | onTemp(cellIndsStr)=mean(prod(data(:,indsNK(aa,:)),2),1); 137 | end 138 | %gn{ni}=gntemp; 139 | %corrn{ni}=ontemp; 140 | 141 | gn{ni}=gnTemp; 142 | corrn{ni}=onTemp; 143 | 144 | else 145 | %gntemp=zeros(ones(1,ni).*n); 146 | %ontemp=zeros(ones(1,ni).*n); 147 | 148 | gnTemp=containers.Map(); 149 | onTemp=containers.Map(); 150 | 151 | 152 | for aa=1:size(indsNK,1) 153 | %{ 154 | cellInds=cell(1,ni); 155 | for ii=1:ni 156 | cellInds{ii}=indsNK(aa,ii); 157 | end 158 | %} 159 | cellIndsStr=num2str(indsNK(aa,:)); 160 | %{ 161 | ppF=factorial(NPart)/factorial(NPart-length(indsNK(aa,:))); 162 | if PP==1 163 | %gntemp(cellInds{:})=mean(prod(data(:,indsNK(aa,:)),2),1)./ppF; 164 | %ontemp(cellInds{:})=mean(prod(data(:,indsNK(aa,:)),2),1)./ppF; 165 | 166 | gnTemp(cellIndsStr)=mean(prod(data(:,indsNK(aa,:)),2),1)./ppF; 167 | onTemp(cellIndsStr)=mean(prod(data(:,indsNK(aa,:)),2),1)./ppF; 168 | else 169 | %gntemp(cellInds{:})=mean(prod(data(:,indsNK(aa,:)),2),1); 170 | %ontemp(cellInds{:})=mean(prod(data(:,indsNK(aa,:)),2),1); 171 | 172 | gnTemp(cellIndsStr)=mean(prod(data(:,indsNK(aa,:)),2),1); 173 | onTemp(cellIndsStr)=mean(prod(data(:,indsNK(aa,:)),2),1); 174 | end 175 | %} 176 | %gn{ni}=gntemp; 177 | gnTemp(cellIndsStr)=mean(prod(data(:,indsNK(aa,:)),2),1); 178 | onTemp(cellIndsStr)=mean(prod(data(:,indsNK(aa,:)),2),1); 179 | for s2ni=2:ni 180 | tempCell=S2kInds{ni,s2ni}; 181 | [nterms, nmult]=size(tempCell); 182 | for nti=1:nterms 183 | tempVal=1; 184 | %smult=13; 185 | for nmi=1:nmult 186 | indTerms=tempCell{nti,nmi}; 187 | refGn=gn{length(indTerms)}; 188 | %smult=smult-length(indTerms); % from philipp's paper if I'm doing it right 189 | %{ 190 | cellInds2=cell(1,length(indTerms)); 191 | for ii=1:length(indTerms) 192 | cellInds2{ii}=indsNK(aa,indTerms(ii)); 193 | end 194 | %} 195 | cellIndsStr2=num2str(indsNK(aa,indTerms(:))); 196 | 197 | 198 | 199 | tempVal=tempVal.*refGn(cellIndsStr2); 200 | 201 | %tempVal=tempVal.*refGn(cellInds2{:}); 202 | 203 | end 204 | 205 | %gntemp(cellInds{:})=gntemp(cellInds{:})-tempVal; 206 | gnTemp(cellIndsStr)=gnTemp(cellIndsStr)-tempVal; 207 | end 208 | 209 | end 210 | end 211 | 212 | gn{ni}=gnTemp; 213 | corrn{ni}=onTemp; 214 | end 215 | 216 | toc 217 | end 218 | 219 | 220 | end 221 | %% 222 | %{ 223 | for nn=1:n 224 | ppF=factorial(NPart)/factorial(NPart-nn); 225 | if PP==1 226 | temp=gn{nn}.*ppF; 227 | else 228 | temp=gn{nn}.*1; 229 | end 230 | % tempPP=gnPP{nn}.*ppF; 231 | 232 | gnmean(nc,nn)=mean(abs(temp(find(abs(temp)>0)))); 233 | % gnmeanPP(ff,nn)=mean(abs(tempPP(find(abs(tempPP)>0)))); 234 | end 235 | %} 236 | %end -------------------------------------------------------------------------------- /functions/permIndsProd.m: -------------------------------------------------------------------------------- 1 | function [prodOut] = permIndsProd(dataIn,prodIn,knum,inds) 2 | 3 | if size(inds,2)~=0 4 | nkInds=nchoosek(inds,knum(1)); 5 | 6 | for nk=1:size(nkInds,1) 7 | indsOut=setdiff(inds,nkInds(nk,:)); 8 | prodOut=GnCorrDatFx(dataIn,nkInds(nk,:))*permIndsProd(dataIn,prodIn,knum(2:end),indsOut); 9 | end 10 | 11 | else 12 | prodOut=prodIn; 13 | end 14 | 15 | end -------------------------------------------------------------------------------- /imgs_for_readme/AL_IPR.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mnrispoli/MATLAB_ED_BHM/ec1770fb3d73d4bb68a50e9ce57889dcbca8c7b9/imgs_for_readme/AL_IPR.PNG -------------------------------------------------------------------------------- /infTData.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mnrispoli/MATLAB_ED_BHM/ec1770fb3d73d4bb68a50e9ce57889dcbca8c7b9/infTData.mat -------------------------------------------------------------------------------- /infT_high_order_corr.m: -------------------------------------------------------------------------------- 1 | % general ED bose-hubbard code 2 | % last cleaned up 9/24/2018 3 | % author: Matthew Rispoli 4 | 5 | addpath('functions') 6 | 7 | close all 8 | clear all 9 | clc 10 | NSites=2:8 11 | 12 | gnSave=zeros(NSites(end),NSites(end)); 13 | rhoSave=zeros(NSites(end),NSites(end)); 14 | 15 | for ns=1:length(NSites) 16 | ns 17 | 18 | basis=BasisMake(NSites(ns),NSites(ns)); 19 | nf=mean(mean(basis.^2,1)-mean(basis,1).^2,2); 20 | pn=1./size(basis,1); 21 | nord=NSites(ns); 22 | inds=1:nord; 23 | 24 | [sn2k,S2kInds,indsNKStore,corrn,gn] = dynBldGnFxFsPPMapPDF(pn,basis,nord,inds,1); 25 | 26 | for nn=1:nord 27 | gnSave(ns,nn)=mean(cell2mat(values(gn{nn}))); 28 | rhoSave(ns,nn)=mean(cell2mat(values(gn{nn}))./(sqrt(nf).^nn)); 29 | end 30 | end 31 | %% 32 | figure(1) 33 | subplot(1,2,1) 34 | imagesc(2:12,1:12,abs(gnSave(1:end-1,:)')) 35 | axis('square') 36 | colorbar() 37 | 38 | subplot(1,2,2) 39 | imagesc(2:12,1:12,abs(rhoSave(1:end-1,:)')) 40 | axis('square') 41 | colorbar() 42 | 43 | 44 | -------------------------------------------------------------------------------- /manybodyLocalizationScript.m: -------------------------------------------------------------------------------- 1 | % general ED bose-hubbard code 2 | % last cleaned up 9/24/2018 3 | % author: Matthew Rispoli 4 | 5 | %close all 6 | clear all 7 | clc 8 | 9 | addpath('functions'); 10 | %load('plot_colormaps\alex_cmap.mat'); 11 | %cmapAlex=ccs; clear ccs; 12 | 13 | % tunneling 14 | J=38.1911/1000; %8Er tunneling rate; defined in Hz/(2 pi) 15 | 16 | % disorder strengths 17 | NW=1; 18 | Ws=linspace(0,1,NW).*J.*0 % units of J 19 | % tupe of disorder 20 | isQP=1; % 0 = uniform random, 1 = FFT of disorder from exp, 2 = actual QP 21 | NB=1; 22 | GR=(1+sqrt(5))./2; 23 | BetaS=linspace(GR,GR,NB); 24 | 25 | 26 | % interaction strengths 27 | Uo=1.*2.7*J % units of J 28 | Us=ones(size(Ws)).*Uo; %make them all the same 29 | 30 | 31 | % system size parameters 32 | NPart=8 % number of bosons 33 | NSites=8 % number of sites 34 | 35 | % num of disorders and time scans 36 | ND=1; %disorder number 37 | NT=151; % time steps 38 | Ts=logspace(-1,3,NT) %actual times for ED evaluation 39 | tj=Ts.*2.*pi.*J; 40 | 41 | % periodic boundary conditions 42 | isPB = 0; % 0 = open boundary; 1 = periodic boundary 43 | jn = 1; % order of neighbor tunnelings 44 | 45 | %% 46 | 47 | % folder for storing all matrix files 48 | folderName = 'Hamiltonians/' 49 | % hamiltonian and basis parameters 50 | edFileName=[folderName sprintf('%i_sites_%i_bosons_%i_pb_%i_jn_loadme.mat',NSites,NPart,isPB,jn)] %format for Hamiltonian filename 51 | 52 | % find hilbert space dimension 53 | HilbD=HilbDim(NSites,NPart) 54 | 55 | % check if we've already made the basis and hamiltonians 56 | if exist(edFileName,'file')==2 57 | % if it exists then load 58 | load(edFileName); 59 | else 60 | % if it doesn't exist then make them all 61 | [Hi,Hj,basis] = MakeHamiltoniansAndBasis(NSites,NPart,jn,isPB); 62 | save(edFileName,'Hi','Hj','basis','NPart','NSites','jn','isPB') 63 | end 64 | 65 | %% 66 | % make giant dataStruct to save wavefunction for all disorders 67 | psiAllSave=cell(NW,ND,NB); 68 | nbarAllSave=cell(NW,ND,NB); 69 | IPRSave=zeros(NW,ND,NB); 70 | 71 | % find initial state in basis 72 | psiInit=zeros(1,HilbD); 73 | 74 | %indInit = floor(NSites/2); %single-particle initial state 75 | indInit = find(ismember(basis,ones(1,NSites),'rows')==1) % uniform density initial state 76 | psiInit(indInit) = 1; 77 | 78 | 79 | %% Dynamics from ED 80 | for ww=1:NW 81 | ww 82 | for dd=1:ND 83 | for bb=1:NB 84 | 85 | 86 | %bose hubbard parameters 87 | W=Ws(ww); 88 | U=Us(ww); 89 | 90 | %Disorder Hamiltonian 91 | isQP=1; 92 | beta=BetaS(bb); 93 | dd.*2.*pi./ND 94 | Hd=MakeDisorderHam(basis,isQP,dd,beta); 95 | 96 | Ham=J.*Hj+(U/2).*Hi+W.*Hd; 97 | try 98 | [psiAll, PhiN, En] = ExactDiagTimeFx(psiInit,Ts,Ham); 99 | catch 100 | %incase diagonalization fails it tries again with new phase 101 | Hd=MakeDisorderHam(basis,isQP,2*pi*dd/ND+0.1,beta); 102 | Ham=J.*Hj+(U/2).*Hi+W.*Hd; 103 | [psiAll, PhiN, En] = ExactDiagTimeFx(psiInit,Ts,Ham); 104 | end 105 | psiAll(:,end)=PhiN(:,1); 106 | %save psi's from all parameters 107 | psiAllSave{ww,dd,bb}=psiAll; 108 | 109 | %evaluate for on-site density, variance, and fluctuations 110 | [nbar,nvar,nfluc]=DensityEval(psiAll,basis); 111 | 112 | %save density stuff 113 | nbarAllSave{ww,dd,bb}=nbar; 114 | %inverse participation ratio 115 | IPRSave(ww,dd,bb)=sum(nbar(:,end).^2,1); 116 | 117 | end 118 | end 119 | end 120 | %% 121 | figure(3) 122 | 123 | hold on 124 | CAB=cabFx([ND NW NB NT],[NPart NSites],basis,psiAllSave); 125 | semilogx(tj,CAB) 126 | set(gca,'xscale','log') 127 | grid on 128 | ylim([0 0.25]) 129 | 130 | %% 131 | temp=@(T) (abs(PhiN).^2)*(exp(-En./T)./(sum(exp(-En./T)))) 132 | Ttemp=logspace(-3,2,100); 133 | vinds=1:1:size(PhiN,2); 134 | for vv=1:length(vinds)-1 135 | vv 136 | %psiAllSave{1,1,1}=sqrt(temp(Ttemp(tt))); 137 | %CAB(tt)=cabFx([ND NW NB 1],[NPart NSites],basis,psiAllSave); 138 | psiAllSave{1,1,1}=PhiN(:,vv); 139 | CABeig(vv)=cabFx([ND NW NB 1],[NPart NSites],basis,psiAllSave); 140 | pn=mean(abs(PhiN(:,[vinds(vv):vinds(vv+1)])).^2,2); 141 | %pn=temp(Ttemp(tt)); 142 | for dd=1:7 143 | %g2(tt,dd)=sum((basis(:,dd).*basis(:,dd+1)).*pn)-sum(basis(:,dd).*pn)*sum(basis(:,dd+1).*pn); 144 | g2Eig(vv,dd)=sum((basis(:,dd).*basis(:,dd+1)).*pn)-sum(basis(:,dd).*pn)*sum(basis(:,dd+1).*pn); 145 | end 146 | end 147 | %% 148 | for tt=1:length(Ttemp) 149 | tt 150 | %psiAllSave{1,1,1}=sqrt(temp(Ttemp(tt))); 151 | %CAB(tt)=cabFx([ND NW NB 1],[NPart NSites],basis,psiAllSave); 152 | %pn=mean(abs(PhiN(:,[vinds(vv):vinds(vv+1)])).^2,2); 153 | pn=temp(Ttemp(tt)); 154 | for dd=1:7 155 | g2Temp(tt,dd)=sum((basis(:,dd).*basis(:,dd+1)).*pn)-sum(basis(:,dd).*pn)*sum(basis(:,dd+1).*pn); 156 | %g2Eig(vv,dd)=sum((basis(:,dd).*basis(:,dd+1)).*pn)-sum(basis(:,dd).*pn)*sum(basis(:,dd+1).*pn); 157 | end 158 | end 159 | 160 | 161 | %% 162 | figure() 163 | semilogx(Ttemp./J,mean(g2Temp,2)) 164 | %% 165 | 166 | %{ 167 | figure(1) 168 | 169 | imagesc(BetaS,Ws./J,reshape(mean(IPRSave,2),[NW NB])) 170 | 171 | set(gcf,'color','white') 172 | xlabel('\beta (sites)') 173 | ylabel('Disorder W(J)') 174 | colormap('jet') 175 | title('IPR: Single-Particle, Anderson Localization Example') 176 | colorbar() 177 | %} 178 | 179 | 180 | %% monte carlo testing and correlator estimation 181 | 182 | %produces probability distribution function since there certainly isn't a 183 | %way to get the coherences back out after this process 184 | ww=1; bb=1; 185 | pdfAllDisAvg = DisorderAvgPsi(psiAllSave,ww,bb); 186 | 187 | tind=NT; 188 | NSamp=10^5; 189 | %get monte carlo sampled basis state indices from pdf determined above 190 | dataSmpInds = MonteCarloSmp(pdfAllDisAvg,tind,NSamp); 191 | 192 | %create sampled dataset from basis and dataSmp indices 193 | MCData=basis(dataSmpInds,:); 194 | %{ 195 | for ll=1:NSites 196 | %{ 197 | [gnConn,gnDisConn]=GnConn(MCData,[1:ll]); 198 | gnConnSave(ll)=gnConn; 199 | gnDisConnSave(ll)=gnDisConn; 200 | %} 201 | %{ 202 | [gnConn]=GnConn(MCData,[1:ll]); 203 | gnConnSave(ll)=gnConn; 204 | %} 205 | gncon(ll)=GnConn(MCData,1:ll); 206 | gndis(ll)=GnCorrDatFx(MCData,1:ll)-gncon(ll); 207 | gn(ll)=GnCorrDatFx(MCData,1:ll); 208 | end 209 | %} 210 | 211 | %gnConnSave 212 | %gnDisConnSave 213 | 214 | %{ 215 | %find two point correlations 216 | g2=zeros(NSites,NSites); 217 | for ii=1:NSites 218 | for jj=ii+1:NSites 219 | g2(ii,jj)=GnCorrDatFx(MCData,[ii,jj]); 220 | end 221 | end 222 | 223 | %find 3 point correlations 224 | g3=zeros(NSites,NSites,NSites); 225 | for ii=1:NSites 226 | for jj=ii+1:NSites 227 | for kk=jj+1:NSites 228 | g3(ii,jj,kk)=GnCorrDatFx(MCData,[ii,jj,kk]); 229 | end 230 | end 231 | end 232 | 233 | %find 4 point correlations 234 | g4=zeros(NSites,NSites,NSites,NSites); 235 | for ii=1:NSites 236 | for jj=ii+1:NSites 237 | for kk=jj+1:NSites 238 | for ll=kk+1:NSites 239 | g4(ii,jj,kk,ll)=GnCorrDatFx(MCData,[ii,jj,kk,ll]); 240 | end 241 | end 242 | end 243 | end 244 | %} -------------------------------------------------------------------------------- /mbl_8site_function_red.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mnrispoli/MATLAB_ED_BHM/ec1770fb3d73d4bb68a50e9ce57889dcbca8c7b9/mbl_8site_function_red.m -------------------------------------------------------------------------------- /mbl_8site_function_red_sr.m: -------------------------------------------------------------------------------- 1 | function [Ts,psiAllSave,Deig] = mbl_8site_function_red(Jx,U,W,DisordN,NT,isQP) 2 | 3 | 4 | % experiment parameters 5 | %phi_m=pi; 6 | %phi_n=pi; 7 | 8 | %{ 9 | Jx=0.038 10 | J=Jx; 11 | U=2.7.*J; 12 | W=20.*J; 13 | DisordN=199; 14 | NT=151; 15 | isQP=1; 16 | %} 17 | 18 | 19 | NSitesy=1; 20 | NSitesx=8; 21 | NSites=NSitesy*NSitesx; 22 | NPart=9; 23 | goldR=(1+sqrt(5))/2; 24 | %goldR=2; 25 | Aphi=0; 26 | chi=-0; 27 | qpdis=isQP; 28 | 29 | 30 | 31 | 32 | 33 | xspec=round(NSitesx/2); 34 | yspec=1; 35 | 36 | 37 | 38 | HilbD=HilbDim(NSites,NPart); 39 | 40 | basis = BasiskMake(HilbD,NSites,NPart); 41 | %% 42 | 43 | 44 | 45 | %{ 46 | 47 | 48 | 49 | 50 | 51 | 52 | Hjx=zeros(size(basis,1)); 53 | %Hjnx=Hjx; 54 | %Hjnnx=Hjnx; 55 | 56 | Hi=zeros(size(basis,1)); 57 | 58 | Hd=Hi; 59 | 60 | jxterm=zeros([1 NSitesx]); 61 | jxterm(1:2)=[1,-1]; 62 | jxterm=jxterm(toeplitz(1:numel(jxterm),[1 numel(jxterm):-1:2])); 63 | %makes open boundary condition 64 | jxterms=jxterm(2:end,:); 65 | %jxterms=jxterm; 66 | jxterms=vertcat(jxterms,fliplr(jxterms)); 67 | 68 | 69 | %other tunneling terms; 70 | %{ 71 | jnxterm=zeros([1 NSitesx]); 72 | jnxterm(1:3)=[1,0,-1]; 73 | jnxterm=jnxterm(toeplitz(1:numel(jnxterm),[1 numel(jnxterm):-1:2])); 74 | %makes open boundary condition 75 | jnxterms=jnxterm(3:end,:); 76 | %jxterms=jxterm; 77 | jnxterms=vertcat(jnxterms,fliplr(jnxterms)); 78 | 79 | jnnxterm=zeros([1 NSitesx]); 80 | jnnxterm(1:4)=[1,0,0,-1]; 81 | jnnxterm=jnnxterm(toeplitz(1:numel(jnnxterm),[1 numel(jnnxterm):-1:2])); 82 | %makes open boundary condition 83 | jnnxterms=jnnxterm(4:end,:); 84 | %jxterms=jxterm; 85 | jnnxterms=vertcat(jnnxterms,fliplr(jnnxterms)); 86 | 87 | 88 | 89 | %% 90 | 91 | 92 | %this works in particular for a ribbon geometry 93 | %otherwise need to be more careful... 94 | jyterm=zeros([1 NSites]); 95 | jyterm(1)=1; 96 | jyterm(1+NSitesx)=-1; 97 | jyterm=jyterm(toeplitz(1:numel(jyterm),[1 numel(jyterm):-1:2])); 98 | %jyterms=jyterm(2:end,:); 99 | jyterms=jyterm; 100 | %jyterms=vertcat(jyterms,fliplr(jyterms)); 101 | %} 102 | 103 | 104 | 105 | 106 | 107 | tiltx=(NSitesx-1):-1:0; 108 | tilt2dx=tiltx; 109 | for kk=1:NSitesy-1 110 | tilt2dx=horzcat(tilt2dx,tiltx); 111 | end 112 | tiltx=fliplr(tiltx+1); 113 | 114 | axDis=(1./goldR).*2.*pi.*tiltx; 115 | 116 | tilty=(NSitesy-1):-1:0; 117 | tilt2dy=tilty; 118 | for kk=1:NSitesx-1 119 | tilt2dy=horzcat(tilt2dy,tilty); 120 | end 121 | 122 | %He(ii,jj)=sum(statei.*horzcat); 123 | 124 | %{ 125 | d1s=[1 0 0 0 0 0 0 0]; 126 | d2s=[0 1 0 0 0 0 0 0]; 127 | d3s=[0 0 1 0 0 0 0 0]; 128 | d4s=[0 0 0 1 0 0 0 0]; 129 | d5s=[0 0 0 0 1 0 0 0]; 130 | d6s=[0 0 0 0 0 1 0 0]; 131 | d7s=[0 0 0 0 0 0 1 0]; 132 | d8s=[0 0 0 0 0 0 0 1]; 133 | %} 134 | 135 | %axDis=[pi 0 0 0 0 0] 136 | for ii=1:size(basis,1) 137 | ii 138 | statei=basis(ii,:); 139 | 140 | for jj=1:size(basis,1) 141 | statef=basis(jj,:); 142 | 143 | for kk=1:size(jxterms,1) 144 | %{ 145 | yy=1; 146 | if kk>size(jxterms,1)/2 147 | yy=2; 148 | end 149 | %} 150 | stateix=statei; 151 | statefx=statef; 152 | %nearest 153 | if (stateix-statefx)==jxterms(kk,:) 154 | Hjx(ii,jj)=-sqrt(stateix(find(jxterms(kk,:)==1)))*sqrt(stateix(find(jxterms(kk,:)==-1))+1); 155 | [nii,njj]=find((statefx-stateix)==-1); 156 | [nii2,njj2]=find((statefx-stateix)==1); 157 | 158 | %{ 159 | [bb,aa]=find(jxterms(kk,:)==1); 160 | nn=statefx(njj2); 161 | 162 | Hjx(ii,jj)=Hjx(ii,jj).*exp(-i*(chi*pi)*(nn)*sign(njj2-njj)).*exp(-i*(Aphi)); 163 | Hjx(jj,ii)=conj(Hjx(ii,jj)); 164 | %} 165 | end 166 | end 167 | 168 | %{ 169 | %nextnearest 170 | for kk=1:size(jnxterms,1) 171 | %{ 172 | yy=1; 173 | if kk>size(jxterms,1)/2 174 | yy=2; 175 | end 176 | %} 177 | stateix=statei; 178 | statefx=statef; 179 | %next nearest 180 | if (stateix-statefx)==jnxterms(kk,:) 181 | Hjnx(ii,jj)=-sqrt(stateix(find(jnxterms(kk,:)==1)))*sqrt(stateix(find(jnxterms(kk,:)==-1))+1); 182 | [nii,njj]=find((statefx-stateix)==-1); 183 | [nii2,njj2]=find((statefx-stateix)==1); 184 | 185 | [bb,aa]=find(jnxterms(kk,:)==1); 186 | nn=statefx(njj2); 187 | 188 | Hjnx(ii,jj)=Hjnx(ii,jj).*exp(-i*(chi*pi)*(nn)*sign(njj2-njj)).*exp(-i*(Aphi)); 189 | Hjnx(jj,ii)=conj(Hjnx(ii,jj)); 190 | end 191 | end 192 | 193 | %nextnextnearest 194 | for kk=1:size(jnnxterms,1) 195 | %{ 196 | yy=1; 197 | if kk>size(jxterms,1)/2 198 | yy=2; 199 | end 200 | %} 201 | stateix=statei; 202 | statefx=statef; 203 | %nextnextnearest 204 | if (stateix-statefx)==jnnxterms(kk,:) 205 | Hjnnx(ii,jj)=-sqrt(stateix(find(jnnxterms(kk,:)==1)))*sqrt(stateix(find(jnnxterms(kk,:)==-1))+1); 206 | [nii,njj]=find((statefx-stateix)==-1); 207 | [nii2,njj2]=find((statefx-stateix)==1); 208 | 209 | [bb,aa]=find(jnnxterms(kk,:)==1); 210 | nn=statefx(njj2); 211 | 212 | Hjnnx(ii,jj)=Hjnnx(ii,jj).*exp(-i*(chi*pi)*(nn)*sign(njj2-njj)).*exp(-i*(Aphi)); 213 | Hjnnx(jj,ii)=conj(Hjnnx(ii,jj)); 214 | end 215 | 216 | 217 | end 218 | 219 | %} 220 | 221 | 222 | if (statei-statef)==0 223 | Hi(ii,jj)=sum(statei.*(statei-1)); 224 | 225 | 226 | end 227 | 228 | 229 | 230 | 231 | end 232 | end 233 | 234 | 235 | 236 | %depths=linspace(1,6,100) 237 | %depths= 238 | 239 | %} 240 | %% 241 | %for dd=1:length(depths) 242 | %disordReals=rand(51,1)*1./1.6; 243 | disordReals=rand(DisordN,1); 244 | 245 | 246 | 247 | %% single particle mapping 248 | 249 | mapss=cell(NPart,NSites); 250 | 251 | for ss=1:NSites 252 | for nn=1:NPart+1 253 | mapss{nn,ss}=find(basis(:,ss)==nn-1); 254 | end 255 | end 256 | 257 | 258 | %% 259 | 260 | %load('8site_loadme_goldR.mat'); 261 | %load('8site_loadme.mat') 262 | 263 | %load('8site_loadme_goldR2_pb.mat') 264 | %load('8site_loadme.mat') 265 | load('8s_9p_loadme.mat') 266 | 267 | %load('Z:\DMD_templates\hor_fake_golden_lattice_17sites_X7_Y7_def-20_mode3_randpar0.15hologram\normalizedoffsets.mat') 268 | %load('Z:\DMD_templates\hor_fake_golden_lattice_matt_temp_X7_Y7_def-20_mode3_randpar0.15hologram\normalizedoffsets.mat') 269 | 270 | %load('data.mat') 271 | %load('disord_pattern_DC2_def_n3.mat') 272 | %load('Disord_UnNorm_Defocus_n3p3.mat'); 273 | %load('Disord_UnNorm_Defocus_n3p3.mat') 274 | load('QPL_low_pxl_defocus_n30_DisordData.mat') 275 | 276 | 277 | siteSave=savedData{3}; 278 | siteSave=siteSave./max(max(siteSave)); 279 | 280 | psiAllSave=cell(1,length(disordReals)); 281 | 282 | %% 283 | for dd=1:length(disordReals) 284 | 285 | 286 | 287 | %% 288 | 289 | %init state 290 | psiref=ones([1,NSitesx]); 291 | psiref(1)=2; 292 | 293 | psi_init=zeros([size(basis,1),1]); 294 | psi11=find(ismember(basis,psiref,'rows')==1); 295 | psi_init(psi11)=1; 296 | 297 | Ts=logspace(-1.5,6,NT); 298 | 299 | 300 | psi=zeros(length(Ts),size(basis,1)); 301 | %% 302 | psi(1,:)=psi_init'; 303 | psiPerp=psi_init; 304 | dt=Ts(2)-Ts(1); 305 | 306 | 307 | 308 | 309 | 310 | theta=disordReals(dd).*2.*pi; 311 | 312 | 313 | 314 | %% 315 | 316 | AmpF=1; 317 | AmpF=floor(200/DisordN); 318 | %AmpF=1; 319 | 320 | tryErr=0; 321 | while tryErr==0 322 | try 323 | 324 | if qpdis==1 325 | 326 | clear rvec 327 | dd 328 | Rvec=siteSave(8-(NSites/2-1):9+(NSites/2-1),floor(dd.*AmpF))'; 329 | 330 | HdisRand=diag(sum((ones(size(basis,1),1)*Rvec).*basis,2)); 331 | 332 | 333 | Ham=Jx.*Hjx+U./2.*Hi + ... 334 | W.*HdisRand; 335 | 336 | theta=rand().*2.*pi; 337 | else 338 | %{ 339 | dd 340 | HdisRand=diag(sum((ones(size(basis,1),1)*(2.*rand(1,NSitesx))).*basis,2)); 341 | Ham=Jx.*Hjx+U./2.*Hi+ ... 342 | W.*HdisRand; 343 | %} 344 | 345 | clear rvec 346 | dd 347 | Rvec=siteSave(8-(NSites/2-1):9+(NSites/2-1),floor(dd.*AmpF))'; 348 | 349 | szR=size(Rvec); 350 | 351 | Rvec=0.5.*cos([0:(NSites-1)]'.*goldR.*2.*pi+(2.*pi).*floor(dd.*AmpF)./DisordN)+0.5; 352 | Rvec=reshape(Rvec,szR); 353 | HdisRand=diag(sum((ones(size(basis,1),1)*Rvec).*basis,2)); 354 | 355 | 356 | Ham=Jx.*Hjx+U./2.*Hi + ... 357 | W.*HdisRand; 358 | 359 | theta=rand().*2.*pi; 360 | 361 | 362 | end 363 | 364 | 365 | [V,D]=eig(Ham); 366 | tryErr=1; 367 | catch 368 | tryErr=0; 369 | 370 | 371 | end 372 | end 373 | Deig(dd,:)=diag(D); 374 | thetaStore(dd)=theta; 375 | 376 | %% 377 | %G.S. Init state 378 | 379 | 380 | 381 | cns=conj(psi_init')*V; 382 | 383 | %% 384 | for tt=1:length(Ts) 385 | 386 | psi(tt,:)=V*(cns'.*exp(diag(D).*i.*2.*pi.*Ts(tt))); 387 | 388 | 389 | end 390 | nbar=(abs(psi).^2)*basis; 391 | nbar2=(abs(psi).^2)*(basis.^2); 392 | 393 | 394 | 395 | 396 | 397 | psiAllSave{dd}=psi; 398 | 399 | end 400 | 401 | 402 | 403 | -------------------------------------------------------------------------------- /meanAbsGn6Sites.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mnrispoli/MATLAB_ED_BHM/ec1770fb3d73d4bb68a50e9ce57889dcbca8c7b9/meanAbsGn6Sites.gif -------------------------------------------------------------------------------- /meanGn6Sites.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mnrispoli/MATLAB_ED_BHM/ec1770fb3d73d4bb68a50e9ce57889dcbca8c7b9/meanGn6Sites.gif -------------------------------------------------------------------------------- /non_eq_high_order_corr.asv: -------------------------------------------------------------------------------- 1 | % general ED bose-hubbard code 2 | % last cleaned up 9/24/2018 3 | % author: Matthew Rispoli 4 | 5 | addpath('functions') 6 | 7 | close all 8 | clear all 9 | clc 10 | 11 | 12 | % tunneling 13 | J=38.1911/1000; %8Er tunneling rate; defined in Hz/(2 pi) 14 | 15 | % disorder strengths 16 | NW=1; 17 | Ws=linspace(0.3,22,NW).*0.*J % units of J 18 | Ws=[1 4 8 12 16 20] 19 | Ws=[0.1 2 6 12 18 24 30 40] 20 | Ws=[30 30 30 30 30] 21 | % tupe of disorder 22 | isQP=1; % 0 = uniform random, 1 = FFT of disorder from exp, 2 = actual QP 23 | 24 | % interaction strengths 25 | Uo=2.7*J % units of J 26 | Us=ones(size(Ws)).*Uo; %make them all the same 27 | Us=[6]; 28 | %Us=linspace(0,10,NW).*J; 29 | 30 | % system size parameters 31 | NPart=8 % number of bosons 32 | NSites=8 % number of sites 33 | 34 | % num of disorders and time scans 35 | ND=99; %disorder number 36 | DisordN=ND 37 | NT=45; % time steps 38 | tau=(1./(2.*pi.*J)); 39 | Ts=linspace(0,1000,NT) %actual times for ED evaluation 40 | Ts=logspace(-2,7,NT).*tau; 41 | % periodic boundary conditions 42 | isPB = 0; % 0 = open boundary; 1 = periodic boundary 43 | jn = 1; % order of neighbor tunnelings 44 | 45 | %% 46 | 47 | % folder for storing all matrix files 48 | folderName = 'Hamiltonians/' 49 | % hamiltonian and basis parameters 50 | edFileName=[folderName sprintf('%i_sites_%i_bosons_%i_pb_%i_jn_loadme.mat',NSites,NPart,isPB,jn)] %format for Hamiltonian filename 51 | 52 | % find hilbert space dimension 53 | HilbD=HilbDim(NSites,NPart) 54 | 55 | % check if we've already made the basis and hamiltonians 56 | if exist(edFileName,'file')==2 57 | % if it exists then load 58 | load(edFileName); 59 | else 60 | % if it doesn't exist then make them all 61 | [Hi,Hj,basis] = MakeHamiltoniansAndBasis(NSites,NPart,jn,isPB); 62 | save(edFileName,'Hi','Hj','basis','NPart','NSites','jn','isPB') 63 | end 64 | 65 | %% 66 | % make giant dataStruct to save wavefunction for all disorders 67 | psiAllW=cell(NW,ND); 68 | 69 | % find initial state in basis 70 | psiInit=zeros(1,HilbD); 71 | psiInit(find(ismember(basis,ones(1,NSites),'rows')==1))=1; 72 | %% 73 | 74 | NW=length(Ws); 75 | 76 | gnPDFStoreStd=zeros(NT,ND,NSites,NW); 77 | gnPDFStoreMAbs=zeros(NT,ND,NSites,NW); 78 | gnPDFStoreMn=zeros(NT,ND,NSites,NW); 79 | 80 | gnPDFAvgStoreStd=zeros(NT,ND,NSites,NW); 81 | gnPDFAvgStoreMAbs=zeros(NT,ND,NSites,NW); 82 | gnPDFAvgStoreMn=zeros(NT,ND,NSites,NW); 83 | 84 | PDFStore=zeros(HilbD,NT,NW); 85 | 86 | for ww=1:length(Ws) 87 | ww 88 | for dd=1:ND 89 | dd 90 | 91 | %bose hubbard parameters 92 | 93 | %Disorder Hamiltonian 94 | isQP=2; 95 | beta=1.618; 96 | Hd=MakeDisorderHam(basis,isQP,2*pi*dd/ND,beta); 97 | 98 | W=Ws(ww)*J; 99 | %W=2*J; 100 | U=Us(ww).*J; 101 | Ham = Hj.*J+Hi.*U+Hd.*W; 102 | 103 | [psiAll, PhiN, En, Cn] = ExactDiagTimeFx(psiInit,Ts,Ham); 104 | 105 | %{ 106 | PhiNSave{ww}=PhiN; 107 | EnSave{ww}=En; 108 | CnSave{ww}=Cn; 109 | %} 110 | 111 | 112 | pdf = abs(psiAll(:,:)).^2; 113 | 114 | PDFStore(:,:,ww)=PDFStore(:,:,ww)+pdf./ND; 115 | %NSamp=1E6 116 | %[dataSmpl] = MonteCarloSmp(pdf,tind,NSamp); 117 | 118 | nord=NSites; 119 | inds=1:nord; 120 | %[sn2k,S2kInds,indsNKStore,corrn,gn] = dynBldGnFxFsPPMap(basis(dataSmpl,:),nord,inds,1) 121 | for tind=1:NT 122 | pn=pdf(:,tind); 123 | %gnDat=gn; 124 | [sn2k,S2kInds,indsNKStore,corrn,gn] = dynBldGnFxFsPPMapPDF(pn,basis,nord,inds,0); 125 | 126 | for nn=1:length(gn) 127 | gnPDFStoreStd(tind,dd,nn,ww)=std(((cell2mat(values(gn{nn}))))); 128 | gnPDFStoreMAbs(tind,dd,nn,ww)=mean(abs((cell2mat(values(gn{nn}))))); 129 | gnPDFStoreMn(tind,dd,nn,ww)=mean(((cell2mat(values(gn{nn}))))); 130 | end 131 | end 132 | 133 | 134 | 135 | %[tt,psiAll,Deig]=mbl_8site_function_red(J,U,W,DisordN,NT,isQP); 136 | %{ 137 | TT{ww}=tt; 138 | DeigS{ww}=Deig; 139 | 140 | for dd=1:DisordN 141 | psiAllW{ww,dd}=psiAll{dd}; 142 | end 143 | %} 144 | 145 | end 146 | 147 | for tind=1:NT 148 | pn=reshape(PDFStore(:,tind,ww),size(pn)); 149 | %gnDat=gn; 150 | [sn2k,S2kInds,indsNKStore,corrn,gn] = dynBldGnFxFsPPMapPDF(pn,basis,nord,inds,0); 151 | 152 | for nn=1:length(gn) 153 | gnPDFAvgStoreStd(tind,dd,nn,ww)=std(((cell2mat(values(gn{nn}))))); 154 | gnPDFAvgStoreMAbs(tind,dd,nn,ww)=mean(abs((cell2mat(values(gn{nn}))))); 155 | gnPDFAvgStoreMn(tind,dd,nn,ww)=mean(((cell2mat(values(gn{nn}))))); 156 | end 157 | end 158 | 159 | end 160 | 161 | %% 162 | 163 | figure(11) 164 | hold off 165 | for ww=1:length(Ws) 166 | for nn=1:NSites 167 | subplot(2,4,nn) 168 | loglog(Ts./tau,mean(gnPDFStoreStd(:,:,nn,ww),2)) 169 | hold on 170 | title(sprintf('W/J=30; N=%i',nn)) 171 | grid on 172 | xlim([Ts(1)./tau,Ts(end)./tau]) 173 | xlabel('time(\tau)') 174 | ylabel('Std[G^{(N)}]') 175 | Ws 176 | 177 | end 178 | end 179 | set(gcf,'color','white') 180 | legend('U/J=0.001','U/J=0.01','U/J=0.1','U/J=1','U/J=2') 181 | 182 | 183 | 184 | figure(12) 185 | hold off 186 | for ww=1:length(Ws) 187 | for nn=1:NSites 188 | subplot(2,4,nn) 189 | loglog(Ts./tau,mean(gnPDFStoreMAbs(:,:,nn,ww),2)) 190 | hold on 191 | title(sprintf('W/J=30; N=%i',nn)) 192 | grid on 193 | xlim([Ts(1)./tau,Ts(end)./tau]) 194 | xlabel('time(\tau)') 195 | ylabel('Mean|G^{(N)}|') 196 | Ws 197 | 198 | end 199 | end 200 | set(gcf,'color','white') 201 | legend('U/J=0.001','U/J=0.01','U/J=0.1','U/J=1','U/J=2') 202 | 203 | 204 | 205 | figure(13) 206 | hold off 207 | for ww=1:length(Ws) 208 | for nn=1:NSites 209 | subplot(2,4,nn) 210 | loglog(Ts./tau,abs(mean(gnPDFStoreMn(:,:,nn,ww),2))) 211 | hold on 212 | title(sprintf('W/J=30; N=%i',nn)) 213 | grid on 214 | xlim([Ts(1)./tau,Ts(end)./tau]) 215 | xlabel('time(\tau)') 216 | ylabel('Mean(G^{(N)})') 217 | Ws 218 | 219 | end 220 | end 221 | set(gcf,'color','white') 222 | legend('U/J=0.001','U/J=0.01','U/J=0.1','U/J=1','U/J=2') 223 | 224 | %% 225 | 226 | 227 | figure(22) 228 | hold off 229 | for ww=1:length(Ws) 230 | for nn=1:NSites 231 | subplot(2,4,nn) 232 | loglog(Ts./tau,mean(gnPDFAvgStoreStd(:,:,nn,ww),2)) 233 | hold on 234 | title(sprintf('W/J=30; N=%i',nn)) 235 | grid on 236 | xlim([Ts(1)./tau,Ts(end)./tau]) 237 | xlabel('time(\tau)') 238 | ylabel('Std[G^{(N)}]') 239 | Ws 240 | 241 | end 242 | end 243 | set(gcf,'color','white') 244 | legend('U/J=0.001','U/J=0.01','U/J=0.1','U/J=1','U/J=2') 245 | 246 | 247 | 248 | figure(23) 249 | hold off 250 | for ww=1:length(Ws) 251 | for nn=1:NSites 252 | subplot(2,4,nn) 253 | loglog(Ts./tau,mean(gnPDFAvgStoreMAbs(:,:,nn,ww),2)) 254 | hold on 255 | title(sprintf('W/J=30; N=%i',nn)) 256 | grid on 257 | xlim([Ts(1)./tau,Ts(end)./tau]) 258 | xlabel('time(\tau)') 259 | ylabel('Mean|G^{(N)}|') 260 | Ws 261 | 262 | end 263 | end 264 | set(gcf,'color','white') 265 | legend('U/J=0.001','U/J=0.01','U/J=0.1','U/J=1','U/J=2') 266 | 267 | 268 | 269 | figure(24) 270 | hold off 271 | for ww=1:length(Ws) 272 | for nn=1:NSites 273 | subplot(2,4,nn) 274 | loglog(Ts./tau,abs(mean(gnPDFAvgStoreMn(:,:,nn,ww),2))) 275 | hold on 276 | title(sprintf('W/J=30; N=%i',nn)) 277 | grid on 278 | xlim([Ts(1)./tau,Ts(end)./tau]) 279 | xlabel('time(\tau)') 280 | ylabel('Mean(G^{(N)})') 281 | Ws 282 | 283 | end 284 | end 285 | set(gcf,'color','white') 286 | legend('U/J=0.001','U/J=0.01','U/J=0.1','U/J=1','U/J=2') 287 | 288 | -------------------------------------------------------------------------------- /non_eq_high_order_corr.m: -------------------------------------------------------------------------------- 1 | % general ED bose-hubbard code 2 | % last cleaned up 9/24/2018 3 | % author: Matthew Rispoli 4 | 5 | addpath('functions') 6 | 7 | close all 8 | clear all 9 | clc 10 | 11 | 12 | % tunneling 13 | J=38.1911/1000; %8Er tunneling rate; defined in Hz/(2 pi) 14 | 15 | % disorder strengths 16 | NW=1; 17 | Ws=linspace(0.3,22,NW).*0.*J % units of J 18 | Ws=[1 4 8 12 16 20] 19 | Ws=[0.1 2 6 12 18 24 30 40] 20 | Ws=[30 30 30 30 30] 21 | Ws=[2 4 6 8 10] 22 | % tupe of disorder 23 | isQP=1; % 0 = uniform random, 1 = FFT of disorder from exp, 2 = actual QP 24 | 25 | % interaction strengths 26 | Uo=2.7*J % units of J 27 | Us=ones(size(Ws)).*Uo; %make them all the same 28 | %Us=[6]; 29 | 30 | %Us=linspace(0,10,NW).*J; 31 | 32 | % system size parameters 33 | NPart=6 % number of bosons 34 | NSites=6 % number of sites 35 | 36 | % num of disorders and time scans 37 | ND=51; %disorder number 38 | DisordN=ND 39 | NT=45; % time steps 40 | tau=(1./(2.*pi.*J)); 41 | Ts=linspace(0,1000,NT) %actual times for ED evaluation 42 | Ts=logspace(-1.5,3,NT).*tau; 43 | % periodic boundary conditions 44 | isPB = 0; % 0 = open boundary; 1 = periodic boundary 45 | jn = 1; % order of neighbor tunnelings 46 | 47 | %% 48 | 49 | % folder for storing all matrix files 50 | folderName = 'Hamiltonians/' 51 | % hamiltonian and basis parameters 52 | edFileName=[folderName sprintf('%i_sites_%i_bosons_%i_pb_%i_jn_loadme.mat',NSites,NPart,isPB,jn)] %format for Hamiltonian filename 53 | 54 | % find hilbert space dimension 55 | HilbD=HilbDim(NSites,NPart) 56 | 57 | % check if we've already made the basis and hamiltonians 58 | if exist(edFileName,'file')==2 59 | % if it exists then load 60 | load(edFileName); 61 | else 62 | % if it doesn't exist then make them all 63 | [Hi,Hj,basis] = MakeHamiltoniansAndBasis(NSites,NPart,jn,isPB); 64 | save(edFileName,'Hi','Hj','basis','NPart','NSites','jn','isPB') 65 | end 66 | 67 | %% 68 | % make giant dataStruct to save wavefunction for all disorders 69 | psiAllW=cell(NW,ND); 70 | 71 | % find initial state in basis 72 | psiInit=zeros(1,HilbD); 73 | psiInit(find(ismember(basis,ones(1,NSites),'rows')==1))=1; 74 | %% 75 | 76 | NW=length(Ws); 77 | 78 | gnPDFStoreStd=zeros(NT,ND,NSites,NW); 79 | gnPDFStoreMAbs=zeros(NT,ND,NSites,NW); 80 | gnPDFStoreMn=zeros(NT,ND,NSites,NW); 81 | 82 | gnPDFAvgStoreStd=zeros(NT,ND,NSites,NW); 83 | gnPDFAvgStoreMAbs=zeros(NT,ND,NSites,NW); 84 | gnPDFAvgStoreMn=zeros(NT,ND,NSites,NW); 85 | 86 | PDFStore=zeros(HilbD,NT,NW); 87 | 88 | for ww=1:length(Ws) 89 | ww 90 | for dd=1:ND 91 | dd 92 | 93 | %bose hubbard parameters 94 | 95 | %Disorder Hamiltonian 96 | isQP=2; 97 | beta=1.618; 98 | Hd=MakeDisorderHam(basis,isQP,2*pi*dd/ND,beta); 99 | 100 | W=Ws(ww)*J; 101 | %W=2*J; 102 | U=Us(ww).*J; 103 | Ham = Hj.*J+Hi.*U+Hd.*W; 104 | 105 | [psiAll, PhiN, En, Cn] = ExactDiagTimeFx(psiInit,Ts,Ham); 106 | 107 | %{ 108 | PhiNSave{ww}=PhiN; 109 | EnSave{ww}=En; 110 | CnSave{ww}=Cn; 111 | %} 112 | 113 | 114 | pdf = abs(psiAll(:,:)).^2; 115 | 116 | PDFStore(:,:,ww)=PDFStore(:,:,ww)+pdf./ND; 117 | %NSamp=1E6 118 | %[dataSmpl] = MonteCarloSmp(pdf,tind,NSamp); 119 | 120 | nord=NSites; 121 | inds=1:nord; 122 | %[sn2k,S2kInds,indsNKStore,corrn,gn] = dynBldGnFxFsPPMap(basis(dataSmpl,:),nord,inds,1) 123 | for tind=1:NT 124 | pn=pdf(:,tind); 125 | %gnDat=gn; 126 | [sn2k,S2kInds,indsNKStore,corrn,gn] = dynBldGnFxFsPPMapPDF(pn,basis,nord,inds,0); 127 | 128 | for nn=1:length(gn) 129 | gnPDFStoreStd(tind,dd,nn,ww)=std(((cell2mat(values(gn{nn}))))); 130 | gnPDFStoreMAbs(tind,dd,nn,ww)=mean(abs((cell2mat(values(gn{nn}))))); 131 | gnPDFStoreMn(tind,dd,nn,ww)=mean(((cell2mat(values(gn{nn}))))); 132 | end 133 | end 134 | 135 | 136 | 137 | %[tt,psiAll,Deig]=mbl_8site_function_red(J,U,W,DisordN,NT,isQP); 138 | %{ 139 | TT{ww}=tt; 140 | DeigS{ww}=Deig; 141 | 142 | for dd=1:DisordN 143 | psiAllW{ww,dd}=psiAll{dd}; 144 | end 145 | %} 146 | 147 | end 148 | 149 | for tind=1:NT 150 | pn=reshape(PDFStore(:,tind,ww),size(pn)); 151 | %gnDat=gn; 152 | [sn2k,S2kInds,indsNKStore,corrn,gn] = dynBldGnFxFsPPMapPDF(pn,basis,nord,inds,0); 153 | 154 | for nn=1:length(gn) 155 | gnPDFAvgStoreStd(tind,dd,nn,ww)=std(((cell2mat(values(gn{nn}))))); 156 | gnPDFAvgStoreMAbs(tind,dd,nn,ww)=mean(abs((cell2mat(values(gn{nn}))))); 157 | gnPDFAvgStoreMn(tind,dd,nn,ww)=mean(((cell2mat(values(gn{nn}))))); 158 | end 159 | end 160 | 161 | end 162 | 163 | %% 164 | 165 | figure(11) 166 | hold off 167 | for ww=1:length(Ws) 168 | for nn=1:NSites 169 | subplot(2,4,nn) 170 | loglog(Ts./tau,mean(gnPDFStoreStd(:,:,nn,ww),2)) 171 | hold on 172 | title(sprintf('W/J=30; N=%i',nn)) 173 | grid on 174 | xlim([Ts(1)./tau,Ts(end)./tau]) 175 | xlabel('time(\tau)') 176 | ylabel('Std[G^{(N)}]') 177 | Ws 178 | 179 | end 180 | end 181 | set(gcf,'color','white') 182 | legend('U/J=0.001','U/J=0.01','U/J=0.1','U/J=1','U/J=2') 183 | 184 | 185 | 186 | figure(12) 187 | hold off 188 | for ww=1:length(Ws) 189 | for nn=1:NSites 190 | subplot(2,4,nn) 191 | loglog(Ts./tau,mean(gnPDFStoreMAbs(:,:,nn,ww),2)) 192 | hold on 193 | title(sprintf('W/J=30; N=%i',nn)) 194 | grid on 195 | xlim([Ts(1)./tau,Ts(end)./tau]) 196 | xlabel('time(\tau)') 197 | ylabel('Mean|G^{(N)}|') 198 | Ws 199 | 200 | end 201 | end 202 | set(gcf,'color','white') 203 | legend('U/J=0.001','U/J=0.01','U/J=0.1','U/J=1','U/J=2') 204 | 205 | 206 | 207 | figure(13) 208 | hold off 209 | for ww=1:length(Ws) 210 | for nn=1:NSites 211 | subplot(2,4,nn) 212 | loglog(Ts./tau,abs(mean(gnPDFStoreMn(:,:,nn,ww),2))) 213 | hold on 214 | title(sprintf('W/J=30; N=%i',nn)) 215 | grid on 216 | xlim([Ts(1)./tau,Ts(end)./tau]) 217 | xlabel('time(\tau)') 218 | ylabel('Mean(G^{(N)})') 219 | Ws 220 | 221 | end 222 | end 223 | set(gcf,'color','white') 224 | legend('U/J=0.001','U/J=0.01','U/J=0.1','U/J=1','U/J=2') 225 | 226 | %% 227 | 228 | 229 | figure(22) 230 | hold off 231 | for ww=1:length(Ws) 232 | for nn=1:NSites 233 | subplot(2,4,nn) 234 | loglog(Ts./tau,mean(gnPDFAvgStoreStd(:,:,nn,ww),2)) 235 | hold on 236 | title(sprintf('W/J=30; N=%i',nn)) 237 | grid on 238 | xlim([Ts(1)./tau,Ts(end)./tau]) 239 | xlabel('time(\tau)') 240 | ylabel('Std[G^{(N)}]') 241 | Ws 242 | 243 | end 244 | end 245 | set(gcf,'color','white') 246 | legend('U/J=0.001','U/J=0.01','U/J=0.1','U/J=1','U/J=2') 247 | 248 | 249 | 250 | figure(23) 251 | hold off 252 | for ww=1:length(Ws) 253 | for nn=1:NSites 254 | subplot(2,4,nn) 255 | loglog(Ts./tau,mean(gnPDFAvgStoreMAbs(:,:,nn,ww),2)) 256 | hold on 257 | title(sprintf('W/J=30; N=%i',nn)) 258 | grid on 259 | xlim([Ts(1)./tau,Ts(end)./tau]) 260 | xlabel('time(\tau)') 261 | ylabel('Mean|G^{(N)}|') 262 | Ws 263 | 264 | end 265 | end 266 | set(gcf,'color','white') 267 | legend('U/J=0.001','U/J=0.01','U/J=0.1','U/J=1','U/J=2') 268 | 269 | 270 | 271 | figure(24) 272 | hold off 273 | for ww=1:length(Ws) 274 | for nn=1:NSites 275 | subplot(2,4,nn) 276 | loglog(Ts./tau,abs(mean(gnPDFAvgStoreMn(:,:,nn,ww),2))) 277 | hold on 278 | title(sprintf('W/J=30; N=%i',nn)) 279 | grid on 280 | xlim([Ts(1)./tau,Ts(end)./tau]) 281 | xlabel('time(\tau)') 282 | ylabel('Mean(G^{(N)})') 283 | Ws 284 | 285 | end 286 | end 287 | set(gcf,'color','white') 288 | legend('U/J=0.001','U/J=0.01','U/J=0.1','U/J=1','U/J=2') 289 | 290 | -------------------------------------------------------------------------------- /plot_colormaps/alex_cmap.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mnrispoli/MATLAB_ED_BHM/ec1770fb3d73d4bb68a50e9ce57889dcbca8c7b9/plot_colormaps/alex_cmap.mat -------------------------------------------------------------------------------- /plots_high_gn_heidelberg/6SiteGS.fig: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mnrispoli/MATLAB_ED_BHM/ec1770fb3d73d4bb68a50e9ce57889dcbca8c7b9/plots_high_gn_heidelberg/6SiteGS.fig -------------------------------------------------------------------------------- /plots_high_gn_heidelberg/6SiteUvary.fig: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mnrispoli/MATLAB_ED_BHM/ec1770fb3d73d4bb68a50e9ce57889dcbca8c7b9/plots_high_gn_heidelberg/6SiteUvary.fig -------------------------------------------------------------------------------- /plots_high_gn_heidelberg/6siteUVaryMean13.fig: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mnrispoli/MATLAB_ED_BHM/ec1770fb3d73d4bb68a50e9ce57889dcbca8c7b9/plots_high_gn_heidelberg/6siteUVaryMean13.fig -------------------------------------------------------------------------------- /plots_high_gn_heidelberg/6siteUVaryMean24.fig: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mnrispoli/MATLAB_ED_BHM/ec1770fb3d73d4bb68a50e9ce57889dcbca8c7b9/plots_high_gn_heidelberg/6siteUVaryMean24.fig -------------------------------------------------------------------------------- /plots_high_gn_heidelberg/6siteUVaryMeanAbs12.fig: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mnrispoli/MATLAB_ED_BHM/ec1770fb3d73d4bb68a50e9ce57889dcbca8c7b9/plots_high_gn_heidelberg/6siteUVaryMeanAbs12.fig -------------------------------------------------------------------------------- /plots_high_gn_heidelberg/6siteUVaryMeanAbs23.fig: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mnrispoli/MATLAB_ED_BHM/ec1770fb3d73d4bb68a50e9ce57889dcbca8c7b9/plots_high_gn_heidelberg/6siteUVaryMeanAbs23.fig -------------------------------------------------------------------------------- /plots_high_gn_heidelberg/6siteUVaryStd11.fig: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mnrispoli/MATLAB_ED_BHM/ec1770fb3d73d4bb68a50e9ce57889dcbca8c7b9/plots_high_gn_heidelberg/6siteUVaryStd11.fig -------------------------------------------------------------------------------- /plots_high_gn_heidelberg/6siteUVaryStd22.fig: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mnrispoli/MATLAB_ED_BHM/ec1770fb3d73d4bb68a50e9ce57889dcbca8c7b9/plots_high_gn_heidelberg/6siteUVaryStd22.fig -------------------------------------------------------------------------------- /plots_high_gn_heidelberg/6siteWscan_MeanAbsGn.fig: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mnrispoli/MATLAB_ED_BHM/ec1770fb3d73d4bb68a50e9ce57889dcbca8c7b9/plots_high_gn_heidelberg/6siteWscan_MeanAbsGn.fig -------------------------------------------------------------------------------- /plots_high_gn_heidelberg/6siteWscan_MeanAbsGn_avg.fig: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mnrispoli/MATLAB_ED_BHM/ec1770fb3d73d4bb68a50e9ce57889dcbca8c7b9/plots_high_gn_heidelberg/6siteWscan_MeanAbsGn_avg.fig -------------------------------------------------------------------------------- /plots_high_gn_heidelberg/6siteWscan_MeanGn.fig: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mnrispoli/MATLAB_ED_BHM/ec1770fb3d73d4bb68a50e9ce57889dcbca8c7b9/plots_high_gn_heidelberg/6siteWscan_MeanGn.fig -------------------------------------------------------------------------------- /plots_high_gn_heidelberg/6siteWscan_MeanGn_avg.fig: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mnrispoli/MATLAB_ED_BHM/ec1770fb3d73d4bb68a50e9ce57889dcbca8c7b9/plots_high_gn_heidelberg/6siteWscan_MeanGn_avg.fig -------------------------------------------------------------------------------- /plots_high_gn_heidelberg/6siteWscan_StdGn.fig: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mnrispoli/MATLAB_ED_BHM/ec1770fb3d73d4bb68a50e9ce57889dcbca8c7b9/plots_high_gn_heidelberg/6siteWscan_StdGn.fig -------------------------------------------------------------------------------- /plots_high_gn_heidelberg/6siteWscan_StdGn_avg.fig: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mnrispoli/MATLAB_ED_BHM/ec1770fb3d73d4bb68a50e9ce57889dcbca8c7b9/plots_high_gn_heidelberg/6siteWscan_StdGn_avg.fig -------------------------------------------------------------------------------- /plots_high_gn_heidelberg/8site_absMeanGn_Avgmbl.fig: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mnrispoli/MATLAB_ED_BHM/ec1770fb3d73d4bb68a50e9ce57889dcbca8c7b9/plots_high_gn_heidelberg/8site_absMeanGn_Avgmbl.fig -------------------------------------------------------------------------------- /plots_high_gn_heidelberg/8site_absMeanGn_mbl.fig: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mnrispoli/MATLAB_ED_BHM/ec1770fb3d73d4bb68a50e9ce57889dcbca8c7b9/plots_high_gn_heidelberg/8site_absMeanGn_mbl.fig -------------------------------------------------------------------------------- /plots_high_gn_heidelberg/8site_meanAbsGn_Avgmbl.fig: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mnrispoli/MATLAB_ED_BHM/ec1770fb3d73d4bb68a50e9ce57889dcbca8c7b9/plots_high_gn_heidelberg/8site_meanAbsGn_Avgmbl.fig -------------------------------------------------------------------------------- /plots_high_gn_heidelberg/8site_meanAbsGn_Wscan.fig: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mnrispoli/MATLAB_ED_BHM/ec1770fb3d73d4bb68a50e9ce57889dcbca8c7b9/plots_high_gn_heidelberg/8site_meanAbsGn_Wscan.fig -------------------------------------------------------------------------------- /plots_high_gn_heidelberg/8site_meanAbsGn_Wscan_avg.fig: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mnrispoli/MATLAB_ED_BHM/ec1770fb3d73d4bb68a50e9ce57889dcbca8c7b9/plots_high_gn_heidelberg/8site_meanAbsGn_Wscan_avg.fig -------------------------------------------------------------------------------- /plots_high_gn_heidelberg/8site_meanAbsGn_mbl.fig: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mnrispoli/MATLAB_ED_BHM/ec1770fb3d73d4bb68a50e9ce57889dcbca8c7b9/plots_high_gn_heidelberg/8site_meanAbsGn_mbl.fig -------------------------------------------------------------------------------- /plots_high_gn_heidelberg/8site_meanGn_Wscan.fig: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mnrispoli/MATLAB_ED_BHM/ec1770fb3d73d4bb68a50e9ce57889dcbca8c7b9/plots_high_gn_heidelberg/8site_meanGn_Wscan.fig -------------------------------------------------------------------------------- /plots_high_gn_heidelberg/8site_meanGn_Wscan_Avg.fig: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mnrispoli/MATLAB_ED_BHM/ec1770fb3d73d4bb68a50e9ce57889dcbca8c7b9/plots_high_gn_heidelberg/8site_meanGn_Wscan_Avg.fig -------------------------------------------------------------------------------- /plots_high_gn_heidelberg/8site_stdGn_Avgmbl.fig: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mnrispoli/MATLAB_ED_BHM/ec1770fb3d73d4bb68a50e9ce57889dcbca8c7b9/plots_high_gn_heidelberg/8site_stdGn_Avgmbl.fig -------------------------------------------------------------------------------- /plots_high_gn_heidelberg/8site_stdGn_Wscan_avg.fig: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mnrispoli/MATLAB_ED_BHM/ec1770fb3d73d4bb68a50e9ce57889dcbca8c7b9/plots_high_gn_heidelberg/8site_stdGn_Wscan_avg.fig -------------------------------------------------------------------------------- /plots_high_gn_heidelberg/8site_stdGn_mbl.fig: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mnrispoli/MATLAB_ED_BHM/ec1770fb3d73d4bb68a50e9ce57889dcbca8c7b9/plots_high_gn_heidelberg/8site_stdGn_mbl.fig -------------------------------------------------------------------------------- /plots_high_gn_heidelberg/AAGS_6Site.fig: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mnrispoli/MATLAB_ED_BHM/ec1770fb3d73d4bb68a50e9ce57889dcbca8c7b9/plots_high_gn_heidelberg/AAGS_6Site.fig -------------------------------------------------------------------------------- /plots_high_gn_heidelberg/SF_vs_corr.fig: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mnrispoli/MATLAB_ED_BHM/ec1770fb3d73d4bb68a50e9ce57889dcbca8c7b9/plots_high_gn_heidelberg/SF_vs_corr.fig -------------------------------------------------------------------------------- /plots_high_gn_heidelberg/TInftyMeanGn.fig: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mnrispoli/MATLAB_ED_BHM/ec1770fb3d73d4bb68a50e9ce57889dcbca8c7b9/plots_high_gn_heidelberg/TInftyMeanGn.fig -------------------------------------------------------------------------------- /plots_high_gn_heidelberg/TInftyMeanGn2.fig: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mnrispoli/MATLAB_ED_BHM/ec1770fb3d73d4bb68a50e9ce57889dcbca8c7b9/plots_high_gn_heidelberg/TInftyMeanGn2.fig -------------------------------------------------------------------------------- /plots_high_gn_heidelberg/TInfty_powerLaw.fig: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mnrispoli/MATLAB_ED_BHM/ec1770fb3d73d4bb68a50e9ce57889dcbca8c7b9/plots_high_gn_heidelberg/TInfty_powerLaw.fig -------------------------------------------------------------------------------- /plots_high_gn_heidelberg/gs_sf_6site.fig: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mnrispoli/MATLAB_ED_BHM/ec1770fb3d73d4bb68a50e9ce57889dcbca8c7b9/plots_high_gn_heidelberg/gs_sf_6site.fig -------------------------------------------------------------------------------- /plots_high_gn_heidelberg/meanAbsGn6Sites.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mnrispoli/MATLAB_ED_BHM/ec1770fb3d73d4bb68a50e9ce57889dcbca8c7b9/plots_high_gn_heidelberg/meanAbsGn6Sites.gif -------------------------------------------------------------------------------- /plots_high_gn_heidelberg/meanGn6Sites.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mnrispoli/MATLAB_ED_BHM/ec1770fb3d73d4bb68a50e9ce57889dcbca8c7b9/plots_high_gn_heidelberg/meanGn6Sites.gif -------------------------------------------------------------------------------- /plots_high_gn_heidelberg/sfVsCorr.fig: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mnrispoli/MATLAB_ED_BHM/ec1770fb3d73d4bb68a50e9ce57889dcbca8c7b9/plots_high_gn_heidelberg/sfVsCorr.fig -------------------------------------------------------------------------------- /plots_high_gn_heidelberg/stdGn6Sites.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mnrispoli/MATLAB_ED_BHM/ec1770fb3d73d4bb68a50e9ce57889dcbca8c7b9/plots_high_gn_heidelberg/stdGn6Sites.gif -------------------------------------------------------------------------------- /plots_high_gn_heidelberg/svn_sf_init_State.fig: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mnrispoli/MATLAB_ED_BHM/ec1770fb3d73d4bb68a50e9ce57889dcbca8c7b9/plots_high_gn_heidelberg/svn_sf_init_State.fig -------------------------------------------------------------------------------- /quenchHamUJ.m: -------------------------------------------------------------------------------- 1 | % general ED bose-hubbard code 2 | % last cleaned up 9/24/2018 3 | % author: Matthew Rispoli 4 | 5 | addpath('functions') 6 | 7 | close all 8 | clear all 9 | clc 10 | 11 | 12 | % tunneling 13 | J=38.1911/1000; %8Er tunneling rate; defined in Hz/(2 pi) 14 | 15 | % disorder strengths 16 | NW=3; 17 | Ws=linspace(0.3,22,NW).*0.*J % units of J 18 | % tupe of disorder 19 | isQP=1; % 0 = uniform random, 1 = FFT of disorder from exp, 2 = actual QP 20 | 21 | % interaction strengths 22 | Uo=2.7*J % units of J 23 | Us=ones(size(Ws)).*Uo; %make them all the same 24 | Us=linspace(0,10,NW).*J; 25 | 26 | % system size parameters 27 | NPart=6 % number of bosons 28 | NSites=6 % number of sites 29 | 30 | % num of disorders and time scans 31 | ND=1; %disorder number 32 | DisordN=ND 33 | NT=25; % time steps 34 | Ts=linspace(0,10,NT).*(1./(2.*pi.*J)) %actual times for ED evaluation 35 | 36 | % periodic boundary conditions 37 | isPB = 0; % 0 = open boundary; 1 = periodic boundary 38 | jn = 1; % order of neighbor tunnelings 39 | 40 | %% 41 | 42 | % folder for storing all matrix files 43 | folderName = 'Hamiltonians/' 44 | % hamiltonian and basis parameters 45 | edFileName=[folderName sprintf('%i_sites_%i_bosons_%i_pb_%i_jn_loadme.mat',NSites,NPart,isPB,jn)] %format for Hamiltonian filename 46 | 47 | % find hilbert space dimension 48 | HilbD=HilbDim(NSites,NPart) 49 | 50 | % check if we've already made the basis and hamiltonians 51 | if exist(edFileName,'file')==2 52 | % if it exists then load 53 | load(edFileName); 54 | else 55 | % if it doesn't exist then make them all 56 | [Hi,Hj,basis] = MakeHamiltoniansAndBasis(NSites,NPart,jn,isPB); 57 | save(edFileName,'Hi','Hj','basis','NPart','NSites','jn','isPB') 58 | end 59 | 60 | %% 61 | % make giant dataStruct to save wavefunction for all disorders 62 | psiAllW=cell(NW,ND); 63 | 64 | % find initial state in basis 65 | psiInit=zeros(1,HilbD); 66 | psiInit(find(ismember(basis,ones(1,NSites),'rows')==1))=1; 67 | %% 68 | for ww=1:length(Ws) 69 | 70 | 71 | ww 72 | %bose hubbard parameters 73 | 74 | W=Ws(ww)*J; 75 | %W=2*J; 76 | U=Us(ww)*J; 77 | Ham = Hj.*J+Hi.*U; 78 | [psiAll, PhiN, En, Cn] = ExactDiagTimeFx(psiInit,Ts,Ham); 79 | 80 | PhiNSave{ww}=PhiN; 81 | EnSave{ww}=En; 82 | CnSave{ww}=Cn; 83 | 84 | pdf= 85 | [dataSmpl] = MonteCarloSmp(pdf,tind,NSamp) 86 | 87 | 88 | 89 | 90 | %[tt,psiAll,Deig]=mbl_8site_function_red(J,U,W,DisordN,NT,isQP); 91 | %{ 92 | TT{ww}=tt; 93 | DeigS{ww}=Deig; 94 | 95 | for dd=1:DisordN 96 | psiAllW{ww,dd}=psiAll{dd}; 97 | end 98 | %} 99 | 100 | end 101 | %% 102 | 103 | for ww=1:NW 104 | tempE(ww,:)=EnSave{ww}./J; 105 | gapsW(ww,:)=tempE(ww,2:end)-tempE(ww,1:end-1); 106 | tempC(ww,:)=CnSave{ww}; 107 | pn=tempC(ww,:).^2; 108 | pns(ww,:)=(pn(2:end).*pn(1:end-1)).*4; 109 | HL=round(HilbD/3); 110 | HH=round(HilbD.*2./3); 111 | tempGap=[gapsW(ww,HL:HH+1); gapsW(ww,HL-1:HH)]; 112 | rspec(ww)=mean(min(tempGap,[],1)./max(tempGap,[],1),2); 113 | 114 | [ii,jj]=sort(pn,'descend'); 115 | 116 | end 117 | %% 118 | %load('8site_loadme.mat'); 119 | %% 120 | %{ 121 | nhalf=sum(basis(:,1:size(basis,2)/2),2); 122 | ND=DisordN; 123 | 124 | 125 | Sp=zeros(NT,length(Ws),ND); 126 | SPM=zeros(NT,length(Ws)); 127 | 128 | NS=size(basis,2); 129 | rhon=zeros(NT,NS+1,length(Ws),ND); 130 | nbar=zeros(NS,NT,ND,length(Ws)); 131 | 132 | for ww=1:length(Ws) 133 | for dd=1:ND 134 | rho=abs(psiAllW{ww,dd}).^2; 135 | nbar(:,:,dd,ww)=(rho*basis)'; 136 | 137 | for nn=1:NS+1 138 | indsn=find(nhalf==(nn-1)); 139 | rhon(:,nn,ww,dd)=sum(rho(:,indsn),2); 140 | end 141 | temp=reshape(rhon(:,:,ww,dd),[NT NS+1]); 142 | 143 | Sp(:,ww,dd)=-sum(temp.*log(temp),2); 144 | end 145 | SPM=mean(Sp,3); 146 | nbarM=reshape(mean(nbar,3),[NS,NT,length(Ws)]); 147 | end 148 | %} 149 | 150 | %% 151 | %tj=TT{1}.*J.*2.*pi; 152 | 153 | %cab_corr_red; 154 | 155 | %subSystemsEP_small_half_only; 156 | 157 | %% Correlation length section 158 | %{ 159 | 160 | % Okay so this is looking at the old data 161 | 162 | %NN=size(prSitesW{1},1); 163 | NN=8; 164 | %NS=size(prSitesW{1},2); 165 | NS=9; 166 | NT=size(psiAllW{1},1); 167 | ND=size(psiAllW,2); 168 | % find long time indices 169 | indsLongTime=find(tt.*2.*pi.*J>100); 170 | 171 | 172 | % create g2matrices. Need to redo simulation to keep psi 173 | g2mats=zeros(size(basis,2),size(basis,2),size(basis,1)); 174 | nImats=zeros(size(basis,2),size(basis,2),size(basis,1)); 175 | nJmats=zeros(size(basis,2),size(basis,2),size(basis,1)); 176 | disN=zeros(NSites,size(basis,1)); 177 | g2dMats=zeros(NSites,size(basis,1)); 178 | 179 | for zz=1:size(basis,1) 180 | zz 181 | for ii=1:size(basis,2) 182 | for jj=ii:size(basis,2) 183 | if ii==jj 184 | g2mat(ii,jj,zz)=basis(zz,ii).^2-basis(zz,ii); 185 | 186 | else 187 | g2mat(ii,jj,zz)=basis(zz,ii).*basis(zz,jj); 188 | end 189 | nImat(ii,jj,zz)=basis(zz,ii); 190 | nJmat(ii,jj,zz)=basis(zz,jj); 191 | 192 | dd=abs(ii-jj); 193 | disN(dd+1,zz)=disN(dd+1,zz)+1; 194 | g2dMats(dd+1,zz)=g2mat(ii,jj,zz)+g2dMats(dd+1,zz); 195 | 196 | end 197 | end 198 | end 199 | 200 | 201 | 202 | 203 | %% 204 | tempOp=g2dMats./disN; 205 | 206 | for ww=1:length(Ws) 207 | temp=zeros(size(psiAllW{ww,1})); 208 | ww 209 | %psiAllW{ww,: 210 | 211 | 212 | for dd=1:DisordN 213 | g2dWD{ww,dd}=(abs(psiAllW{ww,dd}).^2)*tempOp'; 214 | temp=temp+abs(psiAllW{ww,dd}).^2; 215 | nbarWD{ww,dd}=(abs(psiAllW{ww,dd}).^2)*basis; 216 | nbar2WD{ww,dd}=(abs(psiAllW{ww,dd}).^2)*(basis.^2); 217 | end 218 | 219 | tempG2=zeros(size(g2dWD{ww,1})); 220 | for dd=1:DisordN 221 | tempG2=g2dWD{ww,dd}+tempG2; 222 | end 223 | tempG2=tempG2./DisordN; 224 | g2dWDMean{ww}=tempG2; 225 | 226 | temp=temp./DisordN; 227 | g2dW{ww}=temp*tempOp' 228 | nbarW{ww}=temp*basis; 229 | nbar2W{ww}=temp*(basis.^2) 230 | end 231 | 232 | %% 233 | 234 | avgRho=cell(length(Ws),1); 235 | for ww=1:length(Ws) 236 | temp=zeros(size(psiAllW{ww,1})); 237 | 238 | for dd=1:DisordN 239 | temp=temp+abs(psiAllW{ww,dd}).^2; 240 | end 241 | avgRho{ww}=temp./DisordN; 242 | end 243 | 244 | 245 | %% 246 | 247 | G2DNt=cell(size(basis,2),length(Ws)); 248 | G2IJN=cell(size(basis,2),length(Ws)); 249 | G2DNW=cell(length(Ws),1); 250 | for ww=1:length(Ws) 251 | ww 252 | temp=zeros(size(basis,2),NT); 253 | for ii=1:size(basis,2) 254 | %for ii=1:size(basis,2)-dd+1 255 | for jj=ii:size(basis,2) 256 | dd=abs(jj-ii)+1 257 | %jj=ii+dd-1; 258 | G2DNt{dd,ww}=[G2DNt{dd,ww}; reshape(g2mat(ii,jj,:),[1 size(basis,1)])*avgRho{ww}';]; 259 | G2IJN{dd,ww}=[G2IJN{dd,ww}; (reshape(nImat(ii,jj,:),[1 size(basis,1)])*avgRho{ww}').*(reshape(nJmat(ii,jj,:),[1 size(basis,1)])*avgRho{ww}');]; 260 | end 261 | %G2DNt{dd,ww}=mean(G2DNt{dd,ww},1); 262 | %G2IJN{dd,ww}=mean(G2IJN{dd,ww},1); 263 | %temp(dd,:)=G2DNt{dd,ww}./G2IJN{dd,ww}; 264 | 265 | G2DNtt{dd,ww}=mean(G2DNt{dd,ww}./G2IJN{dd,ww},1); 266 | G2IJN{dd,ww}=mean(G2IJN{dd,ww},1); 267 | %temp(dd,:)=G2DNt{dd,ww}./G2IJN{dd,ww}; 268 | temp(dd,:)=G2DNtt{dd,ww}; 269 | end 270 | G2DNW{ww}=temp; 271 | end 272 | 273 | 274 | %% 275 | tt=TT{1}; 276 | 277 | czz_un=zeros(NSites,NSites,length(Ws),length(tt)); 278 | czz=zeros(NSites,NSites,length(Ws),length(tt)); 279 | 280 | for ii=1:size(basis,2) 281 | for jj=ii:size(basis,2) 282 | if ii==jj 283 | optr=basis(:,ii).*basis(:,jj)-basis(:,ii); 284 | normrii=basis(:,ii); 285 | normrjj=basis(:,jj); 286 | 287 | else 288 | optr=basis(:,ii).*basis(:,jj); 289 | normrii=basis(:,ii); 290 | normrjj=basis(:,jj); 291 | 292 | end 293 | 294 | for ww=1:length(Ws) 295 | czz(ii,jj,ww,:)=avgRho{ww}*optr-(avgRho{ww}*normrii).*(avgRho{ww}*normrjj); 296 | 297 | czz_un(ii,jj,ww,:)=avgRho{ww}*optr; 298 | 299 | end 300 | 301 | end 302 | end 303 | 304 | %% 305 | czz_r=zeros([size(czz,1) size(czz,4) size(czz,3)]); 306 | for ww=1:length(Ws) 307 | for tti=1:length(tj) 308 | for dd=1:size(czz_r,1) 309 | czz_r(dd,tti,ww)=mean(diag( ... 310 | reshape(czz(:,:,ww,tti),[size(czz_r,1) size(czz_r,1)]), ... 311 | dd-1)); 312 | end 313 | xd(tti,ww)=-sum(czz_r(:,tti,ww).*([0:7]')); 314 | end 315 | end 316 | %% 317 | save('corrzz.mat','czz','czz_r','czz_un','Ws','tj','xd') 318 | xdLow=xd; 319 | tjLow=tj; 320 | WsLow=Ws; 321 | xd100jtLow=xd(67,:); 322 | save('LowWXDat.mat','WsLow','tjLow','xdLow','xd100jtLow') 323 | %} -------------------------------------------------------------------------------- /quenchHamUJ.m~: -------------------------------------------------------------------------------- 1 | % general ED bose-hubbard code 2 | % last cleaned up 9/24/2018 3 | % author: Matthew Rispoli 4 | 5 | addpath('functions') 6 | 7 | close all 8 | clear all 9 | clc 10 | 11 | 12 | % tunneling 13 | J=38.1911/1000; %8Er tunneling rate; defined in Hz/(2 pi) 14 | 15 | % disorder strengths 16 | NW=3; 17 | Ws=linspace(0.3,22,NW).*0.*J % units of J 18 | % tupe of disorder 19 | isQP=1; % 0 = uniform random, 1 = FFT of disorder from exp, 2 = actual QP 20 | 21 | % interaction strengths 22 | Uo=2.7*J % units of J 23 | Us=ones(size(Ws)).*Uo; %make them all the same 24 | Us=linspace(0,10,NW).*J; 25 | 26 | % system size parameters 27 | NPart=6 % number of bosons 28 | NSites=6 % number of sites 29 | 30 | % num of disorders and time scans 31 | ND=1; %disorder number 32 | DisordN=ND 33 | NT=25; % time steps 34 | Ts=linspace(0,10,NT).*(1./(2.*pi.*J)) %actual times for ED evaluation 35 | 36 | % periodic boundary conditions 37 | isPB = 0; % 0 = open boundary; 1 = periodic boundary 38 | jn = 1; % order of neighbor tunnelings 39 | 40 | %% 41 | 42 | % folder for storing all matrix files 43 | folderName = 'Hamiltonians/' 44 | % hamiltonian and basis parameters 45 | edFileName=[folderName sprintf('%i_sites_%i_bosons_%i_pb_%i_jn_loadme.mat',NSites,NPart,isPB,jn)] %format for Hamiltonian filename 46 | 47 | % find hilbert space dimension 48 | HilbD=HilbDim(NSites,NPart) 49 | 50 | % check if we've already made the basis and hamiltonians 51 | if exist(edFileName,'file')==2 52 | % if it exists then load 53 | load(edFileName); 54 | else 55 | % if it doesn't exist then make them all 56 | [Hi,Hj,basis] = MakeHamiltoniansAndBasis(NSites,NPart,jn,isPB); 57 | save(edFileName,'Hi','Hj','basis','NPart','NSites','jn','isPB') 58 | end 59 | 60 | %% 61 | % make giant dataStruct to save wavefunction for all disorders 62 | psiAllW=cell(NW,ND); 63 | 64 | % find initial state in basis 65 | psiInit=zeros(1,HilbD); 66 | psiInit(find(ismember(basis,ones(1,NSites),'rows')==1))=1; 67 | %% 68 | for ww=1:length(Ws) 69 | 70 | 71 | ww 72 | %bose hubbard parameters 73 | 74 | W=Ws(ww)*J; 75 | %W=2*J; 76 | U=Us(ww)*J; 77 | Ham = Hj.*J+Hi.*U; 78 | [psiAll, PhiN, En, Cn] = ExactDiagTimeFx(psiInit,Ts,Ham); 79 | 80 | PhiNSave{ww}=PhiN; 81 | EnSave{ww}=En; 82 | CnSave{ww}=Cn; 83 | 84 | pdf = abs(psiAll(:,end)).^2; 85 | [dataSmpl] = MonteCarloSmp(pdf,tind,NSamp) 86 | 87 | 88 | 89 | 90 | %[tt,psiAll,Deig]=mbl_8site_function_red(J,U,W,DisordN,NT,isQP); 91 | %{ 92 | TT{ww}=tt; 93 | DeigS{ww}=Deig; 94 | 95 | for dd=1:DisordN 96 | psiAllW{ww,dd}=psiAll{dd}; 97 | end 98 | %} 99 | 100 | end 101 | %% 102 | 103 | for ww=1:NW 104 | tempE(ww,:)=EnSave{ww}./J; 105 | gapsW(ww,:)=tempE(ww,2:end)-tempE(ww,1:end-1); 106 | tempC(ww,:)=CnSave{ww}; 107 | pn=tempC(ww,:).^2; 108 | pns(ww,:)=(pn(2:end).*pn(1:end-1)).*4; 109 | HL=round(HilbD/3); 110 | HH=round(HilbD.*2./3); 111 | tempGap=[gapsW(ww,HL:HH+1); gapsW(ww,HL-1:HH)]; 112 | rspec(ww)=mean(min(tempGap,[],1)./max(tempGap,[],1),2); 113 | 114 | [ii,jj]=sort(pn,'descend'); 115 | 116 | end 117 | %% 118 | %load('8site_loadme.mat'); 119 | %% 120 | %{ 121 | nhalf=sum(basis(:,1:size(basis,2)/2),2); 122 | ND=DisordN; 123 | 124 | 125 | Sp=zeros(NT,length(Ws),ND); 126 | SPM=zeros(NT,length(Ws)); 127 | 128 | NS=size(basis,2); 129 | rhon=zeros(NT,NS+1,length(Ws),ND); 130 | nbar=zeros(NS,NT,ND,length(Ws)); 131 | 132 | for ww=1:length(Ws) 133 | for dd=1:ND 134 | rho=abs(psiAllW{ww,dd}).^2; 135 | nbar(:,:,dd,ww)=(rho*basis)'; 136 | 137 | for nn=1:NS+1 138 | indsn=find(nhalf==(nn-1)); 139 | rhon(:,nn,ww,dd)=sum(rho(:,indsn),2); 140 | end 141 | temp=reshape(rhon(:,:,ww,dd),[NT NS+1]); 142 | 143 | Sp(:,ww,dd)=-sum(temp.*log(temp),2); 144 | end 145 | SPM=mean(Sp,3); 146 | nbarM=reshape(mean(nbar,3),[NS,NT,length(Ws)]); 147 | end 148 | %} 149 | 150 | %% 151 | %tj=TT{1}.*J.*2.*pi; 152 | 153 | %cab_corr_red; 154 | 155 | %subSystemsEP_small_half_only; 156 | 157 | %% Correlation length section 158 | %{ 159 | 160 | % Okay so this is looking at the old data 161 | 162 | %NN=size(prSitesW{1},1); 163 | NN=8; 164 | %NS=size(prSitesW{1},2); 165 | NS=9; 166 | NT=size(psiAllW{1},1); 167 | ND=size(psiAllW,2); 168 | % find long time indices 169 | indsLongTime=find(tt.*2.*pi.*J>100); 170 | 171 | 172 | % create g2matrices. Need to redo simulation to keep psi 173 | g2mats=zeros(size(basis,2),size(basis,2),size(basis,1)); 174 | nImats=zeros(size(basis,2),size(basis,2),size(basis,1)); 175 | nJmats=zeros(size(basis,2),size(basis,2),size(basis,1)); 176 | disN=zeros(NSites,size(basis,1)); 177 | g2dMats=zeros(NSites,size(basis,1)); 178 | 179 | for zz=1:size(basis,1) 180 | zz 181 | for ii=1:size(basis,2) 182 | for jj=ii:size(basis,2) 183 | if ii==jj 184 | g2mat(ii,jj,zz)=basis(zz,ii).^2-basis(zz,ii); 185 | 186 | else 187 | g2mat(ii,jj,zz)=basis(zz,ii).*basis(zz,jj); 188 | end 189 | nImat(ii,jj,zz)=basis(zz,ii); 190 | nJmat(ii,jj,zz)=basis(zz,jj); 191 | 192 | dd=abs(ii-jj); 193 | disN(dd+1,zz)=disN(dd+1,zz)+1; 194 | g2dMats(dd+1,zz)=g2mat(ii,jj,zz)+g2dMats(dd+1,zz); 195 | 196 | end 197 | end 198 | end 199 | 200 | 201 | 202 | 203 | %% 204 | tempOp=g2dMats./disN; 205 | 206 | for ww=1:length(Ws) 207 | temp=zeros(size(psiAllW{ww,1})); 208 | ww 209 | %psiAllW{ww,: 210 | 211 | 212 | for dd=1:DisordN 213 | g2dWD{ww,dd}=(abs(psiAllW{ww,dd}).^2)*tempOp'; 214 | temp=temp+abs(psiAllW{ww,dd}).^2; 215 | nbarWD{ww,dd}=(abs(psiAllW{ww,dd}).^2)*basis; 216 | nbar2WD{ww,dd}=(abs(psiAllW{ww,dd}).^2)*(basis.^2); 217 | end 218 | 219 | tempG2=zeros(size(g2dWD{ww,1})); 220 | for dd=1:DisordN 221 | tempG2=g2dWD{ww,dd}+tempG2; 222 | end 223 | tempG2=tempG2./DisordN; 224 | g2dWDMean{ww}=tempG2; 225 | 226 | temp=temp./DisordN; 227 | g2dW{ww}=temp*tempOp' 228 | nbarW{ww}=temp*basis; 229 | nbar2W{ww}=temp*(basis.^2) 230 | end 231 | 232 | %% 233 | 234 | avgRho=cell(length(Ws),1); 235 | for ww=1:length(Ws) 236 | temp=zeros(size(psiAllW{ww,1})); 237 | 238 | for dd=1:DisordN 239 | temp=temp+abs(psiAllW{ww,dd}).^2; 240 | end 241 | avgRho{ww}=temp./DisordN; 242 | end 243 | 244 | 245 | %% 246 | 247 | G2DNt=cell(size(basis,2),length(Ws)); 248 | G2IJN=cell(size(basis,2),length(Ws)); 249 | G2DNW=cell(length(Ws),1); 250 | for ww=1:length(Ws) 251 | ww 252 | temp=zeros(size(basis,2),NT); 253 | for ii=1:size(basis,2) 254 | %for ii=1:size(basis,2)-dd+1 255 | for jj=ii:size(basis,2) 256 | dd=abs(jj-ii)+1 257 | %jj=ii+dd-1; 258 | G2DNt{dd,ww}=[G2DNt{dd,ww}; reshape(g2mat(ii,jj,:),[1 size(basis,1)])*avgRho{ww}';]; 259 | G2IJN{dd,ww}=[G2IJN{dd,ww}; (reshape(nImat(ii,jj,:),[1 size(basis,1)])*avgRho{ww}').*(reshape(nJmat(ii,jj,:),[1 size(basis,1)])*avgRho{ww}');]; 260 | end 261 | %G2DNt{dd,ww}=mean(G2DNt{dd,ww},1); 262 | %G2IJN{dd,ww}=mean(G2IJN{dd,ww},1); 263 | %temp(dd,:)=G2DNt{dd,ww}./G2IJN{dd,ww}; 264 | 265 | G2DNtt{dd,ww}=mean(G2DNt{dd,ww}./G2IJN{dd,ww},1); 266 | G2IJN{dd,ww}=mean(G2IJN{dd,ww},1); 267 | %temp(dd,:)=G2DNt{dd,ww}./G2IJN{dd,ww}; 268 | temp(dd,:)=G2DNtt{dd,ww}; 269 | end 270 | G2DNW{ww}=temp; 271 | end 272 | 273 | 274 | %% 275 | tt=TT{1}; 276 | 277 | czz_un=zeros(NSites,NSites,length(Ws),length(tt)); 278 | czz=zeros(NSites,NSites,length(Ws),length(tt)); 279 | 280 | for ii=1:size(basis,2) 281 | for jj=ii:size(basis,2) 282 | if ii==jj 283 | optr=basis(:,ii).*basis(:,jj)-basis(:,ii); 284 | normrii=basis(:,ii); 285 | normrjj=basis(:,jj); 286 | 287 | else 288 | optr=basis(:,ii).*basis(:,jj); 289 | normrii=basis(:,ii); 290 | normrjj=basis(:,jj); 291 | 292 | end 293 | 294 | for ww=1:length(Ws) 295 | czz(ii,jj,ww,:)=avgRho{ww}*optr-(avgRho{ww}*normrii).*(avgRho{ww}*normrjj); 296 | 297 | czz_un(ii,jj,ww,:)=avgRho{ww}*optr; 298 | 299 | end 300 | 301 | end 302 | end 303 | 304 | %% 305 | czz_r=zeros([size(czz,1) size(czz,4) size(czz,3)]); 306 | for ww=1:length(Ws) 307 | for tti=1:length(tj) 308 | for dd=1:size(czz_r,1) 309 | czz_r(dd,tti,ww)=mean(diag( ... 310 | reshape(czz(:,:,ww,tti),[size(czz_r,1) size(czz_r,1)]), ... 311 | dd-1)); 312 | end 313 | xd(tti,ww)=-sum(czz_r(:,tti,ww).*([0:7]')); 314 | end 315 | end 316 | %% 317 | save('corrzz.mat','czz','czz_r','czz_un','Ws','tj','xd') 318 | xdLow=xd; 319 | tjLow=tj; 320 | WsLow=Ws; 321 | xd100jtLow=xd(67,:); 322 | save('LowWXDat.mat','WsLow','tjLow','xdLow','xd100jtLow') 323 | %} -------------------------------------------------------------------------------- /scriptEDbhm.m: -------------------------------------------------------------------------------- 1 | % general ED bose-hubbard code 2 | % last cleaned up 9/24/2018 3 | % author: Matthew Rispoli 4 | 5 | addpath('functions') 6 | 7 | close all 8 | clear all 9 | clc 10 | 11 | 12 | % tunneling 13 | J=38.1911/1000; %8Er tunneling rate; defined in Hz/(2 pi) 14 | 15 | % disorder strengths 16 | NW=15; 17 | Ws=linspace(0.3,22,NW).*0.*J % units of J 18 | % tupe of disorder 19 | isQP=1; % 0 = uniform random, 1 = FFT of disorder from exp, 2 = actual QP 20 | 21 | % interaction strengths 22 | Uo=2.7*J % units of J 23 | Us=ones(size(Ws)).*Uo; %make them all the same 24 | Us=linspace(0,30,NW).*J; 25 | 26 | % system size parameters 27 | NPart=8 % number of bosons 28 | NSites=8 % number of sites 29 | 30 | % num of disorders and time scans 31 | ND=1; %disorder number 32 | NT=25; % time steps 33 | Ts=linspace(0,10,NT).*(1./(2.*pi.*J)) %actual times for ED evaluation 34 | 35 | % periodic boundary conditions 36 | isPB = 0; % 0 = open boundary; 1 = periodic boundary 37 | jn = 1; % order of neighbor tunnelings 38 | 39 | %% 40 | 41 | % folder for storing all matrix files 42 | folderName = 'Hamiltonians/' 43 | % hamiltonian and basis parameters 44 | edFileName=[folderName sprintf('%i_sites_%i_bosons_%i_pb_%i_jn_loadme.mat',NSites,NPart,isPB,jn)] %format for Hamiltonian filename 45 | 46 | % find hilbert space dimension 47 | HilbD=HilbDim(NSites,NPart) 48 | 49 | % check if we've already made the basis and hamiltonians 50 | if exist(edFileName,'file')==2 51 | % if it exists then load 52 | load(edFileName); 53 | else 54 | % if it doesn't exist then make them all 55 | [Hi,Hj,basis] = MakeHamiltoniansAndBasis(NSites,NPart,jn,isPB); 56 | save(edFileName,'Hi','Hj','basis','NPart','NSites','jn','isPB') 57 | end 58 | 59 | %% 60 | % make giant dataStruct to save wavefunction for all disorders 61 | psiAllW=cell(NW,ND); 62 | 63 | % find initial state in basis 64 | psiInit=zeros(1,HilbD); 65 | psiInit(find(ismember(basis,ones(1,NSites),'rows')==1))=1; 66 | %% 67 | for ww=1:length(Ws) 68 | 69 | 70 | ww 71 | %bose hubbard parameters 72 | 73 | W=Ws(ww)*J; 74 | %W=2*J; 75 | U=Us(ww)*J; 76 | Ham = Hj.*J+Hi.*U; 77 | [psiAll, PhiN, En] = ExactDiagTimeFx(psiInit,Ts,Ham); 78 | 79 | ph 80 | 81 | 82 | 83 | 84 | [tt,psiAll,Deig]=mbl_8site_function_red(J,U,W,DisordN,NT,isQP); 85 | 86 | TT{ww}=tt; 87 | DeigS{ww}=Deig; 88 | 89 | for dd=1:DisordN 90 | psiAllW{ww,dd}=psiAll{dd}; 91 | end 92 | 93 | end 94 | %% 95 | load('8site_loadme.mat'); 96 | %% 97 | nhalf=sum(basis(:,1:size(basis,2)/2),2); 98 | ND=DisordN; 99 | 100 | 101 | Sp=zeros(NT,length(Ws),ND); 102 | SPM=zeros(NT,length(Ws)); 103 | 104 | NS=size(basis,2); 105 | rhon=zeros(NT,NS+1,length(Ws),ND); 106 | nbar=zeros(NS,NT,ND,length(Ws)); 107 | 108 | for ww=1:length(Ws) 109 | for dd=1:ND 110 | rho=abs(psiAllW{ww,dd}).^2; 111 | nbar(:,:,dd,ww)=(rho*basis)'; 112 | 113 | for nn=1:NS+1 114 | indsn=find(nhalf==(nn-1)); 115 | rhon(:,nn,ww,dd)=sum(rho(:,indsn),2); 116 | end 117 | temp=reshape(rhon(:,:,ww,dd),[NT NS+1]); 118 | 119 | Sp(:,ww,dd)=-sum(temp.*log(temp),2); 120 | end 121 | SPM=mean(Sp,3); 122 | nbarM=reshape(mean(nbar,3),[NS,NT,length(Ws)]); 123 | end 124 | 125 | %% 126 | tj=TT{1}.*J.*2.*pi; 127 | 128 | %cab_corr_red; 129 | 130 | %subSystemsEP_small_half_only; 131 | 132 | %% Correlation length section 133 | 134 | 135 | % Okay so this is looking at the old data 136 | 137 | %NN=size(prSitesW{1},1); 138 | NN=8; 139 | %NS=size(prSitesW{1},2); 140 | NS=9; 141 | NT=size(psiAllW{1},1); 142 | ND=size(psiAllW,2); 143 | % find long time indices 144 | indsLongTime=find(tt.*2.*pi.*J>100); 145 | 146 | 147 | % create g2matrices. Need to redo simulation to keep psi 148 | g2mats=zeros(size(basis,2),size(basis,2),size(basis,1)); 149 | nImats=zeros(size(basis,2),size(basis,2),size(basis,1)); 150 | nJmats=zeros(size(basis,2),size(basis,2),size(basis,1)); 151 | disN=zeros(NSites,size(basis,1)); 152 | g2dMats=zeros(NSites,size(basis,1)); 153 | 154 | for zz=1:size(basis,1) 155 | zz 156 | for ii=1:size(basis,2) 157 | for jj=ii:size(basis,2) 158 | if ii==jj 159 | g2mat(ii,jj,zz)=basis(zz,ii).^2-basis(zz,ii); 160 | 161 | else 162 | g2mat(ii,jj,zz)=basis(zz,ii).*basis(zz,jj); 163 | end 164 | nImat(ii,jj,zz)=basis(zz,ii); 165 | nJmat(ii,jj,zz)=basis(zz,jj); 166 | 167 | dd=abs(ii-jj); 168 | disN(dd+1,zz)=disN(dd+1,zz)+1; 169 | g2dMats(dd+1,zz)=g2mat(ii,jj,zz)+g2dMats(dd+1,zz); 170 | 171 | end 172 | end 173 | end 174 | 175 | 176 | 177 | 178 | %% 179 | tempOp=g2dMats./disN; 180 | 181 | for ww=1:length(Ws) 182 | temp=zeros(size(psiAllW{ww,1})); 183 | ww 184 | %psiAllW{ww,: 185 | 186 | 187 | for dd=1:DisordN 188 | g2dWD{ww,dd}=(abs(psiAllW{ww,dd}).^2)*tempOp'; 189 | temp=temp+abs(psiAllW{ww,dd}).^2; 190 | nbarWD{ww,dd}=(abs(psiAllW{ww,dd}).^2)*basis; 191 | nbar2WD{ww,dd}=(abs(psiAllW{ww,dd}).^2)*(basis.^2); 192 | end 193 | 194 | tempG2=zeros(size(g2dWD{ww,1})); 195 | for dd=1:DisordN 196 | tempG2=g2dWD{ww,dd}+tempG2; 197 | end 198 | tempG2=tempG2./DisordN; 199 | g2dWDMean{ww}=tempG2; 200 | 201 | temp=temp./DisordN; 202 | g2dW{ww}=temp*tempOp' 203 | nbarW{ww}=temp*basis; 204 | nbar2W{ww}=temp*(basis.^2) 205 | end 206 | 207 | %% 208 | 209 | avgRho=cell(length(Ws),1); 210 | for ww=1:length(Ws) 211 | temp=zeros(size(psiAllW{ww,1})); 212 | 213 | for dd=1:DisordN 214 | temp=temp+abs(psiAllW{ww,dd}).^2; 215 | end 216 | avgRho{ww}=temp./DisordN; 217 | end 218 | 219 | 220 | %% 221 | 222 | G2DNt=cell(size(basis,2),length(Ws)); 223 | G2IJN=cell(size(basis,2),length(Ws)); 224 | G2DNW=cell(length(Ws),1); 225 | for ww=1:length(Ws) 226 | ww 227 | temp=zeros(size(basis,2),NT); 228 | for ii=1:size(basis,2) 229 | %for ii=1:size(basis,2)-dd+1 230 | for jj=ii:size(basis,2) 231 | dd=abs(jj-ii)+1 232 | %jj=ii+dd-1; 233 | G2DNt{dd,ww}=[G2DNt{dd,ww}; reshape(g2mat(ii,jj,:),[1 size(basis,1)])*avgRho{ww}';]; 234 | G2IJN{dd,ww}=[G2IJN{dd,ww}; (reshape(nImat(ii,jj,:),[1 size(basis,1)])*avgRho{ww}').*(reshape(nJmat(ii,jj,:),[1 size(basis,1)])*avgRho{ww}');]; 235 | end 236 | %G2DNt{dd,ww}=mean(G2DNt{dd,ww},1); 237 | %G2IJN{dd,ww}=mean(G2IJN{dd,ww},1); 238 | %temp(dd,:)=G2DNt{dd,ww}./G2IJN{dd,ww}; 239 | 240 | G2DNtt{dd,ww}=mean(G2DNt{dd,ww}./G2IJN{dd,ww},1); 241 | G2IJN{dd,ww}=mean(G2IJN{dd,ww},1); 242 | %temp(dd,:)=G2DNt{dd,ww}./G2IJN{dd,ww}; 243 | temp(dd,:)=G2DNtt{dd,ww}; 244 | end 245 | G2DNW{ww}=temp; 246 | end 247 | 248 | 249 | %% 250 | tt=TT{1}; 251 | 252 | czz_un=zeros(NSites,NSites,length(Ws),length(tt)); 253 | czz=zeros(NSites,NSites,length(Ws),length(tt)); 254 | 255 | for ii=1:size(basis,2) 256 | for jj=ii:size(basis,2) 257 | if ii==jj 258 | optr=basis(:,ii).*basis(:,jj)-basis(:,ii); 259 | normrii=basis(:,ii); 260 | normrjj=basis(:,jj); 261 | 262 | else 263 | optr=basis(:,ii).*basis(:,jj); 264 | normrii=basis(:,ii); 265 | normrjj=basis(:,jj); 266 | 267 | end 268 | 269 | for ww=1:length(Ws) 270 | czz(ii,jj,ww,:)=avgRho{ww}*optr-(avgRho{ww}*normrii).*(avgRho{ww}*normrjj); 271 | 272 | czz_un(ii,jj,ww,:)=avgRho{ww}*optr; 273 | 274 | end 275 | 276 | end 277 | end 278 | 279 | %% 280 | czz_r=zeros([size(czz,1) size(czz,4) size(czz,3)]); 281 | for ww=1:length(Ws) 282 | for tti=1:length(tj) 283 | for dd=1:size(czz_r,1) 284 | czz_r(dd,tti,ww)=mean(diag( ... 285 | reshape(czz(:,:,ww,tti),[size(czz_r,1) size(czz_r,1)]), ... 286 | dd-1)); 287 | end 288 | xd(tti,ww)=-sum(czz_r(:,tti,ww).*([0:7]')); 289 | end 290 | end 291 | %% 292 | save('corrzz.mat','czz','czz_r','czz_un','Ws','tj','xd') 293 | xdLow=xd; 294 | tjLow=tj; 295 | WsLow=Ws; 296 | xd100jtLow=xd(67,:); 297 | save('LowWXDat.mat','WsLow','tjLow','xdLow','xd100jtLow') 298 | -------------------------------------------------------------------------------- /stdGn6Sites.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mnrispoli/MATLAB_ED_BHM/ec1770fb3d73d4bb68a50e9ce57889dcbca8c7b9/stdGn6Sites.gif -------------------------------------------------------------------------------- /subSystemsEP_small_half_only.m: -------------------------------------------------------------------------------- 1 | % create subsystems n shit 2 | load('8site_loadme.mat') 3 | 4 | halfS=size(basis,2)/2; 5 | fullS=size(basis,2); 6 | hD=size(basis,1); 7 | 8 | 9 | masksA=zeros(halfS,fullS); 10 | for ii=1:halfS 11 | masksA(ii,1:ii)=ones(size(masksA(ii,1:ii))) 12 | end 13 | 14 | masksAt=masksA; 15 | 16 | masksA=masksAt(end,:); 17 | 18 | EofPInd=size(masksA,1)+1; 19 | 20 | 21 | masksB=ones(size(masksA))-masksA; 22 | 23 | expon=(fullS:-1:1)-1; 24 | bases=ones(size(masksA,1),1)*(10.^(expon)); 25 | 26 | masksD=size(masksA,1); 27 | 28 | subSys=cell(1,masksD); 29 | uniqueRedSys=cell(1,masksD); 30 | psiInds=cell(1,masksD); 31 | 32 | subA=zeros(masksD,hD); 33 | subB=subA; 34 | 35 | subN=zeros(masksD,hD); 36 | for ii=1:hD 37 | subA(:,ii)=sum(masksA.*bases.*(ones(masksD,1)*basis(ii,:)),2); 38 | subB(:,ii)=sum(masksB.*bases.*(ones(masksD,1)*basis(ii,:)),2); 39 | 40 | subN(:,ii)=sum(masksA.*(ones(masksD,1)*basis(ii,:)),2); 41 | end 42 | 43 | allUSubA=cell(1,masksD); 44 | allUSubB=cell(1,masksD); 45 | 46 | allUindsSubA=cell(1,masksD); 47 | allUindsSubB=cell(1,masksD); 48 | 49 | % create mapping matrices 50 | AMap=cell(masksD,1); 51 | BMap=cell(masksD,1); 52 | BAMap=cell(masksD,1); 53 | rhoMap=cell(masksD,1); 54 | 55 | for ii=1:masksD 56 | %unrestricted n subspace 57 | 58 | allUSubA{ii}=unique(subA(ii,:)); 59 | tempA=allUSubA{ii}; 60 | 61 | allUSubB{ii}=unique(subB(ii,:)); 62 | tempB=allUSubB{ii}; 63 | 64 | BAMap{ii}=zeros(length(allUSubB{ii}),length(allUSubA{ii})); 65 | 66 | AMap{ii}=zeros(hD,1); 67 | BMap{ii}=zeros(hD,1); 68 | 69 | tempBA=BAMap{ii}; 70 | 71 | tempAM=AMap{ii}; 72 | tempBM=BMap{ii}; 73 | 74 | for jj=1:length(allUSubA{ii}) 75 | indsA=find(tempA(jj)==subA(ii,:)); 76 | tempAM(indsA)=jj; 77 | end 78 | 79 | 80 | for jj=1:length(allUSubB{ii}) 81 | indsB=find(tempB(jj)==subB(ii,:)); 82 | tempBM(indsB)=jj; 83 | 84 | for kk=1:length(indsB) 85 | indsA=find(subA(ii,indsB(kk))==allUSubA{ii}); 86 | tempBA(jj,indsA)=indsB(kk); 87 | %tempAM(jj,indsA)=indsB(kk); 88 | end 89 | end 90 | BMap{ii}=tempBM; 91 | AMap{ii}=tempAM; 92 | BAMap{ii}=tempBA; 93 | 94 | end 95 | 96 | %okay go through all the psis now? 97 | NW=size(psiAllW,1); 98 | ND=size(psiAllW,2); 99 | NT=size(psiAllW{1,1},1); 100 | 101 | SvnSubs=cell(NW,ND,masksD); 102 | SvnSubsAvg=cell(NW,masksD); 103 | rhoSubs=cell(NW,ND,masksD); 104 | %% 105 | %SPMTemp= 106 | h=waitbar(0,'tracing') 107 | for ii=1:masksD 108 | ii 109 | rdRhoMap=BAMap{ii}; 110 | hdA=size(rdRhoMap,2); 111 | tempBA=BAMap{ii}; 112 | 113 | for ww=1:length(Ws) 114 | 115 | 116 | SvnSubsAvg{ww,ii}=zeros(1,NT); 117 | 118 | saveVs=cell(ND,masksD); 119 | saveDs=cell(ND,masksD); 120 | 121 | for dd=1:ND 122 | ww 123 | dd 124 | 125 | rhoA=zeros(hdA,hdA,NT); 126 | psiT=psiAllW{ww,dd}; 127 | 128 | for bb=1:size(tempBA,1) 129 | 130 | indsA=find(tempBA(bb,:)>0); 131 | 132 | clear rho 133 | rho=zeros(hdA,hdA); 134 | 135 | for tt=1:NT 136 | rho(indsA,indsA)=ctranspose(psiT(tt,tempBA(bb,indsA)))* ... 137 | psiT(tt,tempBA(bb,indsA)); 138 | 139 | rhoA(:,:,tt)=rhoA(:,:,tt)+ ... 140 | rho; 141 | 142 | 143 | end 144 | 145 | end 146 | 147 | 148 | 149 | %clear rhoiiSave 150 | rhoiiSave=zeros(hdA,NT); 151 | for tt=1:NT 152 | 153 | temprho=reshape(rhoA(:,:,tt),[size(rhoA,1) size(rhoA,2)]); 154 | [V,D]=eig(temprho); 155 | rhoii=diag(abs(ctranspose(V(:,:))*temprho*V(:,:))); 156 | 157 | indrho=find(rhoii>0); 158 | Svn(tt)=-sum(rhoii(indrho).*log(rhoii(indrho))); 159 | 160 | rhoiiSave(:,tt)=rhoii; 161 | 162 | end 163 | 164 | 165 | rhoiiSaveW{ww,dd,ii}=rhoiiSave; 166 | SvnSubs{ww,dd,ii}=Svn; 167 | SvnSubsAvg{ww,ii}=SvnSubsAvg{ww,ii}+SvnSubs{ww,dd,ii}./ND; 168 | 169 | waitbar(((dd-1)+(ww-1)*(ND)+(ii-1)*(NW*ND))/(masksD*NW*ND),h) 170 | end 171 | 172 | 173 | end 174 | 175 | end 176 | close(h) 177 | 178 | 179 | %% 180 | svnM=zeros(NT,length(Ws)); 181 | for ww=1:length(Ws) 182 | svnM(:,ww)=SvnSubsAvg{ww,1}; 183 | end 184 | %% 185 | figure(22) 186 | subplot(1,3,1) 187 | hold on 188 | semilogx(tj,SPM) 189 | subplot(1,3,2) 190 | hold on 191 | plot(tj,svnM) 192 | subplot(1,3,3) 193 | hold on 194 | plot(tj,svnM-SPM) 195 | 196 | --------------------------------------------------------------------------------