Permalink
Browse files

Merge pull request #1151 from loriab/backports_aug2018

refactor empirical dispersion
  • Loading branch information...
andysim committed Oct 26, 2018
2 parents 4e9d75a + ccf121c commit 8cb0765c2735b0735fc3468d210d258de476a72b
Showing with 2,280 additions and 1,277 deletions.
  1. +1 −1 doc/sphinxman/CMakeLists.txt
  2. +17 −0 doc/sphinxman/source/bibliography.rst
  3. +68 −60 doc/sphinxman/source/dft.rst
  4. +34 −29 doc/sphinxman/source/dftd3.rst
  5. +2 −2 external/upstream/pylibefp/CMakeLists.txt
  6. +1 −1 psi4/CMakeLists.txt
  7. +3 −4 psi4/driver/molutil.py
  8. +0 −3 psi4/driver/p4util/python_helpers.py
  9. +2 −1 psi4/driver/p4util/util.py
  10. +2 −2 psi4/driver/procrouting/__init__.py
  11. +2 −2 psi4/driver/procrouting/{dft_funcs → dft}/__init__.py
  12. +54 −32 psi4/driver/procrouting/{dft_funcs/dict_builder.py → dft/dft_builder.py}
  13. +19 −7 psi4/driver/procrouting/{dft_funcs/dict_dh_funcs.py → dft/dh_functionals.py}
  14. +18 −6 psi4/driver/procrouting/{dft_funcs/dict_gga_funcs.py → dft/gga_functionals.py}
  15. 0 psi4/driver/procrouting/{dft_funcs/dict_hyb_funcs.py → dft/hyb_functionals.py}
  16. 0 psi4/driver/procrouting/{dft_funcs/dict_lda_funcs.py → dft/lda_functionals.py}
  17. +5 −5 psi4/driver/procrouting/{dft_funcs/dict_xc_funcs.py → dft/libxc_functionals.py}
  18. +3 −3 psi4/driver/procrouting/{dft_funcs/dict_mgga_funcs.py → dft/mgga_functionals.py}
  19. +4 −5 psi4/driver/procrouting/{dft_funcs/superfuncs.py → dft/superfunctionals.py}
  20. +214 −231 psi4/driver/procrouting/empirical_dispersion.py
  21. +31 −16 psi4/driver/procrouting/proc.py
  22. +1 −2 psi4/driver/procrouting/proc_table.py
  23. +1 −2 psi4/driver/procrouting/proc_util.py
  24. +11 −1 psi4/driver/procrouting/scf_proc/scf_iterator.py
  25. +0 −433 psi4/driver/qcdb/dashparam.py
  26. +44 −0 psi4/driver/qcdb/datastructures.py
  27. +1 −0 psi4/driver/qcdb/exceptions.py
  28. +0 −329 psi4/driver/qcdb/interface_dftd3.py
  29. +22 −29 psi4/driver/qcdb/interface_gcp.py
  30. +2 −9 psi4/driver/qcdb/{p4regex.py → intf_dftd3/__init__.py}
  31. +609 −0 psi4/driver/qcdb/intf_dftd3/dashparam.py
  32. +411 −0 psi4/driver/qcdb/intf_dftd3/runner.py
  33. +113 −0 psi4/driver/qcdb/intf_dftd3/worker.py
  34. +6 −7 psi4/driver/qcdb/libmintsbasisset.py
  35. +69 −2 psi4/driver/qcdb/molecule.py
  36. +13 −1 psi4/driver/qcdb/psiutil.py
  37. +280 −0 psi4/driver/qcdb/pytest/test_dftd3.py
  38. +1 −0 psi4/driver/qcdb/util/__init__.py
  39. +77 −0 psi4/driver/qcdb/util/regex.py
  40. +1 −1 psi4/extras.py
  41. +0 −3 psi4/psi4Config.cmake.in
  42. +2 −1 psi4/src/export_functional.cc
  43. +11 −10 psi4/src/psi4/libdisp/dispersion.cc
  44. +2 −2 psi4/src/psi4/libdisp/dispersion.h
  45. +11 −0 psi4/src/psi4/libdisp/dispersion_defines.h
  46. +0 −5 psi4/src/psi4/libmints/molecule.h
  47. +1 −1 psi4/src/psi4/scfgrad/scf_grad.cc
  48. +2 −1 psi4/src/read_options.cc
  49. +51 −0 tests/dft-smoke/input.dat
  50. +13 −13 tests/dftd3/energy/input.dat
  51. +14 −2 tests/dftd3/grad/input.dat
  52. +1 −1 tests/dftd3/psithon2/input.dat
  53. +10 −9 tests/dftd3/version/input.dat
  54. +2 −2 tests/docs-dft/input.dat
  55. +17 −0 tests/freq-isotope2/input.dat
  56. +1 −1 tests/gcp/hf3c/input.dat
