1
0
mirror of https://gitlab.com/scemama/qp_plugins_scemama.git synced 2024-12-22 04:13:40 +01:00

Compare commits

...

2 Commits

Author SHA1 Message Date
9745795b3d Import WF from TREXIO 2022-04-27 16:06:56 +02:00
fcce80d899 Export determinants in TREXIO 2022-04-27 15:16:08 +02:00
4 changed files with 899 additions and 68 deletions

View File

@ -12,8 +12,8 @@ subroutine run
! Exports the wave function in TREXIO format
END_DOC
integer(8) :: f ! TREXIO file handle
integer :: rc
integer(trexio_t) :: f ! TREXIO file handle
integer(trexio_exit_code) :: rc
double precision, allocatable :: factor(:)
print *, 'TREXIO file : '//trim(trexio_filename)
@ -40,10 +40,10 @@ subroutine run
print *, 'Electrons'
rc = trexio_write_electron_up_num(f, elec_alpha_num)
call check_success(rc)
call trexio_assert(rc, TREXIO_SUCCESS)
rc = trexio_write_electron_dn_num(f, elec_beta_num)
call check_success(rc)
call trexio_assert(rc, TREXIO_SUCCESS)
! Nuclei
@ -52,19 +52,19 @@ subroutine run
print *, 'Nuclei'
rc = trexio_write_nucleus_num(f, nucl_num)
call check_success(rc)
call trexio_assert(rc, TREXIO_SUCCESS)
rc = trexio_write_nucleus_charge(f, nucl_charge)
call check_success(rc)
call trexio_assert(rc, TREXIO_SUCCESS)
rc = trexio_write_nucleus_coord(f, nucl_coord_transp)
call check_success(rc)
call trexio_assert(rc, TREXIO_SUCCESS)
rc = trexio_write_nucleus_label(f, nucl_label, 32)
call check_success(rc)
call trexio_assert(rc, TREXIO_SUCCESS)
rc = trexio_write_nucleus_repulsion(f, nuclear_repulsion)
call check_success(rc)
call trexio_assert(rc, TREXIO_SUCCESS)
! Pseudo-potentials
@ -141,28 +141,28 @@ subroutine run
lmax(:) = lmax(:)+1
rc = trexio_write_ecp_max_ang_mom_plus_1(f, lmax)
call check_success(rc)
call trexio_assert(rc, TREXIO_SUCCESS)
rc = trexio_write_ecp_z_core(f, int(nucl_charge_remove))
call check_success(rc)
call trexio_assert(rc, TREXIO_SUCCESS)
rc = trexio_write_ecp_num(f, num)
call check_success(rc)
call trexio_assert(rc, TREXIO_SUCCESS)
rc = trexio_write_ecp_ang_mom(f, ang_mom)
call check_success(rc)
call trexio_assert(rc, TREXIO_SUCCESS)
rc = trexio_write_ecp_nucleus_index(f, nucleus_index)
call check_success(rc)
call trexio_assert(rc, TREXIO_SUCCESS)
rc = trexio_write_ecp_exponent(f, exponent)
call check_success(rc)
call trexio_assert(rc, TREXIO_SUCCESS)
rc = trexio_write_ecp_coefficient(f, coefficient)
call check_success(rc)
call trexio_assert(rc, TREXIO_SUCCESS)
rc = trexio_write_ecp_power(f, power)
call check_success(rc)
call trexio_assert(rc, TREXIO_SUCCESS)
endif
@ -174,19 +174,19 @@ subroutine run
rc = trexio_write_basis_type(f, 'Gaussian', len('Gaussian'))
call check_success(rc)
call trexio_assert(rc, TREXIO_SUCCESS)
rc = trexio_write_basis_prim_num(f, prim_num)
call check_success(rc)
call trexio_assert(rc, TREXIO_SUCCESS)
rc = trexio_write_basis_shell_num(f, shell_num)
call check_success(rc)
call trexio_assert(rc, TREXIO_SUCCESS)
rc = trexio_write_basis_nucleus_index(f, basis_nucleus_index)
call check_success(rc)
call trexio_assert(rc, TREXIO_SUCCESS)
rc = trexio_write_basis_shell_ang_mom(f, shell_ang_mom)
call check_success(rc)
call trexio_assert(rc, TREXIO_SUCCESS)
allocate(factor(shell_num))
if (ao_normalized) then
@ -195,18 +195,18 @@ subroutine run
factor(1:shell_num) = 1.d0
endif
rc = trexio_write_basis_shell_factor(f, factor)
call check_success(rc)
call trexio_assert(rc, TREXIO_SUCCESS)
deallocate(factor)
rc = trexio_write_basis_shell_index(f, shell_index)
call check_success(rc)
call trexio_assert(rc, TREXIO_SUCCESS)
rc = trexio_write_basis_exponent(f, prim_expo)
call check_success(rc)
call trexio_assert(rc, TREXIO_SUCCESS)
rc = trexio_write_basis_coefficient(f, prim_coef)
call check_success(rc)
call trexio_assert(rc, TREXIO_SUCCESS)
allocate(factor(prim_num))
if (primitives_normalized) then
@ -215,7 +215,7 @@ subroutine run
factor(1:prim_num) = 1.d0
endif
rc = trexio_write_basis_prim_factor(f, factor)
call check_success(rc)
call trexio_assert(rc, TREXIO_SUCCESS)
deallocate(factor)
@ -225,13 +225,13 @@ subroutine run
print *, 'AOs'
rc = trexio_write_ao_num(f, ao_num)
call check_success(rc)
call trexio_assert(rc, TREXIO_SUCCESS)
rc = trexio_write_ao_cartesian(f, 1)
call check_success(rc)
call trexio_assert(rc, TREXIO_SUCCESS)
rc = trexio_write_ao_shell(f, ao_shell)
call check_success(rc)
call trexio_assert(rc, TREXIO_SUCCESS)
integer :: i, pow0(3), powA(3), j, k, l, nz
double precision :: normA, norm0, C_A(3), overlap_x, overlap_z, overlap_y, c
@ -251,7 +251,7 @@ subroutine run
factor(:) = 1.d0
endif
rc = trexio_write_ao_normalization(f, factor)
call check_success(rc)
call trexio_assert(rc, TREXIO_SUCCESS)
deallocate(factor)
! One-e AO integrals
@ -260,21 +260,21 @@ subroutine run
print *, 'AO integrals'
rc = trexio_write_ao_1e_int_overlap(f,ao_overlap)
call check_success(rc)
call trexio_assert(rc, TREXIO_SUCCESS)
rc = trexio_write_ao_1e_int_kinetic(f,ao_kinetic_integrals)
call check_success(rc)
call trexio_assert(rc, TREXIO_SUCCESS)
rc = trexio_write_ao_1e_int_potential_n_e(f,ao_integrals_n_e)
call check_success(rc)
call trexio_assert(rc, TREXIO_SUCCESS)
if (do_pseudo) then
rc = trexio_write_ao_1e_int_ecp(f, ao_pseudo_integrals_local + ao_pseudo_integrals_non_local)
call check_success(rc)
call trexio_assert(rc, TREXIO_SUCCESS)
endif
rc = trexio_write_ao_1e_int_core_hamiltonian(f,ao_one_e_integrals)
call check_success(rc)
call trexio_assert(rc, TREXIO_SUCCESS)
! Two-e AO integrals
! ------------------
@ -308,7 +308,7 @@ subroutine run
eri_index(4,icount) = l
if (icount == BUFSIZE) then
rc = trexio_write_ao_2e_int_eri(f, offset, icount, eri_index, eri_buffer)
call check_success(rc)
call trexio_assert(rc, TREXIO_SUCCESS)
offset += icount
icount = 0_8
end if
@ -319,7 +319,7 @@ subroutine run
if (icount >= 0_8) then
rc = trexio_write_ao_2e_int_eri(f, offset, icount, eri_index, eri_buffer)
call check_success(rc)
call trexio_assert(rc, TREXIO_SUCCESS)
end if
end if
@ -330,13 +330,13 @@ subroutine run
print *, 'MOs'
rc = trexio_write_mo_type(f, mo_label, len(trim(mo_label)))
call check_success(rc)
call trexio_assert(rc, TREXIO_SUCCESS)
rc = trexio_write_mo_num(f, mo_num)
call check_success(rc)
call trexio_assert(rc, TREXIO_SUCCESS)
rc = trexio_write_mo_coefficient(f, mo_coef)
call check_success(rc)
call trexio_assert(rc, TREXIO_SUCCESS)
! One-e MO integrals
@ -345,18 +345,18 @@ subroutine run
print *, 'MO integrals'
rc = trexio_write_mo_1e_int_kinetic(f,mo_kinetic_integrals)
call check_success(rc)
call trexio_assert(rc, TREXIO_SUCCESS)
rc = trexio_write_mo_1e_int_potential_n_e(f,mo_integrals_n_e)
call check_success(rc)
call trexio_assert(rc, TREXIO_SUCCESS)
if (do_pseudo) then
rc = trexio_write_mo_1e_int_ecp(f,mo_pseudo_integrals_local)
call check_success(rc)
call trexio_assert(rc, TREXIO_SUCCESS)
endif
rc = trexio_write_mo_1e_int_core_hamiltonian(f,mo_one_e_integrals)
call check_success(rc)
call trexio_assert(rc, TREXIO_SUCCESS)
! Two-e MO integrals
! ------------------
@ -385,7 +385,7 @@ subroutine run
eri_index(4,icount) = l
if (icount == BUFSIZE) then
rc = trexio_write_mo_2e_int_eri(f, offset, icount, eri_index, eri_buffer)
call check_success(rc)
call trexio_assert(rc, TREXIO_SUCCESS)
offset += icount
icount = 0_8
end if
@ -396,7 +396,7 @@ subroutine run
if (icount >= 0_8) then
rc = trexio_write_mo_2e_int_eri(f, offset, icount, eri_index, eri_buffer)
call check_success(rc)
call trexio_assert(rc, TREXIO_SUCCESS)
end if
end if
@ -406,13 +406,13 @@ subroutine run
! ---------
rc = trexio_write_rdm_1e(f,one_e_dm_mo)
call check_success(rc)
call trexio_assert(rc, TREXIO_SUCCESS)
rc = trexio_write_rdm_1e_up(f,one_e_dm_mo_alpha_average)
call check_success(rc)
call trexio_assert(rc, TREXIO_SUCCESS)
rc = trexio_write_rdm_1e_dn(f,one_e_dm_mo_beta_average)
call check_success(rc)
call trexio_assert(rc, TREXIO_SUCCESS)
! Two-e RDM
@ -437,7 +437,7 @@ subroutine run
eri_index(4,icount) = l
if (icount == BUFSIZE) then
rc = trexio_write_rdm_2e(f, offset, icount, eri_index, eri_buffer)
call check_success(rc)
call trexio_assert(rc, TREXIO_SUCCESS)
offset += icount
icount = 0_8
end if
@ -448,29 +448,72 @@ subroutine run
if (icount >= 0_8) then
rc = trexio_write_rdm_2e(f, offset, icount, eri_index, eri_buffer)
call check_success(rc)
call trexio_assert(rc, TREXIO_SUCCESS)
end if
end if
! ------------------------------------------------------------------------------
! Determinants
! ------------
integer*8, allocatable :: det_buffer(:,:,:)
double precision, allocatable :: coef_buffer(:,:)
integer :: nint
! rc = trexio_read_determinant_int64_num(f, nint)
! call trexio_assert(rc, TREXIO_SUCCESS)
nint = N_int
if (nint /= N_int) then
stop 'Problem with N_int'
endif
allocate ( det_buffer(nint, 2, BUFSIZE), coef_buffer(BUFSIZE, n_states) )
icount = 0_8
offset = 0_8
rc = trexio_write_state_num(f, n_states)
call trexio_assert(rc, TREXIO_SUCCESS)
rc = trexio_set_state (f, 0)
call trexio_assert(rc, TREXIO_SUCCESS)
do k=1,n_det
icount += 1_8
det_buffer(1:nint, 1:2, icount) = psi_det(1:N_int, 1:2, k)
coef_buffer(icount,1:N_states) = psi_coef(k,1:N_states)
if (icount == BUFSIZE) then
call trexio_assert(rc, TREXIO_SUCCESS)
rc = trexio_write_determinant_list(f, offset, icount, det_buffer)
call trexio_assert(rc, TREXIO_SUCCESS)
do i=1,N_states
rc = trexio_set_state (f, i-1)
call trexio_assert(rc, TREXIO_SUCCESS)
rc = trexio_write_determinant_coefficient(f, offset, icount, coef_buffer(1,i))
end do
rc = trexio_set_state (f, 0)
offset += icount
icount = 0_8
end if
end do
if (icount >= 0_8) then
call trexio_assert(rc, TREXIO_SUCCESS)
rc = trexio_write_determinant_list(f, offset, icount, det_buffer)
call trexio_assert(rc, TREXIO_SUCCESS)
do i=1,N_states
rc = trexio_set_state (f, i-1)
call trexio_assert(rc, TREXIO_SUCCESS)
rc = trexio_write_determinant_coefficient(f, offset, icount, coef_buffer(1,i))
end do
rc = trexio_set_state (f, 0)
end if
deallocate ( det_buffer, coef_buffer )
rc = trexio_close(f)
call check_success(rc)
call trexio_assert(rc, TREXIO_SUCCESS)
end
subroutine check_success(rc)
use trexio
implicit none
integer, intent(in) :: rc
character*(128) :: str
if (rc /= TREXIO_SUCCESS) then
call trexio_string_of_error(rc,str)
print *, 'TREXIO Error: ' //trim(str)
stop -1
endif
end
! -*- mode: f90 -*-

