/usr/share/psi/python/aliases.py is in psi4-data 1:0.3-5.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 | #
#@BEGIN LICENSE
#
# PSI4: an ab initio quantum chemistry software package
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
#
#@END LICENSE
#
"""Module with functions that call upon those in modules
:py:mod:`proc`, :py:mod:`driver`, and :py:mod:`wrappers`.
Place in this file quickly defined procedures such as
- aliases for complex methods
- simple modifications to existing methods
"""
import re
import os
import math
import warnings
#CUimport psi4
#CUimport p4util
#CUfrom driver import *
from wrappers import *
from gaussian_n import * #CU
#from extend_Molecule import *
#CUfrom molutil import *
from wrappers_cfour import * #CU
from qmmm import * #CU
# Import plugin add-ons here for now
try:
import csx4psi
except ImportError:
pass
# Python procedures like these can be run directly from the input file or integrated
# with the energy(), etc. routines by means of lines like those at the end of this file.
def fake_file11(filename='fake_file11.dat'):
r"""Function to print a file *filename* of the old file11 format.
"""
molecule = psi4.get_active_molecule()
gradient = psi4.get_gradient()
with open(filename, 'w') as handle:
handle.write('%d\n' % (molecule.natom()))
for at in range(molecule.natom()):
handle.write('%6s %16.8f %16.8f %16.8f\n' % (molecule.symbol(at), molecule.x(at), molecule.y(at), molecule.z(at)))
for at in range(molecule.natom()):
handle.write('%6s %16.8f %16.8f %16.8f\n' % ('', gradient.get(at, 0), gradient.get(at, 1), gradient.get(at, 2)))
def sherrill_gold_standard(name='mp2', **kwargs):
r"""Function to call the quantum chemical method known as 'Gold Standard'
in the Sherrill group. Uses :py:func:`~wrappers.complete_basis_set` to evaluate
the following expression. Two-point extrapolation of the correlation energy
performed according to :py:func:`~wrappers.corl_xtpl_helgaker_2`.
.. math:: E_{total}^{\text{Au\_std}} = E_{total,\; \text{SCF}}^{\text{aug-cc-pVQZ}} \; + E_{corl,\; \text{MP2}}^{\text{aug-cc-pV[TQ]Z}} \; + \delta_{\text{MP2}}^{\text{CCSD(T)}}\big\vert_{\text{aug-cc-pVTZ}}
>>> # [1] single-point energy by this composite method
>>> energy('sherrill_gold_standard')
>>> # [2] finite-difference geometry optimization
>>> optimize('sherrill_gold_standard')
>>> # [3] finite-difference geometry optimization, overwriting some pre-defined sherrill_gold_standard options
>>> optimize('sherrill_gold_standard', corl_basis='cc-pV[DT]Z', delta_basis='3-21g')
"""
lowername = name.lower()
kwargs = p4util.kwargs_lower(kwargs)
if not ('func_cbs' in kwargs):
kwargs['func_cbs'] = energy
if not ('scf_basis' in kwargs):
kwargs['scf_basis'] = 'aug-cc-pVQZ'
if not ('scf_scheme' in kwargs):
kwargs['scf_scheme'] = highest_1
if not ('corl_wfn' in kwargs):
kwargs['corl_wfn'] = 'mp2'
name = 'mp2'
if not ('corl_basis' in kwargs):
kwargs['corl_basis'] = 'aug-cc-pV[TQ]Z'
if not ('corl_scheme' in kwargs):
kwargs['corl_scheme'] = corl_xtpl_helgaker_2
if not ('delta_wfn' in kwargs):
kwargs['delta_wfn'] = 'ccsd(t)'
if not ('delta_wfn_lesser' in kwargs):
kwargs['delta_wfn_lesser'] = 'mp2'
if not ('delta_basis' in kwargs):
kwargs['delta_basis'] = 'aug-cc-pVTZ'
if not ('delta_scheme' in kwargs):
kwargs['delta_scheme'] = highest_1
return cbs(name, **kwargs)
def allen_focal_point(name='mp2', **kwargs):
r"""Function to call Wes Allen-style Focal
Point Analysis. JCP 127 014306. Uses
:py:func:`~wrappers.complete_basis_set` to evaluate the following
expression. SCF employs a three-point extrapolation according
to :py:func:`~wrappers.scf_xtpl_helgaker_3`. MP2, CCSD, and
CCSD(T) employ two-point extrapolation performed according to
:py:func:`~wrappers.corl_xtpl_helgaker_2`. CCSDT and CCSDT(Q)
are plain deltas. This wrapper requires :ref:`Kallay's MRCC code <sec:mrcc>`.
.. math:: E_{total}^{\text{FPA}} = E_{total,\; \text{SCF}}^{\text{cc-pV[Q56]Z}} \; + E_{corl,\; \text{MP2}}^{\text{cc-pV[56]Z}} \; + \delta_{\text{MP2}}^{\text{CCSD}}\big\vert_{\text{cc-pV[56]Z}} \; + \delta_{\text{CCSD}}^{\text{CCSD(T)}}\big\vert_{\text{cc-pV[56]Z}} \; + \delta_{\text{CCSD(T)}}^{\text{CCSDT}}\big\vert_{\text{cc-pVTZ}} \; + \delta_{\text{CCSDT}}^{\text{CCSDT(Q)}}\big\vert_{\text{cc-pVDZ}}
>>> # [1] single-point energy by this composite method
>>> energy('allen_focal_point')
>>> # [2] finite-difference geometry optimization embarrasingly parallel
>>> optimize('allen_focal_point', mode='sow')
"""
lowername = name.lower()
kwargs = p4util.kwargs_lower(kwargs)
if not ('func_cbs' in kwargs):
kwargs['func_cbs'] = energy
# SCF
if not ('scf_basis' in kwargs):
kwargs['scf_basis'] = 'cc-pV[Q56]Z'
if not ('scf_scheme' in kwargs):
kwargs['scf_scheme'] = scf_xtpl_helgaker_3
# delta MP2 - SCF
if not ('corl_wfn' in kwargs):
kwargs['corl_wfn'] = 'mp2'
name = 'mp2'
if not ('corl_basis' in kwargs):
kwargs['corl_basis'] = 'cc-pV[56]Z'
if not ('corl_scheme' in kwargs):
kwargs['corl_scheme'] = corl_xtpl_helgaker_2
# delta CCSD - MP2
if not ('delta_wfn' in kwargs):
kwargs['delta_wfn'] = 'mrccsd'
if not ('delta_wfn_lesser' in kwargs):
kwargs['delta_wfn_lesser'] = 'mp2'
if not ('delta_basis' in kwargs):
kwargs['delta_basis'] = 'cc-pV[56]Z'
if not ('delta_scheme' in kwargs):
kwargs['delta_scheme'] = corl_xtpl_helgaker_2
# delta CCSD(T) - CCSD
if not ('delta2_wfn' in kwargs):
kwargs['delta2_wfn'] = 'mrccsd(t)'
if not ('delta2_wfn_lesser' in kwargs):
kwargs['delta2_wfn_lesser'] = 'mrccsd'
if not ('delta2_basis' in kwargs):
kwargs['delta2_basis'] = 'cc-pV[56]Z'
if not ('delta2_scheme' in kwargs):
kwargs['delta2_scheme'] = corl_xtpl_helgaker_2
# delta CCSDT - CCSD(T)
if not ('delta3_wfn' in kwargs):
kwargs['delta3_wfn'] = 'mrccsdt'
if not ('delta3_wfn_lesser' in kwargs):
kwargs['delta3_wfn_lesser'] = 'mrccsd(t)'
if not ('delta3_basis' in kwargs):
kwargs['delta3_basis'] = 'cc-pVTZ'
if not ('delta3_scheme' in kwargs):
kwargs['delta3_scheme'] = highest_1
# delta CCSDT(Q) - CCSDT
if not ('delta4_wfn' in kwargs):
kwargs['delta4_wfn'] = 'mrccsdt(q)'
if not ('delta4_wfn_lesser' in kwargs):
kwargs['delta4_wfn_lesser'] = 'mrccsdt'
if not ('delta4_basis' in kwargs):
kwargs['delta4_basis'] = 'cc-pVDZ'
if not ('delta4_scheme' in kwargs):
kwargs['delta4_scheme'] = highest_1
return cbs(name, **kwargs)
#def run_mp2_5(name, **kwargs):
# r"""Function that computes MP2.5 energy from results of a FNOCC
# MP3 calculation.
#
# .. math:: E_{total}^{\text{MP2.5}} = E_{total,\; \text{SCF}} \; + E_{corl,\; \text{MP2}} + E_{corl, \; \text{MP3}}
#
# :PSI variables:
#
# .. hlist::
# :columns: 1
#
# * :psivar:`MP2.5 TOTAL ENERGY <MP2.5TOTALENERGY>`
# * :psivar:`MP2.5 CORRELATION ENERGY <MP2.5CORRELATIONENERGY>`
#
# >>> energy('mp2.5')
#
# """
# lowername = name.lower()
# kwargs = kwargs_lower(kwargs)
#
# # Run detci calculation and collect conventional quantities
# energy('mp3', **kwargs)
# e_scf = psi4.get_variable('SCF TOTAL ENERGY')
# ce_mp2 = psi4.get_variable('MP2 CORRELATION ENERGY')
# ce_mp3 = psi4.get_variable('MP3 CORRELATION ENERGY')
# e_mp2 = e_scf + ce_mp2
# e_mp3 = e_scf + ce_mp3
#
# # Compute quantities particular to MP2.5
# ce_mp25 = 0.5 * (ce_mp2 + ce_mp3)
# e_mp25 = e_scf + ce_mp25
# psi4.set_variable('MP2.5 CORRELATION ENERGY', ce_mp25)
# psi4.set_variable('MP2.5 TOTAL ENERGY', e_mp25)
# psi4.set_variable('CURRENT CORRELATION ENERGY', ce_mp25)
# psi4.set_variable('CURRENT ENERGY', e_mp25)
#
# # build string of title banner and print results
# banners = ''
# banners += """psi4.print_out('\\n')\n"""
# banners += """banner(' MP2.5 ')\n"""
# banners += """psi4.print_out('\\n')\n\n"""
# exec(banners)
#
# tables = ''
# tables += """ SCF total energy: %16.8f\n""" % (e_scf)
# tables += """ MP2 total energy: %16.8f\n""" % (e_mp2)
# tables += """ MP2.5 total energy: %16.8f\n""" % (e_mp25)
# tables += """ MP3 total energy: %16.8f\n\n""" % (e_mp3)
# tables += """ MP2 correlation energy: %16.8f\n""" % (ce_mp2)
# tables += """ MP2.5 correlation energy: %16.8f\n""" % (ce_mp25)
# tables += """ MP3 correlation energy: %16.8f\n""" % (ce_mp3)
# psi4.print_out(tables)
#
# return e_mp25
# A direct translation of a plugin input file into a function call. Function calls are the only
# way to call plugins in sow/reap mode for db(), opt(), etc. This isn't best practices
# but is an example of what to do for a more complicated procedure where different options
# are set for different qc steps.
#def run_plugin_omega(name, **kwargs):
# r"""Function encoding sequence of PSI module and plugin calls, as well
# as typical options, to access Rob Parrish's omega plugin.
#
# >>> energy('plugin_omega')
#
# """
# lowername = name.lower()
# kwargs = p4util.kwargs_lower(kwargs)
#
# plugfile = psi4.Process.environment["PSIDATADIR"] + "/../tests/plugin_omega/plugin_omega.so"
# psi4.plugin_load("%s" % (plugfile))
#
# psi4.set_global_option('BASIS', 'AUG-CC-PVDZ')
# psi4.set_global_option('DF_BASIS_SCF', 'AUG-CC-PVDZ-RI')
# psi4.set_global_option('REFERENCE', 'UHF')
# psi4.set_global_option('SCF_TYPE', 'DF')
# energy('scf', **kwargs)
#
# psi4.set_global_option('dft_functional', 'wB97')
# psi4.set_global_option('dft_order_spherical', 25)
# psi4.set_global_option('dft_num_radial', 35)
# psi4.set_global_option('omega_procedure', 'ip')
# psi4.set_global_option('maxiter', 50)
# psi4.set_global_option('d_convergence', 5)
# psi4.set_global_option('e_convergence', 7)
# psi4.plugin("plugin_omega.so")
#
# return psi4.get_variable('SCF TOTAL ENERGY')
# Integration with driver routines
#procedures['energy']['mp2.5'] = run_mp2_5
procedures['energy']['sherrill_gold_standard'] = sherrill_gold_standard
procedures['energy']['allen_focal_point'] = allen_focal_point
#procedures['energy']['plugin_omega'] = run_plugin_omega
|