10
0
mirror of https://github.com/LCPQ/quantum_package synced 2024-12-23 04:43:50 +01:00

Remove WILL be DELETED and change ezfio_with_default in concequance

This commit is contained in:
Thomas Applencourt 2015-04-16 13:57:00 +02:00
parent 74c9e03e2a
commit db558258b2
9 changed files with 617 additions and 527 deletions

View File

@ -1,61 +0,0 @@
bielec_integrals
read_ao_integrals False
read_mo_integrals False
write_ao_integrals False
write_mo_integrals False
threshold_ao 1.e-15
threshold_mo 1.e-15
direct False
cis_dressed
n_state_cis 10
n_core_cis 0
n_act_cis mo_basis_mo_tot_num
mp2_dressing False
standard_doubles True
en_2_2 False
determinants
n_states 1
n_states_diag determinants_n_states
n_det_max_jacobi 1000
threshold_generators 0.99
threshold_selectors 0.999
read_wf False
s2_eig False
only_single_double_dm False
full_ci
n_det_max_fci 10000
n_det_max_fci_property 50000
pt2_max 1.e-4
do_pt2_end True
var_pt2_ratio 0.75
cas_sd
n_det_max_cas_sd 100000
pt2_max 1.e-4
do_pt2_end True
var_pt2_ratio 0.75
all_singles
n_det_max_fci 50000
pt2_max 1.e-8
do_pt2_end False
hartree_fock
n_it_scf_max 200
thresh_scf 1.e-10
guess "Huckel"
cisd_selected
n_det_max_cisd 10000
pt2_max 1.e-4
cisd_sc2_selected
n_det_max_cisd_sc2 10000
pt2_max 1.e-4
do_pt2_end True
properties
z_one_point 3.9

View File

@ -70,9 +70,9 @@ def is_bool(str_):
Take a string, if is a bool return the conversion into Take a string, if is a bool return the conversion into
fortran and ocaml. fortran and ocaml.
""" """
if "true" in str_.stirp().lower(): if "true" in str_.strip().lower():
return Type(None, "true", ".True.") return Type(None, "true", ".True.")
elif "false" in str_.stirp().lower(): elif "false" in str_.strip().lower():
return Type(None, "false", ".False") return Type(None, "false", ".False")
else: else:
raise TypeError raise TypeError

View File

@ -90,13 +90,19 @@ END_PROVIDER
self.default = t self.default = t
def get_default(self): def get_default(self):
filename = '/'.join( [os.environ['QPACKAGE_ROOT'], 'data', mypath = '/'.join( [os.environ['QPACKAGE_ROOT'], 'data',
'ezfio_defaults', 'ezfio_defaults'] )
'WILL_BE_DELETED.ezfio_default'] )
from os import listdir
from os.path import isfile, join
onlyfiles = [ join(mypath,f) for f in listdir(mypath) if isfile(join(mypath,f)) ]
lines = []
for filename in onlyfiles:
file = open(filename,'r')
lines.extend(file.readlines())
file.close()
file = open(filename,'r')
lines = file.readlines()
file.close()
k=-1 k=-1
# Search directory # Search directory
for k,line in enumerate(lines): for k,line in enumerate(lines):

View File

