mirror of
https://gitlab.com/scemama/QCaml.git
synced 2024-08-31 00:33:40 +02:00
49 lines
1.3 KiB
OCaml
49 lines
1.3 KiB
OCaml
|
type t =
|
||
|
{
|
||
|
n_alfa : int ;
|
||
|
n_beta : int ;
|
||
|
mo_class : MOClass.t ;
|
||
|
mo_basis : MOBasis.t ;
|
||
|
determinants : Determinant.t array;
|
||
|
}
|
||
|
|
||
|
module Ss = Spindeterminant_space
|
||
|
|
||
|
let n_alfa t = t.n_alfa
|
||
|
let n_beta t = t.n_beta
|
||
|
let mo_class t = t.mo_class
|
||
|
let mo_basis t = t.mo_basis
|
||
|
let determinants t = t.determinants
|
||
|
|
||
|
let fci_of_mo_basis ?(frozen_core=true) mo_basis =
|
||
|
let s = MOBasis.simulation mo_basis in
|
||
|
let e = Simulation.electrons s in
|
||
|
let n_alfa = Electrons.n_alfa e
|
||
|
and n_beta = Electrons.n_beta e in
|
||
|
let det_a =
|
||
|
Ss.fci_of_mo_basis ~frozen_core mo_basis n_alfa
|
||
|
and det_b =
|
||
|
Ss.fci_of_mo_basis ~frozen_core mo_basis n_beta
|
||
|
in
|
||
|
let mo_class = Ss.mo_class det_a in
|
||
|
let determinants =
|
||
|
let a = Ss.spin_determinants det_a
|
||
|
and b = Ss.spin_determinants det_b
|
||
|
in
|
||
|
let sb = Ss.size det_b in
|
||
|
Array.to_list a
|
||
|
|> List.map (fun a_i ->
|
||
|
Array.init sb (fun j ->
|
||
|
Determinant.of_spindeterminants a_i b.(j)) )
|
||
|
|> Array.concat
|
||
|
in
|
||
|
{ n_alfa ; n_beta ; mo_class ; mo_basis ; determinants }
|
||
|
|
||
|
|
||
|
let pp_det_space ppf t =
|
||
|
Format.fprintf ppf "@[<v 2>[ ";
|
||
|
Array.iteri (fun i d -> Format.fprintf ppf "@[<v>@[%8d@]@;@[%a@]@]@;" i
|
||
|
(Determinant.pp_det (MOBasis.size (mo_basis t))) d) t.determinants ;
|
||
|
Format.fprintf ppf "]@]"
|
||
|
|