diff --git a/src/DDCI_selected/ASSUMPTIONS.rst b/src/DDCI_selected/ASSUMPTIONS.rst new file mode 100644 index 00000000..e69de29b diff --git a/src/DDCI_selected/H_apply.irp.f b/src/DDCI_selected/H_apply.irp.f new file mode 100644 index 00000000..5f6c6457 --- /dev/null +++ b/src/DDCI_selected/H_apply.irp.f @@ -0,0 +1,16 @@ +use bitmasks +BEGIN_SHELL [ /usr/bin/env python ] +from generate_h_apply import * + +s = H_apply("DDCI_selection") +s.set_selection_pt2("epstein_nesbet_2x2") +s.set_filter_2h_2p() +print s + +s = H_apply("DDCI_PT2") +s.set_perturbation("epstein_nesbet_2x2") +s.set_filter_2h_2p() +print s + +END_SHELL + diff --git a/src/DDCI_selected/Makefile b/src/DDCI_selected/Makefile new file mode 100644 index 00000000..b2ea1de1 --- /dev/null +++ b/src/DDCI_selected/Makefile @@ -0,0 +1,8 @@ +default: all + +# Define here all new external source files and objects.Don't forget to prefix the +# object files with IRPF90_temp/ +SRC= +OBJ= + +include $(QPACKAGE_ROOT)/src/Makefile.common diff --git a/src/DDCI_selected/NEEDED_MODULES b/src/DDCI_selected/NEEDED_MODULES new file mode 100644 index 00000000..c24125e8 --- /dev/null +++ b/src/DDCI_selected/NEEDED_MODULES @@ -0,0 +1 @@ +AOs BiInts Bitmask Dets Electrons Ezfio_files Generators_CAS Hartree_Fock MOGuess MonoInts MOs Nuclei Output Perturbation Selectors_full Utils diff --git a/src/DDCI_selected/README.rst b/src/DDCI_selected/README.rst new file mode 100644 index 00000000..33d21997 --- /dev/null +++ b/src/DDCI_selected/README.rst @@ -0,0 +1,4 @@ +==================== +DDCI_selected Module +==================== + diff --git a/src/DDCI_selected/ddci.irp.f b/src/DDCI_selected/ddci.irp.f new file mode 100644 index 00000000..3f3b6159 --- /dev/null +++ b/src/DDCI_selected/ddci.irp.f @@ -0,0 +1,65 @@ +program full_ci + implicit none + integer :: i,k + + + double precision, allocatable :: pt2(:), norm_pert(:), H_pert_diag(:) + integer :: N_st, degree + N_st = N_states + allocate (pt2(N_st), norm_pert(N_st),H_pert_diag(N_st)) + character*(64) :: perturbation + + pt2 = 1.d0 + diag_algorithm = "Lapack" + if (N_det > n_det_max_fci) then + call diagonalize_CI + call save_wavefunction + psi_det = psi_det_sorted + psi_coef = psi_coef_sorted + N_det = n_det_max_fci + soft_touch N_det psi_det psi_coef + call diagonalize_CI + call save_wavefunction + print *, 'N_det = ', N_det + print *, 'N_states = ', N_states + print *, 'PT2 = ', pt2 + print *, 'E = ', CI_energy + print *, 'E+PT2 = ', CI_energy+pt2 + print *, '-----' + endif + + do while (N_det < n_det_max_fci.and.maxval(abs(pt2(1:N_st))) > pt2_max) + call H_apply_DDCI_selection(pt2, norm_pert, H_pert_diag, N_st) + + PROVIDE psi_coef + PROVIDE psi_det + PROVIDE psi_det_sorted + + if (N_det > n_det_max_fci) then + psi_det = psi_det_sorted + psi_coef = psi_coef_sorted + N_det = n_det_max_fci + soft_touch N_det psi_det psi_coef + endif + call diagonalize_CI + call save_wavefunction + print *, 'N_det = ', N_det + print *, 'N_states = ', N_states + print *, 'PT2 = ', pt2 + print *, 'E = ', CI_energy + print *, 'E+PT2 = ', CI_energy+pt2 + print *, '-----' + call ezfio_set_full_ci_energy(CI_energy) + if (abort_all) then + exit + endif + enddo + if(do_pt2_end)then + call H_apply_DDCI_pt2(pt2, norm_pert, H_pert_diag, N_st) + print *, 'N_det = ', N_det + print *, 'N_states = ', N_states + print *, 'PT2 = ', pt2 + print *, 'E = ', CI_energy + print *, 'E+PT2 = ', CI_energy+pt2 + endif +end diff --git a/src/DDCI_selected/options.irp.f b/src/DDCI_selected/options.irp.f new file mode 100644 index 00000000..553fbe9f --- /dev/null +++ b/src/DDCI_selected/options.irp.f @@ -0,0 +1,32 @@ +BEGIN_SHELL [ /usr/bin/python ] +from ezfio_with_default import EZFIO_Provider +T = EZFIO_Provider() +T.set_type ( "integer" ) +T.set_name ( "N_det_max_fci" ) +T.set_doc ( "Max number of determinants in the wave function" ) +T.set_ezfio_dir ( "full_ci" ) +T.set_ezfio_name( "N_det_max_fci" ) +T.set_output ( "output_full_ci" ) +print T + +T.set_type ( "logical" ) +T.set_name ( "do_pt2_end" ) +T.set_doc ( "If true, compute the PT2 at the end of the selection" ) +T.set_ezfio_name( "do_pt2_end" ) +print T + +T.set_type ( "double precision" ) +T.set_name ( "pt2_max" ) +T.set_doc ( """The selection process stops when the largest PT2 (for all the states) +is lower than pt2_max in absolute value""" ) +T.set_ezfio_name( "pt2_max" ) +print T + +T.set_type ( "double precision" ) +T.set_name ( "var_pt2_ratio" ) +T.set_doc ( """The selection process stops when the energy ratio variational/(variational+PT2) +is equal to var_pt2_ratio""" ) +T.set_ezfio_name( "var_pt2_ratio" ) +print T +END_SHELL +