Initialization

HaToeV=27.21138602;

SetDirectory["~/Dropbox/Manuscripts/CASPT3/Data"];

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

Error histograms

Sheet=4;

WFT={"CASSCF",};
MAE=Import["FCI-all.xlsx"][[Sheet,3;;286,41+{18}]];
graph=
Show[{
Histogram[MAE[[;;,1]],20,"PDF",PlotTheme->"Scientific",BaseStyle->14,PlotRange->{{-2.2,+2.2},Automatic},FrameLabel->{"Error (eV)",None},ChartStyle->{Directive[Opacity[0.5],Black]},FrameTicks->{Automatic,None},FrameStyle->Directive[Thick,20,Black],PlotLabel->Style[WFT[[1]]<>" MAE: "<>ToString[SetAccuracy[Mean[Abs[DeleteCases[MAE[[;;,1]],""]]],3]]<>" eV",20]]
,
SmoothHistogram[DeleteCases[MAE[[;;,1]],""],Automatic,"PDF",PlotRange->{{-2.2,2.2},Automatic},PlotStyle->Directive[Black,Thickness[0.01]],Filling->Bottom,PlotTheme->"Web"]
},ImageSize->300]
Export["CASSCF.pdf",%];

WFT={"CASPT2(IPEA)","CASPT2(NOIPEA)","CASPT3(IPEA)","CASPT3(NOIPEA)"};
MAE=Import["FCI-all.xlsx"][[Sheet,3;;286,41+{19,20,21,22}]];
graph=Table[
Show[{
Histogram[MAE[[;;,m]],20,"PDF",PlotTheme->"Scientific",BaseStyle->14,PlotRange->{{-1,+1},Automatic},FrameLabel->{"Error (eV)",None},ChartStyle->{Directive[Opacity[0.5],ColorData[1,"ColorList"][[m]]]},FrameTicks->{Automatic,None},FrameStyle->Directive[Thick,20,Black],PlotLabel->Style[WFT[[m]]<>" MAE: "<>ToString[SetAccuracy[Mean[Abs[DeleteCases[MAE[[;;,m]],""]]],3]]<>" eV",20]]
,
SmoothHistogram[DeleteCases[MAE[[;;,m]],""],Automatic,"PDF",PlotRange->{{-1,1},Automatic},PlotStyle->Directive[ColorData[1,"ColorList"][[m]],Thickness[0.01]],Filling->Bottom,PlotTheme->"Web"]
},ImageSize->300]
,{m,4}];
Grid[{graph[[1;;2]],graph[[3;;4]]},Spacings->{1,2}]
Export["PT2_vs_PT3.pdf",%];

