10
1
mirror of https://gitlab.com/scemama/QCaml.git synced 2024-11-15 02:23:39 +01:00
QCaml/CI/Determinant_space.ml

50 lines
1.3 KiB
OCaml
Raw Normal View History

2019-02-20 19:43:16 +01:00
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
2019-02-22 00:18:32 +01:00
let size t = Array.length t.determinants
2019-02-20 19:43:16 +01:00
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 "]@]"