Initialization

Needs["MaTeX`"]
SetOptions[MaTeX,"Preamble"->{"\\usepackage{amssymb,amsmath,latexsym,amsfonts,amsthm,mathpazo,xcolor,bm,mhchem}"}];

ExtractOG[tab_]:=Table[{tab[[k,1]],tab[[k,2]],tab[[k,3]],tab[[k,4]],tab[[k,3]]-tab[[k,2]],tab[[k,4]]-tab[[k,2]]},{k,Length[tab]}]

ExtractFG[tab_]:=Table[{tab[[k,1]],tab[[k,2]],tab[[k,3]],tab[[k,4]],tab[[k,2]]-tab[[k,3]],tab[[k,3]]-tab[[k,4]],tab[[k,2]]+tab[[k,4]]-2tab[[k,3]]},{k,Length[tab]}]

Needs["NumericalDifferentialEquationAnalysis`"]

HaToeV=27.21138602;

(Subscript[P, n_])[x_]=LegendreP[n,x];

(Subscript[δ, a_,b_])=KroneckerDelta[a,b];

SortEigensystem[eigsys_]:=Transpose[Sort[Transpose[eigsys]]]

Γ[x_] = Gamma[x];	ζ[x_]=Zeta[x];	(Subscript[B, a_,k_])=(((((-1))^k)a!)/(((a/2)+k)!((a/2)-k)!));

(Subscript[H, p_])[n_]=HarmonicNumber[n,p];	(Subscript[δ, x_])=KroneckerDelta[x];

(Subscript[U, k_])[x_]=ChebyshevU[k,x];

(Subscript[V, p_,q_])=(1/π)(PolyGamma[p+(1/2)]-PolyGamma[q+(1/2)]);

F[a_,b_,c_,x_]=Hypergeometric2F1[a,b,c,x];

$Assumptions=0<(Subscript[θ, 5])<(Subscript[θ, 4])<(Subscript[θ, 3])<(Subscript[θ, 2])<(Subscript[θ, 1])<2π&&R>0;

(*SetOptions[Integrate,GenerateConditions->False];*)

J3[i_,a_,l_]:=ThreeJSymbol[{i,0},{a,0},{l,0}];

J6[{a_,b_,c_},{e_,f_,g_}]:=SixJSymbol[{a,b,c},{e,f,g}];

(Subscript[C, k_,L_])[x_]=GegenbauerC[k,L,x];	(Subscript[G, k_,L_])[x_]=(Sqrt[(2/π)(((k+1)(k-L)!)/((k+L+1)!))])(2^L)L!(((1-(x^2)))^(L/2))GegenbauerC[k-L,L+1,x];

(Subscript[Y, L_,m_])[θ_,ϕ_]=SphericalHarmonicY[L,m,θ,ϕ];	(Subscript[Y, k_,L_,m_])[χ_,θ_,ϕ_]=(Subscript[G, k,L])[Cos[χ]](Subscript[Y, L,m])[θ,ϕ];

(Subscript[𝒴, ℓ_,m_])[θ_,ϕ_]:=FullSimplify[Which[m<0,(I/(Sqrt[2]))((Subscript[Y, ℓ,m])[θ,ϕ]-(((-1))^m)(Subscript[Y, ℓ,-m])[θ,ϕ]),m==0,(Subscript[Y, ℓ,0])[θ,ϕ],m>0,(1/(Sqrt[2]))((Subscript[Y, ℓ,m])[θ,ϕ]+(((-1))^m)(Subscript[Y, ℓ,-m])[θ,ϕ])],0<θ<π&&0<ϕ<2π];

(Subscript[U, k_])[θ_]=ChebyshevU[k,θ];

TakeMOs[c_,n_]:=Take[c\[Transpose],n]\[Transpose];

AngQ[Shell_]:=Which[
Shell=="S",{{0,0,0}}
,
Shell=="P",{{1,0,0},{0,1,0},{0,0,1}}
,
Shell=="SP",{{0,0,0},{1,0,0},{0,1,0},{0,0,1}}
,
Shell=="D",{{2,0,0},{0,2,0},{0,0,2},{1,1,0},{1,0,1},{0,1,1}}
];

NormCoeff[α_,{ax_,ay_,az_}]:=(((((2α)/π)))^(3/4))((((4α))^((ax+ay+az)/2))/((((2ax-1)!!(2ay-1)!!(2az-1)!!))^(1/2)))

LDA[r_]:=Module[{α=-((π^2)/360),β=(3/4)-((Log[2π])/2),γ=2.408779},α F[1,(3/2),γ,((2α(1-γ))/β)r]];
gLDAold[r_,η_]:=Module[{α=-((π^2)/360)η+(1-η)((((Log[1-η])^2)-6Log[1-η])/348),β=((3/4)-((Log[2π])/2))η-(((1-η)Log[1-η])/16),γ=(19/16)((4-3(Sqrt[1-η]))/(2-(Sqrt[1-η])))},α F[1,(3/2),γ,((2α(1-γ))/β)r]]
gLDAr[r_,η_]:=Module[{α=((0.025873 -0.025873 (Sqrt[1-η])-0.032541 η)/(0.741760 +(Sqrt[1-η])-0.498560η)),β=((0.164037 -0.164037(Sqrt[1-η])-0.261152 η)/(0.519097 + (Sqrt[1-η])+0.055756 η)),γ=((18.3407+0.154372 (Sqrt[1-η])-13.2193η)/(8.807757+ (Sqrt[1-η])-6.681718 η))},α F[1,(3/2),γ,((2α(1-γ))/β)r]]
gLDAj[r_,η_]:=Module[{α=((0.025979 -0.025979 (Sqrt[1-η])-0.033891η)/(0.642367+ (Sqrt[1-η])-0.353798 η)),β=((0.163723 -0.163723(Sqrt[1-η])-0.301135η)/(0.661217 +(Sqrt[1-η])+0.152167 η)),γ=((33.0265-0.896247(Sqrt[1-η])-24.2518 η)/(16.1820 + (Sqrt[1-η])-12.5392η))},α F[1,(3/2),γ,((2α(1-γ))/β)r]]

FCI energies

Optical gap

(* 1-boxium *)

OG$FCI$Box1={
{π/8,32.0000,128.0000,425.2500},
{π/4,8.0000,32.0000,108.6250},
{π/2,2.0000,8.0000,28.3126},
{π,0.5000,2.0000,7.6563},
{2π,0.1250,0.5000,2.2032},
{4π,0.0313,0.1250,0.6953},
{8π,0.0078,0.0313,0.2461}
};

(* 2-boxium: ISYM = 1 for single (1st); ISYM = 2 for GS (1st) and double (4th) *)

OG$FCI$Box2={
{π/8,168.194647457517,330.247099518617,809.997236942863},
{π/4,44.066245327556,85.089035270872,204.983993592649},
{π/2,12.003474686978,22.511247966844,52.477745688713},
{π,3.474697756254,6.224681568238,13.725225716610},
{2π,1.089643101935,1.835450653521,3.724835357058},
{4π,0.371923233496,0.584464153401,1.069631767456},
{8π,0.136701473570,0.200612317127,0.330035342585}
};

OG$FCI$Hoo2={
{1/8,134.306966634967,198.307048175882,388.717642198611},
{1/4,35.116733875586,82.629477486454,98.350433616720},
{1/2,9.523485558798,13.523541633030,25.166635270512},
{1,2.730279741635,3.730313607222,6.574457555688},
{2,0.839318743440,1.089331059140,1.778189253372},
{4,0.276445304604,0.338946992679,0.505618191336},
{8,0.096276955811,0.111901992528,0.152517866678}
};

(* 3-boxium: ISYM = 1 for single (1st); ISYM = 2 for GS (1st) and double (5th) *)

OG$FCI$Box3={
{π/8,475.689137297133,702.832986991962,1379.312775077065},
{π/4,125.777620024696,183.337026650873,353.596718522501},
{π/2,34.824765534451,49.592185312635,92.739770765432},
{π,10.353570159294,14.225525541146,25.313478306262},
{2π,3.376559833367,4.426922104966,7.354607736729},
{4π,1.212589962013,1.510475926450,2.320339147958},
{8π,0.472104597487,0.560562392572,0.798991452147}
};

OG$FCI$Hoo3={
{1/8,433.046255824774,370.139303362163,560.189781816957},
{1/4,80.967183128472,96.967305789967,144.033132095455},
{1/2,22.386403725363,26.386535111556,37.956471657343},
{1,6.605556481758,7.605639924904,10.421493152131},
{2,2.105673493835,2.355707250902,3.035499360038},
{4,0.720329154580,0.782834864894,0.947180824103},
{8,0.259393436738,0.275018613675,0.315138371443}
};

(* 4-boxium: ISYM = 2 for single (1st); ISYM = 1 for GS (1st) and double (6th) *)

OG$FCI$Box4={
{π/8,1020.377826306212,1312.277649574934,2183.439918848647},
{π/4,270.084911552971,344.018425212034,563.594854515617},
{π/2,74.942626586546,93.893577625727,149.675266619095},
{π,22.378989494957,27.339766360243,41.721265951086},
{2π,7.359529441727,8.702149978113,12.505211643625},
{4π,2.679848484674,3.060001596501,4.103334591532},
{8π,1.063300535582,1.176437809352,1.474879504579}
};

OG$FCI$Hoo4={
{1/8,547.008466060107,611.008778034302,800.906198851536},
{1/4,145.312309565214,161.312590988340,208.308396593762},
{1/2,40.474020128002,44.474248855351,56.014676345089},
{1,12.072553525363,13.072704357478,15.877750196001},
{2,3.900559363681,4.150625344994,4.827151554221},
{4,1.353131889799,1.415645056193,1.579170310532},
{8,0.493273508175,0.508899026860,0.548839805231}
};

(* 5-boxium: ISYM = 2 for single (1st); ISYM = 1 for GS (1st) and double (6th) *)

OG$FCI$Box5={
{π/8,1867.634432897571,2224.114881479695,3289.202164536041},
{π/4,493.675989269342,583.898128200365,852.424860192444},
{π/2,136.701998886836,159.795718126304,228.041456100084},
{π,40.724446821138,46.755280540827,64.359664246614},
{2π,13.376330334855,15.002924695211,19.661299622678},
{4π,4.881091333305,5.339932438232,6.620603544129},
{8π,1.949201504573,2.085461298434,2.454693287925}
};

OG$FCI$Hoo5={
{1/8,856.567128271245,920.567592845632,1110.396532266610},
{1/4,227.981820806457,243.982244886060,290.947065112599},
{1/2,63.704380157472,67.704732710623,79.232394739424},
{1,19.093091474633,20.093332880301,22.893922636144},
{2,6.207015878896,6.457127454050,7.132353799942},
{4,2.167729801409,2.230254639564,2.393430292269},
{8,0.795054822065,0.810681052644,0.850536146029}
};

(* 6-boxium: ISYM = 1 for single (1st); ISYM = 2 for GS (1st) and double (7th) *)

OG$FCI$Box6={
{π/8,3082.538592307266,3503.491114465548,4762.092148708625},
{π/4,813.091046312833,919.548717184423,1236.825699224190},
{π/2,224.373396815660,251.584170388871,332.199311585841},
{π,66.525672226089,73.614455317188,94.398816871470},
{2π,21.745363803746,23.650409772876,29.145482275709},
{4π,7.913585546761,8.448674689191,9.958206490046},
{8π,3.163328897487,3.321666241995,3.757156601730}
};

(* 6-hookium: ISYM = 1 for single (1st); ISYM = 2 for GS (1st) and double (6th) *)

OG$FCI$Hoo6={
{1/8,1234.548258814865,1298.548891687954,1488.349521606859},
{1/4,328.844859262140,344.845443138769,391.797609003031},
{1/2,92.014498996882,96.014996621804,107.537548007773},
{1,27.637766114687,28.638126560586,31.430970398074},
{2,,9.262093725244,},
{4,,,},
{8,,,}
};

(* 7-boxium: ISYM = 1 for single (1st); ISYM = 2 for GS (1st) and double (7th) *)

OG$FCI$Box7={
{π/8,4729.980182866665,5215.330721802965,6667.185162322629},
{π/4,1244.775321976067,1367.431588067781,1733.331921404049},
{π/2,342.179614483909,373.489667162725,466.413256109140},
{π,100.894340981957,109.032585695498,132.968610267275},
{2π,32.772804565850,34.952363143892,41.271529495215},
{4π,11.868295610054,12.477867995175,14.209581263880},
{8π,4.735896911600,4.915555657624,5.414589632737}
};

OG$FCI$Hoo7={
{1/8,,,},
{1/4,,,},
{1/2,,,},
{1,,,},
{2,,,},
{4,,,},
{8,,,}
};

SetAccuracy[ExtractOG[OG$FCI$Box7][[;;,2;;6]],5]\[Transpose]//TableForm

Fundamental gap

FG$FCI$Box2={
{π/8,32.0000,168.194647457517,475.689137297133},
{π/4,8.0000,44.066245327556,125.777620024696},
{π/2,2.0000,12.003474686978,34.824765534451},
{π,0.5000,3.474697756254,10.353570159294},
{2π,0.1250,1.089643101935,3.376559833367},
{4π,0.0313,0.371923233496,1.212589962013},
{8π,0.0078,0.136701473570,0.472104597487}
};

FG$FCI$Box3={
{π/8,168.194647457517,475.689137297133,1020.377826306212},
{π/4,44.066245327556,125.777620024696,270.084911552971},
{π/2,12.003474686978,34.824765534451,74.942626586546},
{π,3.474697756254,10.353570159294,22.378989494957},
{2π,1.089643101935,3.376559833367,7.359529441727},
{4π,0.371923233496,1.212589962013,2.679848484674},
{8π,0.136701473570,0.472104597487,1.063300535582}
};

FG$FCI$Box4={
{π/8,475.689137297133,1020.377826306212,1867.634432897571},
{π/4,125.777620024696,270.084911552971,493.675989269342},
{π/2,34.824765534451,74.942626586546,136.701998886836},
{π,10.353570159294,22.378989494957,40.724446821138},
{2π,3.376559833367,7.359529441727,13.376330334855},
{4π,1.212589962013,2.679848484674,4.881091333305},
{8π,0.472104597487,1.063300535582,1.949201504573}
};

FG$FCI$Box5={
{π/8,1020.377826306212,1867.634432897571,3082.538592307266},
{π/4,270.084911552971,493.675989269342,813.091046312833},
{π/2,74.942626586546,136.701998886836,224.373396815660},
{π,22.378989494957,40.724446821138,66.525672226089},
{2π,7.359529441727,13.376330334855,21.745363803746},
{4π,2.679848484674,4.881091333305,7.913585546761},
{8π,1.063300535582,1.949201504573,3.163328897487}
};

FG$FCI$Box6={
{π/8,1867.634432897571,3082.538592307266,4729.980182866665},
{π/4,493.675989269342,813.091046312833,1244.775321976067},
{π/2,136.701998886836,224.373396815660,342.179614483909},
{π,40.724446821138,66.525672226089,100.894340981957},
{2π,13.376330334855,21.745363803746,32.772804565850},
{4π,4.881091333305,7.913585546761,11.868295610054},
{8π,1.949201504573,3.163328897487,4.735896911600}
};

eDFT energies

Optical gap

Energies

OG$c$Box2$0={{(π/8),168.15492271506832`,330.26856749867693`,809.9546388395127`},{(π/4),44.027155043661175`,85.11037283273235`,204.94146107533206`},{(π/2),11.965491620555541`,22.532283439300436`,52.43585905887279`},{π,3.4386011662527936`,6.244688034513225`,13.686557073801499`},{2 π,1.0572975210116857`,1.8513578957921852`,3.69988225703675`},{4 π,0.348340783488998`,0.5946216845175345`,1.0651291131791152`},{8 π,,,}};
OG$c$Box2$SA={{(π/8),168.19777847002158`,330.25607059082785`,809.9967330453873`},{(π/4),44.06983164290744`,85.09777024406881`,204.98309922104218`},{(π/2),12.00783163898371`,22.519520184065286`,52.476252967076775`},{π,3.4800895898374824`,6.232216135936472`,13.722921503893984`},{2 π,1.0938687327570342`,1.842478632684687`,3.7217825824977306`},{4 π,0.3693751095074715`,0.5915508812765917`,1.066961145657589`},{8 π,,,}};

OG$c$Box3$0={{(π/8),475.6409964290283`,702.8672448869478`,1379.340478613646`},{(π/4),125.72980620526384`,183.37056634410018`,353.62333946779023`},{(π/2),34.777513874934556`,49.62428734188752`,92.76447599174641`},{π,10.30725992198291`,14.254692677433242`,25.33501715723421`},{2 π,3.332006386120157`,4.448907490466025`,7.373271921475466`},{4 π,1.1738786791956894`,1.5188242340007403`,2.3410364609506624`},{8 π,0.4463688838616467`,0.5613914151631187`,0.8198335151352746`}};
OG$c$Box3$SA={{(π/8),475.6969341865941`,702.8501310933652`,1379.3772421934125`},{(π/4),125.78557683703006`,183.3532319227312`,353.6603359153622`},{(π/2),34.8329565088978`,49.606583726481404`,92.80179976103352`},{π,10.362045429815373`,14.236688152651201`,25.372452409365383`},{2 π,3.384677628961489`,4.433251019478312`,7.407558501636099`},{4 π,1.2149354060612965`,1.5123697830946896`,2.3622757576584843`},{8 π,0.4698553772043994`,0.5609082029300334`,0.8289489388255149`}};

OG$c$Box4$0={{(π/8),1020.3237637120016`,1312.3189485265302`,2183.5040753464436`},{(π/4),270.03099267437784`,344.0589604878069`,563.6570543810623`},{(π/2),74.88891184786348`,93.93258158813605`,149.73377300548626`},{π,22.325575386830874`,27.37591814759509`,41.77288990174612`},{2 π,7.306621455584239`,8.732528295580869`,12.545064423484183`},{4 π,2.629449728034189`,3.0758864577769764`,4.128623951205954`},{8 π,1.0247276980473803`,1.1771885491139717`,1.489633140933328`}};
OG$c$Box4$SA={{(π/8),1020.3863343076389`,1312.294047925763`,2183.5335188065387`},{(π/4),270.09342679187375`,344.03364579899164`,563.6865373830525`},{(π/2),74.9510682851474`,93.90647797301631`,149.76322510089847`},{π,22.38715778653807`,27.3484570606687`,41.80189241930044`},{2 π,7.366686733623616`,8.70414263800475`,12.571558008915227`},{4 π,2.6819348021300815`,3.0549770004301897`,4.146646532895811`},{8 π,1.0618025535594646`,1.1720349577276201`,1.5047580243953107`}};

OG$c$Box5$0={{(π/8),1867.5757775492211`,2224.1606026384`,3289.288222630861`},{(π/4),493.61735571427886`,583.9431134188851`,852.5085722328557`},{(π/2),136.6433402976773`,159.83922933329274`,228.12073882135664`},{π,40.66566712692822`,46.796144174063684`,64.43076731698773`},{2 π,13.317234346349565`,15.039111399283458`,19.718315086619715`},{4 π,4.822132377115651`,5.3639767721476375`,6.658155999829459`},{8 π,1.8985495528546645`,2.088736617588009`,2.474210200547741`}};
OG$c$Box5$SA={{(π/8),1867.6414447180805`,2224.1311083509927`,3289.3101049615148`},{(π/4),493.68294428357814`,583.9131883069501`,852.5304222234529`},{(π/2),136.70877275380766`,159.80846924078872`,228.14247409950343`},{π,40.7307955416284`,46.763844274542464`,64.45211777824385`},{2 π,13.38166077342119`,15.00470675021722`,19.738387476728924`},{4 π,4.8825614437066935`,5.333255559512595`,6.674301393319577`},{8 π,1.9443335268986592`,2.0759091459525063`,2.4870303683790653`}};

OG$c$Box6$0={{(π/8),3082.475991186376`,3503.5396495903383`,4762.193780561228`},{(π/4),813.0283934241683`,919.5963986653794`,1236.9248751364123`},{(π/2),224.3105772676969`,251.63061990199603`,332.29388708992786`},{π,66.4624656109533`,73.65843568234791`,94.48496113104181`},{2 π,21.681308509617942`,23.690394676393883`,29.217148458485674`},{4 π,7.848148537690231`,8.479435132088613`,10.008792505981`},{8 π,3.1020793742905326`,3.3293670051800652`,3.7840938073703274`}};
OG$c$Box6$SA={{(π/8),3082.5431515628643`,3503.506842752574`,4762.208803318792`},{(π/4),813.0955434828553`,919.5631251947167`,1236.9398362901316`},{(π/2),224.37771245483853`,251.59642266687624`,332.30870296332125`},{π,66.52959729427138`,73.62243956484117`,94.49941978664963`},{2 π,21.748472071912634`,23.65123228403099`,29.230668918780836`},{4 π,7.914174721345744`,8.439552769777961`,10.019676991932396`},{8 π,3.156581074700703`,3.305592098765886`,3.79254120665359`}};

OG$c$Box7$0={{(π/8),4729.913806907565`,5215.380860330249`,6667.297290334195`},{(π/4),1244.7087556703218`,1367.4810821313115`,1733.4422251219949`},{(π/2),342.11291094393016`,373.53784204768317`,466.5192988026742`},{π,100.82709943568615`,109.07844203866216`,133.06645220827127`},{2 π,32.704399178520724`,34.99465771014556`,41.35499693093446`},{4 π,11.797582218213648`,12.513378741268767`,14.272863338446072`},{8 π,4.665639957252881`,4.928699271288726`,5.450376667112608`}};
OG$c$Box7$SA={{(π/8),4729.981577474568`,5215.345633873596`,6667.306800372482`},{(π/4),1244.7765731045777`,1367.4453625591138`,1733.4516699261999`},{(π/2),342.1808302325391`,373.50113496777817`,466.52860051951416`},{π,100.89525531426344`,109.03976051739525`,133.07542543154534`},{2 π,32.77312196543616`,34.95216041983064`,41.36313308923556`},{4 π,11.866964078944916`,12.466822148228003`,14.278564878772379`},{8 π,4.727952950791855`,4.8945396704194195`,5.453347392144472`}};

Differences

Individual energies for w=(0,0)

With[{n=2},
SetAccuracy[
TableForm[{
(OG$c$Box2$0[[;;,n]])-(OG$FCI$Box2[[;;,n]]),
(OG$c$Box3$0[[;;,n]])-(OG$FCI$Box3[[;;,n]]),
(OG$c$Box4$0[[;;,n]])-(OG$FCI$Box4[[;;,n]]),
(OG$c$Box5$0[[;;,n]])-(OG$FCI$Box5[[;;,n]]),
(OG$c$Box6$0[[;;,n]])-(OG$FCI$Box6[[;;,n]]),
(OG$c$Box7$0[[;;,n]])-(OG$FCI$Box7[[;;,n]])
}]
,5]
]

With[{n=3},
SetAccuracy[
TableForm[{
(OG$c$Box2$0[[;;,n]])-(OG$FCI$Box2[[;;,n]]),
(OG$c$Box3$0[[;;,n]])-(OG$FCI$Box3[[;;,n]]),
(OG$c$Box4$0[[;;,n]])-(OG$FCI$Box4[[;;,n]]),
(OG$c$Box5$0[[;;,n]])-(OG$FCI$Box5[[;;,n]]),
(OG$c$Box6$0[[;;,n]])-(OG$FCI$Box6[[;;,n]]),
(OG$c$Box7$0[[;;,n]])-(OG$FCI$Box7[[;;,n]])
}]
,5]
]

With[{n=4},
SetAccuracy[
TableForm[{
(OG$c$Box2$0[[;;,n]])-(OG$FCI$Box2[[;;,n]]),
(OG$c$Box3$0[[;;,n]])-(OG$FCI$Box3[[;;,n]]),
(OG$c$Box4$0[[;;,n]])-(OG$FCI$Box4[[;;,n]]),
(OG$c$Box5$0[[;;,n]])-(OG$FCI$Box5[[;;,n]]),
(OG$c$Box6$0[[;;,n]])-(OG$FCI$Box6[[;;,n]]),
(OG$c$Box7$0[[;;,n]])-(OG$FCI$Box7[[;;,n]])
}]
,5]
]

Individual energies for w=(1/3,1/3)

With[{n=2},
SetAccuracy[
TableForm[{
(OG$c$Box2$SA[[;;,n]])-(OG$FCI$Box2[[;;,n]]),
(OG$c$Box3$SA[[;;,n]])-(OG$FCI$Box3[[;;,n]]),
(OG$c$Box4$SA[[;;,n]])-(OG$FCI$Box4[[;;,n]]),
(OG$c$Box5$SA[[;;,n]])-(OG$FCI$Box5[[;;,n]]),
(OG$c$Box6$SA[[;;,n]])-(OG$FCI$Box6[[;;,n]]),
(OG$c$Box7$SA[[;;,n]])-(OG$FCI$Box7[[;;,n]])
}]
,5]
]

With[{n=3},
SetAccuracy[
TableForm[{
(OG$c$Box2$SA[[;;,n]])-(OG$FCI$Box2[[;;,n]]),
(OG$c$Box3$SA[[;;,n]])-(OG$FCI$Box3[[;;,n]]),
(OG$c$Box4$SA[[;;,n]])-(OG$FCI$Box4[[;;,n]]),
(OG$c$Box5$SA[[;;,n]])-(OG$FCI$Box5[[;;,n]]),
(OG$c$Box6$SA[[;;,n]])-(OG$FCI$Box6[[;;,n]]),
(OG$c$Box7$SA[[;;,n]])-(OG$FCI$Box7[[;;,n]])
}]
,5]
]

With[{n=4},
SetAccuracy[
TableForm[{
(OG$c$Box2$SA[[;;,n]])-(OG$FCI$Box2[[;;,n]]),
(OG$c$Box3$SA[[;;,n]])-(OG$FCI$Box3[[;;,n]]),
(OG$c$Box4$SA[[;;,n]])-(OG$FCI$Box4[[;;,n]]),
(OG$c$Box5$SA[[;;,n]])-(OG$FCI$Box5[[;;,n]]),
(OG$c$Box6$SA[[;;,n]])-(OG$FCI$Box6[[;;,n]]),
(OG$c$Box7$SA[[;;,n]])-(OG$FCI$Box7[[;;,n]])
}]
,5]
]

Single excitation

With[{n=3},
SetAccuracy[
TableForm[{
(OG$c$Box2$0[[;;,n]]-OG$c$Box2$0[[;;,2]])-(OG$FCI$Box2[[;;,n]]-OG$FCI$Box2[[;;,2]]),
(OG$c$Box3$0[[;;,n]]-OG$c$Box3$0[[;;,2]])-(OG$FCI$Box3[[;;,n]]-OG$FCI$Box3[[;;,2]]),
(OG$c$Box4$0[[;;,n]]-OG$c$Box4$0[[;;,2]])-(OG$FCI$Box4[[;;,n]]-OG$FCI$Box4[[;;,2]]),
(OG$c$Box5$0[[;;,n]]-OG$c$Box5$0[[;;,2]])-(OG$FCI$Box5[[;;,n]]-OG$FCI$Box5[[;;,2]]),
(OG$c$Box6$0[[;;,n]]-OG$c$Box6$0[[;;,2]])-(OG$FCI$Box6[[;;,n]]-OG$FCI$Box6[[;;,2]]),
(OG$c$Box7$0[[;;,n]]-OG$c$Box7$0[[;;,2]])-(OG$FCI$Box7[[;;,n]]-OG$FCI$Box7[[;;,2]])
}]
,5]
]

With[{n=3},
SetAccuracy[
TableForm[{
(OG$c$Box2$SA[[;;,n]]-OG$c$Box2$SA[[;;,2]])-(OG$FCI$Box2[[;;,n]]-OG$FCI$Box2[[;;,2]]),
(OG$c$Box3$SA[[;;,n]]-OG$c$Box3$SA[[;;,2]])-(OG$FCI$Box3[[;;,n]]-OG$FCI$Box3[[;;,2]]),
(OG$c$Box4$SA[[;;,n]]-OG$c$Box4$SA[[;;,2]])-(OG$FCI$Box4[[;;,n]]-OG$FCI$Box4[[;;,2]]),
(OG$c$Box5$SA[[;;,n]]-OG$c$Box5$SA[[;;,2]])-(OG$FCI$Box5[[;;,n]]-OG$FCI$Box5[[;;,2]]),
(OG$c$Box6$SA[[;;,n]]-OG$c$Box6$SA[[;;,2]])-(OG$FCI$Box6[[;;,n]]-OG$FCI$Box6[[;;,2]]),
(OG$c$Box7$SA[[;;,n]]-OG$c$Box7$SA[[;;,2]])-(OG$FCI$Box7[[;;,n]]-OG$FCI$Box7[[;;,2]])
}]
,5]
]

Double excitation

With[{n=4},
SetAccuracy[
TableForm[{
(OG$c$Box2$0[[;;,n]]-OG$c$Box2$0[[;;,2]])-(OG$FCI$Box2[[;;,n]]-OG$FCI$Box2[[;;,2]]),
(OG$c$Box3$0[[;;,n]]-OG$c$Box3$0[[;;,2]])-(OG$FCI$Box3[[;;,n]]-OG$FCI$Box3[[;;,2]]),
(OG$c$Box4$0[[;;,n]]-OG$c$Box4$0[[;;,2]])-(OG$FCI$Box4[[;;,n]]-OG$FCI$Box4[[;;,2]]),
(OG$c$Box5$0[[;;,n]]-OG$c$Box5$0[[;;,2]])-(OG$FCI$Box5[[;;,n]]-OG$FCI$Box5[[;;,2]]),
(OG$c$Box6$0[[;;,n]]-OG$c$Box6$0[[;;,2]])-(OG$FCI$Box6[[;;,n]]-OG$FCI$Box6[[;;,2]]),
(OG$c$Box7$0[[;;,n]]-OG$c$Box7$0[[;;,2]])-(OG$FCI$Box7[[;;,n]]-OG$FCI$Box7[[;;,2]])
}]
,5]
]

With[{n=4},
SetAccuracy[
TableForm[{
(OG$c$Box2$SA[[;;,n]]-OG$c$Box2$SA[[;;,2]])-(OG$FCI$Box2[[;;,n]]-OG$FCI$Box2[[;;,2]]),
(OG$c$Box3$SA[[;;,n]]-OG$c$Box3$SA[[;;,2]])-(OG$FCI$Box3[[;;,n]]-OG$FCI$Box3[[;;,2]]),
(OG$c$Box4$SA[[;;,n]]-OG$c$Box4$SA[[;;,2]])-(OG$FCI$Box4[[;;,n]]-OG$FCI$Box4[[;;,2]]),
(OG$c$Box5$SA[[;;,n]]-OG$c$Box5$SA[[;;,2]])-(OG$FCI$Box5[[;;,n]]-OG$FCI$Box5[[;;,2]]),
(OG$c$Box6$SA[[;;,n]]-OG$c$Box6$SA[[;;,2]])-(OG$FCI$Box6[[;;,n]]-OG$FCI$Box6[[;;,2]]),
(OG$c$Box7$SA[[;;,n]]-OG$c$Box7$SA[[;;,2]])-(OG$FCI$Box7[[;;,n]]-OG$FCI$Box7[[;;,2]])
}]
,5]
]

eHF energies

Optical gap

Energies

OG$HF$Box2$0={{(1/8),168.20835892087476`,330.3155736503709`,809.9920605258983`},{(1/4),44.07932311894002`,85.15679985352432`,204.9785327048018`},{(1/2),12.01536468337951`,22.577626156901403`,52.471979261458834`},{1,3.4845132278680246`,6.288399866399363`,13.719770476684596`},{2,1.0963465918081614`,1.8942048047582198`,3.7226629476060857`},{4,0.37520135130644733`,0.6344824646935079`,1.078196406464348`},{8,0.13772465244844154`,0.237805982051995`,0.3571416995252108`}};
OG$HF$Box2$SA={{(1/8),168.25118329874044`,330.3031134673694`,810.0343291449589`},{(1/4),44.12191400021546`,85.14428558596143`,205.02060711342435`},{(1/2),12.057468931311174`,22.565015870770456`,52.5134687382821`},{1,3.52557330296112`,6.275659669535706`,13.759383560330132`},{2,1.1351110731485297`,1.8815024539367065`,3.756445915936122`},{4,0.4091563180202976`,0.6228374540797992`,1.0973803226891725`},{8,0.1635648866225652`,0.22928801640296312`,0.35234372895190036`}};

OG$HF$Box3$0={{(1/8),475.72179964361726`,702.938069912916`,1379.3968378986542`},{(1/4),125.80925540123339`,183.44083112574663`,353.67959359534325`},{(1/2),34.85444069667358`,49.69349182593989`,92.82039543053725`},{1,10.37969323122143`,14.322035612351407`,25.390098366545484`},{2,3.3968708241717787`,4.514405997734929`,7.425001001219954`},{4,1.2251684579343414`,1.5812908064879758`,2.382868593260003`},{8,0.4776225251091063`,0.6046022801393256`,0.8506552994617644`}};
OG$HF$Box3$SA={{(1/8),475.7777244767496`,702.9209665996322`,1379.4336555761204`},{(1/4),125.86498841692342`,183.4235211924921`,353.7167146099079`},{(1/2),34.909763367400735`,49.67582144655257`,92.85799472489236`},{1,10.43409226680221`,14.303863423416026`,25.42817509180031`},{2,3.4490539588480336`,4.496118191738062`,7.4624534051830524`},{4,1.2718853450526812`,1.5657235677565917`,2.4156665051462847`},{8,0.5125400454727596`,0.597995333428798`,0.8737174314662433`}};

OG$HF$Box4$0={{(1/8),1020.4319579309478`,1312.4135780184045`,2183.579264062023`},{(1/4),270.13778741789775`,344.15302494689007`,563.7322148847431`},{(1/2),74.99305697215456`,94.02556969457913`,149.80873795993847`},{1,22.42489016416057`,27.466913174107734`,41.847309451942664`},{2,7.397645576412781`,8.820735929772905`,12.617855366826646`},{4,2.7064520915008297`,3.1640627135612798`,4.194292426733834`},{8,1.0772298924756816`,1.2567931531696024`,1.5352703958744849`}};
OG$HF$Box4$SA={{(1/8),1020.4945222384897`,1312.3886818068122`,2183.6087315523637`},{(1/4),270.20020286148997`,344.12772079958523`,563.7617521365944`},{(1/2),75.05515163685217`,93.99948188849534`,149.83830699476727`},{1,22.48625849149655`,27.439393684833178`,41.87655113417316`},{2,7.457267869198273`,8.790944876460523`,12.645188398277272`},{4,2.7616904269658633`,3.1322589983099913`,4.215142101232604`},{8,1.1225149575980602`,1.2281529818175925`,1.5453593641414127`}};

OG$HF$Box5$0={{(1/8),1867.7113727431683`,2224.279035670849`,3289.382211247591`},{(1/4),493.7515235865161`,584.0609741025531`,852.6025778283187`},{(1/2),136.7747779517922`,159.95599724157907`,228.21461861620256`},{1,40.792048064548474`,46.91085033130936`,64.52419927074058`},{2,13.434751726927974`,15.150405499455097`,19.810557992708855`},{4,4.924987020108651`,5.474307278157903`,6.74661940257398`},{8,1.974946636500993`,2.1974189724645568`,2.553539204245762`}};
OG$HF$Box5$SA={{(1/8),1867.7770364825744`,2224.2495434457023`,3289.4041065095416`},{(1/4),493.81710185239706`,584.0310546002733`,852.6244567609594`},{(1/2),136.84017569882928`,159.92524708715746`,228.23641686398284`},{1,40.85705283457338`,46.878534729874794`,64.54567696518201`},{2,13.498872290973328`,15.115360837888545`,19.830925884657134`},{4,4.987000832019694`,5.435677051043904`,6.763478231106834`},{8,2.031495693462638`,2.1591116539288864`,2.561715592209789`}};

OG$HF$Box6$0={{(1/8),3082.6389923814977`,3503.6818870292236`,4762.306555780776`},{(1/4),813.1899486155382`,919.7380566149908`,1237.0377013256025`},{(1/2),224.4693468717685`,251.77117084313488`,332.40663736652897`},{1,66.61601713613959`,73.79688222957564`,94.59732636980274`},{2,21.825556065745687`,23.825095164799414`,29.328460466440653`},{4,7.9769523490613246`,8.611347307049256`,10.117700113940828`},{8,3.203637272356378`,3.4638832888711955`,3.890496010295839`}};
OG$HF$Box6$SA={{(1/8),3082.706150738251`,3503.6490813262067`,4762.321586400074`},{(1/4),813.2570924965706`,919.7047865086975`,1237.0526799949048`},{(1/2),224.5364612299078`,251.73698066223403`,332.4214919641579`},{1,66.68307282421358`,73.7608856321135`,94.6118657094512`},{2,21.892500499970943`,23.78563801222338`,29.342129585416224`},{4,8.043587296814536`,8.56601315363777`,10.128391233740384`},{8,3.2682055551763`,3.414016520999793`,3.890793499940278`}};

OG$HF$Box7$0={{(1/8),4730.104216957665`,5215.546903201752`,6667.428844281492`},{(1/4),1244.8977063861755`,1367.6465389665145`,1733.5738586738485`},{(1/2),342.29903581927135`,373.70217956631535`,466.6508977317889`},{1,101.00788580438768`,109.24064445675741`,133.1977190103463`},{2,32.87553761151073`,35.15293003740943`,41.48527508275092`},{4,11.952504506021029`,12.667227813113612`,14.401135857992491`},{8,4.792875937275493`,5.086618005171511`,5.579603998384909`}};
OG$HF$Box7$SA={{(1/8),4730.171986208383`,5215.511677508975`,6667.438359494172`},{(1/4),1244.9655199075928`,1367.6108215787385`,1733.5833149573432`},{(1/2),342.36694176181544`,373.66547769129204`,466.6602253065039`},{1,101.07599270803745`,109.20196786727932`,133.20674806526188`},{2,32.944105009546156`,35.11029567963186`,41.493510756660214`},{4,12.02207280907663`,12.617091727390978`,14.406452905890017`},{8,4.863193864888185`,5.027784294589292`,5.572969125814699`}};

Differences

Individual energies for w=(0,0)

With[{n=2},
SetAccuracy[
TableForm[{
(OG$HF$Box2$0[[;;,n]])-(OG$FCI$Box2[[;;,n]]),
(OG$HF$Box3$0[[;;,n]])-(OG$FCI$Box3[[;;,n]]),
(OG$HF$Box4$0[[;;,n]])-(OG$FCI$Box4[[;;,n]]),
(OG$HF$Box5$0[[;;,n]])-(OG$FCI$Box5[[;;,n]]),
(OG$HF$Box6$0[[;;,n]])-(OG$FCI$Box6[[;;,n]]),
(OG$HF$Box7$0[[;;,n]])-(OG$FCI$Box7[[;;,n]])
}]
,5]
]

With[{n=3},
SetAccuracy[
TableForm[{
(OG$HF$Box2$0[[;;,n]])-(OG$FCI$Box2[[;;,n]]),
(OG$HF$Box3$0[[;;,n]])-(OG$FCI$Box3[[;;,n]]),
(OG$HF$Box4$0[[;;,n]])-(OG$FCI$Box4[[;;,n]]),
(OG$HF$Box5$0[[;;,n]])-(OG$FCI$Box5[[;;,n]]),
(OG$HF$Box6$0[[;;,n]])-(OG$FCI$Box6[[;;,n]]),
(OG$HF$Box7$0[[;;,n]])-(OG$FCI$Box7[[;;,n]])
}]
,5]
]

With[{n=4},
SetAccuracy[
TableForm[{
(OG$HF$Box2$0[[;;,n]])-(OG$FCI$Box2[[;;,n]]),
(OG$HF$Box3$0[[;;,n]])-(OG$FCI$Box3[[;;,n]]),
(OG$HF$Box4$0[[;;,n]])-(OG$FCI$Box4[[;;,n]]),
(OG$HF$Box5$0[[;;,n]])-(OG$FCI$Box5[[;;,n]]),
(OG$HF$Box6$0[[;;,n]])-(OG$FCI$Box6[[;;,n]]),
(OG$HF$Box7$0[[;;,n]])-(OG$FCI$Box7[[;;,n]])
}]
,5]
]

Individual energies for w=(1/3,1/3)

With[{n=2},
SetAccuracy[
TableForm[{
(OG$HF$Box2$SA[[;;,n]])-(OG$FCI$Box2[[;;,n]]),
(OG$HF$Box3$SA[[;;,n]])-(OG$FCI$Box3[[;;,n]]),
(OG$HF$Box4$SA[[;;,n]])-(OG$FCI$Box4[[;;,n]]),
(OG$HF$Box5$SA[[;;,n]])-(OG$FCI$Box5[[;;,n]]),
(OG$HF$Box6$SA[[;;,n]])-(OG$FCI$Box6[[;;,n]]),
(OG$HF$Box7$SA[[;;,n]])-(OG$FCI$Box7[[;;,n]])
}]
,5]
]

With[{n=3},
SetAccuracy[
TableForm[{
(OG$HF$Box2$SA[[;;,n]])-(OG$FCI$Box2[[;;,n]]),
(OG$HF$Box3$SA[[;;,n]])-(OG$FCI$Box3[[;;,n]]),
(OG$HF$Box4$SA[[;;,n]])-(OG$FCI$Box4[[;;,n]]),
(OG$HF$Box5$SA[[;;,n]])-(OG$FCI$Box5[[;;,n]]),
(OG$HF$Box6$SA[[;;,n]])-(OG$FCI$Box6[[;;,n]]),
(OG$HF$Box7$SA[[;;,n]])-(OG$FCI$Box7[[;;,n]])
}]
,5]
]

With[{n=4},
SetAccuracy[
TableForm[{
(OG$HF$Box2$SA[[;;,n]])-(OG$FCI$Box2[[;;,n]]),
(OG$HF$Box3$SA[[;;,n]])-(OG$FCI$Box3[[;;,n]]),
(OG$HF$Box4$SA[[;;,n]])-(OG$FCI$Box4[[;;,n]]),
(OG$HF$Box5$SA[[;;,n]])-(OG$FCI$Box5[[;;,n]]),
(OG$HF$Box6$SA[[;;,n]])-(OG$FCI$Box6[[;;,n]]),
(OG$HF$Box7$SA[[;;,n]])-(OG$FCI$Box7[[;;,n]])
}]
,5]
]

Single excitation

With[{n=3},
SetAccuracy[
TableForm[{
(OG$HF$Box2$0[[;;,n]]-OG$c$Box2$0[[;;,2]])-(OG$FCI$Box2[[;;,n]]-OG$FCI$Box2[[;;,2]]),
(OG$HF$Box3$0[[;;,n]]-OG$c$Box3$0[[;;,2]])-(OG$FCI$Box3[[;;,n]]-OG$FCI$Box3[[;;,2]]),
(OG$HF$Box4$0[[;;,n]]-OG$c$Box4$0[[;;,2]])-(OG$FCI$Box4[[;;,n]]-OG$FCI$Box4[[;;,2]]),
(OG$HF$Box5$0[[;;,n]]-OG$c$Box5$0[[;;,2]])-(OG$FCI$Box5[[;;,n]]-OG$FCI$Box5[[;;,2]]),
(OG$HF$Box6$0[[;;,n]]-OG$c$Box6$0[[;;,2]])-(OG$FCI$Box6[[;;,n]]-OG$FCI$Box6[[;;,2]]),
(OG$HF$Box7$0[[;;,n]]-OG$c$Box7$0[[;;,2]])-(OG$FCI$Box7[[;;,n]]-OG$FCI$Box7[[;;,2]])
}]
,5]
]

With[{n=3},
SetAccuracy[
TableForm[{
(OG$HF$Box2$SA[[;;,n]]-OG$c$Box2$SA[[;;,2]])-(OG$FCI$Box2[[;;,n]]-OG$FCI$Box2[[;;,2]]),
(OG$HF$Box3$SA[[;;,n]]-OG$c$Box3$SA[[;;,2]])-(OG$FCI$Box3[[;;,n]]-OG$FCI$Box3[[;;,2]]),
(OG$HF$Box4$SA[[;;,n]]-OG$c$Box4$SA[[;;,2]])-(OG$FCI$Box4[[;;,n]]-OG$FCI$Box4[[;;,2]]),
(OG$HF$Box5$SA[[;;,n]]-OG$c$Box5$SA[[;;,2]])-(OG$FCI$Box5[[;;,n]]-OG$FCI$Box5[[;;,2]]),
(OG$HF$Box6$SA[[;;,n]]-OG$c$Box6$SA[[;;,2]])-(OG$FCI$Box6[[;;,n]]-OG$FCI$Box6[[;;,2]]),
(OG$HF$Box7$SA[[;;,n]]-OG$c$Box7$SA[[;;,2]])-(OG$FCI$Box7[[;;,n]]-OG$FCI$Box7[[;;,2]])
}]
,5]
]

Double excitation

With[{n=4},
SetAccuracy[
TableForm[{
(OG$HF$Box2$0[[;;,n]]-OG$c$Box2$0[[;;,2]])-(OG$FCI$Box2[[;;,n]]-OG$FCI$Box2[[;;,2]]),
(OG$HF$Box3$0[[;;,n]]-OG$c$Box3$0[[;;,2]])-(OG$FCI$Box3[[;;,n]]-OG$FCI$Box3[[;;,2]]),
(OG$HF$Box4$0[[;;,n]]-OG$c$Box4$0[[;;,2]])-(OG$FCI$Box4[[;;,n]]-OG$FCI$Box4[[;;,2]]),
(OG$HF$Box5$0[[;;,n]]-OG$c$Box5$0[[;;,2]])-(OG$FCI$Box5[[;;,n]]-OG$FCI$Box5[[;;,2]]),
(OG$HF$Box6$0[[;;,n]]-OG$c$Box6$0[[;;,2]])-(OG$FCI$Box6[[;;,n]]-OG$FCI$Box6[[;;,2]]),
(OG$HF$Box7$0[[;;,n]]-OG$c$Box7$0[[;;,2]])-(OG$FCI$Box7[[;;,n]]-OG$FCI$Box7[[;;,2]])
}]
,5]
]

With[{n=4},
SetAccuracy[
TableForm[{
(OG$HF$Box2$SA[[;;,n]]-OG$c$Box2$SA[[;;,2]])-(OG$FCI$Box2[[;;,n]]-OG$FCI$Box2[[;;,2]]),
(OG$HF$Box3$SA[[;;,n]]-OG$c$Box3$SA[[;;,2]])-(OG$FCI$Box3[[;;,n]]-OG$FCI$Box3[[;;,2]]),
(OG$HF$Box4$SA[[;;,n]]-OG$c$Box4$SA[[;;,2]])-(OG$FCI$Box4[[;;,n]]-OG$FCI$Box4[[;;,2]]),
(OG$HF$Box5$SA[[;;,n]]-OG$c$Box5$SA[[;;,2]])-(OG$FCI$Box5[[;;,n]]-OG$FCI$Box5[[;;,2]]),
(OG$HF$Box6$SA[[;;,n]]-OG$c$Box6$SA[[;;,2]])-(OG$FCI$Box6[[;;,n]]-OG$FCI$Box6[[;;,2]]),
(OG$HF$Box7$SA[[;;,n]]-OG$c$Box7$SA[[;;,2]])-(OG$FCI$Box7[[;;,n]]-OG$FCI$Box7[[;;,2]])
}]
,5]
]

TDHF energies

Optical gap

CIS

OG$CIS$Box2={
{π/8,162.06282561786588`},{π/4,41.03299724909266`},{π/2,10.517641451646547`},{π,2.75915111313139`},{2π,0.7535249930517856`},{4π,0.2176594789062612`},{8π,0.06610498960447389`}
};

OG$CIS$Box3={
{π/8,227.16016685613775`},{π/4,57.575517287416424`},{π/2,14.783123913271545`},{π,3.886851252207269`},{2π,1.0636385697072777`},{4π,0.30807122275219967`},{8π,0.09419730351896177`}
};

OG$CIS$Box4={
{π/8,291.92011761833487`},{π/4,73.95369837211398`},{π/2,18.970907302939207`},{π,4.980319315065484`},{2π,1.3613615565357786`},{4π,0.3968379628505422`},{8π,0.12471684769673018`}
};

OG$CIS$Box5={
{π/8,356.50346140784626`},{π/4,90.24513334173645`},{π/2,23.116663868638508`},{π,6.053746366410367`},{2π,1.6495488370532914`},{4π,0.48132334670040133`},{8π,0.15448118528895255`}
};

OG$CIS$Box6={
{π/8,420.97740018913305`},{π/4,106.48244330253499`},{π/2,27.23580635080338`},{π,7.114094400779523`},{2π,1.931103507593536`},{4π,0.5622821926563506`},{8π,0.18313959662755622`}
};

OG$CIS$Box7={
{π/8,485.376701636898`},{π/4,122.68264291356593`},{π/2,31.33652947977803`},{π,8.16523834282734`},{2π,2.2078456597296565`},{4π,0.6404089181157815`},{8π,0.21052017337913162`}
};

SetAccuracy[
TableForm[{
OG$CIS$Box2[[;;,2]]-(OG$FCI$Box2[[;;,3]]-OG$FCI$Box2[[;;,2]]),
OG$CIS$Box3[[;;,2]]-(OG$FCI$Box3[[;;,3]]-OG$FCI$Box3[[;;,2]]),
OG$CIS$Box4[[;;,2]]-(OG$FCI$Box4[[;;,3]]-OG$FCI$Box4[[;;,2]]),
OG$CIS$Box5[[;;,2]]-(OG$FCI$Box5[[;;,3]]-OG$FCI$Box5[[;;,2]]),
OG$CIS$Box6[[;;,2]]-(OG$FCI$Box6[[;;,3]]-OG$FCI$Box6[[;;,2]]),
OG$CIS$Box7[[;;,2]]-(OG$FCI$Box7[[;;,3]]-OG$FCI$Box7[[;;,2]])
}]
,5]

TDHF

OG$TDHF$Box2={
{π/8,162.05436510852562`},{π/4,41.02486467050261`},{π/2,10.51012028911645`},{π,2.75269494213817`},{2π,0.7487026296830287`},{4π,0.21484709776405136`},{8π,0.06499739147812032`}
};

OG$TDHF$Box3={
{π/8,227.145150888906`},{π/4,57.56074147224095`},{π/2,14.768798511806168`},{π,3.8733443838374075`},{2π,1.0516285294607612`},{4π,0.2988990125322254`},{8π,0.08918421565592909`}
};

OG$TDHF$Box4={
{π/8,291.9006509116269`},{π/4,73.93436335370787`},{π/2,18.951810116671577`},{π,4.961631355097526`},{2π,1.3434337785166732`},{4π,0.3809155107617724`},{8π,0.11381405989647261`}
};

OG$TDHF$Box5={
{π/8,356.48094271616105`},{π/4,90.222654642361`},{π/2,23.094238429943164`},{π,6.0313508458209935`},{2π,1.6271066714818754`},{4π,0.4593723104835174`},{8π,0.13682345677236288`}
};

OG$TDHF$Box6={
{π/8,420.9527463622777`},{π/4,106.45775817582121`},{π/2,27.21102989270865`},{π,7.089044911453627`},{2π,1.905323079673646`},{4π,0.535418399770808`},{8π,0.15876987509931767`}
};

OG$TDHF$Box7={
{π/8,485.35052994901764`},{π/4,122.65638589151276`},{π/2,31.31007152834391`},{π,8.138276961612766`},{2π,2.1796194448117134`},{4π,0.6097088746056607`},{8π,0.17994505044686687`}
};

SetAccuracy[
TableForm[{
OG$TDHF$Box2[[;;,2]]-(OG$FCI$Box2[[;;,3]]-OG$FCI$Box2[[;;,2]]),
OG$TDHF$Box3[[;;,2]]-(OG$FCI$Box3[[;;,3]]-OG$FCI$Box3[[;;,2]]),
OG$TDHF$Box4[[;;,2]]-(OG$FCI$Box4[[;;,3]]-OG$FCI$Box4[[;;,2]]),
OG$TDHF$Box5[[;;,2]]-(OG$FCI$Box5[[;;,3]]-OG$FCI$Box5[[;;,2]]),
OG$TDHF$Box6[[;;,2]]-(OG$FCI$Box6[[;;,3]]-OG$FCI$Box6[[;;,2]]),
OG$TDHF$Box7[[;;,2]]-(OG$FCI$Box7[[;;,3]]-OG$FCI$Box7[[;;,2]])
}]
,5]

TD-LDA energies

Optical gap

TDA-TDLDA

OG$TDA$Box2={
{π/8,162.06237718837923`},{π/4,41.03156602374918`},{π/2,10.513537967390183`},{π,2.7459174533091546`},{2π,0.7142202688393201`},{4π,0.1658088066598123`},{8π,}
};

OG$TDA$Box3={
{π/8,227.16006859103686`},{π/4,57.57515443271306`},{π/2,14.781995098395203`},{π,3.8829904727012194`},{2π,1.0454834128256123`},{4π,0.2634628773431787`},{8π,0.050618829707642435`}
};

OG$TDA$Box4={
{π/8,291.92009285045333`},{π/4,73.95358152780112`},{π/2,18.970499532094465`},{π,4.978905497541821`},{2π,1.3532351212174725`},{4π,0.36234991370821873`},{8π,0.07626238334937914`}
};

OG$TDA$Box5={
{π/8,356.50345796778805`},{π/4,90.24509095082533`},{π/2,23.116495979295614`},{π,6.0531474158560306`},{2π,1.6457449228574095`},{4π,0.45738458956412975`},{8π,0.10532611726977684`}
};

OG$TDA$Box6={
{π/8,420.97740311857206`},{π/4,106.48242947669729`},{π/2,27.235733531243994`},{π,7.113816130652787`},{2π,1.9292279894212454`},{4π,0.5465247486275698`},{8π,0.13604477748893223`}
};

OG$TDA$Box7={
{π/8,485.37670674384003`},{π/4,122.68264111025061`},{π/2,31.336498400179252`},{π,8.165100631735134`},{2π,2.2068599111970633`},{4π,0.6301440466553566`},{8π,0.16808876521823846`}
};

SetAccuracy[
TableForm[{
OG$TDA$Box2[[;;,2]]-(OG$FCI$Box2[[;;,3]]-OG$FCI$Box2[[;;,2]]),
OG$TDA$Box3[[;;,2]]-(OG$FCI$Box3[[;;,3]]-OG$FCI$Box3[[;;,2]]),
OG$TDA$Box4[[;;,2]]-(OG$FCI$Box4[[;;,3]]-OG$FCI$Box4[[;;,2]]),
OG$TDA$Box5[[;;,2]]-(OG$FCI$Box5[[;;,3]]-OG$FCI$Box5[[;;,2]]),
OG$TDA$Box6[[;;,2]]-(OG$FCI$Box6[[;;,3]]-OG$FCI$Box6[[;;,2]]),
OG$TDA$Box7[[;;,2]]-(OG$FCI$Box7[[;;,3]]-OG$FCI$Box7[[;;,2]])
}]
,5]

TDLDA

OG$TDLDA$Box2={
{π/8,162.0540},{π/4,41.0234},{π/2,10.5060},{π,2.7394},{2π,0.7088},{4π,0.1607},{8π,}
};

OG$TDLDA$Box3={
{π/8,227.1450},{π/4,57.5604},{π/2,14.7677},{π,3.8695},{2π,1.0332},{4π,0.2515},{8π,0.0306}
};

OG$TDLDA$Box4={
{π/8,291.9010},{π/4,73.9342},{π/2,18.9514},{π,4.9602158283294635`},{2π,1.3352},{4π,0.3442},{8π,0.0478}
};

OG$TDLDA$Box5={
{π/8,356.4810},{π/4,90.2226},{π/2,23.0941},{π,6.0308},{2π,1.6233},{4π,0.4340},{8π,0.0712}
};

OG$TDLDA$Box6={
{π/8,420.9530},{π/4,106.4580},{π/2,27.2110},{π,7.0888},{2π,1.9034},{4π,0.5188},{8π,0.0972}
};

OG$TDLDA$Box7={
{π/8,485.3510},{π/4,122.6560},{π/2,31.3100},{π,8.1381},{2π,2.1786},{4π,0.5989},{8π,0.1257}
};

SetAccuracy[
TableForm[{
OG$TDLDA$Box2[[;;,2]]-(OG$FCI$Box2[[;;,3]]-OG$FCI$Box2[[;;,2]]),
OG$TDLDA$Box3[[;;,2]]-(OG$FCI$Box3[[;;,3]]-OG$FCI$Box3[[;;,2]]),
OG$TDLDA$Box4[[;;,2]]-(OG$FCI$Box4[[;;,3]]-OG$FCI$Box4[[;;,2]]),
OG$TDLDA$Box5[[;;,2]]-(OG$FCI$Box5[[;;,3]]-OG$FCI$Box5[[;;,2]]),
OG$TDLDA$Box6[[;;,2]]-(OG$FCI$Box6[[;;,3]]-OG$FCI$Box6[[;;,2]]),
OG$TDLDA$Box7[[;;,2]]-(OG$FCI$Box7[[;;,3]]-OG$FCI$Box7[[;;,2]])
}]
,5]

Generalities

Jacobian on a d-sphere

For two particles on a d-sphere, we need to convert the Jacobian in the principal angle θ to a Jacobian in u

u=2R Sin[(θ/2)]	⟺	θ=2ArcSin[(u/(2R))]

((((Sin[θ])^(d-1))\[DifferentialD]θ)/((∫_0^π)((Sin[θ])^(d-1))\[DifferentialD]θ))=((Γ[((d+1)/2)])/((Sqrt[π]) Γ[(d/2)]))((Sin[θ])^(d-1))((\[DifferentialD]θ)/(\[DifferentialD]u))\[DifferentialD]u

=((Γ[((d+1)/2)])/((Sqrt[π]) Γ[(d/2)]))((Sin[2ArcSin[(u/(2R))]])^(d-1))(\[DifferentialD]/(\[DifferentialD]u))(2ArcSin[(u/(2R))])\[DifferentialD]u

=((Γ[((d+1)/2)])/((Sqrt[π]) Γ[(d/2)]R))((((u/R)))^(d-1))(((1-((((u/(2R))))^2)))^((d-2)/2))\[DifferentialD]u

Exact energies of two electrons on a d-sphere

Singlet state

We consider a pair of opposite-spin electrons on a d-sphere of radius R.

The Hamiltonian is

(((u^2)/(4(R^2)))-1)((\[DifferentialD]^2)/(\[DifferentialD](u^2)))+(((2d-1)/(4(R^2)))-((d-1)/u))(\[DifferentialD]/(\[DifferentialD]u))+(1/u)

where u is the interelectronic distance between the electrons. 
Let us introduce the general (yet non-orthogonal) basis set

(Subscript[ψ, n_])[u_]=(u^(n-1));

Now, we diagonalize the Hamiltonian H for a given metric S. 
M is the size of the basis set, d is the dimensionality of the surface of the sphere and R is the radius.
We print the convergence of each roots of the Hamiltonian as a function of the number of basis functions.

With[{M=10,d=2,R=1},
H=Table[(∫_0^(2R))(Subscript[ψ, i])[u]((((u^2)/(4(R^2)))-1)(Subscript[ψ, j]^″)[u]+((((2d-1)u)/(4(R^2)))-((d-1)/u))  (Subscript[ψ, j]^′)[u]+(((Subscript[ψ, j])[u])/u))(u^(d-1))(((1-((((u/(2R))))^2)))^((d-2)/2))\[DifferentialD]u,{i,M},{j,M}];
S=Table[(∫_0^(2R))(Subscript[ψ, i])[u](Subscript[ψ, j])[u](u^(d-1))(((1-((((u/(2R))))^2)))^((d-2)/2))\[DifferentialD]u,{i,M},{j,M}];
Table[Sort[Eigenvalues[{N[Take[H,m,m],15],N[Take[S,m,m],30]}]],{m,M}]//TableForm
]

(Subscript[ϕ, ℓ_])[θ_]=((Sqrt[2ℓ+1])/(4π))(Subscript[P, ℓ])[Cos[θ]];

Table[8 (π^2)(∫_0^π)(Subscript[ϕ, a])[θ](Subscript[ϕ, b])[θ]Sin[θ]\[DifferentialD]θ,{a,0,4},{b,a,4}]

ϕ=(1-w)(Subscript[ϕ, 0])+w (Subscript[ϕ, 1])

eDFT

Two electrons on a ring

Two-state ensemble

With only 2 basis functions....

With[{M=10},
H=Table[(∫_0^π)((((∂_θ)(Subscript[ψ, i])[θ])/R)(((∂_θ)(Subscript[ψ, j])[θ])/R)+(((Subscript[ψ, i])[θ](Subscript[ψ, j])[θ])/(2 R Sin[θ/2])))\[DifferentialD]θ,{i,M},{j,M}];
S=Table[(∫_0^π)(Subscript[ψ, i])[θ](Subscript[ψ, j])[θ]\[DifferentialD]θ,{i,M},{j,M}];
v=Table[(Subscript[ψ, i])[θ],{i,M}];
{e,c}=FullSimplify[Eigensystem[{H,S}],R>0]
]
%/.R->1.

Let’s consider the following two-state ensemble

(Subscript[Φ, 0])=Simplify[(((c.v)[[1]])/(Sqrt[(c.S.c\[Transpose])[[1,1]]])),0<w<1/2&&R>0];	(Subscript[Φ, 1])=Simplify[(((c.v)[[2]])/(Sqrt[(c.S.c\[Transpose])[[2,2]]])),0<w<1/2&&R>0];	(Subscript[Φ, w_])=Simplify[(Sqrt[1-w])(Subscript[Φ, 0])+(Sqrt[w]) (Subscript[Φ, 1]),0<w<1/2&&R>0];	(* w ≤ 1/2 *)

Note that the density of the ensemble state is uniform and equal to the density of the two uniform states “0” and “1”

The ensemble energy (Subscript[E, w]) is

(Subscript[Ε, 0])[R_]=e[[1]];	(Subscript[Ε, 1])[R_]=e[[2]];	(Subscript[Εe, w_])[R_]=Simplify[Assuming[0<w<1/2&&R>0,(∫_0^π)(((((((∂_θ)(Subscript[Φ, w]))/R)))^2)+((Subscript[Φ, w]^2)/(2R Sin[θ/2])))\[DifferentialD]θ],0<w<1/2&&R>0];

With[{R=1},Plot[{(Subscript[Ε, 0])[R],(Subscript[Ε, 1])[R],(Subscript[Εe, w])[R]},{w,0,(1/2)},PlotLegends->{"(Subscript[E, 0])","(Subscript[E, 1])","(Subscript[E, w])"}]]

As expected, this is perfectly linear.

Can I calculate the excitation energy accurately?

With[{R=1.},{(Subscript[Ε, 1])[R]-(Subscript[Ε, 0])[R],2((Subscript[Εe, 1/2])[R]-(Subscript[Εe, 0])[R])}]

Simplify[(Subscript[Ε, 1])[R]-(Subscript[Ε, 0])[R]==2((Subscript[Εe, 1/2])[R]-(Subscript[Εe, 0])[R])]

Three-state ensemble (for R=1)

With only 3 basis functions....

With[{M=3,R=1},
H=Table[(∫_0^π)((((∂_θ)(Subscript[ψ, i])[θ])/R)(((∂_θ)(Subscript[ψ, j])[θ])/R)+(((Subscript[ψ, i])[θ](Subscript[ψ, j])[θ])/(2 R Sin[θ/2])))\[DifferentialD]θ,{i,M},{j,M}];
S=Table[(∫_0^π)(Subscript[ψ, i])[θ](Subscript[ψ, j])[θ]\[DifferentialD]θ,{i,M},{j,M}];
v=Table[(Subscript[ψ, i])[θ],{i,M}];
{e,c}=Simplify[Eigensystem[{N[H,15],N[S,15]}],R>0]
]

Let’s consider the following three-state ensemble

(Subscript[Φ, 0])=(((c.v)[[1]])/(Sqrt[(c.S.c\[Transpose])[[1,1]]]));	(Subscript[Φ, 1])=(((c.v)[[2]])/(Sqrt[(c.S.c\[Transpose])[[2,2]]]));	(Subscript[Φ, 2])=(((c.v)[[3]])/(Sqrt[(c.S.c\[Transpose])[[3,3]]]));
(Subscript[Φ, w_])=(Sqrt[((1-w)/2)])(Subscript[Φ, 0])+(Sqrt[((1-w)/2)])(Subscript[Φ, 1])+(Sqrt[w]) (Subscript[Φ, 2]);	((1-w)/2)+((1-w)/2)+w==1	(* GOK weights *)

The ensemble energy (Subscript[E, w]) is

(Subscript[Ε, 0])[R_]=e[[1]];	(Subscript[Ε, 1])[R_]=e[[2]];	(Subscript[Ε, 2])[R_]=e[[3]];	(Subscript[Εe, w_])[R_]=With[{R=1},(((∫_0^π)(((((((∂_θ)(Subscript[Φ, w]))/R)))^2)+((Subscript[Φ, w]^2)/(2R Sin[θ/2])))\[DifferentialD]θ)/((∫_0^π)(Subscript[Φ, w]^2)\[DifferentialD]θ))];

With[{R=1},Plot[{(Subscript[Ε, 0])[R],(Subscript[Ε, 1])[R],(Subscript[Ε, 2])[R],(Subscript[Εe, w])[R]},{w,0,(1/3)},PlotLegends->{"(Subscript[E, 0])","(Subscript[E, 1])","(Subscript[E, 2])","(Subscript[E, w])"}]]

HF wave functions

The ground state HF wave function is

(1/(Sqrt[2]))Det[(({{Exp[-(I/2)(Subscript[θ, 1])], Exp[+(I/2)(Subscript[θ, 1])]}, {Exp[-(I/2)(Subscript[θ, 2])], Exp[+(I/2)(Subscript[θ, 2])]}}))]==-I (Sqrt[2]) Sin[(1/2) ((Subscript[θ, 1])-(Subscript[θ, 2]))]//FullSimplify

The first excited state HF wave function is

(1/(Sqrt[2]))Det[(({{Exp[-((3I)/2)(Subscript[θ, 1])], Exp[+((3I)/2)(Subscript[θ, 1])]}, {Exp[-((3I)/2)(Subscript[θ, 2])], Exp[+((3I)/2)(Subscript[θ, 2])]}}))]==-I (Sqrt[2]) Sin[(3/2) ((Subscript[θ, 1])-(Subscript[θ, 2]))]//FullSimplify

The second excited state HF wave function is

(1/(Sqrt[2]))Det[(({{Exp[-((5I)/2)(Subscript[θ, 1])], Exp[+((5I)/2)(Subscript[θ, 1])]}, {Exp[-((5I)/2)(Subscript[θ, 2])], Exp[+((5I)/2)(Subscript[θ, 2])]}}))]==-I (Sqrt[2]) Sin[(5/2) ((Subscript[θ, 1])-(Subscript[θ, 2]))]//FullSimplify

Single excitations

(1/(Sqrt[2]))Det[(({{Exp[-((3I)/2)(Subscript[θ, 1])], Exp[+(I/2)(Subscript[θ, 1])]}, {Exp[-((3I)/2)(Subscript[θ, 2])], Exp[+(I/2)(Subscript[θ, 2])]}}))]+(1/(Sqrt[2]))Det[(({{Exp[+((3I)/2)(Subscript[θ, 1])], Exp[-(I/2)(Subscript[θ, 1])]}, {Exp[+((3I)/2)(Subscript[θ, 2])], Exp[-(I/2)(Subscript[θ, 2])]}}))]//FullSimplify
(1/(Sqrt[2]))Det[(({{Exp[-((3I)/2)(Subscript[θ, 1])], Exp[+(I/2)(Subscript[θ, 1])]}, {Exp[-((3I)/2)(Subscript[θ, 2])], Exp[+(I/2)(Subscript[θ, 2])]}}))]-(1/(Sqrt[2]))Det[(({{Exp[+((3I)/2)(Subscript[θ, 1])], Exp[-(I/2)(Subscript[θ, 1])]}, {Exp[+((3I)/2)(Subscript[θ, 2])], Exp[-(I/2)(Subscript[θ, 2])]}}))]//FullSimplify

HF energies

The ground state HF energy is

(Subscript[Ψ, 0])=(Sqrt[(2/π)])Sin[(θ/2)];	{(∫_0^π)(Subscript[Ψ, 0]^2)\[DifferentialD]θ==1,(∫_0^π)(-(1/(R^2))(Subscript[Ψ, 0])(∂_(θ,θ))(Subscript[Ψ, 0])+((Subscript[Ψ, 0]^2)/(2R Sin[(θ/2)])))\[DifferentialD]θ==(1/(4 (R^2)))+(2/(π R))//Simplify}

The HF energy of the first excited state is

(Subscript[Ψ, 1])=(Sqrt[(2/π)])Sin[((3θ)/2)];	{(∫_0^π)(Subscript[Ψ, 1]^2)\[DifferentialD]θ==1,(∫_0^π)(-(1/(R^2))(Subscript[Ψ, 1])(∂_(θ,θ))(Subscript[Ψ, 1])+((Subscript[Ψ, 1]^2)/(2R Sin[(θ/2)])))\[DifferentialD]θ==(9/(4 (R^2)))+(46/(15 π R))//Simplify}

The HF energy of the second excited state is

(Subscript[Ψ, 2])=(Sqrt[(2/π)])Sin[((5θ)/2)];	{(∫_0^π)(Subscript[Ψ, 2]^2)\[DifferentialD]θ==1,(∫_0^π)(-(1/(R^2))(Subscript[Ψ, 2])(∂_(θ,θ))(Subscript[Ψ, 2])+((Subscript[Ψ, 2]^2)/(2R Sin[(θ/2)])))\[DifferentialD]θ==(25/(4 (R^2)))+(1126/(315 π R))//Simplify}

The HF energy of the n-th excited state is

(Subscript[Ψ, n_])=(Sqrt[(2/π)])Sin[(n+(1/2))θ];	{Simplify[(∫_0^π)(Subscript[Ψ, n]^2)\[DifferentialD]θ==1,n∈Integers],Table[(∫_0^π)(((((((∂_θ)(Subscript[Ψ, n]))/R)))^2)+((Subscript[Ψ, n]^2)/(2R Sin[θ/2])))\[DifferentialD]θ==((((n+(1/2)))^2)/(R^2))+((PolyGamma[2 n+(3/2)]-PolyGamma[(1/2)])/(π R)),{n,0,5}]//FullSimplify}

Single excitations

Ψ0=(I/(4 π))(Det[(({{Exp[-((3I)/2)(Subscript[θ, 1])], Exp[+(I/2)(Subscript[θ, 1])]}, {Exp[-((3I)/2)(Subscript[θ, 2])], Exp[+(I/2)(Subscript[θ, 2])]}}))]+Det[(({{Exp[+((3I)/2)(Subscript[θ, 1])], Exp[-(I/2)(Subscript[θ, 1])]}, {Exp[+((3I)/2)(Subscript[θ, 2])], Exp[-(I/2)(Subscript[θ, 2])]}}))])//FullSimplify;
Ψ1=(I/(4 π))(Det[(({{Exp[-((5I)/2)(Subscript[θ, 1])], Exp[+((3I)/2)(Subscript[θ, 1])]}, {Exp[-((5I)/2)(Subscript[θ, 2])], Exp[+(I/2)(Subscript[θ, 2])]}}))]+Det[(({{Exp[+((5I)/2)(Subscript[θ, 1])], Exp[-((3I)/2)(Subscript[θ, 1])]}, {Exp[+((5I)/2)(Subscript[θ, 2])], Exp[-(I/2)(Subscript[θ, 2])]}}))])//FullSimplify;
Ψ2=(I/(4 π))(Det[(({{Exp[-((7I)/2)(Subscript[θ, 1])], Exp[+((5I)/2)(Subscript[θ, 1])]}, {Exp[-((7I)/2)(Subscript[θ, 2])], Exp[+((5I)/2)(Subscript[θ, 2])]}}))]+Det[(({{Exp[+((7I)/2)(Subscript[θ, 1])], Exp[-((5I)/2)(Subscript[θ, 1])]}, {Exp[+((7I)/2)(Subscript[θ, 2])], Exp[-((5I)/2)(Subscript[θ, 2])]}}))])//FullSimplify;
Ψ3=(I/(4 π))(Det[(({{Exp[-((9I)/2)(Subscript[θ, 1])], Exp[+((7I)/2)(Subscript[θ, 1])]}, {Exp[-((9I)/2)(Subscript[θ, 2])], Exp[+((7I)/2)(Subscript[θ, 2])]}}))]+Det[(({{Exp[+((9I)/2)(Subscript[θ, 1])], Exp[-(I/2)(Subscript[θ, 1])]}, {Exp[+((9I)/2)(Subscript[θ, 2])], Exp[-(I/2)(Subscript[θ, 2])]}}))])//FullSimplify;
Ψ4=(I/(4 π))(Det[(({{Exp[-((11I)/2)(Subscript[θ, 1])], Exp[+(I/2)(Subscript[θ, 1])]}, {Exp[-((11I)/2)(Subscript[θ, 2])], Exp[+(I/2)(Subscript[θ, 2])]}}))]+Det[(({{Exp[+((11I)/2)(Subscript[θ, 1])], Exp[-(I/2)(Subscript[θ, 1])]}, {Exp[+((11I)/2)(Subscript[θ, 2])], Exp[-(I/2)(Subscript[θ, 2])]}}))])//FullSimplify;

Ψ0==((-I)/( π)) Sin[(1/2) ((Subscript[θ, 1])+(Subscript[θ, 2]))] Sin[(2/2)( (Subscript[θ, 1])-(Subscript[θ, 2]))]//Simplify
Ψ1==((-I)/( π)) Sin[(2/2) ((Subscript[θ, 1])+(Subscript[θ, 2]))] Sin[(3/2)( (Subscript[θ, 1])-(Subscript[θ, 2]))]//Simplify
Ψ2==((-I)/( π)) Sin[(3/2) ((Subscript[θ, 1])+(Subscript[θ, 2]))] Sin[(4/2)( (Subscript[θ, 1])-(Subscript[θ, 2]))]//Simplify
Ψ3==((-I)/( π)) Sin[(4/2) ((Subscript[θ, 1])+(Subscript[θ, 2]))] Sin[(5/2)( (Subscript[θ, 1])-(Subscript[θ, 2]))]//Simplify
Ψ4==((-I)/( π)) Sin[(5/2) ((Subscript[θ, 1])+(Subscript[θ, 2]))] Sin[(6/2)( (Subscript[θ, 1])-(Subscript[θ, 2]))]//Simplify

Φ=Sin[Ω];Ψ=Sin[ω];
{(((∫_0^(2π))(1/4)((((((∂_Ω)Φ)/R)))^2)\[DifferentialD]Ω)/((∫_0^(2π))(Φ^2)\[DifferentialD]Ω)),(((∫_0^π)(((((((∂_ω)Ψ)/R)))^2)+((Ψ^2)/(2 R Sin[ω/2])))\[DifferentialD]ω)/((∫_0^π)(Ψ^2)\[DifferentialD]ω))}//Expand
Plus@@%

Φ=Sin[2Ω];Ψ=Sin[(3/2)ω];
{(((∫_0^(2π))(1/4)((((((∂_Ω)Φ)/R)))^2)\[DifferentialD]Ω)/((∫_0^(2π))(Φ^2)\[DifferentialD]Ω)),(((∫_0^π)(((((((∂_ω)Ψ)/R)))^2)+((Ψ^2)/(2 R Sin[ω/2])))\[DifferentialD]ω)/((∫_0^π)(Ψ^2)\[DifferentialD]ω))}//Expand
Plus@@%

Table[((m^2)/(2(R^2)))+((((1/2))^2)/(2(R^2))),{m,{(1/2),(3/2),(5/2),(7/2),(9/2),(11/2)}}]

(Subscript[ψ, n_])[θ_]=Sin[ω]((Sin[(ω/2)])^(n-1));

pES=FindFit[ES,(a/(1+b (Sqrt[R])+c R))/.a->-0.047636873347418,{b,c},R,MaxIterations->10000]

pES=FindFit[ES,(a/(1+b (Sqrt[R])+c R))/.a->-0.047636873347418,{b,c},R,MaxIterations->10000]

ES=Table[{R,Sort[Eigenvalues[{N[H[R],100],N[S[R],100]}]][[1]]-((1/(R^2))+(8/(3 π R)))},{R,{(1/10),(1/5),(1/2),1,2,5,10,20,50,100}}]

pES=FindFit[ES,(a/(1+b (Sqrt[R])+c R)),{a,b,c},R,MaxIterations->10000]

2 0.0240765

ES=Table[{R,Sort[Eigenvalues[{N[H[R],100],N[S[R],100]}]][[1]]-((1/(R^2))+(8/(3 π R)))},{R,{(1/1000000),(1/100000),(1/10000),(1/1000),(1/100),(1/10)}}]
FindFit[%,a+b R +c (R^2)+d (R^3)+e (R^4),{a,b,c,d,e},R]

Correlation functional

(Subscript[ψ, n_])[θ_]=((Sin[(θ/2)])^n);
With[{M=20},
H[R_]=Table[(((Sqrt[π]) (((4 R Gamma[((i+j)/2)])/(Gamma[(1/2) (1+i+j)]))+((i j Gamma[(1/2) (-1+i+j)])/(Gamma[(1/2) (2+i+j)]))))/(8 (R^2))),{i,M},{j,M}];
S[R_]=Table[(((Sqrt[π]) Gamma[(1/2) (1+i+j)])/(Gamma[(1/2) (2+i+j)])),{i,M},{j,M}];
GS=Table[{R,Sort[Eigenvalues[{N[H[R],100],N[S[R],100]}]][[1]]-((1/(4 (R^2)))+(2/(π R)))},{R,{(1/10),(1/5),(1/2),1,2,5,10,20,50,100}}];
ES=Table[{R,Sort[Eigenvalues[{N[H[R],100],N[S[R],100]}]][[2]]-((9/(4 (R^2)))+(46/(15 π R)))},{R,{(1/10),(1/5),(1/2),1,2,5,10,20,50,100}}];
]

pGS=FindFit[GS,(a/(1+b (Sqrt[R])+c R))/.a->-((π^2)/360),{b,c},R]
pES=FindFit[ES,(a/(1+b (Sqrt[R])+c R))/.a->(368/315)-(41325904/(3472875 (π^2))),{b,c},R,MaxIterations->10000]

-((368/315)-(41325904/(3472875 (π^2))))(1/2)//N

SetAccuracy[ES/2,7]

EcGS[R_]=(a/(1+b (Sqrt[R])+c R))/.a->-((π^2)/360)/.{b->0.095958707683682682941695944537473604281786915029293769972707221329933719479742125103692725250505223500265384604391`96.91414506639374,c->0.2358000487741055143930009324325804651761052760760136845862285830126621670590099415807670233869414812299596830608171`96.91414506639374};	EcES[R_]=(a/(1+b (Sqrt[R])+c R))/.a->(368/315)-(41325904/(3472875 (π^2)))/.{b->-0.0450642038834491479552686470928193957445512496838711959860216571781955398753902501502514638402184202581381075098138`96.20122516853725,c->0.1050005105883890820275253948462090005503419436460205156466169966062254250448928962683347439163026889694509717102111`96.20122516853725};

Show[{Plot[{EcES[R]},{R,0,10},PlotRange->All],ListPlot[{ES[[1;;5]]}]}]

TGS[R_]=(1/2)(1/(4 (R^2)));	TES[R_]=(1/2)(9/(4 (R^2)));
HxGS[ρ_]=(1/2)(2/(π R))/.R->(1/(π ρ));	HxES[ρ_]=(1/2)(46/(15 π R))/.R->(1/(π ρ));
EcGS[R_]=(1/2)(a/(1+b (Sqrt[R])+c R))/.a->-((π^2)/360)/.{b->0.10037286447395476985488129511356429111`11.914145066393722,c->0.2349905963892781550051759684291348607`11.914145066393722};	EcES[R_]=(1/2)(a/(1+b (Sqrt[R])+c R))/.a->(368/315)-(41325904/(3472875 (π^2)))/.{b->-0.04420131976762021227234477691324770495`11.201225168537151,c->0.10510888718455757836214541170559819346`11.201225168537151};
HxcGS[ρ_]=HxGS[ ρ]+EcGS[(1/(π ρ))];	HxcES[ρ_]=HxES[ρ]+EcES[(1/(π ρ))];	cGS[ρ_]=EcGS[(1/(π ρ))];	cES[ρ_]=EcES[(1/(π ρ))];
Ewc[ρ_,w_]=(1-w)cGS[ρ]+w cES[ρ];
EwHx[ρ_,w_]=(1-w)HxGS[ρ]+w HxES[ρ];
EwHxc[ρ_,w_]=(1-w)HxcGS[ρ]+w HxcES[ρ];

Show[{ListPlot[{ES}],Plot[{2ϵOGc1[(1/(π R))]},{R,0,100},PlotRange->All]}]

Show[{ListPlot[{GS,ES}],Plot[{2EcGS[R],2EcES[R]},{R,0,100},PlotRange->All]}]

(1/2)((1/(R^2))+(8/(3 π R)))/.R->(1/(π ρ))//Expand

Multi-state correlation functional for single excitations

(-1+i+j+3 i j)//Factor

Table[((((n+1))^2)/(R^2))+((PolyGamma[2 n+(5/2)]-PolyGamma[(1/2)])/(π R)),{n,0,5}]//FullSimplify//Expand

(Subscript[ψ, n_])[θ_]=Cos[(θ/2)]((Sin[(θ/2)])^n);
With[{M=20},
H[R_]=Table[(((Sqrt[π]) (((4 R Gamma[((i+j)/2)])/(Gamma[(1/2) (3+i+j)]))+(((-1+i+j+3 i j) Gamma[(1/2) (-1+i+j)])/(Gamma[(1/2) (4+i+j)]))))/(16 (R^2))),{i,M},{j,M}];
S[R_]=Table[(((Sqrt[π]) Gamma[(1/2) (1+i+j)])/(2 Gamma[(1/2) (4+i+j)])),{i,M},{j,M}];
]

Eig0=Table[{R,Sort[Eigenvalues[{N[H[R],100],N[S[R],100]}]][[1]]-((1/(R^2))+(8/(3 π R)))},{R,{(1/10),(1/5),(1/2),1,2,5,10,20,50,100}}];
Eig1=Table[{R,Sort[Eigenvalues[{N[H[R],100],N[S[R],100]}]][[2]]-((4/(R^2))+(352/(105 π R)))},{R,{(1/10),(1/5),(1/2),1,2,5,10,20,50,100}}];
Eig2=Table[{R,Sort[Eigenvalues[{N[H[R],100],N[S[R],100]}]][[3]]-((9/(R^2))+(13016/(3465 π R)))},{R,{(1/10),(1/5),(1/2),1,2,5,10,20,50,100}}];
Eig3=Table[{R,Sort[Eigenvalues[{N[H[R],100],N[S[R],100]}]][[4]]-((16/(R^2))+(182144/(45045 π R)))},{R,{(1/10),(1/5),(1/2),1,2,5,10,20,50,100}}];
Eig4=Table[{R,Sort[Eigenvalues[{N[H[R],100],N[S[R],100]}]][[5]]-((25/(R^2))+(EulerGamma/(π R))+((Log[4])/(π R))+((PolyGamma[0,(21/2)])/(π R)))},{R,{(1/10),(1/5),(1/2),1,2,5,10,20,50,100}}];

Table[{R,Sort[Eigenvalues[{N[H[R],100],N[S[R],100]}]][[5]]-((25/(R^2))+(EulerGamma/(π R))+((Log[4])/(π R))+((PolyGamma[0,(21/2)])/(π R)))},{R,Table[(10^(-n)),{n,10,4,-1}]}]

pEig0=FindFit[Eig0,(a/(1+b (Sqrt[R])+c R))/.a->-0.047636873,{b,c},R,MaxIterations->10000]
pEig1=FindFit[Eig1,(a/(1+b (Sqrt[R])+c R))/.a->-0.0289264865,{b,c},R,MaxIterations->10000]
pEig2=FindFit[Eig2,(a/(1+b (Sqrt[R])+c R))/.a->-0.018618004,{b,c},R,MaxIterations->10000]
pEig3=FindFit[Eig3,(a/(1+b (Sqrt[R])+c R))/.a->-0.013098897,{b,c},R,MaxIterations->10000]
pEig4=FindFit[Eig4,(a/(1+b (Sqrt[R])+c R))/.a->-0.009805034,{b,c},R,MaxIterations->10000]

(*(* LDA correlation *)
ϵcLDA[ρ_]:=LDA[(1/(2ρ))];
dϵcLDA[ρ_]:=Evaluate[(∂_ρ)ϵcLDA[ρ]];
dvcLDA[ρ_]:=Evaluate[(∂_(ρ,ρ))(ρ ϵcLDA[ρ])];

(* c functional *)
ϵSc0[ρ_]=Module[{a=((-0.047636873)/2),b=0.007322733076681898`,c=0.17864603346785277`,R=(1/(π ρ))},(a/(1+b (Sqrt[R])+c R))];
ϵSc1[ρ_]=Module[{a=((-0.0289264865)/2),b=-0.07509530717469434`,c=0.07153672255768866`,R=(1/(π ρ))},(a/(1+b (Sqrt[R])+c R))];
ϵSc2[ρ_]=Module[{a=((-0.018618004)/2),b=-0.10659462445966353`,c=0.04232689081057203`,R=(1/(π ρ))},(a/(1+b (Sqrt[R])+c R))];
ϵSc3[ρ_]=Module[{a=((-0.013098897)/2),b=-0.1230218348860354`,c=0.03035525175874265`,R=(1/(π ρ))},(a/(1+b (Sqrt[R])+c R))];
ϵSc4[ρ_]=Module[{a=((-0.009805034)/2),b=-0.13229124169573575`,c=0.024081224966440877`,R=(1/(π ρ))},(a/(1+b (Sqrt[R])+c R))];

(* LDA-shifted functionals *)
ϵSc0[ρ_]=ϵSc0[ρ]+ϵcLDA[ρ]-ϵSc0[ρ];
ϵSc1[ρ_]=ϵSc1[ρ]+ϵcLDA[ρ]-ϵSc0[ρ];
ϵSc2[ρ_]=ϵSc2[ρ]+ϵcLDA[ρ]-ϵSc0[ρ];
ϵSc3[ρ_]=ϵSc3[ρ]+ϵcLDA[ρ]-ϵSc0[ρ];
ϵSc4[ρ_]=ϵSc4[ρ]+ϵcLDA[ρ]-ϵSc0[ρ];

ϵSc[ρ_,{w1_,w2_,w3_,w4_}]=(1-w1-w2-w3-w4)ϵSc0[ρ]+w1 ϵSc1[ρ]+w2 ϵSc2[ρ]+w3 ϵSc3[ρ]+w4 ϵSc4[ρ];	
dϵSc[ρ_,{w1_,w2_,w3_,w4_}]=Evaluate[(∂_ρ)ϵSc[ρ,{w1,w2,w3,w4}]];
dvSc[ρ_,{w1_,w2_,w3_,w4_}]=Evaluate[(∂_(ρ,ρ))(ρ ϵSc[ρ,{w1,w2,w3,w4}])];
*)

eDFT5[4,30,π,{1/5,1/5,1/5,1/5}]//Last
eDFT5[4,30,π,{1/4,1/4,1/4,0}]//Last
eDFT5[4,30,π,{1/3,1/3,0,0}]//Last
eDFT5[4,30,π,{1/2,0,0,0}]//Last

Multi-state correlation functional for double excitations

Table[((((n+(1/2)))^2)/(R^2))+((PolyGamma[2 n+(3/2)]-PolyGamma[(1/2)])/(π R)),{n,0,5}]//FullSimplify//Expand

(Subscript[ψ, n_])[θ_]=((Sin[(θ/2)])^n);
With[{M=20},
H[R_]=Table[(((Sqrt[π]) (((4 R Gamma[((i+j)/2)])/(Gamma[(1/2) (1+i+j)]))+((i j Gamma[(1/2) (-1+i+j)])/(Gamma[(1/2) (2+i+j)]))))/(8 (R^2))),{i,M},{j,M}];
S[R_]=Table[(((Sqrt[π]) Gamma[(1/2) (1+i+j)])/(Gamma[(1/2) (2+i+j)])),{i,M},{j,M}];
Eig0=Table[{R,Sort[Eigenvalues[{N[H[R],100],N[S[R],100]}]][[1]]-((1/(4 (R^2)))+(2/(π R)))},{R,{(1/10),(1/5),(1/2),1,2,5,10,20,50,100}}];
Eig1=Table[{R,Sort[Eigenvalues[{N[H[R],100],N[S[R],100]}]][[2]]-((9/(4 (R^2)))+(46/(15 π R)))},{R,{(1/10),(1/5),(1/2),1,2,5,10,20,50,100}}];
Eig2=Table[{R,Sort[Eigenvalues[{N[H[R],100],N[S[R],100]}]][[3]]-((25/(4 (R^2)))+(1126/(315 π R)))},{R,{(1/10),(1/5),(1/2),1,2,5,10,20,50,100}}];
Eig3=Table[{R,Sort[Eigenvalues[{N[H[R],100],N[S[R],100]}]][[4]]-((49/(4 (R^2)))+(176138/(45045 π R)))},{R,{(1/10),(1/5),(1/2),1,2,5,10,20,50,100}}];
Eig4=Table[{R,Sort[Eigenvalues[{N[H[R],100],N[S[R],100]}]][[5]]-((81/(4 (R^2)))+(3186538/(765765 π R)))},{R,{(1/10),(1/5),(1/2),1,2,5,10,20,50,100}}];
]

Table[{R,Sort[Eigenvalues[{N[H[R],100],N[S[R],100]}]][[5]]-((81/(4 (R^2)))+(3186538/(765765 π R)))},{R,Table[(10^(-n)),{n,7,4,-1}]}]

pEig0=FindFit[Eig0,(a/(1+b (Sqrt[R])+c R))/.a->-((π^2)/360),{b,c},R,MaxIterations->10000]
pEig1=FindFit[Eig1,(a/(1+b (Sqrt[R])+c R))/.a->(368/315)-(41325904/(3472875 (π^2))),{b,c},R,MaxIterations->10000]
pEig2=FindFit[Eig2,(a/(1+b (Sqrt[R])+c R))/.a->-0.0229070,{b,c},R,MaxIterations->10000]
pEig3=FindFit[Eig3,(a/(1+b (Sqrt[R])+c R))/.a->-0.01547291,{b,c},R,MaxIterations->10000]
pEig4=FindFit[Eig4,(a/(1+b (Sqrt[R])+c R))/.a->-0.0112604,{b,c},R,MaxIterations->10000]

(*(* LDA correlation *)
ϵcLDA[ρ_]:=LDA[(1/(2ρ))];dϵcLDA[ρ_]:=Evaluate[(∂_ρ)ϵcLDA[ρ]];dvcLDA[ρ_]:=Evaluate[(∂_(ρ,ρ))(ρ ϵcLDA[ρ])];

(* c functional *)
ϵc0[ρ_]=Module[{a=-((π^2)/720),b=0.0955321,c=0.236166,R=(1/(π ρ))},(a/(1+b (Sqrt[R])+c R))];
ϵc1[ρ_]=Module[{a=-((π^2)/720),b=0.0955321,c=0.236166,R=(1/(π ρ))},(a/(1+b (Sqrt[R])+c R))];
ϵc2[ρ_]=Module[{a=(184/315)-(20662952/(3472875 (π^2))),b=-0.0464270,c=0.105760,R=(1/(π ρ))},(a/(1+b (Sqrt[R])+c R))];
ϵc3[ρ_]=Module[{a=((-0.0229070)/2),b=-0.09365681821886007`,c=0.0532411885019781`,R=(1/(π ρ))},(a/(1+b (Sqrt[R])+c R))];
ϵc4[ρ_]=Module[{a=((-0.01547291)/2),b=-0.11601477127629883`,c=0.03525141353674415`,R=(1/(π ρ))},(a/(1+b (Sqrt[R])+c R))];
ϵc5[ρ_]=Module[{a=((-0.0112604)/2),b=0.6115361543664315`,c=-0.15170970938028086`,R=(1/(π ρ))},(a/(1+b (Sqrt[R])+c R))];

(* LDA-shifted functionals *)
ϵc0[ρ_]=ϵc0[ρ]+ϵcLDA[ρ]-ϵc0[ρ];
ϵc1[ρ_]=ϵc1[ρ]+ϵcLDA[ρ]-ϵc0[ρ];
ϵc2[ρ_]=ϵc2[ρ]+ϵcLDA[ρ]-ϵc0[ρ];
ϵc3[ρ_]=ϵc3[ρ]+ϵcLDA[ρ]-ϵc0[ρ];
ϵc4[ρ_]=ϵc4[ρ]+ϵcLDA[ρ]-ϵc0[ρ];
ϵc5[ρ_]=ϵc5[ρ]+ϵcLDA[ρ]-ϵc0[ρ];

ϵc[ρ_,{w1_,w2_,w3_,w4_,w5_}]=(1-w1-w2-w3-w4-w5)ϵc0[ρ]+w1 ϵc1[ρ]+w2 ϵc2[ρ]+w3 ϵc3[ρ]+w4 ϵc4[ρ]+w5 ϵc5[ρ];
dϵc[ρ_,{w1_,w2_,w3_,w4_,w5_}]=Evaluate[(∂_ρ)ϵc[ρ,{w1,w2,w3,w4,w5}]];
dvc[ρ_,{w1_,w2_,w3_,w4_,w5_}]=Evaluate[(∂_(ρ,ρ))(ρ ϵc[ρ,{w1,w2,w3,w4},w5])];
*)

eDFT5[n_,M_,L_,w_]:=Module[
{ϕ,ϕϕ,nQ,rQ,wQ,Boundary,maxSCF,thresh,H,ERI,c,Conv,nSCF,Fw,P0,P1,P2,P3,P4,P5,Pw,ρ0,ρ1,ρ2,ρ3,ρ4,ρ5,ρw,vc,ϵ,HLGap,EwK,EwHx,EwHxc,Ewc,Ew,E,E0,E1,E2,E3,E4,E5,Δxc,ΔLZ,Ω,e,ℱ,ℰ,WP},

(* Parameters *)
maxSCF=128;	thresh=(10^(-7));	nQ=51;	ℱ={};	ℰ={};	WP=30;

(* Define basis functions & other stuff *)
Boundary=L/2;
ϕ=Table[If[OddQ[m],(Sqrt[2/L])Cos[m ((π x)/L)],(Sqrt[2/L])Sin[m ((π x)/L)]],{m,M}];
H=((((π/L)))^2)DiagonalMatrix[Table[(m^2)/2,{m,M}]];	    
ERI=Take[((π/L))ERIB ,{1,M},{1,M},{1,M},{1,M}];

(* Antysymmetrize two-electron integrals *)
ERI=Flatten[ERI,{{1},{2},{3,4}}]-Flatten[ERI,{{1},{4},{3,2}}];

(* Set up quadrature *)
{rQ,wQ}=Transpose[GaussianQuadratureWeights[nQ,-Boundary,Boundary,WP]];

(* Compute values of basis functions at grid points *)
ϕϕ=Table[wQ[[k]]ReplaceAll[ϕ[[i]]ϕ[[j]],x-> rQ[[k]]],{k,nQ},{i,M},{j,M}];

(* Guess coefficients *)
c=Table[(Subscript[δ, i-j]),{i,M},{j,M}];	Conv=1;	nSCF=0;

(* Starting SCF loop *)
While[Conv>thresh∧nSCF<maxSCF,	
	
(* Compute density matrices *)
P0=c[[1;;n]]\[Transpose].c[[1;;n]];																	 ρ0=ϕ.P0.ϕ;
P1=If[n>1,c[[1;;n-1]]\[Transpose].c[[1;;n-1]],0]+If[M>n+1,c[[n+1;;n+1]]\[Transpose].c[[n+1;;n+1]],0];	ρ1=ϕ.P1.ϕ;P2=If[n>2,c[[1;;n-2]]\[Transpose].c[[1;;n-2]],0]+If[M>n+2,c[[n+1;;n+2]]\[Transpose].c[[n+1;;n+2]],0];	ρ2=ϕ.P2.ϕ;
P3=If[n>2,c[[1;;n-2]]\[Transpose].c[[1;;n-2]],0]+If[M>n+4,c[[n+3;;n+4]]\[Transpose].c[[n+3;;n+4]],0];	ρ3=ϕ.P3.ϕ;
P4=If[n>2,c[[1;;n-2]]\[Transpose].c[[1;;n-2]],0]+If[M>n+6,c[[n+5;;n+6]]\[Transpose].c[[n+5;;n+6]],0];	ρ4=ϕ.P4.ϕ;
P5=If[n>2,c[[1;;n-2]]\[Transpose].c[[1;;n-2]],0]+If[M>n+8,c[[n+7;;n+8]]\[Transpose].c[[n+7;;n+8]],0];	ρ5=ϕ.P5.ϕ;
Pw=(1-w[[1]]-w[[2]]-w[[3]]-w[[4]]-w[[5]])P0+w[[1]]P1+w[[2]]P2+w[[3]]P3+w[[4]]P4+w[[5]]P5;		     ρw=ϕ.Pw.ϕ;
	
(* Compute Fock matrices for Hxc or c-only *)
vc=Table[ϵc[ReplaceAll[ρw,x->rQ[[k]]],w]+ dϵc[ReplaceAll[ρw,x->rQ[[k]]]ReplaceAll[ρw,x->rQ[[k]]],w],{k,nQ}];
Fw=H+ERI.Flatten[Pw]+vc.ϕϕ;

(* DIIS section *)
e=Pw.Fw-Fw.Pw;	ℱ=Prepend[ℱ,Fw];	ℰ=Prepend[ℰ,e];	Fw=DIIS[ℱ,ℰ];

(* Diagonalize Fock matrix *)
c=SetPrecision[Chop[Reverse[Eigenvectors[Fw]]],WP];
Conv=Max[Abs[e]];	nSCF++;
];	
(* Check for convergence *)
If[nSCF==128,Print["SCF has not converged!!"]];

(* Compute energies *)
EwK=Tr[Pw.H];
Ewc=Chop[NIntegrate[ϵc[ρw,w]ρw ,{x,-Boundary,Boundary}]];
EwHx=((Tr[Pw.ERI.Flatten[Pw]])/2);	EwHxc=EwHx+Ewc;
Ew=EwK+EwHxc;

(* Compute HOMO-LUMO gap *)
ϵ=Reverse[Eigenvalues[Fw]];	HLGap=If[M>n,ϵ[[n+1]]-ϵ[[n]],0];
{ϵ,c}=Chop[SortEigensystem[Eigensystem[Fw]]];

(* Compute energies for cation, neutral and anion *) 
{E0,E1,E2,E3,E4,E5}={Tr[P0.H],Tr[P1.H],Tr[P2.H],Tr[P3.H],Tr[P4.H],Tr[P5.H]}+
(1/2){Tr[P0.ERI.Flatten[P0]],Tr[P1.ERI.Flatten[P1]],Tr[P2.ERI.Flatten[P2]],Tr[P3.ERI.Flatten[P3]],Tr[P4.ERI.Flatten[P4]],Tr[P5.ERI.Flatten[P5]]}+
Chop[NIntegrate[(ϵc[ρw,w]+dϵc[ρw,w]ρw){ρ0,ρ1,ρ2,ρ3,ρ4,ρ5},{x,-Boundary,Boundary}]];

(* Levy-Zahariev shift *)
ΔLZ=-Chop[NIntegrate[dϵc[ρw,w]((ρw)^2),{x,-Boundary,Boundary}]];

(* Derivative discontinuities *)
Δxc=Chop[NIntegrate[ ({ϵc[ρw,{1,0,0,0,0}],ϵc[ρw,{0,1,0,0,0}],ϵc[ρw,{0,0,1,0,0}],ϵc[ρw,{0,0,0,1,0}],ϵc[ρw,{0,0,0,0,1}]}-ϵc[ρw,{0,0,0,0,0}])ρw,{x,-Boundary,Boundary}]];
Δxc={
-w [[1]]Δxc[[1]]-w[[2]]Δxc[[2]]-w[[3]]Δxc[[3]]-w[[4]]Δxc[[4]]-w[[5]]Δxc[[5]],
(1-w[[1]])Δxc[[1]] -w[[2]]Δxc[[2]]-w[[3]]Δxc[[3]]-w[[4]]Δxc[[4]]-w[[5]]Δxc[[5]],
-w[[1]]Δxc[[1]]+(1-w[[2]])Δxc[[2]]-w[[3]]Δxc[[3]]-w[[4]]Δxc[[4]]-w[[5]]Δxc[[5]],
-w[[1]]Δxc[[1]]-w[[2]]Δxc[[2]]+(1-w[[3]])Δxc[[3]]-w[[4]]Δxc[[4]]-w[[5]]Δxc[[5]],
-w[[1]]Δxc[[1]]-w[[2]]Δxc[[2]]-w[[3]]Δxc[[3]]+(1-w[[4]])Δxc[[4]]-w[[5]]Δxc[[5]],
-w[[1]]Δxc[[1]]-w[[2]]Δxc[[2]]-w[[3]]Δxc[[3]]-w[[4]]Δxc[[4]]+(1-w[[5]])Δxc[[5]]
};

(* Individual energies *)
E={E0,E1,E2,E3,E4,E5}+ΔLZ+Δxc;

(* Excitation energies *)
Ω=E[[2;;6]]-E[[1]];

(* Return useful stuff *)
Return[{Ew,EwK,EwHx,Ewc,EwHxc,nSCF,Conv,HLGap,E,Δxc,ΔLZ,Ω}];
];

eDFT5[5,10,8π,{1/5,1/5,1/5,1/5,1/5}]//Last

ExtractOG[OG$FCI$Box5][[7]]

EnergyTableOG[2, π,{1/2,0},"boxium",30,30]

EnergyTableOG[2, π,{0,1/2},"boxium",30,30]

EnergyTableOG[2, π,{1/3,1/3},"boxium",30,30]

HF-based two-state ensemble

Let’s consider the following two-state ensemble

(Subscript[Ε, 0])[R_]=(1/(4 (R^2)))+(2/(π R));	(Subscript[Ε, 1])[R_]=(9/(4 (R^2)))+(46/(15 π R));	(Subscript[Εe, w_])[R_]=(1-w)(Subscript[Ε, 0])[R]+w (Subscript[Ε, 1])[R];	(* w ≤ 1/2 *)

With[{R=1},Plot[{(Subscript[Ε, 0])[R],(Subscript[Ε, 1])[R],(Subscript[Εe, w])[R]},{w,0,(1/2)},PlotLegends->{"(Subscript[E, 0])","(Subscript[E, 1])","(Subscript[E, w])"}]]

The ensemble energy behaves as a square root for w≈0, and the next term is linear in w (as expected) and decay as 1/R.
Therefore, in the weakly correlated regime, this term is small while in the strongly correlated regime, the non-linearity error is getting large.
Around w≈1/2, the ensemble energy is perfectly linear though...

With[{R=1.},{(Subscript[Ε, 1])[R]-(Subscript[Ε, 0])[R],2((Subscript[Εe, 1/2])[R]-(Subscript[Εe, 0])[R]),(∂_w)(Subscript[Εe, w])[R]}]

HF-based three-state ensemble

Let’s consider the following three-state ensemble

(Subscript[Ε, 0])[R_]=(1/(4 (R^2)))+(2/(π R));	(Subscript[Ε, 1])[R_]=(9/(4 (R^2)))+(46/(15 π R));	(Subscript[Ε, 2])[R_]=(25/(4 (R^2)))+(1126/(315 π R));	(Subscript[Εe, w_])[R_]=((1-w)/2)(Subscript[Ε, 0])[R]+((1-w)/2)(Subscript[Ε, 1])[R]+w (Subscript[Ε, 2])[R];	((1-w)/2)+((1-w)/2)+w==1	(* GOK weights *)

With[{R=1},Plot[{(Subscript[Ε, 0])[R],(Subscript[Ε, 1])[R],(Subscript[Ε, 2])[R],(Subscript[Εe, w])[R]},{w,0,(1/3)},PlotLegends->{"(Subscript[E, 0])","(Subscript[E, 1])","(Subscript[E, 2])","(Subscript[E, w])"}]]

With[{R=1.},{(Subscript[Ε, 2])[R]-(Subscript[Ε, 0])[R],3((Subscript[Εe, 1/3])[R]-(Subscript[Εe, 0])[R])}]

Optical gap functional

GS={{(1/10),-0.0128593998213208488715867331771442724839173512775605292661554779531007167766500066208741907214041075667671974201535`96.91414506639374},{(1/5),-0.0125252185702759177576620651916941484592788006823880092349262556354801069850402717499979104540267334365161286699795`97.42531576476934},{(1/2),-0.0116197723675813416188575002061880300094882266047067549523681876214181050250652459547212894799195356609585299528368`98.01404509782107},{1,-0.0103738985148930123183130300484330373589388712546833735236309324879374918111145767212460664669541699633347887215941`98.37951830718325},{2,-0.0085576871317177848665078766124391478683219937702428675451762491096190273000807507371113823075817603798781780321974`98.67264965264975},{5,-0.0056726354875599750956545324570491509446634466623713768092684236957514145975065343456597184114428997132133835485872`98.95451780763668},{10,-0.0036969676248678700860420346477255626843870233896911044290093099922629826196058265207002879333158431984857449088384`99.09973442176008},{20,-0.0022259300252324747174853602118218493556973259088855646106702084622972261225569603122371553884144975927832749857057`99.20131944046643},{50,-0.0010463483652820938784656533881617884253442725003176995183665118959492005197795774081768208105632151424033014040678`99.28971419763612},{100,-0.0005665759552468250554382515816865617889700714528844284044126267943427071562133958718204416305973950494903325902808`99.33346376956098}};
ES1={{(1/10),-0.0233919133688294338725489902424360579291569352838256256567083743361264952890413839666943800706139111953327011436662`96.63490030716858},{(1/5),-0.0229790165593502511825730569158370414130775180156525783612063022990086504447345507801168478265582230615011279254896`97.19700574467956},{(1/2),-0.0218171161053207956416101442949554983405285652821008177376118305485936020051563965140865305659683386126725217385465`97.88747011379189},{1,-0.0201087685227014797847474339817617295577538045072223922500413062977535618833928782566747809589829774158218143506164`98.34707082463716},{2,-0.01737071560943161136522554362029101695312889227054672968142766995061232835176627270684097288417758809502784868439`98.73489053429275},{5,-0.0123593260698056059283169998460537490766232960342888890153183814337879677623753481642620299634892096706788675863579`99.12574362784343},{10,-0.0084363944651786557816435738550381440420765875664709927488634181718911545197361721268950052448686258593053154738567`99.33503744548479},{20,-0.0052569107832976983237126536599821203689054694311944236688517732836514685682891512068437849140071016778603420943805`99.48485515823415},{50,-0.0025462582306028380464264786183570878766096416172025619663754465671580141071321504863008246866196441220310651168981`99.6175922518337},{100,-0.001399039749842981857828496977704554839733443226241719764887705151489660115748887580018697718643816130450246767085`99.68416767479344}};
ES2={{(1/10),-0.0186531865881619232883304273725418440718317089588615894197621566689654374160170131097463327295545077196126468424068`96.20122516853725},{(1/5),-0.0185760833775931454849107901277835283567083061409109887629667586322036741794774035773270892834305734827242146448726`96.78398843436749},{(1/2),-0.0183004848149312815264548819797128142530042546121619390685520505967401634013364613959899838597692566748900915861263`97.52544101284886},{1,-0.0177431553749197673479121974608999424719220156905844027013629930583120593653187217459772496315381554258940649337002`98.04617977811091},{2,-0.016491254503711582627538415970853287143873780162968558252643625607321618234936577247308125458111039589820220219974`98.5107097283594},{5,-0.0131452316074612776411928701431126996086614728604153436384797396295314877676028906631139812312282407892823797962071`99.00659976475548},{10,-0.0096695193645121758061168753103930508466641481990542338836755373974846427499111140721123525409939355241122974954451`99.28307779680645},{20,-0.0063653164905374629069722251333023819326753972377977193664948159937038394203881113103079322884539836632198178192409`99.48469433334822},{50,-0.0032313348237008517327862165881185269345252750873870728972933968098499300575524756605621701438386666250952636203926`99.66551606360517},{100,-0.0018158465980548370158802426112238369243654400666026792296755738311348552505105974305621220209559930964334663908092`99.75700658345812}};

SizeLegend=1.5;
SizeEpilog=3;
SizeLabel=2;
OptionsEc={
AspectRatio->1,
PlotMarkers->{Automatic,Large},
Frame->True,
FrameStyle->Directive[Thick,20],
ImageSize->Large,
PlotRange->All,PlotStyle->Thick,FrameLabel->{
MaTeX["\\text{Ring's radius $R$ (a.u.)}",Magnification->SizeLabel],
MaTeX["\\text{Reduced correlation energy $\\epsilon_c^{(I)}$ (a.u.)}",Magnification->SizeLabel]
}
};
Show[{ListPlot[{GS,ES1,ES2},OptionsEc,PlotLegends->Placed[{
MaTeX["\\text{Ground state $I=0$}",Magnification->SizeLabel],
MaTeX["\\text{Singly-excited state $I=1$}",Magnification->SizeLabel],
MaTeX["\\text{Doubly-excited state $I=2$}",Magnification->SizeLabel]},{Right,Bottom}]],Plot[{ϵOGc0[(1/(π R))],ϵOGc1[(1/(π R))],ϵOGc2[(1/(π R))]},{R,0,100},PlotRange->All]}]

GIC functional

{(Subscript[Ψ, 0])[ω_]=(Sqrt[(2/π)])Sin[(ω/2)],(Subscript[Ψ, 1])[ω_]=(Sqrt[(2/π)])Sin[2(ω/2)],(Subscript[Ψ, 2])[ω_]=(Sqrt[(2/π)])Sin[3(ω/2)]};

{(∫_0^π)(((Subscript[Ψ, 0])[ω])^2)\[DifferentialD]ω,(∫_0^π)(((Subscript[Ψ, 1])[ω])^2)\[DifferentialD]ω,(∫_0^π)(((Subscript[Ψ, 2])[ω])^2)\[DifferentialD]ω}

(*ϵOGHx0[ρ_]=ρ;	ϵOGHx1[ρ_]=((4 ρ)/3);	ϵOGHx2[ρ_]=((23 ρ)/15);	
ϵOGHx[ρ_,{w1_,w2_}]=(1-w1-w2)ϵOGHx0[ρ]+w1 ϵOGHx1[ρ]+w2 ϵOGHx2[ρ];
dϵOGHx[ρ_,{w1_,w2_}]=Evaluate[(∂_ρ)ϵOGHx[ρ,{w1,w2}]];
dϵOGHxdw1[ρ_,{w1_,w2_}]=Evaluate[(∂_w1)ϵOGHx[ρ,{w1,w2}]];
dϵOGHxdw2[ρ_,{w1_,w2_}]=Evaluate[(∂_w2)ϵOGHx[ρ,{w1,w2}]];*)

(* Hxc functional *)
(*ϵOGHxc0[ρ_]=ϵOGHx0[ρ]+ϵOGc0[ρ];
ϵOGHxc1[ρ_]=ϵOGHx1[ρ]+ϵOGc1[ρ];
ϵOGHxc2[ρ_]=ϵOGHx2[ρ]+ϵOGc2[ρ];	
ϵOGHxc[ρ_,{w1_,w2_}]=ϵOGHx[ρ,{w1,w2}]+ϵOGc[ρ,{w1,w2}];
dϵOGHxc[ρ_,{w1_,w2_}]=Evaluate[(∂_ρ)ϵOGHxc[ρ,{w1,w2}]];
dvOGHxc[ρ_,{w1_,w2_}]=Evaluate[(∂_(ρ,ρ))(ρ ϵOGHxc[ρ,{w1,w2}])];
dϵOGHxcdw1[ρ_,{w1_,w2_}]=Evaluate[(∂_w1)ϵOGHxc[ρ,{w1,w2}]];
dϵOGHxcdw2[ρ_,{w1_,w2_}]=Evaluate[(∂_w2)ϵOGHxc[ρ,{w1,w2}]];*)

(* Hartree-exchange GIC functionals *)
ϵHx[n_,{w1_,w2_}]= n((2Log[2]-(1/3)) w1(w1-1)+(8/3) w1 w2+(32/15) w2(w2-1));

2π(∫_0^π)(((1-(Subscript[w, 1])-(Subscript[w, 2]))(n0[θ]n0[θ]-((γ0[ω])^2))+(Subscript[w, 1])(n1[θ]n1[θ]-((γ1[ω])^2))+(Subscript[w, 2])(n2[θ]n2[θ]-((γ2[ω])^2))-(n[θ]n[θ]-((γ[ω])^2)))/(Sqrt[2-2Cos[ω]]))\[DifferentialD]ω

c=FullSimplify[CoefficientRules[(1-(Subscript[w, 1])-(Subscript[w, 2]))(n0[θ]n0[θ]-((γ0[ω])^2))+(Subscript[w, 1])(n1[θ]n1[θ]-((γ1[ω])^2))+(Subscript[w, 2])(n2[θ]n2[θ]-((γ2[ω])^2))//Expand,{(Subscript[w, 1]),(Subscript[w, 2])}]//TrigToExp]
i=2π(∫_0^π)((c[[;;,2]])/(Sqrt[2-2Cos[ω]]))\[DifferentialD]ω
d=Table[c[[k,1]]->i[[k]],{k,Length[c]}]
(1/(2R))(FromCoefficientRules[d,{(Subscript[w, 1]),(Subscript[w, 2])}])==(1-(Subscript[w, 1])-(Subscript[w, 2]))ρ+(Subscript[w, 1])((4ρ)/3)+(Subscript[w, 2])((23 ρ)/15)/.R->(1/(π ρ))//FullSimplify//Expand

c=FullSimplify[CoefficientRules[(n[θ]n[θ]-((γ[ω])^2))//Expand,{(Subscript[w, 1]),(Subscript[w, 2])}]//TrigToExp]
i=2π Integrate[((c[[;;,2]])/(Sqrt[2-2Cos[ω]])),{ω,0,2π},GenerateConditions->False]
d=Table[c[[k,1]]->i[[k]],{k,Length[c]}]
(1/(2R))(FromCoefficientRules[d,{(Subscript[w, 1]),(Subscript[w, 2])}])/.R->(1/(π ρ))//FullSimplify//Expand

n0[θ_]=(1/π);	n1[θ_]=(1/π);	n2[θ_]=(1/π);	n[θ_]=(1-(Subscript[w, 1])-(Subscript[w, 2]))n0[θ]+(Subscript[w, 1])n1[θ]+(Subscript[w, 2])n2[θ];
γ0[ω_]=((Cos[(ω/2)])/π);	γ1[ω_]=((Cos[2(ω/2)])/π);	γ2[ω_]=((Cos[3(ω/2)])/π);
γ[ω_]=(1-(Subscript[w, 1])-(Subscript[w, 2]))γ0[ω]+(Subscript[w, 1])γ1[ω]+(Subscript[w, 2])γ2[ω];

{2π(∫_0^π)((n0[θ]n0[θ]-((γ0[ω])^2))/(Sqrt[2-2Cos[ω]]))\[DifferentialD]ω,2π(∫_0^π)((n1[θ]n1[θ]-((γ1[ω])^2))/(Sqrt[2-2Cos[ω]]))\[DifferentialD]ω,2π(∫_0^π)((n2[θ]n2[θ]-((γ2[ω])^2))/(Sqrt[2-2Cos[ω]]))\[DifferentialD]ω}

Collect[(1-(Subscript[w, 1])-(Subscript[w, 2]))(n0[θ]n0[θ]-((γ0[ω])^2))+(Subscript[w, 1])(n1[θ]n1[θ]-((γ1[ω])^2))+(Subscript[w, 2])(n2[θ]n2[θ]-((γ2[ω])^2))-(n[θ]n[θ]-((γ[ω])^2))//Expand,{(Subscript[w, 1]),(Subscript[w, 2])},FullSimplify]

c=FullSimplify[CoefficientRules[(1-(Subscript[w, 1])-(Subscript[w, 2]))(n0[θ]n0[θ]-((γ0[ω])^2))+(Subscript[w, 1])(n1[θ]n1[θ]-((γ1[ω])^2))+(Subscript[w, 2])(n2[θ]n2[θ]-((γ2[ω])^2))-(n[θ]n[θ]-((γ[ω])^2))//Expand,{(Subscript[w, 1]),(Subscript[w, 2])}]//TrigToExp]
i=2π Integrate[((c[[;;,2]])/(Sqrt[2-2Cos[ω]])),{ω,0,2π},GenerateConditions->False]
d=Table[c[[k,1]]->i[[k]],{k,Length[c]}]
FromCoefficientRules[d,{(Subscript[w, 1]),(Subscript[w, 2])}]

((28 (Subscript[w, 1]))/(3 π))-((28 (Subscript[w, 1]^2))/(3 π))-((128 (Subscript[w, 2]))/(15 π))+((32 (Subscript[w, 1]) (Subscript[w, 2]))/(3 π))+((128 (Subscript[w, 2]^2))/(15 π))//N

c=FullSimplify[CoefficientRules[(1-(Subscript[w, 1])-(Subscript[w, 2]))(n0[θ]n0[θ]-((γ0[ω])^2))+(Subscript[w, 1])(n1[θ]n1[θ]-((γ1[ω])^2))+(Subscript[w, 2])(n2[θ]n2[θ]-((γ2[ω])^2))-(n[θ]n[θ]-((γ[ω])^2))//Expand,{(Subscript[w, 1]),(Subscript[w, 2])}]//TrigToExp]
i=2π NIntegrate[((c[[;;,2]])/(Sqrt[2-2Cos[ω]])),{ω,0,π},WorkingPrecision->20]
d=Table[c[[k,1]]->i[[k]],{k,Length[c]}]
FromCoefficientRules[d,{(Subscript[w, 1]),(Subscript[w, 2])}]

(1/(2R))(-0.6703358098214133` (Subscript[w, 1])+0.6703358098214133` (Subscript[w, 1]^2)-1.3581221810508415` (Subscript[w, 2])+1.6976527263135517` (Subscript[w, 1]) (Subscript[w, 2])+1.3581221810508415` (Subscript[w, 2]^2))/.R->(1/(π ρ))//FullSimplify//Expand

ρ( (2Log[2]-(1/3)) (Subscript[w, 1])((Subscript[w, 1])-1)+(8/3) (Subscript[w, 1]) (Subscript[w, 2])+(32/15) (Subscript[w, 2])((Subscript[w, 2])-1))//N//Expand

(1/15) ρ (5 (-1+Log[64]) (-1+(Subscript[w, 1])) (Subscript[w, 1])+8 (-4+5 (Subscript[w, 1])) (Subscript[w, 2])+32 (Subscript[w, 2]^2))== ρ( (2Log[2]-(1/3)) (Subscript[w, 1])((Subscript[w, 1])-1)+(8/3) (Subscript[w, 1]) (Subscript[w, 2])+(32/15) (Subscript[w, 2])((Subscript[w, 2])-1))//FullSimplify

Plot[{ϵOGHx[1,{(Subscript[w, 1]),0}],(1/15) ρ (5 (-1+Log[64]) (-1+(Subscript[w, 1])) (Subscript[w, 1])+8 (-4+5 (Subscript[w, 1])) (Subscript[w, 2])+32 (Subscript[w, 2]^2))/.{ρ->1,(Subscript[w, 2])->0},ϵOGHx[1,{(Subscript[w, 1]),0}]-(1/15) ρ (5 (-1+Log[64]) (-1+(Subscript[w, 1])) (Subscript[w, 1])+8 (-4+5 (Subscript[w, 1])) (Subscript[w, 2])+32 (Subscript[w, 2]^2))/.{ρ->1,(Subscript[w, 2])->0}},{(Subscript[w, 1]),0,1/2}]

The ground state HF wave function is

(1/(Sqrt[3]))Det[(({{Exp[-I (Subscript[θ, 1])], 1, Exp[+I (Subscript[θ, 1])]}, {Exp[-I (Subscript[θ, 2])], 1, Exp[+I (Subscript[θ, 2])]}, {Exp[-I (Subscript[θ, 3])], 1, Exp[+I (Subscript[θ, 3])]}}))]==((8 I)/(Sqrt[3])) Sin[((Subscript[θ, 1])/2)-((Subscript[θ, 2])/2)] Sin[((Subscript[θ, 1])/2)-((Subscript[θ, 3])/2)] Sin[((Subscript[θ, 2])/2)-((Subscript[θ, 3])/2)]//FullSimplify

(Subscript[Ψ, 0])=(1/(Sqrt[16 (π^3)]))((8 )/(Sqrt[3])) Sin[((Subscript[θ, 1])/2)-((Subscript[θ, 2])/2)] Sin[((Subscript[θ, 1])/2)-((Subscript[θ, 3])/2)] Sin[((Subscript[θ, 2])/2)-((Subscript[θ, 3])/2)];

(1/(Sqrt[2]))((1/(Sqrt[3]))Det[(({{Exp[-I (Subscript[θ, 1])], 1, Exp[+2I (Subscript[θ, 1])]}, {Exp[-I (Subscript[θ, 2])], 1, Exp[+2I (Subscript[θ, 2])]}, {Exp[-I (Subscript[θ, 3])], 1, Exp[+2I (Subscript[θ, 3])]}}))]+(1/(Sqrt[3]))Det[(({{Exp[-2I (Subscript[θ, 1])], 1, Exp[+1I (Subscript[θ, 1])]}, {Exp[-2I (Subscript[θ, 2])], 1, Exp[+1I (Subscript[θ, 2])]}, {Exp[-2I (Subscript[θ, 3])], 1, Exp[+1I (Subscript[θ, 3])]}}))])==8 I (Sqrt[(2/3)]) (Cos[(Subscript[θ, 1])]+Cos[(Subscript[θ, 2])]+Cos[(Subscript[θ, 3])])  Sin[((Subscript[θ, 1])/2)-((Subscript[θ, 2])/2)] Sin[((Subscript[θ, 1])/2)-((Subscript[θ, 3])/2)] Sin[((Subscript[θ, 2])/2)-((Subscript[θ, 3])/2)]//FullSimplify

(Subscript[Ψ, 1])=(1/(Sqrt[16 (π^3)]))8  (Sqrt[(2/3)]) (Cos[(Subscript[θ, 1])]+Cos[(Subscript[θ, 2])]+Cos[(Subscript[θ, 3])])  Sin[((Subscript[θ, 1])/2)-((Subscript[θ, 2])/2)] Sin[((Subscript[θ, 1])/2)-((Subscript[θ, 3])/2)] Sin[((Subscript[θ, 2])/2)-((Subscript[θ, 3])/2)];

(1/(Sqrt[3]))Det[(({{Exp[-2I (Subscript[θ, 1])], 1, Exp[+2I (Subscript[θ, 1])]}, {Exp[-2I (Subscript[θ, 2])], 1, Exp[+2I (Subscript[θ, 2])]}, {Exp[-2I (Subscript[θ, 3])], 1, Exp[+2I (Subscript[θ, 3])]}}))]==((8 I)/(Sqrt[3])) Sin[(Subscript[θ, 1])-(Subscript[θ, 2])] Sin[(Subscript[θ, 1])-(Subscript[θ, 3])] Sin[(Subscript[θ, 2])-(Subscript[θ, 3])]//FullSimplify

(Subscript[Ψ, 2])=(1/(Sqrt[16 (π^3)]))((8 )/(Sqrt[3])) Sin[(Subscript[θ, 1])-(Subscript[θ, 2])] Sin[(Subscript[θ, 1])-(Subscript[θ, 3])] Sin[(Subscript[θ, 2])-(Subscript[θ, 3])];

Integrate[(Subscript[Ψ, 0]^2),{(Subscript[θ, 1]),0,2π},{(Subscript[θ, 2]),0,2π},{(Subscript[θ, 3]),0,2π}]
Integrate[(Subscript[Ψ, 1]^2),{(Subscript[θ, 1]),0,2π},{(Subscript[θ, 2]),0,2π},{(Subscript[θ, 3]),0,2π}]
Integrate[(Subscript[Ψ, 2]^2),{(Subscript[θ, 1]),0,2π},{(Subscript[θ, 2]),0,2π},{(Subscript[θ, 3]),0,2π}]

NIntegrate[(Subscript[Ψ, 0]^2)((1/(Sqrt[2-2Cos[(Subscript[θ, 1])-(Subscript[θ, 2])]]))+(1/(Sqrt[2-2Cos[(Subscript[θ, 1])-(Subscript[θ, 3])]]))+(1/(Sqrt[2-2Cos[(Subscript[θ, 2])-(Subscript[θ, 3])]]))),{(Subscript[θ, 1]),0,2π},{(Subscript[θ, 2]),0,2π},{(Subscript[θ, 3]),0,2π}]
NIntegrate[(Subscript[Ψ, 1]^2)((1/(Sqrt[2-2Cos[(Subscript[θ, 1])-(Subscript[θ, 2])]]))+(1/(Sqrt[2-2Cos[(Subscript[θ, 1])-(Subscript[θ, 3])]]))+(1/(Sqrt[2-2Cos[(Subscript[θ, 2])-(Subscript[θ, 3])]]))),{(Subscript[θ, 1]),0,2π},{(Subscript[θ, 2]),0,2π},{(Subscript[θ, 3]),0,2π}]
NIntegrate[(Subscript[Ψ, 2]^2)((1/(Sqrt[2-2Cos[(Subscript[θ, 1])-(Subscript[θ, 2])]]))+(1/(Sqrt[2-2Cos[(Subscript[θ, 1])-(Subscript[θ, 3])]]))+(1/(Sqrt[2-2Cos[(Subscript[θ, 2])-(Subscript[θ, 3])]]))),{(Subscript[θ, 1]),0,2π},{(Subscript[θ, 2]),0,2π},{(Subscript[θ, 3]),0,2π}]

(Subscript[ρ, 0])=(Subscript[Ψ, 0]^2);	(Subscript[ρ, 1])=(Subscript[Ψ, 1]^2);	(Subscript[ρ, 2])=(Subscript[Ψ, 2]^2);	(Subscript[ρ, w])=(1-(Subscript[w, 1])-(Subscript[w, 2]))(Subscript[ρ, 0])+(Subscript[w, 1])(Subscript[ρ, 1])+(Subscript[w, 2])(Subscript[ρ, 2]);

c=FullSimplify[CoefficientRules[(1-(Subscript[w, 1])-(Subscript[w, 2]))(Subscript[ρ, 0])+(Subscript[w, 1])(Subscript[ρ, 1])+(Subscript[w, 2])(Subscript[ρ, 2])-(Subscript[ρ, w])//Expand,{(Subscript[w, 1]),(Subscript[w, 2])}]//TrigToExp]
i=2π NIntegrate[c[[;;,2]]((1/(Sqrt[2-2Cos[(Subscript[θ, 1])-(Subscript[θ, 2])]]))+(1/(Sqrt[2-2Cos[(Subscript[θ, 1])-(Subscript[θ, 3])]]))+(1/(Sqrt[2-2Cos[(Subscript[θ, 2])-(Subscript[θ, 3])]]))),{(Subscript[θ, 1]),0,2π},{(Subscript[θ, 2]),0,2π},{(Subscript[θ, 3]),0,2π},WorkingPrecision->15]
d=Table[c[[k,1]]->i[[k]],{k,Length[c]}]
FromCoefficientRules[d,{(Subscript[w, 1]),(Subscript[w, 2])}]

Two electrons on a glome

HF energies

(Subscript[φ, k_])[χ_]=(1/((Sqrt[2]) π))(Subscript[U, k])[Cos[χ]] ;

Table[4 π(∫_0^π)(Subscript[φ, i])[χ](Subscript[φ, j])[χ]((Sin[χ])^2)\[DifferentialD]χ,{i,0,2},{j,i,2}]

Table[(∂_(χ,χ))(Subscript[φ, i])[χ]+2Cot[χ](∂_χ)(Subscript[φ, i])[χ]==-i(i+2)(Subscript[φ, i])[χ]//Simplify,{i,0,4}]

Table[-((4π)/(R^2))(∫_0^π)(Subscript[φ, i])[χ]((∂_(χ,χ))(Subscript[φ, i])[χ]+2Cot[χ](∂_χ)(Subscript[φ, i])[χ])((Sin[χ])^2)\[DifferentialD]χ,{i,0,1}]

Table[4π(∫_0^π)((((Subscript[φ, i])[χ])^2)/(2 R Sin[χ/2]))((Sin[χ])^2)\[DifferentialD]χ,{i,0,2}]

Simplify[Solve[Cx ((((1/(2(π^2)(R^3)))))^(4/3))(2(π^2)(R^3))==-(1/2)(8/(3 π R)),Cx],R>0]//N
Simplify[Solve[Cx ((((1/(2(π^2)(R^3)))))^(4/3))(2(π^2)(R^3))==-(1/2)(352/(105 π R)),Cx],R>0]//N
Simplify[Solve[Cx ((((1/(2(π^2)(R^3)))))^(4/3))(2(π^2)(R^3))==-(1/2)(13016/(3465 π R)),Cx],R>0]//N

Explicitly-correlated calculations

With[{M=10},
(Subscript[ψ, n_])[u_]=(u^(n-1));
H[R_]=Table[(∫_0^(2R))(Subscript[ψ, i])[u]((((u^2)/(4(R^2)))-1)(Subscript[ψ, j]^″)[u]+(((5u)/(4(R^2)))-(2/u))  (Subscript[ψ, j]^′)[u]+(1/u)(Subscript[ψ, j])[u])(u^2) (Sqrt[1-((u^2)/(4 (R^2)))])\[DifferentialD]u,{i,M},{j,M}];
S[R_]=Table[(∫_0^(2R))(Subscript[ψ, i])[u](Subscript[ψ, j])[u](u^2) (Sqrt[1-((u^2)/(4 (R^2)))])\[DifferentialD]u,{i,M},{j,M}];
];

With[{M=10},
(Subscript[ψ, n_])[u_]=(u^(n-1));
H1[R_]=Table[(∫_0^(2R))(Subscript[ψ, i])[u]((((u^2)/(4(R^2)))-1)(Subscript[ψ, j]^″)[u]+(((7u)/(4(R^2)))-(2/u))  (Subscript[ψ, j]^′)[u]+(1/u)(Subscript[ψ, j])[u])(u^2) (Sqrt[1-((u^2)/(4 (R^2)))])\[DifferentialD]u,{i,M},{j,M}];
];

Eig0=Table[{R,Sort[Eigenvalues[{N[H[R],100],N[S[R],100]}]][[1]]-((8/(3 π R)))},{R,{(1/10),(1/5),(1/2),1,2,5,10,20,50,100,200}}];
(*Eig1=Table[{R,Sort[Eigenvalues[{N[H1[R],100],N[S[R],100]}]][[1]]-(((16 )/(5π R)))},{R,{(1/100),(1/10),(1/5),(1/2)1,2,5,10,20,50,100,200}}];*)
Eig2=Table[{R,Sort[Eigenvalues[{N[H[R],100],N[S[R],100]}]][[2]]-((3/(R^2))+(352/(105 π R)))},{R,{(1/10),(1/5),(1/2),1,2,5,10,20,50,100,200}}];

SetAccuracy[-((Eig0[[;;,2]])/2),7]

Table[{R,Sort[Eigenvalues[{N[H[R],100],N[S[R],100]}]][[1]]-((8/(3 π R)))},{R,Table[(10^(-n)),{n,8,4,-1}]}]
Table[{R,Sort[Eigenvalues[{N[H1[R],100],N[S[R],100]}]][[1]]-(((16 )/(5π R)))},{R,Table[(10^(-n)),{n,8,4,-1}]}]
Table[{R,Sort[Eigenvalues[{N[H[R],100],N[S[R],100]}]][[2]]-((3/(R^2))+(352/(105 π R)))},{R,Table[(10^(-n)),{n,8,4,-1}]}]

D[R((a/(1+b (R^(1/2))+c R))),R]

Series[-((a (2+b (Sqrt[R])))/(2 (((1+b (Sqrt[R])+c R))^2))),{R,∞,2}]

FullSimplify[-(a/(1+b (R^(1/2))+c R))-R(D[((a/(1+b (R^(1/2))+c R))),R]),R>0]

-((a (2+b (Sqrt[R])))/(2 (((1+b (Sqrt[R])+c R))^2)))/.R->0

Plot[-((a (2+b (Sqrt[R])))/(2 (((1+b (Sqrt[R])+c R))^2)))/.{a->(4/3)-(368/(27 (π^2))),b->0.0084319438707924920205166745243636796559872314731701129528069530759156586165798732848333592836058966257280604810495`96.7485778774019,c->0.1781609005767008415699947745540530515602214317003787027240376631747390157183632426101027922253652208404793952579282`96.7485778774019},{R,0,10}]

(4/3)-(368/(27 (π^2)))//N

FindFit[Eig0,(a/(1+b (R^(1/2))+c R))/.a->-0.04763687334741862`,{b,c},R,MaxIterations->10000]
(*FindFit[Eig1,(a/(1+b (R^(1/2))+c R))/.a->-0.05656280,{b,c},R,MaxIterations->10000]*)
FindFit[Eig2,(a/(1+b (R^(1/2))+c R))/.a->-0.02892648,{b,c},R,MaxIterations->10000]

(1/2)((4/3)-(368/(27 (π^2))))//N

ϵc0[ρ_]:=Module[{R=(1/((π^(2/3)) (ρ^(1/3)))),a=-0.0238184,b=0.00843194,c=0.178161},(a/(1+b (R^(1/2))+c R))]
ϵc1[ρ_]:=Module[{R=(1/((π^(2/3)) (ρ^(1/3)))),a=-(0.0565628/2),b=0.004990714296802177`,c=0.1424228847498591`},(a/(1+b (R^(1/2))+c R))]
ϵc2[ρ_]:=Module[{R=(1/((π^(2/3)) (ρ^(1/3)))),a=-(0.0289265/2),b=-0.0738888,c=0.0710620},(a/(1+b (R^(1/2))+c R))]

Show[{Plot[{2ϵc0[(2/(2(π^2)(R^3)))],2ϵc1[(2/(2(π^2)(R^3)))],2ϵc2[(2/(2(π^2)(R^3)))]},{R,0,200},PlotRange->All],ListPlot[{Eig0,Eig1,Eig2}]}]

Asymmetric Hubbard dimer

(({{2(Subscript[v, 1])+U, -t, t, 0}, {-t, 0, 0, -t}, {t, 0, 0, t}, {0, -t, t, 2 (Subscript[v, 2])+U}}))==((Subscript[v, 1])+(Subscript[v, 2]))(({{1, 0, 0, 0}, {0, 1, 0, 0}, {0, 0, 1, 0}, {0, 0, 0, 1}}))+(({{-Δv+U, -t, t, 0}, {-t, 0, 0, -t}, {t, 0, 0, t}, {0, -t, t, Δv+U}}))/.Δv->(Subscript[v, 2])-(Subscript[v, 1])/.(Subscript[v, 2])->-(Subscript[v, 1])//Simplify

Eigenvalues[(({{-Δv/2, -t}, {-t, +Δv/2}}))]=={-(Sqrt[(t^2)+((Δv)^2)/4]),+(Sqrt[(t^2)+((Δv)^2)/4])}//Simplify

Eigenvalues[(({{-Δv+U, -t, t, 0}, {-t, 0, 0, -t}, {t, 0, 0, t}, {0, -t, t, +Δv+U}}))]//Simplify

(Subscript[ℰ, 0])[Δv_]=-2(Sqrt[(t^2)+((Δv)^2)/4]);	(Subscript[ℰ, 1])[Δv_]=0;

Simplify[Maximize[(1-w)(Subscript[ℰ, 0])[Δv]+w (Subscript[ℰ, 1])[Δv]+Δv(n-1),Δv],Assumptions->0<w<1/2&&t>0&&w<n<2-w]

U=1;t=1/2;
ν=((Δv)/(2t));	u=(U/(2t));ω=(Sqrt[3(1+(ν^2))+(u^2)]);	θ=(1/3)ArcCos[(9((ν^2)-(1/2))-(u^2))(u/(ω^3))];
(Subscript[Ε, 0])[Δv_]=((4t)/3)(u-ω Sin[θ+(π/6)]);	Δ=(((2U-(Subscript[Ε, 0])[Δv]))^2)+4(4((((((Δv)/2)))^2)+(t^2))-(U^2)+2U (Subscript[Ε, 0])[Δv]-(((Subscript[Ε, 0])[Δv])^2)); (Subscript[Ε, 1])[Δv_]=U-(((Subscript[Ε, 0])[Δv]+(Sqrt[Δ]))/2);

Clear[ν,u,ω]

Sin[((ArcCos[x])/3)+(π/6)]//TrigToExp//FullSimplify
%/.x->(9((ν^2)-(1/2))-(u^2))(u/(ω^3))//FullSimplify

(((-1))^(1/6)) (-(((-1))^(2/3)))

(1/2)((Exp[((I π)/6)]) ((((I x+(Sqrt[1-(x^2)])))^(1/3)))-Exp[((5 I π)/6)](((-I x+(Sqrt[1-(x^2)])))^(1/3)))//FullSimplify

1-(x^2)

(π/2)+ArcTan[(Sqrt[1-(x^2)]),x]//TrigToExp//FullSimplify

Plot[{Re[(((((-1))^(1/6)) (-(((-1))^(2/3))+(((I x+(Sqrt[1-(x^2)])))^(2/3))))/(2 (((I x+(Sqrt[1-(x^2)])))^(1/3))))],Re[(1/2)(-Exp[((I π)/3) ]Exp[(I/3) ArcCos[x]]-Exp[((I 5 π)/6)]Exp[(I/3) ArcSin[-x]])]},{x,0,1}]

D[(1-w)(Subscript[Ε, 0])[Δv]+w (Subscript[Ε, 1])[Δv]+Δv(n-1),Δv]//Simplify

Clear[U,t];
Eigenvalues[(({{-Δv+U, -t, t, 0}, {-t, 0, 0, -t}, {t, 0, 0, t}, {0, -t, t, +Δv+U}}))/.Δv->0]//Simplify//N

{(Subscript[Ε, 0])[Δv],(Subscript[Ε, 1])[Δv]}/.Δv->0//FullSimplify

Plot[(Subscript[Ε, 1])[1.]-(Subscript[Ε, 0])[1.],{w,0,1/2}]

(Subscript[ℰ, 0])[Δv_]=-2(Sqrt[(t^2)+((Δv)^2)/4]);	(Subscript[ℰ, 1])[Δv_]=0;

Simplify[Maximize[(1-w)(Subscript[ℰ, 0])[Δv]+w (Subscript[ℰ, 1])[Δv]+Δv(n-1),Δv],Assumptions->0<w<1/2&&t>0&&w<n<2-w]

Ringium

(Subscript[ℰ, n_])[R_]=((((n+(1/2)))^2)/(R^2))+((PolyGamma[2 n+(3/2)]-PolyGamma[(1/2)])/(π R));
{(∑_(k=0)^(M-2))((1-w)/(M-1))+w==1//Simplify,(Subscript[ℰe, w_])[R_,M_]:=(∑_(k=0)^(M-2))((1-w)/(M-1))(Subscript[ℰ, k])[R]+w (Subscript[ℰ, M-1])[R]}

Table[(∑_(k=0)^(M-2))((1-w)/(M-1))(Subscript[ℰ, k])[R]+w (Subscript[ℰ, M-1])[R]==(((M-(1/2)) (2M (w+(1/2))-(3/2)))/(3 (R^2)))+(1/(π R))((1/(M-1))(∑_(k=0)^(M-2))(∑_(m=1)^(2k+1))(1/(m-(1/2))))-(w/(π R))((1/(M-1))(∑_(k=0)^(M-2))(∑_(m=1)^(2k+1))(1/(m-(1/2)))-(∑_(m=1)^(2M-1))(1/(m-(1/2))))//FullSimplify,{M,2,10}]

2((Subscript[ℰe, 1/2])[R,2]-(Subscript[ℰe, 0])[R,2])==(Subscript[ℰ, 1])[R]-(Subscript[ℰ, 0])[R]//FullSimplify
With[{M=2},M((Subscript[ℰe, 1/M])[R,M]-(Subscript[ℰe, 1/(M-1)])[R,M-1])+(1/(M-1))(∑_(k=1)^(M-2))((Subscript[ℰ, k])[R]-(Subscript[ℰ, 0])[R])==(Subscript[ℰ, M-1])[R]-(Subscript[ℰ, 0])[R]//FullSimplify//Expand]
With[{M=3},M((Subscript[ℰe, 1/M])[R,M]-(Subscript[ℰe, 1/(M-1)])[R,M-1])+(1/(M-1))(∑_(k=1)^(M-2))((Subscript[ℰ, k])[R]-(Subscript[ℰ, 0])[R])==(Subscript[ℰ, M-1])[R]-(Subscript[ℰ, 0])[R]//FullSimplify//Expand]
With[{M=4},M((Subscript[ℰe, 1/M])[R,M]-(Subscript[ℰe, 1/(M-1)])[R,M-1])+(1/(M-1))(∑_(k=1)^(M-2))((Subscript[ℰ, k])[R]-(Subscript[ℰ, 0])[R])==(Subscript[ℰ, M-1])[R]-(Subscript[ℰ, 0])[R]//FullSimplify//Expand]

RecurrenceTable

(Subscript[Ω, M_])[R_]:=Which[M==0,0,M>0,(M+1) ((Subscript[ℰe, 1/(M+1)])[R,M+1]-(Subscript[ℰe, 1/M])[R,M])+(1/M)(∑_(k=0)^(M-1))(Subscript[Ω, k])[R]]
Table[{(Subscript[ℰ, M-1])[R]-(Subscript[ℰ, 0])[R]==(Subscript[Ω, M-1])[R]}//FullSimplify//Expand,{M,2,10}]

Table[{(Subscript[ℰ, M-1])[R]-(Subscript[ℰ, 0])[R]==(Subscript[Ω, M-1])[R]}//FullSimplify//Expand,{M,2,10}]

With[{M=2},{(Subscript[Ω, M-1])[R]==2((Subscript[ℰe, 1/2])[R,2]-(Subscript[ℰe, 1])[R,1])}//FullSimplify//Expand]
With[{M=3},{(Subscript[Ω, M-1])[R]==3((Subscript[ℰe, 1/3])[R,3]-(Subscript[ℰe, 1/2])[R,2])+((Subscript[ℰe, 1/2])[R,2]-(Subscript[ℰe, 1])[R,1])}//FullSimplify//Expand]
With[{M=4},{(Subscript[Ω, M-1])[R]==4((Subscript[ℰe, 1/4])[R,4]-(Subscript[ℰe, 1/3])[R,3])+((Subscript[ℰe, 1/3])[R,3]-(Subscript[ℰe, 1/2])[R,2])+((Subscript[ℰe, 1/2])[R,2]-(Subscript[ℰe, 1])[R,1])}//FullSimplify//Expand]
With[{M=5},{(Subscript[Ω, M-1])[R]==5((Subscript[ℰe, 1/5])[R,5]-(Subscript[ℰe, 1/4])[R,4])+((Subscript[ℰe, 1/4])[R,4]-(Subscript[ℰe, 1/3])[R,3])+((Subscript[ℰe, 1/3])[R,3]-(Subscript[ℰe, 1/2])[R,2])+((Subscript[ℰe, 1/2])[R,2]-(Subscript[ℰe, 1])[R,1])}//FullSimplify//Expand]

With[{M=2},{(Subscript[Ω, M-1])[R]==2((Subscript[ℰe, 1/2])[R,2]-(Subscript[ℰe, 1])[R,1])}//FullSimplify//Expand]
With[{M=3},{(Subscript[Ω, M-1])[R]==3(Subscript[ℰe, 1/3])[R,3]-2(Subscript[ℰe, 1/2])[R,2]-(Subscript[ℰe, 1])[R,1]}//FullSimplify//Expand]
With[{M=4},{(Subscript[Ω, M-1])[R]==4(Subscript[ℰe, 1/4])[R,4]-3(Subscript[ℰe, 1/3])[R,3]-(Subscript[ℰe, 1])[R,1]}//FullSimplify//Expand]
With[{M=5},{(Subscript[Ω, M-1])[R]==5(Subscript[ℰe, 1/5])[R,5]-4(Subscript[ℰe, 1/4])[R,4]-(Subscript[ℰe, 1])[R,1]}//FullSimplify//Expand]

(Subscript[Ω, M_])[R_]:=Which[M==0,0,M>0,(M+1)(Subscript[ℰe, 1/(M+1)])[R,M+1]-M (Subscript[ℰe, 1/M])[R,M]-(Subscript[ℰe, 1])[R,1]]
Table[{(Subscript[ℰ, M-1])[R]-(Subscript[ℰ, 0])[R]==(Subscript[Ω, M-1])[R]}//FullSimplify//Expand,{M,2,10}]

Glomium

N=(1/3)(L+1)(L+3/2)(L+2)->((L^3)/3)

((δN)/(δL))=L (L+3)+(13/6)->(L^2)

α=((L(L+3))/((((L+1)(L+3/2)(L+2)))^(2/3)))->1

((δα)/(δL))=(((2^(2/3)) (6+5 L) (9+5 L))/(3 ((((1+L) (2+L) (3+2 L)))^(5/3))))->(25/(6 (L^3)))

(Subscript[C, x])[N]

(Subscript[C, x])[w]=(1-w)(Subscript[C, x])[N]+w (Subscript[C, x])[N-δN]

N=∞

(Subscript[C, x])[w]=(1-w)(Subscript[C, x])[α=1]+w (Subscript[C, x])[N-δN]

Fx[α_]=((Subscript[C, x,0])/(Subscript[C, x,1]))+α (((Subscript[c, 0])+(Subscript[c, 1])α)/(1+((Subscript[c, 0])+(Subscript[c, 1])-1)α))/.{(Subscript[c, 0])->0.827411,(Subscript[c, 1])->-0.643560,(Subscript[C, x,0])->-(4/3)((((2/π)))^(1/3)),(Subscript[C, x,1])->-(3/2)((((3/(4π))))^(1/3))};

Fx[α]-(∂_α)Fx[α](α-1)

(∂_α)Fx[α]
%/.α->1

(16/(9 (3^(1/3))))+(((0.827411` -0.64356` α) α)/(1-0.816149` α))-(-1+α) (((0.827411` -0.64356` α)/(1-0.816149` α))-((0.64356` α)/(1-0.816149` α))+((0.816149` (0.827411` -0.64356` α) α)/(((1-0.816149` α))^2)))/.α->0.9

Plot[{Fx[α],Evaluate[Fx[α]-(∂_α)Fx[α](α-1)]},{α,0.9,1}]

D[((Subscript[C, x,0])/(Subscript[C, x,1]))+α (((Subscript[c, 0])+(Subscript[c, 1])α)/(1+((Subscript[c, 0])+(Subscript[c, 1])-1)α))(1-((Subscript[C, x,0])/(Subscript[C, x,1]))),α]//FullSimplify

δN=((δN)/(δα))δα=((3 ((((1+L) (2+L) (3+2 L)))^(5/3)) ((13/6)+L (3+L)))/((2^(2/3)) (6+5 L) (9+5 L)))δα

-((((Subscript[c, 0])+α (2-α+α (Subscript[c, 0])) (Subscript[c, 1])+(α^2) (Subscript[c, 1]^2)) ((Subscript[C, x,0])-(Subscript[C, x,1])))/((((1-α+α ((Subscript[c, 0])+(Subscript[c, 1]))))^2) (Subscript[C, x,1])))/.{C}

3-ringium

Basis

ℛ[{a_,b_,c_}]:=(1/π)((((a-1)/2)! ((b-1)/2)!((c-1)/2)! (a+b+c)!)/(((a+b)/2)! ((a+c)/2)! ((b+c)/2)!((a+b+c-1)/2)!));
(Subscript[p, i_]):=(Subscript[r, 12]^i)+(Subscript[r, 13]^i)+(Subscript[r, 23]^i)
basis=(Subscript[r, 12])(Subscript[r, 13])(Subscript[r, 23]){1,(Subscript[p, 1]),(Subscript[p, 2]),(Subscript[p, 1]^2),(Subscript[p, 2])(Subscript[p, 1]),(Subscript[p, 1]^3),(Subscript[p, 2]^2),(Subscript[p, 2])(Subscript[p, 1]^2),(Subscript[p, 1]^4),(Subscript[p, 2]^2)(Subscript[p, 1]),(Subscript[p, 2])(Subscript[p, 1]^3),(Subscript[p, 1]^5),(Subscript[p, 2]^3),(Subscript[p, 2]^2)(Subscript[p, 1]^2),(Subscript[p, 2])(Subscript[p, 1]^4),(Subscript[p, 1]^6),(Subscript[p, 2]^3)(Subscript[p, 1]),(Subscript[p, 2]^2)(Subscript[p, 1]^3),(Subscript[p, 2])(Subscript[p, 1]^5),(Subscript[p, 1]^7),(Subscript[p, 2]^4),(Subscript[p, 2]^3)(Subscript[p, 1]^2),(Subscript[p, 2]^2)(Subscript[p, 1]^4),(Subscript[p, 2])(Subscript[p, 1]^6),(Subscript[p, 1]^8),(Subscript[p, 2]^4)(Subscript[p, 1]),(Subscript[p, 2]^3)(Subscript[p, 1]^3),(Subscript[p, 2]^2)(Subscript[p, 1]^5),(Subscript[p, 2])(Subscript[p, 1]^7),(Subscript[p, 1]^9),(Subscript[p, 2]^5),(Subscript[p, 2]^4)(Subscript[p, 1]^2),(Subscript[p, 2]^3)(Subscript[p, 1]^4),(Subscript[p, 2]^2)(Subscript[p, 1]^6),(Subscript[p, 2])(Subscript[p, 1]^8),(Subscript[p, 1]^10),(Subscript[p, 2]^5)(Subscript[p, 1]),(Subscript[p, 2]^4)(Subscript[p, 1]^3),(Subscript[p, 2]^3)(Subscript[p, 1]^5),(Subscript[p, 2]^2)(Subscript[p, 1]^7),(Subscript[p, 2])(Subscript[p, 1]^9),(Subscript[p, 1]^11),(Subscript[p, 2]^6),(Subscript[p, 2]^5)(Subscript[p, 1]^2),(Subscript[p, 2]^4)(Subscript[p, 1]^4),(Subscript[p, 2]^3)(Subscript[p, 1]^6),(Subscript[p, 2]^2)(Subscript[p, 1]^8),(Subscript[p, 2])(Subscript[p, 1]^10),(Subscript[p, 1]^12),(Subscript[p, 2]^6)(Subscript[p, 1]),(Subscript[p, 2]^5)(Subscript[p, 1]^3),(Subscript[p, 2]^4)(Subscript[p, 1]^5),(Subscript[p, 2]^3)(Subscript[p, 1]^7),(Subscript[p, 2]^2)(Subscript[p, 1]^9),(Subscript[p, 2])(Subscript[p, 1]^11),(Subscript[p, 1]^13),(Subscript[p, 2]^7),(Subscript[p, 2]^6)(Subscript[p, 1]^2),(Subscript[p, 2]^5)(Subscript[p, 1]^4),(Subscript[p, 2]^4)(Subscript[p, 1]^6),(Subscript[p, 2]^3)(Subscript[p, 1]^8),(Subscript[p, 2]^2)(Subscript[p, 1]^10),(Subscript[p, 2])(Subscript[p, 1]^12),(Subscript[p, 1]^14),(Subscript[p, 2]^7)(Subscript[p, 1]),(Subscript[p, 2]^6)(Subscript[p, 1]^3),(Subscript[p, 2]^5)(Subscript[p, 1]^5),(Subscript[p, 2]^4)(Subscript[p, 1]^7),(Subscript[p, 2]^3)(Subscript[p, 1]^9),(Subscript[p, 2]^2)(Subscript[p, 1]^11),(Subscript[p, 2])(Subscript[p, 1]^13),(Subscript[p, 1]^15),(Subscript[p, 2]^8),(Subscript[p, 2]^7)(Subscript[p, 1]^2),(Subscript[p, 2]^6)(Subscript[p, 1]^4),(Subscript[p, 2]^5)(Subscript[p, 1]^6),(Subscript[p, 2]^4)(Subscript[p, 1]^8),(Subscript[p, 2]^3)(Subscript[p, 1]^10),(Subscript[p, 2]^2)(Subscript[p, 1]^12),(Subscript[p, 2])(Subscript[p, 1]^14),(Subscript[p, 1]^16),(Subscript[p, 2]^8)(Subscript[p, 1]),(Subscript[p, 2]^7)(Subscript[p, 1]^3),(Subscript[p, 2]^6)(Subscript[p, 1]^5),(Subscript[p, 2]^5)(Subscript[p, 1]^7),(Subscript[p, 2]^4)(Subscript[p, 1]^9),(Subscript[p, 2]^3)(Subscript[p, 1]^11),(Subscript[p, 2]^2)(Subscript[p, 1]^13),(Subscript[p, 2])(Subscript[p, 1]^15),(Subscript[p, 1]^17)};
(Subscript[ψ, i_]):=basis[[i]]
bl=Length[basis];

Matrices

Overlap

S=Table[
t=CoefficientRules[(Subscript[ψ, i])(Subscript[ψ, j])//Expand,{(Subscript[r, 12]),(Subscript[r, 13]),(Subscript[r, 23])}];
Simplify[(∑_(i=1)^(Length[t]))t[[i]][[2]]ℛ[t[[i]][[1]]]]
,{i,bl},{j,i}];
S=Table[
If[j≤i,
S[[i]][[j]],
S[[j]][[i]]
],{i,bl},{j,bl}];
S//MatrixForm

Kinetic

T=Table[
t=CoefficientRules[(Subscript[ψ, i])((((Subscript[r, 12]^2)/4)-1)(∂_((Subscript[r, 12]),(Subscript[r, 12])))(Subscript[ψ, j])+(((Subscript[r, 13]^2)/4)-1)(∂_((Subscript[r, 13]),(Subscript[r, 13])))(Subscript[ψ, j])+(((Subscript[r, 23]^2)/4)-1)(∂_((Subscript[r, 23]),(Subscript[r, 23])))(Subscript[ψ, j])+ ((Subscript[r, 12])/4)(∂_(Subscript[r, 12]))(Subscript[ψ, j])+ ((Subscript[r, 13])/4)(∂_(Subscript[r, 13]))(Subscript[ψ, j])+ ((Subscript[r, 23])/4)(∂_(Subscript[r, 23]))(Subscript[ψ, j])+((((Subscript[r, 12]) (Subscript[r, 13]))/(4 ))-(( (Subscript[r, 12]^2)+(Subscript[r, 13]^2)- (Subscript[r, 23]^2))/(2 (Subscript[r, 12]) (Subscript[r, 13]))))(∂_((Subscript[r, 12]),(Subscript[r, 13])))(Subscript[ψ, j])+((((Subscript[r, 12]) (Subscript[r, 23]))/(4  ))-(( (Subscript[r, 12]^2)+(Subscript[r, 23]^2)- (Subscript[r, 13]^2))/(2 (Subscript[r, 12]) (Subscript[r, 23]))))(∂_((Subscript[r, 12]),(Subscript[r, 23])))(Subscript[ψ, j])+((((Subscript[r, 13]) (Subscript[r, 23]))/(4  ))-(( (Subscript[r, 13]^2)+(Subscript[r, 23]^2)- (Subscript[r, 12]^2))/(2 (Subscript[r, 13]) (Subscript[r, 23]))))(∂_((Subscript[r, 13]),(Subscript[r, 23])))(Subscript[ψ, j]))//Expand,{(Subscript[r, 12]),(Subscript[r, 13]),(Subscript[r, 23])}];
Simplify[(∑_(i=1)^(Length[t]))t[[i]][[2]]ℛ[t[[i]][[1]]]]
,{i,bl},{j,i}];
T=Table[
If[j≤i,
T[[i]][[j]],
T[[j]][[i]]
],{i,bl},{j,bl}];
T//MatrixForm

Potential

V=Table[
t=CoefficientRules[(Subscript[ψ, i])((1/(Subscript[r, 12]))+(1/(Subscript[r, 13]))+(1/(Subscript[r, 23])))(Subscript[ψ, j])//Expand,{(Subscript[r, 12]),(Subscript[r, 13]),(Subscript[r, 23])}];
Simplify[(∑_(i=1)^(Length[t]))t[[i]][[2]]ℛ[t[[i]][[1]]]]
,{i,bl},{j,i}];
V=Table[
If[j≤i,
V[[i]][[j]],
V[[j]][[i]]
],{i,bl},{j,bl}];
V//MatrixForm

Energy of 3-ringium

Ec3=Table[
{R,(Last[Eigenvalues[N[{(T/(R^2))+(V/R),S},100]]]-((1/(R^2))+(20/(3π R))))},{R,{(10^(-4)),(1/10),(2/10),(5/10),1,2,5,10,20,50,100}}]

Table[(a/(1+b (Sqrt[R])+c R))/.a->(16/3)-(1436/(27 (π^2)))/.pEc3,{R,{(10^(-4)),(1/10),(2/10),(5/10),1,2,5,10,20,50,100}}]

pEc3=FindFit[Ec3,(a/(1+b (Sqrt[R])+c R))/.a->(16/3)-(1436/(27 (π^2))),{b,c},R,MaxIterations->10000]

Plot[(a/(1+b (Sqrt[R])+c R))/.a->(16/3)-(1436/(27 (π^2)))/.pEc3,{R,0,100},PlotRange->All]

Spherium-Hubbard

(({{2 (Subscript[T, 1])+(Subscript[U, 11]), -t, t, 0}, {-t, (Subscript[T, 1])+(Subscript[T, 2])+(Subscript[U, 12]), 0, -t}, {t, 0, (Subscript[T, 1])+(Subscript[T, 2])+(Subscript[U, 12]), t}, {0, -t, t, 2 (Subscript[T, 2])+(Subscript[U, 22])}}))==((Subscript[T, 1])+(Subscript[T, 2]))(({{1, 0, 0, 0}, {0, 1, 0, 0}, {0, 0, 1, 0}, {0, 0, 0, 1}}))+(({{-ΔT+(Subscript[U, 11]), -t, t, 0}, {-t, (Subscript[U, 12]), 0, -t}, {t, 0, (Subscript[U, 12]), t}, {0, -t, t, ΔT+(Subscript[U, 22])}}))/.ΔT->(Subscript[T, 2])-(Subscript[T, 1])//Simplify

r=Eigenvalues[(({{(Subscript[Ε, 1]), -t, t, 0}, {-t, (Subscript[Ε, 12]), 0, -t}, {t, 0, (Subscript[Ε, 12]), t}, {0, -t, t, (Subscript[Ε, 2])}}))];

Plot[Evaluate[{r[[1]],r[[2]],r[[3]],r[[4]]}/.{(Subscript[Ε, 1])->0.852781065,(Subscript[Ε, 12])->0.483724447,(Subscript[Ε, 2])->0.391958796}],{t,0,1/2},PlotLegends->Automatic]

Plot[((1-λ)/λ),{λ,0,1}]

FullSimplify[Solve[{((R2-R1)/(R1+R2))==U,R2-R1==Δv},{R1,R2}],U>0&&Δv>0]

SphHub[λ_,U_,t_,M_]:=Module[{H,WP,L,R1,R2,K,V,V12,T,O,E1,E12,E2,C1,C12,C2,E,C},
WP=15;	L=1;	R2=R2-R1;	R1=λ R2;	
K=DiagonalMatrix[Table[((ℓ(ℓ+1))/2),{ℓ,0,M-1}]];
V=Table[(Sqrt[(2(Subscript[ℓ, 1])+1)(2(Subscript[ℓ, 2])+1)])(∑_((Subscript[ℓ, 3])=Abs[(Subscript[ℓ, 1])-(Subscript[ℓ, 2])])^((Subscript[ℓ, 1])+(Subscript[ℓ, 2])))((ThreeJSymbol[{(Subscript[ℓ, 1]),0},{(Subscript[ℓ, 2]),0},{(Subscript[ℓ, 3]),0}])^2),{(Subscript[ℓ, 1]),0, M-1},{(Subscript[ℓ, 2]),0,M-1}];
V12=Table[(Sqrt[(2(Subscript[ℓ, 1])+1)(2(Subscript[ℓ, 2])+1)])(∑_((Subscript[ℓ, 3])=Abs[(Subscript[ℓ, 1])-(Subscript[ℓ, 2])])^((Subscript[ℓ, 1])+(Subscript[ℓ, 2])))(((Min[R1,R2])^(Subscript[ℓ, 3]))/((Max[R2,R1])^((Subscript[ℓ, 3])+1)))((ThreeJSymbol[{(Subscript[ℓ, 1]),0},{(Subscript[ℓ, 2]),0},{(Subscript[ℓ, 3]),0}])^2),{(Subscript[ℓ, 1]),0, M-1},{(Subscript[ℓ, 2]),0,M-1}];
{E1,C1}=SortEigensystem[Eigensystem[N[((2K)/(R1^2))+(V/R1),WP]]];
{E12,C12}=SortEigensystem[Eigensystem[N[((1/(R1^2))+(1/(R2^2)))K+V12,WP]]];
{E2,C2}=SortEigensystem[Eigensystem[N[((2K)/(R2^2))+(V/R2),WP]]];
E1=DiagonalMatrix[E1[[1;;L]]];	E12=DiagonalMatrix[E12[[1;;L]]];	E2=DiagonalMatrix[E2[[1;;L]]];
T=Table[t,L,L];	O=Table[0,L,L];
{E,C}=SortEigensystem[Eigensystem[ArrayFlatten[(({{E1-E12, -T, T, O}, {-T, O, O, -T}, {T, O, O, T}, {O, -T, T, E2-E12}}))]]];
Return[E];
];

tab12=Table[Flatten[{t,SphHub[1/4,1,t,10]}],{t,0,1,1/10}];
tab11=Table[Flatten[{t,SphHub[1/3,1,t,10]}],{t,0,1,1/10}];
tab21=Table[Flatten[{t,SphHub[1/2,1,t,10]}],{t,0,1,1/10}];
{ListPlot[Table[tab12[[;;,{1,k}]],{k,2,5}],Joined->True,AspectRatio->1,ImageSize->Medium],
ListPlot[Table[tab11[[;;,{1,k}]],{k,2,5}],Joined->True,AspectRatio->1,ImageSize->Medium],ListPlot[Table[tab21[[;;,{1,k}]],{k,2,5}],Joined->True,AspectRatio->1,ImageSize->Medium]}

tab=Table[Flatten[{λ,SphHub[λ,10,1/2,10]}],{λ,1,10,1}];
ListPlot[Table[tab[[;;,{1,k}]],{k,2,2}],Joined->True,AspectRatio->1,ImageSize->Medium]

1D energy program

Loading integrals

TabERI=Import["~/Dropbox/Manuscripts/eDFT_FUEG/Integrals/Hookium_ERI.dat"];
ERI=SparseArray[
Join[
Table[{TabERI[[k,2]],TabERI[[k,3]],TabERI[[k,4]],TabERI[[k,5]]}->TabERI[[k,1]],{k,Length[TabERI]}],
Table[{TabERI[[k,3]],TabERI[[k,2]],TabERI[[k,4]],TabERI[[k,5]]}->TabERI[[k,1]],{k,Length[TabERI]}],
Table[{TabERI[[k,2]],TabERI[[k,3]],TabERI[[k,5]],TabERI[[k,4]]}->TabERI[[k,1]],{k,Length[TabERI]}],
Table[{TabERI[[k,3]],TabERI[[k,2]],TabERI[[k,5]],TabERI[[k,4]]}->TabERI[[k,1]],{k,Length[TabERI]}],
Table[{TabERI[[k,4]],TabERI[[k,5]],TabERI[[k,2]],TabERI[[k,3]]}->TabERI[[k,1]],{k,Length[TabERI]}],
Table[{TabERI[[k,5]],TabERI[[k,4]],TabERI[[k,2]],TabERI[[k,3]]}->TabERI[[k,1]],{k,Length[TabERI]}],
Table[{TabERI[[k,4]],TabERI[[k,5]],TabERI[[k,3]],TabERI[[k,2]]}->TabERI[[k,1]],{k,Length[TabERI]}],
Table[{TabERI[[k,5]],TabERI[[k,4]],TabERI[[k,3]],TabERI[[k,2]]}->TabERI[[k,1]],{k,Length[TabERI]}]
]
];
ERIH=ERI;

TabERI=Import["~/Dropbox/Manuscripts/eDFT_FUEG/Integrals/Boxium_ERI.dat"];
ERI=SparseArray[
Join[
Table[{TabERI[[k,2]],TabERI[[k,3]],TabERI[[k,4]],TabERI[[k,5]]}->TabERI[[k,1]],{k,Length[TabERI]}],
Table[{TabERI[[k,3]],TabERI[[k,2]],TabERI[[k,4]],TabERI[[k,5]]}->TabERI[[k,1]],{k,Length[TabERI]}],
Table[{TabERI[[k,2]],TabERI[[k,3]],TabERI[[k,5]],TabERI[[k,4]]}->TabERI[[k,1]],{k,Length[TabERI]}],
Table[{TabERI[[k,3]],TabERI[[k,2]],TabERI[[k,5]],TabERI[[k,4]]}->TabERI[[k,1]],{k,Length[TabERI]}],
Table[{TabERI[[k,4]],TabERI[[k,5]],TabERI[[k,2]],TabERI[[k,3]]}->TabERI[[k,1]],{k,Length[TabERI]}],
Table[{TabERI[[k,5]],TabERI[[k,4]],TabERI[[k,2]],TabERI[[k,3]]}->TabERI[[k,1]],{k,Length[TabERI]}],
Table[{TabERI[[k,4]],TabERI[[k,5]],TabERI[[k,3]],TabERI[[k,2]]}->TabERI[[k,1]],{k,Length[TabERI]}],
Table[{TabERI[[k,5]],TabERI[[k,4]],TabERI[[k,3]],TabERI[[k,2]]}->TabERI[[k,1]],{k,Length[TabERI]}]
]
];
ERIB=ERI;

DIIS

DIIS[ℱ_,ℰ_]:=Module[{maxDIIS,nDIIS,B,x,w,F,WP},
maxDIIS=5;
WP=30;
nDIIS=Min[maxDIIS,Length[ℰ]];
B=Table[
Which[
i≤nDIIS∧j≤nDIIS,Tr[ℰ[[i]].ℰ[[j]]\[Transpose]],
i≤nDIIS∧j==nDIIS+1,-1,
i==nDIIS+1∧j≤nDIIS,-1,
i==nDIIS+1∨j==nDIIS+1,0
]
,{i,1,nDIIS+1},{j,1,nDIIS+1}];
x=Table[If[k≤nDIIS,0,-1],{k,1,nDIIS+1}];
w=LinearSolve[N[B,WP],N[x,WP]];
F=(∑_(k=1)^nDIIS)w[[k]]ℱ[[k]];
Return[F];
];

EnergyTableOG[2,8 π,{0,0},"boxium",30,30]

EnergyTableOG[2,8 π,{1/3,1/3},"boxium",30,30]

Optical gap module

Functionals

(* LDA correlation *)
ϵcLDA[n_]:=LDA[(1/(2n))];
dϵcLDA[n_]:=Evaluate[(∂_n)ϵcLDA[n]];
dvcLDA[n_]:=Evaluate[(∂_(n,n))(n ϵcLDA[n])];

(* Hartree-exchange functionals *)
(*ϵOGHx0[ρ_]=ρ;	ϵOGHx1[ρ_]=((4 ρ)/3);	ϵOGHx2[ρ_]=((23 ρ)/15);	
ϵOGHx[ρ_,{w1_,w2_}]=(1-w1-w2)ϵOGHx0[ρ]+w1 ϵOGHx1[ρ]+w2 ϵOGHx2[ρ];
dϵOGHx[ρ_,{w1_,w2_}]=Evaluate[(∂_ρ)ϵOGHx[ρ,{w1,w2}]];
dϵOGHxdw1[ρ_,{w1_,w2_}]=Evaluate[(∂_w1)ϵOGHx[ρ,{w1,w2}]];
dϵOGHxdw2[ρ_,{w1_,w2_}]=Evaluate[(∂_w2)ϵOGHx[ρ,{w1,w2}]];*)

(* Hxc functional *)
(*ϵOGHxc0[ρ_]=ϵOGHx0[ρ]+ϵOGc0[ρ];
ϵOGHxc1[ρ_]=ϵOGHx1[ρ]+ϵOGc1[ρ];
ϵOGHxc2[ρ_]=ϵOGHx2[ρ]+ϵOGc2[ρ];	
ϵOGHxc[ρ_,{w1_,w2_}]=ϵOGHx[ρ,{w1,w2}]+ϵOGc[ρ,{w1,w2}];
dϵOGHxc[ρ_,{w1_,w2_}]=Evaluate[(∂_ρ)ϵOGHxc[ρ,{w1,w2}]];
dvOGHxc[ρ_,{w1_,w2_}]=Evaluate[(∂_(ρ,ρ))(ρ ϵOGHxc[ρ,{w1,w2}])];
dϵOGHxcdw1[ρ_,{w1_,w2_}]=Evaluate[(∂_w1)ϵOGHxc[ρ,{w1,w2}]];
dϵOGHxcdw2[ρ_,{w1_,w2_}]=Evaluate[(∂_w2)ϵOGHxc[ρ,{w1,w2}]];*)

(* Hartree-exchange GIC functionals *)
ϵHx[n_,{w1_,w2_}]=n( (2Log[2]-(1/3)) w1(w1-1)+(8/3) w1 w2+(32/15) w2(w2-1));
dϵHxdn[n_,{w1_,w2_}]=Evaluate[(∂_n)ϵHx[n,{w1,w2}]];
dϵHxdw1[n_,{w1_,w2_}]=Evaluate[(∂_w1)ϵHx[n,{w1,w2}]];
dϵHxdw2[n_,{w1_,w2_}]=Evaluate[(∂_w2)ϵHx[n,{w1,w2}]];
dvHxdn[n_,{w1_,w2_}]=Evaluate[(∂_(n,n))(n ϵHx[n,{w1,w2}])];


(* Correlation functional *)
ϵc0[n_]=Module[{a=-((π^2)/720),b=0.0955321,c=0.236166,R=(1/(π n))},(a/(1+b (Sqrt[R])+c R))];
ϵc1[n_]=Module[{a=-0.0238184,b=0.00732275,c=0.178646,R=(1/(π n))},(a/(1+b (Sqrt[R])+c R))];ϵc2[n_]=Module[{a=(184/315)-(20662952/(3472875 (π^2))),b=-0.0464270,c=0.105760,R=(1/(π n))},(a/(1+b (Sqrt[R])+c R))];

(* LDA-centered functionals *)
ϵc0[n_]=ϵc0[n]+ϵcLDA[n]-ϵc0[n];
ϵc1[n_]=ϵc1[n]+ϵcLDA[n]-ϵc0[n];
ϵc2[n_]=ϵc2[n]+ϵcLDA[n]-ϵc0[n];

ϵc[n_,{w1_,w2_}]=(1-w1-w2)ϵc0[n]+w1 ϵc1[n]+w2 ϵc2[n];
dϵcdn[n_,{w1_,w2_}]=Evaluate[(∂_n)ϵc[n,{w1,w2}]];
dϵcdw1[n_,{w1_,w2_}]=Evaluate[(∂_w1)ϵc[n,{w1,w2}]];
dϵcdw2[n_,{w1_,w2_}]=Evaluate[(∂_w2)ϵc[n,{w1,w2}]];
dvcdn[n_,{w1_,w2_}]=Evaluate[(∂_(n,n))(n ϵc[n,{w1,w2}])];

ϵHxc[n_,{w1_,w2_}]=ϵHx[n,{w1,w2}]+ϵc[n,{w1,w2}];
dϵHxcdn[n_,{w1_,w2_}]=Evaluate[(∂_n)ϵHxc[n,{w1,w2}]];
dϵHxcdw1[n_,{w1_,w2_}]=Evaluate[(∂_w1)ϵHxc[n,{w1,w2}]];
dϵHxcdw2[n_,{w1_,w2_}]=Evaluate[(∂_w2)ϵHxc[n,{w1,w2}]];
dvHxcdn[n_,{w1_,w2_}]=Evaluate[(∂_(n,n))(n ϵHxc[n,{w1,w2}])];

HF module

OptGapHF[Atom_,n_,M_,L_,w_]:=Module[
{Boundary,maxSCF,thresh,H,ERI,c,Conv,nSCF,Fw,P0,P1,P2,Pw,ϵ,HLGap,EwK,EwHx,Ew,E,E0,E1,E2,Ω,O,EcMP2d,EcMP2x,A,B,X,ω,Z,TD,TDA},

(* Parameters *)
maxSCF=128;	thresh=(10^(-7));
TD=True;	TDA=False;
(* Check weight conditions *)
If[!(0≤w[[1]]≤1/3&&w[[2]]≤w[[1]]≤(1-w[[2]])/2),Print["Weights are inconsistent!!"]];

(* Define basis functions & other stuff *)
Which[Atom=="boxium",(Boundary=L/2;
					ϕ=Table[If[OddQ[m],(Sqrt[2/L])Cos[m ((π x)/L)],(Sqrt[2/L])Sin[m ((π x)/L)]],{m,M}];
					H=((((π/L)))^2)DiagonalMatrix[Table[(m^2)/2,{m,M}]];	    
					ERI=Take[((π/L))ERIB ,{1,M},{1,M},{1,M},{1,M}]),
	Atom=="hookium",(Boundary=∞;
					ϕ=Table[((L^(-1/2))/(Sqrt[(π^(1/2)) (2^(m-1))Γ[m]]))HermiteH[m-1,(L^(-1)) x]Exp[-(L^(-2)) (x^2)/2],{m,M}];		
					H=DiagonalMatrix[Table[m-(1/2),{m,M}]];					
					ERI= L Take[ERIH,{1,M},{1,M},{1,M},{1,M}])];
(* Antysymmetrize two-electron integrals *)
O=ERI;
ERI=Flatten[ERI,{{1},{2},{3,4}}]-Flatten[ERI,{{1},{4},{3,2}}];

(* Guess coefficients *)
c=Table[(Subscript[δ, i-j]),{i,M},{j,M}];	Conv=1;	nSCF=0;

(* Starting SCF loop *)
While[Conv>thresh∧nSCF<maxSCF,	
	
(* Compute density matrices *)
P0=c[[1;;n]]\[Transpose].c[[1;;n]];																	 ρ0=ϕ.P0.ϕ;
P1=If[n>1,c[[1;;n-1]]\[Transpose].c[[1;;n-1]],0]+If[M>n+1,c[[n+1;;n+1]]\[Transpose].c[[n+1;;n+1]],0];	ρ1=ϕ.P1.ϕ;
P2=If[n>2,c[[1;;n-2]]\[Transpose].c[[1;;n-2]],0]+If[M>n+2,c[[n+1;;n+2]]\[Transpose].c[[n+1;;n+2]],0];	ρ2=ϕ.P2.ϕ;
Pw=(1-w[[1]]-w[[2]])P0+w[[1]]P1+w[[2]]P2;													  ρw=ϕ.Pw.ϕ;
	
(* Compute Fock matrix *)
Fw=H+ERI.Flatten[Pw];
	
(* Diagonalize Fock matrix *)
c=SetPrecision[Chop[Reverse[Eigenvectors[Fw]]],15];
Conv=Max[Abs[Pw.Fw-Fw.Pw]];	nSCF++;

(* Check for convergence *)
If[nSCF==128,Print["SCF has not converged!!"]];

(* Compute energies *)
EwK=Tr[Pw.H];	EwHx=((Tr[Pw.ERI.Flatten[Pw]])/2);

];
Ew=EwK+EwHx;

(* Compute HOMO-LUMO gap *)
ϵ=Reverse[Eigenvalues[Fw]];	HLGap=If[M>n,ϵ[[n+1]]-ϵ[[n]],0];
{ϵ,c}=Chop[SortEigensystem[Eigensystem[Fw]]];

(* Compute energies for cation, neutral and anion *) 
{E0,E1,E2}={Tr[P0.H],Tr[P1.H],Tr[P2.H]}+(1/2){Tr[P0.ERI.Flatten[P0]],Tr[P1.ERI.Flatten[P1]],Tr[P2.ERI.Flatten[P2]]};
(* Individual energies *)
E={E0,E1,E2};

(* Excitation energies *)
Ω=E[[2;;3]]-E[[1]];

(* Ao to MO transformation *)
If[TD,
ERI=c.Transpose[c.O.c\[Transpose],{3,1,4,2}].c\[Transpose];

(* MP2 energy *)
(*EcMP2d=(∑_(i=1)^n)(∑_(j=1)^n)(∑_(a=n+1)^M)(∑_(b=n+1)^M)((ERI[[i,j,a,b]]ERI[[a,b,i,j]])/(ϵ[[i]]+ϵ[[j]]-ϵ[[a]]-ϵ[[b]]));	EcMP2x=(∑_(i=1)^n)(∑_(j=1)^n)(∑_(a=n+1)^M)(∑_(b=n+1)^M)((ERI[[i,j,a,b]]ERI[[a,b,j,i]])/(ϵ[[i]]+ϵ[[j]]-ϵ[[a]]-ϵ[[b]]));
Print["MP2 correlation energy: (Subscript[E, c]^MP2)=",Chop[EcMP2d-EcMP2x]];*)

A=Table[(ϵ[[a]]-ϵ[[i]])(Subscript[δ, a,b])(Subscript[δ, i,j])+ERI[[i,b,a,j]]-ERI[[i,b,j,a]],{i,n},{a,n+1,M},{j,n},{b,n+1,M}];

If[TDA,
B=Table[0,{i,n},{a,n+1,M},{j,n},{b,n+1,M}],
B=Table[ERI[[i,j,a,b]]-ERI[[i,j,b,a]],{i,n},{a,n+1,M},{j,n},{b,n+1,M}]
];
A=Flatten[A,{{1,2},{3,4}}];	B=Flatten[B,{{1,2},{3,4}}];	X=MatrixPower[A-B,(1/2)];
Z=Eigenvectors[X.(A+B).X];	ω=Eigenvalues[X.(A+B).X];
Print[Reverse[Take[(Sqrt[ω]),-10]]];
(*Print[TableForm[Reverse[Take[DiagonalMatrix[(ω^(-1/2))].X.Z,-5]]//Chop,TableHeadings->{None,Flatten[Table[{i,a},{i,n},{a,n+1,M}],{1,2}]}]];*)
];
(* Return useful stuff *)
Return[{Ew,EwK,EwHx,nSCF,Conv,HLGap,E,Ω}];
];

EnergyTableHF[n_,L_,w_,Atom_,Mbeg_,Mend_]:=Module[{Ew,EwK,EwHx,nSCF,Conv,HLGap,E,Ω},
TableForm[Table[({Ew,EwK,EwHx,nSCF,Conv,HLGap,E,Ω}=OptGapHF[Atom,n,M,L,w];
				{"HF",n,M,L,NumberForm[w,3],NumberForm[Ew,{6,4}],NumberForm[EwK,{6,4}],NumberForm[EwHx,{6,4}],nSCF,NumberForm[Conv,{2,1}],NumberForm[HLGap,{6,4}],NumberForm[E,{6,4}],NumberForm[Ω,{6,4}]}),{M,Mbeg,Mend}],
TableHeadings->{None,{"HF","n","M","L","w","(E^w)","(Subscript[E, K]^w)","(Subscript[E, Hx]^w)","(Subscript[N, SCF])","Conv","HL Gap","(Subscript[E, I])","(Subscript[Ω, I])"}},TableAlignments->Center]]

KS-LDA module

KSLDA[Atom_,n_,M_,L_,w_]:=Module[
{ϕ,ϕϕ,nQ,rQ,wQ,Boundary,maxSCF,thresh,H,ERI,c,Conv,nSCF,Fw,P0,P1,P2,Pw,ρ0,ρ1,ρ2,ρw,vc,vHxc,ϵ,HLGap,EwK,EwHx,EwHxc,Ewc,Ew,E,E0,E1,E2,Δxc,ΔLZ,Ω,O,A,B,X,ω,Z,e,ℱ,ℰ,WP,W,dvc,ibaj,ijab,TDA},

(* Parameters *)
maxSCF=128;	thresh=(10^(-7));	nQ=51;	ℱ={};	ℰ={};	WP=30;

(* Check weight conditions *)
If[!(0≤w[[1]]≤1/3&&w[[2]]≤w[[1]]≤(1-w[[2]])/2),Print["Weights are inconsistent!!"]];

(* Define basis functions & other stuff *)
Which[Atom=="boxium",(Boundary=L/2;
					ϕ=Table[If[OddQ[m],(Sqrt[2/L])Cos[m ((π x)/L)],(Sqrt[2/L])Sin[m ((π x)/L)]],{m,M}];
					H=((((π/L)))^2)DiagonalMatrix[Table[(m^2)/2,{m,M}]];	    
					ERI=Take[((π/L))ERIB ,{1,M},{1,M},{1,M},{1,M}]),
	Atom=="hookium",(Boundary=∞;
					ϕ=Table[((L^(-1/2))/(Sqrt[(π^(1/2)) (2^(m-1))Γ[m]]))HermiteH[m-1,(L^(-1)) x]Exp[-(L^(-2)) (x^2)/2],{m,M}];		
					H=DiagonalMatrix[Table[m-(1/2),{m,M}]];					
					ERI= L Take[ERIH,{1,M},{1,M},{1,M},{1,M}])];
(* Antysymmetrize two-electron integrals *)
O=ERI;
ERI=Flatten[ERI,{{1},{2},{3,4}}]-Flatten[ERI,{{1},{4},{3,2}}];

(* Set up quadrature *)
{rQ,wQ}=Transpose[GaussianQuadratureWeights[nQ,-Boundary,Boundary,WP]];

(* Compute values of basis functions at grid points *)
ϕϕ=Table[wQ[[k]]ReplaceAll[ϕ[[i]]ϕ[[j]],x-> rQ[[k]]],{k,nQ},{i,M},{j,M}];

(* Guess coefficients *)
c=Table[(Subscript[δ, i-j]),{i,M},{j,M}];	Conv=1;	nSCF=0;

(* Starting SCF loop *)
While[Conv>thresh∧nSCF<maxSCF,	
	
(* Compute density matrices *)
P0=c[[1;;n]]\[Transpose].c[[1;;n]];																	 ρ0=ϕ.P0.ϕ;
P1=If[n>1,c[[1;;n-1]]\[Transpose].c[[1;;n-1]],0]+If[M>n+1,c[[n+1;;n+1]]\[Transpose].c[[n+1;;n+1]],0];	ρ1=ϕ.P1.ϕ;
P2=If[n>2,c[[1;;n-2]]\[Transpose].c[[1;;n-2]],0]+If[M>n+2,c[[n+1;;n+2]]\[Transpose].c[[n+1;;n+2]],0];	ρ2=ϕ.P2.ϕ;
Pw=(1-w[[1]]-w[[2]])P0+w[[1]]P1+w[[2]]P2;													  ρw=ϕ.Pw.ϕ;
	
(* Compute Fock matrix *)
vc=Table[ϵcLDA[ReplaceAll[ρw,x->rQ[[k]]]]+ dϵcLDA[ReplaceAll[ρw,x->rQ[[k]]]ReplaceAll[ρw,x->rQ[[k]]]],{k,nQ}];
Fw=H+ERI.Flatten[Pw]+vc.ϕϕ;

(* DIIS section *)
e=Pw.Fw-Fw.Pw;	ℱ=Prepend[ℱ,Fw];	ℰ=Prepend[ℰ,e];	Fw=DIIS[ℱ,ℰ];

(* Diagonalize Fock matrix *)
c=SetPrecision[Chop[Reverse[Eigenvectors[Fw]]],WP];
Conv=Max[Abs[e]];	nSCF++;

];	
(* Check for convergence *)
If[nSCF==128,Print["SCF has not converged!!"]];

(* Compute energies *)
EwK=Tr[Pw.H];
Ewc=Chop[NIntegrate[ϵcLDA[ρw]ρw ,{x,-Boundary,Boundary}]];
EwHx=((Tr[Pw.ERI.Flatten[Pw]])/2);	EwHxc=EwHx+Ewc;	Ew=EwK+EwHxc;

(* Compute HOMO-LUMO gap *)
ϵ=Reverse[Eigenvalues[Fw]];	HLGap=If[M>n,ϵ[[n+1]]-ϵ[[n]],0];
{ϵ,c}=Chop[SortEigensystem[Eigensystem[Fw]]];

(* Compute energies for cation, neutral and anion *) 
{E0,E1,E2}={Tr[P0.H],Tr[P1.H],Tr[P2.H]}+
(1/2){Tr[P0.ERI.Flatten[P0]],Tr[P1.ERI.Flatten[P1]],Tr[P2.ERI.Flatten[P2]]}+Chop[NIntegrate[(ϵcLDA[ρw]+dϵcLDA[ρw]ρw){ρ0,ρ1,ρ2},{x,-Boundary,Boundary}]];

(* Levy-Zahariev shift *)
ΔLZ=-Chop[NIntegrate[dϵcLDA[ρw]((ρw)^2),{x,-Boundary,Boundary}]];

(* Individual energies *)
E={E0,E1,E2}+ΔLZ;

(* Excitation energies *)
Ω=E[[2;;3]]-E[[1]];

(* Ao to MO transformation *)
ERI=c.Transpose[c.O.c\[Transpose],{3,1,4,2}].c\[Transpose];

(* TD-LDA calculation *)
dvc=Table[dvcLDA[ReplaceAll[ρw,x->rQ[[k]]]],{k,nQ}];
ibaj=Table[wQ[[k]]ReplaceAll[ϕ[[i]]ϕ[[b]]ϕ[[a]]ϕ[[j]],x-> rQ[[k]]],{k,nQ},{i,n},{a,n+1,M},{j,n},{b,n+1,M}];

A=Table[(ϵ[[a]]-ϵ[[i]])(Subscript[δ, a,b])(Subscript[δ, i,j])+ERI[[i,b,a,j]]-ERI[[i,b,j,a]],{i,n},{a,n+1,M},{j,n},{b,n+1,M}]+dvc.ibaj;

TDA=True;
If[TDA,
B=Table[0,{i,n},{a,n+1,M},{j,n},{b,n+1,M}],(ijab=Table[wQ[[k]]ReplaceAll[ϕ[[i]]ϕ[[j]]ϕ[[a]]ϕ[[b]],x-> rQ[[k]]],{k,nQ},{i,n},{a,n+1,M},{j,n},{b,n+1,M}];
B=Table[ERI[[i,j,a,b]]-ERI[[i,j,b,a]],{i,n},{a,n+1,M},{j,n},{b,n+1,M}]+dvc.ijab)
];

A=Flatten[A,{{1,2},{3,4}}];	B=Flatten[B,{{1,2},{3,4}}];	X=MatrixPower[A-B,(1/2)];
Z=Eigenvectors[X.(A+B).X];	ω=Eigenvalues[X.(A+B).X];
Print[Reverse[Take[(Sqrt[ω]),-10]]];

(* Return useful stuff *)
Return[{Ew,EwK,EwHx,Ewc,EwHxc,nSCF,Conv,HLGap,E,ΔLZ,Ω}];
];

EnergyTableKS[n_,L_,w_,Atom_,Mbeg_,Mend_]:=Module[{Ew,EwK,EwHx,Ewc,EwHxc,nSCF,Conv,HLGap,E,ΔLZ,Ω},
TableForm[Table[({Ew,EwK,EwHx,Ewc,EwHxc,nSCF,Conv,HLGap,E,ΔLZ,Ω}=KSLDA[Atom,n,M,L,w];
				{"KS-LDA",n,M,L,NumberForm[w,3],NumberForm[Ew,{6,4}],NumberForm[EwK,{6,4}],NumberForm[EwHx,{6,4}],NumberForm[Ewc,{6,4}],NumberForm[EwHxc,{6,4}],nSCF,NumberForm[Conv,{2,1}],NumberForm[HLGap,{6,4}],NumberForm[E,{6,4}],NumberForm[Ω,{6,4}],NumberForm[ΔLZ,{9,6}]}),{M,Mbeg,Mend}],
TableHeadings->{None,{"KS-LDA","n","M","L","w","(E^w)","(Subscript[E, K]^w)","(Subscript[E, Hx]^w)","(Subscript[E, c]^w)","(Subscript[E, Hxc]^w)","(Subscript[N, SCF])","Conv","HL Gap","(Subscript[E, I])","(Subscript[Ω, I])","(Subscript[Δ, I]^LZ)"}},TableAlignments->Center]]

eDFT module (with old Hxc)

(*OptGap[Atom_,n_,M_,L_,w_]:=Module[
{DoHxc,ϕ,ϕϕ,nQ,rQ,wQ,Boundary,maxSCF,thresh,H,ERI,c,Conv,nSCF,F0,F1,F2,Fw,P0,P1,P2,Pw,ρ0,ρ1,ρ2,ρw,vc,vc0,vc1,vc2,vHxc,ϵ,HLGap,EwK,EwHx,EwHxc,Ewc,Ew,E,E0,E1,E2,Δxc,ΔLZ,Ω,O,A,B,X,ω,Z,e,e0,e1,e2,ℱ,ℰ,WP,W,dvc,ibaj,ijab,TD,TDA,ΩTD},

(* Parameters *)
DoHxc=False;	maxSCF=128;	thresh=(10^(-7));	nQ=51;	ℱ={};	ℰ={};	WP=30;
TD=False;	TDA=False;

(* Check weight conditions *)
(*If[!(0≤w[[1]]≤1/3&&w[[2]]≤w[[1]]≤(1-w[[2]])/2),Print["Weights are inconsistent!!"]];*)

(* Define basis functions & other stuff *)
Which[Atom=="boxium",(Boundary=L/2;
					ϕ=Table[If[OddQ[m],(Sqrt[2/L])Cos[m ((π x)/L)],(Sqrt[2/L])Sin[m ((π x)/L)]],{m,M}];
					H=((((π/L)))^2)DiagonalMatrix[Table[(m^2)/2,{m,M}]];	    
					ERI=Take[((π/L))ERIB ,{1,M},{1,M},{1,M},{1,M}]),
	Atom=="hookium",(Boundary=∞;
					ϕ=Table[((L^(-1/2))/(Sqrt[(π^(1/2)) (2^(m-1))Γ[m]]))HermiteH[m-1,(L^(-1)) x]Exp[-(L^(-2)) (x^2)/2],{m,M}];		
					H=DiagonalMatrix[Table[m-(1/2),{m,M}]];					
					ERI= L Take[ERIH,{1,M},{1,M},{1,M},{1,M}])];
(* Antysymmetrize two-electron integrals *)
O=ERI;
ERI=Flatten[ERI,{{1},{2},{3,4}}]-Flatten[ERI,{{1},{4},{3,2}}];

(* Set up quadrature *)
{rQ,wQ}=Transpose[GaussianQuadratureWeights[nQ,-Boundary,Boundary,WP]];

(* Compute values of basis functions at grid points *)
ϕϕ=Table[wQ[[k]]ReplaceAll[ϕ[[i]]ϕ[[j]],x-> rQ[[k]]],{k,nQ},{i,M},{j,M}];

(* Guess coefficients *)
c=Table[(Subscript[δ, i-j]),{i,M},{j,M}];	Conv=1;	nSCF=0;

(* Starting SCF loop *)
While[Conv>thresh∧nSCF<maxSCF,	
	
(* Compute density matrices *)
P0=c[[1;;n]]\[Transpose].c[[1;;n]];																	 ρ0=ϕ.P0.ϕ;
P1=If[n>1,c[[1;;n-1]]\[Transpose].c[[1;;n-1]],0]+If[M>n+1,c[[n+1;;n+1]]\[Transpose].c[[n+1;;n+1]],0];	ρ1=ϕ.P1.ϕ;
P2=If[n>2,c[[1;;n-2]]\[Transpose].c[[1;;n-2]],0]+If[M>n+2,c[[n+1;;n+2]]\[Transpose].c[[n+1;;n+2]],0];	ρ2=ϕ.P2.ϕ;
Pw=(1-w[[1]]-w[[2]])P0+w[[1]]P1+w[[2]]P2;													  ρw=ϕ.Pw.ϕ;
	
(* Compute Fock matrices for Hxc or c-only *)
If[DoHxc,
(
vHxc=Table[ϵOGHxc[ReplaceAll[ρw,x->rQ[[k]]],w]+dϵOGHxc[ReplaceAll[ρw,x->rQ[[k]]]ReplaceAll[ρw,x->rQ[[k]]],w],{k,nQ}];
Fw=H+vHxc.ϕϕ;
)
,
(
vc=Table[ϵOGc[ReplaceAll[ρw,x->rQ[[k]]],w]+ dϵOGc[ReplaceAll[ρw,x->rQ[[k]]]ReplaceAll[ρw,x->rQ[[k]]],w],{k,nQ}];
Fw=H+ERI.Flatten[Pw]+vc.ϕϕ;
)
];

(* DIIS section *)
e=Pw.Fw-Fw.Pw;
ℱ=Prepend[ℱ,Fw];	ℰ=Prepend[ℰ,e];	Fw=DIIS[ℱ,ℰ];

(* Diagonalize Fock matrix *)
c=SetPrecision[Chop[Reverse[Eigenvectors[Fw]]],WP];
Conv=Max[Abs[e]];	nSCF++;

];	
(* Check for convergence *)
If[nSCF==maxSCF,Print["SCF has not converged!!"]];

(* Compute energies *)
EwK=Tr[Pw.H];
Ewc=Chop[NIntegrate[ϵOGc[ρw,w]ρw ,{x,-Boundary,Boundary}]];
If[DoHxc,	
(
EwHxc=Chop[NIntegrate[ϵOGHxc[ρw,w]ρw,{x,-Boundary,Boundary}]];	EwHx=EwHxc-Ewc;
),
(
EwHx=((Tr[Pw.ERI.Flatten[Pw]])/2);	EwHxc=EwHx+Ewc;
)
];
Ew=EwK+EwHxc;

(* Compute HOMO-LUMO gap *)
ϵ=Reverse[Eigenvalues[Fw]];	HLGap=If[M>n,ϵ[[n+1]]-ϵ[[n]],0];
{ϵ,c}=Chop[SortEigensystem[Eigensystem[Fw]]];

(* Compute energies for cation, neutral and anion *) 
{E0,E1,E2}={Tr[P0.H],Tr[P1.H],Tr[P2.H]}+
If[DoHxc,	
Chop[NIntegrate[(ϵOGHxc[ρw,w]+dϵOGHxc[ρw,w]ρw){ρ0,ρ1,ρ2},{x,-Boundary,Boundary}]]
,
(1/2){Tr[P0.ERI.Flatten[P0]],Tr[P1.ERI.Flatten[P1]],Tr[P2.ERI.Flatten[P2]]}+Chop[NIntegrate[(ϵOGc[ρw,w]+dϵOGc[ρw,w]ρw){ρ0,ρ1,ρ2},{x,-Boundary,Boundary}]]
];

(* Levy-Zahariev shift *)
ΔLZ=-Chop[
If[DoHxc,
NIntegrate[dϵOGHxc[ρw,w]((ρw)^2),{x,-Boundary,Boundary}],
NIntegrate[dϵOGc[ρw,w]((ρw)^2),{x,-Boundary,Boundary}]
]
];

(* Derivative discontinuities *)
Δxc=Chop[
If[DoHxc,
	NIntegrate[ {dϵOGHxcdw1[ρw,{w[[1]],w[[2]]}],dϵOGHxcdw2[ρw,{w[[1]],w[[2]]}]}ρw,{x,-Boundary,Boundary}]
	,
	NIntegrate[ {dϵOGcdw1[ρw,{w[[1]],w[[2]]}],dϵOGcdw2[ρw,{w[[1]],w[[2]]}]}ρw,{x,-Boundary,Boundary}]
]
];
Δxc={-w [[1]]Δxc[[1]]-w[[2]]Δxc[[2]],(1-w[[1]])Δxc[[1]] -w[[2]]Δxc[[2]],-w[[1]]Δxc[[1]]+(1-w[[2]])Δxc[[2]]};

(* Individual energies *)
E={E0,E1,E2}+ΔLZ+Δxc;

(* Excitation energies *)
Ω=E[[2;;3]]-E[[1]];

(* TD-LDA calculation *)
If[TD,

(* AO to MO transformation *)
ERI=c.Transpose[c.O.c\[Transpose],{3,1,4,2}].c\[Transpose];

(* Casida equations *)
dvc=Table[dvOGc[ReplaceAll[ρw,x->rQ[[k]]],w],{k,nQ}];
ibaj=Table[wQ[[k]]ReplaceAll[ϕ[[i]]ϕ[[b]]ϕ[[a]]ϕ[[j]],x-> rQ[[k]]],{k,nQ},{i,n},{a,n+1,M},{j,n},{b,n+1,M}];
A=Table[(ϵ[[a]]-ϵ[[i]])(Subscript[δ, a,b])(Subscript[δ, i,j])+ERI[[i,b,a,j]]-ERI[[i,b,j,a]],{i,n},{a,n+1,M},{j,n},{b,n+1,M}]+dvc.ibaj;

If[TDA,
B=Table[0,{i,n},{a,n+1,M},{j,n},{b,n+1,M}]
,
(
ijab=Table[wQ[[k]]ReplaceAll[ϕ[[i]]ϕ[[j]]ϕ[[a]]ϕ[[b]],x-> rQ[[k]]],{k,nQ},{i,n},{a,n+1,M},{j,n},{b,n+1,M}];
B=Table[ERI[[i,j,a,b]]-ERI[[i,j,b,a]],{i,n},{a,n+1,M},{j,n},{b,n+1,M}]+dvc.ijab
)
];

A=Flatten[A,{{1,2},{3,4}}];	B=Flatten[B,{{1,2},{3,4}}];	X=MatrixPower[A-B,(1/2)];
Z=Eigenvectors[X.(A+B).X];	ω=Eigenvalues[X.(A+B).X];
ΩTD=Reverse[Take[(Sqrt[ω]),-3]];
];
(* Export densities *)

{nw,n0,n1,n2}={ρw,ρ0,ρ1,ρ2};

(* Return useful stuff *)
Return[{DoHxc,Ew,EwK,EwHx,Ewc,EwHxc,nSCF,Conv,HLGap,E,Δxc,ΔLZ,Ω,ΩTD}];
];*)

(*EnergyTableOG[n_,L_,w_,Atom_,Mbeg_,Mend_]:=Module[{DoHxc,Ew,EwK,EwHx,Ewc,EwHxc,nSCF,Conv,HLGap,E,Δxc,ΔLZ,Ω,ΩTD},
TableForm[Table[({DoHxc,Ew,EwK,EwHx,Ewc,EwHxc,nSCF,Conv,HLGap,E,Δxc,ΔLZ,Ω,ΩTD}=OptGap[Atom,n,M,L,w];
				{If[DoHxc,"Hxc","c"],n,M,L,NumberForm[w,3],NumberForm[Ew,{6,4}],NumberForm[EwK,{6,4}],NumberForm[EwHx,{6,4}],NumberForm[Ewc,{6,4}],NumberForm[EwHxc,{6,4}],nSCF,NumberForm[Conv,{2,1}],NumberForm[HLGap,{6,4}],NumberForm[E,{6,4}],NumberForm[Ω,{6,4}],NumberForm[Δxc,{6,4}],NumberForm[ΔLZ,{9,6}],NumberForm[ΩTD,{6,4}]}),{M,Mbeg,Mend}],
TableHeadings->{None,{"eDFA","n","M","L","w","(E^w)","(Subscript[E, K]^w)","(Subscript[E, Hx]^w)","(Subscript[E, c]^w)","(Subscript[E, Hxc]^w)","(Subscript[N, SCF])","Conv","HL Gap","(E^((I)))","(Ω^((I)))","(Subscript[Δ, xc]^((I)))","(Subscript[Δ, LZ])","(Subscript[Ω, TD])"}},TableAlignments->Center]]*)

eDFT module

OptGap[Atom_,n_,M_,L_,w_,TD_:False,TDA_:False]:=Module[
{ϕ,ϕϕ,nQ,rQ,wQ,Boundary,maxSCF,thresh,h,G,c,Conv,nSCF,F0,F1,F2,Fw,Γ0,Γ1,Γ2,Γw,n0,n1,n2,nw,vc,ϵ,HLGap,EwK,EwHx,EwHxc,Ewc,Ew,EwHxGIC,EwHxcGIC,EwGIC,E,E0,E1,E2,ΔDD,Ω,O,A,B,X,ω,Z,e,e0,e1,e2,ℱ,ℰ,WP,W,dvc,ibaj,ijab,ΩTD},

(* Parameters *)
maxSCF=32;	thresh=(10^(-5));	nQ=51;	ℱ={};	ℰ={};	WP=30;

(* Check weight conditions *)
If[!(0≤w[[1]]≤1/3&&w[[2]]≤w[[1]]≤(1-w[[2]])/2),Print["Weights are inconsistent!!"]];

(* Define basis functions & other stuff *)
Which[Atom=="boxium",(Boundary=L/2;
					ϕ=Table[If[OddQ[m],(Sqrt[2/L])Cos[m ((π x)/L)],(Sqrt[2/L])Sin[m ((π x)/L)]],{m,M}];
					h=((((π/L)))^2)DiagonalMatrix[Table[(m^2)/2,{m,M}]];	    
					G=Take[((π/L))ERIB ,{1,M},{1,M},{1,M},{1,M}]),
	Atom=="hookium",(Boundary=∞;
					ϕ=Table[((L^(-1/2))/(Sqrt[(π^(1/2)) (2^(m-1))Γ[m]]))HermiteH[m-1,(L^(-1)) x]Exp[-(L^(-2)) (x^2)/2],{m,M}];		
					h=DiagonalMatrix[Table[m-(1/2),{m,M}]];					
					G= L Take[ERIH,{1,M},{1,M},{1,M},{1,M}])];
(* Anti-symmetrize two-electron integrals *)
O=G;
G=Flatten[G,{{1},{2},{3,4}}]-Flatten[G,{{1},{4},{3,2}}];

(* Set up quadrature *)
{rQ,wQ}=Transpose[GaussianQuadratureWeights[nQ,-Boundary,Boundary,WP]];

(* Compute values of basis functions at grid points *)
ϕϕ=Table[wQ[[k]]ReplaceAll[ϕ[[i]]ϕ[[j]],x-> rQ[[k]]],{k,nQ},{i,M},{j,M}];

(* Guess coefficients *)
c=Table[(Subscript[δ, i-j]),{i,M},{j,M}];	Conv=1;	nSCF=0;

(* Starting SCF loop *)
While[Conv>thresh∧nSCF<maxSCF,	
	
(* Compute density matrices *)
Γ0=c[[1;;n]]\[Transpose].c[[1;;n]];																	 n0=ϕ.Γ0.ϕ;
Γ1=If[n>1,c[[1;;n-1]]\[Transpose].c[[1;;n-1]],0]+If[M≥n+1,c[[n+1;;n+1]]\[Transpose].c[[n+1;;n+1]],0];	n1=ϕ.Γ1.ϕ;
Γ2=If[n>2,c[[1;;n-2]]\[Transpose].c[[1;;n-2]],0]+If[M≥n+2,c[[n+1;;n+2]]\[Transpose].c[[n+1;;n+2]],0];	n2=ϕ.Γ2.ϕ;
Γw=(1-w[[1]]-w[[2]])Γ0+w[[1]]Γ1+w[[2]]Γ2;													  nw=ϕ.Γw.ϕ;
	
(* Compute Fock matrices *)
vc=Table[ϵc[ReplaceAll[nw,x->rQ[[k]]],w]+ dϵcdn[ReplaceAll[nw,x->rQ[[k]]]ReplaceAll[nw,x->rQ[[k]]],w],{k,nQ}];

Fw=h+G.Flatten[Γw]+vc.ϕϕ;

(* DIIS section *)
e=Γw.Fw-Fw.Γw;

ℱ=Prepend[ℱ,Fw];	ℰ=Prepend[ℰ,e];	Fw=DIIS[ℱ,ℰ];

(* Diagonalize Fock matrix *)
c=SetPrecision[Chop[Reverse[Eigenvectors[Fw]]],WP];
Conv=Max[Abs[e]];	nSCF++;
(*Print[Conv];*)

];	
(* Check for convergence *)
If[nSCF==maxSCF,Print["SCF has not converged!!"]];

(* Compute energies *)
EwK=Tr[Γw.h];
Ewc=Chop[NIntegrate[ϵc[nw,w]nw ,{x,-Boundary,Boundary}]];

EwHx=(1/2)Tr[Γw.G.Flatten[Γw]];
EwHxc=EwHx+Ewc;	Ew=EwK+EwHxc;	

(* GIC energies *)
EwHxGIC=(1/2)(1-w[[1]]-w[[2]])Tr[Γ0.G.Flatten[Γ0]]+(1/2)w[[1]]Tr[Γ1.G.Flatten[Γ1]]+(1/2)w[[2]]Tr[Γ2.G.Flatten[Γ2]];
EwHxcGIC=EwHxGIC+Ewc;	EwGIC=EwK+EwHxGIC+Ewc;

(* Compute HOMO-LUMO gap *)
ϵ=Reverse[Eigenvalues[Fw]];	HLGap=If[M>n,ϵ[[n+1]]-ϵ[[n]],0];
{ϵ,c}=Chop[SortEigensystem[Eigensystem[Fw]]];

(* Compute energies for ground and excited states *) 
{E0,E1,E2}={Tr[Γ0.h],Tr[Γ1.h],Tr[Γ2.h]}
+(1/2){Tr[Γ0.G.Flatten[Γ0]],Tr[Γ1.G.Flatten[Γ1]],Tr[Γ2.G.Flatten[Γ2]]}
+Chop[NIntegrate[(ϵc[nw,w]+dϵcdn[nw,w]nw){n0,n1,n2}-dϵcdn[nw,w](nw^2),{x,-Boundary,Boundary}]];

(* Derivative discontinuities *)
ΔDD=Chop[NIntegrate[ {dϵcdw1[nw,{w[[1]],w[[2]]}],dϵcdw2[nw,{w[[1]],w[[2]]}]}nw,{x,-Boundary,Boundary}]];
ΔDD={-w [[1]]ΔDD[[1]]-w[[2]]ΔDD[[2]],(1-w[[1]])ΔDD[[1]] -w[[2]]ΔDD[[2]],-w[[1]]ΔDD[[1]]+(1-w[[2]])ΔDD[[2]]};

(* Individual energies *)
E={E0,E1,E2}+ΔDD;

(* Excitation energies *)
Ω=E[[2;;3]]-E[[1]];

(* TD-LDA calculation *)
If[TD,

(* AO to MO transformation *)
G=c.Transpose[c.O.c\[Transpose],{3,1,4,2}].c\[Transpose];

(* Casida equations *)
dvc=Table[dvcdn[ReplaceAll[nw,x->rQ[[k]]],w],{k,nQ}];
ibaj=Table[wQ[[k]]ReplaceAll[ϕ[[i]]ϕ[[b]]ϕ[[a]]ϕ[[j]],x-> rQ[[k]]],{k,nQ},{i,n},{a,n+1,M},{j,n},{b,n+1,M}];
A=Table[(ϵ[[a]]-ϵ[[i]])(Subscript[δ, a,b])(Subscript[δ, i,j])+G[[i,b,a,j]]-G[[i,b,j,a]],{i,n},{a,n+1,M},{j,n},{b,n+1,M}]+dvc.ibaj;

If[TDA,
B=Table[0,{i,n},{a,n+1,M},{j,n},{b,n+1,M}]
,
(
ijab=Table[wQ[[k]]ReplaceAll[ϕ[[i]]ϕ[[j]]ϕ[[a]]ϕ[[b]],x-> rQ[[k]]],{k,nQ},{i,n},{a,n+1,M},{j,n},{b,n+1,M}];
B=Table[G[[i,j,a,b]]-G[[i,j,b,a]],{i,n},{a,n+1,M},{j,n},{b,n+1,M}]+dvc.ijab
)
];

A=Flatten[A,{{1,2},{3,4}}];	B=Flatten[B,{{1,2},{3,4}}];	X=MatrixPower[A-B,(1/2)];
Z=Eigenvectors[X.(A+B).X];	ω=Eigenvalues[X.(A+B).X];
ΩTD=Reverse[Take[(Sqrt[ω]),-3]];
];

(* Export densities *)
{ρw,ρ0,ρ1,ρ2}={nw,n0,n1,n2};

(* Return useful stuff *)
Return[{Ew,EwGIC,EwK,EwHx,EwHxGIC,Ewc,EwHxc,EwHxcGIC,nSCF,Conv,HLGap,E,ΔDD,Ω,ΩTD}];
]

EnergyTableOG[n_,L_,w_,Atom_,Mbeg_,Mend_]:=Module[{Ew,EwGIC,EwK,EwHx,EwHxGIC,Ewc,EwHxc,EwHxcGIC,nSCF,Conv,HLGap,E,ΔDD,Ω,ΩTD},
TableForm[Table[({Ew,EwGIC,EwK,EwHx,EwHxGIC,Ewc,EwHxc,EwHxcGIC,nSCF,Conv,HLGap,E,ΔDD,Ω,ΩTD}=OptGap[Atom,n,M,L,w];
				{"eLDA",n,M,L,NumberForm[TableForm[w],3],NumberForm[Ew,{6,4}],NumberForm[EwGIC,{6,4}],NumberForm[EwK,{6,4}],NumberForm[EwHx,{6,4}],NumberForm[EwHxGIC,{6,4}],NumberForm[Ewc,{6,4}],NumberForm[EwHxc,{6,4}],NumberForm[EwHxcGIC,{6,4}],nSCF,NumberForm[Conv,{2,1}],NumberForm[HLGap,{6,4}],NumberForm[TableForm[E],{6,4}],NumberForm[TableForm[Ω],{6,4}],NumberForm[TableForm[ΔDD],{6,4}],NumberForm[TableForm[ΩTD],{6,4}]}),{M,Mbeg,Mend}],
TableHeadings->{None,{"eDFA","n","M","L","w","(E^w)","(E^w)(GIC)","(Subscript[E, K]^w)","(Subscript[E, Hx]^w)","(Subscript[E, Hx]^w)(GIC)","(Subscript[E, c]^w)","(Subscript[E, Hxc]^w)","(Subscript[E, Hxc]^w)(GIC)","(Subscript[N, SCF])","Conv","HL Gap","(E^((I)))","(Ω^((I)))","(Subscript[Δ, DD]^((I)))","(Subscript[Ω, TD])"}},TableAlignments->Center]]

Fundamental gap module

(* LDA correlation *)
ϵcLDA[n_]:=LDA[(1/(2n))];

(* Hx funtionals *)
(*ϵFGHxCation[ρ_]=0;	ϵFGHxNeutral[ρ_]=ρ;	ϵFGHxAnion[ρ_]=((40 ρ)/27);
ϵFGHx[ρ_,{w1_,w2_}]=w1 ϵFGHxCation[ρ]+(1-(1/2)w1-(3/2)w2)ϵFGHxNeutral[ρ]+w2 ϵFGHxAnion[ρ];
dϵFGHx[ρ_,{w1_,w2_}]=Evaluate[(∂_ρ)ϵFGHx[ρ,{w1,w2}]];*)

(* c functionals *)
ϵFGcCation[n_]:=0;
ϵFGcNeutral[n_]:=Module[{a=-((π^2)/720),b=0.100373,c=0.234991,R=(2/(2π n))},(a/(1+b (Sqrt[R])+c R))];
ϵFGcAnion[n_]:=Module[{a=(16/9)-(1436/(81 (π^2))),b=0.025432,c=0.187703,R=(3/(2 π n))},(a/(1+b (Sqrt[R])+c R))];

(* LDA-shifted functionals *)
ϵFGcCation[n_]=ϵFGcCation[n]+ϵcLDA[n]-ϵFGcNeutral[n];
ϵFGcNeutral[n_]=ϵFGcNeutral[n]+ϵcLDA[n]-ϵFGcNeutral[n];
ϵFGcAnion[n_]=ϵFGcAnion[n]+ϵcLDA[n]-ϵFGcNeutral[n];

ϵFGc[n_,{w1_,w2_}]:=w1 ϵFGcCation[n]+(1-(1/2)w1-(3/2)w2)ϵFGcNeutral[n]+w2 ϵFGcAnion[n];
dϵFGcdn[n_,{w1_,w2_}]:=Evaluate[(∂_n)ϵFGc[n,{w1,w2}]];

(* Hxc functionals *)
(*ϵFGHxcCation[ρ_]=ϵFGHxCation[ρ]+ϵFGcCation[ρ];
ϵFGHxcNeutral[ρ_]=ϵFGHxNeutral[ρ]+ϵFGcNeutral[ρ];
ϵFGHxcAnion[ρ_]=ϵFGHxAnion[ρ]+ϵFGcAnion[ρ];
ϵFGHxc[ρ_,{w1_,w2_}]=ϵFGHx[ρ,{w1,w2}]+ϵFGc[ρ,{w1,w2}];
dϵFGHxc[ρ_,{w1_,w2_}]=Evaluate[(∂_ρ)ϵFGHxc[ρ,{w1,w2}]];*)

FundGap[Atom_,n_,M_,L_,w_]:=Module[{ϕ,ϕϕ,nQ,rQ,wQ,Boundary,maxSCF,thresh,h,G,c,Conv,nSCF,Fw,Γcat,Γneu,Γani,Γw,ncat,nneu,nani,nw,vc,ϵ,HLGap,Ew,EwGIC,EwK,EwHx,EwHxGIC,EwHxc,EwHxcGIC,Ewc,E,Ecat,Eneu,Eani,ΔDD,IP,EA,Gap},

(* Check weight conditions *)
If[!(w[[1]]≥0&&w[[2]]≥0&&(n-1)w[[1]]+(n+1)w[[2]]≤n),Print["Weights are inconsistent!!"]];

(* Parameters *)
maxSCF=32;	thresh=(10^(-5));	nQ=51;	

(* Define basis functions & other stuff *)
Which[Atom=="boxium",(Boundary=L/2;
					ϕ=Table[If[OddQ[m],(Sqrt[2/L])Cos[m ((π x)/L)],(Sqrt[2/L])Sin[m ((π x)/L)]],{m,M}];
					h=((((π/L)))^2)DiagonalMatrix[Table[(m^2)/2,{m,M}]];	    
					G=Take[((π/L))ERIB ,{1,M},{1,M},{1,M},{1,M}]),
	Atom=="hookium",(Boundary=∞;
					ϕ=Table[((L^(-1/2))/(Sqrt[(π^(1/2)) (2^(m-1))Γ[m]]))HermiteH[m-1,(L^(-1)) x]Exp[-(L^(-2)) (x^2)/2],{m,M}];		
					h=DiagonalMatrix[Table[m-(1/2),{m,M}]];					
					G= L Take[ERIH,{1,M},{1,M},{1,M},{1,M}])];
(* Antysymmetrize two-electron integrals *)
G=Flatten[G,{{1},{2},{3,4}}]-Flatten[G,{{1},{4},{3,2}}];

(* Set up quadrature *)
{rQ,wQ}=Transpose[GaussianQuadratureWeights[nQ,-Boundary,Boundary,15]];

(* Compute values of basis functions at grid points *)
ϕϕ=Table[wQ[[k]]ReplaceAll[ϕ[[i]]ϕ[[j]],x-> rQ[[k]]],{k,nQ},{i,M},{j,M}];

(* Guess coefficients *)
c=Table[(Subscript[δ, i-j]),{i,M},{j,M}];	Conv=1;	nSCF=0;

(* Starting SCF loop *)
While[Conv>thresh∧nSCF<maxSCF,	
	
	(* Compute density matrices and densities for cation, neutral and anion *)
	Γcat=c[[1;;n-1]]\[Transpose].c[[1;;n-1]];	 ncat=ϕ.Γcat.ϕ;
	Γneu=c[[1;;n]]\[Transpose].c[[1;;n]];		    nneu=ϕ.Γneu.ϕ;
	Γani=c[[1;;n+1]]\[Transpose].c[[1;;n+1]];	nani=ϕ.Γani.ϕ;
									  	

	Γw=w[[1]] Γcat+(1-((n-1)/n)w[[1]]-((n+1)/n)w[[2]])Γneu+w[[2]] Γani;	nw=ϕ.Γw.ϕ;
	
	(* Compute Fock matrices for Hxc or c-only *)
	vc=Table[ϵFGc[ReplaceAll[nw,x->rQ[[k]]],w]+dϵFGcdn[ReplaceAll[nw,x->rQ[[k]]],w]ReplaceAll[nw,x->rQ[[k]]],{k,nQ}];
	Fw=h+G.Flatten[Γw]+vc.ϕϕ;

	(* Diagonalize Fock matrix *)
	c=SetPrecision[Chop[Reverse[Eigenvectors[Fw]]],15];
	Conv=Max[Abs[Γw.Fw-Fw.Γw]];	nSCF++;
];
(* Check for convergence *)
If[nSCF==maxSCF,Print["SCF has not converged!!"]];

(* Compute energies *)
EwK=Tr[Γw.h];
Ewc=Chop[NIntegrate[ϵFGc[nw,w]nw,{x,-Boundary,Boundary}]];
EwHx=((Tr[Γw.G.Flatten[Γw]])/2);	EwHxc=EwHx+Ewc;
Ew=EwK+EwHxc;

(* GIC energies *)
EwHxGIC=(1/2)w[[1]]Tr[Γcat.G.Flatten[Γcat]]+(1/2)(1-((n-1)/n)w[[1]]-((n+1)/n)w[[2]])Tr[Γneu.G.Flatten[Γneu]]+(1/2)w[[2]]Tr[Γani.G.Flatten[Γani]];
EwHxcGIC=EwHxGIC+Ewc;	EwGIC=EwK+EwHxGIC+Ewc;

(* Compute HOMO-LUMO gap *)
ϵ=Reverse[Eigenvalues[Fw]];	HLGap=If[M>n,ϵ[[n+1]]-ϵ[[n]],0];

(* Compute energies for cation, neutral and anion *) 
{Ecat,Eneu,Eani}={Tr[Γcat.h],Tr[Γneu.h],Tr[Γani.h]}+(1/2){Tr[Γcat.G.Flatten[Γcat]],Tr[Γneu.G.Flatten[Γneu]],Tr[Γani.G.Flatten[Γani]]}+Chop[NIntegrate[(ϵFGc[nw,w]+dϵFGcdn[nw,w]nw){ncat,nneu,nani}-dϵFGcdn[nw,w]{((n-1)/n),1,((n+1)/n)}(nw^2),{x,-Boundary,Boundary}]];

(* Derivative discontinuities *)
ΔDD=Chop[NIntegrate[({ϵFGc[nw,{1,0}],ϵFGc[nw,{0,1}]}-ϵFGc[nw,{0,0}])nw,{x,-Boundary,Boundary}]];
ΔDD={(1-((n-1)/n)w[[1]])ΔDD[[1]]-((n-1)/n)w[[2]],-w[[1]]ΔDD[[1]]-w[[2]]ΔDD[[2]],-((n+1)/n)w[[1]]+(1-((n+1)/n)w[[2]])ΔDD[[2]]};

(* Ensemble energies *)
E={Ecat,Eneu,Eani}+ΔDD;

(* IP, EA and band gap *)
IP=E[[1]]-E[[2]];	EA=E[[2]]-E[[3]];	Gap=IP-EA;

(* Return useful stuff *)
Return[{Ew,EwGIC,EwK,EwHx,EwHxGIC,Ewc,EwHxc,EwHxcGIC,nSCF,Conv,HLGap,E,ΔDD,{IP,EA,Gap}}];	
];

EnergyTableFG[n_,L_,w_,Atom_,Mbeg_,Mend_]:=Module[{Ew,EwGIC,EwK,EwHx,EwHxGIC,Ewc,EwHxc,EwHxcGIC,nSCF,Conv,HLGap,E,ΔDD,IP,EA,Gap},
TableForm[Table[({Ew,EwGIC,EwK,EwHx,EwHxGIC,Ewc,EwHxc,EwHxcGIC,nSCF,Conv,HLGap,E,ΔDD,{IP,EA,Gap}}=FundGap[Atom,n,M,L,w];
				{"eLDA",n,M,L,NumberForm[w,3],NumberForm[Ew,{6,4}],NumberForm[EwGIC,{6,4}],NumberForm[EwK,{6,4}],NumberForm[EwHx,{6,4}],NumberForm[EwHxGIC,{6,4}],NumberForm[Ewc,{6,4}],NumberForm[EwHxc,{6,4}],NumberForm[EwHxcGIC,{6,4}],nSCF,NumberForm[Conv,{2,1}],NumberForm[HLGap,{6,4}],NumberForm[TableForm[E],{6,4}],NumberForm[TableForm[{IP,EA,Gap}],{6,4}],NumberForm[ΔDD,{6,4}]}),{M,Mbeg,Mend}],
TableHeadings->{None,{"eDFA","n","M","L","w","(E^w)","(E^w)(GIC)","(Subscript[E, K]^w)","(Subscript[E, Hx]^w)","(Subscript[E, Hx]^w)(GIC)","(Subscript[E, c]^w)","(Subscript[E, Hxc]^w)","(Subscript[E, Hxc]^w)(GIC)","(Subscript[N, SCF])","Conv","HL Gap","(E^((I)))","IP,EA,Gap","(Subscript[Δ, xc]^((I)))","(Subscript[Δ, LZ]^((I)))"}},TableAlignments->Center]]

EnergyTableFG[2,π,{1/3,1/3},"boxium",30,30]

1D results

Optical gap

Ensemble energy wrt weight

SizeLegend=3;
SizeTitle=3;
SizeLabel=3;

OptionsEvsw={
AspectRatio->3/4,
PlotMarkers->{"OpenMarkers",Large},
Frame->True,
FrameStyle->Directive[Thick,26],
ImageSize->Large,
Joined->True,
PlotRange->All,
PlotStyle->{{Black,Thick},{Black,Thick,Dashed},{Red,Thick},{Red,Thick,Dashed}}
};

EnergyTableOG[2,π,{0,0},"boxium",30,30]

EnergyTableOG[2,π,{1/2,0},"boxium",30,30]

EnergyTableOG[2,π,{0,1/2},"boxium",30,30]

Ew1n5Lπ8=Table[Flatten[{w1,OptGap["boxium",5,30,π/8,{w1,0}][[1;;2]]}],{w1,0,1/3,1/27}];
Ew1n5Lπ=Table[Flatten[{w1,OptGap["boxium",5,30,π,{w1,0}][[1;;2]]}],{w1,0,1/3,1/27}];
Ew1n5L8π=Table[Flatten[{w1,OptGap["boxium",5,30,8π,{w1,0}][[1;;2]]}],{w1,0,1/3,1/27}];

Ew2n5Lπ8=Table[Flatten[{w2,OptGap["boxium",5,30,π/8,{1/3,w2}][[1;;2]]}],{w2,0,1/3,1/27}];
Ew2n5Lπ=Table[Flatten[{w2,OptGap["boxium",5,30,π,{1/3,w2}][[1;;2]]}],{w2,0,1/3,1/27}];
Ew2n5L8π=Table[Flatten[{w2,OptGap["boxium",5,30,8π,{1/3,w2}][[1;;2]]}],{w2,0,1/3,1/27}];

Grid[{{
ListPlot[{Ew1n5Lπ8[[;;,{1,2}]],Ew1n5Lπ8[[;;,{1,3}]],Ew2n5Lπ8[[;;,{1,2}]],Ew2n5Lπ8[[;;,{1,3}]]},
OptionsEvsw,PlotLabel->MaTeX["\\text{$N = 5$ and $L = \\pi/8$}",Magnification->SizeTitle],
FrameLabel->{
MaTeX["\\text{Weight $w_1$ or $w_2$}",Magnification->SizeLabel],
MaTeX["\\text{$E^{(w_1,0)}$ or $E^{(1/3,w_2)}$ (a.u.)}",Magnification->SizeLabel]
}]
,
ListPlot[{Ew1n5Lπ[[;;,{1,2}]],Ew1n5Lπ[[;;,{1,3}]],Ew2n5Lπ[[;;,{1,2}]],Ew2n5Lπ[[;;,{1,3}]]},
OptionsEvsw,PlotLabel->MaTeX["\\text{$N = 5$ and $L = \\pi$}",Magnification->SizeTitle],
FrameLabel->{
MaTeX["\\text{Weight $w_1$ or $w_2$}",Magnification->SizeLabel],
MaTeX["\\text{$E^{(w_1,0)}$ or $E^{(1/3,w_2)}$ (a.u.)}",Magnification->SizeLabel]
}]
,
ListPlot[{Ew1n5L8π[[;;,{1,2}]],Ew1n5L8π[[;;,{1,3}]],Ew2n5L8π[[;;,{1,2}]],Ew2n5L8π[[;;,{1,3}]]},
OptionsEvsw,PlotLabel->MaTeX["\\text{$N = 5$ and $L = 8\\pi$}",Magnification->SizeTitle],
PlotLegends->Placed[{
MaTeX["\\text{$E^{(w_1,0)}$}",Magnification->SizeLegend],
MaTeX["\\text{$E^{(w_1,0)}$ (GIC)}",Magnification->SizeLegend],
MaTeX["\\text{$E^{(1/3,w_2)}$}",Magnification->SizeLegend],
MaTeX["\\text{$E^{(1/3,w_2)}$ (GIC)}",Magnification->SizeLegend]
},
Right],
FrameLabel->{
MaTeX["\\text{Weight $w_1$ or $w_2$}",Magnification->SizeLabel],
MaTeX["\\text{$E^{(w_1,0)}$ or $E^{(0,w_2)}$ (a.u.)}",Magnification->SizeLabel]
}]
}
},Spacings->4]

2-boxium

Ew1$n2$π8=Table[Flatten[{w1,OptGap["boxium",2,30,π/8,{w1,0}][[1;;2]]}],{w1,0,1/2,1/12}];
Ew2$n2$π8=Table[Flatten[{w2,OptGap["boxium",2,30,π/8,{0,w2}][[1;;2]]}],{w2,0,1/2,1/12}];
Ew1$n2$π4=Table[Flatten[{w1,OptGap["boxium",2,30,π/4,{w1,0}][[1;;2]]}],{w1,0,1/2,1/12}];
Ew2$n2$π4=Table[Flatten[{w2,OptGap["boxium",2,30,π/4,{0,w2}][[1;;2]]}],{w2,0,1/2,1/12}];
Ew1$n2$π2=Table[Flatten[{w1,OptGap["boxium",2,30,π/2,{w1,0}][[1;;2]]}],{w1,0,1/2,1/12}];
Ew2$n2$π2=Table[Flatten[{w2,OptGap["boxium",2,30,π/2,{0,w2}][[1;;2]]}],{w2,0,1/2,1/12}];
Ew1$n2$π=Table[Flatten[{w1,OptGap["boxium",2,30,π,{w1,0}][[1;;2]]}],{w1,0,1/2,1/12}];
Ew2$n2$π=Table[Flatten[{w2,OptGap["boxium",2,30,π,{0,w2}][[1;;2]]}],{w2,0,1/2,1/12}];
Ew1$n2$2π=Table[Flatten[{w1,OptGap["boxium",2,30,2π,{w1,0}][[1;;2]]}],{w1,0,1/2,1/12}];
Ew2$n2$2π=Table[Flatten[{w2,OptGap["boxium",2,30,2π,{0,w2}][[1;;2]]}],{w2,0,1/2,1/12}];
Ew1$n2$4π=Table[Flatten[{w1,OptGap["boxium",2,30,4π,{w1,0}][[1;;2]]}],{w1,0,1/2,1/12}];
Ew2$n2$4π=Table[Flatten[{w2,OptGap["boxium",2,30,4π,{0,w2}][[1;;2]]}],{w2,0,1/2,1/12}];
Ew1$n2$8π=Table[Flatten[{w1,OptGap["boxium",2,30,8π,{w1,0}][[1;;2]]}],{w1,0,1/2,1/12}];
Ew2$n2$8π=Table[Flatten[{w2,OptGap["boxium",2,30,8π,{0,w2}][[1;;2]]}],{w2,0,1/2,1/12}];

ListPlot[{Ew1$n2$π8[[;;,{1,2}]],Ew1$n2$π8[[;;,{1,3}]],Ew2$n2$π8[[;;,{1,2}]],Ew2$n2$π8[[;;,{1,3}]]},
OptionsEvsw,PlotLegends->Placed[{
MaTeX["\\text{$E^{(w_1,0)}$ ($N = 2$ and $L = \\pi/8$)}",Magnification->SizeLabel],
MaTeX["\\text{$E^{(w_1,0)}$ (GIC)}",Magnification->SizeLabel],
MaTeX["\\text{$E^{(0,w_2)}$}",Magnification->SizeLabel],
MaTeX["\\text{$E^{(0,w_2)}$ (GIC)}",Magnification->SizeLabel]
},
{Left,Top}],
FrameLabel->{
MaTeX["\\text{Weight $w_1$ or $w_2$}",Magnification->SizeLabel],
MaTeX["\\text{$E^{(w_1,0)}$ or $E^{(0,w_2)}$ (a.u.)}",Magnification->SizeLabel]
}]

ListPlot[{Ew1$n2$π[[;;,{1,2}]],Ew1$n2$π[[;;,{1,3}]],Ew2$n2$π[[;;,{1,2}]],Ew2$n2$π[[;;,{1,3}]]},
OptionsEvsw,PlotLegends->Placed[{
MaTeX["\\text{$E^{(w_1,0)}$ ($N = 2$ and $L = \\pi$)}",Magnification->SizeLabel],
MaTeX["\\text{$E^{(w_1,0)}$ (GIC)}",Magnification->SizeLabel],
MaTeX["\\text{$E^{(0,w_2)}$}",Magnification->SizeLabel],
MaTeX["\\text{$E^{(0,w_2)}$ (GIC)}",Magnification->SizeLabel]
},
{Left,Top}],
FrameLabel->{
MaTeX["\\text{Weight $w_1$ or $w_2$}",Magnification->SizeLabel],
MaTeX["\\text{$E^{(w_1,0)}$ or $E^{(0,w_2)}$ (a.u.)}",Magnification->SizeLabel]
}]

ListPlot[{Ew1$n2$4π[[;;,{1,2}]],Ew1$n2$4π[[;;,{1,3}]],Ew2$n2$4π[[;;,{1,2}]],Ew2$n2$4π[[;;,{1,3}]]},
OptionsEvsw,PlotLegends->Placed[{
MaTeX["\\text{$E^{(w_1,0)}$ ($N = 2$ and $L = 4\\pi$)}",Magnification->SizeLabel],
MaTeX["\\text{$E^{(w_1,0)}$ (GIC)}",Magnification->SizeLabel],
MaTeX["\\text{$E^{(0,w_2)}$}",Magnification->SizeLabel],
MaTeX["\\text{$E^{(0,w_2)}$ (GIC)}",Magnification->SizeLabel]
},
{Left,Top}],
FrameLabel->{
MaTeX["\\text{Weight $w_1$ or $w_2$}",Magnification->SizeLabel],
MaTeX["\\text{$E^{(w_1,0)}$ or $E^{(0,w_2)}$ (a.u.)}",Magnification->SizeLabel]
}]

4-boxium

Ew1$n4$π8=Table[Flatten[{w1,OptGap["boxium",4,30,π/8,{w1,0}][[1;;2]]}],{w1,0,1/2,1/12}];
Ew2$n4$π8=Table[Flatten[{w2,OptGap["boxium",4,30,π/8,{0,w2}][[1;;2]]}],{w2,0,1/2,1/12}];
Ew1$n4$π4=Table[Flatten[{w1,OptGap["boxium",4,30,π/4,{w1,0}][[1;;2]]}],{w1,0,1/2,1/12}];
Ew2$n4$π4=Table[Flatten[{w2,OptGap["boxium",4,30,π/4,{0,w2}][[1;;2]]}],{w2,0,1/2,1/12}];
Ew1$n4$π2=Table[Flatten[{w1,OptGap["boxium",4,30,π/2,{w1,0}][[1;;2]]}],{w1,0,1/2,1/12}];
Ew2$n4$π2=Table[Flatten[{w2,OptGap["boxium",4,30,π/2,{0,w2}][[1;;2]]}],{w2,0,1/2,1/12}];
Ew1$n4$π=Table[Flatten[{w1,OptGap["boxium",4,30,π,{w1,0}][[1;;2]]}],{w1,0,1/2,1/12}];
Ew2$n4$π=Table[Flatten[{w2,OptGap["boxium",4,30,π,{0,w2}][[1;;2]]}],{w2,0,1/2,1/12}];
Ew1$n4$2π=Table[Flatten[{w1,OptGap["boxium",4,30,2π,{w1,0}][[1;;2]]}],{w1,0,1/2,1/12}];
Ew2$n4$2π=Table[Flatten[{w2,OptGap["boxium",4,30,2π,{0,w2}][[1;;2]]}],{w2,0,1/2,1/12}];
Ew1$n4$4π=Table[Flatten[{w1,OptGap["boxium",4,30,4π,{w1,0}][[1;;2]]}],{w1,0,1/2,1/12}];
Ew2$n4$4π=Table[Flatten[{w2,OptGap["boxium",4,30,4π,{0,w2}][[1;;2]]}],{w2,0,1/2,1/12}];
Ew1$n4$8π=Table[Flatten[{w1,OptGap["boxium",4,30,8π,{w1,0}][[1;;2]]}],{w1,0,1/2,1/12}];
Ew2$n4$8π=Table[Flatten[{w2,OptGap["boxium",4,30,8π,{0,w2}][[1;;2]]}],{w2,0,1/2,1/12}];

ListPlot[{Ew1$n4$π8[[;;,{1,2}]],Ew1$n4$π8[[;;,{1,3}]],Ew2$n4$π8[[;;,{1,2}]],Ew2$n4$π8[[;;,{1,3}]]},
OptionsEvsw,PlotLegends->Placed[{
MaTeX["\\text{$E^{(w_1,0)}$ ($N = 4$ and $L = \\pi/8$)}",Magnification->SizeLabel],
MaTeX["\\text{$E^{(w_1,0)}$ (GIC)}",Magnification->SizeLabel],
MaTeX["\\text{$E^{(0,w_2)}$}",Magnification->SizeLabel],
MaTeX["\\text{$E^{(0,w_2)}$ (GIC)}",Magnification->SizeLabel]
},
{Left,Top}],
FrameLabel->{
MaTeX["\\text{Weight $w_1$ or $w_2$}",Magnification->SizeLabel],
MaTeX["\\text{$E^{(w_1,0)}$ or $E^{(0,w_2)}$ (a.u.)}",Magnification->SizeLabel]
}]

ListPlot[{Ew1$n4$π[[;;,{1,2}]],Ew1$n4$π[[;;,{1,3}]],Ew2$n4$π[[;;,{1,2}]],Ew2$n4$π[[;;,{1,3}]]},
OptionsEvsw,PlotLegends->Placed[{
MaTeX["\\text{$E^{(w_1,0)}$ ($N = 4$ and $L = \\pi$)}",Magnification->SizeLabel],
MaTeX["\\text{$E^{(w_1,0)}$ (GIC)}",Magnification->SizeLabel],
MaTeX["\\text{$E^{(0,w_2)}$}",Magnification->SizeLabel],
MaTeX["\\text{$E^{(0,w_2)}$ (GIC)}",Magnification->SizeLabel]
},
{Left,Top}],
FrameLabel->{
MaTeX["\\text{Weight $w_1$ or $w_2$}",Magnification->SizeLabel],
MaTeX["\\text{$E^{(w_1,0)}$ or $E^{(0,w_2)}$ (a.u.)}",Magnification->SizeLabel]
}]

ListPlot[{Ew1$n4$8π[[;;,{1,2}]],Ew1$n4$8π[[;;,{1,3}]],Ew2$n4$8π[[;;,{1,2}]],Ew2$n4$8π[[;;,{1,3}]]},
OptionsEvsw,PlotLegends->Placed[{
MaTeX["\\text{$E^{(w_1,0)}$ ($N = 4$ and $L = 8\\pi$)}",Magnification->SizeLabel],
MaTeX["\\text{$E^{(w_1,0)}$ (GIC)}",Magnification->SizeLabel],
MaTeX["\\text{$E^{(0,w_2)}$}",Magnification->SizeLabel],
MaTeX["\\text{$E^{(0,w_2)}$ (GIC)}",Magnification->SizeLabel]
},
{Left,Top}],
FrameLabel->{
MaTeX["\\text{Weight $w_1$ or $w_2$}",Magnification->SizeLabel],
MaTeX["\\text{$E^{(w_1,0)}$ or $E^{(0,w_2)}$ (a.u.)}",Magnification->SizeLabel]
}]

8-boxium

Ew1$n8$π8=Table[Flatten[{w1,OptGap["boxium",8,30,π/8,{w1,0}][[1;;2]]}],{w1,0,1/2,1/12}];
Ew2$n8$π8=Table[Flatten[{w2,OptGap["boxium",8,30,π/8,{0,w2}][[1;;2]]}],{w2,0,1/2,1/12}];
Ew1$n8$π4=Table[Flatten[{w1,OptGap["boxium",8,30,π/4,{w1,0}][[1;;2]]}],{w1,0,1/2,1/12}];
Ew2$n8$π4=Table[Flatten[{w2,OptGap["boxium",8,30,π/4,{0,w2}][[1;;2]]}],{w2,0,1/2,1/12}];
Ew1$n8$π2=Table[Flatten[{w1,OptGap["boxium",8,30,π/2,{w1,0}][[1;;2]]}],{w1,0,1/2,1/12}];
Ew2$n8$π2=Table[Flatten[{w2,OptGap["boxium",8,30,π/2,{0,w2}][[1;;2]]}],{w2,0,1/2,1/12}];
Ew1$n8$π=Table[Flatten[{w1,OptGap["boxium",8,30,π,{w1,0}][[1;;2]]}],{w1,0,1/2,1/12}];
Ew2$n8$π=Table[Flatten[{w2,OptGap["boxium",8,30,π,{0,w2}][[1;;2]]}],{w2,0,1/2,1/12}];
Ew1$n8$2π=Table[Flatten[{w1,OptGap["boxium",8,30,2π,{w1,0}][[1;;2]]}],{w1,0,1/2,1/12}];
Ew2$n8$2π=Table[Flatten[{w2,OptGap["boxium",8,30,2π,{0,w2}][[1;;2]]}],{w2,0,1/2,1/12}];
Ew1$n8$4π=Table[Flatten[{w1,OptGap["boxium",8,30,4π,{w1,0}][[1;;2]]}],{w1,0,1/2,1/12}];
Ew2$n8$4π=Table[Flatten[{w2,OptGap["boxium",8,30,4π,{0,w2}][[1;;2]]}],{w2,0,1/2,1/12}];
Ew1$n8$8π=Table[Flatten[{w1,OptGap["boxium",8,30,8π,{w1,0}][[1;;2]]}],{w1,0,1/2,1/12}];
Ew2$n8$8π=Table[Flatten[{w2,OptGap["boxium",8,30,8π,{0,w2}][[1;;2]]}],{w2,0,1/2,1/12}];

ListPlot[{Ew1$n8$π8[[;;,{1,2}]],Ew1$n8$π8[[;;,{1,3}]],Ew2$n8$π8[[;;,{1,2}]],Ew2$n8$π8[[;;,{1,3}]]},
OptionsEvsw,PlotLegends->Placed[{
MaTeX["\\text{$E^{(w_1,0)}$ ($N = 8$ and $L = \\pi/8$)}",Magnification->SizeLabel],
MaTeX["\\text{$E^{(w_1,0)}$ (GIC)}",Magnification->SizeLabel],
MaTeX["\\text{$E^{(0,w_2)}$}",Magnification->SizeLabel],
MaTeX["\\text{$E^{(0,w_2)}$ (GIC)}",Magnification->SizeLabel]
},
{Left,Top}],
FrameLabel->{
MaTeX["\\text{Weight $w_1$ or $w_2$}",Magnification->SizeLabel],
MaTeX["\\text{$E^{(w_1,0)}$ or $E^{(0,w_2)}$ (a.u.)}",Magnification->SizeLabel]
}]

ListPlot[{Ew1$n8$π[[;;,{1,2}]],Ew1$n8$π[[;;,{1,3}]],Ew2$n8$π[[;;,{1,2}]],Ew2$n8$π[[;;,{1,3}]]},
OptionsEvsw,PlotLegends->Placed[{
MaTeX["\\text{$E^{(w_1,0)}$ ($N = 8$ and $L = \\pi$)}",Magnification->SizeLabel],
MaTeX["\\text{$E^{(w_1,0)}$ (GIC)}",Magnification->SizeLabel],
MaTeX["\\text{$E^{(0,w_2)}$}",Magnification->SizeLabel],
MaTeX["\\text{$E^{(0,w_2)}$ (GIC)}",Magnification->SizeLabel]
},
{Left,Top}],
FrameLabel->{
MaTeX["\\text{Weight $w_1$ or $w_2$}",Magnification->SizeLabel],
MaTeX["\\text{$E^{(w_1,0)}$ or $E^{(0,w_2)}$ (a.u.)}",Magnification->SizeLabel]
}]

ListPlot[{Ew1$n8$8π[[;;,{1,2}]],Ew1$n8$8π[[;;,{1,3}]],Ew2$n8$8π[[;;,{1,2}]],Ew2$n8$8π[[;;,{1,3}]]},
OptionsEvsw,PlotLegends->Placed[{
MaTeX["\\text{$E^{(w_1,0)}$ ($N = 8$ and $L = 8\\pi$)}",Magnification->SizeLabel],
MaTeX["\\text{$E^{(w_1,0)}$ (GIC)}",Magnification->SizeLabel],
MaTeX["\\text{$E^{(0,w_2)}$}",Magnification->SizeLabel],
MaTeX["\\text{$E^{(0,w_2)}$ (GIC)}",Magnification->SizeLabel]
},
{Left,Top}],
FrameLabel->{
MaTeX["\\text{Weight $w_1$ or $w_2$}",Magnification->SizeLabel],
MaTeX["\\text{$E^{(w_1,0)}$ or $E^{(0,w_2)}$ (a.u.)}",Magnification->SizeLabel]
}]

Weight dependence of the individual energies

SizeLegend=1.5;
SizeEpilog=3;
SizeLabel=3;

OptionsEvsw={
AspectRatio->1,
PlotMarkers->{Automatic,Large},
Frame->True,
FrameStyle->Directive[Thick,20],
ImageSize->Large,
Joined->True,
PlotRange->All,PlotStyle->Thick
};

E$w1=Table[Flatten[{w,OptGap["boxium",2,30,π,{w,0}][[10]]}],{w,0,1/2,1/12}]

ListPlot[{
Table[{E$w1[[a,1]],((E$w1[[a,2]])/(E$w1[[1,2]]))},{a,7}],
Table[{E$w1[[a,1]],((E$w1[[a,3]])/(E$w1[[1,3]]))},{a,7}],
Table[{E$w1[[a,1]],((E$w1[[a,4]])/(E$w1[[1,4]]))},{a,7}]
},OptionsEvsw,FrameLabel->{
MaTeX["\\text{Weight $w_1$ }",Magnification->SizeLabel],
MaTeX["\\text{Individual energy $E^{(I)}$ (a.u.)}",Magnification->SizeLabel]
}]

E$w2=Table[Flatten[{w,OptGap["boxium",2,30,π,{0,w}][[10]]}],{w,0,1/2,1/12}]

ListPlot[{
Table[{E$w2[[a,1]],((E$w2[[a,2]])/(E$w2[[1,2]]))},{a,7}],
Table[{E$w2[[a,1]],((E$w2[[a,3]])/(E$w2[[1,3]]))},{a,7}],
Table[{E$w2[[a,1]],((E$w2[[a,4]])/(E$w2[[1,4]]))},{a,7}]
},OptionsEvsw,FrameLabel->{
MaTeX["\\text{Weight $w_2$}",Magnification->SizeLabel],
MaTeX["\\text{Individual energy $E^{(I)}$ (a.u.)}",Magnification->SizeLabel]
}]

E$w1$w2=Table[Flatten[{w,OptGap["boxium",2,30,π,{w,1/3}][[10]]}],{w,0,1/3,1/12}]

ListPlot[{
Table[{E$w1$w2[[a,1]],((E$w1$w2[[a,2]])/(E$w1$w2[[1,2]]))},{a,5}],
Table[{E$w1$w2[[a,1]],((E$w1$w2[[a,3]])/(E$w1$w2[[1,3]]))},{a,5}],
Table[{E$w1$w2[[a,1]],((E$w1$w2[[a,4]])/(E$w1$w2[[1,4]]))},{a,5}]
},OptionsEvsw,FrameLabel->{
MaTeX["\\text{Weight $w_1$}",Magnification->SizeLabel],
MaTeX["\\text{Individual energy $E^{(I)}$ (a.u.)}",Magnification->SizeLabel]
}]

E$w2$w1=Table[Flatten[{w,OptGap["boxium",2,30,π,{1/3,w}][[10]]}],{w,0,1/3,1/12}]

ListPlot[{
Table[{E$w2$w1[[a,1]],((E$w2$w1[[a,2]])/(E$w2$w1[[1,2]]))},{a,5}],
Table[{E$w2$w1[[a,1]],((E$w2$w1[[a,3]])/(E$w2$w1[[1,3]]))},{a,5}],
Table[{E$w2$w1[[a,1]],((E$w2$w1[[a,4]])/(E$w2$w1[[1,4]]))},{a,5}]
},OptionsEvsw,FrameLabel->{
MaTeX["\\text{Weight $w_2$}",Magnification->SizeLabel],
MaTeX["\\text{Individual energy $E^{(I)}$ (a.u.)}",Magnification->SizeLabel]
}]

Derivative discontinuities

SizeLegend=1.5;
SizeEpilog=3;
SizeLabel=3;

OptionsEvsw={
AspectRatio->1,
PlotMarkers->{Automatic,Large},
Frame->True,
FrameStyle->Directive[Thick,20],
ImageSize->Large,
Joined->True,
PlotRange->All,PlotStyle->Thick
};

Δxc$w1=Table[Flatten[{w,OptGap["boxium",2,30,π,{w,0}][[13]]}],{w,0,1/2,1/12}]

ListPlot[{
Table[{Δxc$w1[[a,1]],Δxc$w1[[a,2]]},{a,7}],
Table[{Δxc$w1[[a,1]],Δxc$w1[[a,3]]},{a,7}],
Table[{Δxc$w1[[a,1]],Δxc$w1[[a,4]]},{a,7}]
},OptionsEvsw,FrameLabel->{
MaTeX["\\text{Weight $w_1$ }",Magnification->SizeLabel],
MaTeX["\\text{$\\Delta_\\text{c}^{(I)}$ (a.u.)}",Magnification->SizeLabel]
}]

Δxc$w2=Table[Flatten[{w,OptGap["boxium",2,30,π,{0,w}][[13]]}],{w,0,1/2,1/12}]

ListPlot[{
Table[{Δxc$w2[[a,1]],Δxc$w2[[a,2]]},{a,7}],
Table[{Δxc$w2[[a,1]],Δxc$w2[[a,3]]},{a,7}],
Table[{Δxc$w2[[a,1]],Δxc$w2[[a,4]]},{a,7}]
},OptionsEvsw,FrameLabel->{
MaTeX["\\text{Weight $w_2$}",Magnification->SizeLabel],
MaTeX["\\text{$\\Delta_\\text{c}^{(I)}$ (a.u.)}",Magnification->SizeLabel]
}]

Δxc$w1$w2=Table[Flatten[{w,OptGap["boxium",2,30,π,{w,1/3}][[11]]}],{w,0,1/3,1/12}]

ListPlot[{
Table[{Δxc$w1$w2[[a,1]],Δxc$w1$w2[[a,2]]},{a,5}],
Table[{Δxc$w1$w2[[a,1]],Δxc$w1$w2[[a,3]]},{a,5}],
Table[{Δxc$w1$w2[[a,1]],Δxc$w1$w2[[a,4]]},{a,5}]
},OptionsEvsw,FrameLabel->{
MaTeX["\\text{Weight $w_1$}",Magnification->SizeLabel],
MaTeX["\\text{$\\Delta_\\text{c}^{(I)}$ (a.u.)}",Magnification->SizeLabel]
}]

Δxc$w2$w1=Table[Flatten[{w,OptGap["boxium",2,30,π,{1/3,w}][[11]]}],{w,0,1/3,1/12}]

ListPlot[{
Table[{Δxc$w2$w1[[a,1]],Δxc$w2$w1[[a,2]]},{a,5}],
Table[{Δxc$w2$w1[[a,1]],Δxc$w2$w1[[a,3]]},{a,5}],
Table[{Δxc$w2$w1[[a,1]],Δxc$w2$w1[[a,4]]},{a,5}]
},OptionsEvsw,FrameLabel->{
MaTeX["\\text{Weight $w_2$}",Magnification->SizeLabel],
MaTeX["\\text{$\\Delta_\\text{c}^{(I)}$ (a.u.)}",Magnification->SizeLabel]
}]

Levy-Zahariev shift

SizeLegend=1.5;
SizeEpilog=3;
SizeLabel=3;

OptionsEvsw={
AspectRatio->1,
PlotMarkers->{Automatic,Large},
Frame->True,
FrameStyle->Directive[Thick,20],
ImageSize->Large,
Joined->True,
PlotRange->All,PlotStyle->Thick
};

LZ$w1=Table[Flatten[{w,OptGap["boxium",2,30,π,{w,0}][[12]]}],{w,0,1/2,1/12}]

ListPlot[{
Table[{LZ$w1[[a,1]],LZ$w1[[a,2]]},{a,7}]
},OptionsEvsw,FrameLabel->{
MaTeX["\\text{Weight $w_1$ }",Magnification->SizeLabel],
MaTeX["\\text{$\\Xi_\\text{c}$ (a.u.)}",Magnification->SizeLabel]
}]

LZ$w2=Table[Flatten[{w,OptGap["boxium",2,30,π,{0,w}][[12]]}],{w,0,1/2,1/12}]

ListPlot[{
Table[{Δxc$w2[[a,1]],LZ$w2[[a,2]]},{a,7}]
},OptionsEvsw,FrameLabel->{
MaTeX["\\text{Weight $w_2$}",Magnification->SizeLabel],
MaTeX["\\text{$\\Xi_\\text{c}$ (a.u.)}",Magnification->SizeLabel]
}]

LZ$w1$w2=Table[Flatten[{w,OptGap["boxium",2,30,π,{w,1/3}][[12]]}],{w,0,1/3,1/12}]

ListPlot[{
Table[{LZ$w1$w2[[a,1]],LZ$w1$w2[[a,2]]},{a,5}],
},OptionsEvsw,FrameLabel->{
MaTeX["\\text{Weight $w_1$}",Magnification->SizeLabel],
MaTeX["\\text{$\\Xi_\\text{c}$ (a.u.)}",Magnification->SizeLabel]
}]

LZ$w2$w1=Table[Flatten[{w,OptGap["boxium",2,30,π,{1/3,w}][[12]]}],{w,0,1/3,1/12}]

ListPlot[{
Table[{LZ$w2$w1[[a,1]],Δxc$w2$w1[[a,2]]},{a,5}]
},OptionsEvsw,FrameLabel->{
MaTeX["\\text{Weight $w_2$}",Magnification->SizeLabel],
MaTeX["\\text{$\\Xi_\\text{c}$ (a.u.)}",Magnification->SizeLabel]
}]

Plots E vs L

Options

SizeLegend=2;
SizeEpilog=3;
SizeLabel=3;

OptionsEvsL={
PlotTheme->"Scentific",
PlotStyle->{{Thickness[0.01],Black},{Thickness[0.01],Red},{Thickness[0.01],Blue},{Thickness[0.01],Darker[Green]},{Thickness[0.01],Orange},{Thickness[0.01],Purple},{Thickness[0.01],Magenta},{Thickness[0.01],Cyan}},
AspectRatio->1,
PlotMarkers->{"OpenMarkers",Large},
Frame->True,
FrameStyle->Directive[Thick,26],
ImageSize->Large,
Joined->True,
PlotRange->All
};

OptionsEvsLHF={
PlotTheme->"Scentific",
PlotStyle->{{Thickness[0.01],Red},{Thickness[0.01],Blue},
{Thickness[0.01],Dashing[0.02],Red},{Thickness[0.01],Dashing[0.02],Blue}},
AspectRatio->1,
PlotMarkers->{"OpenMarkers",Large},
Frame->True,
FrameStyle->Directive[Thick,26],
ImageSize->Large,
Joined->True,
PlotRange->All
};

N=2

ΔOG0$Singles=Table[{OG$FCI$Box2[[a,1]],100((OG$c$Box2$0[[a,3]]-OG$c$Box2$0[[a,2]]-(OG$FCI$Box2[[a,3]]-OG$FCI$Box2[[a,2]]))/(OG$FCI$Box2[[a,3]]-OG$FCI$Box2[[a,2]]))},{a,6}];
ΔOG0$Doubles=Table[{OG$FCI$Box2[[a,1]],100((OG$c$Box2$0[[a,4]]-OG$c$Box2$0[[a,2]]-(OG$FCI$Box2[[a,4]]-OG$FCI$Box2[[a,2]]))/(OG$FCI$Box2[[a,4]]-OG$FCI$Box2[[a,2]]))},{a,6}];
ΔOGSA$Singles=Table[{OG$FCI$Box2[[a,1]],100((OG$c$Box2$SA[[a,3]]-OG$c$Box2$SA[[a,2]]-(OG$FCI$Box2[[a,3]]-OG$FCI$Box2[[a,2]]))/(OG$FCI$Box2[[a,3]]-OG$FCI$Box2[[a,2]]))},{a,6}];
ΔOGSA$Doubles=Table[{OG$FCI$Box2[[a,1]],100((OG$c$Box2$SA[[a,4]]-OG$c$Box2$SA[[a,2]]-(OG$FCI$Box2[[a,4]]-OG$FCI$Box2[[a,2]]))/(OG$FCI$Box2[[a,4]]-OG$FCI$Box2[[a,2]]))},{a,6}];
ΔOGTDHF$Singles=Table[{OG$FCI$Box2[[a,1]],100((OG$TDHF$Box2[[a,2]]-(OG$FCI$Box2[[a,3]]-OG$FCI$Box2[[a,2]]))/(OG$FCI$Box2[[a,4]]-OG$FCI$Box2[[a,2]]))},{a,6}];
ΔOGCIS$Singles=Table[{OG$FCI$Box2[[a,1]],100((OG$CIS$Box2[[a,2]]-(OG$FCI$Box2[[a,3]]-OG$FCI$Box2[[a,2]]))/(OG$FCI$Box2[[a,4]]-OG$FCI$Box2[[a,2]]))},{a,6}];
ΔOGTDLDA$Singles=Table[{OG$FCI$Box2[[a,1]],100((OG$TDLDA$Box2[[a,2]]-(OG$FCI$Box2[[a,3]]-OG$FCI$Box2[[a,2]]))/(OG$FCI$Box2[[a,4]]-OG$FCI$Box2[[a,2]]))},{a,6}];
ΔOGTDA$Singles=Table[{OG$FCI$Box2[[a,1]],100((OG$TDA$Box2[[a,2]]-(OG$FCI$Box2[[a,3]]-OG$FCI$Box2[[a,2]]))/(OG$FCI$Box2[[a,4]]-OG$FCI$Box2[[a,2]]))},{a,6}];
ΔHF0$Singles=Table[{OG$FCI$Box2[[a,1]],100((OG$HF$Box2$0[[a,3]]-OG$HF$Box2$0[[a,2]]-(OG$FCI$Box2[[a,3]]-OG$FCI$Box2[[a,2]]))/(OG$FCI$Box2[[a,3]]-OG$FCI$Box2[[a,2]]))},{a,6}];
ΔHF0$Doubles=Table[{OG$FCI$Box2[[a,1]],100((OG$HF$Box2$0[[a,4]]-OG$HF$Box2$0[[a,2]]-(OG$FCI$Box2[[a,4]]-OG$FCI$Box2[[a,2]]))/(OG$FCI$Box2[[a,4]]-OG$FCI$Box2[[a,2]]))},{a,6}];
ΔHFSA$Singles=Table[{OG$FCI$Box2[[a,1]],100((OG$HF$Box2$SA[[a,3]]-OG$HF$Box2$SA[[a,2]]-(OG$FCI$Box2[[a,3]]-OG$FCI$Box2[[a,2]]))/(OG$FCI$Box2[[a,3]]-OG$FCI$Box2[[a,2]]))},{a,6}];
ΔHFSA$Doubles=Table[{OG$FCI$Box2[[a,1]],100((OG$HF$Box2$SA[[a,4]]-OG$HF$Box2$SA[[a,2]]-(OG$FCI$Box2[[a,4]]-OG$FCI$Box2[[a,2]]))/(OG$FCI$Box2[[a,4]]-OG$FCI$Box2[[a,2]]))},{a,6}];
ListLogLinearPlot[{ΔOG0$Singles,ΔOG0$Doubles,ΔOGSA$Singles,ΔOGSA$Doubles,(*ΔOGTDHF$Singles,ΔOGCIS$Singles,*)ΔOGTDLDA$Singles,ΔOGTDA$Singles},OptionsEvsL,
PlotLabel->MaTeX["\\text{$N = 2$}",Magnification->SizeEpilog]]
Export["EvsL_2.pdf",%];
ListLogLinearPlot[{ΔOG0$Doubles,ΔOGSA$Doubles,ΔHF0$Doubles,ΔHFSA$Doubles},OptionsEvsLHF,
PlotLabel->MaTeX["\\text{$N = 2$}",Magnification->SizeEpilog]]
ListLogLinearPlot[{ΔOG0$Singles,ΔOGSA$Singles,ΔHF0$Singles,ΔHFSA$Singles},OptionsEvsLHF,
PlotLabel->MaTeX["\\text{$N = 2$}",Magnification->SizeEpilog]]

N=3

ΔOG0$Singles=Table[{OG$FCI$Box3[[a,1]],100((OG$c$Box3$0[[a,3]]-OG$c$Box3$0[[a,2]]-(OG$FCI$Box3[[a,3]]-OG$FCI$Box3[[a,2]]))/(OG$FCI$Box3[[a,3]]-OG$FCI$Box3[[a,2]]))},{a,7}];
ΔOG0$Doubles=Table[{OG$FCI$Box3[[a,1]],100((OG$c$Box3$0[[a,4]]-OG$c$Box3$0[[a,2]]-(OG$FCI$Box3[[a,4]]-OG$FCI$Box3[[a,2]]))/(OG$FCI$Box3[[a,4]]-OG$FCI$Box3[[a,2]]))},{a,7}];
ΔOGSA$Singles=Table[{OG$FCI$Box3[[a,1]],100((OG$c$Box3$SA[[a,3]]-OG$c$Box3$SA[[a,2]]-(OG$FCI$Box3[[a,3]]-OG$FCI$Box3[[a,2]]))/(OG$FCI$Box3[[a,3]]-OG$FCI$Box3[[a,2]]))},{a,7}];
ΔOGSA$Doubles=Table[{OG$FCI$Box3[[a,1]],100((OG$c$Box3$SA[[a,4]]-OG$c$Box3$SA[[a,2]]-(OG$FCI$Box3[[a,4]]-OG$FCI$Box3[[a,2]]))/(OG$FCI$Box3[[a,4]]-OG$FCI$Box3[[a,2]]))},{a,7}];
ΔOGTDHF$Singles=Table[{OG$FCI$Box3[[a,1]],100((OG$TDHF$Box3[[a,2]]-(OG$FCI$Box3[[a,3]]-OG$FCI$Box3[[a,2]]))/(OG$FCI$Box3[[a,4]]-OG$FCI$Box3[[a,2]]))},{a,7}];
ΔOGCIS$Singles=Table[{OG$FCI$Box3[[a,1]],100((OG$CIS$Box3[[a,2]]-(OG$FCI$Box3[[a,3]]-OG$FCI$Box3[[a,2]]))/(OG$FCI$Box3[[a,4]]-OG$FCI$Box3[[a,2]]))},{a,7}];
ΔOGTDLDA$Singles=Table[{OG$FCI$Box3[[a,1]],100((OG$TDLDA$Box3[[a,2]]-(OG$FCI$Box3[[a,3]]-OG$FCI$Box3[[a,2]]))/(OG$FCI$Box3[[a,4]]-OG$FCI$Box3[[a,2]]))},{a,7}];
ΔOGTDA$Singles=Table[{OG$FCI$Box3[[a,1]],100((OG$TDA$Box3[[a,2]]-(OG$FCI$Box3[[a,3]]-OG$FCI$Box3[[a,2]]))/(OG$FCI$Box3[[a,4]]-OG$FCI$Box3[[a,2]]))},{a,7}];
ΔHF0$Singles=Table[{OG$FCI$Box3[[a,1]],100((OG$HF$Box3$0[[a,3]]-OG$c$Box3$0[[a,2]]-(OG$FCI$Box3[[a,3]]-OG$FCI$Box3[[a,2]]))/(OG$FCI$Box3[[a,3]]-OG$FCI$Box3[[a,2]]))},{a,7}];
ΔHF0$Doubles=Table[{OG$FCI$Box3[[a,1]],100((OG$HF$Box3$0[[a,4]]-OG$c$Box3$0[[a,2]]-(OG$FCI$Box3[[a,4]]-OG$FCI$Box3[[a,2]]))/(OG$FCI$Box3[[a,4]]-OG$FCI$Box3[[a,2]]))},{a,7}];
ΔHFSA$Singles=Table[{OG$FCI$Box3[[a,1]],100((OG$HF$Box3$SA[[a,3]]-OG$HF$Box3$SA[[a,2]]-(OG$FCI$Box3[[a,3]]-OG$FCI$Box3[[a,2]]))/(OG$FCI$Box3[[a,3]]-OG$FCI$Box3[[a,2]]))},{a,7}];
ΔHFSA$Doubles=Table[{OG$FCI$Box3[[a,1]],100((OG$HF$Box3$SA[[a,4]]-OG$HF$Box3$SA[[a,2]]-(OG$FCI$Box3[[a,4]]-OG$FCI$Box3[[a,2]]))/(OG$FCI$Box3[[a,4]]-OG$FCI$Box3[[a,2]]))},{a,7}];
ListLogLinearPlot[{ΔOG0$Singles,ΔOG0$Doubles,ΔOGSA$Singles,ΔOGSA$Doubles,(*ΔOGTDHF$Singles,ΔOGCIS$Singles,*)ΔOGTDLDA$Singles,ΔOGTDA$Singles},OptionsEvsL,
PlotLabel->MaTeX["\\text{$N = 3$}",Magnification->SizeEpilog]]
Export["EvsL_3.pdf",%];
(*ListLogLinearPlot[{ΔOG0$Singles,ΔOG0$Doubles,ΔOGSA$Singles,ΔOGSA$Doubles,ΔHF0$Singles,ΔHF0$Doubles,ΔHFSA$Singles,ΔHFSA$Doubles},OptionsEvsLHF,PlotLegends->Automatic,
PlotLabel->MaTeX["\\text{$N = 3$}",Magnification->SizeEpilog]]*)

N=4

ΔOG0$Singles=Table[{OG$FCI$Box4[[a,1]],100((OG$c$Box4$0[[a,3]]-OG$c$Box4$0[[a,2]]-(OG$FCI$Box4[[a,3]]-OG$FCI$Box4[[a,2]]))/(OG$FCI$Box4[[a,3]]-OG$FCI$Box4[[a,2]]))},{a,7}];
ΔOG0$Doubles=Table[{OG$FCI$Box4[[a,1]],100((OG$c$Box4$0[[a,4]]-OG$c$Box4$0[[a,2]]-(OG$FCI$Box4[[a,4]]-OG$FCI$Box4[[a,2]]))/(OG$FCI$Box4[[a,4]]-OG$FCI$Box4[[a,2]]))},{a,7}];
ΔOGSA$Singles=Table[{OG$FCI$Box4[[a,1]],100((OG$c$Box4$SA[[a,3]]-OG$c$Box4$SA[[a,2]]-(OG$FCI$Box4[[a,3]]-OG$FCI$Box4[[a,2]]))/(OG$FCI$Box4[[a,3]]-OG$FCI$Box4[[a,2]]))},{a,7}];
ΔOGSA$Doubles=Table[{OG$FCI$Box4[[a,1]],100((OG$c$Box4$SA[[a,4]]-OG$c$Box4$SA[[a,2]]-(OG$FCI$Box4[[a,4]]-OG$FCI$Box4[[a,2]]))/(OG$FCI$Box4[[a,4]]-OG$FCI$Box4[[a,2]]))},{a,7}];
ΔOGTDHF$Singles=Table[{OG$FCI$Box4[[a,1]],100((OG$TDHF$Box4[[a,2]]-(OG$FCI$Box4[[a,3]]-OG$FCI$Box4[[a,2]]))/(OG$FCI$Box4[[a,4]]-OG$FCI$Box4[[a,2]]))},{a,7}];
ΔOGCIS$Singles=Table[{OG$FCI$Box4[[a,1]],100((OG$CIS$Box4[[a,2]]-(OG$FCI$Box4[[a,3]]-OG$FCI$Box4[[a,2]]))/(OG$FCI$Box4[[a,4]]-OG$FCI$Box4[[a,2]]))},{a,7}];
ΔOGTDLDA$Singles=Table[{OG$FCI$Box4[[a,1]],100((OG$TDLDA$Box4[[a,2]]-(OG$FCI$Box4[[a,3]]-OG$FCI$Box4[[a,2]]))/(OG$FCI$Box4[[a,4]]-OG$FCI$Box4[[a,2]]))},{a,7}];
ΔOGTDA$Singles=Table[{OG$FCI$Box4[[a,1]],100((OG$TDA$Box4[[a,2]]-(OG$FCI$Box4[[a,3]]-OG$FCI$Box4[[a,2]]))/(OG$FCI$Box4[[a,4]]-OG$FCI$Box4[[a,2]]))},{a,7}];
ΔHF0$Singles=Table[{OG$FCI$Box4[[a,1]],100((OG$HF$Box4$0[[a,3]]-OG$HF$Box4$0[[a,2]]-(OG$FCI$Box4[[a,3]]-OG$FCI$Box4[[a,2]]))/(OG$FCI$Box4[[a,3]]-OG$FCI$Box4[[a,2]]))},{a,7}];
ΔHF0$Doubles=Table[{OG$FCI$Box4[[a,1]],100((OG$HF$Box4$0[[a,4]]-OG$HF$Box4$0[[a,2]]-(OG$FCI$Box4[[a,4]]-OG$FCI$Box4[[a,2]]))/(OG$FCI$Box4[[a,4]]-OG$FCI$Box4[[a,2]]))},{a,7}];
ΔHFSA$Singles=Table[{OG$FCI$Box4[[a,1]],100((OG$HF$Box4$SA[[a,3]]-OG$HF$Box4$SA[[a,2]]-(OG$FCI$Box4[[a,3]]-OG$FCI$Box4[[a,2]]))/(OG$FCI$Box4[[a,3]]-OG$FCI$Box4[[a,2]]))},{a,7}];
ΔHFSA$Doubles=Table[{OG$FCI$Box4[[a,1]],100((OG$HF$Box4$SA[[a,4]]-OG$HF$Box4$SA[[a,2]]-(OG$FCI$Box4[[a,4]]-OG$FCI$Box4[[a,2]]))/(OG$FCI$Box4[[a,4]]-OG$FCI$Box4[[a,2]]))},{a,7}];
ListLogLinearPlot[{ΔOG0$Singles,ΔOG0$Doubles,ΔOGSA$Singles,ΔOGSA$Doubles,(*ΔOGTDHF$Singles,ΔOGCIS$Singles,*)ΔOGTDLDA$Singles,ΔOGTDA$Singles},OptionsEvsL,
PlotLabel->MaTeX["\\text{$N = 4$}",Magnification->SizeEpilog]]
Export["EvsL_4.pdf",%];
(*ListLogLinearPlot[{ΔHF0$Singles,ΔHF0$Doubles,ΔHFSA$Singles,ΔHFSA$Doubles,ΔOG0$Singles,ΔOG0$Doubles,ΔOGSA$Singles,ΔOGSA$Doubles},OptionsEvsLHF,
PlotLabel->MaTeX["\\text{$N = 4$}",Magnification->SizeEpilog],PlotLegends->Automatic]*)

N=5

ΔOG0$Singles=Table[{OG$FCI$Box5[[a,1]],100((OG$c$Box5$0[[a,3]]-OG$c$Box5$0[[a,2]]-(OG$FCI$Box5[[a,3]]-OG$FCI$Box5[[a,2]]))/(OG$FCI$Box5[[a,3]]-OG$FCI$Box5[[a,2]]))},{a,7}];
ΔOG0$Doubles=Table[{OG$FCI$Box5[[a,1]],100((OG$c$Box5$0[[a,4]]-OG$c$Box5$0[[a,2]]-(OG$FCI$Box5[[a,4]]-OG$FCI$Box5[[a,2]]))/(OG$FCI$Box5[[a,4]]-OG$FCI$Box5[[a,2]]))},{a,7}];
ΔOGSA$Singles=Table[{OG$FCI$Box5[[a,1]],100((OG$c$Box5$SA[[a,3]]-OG$c$Box5$SA[[a,2]]-(OG$FCI$Box5[[a,3]]-OG$FCI$Box5[[a,2]]))/(OG$FCI$Box5[[a,3]]-OG$FCI$Box5[[a,2]]))},{a,7}];
ΔOGSA$Doubles=Table[{OG$FCI$Box5[[a,1]],100((OG$c$Box5$SA[[a,4]]-OG$c$Box5$SA[[a,2]]-(OG$FCI$Box5[[a,4]]-OG$FCI$Box5[[a,2]]))/(OG$FCI$Box5[[a,4]]-OG$FCI$Box5[[a,2]]))},{a,7}];
ΔOGTDHF$Singles=Table[{OG$FCI$Box5[[a,1]],100((OG$TDHF$Box5[[a,2]]-(OG$FCI$Box5[[a,3]]-OG$FCI$Box5[[a,2]]))/(OG$FCI$Box5[[a,4]]-OG$FCI$Box5[[a,2]]))},{a,7}];
ΔOGCIS$Singles=Table[{OG$FCI$Box5[[a,1]],100((OG$CIS$Box5[[a,2]]-(OG$FCI$Box5[[a,3]]-OG$FCI$Box5[[a,2]]))/(OG$FCI$Box5[[a,4]]-OG$FCI$Box5[[a,2]]))},{a,7}];
ΔOGTDLDA$Singles=Table[{OG$FCI$Box5[[a,1]],100((OG$TDLDA$Box5[[a,2]]-(OG$FCI$Box5[[a,3]]-OG$FCI$Box5[[a,2]]))/(OG$FCI$Box5[[a,4]]-OG$FCI$Box5[[a,2]]))},{a,7}];
ΔOGTDA$Singles=Table[{OG$FCI$Box5[[a,1]],100((OG$TDA$Box5[[a,2]]-(OG$FCI$Box5[[a,3]]-OG$FCI$Box5[[a,2]]))/(OG$FCI$Box5[[a,4]]-OG$FCI$Box5[[a,2]]))},{a,7}];
ΔHF0$Singles=Table[{OG$FCI$Box5[[a,1]],100((OG$HF$Box5$0[[a,3]]-OG$HF$Box5$0[[a,2]]-(OG$FCI$Box5[[a,3]]-OG$FCI$Box5[[a,2]]))/(OG$FCI$Box5[[a,3]]-OG$FCI$Box5[[a,2]]))},{a,7}];
ΔHF0$Doubles=Table[{OG$FCI$Box5[[a,1]],100((OG$HF$Box5$0[[a,4]]-OG$HF$Box5$0[[a,2]]-(OG$FCI$Box5[[a,4]]-OG$FCI$Box5[[a,2]]))/(OG$FCI$Box5[[a,4]]-OG$FCI$Box5[[a,2]]))},{a,7}];
ΔHFSA$Singles=Table[{OG$FCI$Box5[[a,1]],100((OG$HF$Box5$SA[[a,3]]-OG$HF$Box5$SA[[a,2]]-(OG$FCI$Box5[[a,3]]-OG$FCI$Box5[[a,2]]))/(OG$FCI$Box5[[a,3]]-OG$FCI$Box5[[a,2]]))},{a,7}];
ΔHFSA$Doubles=Table[{OG$FCI$Box5[[a,1]],100((OG$HF$Box5$SA[[a,4]]-OG$HF$Box5$SA[[a,2]]-(OG$FCI$Box5[[a,4]]-OG$FCI$Box5[[a,2]]))/(OG$FCI$Box5[[a,4]]-OG$FCI$Box5[[a,2]]))},{a,7}];
ListLogLinearPlot[{ΔOG0$Singles,ΔOG0$Doubles,ΔOGSA$Singles,ΔOGSA$Doubles,(*ΔOGTDHF$Singles,ΔOGCIS$Singles,*)ΔOGTDLDA$Singles,ΔOGTDA$Singles},OptionsEvsL,
PlotLegends->{MaTeX["\\text{$\\Omega^{(1)}_\\text{eLDA}$ with } \\mathbf{w}=(0,0)",Magnification->SizeLegend],
MaTeX["\\text{$\\Omega^{(2)}_\\text{eLDA}$ with } \\mathbf{w}=(0,0)",Magnification->SizeLegend],
MaTeX["\\text{$\\Omega^{(1)}_\\text{eLDA}$ with } \\mathbf{w}=(1/3,1/3)",Magnification->SizeLegend],
MaTeX["\\text{$\\Omega^{(2)}_\\text{eLDA}$ with } \\mathbf{w}=(1/3,1/3)",Magnification->SizeLegend],
MaTeX["\\Omega^{(1)}_\\text{TDHF}",Magnification->SizeLegend],
MaTeX["\\Omega^{(1)}_\\text{CIS}",Magnification->SizeLegend],
MaTeX["\\Omega^{(1)}_\\text{TDLDA}",Magnification->SizeLegend],
MaTeX["\\Omega^{(1)}_\\text{TDA-TDLDA}",Magnification->SizeLegend]
},
PlotLabel->MaTeX["\\text{$N = 5$}",Magnification->SizeEpilog]]
Export["EvsL_5.pdf",%];

ΔFCI$Singles=Table[{OG$FCI$Box5[[a,1]],((OG$FCI$Box5[[a,1]])^2)(OG$FCI$Box5[[a,3]]-OG$FCI$Box5[[a,2]])},{a,7}];
ΔFCI$Doubles=Table[{OG$FCI$Box5[[a,1]],((OG$FCI$Box5[[a,1]])^2)(OG$FCI$Box5[[a,4]]-OG$FCI$Box5[[a,2]])},{a,7}];
ΔOG0$Singles=Table[{OG$FCI$Box5[[a,1]],((OG$FCI$Box5[[a,1]])^2)(OG$c$Box5$0[[a,3]]-OG$c$Box5$0[[a,2]])},{a,7}];
ΔOG0$Doubles=Table[{OG$FCI$Box5[[a,1]],((OG$FCI$Box5[[a,1]])^2)(OG$c$Box5$0[[a,4]]-OG$c$Box5$0[[a,2]])},{a,7}];
ΔOGSA$Singles=Table[{OG$FCI$Box5[[a,1]],((OG$FCI$Box5[[a,1]])^2)(OG$c$Box5$SA[[a,3]]-OG$c$Box5$SA[[a,2]])},{a,7}];
ΔOGSA$Doubles=Table[{OG$FCI$Box5[[a,1]],((OG$FCI$Box5[[a,1]])^2)(OG$c$Box5$SA[[a,4]]-OG$c$Box5$SA[[a,2]])},{a,7}];
ΔOGTDHF$Singles=Table[{OG$FCI$Box5[[a,1]],((OG$FCI$Box5[[a,1]])^2)(OG$TDHF$Box5[[a,2]])},{a,7}];
ΔOGCIS$Singles=Table[{OG$FCI$Box5[[a,1]],((OG$FCI$Box5[[a,1]])^2)(OG$CIS$Box5[[a,2]])},{a,7}];
ΔOGTDLDA$Singles=Table[{OG$FCI$Box5[[a,1]],((OG$FCI$Box5[[a,1]])^2)(OG$TDLDA$Box5[[a,2]])},{a,7}];
ΔOGTDA$Singles=Table[{OG$FCI$Box5[[a,1]],((OG$FCI$Box5[[a,1]])^2)(OG$TDA$Box5[[a,2]])},{a,7}];
ΔHF0$Singles=Table[{OG$FCI$Box5[[a,1]],((OG$FCI$Box5[[a,1]])^2)(OG$HF$Box5$0[[a,3]]-OG$HF$Box5$0[[a,2]])},{a,7}];
ΔHF0$Doubles=Table[{OG$FCI$Box5[[a,1]],((OG$FCI$Box5[[a,1]])^2)(OG$HF$Box5$0[[a,4]]-OG$HF$Box5$0[[a,2]])},{a,7}];
ΔHFSA$Singles=Table[{OG$FCI$Box5[[a,1]],((OG$FCI$Box5[[a,1]])^2)(OG$HF$Box5$SA[[a,3]]-OG$HF$Box5$SA[[a,2]])},{a,7}];
ΔHFSA$Doubles=Table[{OG$FCI$Box5[[a,1]],((OG$FCI$Box5[[a,1]])^2)(OG$HF$Box5$SA[[a,4]]-OG$HF$Box5$SA[[a,2]])},{a,7}];
Grid[{{
ListLogLinearPlot[{ΔFCI$Doubles,ΔOG0$Doubles,ΔOGSA$Doubles},OptionsEvsL,
PlotLabel->MaTeX["\\text{Double excitation for $N = 5$}",Magnification->SizeEpilog],
FrameLabel->{
MaTeX["\\text{Box length $L$ }",Magnification->SizeLabel],
MaTeX["\\text{$L^2 \\times \\Omega^{(2)}$}",Magnification->SizeLabel]
},
PlotLegends->Placed[{
MaTeX["\\text{$\\Omega^{(2)}_\\text{FCI}$}",Magnification->SizeLegend],
MaTeX["\\text{$\\Omega^{(2)}_\\text{eLDA}$ with } \\mathbf{w}=(0,0)",Magnification->SizeLegend],
MaTeX["\\text{$\\Omega^{(2)}_\\text{eLDA}$ with } \\mathbf{w}=(1/3,1/3)",Magnification->SizeLegend]
},Right]]
},{
ListLogLinearPlot[{ΔFCI$Singles,ΔOG0$Singles,ΔOGSA$Singles,(*ΔOGTDHF$Singles,ΔOGCIS$Singles,*)ΔOGTDLDA$Singles,ΔOGTDA$Singles},OptionsEvsL,
PlotLabel->MaTeX["\\text{Single excitation for $N = 5$}",Magnification->SizeEpilog],
FrameLabel->{
MaTeX["\\text{Box length $L$ }",Magnification->SizeLabel],
MaTeX["\\text{$L^2 \\times \\Omega^{(1)}$}",Magnification->SizeLabel]
},
PlotRange->{All,{40,125}},PlotLegends->Placed[{
MaTeX["\\text{$\\Omega^{(1)}_\\text{FCI}$}",Magnification->SizeLegend],
MaTeX["\\text{$\\Omega^{(1)}_\\text{eLDA}$ with } \\mathbf{w}=(0,0)",Magnification->SizeLegend],
MaTeX["\\text{$\\Omega^{(1)}_\\text{eLDA}$ with } \\mathbf{w}=(1/3,1/3)",Magnification->SizeLegend],
(*MaTeX["\\Omega^{(1)}_\\text{TDHF}",Magnification->SizeLegend],
MaTeX["\\Omega^{(1)}_\\text{CIS}",Magnification->SizeLegend],*)
MaTeX["\\Omega^{(1)}_\\text{TDLDA}",Magnification->SizeLegend],
MaTeX["\\Omega^{(1)}_\\text{TDA-TDLDA}",Magnification->SizeLegend]
},Right]]
}},Spacings->{0,4}]
(*ListLogLinearPlot[{ΔOG0$Singles,ΔOG0$Doubles,ΔOGSA$Singles,ΔOGSA$Doubles,ΔHF0$Singles,ΔHF0$Doubles,ΔHFSA$Singles,ΔHFSA$Doubles},OptionsEvsLHF,
PlotLabel->MaTeX["\\text{$N = 5$}",Magnification->SizeEpilog],
PlotLegends->Placed[{
MaTeX["\\text{$\\Omega^{(1)}_\\text{eLDA}$ with } \\mathbf{w}=(0,0)",Magnification->SizeLegend],
MaTeX["\\text{$\\Omega^{(2)}_\\text{eLDA}$ with } \\mathbf{w}=(0,0)",Magnification->SizeLegend],
MaTeX["\\text{$\\Omega^{(1)}_\\text{eLDA}$ with } \\mathbf{w}=(1/3,1/3)",Magnification->SizeLegend],
MaTeX["\\text{$\\Omega^{(2)}_\\text{eLDA}$ with } \\mathbf{w}=(1/3,1/3)",Magnification->SizeLegend],
MaTeX["\\text{$\\Omega^{(1)}_\\text{eHF}$ with } \\mathbf{w}=(0,0)",Magnification->SizeLegend],
MaTeX["\\text{$\\Omega^{(2)}_\\text{eHF}$ with } \\mathbf{w}=(0,0)",Magnification->SizeLegend],
MaTeX["\\text{$\\Omega^{(1)}_\\text{eHF}$ with } \\mathbf{w}=(1/3,1/3)",Magnification->SizeLegend],
MaTeX["\\text{$\\Omega^{(2)}_\\text{eHF}$ with } \\mathbf{w}=(1/3,1/3)",Magnification->SizeLegend],
},Right]]*)

ΔOG0$Singles=Table[{OG$FCI$Box5[[a,1]],100((OG$c$Box5$0[[a,3]]-OG$c$Box5$0[[a,2]]-(OG$FCI$Box5[[a,3]]-OG$FCI$Box5[[a,2]]))/(OG$FCI$Box5[[a,3]]-OG$FCI$Box5[[a,2]]))},{a,7}];
ΔOG0$Doubles=Table[{OG$FCI$Box5[[a,1]],100((OG$c$Box5$0[[a,4]]-OG$c$Box5$0[[a,2]]-(OG$FCI$Box5[[a,4]]-OG$FCI$Box5[[a,2]]))/(OG$FCI$Box5[[a,4]]-OG$FCI$Box5[[a,2]]))},{a,7}];
ΔOGSA$Singles=Table[{OG$FCI$Box5[[a,1]],100((OG$c$Box5$SA[[a,3]]-OG$c$Box5$SA[[a,2]]-(OG$FCI$Box5[[a,3]]-OG$FCI$Box5[[a,2]]))/(OG$FCI$Box5[[a,3]]-OG$FCI$Box5[[a,2]]))},{a,7}];
ΔOGSA$Doubles=Table[{OG$FCI$Box5[[a,1]],100((OG$c$Box5$SA[[a,4]]-OG$c$Box5$SA[[a,2]]-(OG$FCI$Box5[[a,4]]-OG$FCI$Box5[[a,2]]))/(OG$FCI$Box5[[a,4]]-OG$FCI$Box5[[a,2]]))},{a,7}];
ΔHF0$Singles=Table[{OG$FCI$Box5[[a,1]],100((OG$HF$Box5$0[[a,3]]-OG$HF$Box5$0[[a,2]]-(OG$FCI$Box5[[a,3]]-OG$FCI$Box5[[a,2]]))/(OG$FCI$Box5[[a,3]]-OG$FCI$Box5[[a,2]]))},{a,7}];
ΔHF0$Doubles=Table[{OG$FCI$Box5[[a,1]],100((OG$HF$Box5$0[[a,4]]-OG$HF$Box5$0[[a,2]]-(OG$FCI$Box5[[a,4]]-OG$FCI$Box5[[a,2]]))/(OG$FCI$Box5[[a,4]]-OG$FCI$Box5[[a,2]]))},{a,7}];
ΔHFSA$Singles=Table[{OG$FCI$Box5[[a,1]],100((OG$HF$Box5$SA[[a,3]]-OG$HF$Box5$SA[[a,2]]-(OG$FCI$Box5[[a,3]]-OG$FCI$Box5[[a,2]]))/(OG$FCI$Box5[[a,3]]-OG$FCI$Box5[[a,2]]))},{a,7}];
ΔHFSA$Doubles=Table[{OG$FCI$Box5[[a,1]],100((OG$HF$Box5$SA[[a,4]]-OG$HF$Box5$SA[[a,2]]-(OG$FCI$Box5[[a,4]]-OG$FCI$Box5[[a,2]]))/(OG$FCI$Box5[[a,4]]-OG$FCI$Box5[[a,2]]))},{a,7}];
Grid[{{
ListLogLinearPlot[{ΔOG0$Doubles,ΔOGSA$Doubles,ΔHF0$Doubles,ΔHFSA$Doubles},OptionsEvsLHF,
PlotLabel->MaTeX["\\text{Double excitation for $N = 5$}",Magnification->SizeEpilog],
FrameLabel->{
MaTeX["\\text{Box length $L$ }",Magnification->SizeLabel],
MaTeX["\\text{Error wrt FCI (\\%)}",Magnification->SizeLabel]
},
PlotLegends->Placed[{
MaTeX["\\text{$\\Omega^{(2)}_\\text{eLDA}$ with } \\mathbf{w}=(0,0)",Magnification->SizeLegend],
MaTeX["\\text{$\\Omega^{(2)}_\\text{eLDA}$ with } \\mathbf{w}=(1/3,1/3)",Magnification->SizeLegend],
MaTeX["\\text{$\\Omega^{(2)}_\\text{eHF}$ with } \\mathbf{w}=(0,0)",Magnification->SizeLegend],
MaTeX["\\text{$\\Omega^{(2)}_\\text{eHF}$ with } \\mathbf{w}=(1/3,1/3)",Magnification->SizeLegend]
},Right]]
},{
ListLogLinearPlot[{ΔOG0$Singles,ΔOGSA$Singles,ΔHF0$Singles,ΔHFSA$Singles},OptionsEvsLHF,
PlotLabel->MaTeX["\\text{Single excitation for $N = 5$}",Magnification->SizeEpilog],
FrameLabel->{
MaTeX["\\text{Box length $L$ }",Magnification->SizeLabel],
MaTeX["\\text{Error wrt FCI (\\%)}",Magnification->SizeLabel]
},
PlotRange->{Automatic,{-10,65}},
PlotLegends->Placed[{
MaTeX["\\text{$\\Omega^{(1)}_\\text{eLDA}$ with } \\mathbf{w}=(0,0)",Magnification->SizeLegend],
MaTeX["\\text{$\\Omega^{(1)}_\\text{eLDA}$ with } \\mathbf{w}=(1/3,1/3)",Magnification->SizeLegend],
MaTeX["\\text{$\\Omega^{(1)}_\\text{eHF}$ with } \\mathbf{w}=(0,0)",Magnification->SizeLegend],
MaTeX["\\text{$\\Omega^{(1)}_\\text{eHF}$ with } \\mathbf{w}=(1/3,1/3)",Magnification->SizeLegend]
},Right]]
}},Spacings->{0,4}]

N=6

ΔOG0$Singles=Table[{OG$FCI$Box6[[a,1]],100((OG$c$Box6$0[[a,3]]-OG$c$Box6$0[[a,2]]-(OG$FCI$Box6[[a,3]]-OG$FCI$Box6[[a,2]]))/(OG$FCI$Box6[[a,3]]-OG$FCI$Box6[[a,2]]))},{a,7}];
ΔOG0$Doubles=Table[{OG$FCI$Box6[[a,1]],100((OG$c$Box6$0[[a,4]]-OG$c$Box6$0[[a,2]]-(OG$FCI$Box6[[a,4]]-OG$FCI$Box6[[a,2]]))/(OG$FCI$Box6[[a,4]]-OG$FCI$Box6[[a,2]]))},{a,7}];
ΔOGSA$Singles=Table[{OG$FCI$Box6[[a,1]],100((OG$c$Box6$SA[[a,3]]-OG$c$Box6$SA[[a,2]]-(OG$FCI$Box6[[a,3]]-OG$FCI$Box6[[a,2]]))/(OG$FCI$Box6[[a,3]]-OG$FCI$Box6[[a,2]]))},{a,7}];
ΔOGSA$Doubles=Table[{OG$FCI$Box6[[a,1]],100((OG$c$Box6$SA[[a,4]]-OG$c$Box6$SA[[a,2]]-(OG$FCI$Box6[[a,4]]-OG$FCI$Box6[[a,2]]))/(OG$FCI$Box6[[a,4]]-OG$FCI$Box6[[a,2]]))},{a,7}];
ΔOGTDHF$Singles=Table[{OG$FCI$Box6[[a,1]],100((OG$TDHF$Box6[[a,2]]-(OG$FCI$Box6[[a,3]]-OG$FCI$Box6[[a,2]]))/(OG$FCI$Box6[[a,4]]-OG$FCI$Box6[[a,2]]))},{a,7}];
ΔOGCIS$Singles=Table[{OG$FCI$Box6[[a,1]],100((OG$CIS$Box6[[a,2]]-(OG$FCI$Box6[[a,3]]-OG$FCI$Box6[[a,2]]))/(OG$FCI$Box6[[a,4]]-OG$FCI$Box6[[a,2]]))},{a,7}];
ΔOGTDLDA$Singles=Table[{OG$FCI$Box6[[a,1]],100((OG$TDLDA$Box6[[a,2]]-(OG$FCI$Box6[[a,3]]-OG$FCI$Box6[[a,2]]))/(OG$FCI$Box6[[a,4]]-OG$FCI$Box6[[a,2]]))},{a,7}];
ΔOGTDA$Singles=Table[{OG$FCI$Box6[[a,1]],100((OG$TDA$Box6[[a,2]]-(OG$FCI$Box6[[a,3]]-OG$FCI$Box6[[a,2]]))/(OG$FCI$Box6[[a,4]]-OG$FCI$Box6[[a,2]]))},{a,7}];
ΔHF0$Singles=Table[{OG$FCI$Box6[[a,1]],100((OG$HF$Box6$0[[a,3]]-OG$HF$Box6$0[[a,2]]-(OG$FCI$Box6[[a,3]]-OG$FCI$Box6[[a,2]]))/(OG$FCI$Box6[[a,3]]-OG$FCI$Box6[[a,2]]))},{a,7}];
ΔHF0$Doubles=Table[{OG$FCI$Box6[[a,1]],100((OG$HF$Box6$0[[a,4]]-OG$HF$Box6$0[[a,2]]-(OG$FCI$Box6[[a,4]]-OG$FCI$Box6[[a,2]]))/(OG$FCI$Box6[[a,4]]-OG$FCI$Box6[[a,2]]))},{a,7}];
ΔHFSA$Singles=Table[{OG$FCI$Box6[[a,1]],100((OG$HF$Box6$SA[[a,3]]-OG$HF$Box6$SA[[a,2]]-(OG$FCI$Box6[[a,3]]-OG$FCI$Box6[[a,2]]))/(OG$FCI$Box6[[a,3]]-OG$FCI$Box6[[a,2]]))},{a,7}];
ΔHFSA$Doubles=Table[{OG$FCI$Box6[[a,1]],100((OG$HF$Box6$SA[[a,4]]-OG$HF$Box6$SA[[a,2]]-(OG$FCI$Box6[[a,4]]-OG$FCI$Box6[[a,2]]))/(OG$FCI$Box6[[a,4]]-OG$FCI$Box6[[a,2]]))},{a,7}];
ListLogLinearPlot[{ΔOG0$Singles,ΔOG0$Doubles,ΔOGSA$Singles,ΔOGSA$Doubles,(*ΔOGTDHF$Singles,ΔOGCIS$Singles,*)ΔOGTDLDA$Singles,ΔOGTDA$Singles},OptionsEvsL,
PlotLabel->MaTeX["\\text{$N = 6$}",Magnification->SizeEpilog]]
Export["EvsL_6.pdf",%];
(*ListLogLinearPlot[{ΔOG0$Singles,ΔOG0$Doubles,ΔOGSA$Singles,ΔOGSA$Doubles,ΔHF0$Singles,ΔHF0$Doubles,ΔHFSA$Singles,ΔHFSA$Doubles},OptionsEvsLHF,
PlotLabel->MaTeX["\\text{$N = 6$}",Magnification->SizeEpilog]]*)

N=7

ΔOG0$Singles=Table[{OG$FCI$Box7[[a,1]],100((OG$c$Box7$0[[a,3]]-OG$c$Box7$0[[a,2]]-(OG$FCI$Box7[[a,3]]-OG$FCI$Box7[[a,2]]))/(OG$FCI$Box7[[a,3]]-OG$FCI$Box7[[a,2]]))},{a,7}];
ΔOG0$Doubles=Table[{OG$FCI$Box7[[a,1]],100((OG$c$Box7$0[[a,4]]-OG$c$Box7$0[[a,2]]-(OG$FCI$Box7[[a,4]]-OG$FCI$Box7[[a,2]]))/(OG$FCI$Box7[[a,4]]-OG$FCI$Box7[[a,2]]))},{a,7}];
ΔOGSA$Singles=Table[{OG$FCI$Box7[[a,1]],100((OG$c$Box7$SA[[a,3]]-OG$c$Box7$SA[[a,2]]-(OG$FCI$Box7[[a,3]]-OG$FCI$Box7[[a,2]]))/(OG$FCI$Box7[[a,3]]-OG$FCI$Box7[[a,2]]))},{a,7}];
ΔOGSA$Doubles=Table[{OG$FCI$Box7[[a,1]],100((OG$c$Box7$SA[[a,4]]-OG$c$Box7$SA[[a,2]]-(OG$FCI$Box7[[a,4]]-OG$FCI$Box7[[a,2]]))/(OG$FCI$Box7[[a,4]]-OG$FCI$Box7[[a,2]]))},{a,7}];
ΔOGTDHF$Singles=Table[{OG$FCI$Box7[[a,1]],100((OG$TDHF$Box7[[a,2]]-(OG$FCI$Box7[[a,3]]-OG$FCI$Box7[[a,2]]))/(OG$FCI$Box7[[a,4]]-OG$FCI$Box7[[a,2]]))},{a,7}];
ΔOGCIS$Singles=Table[{OG$FCI$Box7[[a,1]],100((OG$CIS$Box7[[a,2]]-(OG$FCI$Box7[[a,3]]-OG$FCI$Box7[[a,2]]))/(OG$FCI$Box7[[a,4]]-OG$FCI$Box7[[a,2]]))},{a,7}];
ΔOGTDLDA$Singles=Table[{OG$FCI$Box7[[a,1]],100((OG$TDLDA$Box7[[a,2]]-(OG$FCI$Box7[[a,3]]-OG$FCI$Box7[[a,2]]))/(OG$FCI$Box7[[a,4]]-OG$FCI$Box7[[a,2]]))},{a,7}];
ΔOGTDA$Singles=Table[{OG$FCI$Box7[[a,1]],100((OG$TDA$Box7[[a,2]]-(OG$FCI$Box7[[a,3]]-OG$FCI$Box7[[a,2]]))/(OG$FCI$Box7[[a,4]]-OG$FCI$Box7[[a,2]]))},{a,7}];
ΔHF0$Singles=Table[{OG$FCI$Box7[[a,1]],100((OG$HF$Box7$0[[a,3]]-OG$HF$Box7$0[[a,2]]-(OG$FCI$Box7[[a,3]]-OG$FCI$Box7[[a,2]]))/(OG$FCI$Box7[[a,3]]-OG$FCI$Box7[[a,2]]))},{a,7}];
ΔHF0$Doubles=Table[{OG$FCI$Box7[[a,1]],100((OG$HF$Box7$0[[a,4]]-OG$HF$Box7$0[[a,2]]-(OG$FCI$Box7[[a,4]]-OG$FCI$Box7[[a,2]]))/(OG$FCI$Box7[[a,4]]-OG$FCI$Box7[[a,2]]))},{a,7}];
ΔHFSA$Singles=Table[{OG$FCI$Box7[[a,1]],100((OG$HF$Box7$SA[[a,3]]-OG$HF$Box7$SA[[a,2]]-(OG$FCI$Box7[[a,3]]-OG$FCI$Box7[[a,2]]))/(OG$FCI$Box7[[a,3]]-OG$FCI$Box7[[a,2]]))},{a,7}];
ΔHFSA$Doubles=Table[{OG$FCI$Box7[[a,1]],100((OG$HF$Box7$SA[[a,4]]-OG$HF$Box7$SA[[a,2]]-(OG$FCI$Box7[[a,4]]-OG$FCI$Box7[[a,2]]))/(OG$FCI$Box7[[a,4]]-OG$FCI$Box7[[a,2]]))},{a,7}];
ListLogLinearPlot[{ΔOG0$Singles,ΔOG0$Doubles,ΔOGSA$Singles,ΔOGSA$Doubles,(*ΔOGTDHF$Singles,ΔOGCIS$Singles,*)ΔOGTDLDA$Singles,ΔOGTDA$Singles},OptionsEvsL,
PlotLabel->MaTeX["\\text{$N = 7$}",Magnification->SizeEpilog]]
Export["EvsL_7.pdf",%];
ListLogLinearPlot[{ΔOG0$Doubles,ΔOGSA$Doubles,ΔHF0$Doubles,ΔHFSA$Doubles},OptionsEvsLHF,
PlotLabel->MaTeX["\\text{$N = 7$}",Magnification->SizeEpilog]]
ListLogLinearPlot[{ΔOG0$Singles,ΔOGSA$Singles,ΔHF0$Singles,ΔHFSA$Singles},OptionsEvsLHF,
PlotLabel->MaTeX["\\text{$N = 7$}",Magnification->SizeEpilog]]

Plots E vs N

Options

SizeLegend=2;
SizeEpilog=3;
SizeLabel=3;

OptionsEvsN={
PlotTheme->"Scientific",
PlotStyle->{{Thickness[0.01],Black},{Thickness[0.01],Red},{Thickness[0.01],Blue},{Thickness[0.01],Darker[Green]},{Thickness[0.01],Orange},{Thickness[0.01],Purple},{Thickness[0.01],Magenta},{Thickness[0.01],Cyan}},
AspectRatio->1,
PlotMarkers->{"OpenMarkers",Large},
Frame->True,
FrameStyle->Directive[Thick,26],
ImageSize->Large,
Joined->True,
PlotRange->All,FrameLabel->{
MaTeX["\\text{Number of electrons $N$ }",Magnification->SizeLabel],
MaTeX["\\text{Error wrt FCI (\\%)}",Magnification->SizeLabel]
}
};

OptionsEvsNHF={
PlotTheme->"Scientific",
PlotStyle->{{Thickness[0.01],Black},{Thickness[0.01],Red},{Thickness[0.01],Blue},{Thickness[0.01],Darker[Green]},
{Thickness[0.01],Dashing[0.02],Black},{Thickness[0.01],Dashing[0.02],Red},{Thickness[0.01],Dashing[0.02],Blue},{Thickness[0.01],Dashing[0.02],Darker[Green]}},
AspectRatio->1,
PlotMarkers->{"OpenMarkers",Large},
Frame->True,
FrameStyle->Directive[Thick,26],
ImageSize->Large,
Joined->True,
PlotRange->All,FrameLabel->{
MaTeX["\\text{Number of electrons $N$ }",Magnification->SizeLabel],
MaTeX["\\text{Error wrt FCI (\\%)}",Magnification->SizeLabel]
}
};

L=π/8

With[{pts=1},
FCI$Singles={
{2,OG$FCI$Box2[[pts,3]]-OG$FCI$Box2[[pts,2]]},
{3,OG$FCI$Box3[[pts,3]]-OG$FCI$Box3[[pts,2]]},
{4,OG$FCI$Box4[[pts,3]]-OG$FCI$Box4[[pts,2]]},
{5,OG$FCI$Box5[[pts,3]]-OG$FCI$Box5[[pts,2]]},
{6,OG$FCI$Box6[[pts,3]]-OG$FCI$Box6[[pts,2]]},
{7,OG$FCI$Box7[[pts,3]]-OG$FCI$Box7[[pts,2]]}
};
FCI$Doubles={
{2,OG$FCI$Box2[[pts,4]]-OG$FCI$Box2[[pts,2]]},
{3,OG$FCI$Box3[[pts,4]]-OG$FCI$Box3[[pts,2]]},
{4,OG$FCI$Box4[[pts,4]]-OG$FCI$Box4[[pts,2]]},
{5,OG$FCI$Box5[[pts,4]]-OG$FCI$Box5[[pts,2]]},
{6,OG$FCI$Box6[[pts,4]]-OG$FCI$Box6[[pts,2]]},
{7,OG$FCI$Box7[[pts,4]]-OG$FCI$Box7[[pts,2]]}
};
OG0$Singles={
{2,OG$c$Box2$0[[pts,3]]-OG$c$Box2$0[[pts,2]]},
{3,OG$c$Box3$0[[pts,3]]-OG$c$Box3$0[[pts,2]]},
{4,OG$c$Box4$0[[pts,3]]-OG$c$Box4$0[[pts,2]]},
{5,OG$c$Box5$0[[pts,3]]-OG$c$Box5$0[[pts,2]]},
{6,OG$c$Box6$0[[pts,3]]-OG$c$Box6$0[[pts,2]]},
{7,OG$c$Box7$0[[pts,3]]-OG$c$Box7$0[[pts,2]]}
};
OG0$Doubles={
{2,OG$c$Box2$0[[pts,4]]-OG$c$Box2$0[[pts,2]]},
{3,OG$c$Box3$0[[pts,4]]-OG$c$Box3$0[[pts,2]]},
{4,OG$c$Box4$0[[pts,4]]-OG$c$Box4$0[[pts,2]]},
{5,OG$c$Box5$0[[pts,4]]-OG$c$Box5$0[[pts,2]]},
{6,OG$c$Box6$0[[pts,4]]-OG$c$Box6$0[[pts,2]]},
{7,OG$c$Box7$0[[pts,4]]-OG$c$Box7$0[[pts,2]]}
};
OGSA$Singles={
{2,OG$c$Box2$SA[[pts,3]]-OG$c$Box2$SA[[pts,2]]},
{3,OG$c$Box3$SA[[pts,3]]-OG$c$Box3$SA[[pts,2]]},
{4,OG$c$Box4$SA[[pts,3]]-OG$c$Box4$SA[[pts,2]]},
{5,OG$c$Box5$SA[[pts,3]]-OG$c$Box5$SA[[pts,2]]},
{6,OG$c$Box6$SA[[pts,3]]-OG$c$Box6$SA[[pts,2]]},
{7,OG$c$Box7$SA[[pts,3]]-OG$c$Box7$SA[[pts,2]]}
};
OGSA$Doubles={
{2,OG$c$Box2$SA[[pts,4]]-OG$c$Box2$SA[[pts,2]]},
{3,OG$c$Box3$SA[[pts,4]]-OG$c$Box3$SA[[pts,2]]},
{4,OG$c$Box4$SA[[pts,4]]-OG$c$Box4$SA[[pts,2]]},
{5,OG$c$Box5$SA[[pts,4]]-OG$c$Box5$SA[[pts,2]]},
{6,OG$c$Box6$SA[[pts,4]]-OG$c$Box6$SA[[pts,2]]},
{7,OG$c$Box7$SA[[pts,4]]-OG$c$Box7$SA[[pts,2]]}
};
HF0$Singles={
{2,OG$HF$Box2$0[[pts,3]]-OG$HF$Box2$0[[pts,2]]},
{3,OG$HF$Box3$0[[pts,3]]-OG$HF$Box3$0[[pts,2]]},
{4,OG$HF$Box4$0[[pts,3]]-OG$HF$Box4$0[[pts,2]]},
{5,OG$HF$Box5$0[[pts,3]]-OG$HF$Box5$0[[pts,2]]},
{6,OG$HF$Box6$0[[pts,3]]-OG$HF$Box6$0[[pts,2]]},
{7,OG$HF$Box7$0[[pts,3]]-OG$HF$Box7$0[[pts,2]]}
};
HF0$Doubles={
{2,OG$HF$Box2$0[[pts,4]]-OG$HF$Box2$0[[pts,2]]},
{3,OG$HF$Box3$0[[pts,4]]-OG$HF$Box3$0[[pts,2]]},
{4,OG$HF$Box4$0[[pts,4]]-OG$HF$Box4$0[[pts,2]]},
{5,OG$HF$Box5$0[[pts,4]]-OG$HF$Box5$0[[pts,2]]},
{6,OG$HF$Box6$0[[pts,4]]-OG$HF$Box6$0[[pts,2]]},
{7,OG$HF$Box7$0[[pts,4]]-OG$HF$Box7$0[[pts,2]]}
};
HFSA$Singles={
{2,OG$HF$Box2$SA[[pts,3]]-OG$HF$Box2$SA[[pts,2]]},
{3,OG$HF$Box3$SA[[pts,3]]-OG$HF$Box3$SA[[pts,2]]},
{4,OG$HF$Box4$SA[[pts,3]]-OG$HF$Box4$SA[[pts,2]]},
{5,OG$HF$Box5$SA[[pts,3]]-OG$HF$Box5$SA[[pts,2]]},
{6,OG$HF$Box6$SA[[pts,3]]-OG$HF$Box6$SA[[pts,2]]},
{7,OG$HF$Box7$SA[[pts,3]]-OG$HF$Box7$SA[[pts,2]]}
};
HFSA$Doubles={
{2,OG$HF$Box2$SA[[pts,4]]-OG$HF$Box2$SA[[pts,2]]},
{3,OG$HF$Box3$SA[[pts,4]]-OG$HF$Box3$SA[[pts,2]]},
{4,OG$HF$Box4$SA[[pts,4]]-OG$HF$Box4$SA[[pts,2]]},
{5,OG$HF$Box5$SA[[pts,4]]-OG$HF$Box5$SA[[pts,2]]},
{6,OG$HF$Box6$SA[[pts,4]]-OG$HF$Box6$SA[[pts,2]]},
{7,OG$HF$Box7$SA[[pts,4]]-OG$HF$Box7$SA[[pts,2]]}
};
OGTDHF$Singles={
{2,OG$TDHF$Box2[[pts,2]]},
{3,OG$TDHF$Box3[[pts,2]]},
{4,OG$TDHF$Box4[[pts,2]]},
{5,OG$TDHF$Box5[[pts,2]]},
{6,OG$TDHF$Box6[[pts,2]]},
{7,OG$TDHF$Box7[[pts,2]]}
};
OGCIS$Singles={
{2,OG$CIS$Box2[[pts,2]]},
{3,OG$CIS$Box3[[pts,2]]},
{4,OG$CIS$Box4[[pts,2]]},
{5,OG$CIS$Box5[[pts,2]]},
{6,OG$CIS$Box6[[pts,2]]},
{7,OG$CIS$Box7[[pts,2]]}
};
OGTDLDA$Singles={
{2,OG$TDLDA$Box2[[pts,2]]},
{3,OG$TDLDA$Box3[[pts,2]]},
{4,OG$TDLDA$Box4[[pts,2]]},
{5,OG$TDLDA$Box5[[pts,2]]},
{6,OG$TDLDA$Box6[[pts,2]]},
{7,OG$TDLDA$Box7[[pts,2]]}
};
OGTDA$Singles={
{2,OG$TDA$Box2[[pts,2]]},
{3,OG$TDA$Box3[[pts,2]]},
{4,OG$TDA$Box4[[pts,2]]},
{5,OG$TDA$Box5[[pts,2]]},
{6,OG$TDA$Box6[[pts,2]]},
{7,OG$TDA$Box7[[pts,2]]}
};
]

ΔOG0$Singles=Table[{FCI$Singles[[a,1]],100((OG0$Singles[[a,2]]-FCI$Singles[[a,2]])/(FCI$Singles[[a,2]]))},{a,6}];
ΔOG0$Doubles=Table[{FCI$Doubles[[a,1]],100((OG0$Doubles[[a,2]]-FCI$Doubles[[a,2]])/(FCI$Doubles[[a,2]]))},{a,6}];
ΔOGSA$Singles=Table[{FCI$Singles[[a,1]],100((OGSA$Singles[[a,2]]-FCI$Singles[[a,2]])/(FCI$Singles[[a,2]]))},{a,6}];
ΔOGSA$Doubles=Table[{FCI$Doubles[[a,1]],100((OGSA$Doubles[[a,2]]-FCI$Doubles[[a,2]])/(FCI$Doubles[[a,2]]))},{a,6}];
ΔHF0$Singles=Table[{FCI$Singles[[a,1]],100((HF0$Singles[[a,2]]-FCI$Singles[[a,2]])/(FCI$Singles[[a,2]]))},{a,6}];
ΔHF0$Doubles=Table[{FCI$Doubles[[a,1]],100((HF0$Doubles[[a,2]]-FCI$Doubles[[a,2]])/(FCI$Doubles[[a,2]]))},{a,6}];
ΔHFSA$Singles=Table[{FCI$Singles[[a,1]],100((HFSA$Singles[[a,2]]-FCI$Singles[[a,2]])/(FCI$Singles[[a,2]]))},{a,6}];
ΔHFSA$Doubles=Table[{FCI$Doubles[[a,1]],100((HFSA$Doubles[[a,2]]-FCI$Doubles[[a,2]])/(FCI$Doubles[[a,2]]))},{a,6}];
ΔOGTDHF$Singles=Table[{FCI$Singles[[a,1]],100((OGTDHF$Singles[[a,2]]-FCI$Singles[[a,2]])/(FCI$Singles[[a,2]]))},{a,6}];
ΔOGCIS$Singles=Table[{FCI$Singles[[a,1]],100((OGCIS$Singles[[a,2]]-FCI$Singles[[a,2]])/(FCI$Singles[[a,2]]))},{a,6}];
ΔOGTDLDA$Singles=Table[{FCI$Singles[[a,1]],100((OGTDLDA$Singles[[a,2]]-FCI$Singles[[a,2]])/(FCI$Singles[[a,2]]))},{a,6}];
ΔOGTDA$Singles=Table[{FCI$Singles[[a,1]],100((OGTDA$Singles[[a,2]]-FCI$Singles[[a,2]])/(FCI$Singles[[a,2]]))},{a,6}];
EvsNπ8=ListPlot[{ΔOG0$Singles,ΔOG0$Doubles,ΔOGSA$Singles,ΔOGSA$Doubles,ΔOGTDLDA$Singles,ΔOGTDA$Singles},OptionsEvsN,
PlotLabel->MaTeX["\\text{$L = \\pi/8$ }",Magnification->SizeEpilog]]
Export["EvsN_0125.pdf",%];

L=π/4

With[{pts=2},
FCI$Singles={
{2,OG$FCI$Box2[[pts,3]]-OG$FCI$Box2[[pts,2]]},
{3,OG$FCI$Box3[[pts,3]]-OG$FCI$Box3[[pts,2]]},
{4,OG$FCI$Box4[[pts,3]]-OG$FCI$Box4[[pts,2]]},
{5,OG$FCI$Box5[[pts,3]]-OG$FCI$Box5[[pts,2]]},
{6,OG$FCI$Box6[[pts,3]]-OG$FCI$Box6[[pts,2]]},
{7,OG$FCI$Box7[[pts,3]]-OG$FCI$Box7[[pts,2]]}
};
FCI$Doubles={
{2,OG$FCI$Box2[[pts,4]]-OG$FCI$Box2[[pts,2]]},
{3,OG$FCI$Box3[[pts,4]]-OG$FCI$Box3[[pts,2]]},
{4,OG$FCI$Box4[[pts,4]]-OG$FCI$Box4[[pts,2]]},
{5,OG$FCI$Box5[[pts,4]]-OG$FCI$Box5[[pts,2]]},
{6,OG$FCI$Box6[[pts,4]]-OG$FCI$Box6[[pts,2]]},
{7,OG$FCI$Box7[[pts,4]]-OG$FCI$Box7[[pts,2]]}
};
OG0$Singles={
{2,OG$c$Box2$0[[pts,3]]-OG$c$Box2$0[[pts,2]]},
{3,OG$c$Box3$0[[pts,3]]-OG$c$Box3$0[[pts,2]]},
{4,OG$c$Box4$0[[pts,3]]-OG$c$Box4$0[[pts,2]]},
{5,OG$c$Box5$0[[pts,3]]-OG$c$Box5$0[[pts,2]]},
{6,OG$c$Box6$0[[pts,3]]-OG$c$Box6$0[[pts,2]]},
{7,OG$c$Box7$0[[pts,3]]-OG$c$Box7$0[[pts,2]]}
};
OG0$Doubles={
{2,OG$c$Box2$0[[pts,4]]-OG$c$Box2$0[[pts,2]]},
{3,OG$c$Box3$0[[pts,4]]-OG$c$Box3$0[[pts,2]]},
{4,OG$c$Box4$0[[pts,4]]-OG$c$Box4$0[[pts,2]]},
{5,OG$c$Box5$0[[pts,4]]-OG$c$Box5$0[[pts,2]]},
{6,OG$c$Box6$0[[pts,4]]-OG$c$Box6$0[[pts,2]]},
{7,OG$c$Box7$0[[pts,4]]-OG$c$Box7$0[[pts,2]]}
};
OGSA$Singles={
{2,OG$c$Box2$SA[[pts,3]]-OG$c$Box2$SA[[pts,2]]},
{3,OG$c$Box3$SA[[pts,3]]-OG$c$Box3$SA[[pts,2]]},
{4,OG$c$Box4$SA[[pts,3]]-OG$c$Box4$SA[[pts,2]]},
{5,OG$c$Box5$SA[[pts,3]]-OG$c$Box5$SA[[pts,2]]},
{6,OG$c$Box6$SA[[pts,3]]-OG$c$Box6$SA[[pts,2]]},
{7,OG$c$Box7$SA[[pts,3]]-OG$c$Box7$SA[[pts,2]]}
};
OGSA$Doubles={
{2,OG$c$Box2$SA[[pts,4]]-OG$c$Box2$SA[[pts,2]]},
{3,OG$c$Box3$SA[[pts,4]]-OG$c$Box3$SA[[pts,2]]},
{4,OG$c$Box4$SA[[pts,4]]-OG$c$Box4$SA[[pts,2]]},
{5,OG$c$Box5$SA[[pts,4]]-OG$c$Box5$SA[[pts,2]]},
{6,OG$c$Box6$SA[[pts,4]]-OG$c$Box6$SA[[pts,2]]},
{7,OG$c$Box7$SA[[pts,4]]-OG$c$Box7$SA[[pts,2]]}
};
HF0$Singles={
{2,OG$HF$Box2$0[[pts,3]]-OG$HF$Box2$0[[pts,2]]},
{3,OG$HF$Box3$0[[pts,3]]-OG$HF$Box3$0[[pts,2]]},
{4,OG$HF$Box4$0[[pts,3]]-OG$HF$Box4$0[[pts,2]]},
{5,OG$HF$Box5$0[[pts,3]]-OG$HF$Box5$0[[pts,2]]},
{6,OG$HF$Box6$0[[pts,3]]-OG$HF$Box6$0[[pts,2]]},
{7,OG$HF$Box7$0[[pts,3]]-OG$HF$Box7$0[[pts,2]]}
};
HF0$Doubles={
{2,OG$HF$Box2$0[[pts,4]]-OG$HF$Box2$0[[pts,2]]},
{3,OG$HF$Box3$0[[pts,4]]-OG$HF$Box3$0[[pts,2]]},
{4,OG$HF$Box4$0[[pts,4]]-OG$HF$Box4$0[[pts,2]]},
{5,OG$HF$Box5$0[[pts,4]]-OG$HF$Box5$0[[pts,2]]},
{6,OG$HF$Box6$0[[pts,4]]-OG$HF$Box6$0[[pts,2]]},
{7,OG$HF$Box7$0[[pts,4]]-OG$HF$Box7$0[[pts,2]]}
};
HFSA$Singles={
{2,OG$HF$Box2$SA[[pts,3]]-OG$HF$Box2$SA[[pts,2]]},
{3,OG$HF$Box3$SA[[pts,3]]-OG$HF$Box3$SA[[pts,2]]},
{4,OG$HF$Box4$SA[[pts,3]]-OG$HF$Box4$SA[[pts,2]]},
{5,OG$HF$Box5$SA[[pts,3]]-OG$HF$Box5$SA[[pts,2]]},
{6,OG$HF$Box6$SA[[pts,3]]-OG$HF$Box6$SA[[pts,2]]},
{7,OG$HF$Box7$SA[[pts,3]]-OG$HF$Box7$SA[[pts,2]]}
};
HFSA$Doubles={
{2,OG$HF$Box2$SA[[pts,4]]-OG$HF$Box2$SA[[pts,2]]},
{3,OG$HF$Box3$SA[[pts,4]]-OG$HF$Box3$SA[[pts,2]]},
{4,OG$HF$Box4$SA[[pts,4]]-OG$HF$Box4$SA[[pts,2]]},
{5,OG$HF$Box5$SA[[pts,4]]-OG$HF$Box5$SA[[pts,2]]},
{6,OG$HF$Box6$SA[[pts,4]]-OG$HF$Box6$SA[[pts,2]]},
{7,OG$HF$Box7$SA[[pts,4]]-OG$HF$Box7$SA[[pts,2]]}
};
OGTDHF$Singles={
{2,OG$TDHF$Box2[[pts,2]]},
{3,OG$TDHF$Box3[[pts,2]]},
{4,OG$TDHF$Box4[[pts,2]]},
{5,OG$TDHF$Box5[[pts,2]]},
{6,OG$TDHF$Box6[[pts,2]]},
{7,OG$TDHF$Box7[[pts,2]]}
};
OGCIS$Singles={
{2,OG$CIS$Box2[[pts,2]]},
{3,OG$CIS$Box3[[pts,2]]},
{4,OG$CIS$Box4[[pts,2]]},
{5,OG$CIS$Box5[[pts,2]]},
{6,OG$CIS$Box6[[pts,2]]},
{7,OG$CIS$Box7[[pts,2]]}
};
OGTDLDA$Singles={
{2,OG$TDLDA$Box2[[pts,2]]},
{3,OG$TDLDA$Box3[[pts,2]]},
{4,OG$TDLDA$Box4[[pts,2]]},
{5,OG$TDLDA$Box5[[pts,2]]},
{6,OG$TDLDA$Box6[[pts,2]]},
{7,OG$TDLDA$Box7[[pts,2]]}
};
OGTDA$Singles={
{2,OG$TDA$Box2[[pts,2]]},
{3,OG$TDA$Box3[[pts,2]]},
{4,OG$TDA$Box4[[pts,2]]},
{5,OG$TDA$Box5[[pts,2]]},
{6,OG$TDA$Box6[[pts,2]]},
{7,OG$TDA$Box7[[pts,2]]}
};
]

ΔOG0$Singles=Table[{FCI$Singles[[a,1]],100((OG0$Singles[[a,2]]-FCI$Singles[[a,2]])/(FCI$Singles[[a,2]]))},{a,6}];
ΔOG0$Doubles=Table[{FCI$Doubles[[a,1]],100((OG0$Doubles[[a,2]]-FCI$Doubles[[a,2]])/(FCI$Doubles[[a,2]]))},{a,6}];
ΔOGSA$Singles=Table[{FCI$Singles[[a,1]],100((OGSA$Singles[[a,2]]-FCI$Singles[[a,2]])/(FCI$Singles[[a,2]]))},{a,6}];
ΔOGSA$Doubles=Table[{FCI$Doubles[[a,1]],100((OGSA$Doubles[[a,2]]-FCI$Doubles[[a,2]])/(FCI$Doubles[[a,2]]))},{a,6}];
ΔHF0$Singles=Table[{FCI$Singles[[a,1]],100((HF0$Singles[[a,2]]-FCI$Singles[[a,2]])/(FCI$Singles[[a,2]]))},{a,6}];
ΔHF0$Doubles=Table[{FCI$Doubles[[a,1]],100((HF0$Doubles[[a,2]]-FCI$Doubles[[a,2]])/(FCI$Doubles[[a,2]]))},{a,6}];
ΔHFSA$Singles=Table[{FCI$Singles[[a,1]],100((HFSA$Singles[[a,2]]-FCI$Singles[[a,2]])/(FCI$Singles[[a,2]]))},{a,6}];
ΔHFSA$Doubles=Table[{FCI$Doubles[[a,1]],100((HFSA$Doubles[[a,2]]-FCI$Doubles[[a,2]])/(FCI$Doubles[[a,2]]))},{a,6}];
ΔOGTDHF$Singles=Table[{FCI$Singles[[a,1]],100((OGTDHF$Singles[[a,2]]-FCI$Singles[[a,2]])/(FCI$Singles[[a,2]]))},{a,6}];
ΔOGCIS$Singles=Table[{FCI$Singles[[a,1]],100((OGCIS$Singles[[a,2]]-FCI$Singles[[a,2]])/(FCI$Singles[[a,2]]))},{a,6}];
ΔOGTDLDA$Singles=Table[{FCI$Singles[[a,1]],100((OGTDLDA$Singles[[a,2]]-FCI$Singles[[a,2]])/(FCI$Singles[[a,2]]))},{a,6}];
ΔOGTDA$Singles=Table[{FCI$Singles[[a,1]],100((OGTDA$Singles[[a,2]]-FCI$Singles[[a,2]])/(FCI$Singles[[a,2]]))},{a,6}];
ListPlot[{ΔOG0$Singles,ΔOG0$Doubles,ΔOGSA$Singles,ΔOGSA$Doubles,ΔOGTDHF$Singles,ΔOGCIS$Singles,ΔOGTDLDA$Singles,ΔOGTDA$Singles},OptionsEvsN,
PlotLabel->MaTeX["\\text{$L = \\pi/4$ }",Magnification->SizeEpilog]]
Export["EvsN_025.pdf",%];

L=π/2

With[{pts=3},
FCI$Singles={
{2,OG$FCI$Box2[[pts,3]]-OG$FCI$Box2[[pts,2]]},
{3,OG$FCI$Box3[[pts,3]]-OG$FCI$Box3[[pts,2]]},
{4,OG$FCI$Box4[[pts,3]]-OG$FCI$Box4[[pts,2]]},
{5,OG$FCI$Box5[[pts,3]]-OG$FCI$Box5[[pts,2]]},
{6,OG$FCI$Box6[[pts,3]]-OG$FCI$Box6[[pts,2]]},
{7,OG$FCI$Box7[[pts,3]]-OG$FCI$Box7[[pts,2]]}
};
FCI$Doubles={
{2,OG$FCI$Box2[[pts,4]]-OG$FCI$Box2[[pts,2]]},
{3,OG$FCI$Box3[[pts,4]]-OG$FCI$Box3[[pts,2]]},
{4,OG$FCI$Box4[[pts,4]]-OG$FCI$Box4[[pts,2]]},
{5,OG$FCI$Box5[[pts,4]]-OG$FCI$Box5[[pts,2]]},
{6,OG$FCI$Box6[[pts,4]]-OG$FCI$Box6[[pts,2]]},
{7,OG$FCI$Box7[[pts,4]]-OG$FCI$Box7[[pts,2]]}
};
OG0$Singles={
{2,OG$c$Box2$0[[pts,3]]-OG$c$Box2$0[[pts,2]]},
{3,OG$c$Box3$0[[pts,3]]-OG$c$Box3$0[[pts,2]]},
{4,OG$c$Box4$0[[pts,3]]-OG$c$Box4$0[[pts,2]]},
{5,OG$c$Box5$0[[pts,3]]-OG$c$Box5$0[[pts,2]]},
{6,OG$c$Box6$0[[pts,3]]-OG$c$Box6$0[[pts,2]]},
{7,OG$c$Box7$0[[pts,3]]-OG$c$Box7$0[[pts,2]]}
};
OG0$Doubles={
{2,OG$c$Box2$0[[pts,4]]-OG$c$Box2$0[[pts,2]]},
{3,OG$c$Box3$0[[pts,4]]-OG$c$Box3$0[[pts,2]]},
{4,OG$c$Box4$0[[pts,4]]-OG$c$Box4$0[[pts,2]]},
{5,OG$c$Box5$0[[pts,4]]-OG$c$Box5$0[[pts,2]]},
{6,OG$c$Box6$0[[pts,4]]-OG$c$Box6$0[[pts,2]]},
{7,OG$c$Box7$0[[pts,4]]-OG$c$Box7$0[[pts,2]]}
};
OGSA$Singles={
{2,OG$c$Box2$SA[[pts,3]]-OG$c$Box2$SA[[pts,2]]},
{3,OG$c$Box3$SA[[pts,3]]-OG$c$Box3$SA[[pts,2]]},
{4,OG$c$Box4$SA[[pts,3]]-OG$c$Box4$SA[[pts,2]]},
{5,OG$c$Box5$SA[[pts,3]]-OG$c$Box5$SA[[pts,2]]},
{6,OG$c$Box6$SA[[pts,3]]-OG$c$Box6$SA[[pts,2]]},
{7,OG$c$Box7$SA[[pts,3]]-OG$c$Box7$SA[[pts,2]]}
};
OGSA$Doubles={
{2,OG$c$Box2$SA[[pts,4]]-OG$c$Box2$SA[[pts,2]]},
{3,OG$c$Box3$SA[[pts,4]]-OG$c$Box3$SA[[pts,2]]},
{4,OG$c$Box4$SA[[pts,4]]-OG$c$Box4$SA[[pts,2]]},
{5,OG$c$Box5$SA[[pts,4]]-OG$c$Box5$SA[[pts,2]]},
{6,OG$c$Box6$SA[[pts,4]]-OG$c$Box6$SA[[pts,2]]},
{7,OG$c$Box7$SA[[pts,4]]-OG$c$Box7$SA[[pts,2]]}
};
HF0$Singles={
{2,OG$HF$Box2$0[[pts,3]]-OG$HF$Box2$0[[pts,2]]},
{3,OG$HF$Box3$0[[pts,3]]-OG$HF$Box3$0[[pts,2]]},
{4,OG$HF$Box4$0[[pts,3]]-OG$HF$Box4$0[[pts,2]]},
{5,OG$HF$Box5$0[[pts,3]]-OG$HF$Box5$0[[pts,2]]},
{6,OG$HF$Box6$0[[pts,3]]-OG$HF$Box6$0[[pts,2]]},
{7,OG$HF$Box7$0[[pts,3]]-OG$HF$Box7$0[[pts,2]]}
};
HF0$Doubles={
{2,OG$HF$Box2$0[[pts,4]]-OG$HF$Box2$0[[pts,2]]},
{3,OG$HF$Box3$0[[pts,4]]-OG$HF$Box3$0[[pts,2]]},
{4,OG$HF$Box4$0[[pts,4]]-OG$HF$Box4$0[[pts,2]]},
{5,OG$HF$Box5$0[[pts,4]]-OG$HF$Box5$0[[pts,2]]},
{6,OG$HF$Box6$0[[pts,4]]-OG$HF$Box6$0[[pts,2]]},
{7,OG$HF$Box7$0[[pts,4]]-OG$HF$Box7$0[[pts,2]]}
};
HFSA$Singles={
{2,OG$HF$Box2$SA[[pts,3]]-OG$HF$Box2$SA[[pts,2]]},
{3,OG$HF$Box3$SA[[pts,3]]-OG$HF$Box3$SA[[pts,2]]},
{4,OG$HF$Box4$SA[[pts,3]]-OG$HF$Box4$SA[[pts,2]]},
{5,OG$HF$Box5$SA[[pts,3]]-OG$HF$Box5$SA[[pts,2]]},
{6,OG$HF$Box6$SA[[pts,3]]-OG$HF$Box6$SA[[pts,2]]},
{7,OG$HF$Box7$SA[[pts,3]]-OG$HF$Box7$SA[[pts,2]]}
};
HFSA$Doubles={
{2,OG$HF$Box2$SA[[pts,4]]-OG$HF$Box2$SA[[pts,2]]},
{3,OG$HF$Box3$SA[[pts,4]]-OG$HF$Box3$SA[[pts,2]]},
{4,OG$HF$Box4$SA[[pts,4]]-OG$HF$Box4$SA[[pts,2]]},
{5,OG$HF$Box5$SA[[pts,4]]-OG$HF$Box5$SA[[pts,2]]},
{6,OG$HF$Box6$SA[[pts,4]]-OG$HF$Box6$SA[[pts,2]]},
{7,OG$HF$Box7$SA[[pts,4]]-OG$HF$Box7$SA[[pts,2]]}
};
OGTDHF$Singles={
{2,OG$TDHF$Box2[[pts,2]]},
{3,OG$TDHF$Box3[[pts,2]]},
{4,OG$TDHF$Box4[[pts,2]]},
{5,OG$TDHF$Box5[[pts,2]]},
{6,OG$TDHF$Box6[[pts,2]]},
{7,OG$TDHF$Box7[[pts,2]]}
};
OGCIS$Singles={
{2,OG$CIS$Box2[[pts,2]]},
{3,OG$CIS$Box3[[pts,2]]},
{4,OG$CIS$Box4[[pts,2]]},
{5,OG$CIS$Box5[[pts,2]]},
{6,OG$CIS$Box6[[pts,2]]},
{7,OG$CIS$Box7[[pts,2]]}
};
OGTDLDA$Singles={
{2,OG$TDLDA$Box2[[pts,2]]},
{3,OG$TDLDA$Box3[[pts,2]]},
{4,OG$TDLDA$Box4[[pts,2]]},
{5,OG$TDLDA$Box5[[pts,2]]},
{6,OG$TDLDA$Box6[[pts,2]]},
{7,OG$TDLDA$Box7[[pts,2]]}
};
OGTDA$Singles={
{2,OG$TDA$Box2[[pts,2]]},
{3,OG$TDA$Box3[[pts,2]]},
{4,OG$TDA$Box4[[pts,2]]},
{5,OG$TDA$Box5[[pts,2]]},
{6,OG$TDA$Box6[[pts,2]]},
{7,OG$TDA$Box7[[pts,2]]}
};
]

ΔOG0$Singles=Table[{FCI$Singles[[a,1]],100((OG0$Singles[[a,2]]-FCI$Singles[[a,2]])/(FCI$Singles[[a,2]]))},{a,6}];
ΔOG0$Doubles=Table[{FCI$Doubles[[a,1]],100((OG0$Doubles[[a,2]]-FCI$Doubles[[a,2]])/(FCI$Doubles[[a,2]]))},{a,6}];
ΔOGSA$Singles=Table[{FCI$Singles[[a,1]],100((OGSA$Singles[[a,2]]-FCI$Singles[[a,2]])/(FCI$Singles[[a,2]]))},{a,6}];
ΔOGSA$Doubles=Table[{FCI$Doubles[[a,1]],100((OGSA$Doubles[[a,2]]-FCI$Doubles[[a,2]])/(FCI$Doubles[[a,2]]))},{a,6}];
ΔHF0$Singles=Table[{FCI$Singles[[a,1]],100((HF0$Singles[[a,2]]-FCI$Singles[[a,2]])/(FCI$Singles[[a,2]]))},{a,6}];
ΔHF0$Doubles=Table[{FCI$Doubles[[a,1]],100((HF0$Doubles[[a,2]]-FCI$Doubles[[a,2]])/(FCI$Doubles[[a,2]]))},{a,6}];
ΔHFSA$Singles=Table[{FCI$Singles[[a,1]],100((HFSA$Singles[[a,2]]-FCI$Singles[[a,2]])/(FCI$Singles[[a,2]]))},{a,6}];
ΔHFSA$Doubles=Table[{FCI$Doubles[[a,1]],100((HFSA$Doubles[[a,2]]-FCI$Doubles[[a,2]])/(FCI$Doubles[[a,2]]))},{a,6}];
ΔOGTDHF$Singles=Table[{FCI$Singles[[a,1]],100((OGTDHF$Singles[[a,2]]-FCI$Singles[[a,2]])/(FCI$Singles[[a,2]]))},{a,6}];
ΔOGCIS$Singles=Table[{FCI$Singles[[a,1]],100((OGCIS$Singles[[a,2]]-FCI$Singles[[a,2]])/(FCI$Singles[[a,2]]))},{a,6}];
ΔOGTDLDA$Singles=Table[{FCI$Singles[[a,1]],100((OGTDLDA$Singles[[a,2]]-FCI$Singles[[a,2]])/(FCI$Singles[[a,2]]))},{a,6}];
ΔOGTDA$Singles=Table[{FCI$Singles[[a,1]],100((OGTDA$Singles[[a,2]]-FCI$Singles[[a,2]])/(FCI$Singles[[a,2]]))},{a,6}];
ListPlot[{ΔOG0$Singles,ΔOG0$Doubles,ΔOGSA$Singles,ΔOGSA$Doubles,ΔOGTDHF$Singles,ΔOGCIS$Singles},OptionsEvsN,
PlotLabel->MaTeX["\\text{$L = \\pi/2$ }",Magnification->SizeEpilog]]
Export["EvsN_05.pdf",%];

L=π

With[{pts=4},
FCI$Singles={
{2,OG$FCI$Box2[[pts,3]]-OG$FCI$Box2[[pts,2]]},
{3,OG$FCI$Box3[[pts,3]]-OG$FCI$Box3[[pts,2]]},
{4,OG$FCI$Box4[[pts,3]]-OG$FCI$Box4[[pts,2]]},
{5,OG$FCI$Box5[[pts,3]]-OG$FCI$Box5[[pts,2]]},
{6,OG$FCI$Box6[[pts,3]]-OG$FCI$Box6[[pts,2]]},
{7,OG$FCI$Box7[[pts,3]]-OG$FCI$Box7[[pts,2]]}
};
FCI$Doubles={
{2,OG$FCI$Box2[[pts,4]]-OG$FCI$Box2[[pts,2]]},
{3,OG$FCI$Box3[[pts,4]]-OG$FCI$Box3[[pts,2]]},
{4,OG$FCI$Box4[[pts,4]]-OG$FCI$Box4[[pts,2]]},
{5,OG$FCI$Box5[[pts,4]]-OG$FCI$Box5[[pts,2]]},
{6,OG$FCI$Box6[[pts,4]]-OG$FCI$Box6[[pts,2]]},
{7,OG$FCI$Box7[[pts,4]]-OG$FCI$Box7[[pts,2]]}
};
OG0$Singles={
{2,OG$c$Box2$0[[pts,3]]-OG$c$Box2$0[[pts,2]]},
{3,OG$c$Box3$0[[pts,3]]-OG$c$Box3$0[[pts,2]]},
{4,OG$c$Box4$0[[pts,3]]-OG$c$Box4$0[[pts,2]]},
{5,OG$c$Box5$0[[pts,3]]-OG$c$Box5$0[[pts,2]]},
{6,OG$c$Box6$0[[pts,3]]-OG$c$Box6$0[[pts,2]]},
{7,OG$c$Box7$0[[pts,3]]-OG$c$Box7$0[[pts,2]]}
};
OG0$Doubles={
{2,OG$c$Box2$0[[pts,4]]-OG$c$Box2$0[[pts,2]]},
{3,OG$c$Box3$0[[pts,4]]-OG$c$Box3$0[[pts,2]]},
{4,OG$c$Box4$0[[pts,4]]-OG$c$Box4$0[[pts,2]]},
{5,OG$c$Box5$0[[pts,4]]-OG$c$Box5$0[[pts,2]]},
{6,OG$c$Box6$0[[pts,4]]-OG$c$Box6$0[[pts,2]]},
{7,OG$c$Box7$0[[pts,4]]-OG$c$Box7$0[[pts,2]]}
};
OGSA$Singles={
{2,OG$c$Box2$SA[[pts,3]]-OG$c$Box2$SA[[pts,2]]},
{3,OG$c$Box3$SA[[pts,3]]-OG$c$Box3$SA[[pts,2]]},
{4,OG$c$Box4$SA[[pts,3]]-OG$c$Box4$SA[[pts,2]]},
{5,OG$c$Box5$SA[[pts,3]]-OG$c$Box5$SA[[pts,2]]},
{6,OG$c$Box6$SA[[pts,3]]-OG$c$Box6$SA[[pts,2]]},
{7,OG$c$Box7$SA[[pts,3]]-OG$c$Box7$SA[[pts,2]]}
};
OGSA$Doubles={
{2,OG$c$Box2$SA[[pts,4]]-OG$c$Box2$SA[[pts,2]]},
{3,OG$c$Box3$SA[[pts,4]]-OG$c$Box3$SA[[pts,2]]},
{4,OG$c$Box4$SA[[pts,4]]-OG$c$Box4$SA[[pts,2]]},
{5,OG$c$Box5$SA[[pts,4]]-OG$c$Box5$SA[[pts,2]]},
{6,OG$c$Box6$SA[[pts,4]]-OG$c$Box6$SA[[pts,2]]},
{7,OG$c$Box7$SA[[pts,4]]-OG$c$Box7$SA[[pts,2]]}
};
HF0$Singles={
{2,OG$HF$Box2$0[[pts,3]]-OG$HF$Box2$0[[pts,2]]},
{3,OG$HF$Box3$0[[pts,3]]-OG$HF$Box3$0[[pts,2]]},
{4,OG$HF$Box4$0[[pts,3]]-OG$HF$Box4$0[[pts,2]]},
{5,OG$HF$Box5$0[[pts,3]]-OG$HF$Box5$0[[pts,2]]},
{6,OG$HF$Box6$0[[pts,3]]-OG$HF$Box6$0[[pts,2]]},
{7,OG$HF$Box7$0[[pts,3]]-OG$HF$Box7$0[[pts,2]]}
};
HF0$Doubles={
{2,OG$HF$Box2$0[[pts,4]]-OG$HF$Box2$0[[pts,2]]},
{3,OG$HF$Box3$0[[pts,4]]-OG$HF$Box3$0[[pts,2]]},
{4,OG$HF$Box4$0[[pts,4]]-OG$HF$Box4$0[[pts,2]]},
{5,OG$HF$Box5$0[[pts,4]]-OG$HF$Box5$0[[pts,2]]},
{6,OG$HF$Box6$0[[pts,4]]-OG$HF$Box6$0[[pts,2]]},
{7,OG$HF$Box7$0[[pts,4]]-OG$HF$Box7$0[[pts,2]]}
};
HFSA$Singles={
{2,OG$HF$Box2$SA[[pts,3]]-OG$HF$Box2$SA[[pts,2]]},
{3,OG$HF$Box3$SA[[pts,3]]-OG$HF$Box3$SA[[pts,2]]},
{4,OG$HF$Box4$SA[[pts,3]]-OG$HF$Box4$SA[[pts,2]]},
{5,OG$HF$Box5$SA[[pts,3]]-OG$HF$Box5$SA[[pts,2]]},
{6,OG$HF$Box6$SA[[pts,3]]-OG$HF$Box6$SA[[pts,2]]},
{7,OG$HF$Box7$SA[[pts,3]]-OG$HF$Box7$SA[[pts,2]]}
};
HFSA$Doubles={
{2,OG$HF$Box2$SA[[pts,4]]-OG$HF$Box2$SA[[pts,2]]},
{3,OG$HF$Box3$SA[[pts,4]]-OG$HF$Box3$SA[[pts,2]]},
{4,OG$HF$Box4$SA[[pts,4]]-OG$HF$Box4$SA[[pts,2]]},
{5,OG$HF$Box5$SA[[pts,4]]-OG$HF$Box5$SA[[pts,2]]},
{6,OG$HF$Box6$SA[[pts,4]]-OG$HF$Box6$SA[[pts,2]]},
{7,OG$HF$Box7$SA[[pts,4]]-OG$HF$Box7$SA[[pts,2]]}
};
OGTDHF$Singles={
{2,OG$TDHF$Box2[[pts,2]]},
{3,OG$TDHF$Box3[[pts,2]]},
{4,OG$TDHF$Box4[[pts,2]]},
{5,OG$TDHF$Box5[[pts,2]]},
{6,OG$TDHF$Box6[[pts,2]]},
{7,OG$TDHF$Box7[[pts,2]]}
};
OGCIS$Singles={
{2,OG$CIS$Box2[[pts,2]]},
{3,OG$CIS$Box3[[pts,2]]},
{4,OG$CIS$Box4[[pts,2]]},
{5,OG$CIS$Box5[[pts,2]]},
{6,OG$CIS$Box6[[pts,2]]},
{7,OG$CIS$Box7[[pts,2]]}
};
OGTDLDA$Singles={
{2,OG$TDLDA$Box2[[pts,2]]},
{3,OG$TDLDA$Box3[[pts,2]]},
{4,OG$TDLDA$Box4[[pts,2]]},
{5,OG$TDLDA$Box5[[pts,2]]},
{6,OG$TDLDA$Box6[[pts,2]]},
{7,OG$TDLDA$Box7[[pts,2]]}
};
OGTDA$Singles={
{2,OG$TDA$Box2[[pts,2]]},
{3,OG$TDA$Box3[[pts,2]]},
{4,OG$TDA$Box4[[pts,2]]},
{5,OG$TDA$Box5[[pts,2]]},
{6,OG$TDA$Box6[[pts,2]]},
{7,OG$TDA$Box7[[pts,2]]}
};
]

ΔOG0$Singles=Table[{FCI$Singles[[a,1]],100((OG0$Singles[[a,2]]-FCI$Singles[[a,2]])/(FCI$Singles[[a,2]]))},{a,6}];
ΔOG0$Doubles=Table[{FCI$Doubles[[a,1]],100((OG0$Doubles[[a,2]]-FCI$Doubles[[a,2]])/(FCI$Doubles[[a,2]]))},{a,6}];
ΔOGSA$Singles=Table[{FCI$Singles[[a,1]],100((OGSA$Singles[[a,2]]-FCI$Singles[[a,2]])/(FCI$Singles[[a,2]]))},{a,6}];
ΔOGSA$Doubles=Table[{FCI$Doubles[[a,1]],100((OGSA$Doubles[[a,2]]-FCI$Doubles[[a,2]])/(FCI$Doubles[[a,2]]))},{a,6}];
ΔHF0$Singles=Table[{FCI$Singles[[a,1]],100((HF0$Singles[[a,2]]-FCI$Singles[[a,2]])/(FCI$Singles[[a,2]]))},{a,6}];
ΔHF0$Doubles=Table[{FCI$Doubles[[a,1]],100((HF0$Doubles[[a,2]]-FCI$Doubles[[a,2]])/(FCI$Doubles[[a,2]]))},{a,6}];
ΔHFSA$Singles=Table[{FCI$Singles[[a,1]],100((HFSA$Singles[[a,2]]-FCI$Singles[[a,2]])/(FCI$Singles[[a,2]]))},{a,6}];
ΔHFSA$Doubles=Table[{FCI$Doubles[[a,1]],100((HFSA$Doubles[[a,2]]-FCI$Doubles[[a,2]])/(FCI$Doubles[[a,2]]))},{a,6}];
ΔOGTDHF$Singles=Table[{FCI$Singles[[a,1]],100((OGTDHF$Singles[[a,2]]-FCI$Singles[[a,2]])/(FCI$Singles[[a,2]]))},{a,6}];
ΔOGCIS$Singles=Table[{FCI$Singles[[a,1]],100((OGCIS$Singles[[a,2]]-FCI$Singles[[a,2]])/(FCI$Singles[[a,2]]))},{a,6}];
ΔOGTDLDA$Singles=Table[{FCI$Singles[[a,1]],100((OGTDLDA$Singles[[a,2]]-FCI$Singles[[a,2]])/(FCI$Singles[[a,2]]))},{a,6}];
ΔOGTDA$Singles=Table[{FCI$Singles[[a,1]],100((OGTDA$Singles[[a,2]]-FCI$Singles[[a,2]])/(FCI$Singles[[a,2]]))},{a,6}];
EvsNπ=ListPlot[{ΔOG0$Singles,ΔOG0$Doubles,ΔOGSA$Singles,ΔOGSA$Doubles,ΔOGTDLDA$Singles,ΔOGTDA$Singles},OptionsEvsN,
PlotLabel->MaTeX["\\text{$L = \\pi$ }",Magnification->SizeEpilog]]
(*Export["EvsN_1.pdf",%];*)
(*Export["EvsN_1.pdf",%[[1]]];
Export["EvsN_Legend.pdf",%%[[2,1]]];*)
(*ListPlot[{ΔOG0$Singles,ΔOG0$Doubles,ΔOGSA$Singles,ΔOGSA$Doubles,ΔHF0$Singles,ΔHF0$Doubles,ΔHFSA$Singles,ΔHFSA$Doubles},OptionsEvsNHF,
PlotLabel->MaTeX["\\text{$L = \\pi$ }",Magnification->SizeEpilog],
PlotLegends->Placed[{
MaTeX["\\text{$\\Omega^{(1)}_\\text{eLDA}$ with } \\mathbf{w}=(0,0)",Magnification->SizeLegend],
MaTeX["\\text{$\\Omega^{(2)}_\\text{eLDA}$ with } \\mathbf{w}=(0,0)",Magnification->SizeLegend],
MaTeX["\\text{$\\Omega^{(1)}_\\text{eLDA}$ with } \\mathbf{w}=(1/3,1/3)",Magnification->SizeLegend],
MaTeX["\\text{$\\Omega^{(2)}_\\text{eLDA}$ with } \\mathbf{w}=(1/3,1/3)",Magnification->SizeLegend],
MaTeX["\\text{$\\Omega^{(1)}_\\text{eHF}$ with } \\mathbf{w}=(0,0)",Magnification->SizeLegend],
MaTeX["\\text{$\\Omega^{(2)}_\\text{eHF}$ with } \\mathbf{w}=(0,0)",Magnification->SizeLegend],
MaTeX["\\text{$\\Omega^{(1)}_\\text{eHF}$ with } \\mathbf{w}=(1/3,1/3)",Magnification->SizeLegend],
MaTeX["\\text{$\\Omega^{(2)}_\\text{eHF}$ with } \\mathbf{w}=(1/3,1/3)",Magnification->SizeLegend],
},Right]]*)

L=2π

With[{pts=5},
FCI$Singles={
{2,OG$FCI$Box2[[pts,3]]-OG$FCI$Box2[[pts,2]]},
{3,OG$FCI$Box3[[pts,3]]-OG$FCI$Box3[[pts,2]]},
{4,OG$FCI$Box4[[pts,3]]-OG$FCI$Box4[[pts,2]]},
{5,OG$FCI$Box5[[pts,3]]-OG$FCI$Box5[[pts,2]]},
{6,OG$FCI$Box6[[pts,3]]-OG$FCI$Box6[[pts,2]]},
{7,OG$FCI$Box7[[pts,3]]-OG$FCI$Box7[[pts,2]]}
};
FCI$Doubles={
{2,OG$FCI$Box2[[pts,4]]-OG$FCI$Box2[[pts,2]]},
{3,OG$FCI$Box3[[pts,4]]-OG$FCI$Box3[[pts,2]]},
{4,OG$FCI$Box4[[pts,4]]-OG$FCI$Box4[[pts,2]]},
{5,OG$FCI$Box5[[pts,4]]-OG$FCI$Box5[[pts,2]]},
{6,OG$FCI$Box6[[pts,4]]-OG$FCI$Box6[[pts,2]]},
{7,OG$FCI$Box7[[pts,4]]-OG$FCI$Box7[[pts,2]]}
};
OG0$Singles={
{2,OG$c$Box2$0[[pts,3]]-OG$c$Box2$0[[pts,2]]},
{3,OG$c$Box3$0[[pts,3]]-OG$c$Box3$0[[pts,2]]},
{4,OG$c$Box4$0[[pts,3]]-OG$c$Box4$0[[pts,2]]},
{5,OG$c$Box5$0[[pts,3]]-OG$c$Box5$0[[pts,2]]},
{6,OG$c$Box6$0[[pts,3]]-OG$c$Box6$0[[pts,2]]},
{7,OG$c$Box7$0[[pts,3]]-OG$c$Box7$0[[pts,2]]}
};
OG0$Doubles={
{2,OG$c$Box2$0[[pts,4]]-OG$c$Box2$0[[pts,2]]},
{3,OG$c$Box3$0[[pts,4]]-OG$c$Box3$0[[pts,2]]},
{4,OG$c$Box4$0[[pts,4]]-OG$c$Box4$0[[pts,2]]},
{5,OG$c$Box5$0[[pts,4]]-OG$c$Box5$0[[pts,2]]},
{6,OG$c$Box6$0[[pts,4]]-OG$c$Box6$0[[pts,2]]},
{7,OG$c$Box7$0[[pts,4]]-OG$c$Box7$0[[pts,2]]}
};
OGSA$Singles={
{2,OG$c$Box2$SA[[pts,3]]-OG$c$Box2$SA[[pts,2]]},
{3,OG$c$Box3$SA[[pts,3]]-OG$c$Box3$SA[[pts,2]]},
{4,OG$c$Box4$SA[[pts,3]]-OG$c$Box4$SA[[pts,2]]},
{5,OG$c$Box5$SA[[pts,3]]-OG$c$Box5$SA[[pts,2]]},
{6,OG$c$Box6$SA[[pts,3]]-OG$c$Box6$SA[[pts,2]]},
{7,OG$c$Box7$SA[[pts,3]]-OG$c$Box7$SA[[pts,2]]}
};
OGSA$Doubles={
{2,OG$c$Box2$SA[[pts,4]]-OG$c$Box2$SA[[pts,2]]},
{3,OG$c$Box3$SA[[pts,4]]-OG$c$Box3$SA[[pts,2]]},
{4,OG$c$Box4$SA[[pts,4]]-OG$c$Box4$SA[[pts,2]]},
{5,OG$c$Box5$SA[[pts,4]]-OG$c$Box5$SA[[pts,2]]},
{6,OG$c$Box6$SA[[pts,4]]-OG$c$Box6$SA[[pts,2]]},
{7,OG$c$Box7$SA[[pts,4]]-OG$c$Box7$SA[[pts,2]]}
};
HF0$Singles={
{2,OG$HF$Box2$0[[pts,3]]-OG$HF$Box2$0[[pts,2]]},
{3,OG$HF$Box3$0[[pts,3]]-OG$HF$Box3$0[[pts,2]]},
{4,OG$HF$Box4$0[[pts,3]]-OG$HF$Box4$0[[pts,2]]},
{5,OG$HF$Box5$0[[pts,3]]-OG$HF$Box5$0[[pts,2]]},
{6,OG$HF$Box6$0[[pts,3]]-OG$HF$Box6$0[[pts,2]]},
{7,OG$HF$Box7$0[[pts,3]]-OG$HF$Box7$0[[pts,2]]}
};
HF0$Doubles={
{2,OG$HF$Box2$0[[pts,4]]-OG$HF$Box2$0[[pts,2]]},
{3,OG$HF$Box3$0[[pts,4]]-OG$HF$Box3$0[[pts,2]]},
{4,OG$HF$Box4$0[[pts,4]]-OG$HF$Box4$0[[pts,2]]},
{5,OG$HF$Box5$0[[pts,4]]-OG$HF$Box5$0[[pts,2]]},
{6,OG$HF$Box6$0[[pts,4]]-OG$HF$Box6$0[[pts,2]]},
{7,OG$HF$Box7$0[[pts,4]]-OG$HF$Box7$0[[pts,2]]}
};
HFSA$Singles={
{2,OG$HF$Box2$SA[[pts,3]]-OG$HF$Box2$SA[[pts,2]]},
{3,OG$HF$Box3$SA[[pts,3]]-OG$HF$Box3$SA[[pts,2]]},
{4,OG$HF$Box4$SA[[pts,3]]-OG$HF$Box4$SA[[pts,2]]},
{5,OG$HF$Box5$SA[[pts,3]]-OG$HF$Box5$SA[[pts,2]]},
{6,OG$HF$Box6$SA[[pts,3]]-OG$HF$Box6$SA[[pts,2]]},
{7,OG$HF$Box7$SA[[pts,3]]-OG$HF$Box7$SA[[pts,2]]}
};
HFSA$Doubles={
{2,OG$HF$Box2$SA[[pts,4]]-OG$HF$Box2$SA[[pts,2]]},
{3,OG$HF$Box3$SA[[pts,4]]-OG$HF$Box3$SA[[pts,2]]},
{4,OG$HF$Box4$SA[[pts,4]]-OG$HF$Box4$SA[[pts,2]]},
{5,OG$HF$Box5$SA[[pts,4]]-OG$HF$Box5$SA[[pts,2]]},
{6,OG$HF$Box6$SA[[pts,4]]-OG$HF$Box6$SA[[pts,2]]},
{7,OG$HF$Box7$SA[[pts,4]]-OG$HF$Box7$SA[[pts,2]]}
};
OGTDHF$Singles={
{2,OG$TDHF$Box2[[pts,2]]},
{3,OG$TDHF$Box3[[pts,2]]},
{4,OG$TDHF$Box4[[pts,2]]},
{5,OG$TDHF$Box5[[pts,2]]},
{6,OG$TDHF$Box6[[pts,2]]},
{7,OG$TDHF$Box7[[pts,2]]}
};
OGCIS$Singles={
{2,OG$CIS$Box2[[pts,2]]},
{3,OG$CIS$Box3[[pts,2]]},
{4,OG$CIS$Box4[[pts,2]]},
{5,OG$CIS$Box5[[pts,2]]},
{6,OG$CIS$Box6[[pts,2]]},
{7,OG$CIS$Box7[[pts,2]]}
};
OGTDLDA$Singles={
{2,OG$TDLDA$Box2[[pts,2]]},
{3,OG$TDLDA$Box3[[pts,2]]},
{4,OG$TDLDA$Box4[[pts,2]]},
{5,OG$TDLDA$Box5[[pts,2]]},
{6,OG$TDLDA$Box6[[pts,2]]},
{7,OG$TDLDA$Box7[[pts,2]]}
};
OGTDA$Singles={
{2,OG$TDA$Box2[[pts,2]]},
{3,OG$TDA$Box3[[pts,2]]},
{4,OG$TDA$Box4[[pts,2]]},
{5,OG$TDA$Box5[[pts,2]]},
{6,OG$TDA$Box6[[pts,2]]},
{7,OG$TDA$Box7[[pts,2]]}
};
]

ΔOG0$Singles=Table[{FCI$Singles[[a,1]],100((OG0$Singles[[a,2]]-FCI$Singles[[a,2]])/(FCI$Singles[[a,2]]))},{a,6}];
ΔOG0$Doubles=Table[{FCI$Doubles[[a,1]],100((OG0$Doubles[[a,2]]-FCI$Doubles[[a,2]])/(FCI$Doubles[[a,2]]))},{a,6}];
ΔOGSA$Singles=Table[{FCI$Singles[[a,1]],100((OGSA$Singles[[a,2]]-FCI$Singles[[a,2]])/(FCI$Singles[[a,2]]))},{a,6}];
ΔOGSA$Doubles=Table[{FCI$Doubles[[a,1]],100((OGSA$Doubles[[a,2]]-FCI$Doubles[[a,2]])/(FCI$Doubles[[a,2]]))},{a,6}];
ΔHF0$Singles=Table[{FCI$Singles[[a,1]],100((HF0$Singles[[a,2]]-FCI$Singles[[a,2]])/(FCI$Singles[[a,2]]))},{a,6}];
ΔHF0$Doubles=Table[{FCI$Doubles[[a,1]],100((HF0$Doubles[[a,2]]-FCI$Doubles[[a,2]])/(FCI$Doubles[[a,2]]))},{a,6}];
ΔHFSA$Singles=Table[{FCI$Singles[[a,1]],100((HFSA$Singles[[a,2]]-FCI$Singles[[a,2]])/(FCI$Singles[[a,2]]))},{a,6}];
ΔHFSA$Doubles=Table[{FCI$Doubles[[a,1]],100((HFSA$Doubles[[a,2]]-FCI$Doubles[[a,2]])/(FCI$Doubles[[a,2]]))},{a,6}];
ΔOGTDHF$Singles=Table[{FCI$Singles[[a,1]],100((OGTDHF$Singles[[a,2]]-FCI$Singles[[a,2]])/(FCI$Singles[[a,2]]))},{a,6}];
ΔOGCIS$Singles=Table[{FCI$Singles[[a,1]],100((OGCIS$Singles[[a,2]]-FCI$Singles[[a,2]])/(FCI$Singles[[a,2]]))},{a,6}];
ΔOGTDLDA$Singles=Table[{FCI$Singles[[a,1]],100((OGTDLDA$Singles[[a,2]]-FCI$Singles[[a,2]])/(FCI$Singles[[a,2]]))},{a,6}];
ΔOGTDA$Singles=Table[{FCI$Singles[[a,1]],100((OGTDA$Singles[[a,2]]-FCI$Singles[[a,2]])/(FCI$Singles[[a,2]]))},{a,6}];
ListPlot[{ΔOG0$Singles,ΔOG0$Doubles,ΔOGSA$Singles,ΔOGSA$Doubles,ΔOGTDHF$Singles,ΔOGCIS$Singles},OptionsEvsN,
PlotLabel->MaTeX["\\text{$L = 2\\pi$ }",Magnification->SizeEpilog]]
Export["EvsN_2.pdf",%];

L=4π

With[{pts=6},
FCI$Singles={
{2,OG$FCI$Box2[[pts,3]]-OG$FCI$Box2[[pts,2]]},
{3,OG$FCI$Box3[[pts,3]]-OG$FCI$Box3[[pts,2]]},
{4,OG$FCI$Box4[[pts,3]]-OG$FCI$Box4[[pts,2]]},
{5,OG$FCI$Box5[[pts,3]]-OG$FCI$Box5[[pts,2]]},
{6,OG$FCI$Box6[[pts,3]]-OG$FCI$Box6[[pts,2]]},
{7,OG$FCI$Box7[[pts,3]]-OG$FCI$Box7[[pts,2]]}
};
FCI$Doubles={
{2,OG$FCI$Box2[[pts,4]]-OG$FCI$Box2[[pts,2]]},
{3,OG$FCI$Box3[[pts,4]]-OG$FCI$Box3[[pts,2]]},
{4,OG$FCI$Box4[[pts,4]]-OG$FCI$Box4[[pts,2]]},
{5,OG$FCI$Box5[[pts,4]]-OG$FCI$Box5[[pts,2]]},
{6,OG$FCI$Box6[[pts,4]]-OG$FCI$Box6[[pts,2]]},
{7,OG$FCI$Box7[[pts,4]]-OG$FCI$Box7[[pts,2]]}
};
OG0$Singles={
{2,OG$c$Box2$0[[pts,3]]-OG$c$Box2$0[[pts,2]]},
{3,OG$c$Box3$0[[pts,3]]-OG$c$Box3$0[[pts,2]]},
{4,OG$c$Box4$0[[pts,3]]-OG$c$Box4$0[[pts,2]]},
{5,OG$c$Box5$0[[pts,3]]-OG$c$Box5$0[[pts,2]]},
{6,OG$c$Box6$0[[pts,3]]-OG$c$Box6$0[[pts,2]]},
{7,OG$c$Box7$0[[pts,3]]-OG$c$Box7$0[[pts,2]]}
};
OG0$Doubles={
{2,OG$c$Box2$0[[pts,4]]-OG$c$Box2$0[[pts,2]]},
{3,OG$c$Box3$0[[pts,4]]-OG$c$Box3$0[[pts,2]]},
{4,OG$c$Box4$0[[pts,4]]-OG$c$Box4$0[[pts,2]]},
{5,OG$c$Box5$0[[pts,4]]-OG$c$Box5$0[[pts,2]]},
{6,OG$c$Box6$0[[pts,4]]-OG$c$Box6$0[[pts,2]]},
{7,OG$c$Box7$0[[pts,4]]-OG$c$Box7$0[[pts,2]]}
};
OGSA$Singles={
{2,OG$c$Box2$SA[[pts,3]]-OG$c$Box2$SA[[pts,2]]},
{3,OG$c$Box3$SA[[pts,3]]-OG$c$Box3$SA[[pts,2]]},
{4,OG$c$Box4$SA[[pts,3]]-OG$c$Box4$SA[[pts,2]]},
{5,OG$c$Box5$SA[[pts,3]]-OG$c$Box5$SA[[pts,2]]},
{6,OG$c$Box6$SA[[pts,3]]-OG$c$Box6$SA[[pts,2]]},
{7,OG$c$Box7$SA[[pts,3]]-OG$c$Box7$SA[[pts,2]]}
};
OGSA$Doubles={
{2,OG$c$Box2$SA[[pts,4]]-OG$c$Box2$SA[[pts,2]]},
{3,OG$c$Box3$SA[[pts,4]]-OG$c$Box3$SA[[pts,2]]},
{4,OG$c$Box4$SA[[pts,4]]-OG$c$Box4$SA[[pts,2]]},
{5,OG$c$Box5$SA[[pts,4]]-OG$c$Box5$SA[[pts,2]]},
{6,OG$c$Box6$SA[[pts,4]]-OG$c$Box6$SA[[pts,2]]},
{7,OG$c$Box7$SA[[pts,4]]-OG$c$Box7$SA[[pts,2]]}
};
HF0$Singles={
{2,OG$HF$Box2$0[[pts,3]]-OG$HF$Box2$0[[pts,2]]},
{3,OG$HF$Box3$0[[pts,3]]-OG$HF$Box3$0[[pts,2]]},
{4,OG$HF$Box4$0[[pts,3]]-OG$HF$Box4$0[[pts,2]]},
{5,OG$HF$Box5$0[[pts,3]]-OG$HF$Box5$0[[pts,2]]},
{6,OG$HF$Box6$0[[pts,3]]-OG$HF$Box6$0[[pts,2]]},
{7,OG$HF$Box7$0[[pts,3]]-OG$HF$Box7$0[[pts,2]]}
};
HF0$Doubles={
{2,OG$HF$Box2$0[[pts,4]]-OG$HF$Box2$0[[pts,2]]},
{3,OG$HF$Box3$0[[pts,4]]-OG$HF$Box3$0[[pts,2]]},
{4,OG$HF$Box4$0[[pts,4]]-OG$HF$Box4$0[[pts,2]]},
{5,OG$HF$Box5$0[[pts,4]]-OG$HF$Box5$0[[pts,2]]},
{6,OG$HF$Box6$0[[pts,4]]-OG$HF$Box6$0[[pts,2]]},
{7,OG$HF$Box7$0[[pts,4]]-OG$HF$Box7$0[[pts,2]]}
};
HFSA$Singles={
{2,OG$HF$Box2$SA[[pts,3]]-OG$HF$Box2$SA[[pts,2]]},
{3,OG$HF$Box3$SA[[pts,3]]-OG$HF$Box3$SA[[pts,2]]},
{4,OG$HF$Box4$SA[[pts,3]]-OG$HF$Box4$SA[[pts,2]]},
{5,OG$HF$Box5$SA[[pts,3]]-OG$HF$Box5$SA[[pts,2]]},
{6,OG$HF$Box6$SA[[pts,3]]-OG$HF$Box6$SA[[pts,2]]},
{7,OG$HF$Box7$SA[[pts,3]]-OG$HF$Box7$SA[[pts,2]]}
};
HFSA$Doubles={
{2,OG$HF$Box2$SA[[pts,4]]-OG$HF$Box2$SA[[pts,2]]},
{3,OG$HF$Box3$SA[[pts,4]]-OG$HF$Box3$SA[[pts,2]]},
{4,OG$HF$Box4$SA[[pts,4]]-OG$HF$Box4$SA[[pts,2]]},
{5,OG$HF$Box5$SA[[pts,4]]-OG$HF$Box5$SA[[pts,2]]},
{6,OG$HF$Box6$SA[[pts,4]]-OG$HF$Box6$SA[[pts,2]]},
{7,OG$HF$Box7$SA[[pts,4]]-OG$HF$Box7$SA[[pts,2]]}
};
OGTDHF$Singles={
{2,OG$TDHF$Box2[[pts,2]]},
{3,OG$TDHF$Box3[[pts,2]]},
{4,OG$TDHF$Box4[[pts,2]]},
{5,OG$TDHF$Box5[[pts,2]]},
{6,OG$TDHF$Box6[[pts,2]]},
{7,OG$TDHF$Box7[[pts,2]]}
};
OGCIS$Singles={
{2,OG$CIS$Box2[[pts,2]]},
{3,OG$CIS$Box3[[pts,2]]},
{4,OG$CIS$Box4[[pts,2]]},
{5,OG$CIS$Box5[[pts,2]]},
{6,OG$CIS$Box6[[pts,2]]},
{7,OG$CIS$Box7[[pts,2]]}
};
OGTDLDA$Singles={
{2,OG$TDLDA$Box2[[pts,2]]},
{3,OG$TDLDA$Box3[[pts,2]]},
{4,OG$TDLDA$Box4[[pts,2]]},
{5,OG$TDLDA$Box5[[pts,2]]},
{6,OG$TDLDA$Box6[[pts,2]]},
{7,OG$TDLDA$Box7[[pts,2]]}
};
OGTDA$Singles={
{2,OG$TDA$Box2[[pts,2]]},
{3,OG$TDA$Box3[[pts,2]]},
{4,OG$TDA$Box4[[pts,2]]},
{5,OG$TDA$Box5[[pts,2]]},
{6,OG$TDA$Box6[[pts,2]]},
{7,OG$TDA$Box7[[pts,2]]}
};
]

ΔOG0$Singles=Table[{FCI$Singles[[a,1]],100((OG0$Singles[[a,2]]-FCI$Singles[[a,2]])/(FCI$Singles[[a,2]]))},{a,6}];
ΔOG0$Doubles=Table[{FCI$Doubles[[a,1]],100((OG0$Doubles[[a,2]]-FCI$Doubles[[a,2]])/(FCI$Doubles[[a,2]]))},{a,6}];
ΔOGSA$Singles=Table[{FCI$Singles[[a,1]],100((OGSA$Singles[[a,2]]-FCI$Singles[[a,2]])/(FCI$Singles[[a,2]]))},{a,6}];
ΔOGSA$Doubles=Table[{FCI$Doubles[[a,1]],100((OGSA$Doubles[[a,2]]-FCI$Doubles[[a,2]])/(FCI$Doubles[[a,2]]))},{a,6}];
ΔHF0$Singles=Table[{FCI$Singles[[a,1]],100((HF0$Singles[[a,2]]-FCI$Singles[[a,2]])/(FCI$Singles[[a,2]]))},{a,6}];
ΔHF0$Doubles=Table[{FCI$Doubles[[a,1]],100((HF0$Doubles[[a,2]]-FCI$Doubles[[a,2]])/(FCI$Doubles[[a,2]]))},{a,6}];
ΔHFSA$Singles=Table[{FCI$Singles[[a,1]],100((HFSA$Singles[[a,2]]-FCI$Singles[[a,2]])/(FCI$Singles[[a,2]]))},{a,6}];
ΔHFSA$Doubles=Table[{FCI$Doubles[[a,1]],100((HFSA$Doubles[[a,2]]-FCI$Doubles[[a,2]])/(FCI$Doubles[[a,2]]))},{a,6}];
ΔOGTDHF$Singles=Table[{FCI$Singles[[a,1]],100((OGTDHF$Singles[[a,2]]-FCI$Singles[[a,2]])/(FCI$Singles[[a,2]]))},{a,6}];
ΔOGCIS$Singles=Table[{FCI$Singles[[a,1]],100((OGCIS$Singles[[a,2]]-FCI$Singles[[a,2]])/(FCI$Singles[[a,2]]))},{a,6}];
ΔOGTDLDA$Singles=Table[{FCI$Singles[[a,1]],100((OGTDLDA$Singles[[a,2]]-FCI$Singles[[a,2]])/(FCI$Singles[[a,2]]))},{a,6}];
ΔOGTDA$Singles=Table[{FCI$Singles[[a,1]],100((OGTDA$Singles[[a,2]]-FCI$Singles[[a,2]])/(FCI$Singles[[a,2]]))},{a,6}];
ListPlot[{ΔOG0$Singles,ΔOG0$Doubles,ΔOGSA$Singles,ΔOGSA$Doubles,ΔOGTDHF$Singles,ΔOGCIS$Singles},OptionsEvsN,
PlotLabel->MaTeX["\\text{$L = 4\\pi$ }",Magnification->SizeEpilog]]
Export["EvsN_4.pdf",%];
ListPlot[{ΔOG0$Singles,ΔOG0$Doubles,ΔOGSA$Singles,ΔOGSA$Doubles,ΔHF0$Singles,ΔHF0$Doubles,ΔHFSA$Singles,ΔHFSA$Doubles},OptionsEvsNHF,
PlotLabel->MaTeX["\\text{$L = 4\\pi$ }",Magnification->SizeEpilog],
PlotLegends->Placed[{
MaTeX["\\text{$\\Omega^{(1)}_\\text{eLDA}$ with } \\mathbf{w}=(0,0)",Magnification->SizeLegend],
MaTeX["\\text{$\\Omega^{(2)}_\\text{eLDA}$ with } \\mathbf{w}=(0,0)",Magnification->SizeLegend],
MaTeX["\\text{$\\Omega^{(1)}_\\text{eLDA}$ with } \\mathbf{w}=(1/3,1/3)",Magnification->SizeLegend],
MaTeX["\\text{$\\Omega^{(2)}_\\text{eLDA}$ with } \\mathbf{w}=(1/3,1/3)",Magnification->SizeLegend],
MaTeX["\\text{$\\Omega^{(1)}_\\text{eHF}$ with } \\mathbf{w}=(0,0)",Magnification->SizeLegend],
MaTeX["\\text{$\\Omega^{(2)}_\\text{eHF}$ with } \\mathbf{w}=(0,0)",Magnification->SizeLegend],
MaTeX["\\text{$\\Omega^{(1)}_\\text{eHF}$ with } \\mathbf{w}=(1/3,1/3)",Magnification->SizeLegend],
MaTeX["\\text{$\\Omega^{(2)}_\\text{eHF}$ with } \\mathbf{w}=(1/3,1/3)",Magnification->SizeLegend],
},Right]]

L=8π

With[{pts=7},
FCI$Singles={
{2,OG$FCI$Box2[[pts,3]]-OG$FCI$Box2[[pts,2]]},
{3,OG$FCI$Box3[[pts,3]]-OG$FCI$Box3[[pts,2]]},
{4,OG$FCI$Box4[[pts,3]]-OG$FCI$Box4[[pts,2]]},
{5,OG$FCI$Box5[[pts,3]]-OG$FCI$Box5[[pts,2]]},
{6,OG$FCI$Box6[[pts,3]]-OG$FCI$Box6[[pts,2]]},
{7,OG$FCI$Box7[[pts,3]]-OG$FCI$Box7[[pts,2]]}
};
FCI$Doubles={
{2,OG$FCI$Box2[[pts,4]]-OG$FCI$Box2[[pts,2]]},
{3,OG$FCI$Box3[[pts,4]]-OG$FCI$Box3[[pts,2]]},
{4,OG$FCI$Box4[[pts,4]]-OG$FCI$Box4[[pts,2]]},
{5,OG$FCI$Box5[[pts,4]]-OG$FCI$Box5[[pts,2]]},
{6,OG$FCI$Box6[[pts,4]]-OG$FCI$Box6[[pts,2]]},
{7,OG$FCI$Box7[[pts,4]]-OG$FCI$Box7[[pts,2]]}
};
OG0$Singles={
{2,OG$c$Box2$0[[pts,3]]-OG$c$Box2$0[[pts,2]]},
{3,OG$c$Box3$0[[pts,3]]-OG$c$Box3$0[[pts,2]]},
{4,OG$c$Box4$0[[pts,3]]-OG$c$Box4$0[[pts,2]]},
{5,OG$c$Box5$0[[pts,3]]-OG$c$Box5$0[[pts,2]]},
{6,OG$c$Box6$0[[pts,3]]-OG$c$Box6$0[[pts,2]]},
{7,OG$c$Box7$0[[pts,3]]-OG$c$Box7$0[[pts,2]]}
};
OG0$Doubles={
{2,OG$c$Box2$0[[pts,4]]-OG$c$Box2$0[[pts,2]]},
{3,OG$c$Box3$0[[pts,4]]-OG$c$Box3$0[[pts,2]]},
{4,OG$c$Box4$0[[pts,4]]-OG$c$Box4$0[[pts,2]]},
{5,OG$c$Box5$0[[pts,4]]-OG$c$Box5$0[[pts,2]]},
{6,OG$c$Box6$0[[pts,4]]-OG$c$Box6$0[[pts,2]]},
{7,OG$c$Box7$0[[pts,4]]-OG$c$Box7$0[[pts,2]]}
};
OGSA$Singles={
{2,OG$c$Box2$SA[[pts,3]]-OG$c$Box2$SA[[pts,2]]},
{3,OG$c$Box3$SA[[pts,3]]-OG$c$Box3$SA[[pts,2]]},
{4,OG$c$Box4$SA[[pts,3]]-OG$c$Box4$SA[[pts,2]]},
{5,OG$c$Box5$SA[[pts,3]]-OG$c$Box5$SA[[pts,2]]},
{6,OG$c$Box6$SA[[pts,3]]-OG$c$Box6$SA[[pts,2]]},
{7,OG$c$Box7$SA[[pts,3]]-OG$c$Box7$SA[[pts,2]]}
};
OGSA$Doubles={
{2,OG$c$Box2$SA[[pts,4]]-OG$c$Box2$SA[[pts,2]]},
{3,OG$c$Box3$SA[[pts,4]]-OG$c$Box3$SA[[pts,2]]},
{4,OG$c$Box4$SA[[pts,4]]-OG$c$Box4$SA[[pts,2]]},
{5,OG$c$Box5$SA[[pts,4]]-OG$c$Box5$SA[[pts,2]]},
{6,OG$c$Box6$SA[[pts,4]]-OG$c$Box6$SA[[pts,2]]},
{7,OG$c$Box7$SA[[pts,4]]-OG$c$Box7$SA[[pts,2]]}
};
HF0$Singles={
{2,OG$HF$Box2$0[[pts,3]]-OG$HF$Box2$0[[pts,2]]},
{3,OG$HF$Box3$0[[pts,3]]-OG$HF$Box3$0[[pts,2]]},
{4,OG$HF$Box4$0[[pts,3]]-OG$HF$Box4$0[[pts,2]]},
{5,OG$HF$Box5$0[[pts,3]]-OG$HF$Box5$0[[pts,2]]},
{6,OG$HF$Box6$0[[pts,3]]-OG$HF$Box6$0[[pts,2]]},
{7,OG$HF$Box7$0[[pts,3]]-OG$HF$Box7$0[[pts,2]]}
};
HF0$Doubles={
{2,OG$HF$Box2$0[[pts,4]]-OG$HF$Box2$0[[pts,2]]},
{3,OG$HF$Box3$0[[pts,4]]-OG$HF$Box3$0[[pts,2]]},
{4,OG$HF$Box4$0[[pts,4]]-OG$HF$Box4$0[[pts,2]]},
{5,OG$HF$Box5$0[[pts,4]]-OG$HF$Box5$0[[pts,2]]},
{6,OG$HF$Box6$0[[pts,4]]-OG$HF$Box6$0[[pts,2]]},
{7,OG$HF$Box7$0[[pts,4]]-OG$HF$Box7$0[[pts,2]]}
};
HFSA$Singles={
{2,OG$HF$Box2$SA[[pts,3]]-OG$HF$Box2$SA[[pts,2]]},
{3,OG$HF$Box3$SA[[pts,3]]-OG$HF$Box3$SA[[pts,2]]},
{4,OG$HF$Box4$SA[[pts,3]]-OG$HF$Box4$SA[[pts,2]]},
{5,OG$HF$Box5$SA[[pts,3]]-OG$HF$Box5$SA[[pts,2]]},
{6,OG$HF$Box6$SA[[pts,3]]-OG$HF$Box6$SA[[pts,2]]},
{7,OG$HF$Box7$SA[[pts,3]]-OG$HF$Box7$SA[[pts,2]]}
};
HFSA$Doubles={
{2,OG$HF$Box2$SA[[pts,4]]-OG$HF$Box2$SA[[pts,2]]},
{3,OG$HF$Box3$SA[[pts,4]]-OG$HF$Box3$SA[[pts,2]]},
{4,OG$HF$Box4$SA[[pts,4]]-OG$HF$Box4$SA[[pts,2]]},
{5,OG$HF$Box5$SA[[pts,4]]-OG$HF$Box5$SA[[pts,2]]},
{6,OG$HF$Box6$SA[[pts,4]]-OG$HF$Box6$SA[[pts,2]]},
{7,OG$HF$Box7$SA[[pts,4]]-OG$HF$Box7$SA[[pts,2]]}
};
OGTDHF$Singles={
{2,OG$TDHF$Box2[[pts,2]]},
{3,OG$TDHF$Box3[[pts,2]]},
{4,OG$TDHF$Box4[[pts,2]]},
{5,OG$TDHF$Box5[[pts,2]]},
{6,OG$TDHF$Box6[[pts,2]]},
{7,OG$TDHF$Box7[[pts,2]]}
};
OGCIS$Singles={
{2,OG$CIS$Box2[[pts,2]]},
{3,OG$CIS$Box3[[pts,2]]},
{4,OG$CIS$Box4[[pts,2]]},
{5,OG$CIS$Box5[[pts,2]]},
{6,OG$CIS$Box6[[pts,2]]},
{7,OG$CIS$Box7[[pts,2]]}
};
OGTDLDA$Singles={
{2,OG$TDLDA$Box2[[pts,2]]},
{3,OG$TDLDA$Box3[[pts,2]]},
{4,OG$TDLDA$Box4[[pts,2]]},
{5,OG$TDLDA$Box5[[pts,2]]},
{6,OG$TDLDA$Box6[[pts,2]]},
{7,OG$TDLDA$Box7[[pts,2]]}
};
OGTDA$Singles={
{2,OG$TDA$Box2[[pts,2]]},
{3,OG$TDA$Box3[[pts,2]]},
{4,OG$TDA$Box4[[pts,2]]},
{5,OG$TDA$Box5[[pts,2]]},
{6,OG$TDA$Box6[[pts,2]]},
{7,OG$TDA$Box7[[pts,2]]}
};
]

ΔOG0$Singles=Table[{FCI$Singles[[a,1]],100((OG0$Singles[[a,2]]-FCI$Singles[[a,2]])/(FCI$Singles[[a,2]]))},{a,2,6}];
ΔOG0$Doubles=Table[{FCI$Doubles[[a,1]],100((OG0$Doubles[[a,2]]-FCI$Doubles[[a,2]])/(FCI$Doubles[[a,2]]))},{a,2,6}];
ΔOGSA$Singles=Table[{FCI$Singles[[a,1]],100((OGSA$Singles[[a,2]]-FCI$Singles[[a,2]])/(FCI$Singles[[a,2]]))},{a,2,6}];
ΔOGSA$Doubles=Table[{FCI$Doubles[[a,1]],100((OGSA$Doubles[[a,2]]-FCI$Doubles[[a,2]])/(FCI$Doubles[[a,2]]))},{a,2,6}];
ΔHF0$Singles=Table[{FCI$Singles[[a,1]],100((HF0$Singles[[a,2]]-FCI$Singles[[a,2]])/(FCI$Singles[[a,2]]))},{a,2,6}];
ΔHF0$Doubles=Table[{FCI$Doubles[[a,1]],100((HF0$Doubles[[a,2]]-FCI$Doubles[[a,2]])/(FCI$Doubles[[a,2]]))},{a,2,6}];
ΔHFSA$Singles=Table[{FCI$Singles[[a,1]],100((HFSA$Singles[[a,2]]-FCI$Singles[[a,2]])/(FCI$Singles[[a,2]]))},{a,2,6}];
ΔHFSA$Doubles=Table[{FCI$Doubles[[a,1]],100((HFSA$Doubles[[a,2]]-FCI$Doubles[[a,2]])/(FCI$Doubles[[a,2]]))},{a,2,6}];
ΔOGTDHF$Singles=Table[{FCI$Singles[[a,1]],100((OGTDHF$Singles[[a,2]]-FCI$Singles[[a,2]])/(FCI$Singles[[a,2]]))},{a,2,6}];
ΔOGCIS$Singles=Table[{FCI$Singles[[a,1]],100((OGCIS$Singles[[a,2]]-FCI$Singles[[a,2]])/(FCI$Singles[[a,2]]))},{a,2,6}];
ΔOGTDLDA$Singles=Table[{FCI$Singles[[a,1]],100((OGTDLDA$Singles[[a,2]]-FCI$Singles[[a,2]])/(FCI$Singles[[a,2]]))},{a,2,6}];
ΔOGTDA$Singles=Table[{FCI$Singles[[a,1]],100((OGTDA$Singles[[a,2]]-FCI$Singles[[a,2]])/(FCI$Singles[[a,2]]))},{a,2,6}];
EvsN8π=ListPlot[{ΔOG0$Singles,ΔOG0$Doubles,ΔOGSA$Singles,ΔOGSA$Doubles,ΔOGTDLDA$Singles,ΔOGTDA$Singles},OptionsEvsN,
PlotLabel->MaTeX["\\text{$L = 8\\pi$ }",Magnification->SizeEpilog],
PlotLegends->Placed[{
MaTeX["\\text{$\\Omega^{(1)}_\\text{eLDA}$ with } \\mathbf{w}=(0,0)",Magnification->SizeLegend],
MaTeX["\\text{$\\Omega^{(2)}_\\text{eLDA}$ with } \\mathbf{w}=(0,0)",Magnification->SizeLegend],
MaTeX["\\text{$\\Omega^{(1)}_\\text{eLDA}$ with } \\mathbf{w}=(1/3,1/3)",Magnification->SizeLegend],
MaTeX["\\text{$\\Omega^{(2)}_\\text{eLDA}$ with } \\mathbf{w}=(1/3,1/3)",Magnification->SizeLegend],
(*MaTeX["\\Omega^{(1)}_\\text{TDHF}",Magnification->SizeLegend],
MaTeX["\\Omega^{(1)}_\\text{CIS}",Magnification->SizeLegend],*)
MaTeX["\\Omega^{(1)}_\\text{TDLDA}",Magnification->SizeLegend],
MaTeX["\\Omega^{(1)}_\\text{TDA-TDLDA}",Magnification->SizeLegend]
},Right]]
(*Export["EvsN_8.pdf",%];*)
ListPlot[{ΔOG0$Singles,ΔOG0$Doubles,ΔOGSA$Singles,ΔOGSA$Doubles,ΔHF0$Singles,ΔHF0$Doubles,ΔHFSA$Singles,ΔHFSA$Doubles},OptionsEvsNHF,
PlotLabel->MaTeX["\\text{$L = 8\\pi$ }",Magnification->SizeEpilog],
PlotLegends->Placed[{
MaTeX["\\text{$\\Omega^{(1)}_\\text{eLDA}$ with } \\mathbf{w}=(0,0)",Magnification->SizeLegend],
MaTeX["\\text{$\\Omega^{(2)}_\\text{eLDA}$ with } \\mathbf{w}=(0,0)",Magnification->SizeLegend],
MaTeX["\\text{$\\Omega^{(1)}_\\text{eLDA}$ with } \\mathbf{w}=(1/3,1/3)",Magnification->SizeLegend],
MaTeX["\\text{$\\Omega^{(2)}_\\text{eLDA}$ with } \\mathbf{w}=(1/3,1/3)",Magnification->SizeLegend],
MaTeX["\\text{$\\Omega^{(1)}_\\text{eHF}$ with } \\mathbf{w}=(0,0)",Magnification->SizeLegend],
MaTeX["\\text{$\\Omega^{(2)}_\\text{eHF}$ with } \\mathbf{w}=(0,0)",Magnification->SizeLegend],
MaTeX["\\text{$\\Omega^{(1)}_\\text{eHF}$ with } \\mathbf{w}=(1/3,1/3)",Magnification->SizeLegend],
MaTeX["\\text{$\\Omega^{(2)}_\\text{eHF}$ with } \\mathbf{w}=(1/3,1/3)",Magnification->SizeLegend],
},Right]]

Combined

Grid[{{EvsNπ8,EvsNπ,EvsN8π}},Spacings->4]

1-boxium

HF and TD-HF

Table[EnergyTableHF[1,L π,{0,0},"boxium",30,30],{L,{1/8,1/4,1/2,1,2,4,8}}]//TableForm

Zero-weight limit

Table[EnergyTableOG[1,L π,{0,0},"boxium",30,30],{L,{1/8,1/4,1/2,1,2,4,8}}]//TableForm

State-averaged limit

Table[EnergyTableOG[1,L π,{1/3,1/3},"boxium",30,30],{L,{1/8,1/4,1/2,1,2,4,8}}]//TableForm

Tables

OG$c$Box1$0=Table[Flatten[{L π,OptGap["boxium",1,30,  L π,{0,0}][[12]]}],{L,{1/8,1/4,1/2,1,2,4,8}}]
OG$c$Box1$SA=Table[Flatten[{L π,OptGap["boxium",1,30,  L π,{1/3,1/3}][[12]]}],{L,{1/8,1/4,1/2,1,2,4,8}}]

TableForm[ExtractOG[OG$FCI$Box1],TableHeadings->{None,{"L","(Subscript[E, 0])","(Subscript[E, 1])","(Subscript[E, 2])","(Subscript[Ω, 1])","(Subscript[Ω, 2])"}},TableAlignments->Center]
TableForm[ExtractOG[OG$c$Box1$0],TableHeadings->{None,{"L","(Subscript[E, 0])","(Subscript[E, 1])","(Subscript[E, 2])","(Subscript[Ω, 1])","(Subscript[Ω, 2])"}},TableAlignments->Center]
TableForm[ExtractOG[OG$c$Box1$SA],TableHeadings->{None,{"L","(Subscript[E, 0])","(Subscript[E, 1])","(Subscript[E, 2])","(Subscript[Ω, 1])","(Subscript[Ω, 2])"}},TableAlignments->Center]

vs FCI

TableForm[SetAccuracy[ExtractOG[OG$c$Box1$0]-ExtractOG[OG$FCI$Box1]100,3],TableHeadings->{None,{"L","(Subscript[E, 0])","(Subscript[E, 1])","(Subscript[E, 2])","(Subscript[Ω, 1])","(Subscript[Ω, 2])"}},TableAlignments->Center]

TableForm[SetAccuracy[ExtractOG[OG$c$Box1$SA]-ExtractOG[OG$FCI$Box1]100,3],TableHeadings->{None,{"L","(Subscript[E, 0])","(Subscript[E, 1])","(Subscript[E, 2])","(Subscript[Ω, 1])","(Subscript[Ω, 2])"}},TableAlignments->Center]

2-boxium

HF and TD-HF

Table[EnergyTableHF[2,L π,{0,0},"boxium",30,30],{L,{1/8,1/4,1/2,1,2,4,8}}]//TableForm

Table[EnergyTableHF[2,L π,{1/3,1/3},"boxium",30,30],{L,{1/8,1/4,1/2,1,2,4,8}}]//TableForm

Zero-weight limit

Table[EnergyTableOG[2,L π,{0,0},"boxium",30,30],{L,{1/8,1/4,1/2,1,2,4,8}}]//TableForm

State-averaged limit

Table[EnergyTableOG[2,L π,{1/3,1/3},"boxium",30,30],{L,{1/8,1/4,1/2,1,2,4,8}}]//TableForm

Tables

OG$c$Box2$0=Table[Flatten[{L π,OptGap["boxium",2,30,  L π,{0,0}][[12]]}],{L,{1/8,1/4,1/2,1,2,4,8}}]
OG$c$Box2$SA=Table[Flatten[{L π,OptGap["boxium",2,30,  L π,{1/3,1/3}][[12]]}],{L,{1/8,1/4,1/2,1,2,4,8}}]

TableForm[SetAccuracy[ExtractOG[OG$FCI$Box2]\[Transpose][[2;;6]],5],TableHeadings->{{"(Subscript[E, 0])","(Subscript[E, 1])","(Subscript[E, 2])","(Subscript[Ω, 1])","(Subscript[Ω, 2])"},{"π/8","π/4","π/2","π","2π","4π","8π"}},TableAlignments->Center]
TableForm[SetAccuracy[ExtractOG[OG$c$Box2$0]\[Transpose][[2;;6]],5],TableHeadings->{{"(Subscript[E, 0])","(Subscript[E, 1])","(Subscript[E, 2])","(Subscript[Ω, 1])","(Subscript[Ω, 2])"},{"π/8","π/4","π/2","π","2π","4π","8π"}},TableAlignments->Center]
TableForm[SetAccuracy[ExtractOG[OG$c$Box2$SA]\[Transpose][[2;;6]],5],TableHeadings->{{"(Subscript[E, 0])","(Subscript[E, 1])","(Subscript[E, 2])","(Subscript[Ω, 1])","(Subscript[Ω, 2])"},{"π/8","π/4","π/2","π","2π","4π","8π"}},TableAlignments->Center]

vs FCI

TableForm[SetAccuracy[(ExtractOG[OG$c$Box2$0]-ExtractOG[OG$FCI$Box2])\[Transpose][[2;;6]],5],TableHeadings->{{"(Subscript[E, 0])","(Subscript[E, 1])","(Subscript[E, 2])","(Subscript[Ω, 1])","(Subscript[Ω, 2])"},{"π/8","π/4","π/2","π","2π","4π","8π"}},TableAlignments->Center]
TableForm[SetAccuracy[(ExtractOG[OG$c$Box2$SA]-ExtractOG[OG$FCI$Box2])\[Transpose][[2;;6]],5],TableHeadings->{{"(Subscript[E, 0])","(Subscript[E, 1])","(Subscript[E, 2])","(Subscript[Ω, 1])","(Subscript[Ω, 2])"},{"π/8","π/4","π/2","π","2π","4π","8π"}},TableAlignments->Center]

3-boxium

HF and TD-HF

Table[EnergyTableHF[3,L π,{0,0},"boxium",30,30],{L,{1/8,1/4,1/2,1,2,4,8}}]//TableForm

Table[EnergyTableHF[3,L π,{1/3,1/3},"boxium",30,30],{L,{1/8,1/4,1/2,1,2,4,8}}]//TableForm

ExtractOG[OG$c$Box3$0]

ExtractOG[OG$FCI$Box3]

Zero-weight limit

Table[EnergyTableOG[3,L π,{0,0},"boxium",30,30],{L,{1/8,1/4,1/2,1,2,4,8}}]//TableForm

State-averaged limit

Table[EnergyTableOG[3,L π,{1/3,1/3},"boxium",30,30],{L,{1/8,1/4,1/2,1,2,4,8}}]//TableForm

Tables

OG$c$Box3$0=Table[Flatten[{L π,OptGap["boxium",3,30,  L π,{0,0}][[12]]}],{L,{1/8,1/4,1/2,1,2,4,8}}]
OG$c$Box3$SA=Table[Flatten[{L π,OptGap["boxium",3,30,  L π,{1/3,1/3}][[12]]}],{L,{1/8,1/4,1/2,1,2,4,8}}]

TableForm[SetAccuracy[ExtractOG[OG$FCI$Box3]\[Transpose][[2;;6]],5],TableHeadings->{{"(Subscript[E, 0])","(Subscript[E, 1])","(Subscript[E, 2])","(Subscript[Ω, 1])","(Subscript[Ω, 2])"},{"π/8","π/4","π/2","π","2π","4π","8π"}},TableAlignments->Center]
TableForm[SetAccuracy[ExtractOG[OG$c$Box3$0]\[Transpose][[2;;6]],5],TableHeadings->{{"(Subscript[E, 0])","(Subscript[E, 1])","(Subscript[E, 2])","(Subscript[Ω, 1])","(Subscript[Ω, 2])"},{"π/8","π/4","π/2","π","2π","4π","8π"}},TableAlignments->Center]
TableForm[SetAccuracy[ExtractOG[OG$c$Box3$SA]\[Transpose][[2;;6]],5],TableHeadings->{{"(Subscript[E, 0])","(Subscript[E, 1])","(Subscript[E, 2])","(Subscript[Ω, 1])","(Subscript[Ω, 2])"},{"π/8","π/4","π/2","π","2π","4π","8π"}},TableAlignments->Center]

vs FCI

TableForm[SetAccuracy[(ExtractOG[OG$c$Box3$0]-ExtractOG[OG$FCI$Box3])\[Transpose][[2;;6]],5],TableHeadings->{{"(Subscript[E, 0])","(Subscript[E, 1])","(Subscript[E, 2])","(Subscript[Ω, 1])","(Subscript[Ω, 2])"},{"π/8","π/4","π/2","π","2π","4π","8π"}},TableAlignments->Center]
TableForm[SetAccuracy[(ExtractOG[OG$c$Box3$SA]-ExtractOG[OG$FCI$Box3])\[Transpose][[2;;6]],5],TableHeadings->{{"(Subscript[E, 0])","(Subscript[E, 1])","(Subscript[E, 2])","(Subscript[Ω, 1])","(Subscript[Ω, 2])"},{"π/8","π/4","π/2","π","2π","4π","8π"}},TableAlignments->Center]

4-boxium

HF and TD-HF

Table[EnergyTableHF[4,L π,{0,0},"boxium",30,30],{L,{1/8,1/4,1/2,1,2,4,8}}]//TableForm

Table[EnergyTableHF[4,L π,{1/3,1/3},"boxium",30,30],{L,{1/8,1/4,1/2,1,2,4,8}}]//TableForm

Zero-weight limit

Table[EnergyTableOG[4,L π,{0,0},"boxium",30,30],{L,{1/8,1/4,1/2,1,2,4,8}}]//TableForm

State-averaged limit

Table[EnergyTableOG[4,L π,{1/3,1/3},"boxium",30,30],{L,{1/8,1/4,1/2,1,2,4,8}}]//TableForm

Tables

OG$c$Box4$0=Table[Flatten[{L π,OptGap["boxium",4,30,  L π,{0,0}][[12]]}],{L,{1/8,1/4,1/2,1,2,4,8}}]
OG$c$Box4$SA=Table[Flatten[{L π,OptGap["boxium",4,30,  L π,{1/3,1/3}][[12]]}],{L,{1/8,1/4,1/2,1,2,4,8}}]

TableForm[SetAccuracy[ExtractOG[OG$FCI$Box4]\[Transpose][[2;;6]],5],TableHeadings->{{"(Subscript[E, 0])","(Subscript[E, 1])","(Subscript[E, 2])","(Subscript[Ω, 1])","(Subscript[Ω, 2])"},{"π/8","π/4","π/2","π","2π","4π","8π"}},TableAlignments->Center]
TableForm[SetAccuracy[ExtractOG[OG$c$Box4$0]\[Transpose][[2;;6]],5],TableHeadings->{{"(Subscript[E, 0])","(Subscript[E, 1])","(Subscript[E, 2])","(Subscript[Ω, 1])","(Subscript[Ω, 2])"},{"π/8","π/4","π/2","π","2π","4π","8π"}},TableAlignments->Center]
TableForm[SetAccuracy[ExtractOG[OG$c$Box4$SA]\[Transpose][[2;;6]],5],TableHeadings->{{"(Subscript[E, 0])","(Subscript[E, 1])","(Subscript[E, 2])","(Subscript[Ω, 1])","(Subscript[Ω, 2])"},{"π/8","π/4","π/2","π","2π","4π","8π"}},TableAlignments->Center]

vs FCI

TableForm[SetAccuracy[(ExtractOG[OG$c$Box4$0]-ExtractOG[OG$FCI$Box4])\[Transpose][[2;;6]],5],TableHeadings->{{"(Subscript[E, 0])","(Subscript[E, 1])","(Subscript[E, 2])","(Subscript[Ω, 1])","(Subscript[Ω, 2])"},{"π/8","π/4","π/2","π","2π","4π","8π"}},TableAlignments->Center]
TableForm[SetAccuracy[(ExtractOG[OG$c$Box4$SA]-ExtractOG[OG$FCI$Box4])\[Transpose][[2;;6]],5],TableHeadings->{{"(Subscript[E, 0])","(Subscript[E, 1])","(Subscript[E, 2])","(Subscript[Ω, 1])","(Subscript[Ω, 2])"},{"π/8","π/4","π/2","π","2π","4π","8π"}},TableAlignments->Center]

5-boxium

HF and TD-HF

Table[EnergyTableHF[5,L π,{0,0},"boxium",30,30],{L,{1/8,1/4,1/2,1,2,4,8}}]//TableForm

Table[EnergyTableHF[5,L π,{1/3,1/3},"boxium",30,30],{L,{1/8,1/4,1/2,1,2,4,8}}]//TableForm

Zero-weight limit

Table[EnergyTableOG[5,L π,{0,0},"boxium",30,30],{L,{1/8,1/4,1/2,1,2,4,8}}]//TableForm

State-averaged limit

Table[EnergyTableOG[5,L π,{1/3,1/3},"boxium",30,30],{L,{1/8,1/4,1/2,1,2,4,8}}]//TableForm

Tables

OG$c$Box5$0=Table[Flatten[{L π,OptGap["boxium",5,30,  L π,{0,0}][[12]]}],{L,{1/8,1/4,1/2,1,2,4,8}}]
OG$c$Box5$SA=Table[Flatten[{L π,OptGap["boxium",5,30,  L π,{1/3,1/3}][[12]]}],{L,{1/8,1/4,1/2,1,2,4,8}}]

TableForm[SetAccuracy[ExtractOG[OG$FCI$Box5]\[Transpose][[2;;6]],5],TableHeadings->{{"(Subscript[E, 0])","(Subscript[E, 1])","(Subscript[E, 2])","(Subscript[Ω, 1])","(Subscript[Ω, 2])"},{"π/8","π/4","π/2","π","2π","4π","8π"}},TableAlignments->Center]
TableForm[SetAccuracy[ExtractOG[OG$c$Box5$0]\[Transpose][[2;;6]],5],TableHeadings->{{"(Subscript[E, 0])","(Subscript[E, 1])","(Subscript[E, 2])","(Subscript[Ω, 1])","(Subscript[Ω, 2])"},{"π/8","π/4","π/2","π","2π","4π","8π"}},TableAlignments->Center]
TableForm[SetAccuracy[ExtractOG[OG$c$Box5$SA]\[Transpose][[2;;6]],5],TableHeadings->{{"(Subscript[E, 0])","(Subscript[E, 1])","(Subscript[E, 2])","(Subscript[Ω, 1])","(Subscript[Ω, 2])"},{"π/8","π/4","π/2","π","2π","4π","8π"}},TableAlignments->Center]

vs FCI

TableForm[SetAccuracy[(ExtractOG[OG$c$Box5$0]-ExtractOG[OG$FCI$Box5])\[Transpose][[2;;6]],5],TableHeadings->{{"(Subscript[E, 0])","(Subscript[E, 1])","(Subscript[E, 2])","(Subscript[Ω, 1])","(Subscript[Ω, 2])"},{"π/8","π/4","π/2","π","2π","4π","8π"}},TableAlignments->Center]
TableForm[SetAccuracy[(ExtractOG[OG$c$Box5$SA]-ExtractOG[OG$FCI$Box5])\[Transpose][[2;;6]],5],TableHeadings->{{"(Subscript[E, 0])","(Subscript[E, 1])","(Subscript[E, 2])","(Subscript[Ω, 1])","(Subscript[Ω, 2])"},{"π/8","π/4","π/2","π","2π","4π","8π"}},TableAlignments->Center]

6-boxium

HF and TD-HF

Table[EnergyTableHF[6,L π,{0,0},"boxium",30,30],{L,{1/8,1/4,1/2,1,2,4,8}}]//TableForm

Table[EnergyTableHF[6,L π,{1/3,1/3},"boxium",30,30],{L,{1/8,1/4,1/2,1,2,4,8}}]//TableForm

Zero-weight limit

Table[EnergyTableOG[6,L π,{0,0},"boxium",30,30],{L,{1/8,1/4,1/2,1,2,4,8}}]//TableForm

State-averaged limit

Table[EnergyTableOG[6,L π,{1/3,1/3},"boxium",30,30],{L,{1/8,1/4,1/2,1,2,4,8}}]//TableForm

Tables

OG$c$Box6$0=Table[Flatten[{L π,OptGap["boxium",6,30,  L π,{0,0}][[12]]}],{L,{1/8,1/4,1/2,1,2,4,8}}]
OG$c$Box6$SA=Table[Flatten[{L π,OptGap["boxium",6,30,  L π,{1/3,1/3}][[12]]}],{L,{1/8,1/4,1/2,1,2,4,8}}]

TableForm[SetAccuracy[ExtractOG[OG$FCI$Box6]\[Transpose][[2;;6]],5],TableHeadings->{{"(Subscript[E, 0])","(Subscript[E, 1])","(Subscript[E, 2])","(Subscript[Ω, 1])","(Subscript[Ω, 2])"},{"π/8","π/4","π/2","π","2π","4π","8π"}},TableAlignments->Center]
TableForm[SetAccuracy[ExtractOG[OG$c$Box6$0]\[Transpose][[2;;6]],5],TableHeadings->{{"(Subscript[E, 0])","(Subscript[E, 1])","(Subscript[E, 2])","(Subscript[Ω, 1])","(Subscript[Ω, 2])"},{"π/8","π/4","π/2","π","2π","4π","8π"}},TableAlignments->Center]
TableForm[SetAccuracy[ExtractOG[OG$c$Box6$SA]\[Transpose][[2;;6]],5],TableHeadings->{{"(Subscript[E, 0])","(Subscript[E, 1])","(Subscript[E, 2])","(Subscript[Ω, 1])","(Subscript[Ω, 2])"},{"π/8","π/4","π/2","π","2π","4π","8π"}},TableAlignments->Center]

vs FCI

TableForm[SetAccuracy[(ExtractOG[OG$c$Box6$0]-ExtractOG[OG$FCI$Box6])\[Transpose][[2;;6]],5],TableHeadings->{{"(Subscript[E, 0])","(Subscript[E, 1])","(Subscript[E, 2])","(Subscript[Ω, 1])","(Subscript[Ω, 2])"},{"π/8","π/4","π/2","π","2π","4π","8π"}},TableAlignments->Center]
TableForm[SetAccuracy[(ExtractOG[OG$c$Box6$SA]-ExtractOG[OG$FCI$Box6])\[Transpose][[2;;6]],5],TableHeadings->{{"(Subscript[E, 0])","(Subscript[E, 1])","(Subscript[E, 2])","(Subscript[Ω, 1])","(Subscript[Ω, 2])"},{"π/8","π/4","π/2","π","2π","4π","8π"}},TableAlignments->Center]

7-boxium

HF and TD-HF

Table[EnergyTableHF[7,L π,{0,0},"boxium",30,30],{L,{1/8,1/4,1/2,1,2,4,8}}]//TableForm

Table[EnergyTableHF[7,L π,{0,0},"boxium",30,30],{L,{1/8,1/4,1/2,1,2,4,8}}]//TableForm

Table[EnergyTableHF[7,L π,{1/3,1/3},"boxium",30,30],{L,{1/8,1/4,1/2,1,2,4,8}}]//TableForm

Zero-weight limit

Table[EnergyTableOG[7,L π,{0,0},"boxium",30,30],{L,{1/8,1/4,1/2,1,2,4,8}}]//TableForm

State-averaged limit

Table[EnergyTableOG[7,L π,{1/3,1/3},"boxium",30,30],{L,{1/8,1/4,1/2,1,2,4,8}}]//TableForm

Tables

OG$c$Box7$0=Table[Flatten[{L π,OptGap["boxium",7,30,  L π,{0,0}][[12]]}],{L,{1/8,1/4,1/2,1,2,4,8}}]
OG$c$Box7$SA=Table[Flatten[{L π,OptGap["boxium",7,30,  L π,{1/3,1/3}][[12]]}],{L,{1/8,1/4,1/2,1,2,4,8}}]

TableForm[SetAccuracy[ExtractOG[OG$FCI$Box7]\[Transpose][[2;;6]],5],TableHeadings->{{"(Subscript[E, 0])","(Subscript[E, 1])","(Subscript[E, 2])","(Subscript[Ω, 1])","(Subscript[Ω, 2])"},{"π/8","π/4","π/2","π","2π","4π","8π"}},TableAlignments->Center]
TableForm[SetAccuracy[ExtractOG[OG$HF$Box7$0]\[Transpose][[2;;6]],5],TableHeadings->{{"(Subscript[E, 0])","(Subscript[E, 1])","(Subscript[E, 2])","(Subscript[Ω, 1])","(Subscript[Ω, 2])"},{"π/8","π/4","π/2","π","2π","4π","8π"}},TableAlignments->Center]
TableForm[SetAccuracy[ExtractOG[OG$HF$Box7$SA]\[Transpose][[2;;6]],5],TableHeadings->{{"(Subscript[E, 0])","(Subscript[E, 1])","(Subscript[E, 2])","(Subscript[Ω, 1])","(Subscript[Ω, 2])"},{"π/8","π/4","π/2","π","2π","4π","8π"}},TableAlignments->Center]

TableForm[SetAccuracy[ExtractOG[OG$FCI$Box7]\[Transpose][[2;;6]],5],TableHeadings->{{"(Subscript[E, 0])","(Subscript[E, 1])","(Subscript[E, 2])","(Subscript[Ω, 1])","(Subscript[Ω, 2])"},{"π/8","π/4","π/2","π","2π","4π","8π"}},TableAlignments->Center]
TableForm[SetAccuracy[ExtractOG[OG$c$Box7$0]\[Transpose][[2;;6]],5],TableHeadings->{{"(Subscript[E, 0])","(Subscript[E, 1])","(Subscript[E, 2])","(Subscript[Ω, 1])","(Subscript[Ω, 2])"},{"π/8","π/4","π/2","π","2π","4π","8π"}},TableAlignments->Center]
TableForm[SetAccuracy[ExtractOG[OG$c$Box7$SA]\[Transpose][[2;;6]],5],TableHeadings->{{"(Subscript[E, 0])","(Subscript[E, 1])","(Subscript[E, 2])","(Subscript[Ω, 1])","(Subscript[Ω, 2])"},{"π/8","π/4","π/2","π","2π","4π","8π"}},TableAlignments->Center]

vs FCI

TableForm[SetAccuracy[(ExtractOG[OG$c$Box7$0]-ExtractOG[OG$FCI$Box7])\[Transpose][[2;;6]],5],TableHeadings->{{"(Subscript[E, 0])","(Subscript[E, 1])","(Subscript[E, 2])","(Subscript[Ω, 1])","(Subscript[Ω, 2])"},{"π/8","π/4","π/2","π","2π","4π","8π"}},TableAlignments->Center]
TableForm[SetAccuracy[(ExtractOG[OG$c$Box7$SA]-ExtractOG[OG$FCI$Box7])\[Transpose][[2;;6]],5],TableHeadings->{{"(Subscript[E, 0])","(Subscript[E, 1])","(Subscript[E, 2])","(Subscript[Ω, 1])","(Subscript[Ω, 2])"},{"π/8","π/4","π/2","π","2π","4π","8π"}},TableAlignments->Center]

Fundamental gap

2-boxium

Zero-weight limit

Table[EnergyTableFG[2,L π,{0,0},"boxium",30,30],{L,{1/8,1/4,1/2,1,2,4,8}}]//TableForm

State-averaged limit

Table[EnergyTableFG[2,L π,{1/3,1/3},"boxium",30,30],{L,{1/8,1/4,1/2,1,2,4,8}}]//TableForm

Tables

FG$c$Box2$0=Table[Flatten[{L π,FundGap["boxium",2,30,  L π,{0,0}][[10]]}],{L,{1/8,1/4,1/2,1,2,4,8}}]
FG$c$Box2$SA=Table[Flatten[{L π,FundGap["boxium",2,30,  L π,{1/3,1/3}][[10]]}],{L,{1/8,1/4,1/2,1,2,4,8}}]

TableForm[ExtractFG[FG$FCI$Box2],TableHeadings->{None,{"L","(Subscript[E, 0])","(Subscript[E, 1])","(Subscript[E, 2])","IP","EA","Gap"}},TableAlignments->Center]
TableForm[ExtractFG[FG$c$Box2$0],TableHeadings->{None,{"L","(Subscript[E, 0])","(Subscript[E, 1])","(Subscript[E, 2])","IP","EA","Gap"}},TableAlignments->Center]
TableForm[ExtractFG[FG$c$Box2$SA],TableHeadings->{None,{"L","(Subscript[E, 0])","(Subscript[E, 1])","(Subscript[E, 2])","IP","EA","Gap"}},TableAlignments->Center]

vs FCI

TableForm[SetAccuracy[((ExtractFG[FG$c$Box2$0]-ExtractFG[FG$FCI$Box2])/(ExtractFG[FG$FCI$Box2]))100,2],TableHeadings->{None,{"L","(Subscript[E, 0])","(Subscript[E, 1])","(Subscript[E, 2])","IP","EA","Gap"}},TableAlignments->Center]

TableForm[SetAccuracy[((ExtractFG[FG$c$Box2$SA]-ExtractFG[FG$FCI$Box2])/(ExtractFG[FG$FCI$Box2]))100,2],TableHeadings->{None,{"L","(Subscript[E, 0])","(Subscript[E, 1])","(Subscript[E, 2])","IP","EA","Gap"}},TableAlignments->Center]

3-boxium

Zero-weight limit

Table[EnergyTableFG[3,L π,{0,0},"boxium",30,30],{L,{1/8,1/4,1/2,1,2,4,8}}]//TableForm

State-averaged limit

Table[EnergyTableFG[3,L π,{1/3,1/3},"boxium",30,30],{L,{1/8,1/4,1/2,1,2,4,8}}]//TableForm

Tables

FG$c$Box3$0=Table[Flatten[{L π,FundGap["boxium",3,30,  L π,{0,0}][[10]]}],{L,{1/8,1/4,1/2,1,2,4,8}}]
FG$c$Box3$SA=Table[Flatten[{L π,FundGap["boxium",3,30,  L π,{1/3,1/3}][[10]]}],{L,{1/8,1/4,1/2,1,2,4,8}}]

TableForm[ExtractFG[FG$FCI$Box3],TableHeadings->{None,{"L","(Subscript[E, 0])","(Subscript[E, 1])","(Subscript[E, 2])","IP","EA","Gap"}},TableAlignments->Center]
TableForm[ExtractFG[FG$c$Box3$0],TableHeadings->{None,{"L","(Subscript[E, 0])","(Subscript[E, 1])","(Subscript[E, 2])","IP","EA","Gap"}},TableAlignments->Center]
TableForm[ExtractFG[FG$c$Box3$SA],TableHeadings->{None,{"L","(Subscript[E, 0])","(Subscript[E, 1])","(Subscript[E, 2])","IP","EA","Gap"}},TableAlignments->Center]

vs FCI

TableForm[SetAccuracy[((ExtractFG[FG$c$Box3$0]-ExtractFG[FG$FCI$Box3])/(ExtractFG[FG$FCI$Box3]))100,2],TableHeadings->{None,{"L","(Subscript[E, 0])","(Subscript[E, 1])","(Subscript[E, 2])","IP","EA","Gap"}},TableAlignments->Center]

TableForm[SetAccuracy[((ExtractFG[FG$c$Box3$SA]-ExtractFG[FG$FCI$Box3])/(ExtractFG[FG$FCI$Box3]))100,2],TableHeadings->{None,{"L","(Subscript[E, 0])","(Subscript[E, 1])","(Subscript[E, 2])","IP","EA","Gap"}},TableAlignments->Center]

4-boxium

Zero-weight limit

Table[EnergyTableFG[4,L π,{0,0},"boxium",30,30],{L,{1/8,1/4,1/2,1,2,4,8}}]//TableForm

State-averaged limit

Table[EnergyTableFG[4,L π,{1/3,1/3},"boxium",30,30],{L,{1/8,1/4,1/2,1,2,4,8}}]//TableForm

Tables

FG$c$Box4$0=Table[Flatten[{L π,FundGap["boxium",4,30,  L π,{0,0}][[10]]}],{L,{1/8,1/4,1/2,1,2,4,8}}]
FG$c$Box4$SA=Table[Flatten[{L π,FundGap["boxium",4,30,  L π,{1/3,1/3}][[10]]}],{L,{1/8,1/4,1/2,1,2,4,8}}]

TableForm[ExtractFG[FG$FCI$Box4],TableHeadings->{None,{"L","(Subscript[E, 0])","(Subscript[E, 1])","(Subscript[E, 2])","IP","EA","Gap"}},TableAlignments->Center]
TableForm[ExtractFG[FG$c$Box4$0],TableHeadings->{None,{"L","(Subscript[E, 0])","(Subscript[E, 1])","(Subscript[E, 2])","IP","EA","Gap"}},TableAlignments->Center]
TableForm[ExtractFG[FG$c$Box4$SA],TableHeadings->{None,{"L","(Subscript[E, 0])","(Subscript[E, 1])","(Subscript[E, 2])","IP","EA","Gap"}},TableAlignments->Center]

vs FCI

TableForm[SetAccuracy[((ExtractFG[FG$c$Box4$0]-ExtractFG[FG$FCI$Box4])/(ExtractFG[FG$FCI$Box4]))100,2],TableHeadings->{None,{"L","(Subscript[E, 0])","(Subscript[E, 1])","(Subscript[E, 2])","IP","EA","Gap"}},TableAlignments->Center]

TableForm[SetAccuracy[((ExtractFG[FG$c$Box4$SA]-ExtractFG[FG$FCI$Box4])/(ExtractFG[FG$FCI$Box4]))100,2],TableHeadings->{None,{"L","(Subscript[E, 0])","(Subscript[E, 1])","(Subscript[E, 2])","IP","EA","Gap"}},TableAlignments->Center]

5-boxium

Zero-weight limit

Table[EnergyTableFG[5,L π,{0,0},"boxium",30,30],{L,{1/8,1/4,1/2,1,2,4,8}}]//TableForm

State-averaged limit

Table[EnergyTableFG[5,L π,{1/3,1/3},"boxium",30,30],{L,{1/8,1/4,1/2,1,2,4,8}}]//TableForm

Tables

FG$c$Box5$0=Table[Flatten[{L π,FundGap["boxium",5,30,  L π,{0,0}][[10]]}],{L,{1/8,1/4,1/2,1,2,4,8}}]
FG$c$Box5$SA=Table[Flatten[{L π,FundGap["boxium",5,30,  L π,{1/3,1/3}][[10]]}],{L,{1/8,1/4,1/2,1,2,4,8}}]

TableForm[ExtractFG[FG$FCI$Box5],TableHeadings->{None,{"L","(Subscript[E, 0])","(Subscript[E, 1])","(Subscript[E, 2])","IP","EA","Gap"}},TableAlignments->Center]
TableForm[ExtractFG[FG$c$Box5$0],TableHeadings->{None,{"L","(Subscript[E, 0])","(Subscript[E, 1])","(Subscript[E, 2])","IP","EA","Gap"}},TableAlignments->Center]
TableForm[ExtractFG[FG$c$Box5$SA],TableHeadings->{None,{"L","(Subscript[E, 0])","(Subscript[E, 1])","(Subscript[E, 2])","IP","EA","Gap"}},TableAlignments->Center]

vs FCI

TableForm[SetAccuracy[((ExtractFG[FG$c$Box5$0]-ExtractFG[FG$FCI$Box5])/(ExtractFG[FG$FCI$Box5]))100,2],TableHeadings->{None,{"L","(Subscript[E, 0])","(Subscript[E, 1])","(Subscript[E, 2])","IP","EA","Gap"}},TableAlignments->Center]

TableForm[SetAccuracy[((ExtractFG[FG$c$Box5$SA]-ExtractFG[FG$FCI$Box5])/(ExtractFG[FG$FCI$Box5]))100,2],TableHeadings->{None,{"L","(Subscript[E, 0])","(Subscript[E, 1])","(Subscript[E, 2])","IP","EA","Gap"}},TableAlignments->Center]

6-boxium

Zero-weight limit

Table[EnergyTableFG[6,L π,{0,0},"boxium",30,30],{L,{1/8,1/4,1/2,1,2,4,8}}]//TableForm

State-averaged limit

Table[EnergyTableFG[6,L π,{1/3,1/3},"boxium",30,30],{L,{1/8,1/4,1/2,1,2,4,8}}]//TableForm

Tables

FG$c$Box6$0=Table[Flatten[{L π,FundGap["boxium",6,30,  L π,{0,0}][[10]]}],{L,{1/8,1/4,1/2,1,2,4,8}}]
FG$c$Box6$SA=Table[Flatten[{L π,FundGap["boxium",6,30,  L π,{1/3,1/3}][[10]]}],{L,{1/8,1/4,1/2,1,2,4,8}}]

TableForm[ExtractFG[FG$FCI$Box6],TableHeadings->{None,{"L","(Subscript[E, 0])","(Subscript[E, 1])","(Subscript[E, 2])","IP","EA","Gap"}},TableAlignments->Center]
TableForm[ExtractFG[FG$c$Box6$0],TableHeadings->{None,{"L","(Subscript[E, 0])","(Subscript[E, 1])","(Subscript[E, 2])","IP","EA","Gap"}},TableAlignments->Center]
TableForm[ExtractFG[FG$c$Box6$SA],TableHeadings->{None,{"L","(Subscript[E, 0])","(Subscript[E, 1])","(Subscript[E, 2])","IP","EA","Gap"}},TableAlignments->Center]

vs FCI

TableForm[SetAccuracy[((ExtractFG[FG$c$Box6$0]-ExtractFG[FG$FCI$Box6])/(ExtractFG[FG$FCI$Box6]))100,2],TableHeadings->{None,{"L","(Subscript[E, 0])","(Subscript[E, 1])","(Subscript[E, 2])","IP","EA","Gap"}},TableAlignments->Center]

TableForm[SetAccuracy[((ExtractFG[FG$c$Box6$SA]-ExtractFG[FG$FCI$Box6])/(ExtractFG[FG$FCI$Box6]))100,2],TableHeadings->{None,{"L","(Subscript[E, 0])","(Subscript[E, 1])","(Subscript[E, 2])","IP","EA","Gap"}},TableAlignments->Center]

3D energy program

Module

Functional

ϵc0[ρ_]:=Module[{a=-0.0238184,b=0.00575719,c=0.0830576},(a/(1+b (ρ^(-1/6))+c (ρ^(-1/3))))]
ϵc1[ρ_]:=Module[{a=-0.0282814,b=0.00340758,c=0.0663967},(a/(1+b (ρ^(-1/6))+c (ρ^(-1/3))))]
ϵc2[ρ_]:=Module[{a=-0.0144633,b=-0.0504501,c=0.0331287},(a/(1+b (ρ^(-1/6))+c (ρ^(-1/3))))]

D[Evaluate[(a/(1+b (ρ^(-1/6))+c (ρ^(-1/3))))/.ρ->ρa+ρb],ρa]==((a (ρ^(-7/6)))/6)((b +2 c (ρ^(-1/6)))/(((1+b (ρ^(-1/6))+c (ρ^(-1/3))))^2))/.ρ->ρa+ρb//Simplify

Orthogonalization

CalcX[NB_,S_]:=Module[{s,X,WP,u,v,w,ϵ,Cp,Ortho,nLD,cutoff},
WP=15;	cutoff=(10^(-7));
Ortho="SVD";
Which[
Ortho=="Lowdin",X=MatrixPower[S,-1/2],
Ortho=="Canonical",X=Eigenvectors[S]\[Transpose].DiagonalMatrix[((Eigenvalues[S])^(-1/2))],
Ortho=="SVD",(
	s=Sort[Eigenvalues[S]];
	Print["Overlap eigenvalues in OBS = ",s];
	nLD=0;
	Do[If[s[[i]]<cutoff ,nLD++],{i,NB}];
	Print["Number of linear dependencies in OBS = ",nLD];
	{u,w,v}=SingularValueDecomposition[S,NB-nLD];	
	X=u.DiagonalMatrix[((Diagonal[w])^(-1/2))].v\[Transpose];
)
];
Return[X];
]

eRHF

eRHF[n_,N_,w_,ENuc_,ϕ_,S_,T_,V_,U_,X_]:=Module[{maxSCF,thresh,Fw,F0,F1,nO,nV,H,UJ,UK,c,cp,o,v,ϵ,Pw,P0,P1,ρw,ρ0,ρ1,nSCF,Conv,EHF,ET,EV,EJ,EK,Gap,Ew,Δ,LZ,δ,WP=15,Boundary=∞,TabRes},
(* Generate initial guess *)
nO=(n/2);	nV=N-(n/2);	H=T+V;
UJ=Flatten[U,{{1},{2},{3,4}}];	UK=Flatten[U,{{1},{4},{3,2}}];

{ϵ,cp}=Chop[SortEigensystem[Eigensystem[X.H.X]]];
c=cp.X;	o=c[[1;;nO]];	v=c[[nO+1;;N]];

(* Main SCF loop *)
Conv=1;	nSCF=0;	maxSCF=64;	thresh=(10^(-5));
While[Conv>thresh∧nSCF<maxSCF,
nSCF++;

(* Density matrix *)
Pw=2(1-w)o[[nO;;nO]]\[Transpose].o[[nO;;nO]];	
If[nO>1,Pw=Pw+2o[[1;;nO-1]]\[Transpose].o[[1;;nO-1]]];	
If[nV>0,Pw=Pw+2w v[[1;;1]]\[Transpose].v[[1;;1]]];

Fw=H+(UJ-(1/2)UK).Flatten[Pw];
{ϵ,cp}=Chop[SortEigensystem[Eigensystem[X.Fw.X]]];
c=cp.X;	o=c[[1;;nO]];	v=c[[nO+1;;N]];
Conv=Max[Abs[Fw.Pw.S-S.Pw.Fw]];
];

ρw=ϕ.Pw.ϕ;	Gap=If[N>nO,ϵ[[nO+1]]-ϵ[[nO]],0];
ET= Tr[Pw.T];	EV= Tr[Pw.V];	EJ= ((Tr[Pw.UJ.Flatten[Pw]])/2);	EK= -((Tr[Pw.UK.Flatten[Pw]])/4);
EHF=ET+EV+EJ+EK;

P0=2o[[1;;nO]]\[Transpose].o[[1;;nO]];	ρ0=ϕ.P0.ϕ;	F0=H+(UJ-(1/2)UK).Flatten[P0];

P1=0o[[nO;;nO]]\[Transpose].o[[nO;;nO]];	
If[nO>1,P1=P1+2o[[1;;nO-1]]\[Transpose].o[[1;;nO-1]]];	
If[nV>0,P1=P1+2 v[[1;;1]]\[Transpose].v[[1;;1]]];
ρ1=ϕ.P1.ϕ;	F1=H+(UJ-(1/2)UK).Flatten[P1];

Δ=Chop[NIntegrate[ρw (EcES[ρw]-EcGS[ρw]),{x,-Boundary,Boundary},{y,-Boundary,Boundary},{z,-Boundary,Boundary}]];
LZ=Chop[NIntegrate[dEwc[ρw,w]({ρ0,ρ1}-ρw),{x,-Boundary,Boundary},{y,-Boundary,Boundary},{z,-Boundary,Boundary}]];
δ=Chop[NIntegrate[ρw Ewc[ρw,w],{x,-Boundary,Boundary},{y,-Boundary,Boundary},{z,-Boundary,Boundary}]];
Ew={((Tr[P0.(H+F0)])/2)+δ,((Tr[P1.(H+F1)])/2)+δ}+{-w Δ,(1-w) Δ}+LZ;
Print[{Ew,(Ew[[2]]-Ew[[1]])HaToeV,Δ,LZ}];
Print[NIntegrate[ρw,{x,-Boundary,Boundary},{y,-Boundary,Boundary},{z,-Boundary,Boundary}]];

TabRes=TableForm[{{n,N,NumberForm[ENuc+EHF,{9,6}],NumberForm[ENuc,{9,6}],NumberForm[EHF,{9,6}],NumberForm[ET,{9,6}],NumberForm[EV,{9,6}],NumberForm[EJ,{9,6}],NumberForm[EK,{9,6}],nSCF,NumberForm[Conv,{6,3}],NumberForm[Gap,{6,3}]}},
TableHeadings->{None,{"n","(Subscript[N, Basis])","(Subscript[E, 0])","(Subscript[E, Nuc])","(Subscript[E, HF])","(Subscript[T, HF])","(Subscript[V, HF])","(Subscript[J, HF])","(Subscript[K, HF])","(Subscript[N, SCF])","Conv","HL Gap"}},TableAlignments->Center];
Return[TabRes];
];

Main module

eDFT[n_,nBas_,w_,XYZ_,ZA_,Basis_,FileInt_]:=Module[
{nO,nV,nAt,nSh,r,αμ,χμ,BF,Aμ,aμ,Dμ,KA,S,T,V,U,X,ENuc,EHF,TabInt,nInt,TabHF,TabFCI,tRHF,tFCI,F,c,ϵ,O1,O2,J,K,ERI},

SetDirectory["~/Dropbox/quack/int"];

(* Information *) 
Print[Style["Start of calculation",Red,Bold]];
nO=(n/2);	nV=nBas-nO;

(* Input *)
nAt=Length[XYZ];	nSh=Length[Basis];	
ENuc=(∑_(c=1)^nAt)(∑_(d=c+1)^nAt)((ZA[[c]]ZA[[d]])/(Norm[XYZ[[c]]-XYZ[[d]]]));

BF=Flatten[Table[{Basis[[i,3]],XYZ[[Basis[[i,1]]]],AngQ[Basis[[i,2]]][[l]],Basis[[i,4]]},{i,nSh},{l,Length[AngQ[Basis[[i,2]]]]}],1];
r={x,y,z};
αμ=Table[BF[[μ,1]],{μ,nBas}];	Aμ=Table[BF[[μ,2]],{μ,nBas}];	aμ=Table[BF[[μ,3]],{μ,nBas}];	Dμ=Table[BF[[μ,4]],{μ,nBas}];
χμ=Table[(KA=Length[αμ[[μ]]];Simplify[(∑_(kA=1)^KA)NormCoeff[αμ[[μ,kA]],aμ[[μ]]]Dμ[[μ,kA]]Apply[Times,(((r-Aμ[[μ]]))^(aμ[[μ]]))]Exp[-αμ[[μ,kA]]((Norm[r-Aμ[[μ]]])^2)],(x|y|z)∈Reals]),{μ,nBas}];

(* Compute one-electron integrals *)
Print["Reading one-electron integrals..."];
TabInt=ReadList[StringJoin["Ov.",FileInt,".dat"],{Number,Number,Real}];	nInt=Length[TabInt];
S=Normal[SparseArray[Table[{TabInt[[k,1]],TabInt[[k,2]]}->TabInt[[k,3]],{k,nInt}]]];
TabInt=ReadList[StringJoin["Kin.",FileInt,".dat"],{Number,Number,Real}];	nInt=Length[TabInt];
T=SparseArray[Table[{TabInt[[k,1]],TabInt[[k,2]]}->TabInt[[k,3]],{k,nInt}]];
TabInt=ReadList[StringJoin["Nuc.",FileInt,".dat"],{Number,Number,Real}];	nInt=Length[TabInt];
V=SparseArray[Table[{TabInt[[k,1]],TabInt[[k,2]]}->TabInt[[k,3]],{k,nInt}]];
X=CalcX[nBas,S];
Print["Done!"];

(* Read two-electron integrals *)
Print["Reading two-electron integrals..."];
TabInt=ReadList[StringJoin["ERI.",FileInt,".dat"],{Number,Number,Number,Number,Real}];	nInt=Length[TabInt];
U=SparseArray[
Join[
Table[{TabInt[[k,1]],TabInt[[k,2]],TabInt[[k,3]],TabInt[[k,4]]}->TabInt[[k,5]],{k,nInt}],
Table[{TabInt[[k,2]],TabInt[[k,1]],TabInt[[k,3]],TabInt[[k,4]]}->TabInt[[k,5]],{k,nInt}],
Table[{TabInt[[k,1]],TabInt[[k,2]],TabInt[[k,4]],TabInt[[k,3]]}->TabInt[[k,5]],{k,nInt}],
Table[{TabInt[[k,2]],TabInt[[k,1]],TabInt[[k,4]],TabInt[[k,3]]}->TabInt[[k,5]],{k,nInt}],
Table[{TabInt[[k,3]],TabInt[[k,4]],TabInt[[k,1]],TabInt[[k,2]]}->TabInt[[k,5]],{k,nInt}],
Table[{TabInt[[k,4]],TabInt[[k,3]],TabInt[[k,1]],TabInt[[k,2]]}->TabInt[[k,5]],{k,nInt}],
Table[{TabInt[[k,3]],TabInt[[k,4]],TabInt[[k,2]],TabInt[[k,1]]}->TabInt[[k,5]],{k,nInt}],
Table[{TabInt[[k,4]],TabInt[[k,3]],TabInt[[k,2]],TabInt[[k,1]]}->TabInt[[k,5]],{k,nInt}]
]
];

(* Perform HF calculation *)
Print[Style["RHF calculation...",Bold,Orange]];
{tRHF,TabHF}=Timing[eRHF[n,nBas,w,ENuc,χμ,S,T,V,U,X]];
Print[TabHF];
Print["CPU time = ",tRHF];

Return[":-)"];
];

He/6-31G

eDFT[2,2,0,{{0.,0.,0.}},{2},
{
{1,"S",{38.4216340,5.7780300,1.2417740},{0.0237660,0.1546790,0.4696300}},
{1,"S",{0.2979640},{1.}}
},
"He.6-31G"]

(Subscript[H, 2])/6-31G

eDFT[2,4,0,{{0.,0.,-0.7},{0.,0.,0.7}},{1,1},
{
{1,"S",{18.7311370,2.8253937,0.6401217},{0.03349460,0.23472695,0.81375733}},
{1,"S",{0.1612778},{1.}},
{2,"S",{18.7311370,2.8253937,0.6401217},{0.03349460,0.23472695,0.81375733}},
{2,"S",{0.1612778},{1.}}
},
"H2.6-31G"]

(Subscript[H, 2])/6-31G**

eDFT[2,10,0,{{0.,0.,-0.7},{0.,0.,0.7}},{1,1},
{
{1,"S",{18.7311370,2.8253937,0.6401217},{0.03349460,0.23472695,0.81375733}},
{1,"S",{0.1612778},{1.}},
{1,"P",{1.1000000},{1.}},
{2,"S",{18.7311370,2.8253937,0.6401217},{0.03349460,0.23472695,0.81375733}},
{2,"S",{0.1612778},{1.}},
{2,"P",{1.1000000},{1.}}
},
"H2.6-31Gss"]

(Subscript[H, 2])/aug-cc-pVDZ

eDFT[2,18,0,{{0.,0.,-0.7},{0.,0.,0.7}},{1,1},
{
{1,"S",{13.0100000,1.9620000,0.4446000},{0.0196850,0.1379770,0.4781480}},
{1,"S",{0.1220000},{1.}},
{1,"S",{0.0297400},{1.}},
{1,"P",{0.7270000},{1.}},
{1,"P",{0.1410000},{1.}},
{2,"S",{13.0100000,1.9620000,0.4446000},{0.0196850,0.1379770,0.4781480}},
{2,"S",{0.1220000},{1.}},
{2,"S",{0.0297400},{1.}},
{2,"P",{0.7270000},{1.}},
{2,"P",{0.1410000},{1.}}
},
"H2.AVDZ"]

Be/6-31G

eDFT[4,9,0,{{0.,0.,0.}},{4.},
{
{1,"S",{1264.5857000,189.9368100,43.1590890,12.0986630,3.8063232,1.2728903},{0.0019448,0.0148351,0.0720906,0.2371542,0.4691987,0.3565202}},
{1,"S",{3.1964631,0.7478133,0.2199663},{-0.1126487,-0.2295064,1.1869167}},
{1,"P",{3.1964631,0.7478133,0.2199663},{0.0559802,0.2615506,0.7939723}},
{1,"S",{0.0823099},{1.}},
{1,"P",{0.0823099},{1.}}
},
"Be.6-31G"]