Table[
{SetAccuracy[Mean[Abs[DeleteCases[MCSi[[;;,m]],""]]],3],
SetAccuracy[Mean[Abs[Select[DeleteCases[MCSi[[;;,m]],""],#<=0.4&]]],3]}
,{m,4}]

WFT={"CASPT2(IPEA)","CASPT2(NOIPEA)","CASPT3(IPEA)","CASPT3(NOIPEA)"};
MC=Import["FCI-all.xlsx"][[Sheet,3;;286,60;;63]];
ST=Import["FCI-all.xlsx"][[Sheet,3;;286,6]];
VR=Import["FCI-all.xlsx"][[Sheet,3;;286,7]];
Size=Import["FCI-all.xlsx"][[Sheet,3;;286,3]];
Type=Import["FCI-all.xlsx"][[Sheet,3;;286,8]];
MCSi=MC[[Flatten[Position[ST,1.]],;;]];
MCTr=MC[[Flatten[Position[ST,3.]],;;]];
MCVal=MC[[Flatten[Position[VR,"V"]],;;]];
MCRyd=MC[[Flatten[Position[VR,"R"]],;;]];
MCnpi=MC[[Flatten[Position[Type,"npi"]],;;]];
MCppi=MC[[Flatten[Position[Type,"ppi"]],;;]];
MCdou=MC[[Flatten[Position[Type,"dou"]],;;]]
nonH3=MC[[Flatten[Position[Size,3.]],;;]];
nonH4=MC[[Flatten[Position[Size,4.]],;;]];
nonH56=Join[MC[[Flatten[Position[Size,5.]],;;]],MC[[Flatten[Position[Size,6.]],;;]]];
graphSi=Table[
Show[{
Histogram[MCSi[[;;,m]],20,"PDF",PlotTheme->"Scientific",BaseStyle->14,PlotRange->{{-1,+1},Automatic},FrameLabel->{"Error (eV)",None},ChartStyle->{Directive[Opacity[0.5],ColorData[1,"ColorList"][[m]]]},FrameTicks->{Automatic,None},FrameStyle->Directive[Thick,20,Black],PlotLabel->Style["Singlet transitions: \n "<>WFT[[m]]<>" MAE: "<>ToString[SetAccuracy[Mean[Abs[DeleteCases[MCSi[[;;,m]],""]]],3]]<>" eV",20]]
,
SmoothHistogram[DeleteCases[MCSi[[;;,m]],""],Automatic,"PDF",PlotRange->{{-1,1},Automatic},PlotStyle->Directive[ColorData[1,"ColorList"][[m]],Thickness[0.01]],Filling->Bottom,PlotTheme->"Web"]
},ImageSize->300]
,{m,4}];
graphTr=Table[
Show[{
Histogram[MCTr[[;;,m]],20,"PDF",PlotTheme->"Scientific",BaseStyle->14,PlotRange->{{-1,+1},Automatic},FrameLabel->{"Error (eV)",None},ChartStyle->{Directive[Opacity[0.5],ColorData[1,"ColorList"][[m]]]},FrameTicks->{Automatic,None},FrameStyle->Directive[Thick,20,Black],PlotLabel->Style["Triplet transitions: \n  "<>WFT[[m]]<>" MAE: "<>ToString[SetAccuracy[Mean[Abs[DeleteCases[MCTr[[;;,m]],""]]],3]]<>" eV",20]]
,
SmoothHistogram[DeleteCases[MCTr[[;;,m]],""],Automatic,"PDF",PlotRange->{{-1,1},Automatic},PlotStyle->Directive[ColorData[1,"ColorList"][[m]],Thickness[0.01]],Filling->Bottom,PlotTheme->"Web"]
},ImageSize->300]
,{m,4}];
graphVal=Table[
Show[{
Histogram[MCVal[[;;,m]],20,"PDF",PlotTheme->"Scientific",BaseStyle->14,PlotRange->{{-1,+1},Automatic},FrameLabel->{"Error (eV)",None},ChartStyle->{Directive[Opacity[0.5],ColorData[1,"ColorList"][[m]]]},FrameTicks->{Automatic,None},FrameStyle->Directive[Thick,20,Black],PlotLabel->Style["Valence transitions: \n  "<>WFT[[m]]<>" MAE: "<>ToString[SetAccuracy[Mean[Abs[DeleteCases[MCVal[[;;,m]],""]]],3]]<>" eV",20]]
,
SmoothHistogram[DeleteCases[MCVal[[;;,m]],""],Automatic,"PDF",PlotRange->{{-1,1},Automatic},PlotStyle->Directive[ColorData[1,"ColorList"][[m]],Thickness[0.01]],Filling->Bottom,PlotTheme->"Web"]
},ImageSize->300]
,{m,4}];
graphRyd=Table[
Show[{
Histogram[MCRyd[[;;,m]],20,"PDF",PlotTheme->"Scientific",BaseStyle->14,PlotRange->{{-1,+1},Automatic},FrameLabel->{"Error (eV)",None},ChartStyle->{Directive[Opacity[0.5],ColorData[1,"ColorList"][[m]]]},FrameTicks->{Automatic,None},FrameStyle->Directive[Thick,20,Black],PlotLabel->Style["Rydberg transitions: \n  "<>WFT[[m]]<>" MAE: "<>ToString[SetAccuracy[Mean[Abs[DeleteCases[MCRyd[[;;,m]],""]]],3]]<>" eV",20]]
,
SmoothHistogram[DeleteCases[MCRyd[[;;,m]],""],Automatic,"PDF",PlotRange->{{-1,1},Automatic},PlotStyle->Directive[ColorData[1,"ColorList"][[m]],Thickness[0.01]],Filling->Bottom,PlotTheme->"Web"]
},ImageSize->300]
,{m,4}];
graphS3=Table[
Show[{
Histogram[nonH3[[;;,m]],20,"PDF",PlotTheme->"Scientific",BaseStyle->14,PlotRange->{{-1,+1},Automatic},FrameLabel->{"Error (eV)",None},ChartStyle->{Directive[Opacity[0.5],ColorData[1,"ColorList"][[m]]]},FrameTicks->{Automatic,None},FrameStyle->Directive[Thick,20,Black],PlotLabel->Style["3 non-H atoms: \n  "<>WFT[[m]]<>" MAE: "<>ToString[SetAccuracy[Mean[Abs[DeleteCases[nonH3[[;;,m]],""]]],3]]<>" eV",20]]
,
SmoothHistogram[DeleteCases[nonH3[[;;,m]],""],Automatic,"PDF",PlotRange->{{-1,1},Automatic},PlotStyle->Directive[ColorData[1,"ColorList"][[m]],Thickness[0.01]],Filling->Bottom,PlotTheme->"Web"]
},ImageSize->300]
,{m,4}];
graphS4=Table[
Show[{
Histogram[nonH4[[;;,m]],20,"PDF",PlotTheme->"Scientific",BaseStyle->14,PlotRange->{{-1,+1},Automatic},FrameLabel->{"Error (eV)",None},ChartStyle->{Directive[Opacity[0.5],ColorData[1,"ColorList"][[m]]]},FrameTicks->{Automatic,None},FrameStyle->Directive[Thick,20,Black],PlotLabel->Style["4 non-H atoms: \n  "<>WFT[[m]]<>" MAE: "<>ToString[SetAccuracy[Mean[Abs[DeleteCases[nonH4[[;;,m]],""]]],3]]<>" eV",20]]
,
SmoothHistogram[DeleteCases[nonH4[[;;,m]],""],Automatic,"PDF",PlotRange->{{-1,1},Automatic},PlotStyle->Directive[ColorData[1,"ColorList"][[m]],Thickness[0.01]],Filling->Bottom,PlotTheme->"Web"]
},ImageSize->300]
,{m,4}];
graphS56=Table[
Show[{
Histogram[nonH56[[;;,m]],20,"PDF",PlotTheme->"Scientific",BaseStyle->14,PlotRange->{{-1,+1},Automatic},FrameLabel->{"Error (eV)",None},ChartStyle->{Directive[Opacity[0.5],ColorData[1,"ColorList"][[m]]]},FrameTicks->{Automatic,None},FrameStyle->Directive[Thick,20,Black],PlotLabel->Style["5-6 non-H atoms: \n  "<>WFT[[m]]<>" MAE: "<>ToString[SetAccuracy[Mean[Abs[DeleteCases[nonH56[[;;,m]],""]]],3]]<>" eV",20]]
,
SmoothHistogram[DeleteCases[nonH56[[;;,m]],""],Automatic,"PDF",PlotRange->{{-1,1},Automatic},PlotStyle->Directive[ColorData[1,"ColorList"][[m]],Thickness[0.01]],Filling->Bottom,PlotTheme->"Web"]
},ImageSize->300]
,{m,4}];
Grid[{graphSi,graphTr,graphVal,graphRyd,graphS3,graphS4,graphS56},Spacings->{1,2}]
Export["subsets.pdf",%];

Error wrt TBEs

Sheet=4;

WFT={"CASPT2(IPEA)","CASPT2(NOIPEA)","CASPT3(IPEA)","CASPT3(NOIPEA)","SC-NEVPT2","PC-NEVPT2"};
MAE=Import["FCI-all.xlsx"][[Sheet,3;;286,39+{19,20,21,22,23,24}]];
CASSCF=Table[{k,MAE[[k,1]]},{k,284}];
CASPT2IPEA=Table[{k,MAE[[k,2]]},{k,284}];
CASPT2NOIPEA=Table[{k,MAE[[k,3]]},{k,284}];
CASPT3IPEA=Table[{k,MAE[[k,4]]},{k,284}];
CASPT3NOIPEA=Table[{k,MAE[[k,5]]},{k,284}];
ListPlot[{CASPT2NOIPEA,CASPT3NOIPEA},
PlotTheme->"Scientific",FrameLabel->{"# excitation","Error (eV)"},PlotMarkers->"OpenMarkers",Joined->True,
ImageSize->1500,AspectRatio->1/6,PlotLegends->Placed[{(*"CASPT2(IPEA)",*)"CASPT2(NOIPEA)",(*"CASPT3(IPEA)",*)"CASPT3(NOIPEA)"},Right],
Frame->True,Axes->False,PlotRange->{{0,286},{-0.2,0.5}},GridLines->{Automatic,Automatic},
BaseStyle->20,FrameStyle->Directive[Thick,20,Black]]
(*Export["PT2_vs_PT3.pdf",%];*)

Table

tab=Import["FCI-all.xlsx"][[Sheet,3;;286,{1,2,5,7,8,9,11,13,19,20,21,22,23,24}]];
TableForm[Table[{IntegerPart[tab[[k,1]]],tab[[k,2]],"$"<>StringTrim[tab[[k,3]]]<>"("<>tab[[k,5]]<>")$",tab[[k,4]],tab[[k,6]],tab[[k,7]],tab[[k,8]],tab[[k,9]],tab[[k,10]],tab[[k,11]],tab[[k,12]],tab[[k,13]]},{k,Length[tab]}],TableHeadings->{ None,{"#","Molecule","Excitation","Nature","$\%T_1$","TBE","Safe?","CASSCF","CASPT2(IPEA)","CASPT2(NOIPEA)","CASPT3(IPEA)","CASPT3(NOIPEA)"}}]

Timings

(*timings={
{3.86 (10^6),1.49 (10^8),12.50,33.25},
{4.79 (10^6),2.04 (10^8),13.24,49.36},
{1.46 (10^7),1.82 (10^9),193.93,282.62},
{6.95 (10^6),6.38 (10^8),29.58,174.96}
};
tPT2=timings[[;;,{2,3}]];
tPT3=timings[[;;,{2,4}]];
ratio=Table[{tPT2[[k,1]],tPT2[[k,2]]/(tPT2[[k,2]]+tPT3[[k,2]])},{k,Length[tPT2]}];*)

timings={
{1320018+15218830,1.86,5.61},
{1731416+24240552,5.52,6.98},
{2452657+97100145,8.56,21.48},
{3719203+196989406,23.26,52.92},
{4501292+229050132,10.64,59.76},
{7271286+369121938,38.82,249.01},
{15868408+897752131,158.74,1332.66},
{39649477+3528121180,578.49,6332.44}
};
tPT2=timings[[;;,{1,2}]];
tPT3=timings[[;;,{1,3}]];
ratio=Table[{tPT2[[k,1]],tPT3[[k,2]]/tPT2[[k,2]]},{k,Length[tPT2]}];

ListLogPlot[{ratio[[5;;8]]},PlotMarkers->{"OpenMarkers",Large},
PlotTheme->"Scientific",FrameLabel->{MaTeX["\\text{\\# external configurations}",FontSize->24],MaTeX["t_\\text{PT3}/t_\\text{PT2}",FontSize->24]},Joined->True,
ImageSize->500,
Frame->True,Axes->False,PlotRange->All,GridLines->{Automatic,Automatic},
BaseStyle->16,FrameStyle->Directive[Thick,16,Black],PlotStyle->Thickness[0.01]]