diff --git a/Work.ipynb b/Work.ipynb index cdba7e2..596a7d9 100644 --- a/Work.ipynb +++ b/Work.ipynb @@ -127,8 +127,10 @@ "#install_printer HartreeFock.pp ;;\n", "#install_printer Fock.pp ;;\n", "#install_printer MOClass.pp ;;\n", + "(*\n", "#install_printer DeterminantSpace.pp;;\n", "#install_printer SpindeterminantSpace.pp;;\n", + "*)\n", "#install_printer Bitstring.pp;;\n", "let pp_mo ppf t = MOBasis.pp ~start:1 ~finish:0 ppf t ;;\n", "#install_printer pp_mo;;\n", @@ -202,7 +204,7 @@ " accu\n", " in string_of_int(n) ^ \"\\nH\" ^ string_of_int(n) ^ \"\\n\" ^ toto accu d n;;\n", " \n", - "let xyz_string = xyz 1.8 6;;\n" + "let xyz_string = xyz 1.8 4;;\n" ] }, { @@ -617,8 +619,10 @@ "metadata": {}, "outputs": [], "source": [ + "(*\n", "let m_X = \n", - " AOBasis.ortho ao_basis\n" + " AOBasis.ortho ao_basis\n", + "*)" ] }, { @@ -634,6 +638,7 @@ "metadata": {}, "outputs": [], "source": [ + "(*\n", "let c_of_h m_H = \n", " (* On exprime H dans la base orthonormale *)\n", " let m_Hmo =\n", @@ -652,7 +657,8 @@ "let m_C = \n", " match Guess.make ~nocc ~guess:`Hcore ao_basis with\n", " | Hcore m_H -> c_of_h m_H\n", - " | _ -> assert false\n" + " | _ -> assert false\n", + "*)" ] }, { @@ -669,9 +675,11 @@ "metadata": {}, "outputs": [], "source": [ + "\n", "let m_P = \n", + " (*let m_C = m_assemble_er in*)\n", " (* P = 2 C.C^t *)\n", - " gemm ~alpha:2. ~transb:`T ~k:nocc m_C m_C" + " gemm ~alpha:2. ~transb:`T ~k:nocc m_C m_C\n" ] }, { @@ -687,11 +695,12 @@ "metadata": {}, "outputs": [], "source": [ + "\n", "let m_Hc, m_J, m_K =\n", " let f =\n", " Fock.make_rhf ~density:m_P ao_basis\n", " in\n", - " Fock.(core f, coulomb f, exchange f)" + " Fock.(core f, coulomb f, exchange f)\n" ] }, { @@ -708,9 +717,10 @@ "metadata": {}, "outputs": [], "source": [ + "\n", "let m_F = \n", " Mat.add m_Hc (Mat.sub m_J m_K)\n", - " " + " " ] }, { @@ -747,6 +757,7 @@ "metadata": {}, "outputs": [], "source": [ + "\n", "let energy =\n", " (Simulation.nuclear_repulsion simulation) +. 0.5 *.\n", " Mat.gemm_trace m_P (Mat.add m_Hc m_F)\n" @@ -765,6 +776,7 @@ "metadata": {}, "outputs": [], "source": [ + "\n", "let rec iteration m_C n =\n", " let m_P = \n", " (* P = 2 C.C^t *)\n", @@ -2023,6 +2035,75 @@ "let loc_assemble_er = localisation m_assemble_er \"er\" \"loc\" 1. 100 0. 10e-7;;" ] }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "let mo_base = MOBasis.make ~simulation ~mo_type:(MOBasis.Localized \"Boys\") \n", + "~mo_occupation:(MOBasis.mo_occupation mo_basis) ~mo_coef:loc_assemble_boys ();;\n", + "\n", + "let mo_base2 = MOBasis.make ~simulation ~mo_type:(MOBasis.Localized \"Boys\") \n", + "~mo_occupation:(MOBasis.mo_occupation mo_basis) ~mo_coef:m_assemble_er ();;\n" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "let plot data filename = \n", + " let output = Gnuplot.Output.create (`Png filename) in\n", + " let gp = Gnuplot.create () in\n", + " Gnuplot.set gp ~use_grid:true;\n", + " List.map Gnuplot.Series.lines_xy data\n", + " |> Gnuplot.plot_many gp ~output;\n", + " Gnuplot.close gp ;\n", + " Jupyter_notebook.display_file ~base64:true \"image/png\" filename\n", + ";;\n", + "\n", + "let x_values = \n", + " let n = 1000 in\n", + " \n", + " let xmin, xmax =\n", + " let coord =\n", + " Array.map snd nuclei\n", + " |> Array.map (fun a -> Coordinate.(get X) a)\n", + " in\n", + " Array.sort compare coord;\n", + " coord.(0) -. 4. ,\n", + " coord.(Array.length coord -1) +. 4.\n", + " in\n", + "\n", + " let dx =\n", + " (xmax -. xmin) /. (float_of_int n -. 1.)\n", + " in\n", + " Array.init n (fun i -> xmin +. (float_of_int i)*.dx)\n", + "in\n", + "\n", + "let data = \n", + " let result = \n", + " Array.map (fun x -> \n", + " let point = Coordinate.make_angstrom\n", + " { Coordinate.\n", + " x ; y = 0. ; z = 0.\n", + " } in\n", + " MOBasis.values mo_base2 point\n", + " ) x_values\n", + " |> Mat.of_col_vecs\n", + " |> Mat.transpose_copy\n", + " |> Mat.to_col_vecs\n", + " |> Array.map Vec.to_list\n", + " |> Array.map (fun l -> List.mapi (fun i y -> (x_values.(i),y)) l)\n", + " in\n", + " [ result.(0) ; result.(1) ; result.(2) ]\n", + "in\n", + "\n", + "plot data \"test_data.png\"" + ] + }, { "cell_type": "code", "execution_count": null, @@ -2056,7 +2137,9 @@ " DeterminantSpace.fci_of_mo_basis mo_basis ~frozen_core:false\n", " |> CI.make\n", " \n", - "let ci_coef, ci_energy = Lazy.force ci.eigensystem " + "let ci_coef, ci_energy = Lazy.force ci.eigensystem ;;\n", + "Vec.iteri (fun i x -> Printf.printf \"%d %f\\n\" i x) ci_coef;;\n", + "\n" ] }, { @@ -2087,6 +2170,321 @@ "outputs": [], "source": [] }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [] + }, { "cell_type": "code", "execution_count": null,