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

Compare commits

...

4 Commits

Author SHA1 Message Date
114d4a695c Fixed bug 2021-12-03 17:39:10 +01:00
f918fcf13e Fixed bug in det-csf provider 2021-12-03 15:30:07 +01:00
4d380c9948 File name 2021-12-03 15:20:59 +01:00
8eef226634 Det-CSF conversion 2021-12-03 14:48:52 +01:00
5 changed files with 1254 additions and 675 deletions

View File

@ -12,9 +12,9 @@ program export_trexio
print *, '' print *, ''
if (backend == 0) then if (backend == 0) then
f = trexio_open(trexio_filename, 'w', TREXIO_HDF5) f = trexio_open(trexio_filename, 'w', TREXIO_HDF5, rc)
else if (backend == 1) then else if (backend == 1) then
f = trexio_open(trexio_filename, 'w', TREXIO_TEXT) f = trexio_open(trexio_filename, 'w', TREXIO_TEXT, rc)
endif endif
if (f == 0) then if (f == 0) then
print *, 'Unable to open TREXIO file for writing' print *, 'Unable to open TREXIO file for writing'

File diff suppressed because it is too large Load Diff

View File

@ -1 +1 @@
determinants fci determinants fci csf

View File

@ -1,4 +1,4 @@
program qmcpack program save_for_camp
implicit none implicit none
BEGIN_DOC BEGIN_DOC
! Generates a file for CHAMP ! Generates a file for CHAMP
@ -23,6 +23,7 @@ program qmcpack
call system('rm '//trim(ezfio_filename)//'/mo_basis/ao_md5') call system('rm '//trim(ezfio_filename)//'/mo_basis/ao_md5')
call system('$QP_ROOT/src/champ/qp_convert.py '//trim(ezfio_filename)) call system('$QP_ROOT/src/champ/qp_convert.py '//trim(ezfio_filename))
call write_champ_csf()
! integer :: iunit ! integer :: iunit
! integer, external :: getUnitAndOpen ! integer, external :: getUnitAndOpen
! iunit = getUnitAndOpen(trim(ezfio_filename)//'.H','w') ! iunit = getUnitAndOpen(trim(ezfio_filename)//'.H','w')

View File

@ -0,0 +1,99 @@
subroutine write_champ_csf
implicit none
integer, parameter :: istate=1
character*(2048) :: format
integer :: i, n_elements, j, k
integer, allocatable :: list(:,:)
integer :: startdet, enddet, iunit
integer :: ndetI, bfIcfg, s
double precision :: phasedet
integer :: idx
open(newunit=iunit, file='det.'//ezfio_filename)
write(iunit, '(A, X, I4, X, A, X, I4)') '&electrons nelec', elec_num, 'nup', elec_alpha_num
! Determinants
write(iunit, '(A, I10)') 'determinants', N_det
write(format,*) '(', N_det, '(F12.8, X))'
write(iunit, format) psi_coef(1:N_det,istate)
write(format,*) '( ', elec_alpha_num, '(I4,X), 2X, ', elec_beta_num, '(I4,X))'
allocate ( list(bit_kind_size,2) )
do i=1, N_det
call bitstring_to_list( psi_det(1,1,i), list(1,1), n_elements, N_int)
call bitstring_to_list( psi_det(1,2,i), list(1,2), n_elements, N_int)
write(iunit,format) list(1:elec_alpha_num,1), list(1:elec_beta_num,2)
end do
write(iunit, '(A)') 'end'
! CSF
write(iunit, '(A, I10, X, I3)') 'csf', N_csf, N_states
write(format,*) '(', N_csf, '(F12.8, X))'
do i=1,N_states
write(iunit, format) psi_csf_coef(1:N_csf,i)
end do
write(iunit, '(A)') 'end'
! CSF map
phasedet = 1.0d0
ndetI = 0
do i=1,N_configuration
startdet = psi_configuration_to_psi_det(1,i)
enddet = psi_configuration_to_psi_det(2,i)
s = 0
do k=1,N_int
if (psi_configuration(k,1,i) == 0_bit_kind) cycle
s = s + popcnt(psi_configuration(k,1,i))
enddo
bfIcfg = max(1,nint((binom(s,(s+1)/2)-binom(s,((s+1)/2)+1))))
do k=1,bfIcfg
do j = startdet, enddet
if (DetToCSFTransformationMatrix(s,k,j-startdet+1) == 0.d0) cycle
ndetI += 1
end do
end do
end do
write(iunit, '(A)') 'csfmap'
write(iunit, '(I10, I10, I10)') n_csf, n_det, ndetI
do i=1,N_configuration
startdet = psi_configuration_to_psi_det(1,i)
enddet = psi_configuration_to_psi_det(2,i)
s = 0
do k=1,N_int
if (psi_configuration(k,1,i) == 0_bit_kind) cycle
s = s + popcnt(psi_configuration(k,1,i))
enddo
bfIcfg = max(1,nint((binom(s,(s+1)/2)-binom(s,((s+1)/2)+1))))
do k=1,bfIcfg
ndetI = 0
do j = startdet, enddet
if (DetToCSFTransformationMatrix(s,k,j-startdet+1) == 0.d0) cycle
ndetI += 1
end do
write(iunit, '(I4)') ndetI
do j = startdet, enddet
if (DetToCSFTransformationMatrix(s,k,j-startdet+1) == 0.d0) cycle
idx = psi_configuration_to_psi_det_data(j)
call get_phase_qp_to_cfg(psi_det(1,1,idx), psi_det(1,2,idx), phasedet)
write(iunit, '(I10, F18.12)') idx, DetToCSFTransformationMatrix(s,k,j-startdet+1)*phasedet
end do
end do
end do
write(iunit, '(A)') 'end'
end