QCaml/Notebooks/F12_matrix.ipynb

25 KiB

None <html> <head> </head>

Test of F12 matrix elements

Initialization

In [1]:
#cd "/home/scemama/QCaml";;
#use "topfind";;
#require "jupyter.notebook";;

#require "lacaml";;
#require "alcotest";;
#require "str";;
#require "bigarray";;
#require "zarith";;
#require "getopt";;
#directory "_build";;
#directory "_build/Basis";;
#directory "_build/CI";;
#directory "_build/MOBasis";;
#directory "_build/Nuclei";;
#directory "_build/Parallel";;
#directory "_build/Perturbation";;
#directory "_build/SCF";;
#directory "_build/Utils";;
- : unit = ()
Findlib has been successfully loaded. Additional directives:
  #require "package";;      to load a package
  #list;;                   to list the available packages
  #camlp4o;;                to load camlp4 (standard syntax)
  #camlp4r;;                to load camlp4 (revised syntax)
  #predicates "p,q,...";;   to set these predicates
  Topfind.reset();;         to force that packages will be reloaded
  #thread;;                 to enable threads

- : unit = ()
/home/scemama/qp2/external/opam/4.07.1/lib/bytes: added to search path
/home/scemama/qp2/external/opam/4.07.1/lib/base64: added to search path
/home/scemama/qp2/external/opam/4.07.1/lib/base64/base64.cma: loaded
/home/scemama/qp2/external/opam/4.07.1/lib/ocaml/compiler-libs: added to search path
/home/scemama/qp2/external/opam/4.07.1/lib/ocaml/compiler-libs/ocamlcommon.cma: loaded
/home/scemama/qp2/external/opam/4.07.1/lib/result: added to search path
/home/scemama/qp2/external/opam/4.07.1/lib/result/result.cma: loaded
/home/scemama/qp2/external/opam/4.07.1/lib/ppx_deriving/runtime: added to search path
/home/scemama/qp2/external/opam/4.07.1/lib/ppx_deriving/runtime/ppx_deriving_runtime.cma: loaded
/home/scemama/qp2/external/opam/4.07.1/lib/ppx_deriving_yojson/runtime: added to search path
/home/scemama/qp2/external/opam/4.07.1/lib/ppx_deriving_yojson/runtime/ppx_deriving_yojson_runtime.cma: loaded
/home/scemama/qp2/external/opam/4.07.1/lib/ocaml/unix.cma: loaded
/home/scemama/qp2/external/opam/4.07.1/lib/uuidm: added to search path
/home/scemama/qp2/external/opam/4.07.1/lib/uuidm/uuidm.cma: loaded
/home/scemama/qp2/external/opam/4.07.1/lib/easy-format: added to search path
/home/scemama/qp2/external/opam/4.07.1/lib/easy-format/easy_format.cma: loaded
/home/scemama/qp2/external/opam/4.07.1/lib/biniou: added to search path
/home/scemama/qp2/external/opam/4.07.1/lib/biniou/biniou.cma: loaded
/home/scemama/qp2/external/opam/4.07.1/lib/yojson: added to search path
/home/scemama/qp2/external/opam/4.07.1/lib/yojson/yojson.cma: loaded
/home/scemama/qp2/external/opam/4.07.1/lib/jupyter: added to search path
/home/scemama/qp2/external/opam/4.07.1/lib/jupyter/jupyter.cma: loaded
/home/scemama/qp2/external/opam/4.07.1/lib/jupyter/notebook: added to search path
/home/scemama/qp2/external/opam/4.07.1/lib/jupyter/notebook/jupyter_notebook.cma: loaded
/home/scemama/qp2/external/opam/4.07.1/lib/ocaml/bigarray.cma: loaded
/home/scemama/qp2/external/opam/4.07.1/lib/lacaml: added to search path
/home/scemama/qp2/external/opam/4.07.1/lib/lacaml/lacaml.cma: loaded
/home/scemama/qp2/external/opam/4.07.1/lib/astring: added to search path
/home/scemama/qp2/external/opam/4.07.1/lib/astring/astring.cma: loaded
/home/scemama/qp2/external/opam/4.07.1/lib/cmdliner: added to search path
/home/scemama/qp2/external/opam/4.07.1/lib/cmdliner/cmdliner.cma: loaded
/home/scemama/qp2/external/opam/4.07.1/lib/seq: added to search path
/home/scemama/qp2/external/opam/4.07.1/lib/stdlib-shims: added to search path
/home/scemama/qp2/external/opam/4.07.1/lib/stdlib-shims/stdlib_shims.cma: loaded
/home/scemama/qp2/external/opam/4.07.1/lib/fmt: added to search path
/home/scemama/qp2/external/opam/4.07.1/lib/fmt/fmt.cma: loaded
/home/scemama/qp2/external/opam/4.07.1/lib/fmt/fmt_cli.cma: loaded
/home/scemama/qp2/external/opam/4.07.1/lib/fmt/fmt_tty.cma: loaded
/home/scemama/qp2/external/opam/4.07.1/lib/alcotest: added to search path
/home/scemama/qp2/external/opam/4.07.1/lib/alcotest/alcotest.cma: loaded
/home/scemama/qp2/external/opam/4.07.1/lib/ocaml/str.cma: loaded
/home/scemama/qp2/external/opam/4.07.1/lib/zarith: added to search path
/home/scemama/qp2/external/opam/4.07.1/lib/zarith/zarith.cma: loaded
/home/scemama/qp2/external/opam/4.07.1/lib/getopt: added to search path
/home/scemama/qp2/external/opam/4.07.1/lib/getopt/getopt.cma: loaded

