1
0
mirror of https://gitlab.com/scemama/qp_plugins_scemama.git synced 2024-11-07 14:43:41 +01:00

Update trexio module

This commit is contained in:
Anthony Scemama 2022-04-11 23:05:24 +02:00
parent d8a7caf967
commit 04f6220317
4 changed files with 88 additions and 219 deletions

View File

@ -21,13 +21,12 @@ subroutine run
call system('rm -rf '//trim(trexio_filename)//'.bak')
call system('mv '//trim(trexio_filename)//' '//trim(trexio_filename)//'.bak')
! call system('mv '//trim(trexio_filename)//' '//trim(trexio_filename)''//.bak)
if (backend == 0) then
f = trexio_open(trexio_filename, 'w', TREXIO_HDF5, rc)
else if (backend == 1) then
f = trexio_open(trexio_filename, 'w', TREXIO_TEXT, rc)
endif
if (f == 0) then
if (f == 0_8) then
print *, 'Unable to open TREXIO file for writing'
print *, 'rc = ', rc
stop -1
@ -270,10 +269,7 @@ subroutine run
call check_success(rc)
if (do_pseudo) then
rc = trexio_write_ao_1e_int_ecp_local(f,ao_pseudo_integrals_local)
call check_success(rc)
rc = trexio_write_ao_1e_int_ecp_non_local(f,ao_pseudo_integrals_non_local)
rc = trexio_write_ao_1e_int_ecp(f, ao_pseudo_integrals_local + ao_pseudo_integrals_non_local)
call check_success(rc)
endif
@ -355,10 +351,7 @@ subroutine run
call check_success(rc)
if (do_pseudo) then
rc = trexio_write_mo_1e_int_ecp_local(f,mo_pseudo_integrals_local)
call check_success(rc)
rc = trexio_write_mo_1e_int_ecp_non_local(f,mo_pseudo_integrals_non_local)
rc = trexio_write_mo_1e_int_ecp(f,mo_pseudo_integrals_local)
call check_success(rc)
endif

View File

@ -13,14 +13,19 @@ subroutine run
integer(8) :: f ! TREXIO file handle
integer :: rc
integer ::i,j,k,l
integer ::i,j,k,l,m
double precision :: integral
double precision, allocatable :: A(:,:)
integer :: n_integrals
integer :: n_integrals
integer(key_kind), allocatable :: buffer_i(:)
real(integral_kind), allocatable :: buffer_values(:)
double precision, allocatable :: A(:,:)
double precision, allocatable :: V(:)
integer , allocatable :: Vi(:,:)
double precision, allocatable :: s
f = trexio_open(trexio_filename, 'r', TREXIO_AUTO, rc)
if (f == 0_8) then
print *, 'Unable to open TREXIO file for reading'
@ -29,10 +34,6 @@ subroutine run
endif
double precision, allocatable :: A(:,:)
double precision, allocatable :: V(:)
double precision, allocatable :: s
allocate(A(ao_num, ao_num))
if (trexio_has_nucleus_repulsion(f)) then
rc = trexio_read_nucleus_repulsion(f, s)
@ -45,6 +46,11 @@ subroutine run
call ezfio_set_nuclei_io_nuclear_repulsion('Read')
endif
! AO integrals
! ------------
allocate(A(ao_num, ao_num))
if (trexio_has_ao_1e_int_overlap(f) == TREXIO_SUCCESS) then
rc = trexio_read_ao_1e_int_overlap(f, A)
@ -68,16 +74,16 @@ subroutine run
call ezfio_set_ao_one_e_ints_io_ao_integrals_kinetic('Read')
endif
if (trexio_has_ao_1e_int_ecp(f) == TREXIO_SUCCESS) then
rc = trexio_read_ao_1e_int_ecp(f, A)
if (rc /= TREXIO_SUCCESS) then
print *, irp_here
print *, 'Error reading AO ECP local integrals'
stop -1
endif
call ezfio_set_ao_one_e_ints_ao_integrals_pseudo(A)
call ezfio_set_ao_one_e_ints_io_ao_integrals_pseudo('Read')
endif
! if (trexio_has_ao_1e_int_ecp(f) == TREXIO_SUCCESS) then
! rc = trexio_read_ao_1e_int_ecp(f, A)
! if (rc /= TREXIO_SUCCESS) then
! print *, irp_here
! print *, 'Error reading AO ECP local integrals'
! stop -1
! endif
! call ezfio_set_ao_one_e_ints_ao_integrals_pseudo(A)
! call ezfio_set_ao_one_e_ints_io_ao_integrals_pseudo('Read')
! endif
if (trexio_has_ao_1e_int_potential_n_e(f) == TREXIO_SUCCESS) then
rc = trexio_read_ao_1e_int_potential_n_e(f, A)
@ -90,47 +96,37 @@ subroutine run
call ezfio_set_ao_one_e_ints_io_ao_integrals_n_e('Read')
endif
deallocate(A)
! AO 2e integrals
! ---------------
allocate(buffer_i(ao_num**3), buffer_values(ao_num**3))
iunit = getunitandopen('W.qp','r')
n_integrals=0
i = 1
j = 1
k = 1
l = 1
buffer_values = 0.d0
do
read (iunit,*,end=13) i,j,k,l, integral
if (i<0 .or. i>ao_num) then
print *, i
stop 'i out of bounds in W.qp'
endif
if (j<0 .or. j>ao_num) then
print *, j
stop 'j out of bounds in W.qp'
endif
if (k<0 .or. k>ao_num) then
print *, k
stop 'k out of bounds in W.qp'
endif
if (l<0 .or. l>ao_num) then
print *, l
stop 'l out of bounds in W.qp'
endif
n_integrals += 1
call two_e_integrals_index(i, j, k, l, buffer_i(n_integrals) )
buffer_values(n_integrals) = integral
if (n_integrals == size(buffer_i)) then
call insert_into_ao_integrals_map(n_integrals,buffer_i,buffer_values)
n_integrals = 0
endif
enddo
13 continue
close(iunit)
allocate(Vi(4,ao_num**3), V(ao_num**3))
if (n_integrals > 0) then
call insert_into_ao_integrals_map(n_integrals,buffer_i,buffer_values)
endif
integer*8 :: offset, icount
offset = 0_8
icount = 0_8
rc = TREXIO_SUCCESS
do while (icount == size(V))
rc = trexio_read_ao_2e_int_eri(f, offset, icount, Vi, V)
if (rc /= TREXIO_SUCCESS) then
exit
endif
do m=1,icount
i = Vi(1,m)
j = Vi(2,m)
k = Vi(3,m)
l = Vi(4,m)
integral = V(m)
call two_e_integrals_index(i, j, k, l, buffer_i(m) )
buffer_values(m) = integral
enddo
call insert_into_ao_integrals_map(int(icount,4),buffer_i,buffer_values)
offset = offset + icount
end do
n_integrals = offset
call map_sort(ao_integrals_map)
call map_unique(ao_integrals_map)

View File

@ -245,10 +245,14 @@ def write_ezfio(trexio_filename, filename):
labels = { "Canonical" : "Canonical",
"RHF" : "Canonical",
"BOYS" : "Localized",
"ROHF" : "Canonical",
"UHF" : "Canonical",
"Natural": "Natural" }
label = labels[trexio.read_mo_type(trexio_file)]
try:
label = labels[trexio.read_mo_type(trexio_file)]
except:
label = "None"
ezfio.set_mo_basis_mo_label(label)
try:

View File

@ -117,7 +117,7 @@ character(len = 12) :: TREXIO_PACKAGE_VERSION = "2.2.0"
integer :: TREXIO_VERSION_MAJOR = 2
integer :: TREXIO_VERSION_MINOR = 2
integer :: TREXIO_VERSION_PATCH = 0
character(len = 64) :: TREXIO_GIT_HASH = "5834244b302daa1b283349404aaa35dd71c7b929"
character(len = 64) :: TREXIO_GIT_HASH = "eaeeee5e13f09a4738dedc295c100c32a291e9a6"
interface
integer(trexio_exit_code) function trexio_delete_metadata (trex_file) bind(C)
@ -528,19 +528,11 @@ interface
end interface
interface
integer(trexio_exit_code) function trexio_has_ao_1e_int_ecp_local (trex_file) bind(C)
integer(trexio_exit_code) function trexio_has_ao_1e_int_ecp (trex_file) bind(C)
use, intrinsic :: iso_c_binding
import
integer(c_int64_t), intent(in), value :: trex_file
end function trexio_has_ao_1e_int_ecp_local
end interface
interface
integer(trexio_exit_code) function trexio_has_ao_1e_int_ecp_non_local (trex_file) bind(C)
use, intrinsic :: iso_c_binding
import
integer(c_int64_t), intent(in), value :: trex_file
end function trexio_has_ao_1e_int_ecp_non_local
end function trexio_has_ao_1e_int_ecp
end interface
interface
@ -592,19 +584,11 @@ interface
end interface
interface
integer(trexio_exit_code) function trexio_has_mo_1e_int_ecp_local (trex_file) bind(C)
integer(trexio_exit_code) function trexio_has_mo_1e_int_ecp (trex_file) bind(C)
use, intrinsic :: iso_c_binding
import
integer(c_int64_t), intent(in), value :: trex_file
end function trexio_has_mo_1e_int_ecp_local
end interface
interface
integer(trexio_exit_code) function trexio_has_mo_1e_int_ecp_non_local (trex_file) bind(C)
use, intrinsic :: iso_c_binding
import
integer(c_int64_t), intent(in), value :: trex_file
end function trexio_has_mo_1e_int_ecp_non_local
end function trexio_has_mo_1e_int_ecp
end interface
interface
@ -1347,21 +1331,12 @@ interface
end interface
interface
integer(trexio_exit_code) function trexio_read_ao_1e_int_ecp_local_32 (trex_file, dset) bind(C)
integer(trexio_exit_code) function trexio_read_ao_1e_int_ecp_32 (trex_file, dset) bind(C)
use, intrinsic :: iso_c_binding
import
integer(c_int64_t), intent(in), value :: trex_file
real(c_float), intent(out) :: dset(*)
end function trexio_read_ao_1e_int_ecp_local_32
end interface
interface
integer(trexio_exit_code) function trexio_read_ao_1e_int_ecp_non_local_32 (trex_file, dset) bind(C)
use, intrinsic :: iso_c_binding
import
integer(c_int64_t), intent(in), value :: trex_file
real(c_float), intent(out) :: dset(*)
end function trexio_read_ao_1e_int_ecp_non_local_32
end function trexio_read_ao_1e_int_ecp_32
end interface
interface
@ -1419,21 +1394,12 @@ interface
end interface
interface
integer(trexio_exit_code) function trexio_read_mo_1e_int_ecp_local_32 (trex_file, dset) bind(C)
integer(trexio_exit_code) function trexio_read_mo_1e_int_ecp_32 (trex_file, dset) bind(C)
use, intrinsic :: iso_c_binding
import
integer(c_int64_t), intent(in), value :: trex_file
real(c_float), intent(out) :: dset(*)
end function trexio_read_mo_1e_int_ecp_local_32
end interface
interface
integer(trexio_exit_code) function trexio_read_mo_1e_int_ecp_non_local_32 (trex_file, dset) bind(C)
use, intrinsic :: iso_c_binding
import
integer(c_int64_t), intent(in), value :: trex_file
real(c_float), intent(out) :: dset(*)
end function trexio_read_mo_1e_int_ecp_non_local_32
end function trexio_read_mo_1e_int_ecp_32
end interface
interface
@ -1662,21 +1628,12 @@ interface
end interface
interface
integer(trexio_exit_code) function trexio_read_ao_1e_int_ecp_local_64 (trex_file, dset) bind(C)
integer(trexio_exit_code) function trexio_read_ao_1e_int_ecp_64 (trex_file, dset) bind(C)
use, intrinsic :: iso_c_binding
import
integer(c_int64_t), intent(in), value :: trex_file
real(c_double), intent(out) :: dset(*)
end function trexio_read_ao_1e_int_ecp_local_64
end interface
interface
integer(trexio_exit_code) function trexio_read_ao_1e_int_ecp_non_local_64 (trex_file, dset) bind(C)
use, intrinsic :: iso_c_binding
import
integer(c_int64_t), intent(in), value :: trex_file
real(c_double), intent(out) :: dset(*)
end function trexio_read_ao_1e_int_ecp_non_local_64
end function trexio_read_ao_1e_int_ecp_64
end interface
interface
@ -1734,21 +1691,12 @@ interface
end interface
interface
integer(trexio_exit_code) function trexio_read_mo_1e_int_ecp_local_64 (trex_file, dset) bind(C)
integer(trexio_exit_code) function trexio_read_mo_1e_int_ecp_64 (trex_file, dset) bind(C)
use, intrinsic :: iso_c_binding
import
integer(c_int64_t), intent(in), value :: trex_file
real(c_double), intent(out) :: dset(*)
end function trexio_read_mo_1e_int_ecp_local_64
end interface
interface
integer(trexio_exit_code) function trexio_read_mo_1e_int_ecp_non_local_64 (trex_file, dset) bind(C)
use, intrinsic :: iso_c_binding
import
integer(c_int64_t), intent(in), value :: trex_file
real(c_double), intent(out) :: dset(*)
end function trexio_read_mo_1e_int_ecp_non_local_64
end function trexio_read_mo_1e_int_ecp_64
end interface
interface
@ -1977,21 +1925,12 @@ interface
end interface
interface
integer(trexio_exit_code) function trexio_read_ao_1e_int_ecp_local (trex_file, dset) bind(C)
integer(trexio_exit_code) function trexio_read_ao_1e_int_ecp (trex_file, dset) bind(C)
use, intrinsic :: iso_c_binding
import
integer(c_int64_t), intent(in), value :: trex_file
real(c_double), intent(out) :: dset(*)
end function trexio_read_ao_1e_int_ecp_local
end interface
interface
integer(trexio_exit_code) function trexio_read_ao_1e_int_ecp_non_local (trex_file, dset) bind(C)
use, intrinsic :: iso_c_binding
import
integer(c_int64_t), intent(in), value :: trex_file
real(c_double), intent(out) :: dset(*)
end function trexio_read_ao_1e_int_ecp_non_local
end function trexio_read_ao_1e_int_ecp
end interface
interface
@ -2049,21 +1988,12 @@ interface
end interface
interface
integer(trexio_exit_code) function trexio_read_mo_1e_int_ecp_local (trex_file, dset) bind(C)
integer(trexio_exit_code) function trexio_read_mo_1e_int_ecp (trex_file, dset) bind(C)
use, intrinsic :: iso_c_binding
import
integer(c_int64_t), intent(in), value :: trex_file
real(c_double), intent(out) :: dset(*)
end function trexio_read_mo_1e_int_ecp_local
end interface
interface
integer(trexio_exit_code) function trexio_read_mo_1e_int_ecp_non_local (trex_file, dset) bind(C)
use, intrinsic :: iso_c_binding
import
integer(c_int64_t), intent(in), value :: trex_file
real(c_double), intent(out) :: dset(*)
end function trexio_read_mo_1e_int_ecp_non_local
end function trexio_read_mo_1e_int_ecp
end interface
interface
@ -3117,21 +3047,12 @@ interface
end interface
interface
integer(trexio_exit_code) function trexio_write_ao_1e_int_ecp_local_32 (trex_file, dset) bind(C)
integer(trexio_exit_code) function trexio_write_ao_1e_int_ecp_32 (trex_file, dset) bind(C)
use, intrinsic :: iso_c_binding
import
integer(c_int64_t), intent(in), value :: trex_file
real(c_float), intent(in) :: dset(*)
end function trexio_write_ao_1e_int_ecp_local_32
end interface
interface
integer(trexio_exit_code) function trexio_write_ao_1e_int_ecp_non_local_32 (trex_file, dset) bind(C)
use, intrinsic :: iso_c_binding
import
integer(c_int64_t), intent(in), value :: trex_file
real(c_float), intent(in) :: dset(*)
end function trexio_write_ao_1e_int_ecp_non_local_32
end function trexio_write_ao_1e_int_ecp_32
end interface
interface
@ -3189,21 +3110,12 @@ interface
end interface
interface
integer(trexio_exit_code) function trexio_write_mo_1e_int_ecp_local_32 (trex_file, dset) bind(C)
integer(trexio_exit_code) function trexio_write_mo_1e_int_ecp_32 (trex_file, dset) bind(C)
use, intrinsic :: iso_c_binding
import
integer(c_int64_t), intent(in), value :: trex_file
real(c_float), intent(in) :: dset(*)
end function trexio_write_mo_1e_int_ecp_local_32
end interface
interface
integer(trexio_exit_code) function trexio_write_mo_1e_int_ecp_non_local_32 (trex_file, dset) bind(C)
use, intrinsic :: iso_c_binding
import
integer(c_int64_t), intent(in), value :: trex_file
real(c_float), intent(in) :: dset(*)
end function trexio_write_mo_1e_int_ecp_non_local_32
end function trexio_write_mo_1e_int_ecp_32
end interface
interface
@ -3432,21 +3344,12 @@ interface
end interface
interface
integer(trexio_exit_code) function trexio_write_ao_1e_int_ecp_local_64 (trex_file, dset) bind(C)
integer(trexio_exit_code) function trexio_write_ao_1e_int_ecp_64 (trex_file, dset) bind(C)
use, intrinsic :: iso_c_binding
import
integer(c_int64_t), intent(in), value :: trex_file
real(c_double), intent(in) :: dset(*)
end function trexio_write_ao_1e_int_ecp_local_64
end interface
interface
integer(trexio_exit_code) function trexio_write_ao_1e_int_ecp_non_local_64 (trex_file, dset) bind(C)
use, intrinsic :: iso_c_binding
import
integer(c_int64_t), intent(in), value :: trex_file
real(c_double), intent(in) :: dset(*)
end function trexio_write_ao_1e_int_ecp_non_local_64
end function trexio_write_ao_1e_int_ecp_64
end interface
interface
@ -3504,21 +3407,12 @@ interface
end interface
interface
integer(trexio_exit_code) function trexio_write_mo_1e_int_ecp_local_64 (trex_file, dset) bind(C)
integer(trexio_exit_code) function trexio_write_mo_1e_int_ecp_64 (trex_file, dset) bind(C)
use, intrinsic :: iso_c_binding
import
integer(c_int64_t), intent(in), value :: trex_file
real(c_double), intent(in) :: dset(*)
end function trexio_write_mo_1e_int_ecp_local_64
end interface
interface
integer(trexio_exit_code) function trexio_write_mo_1e_int_ecp_non_local_64 (trex_file, dset) bind(C)
use, intrinsic :: iso_c_binding
import
integer(c_int64_t), intent(in), value :: trex_file
real(c_double), intent(in) :: dset(*)
end function trexio_write_mo_1e_int_ecp_non_local_64
end function trexio_write_mo_1e_int_ecp_64
end interface
interface
@ -3747,21 +3641,12 @@ interface
end interface
interface
integer(trexio_exit_code) function trexio_write_ao_1e_int_ecp_local (trex_file, dset) bind(C)
integer(trexio_exit_code) function trexio_write_ao_1e_int_ecp (trex_file, dset) bind(C)
use, intrinsic :: iso_c_binding
import
integer(c_int64_t), intent(in), value :: trex_file
real(c_double), intent(in) :: dset(*)
end function trexio_write_ao_1e_int_ecp_local
end interface
interface
integer(trexio_exit_code) function trexio_write_ao_1e_int_ecp_non_local (trex_file, dset) bind(C)
use, intrinsic :: iso_c_binding
import
integer(c_int64_t), intent(in), value :: trex_file
real(c_double), intent(in) :: dset(*)
end function trexio_write_ao_1e_int_ecp_non_local
end function trexio_write_ao_1e_int_ecp
end interface
interface
@ -3819,21 +3704,12 @@ interface
end interface
interface
integer(trexio_exit_code) function trexio_write_mo_1e_int_ecp_local (trex_file, dset) bind(C)
integer(trexio_exit_code) function trexio_write_mo_1e_int_ecp (trex_file, dset) bind(C)
use, intrinsic :: iso_c_binding
import
integer(c_int64_t), intent(in), value :: trex_file
real(c_double), intent(in) :: dset(*)
end function trexio_write_mo_1e_int_ecp_local
end interface
interface
integer(trexio_exit_code) function trexio_write_mo_1e_int_ecp_non_local (trex_file, dset) bind(C)
use, intrinsic :: iso_c_binding
import
integer(c_int64_t), intent(in), value :: trex_file
real(c_double), intent(in) :: dset(*)
end function trexio_write_mo_1e_int_ecp_non_local
end function trexio_write_mo_1e_int_ecp
end interface
interface