From d926b20eab7216866dffc30f80607b9b06021530 Mon Sep 17 00:00:00 2001 From: Emmanuel Giner Date: Sun, 23 Dec 2018 23:50:31 +0100 Subject: [PATCH] some cleaning and more explicit README --- TODO | 5 ---- docs/source/users_guide/quickstart.rst | 8 +++---- src/density_for_dft/EZFIO.cfg | 11 +++++++++ src/density_for_dft/README.rst | 14 ++++++++--- src/determinants/README.rst | 2 +- src/dft_keywords/EZFIO.cfg | 11 --------- src/dft_keywords/README.rst | 7 +++++- src/dft_utils_in_r/NEED | 1 - .../{ao_on_grid.irp.f => ao_in_r.irp.f} | 0 .../{mo_on_grid.irp.f => mo_in_r.irp.f} | 0 src/dft_utils_one_e/README.rst | 23 ++++++++++++++++--- src/dft_utils_one_e/mu_erf_dft.irp.f | 3 +++ src/dft_utils_one_e/pot_general.irp.f | 12 ++++++++++ src/dft_utils_one_e/utils.irp.f | 10 ++++++-- 14 files changed, 76 insertions(+), 31 deletions(-) create mode 100644 src/density_for_dft/EZFIO.cfg rename src/dft_utils_in_r/{ao_on_grid.irp.f => ao_in_r.irp.f} (100%) rename src/dft_utils_in_r/{mo_on_grid.irp.f => mo_in_r.irp.f} (100%) diff --git a/TODO b/TODO index 4ca05902..29eadf8f 100644 --- a/TODO +++ b/TODO @@ -7,12 +7,7 @@ * Creer une page web pas trop degueu et la mettre ici : http://lcpq.github.io/quantum_package * Manu : README - * data_energy_and_density - * dft_keywords - * dft_quantities_on_grid - * dft_utils_one_body * dm_for_dft - * integrals_erf * prendre des bouts du src/README.rst et en mettre partout diff --git a/docs/source/users_guide/quickstart.rst b/docs/source/users_guide/quickstart.rst index a46f3114..43dc7106 100644 --- a/docs/source/users_guide/quickstart.rst +++ b/docs/source/users_guide/quickstart.rst @@ -67,13 +67,13 @@ just run .. code:: bash - qp_run SCF hcn + qp_run scf hcn The expected energy is ``-92.827856698`` au. .. seealso:: - The documentation of the :ref:`Hartree_Fock` module. + The documentation of the :ref:`hartree_fock` module. Choose the target |MO| space @@ -95,7 +95,7 @@ We will now use the |CIPSI| algorithm to estimate the |FCI| energy. .. code:: - qp_run FCI hcn + qp_run fci hcn The program will start with a single determinant and will iteratively: @@ -116,7 +116,7 @@ The estimated |FCI| energy of HCN is ``-93.0501`` au. .. seealso:: - The documentation of the :ref:`FCI` module. + The documentation of the :ref:`fci` module. .. important:: TODO diff --git a/src/density_for_dft/EZFIO.cfg b/src/density_for_dft/EZFIO.cfg new file mode 100644 index 00000000..ed1cf9ce --- /dev/null +++ b/src/density_for_dft/EZFIO.cfg @@ -0,0 +1,11 @@ +[density_for_dft] +type: character*(32) +doc: Type of density used for DFT calculation. If set to WFT , it uses the density of the wave function stored in (psi_det,psi_coef). If set to input_density it uses the one-body dm stored in aux_quantities/ . If set to damping_rs_dft it uses the damped density between WFT and input_density. In the ks_scf and rs_ks_scf programs, it is set to WFT. +interface: ezfio, provider, ocaml +default: WFT + +[damping_for_rs_dft] +type: double precision +doc: damping factor for the density used in RSFT. +interface: ezfio,provider,ocaml +default: 0.5 diff --git a/src/density_for_dft/README.rst b/src/density_for_dft/README.rst index 4019f77f..24166855 100644 --- a/src/density_for_dft/README.rst +++ b/src/density_for_dft/README.rst @@ -1,4 +1,12 @@ -========== -DM_for_dft -========== +=============== +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: + +# 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` diff --git a/src/determinants/README.rst b/src/determinants/README.rst index f7d2eb02..ff83f7c4 100644 --- a/src/determinants/README.rst +++ b/src/determinants/README.rst @@ -2,4 +2,4 @@ Determinants ============ -Contains everything for the computation of the Hamiltonian in the basis of Slater determinants. +Contains everything for the computation of the Hamiltonian matrix elements in the basis of orthogonal Slater determinants built on a restricted spin-orbitals basis. diff --git a/src/dft_keywords/EZFIO.cfg b/src/dft_keywords/EZFIO.cfg index 20cbcc74..3c3ed22a 100644 --- a/src/dft_keywords/EZFIO.cfg +++ b/src/dft_keywords/EZFIO.cfg @@ -16,14 +16,3 @@ doc: Percentage of HF exchange in the DFT model interface: ezfio,provider,ocaml default: 0. -[density_for_dft] -type: character*(32) -doc: Type of density used for DFT calculation. If WFT it uses the density of the WFT stored in terms of determinants. If input_density it uses the one-body dm stored in data_.../ . If damping_rs_dft it uses the damping density between WFT and input_density -interface: ezfio, provider, ocaml -default: WFT - -[damping_for_rs_dft] -type: double precision -doc: damping factor for the density used in RSFT. -interface: ezfio,provider,ocaml -default: 0.5 diff --git a/src/dft_keywords/README.rst b/src/dft_keywords/README.rst index 089420cc..febb0a9f 100644 --- a/src/dft_keywords/README.rst +++ b/src/dft_keywords/README.rst @@ -2,6 +2,11 @@ DFT Keywords ============ -This module contains all keywords which are related to a DFT calculation +This module contains the main keywords related to a DFT calculation or RS-DFT calculation, such as: +# :option:exchange_functional +# :option:correlation_functional +# :option:HF_exchange : only relevent for the :ref:`ks_scf` program +# :option:density_for_dft : mainly relevent for multi-determinant range separated DFT, see the plugins of eginer. +The keyword for the range separation parameter :math:`\mu` is the :option:`ao_two_e_erf_integrals mu_erf` keyword. diff --git a/src/dft_utils_in_r/NEED b/src/dft_utils_in_r/NEED index c591b4c7..4704d59b 100644 --- a/src/dft_utils_in_r/NEED +++ b/src/dft_utils_in_r/NEED @@ -1,5 +1,4 @@ dft_keywords -determinants ao_basis mo_basis becke_numerical_grid diff --git a/src/dft_utils_in_r/ao_on_grid.irp.f b/src/dft_utils_in_r/ao_in_r.irp.f similarity index 100% rename from src/dft_utils_in_r/ao_on_grid.irp.f rename to src/dft_utils_in_r/ao_in_r.irp.f diff --git a/src/dft_utils_in_r/mo_on_grid.irp.f b/src/dft_utils_in_r/mo_in_r.irp.f similarity index 100% rename from src/dft_utils_in_r/mo_on_grid.irp.f rename to src/dft_utils_in_r/mo_in_r.irp.f diff --git a/src/dft_utils_one_e/README.rst b/src/dft_utils_one_e/README.rst index 9b292d8e..96bbd211 100644 --- a/src/dft_utils_one_e/README.rst +++ b/src/dft_utils_one_e/README.rst @@ -1,4 +1,21 @@ -=========== -RSDFT_Utils -=========== +=============== +dft_utils_one_e +=============== + +This module contains all the one-body related quantities needed to perform DFT or RS-DFT calculations. +Therefore, it contains most of the properties which depends on the one-body density and density matrix. + +The most important files and variables are: +# The general *providers* for the x/c energies in :file:`e_xc_general.irp.f` +# The general *providers* for the x/c potentials in :file:`pot_general.irp.f` +# The short-range hartree operator and all related quantities in :file:`sr_coulomb.irp.f` +These *providers* will be used in many DFT-related programs, such as :file:`ks_scf.irp.f` or :file:`rs_ks_scf.irp.f`. +It is also needed to compute the effective one-body operator needed in multi-determinant RS-DFT (see plugins by eginer). + +Some other interesting quantities: +# The LDA and PBE *providers* for the x/c energies in :file:`e_xc.irp.f` and :file:`sr_exc.irp.f` +# The LDA and PBE *providers* for the x/c potentials on the AO basis in :file:`pot_ao.irp.f` and :file:`sr_pot_ao.irp.f` +# The :math:`h_{core}` energy computed directly with the one-body density matrix in :file:`one_e_energy_dft.irp.f` +# LDA and PBE short-range functionals *subroutines* in :file:`exc_sr_lda.irp.f` and :file:`exc_sr_pbe.irp.f` + diff --git a/src/dft_utils_one_e/mu_erf_dft.irp.f b/src/dft_utils_one_e/mu_erf_dft.irp.f index 8999a429..f4f12788 100644 --- a/src/dft_utils_one_e/mu_erf_dft.irp.f +++ b/src/dft_utils_one_e/mu_erf_dft.irp.f @@ -1,5 +1,8 @@ BEGIN_PROVIDER [double precision, mu_erf_dft] implicit none + BEGIN_DOC +! range separation parameter used in RS-DFT. It is set to mu_erf in order to be consistent with the two electrons integrals erf + END_DOC mu_erf_dft = mu_erf END_PROVIDER diff --git a/src/dft_utils_one_e/pot_general.irp.f b/src/dft_utils_one_e/pot_general.irp.f index 15b86764..c9cff11f 100644 --- a/src/dft_utils_one_e/pot_general.irp.f +++ b/src/dft_utils_one_e/pot_general.irp.f @@ -14,6 +14,12 @@ else if(exchange_functional.EQ."short_range_PBE")then potential_x_alpha_ao = potential_sr_x_alpha_ao_PBE potential_x_beta_ao = potential_sr_x_beta_ao_PBE + else if(trim(exchange_functional)=="LDA")then + potential_x_alpha_ao = potential_x_alpha_ao_LDA + potential_x_beta_ao = potential_x_beta_ao_LDA + else if(exchange_functional.EQ."PBE")then + potential_x_alpha_ao = potential_x_alpha_ao_PBE + potential_x_beta_ao = potential_x_beta_ao_PBE else if(exchange_functional.EQ."None")then potential_x_alpha_ao = 0.d0 potential_x_beta_ao = 0.d0 @@ -26,9 +32,15 @@ if(trim(correlation_functional)=="short_range_LDA")then potential_c_alpha_ao = potential_sr_c_alpha_ao_LDA potential_c_beta_ao = potential_sr_c_beta_ao_LDA + else if(trim(correlation_functional)=="LDA")then + potential_c_alpha_ao = potential_c_alpha_ao_LDA + potential_c_beta_ao = potential_c_beta_ao_LDA else if(correlation_functional.EQ."short_range_PBE")then potential_c_alpha_ao = potential_sr_c_alpha_ao_PBE potential_c_beta_ao = potential_sr_c_beta_ao_PBE + else if(correlation_functional.EQ."PBE")then + potential_c_alpha_ao = potential_c_alpha_ao_PBE + potential_c_beta_ao = potential_c_beta_ao_PBE else if(correlation_functional.EQ."None")then potential_c_alpha_ao = 0.d0 potential_c_beta_ao = 0.d0 diff --git a/src/dft_utils_one_e/utils.irp.f b/src/dft_utils_one_e/utils.irp.f index 9775ebb0..dbebe824 100644 --- a/src/dft_utils_one_e/utils.irp.f +++ b/src/dft_utils_one_e/utils.irp.f @@ -3,6 +3,9 @@ subroutine GGA_sr_type_functionals(r,rho_a,rho_b,grad_rho_a_2,grad_rho_b_2,grad_ ex,vx_rho_a,vx_rho_b,vx_grad_rho_a_2,vx_grad_rho_b_2,vx_grad_rho_a_b, & ec,vc_rho_a,vc_rho_b,vc_grad_rho_a_2,vc_grad_rho_b_2,vc_grad_rho_a_b ) implicit none + BEGIN_DOC + ! routine that helps in building the x/c potentials on the AO basis for a GGA functional with a short-range interaction + END_DOC double precision, intent(in) :: r(3),rho_a(N_states),rho_b(N_states),grad_rho_a_2(N_states),grad_rho_b_2(N_states),grad_rho_a_b(N_states) double precision, intent(out) :: ex(N_states),vx_rho_a(N_states),vx_rho_b(N_states),vx_grad_rho_a_2(N_states),vx_grad_rho_b_2(N_states),vx_grad_rho_a_b(N_states) double precision, intent(out) :: ec(N_states),vc_rho_a(N_states),vc_rho_b(N_states),vc_grad_rho_a_2(N_states),vc_grad_rho_b_2(N_states),vc_grad_rho_a_b(N_states) @@ -54,13 +57,16 @@ subroutine GGA_type_functionals(r,rho_a,rho_b,grad_rho_a_2,grad_rho_b_2,grad_rho ex,vx_rho_a,vx_rho_b,vx_grad_rho_a_2,vx_grad_rho_b_2,vx_grad_rho_a_b, & ec,vc_rho_a,vc_rho_b,vc_grad_rho_a_2,vc_grad_rho_b_2,vc_grad_rho_a_b ) implicit none + BEGIN_DOC + ! routine that helps in building the x/c potentials on the AO basis for a GGA functional + END_DOC double precision, intent(in) :: r(3),rho_a(N_states),rho_b(N_states),grad_rho_a_2(N_states),grad_rho_b_2(N_states),grad_rho_a_b(N_states) double precision, intent(out) :: ex(N_states),vx_rho_a(N_states),vx_rho_b(N_states),vx_grad_rho_a_2(N_states),vx_grad_rho_b_2(N_states),vx_grad_rho_a_b(N_states) double precision, intent(out) :: ec(N_states),vc_rho_a(N_states),vc_rho_b(N_states),vc_grad_rho_a_2(N_states),vc_grad_rho_b_2(N_states),vc_grad_rho_a_b(N_states) integer :: istate - double precision :: r2(3),dr2(3), local_potential,r12,dx2,mu + double precision :: r2(3),dr2(3), local_potential,r12,dx2 double precision :: mu_local - mu_local = 1.d+9 + mu_local = 1.d-9 do istate = 1, N_states if(exchange_functional.EQ."short_range_PBE")then call ex_pbe_sr(mu_local,rho_a(istate),rho_b(istate),grad_rho_a_2(istate),grad_rho_b_2(istate),grad_rho_a_b(istate),ex(istate),vx_rho_a(istate),vx_rho_b(istate),vx_grad_rho_a_2(istate),vx_grad_rho_b_2(istate),vx_grad_rho_a_b(istate))