Work : fonction creation chaine de n H lineaire

This commit is contained in:
Yann Damour 2020-05-07 21:07:04 +02:00
parent 514ea607e2
commit 008f439667

View File

@ -176,7 +176,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"### $H_2$"
"### H$_4$"
]
},
{
@ -185,6 +185,7 @@
"metadata": {},
"outputs": [],
"source": [
"(*\n",
"let xyz_string = \n",
"\"4\n",
"H4\n",
@ -192,7 +193,34 @@
"H 1.8 0. 0.\n",
"H 3.6 0. 0.\n",
"H 5.4 0. 0.\n",
"\""
"\"\n",
"*)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"(* Fonction création chaîne de n H *)\n",
"\n",
"let xyz n = \n",
" let accu = \"\"\n",
" in\n",
" let rec toto accu n =\n",
" let accu = \n",
" if n=0 \n",
" then accu ^ \"\"\n",
" else\n",
" match n with \n",
" | 1 -> \"H\" ^ \" \" ^ string_of_float(1.8 *. float_of_int(n)) ^ \" 0. 0.\\n\" ^ accu\n",
" | x -> toto (\"H\" ^ \" \" ^ string_of_float(1.8 *. float_of_int(n)) ^ \" 0. 0.\\n\" ^ accu ) (n-1)\n",
" in\n",
" accu\n",
" in string_of_int(n) ^ \"\\nH\" ^ string_of_int(n) ^ \"\\n\" ^ toto accu n;;\n",
" \n",
"let xyz_string = xyz 4;;"
]
},
{
@ -1837,7 +1865,7 @@
"outputs": [],
"source": [
"(* Localisation de Edminstion *)\n",
"\n",
"let n_rec_alpha = 10;;\n",
"(* Calcul de la nouvelle matrice des coefficient après n rotation d'orbitales *)\n",
"let rec final_m_C m_C n =\n",
"\n",