type t = { charge : Charge.t; electrons : Electrons.t ; basis : Basis.t; nuclei : Nuclei.t; overlap : Overlap.t lazy_t; overlap_ortho : Orthonormalization.t lazy_t; eN_ints : NucInt.t lazy_t; kin_ints : KinInt.t lazy_t; ee_ints : ERI.t lazy_t; nuclear_repulsion : float; } let make ?multiplicity:(multiplicity=1) ?charge:(charge=0) ~nuclei basis = let electrons = Electrons.make ~multiplicity ~charge nuclei in let charge = Array.fold_left (fun accu (e, _) -> accu + Charge.to_int (Element.to_charge e) ) 0 nuclei - Electrons.(electrons.n_alpha + electrons.n_beta) |> Charge.of_int in let overlap = lazy (Overlap.of_basis basis) in { charge ; basis ; nuclei ; electrons ; overlap ; overlap_ortho = lazy (Orthonormalization.make (Lazy.force overlap)); eN_ints = lazy (NucInt.of_basis_nuclei basis nuclei); kin_ints = lazy (KinInt.of_basis basis); ee_ints = lazy (ERI.of_basis basis); nuclear_repulsion = Nuclei.repulsion nuclei; } let of_filenames ?multiplicity:(multiplicity=1) ?charge:(charge=0) ~nuclei basis = let nuclei = Nuclei.of_filename ~filename:nuclei in let basis = Basis.of_nuclei_and_basis_filename ~nuclei ~filename:basis in make ~charge ~multiplicity ~nuclei basis