9
1
mirror of https://github.com/QuantumPackage/qp2.git synced 2025-04-25 17:54:44 +02:00

Added selected MRCI module

This commit is contained in:
Anthony Scemama 2025-02-03 14:05:28 +01:00
parent 4b9939e738
commit dc75f49500
8 changed files with 129 additions and 1 deletions

View File

@ -212,6 +212,7 @@ subroutine ZMQ_pt2(E, pt2_data, pt2_data_err, relative_error, N_in)
ipos += 1
endif
enddo
call write_int(6,pt2_stoch_istate,'State')
call write_int(6,sum(pt2_F),'Number of tasks')
call write_int(6,ipos,'Number of fragmented tasks')

View File

@ -228,7 +228,7 @@ subroutine mo_as_svd_vectors_of_mo_matrix_eig(matrix,lda,m,n,eig,label)
call dgemm('N','N',ao_num,m,m,1.d0,mo_coef_new,size(mo_coef_new,1),U,size(U,1),0.d0,mo_coef,size(mo_coef,1))
do i=1,m
if (eig(i) > 1.d-20) then
if (D(i) > 1.d-20) then
eig(i) = D(i)
else
eig(i) = 0.d0

24
src/mrci/EZFIO.cfg Normal file
View File

@ -0,0 +1,24 @@
[energy]
type: double precision
doc: Calculated Selected CASSD energy
interface: ezfio
size: (determinants.n_states)
[energy_pt2]
type: double precision
doc: Calculated CASSD energy + PT2
interface: ezfio
size: (determinants.n_states)
[do_ddci]
type: logical
doc: If true, remove purely inactive double excitations
interface: ezfio,provider,ocaml
default: False
[do_only_1h1p]
type: logical
doc: If true, do only one hole/one particle excitations
interface: ezfio,provider,ocaml
default: False

4
src/mrci/NEED Normal file
View File

@ -0,0 +1,4 @@
cipsi
generators_cas
selectors_full
davidson_undressed

17
src/mrci/README.rst Normal file
View File

@ -0,0 +1,17 @@
====
mrci
====
|CIPSI| algorithm in the multi-reference CI space (CAS + Singles and Doubles).
This module is the same as the :ref:`fci` module, except for the choice of the
generator and selector determinants.
The inactive, active and virtual |MOs| will need to be set with the
:ref:`qp_set_mo_class` program.
.. seealso::
The documentation of the :ref:`fci` module.

8
src/mrci/class.irp.f Normal file
View File

@ -0,0 +1,8 @@
BEGIN_PROVIDER [ logical, do_only_cas ]
implicit none
BEGIN_DOC
! In the CAS+SD case, always false
END_DOC
do_only_cas = .False.
END_PROVIDER

64
src/mrci/mrci.irp.f Normal file
View File

@ -0,0 +1,64 @@
program mrci
implicit none
BEGIN_DOC
! Selected CAS+Singles and Doubles 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
! program will stop when reaching at least one the two following
! conditions:
!
! * number of Slater determinants > :option:`determinants n_det_max`
! * |PT2| < :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
PROVIDE all_mo_integrals
if (.not.is_zmq_slave) then
PROVIDE psi_det psi_coef
write(json_unit,json_array_open_fmt) 'fci'
double precision, allocatable :: Ev(:),PT2(:)
allocate(Ev(N_states), PT2(N_states))
if (do_pt2) then
call run_stochastic_cipsi(Ev,PT2)
else
call run_cipsi
endif
write(json_unit,json_dict_uopen_fmt)
write(json_unit,json_dict_close_fmtx)
write(json_unit,json_array_close_fmtx)
call json_close
else
PROVIDE pt2_min_parallel_tasks
call run_slave_cipsi
endif
end

View File

@ -0,0 +1,10 @@
subroutine save_energy(E,pt2)
implicit none
BEGIN_DOC
! Saves the energy in |EZFIO|.
END_DOC
double precision, intent(in) :: E(N_states), pt2(N_states)
call ezfio_set_mrci_energy(E(1:N_states))
call ezfio_set_mrci_energy_pt2(E(1:N_states)+pt2(1:N_states))
end