(* Content-type: application/vnd.wolfram.cdf.text *) (*** Wolfram CDF File ***) (* http://www.wolfram.com/cdf *) (* CreatedBy='Mathematica 9.0' *) (*************************************************************************) (* *) (* The Mathematica License under which this file was created prohibits *) (* restricting third parties in receipt of this file from republishing *) (* or redistributing it by any means, including but not limited to *) (* rights management or terms of use, without the express consent of *) (* Wolfram Research, Inc. For additional information concerning CDF *) (* licensing and redistribution see: *) (* *) (* www.wolfram.com/cdf/adopting-cdf/licensing-options.html *) (* *) (*************************************************************************) (*CacheID: 234*) (* Internal cache information: NotebookFileLineBreakTest NotebookFileLineBreakTest NotebookDataPosition[ 1063, 20] NotebookDataLength[ 1115279, 19411] NotebookOptionsPosition[ 1114284, 19350] NotebookOutlinePosition[ 1115137, 19384] CellTagsIndexPosition[ 1115055, 19379] WindowFrame->Normal*) (* Beginning of Notebook Content *) Notebook[{ Cell[TextData[StyleBox["BETA VERSION 4.0 ", FontFamily->"Arial Bold", FontColor->RGBColor[0.01680018310826276, 0.19832150759136338`, 1.]]], "Text",\ Evaluatable->True], Cell["\<\ Marius Wehrle, Aur\[EAcute]lien Patoz, Miroslav Sulc\ \>", "Text", Evaluatable->True, TextAlignment->Right], Cell[TextData[StyleBox["LABORATORY OF THEORETICAL PHYSICAL CHEMISTRY - EPFL\n\ MUST Education Competition 2013", FontFamily->"Arial Bold"]], "Text", Evaluatable->True, TextAlignment->Left], Cell[CellGroupData[{ Cell["Create your own experiment!", "Title", Evaluatable->True, TextAlignment->Center], Cell[TextData[{ "Apply your pulse to the ", StyleBox["Na-I", FontFamily->"Arial Bold"], " molecule. \n\t\nNotes:\n-\tThis version can be watched with the ", StyleBox["free", FontFamily->"Arial Italic"], " \[OpenCurlyDoubleQuote]Wolfram CDF Player\[CloseCurlyDoubleQuote]: \ http://www.wolfram.com/cdf-player/" }], "Text", Evaluatable->True], Cell[BoxData[ RowBox[{ RowBox[{"(*", "Definitions", "*)"}], "\[IndentingNewLine]", RowBox[{ RowBox[{ RowBox[{"buttColor", "=", "Green"}], ";"}], "\[IndentingNewLine]", RowBox[{ RowBox[{"shiftQ", "=", "0."}], ";"}], "\[IndentingNewLine]", RowBox[{ RowBox[{"mass", "=", "35480.25"}], ";"}], "\[IndentingNewLine]", RowBox[{ RowBox[{"TAU2FS", "=", "0.0241888"}], ";"}], "\[IndentingNewLine]", RowBox[{ RowBox[{"BOHR2ANG", "=", "0.52917720859"}], ";"}], "\[IndentingNewLine]", "\[IndentingNewLine]", RowBox[{ RowBox[{"saveFreq", "=", "1"}], ";"}], "\[IndentingNewLine]", RowBox[{ RowBox[{"saveLimit", "=", "300"}], ";"}], "\[IndentingNewLine]", RowBox[{ RowBox[{"gridLimit", "=", "256"}], ";"}], "\[IndentingNewLine]", "\[IndentingNewLine]", RowBox[{"(*", " ", RowBox[{"some", " ", "start", " ", "values"}], " ", "*)"}], "\[IndentingNewLine]", RowBox[{ RowBox[{"exampleQ", "=", "1"}], ";"}], "\[IndentingNewLine]", RowBox[{ RowBox[{"timeDep", "=", "True"}], ";"}], "\[IndentingNewLine]", RowBox[{ RowBox[{"newCalc", "=", "True"}], ";"}], "\[IndentingNewLine]", "\[IndentingNewLine]", RowBox[{"(*", " ", RowBox[{ RowBox[{"Potential", "/", "Transition"}], " ", "Dipole"}], " ", "*)"}], "\[IndentingNewLine]", RowBox[{ RowBox[{"potOpt", "=", RowBox[{"{", "\"\\"", "}"}]}], ";"}], "\[IndentingNewLine]", RowBox[{"(*", RowBox[{ RowBox[{"potOpt", "=", RowBox[{"{", RowBox[{"\"\\"", ",", RowBox[{"{", RowBox[{"0.0", ",", "0.179704196969471"}], "}"}], ",", RowBox[{"{", RowBox[{"4.887660162973332", "*", RowBox[{"10", "^", RowBox[{"-", "3"}]}]}], "}"}], ",", RowBox[{"{", RowBox[{ RowBox[{"{", "0.0", "}"}], ",", RowBox[{"{", RowBox[{ RowBox[{"-", "8.209799100813852"}], "*", RowBox[{"10", "^", RowBox[{"-", "3"}]}]}], "}"}]}], "}"}], ",", RowBox[{"{", RowBox[{"{", RowBox[{"6.159186791837070", "*", RowBox[{"10", "^", RowBox[{"-", "003"}]}]}], "}"}], "}"}]}], "}"}]}], ";"}], "*)"}], RowBox[{"(*", " ", RowBox[{"{", RowBox[{ "\"\\"", ",", "verticalE", ",", "freq", ",", "vibCorr1st", ",", "surfCouplings1st"}], "}"}], "*)"}], "\[IndentingNewLine]", RowBox[{ RowBox[{"dipolInfo", "=", RowBox[{"{", RowBox[{"\"\\"", ",", RowBox[{"{", RowBox[{ RowBox[{"{", RowBox[{ RowBox[{"{", RowBox[{"0.0", ",", "0.0", ",", "0.0"}], "}"}], ",", RowBox[{"{", RowBox[{"0.1", ",", "0.1", ",", "0.1"}], "}"}]}], "}"}], ",", RowBox[{"{", RowBox[{ RowBox[{"{", RowBox[{"0.1", ",", "0.1", ",", "0.1"}], "}"}], ",", RowBox[{"{", RowBox[{"0.0", ",", "0.0", ",", "0.0"}], "}"}]}], "}"}]}], "}"}]}], "}"}]}], ";"}], " ", "\[IndentingNewLine]", "\[IndentingNewLine]", RowBox[{"(*", " ", RowBox[{"Initial", " ", "Values"}], " ", "*)"}], "\[IndentingNewLine]", RowBox[{ RowBox[{"IgridInfo", "=", RowBox[{"{", RowBox[{"128", ",", "3", ",", "8"}], "}"}]}], ";", RowBox[{"(*", " ", RowBox[{"n", ",", "qmin", ",", "qmax"}], " ", "*)"}], " ", ";"}], "\[IndentingNewLine]", RowBox[{ RowBox[{"IpsiInit", "=", RowBox[{"{", RowBox[{"\"\\"", ",", RowBox[{"{", RowBox[{"1.0", ",", "0.0"}], "}"}], ",", "5.049104313929139`", ",", "0.0", ",", "0.14802122290650707`"}], "}"}]}], ";", " ", RowBox[{"(*", " ", RowBox[{ "kind", ",", "population", ",", " ", "Q0", ",", " ", "P0", ",", " ", "\[Sigma]"}], " ", "*)"}], ";"}], "\[IndentingNewLine]", RowBox[{ RowBox[{"IpulseInfo", "=", RowBox[{"{", RowBox[{"\"\\"", ",", RowBox[{"{", RowBox[{"0.02", ",", "0.02", ",", "0.02"}], "}"}], ",", RowBox[{"0.1430464", "-", "0.0006431841851161906`"}], ",", "166.591", ",", "500.0"}], "}"}]}], ";"}], "\[IndentingNewLine]", RowBox[{ RowBox[{"nStepI", "=", "600"}], ";"}], "\[IndentingNewLine]", RowBox[{ RowBox[{"dtI", "=", "4.5"}], ";"}], "\[IndentingNewLine]", RowBox[{ RowBox[{"rangePotI", "=", RowBox[{"{", RowBox[{"All", ",", RowBox[{"{", RowBox[{ RowBox[{"-", "0.13"}], ",", "0.22"}], "}"}]}], "}"}]}], ";"}], "\[IndentingNewLine]", "\[IndentingNewLine]", RowBox[{"(*", " ", RowBox[{ RowBox[{ RowBox[{"Data", " ", "\[IndentingNewLine]", "gridInfo"}], "=", RowBox[{"{", RowBox[{"128", ",", "3", ",", "8"}], "}"}]}], ";", RowBox[{"(*", " ", RowBox[{"n", ",", "qmin", ",", "qmax"}], " ", "*)"}], " ", "\[IndentingNewLine]", RowBox[{"psiInit", "=", RowBox[{"{", RowBox[{"\"\\"", ",", RowBox[{"{", RowBox[{"1.0", ",", "0.0"}], "}"}], ",", "5.049104313929139`", ",", "0.0", ",", "0.14802122290650707`"}], "}"}]}], ";", " ", RowBox[{"(*", " ", RowBox[{ "kind", ",", "population", ",", " ", "Q0", ",", " ", "P0", ",", " ", "\[Sigma]"}], " ", "*)"}], "\[IndentingNewLine]", RowBox[{"pulseInfo", "=", RowBox[{"{", RowBox[{"\"\\"", ",", RowBox[{"{", RowBox[{"0.02", ",", "0.02", ",", "0.02"}], "}"}], ",", RowBox[{"0.1430464", "-", "0.0006431841851161906`"}], ",", "166.591", ",", "500.0"}], "}"}]}], ";"}], " ", "\[IndentingNewLine]", "*)"}], "\[IndentingNewLine]", "\[IndentingNewLine]", "\[IndentingNewLine]", "\[IndentingNewLine]"}]}]], "Input", CellOpen->False], Cell[BoxData[ RowBox[{ RowBox[{"(*", RowBox[{ "Function", " ", "that", " ", "calulates", " ", "the", " ", "MatrixElement"}], "*)"}], "\n", RowBox[{ RowBox[{ RowBox[{"potIndexVibCouplingFirst", "[", RowBox[{ "q_", ",", " ", "verticalE_", ",", " ", "freq_", ",", " ", "vibCorr1st_", ",", " ", "surfCouplings1st_", ",", " ", "matIndex_"}], "]"}], " ", ":=", " ", RowBox[{"Module", "[", RowBox[{ RowBox[{"{", RowBox[{ RowBox[{"i", " ", "=", " ", RowBox[{"matIndex", "[", RowBox[{"[", "1", "]"}], "]"}]}], ",", " ", RowBox[{"j", " ", "=", " ", RowBox[{"matIndex", "[", RowBox[{"[", "2", "]"}], "]"}]}], ",", " ", "cI", ",", " ", "n", ",", " ", "V", ",", RowBox[{"nSurf", "=", "2"}]}], "}"}], ",", " ", RowBox[{ RowBox[{"Which", "[", RowBox[{ RowBox[{"i", " ", "==", " ", "j"}], ",", " ", RowBox[{"V", " ", "=", " ", RowBox[{ RowBox[{"verticalE", "[", RowBox[{"[", "i", "]"}], "]"}], " ", "+", " ", RowBox[{"Total", "[", RowBox[{ RowBox[{"(", RowBox[{"freq", "/", "2.0"}], ")"}], "*", RowBox[{"q", "^", "2"}]}], "]"}], " ", "+", " ", RowBox[{"Total", "[", RowBox[{ RowBox[{"vibCorr1st", "[", RowBox[{"[", "i", "]"}], "]"}], "*", "q"}], "]"}]}]}], ",", RowBox[{"(*", RowBox[{ "cI", " ", "is", " ", "the", " ", "index", " ", "for", " ", "the", " ", "surfCouplings1st"}], "*)"}], RowBox[{"j", " ", ">", " ", "i"}], ",", " ", RowBox[{ RowBox[{"cI", " ", "=", " ", RowBox[{ RowBox[{"Sum", "[", RowBox[{ RowBox[{"nSurf", " ", "-", " ", "n"}], ",", " ", RowBox[{"{", RowBox[{"n", ",", " ", "1", ",", " ", RowBox[{"i", " ", "-", " ", "1"}]}], "}"}]}], "]"}], " ", "+", " ", RowBox[{"(", RowBox[{"j", " ", "-", " ", "i"}], ")"}]}]}], ";", "\n", " ", RowBox[{"V", " ", "=", " ", RowBox[{"Total", "[", RowBox[{ RowBox[{"surfCouplings1st", "[", RowBox[{"[", "cI", "]"}], "]"}], "*", "q"}], "]"}]}]}], ",", " ", RowBox[{"j", " ", "<", " ", "i"}], ",", " ", RowBox[{ RowBox[{"cI", " ", "=", " ", RowBox[{ RowBox[{"Sum", "[", RowBox[{ RowBox[{"nSurf", " ", "-", " ", "n"}], ",", " ", RowBox[{"{", RowBox[{"n", ",", " ", "1", ",", " ", RowBox[{"j", " ", "-", " ", "1"}]}], "}"}]}], "]"}], " ", "+", " ", RowBox[{"(", RowBox[{"i", " ", "-", " ", "j"}], ")"}]}]}], ";", "\n", " ", RowBox[{"V", " ", "=", " ", RowBox[{"Conjugate", "[", RowBox[{"Total", "[", RowBox[{ RowBox[{"surfCouplings1st", "[", RowBox[{"[", "cI", "]"}], "]"}], "*", "q"}], "]"}], "]"}]}]}]}], "]"}], ";", "\n", " ", "V"}]}], "]"}]}], "\[IndentingNewLine]", RowBox[{"(*", RowBox[{ "potential", " ", "Function", " ", "gives", " ", "the", " ", "nSurf", "*", "nSurf", " ", "matrix"}], "*)"}], "\n", "\[IndentingNewLine]", "\[IndentingNewLine]", RowBox[{ RowBox[{"potentialNaI", "[", RowBox[{"q_", ",", RowBox[{"verticalE_:", "0.0762548"}], ",", RowBox[{"q0_:", "5.04554"}]}], "]"}], ":=", RowBox[{"Module", "[", RowBox[{ RowBox[{"{", RowBox[{ RowBox[{"maxE", "=", "50.0"}], ",", "\[IndentingNewLine]", RowBox[{"A2", "=", "101.428"}], ",", RowBox[{"b2", "=", "2.99849"}], ",", RowBox[{"rho", "=", "0.659322"}], ",", RowBox[{"l1", "=", "2.75328"}], ",", RowBox[{"l2", "=", "43.3979"}], ",", RowBox[{"C2", "=", "18.9107"}], ",", "\[IndentingNewLine]", RowBox[{"A1", "=", "0.0298772"}], ",", RowBox[{"b1", "=", "2.15905"}], ",", "\[IndentingNewLine]", RowBox[{"A12", "=", "0.00202121"}], ",", RowBox[{"b12", "=", "0.19409"}], ",", RowBox[{"qx", "=", "13.0957"}], ",", "\[IndentingNewLine]", "pot1", ",", " ", "pot2", ",", " ", "pot12"}], "}"}], ",", "\[IndentingNewLine]", RowBox[{ RowBox[{"pot1", "=", RowBox[{"N", "[", RowBox[{"A1", "*", RowBox[{"Exp", "[", RowBox[{ RowBox[{"-", "b1"}], "*", RowBox[{"(", RowBox[{"q", "-", "q0"}], ")"}]}], "]"}]}], "]"}]}], ";", "\[IndentingNewLine]", RowBox[{"pot12", "=", RowBox[{"N", "[", RowBox[{"A12", "*", RowBox[{"Exp", "[", RowBox[{ RowBox[{"-", "b12"}], "*", RowBox[{ RowBox[{"(", RowBox[{"q", "-", "qx"}], ")"}], "^", "2"}]}], "]"}]}], "]"}]}], ";", " ", "\[IndentingNewLine]", RowBox[{"pot2", "=", RowBox[{"N", "[", RowBox[{ RowBox[{ RowBox[{"(", RowBox[{"A2", "+", RowBox[{ RowBox[{"(", RowBox[{"b2", "/", "q"}], ")"}], "^", "8"}]}], ")"}], "*", RowBox[{"Exp", "[", RowBox[{ RowBox[{"-", "q"}], "/", "rho"}], "]"}]}], "-", RowBox[{"1", "/", "q"}], "-", RowBox[{ RowBox[{"(", RowBox[{"l1", "+", "l2"}], ")"}], "/", RowBox[{"(", RowBox[{"2", "*", RowBox[{"q", "^", "4"}]}], ")"}]}], "-", RowBox[{"C2", "/", RowBox[{"q", "^", "6"}]}], "-", RowBox[{"2", "*", "l1", "*", RowBox[{"l2", "/", RowBox[{"q", "^", "7"}]}]}], "+", "verticalE"}], "]"}]}], ";", "\[IndentingNewLine]", RowBox[{"(*", " ", RowBox[{ RowBox[{"MW", ":", " ", RowBox[{"set", " ", "maximal", " ", "energy"}]}], " ", "\[Rule]", " ", RowBox[{ "accuracy", " ", "problem", " ", "with", " ", "large", " ", "numbers"}]}], " ", "*)"}], "\[IndentingNewLine]", RowBox[{"If", "[", RowBox[{ RowBox[{"pot1", ">", "maxE"}], ",", RowBox[{"pot1", "=", "maxE"}]}], "]"}], ";", "\[IndentingNewLine]", RowBox[{"If", "[", RowBox[{ RowBox[{"pot2", ">", "maxE"}], ",", RowBox[{"pot2", "=", "maxE"}]}], "]"}], ";", "\[IndentingNewLine]", "\[IndentingNewLine]", RowBox[{"{", RowBox[{ RowBox[{"{", RowBox[{"pot2", ",", "pot12"}], "}"}], ",", RowBox[{"{", RowBox[{"pot12", ",", "pot1"}], "}"}]}], "}"}]}]}], "\[IndentingNewLine]", "]"}]}], "\n", "\[IndentingNewLine]", RowBox[{ RowBox[{"potentialE", "[", RowBox[{"potOpt_", ",", "qPoint_"}], "]"}], ":=", RowBox[{"Module", "[", RowBox[{ RowBox[{"{", "pot", "}"}], ",", "\[IndentingNewLine]", RowBox[{ RowBox[{"Switch", "[", RowBox[{ RowBox[{"potOpt", "[", RowBox[{"[", "1", "]"}], "]"}], ",", "\[IndentingNewLine]", "\"\\"", ",", RowBox[{ RowBox[{"pot", "=", RowBox[{"N", "[", RowBox[{"Array", "[", RowBox[{ RowBox[{ RowBox[{"potIndexVibCouplingFirst", "[", RowBox[{"qPoint", ",", " ", RowBox[{"potOpt", "[", RowBox[{"[", "2", "]"}], "]"}], ",", " ", RowBox[{"potOpt", "[", RowBox[{"[", "3", "]"}], "]"}], ",", " ", RowBox[{"potOpt", "[", RowBox[{"[", "4", "]"}], "]"}], ",", " ", RowBox[{"potOpt", "[", RowBox[{"[", "5", "]"}], "]"}], ",", " ", RowBox[{"{", "##", "}"}]}], "]"}], " ", "&"}], ",", " ", RowBox[{"{", RowBox[{"2", ",", " ", "2"}], "}"}]}], "]"}], "]"}]}], ";"}], ",", "\[IndentingNewLine]", "\"\\"", ",", " ", RowBox[{ RowBox[{"pot", "=", RowBox[{"potentialNaI", "[", "qPoint", "]"}]}], ";"}]}], "\[IndentingNewLine]", "]"}], ";", "\[IndentingNewLine]", "pot"}]}], "]"}]}], "\[IndentingNewLine]", "\[IndentingNewLine]", RowBox[{ RowBox[{"InitGrid", "[", "gridInfo_", "]"}], ":=", RowBox[{"Module", "[", RowBox[{ RowBox[{"{", RowBox[{ RowBox[{"n", "=", RowBox[{"gridInfo", "[", RowBox[{"[", "1", "]"}], "]"}]}], ",", RowBox[{"qmin", "=", RowBox[{"gridInfo", "[", RowBox[{"[", "2", "]"}], "]"}]}], ",", RowBox[{"qmax", "=", RowBox[{"gridInfo", "[", RowBox[{"[", "3", "]"}], "]"}]}], ",", "dq", ",", "dp", ",", "prange", ",", "qgrid", ",", "pgrid", ",", "pmin", ",", "pmax", ",", "M1", ",", "M2", ",", "fq", ",", "fp"}], "}"}], ",", "\[IndentingNewLine]", RowBox[{ RowBox[{"dq", "=", RowBox[{ RowBox[{"(", RowBox[{"qmax", "-", "qmin"}], ")"}], "/", "n"}]}], ";", "\[IndentingNewLine]", RowBox[{"prange", "=", RowBox[{"(", RowBox[{"2.0", FractionBox[ RowBox[{" ", "\[Pi]", " "}], "dq"]}], ")"}]}], ";", "\[IndentingNewLine]", RowBox[{"dp", "=", RowBox[{"prange", "/", "n"}]}], ";", "\[IndentingNewLine]", RowBox[{"pmin", "=", RowBox[{ RowBox[{"-", "prange"}], "/", "2.0"}]}], ";", "\[IndentingNewLine]", RowBox[{"pmax", "=", RowBox[{"prange", "/", "2.0"}]}], ";", "\[IndentingNewLine]", RowBox[{"qgrid", "=", RowBox[{"N", "[", RowBox[{"Range", "[", RowBox[{"qmin", ",", RowBox[{"qmax", "-", "dq"}], ",", "dq"}], "]"}], "]"}]}], ";", "\[IndentingNewLine]", RowBox[{"pgrid", "=", RowBox[{"N", "[", RowBox[{"Range", "[", RowBox[{"pmin", ",", RowBox[{"pmax", "-", "dp"}], ",", "dp"}], "]"}], "]"}]}], ";", RowBox[{"(*", " ", RowBox[{"P0", " ", "=", " ", RowBox[{ RowBox[{"0", " ", "!!"}], "!"}]}], " ", "*)"}], "\[IndentingNewLine]", RowBox[{"M1", "=", RowBox[{"Exp", "[", RowBox[{"\[ImaginaryI]", "*", "pmin", "*", RowBox[{"(", RowBox[{"qgrid", "-", "qmin"}], ")"}]}], "]"}]}], ";", "\[IndentingNewLine]", RowBox[{"M2", "=", RowBox[{"Exp", "[", RowBox[{"\[ImaginaryI]", "*", "qmin", "*", RowBox[{"(", RowBox[{"pgrid", "-", "pmin"}], ")"}]}], "]"}]}], ";", "\[IndentingNewLine]", RowBox[{"fq", "=", RowBox[{ RowBox[{"Sqrt", "[", "n", "]"}], "*", RowBox[{"dq", "/", RowBox[{"Sqrt", "[", RowBox[{"2.0", "*", "\[Pi]"}], "]"}]}]}]}], ";", "\[IndentingNewLine]", RowBox[{"fp", "=", RowBox[{ RowBox[{"Sqrt", "[", "n", "]"}], "*", RowBox[{"dp", "/", RowBox[{"Sqrt", "[", RowBox[{"2.0", "*", "\[Pi]"}], "]"}]}]}]}], ";", "\[IndentingNewLine]", "\[IndentingNewLine]", RowBox[{"{", RowBox[{ "qgrid", ",", "pgrid", ",", "M1", ",", "M2", ",", "fq", ",", "fp", ",", "dq"}], "}"}]}]}], "\[IndentingNewLine]", "]"}]}], "\[IndentingNewLine]", "\[IndentingNewLine]", "\[IndentingNewLine]", "\[IndentingNewLine]", RowBox[{ RowBox[{"initPsi", "[", RowBox[{"psiInit_", ",", "grid_"}], "]"}], ":=", RowBox[{"Module", "[", RowBox[{ RowBox[{"{", "psi", "}"}], ",", "\[IndentingNewLine]", RowBox[{ RowBox[{"Switch", "[", RowBox[{ RowBox[{"psiInit", "[", RowBox[{"[", "1", "]"}], "]"}], ",", "\[IndentingNewLine]", RowBox[{"(*", " ", RowBox[{"Gaussian", " ", "State", " ", "init"}], " ", "*)"}], "\[IndentingNewLine]", "\"\\"", ",", RowBox[{ RowBox[{"psi", "=", RowBox[{ RowBox[{ RowBox[{"(", RowBox[{ RowBox[{"Sqrt", "[", "#", "]"}], "*", RowBox[{"Sqrt", "[", RowBox[{"1.0", "/", RowBox[{"(", RowBox[{ RowBox[{"Sqrt", "[", "\[Pi]", "]"}], " ", "*", RowBox[{"psiInit", "[", RowBox[{"[", "5", "]"}], "]"}]}], ")"}]}], "]"}], "*", RowBox[{"Exp", "[", RowBox[{ RowBox[{"\[ImaginaryI]", "*", RowBox[{"psiInit", "[", RowBox[{"[", "4", "]"}], "]"}], "*", RowBox[{"(", RowBox[{"grid", "-", RowBox[{"psiInit", "[", RowBox[{"[", "3", "]"}], "]"}]}], ")"}]}], " ", "-", " ", RowBox[{"0.5", "*", RowBox[{ RowBox[{"(", RowBox[{ RowBox[{"(", RowBox[{"grid", "-", RowBox[{"psiInit", "[", RowBox[{"[", "3", "]"}], "]"}]}], ")"}], "/", RowBox[{"psiInit", "[", RowBox[{"[", "5", "]"}], "]"}]}], ")"}], "^", "2"}]}]}], "]"}]}], ")"}], "&"}], "/@", RowBox[{"psiInit", "[", RowBox[{"[", "2", "]"}], "]"}]}]}], ";"}]}], "\[IndentingNewLine]", "]"}], ";", "\[IndentingNewLine]", "psi"}]}], "\[IndentingNewLine]", "]"}]}], "\[IndentingNewLine]", "\[IndentingNewLine]", RowBox[{ RowBox[{ RowBox[{"gaussPulseShapeF", "[", RowBox[{"timeDepPotOpt_", ",", "t_"}], "]"}], ":=", RowBox[{"N", "[", RowBox[{ RowBox[{"Cos", "[", RowBox[{ RowBox[{"timeDepPotOpt", "[", RowBox[{"[", "3", "]"}], "]"}], "*", "t"}], "]"}], "*", RowBox[{"Exp", "[", RowBox[{ RowBox[{"-", RowBox[{ RowBox[{"(", RowBox[{"t", "-", RowBox[{"timeDepPotOpt", "[", RowBox[{"[", "5", "]"}], "]"}]}], ")"}], "^", "2"}]}], "/", RowBox[{"(", RowBox[{"2", "*", RowBox[{ RowBox[{"timeDepPotOpt", "[", RowBox[{"[", "4", "]"}], "]"}], "^", "2"}]}], ")"}]}], "]"}]}], "]"}]}], ";"}], "\[IndentingNewLine]", "\[IndentingNewLine]", RowBox[{ RowBox[{"propagation", "[", RowBox[{ "dt_", ",", "nStep_", ",", "mass_", ",", "gridInfo_", ",", "psiInfo_", ",", "potentialInfo_", ",", "gridLimit_", ",", "saveFreq_", ",", RowBox[{"timeDep_:", "False"}], ",", RowBox[{"pulseInfo_:", "\"\\""}], ",", RowBox[{"dipoleInfo_:", "\"\\""}]}], "]"}], ":=", RowBox[{"Module", "[", RowBox[{ RowBox[{"{", RowBox[{ RowBox[{"nSurf", "=", "2"}], ",", "psi", ",", "qmProp", ",", "t", ",", RowBox[{"gridSize", "=", RowBox[{"gridInfo", "[", RowBox[{"[", "1", "]"}], "]"}]}], ",", "uv", ",", "uk", ",", "grid", ",", "pgrid", ",", "M1", ",", "M2", ",", "fq", ",", "fp", ",", "dq", ",", "potential", ",", "corrSurface", ",", "muEO", ",", "uvF", ",", "avPos", ",", "i", ",", RowBox[{"saveGridFreq", "=", "1"}], ",", "\[IndentingNewLine]", "psiSave", ",", "pop", ",", "avPosS1", ",", "avPosS2"}], "}"}], ",", "\[IndentingNewLine]", RowBox[{"(*", " ", "*)"}], "\[IndentingNewLine]", RowBox[{"(*", " ", "Init", " ", "*)"}], "\[IndentingNewLine]", RowBox[{ RowBox[{ RowBox[{"{", RowBox[{ "grid", ",", "pgrid", ",", "M1", ",", "M2", ",", "fq", ",", "fp", ",", "dq"}], "}"}], "=", RowBox[{"InitGrid", "[", "gridInfo", "]"}]}], ";", "\[IndentingNewLine]", RowBox[{"If", "[", RowBox[{ RowBox[{"gridSize", ">", "gridLimit"}], ",", RowBox[{"saveGridFreq", "=", RowBox[{ RowBox[{"Floor", "[", "gridSize", "]"}], "/", "gridLimit"}]}]}], "]"}], ";", "\[IndentingNewLine]", RowBox[{"psi", "=", RowBox[{"initPsi", "[", RowBox[{"psiInfo", ",", "grid"}], "]"}]}], ";", "\[IndentingNewLine]", RowBox[{"(*", " ", RowBox[{ RowBox[{"potential", "=", RowBox[{ RowBox[{ RowBox[{"potentialNaI", "[", "#", "]"}], "&"}], "/@", "grid"}]}], ";"}], "*)"}], "\[IndentingNewLine]", RowBox[{"potential", "=", RowBox[{ RowBox[{ RowBox[{"potentialE", "[", RowBox[{"potentialInfo", ",", "#"}], "]"}], "&"}], "/@", "grid"}]}], ";", "\[IndentingNewLine]", RowBox[{"uk", "=", RowBox[{ RowBox[{ RowBox[{"DiagonalMatrix", "[", RowBox[{"ConstantArray", "[", RowBox[{ RowBox[{"(", RowBox[{"Exp", "[", RowBox[{ RowBox[{"-", "\[ImaginaryI]"}], "*", "dt", "*", RowBox[{ RowBox[{"#", "^", "2"}], "/", RowBox[{"(", RowBox[{"2.0", "*", "mass"}], ")"}]}]}], "]"}], ")"}], ",", "nSurf"}], "]"}], "]"}], "&"}], "/@", "pgrid"}]}], ";", "\[IndentingNewLine]", RowBox[{"uv", "=", RowBox[{ RowBox[{ RowBox[{"MatrixExp", "[", RowBox[{ RowBox[{"-", "\[ImaginaryI]"}], "*", "dt", "*", "0.5", "*", "#"}], "]"}], "&"}], "/@", "potential"}]}], ";", "\[IndentingNewLine]", RowBox[{"(*", RowBox[{ RowBox[{ RowBox[{"--", RowBox[{"--", RowBox[{"--", RowBox[{"--", RowBox[{"--", RowBox[{"-", " ", "Time"}]}]}]}]}]}], " ", "dependent", " ", "potential", " ", "condon"}], "-", RowBox[{ RowBox[{ RowBox[{ RowBox[{ RowBox[{"approx", " ", "--"}], "--"}], "--"}], "--"}], "--"}]}], "*)"}], "\[IndentingNewLine]", "\t", RowBox[{"(*", " ", "precomputation", " ", "*)"}], "\[IndentingNewLine]", "\t", RowBox[{"If", "[", RowBox[{"timeDep", ",", "\[IndentingNewLine]", "\t", RowBox[{ RowBox[{"muEO", "=", RowBox[{"-", RowBox[{ RowBox[{"dipoleInfo", "[", RowBox[{"[", "2", "]"}], "]"}], ".", RowBox[{"pulseInfo", "[", RowBox[{"[", "2", "]"}], "]"}]}]}]}], ";"}]}], "\[IndentingNewLine]", "\t", "]"}], ";", "\[IndentingNewLine]", "\t", RowBox[{"(*", " ", "function", " ", "*)"}], "\[IndentingNewLine]", "\t", "\[IndentingNewLine]", "\t", RowBox[{ RowBox[{"uvF", "[", "t_", "]"}], ":=", RowBox[{ RowBox[{ RowBox[{"MatrixExp", "[", RowBox[{ RowBox[{"-", "\[ImaginaryI]"}], "*", "dt", "*", "0.5", "*", "#"}], "]"}], "&"}], "/@", RowBox[{"N", "[", RowBox[{"potential", "+", RowBox[{"ConstantArray", "[", RowBox[{ RowBox[{"muEO", "*", RowBox[{"gaussPulseShapeF", "[", RowBox[{"pulseInfo", ",", "t"}], "]"}]}], ",", "gridSize"}], "]"}]}], "]"}]}]}], ";", "\[IndentingNewLine]", "\[IndentingNewLine]", RowBox[{"(*", " ", RowBox[{ RowBox[{ RowBox[{ RowBox[{"--", RowBox[{"--", RowBox[{"--", RowBox[{"--", RowBox[{"--", " ", "Function"}]}]}]}]}], " ", "Propagation"}], " ", "&"}], " ", RowBox[{ RowBox[{ RowBox[{ RowBox[{ RowBox[{ RowBox[{ RowBox[{ RowBox[{"Correlation", " ", "--"}], "--"}], "--"}], "--"}], "--"}], "--"}], "--"}], "--"}]}], " ", "*)"}], "\[IndentingNewLine]", "\t", RowBox[{ RowBox[{"corrSurface", "[", "psi_", "]"}], ":=", RowBox[{ RowBox[{ RowBox[{"Total", "[", RowBox[{"dq", "*", RowBox[{"Conjugate", "[", "#", "]"}], "*", "#"}], "]"}], "&"}], "/@", "psi"}]}], ";", "\[IndentingNewLine]", "\t", RowBox[{ RowBox[{"qmProp", "[", RowBox[{"matProp_", ",", "psi_"}], "]"}], ":=", RowBox[{"Module", "[", RowBox[{ RowBox[{"{", RowBox[{ RowBox[{"psiProp", "=", RowBox[{"ConstantArray", "[", RowBox[{ RowBox[{"0.0", "+", RowBox[{"I", "*", "0.0"}]}], ",", RowBox[{"{", RowBox[{"nSurf", ",", "gridSize"}], "}"}]}], "]"}]}], ",", "j", ",", "k"}], "}"}], ",", "\[IndentingNewLine]", RowBox[{"(*", " ", RowBox[{ RowBox[{ RowBox[{ RowBox[{ "Function", " ", "should", " ", "be", " ", "optimized"}], " ", "-", " ", RowBox[{"avoiding", " ", "Do"}], "-", RowBox[{ RowBox[{ RowBox[{"Loop", " ", "--"}], "--"}], " ", "Using", " ", "Thread"}]}], " ", "&"}], " ", "Map", " ", RowBox[{"was", "'"}], "n", " ", "general"}], "*)"}], "\[IndentingNewLine]", RowBox[{ RowBox[{"Do", "[", RowBox[{ RowBox[{"Do", "[", "\[IndentingNewLine]", RowBox[{ RowBox[{ RowBox[{"psiProp", "[", RowBox[{"[", "k", "]"}], "]"}], "+=", RowBox[{ RowBox[{"matProp", "[", RowBox[{"[", RowBox[{"All", ",", "k", ",", "j"}], "]"}], "]"}], "*", RowBox[{"psi", "[", RowBox[{"[", "j", "]"}], "]"}]}]}], ",", RowBox[{"{", RowBox[{"j", ",", "nSurf"}], "}"}]}], "]"}], ",", RowBox[{"{", RowBox[{"k", ",", "nSurf"}], "}"}]}], "]"}], ";", "\[IndentingNewLine]", "psiProp"}]}], "\[IndentingNewLine]", "]"}]}], ";", "\[IndentingNewLine]", "\[IndentingNewLine]", RowBox[{"(*", " ", RowBox[{ RowBox[{"--", RowBox[{"--", RowBox[{"-", " ", "average"}]}]}], " ", RowBox[{ RowBox[{"Position", " ", "--"}], "--"}]}], " ", "*)"}], "\[IndentingNewLine]", RowBox[{ RowBox[{"avPos", "[", "psi_", "]"}], ":=", RowBox[{"Re", "[", RowBox[{ RowBox[{"Total", "[", RowBox[{ RowBox[{"Conjugate", "[", "psi", "]"}], "*", "grid", "*", "psi"}], "]"}], "*", RowBox[{"dq", "/", RowBox[{"(", RowBox[{ RowBox[{ RowBox[{"Total", "[", RowBox[{ RowBox[{"Conjugate", "[", "psi", "]"}], "*", "psi"}], "]"}], "*", "dq"}], "+", RowBox[{"10", "^", RowBox[{"-", "8"}]}]}], ")"}]}]}], "]"}]}], ";", "\[IndentingNewLine]", "\[IndentingNewLine]", RowBox[{"(*", " ", RowBox[{"Propagation", " ", "TVT"}], " ", "*)"}], "\[IndentingNewLine]", RowBox[{"avPosS1", "=", RowBox[{"ConstantArray", "[", RowBox[{ RowBox[{"-", "1.0"}], ",", RowBox[{"nStep", "+", "1"}]}], "]"}]}], ";", "\[IndentingNewLine]", RowBox[{"avPosS2", "=", RowBox[{"ConstantArray", "[", RowBox[{ RowBox[{"-", "1.0"}], ",", RowBox[{"nStep", "+", "1"}]}], "]"}]}], ";", "\[IndentingNewLine]", RowBox[{"pop", "=", RowBox[{"ConstantArray", "[", RowBox[{ RowBox[{"N", "[", RowBox[{ RowBox[{"Re", "[", RowBox[{"corrSurface", "[", "psi", "]"}], "]"}], "*", "0.0"}], "]"}], ",", RowBox[{"nStep", "+", "1"}]}], "]"}]}], ";", "\[IndentingNewLine]", RowBox[{"psiSave", "=", RowBox[{"ConstantArray", "[", RowBox[{ RowBox[{ RowBox[{"Re", "[", RowBox[{"psi", "[", RowBox[{"[", RowBox[{"All", ",", RowBox[{"1", ";;", "All", ";;", "saveGridFreq"}]}], "]"}], "]"}], "]"}], "*", "0.0"}], ",", RowBox[{ RowBox[{"Floor", "[", RowBox[{"nStep", "/", "saveFreq"}], "]"}], "+", "1"}]}], "]"}]}], ";", "\[IndentingNewLine]", "\[IndentingNewLine]", RowBox[{ RowBox[{"pop", "[", RowBox[{"[", "1", "]"}], "]"}], "=", RowBox[{"N", "[", RowBox[{"Re", "[", RowBox[{"corrSurface", "[", "psi", "]"}], "]"}], "]"}]}], ";", "\[IndentingNewLine]", RowBox[{ RowBox[{"psiSave", "[", RowBox[{"[", "1", "]"}], "]"}], "=", RowBox[{"N", "[", RowBox[{"Re", "[", RowBox[{ RowBox[{"Conjugate", "[", RowBox[{"psi", "[", RowBox[{"[", RowBox[{"All", ",", RowBox[{"1", ";;", "All", ";;", "saveGridFreq"}]}], "]"}], "]"}], "]"}], "*", RowBox[{"psi", "[", RowBox[{"[", RowBox[{"All", ",", RowBox[{"1", ";;", "All", ";;", "saveGridFreq"}]}], "]"}], "]"}]}], "]"}], "]"}]}], ";", "\[IndentingNewLine]", RowBox[{ RowBox[{"avPosS1", "[", RowBox[{"[", "1", "]"}], "]"}], "=", RowBox[{"N", "[", RowBox[{"avPos", "[", RowBox[{"psi", "[", RowBox[{"[", "1", "]"}], "]"}], "]"}], "]"}]}], ";", "\[IndentingNewLine]", RowBox[{ RowBox[{"avPosS2", "[", RowBox[{"[", "1", "]"}], "]"}], "=", RowBox[{"N", "[", RowBox[{"avPos", "[", RowBox[{"psi", "[", RowBox[{"[", "2", "]"}], "]"}], "]"}], "]"}]}], ";", "\[IndentingNewLine]", RowBox[{"Do", "[", "\[IndentingNewLine]", RowBox[{ RowBox[{ RowBox[{"t", "=", RowBox[{"i", "*", "dt"}]}], ";", "\[IndentingNewLine]", "\[IndentingNewLine]", RowBox[{"If", "[", RowBox[{"timeDep", ",", RowBox[{ RowBox[{"uv", "=", RowBox[{"uvF", "[", "t", "]"}]}], ";"}]}], "]"}], ";", "\[IndentingNewLine]", RowBox[{"psi", "=", RowBox[{"qmProp", "[", RowBox[{"uv", ",", "psi"}], "]"}]}], ";", "\[IndentingNewLine]", "\[IndentingNewLine]", RowBox[{"psi", "=", RowBox[{ RowBox[{ RowBox[{"(", RowBox[{ RowBox[{"InverseFourier", "[", RowBox[{"#", "*", RowBox[{"Conjugate", "[", "M1", "]"}]}], "]"}], "*", RowBox[{"Conjugate", "[", "M2", "]"}], "*", "fq"}], ")"}], "&"}], "/@", "psi"}]}], ";", "\[IndentingNewLine]", RowBox[{"psi", "=", RowBox[{"qmProp", "[", RowBox[{"uk", ",", "psi"}], "]"}]}], ";", "\[IndentingNewLine]", RowBox[{"psi", "=", RowBox[{ RowBox[{ RowBox[{"(", RowBox[{ RowBox[{"Fourier", "[", RowBox[{"#", "*", "M2"}], "]"}], "*", "M1", "*", "fp"}], ")"}], "&"}], "/@", "psi"}]}], ";", "\[IndentingNewLine]", "\[IndentingNewLine]", RowBox[{"If", "[", RowBox[{"timeDep", ",", RowBox[{"uv", "=", RowBox[{"uvF", "[", RowBox[{"t", "+", "dt"}], "]"}]}]}], "]"}], ";", "\[IndentingNewLine]", RowBox[{"psi", "=", RowBox[{"qmProp", "[", RowBox[{"uv", ",", "psi"}], "]"}]}], ";", "\[IndentingNewLine]", "\[IndentingNewLine]", RowBox[{"(*", " ", "save", " ", "*)"}], "\[IndentingNewLine]", "\[IndentingNewLine]", RowBox[{"If", "[", RowBox[{ RowBox[{ RowBox[{"Mod", "[", RowBox[{"i", ",", "saveFreq"}], "]"}], "\[Equal]", "0"}], ",", "\[IndentingNewLine]", RowBox[{ RowBox[{ RowBox[{"psiSave", "[", RowBox[{"[", RowBox[{ RowBox[{"Floor", "[", RowBox[{"i", "/", "saveFreq"}], "]"}], "+", "1"}], "]"}], "]"}], "=", RowBox[{"N", "[", RowBox[{"Re", "[", RowBox[{ RowBox[{"Conjugate", "[", RowBox[{"psi", "[", RowBox[{"[", RowBox[{"All", ",", RowBox[{"1", ";;", "All", ";;", "saveGridFreq"}]}], "]"}], "]"}], "]"}], "*", RowBox[{"psi", "[", RowBox[{"[", RowBox[{"All", ",", RowBox[{"1", ";;", "All", ";;", "saveGridFreq"}]}], "]"}], "]"}]}], "]"}], "]"}]}], ";"}]}], "\[IndentingNewLine]", "]"}], ";", "\[IndentingNewLine]", RowBox[{ RowBox[{"pop", "[", RowBox[{"[", RowBox[{"i", "+", "1"}], "]"}], "]"}], "=", RowBox[{"N", "[", RowBox[{"Re", "[", RowBox[{"corrSurface", "[", "psi", "]"}], "]"}], "]"}]}], ";", "\[IndentingNewLine]", RowBox[{ RowBox[{"avPosS1", "[", RowBox[{"[", RowBox[{"i", "+", "1"}], "]"}], "]"}], "=", RowBox[{"N", "[", RowBox[{"avPos", "[", RowBox[{"psi", "[", RowBox[{"[", "1", "]"}], "]"}], "]"}], "]"}]}], ";", "\[IndentingNewLine]", RowBox[{ RowBox[{"avPosS2", "[", RowBox[{"[", RowBox[{"i", "+", "1"}], "]"}], "]"}], "=", RowBox[{"N", "[", RowBox[{"avPos", "[", RowBox[{"psi", "[", RowBox[{"[", "2", "]"}], "]"}], "]"}], "]"}]}], ";"}], "\[IndentingNewLine]", "\[IndentingNewLine]", ",", RowBox[{"{", RowBox[{"i", ",", "nStep"}], "}"}]}], "]"}], ";", "\[IndentingNewLine]", "\[IndentingNewLine]", RowBox[{"{", RowBox[{"psiSave", ",", "pop", ",", "avPosS1", ",", "avPosS2"}], "}"}]}]}], "\[IndentingNewLine]", RowBox[{"(*", RowBox[{ RowBox[{"Print", "[", "\"\\"", "]"}], ";"}], "*)"}], "\[IndentingNewLine]", "]"}]}], "\[IndentingNewLine]", "\[IndentingNewLine]", RowBox[{ RowBox[{"molPlotFunc", "[", RowBox[{"q_", ",", "y_", ",", RowBox[{"Col_:", RowBox[{ RowBox[{"ColorData", "[", "\"\\"", "]"}], "[", "\"\\"", "]"}]}], ",", RowBox[{"trans_:", "1"}]}], "]"}], ":=", RowBox[{"Graphics3D", "[", RowBox[{ RowBox[{"{", RowBox[{"Col", ",", RowBox[{"Opacity", "[", "trans", "]"}], ",", RowBox[{"Sphere", "[", RowBox[{ RowBox[{"{", RowBox[{ RowBox[{ RowBox[{"-", "q"}], "*", "0.5"}], ",", "0", ",", "y"}], "}"}], ",", "0.3"}], "]"}], ",", RowBox[{"Sphere", "[", RowBox[{ RowBox[{"{", RowBox[{ RowBox[{"q", "*", "0.5"}], ",", "0", ",", "y"}], "}"}], ",", "0.3"}], "]"}], ",", RowBox[{"Tube", "[", RowBox[{ RowBox[{"{", RowBox[{ RowBox[{"{", RowBox[{ RowBox[{ RowBox[{"-", "q"}], "*", "0.5"}], ",", "0", ",", "y"}], "}"}], ",", RowBox[{"{", RowBox[{ RowBox[{"q", "*", "0.5"}], ",", "0", ",", "y"}], "}"}]}], "}"}], ",", "0.1"}], "]"}]}], "}"}], ",", RowBox[{"Boxed", "\[Rule]", "False"}], ",", RowBox[{"ImageSize", "\[Rule]", "Small"}]}], "]"}]}], "\[IndentingNewLine]", "\[IndentingNewLine]", RowBox[{ RowBox[{"popPlotFunc", "[", "S1_", "]"}], ":=", RowBox[{"Graphics3D", "[", RowBox[{"{", RowBox[{ RowBox[{"Opacity", "[", "0.3", "]"}], ",", "Blue", ",", RowBox[{"Cylinder", "[", RowBox[{ RowBox[{"{", RowBox[{ RowBox[{"{", RowBox[{"0", ",", "0", ",", "0.5"}], "}"}], ",", RowBox[{"{", RowBox[{"0", ",", "0", ",", RowBox[{"0.5", "+", "S1"}]}], "}"}]}], "}"}], ",", "0.1"}], "]"}], ",", "\[IndentingNewLine]", "Red", ",", RowBox[{"Cylinder", "[", RowBox[{ RowBox[{"{", RowBox[{ RowBox[{"{", RowBox[{"0", ",", "0", ",", "1.5"}], "}"}], ",", RowBox[{"{", RowBox[{"0", ",", "0", ",", RowBox[{"0.5", "+", "S1"}]}], "}"}]}], "}"}], ",", "0.1"}], "]"}]}], "}"}], "]"}]}], "\[IndentingNewLine]", "\[IndentingNewLine]", RowBox[{ RowBox[{"plotMolecule", "[", RowBox[{"q1_", ",", "q2_", ",", "popS1_"}], "]"}], ":=", RowBox[{"Show", "[", RowBox[{ RowBox[{"{", RowBox[{ RowBox[{"molPlotFunc", "[", RowBox[{"q1", ",", "0", ",", "Blue", ",", "popS1"}], "]"}], ",", RowBox[{"molPlotFunc", "[", RowBox[{"q2", ",", "2", ",", "Red", ",", RowBox[{"1", "-", "popS1"}]}], "]"}], ",", RowBox[{"popPlotFunc", "[", "popS1", "]"}]}], "}"}], ",", RowBox[{ "PlotLabel", "\[Rule]", "\"\\""}]}], "]"}]}]}]}]], "Input", CellOpen->False, CellTags->"CellOpen->False"], Cell[TextData[{ StyleBox["How to use it:", FontFamily->"Arial Bold", FontSize->18], "\n1) \tSet up the initial conditions for the wave packet (\[Psi]) and the \ pulse.\n2) \tPress the \[OpenCurlyDoubleQuote]Perform Calculation\ \[CloseCurlyDoubleQuote] button and wait until the button is green.\n3)\tLoad \ the calculation into the analysis window. " }], "Text", Evaluatable->True], Cell[CellGroupData[{ Cell[BoxData[ RowBox[{ RowBox[{"(*", " ", RowBox[{"choose", " ", "initial", " ", "condition"}], " ", "*)"}], "\[IndentingNewLine]", RowBox[{ RowBox[{"Manipulate", "[", "\[IndentingNewLine]", RowBox[{ RowBox[{"Module", "[", RowBox[{ RowBox[{"{", RowBox[{ "pulse", ",", "plotPulse", ",", "psi", ",", "grid", ",", "potential", ",", "plotPot", ",", "plotArrow", ",", "potQ0", ",", RowBox[{"scale", "=", "0.04"}], ",", "time", ",", RowBox[{"timeUnit", "=", "\"\<[au]\>\""}], ",", "potentialDiag"}], "}"}], ",", "\[IndentingNewLine]", RowBox[{"(*", " ", "examples", " ", "*)"}], "\[IndentingNewLine]", "\[IndentingNewLine]", RowBox[{"(*", " ", RowBox[{ RowBox[{"--", RowBox[{"--", RowBox[{"--", RowBox[{"--", RowBox[{"--", RowBox[{"--", RowBox[{"--", " ", RowBox[{ RowBox[{"Examples", " ", "--"}], "--"}]}]}]}]}]}]}]}], RowBox[{"--", RowBox[{"--", RowBox[{"--", RowBox[{"--", RowBox[{"--", RowBox[{"--", RowBox[{"--", "-"}]}]}]}]}]}]}]}], " ", "*)"}], "\[IndentingNewLine]", RowBox[{ RowBox[{"If", "[", RowBox[{ RowBox[{"exampleQ", "!=", "examples"}], ",", "\[IndentingNewLine]", RowBox[{ RowBox[{"If", "[", RowBox[{ RowBox[{"examples", "==", "\"\\""}], ",", RowBox[{"examples", "=", "1"}]}], "]"}], ";", "\[IndentingNewLine]", RowBox[{"Switch", "[", RowBox[{"examples", ",", "\[IndentingNewLine]", "1", ",", RowBox[{ RowBox[{"exampleQ", "=", "1"}], ";", RowBox[{"Qmin", "=", RowBox[{"IgridInfo", "[", RowBox[{"[", "2", "]"}], "]"}]}], ";", RowBox[{"Qmax", "=", RowBox[{"IgridInfo", "[", RowBox[{"[", "3", "]"}], "]"}]}], ";", RowBox[{"\[CapitalDelta]t", "=", "dtI"}], ";", RowBox[{"NStep", "=", "nStepI"}], ";", "\[IndentingNewLine]", "\t", RowBox[{"Q0", "=", RowBox[{"IpsiInit", "[", RowBox[{"[", "3", "]"}], "]"}]}], ";", RowBox[{"P0", "=", RowBox[{"IpsiInit", "[", RowBox[{"[", "4", "]"}], "]"}]}], ";", RowBox[{"\[Sigma]\[Psi]", "=", RowBox[{"IpsiInit", "[", RowBox[{"[", "5", "]"}], "]"}]}], ";", RowBox[{"popS2", "=", RowBox[{"IpsiInit", "[", RowBox[{"[", RowBox[{"2", ",", "2"}], "]"}], "]"}]}], ";", "\[IndentingNewLine]", "\t", RowBox[{"\[Omega]", "=", RowBox[{"IpulseInfo", "[", RowBox[{"[", "3", "]"}], "]"}]}], ";", RowBox[{"t0", "=", RowBox[{"IpulseInfo", "[", RowBox[{"[", "5", "]"}], "]"}]}], ";", RowBox[{"\[Sigma]", "=", RowBox[{"IpulseInfo", "[", RowBox[{"[", "4", "]"}], "]"}]}], ";", RowBox[{"Amplitude", "=", RowBox[{"IpulseInfo", "[", RowBox[{"[", RowBox[{"2", ",", "1"}], "]"}], "]"}]}], ";", "\[IndentingNewLine]", "\t", RowBox[{"Pulse", "=", "True"}], ";", RowBox[{"yMinPlot", "=", RowBox[{"-", "0.13"}]}], ";", RowBox[{"yMaxPlot", "=", "0.22"}], ";", RowBox[{"SaveFreq", "=", "2"}], ";", RowBox[{"n", "=", "128"}]}], ",", "\[IndentingNewLine]", "2", ",", RowBox[{ RowBox[{"exampleQ", "=", "2"}], ";", RowBox[{"Qmin", "=", RowBox[{"IgridInfo", "[", RowBox[{"[", "2", "]"}], "]"}]}], ";", RowBox[{"Qmax", "=", RowBox[{"IgridInfo", "[", RowBox[{"[", "3", "]"}], "]"}]}], ";", RowBox[{"\[CapitalDelta]t", "=", "dtI"}], ";", RowBox[{"NStep", "=", "nStepI"}], ";", "\[IndentingNewLine]", "\t", RowBox[{"Q0", "=", RowBox[{"IpsiInit", "[", RowBox[{"[", "3", "]"}], "]"}]}], ";", RowBox[{"P0", "=", RowBox[{"IpsiInit", "[", RowBox[{"[", "4", "]"}], "]"}]}], ";", RowBox[{"\[Sigma]\[Psi]", "=", RowBox[{"IpsiInit", "[", RowBox[{"[", "5", "]"}], "]"}]}], ";", RowBox[{"popS2", "=", RowBox[{"IpsiInit", "[", RowBox[{"[", RowBox[{"2", ",", "2"}], "]"}], "]"}]}], ";", "\[IndentingNewLine]", "\t", RowBox[{"\[Omega]", "=", "0.142403`"}], ";", RowBox[{"t0", "=", "500"}], ";", RowBox[{"\[Sigma]", "=", "71."}], ";", RowBox[{"Amplitude", "=", "0.01"}], ";", "\[IndentingNewLine]", "\t", RowBox[{"Pulse", "=", "True"}], ";", RowBox[{"yMinPlot", "=", RowBox[{"-", "0.13"}]}], ";", RowBox[{"yMaxPlot", "=", "0.22"}], ";", RowBox[{"SaveFreq", "=", "2"}], ";", RowBox[{"n", "=", "128"}]}], ",", "\[IndentingNewLine]", "3", ",", RowBox[{ RowBox[{"exampleQ", "=", "3"}], ";", RowBox[{"Qmin", "=", RowBox[{"IgridInfo", "[", RowBox[{"[", "2", "]"}], "]"}]}], ";", RowBox[{"Qmax", "=", RowBox[{"IgridInfo", "[", RowBox[{"[", "3", "]"}], "]"}]}], ";", RowBox[{"\[CapitalDelta]t", "=", "dtI"}], ";", RowBox[{"NStep", "=", "nStepI"}], ";", "\[IndentingNewLine]", "\t", RowBox[{"Q0", "=", RowBox[{"IpsiInit", "[", RowBox[{"[", "3", "]"}], "]"}]}], ";", RowBox[{"P0", "=", RowBox[{"IpsiInit", "[", RowBox[{"[", "4", "]"}], "]"}]}], ";", RowBox[{"\[Sigma]\[Psi]", "=", RowBox[{"IpsiInit", "[", RowBox[{"[", "5", "]"}], "]"}]}], ";", RowBox[{"popS2", "=", RowBox[{"IpsiInit", "[", RowBox[{"[", RowBox[{"2", ",", "2"}], "]"}], "]"}]}], ";", "\[IndentingNewLine]", "\t", RowBox[{"\[Omega]", "=", "0.1397`"}], ";", RowBox[{"t0", "=", "1120"}], ";", RowBox[{"\[Sigma]", "=", "413"}], ";", RowBox[{"Amplitude", "=", "0.88"}], ";", "\[IndentingNewLine]", "\t", RowBox[{"Pulse", "=", "True"}], ";", RowBox[{"yMinPlot", "=", RowBox[{"-", "0.13"}]}], ";", RowBox[{"yMaxPlot", "=", "0.22"}], ";", RowBox[{"SaveFreq", "=", "2"}], ";", RowBox[{"n", "=", "128"}]}], ",", "\[IndentingNewLine]", "4", ",", RowBox[{ RowBox[{"exampleQ", "=", "4"}], ";", RowBox[{"Qmin", "=", "3"}], ";", RowBox[{"Qmax", "=", "30"}], ";", RowBox[{"\[CapitalDelta]t", "=", "15"}], ";", RowBox[{"NStep", "=", "2100"}], ";", "\[IndentingNewLine]", "\t", RowBox[{"Q0", "=", "5.3794"}], ";", RowBox[{"P0", "=", "0.0"}], ";", RowBox[{"\[Sigma]\[Psi]", "=", RowBox[{"IpsiInit", "[", RowBox[{"[", "5", "]"}], "]"}]}], ";", RowBox[{"popS2", "=", "1"}], ";", "\[IndentingNewLine]", "\t", RowBox[{"\[Omega]", "=", "0.1397`"}], ";", RowBox[{"t0", "=", "1120"}], ";", RowBox[{"\[Sigma]", "=", "413"}], ";", RowBox[{"Amplitude", "=", "0.0"}], ";", "\[IndentingNewLine]", "\t", RowBox[{"Pulse", "=", "False"}], ";", RowBox[{"yMinPlot", "=", RowBox[{"-", "0.13"}]}], ";", RowBox[{"yMaxPlot", "=", "0.22"}], ";", RowBox[{"SaveFreq", "=", "2"}], ";", RowBox[{"n", "=", "512"}], ";"}], ",", "\[IndentingNewLine]", "5", ",", RowBox[{ RowBox[{"exampleQ", "=", "5"}], ";", RowBox[{"Qmin", "=", "6"}], ";", RowBox[{"Qmax", "=", "25"}], ";", RowBox[{"\[CapitalDelta]t", "=", "13"}], ";", RowBox[{"NStep", "=", "1800"}], ";", "\[IndentingNewLine]", "\t", RowBox[{"Q0", "=", "9.9"}], ";", RowBox[{"P0", "=", "33.0"}], ";", RowBox[{"\[Sigma]\[Psi]", "=", RowBox[{"IpsiInit", "[", RowBox[{"[", "5", "]"}], "]"}]}], ";", RowBox[{"popS2", "=", "1"}], ";", "\[IndentingNewLine]", "\t", RowBox[{"\[Omega]", "=", "0.1397`"}], ";", RowBox[{"t0", "=", "1120"}], ";", RowBox[{"\[Sigma]", "=", "413"}], ";", RowBox[{"Amplitude", "=", "0.0"}], ";", "\[IndentingNewLine]", "\t", RowBox[{"Pulse", "=", "False"}], ";", RowBox[{"yMinPlot", "=", RowBox[{"-", "0.1"}]}], ";", RowBox[{"yMaxPlot", "=", "0.1"}], ";", RowBox[{"SaveFreq", "=", "2"}], ";", RowBox[{"n", "=", "512"}], ";"}], ",", "\[IndentingNewLine]", "6", ",", RowBox[{ RowBox[{"exampleQ", "=", "6"}], ";", RowBox[{"Qmin", "=", "8"}], ";", RowBox[{"Qmax", "=", "30"}], ";", RowBox[{"\[CapitalDelta]t", "=", "8"}], ";", RowBox[{"NStep", "=", "600"}], ";", "\[IndentingNewLine]", "\t", RowBox[{"Q0", "=", "9.9"}], ";", RowBox[{"P0", "=", "125."}], ";", RowBox[{"\[Sigma]\[Psi]", "=", RowBox[{"IpsiInit", "[", RowBox[{"[", "5", "]"}], "]"}]}], ";", RowBox[{"popS2", "=", "1"}], ";", "\[IndentingNewLine]", "\t", RowBox[{"\[Omega]", "=", "0.1397`"}], ";", RowBox[{"t0", "=", "1120"}], ";", RowBox[{"\[Sigma]", "=", "413"}], ";", RowBox[{"Amplitude", "=", "0.0"}], ";", "\[IndentingNewLine]", "\t", RowBox[{"Pulse", "=", "False"}], ";", RowBox[{"yMinPlot", "=", RowBox[{"-", "0.1"}]}], ";", RowBox[{"yMaxPlot", "=", "0.1"}], ";", RowBox[{"SaveFreq", "=", "2"}], ";", RowBox[{"n", "=", "1024"}], ";"}]}], "\[IndentingNewLine]", "]"}], ";"}]}], "\[IndentingNewLine]", "]"}], ";", "\[IndentingNewLine]", RowBox[{"(*", " ", RowBox[{ RowBox[{"--", RowBox[{"--", RowBox[{"--", RowBox[{"--", RowBox[{"--", RowBox[{"-", " ", "Calculation"}]}]}]}]}]}], " ", RowBox[{ RowBox[{ RowBox[{ RowBox[{ RowBox[{ RowBox[{"Parameter", " ", "--"}], "--"}], "--"}], "--"}], "--"}], "--"}]}], "*)"}], "\[IndentingNewLine]", RowBox[{"time", "=", RowBox[{ RowBox[{"Range", "[", RowBox[{"0", ",", RowBox[{"Floor", "[", "NStep", "]"}]}], "]"}], "*", "\[CapitalDelta]t", "*", "tPlot"}]}], ";", "\[IndentingNewLine]", RowBox[{"(*", RowBox[{ RowBox[{"--", RowBox[{"--", RowBox[{"--", RowBox[{"--", " ", "PULSE"}]}]}]}], " ", "*", RowBox[{"--", RowBox[{"--", RowBox[{"--", RowBox[{"--", RowBox[{"--", RowBox[{"--", "-"}]}]}]}]}]}]}], "*)"}], "\[IndentingNewLine]", "\[IndentingNewLine]", RowBox[{"pulse", "=", RowBox[{ RowBox[{ RowBox[{"Amplitude", "*", RowBox[{"gaussPulseShapeF", "[", RowBox[{ RowBox[{"{", RowBox[{"\"\\"", ",", RowBox[{"{", RowBox[{"Amplitude", ",", "Amplitude", ",", "Amplitude"}], "}"}], ",", "\[Omega]", ",", "\[Sigma]", ",", "t0"}], "}"}], ",", "#"}], "]"}]}], "&"}], "/@", RowBox[{"Range", "[", RowBox[{"0", ",", RowBox[{ RowBox[{"Floor", "[", "NStep", "]"}], "*", "\[CapitalDelta]t"}], ",", "\[CapitalDelta]t"}], "]"}]}]}], ";", "\[IndentingNewLine]", RowBox[{"If", "[", RowBox[{ RowBox[{"!", "Pulse"}], ",", RowBox[{"pulse", "=", RowBox[{"pulse", "*", "0.0"}]}]}], "]"}], ";", "\[IndentingNewLine]", RowBox[{"If", "[", RowBox[{ RowBox[{"tPlot", "\[NotEqual]", "1"}], ",", RowBox[{"timeUnit", "=", "\"\<[fs]\>\""}]}], "]"}], ";", "\[IndentingNewLine]", RowBox[{"plotPulse", "=", RowBox[{"ListLinePlot", "[", RowBox[{ RowBox[{"Transpose", "[", RowBox[{"{", RowBox[{"time", ",", "pulse"}], "}"}], "]"}], ",", RowBox[{"PlotStyle", "\[Rule]", RowBox[{"{", RowBox[{ RowBox[{"ColorData", "[", "\"\\"", "]"}], "[", "\"\<#CC0000\>\"", "]"}], "}"}]}], ",", RowBox[{"PlotRange", "\[Rule]", "All"}], ",", RowBox[{"AxesLabel", "\[Rule]", RowBox[{"{", RowBox[{ RowBox[{"\"\