10
0
mirror of https://github.com/LCPQ/quantum_package synced 2024-11-12 17:13:54 +01:00

Merge branch 'master' of github.com:LCPQ/quantum_package

This commit is contained in:
Manu 2014-05-27 17:44:17 +02:00
commit 07b8e89fed
35 changed files with 381 additions and 162 deletions

View File

@ -42,7 +42,7 @@ class H_apply(object):
!$OMP N_elec_in_key_hole_2,ia_ja_pairs,iproc) &
!$OMP SHARED(key_in,N_int,elec_num_tab,mo_tot_num, &
!$OMP hole_1, particl_1, hole_2, particl_2, &
!$OMP thresh,elec_alpha_num)"""
!$OMP thresh,elec_alpha_num,i_generator)"""
s["omp_end_parallel"] = "!$OMP END PARALLEL"
s["omp_master"] = "!$OMP MASTER"
s["omp_end_master"] = "!$OMP END MASTER"
@ -121,10 +121,10 @@ class H_apply(object):
sum_e_2_pert = sum_e_2_pert_in
sum_norm_pert = sum_norm_pert_in
sum_H_pert_diag = sum_H_pert_diag_in
PROVIDE CI_electronic_energy psi_ref_coef psi_ref
PROVIDE CI_electronic_energy psi_selectors_coef psi_selectors
"""
self.data["keys_work"] = """
call perturb_buffer_%s(keys_out,key_idx,e_2_pert_buffer,coef_pert_buffer,sum_e_2_pert, &
call perturb_buffer_%s(i_generator,keys_out,key_idx,e_2_pert_buffer,coef_pert_buffer,sum_e_2_pert, &
sum_norm_pert,sum_H_pert_diag,N_st,Nint)
"""%(pert,)
self.data["finalization"] = """

View File

View File

@ -0,0 +1,32 @@
use bitmasks
BEGIN_SHELL [ /usr/bin/env python ]
from generate_h_apply import *
from perturbation import perturbations
for perturbation in perturbations:
s = H_apply("cisd_selection_"+perturbation,openmp=True)
s.set_selection_pt2(perturbation)
print s
END_SHELL
subroutine H_apply_cisd_selection(perturbation,pt2, norm_pert, H_pert_diag, N_st)
implicit none
character*(64), intent(in) :: perturbation
integer, intent(in) :: N_st
double precision, intent(inout):: pt2(N_st), norm_pert(N_st)
double precision,intent(inout) :: H_pert_diag
BEGIN_SHELL [ /usr/bin/env python ]
from perturbation import perturbations
for perturbation in perturbations:
print """
if (perturbation == '%s') then
call H_apply_cisd_selection_%s(pt2, norm_pert, H_pert_diag, N_st)
endif
"""%(perturbation,perturbation)
END_SHELL
end

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 CISD Dets Electrons Ezfio_files Hartree_Fock MonoInts MOs Nuclei Output Perturbation SingleRefMethod Utils Selectors_full

View File

@ -0,0 +1,35 @@
====================
CISD_selected Module
====================
Documentation
=============
.. Do not edit this section. It was auto-generated from the
.. NEEDED_MODULES file.
Needed Modules
==============
.. Do not edit this section. It was auto-generated from the
.. NEEDED_MODULES file.
* `AOs <http://github.com/LCPQ/quantum_package/tree/master/src/AOs>`_
* `BiInts <http://github.com/LCPQ/quantum_package/tree/master/src/BiInts>`_
* `Bitmask <http://github.com/LCPQ/quantum_package/tree/master/src/Bitmask>`_
* `CISD <http://github.com/LCPQ/quantum_package/tree/master/src/CISD>`_
* `Dets <http://github.com/LCPQ/quantum_package/tree/master/src/Dets>`_
* `Electrons <http://github.com/LCPQ/quantum_package/tree/master/src/Electrons>`_
* `Ezfio_files <http://github.com/LCPQ/quantum_package/tree/master/src/Ezfio_files>`_
* `Hartree_Fock <http://github.com/LCPQ/quantum_package/tree/master/src/Hartree_Fock>`_
* `MonoInts <http://github.com/LCPQ/quantum_package/tree/master/src/MonoInts>`_
* `MOs <http://github.com/LCPQ/quantum_package/tree/master/src/MOs>`_
* `Nuclei <http://github.com/LCPQ/quantum_package/tree/master/src/Nuclei>`_
* `Output <http://github.com/LCPQ/quantum_package/tree/master/src/Output>`_
* `Perturbation <http://github.com/LCPQ/quantum_package/tree/master/src/Perturbation>`_
* `SingleRefMethod <http://github.com/LCPQ/quantum_package/tree/master/src/SingleRefMethod>`_
* `Utils <http://github.com/LCPQ/quantum_package/tree/master/src/Utils>`_
* `Selectors_full <http://github.com/LCPQ/quantum_package/tree/master/src/Selectors_full>`_

View File

@ -6,15 +6,15 @@ program cisd
double precision, allocatable :: pt2(:), norm_pert(:)
double precision :: H_pert_diag, E_old
integer :: N_st, iter
character*(64) :: perturbation
N_st = N_states
allocate (pt2(N_st), norm_pert(N_st))
pt2 = 1.d0
! davidson_criterion = 'wall_time'
! davidson_threshold = 1.d0
perturbation = "epstein_nesbet"
do while (maxval(abs(pt2(1:N_st))) > 1.d-6)
E_old = CI_energy(1)
call H_apply_cisd_selection(pt2, norm_pert, H_pert_diag, N_st)
call H_apply_cisd_selection(perturbation,pt2, norm_pert, H_pert_diag, N_st)
call diagonalize_CI
print *, 'N_det = ', N_det
print *, 'N_states = ', N_states

View File

@ -0,0 +1,33 @@
OPENMP =1
PROFILE =0
DEBUG = 0
IRPF90+= -I tests
REF_FILES=$(subst %.irp.f, %.ref, $(wildcard *.irp.f))
.PHONY: clean executables serial_tests parallel_tests
all: clean executables serial_tests parallel_tests
parallel_tests: $(REF_FILES)
@echo ; echo " ---- Running parallel tests ----" ; echo
@OMP_NUM_THREADS=10 ${QPACKAGE_ROOT}/scripts/run_tests.py
serial_tests: $(REF_FILES)
@echo ; echo " ---- Running serial tests ----" ; echo
@OMP_NUM_THREADS=1 ${QPACKAGE_ROOT}/scripts/run_tests.py
executables: $(wildcard *.irp.f) veryclean
$(MAKE) -C ..
%.ref: $(wildcard $(QPACKAGE_ROOT)/data/inputs/*.md5) executables
$(QPACKAGE_ROOT)/scripts/create_test_ref.sh $*
clean:
$(MAKE) -C .. clean
veryclean:
$(MAKE) -C .. veryclean

View File

@ -1,4 +1,4 @@
subroutine $subroutine_diexc(key_in, hole_1,particl_1, hole_2, particl_2 $parameters )
subroutine $subroutine_diexc(key_in, hole_1,particl_1, hole_2, particl_2, i_generator $parameters )
use omp_lib
use bitmasks
implicit none
@ -9,6 +9,7 @@ subroutine $subroutine_diexc(key_in, hole_1,particl_1, hole_2, particl_2 $parame
END_DOC
integer,parameter :: size_max = $size_max
$declarations
integer ,intent(in) :: i_generator
integer(bit_kind),intent(in) :: key_in(N_int,2)
integer(bit_kind),allocatable :: keys_out(:,:,:)
integer(bit_kind), intent(in) :: hole_1(N_int,2), particl_1(N_int,2)
@ -210,7 +211,7 @@ subroutine $subroutine_diexc(key_in, hole_1,particl_1, hole_2, particl_2 $parame
abort_here = abort_all
end
subroutine $subroutine_monoexc(key_in, hole_1,particl_1 $parameters )
subroutine $subroutine_monoexc(key_in, hole_1,particl_1,i_generator $parameters )
use omp_lib
use bitmasks
implicit none
@ -221,6 +222,7 @@ subroutine $subroutine_monoexc(key_in, hole_1,particl_1 $parameters )
END_DOC
integer,parameter :: size_max = $size_max
$declarations
integer ,intent(in) :: i_generator
integer(bit_kind),intent(in) :: key_in(N_int,2)
integer(bit_kind),allocatable :: keys_out(:,:,:)
integer(bit_kind), intent(in) :: hole_1(N_int,2), particl_1(N_int,2)
@ -328,19 +330,20 @@ subroutine $subroutine($params_main)
$decls_main
PROVIDE H_apply_buffer_allocated mo_bielec_integrals_in_map N_det_reference psi_generators
integer :: imask
integer :: i_generator
do imask=1,N_det_generators
call $subroutine_monoexc(psi_generators(1,1,imask), &
print *, irp_here
do i_generator=1,N_det_generators
call $subroutine_monoexc(psi_generators(1,1,i_generator), &
generators_bitmask(1,1,s_hole ,i_bitmask_gen), &
generators_bitmask(1,1,s_part ,i_bitmask_gen) &
$params_post)
call $subroutine_diexc(psi_generators(1,1,imask), &
generators_bitmask(1,1,s_part ,i_bitmask_gen), &
i_generator $params_post)
call $subroutine_diexc(psi_generators(1,1,i_generator), &
generators_bitmask(1,1,d_hole1,i_bitmask_gen), &
generators_bitmask(1,1,d_part1,i_bitmask_gen), &
generators_bitmask(1,1,d_hole2,i_bitmask_gen), &
generators_bitmask(1,1,d_part2,i_bitmask_gen) &
$params_post)
generators_bitmask(1,1,d_part2,i_bitmask_gen), &
i_generator $params_post)
if (abort_here) then
exit
endif

View File

@ -32,11 +32,6 @@ integer function connected_to_ref(key,keys,Nint,N_past_in,Ndet,thresh)
endif
if (degree_x2 > 5) then
cycle
! else
! call i_H_j(keys(1,1,i),key,Nint,hij_elec)
! if(dabs(hij_elec).lt.thresh)cycle
! connected_to_ref = i
! return
endif
enddo
@ -69,11 +64,6 @@ integer function connected_to_ref(key,keys,Nint,N_past_in,Ndet,thresh)
endif
if (degree_x2 > 5) then
cycle
! else
! call i_H_j(keys(1,1,i),key,Nint,hij_elec)
! if(dabs(hij_elec).lt.thresh)cycle
! connected_to_ref = i
! return
endif
enddo
@ -111,11 +101,6 @@ integer function connected_to_ref(key,keys,Nint,N_past_in,Ndet,thresh)
endif
if (degree_x2 > 5) then
cycle
! else
! call i_H_j(keys(1,1,i),key,Nint,hij_elec)
! if(dabs(hij_elec).lt.thresh)cycle
! connected_to_ref = i
! return
endif
enddo
@ -155,11 +140,6 @@ integer function connected_to_ref(key,keys,Nint,N_past_in,Ndet,thresh)
endif
if (degree_x2 > 5) then
cycle
! else
! call i_H_j(keys(1,1,i),key,Nint,hij_elec)
! if(dabs(hij_elec).lt.thresh)cycle
! connected_to_ref = i
! return
endif
enddo

0
src/MP2/ASSUMPTIONS.rst Normal file
View File

10
src/MP2/H_apply.irp.f Normal file
View File

@ -0,0 +1,10 @@
use bitmasks
BEGIN_SHELL [ /usr/bin/env python ]
from generate_h_apply import *
from perturbation import perturbations
s = H_apply("mp2",openmp=True)
s.set_perturbation("Moller_plesset")
print s
END_SHELL

8
src/MP2/Makefile Normal file
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

1
src/MP2/NEEDED_MODULES Normal file
View File

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

34
src/MP2/README.rst Normal file
View File

@ -0,0 +1,34 @@
==========
MP2 Module
==========
Documentation
=============
.. Do not edit this section. It was auto-generated from the
.. NEEDED_MODULES file.
Needed Modules
==============
.. Do not edit this section. It was auto-generated from the
.. NEEDED_MODULES file.
* `AOs <http://github.com/LCPQ/quantum_package/tree/master/src/AOs>`_
* `BiInts <http://github.com/LCPQ/quantum_package/tree/master/src/BiInts>`_
* `Bitmask <http://github.com/LCPQ/quantum_package/tree/master/src/Bitmask>`_
* `Dets <http://github.com/LCPQ/quantum_package/tree/master/src/Dets>`_
* `Electrons <http://github.com/LCPQ/quantum_package/tree/master/src/Electrons>`_
* `Ezfio_files <http://github.com/LCPQ/quantum_package/tree/master/src/Ezfio_files>`_
* `Hartree_Fock <http://github.com/LCPQ/quantum_package/tree/master/src/Hartree_Fock>`_
* `MonoInts <http://github.com/LCPQ/quantum_package/tree/master/src/MonoInts>`_
* `MOs <http://github.com/LCPQ/quantum_package/tree/master/src/MOs>`_
* `Nuclei <http://github.com/LCPQ/quantum_package/tree/master/src/Nuclei>`_
* `Output <http://github.com/LCPQ/quantum_package/tree/master/src/Output>`_
* `Perturbation <http://github.com/LCPQ/quantum_package/tree/master/src/Perturbation>`_
* `Utils <http://github.com/LCPQ/quantum_package/tree/master/src/Utils>`_
* `Selectors_full <http://github.com/LCPQ/quantum_package/tree/master/src/Selectors_full>`_
* `SingleRefMethod <http://github.com/LCPQ/quantum_package/tree/master/src/SingleRefMethod>`_

17
src/MP2/mp2.irp.f Normal file
View File

@ -0,0 +1,17 @@
program cisd
implicit none
double precision, allocatable :: pt2(:), norm_pert(:)
double precision :: H_pert_diag, E_old
integer :: N_st, iter
PROVIDE Fock_matrix_diag_mo
N_st = N_states
allocate (pt2(N_st), norm_pert(N_st))
E_old = HF_energy
call H_apply_mp2(pt2, norm_pert, H_pert_diag, N_st)
print *, 'N_det = ', N_det
print *, 'N_states = ', N_states
print *, 'MP2 = ', pt2
print *, 'E = ', E_old
print *, 'E+MP2 = ', E_old+pt2
deallocate(pt2,norm_pert)
end

33
src/MP2/tests/Makefile Normal file
View File

@ -0,0 +1,33 @@
OPENMP =1
PROFILE =0
DEBUG = 0
IRPF90+= -I tests
REF_FILES=$(subst %.irp.f, %.ref, $(wildcard *.irp.f))
.PHONY: clean executables serial_tests parallel_tests
all: clean executables serial_tests parallel_tests
parallel_tests: $(REF_FILES)
@echo ; echo " ---- Running parallel tests ----" ; echo
@OMP_NUM_THREADS=10 ${QPACKAGE_ROOT}/scripts/run_tests.py
serial_tests: $(REF_FILES)
@echo ; echo " ---- Running serial tests ----" ; echo
@OMP_NUM_THREADS=1 ${QPACKAGE_ROOT}/scripts/run_tests.py
executables: $(wildcard *.irp.f) veryclean
$(MAKE) -C ..
%.ref: $(wildcard $(QPACKAGE_ROOT)/data/inputs/*.md5) executables
$(QPACKAGE_ROOT)/scripts/create_test_ref.sh $*
clean:
$(MAKE) -C .. clean
veryclean:
$(MAKE) -C .. veryclean

View File

@ -5,7 +5,7 @@ OBJ=
include $(QPACKAGE_ROOT)/src/Makefile.common
all:$(ALL)
all: all_modules
all_clean:
@for i in $(NEEDED_MODULES) ; do cd $$i ; make veryclean ; make clean_links ; cd .. ; done

View File

@ -1 +1 @@
AOs Bitmask Electrons Ezfio_files MOs Nuclei Output Utils Hartree_Fock BiInts MonoInts MOGuess Dets DensityMatrix CISD Perturbation SingleRefMethod
AOs Bitmask Electrons Ezfio_files MOs Nuclei Output Utils Hartree_Fock BiInts MonoInts MOGuess Dets DensityMatrix CISD Perturbation SingleRefMethod CISD_selected Selectors_full MP2

View File

@ -25,13 +25,13 @@ subroutine pt2_moller_plesset(det_pert,c_pert,e_2_pert,H_pert_diag,Nint,ndet,n_s
integer :: h1,h2,p1,p2,s1,s2
ASSERT (Nint == N_int)
ASSERT (Nint > 0)
call get_excitation(det_pert,ref_bitmask,exc,degree,phase,Nint)
call get_excitation(ref_bitmask,det_pert,exc,degree,phase,Nint)
call decode_exc(exc,degree,h1,p1,h2,p2,s1,s2)
delta_e = Fock_matrix_diag_mo(h1) + Fock_matrix_diag_mo(h2) - &
Fock_matrix_diag_mo(p1) + Fock_matrix_diag_mo(p2)
(Fock_matrix_diag_mo(p1) + Fock_matrix_diag_mo(p2))
delta_e = 1.d0/delta_e
call i_H_psi(det_pert,psi_ref,psi_ref_coef,Nint,ndet,psi_ref_size,n_st,i_H_psi_array)
call i_H_psi(det_pert,psi_selectors,psi_selectors_coef,Nint,N_det,psi_selectors_size,n_st,i_H_psi_array)
H_pert_diag = diag_H_mat_elem(det_pert,Nint)
do i =1,n_st
c_pert(i) = i_H_psi_array(i) *delta_e

View File

@ -1 +1 @@
AOs BiInts Bitmask Dets Electrons Ezfio_files Hartree_Fock MonoInts MOs Nuclei Output Utils SingleRefMethod
AOs BiInts Bitmask Dets Electrons Ezfio_files Hartree_Fock MonoInts MOs Nuclei Output Utils

View File

@ -182,36 +182,33 @@ Documentation
NOTE :::: if you satisfy Brillouin Theorem, the singles don't contribute !!
.br
`cisd <http://github.com/LCPQ/quantum_package/tree/master/src/Perturbation/perturbation_test.irp.f#L1>`_
Undocumented
`fill_h_apply_buffer_selection <http://github.com/LCPQ/quantum_package/tree/master/src/Perturbation/selection.irp.f#L1>`_
`fill_h_apply_buffer_selection <http://github.com/LCPQ/quantum_package/tree/master/src/Perturbation/selection.irp.f#L2>`_
Fill the H_apply buffer with determiants for the selection
`remove_small_contributions <http://github.com/LCPQ/quantum_package/tree/master/src/Perturbation/selection.irp.f#L80>`_
`n_det_selectors <http://github.com/LCPQ/quantum_package/tree/master/src/Perturbation/selection.irp.f#L120>`_
Undocumented
`psi_selectors <http://github.com/LCPQ/quantum_package/tree/master/src/Perturbation/selection.irp.f#L125>`_
On what we apply <i|H|psi> for perturbation. If selection, it may be 0.9 of the norm.
`psi_selectors_coef <http://github.com/LCPQ/quantum_package/tree/master/src/Perturbation/selection.irp.f#L126>`_
On what we apply <i|H|psi> for perturbation. If selection, it may be 0.9 of the norm.
`psi_selectors_size <http://github.com/LCPQ/quantum_package/tree/master/src/Perturbation/selection.irp.f#L116>`_
Undocumented
`remove_small_contributions <http://github.com/LCPQ/quantum_package/tree/master/src/Perturbation/selection.irp.f#L81>`_
Remove determinants with small contributions
`selection_criterion <http://github.com/LCPQ/quantum_package/tree/master/src/Perturbation/selection.irp.f#L67>`_
`selection_criterion <http://github.com/LCPQ/quantum_package/tree/master/src/Perturbation/selection.irp.f#L68>`_
Threshold to select determinants. Set by selection routines.
`selection_criterion_factor <http://github.com/LCPQ/quantum_package/tree/master/src/Perturbation/selection.irp.f#L69>`_
`selection_criterion_factor <http://github.com/LCPQ/quantum_package/tree/master/src/Perturbation/selection.irp.f#L70>`_
Threshold to select determinants. Set by selection routines.
`selection_criterion_min <http://github.com/LCPQ/quantum_package/tree/master/src/Perturbation/selection.irp.f#L68>`_
`selection_criterion_min <http://github.com/LCPQ/quantum_package/tree/master/src/Perturbation/selection.irp.f#L69>`_
Threshold to select determinants. Set by selection routines.
`n_det_ref <http://github.com/LCPQ/quantum_package/tree/master/src/Perturbation/temporary_stuff.irp.f#L11>`_
Undocumented
`psi_ref <http://github.com/LCPQ/quantum_package/tree/master/src/Perturbation/temporary_stuff.irp.f#L16>`_
On what we apply <i|H|psi> for perturbation. If selection, it may be 0.9 of the norm.
`psi_ref_coef <http://github.com/LCPQ/quantum_package/tree/master/src/Perturbation/temporary_stuff.irp.f#L17>`_
On what we apply <i|H|psi> for perturbation. If selection, it may be 0.9 of the norm.
`psi_ref_size <http://github.com/LCPQ/quantum_package/tree/master/src/Perturbation/temporary_stuff.irp.f#L7>`_
Undocumented
Needed Modules
@ -232,5 +229,4 @@ Needed Modules
* `Nuclei <http://github.com/LCPQ/quantum_package/tree/master/src/Nuclei>`_
* `Output <http://github.com/LCPQ/quantum_package/tree/master/src/Output>`_
* `Utils <http://github.com/LCPQ/quantum_package/tree/master/src/Utils>`_
* `SingleRefMethod <http://github.com/LCPQ/quantum_package/tree/master/src/SingleRefMethod>`_

View File

@ -21,17 +21,17 @@ subroutine pt2_epstein_nesbet(det_pert,c_pert,e_2_pert,H_pert_diag,Nint,ndet,n_s
double precision :: diag_H_mat_elem
ASSERT (Nint == N_int)
ASSERT (Nint > 0)
call i_H_psi(det_pert,psi_ref,psi_ref_coef,Nint,ndet,psi_ref_size,n_st,i_H_psi_array)
call i_H_psi(det_pert,psi_selectors,psi_selectors_coef,Nint,N_det_selectors,psi_selectors_size,N_st,i_H_psi_array)
H_pert_diag = diag_H_mat_elem(det_pert,Nint)
if (dabs(CI_electronic_energy(i) - H_pert_diag) > 1.d-6) then
do i =1,n_st
c_pert(i) = i_H_psi_array(i) / (CI_electronic_energy(i) - H_pert_diag)
e_2_pert(i) = c_pert(i) * i_H_psi_array(i)
enddo
else
c_pert = 0.d0
e_2_pert = 0.d0
endif
do i =1,n_st
if (dabs(CI_electronic_energy(i) - H_pert_diag) > 1.d-6) then
c_pert(i) = i_H_psi_array(i) / (CI_electronic_energy(i) - H_pert_diag)
e_2_pert(i) = c_pert(i) * i_H_psi_array(i)
else
c_pert(i) = 0.d0
e_2_pert(i) = 0.d0
endif
enddo
end
@ -58,7 +58,7 @@ subroutine pt2_epstein_nesbet_2x2(det_pert,c_pert,e_2_pert,H_pert_diag,Nint,ndet
double precision :: diag_H_mat_elem,delta_e
ASSERT (Nint == N_int)
ASSERT (Nint > 0)
call i_H_psi(det_pert,psi_ref,psi_ref_coef,Nint,N_det_ref,psi_ref_size,n_st,i_H_psi_array)
call i_H_psi(det_pert,psi_selectors,psi_selectors_coef,Nint,N_det_selectors,psi_selectors_size,n_st,i_H_psi_array)
H_pert_diag = diag_H_mat_elem(det_pert,Nint)
do i =1,n_st
delta_e = H_pert_diag - CI_electronic_energy(i)
@ -108,13 +108,13 @@ subroutine pt2_epstein_nesbet_SC2(det_pert,c_pert,e_2_pert,H_pert_diag,Nint,ndet
double precision :: diag_H_mat_elem,accu_e_corr,hij
ASSERT (Nint == N_int)
ASSERT (Nint > 0)
call i_H_psi_SC2(det_pert,psi_ref,psi_ref_coef,Nint,ndet,psi_ref_size,n_st,i_H_psi_array,idx_repeat)
call i_H_psi_SC2(det_pert,psi_selectors,psi_selectors_coef,Nint,N_det_selectors,psi_selectors_size,n_st,i_H_psi_array,idx_repeat)
accu_e_corr = 0.d0
do i = 1, idx_repeat(0)
call i_H_j(psi_ref(1,1,idx_repeat(i)),det_pert,Nint,hij)
accu_e_corr = accu_e_corr + hij * psi_ref_coef(idx_repeat(i),1)
call i_H_j(psi_selectors(1,1,idx_repeat(i)),det_pert,Nint,hij)
accu_e_corr = accu_e_corr + hij * psi_selectors_coef(idx_repeat(i),1)
enddo
accu_e_corr = accu_e_corr / psi_ref_coef(1,1)
accu_e_corr = accu_e_corr / psi_selectors_coef(1,1)
H_pert_diag = diag_H_mat_elem(det_pert,Nint) + accu_e_corr
do i =1,n_st
e_2_pert(i) = c_pert(i) * i_H_psi_array(i)
@ -162,13 +162,13 @@ subroutine pt2_epstein_nesbet_2x2_SC2(det_pert,c_pert,e_2_pert,H_pert_diag,Nint,
double precision :: diag_H_mat_elem,accu_e_corr,hij,delta_e
ASSERT (Nint == N_int)
ASSERT (Nint > 0)
call i_H_psi_SC2(det_pert,psi_ref,psi_ref_coef,Nint,ndet,psi_ref_size,n_st,i_H_psi_array,idx_repeat)
call i_H_psi_SC2(det_pert,psi_selectors,psi_selectors_coef,Nint,N_det_selectors,psi_selectors_size,n_st,i_H_psi_array,idx_repeat)
accu_e_corr = 0.d0
do i = 1, idx_repeat(0)
call i_H_j(psi_ref(1,1,idx_repeat(i)),det_pert,Nint,hij)
accu_e_corr = accu_e_corr + hij * psi_ref_coef(idx_repeat(i),1)
call i_H_j(psi_selectors(1,1,idx_repeat(i)),det_pert,Nint,hij)
accu_e_corr = accu_e_corr + hij * psi_selectors_coef(idx_repeat(i),1)
enddo
accu_e_corr = accu_e_corr / psi_ref_coef(1,1)
accu_e_corr = accu_e_corr / psi_selectors_coef(1,1)
H_pert_diag = diag_H_mat_elem(det_pert,Nint) + accu_e_corr
do i =1,n_st
delta_e = H_pert_diag - CI_electronic_energy(i)
@ -222,17 +222,17 @@ subroutine pt2_epstein_nesbet_SC2_projected(det_pert,c_pert,e_2_pert,H_pert_diag
double precision :: diag_H_mat_elem,accu_e_corr,hij,h0j
ASSERT (Nint == N_int)
ASSERT (Nint > 0)
call i_H_psi_SC2(det_pert,psi_ref,psi_ref_coef,Nint,ndet,psi_ref_size,n_st,i_H_psi_array,idx_repeat)
call i_H_psi_SC2(det_pert,psi_selectors,psi_selectors_coef,Nint,N_det_selectors,psi_selectors_size,n_st,i_H_psi_array,idx_repeat)
accu_e_corr = 0.d0
call i_H_j(ref_bitmask,det_pert,Nint,h0j)
do i = 1, idx_repeat(0)
call i_H_j(psi_ref(1,1,idx_repeat(i)),det_pert,Nint,hij)
accu_e_corr = accu_e_corr + hij * psi_ref_coef(idx_repeat(i),1)
call i_H_j(psi_selectors(1,1,idx_repeat(i)),det_pert,Nint,hij)
accu_e_corr = accu_e_corr + hij * psi_selectors_coef(idx_repeat(i),1)
enddo
accu_e_corr = accu_e_corr / psi_ref_coef(1,1)
accu_e_corr = accu_e_corr / psi_selectors_coef(1,1)
H_pert_diag = diag_H_mat_elem(det_pert,Nint) + accu_e_corr
c_pert(1) = 1.d0/psi_ref_coef(1,1) * i_H_psi_array(1) / (CI_electronic_energy(i) - H_pert_diag)
c_pert(1) = 1.d0/psi_selectors_coef(1,1) * i_H_psi_array(1) / (CI_electronic_energy(i) - H_pert_diag)
e_2_pert(1) = c_pert(i) * h0j
do i =2,n_st
if (dabs(CI_electronic_energy(i) - H_pert_diag) > 1.d-6) then

View File

@ -1,16 +0,0 @@
#!/usr/bin/env python
from generate_h_apply import *
s = H_apply("cisd_pt2",openmp=True)
#s.set_perturbation("epstein_nesbet_2x2")
s.set_perturbation("epstein_nesbet")
#s["keys_work"] += """
#call fill_H_apply_buffer_cisd(key_idx,keys_out,N_int)
#"""
print s
s = H_apply("cisd_selection",openmp=True)
s.set_selection_pt2("epstein_nesbet_2x2")
print s

View File

@ -2,14 +2,14 @@ BEGIN_SHELL [ /usr/bin/env python ]
import perturbation
END_SHELL
subroutine perturb_buffer_$PERT(buffer,buffer_size,e_2_pert_buffer,coef_pert_buffer,sum_e_2_pert,sum_norm_pert,sum_H_pert_diag,N_st,Nint)
subroutine perturb_buffer_$PERT(i_generator,buffer,buffer_size,e_2_pert_buffer,coef_pert_buffer,sum_e_2_pert,sum_norm_pert,sum_H_pert_diag,N_st,Nint)
implicit none
BEGIN_DOC
! Applly pertubration ``$PERT`` to the buffer of determinants generated in the H_apply
! routine.
END_DOC
integer, intent(in) :: Nint, N_st, buffer_size
integer, intent(in) :: Nint, N_st, buffer_size, i_generator
integer(bit_kind), intent(in) :: buffer(Nint,2,buffer_size)
double precision, intent(inout) :: sum_norm_pert(N_st),sum_e_2_pert(N_st)
double precision, intent(inout) :: coef_pert_buffer(N_st,buffer_size),e_2_pert_buffer(N_st,buffer_size),sum_H_pert_diag(N_st)
@ -24,14 +24,14 @@ subroutine perturb_buffer_$PERT(buffer,buffer_size,e_2_pert_buffer,coef_pert_buf
ASSERT (N_st > 0)
do i = 1,buffer_size
c_ref = connected_to_ref(buffer(1,1,i),psi_det,Nint,N_det_generators,N_det_reference,h_apply_threshold)
c_ref = connected_to_ref(buffer(1,1,i),psi_generators,Nint,i_generator,N_det,h_apply_threshold)
if (c_ref /= 0) then
cycle
endif
call pt2_$PERT(buffer(1,1,i), &
c_pert,e_2_pert,H_pert_diag,Nint,n_det_ref,n_st)
c_pert,e_2_pert,H_pert_diag,Nint,N_det_selectors,n_st)
do k = 1,N_st
e_2_pert_buffer(k,i) = e_2_pert(k)

View File

@ -1,16 +0,0 @@
program cisd
implicit none
integer :: i,k
double precision, allocatable :: eigvalues(:),eigvectors(:,:)
double precision, allocatable :: pt2(:), norm_pert(:)
double precision :: H_pert_diag
integer :: N_st
N_st = N_states
allocate (pt2(N_st), norm_pert(N_st))
call H_apply_cisd_pt2(pt2, norm_pert, H_pert_diag, N_st)
print *, 'N_det = ', N_det
print *, 'pt2 = ', pt2(1)
print *, 'E = ', CI_energy(1)+pt2(1)
return
end

View File

@ -110,3 +110,7 @@ subroutine remove_small_contributions
call write_int(output_dets,N_removed, 'Removed determinants')
endif
end

View File

@ -1,37 +0,0 @@
use bitmasks
BEGIN_SHELL [ /bin/bash ]
./h_apply.py
END_SHELL
BEGIN_PROVIDER [ integer, psi_ref_size ]
implicit none
psi_ref_size = psi_det_size
END_PROVIDER
BEGIN_PROVIDER [ integer, N_det_ref]
implicit none
N_det_ref = N_det
END_PROVIDER
BEGIN_PROVIDER [ integer(bit_kind), psi_ref, (N_int,2,psi_ref_size) ]
&BEGIN_PROVIDER [ double precision, psi_ref_coef, (psi_ref_size,N_states) ]
implicit none
BEGIN_DOC
! On what we apply <i|H|psi> for perturbation. If selection, it may be 0.9 of the norm.
END_DOC
integer :: i,k
do i=1,N_det_ref
do k=1,N_int
psi_ref(k,1,i) = psi_det(k,1,i)
psi_ref(k,2,i) = psi_det(k,2,i)
enddo
enddo
do k=1,N_states
do i=1,N_det_ref
psi_ref_coef(i,k) = psi_coef(i,k)
enddo
enddo
END_PROVIDER

View File

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 Hartree_Fock MonoInts MOs Nuclei Output Utils

View File

@ -0,0 +1,4 @@
=====================
Selectors_full Module
=====================

View File

@ -0,0 +1,32 @@
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
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
! On what we apply <i|H|psi> for perturbation. If selection, it may be 0.9 of the norm.
END_DOC
integer :: i,k
do i=1,N_det_selectors
do k=1,N_int
psi_selectors(k,1,i) = psi_det(k,1,i)
psi_selectors(k,2,i) = psi_det(k,2,i)
enddo
enddo
do k=1,N_states
do i=1,N_det_selectors
psi_selectors_coef(i,k) = psi_coef(i,k)
enddo
enddo
END_PROVIDER

View File

@ -0,0 +1,33 @@
OPENMP =1
PROFILE =0
DEBUG = 0
IRPF90+= -I tests
REF_FILES=$(subst %.irp.f, %.ref, $(wildcard *.irp.f))
.PHONY: clean executables serial_tests parallel_tests
all: clean executables serial_tests parallel_tests
parallel_tests: $(REF_FILES)
@echo ; echo " ---- Running parallel tests ----" ; echo
@OMP_NUM_THREADS=10 ${QPACKAGE_ROOT}/scripts/run_tests.py
serial_tests: $(REF_FILES)
@echo ; echo " ---- Running serial tests ----" ; echo
@OMP_NUM_THREADS=1 ${QPACKAGE_ROOT}/scripts/run_tests.py
executables: $(wildcard *.irp.f) veryclean
$(MAKE) -C ..
%.ref: $(wildcard $(QPACKAGE_ROOT)/data/inputs/*.md5) executables
$(QPACKAGE_ROOT)/scripts/create_test_ref.sh $*
clean:
$(MAKE) -C .. clean
veryclean:
$(MAKE) -C .. veryclean

View File

@ -9,20 +9,35 @@ BEGIN_PROVIDER [ integer, N_det_generators ]
N_det_generators = 1
END_PROVIDER
BEGIN_PROVIDER [ integer(bit_kind), psi_generators, (N_int,2,1) ]
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
psi_generators = 0_bit_kind
integer :: i
integer :: i,j,k
integer :: degree
do i=1,N_int
psi_generators(i,1,1) = HF_bitmask(i,1)
psi_generators(i,2,1) = HF_bitmask(i,2)
enddo
do j=1,N_det
call get_excitation_degree(HF_bitmask,psi_det(1,1,j),degree,N_int)
if (degree == 0) then
k = j
endif
end do
do j=2,k
psi_generators(:,:,j) = psi_det(:,:,j-1)
enddo
do j=k+1,N_det
psi_generators(:,:,j) = psi_det(:,:,j)
enddo
END_PROVIDER