(* Content-type: application/vnd.wolfram.mathematica *) (*** Wolfram Notebook File ***) (* http://www.wolfram.com/nb *) (* CreatedBy='Mathematica 13.0' *) (*CacheID: 234*) (* Internal cache information: NotebookFileLineBreakTest NotebookFileLineBreakTest NotebookDataPosition[ 158, 7] NotebookDataLength[ 160924, 3977] NotebookOptionsPosition[ 147880, 3738] NotebookOutlinePosition[ 148393, 3756] CellTagsIndexPosition[ 148350, 3753] WindowFrame->Normal*) (* Beginning of Notebook Content *) Notebook[{ Cell["3.029 Spring 2022\[LineSeparator]Lecture 12 - 03/09/2022", "Subtitle", CellChangeTimes->{{3.8525512993398438`*^9, 3.8525513206118402`*^9}, { 3.852652054138073*^9, 3.8526520591301193`*^9}, {3.853194369726288*^9, 3.8531943739664793`*^9}, 3.8531971130005827`*^9, {3.853361889945813*^9, 3.853361893353859*^9}, {3.854455749568426*^9, 3.8544557604776297`*^9}, { 3.8545621484661007`*^9, 3.8545621501697083`*^9}, {3.85499650158072*^9, 3.854996504060568*^9}, {3.855176893175762*^9, 3.855176906151746*^9}, { 3.855604699389501*^9, 3.855604707177799*^9}, {3.85582102333785*^9, 3.855821026740013*^9}, {3.8561799930634317`*^9, 3.8561799980947123`*^9}},ExpressionUUID->"8cd89a4f-888e-49d6-af41-\ 08fc627c7586"], Cell[CellGroupData[{ Cell["Step-Growth Polymerization", "Chapter", CellChangeTimes->{{3.852551340964005*^9, 3.852551346980482*^9}, 3.8526520737398577`*^9, {3.853194378006518*^9, 3.853194381142681*^9}, { 3.853361935778483*^9, 3.853361942498363*^9}, {3.854456274982847*^9, 3.854456277927383*^9}, {3.8544565045315533`*^9, 3.854456514672267*^9}, 3.854562160779923*^9, {3.854996506556843*^9, 3.854996508477077*^9}, { 3.854996641253805*^9, 3.854996643918687*^9}, {3.855604708758831*^9, 3.855604727103332*^9}, {3.855660670350954*^9, 3.855660672414981*^9}, { 3.8558210308839273`*^9, 3.8558210389988337`*^9}},ExpressionUUID->"0aa512c8-6ce6-4b68-b5a8-\ ebba3c8ce8ba"], Cell["\<\ Last lecture, we developed a reptation model for a single polymer chain\ \>", "Item", CellChangeTimes->{ 3.854477893774478*^9, {3.854478372417194*^9, 3.854478373564378*^9}, { 3.854534827207877*^9, 3.854534844513954*^9}, {3.854996537677141*^9, 3.854996605550372*^9}, {3.855042873617885*^9, 3.855042874969273*^9}, { 3.855604739271578*^9, 3.855604794684745*^9}, {3.855821042349037*^9, 3.855821054364428*^9}},ExpressionUUID->"440c792d-4e3a-4a46-9d39-\ 10952589f5f9"], Cell[CellGroupData[{ Cell["\<\ Today, we will investigate the collision-free reptation of multiple chains\ \>", "Item", CellChangeTimes->{ 3.854477893774478*^9, {3.854478372417194*^9, 3.854478373564378*^9}, { 3.854534827207877*^9, 3.854534877299165*^9}, {3.854996626765793*^9, 3.8549966723106623`*^9}, {3.855604796774249*^9, 3.855604816156654*^9}, { 3.855604889750051*^9, 3.8556048959080973`*^9}, {3.855821056679214*^9, 3.855821080742033*^9}},ExpressionUUID->"ba26455e-7b7c-4c69-82e7-\ dee008a05c68"], Cell["And use it to investigate step-growth polymerization", "Subitem", CellChangeTimes->{ 3.854477893774478*^9, {3.854478372417194*^9, 3.854478373564378*^9}, { 3.854534827207877*^9, 3.854534877299165*^9}, {3.854996626765793*^9, 3.8549966723106623`*^9}, {3.855604796774249*^9, 3.855604816156654*^9}, { 3.855604889750051*^9, 3.8556048959080973`*^9}, {3.855821056679214*^9, 3.855821102687752*^9}},ExpressionUUID->"b6df0067-b72a-43f4-bf79-\ 71ac35a20630"] }, Open ]], Cell[CellGroupData[{ Cell["Initialization Functions from L11", "Section", CellChangeTimes->{{3.85582123030018*^9, 3.8558212403744383`*^9}, 3.856180361584917*^9},ExpressionUUID->"8ff8456e-b91d-4061-acac-\ e2713497b22d"], Cell[CellGroupData[{ Cell["Making a 2D correlated polymer", "Item", CellChangeTimes->{{3.8558212926928377`*^9, 3.855821299834899*^9}},ExpressionUUID->"91390901-108a-49ba-9087-\ 66db16b94f4d"], Cell[BoxData[{ RowBox[{ RowBox[{ RowBox[{"angularRange", "[", "correlation_", "]"}], ":=", RowBox[{ RowBox[{"{", RowBox[{ RowBox[{"-", "1"}], ",", "1"}], "}"}], RowBox[{"(", RowBox[{"1", "-", "correlation"}], ")"}], "2", RowBox[{"\[Pi]", "/", "3"}]}]}], "\[IndentingNewLine]"}], "\[IndentingNewLine]", RowBox[{ RowBox[{ RowBox[{ RowBox[{"collisionQ", "[", RowBox[{"nf_NearestFunction", ",", RowBox[{"bondLength_", ":", "1"}]}], "]"}], "[", "candidatePt_", "]"}], ":=", RowBox[{ RowBox[{ RowBox[{"First", "[", RowBox[{"nf", "[", "candidatePt", "]"}], "]"}], "[", "\"\\"", "]"}], "<", "bondLength"}]}], "\[IndentingNewLine]"}], "\[IndentingNewLine]", RowBox[{ RowBox[{ RowBox[{ RowBox[{"addCorrelatedParticleToChain", "[", "correlation_", "]"}], "[", "chainSoFar_", "]"}], ":=", RowBox[{ RowBox[{"Block", "[", RowBox[{ RowBox[{"{", "\[IndentingNewLine]", "\[IndentingNewLine]", RowBox[{ RowBox[{"nf", "=", RowBox[{"Nearest", "[", RowBox[{"chainSoFar", "->", "All"}], "]"}]}], ",", "\[IndentingNewLine]", RowBox[{"angleRange", "=", RowBox[{"angularRange", "[", "correlation", "]"}]}], ",", "\[IndentingNewLine]", RowBox[{"lastAngle", "=", RowBox[{"ArcTan", "@@", RowBox[{"(", RowBox[{ RowBox[{"chainSoFar", "[", RowBox[{"[", RowBox[{"-", "1"}], "]"}], "]"}], "-", RowBox[{"chainSoFar", "[", RowBox[{"[", RowBox[{"-", "2"}], "]"}], "]"}]}], ")"}]}]}], ",", "\[IndentingNewLine]", "newAngle", ",", "candidate", ",", "collision"}], "\[IndentingNewLine]", "\[IndentingNewLine]", "}"}], ",", "\[IndentingNewLine]", "\[IndentingNewLine]", RowBox[{ RowBox[{"newAngle", "=", RowBox[{ RowBox[{"RandomReal", "[", "angleRange", "]"}], "+", "lastAngle"}]}], ";", "\[IndentingNewLine]", RowBox[{"candidate", "=", RowBox[{ RowBox[{"Last", "[", "chainSoFar", "]"}], "+", RowBox[{"AngleVector", "[", "newAngle", "]"}]}]}], ";", "\[IndentingNewLine]", "\[IndentingNewLine]", RowBox[{"collision", "=", RowBox[{ RowBox[{"collisionQ", "[", "nf", "]"}], "[", "candidate", "]"}]}], ";", "\[IndentingNewLine]", RowBox[{"If", "[", RowBox[{"collision", ",", "chainSoFar", ",", RowBox[{"Append", "[", RowBox[{"chainSoFar", ",", "candidate"}], "]"}]}], "]"}]}]}], "\[IndentingNewLine]", "\[IndentingNewLine]", "]"}], "/;", RowBox[{ RowBox[{"Length", "[", "chainSoFar", "]"}], ">", "1"}]}]}], "\[IndentingNewLine]"}], "\[IndentingNewLine]", RowBox[{ RowBox[{ RowBox[{"correlatedPolymerChain2D", "[", RowBox[{"numberUnits_", ",", "correlation_"}], "]"}], ":=", RowBox[{"AnglePath", "[", RowBox[{"RandomReal", "[", RowBox[{ RowBox[{"angularRange", "[", "correlation", "]"}], ",", RowBox[{"numberUnits", "-", "1"}]}], "]"}], "]"}]}], "\[IndentingNewLine]"}], "\[IndentingNewLine]", RowBox[{"Clear", "[", "collisionFreeCorrelatedPolymerChain2D", "]"}], "\[IndentingNewLine]", RowBox[{ RowBox[{ RowBox[{"collisionFreeCorrelatedPolymerChain2D", "[", RowBox[{"numberUnits_", ",", "correlation_", ",", RowBox[{"origin_", ":", RowBox[{"{", RowBox[{"0", ",", "0"}], "}"}]}], ",", RowBox[{"maxAttempts_", ":", "100"}]}], "]"}], ":=", RowBox[{"With", "[", RowBox[{ RowBox[{"{", RowBox[{"start", "=", RowBox[{"Join", "[", RowBox[{ RowBox[{"{", "origin", "}"}], ",", RowBox[{"{", RowBox[{"AngleVector", "[", RowBox[{"origin", ",", RowBox[{"RandomReal", "[", RowBox[{"angularRange", "[", "correlation", "]"}], "]"}]}], "]"}], "}"}]}], "]"}]}], "}"}], ",", "\[IndentingNewLine]", RowBox[{"NestWhile", "[", RowBox[{ RowBox[{"addCorrelatedParticleToChain", "[", "correlation", "]"}], ",", "start", ",", RowBox[{ RowBox[{ RowBox[{"Length", "[", "#", "]"}], "<", "numberUnits"}], "&"}], ",", "1", ",", "maxAttempts"}], "]"}]}], "\[IndentingNewLine]", "]"}]}], "\[IndentingNewLine]"}], "\[IndentingNewLine]", RowBox[{ RowBox[{"chainGraphic", "[", "positions_", "]"}], ":=", " ", RowBox[{"{", "\[IndentingNewLine]", RowBox[{ RowBox[{"{", RowBox[{ RowBox[{ RowBox[{"Circle", "[", RowBox[{"#", ",", RowBox[{"1", "/", "2"}]}], "]"}], "&"}], "/@", RowBox[{"positions", "[", RowBox[{"[", RowBox[{"2", ";;", RowBox[{"-", "2"}]}], "]"}], "]"}]}], "}"}], ",", "\[IndentingNewLine]", RowBox[{"{", RowBox[{ RowBox[{"FaceForm", "[", "LightGray", "]"}], ",", RowBox[{"EdgeForm", "[", "Black", "]"}], ",", RowBox[{ RowBox[{ RowBox[{"Disk", "[", RowBox[{"#", ",", RowBox[{"1", "/", "2"}]}], "]"}], "&"}], "/@", RowBox[{"positions", "[", RowBox[{"[", RowBox[{"{", RowBox[{"1", ",", RowBox[{"-", "1"}]}], "}"}], "]"}], "]"}]}]}], "}"}]}], "\[IndentingNewLine]", "}"}]}]}], "Input", InitializationCell->True, CellChangeTimes->{{3.8551701478728456`*^9, 3.85517016521255*^9}, { 3.855651777774321*^9, 3.855651793828869*^9}, {3.855821304785056*^9, 3.855821332177742*^9}, {3.8558217625622997`*^9, 3.855821769660206*^9}, { 3.855822600486631*^9, 3.855822600800152*^9}}, CellLabel->"In[80]:=",ExpressionUUID->"9e0f6798-598e-45db-b21b-32856260f645"] }, Open ]], Cell[CellGroupData[{ Cell["Single chain reptation", "Item", CellChangeTimes->{{3.8558218212796*^9, 3.855821826522542*^9}},ExpressionUUID->"566c8c01-5be6-43aa-998a-\ 10afd04493f8"], Cell[BoxData[{ RowBox[{ RowBox[{ RowBox[{"collisionFreeQ", "[", "positions_", "]"}], ":=", RowBox[{"With", "[", RowBox[{ RowBox[{"{", RowBox[{"nf", "=", RowBox[{"Nearest", "[", "positions", "]"}]}], "}"}], ",", RowBox[{ RowBox[{"Total", "[", RowBox[{ RowBox[{ RowBox[{"Length", "[", RowBox[{"nf", "[", RowBox[{"#", ",", RowBox[{"{", RowBox[{"All", ",", RowBox[{"1.", "-", SuperscriptBox["10", RowBox[{"-", "6"}]]}]}], "}"}]}], "]"}], "]"}], "&"}], "/@", "positions"}], "]"}], "<=", RowBox[{"Length", "[", "positions", "]"}]}]}], "]"}]}], "\[IndentingNewLine]"}], "\[IndentingNewLine]", RowBox[{ RowBox[{ RowBox[{"moveSingleChain", "[", " ", RowBox[{"positions_", ",", "ds_", ",", RowBox[{"stickiness_", ":", "0.1"}]}], "]"}], ":=", " ", "\[IndentingNewLine]", RowBox[{"Block", "[", RowBox[{ RowBox[{"{", "newPositions", "}"}], ",", "\[IndentingNewLine]", RowBox[{ RowBox[{"newPositions", "=", " ", RowBox[{"displacements", "[", RowBox[{ RowBox[{"RandomInteger", "[", RowBox[{"{", RowBox[{"1", ",", RowBox[{"Length", "[", "positions", "]"}]}], "}"}], "]"}], ",", "positions", ",", "ds", ",", "stickiness", ",", RowBox[{"RandomReal", "[", RowBox[{"2", "\[Pi]"}], "]"}]}], "]"}]}], ";", "\[IndentingNewLine]", RowBox[{"If", "[", RowBox[{ RowBox[{"collisionFreeQ", "[", "newPositions", "]"}], ",", "newPositions", ",", "positions"}], "]"}]}]}], "\[IndentingNewLine]", "]"}]}], "\[IndentingNewLine]"}], "\[IndentingNewLine]", RowBox[{ RowBox[{ RowBox[{"displacements", "[", RowBox[{ "perturbedIndex_", ",", "positionList_", ",", "s_", ",", "\[Nu]_", ",", "\[Theta]_"}], "]"}], ":=", " ", "\[IndentingNewLine]", RowBox[{"Block", "[", RowBox[{ RowBox[{"{", RowBox[{"newPositions", ",", "betaList", ",", "\[CapitalDelta]"}], " ", "}"}], ",", "\[IndentingNewLine]", "\[IndentingNewLine]", RowBox[{ RowBox[{"\[CapitalDelta]", "=", RowBox[{"precompute", "[", RowBox[{ "positionList", ",", "perturbedIndex", ",", "s", ",", "\[Nu]", ",", "\[Theta]"}], "]"}]}], ";", "\[IndentingNewLine]", "\[IndentingNewLine]", RowBox[{ RowBox[{"newPositions", "[", "perturbedIndex", "]"}], " ", "=", RowBox[{ RowBox[{"positionList", "[", RowBox[{"[", "perturbedIndex", "]"}], "]"}], "+", RowBox[{"s", " ", RowBox[{"AngleVector", "[", "\[Theta]", "]"}]}]}]}], ";", "\[IndentingNewLine]", "\[IndentingNewLine]", RowBox[{ RowBox[{"newPositions", "[", "index_", "]"}], " ", ":=", " ", RowBox[{ RowBox[{"newPositions", "[", "index", "]"}], "=", "\[IndentingNewLine]", RowBox[{"Module", "[", RowBox[{ RowBox[{"{", RowBox[{"nextIndex", "=", RowBox[{"index", "-", RowBox[{"Sign", "[", RowBox[{"index", "-", "perturbedIndex"}], "]"}]}]}], "}"}], ",", "\[IndentingNewLine]", RowBox[{ RowBox[{"newPositions", "[", "nextIndex", "]"}], " ", "+", " ", RowBox[{"\[CapitalDelta]", "[", RowBox[{"[", "index", "]"}], "]"}]}]}], "\[IndentingNewLine]", "]"}]}]}], ";", "\[IndentingNewLine]", "\[IndentingNewLine]", RowBox[{"newPositions", "/@", RowBox[{"Range", "[", RowBox[{"Length", "[", "\[CapitalDelta]", "]"}], "]"}]}]}]}], "\[IndentingNewLine]", "]"}]}], "\[IndentingNewLine]"}], "\[IndentingNewLine]", RowBox[{ RowBox[{"precompute", "[", RowBox[{ "positions_", ",", "perturbedIndex_", ",", "s_", ",", "\[Nu]_", ",", " ", "\[Theta]_"}], "]"}], ":=", " ", RowBox[{"Block", "[", "\[IndentingNewLine]", RowBox[{ RowBox[{"{", "\[IndentingNewLine]", RowBox[{ RowBox[{"dp", " ", "=", " ", RowBox[{"Differences", "[", "positions", "]"}]}], ",", "\[IndentingNewLine]", "betaList", ",", "\[IndentingNewLine]", "diffs", ",", "\[IndentingNewLine]", "reducedAngles"}], "\[IndentingNewLine]", "}"}], ",", "\[IndentingNewLine]", RowBox[{ RowBox[{"betaList", " ", "=", RowBox[{"ArcTan", "@@@", " ", RowBox[{"Join", "[", RowBox[{ RowBox[{"-", RowBox[{"dp", "[", RowBox[{"[", RowBox[{"1", ";;", RowBox[{"perturbedIndex", "-", "1"}]}], "]"}], "]"}]}], ",", RowBox[{"dp", "[", RowBox[{"[", RowBox[{"perturbedIndex", ";;", RowBox[{"-", "1"}]}], "]"}], "]"}]}], "]"}]}]}], " ", ";", "\[IndentingNewLine]", RowBox[{"reducedAngles", "=", RowBox[{"\[Theta]", " ", "+", RowBox[{"2", " ", RowBox[{"ArcCot", "[", RowBox[{ SuperscriptBox["\[ExponentialE]", RowBox[{ RowBox[{"-", "s"}], "+", RowBox[{"s", " ", "\[Nu]"}]}]], RowBox[{"Cot", "[", RowBox[{ RowBox[{"(", RowBox[{"betaList", "-", "\[Theta]"}], ")"}], "/", "2"}], "]"}]}], "]"}]}]}]}], ";", "\[IndentingNewLine]", RowBox[{"reducedAngles", "=", RowBox[{"Insert", "[", RowBox[{"reducedAngles", ",", "\[Theta]", ",", "perturbedIndex"}], "]"}]}], ";", "\[IndentingNewLine]", RowBox[{"Transpose", "@", RowBox[{"{", RowBox[{ RowBox[{"Cos", "[", "reducedAngles", "]"}], ",", RowBox[{"Sin", "[", "reducedAngles", "]"}]}], "}"}]}]}]}], "]"}]}]}], "Input", InitializationCell->True, CellChangeTimes->{{3.855821849092704*^9, 3.8558218608838263`*^9}}, CellLabel->"In[58]:=",ExpressionUUID->"1ca885f6-05f9-4323-a78d-596b6e1d6d69"] }, Open ]] }, Closed]], Cell[CellGroupData[{ Cell["Multiple Chains Reptating", "Section", CellChangeTimes->{{3.8556612784439983`*^9, 3.855661281540303*^9}},ExpressionUUID->"ea09dac9-d04e-4d33-be26-\ 5b350b9e91f8"], Cell["\<\ We wish to extend our single-chain reptation to multiple chains\ \>", "Item", CellChangeTimes->{{3.855661385505871*^9, 3.855661400903737*^9}, { 3.855821175445785*^9, 3.85582118672326*^9}},ExpressionUUID->"a0e04359-7c71-47bf-aa37-\ 15aaaf54772f"], Cell[CellGroupData[{ Cell["But we similarly have to be concerned about collisions", "Item", CellChangeTimes->{{3.855661385505871*^9, 3.855661417640823*^9}},ExpressionUUID->"2b2fb7bc-5963-49dc-83e8-\ 0f731ca1d854"], Cell["We will use a hierarchical collision-detection!", "Subitem", CellChangeTimes->{{3.855661385505871*^9, 3.855661432956143*^9}},ExpressionUUID->"9e942319-462b-4278-877e-\ 705e83898520"] }, Open ]], Cell[CellGroupData[{ Cell["\<\ We\[CloseCurlyQuote]ll use the following polymer chain to develop our \ collision detection\ \>", "Item", CellChangeTimes->{{3.855821354143869*^9, 3.855821386763756*^9}},ExpressionUUID->"a583feb0-8b38-4f4d-8a3d-\ 478df4e078eb"], Cell[CellGroupData[{ Cell["\<\ Note the functions to make this are from L10 (see collapsed section above)\ \>", "Subitem", CellChangeTimes->{{3.855821354143869*^9, 3.8558214054733343`*^9}},ExpressionUUID->"e4f2fe33-25b4-4b63-823a-\ 3557949bb47a"], Cell[BoxData[{ RowBox[{ RowBox[{"SeedRandom", "[", "1111", "]"}], ";"}], "\[IndentingNewLine]", RowBox[{ RowBox[{"chainPositions", "=", RowBox[{"collisionFreeCorrelatedPolymerChain2D", "[", RowBox[{"12", ",", "0.4"}], "]"}]}], ";"}]}], "Input", CellLabel-> "In[130]:=",ExpressionUUID->"acbfff2a-0477-4578-aa4e-0ce48c1ee7c0"] }, Open ]] }, Open ]], Cell[CellGroupData[{ Cell["\<\ First, we start by checking if the axis-aligned bounding boxes of two chains \ overlap\ \>", "Item", CellChangeTimes->{{3.855661433865086*^9, 3.855661461879361*^9}},ExpressionUUID->"7047e99b-06ce-4c41-812a-\ 5b23aec2a707"], Cell[BoxData[{ RowBox[{ RowBox[{ RowBox[{"axesAlignedBoundingBoxes", "[", "positions_", "]"}], ":=", RowBox[{ RowBox[{"{", RowBox[{ RowBox[{"{", RowBox[{ RowBox[{ RowBox[{"-", "1"}], "/", "2"}], ",", RowBox[{"1", "/", "2"}]}], "}"}], ",", RowBox[{"{", RowBox[{ RowBox[{ RowBox[{"-", "1"}], "/", "2"}], ",", RowBox[{"1", "/", "2"}]}], "}"}]}], "}"}], "+", RowBox[{"MinMax", "/@", RowBox[{"Transpose", "[", "positions", "]"}]}]}]}], "\[IndentingNewLine]"}], "\[IndentingNewLine]", RowBox[{ RowBox[{"pairWiseAxesAlignedIntersection", "[", RowBox[{ RowBox[{"{", RowBox[{ RowBox[{"{", RowBox[{"xMinA_", ",", "xMaxA_"}], "}"}], ",", RowBox[{"{", RowBox[{"yMinA_", ",", "yMaxA_"}], "}"}]}], "}"}], ",", RowBox[{"{", RowBox[{ RowBox[{"{", RowBox[{"xMinB_", ",", "xMaxB_"}], "}"}], ",", RowBox[{"{", RowBox[{"yMinB_", ",", "yMaxB_"}], "}"}]}], "}"}]}], "]"}], ":=", RowBox[{ RowBox[{"(", RowBox[{ RowBox[{"xMaxA", ">", "xMinB"}], "&&", RowBox[{"xMinA", "<", "xMaxB"}]}], ")"}], "&&", RowBox[{"(", RowBox[{ RowBox[{"yMaxA", ">", "yMinB"}], "&&", RowBox[{"yMinA", "<", "yMaxB"}]}], ")"}]}]}]}], "Input", CellChangeTimes->{{3.855661474745223*^9, 3.855661475988696*^9}, 3.855821193667446*^9}, CellLabel->"In[1]:=",ExpressionUUID->"04ec7c6a-9b8e-4579-9622-3627f11fe54f"] }, Open ]], Cell[CellGroupData[{ Cell["\<\ Let\[CloseCurlyQuote]s define a new visualization function to help us with \ debugging bounding boxes collisions\ \>", "Item", CellChangeTimes->{{3.855821205536501*^9, 3.85582122288894*^9}},ExpressionUUID->"3a49b3bd-faf1-458e-bcef-\ 6e30088c63b7"], Cell[BoxData[ RowBox[{ RowBox[{"chainGraphic", "[", RowBox[{"positions_", ",", "bb_", ",", RowBox[{"col_", ":", RowBox[{"RandomColor", "[", "]"}]}]}], "]"}], ":=", " ", RowBox[{"{", "\[IndentingNewLine]", RowBox[{ RowBox[{"{", RowBox[{ RowBox[{"Opacity", "[", "0.25", "]"}], ",", "col", ",", RowBox[{"Rectangle", "@@", SuperscriptBox["bb", "\[Transpose]"]}]}], "}"}], ",", "\[IndentingNewLine]", RowBox[{"{", RowBox[{ RowBox[{"FaceForm", "[", "None", "]"}], ",", RowBox[{"EdgeForm", "[", RowBox[{"col", "//", "Darker"}], "]"}], ",", RowBox[{ RowBox[{ RowBox[{"Disk", "[", RowBox[{"#", ",", RowBox[{"1", "/", "2"}]}], "]"}], "&"}], "/@", RowBox[{"positions", "[", RowBox[{"[", RowBox[{"2", ";;", RowBox[{"-", "2"}]}], "]"}], "]"}]}]}], "}"}], ",", "\[IndentingNewLine]", RowBox[{"{", RowBox[{ RowBox[{"FaceForm", "[", RowBox[{"col", "//", "Darker"}], "]"}], ",", RowBox[{"EdgeForm", "[", "Black", "]"}], ",", RowBox[{ RowBox[{ RowBox[{"Disk", "[", RowBox[{"#", ",", RowBox[{"1", "/", "2"}]}], "]"}], "&"}], "/@", RowBox[{"positions", "[", RowBox[{"[", RowBox[{"{", RowBox[{"1", ",", RowBox[{"-", "1"}]}], "}"}], "]"}], "]"}]}]}], "}"}]}], "\[IndentingNewLine]", "}"}]}]], "Input", CellLabel->"In[3]:=",ExpressionUUID->"f4caa316-f75c-496e-a21a-17a040e0c7b7"] }, Open ]], Cell[CellGroupData[{ Cell["We construct the bounding box for our polymer chain", "Item", CellChangeTimes->{{3.855821426464365*^9, 3.855821461245325*^9}},ExpressionUUID->"1855f680-f530-4e01-8782-\ afd3bec5bb89"], Cell[CellGroupData[{ Cell["\<\ and check whether it intersects with the bounding box of another chain\ \>", "Subitem", CellChangeTimes->{{3.855821426464365*^9, 3.855821475234254*^9}},ExpressionUUID->"a72bd60d-baf9-41b4-970e-\ 3e2219494f51"], Cell[CellGroupData[{ Cell["for simplicity, we use the same chain - just translated", "Subsubitem", CellChangeTimes->{{3.855821426464365*^9, 3.855821486831195*^9}},ExpressionUUID->"7c04d40c-487b-4251-a38e-\ b2624af4c85f"], Cell[CellGroupData[{ Cell[BoxData[ RowBox[{"Block", "[", RowBox[{ RowBox[{"{", RowBox[{ RowBox[{"posA", "=", "chainPositions"}], ",", RowBox[{"posB", "=", RowBox[{ RowBox[{"TranslationTransform", "[", RowBox[{"{", RowBox[{ RowBox[{"-", "3"}], ",", RowBox[{"-", "3"}]}], "}"}], "]"}], "@", "chainPositions"}]}], ",", "bbA", ",", "bbB"}], "}"}], ",", "\[IndentingNewLine]", "\[IndentingNewLine]", RowBox[{ RowBox[{"bbA", "=", RowBox[{"axesAlignedBoundingBoxes", "[", "posA", "]"}]}], ";", "\[IndentingNewLine]", RowBox[{"bbB", "=", RowBox[{"axesAlignedBoundingBoxes", "[", "posB", "]"}]}], ";", "\[IndentingNewLine]", "\[IndentingNewLine]", RowBox[{ RowBox[{"pairWiseAxesAlignedIntersection", "[", RowBox[{"bbA", ",", "bbB"}], "]"}], "//", "Echo"}], ";", "\[IndentingNewLine]", "\[IndentingNewLine]", RowBox[{"Graphics", "[", RowBox[{"MapThread", "[", RowBox[{"chainGraphic", ",", RowBox[{"{", RowBox[{ RowBox[{"{", RowBox[{"posA", ",", "posB"}], "}"}], ",", RowBox[{"{", RowBox[{"bbA", ",", "bbB"}], "}"}], ",", RowBox[{"{", RowBox[{"Red", ",", "Blue"}], "}"}]}], "}"}]}], "]"}], "]"}]}]}], "\[IndentingNewLine]", "\[IndentingNewLine]", "]"}]], "Input", CellChangeTimes->{{3.855661543149337*^9, 3.8556616109229937`*^9}, { 3.855821344178351*^9, 3.855821346907646*^9}, {3.8558214111981153`*^9, 3.8558214120516863`*^9}}, CellLabel->"In[47]:=",ExpressionUUID->"8fd92479-5013-455b-b640-111414418aee"], Cell[BoxData["True"], "Echo", CellChangeTimes->{ 3.855821777664723*^9},ExpressionUUID->"ec417752-090e-4128-887d-\ 140a3f69655a"], Cell[BoxData[ GraphicsBox[{{ {RGBColor[1, 0, 0], Opacity[0.25], RectangleBox[ NCache[{Rational[-1, 2], -2.390224640128515}, {-0.5, -2.390224640128515}], \ {4.871269615886817, 3.6172468445425503}]}, {EdgeForm[RGBColor[ NCache[ Rational[2, 3], 0.6666666666666666], 0, 0]], FaceForm[None], DiskBox[{0.48789978931200123, -0.8728996480634557}, NCache[ Rational[1, 2], 0.5]], DiskBox[{1.0939566180207008, -1.6683209957626195}, NCache[ Rational[1, 2], 0.5]], DiskBox[{2.083257212377393, -1.8142125102708158}, NCache[ Rational[1, 2], 0.5]], DiskBox[{3.080364105400652, -1.890224640128515}, NCache[ Rational[1, 2], 0.5]], DiskBox[{4.078294480542105, -1.8259209359580861}, NCache[ Rational[1, 2], 0.5]], DiskBox[{4.371269615886817, -0.8698008754689508}, NCache[ Rational[1, 2], 0.5]], DiskBox[{3.706589826414799, -0.12267252139086215}, NCache[ Rational[1, 2], 0.5]], DiskBox[{3.3298814397317824, 0.8036593799288965}, NCache[ Rational[1, 2], 0.5]], DiskBox[{2.5191973507937178, 1.389143203738453}, NCache[ Rational[1, 2], 0.5]], DiskBox[{1.84142659874595, 2.124416491481591}, NCache[ Rational[1, 2], 0.5]]}, {EdgeForm[GrayLevel[0]], FaceForm[RGBColor[ NCache[ Rational[2, 3], 0.6666666666666666], 0, 0]], DiskBox[{0, 0}, NCache[Rational[1, 2], 0.5]], DiskBox[{1.9609585611696088, 3.1172468445425503}, NCache[ Rational[1, 2], 0.5]]}}, { {RGBColor[0, 0, 1], Opacity[0.25], RectangleBox[{-3.5, -5.390224640128515}, \ {1.871269615886817, 0.6172468445425503}]}, {EdgeForm[RGBColor[0, 0, NCache[ Rational[2, 3], 0.6666666666666666]]], FaceForm[None], DiskBox[{-2.512100210687999, -3.8728996480634557}, NCache[ Rational[1, 2], 0.5]], DiskBox[{-1.9060433819792992, -4.6683209957626195}, NCache[ Rational[1, 2], 0.5]], DiskBox[{-0.9167427876226069, -4.814212510270815}, NCache[ Rational[1, 2], 0.5]], DiskBox[{0.08036410540065209, -4.890224640128515}, NCache[ Rational[1, 2], 0.5]], DiskBox[{1.0782944805421053, -4.825920935958086}, NCache[ Rational[1, 2], 0.5]], DiskBox[{1.371269615886817, -3.869800875468951}, NCache[ Rational[1, 2], 0.5]], DiskBox[{0.706589826414799, -3.122672521390862}, NCache[ Rational[1, 2], 0.5]], DiskBox[{0.3298814397317824, -2.1963406200711035}, NCache[ Rational[1, 2], 0.5]], DiskBox[{-0.48080264920628224, -1.610856796261547}, NCache[ Rational[1, 2], 0.5]], DiskBox[{-1.15857340125405, -0.8755835085184089}, NCache[ Rational[1, 2], 0.5]]}, {EdgeForm[GrayLevel[0]], FaceForm[RGBColor[0, 0, NCache[ Rational[2, 3], 0.6666666666666666]]], DiskBox[{-3., -3.}, NCache[Rational[1, 2], 0.5]], DiskBox[{-1.0390414388303912, 0.1172468445425503}, NCache[ Rational[1, 2], 0.5]]}}}]], "Output", CellChangeTimes->{{3.855661552112196*^9, 3.855661618356192*^9}, 3.85566244317692*^9, 3.855821413275729*^9, 3.8558217776936703`*^9}, CellLabel->"Out[47]=",ExpressionUUID->"1479bdde-589f-4968-9290-a998f0c1a274"] }, Open ]] }, Open ]] }, Open ]] }, Open ]], Cell["Great, our bounding-box collision detection seems to work!", "Item", CellChangeTimes->{{3.855821490829348*^9, 3.855821504673456*^9}},ExpressionUUID->"1f28364c-b8ac-4085-99a0-\ 9b75f129797c"], Cell[CellGroupData[{ Cell["\<\ Next, we only keep points on each chain inside the overlap region\ \>", "Item", CellChangeTimes->{{3.855661433865086*^9, 3.855661461879361*^9}, { 3.8556616249566927`*^9, 3.855661642261322*^9}},ExpressionUUID->"497eda49-07d2-4274-816b-\ 8cfcd926d737"], Cell[BoxData[ RowBox[{ RowBox[{"returnPointsInOverlapSimple", "[", RowBox[{ RowBox[{"{", RowBox[{"positionsA_", ",", RowBox[{"{", RowBox[{ RowBox[{"{", RowBox[{"xMinA_", ",", "xMaxA_"}], "}"}], ",", RowBox[{"{", RowBox[{"yMinA_", ",", "yMaxA_"}], "}"}]}], "}"}]}], "}"}], ",", RowBox[{"{", RowBox[{"positionsB_", ",", RowBox[{"{", RowBox[{ RowBox[{"{", RowBox[{"xMinB_", ",", "xMaxB_"}], "}"}], ",", RowBox[{"{", RowBox[{"yMinB_", ",", "yMaxB_"}], "}"}]}], "}"}]}], "}"}]}], "]"}], ":=", RowBox[{"With", "[", "\[IndentingNewLine]", RowBox[{ RowBox[{"{", "\[IndentingNewLine]", RowBox[{ RowBox[{"xMin", "=", RowBox[{ RowBox[{"Max", "[", RowBox[{"xMinA", ",", "xMinB"}], "]"}], "-", RowBox[{"1", "/", "2"}]}]}], ",", RowBox[{"yMin", "=", RowBox[{ RowBox[{"Max", "[", RowBox[{"yMinA", ",", "yMinB"}], "]"}], "-", RowBox[{"1", "/", "2"}]}]}], ",", "\[IndentingNewLine]", RowBox[{"xMax", "=", RowBox[{ RowBox[{"Min", "[", RowBox[{"xMaxA", ",", "xMaxB"}], "]"}], "+", RowBox[{"1", "/", "2"}]}]}], ",", RowBox[{"yMax", "=", RowBox[{ RowBox[{"Min", "[", RowBox[{"yMaxA", ",", "yMaxB"}], "]"}], "+", RowBox[{"1", "/", "2"}]}]}]}], "\[IndentingNewLine]", "}"}], ",", "\[IndentingNewLine]", RowBox[{"Table", "[", RowBox[{ RowBox[{"Select", "[", RowBox[{"pos", ",", RowBox[{ RowBox[{ RowBox[{"xMax", ">", RowBox[{"#", "[", RowBox[{"[", "1", "]"}], "]"}], ">", "xMin"}], "&&", RowBox[{"yMax", ">", RowBox[{"#", "[", RowBox[{"[", "2", "]"}], "]"}], ">", "yMin"}]}], "&"}]}], "]"}], ",", RowBox[{"{", RowBox[{"pos", ",", RowBox[{"{", RowBox[{"positionsA", ",", "positionsB"}], "}"}]}], "}"}]}], "]"}]}], "\[IndentingNewLine]", "]"}]}]], "Input", CellChangeTimes->{{3.855661721064062*^9, 3.8556617314077997`*^9}, { 3.85583683297932*^9, 3.8558368341133823`*^9}}, CellLabel-> "In[121]:=",ExpressionUUID->"60465d11-11a6-482d-b331-54f05e4102b5"], Cell[CellGroupData[{ Cell[BoxData[ RowBox[{"Block", "[", RowBox[{ RowBox[{"{", RowBox[{ RowBox[{"posA", "=", "chainPositions"}], ",", RowBox[{"posB", "=", RowBox[{ RowBox[{"TranslationTransform", "[", RowBox[{"{", RowBox[{ RowBox[{"-", "3"}], ",", RowBox[{"-", "3"}]}], "}"}], "]"}], "@", "chainPositions"}]}], ",", "bbA", ",", "bbB"}], "}"}], ",", "\[IndentingNewLine]", "\[IndentingNewLine]", RowBox[{ RowBox[{"bbA", "=", RowBox[{"axesAlignedBoundingBoxes", "[", "posA", "]"}]}], ";", "\[IndentingNewLine]", RowBox[{"bbB", "=", RowBox[{"axesAlignedBoundingBoxes", "[", "posB", "]"}]}], ";", "\[IndentingNewLine]", "\[IndentingNewLine]", RowBox[{ RowBox[{"{", RowBox[{"posA", ",", "posB"}], "}"}], "=", RowBox[{"returnPointsInOverlapSimple", "[", RowBox[{ RowBox[{"{", RowBox[{"posA", ",", "bbA"}], "}"}], ",", RowBox[{"{", RowBox[{"posB", ",", "bbB"}], "}"}]}], "]"}]}], ";", "\[IndentingNewLine]", "\[IndentingNewLine]", RowBox[{"Graphics", "[", RowBox[{"MapThread", "[", RowBox[{"chainGraphic", ",", RowBox[{"{", RowBox[{ RowBox[{"{", RowBox[{"posA", ",", "posB"}], "}"}], ",", RowBox[{"{", RowBox[{"bbA", ",", "bbB"}], "}"}], ",", RowBox[{"{", RowBox[{"Red", ",", "Blue"}], "}"}]}], "}"}]}], "]"}], "]"}]}]}], "\[IndentingNewLine]", "\[IndentingNewLine]", "]"}]], "Input", CellChangeTimes->{3.855661672631922*^9, 3.8558368391848516`*^9}, CellLabel-> "In[122]:=",ExpressionUUID->"73124b3d-1bab-45d7-baba-a69e8e6a53c9"], Cell[BoxData[ GraphicsBox[{{ {RGBColor[1, 0, 0], Opacity[0.25], RectangleBox[ NCache[{Rational[-1, 2], -2.390224640128515}, {-0.5, -2.390224640128515}], \ {4.871269615886817, 3.6172468445425503}]}, {EdgeForm[RGBColor[ NCache[ Rational[2, 3], 0.6666666666666666], 0, 0]], FaceForm[None], DiskBox[{0.48789978931200123, -0.8728996480634557}, NCache[ Rational[1, 2], 0.5]], DiskBox[{1.0939566180207008, -1.6683209957626195}, NCache[ Rational[1, 2], 0.5]]}, {EdgeForm[GrayLevel[0]], FaceForm[RGBColor[ NCache[ Rational[2, 3], 0.6666666666666666], 0, 0]], DiskBox[{0, 0}, NCache[Rational[1, 2], 0.5]], DiskBox[{2.083257212377393, -1.8142125102708158}, NCache[ Rational[1, 2], 0.5]]}}, { {RGBColor[0, 0, 1], Opacity[0.25], RectangleBox[{-3.5, -5.390224640128515}, \ {1.871269615886817, 0.6172468445425503}]}, {EdgeForm[RGBColor[0, 0, NCache[ Rational[2, 3], 0.6666666666666666]]], FaceForm[None]}, {EdgeForm[GrayLevel[0]], FaceForm[RGBColor[0, 0, NCache[ Rational[2, 3], 0.6666666666666666]]], DiskBox[{0.3298814397317824, -2.1963406200711035}, NCache[ Rational[1, 2], 0.5]], DiskBox[{-0.48080264920628224, -1.610856796261547}, NCache[ Rational[1, 2], 0.5]]}}}]], "Output", CellChangeTimes->{ 3.855661678345234*^9, {3.855661725536191*^9, 3.855661732783587*^9}, 3.855662446200679*^9, 3.855821512992957*^9, 3.8558368394401283`*^9}, CellLabel-> "Out[122]=",ExpressionUUID->"c03e9a89-0708-4e1e-ba0a-9af7e3d868db"] }, Open ]] }, Open ]], Cell[CellGroupData[{ Cell["\<\ This again seems to work well, and reduces the problem considerably\ \>", "Item", CellChangeTimes->{{3.8558215170093*^9, 3.855821540639906*^9}},ExpressionUUID->"936735af-6724-47aa-9d5b-\ 623214450c69"], Cell[CellGroupData[{ Cell["\<\ Quick note: Later, we will concern ourselves with the exact position of \ collisions\ \>", "Subitem", CellChangeTimes->{{3.8558215170093*^9, 3.855821579810252*^9}},ExpressionUUID->"611beb46-3ba2-457f-acac-\ 05a22fd158f9"], Cell["To check e.g. if an end-mer collided with another end-mer", "Subsubitem", CellChangeTimes->{{3.8558215170093*^9, 3.855821599966763*^9}},ExpressionUUID->"c33ebb0d-86fa-4aac-9c45-\ bac46adf41f3"], Cell["\<\ As such, we\[CloseCurlyQuote]ll need to update this function later to also \ return the indices of the selected points\ \>", "Subsubitem", CellChangeTimes->{{3.8558215170093*^9, 3.855821626689795*^9}},ExpressionUUID->"60d7a17b-e473-4ae8-abca-\ 813cfbc6c596"] }, Open ]] }, Open ]], Cell[CellGroupData[{ Cell["\<\ If the two chains are non-empty, we finally check pairwise distances\ \>", "Item", CellChangeTimes->{{3.8555137417755013`*^9, 3.855513761255863*^9}, { 3.85551423280124*^9, 3.855514240073593*^9}, {3.8555151526976748`*^9, 3.855515161226368*^9}, {3.855515881897376*^9, 3.85551591081001*^9}, { 3.855520987194358*^9, 3.85552100668781*^9}, {3.855821631288938*^9, 3.8558216320099773`*^9}},ExpressionUUID->"ca0db60b-396d-42c9-97b1-\ 8d1d96d90f53"], Cell[CellGroupData[{ Cell[BoxData[ RowBox[{"Block", "[", RowBox[{ RowBox[{"{", RowBox[{ RowBox[{"posA", "=", "chainPositions"}], ",", RowBox[{"posB", "=", RowBox[{ RowBox[{"TranslationTransform", "[", RowBox[{"{", RowBox[{ RowBox[{"-", "3"}], ",", RowBox[{"-", "3"}]}], "}"}], "]"}], "@", "chainPositions"}]}], ",", "bbA", ",", "bbB", ",", "dm"}], "}"}], ",", "\[IndentingNewLine]", "\[IndentingNewLine]", RowBox[{ RowBox[{"bbA", "=", RowBox[{"axesAlignedBoundingBoxes", "[", "posA", "]"}]}], ";", "\[IndentingNewLine]", RowBox[{"bbB", "=", RowBox[{"axesAlignedBoundingBoxes", "[", "posB", "]"}]}], ";", "\[IndentingNewLine]", "\[IndentingNewLine]", RowBox[{ RowBox[{"{", RowBox[{"posA", ",", "posB"}], "}"}], "=", RowBox[{"returnPointsInOverlapSimple", "[", RowBox[{ RowBox[{"{", RowBox[{"posA", ",", "bbA"}], "}"}], ",", RowBox[{"{", RowBox[{"posB", ",", "bbB"}], "}"}]}], "]"}]}], ";", "\[IndentingNewLine]", "\[IndentingNewLine]", RowBox[{ RowBox[{"MatrixForm", "[", "\[IndentingNewLine]", RowBox[{"dm", "=", RowBox[{"DistanceMatrix", "[", RowBox[{"posA", ",", "posB"}], "]"}]}], "\[IndentingNewLine]", "]"}], "//", "Echo"}], ";", "\[IndentingNewLine]", "\[IndentingNewLine]", RowBox[{ RowBox[{"Min", "[", "dm", "]"}], "<", "1"}]}]}], "\[IndentingNewLine]", "\[IndentingNewLine]", "]"}]], "Input", CellChangeTimes->{{3.8556617840217524`*^9, 3.855661822030601*^9}, { 3.855661886498505*^9, 3.8556618901920357`*^9}, 3.855836842669094*^9}, CellLabel-> "In[123]:=",ExpressionUUID->"5fdecfe3-d897-4e56-9b3f-0c75686f479c"], Cell[BoxData[ TagBox[ RowBox[{"(", "\[NoBreak]", GridBox[{ {"2.2209758854282575`", "1.6810802495853059`"}, {"1.3328412528101776`", "1.2177705723854262`"}, {"0.9287710168454413`", "1.575807375265633`"}, {"1.7945329454763803`", "2.5721112962320887`"} }, GridBoxAlignment->{"Columns" -> {{Center}}, "Rows" -> {{Baseline}}}, GridBoxSpacings->{"Columns" -> { Offset[0.27999999999999997`], { Offset[0.7]}, Offset[0.27999999999999997`]}, "Rows" -> { Offset[0.2], { Offset[0.4]}, Offset[0.2]}}], "\[NoBreak]", ")"}], Function[BoxForm`e$, MatrixForm[BoxForm`e$]]]], "Echo", CellChangeTimes->{ 3.855836843035329*^9},ExpressionUUID->"4b57c809-9116-4718-b02c-\ bfc279823ccc"], Cell[BoxData["True"], "Output", CellChangeTimes->{{3.855661794168006*^9, 3.855661822380506*^9}, 3.855662448186955*^9, 3.8558216374903393`*^9, 3.8558368430893908`*^9}, CellLabel-> "Out[123]=",ExpressionUUID->"b44c51cd-2b59-49d7-bc23-7cf5a3066046"] }, Open ]], Cell["\<\ Remember our discussion on checking pairwise distances last lecture\ \>", "Subitem", CellChangeTimes->{{3.8556618356490717`*^9, 3.855661857814152*^9}, { 3.8558216451858177`*^9, 3.855821656103505*^9}},ExpressionUUID->"94dd0bd9-e2da-47b8-a0b3-\ dfda407c305b"], Cell[CellGroupData[{ Cell["\<\ We can do a little faster by looping over a Nearest function until we find \ the first distance less than 1\ \>", "Subitem", CellChangeTimes->{{3.8556618356490717`*^9, 3.855661857814152*^9}},ExpressionUUID->"3a43faf3-8526-4cab-89e0-\ 7650df7be834"], Cell[BoxData[ RowBox[{ RowBox[{"shortestDistanceLessThanOne", "[", RowBox[{"posA_", ",", "posB_"}], "]"}], ":=", RowBox[{"Block", "[", RowBox[{ RowBox[{"{", RowBox[{ RowBox[{"nf", "=", RowBox[{"Nearest", "[", RowBox[{"posA", "->", "\"\\""}], "]"}]}], ",", RowBox[{"i", "=", "1"}], ",", RowBox[{"d", "=", "2."}], ",", RowBox[{"l", "=", RowBox[{"Length", "[", "posB", "]"}]}]}], "}"}], ",", "\[IndentingNewLine]", RowBox[{ RowBox[{"While", "[", RowBox[{ RowBox[{ RowBox[{"d", ">", "1."}], " ", "&&", " ", RowBox[{"i", "<=", "l"}]}], ",", "\[IndentingNewLine]", RowBox[{ RowBox[{"d", "=", RowBox[{"First", "[", RowBox[{"nf", "[", RowBox[{"posB", "[", RowBox[{"[", "i", "]"}], "]"}], "]"}], "]"}]}], ";", "\[IndentingNewLine]", RowBox[{"i", "++"}]}]}], "\[IndentingNewLine]", "]"}], ";", "\[IndentingNewLine]", RowBox[{"d", "<", "1."}]}]}], "\[IndentingNewLine]", "]"}]}]], "Input", CellLabel->"In[21]:=",ExpressionUUID->"c146544c-766d-4952-94e0-f28fd27ae216"], Cell[CellGroupData[{ Cell[BoxData[ RowBox[{"Block", "[", RowBox[{ RowBox[{"{", RowBox[{ RowBox[{"posA", "=", "chainPositions"}], ",", RowBox[{"posB", "=", RowBox[{ RowBox[{"TranslationTransform", "[", RowBox[{"{", RowBox[{ RowBox[{"-", "3"}], ",", RowBox[{"-", "3"}]}], "}"}], "]"}], "@", "chainPositions"}]}], ",", "bbA", ",", "bbB", ",", "dm"}], "}"}], ",", "\[IndentingNewLine]", "\[IndentingNewLine]", RowBox[{ RowBox[{"bbA", "=", RowBox[{"axesAlignedBoundingBoxes", "[", "posA", "]"}]}], ";", "\[IndentingNewLine]", RowBox[{"bbB", "=", RowBox[{"axesAlignedBoundingBoxes", "[", "posB", "]"}]}], ";", "\[IndentingNewLine]", "\[IndentingNewLine]", RowBox[{ RowBox[{"{", RowBox[{"posA", ",", "posB"}], "}"}], "=", RowBox[{"returnPointsInOverlapSimple", "[", RowBox[{ RowBox[{"{", RowBox[{"posA", ",", "bbA"}], "}"}], ",", RowBox[{"{", RowBox[{"posB", ",", "bbB"}], "}"}]}], "]"}]}], ";", "\[IndentingNewLine]", "\[IndentingNewLine]", RowBox[{"shortestDistanceLessThanOne", "[", RowBox[{"posA", ",", "posB"}], "]"}]}]}], "\[IndentingNewLine]", "\[IndentingNewLine]", "]"}]], "Input", CellChangeTimes->{{3.855661871600664*^9, 3.855661875202189*^9}, 3.855836845109733*^9}, CellLabel-> "In[124]:=",ExpressionUUID->"141ea027-39a2-4b32-b489-36626168a62f"], Cell[BoxData["True"], "Output", CellChangeTimes->{{3.855661875596073*^9, 3.855661892991724*^9}, 3.855662451110379*^9, 3.855821661914304*^9, 3.8558368454045343`*^9}, CellLabel-> "Out[124]=",ExpressionUUID->"73407f88-176d-4ba0-bbf7-d9746c1ef761"] }, Open ]] }, Open ]] }, Open ]], Cell[CellGroupData[{ Cell["\<\ The final piece we need is a connectivity matrix telling us which bounding \ boxes overlap\ \>", "Item", CellChangeTimes->{{3.855661913041297*^9, 3.8556619453826647`*^9}},ExpressionUUID->"42527b47-e773-4f9d-8184-\ 3a4eddef17bf"], Cell[CellGroupData[{ Cell["\<\ We\[CloseCurlyQuote]ll construct this by looking at the upper-triangle part \ of the matrix at each step\ \>", "Subitem", CellChangeTimes->{{3.855661913041297*^9, 3.855661970314557*^9}},ExpressionUUID->"4cf79c90-bdcd-44b7-a51e-\ 26e6da2ef7df"], Cell[CellGroupData[{ Cell[BoxData[ RowBox[{"Subsets", "[", RowBox[{ RowBox[{"Range", "[", "6", "]"}], ",", RowBox[{"{", "2", "}"}]}], "]"}]], "Input", CellLabel->"In[27]:=",ExpressionUUID->"ed9731bc-68fa-4dce-ae18-2c0ad7d93d1f"], Cell[BoxData[ RowBox[{"{", RowBox[{ RowBox[{"{", RowBox[{"1", ",", "2"}], "}"}], ",", RowBox[{"{", RowBox[{"1", ",", "3"}], "}"}], ",", RowBox[{"{", RowBox[{"1", ",", "4"}], "}"}], ",", RowBox[{"{", RowBox[{"1", ",", "5"}], "}"}], ",", RowBox[{"{", RowBox[{"1", ",", "6"}], "}"}], ",", RowBox[{"{", RowBox[{"2", ",", "3"}], "}"}], ",", RowBox[{"{", RowBox[{"2", ",", "4"}], "}"}], ",", RowBox[{"{", RowBox[{"2", ",", "5"}], "}"}], ",", RowBox[{"{", RowBox[{"2", ",", "6"}], "}"}], ",", RowBox[{"{", RowBox[{"3", ",", "4"}], "}"}], ",", RowBox[{"{", RowBox[{"3", ",", "5"}], "}"}], ",", RowBox[{"{", RowBox[{"3", ",", "6"}], "}"}], ",", RowBox[{"{", RowBox[{"4", ",", "5"}], "}"}], ",", RowBox[{"{", RowBox[{"4", ",", "6"}], "}"}], ",", RowBox[{"{", RowBox[{"5", ",", "6"}], "}"}]}], "}"}]], "Output", CellChangeTimes->{3.855821718673332*^9}, CellLabel->"Out[27]=",ExpressionUUID->"5472f8b3-9e8b-44fe-bbcf-1c00ec755773"] }, Open ]], Cell[CellGroupData[{ Cell[BoxData[ RowBox[{"MatrixForm", "[", RowBox[{"SparseArray", "[", RowBox[{ RowBox[{"Subsets", "[", RowBox[{ RowBox[{"Range", "[", "6", "]"}], ",", RowBox[{"{", "2", "}"}]}], "]"}], "->", "1"}], "]"}], "]"}]], "Input", CellChangeTimes->{{3.855821681211012*^9, 3.855821714188684*^9}}, CellLabel->"In[28]:=",ExpressionUUID->"ff6e7c2a-ffca-43aa-9079-f82b9fe78bd7"], Cell[BoxData[ TagBox[ RowBox[{"(", "\[NoBreak]", GridBox[{ {"0", "1", "1", "1", "1", "1"}, {"0", "0", "1", "1", "1", "1"}, {"0", "0", "0", "1", "1", "1"}, {"0", "0", "0", "0", "1", "1"}, {"0", "0", "0", "0", "0", "1"} }, GridBoxAlignment->{"Columns" -> {{Center}}, "Rows" -> {{Baseline}}}, GridBoxSpacings->{"Columns" -> { Offset[0.27999999999999997`], { Offset[0.7]}, Offset[0.27999999999999997`]}, "Rows" -> { Offset[0.2], { Offset[0.4]}, Offset[0.2]}}], "\[NoBreak]", ")"}], Function[BoxForm`e$, MatrixForm[ SparseArray[ Automatic, {5, 6}, 0, { 1, {{0, 5, 9, 12, 14, 15}, {{2}, {3}, {4}, {5}, {6}, {3}, {4}, {5}, { 6}, {4}, {5}, {6}, {5}, {6}, {6}}}, {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}}]]]]], "Output", CellChangeTimes->{{3.8558216961927557`*^9, 3.855821720401462*^9}}, CellLabel-> "Out[28]//MatrixForm=",ExpressionUUID->"682b392b-bf7f-40a4-9b91-\ 133a1ee4bbe3"] }, Open ]] }, Open ]], Cell[CellGroupData[{ Cell["Is this efficient? How can we do better?", "Subitem", CellChangeTimes->{{3.855661913041297*^9, 3.85566197771819*^9}},ExpressionUUID->"f1ff8df9-2a3a-4577-8ac5-\ 47f164af11af"], Cell[BoxData[{ RowBox[{ RowBox[{"Clear", "[", RowBox[{"connectivityMatrixIndex", ",", "connectivityMatrix"}], "]"}], "\[IndentingNewLine]"}], "\[IndentingNewLine]", RowBox[{ RowBox[{ RowBox[{"connectivityMatrixIndex", "[", RowBox[{"bbs_", ",", RowBox[{"{", RowBox[{"i_", ",", "j_"}], "}"}]}], "]"}], ":=", RowBox[{ RowBox[{"pairWiseAxesAlignedIntersection", "[", RowBox[{ RowBox[{"bbs", "[", RowBox[{"[", "i", "]"}], "]"}], ",", RowBox[{"bbs", "[", RowBox[{"[", "j", "]"}], "]"}]}], "]"}], "//", "Boole"}]}], "\[IndentingNewLine]"}], "\[IndentingNewLine]", RowBox[{ RowBox[{"connectivityMatrix", "[", "bbs_", "]"}], ":=", RowBox[{"Block", "[", RowBox[{ RowBox[{"{", RowBox[{ RowBox[{"s", "=", RowBox[{"Subsets", "[", RowBox[{ RowBox[{"Range", "[", RowBox[{"Length", "[", "bbs", "]"}], "]"}], ",", RowBox[{"{", "2", "}"}]}], "]"}]}], ",", RowBox[{"l", "=", RowBox[{"Length", "[", "bbs", "]"}]}], ",", "is"}], "}"}], ",", "\[IndentingNewLine]", RowBox[{"SparseArray", "[", RowBox[{ RowBox[{"s", "->", RowBox[{"(", RowBox[{ RowBox[{ RowBox[{"connectivityMatrixIndex", "[", RowBox[{"bbs", ",", "#"}], "]"}], "&"}], "/@", "s"}], ")"}]}], ",", RowBox[{"{", RowBox[{"l", ",", "l"}], "}"}]}], "]"}]}], "\[IndentingNewLine]", "]"}]}]}], "Input", CellChangeTimes->{3.855821730407148*^9}, CellLabel->"In[29]:=",ExpressionUUID->"411b4aa5-e580-4550-b144-3d7bccb52a3a"], Cell[CellGroupData[{ Cell[BoxData[ RowBox[{ RowBox[{"(*", RowBox[{ RowBox[{"SeedRandom", "[", "1111", "]"}], ";"}], "*)"}], "\[IndentingNewLine]", RowBox[{ RowBox[{ RowBox[{"SeedRandom", "[", "11111", "]"}], ";"}], "\[IndentingNewLine]", RowBox[{ RowBox[{"listOfPositions", "=", RowBox[{"Table", "[", RowBox[{ RowBox[{"collisionFreeCorrelatedPolymerChain2D", "[", RowBox[{"40", ",", "0.3", ",", RowBox[{"RandomReal", "[", RowBox[{ RowBox[{"{", RowBox[{ RowBox[{"-", "30"}], ",", "30"}], "}"}], ",", "2"}], "]"}]}], "]"}], ",", "4"}], "]"}]}], ";"}], "\[IndentingNewLine]", RowBox[{ RowBox[{"bbs", "=", RowBox[{"axesAlignedBoundingBoxes", "/@", "listOfPositions"}]}], ";"}], "\[IndentingNewLine]", RowBox[{ RowBox[{"cols", "=", RowBox[{"RandomColor", "[", "4", "]"}]}], ";"}], "\[IndentingNewLine]", RowBox[{ RowBox[{"Echo", "[", RowBox[{ RowBox[{"MatrixForm", "[", RowBox[{"connectivityMatrix", "[", "bbs", "]"}], "]"}], ",", "\"\\""}], "]"}], ";"}], "\[IndentingNewLine]", RowBox[{"graphicMultiple", "=", RowBox[{"Graphics", "[", RowBox[{"MapThread", "[", RowBox[{"chainGraphic", ",", RowBox[{"{", RowBox[{"listOfPositions", ",", "bbs", ",", "cols"}], "}"}]}], "]"}], "]"}]}]}]}]], "Input", CellChangeTimes->{{3.855662470241838*^9, 3.8556624849871273`*^9}}, CellLabel-> "In[132]:=",ExpressionUUID->"a3d5bc92-a40f-425e-9f07-8e0c6e9e50ba"], Cell[BoxData[ RowBox[{ TagBox["\<\"Connectivity Matrix\"\>", "EchoLabel"], " ", TagBox[ RowBox[{"(", "\[NoBreak]", GridBox[{ {"0", "0", "0", "0"}, {"0", "0", "1", "0"}, {"0", "0", "0", "0"}, {"0", "0", "0", "0"} }, GridBoxAlignment->{"Columns" -> {{Center}}, "Rows" -> {{Baseline}}}, GridBoxSpacings->{"Columns" -> { Offset[0.27999999999999997`], { Offset[0.7]}, Offset[0.27999999999999997`]}, "Rows" -> { Offset[0.2], { Offset[0.4]}, Offset[0.2]}}], "\[NoBreak]", ")"}], Function[BoxForm`e$, MatrixForm[ SparseArray[ Automatic, {4, 4}, 0, {1, {{0, 0, 1, 1, 1}, {{3}}}, {1}}]]]]}]], "Echo", CellChangeTimes->{ 3.855836888941478*^9},ExpressionUUID->"e59e7864-1a0b-466b-92d0-\ d8f728115db6"], Cell[BoxData[ GraphicsBox[{{ {RGBColor[0.9128081900098961, 0.6090936304379417, 0.5817600363515538], Opacity[0.25], RectangleBox[{-25.25571001321872, 15.531305207379503}, \ {-10.014937504534378, 29.215079437228013}]}, {EdgeForm[RGBColor[ 0.6085387933399308, 0.40606242029196116`, 0.38784002423436925`]], FaceForm[None], DiskBox[{-13.262661417146619, 16.43878148325432}, NCache[ Rational[1, 2], 0.5]], DiskBox[{-13.125021318440734, 17.42926379164162}, NCache[ Rational[1, 2], 0.5]], DiskBox[{-12.22926135001253, 17.873801842838034}, NCache[ Rational[1, 2], 0.5]], DiskBox[{-12.168632187738996, 18.87196220304175}, NCache[ Rational[1, 2], 0.5]], DiskBox[{-11.577601315871657, 19.67861114062224}, NCache[ Rational[1, 2], 0.5]], DiskBox[{-11.918853814793161, 20.618582806141916}, NCache[ Rational[1, 2], 0.5]], DiskBox[{-11.744180385211425, 21.603209229207106}, NCache[ Rational[1, 2], 0.5]], DiskBox[{-12.125467115892608, 22.52766605838111}, NCache[ Rational[1, 2], 0.5]], DiskBox[{-11.715676661461664, 23.43984574652226}, NCache[ Rational[1, 2], 0.5]], DiskBox[{-10.827052958166151, 23.89848276415316}, NCache[ Rational[1, 2], 0.5]], DiskBox[{-10.514937504534378, 24.848526943970203}, NCache[ Rational[1, 2], 0.5]], DiskBox[{-10.98678973095498, 25.730204592786322}, NCache[ Rational[1, 2], 0.5]], DiskBox[{-11.681026517037285, 26.449951273813827}, NCache[ Rational[1, 2], 0.5]], DiskBox[{-12.492399583687648, 27.034479927272653}, NCache[ Rational[1, 2], 0.5]], DiskBox[{-12.739006196914616, 28.003595595453042}, NCache[ Rational[1, 2], 0.5]], DiskBox[{-13.441708653786035, 28.715079437228013}, NCache[ Rational[1, 2], 0.5]], DiskBox[{-14.31497884563418, 28.22784317828426}, NCache[ Rational[1, 2], 0.5]], DiskBox[{-13.98868540253158, 27.28257465083386}, NCache[ Rational[1, 2], 0.5]], DiskBox[{-14.806583514842492, 26.707211567313333}, NCache[ Rational[1, 2], 0.5]], DiskBox[{-15.805955719777874, 26.742640312741212}, NCache[ Rational[1, 2], 0.5]], DiskBox[{-16.796250288256708, 26.881624727843484}, NCache[ Rational[1, 2], 0.5]], DiskBox[{-17.722853600919553, 27.25766501951745}, NCache[ Rational[1, 2], 0.5]], DiskBox[{-18.69469548106188, 27.02203106610363}, NCache[ Rational[1, 2], 0.5]], DiskBox[{-19.41403444434288, 26.327371828847106}, NCache[ Rational[1, 2], 0.5]], DiskBox[{-18.968554141584924, 25.43208008876755}, NCache[ Rational[1, 2], 0.5]], DiskBox[{-18.739427763386853, 24.458683405593707}, NCache[ Rational[1, 2], 0.5]], DiskBox[{-18.553542767724334, 23.476111897566152}, NCache[ Rational[1, 2], 0.5]], DiskBox[{-19.300477548322604, 22.81121458704925}, NCache[ Rational[1, 2], 0.5]], DiskBox[{-20.10704687931543, 23.40235409199016}, NCache[ Rational[1, 2], 0.5]], DiskBox[{-21.057090427922397, 23.71447146694753}, NCache[ Rational[1, 2], 0.5]], DiskBox[{-21.8392760889079, 24.33751688403096}, NCache[ Rational[1, 2], 0.5]], DiskBox[{-21.32207299380302, 25.193379582373357}, NCache[ Rational[1, 2], 0.5]], DiskBox[{-21.293242005096754, 26.192963883015487}, NCache[ Rational[1, 2], 0.5]], DiskBox[{-22.199889696937237, 26.61485244991476}, NCache[ Rational[1, 2], 0.5]], DiskBox[{-22.751284795285542, 25.78060821378396}, NCache[ Rational[1, 2], 0.5]], DiskBox[{-23.21741109917105, 24.89589002767833}, NCache[ Rational[1, 2], 0.5]], DiskBox[{-24.17466451907915, 25.185140593925386}, NCache[ Rational[1, 2], 0.5]], DiskBox[{-24.75571001321872, 25.999011673237156}, NCache[ Rational[1, 2], 0.5]]}, {EdgeForm[GrayLevel[0]], FaceForm[RGBColor[ 0.6085387933399308, 0.40606242029196116`, 0.38784002423436925`]], DiskBox[{-14.175877210154596, 16.031305207379503}, NCache[ Rational[1, 2], 0.5]], DiskBox[{-24.54982916228297, 26.977588739807782}, NCache[ Rational[1, 2], 0.5]]}}, { {RGBColor[0.1629685137822714, 0.7702952192454355, 0.020086483808114952`], Opacity[0.25], RectangleBox[{-12.218221380134581, -17.864574902236097}, {0.5762895485876374, -7.460447639078169}]}, {EdgeForm[RGBColor[ 0.1086456758548476, 0.5135301461636237, 0.01339098920540997]], FaceForm[ None], DiskBox[{-2.2916829154231655, -16.548661763716854}, NCache[ Rational[1, 2], 0.5]], DiskBox[{-1.6733594390007576, -15.762738053357568}, NCache[ Rational[1, 2], 0.5]], DiskBox[{-1.431251341537441, -14.792488771398187}, NCache[ Rational[1, 2], 0.5]], DiskBox[{-1.5065030985409749, -13.795324204705265}, NCache[ Rational[1, 2], 0.5]], DiskBox[{-1.206097547165471, -12.841512638040875}, NCache[ Rational[1, 2], 0.5]], DiskBox[{-1.2175217563104677, -11.841577896447498}, NCache[ Rational[1, 2], 0.5]], DiskBox[{-0.25775842982502417, -11.560767716550835}, NCache[ Rational[1, 2], 0.5]], DiskBox[{0.07628954858763742, -10.618211644946385}, NCache[ Rational[1, 2], 0.5]], DiskBox[{-0.785598920637389, -10.111113758323949}, NCache[ Rational[1, 2], 0.5]], DiskBox[{-1.682833173256141, -10.552668620065578}, NCache[ Rational[1, 2], 0.5]], DiskBox[{-2.3453444607104794, -9.803616689959531}, NCache[ Rational[1, 2], 0.5]], DiskBox[{-3.2672061900932667, -9.416097720231111}, NCache[ Rational[1, 2], 0.5]], DiskBox[{-4.262696400528142, -9.51096204929281}, NCache[ Rational[1, 2], 0.5]], DiskBox[{-4.975446172574839, -8.809543656001487}, NCache[ Rational[1, 2], 0.5]], DiskBox[{-5.729761740499974, -8.153031642413175}, NCache[ Rational[1, 2], 0.5]], DiskBox[{-6.711042231317692, -7.960447639078169}, NCache[ Rational[1, 2], 0.5]], DiskBox[{-7.370068117851006, -8.712567896004533}, NCache[ Rational[1, 2], 0.5]], DiskBox[{-8.242293762531313, -9.201671591310571}, NCache[ Rational[1, 2], 0.5]], DiskBox[{-9.219203647805998, -9.415323354824476}, NCache[ Rational[1, 2], 0.5]], DiskBox[{-9.99050659834819, -10.051791546083793}, NCache[ Rational[1, 2], 0.5]], DiskBox[{-10.45644854878115, -10.936606836879974}, NCache[ Rational[1, 2], 0.5]], DiskBox[{-10.289699108945896, -11.922606139270513}, NCache[ Rational[1, 2], 0.5]], DiskBox[{-10.642186173756457, -12.858422824920666}, NCache[ Rational[1, 2], 0.5]], DiskBox[{-10.905823705271375, -13.823044643032159}, NCache[ Rational[1, 2], 0.5]], DiskBox[{-11.718221380134581, -14.406148422711949}, NCache[ Rational[1, 2], 0.5]], DiskBox[{-11.566703059579421, -15.394602872110678}, NCache[ Rational[1, 2], 0.5]], DiskBox[{-10.577743504961626, -15.542788564166873}, NCache[ Rational[1, 2], 0.5]], DiskBox[{-10.585016671267311, -16.54276211434302}, NCache[ Rational[1, 2], 0.5]], DiskBox[{-10.015259054683373, -17.364574902236097}, NCache[ Rational[1, 2], 0.5]], DiskBox[{-9.015494461301115, -17.34287794809018}, NCache[ Rational[1, 2], 0.5]], DiskBox[{-8.048141156830592, -17.089446331416255}, NCache[ Rational[1, 2], 0.5]], DiskBox[{-7.258766462789163, -16.47553461756238}, NCache[ Rational[1, 2], 0.5]], DiskBox[{-6.528734147012414, -15.79212199116334}, NCache[ Rational[1, 2], 0.5]], DiskBox[{-7.048962397141614, -14.93809472709766}, NCache[ Rational[1, 2], 0.5]], DiskBox[{-8.042467040082046, -14.824303143683931}, NCache[ Rational[1, 2], 0.5]], DiskBox[{-8.532491099906464, -13.952594235393327}, NCache[ Rational[1, 2], 0.5]], DiskBox[{-8.500794717575536, -12.953096691951059}, NCache[ Rational[1, 2], 0.5]], DiskBox[{-8.205530858426256, -11.997680942928532}, NCache[ Rational[1, 2], 0.5]]}, {EdgeForm[GrayLevel[0]], FaceForm[RGBColor[ 0.1086456758548476, 0.5135301461636237, 0.01339098920540997]], DiskBox[{-3.0412281011381026, -17.21061494527244}, NCache[ Rational[1, 2], 0.5]], DiskBox[{-8.470091118397232, -11.03331178703226}, NCache[ Rational[1, 2], 0.5]]}}, { {RGBColor[0.0248316683154024, 0.3355553052012006, 0.5254786520271737], Opacity[0.25], RectangleBox[{-13.00087656780419, -8.51562738970965}, \ {1.0621449418623472, 0.25580601801471403}]}, {EdgeForm[RGBColor[ 0.016554445543601602`, 0.2237035368008004, 0.35031910135144917`]], FaceForm[None], DiskBox[{-10.70931257082899, -6.835879300811861}, NCache[ Rational[1, 2], 0.5]], DiskBox[{-10.722645054389645, -5.835968182320769}, NCache[ Rational[1, 2], 0.5]], DiskBox[{-10.030478424176883, -5.114230448777684}, NCache[ Rational[1, 2], 0.5]], DiskBox[{-9.24720681135469, -4.492550804147975}, NCache[ Rational[1, 2], 0.5]], DiskBox[{-8.697117956185444, -3.6574446723188596}, NCache[ Rational[1, 2], 0.5]], DiskBox[{-8.374597586190708, -2.710882148795739}, NCache[ Rational[1, 2], 0.5]], DiskBox[{-7.799131565503387, -1.8930564589117025}, NCache[ Rational[1, 2], 0.5]], DiskBox[{-6.799604273240225, -1.9238004342738713}, NCache[ Rational[1, 2], 0.5]], DiskBox[{-6.105692400165596, -2.6438603709500215}, NCache[ Rational[1, 2], 0.5]], DiskBox[{-5.209759687491532, -3.0880501663759117}, NCache[ Rational[1, 2], 0.5]], DiskBox[{-4.66847179965962, -3.9288875005175794}, NCache[ Rational[1, 2], 0.5]], DiskBox[{-4.045175100923044, -4.7108729385815415}, NCache[ Rational[1, 2], 0.5]], DiskBox[{-3.128031509565386, -5.10942987658611}, NCache[ Rational[1, 2], 0.5]], DiskBox[{-2.544398211035439, -5.921447224213027}, NCache[ Rational[1, 2], 0.5]], DiskBox[{-1.8839923300190429, -6.672356055109933}, NCache[ Rational[1, 2], 0.5]], DiskBox[{-1.2576727982005291, -7.451922501323877}, NCache[ Rational[1, 2], 0.5]], DiskBox[{-0.43169652807530046, -8.01562738970965}, NCache[ Rational[1, 2], 0.5]], DiskBox[{0.3409246015590659, -7.380760009824279}, NCache[ Rational[1, 2], 0.5]], DiskBox[{-0.1637815903141847, -6.517468830739955}, NCache[ Rational[1, 2], 0.5]], DiskBox[{0.5621449418623472, -5.829696579277194}, NCache[ Rational[1, 2], 0.5]], DiskBox[{0.07022164324506136, -4.959058038734973}, NCache[ Rational[1, 2], 0.5]], DiskBox[{-0.5011158543593188, -4.138342823918552}, NCache[ Rational[1, 2], 0.5]], DiskBox[{-1.392806805163468, -4.590987550226052}, NCache[ Rational[1, 2], 0.5]], DiskBox[{-2.363185148065008, -4.349397253178217}, NCache[ Rational[1, 2], 0.5]], DiskBox[{-2.822985413491406, -3.461374890895704}, NCache[ Rational[1, 2], 0.5]], DiskBox[{-3.4718932795749757, -2.700507897699871}, NCache[ Rational[1, 2], 0.5]], DiskBox[{-2.9831835467663526, -1.82806145403807}, NCache[ Rational[1, 2], 0.5]], DiskBox[{-3.006985765053007, -0.8283447669688611}, NCache[ Rational[1, 2], 0.5]], DiskBox[{-3.8186309217582464, -0.24419398198528597}, NCache[ Rational[1, 2], 0.5]], DiskBox[{-4.665631411389116, -0.775786091186567}, NCache[ Rational[1, 2], 0.5]], DiskBox[{-5.663939092202423, -0.7176330652192314}, NCache[ Rational[1, 2], 0.5]], DiskBox[{-6.558423722409044, -0.2705343665808614}, NCache[ Rational[1, 2], 0.5]], DiskBox[{-7.5482736021254935, -0.4126512748829038}, NCache[ Rational[1, 2], 0.5]], DiskBox[{-8.342506378905979, -1.0202648826037648}, NCache[ Rational[1, 2], 0.5]], DiskBox[{-9.018765247776892, -1.7569289459823394}, NCache[ Rational[1, 2], 0.5]], DiskBox[{-9.981638116801516, -1.4869736939565839}, NCache[ Rational[1, 2], 0.5]], DiskBox[{-10.585587298648806, -0.6899508675921248}, NCache[ Rational[1, 2], 0.5]], DiskBox[{-11.525571318005841, -1.0311693362502452}, NCache[ Rational[1, 2], 0.5]]}, {EdgeForm[GrayLevel[0]], FaceForm[RGBColor[ 0.016554445543601602`, 0.2237035368008004, 0.35031910135144917`]], DiskBox[{-11.634993541209482, -7.214184390753076}, NCache[ Rational[1, 2], 0.5]], DiskBox[{-12.50087656780419, -1.2520305363642124}, NCache[ Rational[1, 2], 0.5]]}}, { {RGBColor[0.2592727715291965, 0.7653529433997175, 0.04951685769666048], Opacity[0.25], RectangleBox[{1.962422800132389, -8.874478012418177}, \ {11.379023029261107, 4.023675920347964}]}, {EdgeForm[RGBColor[ 0.17284851435279766`, 0.5102352955998117, 0.03301123846444032]], FaceForm[None], DiskBox[{6.8025247781700156, 1.9561720091081143}, NCache[ Rational[1, 2], 0.5]], DiskBox[{6.130772831306027, 2.6969481709035934}, NCache[ Rational[1, 2], 0.5]], DiskBox[{5.568170637657046, 3.523675920347964}, NCache[ Rational[1, 2], 0.5]], DiskBox[{4.65603689669497, 3.1137832043861784}, NCache[ Rational[1, 2], 0.5]], DiskBox[{4.748509905834977, 2.1180680128878304}, NCache[ Rational[1, 2], 0.5]], DiskBox[{3.7699559297921468, 1.9120774403589709}, NCache[ Rational[1, 2], 0.5]], DiskBox[{3.4717053596672915, 0.9575898304759515}, NCache[ Rational[1, 2], 0.5]], DiskBox[{4.037120162173152, 0.13278312517630453}, NCache[ Rational[1, 2], 0.5]], DiskBox[{4.333410309291755, -0.8223148534208846}, NCache[ Rational[1, 2], 0.5]], DiskBox[{5.085560011336314, -1.4813071338872654}, NCache[ Rational[1, 2], 0.5]], DiskBox[{5.69178431596247, -2.2766008484861766}, NCache[ Rational[1, 2], 0.5]], DiskBox[{6.642016535093718, -1.965058347814272}, NCache[ Rational[1, 2], 0.5]], DiskBox[{7.155973209968625, -1.1072422041380592}, NCache[ Rational[1, 2], 0.5]], DiskBox[{7.862505761812101, -0.39956165955205336}, NCache[ Rational[1, 2], 0.5]], DiskBox[{7.529622026079515, 0.5434062182066314}, NCache[ Rational[1, 2], 0.5]], DiskBox[{7.859289194018599, 1.487503436920374}, NCache[ Rational[1, 2], 0.5]], DiskBox[{7.983490201380264, 2.479760515388624}, NCache[ Rational[1, 2], 0.5]], DiskBox[{8.977664355801405, 2.587546185498386}, NCache[ Rational[1, 2], 0.5]], DiskBox[{9.706140434070594, 1.902474945852798}, NCache[ Rational[1, 2], 0.5]], DiskBox[{10.706081062379589, 1.8915781638960225}, NCache[ Rational[1, 2], 0.5]], DiskBox[{10.879023029261107, 0.9066461479217466}, NCache[ Rational[1, 2], 0.5]], DiskBox[{10.112257501219958, 0.2647188739975306}, NCache[ Rational[1, 2], 0.5]], DiskBox[{9.662274917427382, -0.6283184568478027}, NCache[ Rational[1, 2], 0.5]], DiskBox[{9.861898928568957, -1.6081910272240474}, NCache[ Rational[1, 2], 0.5]], DiskBox[{9.090644549346617, -2.244718074984285}, NCache[ Rational[1, 2], 0.5]], DiskBox[{8.117387450889057, -2.474436642588149}, NCache[ Rational[1, 2], 0.5]], DiskBox[{7.197484123108213, -2.8665818548982442}, NCache[ Rational[1, 2], 0.5]], DiskBox[{6.4968110217408, -3.58006430389063}, NCache[ Rational[1, 2], 0.5]], DiskBox[{5.626196380129199, -4.072029898024513}, NCache[ Rational[1, 2], 0.5]], DiskBox[{4.8181200429502224, -3.482952115986005}, NCache[ Rational[1, 2], 0.5]], DiskBox[{4.10187796501145, -2.7851002077777163}, NCache[ Rational[1, 2], 0.5]], DiskBox[{3.283506459401656, -3.3597897577139912}, NCache[ Rational[1, 2], 0.5]], DiskBox[{2.462422800132389, -3.930597627737689}, NCache[ Rational[1, 2], 0.5]], DiskBox[{2.891484355067467, -4.833872880402508}, NCache[ Rational[1, 2], 0.5]], DiskBox[{3.75754115942872, -5.333818489063665}, NCache[ Rational[1, 2], 0.5]], DiskBox[{4.726991393758518, -5.5791065710364744}, NCache[ Rational[1, 2], 0.5]], DiskBox[{5.293342730863739, -6.403270488566918}, NCache[ Rational[1, 2], 0.5]], DiskBox[{5.185110421012237, -7.397396118004268}, NCache[ Rational[1, 2], 0.5]]}, {EdgeForm[GrayLevel[0]], FaceForm[RGBColor[ 0.17284851435279766`, 0.5102352955998117, 0.03301123846444032]], DiskBox[{6.3818545918178415, 1.0489583659598054}, NCache[ Rational[1, 2], 0.5]], DiskBox[{4.9722466814779365, -8.374478012418177}, NCache[ Rational[1, 2], 0.5]]}}}]], "Output", CellChangeTimes->{{3.85566247707909*^9, 3.855662485375963*^9}, 3.855821781825358*^9, 3.85582189953445*^9, 3.855836889004043*^9}, CellLabel->"Out[137]=",ImageCache->GraphicsData["CompressedBitmap", "\<\ eJztXVuTJEd1btWtu2d2dmZ2Zvaivc2uVqvVanVFAoQArS57Q8heJGSBL2GW SwAGhxSYCBwBBgFhAcIOPWBuEo512E82P4AIv2wEYT/vD+AH+GeMO09WZp6T /Z2srO6ekUTooWuqs7OyzvnONU9m1Tx/45tf+dLf3vjmV79wY/vKN268+pWv fuHvti+/8o1JU3nHYHDH/wwGxcXtQTU53xkMxOGOnZ2d/zWH3Tn/D/pTrj10 a2373K2R+Qw26VheP/5meevoD8qdyWfQHs130049qtDvtWPfr8xvg8KcvWJ/ MIOa4ekWr4v7mQ5Pnvt9ZT6DDTqWr2z/pjB3uX309WJQ3ZyMOqBz02Z70LFy ba5vS5q53A/5NXuBuU0OBQcCBWZE83fQUNvQUeWGN3T5PvbqUrR9vG0bnSUJ khRLezRt/p53z0SiIcXczhJnATHfHRjmM5R4ElV0QRFANWf0w6O28+1i1ZK7 8tQdg4qORLQjuS+56wEZL78x0QCkRVAT6ZZOR/nAHqck/giDuNkeUKemVdPJ d8ML9TizSJrpbFDzX50wnB44/aG2hyI9MOSNWiI5sHctnkivEU78Qw/wg60a taIWVJnvk/bdoqrkejoYASV94F1AHMluDIzt/t0hLsOuHT4tZM4a9prSFank 1jSBNUfGQJJlfslbt6M5YsEalDne280HJ8LxT1cd68fbvu4QhNosbyAIVAln QfyOAHB3pz2G4TmAE8m8J7/LasAruXhc2Hd9usNw5bq5YBTZOZFeA8TuYXEI +fTlD94RxYrZWAaGBjyDJdgROKCzEnisBugNCr/3RKKNoqzhkHqMAJF39uNz SedJDLsOYlZkusTO2AN+LmKCZTZONzkTgoJdYsJ6z5rrrJdDCdwCEvj9YNw9 ZGGT8LV2wTOz2MWLgS4AHRuDtl2i+UgmZO8wtL3IJBUPyn50d7zLnfJWIZSo 7vYeINbIxajXbs0cFZC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85ygA qV5gTVXi7vVxjKDLNLqewtQz/KxFwWVgIRHTqhtaBioShLckzyISVzXFVa9I 2WP346b6JM/D5PQKrTCybFUraaoOh2yBNtgUmVY9TkLHKktSgXHNTYyM93S4 2XjXg5+J2oBo2wJWg3antFVoTqG5hpVZvW6gBB3C5EpecFsVKiVF2s5nWMLT 4D07TqSJp3BjoSUjKUUnZGxgod/8rQOE3JYy4FL3NEXCRIUjtF0EeRe8Dcw6 cm6yY4DYqvfJSBrHkwzi1dOUQrHMempVJL0NLRsf4FYwPrk6ZV3/mKuD82Nc H4jeE57eqYgpnAainOcNaPYkcEX+IHcl+OBccKAVmwKAfkJTnexFlprDHSWk MkaUEuKQlaf3hS4ONZOR7rSPx3vUzAP4baY6YIt13l7YpC6yjaQNkYZYp1bz lNx86DdWoff3KiRqIXPK3b07H0wlCH1NCH0epse9DUTbHhkQFbdE85ftqvUG xjLj5IQ5t5qYuw8As++udlpiZjHtXMZ895H/iXCXSN9rru8aIOYbRSsQk7cy GQ1LcOiB4UOQvTpiz75vn45iqvZRKVOWbFdOcC6vCIWek30ID9jZbAhoBn7E /zlVXxquL9xW1Td+ZCyaRLtfidghkBomNtrrgtJk+nYKUIiq2si20Y60o5Ca lwAvqG50QnNBg4YXAcVUCjCAYL8TEvayaSUViICwLg/EB/XtC1HxEd/vO5JB daaSkcrQtyOpuyAVQ/Yw412+DXrOsxv6XX4Xa0IgbobqP5a5OjYNnVts7zl2 5NFQ3o3cATbfXH3KLQ932kYyr1Xrq/jVMN/VusvaIZurCT7xe3a+G+iKHJX2 EpCMQV/XVXivru6cFZ+GV//ImwCaId4Fr/mxVdasORN+PdhPtv/vl78My03c Pd96+8s3rv/nq1+nHmfMkV/987CWY87oGx3vt7/T+YJfEje44/8B71NAuA== \ \>", "ImageResolution" -> \ 96.],ExpressionUUID->"ab3d78da-c32d-47d7-8088-f9df74f70890"] }, Open ]] }, Open ]] }, Open ]], Cell[CellGroupData[{ Cell["Wrapping it all together", "Item", CellChangeTimes->{{3.855662491534045*^9, 3.855662495272839*^9}},ExpressionUUID->"f13dd67f-a4d0-4811-8654-\ f2de7b2fe078"], Cell[BoxData[{ RowBox[{ RowBox[{ RowBox[{"pairwiseChainCollisionQ", "[", RowBox[{ RowBox[{"{", RowBox[{"listOfPositions_", ",", "bbs_"}], "}"}], ",", RowBox[{"{", RowBox[{"i_", ",", "j_"}], "}"}]}], "]"}], ":=", RowBox[{"Block", "[", RowBox[{ RowBox[{"{", "\[IndentingNewLine]", RowBox[{ RowBox[{"posA", "=", RowBox[{"listOfPositions", "[", RowBox[{"[", "i", "]"}], "]"}]}], ",", RowBox[{"bbA", "=", RowBox[{"bbs", "[", RowBox[{"[", "i", "]"}], "]"}]}], ",", "\[IndentingNewLine]", RowBox[{"posB", "=", RowBox[{"listOfPositions", "[", RowBox[{"[", "j", "]"}], "]"}]}], ",", RowBox[{"bbB", "=", RowBox[{"bbs", "[", RowBox[{"[", "j", "]"}], "]"}]}]}], "\[IndentingNewLine]", "}"}], ",", "\[IndentingNewLine]", "\[IndentingNewLine]", RowBox[{ RowBox[{ RowBox[{"{", RowBox[{"posA", ",", "posB"}], "}"}], "=", RowBox[{"returnPointsInOverlapSimple", "[", RowBox[{ RowBox[{"{", RowBox[{"posA", ",", "bbA"}], "}"}], ",", RowBox[{"{", RowBox[{"posB", ",", "bbB"}], "}"}]}], "]"}]}], ";", "\[IndentingNewLine]", RowBox[{"If", "[", RowBox[{ RowBox[{ RowBox[{ RowBox[{"Length", "[", "posA", "]"}], "==", "0"}], "||", RowBox[{ RowBox[{"Length", "[", "posB", "]"}], "==", "0"}]}], ",", "False", ",", RowBox[{"shortestDistanceLessThanOne", "[", RowBox[{"posA", ",", "posB"}], "]"}]}], "]"}]}]}], "\[IndentingNewLine]", "]"}]}], "\[IndentingNewLine]"}], "\[IndentingNewLine]", RowBox[{ RowBox[{ RowBox[{"collisionsFreeChainsQ", "[", "listOfPositions_", "]"}], ":=", RowBox[{"Block", "[", RowBox[{ RowBox[{"{", "\[IndentingNewLine]", RowBox[{ RowBox[{"bbs", "=", RowBox[{"axesAlignedBoundingBoxes", "/@", "listOfPositions"}]}], ",", "\[IndentingNewLine]", "mij", ",", "nonzero"}], "}"}], ",", "\[IndentingNewLine]", "\[IndentingNewLine]", RowBox[{ RowBox[{"mij", "=", RowBox[{"connectivityMatrix", "[", "bbs", "]"}]}], ";", "\[IndentingNewLine]", RowBox[{"nonzero", "=", RowBox[{"mij", "[", "\"\\"", "]"}]}], ";", "\[IndentingNewLine]", "\[IndentingNewLine]", "\[IndentingNewLine]", RowBox[{"NoneTrue", "[", RowBox[{"nonzero", ",", RowBox[{ RowBox[{"pairwiseChainCollisionQ", "[", RowBox[{ RowBox[{"{", RowBox[{"listOfPositions", ",", "bbs"}], "}"}], ",", "#"}], "]"}], "&"}]}], "]"}]}]}], "\[IndentingNewLine]", "\[IndentingNewLine]", "]"}]}], "\[IndentingNewLine]"}], "\[IndentingNewLine]", RowBox[{ RowBox[{"moveAllChains", "[", RowBox[{"listOfPositions_", ",", "ds_"}], "]"}], ":=", " ", RowBox[{"Block", "[", RowBox[{ RowBox[{"{", RowBox[{"listOfPos", "=", "listOfPositions"}], "}"}], ",", "\[IndentingNewLine]", RowBox[{ RowBox[{"listOfPos", "=", RowBox[{ RowBox[{ RowBox[{"moveSingleChain", "[", RowBox[{"#", ",", "ds"}], "]"}], "&"}], "/@", "listOfPos"}]}], ";", "\[IndentingNewLine]", RowBox[{"If", "[", RowBox[{ RowBox[{"collisionsFreeChainsQ", "[", "listOfPos", "]"}], ",", "listOfPos", ",", "listOfPositions"}], "]"}]}]}], "\[IndentingNewLine]", "]"}]}]}], "Input", CellChangeTimes->{3.855836869566367*^9}, CellLabel-> "In[125]:=",ExpressionUUID->"e51b1b8c-3a3b-4938-b29a-5da4e64aa9d8"], Cell[BoxData[ RowBox[{"Dynamic", "[", RowBox[{"Graphics", "[", RowBox[{"MapThread", "[", RowBox[{"chainGraphic", ",", RowBox[{"{", RowBox[{"listOfPositions", ",", "bbs", ",", "cols"}], "}"}]}], "]"}], "]"}], "]"}]], "Input", CellChangeTimes->{{3.855662533483087*^9, 3.855662534586904*^9}}, CellLabel-> "In[128]:=",ExpressionUUID->"f7c761a7-fef4-4ddd-b5b9-e3d8a51b0e38"], Cell[CellGroupData[{ Cell[BoxData[ RowBox[{"Do", "[", "\[IndentingNewLine]", RowBox[{ RowBox[{ RowBox[{"listOfPositions", "=", RowBox[{"moveAllChains", "[", RowBox[{"listOfPositions", ",", ".1"}], "]"}]}], ";", "\[IndentingNewLine]", RowBox[{"bbs", "=", RowBox[{"axesAlignedBoundingBoxes", "/@", "listOfPositions"}]}], ";", "\[IndentingNewLine]", RowBox[{"Pause", "[", "0.01", "]"}]}], ",", "\[IndentingNewLine]", RowBox[{"{", "1000", "}"}]}], "]"}]], "Input", CellChangeTimes->{{3.855662526369999*^9, 3.855662545970525*^9}}, CellLabel-> "In[129]:=",ExpressionUUID->"6836538a-5c2f-4520-95da-202a4d41038f"], Cell[BoxData["$Aborted"], "Output", CellChangeTimes->{3.855821894884758*^9, 3.855836877535819*^9}, CellLabel-> "Out[129]=",ExpressionUUID->"87425d12-0dea-46a8-93af-4bc80e60b64c"] }, Open ]] }, Open ]] }, Open ]], Cell[CellGroupData[{ Cell["Step-Growth Polymerization", "Section", CellChangeTimes->{{3.8556612784439983`*^9, 3.855661281540303*^9}, { 3.855821915824564*^9, 3.855821921457221*^9}},ExpressionUUID->"d6abc337-7ebd-4edb-bb6a-\ abf80e7632d1"], Cell["Now that we have a realistic motion for polymer chains in 2D", "Item", CellChangeTimes->{{3.8558222464921913`*^9, 3.855822277950742*^9}},ExpressionUUID->"d7224a08-2a94-4044-acc5-\ bf55ec859836"], Cell["\<\ We\[CloseCurlyQuote]ll try and simulate one of the important polymerization \ mechanisms, called step-growth\ \>", "Item", CellChangeTimes->{{3.8558222464921913`*^9, 3.855822297621269*^9}},ExpressionUUID->"0b3148fc-7513-4a4e-8d05-\ 4b4050a56c87"], Cell[CellGroupData[{ Cell["Our approach is again simple:", "Item", CellChangeTimes->{{3.8558222464921913`*^9, 3.85582231210885*^9}},ExpressionUUID->"76de842a-f7c8-4cdf-9a7c-\ e079c5238b6c"], Cell["\<\ We will start with many non-colliding polymer dimers and allow them to reptate\ \>", "Subitem", CellChangeTimes->{{3.8558222464921913`*^9, 3.8558223345292463`*^9}},ExpressionUUID->"dd00e31e-a372-4123-b74c-\ 7bb687978e29"], Cell["\<\ When we detect a collision between two \[OpenCurlyQuote]end-mers\ \[CloseCurlyQuote] we will merge our chains (to form 4-mers, 6-mers, 8-mers \ etc)\ \>", "Subitem", CellChangeTimes->{{3.8558222464921913`*^9, 3.8558223714269047`*^9}},ExpressionUUID->"c6d51e7d-1cfd-416c-a3a0-\ 2bb8f39168c0"] }, Open ]], Cell[CellGroupData[{ Cell["First, let\[CloseCurlyQuote]s start with our initial dimers \ configuration", "Item", CellChangeTimes->{{3.855822375069611*^9, 3.855822410951208*^9}},ExpressionUUID->"00dfbd39-0d3e-485e-a241-\ a66e91a6a296"], Cell[CellGroupData[{ Cell["We could do this a number of ways", "Subitem", CellChangeTimes->{{3.855822375069611*^9, 3.855822429011339*^9}},ExpressionUUID->"e5a9e3ad-e09e-4d65-ab44-\ a0267bcabb86"], Cell[CellGroupData[{ Cell["\<\ E.g. we could start with a regular hexagonal arrangement of dimers\ \>", "Subsubitem", CellChangeTimes->{{3.855822375069611*^9, 3.8558224461738873`*^9}},ExpressionUUID->"5ed1bda1-9dfe-4557-99de-\ 9b4941c16584"], Cell[CellGroupData[{ Cell[BoxData[{ RowBox[{ RowBox[{"hexagonalLatticeVectors", "=", RowBox[{"{", RowBox[{ RowBox[{"{", RowBox[{"1", ",", "0"}], "}"}], ",", RowBox[{"{", RowBox[{ RowBox[{"1", "/", "2"}], ",", RowBox[{ RowBox[{"Sqrt", "[", "3", "]"}], "/", "2"}]}], "}"}]}], "}"}]}], ";", RowBox[{"latticeCoords", "=", RowBox[{"Tuples", "[", RowBox[{ RowBox[{"Range", "[", RowBox[{ RowBox[{"-", "12"}], ",", "12", ",", "4"}], "]"}], ",", "2"}], "]"}]}], ";"}], "\[IndentingNewLine]", RowBox[{ RowBox[{"hexagonalLatticePoints", "=", RowBox[{"latticeCoords", ".", "hexagonalLatticeVectors"}]}], ";"}], "\[IndentingNewLine]", RowBox[{"Graphics", "[", RowBox[{"{", RowBox[{"Point", "[", "hexagonalLatticePoints", "]"}], "}"}], "]"}]}], "Input", CellChangeTimes->{{3.855822454535363*^9, 3.855822498379705*^9}}, CellLabel->"In[73]:=",ExpressionUUID->"86c2f9ba-870e-4969-a23c-8af8691108b4"], Cell[BoxData[ GraphicsBox[ PointBox[NCache[{{-18, (-6) 3^Rational[1, 2]}, {-16, (-4) 3^Rational[1, 2]}, {-14, (-2) 3^Rational[1, 2]}, {-12, 0}, {-10, 2 3^Rational[1, 2]}, {-8, 4 3^Rational[1, 2]}, {-6, 6 3^Rational[1, 2]}, {-14, (-6) 3^Rational[1, 2]}, {-12, (-4) 3^Rational[1, 2]}, {-10, (-2) 3^Rational[1, 2]}, {-8, 0}, {-6, 2 3^Rational[1, 2]}, {-4, 4 3^Rational[1, 2]}, {-2, 6 3^Rational[1, 2]}, {-10, (-6) 3^Rational[1, 2]}, {-8, (-4) 3^Rational[1, 2]}, {-6, (-2) 3^Rational[1, 2]}, {-4, 0}, {-2, 2 3^Rational[1, 2]}, {0, 4 3^Rational[1, 2]}, { 2, 6 3^Rational[1, 2]}, {-6, (-6) 3^Rational[1, 2]}, {-4, (-4) 3^Rational[1, 2]}, {-2, (-2) 3^Rational[1, 2]}, {0, 0}, { 2, 2 3^Rational[1, 2]}, {4, 4 3^Rational[1, 2]}, { 6, 6 3^Rational[1, 2]}, {-2, (-6) 3^Rational[1, 2]}, { 0, (-4) 3^Rational[1, 2]}, {2, (-2) 3^Rational[1, 2]}, {4, 0}, { 6, 2 3^Rational[1, 2]}, {8, 4 3^Rational[1, 2]}, { 10, 6 3^Rational[1, 2]}, {2, (-6) 3^Rational[1, 2]}, { 4, (-4) 3^Rational[1, 2]}, {6, (-2) 3^Rational[1, 2]}, {8, 0}, { 10, 2 3^Rational[1, 2]}, {12, 4 3^Rational[1, 2]}, { 14, 6 3^Rational[1, 2]}, {6, (-6) 3^Rational[1, 2]}, { 8, (-4) 3^Rational[1, 2]}, {10, (-2) 3^Rational[1, 2]}, {12, 0}, { 14, 2 3^Rational[1, 2]}, {16, 4 3^Rational[1, 2]}, { 18, 6 3^Rational[ 1, 2]}}, {{-18, -10.392304845413264`}, {-16, -6.928203230275509}, \ {-14, -3.4641016151377544`}, {-12, 0}, {-10, 3.4641016151377544`}, {-8, 6.928203230275509}, {-6, 10.392304845413264`}, {-14, -10.392304845413264`}, {-12, \ -6.928203230275509}, {-10, -3.4641016151377544`}, {-8, 0}, {-6, 3.4641016151377544`}, {-4, 6.928203230275509}, {-2, 10.392304845413264`}, {-10, -10.392304845413264`}, {-8, \ -6.928203230275509}, {-6, -3.4641016151377544`}, {-4, 0}, {-2, 3.4641016151377544`}, {0, 6.928203230275509}, { 2, 10.392304845413264`}, {-6, -10.392304845413264`}, {-4, \ -6.928203230275509}, {-2, -3.4641016151377544`}, {0, 0}, { 2, 3.4641016151377544`}, {4, 6.928203230275509}, { 6, 10.392304845413264`}, {-2, -10.392304845413264`}, { 0, -6.928203230275509}, {2, -3.4641016151377544`}, {4, 0}, { 6, 3.4641016151377544`}, {8, 6.928203230275509}, { 10, 10.392304845413264`}, {2, -10.392304845413264`}, { 4, -6.928203230275509}, {6, -3.4641016151377544`}, {8, 0}, { 10, 3.4641016151377544`}, {12, 6.928203230275509}, { 14, 10.392304845413264`}, {6, -10.392304845413264`}, { 8, -6.928203230275509}, {10, -3.4641016151377544`}, {12, 0}, { 14, 3.4641016151377544`}, {16, 6.928203230275509}, { 18, 10.392304845413264`}}]]]], "Output", CellChangeTimes->{3.855822498683201*^9}, CellLabel->"Out[75]=",ExpressionUUID->"194cadad-4fb1-410e-ac82-680208898ff1"] }, Open ]] }, Open ]], Cell[CellGroupData[{ Cell["\<\ And place a dimer on each hexagonal grid point within a square box\ \>", "Subsubitem", CellChangeTimes->{{3.8558225085055017`*^9, 3.855822525878924*^9}},ExpressionUUID->"40cac478-584f-4d7e-a2f3-\ f260e656ca01"], Cell[BoxData[ RowBox[{ RowBox[{"randomDimer", "[", "origin_", "]"}], ":=", RowBox[{"Join", "[", RowBox[{ RowBox[{"{", "origin", "}"}], ",", RowBox[{"{", RowBox[{"AngleVector", "[", RowBox[{"origin", ",", RowBox[{"RandomReal", "[", RowBox[{"2", "\[Pi]"}], "]"}]}], "]"}], "}"}]}], "]"}]}]], "Input", CellChangeTimes->{3.855822535757028*^9}, CellLabel->"In[76]:=",ExpressionUUID->"9ceb6e5c-40b7-48f7-8082-94db1542a34a"], Cell[BoxData[ RowBox[{ RowBox[{"hexagonalDimerConfiguration", "[", "size_", "]"}], ":=", RowBox[{"Block", "[", RowBox[{ RowBox[{"{", "\[IndentingNewLine]", RowBox[{ RowBox[{"hexagonalLatticeVectors", "=", RowBox[{"{", RowBox[{ RowBox[{"{", RowBox[{"1", ",", "0"}], "}"}], ",", RowBox[{"{", RowBox[{ RowBox[{"1", "/", "2"}], ",", RowBox[{ RowBox[{"Sqrt", "[", "3", "]"}], "/", "2"}]}], "}"}]}], "}"}]}], ",", RowBox[{"latticeCoords", "=", RowBox[{"Tuples", "[", RowBox[{ RowBox[{"Range", "[", RowBox[{ RowBox[{"-", "size"}], ",", "size", ",", "4"}], "]"}], ",", "2"}], "]"}]}], ",", "\[IndentingNewLine]", "pts", ",", "dimers", ",", "bbs", ",", "collisions"}], "}"}], ",", "\[IndentingNewLine]", "\[IndentingNewLine]", RowBox[{ RowBox[{"pts", "=", RowBox[{"Select", "[", RowBox[{ RowBox[{"latticeCoords", ".", "hexagonalLatticeVectors"}], ",", RowBox[{ RowBox[{ RowBox[{ RowBox[{"size", "/", "2"}], ">", RowBox[{"#", "[", RowBox[{"[", "1", "]"}], "]"}], ">", RowBox[{ RowBox[{"-", "size"}], "/", "2"}]}], "&&", RowBox[{ RowBox[{"size", "/", "2"}], ">", RowBox[{"#", "[", RowBox[{"[", "2", "]"}], "]"}], ">", RowBox[{ RowBox[{"-", "size"}], "/", "2"}]}]}], "&"}]}], "]"}]}], ";", "\[IndentingNewLine]", "\[IndentingNewLine]", RowBox[{"randomDimer", "/@", "pts"}]}]}], "\[IndentingNewLine]", "\[IndentingNewLine]", "]"}]}]], "Input", CellChangeTimes->{{3.8558225499306803`*^9, 3.8558225571837893`*^9}, { 3.8558231087547083`*^9, 3.855823109037889*^9}}, CellLabel-> "In[102]:=",ExpressionUUID->"5c3a6514-8f78-475d-a30a-b58d108afccc"], Cell[CellGroupData[{ Cell[BoxData[ RowBox[{"Graphics", "[", RowBox[{"chainGraphic", "/@", RowBox[{"hexagonalDimerConfiguration", "[", "24", "]"}]}], "]"}]], "Input",\ CellChangeTimes->{{3.855822559338991*^9, 3.855822571610626*^9}, { 3.855822615152061*^9, 3.8558226153638287`*^9}}, CellLabel-> "In[104]:=",ExpressionUUID->"63a1f954-7cd4-407c-ae8f-db6a07d4e334"], Cell[BoxData[ GraphicsBox[{{{}, {EdgeForm[GrayLevel[0]], FaceForm[GrayLevel[0.85]], DiskBox[NCache[{-10, 6 3^Rational[1, 2]}, {-10, 10.392304845413264`}], NCache[Rational[1, 2], 0.5]], DiskBox[{-10.230994529354005, 9.419349796395828}, NCache[ Rational[1, 2], 0.5]]}}, {{}, {EdgeForm[GrayLevel[0]], FaceForm[GrayLevel[0.85]], DiskBox[NCache[{-10, 2 3^Rational[1, 2]}, {-10, 3.4641016151377544`}], NCache[Rational[1, 2], 0.5]], DiskBox[{-9.913250706168983, 4.460331789354446}, NCache[ Rational[1, 2], 0.5]]}}, {{}, {EdgeForm[GrayLevel[0]], FaceForm[GrayLevel[0.85]], DiskBox[NCache[{-8, 4 3^Rational[1, 2]}, {-8, 6.928203230275509}], NCache[Rational[1, 2], 0.5]], DiskBox[{-7.045303174246931, 6.6306230378953455}, NCache[ Rational[1, 2], 0.5]]}}, {{}, {EdgeForm[GrayLevel[0]], FaceForm[GrayLevel[0.85]], DiskBox[NCache[{-6, 6 3^Rational[1, 2]}, {-6, 10.392304845413264`}], NCache[Rational[1, 2], 0.5]], DiskBox[{-5.252637655910729, 11.056721526899658}, NCache[ Rational[1, 2], 0.5]]}}, {{}, {EdgeForm[GrayLevel[0]], FaceForm[GrayLevel[0.85]], DiskBox[NCache[{-10, (-2) 3^Rational[1, 2]}, {-10, -3.4641016151377544`}], NCache[ Rational[1, 2], 0.5]], DiskBox[{-10.996219231929086, -3.377226751485356}, NCache[ Rational[1, 2], 0.5]]}}, {{}, {EdgeForm[GrayLevel[0]], FaceForm[GrayLevel[0.85]], DiskBox[{-8, 0}, NCache[Rational[1, 2], 0.5]], DiskBox[{-7.136265831454544, -0.5039477017380772}, NCache[ Rational[1, 2], 0.5]]}}, {{}, {EdgeForm[GrayLevel[0]], FaceForm[GrayLevel[0.85]], DiskBox[NCache[{-6, 2 3^Rational[1, 2]}, {-6, 3.4641016151377544`}], NCache[Rational[1, 2], 0.5]], DiskBox[{-6.8947599125164905, 3.9106491478299437}, NCache[ Rational[1, 2], 0.5]]}}, {{}, {EdgeForm[GrayLevel[0]], FaceForm[GrayLevel[0.85]], DiskBox[NCache[{-4, 4 3^Rational[1, 2]}, {-4, 6.928203230275509}], NCache[Rational[1, 2], 0.5]], DiskBox[{-4.619042680357468, 7.713560575625918}, NCache[ Rational[1, 2], 0.5]]}}, {{}, {EdgeForm[GrayLevel[0]], FaceForm[GrayLevel[0.85]], DiskBox[NCache[{-2, 6 3^Rational[1, 2]}, {-2, 10.392304845413264`}], NCache[Rational[1, 2], 0.5]], DiskBox[{-1.7191785133484005, 9.432544827161417}, NCache[ Rational[1, 2], 0.5]]}}, {{}, {EdgeForm[GrayLevel[0]], FaceForm[GrayLevel[0.85]], DiskBox[NCache[{-10, (-6) 3^Rational[1, 2]}, {-10, -10.392304845413264`}], NCache[ Rational[1, 2], 0.5]], DiskBox[{-10.892430972378891, -10.843488798517614}, NCache[ Rational[1, 2], 0.5]]}}, {{}, {EdgeForm[GrayLevel[0]], FaceForm[GrayLevel[0.85]], DiskBox[NCache[{-8, (-4) 3^Rational[1, 2]}, {-8, -6.928203230275509}], NCache[Rational[1, 2], 0.5]], DiskBox[{-8.821600823962909, -6.358140000393533}, NCache[ Rational[1, 2], 0.5]]}}, {{}, {EdgeForm[GrayLevel[0]], FaceForm[GrayLevel[0.85]], DiskBox[NCache[{-6, (-2) 3^Rational[1, 2]}, {-6, -3.4641016151377544`}], NCache[Rational[1, 2], 0.5]], DiskBox[{-6.940239121005106, -3.1235867177668086}, NCache[ Rational[1, 2], 0.5]]}}, {{}, {EdgeForm[GrayLevel[0]], FaceForm[GrayLevel[0.85]], DiskBox[{-4, 0}, NCache[Rational[1, 2], 0.5]], DiskBox[{-4.110856355521137, 0.9938364394811509}, NCache[ Rational[1, 2], 0.5]]}}, {{}, {EdgeForm[GrayLevel[0]], FaceForm[GrayLevel[0.85]], DiskBox[NCache[{-2, 2 3^Rational[1, 2]}, {-2, 3.4641016151377544`}], NCache[Rational[1, 2], 0.5]], DiskBox[{-2.888514309900363, 3.005252706342842}, NCache[ Rational[1, 2], 0.5]]}}, {{}, {EdgeForm[GrayLevel[0]], FaceForm[GrayLevel[0.85]], DiskBox[NCache[{0, 4 3^Rational[1, 2]}, {0, 6.928203230275509}], NCache[ Rational[1, 2], 0.5]], DiskBox[{0.18548280763363878, 7.910850739849691}, NCache[ Rational[1, 2], 0.5]]}}, {{}, {EdgeForm[GrayLevel[0]], FaceForm[GrayLevel[0.85]], DiskBox[NCache[{2, 6 3^Rational[1, 2]}, {2, 10.392304845413264`}], NCache[Rational[1, 2], 0.5]], DiskBox[{1.139216357442118, 9.883333804287362}, NCache[ Rational[1, 2], 0.5]]}}, {{}, {EdgeForm[GrayLevel[0]], FaceForm[GrayLevel[0.85]], DiskBox[NCache[{-6, (-6) 3^Rational[1, 2]}, {-6, -10.392304845413264`}], NCache[Rational[1, 2], 0.5]], DiskBox[{-5.504517947734652, -9.523686669295058}, NCache[ Rational[1, 2], 0.5]]}}, {{}, {EdgeForm[GrayLevel[0]], FaceForm[GrayLevel[0.85]], DiskBox[NCache[{-4, (-4) 3^Rational[1, 2]}, {-4, -6.928203230275509}], NCache[Rational[1, 2], 0.5]], DiskBox[{-3.0033398648153167, -7.009864573233168}, NCache[ Rational[1, 2], 0.5]]}}, {{}, {EdgeForm[GrayLevel[0]], FaceForm[GrayLevel[0.85]], DiskBox[NCache[{-2, (-2) 3^Rational[1, 2]}, {-2, -3.4641016151377544`}], NCache[Rational[1, 2], 0.5]], DiskBox[{-2.962405341702265, -3.7357189162489797}, NCache[ Rational[1, 2], 0.5]]}}, {{}, {EdgeForm[GrayLevel[0]], FaceForm[GrayLevel[0.85]], DiskBox[{0, 0}, NCache[Rational[1, 2], 0.5]], DiskBox[{0.40695178799328324, -0.9134496385948543}, NCache[ Rational[1, 2], 0.5]]}}, {{}, {EdgeForm[GrayLevel[0]], FaceForm[GrayLevel[0.85]], DiskBox[NCache[{2, 2 3^Rational[1, 2]}, {2, 3.4641016151377544`}], NCache[Rational[1, 2], 0.5]], DiskBox[{1.7775437371494445, 4.4390442858207875}, NCache[ Rational[1, 2], 0.5]]}}, {{}, {EdgeForm[GrayLevel[0]], FaceForm[GrayLevel[0.85]], DiskBox[NCache[{4, 4 3^Rational[1, 2]}, {4, 6.928203230275509}], NCache[ Rational[1, 2], 0.5]], DiskBox[{3.161421269599612, 7.472983656612646}, NCache[ Rational[1, 2], 0.5]]}}, {{}, {EdgeForm[GrayLevel[0]], FaceForm[GrayLevel[0.85]], DiskBox[NCache[{6, 6 3^Rational[1, 2]}, {6, 10.392304845413264`}], NCache[Rational[1, 2], 0.5]], DiskBox[{5.30301972047962, 11.109395139560167}, NCache[ Rational[1, 2], 0.5]]}}, {{}, {EdgeForm[GrayLevel[0]], FaceForm[GrayLevel[0.85]], DiskBox[NCache[{-2, (-6) 3^Rational[1, 2]}, {-2, -10.392304845413264`}], NCache[Rational[1, 2], 0.5]], DiskBox[{-1.0099959168544697, -10.251266143791412}, NCache[ Rational[1, 2], 0.5]]}}, {{}, {EdgeForm[GrayLevel[0]], FaceForm[GrayLevel[0.85]], DiskBox[NCache[{0, (-4) 3^Rational[1, 2]}, {0, -6.928203230275509}], NCache[Rational[1, 2], 0.5]], DiskBox[{-0.2440213107375202, -5.9584333607157545}, NCache[ Rational[1, 2], 0.5]]}}, {{}, {EdgeForm[GrayLevel[0]], FaceForm[GrayLevel[0.85]], DiskBox[NCache[{2, (-2) 3^Rational[1, 2]}, {2, -3.4641016151377544`}], NCache[Rational[1, 2], 0.5]], DiskBox[{2.664395961222916, -4.211482379347456}, NCache[ Rational[1, 2], 0.5]]}}, {{}, {EdgeForm[GrayLevel[0]], FaceForm[GrayLevel[0.85]], DiskBox[{4, 0}, NCache[Rational[1, 2], 0.5]], DiskBox[{3.506566786441808, 0.8697836879119059}, NCache[ Rational[1, 2], 0.5]]}}, {{}, {EdgeForm[GrayLevel[0]], FaceForm[GrayLevel[0.85]], DiskBox[NCache[{6, 2 3^Rational[1, 2]}, {6, 3.4641016151377544`}], NCache[Rational[1, 2], 0.5]], DiskBox[{6.504834467952243, 4.327317787349197}, NCache[ Rational[1, 2], 0.5]]}}, {{}, {EdgeForm[GrayLevel[0]], FaceForm[GrayLevel[0.85]], DiskBox[NCache[{8, 4 3^Rational[1, 2]}, {8, 6.928203230275509}], NCache[ Rational[1, 2], 0.5]], DiskBox[{7.095923083609273, 7.355573010734347}, NCache[ Rational[1, 2], 0.5]]}}, {{}, {EdgeForm[GrayLevel[0]], FaceForm[GrayLevel[0.85]], DiskBox[NCache[{10, 6 3^Rational[1, 2]}, {10, 10.392304845413264`}], NCache[Rational[1, 2], 0.5]], DiskBox[{9.648587051221027, 11.328525406729062}, NCache[ Rational[1, 2], 0.5]]}}, {{}, {EdgeForm[GrayLevel[0]], FaceForm[GrayLevel[0.85]], DiskBox[NCache[{2, (-6) 3^Rational[1, 2]}, {2, -10.392304845413264`}], NCache[Rational[1, 2], 0.5]], DiskBox[{1.0219651487092212, -10.600746275221795}, NCache[ Rational[1, 2], 0.5]]}}, {{}, {EdgeForm[GrayLevel[0]], FaceForm[GrayLevel[0.85]], DiskBox[NCache[{4, (-4) 3^Rational[1, 2]}, {4, -6.928203230275509}], NCache[Rational[1, 2], 0.5]], DiskBox[{3.441051865332586, -7.757405848910917}, NCache[ Rational[1, 2], 0.5]]}}, {{}, {EdgeForm[GrayLevel[0]], FaceForm[GrayLevel[0.85]], DiskBox[NCache[{6, (-2) 3^Rational[1, 2]}, {6, -3.4641016151377544`}], NCache[Rational[1, 2], 0.5]], DiskBox[{6.965847530945085, -3.204990544422351}, NCache[ Rational[1, 2], 0.5]]}}, {{}, {EdgeForm[GrayLevel[0]], FaceForm[GrayLevel[0.85]], DiskBox[{8, 0}, NCache[Rational[1, 2], 0.5]], DiskBox[{8.58342225127782, 0.8121689951690595}, NCache[ Rational[1, 2], 0.5]]}}, {{}, {EdgeForm[GrayLevel[0]], FaceForm[GrayLevel[0.85]], DiskBox[NCache[{10, 2 3^Rational[1, 2]}, {10, 3.4641016151377544`}], NCache[Rational[1, 2], 0.5]], DiskBox[{10.395733015143236, 2.545736012163839}, NCache[ Rational[1, 2], 0.5]]}}, {{}, {EdgeForm[GrayLevel[0]], FaceForm[GrayLevel[0.85]], DiskBox[NCache[{6, (-6) 3^Rational[1, 2]}, {6, -10.392304845413264`}], NCache[Rational[1, 2], 0.5]], DiskBox[{5.60719485980419, -9.472683117834066}, NCache[ Rational[1, 2], 0.5]]}}, {{}, {EdgeForm[GrayLevel[0]], FaceForm[GrayLevel[0.85]], DiskBox[NCache[{8, (-4) 3^Rational[1, 2]}, {8, -6.928203230275509}], NCache[Rational[1, 2], 0.5]], DiskBox[{8.35575590382024, -5.993624321409572}, NCache[ Rational[1, 2], 0.5]]}}, {{}, {EdgeForm[GrayLevel[0]], FaceForm[GrayLevel[0.85]], DiskBox[NCache[{10, (-2) 3^Rational[1, 2]}, {10, -3.4641016151377544`}], NCache[Rational[1, 2], 0.5]], DiskBox[{10.948258724621429, -3.1466029676141103}, NCache[ Rational[1, 2], 0.5]]}}, {{}, {EdgeForm[GrayLevel[0]], FaceForm[GrayLevel[0.85]], DiskBox[NCache[{10, (-6) 3^Rational[1, 2]}, {10, -10.392304845413264`}], NCache[Rational[1, 2], 0.5]], DiskBox[{10.119439032849808, -11.385146382332374}, NCache[ Rational[1, 2], 0.5]]}}}]], "Output", CellChangeTimes->{{3.855822562850107*^9, 3.855822572386911*^9}, { 3.8558226092628183`*^9, 3.855822615922874*^9}, 3.855823111032358*^9}, CellLabel-> "Out[104]=",ExpressionUUID->"7c3263d2-95ee-4717-b9f0-d705b3851384"] }, Open ]] }, Open ]] }, Open ]] }, Open ]], Cell[CellGroupData[{ Cell["\<\ Or equivalently, we can make an amorphous packing of lattice sites for each \ of our dimers\ \>", "Item", CellChangeTimes->{{3.8558226319635983`*^9, 3.855822667378251*^9}},ExpressionUUID->"9693eb67-c146-49f1-be12-\ 7f9eafbb0eab"], Cell[BoxData[ RowBox[{ RowBox[{"amorphousPackedDimers", "[", "size_", "]"}], ":=", RowBox[{"Block", "[", RowBox[{ RowBox[{"{", "\[IndentingNewLine]", RowBox[{ RowBox[{"proc", "=", RowBox[{"HardcorePointProcess", "[", RowBox[{"1", ",", "4", ",", "2"}], "]"}]}], ",", "sites"}], "}"}], ",", "\[IndentingNewLine]", RowBox[{ RowBox[{"sites", "=", RowBox[{ RowBox[{"RandomPointConfiguration", "[", RowBox[{"proc", ",", RowBox[{"Rectangle", "[", RowBox[{ RowBox[{"{", RowBox[{ RowBox[{ RowBox[{"-", "size"}], "/", "2"}], ",", RowBox[{ RowBox[{"-", "size"}], "/", "2"}]}], "}"}], ",", RowBox[{"{", RowBox[{ RowBox[{"size", "/", "2"}], ",", RowBox[{"size", "/", "2"}]}], "}"}]}], "]"}]}], "]"}], "[", "\"\\"", "]"}]}], ";", "\[IndentingNewLine]", RowBox[{"randomDimer", "/@", "sites"}]}]}], "\[IndentingNewLine]", "\[IndentingNewLine]", "]"}]}]], "Input", CellChangeTimes->{{3.85582305008775*^9, 3.855823104755896*^9}, 3.8558364992285557`*^9, 3.855836546093607*^9}, CellLabel-> "In[107]:=",ExpressionUUID->"27581ba5-fd09-4960-a004-ea8696264e5d"], Cell[CellGroupData[{ Cell[BoxData[ RowBox[{"Graphics", "[", RowBox[{"chainGraphic", "/@", RowBox[{"amorphousPackedDimers", "[", "24", "]"}]}], "]"}]], "Input", CellChangeTimes->{3.85582312242785*^9}, CellLabel-> "In[120]:=",ExpressionUUID->"334f8f1a-8e3d-4995-aa95-b15dfe6d9f6b"], Cell[BoxData[ GraphicsBox[{{{}, {EdgeForm[GrayLevel[0]], FaceForm[GrayLevel[0.85]], DiskBox[{-2.4821955042622097, -3.0865910075398446}, NCache[ Rational[1, 2], 0.5]], DiskBox[{-1.523318385801335, -3.3704125565669925}, NCache[ Rational[1, 2], 0.5]]}}, {{}, {EdgeForm[GrayLevel[0]], FaceForm[GrayLevel[0.85]], DiskBox[{1.2573336434476818, -11.466594024376587}, NCache[ Rational[1, 2], 0.5]], DiskBox[{1.9220802754837085, -12.213662906874552}, NCache[ Rational[1, 2], 0.5]]}}, {{}, {EdgeForm[GrayLevel[0]], FaceForm[GrayLevel[0.85]], DiskBox[{11.326356322319407, -9.799698968237728}, NCache[ Rational[1, 2], 0.5]], DiskBox[{11.18590486716242, -8.809611402037502}, NCache[ Rational[1, 2], 0.5]]}}, {{}, {EdgeForm[GrayLevel[0]], FaceForm[GrayLevel[0.85]], DiskBox[{11.25784329070528, -3.5583440110781677}, NCache[ Rational[1, 2], 0.5]], DiskBox[{12.050642738720004, -4.167826607406846}, NCache[ Rational[1, 2], 0.5]]}}, {{}, {EdgeForm[GrayLevel[0]], FaceForm[GrayLevel[0.85]], DiskBox[{3.104131466762846, -6.66573241727407}, NCache[ Rational[1, 2], 0.5]], DiskBox[{2.747035496081647, -7.599800117027815}, NCache[ Rational[1, 2], 0.5]]}}, {{}, {EdgeForm[GrayLevel[0]], FaceForm[GrayLevel[0.85]], DiskBox[{5.386731566186782, -11.870555611854307}, NCache[ Rational[1, 2], 0.5]], DiskBox[{6.253808210518952, -11.372380850496745}, NCache[ Rational[1, 2], 0.5]]}}, {{}, {EdgeForm[GrayLevel[0]], FaceForm[GrayLevel[0.85]], DiskBox[{-3.4919192040355522, -10.825167057988907}, NCache[ Rational[1, 2], 0.5]], DiskBox[{-4.483240746042527, -10.693707557180051}, NCache[ Rational[1, 2], 0.5]]}}, {{}, {EdgeForm[GrayLevel[0]], FaceForm[GrayLevel[0.85]], DiskBox[{3.840115159830768, 3.21817190143571}, NCache[ Rational[1, 2], 0.5]], DiskBox[{3.365977935463788, 2.337720941717012}, NCache[ Rational[1, 2], 0.5]]}}, {{}, {EdgeForm[GrayLevel[0]], FaceForm[GrayLevel[0.85]], DiskBox[{-11.644650713726307, 6.996633035172017}, NCache[ Rational[1, 2], 0.5]], DiskBox[{-12.120473325773581, 6.117091767314443}, NCache[ Rational[1, 2], 0.5]]}}, {{}, {EdgeForm[GrayLevel[0]], FaceForm[GrayLevel[0.85]], DiskBox[{-8.757775061784333, 10.853594373050921}, NCache[ Rational[1, 2], 0.5]], DiskBox[{-9.757366899369773, 10.882162856254704}, NCache[ Rational[1, 2], 0.5]]}}, {{}, {EdgeForm[GrayLevel[0]], FaceForm[GrayLevel[0.85]], DiskBox[{0.7346162829107161, 11.385675318524578}, NCache[ Rational[1, 2], 0.5]], DiskBox[{1.7138760070305357, 11.18306635347916}, NCache[ Rational[1, 2], 0.5]]}}, {{}, {EdgeForm[GrayLevel[0]], FaceForm[GrayLevel[0.85]], DiskBox[{5.532232319628829, 7.455166878103611}, NCache[ Rational[1, 2], 0.5]], DiskBox[{4.749922537185218, 6.832277317833872}, NCache[ Rational[1, 2], 0.5]]}}, {{}, {EdgeForm[GrayLevel[0]], FaceForm[GrayLevel[0.85]], DiskBox[{-7.970886531242682, -2.104152250956618}, NCache[ Rational[1, 2], 0.5]], DiskBox[{-8.764827301866472, -2.712147360099201}, NCache[ Rational[1, 2], 0.5]]}}, {{}, {EdgeForm[GrayLevel[0]], FaceForm[GrayLevel[0.85]], DiskBox[{11.966822951110299, 4.7144547060761735}, NCache[ Rational[1, 2], 0.5]], DiskBox[{11.405506629069626, 5.542056051296644}, NCache[ Rational[1, 2], 0.5]]}}, {{}, {EdgeForm[GrayLevel[0]], FaceForm[GrayLevel[0.85]], DiskBox[{8.912794715486005, 1.356762599314166}, NCache[ Rational[1, 2], 0.5]], DiskBox[{9.77962185307088, 0.8581538212662746}, NCache[ Rational[1, 2], 0.5]]}}, {{}, {EdgeForm[GrayLevel[0]], FaceForm[GrayLevel[0.85]], DiskBox[{-1.2540743531861018, 3.2369224571564157}, NCache[ Rational[1, 2], 0.5]], DiskBox[{-0.4423761436269612, 2.652845393235493}, NCache[ Rational[1, 2], 0.5]]}}, {{}, {EdgeForm[GrayLevel[0]], FaceForm[GrayLevel[0.85]], DiskBox[{-7.505997634281746, 5.980715548455471}, NCache[ Rational[1, 2], 0.5]], DiskBox[{-7.760242840314775, 6.947855339390175}, NCache[ Rational[1, 2], 0.5]]}}, {{}, {EdgeForm[GrayLevel[0]], FaceForm[GrayLevel[0.85]], DiskBox[{2.532169095053419, -2.5484963560463783}, NCache[ Rational[1, 2], 0.5]], DiskBox[{2.2925646584448938, -3.5193669519331374}, NCache[ Rational[1, 2], 0.5]]}}, {{}, {EdgeForm[GrayLevel[0]], FaceForm[GrayLevel[0.85]], DiskBox[{-5.961926247485298, -7.263619676643836}, NCache[ Rational[1, 2], 0.5]], DiskBox[{-6.804763672022335, -6.725451416896223}, NCache[ Rational[1, 2], 0.5]]}}, {{}, {EdgeForm[GrayLevel[0]], FaceForm[GrayLevel[0.85]], DiskBox[{9.35894912922659, 9.913636451947088}, NCache[ Rational[1, 2], 0.5]], DiskBox[{10.154212603194287, 9.3073724772852}, NCache[ Rational[1, 2], 0.5]]}}, {{}, {EdgeForm[GrayLevel[0]], FaceForm[GrayLevel[0.85]], DiskBox[{-9.657853501887798, 2.365343764665658}, NCache[ Rational[1, 2], 0.5]], DiskBox[{-8.796557583213325, 2.8734474356568196}, NCache[ Rational[1, 2], 0.5]]}}, {{}, {EdgeForm[GrayLevel[0]], FaceForm[GrayLevel[0.85]], DiskBox[{4.839737214956999, 11.64299262723251}, NCache[ Rational[1, 2], 0.5]], DiskBox[{5.8373170271341, 11.573461926555042}, NCache[ Rational[1, 2], 0.5]]}}, {{}, {EdgeForm[GrayLevel[0]], FaceForm[GrayLevel[0.85]], DiskBox[{-8.985331906647332, -11.741552156262161}, NCache[ Rational[1, 2], 0.5]], DiskBox[{-9.870248868604328, -11.275803328629927}, NCache[ Rational[1, 2], 0.5]]}}, {{}, {EdgeForm[GrayLevel[0]], FaceForm[GrayLevel[0.85]], DiskBox[{-4.050307193817833, 10.54772378578215}, NCache[ Rational[1, 2], 0.5]], DiskBox[{-4.46462707110317, 9.637592454991772}, NCache[ Rational[1, 2], 0.5]]}}, {{}, {EdgeForm[GrayLevel[0]], FaceForm[GrayLevel[0.85]], DiskBox[{-11.902977464567012, -4.43559925079351}, NCache[ Rational[1, 2], 0.5]], DiskBox[{-12.870675865901022, -4.687709948812459}, NCache[ Rational[1, 2], 0.5]]}}}]], "Output", CellChangeTimes->{3.8558231227339783`*^9, 3.855836547380074*^9, 3.8558367452214613`*^9}, CellLabel-> "Out[120]=",ExpressionUUID->"23f85698-d414-42d9-ae03-537417aede86"] }, Open ]] }, Open ]], Cell[CellGroupData[{ Cell["\<\ First, like we mentioned above, we generalize our overlapping bounding boxes \ function to return the indices of the points as-well\ \>", "Item", CellChangeTimes->{{3.855836757206854*^9, 3.855836817804801*^9}},ExpressionUUID->"80d343d7-bdd0-4412-bee0-\ 2b3f696c327f"], Cell[BoxData[ RowBox[{ RowBox[{"returnPointsInOverlap", "[", RowBox[{ RowBox[{"{", RowBox[{"positionsA_", ",", RowBox[{"{", RowBox[{ RowBox[{"{", RowBox[{"xMinA_", ",", "xMaxA_"}], "}"}], ",", RowBox[{"{", RowBox[{"yMinA_", ",", "yMaxA_"}], "}"}]}], "}"}]}], "}"}], ",", RowBox[{"{", RowBox[{"positionsB_", ",", RowBox[{"{", RowBox[{ RowBox[{"{", RowBox[{"xMinB_", ",", "xMaxB_"}], "}"}], ",", RowBox[{"{", RowBox[{"yMinB_", ",", "yMaxB_"}], "}"}]}], "}"}]}], "}"}]}], "]"}], ":=", RowBox[{"With", "[", "\[IndentingNewLine]", RowBox[{ RowBox[{"{", "\[IndentingNewLine]", RowBox[{ RowBox[{"xMin", "=", RowBox[{ RowBox[{"Max", "[", RowBox[{"xMinA", ",", "xMinB"}], "]"}], "-", RowBox[{"1", "/", "2"}]}]}], ",", RowBox[{"yMin", "=", RowBox[{ RowBox[{"Max", "[", RowBox[{"yMinA", ",", "yMinB"}], "]"}], "-", RowBox[{"1", "/", "2"}]}]}], ",", "\[IndentingNewLine]", RowBox[{"xMax", "=", RowBox[{ RowBox[{"Min", "[", RowBox[{"xMaxA", ",", "xMaxB"}], "]"}], "+", RowBox[{"1", "/", "2"}]}]}], ",", RowBox[{"yMax", "=", RowBox[{ RowBox[{"Min", "[", RowBox[{"yMaxA", ",", "yMaxB"}], "]"}], "+", RowBox[{"1", "/", "2"}]}]}]}], "\[IndentingNewLine]", "}"}], ",", "\[IndentingNewLine]", RowBox[{"Table", "[", RowBox[{ RowBox[{"Select", "[", RowBox[{ RowBox[{"Thread", "[", RowBox[{"{", RowBox[{"pos", ",", RowBox[{"Range", "[", RowBox[{"Length", "[", "pos", "]"}], "]"}]}], "}"}], "]"}], ",", RowBox[{ RowBox[{ RowBox[{"xMax", ">", RowBox[{"#", "[", RowBox[{"[", RowBox[{"1", ",", "1"}], "]"}], "]"}], ">", "xMin"}], "&&", RowBox[{"yMax", ">", RowBox[{"#", "[", RowBox[{"[", RowBox[{"1", ",", "2"}], "]"}], "]"}], ">", "yMin"}]}], "&"}]}], "]"}], ",", RowBox[{"{", RowBox[{"pos", ",", RowBox[{"{", RowBox[{"positionsA", ",", "positionsB"}], "}"}]}], "}"}]}], "]"}]}], "\[IndentingNewLine]", "]"}]}]], "Input", CellLabel-> "In[138]:=",ExpressionUUID->"19e18cf2-5f1e-4114-8dc1-9269bedbef6e"], Cell[CellGroupData[{ Cell[BoxData[ RowBox[{"Block", "[", RowBox[{ RowBox[{"{", RowBox[{ RowBox[{"posA", "=", "chainPositions"}], ",", RowBox[{"posB", "=", RowBox[{ RowBox[{"TranslationTransform", "[", RowBox[{"{", RowBox[{ RowBox[{"-", "3"}], ",", RowBox[{"-", "3"}]}], "}"}], "]"}], "@", "chainPositions"}]}], ",", "bbA", ",", "bbB", ",", "dm"}], "}"}], ",", "\[IndentingNewLine]", "\[IndentingNewLine]", RowBox[{ RowBox[{"bbA", "=", RowBox[{"axesAlignedBoundingBoxes", "[", "posA", "]"}]}], ";", "\[IndentingNewLine]", RowBox[{"bbB", "=", RowBox[{"axesAlignedBoundingBoxes", "[", "posB", "]"}]}], ";", "\[IndentingNewLine]", "\[IndentingNewLine]", RowBox[{ RowBox[{"{", RowBox[{"posA", ",", "posB"}], "}"}], "=", RowBox[{"returnPointsInOverlap", "[", RowBox[{ RowBox[{"{", RowBox[{"posA", ",", "bbA"}], "}"}], ",", RowBox[{"{", RowBox[{"posB", ",", "bbB"}], "}"}]}], "]"}]}], ";", "\[IndentingNewLine]", "\[IndentingNewLine]", RowBox[{"Echo", "[", "posA", "]"}], ";", "\[IndentingNewLine]", RowBox[{"Echo", "[", "posB", "]"}], ";", "\[IndentingNewLine]", "\[IndentingNewLine]", RowBox[{"Graphics", "[", RowBox[{"MapThread", "[", RowBox[{"chainGraphic", ",", RowBox[{"{", RowBox[{ RowBox[{"{", RowBox[{ RowBox[{"posA", "[", RowBox[{"[", RowBox[{"All", ",", "1"}], "]"}], "]"}], ",", RowBox[{"posB", "[", RowBox[{"[", RowBox[{"All", ",", "1"}], "]"}], "]"}]}], "}"}], ",", RowBox[{"{", RowBox[{"bbA", ",", "bbB"}], "}"}], ",", RowBox[{"{", RowBox[{"Red", ",", "Blue"}], "}"}]}], "}"}]}], "]"}], "]"}]}]}], "\[IndentingNewLine]", "\[IndentingNewLine]", "]"}]], "Input", CellChangeTimes->{{3.855836970170452*^9, 3.8558370106391993`*^9}, { 3.85583718364067*^9, 3.855837201669716*^9}}, CellLabel-> "In[145]:=",ExpressionUUID->"16a68645-974b-4d67-b972-4e84163f1608"], Cell[CellGroupData[{ Cell[BoxData[ RowBox[{"{", RowBox[{ RowBox[{"{", RowBox[{ RowBox[{"{", RowBox[{"0", ",", "0"}], "}"}], ",", "1"}], "}"}], ",", RowBox[{"{", RowBox[{ RowBox[{"{", RowBox[{"0.48789978931200123`", ",", RowBox[{"-", "0.8728996480634557`"}]}], "}"}], ",", "2"}], "}"}], ",", RowBox[{"{", RowBox[{ RowBox[{"{", RowBox[{"1.0939566180207008`", ",", RowBox[{"-", "1.6683209957626195`"}]}], "}"}], ",", "3"}], "}"}], ",", RowBox[{"{", RowBox[{ RowBox[{"{", RowBox[{"2.083257212377393`", ",", RowBox[{"-", "1.8142125102708158`"}]}], "}"}], ",", "4"}], "}"}]}], "}"}]], "Echo", CellChangeTimes->{ 3.855837202038073*^9},ExpressionUUID->"9a8e4d1b-b5fd-4266-b7b7-\ bba749f4315b"], Cell[BoxData[ RowBox[{"{", RowBox[{ RowBox[{"{", RowBox[{ RowBox[{"{", RowBox[{"0.3298814397317824`", ",", RowBox[{"-", "2.1963406200711035`"}]}], "}"}], ",", "9"}], "}"}], ",", RowBox[{"{", RowBox[{ RowBox[{"{", RowBox[{ RowBox[{"-", "0.48080264920628224`"}], ",", RowBox[{"-", "1.610856796261547`"}]}], "}"}], ",", "10"}], "}"}]}], "}"}]], "Echo", CellChangeTimes->{ 3.855837202108782*^9},ExpressionUUID->"3fd21d2e-9472-49d5-9cd6-\ 632871a181c1"] }, Open ]], Cell[BoxData[ GraphicsBox[{{ {RGBColor[1, 0, 0], Opacity[0.25], RectangleBox[ NCache[{Rational[-1, 2], -2.390224640128515}, {-0.5, -2.390224640128515}], \ {4.871269615886817, 3.6172468445425503}]}, {EdgeForm[RGBColor[ NCache[ Rational[2, 3], 0.6666666666666666], 0, 0]], FaceForm[None], DiskBox[{0.48789978931200123, -0.8728996480634557}, NCache[ Rational[1, 2], 0.5]], DiskBox[{1.0939566180207008, -1.6683209957626195}, NCache[ Rational[1, 2], 0.5]]}, {EdgeForm[GrayLevel[0]], FaceForm[RGBColor[ NCache[ Rational[2, 3], 0.6666666666666666], 0, 0]], DiskBox[{0, 0}, NCache[Rational[1, 2], 0.5]], DiskBox[{2.083257212377393, -1.8142125102708158}, NCache[ Rational[1, 2], 0.5]]}}, { {RGBColor[0, 0, 1], Opacity[0.25], RectangleBox[{-3.5, -5.390224640128515}, \ {1.871269615886817, 0.6172468445425503}]}, {EdgeForm[RGBColor[0, 0, NCache[ Rational[2, 3], 0.6666666666666666]]], FaceForm[None]}, {EdgeForm[GrayLevel[0]], FaceForm[RGBColor[0, 0, NCache[ Rational[2, 3], 0.6666666666666666]]], DiskBox[{0.3298814397317824, -2.1963406200711035}, NCache[ Rational[1, 2], 0.5]], DiskBox[{-0.48080264920628224, -1.610856796261547}, NCache[ Rational[1, 2], 0.5]]}}}]], "Output", CellChangeTimes->{{3.8558371958542023`*^9, 3.855837202169736*^9}}, CellLabel-> "Out[145]=",ExpressionUUID->"75adf91f-b1b7-4d62-96b8-8878a703c843"] }, Open ]] }, Open ]], Cell[CellGroupData[{ Cell["\<\ This allows us to check for collisions, while maintaining the relative \ indices\ \>", "Item", CellChangeTimes->{{3.855836938481254*^9, 3.855836948939477*^9}, { 3.855837066293992*^9, 3.855837086679042*^9}},ExpressionUUID->"d1a575aa-d9ec-4dcb-863c-\ 8dca16b89bad"], Cell["remember the first and last indices are our end-mers", "Subitem", CellChangeTimes->{{3.855836938481254*^9, 3.855836948939477*^9}, { 3.855837066293992*^9, 3.8558370967838707`*^9}},ExpressionUUID->"88c4ffc5-1b4f-4ebe-844a-\ b0b76a3476fb"], Cell[CellGroupData[{ Cell["and thus we want to check the collision index", "Subitem", CellChangeTimes->{{3.855836938481254*^9, 3.855836948939477*^9}, { 3.855837066293992*^9, 3.855837106291912*^9}},ExpressionUUID->"832ad5b3-ef5a-4344-9d62-\ d3644671cf1e"], Cell[BoxData[ RowBox[{ RowBox[{"returnAllCollisions", "[", RowBox[{"posA_", ",", "posB_"}], "]"}], ":=", RowBox[{"Block", "[", RowBox[{ RowBox[{"{", RowBox[{ "nf", ",", "sorted", ",", "\[IndentingNewLine]", "posShortcoords", ",", "posShortIndices", ",", "\[IndentingNewLine]", "posLongcoords", ",", "posLongIndices", ",", "\[IndentingNewLine]", "cols"}], "}"}], ",", "\[IndentingNewLine]", "\[IndentingNewLine]", RowBox[{ RowBox[{"sorted", "=", RowBox[{"SortBy", "[", RowBox[{ RowBox[{"{", RowBox[{"posA", ",", "posB"}], "}"}], ",", "Length"}], "]"}]}], ";", "\[IndentingNewLine]", RowBox[{"posShortcoords", "=", RowBox[{"sorted", "[", RowBox[{"[", RowBox[{"1", ",", "All", ",", "1"}], "]"}], "]"}]}], ";", RowBox[{"posShortIndices", "=", RowBox[{"sorted", "[", RowBox[{"[", RowBox[{"1", ",", "All", ",", "2"}], "]"}], "]"}]}], ";", "\[IndentingNewLine]", RowBox[{"posLongcoords", "=", RowBox[{"sorted", "[", RowBox[{"[", RowBox[{"2", ",", "All", ",", "1"}], "]"}], "]"}]}], ";", RowBox[{"posLongIndices", "=", RowBox[{"sorted", "[", RowBox[{"[", RowBox[{"2", ",", "All", ",", "2"}], "]"}], "]"}]}], ";", "\[IndentingNewLine]", "\[IndentingNewLine]", RowBox[{"nf", "=", RowBox[{"Nearest", "[", RowBox[{"posLongcoords", "->", RowBox[{"{", RowBox[{"\"\\"", ",", "\"\\""}], "}"}]}], "]"}]}], ";", "\[IndentingNewLine]", "\[IndentingNewLine]", RowBox[{"cols", "=", RowBox[{"Select", "[", RowBox[{ RowBox[{ RowBox[{ RowBox[{"Prepend", "[", RowBox[{ RowBox[{"First", "[", RowBox[{"nf", "[", RowBox[{"posShortcoords", "[", RowBox[{"[", "#", "]"}], "]"}], "]"}], "]"}], ",", "#"}], "]"}], "&"}], "/@", RowBox[{"Range", "[", RowBox[{"Length", "[", "posShortcoords", "]"}], "]"}]}], ",", RowBox[{ RowBox[{ RowBox[{"#", "[", RowBox[{"[", "3", "]"}], "]"}], "<", "1"}], "&"}]}], "]"}]}], ";", "\[IndentingNewLine]", "\[IndentingNewLine]", RowBox[{ RowBox[{ RowBox[{"{", RowBox[{ RowBox[{"posLongIndices", "[", RowBox[{"[", "#2", "]"}], "]"}], ",", RowBox[{"posShortIndices", "[", RowBox[{"[", "#1", "]"}], "]"}], ",", "#3"}], "}"}], "&"}], "@@@", "cols"}]}]}], "\[IndentingNewLine]", "\[IndentingNewLine]", "]"}]}]], "Input", CellChangeTimes->{3.8558371339610147`*^9}, CellLabel-> "In[142]:=",ExpressionUUID->"85125208-995a-4d27-b76e-a242128b3df2"] }, Open ]] }, Open ]], Cell[CellGroupData[{ Cell["In this case, we detect a single collision", "Item", CellChangeTimes->{{3.855837166672331*^9, 3.855837168773814*^9}, { 3.855837271466825*^9, 3.8558372739883137`*^9}, {3.855837314607914*^9, 3.8558373232523727`*^9}},ExpressionUUID->"923b193b-c4d7-46eb-9b05-\ 2d96c186c2b9"], Cell[CellGroupData[{ Cell["Between the 3rd and 9th particle", "Subitem", CellChangeTimes->{{3.855837166672331*^9, 3.855837168773814*^9}, { 3.855837271466825*^9, 3.8558372739883137`*^9}, {3.855837314607914*^9, 3.855837340271969*^9}},ExpressionUUID->"568b5ec7-9914-4d95-ac72-\ 73d84617c57c"], Cell[CellGroupData[{ Cell["\<\ These are both inside the middle of the chain, so no further action needs to \ be taken\ \>", "Subsubitem", CellChangeTimes->{{3.855837166672331*^9, 3.855837168773814*^9}, { 3.855837271466825*^9, 3.8558372739883137`*^9}, {3.855837314607914*^9, 3.8558373553946867`*^9}},ExpressionUUID->"47bda219-913d-4848-9806-\ 9a0ff5a996cc"], Cell[CellGroupData[{ Cell[BoxData[ RowBox[{"Block", "[", RowBox[{ RowBox[{"{", RowBox[{ RowBox[{"posA", "=", "chainPositions"}], ",", RowBox[{"posB", "=", RowBox[{ RowBox[{"TranslationTransform", "[", RowBox[{"{", RowBox[{ RowBox[{"-", "3"}], ",", RowBox[{"-", "3"}]}], "}"}], "]"}], "@", "chainPositions"}]}], ",", "bbA", ",", "bbB", ",", "dm"}], "}"}], ",", "\[IndentingNewLine]", "\[IndentingNewLine]", RowBox[{ RowBox[{"bbA", "=", RowBox[{"axesAlignedBoundingBoxes", "[", "posA", "]"}]}], ";", "\[IndentingNewLine]", RowBox[{"bbB", "=", RowBox[{"axesAlignedBoundingBoxes", "[", "posB", "]"}]}], ";", "\[IndentingNewLine]", "\[IndentingNewLine]", RowBox[{ RowBox[{"{", RowBox[{"posA", ",", "posB"}], "}"}], "=", RowBox[{"returnPointsInOverlap", "[", RowBox[{ RowBox[{"{", RowBox[{"posA", ",", "bbA"}], "}"}], ",", RowBox[{"{", RowBox[{"posB", ",", "bbB"}], "}"}]}], "]"}]}], ";", "\[IndentingNewLine]", "\[IndentingNewLine]", RowBox[{ RowBox[{"returnAllCollisions", "[", RowBox[{"posA", ",", "posB"}], "]"}], "//", "Echo"}], ";", "\[IndentingNewLine]", "\[IndentingNewLine]", RowBox[{"Graphics", "[", RowBox[{"MapThread", "[", RowBox[{"chainGraphic", ",", RowBox[{"{", RowBox[{ RowBox[{"{", RowBox[{ RowBox[{"posA", "[", RowBox[{"[", RowBox[{"All", ",", "1"}], "]"}], "]"}], ",", RowBox[{"posB", "[", RowBox[{"[", RowBox[{"All", ",", "1"}], "]"}], "]"}]}], "}"}], ",", RowBox[{"{", RowBox[{"bbA", ",", "bbB"}], "}"}], ",", RowBox[{"{", RowBox[{"Red", ",", "Blue"}], "}"}]}], "}"}]}], "]"}], "]"}]}]}], "\[IndentingNewLine]", "]"}]], "Input", CellChangeTimes->{{3.855837151295311*^9, 3.855837154821389*^9}, { 3.8558372094472322`*^9, 3.855837212787081*^9}}, CellLabel-> "In[146]:=",ExpressionUUID->"cbed2842-823e-48e7-8f82-30c6f4b696a9"], Cell[BoxData[ RowBox[{"{", RowBox[{"{", RowBox[{"3", ",", "9", ",", "0.9287710168454413`"}], "}"}], "}"}]], "Echo",\ CellChangeTimes->{ 3.855837213176187*^9},ExpressionUUID->"8ebb3d61-72e6-40f1-bd75-\ 00834ed0b81e"], Cell[BoxData[ GraphicsBox[{{ {RGBColor[1, 0, 0], Opacity[0.25], RectangleBox[ NCache[{Rational[-1, 2], -2.390224640128515}, {-0.5, -2.390224640128515}], \ {4.871269615886817, 3.6172468445425503}]}, {EdgeForm[RGBColor[ NCache[ Rational[2, 3], 0.6666666666666666], 0, 0]], FaceForm[None], DiskBox[{0.48789978931200123, -0.8728996480634557}, NCache[ Rational[1, 2], 0.5]], DiskBox[{1.0939566180207008, -1.6683209957626195}, NCache[ Rational[1, 2], 0.5]]}, {EdgeForm[GrayLevel[0]], FaceForm[RGBColor[ NCache[ Rational[2, 3], 0.6666666666666666], 0, 0]], DiskBox[{0, 0}, NCache[Rational[1, 2], 0.5]], DiskBox[{2.083257212377393, -1.8142125102708158}, NCache[ Rational[1, 2], 0.5]]}}, { {RGBColor[0, 0, 1], Opacity[0.25], RectangleBox[{-3.5, -5.390224640128515}, \ {1.871269615886817, 0.6172468445425503}]}, {EdgeForm[RGBColor[0, 0, NCache[ Rational[2, 3], 0.6666666666666666]]], FaceForm[None]}, {EdgeForm[GrayLevel[0]], FaceForm[RGBColor[0, 0, NCache[ Rational[2, 3], 0.6666666666666666]]], DiskBox[{0.3298814397317824, -2.1963406200711035}, NCache[ Rational[1, 2], 0.5]], DiskBox[{-0.48080264920628224, -1.610856796261547}, NCache[ Rational[1, 2], 0.5]]}}}]], "Output", CellChangeTimes->{3.8558371550835037`*^9, 3.855837213230435*^9}, CellLabel-> "Out[146]=",ExpressionUUID->"008426db-2aca-4cb2-9b7a-4f2aa40057d6"] }, Open ]], Cell[BoxData[ RowBox[{ RowBox[{"pairwiseChainCollisions", "[", RowBox[{ RowBox[{"{", RowBox[{"listOfPositions_", ",", "bbs_"}], "}"}], ",", RowBox[{"{", RowBox[{"i_", ",", "j_"}], "}"}]}], "]"}], ":=", RowBox[{"Block", "[", RowBox[{ RowBox[{"{", "\[IndentingNewLine]", RowBox[{ RowBox[{"posA", "=", RowBox[{"listOfPositions", "[", RowBox[{"[", "i", "]"}], "]"}]}], ",", RowBox[{"bbA", "=", RowBox[{"bbs", "[", RowBox[{"[", "i", "]"}], "]"}]}], ",", "\[IndentingNewLine]", RowBox[{"posB", "=", RowBox[{"listOfPositions", "[", RowBox[{"[", "j", "]"}], "]"}]}], ",", RowBox[{"bbB", "=", RowBox[{"bbs", "[", RowBox[{"[", "j", "]"}], "]"}]}]}], "\[IndentingNewLine]", "}"}], ",", "\[IndentingNewLine]", "\[IndentingNewLine]", RowBox[{ RowBox[{ RowBox[{"{", RowBox[{"posA", ",", "posB"}], "}"}], "=", RowBox[{"returnPointsInOverlap", "[", RowBox[{ RowBox[{"{", RowBox[{"posA", ",", "bbA"}], "}"}], ",", RowBox[{"{", RowBox[{"posB", ",", "bbB"}], "}"}]}], "]"}]}], ";", "\[IndentingNewLine]", RowBox[{"If", "[", RowBox[{ RowBox[{ RowBox[{ RowBox[{"Length", "[", "posA", "]"}], "==", "0"}], "||", RowBox[{ RowBox[{"Length", "[", "posB", "]"}], "==", "0"}]}], ",", RowBox[{"{", "}"}], ",", RowBox[{"returnAllCollisions", "[", RowBox[{"posA", ",", "posB"}], "]"}]}], "]"}]}]}], "\[IndentingNewLine]", "]"}]}]], "Input", CellLabel-> "In[151]:=",ExpressionUUID->"76d0096d-213f-4e5b-b266-b32d4cc30fe9"] }, Open ]] }, Open ]] }, Open ]], Cell[CellGroupData[{ Cell["When the collision is between some of the end-mers however,", "Item", CellChangeTimes->{{3.855837357632345*^9, 3.855837377174521*^9}},ExpressionUUID->"f0e1c76f-0b7e-4959-83de-\ efed811ef8bb"], Cell["we wish to join the the two chains", "Subitem", CellChangeTimes->{{3.855837357632345*^9, 3.855837385350245*^9}},ExpressionUUID->"f4acabf0-1fbc-4956-b741-\ 00d00cffd5fc"], Cell[CellGroupData[{ Cell["this will depend on the ordering of the colliding end-mers", "Subitem", CellChangeTimes->{{3.855837357632345*^9, 3.8558374056110563`*^9}},ExpressionUUID->"e8284051-b440-42e9-9f9e-\ 87050a34ffcb"], Cell[CellGroupData[{ Cell["I.e. is it a head-head collision? a head-tail collision etc?", \ "Subsubitem", CellChangeTimes->{{3.855837357632345*^9, 3.8558374173235397`*^9}},ExpressionUUID->"fbd18a60-89e9-41f2-abe1-\ 51cd444bdefc"], Cell[BoxData[ RowBox[{ RowBox[{"compareEndPoints", "[", RowBox[{"listOfPositions_", ",", RowBox[{"{", RowBox[{"i_", ",", "j_"}], "}"}]}], "]"}], ":=", "\[IndentingNewLine]", RowBox[{"Block", "[", RowBox[{ RowBox[{"{", "\[IndentingNewLine]", RowBox[{ RowBox[{"endsI", "=", RowBox[{"listOfPositions", "[", RowBox[{"[", RowBox[{"i", ",", RowBox[{"{", RowBox[{"1", ",", RowBox[{"-", "1"}]}], "}"}]}], "]"}], "]"}]}], ",", "\[IndentingNewLine]", RowBox[{"endsJ", "=", RowBox[{"listOfPositions", "[", RowBox[{"[", RowBox[{"j", ",", RowBox[{"{", RowBox[{"1", ",", RowBox[{"-", "1"}]}], "}"}]}], "]"}], "]"}]}], ",", "\[IndentingNewLine]", "vecs"}], "}"}], ",", "\[IndentingNewLine]", "\[IndentingNewLine]", RowBox[{ RowBox[{"vecs", "=", RowBox[{"Tuples", "[", RowBox[{"{", RowBox[{"endsI", ",", "endsJ"}], "}"}], "]"}]}], ";", "\[IndentingNewLine]", RowBox[{"Thread", "[", RowBox[{ RowBox[{"SquaredEuclideanDistance", "@@@", "vecs"}], "<", "1"}], "]"}]}]}], "\[IndentingNewLine]", "]"}]}]], "Input", CellLabel-> "In[150]:=",ExpressionUUID->"7edf0e3b-43c2-4cc0-b08f-2c44405176bb"], Cell[BoxData[ RowBox[{ RowBox[{"mergeEndPoints", "[", RowBox[{"listOfPositions_", ",", RowBox[{"{", RowBox[{"i_", ",", "j_"}], "}"}], ",", "pairwiseEndPointChecks_"}], "]"}], ":=", RowBox[{"With", "[", RowBox[{ RowBox[{"{", RowBox[{ RowBox[{"posI", "=", RowBox[{"listOfPositions", "[", RowBox[{"[", "i", "]"}], "]"}]}], ",", RowBox[{"posJ", "=", RowBox[{"listOfPositions", "[", RowBox[{"[", "j", "]"}], "]"}]}]}], "}"}], ",", "\[IndentingNewLine]", RowBox[{"Switch", "[", RowBox[{"pairwiseEndPointChecks", ",", "\[IndentingNewLine]", RowBox[{"{", RowBox[{"True", ",", "_", ",", "_", ",", "_"}], "}"}], ",", RowBox[{"ReplacePart", "[", RowBox[{"listOfPositions", ",", RowBox[{"checkProposedMerger", "[", RowBox[{ RowBox[{"{", RowBox[{"i", ",", "j"}], "}"}], ",", RowBox[{"{", RowBox[{ RowBox[{"Reverse", "[", "posI", "]"}], ",", "posJ"}], "}"}]}], "]"}]}], "]"}], ",", "\[IndentingNewLine]", RowBox[{"{", RowBox[{"False", ",", "True", ",", "_", ",", "_"}], "}"}], ",", RowBox[{"ReplacePart", "[", RowBox[{"listOfPositions", ",", RowBox[{"checkProposedMerger", "[", RowBox[{ RowBox[{"{", RowBox[{"i", ",", "j"}], "}"}], ",", RowBox[{"{", RowBox[{"posJ", ",", "posI"}], "}"}]}], "]"}]}], "]"}], ",", "\[IndentingNewLine]", RowBox[{"{", RowBox[{"False", ",", "False", ",", "True", ",", "_"}], "}"}], ",", RowBox[{"ReplacePart", "[", RowBox[{"listOfPositions", ",", RowBox[{"checkProposedMerger", "[", RowBox[{ RowBox[{"{", RowBox[{"i", ",", "j"}], "}"}], ",", RowBox[{"{", RowBox[{"posI", ",", "posJ"}], "}"}]}], "]"}]}], "]"}], ",", "\[IndentingNewLine]", RowBox[{"{", RowBox[{"False", ",", "False", ",", "False", ",", "True"}], "}"}], ",", RowBox[{"ReplacePart", "[", RowBox[{"listOfPositions", ",", RowBox[{"checkProposedMerger", "[", RowBox[{ RowBox[{"{", RowBox[{"i", ",", "j"}], "}"}], ",", RowBox[{"{", RowBox[{"posI", ",", RowBox[{"Reverse", "[", "posJ", "]"}]}], "}"}]}], "]"}]}], "]"}], ",", "\[IndentingNewLine]", "_", ",", "listOfPositions"}], "\[IndentingNewLine]", "]"}]}], "\[IndentingNewLine]", "]"}]}]], "Input",\ CellLabel-> "In[147]:=",ExpressionUUID->"ec85910b-313c-43bf-b7bb-6f93a68396c0"], Cell[BoxData[ RowBox[{ RowBox[{"checkProposedMerger", "[", RowBox[{ RowBox[{"{", RowBox[{"i_", ",", "j_"}], "}"}], ",", RowBox[{"{", RowBox[{"posI_", ",", "posJ_"}], "}"}]}], "]"}], ":=", "\[IndentingNewLine]", RowBox[{"With", "[", RowBox[{ RowBox[{"{", RowBox[{"proposal", "=", RowBox[{"Join", "[", RowBox[{"posI", ",", "posJ"}], "]"}]}], "}"}], ",", "\[IndentingNewLine]", RowBox[{"If", "[", RowBox[{ RowBox[{"collisionFreeFurtherQ", "[", "proposal", "]"}], ",", RowBox[{ RowBox[{"{", RowBox[{ RowBox[{"{", "i", "}"}], ",", RowBox[{"{", "j", "}"}]}], "}"}], "->", "proposal"}], ",", RowBox[{ RowBox[{"Echo", "[", "\"\\"", "]"}], ";", RowBox[{"{", "}"}]}]}], "]"}]}], "\[IndentingNewLine]", "]"}]}]], "Input", CellLabel-> "In[148]:=",ExpressionUUID->"5b1ccc6d-0329-48ba-9fc6-494dd466a313"], Cell[BoxData[ RowBox[{ RowBox[{"collisionFreeFurtherQ", "[", "positions_", "]"}], ":=", RowBox[{"With", "[", RowBox[{ RowBox[{"{", RowBox[{ RowBox[{"nf", "=", RowBox[{"Nearest", "[", RowBox[{"positions", "->", "All"}], "]"}]}], ",", RowBox[{"l", "=", RowBox[{"Length", "[", "positions", "]"}]}]}], "}"}], ",", "\[IndentingNewLine]", RowBox[{ RowBox[{"Length", "[", RowBox[{"Join", "@@", RowBox[{"Table", "[", RowBox[{ RowBox[{"Select", "[", RowBox[{ RowBox[{"nf", "[", RowBox[{ RowBox[{"positions", "[", RowBox[{"[", "i", "]"}], "]"}], ",", RowBox[{"{", RowBox[{"All", ",", "1"}], "}"}]}], "]"}], ",", RowBox[{ RowBox[{ RowBox[{"Abs", "[", RowBox[{"#Index", "-", "i"}], "]"}], ">", "1"}], "&"}]}], "]"}], ",", RowBox[{"{", RowBox[{"i", ",", "l"}], "}"}]}], "]"}]}], "]"}], "==", "0"}]}], "]"}]}]], "Input", CellLabel-> "In[149]:=",ExpressionUUID->"8f67c13b-dad3-4b95-8b02-0828e9d1a8a8"] }, Open ]] }, Open ]] }, Open ]], Cell[CellGroupData[{ Cell["Let\[CloseCurlyQuote]s wrap everything together", "Item", CellChangeTimes->{{3.855837458894021*^9, 3.855837463543749*^9}, 3.855837505926037*^9},ExpressionUUID->"86585871-96e2-4fbd-b12d-\ 15fd1133fea6"], Cell[BoxData[ RowBox[{ RowBox[{"checkForCollisions", "[", RowBox[{"{", RowBox[{"listOfPositions_", ",", "oldListOfPositions_"}], "}"}], "]"}], ":=", RowBox[{"Catch", "[", "\[IndentingNewLine]", RowBox[{"Block", "[", RowBox[{ RowBox[{"{", "\[IndentingNewLine]", RowBox[{ RowBox[{"listOfPos", "=", "listOfPositions"}], ",", "\[IndentingNewLine]", RowBox[{"bbs", "=", RowBox[{"axesAlignedBoundingBoxes", "/@", "listOfPositions"}]}], ",", "\[IndentingNewLine]", "mij", ",", "nonzero", ",", "collisions", ",", "collisionIndices", ",", "endpointChecks", ",", "lengths"}], "}"}], ",", "\[IndentingNewLine]", "\[IndentingNewLine]", RowBox[{ RowBox[{"mij", "=", RowBox[{"connectivityMatrix", "[", "bbs", "]"}]}], ";", "\[IndentingNewLine]", RowBox[{"If", "[", RowBox[{ RowBox[{ RowBox[{"mij", "[", "\"\\"", "]"}], "==", "0"}], ",", RowBox[{ RowBox[{"Echo", "[", "\"\\"", "]"}], ";", RowBox[{"Return", "[", "listOfPos", "]"}]}]}], "]"}], ";", "\[IndentingNewLine]", "\[IndentingNewLine]", RowBox[{"nonzero", "=", RowBox[{"mij", "[", "\"\\"", "]"}]}], ";", "\[IndentingNewLine]", RowBox[{"collisions", "=", RowBox[{ RowBox[{ RowBox[{"pairwiseChainCollisions", "[", RowBox[{ RowBox[{"{", RowBox[{"listOfPos", ",", "bbs"}], "}"}], ",", "#"}], "]"}], "&"}], "/@", "nonzero"}]}], ";", "\[IndentingNewLine]", RowBox[{"If", "[", RowBox[{ RowBox[{ RowBox[{"Length", "[", RowBox[{"Join", "@@", "collisions"}], "]"}], "==", "0"}], ",", RowBox[{ RowBox[{"Echo", "[", "\"\\"", "]"}], ";", RowBox[{"Return", "[", "listOfPos", "]"}]}]}], "]"}], ";", "\[IndentingNewLine]", "\[IndentingNewLine]", RowBox[{"lengths", "=", RowBox[{ RowBox[{ RowBox[{"Sort", "[", RowBox[{"Length", "/@", RowBox[{"Extract", "[", RowBox[{"listOfPos", ",", RowBox[{"List", "/@", "#"}]}], "]"}]}], "]"}], "&"}], "/@", "nonzero"}]}], ";", "\[IndentingNewLine]", "\[IndentingNewLine]", RowBox[{"Do", "[", "\[IndentingNewLine]", RowBox[{ RowBox[{"If", "[", "\[IndentingNewLine]", RowBox[{ RowBox[{ RowBox[{ RowBox[{"Length", "[", RowBox[{"collisions", "[", RowBox[{"[", "a", "]"}], "]"}], "]"}], ">", "0"}], "&&", "\[IndentingNewLine]", RowBox[{"(", RowBox[{ RowBox[{"1", "<", RowBox[{"collisions", "[", RowBox[{"[", RowBox[{"a", ",", "j", ",", "1"}], "]"}], "]"}], "<", RowBox[{"lengths", "[", RowBox[{"[", RowBox[{"a", ",", "1"}], "]"}], "]"}]}], "||", "\[IndentingNewLine]", RowBox[{"1", "<", RowBox[{"collisions", "[", RowBox[{"[", RowBox[{"a", ",", "j", ",", "2"}], "]"}], "]"}], "<", RowBox[{"lengths", "[", RowBox[{"[", RowBox[{"a", ",", "2"}], "]"}], "]"}]}]}], ")"}]}], ",", "\[IndentingNewLine]", RowBox[{ RowBox[{"Echo", "[", "\"\\"", "]"}], ";", RowBox[{"Throw", "[", "oldListOfPositions", "]"}]}]}], "]"}], ",", RowBox[{"{", RowBox[{"a", ",", RowBox[{"Length", "[", "collisions", "]"}]}], "}"}], ",", RowBox[{"{", RowBox[{"j", ",", RowBox[{"Length", "[", RowBox[{"collisions", "[", RowBox[{"[", "a", "]"}], "]"}], "]"}]}], "}"}]}], "]"}], ";", "\[IndentingNewLine]", "\[IndentingNewLine]", RowBox[{"collisionIndices", "=", " ", RowBox[{"Extract", "[", RowBox[{"nonzero", ",", RowBox[{"Position", "[", RowBox[{"collisions", ",", RowBox[{"Except", "[", RowBox[{"{", "}"}], "]"}], ",", "1", ",", RowBox[{"Heads", "\[Rule]", "False"}]}], "]"}]}], "]"}]}], ";", "\[IndentingNewLine]", RowBox[{"endpointChecks", "=", RowBox[{ RowBox[{ RowBox[{"compareEndPoints", "[", RowBox[{"listOfPos", ",", "#"}], "]"}], "&"}], "/@", "collisionIndices"}]}], ";", "\[IndentingNewLine]", RowBox[{"If", "[", RowBox[{ RowBox[{"Nor", "@@", RowBox[{"Flatten", "[", "endpointChecks", "]"}]}], ",", RowBox[{ RowBox[{"Echo", "[", "\"\\"", "]"}], ";", RowBox[{"Return", "[", "oldListOfPositions", "]"}]}]}], "]"}], ";", "\[IndentingNewLine]", "\[IndentingNewLine]", RowBox[{"Do", "[", "\[IndentingNewLine]", RowBox[{ RowBox[{"listOfPos", "=", RowBox[{"mergeEndPoints", "[", RowBox[{"listOfPos", ",", RowBox[{"collisionIndices", "[", RowBox[{"[", "a", "]"}], "]"}], ",", RowBox[{"endpointChecks", "[", RowBox[{"[", "a", "]"}], "]"}]}], "]"}]}], ",", "\[IndentingNewLine]", RowBox[{"{", RowBox[{"a", ",", RowBox[{"Length", "[", "collisionIndices", "]"}]}], "}"}]}], "\[IndentingNewLine]", "]"}], ";", "\[IndentingNewLine]", "\[IndentingNewLine]", RowBox[{"DeleteDuplicates", "[", "listOfPos", "]"}]}]}], "\[IndentingNewLine]", "\[IndentingNewLine]", "]"}], "\[IndentingNewLine]", "]"}]}]], "Input", CellChangeTimes->{{3.8558374918497066`*^9, 3.855837492963591*^9}}, CellLabel-> "In[152]:=",ExpressionUUID->"6a4046d1-7c41-4089-b2dc-d14686f24550"], Cell[BoxData[ RowBox[{ RowBox[{"moveAllChains", "[", RowBox[{"listOfPositions_", ",", "ds_"}], "]"}], ":=", " ", RowBox[{"Block", "[", RowBox[{ RowBox[{"{", RowBox[{"listOfPos", "=", "listOfPositions"}], "}"}], ",", "\[IndentingNewLine]", RowBox[{ RowBox[{"listOfPos", "=", RowBox[{ RowBox[{ RowBox[{"moveSingleChain", "[", RowBox[{"#", ",", "ds"}], "]"}], "&"}], "/@", "listOfPos"}]}], ";", "\[IndentingNewLine]", RowBox[{"checkForCollisions", "[", RowBox[{"{", RowBox[{"listOfPos", ",", "listOfPositions"}], "}"}], "]"}]}]}], "\[IndentingNewLine]", "]"}]}]], "Input", CellLabel-> "In[153]:=",ExpressionUUID->"df89f259-d83d-4a40-940c-e215d6e026ee"], Cell[BoxData[ RowBox[{"\[IndentingNewLine]", RowBox[{ RowBox[{ RowBox[{"listOfPositions", "=", RowBox[{"amorphousPackedDimers", "[", "35", "]"}]}], ";"}], "\[IndentingNewLine]", RowBox[{"Dynamic", "[", RowBox[{"Graphics", "[", RowBox[{"chainGraphic", "/@", "listOfPositions"}], "]"}], "]"}]}]}]], "Input", CellChangeTimes->{{3.85558287683211*^9, 3.855582877958933*^9}, { 3.8555891391149883`*^9, 3.855589140194976*^9}, {3.855594743961315*^9, 3.85559474422331*^9}, 3.855689987431669*^9, {3.85583755353592*^9, 3.85583758297364*^9}}, CellLabel-> "In[165]:=",ExpressionUUID->"a04c293b-81f0-4b6f-b3ac-ef0d3968008e"], Cell[CellGroupData[{ Cell[BoxData[ RowBox[{"QuietEcho", "[", "\[IndentingNewLine]", RowBox[{"Do", "[", "\[IndentingNewLine]", RowBox[{ RowBox[{"listOfPositions", "=", RowBox[{"moveAllChains", "[", RowBox[{"listOfPositions", ",", ".1"}], "]"}]}], ",", "\[IndentingNewLine]", RowBox[{"{", "5000", "}"}]}], "]"}], "\[IndentingNewLine]", "]"}]], "Input", CellChangeTimes->{{3.8556865659252653`*^9, 3.855686580354068*^9}, { 3.855686703786871*^9, 3.855686705949273*^9}, 3.855686763833805*^9, { 3.8556868118311234`*^9, 3.85568681339431*^9}, 3.855687063641838*^9, { 3.855687197540307*^9, 3.855687197740484*^9}, {3.855688658520664*^9, 3.855688669913681*^9}, {3.855688701818617*^9, 3.8556887020259237`*^9}, 3.855688984196167*^9, {3.85568991666103*^9, 3.855689916756907*^9}, { 3.855689984422336*^9, 3.8556899940218773`*^9}, {3.855837598128038*^9, 3.8558376015511303`*^9}}, CellLabel-> "In[167]:=",ExpressionUUID->"1bcef39a-c036-4de0-8cd1-1e94dd57b95e"], Cell[BoxData["$Aborted"], "Output", CellChangeTimes->{ 3.8558375379114437`*^9, {3.8558375805230703`*^9, 3.855837619377181*^9}}, CellLabel-> "Out[167]=",ExpressionUUID->"9ba63b8d-d1e1-41a5-aa76-8899be98ed60"] }, Open ]] }, Open ]] }, Open ]] }, Open ]] }, WindowSize->{1440., 760.5}, WindowMargins->{{0, Automatic}, {0, Automatic}}, PrivateNotebookOptions->{"CloudPublishPath"->"/Published/3029-SP22__L12__step-\ growth-polymerization__03-09-22.nb"}, FrontEndVersion->"13.0 for Linux x86 (64-bit) (December 2, 2021)", StyleDefinitions->"Default.nb", ExpressionUUID->"6cd18f76-268d-4785-a426-59298d07678c" ] (* End of Notebook Content *) (* Internal cache information *) (*CellTagsOutline CellTagsIndex->{} *) (*CellTagsIndex CellTagsIndex->{} *) (*NotebookFileOutline Notebook[{ Cell[558, 20, 731, 10, 85, "Subtitle",ExpressionUUID->"8cd89a4f-888e-49d6-af41-08fc627c7586"], Cell[CellGroupData[{ Cell[1314, 34, 666, 10, 69, "Chapter",ExpressionUUID->"0aa512c8-6ce6-4b68-b5a8-ebba3c8ce8ba"], Cell[1983, 46, 489, 9, 32, "Item",ExpressionUUID->"440c792d-4e3a-4a46-9d39-10952589f5f9"], Cell[CellGroupData[{ Cell[2497, 59, 496, 9, 32, "Item",ExpressionUUID->"ba26455e-7b7c-4c69-82e7-dee008a05c68"], Cell[2996, 70, 469, 7, 26, "Subitem",ExpressionUUID->"b6df0067-b72a-43f4-bf79-71ac35a20630"] }, Open ]], Cell[CellGroupData[{ Cell[3502, 82, 202, 3, 68, "Section",ExpressionUUID->"8ff8456e-b91d-4061-acac-e2713497b22d"], Cell[CellGroupData[{ Cell[3729, 89, 174, 3, 32, "Item",ExpressionUUID->"91390901-108a-49ba-9087-66db16b94f4d"], Cell[3906, 94, 5811, 154, 850, "Input",ExpressionUUID->"9e0f6798-598e-45db-b21b-32856260f645", InitializationCell->True] }, Open ]], Cell[CellGroupData[{ Cell[9754, 253, 162, 3, 32, "Item",ExpressionUUID->"566c8c01-5be6-43aa-998a-10afd04493f8"], Cell[9919, 258, 6007, 154, 839, "Input",ExpressionUUID->"1ca885f6-05f9-4323-a78d-596b6e1d6d69", InitializationCell->True] }, Open ]] }, Closed]], Cell[CellGroupData[{ Cell[15975, 418, 172, 3, 54, "Section",ExpressionUUID->"ea09dac9-d04e-4d33-be26-5b350b9e91f8"], Cell[16150, 423, 261, 6, 32, "Item",ExpressionUUID->"a0e04359-7c71-47bf-aa37-15aaaf54772f"], Cell[CellGroupData[{ Cell[16436, 433, 196, 3, 32, "Item",ExpressionUUID->"2b2fb7bc-5963-49dc-83e8-0f731ca1d854"], Cell[16635, 438, 192, 3, 26, "Subitem",ExpressionUUID->"9e942319-462b-4278-877e-705e83898520"] }, Open ]], Cell[CellGroupData[{ Cell[16864, 446, 241, 6, 32, "Item",ExpressionUUID->"a583feb0-8b38-4f4d-8a3d-478df4e078eb"], Cell[CellGroupData[{ Cell[17130, 456, 229, 5, 26, "Subitem",ExpressionUUID->"e4f2fe33-25b4-4b63-823a-3557949bb47a"], Cell[17362, 463, 343, 8, 51, "Input",ExpressionUUID->"acbfff2a-0477-4578-aa4e-0ce48c1ee7c0"] }, Open ]] }, Open ]], Cell[CellGroupData[{ Cell[17754, 477, 236, 6, 32, "Item",ExpressionUUID->"7047e99b-06ce-4c41-812a-5b23aec2a707"], Cell[17993, 485, 1506, 46, 71, "Input",ExpressionUUID->"04ec7c6a-9b8e-4579-9622-3627f11fe54f"] }, Open ]], Cell[CellGroupData[{ Cell[19536, 536, 261, 6, 32, "Item",ExpressionUUID->"3a49b3bd-faf1-458e-bcef-6e30088c63b7"], Cell[19800, 544, 1565, 45, 118, "Input",ExpressionUUID->"f4caa316-f75c-496e-a21a-17a040e0c7b7"] }, Open ]], Cell[CellGroupData[{ Cell[21402, 594, 193, 3, 32, "Item",ExpressionUUID->"1855f680-f530-4e01-8782-afd3bec5bb89"], Cell[CellGroupData[{ Cell[21620, 601, 223, 5, 26, "Subitem",ExpressionUUID->"a72bd60d-baf9-41b4-970e-3e2219494f51"], Cell[CellGroupData[{ Cell[21868, 610, 203, 3, 25, "Subsubitem",ExpressionUUID->"7c04d40c-487b-4251-a38e-b2624af4c85f"], Cell[CellGroupData[{ Cell[22096, 617, 1624, 41, 216, "Input",ExpressionUUID->"8fd92479-5013-455b-b640-111414418aee"], Cell[23723, 660, 131, 3, 26, "Echo",ExpressionUUID->"ec417752-090e-4128-887d-140a3f69655a"], Cell[23857, 665, 3196, 70, 402, "Output",ExpressionUUID->"1479bdde-589f-4968-9290-a998f0c1a274"] }, Open ]] }, Open ]] }, Open ]] }, Open ]], Cell[27104, 741, 200, 3, 32, "Item",ExpressionUUID->"1f28364c-b8ac-4085-99a0-9b75f129797c"], Cell[CellGroupData[{ Cell[27329, 748, 266, 6, 32, "Item",ExpressionUUID->"497eda49-07d2-4274-816b-8cfcd926d737"], Cell[27598, 756, 2314, 67, 154, "Input",ExpressionUUID->"60465d11-11a6-482d-b331-54f05e4102b5"], Cell[CellGroupData[{ Cell[29937, 827, 1695, 46, 216, "Input",ExpressionUUID->"73124b3d-1bab-45d7-baba-a69e8e6a53c9"], Cell[31635, 875, 1589, 37, 402, "Output",ExpressionUUID->"c03e9a89-0708-4e1e-ba0a-9af7e3d868db"] }, Open ]] }, Open ]], Cell[CellGroupData[{ Cell[33273, 918, 215, 5, 32, "Item",ExpressionUUID->"936735af-6724-47aa-9d5b-623214450c69"], Cell[CellGroupData[{ Cell[33513, 927, 235, 6, 26, "Subitem",ExpressionUUID->"611beb46-3ba2-457f-acac-05a22fd158f9"], Cell[33751, 935, 203, 3, 25, "Subsubitem",ExpressionUUID->"c33ebb0d-86fa-4aac-9c45-bac46adf41f3"], Cell[33957, 940, 272, 6, 25, "Subsubitem",ExpressionUUID->"60d7a17b-e473-4ae8-abca-813cfbc6c596"] }, Open ]] }, Open ]], Cell[CellGroupData[{ Cell[34278, 952, 460, 8, 32, "Item",ExpressionUUID->"ca0db60b-396d-42c9-97b1-8d1d96d90f53"], Cell[CellGroupData[{ Cell[34763, 964, 1748, 44, 298, "Input",ExpressionUUID->"5fdecfe3-d897-4e56-9b3f-0c75686f479c"], Cell[36514, 1010, 759, 20, 72, "Echo",ExpressionUUID->"4b57c809-9116-4718-b02c-bfc279823ccc"], Cell[37276, 1032, 254, 4, 33, "Output",ExpressionUUID->"b44c51cd-2b59-49d7-bc23-7cf5a3066046"] }, Open ]], Cell[37545, 1039, 273, 6, 26, "Subitem",ExpressionUUID->"94dd0bd9-e2da-47b8-a0b3-dfda407c305b"], Cell[CellGroupData[{ Cell[37843, 1049, 262, 6, 26, "Subitem",ExpressionUUID->"3a43faf3-8526-4cab-89e0-7650df7be834"], Cell[38108, 1057, 1182, 32, 154, "Input",ExpressionUUID->"c146544c-766d-4952-94e0-f28fd27ae216"], Cell[CellGroupData[{ Cell[39315, 1093, 1441, 38, 216, "Input",ExpressionUUID->"141ea027-39a2-4b32-b489-36626168a62f"], Cell[40759, 1133, 252, 4, 33, "Output",ExpressionUUID->"73407f88-176d-4ba0-bbf7-d9746c1ef761"] }, Open ]] }, Open ]] }, Open ]], Cell[CellGroupData[{ Cell[41072, 1144, 242, 6, 32, "Item",ExpressionUUID->"42527b47-e773-4f9d-8184-3a4eddef17bf"], Cell[CellGroupData[{ Cell[41339, 1154, 257, 6, 26, "Subitem",ExpressionUUID->"4cf79c90-bdcd-44b7-a51e-26e6da2ef7df"], Cell[CellGroupData[{ Cell[41621, 1164, 219, 5, 29, "Input",ExpressionUUID->"ed9731bc-68fa-4dce-ae18-2c0ad7d93d1f"], Cell[41843, 1171, 1059, 34, 33, "Output",ExpressionUUID->"5472f8b3-9e8b-44fe-bbcf-1c00ec755773"] }, Open ]], Cell[CellGroupData[{ Cell[42939, 1210, 396, 9, 29, "Input",ExpressionUUID->"ff6e7c2a-ffca-43aa-9079-f82b9fe78bd7"], Cell[43338, 1221, 1004, 27, 113, "Output",ExpressionUUID->"682b392b-bf7f-40a4-9b91-133a1ee4bbe3"] }, Open ]] }, Open ]], Cell[CellGroupData[{ Cell[44391, 1254, 184, 3, 26, "Subitem",ExpressionUUID->"f1ff8df9-2a3a-4577-8ac5-47f164af11af"], Cell[44578, 1259, 1616, 46, 154, "Input",ExpressionUUID->"411b4aa5-e580-4550-b144-3d7bccb52a3a"], Cell[CellGroupData[{ Cell[46219, 1309, 1583, 43, 154, "Input",ExpressionUUID->"a3d5bc92-a40f-425e-9f07-8e0c6e9e50ba"], Cell[47805, 1354, 819, 25, 72, "Echo",ExpressionUUID->"e59e7864-1a0b-466b-92d0-d8f728115db6"], Cell[48627, 1381, 32115, 609, 449, "Output",ExpressionUUID->"ab3d78da-c32d-47d7-8088-f9df74f70890"] }, Open ]] }, Open ]] }, Open ]], Cell[CellGroupData[{ Cell[80803, 1997, 166, 3, 32, "Item",ExpressionUUID->"f13dd67f-a4d0-4811-8654-f2de7b2fe078"], Cell[80972, 2002, 3665, 98, 525, "Input",ExpressionUUID->"e51b1b8c-3a3b-4938-b29a-5da4e64aa9d8"], Cell[84640, 2102, 403, 10, 29, "Input",ExpressionUUID->"f7c761a7-fef4-4ddd-b5b9-e3d8a51b0e38"], Cell[CellGroupData[{ Cell[85068, 2116, 642, 15, 113, "Input",ExpressionUUID->"6836538a-5c2f-4520-95da-202a4d41038f"], Cell[85713, 2133, 182, 3, 33, "Output",ExpressionUUID->"87425d12-0dea-46a8-93af-4bc80e60b64c"] }, Open ]] }, Open ]] }, Open ]], Cell[CellGroupData[{ Cell[85956, 2143, 222, 4, 68, "Section",ExpressionUUID->"d6abc337-7ebd-4edb-bb6a-abf80e7632d1"], Cell[86181, 2149, 204, 3, 32, "Item",ExpressionUUID->"d7224a08-2a94-4044-acc5-bf55ec859836"], Cell[86388, 2154, 260, 6, 32, "Item",ExpressionUUID->"0b3148fc-7513-4a4e-8d05-4b4050a56c87"], Cell[CellGroupData[{ Cell[86673, 2164, 172, 3, 32, "Item",ExpressionUUID->"76de842a-f7c8-4cdf-9a7c-e079c5238b6c"], Cell[86848, 2169, 235, 5, 26, "Subitem",ExpressionUUID->"dd00e31e-a372-4123-b74c-7bb687978e29"], Cell[87086, 2176, 305, 7, 26, "Subitem",ExpressionUUID->"c6d51e7d-1cfd-416c-a3a0-2bb8f39168c0"] }, Open ]], Cell[CellGroupData[{ Cell[87428, 2188, 217, 4, 32, "Item",ExpressionUUID->"00dfbd39-0d3e-485e-a241-a66e91a6a296"], Cell[CellGroupData[{ Cell[87670, 2196, 178, 3, 26, "Subitem",ExpressionUUID->"e5a9e3ad-e09e-4d65-ab44-a0267bcabb86"], Cell[CellGroupData[{ Cell[87873, 2203, 224, 5, 25, "Subsubitem",ExpressionUUID->"5ed1bda1-9dfe-4557-99de-9b4941c16584"], Cell[CellGroupData[{ Cell[88122, 2212, 983, 29, 71, "Input",ExpressionUUID->"86c2f9ba-870e-4969-a23c-8af8691108b4"], Cell[89108, 2243, 2829, 47, 230, "Output",ExpressionUUID->"194cadad-4fb1-410e-ac82-680208898ff1"] }, Open ]] }, Open ]], Cell[CellGroupData[{ Cell[91986, 2296, 224, 5, 25, "Subsubitem",ExpressionUUID->"40cac478-584f-4d7e-a2f3-f260e656ca01"], Cell[92213, 2303, 468, 12, 29, "Input",ExpressionUUID->"9ceb6e5c-40b7-48f7-8082-94db1542a34a"], Cell[92684, 2317, 1944, 52, 200, "Input",ExpressionUUID->"5c3a6514-8f78-475d-a30a-b58d108afccc"], Cell[CellGroupData[{ Cell[94653, 2373, 354, 8, 29, "Input",ExpressionUUID->"63a1f954-7cd4-407c-ae8f-db6a07d4e334"], Cell[95010, 2383, 10494, 197, 388, "Output",ExpressionUUID->"7c3263d2-95ee-4717-b9f0-d705b3851384"] }, Open ]] }, Open ]] }, Open ]] }, Open ]], Cell[CellGroupData[{ Cell[105577, 2588, 243, 6, 32, "Item",ExpressionUUID->"9693eb67-c146-49f1-be12-7f9eafbb0eab"], Cell[105823, 2596, 1305, 34, 139, "Input",ExpressionUUID->"27581ba5-fd09-4960-a004-ea8696264e5d"], Cell[CellGroupData[{ Cell[107153, 2634, 270, 6, 29, "Input",ExpressionUUID->"334f8f1a-8e3d-4995-aa95-b15dfe6d9f6b"], Cell[107426, 2642, 6443, 130, 362, "Output",ExpressionUUID->"23f85698-d414-42d9-ae03-537417aede86"] }, Open ]] }, Open ]], Cell[CellGroupData[{ Cell[113918, 2778, 281, 6, 32, "Item",ExpressionUUID->"80d343d7-bdd0-4412-bee0-2b3f696c327f"], Cell[114202, 2786, 2445, 72, 154, "Input",ExpressionUUID->"19e18cf2-5f1e-4114-8dc1-9269bedbef6e"], Cell[CellGroupData[{ Cell[116672, 2862, 2128, 56, 278, "Input",ExpressionUUID->"16a68645-974b-4d67-b972-4e84163f1608"], Cell[CellGroupData[{ Cell[118825, 2922, 789, 27, 26, "Echo",ExpressionUUID->"9a8e4d1b-b5fd-4266-b7b7-bba749f4315b"], Cell[119617, 2951, 526, 18, 26, "Echo",ExpressionUUID->"3fd21d2e-9472-49d5-9cd6-632871a181c1"] }, Open ]], Cell[120158, 2972, 1494, 35, 402, "Output",ExpressionUUID->"75adf91f-b1b7-4d62-96b8-8878a703c843"] }, Open ]] }, Open ]], Cell[CellGroupData[{ Cell[121701, 3013, 280, 7, 32, "Item",ExpressionUUID->"d1a575aa-d9ec-4dcb-863c-8dca16b89bad"], Cell[121984, 3022, 248, 4, 26, "Subitem",ExpressionUUID->"88c4ffc5-1b4f-4ebe-844a-b0b76a3476fb"], Cell[CellGroupData[{ Cell[122257, 3030, 239, 4, 26, "Subitem",ExpressionUUID->"832ad5b3-ef5a-4344-9d62-d3644671cf1e"], Cell[122499, 3036, 2810, 74, 339, "Input",ExpressionUUID->"85125208-995a-4d27-b76e-a242128b3df2"] }, Open ]] }, Open ]], Cell[CellGroupData[{ Cell[125358, 3116, 283, 4, 32, "Item",ExpressionUUID->"923b193b-c4d7-46eb-9b05-2d96c186c2b9"], Cell[CellGroupData[{ Cell[125666, 3124, 274, 4, 26, "Subitem",ExpressionUUID->"568b5ec7-9914-4d95-ac72-73d84617c57c"], Cell[CellGroupData[{ Cell[125965, 3132, 342, 7, 25, "Subsubitem",ExpressionUUID->"47bda219-913d-4848-9806-9a0ff5a996cc"], Cell[CellGroupData[{ Cell[126332, 3143, 2112, 57, 236, "Input",ExpressionUUID->"cbed2842-823e-48e7-8f82-30c6f4b696a9"], Cell[128447, 3202, 227, 7, 26, "Echo",ExpressionUUID->"8ebb3d61-72e6-40f1-bd75-00834ed0b81e"], Cell[128677, 3211, 1492, 35, 402, "Output",ExpressionUUID->"008426db-2aca-4cb2-9b7a-4f2aa40057d6"] }, Open ]], Cell[130184, 3249, 1703, 48, 174, "Input",ExpressionUUID->"76d0096d-213f-4e5b-b266-b32d4cc30fe9"] }, Open ]] }, Open ]] }, Open ]], Cell[CellGroupData[{ Cell[131948, 3304, 201, 3, 32, "Item",ExpressionUUID->"f0e1c76f-0b7e-4959-83de-efed811ef8bb"], Cell[132152, 3309, 179, 3, 26, "Subitem",ExpressionUUID->"f4acabf0-1fbc-4956-b741-00d00cffd5fc"], Cell[CellGroupData[{ Cell[132356, 3316, 205, 3, 26, "Subitem",ExpressionUUID->"e8284051-b440-42e9-9f9e-87050a34ffcb"], Cell[CellGroupData[{ Cell[132586, 3323, 212, 4, 25, "Subsubitem",ExpressionUUID->"fbd18a60-89e9-41f2-abe1-51cd444bdefc"], Cell[132801, 3329, 1335, 38, 195, "Input",ExpressionUUID->"7edf0e3b-43c2-4cc0-b08f-2c44405176bb"], Cell[134139, 3369, 2645, 68, 195, "Input",ExpressionUUID->"ec85910b-313c-43bf-b7bb-6f93a68396c0"], Cell[136787, 3439, 968, 29, 92, "Input",ExpressionUUID->"5b1ccc6d-0329-48ba-9fc6-494dd466a313"], Cell[137758, 3470, 1174, 35, 51, "Input",ExpressionUUID->"8f67c13b-dad3-4b95-8b02-0828e9d1a8a8"] }, Open ]] }, Open ]] }, Open ]], Cell[CellGroupData[{ Cell[138993, 3512, 212, 3, 32, "Item",ExpressionUUID->"86585871-96e2-4fbd-b12d-15fd1133fea6"], Cell[139208, 3517, 5968, 145, 731, "Input",ExpressionUUID->"6a4046d1-7c41-4089-b2dc-d14686f24550"], Cell[145179, 3664, 754, 21, 92, "Input",ExpressionUUID->"df89f259-d83d-4a40-940c-e215d6e026ee"], Cell[145936, 3687, 665, 16, 71, "Input",ExpressionUUID->"a04c293b-81f0-4b6f-b3ac-ef0d3968008e"], Cell[CellGroupData[{ Cell[146626, 3707, 986, 19, 113, "Input",ExpressionUUID->"1bcef39a-c036-4de0-8cd1-1e94dd57b95e"], Cell[147615, 3728, 213, 4, 33, "Output",ExpressionUUID->"9ba63b8d-d1e1-41a5-aa76-8899be98ed60"] }, Open ]] }, Open ]] }, Open ]] }, Open ]] } ] *)