Calcul : réorganisation/suppression
This commit is contained in:
parent
7edbaab08c
commit
b770f0b442
96
Calcul.ipynb
96
Calcul.ipynb
@ -8,14 +8,7 @@
|
||||
},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"open Lacaml.D\n"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"### H$_n$"
|
||||
"(* Algorithme de localisation des orbitales : Méthode de Boys ou Edminston-Ruedenberg *)\n"
|
||||
]
|
||||
},
|
||||
{
|
||||
@ -24,6 +17,17 @@
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"open Lacaml.D"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"(*I : Position et base atomique*)\n",
|
||||
"\n",
|
||||
"(* Fonction création chaîne linéaire de n H *)\n",
|
||||
"\n",
|
||||
"let xyz d n = \n",
|
||||
@ -44,15 +48,6 @@
|
||||
"let xyz_string = xyz 1.8 10;;\n"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {
|
||||
"heading_collapsed": true
|
||||
},
|
||||
"source": [
|
||||
"### Base atomique"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
@ -61,6 +56,8 @@
|
||||
},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"(* Base atomique *)\n",
|
||||
"\n",
|
||||
"let basis_string = \n",
|
||||
"\"\n",
|
||||
"HYDROGEN\n",
|
||||
@ -82,6 +79,10 @@
|
||||
},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"(* II : Hartree-Fock *)\n",
|
||||
"\n",
|
||||
"(* Def pour HF *)\n",
|
||||
"\n",
|
||||
"let nuclei =\n",
|
||||
" Nuclei.of_xyz_string xyz_string\n",
|
||||
" \n",
|
||||
@ -100,15 +101,6 @@
|
||||
" "
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {
|
||||
"heading_collapsed": true
|
||||
},
|
||||
"source": [
|
||||
"### Calcul Hartree-Fock"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
@ -117,6 +109,8 @@
|
||||
},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"(* Calcul de Hartree-Fock*)\n",
|
||||
"\n",
|
||||
"let hf = HartreeFock.make simulation\n"
|
||||
]
|
||||
},
|
||||
@ -142,19 +136,14 @@
|
||||
"let mo_coef = MOBasis.mo_coef mo_basis\n"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"## Fonctions pour la localisation"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"(* III : Définition des fonctions pour la localisation *)\n",
|
||||
"\n",
|
||||
"(* Définitions de base nécessaire pour la suite *)\n",
|
||||
"let ee_ints = AOBasis.ee_ints ao_basis;;\n",
|
||||
"let m_C = MOBasis.mo_coef mo_basis;;\n",
|
||||
@ -175,7 +164,7 @@
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"(* Fonction de calcul de tous les alpha ER -> Matrice, dépend de m_a12, m_b12 qui dépendent de m_C *)\n",
|
||||
"(* Fonction de calcul de tous les alpha ER *)\n",
|
||||
"let f_alpha m_C =\n",
|
||||
"\n",
|
||||
" let n_mo = Mat.dim2 m_C in\n",
|
||||
@ -266,7 +255,7 @@
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"(* Fonction calcul alpha Boys *)\n",
|
||||
"(* Fonction de calcul de tous les alpha Boys *)\n",
|
||||
"let f_alpha_boys m_C = \n",
|
||||
" let n_mo = Mat.dim2 m_C\n",
|
||||
" in\n",
|
||||
@ -351,13 +340,13 @@
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"(* Détermination alpha_max et ses indices i et j.\n",
|
||||
"Si alpha max > pi/2 on soustrait pi/2 à la matrice des alphas de manière récursive *)\n",
|
||||
"type alphaij = {\n",
|
||||
" alpha_max : float;\n",
|
||||
" indice_ii : int;\n",
|
||||
" indice_jj : int;};;\n",
|
||||
"\n",
|
||||
"(* Détermination alpha_max et ses indices i et j.\n",
|
||||
"Si alpha max > pi/2 on soustrait pi/2 à la matrice des alphas de manière récursive *)\n",
|
||||
"let rec new_m_alpha m_alpha m_C n_rec_alpha=\n",
|
||||
"\n",
|
||||
" let n_mo = Mat.dim2 m_C\n",
|
||||
@ -488,20 +477,13 @@
|
||||
"let f_interm m_C m_Psi = Mat.sub m_C m_Psi;;\n"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"## Boucle localisation avec choix de la méthode de localisation"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"(* Localisation de Edminstion ou de Boys *)\n",
|
||||
"(* IV : Boucle de localisation des OMs *)\n",
|
||||
"\n",
|
||||
"(* Calcul de la nouvelle matrice des coefficient après n rotation d'orbitales *)\n",
|
||||
"let rec localisation m_C methode epsilon n prev_critere_D cc=\n",
|
||||
@ -621,6 +603,8 @@
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"(* V : Fonctions pour la séparation et le rassemblement des matrices *)\n",
|
||||
"\n",
|
||||
"(*Fonction de création d'une list d'entier à partir d'un vecteur de float*)\n",
|
||||
"let int_list vec = \n",
|
||||
" let float_list = Vec.to_list vec\n",
|
||||
@ -665,7 +649,8 @@
|
||||
" if j > nocc \n",
|
||||
" then m_vir.{i,j-(n_mo - nocc)}\n",
|
||||
" else m_occ.{i,j});;\n",
|
||||
"\n",
|
||||
" \n",
|
||||
"(* m_occ : OMs occupées; m_vir : OMs vacantes *)\n",
|
||||
"let m_occ , m_vir = split_mat m_C list_occ;;\n"
|
||||
]
|
||||
},
|
||||
@ -675,11 +660,17 @@
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"(* VI : Calcul et assemblage des OMs occupées/virtuels *)\n",
|
||||
"\n",
|
||||
"(* Fonction / Matrice des coef / Méthode(\"Boys\" ou \"ER\") / Pas(<=1.) \n",
|
||||
"/ Nombre d'itérations max / 0. (valeur de D pour initier la boucle) / critère de convergence sur D*)\n",
|
||||
"\n",
|
||||
"\n",
|
||||
"(*let new_m_boys = localisation m_C \"boys\" 1. 100 0. 10e-7;;\n",
|
||||
"let new_m_er = localisation m_C \"ER\" 1. 100 0. 10e-7;;\n",
|
||||
"*)\n",
|
||||
"\n",
|
||||
"let loc_m_occ_boys = localisation m_occ \"boys\" 0.9 100 0. 10e-7;;\n",
|
||||
"let loc_m_occ_boys = localisation m_occ \"boys\" 1. 100 0. 10e-7;;\n",
|
||||
"let loc_m_vir_boys = localisation m_vir \"boys\" 1. 100 0. 10e-7;;\n",
|
||||
"let m_assemble_boys = assemble loc_m_occ_boys loc_m_vir_boys;;\n",
|
||||
"\n",
|
||||
@ -699,6 +690,10 @@
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"(* VII : Calcul Coef CI *)\n",
|
||||
"\n",
|
||||
"(* Def de la mo_basis pour le HF pre CI *)\n",
|
||||
"\n",
|
||||
"(*\n",
|
||||
"let mo_base1 = MOBasis.make ~simulation ~mo_type:(MOBasis.Localized \"Boys\")\n",
|
||||
"~mo_occupation:(MOBasis.mo_occupation mo_basis) ~mo_coef:new_m_boys ();;\n",
|
||||
@ -728,6 +723,8 @@
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"(* HF pour CI *)\n",
|
||||
"\n",
|
||||
"let nuclei =\n",
|
||||
" Nuclei.of_xyz_string xyz_string\n",
|
||||
" \n",
|
||||
@ -742,7 +739,8 @@
|
||||
" \n",
|
||||
"let hf = HartreeFock.make simulation\n",
|
||||
"\n",
|
||||
"let mo_basis = MOBasis.of_hartree_fock hf\n"
|
||||
"(*let mo_basis = MOBasis.of_hartree_fock hf*)\n",
|
||||
"let mo_basis = mo_base3\n"
|
||||
]
|
||||
},
|
||||
{
|
||||
@ -751,6 +749,8 @@
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"(* Calcul de coef CI *)\n",
|
||||
"\n",
|
||||
"let ci =\n",
|
||||
" DeterminantSpace.fci_of_mo_basis mo_basis ~frozen_core:false\n",
|
||||
" |> CI.make\n",
|
||||
|
Loading…
Reference in New Issue
Block a user