@ -90,10 +90,6 @@ Documentation
`connected_to_ref_by_mono <http://github.com/LCPQ/quantum_package/tree/master/src/Dets/connected_to_ref.irp.f#L253>`_ `connected_to_ref_by_mono <http://github.com/LCPQ/quantum_package/tree/master/src/Dets/connected_to_ref.irp.f#L253>`_
Undocumented Undocumented
`det_is_not_or_may_be_in_ref <http://github.com/LCPQ/quantum_package/tree/master/src/Dets/connected_to_ref.irp.f#L359>`_
If true, det is not in ref
If false, det may be in ref
`det_search_key <http://github.com/LCPQ/quantum_package/tree/master/src/Dets/connected_to_ref.irp.f#L1>`_ `det_search_key <http://github.com/LCPQ/quantum_package/tree/master/src/Dets/connected_to_ref.irp.f#L1>`_
Return an integer*8 corresponding to a determinant index for searching Return an integer*8 corresponding to a determinant index for searching
@ -103,9 +99,6 @@ Documentation
`is_in_wavefunction <http://github.com/LCPQ/quantum_package/tree/master/src/Dets/connected_to_ref.irp.f#L34>`_ `is_in_wavefunction <http://github.com/LCPQ/quantum_package/tree/master/src/Dets/connected_to_ref.irp.f#L34>`_
True if the determinant ``det`` is in the wave function True if the determinant ``det`` is in the wave function
`key_pattern_not_in_ref <http://github.com/LCPQ/quantum_package/tree/master/src/Dets/connected_to_ref.irp.f#L393>`_
Min and max values of the integers of the keys of the reference
`occ_pattern_search_key <http://github.com/LCPQ/quantum_package/tree/master/src/Dets/connected_to_ref.irp.f#L17>`_ `occ_pattern_search_key <http://github.com/LCPQ/quantum_package/tree/master/src/Dets/connected_to_ref.irp.f#L17>`_
Return an integer*8 corresponding to a determinant index for searching Return an integer*8 corresponding to a determinant index for searching
@ -200,16 +193,10 @@ Documentation
`det_svd <http://github.com/LCPQ/quantum_package/tree/master/src/Dets/det_svd.irp.f#L1>`_ `det_svd <http://github.com/LCPQ/quantum_package/tree/master/src/Dets/det_svd.irp.f#L1>`_
Computes the SVD of the Alpha x Beta determinant coefficient matrix Computes the SVD of the Alpha x Beta determinant coefficient matrix
`create_wf_of_psi_svd_matrix <http://github.com/LCPQ/quantum_package/tree/master/src/Dets/determinants.irp.f#L741>`_ `filter_3_highest_electrons <http://github.com/LCPQ/quantum_package/tree/master/src/Dets/determinants.irp.f#L426>`_
Matrix of wf coefficients. Outer product of alpha and beta determinants
`filter_3_highest_electrons <http://github.com/LCPQ/quantum_package/tree/master/src/Dets/determinants.irp.f#L552>`_
Returns a determinant with only the 3 highest electrons Returns a determinant with only the 3 highest electrons
`generate_all_alpha_beta_det_products <http://github.com/LCPQ/quantum_package/tree/master/src/Dets/determinants.irp.f#L796>`_ `int_of_3_highest_electrons <http://github.com/LCPQ/quantum_package/tree/master/src/Dets/determinants.irp.f#L391>`_
Create a wave function from all possible alpha x beta determinants
`int_of_3_highest_electrons <http://github.com/LCPQ/quantum_package/tree/master/src/Dets/determinants.irp.f#L517>`_
Returns an integer*8 as : Returns an integer*8 as :
.br .br
|_<--- 21 bits ---><--- 21 bits ---><--- 21 bits --->| |_<--- 21 bits ---><--- 21 bits ---><--- 21 bits --->|
@ -226,32 +213,26 @@ Documentation
`n_det <http://github.com/LCPQ/quantum_package/tree/master/src/Dets/determinants.irp.f#L3>`_ `n_det <http://github.com/LCPQ/quantum_package/tree/master/src/Dets/determinants.irp.f#L3>`_
Number of determinants in the wave function Number of determinants in the wave function
`n_det_alpha_unique <http://github.com/LCPQ/quantum_package/tree/master/src/Dets/determinants.irp.f#L348>`_
Unique alpha determinants
`n_det_beta_unique <http://github.com/LCPQ/quantum_package/tree/master/src/Dets/determinants.irp.f#L385>`_
Unique beta determinants
`psi_average_norm_contrib <http://github.com/LCPQ/quantum_package/tree/master/src/Dets/determinants.irp.f#L276>`_ `psi_average_norm_contrib <http://github.com/LCPQ/quantum_package/tree/master/src/Dets/determinants.irp.f#L276>`_
Contribution of determinants to the state-averaged density Contribution of determinants to the state-averaged density
`psi_average_norm_contrib_sorted <http://github.com/LCPQ/quantum_package/tree/master/src/Dets/determinants.irp.f#L432>`_ `psi_average_norm_contrib_sorted <http://github.com/LCPQ/quantum_package/tree/master/src/Dets/determinants.irp.f#L306>`_
Wave function sorted by determinants contribution to the norm (state-averaged) Wave function sorted by determinants contribution to the norm (state-averaged)
`psi_coef <http://github.com/LCPQ/quantum_package/tree/master/src/Dets/determinants.irp.f#L230>`_ `psi_coef <http://github.com/LCPQ/quantum_package/tree/master/src/Dets/determinants.irp.f#L230>`_
The wave function coefficients. Initialized with Hartree-Fock if the EZFIO file The wave function coefficients. Initialized with Hartree-Fock if the EZFIO file
is empty is empty
`psi_coef_sorted <http://github.com/LCPQ/quantum_package/tree/master/src/Dets/determinants.irp.f#L431>`_ `psi_coef_sorted <http://github.com/LCPQ/quantum_package/tree/master/src/Dets/determinants.irp.f#L305>`_
Wave function sorted by determinants contribution to the norm (state-averaged) Wave function sorted by determinants contribution to the norm (state-averaged)
`psi_coef_sorted_ab <http://github.com/LCPQ/quantum_package/tree/master/src/Dets/determinants.irp.f#L579>`_ `psi_coef_sorted_ab <http://github.com/LCPQ/quantum_package/tree/master/src/Dets/determinants.irp.f#L453>`_
Determinants on which we apply <i|H|j>. Determinants on which we apply <i|H|j>.
They are sorted by the 3 highest electrons in the alpha part, They are sorted by the 3 highest electrons in the alpha part,
then by the 3 highest electrons in the beta part to accelerate then by the 3 highest electrons in the beta part to accelerate
the research of connected determinants. the research of connected determinants.
`psi_coef_sorted_bit <http://github.com/LCPQ/quantum_package/tree/master/src/Dets/determinants.irp.f#L462>`_ `psi_coef_sorted_bit <http://github.com/LCPQ/quantum_package/tree/master/src/Dets/determinants.irp.f#L336>`_
Determinants on which we apply <i|H|psi> for perturbation. Determinants on which we apply <i|H|psi> for perturbation.
They are sorted by determinants interpreted as integers. Useful They are sorted by determinants interpreted as integers. Useful
to accelerate the search of a random determinant in the wave to accelerate the search of a random determinant in the wave
@ -261,80 +242,53 @@ Documentation
The wave function determinants. Initialized with Hartree-Fock if the EZFIO file The wave function determinants. Initialized with Hartree-Fock if the EZFIO file
is empty is empty
`psi_det_alpha <http://github.com/LCPQ/quantum_package/tree/master/src/Dets/determinants.irp.f#L319>`_
List of alpha determinants of psi_det
`psi_det_alpha_unique <http://github.com/LCPQ/quantum_package/tree/master/src/Dets/determinants.irp.f#L347>`_
Unique alpha determinants
`psi_det_beta <http://github.com/LCPQ/quantum_package/tree/master/src/Dets/determinants.irp.f#L333>`_
List of beta determinants of psi_det
`psi_det_beta_unique <http://github.com/LCPQ/quantum_package/tree/master/src/Dets/determinants.irp.f#L384>`_
Unique beta determinants
`psi_det_size <http://github.com/LCPQ/quantum_package/tree/master/src/Dets/determinants.irp.f#L47>`_ `psi_det_size <http://github.com/LCPQ/quantum_package/tree/master/src/Dets/determinants.irp.f#L47>`_
Size of the psi_det/psi_coef arrays Size of the psi_det/psi_coef arrays
`psi_det_sorted <http://github.com/LCPQ/quantum_package/tree/master/src/Dets/determinants.irp.f#L430>`_ `psi_det_sorted <http://github.com/LCPQ/quantum_package/tree/master/src/Dets/determinants.irp.f#L304>`_
Wave function sorted by determinants contribution to the norm (state-averaged) Wave function sorted by determinants contribution to the norm (state-averaged)
`psi_det_sorted_ab <http://github.com/LCPQ/quantum_package/tree/master/src/Dets/determinants.irp.f#L578>`_ `psi_det_sorted_ab <http://github.com/LCPQ/quantum_package/tree/master/src/Dets/determinants.irp.f#L452>`_
Determinants on which we apply <i|H|j>. Determinants on which we apply <i|H|j>.
They are sorted by the 3 highest electrons in the alpha part, They are sorted by the 3 highest electrons in the alpha part,
then by the 3 highest electrons in the beta part to accelerate then by the 3 highest electrons in the beta part to accelerate
the research of connected determinants. the research of connected determinants.
`psi_det_sorted_bit <http://github.com/LCPQ/quantum_package/tree/master/src/Dets/determinants.irp.f#L461>`_ `psi_det_sorted_bit <http://github.com/LCPQ/quantum_package/tree/master/src/Dets/determinants.irp.f#L335>`_
Determinants on which we apply <i|H|psi> for perturbation. Determinants on which we apply <i|H|psi> for perturbation.
They are sorted by determinants interpreted as integers. Useful They are sorted by determinants interpreted as integers. Useful
to accelerate the search of a random determinant in the wave to accelerate the search of a random determinant in the wave
function. function.
`psi_det_sorted_next_ab <http://github.com/LCPQ/quantum_package/tree/master/src/Dets/determinants.irp.f#L580>`_ `psi_det_sorted_next_ab <http://github.com/LCPQ/quantum_package/tree/master/src/Dets/determinants.irp.f#L454>`_
Determinants on which we apply <i|H|j>. Determinants on which we apply <i|H|j>.
They are sorted by the 3 highest electrons in the alpha part, They are sorted by the 3 highest electrons in the alpha part,
then by the 3 highest electrons in the beta part to accelerate then by the 3 highest electrons in the beta part to accelerate
the research of connected determinants. the research of connected determinants.
`psi_svd_alpha <http://github.com/LCPQ/quantum_package/tree/master/src/Dets/determinants.irp.f#L826>`_ `read_dets <http://github.com/LCPQ/quantum_package/tree/master/src/Dets/determinants.irp.f#L583>`_
SVD wave function
`psi_svd_beta <http://github.com/LCPQ/quantum_package/tree/master/src/Dets/determinants.irp.f#L827>`_
SVD wave function
`psi_svd_coefs <http://github.com/LCPQ/quantum_package/tree/master/src/Dets/determinants.irp.f#L828>`_
SVD wave function
`psi_svd_matrix <http://github.com/LCPQ/quantum_package/tree/master/src/Dets/determinants.irp.f#L709>`_
Matrix of wf coefficients. Outer product of alpha and beta determinants
`read_dets <http://github.com/LCPQ/quantum_package/tree/master/src/Dets/determinants.irp.f#L880>`_
Reads the determinants from the EZFIO file Reads the determinants from the EZFIO file
`save_wavefunction <http://github.com/LCPQ/quantum_package/tree/master/src/Dets/determinants.irp.f#L927>`_ `save_wavefunction <http://github.com/LCPQ/quantum_package/tree/master/src/Dets/determinants.irp.f#L630>`_
Save the wave function into the EZFIO file Save the wave function into the EZFIO file
`save_wavefunction_general <http://github.com/LCPQ/quantum_package/tree/master/src/Dets/determinants.irp.f#L946>`_ `save_wavefunction_general <http://github.com/LCPQ/quantum_package/tree/master/src/Dets/determinants.irp.f#L649>`_
Save the wave function into the EZFIO file Save the wave function into the EZFIO file
`save_wavefunction_unsorted <http://github.com/LCPQ/quantum_package/tree/master/src/Dets/determinants.irp.f#L937>`_ `save_wavefunction_unsorted <http://github.com/LCPQ/quantum_package/tree/master/src/Dets/determinants.irp.f#L640>`_
Save the wave function into the EZFIO file Save the wave function into the EZFIO file
`sort_dets_by_3_highest_electrons <http://github.com/LCPQ/quantum_package/tree/master/src/Dets/determinants.irp.f#L600>`_ `sort_dets_by_3_highest_electrons <http://github.com/LCPQ/quantum_package/tree/master/src/Dets/determinants.irp.f#L474>`_
Determinants on which we apply <i|H|j>. Determinants on which we apply <i|H|j>.
They are sorted by the 3 highest electrons in the alpha part, They are sorted by the 3 highest electrons in the alpha part,
then by the 3 highest electrons in the beta part to accelerate then by the 3 highest electrons in the beta part to accelerate
the research of connected determinants. the research of connected determinants.
`sort_dets_by_det_search_key <http://github.com/LCPQ/quantum_package/tree/master/src/Dets/determinants.irp.f#L475>`_ `sort_dets_by_det_search_key <http://github.com/LCPQ/quantum_package/tree/master/src/Dets/determinants.irp.f#L349>`_
Determinants are sorted are sorted according to their det_search_key. Determinants are sorted are sorted according to their det_search_key.
Useful to accelerate the search of a random determinant in the wave Useful to accelerate the search of a random determinant in the wave
function. function.
`spin_det_search_key <http://github.com/LCPQ/quantum_package/tree/master/src/Dets/determinants.irp.f#L303>`_
Return an integer*8 corresponding to a determinant index for searching
`double_exc_bitmask <http://github.com/LCPQ/quantum_package/tree/master/src/Dets/determinants_bitmasks.irp.f#L40>`_ `double_exc_bitmask <http://github.com/LCPQ/quantum_package/tree/master/src/Dets/determinants_bitmasks.irp.f#L40>`_
double_exc_bitmask(:,1,i) is the bitmask for holes of excitation 1 double_exc_bitmask(:,1,i) is the bitmask for holes of excitation 1
double_exc_bitmask(:,2,i) is the bitmask for particles of excitation 1 double_exc_bitmask(:,2,i) is the bitmask for particles of excitation 1
@ -675,7 +629,61 @@ Documentation
`n_con_int <http://github.com/LCPQ/quantum_package/tree/master/src/Dets/slater_rules.irp.f#L1131>`_ `n_con_int <http://github.com/LCPQ/quantum_package/tree/master/src/Dets/slater_rules.irp.f#L1131>`_
Number of integers to represent the connections between determinants Number of integers to represent the connections between determinants
`write_spindeterminants <http://github.com/LCPQ/quantum_package/tree/master/src/Dets/spindeterminants.irp.f#L1>`_ `create_wf_of_psi_svd_matrix <http://github.com/LCPQ/quantum_package/tree/master/src/Dets/spindeterminants.irp.f#L473>`_
Matrix of wf coefficients. Outer product of alpha and beta determinants
`generate_all_alpha_beta_det_products <http://github.com/LCPQ/quantum_package/tree/master/src/Dets/spindeterminants.irp.f#L528>`_
Create a wave function from all possible alpha x beta determinants
`get_index_in_psi_det_alpha_unique <http://github.com/LCPQ/quantum_package/tree/master/src/Dets/spindeterminants.irp.f#L131>`_
Returns the index of the determinant in the ``psi_det_alpha_unique`` array
`get_index_in_psi_det_beta_unique <http://github.com/LCPQ/quantum_package/tree/master/src/Dets/spindeterminants.irp.f#L212>`_
Returns the index of the determinant in the ``psi_det_beta_unique`` array
`n_det_alpha_unique <http://github.com/LCPQ/quantum_package/tree/master/src/Dets/spindeterminants.irp.f#L54>`_
Unique alpha determinants
`n_det_beta_unique <http://github.com/LCPQ/quantum_package/tree/master/src/Dets/spindeterminants.irp.f#L91>`_
Unique beta determinants
`psi_det_alpha <http://github.com/LCPQ/quantum_package/tree/master/src/Dets/spindeterminants.irp.f#L25>`_
List of alpha determinants of psi_det
`psi_det_alpha_unique <http://github.com/LCPQ/quantum_package/tree/master/src/Dets/spindeterminants.irp.f#L53>`_
Unique alpha determinants
`psi_det_beta <http://github.com/LCPQ/quantum_package/tree/master/src/Dets/spindeterminants.irp.f#L39>`_
List of beta determinants of psi_det
`psi_det_beta_unique <http://github.com/LCPQ/quantum_package/tree/master/src/Dets/spindeterminants.irp.f#L90>`_
Unique beta determinants
`psi_svd_alpha <http://github.com/LCPQ/quantum_package/tree/master/src/Dets/spindeterminants.irp.f#L568>`_
SVD wave function
`psi_svd_beta <http://github.com/LCPQ/quantum_package/tree/master/src/Dets/spindeterminants.irp.f#L569>`_
SVD wave function
`psi_svd_coefs <http://github.com/LCPQ/quantum_package/tree/master/src/Dets/spindeterminants.irp.f#L570>`_
SVD wave function
`psi_svd_matrix <http://github.com/LCPQ/quantum_package/tree/master/src/Dets/spindeterminants.irp.f#L457>`_
Matrix of wf coefficients. Outer product of alpha and beta determinants
`psi_svd_matrix_columns <http://github.com/LCPQ/quantum_package/tree/master/src/Dets/spindeterminants.irp.f#L398>`_
Matrix of wf coefficients. Outer product of alpha and beta determinants
`psi_svd_matrix_rows <http://github.com/LCPQ/quantum_package/tree/master/src/Dets/spindeterminants.irp.f#L397>`_
Matrix of wf coefficients. Outer product of alpha and beta determinants
`psi_svd_matrix_values <http://github.com/LCPQ/quantum_package/tree/master/src/Dets/spindeterminants.irp.f#L396>`_
Matrix of wf coefficients. Outer product of alpha and beta determinants
`spin_det_search_key <http://github.com/LCPQ/quantum_package/tree/master/src/Dets/spindeterminants.irp.f#L9>`_
Return an integer*8 corresponding to a determinant index for searching
`write_spindeterminants <http://github.com/LCPQ/quantum_package/tree/master/src/Dets/spindeterminants.irp.f#L294>`_
Undocumented Undocumented
`cisd <http://github.com/LCPQ/quantum_package/tree/master/src/Dets/truncate_wf.irp.f#L1>`_ `cisd <http://github.com/LCPQ/quantum_package/tree/master/src/Dets/truncate_wf.irp.f#L1>`_