View File

@ -0,0 +1,79 @@
program import_determinants_ao
call run
end
subroutine run
use trexio
use map_module
implicit none
BEGIN_DOC
! Program to import determinants from TREXIO
END_DOC
integer(trexio_t) :: f ! TREXIO file handle
integer(trexio_exit_code) :: rc
integer :: m
double precision, allocatable :: coef_buffer(:,:)
integer*8 , allocatable :: det_buffer(:,:,:)
f = trexio_open(trexio_filename, 'r', TREXIO_AUTO, rc)
if (f == 0_8) then
print *, 'Unable to open TREXIO file for reading'
print *, 'rc = ', rc
stop -1
endif
! Determinants
! ------------
integer :: nint, nstates
integer :: bufsize
rc = trexio_read_state_num(f, nstates)
call trexio_assert(rc, TREXIO_SUCCESS)
! rc = trexio_read_determinant_int64_num(f, nint)
! call trexio_assert(rc, TREXIO_SUCCESS)
nint = N_int
if (nint /= N_int) then
stop 'Problem with N_int'
endif
integer*8 :: offset, icount
rc = trexio_read_determinant_num(f, bufsize)
call trexio_assert(rc, TREXIO_SUCCESS)
print *, 'N_det = ', bufsize
allocate ( det_buffer(nint, 2, bufsize), coef_buffer(bufsize, n_states) )
offset = 0_8
icount = bufsize
rc = trexio_read_determinant_list(f, offset, icount, det_buffer)
call trexio_assert(rc, TREXIO_SUCCESS)
if (icount /= bufsize) then
print *, 'error: bufsize /= N_det: ', bufsize, icount
stop -1
endif
do m=1,nstates
rc = trexio_set_state(f, m-1)
call trexio_assert(rc, TREXIO_SUCCESS)
rc = trexio_read_determinant_coefficient(f, offset, icount, coef_buffer(1,m))
call trexio_assert(rc, TREXIO_SUCCESS)
if (icount /= bufsize) then
print *, 'error: bufsize /= N_det for state', m, ':', icount, bufsize
stop -1
endif
enddo
call save_wavefunction_general(bufsize,nstates,det_buffer,size(coef_buffer,1),coef_buffer)
end

