diff --git a/INSTALL.rst b/INSTALL.rst index 1796a332..c950d81d 100644 --- a/INSTALL.rst +++ b/INSTALL.rst @@ -210,6 +210,12 @@ Zlib make make install +With Debian or Ubuntu, you can use + +.. code:: bash + + sudo apt install zlib1g-dev + OCaml @@ -217,6 +223,13 @@ OCaml *OCaml* is a general purpose programming language with an emphasis on expressiveness and safety. +* The following packages are required (Debian or Ubuntu): + + .. code:: bash + + sudo apt install libncurses5-dev pkg-config libgmp3-dev m4 + + * Download the installer of the OPAM package manager here : ``_ and move it in the :file:`${QP_ROOT}/external` directory diff --git a/REPLACE b/REPLACE index b23f324c..555616ac 100644 --- a/REPLACE +++ b/REPLACE @@ -183,3 +183,17 @@ qp_name save_one_body_dm -r save_one_e_dm qp_name ezfio_set_aux_quantities_data_one_e_alpha_dm_mo -r ezfio_set_aux_quantities_data_one_e_dm_alpha_mo qp_name ezfio_set_aux_quantities_data_one_e_beta_dm_mo -r ezfio_set_aux_quantities_data_one_e_dm_beta_mo qp_name two_electron_energy -r two_e_energy +qp_name do_mono_excitation -r do_single_excitation +qp_name get_mono_excitation -r get_single_excitation +qp_name get_mono_excitation_from_fock -r get_single_excitation_from_fock +qp_name is_connected_to_by_mono -r is_connected_to_by_single +qp_name connected_to_ref_by_mono -r connected_to_ref_by_single +qp_name mono_excitation_wee -r single_excitation_wee +qp_name get_mono_excitation_spin +qp_name get_mono_excitation_spin -r get_single_excitation_spin +qp_name get_excitation_degree_vector_mono -r get_excitation_degree_vector_single +qp_name get_excitation_degree_vector_mono_or_exchange -r get_excitation_degree_vector_single_or_exchange_or_exchange +qp_name get_excitation_degree_vector_single_or_exchange_or_exchange -r get_excitation_degree_vector_single_or_exchange +qp_name get_excitation_degree_vector_mono_or_exchange_verbose -r get_excitation_degree_vector_single_or_exchange_verbose +qp_name i_h_j_mono_spin -r i_h_j_single_spin +qp_name i_Wee_j_mono -r i_Wee_j_single diff --git a/TODO b/TODO index 699823ae..11be081c 100644 --- a/TODO +++ b/TODO @@ -49,8 +49,6 @@ Refaire les benchmarks # Documentation de qpsh # Documentation de /etc -# Extrapolation qui prend aussi en compe la variance? a tester -Parler dans le papier de rPT2 # Toto Re-design de qp command @@ -58,3 +56,5 @@ Re-design de qp command Doc: plugins et qp_plugins Ajouter les symetries dans devel + +Compiler ezfio avec openmp diff --git a/bin/qp_export_as_tgz b/bin/qp_export_as_tgz index 84dac639..7332d1ed 100755 --- a/bin/qp_export_as_tgz +++ b/bin/qp_export_as_tgz @@ -154,7 +154,7 @@ for i in ${FORTRAN_EXEC} ; do done > ${QPACKAGE_STATIC}/data/executables mkdir --parents -- ${QPACKAGE_STATIC}/src/bitmask -cp ${QP_ROOT}/src/Bitmask/bitmasks_module.f90 ${QPACKAGE_STATIC}/src/bitmask +cp ${QP_ROOT}/src/bitmask/bitmasks_module.f90 ${QPACKAGE_STATIC}/src/bitmask echo "Copying dynamic libraries" @@ -179,7 +179,7 @@ if [[ $? -ne 0 ]] ; then exit 1 fi -cp -- ${QPACKAGE_STATIC}/extra_lib/lib{[gi]omp*,mkl*,lapack*,blas*,z*} \ +cp -- ${QPACKAGE_STATIC}/extra_lib/lib{[gi]omp*,mkl*,lapack*,blas*,z*,gfortran*,quad*} \ ${QPACKAGE_STATIC}/lib/ # diff --git a/config/gfortran.cfg b/config/gfortran.cfg index f561fcb7..94a12ccf 100644 --- a/config/gfortran.cfg +++ b/config/gfortran.cfg @@ -35,7 +35,7 @@ OPENMP : 1 ; Append OpenMP flags # -ffast-math and the Fortran-specific # -fno-protect-parens and -fstack-arrays. [OPT] -FCFLAGS : -Ofast -msse4.2 +FCFLAGS : -Ofast -march=native # Profiling flags ################# diff --git a/configure b/configure index 3f532061..389f7541 100755 --- a/configure +++ b/configure @@ -353,23 +353,24 @@ EOF done - + +source quantum_package.rc NINJA=$(find_exe ninja) if [[ ${NINJA} = $(not_found) ]] ; then - error "Ninja is not installed." + error "Ninja (ninja) is not installed." fail fi IRPF90=$(find_exe irpf90) if [[ ${IRPF90} = $(not_found) ]] ; then - error "IRPf90 is not installed." + error "IRPf90 (irpf90) is not installed." fail fi ZEROMQ=$(find_lib -lzmq) if [[ ${ZEROMQ} = $(not_found) ]] ; then - error "ZeroMQ is not installed." + error "ZeroMQ (zeromq) is not installed." fail fi @@ -387,31 +388,31 @@ fi OCAML=$(find_exe ocaml) if [[ ${OCAML} = $(not_found) ]] ; then - error "OCaml compiler is not installed." + error "OCaml (ocaml) compiler is not installed." fail fi EZFIO=$(find_dir "${QP_ROOT}"/external/ezfio) if [[ ${EZFIO} = $(not_found) ]] ; then - error "EZFIO is not installed." + error "EZFIO (ezfio) is not installed." fail fi ZLIB=$(find_lib -lz) if [[ ${ZLIB} = $(not_found) ]] ; then - error "Zlib is not installed." + error "Zlib (zlib) is not installed." fail fi DOCOPT=$(find_python_lib docopt) if [[ ${DOCOPT} = $(not_found) ]] ; then - error "docopt is not installed." + error "docopt (docopt) is not installed." fail fi RESULTSFILE=$(find_python_lib resultsFile) if [[ ${RESULTSFILE} = $(not_found) ]] ; then - error "resultsFile is not installed." + error "resultsFile (resultsFile) is not installed." fail fi diff --git a/docs/source/_static/links.rst b/docs/source/_static/links.rst index f95e3e70..96393b79 100644 --- a/docs/source/_static/links.rst +++ b/docs/source/_static/links.rst @@ -12,7 +12,6 @@ .. _Irene: http://www-hpc.cea.fr/en/complexe/tgcc-Irene.htm .. _IRPF90: http://irpf90.ups-tlse.fr .. _LAPACK: http://www.netlib.org/lapack/ -.. _Molden: http://cheminf.cmbi.ru.nl/molden/ .. _NECI: https://github.com/ghb24/NECI_STABLE .. _Ninja: https://ninja-build.org/ .. _NWChem: http://www.nwchem-sw.org/ @@ -53,12 +52,15 @@ .. |CIPSI| replace:: :abbr:`CIPSI (Configuration Interaction using a Perturbative Selection)` .. |CI| replace:: :abbr:`CI (Configuration Interaction)` .. |CISD| replace:: :abbr:`CISD (Configuration Interaction with Single and Double Excitations)` +.. |CASSCF| replace:: |CAS| - |SCF| .. |CIS| replace:: :abbr:`CIS (Configuration Interaction with Single Excitations)` -.. |DFT| replace:: :abbr:`DFT (Density Functional Theory)` .. |DDCI| replace:: :abbr:`DDCI (Difference Dedicated Configuration Interaction)` +.. |DFT| replace:: :abbr:`DFT (Density Functional Theory)` .. |DIIS| replace:: :abbr:`DIIS (Direct Inversion of the Iterative Subspace)` +.. |FCIQMC| replace:: |FCI| - |QMC| .. |FCI| replace:: :abbr:`FCI (Full Configuration Interaction)` .. |HF| replace:: :abbr:`HF (Hartree-Fock)` +.. |KS-DFT| replace:: :abbr:`KS-DFT (Kohn-Sham Density Functional Theory)` .. |MO| replace:: :abbr:`MO (Molecular Orbital)` .. |MOs| replace:: :abbr:`MOs (Molecular Orbitals)` .. |MP2| replace:: :abbr:`MP2 (Moller-Plesset second order perturbative correction)` @@ -67,15 +69,13 @@ .. |MRPT| replace:: :abbr:`MRPT (Multi-Reference Perturbation Theory)` .. |PT2| replace:: :abbr:`PT2 (Second order perturbative correction)` .. |QMC| replace:: :abbr:`QMC (Quantum Monte Carlo)` +.. |ROHF| replace:: :abbr:`ROHF (Restricted Open-Shell Hartree-Fock)` +.. |RSDFT| replace:: :abbr:`RSDFT (Range Separated Density Functional Theory)` +.. |RSH| replace:: :abbr:`RSH (Range Separated Hybrids)` .. |rst| replace:: :abbr:`RST (ReStructured Text)` .. |SCF| replace:: :abbr:`SCF (Self Consistent Field)` -.. |RSH| replace:: :abbr:`RSH (Range Separated Hybrids)` -.. |RSDFT| replace:: :abbr:`RSDFT (Range Separated Density Functional Theory)` -.. |KS-DFT| replace:: :abbr:`KS-DFT (Kohn-Sham Density Functional Theory)` .. |sCI| replace:: :abbr:`sCI (Selected-CI)` .. |WFT| replace:: :abbr:`WFT (Wave Function Theory)` -.. |CASSCF| replace:: |CAS| - |SCF| -.. |FCIQMC| replace:: |FCI| - |QMC| .. |kalpha| replace:: :math:`|\alpha \rangle` .. |H| replace:: :math:`\hat H` diff --git a/docs/source/conf.py b/docs/source/conf.py index 939793cd..8d6a023e 100644 --- a/docs/source/conf.py +++ b/docs/source/conf.py @@ -171,7 +171,7 @@ for f in os.listdir("users_guide"): for f in os.listdir("programs"): name = f.split('.')[0] - if name not in []: + if name not in [""]: filename = os.path.join("programs",name) man_pages.append( (filename, name, qpdoc, [author], 1) ) diff --git a/docs/source/intro/selected_ci.rst b/docs/source/intro/selected_ci.rst index 443a678f..21062e62 100644 --- a/docs/source/intro/selected_ci.rst +++ b/docs/source/intro/selected_ci.rst @@ -55,8 +55,6 @@ Simple Algorithm .. |SetDI| replace:: `\{|D_I\rangle\}^{(n)}` .. |Psi_n| replace:: `|\Psi^{(n)}\rangle` -.. |H| replace:: `\hat H` -.. |kalpha| replace:: `|\alpha\rangle` .. |kalpha_star| replace:: `\{ |\alpha \rangle \}_\star ^{(n)}` .. |ealpha| replace:: `e_\alpha` .. |EPT| replace:: `E_\text{PT2}` diff --git a/docs/source/modules/ao_basis.rst b/docs/source/modules/ao_basis.rst index f61e99e8..240f31d1 100644 --- a/docs/source/modules/ao_basis.rst +++ b/docs/source/modules/ao_basis.rst @@ -23,9 +23,13 @@ The |AO| coefficients are normalized as: {\tilde c}_{ki} = \frac{c_{ki}}{ \int \left( (x-X_A)^a (y-Y_A)^b (z-Z_A)^c e^{-\gamma_{ki} |{\bf r} - {\bf R}_A|^2} \right)^2 dr} -Warning: `ao_coef` contains the |AO| coefficients given in input. These do not -include the normalization constant of the |AO|. The `ao_coef_normalized` provider includes -this normalization factor. + +.. warning:: + + `ao_coef` contains the |AO| coefficients given in input. These do not + include the normalization constant of the |AO|. The `ao_coef_normalized` + provider includes this normalization factor. + The |AOs| are also sorted by increasing exponent to accelerate the calculation of the two electron integrals. @@ -1076,7 +1080,7 @@ Subroutines / functions double precision function ao_value(i,r) - return the value of the ith ao at point r + Returns the value of the i-th ao at point $\textbf{r}$ Needs: @@ -1101,9 +1105,12 @@ Subroutines / functions subroutine give_all_aos_and_grad_and_lapl_at_r(r,aos_array,aos_grad_array,aos_lapl_array) - input : r(1) ==> r(1) = x, r(2) = y, r(3) = z - output : aos_array(i) = ao(i) evaluated at r - : aos_grad_array(1,i) = gradient X of the ao(i) evaluated at r + input : r(1) ==> r(1) = x, r(2) = y, r(3) = z + + output : + + * aos_array(i) = ao(i) evaluated at $\textbf{r}$ + * aos_grad_array(1,i) = $\nabla_x$ of the ao(i) evaluated at $\textbf{r}$ Needs: @@ -1138,9 +1145,13 @@ Subroutines / functions subroutine give_all_aos_and_grad_at_r(r,aos_array,aos_grad_array) - input : r(1) ==> r(1) = x, r(2) = y, r(3) = z - output : aos_array(i) = ao(i) evaluated at r - : aos_grad_array(1,i) = gradient X of the ao(i) evaluated at r + input : r(1) ==> r(1) = x, r(2) = y, r(3) = z + + output : + + * aos_array(i) = ao(i) evaluated at ro + * aos_grad_array(1,i) = gradient X of the ao(i) evaluated at $\textbf{r}$ + Needs: @@ -1175,8 +1186,9 @@ Subroutines / functions subroutine give_all_aos_at_r(r,aos_array) - input : r == r(1) = x and so on - aos_array(i) = aos(i) evaluated in r + input : r == r(1) = x and so on + + output : aos_array(i) = aos(i) evaluated in $\textbf{r}$ Needs: @@ -1211,7 +1223,7 @@ Subroutines / functions subroutine give_all_aos_at_r_old(r,aos_array) - gives the values of aos at a given point r + Gives the values of |AOs| at a given point $\textbf{r}$ Needs: @@ -1231,7 +1243,8 @@ Subroutines / functions double precision function primitive_value(i,j,r) - return the value of the jth primitive of ith ao at point r WITHOUT THE COEF + Returns the value of the j-th primitive of the i-th |AO| at point $\textbf{r} + **without the coefficient** Needs: diff --git a/docs/source/modules/ao_one_e_ints.rst b/docs/source/modules/ao_one_e_ints.rst index 53f5844c..ae8bda04 100644 --- a/docs/source/modules/ao_one_e_ints.rst +++ b/docs/source/modules/ao_one_e_ints.rst @@ -232,8 +232,10 @@ Providers Second derivative matrix elements in the |AO| basis. - :math:`{\tt ao\_deriv2\_x} = - \langle \chi_i(x,y,z) | \frac{\partial^2}{\partial x^2} |\chi_j (x,y,z) \rangle` + .. math:: + + {\tt ao\_deriv2\_x} = + \langle \chi_i(x,y,z) | \frac{\partial^2}{\partial x^2} |\chi_j (x,y,z) \rangle Needs: @@ -271,8 +273,10 @@ Providers Second derivative matrix elements in the |AO| basis. - :math:`{\tt ao\_deriv2\_x} = - \langle \chi_i(x,y,z) | \frac{\partial^2}{\partial x^2} |\chi_j (x,y,z) \rangle` + .. math:: + + {\tt ao\_deriv2\_x} = + \langle \chi_i(x,y,z) | \frac{\partial^2}{\partial x^2} |\chi_j (x,y,z) \rangle Needs: @@ -310,8 +314,10 @@ Providers Second derivative matrix elements in the |AO| basis. - :math:`{\tt ao\_deriv2\_x} = - \langle \chi_i(x,y,z) | \frac{\partial^2}{\partial x^2} |\chi_j (x,y,z) \rangle` + .. math:: + + {\tt ao\_deriv2\_x} = + \langle \chi_i(x,y,z) | \frac{\partial^2}{\partial x^2} |\chi_j (x,y,z) \rangle Needs: @@ -642,7 +648,8 @@ Providers Kinetic energy integrals in the |AO| basis. - :math:`\langle \chi_i |\hat{T}| \chi_j \rangle` + :math:`\langle \chi_i |\hat{T}| \chi_j \rangle` + Needs: @@ -1331,7 +1338,8 @@ Providers power_A,power_B,C_center,n_pt_in,d,n_pt_out,mu_in) - Returns the explicit polynomial in terms of the $t$ variable of the following polynomial: + Returns the explicit polynomial in terms of the $t$ variable of the + following polynomial: $I_{x1}(a_x, d_x,p,q) \times I_{x1}(a_y, d_y,p,q) \times I_{x1}(a_z, d_z,p,q)$. @@ -1355,7 +1363,8 @@ Providers power_A,power_B,C_center,n_pt_in,d,n_pt_out,mu_in,p,p_inv,p_inv_2,p_new,P_center) - Returns the explicit polynomial in terms of the $t$ variable of the following polynomial: + Returns the explicit polynomial in terms of the $t$ variable of the + following polynomial: $I_{x1}(a_x, d_x,p,q) \times I_{x1}(a_y, d_y,p,q) \times I_{x1}(a_z, d_z,p,q)$. @@ -1724,7 +1733,7 @@ Subroutines / functions Subroutine that returns all integrals over $r$ of type - $\frac{ \erf(\mu * |r-R_C|) }{ |r-R_C| }$ + $\frac{ \erf(\mu * | r - R_C | ) }{ | r - R_C | }$ Needs: @@ -1812,8 +1821,12 @@ Subroutines / functions Computes the following integral : - $\int dr (x-A_x)^a (x-B_x)^b \exp(-\alpha (x-A_x)^2 - \beta (x-B_x)^2 ) - \frac{\erf(\mu |r-R_C|)}{|r-R_c|}$. + + .. math:: + + \int dr (x-A_x)^a (x-B_x)^b \exp(-\alpha (x-A_x)^2 - \beta (x-B_x)^2 ) + \frac{\erf(\mu | r - R_C | )}{ | r - R_C | }$. + Calls: @@ -1834,7 +1847,7 @@ Subroutines / functions Computes the following integral : - $\int_{-\infty}^{infty} dr \chi_i(r) \chi_j(r) \frac{\erf(\mu |r-R_C|)}{|r-R_C|}$. + $\int_{-\infty}^{infty} dr \chi_i(r) \chi_j(r) \frac{\erf(\mu | r - R_C | )}{ | r - R_C | }$. Needs: diff --git a/docs/source/modules/ao_two_e_erf_ints.rst b/docs/source/modules/ao_two_e_erf_ints.rst index 4e35de17..7ee24a88 100644 --- a/docs/source/modules/ao_two_e_erf_ints.rst +++ b/docs/source/modules/ao_two_e_erf_ints.rst @@ -587,11 +587,13 @@ Subroutines / functions double precision function ERI_erf(alpha,beta,delta,gama,a_x,b_x,c_x,d_x,a_y,b_y,c_y,d_y,a_z,b_z,c_z,d_z) - ATOMIC PRIMTIVE two-electron integral between the 4 primitives :: - primitive_1 = x1**(a_x) y1**(a_y) z1**(a_z) exp(-alpha * r1**2) - primitive_2 = x1**(b_x) y1**(b_y) z1**(b_z) exp(- beta * r1**2) - primitive_3 = x2**(c_x) y2**(c_y) z2**(c_z) exp(-delta * r2**2) - primitive_4 = x2**(d_x) y2**(d_y) z2**(d_z) exp(- gama * r2**2) + Atomic primtive two-electron integral between the 4 primitives : + + * primitive 1 : $x_1^{a_x} y_1^{a_y} z_1^{a_z} \exp(-\alpha * r1^2)$ + * primitive 2 : $x_1^{b_x} y_1^{b_y} z_1^{b_z} \exp(- \beta * r1^2)$ + * primitive 3 : $x_2^{c_x} y_2^{c_y} z_2^{c_z} \exp(-\delta * r2^2)$ + * primitive 4 : $x_2^{d_x} y_2^{d_y} z_2^{d_z} \exp(-\gamma * r2^2)$ + Needs: @@ -776,9 +778,11 @@ Subroutines / functions subroutine integrale_new_erf(I_f,a_x,b_x,c_x,d_x,a_y,b_y,c_y,d_y,a_z,b_z,c_z,d_z,p,q,n_pt) - calculate the integral of the polynom :: - I_x1(a_x+b_x, c_x+d_x,p,q) * I_x1(a_y+b_y, c_y+d_y,p,q) * I_x1(a_z+b_z, c_z+d_z,p,q) - between ( 0 ; 1) + Calculate the integral of the polynomial : + + $I_x1(a_x+b_x, c_x+d_x,p,q) \, I_x1(a_y+b_y, c_y+d_y,p,q) \, I_x1(a_z+b_z, c_z+d_z,p,q)$ + + between $( 0 ; 1)$ Needs: diff --git a/docs/source/modules/ao_two_e_ints.rst b/docs/source/modules/ao_two_e_ints.rst index 9121ed30..3c833a90 100644 --- a/docs/source/modules/ao_two_e_ints.rst +++ b/docs/source/modules/ao_two_e_ints.rst @@ -362,7 +362,7 @@ Providers recursive subroutine I_x1_pol_mult_a1(c,B_10,B_01,B_00,C_00,D_00,d,nd,n_pt_in) - recursive function involved in the two-electron integral + Recursive function involved in the two-electron integral Called by: @@ -392,7 +392,7 @@ Providers recursive subroutine I_x1_pol_mult_a2(c,B_10,B_01,B_00,C_00,D_00,d,nd,n_pt_in) - recursive function involved in the two-electron integral + Recursive function involved in the two-electron integral Called by: @@ -422,7 +422,7 @@ Providers recursive subroutine I_x1_pol_mult_recurs(a,c,B_10,B_01,B_00,C_00,D_00,d,nd,n_pt_in) - recursive function involved in the two-electron integral + Recursive function involved in the two-electron integral Called by: @@ -487,7 +487,7 @@ Providers recursive subroutine I_x2_pol_mult(c,B_10,B_01,B_00,C_00,D_00,d,nd,dim) - recursive function involved in the two-electron integral + Recursive function involved in the two-electron integral Called by: @@ -1027,7 +1027,8 @@ Subroutines / functions subroutine that returns the explicit polynom in term of the "t" variable of the following polynomw : - I_x1(a_x, d_x,p,q) * I_x1(a_y, d_y,p,q) * I_x1(a_z, d_z,p,q) + + $I_{x_1}(a_x,d_x,p,q) \, I_{x_1}(a_y,d_y,p,q) \ I_{x_1}(a_z,d_z,p,q)$ Called by: @@ -1055,7 +1056,7 @@ Subroutines / functions subroutine I_x1_pol_mult(a,c,B_10,B_01,B_00,C_00,D_00,d,nd,n_pt_in) - recursive function involved in the two-electron integral + Recursive function involved in the two-electron integral Called by: @@ -1119,9 +1120,10 @@ Subroutines / functions subroutine integrale_new(I_f,a_x,b_x,c_x,d_x,a_y,b_y,c_y,d_y,a_z,b_z,c_z,d_z,p,q,n_pt) - calculate the integral of the polynom :: - I_x1(a_x+b_x, c_x+d_x,p,q) * I_x1(a_y+b_y, c_y+d_y,p,q) * I_x1(a_z+b_z, c_z+d_z,p,q) - between ( 0 ; 1) + Calculates the integral of the polynomial : + + $I_{x_1}(a_x+b_x,c_x+d_x,p,q) \, I_{x_1}(a_y+b_y,c_y+d_y,p,q) \, I_{x_1}(a_z+b_z,c_z+d_z,p,q)$ + in $( 0 ; 1)$ Needs: @@ -1186,8 +1188,9 @@ Subroutines / functions Returns the upper boundary of the degree of the polynomial involved in the - bielctronic integral : - Ix(a_x,b_x,c_x,d_x) * Iy(a_y,b_y,c_y,d_y) * Iz(a_z,b_z,c_z,d_z) + two-electron integral : + + $I_x(a_x,b_x,c_x,d_x) \, I_y(a_y,b_y,c_y,d_y) \, I_z(a_z,b_z,c_z,d_z)$ .. c:function:: push_integrals: diff --git a/docs/source/modules/aux_quantities.rst b/docs/source/modules/aux_quantities.rst index 3ded29f8..e71dc325 100644 --- a/docs/source/modules/aux_quantities.rst +++ b/docs/source/modules/aux_quantities.rst @@ -10,21 +10,22 @@ aux_quantities This module contains some global variables (such as densities and energies) -which are stored in the EZFIO folder in a different place than determinants. +which are stored in the |EZFIO| directory in a different place than determinants. This is used in practice to store density matrices which can be obtained from -any methods, as long as they are stored in the same MO basis which is used for +any method, as long as they are stored in the same |MO| basis which is used for the calculations. In |RSDFT| calculations, this can be done to perform damping -on the density in order to speed up convergence. +on the density in order to speed up the convergence. The main providers of that module are: -* `data_one_e_dm_alpha_mo` and `data_one_e_dm_beta_mo` which are the - one-body alpha and beta densities which are necessary read from the EZFIO - folder. +* :c:data:`data_one_e_dm_alpha_mo` and :c:data:`data_one_e_dm_beta_mo` which + are the one-body alpha and beta densities which are necessary read from the + |EZFIO| directory. Thanks to these providers you can use any density matrix that does not -necessary corresponds to that of the current wave function. +necessarily corresponds to that of the current wave function. + diff --git a/docs/source/modules/cipsi.rst b/docs/source/modules/cipsi.rst index 3e0d1aef..7b5c82fd 100644 --- a/docs/source/modules/cipsi.rst +++ b/docs/source/modules/cipsi.rst @@ -49,7 +49,7 @@ By default, the program will stop when more than one million determinants have been selected, or when the |PT2| energy is below :math:`10^{-4}`. The variational and |PT2| energies of the iterations are stored in the -|EZFIO| database, in the :ref:`iterations` module. +|EZFIO| database, in the :ref:`module_iterations` module. @@ -180,55 +180,6 @@ Providers -.. c:function:: pt2_collector: - - - File : :file:`cipsi/pt2_stoch_routines.irp.f` - - .. code:: fortran - - subroutine pt2_collector(zmq_socket_pull, E, relative_error, pt2, error, & - variance, norm, b, N_) - - - - Needs: - - .. hlist:: - :columns: 3 - - * :c:data:`pt2_j` - * :c:data:`pt2_stoch_istate` - * :c:data:`n_states` - * :c:data:`pt2_f` - * :c:data:`pt2_w` - * :c:data:`n_det_generators` - * :c:data:`pt2_n_teeth` - * :c:data:`pt2_u` - - Called by: - - .. hlist:: - :columns: 3 - - * :c:func:`zmq_pt2` - - Calls: - - .. hlist:: - :columns: 3 - - * :c:func:`add_to_selection_buffer` - * :c:func:`check_mem` - * :c:func:`create_selection_buffer` - * :c:func:`delete_selection_buffer` - * :c:func:`end_zmq_to_qp_run_socket` - * :c:func:`pull_pt2_results` - * :c:func:`sleep` - * :c:func:`sort_selection_buffer` - * :c:func:`wall_time` - - .. c:var:: pt2_cw @@ -311,7 +262,6 @@ Providers * :c:data:`n_core_orb` * :c:data:`n_det_generators` * :c:data:`n_det_selectors` - * :c:data:`n_states` * :c:data:`psi_det_sorted_gen` @@ -455,7 +405,6 @@ Providers * :c:data:`n_core_orb` * :c:data:`n_det_generators` * :c:data:`n_det_selectors` - * :c:data:`n_states` * :c:data:`psi_det_sorted_gen` @@ -1164,6 +1113,54 @@ Subroutines / functions * :c:func:`run_slave_cipsi` +.. c:function:: pt2_collector: + + + File : :file:`cipsi/pt2_stoch_routines.irp.f` + + .. code:: fortran + + subroutine pt2_collector(zmq_socket_pull, E, relative_error, pt2, error, variance, norm, b, N_) + + + + Needs: + + .. hlist:: + :columns: 3 + + * :c:data:`pt2_j` + * :c:data:`pt2_stoch_istate` + * :c:data:`n_states` + * :c:data:`pt2_f` + * :c:data:`pt2_w` + * :c:data:`n_det_generators` + * :c:data:`pt2_n_teeth` + * :c:data:`pt2_u` + + Called by: + + .. hlist:: + :columns: 3 + + * :c:func:`zmq_pt2` + + Calls: + + .. hlist:: + :columns: 3 + + * :c:func:`add_to_selection_buffer` + * :c:func:`check_mem` + * :c:func:`create_selection_buffer` + * :c:func:`delete_selection_buffer` + * :c:func:`end_zmq_to_qp_run_socket` + * :c:func:`pull_pt2_results` + * :c:func:`sleep` + * :c:func:`sort_selection_buffer` + * :c:func:`wall_time` + + .. c:function:: pt2_find_sample: @@ -1633,21 +1630,31 @@ Subroutines / functions .. hlist:: :columns: 3 + * :c:data:`pt2_stoch_istate` + * :c:data:`psi_det` + * :c:data:`zmq_state` * :c:data:`psi_coef` * :c:data:`mpi_rank` - * :c:data:`zmq_state` - * :c:data:`state_average_weight` * :c:data:`mpi_master` - * :c:data:`pt2_stoch_istate` - * :c:data:`n_states` * :c:data:`n_det` - * :c:data:`pt2_e0_denominator` - * :c:data:`n_det_selectors` - * :c:data:`n_det_generators` - * :c:data:`psi_det` - * :c:data:`n_states_diag` * :c:data:`zmq_context` + * :c:data:`n_det_selectors` + * :c:data:`psi_occ_pattern_hii` + * :c:data:`state_average_weight` + * :c:data:`mo_num` + * :c:data:`nthreads_pt2` + * :c:data:`elec_alpha_num` + * :c:data:`pt2_e0_denominator` + * :c:data:`qp_max_mem` + * :c:data:`n_states_diag` + * :c:data:`s2_eig` * :c:data:`threshold_generators` + * :c:data:`det_to_occ_pattern` + * :c:data:`n_states` + * :c:data:`pt2_f` + * :c:data:`n_det_generators` + * :c:data:`n_int` + * :c:data:`psi_det_hii` Called by: @@ -1661,9 +1668,11 @@ Subroutines / functions .. hlist:: :columns: 3 + * :c:func:`check_mem` * :c:func:`davidson_slave_tcp` * :c:func:`mpi_print` * :c:func:`omp_set_nested` + * :c:func:`resident_memory` * :c:func:`run_pt2_slave` * :c:func:`run_selection_slave` * :c:func:`sleep` @@ -1832,13 +1841,12 @@ Subroutines / functions * :c:data:`n_states` * :c:data:`n_det` * :c:data:`psi_bilinear_matrix_transp_values` - * :c:data:`elec_alpha_num` + * :c:data:`psi_bilinear_matrix_values` * :c:data:`n_det_selectors` * :c:data:`psi_bilinear_matrix_transp_values` * :c:data:`psi_bilinear_matrix_values` * :c:data:`n_int` * :c:data:`psi_det_generators` - * :c:data:`psi_bilinear_matrix_values` * :c:data:`psi_det_alpha_unique` * :c:data:`psi_det_sorted` * :c:data:`psi_det_sorted` @@ -1859,7 +1867,6 @@ Subroutines / functions * :c:func:`apply_hole` * :c:func:`bitstring_to_list_ab` - * :c:func:`check_mem` * :c:func:`fill_buffer_double` * :c:func:`get_excitation_degree_spin` * :c:func:`isort` @@ -2103,14 +2110,15 @@ Subroutines / functions * :c:data:`pt2_stoch_istate` * :c:data:`psi_selectors` * :c:data:`psi_bilinear_matrix_values` - * :c:data:`psi_det_alpha_unique` + * :c:data:`psi_occ_pattern_hii` * :c:data:`pt2_e0_denominator` * :c:data:`pt2_n_teeth` * :c:data:`psi_selectors_coef_transp` * :c:data:`n_det` + * :c:data:`mo_two_e_integrals_in_map` * :c:data:`s2_eig` * :c:data:`pt2_j` - * :c:data:`mo_two_e_integrals_in_map` + * :c:data:`psi_det_alpha_unique` * :c:data:`psi_bilinear_matrix_transp_values` * :c:data:`state_average_weight` * :c:data:`mo_num` @@ -2119,16 +2127,18 @@ Subroutines / functions * :c:data:`mo_one_e_integrals` * :c:data:`elec_alpha_num` * :c:data:`nproc` + * :c:data:`qp_max_mem` * :c:data:`psi_bilinear_matrix_columns_loc` * :c:data:`threshold_generators` * :c:data:`psi_det_beta_unique` - * :c:data:`qp_max_mem` + * :c:data:`det_to_occ_pattern` * :c:data:`psi_bilinear_matrix_transp_rows_loc` * :c:data:`n_states` * :c:data:`pt2_f` * :c:data:`n_det_generators` * :c:data:`psi_bilinear_matrix_transp_values` * :c:data:`n_int` + * :c:data:`psi_det_hii` * :c:data:`pt2_j` * :c:data:`psi_det_sorted` * :c:data:`pt2_w` diff --git a/docs/source/modules/cis.rst b/docs/source/modules/cis.rst index 10700afb..7943d7ce 100644 --- a/docs/source/modules/cis.rst +++ b/docs/source/modules/cis.rst @@ -8,34 +8,39 @@ cis === -This module contains a CIS program. +This module contains a |CIS| program. The user point of view ---------------------- -The :command:`cis` program performs the CI of the ROHF-like + all single excitations on top of it. -This program can be very useful to : +The :ref:`cis` program performs the CI to obtain the ROHF reference + all +single excitations on top of it. This program can be very useful to: -* **Ground state calculations**: generate a guess for the ground state wave function if one is not sure that the :c:func:`scf` program gave the lowest SCF solution. In combination with :c:func:`save_natorb` it can produce new |MOs| in order to reperform an :c:func:`scf` optimization. +* **Ground state calculations**: generate a guess for the ground state wave + function if one is not sure that the :ref:`scf` program gave the lowest |SCF| + solution. In combination with :ref:`save_natorb` it can produce new |MOs| in + order to reperform an :ref:`scf` optimization. -* **Excited states calculations**: generate guess for all the :option:`determinants n_states` wave functions, that will be used by the :c:func:`fci` program. +* **Excited states calculations**: generate guesses for all the + :option:`determinants n_states` wave functions, that will be used by the + :ref:`fci` program. The main keywords/options to be used are: -* :option:`determinants n_states` : number of states to consider for the |CIS| calculation +* :option:`determinants n_states`: number of states to consider for the |CIS| calculation -* :option:`determinants s2_eig` : force all states to have the desired value of :math:`S^2` +* :option:`determinants s2_eig`: force all states to have the desired value of |S^2| -* :option:`determinants expected_s2` : desired value of :math:`S^2` +* :option:`determinants expected_s2`: desired value of |S^2| -The programmer point of view ----------------------------- +The programmer's point of view +------------------------------ -This module have been built by setting the following rules: +This module was built by setting the following rules: * The only generator determinant is the Hartree-Fock (single-reference method) * All generated singly excited determinants are included in the wave function (no perturbative diff --git a/docs/source/modules/davidson.rst b/docs/source/modules/davidson.rst index b29d42ff..9a4eab1e 100644 --- a/docs/source/modules/davidson.rst +++ b/docs/source/modules/davidson.rst @@ -9,15 +9,22 @@ davidson ======== Abstract module for Davidson's diagonalization. -It contains everything required for the Davidson algorithm, dressed or not. If -a dressing is used, the dressing column should be defined and the -:ref:`davidson_dressed` module should be used. If no dressing is required, -the :ref:`davidson` module should be used, and it has a default zero dressing vector. +It contains everything required for the Davidson algorithm, dressed or +not. If a dressing is used, the dressing column should be defined and +the :ref:`module_davidson_dressed` module should be used. If no dressing +is required, the :ref:`module_davidson` module should be used, and it +has a default zero dressing vector. The important providers for that module are: -# `psi_energy` which is the expectation value over the wave function (`psi_det`, `psi_coef`) of the Hamiltonian, dressed or not. It uses the general subroutine `u_0_H_u_0`. -# `psi_energy_two_e` which is the expectation value over the wave function (`psi_det`, `psi_coef`) of the standard two-electrons coulomb operator. It uses the general routine `u_0_H_u_0_two_e`. +#. :c:data:`psi_energy` which is the expectation value over the wave + function (:c:data:`psi_det`, :c:data:`psi_coef`) of the Hamiltonian, + dressed or not. It uses the general subroutine :c:func:`u_0_H_u_0`. + +#. :c:data:`psi_energy_two_e` which is the expectation value over the + wave function (:c:data:`psi_det`, :c:data:`psi_coef`) of the standard + two-electron Coulomb operator. It uses the general routine + :c:func:`u_0_H_u_0_two_e`. @@ -40,7 +47,7 @@ EZFIO parameters Number of micro-iterations before re-contracting - Default: 8 + Default: 15 .. option:: state_following @@ -585,7 +592,6 @@ Subroutines / functions * :c:data:`psi_det_beta_unique` * :c:data:`only_expected_s2` * :c:data:`distributed_davidson` - * :c:data:`n_states` * :c:data:`n_int` Called by: @@ -626,7 +632,6 @@ Subroutines / functions .. hlist:: :columns: 3 - * :c:data:`n_states_diag` * :c:data:`nthreads_davidson` @@ -682,7 +687,6 @@ Subroutines / functions .. hlist:: :columns: 3 - * :c:data:`n_states_diag` * :c:data:`nthreads_davidson` @@ -696,7 +700,7 @@ Subroutines / functions subroutine davidson_pull_results(zmq_socket_pull, v_t, s_t, imin, imax, task_id) - Pull the results of $H|U \rangle$ on the master. + Pull the results of $H | U \rangle$ on the master. Needs: @@ -724,7 +728,7 @@ Subroutines / functions subroutine davidson_push_results(zmq_socket_push, v_t, s_t, imin, imax, task_id) - Push the results of $H|U \rangle$ from a worker to the master. + Push the results of $H | U \rangle$ from a worker to the master. Needs: @@ -850,6 +854,7 @@ Subroutines / functions :columns: 3 * :c:data:`psi_det_beta_unique` + * :c:data:`mpi_rank` * :c:data:`psi_bilinear_matrix_order_transp_reverse` * :c:data:`psi_det_alpha_unique` * :c:data:`mpi_initialized` @@ -858,6 +863,7 @@ Subroutines / functions * :c:data:`psi_bilinear_matrix_values` * :c:data:`nproc` * :c:data:`ref_bitmask_energy` + * :c:data:`n_states_diag` * :c:data:`psi_bilinear_matrix_columns_loc` Called by: @@ -874,7 +880,6 @@ Subroutines / functions * :c:func:`davidson_push_results` * :c:func:`h_s2_u_0_nstates_openmp_work` - * :c:func:`sleep` .. c:function:: diagonalize_ci: @@ -934,7 +939,7 @@ Subroutines / functions subroutine H_S2_u_0_nstates_openmp(v_0,s_0,u_0,N_st,sze) - Computes $v_0 = H|u_0\rangle$ and $s_0 = S^2 |u_0\rangle$. + Computes $v_0 = H | u_0\rangle$ and $s_0 = S^2 | u_0\rangle$. Assumes that the determinants are in psi_det @@ -977,7 +982,7 @@ Subroutines / functions subroutine H_S2_u_0_nstates_openmp_work(v_t,s_t,u_t,N_st,sze,istart,iend,ishift,istep) - Computes $v_t = H|u_t\rangle$ and $s_t = S^2 |u_t\rangle$ + Computes $v_t = H | u_t\rangle$ and $s_t = S^2 | u_t\rangle$ Default should be 1,N_det,0,1 @@ -1020,7 +1025,7 @@ Subroutines / functions subroutine H_S2_u_0_nstates_openmp_work_1(v_t,s_t,u_t,N_st,sze,istart,iend,ishift,istep) - Computes $v_t = H|u_t angle$ and $s_t = S^2 |u_t angle$ + Computes $v_t = H | u_t \rangle$ and $s_t = S^2 | u_t\rangle$ Default should be 1,N_det,0,1 @@ -1072,7 +1077,7 @@ Subroutines / functions subroutine H_S2_u_0_nstates_openmp_work_2(v_t,s_t,u_t,N_st,sze,istart,iend,ishift,istep) - Computes $v_t = H|u_t angle$ and $s_t = S^2 |u_t angle$ + Computes $v_t = H | u_t \rangle$ and $s_t = S^2 | u_t\rangle$ Default should be 1,N_det,0,1 @@ -1124,7 +1129,7 @@ Subroutines / functions subroutine H_S2_u_0_nstates_openmp_work_3(v_t,s_t,u_t,N_st,sze,istart,iend,ishift,istep) - Computes $v_t = H|u_t angle$ and $s_t = S^2 |u_t angle$ + Computes $v_t = H | u_t \rangle$ and $s_t = S^2 | u_t\rangle$ Default should be 1,N_det,0,1 @@ -1176,7 +1181,7 @@ Subroutines / functions subroutine H_S2_u_0_nstates_openmp_work_4(v_t,s_t,u_t,N_st,sze,istart,iend,ishift,istep) - Computes $v_t = H|u_t angle$ and $s_t = S^2 |u_t angle$ + Computes $v_t = H | u_t \rangle$ and $s_t = S^2 | u_t\rangle$ Default should be 1,N_det,0,1 @@ -1228,7 +1233,7 @@ Subroutines / functions subroutine H_S2_u_0_nstates_openmp_work_N_int(v_t,s_t,u_t,N_st,sze,istart,iend,ishift,istep) - Computes $v_t = H|u_t angle$ and $s_t = S^2 |u_t angle$ + Computes $v_t = H | u_t \rangle$ and $s_t = S^2 | u_t\rangle$ Default should be 1,N_det,0,1 @@ -1280,13 +1285,13 @@ Subroutines / functions subroutine H_S2_u_0_nstates_zmq(v_0,s_0,u_0,N_st,sze) - Computes $v_0 = H|u_0\rangle$ and $s_0 = S^2 |u_0\rangle$ + Computes $v_0 = H | u_0\rangle$ and $s_0 = S^2 | u_0\rangle$ n : number of determinants - H_jj : array of $\langle j|H|j \rangle$ + H_jj : array of $\langle j | H | j \rangle$ - S2_jj : array of $\langle j|S^2|j \rangle$ + S2_jj : array of $\langle j | S^2 | j \rangle$ Needs: @@ -1303,7 +1308,6 @@ Subroutines / functions * :c:data:`psi_bilinear_matrix_values` * :c:data:`nproc` * :c:data:`ref_bitmask_energy` - * :c:data:`n_states_diag` * :c:data:`psi_bilinear_matrix_columns_loc` Called by: @@ -1327,13 +1331,6 @@ Subroutines / functions * :c:func:`new_parallel_job` * :c:func:`omp_set_nested` - Touches: - - .. hlist:: - :columns: 3 - - * :c:data:`n_states_diag` - .. c:function:: h_s2_u_0_two_e_nstates_openmp: @@ -1345,7 +1342,7 @@ Subroutines / functions subroutine H_S2_u_0_two_e_nstates_openmp(v_0,s_0,u_0,N_st,sze) - Computes $v_0 = H|u_0\rangle$ and $s_0 = S^2 |u_0\rangle$ + Computes $v_0 = H | u_0\rangle$ and $s_0 = S^2 | u_0\rangle$ Assumes that the determinants are in psi_det @@ -1387,7 +1384,7 @@ Subroutines / functions subroutine H_S2_u_0_two_e_nstates_openmp_work(v_t,s_t,u_t,N_st,sze,istart,iend,ishift,istep) - Computes $v_t = H|u_t\rangle$ and $s_t = S^2 |u_t\rangle$ + Computes $v_t = H | u_t\rangle$ and $s_t = S^2 | u_t\rangle$ Default should be 1,N_det,0,1 @@ -1429,7 +1426,7 @@ Subroutines / functions subroutine H_S2_u_0_two_e_nstates_openmp_work_1(v_t,s_t,u_t,N_st,sze,istart,iend,ishift,istep) - Computes $v_t = H|u_t angle$ and $s_t = S^2 |u_t angle$ + Computes $v_t = H | u_t \rangle$ and $s_t = S^2 | u_t \rangle$ Default should be 1,N_det,0,1 @@ -1479,7 +1476,7 @@ Subroutines / functions subroutine H_S2_u_0_two_e_nstates_openmp_work_2(v_t,s_t,u_t,N_st,sze,istart,iend,ishift,istep) - Computes $v_t = H|u_t angle$ and $s_t = S^2 |u_t angle$ + Computes $v_t = H | u_t \rangle$ and $s_t = S^2 | u_t \rangle$ Default should be 1,N_det,0,1 @@ -1529,7 +1526,7 @@ Subroutines / functions subroutine H_S2_u_0_two_e_nstates_openmp_work_3(v_t,s_t,u_t,N_st,sze,istart,iend,ishift,istep) - Computes $v_t = H|u_t angle$ and $s_t = S^2 |u_t angle$ + Computes $v_t = H | u_t \rangle$ and $s_t = S^2 | u_t \rangle$ Default should be 1,N_det,0,1 @@ -1579,7 +1576,7 @@ Subroutines / functions subroutine H_S2_u_0_two_e_nstates_openmp_work_4(v_t,s_t,u_t,N_st,sze,istart,iend,ishift,istep) - Computes $v_t = H|u_t angle$ and $s_t = S^2 |u_t angle$ + Computes $v_t = H | u_t \rangle$ and $s_t = S^2 | u_t \rangle$ Default should be 1,N_det,0,1 @@ -1629,7 +1626,7 @@ Subroutines / functions subroutine H_S2_u_0_two_e_nstates_openmp_work_N_int(v_t,s_t,u_t,N_st,sze,istart,iend,ishift,istep) - Computes $v_t = H|u_t angle$ and $s_t = S^2 |u_t angle$ + Computes $v_t = H | u_t \rangle$ and $s_t = S^2 | u_t \rangle$ Default should be 1,N_det,0,1 @@ -1679,9 +1676,9 @@ Subroutines / functions subroutine u_0_H_u_0(e_0,s_0,u_0,n,keys_tmp,Nint,N_st,sze) - Computes $E_0 = \frac{\langle u_0|H|u_0 \rangle}{\langle u_0|u_0 \rangle}$ + Computes $E_0 = \frac{\langle u_0 | H | u_0 \rangle}{\langle u_0 | u_0 \rangle}$ - and $S_0 = \frac{\langle u_0|S^2|u_0 \rangle}{\langle u_0|u_0 \rangle}$ + and $S_0 = \frac{\langle u_0 | S^2 | u_0 \rangle}{\langle u_0 | u_0 \rangle}$ n : number of determinants @@ -1692,7 +1689,6 @@ Subroutines / functions :columns: 3 * :c:data:`n_states_diag` - * :c:data:`n_states` * :c:data:`distributed_davidson` Called by: @@ -1710,13 +1706,6 @@ Subroutines / functions * :c:func:`h_s2_u_0_nstates_openmp` * :c:func:`h_s2_u_0_nstates_zmq` - Touches: - - .. hlist:: - :columns: 3 - - * :c:data:`n_states_diag` - .. c:function:: u_0_h_u_0_two_e: @@ -1728,7 +1717,7 @@ Subroutines / functions subroutine u_0_H_u_0_two_e(e_0,u_0,n,keys_tmp,Nint,N_st,sze) - Computes $E_0 = \frac{ \langle u_0|H|u_0\rangle}{\langle u_0|u_0 \rangle}$. + Computes $E_0 = \frac{ \langle u_0 | H | u_0\rangle}{\langle u_0 | u_0 \rangle}$. n : number of determinants diff --git a/docs/source/modules/density_for_dft.rst b/docs/source/modules/density_for_dft.rst index 28708f69..ad42369b 100644 --- a/docs/source/modules/density_for_dft.rst +++ b/docs/source/modules/density_for_dft.rst @@ -9,12 +9,16 @@ density_for_dft =============== -This module defines the *provider* of the density used for the DFT related calculations. -This definition is done through the keyword :option:`density_for_dft density_for_dft`. -The density can be: +This module defines the *provider* of the density used for the |DFT| related +calculations. This definition is done through the keyword +:option:`density_for_dft density_for_dft`. The density can be: -* WFT : the density is computed with a potentially multi determinant wave function (see variables `psi_det` and `psi_det`)# input_density : the density is set to a density previously stored in the |EZFIO| folder (see ``aux_quantities``) -* damping_rs_dft : the density is damped between the input_density and the WFT density, with a damping factor of :option:`density_for_dft damping_for_rs_dft` +* `WFT`: the density is computed with a potentially multi determinant wave + function (see variables `psi_det` and `psi_det`)# input_density: the density + is set to a density previously stored in the |EZFIO| directory (see + ``aux_quantities``) +* `damping_rs_dft`: the density is damped between the input_density and the WFT + density, with a damping factor of :option:`density_for_dft damping_for_rs_dft` diff --git a/docs/source/modules/determinants.rst b/docs/source/modules/determinants.rst index e6f1ddd7..f3636982 100644 --- a/docs/source/modules/determinants.rst +++ b/docs/source/modules/determinants.rst @@ -13,15 +13,15 @@ Contains everything for the computation of the Hamiltonian matrix elements in th The main providers for this module are: * :option:`determinants n_states`: number of states to be computed -* `psi_det`: list of determinants in the wave function used in many routines/providers of the |QP|. -* `psi_coef`: list of coefficients, for all :option:`determinants n_states` states, and all determinants. +* :c:data:`psi_det`: list of determinants in the wave function used in many routines/providers of the |QP|. +* :c:data:`psi_coef`: list of coefficients, for all :option:`determinants n_states` states, and all determinants. The main routines for this module are: -* `i_H_j`: computes the Hamiltonian matrix element between two arbitrary Slater determinants. -* `i_H_j_s2`: computes the Hamiltonian and (:math:`S^2`) matrix element between two arbitrary Slater determinants. -* `i_H_j_verbose`: returns the decomposition in terms of one- and two-body components of the Hamiltonian matrix elements between two arbitrary Slater determinants. Also return the fermionic phase factor. -* `i_H_psi`: computes the Hamiltonian matrix element between an arbitrary Slater determinant and a wave function composed of a sum of arbitrary Slater determinants. +* :c:func:`i_H_j`: computes the Hamiltonian matrix element between two arbitrary Slater determinants. +* :c:func:`i_H_j_s2`: computes the Hamiltonian and (|S^2|) matrix element between two arbitrary Slater determinants. +* :c:func:`i_H_j_verbose`: returns the decomposition in terms of one- and two-body components of the Hamiltonian matrix elements between two arbitrary Slater determinants. Also return the fermionic phase factor. +* :c:func:`i_H_psi`: computes the Hamiltonian matrix element between an arbitrary Slater determinant and a wave function composed of a sum of arbitrary Slater determinants. For an example of how to use these routines and providers, take a look at :file:`example.irp.f`. @@ -81,12 +81,12 @@ EZFIO parameters .. option:: n_int - Number of integers required to represent bitstrings (set in module :ref:`bitmask`) + Number of integers required to represent bitstrings (set in module :ref:`module_bitmask`) .. option:: bit_kind - (set in module :ref:`bitmask`) + (set in module :ref:`module_bitmask`) .. option:: mo_label diff --git a/docs/source/modules/dft_utils_in_r.rst b/docs/source/modules/dft_utils_in_r.rst index 4a011cc8..3e3fd5f1 100644 --- a/docs/source/modules/dft_utils_in_r.rst +++ b/docs/source/modules/dft_utils_in_r.rst @@ -769,13 +769,19 @@ Subroutines / functions subroutine density_and_grad_alpha_beta_and_all_aos_and_grad_aos_at_r(r,dm_a,dm_b, grad_dm_a, grad_dm_b, aos_array, grad_aos_array) - input : r(1) ==> r(1) = x, r(2) = y, r(3) = z - output : dm_a = alpha density evaluated at r - : dm_b = beta density evaluated at r - : aos_array(i) = ao(i) evaluated at r - : grad_dm_a(1) = X gradient of the alpha density evaluated in r - : grad_dm_a(1) = X gradient of the beta density evaluated in r - : grad_aos_array(1) = X gradient of the aos(i) evaluated at r + input: + + * r(1) ==> r(1) = x, r(2) = y, r(3) = z + + output: + + * dm_a = alpha density evaluated at r + * dm_b = beta density evaluated at r + * aos_array(i) = ao(i) evaluated at r + * grad_dm_a(1) = X gradient of the alpha density evaluated in r + * grad_dm_a(1) = X gradient of the beta density evaluated in r + * grad_aos_array(1) = X gradient of the aos(i) evaluated at r + Needs: diff --git a/docs/source/modules/fci.rst b/docs/source/modules/fci.rst index 2631511b..2d2bb639 100644 --- a/docs/source/modules/fci.rst +++ b/docs/source/modules/fci.rst @@ -15,43 +15,52 @@ fci The user point of view ---------------------- -* :c:func:`fci` performs |CIPSI| calculations using a stochastic scheme for both the selection and the |PT2| contribution, -* :c:func:`pt2` computes the |PT2| contribution using the wave function stored in the |EZFIO| - database. +* :ref:`fci` performs |CIPSI| calculations using a stochastic scheme for both + the selection and the |PT2| contribution, + +* :ref:`pt2` computes the |PT2| contribution using the wave function stored in + the |EZFIO| database. The main keywords/options for this module are: -* :option:`determinants n_det_max` : maximum number of Slater determinants in the CIPSI wave function. The :command:`fci` program will stop when the size of the CIPSI wave function will exceed :option:`determinants n_det_max`. +* :option:`determinants n_det_max` : maximum number of Slater determinants in + the |CIPSI| wave function. The :ref:`fci` program will stop when the size of + the |CIPSI| wave function will exceed :option:`determinants n_det_max`. -* :option:`perturbation pt2_max` : absolute value of the |PT2| to stop the CIPSI calculation. Once the |PT2| :math:`<` :option:`perturbation pt2_max`, the CIPSI calculation stops. +* :option:`perturbation pt2_max` : absolute value of the |PT2| to stop the + |CIPSI| calculation. Once the abs(|PT2|) :math:`<` :option:`perturbation pt2_max`, + the |CIPSI| calculation stops. -* :option:`determinants n_states` : number of states to consider in the CIPSI calculation. +* :option:`determinants n_states` : number of states to consider in the |CIPSI| + calculation. -* :option:`determinants read_wf` : if False, starts with a ROHF-like determinant, if True, starts with the current wave function(s) stored in the |EZFIO| folder. +* :option:`determinants read_wf` : if |false|, starts with a |ROHF|-like + determinant, if |true|, starts with the current wave function(s) stored in + the |EZFIO| directory. .. note:: - For a multi-state calculation, it is recommended to start with :c:func:`cis` or :c:func:`cisd` - wave functions as a guess. + For a multi-state calculation, it is recommended to start with :ref:`cis` + or :ref:`cisd` wave functions as a guess. -* :option:`determinants s2_eig` : if True, systematically add all the determinants needed to have a pure value of :math:`S^2`. Also, if True, it tracks only the states having the good :option:`determinants expected_s2`. +* :option:`determinants expected_s2` : expected value of |S^2| for the + desired spin multiplicity. -.. note:: - For a multi-state calculation, it is recommended to start with :c:func:`cis` or :c:func:`cisd` - wave functions as a guess. - -* :option:`determinants expected_s2` : expected value of :math:`S^2` for the desired spin multiplicity. +* :option:`determinants s2_eig` : if |true|, systematically add all the + determinants needed to have a pure value of |S^2|. Also, if |true|, it + tracks only the states having the good :option:`determinants expected_s2`. -The programmer point of view ----------------------------- -This module have been created with the :ref:`cipsi` module. +The programmer's point of view +------------------------------ + +This module was created with the :ref:`module_cipsi` module. .. seealso:: - The documentation of the :ref:`cipsi` module. + The documentation of the :ref:`module_cipsi` module. diff --git a/docs/source/modules/hartree_fock.rst b/docs/source/modules/hartree_fock.rst index 9f818166..f8aa5135 100644 --- a/docs/source/modules/hartree_fock.rst +++ b/docs/source/modules/hartree_fock.rst @@ -14,9 +14,9 @@ calculations (the spatial part of the |MOs| is common for alpha and beta spinorbitals). The Hartree-Fock algorithm is a |SCF| and therefore is based on the -:ref:`module_scf_utils`` module. +:ref:`module_scf_utils` module. -The Fock matrix is defined in :file:`hartree_fock fock_matrix_hf.irp.f`. +The Fock matrix is defined in :file:`fock_matrix_hf.irp.f`. diff --git a/docs/source/modules/mo_basis.rst b/docs/source/modules/mo_basis.rst index 2038ca3a..aae2e481 100644 --- a/docs/source/modules/mo_basis.rst +++ b/docs/source/modules/mo_basis.rst @@ -562,9 +562,9 @@ Subroutines / functions Rotates the j-th |MO| with the k-th |MO| to give two new |MOs| that are - * $+ = \frac{1}{\sqrt{2}} (|j\rangle + |k\rangle)$ + * $+ = \frac{1}{\sqrt{2}} ( | j\rangle + | k\rangle)$ - * $- = \frac{1}{\sqrt{2}} (|j\rangle - |k\rangle)$ + * $- = \frac{1}{\sqrt{2}} ( | j\rangle - | k\rangle)$ by convention, the '+' |MO| is in the lowest index (min(j,k)) by convention, the '-' |MO| is in the highest index (max(j,k)) diff --git a/docs/source/modules/perturbation.rst b/docs/source/modules/perturbation.rst index fb144639..b933ca57 100644 --- a/docs/source/modules/perturbation.rst +++ b/docs/source/modules/perturbation.rst @@ -106,39 +106,6 @@ EZFIO parameters Providers --------- -.. c:function:: fill_h_apply_buffer_selection: - - - File : :file:`perturbation/selection.irp.f` - - .. code:: fortran - - subroutine fill_H_apply_buffer_selection(n_selected,det_buffer,e_2_pert_buffer,coef_pert_buffer, & - N_st,Nint,iproc,select_max_out) - - - Fill the H_apply buffer with determiants for the selection - - Needs: - - .. hlist:: - :columns: 3 - - * :c:data:`selection_criterion` - * :c:data:`h_apply_buffer_allocated` - * :c:data:`n_det` - * :c:data:`n_int` - - Calls: - - .. hlist:: - :columns: 3 - - * :c:func:`omp_set_lock` - * :c:func:`omp_unset_lock` - * :c:func:`resize_h_apply_buffer` - - .. c:var:: h0_type @@ -253,6 +220,38 @@ Providers Subroutines / functions ----------------------- +.. c:function:: fill_h_apply_buffer_selection: + + + File : :file:`perturbation/selection.irp.f` + + .. code:: fortran + + subroutine fill_H_apply_buffer_selection(n_selected,det_buffer,e_2_pert_buffer,coef_pert_buffer, N_st,Nint,iproc,select_max_out) + + + Fill the H_apply buffer with determiants for the selection + + Needs: + + .. hlist:: + :columns: 3 + + * :c:data:`selection_criterion` + * :c:data:`h_apply_buffer_allocated` + * :c:data:`n_det` + * :c:data:`n_int` + + Calls: + + .. hlist:: + :columns: 3 + + * :c:func:`omp_set_lock` + * :c:func:`omp_unset_lock` + * :c:func:`resize_h_apply_buffer` + + .. c:function:: perturb_buffer_by_mono_dummy: @@ -263,7 +262,7 @@ Subroutines / functions subroutine perturb_buffer_by_mono_dummy(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,key_mask,fock_diag_tmp,electronic_energy) - Applly pertubration ``dummy`` to the buffer of determinants generated in the H_apply + Apply pertubration ``dummy`` to the buffer of determinants generated in the H_apply routine. Needs: @@ -298,7 +297,7 @@ Subroutines / functions subroutine perturb_buffer_by_mono_epstein_nesbet(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,key_mask,fock_diag_tmp,electronic_energy) - Applly pertubration ``epstein_nesbet`` to the buffer of determinants generated in the H_apply + Apply pertubration ``epstein_nesbet`` to the buffer of determinants generated in the H_apply routine. Needs: @@ -333,7 +332,7 @@ Subroutines / functions subroutine perturb_buffer_by_mono_epstein_nesbet_2x2(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,key_mask,fock_diag_tmp,electronic_energy) - Applly pertubration ``epstein_nesbet_2x2`` to the buffer of determinants generated in the H_apply + Apply pertubration ``epstein_nesbet_2x2`` to the buffer of determinants generated in the H_apply routine. Needs: @@ -368,7 +367,7 @@ Subroutines / functions subroutine perturb_buffer_by_mono_epstein_nesbet_2x2_no_ci_diag(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,key_mask,fock_diag_tmp,electronic_energy) - Applly pertubration ``epstein_nesbet_2x2_no_ci_diag`` to the buffer of determinants generated in the H_apply + Apply pertubration ``epstein_nesbet_2x2_no_ci_diag`` to the buffer of determinants generated in the H_apply routine. Needs: @@ -403,7 +402,7 @@ Subroutines / functions subroutine perturb_buffer_by_mono_moller_plesset(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,key_mask,fock_diag_tmp,electronic_energy) - Applly pertubration ``moller_plesset`` to the buffer of determinants generated in the H_apply + Apply pertubration ``moller_plesset`` to the buffer of determinants generated in the H_apply routine. Needs: @@ -438,7 +437,7 @@ Subroutines / functions subroutine perturb_buffer_by_mono_qdpt(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,key_mask,fock_diag_tmp,electronic_energy) - Applly pertubration ``qdpt`` to the buffer of determinants generated in the H_apply + Apply pertubration ``qdpt`` to the buffer of determinants generated in the H_apply routine. Needs: @@ -473,7 +472,7 @@ Subroutines / functions subroutine perturb_buffer_dummy(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,key_mask,fock_diag_tmp,electronic_energy) - Applly pertubration ``dummy`` to the buffer of determinants generated in the H_apply + Apply pertubration ``dummy`` to the buffer of determinants generated in the H_apply routine. Needs: @@ -509,7 +508,7 @@ Subroutines / functions subroutine perturb_buffer_epstein_nesbet(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,key_mask,fock_diag_tmp,electronic_energy) - Applly pertubration ``epstein_nesbet`` to the buffer of determinants generated in the H_apply + Apply pertubration ``epstein_nesbet`` to the buffer of determinants generated in the H_apply routine. Needs: @@ -545,7 +544,7 @@ Subroutines / functions subroutine perturb_buffer_epstein_nesbet_2x2(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,key_mask,fock_diag_tmp,electronic_energy) - Applly pertubration ``epstein_nesbet_2x2`` to the buffer of determinants generated in the H_apply + Apply pertubration ``epstein_nesbet_2x2`` to the buffer of determinants generated in the H_apply routine. Needs: @@ -581,7 +580,7 @@ Subroutines / functions subroutine perturb_buffer_epstein_nesbet_2x2_no_ci_diag(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,key_mask,fock_diag_tmp,electronic_energy) - Applly pertubration ``epstein_nesbet_2x2_no_ci_diag`` to the buffer of determinants generated in the H_apply + Apply pertubration ``epstein_nesbet_2x2_no_ci_diag`` to the buffer of determinants generated in the H_apply routine. Needs: @@ -617,7 +616,7 @@ Subroutines / functions subroutine perturb_buffer_moller_plesset(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,key_mask,fock_diag_tmp,electronic_energy) - Applly pertubration ``moller_plesset`` to the buffer of determinants generated in the H_apply + Apply pertubration ``moller_plesset`` to the buffer of determinants generated in the H_apply routine. Needs: @@ -653,7 +652,7 @@ Subroutines / functions subroutine perturb_buffer_qdpt(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,key_mask,fock_diag_tmp,electronic_energy) - Applly pertubration ``qdpt`` to the buffer of determinants generated in the H_apply + Apply pertubration ``qdpt`` to the buffer of determinants generated in the H_apply routine. Needs: diff --git a/docs/source/modules/scf_utils.rst b/docs/source/modules/scf_utils.rst index 5b06d6d0..3ab72f78 100644 --- a/docs/source/modules/scf_utils.rst +++ b/docs/source/modules/scf_utils.rst @@ -192,11 +192,11 @@ Providers .. code:: fortran - subroutine extrapolate_Fock_matrix( & - error_matrix_DIIS,Fock_matrix_DIIS, & - Fock_matrix_AO_,size_Fock_matrix_AO, & - iteration_SCF,dim_DIIS & -) + subroutine extrapolate_Fock_matrix( & + error_matrix_DIIS,Fock_matrix_DIIS, & + Fock_matrix_AO_,size_Fock_matrix_AO, & + iteration_SCF,dim_DIIS & + ) Compute the extrapolated Fock matrix using the DIIS procedure diff --git a/docs/source/modules/selectors_cassd.rst b/docs/source/modules/selectors_cassd.rst index 57704d5c..0740d91e 100644 --- a/docs/source/modules/selectors_cassd.rst +++ b/docs/source/modules/selectors_cassd.rst @@ -9,5 +9,5 @@ selectors_cassd =============== Selectors for |CAS-SD| calculations. The selectors are defined as first the -generators from :ref:`Generators_CAS`, and then the rest of the wave function. +generators from :ref:`module_generators_cas`, and then the rest of the wave function. diff --git a/docs/source/modules/utils.rst b/docs/source/modules/utils.rst index d2c76ba2..775cfc0d 100644 --- a/docs/source/modules/utils.rst +++ b/docs/source/modules/utils.rst @@ -855,8 +855,8 @@ Subroutines / functions * :c:func:`remove_duplicates_in_selection_buffer` * :c:func:`run_cipsi` * :c:func:`run_pt2_slave` + * :c:func:`run_slave_main` * :c:func:`run_stochastic_cipsi` - * :c:func:`select_singles_and_doubles` * :c:func:`selection_collector` * :c:func:`sort_selection_buffer` * :c:func:`testteethbuilding` @@ -2651,6 +2651,7 @@ Subroutines / functions * :c:func:`check_mem` * :c:func:`davidson_diag_hjj_sjj` * :c:func:`print_memory_usage` + * :c:func:`run_slave_main` * :c:func:`zmq_pt2` Calls: diff --git a/docs/source/programmers_guide/conventions.rst b/docs/source/programmers_guide/conventions.rst index ecd6d6b0..33fd810a 100644 --- a/docs/source/programmers_guide/conventions.rst +++ b/docs/source/programmers_guide/conventions.rst @@ -107,7 +107,7 @@ Only standard Fortran is allowed : Intel or GNU extensions are forbidden. The name of a program should be the same as the name of the file. For example, for the :ref:`fci` program, we have -.. code-block:: fortan +.. code-block:: fortran program fci diff --git a/docs/source/programmers_guide/ezfio.rst b/docs/source/programmers_guide/ezfio.rst index e96883bb..1eece851 100644 --- a/docs/source/programmers_guide/ezfio.rst +++ b/docs/source/programmers_guide/ezfio.rst @@ -8,7 +8,7 @@ EZFIO.cfg The simplest way to add control parameters in the |EZFIO| directory is to create a :file:`EZFIO.cfg` file in the module. An example can be found in existing modules -such as :ref:`hartree_fock`:: +such as :ref:`module_hartree_fock`:: [max_dim_diis] type: integer @@ -92,7 +92,7 @@ Optional It is possible to directly add to the current module |EZFIO| configuration files, named with the ``.ezfio_config`` suffix. An example is in the -:ref:`bitmask` module. +:ref:`module_bitmask` module. .. code:: text diff --git a/docs/source/programmers_guide/index_providers.rst b/docs/source/programmers_guide/index_providers.rst index 1b296fff..c9d65302 100644 --- a/docs/source/programmers_guide/index_providers.rst +++ b/docs/source/programmers_guide/index_providers.rst @@ -226,7 +226,6 @@ Index of Providers * :c:data:`ezfio_work_dir` * :c:data:`fact_inv` * :c:data:`file_lock` -* :c:data:`fill_h_apply_buffer_selection` * :c:data:`final_grid_points` * :c:data:`final_weight_at_r` * :c:data:`final_weight_at_r_vector` @@ -606,7 +605,6 @@ Index of Providers * :c:data:`psi_selectors_coef_transp` * :c:data:`psi_selectors_diag_h_mat` * :c:data:`psi_selectors_size` -* :c:data:`pt2_collector` * :c:data:`pt2_cw` * :c:data:`pt2_e0_denominator` * :c:data:`pt2_f` @@ -907,6 +905,7 @@ Index of Subroutines/Functions * :c:func:`fcidump` * :c:func:`fill_buffer_double` * :c:func:`fill_h_apply_buffer_no_selection` +* :c:func:`fill_h_apply_buffer_selection` * :c:func:`filter_connected` * :c:func:`filter_connected_i_h_psi0` * :c:func:`filter_not_connected` @@ -1198,6 +1197,7 @@ Index of Subroutines/Functions * :c:func:`provide_all_mo_integrals_erf` * :c:func:`provide_everything` * :c:func:`pt2` +* :c:func:`pt2_collector` * :c:func:`pt2_dummy` * :c:func:`pt2_epstein_nesbet` * :c:func:`pt2_epstein_nesbet_2x2` diff --git a/docs/source/programs/cis.rst b/docs/source/programs/cis.rst index ffbadf5f..4f496254 100644 --- a/docs/source/programs/cis.rst +++ b/docs/source/programs/cis.rst @@ -20,25 +20,22 @@ cis This program can be useful in many cases: - Ground state calculation - ------------------------ + 1. Ground state calculation - To be sure to have the lowest |SCF| solution, perform an :ref:`scf` - (see the :ref:`hartree_fock` module), then a :ref:`cis`, save - the natural orbitals (see :ref:`save_natorb`) and re-run an - :ref:`scf` optimization from this |MO| guess. + To be sure to have the lowest |SCF| solution, perform an :ref:`scf` + (see the :ref:`module_hartree_fock` module), then a :ref:`cis`, save the + natural orbitals (see :ref:`save_natorb`) and re-run an :ref:`scf` + optimization from this |MO| guess. - Excited states calculations - --------------------------- + 2. Excited states calculations - The lowest excited states are much likely to be dominated by - single-excitations. Therefore, running a :ref:`cis` will save - the `n_states` lowest states within the |CIS| space in the |EZFIO| - directory, which can afterwards be used as guess wave functions for - a further multi-state |FCI| calculation if :option:`determinants read_wf` - is set to |true| before running the :ref:`fci` - executable. + The lowest excited states are much likely to be dominated by + single-excitations. Therefore, running a :ref:`cis` will save the + `n_states` lowest states within the |CIS| space in the |EZFIO| + directory, which can afterwards be used as guess wave functions for + a further multi-state |FCI| calculation if :option:`determinants + read_wf` is set to |true| before running the :ref:`fci` executable. If :option:`determinants s2_eig` is set to |true|, the |CIS| diff --git a/docs/source/programs/cisd.rst b/docs/source/programs/cisd.rst index 8208dd06..8d3f5ab4 100644 --- a/docs/source/programs/cisd.rst +++ b/docs/source/programs/cisd.rst @@ -19,7 +19,7 @@ cisd This program can be useful in many cases: - * GROUND STATE CALCULATION: if even after a :c:func:`cis` calculation, natural + * **Ground state calculation**: if even after a :c:func:`cis` calculation, natural orbitals (see :c:func:`save_natorb`) and then :c:func:`scf` optimization, you are not sure to have the lowest scf solution, do the same strategy with the :c:func:`cisd` executable instead of the :c:func:`cis` exectuable to generate the natural @@ -27,11 +27,11 @@ cisd - * EXCITED STATES CALCULATIONS: the lowest excited states are much likely to + * **Excited states calculations**: the lowest excited states are much likely to be dominanted by single- or double-excitations. Therefore, running a :c:func:`cisd` will save the "n_states" lowest states within the CISD space - in the EZFIO folder, which can afterward be used as guess wave functions + in the |EZFIO| directory, which can afterward be used as guess wave functions for a further multi-state fci calculation if you specify "read_wf" = True before running the fci executable (see :option:`determinants read_wf`). Also, if you specify "s2_eig" = True, the cisd will only retain states @@ -50,6 +50,7 @@ cisd * "act" orbitals where an electron can be either excited from or to * "del" orbitals which will be never occupied + Needs: diff --git a/docs/source/programs/diagonalize_h.rst b/docs/source/programs/diagonalize_h.rst index e21da7c0..cd1f9e7b 100644 --- a/docs/source/programs/diagonalize_h.rst +++ b/docs/source/programs/diagonalize_h.rst @@ -9,11 +9,14 @@ diagonalize_h - Program that extracts the :option:`determinants n_states` lowest states of the Hamiltonian within the set of Slater determinants stored in the EZFIO folder. + Program that extracts the :option:`determinants n_states` lowest + states of the Hamiltonian within the set of Slater determinants stored + in the |EZFIO| directory. - If :option:`determinants s2_eig` = True, it will retain only states + If :option:`determinants s2_eig` = |true|, it will retain only states + which correspond to the desired value of + :option:`determinants expected_s2`. - which corresponds to the desired value of :option:`determinants expected_s2`. Needs: diff --git a/docs/source/programs/fci.rst b/docs/source/programs/fci.rst index f4b8b268..5ebd7da9 100644 --- a/docs/source/programs/fci.rst +++ b/docs/source/programs/fci.rst @@ -21,7 +21,7 @@ fci conditions: * number of Slater determinants > :option:`determinants n_det_max` - * |PT2| < :option:`perturbation pt2_max` + * abs(|PT2|) less than :option:`perturbation pt2_max` The following other options can be of interest: @@ -38,7 +38,7 @@ fci :option:`determinants expected_s2`. For excited states calculations, it is recommended to start with - :ref:`.cis.` or :ref:`.cisd.` guess wave functions, eventually in + :ref:`cis` or :ref:`cisd` guess wave functions, eventually in a restricted set of |MOs|, and to set :option:`determinants s2_eig` to |true|. diff --git a/docs/source/programs/fcidump.rst b/docs/source/programs/fcidump.rst index b6e2a5b4..4e58a1ff 100644 --- a/docs/source/programs/fcidump.rst +++ b/docs/source/programs/fcidump.rst @@ -9,17 +9,22 @@ fcidump - Produce a regular FCIDUMP file from the |MOs| stored in the |EZFIO| folder. + Produce a regular `FCIDUMP` file from the |MOs| stored in the |EZFIO| + directory. - To specify an active space, the class of the mos have to set in the |EZFIO| folder (see :ref:`qp_set_mo_class`). + To specify an active space, the class of the |MOs| have to set in the + |EZFIO| directory (see :ref:`qp_set_mo_class`). - The fcidump program supports 3 types of MO_class : + The :ref:`fcidump` program supports 3 types of |MO| classes : - * the "core" orbitals which are always doubly occupied in the calculation + * the *core* orbitals which are always doubly occupied in the + calculation - * the "del" orbitals that are never occupied in the calculation + * the *deleted* orbitals that are never occupied in the calculation + + * the *active* orbitals that are occupied with a varying number of + electrons - * the "act" orbitals that will be occupied by a varying number of electrons Needs: diff --git a/docs/source/programs/four_idx_transform.rst b/docs/source/programs/four_idx_transform.rst index 953d7b1d..220433e1 100644 --- a/docs/source/programs/four_idx_transform.rst +++ b/docs/source/programs/four_idx_transform.rst @@ -9,11 +9,15 @@ four_idx_transform - 4-index transformation of two-electron integrals from |AO| to |MO| integrals. + 4-index transformation of two-electron integrals from |AO| to |MO| + integrals. - This program will compute the two-electron integrals on the |MO| basis and store it into the |EZFIO| folder. + This program will compute the two-electron integrals on the |MO| basis + and store it into the |EZFIO| directory. + + This program can be useful if the AO --> MO transformation is an + expensive step by itself. - This program can be useful if the AO --> MO transformation is an expensive step by itself. Needs: diff --git a/docs/source/programs/molden.rst b/docs/source/programs/molden.rst index 23830392..9611bac0 100644 --- a/docs/source/programs/molden.rst +++ b/docs/source/programs/molden.rst @@ -9,7 +9,7 @@ molden - Produce a Molden file + Produces a Molden file Needs: diff --git a/docs/source/programs/print_wf.rst b/docs/source/programs/print_wf.rst index 56f5b238..a141be09 100644 --- a/docs/source/programs/print_wf.rst +++ b/docs/source/programs/print_wf.rst @@ -9,13 +9,15 @@ print_wf - Print the ground state wave function stored in the |EZFIO| folder in the intermediate normalization. + Print the ground state wave function stored in the |EZFIO| directory + in the intermediate normalization. - It also prints a lot of information regarding the excitation operators from the reference determinant + It also prints a lot of information regarding the excitation + operators from the reference determinant ! and a first-order + perturbative analysis of the wave function. - and a first-order perturbative analysis of the wave function. - - If the wave function strongly deviates from the first-order analysis, something funny is going on :) + If the wave function strongly deviates from the first-order analysis, + something funny is going on :) Needs: diff --git a/docs/source/programs/pt2.rst b/docs/source/programs/pt2.rst index c18e466b..45726526 100644 --- a/docs/source/programs/pt2.rst +++ b/docs/source/programs/pt2.rst @@ -9,13 +9,18 @@ pt2 - Second order perturbative correction to the wave function contained in the EZFIO directory. + Second order perturbative correction to the wave function contained + in the |EZFIO| directory. - This programs runs the stochastic PT2 correction on all "n_states" wave function stored in the EZFIO folder (see :option:`determinant n_states`). + This programs runs the stochastic |PT2| correction on all + :option:`determinants n_states` wave functions stored in the |EZFIO| + directory. - The option for the PT2 correction are the "pt2_relative_error" which is the relative stochastic + The main option for the |PT2| correction is the + :option:`perturbation pt2_relative_error` which is the relative + stochastic error on the |PT2| to reach before stopping the + sampling. - error on the PT2 to reach before stopping the stochastic sampling. (see :option:`perturbation pt2_relative_error`) Needs: diff --git a/docs/source/programs/save_natorb.rst b/docs/source/programs/save_natorb.rst index 736e4178..852b1583 100644 --- a/docs/source/programs/save_natorb.rst +++ b/docs/source/programs/save_natorb.rst @@ -9,15 +9,16 @@ save_natorb - Save natural MOs into the EZFIO + Save natural |MOs| into the |EZFIO|. - This program reads the wave function stored in the EZFIO folder, + This program reads the wave function stored in the |EZFIO| directory, + extracts the corresponding natural orbitals and setd them as the new + |MOs|. - extracts the corresponding natural orbitals and set them as the new MOs - - If this is a multi-state calculation, the density matrix that produces the natural orbitals - - is obtained from a state-averaged of the density matrices of each state with the corresponding state_average_weight (see the doc of state_average_weight). + If this is a multi-state calculation, the density matrix that produces + the natural orbitals is obtained from an average of the density + matrices of each state with the corresponding + :option:`determinants state_average_weight` Needs: diff --git a/docs/source/programs/save_one_e_dm.rst b/docs/source/programs/save_one_e_dm.rst index bf8ec089..5758aad6 100644 --- a/docs/source/programs/save_one_e_dm.rst +++ b/docs/source/programs/save_one_e_dm.rst @@ -9,12 +9,16 @@ save_one_e_dm - programs that computes the one body density on the mo basis for alpha and beta electrons - from the wave function stored in the EZFIO folder, and then save it into the EZFIO folder aux_quantities. + Program that computes the one body density on the |MO| basis + for $\alpha$ and $\beta$ electrons from the wave function + stored in the |EZFIO| directory, and then saves it into the + :ref:`module_aux_quantities`. - Then, the global variable data_one_e_dm_alpha_mo and data_one_e_dm_beta_mo will automatically read this density in a further calculation. - - This can be used to perform damping on the density in RS-DFT calculation (see the density_for_dft module). + Then, the global variable :option:`aux_quantities data_one_e_dm_alpha_mo` + and :option:`aux_quantities data_one_e_dm_beta_mo` will automatically + read this density in the next calculation. This can be used to perform + damping on the density in |RSDFT| calculations (see + :ref:`module_density_for_dft`). Needs: diff --git a/docs/source/programs/write_integrals_erf.rst b/docs/source/programs/write_integrals_erf.rst index b940e8b4..43cf853d 100644 --- a/docs/source/programs/write_integrals_erf.rst +++ b/docs/source/programs/write_integrals_erf.rst @@ -9,7 +9,8 @@ write_integrals_erf - Saves the two-electron integrals with the :math:`erf(\mu r_{12})/r_{12}` oprerator into the EZFIO folder + Saves the two-electron integrals with the $erf(\mu r_{12})/r_{12}$ + oprerator into the EZFIO directory. Needs: diff --git a/docs/source/users_guide/interfaces.rst b/docs/source/users_guide/interfaces.rst index c00b165e..dc443346 100644 --- a/docs/source/users_guide/interfaces.rst +++ b/docs/source/users_guide/interfaces.rst @@ -15,7 +15,7 @@ A few interfaces to external codes are available. |qp| -> \* ---------- -`Molden`_ +`Molden `_ 3D plots of Molecular Orbitals FCIDUMP diff --git a/docs/source/users_guide/printing.rst b/docs/source/users_guide/printing.rst index 8509a2d8..69f2b839 100644 --- a/docs/source/users_guide/printing.rst +++ b/docs/source/users_guide/printing.rst @@ -31,7 +31,7 @@ interactively in :ref:`qp_edit` mode. An alternative is to use the This program will, by default, print out the first :math:`10^4` determinants whatever the size of the wave function stored in the -|EZFIO| folder. If you want to change the number of printed Slater +|EZFIO| directory. If you want to change the number of printed Slater determinants, just change the :option:`determinants n_det_print_wf` keyword using the :ref:`qp_edit` tool. diff --git a/docs/source/users_guide/qp_reset.rst b/docs/source/users_guide/qp_reset.rst new file mode 100644 index 00000000..c92f2791 --- /dev/null +++ b/docs/source/users_guide/qp_reset.rst @@ -0,0 +1,32 @@ +.. _qp_reset: + +======== +qp_reset +======== + +.. program:: qp_reset + +This command resets parts of the |EZFIO| directory. + + +Usage +----- + +.. code:: bash + + qp_reset [-adhm] EZFIO_DIR + +.. option:: -a, --all + + Reset to the state in which the directory is after after running :ref:`qp_create_ezfio`. + +.. option:: -d, --dets + + Deletes the determinants and CI coefficients. + +.. option:: -m, --mos + + Deletes the |MOs|, and consequently the determinants and CI coefficients. + + + diff --git a/docs/source/users_guide/qpsh.rst b/docs/source/users_guide/qpsh.rst index 4cf1a612..7a1a874c 100644 --- a/docs/source/users_guide/qpsh.rst +++ b/docs/source/users_guide/qpsh.rst @@ -95,7 +95,7 @@ Running programs qp (run|srun|mpirun) [options] - Runs :ref:`qp_run`, :ref:`qp_srun`, or :ref:`qp_mpirun` using the current + Runs :ref:`qp_run`, :command:`qp_srun`, or :command:`qp_mpirun` using the current |EZFIO| directory. .. option:: stop diff --git a/docs/source/users_guide/quickstart.rst b/docs/source/users_guide/quickstart.rst index 2c04cbcb..d2de32c9 100644 --- a/docs/source/users_guide/quickstart.rst +++ b/docs/source/users_guide/quickstart.rst @@ -74,7 +74,8 @@ The expected energy is ``-92.827856698`` au. .. seealso:: - The documentation of the :ref:`hartree_fock` module and that of the :c:func:`scf` program. + The documentation of the :ref:`module_hartree_fock` module and that of the + :ref:`scf` program. This creates the |MOs| in the |EZFIO| database that will be used to perform any other post-SCF method. The |qp| does not handle symmetry and @@ -138,7 +139,7 @@ The estimated |FCI| energy of HCN is ``-93.0501`` au. .. seealso:: - The documentation of the :ref:`fci` module and that of the :c:func:`fci` program. + The documentation of the :ref:`module_fci` module and that of the :ref:`fci` program. --------------------------- diff --git a/etc/paths.rc b/etc/paths.rc index 758097d9..ce82358a 100644 --- a/etc/paths.rc +++ b/etc/paths.rc @@ -32,7 +32,8 @@ export PYTHONPATH=$(qp_prepend_export "PYTHONPATH" "${QP_EZFIO}/Python":"${QP_PY export PATH=$(qp_prepend_export "PATH" "${QP_PYTHON}":"${QP_ROOT}"/bin:"${QP_ROOT}"/ocaml) -export LD_LIBRARY_PATH=$(qp_prepend_export "LD_LIBRARY_PATH" "${QP_ROOT}"/lib:"${QP_ROOT}"/lib64) +export LD_LIBRARY_PATH=$(qp_prepend_export "LD_LIBRARY_PATH" "${QP_ROOT}"/lib) + export LIBRARY_PATH=$(qp_prepend_export "LIBRARY_PATH" "${QP_ROOT}"/lib:"${QP_ROOT}"/lib64) diff --git a/man/cis.1 b/man/cis.1 index 07e3260b..7ecc6ace 100644 --- a/man/cis.1 +++ b/man/cis.1 @@ -1,6 +1,6 @@ .\" Man page generated from reStructuredText. . -.TH "CIS" "1" "Jan 25, 2019" "2.0" "Quantum Package" +.TH "CIS" "1" "Jan 29, 2019" "2.0" "Quantum Package" .SH NAME cis \- | Quantum Package > . @@ -40,19 +40,24 @@ Disregarding spatial symmetry, it computes the \fIn_states\fP lowest eigenstates of that CI matrix. (see \fBdeterminants n_states\fP) .sp This program can be useful in many cases: +.INDENT 0.0 +.IP 1. 3 +Ground state calculation .sp To be sure to have the lowest SCF solution, perform an scf -(see the hartree_fock module), then a \fI\%cis\fP, save -the natural orbitals (see save_natorb) and re\-run an -scf optimization from this MO guess. +(see the module_hartree_fock module), then a \fI\%cis\fP, save the +natural orbitals (see save_natorb) and re\-run an scf +optimization from this MO guess. +.IP 2. 3 +Excited states calculations .sp The lowest excited states are much likely to be dominated by -single\-excitations. Therefore, running a \fI\%cis\fP will save -the \fIn_states\fP lowest states within the CIS space in the \fI\%EZFIO\fP +single\-excitations. Therefore, running a \fI\%cis\fP will save the +\fIn_states\fP lowest states within the CIS space in the \fI\%EZFIO\fP directory, which can afterwards be used as guess wave functions for -a further multi\-state FCI calculation if \fBdeterminants read_wf\fP -is set to \fBtrue\fP before running the fci -executable. +a further multi\-state FCI calculation if \fBdeterminants +read_wf\fP is set to \fBtrue\fP before running the fci executable. +.UNINDENT .sp If \fBdeterminants s2_eig\fP is set to \fBtrue\fP, the CIS will only retain states having the expected \ewidehat{S^2} value (see diff --git a/man/cisd.1 b/man/cisd.1 index 79bb7ae1..20954d68 100644 --- a/man/cisd.1 +++ b/man/cisd.1 @@ -1,6 +1,6 @@ .\" Man page generated from reStructuredText. . -.TH "CISD" "1" "Jan 25, 2019" "2.0" "Quantum Package" +.TH "CISD" "1" "Jan 29, 2019" "2.0" "Quantum Package" .SH NAME cisd \- | Quantum Package > . @@ -43,17 +43,17 @@ matrix (see \fBdeterminants n_states\fP). This program can be useful in many cases: .INDENT 0.0 .IP \(bu 2 -GROUND STATE CALCULATION: if even after a \fBcis()\fP calculation, natural +\fBGround state calculation\fP: if even after a \fBcis()\fP calculation, natural orbitals (see \fBsave_natorb()\fP) and then \fBscf()\fP optimization, you are not sure to have the lowest scf solution, do the same strategy with the \fBcisd()\fP executable instead of the \fBcis()\fP\ exectuable to generate the natural orbitals as a guess for the \fBscf()\fP\&. .IP \(bu 2 -EXCITED STATES CALCULATIONS: the lowest excited states are much likely to +\fBExcited states calculations\fP: the lowest excited states are much likely to be dominanted by single\- or double\-excitations. Therefore, running a \fBcisd()\fP will save the “n_states” lowest states within the CISD space -in the EZFIO folder, which can afterward be used as guess wave functions +in the \fI\%EZFIO\fP directory, which can afterward be used as guess wave functions for a further multi\-state fci calculation if you specify “read_wf” = True before running the fci executable (see \fBdeterminants read_wf\fP). Also, if you specify “s2_eig” = True, the cisd will only retain states diff --git a/man/configure.1 b/man/configure.1 index 402f4cff..2bd704ed 100644 --- a/man/configure.1 +++ b/man/configure.1 @@ -1,6 +1,6 @@ .\" Man page generated from reStructuredText. . -.TH "CONFIGURE" "1" "Jan 25, 2019" "2.0" "Quantum Package" +.TH "CONFIGURE" "1" "Jan 29, 2019" "2.0" "Quantum Package" .SH NAME configure \- | Quantum Package > . diff --git a/man/diagonalize_h.1 b/man/diagonalize_h.1 index 0579b2f0..ed8931ba 100644 --- a/man/diagonalize_h.1 +++ b/man/diagonalize_h.1 @@ -1,6 +1,6 @@ .\" Man page generated from reStructuredText. . -.TH "DIAGONALIZE_H" "1" "Jan 25, 2019" "2.0" "Quantum Package" +.TH "DIAGONALIZE_H" "1" "Jan 29, 2019" "2.0" "Quantum Package" .SH NAME diagonalize_h \- | Quantum Package > . @@ -32,11 +32,13 @@ level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] .. .INDENT 0.0 .INDENT 3.5 -Program that extracts the \fBdeterminants n_states\fP lowest states of the Hamiltonian within the set of Slater determinants stored in the EZFIO folder. +Program that extracts the \fBdeterminants n_states\fP lowest +states of the Hamiltonian within the set of Slater determinants stored +in the \fI\%EZFIO\fP directory. .sp -If \fBdeterminants s2_eig\fP = True, it will retain only states -.sp -which corresponds to the desired value of \fBdeterminants expected_s2\fP\&. +If \fBdeterminants s2_eig\fP = \fBtrue\fP, it will retain only states +which correspond to the desired value of +\fBdeterminants expected_s2\fP\&. .sp Needs: .INDENT 0.0 diff --git a/man/excited_states.1 b/man/excited_states.1 index c35acce8..f96ab6f2 100644 --- a/man/excited_states.1 +++ b/man/excited_states.1 @@ -1,6 +1,6 @@ .\" Man page generated from reStructuredText. . -.TH "EXCITED_STATES" "1" "Jan 25, 2019" "2.0" "Quantum Package" +.TH "EXCITED_STATES" "1" "Jan 29, 2019" "2.0" "Quantum Package" .SH NAME excited_states \- | Quantum Package > . diff --git a/man/fci.1 b/man/fci.1 index 0121e2ae..97975d6a 100644 --- a/man/fci.1 +++ b/man/fci.1 @@ -1,6 +1,6 @@ .\" Man page generated from reStructuredText. . -.TH "FCI" "1" "Jan 25, 2019" "2.0" "Quantum Package" +.TH "FCI" "1" "Jan 29, 2019" "2.0" "Quantum Package" .SH NAME fci \- | Quantum Package > . @@ -46,7 +46,7 @@ conditions: .IP \(bu 2 number of Slater determinants > \fBdeterminants n_det_max\fP .IP \(bu 2 -PT2 < \fBperturbation pt2_max\fP +abs(PT2) less than \fBperturbation pt2_max\fP .UNINDENT .sp The following other options can be of interest: @@ -66,7 +66,7 @@ function with an \ewidehat{S^2} value corresponding to .UNINDENT .sp For excited states calculations, it is recommended to start with -\&.cis. or \&.cisd. guess wave functions, eventually in +cis or cisd guess wave functions, eventually in a restricted set of MOs, and to set \fBdeterminants s2_eig\fP to \fBtrue\fP\&. .sp diff --git a/man/fcidump.1 b/man/fcidump.1 index 6df57772..c8791248 100644 --- a/man/fcidump.1 +++ b/man/fcidump.1 @@ -1,6 +1,6 @@ .\" Man page generated from reStructuredText. . -.TH "FCIDUMP" "1" "Jan 25, 2019" "2.0" "Quantum Package" +.TH "FCIDUMP" "1" "Jan 29, 2019" "2.0" "Quantum Package" .SH NAME fcidump \- | Quantum Package > . @@ -32,18 +32,22 @@ level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] .. .INDENT 0.0 .INDENT 3.5 -Produce a regular FCIDUMP file from the MOs stored in the \fI\%EZFIO\fP folder. +Produce a regular \fIFCIDUMP\fP file from the MOs stored in the \fI\%EZFIO\fP +directory. .sp -To specify an active space, the class of the mos have to set in the \fI\%EZFIO\fP folder (see qp_set_mo_class). +To specify an active space, the class of the MOs have to set in the +\fI\%EZFIO\fP directory (see qp_set_mo_class). .sp -The fcidump program supports 3 types of MO_class : +The \fI\%fcidump\fP program supports 3 types of MO classes : .INDENT 0.0 .IP \(bu 2 -the “core” orbitals which are always doubly occupied in the calculation +the \fIcore\fP orbitals which are always doubly occupied in the +calculation .IP \(bu 2 -the “del” orbitals that are never occupied in the calculation +the \fIdeleted\fP orbitals that are never occupied in the calculation .IP \(bu 2 -the “act” orbitals that will be occupied by a varying number of electrons +the \fIactive\fP orbitals that are occupied with a varying number of +electrons .UNINDENT .sp Needs: diff --git a/man/four_idx_transform.1 b/man/four_idx_transform.1 index cc610f5a..41f89b92 100644 --- a/man/four_idx_transform.1 +++ b/man/four_idx_transform.1 @@ -1,6 +1,6 @@ .\" Man page generated from reStructuredText. . -.TH "FOUR_IDX_TRANSFORM" "1" "Jan 25, 2019" "2.0" "Quantum Package" +.TH "FOUR_IDX_TRANSFORM" "1" "Jan 29, 2019" "2.0" "Quantum Package" .SH NAME four_idx_transform \- | Quantum Package > . @@ -32,11 +32,14 @@ level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] .. .INDENT 0.0 .INDENT 3.5 -4\-index transformation of two\-electron integrals from AO to MO integrals. +4\-index transformation of two\-electron integrals from AO to MO +integrals. .sp -This program will compute the two\-electron integrals on the MO basis and store it into the \fI\%EZFIO\fP folder. +This program will compute the two\-electron integrals on the MO basis +and store it into the \fI\%EZFIO\fP directory. .sp -This program can be useful if the AO –> MO transformation is an expensive step by itself. +This program can be useful if the AO –> MO transformation is an +expensive step by itself. .sp Needs: .INDENT 0.0 diff --git a/man/interfaces.1 b/man/interfaces.1 index 6b61eb4e..f9cadd99 100644 --- a/man/interfaces.1 +++ b/man/interfaces.1 @@ -1,6 +1,6 @@ .\" Man page generated from reStructuredText. . -.TH "INTERFACES" "1" "Jan 25, 2019" "2.0" "Quantum Package" +.TH "INTERFACES" "1" "Jan 29, 2019" "2.0" "Quantum Package" .SH NAME interfaces \- | Quantum Package > . diff --git a/man/ks_scf.1 b/man/ks_scf.1 index e9eb6d53..00b42a45 100644 --- a/man/ks_scf.1 +++ b/man/ks_scf.1 @@ -1,6 +1,6 @@ .\" Man page generated from reStructuredText. . -.TH "KS_SCF" "1" "Jan 25, 2019" "2.0" "Quantum Package" +.TH "KS_SCF" "1" "Jan 29, 2019" "2.0" "Quantum Package" .SH NAME ks_scf \- | Quantum Package > . diff --git a/man/molden.1 b/man/molden.1 index 09ce8921..1ceae1ab 100644 --- a/man/molden.1 +++ b/man/molden.1 @@ -1,6 +1,6 @@ .\" Man page generated from reStructuredText. . -.TH "MOLDEN" "1" "Jan 25, 2019" "2.0" "Quantum Package" +.TH "MOLDEN" "1" "Jan 29, 2019" "2.0" "Quantum Package" .SH NAME molden \- | Quantum Package > . @@ -32,7 +32,7 @@ level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] .. .INDENT 0.0 .INDENT 3.5 -Produce a Molden file +Produces a Molden file .sp Needs: .INDENT 0.0 diff --git a/man/natural_orbitals.1 b/man/natural_orbitals.1 index 8f8cf279..35b0980c 100644 --- a/man/natural_orbitals.1 +++ b/man/natural_orbitals.1 @@ -1,6 +1,6 @@ .\" Man page generated from reStructuredText. . -.TH "NATURAL_ORBITALS" "1" "Jan 25, 2019" "2.0" "Quantum Package" +.TH "NATURAL_ORBITALS" "1" "Jan 29, 2019" "2.0" "Quantum Package" .SH NAME natural_orbitals \- | Quantum Package > . diff --git a/man/plugins.1 b/man/plugins.1 index 8107c596..018cf648 100644 --- a/man/plugins.1 +++ b/man/plugins.1 @@ -1,6 +1,6 @@ .\" Man page generated from reStructuredText. . -.TH "PLUGINS" "1" "Jan 25, 2019" "2.0" "Quantum Package" +.TH "PLUGINS" "1" "Jan 29, 2019" "2.0" "Quantum Package" .SH NAME plugins \- | Quantum Package > . diff --git a/man/print_e_conv.1 b/man/print_e_conv.1 index 2df9cc2d..21a083f1 100644 --- a/man/print_e_conv.1 +++ b/man/print_e_conv.1 @@ -1,6 +1,6 @@ .\" Man page generated from reStructuredText. . -.TH "PRINT_E_CONV" "1" "Jan 25, 2019" "2.0" "Quantum Package" +.TH "PRINT_E_CONV" "1" "Jan 29, 2019" "2.0" "Quantum Package" .SH NAME print_e_conv \- | Quantum Package > . diff --git a/man/print_wf.1 b/man/print_wf.1 index e0278254..515b8a91 100644 --- a/man/print_wf.1 +++ b/man/print_wf.1 @@ -1,6 +1,6 @@ .\" Man page generated from reStructuredText. . -.TH "PRINT_WF" "1" "Jan 25, 2019" "2.0" "Quantum Package" +.TH "PRINT_WF" "1" "Jan 29, 2019" "2.0" "Quantum Package" .SH NAME print_wf \- | Quantum Package > . @@ -32,13 +32,15 @@ level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] .. .INDENT 0.0 .INDENT 3.5 -Print the ground state wave function stored in the \fI\%EZFIO\fP folder in the intermediate normalization. +Print the ground state wave function stored in the \fI\%EZFIO\fP directory +in the intermediate normalization. .sp -It also prints a lot of information regarding the excitation operators from the reference determinant +It also prints a lot of information regarding the excitation +operators from the reference determinant ! and a first\-order +perturbative analysis of the wave function. .sp -and a first\-order perturbative analysis of the wave function. -.sp -If the wave function strongly deviates from the first\-order analysis, something funny is going on :) +If the wave function strongly deviates from the first\-order analysis, +something funny is going on :) .sp Needs: .INDENT 0.0 diff --git a/man/printing.1 b/man/printing.1 index 2c9d32f1..0ba10e53 100644 --- a/man/printing.1 +++ b/man/printing.1 @@ -1,6 +1,6 @@ .\" Man page generated from reStructuredText. . -.TH "PRINTING" "1" "Jan 25, 2019" "2.0" "Quantum Package" +.TH "PRINTING" "1" "Jan 29, 2019" "2.0" "Quantum Package" .SH NAME printing \- | Quantum Package > . @@ -74,7 +74,7 @@ qp_run print_wf file.ezfio | tee file.ezfio.fci_natorb.wf .sp This program will, by default, print out the first 10^4 determinants whatever the size of the wave function stored in the -\fI\%EZFIO\fP folder. If you want to change the number of printed Slater +\fI\%EZFIO\fP directory. If you want to change the number of printed Slater determinants, just change the \fBdeterminants n_det_print_wf\fP keyword using the qp_edit tool. .sp diff --git a/man/pt2.1 b/man/pt2.1 index 743cbfed..91ac2941 100644 --- a/man/pt2.1 +++ b/man/pt2.1 @@ -1,6 +1,6 @@ .\" Man page generated from reStructuredText. . -.TH "PT2" "1" "Jan 25, 2019" "2.0" "Quantum Package" +.TH "PT2" "1" "Jan 29, 2019" "2.0" "Quantum Package" .SH NAME pt2 \- | Quantum Package > . @@ -32,13 +32,17 @@ level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] .. .INDENT 0.0 .INDENT 3.5 -Second order perturbative correction to the wave function contained in the EZFIO directory. +Second order perturbative correction to the wave function contained +in the \fI\%EZFIO\fP directory. .sp -This programs runs the stochastic PT2 correction on all “n_states” wave function stored in the EZFIO folder (see \fBdeterminant n_states\fP). +This programs runs the stochastic PT2 correction on all +\fBdeterminants n_states\fP wave functions stored in the \fI\%EZFIO\fP +directory. .sp -The option for the PT2 correction are the “pt2_relative_error” which is the relative stochastic -.sp -error on the PT2 to reach before stopping the stochastic sampling. (see \fBperturbation pt2_relative_error\fP) +The main option for the PT2 correction is the +\fBperturbation pt2_relative_error\fP which is the relative +stochastic error on the PT2 to reach before stopping the +sampling. .sp Needs: .INDENT 0.0 diff --git a/man/qp_convert_output_to_ezfio.1 b/man/qp_convert_output_to_ezfio.1 index 250852fc..43c10485 100644 --- a/man/qp_convert_output_to_ezfio.1 +++ b/man/qp_convert_output_to_ezfio.1 @@ -1,6 +1,6 @@ .\" Man page generated from reStructuredText. . -.TH "QP_CONVERT_OUTPUT_TO_EZFIO" "1" "Jan 25, 2019" "2.0" "Quantum Package" +.TH "QP_CONVERT_OUTPUT_TO_EZFIO" "1" "Jan 29, 2019" "2.0" "Quantum Package" .SH NAME qp_convert_output_to_ezfio \- | Quantum Package > . diff --git a/man/qp_create_ezfio_from_xyz.1 b/man/qp_create_ezfio_from_xyz.1 index 06e8a21c..de6a6da8 100644 --- a/man/qp_create_ezfio_from_xyz.1 +++ b/man/qp_create_ezfio_from_xyz.1 @@ -1,6 +1,6 @@ .\" Man page generated from reStructuredText. . -.TH "QP_CREATE_EZFIO_FROM_XYZ" "1" "Jan 25, 2019" "2.0" "Quantum Package" +.TH "QP_CREATE_EZFIO_FROM_XYZ" "1" "Jan 29, 2019" "2.0" "Quantum Package" .SH NAME qp_create_ezfio_from_xyz \- | Quantum Package > . diff --git a/man/qp_edit.1 b/man/qp_edit.1 index d1cded7f..3e222910 100644 --- a/man/qp_edit.1 +++ b/man/qp_edit.1 @@ -1,6 +1,6 @@ .\" Man page generated from reStructuredText. . -.TH "QP_EDIT" "1" "Jan 25, 2019" "2.0" "Quantum Package" +.TH "QP_EDIT" "1" "Jan 29, 2019" "2.0" "Quantum Package" .SH NAME qp_edit \- | Quantum Package > . diff --git a/man/qp_export_as_tgz.1 b/man/qp_export_as_tgz.1 index 0363eebb..0950a030 100644 --- a/man/qp_export_as_tgz.1 +++ b/man/qp_export_as_tgz.1 @@ -1,6 +1,6 @@ .\" Man page generated from reStructuredText. . -.TH "QP_EXPORT_AS_TGZ" "1" "Jan 25, 2019" "2.0" "Quantum Package" +.TH "QP_EXPORT_AS_TGZ" "1" "Jan 29, 2019" "2.0" "Quantum Package" .SH NAME qp_export_as_tgz \- | Quantum Package > . diff --git a/man/qp_plugins.1 b/man/qp_plugins.1 index 2a63d809..7e5db588 100644 --- a/man/qp_plugins.1 +++ b/man/qp_plugins.1 @@ -1,6 +1,6 @@ .\" Man page generated from reStructuredText. . -.TH "QP_PLUGINS" "1" "Jan 25, 2019" "2.0" "Quantum Package" +.TH "QP_PLUGINS" "1" "Jan 29, 2019" "2.0" "Quantum Package" .SH NAME qp_plugins \- | Quantum Package > . diff --git a/man/qp_reset.1 b/man/qp_reset.1 new file mode 100644 index 00000000..2b62d8ed --- /dev/null +++ b/man/qp_reset.1 @@ -0,0 +1,66 @@ +.\" Man page generated from reStructuredText. +. +.TH "QP_RESET" "1" "Jan 29, 2019" "2.0" "Quantum Package" +.SH NAME +qp_reset \- | Quantum Package > +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.sp +This command resets parts of the \fI\%EZFIO\fP directory. +.SH USAGE +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +qp_reset [\-adhm] EZFIO_DIR +.ft P +.fi +.UNINDENT +.UNINDENT +.INDENT 0.0 +.TP +.B \-a, \-\-all +Reset to the state in which the directory is after after running qp_create_ezfio\&. +.UNINDENT +.INDENT 0.0 +.TP +.B \-d, \-\-dets +Deletes the determinants and CI coefficients. +.UNINDENT +.INDENT 0.0 +.TP +.B \-m, \-\-mos +Deletes the MOs, and consequently the determinants and CI coefficients. +.UNINDENT +.SH AUTHOR +A. Scemama, E. Giner +.SH COPYRIGHT +2019, A. Scemama, E. Giner +.\" Generated by docutils manpage writer. +. diff --git a/man/qp_run.1 b/man/qp_run.1 index 976a7318..7ec33303 100644 --- a/man/qp_run.1 +++ b/man/qp_run.1 @@ -1,6 +1,6 @@ .\" Man page generated from reStructuredText. . -.TH "QP_RUN" "1" "Jan 25, 2019" "2.0" "Quantum Package" +.TH "QP_RUN" "1" "Jan 29, 2019" "2.0" "Quantum Package" .SH NAME qp_run \- | Quantum Package > . diff --git a/man/qp_set_frozen_core.1 b/man/qp_set_frozen_core.1 index 24f87b09..7077976e 100644 --- a/man/qp_set_frozen_core.1 +++ b/man/qp_set_frozen_core.1 @@ -1,6 +1,6 @@ .\" Man page generated from reStructuredText. . -.TH "QP_SET_FROZEN_CORE" "1" "Jan 25, 2019" "2.0" "Quantum Package" +.TH "QP_SET_FROZEN_CORE" "1" "Jan 29, 2019" "2.0" "Quantum Package" .SH NAME qp_set_frozen_core \- | Quantum Package > . diff --git a/man/qp_set_mo_class.1 b/man/qp_set_mo_class.1 index a97f50e3..01c71fe6 100644 --- a/man/qp_set_mo_class.1 +++ b/man/qp_set_mo_class.1 @@ -1,6 +1,6 @@ .\" Man page generated from reStructuredText. . -.TH "QP_SET_MO_CLASS" "1" "Jan 25, 2019" "2.0" "Quantum Package" +.TH "QP_SET_MO_CLASS" "1" "Jan 29, 2019" "2.0" "Quantum Package" .SH NAME qp_set_mo_class \- | Quantum Package > . diff --git a/man/qp_stop.1 b/man/qp_stop.1 index 35fa3082..47cc7559 100644 --- a/man/qp_stop.1 +++ b/man/qp_stop.1 @@ -1,6 +1,6 @@ .\" Man page generated from reStructuredText. . -.TH "QP_STOP" "1" "Jan 25, 2019" "2.0" "Quantum Package" +.TH "QP_STOP" "1" "Jan 29, 2019" "2.0" "Quantum Package" .SH NAME qp_stop \- | Quantum Package > . diff --git a/man/qp_update.1 b/man/qp_update.1 index 4ee9654c..5acad761 100644 --- a/man/qp_update.1 +++ b/man/qp_update.1 @@ -1,6 +1,6 @@ .\" Man page generated from reStructuredText. . -.TH "QP_UPDATE" "1" "Jan 25, 2019" "2.0" "Quantum Package" +.TH "QP_UPDATE" "1" "Jan 29, 2019" "2.0" "Quantum Package" .SH NAME qp_update \- | Quantum Package > . diff --git a/man/qpsh.1 b/man/qpsh.1 index c445c006..e7f22a8c 100644 --- a/man/qpsh.1 +++ b/man/qpsh.1 @@ -1,6 +1,6 @@ .\" Man page generated from reStructuredText. . -.TH "QPSH" "1" "Jan 25, 2019" "2.0" "Quantum Package" +.TH "QPSH" "1" "Jan 29, 2019" "2.0" "Quantum Package" .SH NAME qpsh \- | Quantum Package > . @@ -153,7 +153,7 @@ qp (run|srun|mpirun) [options] .UNINDENT .UNINDENT .sp -Runs qp_run, qp_srun, or qp_mpirun using the current +Runs qp_run, \fBqp_srun\fP, or \fBqp_mpirun\fP using the current \fI\%EZFIO\fP directory. .UNINDENT .INDENT 0.0 diff --git a/man/rs_ks_scf.1 b/man/rs_ks_scf.1 index 2c7a715e..1fc27949 100644 --- a/man/rs_ks_scf.1 +++ b/man/rs_ks_scf.1 @@ -1,6 +1,6 @@ .\" Man page generated from reStructuredText. . -.TH "RS_KS_SCF" "1" "Jan 25, 2019" "2.0" "Quantum Package" +.TH "RS_KS_SCF" "1" "Jan 29, 2019" "2.0" "Quantum Package" .SH NAME rs_ks_scf \- | Quantum Package > . diff --git a/man/save_natorb.1 b/man/save_natorb.1 index b46fdad8..1b06061d 100644 --- a/man/save_natorb.1 +++ b/man/save_natorb.1 @@ -1,6 +1,6 @@ .\" Man page generated from reStructuredText. . -.TH "SAVE_NATORB" "1" "Jan 25, 2019" "2.0" "Quantum Package" +.TH "SAVE_NATORB" "1" "Jan 29, 2019" "2.0" "Quantum Package" .SH NAME save_natorb \- | Quantum Package > . @@ -32,15 +32,16 @@ level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] .. .INDENT 0.0 .INDENT 3.5 -Save natural MOs into the EZFIO +Save natural MOs into the \fI\%EZFIO\fP\&. .sp -This program reads the wave function stored in the EZFIO folder, +This program reads the wave function stored in the \fI\%EZFIO\fP directory, +extracts the corresponding natural orbitals and setd them as the new +MOs\&. .sp -extracts the corresponding natural orbitals and set them as the new MOs -.sp -If this is a multi\-state calculation, the density matrix that produces the natural orbitals -.sp -is obtained from a state\-averaged of the density matrices of each state with the corresponding state_average_weight (see the doc of state_average_weight). +If this is a multi\-state calculation, the density matrix that produces +the natural orbitals is obtained from an average of the density +matrices of each state with the corresponding +\fBdeterminants state_average_weight\fP .sp Needs: .INDENT 0.0 diff --git a/man/save_one_e_dm.1 b/man/save_one_e_dm.1 index 80fb6ff2..5899cdfb 100644 --- a/man/save_one_e_dm.1 +++ b/man/save_one_e_dm.1 @@ -1,6 +1,6 @@ .\" Man page generated from reStructuredText. . -.TH "SAVE_ONE_E_DM" "1" "Jan 25, 2019" "2.0" "Quantum Package" +.TH "SAVE_ONE_E_DM" "1" "Jan 29, 2019" "2.0" "Quantum Package" .SH NAME save_one_e_dm \- | Quantum Package > . @@ -32,12 +32,16 @@ level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] .. .INDENT 0.0 .INDENT 3.5 -programs that computes the one body density on the mo basis for alpha and beta electrons -from the wave function stored in the EZFIO folder, and then save it into the EZFIO folder aux_quantities. +Program that computes the one body density on the MO basis +for $alpha$ and $beta$ electrons from the wave function +stored in the \fI\%EZFIO\fP directory, and then saves it into the +module_aux_quantities\&. .sp -Then, the global variable data_one_e_dm_alpha_mo and data_one_e_dm_beta_mo will automatically read this density in a further calculation. -.sp -This can be used to perform damping on the density in RS\-DFT calculation (see the density_for_dft module). +Then, the global variable \fBaux_quantities data_one_e_dm_alpha_mo\fP +and \fBaux_quantities data_one_e_dm_beta_mo\fP will automatically +read this density in the next calculation. This can be used to perform +damping on the density in RSDFT calculations (see +module_density_for_dft). .sp Needs: .INDENT 0.0 diff --git a/man/save_ortho_mos.1 b/man/save_ortho_mos.1 index 0cdfc0ce..a3183723 100644 --- a/man/save_ortho_mos.1 +++ b/man/save_ortho_mos.1 @@ -1,6 +1,6 @@ .\" Man page generated from reStructuredText. . -.TH "SAVE_ORTHO_MOS" "1" "Jan 25, 2019" "2.0" "Quantum Package" +.TH "SAVE_ORTHO_MOS" "1" "Jan 29, 2019" "2.0" "Quantum Package" .SH NAME save_ortho_mos \- | Quantum Package > . diff --git a/man/scf.1 b/man/scf.1 index cc0d3b14..9ff63737 100644 --- a/man/scf.1 +++ b/man/scf.1 @@ -1,6 +1,6 @@ .\" Man page generated from reStructuredText. . -.TH "SCF" "1" "Jan 25, 2019" "2.0" "Quantum Package" +.TH "SCF" "1" "Jan 29, 2019" "2.0" "Quantum Package" .SH NAME scf \- | Quantum Package > . diff --git a/man/write_integrals_erf.1 b/man/write_integrals_erf.1 index 45689b7b..71b989c6 100644 --- a/man/write_integrals_erf.1 +++ b/man/write_integrals_erf.1 @@ -1,6 +1,6 @@ .\" Man page generated from reStructuredText. . -.TH "WRITE_INTEGRALS_ERF" "1" "Jan 25, 2019" "2.0" "Quantum Package" +.TH "WRITE_INTEGRALS_ERF" "1" "Jan 29, 2019" "2.0" "Quantum Package" .SH NAME write_integrals_erf \- | Quantum Package > . @@ -32,7 +32,8 @@ level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] .. .INDENT 0.0 .INDENT 3.5 -Saves the two\-electron integrals with the erf(\emu r_{12})/r_{12} oprerator into the EZFIO folder +Saves the two\-electron integrals with the $erf(mu r_{12})/r_{12}$ +oprerator into the EZFIO directory. .sp Needs: .INDENT 0.0 diff --git a/ocaml/TaskServer.ml b/ocaml/TaskServer.ml index 4d48a2d0..76349844 100644 --- a/ocaml/TaskServer.ml +++ b/ocaml/TaskServer.ml @@ -50,7 +50,7 @@ let zmq_context = Zmq.Context.create () let () = - Zmq.Context.set_io_threads zmq_context 8 + Zmq.Context.set_io_threads zmq_context 16 let bind_socket ~socket_type ~socket ~port = diff --git a/src/ao_basis/README.rst b/src/ao_basis/README.rst index 753dd12b..6adfdd82 100644 --- a/src/ao_basis/README.rst +++ b/src/ao_basis/README.rst @@ -17,9 +17,13 @@ The |AO| coefficients are normalized as: {\tilde c}_{ki} = \frac{c_{ki}}{ \int \left( (x-X_A)^a (y-Y_A)^b (z-Z_A)^c e^{-\gamma_{ki} |{\bf r} - {\bf R}_A|^2} \right)^2 dr} -Warning: `ao_coef` contains the |AO| coefficients given in input. These do not -include the normalization constant of the |AO|. The `ao_coef_normalized` provider includes -this normalization factor. + +.. warning:: + + `ao_coef` contains the |AO| coefficients given in input. These do not + include the normalization constant of the |AO|. The `ao_coef_normalized` + provider includes this normalization factor. + The |AOs| are also sorted by increasing exponent to accelerate the calculation of the two electron integrals. diff --git a/src/ao_basis/aos_value.irp.f b/src/ao_basis/aos_value.irp.f index 8ace8b39..8707c0e6 100644 --- a/src/ao_basis/aos_value.irp.f +++ b/src/ao_basis/aos_value.irp.f @@ -1,7 +1,7 @@ double precision function ao_value(i,r) implicit none BEGIN_DOC -! return the value of the ith ao at point r +! Returns the value of the i-th ao at point $\textbf{r}$ END_DOC double precision, intent(in) :: r(3) integer, intent(in) :: i @@ -35,7 +35,8 @@ end double precision function primitive_value(i,j,r) implicit none BEGIN_DOC -! return the value of the jth primitive of ith ao at point r WITHOUT THE COEF +! Returns the value of the j-th primitive of the i-th |AO| at point $\textbf{r} +! **without the coefficient** END_DOC double precision, intent(in) :: r(3) integer, intent(in) :: i,j @@ -68,8 +69,9 @@ end subroutine give_all_aos_at_r(r,aos_array) implicit none BEGIN_dOC -! input : r == r(1) = x and so on -! aos_array(i) = aos(i) evaluated in r +! input : r == r(1) = x and so on +! +! output : aos_array(i) = aos(i) evaluated in $\textbf{r}$ END_DOC double precision, intent(in) :: r(3) double precision, intent(out):: aos_array(ao_num) @@ -106,9 +108,13 @@ end subroutine give_all_aos_and_grad_at_r(r,aos_array,aos_grad_array) implicit none BEGIN_DOC -! input : r(1) ==> r(1) = x, r(2) = y, r(3) = z -! output : aos_array(i) = ao(i) evaluated at r -! : aos_grad_array(1,i) = gradient X of the ao(i) evaluated at r +! input : r(1) ==> r(1) = x, r(2) = y, r(3) = z +! +! output : +! +! * aos_array(i) = ao(i) evaluated at ro +! * aos_grad_array(1,i) = gradient X of the ao(i) evaluated at $\textbf{r}$ +! END_DOC double precision, intent(in) :: r(3) double precision, intent(out) :: aos_array(ao_num) @@ -172,9 +178,12 @@ end subroutine give_all_aos_and_grad_and_lapl_at_r(r,aos_array,aos_grad_array,aos_lapl_array) implicit none BEGIN_DOC -! input : r(1) ==> r(1) = x, r(2) = y, r(3) = z -! output : aos_array(i) = ao(i) evaluated at r -! : aos_grad_array(1,i) = gradient X of the ao(i) evaluated at r +! input : r(1) ==> r(1) = x, r(2) = y, r(3) = z +! +! output : +! +! * aos_array(i) = ao(i) evaluated at $\textbf{r}$ +! * aos_grad_array(1,i) = $\nabla_x$ of the ao(i) evaluated at $\textbf{r}$ END_DOC double precision, intent(in) :: r(3) double precision, intent(out) :: aos_array(ao_num) diff --git a/src/ao_one_e_ints/kin_ao_ints.irp.f b/src/ao_one_e_ints/kin_ao_ints.irp.f index 8e981d77..b87e2a22 100644 --- a/src/ao_one_e_ints/kin_ao_ints.irp.f +++ b/src/ao_one_e_ints/kin_ao_ints.irp.f @@ -5,8 +5,10 @@ BEGIN_DOC ! Second derivative matrix elements in the |AO| basis. ! - ! :math:`{\tt ao\_deriv2\_x} = - ! \langle \chi_i(x,y,z) | \frac{\partial^2}{\partial x^2} |\chi_j (x,y,z) \rangle` + ! .. math:: + ! + ! {\tt ao\_deriv2\_x} = + ! \langle \chi_i(x,y,z) | \frac{\partial^2}{\partial x^2} |\chi_j (x,y,z) \rangle ! END_DOC integer :: i,j,n,l @@ -122,7 +124,8 @@ BEGIN_PROVIDER [double precision, ao_kinetic_integrals, (ao_num,ao_num)] BEGIN_DOC ! Kinetic energy integrals in the |AO| basis. ! - ! :math:`\langle \chi_i |\hat{T}| \chi_j \rangle` + ! $\langle \chi_i |\hat{T}| \chi_j \rangle$ + ! END_DOC integer :: i,j,k,l diff --git a/src/ao_one_e_ints/pot_ao_erf_ints.irp.f b/src/ao_one_e_ints/pot_ao_erf_ints.irp.f index 66637420..42505194 100644 --- a/src/ao_one_e_ints/pot_ao_erf_ints.irp.f +++ b/src/ao_one_e_ints/pot_ao_erf_ints.irp.f @@ -2,7 +2,7 @@ subroutine give_all_erf_kl_ao(integrals_ao,mu_in,C_center) implicit none BEGIN_DOC ! Subroutine that returns all integrals over $r$ of type - ! $\frac{ \erf(\mu * |r-R_C|) }{ |r-R_C| }$ + ! $\frac{ \erf(\mu * | r - R_C | ) }{ | r - R_C | }$ END_DOC double precision, intent(in) :: mu_in,C_center(3) double precision, intent(out) :: integrals_ao(ao_num,ao_num) @@ -20,7 +20,7 @@ double precision function NAI_pol_mult_erf_ao(i_ao,j_ao,mu_in,C_center) implicit none BEGIN_DOC ! Computes the following integral : - ! $\int_{-\infty}^{infty} dr \chi_i(r) \chi_j(r) \frac{\erf(\mu |r-R_C|)}{|r-R_C|}$. + ! $\int_{-\infty}^{infty} dr \chi_i(r) \chi_j(r) \frac{\erf(\mu | r - R_C | )}{ | r - R_C | }$. END_DOC integer, intent(in) :: i_ao,j_ao double precision, intent(in) :: mu_in, C_center(3) @@ -51,8 +51,12 @@ end double precision function NAI_pol_mult_erf(A_center,B_center,power_A,power_B,alpha,beta,C_center,n_pt_in,mu_in) BEGIN_DOC ! Computes the following integral : - ! $\int dr (x-A_x)^a (x-B_x)^b \exp(-\alpha (x-A_x)^2 - \beta (x-B_x)^2 ) - ! \frac{\erf(\mu |r-R_C|)}{|r-R_c|}$. + ! + ! .. math:: + ! + ! \int dr (x-A_x)^a (x-B_x)^b \exp(-\alpha (x-A_x)^2 - \beta (x-B_x)^2 ) + ! \frac{\erf(\mu | r - R_C | )}{ | r - R_C | }$. + ! END_DOC implicit none @@ -126,7 +130,8 @@ end subroutine give_polynomial_mult_center_one_e_erf_opt(A_center,B_center,alpha,beta,& power_A,power_B,C_center,n_pt_in,d,n_pt_out,mu_in,p,p_inv,p_inv_2,p_new,P_center) BEGIN_DOC - ! Returns the explicit polynomial in terms of the $t$ variable of the following polynomial: + ! Returns the explicit polynomial in terms of the $t$ variable of the + ! following polynomial: ! ! $I_{x1}(a_x, d_x,p,q) \times I_{x1}(a_y, d_y,p,q) \times I_{x1}(a_z, d_z,p,q)$. END_DOC @@ -244,7 +249,8 @@ end subroutine give_polynomial_mult_center_one_e_erf(A_center,B_center,alpha,beta,& power_A,power_B,C_center,n_pt_in,d,n_pt_out,mu_in) BEGIN_DOC - ! Returns the explicit polynomial in terms of the $t$ variable of the following polynomial: + ! Returns the explicit polynomial in terms of the $t$ variable of the + ! following polynomial: ! ! $I_{x1}(a_x, d_x,p,q) \times I_{x1}(a_y, d_y,p,q) \times I_{x1}(a_z, d_z,p,q)$. END_DOC @@ -262,7 +268,6 @@ subroutine give_polynomial_mult_center_one_e_erf(A_center,B_center,alpha,beta,& double precision :: accu, pq_inv, p10_1, p10_2, p01_1, p01_2 double precision :: p,P_center(3),rho,p_inv,p_inv_2 accu = 0.d0 - !COMPTEUR irp_rdtsc1 = irp_rdtsc() ASSERT (n_pt_in > 1) p = alpha+beta p_inv = 1.d0/p diff --git a/src/ao_two_e_erf_ints/two_e_integrals_erf.irp.f b/src/ao_two_e_erf_ints/two_e_integrals_erf.irp.f index 24a48e32..4433690f 100644 --- a/src/ao_two_e_erf_ints/two_e_integrals_erf.irp.f +++ b/src/ao_two_e_erf_ints/two_e_integrals_erf.irp.f @@ -458,11 +458,13 @@ end double precision function ERI_erf(alpha,beta,delta,gama,a_x,b_x,c_x,d_x,a_y,b_y,c_y,d_y,a_z,b_z,c_z,d_z) implicit none BEGIN_DOC - ! ATOMIC PRIMTIVE two-electron integral between the 4 primitives :: - ! primitive_1 = x1**(a_x) y1**(a_y) z1**(a_z) exp(-alpha * r1**2) - ! primitive_2 = x1**(b_x) y1**(b_y) z1**(b_z) exp(- beta * r1**2) - ! primitive_3 = x2**(c_x) y2**(c_y) z2**(c_z) exp(-delta * r2**2) - ! primitive_4 = x2**(d_x) y2**(d_y) z2**(d_z) exp(- gama * r2**2) + ! Atomic primtive two-electron integral between the 4 primitives : + ! + ! * primitive 1 : $x_1^{a_x} y_1^{a_y} z_1^{a_z} \exp(-\alpha * r1^2)$ + ! * primitive 2 : $x_1^{b_x} y_1^{b_y} z_1^{b_z} \exp(- \beta * r1^2)$ + ! * primitive 3 : $x_2^{c_x} y_2^{c_y} z_2^{c_z} \exp(-\delta * r2^2)$ + ! * primitive 4 : $x_2^{d_x} y_2^{d_y} z_2^{d_z} \exp(-\gamma * r2^2)$ + ! END_DOC double precision, intent(in) :: delta,gama,alpha,beta integer, intent(in) :: a_x,b_x,c_x,d_x,a_y,b_y,c_y,d_y,a_z,b_z,c_z,d_z @@ -517,9 +519,11 @@ end subroutine integrale_new_erf(I_f,a_x,b_x,c_x,d_x,a_y,b_y,c_y,d_y,a_z,b_z,c_z,d_z,p,q,n_pt) BEGIN_DOC - ! calculate the integral of the polynom :: - ! I_x1(a_x+b_x, c_x+d_x,p,q) * I_x1(a_y+b_y, c_y+d_y,p,q) * I_x1(a_z+b_z, c_z+d_z,p,q) - ! between ( 0 ; 1) + ! Calculate the integral of the polynomial : + ! + ! $I_x1(a_x+b_x, c_x+d_x,p,q) \, I_x1(a_y+b_y, c_y+d_y,p,q) \, I_x1(a_z+b_z, c_z+d_z,p,q)$ + ! + ! between $( 0 ; 1)$ END_DOC diff --git a/src/ao_two_e_ints/two_e_integrals.irp.f b/src/ao_two_e_ints/two_e_integrals.irp.f index ca3b950d..3ecdbbb2 100644 --- a/src/ao_two_e_ints/two_e_integrals.irp.f +++ b/src/ao_two_e_ints/two_e_integrals.irp.f @@ -641,9 +641,10 @@ end subroutine integrale_new(I_f,a_x,b_x,c_x,d_x,a_y,b_y,c_y,d_y,a_z,b_z,c_z,d_z,p,q,n_pt) BEGIN_DOC - ! calculate the integral of the polynom :: - ! I_x1(a_x+b_x, c_x+d_x,p,q) * I_x1(a_y+b_y, c_y+d_y,p,q) * I_x1(a_z+b_z, c_z+d_z,p,q) - ! between ( 0 ; 1) + ! Calculates the integral of the polynomial : + ! + ! $I_{x_1}(a_x+b_x,c_x+d_x,p,q) \, I_{x_1}(a_y+b_y,c_y+d_y,p,q) \, I_{x_1}(a_z+b_z,c_z+d_z,p,q)$ + ! in $( 0 ; 1)$ END_DOC @@ -775,8 +776,9 @@ integer function n_pt_sup(a_x,b_x,c_x,d_x,a_y,b_y,c_y,d_y,a_z,b_z,c_z,d_z) implicit none BEGIN_DOC ! Returns the upper boundary of the degree of the polynomial involved in the - ! bielctronic integral : - ! Ix(a_x,b_x,c_x,d_x) * Iy(a_y,b_y,c_y,d_y) * Iz(a_z,b_z,c_z,d_z) + ! two-electron integral : + ! + ! $I_x(a_x,b_x,c_x,d_x) \, I_y(a_y,b_y,c_y,d_y) \, I_z(a_z,b_z,c_z,d_z)$ END_DOC integer :: a_x,b_x,c_x,d_x,a_y,b_y,c_y,d_y,a_z,b_z,c_z,d_z n_pt_sup = shiftl( a_x+b_x+c_x+d_x + a_y+b_y+c_y+d_y + a_z+b_z+c_z+d_z,1 ) @@ -790,7 +792,8 @@ subroutine give_polynom_mult_center_x(P_center,Q_center,a_x,d_x,p,q,n_pt_in,pq_i BEGIN_DOC ! subroutine that returns the explicit polynom in term of the "t" ! variable of the following polynomw : - ! I_x1(a_x, d_x,p,q) * I_x1(a_y, d_y,p,q) * I_x1(a_z, d_z,p,q) + ! + ! $I_{x_1}(a_x,d_x,p,q) \, I_{x_1}(a_y,d_y,p,q) \ I_{x_1}(a_z,d_z,p,q)$ END_DOC integer, intent(in) :: n_pt_in integer,intent(out) :: n_pt_out @@ -851,7 +854,7 @@ end subroutine I_x1_pol_mult(a,c,B_10,B_01,B_00,C_00,D_00,d,nd,n_pt_in) implicit none BEGIN_DOC - ! recursive function involved in the two-electron integral + ! Recursive function involved in the two-electron integral END_DOC integer , intent(in) :: n_pt_in include 'utils/constants.include.F' @@ -885,7 +888,7 @@ end recursive subroutine I_x1_pol_mult_recurs(a,c,B_10,B_01,B_00,C_00,D_00,d,nd,n_pt_in) implicit none BEGIN_DOC - ! recursive function involved in the two-electron integral + ! Recursive function involved in the two-electron integral END_DOC integer , intent(in) :: n_pt_in include 'utils/constants.include.F' @@ -966,7 +969,7 @@ end recursive subroutine I_x1_pol_mult_a1(c,B_10,B_01,B_00,C_00,D_00,d,nd,n_pt_in) implicit none BEGIN_DOC - ! recursive function involved in the two-electron integral + ! Recursive function involved in the two-electron integral END_DOC integer , intent(in) :: n_pt_in include 'utils/constants.include.F' @@ -1017,7 +1020,7 @@ end recursive subroutine I_x1_pol_mult_a2(c,B_10,B_01,B_00,C_00,D_00,d,nd,n_pt_in) implicit none BEGIN_DOC - ! recursive function involved in the two-electron integral + ! Recursive function involved in the two-electron integral END_DOC integer , intent(in) :: n_pt_in include 'utils/constants.include.F' @@ -1075,7 +1078,7 @@ end recursive subroutine I_x2_pol_mult(c,B_10,B_01,B_00,C_00,D_00,d,nd,dim) implicit none BEGIN_DOC - ! recursive function involved in the two-electron integral + ! Recursive function involved in the two-electron integral END_DOC integer , intent(in) :: dim include 'utils/constants.include.F' diff --git a/src/aux_quantities/README.rst b/src/aux_quantities/README.rst index 62036952..c2b8b5ed 100644 --- a/src/aux_quantities/README.rst +++ b/src/aux_quantities/README.rst @@ -4,18 +4,19 @@ aux_quantities This module contains some global variables (such as densities and energies) -which are stored in the EZFIO folder in a different place than determinants. +which are stored in the |EZFIO| directory in a different place than determinants. This is used in practice to store density matrices which can be obtained from -any methods, as long as they are stored in the same MO basis which is used for +any method, as long as they are stored in the same |MO| basis which is used for the calculations. In |RSDFT| calculations, this can be done to perform damping -on the density in order to speed up convergence. +on the density in order to speed up the convergence. The main providers of that module are: -* `data_one_e_dm_alpha_mo` and `data_one_e_dm_beta_mo` which are the - one-body alpha and beta densities which are necessary read from the EZFIO - folder. +* :c:data:`data_one_e_dm_alpha_mo` and :c:data:`data_one_e_dm_beta_mo` which + are the one-body alpha and beta densities which are necessary read from the + |EZFIO| directory. Thanks to these providers you can use any density matrix that does not -necessary corresponds to that of the current wave function. +necessarily corresponds to that of the current wave function. + diff --git a/src/cipsi/README.rst b/src/cipsi/README.rst index 401c0cc6..054f938f 100644 --- a/src/cipsi/README.rst +++ b/src/cipsi/README.rst @@ -43,7 +43,7 @@ By default, the program will stop when more than one million determinants have been selected, or when the |PT2| energy is below :math:`10^{-4}`. The variational and |PT2| energies of the iterations are stored in the -|EZFIO| database, in the :ref:`iterations` module. +|EZFIO| database, in the :ref:`module_iterations` module. diff --git a/src/cipsi/energy.irp.f b/src/cipsi/energy.irp.f index b7ba42bb..0ae5ad79 100644 --- a/src/cipsi/energy.irp.f +++ b/src/cipsi/energy.irp.f @@ -11,9 +11,15 @@ BEGIN_PROVIDER [ double precision, pt2_E0_denominator, (N_states) ] BEGIN_DOC ! E0 in the denominator of the PT2 END_DOC + integer :: i,j if (initialize_pt2_E0_denominator) then if (h0_type == "EN") then pt2_E0_denominator(1:N_states) = psi_energy(1:N_states) + else if (h0_type == "HF") then + do i=1,N_states + j = maxloc(abs(psi_coef(:,i)),1) + pt2_E0_denominator(i) = psi_det_hii(j) + enddo else if (h0_type == "Barycentric") then pt2_E0_denominator(1:N_states) = barycentric_electronic_energy(1:N_states) else if (h0_type == "Variance") then @@ -24,7 +30,9 @@ BEGIN_PROVIDER [ double precision, pt2_E0_denominator, (N_states) ] print *, h0_type, ' not implemented' stop endif - call write_double(6,pt2_E0_denominator(1)+nuclear_repulsion, 'PT2 Energy denominator') + do i=1,N_states + call write_double(6,pt2_E0_denominator(i)+nuclear_repulsion, 'PT2 Energy denominator') + enddo else pt2_E0_denominator = -huge(1.d0) endif diff --git a/src/cipsi/pt2_stoch_routines.irp.f b/src/cipsi/pt2_stoch_routines.irp.f index 5ebe46bb..afa7a636 100644 --- a/src/cipsi/pt2_stoch_routines.irp.f +++ b/src/cipsi/pt2_stoch_routines.irp.f @@ -10,13 +10,20 @@ END_PROVIDER &BEGIN_PROVIDER [ integer, pt2_n_tasks_max ] implicit none logical, external :: testTeethBuilding - integer :: i - integer :: e - e = elec_num - n_core_orb * 2 - pt2_n_tasks_max = 1+min((e*(e-1))/2, int(dsqrt(dble(N_det_selectors)))/4) - do i=1,N_det_generators - pt2_F(i) = 1 + int(dble(pt2_n_tasks_max)*maxval(dsqrt(dabs(psi_coef_sorted_gen(i,1:N_states))))) + integer :: i,j + pt2_n_tasks_max = elec_beta_num*elec_beta_num + elec_alpha_num*elec_beta_num - n_core_orb*2 + pt2_n_tasks_max = min(pt2_n_tasks_max,1+N_det_generators/10000) + call write_int(6,pt2_n_tasks_max,'pt2_n_tasks_max') + + pt2_F(:) = int(sqrt(float(pt2_n_tasks_max))) + do i=1,pt2_n_0(1+pt2_N_teeth/4) + pt2_F(i) = pt2_n_tasks_max enddo + do i=1+pt2_n_0(pt2_N_teeth-pt2_N_teeth/4), N_det_generators + pt2_F(i) = 1 + enddo + + END_PROVIDER BEGIN_PROVIDER [ integer, pt2_N_teeth ] @@ -54,17 +61,16 @@ logical function testTeethBuilding(minF, N) allocate(tilde_w(N_det_generators), tilde_cW(0:N_det_generators)) - do i=1,N_det_generators - tilde_w(i) = psi_coef_sorted_gen(i,pt2_stoch_istate)**2 !+ 1.d-20 - enddo - - double precision :: norm norm = 0.d0 + double precision :: norm do i=N_det_generators,1,-1 - norm += tilde_w(i) + tilde_w(i) = psi_coef_sorted_gen(i,pt2_stoch_istate) * & + psi_coef_sorted_gen(i,pt2_stoch_istate) + norm = norm + tilde_w(i) enddo - tilde_w(:) = tilde_w(:) / norm + f = 1.d0/norm + tilde_w(:) = tilde_w(:) * f tilde_cW(0) = -1.d0 do i=1,N_det_generators @@ -74,10 +80,14 @@ logical function testTeethBuilding(minF, N) n0 = 0 testTeethBuilding = .false. + double precision :: f + integer :: minFN + minFN = N_det_generators - minF * N + f = 1.d0/dble(N) do u0 = tilde_cW(n0) r = tilde_cW(n0 + minF) - Wt = (1d0 - u0) / dble(N) + Wt = (1d0 - u0) * f if (dabs(Wt) <= 1.d-3) then return endif @@ -86,7 +96,8 @@ logical function testTeethBuilding(minF, N) return end if n0 += 1 - if(N_det_generators - n0 < minF * N) then +! if(N_det_generators - n0 < minF * N) then + if(n0 > minFN) then return end if end do @@ -103,7 +114,6 @@ subroutine ZMQ_pt2(E, pt2,relative_error, error, variance, norm, N_in) integer(ZMQ_PTR) :: zmq_to_qp_run_socket, zmq_socket_pull integer, intent(in) :: N_in - integer, external :: omp_get_thread_num double precision, intent(in) :: relative_error, E(N_states) double precision, intent(out) :: pt2(N_states),error(N_states) double precision, intent(out) :: variance(N_states),norm(N_states) @@ -111,7 +121,6 @@ subroutine ZMQ_pt2(E, pt2,relative_error, error, variance, norm, N_in) integer :: i, N - double precision, external :: omp_get_wtime double precision :: state_average_weight_save(N_states), w(N_states,4) integer(ZMQ_PTR), external :: new_zmq_to_qp_run_socket type(selection_buffer) :: b @@ -120,7 +129,11 @@ subroutine ZMQ_pt2(E, pt2,relative_error, error, variance, norm, N_in) PROVIDE psi_bilinear_matrix_rows psi_det_sorted_order psi_bilinear_matrix_order PROVIDE psi_bilinear_matrix_transp_rows_loc psi_bilinear_matrix_transp_columns PROVIDE psi_bilinear_matrix_transp_order psi_selectors_coef_transp psi_det_sorted + PROVIDE psi_det_hii N_generators_bitmask + if (h0_type == 'SOP') then + PROVIDE psi_occ_pattern_hii det_to_occ_pattern + endif if (N_det < max(10,N_states)) then pt2=0.d0 @@ -132,6 +145,10 @@ subroutine ZMQ_pt2(E, pt2,relative_error, error, variance, norm, N_in) N = max(N_in,1) * N_states state_average_weight_save(:) = state_average_weight(:) + if (int(N,8)*2_8 > huge(1)) then + print *, irp_here, ': integer too large' + stop -1 + endif call create_selection_buffer(N, N*2, b) ASSERT (associated(b%det)) ASSERT (associated(b%val)) @@ -244,8 +261,8 @@ subroutine ZMQ_pt2(E, pt2,relative_error, error, variance, norm, N_in) + 64.d0*pt2_n_tasks_max & ! task + 3.d0*pt2_n_tasks_max*N_states & ! pt2, variance, norm + 1.d0*pt2_n_tasks_max & ! i_generator, subset - + 2.d0*(N_int*2.d0*N_in + N_in) & ! selection buffers - + 1.d0*(N_int*2.d0*N_in + N_in) & ! sort/merge selection buffers + + 1.d0*(N_int*2.d0*ii+ ii) & ! selection buffer + + 1.d0*(N_int*2.d0*ii+ ii) & ! sort selection buffer + 2.0d0*(ii) & ! preinteresting, interesting, ! prefullinteresting, fullinteresting + 2.0d0*(N_int*2*ii) & ! minilist, fullminilist @@ -275,6 +292,7 @@ subroutine ZMQ_pt2(E, pt2,relative_error, error, variance, norm, N_in) print '(A)', ' Samples Energy Stat. Err Variance Norm Seconds ' print '(A)', '========== ================= =========== =============== =============== =================' + PROVIDE global_selection_buffer !$OMP PARALLEL DEFAULT(shared) NUM_THREADS(nproc_target+1) & !$OMP PRIVATE(i) i = omp_get_thread_num() @@ -322,12 +340,12 @@ subroutine pt2_slave_inproc(i) implicit none integer, intent(in) :: i + PROVIDE global_selection_buffer call run_pt2_slave(1,i,pt2_e0_denominator) end -subroutine pt2_collector(zmq_socket_pull, E, relative_error, pt2, error, & - variance, norm, b, N_) +subroutine pt2_collector(zmq_socket_pull, E, relative_error, pt2, error, variance, norm, b, N_) use f77_zmq use selection_types use bitmasks @@ -347,7 +365,8 @@ subroutine pt2_collector(zmq_socket_pull, E, relative_error, pt2, error, & double precision, allocatable :: nI(:,:), nI_task(:,:), T3(:) integer(ZMQ_PTR),external :: new_zmq_to_qp_run_socket integer(ZMQ_PTR) :: zmq_to_qp_run_socket - integer, external :: zmq_delete_tasks + integer, external :: zmq_delete_tasks_async_send + integer, external :: zmq_delete_tasks_async_recv integer, external :: zmq_abort integer, external :: pt2_find_sample_lr @@ -355,13 +374,12 @@ subroutine pt2_collector(zmq_socket_pull, E, relative_error, pt2, error, & integer, allocatable :: task_id(:) integer, allocatable :: index(:) - double precision, external :: omp_get_wtime double precision :: v, x, x2, x3, avg, avg2, avg3, eqt, E0, v0, n0 double precision :: time, time1, time0 integer, allocatable :: f(:) logical, allocatable :: d(:) - logical :: do_exit, stop_now + logical :: do_exit, stop_now, sending logical, external :: qp_stop type(selection_buffer) :: b2 @@ -369,6 +387,8 @@ subroutine pt2_collector(zmq_socket_pull, E, relative_error, pt2, error, & double precision :: rss double precision, external :: memory_of_double, memory_of_int + sending =.False. + rss = memory_of_int(pt2_n_tasks_max*2+N_det_generators*2) rss += memory_of_double(N_states*N_det_generators)*3.d0 rss += memory_of_double(N_states*pt2_n_tasks_max)*3.d0 @@ -444,6 +464,7 @@ subroutine pt2_collector(zmq_socket_pull, E, relative_error, pt2, error, & ! Add Stochastic part c = pt2_R(n) if(c > 0) then +!print *, 'c>0' x = 0d0 x2 = 0d0 x3 = 0d0 @@ -470,6 +491,7 @@ subroutine pt2_collector(zmq_socket_pull, E, relative_error, pt2, error, & pt2(pt2_stoch_istate) = avg variance(pt2_stoch_istate) = avg2 norm(pt2_stoch_istate) = avg3 + call wall_time(time) ! 1/(N-1.5) : see Brugger, The American Statistician (23) 4 p. 32 (1969) if(c > 2) then eqt = dabs((S2(t) / c) - (S(t)/c)**2) ! dabs for numerical stability @@ -490,30 +512,36 @@ subroutine pt2_collector(zmq_socket_pull, E, relative_error, pt2, error, & endif endif endif - call wall_time(time) end if n += 1 else if(more == 0) then exit else call pull_pt2_results(zmq_socket_pull, index, eI_task, vI_task, nI_task, task_id, n_tasks, b2) - if (zmq_delete_tasks(zmq_to_qp_run_socket,zmq_socket_pull,task_id,n_tasks,more) == -1) then - stop 'Unable to delete tasks' + if (zmq_delete_tasks_async_send(zmq_to_qp_run_socket,task_id,n_tasks,sending) == -1) then + stop 'PT2: Unable to delete tasks (send)' endif do i=1,n_tasks - eI(:, index(i)) += eI_task(:,i) - vI(:, index(i)) += vI_task(:,i) - nI(:, index(i)) += nI_task(:,i) + eI(1:N_states, index(i)) += eI_task(1:N_states,i) + vI(1:N_states, index(i)) += vI_task(1:N_states,i) + nI(1:N_states, index(i)) += nI_task(1:N_states,i) f(index(i)) -= 1 end do do i=1, b2%cur - call add_to_selection_buffer(b, b2%det(1,1,i), b2%val(i)) + ! We assume the pulled buffer is sorted if (b2%val(i) > b%mini) exit + call add_to_selection_buffer(b, b2%det(1,1,i), b2%val(i)) end do + if (zmq_delete_tasks_async_recv(zmq_to_qp_run_socket,more,sending) == -1) then + stop 'PT2: Unable to delete tasks (recv)' + endif end if end do +!print *, 'deleting b2' call delete_selection_buffer(b2) +!print *, 'sorting b' call sort_selection_buffer(b) +!print *, 'done' call end_zmq_to_qp_run_socket(zmq_to_qp_run_socket) end subroutine diff --git a/src/cipsi/run_pt2_slave.irp.f b/src/cipsi/run_pt2_slave.irp.f index 8063a7fc..21def8f2 100644 --- a/src/cipsi/run_pt2_slave.irp.f +++ b/src/cipsi/run_pt2_slave.irp.f @@ -1,7 +1,46 @@ + use omp_lib + use selection_types + use f77_zmq +BEGIN_PROVIDER [ integer(omp_lock_kind), global_selection_buffer_lock ] + use omp_lib + implicit none + BEGIN_DOC + ! Global buffer for the OpenMP selection + END_DOC + call omp_init_lock(global_selection_buffer_lock) +END_PROVIDER + +BEGIN_PROVIDER [ type(selection_buffer), global_selection_buffer ] + use omp_lib + implicit none + BEGIN_DOC + ! Global buffer for the OpenMP selection + END_DOC + call omp_set_lock(global_selection_buffer_lock) + call delete_selection_buffer(global_selection_buffer) + call create_selection_buffer(N_det_generators, 2*N_det_generators, & + global_selection_buffer) + call omp_unset_lock(global_selection_buffer_lock) +END_PROVIDER + subroutine run_pt2_slave(thread,iproc,energy) - use f77_zmq - use selection_types + use selection_types + use f77_zmq + implicit none + + double precision, intent(in) :: energy(N_states_diag) + integer, intent(in) :: thread, iproc + if (N_det > nproc*(elec_alpha_num * (mo_num-elec_alpha_num))**2) then + call run_pt2_slave_large(thread,iproc,energy) + else + call run_pt2_slave_small(thread,iproc,energy) + endif +end + +subroutine run_pt2_slave_small(thread,iproc,energy) + use selection_types + use f77_zmq implicit none double precision, intent(in) :: energy(N_states_diag) @@ -18,18 +57,16 @@ subroutine run_pt2_slave(thread,iproc,energy) integer(ZMQ_PTR), external :: new_zmq_push_socket integer(ZMQ_PTR) :: zmq_socket_push - type(selection_buffer) :: b, b2 + type(selection_buffer) :: b logical :: done, buffer_ready double precision,allocatable :: pt2(:,:), variance(:,:), norm(:,:) integer :: n_tasks, k, N integer, allocatable :: i_generator(:), subset(:) - double precision :: rss double precision, external :: memory_of_double, memory_of_int - rss = memory_of_int(pt2_n_tasks_max)*67.d0 - rss += memory_of_double(pt2_n_tasks_max)*(N_states*3) - call check_mem(rss,irp_here) + integer :: bsize ! Size of selection buffers +! logical :: sending allocate(task_id(pt2_n_tasks_max), task(pt2_n_tasks_max)) allocate(pt2(N_states,pt2_n_tasks_max), i_generator(pt2_n_tasks_max), subset(pt2_n_tasks_max)) @@ -50,8 +87,8 @@ subroutine run_pt2_slave(thread,iproc,energy) buffer_ready = .False. n_tasks = 1 +! sending = .False. done = .False. - n_tasks = 1 do while (.not.done) n_tasks = max(1,n_tasks) @@ -72,11 +109,11 @@ subroutine run_pt2_slave(thread,iproc,energy) enddo if (b%N == 0) then ! Only first time - call create_selection_buffer(N, N*2, b) - call create_selection_buffer(N, N*2, b2) + bsize = min(N, (elec_alpha_num * (mo_num-elec_alpha_num))**2) + call create_selection_buffer(bsize, bsize*2, b) buffer_ready = .True. else - ASSERT (N == b%N) + ASSERT (b%N == bsize) endif double precision :: time0, time1 @@ -93,20 +130,19 @@ subroutine run_pt2_slave(thread,iproc,energy) !print *, i_generator(1), time1-time2, n_tasks, pt2_F(i_generator(1)) enddo call wall_time(time1) -!print *, i_generator(1), time1-time0, n_tasks +!print *, '-->', i_generator(1), time1-time0, n_tasks integer, external :: tasks_done_to_taskserver if (tasks_done_to_taskserver(zmq_to_qp_run_socket,worker_id,task_id,n_tasks) == -1) then done = .true. endif call sort_selection_buffer(b) - call merge_selection_buffers(b,b2) call push_pt2_results(zmq_socket_push, i_generator, pt2, variance, norm, b, task_id, n_tasks) - b%mini = b2%mini b%cur=0 - ! Try to adjust n_tasks around nproc/8 seconds per job - n_tasks = min(2*n_tasks,int( dble(n_tasks * nproc/8) / (time1 - time0 + 1.d0))) +! ! Try to adjust n_tasks around nproc/2 seconds per job +! n_tasks = min(2*n_tasks,int( dble(n_tasks * nproc/2) / (time1 - time0 + 1.d0))) + n_tasks = 1 end do integer, external :: disconnect_from_taskserver @@ -120,14 +156,150 @@ subroutine run_pt2_slave(thread,iproc,energy) call end_zmq_to_qp_run_socket(zmq_to_qp_run_socket) if (buffer_ready) then call delete_selection_buffer(b) - call delete_selection_buffer(b2) endif end subroutine +subroutine run_pt2_slave_large(thread,iproc,energy) + use selection_types + use f77_zmq + implicit none + + double precision, intent(in) :: energy(N_states_diag) + integer, intent(in) :: thread, iproc + integer :: rc, i + + integer :: worker_id, ctask, ltask + character*(512), allocatable :: task(:) + integer, allocatable :: task_id(:) + + integer(ZMQ_PTR),external :: new_zmq_to_qp_run_socket + integer(ZMQ_PTR) :: zmq_to_qp_run_socket + + integer(ZMQ_PTR), external :: new_zmq_push_socket + integer(ZMQ_PTR) :: zmq_socket_push + + type(selection_buffer) :: b + logical :: done, buffer_ready + + double precision,allocatable :: pt2(:,:), variance(:,:), norm(:,:) + integer :: n_tasks, k, N + integer, allocatable :: i_generator(:), subset(:) + + integer :: bsize ! Size of selection buffers + logical :: sending + PROVIDE global_selection_buffer global_selection_buffer_lock + + + allocate(task_id(pt2_n_tasks_max), task(pt2_n_tasks_max)) + allocate(pt2(N_states,pt2_n_tasks_max), i_generator(pt2_n_tasks_max), subset(pt2_n_tasks_max)) + allocate(variance(N_states,pt2_n_tasks_max)) + allocate(norm(N_states,pt2_n_tasks_max)) + + zmq_to_qp_run_socket = new_zmq_to_qp_run_socket() + + integer, external :: connect_to_taskserver + if (connect_to_taskserver(zmq_to_qp_run_socket,worker_id,thread) == -1) then + call end_zmq_to_qp_run_socket(zmq_to_qp_run_socket) + return + endif + + zmq_socket_push = new_zmq_push_socket(thread) + + b%N = 0 + buffer_ready = .False. + n_tasks = 1 + + sending = .False. + done = .False. + do while (.not.done) + + n_tasks = max(1,n_tasks) + n_tasks = min(pt2_n_tasks_max,n_tasks) + + integer, external :: get_tasks_from_taskserver + if (get_tasks_from_taskserver(zmq_to_qp_run_socket,worker_id, task_id, task, n_tasks) == -1) then + exit + endif + done = task_id(n_tasks) == 0 + if (done) then + n_tasks = n_tasks-1 + endif + if (n_tasks == 0) exit + + do k=1,n_tasks + read (task(k),*) subset(k), i_generator(k), N + enddo + if (b%N == 0) then + ! Only first time + bsize = min(N, (elec_alpha_num * (mo_num-elec_alpha_num))**2) + call create_selection_buffer(bsize, bsize*2, b) + buffer_ready = .True. + else + ASSERT (b%N == bsize) + endif + + double precision :: time0, time1 + call wall_time(time0) + do k=1,n_tasks + pt2(:,k) = 0.d0 + variance(:,k) = 0.d0 + norm(:,k) = 0.d0 + b%cur = 0 +!double precision :: time2 +!call wall_time(time2) + call select_connected(i_generator(k),energy,pt2(1,k),variance(1,k),norm(1,k),b,subset(k),pt2_F(i_generator(k))) +!call wall_time(time1) +!print *, i_generator(1), time1-time2, n_tasks, pt2_F(i_generator(1)) + enddo + call wall_time(time1) +!print *, '-->', i_generator(1), time1-time0, n_tasks + + integer, external :: tasks_done_to_taskserver + if (tasks_done_to_taskserver(zmq_to_qp_run_socket,worker_id,task_id,n_tasks) == -1) then + done = .true. + endif + call sort_selection_buffer(b) + call push_pt2_results_async_recv(zmq_socket_push,b%mini,sending) + call omp_set_lock(global_selection_buffer_lock) + global_selection_buffer%mini = b%mini + call merge_selection_buffers(b,global_selection_buffer) + b%cur=0 + call omp_unset_lock(global_selection_buffer_lock) + if ( iproc == 1 ) then + call omp_set_lock(global_selection_buffer_lock) + call push_pt2_results_async_send(zmq_socket_push, i_generator, pt2, variance, norm, global_selection_buffer, task_id, n_tasks,sending) + global_selection_buffer%cur = 0 + call omp_unset_lock(global_selection_buffer_lock) + else + call push_pt2_results_async_send(zmq_socket_push, i_generator, pt2, variance, norm, b, task_id, n_tasks,sending) + endif + +! ! Try to adjust n_tasks around nproc/2 seconds per job +! n_tasks = min(2*n_tasks,int( dble(n_tasks * nproc/2) / (time1 - time0 + 1.d0))) + n_tasks = 1 + end do + call push_pt2_results_async_recv(zmq_socket_push,b%mini,sending) + + integer, external :: disconnect_from_taskserver + do i=1,300 + if (disconnect_from_taskserver(zmq_to_qp_run_socket,worker_id) /= -2) exit + call sleep(1) + print *, 'Retry disconnect...' + end do + + call end_zmq_push_socket(zmq_socket_push,thread) + call end_zmq_to_qp_run_socket(zmq_to_qp_run_socket) + if (buffer_ready) then + call delete_selection_buffer(b) + endif + FREE global_selection_buffer +end subroutine + + subroutine push_pt2_results(zmq_socket_push, index, pt2, variance, norm, b, task_id, n_tasks) - use f77_zmq - use selection_types + use selection_types + use f77_zmq implicit none integer(ZMQ_PTR), intent(in) :: zmq_socket_push @@ -136,10 +308,39 @@ subroutine push_pt2_results(zmq_socket_push, index, pt2, variance, norm, b, task double precision, intent(in) :: norm(N_states,n_tasks) integer, intent(in) :: n_tasks, index(n_tasks), task_id(n_tasks) type(selection_buffer), intent(inout) :: b + + logical :: sending + sending = .False. + call push_pt2_results_async_send(zmq_socket_push, index, pt2, variance, norm, b, task_id, n_tasks, sending) + call push_pt2_results_async_recv(zmq_socket_push, b%mini, sending) +end subroutine + + +subroutine push_pt2_results_async_send(zmq_socket_push, index, pt2, variance, norm, b, task_id, n_tasks, sending) + use selection_types + use f77_zmq + implicit none + + integer(ZMQ_PTR), intent(in) :: zmq_socket_push + double precision, intent(in) :: pt2(N_states,n_tasks) + double precision, intent(in) :: variance(N_states,n_tasks) + double precision, intent(in) :: norm(N_states,n_tasks) + integer, intent(in) :: n_tasks, index(n_tasks), task_id(n_tasks) + type(selection_buffer), intent(inout) :: b + logical, intent(inout) :: sending integer :: rc + integer*8 :: rc8 + + if (sending) then + print *, irp_here, ': sending is true' + stop -1 + endif + sending = .True. rc = f77_zmq_send( zmq_socket_push, n_tasks, 4, ZMQ_SNDMORE) if (rc == -1) then + print *, irp_here, ': error sending result' + stop 1 return else if(rc /= 4) then stop 'push' @@ -148,6 +349,8 @@ subroutine push_pt2_results(zmq_socket_push, index, pt2, variance, norm, b, task rc = f77_zmq_send( zmq_socket_push, index, 4*n_tasks, ZMQ_SNDMORE) if (rc == -1) then + print *, irp_here, ': error sending result' + stop 2 return else if(rc /= 4*n_tasks) then stop 'push' @@ -156,6 +359,8 @@ subroutine push_pt2_results(zmq_socket_push, index, pt2, variance, norm, b, task rc = f77_zmq_send( zmq_socket_push, pt2, 8*N_states*n_tasks, ZMQ_SNDMORE) if (rc == -1) then + print *, irp_here, ': error sending result' + stop 3 return else if(rc /= 8*N_states*n_tasks) then stop 'push' @@ -164,6 +369,8 @@ subroutine push_pt2_results(zmq_socket_push, index, pt2, variance, norm, b, task rc = f77_zmq_send( zmq_socket_push, variance, 8*N_states*n_tasks, ZMQ_SNDMORE) if (rc == -1) then + print *, irp_here, ': error sending result' + stop 4 return else if(rc /= 8*N_states*n_tasks) then stop 'push' @@ -172,6 +379,8 @@ subroutine push_pt2_results(zmq_socket_push, index, pt2, variance, norm, b, task rc = f77_zmq_send( zmq_socket_push, norm, 8*N_states*n_tasks, ZMQ_SNDMORE) if (rc == -1) then + print *, irp_here, ': error sending result' + stop 5 return else if(rc /= 8*N_states*n_tasks) then stop 'push' @@ -180,35 +389,71 @@ subroutine push_pt2_results(zmq_socket_push, index, pt2, variance, norm, b, task rc = f77_zmq_send( zmq_socket_push, task_id, n_tasks*4, ZMQ_SNDMORE) if (rc == -1) then + print *, irp_here, ': error sending result' + stop 6 return else if(rc /= 4*n_tasks) then stop 'push' endif - rc = f77_zmq_send( zmq_socket_push, b%cur, 4, ZMQ_SNDMORE) - if (rc == -1) then - return - else if(rc /= 4) then - stop 'push' + if (b%cur == 0) then + + rc = f77_zmq_send( zmq_socket_push, b%cur, 4, 0) + if (rc == -1) then + print *, irp_here, ': error sending result' + stop 7 + return + else if(rc /= 4) then + stop 'push' + endif + + else + + rc = f77_zmq_send( zmq_socket_push, b%cur, 4, ZMQ_SNDMORE) + if (rc == -1) then + print *, irp_here, ': error sending result' + stop 7 + return + else if(rc /= 4) then + stop 'push' + endif + + + rc8 = f77_zmq_send8( zmq_socket_push, b%val, 8_8*int(b%cur,8), ZMQ_SNDMORE) + if (rc8 == -1_8) then + print *, irp_here, ': error sending result' + stop 8 + return + else if(rc8 /= 8_8*int(b%cur,8)) then + stop 'push' + endif + + + rc8 = f77_zmq_send8( zmq_socket_push, b%det, int(bit_kind*N_int*2,8)*int(b%cur,8), 0) + if (rc8 == -1_8) then + print *, irp_here, ': error sending result' + stop 9 + return + else if(rc8 /= int(N_int*2*8,8)*int(b%cur,8)) then + stop 'push' + endif + endif +end subroutine - rc = f77_zmq_send( zmq_socket_push, b%val, 8*b%cur, ZMQ_SNDMORE) - if (rc == -1) then - return - else if(rc /= 8*b%cur) then - stop 'push' - endif +subroutine push_pt2_results_async_recv(zmq_socket_push,mini,sending) + use selection_types + use f77_zmq + implicit none + integer(ZMQ_PTR), intent(in) :: zmq_socket_push + double precision, intent(out) :: mini + logical, intent(inout) :: sending + integer :: rc - rc = f77_zmq_send( zmq_socket_push, b%det, bit_kind*N_int*2*b%cur, 0) - if (rc == -1) then - return - else if(rc /= N_int*2*8*b%cur) then - stop 'push' - endif - + if (.not.sending) return ! Activate is zmq_socket_push is a REQ IRP_IF ZMQ_PUSH @@ -216,19 +461,31 @@ IRP_ELSE character*(2) :: ok rc = f77_zmq_recv( zmq_socket_push, ok, 2, 0) if (rc == -1) then + print *, irp_here, ': error sending result' + stop 10 return else if ((rc /= 2).and.(ok(1:2) /= 'ok')) then print *, irp_here//': error in receiving ok' stop -1 endif + rc = f77_zmq_recv( zmq_socket_push, mini, 8, 0) + if (rc == -1) then + print *, irp_here, ': error sending result' + stop 11 + return + else if (rc /= 8) then + print *, irp_here//': error in receiving mini' + stop 12 + endif IRP_ENDIF - + sending = .False. end subroutine + subroutine pull_pt2_results(zmq_socket_pull, index, pt2, variance, norm, task_id, n_tasks, b) - use f77_zmq - use selection_types + use selection_types + use f77_zmq implicit none integer(ZMQ_PTR), intent(in) :: zmq_socket_pull double precision, intent(inout) :: pt2(N_states,*) @@ -238,6 +495,7 @@ subroutine pull_pt2_results(zmq_socket_pull, index, pt2, variance, norm, task_id integer, intent(out) :: index(*) integer, intent(out) :: n_tasks, task_id(*) integer :: rc, rn, i + integer*8 :: rc8 rc = f77_zmq_recv( zmq_socket_pull, n_tasks, 4, 0) if (rc == -1) then @@ -295,27 +553,30 @@ subroutine pull_pt2_results(zmq_socket_pull, index, pt2, variance, norm, task_id stop 'pull' endif - rc = f77_zmq_recv( zmq_socket_pull, b%val, 8*b%cur, 0) - if (rc == -1) then - n_tasks = 1 - task_id(1) = 0 - else if(rc /= 8*b%cur) then - stop 'pull' - endif + if (b%cur > 0) then - rc = f77_zmq_recv( zmq_socket_pull, b%det, bit_kind*N_int*2*b%cur, 0) - if (rc == -1) then - n_tasks = 1 - task_id(1) = 0 - else if(rc /= N_int*2*8*b%cur) then - stop 'pull' - endif + rc8 = f77_zmq_recv8( zmq_socket_pull, b%val, 8_8*int(b%cur,8), 0) + if (rc8 == -1_8) then + n_tasks = 1 + task_id(1) = 0 + else if(rc8 /= 8_8*int(b%cur,8)) then + stop 'pull' + endif + rc8 = f77_zmq_recv8( zmq_socket_pull, b%det, int(bit_kind*N_int*2,8)*int(b%cur,8), 0) + if (rc8 == -1_8) then + n_tasks = 1 + task_id(1) = 0 + else if(rc8 /= int(N_int*2*8,8)*int(b%cur,8)) then + stop 'pull' + endif + + endif ! Activate is zmq_socket_pull is a REP IRP_IF ZMQ_PUSH IRP_ELSE - rc = f77_zmq_send( zmq_socket_pull, 'ok', 2, 0) + rc = f77_zmq_send( zmq_socket_pull, 'ok', 2, ZMQ_SNDMORE) if (rc == -1) then n_tasks = 1 task_id(1) = 0 @@ -323,6 +584,7 @@ IRP_ELSE print *, irp_here//': error in sending ok' stop -1 endif + rc = f77_zmq_send( zmq_socket_pull, b%mini, 8, 0) IRP_ENDIF end subroutine diff --git a/src/cipsi/run_selection_slave.irp.f b/src/cipsi/run_selection_slave.irp.f index 04bb99ef..480ef12b 100644 --- a/src/cipsi/run_selection_slave.irp.f +++ b/src/cipsi/run_selection_slave.irp.f @@ -55,12 +55,13 @@ subroutine run_selection_slave(thread,iproc,energy) if (done) then ctask = ctask - 1 else - integer :: i_generator, N, subset + integer :: i_generator, N, subset, bsize read(task,*) subset, i_generator, N if(buf%N == 0) then ! Only first time - call create_selection_buffer(N, N*2, buf) - call create_selection_buffer(N, N*2, buf2) + bsize = min(N, (elec_alpha_num * (mo_num-elec_alpha_num))**2) + call create_selection_buffer(bsize, bsize*2, buf) +! call create_selection_buffer(N, N*2, buf2) buffer_ready = .True. else ASSERT (N == buf%N) @@ -83,9 +84,9 @@ subroutine run_selection_slave(thread,iproc,energy) end do if(ctask > 0) then call sort_selection_buffer(buf) - call merge_selection_buffers(buf,buf2) +! call merge_selection_buffers(buf,buf2) call push_selection_results(zmq_socket_push, pt2, variance, norm, buf, task_id(1), ctask) - buf%mini = buf2%mini +! buf%mini = buf2%mini pt2(:) = 0d0 variance(:) = 0d0 norm(:) = 0d0 @@ -108,7 +109,7 @@ subroutine run_selection_slave(thread,iproc,energy) call end_zmq_push_socket(zmq_socket_push,thread) if (buffer_ready) then call delete_selection_buffer(buf) - call delete_selection_buffer(buf2) +! call delete_selection_buffer(buf2) endif end subroutine diff --git a/src/cipsi/selection.irp.f b/src/cipsi/selection.irp.f index 1e91019f..69540afc 100644 --- a/src/cipsi/selection.irp.f +++ b/src/cipsi/selection.irp.f @@ -153,27 +153,11 @@ subroutine select_singles_and_doubles(i_generator,hole_mask,particle_mask,fock_d logical :: monoAdo, monoBdo integer :: maskInd - double precision :: rss - double precision, external :: memory_of_double, memory_of_int - PROVIDE psi_bilinear_matrix_columns_loc psi_det_alpha_unique psi_det_beta_unique PROVIDE psi_bilinear_matrix_rows psi_det_sorted_order psi_bilinear_matrix_order PROVIDE psi_bilinear_matrix_transp_rows_loc psi_bilinear_matrix_transp_columns PROVIDE psi_bilinear_matrix_transp_order psi_selectors_coef_transp - ii = min(N_det,(elec_alpha_num*(mo_num-elec_alpha_num))**2) - rss = memory_of_double( & - 2*N_int*2*ii & ! minilist, fullminilist - + N_states*mo_num*mo_num & ! mat - ) + memory_of_int( & - + 2*ii & ! preinteresting, prefullinteresting, - + 2*ii & ! interesting, fullinteresting - + mo_num*mo_num/2 & ! banned - + mo_num/2 & ! bannedOrb - ) - - call check_mem(rss,irp_here) - monoAdo = .true. monoBdo = .true. @@ -244,7 +228,7 @@ subroutine select_singles_and_doubles(i_generator,hole_mask,particle_mask,fock_d deallocate(exc_degree) nmax=k-1 - + allocate(iorder(nmax)) do i=1,nmax iorder(i) = i @@ -254,8 +238,8 @@ subroutine select_singles_and_doubles(i_generator,hole_mask,particle_mask,fock_d allocate(preinteresting(0:32), prefullinteresting(0:32), & interesting(0:32), fullinteresting(0:32)) - preinteresting(0) = 0 - prefullinteresting(0) = 0 + preinteresting(:) = 0 + prefullinteresting(:) = 0 do i=1,N_int negMask(i,1) = not(psi_det_generators(i,1,i_generator)) @@ -658,13 +642,11 @@ subroutine splash_pq(mask, sp, det, i_gen, N_sel, bannedOrb, banned, mat, intere negMask(i,2) = not(mask(i,2)) end do - do i=1, N_sel ! interesting(0) - !i = interesting(ii) + do i=1, N_sel if (interesting(i) < 0) then stop 'prefetch interesting(i) and det(i)' endif - mobMask(1,1) = iand(negMask(1,1), det(1,1,i)) mobMask(1,2) = iand(negMask(1,2), det(1,2,i)) nt = popcnt(mobMask(1, 1)) + popcnt(mobMask(1, 2)) @@ -695,10 +677,10 @@ subroutine splash_pq(mask, sp, det, i_gen, N_sel, bannedOrb, banned, mat, intere end if end if - call bitstring_to_list_in_selection(mobMask(1,1), p(1,1), p(0,1), N_int) - call bitstring_to_list_in_selection(mobMask(1,2), p(1,2), p(0,2), N_int) - if (interesting(i) >= i_gen) then + call bitstring_to_list_in_selection(mobMask(1,1), p(1,1), p(0,1), N_int) + call bitstring_to_list_in_selection(mobMask(1,2), p(1,2), p(0,2), N_int) + perMask(1,1) = iand(mask(1,1), not(det(1,1,i))) perMask(1,2) = iand(mask(1,2), not(det(1,2,i))) do j=2,N_int @@ -717,9 +699,14 @@ subroutine splash_pq(mask, sp, det, i_gen, N_sel, bannedOrb, banned, mat, intere else call get_d0(det(1,1,i), phasemask, bannedOrb, banned, mat, mask, h, p, sp, psi_selectors_coef_transp(1, interesting(i))) end if - else - if(nt == 4) call past_d2(banned, p, sp) - if(nt == 3) call past_d1(bannedOrb, p) + else if(nt == 4) then + call bitstring_to_list_in_selection(mobMask(1,1), p(1,1), p(0,1), N_int) + call bitstring_to_list_in_selection(mobMask(1,2), p(1,2), p(0,2), N_int) + call past_d2(banned, p, sp) + else if(nt == 3) then + call bitstring_to_list_in_selection(mobMask(1,1), p(1,1), p(0,1), N_int) + call bitstring_to_list_in_selection(mobMask(1,2), p(1,2), p(0,2), N_int) + call past_d1(bannedOrb, p) end if end do @@ -1279,4 +1266,4 @@ subroutine bitstring_to_list_in_selection( string, list, n_elements, Nint) enddo end - +! diff --git a/src/cipsi/selection_buffer.irp.f b/src/cipsi/selection_buffer.irp.f index ce7f2d8b..aa3be942 100644 --- a/src/cipsi/selection_buffer.irp.f +++ b/src/cipsi/selection_buffer.irp.f @@ -2,6 +2,10 @@ subroutine create_selection_buffer(N, siz_, res) use selection_types implicit none + BEGIN_DOC +! Allocates the memory for a selection buffer. +! The arrays have dimension siz_ and the maximum number of elements is N + END_DOC integer, intent(in) :: N, siz_ type(selection_buffer), intent(out) :: res @@ -33,6 +37,11 @@ subroutine delete_selection_buffer(b) if (associated(b%val)) then deallocate(b%val) endif + NULLIFY(b%det) + NULLIFY(b%val) + b%cur = 0 + b%mini = 0.d0 + b%N = 0 end @@ -65,7 +74,7 @@ subroutine merge_selection_buffers(b1, b2) type(selection_buffer), intent(inout) :: b2 integer(bit_kind), pointer :: detmp(:,:,:) double precision, pointer :: val(:) - integer :: i, i1, i2, k, nmwen + integer :: i, i1, i2, k, nmwen, sze if (b1%cur == 0) return do while (b1%val(b1%cur) > b2%mini) b1%cur = b1%cur-1 @@ -76,9 +85,10 @@ subroutine merge_selection_buffers(b1, b2) nmwen = min(b1%N, b1%cur+b2%cur) double precision :: rss double precision, external :: memory_of_double - rss = memory_of_double(size(b1%val)) + 2*N_int*memory_of_double(size(b1%det,3)) + sze = max(size(b1%val), size(b2%val)) + rss = memory_of_double(sze) + 2*N_int*memory_of_double(sze) call check_mem(rss,irp_here) - allocate( val(size(b1%val)), detmp(N_int, 2, size(b1%det,3)) ) + allocate(val(sze), detmp(N_int, 2, sze)) i1=1 i2=1 do i=1,nmwen diff --git a/src/cipsi/slave_cipsi.irp.f b/src/cipsi/slave_cipsi.irp.f index 2b64326d..58b53f94 100644 --- a/src/cipsi/slave_cipsi.irp.f +++ b/src/cipsi/slave_cipsi.irp.f @@ -53,7 +53,7 @@ subroutine run_slave_main PROVIDE psi_det psi_coef threshold_generators state_average_weight mpi_master PROVIDE zmq_state N_det_selectors pt2_stoch_istate N_det pt2_e0_denominator - PROVIDE N_det_generators N_states N_states_diag pt2_e0_denominator + PROVIDE N_det_generators N_states N_states_diag pt2_e0_denominator mpi_rank IRP_IF MPI call MPI_BARRIER(MPI_COMM_WORLD, ierr) @@ -161,18 +161,17 @@ subroutine run_slave_main call mpi_print('zmq_get_psi') IRP_ENDIF if (zmq_get_psi(zmq_to_qp_run_socket,1) == -1) cycle - IRP_IF MPI_DEBUG - call mpi_print('zmq_get_dvector energy') - IRP_ENDIF - if (zmq_get_dvector(zmq_to_qp_run_socket,1,'energy',energy,N_states_diag) == -1) cycle call wall_time(t1) call write_double(6,(t1-t0),'Broadcast time') + !--- call omp_set_nested(.True.) call davidson_slave_tcp(0) call omp_set_nested(.False.) print *, mpi_rank, ': Davidson done' + !--- + IRP_IF MPI call MPI_BARRIER(MPI_COMM_WORLD, ierr) if (ierr /= MPI_SUCCESS) then @@ -223,14 +222,6 @@ subroutine run_slave_main if (zmq_get_dvector(zmq_to_qp_run_socket,1,'state_average_weight',state_average_weight,N_states) == -1) cycle pt2_e0_denominator(1:N_states) = energy(1:N_states) SOFT_TOUCH pt2_e0_denominator state_average_weight pt2_stoch_istate threshold_generators - if (mpi_master) then - print *, 'N_det', N_det - print *, 'N_det_generators', N_det_generators - print *, 'N_det_selectors', N_det_selectors - print *, 'pt2_e0_denominator', pt2_e0_denominator - print *, 'pt2_stoch_istate', pt2_stoch_istate - print *, 'state_average_weight', state_average_weight - endif call wall_time(t1) call write_double(6,(t1-t0),'Broadcast time') @@ -241,17 +232,78 @@ subroutine run_slave_main endif IRP_ENDIF + IRP_IF MPI_DEBUG call mpi_print('Entering OpenMP section') IRP_ENDIF if (.true.) then - !$OMP PARALLEL PRIVATE(i) - i = omp_get_thread_num() - call run_pt2_slave(0,i,pt2_e0_denominator) - !$OMP END PARALLEL + integer :: nproc_target, ii + double precision :: mem_collector, mem, rss + + call resident_memory(rss) + + nproc_target = nthreads_pt2 + ii = min(N_det, (elec_alpha_num*(mo_num-elec_alpha_num))**2) + + do + mem = rss + & ! + nproc_target * 8.d0 * & ! bytes + ( 0.5d0*pt2_n_tasks_max & ! task_id + + 64.d0*pt2_n_tasks_max & ! task + + 3.d0*pt2_n_tasks_max*N_states & ! pt2, variance, norm + + 1.d0*pt2_n_tasks_max & ! i_generator, subset + + 3.d0*(N_int*2.d0*ii+ ii) & ! selection buffer + + 1.d0*(N_int*2.d0*ii+ ii) & ! sort selection buffer + + 2.0d0*(ii) & ! preinteresting, interesting, + ! prefullinteresting, fullinteresting + + 2.0d0*(N_int*2*ii) & ! minilist, fullminilist + + 1.0d0*(N_states*mo_num*mo_num) & ! mat + ) / 1024.d0**3 + + if (nproc_target == 0) then + call check_mem(mem,irp_here) + nproc_target = 1 + exit + endif + + if (mem+rss < qp_max_mem) then + exit + endif + + nproc_target = nproc_target - 1 + + enddo + + if (N_det > 100000) then + + if (mpi_master) then + print *, 'N_det', N_det + print *, 'N_det_generators', N_det_generators + print *, 'N_det_selectors', N_det_selectors + print *, 'pt2_e0_denominator', pt2_e0_denominator + print *, 'pt2_stoch_istate', pt2_stoch_istate + print *, 'state_average_weight', state_average_weight + print *, 'Number of threads', nproc_target + endif + + if (h0_type == 'SOP') then + PROVIDE det_to_occ_pattern + endif + + PROVIDE global_selection_buffer + if (mpi_master) then + print *, 'Running PT2' + endif + !$OMP PARALLEL PRIVATE(i) NUM_THREADS(nproc_target+1) + i = omp_get_thread_num() + call run_pt2_slave(0,i,pt2_e0_denominator) + !$OMP END PARALLEL + FREE state_average_weight + print *, mpi_rank, ': PT2 done' + print *, '-------' + + endif endif - FREE state_average_weight - print *, mpi_rank, ': PT2 done' IRP_IF MPI call MPI_BARRIER(MPI_COMM_WORLD, ierr) diff --git a/src/cipsi/stochastic_cipsi.irp.f b/src/cipsi/stochastic_cipsi.irp.f index 9841a429..791656ce 100644 --- a/src/cipsi/stochastic_cipsi.irp.f +++ b/src/cipsi/stochastic_cipsi.irp.f @@ -10,7 +10,7 @@ subroutine run_stochastic_cipsi double precision :: rss double precision, external :: memory_of_double - PROVIDE H_apply_buffer_allocated + PROVIDE H_apply_buffer_allocated N_generators_bitmask threshold_generators = 1.d0 SOFT_TOUCH threshold_generators diff --git a/src/cis/README.rst b/src/cis/README.rst index b1e3e2e1..61077e69 100644 --- a/src/cis/README.rst +++ b/src/cis/README.rst @@ -2,34 +2,39 @@ cis === -This module contains a CIS program. +This module contains a |CIS| program. The user point of view ---------------------- -The :command:`cis` program performs the CI of the ROHF-like + all single excitations on top of it. -This program can be very useful to : +The :ref:`cis` program performs the CI to obtain the ROHF reference + all +single excitations on top of it. This program can be very useful to: -* **Ground state calculations**: generate a guess for the ground state wave function if one is not sure that the :c:func:`scf` program gave the lowest SCF solution. In combination with :c:func:`save_natorb` it can produce new |MOs| in order to reperform an :c:func:`scf` optimization. +* **Ground state calculations**: generate a guess for the ground state wave + function if one is not sure that the :ref:`scf` program gave the lowest |SCF| + solution. In combination with :ref:`save_natorb` it can produce new |MOs| in + order to reperform an :ref:`scf` optimization. -* **Excited states calculations**: generate guess for all the :option:`determinants n_states` wave functions, that will be used by the :c:func:`fci` program. +* **Excited states calculations**: generate guesses for all the + :option:`determinants n_states` wave functions, that will be used by the + :ref:`fci` program. The main keywords/options to be used are: -* :option:`determinants n_states` : number of states to consider for the |CIS| calculation +* :option:`determinants n_states`: number of states to consider for the |CIS| calculation -* :option:`determinants s2_eig` : force all states to have the desired value of :math:`S^2` +* :option:`determinants s2_eig`: force all states to have the desired value of |S^2| -* :option:`determinants expected_s2` : desired value of :math:`S^2` +* :option:`determinants expected_s2`: desired value of |S^2| -The programmer point of view ----------------------------- +The programmer's point of view +------------------------------ -This module have been built by setting the following rules: +This module was built by setting the following rules: * The only generator determinant is the Hartree-Fock (single-reference method) * All generated singly excited determinants are included in the wave function (no perturbative diff --git a/src/cis/cis.irp.f b/src/cis/cis.irp.f index 6ab2e7e9..48f0b9e5 100644 --- a/src/cis/cis.irp.f +++ b/src/cis/cis.irp.f @@ -1,55 +1,52 @@ program cis implicit none BEGIN_DOC - ! - ! Configuration Interaction with Single excitations. - ! - ! This program takes a reference Slater determinant of ROHF-like - ! occupancy, and performs all single excitations on top of it. - ! Disregarding spatial symmetry, it computes the `n_states` lowest - ! eigenstates of that CI matrix. (see :option:`determinants n_states`) - ! - ! This program can be useful in many cases: - ! - ! - ! Ground state calculation - ! ------------------------ - ! - ! To be sure to have the lowest |SCF| solution, perform an :ref:`scf` - ! (see the :ref:`hartree_fock` module), then a :ref:`cis`, save - ! the natural orbitals (see :ref:`save_natorb`) and re-run an - ! :ref:`scf` optimization from this |MO| guess. - ! - ! - ! Excited states calculations - ! --------------------------- - ! - ! The lowest excited states are much likely to be dominated by - ! single-excitations. Therefore, running a :ref:`cis` will save - ! the `n_states` lowest states within the |CIS| space in the |EZFIO| - ! directory, which can afterwards be used as guess wave functions for - ! a further multi-state |FCI| calculation if :option:`determinants read_wf` - ! is set to |true| before running the :ref:`fci` - ! executable. - ! - ! - ! If :option:`determinants s2_eig` is set to |true|, the |CIS| - ! will only retain states having the expected |S^2| value (see - ! :option:`determinants expected_s2`). Otherwise, the |CIS| will take - ! the lowest :option:`determinants n_states`, whatever multiplicity - ! they are. - ! - ! .. note:: - ! - ! To discard some orbitals, use the :ref:`qp_set_mo_class` - ! command to specify: - ! - ! * *core* orbitals which will be always doubly occupied - ! - ! * *act* orbitals where an electron can be either excited from or to - ! - ! * *del* orbitals which will be never occupied - ! +! +! Configuration Interaction with Single excitations. +! +! This program takes a reference Slater determinant of ROHF-like +! occupancy, and performs all single excitations on top of it. +! Disregarding spatial symmetry, it computes the `n_states` lowest +! eigenstates of that CI matrix. (see :option:`determinants n_states`) +! +! This program can be useful in many cases: +! +! +! 1. Ground state calculation +! +! To be sure to have the lowest |SCF| solution, perform an :ref:`scf` +! (see the :ref:`module_hartree_fock` module), then a :ref:`cis`, save the +! natural orbitals (see :ref:`save_natorb`) and re-run an :ref:`scf` +! optimization from this |MO| guess. +! +! +! 2. Excited states calculations +! +! The lowest excited states are much likely to be dominated by +! single-excitations. Therefore, running a :ref:`cis` will save the +! `n_states` lowest states within the |CIS| space in the |EZFIO| +! directory, which can afterwards be used as guess wave functions for +! a further multi-state |FCI| calculation if :option:`determinants +! read_wf` is set to |true| before running the :ref:`fci` executable. +! +! +! If :option:`determinants s2_eig` is set to |true|, the |CIS| +! will only retain states having the expected |S^2| value (see +! :option:`determinants expected_s2`). Otherwise, the |CIS| will take +! the lowest :option:`determinants n_states`, whatever multiplicity +! they are. +! +! .. note:: +! +! To discard some orbitals, use the :ref:`qp_set_mo_class` +! command to specify: +! +! * *core* orbitals which will be always doubly occupied +! +! * *act* orbitals where an electron can be either excited from or to +! +! * *del* orbitals which will be never occupied +! END_DOC read_wf = .False. SOFT_TOUCH read_wf diff --git a/src/cisd/cisd.irp.f b/src/cisd/cisd.irp.f index 79f312d5..9631f971 100644 --- a/src/cisd/cisd.irp.f +++ b/src/cisd/cisd.irp.f @@ -11,7 +11,7 @@ program cisd ! ! This program can be useful in many cases: ! - ! * GROUND STATE CALCULATION: if even after a :c:func:`cis` calculation, natural + ! * **Ground state calculation**: if even after a :c:func:`cis` calculation, natural ! orbitals (see :c:func:`save_natorb`) and then :c:func:`scf` optimization, you are not sure to have the lowest scf ! solution, ! do the same strategy with the :c:func:`cisd` executable instead of the :c:func:`cis` exectuable to generate the natural @@ -19,11 +19,11 @@ program cisd ! ! ! - ! * EXCITED STATES CALCULATIONS: the lowest excited states are much likely to + ! * **Excited states calculations**: the lowest excited states are much likely to ! be dominanted by single- or double-excitations. ! Therefore, running a :c:func:`cisd` will save the "n_states" lowest states within ! the CISD space - ! in the EZFIO folder, which can afterward be used as guess wave functions + ! in the |EZFIO| directory, which can afterward be used as guess wave functions ! for a further multi-state fci calculation if you specify "read_wf" = True ! before running the fci executable (see :option:`determinants read_wf`). ! Also, if you specify "s2_eig" = True, the cisd will only retain states @@ -42,6 +42,7 @@ program cisd ! * "act" orbitals where an electron can be either excited from or to ! ! * "del" orbitals which will be never occupied + ! END_DOC read_wf = .False. SOFT_TOUCH read_wf diff --git a/src/davidson/EZFIO.cfg b/src/davidson/EZFIO.cfg index f5d68a32..e1ad58ae 100644 --- a/src/davidson/EZFIO.cfg +++ b/src/davidson/EZFIO.cfg @@ -13,7 +13,7 @@ interface: ezfio,ocaml [davidson_sze_max] type: Strictly_positive_int doc: Number of micro-iterations before re-contracting -default: 8 +default: 15 interface: ezfio,provider,ocaml [state_following] diff --git a/src/davidson/README.rst b/src/davidson/README.rst index 596abca0..1df5f343 100644 --- a/src/davidson/README.rst +++ b/src/davidson/README.rst @@ -3,12 +3,19 @@ davidson ======== Abstract module for Davidson's diagonalization. -It contains everything required for the Davidson algorithm, dressed or not. If -a dressing is used, the dressing column should be defined and the -:ref:`davidson_dressed` module should be used. If no dressing is required, -the :ref:`davidson` module should be used, and it has a default zero dressing vector. +It contains everything required for the Davidson algorithm, dressed or +not. If a dressing is used, the dressing column should be defined and +the :ref:`module_davidson_dressed` module should be used. If no dressing +is required, the :ref:`module_davidson` module should be used, and it +has a default zero dressing vector. The important providers for that module are: -# `psi_energy` which is the expectation value over the wave function (`psi_det`, `psi_coef`) of the Hamiltonian, dressed or not. It uses the general subroutine `u_0_H_u_0`. -# `psi_energy_two_e` which is the expectation value over the wave function (`psi_det`, `psi_coef`) of the standard two-electrons coulomb operator. It uses the general routine `u_0_H_u_0_two_e`. +#. :c:data:`psi_energy` which is the expectation value over the wave + function (:c:data:`psi_det`, :c:data:`psi_coef`) of the Hamiltonian, + dressed or not. It uses the general subroutine :c:func:`u_0_H_u_0`. + +#. :c:data:`psi_energy_two_e` which is the expectation value over the + wave function (:c:data:`psi_det`, :c:data:`psi_coef`) of the standard + two-electron Coulomb operator. It uses the general routine + :c:func:`u_0_H_u_0_two_e`. diff --git a/src/davidson/davidson_parallel.irp.f b/src/davidson/davidson_parallel.irp.f index a1f69841..9e4402f6 100644 --- a/src/davidson/davidson_parallel.irp.f +++ b/src/davidson/davidson_parallel.irp.f @@ -35,50 +35,31 @@ subroutine davidson_run_slave(thread,iproc) integer(ZMQ_PTR) :: zmq_socket_push integer, external :: connect_to_taskserver - integer, external :: zmq_get_N_states_diag + integer :: doexit, send, receive - PROVIDE mpi_rank zmq_to_qp_run_socket = new_zmq_to_qp_run_socket() + + doexit = 0 + if (connect_to_taskserver(zmq_to_qp_run_socket,worker_id,thread) == -1) then + doexit=1 + endif + IRP_IF MPI + include 'mpif.h' + integer :: ierr + send = doexit + call MPI_AllReduce(send, receive, 1, MPI_INTEGER, MPI_SUM, MPI_COMM_WORLD, ierr) + if (ierr /= MPI_SUCCESS) then + doexit=1 + endif + doexit = receive + IRP_ENDIF + if (doexit>0) then + call end_zmq_to_qp_run_socket(zmq_to_qp_run_socket) + return + endif + zmq_socket_push = new_zmq_push_socket(thread) - - - integer :: ierr, doexit - do - doexit = 0 - if (connect_to_taskserver(zmq_to_qp_run_socket,worker_id,thread) == -1) then - call sleep( int(1.5+float(mpi_rank)/10.) ) - if (connect_to_taskserver(zmq_to_qp_run_socket,worker_id,thread) == -1) then - doexit=1 - endif - endif - - IRP_IF MPI - include 'mpif.h' - integer :: sendbuf, recvbuf - sendbuf = doexit - recvbuf = doexit - call MPI_ALLREDUCE(sendbuf, recvbuf, 1, MPI_INTEGER, MPI_SUM, MPI_COMM_WORLD, ierr) - if (ierr /= MPI_SUCCESS) then - print *, irp_here//': Unable to reduce ' - stop -1 - endif - doexit = recvbuf - IRP_ENDIF - - if (doexit == 0) then - exit - else - print *, irp_here, ': retrying connection (', doexit, ')' - endif - enddo - - do - if (zmq_get_N_states_diag(zmq_to_qp_run_socket, 1) /= -1) then - exit - endif - print *, irp_here, ': Waiting for N_states_diag' - call sleep(1) - enddo + call davidson_slave_work(zmq_to_qp_run_socket, zmq_socket_push, N_states_diag, N_det, worker_id) integer, external :: disconnect_from_taskserver @@ -91,7 +72,8 @@ subroutine davidson_run_slave(thread,iproc) endif call end_zmq_to_qp_run_socket(zmq_to_qp_run_socket) - call end_zmq_push_socket(zmq_socket_push,thread) + call end_zmq_push_socket(zmq_socket_push) + end subroutine @@ -141,8 +123,9 @@ subroutine davidson_slave_work(zmq_to_qp_run_socket, zmq_socket_push, N_st, sze, endif do while (zmq_get_dmatrix(zmq_to_qp_run_socket, worker_id, 'u_t', u_t, ni, nj, size(u_t,kind=8)) == -1) - call sleep(1) - print *, irp_here, ': waiting for u_t...' + print *, 'mpi_rank, N_states_diag, N_det' + print *, mpi_rank, N_states_diag, N_det + stop 'u_t' enddo IRP_IF MPI @@ -156,6 +139,8 @@ subroutine davidson_slave_work(zmq_to_qp_run_socket, zmq_socket_push, N_st, sze, ! Run tasks ! --------- + logical :: sending + sending=.False. allocate(v_t(N_st,N_det), s_t(N_st,N_det)) do @@ -175,9 +160,11 @@ subroutine davidson_slave_work(zmq_to_qp_run_socket, zmq_socket_push, N_st, sze, if (task_done_to_taskserver(zmq_to_qp_run_socket,worker_id,task_id) == -1) then print *, irp_here, 'Unable to send task_done' endif - call davidson_push_results(zmq_socket_push, v_t, s_t, imin, imax, task_id) + call davidson_push_results_async_recv(zmq_socket_push, sending) + call davidson_push_results_async_send(zmq_socket_push, v_t, s_t, imin, imax, task_id, sending) end do deallocate(u_t,v_t, s_t) + call davidson_push_results_async_recv(zmq_socket_push, sending) end subroutine @@ -187,7 +174,7 @@ subroutine davidson_push_results(zmq_socket_push, v_t, s_t, imin, imax, task_id) use f77_zmq implicit none BEGIN_DOC -! Push the results of $H|U \rangle$ from a worker to the master. +! Push the results of $H | U \rangle$ from a worker to the master. END_DOC integer(ZMQ_PTR) ,intent(in) :: zmq_socket_push @@ -227,13 +214,80 @@ IRP_ENDIF end subroutine +subroutine davidson_push_results_async_send(zmq_socket_push, v_t, s_t, imin, imax, task_id,sending) + use f77_zmq + implicit none + BEGIN_DOC +! Push the results of $H | U \rangle$ from a worker to the master. + END_DOC + + integer(ZMQ_PTR) ,intent(in) :: zmq_socket_push + integer ,intent(in) :: task_id, imin, imax + double precision ,intent(in) :: v_t(N_states_diag,N_det) + double precision ,intent(in) :: s_t(N_states_diag,N_det) + logical ,intent(inout) :: sending + integer :: rc, sz + integer*8 :: rc8 + + if (sending) then + print *, irp_here, ': sending=true' + stop -1 + endif + sending = .True. + + sz = (imax-imin+1)*N_states_diag + + rc = f77_zmq_send( zmq_socket_push, task_id, 4, ZMQ_SNDMORE) + if(rc /= 4) stop 'davidson_push_results failed to push task_id' + + rc = f77_zmq_send( zmq_socket_push, imin, 4, ZMQ_SNDMORE) + if(rc /= 4) stop 'davidson_push_results failed to push imin' + + rc = f77_zmq_send( zmq_socket_push, imax, 4, ZMQ_SNDMORE) + if(rc /= 4) stop 'davidson_push_results failed to push imax' + + rc8 = f77_zmq_send8( zmq_socket_push, v_t(1,imin), 8_8*sz, ZMQ_SNDMORE) + if(rc8 /= 8_8*sz) stop 'davidson_push_results failed to push vt' + + rc8 = f77_zmq_send8( zmq_socket_push, s_t(1,imin), 8_8*sz, 0) + if(rc8 /= 8_8*sz) stop 'davidson_push_results failed to push st' + +end subroutine + +subroutine davidson_push_results_async_recv(zmq_socket_push,sending) + use f77_zmq + implicit none + BEGIN_DOC +! Push the results of $H | U \rangle$ from a worker to the master. + END_DOC + + integer(ZMQ_PTR) ,intent(in) :: zmq_socket_push + logical ,intent(inout) :: sending + + integer :: rc + + if (.not.sending) return +! Activate is zmq_socket_push is a REQ +IRP_IF ZMQ_PUSH +IRP_ELSE + character*(2) :: ok + rc = f77_zmq_recv( zmq_socket_push, ok, 2, 0) + if ((rc /= 2).and.(ok(1:2)/='ok')) then + print *, irp_here, ': f77_zmq_recv( zmq_socket_push, ok, 2, 0)' + stop -1 + endif +IRP_ENDIF + sending = .False. + +end subroutine + subroutine davidson_pull_results(zmq_socket_pull, v_t, s_t, imin, imax, task_id) use f77_zmq implicit none BEGIN_DOC -! Pull the results of $H|U \rangle$ on the master. +! Pull the results of $H | U \rangle$ on the master. END_DOC integer(ZMQ_PTR) ,intent(in) :: zmq_socket_pull @@ -292,23 +346,29 @@ subroutine davidson_collector(zmq_to_qp_run_socket, zmq_socket_pull, v0, s0, sze integer :: more, task_id, imin, imax double precision, allocatable :: v_t(:,:), s_t(:,:) + logical :: sending integer :: i,j + integer, external :: zmq_delete_task_async_send + integer, external :: zmq_delete_task_async_recv allocate(v_t(N_st,N_det), s_t(N_st,N_det)) v0 = 0.d0 s0 = 0.d0 more = 1 + sending = .False. do while (more == 1) call davidson_pull_results(zmq_socket_pull, v_t, s_t, imin, imax, task_id) + if (zmq_delete_task_async_send(zmq_to_qp_run_socket,task_id,sending) == -1) then + stop 'davidson: Unable to delete task (send)' + endif do j=1,N_st do i=imin,imax v0(i,j) = v0(i,j) + v_t(j,i) s0(i,j) = s0(i,j) + s_t(j,i) enddo enddo - integer, external :: zmq_delete_task - if (zmq_delete_task(zmq_to_qp_run_socket,zmq_socket_pull,task_id,more) == -1) then - stop 'Unable to delete task' + if (zmq_delete_task_async_recv(zmq_to_qp_run_socket,more,sending) == -1) then + stop 'davidson: Unable to delete task (recv)' endif end do deallocate(v_t,s_t) @@ -324,13 +384,13 @@ subroutine H_S2_u_0_nstates_zmq(v_0,s_0,u_0,N_st,sze) use f77_zmq implicit none BEGIN_DOC - ! Computes $v_0 = H|u_0\rangle$ and $s_0 = S^2 |u_0\rangle$ + ! Computes $v_0 = H | u_0\rangle$ and $s_0 = S^2 | u_0\rangle$ ! ! n : number of determinants ! - ! H_jj : array of $\langle j|H|j \rangle$ + ! H_jj : array of $\langle j | H | j \rangle$ ! - ! S2_jj : array of $\langle j|S^2|j \rangle$ + ! S2_jj : array of $\langle j | S^2 | j \rangle$ END_DOC integer, intent(in) :: N_st, sze double precision, intent(out) :: v_0(sze,N_st), s_0(sze,N_st) @@ -347,9 +407,9 @@ subroutine H_S2_u_0_nstates_zmq(v_0,s_0,u_0,N_st,sze) call new_parallel_job(zmq_to_qp_run_socket,zmq_socket_pull,'davidson') - integer :: N_states_diag_save - N_states_diag_save = N_states_diag - N_states_diag = N_st +! integer :: N_states_diag_save +! N_states_diag_save = N_states_diag +! N_states_diag = N_st if (zmq_put_N_states_diag(zmq_to_qp_run_socket, 1) == -1) then stop 'Unable to put N_states_diag on ZMQ server' endif @@ -468,8 +528,8 @@ subroutine H_S2_u_0_nstates_zmq(v_0,s_0,u_0,N_st,sze) !$OMP TASKWAIT !$OMP END PARALLEL - N_states_diag = N_states_diag_save - SOFT_TOUCH N_states_diag +! N_states_diag = N_states_diag_save +! SOFT_TOUCH N_states_diag end @@ -582,3 +642,4 @@ integer function zmq_get_N_states_diag(zmq_to_qp_run_socket, worker_id) endif IRP_ENDIF end + diff --git a/src/davidson/diagonalization_hs2_dressed.irp.f b/src/davidson/diagonalization_hs2_dressed.irp.f index 16ab776d..a9f07962 100644 --- a/src/davidson/diagonalization_hs2_dressed.irp.f +++ b/src/davidson/diagonalization_hs2_dressed.irp.f @@ -202,9 +202,7 @@ subroutine davidson_diag_hjj_sjj(dets_in,u_in,H_jj,s2_out,energies,dim_in,sze,N_ exit endif - if (N_st_diag > 2*N_states) then - N_st_diag = N_st_diag-1 - else if (itermax > 4) then + if (itermax > 4) then itermax = itermax - 1 else if (m==1.and.disk_based_davidson) then m=0 @@ -324,6 +322,7 @@ subroutine davidson_diag_hjj_sjj(dets_in,u_in,H_jj,s2_out,energies,dim_in,sze,N_ shift = N_st_diag*(iter-1) shift2 = N_st_diag*iter + call ortho_qr(U,size(U,1),sze,shift2) call ortho_qr(U,size(U,1),sze,shift2) ! Compute |W_k> = \sum_i |i> @@ -394,6 +393,8 @@ subroutine davidson_diag_hjj_sjj(dets_in,u_in,H_jj,s2_out,energies,dim_in,sze,N_ ! call dgemm('T','N', shift2, shift2, sze, & ! 1.d0, U, size(U,1), S, size(S,1), & ! 0.d0, s_, size(s_,1)) + + !$OMP PARALLEL DO DEFAULT(SHARED) PRIVATE(i,j,k) do j=1,shift2 do i=1,shift2 s_(i,j) = 0.d0 @@ -402,6 +403,7 @@ subroutine davidson_diag_hjj_sjj(dets_in,u_in,H_jj,s2_out,energies,dim_in,sze,N_ enddo enddo enddo + !$OMP END PARALLEL DO ! Compute h_kl = = ! ------------------------------------------- diff --git a/src/davidson/diagonalize_ci.irp.f b/src/davidson/diagonalize_ci.irp.f index ab551084..d4b3b48c 100644 --- a/src/davidson/diagonalize_ci.irp.f +++ b/src/davidson/diagonalize_ci.irp.f @@ -202,6 +202,8 @@ subroutine diagonalize_CI psi_coef(i,j) = CI_eigenvectors(i,j) enddo enddo + psi_energy(1:N_states) = CI_electronic_energy(1:N_states) + psi_s2(1:N_states) = CI_s2(1:N_states) - SOFT_TOUCH psi_coef CI_electronic_energy CI_energy CI_eigenvectors CI_s2 + SOFT_TOUCH psi_coef CI_electronic_energy CI_energy CI_eigenvectors CI_s2 psi_energy psi_s2 end diff --git a/src/davidson/u0_h_u0.irp.f b/src/davidson/u0_h_u0.irp.f index 944a9105..726673ce 100644 --- a/src/davidson/u0_h_u0.irp.f +++ b/src/davidson/u0_h_u0.irp.f @@ -27,9 +27,9 @@ subroutine u_0_H_u_0(e_0,s_0,u_0,n,keys_tmp,Nint,N_st,sze) use bitmasks implicit none BEGIN_DOC - ! Computes $E_0 = \frac{\langle u_0|H|u_0 \rangle}{\langle u_0|u_0 \rangle}$ + ! Computes $E_0 = \frac{\langle u_0 | H | u_0 \rangle}{\langle u_0 | u_0 \rangle}$ ! - ! and $S_0 = \frac{\langle u_0|S^2|u_0 \rangle}{\langle u_0|u_0 \rangle}$ + ! and $S_0 = \frac{\langle u_0 | S^2 | u_0 \rangle}{\langle u_0 | u_0 \rangle}$ ! ! n : number of determinants ! @@ -41,21 +41,35 @@ subroutine u_0_H_u_0(e_0,s_0,u_0,n,keys_tmp,Nint,N_st,sze) double precision, allocatable :: v_0(:,:), s_vec(:,:), u_1(:,:) double precision :: u_dot_u,u_dot_v,diag_H_mat_elem - integer :: i,j + integer :: i,j, istate if ((n > 100000).and.distributed_davidson) then allocate (v_0(n,N_states_diag),s_vec(n,N_states_diag), u_1(n,N_states_diag)) - u_1(1:n,1:N_states) = u_0(1:n,1:N_states) - u_1(1:n,N_states+1:N_states_diag) = 0.d0 - call H_S2_u_0_nstates_zmq(v_0,s_vec,u_1,N_st,n) - deallocate(u_1) + u_1(:,:) = 0.d0 + u_1(1:n,1:N_st) = u_0(1:n,1:N_st) + call H_S2_u_0_nstates_zmq(v_0,s_vec,u_1,N_states_diag,n) + else if (n < n_det_max_full) then + allocate (v_0(n,N_st),s_vec(n,N_st), u_1(n,N_st)) + v_0(:,:) = 0.d0 + u_1(:,:) = 0.d0 + s_vec(:,:) = 0.d0 + u_1(1:n,1:N_st) = u_0(1:n,1:N_st) + do istate = 1,N_st + do j=1,n + do i=1,n + v_0(i,istate) = v_0(i,istate) + h_matrix_all_dets(i,j) * u_0(j,istate) + s_vec(i,istate) = s_vec(i,istate) + S2_matrix_all_dets(i,j) * u_0(j,istate) + enddo + enddo + enddo else allocate (v_0(n,N_st),s_vec(n,N_st),u_1(n,N_st)) - u_1(1:n,:) = u_0(1:n,:) + u_1(:,:) = 0.d0 + u_1(1:n,1:N_st) = u_0(1:n,1:N_st) call H_S2_u_0_nstates_openmp(v_0,s_vec,u_1,N_st,n) - u_0(1:n,:) = u_1(1:n,:) - deallocate(u_1) endif + u_0(1:n,1:N_st) = u_1(1:n,1:N_st) + deallocate(u_1) double precision :: norm !$OMP PARALLEL DO PRIVATE(i,norm) DEFAULT(SHARED) do i=1,N_st @@ -80,7 +94,7 @@ subroutine H_S2_u_0_nstates_openmp(v_0,s_0,u_0,N_st,sze) use bitmasks implicit none BEGIN_DOC - ! Computes $v_0 = H|u_0\rangle$ and $s_0 = S^2 |u_0\rangle$. + ! Computes $v_0 = H | u_0\rangle$ and $s_0 = S^2 | u_0\rangle$. ! ! Assumes that the determinants are in psi_det ! @@ -135,7 +149,7 @@ subroutine H_S2_u_0_nstates_openmp_work(v_t,s_t,u_t,N_st,sze,istart,iend,ishift, use bitmasks implicit none BEGIN_DOC - ! Computes $v_t = H|u_t\rangle$ and $s_t = S^2 |u_t\rangle$ + ! Computes $v_t = H | u_t\rangle$ and $s_t = S^2 | u_t\rangle$ ! ! Default should be 1,N_det,0,1 END_DOC @@ -165,7 +179,7 @@ subroutine H_S2_u_0_nstates_openmp_work_$N_int(v_t,s_t,u_t,N_st,sze,istart,iend, use bitmasks implicit none BEGIN_DOC - ! Computes $v_t = H|u_t\rangle$ and $s_t = S^2 |u_t\rangle$ + ! Computes $v_t = H | u_t \\rangle$ and $s_t = S^2 | u_t\\rangle$ ! ! Default should be 1,N_det,0,1 END_DOC @@ -469,7 +483,7 @@ compute_singles=.True. ASSERT (lrow <= N_det_alpha_unique) tmp_det2(1:$N_int,1) = psi_det_alpha_unique(1:$N_int, lrow) - call i_H_j_mono_spin( tmp_det, tmp_det2, $N_int, 1, hij) + call i_h_j_single_spin( tmp_det, tmp_det2, $N_int, 1, hij) !DIR$ LOOP COUNT AVG(4) do l=1,N_st @@ -554,7 +568,7 @@ compute_singles=.True. ASSERT (lcol <= N_det_beta_unique) tmp_det2(1:$N_int,2) = psi_det_beta_unique (1:$N_int, lcol) - call i_H_j_mono_spin( tmp_det, tmp_det2, $N_int, 2, hij) + call i_h_j_single_spin( tmp_det, tmp_det2, $N_int, 2, hij) l_a = psi_bilinear_matrix_transp_order(l_b) ASSERT (l_a <= N_det) !DIR$ LOOP COUNT AVG(4) diff --git a/src/davidson/u0_wee_u0.irp.f b/src/davidson/u0_wee_u0.irp.f index 8b071629..c1f163d4 100644 --- a/src/davidson/u0_wee_u0.irp.f +++ b/src/davidson/u0_wee_u0.irp.f @@ -15,7 +15,7 @@ subroutine H_S2_u_0_two_e_nstates_openmp(v_0,s_0,u_0,N_st,sze) use bitmasks implicit none BEGIN_DOC - ! Computes $v_0 = H|u_0\rangle$ and $s_0 = S^2 |u_0\rangle$ + ! Computes $v_0 = H | u_0\rangle$ and $s_0 = S^2 | u_0\rangle$ ! ! Assumes that the determinants are in psi_det ! @@ -69,7 +69,7 @@ subroutine H_S2_u_0_two_e_nstates_openmp_work(v_t,s_t,u_t,N_st,sze,istart,iend,i use bitmasks implicit none BEGIN_DOC - ! Computes $v_t = H|u_t\rangle$ and $s_t = S^2 |u_t\rangle$ + ! Computes $v_t = H | u_t\rangle$ and $s_t = S^2 | u_t\rangle$ ! ! Default should be 1,N_det,0,1 END_DOC @@ -99,7 +99,7 @@ subroutine H_S2_u_0_two_e_nstates_openmp_work_$N_int(v_t,s_t,u_t,N_st,sze,istart use bitmasks implicit none BEGIN_DOC - ! Computes $v_t = H|u_t\rangle$ and $s_t = S^2 |u_t\rangle$ + ! Computes $v_t = H | u_t \\rangle$ and $s_t = S^2 | u_t \\rangle$ ! ! Default should be 1,N_det,0,1 END_DOC @@ -304,7 +304,7 @@ subroutine H_S2_u_0_two_e_nstates_openmp_work_$N_int(v_t,s_t,u_t,N_st,sze,istart ASSERT (lrow <= N_det_alpha_unique) tmp_det2(1:$N_int,1) = psi_det_alpha_unique(1:$N_int, lrow) - call i_Wee_j_mono( tmp_det, tmp_det2, $N_int, 1, hij) + call i_Wee_j_single( tmp_det, tmp_det2, $N_int, 1, hij) do l=1,N_st v_t(l,k_a) = v_t(l,k_a) + hij * u_t(l,l_a) @@ -384,7 +384,7 @@ subroutine H_S2_u_0_two_e_nstates_openmp_work_$N_int(v_t,s_t,u_t,N_st,sze,istart ASSERT (lcol <= N_det_beta_unique) tmp_det2(1:$N_int,2) = psi_det_beta_unique (1:$N_int, lcol) - call i_Wee_j_mono( tmp_det, tmp_det2, $N_int, 2, hij) + call i_Wee_j_single( tmp_det, tmp_det2, $N_int, 2, hij) l_a = psi_bilinear_matrix_transp_order(l_b) ASSERT (l_a <= N_det) do l=1,N_st @@ -461,7 +461,7 @@ subroutine u_0_H_u_0_two_e(e_0,u_0,n,keys_tmp,Nint,N_st,sze) use bitmasks implicit none BEGIN_DOC - ! Computes $E_0 = \frac{ \langle u_0|H|u_0\rangle}{\langle u_0|u_0 \rangle}$. + ! Computes $E_0 = \frac{ \langle u_0 | H | u_0\rangle}{\langle u_0 | u_0 \rangle}$. ! ! n : number of determinants ! diff --git a/src/density_for_dft/README.rst b/src/density_for_dft/README.rst index 278a27ef..612d236e 100644 --- a/src/density_for_dft/README.rst +++ b/src/density_for_dft/README.rst @@ -3,10 +3,14 @@ density_for_dft =============== -This module defines the *provider* of the density used for the DFT related calculations. -This definition is done through the keyword :option:`density_for_dft density_for_dft`. -The density can be: +This module defines the *provider* of the density used for the |DFT| related +calculations. This definition is done through the keyword +:option:`density_for_dft density_for_dft`. The density can be: -* WFT : the density is computed with a potentially multi determinant wave function (see variables `psi_det` and `psi_det`)# input_density : the density is set to a density previously stored in the |EZFIO| folder (see ``aux_quantities``) -* damping_rs_dft : the density is damped between the input_density and the WFT density, with a damping factor of :option:`density_for_dft damping_for_rs_dft` +* `WFT`: the density is computed with a potentially multi determinant wave + function (see variables `psi_det` and `psi_det`)# input_density: the density + is set to a density previously stored in the |EZFIO| directory (see + ``aux_quantities``) +* `damping_rs_dft`: the density is damped between the input_density and the WFT + density, with a damping factor of :option:`density_for_dft damping_for_rs_dft` diff --git a/src/determinants/EZFIO.cfg b/src/determinants/EZFIO.cfg index 85c0203d..79cf29eb 100644 --- a/src/determinants/EZFIO.cfg +++ b/src/determinants/EZFIO.cfg @@ -48,12 +48,12 @@ default: 0.99 [n_int] interface: ezfio -doc: Number of integers required to represent bitstrings (set in module :ref:`bitmask`) +doc: Number of integers required to represent bitstrings (set in module :ref:`module_bitmask`) type: N_int_number [bit_kind] interface: ezfio -doc: (set in module :ref:`bitmask`) +doc: (set in module :ref:`module_bitmask`) type: Bit_kind [mo_label] diff --git a/src/determinants/README.rst b/src/determinants/README.rst index 244913b8..df7a2d8e 100644 --- a/src/determinants/README.rst +++ b/src/determinants/README.rst @@ -7,15 +7,15 @@ Contains everything for the computation of the Hamiltonian matrix elements in th The main providers for this module are: * :option:`determinants n_states`: number of states to be computed -* `psi_det`: list of determinants in the wave function used in many routines/providers of the |QP|. -* `psi_coef`: list of coefficients, for all :option:`determinants n_states` states, and all determinants. +* :c:data:`psi_det`: list of determinants in the wave function used in many routines/providers of the |QP|. +* :c:data:`psi_coef`: list of coefficients, for all :option:`determinants n_states` states, and all determinants. The main routines for this module are: -* `i_H_j`: computes the Hamiltonian matrix element between two arbitrary Slater determinants. -* `i_H_j_s2`: computes the Hamiltonian and (:math:`S^2`) matrix element between two arbitrary Slater determinants. -* `i_H_j_verbose`: returns the decomposition in terms of one- and two-body components of the Hamiltonian matrix elements between two arbitrary Slater determinants. Also return the fermionic phase factor. -* `i_H_psi`: computes the Hamiltonian matrix element between an arbitrary Slater determinant and a wave function composed of a sum of arbitrary Slater determinants. +* :c:func:`i_H_j`: computes the Hamiltonian matrix element between two arbitrary Slater determinants. +* :c:func:`i_H_j_s2`: computes the Hamiltonian and (|S^2|) matrix element between two arbitrary Slater determinants. +* :c:func:`i_H_j_verbose`: returns the decomposition in terms of one- and two-body components of the Hamiltonian matrix elements between two arbitrary Slater determinants. Also return the fermionic phase factor. +* :c:func:`i_H_psi`: computes the Hamiltonian matrix element between an arbitrary Slater determinant and a wave function composed of a sum of arbitrary Slater determinants. For an example of how to use these routines and providers, take a look at :file:`example.irp.f`. diff --git a/src/determinants/connected_to_ref.irp.f b/src/determinants/connected_to_ref.irp.f index c3760f69..086f19d1 100644 --- a/src/determinants/connected_to_ref.irp.f +++ b/src/determinants/connected_to_ref.irp.f @@ -185,7 +185,7 @@ end -logical function is_connected_to_by_mono(key,keys,Nint,Ndet) +logical function is_connected_to_by_single(key,keys,Nint,Ndet) use bitmasks implicit none BEGIN_DOC @@ -202,7 +202,7 @@ logical function is_connected_to_by_mono(key,keys,Nint,Ndet) ASSERT (Nint > 0) ASSERT (Nint == N_int) - is_connected_to_by_mono = .false. + is_connected_to_by_single = .false. do i=1,Ndet degree_x2 = popcnt(xor( key(1,1), keys(1,1,i))) + & @@ -214,7 +214,7 @@ logical function is_connected_to_by_mono(key,keys,Nint,Ndet) if (degree_x2 > 2) then cycle else - is_connected_to_by_mono = .true. + is_connected_to_by_single = .true. return endif enddo @@ -333,7 +333,7 @@ end -integer function connected_to_ref_by_mono(key,keys,Nint,N_past_in,Ndet) +integer function connected_to_ref_by_single(key,keys,Nint,N_past_in,Ndet) use bitmasks implicit none BEGIN_DOC @@ -368,7 +368,7 @@ integer function connected_to_ref_by_mono(key,keys,Nint,N_past_in,Ndet) ASSERT (Nint > 0) ASSERT (Nint == N_int) - connected_to_ref_by_mono = 0 + connected_to_ref_by_single = 0 N_past = max(1,N_past_in) if (Nint == 1) then @@ -380,7 +380,7 @@ integer function connected_to_ref_by_mono(key,keys,Nint,N_past_in,Ndet) else if (degree_x2 == 4)then cycle else if(degree_x2 == 2)then - connected_to_ref_by_mono = i + connected_to_ref_by_single = i return endif enddo @@ -400,7 +400,7 @@ integer function connected_to_ref_by_mono(key,keys,Nint,N_past_in,Ndet) else if (degree_x2 == 4)then cycle else if(degree_x2 == 2)then - connected_to_ref_by_mono = i + connected_to_ref_by_single = i return endif enddo @@ -421,7 +421,7 @@ integer function connected_to_ref_by_mono(key,keys,Nint,N_past_in,Ndet) else if (degree_x2 == 4)then cycle else if(degree_x2 == 2)then - connected_to_ref_by_mono = i + connected_to_ref_by_single = i return endif enddo @@ -442,7 +442,7 @@ integer function connected_to_ref_by_mono(key,keys,Nint,N_past_in,Ndet) else if (degree_x2 == 4)then cycle else if(degree_x2 == 2)then - connected_to_ref_by_mono = i + connected_to_ref_by_single = i return endif enddo diff --git a/src/determinants/create_excitations.irp.f b/src/determinants/create_excitations.irp.f index d1bd0dd4..816006be 100644 --- a/src/determinants/create_excitations.irp.f +++ b/src/determinants/create_excitations.irp.f @@ -1,4 +1,4 @@ -subroutine do_mono_excitation(key_in,i_hole,i_particle,ispin,i_ok) +subroutine do_single_excitation(key_in,i_hole,i_particle,ispin,i_ok) implicit none BEGIN_DOC ! Apply the single excitation operator : a^{dager}_(i_particle) a_(i_hole) of spin = ispin diff --git a/src/determinants/density_matrix.irp.f b/src/determinants/density_matrix.irp.f index bc5f45b5..a9630977 100644 --- a/src/determinants/density_matrix.irp.f +++ b/src/determinants/density_matrix.irp.f @@ -150,7 +150,7 @@ END_PROVIDER call get_excitation_degree_spin(tmp_det(1,1),tmp_det2,degree,N_int) if (degree == 1) then exc = 0 - call get_mono_excitation_spin(tmp_det(1,1),tmp_det2,exc,phase,N_int) + call get_single_excitation_spin(tmp_det(1,1),tmp_det2,exc,phase,N_int) call decode_exc_spin(exc,h1,p1,h2,p2) do m=1,N_states ckl = psi_bilinear_matrix_values(k_a,m)*psi_bilinear_matrix_values(l,m) * phase @@ -206,7 +206,7 @@ END_PROVIDER call get_excitation_degree_spin(tmp_det(1,2),tmp_det2,degree,N_int) if (degree == 1) then exc = 0 - call get_mono_excitation_spin(tmp_det(1,2),tmp_det2,exc,phase,N_int) + call get_single_excitation_spin(tmp_det(1,2),tmp_det2,exc,phase,N_int) call decode_exc_spin(exc,h1,p1,h2,p2) do m=1,N_states ckl = psi_bilinear_matrix_transp_values(k_b,m)*psi_bilinear_matrix_transp_values(l,m) * phase diff --git a/src/determinants/determinants.irp.f b/src/determinants/determinants.irp.f index cbb013ec..f29939ad 100644 --- a/src/determinants/determinants.irp.f +++ b/src/determinants/determinants.irp.f @@ -877,9 +877,11 @@ BEGIN_PROVIDER [ double precision, psi_det_Hii, (N_det) ] END_DOC integer :: i,j double precision, external :: diag_H_mat_elem + !$OMP PARALLEL DO DEFAULT(SHARED) PRIVATE(i) do i=1,N_det psi_det_Hii(i) = diag_H_mat_elem(psi_det(1,1,i),N_int) enddo + !$OMP END PARALLEL DO END_PROVIDER diff --git a/src/determinants/example.irp.f b/src/determinants/example.irp.f index c8571995..4d5b6b55 100644 --- a/src/determinants/example.irp.f +++ b/src/determinants/example.irp.f @@ -29,7 +29,7 @@ subroutine example_determinants print*,'h1 --> p1 of spin s1' print*,'i_ok == +1 : excitation is possible ' print*,'i_ok == -1 : excitation is NOT possible ' - call do_mono_excitation(det_i,h1,p1,s1,i_ok) + call do_single_excitation(det_i,h1,p1,s1,i_ok) print*,'h1,p1,s1,i_ok' print*, h1,p1,s1,i_ok if(i_ok == -1)then @@ -54,7 +54,7 @@ subroutine example_determinants h1 = elec_alpha_num p1 = elec_alpha_num + 1 s1 = 2 - call do_mono_excitation(det_i,h1,p1,s1,i_ok) + call do_single_excitation(det_i,h1,p1,s1,i_ok) print*,'h1,p1,s1,i_ok' print*, h1,p1,s1,i_ok call i_H_j(det_i,det_i,N_int,h0i) @@ -105,7 +105,7 @@ subroutine example_determinants_psi_det END_DOC read_wf = .True. touch read_wf - ! you force the wave function to be set to the one in the EZFIO folder + ! you force the wave function to be set to the one in the EZFIO directory call routine_example_psi_det end diff --git a/src/determinants/h_apply.template.f b/src/determinants/h_apply.template.f index 8149b664..169bd47e 100644 --- a/src/determinants/h_apply.template.f +++ b/src/determinants/h_apply.template.f @@ -236,7 +236,7 @@ subroutine $subroutine_diexcOrg(key_in,key_mask,hole_1,particl_1,hole_2, particl call bitstring_to_list_ab(particle_tmp,occ_particle_tmp,N_elec_in_key_part_2,N_int) call bitstring_to_list_ab(hole_tmp,occ_hole_tmp,N_elec_in_key_hole_2,N_int) - ! hole = a^(+)_j_a(ispin) a_i_a(ispin)|key_in> : mono exc :: orb(i_a,ispin) --> orb(j_a,ispin) + ! hole = a^(+)_j_a(ispin) a_i_a(ispin)|key_in> : single exc :: orb(i_a,ispin) --> orb(j_a,ispin) hole_save = hole ! Build array of the non-zero integrals of second excitation @@ -297,7 +297,7 @@ subroutine $subroutine_diexcOrg(key_in,key_mask,hole_1,particl_1,hole_2, particl enddo endif - ! does all the mono excitations of the same spin + ! does all the single excitations of the same spin i=0 do kk = 1,N_elec_in_key_hole_2(ispin) i_b = occ_hole_tmp(kk,ispin) diff --git a/src/determinants/occ_pattern.irp.f b/src/determinants/occ_pattern.irp.f index f8f50a28..d5f458a0 100644 --- a/src/determinants/occ_pattern.irp.f +++ b/src/determinants/occ_pattern.irp.f @@ -408,11 +408,13 @@ subroutine make_s2_eigenfunction integer :: N_det_new, ithread, omp_get_thread_num integer, parameter :: bufsze = 1000 logical, external :: is_in_wavefunction + logical :: update + update=.False. call write_int(6,N_occ_pattern,'Number of occupation patterns') !$OMP PARALLEL DEFAULT(NONE) & - !$OMP SHARED(N_occ_pattern, psi_occ_pattern, elec_alpha_num,N_int) & + !$OMP SHARED(N_occ_pattern, psi_occ_pattern, elec_alpha_num,N_int,update) & !$OMP PRIVATE(s,ithread, d, det_buffer, smax, N_det_new,i,j,k) N_det_new = 0 call occ_pattern_to_dets_size(psi_occ_pattern(1,1,1),s,elec_alpha_num,N_int) @@ -434,6 +436,7 @@ subroutine make_s2_eigenfunction if ( is_in_wavefunction(d(1,1,j), N_int) ) then cycle endif + update = .true. N_det_new += 1 det_buffer(:,:,N_det_new) = d(:,:,j) if (N_det_new == bufsze) then @@ -451,8 +454,10 @@ subroutine make_s2_eigenfunction deallocate(d,det_buffer) !$OMP END PARALLEL - call copy_H_apply_buffer_to_wf - SOFT_TOUCH N_det psi_coef psi_det psi_occ_pattern N_occ_pattern + if (update) then + call copy_H_apply_buffer_to_wf + TOUCH N_det psi_coef psi_det psi_occ_pattern N_occ_pattern + endif call write_time(6) end diff --git a/src/determinants/mono_excitations_bielec.irp.f b/src/determinants/single_excitation_two_e.irp.f similarity index 96% rename from src/determinants/mono_excitations_bielec.irp.f rename to src/determinants/single_excitation_two_e.irp.f index a4f46887..f150f531 100644 --- a/src/determinants/mono_excitations_bielec.irp.f +++ b/src/determinants/single_excitation_two_e.irp.f @@ -1,5 +1,5 @@ use bitmasks -subroutine mono_excitation_wee(det_1,det_2,h,p,spin,phase,hij) +subroutine single_excitation_wee(det_1,det_2,h,p,spin,phase,hij) use bitmasks implicit none integer,intent(in) :: h,p,spin @@ -79,7 +79,7 @@ BEGIN_PROVIDER [double precision, fock_wee_closed_shell, (mo_num, mo_num) ] enddo double precision :: array_coulomb(mo_num),array_exchange(mo_num) call bitstring_to_list_ab(key_virt, occ_virt, n_occ_ab_virt, N_int) - ! docc ---> virt mono excitations + ! docc ---> virt single excitations do i0 = 1, n_occ_ab(1) i=occ(i0,1) do j0 = 1, n_occ_ab_virt(1) @@ -97,7 +97,7 @@ BEGIN_PROVIDER [double precision, fock_wee_closed_shell, (mo_num, mo_num) ] enddo enddo - ! virt ---> virt mono excitations + ! virt ---> virt single excitations do i0 = 1, n_occ_ab_virt(1) i=occ_virt(i0,1) do j0 = 1, n_occ_ab_virt(1) @@ -114,7 +114,7 @@ BEGIN_PROVIDER [double precision, fock_wee_closed_shell, (mo_num, mo_num) ] enddo enddo - ! docc ---> docc mono excitations + ! docc ---> docc single excitations do i0 = 1, n_occ_ab(1) i=occ(i0,1) do j0 = 1, n_occ_ab(1) diff --git a/src/determinants/single_excitations.irp.f b/src/determinants/single_excitations.irp.f index 32b2dc0c..03ff0f7e 100644 --- a/src/determinants/single_excitations.irp.f +++ b/src/determinants/single_excitations.irp.f @@ -39,7 +39,7 @@ BEGIN_PROVIDER [double precision, fock_operator_closed_shell_ref_bitmask, (mo_nu double precision, allocatable :: array_coulomb(:),array_exchange(:) allocate (array_coulomb(mo_num),array_exchange(mo_num)) call bitstring_to_list_ab(key_virt, occ_virt, n_occ_ab_virt, N_int) - ! docc ---> virt mono excitations + ! docc ---> virt single excitations do i0 = 1, n_occ_ab(1) i=occ(i0,1) do j0 = 1, n_occ_ab_virt(1) @@ -57,7 +57,7 @@ BEGIN_PROVIDER [double precision, fock_operator_closed_shell_ref_bitmask, (mo_nu enddo enddo - ! virt ---> virt mono excitations + ! virt ---> virt single excitations do i0 = 1, n_occ_ab_virt(1) i=occ_virt(i0,1) do j0 = 1, n_occ_ab_virt(1) @@ -74,7 +74,7 @@ BEGIN_PROVIDER [double precision, fock_operator_closed_shell_ref_bitmask, (mo_nu enddo enddo - ! docc ---> docc mono excitations + ! docc ---> docc single excitations do i0 = 1, n_occ_ab(1) i=occ(i0,1) do j0 = 1, n_occ_ab(1) @@ -94,7 +94,7 @@ BEGIN_PROVIDER [double precision, fock_operator_closed_shell_ref_bitmask, (mo_nu END_PROVIDER -subroutine get_mono_excitation_from_fock(det_1,det_2,h,p,spin,phase,hij) +subroutine get_single_excitation_from_fock(det_1,det_2,h,p,spin,phase,hij) use bitmasks implicit none integer,intent(in) :: h,p,spin diff --git a/src/determinants/slater_rules.irp.f b/src/determinants/slater_rules.irp.f index a36d94a9..3f0f9335 100644 --- a/src/determinants/slater_rules.irp.f +++ b/src/determinants/slater_rules.irp.f @@ -93,7 +93,7 @@ subroutine get_excitation(det1,det2,exc,degree,phase,Nint) return case (1) - call get_mono_excitation(det1,det2,exc,phase,Nint) + call get_single_excitation(det1,det2,exc,phase,Nint) return case(0) @@ -336,7 +336,7 @@ end -subroutine get_mono_excitation(det1,det2,exc,phase,Nint) +subroutine get_single_excitation(det1,det2,exc,phase,Nint) use bitmasks implicit none BEGIN_DOC @@ -499,7 +499,7 @@ subroutine i_H_j_s2(key_i,key_j,Nint,hij,s2) select case (degree) case (2) call get_double_excitation(key_i,key_j,exc,phase,Nint) - ! Mono alpha, mono beta + ! Single alpha, single beta if (exc(0,1,1) == 1) then if ( (exc(1,1,1) == exc(1,2,2)).and.(exc(1,1,2) == exc(1,2,1)) ) then s2 = -phase @@ -541,21 +541,21 @@ subroutine i_H_j_s2(key_i,key_j,Nint,hij,s2) exc(1,2,2) ,mo_integrals_map) ) endif case (1) - call get_mono_excitation(key_i,key_j,exc,phase,Nint) + call get_single_excitation(key_i,key_j,exc,phase,Nint) !DIR$ FORCEINLINE call bitstring_to_list_ab(key_i, occ, n_occ_ab, Nint) - ! Mono alpha + ! Single alpha if (exc(0,1,1) == 1) then m = exc(1,1,1) p = exc(1,2,1) spin = 1 - ! Mono beta + ! Single beta else m = exc(1,1,2) p = exc(1,2,2) spin = 2 endif - call get_mono_excitation_from_fock(key_i,key_j,p,m,spin,phase,hij) + call get_single_excitation_from_fock(key_i,key_j,p,m,spin,phase,hij) case (0) double precision, external :: diag_S_mat_elem @@ -602,7 +602,7 @@ subroutine i_H_j(key_i,key_j,Nint,hij) case (2) call get_double_excitation(key_i,key_j,exc,phase,Nint) if (exc(0,1,1) == 1) then - ! Mono alpha, mono beta + ! Single alpha, single beta if(exc(1,1,1) == exc(1,2,2) )then hij = phase * big_array_exchange_integrals(exc(1,1,1),exc(1,1,2),exc(1,2,1)) else if (exc(1,2,1) ==exc(1,1,2))then @@ -640,21 +640,21 @@ subroutine i_H_j(key_i,key_j,Nint,hij) exc(1,2,2) ,mo_integrals_map) ) endif case (1) - call get_mono_excitation(key_i,key_j,exc,phase,Nint) + call get_single_excitation(key_i,key_j,exc,phase,Nint) !DIR$ FORCEINLINE call bitstring_to_list_ab(key_i, occ, n_occ_ab, Nint) if (exc(0,1,1) == 1) then - ! Mono alpha + ! Single alpha m = exc(1,1,1) p = exc(1,2,1) spin = 1 else - ! Mono beta + ! Single beta m = exc(1,1,2) p = exc(1,2,2) spin = 2 endif - call get_mono_excitation_from_fock(key_i,key_j,p,m,spin,phase,hij) + call get_single_excitation_from_fock(key_i,key_j,p,m,spin,phase,hij) case (0) hij = diag_H_mat_elem(key_i,Nint) @@ -703,7 +703,7 @@ subroutine i_H_j_verbose(key_i,key_j,Nint,hij,hmono,hdouble,phase) case (2) call get_double_excitation(key_i,key_j,exc,phase,Nint) if (exc(0,1,1) == 1) then - ! Mono alpha, mono beta + ! Single alpha, single beta hij = phase*get_two_e_integral( & exc(1,1,1), & exc(1,1,2), & @@ -736,12 +736,12 @@ subroutine i_H_j_verbose(key_i,key_j,Nint,hij,hmono,hdouble,phase) exc(1,2,2) ,mo_integrals_map) ) endif case (1) - call get_mono_excitation(key_i,key_j,exc,phase,Nint) + call get_single_excitation(key_i,key_j,exc,phase,Nint) !DIR$ FORCEINLINE call bitstring_to_list_ab(key_i, occ, n_occ_ab, Nint) has_mipi = .False. if (exc(0,1,1) == 1) then - ! Mono alpha + ! Single alpha m = exc(1,1,1) p = exc(1,2,1) do k = 1, elec_alpha_num @@ -768,7 +768,7 @@ subroutine i_H_j_verbose(key_i,key_j,Nint,hij,hmono,hdouble,phase) enddo else - ! Mono beta + ! Single beta m = exc(1,1,2) p = exc(1,2,2) do k = 1, elec_beta_num @@ -1060,7 +1060,7 @@ end -subroutine get_excitation_degree_vector_mono(key1,key2,degree,Nint,sze,idx) +subroutine get_excitation_degree_vector_single(key1,key2,degree,Nint,sze,idx) use bitmasks implicit none BEGIN_DOC @@ -1154,7 +1154,7 @@ subroutine get_excitation_degree_vector_mono(key1,key2,degree,Nint,sze,idx) end -subroutine get_excitation_degree_vector_mono_or_exchange(key1,key2,degree,Nint,sze,idx) +subroutine get_excitation_degree_vector_single_or_exchange(key1,key2,degree,Nint,sze,idx) use bitmasks implicit none BEGIN_DOC @@ -1202,7 +1202,7 @@ subroutine get_excitation_degree_vector_mono_or_exchange(key1,key2,degree,Nint,s enddo else - print*, 'get_excitation_degree_vector_mono_or_exchange not yet implemented for N_int > 1 ...' + print*, 'get_excitation_degree_vector_single_or_exchange not yet implemented for N_int > 1 ...' stop endif @@ -1322,7 +1322,7 @@ subroutine get_excitation_degree_vector_double_alpha_beta(key1,key2,degree,Nint, end -subroutine get_excitation_degree_vector_mono_or_exchange_verbose(key1,key2,degree,Nint,sze,idx) +subroutine get_excitation_degree_vector_single_or_exchange_verbose(key1,key2,degree,Nint,sze,idx) use bitmasks implicit none BEGIN_DOC @@ -1635,7 +1635,7 @@ double precision function diag_H_mat_elem_fock(det_ref,det_pert,fock_diag_tmp,Ni endif else if (degree == 1) then - call get_mono_excitation(det_ref,det_pert,exc,phase,Nint) + call get_single_excitation(det_ref,det_pert,exc,phase,Nint) call decode_exc(exc,1,h1,p1,h2,p2,s1,s2) if (s1 == 1) then diag_H_mat_elem_fock = E0 - fock_diag_tmp(1,h1) & @@ -1775,7 +1775,17 @@ subroutine ac_operator(iorb,ispin,key,hjj,Nint,na,nb) integer :: other_spin integer :: k,l,i - ASSERT (iorb > 0) + if (iorb < 1) then + print *, irp_here, 'iorb < 1' + print *, iorb, mo_num + stop -1 + endif + if (iorb > mo_num) then + print *, irp_here, 'iorb > mo_num' + print *, iorb, mo_num + stop -1 + endif + ASSERT (ispin > 0) ASSERT (ispin < 3) ASSERT (Nint > 0) @@ -1793,11 +1803,6 @@ subroutine ac_operator(iorb,ispin,key,hjj,Nint,na,nb) key(k,ispin) = ibset(key(k,ispin),l) other_spin = iand(ispin,1)+1 -! if (iorb > mo_num) then -! print *, irp_here, 'iorb > mo_num' -! print *, iorb, mo_num -! stop -1 -! endif hjj = hjj + mo_one_e_integrals(iorb,iorb) ! Same spin @@ -1921,7 +1926,7 @@ subroutine get_excitation_spin(det1,det2,exc,degree,phase,Nint) return case (1) - call get_mono_excitation_spin(det1,det2,exc,phase,Nint) + call get_single_excitation_spin(det1,det2,exc,phase,Nint) return case(0) @@ -2093,7 +2098,7 @@ subroutine get_double_excitation_spin(det1,det2,exc,phase,Nint) end -subroutine get_mono_excitation_spin(det1,det2,exc,phase,Nint) +subroutine get_single_excitation_spin(det1,det2,exc,phase,Nint) use bitmasks implicit none BEGIN_DOC @@ -2169,7 +2174,7 @@ subroutine get_mono_excitation_spin(det1,det2,exc,phase,Nint) enddo end -subroutine i_H_j_mono_spin(key_i,key_j,Nint,spin,hij) +subroutine i_H_j_single_spin(key_i,key_j,Nint,spin,hij) use bitmasks implicit none BEGIN_DOC @@ -2185,8 +2190,8 @@ subroutine i_H_j_mono_spin(key_i,key_j,Nint,spin,hij) PROVIDE big_array_exchange_integrals mo_two_e_integrals_in_map - call get_mono_excitation_spin(key_i(1,spin),key_j(1,spin),exc,phase,Nint) - call get_mono_excitation_from_fock(key_i,key_j,exc(1,1),exc(1,2),spin,phase,hij) + call get_single_excitation_spin(key_i(1,spin),key_j(1,spin),exc,phase,Nint) + call get_single_excitation_from_fock(key_i,key_j,exc(1,1),exc(1,2),spin,phase,hij) end subroutine i_H_j_double_spin(key_i,key_j,Nint,hij) @@ -2235,8 +2240,8 @@ subroutine i_H_j_double_alpha_beta(key_i,key_j,Nint,hij) PROVIDE big_array_exchange_integrals mo_two_e_integrals_in_map - call get_mono_excitation_spin(key_i(1,1),key_j(1,1),exc(0,1,1),phase,Nint) - call get_mono_excitation_spin(key_i(1,2),key_j(1,2),exc(0,1,2),phase2,Nint) + call get_single_excitation_spin(key_i(1,1),key_j(1,1),exc(0,1,1),phase,Nint) + call get_single_excitation_spin(key_i(1,2),key_j(1,2),exc(0,1,2),phase2,Nint) phase = phase*phase2 if (exc(1,1,1) == exc(1,2,2)) then hij = phase * big_array_exchange_integrals(exc(1,1,1),exc(1,1,2),exc(1,2,1)) diff --git a/src/determinants/slater_rules_wee_mono.irp.f b/src/determinants/slater_rules_wee_mono.irp.f index ce9b4b59..4c1c9330 100644 --- a/src/determinants/slater_rules_wee_mono.irp.f +++ b/src/determinants/slater_rules_wee_mono.irp.f @@ -1,5 +1,5 @@ -subroutine i_Wee_j_mono(key_i,key_j,Nint,spin,hij) +subroutine i_Wee_j_single(key_i,key_j,Nint,spin,hij) use bitmasks implicit none BEGIN_DOC @@ -15,8 +15,8 @@ subroutine i_Wee_j_mono(key_i,key_j,Nint,spin,hij) PROVIDE big_array_exchange_integrals mo_two_e_integrals_in_map - call get_mono_excitation_spin(key_i(1,spin),key_j(1,spin),exc,phase,Nint) - call mono_excitation_wee(key_i,key_j,exc(1,1),exc(1,2),spin,phase,hij) + call get_single_excitation_spin(key_i(1,spin),key_j(1,spin),exc,phase,Nint) + call single_excitation_wee(key_i,key_j,exc(1,1),exc(1,2),spin,phase,hij) end @@ -188,7 +188,7 @@ subroutine i_H_j_mono_spin_one_e(key_i,key_j,Nint,spin,hij) integer :: exc(0:2,2) double precision :: phase - call get_mono_excitation_spin(key_i(1,spin),key_j(1,spin),exc,phase,Nint) + call get_single_excitation_spin(key_i(1,spin),key_j(1,spin),exc,phase,Nint) integer :: m,p m = exc(1,1) p = exc(1,2) @@ -252,7 +252,7 @@ subroutine i_H_j_one_e(key_i,key_j,Nint,hij) if(degree==0)then hij = diag_H_mat_elem_one_e(key_i,N_int) else - call get_mono_excitation(key_i,key_j,exc,phase,Nint) + call get_single_excitation(key_i,key_j,exc,phase,Nint) if (exc(0,1,1) == 1) then ! Mono alpha m = exc(1,1,1) @@ -340,7 +340,7 @@ subroutine i_H_j_two_e(key_i,key_j,Nint,hij) exc(1,2,2) ,mo_integrals_map) ) endif case (1) - call get_mono_excitation(key_i,key_j,exc,phase,Nint) + call get_single_excitation(key_i,key_j,exc,phase,Nint) !DIR$ FORCEINLINE call bitstring_to_list_ab(key_i, occ, n_occ_ab, Nint) if (exc(0,1,1) == 1) then @@ -354,7 +354,7 @@ subroutine i_H_j_two_e(key_i,key_j,Nint,hij) p = exc(1,2,2) spin = 2 endif - call mono_excitation_wee(key_i,key_j,p,m,spin,phase,hij) + call single_excitation_wee(key_i,key_j,p,m,spin,phase,hij) case (0) double precision :: diag_wee_mat_elem hij = diag_wee_mat_elem(key_i,Nint) diff --git a/src/dft_utils_in_r/dm_in_r.irp.f b/src/dft_utils_in_r/dm_in_r.irp.f index 777f7ede..8d277453 100644 --- a/src/dft_utils_in_r/dm_in_r.irp.f +++ b/src/dft_utils_in_r/dm_in_r.irp.f @@ -54,13 +54,19 @@ end subroutine density_and_grad_alpha_beta_and_all_aos_and_grad_aos_at_r(r,dm_a,dm_b, grad_dm_a, grad_dm_b, aos_array, grad_aos_array) implicit none BEGIN_DOC -! input : r(1) ==> r(1) = x, r(2) = y, r(3) = z -! output : dm_a = alpha density evaluated at r -! : dm_b = beta density evaluated at r -! : aos_array(i) = ao(i) evaluated at r -! : grad_dm_a(1) = X gradient of the alpha density evaluated in r -! : grad_dm_a(1) = X gradient of the beta density evaluated in r -! : grad_aos_array(1) = X gradient of the aos(i) evaluated at r +! input: +! +! * r(1) ==> r(1) = x, r(2) = y, r(3) = z +! +! output: +! +! * dm_a = alpha density evaluated at r +! * dm_b = beta density evaluated at r +! * aos_array(i) = ao(i) evaluated at r +! * grad_dm_a(1) = X gradient of the alpha density evaluated in r +! * grad_dm_a(1) = X gradient of the beta density evaluated in r +! * grad_aos_array(1) = X gradient of the aos(i) evaluated at r +! END_DOC double precision, intent(in) :: r(3) double precision, intent(out) :: dm_a(N_states),dm_b(N_states) diff --git a/src/fci/40.fci.bats b/src/fci/40.fci.bats index d6d63ff3..3d6a4858 100644 --- a/src/fci/40.fci.bats +++ b/src/fci/40.fci.bats @@ -18,8 +18,27 @@ function run() { } +function run_stoch() { + thresh=$2 + test_exe fci || skip + qp set perturbation do_pt2 True + qp set determinants n_det_max 100000 + qp set determinants n_states 1 + qp set davidson threshold_davidson 1.e-10 + qp set davidson n_states_diag 1 + qp run fci + energy1="$(ezfio get fci energy_pt2 | tr '[]' ' ' | cut -d ',' -f 1)" + eq $energy1 $1 $thresh +} +@test "F2" { # 4.07m + [[ -n $TRAVIS ]] && skip + qp set_file f2.ezfio + qp set_frozen_core + run_stoch -199.30496 1.e-4 +} + @test "NH3" { # 10.6657s qp set_file nh3.ezfio qp set_mo_class --core="[1-4]" --act="[5-72]" @@ -34,37 +53,37 @@ function run() { @test "HCO" { # 12.2868s qp set_file hco.ezfio - run -113.296806579881 1.e-05 + run -113.296794171915 2.e-05 } @test "H2O2" { # 12.9214s qp set_file h2o2.ezfio qp set_mo_class --core="[1-2]" --act="[3-24]" --del="[25-38]" - run -151.004935161155 1.e-5 + run -151.004888189874 2.e-5 } @test "HBO" { # 13.3144s [[ -n $TRAVIS ]] && skip qp set_file hbo.ezfio - run -100.212729100021 1.e-5 + run -100.214185815312 1.e-5 } @test "H2O" { # 11.3727s [[ -n $TRAVIS ]] && skip qp set_file h2o.ezfio - run -76.2359268957699 1.e-5 + run -76.2359268957699 2.e-5 } @test "ClO" { # 13.3755s [[ -n $TRAVIS ]] && skip qp set_file clo.ezfio - run -534.546053053143 1.e-5 + run -534.546005867797 5.e-5 } @test "SO" { # 13.4952s [[ -n $TRAVIS ]] && skip qp set_file so.ezfio - run -26.0083256834896 1.e-5 + run -26.0144622194831 1.e-5 } @test "H2S" { # 13.6745s @@ -94,63 +113,57 @@ function run() { @test "SiH3" { # 15.99s [[ -n $TRAVIS ]] && skip qp set_file sih3.ezfio - run -5.57267383364177 1.e-05 + run -5.57269434557089 2.e-05 } @test "CH4" { # 16.1612s [[ -n $TRAVIS ]] && skip qp set_file ch4.ezfio qp set_mo_class --core="[1]" --act="[2-30]" --del="[31-59]" - run -40.2409672510721 1.e-5 + run -40.2409858175829 2.e-5 } @test "ClF" { # 16.8864s [[ -n $TRAVIS ]] && skip qp set_file clf.ezfio - run -559.168731496312 1.e-5 + run -559.170116079903 1.e-5 } @test "SO2" { # 17.5645s [[ -n $TRAVIS ]] && skip qp set_file so2.ezfio qp set_mo_class --core="[1-8]" --act="[9-87]" - run -41.5746938811597 1.e-5 + run -41.5746738713298 5.e-5 } @test "C2H2" { # 17.6827s [[ -n $TRAVIS ]] && skip qp set_file c2h2.ezfio qp set_mo_class --act="[1-30]" --del="[31-36]" - run -12.365788387909 1.e-5 + run -12.3678973551285 2.e-5 } @test "N2" { # 18.0198s [[ -n $TRAVIS ]] && skip qp set_file n2.ezfio qp set_mo_class --core="[1,2]" --act="[3-40]" --del="[41-60]" - run -109.316843972685 1.e-5 + run -109.291310557766 1.e-4 } @test "N2H4" { # 18.5006s [[ -n $TRAVIS ]] && skip qp set_file n2h4.ezfio qp set_mo_class --core="[1-2]" --act="[3-24]" --del="[25-48]" - run -111.367234092521 1.e-5 + run -111.367234092521 2.e-5 } @test "CO2" { # 21.1748s [[ -n $TRAVIS ]] && skip qp set_file co2.ezfio qp set_mo_class --core="[1,2]" --act="[3-30]" --del="[31-42]" - run -187.968860407394 1.e-5 + run -187.969556614801 1.e-5 } -@test "F2" { # 21.331s - [[ -n $TRAVIS ]] && skip - qp set_file f2.ezfio - qp set_mo_class --core="[1,2]" --act="[3-30]" --del="[31-62]" - run -199.068219028883 1.e-5 -} @test "[Cu(NH3)4]2+" { # 25.0417s [[ -n $TRAVIS ]] && skip @@ -163,6 +176,6 @@ function run() { [[ -n $TRAVIS ]] && skip qp set_file hcn.ezfio qp set_mo_class --core="[1,2]" --act="[3-40]" --del="[41-55]" - run -93.0806630964871 1.e-5 + run -93.0794109423741 2.e-5 } diff --git a/src/fci/README.rst b/src/fci/README.rst index 603d492c..a6a1f962 100644 --- a/src/fci/README.rst +++ b/src/fci/README.rst @@ -9,42 +9,51 @@ fci The user point of view ---------------------- -* :c:func:`fci` performs |CIPSI| calculations using a stochastic scheme for both the selection and the |PT2| contribution, -* :c:func:`pt2` computes the |PT2| contribution using the wave function stored in the |EZFIO| - database. +* :ref:`fci` performs |CIPSI| calculations using a stochastic scheme for both + the selection and the |PT2| contribution, + +* :ref:`pt2` computes the |PT2| contribution using the wave function stored in + the |EZFIO| database. The main keywords/options for this module are: -* :option:`determinants n_det_max` : maximum number of Slater determinants in the CIPSI wave function. The :command:`fci` program will stop when the size of the CIPSI wave function will exceed :option:`determinants n_det_max`. +* :option:`determinants n_det_max` : maximum number of Slater determinants in + the |CIPSI| wave function. The :ref:`fci` program will stop when the size of + the |CIPSI| wave function will exceed :option:`determinants n_det_max`. -* :option:`perturbation pt2_max` : absolute value of the |PT2| to stop the CIPSI calculation. Once the |PT2| :math:`<` :option:`perturbation pt2_max`, the CIPSI calculation stops. +* :option:`perturbation pt2_max` : absolute value of the |PT2| to stop the + |CIPSI| calculation. Once the abs(|PT2|) :math:`<` :option:`perturbation pt2_max`, + the |CIPSI| calculation stops. -* :option:`determinants n_states` : number of states to consider in the CIPSI calculation. +* :option:`determinants n_states` : number of states to consider in the |CIPSI| + calculation. -* :option:`determinants read_wf` : if False, starts with a ROHF-like determinant, if True, starts with the current wave function(s) stored in the |EZFIO| folder. +* :option:`determinants read_wf` : if |false|, starts with a |ROHF|-like + determinant, if |true|, starts with the current wave function(s) stored in + the |EZFIO| directory. .. note:: - For a multi-state calculation, it is recommended to start with :c:func:`cis` or :c:func:`cisd` - wave functions as a guess. + For a multi-state calculation, it is recommended to start with :ref:`cis` + or :ref:`cisd` wave functions as a guess. -* :option:`determinants s2_eig` : if True, systematically add all the determinants needed to have a pure value of :math:`S^2`. Also, if True, it tracks only the states having the good :option:`determinants expected_s2`. +* :option:`determinants expected_s2` : expected value of |S^2| for the + desired spin multiplicity. -.. note:: - For a multi-state calculation, it is recommended to start with :c:func:`cis` or :c:func:`cisd` - wave functions as a guess. - -* :option:`determinants expected_s2` : expected value of :math:`S^2` for the desired spin multiplicity. +* :option:`determinants s2_eig` : if |true|, systematically add all the + determinants needed to have a pure value of |S^2|. Also, if |true|, it + tracks only the states having the good :option:`determinants expected_s2`. -The programmer point of view ----------------------------- -This module have been created with the :ref:`cipsi` module. +The programmer's point of view +------------------------------ + +This module was created with the :ref:`module_cipsi` module. .. seealso:: - The documentation of the :ref:`cipsi` module. + The documentation of the :ref:`module_cipsi` module. diff --git a/src/fci/fci.irp.f b/src/fci/fci.irp.f index 40f683b2..5c747081 100644 --- a/src/fci/fci.irp.f +++ b/src/fci/fci.irp.f @@ -13,7 +13,7 @@ program fci ! conditions: ! ! * number of Slater determinants > :option:`determinants n_det_max` - ! * |PT2| < :option:`perturbation pt2_max` + ! * abs(|PT2|) less than :option:`perturbation pt2_max` ! ! The following other options can be of interest: ! @@ -30,7 +30,7 @@ program fci ! :option:`determinants expected_s2`. ! ! For excited states calculations, it is recommended to start with - ! :ref:`.cis.` or :ref:`.cisd.` guess wave functions, eventually in + ! :ref:`cis` or :ref:`cisd` guess wave functions, eventually in ! a restricted set of |MOs|, and to set :option:`determinants s2_eig` ! to |true|. ! diff --git a/src/fci/pt2.irp.f b/src/fci/pt2.irp.f index 4a555d69..45860fb5 100644 --- a/src/fci/pt2.irp.f +++ b/src/fci/pt2.irp.f @@ -1,13 +1,18 @@ program pt2 implicit none BEGIN_DOC - ! Second order perturbative correction to the wave function contained in the EZFIO directory. + ! Second order perturbative correction to the wave function contained + ! in the |EZFIO| directory. ! - ! This programs runs the stochastic PT2 correction on all "n_states" wave function stored in the EZFIO folder (see :option:`determinant n_states`). + ! This programs runs the stochastic |PT2| correction on all + ! :option:`determinants n_states` wave functions stored in the |EZFIO| + ! directory. ! - ! The option for the PT2 correction are the "pt2_relative_error" which is the relative stochastic + ! The main option for the |PT2| correction is the + ! :option:`perturbation pt2_relative_error` which is the relative + ! stochastic error on the |PT2| to reach before stopping the + ! sampling. ! - ! error on the PT2 to reach before stopping the stochastic sampling. (see :option:`perturbation pt2_relative_error`) END_DOC if (.not. is_zmq_slave) then read_wf = .True. diff --git a/src/hartree_fock/README.rst b/src/hartree_fock/README.rst index 213ae209..38018eb5 100644 --- a/src/hartree_fock/README.rst +++ b/src/hartree_fock/README.rst @@ -8,9 +8,9 @@ calculations (the spatial part of the |MOs| is common for alpha and beta spinorbitals). The Hartree-Fock algorithm is a |SCF| and therefore is based on the -:ref:`module_scf_utils`` module. +:ref:`module_scf_utils` module. -The Fock matrix is defined in :file:`hartree_fock fock_matrix_hf.irp.f`. +The Fock matrix is defined in :file:`fock_matrix_hf.irp.f`. diff --git a/src/mo_basis/mos.irp.f b/src/mo_basis/mos.irp.f index 1380ee09..5547de0c 100644 --- a/src/mo_basis/mos.irp.f +++ b/src/mo_basis/mos.irp.f @@ -236,9 +236,9 @@ subroutine mix_mo_jk(j,k) BEGIN_DOC ! Rotates the j-th |MO| with the k-th |MO| to give two new |MOs| that are ! - ! * $+ = \frac{1}{\sqrt{2}} (|j\rangle + |k\rangle)$ + ! * $+ = \frac{1}{\sqrt{2}} ( | j\rangle + | k\rangle)$ ! - ! * $- = \frac{1}{\sqrt{2}} (|j\rangle - |k\rangle)$ + ! * $- = \frac{1}{\sqrt{2}} ( | j\rangle - | k\rangle)$ ! ! by convention, the '+' |MO| is in the lowest index (min(j,k)) ! by convention, the '-' |MO| is in the highest index (max(j,k)) diff --git a/src/mo_one_e_ints/mo_one_e_ints.irp.f b/src/mo_one_e_ints/mo_one_e_ints.irp.f index 88a40f24..ac4b4e3b 100644 --- a/src/mo_one_e_ints/mo_one_e_ints.irp.f +++ b/src/mo_one_e_ints/mo_one_e_ints.irp.f @@ -2,10 +2,10 @@ BEGIN_PROVIDER [ double precision, mo_one_e_integrals,(mo_num,mo_num)] implicit none integer :: i,j,n,l BEGIN_DOC - ! array of the mono electronic hamiltonian on the MOs basis : - ! sum of the kinetic and nuclear electronic potential (and pseudo potential if needed) + ! array of the one-electron Hamiltonian on the |MO| basis : + ! sum of the kinetic and nuclear electronic potentials (and pseudo potential if needed) END_DOC - print*,'Providing the mono electronic integrals' + print*,'Providing the one-electron integrals' IF (read_mo_one_e_integrals) THEN call ezfio_get_mo_one_e_ints_mo_one_e_integrals(mo_one_e_integrals) diff --git a/src/perturbation/EZFIO.cfg b/src/perturbation/EZFIO.cfg index c4c304e0..b90a8961 100644 --- a/src/perturbation/EZFIO.cfg +++ b/src/perturbation/EZFIO.cfg @@ -6,22 +6,24 @@ default: True [pt2_max] type: PT2_energy -doc: The selection process stops when the largest |PT2| (for all the state) is lower - than `pt2_max` in absolute value +doc: The selection process stops when the largest |PT2| (for all the state) is lower than `pt2_max` in absolute value interface: ezfio,provider,ocaml default: 0.0001 [pt2_relative_error] type: Normalized_float -doc: Stop stochastic |PT2| when the relative error is smaller than `PT2_relative_error` +doc: Stop stochastic |PT2| when the relative error is smaller than `pT2_relative_error` interface: ezfio,provider,ocaml default: 0.002 [correlation_energy_ratio_max] type: Normalized_float -doc: The selection process stops at a fixed correlation ratio (useful for getting same accuracy between molecules). - Defined as :math:`{E_{CI}-E_{HF}}/{E_{CI}+E_{PT2} - E_{HF}}`. +doc: The selection process stops at a fixed correlation ratio (useful for getting same accuracy between molecules). Defined as :math:`(E_{CI}-E_{HF})/(E_{CI}+E_{PT2} - E_{HF})`. interface: ezfio,provider,ocaml default: 1.00 - +[h0_type] +type: character*(32) +doc: Type of denominator in PT2. [EN | SOP | HF] +interface: ezfio,provider,ocaml +default: EN diff --git a/src/perturbation/h0_type.irp.f b/src/perturbation/h0_type.irp.f deleted file mode 100644 index 17a47ce6..00000000 --- a/src/perturbation/h0_type.irp.f +++ /dev/null @@ -1,12 +0,0 @@ -BEGIN_PROVIDER [ character*32,h0_type ] - implicit none - BEGIN_DOC - ! Type of zeroth-order Hamiltonian - END_DOC - if (s2_eig) then - h0_type = 'SOP' - else - h0_type = 'EN' - endif -END_PROVIDER - diff --git a/src/perturbation/perturbation.template.f b/src/perturbation/perturbation.template.f index e9f5f8fd..0a7ca181 100644 --- a/src/perturbation/perturbation.template.f +++ b/src/perturbation/perturbation.template.f @@ -6,7 +6,7 @@ END_SHELL 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,key_mask,fock_diag_tmp,electronic_energy) implicit none BEGIN_DOC - ! Applly pertubration ``$PERT`` to the buffer of determinants generated in the H_apply + ! Apply pertubration ``$PERT`` to the buffer of determinants generated in the H_apply ! routine. END_DOC @@ -185,7 +185,7 @@ end subroutine perturb_buffer_by_mono_$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,key_mask,fock_diag_tmp,electronic_energy) implicit none BEGIN_DOC - ! Applly pertubration ``$PERT`` to the buffer of determinants generated in the H_apply + ! Apply pertubration ``$PERT`` to the buffer of determinants generated in the H_apply ! routine. END_DOC @@ -198,7 +198,7 @@ subroutine perturb_buffer_by_mono_$PERT(i_generator,buffer,buffer_size,e_2_pert_ 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) double precision :: c_pert(N_st), e_2_pert(N_st), H_pert_diag(N_st) integer :: i,k, c_ref, ni, ex - integer, external :: connected_to_ref_by_mono + integer, external :: connected_to_ref_by_single logical, external :: is_in_wavefunction integer(bit_kind), allocatable :: minilist(:,:,:) @@ -232,7 +232,7 @@ subroutine perturb_buffer_by_mono_$PERT(i_generator,buffer,buffer_size,e_2_pert_ do i=1,buffer_size - c_ref = connected_to_ref_by_mono(buffer(1,1,i),psi_det_generators,Nint,i_generator,N_det) + c_ref = connected_to_ref_by_single(buffer(1,1,i),psi_det_generators,Nint,i_generator,N_det) if (c_ref /= 0) then cycle diff --git a/src/perturbation/selection.irp.f b/src/perturbation/selection.irp.f index 2d00f35f..f3f03673 100644 --- a/src/perturbation/selection.irp.f +++ b/src/perturbation/selection.irp.f @@ -1,5 +1,4 @@ -subroutine fill_H_apply_buffer_selection(n_selected,det_buffer,e_2_pert_buffer,coef_pert_buffer, & - N_st,Nint,iproc,select_max_out) +subroutine fill_H_apply_buffer_selection(n_selected,det_buffer,e_2_pert_buffer,coef_pert_buffer, N_st,Nint,iproc,select_max_out) use bitmasks implicit none BEGIN_DOC diff --git a/src/scf_utils/roothaan_hall_scf.irp.f b/src/scf_utils/roothaan_hall_scf.irp.f index c0337d7d..faf23a51 100644 --- a/src/scf_utils/roothaan_hall_scf.irp.f +++ b/src/scf_utils/roothaan_hall_scf.irp.f @@ -174,11 +174,11 @@ END_DOC end -subroutine extrapolate_Fock_matrix( & - error_matrix_DIIS,Fock_matrix_DIIS, & - Fock_matrix_AO_,size_Fock_matrix_AO, & - iteration_SCF,dim_DIIS & -) +subroutine extrapolate_Fock_matrix( & + error_matrix_DIIS,Fock_matrix_DIIS, & + Fock_matrix_AO_,size_Fock_matrix_AO, & + iteration_SCF,dim_DIIS & + ) BEGIN_DOC ! Compute the extrapolated Fock matrix using the DIIS procedure diff --git a/src/selectors_cassd/README.rst b/src/selectors_cassd/README.rst index e359ef8e..d4a648d3 100644 --- a/src/selectors_cassd/README.rst +++ b/src/selectors_cassd/README.rst @@ -3,4 +3,4 @@ selectors_cassd =============== Selectors for |CAS-SD| calculations. The selectors are defined as first the -generators from :ref:`Generators_CAS`, and then the rest of the wave function. +generators from :ref:`module_generators_cas`, and then the rest of the wave function. diff --git a/src/tools/diagonalize_h.irp.f b/src/tools/diagonalize_h.irp.f index 5b3cbdf5..c9ae2033 100644 --- a/src/tools/diagonalize_h.irp.f +++ b/src/tools/diagonalize_h.irp.f @@ -1,11 +1,14 @@ program diagonalize_h implicit none BEGIN_DOC -! Program that extracts the :option:`determinants n_states` lowest states of the Hamiltonian within the set of Slater determinants stored in the EZFIO folder. +! Program that extracts the :option:`determinants n_states` lowest +! states of the Hamiltonian within the set of Slater determinants stored +! in the |EZFIO| directory. ! -! If :option:`determinants s2_eig` = True, it will retain only states +! If :option:`determinants s2_eig` = |true|, it will retain only states +! which correspond to the desired value of +! :option:`determinants expected_s2`. ! -! which corresponds to the desired value of :option:`determinants expected_s2`. END_DOC read_wf = .True. touch read_wf diff --git a/src/tools/fcidump.irp.f b/src/tools/fcidump.irp.f index f979ac1a..bf4d07fb 100644 --- a/src/tools/fcidump.irp.f +++ b/src/tools/fcidump.irp.f @@ -1,17 +1,22 @@ program fcidump implicit none BEGIN_DOC -! Produce a regular FCIDUMP file from the |MOs| stored in the |EZFIO| folder. +! Produce a regular `FCIDUMP` file from the |MOs| stored in the |EZFIO| +! directory. ! -! To specify an active space, the class of the mos have to set in the |EZFIO| folder (see :ref:`qp_set_mo_class`). +! To specify an active space, the class of the |MOs| have to set in the +! |EZFIO| directory (see :ref:`qp_set_mo_class`). ! -! The fcidump program supports 3 types of MO_class : +! The :ref:`fcidump` program supports 3 types of |MO| classes : ! -! * the "core" orbitals which are always doubly occupied in the calculation +! * the *core* orbitals which are always doubly occupied in the +! calculation ! -! * the "del" orbitals that are never occupied in the calculation +! * the *deleted* orbitals that are never occupied in the calculation +! +! * the *active* orbitals that are occupied with a varying number of +! electrons ! -! * the "act" orbitals that will be occupied by a varying number of electrons END_DOC character*(128) :: output integer :: i_unit_output,getUnitAndOpen diff --git a/src/tools/four_idx_transform.irp.f b/src/tools/four_idx_transform.irp.f index 45198770..92e87cad 100644 --- a/src/tools/four_idx_transform.irp.f +++ b/src/tools/four_idx_transform.irp.f @@ -1,11 +1,15 @@ program four_idx_transform implicit none BEGIN_DOC -! 4-index transformation of two-electron integrals from |AO| to |MO| integrals. +! 4-index transformation of two-electron integrals from |AO| to |MO| +! integrals. ! -! This program will compute the two-electron integrals on the |MO| basis and store it into the |EZFIO| folder. +! This program will compute the two-electron integrals on the |MO| basis +! and store it into the |EZFIO| directory. +! +! This program can be useful if the AO --> MO transformation is an +! expensive step by itself. ! -! This program can be useful if the AO --> MO transformation is an expensive step by itself. END_DOC io_mo_two_e_integrals = 'Write' diff --git a/src/tools/molden.irp.f b/src/tools/molden.irp.f index f22592f6..081e74db 100644 --- a/src/tools/molden.irp.f +++ b/src/tools/molden.irp.f @@ -1,7 +1,7 @@ program molden implicit none BEGIN_DOC - ! Produce a Molden file + ! Produces a Molden file END_DOC character*(128) :: output integer :: i_unit_output,getUnitAndOpen diff --git a/src/tools/print_wf.irp.f b/src/tools/print_wf.irp.f index 2a8335fc..01fc8948 100644 --- a/src/tools/print_wf.irp.f +++ b/src/tools/print_wf.irp.f @@ -1,17 +1,20 @@ program print_wf implicit none BEGIN_DOC - ! Print the ground state wave function stored in the |EZFIO| folder in the intermediate normalization. + ! Print the ground state wave function stored in the |EZFIO| directory + ! in the intermediate normalization. ! - ! It also prints a lot of information regarding the excitation operators from the reference determinant + ! It also prints a lot of information regarding the excitation + ! operators from the reference determinant ! and a first-order + ! perturbative analysis of the wave function. ! - ! and a first-order perturbative analysis of the wave function. - ! - ! If the wave function strongly deviates from the first-order analysis, something funny is going on :) + ! If the wave function strongly deviates from the first-order analysis, + ! something funny is going on :) END_DOC - ! this has to be done in order to be sure that N_det, psi_det and psi_coef are the wave function stored in the EZFIO folder + ! this has to be done in order to be sure that N_det, psi_det and + ! psi_coef are the wave function stored in the |EZFIO| directory. read_wf = .True. touch read_wf call routine diff --git a/src/tools/save_natorb.irp.f b/src/tools/save_natorb.irp.f index e18309ba..88b28f06 100644 --- a/src/tools/save_natorb.irp.f +++ b/src/tools/save_natorb.irp.f @@ -1,15 +1,16 @@ program save_natorb implicit none BEGIN_DOC -! Save natural MOs into the EZFIO +! Save natural |MOs| into the |EZFIO|. ! -! This program reads the wave function stored in the EZFIO folder, +! This program reads the wave function stored in the |EZFIO| directory, +! extracts the corresponding natural orbitals and setd them as the new +! |MOs|. ! -! extracts the corresponding natural orbitals and set them as the new MOs -! -! If this is a multi-state calculation, the density matrix that produces the natural orbitals -! -! is obtained from a state-averaged of the density matrices of each state with the corresponding state_average_weight (see the doc of state_average_weight). +! If this is a multi-state calculation, the density matrix that produces +! the natural orbitals is obtained from an average of the density +! matrices of each state with the corresponding +! :option:`determinants state_average_weight` END_DOC read_wf = .True. touch read_wf diff --git a/src/tools/save_one_e_dm.irp.f b/src/tools/save_one_e_dm.irp.f index 9bfa6717..e850131e 100644 --- a/src/tools/save_one_e_dm.irp.f +++ b/src/tools/save_one_e_dm.irp.f @@ -1,13 +1,16 @@ program save_one_e_dm implicit none BEGIN_DOC -! programs that computes the one body density on the mo basis for alpha and beta electrons - -! from the wave function stored in the EZFIO folder, and then save it into the EZFIO folder aux_quantities. +! Program that computes the one body density on the |MO| basis +! for $\alpha$ and $\beta$ electrons from the wave function +! stored in the |EZFIO| directory, and then saves it into the +! :ref:`module_aux_quantities`. ! -! Then, the global variable data_one_e_dm_alpha_mo and data_one_e_dm_beta_mo will automatically read this density in a further calculation. -! -! This can be used to perform damping on the density in RS-DFT calculation (see the density_for_dft module). +! Then, the global variable :option:`aux_quantities data_one_e_dm_alpha_mo` +! and :option:`aux_quantities data_one_e_dm_beta_mo` will automatically +! read this density in the next calculation. This can be used to perform +! damping on the density in |RSDFT| calculations (see +! :ref:`module_density_for_dft`). END_DOC read_wf = .True. touch read_wf diff --git a/src/tools/write_integrals_erf.irp.f b/src/tools/write_integrals_erf.irp.f index b527576d..89c818f6 100644 --- a/src/tools/write_integrals_erf.irp.f +++ b/src/tools/write_integrals_erf.irp.f @@ -1,7 +1,8 @@ program write_integrals_erf implicit none BEGIN_DOC - ! Saves the two-electron integrals with the :math:`erf(\mu r_{12})/r_{12}` oprerator into the EZFIO folder + ! Saves the two-electron integrals with the $erf(\mu r_{12})/r_{12}$ + ! oprerator into the EZFIO directory. END_DOC io_mo_two_e_integrals = 'None' touch io_mo_two_e_integrals diff --git a/src/zmq/put_get.irp.f b/src/zmq/put_get.irp.f index 64bc9db8..fce8722d 100644 --- a/src/zmq/put_get.irp.f +++ b/src/zmq/put_get.irp.f @@ -397,7 +397,9 @@ integer function zmq_get_dmatrix(zmq_to_qp_run_socket, worker_id, name, x, size_ if (rc /= len(trim(msg))) then print *, trim(msg) zmq_get_dmatrix = -1 - print *, irp_here, 'rc /= len(trim(msg))', rc, len(trim(msg)) + print *, irp_here, 'rc /= len(trim(msg))' + print *, irp_here, ' received : ', rc + print *, irp_here, ' expected : ', len(trim(msg)) go to 10 endif @@ -411,7 +413,9 @@ integer function zmq_get_dmatrix(zmq_to_qp_run_socket, worker_id, name, x, size_ rc = f77_zmq_recv8(zmq_to_qp_run_socket,x(1,j),ni*8_8,0) if (rc /= ni*8_8) then - print *, irp_here, 'rc /= size_x1*8', rc, ni*8_8 + print *, irp_here, 'rc /= size_x1*8 : ', trim(name) + print *, irp_here, ' received: ', rc + print *, irp_here, ' expected: ', ni*8_8 zmq_get_dmatrix = -1 go to 10 endif diff --git a/src/zmq/utils.irp.f b/src/zmq/utils.irp.f index 22a53414..1205e09e 100644 --- a/src/zmq/utils.irp.f +++ b/src/zmq/utils.irp.f @@ -246,7 +246,7 @@ IRP_ENDIF ! stop 'Unable to set ZMQ_RCVBUF on pull socket' ! endif - rc = f77_zmq_setsockopt(new_zmq_pull_socket,ZMQ_RCVHWM,10,4) + rc = f77_zmq_setsockopt(new_zmq_pull_socket,ZMQ_RCVHWM,50,4) if (rc /= 0) then stop 'Unable to set ZMQ_RCVHWM on pull socket' endif @@ -323,7 +323,7 @@ IRP_ENDIF stop 'Unable to set ZMQ_LINGER on push socket' endif - rc = f77_zmq_setsockopt(new_zmq_push_socket,ZMQ_SNDHWM,10,4) + rc = f77_zmq_setsockopt(new_zmq_push_socket,ZMQ_SNDHWM,1,4) if (rc /= 0) then stop 'Unable to set ZMQ_SNDHWM on push socket' endif @@ -604,11 +604,11 @@ subroutine end_parallel_job(zmq_to_qp_run_socket,zmq_socket_pull,name_in) rc = f77_zmq_send(zmq_to_qp_run_socket, 'end_job '//trim(zmq_state),8+len(trim(zmq_state)),0) rc = f77_zmq_recv(zmq_to_qp_run_socket, message, 512, 0) if (trim(message(1:13)) == 'error waiting') then - call sleep(1) cycle else if (message(1:2) == 'ok') then exit endif + call sleep(1) end do if (i==0) then print *, '.. Forcing kill ..' @@ -663,17 +663,16 @@ integer function connect_to_taskserver(zmq_to_qp_run_socket,worker_id,thread) rc = f77_zmq_recv(zmq_to_qp_run_socket, message, 510, 0) message = trim(message(1:rc)) if(message(1:5) == "error") then - connect_to_taskserver = -1 - return + go to 10 end if read(message,*, end=10, err=10) reply, state, worker_id, address if (trim(reply) /= 'connect_reply') then - connect_to_taskserver = -1 - return + go to 10 endif if (trim(state) /= zmq_state) then integer, external :: disconnect_from_taskserver_state if (disconnect_from_taskserver_state(zmq_to_qp_run_socket, worker_id, state) == -1) then + print *, irp_here//': Wrong zmq_state. Disconnecting.' continue endif connect_to_taskserver = -1 @@ -682,6 +681,7 @@ integer function connect_to_taskserver(zmq_to_qp_run_socket,worker_id,thread) return 10 continue +! print *, irp_here//': '//trim(message) connect_to_taskserver = -1 end @@ -1085,6 +1085,64 @@ integer function zmq_delete_task(zmq_to_qp_run_socket,zmq_socket_pull,task_id,mo endif end +integer function zmq_delete_task_async_send(zmq_to_qp_run_socket,task_id,sending) + use f77_zmq + implicit none + BEGIN_DOC +! When a task is done, it has to be removed from the list of tasks on the qp_run +! queue. This guarantees that the results have been received in the pull. + END_DOC + integer(ZMQ_PTR), intent(in) :: zmq_to_qp_run_socket + integer, intent(in) :: task_id + logical, intent(inout) :: sending + integer :: rc + character*(512) :: message + + if (sending) then + print *, irp_here, ': sending=true' + stop -1 + endif + zmq_delete_task_async_send = 0 + + write(message,*) 'del_task ', zmq_state, task_id + rc = f77_zmq_send(zmq_to_qp_run_socket,trim(message),len(trim(message)),0) + if (rc /= len(trim(message))) then + zmq_delete_task_async_send = -1 + return + endif + sending = .True. + +end + +integer function zmq_delete_task_async_recv(zmq_to_qp_run_socket,more,sending) + use f77_zmq + implicit none + BEGIN_DOC +! When a task is done, it has to be removed from the list of tasks on the qp_run +! queue. This guarantees that the results have been received in the pull. + END_DOC + integer(ZMQ_PTR), intent(in) :: zmq_to_qp_run_socket + integer, intent(out) :: more + logical, intent(inout) :: sending + integer :: rc + character*(512) :: message + character*(64) :: reply + zmq_delete_task_async_recv = 0 + if (.not.sending) return + sending = .False. + reply = '' + rc = f77_zmq_recv(zmq_to_qp_run_socket,reply,64,0) + if (reply(16:19) == 'more') then + more = 1 + else if (reply(16:19) == 'done') then + more = 0 + else + print *, reply(1:rc) + zmq_delete_task_async_recv = -1 + return + endif +end + integer function zmq_delete_tasks(zmq_to_qp_run_socket,zmq_socket_pull,task_id,n_tasks,more) use f77_zmq implicit none @@ -1128,7 +1186,7 @@ integer function zmq_delete_tasks(zmq_to_qp_run_socket,zmq_socket_pull,task_id,n endif end -integer function zmq_delete_tasks_async_send(zmq_to_qp_run_socket,zmq_socket_pull,task_id,n_tasks,more) +integer function zmq_delete_tasks_async_send(zmq_to_qp_run_socket,task_id,n_tasks,sending) use f77_zmq implicit none BEGIN_DOC @@ -1136,13 +1194,17 @@ integer function zmq_delete_tasks_async_send(zmq_to_qp_run_socket,zmq_socket_pul ! queue. This guarantees that the results have been received in the pull. END_DOC integer(ZMQ_PTR), intent(in) :: zmq_to_qp_run_socket - integer(ZMQ_PTR) :: zmq_socket_pull integer, intent(in) :: n_tasks, task_id(n_tasks) - integer, intent(in) :: more + logical, intent(inout) :: sending integer :: rc, k character*(64) :: fmt, reply character(LEN=:), allocatable :: message + if (sending) then + print *, irp_here, ': sending is true' + stop -1 + endif + sending = .True. zmq_delete_tasks_async_send = 0 allocate(character(LEN=64+n_tasks*12) :: message) @@ -1162,7 +1224,7 @@ integer function zmq_delete_tasks_async_send(zmq_to_qp_run_socket,zmq_socket_pul end -integer function zmq_delete_tasks_async_recv(zmq_to_qp_run_socket,zmq_socket_pull,task_id,n_tasks,more) +integer function zmq_delete_tasks_async_recv(zmq_to_qp_run_socket,more,sending) use f77_zmq implicit none BEGIN_DOC @@ -1170,12 +1232,12 @@ integer function zmq_delete_tasks_async_recv(zmq_to_qp_run_socket,zmq_socket_pul ! queue. This guarantees that the results have been received in the pull. END_DOC integer(ZMQ_PTR), intent(in) :: zmq_to_qp_run_socket - integer(ZMQ_PTR) :: zmq_socket_pull - integer, intent(in) :: n_tasks, task_id(n_tasks) integer, intent(out) :: more + logical, intent(inout) :: sending integer :: rc character*(64) :: reply + if (.not.sending) return zmq_delete_tasks_async_recv = 0 reply = '' @@ -1188,6 +1250,7 @@ integer function zmq_delete_tasks_async_recv(zmq_to_qp_run_socket,zmq_socket_pul else zmq_delete_tasks_async_recv = -1 endif + sending = .False. end