View File

@ -162,7 +162,7 @@ integer function connected_to_ref(key,keys,Nint,N_past_in,Ndet)
integer :: N_past integer :: N_past
integer :: i, l integer :: i, l
integer :: degree_x2 integer :: degree_x2
logical :: det_is_not_or_may_be_in_ref, t logical :: t
double precision :: hij_elec double precision :: hij_elec
! output : 0 : not connected ! output : 0 : not connected
@ -260,7 +260,7 @@ integer function connected_to_ref_by_mono(key,keys,Nint,N_past_in,Ndet)
integer :: N_past integer :: N_past
integer :: i, l integer :: i, l
integer :: degree_x2 integer :: degree_x2
logical :: det_is_not_or_may_be_in_ref, t logical :: t
double precision :: hij_elec double precision :: hij_elec
! output : 0 : not connected ! output : 0 : not connected
@ -355,66 +355,3 @@ integer function connected_to_ref_by_mono(key,keys,Nint,N_past_in,Ndet)
end end
logical function det_is_not_or_may_be_in_ref(key,Nint)
use bitmasks
implicit none
BEGIN_DOC
! If true, det is not in ref
! If false, det may be in ref
END_DOC
integer, intent(in) :: Nint
integer(bit_kind), intent(in) :: key(Nint,2)
integer(bit_kind) :: key_int
integer*1 :: key_short(bit_kind)
!DIR$ ATTRIBUTES ALIGN : 32 :: key_short
equivalence (key_int,key_short)
integer :: i, ispin, k
det_is_not_or_may_be_in_ref = .False.
do ispin=1,2
do i=1,Nint
key_int = key(i,ispin)
do k=1,bit_kind
det_is_not_or_may_be_in_ref = &
det_is_not_or_may_be_in_ref .or. &
key_pattern_not_in_ref(key_short(k), i, ispin)
enddo
if(det_is_not_or_may_be_in_ref) then
return
endif
enddo
enddo
end
BEGIN_PROVIDER [ logical, key_pattern_not_in_ref, (-128:127,N_int,2) ]
use bitmasks
implicit none
BEGIN_DOC
! Min and max values of the integers of the keys of the reference
END_DOC
integer :: i, j, ispin
integer(bit_kind) :: key
integer*1 :: key_short(bit_kind)
equivalence (key,key_short)
integer :: idx, k
key_pattern_not_in_ref = .True.
do j=1,N_det
do ispin=1,2
do i=1,N_int
key = psi_det(i,ispin,j)
do k=1,bit_kind
key_pattern_not_in_ref( key_short(k), i, ispin ) = .False.
enddo
enddo
enddo
enddo
END_PROVIDER