Modules to load

In [2]:
#load "Constants.cmo";;
#load_rec "Util.cma";;
#load_rec "Matrix.cmo";;
#load_rec "Simulation.cmo";;
#load_rec "Simulation.cmo";;
#load_rec "HartreeFock.cmo";;

open Lacaml.D;;

Printers

In [3]:
#install_printer AngularMomentum.pp_string ;;
#install_printer Basis.pp ;;
#install_printer Charge.pp ;;
#install_printer Coordinate.pp ;;
#install_printer Vector.pp;;
#install_printer Matrix.pp;;
#install_printer Util.pp_float_2darray;;
#install_printer Util.pp_float_array;;
#install_printer Util.pp_matrix;;
#install_printer HartreeFock.pp ;;
#install_printer Fock.pp ;;

Run

Simulation

In [4]:
let basis_filename  = "/home/scemama/qp2/data/basis/cc-pvdz" 
let aux_basis_filename = "/home/scemama/qp2/data/basis/cc-pvtz" 
let nuclei = Nuclei.of_zmt_string "be" 

let basis =  Basis.of_nuclei_and_basis_filenames ~nuclei [basis_filename] 
let aux_basis =  Basis.of_nuclei_and_basis_filenames ~nuclei (basis_filename :: aux_basis_filename :: []) 
let f12 = F12factor.gaussian_geminal 1.0 
let charge = 0 
let multiplicity = 1 


let simulation =
    Simulation.make 
        ~f12 ~charge ~multiplicity ~nuclei
        ~cartesian:true
        basis
Out[4]:
val basis_filename : string = "/home/scemama/qp2/data/basis/cc-pvdz"
Out[4]:
val aux_basis_filename : string = "/home/scemama/qp2/data/basis/cc-pvtz"
Out[4]:
val nuclei : Nuclei.t = [|(Element.Be,   0.0000   0.0000   0.0000)|]
Out[4]:
val basis : Basis.t =
  
                          Atomic Basis set
                          ----------------

-----------------------------------------------------------------------
 #   Angular   Coordinates (Bohr)       Exponents       Coefficients
    Momentum  X        Y        Z
-----------------------------------------------------------------------
  1-3  S   0.0000   0.0000   0.0000   2.94000000e+03    6.80000000e-04
                                      4.41200000e+02    5.23600000e-03
                                      1.00500000e+02    2.66060000e-02
                                      2.84300000e+01    9.99930000e-02
                                      9.16900000e+00    2.69702000e-01
                                      3.19600000e+00    4.51469000e-01
                                      1.15900000e+00    2.95074000e-01
                                      1.81100000e-01    1.25870000e-02
                                    
                                      2.94000000e+03   -1.23000000e-04
                                      4.41200000e+02   -9.66000000e-04
                                      1.00500000e+02   -4.83100000e-03
                                      2.84300000e+01   -1.93140000e-02
                                      9.16900000e+00   -5.32800000e-02
                                      3.19600000e+00   -1.20723000e-01
                                      1.15900000e+00   -1.33435000e-01
                                      1.81100000e-01    5.30767000e-01
                                    
                                      5.89000000e-02    1.00000000e+00
                                    
                                    
