1
0
mirror of https://gitlab.com/scemama/qp_plugins_scemama.git synced 2024-11-07 22:53:42 +01:00
qp_plugins_scemama/devel/trexio/export_trexio.irp.f

526 lines
14 KiB
FortranFixed
Raw Normal View History

2021-05-05 18:17:56 +02:00
program export_trexio
2021-12-10 18:42:49 +01:00
implicit none
read_wf = .True.
SOFT_TOUCH read_wf
call run
end
subroutine run
2021-05-05 18:17:56 +02:00
use trexio
implicit none
BEGIN_DOC
! Exports the wave function in TREXIO format
END_DOC
2021-05-05 17:15:14 +02:00
2022-04-27 16:06:56 +02:00
integer(trexio_t) :: f ! TREXIO file handle
integer(trexio_exit_code) :: rc
2021-12-08 11:09:54 +01:00
double precision, allocatable :: factor(:)
2021-05-05 18:17:56 +02:00
print *, 'TREXIO file : '//trim(trexio_filename)
print *, ''
2022-06-17 19:04:09 +02:00
call system('cp '//trim(trexio_filename)//' '//trim(trexio_filename)//'.bak')
2021-06-25 00:03:06 +02:00
if (backend == 0) then
2022-06-17 19:04:09 +02:00
f = trexio_open(trexio_filename, 'u', TREXIO_HDF5, rc)
2021-06-25 00:03:06 +02:00
else if (backend == 1) then
2022-06-17 19:04:09 +02:00
f = trexio_open(trexio_filename, 'u', TREXIO_TEXT, rc)
2021-05-05 18:17:56 +02:00
endif
2022-04-11 23:05:24 +02:00
if (f == 0_8) then
2021-05-05 18:17:56 +02:00
print *, 'Unable to open TREXIO file for writing'
2021-10-12 16:00:27 +02:00
print *, 'rc = ', rc
2021-05-05 18:17:56 +02:00
stop -1
endif
2021-05-06 19:58:30 +02:00
! ------------------------------------------------------------------------------
2021-06-03 01:18:05 +02:00
! Electrons
! ---------
2021-12-07 19:30:23 +01:00
print *, 'Electrons'
2021-06-03 01:18:05 +02:00
rc = trexio_write_electron_up_num(f, elec_alpha_num)
2022-04-27 15:16:08 +02:00
call trexio_assert(rc, TREXIO_SUCCESS)
2021-06-03 01:18:05 +02:00
rc = trexio_write_electron_dn_num(f, elec_beta_num)
2022-04-27 15:16:08 +02:00
call trexio_assert(rc, TREXIO_SUCCESS)
2021-06-03 01:18:05 +02:00
2021-05-06 19:58:30 +02:00
! Nuclei
! ------
2021-12-07 19:30:23 +01:00
print *, 'Nuclei'
2021-05-05 18:17:56 +02:00
rc = trexio_write_nucleus_num(f, nucl_num)
2022-04-27 15:16:08 +02:00
call trexio_assert(rc, TREXIO_SUCCESS)
2021-05-05 18:17:56 +02:00
rc = trexio_write_nucleus_charge(f, nucl_charge)
2022-04-27 15:16:08 +02:00
call trexio_assert(rc, TREXIO_SUCCESS)
2021-05-05 18:17:56 +02:00
rc = trexio_write_nucleus_coord(f, nucl_coord_transp)
2022-04-27 15:16:08 +02:00
call trexio_assert(rc, TREXIO_SUCCESS)
2021-05-05 18:17:56 +02:00
2021-06-25 00:03:06 +02:00
rc = trexio_write_nucleus_label(f, nucl_label, 32)
2022-04-27 15:16:08 +02:00
call trexio_assert(rc, TREXIO_SUCCESS)
2021-06-03 01:18:05 +02:00
2021-12-10 18:42:49 +01:00
rc = trexio_write_nucleus_repulsion(f, nuclear_repulsion)
2022-04-27 15:16:08 +02:00
call trexio_assert(rc, TREXIO_SUCCESS)
2021-12-10 18:42:49 +01:00
2021-06-03 01:18:05 +02:00
! Pseudo-potentials
! -----------------
2022-01-10 13:19:22 +01:00
if (do_pseudo) then
2021-12-07 19:30:23 +01:00
2022-01-10 13:19:22 +01:00
print *, 'ECP'
integer :: num
2021-12-30 14:42:50 +01:00
2022-01-10 13:19:22 +01:00
num = 0
do k=1,pseudo_klocmax
2021-12-30 14:42:50 +01:00
do i=1,nucl_num
2022-01-10 13:19:22 +01:00
if (pseudo_dz_k(i,k) /= 0.d0) then
2021-12-30 14:42:50 +01:00
num = num+1
end if
end do
end do
2022-01-03 01:43:01 +01:00
do l=0,pseudo_lmax
2021-12-30 14:42:50 +01:00
do k=1,pseudo_kmax
2022-01-10 13:19:22 +01:00
do i=1,nucl_num
if (pseudo_dz_kl(i,k,l) /= 0.d0) then
num = num+1
end if
end do
2021-12-30 14:42:50 +01:00
end do
end do
2022-01-10 13:19:22 +01:00
integer, allocatable :: ang_mom(:), nucleus_index(:), power(:), lmax(:)
double precision, allocatable :: exponent(:), coefficient(:)
allocate(ang_mom(num), nucleus_index(num), exponent(num), coefficient(num), power(num), &
lmax(nucl_num) )
do i=1,nucl_num
lmax(i) = -1
do l=0,pseudo_lmax
do k=1,pseudo_kmax
if (pseudo_dz_kl_transp(k,l,i) /= 0.d0) then
lmax(i) = max(lmax(i), l)
end if
end do
end do
2021-12-30 14:42:50 +01:00
end do
2022-01-10 13:19:22 +01:00
j = 0
do i=1,nucl_num
do k=1,pseudo_klocmax
if (pseudo_dz_k_transp(k,i) /= 0.d0) then
2021-12-30 14:42:50 +01:00
j = j+1
2022-01-10 13:19:22 +01:00
ang_mom(j) = lmax(i)+1
2021-12-30 14:42:50 +01:00
nucleus_index(j) = i
2022-01-10 13:19:22 +01:00
exponent(j) = pseudo_dz_k_transp(k,i)
coefficient(j) = pseudo_v_k_transp(k,i)
power(j) = pseudo_n_k_transp(k,i)
2021-12-30 14:42:50 +01:00
end if
end do
2022-01-10 13:19:22 +01:00
do l=0,lmax(i)
do k=1,pseudo_kmax
if (pseudo_dz_kl_transp(k,l,i) /= 0.d0) then
j = j+1
ang_mom(j) = l
nucleus_index(j) = i
exponent(j) = pseudo_dz_kl_transp(k,l,i)
coefficient(j) = pseudo_v_kl_transp(k,l,i)
power(j) = pseudo_n_kl_transp(k,l,i)
end if
end do
end do
2021-12-30 14:42:50 +01:00
end do
2022-01-10 13:19:22 +01:00
lmax(:) = lmax(:)+1
rc = trexio_write_ecp_max_ang_mom_plus_1(f, lmax)
2022-04-27 15:16:08 +02:00
call trexio_assert(rc, TREXIO_SUCCESS)
2021-12-30 14:42:50 +01:00
2022-01-10 13:19:22 +01:00
rc = trexio_write_ecp_z_core(f, int(nucl_charge_remove))
2022-04-27 15:16:08 +02:00
call trexio_assert(rc, TREXIO_SUCCESS)
2021-12-30 14:42:50 +01:00
2022-01-10 13:19:22 +01:00
rc = trexio_write_ecp_num(f, num)
2022-04-27 15:16:08 +02:00
call trexio_assert(rc, TREXIO_SUCCESS)
2021-12-30 14:42:50 +01:00
2022-01-10 13:19:22 +01:00
rc = trexio_write_ecp_ang_mom(f, ang_mom)
2022-04-27 15:16:08 +02:00
call trexio_assert(rc, TREXIO_SUCCESS)
2021-12-30 14:42:50 +01:00
2022-01-10 13:19:22 +01:00
rc = trexio_write_ecp_nucleus_index(f, nucleus_index)
2022-04-27 15:16:08 +02:00
call trexio_assert(rc, TREXIO_SUCCESS)
2021-12-30 14:42:50 +01:00
2022-01-10 13:19:22 +01:00
rc = trexio_write_ecp_exponent(f, exponent)
2022-04-27 15:16:08 +02:00
call trexio_assert(rc, TREXIO_SUCCESS)
2021-12-30 14:42:50 +01:00
2022-01-10 13:19:22 +01:00
rc = trexio_write_ecp_coefficient(f, coefficient)
2022-04-27 15:16:08 +02:00
call trexio_assert(rc, TREXIO_SUCCESS)
2021-12-30 14:42:50 +01:00
2022-01-10 13:19:22 +01:00
rc = trexio_write_ecp_power(f, power)
2022-04-27 15:16:08 +02:00
call trexio_assert(rc, TREXIO_SUCCESS)
2021-06-03 01:18:05 +02:00
2022-01-10 13:19:22 +01:00
endif
2021-05-05 18:17:56 +02:00
2021-05-06 19:58:30 +02:00
! Basis
! -----
2021-12-07 19:30:23 +01:00
print *, 'Basis'
2021-06-25 00:03:06 +02:00
2021-05-05 18:17:56 +02:00
2021-12-07 19:30:23 +01:00
rc = trexio_write_basis_type(f, 'Gaussian', len('Gaussian'))
2022-04-27 15:16:08 +02:00
call trexio_assert(rc, TREXIO_SUCCESS)
2021-06-03 01:18:05 +02:00
2021-12-07 19:30:23 +01:00
rc = trexio_write_basis_prim_num(f, prim_num)
2022-04-27 15:16:08 +02:00
call trexio_assert(rc, TREXIO_SUCCESS)
2021-06-03 01:18:05 +02:00
2021-12-07 19:30:23 +01:00
rc = trexio_write_basis_shell_num(f, shell_num)
2022-04-27 15:16:08 +02:00
call trexio_assert(rc, TREXIO_SUCCESS)
2021-05-05 18:17:56 +02:00
2021-12-07 19:30:23 +01:00
rc = trexio_write_basis_nucleus_index(f, basis_nucleus_index)
2022-04-27 15:16:08 +02:00
call trexio_assert(rc, TREXIO_SUCCESS)
2021-06-03 01:18:05 +02:00
2021-12-07 19:30:23 +01:00
rc = trexio_write_basis_shell_ang_mom(f, shell_ang_mom)
2022-04-27 15:16:08 +02:00
call trexio_assert(rc, TREXIO_SUCCESS)
2021-06-08 15:40:54 +02:00
2021-12-07 19:30:23 +01:00
allocate(factor(shell_num))
if (ao_normalized) then
factor(1:shell_num) = shell_normalization_factor(1:shell_num)
else
factor(1:shell_num) = 1.d0
endif
rc = trexio_write_basis_shell_factor(f, factor)
2022-04-27 15:16:08 +02:00
call trexio_assert(rc, TREXIO_SUCCESS)
2021-06-03 01:18:05 +02:00
2021-12-07 19:30:23 +01:00
deallocate(factor)
2021-06-03 01:18:05 +02:00
2021-12-07 19:30:23 +01:00
rc = trexio_write_basis_shell_index(f, shell_index)
2022-04-27 15:16:08 +02:00
call trexio_assert(rc, TREXIO_SUCCESS)
2021-06-03 01:18:05 +02:00
rc = trexio_write_basis_exponent(f, prim_expo)
2022-04-27 15:16:08 +02:00
call trexio_assert(rc, TREXIO_SUCCESS)
2021-06-03 01:18:05 +02:00
rc = trexio_write_basis_coefficient(f, prim_coef)
2022-04-27 15:16:08 +02:00
call trexio_assert(rc, TREXIO_SUCCESS)
2021-06-03 01:18:05 +02:00
allocate(factor(prim_num))
if (primitives_normalized) then
factor(1:prim_num) = prim_normalization_factor(1:prim_num)
else
factor(1:prim_num) = 1.d0
endif
rc = trexio_write_basis_prim_factor(f, factor)
2022-04-27 15:16:08 +02:00
call trexio_assert(rc, TREXIO_SUCCESS)
2021-06-03 01:18:05 +02:00
deallocate(factor)
2021-05-06 19:58:30 +02:00
! Atomic orbitals
! ---------------
2021-12-07 19:30:23 +01:00
print *, 'AOs'
2021-05-06 19:58:30 +02:00
rc = trexio_write_ao_num(f, ao_num)
2022-04-27 15:16:08 +02:00
call trexio_assert(rc, TREXIO_SUCCESS)
2021-05-06 19:58:30 +02:00
rc = trexio_write_ao_cartesian(f, 1)
2022-04-27 15:16:08 +02:00
call trexio_assert(rc, TREXIO_SUCCESS)
2021-05-06 19:58:30 +02:00
2021-06-03 01:18:05 +02:00
rc = trexio_write_ao_shell(f, ao_shell)
2022-04-27 15:16:08 +02:00
call trexio_assert(rc, TREXIO_SUCCESS)
2021-06-03 01:18:05 +02:00
2021-08-24 15:14:29 +02:00
integer :: i, pow0(3), powA(3), j, k, l, nz
double precision :: normA, norm0, C_A(3), overlap_x, overlap_z, overlap_y, c
nz=100
C_A(1) = 0.d0
C_A(2) = 0.d0
C_A(3) = 0.d0
2021-06-03 01:18:05 +02:00
allocate(factor(ao_num))
if (ao_normalized) then
do i=1,ao_num
2021-08-24 15:14:29 +02:00
l = ao_first_of_shell(ao_shell(i))
factor(i) = (ao_coef_normalized(i,1)+tiny(1.d0))/(ao_coef_normalized(l,1)+tiny(1.d0))
2021-06-03 01:18:05 +02:00
enddo
else
factor(:) = 1.d0
endif
rc = trexio_write_ao_normalization(f, factor)
2022-04-27 15:16:08 +02:00
call trexio_assert(rc, TREXIO_SUCCESS)
2021-06-03 01:18:05 +02:00
deallocate(factor)
2021-05-06 19:58:30 +02:00
! One-e AO integrals
! ------------------
2022-05-05 13:26:51 +02:00
if (export_ao_one_e_ints) then
print *, 'AO one-e integrals'
2021-12-07 19:30:23 +01:00
2022-05-05 13:26:51 +02:00
rc = trexio_write_ao_1e_int_overlap(f,ao_overlap)
call trexio_assert(rc, TREXIO_SUCCESS)
2021-05-06 19:58:30 +02:00
2022-05-05 13:26:51 +02:00
rc = trexio_write_ao_1e_int_kinetic(f,ao_kinetic_integrals)
call trexio_assert(rc, TREXIO_SUCCESS)
2021-05-06 19:58:30 +02:00
2022-05-05 13:26:51 +02:00
rc = trexio_write_ao_1e_int_potential_n_e(f,ao_integrals_n_e)
2022-04-27 15:16:08 +02:00
call trexio_assert(rc, TREXIO_SUCCESS)
2021-05-06 19:58:30 +02:00
2022-05-05 13:26:51 +02:00
if (do_pseudo) then
rc = trexio_write_ao_1e_int_ecp(f, ao_pseudo_integrals_local + ao_pseudo_integrals_non_local)
call trexio_assert(rc, TREXIO_SUCCESS)
endif
rc = trexio_write_ao_1e_int_core_hamiltonian(f,ao_one_e_integrals)
call trexio_assert(rc, TREXIO_SUCCESS)
end if
2021-05-06 19:58:30 +02:00
2021-12-08 11:09:54 +01:00
! Two-e AO integrals
! ------------------
2022-05-05 13:26:51 +02:00
if (export_ao_two_e_ints) then
print *, 'AO two-e integrals'
2021-12-10 18:42:49 +01:00
PROVIDE ao_two_e_integrals_in_map
integer(8), parameter :: BUFSIZE=10000_8
double precision :: eri_buffer(BUFSIZE), integral
integer(4) :: eri_index(4,BUFSIZE)
integer(8) :: icount, offset
double precision, external :: get_ao_two_e_integral
icount = 0_8
offset = 0_8
do l=1,ao_num
do k=1,ao_num
do j=l,ao_num
do i=k,ao_num
if (i==j .and. k<l) cycle
if (i<j) cycle
integral = get_ao_two_e_integral(i,j,k,l,ao_integrals_map)
if (integral == 0.d0) cycle
icount += 1_8
eri_buffer(icount) = integral
eri_index(1,icount) = i
eri_index(2,icount) = j
eri_index(3,icount) = k
eri_index(4,icount) = l
if (icount == BUFSIZE) then
rc = trexio_write_ao_2e_int_eri(f, offset, icount, eri_index, eri_buffer)
2022-04-27 15:16:08 +02:00
call trexio_assert(rc, TREXIO_SUCCESS)
2021-12-10 18:42:49 +01:00
offset += icount
2022-01-10 10:42:35 +01:00
icount = 0_8
2021-12-10 18:42:49 +01:00
end if
end do
2021-12-08 11:09:54 +01:00
end do
end do
end do
2021-12-10 18:42:49 +01:00
if (icount >= 0_8) then
rc = trexio_write_ao_2e_int_eri(f, offset, icount, eri_index, eri_buffer)
2022-04-27 15:16:08 +02:00
call trexio_assert(rc, TREXIO_SUCCESS)
2021-12-10 18:42:49 +01:00
end if
2021-12-08 11:09:54 +01:00
end if
2021-05-06 19:58:30 +02:00
! Molecular orbitals
! ------------------
2021-12-07 19:30:23 +01:00
print *, 'MOs'
2021-12-30 14:42:50 +01:00
rc = trexio_write_mo_type(f, mo_label, len(trim(mo_label)))
2022-04-27 15:16:08 +02:00
call trexio_assert(rc, TREXIO_SUCCESS)
2021-05-06 19:58:30 +02:00
rc = trexio_write_mo_num(f, mo_num)
2022-04-27 15:16:08 +02:00
call trexio_assert(rc, TREXIO_SUCCESS)
2021-05-06 19:58:30 +02:00
2021-06-03 01:18:05 +02:00
rc = trexio_write_mo_coefficient(f, mo_coef)
2022-04-27 15:16:08 +02:00
call trexio_assert(rc, TREXIO_SUCCESS)
2021-05-06 19:58:30 +02:00
! One-e MO integrals
! ------------------
2022-05-05 13:26:51 +02:00
if (export_mo_two_e_ints) then
print *, 'MO one-e integrals'
2021-05-06 19:58:30 +02:00
2022-05-05 13:26:51 +02:00
rc = trexio_write_mo_1e_int_kinetic(f,mo_kinetic_integrals)
call trexio_assert(rc, TREXIO_SUCCESS)
2021-05-06 19:58:30 +02:00
2022-05-05 13:26:51 +02:00
rc = trexio_write_mo_1e_int_potential_n_e(f,mo_integrals_n_e)
2022-04-27 15:16:08 +02:00
call trexio_assert(rc, TREXIO_SUCCESS)
2021-12-08 11:09:54 +01:00
2022-05-05 13:26:51 +02:00
if (do_pseudo) then
rc = trexio_write_mo_1e_int_ecp(f,mo_pseudo_integrals_local)
call trexio_assert(rc, TREXIO_SUCCESS)
endif
rc = trexio_write_mo_1e_int_core_hamiltonian(f,mo_one_e_integrals)
call trexio_assert(rc, TREXIO_SUCCESS)
end if
2021-05-06 19:58:30 +02:00
2021-12-08 11:09:54 +01:00
! Two-e MO integrals
! ------------------
2021-05-06 19:58:30 +02:00
2022-05-05 13:26:51 +02:00
if (export_mo_two_e_ints) then
print *, 'MO two-e integrals'
2021-12-10 18:42:49 +01:00
PROVIDE mo_two_e_integrals_in_map
double precision, external :: mo_two_e_integral
icount = 0_8
offset = 0_8
do l=1,mo_num
do k=1,mo_num
do j=l,mo_num
do i=k,mo_num
if (i==j .and. k<l) cycle
if (i<j) cycle
integral = mo_two_e_integral(i,j,k,l)
if (integral == 0.d0) cycle
icount += 1_8
eri_buffer(icount) = integral
eri_index(1,icount) = i
eri_index(2,icount) = j
eri_index(3,icount) = k
eri_index(4,icount) = l
if (icount == BUFSIZE) then
rc = trexio_write_mo_2e_int_eri(f, offset, icount, eri_index, eri_buffer)
2022-04-27 15:16:08 +02:00
call trexio_assert(rc, TREXIO_SUCCESS)
2021-12-10 18:42:49 +01:00
offset += icount
2022-01-10 10:42:35 +01:00
icount = 0_8
2021-12-10 18:42:49 +01:00
end if
end do
2021-12-08 11:09:54 +01:00
end do
end do
end do
2021-12-10 18:42:49 +01:00
if (icount >= 0_8) then
rc = trexio_write_mo_2e_int_eri(f, offset, icount, eri_index, eri_buffer)
2022-04-27 15:16:08 +02:00
call trexio_assert(rc, TREXIO_SUCCESS)
2021-12-10 18:42:49 +01:00
end if
2021-12-08 11:09:54 +01:00
end if
2021-05-06 19:58:30 +02:00
2021-12-10 18:42:49 +01:00
! One-e RDM
! ---------
2021-05-06 19:58:30 +02:00
2021-12-10 18:42:49 +01:00
rc = trexio_write_rdm_1e(f,one_e_dm_mo)
2022-04-27 15:16:08 +02:00
call trexio_assert(rc, TREXIO_SUCCESS)
2021-12-10 18:42:49 +01:00
rc = trexio_write_rdm_1e_up(f,one_e_dm_mo_alpha_average)
2022-04-27 15:16:08 +02:00
call trexio_assert(rc, TREXIO_SUCCESS)
2021-05-06 19:58:30 +02:00
2021-12-10 18:42:49 +01:00
rc = trexio_write_rdm_1e_dn(f,one_e_dm_mo_beta_average)
2022-04-27 15:16:08 +02:00
call trexio_assert(rc, TREXIO_SUCCESS)
2021-12-10 18:42:49 +01:00
! Two-e RDM
! ---------
if (export_rdm) then
PROVIDE two_e_dm_mo
2022-05-05 13:26:51 +02:00
print *, 'Two-e RDM'
2021-12-10 18:42:49 +01:00
icount = 0_8
offset = 0_8
do l=1,mo_num
do k=1,mo_num
do j=1,mo_num
do i=1,mo_num
integral = two_e_dm_mo(i,j,k,l)
if (integral == 0.d0) cycle
icount += 1_8
eri_buffer(icount) = integral
eri_index(1,icount) = i
eri_index(2,icount) = j
eri_index(3,icount) = k
eri_index(4,icount) = l
if (icount == BUFSIZE) then
rc = trexio_write_rdm_2e(f, offset, icount, eri_index, eri_buffer)
2022-04-27 15:16:08 +02:00
call trexio_assert(rc, TREXIO_SUCCESS)
2021-12-10 18:42:49 +01:00
offset += icount
2022-01-10 10:42:35 +01:00
icount = 0_8
2021-12-10 18:42:49 +01:00
end if
end do
end do
end do
end do
if (icount >= 0_8) then
rc = trexio_write_rdm_2e(f, offset, icount, eri_index, eri_buffer)
2022-04-27 15:16:08 +02:00
call trexio_assert(rc, TREXIO_SUCCESS)
2021-12-10 18:42:49 +01:00
end if
end if
2021-05-06 19:58:30 +02:00
! ------------------------------------------------------------------------------
2022-04-27 15:16:08 +02:00
! Determinants
! ------------
2021-05-05 18:17:56 +02:00
2022-04-27 15:16:08 +02:00
integer*8, allocatable :: det_buffer(:,:,:)
double precision, allocatable :: coef_buffer(:,:)
integer :: nint
2021-05-05 18:17:56 +02:00
2022-04-27 15:16:08 +02:00
! 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
2022-04-27 16:06:56 +02:00
rc = trexio_write_state_num(f, n_states)
call trexio_assert(rc, TREXIO_SUCCESS)
2022-04-27 15:16:08 +02:00
rc = trexio_set_state (f, 0)
2022-04-27 16:06:56 +02:00
call trexio_assert(rc, TREXIO_SUCCESS)
2022-04-27 15:16:08 +02:00
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 trexio_assert(rc, TREXIO_SUCCESS)
2021-05-05 18:17:56 +02:00
2021-05-05 17:15:14 +02:00
end
2022-04-27 15:16:08 +02:00
2021-05-05 17:15:14 +02:00
! -*- mode: f90 -*-