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

96 lines
1.8 KiB
Fortran
Raw Normal View History

2023-02-07 17:07:49 +01:00
program save_bitcpsileft_for_qmcchem
2023-03-31 10:32:02 +02:00
implicit none
read_wf = .True.
TOUCH read_wf
call main()
end
subroutine main()
implicit none
2023-02-07 17:07:49 +01:00
integer :: iunit
logical :: exists
double precision :: e_ref
print *, ' '
print *, ' ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~'
print *, ' call save_for_qmcchem before '
print *, ' ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~'
print *, ' '
call write_lr_spindeterminants()
e_ref = 0.d0
iunit = 13
open(unit=iunit, file=trim(ezfio_filename)//'/simulation/e_ref', action='write')
call ezfio_has_fci_energy_pt2(exists)
if(.not.exists) then
call ezfio_has_fci_energy(exists)
if(.not.exists) then
call ezfio_has_cisd_energy(exists)
if(.not.exists) then
2024-05-01 20:25:01 +02:00
call ezfio_has_tc_scf_tcscf_energy(exists)
2023-02-07 17:07:49 +01:00
if(exists) then
2024-05-01 20:25:01 +02:00
call ezfio_get_tc_scf_tcscf_energy(e_ref)
2023-02-07 17:07:49 +01:00
endif
else
call ezfio_get_cisd_energy(e_ref)
endif
else
call ezfio_get_fci_energy(e_ref)
endif
else
call ezfio_get_fci_energy_pt2(e_ref)
endif
write(iunit,*) e_ref
close(iunit)
2024-05-01 20:25:01 +02:00
end
2023-02-07 17:07:49 +01:00
! --
subroutine write_lr_spindeterminants()
use bitmasks
implicit none
integer :: k, l
double precision, allocatable :: buffer(:,:)
PROVIDE psi_bitcleft_bilinear_matrix_values
2023-03-31 10:32:02 +02:00
print *, ' saving left determinants'
print *, ' assuming save_for_qmc called before to save right determinants'
print *, ' N_det = ', N_det
print *, ' N_states = ', N_states
2023-02-07 17:07:49 +01:00
allocate(buffer(N_det,N_states))
do l = 1, N_states
do k = 1, N_det
buffer(k,l) = psi_bitcleft_bilinear_matrix_values(k,l)
enddo
enddo
2023-03-31 10:32:02 +02:00
2023-02-07 17:07:49 +01:00
call ezfio_set_spindeterminants_psi_left_coef_matrix_values(buffer)
deallocate(buffer)
2024-05-01 20:25:01 +02:00
end
2023-02-07 17:07:49 +01:00
! ---