mirror of
https://github.com/LCPQ/quantum_package
synced 2024-08-25 14:01:46 +02:00
Cleaning
This commit is contained in:
parent
a59a6b002c
commit
17dd70e86d
@ -1,10 +0,0 @@
|
|||||||
[energy]
|
|
||||||
type: double precision
|
|
||||||
doc: "Calculated CAS-SCF energy"
|
|
||||||
interface: ezfio
|
|
||||||
|
|
||||||
[energy_pt2]
|
|
||||||
type: double precision
|
|
||||||
doc: "Calculated selected CAS-SCF energy with PT2 correction"
|
|
||||||
interface: ezfio
|
|
||||||
|
|
@ -1,39 +0,0 @@
|
|||||||
use bitmasks
|
|
||||||
BEGIN_SHELL [ /usr/bin/env python ]
|
|
||||||
from generate_h_apply import *
|
|
||||||
|
|
||||||
s = H_apply("CAS_SD")
|
|
||||||
print s
|
|
||||||
|
|
||||||
s = H_apply("CAS_SD_selected_no_skip")
|
|
||||||
s.set_selection_pt2("epstein_nesbet_2x2")
|
|
||||||
s.unset_skip()
|
|
||||||
print s
|
|
||||||
|
|
||||||
s = H_apply("CAS_SD_selected")
|
|
||||||
s.set_selection_pt2("epstein_nesbet_2x2")
|
|
||||||
print s
|
|
||||||
|
|
||||||
s = H_apply("CAS_SD_PT2")
|
|
||||||
s.set_perturbation("epstein_nesbet_2x2")
|
|
||||||
print s
|
|
||||||
|
|
||||||
|
|
||||||
s = H_apply("CAS_S",do_double_exc=False)
|
|
||||||
print s
|
|
||||||
|
|
||||||
s = H_apply("CAS_S_selected_no_skip",do_double_exc=False)
|
|
||||||
s.set_selection_pt2("epstein_nesbet_2x2")
|
|
||||||
s.unset_skip()
|
|
||||||
print s
|
|
||||||
|
|
||||||
s = H_apply("CAS_S_selected",do_double_exc=False)
|
|
||||||
s.set_selection_pt2("epstein_nesbet_2x2")
|
|
||||||
print s
|
|
||||||
|
|
||||||
s = H_apply("CAS_S_PT2",do_double_exc=False)
|
|
||||||
s.set_perturbation("epstein_nesbet_2x2")
|
|
||||||
print s
|
|
||||||
|
|
||||||
END_SHELL
|
|
||||||
|
|
@ -1 +0,0 @@
|
|||||||
Generators_CAS Perturbation Selectors_full
|
|
@ -1,20 +0,0 @@
|
|||||||
======
|
|
||||||
CASSCF
|
|
||||||
======
|
|
||||||
|
|
||||||
This module is not a "real" CAS-SCF. It is an orbital optimization step done by :
|
|
||||||
|
|
||||||
1) Doing the CAS+SD
|
|
||||||
2) Taking one-electron density matrix
|
|
||||||
3) Cancelling all active-active rotations
|
|
||||||
4) Finding the order which matches with the input MOs
|
|
||||||
|
|
||||||
|
|
||||||
Needed Modules
|
|
||||||
==============
|
|
||||||
.. Do not edit this section It was auto-generated
|
|
||||||
.. by the `update_README.py` script.
|
|
||||||
Documentation
|
|
||||||
=============
|
|
||||||
.. Do not edit this section It was auto-generated
|
|
||||||
.. by the `update_README.py` script.
|
|
@ -1,217 +0,0 @@
|
|||||||
program casscf
|
|
||||||
implicit none
|
|
||||||
BEGIN_DOC
|
|
||||||
! Optimize MOs and CI coefficients of the CAS
|
|
||||||
END_DOC
|
|
||||||
|
|
||||||
double precision, allocatable :: pt2(:), norm_pert(:), H_pert_diag(:)
|
|
||||||
integer(bit_kind), allocatable :: generators_bitmask_save(:,:,:,:)
|
|
||||||
|
|
||||||
integer :: degree, N_generators_bitmask_save, N_det_ci
|
|
||||||
double precision :: E_old, E_CI
|
|
||||||
double precision :: selection_criterion_save, selection_criterion_min_save
|
|
||||||
|
|
||||||
integer :: N_det_old
|
|
||||||
integer :: i, j, k, l
|
|
||||||
integer :: i_bit, j_bit, i_int, j_int
|
|
||||||
integer(bit_kind), allocatable :: bit_tmp(:), cas_bm(:)
|
|
||||||
character*(64) :: label
|
|
||||||
|
|
||||||
allocate( pt2(N_states), norm_pert(N_states),H_pert_diag(N_states) )
|
|
||||||
allocate( generators_bitmask_save(N_int,2,6,N_generators_bitmask) )
|
|
||||||
allocate( bit_tmp(N_int), cas_bm(N_int) )
|
|
||||||
|
|
||||||
PROVIDE N_det_cas
|
|
||||||
N_det_old = 0
|
|
||||||
pt2 = 1.d0
|
|
||||||
E_CI = 1.d0
|
|
||||||
E_old = 0.d0
|
|
||||||
diag_algorithm = "Lapack"
|
|
||||||
selection_criterion_save = selection_criterion
|
|
||||||
selection_criterion_min_save = selection_criterion_min
|
|
||||||
|
|
||||||
|
|
||||||
cas_bm = 0_bit_kind
|
|
||||||
do i=1,N_cas_bitmask
|
|
||||||
do j=1,N_int
|
|
||||||
cas_bm(j) = ior(cas_bm(j), cas_bitmask(j,1,i))
|
|
||||||
cas_bm(j) = ior(cas_bm(j), cas_bitmask(j,2,i))
|
|
||||||
enddo
|
|
||||||
enddo
|
|
||||||
|
|
||||||
! Save CAS-SD bitmask
|
|
||||||
generators_bitmask_save = generators_bitmask
|
|
||||||
N_generators_bitmask_save = N_generators_bitmask
|
|
||||||
|
|
||||||
! Set the CAS bitmask
|
|
||||||
do i=1,6
|
|
||||||
generators_bitmask(:,:,i,:) = cas_bitmask
|
|
||||||
enddo
|
|
||||||
N_generators_bitmask = N_cas_bitmask
|
|
||||||
SOFT_TOUCH generators_bitmask N_generators_bitmask
|
|
||||||
|
|
||||||
|
|
||||||
! If the number of dets already in the file is larger than the requested
|
|
||||||
! number of determinants, truncate the wf
|
|
||||||
if (N_det > N_det_max) then
|
|
||||||
call diagonalize_CI
|
|
||||||
call save_wavefunction
|
|
||||||
psi_det = psi_det_sorted
|
|
||||||
psi_coef = psi_coef_sorted
|
|
||||||
N_det = N_det_max
|
|
||||||
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
|
|
||||||
|
|
||||||
! Start MCSCF iteration
|
|
||||||
|
|
||||||
! CAS-CI
|
|
||||||
! ------
|
|
||||||
|
|
||||||
E_old = E_CI
|
|
||||||
|
|
||||||
! Reset the selection criterion
|
|
||||||
selection_criterion = selection_criterion_save
|
|
||||||
selection_criterion_min = selection_criterion_min_save
|
|
||||||
SOFT_TOUCH selection_criterion_min selection_criterion selection_criterion_factor
|
|
||||||
|
|
||||||
! Set the CAS bitmask
|
|
||||||
do i=1,6
|
|
||||||
generators_bitmask(:,:,i,:) = cas_bitmask
|
|
||||||
enddo
|
|
||||||
N_generators_bitmask = N_cas_bitmask
|
|
||||||
SOFT_TOUCH generators_bitmask N_generators_bitmask
|
|
||||||
|
|
||||||
do while (N_det < N_det_max.and.maxval(abs(pt2(1:N_states))) > pt2_max)
|
|
||||||
N_det_old = N_det
|
|
||||||
call H_apply_CAS_SD_selected_no_skip(pt2, norm_pert, H_pert_diag, N_states)
|
|
||||||
|
|
||||||
PROVIDE psi_coef
|
|
||||||
PROVIDE psi_det
|
|
||||||
PROVIDE psi_det_sorted
|
|
||||||
|
|
||||||
if (N_det > N_det_max) then
|
|
||||||
psi_det = psi_det_sorted
|
|
||||||
psi_coef = psi_coef_sorted
|
|
||||||
N_det = N_det_max
|
|
||||||
soft_touch N_det psi_det psi_coef
|
|
||||||
endif
|
|
||||||
call diagonalize_CI
|
|
||||||
call save_wavefunction
|
|
||||||
print *, '======'
|
|
||||||
print *, 'CAS-CI'
|
|
||||||
print *, '======'
|
|
||||||
print *, ''
|
|
||||||
print *, 'N_det = ', N_det
|
|
||||||
print *, 'N_states = ', N_states
|
|
||||||
print *, 'PT2 = ', pt2
|
|
||||||
print *, 'E(CAS) = ', CI_energy
|
|
||||||
print *, 'E(CAS)+PT2 = ', CI_energy+pt2
|
|
||||||
print *, '-----'
|
|
||||||
print *, ''
|
|
||||||
E_CI = sum(CI_energy(1:N_states)+pt2(1:N_states))/dble(N_states)
|
|
||||||
|
|
||||||
call ezfio_set_casscf_energy(CI_energy(1))
|
|
||||||
if (N_det == N_det_old) then
|
|
||||||
exit
|
|
||||||
endif
|
|
||||||
|
|
||||||
enddo
|
|
||||||
|
|
||||||
! Super-CI
|
|
||||||
! --------
|
|
||||||
|
|
||||||
selection_criterion_min = 1.d-12
|
|
||||||
selection_criterion = 1.d-12
|
|
||||||
|
|
||||||
! Set the CAS bitmask
|
|
||||||
generators_bitmask = generators_bitmask_save
|
|
||||||
N_generators_bitmask = N_generators_bitmask_save
|
|
||||||
SOFT_TOUCH generators_bitmask N_generators_bitmask selection_criterion selection_criterion_min selection_criterion_factor
|
|
||||||
|
|
||||||
N_det_ci = N_det
|
|
||||||
|
|
||||||
call H_apply_CAS_SD_selected(pt2, norm_pert, H_pert_diag, N_states)
|
|
||||||
|
|
||||||
|
|
||||||
do i=1,mo_tot_num
|
|
||||||
i_int = ishft(i-1,-bit_kind_shift)+1
|
|
||||||
i_bit = j-ishft(i_int-1,bit_kind_shift)-1
|
|
||||||
bit_tmp(:) = 0_bit_kind
|
|
||||||
bit_tmp(i_int) = ibset(0_bit_kind,i_bit)
|
|
||||||
if (iand(bit_tmp(i_int), cas_bm(i_int)) == 0_bit_kind) then
|
|
||||||
! Not a CAS MO
|
|
||||||
cycle
|
|
||||||
endif
|
|
||||||
|
|
||||||
do j=1,mo_tot_num
|
|
||||||
if (j == i) then
|
|
||||||
cycle
|
|
||||||
endif
|
|
||||||
j_int = ishft(j-1,-bit_kind_shift)+1
|
|
||||||
j_bit = j-ishft(j_int-1,bit_kind_shift)-1
|
|
||||||
bit_tmp(:) = 0_bit_kind
|
|
||||||
bit_tmp(j_int) = ibset(0_bit_kind,j_bit)
|
|
||||||
if (iand(bit_tmp(j_int), cas_bm(j_int)) == 0_bit_kind) then
|
|
||||||
! Not a CAS MO
|
|
||||||
cycle
|
|
||||||
endif
|
|
||||||
! Now, both i and j are MOs of the CAS. De-couple them in the DM
|
|
||||||
one_body_dm_mo(i,j) = 0.d0
|
|
||||||
enddo
|
|
||||||
|
|
||||||
enddo
|
|
||||||
|
|
||||||
SOFT_TOUCH one_body_dm_mo
|
|
||||||
|
|
||||||
double precision :: mx, ov
|
|
||||||
double precision, allocatable :: mo_coef_old(:,:)
|
|
||||||
integer, allocatable :: iorder(:)
|
|
||||||
logical, allocatable :: selected(:)
|
|
||||||
allocate( mo_coef_old(size(mo_coef,1), size(mo_coef,2)), iorder(mo_tot_num), selected(mo_tot_num) )
|
|
||||||
mo_coef_old = mo_coef
|
|
||||||
label = "Canonical"
|
|
||||||
call mo_as_eigvectors_of_mo_matrix(one_body_dm_mo,size(one_body_dm_mo,1),size(one_body_dm_mo,2),label,-1)
|
|
||||||
selected = .False.
|
|
||||||
do j=1,mo_tot_num
|
|
||||||
mx = -1.d0
|
|
||||||
iorder(j) = j
|
|
||||||
do i=1,mo_tot_num
|
|
||||||
if (selected(i)) then
|
|
||||||
cycle
|
|
||||||
endif
|
|
||||||
ov = 0.d0
|
|
||||||
do l=1,ao_num
|
|
||||||
do k=1,ao_num
|
|
||||||
ov = ov + mo_coef_old(k,j) * ao_overlap(k,l) * mo_coef(l,i)
|
|
||||||
enddo
|
|
||||||
enddo
|
|
||||||
ov= dabs(ov)
|
|
||||||
if (ov > mx) then
|
|
||||||
mx = ov
|
|
||||||
iorder(j) = i
|
|
||||||
endif
|
|
||||||
enddo
|
|
||||||
selected( iorder(j) ) = .True.
|
|
||||||
enddo
|
|
||||||
mo_coef_old = mo_coef
|
|
||||||
do i=1,mo_tot_num
|
|
||||||
mo_coef(:,i) = mo_coef_old(:,iorder(i))
|
|
||||||
enddo
|
|
||||||
|
|
||||||
call save_mos
|
|
||||||
|
|
||||||
call write_double(6,E_CI,"Energy(CAS)")
|
|
||||||
|
|
||||||
deallocate( mo_coef_old )
|
|
||||||
deallocate( pt2, norm_pert,H_pert_diag )
|
|
||||||
deallocate( generators_bitmask_save )
|
|
||||||
deallocate( bit_tmp, cas_bm, iorder )
|
|
||||||
end
|
|
@ -1,10 +0,0 @@
|
|||||||
[energy]
|
|
||||||
type: double precision
|
|
||||||
doc: "Calculated CAS-SD energy"
|
|
||||||
interface: ezfio
|
|
||||||
|
|
||||||
[energy_pt2]
|
|
||||||
type: double precision
|
|
||||||
doc: "Calculated selected CAS-SD energy with PT2 correction"
|
|
||||||
interface: ezfio
|
|
||||||
|
|
@ -1,37 +0,0 @@
|
|||||||
use bitmasks
|
|
||||||
BEGIN_SHELL [ /usr/bin/env python ]
|
|
||||||
from generate_h_apply import *
|
|
||||||
|
|
||||||
s = H_apply("CAS_SD")
|
|
||||||
s.unset_skip()
|
|
||||||
print s
|
|
||||||
|
|
||||||
s = H_apply("CAS_SD_selected_no_skip")
|
|
||||||
s.set_selection_pt2("epstein_nesbet_2x2")
|
|
||||||
s.unset_skip()
|
|
||||||
print s
|
|
||||||
|
|
||||||
s = H_apply("CAS_SD_selected")
|
|
||||||
s.set_selection_pt2("epstein_nesbet_2x2")
|
|
||||||
s.unset_skip()
|
|
||||||
print s
|
|
||||||
|
|
||||||
s = H_apply("CAS_SD_PT2")
|
|
||||||
s.set_perturbation("epstein_nesbet_2x2")
|
|
||||||
print s
|
|
||||||
|
|
||||||
|
|
||||||
s = H_apply("CAS_S",do_double_exc=False)
|
|
||||||
print s
|
|
||||||
|
|
||||||
s = H_apply("CAS_S_selected",do_double_exc=False)
|
|
||||||
s.set_selection_pt2("epstein_nesbet_2x2")
|
|
||||||
s.unset_skip()
|
|
||||||
print s
|
|
||||||
|
|
||||||
s = H_apply("CAS_S_PT2",do_double_exc=False)
|
|
||||||
s.set_perturbation("epstein_nesbet_2x2")
|
|
||||||
print s
|
|
||||||
|
|
||||||
END_SHELL
|
|
||||||
|
|
@ -1 +0,0 @@
|
|||||||
Perturbation Selectors_full Generators_CAS Davidson
|
|
@ -1,295 +0,0 @@
|
|||||||
======================
|
|
||||||
CAS_SD_selected Module
|
|
||||||
======================
|
|
||||||
|
|
||||||
Selected CAS + SD module.
|
|
||||||
|
|
||||||
1) Set the different MO classes using the ``qp_set_mo_class`` command
|
|
||||||
2) Run the selected CAS+SD program
|
|
||||||
|
|
||||||
Documentation
|
|
||||||
=============
|
|
||||||
|
|
||||||
.. Do not edit this section. It was auto-generated from the
|
|
||||||
.. by the `update_README.py` script.
|
|
||||||
|
|
||||||
`full_ci <http://github.com/LCPQ/quantum_package/tree/master/src/CAS_SD/cas_sd_selected.irp.f#L1>`_
|
|
||||||
Undocumented
|
|
||||||
|
|
||||||
|
|
||||||
`h_apply_cas_sd <http://github.com/LCPQ/quantum_package/tree/master/src/CAS_SD/H_apply.irp.f_shell_22#L414>`_
|
|
||||||
Calls H_apply on the HF determinant and selects all connected single and double
|
|
||||||
excitations (of the same symmetry). Auto-generated by the ``generate_h_apply`` script.
|
|
||||||
|
|
||||||
|
|
||||||
`h_apply_cas_sd_diexc <http://github.com/LCPQ/quantum_package/tree/master/src/CAS_SD/H_apply.irp.f_shell_22#L1>`_
|
|
||||||
Generate all double excitations of key_in using the bit masks of holes and
|
|
||||||
particles.
|
|
||||||
Assume N_int is already provided.
|
|
||||||
|
|
||||||
|
|
||||||
`h_apply_cas_sd_monoexc <http://github.com/LCPQ/quantum_package/tree/master/src/CAS_SD/H_apply.irp.f_shell_22#L269>`_
|
|
||||||
Generate all single excitations of key_in using the bit masks of holes and
|
|
||||||
particles.
|
|
||||||
Assume N_int is already provided.
|
|
||||||
|
|
||||||
|
|
||||||
`h_apply_cas_sd_pt2 <http://github.com/LCPQ/quantum_package/tree/master/src/CAS_SD/H_apply.irp.f_shell_22#L2610>`_
|
|
||||||
Calls H_apply on the HF determinant and selects all connected single and double
|
|
||||||
excitations (of the same symmetry). Auto-generated by the ``generate_h_apply`` script.
|
|
||||||
|
|
||||||
|
|
||||||
`h_apply_cas_sd_pt2_diexc <http://github.com/LCPQ/quantum_package/tree/master/src/CAS_SD/H_apply.irp.f_shell_22#L2118>`_
|
|
||||||
Generate all double excitations of key_in using the bit masks of holes and
|
|
||||||
particles.
|
|
||||||
Assume N_int is already provided.
|
|
||||||
|
|
||||||
|
|
||||||
`h_apply_cas_sd_pt2_monoexc <http://github.com/LCPQ/quantum_package/tree/master/src/CAS_SD/H_apply.irp.f_shell_22#L2427>`_
|
|
||||||
Generate all single excitations of key_in using the bit masks of holes and
|
|
||||||
particles.
|
|
||||||
Assume N_int is already provided.
|
|
||||||
|
|
||||||
|
|
||||||
`h_apply_cas_sd_selected <http://github.com/LCPQ/quantum_package/tree/master/src/CAS_SD/H_apply.irp.f_shell_22#L1872>`_
|
|
||||||
Calls H_apply on the HF determinant and selects all connected single and double
|
|
||||||
excitations (of the same symmetry). Auto-generated by the ``generate_h_apply`` script.
|
|
||||||
|
|
||||||
|
|
||||||
`h_apply_cas_sd_selected_diexc <http://github.com/LCPQ/quantum_package/tree/master/src/CAS_SD/H_apply.irp.f_shell_22#L1346>`_
|
|
||||||
Generate all double excitations of key_in using the bit masks of holes and
|
|
||||||
particles.
|
|
||||||
Assume N_int is already provided.
|
|
||||||
|
|
||||||
|
|
||||||
`h_apply_cas_sd_selected_monoexc <http://github.com/LCPQ/quantum_package/tree/master/src/CAS_SD/H_apply.irp.f_shell_22#L1675>`_
|
|
||||||
Generate all single excitations of key_in using the bit masks of holes and
|
|
||||||
particles.
|
|
||||||
Assume N_int is already provided.
|
|
||||||
|
|
||||||
|
|
||||||
`h_apply_cas_sd_selected_no_skip <http://github.com/LCPQ/quantum_package/tree/master/src/CAS_SD/H_apply.irp.f_shell_22#L1128>`_
|
|
||||||
Calls H_apply on the HF determinant and selects all connected single and double
|
|
||||||
excitations (of the same symmetry). Auto-generated by the ``generate_h_apply`` script.
|
|
||||||
|
|
||||||
|
|
||||||
`h_apply_cas_sd_selected_no_skip_diexc <http://github.com/LCPQ/quantum_package/tree/master/src/CAS_SD/H_apply.irp.f_shell_22#L602>`_
|
|
||||||
Generate all double excitations of key_in using the bit masks of holes and
|
|
||||||
particles.
|
|
||||||
Assume N_int is already provided.
|
|
||||||
|
|
||||||
|
|
||||||
`h_apply_cas_sd_selected_no_skip_monoexc <http://github.com/LCPQ/quantum_package/tree/master/src/CAS_SD/H_apply.irp.f_shell_22#L931>`_
|
|
||||||
Generate all single excitations of key_in using the bit masks of holes and
|
|
||||||
particles.
|
|
||||||
Assume N_int is already provided.
|
|
||||||
|
|
||||||
Needed Modules
|
|
||||||
==============
|
|
||||||
|
|
||||||
.. Do not edit this section. It was auto-generated from the
|
|
||||||
.. by the `update_README.py` script.
|
|
||||||
|
|
||||||
.. image:: tree_dependency.png
|
|
||||||
|
|
||||||
* `Perturbation <http://github.com/LCPQ/quantum_package/tree/master/src/Perturbation>`_
|
|
||||||
* `Selectors_full <http://github.com/LCPQ/quantum_package/tree/master/src/Selectors_full>`_
|
|
||||||
* `Generators_CAS <http://github.com/LCPQ/quantum_package/tree/master/src/Generators_CAS>`_
|
|
||||||
|
|
||||||
Needed Modules
|
|
||||||
==============
|
|
||||||
.. Do not edit this section It was auto-generated
|
|
||||||
.. by the `update_README.py` script.
|
|
||||||
|
|
||||||
|
|
||||||
.. image:: tree_dependency.png
|
|
||||||
|
|
||||||
* `Perturbation <http://github.com/LCPQ/quantum_package/tree/master/plugins/Perturbation>`_
|
|
||||||
* `Selectors_full <http://github.com/LCPQ/quantum_package/tree/master/plugins/Selectors_full>`_
|
|
||||||
* `Generators_CAS <http://github.com/LCPQ/quantum_package/tree/master/plugins/Generators_CAS>`_
|
|
||||||
* `Davidson <http://github.com/LCPQ/quantum_package/tree/master/src/Davidson>`_
|
|
||||||
|
|
||||||
Documentation
|
|
||||||
=============
|
|
||||||
.. Do not edit this section It was auto-generated
|
|
||||||
.. by the `update_README.py` script.
|
|
||||||
|
|
||||||
|
|
||||||
`full_ci <http://github.com/LCPQ/quantum_package/tree/master/plugins/CAS_SD/cas_sd_selected.irp.f#L1>`_
|
|
||||||
Undocumented
|
|
||||||
|
|
||||||
|
|
||||||
h_apply_cas_s
|
|
||||||
Calls H_apply on the HF determinant and selects all connected single and double
|
|
||||||
excitations (of the same symmetry). Auto-generated by the ``generate_h_apply`` script.
|
|
||||||
|
|
||||||
|
|
||||||
h_apply_cas_s_diexc
|
|
||||||
Undocumented
|
|
||||||
|
|
||||||
|
|
||||||
h_apply_cas_s_diexcorg
|
|
||||||
Generate all double excitations of key_in using the bit masks of holes and
|
|
||||||
particles.
|
|
||||||
Assume N_int is already provided.
|
|
||||||
|
|
||||||
|
|
||||||
h_apply_cas_s_diexcp
|
|
||||||
Undocumented
|
|
||||||
|
|
||||||
|
|
||||||
h_apply_cas_s_monoexc
|
|
||||||
Generate all single excitations of key_in using the bit masks of holes and
|
|
||||||
particles.
|
|
||||||
Assume N_int is already provided.
|
|
||||||
|
|
||||||
|
|
||||||
h_apply_cas_s_pt2
|
|
||||||
Calls H_apply on the HF determinant and selects all connected single and double
|
|
||||||
excitations (of the same symmetry). Auto-generated by the ``generate_h_apply`` script.
|
|
||||||
|
|
||||||
|
|
||||||
h_apply_cas_s_pt2_diexc
|
|
||||||
Undocumented
|
|
||||||
|
|
||||||
|
|
||||||
h_apply_cas_s_pt2_diexcorg
|
|
||||||
Generate all double excitations of key_in using the bit masks of holes and
|
|
||||||
particles.
|
|
||||||
Assume N_int is already provided.
|
|
||||||
|
|
||||||
|
|
||||||
h_apply_cas_s_pt2_diexcp
|
|
||||||
Undocumented
|
|
||||||
|
|
||||||
|
|
||||||
h_apply_cas_s_pt2_monoexc
|
|
||||||
Generate all single excitations of key_in using the bit masks of holes and
|
|
||||||
particles.
|
|
||||||
Assume N_int is already provided.
|
|
||||||
|
|
||||||
|
|
||||||
h_apply_cas_s_selected
|
|
||||||
Calls H_apply on the HF determinant and selects all connected single and double
|
|
||||||
excitations (of the same symmetry). Auto-generated by the ``generate_h_apply`` script.
|
|
||||||
|
|
||||||
|
|
||||||
h_apply_cas_s_selected_diexc
|
|
||||||
Undocumented
|
|
||||||
|
|
||||||
|
|
||||||
h_apply_cas_s_selected_diexcorg
|
|
||||||
Generate all double excitations of key_in using the bit masks of holes and
|
|
||||||
particles.
|
|
||||||
Assume N_int is already provided.
|
|
||||||
|
|
||||||
|
|
||||||
h_apply_cas_s_selected_diexcp
|
|
||||||
Undocumented
|
|
||||||
|
|
||||||
|
|
||||||
h_apply_cas_s_selected_monoexc
|
|
||||||
Generate all single excitations of key_in using the bit masks of holes and
|
|
||||||
particles.
|
|
||||||
Assume N_int is already provided.
|
|
||||||
|
|
||||||
|
|
||||||
h_apply_cas_sd
|
|
||||||
Calls H_apply on the HF determinant and selects all connected single and double
|
|
||||||
excitations (of the same symmetry). Auto-generated by the ``generate_h_apply`` script.
|
|
||||||
|
|
||||||
|
|
||||||
h_apply_cas_sd_diexc
|
|
||||||
Undocumented
|
|
||||||
|
|
||||||
|
|
||||||
h_apply_cas_sd_diexcorg
|
|
||||||
Generate all double excitations of key_in using the bit masks of holes and
|
|
||||||
particles.
|
|
||||||
Assume N_int is already provided.
|
|
||||||
|
|
||||||
|
|
||||||
h_apply_cas_sd_diexcp
|
|
||||||
Undocumented
|
|
||||||
|
|
||||||
|
|
||||||
h_apply_cas_sd_monoexc
|
|
||||||
Generate all single excitations of key_in using the bit masks of holes and
|
|
||||||
particles.
|
|
||||||
Assume N_int is already provided.
|
|
||||||
|
|
||||||
|
|
||||||
h_apply_cas_sd_pt2
|
|
||||||
Calls H_apply on the HF determinant and selects all connected single and double
|
|
||||||
excitations (of the same symmetry). Auto-generated by the ``generate_h_apply`` script.
|
|
||||||
|
|
||||||
|
|
||||||
h_apply_cas_sd_pt2_diexc
|
|
||||||
Undocumented
|
|
||||||
|
|
||||||
|
|
||||||
h_apply_cas_sd_pt2_diexcorg
|
|
||||||
Generate all double excitations of key_in using the bit masks of holes and
|
|
||||||
particles.
|
|
||||||
Assume N_int is already provided.
|
|
||||||
|
|
||||||
|
|
||||||
h_apply_cas_sd_pt2_diexcp
|
|
||||||
Undocumented
|
|
||||||
|
|
||||||
|
|
||||||
h_apply_cas_sd_pt2_monoexc
|
|
||||||
Generate all single excitations of key_in using the bit masks of holes and
|
|
||||||
particles.
|
|
||||||
Assume N_int is already provided.
|
|
||||||
|
|
||||||
|
|
||||||
h_apply_cas_sd_selected
|
|
||||||
Calls H_apply on the HF determinant and selects all connected single and double
|
|
||||||
excitations (of the same symmetry). Auto-generated by the ``generate_h_apply`` script.
|
|
||||||
|
|
||||||
|
|
||||||
h_apply_cas_sd_selected_diexc
|
|
||||||
Undocumented
|
|
||||||
|
|
||||||
|
|
||||||
h_apply_cas_sd_selected_diexcorg
|
|
||||||
Generate all double excitations of key_in using the bit masks of holes and
|
|
||||||
particles.
|
|
||||||
Assume N_int is already provided.
|
|
||||||
|
|
||||||
|
|
||||||
h_apply_cas_sd_selected_diexcp
|
|
||||||
Undocumented
|
|
||||||
|
|
||||||
|
|
||||||
h_apply_cas_sd_selected_monoexc
|
|
||||||
Generate all single excitations of key_in using the bit masks of holes and
|
|
||||||
particles.
|
|
||||||
Assume N_int is already provided.
|
|
||||||
|
|
||||||
|
|
||||||
h_apply_cas_sd_selected_no_skip
|
|
||||||
Calls H_apply on the HF determinant and selects all connected single and double
|
|
||||||
excitations (of the same symmetry). Auto-generated by the ``generate_h_apply`` script.
|
|
||||||
|
|
||||||
|
|
||||||
h_apply_cas_sd_selected_no_skip_diexc
|
|
||||||
Undocumented
|
|
||||||
|
|
||||||
|
|
||||||
h_apply_cas_sd_selected_no_skip_diexcorg
|
|
||||||
Generate all double excitations of key_in using the bit masks of holes and
|
|
||||||
particles.
|
|
||||||
Assume N_int is already provided.
|
|
||||||
|
|
||||||
|
|
||||||
h_apply_cas_sd_selected_no_skip_diexcp
|
|
||||||
Undocumented
|
|
||||||
|
|
||||||
|
|
||||||
h_apply_cas_sd_selected_no_skip_monoexc
|
|
||||||
Generate all single excitations of key_in using the bit masks of holes and
|
|
||||||
particles.
|
|
||||||
Assume N_int is already provided.
|
|
||||||
|
|
@ -1,92 +0,0 @@
|
|||||||
program full_ci
|
|
||||||
implicit none
|
|
||||||
integer :: i,k
|
|
||||||
integer :: N_det_old
|
|
||||||
|
|
||||||
|
|
||||||
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
|
|
||||||
PROVIDE N_det_cas
|
|
||||||
|
|
||||||
N_det_old = 0
|
|
||||||
pt2 = 1.d0
|
|
||||||
diag_algorithm = "Lapack"
|
|
||||||
if (N_det > N_det_max) then
|
|
||||||
call diagonalize_CI
|
|
||||||
call save_wavefunction
|
|
||||||
psi_det = psi_det_sorted
|
|
||||||
psi_coef = psi_coef_sorted
|
|
||||||
N_det = N_det_max
|
|
||||||
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.and.maxval(abs(pt2(1:N_st))) > pt2_max)
|
|
||||||
N_det_old = N_det
|
|
||||||
call H_apply_CAS_S(pt2, norm_pert, H_pert_diag, N_st)
|
|
||||||
|
|
||||||
PROVIDE psi_coef
|
|
||||||
PROVIDE psi_det
|
|
||||||
PROVIDE psi_det_sorted
|
|
||||||
|
|
||||||
if (N_det > N_det_max) then
|
|
||||||
psi_det = psi_det_sorted
|
|
||||||
psi_coef = psi_coef_sorted
|
|
||||||
N_det = N_det_max
|
|
||||||
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_cas_sd_energy(CI_energy(1))
|
|
||||||
if (N_det == N_det_old) then
|
|
||||||
exit
|
|
||||||
endif
|
|
||||||
enddo
|
|
||||||
call diagonalize_CI
|
|
||||||
|
|
||||||
if(do_pt2_end)then
|
|
||||||
print*,'Last iteration only to compute the PT2'
|
|
||||||
threshold_selectors = 1.d0
|
|
||||||
threshold_generators = 0.999d0
|
|
||||||
call H_apply_CAS_S_PT2(pt2, norm_pert, H_pert_diag, N_st)
|
|
||||||
|
|
||||||
print *, 'Final step'
|
|
||||||
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_cas_sd_energy_pt2(CI_energy(1)+pt2(1))
|
|
||||||
endif
|
|
||||||
|
|
||||||
|
|
||||||
integer :: exc_max, degree_min
|
|
||||||
exc_max = 0
|
|
||||||
print *, 'CAS determinants : ', N_det_cas
|
|
||||||
do i=1,min(N_det_cas,10)
|
|
||||||
do k=i,N_det_cas
|
|
||||||
call get_excitation_degree(psi_cas(1,1,k),psi_cas(1,1,i),degree,N_int)
|
|
||||||
exc_max = max(exc_max,degree)
|
|
||||||
enddo
|
|
||||||
call debug_det(psi_cas(1,1,i),N_int)
|
|
||||||
print *, ''
|
|
||||||
enddo
|
|
||||||
print *, 'Max excitation degree in the CAS :', exc_max
|
|
||||||
end
|
|
@ -1,123 +0,0 @@
|
|||||||
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
|
|
||||||
PROVIDE N_det_cas
|
|
||||||
|
|
||||||
pt2 = 1.d0
|
|
||||||
diag_algorithm = "Lapack"
|
|
||||||
|
|
||||||
if (N_det > N_det_max) then
|
|
||||||
call diagonalize_CI
|
|
||||||
call save_wavefunction
|
|
||||||
psi_det = psi_det_sorted
|
|
||||||
psi_coef = psi_coef_sorted
|
|
||||||
N_det = N_det_max
|
|
||||||
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
|
|
||||||
double precision :: i_H_psi_array(N_states),diag_H_mat_elem,h,i_O1_psi_array(N_states)
|
|
||||||
double precision :: E_CI_before(N_states)
|
|
||||||
if(read_wf)then
|
|
||||||
call i_H_psi(psi_det(1,1,N_det),psi_det,psi_coef,N_int,N_det,psi_det_size,N_states,i_H_psi_array)
|
|
||||||
h = diag_H_mat_elem(psi_det(1,1,N_det),N_int)
|
|
||||||
selection_criterion = dabs(psi_coef(N_det,1) * (i_H_psi_array(1) - h * psi_coef(N_det,1))) * 0.1d0
|
|
||||||
soft_touch selection_criterion
|
|
||||||
endif
|
|
||||||
|
|
||||||
|
|
||||||
integer :: n_det_before
|
|
||||||
print*,'Beginning the selection ...'
|
|
||||||
E_CI_before(1:N_states) = CI_energy(1:N_states)
|
|
||||||
do while (N_det < N_det_max.and.maxval(abs(pt2(1:N_st))) > pt2_max)
|
|
||||||
n_det_before = N_det
|
|
||||||
call H_apply_CAS_SD_selected(pt2, norm_pert, H_pert_diag, N_st)
|
|
||||||
|
|
||||||
PROVIDE psi_coef
|
|
||||||
PROVIDE psi_det
|
|
||||||
PROVIDE psi_det_sorted
|
|
||||||
|
|
||||||
call diagonalize_CI
|
|
||||||
|
|
||||||
if (N_det > N_det_max) then
|
|
||||||
N_det = N_det_max
|
|
||||||
psi_det = psi_det_sorted
|
|
||||||
psi_coef = psi_coef_sorted
|
|
||||||
touch N_det psi_det psi_coef psi_det_sorted psi_coef_sorted psi_average_norm_contrib_sorted
|
|
||||||
endif
|
|
||||||
|
|
||||||
|
|
||||||
call save_wavefunction
|
|
||||||
if(n_det_before == N_det)then
|
|
||||||
selection_criterion = selection_criterion * 0.5d0
|
|
||||||
endif
|
|
||||||
print *, 'N_det = ', N_det
|
|
||||||
print *, 'N_states = ', N_states
|
|
||||||
do k = 1, N_states
|
|
||||||
print*,'State ',k
|
|
||||||
print *, 'PT2 = ', pt2(k)
|
|
||||||
print *, 'E = ', CI_energy(k)
|
|
||||||
print *, 'E(before)+PT2 = ', E_CI_before(k)+pt2(k)
|
|
||||||
enddo
|
|
||||||
print *, '-----'
|
|
||||||
if(N_states.gt.1)then
|
|
||||||
print*,'Variational Energy difference'
|
|
||||||
do i = 2, N_states
|
|
||||||
print*,'Delta E = ',CI_energy(i) - CI_energy(1)
|
|
||||||
enddo
|
|
||||||
endif
|
|
||||||
if(N_states.gt.1)then
|
|
||||||
print*,'Variational + perturbative Energy difference'
|
|
||||||
do i = 2, N_states
|
|
||||||
print*,'Delta E = ',E_CI_before(i)+ pt2(i) - (E_CI_before(1) + pt2(1))
|
|
||||||
enddo
|
|
||||||
endif
|
|
||||||
E_CI_before(1:N_states) = CI_energy(1:N_states)
|
|
||||||
call ezfio_set_cas_sd_energy(CI_energy(1))
|
|
||||||
enddo
|
|
||||||
N_det = min(N_det_max,N_det)
|
|
||||||
touch N_det psi_det psi_coef
|
|
||||||
call diagonalize_CI
|
|
||||||
if(do_pt2_end)then
|
|
||||||
print*,'Last iteration only to compute the PT2'
|
|
||||||
threshold_selectors = 1.d0
|
|
||||||
threshold_generators = 0.999d0
|
|
||||||
call H_apply_CAS_SD_PT2(pt2, norm_pert, H_pert_diag, N_st)
|
|
||||||
|
|
||||||
print *, 'Final step'
|
|
||||||
print *, 'N_det = ', N_det
|
|
||||||
print *, 'N_states = ', N_states
|
|
||||||
print *, 'PT2 = ', pt2
|
|
||||||
print *, 'E = ', CI_energy(1:N_states)
|
|
||||||
print *, 'E+PT2 = ', CI_energy(1:N_states)+pt2(1:N_states)
|
|
||||||
print *, '-----'
|
|
||||||
call ezfio_set_cas_sd_energy_pt2(CI_energy(1)+pt2(1))
|
|
||||||
endif
|
|
||||||
|
|
||||||
integer :: exc_max, degree_min
|
|
||||||
exc_max = 0
|
|
||||||
print *, 'CAS determinants : ', N_det_cas
|
|
||||||
do i=1,min(N_det_cas,10)
|
|
||||||
do k=i,N_det_cas
|
|
||||||
call get_excitation_degree(psi_cas(1,1,k),psi_cas(1,1,i),degree,N_int)
|
|
||||||
exc_max = max(exc_max,degree)
|
|
||||||
enddo
|
|
||||||
print *, psi_coef_cas_diagonalized(i,:)
|
|
||||||
call debug_det(psi_cas(1,1,i),N_int)
|
|
||||||
print *, ''
|
|
||||||
enddo
|
|
||||||
print *, 'Max excitation degree in the CAS :', exc_max
|
|
||||||
end
|
|
@ -1,123 +0,0 @@
|
|||||||
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
|
|
||||||
PROVIDE N_det_cas
|
|
||||||
|
|
||||||
pt2 = 1.d0
|
|
||||||
diag_algorithm = "Lapack"
|
|
||||||
|
|
||||||
if (N_det > N_det_max) then
|
|
||||||
call diagonalize_CI
|
|
||||||
call save_wavefunction
|
|
||||||
psi_det = psi_det_sorted
|
|
||||||
psi_coef = psi_coef_sorted
|
|
||||||
N_det = N_det_max
|
|
||||||
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
|
|
||||||
double precision :: i_H_psi_array(N_states),diag_H_mat_elem,h,i_O1_psi_array(N_states)
|
|
||||||
double precision :: E_CI_before(N_states)
|
|
||||||
if(read_wf)then
|
|
||||||
call i_H_psi(psi_det(1,1,N_det),psi_det,psi_coef,N_int,N_det,psi_det_size,N_states,i_H_psi_array)
|
|
||||||
h = diag_H_mat_elem(psi_det(1,1,N_det),N_int)
|
|
||||||
selection_criterion = dabs(psi_coef(N_det,1) * (i_H_psi_array(1) - h * psi_coef(N_det,1))) * 0.1d0
|
|
||||||
soft_touch selection_criterion
|
|
||||||
endif
|
|
||||||
|
|
||||||
|
|
||||||
integer :: n_det_before
|
|
||||||
print*,'Beginning the selection ...'
|
|
||||||
E_CI_before(1:N_states) = CI_energy(1:N_states)
|
|
||||||
do while (N_det < N_det_max.and.maxval(abs(pt2(1:N_st))) > pt2_max)
|
|
||||||
n_det_before = N_det
|
|
||||||
call H_apply_CAS_SD(pt2, norm_pert, H_pert_diag, N_st)
|
|
||||||
|
|
||||||
PROVIDE psi_coef
|
|
||||||
PROVIDE psi_det
|
|
||||||
PROVIDE psi_det_sorted
|
|
||||||
|
|
||||||
call diagonalize_CI
|
|
||||||
|
|
||||||
if (N_det > N_det_max) then
|
|
||||||
N_det = N_det_max
|
|
||||||
psi_det = psi_det_sorted
|
|
||||||
psi_coef = psi_coef_sorted
|
|
||||||
touch N_det psi_det psi_coef psi_det_sorted psi_coef_sorted psi_average_norm_contrib_sorted
|
|
||||||
endif
|
|
||||||
|
|
||||||
|
|
||||||
call save_wavefunction
|
|
||||||
if(n_det_before == N_det)then
|
|
||||||
selection_criterion = selection_criterion * 0.5d0
|
|
||||||
endif
|
|
||||||
print *, 'N_det = ', N_det
|
|
||||||
print *, 'N_states = ', N_states
|
|
||||||
do k = 1, N_states
|
|
||||||
print*,'State ',k
|
|
||||||
print *, 'PT2 = ', pt2(k)
|
|
||||||
print *, 'E = ', CI_energy(k)
|
|
||||||
print *, 'E(before)+PT2 = ', E_CI_before(k)+pt2(k)
|
|
||||||
enddo
|
|
||||||
print *, '-----'
|
|
||||||
if(N_states.gt.1)then
|
|
||||||
print*,'Variational Energy difference'
|
|
||||||
do i = 2, N_states
|
|
||||||
print*,'Delta E = ',CI_energy(i) - CI_energy(1)
|
|
||||||
enddo
|
|
||||||
endif
|
|
||||||
if(N_states.gt.1)then
|
|
||||||
print*,'Variational + perturbative Energy difference'
|
|
||||||
do i = 2, N_states
|
|
||||||
print*,'Delta E = ',E_CI_before(i)+ pt2(i) - (E_CI_before(1) + pt2(1))
|
|
||||||
enddo
|
|
||||||
endif
|
|
||||||
E_CI_before(1:N_states) = CI_energy(1:N_states)
|
|
||||||
call ezfio_set_cas_sd_energy(CI_energy(1))
|
|
||||||
enddo
|
|
||||||
N_det = min(N_det_max,N_det)
|
|
||||||
touch N_det psi_det psi_coef
|
|
||||||
call diagonalize_CI
|
|
||||||
if(do_pt2_end)then
|
|
||||||
print*,'Last iteration only to compute the PT2'
|
|
||||||
threshold_selectors = 1.d0
|
|
||||||
threshold_generators = 0.999d0
|
|
||||||
call H_apply_CAS_SD_PT2(pt2, norm_pert, H_pert_diag, N_st)
|
|
||||||
|
|
||||||
print *, 'Final step'
|
|
||||||
print *, 'N_det = ', N_det
|
|
||||||
print *, 'N_states = ', N_states
|
|
||||||
print *, 'PT2 = ', pt2
|
|
||||||
print *, 'E = ', CI_energy(1:N_states)
|
|
||||||
print *, 'E+PT2 = ', CI_energy(1:N_states)+pt2(1:N_states)
|
|
||||||
print *, '-----'
|
|
||||||
call ezfio_set_cas_sd_energy_pt2(CI_energy(1)+pt2(1))
|
|
||||||
endif
|
|
||||||
|
|
||||||
integer :: exc_max, degree_min
|
|
||||||
exc_max = 0
|
|
||||||
print *, 'CAS determinants : ', N_det_cas
|
|
||||||
do i=1,min(N_det_cas,10)
|
|
||||||
do k=i,N_det_cas
|
|
||||||
call get_excitation_degree(psi_cas(1,1,k),psi_cas(1,1,i),degree,N_int)
|
|
||||||
exc_max = max(exc_max,degree)
|
|
||||||
enddo
|
|
||||||
print *, psi_coef_cas_diagonalized(i,:)
|
|
||||||
call debug_det(psi_cas(1,1,i),N_int)
|
|
||||||
print *, ''
|
|
||||||
enddo
|
|
||||||
print *, 'Max excitation degree in the CAS :', exc_max
|
|
||||||
end
|
|
@ -1,123 +0,0 @@
|
|||||||
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
|
|
||||||
PROVIDE N_det_cas
|
|
||||||
|
|
||||||
pt2 = 1.d0
|
|
||||||
diag_algorithm = "Lapack"
|
|
||||||
|
|
||||||
if (N_det > N_det_max) then
|
|
||||||
call diagonalize_CI
|
|
||||||
call save_wavefunction
|
|
||||||
psi_det = psi_det_sorted
|
|
||||||
psi_coef = psi_coef_sorted
|
|
||||||
N_det = N_det_max
|
|
||||||
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
|
|
||||||
double precision :: i_H_psi_array(N_states),diag_H_mat_elem,h,i_O1_psi_array(N_states)
|
|
||||||
double precision :: E_CI_before(N_states)
|
|
||||||
if(read_wf)then
|
|
||||||
call i_H_psi(psi_det(1,1,N_det),psi_det,psi_coef,N_int,N_det,psi_det_size,N_states,i_H_psi_array)
|
|
||||||
h = diag_H_mat_elem(psi_det(1,1,N_det),N_int)
|
|
||||||
selection_criterion = dabs(psi_coef(N_det,1) * (i_H_psi_array(1) - h * psi_coef(N_det,1))) * 0.1d0
|
|
||||||
soft_touch selection_criterion
|
|
||||||
endif
|
|
||||||
|
|
||||||
|
|
||||||
integer :: n_det_before
|
|
||||||
print*,'Beginning the selection ...'
|
|
||||||
E_CI_before(1:N_states) = CI_energy(1:N_states)
|
|
||||||
do while (N_det < N_det_max.and.maxval(abs(pt2(1:N_st))) > pt2_max)
|
|
||||||
n_det_before = N_det
|
|
||||||
call H_apply_CAS_SD_selected(pt2, norm_pert, H_pert_diag, N_st)
|
|
||||||
|
|
||||||
PROVIDE psi_coef
|
|
||||||
PROVIDE psi_det
|
|
||||||
PROVIDE psi_det_sorted
|
|
||||||
|
|
||||||
call diagonalize_CI
|
|
||||||
|
|
||||||
if (N_det > N_det_max) then
|
|
||||||
N_det = N_det_max
|
|
||||||
psi_det = psi_det_sorted
|
|
||||||
psi_coef = psi_coef_sorted
|
|
||||||
touch N_det psi_det psi_coef psi_det_sorted psi_coef_sorted psi_average_norm_contrib_sorted
|
|
||||||
endif
|
|
||||||
|
|
||||||
|
|
||||||
call save_wavefunction
|
|
||||||
if(n_det_before == N_det)then
|
|
||||||
selection_criterion = selection_criterion * 0.5d0
|
|
||||||
endif
|
|
||||||
print *, 'N_det = ', N_det
|
|
||||||
print *, 'N_states = ', N_states
|
|
||||||
do k = 1, N_states
|
|
||||||
print*,'State ',k
|
|
||||||
print *, 'PT2 = ', pt2(k)
|
|
||||||
print *, 'E = ', CI_energy(k)
|
|
||||||
print *, 'E(before)+PT2 = ', E_CI_before(k)+pt2(k)
|
|
||||||
enddo
|
|
||||||
print *, '-----'
|
|
||||||
if(N_states.gt.1)then
|
|
||||||
print*,'Variational Energy difference'
|
|
||||||
do i = 2, N_states
|
|
||||||
print*,'Delta E = ',CI_energy(i) - CI_energy(1)
|
|
||||||
enddo
|
|
||||||
endif
|
|
||||||
if(N_states.gt.1)then
|
|
||||||
print*,'Variational + perturbative Energy difference'
|
|
||||||
do i = 2, N_states
|
|
||||||
print*,'Delta E = ',E_CI_before(i)+ pt2(i) - (E_CI_before(1) + pt2(1))
|
|
||||||
enddo
|
|
||||||
endif
|
|
||||||
E_CI_before(1:N_states) = CI_energy(1:N_states)
|
|
||||||
call ezfio_set_cas_sd_energy(CI_energy(1))
|
|
||||||
enddo
|
|
||||||
N_det = min(N_det_max,N_det)
|
|
||||||
touch N_det psi_det psi_coef
|
|
||||||
call diagonalize_CI
|
|
||||||
if(do_pt2_end)then
|
|
||||||
print*,'Last iteration only to compute the PT2'
|
|
||||||
threshold_selectors = max(threshold_selectors,threshold_selectors_pt2)
|
|
||||||
threshold_generators = max(threshold_generators,threshold_generators_pt2)
|
|
||||||
call H_apply_CAS_SD_PT2(pt2, norm_pert, H_pert_diag, N_st)
|
|
||||||
|
|
||||||
print *, 'Final step'
|
|
||||||
print *, 'N_det = ', N_det
|
|
||||||
print *, 'N_states = ', N_states
|
|
||||||
print *, 'PT2 = ', pt2
|
|
||||||
print *, 'E = ', CI_energy(1:N_states)
|
|
||||||
print *, 'E+PT2 = ', CI_energy(1:N_states)+pt2(1:N_states)
|
|
||||||
print *, '-----'
|
|
||||||
call ezfio_set_cas_sd_energy_pt2(CI_energy(1)+pt2(1))
|
|
||||||
endif
|
|
||||||
|
|
||||||
integer :: exc_max, degree_min
|
|
||||||
exc_max = 0
|
|
||||||
print *, 'CAS determinants : ', N_det_cas
|
|
||||||
do i=1,min(N_det_cas,10)
|
|
||||||
do k=i,N_det_cas
|
|
||||||
call get_excitation_degree(psi_cas(1,1,k),psi_cas(1,1,i),degree,N_int)
|
|
||||||
exc_max = max(exc_max,degree)
|
|
||||||
enddo
|
|
||||||
print *, psi_cas_coef(i,:)
|
|
||||||
call debug_det(psi_cas(1,1,i),N_int)
|
|
||||||
print *, ''
|
|
||||||
enddo
|
|
||||||
print *, 'Max excitation degree in the CAS :', exc_max
|
|
||||||
end
|
|
Binary file not shown.
Before Width: | Height: | Size: 109 KiB |
@ -1,6 +1,6 @@
|
|||||||
[do_pt2_end]
|
[do_pt2]
|
||||||
type: logical
|
type: logical
|
||||||
doc: If true, compute the PT2 at the end of the selection
|
doc: If true, compute the PT2
|
||||||
interface: ezfio,provider,ocaml
|
interface: ezfio,provider,ocaml
|
||||||
default: True
|
default: True
|
||||||
|
|
||||||
|
@ -1 +0,0 @@
|
|||||||
|
|
@ -1,12 +0,0 @@
|
|||||||
===============
|
|
||||||
Selectors_CASSD
|
|
||||||
===============
|
|
||||||
|
|
||||||
Needed Modules
|
|
||||||
==============
|
|
||||||
.. Do not edit this section It was auto-generated
|
|
||||||
.. by the `update_README.py` script.
|
|
||||||
Documentation
|
|
||||||
=============
|
|
||||||
.. Do not edit this section It was auto-generated
|
|
||||||
.. by the `update_README.py` script.
|
|
@ -1,95 +0,0 @@
|
|||||||
use bitmasks
|
|
||||||
|
|
||||||
BEGIN_PROVIDER [ integer, psi_selectors_size ]
|
|
||||||
implicit none
|
|
||||||
psi_selectors_size = psi_det_size
|
|
||||||
END_PROVIDER
|
|
||||||
|
|
||||||
BEGIN_PROVIDER [ integer, N_det_selectors]
|
|
||||||
implicit none
|
|
||||||
BEGIN_DOC
|
|
||||||
! For Single reference wave functions, the number of selectors is 1 : the
|
|
||||||
! Hartree-Fock determinant
|
|
||||||
END_DOC
|
|
||||||
N_det_selectors = N_det
|
|
||||||
END_PROVIDER
|
|
||||||
|
|
||||||
BEGIN_PROVIDER [ integer(bit_kind), psi_selectors, (N_int,2,psi_selectors_size) ]
|
|
||||||
&BEGIN_PROVIDER [ double precision, psi_selectors_coef, (psi_selectors_size,N_states) ]
|
|
||||||
implicit none
|
|
||||||
BEGIN_DOC
|
|
||||||
! Determinants on which we apply <i|H|psi> for perturbation.
|
|
||||||
END_DOC
|
|
||||||
integer :: i, k, l, m
|
|
||||||
logical :: good
|
|
||||||
|
|
||||||
do i=1,N_det_generators
|
|
||||||
do k=1,N_int
|
|
||||||
psi_selectors(k,1,i) = psi_det_generators(k,1,i)
|
|
||||||
psi_selectors(k,2,i) = psi_det_generators(k,2,i)
|
|
||||||
enddo
|
|
||||||
enddo
|
|
||||||
do k=1,N_states
|
|
||||||
do i=1,N_det_generators
|
|
||||||
psi_selectors_coef(i,k) = psi_coef_generators(i,k)
|
|
||||||
enddo
|
|
||||||
enddo
|
|
||||||
|
|
||||||
m=N_det_generators
|
|
||||||
|
|
||||||
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_sorted(k,1,i)) == &
|
|
||||||
iand(not(cas_bitmask(k,1,l)), HF_bitmask(k,1)) .and. ( &
|
|
||||||
iand(not(cas_bitmask(k,2,l)), psi_det_sorted(k,2,i)) == &
|
|
||||||
iand(not(cas_bitmask(k,2,l)), HF_bitmask(k,2) )) )
|
|
||||||
enddo
|
|
||||||
if (good) then
|
|
||||||
exit
|
|
||||||
endif
|
|
||||||
enddo
|
|
||||||
if (.not.good) then
|
|
||||||
m = m+1
|
|
||||||
do k=1,N_int
|
|
||||||
psi_selectors(k,1,m) = psi_det_sorted(k,1,i)
|
|
||||||
psi_selectors(k,2,m) = psi_det_sorted(k,2,i)
|
|
||||||
enddo
|
|
||||||
psi_selectors_coef(m,:) = psi_coef_sorted(i,:)
|
|
||||||
endif
|
|
||||||
enddo
|
|
||||||
if (N_det /= m) then
|
|
||||||
print *, N_det, m
|
|
||||||
stop 'N_det /= m'
|
|
||||||
endif
|
|
||||||
END_PROVIDER
|
|
||||||
|
|
||||||
BEGIN_PROVIDER [ double precision, psi_selectors_coef_transp, (N_states,psi_selectors_size) ]
|
|
||||||
implicit none
|
|
||||||
BEGIN_DOC
|
|
||||||
! Transposed psi_selectors
|
|
||||||
END_DOC
|
|
||||||
integer :: i,k
|
|
||||||
|
|
||||||
do i=1,N_det_selectors
|
|
||||||
do k=1,N_states
|
|
||||||
psi_selectors_coef_transp(k,i) = psi_selectors_coef(i,k)
|
|
||||||
enddo
|
|
||||||
enddo
|
|
||||||
END_PROVIDER
|
|
||||||
|
|
||||||
BEGIN_PROVIDER [ double precision, psi_selectors_diag_h_mat, (psi_selectors_size) ]
|
|
||||||
implicit none
|
|
||||||
BEGIN_DOC
|
|
||||||
! Diagonal elements of the H matrix for each selectors
|
|
||||||
END_DOC
|
|
||||||
integer :: i
|
|
||||||
double precision :: diag_H_mat_elem
|
|
||||||
do i = 1, N_det_selectors
|
|
||||||
psi_selectors_diag_h_mat(i) = diag_H_mat_elem(psi_selectors(1,1,i),N_int)
|
|
||||||
enddo
|
|
||||||
END_PROVIDER
|
|
||||||
|
|
||||||
|
|
@ -1,121 +0,0 @@
|
|||||||
subroutine zmq_put_psi(zmq_to_qp_run_socket,worker_id, energy, size_energy)
|
|
||||||
use f77_zmq
|
|
||||||
implicit none
|
|
||||||
BEGIN_DOC
|
|
||||||
! Put the wave function on the qp_run scheduler
|
|
||||||
END_DOC
|
|
||||||
integer(ZMQ_PTR), intent(in) :: zmq_to_qp_run_socket
|
|
||||||
integer, intent(in) :: worker_id
|
|
||||||
integer, intent(in) :: size_energy
|
|
||||||
double precision, intent(out) :: energy(size_energy)
|
|
||||||
integer :: rc
|
|
||||||
integer*8 :: rc8
|
|
||||||
character*(256) :: msg
|
|
||||||
|
|
||||||
write(msg,*) 'put_psi ', worker_id, N_states, N_det, psi_det_size, n_det_generators, n_det_selectors
|
|
||||||
|
|
||||||
rc = f77_zmq_send(zmq_to_qp_run_socket,trim(msg),len(trim(msg)),ZMQ_SNDMORE)
|
|
||||||
if (rc /= len(trim(msg))) then
|
|
||||||
print *, 'f77_zmq_send(zmq_to_qp_run_socket,trim(msg),len(trim(msg)),ZMQ_SNDMORE)'
|
|
||||||
stop 'error'
|
|
||||||
endif
|
|
||||||
|
|
||||||
rc8 = f77_zmq_send8(zmq_to_qp_run_socket,psi_det,N_int*2_8*N_det*bit_kind,ZMQ_SNDMORE)
|
|
||||||
if (rc8 /= N_int*2_8*N_det*bit_kind) then
|
|
||||||
print *, 'f77_zmq_send8(zmq_to_qp_run_socket,psi_det,N_int*2_8*N_det*bit_kind,ZMQ_SNDMORE)'
|
|
||||||
stop 'error'
|
|
||||||
endif
|
|
||||||
|
|
||||||
rc8 = f77_zmq_send8(zmq_to_qp_run_socket,psi_coef,psi_det_size*N_states*8_8,ZMQ_SNDMORE)
|
|
||||||
if (rc8 /= psi_det_size*N_states*8_8) then
|
|
||||||
print *, 'f77_zmq_send8(zmq_to_qp_run_socket,psi_coef,psi_det_size*N_states*8_8,ZMQ_SNDMORE)'
|
|
||||||
stop 'error'
|
|
||||||
endif
|
|
||||||
|
|
||||||
rc = f77_zmq_send(zmq_to_qp_run_socket,energy,size_energy*8,0)
|
|
||||||
if (rc /= size_energy*8) then
|
|
||||||
print *, 'f77_zmq_send(zmq_to_qp_run_socket,energy,size_energy*8,0)'
|
|
||||||
stop 'error'
|
|
||||||
endif
|
|
||||||
|
|
||||||
rc = f77_zmq_recv(zmq_to_qp_run_socket,msg,len(msg),0)
|
|
||||||
if (msg(1:rc) /= 'put_psi_reply 1') then
|
|
||||||
print *, rc, trim(msg)
|
|
||||||
print *, 'Error in put_psi_reply'
|
|
||||||
stop 'error'
|
|
||||||
endif
|
|
||||||
|
|
||||||
end
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
subroutine zmq_get_psi(zmq_to_qp_run_socket, worker_id, energy, size_energy)
|
|
||||||
use f77_zmq
|
|
||||||
implicit none
|
|
||||||
BEGIN_DOC
|
|
||||||
! Get the wave function from the qp_run scheduler
|
|
||||||
END_DOC
|
|
||||||
integer(ZMQ_PTR), intent(in) :: zmq_to_qp_run_socket
|
|
||||||
integer, intent(in) :: worker_id
|
|
||||||
integer, intent(in) :: size_energy
|
|
||||||
double precision, intent(out) :: energy(size_energy)
|
|
||||||
integer :: rc
|
|
||||||
integer*8 :: rc8
|
|
||||||
character*(64) :: msg
|
|
||||||
|
|
||||||
write(msg,*) 'get_psi ', worker_id
|
|
||||||
|
|
||||||
rc = f77_zmq_send(zmq_to_qp_run_socket,trim(msg),len(trim(msg)),0)
|
|
||||||
if (rc /= len(trim(msg))) then
|
|
||||||
print *, 'f77_zmq_send(zmq_to_qp_run_socket,trim(msg),len(trim(msg)),0)'
|
|
||||||
stop 'error'
|
|
||||||
endif
|
|
||||||
|
|
||||||
rc = f77_zmq_recv(zmq_to_qp_run_socket,msg,len(msg),0)
|
|
||||||
if (msg(1:13) /= 'get_psi_reply') then
|
|
||||||
print *, rc, trim(msg)
|
|
||||||
print *, 'Error in get_psi_reply'
|
|
||||||
stop 'error'
|
|
||||||
endif
|
|
||||||
|
|
||||||
integer :: N_states_read, N_det_read, psi_det_size_read
|
|
||||||
integer :: N_det_selectors_read, N_det_generators_read
|
|
||||||
read(msg(14:rc),*) N_states_read, N_det_read, psi_det_size_read, &
|
|
||||||
N_det_generators_read, N_det_selectors_read
|
|
||||||
|
|
||||||
N_states = N_states_read
|
|
||||||
N_det = N_det_read
|
|
||||||
psi_det_size = psi_det_size_read
|
|
||||||
TOUCH psi_det_size N_det N_states
|
|
||||||
|
|
||||||
rc8 = f77_zmq_recv8(zmq_to_qp_run_socket,psi_det,N_int*2_8*N_det*bit_kind,0)
|
|
||||||
if (rc8 /= N_int*2_8*N_det*bit_kind) then
|
|
||||||
print *, 'f77_zmq_recv(zmq_to_qp_run_socket,psi_det,N_int*2*N_det*bit_kind,ZMQ_SNDMORE)'
|
|
||||||
stop 'error'
|
|
||||||
endif
|
|
||||||
|
|
||||||
rc8 = f77_zmq_recv8(zmq_to_qp_run_socket,psi_coef,psi_det_size*N_states*8_8,0)
|
|
||||||
if (rc8 /= psi_det_size*N_states*8_8) then
|
|
||||||
print *, '77_zmq_recv8(zmq_to_qp_run_socket,psi_coef,psi_det_size*N_states*8_8,ZMQ_SNDMORE)'
|
|
||||||
stop 'error'
|
|
||||||
endif
|
|
||||||
TOUCH psi_det psi_coef
|
|
||||||
|
|
||||||
rc = f77_zmq_recv(zmq_to_qp_run_socket,energy,size_energy*8,0)
|
|
||||||
if (rc /= size_energy*8) then
|
|
||||||
print *, '77_zmq_recv(zmq_to_qp_run_socket,energy,size_energy*8,0)'
|
|
||||||
stop 'error'
|
|
||||||
endif
|
|
||||||
|
|
||||||
if (N_det_generators_read > 0) then
|
|
||||||
N_det_generators = N_det_generators_read
|
|
||||||
TOUCH N_det_generators
|
|
||||||
endif
|
|
||||||
if (N_det_selectors_read > 0) then
|
|
||||||
N_det_selectors = N_det_selectors_read
|
|
||||||
TOUCH N_det_selectors
|
|
||||||
endif
|
|
||||||
|
|
||||||
end
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user