Added basis module for easy export

This commit is contained in:
Anthony Scemama 2021-05-21 18:26:50 +02:00
parent 68b33e4b35
commit 1685e41258
5 changed files with 75 additions and 40 deletions

View File

@ -3606,4 +3606,4 @@ D 5
5 1.507524E+00 2.667560E-01
D 1
1 5.030000E-01 1.000000E+00
$END
$END

View File

@ -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

View File

@ -1 +1,2 @@
nuclei
basis

View File

@ -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

View File

@ -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