-----------------------------------------------------------------------
  4-9  P   0.0000   0.0000   0.0000   3.61900000e+00    2.91110000e-02
                                      7.11000000e-01    1.69365000e-01
                                      1.95100000e-01    5.13458000e-01
                                    
                                      6.01800000e-02    1.00000000e+00
                                    
                                    
-----------------------------------------------------------------------
 10-15 D   0.0000   0.0000   0.0000   2.38000000e-01    1.00000000e+00
                                    
                                    
-----------------------------------------------------------------------

Out[4]:
val aux_basis : Basis.t =
  
                          Atomic Basis set
                          ----------------

-----------------------------------------------------------------------
 #   Angular   Coordinates (Bohr)       Exponents       Coefficients
    Momentum  X        Y        Z
-----------------------------------------------------------------------
  1-7  S   0.0000   0.0000   0.0000   2.94000000e+03    6.80000000e-04
                                      4.41200000e+02    5.23600000e-03
                                      1.00500000e+02    2.66060000e-02
                                      2.84300000e+01    9.99930000e-02
                                      9.16900000e+00    2.69702000e-01
                                      3.19600000e+00    4.51469000e-01
                                      1.15900000e+00    2.95074000e-01
                                      1.81100000e-01    1.25870000e-02
                                    
                                      2.94000000e+03   -1.23000000e-04
                                      4.41200000e+02   -9.66000000e-04
                                      1.00500000e+02   -4.83100000e-03
                                      2.84300000e+01   -1.93140000e-02
                                      9.16900000e+00   -5.32800000e-02
                                      3.19600000e+00   -1.20723000e-01
                                      1.15900000e+00   -1.33435000e-01
                                      1.81100000e-01    5.30767000e-01
                                    
                                      5.89000000e-02    1.00000000e+00
                                    
                                      6.86300000e+03    2.36000000e-04
                                      1.03000000e+03    1.82600000e-03
                                      2.34700000e+02    9.45200000e-03
                                      6.65600000e+01    3.79570000e-02
                                      2.16900000e+01    1.19965000e-01
                                      7.73400000e+00    2.82162000e-01
                                      2.91600000e+00    4.27404000e-01
                                      1.13000000e+00    2.66278000e-01
                                      1.10100000e-01   -7.27500000e-03
                                    
                                      6.86300000e+03   -4.30000000e-05
                                      1.03000000e+03   -3.33000000e-04
                                      2.34700000e+02   -1.73600000e-03
                                      6.65600000e+01   -7.01200000e-03
                                      2.16900000e+01   -2.31260000e-02
                                      7.73400000e+00   -5.81380000e-02
                                      2.91600000e+00   -1.14556000e-01
                                      1.13000000e+00   -1.35908000e-01
                                      1.10100000e-01    5.77441000e-01
                                    
                                      2.57700000e-01    1.00000000e+00
                                    
                                      4.40900000e-02    1.00000000e+00
                                    
                                    
-----------------------------------------------------------------------
  4-18 P   0.0000   0.0000   0.0000   3.61900000e+00    2.91110000e-02
                                      7.11000000e-01    1.69365000e-01
                                      1.95100000e-01    5.13458000e-01
                                    
                                      6.01800000e-02    1.00000000e+00
                                    
                                      7.43600000e+00    1.07360000e-02
                                      1.57700000e+00    6.28540000e-02
                                      4.35200000e-01    2.48180000e-01
                                    
                                      1.43800000e-01    1.00000000e+00
                                    
                                      4.99400000e-02    1.00000000e+00
                                    
                                    
-----------------------------------------------------------------------
 10-27 D   0.0000   0.0000   0.0000   2.38000000e-01    1.00000000e+00
                                    
                                      3.48000000e-01    1.00000000e+00
                                    
                                      1.80300000e-01    1.00000000e+00
                                    
                                    
-----------------------------------------------------------------------
 41-50 F   0.0000   0.0000   0.0000   3.25000000e-01    1.00000000e+00
                                    
                                    
