10
0
mirror of https://github.com/LCPQ/quantum_package synced 2024-06-26 15:12:14 +02:00

Added CAS_SD and generators_CAS

This commit is contained in:
Anthony Scemama 2015-03-02 13:58:00 +01:00
parent b358afb610
commit 487ec77613
10 changed files with 211 additions and 0 deletions

View File

@ -0,0 +1,14 @@
use bitmasks
BEGIN_SHELL [ /usr/bin/env python ]
from generate_h_apply import *
s = H_apply("FCI")
s.set_selection_pt2("epstein_nesbet_2x2")
print s
s = H_apply("FCI_PT2")
s.set_perturbation("epstein_nesbet_2x2")
print s
END_SHELL

View File

@ -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

View File

@ -0,0 +1 @@
AOs BiInts Bitmask Dets Electrons Ezfio_files Generators_CAS Hartree_Fock MOGuess MonoInts MOs Nuclei Output Perturbation Selectors_full Utils

View File

@ -0,0 +1,57 @@
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_FCI(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
end

View File

@ -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

View File

@ -0,0 +1 @@
The active space is defined by the ``reference_bitmask``.

View File

@ -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

View File

@ -0,0 +1 @@
AOs BiInts Bitmask Dets Electrons Ezfio_files MonoInts MOs Nuclei Output Utils

View File

@ -0,0 +1,5 @@
=====================
Generators_CAS Module
=====================
The generator determinants are those filtered by the ``cas_bitmask`` mask.

View File

@ -0,0 +1,84 @@
use bitmasks
BEGIN_PROVIDER [ integer, N_det_generators ]
implicit none
BEGIN_DOC
! Number of generator detetrminants
END_DOC
integer :: i,k,l
logical :: good
call write_time(output_dets)
N_det_generators = 0
do i=1,N_det
do l=1,n_cas_bitmask
good = .True.
do k=1,N_int
good = good .and. ( &
iand(not(cas_bitmask(k,1,l)), psi_det(k,1,i)) == &
iand(not(cas_bitmask(k,1,l)), psi_det(k,1,1)) ) .and. ( &
iand(not(cas_bitmask(k,2,l)), psi_det(k,2,i)) == &
iand(not(cas_bitmask(k,2,l)), psi_det(k,2,1)) )
enddo
if (good) then
exit
endif
enddo
if (good) then
N_det_generators += 1
endif
enddo
N_det_generators = max(N_det_generators,1)
call write_int(output_dets,N_det_generators,'Number of generators')
END_PROVIDER
BEGIN_PROVIDER [ integer(bit_kind), psi_generators, (N_int,2,psi_det_size) ]
implicit none
BEGIN_DOC
! For Single reference wave functions, the generator is the
! Hartree-Fock determinant
END_DOC
integer :: i, k, l, m
logical :: good
m=0
do i=1,N_det
do l=1,n_cas_bitmask
good = .True.
do k=1,N_int
good = good .and. ( &
iand(not(cas_bitmask(k,1,l)), psi_det(k,1,i)) == &
iand(not(cas_bitmask(k,1,l)), psi_det(k,1,1)) ) .and. ( &
iand(not(cas_bitmask(k,2,l)), psi_det(k,2,i)) == &
iand(not(cas_bitmask(k,2,l)), psi_det(k,2,1)) )
enddo
if (good) then
exit
endif
enddo
if (good) then
m = m+1
do k=1,N_int
psi_generators(k,1,m) = psi_det(k,1,i)
psi_generators(k,2,m) = psi_det(k,2,i)
enddo
call debug_det(psi_generators(1,1,m),N_int)
endif
enddo
END_PROVIDER
BEGIN_PROVIDER [ integer, size_select_max]
implicit none
BEGIN_DOC
! Size of the select_max array
END_DOC
size_select_max = 10000
END_PROVIDER
BEGIN_PROVIDER [ double precision, select_max, (size_select_max) ]
implicit none
BEGIN_DOC
! Memo to skip useless selectors
END_DOC
select_max = huge(1.d0)
END_PROVIDER