10
1
mirror of https://gitlab.com/scemama/QCaml.git synced 2024-07-15 15:44:34 +02:00

Adapt for Notebooks

This commit is contained in:
Anthony Scemama 2019-12-02 14:58:48 +01:00
parent 1de449b0b9
commit acb2314be4
20 changed files with 514 additions and 71 deletions

View File

@ -101,3 +101,6 @@ let of_nuclei_and_basis_filenames ~nuclei filenames =
of_nuclei_and_general_basis nuclei general_basis
let pp ppf t =
Format.fprintf ppf "@[%s@]" (to_string t)

View File

@ -41,5 +41,5 @@ val general_basis : t -> GeneralBasis.t
val to_string : t -> string
(** Pretty prints the basis set in a string. TODO *)
val pp : Format.formatter -> t -> unit

View File

@ -8,9 +8,18 @@
]
},
{
"cell_type": "code",
"execution_count": 7,
"cell_type": "markdown",
"metadata": {},
"source": [
"## Initialization"
]
},
{
"cell_type": "code",
"execution_count": 1,
"metadata": {
"collapsed": true
},
"outputs": [
{
"name": "stdout",
@ -28,6 +37,57 @@
"\n",
"- : unit = ()\n"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"/home/scemama/qp2/external/opam/4.07.1/lib/bytes: added to search path\n",
"/home/scemama/qp2/external/opam/4.07.1/lib/base64: added to search path\n",
"/home/scemama/qp2/external/opam/4.07.1/lib/base64/base64.cma: loaded\n",
"/home/scemama/qp2/external/opam/4.07.1/lib/ocaml/compiler-libs: added to search path\n",
"/home/scemama/qp2/external/opam/4.07.1/lib/ocaml/compiler-libs/ocamlcommon.cma: loaded\n",
"/home/scemama/qp2/external/opam/4.07.1/lib/result: added to search path\n",
"/home/scemama/qp2/external/opam/4.07.1/lib/result/result.cma: loaded\n",
"/home/scemama/qp2/external/opam/4.07.1/lib/ppx_deriving/runtime: added to search path\n",
"/home/scemama/qp2/external/opam/4.07.1/lib/ppx_deriving/runtime/ppx_deriving_runtime.cma: loaded\n",
"/home/scemama/qp2/external/opam/4.07.1/lib/ppx_deriving_yojson/runtime: added to search path\n",
"/home/scemama/qp2/external/opam/4.07.1/lib/ppx_deriving_yojson/runtime/ppx_deriving_yojson_runtime.cma: loaded\n",
"/home/scemama/qp2/external/opam/4.07.1/lib/ocaml/unix.cma: loaded\n",
"/home/scemama/qp2/external/opam/4.07.1/lib/uuidm: added to search path\n",
"/home/scemama/qp2/external/opam/4.07.1/lib/uuidm/uuidm.cma: loaded\n",
"/home/scemama/qp2/external/opam/4.07.1/lib/easy-format: added to search path\n",
"/home/scemama/qp2/external/opam/4.07.1/lib/easy-format/easy_format.cma: loaded\n",
"/home/scemama/qp2/external/opam/4.07.1/lib/biniou: added to search path\n",
"/home/scemama/qp2/external/opam/4.07.1/lib/biniou/biniou.cma: loaded\n",
"/home/scemama/qp2/external/opam/4.07.1/lib/yojson: added to search path\n",
"/home/scemama/qp2/external/opam/4.07.1/lib/yojson/yojson.cma: loaded\n",
"/home/scemama/qp2/external/opam/4.07.1/lib/jupyter: added to search path\n",
"/home/scemama/qp2/external/opam/4.07.1/lib/jupyter/jupyter.cma: loaded\n",
"/home/scemama/qp2/external/opam/4.07.1/lib/jupyter/notebook: added to search path\n",
"/home/scemama/qp2/external/opam/4.07.1/lib/jupyter/notebook/jupyter_notebook.cma: loaded\n",
"/home/scemama/qp2/external/opam/4.07.1/lib/ocaml/bigarray.cma: loaded\n",
"/home/scemama/qp2/external/opam/4.07.1/lib/lacaml: added to search path\n",
"/home/scemama/qp2/external/opam/4.07.1/lib/lacaml/lacaml.cma: loaded\n",
"/home/scemama/qp2/external/opam/4.07.1/lib/astring: added to search path\n",
"/home/scemama/qp2/external/opam/4.07.1/lib/astring/astring.cma: loaded\n",
"/home/scemama/qp2/external/opam/4.07.1/lib/cmdliner: added to search path\n",
"/home/scemama/qp2/external/opam/4.07.1/lib/cmdliner/cmdliner.cma: loaded\n",
"/home/scemama/qp2/external/opam/4.07.1/lib/seq: added to search path\n",
"/home/scemama/qp2/external/opam/4.07.1/lib/stdlib-shims: added to search path\n",
"/home/scemama/qp2/external/opam/4.07.1/lib/stdlib-shims/stdlib_shims.cma: loaded\n",
"/home/scemama/qp2/external/opam/4.07.1/lib/fmt: added to search path\n",
"/home/scemama/qp2/external/opam/4.07.1/lib/fmt/fmt.cma: loaded\n",
"/home/scemama/qp2/external/opam/4.07.1/lib/fmt/fmt_cli.cma: loaded\n",
"/home/scemama/qp2/external/opam/4.07.1/lib/fmt/fmt_tty.cma: loaded\n",
"/home/scemama/qp2/external/opam/4.07.1/lib/alcotest: added to search path\n",
"/home/scemama/qp2/external/opam/4.07.1/lib/alcotest/alcotest.cma: loaded\n",
"/home/scemama/qp2/external/opam/4.07.1/lib/ocaml/str.cma: loaded\n",
"/home/scemama/qp2/external/opam/4.07.1/lib/zarith: added to search path\n",
"/home/scemama/qp2/external/opam/4.07.1/lib/zarith/zarith.cma: loaded\n",
"/home/scemama/qp2/external/opam/4.07.1/lib/getopt: added to search path\n",
"/home/scemama/qp2/external/opam/4.07.1/lib/getopt/getopt.cma: loaded\n"
]
}
],
"source": [
@ -37,6 +97,8 @@
"\n",
"#require \"lacaml\";;\n",
"#require \"alcotest\";;\n",
"#require \"str\";;\n",
"#require \"bigarray\";;\n",
"#require \"zarith\";;\n",
"#require \"getopt\";;\n",
"#directory \"_build\";;\n",
@ -47,100 +109,469 @@
"#directory \"_build/Parallel\";;\n",
"#directory \"_build/Perturbation\";;\n",
"#directory \"_build/SCF\";;\n",
"#directory \"_build/Utils\";;\n",
"\n",
"#load \"Constants.cmo\";;\n",
"#load_rec \"Util.cma\";;\n",
"#load_rec \"Matrix.cmo\";;\n",
"#load_rec \"Simulation.cmo\";;\n",
"\n"
"#directory \"_build/Utils\";;"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Simulation\n"
"### Modules to load"
]
},
{
"cell_type": "code",
"execution_count": 12,
"execution_count": 2,
"metadata": {},
"outputs": [],
"source": [
"#load \"Constants.cmo\";;\n",
"#load_rec \"Util.cma\";;\n",
"#load_rec \"Matrix.cmo\";;\n",
"#load_rec \"Simulation.cmo\";;\n",
"#load_rec \"Simulation.cmo\";;\n",
"#load_rec \"HartreeFock.cmo\";;\n",
"\n",
"open Lacaml.D;;"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### Printers"
]
},
{
"cell_type": "code",
"execution_count": 3,
"metadata": {},
"outputs": [],
"source": [
"#install_printer AngularMomentum.pp_string ;;\n",
"#install_printer Basis.pp ;;\n",
"#install_printer Charge.pp ;;\n",
"#install_printer Coordinate.pp ;;\n",
"#install_printer Vector.pp;;\n",
"#install_printer Matrix.pp;;\n",
"#install_printer Util.pp_float_2darray;;\n",
"#install_printer Util.pp_float_array;;\n",
"#install_printer Util.pp_matrix;;\n",
"#install_printer HartreeFock.pp ;;\n",
"#install_printer Fock.pp ;;\n"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Run"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### Simulation\n"
]
},
{
"cell_type": "code",
"execution_count": 4,
"metadata": {},
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"File \"[12]\", line 3, characters 4-22:\n",
"Warning 26: unused variable aux_basis_filename.\n"
]
"data": {
"text/plain": [
"val basis_filename : string = \"/home/scemama/qp2/data/basis/cc-pvdz\"\n"
]
},
"execution_count": 4,
"metadata": {},
"output_type": "execute_result"
},
{
"data": {
"text/plain": [
"- : Simulation.t = <abstr>\n"
"val aux_basis_filename : string = \"/home/scemama/qp2/data/basis/cc-pvtz\"\n"
]
},
"execution_count": 12,
"execution_count": 4,
"metadata": {},
"output_type": "execute_result"
},
{
"data": {
"text/plain": [
"val nuclei : Nuclei.t = [|(Element.Be, 0.0000 0.0000 0.0000)|]\n"
]
},
"execution_count": 4,
"metadata": {},
"output_type": "execute_result"
},
{
"data": {
"text/plain": [
"val basis : Basis.t =\n",
" \n",
" Atomic Basis set\n",
" ----------------\n",
"\n",
"-----------------------------------------------------------------------\n",
" # Angular Coordinates (Bohr) Exponents Coefficients\n",
" Momentum X Y Z\n",
"-----------------------------------------------------------------------\n",
" 1-3 S 0.0000 0.0000 0.0000 2.94000000e+03 6.80000000e-04\n",
" 4.41200000e+02 5.23600000e-03\n",
" 1.00500000e+02 2.66060000e-02\n",
" 2.84300000e+01 9.99930000e-02\n",
" 9.16900000e+00 2.69702000e-01\n",
" 3.19600000e+00 4.51469000e-01\n",
" 1.15900000e+00 2.95074000e-01\n",
" 1.81100000e-01 1.25870000e-02\n",
" \n",
" 2.94000000e+03 -1.23000000e-04\n",
" 4.41200000e+02 -9.66000000e-04\n",
" 1.00500000e+02 -4.83100000e-03\n",
" 2.84300000e+01 -1.93140000e-02\n",
" 9.16900000e+00 -5.32800000e-02\n",
" 3.19600000e+00 -1.20723000e-01\n",
" 1.15900000e+00 -1.33435000e-01\n",
" 1.81100000e-01 5.30767000e-01\n",
" \n",
" 5.89000000e-02 1.00000000e+00\n",
" \n",
" \n",
"-----------------------------------------------------------------------\n",
" 4-9 P 0.0000 0.0000 0.0000 3.61900000e+00 2.91110000e-02\n",
" 7.11000000e-01 1.69365000e-01\n",
" 1.95100000e-01 5.13458000e-01\n",
" \n",
" 6.01800000e-02 1.00000000e+00\n",
" \n",
" \n",
"-----------------------------------------------------------------------\n",
" 10-15 D 0.0000 0.0000 0.0000 2.38000000e-01 1.00000000e+00\n",
" \n",
" \n",
"-----------------------------------------------------------------------\n",
"\n"
]
},
"execution_count": 4,
"metadata": {},
"output_type": "execute_result"
},
{
"data": {
"text/plain": [
"val aux_basis : Basis.t =\n",
" \n",
" Atomic Basis set\n",
" ----------------\n",
"\n",
"-----------------------------------------------------------------------\n",
" # Angular Coordinates (Bohr) Exponents Coefficients\n",
" Momentum X Y Z\n",
"-----------------------------------------------------------------------\n",
" 1-7 S 0.0000 0.0000 0.0000 2.94000000e+03 6.80000000e-04\n",
" 4.41200000e+02 5.23600000e-03\n",
" 1.00500000e+02 2.66060000e-02\n",
" 2.84300000e+01 9.99930000e-02\n",
" 9.16900000e+00 2.69702000e-01\n",
" 3.19600000e+00 4.51469000e-01\n",
" 1.15900000e+00 2.95074000e-01\n",
" 1.81100000e-01 1.25870000e-02\n",
" \n",
" 2.94000000e+03 -1.23000000e-04\n",
" 4.41200000e+02 -9.66000000e-04\n",
" 1.00500000e+02 -4.83100000e-03\n",
" 2.84300000e+01 -1.93140000e-02\n",
" 9.16900000e+00 -5.32800000e-02\n",
" 3.19600000e+00 -1.20723000e-01\n",
" 1.15900000e+00 -1.33435000e-01\n",
" 1.81100000e-01 5.30767000e-01\n",
" \n",
" 5.89000000e-02 1.00000000e+00\n",
" \n",
" 6.86300000e+03 2.36000000e-04\n",
" 1.03000000e+03 1.82600000e-03\n",
" 2.34700000e+02 9.45200000e-03\n",
" 6.65600000e+01 3.79570000e-02\n",
" 2.16900000e+01 1.19965000e-01\n",
" 7.73400000e+00 2.82162000e-01\n",
" 2.91600000e+00 4.27404000e-01\n",
" 1.13000000e+00 2.66278000e-01\n",
" 1.10100000e-01 -7.27500000e-03\n",
" \n",
" 6.86300000e+03 -4.30000000e-05\n",
" 1.03000000e+03 -3.33000000e-04\n",
" 2.34700000e+02 -1.73600000e-03\n",
" 6.65600000e+01 -7.01200000e-03\n",
" 2.16900000e+01 -2.31260000e-02\n",
" 7.73400000e+00 -5.81380000e-02\n",
" 2.91600000e+00 -1.14556000e-01\n",
" 1.13000000e+00 -1.35908000e-01\n",
" 1.10100000e-01 5.77441000e-01\n",
" \n",
" 2.57700000e-01 1.00000000e+00\n",
" \n",
" 4.40900000e-02 1.00000000e+00\n",
" \n",
" \n",
"-----------------------------------------------------------------------\n",
" 4-18 P 0.0000 0.0000 0.0000 3.61900000e+00 2.91110000e-02\n",
" 7.11000000e-01 1.69365000e-01\n",
" 1.95100000e-01 5.13458000e-01\n",
" \n",
" 6.01800000e-02 1.00000000e+00\n",
" \n",
" 7.43600000e+00 1.07360000e-02\n",
" 1.57700000e+00 6.28540000e-02\n",
" 4.35200000e-01 2.48180000e-01\n",
" \n",
" 1.43800000e-01 1.00000000e+00\n",
" \n",
" 4.99400000e-02 1.00000000e+00\n",
" \n",
" \n",
"-----------------------------------------------------------------------\n",
" 10-27 D 0.0000 0.0000 0.0000 2.38000000e-01 1.00000000e+00\n",
" \n",
" 3.48000000e-01 1.00000000e+00\n",
" \n",
" 1.80300000e-01 1.00000000e+00\n",
" \n",
" \n",
"-----------------------------------------------------------------------\n",
" 41-50 F 0.0000 0.0000 0.0000 3.25000000e-01 1.00000000e+00\n",
" \n",
" \n",
"-----------------------------------------------------------------------\n",
"\n"
]
},
"execution_count": 4,
"metadata": {},
"output_type": "execute_result"
},
{
"data": {
"text/plain": [
"val f12 : F12factor.t =\n",
" {F12factor.expo_s = 1.;\n",
" gaussian =\n",
" {GaussianOperator.coef_g =\n",
" [ -0.314400 -0.303700 -0.168100 -0.098110 -0.060240 -0.037260 ];\n",
" expo_sg =\n",
" [ 0.220900 1.004000 3.622000 12.160000 45.870000 254.400000 ];\n",
" expo_sg_inv =\n",
" [ 4.526935 0.996016 0.276091 0.082237 0.021801 0.003931 ]}}\n"
]
},
"execution_count": 4,
"metadata": {},
"output_type": "execute_result"
},
{
"data": {
"text/plain": [
"val charge : int = 0\n"
]
},
"execution_count": 4,
"metadata": {},
"output_type": "execute_result"
},
{
"data": {
"text/plain": [
"val multiplicity : int = 1\n"
]
},
"execution_count": 4,
"metadata": {},
"output_type": "execute_result"
},
{
"data": {
"text/plain": [
"val simulation : Simulation.t = <abstr>\n"
]
},
"execution_count": 4,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"let basis_file = \"/home/scemama/qp2/data/basis/6-31g\" in\n",
" \n",
"let aux_basis_filename = \"/home/scemama/qp2/data/basis/cc-pvdz\" in\n",
" \n",
"let nuclei_file = \"be.xyz\" in\n",
" \n",
"let charge = 0 in\n",
"let basis_filename = \"/home/scemama/qp2/data/basis/cc-pvdz\" \n",
"let aux_basis_filename = \"/home/scemama/qp2/data/basis/cc-pvtz\" \n",
"let nuclei = Nuclei.of_zmt_string \"be\" \n",
"\n",
"let multiplicity = 1 in\n",
"let basis = Basis.of_nuclei_and_basis_filenames ~nuclei [basis_filename] \n",
"let aux_basis = Basis.of_nuclei_and_basis_filenames ~nuclei (basis_filename :: aux_basis_filename :: []) \n",
"let f12 = F12factor.gaussian_geminal 1.0 \n",
"let charge = 0 \n",
"let multiplicity = 1 \n",
"\n",
"let f12 = F12factor.gaussian_geminal 1.0 in\n",
"\n",
"let simulation =\n",
" Simulation.of_filenames ~f12 ~charge ~multiplicity ~nuclei:nuclei_file basis_file \n",
"in\n",
"simulation\n",
" \n",
"\n"
" Simulation.make \n",
" ~f12 ~charge ~multiplicity ~nuclei\n",
" ~cartesian:true\n",
" basis\n"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Hartree-Fock"
]
},
{
"cell_type": "code",
"execution_count": 10,
"execution_count": 7,
"metadata": {},
"outputs": [
{
"ename": "NameError",
"evalue": "name 'version' is not defined",
"output_type": "error",
"traceback": [
"\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
"\u001b[0;31mNameError\u001b[0m Traceback (most recent call last)",
"\u001b[0;32m<ipython-input-10-605b5d1778ad>\u001b[0m in \u001b[0;36m<module>\u001b[0;34m\u001b[0m\n\u001b[0;32m----> 1\u001b[0;31m \u001b[0mversion\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m",
"\u001b[0;31mNameError\u001b[0m: name 'version' is not defined"
"name": "stdout",
"output_type": "stream",
"text": [
"MOs =\n",
"\n",
"\n",
" -- 1 -- -- 2 -- -- 3 -- -- 4 -- -- 5 --\n",
" 1 1.0006 0.00028918 -0 -0 0\n",
" 2 0.00576322 1.00367 -7.13815E-16 -0 0\n",
" 3 -0.00181801 0.582215 4.68436E-16 -6.48338E-16 0\n",
" ... ... ... ... ...\n",
" 13 -0.00209072 -0.00172308 -0 -0 0\n",
" 14 -0 -0 -0 -0 0\n",
" 15 -0.00209072 -0.00172308 -0 -8.65517E-16 0\n",
" \n",
"\n",
" -- 6 -- -- 7 -- -- 8 -- -- 9 -- -- 10 --\n",
" 1 0.549926 -7.88204E-16 0 0 -5.10457E-16\n",
" 2 2.77214 -4.20928E-15 0 -8.18142E-16 -6.26457E-16\n",
" 3 -1.826 2.68321E-15 0 0 4.82834E-15\n",
" ... ... ... ... ...\n",
" 13 0.224421 0 0 0 -0.995373\n",
" 14 -0 0 0 0 -0.00304009\n",
" 15 0.224421 0 0 0 0.534433\n",
" \n",
"\n",
" -- 11 -- -- 12 -- -- 13 -- -- 14 -- -- 15 --\n",
" 1 -8.47272E-16 4.18722E-16 0 0 0.516133\n",
" 2 -7.29877E-15 3.26085E-15 -5.13582E-16 0 4.52711\n",
" 3 -1.53999E-15 0 0 0 1.08073\n",
" ... ... ... ... ...\n",
" 13 0.0741226 0.0584492 -0.01795 0.000120624 -1.45115\n",
" 14 0.00668622 0.201298 0.848372 -0.489582 0\n",
" 15 0.750441 -0.380516 0.0792247 -0.0122393 -1.45115\n",
" \n"
]
},
{
"data": {
"text/plain": [
"val hf : HartreeFock.t = \n",
"======================================================================\n",
" Restricted Hartree-Fock \n",
"======================================================================\n",
"\n",
" ------------------------------------------------------------\n",
" # HF energy Convergence HOMO-LUMO\n",
" ------------------------------------------------------------\n",
" 1 -14.05142130 8.0958e-01 0.2991\n",
" 2 -14.51982122 2.7933e-01 0.3600\n",
" 3 -14.56519147 8.3990e-02 0.3674\n",
" 4 -14.57117146 2.6217e-02 0.3679\n",
" 5 -14.57214606 1.0744e-02 0.3676\n",
" 6 -14.57232209 5.0392e-03 0.3675\n",
" 7 -14.57235521 2.2956e-03 0.3674\n",
" 8 -14.57236154 1.0293e-03 0.3673\n",
" 9 -14.57236304 4.1738e-08 0.3673\n",
" 10 -14.57236304 4.9181e-09 0.3673\n",
" ------------------------------------------------------------\n",
"\n",
"\n",
" ============================================================\n",
" One-electron energy -19.0610711155\n",
" Kinetic 14.5598880887\n",
" Potential -33.6209592042\n",
" -------------------------------------------------------- \n",
" Two-electron energy 4.4887080772\n",
" Coulomb 7.1543328046\n",
" Exchange -2.6656247274\n",
" -------------------------------------------------------- \n",
" HF HOMO -8.4100296422\n",
" HF LUMO 1.5842692336\n",
" HF LUMO-LUMO 9.9942988758\n",
" -------------------------------------------------------- \n",
" Electronic energy -14.5723630383\n",
" Nuclear repulsion 0.0000000000\n",
" Hartree-Fock energy -14.5723630383\n",
" ============================================================\n",
" \n",
"\n"
]
},
"execution_count": 7,
"metadata": {},
"output_type": "execute_result"
}
],
"source": []
"source": [
"let hf = \n",
" HartreeFock.make ~guess:`Hcore simulation \n"
]
},
{
"cell_type": "code",
"execution_count": 8,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"val ints : ERI.t = <abstr>\n"
]
},
"execution_count": 8,
"metadata": {},
"output_type": "execute_result"
},
{
"data": {
"text/plain": [
"- : float = 0.\n"
]
},
"execution_count": 8,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"let ints = Simulation.ao_basis simulation\n",
"|> AOBasis.ee_ints ;;\n",
"ERI.get_phys ints 1 1 1 4"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"\n",
"\n"
]
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "OCaml default",
"display_name": "OCaml 4.07.1",
"language": "OCaml",
"name": "ocaml-jupyter"
},

