From 7fe02354f2756f94a237cc5fa659a9e81936b869 Mon Sep 17 00:00:00 2001 From: Anthony Scemama Date: Fri, 8 May 2020 00:40:13 +0200 Subject: [PATCH] Added range_separation and f12 to Basis --- Basis/Basis.ml | 27 ++++++++++++++++----------- Basis/Basis.mli | 18 ++++++++++++++---- 2 files changed, 30 insertions(+), 15 deletions(-) diff --git a/Basis/Basis.ml b/Basis/Basis.ml index 9a3302f..3f417b6 100644 --- a/Basis/Basis.ml +++ b/Basis/Basis.ml @@ -4,6 +4,8 @@ type t = contracted_shells : ContractedShell.t array ; atomic_shells : AtomicShell.t array lazy_t; general_basis : GeneralBasis.t ; + range_separation : float option ; + f12 : F12factor.t option ; } module As = AtomicShell @@ -14,7 +16,7 @@ module Ps = PrimitiveShell let general_basis t = t.general_basis (** Returns an array of the basis set per atom *) -let of_nuclei_and_general_basis nucl bas = +let of_nuclei_and_general_basis ?f12 ?range_separation nucl bas = let index_ = ref 0 in let contracted_shells = Array.map (fun (e, center) -> @@ -52,15 +54,18 @@ let of_nuclei_and_general_basis nucl bas = |> Array.of_list ) in { contracted_shells ; atomic_shells ; size = !index_; - general_basis = bas } + general_basis = bas ; f12 ; range_separation } -let size x = x.size +let size t = t.size -let atomic_shells x = Lazy.force x.atomic_shells +let atomic_shells t = Lazy.force t.atomic_shells -let contracted_shells x = x.contracted_shells +let contracted_shells t = t.contracted_shells +let range_separation t = t.range_separation + +let f12 t = t.f12 let to_string b = @@ -87,24 +92,24 @@ let to_string b = -let of_nuclei_and_basis_filename ~nuclei filename = +let of_nuclei_and_basis_filename ?f12 ?range_separation ~nuclei filename = let general_basis = GeneralBasis.read filename in - of_nuclei_and_general_basis nuclei general_basis + of_nuclei_and_general_basis ?f12 ?range_separation nuclei general_basis -let of_nuclei_and_basis_string ~nuclei str = +let of_nuclei_and_basis_string ?f12 ?range_separation ~nuclei str = let general_basis = GeneralBasis.of_string str in - of_nuclei_and_general_basis nuclei general_basis + of_nuclei_and_general_basis ?f12 ?range_separation nuclei general_basis -let of_nuclei_and_basis_filenames ~nuclei filenames = +let of_nuclei_and_basis_filenames ?f12 ?range_separation ~nuclei filenames = let general_basis = GeneralBasis.read_many filenames in - of_nuclei_and_general_basis nuclei general_basis + of_nuclei_and_general_basis ?f12 ?range_separation nuclei general_basis let pp ppf t = diff --git a/Basis/Basis.mli b/Basis/Basis.mli index ea9297e..f9cac65 100644 --- a/Basis/Basis.mli +++ b/Basis/Basis.mli @@ -3,7 +3,8 @@ type t -val of_nuclei_and_general_basis : Nuclei.t -> GeneralBasis.t -> t +val of_nuclei_and_general_basis : ?f12:F12factor.t -> ?range_separation:float -> + Nuclei.t -> GeneralBasis.t -> t (** Takes an array of {!Nuclei.t}, and a {!GeneralBasis.t} (such as cc-pVDZ for instance) and creates the corresponding atomic basis set. All the {!Element.t}'s of the array of {!Nuclei.t} are searched in @@ -13,17 +14,20 @@ val of_nuclei_and_general_basis : Nuclei.t -> GeneralBasis.t -> t *) -val of_nuclei_and_basis_filename : nuclei:Nuclei.t -> string -> t +val of_nuclei_and_basis_filename : ?f12:F12factor.t -> ?range_separation:float -> + nuclei:Nuclei.t -> string -> t (** Same as {!of_nuclei_and_general_basis}, but taking the {!GeneralBasis.t} from a file. *) -val of_nuclei_and_basis_string : nuclei:Nuclei.t -> string -> t +val of_nuclei_and_basis_string : ?f12:F12factor.t -> ?range_separation:float -> + nuclei:Nuclei.t -> string -> t (** Same as {!of_nuclei_and_general_basis}, but taking the {!GeneralBasis.t} from a string. *) -val of_nuclei_and_basis_filenames : nuclei:Nuclei.t -> string list -> t +val of_nuclei_and_basis_filenames : ?f12:F12factor.t -> ?range_separation:float -> + nuclei:Nuclei.t -> string list -> t (** Same as {!of_nuclei_and_general_basis}, but taking the {!GeneralBasis.t} from multiple files. *) @@ -41,6 +45,12 @@ val contracted_shells : t -> ContractedShell.t array val general_basis : t -> GeneralBasis.t (** Returns the [!GeneralBasis] that was used to build the current basis. *) +val f12 : t -> F12factor.t option +(** Returns the explicit correlation factor if present. *) + +val range_separation : t -> float option +(** Returns the electron-electrons interaction range-separation value if present. *) + (** {2 Printers} *) val to_string : t -> string