10
0
mirror of https://github.com/QuantumPackage/qp2.git synced 2024-11-19 12:32:30 +01:00

Improvements to read cholesky integrals from a trexio file

This commit is contained in:
Anthony Scemama 2024-10-04 21:52:05 +02:00
parent 13ae95fac5
commit b3930d977a
5 changed files with 157 additions and 115 deletions

View File

@ -58,26 +58,36 @@ end = struct
;;
let read_ao_prim_num () =
if Ezfio.has_ao_basis_ao_prim_num () then
Ezfio.get_ao_basis_ao_prim_num ()
|> Ezfio.flattened_ezfio
|> Array.map AO_prim_number.of_int
else
[||]
;;
let read_ao_prim_num_max () =
if Ezfio.has_ao_basis_ao_prim_num () then
Ezfio.get_ao_basis_ao_prim_num ()
|> Ezfio.flattened_ezfio
|> Array.fold_left (fun x y -> if x>y then x else y) 0
|> AO_prim_number.of_int
else
AO_prim_number.of_int 0
;;
let read_ao_nucl () =
if Ezfio.has_ao_basis_ao_nucl () then
let nmax = Nucl_number.get_max () in
Ezfio.get_ao_basis_ao_nucl ()
|> Ezfio.flattened_ezfio
|> Array.map (fun x-> Nucl_number.of_int ~max:nmax x)
else
[||]
;;
let read_ao_power () =
if Ezfio.has_ao_basis_ao_power () then
let x = Ezfio.get_ao_basis_ao_power () in
let dim = x.Ezfio.dim.(0) in
let data = Ezfio.flattened_ezfio x in
@ -92,18 +102,26 @@ end = struct
result.(i-1) <- result.(i-1)^"z"^(string_of_int data.(2*dim+i-1));
done;
Array.map Angmom.Xyz.of_string result
else
[||]
;;
let read_ao_coef () =
if Ezfio.has_ao_basis_ao_coef () then
Ezfio.get_ao_basis_ao_coef ()
|> Ezfio.flattened_ezfio
|> Array.map AO_coef.of_float
else
[||]
;;
let read_ao_expo () =
if Ezfio.has_ao_basis_ao_expo () then
Ezfio.get_ao_basis_ao_expo ()
|> Ezfio.flattened_ezfio
|> Array.map AO_expo.of_float
else
[||]
;;
let read_ao_cartesian () =

View File

@ -79,7 +79,7 @@ END_PROVIDER
type(mmap_type) :: map
PROVIDE nproc ao_cholesky_threshold do_direct_integrals qp_max_mem
PROVIDE nucl_coord ao_two_e_integral_schwartz
PROVIDE nucl_coord
call set_multiple_levels_omp(.False.)
call wall_time(wall0)

View File

@ -1,6 +1,22 @@
! ---
logical function do_schwartz_accel(i,j,k,l)
implicit none
BEGIN_DOC
! If true, use Schwatrz to accelerate direct integral calculation
END_DOC
integer, intent(in) :: i, j, k, l
if (do_ao_cholesky) then
do_schwartz_accel = .False.
else
do_schwartz_accel = (ao_prim_num(i) * ao_prim_num(j) * &
ao_prim_num(k) * ao_prim_num(l) > 1024 )
endif
end function
double precision function ao_two_e_integral(i, j, k, l)
BEGIN_DOC
@ -25,6 +41,7 @@ double precision function ao_two_e_integral(i, j, k, l)
double precision, external :: ao_two_e_integral_cosgtos
double precision, external :: ao_two_e_integral_schwartz_accel
logical, external :: do_schwartz_accel
if(use_cosgtos) then
!print *, ' use_cosgtos for ao_two_e_integral ?', use_cosgtos
@ -35,7 +52,7 @@ double precision function ao_two_e_integral(i, j, k, l)
ao_two_e_integral = ao_two_e_integral_erf(i, j, k, l)
else if (ao_prim_num(i) * ao_prim_num(j) * ao_prim_num(k) * ao_prim_num(l) > 1024 ) then
else if (do_schwartz_accel(i,j,k,l)) then
ao_two_e_integral = ao_two_e_integral_schwartz_accel(i,j,k,l)

View File

@ -16,20 +16,20 @@ subroutine run
implicit none
call print_mol_properties
print *, psi_energy + nuclear_repulsion
! call print_energy_components
! print *, 'E(HF) = ', HF_energy
! print *, 'E(CI) = ', psi_energy + nuclear_repulsion
! print *, ''
! print *, 'E_kin(CI) = ', ref_bitmask_kinetic_energy
! print *, 'E_kin(HF) = ', HF_kinetic_energy
! print *, ''
! print *, 'E_ne (CI) = ', ref_bitmask_n_e_energy
! print *, 'E_ne (HF) = ', HF_n_e_energy
! print *, ''
! print *, 'E_1e (CI) = ', ref_bitmask_one_e_energy
! print *, 'E_1e (HF) = ', HF_one_electron_energy
! print *, ''
! print *, 'E_2e (CI) = ', ref_bitmask_two_e_energy
! print *, 'E_2e (HF) = ', HF_two_electron_energy
call print_energy_components
print *, 'E(HF) = ', HF_energy
print *, 'E(CI) = ', psi_energy + nuclear_repulsion
print *, ''
print *, 'E_kin(CI) = ', ref_bitmask_kinetic_energy
print *, 'E_kin(HF) = ', HF_kinetic_energy
print *, ''
print *, 'E_ne (CI) = ', ref_bitmask_n_e_energy
print *, 'E_ne (HF) = ', HF_n_e_energy
print *, ''
print *, 'E_1e (CI) = ', ref_bitmask_one_e_energy
print *, 'E_1e (HF) = ', HF_one_electron_energy
print *, ''
print *, 'E_2e (CI) = ', ref_bitmask_two_e_energy
print *, 'E_2e (HF) = ', HF_two_electron_energy
end

View File

@ -46,6 +46,8 @@ subroutine run(f)
double precision, allocatable :: tmp(:,:,:)
integer*8 :: offset, icount
integer :: k_num
integer, external :: getUnitAndOpen
if (trexio_has_nucleus_repulsion(f) == TREXIO_SUCCESS) then
@ -163,7 +165,8 @@ subroutine run(f)
deallocate(Vi, V, tmp)
print *, 'Cholesky AO integrals read from TREXIO file'
endif
else
rc = trexio_has_ao_2e_int_eri(f)
if (rc /= TREXIO_HAS_NOT) then
@ -204,6 +207,7 @@ subroutine run(f)
deallocate(buffer_i, buffer_values, Vi, V)
print *, 'AO integrals read from TREXIO file'
endif
endif
else
print *, 'AO integrals not found in TREXIO file'
endif
@ -270,7 +274,8 @@ subroutine run(f)
deallocate(Vi, V, tmp)
print *, 'Cholesky MO integrals read from TREXIO file'
endif
else
rc = trexio_has_mo_2e_int_eri(f)
if (rc /= TREXIO_HAS_NOT) then
@ -310,6 +315,8 @@ subroutine run(f)
print *, 'MO integrals read from TREXIO file'
endif
endif
else
print *, 'MO integrals not found in TREXIO file'
endif