View File

@ -294,132 +294,6 @@ END_PROVIDER
!==============================================================================!
! !
! Independent alpha/beta parts !
! !
!==============================================================================!
integer*8 function spin_det_search_key(det,Nint)
use bitmasks
implicit none
BEGIN_DOC
! Return an integer*8 corresponding to a determinant index for searching
END_DOC
integer, intent(in) :: Nint
integer(bit_kind), intent(in) :: det(Nint)
integer :: i
spin_det_search_key = det(1)
do i=2,Nint
spin_det_search_key = ieor(spin_det_search_key,det(i))
enddo
end
BEGIN_PROVIDER [ integer(bit_kind), psi_det_alpha, (N_int,psi_det_size) ]
implicit none
BEGIN_DOC
! List of alpha determinants of psi_det
END_DOC
integer :: i,k
do i=1,N_det
do k=1,N_int
psi_det_alpha(k,i) = psi_det(k,1,i)
enddo
enddo
END_PROVIDER
BEGIN_PROVIDER [ integer(bit_kind), psi_det_beta, (N_int,psi_det_size) ]
implicit none
BEGIN_DOC
! List of beta determinants of psi_det
END_DOC
integer :: i,k
do i=1,N_det
do k=1,N_int
psi_det_beta(k,i) = psi_det(k,2,i)
enddo
enddo
END_PROVIDER
BEGIN_PROVIDER [ integer(bit_kind), psi_det_alpha_unique, (N_int,psi_det_size) ]
&BEGIN_PROVIDER [ integer, N_det_alpha_unique ]
implicit none
BEGIN_DOC
! Unique alpha determinants
END_DOC
integer :: i,k
integer, allocatable :: iorder(:)
integer*8, allocatable :: bit_tmp(:)
integer*8 :: last_key
integer*8, external :: spin_det_search_key
allocate ( iorder(N_det), bit_tmp(N_det))
do i=1,N_det
iorder(i) = i
bit_tmp(i) = spin_det_search_key(psi_det_alpha(1,i),N_int)
enddo
call i8sort(bit_tmp,iorder,N_det)
N_det_alpha_unique = 0
last_key = 0_8
do i=1,N_det
if (bit_tmp(i) /= last_key) then
last_key = bit_tmp(i)
N_det_alpha_unique += 1
do k=1,N_int
psi_det_alpha_unique(k,N_det_alpha_unique) = psi_det_alpha(k,iorder(i))
enddo
endif
enddo
deallocate (iorder, bit_tmp)
END_PROVIDER
BEGIN_PROVIDER [ integer(bit_kind), psi_det_beta_unique, (N_int,psi_det_size) ]
&BEGIN_PROVIDER [ integer, N_det_beta_unique ]
implicit none
BEGIN_DOC
! Unique beta determinants
END_DOC
integer :: i,k
integer, allocatable :: iorder(:)
integer*8, allocatable :: bit_tmp(:)
integer*8 :: last_key
integer*8, external :: spin_det_search_key
allocate ( iorder(N_det), bit_tmp(N_det))
do i=1,N_det
iorder(i) = i
bit_tmp(i) = spin_det_search_key(psi_det_beta(1,i),N_int)
enddo
call i8sort(bit_tmp,iorder,N_det)
N_det_beta_unique = 0
last_key = 0_8
do i=1,N_det
if (bit_tmp(i) /= last_key) then
last_key = bit_tmp(i)
N_det_beta_unique += 1
do k=1,N_int
psi_det_beta_unique(k,N_det_beta_unique) = psi_det_beta(k,iorder(i))
enddo
endif
enddo
deallocate (iorder, bit_tmp)
END_PROVIDER
!==============================================================================! !==============================================================================!
! ! ! !
! Sorting providers ! ! Sorting providers !
@ -700,177 +574,6 @@ subroutine sort_dets_by_3_highest_electrons(det_in,coef_in,det_out,coef_out, &
end end
!==============================================================================!
! !
! Alpha x Beta Matrix !
! !
!==============================================================================!
BEGIN_PROVIDER [ double precision, psi_svd_matrix, (N_det_alpha_unique,N_det_beta_unique,N_states) ]
use bitmasks
implicit none
BEGIN_DOC
! Matrix of wf coefficients. Outer product of alpha and beta determinants
END_DOC
integer :: i,j,k
integer(bit_kind) :: tmp_det(N_int,2)
integer :: idx
integer, external :: get_index_in_psi_det_sorted_bit
logical, external :: is_in_wavefunction
psi_svd_matrix = 0.d0
do j=1,N_det_beta_unique
do k=1,N_int
tmp_det(k,2) = psi_det_beta_unique(k,j)
enddo
do i=1,N_det_alpha_unique
do k=1,N_int
tmp_det(k,1) = psi_det_alpha_unique(k,i)
enddo
idx = get_index_in_psi_det_sorted_bit(tmp_det,N_int)
if (idx > 0) then
do k=1,N_states
psi_svd_matrix(i,j,k) = psi_coef_sorted_bit(idx,k)
enddo
endif
enddo
enddo
END_PROVIDER
subroutine create_wf_of_psi_svd_matrix
use bitmasks
implicit none
BEGIN_DOC
! Matrix of wf coefficients. Outer product of alpha and beta determinants
END_DOC
integer :: i,j,k
integer(bit_kind) :: tmp_det(N_int,2)
integer :: idx
integer, external :: get_index_in_psi_det_sorted_bit
logical, external :: is_in_wavefunction
double precision :: norm(N_states)
call generate_all_alpha_beta_det_products
norm = 0.d0
do j=1,N_det_beta_unique
do k=1,N_int
tmp_det(k,2) = psi_det_beta_unique(k,j)
enddo
do i=1,N_det_alpha_unique
do k=1,N_int
tmp_det(k,1) = psi_det_alpha_unique(k,i)
enddo
idx = get_index_in_psi_det_sorted_bit(tmp_det,N_int)
if (idx > 0) then
do k=1,N_states
psi_coef_sorted_bit(idx,k) = psi_svd_matrix(i,j,k)
norm(k) += psi_svd_matrix(i,j,k)
enddo
endif
enddo
enddo
do k=1,N_states
norm(k) = 1.d0/dsqrt(norm(k))
do i=1,N_det
psi_coef_sorted_bit(i,k) = psi_coef_sorted_bit(i,k)*norm(k)
enddo
enddo
psi_det = psi_det_sorted_bit
psi_coef = psi_coef_sorted_bit
TOUCH psi_det psi_coef
psi_det = psi_det_sorted
psi_coef = psi_coef_sorted
norm(1) = 0.d0
do i=1,N_det
norm(1) += psi_average_norm_contrib_sorted(i)
if (norm(1) >= 0.999999d0) then
exit
endif
enddo
N_det = min(i,N_det)
SOFT_TOUCH psi_det psi_coef N_det
end
subroutine generate_all_alpha_beta_det_products
implicit none
BEGIN_DOC
! Create a wave function from all possible alpha x beta determinants
END_DOC
integer :: i,j,k,l
integer :: idx
integer, external :: get_index_in_psi_det_sorted_bit
integer(bit_kind), allocatable :: tmp_det(:,:,:)
logical, external :: is_in_wavefunction
allocate (tmp_det(N_int,2,N_det_alpha_unique))
do j=1,N_det_beta_unique
l = 1
do i=1,N_det_alpha_unique
do k=1,N_int
tmp_det(k,1,l) = psi_det_alpha_unique(k,i)
tmp_det(k,2,l) = psi_det_beta_unique (k,j)
enddo
if (.not.is_in_wavefunction(tmp_det(1,1,l),N_int,N_det)) then
l = l+1
endif
enddo
call fill_H_apply_buffer_no_selection(l-1, tmp_det, N_int, 1)
enddo
deallocate (tmp_det)
call copy_H_apply_buffer_to_wf
SOFT_TOUCH psi_det psi_coef N_det
end
BEGIN_PROVIDER [ double precision, psi_svd_alpha, (N_det_alpha_unique,N_det_alpha_unique,N_states) ]
&BEGIN_PROVIDER [ double precision, psi_svd_beta , (N_det_beta_unique,N_det_beta_unique,N_states) ]
&BEGIN_PROVIDER [ double precision, psi_svd_coefs, (N_det_beta_unique,N_states) ]
implicit none
BEGIN_DOC
! SVD wave function
END_DOC
integer :: lwork, info, istate
double precision, allocatable :: work(:), tmp(:,:), copy(:,:)
allocate (work(1),tmp(N_det_beta_unique,N_det_beta_unique), &
copy(size(psi_svd_matrix,1),size(psi_svd_matrix,2)))
do istate = 1,N_states
copy(:,:) = psi_svd_matrix(:,:,istate)
lwork=-1
call dgesvd('A','A', N_det_alpha_unique, N_det_beta_unique, &
copy, size(copy,1), &
psi_svd_coefs(1,istate), psi_svd_alpha(1,1,istate), &
size(psi_svd_alpha,1), &
tmp, size(psi_svd_beta,2), &
work, lwork, info)
lwork = work(1)
deallocate(work)
allocate(work(lwork))
call dgesvd('A','A', N_det_alpha_unique, N_det_beta_unique, &
copy, size(copy,1), &
psi_svd_coefs(1,istate), psi_svd_alpha(1,1,istate), &
size(psi_svd_alpha,1), &
tmp, size(psi_svd_beta,2), &
work, lwork, info)
deallocate(work)
if (info /= 0) then
print *, irp_here//': error in det SVD'
stop 1
endif
integer :: i,j
do j=1,N_det_beta_unique
do i=1,N_det_beta_unique
psi_svd_beta(i,j,istate) = tmp(j,i)
enddo
enddo
deallocate(tmp,copy)
enddo
END_PROVIDER
!==============================================================================! !==============================================================================!
! ! ! !
! Read/write routines ! ! Read/write routines !

View File

@ -1,12 +1,15 @@
spindeterminants spindeterminants
n_det_alpha integer n_det_alpha integer
n_det_beta integer n_det_beta integer
n_det integer
n_int integer n_int integer
bit_kind integer bit_kind integer
n_states integer n_states integer
psi_det_alpha integer*8 (spindeterminants_n_int*spindeterminants_bit_kind/8,spindeterminants_n_det_alpha) psi_det_alpha integer*8 (spindeterminants_n_int*spindeterminants_bit_kind/8,spindeterminants_n_det_alpha)
psi_det_beta integer*8 (spindeterminants_n_int*spindeterminants_bit_kind/8,spindeterminants_n_det_beta) psi_det_beta integer*8 (spindeterminants_n_int*spindeterminants_bit_kind/8,spindeterminants_n_det_beta)
psi_coef_matrix double precision (spindeterminants_n_det_alpha,spindeterminants_n_det_beta,spindeterminants_n_states) psi_coef_matrix_rows integer (spindeterminants_n_det)
psi_coef_matrix_columns integer (spindeterminants_n_det)
psi_coef_matrix_values double precision (spindeterminants_n_det,spindeterminants_n_states)
n_svd_coefs integer n_svd_coefs integer
psi_svd_alpha double precision (spindeterminants_n_det_alpha,spindeterminants_n_svd_coefs,spindeterminants_n_states) psi_svd_alpha double precision (spindeterminants_n_det_alpha,spindeterminants_n_svd_coefs,spindeterminants_n_states)
psi_svd_beta double precision (spindeterminants_n_det_beta,spindeterminants_n_svd_coefs,spindeterminants_n_states) psi_svd_beta double precision (spindeterminants_n_det_beta,spindeterminants_n_svd_coefs,spindeterminants_n_states)

View File

@ -1,3 +1,296 @@
!==============================================================================!
! !
! Independent alpha/beta parts !
! !
!==============================================================================!
use bitmasks
integer*8 function spin_det_search_key(det,Nint)
use bitmasks
implicit none
BEGIN_DOC
! Return an integer*8 corresponding to a determinant index for searching
END_DOC
integer, intent(in) :: Nint
integer(bit_kind), intent(in) :: det(Nint)
integer :: i
spin_det_search_key = det(1)
do i=2,Nint
spin_det_search_key = ieor(spin_det_search_key,det(i))
enddo
end
BEGIN_PROVIDER [ integer(bit_kind), psi_det_alpha, (N_int,psi_det_size) ]
implicit none
BEGIN_DOC
! List of alpha determinants of psi_det
END_DOC
integer :: i,k
do i=1,N_det
do k=1,N_int
psi_det_alpha(k,i) = psi_det(k,1,i)
enddo
enddo
END_PROVIDER
BEGIN_PROVIDER [ integer(bit_kind), psi_det_beta, (N_int,psi_det_size) ]
implicit none
BEGIN_DOC
! List of beta determinants of psi_det
END_DOC
integer :: i,k
do i=1,N_det
do k=1,N_int
psi_det_beta(k,i) = psi_det(k,2,i)
enddo
enddo
END_PROVIDER
BEGIN_PROVIDER [ integer(bit_kind), psi_det_alpha_unique, (N_int,psi_det_size) ]
&BEGIN_PROVIDER [ integer, N_det_alpha_unique ]
implicit none
BEGIN_DOC
! Unique alpha determinants
END_DOC
integer :: i,k
integer, allocatable :: iorder(:)
integer*8, allocatable :: bit_tmp(:)
integer*8 :: last_key
integer*8, external :: spin_det_search_key
allocate ( iorder(N_det), bit_tmp(N_det))
do i=1,N_det
iorder(i) = i
bit_tmp(i) = spin_det_search_key(psi_det_alpha(1,i),N_int)
enddo
call i8sort(bit_tmp,iorder,N_det)
N_det_alpha_unique = 0
last_key = 0_8
do i=1,N_det
if (bit_tmp(i) /= last_key) then
last_key = bit_tmp(i)
N_det_alpha_unique += 1
do k=1,N_int
psi_det_alpha_unique(k,N_det_alpha_unique) = psi_det_alpha(k,iorder(i))
enddo
endif
enddo
deallocate (iorder, bit_tmp)
END_PROVIDER
BEGIN_PROVIDER [ integer(bit_kind), psi_det_beta_unique, (N_int,psi_det_size) ]
&BEGIN_PROVIDER [ integer, N_det_beta_unique ]
implicit none
BEGIN_DOC
! Unique beta determinants
END_DOC
integer :: i,k
integer, allocatable :: iorder(:)
integer*8, allocatable :: bit_tmp(:)
integer*8 :: last_key
integer*8, external :: spin_det_search_key
allocate ( iorder(N_det), bit_tmp(N_det))
do i=1,N_det
iorder(i) = i
bit_tmp(i) = spin_det_search_key(psi_det_beta(1,i),N_int)
enddo
call i8sort(bit_tmp,iorder,N_det)
N_det_beta_unique = 0
last_key = 0_8
do i=1,N_det
if (bit_tmp(i) /= last_key) then
last_key = bit_tmp(i)
N_det_beta_unique += 1
do k=1,N_int
psi_det_beta_unique(k,N_det_beta_unique) = psi_det_beta(k,iorder(i))
enddo
endif
enddo
deallocate (iorder, bit_tmp)
END_PROVIDER
integer function get_index_in_psi_det_alpha_unique(key,Nint)
use bitmasks
BEGIN_DOC
! Returns the index of the determinant in the ``psi_det_alpha_unique`` array
END_DOC
implicit none
integer, intent(in) :: Nint
integer(bit_kind), intent(in) :: key(Nint)
integer :: i, ibegin, iend, istep, l
integer*8 :: det_ref, det_search
integer*8, external :: spin_det_search_key
logical :: is_in_wavefunction
is_in_wavefunction = .False.
get_index_in_psi_det_alpha_unique = 0
ibegin = 1
iend = N_det_alpha_unique + 1
!DIR$ FORCEINLINE
det_ref = spin_det_search_key(key,Nint)
!DIR$ FORCEINLINE
det_search = spin_det_search_key(psi_det_alpha_unique(1,1),Nint)
istep = ishft(iend-ibegin,-1)
i=ibegin+istep
do while (istep > 0)
!DIR$ FORCEINLINE
det_search = spin_det_search_key(psi_det_alpha_unique(1,i),Nint)
if ( det_search > det_ref ) then
iend = i
else if ( det_search == det_ref ) then
exit
else
ibegin = i
endif
istep = ishft(iend-ibegin,-1)
i = ibegin + istep
end do
!DIR$ FORCEINLINE
do while (spin_det_search_key(psi_det_alpha_unique(1,i),Nint) == det_ref)
i = i-1
if (i == 0) then
exit
endif
enddo
i += 1
if (i > N_det_alpha_unique) then
return
endif
!DIR$ FORCEINLINE
do while (spin_det_search_key(psi_det_alpha_unique(1,i),Nint) == det_ref)
if (key(1) /= psi_det_alpha_unique(1,i)) then
continue
else
is_in_wavefunction = .True.
!DIR$ IVDEP
!DIR$ LOOP COUNT MIN(3)
do l=2,Nint
if (key(l) /= psi_det_alpha_unique(l,i)) then
is_in_wavefunction = .False.
endif
enddo
if (is_in_wavefunction) then
get_index_in_psi_det_alpha_unique = i
return
endif
endif
i += 1
if (i > N_det_alpha_unique) then
return
endif
enddo
end
integer function get_index_in_psi_det_beta_unique(key,Nint)
use bitmasks
BEGIN_DOC
! Returns the index of the determinant in the ``psi_det_beta_unique`` array
END_DOC
implicit none
integer, intent(in) :: Nint
integer(bit_kind), intent(in) :: key(Nint)
integer :: i, ibegin, iend, istep, l
integer*8 :: det_ref, det_search
integer*8, external :: spin_det_search_key
logical :: is_in_wavefunction
is_in_wavefunction = .False.
get_index_in_psi_det_beta_unique = 0
ibegin = 1
iend = N_det_beta_unique + 1
!DIR$ FORCEINLINE
det_ref = spin_det_search_key(key,Nint)
!DIR$ FORCEINLINE
det_search = spin_det_search_key(psi_det_beta_unique(1,1),Nint)
istep = ishft(iend-ibegin,-1)
i=ibegin+istep
do while (istep > 0)
!DIR$ FORCEINLINE
det_search = spin_det_search_key(psi_det_beta_unique(1,i),Nint)
if ( det_search > det_ref ) then
iend = i
else if ( det_search == det_ref ) then
exit
else
ibegin = i
endif
istep = ishft(iend-ibegin,-1)
i = ibegin + istep
end do
!DIR$ FORCEINLINE
do while (spin_det_search_key(psi_det_beta_unique(1,i),Nint) == det_ref)
i = i-1
if (i == 0) then
exit
endif
enddo
i += 1
if (i > N_det_beta_unique) then
return
endif
!DIR$ FORCEINLINE
do while (spin_det_search_key(psi_det_beta_unique(1,i),Nint) == det_ref)
if (key(1) /= psi_det_beta_unique(1,i)) then
continue
else
is_in_wavefunction = .True.
!DIR$ IVDEP
!DIR$ LOOP COUNT MIN(3)
do l=2,Nint
if (key(l) /= psi_det_beta_unique(l,i)) then
is_in_wavefunction = .False.
endif
enddo
if (is_in_wavefunction) then
get_index_in_psi_det_beta_unique = i
return
endif
endif
i += 1
if (i > N_det_beta_unique) then
return
endif
enddo
end
subroutine write_spindeterminants subroutine write_spindeterminants
use bitmasks use bitmasks
implicit none implicit none
@ -11,6 +304,7 @@ subroutine write_spindeterminants
N_int2 = (N_int*bit_kind)/8 N_int2 = (N_int*bit_kind)/8
call ezfio_set_spindeterminants_n_det_alpha(N_det_alpha_unique) call ezfio_set_spindeterminants_n_det_alpha(N_det_alpha_unique)
call ezfio_set_spindeterminants_n_det_beta(N_det_beta_unique) call ezfio_set_spindeterminants_n_det_beta(N_det_beta_unique)
call ezfio_set_spindeterminants_n_det(N_det)
call ezfio_set_spindeterminants_n_int(N_int) call ezfio_set_spindeterminants_n_int(N_int)
call ezfio_set_spindeterminants_bit_kind(bit_kind) call ezfio_set_spindeterminants_bit_kind(bit_kind)
call ezfio_set_spindeterminants_n_states(N_states) call ezfio_set_spindeterminants_n_states(N_states)
@ -39,7 +333,9 @@ subroutine write_spindeterminants
call ezfio_set_spindeterminants_psi_det_beta(psi_det_beta_unique) call ezfio_set_spindeterminants_psi_det_beta(psi_det_beta_unique)
deallocate(tmpdet) deallocate(tmpdet)
call ezfio_set_spindeterminants_psi_coef_matrix(psi_svd_matrix) call ezfio_set_spindeterminants_psi_coef_matrix_values(psi_svd_matrix_values)
call ezfio_set_spindeterminants_psi_coef_matrix_rows(psi_svd_matrix_rows)
call ezfio_set_spindeterminants_psi_coef_matrix_columns(psi_svd_matrix_columns)
integer :: n_svd_coefs integer :: n_svd_coefs
double precision :: norm, f double precision :: norm, f
@ -49,7 +345,7 @@ subroutine write_spindeterminants
do k=1,N_states do k=1,N_states
norm -= psi_svd_coefs(n_svd_coefs,k)*psi_svd_coefs(n_svd_coefs,k) norm -= psi_svd_coefs(n_svd_coefs,k)*psi_svd_coefs(n_svd_coefs,k)
enddo enddo
if (norm < 1.d-6) then if (norm < 1.d-4) then
exit exit
endif endif
enddo enddo
@ -89,3 +385,231 @@ subroutine write_spindeterminants
deallocate(dtmp) deallocate(dtmp)
end end
!==============================================================================!
! !
! Alpha x Beta Matrix !
! !
!==============================================================================!
BEGIN_PROVIDER [ double precision, psi_svd_matrix_values, (N_det,N_states) ]
&BEGIN_PROVIDER [ integer, psi_svd_matrix_rows, (N_det) ]
&BEGIN_PROVIDER [ integer, psi_svd_matrix_columns, (N_det) ]
use bitmasks
implicit none
BEGIN_DOC
! Matrix of wf coefficients. Outer product of alpha and beta determinants
END_DOC
integer :: i,j,k, l
integer(bit_kind) :: tmp_det(N_int,2)
integer :: idx
integer, external :: get_index_in_psi_det_sorted_bit
logical, external :: is_in_wavefunction
PROVIDE psi_coef_sorted_bit
! l=0
! do j=1,N_det_beta_unique
! do k=1,N_int
! tmp_det(k,2) = psi_det_beta_unique(k,j)
! enddo
! do i=1,N_det_alpha_unique
! do k=1,N_int
! tmp_det(k,1) = psi_det_alpha_unique(k,i)
! enddo
! idx = get_index_in_psi_det_sorted_bit(tmp_det,N_int)
! if (idx > 0) then
! l += 1
! psi_svd_matrix_rows(l) = i
! psi_svd_matrix_columns(l) = j
! do k=1,N_states
! psi_svd_matrix_values(l,k) = psi_coef_sorted_bit(idx,k)
! enddo
! endif
! enddo
! enddo
! ASSERT (l == N_det)
integer, allocatable :: iorder(:), to_sort(:)
integer, external :: get_index_in_psi_det_alpha_unique
integer, external :: get_index_in_psi_det_beta_unique
allocate(iorder(N_det), to_sort(N_det))
do k=1,N_det
i = get_index_in_psi_det_alpha_unique(psi_det(1,1,k),N_int)
j = get_index_in_psi_det_beta_unique (psi_det(1,2,k),N_int)
do l=1,N_states
psi_svd_matrix_values(k,l) = psi_coef(k,l)
enddo
psi_svd_matrix_rows(k) = i
psi_svd_matrix_columns(k) = j
to_sort(k) = N_det_alpha_unique * (j-1) + i
iorder(k) = k
enddo
call isort(to_sort, iorder, N_det)
call iset_order(psi_svd_matrix_rows,iorder,N_det)
call iset_order(psi_svd_matrix_columns,iorder,N_det)
call dset_order(psi_svd_matrix_values,iorder,N_det)
deallocate(iorder,to_sort)
END_PROVIDER
BEGIN_PROVIDER [ double precision, psi_svd_matrix, (N_det_alpha_unique,N_det_beta_unique,N_states) ]
implicit none
BEGIN_DOC
! Matrix of wf coefficients. Outer product of alpha and beta determinants
END_DOC
integer :: i,j,k,istate
psi_svd_matrix = 0.d0
do k=1,N_det
i = psi_svd_matrix_rows(k)
j = psi_svd_matrix_columns(k)
do istate=1,N_states
psi_svd_matrix(i,j,istate) = psi_svd_matrix_values(k,istate)
enddo
enddo
END_PROVIDER
subroutine create_wf_of_psi_svd_matrix
use bitmasks
implicit none
BEGIN_DOC
! Matrix of wf coefficients. Outer product of alpha and beta determinants
END_DOC
integer :: i,j,k
integer(bit_kind) :: tmp_det(N_int,2)
integer :: idx
integer, external :: get_index_in_psi_det_sorted_bit
logical, external :: is_in_wavefunction
double precision :: norm(N_states)
call generate_all_alpha_beta_det_products
norm = 0.d0
do j=1,N_det_beta_unique
do k=1,N_int
tmp_det(k,2) = psi_det_beta_unique(k,j)
enddo
do i=1,N_det_alpha_unique
do k=1,N_int
tmp_det(k,1) = psi_det_alpha_unique(k,i)
enddo
idx = get_index_in_psi_det_sorted_bit(tmp_det,N_int)
if (idx > 0) then
do k=1,N_states
psi_coef_sorted_bit(idx,k) = psi_svd_matrix(i,j,k)
norm(k) += psi_svd_matrix(i,j,k)
enddo
endif
enddo
enddo
do k=1,N_states
norm(k) = 1.d0/dsqrt(norm(k))
do i=1,N_det
psi_coef_sorted_bit(i,k) = psi_coef_sorted_bit(i,k)*norm(k)
enddo
enddo
psi_det = psi_det_sorted_bit
psi_coef = psi_coef_sorted_bit
TOUCH psi_det psi_coef
psi_det = psi_det_sorted
psi_coef = psi_coef_sorted
norm(1) = 0.d0
do i=1,N_det
norm(1) += psi_average_norm_contrib_sorted(i)
if (norm(1) >= 0.999999d0) then
exit
endif
enddo
N_det = min(i,N_det)
SOFT_TOUCH psi_det psi_coef N_det
end
subroutine generate_all_alpha_beta_det_products
implicit none
BEGIN_DOC
! Create a wave function from all possible alpha x beta determinants
END_DOC
integer :: i,j,k,l
integer :: idx, iproc
integer, external :: get_index_in_psi_det_sorted_bit
integer(bit_kind), allocatable :: tmp_det(:,:,:)
logical, external :: is_in_wavefunction
integer, external :: omp_get_thread_num
!$OMP PARALLEL DEFAULT(NONE) SHARED(psi_coef_sorted_bit,N_det_beta_unique,&
!$OMP N_det_alpha_unique, N_int, psi_det_alpha_unique, psi_det_beta_unique,&
!$OMP N_det) &
!$OMP PRIVATE(i,j,k,l,tmp_det,idx,iproc)
!$ iproc = omp_get_thread_num()
allocate (tmp_det(N_int,2,N_det_alpha_unique))
!$OMP DO
do j=1,N_det_beta_unique
l = 1
do i=1,N_det_alpha_unique
do k=1,N_int
tmp_det(k,1,l) = psi_det_alpha_unique(k,i)
tmp_det(k,2,l) = psi_det_beta_unique (k,j)
enddo
if (.not.is_in_wavefunction(tmp_det(1,1,l),N_int,N_det)) then
l = l+1
endif
enddo
call fill_H_apply_buffer_no_selection(l-1, tmp_det, N_int, iproc)
enddo
!$OMP END DO NOWAIT
deallocate(tmp_det)
!$OMP END PARALLEL
deallocate (tmp_det)
call copy_H_apply_buffer_to_wf
SOFT_TOUCH psi_det psi_coef N_det
end
BEGIN_PROVIDER [ double precision, psi_svd_alpha, (N_det_alpha_unique,N_det_alpha_unique,N_states) ]
&BEGIN_PROVIDER [ double precision, psi_svd_beta , (N_det_beta_unique,N_det_beta_unique,N_states) ]
&BEGIN_PROVIDER [ double precision, psi_svd_coefs, (N_det_beta_unique,N_states) ]
implicit none
BEGIN_DOC
! SVD wave function
END_DOC
integer :: lwork, info, istate
double precision, allocatable :: work(:), tmp(:,:), copy(:,:)
allocate (work(1),tmp(N_det_beta_unique,N_det_beta_unique), &
copy(size(psi_svd_matrix,1),size(psi_svd_matrix,2)))
do istate = 1,N_states
copy(:,:) = psi_svd_matrix(:,:,istate)
lwork=-1
call dgesvd('A','A', N_det_alpha_unique, N_det_beta_unique, &
copy, size(copy,1), &
psi_svd_coefs(1,istate), psi_svd_alpha(1,1,istate), &
size(psi_svd_alpha,1), &
tmp, size(psi_svd_beta,2), &
work, lwork, info)
lwork = work(1)
deallocate(work)
allocate(work(lwork))
call dgesvd('A','A', N_det_alpha_unique, N_det_beta_unique, &
copy, size(copy,1), &
psi_svd_coefs(1,istate), psi_svd_alpha(1,1,istate), &
size(psi_svd_alpha,1), &
tmp, size(psi_svd_beta,2), &
work, lwork, info)
deallocate(work)
if (info /= 0) then
print *, irp_here//': error in det SVD'
stop 1
endif
integer :: i,j
do j=1,N_det_beta_unique
do i=1,N_det_beta_unique
psi_svd_beta(i,j,istate) = tmp(j,i)
enddo
enddo
deallocate(tmp,copy)
enddo
END_PROVIDER

View File

@ -1,30 +0,0 @@
OPENMP =1
PROFILE =0
DEBUG = 0
IRPF90_FLAGS+= --align=32
FC = ifort -g
FCFLAGS=
FCFLAGS+= -axAVX,SSE4.2
FCFLAGS+= -O2
FCFLAGS+= -ip
FCFLAGS+= -opt-prefetch
FCFLAGS+= -ftz
MKL=-mkl=parallel
ifeq ($(PROFILE),1)
FC += -p -g
CXX += -pg
endif
ifeq ($(OPENMP),1)
FC += -openmp
IRPF90_FLAGS += --openmp
CXX += -fopenmp
endif
ifeq ($(DEBUG),1)
FC += -C -traceback -fpe0
IRPF90_FLAGS += -a
#FCFLAGS =-O0
endif