View File

@ -1746,7 +1746,7 @@
"metadata": {
"celltoolbar": "Raw Cell Format",
"kernelspec": {
"display_name": "OCaml default",
"display_name": "OCaml 4.07.1",
"language": "OCaml",
"name": "ocaml-jupyter"
},

View File

@ -1,3 +1,7 @@
let create ?(temp_dir="/dev/shm") data_type size_array =
Bigarray.Genarray.create data_type Bigarray.fortran_layout size_array
let result =
Bigarray.Genarray.create data_type Bigarray.fortran_layout size_array
in
Bigarray.Genarray.fill result 0.;
result

View File

@ -234,7 +234,7 @@ let scale alpha f1 =
let pp_fock ppf a =
let pp ppf a =
Format.fprintf ppf "@[<2>";
Format.fprintf ppf "@[ Fock matrix:@[<2>@[%a@]@.]@]" pp_matrix a.fock;
Format.fprintf ppf "@[ Core Hamiltonian:@[<2>@[%a@]@.]@]" pp_matrix a.core;

View File

@ -46,5 +46,5 @@ val sub : t -> t -> t
(** {1 Printers} *)
val pp_fock : Format.formatter -> t -> unit
val pp : Format.formatter -> t -> unit

View File

@ -192,7 +192,7 @@ let make
?kind
?guess:(guess=`Huckel)
?max_scf:(max_scf=64)
?level_shift:(level_shift=0.1)
?level_shift:(level_shift=0.2)
?threshold_SCF:(threshold_SCF=1.e-8)
simulation =
@ -223,6 +223,7 @@ let make
(* Orthogonalization matrix *)
let m_X =
Ao.ortho ao_basis
|> Util.remove_epsilons
in
(* Overlap matrix *)
@ -276,6 +277,7 @@ let make
(* Density matrix over nocc occupied MOs *)
let m_P =
gemm ~alpha:2. ~transb:`T ~k:nocc m_C m_C
|> Util.remove_epsilons
in
(* Fock matrix in AO basis *)
@ -698,7 +700,7 @@ let pp_summary ppf t =
let pp_hf ppf t =
let pp ppf t =
Format.fprintf ppf "@.@[%s@]@." (Printing.line ~c:'=' 70);
Format.fprintf ppf "@[%34s %-34s@]@." (match t.kind with
| UHF -> "Unrestricted"

View File

@ -65,7 +65,7 @@ val make :
(** {1 Printers} *)
val pp_hf : Format.formatter -> t -> unit
val pp : Format.formatter -> t -> unit
val pp_iterations : Format.formatter -> t -> unit

View File

@ -624,10 +624,10 @@ let parallel_mm ?(transa=`N) ?(transb=`N) ?(threshold=epsilon) a b =
(* ------------ Printers ------------ *)
let rec pp_matrix ppf = function
let rec pp ppf = function
| Dense m -> Util.pp_matrix ppf m
| Sparse m -> pp_matrix ppf @@ dense_of_sparse (Sparse m)
| Computed m -> pp_matrix ppf @@ dense_of_computed (Computed m)
| Sparse m -> pp ppf @@ dense_of_sparse (Sparse m)
| Computed m -> pp ppf @@ dense_of_computed (Computed m)

View File

@ -93,7 +93,7 @@ val parallel_mm : ?transa:trans3 -> ?transb:trans3 -> ?threshold:float -> t -> t
(** {1 Printers } *)
val pp_matrix : Format.formatter -> t -> unit
val pp : Format.formatter -> t -> unit
(** {1 Unit testing} *)

View File

@ -40,7 +40,7 @@ let to_string l =
"]"
let pp_range ppf t =
let pp ppf t =
Format.fprintf ppf "@[%s@]" (to_string t)

View File

@ -26,5 +26,5 @@ val to_int_list : t -> int list
(** {2 Printers} *)
val pp_range : Format.formatter -> t -> unit
val pp : Format.formatter -> t -> unit

View File

@ -186,7 +186,7 @@ let add = axpy ~alpha:1.
let sub ?(threshold=epsilon) x y = add ~threshold x @@ neg y
let pp_vector ppf = function
let pp ppf = function
| Dense m -> Util.pp_float_array ppf @@ Vec.to_array m
| Sparse {n ; v} ->
begin

View File

@ -70,7 +70,7 @@ val norm : t -> float
(** {1 Printers } *)
val pp_vector : Format.formatter -> t -> unit
val pp : Format.formatter -> t -> unit
(** {1 Unit testing} *)

View File

@ -60,7 +60,7 @@ let () =
in
let hf = HartreeFock.make s in
Format.fprintf ppf "@[%a@]@." HartreeFock.pp_hf hf;
Format.fprintf ppf "@[%a@]@." HartreeFock.pp hf;
let mos =
MOBasis.of_hartree_fock hf

View File

@ -49,7 +49,7 @@ let () =
in
let hf = HartreeFock.make s in
Format.fprintf ppf "@[%a@]@." HartreeFock.pp_hf hf;
Format.fprintf ppf "@[%a@]@." HartreeFock.pp hf;
let mos =
MOBasis.of_hartree_fock hf

View File

@ -47,7 +47,10 @@ let () =
let charge =
match Command_line.get "charge" with
| Some x -> int_of_string x
| Some x -> ( if x.[0] = 'm' then
~- (int_of_string (String.sub x 1 (String.length x - 1)))
else
int_of_string x )
| None -> 0
in

View File

@ -59,7 +59,7 @@ let () =
let s_guess = Simulation.of_filenames
~charge ~multiplicity ~nuclei:nuclei_file filename in
let hf = HartreeFock.make s_guess in
Format.fprintf ppf "@[%a@]@." HartreeFock.pp_hf hf;
Format.fprintf ppf "@[%a@]@." HartreeFock.pp hf;
let guess_mos =
MOBasis.of_hartree_fock hf
|> MOBasis.of_mo_basis s
@ -69,7 +69,7 @@ let () =
let hf = HartreeFock.make ~guess s in
Format.fprintf ppf "@[%a@]@." HartreeFock.pp_hf hf
Format.fprintf ppf "@[%a@]@." HartreeFock.pp hf
(*
; let mos = MOBasis.of_hartree_fock hf in
Format.fprintf ppf "@[%a@]@." (fun ppf x -> MOBasis.pp_mo ppf x) mos

View File

@ -59,7 +59,7 @@ let () =
let s_guess = Simulation.of_filenames
~charge ~multiplicity ~nuclei:nuclei_file filename in
let hf = HartreeFock.make s_guess in
Format.fprintf ppf "@[%a@]@." HartreeFock.pp_hf hf;
Format.fprintf ppf "@[%a@]@." HartreeFock.pp hf;
let guess_mos =
MOBasis.of_hartree_fock hf
|> MOBasis.of_mo_basis s
@ -69,7 +69,7 @@ let () =
let hf = HartreeFock.make ~guess s in
Format.fprintf ppf "@[%a@]@." HartreeFock.pp_hf hf;
Format.fprintf ppf "@[%a@]@." HartreeFock.pp hf;
let e_hf = HartreeFock.energy hf in