mirror of
https://gitlab.com/scemama/QCaml.git
synced 2024-08-30 16:23:41 +02:00
Cleaned AO Basis
This commit is contained in:
parent
8454863e91
commit
ccb4967993
@ -12,6 +12,16 @@ type t =
|
|||||||
cartesian : bool;
|
cartesian : bool;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let basis t = t.basis
|
||||||
|
let overlap t = Lazy.force t.overlap
|
||||||
|
let ortho t = Lazy.force t.ortho
|
||||||
|
let eN_ints t = Lazy.force t.eN_ints
|
||||||
|
let ee_ints t = Lazy.force t.ee_ints
|
||||||
|
let kin_ints t = Lazy.force t.kin_ints
|
||||||
|
let cartesian t = t.cartesian
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
let make ~cartesian ~basis nuclei =
|
let make ~cartesian ~basis nuclei =
|
||||||
|
|
||||||
let overlap = lazy (
|
let overlap = lazy (
|
||||||
|
@ -1,16 +1,32 @@
|
|||||||
(** Data structure for Atomic Orbitals. *)
|
(** Data structure for Atomic Orbitals. *)
|
||||||
|
|
||||||
type t = private
|
type t
|
||||||
{
|
|
||||||
basis : Basis.t ; (* One-electron basis set *)
|
|
||||||
overlap : Overlap.t lazy_t; (* Overlap matrix *)
|
|
||||||
ortho : Orthonormalization.t lazy_t; (* Orthonormalization matrix of the overlap *)
|
|
||||||
eN_ints : NucInt.t lazy_t; (* Electron-nucleus potential integrals *)
|
|
||||||
ee_ints : ERI.t lazy_t; (* Electron-electron potential integrals *)
|
|
||||||
kin_ints : KinInt.t lazy_t; (* Kinetic energy integrals *)
|
|
||||||
cartesian : bool ; (* If true, use cartesian Gaussians (6d, 10f, ...) *)
|
|
||||||
}
|
|
||||||
|
|
||||||
|
(** {1 Accessors} *)
|
||||||
|
|
||||||
|
val basis : t -> Basis.t
|
||||||
|
(** One-electron basis set *)
|
||||||
|
|
||||||
|
val overlap : t -> Overlap.t
|
||||||
|
(** Overlap matrix *)
|
||||||
|
|
||||||
|
val ortho : t -> Orthonormalization.t
|
||||||
|
(** Orthonormalization matrix of the overlap *)
|
||||||
|
|
||||||
|
val eN_ints : t -> NucInt.t
|
||||||
|
(** Electron-nucleus potential integrals *)
|
||||||
|
|
||||||
|
val ee_ints : t -> ERI.t
|
||||||
|
(** Electron-electron potential integrals *)
|
||||||
|
|
||||||
|
val kin_ints : t -> KinInt.t
|
||||||
|
(** Kinetic energy integrals *)
|
||||||
|
|
||||||
|
val cartesian : t -> bool
|
||||||
|
(** If true, use cartesian Gaussians (6d, 10f, ...) *)
|
||||||
|
|
||||||
|
|
||||||
|
(** {1 Creators} *)
|
||||||
|
|
||||||
val make : cartesian:bool -> basis:Basis.t -> Nuclei.t -> t
|
val make : cartesian:bool -> basis:Basis.t -> Nuclei.t -> t
|
||||||
(** Creates the data structure for atomic orbitals from a {Basis.t} and the
|
(** Creates the data structure for atomic orbitals from a {Basis.t} and the
|
||||||
@ -18,4 +34,5 @@ val make : cartesian:bool -> basis:Basis.t -> Nuclei.t -> t
|
|||||||
|
|
||||||
|
|
||||||
(** {2 Tests} *)
|
(** {2 Tests} *)
|
||||||
|
|
||||||
val test_case : t -> unit Alcotest.test_case list
|
val test_case : t -> unit Alcotest.test_case list
|
||||||
|
@ -130,19 +130,19 @@ let make ~simulation ~mo_type ~mo_occupation ~mo_coef () =
|
|||||||
Si.ao_basis simulation
|
Si.ao_basis simulation
|
||||||
in
|
in
|
||||||
let eN_ints = lazy (
|
let eN_ints = lazy (
|
||||||
Lazy.force ao_basis.AOBasis.eN_ints
|
AOBasis.eN_ints ao_basis
|
||||||
|> NucInt.matrix
|
|> NucInt.matrix
|
||||||
|> mo_matrix_of_ao_matrix ~mo_coef
|
|> mo_matrix_of_ao_matrix ~mo_coef
|
||||||
|> NucInt.of_matrix
|
|> NucInt.of_matrix
|
||||||
)
|
)
|
||||||
and kin_ints = lazy (
|
and kin_ints = lazy (
|
||||||
Lazy.force ao_basis.AOBasis.kin_ints
|
AOBasis.kin_ints ao_basis
|
||||||
|> KinInt.matrix
|
|> KinInt.matrix
|
||||||
|> mo_matrix_of_ao_matrix ~mo_coef
|
|> mo_matrix_of_ao_matrix ~mo_coef
|
||||||
|> KinInt.of_matrix
|
|> KinInt.of_matrix
|
||||||
)
|
)
|
||||||
and ee_ints = lazy (
|
and ee_ints = lazy (
|
||||||
Lazy.force ao_basis.AOBasis.ee_ints
|
AOBasis.ee_ints ao_basis
|
||||||
|> four_index_transform ~mo_coef
|
|> four_index_transform ~mo_coef
|
||||||
)
|
)
|
||||||
in
|
in
|
||||||
|
@ -18,9 +18,9 @@ module Ao = AOBasis
|
|||||||
|
|
||||||
let make ~density ?(threshold=Constants.epsilon) ao_basis =
|
let make ~density ?(threshold=Constants.epsilon) ao_basis =
|
||||||
let m_P = density
|
let m_P = density
|
||||||
and m_T = Lazy.force ao_basis.Ao.kin_ints |> KinInt.matrix
|
and m_T = Ao.kin_ints ao_basis |> KinInt.matrix
|
||||||
and m_V = Lazy.force ao_basis.Ao.eN_ints |> NucInt.matrix
|
and m_V = Ao.eN_ints ao_basis |> NucInt.matrix
|
||||||
and m_G = Lazy.force ao_basis.Ao.ee_ints
|
and m_G = Ao.ee_ints ao_basis
|
||||||
in
|
in
|
||||||
let nBas = Mat.dim1 m_T
|
let nBas = Mat.dim1 m_T
|
||||||
in
|
in
|
||||||
|
18
SCF/Guess.ml
18
SCF/Guess.ml
@ -12,19 +12,19 @@ module El = Electrons
|
|||||||
module Ov = Overlap
|
module Ov = Overlap
|
||||||
|
|
||||||
let hcore_guess ao_basis =
|
let hcore_guess ao_basis =
|
||||||
let eN_ints = Lazy.force ao_basis.Ao.eN_ints |> NucInt.matrix
|
let eN_ints = Ao.eN_ints ao_basis |> NucInt.matrix
|
||||||
and kin_ints = Lazy.force ao_basis.Ao.kin_ints |> KinInt.matrix
|
and kin_ints = Ao.kin_ints ao_basis |> KinInt.matrix
|
||||||
in
|
in
|
||||||
Mat.add eN_ints kin_ints
|
Mat.add eN_ints kin_ints
|
||||||
|
|
||||||
|
|
||||||
let huckel_guess ao_basis =
|
let huckel_guess ao_basis =
|
||||||
let c = 0.5 *. 1.75 in
|
let c = 0.5 *. 1.75 in
|
||||||
let ao_num = Basis.size ao_basis.Ao.basis in
|
let ao_num = Ao.basis ao_basis |> Basis.size in
|
||||||
let eN_ints = Lazy.force ao_basis.Ao.eN_ints |> NucInt.matrix
|
let eN_ints = Ao.eN_ints ao_basis |> NucInt.matrix
|
||||||
and kin_ints = Lazy.force ao_basis.Ao.kin_ints |> KinInt.matrix
|
and kin_ints = Ao.kin_ints ao_basis |> KinInt.matrix
|
||||||
and overlap = Lazy.force ao_basis.Ao.overlap |> Ov.matrix
|
and overlap = Ao.overlap ao_basis |> Ov.matrix
|
||||||
and m_X = Lazy.force ao_basis.Ao.ortho
|
and m_X = Ao.ortho ao_basis
|
||||||
in
|
in
|
||||||
let diag = Array.init (ao_num+1) (fun i -> if i=0 then 0. else
|
let diag = Array.init (ao_num+1) (fun i -> if i=0 then 0. else
|
||||||
eN_ints.{i,i} +. kin_ints.{i,i})
|
eN_ints.{i,i} +. kin_ints.{i,i})
|
||||||
@ -62,8 +62,8 @@ let test_case ao_basis =
|
|||||||
let a = Lacaml.D.Mat.to_array matrix in
|
let a = Lacaml.D.Mat.to_array matrix in
|
||||||
let reference =
|
let reference =
|
||||||
Lacaml.D.Mat.add
|
Lacaml.D.Mat.add
|
||||||
(Lazy.force ao_basis.AOBasis.eN_ints |> NucInt.matrix)
|
(AOBasis.eN_ints ao_basis |> NucInt.matrix)
|
||||||
(Lazy.force ao_basis.AOBasis.kin_ints |> KinInt.matrix)
|
(AOBasis.kin_ints ao_basis |> KinInt.matrix)
|
||||||
|> Lacaml.D.Mat.to_array
|
|> Lacaml.D.Mat.to_array
|
||||||
in
|
in
|
||||||
Array.iteri (fun i x ->
|
Array.iteri (fun i x ->
|
||||||
|
@ -30,18 +30,18 @@ let make ?guess:(guess=`Huckel) ?max_scf:(max_scf=64) ?level_shift:(level_shift=
|
|||||||
|
|
||||||
(* Orthogonalization matrix *)
|
(* Orthogonalization matrix *)
|
||||||
let m_X =
|
let m_X =
|
||||||
Lazy.force ao_basis.Ao.ortho
|
Ao.ortho ao_basis
|
||||||
in
|
in
|
||||||
|
|
||||||
|
|
||||||
(* Overlap matrix *)
|
(* Overlap matrix *)
|
||||||
let m_S =
|
let m_S =
|
||||||
Lazy.force ao_basis.Ao.overlap
|
Ao.overlap ao_basis
|
||||||
|> Ov.matrix
|
|> Ov.matrix
|
||||||
in
|
in
|
||||||
|
|
||||||
let m_T = Lazy.force ao_basis.Ao.kin_ints |> KinInt.matrix
|
let m_T = Ao.kin_ints ao_basis |> KinInt.matrix
|
||||||
and m_V = Lazy.force ao_basis.Ao.eN_ints |> NucInt.matrix
|
and m_V = Ao.eN_ints ao_basis |> NucInt.matrix
|
||||||
in
|
in
|
||||||
|
|
||||||
(* Level shift in MO basis *)
|
(* Level shift in MO basis *)
|
||||||
|
@ -37,10 +37,10 @@ let run ~out =
|
|||||||
print_endline @@ Basis.to_string @@ Simulation.basis s;
|
print_endline @@ Basis.to_string @@ Simulation.basis s;
|
||||||
|
|
||||||
let ao_basis = Simulation.ao_basis s in
|
let ao_basis = Simulation.ao_basis s in
|
||||||
let overlap = Lazy.force ao_basis.AOBasis.overlap in
|
let overlap = AOBasis.overlap ao_basis in
|
||||||
let eN_ints = Lazy.force ao_basis.AOBasis.eN_ints in
|
let eN_ints = AOBasis.eN_ints ao_basis in
|
||||||
let kin_ints = Lazy.force ao_basis.AOBasis.kin_ints in
|
let kin_ints = AOBasis.kin_ints ao_basis in
|
||||||
let ee_ints = Lazy.force ao_basis.AOBasis.ee_ints in
|
let ee_ints = AOBasis.ee_ints ao_basis in
|
||||||
Overlap.to_file ~filename:(out_file^".overlap") overlap;
|
Overlap.to_file ~filename:(out_file^".overlap") overlap;
|
||||||
NucInt.to_file ~filename:(out_file^".nuc") eN_ints;
|
NucInt.to_file ~filename:(out_file^".nuc") eN_ints;
|
||||||
KinInt.to_file ~filename:(out_file^".kin") kin_ints;
|
KinInt.to_file ~filename:(out_file^".kin") kin_ints;
|
||||||
|
Loading…
Reference in New Issue
Block a user