From 1685e412584b4ee521cfb33571547b5fc52c037a Mon Sep 17 00:00:00 2001 From: Anthony Scemama Date: Fri, 21 May 2021 18:26:50 +0200 Subject: [PATCH] Added basis module for easy export --- data/basis/cc-pvdz | 2 +- ocaml/qp_create_ezfio.ml | 51 ++++++++++++++++++++++++++++++++++++++++ src/ao_basis/NEED | 1 + src/ao_basis/aos.irp.f | 33 -------------------------- src/basis/EZFIO.cfg | 28 +++++++++++++++++----- 5 files changed, 75 insertions(+), 40 deletions(-) diff --git a/data/basis/cc-pvdz b/data/basis/cc-pvdz index 3d1a77e6..156e46ac 100644 --- a/data/basis/cc-pvdz +++ b/data/basis/cc-pvdz @@ -3606,4 +3606,4 @@ D 5 5 1.507524E+00 2.667560E-01 D 1 1 5.030000E-01 1.000000E+00 -$END \ No newline at end of file +$END diff --git a/ocaml/qp_create_ezfio.ml b/ocaml/qp_create_ezfio.ml index 6a4a36a1..bf3018b3 100644 --- a/ocaml/qp_create_ezfio.ml +++ b/ocaml/qp_create_ezfio.ml @@ -562,6 +562,57 @@ let run ?o b au c d m p cart xyz_file = and ao_expo = create_expo_coef `Expos in let () = + let shell_num = List.length basis in + let lc : (GaussianPrimitive.t * Qptypes.AO_coef.t) list list = + list_map ( fun (g,_) -> g.Gto.lc ) basis + in + let ang_mom = + list_map (fun (l : (GaussianPrimitive.t * Qptypes.AO_coef.t) list) -> + let x, _ = List.hd l in + Angmom.to_l x.GaussianPrimitive.sym |> Qptypes.Positive_int.to_int + ) lc + in + let expo = + list_map (fun l -> list_map (fun (x,_) -> Qptypes.AO_expo.to_float x.GaussianPrimitive.expo) l ) lc + |> List.concat + in + let coef = + list_map (fun l -> + list_map (fun (_,x) -> Qptypes.AO_coef.to_float x) l + ) lc + |> List.concat + in + let shell_prim_num = + list_map List.length lc + in + let shell_prim_idx = + let rec aux count accu = function + | [] -> List.rev accu + | l::rest -> + let newcount = count+(List.length l) in + aux newcount (count::accu) rest + in + aux 1 [] lc + in + let prim_num = List.length coef in + Ezfio.set_basis_typ "Gaussian"; + Ezfio.set_basis_shell_num shell_num; + Ezfio.set_basis_prim_num prim_num ; + Ezfio.set_basis_shell_prim_num (Ezfio.ezfio_array_of_list + ~rank:1 ~dim:[| shell_num |] ~data:shell_prim_num); + Ezfio.set_basis_shell_ang_mom (Ezfio.ezfio_array_of_list + ~rank:1 ~dim:[| shell_num |] ~data:ang_mom ) ; + Ezfio.set_basis_shell_prim_index (Ezfio.ezfio_array_of_list + ~rank:1 ~dim:[| shell_num |] ~data:shell_prim_idx) ; + Ezfio.set_basis_shell_nucl (Ezfio.ezfio_array_of_list + ~rank:1 ~dim:[| shell_num |] + ~data:(list_map (fun (_,n) -> Nucl_number.to_int n) basis) ) ; + Ezfio.set_basis_shell_prim_coef (Ezfio.ezfio_array_of_list + ~rank:1 ~dim:[| prim_num |] ~data:coef) ; + Ezfio.set_basis_shell_prim_expo (Ezfio.ezfio_array_of_list + ~rank:1 ~dim:[| prim_num |] ~data:expo) ; + + Ezfio.set_ao_basis_ao_prim_num (Ezfio.ezfio_array_of_list ~rank:1 ~dim:[| ao_num |] ~data:ao_prim_num) ; Ezfio.set_ao_basis_ao_nucl(Ezfio.ezfio_array_of_list diff --git a/src/ao_basis/NEED b/src/ao_basis/NEED index d2066b18..a69fe768 100644 --- a/src/ao_basis/NEED +++ b/src/ao_basis/NEED @@ -1 +1,2 @@ nuclei +basis diff --git a/src/ao_basis/aos.irp.f b/src/ao_basis/aos.irp.f index e95ac711..a8384ad4 100644 --- a/src/ao_basis/aos.irp.f +++ b/src/ao_basis/aos.irp.f @@ -56,39 +56,6 @@ END_PROVIDER END_PROVIDER -BEGIN_PROVIDER [ double precision, ao_coef_normalization_libint_factor, (ao_num) ] - implicit none - BEGIN_DOC - ! |AO| normalization for interfacing with libint - END_DOC - double precision :: norm,overlap_x,overlap_y,overlap_z,C_A(3), c - integer :: l, powA(3), nz - integer :: i,j,k - nz=100 - C_A(1) = 0.d0 - C_A(2) = 0.d0 - C_A(3) = 0.d0 - - do i=1,ao_num - powA(1) = ao_l(i) - powA(2) = 0 - powA(3) = 0 - - ! Normalization of the contracted basis functions - norm = 0.d0 - do j=1,ao_prim_num(i) - do k=1,ao_prim_num(i) - call overlap_gaussian_xyz(C_A,C_A,ao_expo(i,j),ao_expo(i,k),powA,powA,overlap_x,overlap_y,overlap_z,c,nz) - norm = norm+c*ao_coef_normalized(i,j)*ao_coef_normalized(i,k) - enddo - enddo - ao_coef_normalization_libint_factor(i) = ao_coef_normalization_factor(i) * sqrt(norm) - - enddo - -END_PROVIDER - - BEGIN_PROVIDER [ double precision, ao_coef_normalized_ordered, (ao_num,ao_prim_num_max) ] &BEGIN_PROVIDER [ double precision, ao_expo_ordered, (ao_num,ao_prim_num_max) ] implicit none diff --git a/src/basis/EZFIO.cfg b/src/basis/EZFIO.cfg index d560a291..57bd427b 100644 --- a/src/basis/EZFIO.cfg +++ b/src/basis/EZFIO.cfg @@ -1,7 +1,12 @@ [basis] type: character*(256) doc: Name of the |AO| basis set -interface: ezfio +interface: ezfio, provider + +[typ] +type: character*(32) +doc: Type of basis set. Only 'Gaussian' is supported +interface: ezfio, provider [shell_num] type: integer @@ -14,9 +19,20 @@ doc: Number of primitives per |AO| size: (basis.shell_num) interface: ezfio, provider +[prim_num] +type: integer +doc: Total number of primitives +interface: ezfio, provider + +[shell_ang_mom] +type: integer +doc: Angular momentum of each shell +size: (basis.shell_num) +interface: ezfio, provider + [shell_prim_num] type: integer -doc: Max number of primitives in a shell +doc: Number of primitives in a shell size: (basis.shell_num) interface: ezfio, provider @@ -32,16 +48,16 @@ doc: Index of the nucleus on which the shell is centered size: (basis.shell_num) interface: ezfio, provider -[shell_coef] +[shell_prim_coef] type: double precision doc: Primitive coefficients -size: (basis.shell_prim_num) +size: (basis.prim_num) interface: ezfio, provider -[shell_expo] +[shell_prim_expo] type: double precision doc: Exponents in the shell -size: (basis.shell_prim_num) +size: (basis.prim_num) interface: ezfio, provider