-----------------------------------------------------------------------

Out[4]:
val f12 : F12factor.t =
  {F12factor.expo_s = 1.;
   gaussian =
    {GaussianOperator.coef_g =
      [  -0.314400  -0.303700  -0.168100  -0.098110  -0.060240  -0.037260 ];
     expo_sg =
      [   0.220900   1.004000   3.622000  12.160000  45.870000 254.400000 ];
     expo_sg_inv =
      [   4.526935   0.996016   0.276091   0.082237   0.021801   0.003931 ]}}
Out[4]:
val charge : int = 0
Out[4]:
val multiplicity : int = 1
Out[4]:
val simulation : Simulation.t = <abstr>

Hartree-Fock

In [7]:
let hf = 
    HartreeFock.make ~guess:`Hcore  simulation
MOs =


             -- 1 --     -- 2 --      -- 3 --      -- 4 -- -- 5 --
             1        1.0006  0.00028918           -0           -0       0
             2    0.00576322     1.00367 -7.13815E-16           -0       0
             3   -0.00181801    0.582215  4.68436E-16 -6.48338E-16       0
                         ...         ...          ...          ...     ...
            13   -0.00209072 -0.00172308           -0           -0       0
            14            -0          -0           -0           -0       0
            15   -0.00209072 -0.00172308           -0 -8.65517E-16       0
      

          -- 6 --      -- 7 -- -- 8 --      -- 9 --     -- 10 --
             1   0.549926 -7.88204E-16       0            0 -5.10457E-16
             2    2.77214 -4.20928E-15       0 -8.18142E-16 -6.26457E-16
             3     -1.826  2.68321E-15       0            0  4.82834E-15
                      ...          ...     ...          ...          ...
            13   0.224421            0       0            0    -0.995373
            14         -0            0       0            0  -0.00304009
            15   0.224421            0       0            0     0.534433
      

             -- 11 --    -- 12 --     -- 13 --    -- 14 -- -- 15 --
             1   -8.47272E-16 4.18722E-16            0           0 0.516133
             2   -7.29877E-15 3.26085E-15 -5.13582E-16           0  4.52711
             3   -1.53999E-15           0            0           0  1.08073
                          ...         ...          ...         ...      ...
            13      0.0741226   0.0584492     -0.01795 0.000120624 -1.45115
            14     0.00668622    0.201298     0.848372   -0.489582        0
            15       0.750441   -0.380516    0.0792247  -0.0122393 -1.45115
      
Out[7]:
val hf : HartreeFock.t = 
======================================================================
                        Restricted Hartree-Fock                      
======================================================================

    ------------------------------------------------------------
        #     HF energy       Convergence  HOMO-LUMO
    ------------------------------------------------------------
        1    -14.05142130      8.0958e-01     0.2991
        2    -14.51982122      2.7933e-01     0.3600
        3    -14.56519147      8.3990e-02     0.3674
        4    -14.57117146      2.6217e-02     0.3679
        5    -14.57214606      1.0744e-02     0.3676
        6    -14.57232209      5.0392e-03     0.3675
        7    -14.57235521      2.2956e-03     0.3674
        8    -14.57236154      1.0293e-03     0.3673
        9    -14.57236304      4.1738e-08     0.3673
       10    -14.57236304      4.9181e-09     0.3673
    ------------------------------------------------------------


    ============================================================
               One-electron energy  -19.0610711155
                           Kinetic   14.5598880887
                         Potential  -33.6209592042
      --------------------------------------------------------  
               Two-electron energy    4.4887080772
                           Coulomb    7.1543328046
                          Exchange   -2.6656247274
      --------------------------------------------------------  
                           HF HOMO   -8.4100296422
                           HF LUMO    1.5842692336
                      HF LUMO-LUMO    9.9942988758
      --------------------------------------------------------  
               Electronic   energy  -14.5723630383
               Nuclear   repulsion    0.0000000000
               Hartree-Fock energy  -14.5723630383
    ============================================================
    

In [8]:
let ints = Simulation.ao_basis simulation
|> AOBasis.ee_ints ;;
ERI.get_phys ints 1 1 1 4
Out[8]:
val ints : ERI.t = <abstr>
Out[8]:
- : float = 0.
In [ ]:

</html>