From 0fb0b9e2ec49cd5247f4e9cec11f8c22d5980ee6 Mon Sep 17 00:00:00 2001 From: Anthony Scemama Date: Fri, 20 Jun 2014 15:23:04 +0200 Subject: [PATCH] Put do_mono/diexcitations in generate_h_apply.py --- scripts/generate_h_apply.py | 5 +- src/CID/H_apply.irp.f | 2 +- src/CID/README.rst | 2 +- src/CID/do_mono_double.irp.f | 19 --- src/CID_SC2_selected/H_apply.irp.f | 2 +- src/CID_SC2_selected/README.rst | 2 +- src/CID_SC2_selected/do_mono_double.irp.f | 19 --- src/CID_selected/H_apply.irp.f | 2 +- src/CID_selected/README.rst | 4 +- src/CID_selected/do_mono_double.irp.f | 19 --- src/CISD/do_mono_double.irp.f | 19 --- src/CISD_SC2_selected/do_mono_double.irp.f | 19 --- src/CISD_selected/do_mono_double.irp.f | 19 --- src/Dets/H_apply_template.f | 8 +- src/Dets/README.rst | 145 +++++++++++---------- src/MonoInts/NEEDED_MODULES | 2 +- src/MonoInts/README.rst | 1 + 17 files changed, 91 insertions(+), 198 deletions(-) delete mode 100644 src/CID/do_mono_double.irp.f delete mode 100644 src/CID_SC2_selected/do_mono_double.irp.f delete mode 100644 src/CID_selected/do_mono_double.irp.f delete mode 100644 src/CISD/do_mono_double.irp.f delete mode 100644 src/CISD_SC2_selected/do_mono_double.irp.f delete mode 100644 src/CISD_selected/do_mono_double.irp.f diff --git a/scripts/generate_h_apply.py b/scripts/generate_h_apply.py index a9d1c966..a57f869f 100755 --- a/scripts/generate_h_apply.py +++ b/scripts/generate_h_apply.py @@ -27,7 +27,7 @@ filter_integrals class H_apply(object): - def __init__(self,sub,SingleRef=False): + def __init__(self,sub,SingleRef=False,do_mono_exc=True, do_double_exc=True): s = {} for k in keywords: s[k] = "" @@ -56,6 +56,9 @@ class H_apply(object): s["omp_do"] = "!$OMP DO SCHEDULE (static)" s["omp_enddo"] = "!$OMP ENDDO NOWAIT" + d = { True : '.True.', False : '.False.'} + s["do_mono_excitations"] = d[do_mono_exc] + s["do_double_excitations"] = d[do_double_exc] s["keys_work"] += "call fill_H_apply_buffer_no_selection(key_idx,keys_out,N_int,iproc)" s["filter_integrals"] = "array_pairs = .True." diff --git a/src/CID/H_apply.irp.f b/src/CID/H_apply.irp.f index 0df1da38..6a1bb536 100644 --- a/src/CID/H_apply.irp.f +++ b/src/CID/H_apply.irp.f @@ -3,7 +3,7 @@ BEGIN_SHELL [ /usr/bin/env python ] from generate_h_apply import H_apply -H = H_apply("cisd") +H = H_apply("cisd",do_double_exc=True,do_mono_exc=False) print H END_SHELL diff --git a/src/CID/README.rst b/src/CID/README.rst index 003b51fa..5a0c5026 100644 --- a/src/CID/README.rst +++ b/src/CID/README.rst @@ -36,7 +36,7 @@ Documentation .. Do not edit this section. It was auto-generated from the .. NEEDED_MODULES file. -`cisd `_ +`cisd `_ Undocumented diff --git a/src/CID/do_mono_double.irp.f b/src/CID/do_mono_double.irp.f deleted file mode 100644 index f211879e..00000000 --- a/src/CID/do_mono_double.irp.f +++ /dev/null @@ -1,19 +0,0 @@ -BEGIN_PROVIDER [logical, do_double_excitations] - implicit none - BEGIN_DOC - ! if True then the double excitations are performed in the calculation - ! always true in the CISD - END_DOC - do_double_excitations = .True. - -END_PROVIDER - -BEGIN_PROVIDER [logical, do_mono_excitations] - implicit none - BEGIN_DOC - ! if True then the mono excitations are performed in the calculation - ! always true in the CISD - END_DOC - do_mono_excitations = .False. - -END_PROVIDER diff --git a/src/CID_SC2_selected/H_apply.irp.f b/src/CID_SC2_selected/H_apply.irp.f index 79668af7..e284ab43 100644 --- a/src/CID_SC2_selected/H_apply.irp.f +++ b/src/CID_SC2_selected/H_apply.irp.f @@ -3,7 +3,7 @@ BEGIN_SHELL [ /usr/bin/env python ] from generate_h_apply import * from perturbation import perturbations -s = H_apply("PT2",SingleRef=True) +s = H_apply("PT2",SingleRef=True,do_mono_exc=False,do_double_exc=True) s.set_perturbation("epstein_nesbet_sc2_projected") print s END_SHELL diff --git a/src/CID_SC2_selected/README.rst b/src/CID_SC2_selected/README.rst index b6206850..8688fd41 100644 --- a/src/CID_SC2_selected/README.rst +++ b/src/CID_SC2_selected/README.rst @@ -8,7 +8,7 @@ Documentation .. Do not edit this section. It was auto-generated from the .. NEEDED_MODULES file. -`cisd_sc2_selected `_ +`cisd_sc2_selected `_ Undocumented diff --git a/src/CID_SC2_selected/do_mono_double.irp.f b/src/CID_SC2_selected/do_mono_double.irp.f deleted file mode 100644 index f211879e..00000000 --- a/src/CID_SC2_selected/do_mono_double.irp.f +++ /dev/null @@ -1,19 +0,0 @@ -BEGIN_PROVIDER [logical, do_double_excitations] - implicit none - BEGIN_DOC - ! if True then the double excitations are performed in the calculation - ! always true in the CISD - END_DOC - do_double_excitations = .True. - -END_PROVIDER - -BEGIN_PROVIDER [logical, do_mono_excitations] - implicit none - BEGIN_DOC - ! if True then the mono excitations are performed in the calculation - ! always true in the CISD - END_DOC - do_mono_excitations = .False. - -END_PROVIDER diff --git a/src/CID_selected/H_apply.irp.f b/src/CID_selected/H_apply.irp.f index 91dfb9fc..e3afaa9d 100644 --- a/src/CID_selected/H_apply.irp.f +++ b/src/CID_selected/H_apply.irp.f @@ -4,7 +4,7 @@ from generate_h_apply import * from perturbation import perturbations for perturbation in perturbations: - s = H_apply("cisd_selection_"+perturbation) + s = H_apply("cisd_selection_"+perturbation,do_mono_exc=False) s.set_selection_pt2(perturbation) print s END_SHELL diff --git a/src/CID_selected/README.rst b/src/CID_selected/README.rst index 4fed26e5..8c64bc25 100644 --- a/src/CID_selected/README.rst +++ b/src/CID_selected/README.rst @@ -8,10 +8,10 @@ Documentation .. Do not edit this section. It was auto-generated from the .. NEEDED_MODULES file. -`h_apply_cisd_selection `_ +`h_apply_cisd_selection `_ Undocumented -`cisd `_ +`cisd `_ Undocumented diff --git a/src/CID_selected/do_mono_double.irp.f b/src/CID_selected/do_mono_double.irp.f deleted file mode 100644 index f211879e..00000000 --- a/src/CID_selected/do_mono_double.irp.f +++ /dev/null @@ -1,19 +0,0 @@ -BEGIN_PROVIDER [logical, do_double_excitations] - implicit none - BEGIN_DOC - ! if True then the double excitations are performed in the calculation - ! always true in the CISD - END_DOC - do_double_excitations = .True. - -END_PROVIDER - -BEGIN_PROVIDER [logical, do_mono_excitations] - implicit none - BEGIN_DOC - ! if True then the mono excitations are performed in the calculation - ! always true in the CISD - END_DOC - do_mono_excitations = .False. - -END_PROVIDER diff --git a/src/CISD/do_mono_double.irp.f b/src/CISD/do_mono_double.irp.f deleted file mode 100644 index 8a07c292..00000000 --- a/src/CISD/do_mono_double.irp.f +++ /dev/null @@ -1,19 +0,0 @@ -BEGIN_PROVIDER [logical, do_double_excitations] - implicit none - BEGIN_DOC - ! if True then the double excitations are performed in the calculation - ! always true in the CISD - END_DOC - do_double_excitations = .True. - -END_PROVIDER - -BEGIN_PROVIDER [logical, do_mono_excitations] - implicit none - BEGIN_DOC - ! if True then the mono excitations are performed in the calculation - ! always true in the CISD - END_DOC - do_mono_excitations = .True. - -END_PROVIDER diff --git a/src/CISD_SC2_selected/do_mono_double.irp.f b/src/CISD_SC2_selected/do_mono_double.irp.f deleted file mode 100644 index 8a07c292..00000000 --- a/src/CISD_SC2_selected/do_mono_double.irp.f +++ /dev/null @@ -1,19 +0,0 @@ -BEGIN_PROVIDER [logical, do_double_excitations] - implicit none - BEGIN_DOC - ! if True then the double excitations are performed in the calculation - ! always true in the CISD - END_DOC - do_double_excitations = .True. - -END_PROVIDER - -BEGIN_PROVIDER [logical, do_mono_excitations] - implicit none - BEGIN_DOC - ! if True then the mono excitations are performed in the calculation - ! always true in the CISD - END_DOC - do_mono_excitations = .True. - -END_PROVIDER diff --git a/src/CISD_selected/do_mono_double.irp.f b/src/CISD_selected/do_mono_double.irp.f deleted file mode 100644 index 8a07c292..00000000 --- a/src/CISD_selected/do_mono_double.irp.f +++ /dev/null @@ -1,19 +0,0 @@ -BEGIN_PROVIDER [logical, do_double_excitations] - implicit none - BEGIN_DOC - ! if True then the double excitations are performed in the calculation - ! always true in the CISD - END_DOC - do_double_excitations = .True. - -END_PROVIDER - -BEGIN_PROVIDER [logical, do_mono_excitations] - implicit none - BEGIN_DOC - ! if True then the mono excitations are performed in the calculation - ! always true in the CISD - END_DOC - do_mono_excitations = .True. - -END_PROVIDER diff --git a/src/Dets/H_apply_template.f b/src/Dets/H_apply_template.f index 773fbd92..b795223f 100644 --- a/src/Dets/H_apply_template.f +++ b/src/Dets/H_apply_template.f @@ -420,13 +420,13 @@ subroutine $subroutine($params_main) enddo enddo - if(do_double_excitations)then + if($do_double_excitations)then call $subroutine_diexc(psi_generators(1,1,i_generator), & mask(1,1,d_hole1), mask(1,1,d_part1), & mask(1,1,d_hole2), mask(1,1,d_part2), & i_generator $params_post) endif - if(do_mono_excitations)then + if($do_mono_excitations)then call $subroutine_monoexc(psi_generators(1,1,i_generator), & mask(1,1,s_hole ), mask(1,1,s_part ), & i_generator $params_post) @@ -475,13 +475,13 @@ subroutine $subroutine($params_main) not(psi_generators(k,ispin,i_generator)) ) enddo enddo - if(do_double_excitations)then + if($do_double_excitations)then call $subroutine_diexc(psi_generators(1,1,i_generator), & mask(1,1,d_hole1), mask(1,1,d_part1), & mask(1,1,d_hole2), mask(1,1,d_part2), & i_generator $params_post) endif - if(do_mono_excitations)then + if($do_mono_excitations)then call $subroutine_monoexc(psi_generators(1,1,i_generator), & mask(1,1,s_hole ), mask(1,1,s_part ), & i_generator $params_post) diff --git a/src/Dets/README.rst b/src/Dets/README.rst index 09352c44..4a4e8ff2 100644 --- a/src/Dets/README.rst +++ b/src/Dets/README.rst @@ -50,24 +50,24 @@ Documentation .. Do not edit this section. It was auto-generated from the .. NEEDED_MODULES file. -`copy_h_apply_buffer_to_wf `_ +`copy_h_apply_buffer_to_wf `_ Copies the H_apply buffer to psi_coef. You need to touch psi_det, psi_coef and N_det after calling this function. -`fill_h_apply_buffer_no_selection `_ +`fill_h_apply_buffer_no_selection `_ Fill the H_apply buffer with determiants for CISD -`h_apply_buffer_allocated `_ +`h_apply_buffer_allocated `_ Buffer of determinants/coefficients/perturbative energy for H_apply. Uninitialized. Filled by H_apply subroutines. -`h_apply_threshold `_ +`h_apply_threshold `_ Theshold on | | -`resize_h_apply_buffer `_ +`resize_h_apply_buffer `_ Undocumented -`cisd_sc2 `_ +`cisd_sc2 `_ CISD+SC2 method :: take off all the disconnected terms of a CISD (selected or not) .br dets_in : bitmasks corresponding to determinants @@ -83,29 +83,29 @@ Documentation .br Initial guess vectors are not necessarily orthonormal -`repeat_excitation `_ +`repeat_excitation `_ Undocumented -`connected_to_ref `_ +`connected_to_ref `_ Undocumented -`det_is_not_or_may_be_in_ref `_ +`det_is_not_or_may_be_in_ref `_ If true, det is not in ref If false, det may be in ref -`is_in_wavefunction `_ +`is_in_wavefunction `_ Undocumented -`key_pattern_not_in_ref `_ +`key_pattern_not_in_ref `_ Min and max values of the integers of the keys of the reference -`davidson_converged `_ +`davidson_converged `_ True if the Davidson algorithm is converged -`davidson_criterion `_ +`davidson_criterion `_ Can be : [ energy | residual | both | wall_time | cpu_time | iterations ] -`davidson_diag `_ +`davidson_diag `_ Davidson diagonalization. .br dets_in : bitmasks corresponding to determinants @@ -123,7 +123,7 @@ Documentation .br Initial guess vectors are not necessarily orthonormal -`davidson_diag_hjj `_ +`davidson_diag_hjj `_ Davidson diagonalization with specific diagonal elements of the H matrix .br H_jj : specific diagonal H matrix elements to diagonalize de Davidson @@ -143,114 +143,117 @@ Documentation .br Initial guess vectors are not necessarily orthonormal -`davidson_iter_max `_ +`davidson_iter_max `_ Max number of Davidson iterations -`davidson_sze_max `_ +`davidson_sze_max `_ Max number of Davidson sizes -`davidson_threshold `_ +`davidson_threshold `_ Can be : [ energy | residual | both | wall_time | cpu_time | iterations ] -`det_search_key `_ +`det_search_key `_ Return an integer*8 corresponding to a determinant index for searching -`n_det `_ +`n_det `_ Number of determinants in the wave function -`n_det_max_jacobi `_ +`n_det_max_jacobi `_ Maximum number of determinants diagonalized my jacobi -`n_states `_ +`n_states `_ Number of states to consider -`psi_average_norm_contrib `_ +`psi_average_norm_contrib `_ Contribution of determinants to the state-averaged density -`psi_average_norm_contrib_sorted `_ +`psi_average_norm_contrib_sorted `_ Wave function sorted by determinants contribution to the norm (state-averaged) -`psi_coef `_ +`psi_coef `_ The wave function coefficients. Initialized with Hartree-Fock if the EZFIO file is empty -`psi_coef_sorted `_ +`psi_coef_sorted `_ Wave function sorted by determinants contribution to the norm (state-averaged) -`psi_coef_sorted_bit `_ +`psi_coef_sorted_bit `_ Determinants on which we apply for perturbation. o They are sorted by determinants interpreted as integers. Useful to accelerate the search of a determinant -`psi_det `_ +`psi_det `_ The wave function determinants. Initialized with Hartree-Fock if the EZFIO file is empty -`psi_det_size `_ +`psi_det_size `_ Size of the psi_det/psi_coef arrays -`psi_det_sorted `_ +`psi_det_sorted `_ Wave function sorted by determinants contribution to the norm (state-averaged) -`psi_det_sorted_bit `_ +`psi_det_sorted_bit `_ Determinants on which we apply for perturbation. o They are sorted by determinants interpreted as integers. Useful to accelerate the search of a determinant -`read_dets `_ +`read_dets `_ Reads the determinants from the EZFIO file -`save_wavefunction `_ +`save_wavefunction `_ Save the wave function into the EZFIO file -`double_exc_bitmask `_ +`double_exc_bitmask `_ 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(:,3,i) is the bitmask for holes of excitation 2 double_exc_bitmask(:,4,i) is the bitmask for particles of excitation 2 for a given couple of hole/particle excitations i. -`n_double_exc_bitmasks `_ +`n_double_exc_bitmasks `_ Number of double excitation bitmasks -`n_single_exc_bitmasks `_ +`n_single_exc_bitmasks `_ Number of single excitation bitmasks -`single_exc_bitmask `_ +`single_exc_bitmask `_ single_exc_bitmask(:,1,i) is the bitmask for holes single_exc_bitmask(:,2,i) is the bitmask for particles for a given couple of hole/particle excitations i. -`ci_eigenvectors `_ +`ci_eigenvectors `_ Eigenvectors/values of the CI matrix -`ci_electronic_energy `_ +`ci_electronic_energy `_ Eigenvectors/values of the CI matrix -`ci_energy `_ +`ci_energy `_ N_states lowest eigenvalues of the CI matrix -`diag_algorithm `_ +`diag_algorithm `_ Diagonalization algorithm (Davidson or Lapack) -`diagonalize_ci `_ +`diagonalize_ci `_ Replace the coefficients of the CI states by the coefficients of the eigenstates of the CI matrix -`ci_sc2_eigenvectors `_ +`ci_sc2_eigenvectors `_ Eigenvectors/values of the CI matrix -`ci_sc2_electronic_energy `_ +`ci_sc2_electronic_energy `_ Eigenvectors/values of the CI matrix -`ci_sc2_energy `_ +`ci_sc2_energy `_ N_states lowest eigenvalues of the CI matrix -`diagonalize_ci_sc2 `_ +`diagonalize_ci_sc2 `_ Replace the coefficients of the CI states by the coefficients of the eigenstates of the CI matrix -`filter_connected `_ +`threshold_convergence_sc2 `_ + convergence of the correlation energy of SC2 iterations + +`filter_connected `_ Filters out the determinants that are not connected by H .br returns the array idx which contains the index of the @@ -261,7 +264,7 @@ Documentation .br idx(0) is the number of determinants that interact with key1 -`filter_connected_davidson `_ +`filter_connected_davidson `_ Filters out the determinants that are not connected by H .br returns the array idx which contains the index of the @@ -272,7 +275,7 @@ Documentation .br idx(0) is the number of determinants that interact with key1 -`filter_connected_i_h_psi0 `_ +`filter_connected_i_h_psi0 `_ returns the array idx which contains the index of the .br determinants in the array key1 that interact @@ -281,7 +284,7 @@ Documentation .br idx(0) is the number of determinants that interact with key1 -`filter_connected_i_h_psi0_sc2 `_ +`filter_connected_i_h_psi0_sc2 `_ standard filter_connected_i_H_psi but returns in addition .br the array of the index of the non connected determinants to key1 @@ -292,69 +295,69 @@ Documentation .br to repeat the excitations -`get_s2 `_ +`get_s2 `_ Returns -`get_s2_u0 `_ +`get_s2_u0 `_ Undocumented -`s_z `_ +`s_z `_ Undocumented -`s_z2_sz `_ +`s_z2_sz `_ Undocumented -`a_operator `_ +`a_operator `_ Needed for diag_H_mat_elem -`ac_operator `_ +`ac_operator `_ Needed for diag_H_mat_elem -`decode_exc `_ +`decode_exc `_ Decodes the exc arrays returned by get_excitation. h1,h2 : Holes p1,p2 : Particles s1,s2 : Spins (1:alpha, 2:beta) degree : Degree of excitation -`det_connections `_ +`det_connections `_ .br -`diag_h_mat_elem `_ +`diag_h_mat_elem `_ Computes -`get_double_excitation `_ +`get_double_excitation `_ Returns the two excitation operators between two doubly excited determinants and the phase -`get_excitation `_ +`get_excitation `_ Returns the excitation operators between two determinants and the phase -`get_excitation_degree `_ +`get_excitation_degree `_ Returns the excitation degree between two determinants -`get_excitation_degree_vector `_ +`get_excitation_degree_vector `_ Applies get_excitation_degree to an array of determinants -`get_mono_excitation `_ +`get_mono_excitation `_ Returns the excitation operator between two singly excited determinants and the phase -`get_occ_from_key `_ +`get_occ_from_key `_ Returns a list of occupation numbers from a bitstring -`h_u_0 `_ +`h_u_0 `_ Computes v_0 = H|u_0> .br n : number of determinants .br H_jj : array of -`i_h_j `_ +`i_h_j `_ Returns where i and j are determinants -`i_h_psi `_ +`i_h_psi `_ for the various Nstates -`i_h_psi_sc2 `_ +`i_h_psi_sc2 `_ for the various Nstate .br returns in addition @@ -367,10 +370,10 @@ Documentation .br to repeat the excitations -`n_con_int `_ +`n_con_int `_ Number of integers to represent the connections between determinants -`h_matrix_all_dets `_ +`h_matrix_all_dets `_ H matrix on the basis of the slater deter;inants defined by psi_det diff --git a/src/MonoInts/NEEDED_MODULES b/src/MonoInts/NEEDED_MODULES index 56587081..190f8c6e 100644 --- a/src/MonoInts/NEEDED_MODULES +++ b/src/MonoInts/NEEDED_MODULES @@ -1 +1 @@ -AOs Ezfio_files MOs Nuclei Output Utils +AOs Electrons Ezfio_files MOs Nuclei Output Utils diff --git a/src/MonoInts/README.rst b/src/MonoInts/README.rst index a9bd07bc..d10cee82 100644 --- a/src/MonoInts/README.rst +++ b/src/MonoInts/README.rst @@ -5,6 +5,7 @@ Needed Modules .. NEEDED_MODULES file. * `AOs `_ +* `Electrons `_ * `Ezfio_files `_ * `MOs `_ * `Nuclei `_