View File

@ -10,8 +10,8 @@ subroutine run
! Program to import integrals from TREXIO
END_DOC
integer(8) :: f ! TREXIO file handle
integer :: rc
integer(trexio_t) :: f ! TREXIO file handle
integer(trexio_exit_code) :: rc
integer ::i,j,k,l,m
double precision :: integral

View File

@ -37,9 +37,16 @@ integer(trexio_exit_code), parameter :: TREXIO_UNSAFE_ARRAY_DIM = 23
integer(trexio_exit_code), parameter :: TREXIO_ATTR_MISSING = 24
integer(trexio_exit_code), parameter :: TREXIO_DSET_MISSING = 25
integer(trexio_exit_code), parameter :: TREXIO_BACK_END_MISSING = 26
integer(trexio_exit_code), parameter :: TREXIO_INVALID_ARG_6 = 27
integer(trexio_exit_code), parameter :: TREXIO_INVALID_ARG_7 = 28
integer(trexio_exit_code), parameter :: TREXIO_INVALID_ARG_8 = 29
integer(trexio_exit_code), parameter :: TREXIO_INVALID_STR_LEN = 30
integer(trexio_exit_code), parameter :: TREXIO_INT_SIZE_OVERFLOW = 31
integer(trexio_exit_code), parameter :: TREXIO_SAFE_MODE = 32
integer(trexio_exit_code), parameter :: TREXIO_INVALID_ELECTRON_NUM = 33
integer(trexio_exit_code), parameter :: TREXIO_INVALID_DETERMINANT_NUM = 34
integer(trexio_exit_code), parameter :: TREXIO_INVALID_STATE = 35
integer(trexio_exit_code), parameter :: TREXIO_VERSION_PARSING_ISSUE = 36
interface
subroutine trexio_string_of_error (error, string) bind(C, name='trexio_string_of_error_f')
@ -107,17 +114,59 @@ interface
end function trexio_inquire_c
end interface
interface
integer(trexio_exit_code) function trexio_set_state (trex_file, state) bind(C)
use, intrinsic :: iso_c_binding
import
integer(c_int64_t), intent(in), value :: trex_file
integer(c_int32_t), intent(in), value :: state
end function trexio_set_state
end interface
interface
integer(trexio_exit_code) function trexio_get_state (trex_file, state) bind(C)
use, intrinsic :: iso_c_binding
import
integer(c_int64_t), intent(in), value :: trex_file
integer(c_int32_t), intent(out) :: state
end function trexio_get_state
end interface
interface
integer function trexio_info () bind(C)
use, intrinsic :: iso_c_binding
end function trexio_info
end interface
interface
integer(trexio_exit_code) function trexio_to_orbital_list(N_int, d1, list, occupied_num) bind(C)
use, intrinsic :: iso_c_binding
import
integer(c_int32_t), intent(in), value :: N_int
integer(c_int64_t), intent(in) :: d1(*)
integer(c_int32_t), intent(out) :: list(*)
integer(c_int32_t), intent(inout) :: occupied_num
end function trexio_to_orbital_list
end interface
interface
integer(trexio_exit_code) function trexio_to_orbital_list_up_dn(N_int, d1, list_up, list_dn, occ_num_up, occ_num_dn) bind(C)
use, intrinsic :: iso_c_binding
import
integer(c_int32_t), intent(in), value :: N_int
integer(c_int64_t), intent(in) :: d1(*)
integer(c_int32_t), intent(out) :: list_up(*)
integer(c_int32_t), intent(out) :: list_dn(*)
integer(c_int32_t), intent(inout) :: occ_num_up
integer(c_int32_t), intent(inout) :: occ_num_dn
end function trexio_to_orbital_list_up_dn
end interface
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 = "eaeeee5e13f09a4738dedc295c100c32a291e9a6"
character(len = 64) :: TREXIO_GIT_HASH = "dc783bc1e03a48b3d3d020edf6ce349d533dc8d6"
interface
integer(trexio_exit_code) function trexio_delete_metadata (trex_file) bind(C)
@ -207,6 +256,22 @@ interface
end function trexio_delete_mo_2e_int
end interface
interface
integer(trexio_exit_code) function trexio_delete_determinant (trex_file) bind(C)
use, intrinsic :: iso_c_binding
import
integer(trexio_t), intent(in), value :: trex_file
end function trexio_delete_determinant
end interface
interface
integer(trexio_exit_code) function trexio_delete_state (trex_file) bind(C)
use, intrinsic :: iso_c_binding
import
integer(trexio_t), intent(in), value :: trex_file
end function trexio_delete_state
end interface
interface
integer(trexio_exit_code) function trexio_delete_rdm (trex_file) bind(C)
use, intrinsic :: iso_c_binding
@ -215,6 +280,14 @@ interface
end function trexio_delete_rdm
end interface
interface
integer(trexio_exit_code) function trexio_delete_qmc (trex_file) bind(C)
use, intrinsic :: iso_c_binding
import
integer(trexio_t), intent(in), value :: trex_file
end function trexio_delete_qmc
end interface
interface
integer(trexio_exit_code) function trexio_has_metadata_code_num (trex_file) bind(C)
use, intrinsic :: iso_c_binding
@ -239,6 +312,14 @@ interface
end function trexio_has_metadata_unsafe
end interface
interface
integer(trexio_exit_code) function trexio_has_electron_num (trex_file) bind(C)
use, intrinsic :: iso_c_binding
import
integer(c_int64_t), intent(in), value :: trex_file
end function trexio_has_electron_num
end interface
interface
integer(trexio_exit_code) function trexio_has_electron_up_num (trex_file) bind(C)
use, intrinsic :: iso_c_binding
@ -319,6 +400,30 @@ interface
end function trexio_has_mo_num
end interface
interface
integer(trexio_exit_code) function trexio_has_determinant_num (trex_file) bind(C)
use, intrinsic :: iso_c_binding
import
integer(c_int64_t), intent(in), value :: trex_file
end function trexio_has_determinant_num
end interface
interface
integer(trexio_exit_code) function trexio_has_state_num (trex_file) bind(C)
use, intrinsic :: iso_c_binding
import
integer(c_int64_t), intent(in), value :: trex_file
end function trexio_has_state_num
end interface
interface
integer(trexio_exit_code) function trexio_has_qmc_num (trex_file) bind(C)
use, intrinsic :: iso_c_binding
import
integer(c_int64_t), intent(in), value :: trex_file
end function trexio_has_qmc_num
end interface
interface
integer(trexio_exit_code) function trexio_has_metadata_package_version (trex_file) bind(C)
use, intrinsic :: iso_c_binding
@ -623,6 +728,30 @@ interface
end function trexio_has_rdm_1e_dn
end interface
interface
integer(trexio_exit_code) function trexio_has_qmc_point (trex_file) bind(C)
use, intrinsic :: iso_c_binding
import
integer(c_int64_t), intent(in), value :: trex_file
end function trexio_has_qmc_point
end interface
interface
integer(trexio_exit_code) function trexio_has_qmc_psi (trex_file) bind(C)
use, intrinsic :: iso_c_binding
import
integer(c_int64_t), intent(in), value :: trex_file
end function trexio_has_qmc_psi
end interface
interface
integer(trexio_exit_code) function trexio_has_qmc_e_loc (trex_file) bind(C)
use, intrinsic :: iso_c_binding
import
integer(c_int64_t), intent(in), value :: trex_file
end function trexio_has_qmc_e_loc
end interface
interface
integer(trexio_exit_code) function trexio_has_ao_2e_int_eri (trex_file) bind(C)
use, intrinsic :: iso_c_binding
@ -735,6 +864,14 @@ interface
end function trexio_has_mo_symmetry
end interface
interface
integer(trexio_exit_code) function trexio_has_state_label (trex_file) bind(C)
use, intrinsic :: iso_c_binding
import
integer(c_int64_t), intent(in), value :: trex_file
end function trexio_has_state_label
end interface
interface
integer(trexio_exit_code) function trexio_read_metadata_code_num_32 (trex_file, num) bind(C)
use, intrinsic :: iso_c_binding
@ -762,6 +899,15 @@ interface
end function trexio_read_metadata_unsafe_32
end interface
interface
integer(trexio_exit_code) function trexio_read_electron_num_32 (trex_file, num) bind(C)
use, intrinsic :: iso_c_binding
import
integer(c_int64_t), intent(in), value :: trex_file
integer(c_int32_t), intent(out) :: num
end function trexio_read_electron_num_32
end interface
interface
integer(trexio_exit_code) function trexio_read_electron_up_num_32 (trex_file, num) bind(C)
use, intrinsic :: iso_c_binding
@ -852,6 +998,33 @@ interface
end function trexio_read_mo_num_32
end interface
interface
integer(trexio_exit_code) function trexio_read_determinant_num_32 (trex_file, num) bind(C)
use, intrinsic :: iso_c_binding
import
integer(c_int64_t), intent(in), value :: trex_file
integer(c_int32_t), intent(out) :: num
end function trexio_read_determinant_num_32
end interface
interface
integer(trexio_exit_code) function trexio_read_state_num_32 (trex_file, num) bind(C)
use, intrinsic :: iso_c_binding
import
integer(c_int64_t), intent(in), value :: trex_file
integer(c_int32_t), intent(out) :: num
end function trexio_read_state_num_32
end interface
interface
integer(trexio_exit_code) function trexio_read_qmc_num_32 (trex_file, num) bind(C)
use, intrinsic :: iso_c_binding
import
integer(c_int64_t), intent(in), value :: trex_file
integer(c_int32_t), intent(out) :: num
end function trexio_read_qmc_num_32
end interface
interface
integer(trexio_exit_code) function trexio_read_metadata_code_num_64 (trex_file, num) bind(C)
use, intrinsic :: iso_c_binding
@ -879,6 +1052,15 @@ interface
end function trexio_read_metadata_unsafe_64
end interface
interface
integer(trexio_exit_code) function trexio_read_electron_num_64 (trex_file, num) bind(C)
use, intrinsic :: iso_c_binding
import
integer(c_int64_t), intent(in), value :: trex_file
integer(c_int64_t), intent(out) :: num
end function trexio_read_electron_num_64
end interface
interface
integer(trexio_exit_code) function trexio_read_electron_up_num_64 (trex_file, num) bind(C)
use, intrinsic :: iso_c_binding
@ -969,6 +1151,33 @@ interface
end function trexio_read_mo_num_64
end interface
interface
integer(trexio_exit_code) function trexio_read_determinant_num_64 (trex_file, num) bind(C)
use, intrinsic :: iso_c_binding
import
integer(c_int64_t), intent(in), value :: trex_file
integer(c_int64_t), intent(out) :: num
end function trexio_read_determinant_num_64
end interface
interface
integer(trexio_exit_code) function trexio_read_state_num_64 (trex_file, num) bind(C)
use, intrinsic :: iso_c_binding
import
integer(c_int64_t), intent(in), value :: trex_file
integer(c_int64_t), intent(out) :: num
end function trexio_read_state_num_64
end interface
interface
integer(trexio_exit_code) function trexio_read_qmc_num_64 (trex_file, num) bind(C)
use, intrinsic :: iso_c_binding
import
integer(c_int64_t), intent(in), value :: trex_file
integer(c_int64_t), intent(out) :: num
end function trexio_read_qmc_num_64
end interface
interface
integer(trexio_exit_code) function trexio_read_metadata_code_num (trex_file, num) bind(C)
use, intrinsic :: iso_c_binding
@ -996,6 +1205,15 @@ interface
end function trexio_read_metadata_unsafe
end interface
interface
integer(trexio_exit_code) function trexio_read_electron_num (trex_file, num) bind(C)
use, intrinsic :: iso_c_binding
import
integer(c_int64_t), intent(in), value :: trex_file
integer(c_int32_t), intent(out) :: num
end function trexio_read_electron_num
end interface
interface
integer(trexio_exit_code) function trexio_read_electron_up_num (trex_file, num) bind(C)
use, intrinsic :: iso_c_binding
@ -1086,6 +1304,33 @@ interface
end function trexio_read_mo_num
end interface
interface
integer(trexio_exit_code) function trexio_read_determinant_num (trex_file, num) bind(C)
use, intrinsic :: iso_c_binding
import
integer(c_int64_t), intent(in), value :: trex_file
integer(c_int32_t), intent(out) :: num
end function trexio_read_determinant_num
end interface
interface
integer(trexio_exit_code) function trexio_read_state_num (trex_file, num) bind(C)
use, intrinsic :: iso_c_binding
import
integer(c_int64_t), intent(in), value :: trex_file
integer(c_int32_t), intent(out) :: num
end function trexio_read_state_num
end interface
interface
integer(trexio_exit_code) function trexio_read_qmc_num (trex_file, num) bind(C)
use, intrinsic :: iso_c_binding
import
integer(c_int64_t), intent(in), value :: trex_file
integer(c_int32_t), intent(out) :: num
end function trexio_read_qmc_num
end interface
interface
integer(trexio_exit_code) function trexio_read_metadata_package_version_c (trex_file, str, max_str_len) &
bind(C, name="trexio_read_metadata_package_version")
@ -1438,6 +1683,33 @@ interface
end function trexio_read_rdm_1e_dn_32
end interface
interface
integer(trexio_exit_code) function trexio_read_qmc_point_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_qmc_point_32
end interface
interface
integer(trexio_exit_code) function trexio_read_qmc_psi_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_qmc_psi_32
end interface
interface
integer(trexio_exit_code) function trexio_read_qmc_e_loc_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_qmc_e_loc_32
end interface
interface
integer(trexio_exit_code) function trexio_read_nucleus_charge_64 (trex_file, dset) bind(C)
use, intrinsic :: iso_c_binding
@ -1735,6 +2007,33 @@ interface
end function trexio_read_rdm_1e_dn_64
end interface
interface
integer(trexio_exit_code) function trexio_read_qmc_point_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_qmc_point_64
end interface
interface
integer(trexio_exit_code) function trexio_read_qmc_psi_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_qmc_psi_64
end interface
interface
integer(trexio_exit_code) function trexio_read_qmc_e_loc_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_qmc_e_loc_64
end interface
interface
integer(trexio_exit_code) function trexio_read_nucleus_charge (trex_file, dset) bind(C)
use, intrinsic :: iso_c_binding
@ -2032,6 +2331,33 @@ interface
end function trexio_read_rdm_1e_dn
end interface
interface
integer(trexio_exit_code) function trexio_read_qmc_point (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_qmc_point
end interface
interface
integer(trexio_exit_code) function trexio_read_qmc_psi (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_qmc_psi
end interface
interface
integer(trexio_exit_code) function trexio_read_qmc_e_loc (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_qmc_e_loc
end interface
interface
integer(trexio_exit_code) function trexio_read_ao_2e_int_eri (trex_file, &
offset_file, buffer_size, &
@ -2451,6 +2777,16 @@ interface
end function trexio_read_mo_symmetry_low
end interface
interface
integer(trexio_exit_code) function trexio_read_state_label_low (trex_file, dset, max_str_len) bind(C)
use, intrinsic :: iso_c_binding
import
integer(c_int64_t), intent(in), value :: trex_file
character(kind=c_char), intent(out) :: dset(*)
integer(c_int32_t), intent(in), value :: max_str_len
end function trexio_read_state_label_low
end interface
interface
integer(trexio_exit_code) function trexio_write_metadata_code_num_32 (trex_file, num) bind(C)
use, intrinsic :: iso_c_binding
@ -2478,6 +2814,15 @@ interface
end function trexio_write_metadata_unsafe_32
end interface
interface
integer(trexio_exit_code) function trexio_write_electron_num_32 (trex_file, num) bind(C)
use, intrinsic :: iso_c_binding
import
integer(c_int64_t), intent(in), value :: trex_file
integer(c_int32_t), intent(in), value :: num
end function trexio_write_electron_num_32
end interface
interface
integer(trexio_exit_code) function trexio_write_electron_up_num_32 (trex_file, num) bind(C)
use, intrinsic :: iso_c_binding
@ -2568,6 +2913,33 @@ interface
end function trexio_write_mo_num_32
end interface
interface
integer(trexio_exit_code) function trexio_write_determinant_num_32 (trex_file, num) bind(C)
use, intrinsic :: iso_c_binding
import
integer(c_int64_t), intent(in), value :: trex_file
integer(c_int32_t), intent(in), value :: num
end function trexio_write_determinant_num_32
end interface
interface
integer(trexio_exit_code) function trexio_write_state_num_32 (trex_file, num) bind(C)
use, intrinsic :: iso_c_binding
import
integer(c_int64_t), intent(in), value :: trex_file
integer(c_int32_t), intent(in), value :: num
end function trexio_write_state_num_32
end interface
interface
integer(trexio_exit_code) function trexio_write_qmc_num_32 (trex_file, num) bind(C)
use, intrinsic :: iso_c_binding
import
integer(c_int64_t), intent(in), value :: trex_file
integer(c_int32_t), intent(in), value :: num
end function trexio_write_qmc_num_32
end interface
interface
integer(trexio_exit_code) function trexio_write_metadata_code_num_64 (trex_file, num) bind(C)
use, intrinsic :: iso_c_binding
@ -2595,6 +2967,15 @@ interface
end function trexio_write_metadata_unsafe_64
end interface
interface
integer(trexio_exit_code) function trexio_write_electron_num_64 (trex_file, num) bind(C)
use, intrinsic :: iso_c_binding
import
integer(c_int64_t), intent(in), value :: trex_file
integer(c_int64_t), intent(in), value :: num
end function trexio_write_electron_num_64
end interface
interface
integer(trexio_exit_code) function trexio_write_electron_up_num_64 (trex_file, num) bind(C)
use, intrinsic :: iso_c_binding
@ -2685,6 +3066,33 @@ interface
end function trexio_write_mo_num_64
end interface
interface
integer(trexio_exit_code) function trexio_write_determinant_num_64 (trex_file, num) bind(C)
use, intrinsic :: iso_c_binding
import
integer(c_int64_t), intent(in), value :: trex_file
integer(c_int64_t), intent(in), value :: num
end function trexio_write_determinant_num_64
end interface
interface
integer(trexio_exit_code) function trexio_write_state_num_64 (trex_file, num) bind(C)
use, intrinsic :: iso_c_binding
import
integer(c_int64_t), intent(in), value :: trex_file
integer(c_int64_t), intent(in), value :: num
end function trexio_write_state_num_64
end interface
interface
integer(trexio_exit_code) function trexio_write_qmc_num_64 (trex_file, num) bind(C)
use, intrinsic :: iso_c_binding
import
integer(c_int64_t), intent(in), value :: trex_file
integer(c_int64_t), intent(in), value :: num
end function trexio_write_qmc_num_64
end interface
interface
integer(trexio_exit_code) function trexio_write_metadata_code_num (trex_file, num) bind(C)
use, intrinsic :: iso_c_binding
@ -2712,6 +3120,15 @@ interface
end function trexio_write_metadata_unsafe
end interface
interface
integer(trexio_exit_code) function trexio_write_electron_num (trex_file, num) bind(C)
use, intrinsic :: iso_c_binding
import
integer(c_int64_t), intent(in), value :: trex_file
integer(c_int32_t), intent(in), value :: num
end function trexio_write_electron_num
end interface
interface
integer(trexio_exit_code) function trexio_write_electron_up_num (trex_file, num) bind(C)
use, intrinsic :: iso_c_binding
@ -2802,6 +3219,33 @@ interface
end function trexio_write_mo_num
end interface
interface
integer(trexio_exit_code) function trexio_write_determinant_num (trex_file, num) bind(C)
use, intrinsic :: iso_c_binding
import
integer(c_int64_t), intent(in), value :: trex_file
integer(c_int32_t), intent(in), value :: num
end function trexio_write_determinant_num
end interface
interface
integer(trexio_exit_code) function trexio_write_state_num (trex_file, num) bind(C)
use, intrinsic :: iso_c_binding
import
integer(c_int64_t), intent(in), value :: trex_file
integer(c_int32_t), intent(in), value :: num
end function trexio_write_state_num
end interface
interface
integer(trexio_exit_code) function trexio_write_qmc_num (trex_file, num) bind(C)
use, intrinsic :: iso_c_binding
import
integer(c_int64_t), intent(in), value :: trex_file
integer(c_int32_t), intent(in), value :: num
end function trexio_write_qmc_num
end interface
interface
integer(trexio_exit_code) function trexio_write_metadata_package_version_c (trex_file, str, max_str_len) &
bind(C, name="trexio_write_metadata_package_version")
@ -3154,6 +3598,33 @@ interface
end function trexio_write_rdm_1e_dn_32
end interface
interface
integer(trexio_exit_code) function trexio_write_qmc_point_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_qmc_point_32
end interface
interface
integer(trexio_exit_code) function trexio_write_qmc_psi_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_qmc_psi_32
end interface
interface
integer(trexio_exit_code) function trexio_write_qmc_e_loc_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_qmc_e_loc_32
end interface
interface
integer(trexio_exit_code) function trexio_write_nucleus_charge_64 (trex_file, dset) bind(C)
use, intrinsic :: iso_c_binding
@ -3451,6 +3922,33 @@ interface
end function trexio_write_rdm_1e_dn_64
end interface
interface
integer(trexio_exit_code) function trexio_write_qmc_point_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_qmc_point_64
end interface
interface
integer(trexio_exit_code) function trexio_write_qmc_psi_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_qmc_psi_64
end interface
interface
integer(trexio_exit_code) function trexio_write_qmc_e_loc_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_qmc_e_loc_64
end interface
interface
integer(trexio_exit_code) function trexio_write_nucleus_charge (trex_file, dset) bind(C)
use, intrinsic :: iso_c_binding
@ -3748,6 +4246,33 @@ interface
end function trexio_write_rdm_1e_dn
end interface
interface
integer(trexio_exit_code) function trexio_write_qmc_point (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_qmc_point
end interface
interface
integer(trexio_exit_code) function trexio_write_qmc_psi (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_qmc_psi
end interface
interface
integer(trexio_exit_code) function trexio_write_qmc_e_loc (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_qmc_e_loc
end interface
interface
integer(trexio_exit_code) function trexio_write_ao_2e_int_eri (trex_file, &
offset_file, buffer_size, &
@ -4077,6 +4602,143 @@ interface
end function trexio_write_mo_symmetry_low
end interface
interface
integer(trexio_exit_code) function trexio_write_state_label_low (trex_file, dset, max_str_len) bind(C)
use, intrinsic :: iso_c_binding
import
integer(c_int64_t), intent(in), value :: trex_file
character(kind=c_char), intent(in) :: dset(*)
integer(c_int32_t), intent(in), value :: max_str_len
end function trexio_write_state_label_low
end interface
interface
integer(trexio_exit_code) function trexio_has_determinant_list (trex_file) bind(C)
use, intrinsic :: iso_c_binding
import
integer(c_int64_t), intent(in), value :: trex_file
end function trexio_has_determinant_list
end interface
interface
integer(trexio_exit_code) function trexio_has_determinant_coefficient (trex_file) bind(C)
use, intrinsic :: iso_c_binding
import
integer(c_int64_t), intent(in), value :: trex_file
end function trexio_has_determinant_coefficient
end interface
interface
integer(trexio_exit_code) function trexio_read_determinant_list(trex_file, &
offset_file, buffer_size, list) bind(C)
use, intrinsic :: iso_c_binding
import
integer(c_int64_t), intent(in), value :: trex_file
integer(c_int64_t), intent(in), value :: offset_file
integer(c_int64_t), intent(inout) :: buffer_size
integer(c_int64_t), intent(out) :: list(*)
end function trexio_read_determinant_list
end interface
interface
integer(trexio_exit_code) function trexio_read_safe_determinant_list (trex_file, &
offset_file, buffer_size, &
list, list_size) bind(C)
use, intrinsic :: iso_c_binding
import
integer(c_int64_t), intent(in), value :: trex_file
integer(c_int64_t), intent(in), value :: offset_file
integer(c_int64_t), intent(inout) :: buffer_size
integer(c_int64_t), intent(out) :: list(*)
integer(c_int64_t), intent(in), value :: list_size
end function trexio_read_safe_determinant_list
end interface
interface
integer(trexio_exit_code) function trexio_read_safe_determinant_coefficient (trex_file, &
offset_file, buffer_size, &
coefficient, coefficient_size) bind(C)
use, intrinsic :: iso_c_binding
import
integer(c_int64_t), intent(in), value :: trex_file
integer(c_int64_t), intent(in), value :: offset_file
integer(c_int64_t), intent(inout) :: buffer_size
real(c_double), intent(out) :: coefficient(*)
integer(c_int64_t), intent(in), value :: coefficient_size
end function trexio_read_safe_determinant_coefficient
end interface
interface
integer(trexio_exit_code) function trexio_read_determinant_coefficient(trex_file, &
offset_file, buffer_size, coefficient) bind(C)
use, intrinsic :: iso_c_binding
import
integer(c_int64_t), intent(in), value :: trex_file
integer(c_int64_t), intent(in), value :: offset_file
integer(c_int64_t), intent(inout) :: buffer_size
real(c_double), intent(out) :: coefficient(*)
end function trexio_read_determinant_coefficient
end interface
interface
integer(trexio_exit_code) function trexio_read_determinant_coefficient_size (trex_file, &
size_max) bind(C)
use, intrinsic :: iso_c_binding
import
integer(c_int64_t), intent(in), value :: trex_file
integer(c_int64_t), intent(out) :: size_max
end function trexio_read_determinant_coefficient_size
end interface
interface
integer(trexio_exit_code) function trexio_write_determinant_list (trex_file, &
offset_file, buffer_size, list) bind(C)
use, intrinsic :: iso_c_binding
import
integer(c_int64_t), intent(in), value :: trex_file
integer(c_int64_t), intent(in), value :: offset_file
integer(c_int64_t), intent(in), value :: buffer_size
integer(c_int64_t), intent(in) :: list(*)
end function trexio_write_determinant_list
end interface
interface
integer(trexio_exit_code) function trexio_write_safe_determinant_list (trex_file, &
offset_file, buffer_size, &
list, list_size) bind(C)
use, intrinsic :: iso_c_binding
import
integer(c_int64_t), intent(in), value :: trex_file
integer(c_int64_t), intent(in), value :: offset_file
integer(c_int64_t), intent(in), value :: buffer_size
integer(c_int64_t), intent(in) :: list(*)
integer(c_int64_t), intent(in), value :: list_size
end function trexio_write_safe_determinant_list
end interface
interface
integer(trexio_exit_code) function trexio_write_determinant_coefficient(trex_file, &
offset_file, buffer_size, coefficient) bind(C)
use, intrinsic :: iso_c_binding
import
integer(c_int64_t), intent(in), value :: trex_file
integer(c_int64_t), intent(in), value :: offset_file
integer(c_int64_t), intent(in), value :: buffer_size
real(c_double), intent(in) :: coefficient(*)
end function trexio_write_determinant_coefficient
end interface
interface
integer(trexio_exit_code) function trexio_write_safe_determinant_coefficient (trex_file, &
offset_file, buffer_size, &
coefficient, coefficient_size) bind(C)
use, intrinsic :: iso_c_binding
import
integer(c_int64_t), intent(in), value :: trex_file
integer(c_int64_t), intent(in), value :: offset_file
integer(c_int64_t), intent(in), value :: buffer_size
real(c_double), intent(in) :: coefficient(*)
integer(c_int64_t), intent(in), value :: coefficient_size
end function trexio_write_safe_determinant_coefficient
end interface
contains
integer(trexio_t) function trexio_open (filename, mode, back_end, rc_open)
use, intrinsic :: iso_c_binding, only : c_null_char
@ -4361,6 +5023,33 @@ integer(trexio_exit_code) function trexio_read_mo_symmetry (trex_file, dset, max
end function trexio_read_mo_symmetry
integer(trexio_exit_code) function trexio_read_state_label (trex_file, dset, max_str_len)
implicit none
integer(c_int64_t), intent(in), value :: trex_file
integer(c_int32_t), intent(in), value :: max_str_len
character(len=*), intent(inout) :: dset(*)
character, allocatable :: str_compiled(:)
integer(c_int64_t) :: state_num
integer(trexio_exit_code) :: rc
rc = trexio_read_state_num_64(trex_file, state_num)
if (rc /= TREXIO_SUCCESS) trexio_read_state_label = rc
allocate(str_compiled(state_num*(max_str_len+1)+1))
rc = trexio_read_state_label_low(trex_file, str_compiled, max_str_len)
if (rc /= TREXIO_SUCCESS) then
deallocate(str_compiled)
trexio_read_state_label = rc
else
call trexio_str2strarray(str_compiled, state_num, max_str_len, dset)
deallocate(str_compiled)
trexio_read_state_label = TREXIO_SUCCESS
endif
end function trexio_read_state_label
integer(trexio_exit_code) function trexio_write_metadata_package_version (trex_file, str, max_str_len)
use, intrinsic :: iso_c_binding, only : c_null_char
implicit none
@ -4536,4 +5225,24 @@ integer(trexio_exit_code) function trexio_write_mo_symmetry (trex_file, dset, ma
end function trexio_write_mo_symmetry
integer(trexio_exit_code) function trexio_write_state_label (trex_file, dset, max_str_len)
implicit none
integer(c_int64_t), intent(in), value :: trex_file
integer(c_int32_t), intent(in), value :: max_str_len
character(len=*), intent(in) :: dset(*)
character(len=:), allocatable :: str_compiled
integer(c_int64_t) :: state_num
integer(trexio_exit_code) :: rc
rc = trexio_read_state_num_64(trex_file, state_num)
if (rc /= TREXIO_SUCCESS) then
trexio_write_state_label = rc
else
call trexio_strarray2str(dset, state_num, max_str_len, str_compiled)
trexio_write_state_label = trexio_write_state_label_low(trex_file, str_compiled, max_str_len)
endif
end function trexio_write_state_label
end module trexio