
Python Driver¶
parallel¶
roa¶
diatomic¶
aliases¶
Module with functions that call upon those in modules
proc
, driver
, and wrappers
.
- Place in this file quickly defined procedures such as
- aliases for complex methods
- simple modifications to existing methods
dashparam¶
Module to hold and distribute the -D dispersion correction parameters.
-
dash_server
(func, dashlvl, mode='psi4')[source]¶ Function to serve up dispersion correction parameters in whatever form needed. When mode is ‘dftd3’, returns a string suitable for writing to ./dftd3_parameters to calculuate the correction at dashlvl with the default parameters for functional func. When mode is ‘psi4’, returns a tuple of arguments suitable for building a Dispersion object with dashlvl parameters for functional func.
There are four computational dashlvl choices. ‘d2p4’ calls the -D2 correction within psi4 (hence, faked for mode=’dftd3’). The other three, ‘d2gr’, ‘d3zero’, and ‘d3bj’ call the three dftd3 modes of operation (corresponding to -old, -zero, -bj). Additionally, there are three aliased dashlvl choices since the aliases in dash_alias above are imposed.
interface_cfour¶
Module with functions for Psi4/Cfour interface. Portions that require calls to Boost Python psi4 module are here, otherwise in qcdb module. Also calls to qcdb module are here and not elsewhere in driver. Organizationally, this module isolates qcdb code from psi4 code.
-
cfour_gradient_list
()[source]¶ Form list of Cfour analytic
gradient()
arguments.
-
cfour_psivar_list
()[source]¶ Form dictionary of PSI Variables set by Cfour methods.
wrappers¶
Module with functions that call the four main driver
functions: driver.energy
, driver.optimize
,
driver.response
, and driver.frequency
.
-
auto_fragments
(name, **kwargs)[source]¶ Detects fragments if the user does not supply them. Currently only used for the WebMO implementation of SAPT Returns a new fragmented molecule
usage: auto_fragments(‘’)
-
call_function_in_1st_argument
(funcarg, **largs)[source]¶ Function to make primary function call to energy(), opt(), etc. with options dictionary largs. Useful when funcarg to call is stored in variable.
-
mbe
(name, **kwargs)[source]¶ The driver routine for running calculations with the MBE or the GMBE.
Parameters: name (string) – 'scf'
||'ccsd(t)'
|| etc.First argument, usually unlabeled. Indicates the computational method to be applied to the molecule. May be any valid argument to
energy()
; however, SAPT is not appropriate.
-
reconstitute_bracketed_basis
(needarray)[source]¶ Function to reform a bracketed basis set string from a sequential series of basis sets (e.g, form ‘cc-pv[q5]z’ from array [cc-pvqz, cc-pv5z]). The basis set array is extracted from the f_basis field of a NEED dictionary in
complete_basis_set()
. Result is used to print a nicely formatted basis set string in the results table.
-
split_menial
(menial)[source]¶ Function used by
complete_basis_set()
to separate menial ‘scftot’ into [scf, tot] and ‘mp2corl’ into [mp2, corl].
-
tblhead
(tbl_maxrgt, tbl_delimit, ttype)[source]¶ Function that prints the header for the changable-width results tables in db(). tbl_maxrgt is the number of reagent columns the table must plan for. tbl_delimit is a string of dashes of the correct length to set off the table. ttype is 1 for tables comparing the computed values to the reference or 2 for simple tabulation and sum of the computed values.
-
validate_bracketed_basis
(basisstring)[source]¶ Function to transform and validate basis sets for cbs(). A basis set with no paired square brackets is passed through with zeta level 0 (e.g., ‘6-31+G(d,p)’ is returned as [6-31+G(d,p)] and [0]). A basis set with square brackets is checked for sensible sequence and Dunning-ness and returned as separate basis sets (e.g., ‘cc-pV[Q5]Z’ is returned as [cc-pVQZ, cc-pV5Z] and [4, 5]). Note that this function has no communication with the basis set library to check if the basis actually exists. Used by
complete_basis_set()
.
-
validate_scheme_args
(functionname, **largs)[source]¶ Function called by each extrapolation scheme in
complete_basis_set()
. Checks that all the input arguments are present and suitable so that the scheme function can focus on defining the extrapolation.
driver¶
-
gradient
(name, **kwargs)[source]¶ Function complementary to optimize(). Carries out one gradient pass, deciding analytic or finite difference.
-
hessian
(name, **kwargs)[source]¶ Function complementary to
frequency()
. Computes force constants, deciding analytic, finite difference of gradients, or finite difference of energies.
molutil¶
Module with utility functions that act on molecule objects.
-
BFS
(self)[source]¶ Perform a breadth-first search (BFS) on the real atoms in molecule, returning an array of atom indices of fragments. Relies upon van der Waals radii and so faulty for close (esp. hydrogen-bonded) fragments. Original code from Michael S. Marshall.
-
dynamic_variable_bind
(cls)[source]¶ Function to dynamically add extra members to the psi4.Molecule class.
-
extract_cluster_indexing
(mol, cluster_size=0)[source]¶ Function to returns a LIST of all subclusters of the molecule mol of real size cluster_size. If cluster_size = 0, returns all possible combinations of cluster size.
-
extract_clusters
(mol, ghost=True, cluster_size=0)[source]¶ Function to return all subclusters of the molecule mol of real size cluster_size and all other atoms ghosted if ghost equals true, all other atoms discarded if ghost is false. If cluster_size = 0, returns all possible combinations of cluster size.
proc¶
-
parse_scf_cases
(name)[source]¶ Function to parse name string involving SCF family into proper reference option.
-
run_adc
(name, **kwargs)[source]¶ Function encoding sequence of PSI module calls for an algebraic diagrammatic construction calculation.
Caution
Get rid of active molecule lines- should be handled in energy.
-
run_bccd
(name, **kwargs)[source]¶ Function encoding sequence of PSI module calls for a Brueckner CCD calculation.
-
run_bccd_t
(name, **kwargs)[source]¶ Function encoding sequence of PSI module calls for a Brueckner CCD(T) calculation.
-
run_cc_gradient
(name, **kwargs)[source]¶ Function encoding sequence of PSI module calls for a CCSD and CCSD(T) gradient calculation.
-
run_cc_property
(name, **kwargs)[source]¶ Function encoding sequence of PSI module calls for all CC property calculations.
-
run_ccenergy
(name, **kwargs)[source]¶ Function encoding sequence of PSI module calls for a CCSD, CC2, and CC3 calculation.
-
run_cdccd
(name, **kwargs)[source]¶ Function encoding sequence of PSI module calls for a cholesky-decomposed CCD computation
-
run_cdccsd
(name, **kwargs)[source]¶ Function encoding sequence of PSI module calls for a cholesky-decomposed CCSD computation
-
run_cdmp2
(name, **kwargs)[source]¶ Function encoding sequence of PSI module calls for a cholesky-decomposed MP2 computation
-
run_cdmp3
(name, **kwargs)[source]¶ Function encoding sequence of PSI module calls for a cholesky-decomposed MP3 computation
-
run_cdomp2
(name, **kwargs)[source]¶ Function encoding sequence of PSI module calls for a cholesky-decomposed orbital-optimized MP2 computation
-
run_cdomp3
(name, **kwargs)[source]¶ Function encoding sequence of PSI module calls for a cholesky-decomposed orbital-optimized MP3 computation
-
run_cepa
(name, **kwargs)[source]¶ Function encoding sequence of PSI module calls for a cepa-like calculation.
>>> energy('cepa(1)')
-
run_cepa0
(name, **kwargs)[source]¶ Function encoding sequence of PSI module calls for a CEPA (LCCD) computation
-
run_cepa0_gradient
(name, **kwargs)[source]¶ Function encoding sequence of PSI module calls for a CEPA(0) gradient calculation.
-
run_conv_omp2
(name, **kwargs)[source]¶ Function encoding sequence of PSI module calls for an orbital-optimized MP2 computation
-
run_conv_omp2_gradient
(name, **kwargs)[source]¶ Function encoding sequence of PSI module calls for OMP2 gradient calculation.
-
run_dcft
(name, **kwargs)[source]¶ Function encoding sequence of PSI module calls for a density cumulant functional theory calculation.
-
run_dcft_gradient
(name, **kwargs)[source]¶ Function encoding sequence of PSI module calls for DCFT gradient calculation.
-
run_detcas
(name, **kwargs)[source]¶ Function encoding sequence of PSI module calls for determinant-based multireference wavefuncations, namely CASSCF and RASSCF.
-
run_detci
(name, **kwargs)[source]¶ Function encoding sequence of PSI module calls for a configuration interaction calculation, namely FCI, CIn, MPn, and ZAPTn.
-
run_detci_property
(name, **kwargs)[source]¶ Function encoding sequence of PSI module calls for a configuration interaction calculation, namely FCI, CIn, MPn, and ZAPTn, computing properties.
-
run_dfccd
(name, **kwargs)[source]¶ Function encoding sequence of PSI module calls for an density-fitted orbital-optimized MP2 computation
-
run_dfccd_gradient
(name, **kwargs)[source]¶ Function encoding sequence of PSI module calls for an density-fitted CCD gradient computation
-
run_dfccdl
(name, **kwargs)[source]¶ Function encoding sequence of PSI module calls for an density-fitted CCSD Lambda computation
-
run_dfccsd2
(name, **kwargs)[source]¶ Function encoding sequence of PSI module calls for an density-fitted orbital-optimized MP2 computation
-
run_dfccsd_gradient
(name, **kwargs)[source]¶ Function encoding sequence of PSI module calls for an density-fitted CCSD gradient computation
-
run_dfccsdl
(name, **kwargs)[source]¶ Function encoding sequence of PSI module calls for an density-fitted CCSD Lambda computation
-
run_dfmp2
(name, **kwargs)[source]¶ Function encoding sequence of PSI module calls for a density-fitted MP2 calculation.
-
run_dfmp2_gradient
(name, **kwargs)[source]¶ Function encoding sequence of PSI module calls for a DFMP2 gradient calculation.
-
run_dfmp2_property
(name, **kwargs)[source]¶ Function encoding sequence of PSI module calls for a DFMP2 property calculation.
-
run_dfmp2_select_gradient
(name, **kwargs)[source]¶ Function selecting the algorithm for a MP2 gradient call and directing toward the OCC (conv MP2) or the DFMP2 modules.
-
run_dfmp3
(name, **kwargs)[source]¶ Function encoding sequence of PSI module calls for an density-fitted MP3 computation
-
run_dfocc
(name, **kwargs)[source]¶ Function encoding sequence of PSI module calls for an density-fitted orbital-optimized MP2 computation
-
run_dfomp2
(name, **kwargs)[source]¶ Function encoding sequence of PSI module calls for an density-fitted orbital-optimized MP2 computation
-
run_dfomp2_gradient
(name, **kwargs)[source]¶ Function encoding sequence of PSI module calls for DF-OMP2 gradient calculation.
-
run_dfomp2_property
(name, **kwargs)[source]¶ Function encoding sequence of PSI module calls for DF-OMP2 gradient calculation.
-
run_dfomp3
(name, **kwargs)[source]¶ Function encoding sequence of PSI module calls for an density-fitted orbital-optimized MP3 computation
-
run_dft
(name, **kwargs)[source]¶ Function encoding sequence of PSI module calls for a density-functional-theory calculation.
-
run_dft_gradient
(name, **kwargs)[source]¶ Function encoding sequence of PSI module calls for a density-functional-theory gradient calculation.
-
run_dmrgci
(name, **kwargs)[source]¶ Function encoding sequence of PSI module calls for an DMRG calculation.
-
run_dmrgscf
(name, **kwargs)[source]¶ Function encoding sequence of PSI module calls for an DMRG calculation.
-
run_efp
(name, **kwargs)[source]¶ Function encoding sequence of module calls for a pure EFP computation (ignore any QM atoms).
-
run_eom_cc
(name, **kwargs)[source]¶ Function encoding sequence of PSI module calls for an EOM-CC calculation, namely EOM-CC2, EOM-CCSD, and EOM-CC3.
-
run_eom_cc_gradient
(name, **kwargs)[source]¶ Function encoding sequence of PSI module calls for an EOM-CCSD gradient calculation.
-
run_fisapt
(name, **kwargs)[source]¶ Function encoding sequence of PSI module calls for an F/ISAPT0 computation
-
run_fnocc
(name, **kwargs)[source]¶ Function encoding sequence of PSI module calls for a QCISD(T), CCSD(T), MP2.5, MP3, and MP4 computation.
>>> energy('fno-ccsd(t)')
-
run_fnodfcc
(name, **kwargs)[source]¶ Function encoding sequence of PSI module calls for a DF-CCSD(T) computation.
>>> energy('df-ccsd(t)')
-
run_libfock
(name, **kwargs)[source]¶ Function encoding sequence of PSI module calls for a calculation through libfock, namely RCPHF, RCIS, RTDHF, RTDA, and RTDDFT.
-
run_lmp2
(name, **kwargs)[source]¶ Function encoding sequence of PSI module calls for an LMP2 theory calculation.
-
run_mcscf
(name, **kwargs)[source]¶ Function encoding sequence of PSI module calls for a multiconfigurational self-consistent-field calculation.
-
run_mp2
(name, **kwargs)[source]¶ Function encoding sequence of PSI module calls for a MP2 calculation.
-
run_mp2_5
(name, **kwargs)[source]¶ Function encoding sequence of PSI module calls for a MP2.5 calculation.
-
run_mp2_5_gradient
(name, **kwargs)[source]¶ Function encoding sequence of PSI module calls for a MP3 gradient calculation.
-
run_mp2_gradient
(name, **kwargs)[source]¶ Function encoding sequence of PSI module calls for a MP2 gradient calculation.
-
run_mp2_select
(name, **kwargs)[source]¶ Function selecting the algorithm for a MP2 energy call and directing toward the OCC (conv MP2) or the DFMP2 modules.
-
run_mp2_select_gradient
(name, **kwargs)[source]¶ Function selecting the algorithm for a MP2 gradient call and directing toward the OCC (conv MP2) or the DFMP2 modules.
-
run_mp2c
(name, **kwargs)[source]¶ Function encoding sequence of PSI module calls for a coupled MP2 calculation.
-
run_mp3
(name, **kwargs)[source]¶ Function encoding sequence of PSI module calls for a MP3 calculation.
-
run_mp3_gradient
(name, **kwargs)[source]¶ Function encoding sequence of PSI module calls for a MP3 gradient calculation.
-
run_mrcc
(name, **kwargs)[source]¶ Function that prepares environment and input files for a calculation calling Kallay’s MRCC code.
-
run_ocepa
(name, **kwargs)[source]¶ Function encoding sequence of PSI module calls for an orbital-optimized CEPA computation
-
run_ocepa_gradient
(name, **kwargs)[source]¶ Function encoding sequence of PSI module calls for OCEPA gradient calculation.
-
run_oldmp2
(name, **kwargs)[source]¶ Function encoding sequence of PSI module calls for a MP2 calculation.
-
run_omp2
(name, **kwargs)[source]¶ Function encoding sequence of PSI module calls for an orbital-optimized MP2 computation
-
run_omp2_5
(name, **kwargs)[source]¶ Function encoding sequence of PSI module calls for an orbital-optimized MP2.5 computation
-
run_omp2_5_gradient
(name, **kwargs)[source]¶ Function encoding sequence of PSI module calls for OMP2.5 gradient calculation.
-
run_omp2_gradient
(name, **kwargs)[source]¶ Function encoding sequence of PSI module calls for OMP2 gradient calculation.
-
run_omp3
(name, **kwargs)[source]¶ Function encoding sequence of PSI module calls for an orbital-optimized MP3 computation
-
run_omp3_gradient
(name, **kwargs)[source]¶ Function encoding sequence of PSI module calls for OMP3 gradient calculation.
-
run_psimrcc
(name, **kwargs)[source]¶ Function encoding sequence of PSI module calls for a PSIMRCC computation using a reference from the MCSCF module
-
run_psimrcc_scf
(name, **kwargs)[source]¶ Function encoding sequence of PSI module calls for a PSIMRCC computation using a reference from the SCF module
-
run_qchf
(name, **kwargs)[source]¶ Function encoding sequence of PSI module calls for an density-fitted orbital-optimized MP2 computation
-
run_rimp2
(name, **kwargs)[source]¶ Function encoding sequence of PSI module calls for a density-fitted MP2 computation
-
run_rimp2_gradient
(name, **kwargs)[source]¶ Function encoding sequence of PSI module calls for a density-fitted MP2 computation
-
run_rimp2_property
(name, **kwargs)[source]¶ Function encoding sequence of PSI module calls for a cholesky-decomposed MP2 computation
-
run_sapt
(name, **kwargs)[source]¶ Function encoding sequence of PSI module calls for a SAPT calculation of any level.
-
run_sapt_ct
(name, **kwargs)[source]¶ Function encoding sequence of PSI module calls for a charge-transfer SAPT calcuation of any level.
-
run_scf
(name, **kwargs)[source]¶ Function encoding sequence of PSI module calls for a self-consistent-field theory (HF & DFT) calculation.
-
run_scf_gradient
(name, **kwargs)[source]¶ Function encoding sequence of PSI module calls for a SCF gradient calculation.
-
run_scf_property
(name, **kwargs)[source]¶ Function encoding sequence of PSI module calls for SCF calculations. This is a simple alias to
run_scf()
since SCF properties all handled through oeprop.
-
run_scs_omp2
(name, **kwargs)[source]¶ Function encoding sequence of PSI module calls for a spin-component scaled OMP2 computation
-
run_scs_omp3
(name, **kwargs)[source]¶ Function encoding sequence of PSI module calls for a spin-component scaled OMP3 computation
-
run_sos_omp2
(name, **kwargs)[source]¶ Function encoding sequence of PSI module calls for a spin-opposite scaled OMP2 computation
qmmm¶
Module with classes to integrate MM charges into a QM calculation.
-
class
Diffuse
(molecule, basisname, ribasisname)[source]¶ -
fitGeneral
()¶ Function to perform a general fit of diffuse charges to wavefunction density.
-
fitScf
()¶ Function to run scf and fit a system of diffuse charges to resulting density.
-
populateExtern
(extern)¶
-
-
class
QMMM
[source]¶ -
addChargeAngstrom
(Q, x, y, z)¶ Function to add a point charge of magnitude Q at position (x, y, z) Angstroms.
-
addChargeBohr
(Q, x, y, z)¶ Function to add a point charge of magnitude Q at position (x, y, z) Bohr.
-
addDiffuse
(diffuse)¶ Function to add a diffuse charge field diffuse.
-
populateExtern
()¶ Function to define a charge field external to the molecule through point and diffuse charges.
-
pubchem¶
-
class
PubChemObj
(cid, mf, iupac)[source]¶ -
getCartesian
()¶ Function to return a string of the atom symbol and XYZ coordinates of the PubChem object.
-
getMoleculeString
()¶ Function to obtain a molecule string through getCartesian() or fail.
-
getSDF
()¶ Function to return the SDF (structure-data file) of the PubChem object.
-
getXYZFile
()¶ Function to obtain preferentially a molecule string through getCartesian() or a query string otherwise.
-
name
()¶ Function to return the IUPAC name of the PubChem object.
-
inputparser¶
-
check_parentheses_and_brackets
(input_string, exit_on_error)[source]¶ Function to check that all parenthesis and brackets in input_string are paired. On that condition, exit_on_error =1, otherwise 0.
-
parse_multiline_array
(input_list)[source]¶ Function to squash multiline arrays into a single line until all parentheses and brackets are fully paired.
-
process_from_file_command
(matchobj)[source]¶ Function that process a match of
from_file
in molecule block.
-
process_input
(raw_input, print_level=1)[source]¶ Function to preprocess raw input, the text of the input file, then parse it, validate it for format, and convert it into legitimate Python. raw_input is printed to the output file unless print_level =0. Does a series of regular expression filters, where the matching portion of the input is replaced by the output of the corresponding function (in this module) call. Returns a string concatenating module import lines, a copy of the user’s .psi4rc files, a setting of the scratch directory, a dummy molecule, and the processed raw_input.
-
process_multiline_arrays
(inputfile)[source]¶ Function to find array inputs that are spread across multiple lines and squash them into a single line.
-
process_option
(spaces, module, key, value, line)[source]¶ Function to process a line with set or in a set block into global/local domain and keyword/value.
-
process_print_command
(matchobj)[source]¶ Function to process match of
print
and transform it topsi4.print_out()
.
-
process_set_command
(matchobj)[source]¶ Function to process match of all individual
set (module_list) key {[value_list] or $value or value}
.
functional¶
Module to provide lightweight definitions of functionals and SuperFunctionals
mbe_impl¶
frac¶
p4regex¶
p4xcpt¶
Module with non-generic exceptions classes.
wrappers_cfour¶
Module with functions for Psi4/Cfour interface. Portions that require calls to Boost Python psi4 module are here, otherwise in qcdb module. Also calls to qcdb module are here and not elsewhere in driver. Organizationally, this module isolates qcdb code from psi4 code.
-
reap_job_validate
(dir, prefix, item, linkage, keys)[source]¶ For a given output file whose path is constructed with dir + ‘/’ + prefix + ‘-‘ + item + ‘.out’, tests that the file exists and has prefix RESULTS lines for each piece of information requested in list keys and that those lines correspond to the appropriate linkage and item. Returns keys along with their scanned values in dict reapings, along with error and success messages in instructions and a boolean isOk indicating whether all keys reaped sucessfully.
-
sown_jobs_status
(dir, prefix, zmats, validate_func=None, linkage=None, keys=None)[source]¶ Evaluate the output file status of jobs in zmats which should exist at dir + ‘/’ + prefix + ‘-‘ + job + ‘.out’. Returns string with formatted summary of job status and boolean of whether all complete. Return boolean isOk signals whether all zmats have completed and, if validate_func present, are validated.
-
vpt2
(name, **kwargs)[source]¶ Perform vibrational second-order perturbation computation through Cfour to get anharmonic frequencies. This version uses c4 for the disp and pt2 but gets gradients from p4.
Parameters: c4full (boolean) – 'on'
||'off'
Indicates whether when name indicates a Cfour method and mode indicates a sow/reap approach, sown files are direct ZMAT files and FJOBARC files are expected to reap, so that Cfour only, not Cfour-through-Psi4, is needed for distributed jobs.
Caution
Some features are not yet implemented. Buy a developer a coffee.
- Presently uses all gradients. Could mix in analytic 2nd-derivs.
- Collect resutls.
- Manage scratch / subdir better.
- Untangle CCSD(T) vs CCSD[T] and FJOBARC issue
- Allow CFOUR_BASIS
- Consider forcing some tighter convcrit, c4 and p4
- sow/reap
- mixed ang/bohr signals
- error by converting to ang in psi?
- Expand CURRENT DIPOLE XYZ beyond SCF
- Remember additional FJOBARC record TOTENER2 if EXCITE .ne. NONE
- S/R P4grad
- S/R C4grad
- C P4grad
- C C4grad
- switch C –> S/R with recovery using shelf
- pure C mode where only need P4 for wrapper
-
vpt2_instructions
(stage, dir, zmats)[source]¶ Stores all the instructions to the user for running
vpt2()
in sowreap mode. Depending on the stage, Pieces together instruction strings for the appropriate stage individualized by working directory dir and sown inputs zmats information.
-
vpt2_reaprun_files
(item, linkage, isSowReap, isC4notP4, isC4fully, zmat, outdir, scrdir, c4scrdir, lowername, kwargs)[source]¶ Provided with the particular displacement number item and the associated zmat file with geometry and linkage, returns the FJOBARC contents. Depending on the mode settings of isC4notP4, isSowReap, and isC4fully, either runs (using lowername and kwargs) or reaps contents. outdir is where psi4 was invoked, scrdir is the psi4 scratch directory, and c4scrdir is Cfour scratch directory within.
interface_dftd3¶
Module with functions that interface with Grimme’s DFTD3 code.
qcdb¶
Module to facilitate quantum chemical computations on chemical databases. Contains Molecule class and physical constants from psi4 suite.
-
class
Infile
(mem, mol, mtd, der, opt)[source]¶ -
format_infile_string
()¶
-
muster_basis_options
()¶
-
prepare_basis_for_molpro
()¶
-
-
muster_modelchem
(name, dertype, mol)[source]¶ Transform calculation method name and derivative level dertype into options for cfour. While deliberately requested pieces, generally CFOUR_DERIV_LEVEL and CFOUR_CALC_LEVEL, are set to complain if contradicted (‘clobber’ set to True), other ‘recommended’ settings, like CFOUR_CC_PROGRAM, can be countermanded by keywords in input file (‘clobber’ set to False). Occasionally, want these pieces to actually overcome keywords in input file (‘superclobber’ set to True).
-
prepare_options_for_molpro
(options, proc)[source]¶ Function to take the full snapshot of the liboptions object encoded in dictionary options, find the options directable toward Cfour (options[‘CFOUR’][‘CFOUR_**’]) that aren’t default, then write a CFOUR deck with those options. Note that unlike the cfour version, this uses complete options deck.
-
class
CharacterTable
(*args)[source]¶ The CharacterTable class provides a workable character table for all of the non-cubic point groups. While I have tried to match the ordering in Cotton’s book, I don’t guarantee that it is always followed. It shouldn’t matter anyway. Also note that I don’t lump symmetry operations of the same class together. For example, in C3v there are two distinct C3 rotations and 3 distinct reflections, each with a separate character. Thus symop has 6 elements rather than the 3 you’ll find in most published character tables.
-
common_init
()[source]¶ First parse the point group symbol, this will give us the order of the point group(g), the type of point group (pg), the order of the principle rotation axis (nt), and the number of irreps (nirrep_).
-
complex
()[source]¶ Cn, Cnh, Sn, T, and Th point groups have complex representations. This function returns 1 if the point group has a complex representation, 0 otherwise.
-
constructor_bits
(bits)[source]¶ This constructor takes the bitswise representation of a point group as input.
-
constructor_schoenflies
(cpg)[source]¶ This constructor takes the Schoenflies symbol of a point group as input.
-
-
class
IrreducibleRepresentation
(*args)[source]¶ The IrreducibleRepresentation class provides information associated with a particular irreducible representation of a point group. This includes the Mulliken symbol for the irrep, the degeneracy of the irrep, the characters which represent the irrep, and the number of translations and rotations in the irrep. The order of the point group is also provided (this is equal to the number of characters in an irrep).
-
constructor_order_degen_mulliken
(order, d, lab, clab)[source]¶ This constructor takes as arguments the order of the point group, the degeneracy d of the irrep, and the Mulliken symbol of the irrep. The Mulliken symbol is copied internally.
-
init
(order, d, lab, clab)[source]¶ Initialize the order, degeneracy, and Mulliken symbol of the irrep.
-
-
class
PointGroup
(*args)[source]¶ The PointGroup class is really a place holder for a CharacterTable. It contains a string representation of the Schoenflies symbol of a point group, a frame of reference for the symmetry operation transformation matrices, and a point of origin. The origin is not respected by the symmetry operations, so if you want to use a point group with a nonzero origin, first translate all your coordinates to the origin and then set the origin to zero.
-
static
bits_to_basic_name
(bits)[source]¶ From bit representation of point group, returns string of simple (non-directional) Schoenflies symbol.
-
constructor_bits
(bits)[source]¶ Using the bitwise representation constructor the point group object.
-
constructor_bits_origin
(bits, origin)[source]¶ Using the bitwise representation constructor the point group object.
-
constructor_schoenflies
(s)[source]¶ This constructor takes a string containing the Schoenflies symbol of the point group as its only argument.
-
static
-
class
SymRep
(*args)[source]¶ The SymRep class provides an n dimensional matrix representation of a symmetry operation, such as a rotation or reflection. The trace of a SymRep can be used as the character for that symmetry operation. d is hardwired to 5x5 since the H irrep in Ih is 5 dimensional.
-
class
SymmetryOperation
(*args)[source]¶ The SymmetryOperation class provides a 3 by 3 matrix representation of a symmetry operation, such as a rotation or reflection.
-
similar
(bits)[source]¶ From bits of a directionalized point group, returns array of bits of all directions.
-
class
LibmintsMolecule
(psi4molstr=None)[source]¶ Class to store the elements, coordinates, fragmentation pattern, charge, multiplicity of a molecule. Largely replicates psi4’s libmints Molecule class, developed by Justin M. Turney and Andy M. Simmonett with incremental improvements by other psi4 developers. Major differences from the C++ class are: no basisset handling, no symmetry, no pubchem, no efp, no discarding dummies. This class translated so that databases can function independently of psi4.
>>> H2OH2O = qcdb.Molecule(""" 0 1 O1 -1.551007 -0.114520 0.000000 H1 -1.934259 0.762503 0.000000 H2 -0.599677 0.040712 0.000000 -- 0 1 X 0.000000 0.000000 0.000000 O2 1.350625 0.111469 0.000000 H3 1.680398 -0.373741 -0.758561 H4 1.680398 -0.373741 0.758561 no_com no_reorient units angstrom """)
>>> H2O = qcdb.Molecule.init_with_xyz('h2o.xyz')
-
FullPointGroupList
= ['ATOM', 'C_inf_v', 'D_inf_h', 'C1', 'Cs', 'Ci', 'Cn', 'Cnv', 'Cnh', 'Sn', 'Dn', 'Dnd', 'Dnh', 'Td', 'Oh', 'Ih']¶
-
add_atom
(Z, x, y, z, label='', mass=0.0, charge=0.0, lineno=-1)[source]¶ Add an atom to the molecule Z atomic number x cartesian coordinate y cartesian coordinate z cartesian coordinate symb atomic symbol to use mass mass to use if non standard charge charge to use if non standard lineno line number when taken from a string
-
atom_at_position
(b, tol=0.05)[source]¶ Tests to see of an atom is at the passed position b in Bohr with a tolerance tol.
>>> print H2OH2O.atom_at_position([1.35*(1.0/psi_bohr2angstroms), 0.10*(1.0/psi_bohr2angstroms), 0.0*(1.0/psi_bohr2angstroms)]) 3
-
atom_to_unique
(iatom)[source]¶ Converts an atom number to the number of its generating unique atom. The return value is in [0, nunique).
-
atom_to_unique_offset
(iatom)[source]¶ Converts an atom number to the offset of this atom in the list of generated atoms. The unique atom itself is allowed offset 0.
-
center_of_mass
()[source]¶ Computes center of mass of molecule (does not translate molecule).
>>> H2OH2O.center_of_mass() [-0.12442647346606871, 0.00038657002584110707, 0.0]
-
charge
(atom)[source]¶ Returns charge of atom (0-indexed). Related to SAD guess in libmints version.
>>> print H2OH2O.charge(4) 1.0
-
charge_specified
()[source]¶ Whether the charge was given by the user
>>> print H2OH2O.charge_specified() True
-
create_molecule_from_string
(text)[source]¶ Given a string text of psi4-style geometry specification (including newlines to separate lines), builds a new molecule. Called from constructor.
-
create_psi4_string_from_molecule
()[source]¶ Regenerates a input file molecule specification string from the current state of the Molecule. Contains geometry info, fragmentation, charges and multiplicities, and any frame restriction.
-
distance_matrix
()[source]¶ Computes a matrix depicting distances between atoms. Prints formatted and returns array.
>>> H2OH2O.distance_matrix() Interatomic Distances (Angstroms) [1] [2] [3] [4] [5] [6] [1] 0.00000 [2] 0.95711 0.00000 [3] 0.96391 1.51726 0.00000 [4] 2.91042 3.34878 1.95159 0.00000 [5] 3.32935 3.86422 2.43843 0.95895 0.00000 [6] 3.32935 3.86422 2.43843 0.95895 1.51712 0.00000
-
extract_fragments
(reals, ghosts=[])[source]¶ Makes a copy of the molecule, returning a new molecule with only certain fragment atoms present as either ghost or real atoms reals: The list or int of fragments (1-indexed) that should be present in the molecule as real atoms. ghosts: The list or int of fragments (1-indexed) that should be present in the molecule as ghosts. (method name in libmints is extract_subsets. This is different in qcdb because the psi4 input parser tries to process lines with that term, giving rise to Boost:Python type conlicts.) See usage at
extract_fragments()
.
-
extract_subsets
(reals, ghosts=[])[source]¶ Wrapper for
extract_fragments()
. See note there. This function can be used as long as not in psi4 input file. Use extract_fragments directly, then.>>> H2OH2O.extract_subsets(2) # monomer B, unCP-corrected >>> H2OH2O.extract_subsets(2,1) # monomer B, CP-corrected >>> obj.extract_subsets(1,[2,3]) # monomer A, CP-corrected if obj is tri-molecular complex
-
fcharge
(atom)[source]¶ Returns charge of atom (0-indexed, includes dummies). Related to SAD guess in libmints version.
>>> print H2OH2O.fcharge(4) 8.0
-
find_highest_point_group
(tol=1e-08)[source]¶ Find the highest D2h point group from Jet and Ed’s code: c1 ci c2 cs d2 c2v c2h d2h. Ignore the user-specified subgroup in this case.
-
find_point_group
(tol=1e-08)[source]¶ Find computational molecular point group, user can override this with the “symmetry” keyword. Result is highest D2h subgroup attendant on molecule and allowed by the user.
-
fix_orientation
(_fix=True)[source]¶ Fix the orientation at its current frame (method name in libmints is set_orientation_fixed)
-
flabel
(atom)[source]¶ Returns the original label of the atom (0-indexed) as given in the input file (C2, H4) (includes dummies)
>>> print H2OH2O.flabel(4) O2
-
fmass
(atom)[source]¶ Returns mass of atom (0-indexed, includes dummies)
>>> print H2OH2O.fmass(4) 15.9949146196
-
form_symmetry_information
(tol=1e-08)[source]¶ Initialize molecular specific symmetry information. Uses the point group object obtain by calling point_group()
-
fsymbol
(atom)[source]¶ Returns the cleaned up label of the atom (C2 => C, H4 = H) (includes dummies) (0-indexed)
>>> print H2OH2O.fsymbol(4) O
-
full_geometry
()[source]¶ Returns the full (dummies included) geometry in Bohr as a N X 3 array.
>>> print H2OH2O.full_geometry() [[-2.930978460188563, -0.21641143673806384, 0.0], [-3.655219780069251, 1.4409218455037016, 0.0], [-1.1332252981904638, 0.0769345303220403, 0.0], [0.0, 0.0, 0.0], [2.5523113582286716, 0.21064588230662976, 0.0], [3.175492014248769, -0.7062681346308132, -1.4334725450878665], [3.175492014248769, -0.7062681346308132, 1.4334725450878665]]
-
full_pg_n
()[source]¶ Return n in Cnv, etc.; If there is no n (e.g. Td) it’s the highest-order rotation axis.
-
fx
(atom)[source]¶ x position of atom (0-indexed, includes dummies) in Bohr
>>> print H2OH2O.fx(4) 2.55231135823
-
fxyz
(atom)[source]¶ Returns a Vector3 with x, y, z position of atom (0-indexed) in Bohr (includes dummies)
>>> print H2OH2O.fxyz(4) [2.5523113582286716, 0.21064588230662976, 0.0]
-
fy
(atom)[source]¶ y position of atom (0-indexed, includes dummies) in Bohr
>>> print H2OH2O.fy(4) 0.210645882307
-
fz
(atom)[source]¶ z position of atom (0-indexed, includes dummies) in Bohr
>>> print H2OH2O.fz(4) 0.0
-
geometry
()[source]¶ Returns the geometry in Bohr as a N X 3 array.
>>> print H2OH2O.geometry() [[-2.930978460188563, -0.21641143673806384, 0.0], [-3.655219780069251, 1.4409218455037016, 0.0], [-1.1332252981904638, 0.0769345303220403, 0.0], [2.5523113582286716, 0.21064588230662976, 0.0], [3.175492014248769, -0.7062681346308132, -1.4334725450878665], [3.175492014248769, -0.7062681346308132, 1.4334725450878665]]
-
get_anchor_atom
(vstr, line)[source]¶ Attempts to interpret a string vstr as an atom specifier in a zmatrix. Takes the current line for error message printing. Returns the atom number (adjusted to zero-based counting).
-
get_coord_value
(vstr)[source]¶ Attempts to interpret a string as a double, if not it assumes it’s a variable.
-
get_full_point_group
()[source]¶ Return point group name such as C3v or S8. (method name in libmints is full_point_group)
-
get_variable
(vstr)[source]¶ Checks to see if the variable str is in the list, sets it to val and returns true if it is, and returns false if not.
-
has_symmetry_element
(op, tol=1e-08)[source]¶ NYI Whether molecule satisfies the vector symmetry operation op. Not used by libmints.
-
inertia_tensor
()[source]¶ Compute inertia tensor.
>>> print H2OH2O.inertia_tensor() [[8.704574864178731, -8.828375721817082, 0.0], [-8.828375721817082, 280.82861714077666, 0.0], [0.0, 0.0, 281.249500988553]]
-
init_with_checkpoint
(chkpt)[source]¶ NYI Pull information from the chkpt object passed (method name in libmints is init_with_chkpt)
-
init_with_io
(psio)[source]¶ NYI Pull information from a chkpt object created from psio (method name in libmints is init_with_psio)
-
classmethod
init_with_xyz
(xyzfilename)[source]¶ Pull information from an XYZ file. No fragment or chg/mult info detected.
>>> H2O = qcdb.Molecule.init_with_xyz('h2o.xyz')
-
is_axis
(origin, axis, order, tol=1e-08)[source]¶ Is axis an axis of order order with respect to origin?
-
is_linear_planar
(tol=1e-08)[source]¶ Is the molecule linear, or planar?
>>> print H2OH2O.is_linear_planar() (False, False)
-
is_variable
(vstr)[source]¶ Checks to see if the variable str is in the list, returns true if it is, and returns false if not.
>>> H2OH2O.is_variable('R') False
-
label
(atom)[source]¶ Returns the original label of the atom (0-indexed) as given in the input file (C2, H4). (0-indexed)
>>> print H2OH2O.label(4) H3
-
static
like_world_axis
(axis, worldxaxis, worldyaxis, worldzaxis)[source]¶ Returns which worldaxis axis most overlaps with. Inverts axis when indicated.
-
multiplicity_specified
()[source]¶ Whether the multiplicity was given by the user
>>> print H2OH2O.multiplicity_specified() True
-
nactive_fragments
()[source]¶ The number of active fragments in the molecule.
>>> print H2OH2O.nactive_fragments() 2
-
nfrozen_core
(depth=False)[source]¶ Number of frozen core for molecule given freezing state.
>>> print H2OH2O.nfrozen_core() 2
-
nuclear_repulsion_energy
()[source]¶ Computes nuclear repulsion energy.
>>> print H2OH2O.nuclear_repulsion_energy() 36.6628478528
-
nuclear_repulsion_energy_deriv1
()[source]¶ Computes nuclear repulsion energy derivatives
>>> print H2OH2O.nuclear_repulsion_energy_deriv1() [[3.9020946901323774, 2.76201566471991, 0.0], [1.3172905807089021, -2.3486366050337293, 0.0], [-1.8107598525022435, -0.32511212499256564, 0.0], [-1.217656141385739, -2.6120090867576717, 0.0], [-1.0954846384766488, 1.2618710760320282, 2.1130743287465603], [-1.0954846384766488, 1.2618710760320282, -2.1130743287465603]]
-
orientation_fixed
()[source]¶ Get whether or not orientation is fixed.
>>> H2OH2O.orientation_fixed() True
-
print_bond_angles
()[source]¶ Print the geometrical parameters (bond_angles) of the molecule.
>>> print H2OH2O.print_bond_angles() Bond Angles (degrees) Angle 2-1-3: 104.337 Angle 2-1-4: 109.152 Angle 2-1-5: 117.387 ...
-
print_dihedrals
()[source]¶ Print the geometrical parameters (dihedrals) of the molecule.
>>> print H2OH2O.print_dihedrals() Dihedral Angles (Degrees) Dihedral 1-2-3-4: 180.000 Dihedral 1-2-3-5: 133.511 Dihedral 1-2-3-6: 133.511 ...
-
print_distances
()[source]¶ Print the geometrical parameters (distances) of the molecule. suspect libmints version actually prints Bohr.
>>> print H2OH2O.print_distances() Interatomic Distances (Angstroms) Distance 1 to 2 0.957 Distance 1 to 3 0.964 Distance 1 to 4 2.910 ...
-
print_full
()[source]¶ Print full atom list. Same as
print_out()
only displays dummy atoms.
-
print_out
()[source]¶ Print the molecule. (method name in libmints is print)
>>> H2OH2O.print_out() Geometry (in Angstrom), charge = -2, multiplicity = 3: Center X Y Z ------------ ----------------- ----------------- ----------------- O -1.551007000000 -0.114520000000 0.000000000000 H -1.934259000000 0.762503000000 0.000000000000 H -0.599677000000 0.040712000000 0.000000000000 O 1.350625000000 0.111469000000 0.000000000000 H 1.680398000000 -0.373741000000 -0.758561000000 H 1.680398000000 -0.373741000000 0.758561000000
-
print_out_in_angstrom
()[source]¶ Print the molecule in Angstroms. Same as
print_out()
only always in Angstroms. (method name in libmints is print_in_angstrom)
-
print_out_in_bohr
()[source]¶ Print the molecule in Bohr. Same as
print_out()
only in Bohr. (method name in libmints is print_in_bohr)
-
print_out_of_planes
()[source]¶ Print the geometrical parameters (out_of_planes) of the molecule.
>>> print H2OH2O.print_out_of_planes() Out-Of-Plane Angles (Degrees) Out-of-plane 1-2-3-4: 0.000 Out-of-plane 1-2-3-5: -7.373 Out-of-plane 1-2-3-6: 7.373 ...
-
reinterpret_coordentries
()[source]¶ Reinterpret the fragments for reals/ghosts and build the atom list.
-
reinterpret_coordentry
(rc)[source]¶ Do we reinterpret coordentries during a call to update_geometry? (method name in libmints is set_reinterpret_coordentry)
-
rotate
(R)[source]¶ Rotates the molecule using rotation matrix R.
>>> H2OH2O.rotate([[0,-1,0],[-1,0,0],[0,0,1]])
-
rotate_full
(R)[source]¶ Rotates the full molecule using rotation matrix R.
>>> H2OH2O.rotate_full([[0,-1,0],[-1,0,0],[0,0,1]])
-
rotational_constants
(tol=1e-08)[source]¶ Compute the rotational constants and return them in wavenumbers
-
save_string_xyz
(save_ghosts=True)[source]¶ Save a string for a XYZ-style file.
>>> H2OH2O.save_string_xyz() 6 _ O -1.551007000000 -0.114520000000 0.000000000000 H -1.934259000000 0.762503000000 0.000000000000 H -0.599677000000 0.040712000000 0.000000000000 O 1.350625000000 0.111469000000 0.000000000000 H 1.680398000000 -0.373741000000 -0.758561000000 H 1.680398000000 -0.373741000000 0.758561000000
-
save_to_checkpoint
(chkpt, prefix='')[source]¶ NYI Save information to checkpoint file (method name in libmints is save_to_chkpt)
-
set_basis_by_number
(number, name, role='BASIS')[source]¶ Assigns basis name to atom number number (0-indexed, excludes dummies).
-
set_com_fixed
(_fix=True)[source]¶ NYI Fix the center of mass at its current frame. Not used in libmints so not implemented.
-
set_full_geometry
(geom)[source]¶ Sets the full geometry (dummies included), given a N X 3 array of coordinates geom in Bohr.
>>> H2OH2O.set_full geometry([[1,2,3],[4,5,6],[7,8,9],[0,0,0],[-1,-2,-3],[-4,-5,-6],[-7,-8,-9]])
-
set_full_point_group
(tol=1e-08)[source]¶ Determine and set FULL point group. full_pg_n_ is highest order n in Cn. 0 for atoms or infinity.
-
set_geometry
(geom)[source]¶ Sets the geometry, given a N X 3 array of coordinates geom in Bohr.
>>> H2OH2O.set_geometry([[1,2,3],[4,5,6],[7,8,9],[-1,-2,-3],[-4,-5,-6],[-7,-8,-9]])
-
set_has_zmatrix
(tf)[source]¶ Sets the presence of any zmatrix entry
>>> H2OH2O.set_has_zmatrix(True)
-
set_multiplicity
(mult)[source]¶ Sets the multiplicity (defined as 2Ms + 1)
>>> H2OH2O.set_multiplicity(3)
-
set_shell_by_number
(number, bshash, role='BASIS')[source]¶ Assigns BasisSet bshash to atom number number (0-indexed, excludes dummies).
-
set_variable
(vstr, val)[source]¶ Assigns the value val to the variable labelled string in the list of geometry variables. Also calls update_geometry()
-
symbol
(atom)[source]¶ Returns the cleaned up label of the atom (C2 => C, H4 = H) (0-indexed)
>>> print H2OH2O.symbol(4) H
-
symmetrize
()[source]¶ Force the molecule to have the symmetry specified in pg. This is to handle noise coming in from optking.
-
symmetry_frame
(tol=1e-08)[source]¶ Determine symmetry reference frame. If noreorient is not set, this is the rotation matrix applied to the geometry in update_geometry.
>>> print H2OH2O.symmetry_frame() [[1.0, -0.0, 0.0], [0.0, 1.0, 0.0], [0.0, -0.0, 1.0]]
-
symmetry_from_input
()[source]¶ Returns the symmetry specified in the input.
>>> print H2OH2O.symmetry_from_input() C1
-
update_geometry
()[source]¶ Updates the geometry, by (re)interpreting the string used to create the molecule, and the current values of the variables. The atoms list is cleared, and then rebuilt by this routine. This function must be called after first instantiation of Molecule.
>>> H2 = qcdb.Molecule("H\nH 1 0.74\n") >>> print H2.natom() 0 >>> H2.update_geometry() >>> print H2.natom() 2
-
-
atom_present_in_geom
(geom, b, tol=1e-08)[source]¶ Function used by set_full_point_group() to scan a given geometry and determine if an atom is present at a given location.
-
compute_atom_map
(mol)[source]¶ Computes atom mappings during symmetry operations. Useful in generating SO information and Cartesian displacement SALCs. param mol Molecule to form mapping matrix from. returns Integer matrix of dimension natoms X nirreps.
-
equal_but_for_row_order
(mat, rhs, tol=1e-08)[source]¶ Checks matrix equality, but allows rows to be in a different order. @param rhs Matrix to compare to. @returns true if equal, otherwise false.
-
matrix_3d_rotation
(mat, axis, phi, Sn)[source]¶ For a matrix of 3D vectors (ncol==3), rotate a set of points around an arbitrary axis. Vectors are the rows of the matrix. @param axis Vector3 : axis around which to rotate (need not be normalized) @param phi double : magnitude of rotation in rad @param Sn bool : if true, then also reflect in plane through origin and
perpendicular to rotation@returns SharedMatrix with rotated points (rows)
-
matrix_3d_rotation_Cn
(coord, axis, reflect, tol=1e-08, max_Cn_to_check=-1)[source]¶ Find maximum n in Cn around given axis, i.e., the highest-order rotation axis. @param coord Matrix : points to rotate - column dim is 3 @param axis Vector3 : axis around which to rotate, does not need to be normalized @param bool reflect : if true, really look for Sn not Cn @returns n
-
class
BasisSet
(name, fullname=None, latex=None, citation=None, pdfdatabase=None, comment=None, zeta=None, build=None)[source]¶ Specialization of :pyclass:`QCEssential` for basis sets.
-
class
Error
(name, fullname=None, latex=None, citation=None, pdfdatabase=None, comment=None)[source]¶ Specialization of :pyclass:`QCEssential` for measures of error.
-
class
Method
(name, fullname=None, latex=None, citation=None, pdfdatabase=None, comment=None)[source]¶ Specialization of :pyclass:`QCEssential` for quantum chemical methods.
-
class
QCEssential
(name, fullname=None, latex=None, citation=None, pdfdatabase=None, comment=None)[source]¶ Class to link literature and external representation of some aspect of quantum chemistry (basis set, method, etc.) with a shorthand and indexed representation of same.
-
conv_float2negexp
(val)[source]¶ Returns the least restrictive negative exponent of the power 10 that would achieve the floating point convergence criterium val.
-
format_option_for_cfour
(opt, val)[source]¶ Function to reformat value val for option opt from python into cfour-speak. Arrays are the primary target.
-
prepare_options_for_cfour
(options)[source]¶ Function to take the full snapshot of the liboptions object encoded in dictionary options, find the options directable toward Cfour (options[‘CFOUR’][‘CFOUR_**’]) that aren’t default, then write a CFOUR deck with those options.
-
prepare_options_for_psi4
(options)[source]¶ Function to take the full snapshot of the liboptions object encoded in dictionary options, find the options directable toward Cfour (options[‘CFOUR’][‘CFOUR_**’]) that aren’t default, then write a CFOUR deck with those options. Note that unlike the cfour version, this uses complete options deck.
-
reconcile_options
(full, partial)[source]¶ Function to take the full snapshot of the liboptions object encoded in dictionary full and reconcile it with proposed options value changes in partial. Overwrites full with partial if option untouched, touches full if full and partial are in agreement, balks if full and partial conflict. Returns full.
-
reconcile_options2
(full, partial)[source]¶ Function to take the full snapshot of the liboptions object encoded in dictionary full and reconcile it with proposed options value changes in partial. Overwrites full with partial if option untouched, touches full if full and partial are in agreement, balks if full and partial conflict. Returns full. Note: this is surprisingly similar to reconcile_options except that full is essentially empty and lacking in has_changed keys so presence is enough to satisfy has_changed. consider merging once mature.
-
muster_modelchem
(name, dertype)[source]¶ Transform calculation method name and derivative level dertype into options for cfour. While deliberately requested pieces, generally CFOUR_DERIV_LEVEL and CFOUR_CALC_LEVEL, are set to complain if contradicted (‘clobber’ set to True), other ‘recommended’ settings, like CFOUR_CC_PROGRAM, can be countermanded by keywords in input file (‘clobber’ set to False). Occasionally, want these pieces to actually overcome keywords in input file (‘superclobber’ set to True).
-
class
DB4
(pythonpath=None, loadfrompickle=False, path=None)[source]¶ -
-
make_pt2_Figure_2
()[source]¶ Plot all the graphics needed for the diffuse augmented grey bars plot in Fig. 2 of PT2.
-
-
class
Database
(dbnamelist, dbse=None, pythonpath=None, loadfrompickle=False, path=None)[source]¶ Collection for handling single or multiple qcdb.WrappedDatabase objects. Particularly, unifying modelchem and subset names that when inconsistent across component databases. Also, defining statistics across databases.
>>> asdf = qcdb.Database(['s22', 'Nbc10', 'hbc6', 'HSG'], 'DB4') >>> qwer = qcdb.Database(['s22'])
-
analyze_modelchems
(modelchem, benchmark='default', failoninc=True, verbose=False)[source]¶ For each component database, compute and print nicely formatted summary error statistics for each model chemistry in array modelchem versus benchmark for all available subsets.
-
compute_statistics
(modelchem, benchmark='default', sset='default', failoninc=True, verbose=False, returnindiv=False)[source]¶ Computes summary statistics and, if returnindiv True, individual errors for single model chemistry modelchem versus benchmark over subset sset over all component databases. Particularly, imposes cross-database definitions for sset and modelchem. #Returns error if model chemistries are missing #for any reaction in subset unless failoninc set to False, #whereupon returns partial statistics. Returns dictionary of #statistics labels and values.
-
dbdict
= None¶ ordered component Database objects
>>> print asdf.dbdict XXXX
-
dbse
= None¶ internal name of database collection
>>> print asdf.dbse 'DB4'
-
load_qcdata_byproject
(project, pythonpath=None)[source]¶ For each component database, loads qcdb.ReactionDatums from standard location for project :module dbse_project and function load_project. Module search path can be prepended with pythonpath.
-
load_qcdata_hdf5_trusted
(project, path=None)[source]¶ For each component database, loads qcdb.ReactionDatums from HDF5 file at path/dbse_project.h5 . If path not given, looks in qcdb/data. This file is written by reap-DB and so has been largely validated.
-
load_subsets
(modname='subsetgenerator', pythonpath=None)[source]¶ For each component database, loads subsets from all functions in module modname. Default modname usues standard generators.
-
mcs
= None¶ assembly pattern for transspecies modelchems
>>> print asdf.mcs.keys() XXXX
-
plot_all_flats
(modelchem=None, sset='default', xlimit=4.0, saveas=None, relpath=False, graphicsformat=['pdf'])[source]¶ Generate pieces for inclusion into tables. Supply list of modelchemistries to plot from modelchem, otherwise defaults to all those available. Can modify subset sset and plotting range xlimit.
>>>> asdf.plot_all_flats(sset=’tt-5min’, xlimit=4.0)
-
plot_bars
(modelchem, benchmark='default', sset=['default', 'hb', 'mx', 'dd'], failoninc=True, verbose=False, saveas=None, relpath=False, graphicsformat=['pdf'])[source]¶ Prepares ‘grey bars’ diagram for each model chemistry in array modelchem versus benchmark over all component databases. A wide bar is plotted with three smaller bars, corresponding to the ‘mae’ summary statistic of the four subsets in sset.
saveas conveys directory (‘/’) and/or filename for saving the resulting plot. File extension is not accessible, but graphicsformat array requests among ‘png’, ‘pdf’, and ‘eps’ formats. relpath forces paths to saved files to be relative to current directory, rather than absolute paths for returned code and file dictionary.
Prepares bars diagram instructions and either executes them if matplotlib available (Canopy or Anaconda) or prints them. Returns a dictionary of all saved plot filenames.
>>>> asdf.plot_bars([‘MP2-CP-adz’, ‘MP2-CP-adtz’], sset=[‘tt-5min’, ‘hb-5min’, ‘mx-5min’, ‘dd-5min’])
-
plot_disthist
(modelchem, benchmark='default', sset='default', failoninc=True, verbose=False, xtitle='', saveas=None, relpath=False, graphicsformat=['pdf'])[source]¶ Computes individual errors and summary statistics for single model chemistry modelchem versus benchmark over subset sset over all component databases. Computes histogram of errors and gaussian distribution.
saveas conveys directory (‘/’) and/or filename for saving the resulting plot. File extension is not accessible, but graphicsformat array requests among ‘png’, ‘pdf’, and ‘eps’ formats. relpath forces paths to saved files to be relative to current directory, rather than absolute paths for returned code and file dictionary.
Prepares disthist diagram instructions and either executes them if matplotlib available (Canopy or Anaconda) or prints them. Returns a dictionary of all saved plot filenames.
-
plot_flat
(modelchem, benchmark='default', sset='default', failoninc=True, verbose=False, color='sapt', xlimit=4.0, view=True, saveas=None, relpath=False, graphicsformat=['pdf'])[source]¶ Computes individual errors and summary statistics for single model chemistry modelchem versus benchmark over subset sset over all component databases. Thread color can be ‘rgb’ for old coloring, a color name or ‘sapt’ for spectrum coloring.
saveas conveys directory (‘/’) and/or filename for saving the resulting plot. File extension is not accessible, but graphicsformat array requests among ‘png’, ‘pdf’, and ‘eps’ formats. relpath forces paths to saved files to be relative to current directory, rather than absolute paths for returned code and file dictionary.
Prepares flat diagram instructions and either executes them if matplotlib available (Canopy or Anaconda) or prints them. Returns a dictionary of all saved plot filenames.
asdf.plot_flat(‘CCSD-CP-atqzadz’, failoninc=False)
-
plot_modelchems
(modelchem, benchmark='default', mbenchmark=None, sset='default', msset=None, failoninc=True, verbose=False, color='sapt', xlimit=4.0, saveas=None, mousetext=None, mouselink=None, mouseimag=None, mousetitle=None, relpath=False, graphicsformat=['pdf'])[source]¶ Computes individual errors and summary statistics over all component databases for each model chemistry in array modelchem versus benchmark over subset sset. mbenchmark and msset are array options (same length as modelchem) that override benchmark and sset, respectively, for non-uniform specification. Thread color can be ‘rgb’ for old coloring, a color name or ‘sapt’ for spectrum coloring.
saveas conveys directory (‘/’) and/or filename for saving the resulting plot. File extension is not accessible, but graphicsformat array requests among ‘png’, ‘pdf’, and ‘eps’ formats. relpath forces paths to saved files to be relative to current directory, rather than absolute paths for returned code and file dictionary.
Prepares thread diagram instructions and either executes them if matplotlib available (Canopy or Anaconda) or prints them. Returns a dictionary of all saved plot filenames. If any of mousetext, mouselink, or mouseimag is specified, htmlcode will be returned with an image map of slats to any of text, link, or image, respectively.
-
sset
= None¶ subset assembly pattern
>>> print asdf.sset.keys() XXXX
-
table_generic
(mtd, bas, columnplan, rowplan=['bas', 'mtd'], opt=['CP'], err=['mae'], sset=['tt'], benchmark='default', failoninc=True, landscape=False, standalone=True, subjoin=True, plotpath='', theme='', filename=None)[source]¶ Prepares dictionary of errors for all combinations of mtd, opt, bas with respect to model chemistry benchmark, mindful of failoninc. Once error dictionary is ready, it and all other arguments are passed along to textables.table_generic.
-
table_merge_abbr
(mtd, bas, opt=['CP'], err=['mae'], benchmark='default', failoninc=True, plotpath='analysis/flats/mplflat_', theme='smmerge')[source]¶ Specialization of table_generic into table with minimal statistics (three S22 and three overall) plus embedded slat diagram as suitable for main paper. A single table is formed in sections by bas with lines mtd within each section.
-
table_merge_suppmat
(mtd, bas, opt=['CP'], err=['mae'], benchmark='default', failoninc=True, plotpath='analysis/flats/mplflat_', theme='lgmerge')[source]¶ Specialization of table_generic into table with as many statistics as will fit (mostly fullcurve and a few 5min) plus embedded slat diagram as suitable for supplementary material. Multiple tables are formed, one for each in bas with lines mtd within each table.
-
-
class
ReactionDatum
(dbse, rxn, method, mode, basis, value, units='kcal/mol', comment=None)[source]¶ Piece of quantum chemical information that describes a qcdb.Reaction object.
-
class
Reagent
(name, mol, tagl=None, comment=None)[source]¶ Chemical entity only slightly dresed up from qcdb.Molecule.
-
class
WrappedDatabase
(dbname, pythonpath=None)[source]¶ Wrapper class for raw Psi4 database modules that does some validation of contents, creates member data and accessors for database structures, defines error computation, and handles database subsets. Not to be used directly– see qcdb.Database for handling single or multiple qdcb.WrappedDatabase objects and defining nice statistics, plotting, and table functionalities.
>>> asdf = qcdb.WrappedDatabase('Nbc10')
-
add_ReactionDatum
(dbse, rxn, method, mode, basis, value, units='kcal/mol', comment=None, overwrite=False)[source]¶ Add a new quantum chemical value to rxn by creating a qcdb.ReactionDatum from same arguments as that class’s object-less constructor. rxn may be actual Reaction.name or Reaction.indx.
-
add_Subset
(name, func)[source]¶ Define a new subset labeled name by providing a function func that filters self.hrxn.
-
available_modelchems
(union=True)[source]¶ Returns all the labels of model chemistries that have been loaded. Either all modelchems that have data for any reaction if union is True or all modelchems that have data for all reactions if union is False.
-
compute_errors
(modelchem, benchmark='default', sset='default', failoninc=True, verbose=False)[source]¶ For full database or subset sset, computes raw reaction errors between modelchem and benchmark model chemistries. Returns error if model chemistries are missing for any reaction in subset unless failoninc set to False, whereupon returns partial. Returns dictionary of reaction labels and error forms.
-
compute_statistics
(modelchem, benchmark='default', sset='default', failoninc=True, verbose=False, returnindiv=False)[source]¶ For full database or subset sset, computes many error statistics between single modelchem and benchmark model chemistries. Returns error if model chemistries are missing for any reaction in subset unless failoninc set to False, whereupon returns partial statistics. Returns dictionary of statistics labels and values.
-
dbse
= None¶ internal name of database
>>> print asdf.dbse 'NBC1'
-
hrgt
= None¶ dict of reagents/geometries
>>> print asdf.hrgt.keys() ['NBC1-BzBz_PD32-0.8-monoA-CP', 'NBC1-BzBz_PD34-0.6-dimer', ... 'NBC1-BzBz_PD34-1.7-dimer']
-
hrxn
= None¶ OrderedDict of reactions/members
>>> print asdf.hrxn.keys() ['BzBz_S-3.2', 'BzBz_S-3.3', ... 'BzBz_PD36-2.8', 'BzBz_PD36-3.0']
-
load_qcdata
(modname, funcname, pythonpath=None, failoninc=True)[source]¶ Loads qcdb.ReactionDatums from module modname function funcname. Module search path can be prepended with pythonpath.
-
load_qcdata_byproject
(project, pythonpath=None)[source]¶ Loads qcdb.ReactionDatums from standard location for project :module dbse_project and function load_project. Module search path can be prepended with pythonpath.
-
load_qcdata_hdf5_trusted
(project, path=None)[source]¶ Loads qcdb.ReactionDatums from HDF5 file at path/dbse_project.h5 . If path not given, looks in qcdb/data. This file is written by reap-DB and so has been largely validated.
-
load_subsets
(modname='subsetgenerator', pythonpath=None)[source]¶ Loads subsets from all functions in module modname.
-
plot_iowa
(modelchem, benchmark='default', sset='default', failoninc=True, verbose=False, xlimit=2.0)[source]¶ Computes individual errors for single modelchem versus benchmark over subset sset. Coloring green-to-purple with maximum intensity at xlimit. Prepares Iowa plot instructions and either executes them if matplotlib available (Canopy) or prints them.
-
sset
= None¶ dict of defined reaction subsets. Note that self.sset[‘default’] contains all the nonredundant information.
>>> print asdf.sset.keys() ['meme', 'mxddpp', '5min', ... 'small']
-
table_generic
(mtd, bas, columnplan, rowplan=['bas', 'mtd'], opt=['CP'], err=['mae'], sset=['default'], benchmark='default', failoninc=True, landscape=False, standalone=True, subjoin=True, plotpath='', theme='', filename=None)[source]¶ Prepares dictionary of errors for all combinations of mtd, opt, bas with respect to model chemistry benchmark, mindful of failoninc. Once error dictionary is ready, it and all other arguments are passed along to textables.table_generic.
-
table_simple1
(mtd, bas, opt=['CP'], err=['mae'], benchmark='default', failoninc=True, plotpath='analysis/flats/mplflat_', theme='smmerge')[source]¶ Specialization of table_generic into table with minimal statistics (three S22 and three overall) plus embedded slat diagram as suitable for main paper. A single table is formed in sections by bas with lines mtd within each section.
-
table_simple2
(mtd, bas, opt=['CP'], err=['mae'], benchmark='default', failoninc=True, plotpath='analysis/flats/mplflat_', theme='smmerge')[source]¶ Specialization of table_generic into table with minimal statistics (three S22 and three overall) plus embedded slat diagram as suitable for main paper. A single table is formed in sections by bas with lines mtd within each section.
-
table_simple3
(mtd, bas, opt=['CP'], err=['mae'], benchmark='default', failoninc=True, plotpath='analysis/flats/mplflat_', theme='smmerge')[source]¶ Specialization of table_generic into table with minimal statistics (three S22 and three overall) plus embedded slat diagram as suitable for main paper. A single table is formed in sections by bas with lines mtd within each section.
-
table_simple4
(mtd, bas, opt=['CP'], err=['mae'], benchmark='default', failoninc=True, plotpath='analysis/flats/mplflat_', theme='smmerge')[source]¶ Specialization of table_generic into table with minimal statistics (three S22 and three overall) plus embedded slat diagram as suitable for main paper. A single table is formed in sections by bas with lines mtd within each section.
-
-
average_errors
(*args)[source]¶ Each item in args should be an error dictionary. Performs average-like operation over all items, which should be error dictionaries, in args. Defined for ME, MAE, STDE, and their relative-error variants. None returned for undefined statistics or when an item is missing.
-
format_errors
(err, mode=1)[source]¶ From error dictionary err, returns a LaTeX-formatted string, after handling None entries.
-
string_contrast
(ss)[source]¶ From an array of strings, ss, returns maximum common prefix string, maximum common suffix string, and array of middles.
Module with commands building BasisFamily
objects
for Pople and other non-Dunning orbital basis sets. Some
plausible fitting basis sets are supplied as defaults.
Module to define a class BasisFamily
that associates
fitting basis sets to an orbital basis and to provide functions to
query appropriate fitting bases for any orbital basis distributed
with Psi4.
-
class
BasisFamily
(ornate, orbital=None)[source]¶ Class to associate with an orbital basis name ornate the gbs file names in which the orbital basis orbital (usually the coded form of ornate) and jfit, jkfit, rifit, and dualfit auxiliary bases can be found.
-
add_dualfit
(fit)[source]¶ Function to add basis fit as associated helper basis member dualfit to a BasisFamily object.
-
add_jfit
(fit)[source]¶ Function to add basis fit as associated fitting basis member jfit to a BasisFamily object.
-
add_jfit_default
(fit)[source]¶ Function to add basis fit as associated fitting basis member jdef to a BasisFamily object.
-
add_jkfit
(fit)[source]¶ Function to add basis fit as associated fitting basis member jkfit to a BasisFamily object.
-
add_jkfit_default
(fit)[source]¶ Function to add basis fit as associated fitting basis member jkdef to a BasisFamily object.
-
add_rifit
(fit)[source]¶ Function to add basis fit as associated fitting basis member rifit to a BasisFamily object.
-
-
corresponding_basis
(name, role='BASIS')[source]¶ Function to validate if the orbital basis name in coded or ornate form is in Psi4’s standard installed bases list.
None
is returned if the orbital basis is not found.
-
load_basis_families
()[source]¶ Function to load into the array
basisfamily_list
BasisFamily objects for all Psi4’s standard installed bases.
-
print_basis_families
()[source]¶ Function to print to the output file a formatted summary of all the BasisFamily objects in
basisfamily_list
, by default all Psi4’s standard installed bases.
-
sanitize_basisname
(name)[source]¶ Function to return name in coded form, stripped of characters that confuse filenames, characters into lowercase,
+
intop
,*
intos
, and(
,)
, &,
into_
.
Module to hold and distribute the -D dispersion correction parameters.
-
dash_server
(func, dashlvl, mode='psi4')[source]¶ Function to serve up dispersion correction parameters in whatever form needed. When mode is ‘dftd3’, returns a string suitable for writing to ./dftd3_parameters to calculuate the correction at dashlvl with the default parameters for functional func. When mode is ‘psi4’, returns a tuple of arguments suitable for building a Dispersion object with dashlvl parameters for functional func.
There are four computational dashlvl choices. ‘d2p4’ calls the -D2 correction within psi4 (hence, faked for mode=’dftd3’). The other three, ‘d2gr’, ‘d3zero’, and ‘d3bj’ call the three dftd3 modes of operation (corresponding to -old, -zero, -bj). Additionally, there are three aliased dashlvl choices since the aliases in dash_alias above are imposed.
Module (auto-generated from make_dunning.pl script)
with commands building BasisFamily
objects that
encode the Dunning basis set orbital definitions in
psi4/lib/basis/NOTES and fitting bases designed for those
orbital bases.
-
backtransform
(chgeMol, permMol, chgeGrad=None, chgeDip=None)[source]¶ Here, chgeMol and chgeGrd need to be turned into the native Cfour orientation embodied by permMol. Currently for vpt2.
-
cfour_gradient_list
()[source]¶ Return an array of Cfour methods with analytical gradients. Appended to procedures[‘gradient’].
-
cfour_list
()[source]¶ Return an array of Cfour methods with energies. Appended to procedures[‘energy’].
-
cfour_psivar_list
()[source]¶ Return a dict with keys of most Cfour methods and values of dicts with the PSI Variables returned by those methods. Used by cbs() wrapper to avoid unnecessary computations in compound methods. Result is appended to
VARH
.
-
format_fjobarc
(energy, map, elem, coordinates, gradient, dipole)[source]¶ Takes the key results from a gradient computation (energy, element Z list elem, coordinates, gradient, dipole, and atom ordering map) and writes a string fja that exactly mimics the contents of a Cfour FJOBARC file.
-
harvest
(p4Mol, c4out, **largs)[source]¶ Parses all the pieces of output from Cfour: the stdout in c4out and the contents of various scratch files like GRD stored in their namesake keys in largs. Since all Cfour output uses its own orientation and atom ordering for the given molecule, a qcdb.Molecule p4Mol, if supplied, is used to transform the Cfour output back into consistency with p4Mol.
-
harvest_DIPOL
(dipol)[source]¶ Parses the contents dipol of the Cfour DIPOL file into a dipol vector.
-
harvest_GRD
(grd)[source]¶ Parses the contents grd of the Cfour GRD file into the gradient array and coordinate information. The coordinate info is converted into a rather dinky Molecule (no charge, multiplicity, or fragment), but this is these coordinates that govern the reading of molecule orientation by Cfour. Return qcdb.Molecule and gradient array.
-
harvest_outfile_pass
(outtext)[source]¶ Function to read CFOUR output file outtext and parse important quantum chemical information from it in
-
harvest_output
(outtext)[source]¶ Function to separate portions of a CFOUR output file outtest, divided by xjoda.
-
harvest_zmat
(zmat)[source]¶ Parses the contents of the Cfour ZMAT file into array and coordinate information. The coordinate info is converted into a rather dinky Molecule (no fragment, but does read charge, mult, unit). Return qcdb.Molecule. Written for findif zmat* where geometry always Cartesian and Bohr.
-
jajo2mol
(jajodic)[source]¶ Returns a Molecule from entries in dictionary jajodic extracted from JAINDX and JOBARC.
-
muster_modelchem
(name, dertype)[source]¶ Transform calculation method name and derivative level dertype into options for cfour. While deliberately requested pieces, generally CFOUR_DERIV_LEVEL and CFOUR_CALC_LEVEL, are set to complain if contradicted (‘clobber’ set to True), other ‘recommended’ settings, like CFOUR_CC_PROGRAM, can be countermanded by keywords in input file (‘clobber’ set to False). Occasionally, want these pieces to actually overcome keywords in input file (‘superclobber’ set to True).
-
muster_psi4options
(opt)[source]¶ Translate psi4 keywords opt that have been explicitly set into their Cfour counterparts. Since explicitly set Cfour module keyword values will always be used preferentially to these inferred from psi4, the ‘clobber’ property is set to False.
Elemental masses (most common isotope), symbols, and atomic numbers from psi4.
-
class
OrientMols
(molPermanent, molChangeable)[source]¶ Class to encode a transformation between two molecular coordinate systems. After initializing with two qcdb.Molecule objects at the same geometry in possible different frames and orderings, class can apply the appropriate transformations to coordinate, gradient, Hessian, etc. arrays.
-
create_orientation_from_molecules
(Pmol, Cmol)[source]¶ Finds the shift, rotation, axis exchange, axis inversion, and atom remapping necessary to bring the geometry of Cmol into coincidence with the geometry of Pmol. Pmol and Cmol must be
qcdb.Molecule
and represent the same geometry. Presently catches some errors of orientation that Cfour as Cmol should properly fulfill. These are unnecessary restrictions and can be relaxed later.
-
transform_elementlist
(elem)[source]¶ Applies to elem the transformation appropriate to bring a list of atomic numbers in molChangeable orientation into molPermanent orientation. In particular, applies a row exchange to place it in the atom ordering.
-
transform_gradient
(arr)[source]¶ Applies to arr the transformation appropriate to bring a gradient in molChangeable orientation into molPermanent orientation. In particular, applies a rotation to place it in the inertial frame, a column exchange and phasing to place it in the axis system, a row exchange to place it in the atom ordering, and a rotation to remove it from the inertial frame.
-
transform_vector
(vec)[source]¶ Applies to vec the transformation appropriate to bring a vector in molChangeable orientation into molPermanent orientation. In particular, applies a rotation to place it in the inertial frame, a column exchange and phasing to place it in the axis system, and a rotation to remove it from the inertial frame.
-
-
class
Gaussian94BasisSetParser
(forced_puream=None)[source]¶ Class for parsing basis sets from a text file in Gaussian 94 format. Translated directly from the Psi4 libmints class written by Justin M. Turney and Andrew C. Simmonett.
Class to
-
class
GaussianShell
(am, nprimitive, oc, c, ec, e, pure, nc, center, start)[source]¶ Class with same information as
ShellInfo
. In C++, class uses more efficient data structures, but in Python differences minimal.
-
INT_CARTINDEX
(am, i, j)[source]¶ Computes offset index for cartesian function. #define INT_CARTINDEX(am,i,j) (((i) == (am))? 0 : (((((am) - (i) + 1)*((am) - (i)))>>1) + (am) - (i) - (j)))
-
INT_ICART
(a, b, c)[source]¶ Given a, b, and c compute a cartesian offset. #define INT_ICART(a, b, c) (((((((a)+(b)+(c)+1)<<1)-(a))*((a)+1))>>1)-(b)-1)
-
INT_IPURE
(l, m)[source]¶ Given l and m compute a pure function offset. #define INT_IPURE(l, m) ((l)+(m))
-
INT_NCART
(am)[source]¶ Gives the number of cartesian functions for an angular momentum. define INT_NCART(am) ((am>=0) ? ((((am)+2)*((am)+1))>>1) : 0)
-
INT_NFUNC
(pu, am)[source]¶ Gives the number of functions for an angular momentum based on pu. #define INT_NFUNC(pu,am) ((pu)?INT_NPURE(am):INT_NCART(am))
-
INT_NPURE
(am)[source]¶ Gives the number of spherical functions for an angular momentum. #define INT_NPURE(am) (2*(am)+1)
-
class
ShellInfo
(am, c, e, pure, nc, center, start, pt='Normalized')[source]¶ This class has the same behavior as GaussianShell, but implements everything using slower data structures, which are easier to construct. These are used to build the basis set, which builds more efficient pointer-based GaussianShell objects. * @param e An array of exponent values. * @param am Angular momentum. * @param pure Pure spherical harmonics, or Cartesian. * @param c An array of contraction coefficients. * @param nc The atomic center that this shell is located on. Must map
back to the correct atom in the owning BasisSet molecule_. Used in integral derivatives for indexing.- @param center The x, y, z position of the shell. This is passed to
reduce the number of calls to the molecule.
- @param start The starting index of the first function this shell
provides. Used to provide starting positions in matrices.
@param pt Is the shell already normalized?
-
AMCHAR
()[source]¶ The character symbol for the angular momentum of the given contraction (upper case)
-
contraction_normalization
()[source]¶ Normalizes an entire contraction set. Applies the normalization to the coefficients * @param gs The contraction set to normalize.
-
ncenter
()[source]¶ Returns the atom number this shell is on. Used by integral derivatives for indexing.
-
normalize_shell
()[source]¶ Handles calling primitive_normalization and contraction_normalization for you.
Stuff stolen from psi. Should import or not as necessary or some better way. Apologies to the coders.
-
all_casings
(input_string)[source]¶ Function to return a generator of all lettercase permutations of input_string.
-
compare_integers
(expected, computed, label)[source]¶ Function to compare two integers. Prints
util.success()
when value computed matches value expected. Performs a system exit on failure. Used in input files in the test suite.
-
compare_matrices
(expected, computed, digits, label)[source]¶ Function to compare two matrices. Prints
util.success()
when elements of matrix computed match elements of matrix expected to number of digits. Performs a system exit on failure to match symmetry structure, dimensions, or element values. Used in input files in the test suite.
-
compare_strings
(expected, computed, label)[source]¶ Function to compare two strings. Prints
util.success()
when string computed exactly matches string expected. Performs a system exit on failure. Used in input files in the test suite.
-
compare_values
(expected, computed, digits, label)[source]¶ Function to compare two values. Prints
util.success()
when value computed matches value expected to number of digits (or to digits itself when digits > 1 e.g. digits=0.04). Performs a system exit on failure. Used in input files in the test suite.
-
drop_duplicates
(seq)[source]¶ Function that given an array seq, returns an array without any duplicate entries. There is no guarantee of which duplicate entry is dropped.
-
getattr_ignorecase
(module, attr)[source]¶ Function to extract attribute attr from module if attr is available in any possible lettercase permutation. Returns attribute if available, None if not.
-
import_ignorecase
(module)[source]¶ Function to import module in any possible lettercase permutation. Returns module object if available, None if not.
-
query_yes_no
(question, default=True)[source]¶ Ask a yes/no question via raw_input() and return their answer.
question is a string that is presented to the user. default is the presumed answer if the user just hits <Enter>. It must be yes (the default), no or None (meaning an answer is required of the user).
The return value is one of True or False.
-
search_file
(filename, search_path)[source]¶ Given an os.pathsep divided search_path, find first occurance of filename. Returns full path to file if found or None if unfound.
Module to largely replicate in python the psi4 libmints CoordValue and CoordEntry classes, which were developed by Justin M. Turney, with incremental improvements by other psi4 developers.
-
class
CartesianEntry
(entry_number, Z, charge, mass, symbol, label, x, y, z, basis=None, shells=None)[source]¶ Class to hold all information about an atom, including its coordinate specification as three Cartesians.
-
compute
()[source]¶ Computes the values of the coordinates (in whichever units were inputted), returning them in a Vector
-
print_in_input_format_cfour
()[source]¶ Prints the updated geometry, in the format provided by the user. This, for Cfour, not different from regular version.
-
-
class
CoordEntry
(entry_number, Z, charge, mass, symbol, label='', basis=None, shells=None)[source]¶ Class to store all the attributes associated with an atom, not the larger Molecule. Specialized into CartesianEntry and ZMatrixEntry.
-
basisset
(role='BASIS')[source]¶ Returns the basis name for the provided type. * @param type Keyword from input file. * @returns the value from input.
-
is_equivalent_to
(other)[source]¶ Whether this atom has the same mass and ghost status as atom other. Also compares basis set assignment down to nbf(), has_puream() level with code borrowed from Robert M. Parrish’s SAD guess in Psi4.
-
set_basisset
(name, role='BASIS')[source]¶ Set the basis for this atom * @param type Keyword from input file, basis, ri_basis, etc. * @param name Value from input file
-
set_shell
(bshash, key='BASIS')[source]¶ Set the hash for this atom * @param key Keyword from input file, basis, ri_basis, etc. * @param bshash hash string of one-atom BasisSet
-
-
class
CoordValue
(fixed=False, computed=False)[source]¶ An abstract class to handle storage of Cartesian coordinate values, which may be defined in terms of other variables through this mechanism, greatly simplifying Z-matrix specification, for example.
-
class
NumberValue
(value, fixed=False)[source]¶ Specialization of CoordValue that is simply a number to be stored.
-
class
VariableValue
(name, geometryVariables, negate=False, fixed=False)[source]¶ Specialization of CoordValue, where the current value depends on the list of geometry values stored by the molecule.
-
class
ZMatrixEntry
(entry_number, Z, charge, mass, symbol, label, rto=None, rval=0, ato=None, aval=0, dto=None, dval=0, basis=None, shells=None)[source]¶ Class to hold all information about an atom, including its coordinate specification as any position of ZMatrix.
-
print_in_input_format_cfour
()[source]¶ Prints the updated geometry, in the format provided by the user
-
-
class
OrderedDict
(*args, **kwds)[source]¶ Dictionary that remembers insertion order
-
classmethod
fromkeys
(S[, v]) → New ordered dictionary with keys from S[source]¶ and values equal to v (which defaults to None).
-
pop
(k[, d]) → v, remove specified key and return the corresponding value.[source]¶ If key is not found, d is returned if given, otherwise KeyError is raised.
-
popitem
() → (k, v), return and remove a (key, value) pair.[source]¶ Pairs are returned in LIFO order if last is true or FIFO order if false.
-
update
(E, **F) → None. Update od from dict/iterable E and F.[source]¶ If E is a dict instance, does: for k in E: od[k] = E[k] If E has a .keys() method, does: for k in E.keys(): od[k] = E[k] Or if E is an iterable of items, does: for k, v in E: od[k] = v In either case, this is followed by: for k, v in F.items(): od[k] = v
-
classmethod
-
class
MolproIn
(mem, mtd, bas, mol, sys, cast)[source]¶ -
format_basis
()¶
-
format_global_parameters
()¶
-
format_infile_string
()¶
-
-
getrec
(reclabelarray, verbose=False)[source]¶ Reads binary files JOBARC and JAINDX and returns contents of each record in reclabelarray.
Module to facilitate quantum chemical computations on chemical databases. Contains Molecule class and physical constants from psi4 suite.
File to
-
drop_duplicates
(seq)[source]¶ Function that given an array or array of arrays seq, returns an array without any duplicate entries. There is no guarantee of which duplicate entry is dropped.
-
class
PreservingDict
(*args, **kwargs)[source]¶ Class to store quantum chemical quantities extracted from output files. Extends the dictionary object to (1) store key as all-caps version of itself and (2) validate value for duplicate values for the same key by testing which has more decimal places and whether value the same within a plausing rounding error. Allows consistency checks when parsing output files without loss of precision.
Module containing functions that, when passed a qcdb.Database instance dbinstance, return an array of reaction names that are a subset of dbinstance.hrxn.keys(). Since the full database is passed in, reactions can be filtered by molecule characteristics, reaction names, existing subsets, etc. The official name of the subset is specified by the function docstring.
-
class
BasisSet
(*args)[source]¶ Basis set container class Reads the basis set from a checkpoint file object. Also reads the molecule from the checkpoint file storing the information in an internal Molecule class which can be accessed using molecule().
-
LIBINT_MAX_AM
= 6¶
-
add
(b)[source]¶ Adds this plus another basis set and returns the result. Equivalent to the ‘+’ operator. Appears defunct.
-
atomic_basis_set
(center)[source]¶ Return a BasisSet object containing all shells at center i (0-index) * Used for Atomic HF computations for SAD Guesses * @param center Atomic center to provide a basis object for. * @returns A new basis set object for the atomic center.
-
static
build
(molecule, shells)[source]¶ Builder factory method * @param molecule the molecule to build the BasisSet around * @param shells array of atom-numbered GaussianShells to build the BasisSet from * @return BasisSet corresponding to this molecule and set of shells
-
concatenate
(b)[source]¶ Concatenates two basis sets together into a new basis without reordering anything. Unless you know what you’re doing, you should use the ‘+’ operator instead of this method. Appears defunct.
-
classmethod
construct
(parser, mol, role, deffit=None, basstrings=None)[source]¶ Returns a new BasisSet object configured from the mol Molecule object for role (generally a Psi4 keyword: BASIS, DF_BASIS_SCF, etc.). Fails utterly if a basis has not been set for role for every atom in mol, unless deffit is set (JFIT, JKFIT, or RIFIT), whereupon empty atoms are assigned to role from the
BasisFamily
. This function is significantly re-worked from its libmints analog.
-
constructor_basisset_center
(bs, center)[source]¶ - Creates a new basis set object for an atom, from an existing basis set
- bs: the basis set to copy data from
- center: the atom in bs to copy over
-
constructor_role_mol_shellmap
(role, mol, shell_map)[source]¶ The most commonly used constructor. Extracts basis set name for role from each atom of mol, looks up basis and role entries in the shell_map dictionary, retrieves the GaussianShell objects and returns the BasisSet.
-
exp_ao
= [[], [], [], [], [], []]¶
-
export_for_libmints
(role)[source]¶ From complete BasisSet object, returns array where triplets of elements are each unique atom label, the hash of the string shells entry in gbs format and the shells entry in gbs format for that label. This packaging is intended for return to libmints BasisSet::pyconstruct for instantiation of a libmints BasisSet clone of self.
-
function_to_center
(i)[source]¶ Given a function what is its atomic center * @param i Function number * @return The atomic center for the i’th function.
-
initialize_singletons
()[source]¶ Initialize singleton values that are shared by all basis set objects.
-
l
= 5¶
-
static
make_filename
(name)[source]¶ Converts basis set name to a compatible filename. * @param basisname Basis name * @return Compatible file name.
-
max_am
()[source]¶ Maximum angular momentum used in the basis set. * @return Maximum angular momentum.
-
max_function_per_shell
()[source]¶ Compute the maximum number of basis functions contained in a shell. * @return The max number of basis functions in a shell.
-
max_nprimitive
()[source]¶ Maximum number of primitives in a shell. * Examines each shell and find the shell with the maximum number of primitives returns that * number of primitives. * @return Maximum number of primitives.
-
molecule
()[source]¶ Molecule this basis is for. * @return Shared pointer to the molecule for this basis set.
-
nao
()[source]¶ Number of atomic orbitals (Cartesian). * @return The number of atomic orbitals (Cartesian orbitals, always).
-
nbf
()[source]¶ Number of basis functions (Spherical). * @return The number of basis functions (Spherical, if has_puream() == true).
-
nprimitive
()[source]¶ Number of primitives. * @return The total number of primitives in all contractions.
-
print_by_level
(out=None, level=2)[source]¶ Print basis set information according to the level of detail in print_level * @param out The file stream to use for printing. Defaults to outfile. * @param print_level: < 1: Nothing
1: Brief summary 2: Summary and contraction details> 2: Full details Defaults to 2
-
print_detail
(out=None, numbersonly=False)[source]¶ Prints a detailed PSI3-style summary of the basis (per-atom) * @param out The file stream to use for printing. Defaults to outfile.
-
print_detail_cfour
(out=None)[source]¶ Returns a string in CFOUR-style of the basis (per-atom) * Format from http://slater.chemie.uni-mainz.de/cfour/index.php?n=Main.OldFormatOfAnEntryInTheGENBASFile
-
print_summary
(out=None)[source]¶ Prints a short string summarizing the basis set * @param out The file stream to use for printing. Defaults to outfile.
-
static
pyconstruct
(mol, key, target, fitrole='BASIS', other=None)[source]¶ Builds a BasisSet object for mol (either a qcdb.Molecule or a string that can be instantiated into one) from basis set specifications passed in as python functions or as a string that names a basis to be applied to all atoms. Always required is the keyword key and string/function target of the basis to be constructed. For orbital basis sets, key will likely be ‘BASIS’ and, together with target, these arguments suffice.
pyconstruct(smol, “BASIS”, basisspec_psi4_yo_631pg_d_p_) pyconstruct(mol, “BASIS”, “6-31+G**”)When building an auxiliary basis, key is again the keyword, target is the string or function for the fitting basis (this may also be an empty string). In case the fitting basis isn’t fully specified, also provide a fitrole and the string/function of the orbital basis as other, so that orbital hints can be used to look up a suitable default basis in BasisFamily.
pyconstruct(smol, “DF_BASIS_MP2”, basisspec_psi4_yo_ccpvdzri, ‘RIFIT’, basisspec_psi4_yo_631pg_d_p_) pyconstruct(mol, “DF_BASIS_MP2”, “”, “RIFIT”, “6-31+G(d,p)”)
-
pyprint
(out=None)[source]¶ Print the basis set. * @param out The file stream to use for printing. Defaults to outfile.
-
refresh
()[source]¶ Refresh internal basis set data. Useful if someone has pushed to shells_. Pushing to shells_ happens in the BasisSetParsers, so the parsers will call refresh(). This function is now defunct.
-
shell
(si, center=None)[source]¶ Return the si’th Gaussian shell on center * @param i Shell number * @return A shared pointer to the GaussianShell object for the i’th shell.
-
shell_to_ao_function
(i)[source]¶ Given a shell what is its first AO function * @param i Shell number * @return The function number for the first function for the i’th shell.
-
shell_to_basis_function
(i)[source]¶ Given a shell what is its first basis function (spherical) function * @param i Shell number * @return The function number for the first function for the i’th shell.
-
shell_to_center
(i)[source]¶ Given a shell what is its atomic center * @param i Shell number * @return The atomic center for the i’th shell.
-
static
test_basis_set
(max_am)[source]¶ Returns a shell-labeled test basis set object * @param max_am maximum angular momentum to build * @return pair containing shell labels and four-center * test basis for use in benchmarking * See libmints/benchmark.cc for details The libmints version seems not to have been updated along with the classes.
-
File for accessory procedures in the chem module. Credit for the libmints vector3 class to Justin M. Turney and incremental improvements by other psi4 developers.
Module with non-generic exceptions classes.
-
exception
FeatureNotImplemented
(msg)[source]¶ Error called for functions defined but not yet implemented. Also for functions defined that will never be implemented.
-
exception
FragmentCountError
(msg)[source]¶ Error called molecule has wrong number of fragments for method. Prints error message msg to standard output stream.
-
exception
IncompleteAtomError
(msg)[source]¶ Error raised when not all variables in an atom specification have been defined at compute time. May be a temporary situation so message not printed but appears as traceback when error persists.
-
exception
ParsingValidationError
(msg)[source]¶ Error called for problems with syntax from a QC output file. Prints error message msg to standard output stream.
-
exception
ValidationError
(msg)[source]¶ Error called for problems with syntax input file. Prints error message msg to standard output stream.
-
class
Molecule
(psi4molstr=None)[source]¶ Class to store python extensions to the MoleculeLibmints class. Multiple classes allows separation of libmints and extension methods.
-
BFS
()[source]¶ Perform a breadth-first search (BFS) on the real atoms in molecule, returning an array of atom indices of fragments. Relies upon van der Waals radii and so faulty for close (esp. hydrogen-bonded) fragments. Original code from Michael S. Marshall.
-
auto_fragments
()[source]¶ Detects fragments in an unfragmented molecule using BFS algorithm. Returns a new Molecule in Cartesian, fixed-geom (no variable values), no dummy-atom format. Any non-default charge and multiplicity assigned to first fragment.
-
center_of_charge
()[source]¶ Computes center of charge of molecule (does not translate molecule).
>>> H2OH2O.center_of_charge() [-0.073339893272065401, 0.002959783555632145, 0.0]
-
format_basis_for_cfour
(puream)[source]¶ Function to print the BASIS=SPECIAL block for Cfour according to the active atoms in Molecule. Special short basis names are used by Psi4 libmints GENBAS-writer in accordance with Cfour constraints.
-
format_molecule_for_cfour_old
()[source]¶ Function to print Molecule in a form readable by Cfour. This version works as long as zmat is composed entirely of variables, not internal values, while cartesian is all internal values, no variables. Cutting off this line of development because, with getting molecules after passing through libmints Molecule, all zmats with dummies (Cfour’s favorite kind) have already been converted into cartesian. Next step, if this line was pursued would be to shift any zmat internal values to external and any cartesian external values to internal.
-
inertia_tensor
(masswt=True, zero=1e-14)[source]¶ Compute inertia tensor.
>>> print H2OH2O.inertia_tensor() [[8.704574864178731, -8.828375721817082, 0.0], [-8.828375721817082, 280.82861714077666, 0.0], [0.0, 0.0, 281.249500988553]]
-
inertia_tensor_partial
(part, masswt=True, zero=1e-14)[source]¶ Compute inertia tensor based on atoms in part.
-
inertial_system_partial
(part, masswt=True, zero=1e-14)[source]¶ Solve inertial system based on atoms in part
-
classmethod
init_with_xyz
(xyzfilename, no_com=False, no_reorient=False, contentsNotFilename=False)[source]¶ Pull information from an XYZ file. No fragment info detected. Bohr/Angstrom pulled from first line if available. Charge, multiplicity, tagline pulled from second line if available. Body accepts atom symbol or atom charge in first column. Arguments no_com and no_reorient can be used to turn off shift and rotation. If xyzfilename is a string of the contents of an XYZ file, rather than the name of a file, set contentsNotFilename to
True
.>>> H2O = qcdb.Molecule.init_with_xyz('h2o.xyz')
-
run_dftd3
(func=None, dashlvl=None, dashparam=None, dertype=None)¶ Function to call Grimme’s dftd3 program (http://toc.uni-muenster.de/DFTD3/) to compute the -D correction of level dashlvl using parameters for the functional func. The dictionary dashparam can be used to supply a full set of dispersion parameters in the absense of func or to supply individual overrides in the presence of func. Returns energy if dertype is 0, gradient if dertype is 1, else tuple of energy and gradient if dertype unspecified. The dftd3 executable must be independently compiled and found in
PATH
orPSIPATH
.
-
save_string_xyz
(save_ghosts=True)[source]¶ Save a string for a XYZ-style file.
>>> H2OH2O.save_string_xyz() 6 -2 3 water_dimer O -1.551007000000 -0.114520000000 0.000000000000 H -1.934259000000 0.762503000000 0.000000000000 H -0.599677000000 0.040712000000 0.000000000000 O 1.350625000000 0.111469000000 0.000000000000 H 1.680398000000 -0.373741000000 -0.758561000000 H 1.680398000000 -0.373741000000 0.758561000000
-
Parent classes for quantum chemistry program input and output file formats.
-
class
InputFormat
(mem, mtd, bas, mol, sys, cast)[source]¶ -
corresponding_aux_basis
()¶ For Dunning basis sets, returns strings from which auxiliary basis sets and heavy-aug can be constructed. Note that valence/core-valence/etc. is conserved and X-zeta/(X+d)zeta is not, since this is the usual aux basis pattern. augbasis is round up to the nearest aug-cc-pVXZ rootbasis is round down to the nearest cc-pVXZ auxbasis is round up to the nearest cc-pVXZ or aug-cc-pVXZ
-
-
class
InputFormat2
(mem, mol, mtd, der, opt)[source]¶ -
corresponding_aux_basis
()¶ For Dunning basis sets, returns strings from which auxiliary basis sets and heavy-aug can be constructed. Note that valence/core-valence/etc. is conserved and X-zeta/(X+d)zeta is not, since this is the usual aux basis pattern. augbasis is round up to the nearest aug-cc-pVXZ rootbasis is round down to the nearest cc-pVXZ auxbasis is round up to the nearest cc-pVXZ or aug-cc-pVXZ
-
-
table_generic
(dbse, serrors, mtd, bas, columnplan, rowplan=['bas', 'mtd'], opt=['CP'], err=['mae'], sset=['default'], landscape=False, standalone=True, subjoin=True, plotpath='', theme='', filename=None)[source]¶ Arrays mtd and bas contain the keys to the qcdb.Method and qcdb.BasisSet objects that span all those that the table may encompass. If method and basis are to be scanned over, the arrays should be in the desired order.
Module with matplotlib plotting routines. These are not hooked up to any particular qcdb data structures but can be called with basic arguments.
-
bars
(data, title='', saveas=None, relpath=False, graphicsformat=['pdf'])[source]¶ Generates a ‘gray-bars’ diagram between model chemistries with error statistics in list data, which is supplied as part of the dictionary for each participating bar/modelchem, along with mc keys in argument data. The plot is labeled with title and each bar with mc key and plotted at a fixed scale to facilitate comparison across projects.
-
composition_tile
(db, aa1, aa2)[source]¶ Takes dictionary db of label, error pairs and amino acids aa1 and aa2 and returns a square array of all errors for that amino acid pair, buffered by zeros.
-
disthist
(data, title='', xtitle='', xmin=None, xmax=None, me=None, stde=None, saveas=None, relpath=False, graphicsformat=['pdf'])[source]¶ Saves a plot with name saveas with a histogram representation of the reaction errors in data. Also plots a gaussian distribution with mean me and standard deviation stde. Plot has x-range xmin to xmax, x-axis label xtitle and overall title title.
-
expand_saveas
(saveas, def_filename, def_path='/build/psi4-FsTMhA/psi4-0.3/builddir/doc/sphinxman', def_prefix='', relpath=False)[source]¶ Analyzes string saveas to see if it contains information on path to save file, name to save file, both or neither (saveas ends in ‘/’ to indicate directory only) (able to expand ‘.’). A full absolute filename is returned, lacking only file extension. Based on analysis of missing parts of saveas, path information from def_path and/or filename information from def_prefix + def_filename is inserted. def_prefix is intended to be something like ‘mplthread_‘ to identify the type of figure.
-
flat
(data, color=None, title='', xlimit=4.0, mae=None, mape=None, view=True, saveas=None, relpath=False, graphicsformat=['pdf'])[source]¶ Generates a slat diagram between model chemistries with errors in single-item list data, which is supplied as part of the dictionary for each participating reaction, along with dbse and rxn keys in argument data. Limits of plot are xlimit from the zero-line. If color is None, slats are black, if ‘sapt’, colors are taken from sapt_colors module. Summary statistic mae is plotted on the overbound side and relative statistic mape on the underbound side. Saves a file with name title and plots to screen if view.
-
iowa
(mcdat, mclbl, title='', xlimit=2.0)[source]¶ Saves a plot with (extensionless) name pltfile with an Iowa representation of the modelchems errors in mcdat for BBI/SSI-style labels.
-
segment_color
(argcolor, saptcolor)[source]¶ Find appropriate color expression between overall color directive argcolor and particular color availibility rxncolor.
-
threads
(data, labels, color=None, title='', xlimit=4.0, mae=None, mape=None, mousetext=None, mouselink=None, mouseimag=None, mousetitle=None, saveas=None, relpath=False, graphicsformat=['pdf'])[source]¶ Generates a tiered slat diagram between model chemistries with errors (or simply values) in list data, which is supplied as part of the dictionary for each participating reaction, along with dbse and rxn keys in argument data. The plot is labeled with title and each tier with an element of labels and plotted at xlimit from the zero-line. If color is None, slats are black, if ‘sapt’, colors are taken from color key in data [0, 1]. Summary statistics mae are plotted on the overbound side and relative statistics mape on the underbound side. HTML code for mouseover if mousetext or mouselink or mouseimag specified based on recipe of Andrew Dalke from http://www.dalkescientific.com/writings/diary/archive/2005/04/24/interactive_html.html
Module with functions that interface with Grimme’s DFTD3 code.
-
run_dftd3
(self, func=None, dashlvl=None, dashparam=None, dertype=None)[source]¶ Function to call Grimme’s dftd3 program (http://toc.uni-muenster.de/DFTD3/) to compute the -D correction of level dashlvl using parameters for the functional func. The dictionary dashparam can be used to supply a full set of dispersion parameters in the absense of func or to supply individual overrides in the presence of func. Returns energy if dertype is 0, gradient if dertype is 1, else tuple of energy and gradient if dertype unspecified. The dftd3 executable must be independently compiled and found in
PATH
orPSIPATH
.
p4util¶
Module with commands building BasisFamily
objects
for Pople and other non-Dunning orbital basis sets. Some
plausible fitting basis sets are supplied as defaults.
Module to define a class BasisFamily
that associates
fitting basis sets to an orbital basis and to provide functions to
query appropriate fitting bases for any orbital basis distributed
with Psi4.
-
class
BasisFamily
(ornate, orbital=None, jk=None, ri=None, dual=None)[source]¶ Class to associate with an orbital basis name ornate the gbs file names in which the orbital basis orbital (usually the coded form of ornate) and jfit, jkfit, rifit, and dualfit auxiliary bases can be found.
-
add_dualfit
(fit)[source]¶ Function to add basis fit as associated helper basis member dualfit to a BasisFamily object.
-
add_jfit
(fit)[source]¶ Function to add basis fit as associated fitting basis member jfit to a BasisFamily object.
-
add_jkfit
(fit)[source]¶ Function to add basis fit as associated fitting basis member jkfit to a BasisFamily object.
-
-
corresponding_dualfit
(name)[source]¶ Function to return an appropriate DUAL helper basis for the orbital basis name in coded or ornate form.
None
is returned if no fitting basis is defined or if the orbital basis is not found.
-
corresponding_jfit
(name)[source]¶ Function to return an appropriate J fitting basis for the orbital basis name in coded or ornate form.
None
is returned if no fitting basis is defined or if the orbital basis is not found.
-
corresponding_jkfit
(name)[source]¶ Function to return an appropriate JK fitting basis for the orbital basis name in coded or ornate form.
None
is returned if no fitting basis is defined or if the orbital basis is not found.
-
corresponding_orbital
(name)[source]¶ Function to validate if the orbital basis name in coded or ornate form is in Psi4’s standard installed bases list.
None
is returned if the orbital basis is not found.
-
corresponding_rifit
(name)[source]¶ Function to return an appropriate RI fitting basis for the orbital basis name in coded or ornate form.
None
is returned if no fitting basis is defined or if the orbital basis is not found.
-
load_basis_families
()[source]¶ Function to load into the array
basisfamily_list
BasisFamily objects for all Psi4’s standard installed bases.
-
print_basis_families
()[source]¶ Function to print to the output file a formatted summary of all the BasisFamily objects in
basisfamily_list
, by default all Psi4’s standard installed bases.
-
sanitize_basisname
(name)[source]¶ Function to return name in coded form, stripped of characters that confuse filenames, characters into lowercase,
+
intop
,*
intos
, and(
,)
, &,
into_
.
Module (auto-generated from make_dunning.pl script)
with commands building BasisFamily
objects that
encode the Dunning basis set orbital definitions in
psi4/lib/basis/NOTES and fitting bases designed for those
orbital bases.
Module with utility functions for use in input files.
-
compare_csx
()[source]¶ Function to validate energies in CSX files against PSIvariables. Only active if write_csx flag on.
-
compare_cubes
(expected, computed, label)[source]¶ Function to compare two cube files. Prints
util.success()
when value computed matches value expected. Performs a system exit on failure. Used in input files in the test suite.
-
compare_integers
(expected, computed, label)[source]¶ Function to compare two integers. Prints
util.success()
when value computed matches value expected. Performs a system exit on failure. Used in input files in the test suite.
-
compare_matrices
(expected, computed, digits, label)[source]¶ Function to compare two matrices. Prints
util.success()
when elements of matrix computed match elements of matrix expected to number of digits. Performs a system exit on failure to match symmetry structure, dimensions, or element values. Used in input files in the test suite.
-
compare_strings
(expected, computed, label)[source]¶ Function to compare two strings. Prints
util.success()
when string computed exactly matches string expected. Performs a system exit on failure. Used in input files in the test suite.
-
compare_values
(expected, computed, digits, label)[source]¶ Function to compare two values. Prints
util.success()
when value computed matches value expected to number of digits. Performs a system exit on failure. Used in input files in the test suite.
-
compare_vectors
(expected, computed, digits, label)[source]¶ Function to compare two vectors. Prints
util.success()
when elements of vector computed match elements of vector expected to number of digits. Performs a system exit on failure to match symmetry structure, dimension, or element values. Used in input files in the test suite.
-
copy_file_from_scratch
(filename, prefix, namespace, unit, move=False)[source]¶ Function to move file out of scratch with correct naming convention.
Arguments:
@arg filename full path to target file @arg prefix computation prefix, usually ‘psi’ @arg namespace context namespace, usually molecule name @arg unit unit number, e.g. 32 @arg move copy or move? (default copy)
Example:
Assume PID is 12345 and SCRATCH is /scratch/parrish/
- copy_file_to_scratch(‘temp’, ‘psi’, ‘h2o’, 32):
- -cp /scratch/parrish/psi.12345.h2o.32 .temp
- copy_file_to_scratch(‘/tmp/temp’, ‘psi’, ‘h2o’, 32):
- -cp /scratch/parrish/psi.12345.h2o.32 /tmp/temp
- copy_file_to_scratch(‘/tmp/temp’, ‘psi’, ‘’, 32):
- -cp /scratch/parrish/psi.12345.32 /tmp/temp
- copy_file_to_scratch(‘/tmp/temp’, ‘psi’, ‘’, 32, True):
- -mv /scratch/parrish/psi.12345.32 /tmp/temp
-
copy_file_to_scratch
(filename, prefix, namespace, unit, move=False)[source]¶ Function to move file into scratch with correct naming convention.
Arguments:
@arg filename full path to file @arg prefix computation prefix, usually ‘psi’ @arg namespace context namespace, usually molecule name @arg unit unit number, e.g. 32 @arg move copy or move? (default copy)
Example:
Assume PID is 12345 and SCRATCH is /scratch/parrish/
- copy_file_to_scratch(‘temp’, ‘psi’, ‘h2o’, 32):
- -cp ./temp /scratch/parrish/psi.12345.h2o.32
- copy_file_to_scratch(‘/tmp/temp’, ‘psi’, ‘h2o’, 32):
- -cp /tmp/temp /scratch/parrish/psi.12345.h2o.32
- copy_file_to_scratch(‘/tmp/temp’, ‘psi’, ‘’, 32):
- -cp /tmp/temp /scratch/parrish/psi.12345.32
- copy_file_to_scratch(‘/tmp/temp’, ‘psi’, ‘’, 32, True):
- -mv /tmp/temp /scratch/parrish/psi.12345.32
-
csx2endict
()[source]¶ Grabs the CSX file as a dictionary, encodes translation of PSI variables to XML blocks, gathers all available energies from CSX file into returned dictionary.
-
cubefile
(filename='psi4.cube', nptsx=50, nptsy=50, nptsz=50, buffer_size=5.0, prop='density', **kwargs)[source]¶
-
success
(label)[source]¶ Function to print a ‘label...PASSED’ line to screen. Used by
util.compare_values()
family when functions pass.
-
xml2dict
(filename=None)[source]¶ Read XML filename into nested OrderedDict-s. filename defaults to active CSX file.
-
class
Table
(rows=(), row_label_width=10, row_label_precision=4, cols=(), width=16, precision=10)[source]¶ Class defining a flexible Table object for storing data.
Function to print text to output file in a banner of minimum width width and minimum three-line height for type = 1 or one-line height for type = 2. If strNotOutfile is True, function returns string rather than printing it to output file.
-
find_approximate_string_matches
(seq1, options, max_distance)[source]¶ Function to compute approximate string matches from a list of options.
Module with utility functions used by several Python functions.
-
all_casings
(input_string)[source]¶ Function to return a generator of all lettercase permutations of input_string.
-
drop_duplicates
(seq)[source]¶ Function that given an array seq, returns an array without any duplicate entries. There is no guarantee of which duplicate entry is dropped.
-
extract_sowreap_from_output
(sowout, quantity, sownum, linkage, allvital=False)[source]¶ Function to examine file sowout from a sow/reap distributed job for formatted line with electronic energy information about index sownum to be used for construction of quantity computations as directed by master input file with linkage kwarg. When file sowout is missing or incomplete files, function will either return zero (allvital is
False
) or terminate (allvital isTrue
) since some sow/reap procedures can produce meaningful results (database) from an incomplete set of sown files, while others cannot (gradient, hessian).
-
format_currentstate_for_input
(func, name, allButMol=False, **kwargs)[source]¶ Function to return an input file in preprocessed psithon. Captures memory, molecule, options, function, method, and kwargs. Used to write distributed (sow/reap) input files.
-
format_kwargs_for_input
(filename, lmode=1, **kwargs)[source]¶ Function to pickle to file filename the options dictionary kwargs. Mode lmode =2 pickles appropriate settings for reap mode. Used to capture Python options information for distributed (sow/reap) input files.
-
format_molecule_for_input
(mol, name='')[source]¶ Function to return a string of the output of
inputparser.process_input()
applied to the XYZ format of molecule, passed as either fragmented geometry string mol or molecule instance mol. Used to capture molecule information from database modules and for distributed (sow/reap) input files. For the reverse, seemolutil.geometry()
.
-
format_options_for_input
()[source]¶ Function to return a string of commands to replicate the current state of user-modified options. Used to capture C++ options information for distributed (sow/reap) input files.
Caution
Some features are not yet implemented. Buy a developer a coffee.
- Does not cover local (as opposed to global) options.
-
get_psifile
(fileno, pidspace='21064')[source]¶ Function to return the full path and filename for psi file fileno (e.g., psi.32) in current namespace pidspace.
-
getattr_ignorecase
(module, attr)[source]¶ Function to extract attribute attr from module if attr is available in any possible lettercase permutation. Returns attribute if available, None if not.
-
import_ignorecase
(module)[source]¶ Function to import module in any possible lettercase permutation. Returns module object if available, None if not.
-
kwargs_lower
(kwargs)[source]¶ Function to rebuild and return kwargs dictionary with all keys made lowercase. Should be called by every function that could be called directly by the user.
-
mat2arr
(mat)[source]¶ Function to convert psi4.Matrix mat to Python array of arrays. Expects psi4.Matrix to be flat with respect to symmetry.
-
prepare_options_for_modules
(changedOnly=False, commandsInsteadDict=False)[source]¶ Function to return a string of commands to replicate the current state of user-modified options. Used to capture C++ options information for distributed (sow/reap) input files.
Caution
Some features are not yet implemented. Buy a developer a coffee.
- Need some option to get either all or changed
- Need some option to either get dict or set string or psimod command list
- command return doesn’t revoke has_changed setting for unchanged with changedOnly=False
Module to provide mechanism to store and restore option states in driver.
-
class
OptionState
(option, module=None)[source]¶ Class to store the state of a single option. If module given, the option value and has_changed value is stored for global, local to module, and used by module scopes; otherwise (used for BASIS keywords), only global scope is stored. Class can store, print, and restore option values.
>>> OptionState('SCF_TYPE', 'SCF') >>> print(OptionState('DF_BASIS_MP2'))
-
class
OptionsState
(*largs)[source]¶ Class to contain multiple
OptionsState()
objects. Used in python driver functions to collect several options before altering them, then restoring before function return.>>> optstash = OptionsState( ['SCF', 'DFT_FUNCTIONAL'], ['DF_BASIS_SCF'], ['SCF', 'SCF_TYPE'], ['SCF', 'REFERENCE']) >>> print(optstash) >>> optstash.restore()