From c65ecce327089b6b9568304d4b57b11898a60914 Mon Sep 17 00:00:00 2001 From: Anthony Scemama Date: Thu, 7 Mar 2019 14:05:50 +0100 Subject: [PATCH] Develop manus (#14) * modified printing for rpt2 * Comment * Fixed plugins * Scripting for functionals * Documentation * Develop (#10) * fixed laplacian of aos * corrected the laplacians of aos * added dft_one_e * added new feature for new dft functionals * changed the configure to add new functionals * changed the configure * added dft_one_e/README.rst * added README.rst in new_functionals * added source/programmers_guide/new_ks.rst * Thesis Yann * Added gmp installation in configure * improved qp_e_conv_fci * Doc * Typos * Added variance_max * Fixed completion in qp_create * modif TODO * fixed DFT potential for n_states gt 1 * improved pot pbe * trying to improve sr PBE * fixed potential pbe * fixed the vxc smashed for pbe sr and normal * Comments in selection * bug fixed by peter * Fixed bug with zero beta electrons * Update README.rst * Update e_xc_new_func.irp.f * Update links.rst * Update quickstart.rst * Update quickstart.rst * updated cipsi * Fixed energies of non-expected s2 (#9) * Moved diag_algorithm in Davdison * some modifs * modified gfortran_debug.cfg * fixed automatization of functionals * modified e_xc_general.irp.f * minor modifs in ref_bitmask.irp.f * modifying functionals * rs_ks_scf and ks_scf compiles with the automatic handling of functionals * removed prints * fixed configure * fixed the new functionals * Merge toto * modified automatic functionals --- docs/source/programmers_guide/new_ks.rst | 73 +++++------------------- ocaml/.gitignore | 7 ++- src/dft_one_e/e_xc_general.irp.f | 10 ++-- src/dft_one_e/pot_general.irp.f | 15 ++--- 4 files changed, 30 insertions(+), 75 deletions(-) diff --git a/docs/source/programmers_guide/new_ks.rst b/docs/source/programmers_guide/new_ks.rst index c60db8c8..e95fca87 100644 --- a/docs/source/programmers_guide/new_ks.rst +++ b/docs/source/programmers_guide/new_ks.rst @@ -28,72 +28,27 @@ So, at the end of the day, adding a new functional consists only in **setting a The general philosphy --------------------- -We have created a quite easy way to develop new functionals that is based on +The directory **functionals** contains only files ending with .irp.f whose name being the name of a specific functional. +All files in *a_functional*.irp.f **must** contain **at least** the following providers -* the used of **your own external plugins** +* :c:data:`energy_x_a_functional` and :c:data:`energy_c_a_functional` which are of course the exchange and correlation energies -* the module :ref:`module_new_functionals` acting as **hub** +* :c:data:`potential_x_alpha_ao_a_functional` and :c:data:`potential_x_beta_ao_a_functional` which are the exchange alpha/beta potentials -A pictorial representation of the main dependencies can be seen here: +* :c:data:`potential_c_alpha_ao_a_functional` and :c:data:`potential_c_beta_ao_a_functional` which are the correlation alpha/beta potentials - .. image:: /_static/dependencies_func.pdf - :align: center - :width: 200px - :alt: Summary of dependencies +For instance, the file :file:`sr_lda.irp.f` contains the following providers + +* :c:data:`energy_x_sr_lda` and :c:data:`energy_c_sr_lda` which are of course the exchange and correlation energies + +* :c:data:`potential_x_alpha_ao_sr_lda` and :c:data:`potential_x_beta_ao_sr_lda` which are the exchange alpha/beta potentials + +* :c:data:`potential_c_alpha_ao_sr_lda` and :c:data:`potential_c_beta_ao_sr_lda` which are the correlation alpha/beta potentials -The main idea is the following: - - 1. Develop *new providers* for the new functionals (energy and potential for exchange and correlation) in some **external plugin**. - - * Example: - - * In an **external plugin** named **fancy_functionals**, you create *e_c_new_fancy_func* for the energy and *pot_ao_alpha_new_func* for the alpha potential - - * If you want to be able to use the |DFT| programs already available in the |QP|, these *providers* must use the providers for the density defined in :ref:`module_density_for_dft` and :ref:`module_dft_utils_in_r` (see below). - - - 2. Add the name of your **external plugin** to the :file:`NEED` in order to link your new providers to **new_functionals** - - * Example: - - * add **fancy_functionals** to the NEED file of **new_functionals** - - 3. Change the file :file:`e_xc_new_func.irp.f` and :file:`pot_xc_new_func.irp.f` to set the value of your new providers to the providers defined in **new_functionals** - - * Example: - - * for the exchange/correlation energy - - - .. code:: fortran - - BEGIN_PROVIDER[double precision, energy_x_new_functional, (N_states) ] - &BEGIN_PROVIDER[double precision, energy_c_new_functional, (N_states) ] - implicit none - BEGIN_DOC - ! energy_x_new_functional = define here your functional - ! energy_c_new_functional = define here your functional - END_DOC - energy_c_new_functional = e_c_new_fancy_func - energy_x_new_functional = e_x_new_fancy_func - - END_PROVIDER - - -4. Compile at the root of the |QP| - - * Example: - - - .. code:: bash - - cd ${QP_ROOT} - ninja - - -5. When you want to execute a program with your new functional, just set the options :option:`dft_keywords exchange_functional` and :option:`dft_keywords correlation_functional` to "my_functional". +Therefore, if you want to develop a new functional, just design a provider +To use a functional Using the density for DFT calculations in the |QP| ================================================== diff --git a/ocaml/.gitignore b/ocaml/.gitignore index 74e83c02..d9cf2cff 100644 --- a/ocaml/.gitignore +++ b/ocaml/.gitignore @@ -14,15 +14,20 @@ Input_davidson.ml Input_density_for_dft.ml Input_determinants.ml Input_dft_keywords.ml +Input_dft_mu_of_r.ml Input_dressing.ml +Input_ijkl_ints_in_r3.ml Input_mo_one_e_ints.ml Input_mo_two_e_erf_ints.ml Input_mo_two_e_ints.ml +Input_mu_of_r_ints.ml +Input_mu_of_r.ml Input_nuclei.ml Input_perturbation.ml Input_pseudo.ml +Input_rsdft_ecmd.ml Input_scf_utils.ml -Input_variance.ml +Input_two_body_dm.ml qp_create_ezfio qp_create_ezfio.native qp_edit diff --git a/src/dft_one_e/e_xc_general.irp.f b/src/dft_one_e/e_xc_general.irp.f index 11fb7791..2fa48585 100644 --- a/src/dft_one_e/e_xc_general.irp.f +++ b/src/dft_one_e/e_xc_general.irp.f @@ -7,9 +7,8 @@ BEGIN_PROVIDER [double precision, energy_x, (N_states)] BEGIN_SHELL [ /usr/bin/env python ] import os import glob -import sys -qproot=os.environ['QP_ROOT'] -funcdir='../functionals/' +from qp_path import QP_SRC +funcdir=QP_SRC+'/functionals/' os.chdir(funcdir) functionals = map(lambda x : x.replace(".irp.f",""), glob.glob("*.irp.f")) prefix = "" @@ -42,9 +41,8 @@ print "endif" BEGIN_SHELL [ /usr/bin/env python ] import os import glob -import sys -qproot=os.environ['QP_ROOT'] -funcdir='../functionals/' +from qp_path import QP_SRC +funcdir=QP_SRC+'/functionals/' os.chdir(funcdir) functionals = map(lambda x : x.replace(".irp.f",""), glob.glob("*.irp.f")) prefix = "" diff --git a/src/dft_one_e/pot_general.irp.f b/src/dft_one_e/pot_general.irp.f index ea2da704..9ca38080 100644 --- a/src/dft_one_e/pot_general.irp.f +++ b/src/dft_one_e/pot_general.irp.f @@ -8,9 +8,8 @@ BEGIN_SHELL [ /usr/bin/env python ] import os import glob -import sys -qproot=os.environ['QP_ROOT'] -funcdir='../functionals/' +from qp_path import QP_SRC +funcdir=QP_SRC+'/functionals/' os.chdir(funcdir) functionals = map(lambda x : x.replace(".irp.f",""), glob.glob("*.irp.f")) @@ -45,9 +44,8 @@ print "endif" BEGIN_SHELL [ /usr/bin/env python ] import os import glob -import sys -qproot=os.environ['QP_ROOT'] -funcdir='../functionals/' +from qp_path import QP_SRC +funcdir=QP_SRC+'/functionals/' os.chdir(funcdir) functionals = map(lambda x : x.replace(".irp.f",""), glob.glob("*.irp.f")) @@ -205,9 +203,8 @@ print "endif" BEGIN_SHELL [ /usr/bin/env python ] import os import glob -import sys -qproot=os.environ['QP_ROOT'] -funcdir='../functionals/' +from qp_path import QP_SRC +funcdir=QP_SRC+'/functionals/' os.chdir(funcdir) functionals = map(lambda x : x.replace(".irp.f",""), glob.glob("*.irp.f"))