10
1
mirror of https://gitlab.com/scemama/QCaml.git synced 2024-12-22 20:33:36 +01:00
QCaml/ao/lib/basis.ml

175 lines
3.6 KiB
OCaml

type t =
{ ao_basis : Basis_poly.t ;
cartesian : bool
}
type ao = Ao_dim.t
open Linear_algebra
open Common
let not_implemented () =
Util.not_implemented "Only Gaussian is implemented"
let of_nuclei_and_basis_string ?(kind=`Gaussian) ?operators ?(cartesian=false)
~nuclei filename =
match kind with
| `Gaussian ->
let basis =
Gaussian.Basis.of_nuclei_and_basis_string ~nuclei filename
in
let ao_basis =
Basis_poly.Gaussian (Basis_gaussian.make ~basis ?operators ~cartesian nuclei )
in
{ ao_basis ; cartesian }
| _ -> not_implemented ()
let of_nuclei_and_basis_filename ?(kind=`Gaussian) ?operators ?(cartesian=false)
~nuclei filename =
match kind with
| `Gaussian ->
let basis =
Gaussian.Basis.of_nuclei_and_basis_filename ~nuclei filename
in
let ao_basis =
Basis_poly.Gaussian (Basis_gaussian.make ~basis ?operators ~cartesian nuclei )
in
{ ao_basis ; cartesian }
| _ -> not_implemented ()
let ao_basis t = t.ao_basis
let size t =
match t.ao_basis with
| Basis_poly.Gaussian b -> Basis_gaussian.size b
| _ -> not_implemented ()
let overlap t =
begin
match t.ao_basis with
| Basis_poly.Gaussian b -> Basis_gaussian.overlap b
| _ -> not_implemented ()
end
|> Matrix.relabel
let multipole t =
begin
match t.ao_basis with
| Basis_poly.Gaussian b ->
let m = Basis_gaussian.multipole b in
fun s ->
Gaussian_integrals.Multipole.matrix m s
|> Matrix.relabel
| _ -> not_implemented ()
end
let ortho t =
begin
match t.ao_basis with
| Basis_poly.Gaussian b -> Basis_gaussian.ortho b
| _ -> not_implemented ()
end
|> Matrix.relabel
let eN_ints t =
begin
match t.ao_basis with
| Basis_poly.Gaussian b -> Basis_gaussian.eN_ints b
| _ -> not_implemented ()
end
|> Matrix.relabel
let kin_ints t =
begin
match t.ao_basis with
| Basis_poly.Gaussian b -> Basis_gaussian.kin_ints b
| _ -> not_implemented ()
end
|> Matrix.relabel
let ee_ints t =
begin
match t.ao_basis with
| Basis_poly.Gaussian b -> Basis_gaussian.ee_ints b
| _ -> not_implemented ()
end
|> Four_idx_storage.relabel
let ee_lr_ints t =
begin
match t.ao_basis with
| Basis_poly.Gaussian b -> Basis_gaussian.ee_lr_ints b
| _ -> not_implemented ()
end
|> Four_idx_storage.relabel
let f12_ints t =
begin
match t.ao_basis with
| Basis_poly.Gaussian b -> Basis_gaussian.f12_ints b
| _ -> not_implemented ()
end
|> Four_idx_storage.relabel
let f12_over_r12_ints t =
begin
match t.ao_basis with
| Basis_poly.Gaussian b -> Basis_gaussian.f12_over_r12_ints b
| _ -> not_implemented ()
end
|> Four_idx_storage.relabel
let cartesian t = t.cartesian
let values t point =
begin
match t.ao_basis with
| Basis_poly.Gaussian b -> Basis_gaussian.values b point
| _ -> not_implemented ()
end
|> Vector.relabel
(*
let of_trexio f =
match Trexio.read_basis_type f with
| "G"
| "Gaussian"
| "gaussian" ->
let basis =
Gaussian.Basis.of_trexio f
in
let ao_basis =
Basis_poly.Gaussian (Basis_gaussian.make ~basis ?operators ~cartesian nuclei )
in
{ ao_basis ; cartesian }
| _ -> not_implemented ()
let to_trexio f t =
match t.ao_basis with
| Basis_poly.Gaussian b -> Gaussian.Basis.to_trexio f (Basis_gaussian.basis b))
| _ -> not_implemented ()
*)
let pp ppf t =
begin
match t.ao_basis with
| Basis_poly.Gaussian b -> Basis_gaussian.pp ppf b
| _ -> not_implemented ()
end