@@ -232,7 +232,7 @@ if(PERL_FOUND AND SPHINX_FOUND AND SPHINX_STUFF_FOUND)
${CCBD}/source/autodoc_dft_dhybrid.rst
#${CCBD}/source/autodoc_dft_scsdhybrid.rst # commented until populated again to appease Sphinx
${CCBD}/source/autodoc_dft_disp.rst
DEPENDS ${psi4_SOURCE_DIR}/psi4/driver/procrouting/dft_funcs/superfuncs.py
DEPENDS ${psi4_SOURCE_DIR}/psi4/driver/procrouting/dft/superfunctionals.py
${psi4_SOURCE_DIR}/tests/docs-dft/input.dat
${STAGED_INSTALL_PREFIX}/${CMAKE_INSTALL_BINDIR}/psi4
COMMENT "Autodoc functionals")
@@ -402,3 +402,20 @@ Bibliography
.. [Martinez-Araya:2015:451]
Jorge Ignacio Mart\ |i_acute|\ nez-Araya
*J. Math. Chem.* **53**, 451 (2015).
.. [Hujo:2011:3866]
W. Hujo and S. Grimme
*J. Chem. Theory Comput.* **7** 3866 (2011).
.. [Chai:2010:6615]
J. Chai and M. Head-Gordon
*Phys. Chem. Chem. Phys.* **10** 6615 (2008).
.. [Pernal:2009:263201]
K. Pernal, R. Podeszwa, K. Patkowski, K. Szalewicz
*Phys. Rev. Lett.* **103** 263201 (2009).
.. [Podeszwa:2010:550]
R. Podeszwa, K. Pernal, K. Patkowski, K. Szalewicz
*J. Phys. Chem. Lett.* **1** 550 (2010).
@@ -365,7 +365,7 @@ Note that if you are running an unrestricted computation, you should set the
set reference uks
energy('b3lyp')
The functional may also be manually specified by calling ``energy`` (or any other keyword)
The functional may also be manually specified by calling ``energy`` (or any driver function)
with a ``dft_functional`` argument::
energy('scf', dft_functional = 'b3lyp')
@@ -377,7 +377,7 @@ argument::
energy('scf', dft_functional = custom_functional)
For further details about this so called `dict_func` syntax, see
:ref: Advanced Functional Use and Manipulation.
:ref:`sec:dftdictbuilder`.
For hybrid functionals, the fraction of exact exchange is controlled by the
|scf__dft_alpha| option. For the LRC functionals, the fraction of long-range
@@ -724,28 +724,83 @@ The "best-practice" input file for KS-DFT is::
energy('b3lyp')
.. _`sec:dftdictbuilder`:
Advanced Functional Use and Manipulation
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
New DFT functionals can be created from scratch from within the input
file and accessed using the ``dft_functional`` keyword argument in the
energy call::
Using the ``dft_functional`` keyword argument in the energy procedure call, one is able to use the orbitals generated by DFT for correlated wavefunction methods::
# DFT Custom Functional
molecule h2o {
0 1
O
H 1 1.0
H 1 1.0 2 104.5
}
set {
basis sto-3g
dft_spherical_points 302
dft_radial_points 99
reference rks
}
pbe0 = {
"name": "my_PBE0",
"x_functionals": {"GGA_X_PBE": {"alpha": 0.75}},
"x_hf": {"alpha": 0.25},
"c_functionals": {"GGA_C_PBE": {}}
}
func_call = energy('SCF', dft_functional=pbe0)
# as PBE0 is a pre-defined functional, the call above is equivalent to both below:
func_call = energy('SCF', dft_functional="PBE0")
func_call = energy('PBE0')
Supported keywords include:
- `name`: string, name of the functional. for custom defined functionals used for printing only.
- `xc_functionals`: dict, definition of a complete (X + C) functional based in LibXC name
- `x_functionals`: dict, definition of exchange functionals using LibXC names
- `c_functionals`: dict, definition of correlation functionals using LibXC names
- `x_hf`: dict, parameters dealing with exact (HF) exchange settings for hybrid DFT
- `c_mp2`: dict, parameters dealing with MP2 correlation for double hybrid DFT
- `dispersion`: dict, definition of dispersion corrections
- `citation`: string, citation for the method, for printing purposes
- `description`: string, description of the method, for printing purposes
The full interface is defined in
:source:`psi4/driver/procrouting/dft/dft_builder.py`. All
standard functionals provided in |PSIfour| are implemented in the
``*_functionals.py`` files in the same folder.
.. literalinclude:: @SFNX_INCLUDE@psi4/driver/procrouting/dft/dft_builder.py
:lines: 29-77
One can also use the ``dft_functional`` keyword argument to use the
orbitals generated by DFT for correlated wavefunction methods::
# MP2 with a PBE0 reference computation
molecule h2o {
0 1
O
H 1 1.0
H 1 1.0 2 104.5
}
set {
basis 6-31G
dft_spherical_points 302
dft_radial_points 99
reference rks
}
mp2_dft = energy("MP2", dft_functional="PBE0")
@@ -757,70 +812,23 @@ and |scf__dft_omega| keywords. For example, for LRC functionals, one can control
C
H 1 R
H 1 R 2 A
R = 1.075
A = 133.93
}
set reference uhf
set guess gwh
set basis cc-pvdz
set e_convergence 8
# Override the default value of omega
set dft_omega 2.0
E = energy('wb97x')
# Revoke the change for later computations if needed
revoke_global_option_changed('DFT_OMEGA')
This feature would be useful after finishing IP fitting procedure, for example.
Furthermore, new DFT functionals can be created from scratch from within the input file::
# DFT Custom Functional
molecule h2o {
0 1
O
H 1 1.0
H 1 1.0 2 104.5
}
set {
basis sto-3g
dft_spherical_points 302
dft_radial_points 99
reference rks
}
pbe0 = {
"name": "my_PBE0",
"x_functionals": {"GGA_X_PBE": {"alpha": 0.75}},
"x_hf": {"alpha": 0.25},
"c_functionals": {"GGA_C_PBE": {}}
}
func_call = energy('SCF', dft_functional=pbe0)
# as PBE0 is a pre-defined functional, the call above is equivalent to both below:
func_call = energy('SCF', dft_functional="PBE0")
func_call = energy('PBE0')
E = energy('wb97x')
Supported keywords include:
# Revoke the change for later computations if needed
revoke_global_option_changed('DFT_OMEGA')
- `name`: string, name of the functional, for custom defined functionals used for printing only.
- `xc_functionals`: dict, definition of a complete (X + C) functional based in LibXC name
- `x_functionals`: dict, definition of exchange functionals using LibXC names
- `c_functionals`: dict, definition of correlation functionals using LibXC names
- `x_hf`: dict, parameters dealing with exact (HF) exchange settings for hybrid DFT
- `c_mp2`: dict, parameters dealing with MP2 correlation for double hybrid DFT
- `dispersion`: dict, definition of dispersion corrections
- `citation`: string, citation for the method, for printing purposes
- `description`: string, description of the method, for printing purposes
This feature would be useful after finishing the IP fitting procedure, for example.
The full interface is defined in :ref:driver/procrouting/dft_funcs/dict_builder.py, all standard
functionals provided in Psi4 are implemented in the `dict_*_funcs.py` files in the same folder.
@@ -176,7 +176,7 @@ Running DFTD3
~~~~~~~~~~~~~
A number of *a posteriori* dispersion corrections are available in
|PSIfour|. While most are computed within |PSIfours| codebase (-D1, -D2,
|PSIfour|. While some are computed within |PSIfours| codebase (-D1, -D2,
-CHG, -DAS2009, -DAS2010), the -D3 correction and its variants are
available only through the ``DFTD3`` program. Once installed, the
``dftd3``/|PSIfour| interface is transparent, and all corrections are
@@ -210,44 +210,45 @@ program is suppressed; to see it in the output file, set print > 2.
.. _`table:dashd`:
.. table:: Variants of S. Grimme's -D correction
+-------------------------------------+---------------------------------------------------------------------------------------------------------+---------------------------------------------------------------+
| Extension [#f0]_ | Variant and Computing Program | |scf__dft_dispersion_parameters| |
+=====================================+=========================================================================================================+===============================================================+
| -D | alias to -D2P4 | |
+-------------------------------------+---------------------------------------------------------------------------------------------------------+---------------------------------------------------------------+
| -D1 | -D1 [#f1]_ within |PSIfour| | |
+-------------------------------------+---------------------------------------------------------------------------------------------------------+---------------------------------------------------------------+
| -D2 | alias to -D2P4 | |
+-------------------------------------+---------------------------------------------------------------------------------------------------------+---------------------------------------------------------------+
| -D2P4 | -D2 [#f2]_ within |PSIfour| | [:math:`s_6`] |
+-------------------------------------+---------------------------------------------------------------------------------------------------------+---------------------------------------------------------------+
| -D2GR | -D2 [#f2]_ through ``dftd3`` | [:math:`s_6`, :math:`\alpha_6`] |
+-------------------------------------+---------------------------------------------------------------------------------------------------------+---------------------------------------------------------------+
| -D3 | alias to -D3ZERO | |
+-------------------------------------+---------------------------------------------------------------------------------------------------------+---------------------------------------------------------------+
| -D3ZERO | -D3 [#f3]_ w/ original zero-damping through ``dftd3`` | [:math:`s_6`, :math:`s_8`, :math:`s_{r,6}`, :math:`\alpha_6`] |
+-------------------------------------+---------------------------------------------------------------------------------------------------------+---------------------------------------------------------------+
| -D3BJ | -D3 [#f4]_ w/ newer Becke-Johnson rational damping through ``dftd3`` | [:math:`s_6`, :math:`s_8`, :math:`a_1`, :math:`a_2`] |
+-------------------------------------+---------------------------------------------------------------------------------------------------------+---------------------------------------------------------------+
| -D3M | alias to -D3MZERO | |
+-------------------------------------+---------------------------------------------------------------------------------------------------------+---------------------------------------------------------------+
| -D3MZERO | -D3 [#f5]_ w/ reparameterized and more flexible original zero-damping through ``dftd3`` | [:math:`s_6`, :math:`s_8`, :math:`s_{r,6}`, :math:`\beta`] |
+-------------------------------------+---------------------------------------------------------------------------------------------------------+---------------------------------------------------------------+
| -D3MBJ | -D3 [#f5]_ w/ reparameterized newer Becke-Johnson rational damping through ``dftd3`` | [:math:`s_6`, :math:`s_8`, :math:`a_1`, :math:`a_2`] |
+-------------------------------------+---------------------------------------------------------------------------------------------------------+---------------------------------------------------------------+
.. table:: Variants of dispersion corrections
+-------------------------------------+-----------------------------------------------------------------------+---------------------------------+--------------------------------------------------------------------------------+
| Extension [#f0]_ | Variant | Computing Program (engine) | |scf__dft_dispersion_parameters| [#f10]_ |
+=====================================+=======================================================================+=================================+================================================================================+
| -D | alias to -D2 | | |
| -D1 | -D1 [#f1]_ | |PSIfours| libdisp | [:math:`s_6`] |
| -D2 | -D2 [#f2]_ | |PSIfours| libdisp OR ``dftd3`` | [:math:`s_6`, :math:`\alpha_6`, :math:`s_{r,6}`] |
| -D3 | alias to -D3ZERO | | |
| -D3ZERO | -D3 [#f3]_ w/ original zero-damping | ``dftd3`` | [:math:`s_6`, :math:`s_8`, :math:`s_{r,6}`, :math:`\alpha_6`, :math:`s_{r,8}`] |
| -D3BJ | -D3 [#f4]_ w/ newer Becke-Johnson rational damping | ``dftd3`` | [:math:`s_6`, :math:`s_8`, :math:`a_1`, :math:`a_2`] |
| -D3(BJ) | alias to -D3BJ | | |
| -D3M | alias to -D3MZERO | | |
| -D3MZERO | -D3 [#f5]_ w/ reparameterized and more flexible original zero-damping | ``dftd3`` | [:math:`s_6`, :math:`s_8`, :math:`s_{r,6}`, :math:`\beta`] |
| -D3MBJ | -D3 [#f5]_ w/ reparameterized newer Becke-Johnson rational damping | ``dftd3`` | [:math:`s_6`, :math:`s_8`, :math:`a_1`, :math:`a_2`] |
| -D3M(BJ) | alias to -D3MBJ | | |
| -NL | Grimme's -NL (DFT plus VV10 correlation) [#f6]_ | |PSIfours| nl | [:math:`b`, :math:`c`] via |scf__nl_dispersion_parameters| |
| -CHG | Chai & Head-Gordon dispersion formula [#f7]_ | |PSIfours| libdisp | [:math:`s_6`] |
| -DAS2009 | Podeszwa & Szalewicz dispersion formula [#f8]_ | |PSIfours| libdisp | [:math:`s_6`] |
| -DAS2010 | Podeszwa & Szalewicz dispersion formula [#f9]_ | |PSIfours| libdisp | [:math:`s_6`] |
+-------------------------------------+-----------------------------------------------------------------------+---------------------------------+--------------------------------------------------------------------------------+
.. rubric:: Footnotes
.. [#f0] Note that there are functionals with these extensions (*e.g.*, wB97X-D) that,
not being Grimme corrections, have nothing to do with this table.
not being Grimme corrections, won't follow this table exactly.
.. [#f1] [Grimme:2004:1463]_
.. [#f2] [Grimme:2006:1787]_
.. [#f3] [Grimme:2010:154104]_
.. [#f4] [Grimme:2011:1456]_
.. [#f5] [Smith:2016:2197]_
.. [#f6] [Hujo:2011:3866]_
.. [#f7] [Chai:2010:6615]_
.. [#f8] [Pernal:2009:263201]_
.. [#f9] [Podeszwa:2010:550]_
.. [#f10] Keyword not used for user-defined functionals where the ``dft_dict["dispersion"]["params"]``
is easily editable for this purpose. See :ref:`sec:dftdictbuilder`
A few practical examples:
@@ -269,6 +270,10 @@ A few practical examples:
set dft_dispersion_parameters [1.0, 2.0, 1.261, 14.0]
energy('b3lyp-d3')
* DFT-D2 single point with ``dftd3`` instead of |PSIfours| libdisp ::
energy('pbe-d2', engine='dftd3')
If only dispersion corrections (rather than total energies) are of
interest, the ``dftd3`` program can be run independently of the scf
through the python function :py:func:`~qcdb.interface_dftd3.run_dftd3`. (This function
@@ -1,5 +1,5 @@
if(${ENABLE_libefp})
find_package(pylibefp 0.3 CONFIG QUIET)
find_package(pylibefp 0.4 CONFIG QUIET)
if(${pylibefp_FOUND})
get_property(_loc TARGET pylibefp::core PROPERTY LOCATION)
@@ -21,7 +21,7 @@ if(${ENABLE_libefp})
libefp_external
pybind11_external
GIT_REPOSITORY https://github.com/loriab/pylibefp
GIT_TAG 07ec7e9 # v0.3+7 # add tag when stable
GIT_TAG v0.4
UPDATE_COMMAND ""
CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${STAGED_INSTALL_PREFIX}
-DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}
@@ -94,7 +94,7 @@ if(${ENABLE_libefp})
list(APPEND _addons ${_loc})
message(STATUS "${Cyan}Using libefp${ColourReset}: ${_loc} (version ${libefp_VERSION})")
find_package(pylibefp 0.3 CONFIG REQUIRED)
find_package(pylibefp 0.4 CONFIG REQUIRED)
get_property(_loc TARGET pylibefp::core PROPERTY LOCATION)
list(APPEND _addons ${_loc})
message(STATUS "${Cyan}Using pylibefp${ColourReset}: ${_loc} (version ${pylibefp_VERSION})")
Oops, something went wrong.

0 comments on commit 8cb0765

Please sign in to comment.