9
1
mirror of https://github.com/QuantumPackage/qp2.git synced 2024-06-01 02:05:18 +02:00
qp2/src/fci_tc_bi/fci_tc_bi_ortho.irp.f

110 lines
2.9 KiB
Fortran
Raw Normal View History

2023-07-02 21:49:25 +02:00
! ---
program fci_tc_bi
2023-02-07 17:28:11 +01:00
BEGIN_DOC
! Selected Full Configuration Interaction with stochastic selection
! and PT2.
!
! This program performs a |CIPSI|-like selected |CI| using a
! stochastic scheme for both the selection of the important Slater
! determinants and the computation of the |PT2| correction. This
! |CIPSI|-like algorithm will be performed for the lowest states of
! the variational space (see :option:`determinants n_states`). The
! |FCI| program will stop when reaching at least one the two following
! conditions:
!
! * number of Slater determinants > :option:`determinants n_det_max`
! * abs(|PT2|) less than :option:`perturbation pt2_max`
!
! The following other options can be of interest:
!
! :option:`determinants read_wf`
! When set to |false|, the program starts with a ROHF-like Slater
! determinant as a guess wave function. When set to |true|, the
! program starts with the wave function(s) stored in the |EZFIO|
! directory as guess wave function(s).
!
! :option:`determinants s2_eig`
! When set to |true|, the selection will systematically add all the
! necessary Slater determinants in order to have a pure spin wave
! function with an |S^2| value corresponding to
! :option:`determinants expected_s2`.
!
! For excited states calculations, it is recommended to start with
! :ref:`cis` or :ref:`cisd` guess wave functions, eventually in
! a restricted set of |MOs|, and to set :option:`determinants s2_eig`
! to |true|.
!
END_DOC
2023-07-02 21:49:25 +02:00
implicit none
2023-02-07 17:28:11 +01:00
my_grid_becke = .True.
2023-07-02 21:49:25 +02:00
PROVIDE tc_grid1_a tc_grid1_r
my_n_pt_r_grid = tc_grid1_r
my_n_pt_a_grid = tc_grid1_a
2023-02-07 17:28:11 +01:00
touch my_grid_becke my_n_pt_r_grid my_n_pt_a_grid
2023-07-02 15:29:21 +02:00
2023-02-07 17:28:11 +01:00
pruning = -1.d0
touch pruning
2023-07-02 15:29:21 +02:00
2023-02-07 17:28:11 +01:00
! pt2_relative_error = 0.01d0
! touch pt2_relative_error
2023-07-02 15:29:21 +02:00
call run_cipsi_tc()
2023-02-07 17:28:11 +01:00
end
2023-07-02 15:29:21 +02:00
! ---
2023-02-07 17:28:11 +01:00
2023-07-02 15:29:21 +02:00
subroutine run_cipsi_tc()
2023-02-07 17:28:11 +01:00
implicit none
2023-06-04 09:19:34 +02:00
if (.not. is_zmq_slave) then
2023-02-07 17:28:11 +01:00
PROVIDE psi_det psi_coef mo_bi_ortho_tc_two_e mo_bi_ortho_tc_one_e
2023-06-04 09:19:34 +02:00
2023-07-02 21:49:25 +02:00
if((elec_alpha_num+elec_beta_num) .ge. 3) then
2023-07-02 15:29:21 +02:00
if(three_body_h_tc) then
2023-06-04 09:19:34 +02:00
call provide_all_three_ints_bi_ortho()
2023-02-07 17:28:11 +01:00
endif
endif
2023-07-02 21:49:25 +02:00
FREE int2_grad1_u12_ao int2_grad1_u12_ao_t int2_grad1_u12_ao_transp
FREE int2_grad1_u12_bimo_transp
2023-04-24 01:22:24 +02:00
write(json_unit,json_array_open_fmt) 'fci_tc'
2023-02-07 17:28:11 +01:00
2023-07-02 21:49:25 +02:00
if(do_pt2) then
2023-07-02 15:29:21 +02:00
call run_stochastic_cipsi()
2023-02-07 17:28:11 +01:00
else
2023-07-02 15:29:21 +02:00
call run_cipsi()
2023-02-07 17:28:11 +01:00
endif
2023-04-24 01:22:24 +02:00
write(json_unit,json_dict_uopen_fmt)
write(json_unit,json_dict_close_fmtx)
write(json_unit,json_array_close_fmtx)
call json_close
2023-02-07 17:28:11 +01:00
else
2023-02-07 17:28:11 +01:00
PROVIDE mo_bi_ortho_tc_one_e mo_bi_ortho_tc_two_e pt2_min_parallel_tasks
2023-07-02 21:49:25 +02:00
if((elec_alpha_num+elec_beta_num) .ge. 3) then
2023-07-02 15:29:21 +02:00
if(three_body_h_tc) then
call provide_all_three_ints_bi_ortho()
2023-02-07 17:28:11 +01:00
endif
endif
2023-07-02 21:49:25 +02:00
FREE int2_grad1_u12_ao int2_grad1_u12_ao_t int2_grad1_u12_ao_transp
FREE int2_grad1_u12_bimo_transp
2023-02-07 17:28:11 +01:00
call run_slave_cipsi
endif
end