Permalink
Browse files

docs on managed methods

  • Loading branch information...
loriab committed Feb 2, 2016
1 parent f0dd92b commit 5450afa54b4f5861c0470c440bc85935145a0d2f
Showing with 204 additions and 107 deletions.
  1. +203 −2 doc/sphinxman/source/proc_py.rst
  2. +0 −104 doc/sphinxman/source/sowreap.rst
  3. +1 −1 lib/python/proc.py
@@ -6,6 +6,9 @@
Adding Methods to Driver
========================
``proc.py``
-----------
This is concerned at present with normal methods added first to the
procedures table in driver.py that associates method names with functions
to run them located in proc.py .
@@ -80,14 +83,14 @@ previously. ::
# Bypass routine scf if user did something special to get it to converge
if not (('bypass_scf' in kwargs) and yes.match(str(kwargs['bypass_scf']))):
scf_helper(name, **kwargs)
# include if TEI are needed beyond scf
# If the scf type is DF, then the AO integrals were never generated
if psi4.get_option('SCF', 'SCF_TYPE') == 'DF':
mints = psi4.MintsHelper()
mints.integrals()
Direct any post-scf modules to be run. ::
# include if further post-scf modules are needed
@@ -107,3 +110,201 @@ No function should return anything. ``CURRENT ENERGY`` will be set by
# never include
return returnvalue
Managed Methods
---------------
When functionality overlaps between modules, a pattern is needed to (1)
access each route through the code without contrivances like ``ccsd2``,
``_ccsd``, ``sdci`` and (2) apportion defaulting among the modules, taking
into account reference (RHF/UHF/ROHF) and calc type (CONV, DF, CD).
Managed methods handle both these cases through the addition of a new
keyword |globals__qc_module| and a set of type keywords analogous to
|globals__mp2_type|: |globals__mp_type|, |globals__cepa_type|,
|globals__ci_type|, |globals__cc_type|, which can have values ``CONV``,
``DF``, and ``CD``. These are all *global* keywords, as their values are
shared among modules rather than (or in addition to) being used internally
by the module). We're sticking with |scf__scf_type| and
|globals__mp2_type| defaulting to ``DF``, while everything higher defaults
to ``CONV``. In :source:`share/python/driver.py`, a managed method calls a
"select" function rather than a "run" function. ::
procedures = {
'energy': {
'scf' : run_scf,
'mp3' : select_mp3,
'dcft' : run_dcft,
Then in :source:`share/python/proc.py`, the select function runs through
reference (always outer loop) and type (inner loop) to specify the proc
function to call for any able, non-default module (*e.g.*, ``mtd_type ==
'DETCI'`` or able, default module (*e.g.*, ``mtd_typd == ['', 'FNOCC']``.
Don't worry about 'else' statements as anything that falls through will be
caught and a readable error generated. ::
def select_mp3(name, **kwargs):
"""Function selecting the algorithm for a MP3 energy call
and directing to specified or best-performance default modules.
"""
reference = psi4.get_option('SCF', 'REFERENCE')
mtd_type = psi4.get_global_option('MP_TYPE')
module = psi4.get_global_option('QC_MODULE')
# Considering only [df]occ/fnocc/detci
func = None
if reference == 'RHF':
if mtd_type == 'CONV':
if module == 'DETCI':
func = run_detci
elif module == 'FNOCC':
func = run_fnocc
elif module in ['', 'OCC']:
func = run_occ
elif mtd_type == 'DF':
if module in ['', 'OCC']:
func = run_dfocc
elif mtd_type == 'CD':
if module in ['', 'OCC']:
func = run_dfocc
elif reference == 'UHF':
if mtd_type == 'CONV':
if module in ['', 'OCC']:
func = run_occ
elif mtd_type == 'DF':
if module in ['', 'OCC']:
func = run_dfocc
elif mtd_type == 'CD':
if module in ['', 'OCC']:
func = run_dfocc
elif reference == 'ROHF':
if mtd_type == 'CONV':
if module in ['', 'DETCI']:
func = run_detci
if func is None:
raise ManagedMethodError(['select_mp3', name, 'MP_TYPE', mtd_type, reference, module])
return func(name, **kwargs)
Naturally, in the run function, you must either use the type keyword for
type switching or translate it into whatever ``DO_CD``-like keywords your
module uses. At run time with a closed-shell molecule, ::
energy('mp3')
will run OCC, while ::
set qc_module fnocc
energy('mp3')
will run FNOCC mp3.
Again, whenever a single method name needs to call multiple proc.py run
functions, it should be managed. Below, "Y" means method available in
module, "D" means module is default for that method, "" mean method not
available.
.. _`table:managed`:
.. table:: Overlapping capabilities of |PSIfour|
+-----------+-----------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+
| | | Energy | Gradient |
+ + +------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+
| | | RHF | UHF | ROHF | RHF | UHF | ROHF |
+ + +------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+
| | | CV | DF | CD | CV | DF | CD | CV | DF | CD | CV | DF | CD | CV | DF | CD | CV | DF | CD |
+===========+===========+======+======+======+======+======+======+======+======+======+======+======+======+======+======+======+======+======+======+
| mp2 | CCENERGY | | | | | | | | | | | | | | | | | | |
+ +-----------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+
| | DETCI | Y | | | | | | Y | | | | | | | | | | | |
+ +-----------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+
| | DFMP2 | | D | | | D | | | D | | | D | | | D | | | | |
+ +-----------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+
| | FNOCC | Y | | | | | | | | | | | | | | | | | |
+ +-----------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+
| | OCC | D | Y | D | D | Y | Y | D | Y | D | D | Y | | D | Y | | D | D | |
+-----------+-----------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+
| mp3 | CCENERGY | | | | | | | | | | | | | | | | | | |
+ +-----------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+
| | DETCI | Y | | | | | | D | | | | | | | | | | | |
+ +-----------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+
| | DFMP2 | | | | | | | | | | | | | | | | | | |
+ +-----------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+
| | FNOCC | Y | | | | | | | | | | | | | | | | | |
+ +-----------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+
| | OCC | D | D | D | D | D | D | | | | D | D | | D | D | | | | |
+-----------+-----------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+
| mp2.5 | CCENERGY | | | | | | | | | | | | | | | | | | |
+ +-----------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+
| | DETCI | | | | | | | | | | | | | | | | | | |
+ +-----------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+
| | DFMP2 | | | | | | | | | | | | | | | | | | |
+ +-----------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+
| | FNOCC | | | | | | | | | | | | | | | | | | |
+ +-----------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+
| | OCC | D | D | D | D | D | D | | | | D | D | | D | D | | | | |
+-----------+-----------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+
| mp4 | CCENERGY | | | | | | | | | | | | | | | | | | |
+ +-----------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+
| | DETCI | Y | | | | | | D | | | | | | | | | | | |
+ +-----------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+
| | DFMP2 | | | | | | | | | | | | | | | | | | |
+ +-----------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+
| | FNOCC | D | | | | | | | | | | | | | | | | | |
+ +-----------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+
| | OCC | | | | | | | | | | | | | | | | | | |
+-----------+-----------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+
| cepa(0) | CCENERGY | | | | | | | | | | | | | | | | | | |
+ +-----------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+
| | DETCI | | | | | | | | | | | | | | | | | | |
+ +-----------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+
| | DFMP2 | | | | | | | | | | | | | | | | | | |
+ +-----------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+
| | FNOCC | D | | | | | | | | | | | | | | | | | |
+ +-----------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+
| | OCC | Y | D | D | D | D | D | | | | D | D | | D | D | | | | |
+-----------+-----------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+
| ccsd | CCENERGY | D | | | D | | | D | | | D | | | D | | | D | | |
+ +-----------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+
| | DETCI | Y | | | | | | Y | | | | | | | | | | | |
+ +-----------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+
| | DFMP2 | | | | | | | | | | | | | | | | | | |
+ +-----------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+
| | FNOCC | Y | D | D | | | | | | | | | | | | | | | |
+ +-----------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+
| | OCC | | Y | Y | | | | | | | | D | | | | | | | |
+-----------+-----------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+
| ccsd(t) | CCENERGY | D | | | D | | | D | | | | | | D | | | | | |
+ +-----------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+
| | DETCI | | | | | | | | | | | | | | | | | | |
+ +-----------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+
| | DFMP2 | | | | | | | | | | | | | | | | | | |
+ +-----------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+
| | FNOCC | Y | D | D | | | | | | | | | | | | | | | |
+ +-----------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+
| | OCC | | Y | Y | | | | | | | | | | | | | | | |
+-----------+-----------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+
| ccsd(at) | CCENERGY | D | | | | | | | | | | | | | | | | | |
+ +-----------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+
| | DETCI | | | | | | | | | | | | | | | | | | |
+ +-----------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+
| | DFMP2 | | | | | | | | | | | | | | | | | | |
+ +-----------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+
| | FNOCC | | | | | | | | | | | | | | | | | | |
+ +-----------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+
| | OCC | | D | D | | | | | | | | | | | | | | | |
+-----------+-----------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+
| cisd | CCENERGY | | | | | | | | | | | | | | | | | | |
+ +-----------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+
| | DETCI | Y | | | | | | D | | | | | | | | | | | |
+ +-----------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+
| | DFMP2 | | | | | | | | | | | | | | | | | | |
+ +-----------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+
| | FNOCC | D | | | | | | | | | | | | | | | | | |
+ +-----------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+
| | OCC | | | | | | | | | | | | | | | | | | |
+-----------+-----------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+
Oops, something went wrong.

0 comments on commit 5450afa

Please sign in to comment.