Psi4 Project Logo

Python Driver

wrapper_database

Module with functions that call the four main driver functions: driver.energy, driver.optimize, driver.response, and driver.frequency.

diatomic

pcm_placeholder

This is a placeholder for the real pcmsolver.py script. The location of the real pcmsolver.py is configured by CMake to point to the proper install prefix. In this way we avoid to transform inputparser.py into a file that has to be configured by CMake With conda, this starts to get complicated. Bottom option works for build-in-place and build-psi-w-prebuilt-pcmsolver. Upper option necessary when psi4metapackage is conda build dependency. At least I think that’s what’s going on.

dependency_check

Attempts to catch Python based import errors and provides possible solutions.

gaussian_n

run_gaussian_2(name, **kwargs)[source]

frac

frac_nuke(molecule, **kwargs)[source]
frac_traverse(molecule, **kwargs)[source]
ip_fitting(molecule, omega_l, omega_r, **kwargs)[source]

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.

activate(mol)[source]

Function to set molecule object mol as the current active molecule. Permitted for user use but deprecated in driver in favor of explicit molecule-passing.

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.

geometry(geom, name='default')[source]

Function to create a molecule object of name name from the geometry in string geom. Permitted for user use but deprecated in driver in favor of explicit molecule-passing.

new_get_attr(self, name)[source]

Function to redefine __getattr__ method of molecule class.

new_set_attr(self, name, value)[source]

Function to redefine __setattr__ method of molecule class.

driver_util

parse_arbitrary_order(name)[source]

Function to parse name string into a method family like CI or MRCC and specific level information like 4 for CISDTQ or MRCCSDTQ.

parse_cotton_irreps(irrep, point_group)[source]

Function to return validated Cotton ordering index for molecular point_group from string or integer irreducible representation irrep.

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
fake_file11(wfn, filename='fake_file11.dat', **kwargs)[source]

Function to print a file filename of the old file11 format from molecule and gradient information in wfn.

New in version 0.6: wfn parameter passed explicitly

Returns:

None

Parameters:
  • filename (string) – destination file name for file11 file
  • wfn (Wavefunction) – set of molecule, gradient from which to generate file11
Examples:
>>> # [1] file11 for CISD calculation
>>> G, wfn = gradient('cisd', return_wfn=True)
>>> fake_file11(wfn, 'mycalc.11')

interactive

run()[source]

pubchem

class PubChemObj(cid, mf, iupac)[source]
getCartesian()[source]

Function to return a string of the atom symbol and XYZ coordinates of the PubChem object.

getMoleculeString()[source]

Function to obtain a molecule string through getCartesian() or fail.

getSDF()[source]

Function to return the SDF (structure-data file) of the PubChem object.

getXYZFile()[source]

Function to obtain preferentially a molecule string through getCartesian() or a query string otherwise.

name()[source]

Function to return the IUPAC name of the PubChem object.

getPubChemResults(name)[source]

Function to query the PubChem database for molecules matching the input string. Builds a PubChem object if found.

inputparser

Module with functions to parse the input file and convert Psithon into standard Python. Particularly, forms psi4 module calls that access the C++ side of Psi4.

bad_option_syntax(line)[source]

Function to report bad syntax to screen and output file.

basname(name)[source]

Imitates BasisSet.make_filename() without the gbs extension

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_basis_block(matchobj)[source]

Function to process match of basis name? { ... }.

process_cfour_command(matchobj)[source]

Function to process match of cfour name? { ... }.

process_external_command(matchobj)[source]

Function to process match of external name? { ... }.

process_extract_command(matchobj)[source]

Function to process match of extract_subsets.

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_literal_blocks(matchobj)[source]

Function to process match of literals_psi4_yo-....

process_memory_command(matchobj)[source]

Function to process match of memory ....

process_molecule_command(matchobj)[source]

Function to process match of molecule name? { ... }.

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_pcm_command(matchobj)[source]

Function to process match of pcm name? { ... }.

process_print_command(matchobj)[source]

Function to process match of print and transform it to psi4.print_out().

process_pubchem_command(matchobj)[source]

Function to process match of pubchem in molecule block.

process_set_command(matchobj)[source]

Function to process match of all individual set (module_list) key {[value_list] or $value or value}.

process_set_commands(matchobj)[source]

Function to process match of set name? { ... }.

process_word_quotes(matchobj)[source]

Function to determine if argument needs wrapping in quotes as string.

quotify(string, isbasis=False)[source]

Function to wrap anything that looks like a string in quotes and to remove leading dollar signs from python variables. When basis is True, allows commas, since basis sets may have commas and are assured to not involve arrays.

driver_nbody

nCr(n, r)[source]

driver_cbs

return_energy_components()[source]

driver

Module with a procedures dictionary specifying available quantum chemical methods and functions driving the main quantum chemical functionality, namely single-point energies, geometry optimizations, properties, and vibrational frequency calculations.

wrapper_autofrag

auto_fragments(**kwargs)[source]

Detects fragments if the user does not supply them. Currently only used for the WebMO implementation of SAPT.

Returns:Molecule) – fragmented molecule.
Parameters:molecule (molecule) –

h2o || etc.

The target molecule, if not the last molecule defined.

Examples:
>>> # [1] replicates with cbs() the simple model chemistry scf/cc-pVDZ: set basis cc-pVDZ energy('scf')
>>> molecule mol {\nH 0.0 0.0 0.0\nH 2.0 0.0 0.0\nF 0.0 1.0 0.0\nF 2.0 1.0 0.0\n}
>>> print mol.nfragments()  # 1
>>> fragmol = auto_fragments()
>>> print fragmol.nfragments()  # 2

qmmm

Module with classes to integrate MM charges into a QM calculation.

class Diffuse(molecule, basisname, ribasisname)[source]
fitGeneral()[source]

Function to perform a general fit of diffuse charges to wavefunction density.

fitScf()[source]

Function to run scf and fit a system of diffuse charges to resulting density.

populateExtern(extern)[source]
class QMMM[source]
addChargeAngstrom(Q, x, y, z)[source]

Function to add a point charge of magnitude Q at position (x, y, z) Angstroms.

addChargeBohr(Q, x, y, z)[source]

Function to add a point charge of magnitude Q at position (x, y, z) Bohr.

addDiffuse(diffuse)[source]

Function to add a diffuse charge field diffuse.

populateExtern()[source]

Function to define a charge field external to the molecule through point and diffuse charges.

qcdb

Module to facilitate quantum chemical computations on chemical databases. Contains Molecule class and physical constants from psi4 suite.

Module with commands building BasisFamily objects for Pople and other non-Dunning orbital basis sets. Some plausible fitting basis sets are supplied as defaults.

load_basfam_other()[source]
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.

bits()[source]

Returns bitwise representation of symm ops

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.

gamma(i)[source]

Returns the i’th irrep.

inverse(i)[source]

Returns the index of the symop which is the inverse of symop[i].

make_table()[source]

This function will generate a character table for the point group. This character table is in the order that symmetry operations are generated, not in Cotton order. If this is a problem, tough. Also generate the transformation matrices. This fills in the irrep and symop arrays

ncomp()[source]

Returns number of compenents, including degeneracies

nirrep()[source]

Returns the number of irreps.

order()[source]

Returns the order of the point group

symbol()[source]

Returns the Schoenflies symbol for the point group

symm_operation(i)[source]

Returns the i’th symmetry operation.

which_comp(i)[source]

Returns which component i is.

which_irrep(i)[source]

Returns the irrep component i belongs to.

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).

character(i)[source]

Returns the character for the i’th symmetry operation of the point group.

complex()[source]

Returns the value of complex

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.

degeneracy()[source]

Returns the degeneracy of the irrep.

init(order, d, lab, clab)[source]

Initialize the order, degeneracy, and Mulliken symbol of the irrep.

nproj()[source]

Returns the number of projection operators for the irrep.

nrot()[source]

Returns the number of rotations associated with the irrep.

ntrans()[source]

Returns the number of translations associated with the irrep.

order()[source]

Returns the order of the group.

p(x1, x2, i=None)[source]

Returns the element (x1, x2) of the i’th representation matrix. Or Returns the character for the x1’th contribution to the x2’th representation matrix.

symbol()[source]

Returns the Mulliken symbol for the irrep.

symbol_ns()[source]

Returns the Mulliken symbol for the irrep without special characters.

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.

bits()[source]

Returns the bitwise representation of the point group

static bits_to_basic_name(bits)[source]

From bit representation of point group, returns string of simple (non-directional) Schoenflies symbol.

static bits_to_full_name(bits)[source]
char_table()[source]

Returns the CharacterTable for this point group.

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.

constructor_schoenflies_origin(s, origin)[source]

Like the above, but this constructor also takes a point of origin as an argument.

static full_name_to_bits(pg)[source]
origin()[source]

Returns the origin of the symmetry frame.

set_symbol(sym)[source]

Sets (or resets) the Schoenflies symbol.

symbol()[source]

Returns the Schoenflies symbol for this point group.

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.

E()[source]

Set equal to the identity

SymmetryOperation()[source]

Cast SymRep to SymmetryOperation

c2_x()[source]

Set equal to C2 about the x axis

c2_y()[source]

Set equal to C2 about the y axis

c2_z()[source]

Set equal to C2 about the z axis

constructor_order(i)[source]

Initialize order only

constructor_symmetryoperation(so)[source]

Initialize from 3x3 SymmetryOperation

i()[source]

Set equal to an inversion

operate(r)[source]

This operates on this with r (i.e. return r * this)

rotation(theta)[source]

Set equal to a clockwise rotation by 2pi/n or theta degrees

set_dim(i)[source]

Set the dimension of d

sigma_h()[source]

Set equal to reflection in xy plane

sigma_xz()[source]

Set equal to reflection in xz plane

sigma_yz()[source]

Set equal to reflection in yz plane

trace()[source]

returns the trace of the transformation matrix

transform(r)[source]

This performs the transform r * this * r~

unit()[source]

Set equal to a unit matrix

zero()[source]

zero out the symop

class SymmetryOperation(*args)[source]

The SymmetryOperation class provides a 3 by 3 matrix representation of a symmetry operation, such as a rotation or reflection.

E()[source]

Set equal to E

analyze_d()[source]
bit()[source]

Get the bit value.

c2_x()[source]

Set equal to C2 about the x axis

c2_y()[source]

Set equal to C2 about the y axis

c2_z()[source]

Set equal to C2 about the z axis

constructor_symmetryoperation(so)[source]
i()[source]

Set equal to an inversion

operate(r)[source]

This operates on this with r (i.e. return r * this)

rotation(theta)[source]

Set equal to a clockwise rotation by 2pi/n or theta degrees

sigma_xy()[source]

Set equal to reflection in xy plane

sigma_xz()[source]

Set equal to reflection in xz plane

sigma_yz()[source]

Set equal to reflection in yz plane

trace()[source]

returns the trace of the transformation matrix

transform(r)[source]

This performs the transform r * this * r~

transpose()[source]

Transpose matrix operation

unit()[source]

Set equal to a unit matrix

zero()[source]

zero out the symop

similar(bits)[source]

From bits of a directionalized point group, returns array of bits of all directions.

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.

bond_profile()

Obtain bonding topology of molecule

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()[source]

Function to print Molecule in a form readable by Cfour.

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.

format_molecule_for_mol2()

Returns a string of Molecule formatted for mol2.

Written by Trent M. Parker 9 Jun 2014

format_molecule_for_molpro()[source]
format_molecule_for_numpy(npobj=True)[source]

Returns a NumPy array of the non-dummy atoms of the geometry in Cartesian coordinates in Angstroms with element encoded as atomic number. If npobj is False, returns representation of NumPy array.

format_molecule_for_nwchem()[source]
format_molecule_for_orca()[source]

Format the molecule into an orca xyz format

format_molecule_for_psi4()[source]

Returns string of molecule definition block.

format_molecule_for_psi4_xyz()[source]

not much examined

format_molecule_for_qchem(mixedbas=True)[source]

Returns geometry section of input file formatted for Q-Chem. For ghost atoms, prints Gh as elemental symbol, with expectation that element identity will be established in mixed basis section. For ghost atoms when mixedbas is False, prints @ plus element symbol.

candidate modeled after psi4_xyz so that absent fragments observed force xyz

format_molecule_for_qchem_old(mixedbas=True)[source]

Returns geometry section of input file formatted for Q-Chem. For ghost atoms, prints Gh as elemental symbol, with expectation that element identity will be established in mixed basis section. For ghost atoms when mixedbas is False, prints @ plus element symbol.

prints whole dimer for unCP mono when called dir (as opposed to passing thru str no frag markers

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(masswt=True, zero=1e-14)[source]

Solve inertial system

inertial_system_partial(part, masswt=True, zero=1e-14)[source]

Solve inertial system based on atoms in part

classmethod init_with_mol2(xyzfilename, no_com=False, no_reorient=False, contentsNotFilename=False)[source]

Pull information from a MOl2 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.

NOTE: chg/mult NYI

>>> H2O = qcdb.Molecule.init_with_mol2('h2o.mol2')
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')
move_to_coc()[source]

Moves molecule to center of charge

print_ring_planes(entity1, entity2, entity3=None, entity4=None)[source]

(reals only, 1-indexed)

rotor_type(tol=1e-08)[source]

Returns the rotor type.

>>> H2OH2O.rotor_type()
RT_ASYMMETRIC_TOP
run_dftd3(func=None, dashlvl=None, dashparam=None, dertype=None, verbose=False)

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 or PSIPATH. self may be either a qcdb.Molecule (sensibly) or a psi4.Molecule (works b/c psi4.Molecule has been extended by this method py-side and only public interface fns used) or a string that can be instantiated into a qcdb.Molecule.

save_string_xyz(save_ghosts=True, save_natom=False)[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
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_FCM(fcm)[source]

Parses the contents fcm of the Cfour FCMFINAL file into a hessian array.

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_memory(mem)[source]

Transform input mem in MB into psi4-type options for cfour.

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.

class DB4(pythonpath=None, loadfrompickle=False, path=None)[source]
define_supermodelchems()[source]
define_supersubsets()[source]
make_dhdft_Figure_1()[source]

Plot all the graphics needed for the grey bars plot in Fig. 1 of DHDFT.

make_dhdft_Figure_2()[source]

Plot all the graphics needed for the SAPT/DFT/WFN comparison plot in Fig. 2 of DHDFT.

Note that benchmark set as reminder, not necessity, since default.

make_dhdft_Table_I()[source]

Generate the in-manuscript summary slat table for DHDFT.

make_dhdft_Table_II()[source]

Generate the in-manuscript CP slat table for DHDFT.

make_dhdft_Table_III()[source]

Generate the in-manuscript unCP slat table for DHDFT.

make_dhdft_Tables_SII()[source]

Generate the subset details suppmat Part II tables and their indices for DHDFT.

make_dhdft_Tables_SIII()[source]

Generate the per-reaction suppmat Part III tables and their indices for DHDFT.

make_pt2_Figure_2()[source]

Plot all the graphics needed for the diffuse augmented grey bars plot in Fig. 2 of PT2.

Note that in the modern implementation of class DB4, would need to pass sset=['tt-5min', 'hb-5min', 'mx-5min', 'dd-5min'] to get published figure.

make_pt2_Figure_3()[source]

Plot all the graphics needed for the calendar grey bars plot in Fig. 3 of PT2.

Note that in the modern implementation of class DB4, would need to pass sset=['tt-5min', 'hb-5min', 'mx-5min', 'dd-5min'] to get published figure.

plot_dhdft_flats()[source]

Generate pieces for grey bars figure for DH-DFT paper.

plot_dhdft_modelchems()[source]
plot_minn_modelchems()[source]
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')
add_Subset(name, func)[source]

Define a new subset labeled name by providing a database func whose keys are the keys of dbdict and whose values are a function that filters each WrappedDatabase’s self.hrxn.

add_Subset_union(name, sslist)[source]

Define a new subset labeled name (note that there’s nothing to prevent overwriting an existing subset name) from the union of existing named subsets in sslist.

add_sampled_Subset(sset='default', number_of_samples=1, sample_size=5, prefix='rand')[source]

Generate and register number_of_samples new subsets of size sample_size and name built from prefix. Reactions chosen from sset.

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.

available_projects(path=None)[source]
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'
export_pandas(modelchem=[], benchmark='default', sset='default', modelchemlabels=None, failoninc=True)[source]

modelchem is array of model chemistries, if modelchem is empty, get only benchmark is benchmark needed?

fancy_mcs(latex=False)[source]
get_hrgt(sset='default', actv='default')[source]
get_hrxn(sset='default')[source]
get_missing_reactions(modelchem, sset='default')[source]

Returns a dictionary (keys self.dbse and all component WrappedDatabase.dbse) of two elements, the first being the number of reactions sset should contain and the second being a list of the reaction names (dbrxn) not available for modelchem. Absence of benchmark not considered.

get_reactions(modelchem, sset='default', benchmark='default', failoninc=True)[source]

Collects the reactions present in sset from each WrappedDatabase, checks that modelchem and benchmark ReactionDatum are present (fails if failoninc True), then returns in an array a tuple for each reaction containing the modelchem key needed to access modelchem, the modelchem key needed to access benchmark, and the Reaction object.

integer_reactions()[source]

Returns boolean of whether reaction names need to be cast to integer

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_qcdata_hrxn_byproject(project, path=None)[source]
load_saptdata_frombfdb(sset='default', pythonpath='/Users/loriab/linux/bfdb/sapt_punt', failoninc=True)[source]

This is a stopgap function that loads sapt component data from sapt_punt in bfdb repo.

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, failoninc=True, 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_axis(axis, modelchem, benchmark='default', sset='default', failoninc=True, verbose=False, color='sapt', view=True, saveas=None, relpath=False, graphicsformat=['pdf'])[source]
plot_bars(modelchem, benchmark='default', sset=['default', 'hb', 'mx', 'dd'], failoninc=True, verbose=False, view=True, 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='', 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. 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, xlines=[0.0, 0.3, 1.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_iowa(modelchem, benchmark='default', sset='default', failoninc=True, verbose=False, title='', xtitle='', xlimit=2.0, view=True, saveas=None, relpath=False, graphicsformat=['pdf'])[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.

plot_liliowa(modelchem, benchmark='default', failoninc=True, xlimit=2.0, view=True, saveas=None, relpath=False, graphicsformat=['pdf'])[source]

Note that not possible to access sset of component databases. That is, for Database SSIBBI, SSI-only arylaryl is accessible b/c not defined in BBI, but SSI-only neutral is not accessible.

plot_modelchems(modelchem, benchmark='default', mbenchmark=None, sset='default', msset=None, failoninc=True, verbose=False, color='sapt', xlimit=4.0, labeled=True, view=True, mousetext=None, mouselink=None, mouseimag=None, mousetitle=None, mousediv=None, saveas=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.

plot_ternary(sset='default', labeled=True, pythonpath='/Users/loriab/linux/bfdb/sapt_punt', failoninc=True, view=True, saveas=None, relpath=False, graphicsformat=['pdf'])[source]

This is a stopgap function that loads sapt component data from sapt_punt in bfdb repo, then formats it to plot a ternary diagram.

promote_Subset(name=None)[source]

Examine component databases and elevate subset name not necessarily present for all component databases to a subset for the self. When name is None, promotes all subsets found for component databases. Also promotes entirety of each component database as a subset with name of component database dbse in lowercase.

sset = None

subset assembly pattern

>>> print asdf.sset.keys()
XXXX
table_merge_abbr(plotpath, subjoin)[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(plotpath, subjoin)[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.

table_reactions(modelchem, benchmark='default', sset='default', failoninc=True, columnplan=['indx', 'tagl', 'bm', 'mc', 'e', 'pe'], title='Reaction energies [kcal/mol] for {sset} $\\subset$ {dbse} with {mc}', indextitle='Detailed results for {sset} $\\subset$ {dbse} with {mc}', plotpath='analysis/mols/', standalone=True, theme='rxns', filename=None)[source]

Prepare single LaTeX table to filename or return lines if None showing the per-reaction results for reactions in sset for single or array or ‘all’ modelchem, where the last uses self.mcs(), model chemistries versus benchmark. Use failoninc to toggle between command failing or blank lines in table. Use standalone to toggle between full compilable document and suitable for inclusion in another LaTeX document. Use columnplan to customize column (from among columnreservoir, below) layout. Use title and indextitle to customize table caption and table-of-contents caption, respectively; variables in curly braces will be substituted. Use theme to customize the ref{tbl:} code.

table_scrunch(plotpath, subjoin)[source]
table_wrapper(mtd, bas, tableplan, benchmark='default', opt=['CP'], err=['mae'], sset=['default'], dbse=None, opttarget=None, failoninc=True, xlimit=4.0, xlines=[0.0, 0.3, 1.0], ialimit=2.0, plotpath='autogen', subjoin=True, title=None, indextitle=None, suppressblanks=False, standalone=True, theme=None, filename=None)[source]

Prepares dictionary of errors for all combinations of mtd, opt, bas with respect to model chemistry benchmark, mindful of failoninc. The general plan for the table, as well as defaults for landscape, footnotes, title, indextitle, and *theme are got from function tableplan. Once error dictionary is ready, it and all other arguments are passed along to textables.table_generic. Two arrays, one of table lines and one of index lines are returned unless filename is given, in which case they’re written to file and a filedict returned.

write_xyz_files(path=None)[source]

Writes xyz files for every reagent in the Database to directory in path or to directory dbse_xyzfiles that it createsin cwd if path is None. Additionally, writes a script to that directory that will generate transparent-background ray-traced png files for every reagent with PyMol.

class Reaction(name, dbse, indx, tagl=None, latex=None, color='black', comment=None)[source]
compute_errors(benchmark='default', mcset='default', failoninc=True, verbose=False)[source]

For all data or modelchem subset mcset, 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.

plot(benchmark='default', mcset='default', failoninc=True, verbose=False, color='sapt', xlimit=4.0, labeled=True, view=True, mousetext=None, mouselink=None, mouseimag=None, mousetitle=None, mousediv=None, saveas=None, relpath=False, graphicsformat=['pdf'])[source]

Computes individual errors over model chemistries in mcset (which may be default or an array or a function generating an array) versus benchmark. 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.

class ReactionDatum(dbse, rxn, method, mode, basis, value, units='kcal/mol', citation=None, doi=None, comment=None)[source]

Piece of quantum chemical information that describes a qcdb.Reaction object.

classmethod library_modelchem(dbse, rxn, method, mode, basis, value, units='kcal/mol', citation=None, doi=None, comment=None)[source]

Constructor when method and basis are strings corresponding to qcdb.Method and qcdb.BasisSet already defined in methods and bases.

class Reagent(name, mol, tagl=None, comment=None)[source]

Chemical entity only slightly dresed up from qcdb.Molecule.

class Subset(name, hrxn, tagl=None, axis=None)[source]

Affiliated qcdb.Reaction-s

class ThreeDatabases(pythonpath=None)[source]
define_supermodelchems()[source]
define_supersubsets()[source]
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', citation=None, 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.

benchmark()[source]

Returns the model chemistry label for the database’s benchmark.

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'
get_pec_weightinfo()[source]
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']
integer_reactions()[source]

Returns boolean of whether reaction names need to be cast to integer

static load_pickled(dbname, path=None)[source]
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_qcdata_hrxn_byproject(project, path=None)[source]
load_subsets(modname='subsetgenerator', pythonpath=None)[source]

Loads subsets from all functions in module modname.

oss = None

object of defined reaction subsets.

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']
tagl = None

description line

>>> print asdf.tagl
'interaction energies of dissociation curves for non-bonded systems'
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.

balanced_error(refrxn, refeq, rrat, m=0.03, p=10.0)[source]
Parameters:
  • refrxn
  • refeq
  • rrat
  • m – minimum permitted weight for a point
  • p – multiples of abs(refeq) above refeq to which zero-line in head is displaced
Returns:

cure_weight(refrxn, refeq, rrat, xi=0.2)[source]
Parameters:
  • refeq – value of benchmark for equilibrium Reaction
  • rrat – ratio of intermonomer separation for Reaction to equilibrium Reaction
  • xi – parameter
Returns:

weight for CURE

fancify_mc_tag(mc, latex=False)[source]

From the usual MTD-opt1_opt2-bas model chemistry identifier, return string based on fullname, if latex is False or latex if latex is True.

format_errors(err, mode=1)[source]

From error dictionary err, returns a LaTeX-formatted string, after handling None entries.

initialize_errors()[source]

Form OrderedDict of all possible statistical measures set to None

initialize_errors_elaborate(e=None, pe=None, pbe=None, pce=None, extrema=True)[source]
oxcom(lst)[source]

Returns gramatical comma separated string of lst.

string_contrast(ss)[source]

From an array of strings, ss, returns maximum common prefix string, maximum common suffix string, and array of middles.

File to

dictify_database_docstrings()[source]
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.

useful()[source]
find_start(lines, start_str, reverse=True)[source]

Find the start of a block, iterate backwards by default, Usually the last one is wanted If not found, return -1

harvest(p4Mol, orca_out, **largs)[source]

Harvest variables, gradient, and the molecule from the output and other files

harvest_coupled_cluster(lines, psivar)[source]

Harvest coupled cluster results WARNING: Canonical and DLPNO print the coupled cluster results differently

harvest_dipole(lines, psivar)[source]

Harvest the dipole, and return as a tuple (x, y, z) Multiple different dipole moments can be output if post-HF calculations are run and their dipoles are requested resulting in highly similar blocks. It by default collects the last which appears to always be the one requested

TODO: collect all the different types of dipole moments

harvest_engrad(engrad)[source]

Parse the engrad file for the gradient

harvest_molecule_from_outfile(lines)[source]

Return a molecule of the last geometry

harvest_mp2(lines, psivar)[source]

Harvest the MP2 results

harvest_scf_from_outfile(lines, psivar)[source]

Harvest SCF results from the SCF section of the output file

muster_memory(mem)[source]

Transform input mem in MB into psi4-type options for orca.

muster_modelchem(name, dertype)[source]

Transform calculation method name and derivative level dertype into options for orca. While deliberately requested pieces, generally orca__orca_deriv_level and orca__orca_calc_level, are set to complain if contradicted (‘clobber’ set to True), other ‘recommended’ settings, can be countermanded by keywords in input file (‘clobber’ set to False). Occasionally, we want these pieces to actually overcome keywords in input file (‘superclobber’ set to True).

orca_gradient_list()[source]

Return an array of Orca methods with analytical gradients. Appended to procedures[‘gradient’].

orca_list()[source]

Return an array of Orca methods with energies. Appended to procedures[‘energy’].

class OrderedDict(*args, **kwds)[source]

Dictionary that remembers insertion order

clear() → None. Remove all items from od.[source]
copy() → a shallow copy of od[source]
classmethod fromkeys(S[, v]) → New ordered dictionary with keys from S[source]

and values equal to v (which defaults to None).

items() → list of (key, value) pairs in od[source]
iteritems()[source]

od.iteritems -> an iterator over the (key, value) items in od

iterkeys() → an iterator over the keys in od[source]
itervalues()[source]

od.itervalues -> an iterator over the values in od

keys() → list of keys in od[source]
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.

setdefault(k[, d]) → od.get(k,d), also set od[k]=d if k not in od[source]
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

values() → list of values in od[source]
viewitems() → a set-like object providing a view on od's items[source]
viewkeys() → a set-like object providing a view on od's keys[source]
viewvalues() → an object providing a view on od's values[source]

Parent classes for quantum chemistry program input and output file formats.

class InputFormat(mem, mtd, bas, mol, sys, cast)[source]
corresponding_aux_basis()[source]

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()[source]

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

Module with non-generic exceptions classes.

exception BasisSetFileNotFound(msg)[source]
exception BasisSetNotDefined(msg)[source]
exception BasisSetNotFound(msg, silent=False)[source]
exception Dftd3Error(msg)[source]
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 QcdbException[source]

Error class for QCDB.

exception ValidationError(msg)[source]

Error called for problems with syntax input file. Prints error message msg to standard output stream.

class Infile(mem, mol, mtd, der, opt)[source]
format_infile_string()[source]
harvest_output(outtext)[source]

Function to separate portions of a Psi4 output file outtext.

muster_basis(bas)[source]

Transform input mem in MB into psi4-type options.

muster_cdsgroup_options()[source]
muster_memory(mem)[source]

Transform input mem in MB into psi4-type options.

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).

psi4_list()[source]

Return an array of Psi4 methods with energies.

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.

ao_to_shell(i)[source]

Given a Cartesian function (AO) number what shell does it correspond to.

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

compute_phi(phi_ao, x, y, z)[source]

Returns the values of the basis functions at a point

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.

constructor_zero_ao_basis()[source]

Constructs a zero AO basis set

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.

function_to_shell(i)[source]

Given a function number what shell does it correspond to.

get_ao_sorted_list()[source]

Returns the vector of sorted shell list. Defunct

get_ao_sorted_shell(i)[source]

Returns the value of the sorted shell list. Defunct

has_puream()[source]

Spherical harmonics? * @return true if using spherical harmonics

initialize_singletons()[source]

Initialize singleton values that are shared by all basis set objects.

initialized_shared = False
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.

name()[source]

Returns the name of 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.

nshell()[source]

Number of shells. * @return Number of shells.

nshell_on_center(i)[source]

Return the number of shells on a given center.

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: defaults to 2 * < 1: Nothing * 1: Brief summary * 2: Summary and contraction details * > 2: Full details

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_detail_gamess(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_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)")

static pyconstruct_combined(mol, keys, targets, fitroles, others)[source]
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.

set_name(name)[source]

Sets the name of this basis set

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_on_center(center, shell)[source]

Return the overall shell number

static shell_sorter_am(d1, d2)[source]
static shell_sorter_ncenter(d1, d2)[source]
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.

static zero_ao_basis_set()[source]

Returns an empty basis set object. Returns a BasisSet object that actually has a single s-function at the origin with an exponent of 0.0 and contraction of 1.0. * @return A new empty BasisSet object.

zero_so_basis_set(factory)[source]

NYI Returns an empty SO basis set object. * Returns an SOBasis object that actually has a single s-function * at the origin with an exponent of 0.0 and contraction of 1.0. * @return A new empty SOBasis object.

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.

setdefault(key, value=None)[source]
update(*args, **kwargs)[source]
class BasisSet(name, fullname=None, latex=None, citations=None, doi=None, comment=None, zeta=None, build=None)[source]

Specialization of QCEssential for basis sets.

class Citation(doi, fullname=None, dsdbid=None, comment=None)[source]

Class to hold reference to a single published scientific work

class Error(name, fullname=None, latex=None, citations=None, doi=None, comment=None)[source]

Specialization of QCEssential for measures of error.

class Method(name, fullname=None, latex=None, citations=None, doi=None, comment=None)[source]

Specialization of QCEssential for quantum chemical methods.

class Publication(name, fullname=None, latex=None, dsdbid=None, doi=None, comment=None, owner=None)[source]

Specialization of QCEssential for computational chemistry publications, presumably containing many quantum chemistry results.

class QCEssential(name, fullname=None, latex=None, citations=None, doi=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.

Module with functions that interface with Grimme’s DFTD3 code.

run_dftd3(self, func=None, dashlvl=None, dashparam=None, dertype=None, verbose=False)[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 or PSIPATH. self may be either a qcdb.Molecule (sensibly) or a psi4.Molecule (works b/c psi4.Molecule has been extended by this method py-side and only public interface fns used) or a string that can be instantiated into a qcdb.Molecule.

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_coordinates(coord)[source]
transform_coordinates2(coord)[source]
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.

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_orca(options)[source]

Function to take the full snapshot of the liboptions object encoded in dictionary options, find the options directable toward Orca (options[‘ORCA’][‘ORCA_**’]) that aren’t default, then write an ORCA 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.

prepare_options_for_qchem(options)[source]

Function to take the full snapshot of the liboptions object encoded in dictionary options, find the options directable toward Q-Chem (options[‘QCHEM’][‘QCHEM_**’]) that aren’t default, then write a Q-Chem deck with those options.

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.

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']
Z(atom)[source]

Nuclear charge of atom (0-indexed)

>>> print H2OH2O.Z(4)
1
activate_all_fragments()[source]

Sets all fragments in the molecule to be active.

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_entry(atom)[source]

Returns the CoordEntry for an atom.

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
clear()[source]

Zero it out.

clear_basis_all_atoms()[source]

Remove all basis information from atoms.

clone()[source]

Returns new, independent Molecule object.

>>> dimer = H2OH2O.clone()
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.

deactivate_all_fragments()[source]

Sets all fragments in the molecule to be inactive.

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
equivalent(iuniq, j)[source]

Returns the j’th atom equivalent to iuniq.

everything()[source]

Quick print of class data

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
fZ(atom)[source]

Nuclear charge of atom (includes dummies)

>>> print H2OH2O.fZ(4)
8
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.

full_point_group_with_n()[source]

Return point group name such as Cnv or Sn.

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_inversion(origin, tol=1e-08)[source]

Does the molecule have an inversion center at origin

has_symmetry_element(op, tol=1e-08)[source]

NYI Whether molecule satisfies the vector symmetry operation op. Not used by libmints.

has_zmatrix()[source]

Gets the presence of any zmatrix entry

>>> print H2OH2O.has_zmatrix()
False
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')
irrep_labels()[source]

Returns the irrep labels

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_plane(origin, uperp, tol=1e-08)[source]

Is a plane?

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.

mass(atom)[source]

Returns mass of atom (0-indexed)

>>> print H2OH2O.mass(4)
1.00782503207
max_nequivalent()[source]

Returns the maximum number of equivalent atoms.

molecular_charge()[source]

Gets the molecular charge

>>> print H2OH2O.molecular_charge()
-2
move_to_com()[source]

Moves molecule to center of mass

multiplicity()[source]

Get the multiplicity (defined as 2Ms + 1)

>>> print H2OH2O.multiplicity()
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
nallatom()[source]

Number of all atoms (includes dummies)

>>> print H2OH2O.nallatom()
7
name()[source]

Get molecule name

>>> print H2OH2O.name()
water_dimer
natom()[source]

Number of atoms

>>> print H2OH2O.natom()
6
nequivalent(iuniq)[source]

Returns the number of atoms equivalent to iuniq.

nfragments()[source]

The number of fragments in the molecule.

>>> print H2OH2O.nfragments()
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]]
nuclear_repulsion_energy_deriv2()[source]

NYI Computes nuclear repulsion energy second derivatives

nunique()[source]

Return the number of unique atoms.

orientation_fixed()[source]

Get whether or not orientation is fixed.

>>> H2OH2O.orientation_fixed()
True
point_group()[source]

Returns the point group (object) if set

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_in_input_format()[source]

Print the molecule in the same format that the user provided.

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)

release_symmetry_information()[source]

Release symmetry information

reset_point_group(pgname)[source]

Override symmetry from outside the molecule string

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

rotor_type(tol=1e-08)[source]

Returns the rotor type.

>>> H2OH2O.rotor_type()
RT_ASYMMETRIC_TOP
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)

save_xyz(filename, save_ghosts=True)[source]

Save an XYZ file.

>>> H2OH2O.save_xyz('h2o.xyz')
schoenflies_symbol()[source]

Returns the Schoenflies symbol

set_active_fragment(fr)[source]

Tags fragment index fr as composed of real atoms.

set_active_fragments(reals)[source]

Tags the fragments in array reals as composed of real atoms.

set_basis_all_atoms(name, role='BASIS')[source]

Assigns basis name to all atoms.

set_basis_by_label(label, name, role='BASIS')[source]

Assigns basis name to all atoms with label.

set_basis_by_number(number, name, role='BASIS')[source]

Assigns basis name to atom number number (0-indexed, excludes dummies).

set_basis_by_symbol(symbol, name, role='BASIS')[source]

Assigns basis name to all symbol atoms.

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. self.PYfull_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_ghost_fragment(fr)[source]

Tags fragment index fr as composed of ghost atoms.

set_ghost_fragments(ghosts)[source]

Tags the fragments in array ghosts as composed of ghost atoms.

set_has_zmatrix(tf)[source]

Sets the presence of any zmatrix entry

>>> H2OH2O.set_has_zmatrix(True)
set_molecular_charge(charge)[source]

Sets the molecular charge

>>> H2OH2O.set_molecular_charge(-2)
set_multiplicity(mult)[source]

Sets the multiplicity (defined as 2Ms + 1)

>>> H2OH2O.set_multiplicity(3)
set_name(name)[source]

Set molecule name

>>> H2OH2O.set_name('water_dimer')
set_point_group(pg)[source]

Set the point group to object pg

set_shell_by_number(number, bshash, role='BASIS')[source]

Assigns BasisSet bshash to atom number number (0-indexed, excludes dummies).

set_units(units)[source]

Sets the geometry units

>>> H2OH2O.set_units('Angstom')
set_variable(vstr, val)[source]

Assigns the value val to the variable labelled string in the list of geometry variables. Also calls update_geometry()

sym_label()[source]

Returns the symmetry label

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
translate(r)[source]

Translates molecule by r.

>>> H2OH2O.translate([1.0, 1.0, 0.0])
unique(iuniq)[source]

Returns the overall number of the iuniq’th unique atom.

units()[source]

Gets the geometry units

>>> print H2OH2O.units()
Angstrom
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
valid_atom_map(tol=0.01)[source]

Check if current geometry fits current point group

x(atom)[source]

x position of atom (0-indexed) in Bohr

>>> print H2OH2O.x(4)
3.17549201425
xyz(atom, posn=None)[source]

Returns a Vector3 with x, y, z position of atom (0-indexed) in Bohr or coordinate at posn

>>> print H2OH2O.xyz(4)
[3.175492014248769, -0.7062681346308132, -1.4334725450878665]
y(atom)[source]

y position of atom (0-indexed) in Bohr

>>> print H2OH2O.y(4)
-0.706268134631
z(atom)[source]

z position of atom (0-indexed) in Bohr

>>> print H2OH2O.z(4)
-1.43347254509
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

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, exitonfail=True)[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 unless exitonfail False, in which case returns error message. 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.

findfile_ignorecase(fil, pre='', post='')[source]

Function to locate a file pre + fil + post in any possible lettercase permutation of fil. Returns pre + fil + post if available, None if not.

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.

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.

nprimitive()[source]

The number of primitive Gaussians

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)

am()[source]

The angular momentum of the given contraction

amchar()[source]

The character symbol for the angular momentum of the given contraction

center()[source]

Returns the center of the Molecule this shell is on

coef(pi)[source]

Return coefficient of pi’th primitive

coefs()[source]

Return coefficient of pi’th primitive and ci’th contraction

contraction_normalization()[source]

Normalizes an entire contraction set. Applies the normalization to the coefficients * @param gs The contraction set to normalize.

copy(nc=None, c=None)[source]

Make a copy of the ShellInfo

erd_coef(pi)[source]

Return ERD normalized coefficient of pi’th primitive

erd_normalize_shell()[source]
exp(prim)[source]

Returns the exponent of the given primitive

exps()[source]

Returns the exponent of the given primitive

function_index()[source]

Basis function index where this shell starts.

is_cartesian()[source]

Returns true if contraction is Cartesian

is_pure()[source]

Returns true if contraction is pure

ncartesian()[source]

Total number of functions if this shell was Cartesian

ncenter()[source]

Returns the atom number this shell is on. Used by integral derivatives for indexing.

nfunction()[source]

Total number of basis functions

normalize(l, m, n)[source]

Normalize the angular momentum component

normalize_shell()[source]

Handles calling primitive_normalization and contraction_normalization for you.

nprimitive()[source]

The number of primitive Gaussians

original_coef(pi)[source]

Return unnormalized coefficient of pi’th primitive

original_coefs()[source]

Return unnormalized coefficient of pi’th primitive and ci’th contraction

primitive_normalization(p)[source]

Normalizes a single primitive. @param p The primitive index to normalize. @return Normalization constant to be applied to the primitive.

pyprint(outfile=None)[source]

Print out the shell

pyprint_gamess(outfile=None)[source]

Print out the shell in Gamess format

set_function_index(i)[source]

Set basis function index where this shell starts.

df(n)[source]

Gives the double factorial of n

Module containing functions that, when passed a qcdb.WrappedDatabase 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. Second line of docstring becomes tagl.

genset_DDn5min(dbinstance)[source]

DD-5min near-equilibrium systems also in dd

genset_HBn5min(dbinstance)[source]

HB-5min near-equilibrium systems also in hb

genset_MXDDNPn5min(dbinstance)[source]

MXDDNP-5min near-equilibrium systems also in mxddnp

genset_MXDDPPn5min(dbinstance)[source]

MXDDPP-5min near-equilibrium systems also in mxddpp

genset_MXn5min(dbinstance)[source]

MX-5min near-equilibrium systems also in mx

genset_MXuDD(dbinstance)[source]

mxdd near-equilibrium systems also in mxdd

genset_allneutral(dbinstance)[source]

neutral systems where all components are neutral

genset_anyanion(dbinstance)[source]

anion systems where any component is an anion

genset_anycation(dbinstance)[source]

cation systems where any component is a cation

sapt_psivars()[source]

Returns dictionary of PsiVariable definitions.

class Infile(mem, mol, mtd, der, opt)[source]
format_infile_string()[source]
muster_basis_options()[source]
prepare_basis_for_molpro()[source]
harvest_output(outtext)[source]

Function to read MRCC output file outtext and parse important quantum chemical information from it in

muster_cdsgroup_options(name)[source]
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.

psi4_list()[source]

Return an array of Psi4 methods with energies.

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.

load_file(filename, basisname=None)[source]

Load and return the file to be used by parse. Return only portion of filename pertaining to basisname if specified (for multi-basisset files) otherwise entire file as list of strings.

parse(symbol, dataset)[source]

Given a string, parse for the basis set needed for atom. * @param symbol atom symbol to look for in dataset * @param dataset data set to look through dataset can be list of lines or a single string which will be converted to list of lines

getrec(reclabelarray, verbose=False)[source]

Reads binary files JOBARC and JAINDX and returns contents of each record in reclabelarray.

class Infile(mem, mol, mtd, der, opt)[source]
format_infile_string()[source]
harvest_output(outtext)[source]

Function to separate portions of a Psi4 output file outtext.

muster_cdsgroup_options()[source]
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).

psi4_list()[source]

Return an array of Psi4 methods with energies.

Elemental masses (most common isotope), symbols, and atomic numbers from psi4.

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.

add(v, u)[source]

Compute sum of vectors v and u.

cross(v, u)[source]

Compute cross product of length 3 vectors v and u.

determinant(mat)[source]

Given 3x3 matrix mat, compute the determinat

diagonalize3x3symmat(M)[source]

Given an real symmetric 3x3 matrix M, compute the eigenvalues

distance(v, u)[source]

Compute the distance between points defined by vectors v and u.

dot(v, u)[source]

Compute dot product of vectors v and u.

identity(m)[source]

Create identity matrix

matadd(matrix1, matrix2, fac1=1.0, fac2=1.0)[source]

Matrix addition

mscale(matrix, d)[source]

Return matrix scaled by scalar d

mult(matrix1, matrix2)[source]

Matrix multiplication

naivemult(v, u)[source]

Compute by-element multiplication of vectors v and u.

norm(v)[source]

Compute the magnitude of vector v.

normalize(v)[source]

Compute normalized vector v.

perp_unit(u, v)[source]

Compute unit vector perpendicular to length 3 vectors u and v.

rotate(v, theta, axis)[source]

Rotate length 3 vector v about axis by theta radians.

scale(v, d)[source]

Compute by-element scale by d of vector v.

show(matrix)[source]

Print out matrix

sub(v, u)[source]

Compute difference of vectors v - u.

transpose(matrix)[source]

Return matrix transpose

zero(m, n)[source]

Create zero matrix

class MolproIn(mem, mtd, bas, mol, sys, cast)[source]
format_basis()[source]
format_global_parameters()[source]
format_infile_string()[source]

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'], view=True)[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, view=True, 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='/scratch/cdsgroup/conda-builds/work/build/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, xlines=[0.0, 0.3, 1.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='', xtitle='', xlimit=2.0, view=True, saveas=None, relpath=False, graphicsformat=['pdf'])[source]

Saves a plot with (extensionless) name pltfile with an Iowa representation of the modelchems errors in mcdat for BBI/SSI-style labels.

liliowa(mcdat, title='', xlimit=2.0, view=True, saveas=None, relpath=False, graphicsformat=['pdf'])[source]

Saves a plot with a heatmap representation of mcdat.

segment_color(argcolor, saptcolor)[source]

Find appropriate color expression between overall color directive argcolor and particular color availibility rxncolor.

ternary(sapt, title='', labeled=True, view=True, saveas=None, relpath=False, graphicsformat=['pdf'])[source]

Takes array of arrays sapt in form [elst, indc, disp] and builds formatted two-triangle ternary diagrams. Either fully-readable or dotsonly depending on labeled. Saves in formats graphicsformat.

threads(data, labels, color=None, title='', xlimit=4.0, mae=None, mape=None, mousetext=None, mouselink=None, mouseimag=None, mousetitle=None, mousediv=None, labeled=True, view=True, 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

valerr(data, color=None, title='', xtitle='', view=True, saveas=None, relpath=False, graphicsformat=['pdf'])[source]

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.

clone()[source]

Returns new, independent CartesianEntry object

compute()[source]

Computes the values of the coordinates (in whichever units were inputted), returning them in a Vector

everything()[source]
invalidate()[source]

Flags the current coordinates as being outdated.

print_in_input_format()[source]

Prints the updated geometry, in the format provided by the user.

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.

set_coordinates(x, y, z)[source]

Given the current set of coordinates, updates the values of this atom’s coordinates and any variables that may depend on it.

type()[source]

The type of CoordEntry specialization.

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.

Z()[source]

The nuclear charge of the current atom (0 if ghosted).

static a(a1, a2, a3)[source]

Computes the angle (in rad.) between three sets of coordinates.

basisset(role='BASIS')[source]

Returns the basis name for the provided type. * @param type Keyword from input file. * @returns the value from input.

basissets()[source]

Returns basisset to atom map

charge()[source]

The “atomic charge” of the current atom (for SAD purposes).

static d(a1, a2, a3, a4)[source]

Computes the dihedral (in rad.) between four sets of coordinates.

entry_number()[source]

The order in which this appears in the full atom list.

everything()[source]
is_computed()[source]

Whether the current atom’s coordinates are up-to-date.

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.

is_ghosted()[source]

Whether the current atom is ghosted or not.

label()[source]

The atom label.

mass()[source]

The atomic mass of the current atom.

static r(a1, a2)[source]

Computes the distance between two sets of coordinates

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_ghosted(gh)[source]

Flag the atom as either ghost or real.

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

shell(key='BASIS')[source]

Returns the hash for the provided type. * @param type Keyword from input file. * @returns the hash string for basis.

shells()[source]

Returns shells sets to atom map

symbol()[source]

The atomic symbol.

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.

everything()[source]
fixed()[source]

Get whether the coordinate value is fixed or not

invalidate()[source]

Flag the current value as outdated

set_fixed(fixed)[source]

Set whether the coordinate value is fixed or not

class NumberValue(value, fixed=False)[source]

Specialization of CoordValue that is simply a number to be stored.

clone()[source]

Returns new, independent NumberValue object

compute()[source]

Computes value of coordinate from member data

everything()[source]
rset(val)[source]

Resets value of coordinate if not fixed

type()[source]

Gets specialization type of CoordValue

variable_to_string(precision)[source]

Takes a CoordValue object, and returns a string for printing.

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.

clone()[source]

Returns new, independent VariableValue object

compute()[source]

Computes value of coordinate from member data

everything()[source]
name()[source]

Gets the name of the variable

negated()[source]

Gets whether the coordinate value is actually the negative of the variable value

rset(val)[source]

Resets value of coordinate if not fixed

type()[source]

Gets specialization type of CoordValue

variable_to_string(precision)[source]

Takes a CoordValue object, and returns a string for printing.

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.

clone()[source]

Returns new, independent ZMatrixEntry object.

compute()[source]

Compute the Cartesian coordinates in Bohr of current atom’s entry.

everything()[source]
invalidate()[source]

Flags the current coordinates as being outdated

print_in_input_format()[source]

Prints the updated geometry, in the format provided by the user

print_in_input_format_cfour()[source]

Prints the updated geometry, in the format provided by the user

set_coordinates(x, y, z)[source]

Given the current set of coordinates, updates the values of this atom’s coordinates, and any variables that may depend on it.

type()[source]

The type of CoordEntry specialization.

bond_profile(self)[source]

Obtain bonding topology of molecule

missing_bonds(bonds, bond_tree, at_types)[source]

Determine number of bonds missing for each atom

missing_neighbors(bond_tree, n_missing)[source]

Determine number of neighboring atoms missing bonds for each atom

xyz2mol(self)[source]

Returns a string of Molecule formatted for mol2.

Written by Trent M. Parker 9 Jun 2014

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.

add_rifit_default(fit)[source]

Function to add basis fit as associated fitting basis member ridef to a BasisFamily object.

name()[source]

Function to return the ornate name of the orbital basis, e.g., 6-311++G** for 6-311ppgss.

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, + into p, * into s, 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 to facilitate quantum chemical computations on chemical databases. Contains Molecule class and physical constants from psi4 suite.

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.

load_basfam_dunning()[source]
begin_latex_document()[source]

Returns array of lines at start of LaTeX file that enable it to be compiled as its own document (standalone).

count(kw)[source]
empty(kw)[source]
end_latex_document()[source]

Returns array of lines at end of LaTeX file that enable it to be compiled as its own document (standalone).

flat(kw)[source]
graphics(kw)[source]
iteritems(d)[source]
itervalues(d)[source]
label(kw)[source]
label2(kw)[source]

This and fancy_mc_archive are experimental alternative for summoning up col/row headers. Safe so long as mtd/bas/opt have orthogonal keys.

liliowa(kw)[source]
lmtdbas(kw)[source]
table_generic(dbse, serrors, mtd, bas, columnplan, rowplan=['bas', 'mtd'], opt=['CP'], err=['mae'], sset=['default'], landscape=False, standalone=True, subjoin=True, suppressblanks=False, footnotes=[], title='', indextitle='', plotpath='', theme='')[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.

val(kw)[source]

p4util

array_to_matrix

classmethod(function) -> method

Convert a function to be a class method.

A class method receives the class as implicit first argument, just like an instance method receives the instance. To declare a class method, use this idiom:

class C:
def f(cls, arg1, arg2, ...): ... f = classmethod(f)

It can be called either on the class (e.g. C.f()) or on an instance (e.g. C().f()). The instance is ignored except for its class. If a class method is called for a derived class, the derived class object is passed as the implied first argument.

Class methods are different than C++ or Java static methods. If you want those, see the staticmethod builtin.

Module with commands building BasisFamily objects for Pople and other non-Dunning orbital basis sets. Some plausible fitting basis sets are supplied as defaults.

load_basfam_other()[source]
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.

absolute_to_relative(Factor=627.5095)[source]

Function to shift the data of each column of the Table object such that the lowest value is zero. A scaling factor of Factor is applied.

copy()[source]

Function to return a copy of the Table object.

format_label()[source]

Function to pad the width of Table object labels.

format_values(values)[source]

Function to pad the width of Table object data cells.

save(file)[source]

Function to save string of the Table object to file.

scale(Factor=627.5095)[source]

Function to apply a scaling factor Factor to the data of the Table object.

banner(text, type=1, width=35, strNotOutfile=False)[source]

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.

levenshtein(seq1, seq2)[source]

Function to compute the Levenshtein distance between two strings.

print_stderr(stuff)[source]

Function to print stuff to standard error stream.

print_stdout(stuff)[source]

Function to print stuff to standard output stream.

Module with non-generic exceptions classes.

exception CSXError(msg)[source]

Error called when CSX generation fails.

exception Dftd3Error(msg)[source]
exception ManagedMethodError(circs)[source]
exception ParsingError(msg)[source]

Error called for problems parsing a text file. Prints error message msg to standard output stream and output file.

exception PsiException[source]

Error class for Psi.

exception PsiImportError(msg)[source]

Error called for problems import python dependencies. Prints error message msg to standard output stream and output file.

exception TestComparisonError(msg)[source]

Error called when a test case fails due to a failed compare_values() call. Prints error message msg to standard output stream and output file.

exception ValidationError(msg)[source]

Error called for problems with the input file. Prints error message msg to standard output stream and output file.

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'))
restore()[source]
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()
restore()[source]
class InPsight(molecule)[source]
atoms = []
azimuth = 0.0
bohr_per_ang = 1.8897161646320724
bond_width = 0.2
bonding_alpha = 0.65
bonds = []
colors = [[0, 0, 0], [255, 255, 255], [217, 255, 255], [204, 128, 255], [194, 255, 0], [255, 181, 181], [144, 144, 144], [48, 80, 248], [255, 13, 13], [144, 224, 80], [179, 227, 245], [171, 92, 242], [138, 255, 0], [191, 166, 166], [240, 200, 160], [255, 128, 0], [255, 255, 48], [31, 240, 31], [128, 209, 227], [143, 64, 212], [61, 255, 0], [230, 230, 230], [191, 194, 199], [166, 166, 171], [138, 153, 199], [156, 122, 199], [224, 102, 51], [240, 144, 160], [80, 208, 80], [200, 128, 51], [125, 128, 176], [194, 143, 143], [102, 143, 143], [189, 128, 227], [255, 161, 0], [166, 41, 41], [92, 184, 209], [112, 46, 176], [0, 255, 0], [148, 255, 255], [148, 224, 224], [115, 194, 201], [84, 181, 181], [59, 158, 158], [36, 143, 143], [10, 125, 140], [0, 105, 133], [192, 192, 192], [255, 217, 143], [166, 117, 115], [102, 128, 128], [158, 99, 181], [212, 122, 0], [148, 0, 148], [66, 158, 176], [87, 23, 143], [0, 201, 0], [112, 212, 255], [255, 255, 199], [217, 255, 199], [199, 255, 199], [163, 255, 199], [143, 255, 199], [97, 255, 199], [69, 255, 199], [48, 255, 199], [31, 255, 199], [0, 255, 156], [0, 230, 117], [0, 212, 82], [0, 191, 56], [0, 171, 36], [77, 194, 255], [77, 166, 255], [33, 148, 214], [38, 125, 171], [38, 102, 150], [23, 84, 135], [208, 208, 224], [255, 209, 35], [184, 184, 208], [166, 84, 77], [87, 89, 97], [158, 79, 181], [171, 92, 0], [117, 79, 69], [66, 130, 150], [66, 0, 102], [0, 125, 0], [112, 171, 250], [0, 186, 255], [0, 161, 255], [0, 143, 255], [0, 128, 255], [0, 107, 255], [84, 92, 242], [120, 92, 227], [138, 79, 227], [161, 54, 212], [179, 31, 212], [179, 31, 186], [179, 13, 166], [189, 13, 135], [199, 0, 102], [204, 0, 89], [209, 0, 79], [217, 0, 69], [224, 0, 56], [230, 0, 46], [235, 0, 38]]
defines = {'Shadows': 'false', 'Output_Alpha': 'true', 'Filepath': '/scratch/cdsgroup/conda-builds/work/build/doc/sphinxman', 'Output_File_Type': 'N', 'Antialias': 'true', 'Filename': 'inpsight', 'Light_Color': '<1,1,1>', 'Antialias_Threshold': '0.1', 'Background_Color': '<0.6,0.6,0.6>'}
elevation = 0.0
height = 900
light = [1.0, 0.0, 0.0]
light_color = [0.6, 0.6, 0.6]
location = [1.0, 0.0, 0.0]
look_at = [0.0, 0.0, 0.0]
position_camera()[source]
radial_scale = 0.25
radii = [2.0, 1.001, 1.012, 0.825, 1.408, 1.485, 1.452, 1.397, 1.342, 1.287, 1.243, 1.144, 1.364, 1.639, 1.716, 1.705, 1.683, 1.639, 1.595, 1.485, 1.474, 1.562, 1.562, 1.562, 1.562, 1.562, 1.562, 1.562, 1.562, 1.562, 1.562, 1.65, 1.727, 1.76, 1.771, 1.749, 1.727, 1.628, 1.606, 1.639, 1.639, 1.639, 1.639, 1.639, 1.639, 1.639, 1.639, 1.639, 1.639, 1.672, 1.804, 1.881, 1.892, 1.892, 1.881, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0]
right = [1.0, 0.0, 0.0]
save_density(filename='rho', overlap=2.0, n=[40, 40, 40], caxis=[0.0, 1.0])[source]
save_molecule(filename)[source]
set_camera(location, sky, up, right, look_at, light, light_color)[source]
set_color(Z, color)[source]
set_define(key, value)[source]
set_radius(Z, radius)[source]
set_size(width, height)[source]
set_view(azimuth, elevation, zoom=0.7)[source]
sky = [0.0, -1.0, 0.0]
up = [0.0, 0.75, 0.0]
update_geometry()[source]
width = 1200
zoom = 0.5

Module with utility functions for use in input files.

compare_arrays(expected, computed, digits, label)[source]

Function to compare two numpy arrays. 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.

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.

cubeprop(wfn, **kwargs)[source]

Evaluate properties on a grid and generate cube files.

New in version 0.5: wfn parameter passed explicitly

Returns:None
Parameters:wfn (Wavefunction) – set of molecule, basis, orbitals from which to generate cube files
Examples:
>>> # [1] Cube files for all orbitals
>>> E, wfn = energy('b3lyp', return_wfn=True)
>>> cubeprop(wfn)
>>> # [2] Cube files for density (alpha, beta, total, spin) and four orbitals 
>>> #     (two alpha, two beta)
>>> set cubeprop_tasks ['orbitals', 'density']
>>> set cubeprop_orbitals [5, 6, -5, -6]
>>> E, wfn = energy('scf', return_wfn=True)
>>> cubeprop(wfn)
getFromDict(dataDict, mapList)[source]
get_memory()[source]

Function to return the total memory allocation.

get_num_threads()[source]

Function to return the number of threads to parallelize across.

oeprop(wfn, *args, **kwargs)[source]

Evaluate one-electron properties.

Returns:None
Parameters:wfn (Wavefunction) – set of molecule, basis, orbitals from which to compute properties

How to specify args, which are actually the most important

Parameters:title (string) – label prepended to all psivars computed
Examples:
>>> # [1] Moments with specific label
>>> E, wfn = energy('hf', return_wfn=True)
>>> oeprop(wfn, 'DIPOLE', 'QUADRUPOLE', title='H3O+ SCF')
set_memory(bytes)[source]

Function to reset the total memory allocation.

set_num_threads(nthread)[source]

Function to reset the number of threads to parallelize across.

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.

array_to_matrix

classmethod(function) -> method

Convert a function to be a class method.

A class method receives the class as implicit first argument, just like an instance method receives the instance. To declare a class method, use this idiom:

class C:
def f(cls, arg1, arg2, ...): ... f = classmethod(f)

It can be called either on the class (e.g. C.f()) or on an instance (e.g. C().f()). The instance is ignored except for its class. If a class method is called for a derived class, the derived class object is passed as the implied first argument.

Class methods are different than C++ or Java static methods. If you want those, see the staticmethod builtin.

to_array(matrix, copy=True, dense=False)[source]

Converts a Psi4 Matrix or Vector to a numpy array. Either copies the data or simply consturcts a view.

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.

expand_psivars(pvdefs)[source]

Dictionary pvdefs has keys with names of PsiVariables to be created and values with dictionary of two keys: ‘args’, the PsiVariables that contribute to the key and ‘func’, a function (or lambda) to combine them. This function builds those PsiVariables if all the contributors are available. Helpful printing is available when PRINT > 2.

extract_sowreap_from_output(sowout, quantity, sownum, linkage, allvital=False, label='electronic energy')[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 is True) 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='', forcexyz=False)[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, see molutil.geometry().

format_options_for_input(molecule=None, **kwargs)[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='8619')[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. Also turns boolean-like values into actual booleans. Also turns values lowercase if sensible.

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 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.

add_rifit(fit)[source]

Function to add basis fit as associated fitting basis member rifit to a BasisFamily object.

name()[source]

Function to return the ornate name of the orbital basis, e.g., 6-311++G** for 6-311ppgss.

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, + into p, * into s, and (, ), & , into _.

array_to_matrix

classmethod(function) -> method

Convert a function to be a class method.

A class method receives the class as implicit first argument, just like an instance method receives the instance. To declare a class method, use this idiom:

class C:
def f(cls, arg1, arg2, ...): ... f = classmethod(f)

It can be called either on the class (e.g. C.f()) or on an instance (e.g. C().f()). The instance is ignored except for its class. If a class method is called for a derived class, the derived class object is passed as the implied first argument.

Class methods are different than C++ or Java static methods. If you want those, see the staticmethod builtin.

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.

load_basfam_dunning()[source]

p4const

procedures

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.

run_cfour_module(xmod)[source]
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' || \Rightarrow 'off' \Leftarrow

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.

vpt2_sow_files(item, linkage, isC4notP4, isC4fully, zmat, inputSansMol, inputGenbas)[source]

Provided with the particular displacement number item and the associated zmat file contents and linkage, and common contents inputSansMol, returns contents of input file to be sown.

Module with a procedures dictionary specifying available quantum chemical methods.

Module to provide lightweight definitions of functionals and SuperFunctionals

build_b2plyp_superfunctional(name, npoints, deriv)[source]
build_b2plypd2gr_superfunctional(name, npoints, deriv)[source]
build_b2plypd2p4_superfunctional(name, npoints, deriv)[source]
build_b2plypd3bj_superfunctional(name, npoints, deriv)[source]
build_b2plypd3mbj_superfunctional(name, npoints, deriv)[source]
build_b2plypd3mzero_superfunctional(name, npoints, deriv)[source]
build_b2plypd3zero_superfunctional(name, npoints, deriv)[source]
build_b3_x_functional(name)[source]
build_b3lyp5_superfunctional(name, npoints, deriv)[source]
build_b3lyp5d2gr_superfunctional(name, npoints, deriv)[source]
build_b3lyp5d2p4_superfunctional(name, npoints, deriv)[source]
build_b3lyp5d3bj_superfunctional(name, npoints, deriv)[source]
build_b3lyp5d3mbj_superfunctional(name, npoints, deriv)[source]
build_b3lyp5d3mzero_superfunctional(name, npoints, deriv)[source]
build_b3lyp5d3zero_superfunctional(name, npoints, deriv)[source]
build_b3lyp_superfunctional(name, npoints, deriv)[source]
build_b3lypchg_superfunctional(name, npoints, deriv)[source]
build_b3lypd1_superfunctional(name, npoints, deriv)[source]
build_b3lypd2gr_superfunctional(name, npoints, deriv)[source]
build_b3lypd2p4_superfunctional(name, npoints, deriv)[source]
build_b3lypd3bj_superfunctional(name, npoints, deriv)[source]
build_b3lypd3mbj_superfunctional(name, npoints, deriv)[source]
build_b3lypd3mzero_superfunctional(name, npoints, deriv)[source]
build_b3lypd3zero_superfunctional(name, npoints, deriv)[source]
build_b88_x_functional(name)[source]
build_b970_superfunctional(name, npoints, deriv)[source]
build_b971_superfunctional(name, npoints, deriv)[source]
build_b972_superfunctional(name, npoints, deriv)[source]
build_b97_x_functional(name)[source]
build_b97d2gr_superfunctional(name, npoints, deriv)[source]
build_b97d2p4_superfunctional(name, npoints, deriv)[source]
build_b97d3bj_superfunctional(name, npoints, deriv)[source]
build_b97d3mbj_superfunctional(name, npoints, deriv)[source]
build_b97d3mzero_superfunctional(name, npoints, deriv)[source]
build_b97d3zero_superfunctional(name, npoints, deriv)[source]
build_blyp_superfunctional(name, npoints, deriv)[source]
build_blypd1_superfunctional(name, npoints, deriv)[source]
build_blypd2gr_superfunctional(name, npoints, deriv)[source]
build_blypd2p4_superfunctional(name, npoints, deriv)[source]
build_blypd3bj_superfunctional(name, npoints, deriv)[source]
build_blypd3mbj_superfunctional(name, npoints, deriv)[source]
build_blypd3mzero_superfunctional(name, npoints, deriv)[source]
build_blypd3zero_superfunctional(name, npoints, deriv)[source]
build_bp86_superfunctional(name, npoints, deriv)[source]
build_bp86d1_superfunctional(name, npoints, deriv)[source]
build_bp86d2gr_superfunctional(name, npoints, deriv)[source]
build_bp86d2p4_superfunctional(name, npoints, deriv)[source]
build_bp86d3bj_superfunctional(name, npoints, deriv)[source]
build_bp86d3mbj_superfunctional(name, npoints, deriv)[source]
build_bp86d3mzero_superfunctional(name, npoints, deriv)[source]
build_bp86d3zero_superfunctional(name, npoints, deriv)[source]
build_dldf_superfunctional(name, npoints, deriv)[source]
build_dldfd09_superfunctional(name, npoints, deriv)[source]
build_dldfd_superfunctional(name, npoints, deriv)[source]
build_dsd_blyp_superfunctional(name, npoints, deriv)[source]
build_dsd_pbep86_superfunctional(name, npoints, deriv)[source]
build_dsd_pbepbe_superfunctional(name, npoints, deriv)[source]
build_ft97_superfunctional(name, npoints, deriv)[source]
build_functional(alias)[source]
build_hcth120_superfunctional(name, npoints, deriv)[source]
build_hcth120d3bj_superfunctional(name, npoints, deriv)[source]
build_hcth120d3zero_superfunctional(name, npoints, deriv)[source]
build_hcth147_superfunctional(name, npoints, deriv)[source]
build_hcth407_superfunctional(name, npoints, deriv)[source]
build_hcth_superfunctional(name, npoints, deriv)[source]
build_hf_x_functional(name)[source]
build_hf_x_superfunctional(name, npoints, deriv)[source]
build_hfd_superfunctional(name, npoints, deriv)[source]
build_m05_2x_superfunctional(name, npoints, deriv)[source]
build_m05_2xd3zero_superfunctional(name, npoints, deriv)[source]
build_m05_superfunctional(name, npoints, deriv)[source]
build_m05d3zero_superfunctional(name, npoints, deriv)[source]
build_pbe0_2_superfunctional(name, npoints, deriv)[source]
build_pbe0_superfunctional(name, npoints, deriv)[source]
build_pbe0d2gr_superfunctional(name, npoints, deriv)[source]
build_pbe0d2p4_superfunctional(name, npoints, deriv)[source]
build_pbe0d3bj_superfunctional(name, npoints, deriv)[source]
build_pbe0d3mbj_superfunctional(name, npoints, deriv)[source]
build_pbe0d3mzero_superfunctional(name, npoints, deriv)[source]
build_pbe0d3zero_superfunctional(name, npoints, deriv)[source]
build_pbe_superfunctional(name, npoints, deriv)[source]
build_pbe_x_functional(name)[source]
build_pbed1_superfunctional(name, npoints, deriv)[source]
build_pbed2gr_superfunctional(name, npoints, deriv)[source]
build_pbed2p4_superfunctional(name, npoints, deriv)[source]
build_pbed3bj_superfunctional(name, npoints, deriv)[source]
build_pbed3mbj_superfunctional(name, npoints, deriv)[source]
build_pbed3mzero_superfunctional(name, npoints, deriv)[source]
build_pbed3zero_superfunctional(name, npoints, deriv)[source]
build_pbesol_x_functional(name)[source]
build_primitive_functional(name)[source]
build_primitive_superfunctional(name, npoints, deriv)[source]
build_pw91_superfunctional(name, npoints, deriv)[source]
build_pw91_x_functional(name)[source]
build_revpbe_x_functional(name)[source]
build_rpbe_x_functional(name)[source]
build_s_x_functional(name)[source]
build_sogga_superfunctional(name, npoints, deriv)[source]
build_sogga_x_functional(name)[source]
build_superfunctional(alias, npoints, deriv)[source]
build_svwn_superfunctional(name, npoints, deriv)[source]
build_vwn3_c_functional(name)[source]
build_vwn3rpa_c_functional(name)[source]
build_vwn5_c_functional(name)[source]
build_vwn5rpa_c_functional(name)[source]
build_wb88_x_functional(name)[source]
build_wb88_x_superfunctional(name, npoints, deriv)[source]
build_wb97_superfunctional(name, npoints, deriv)[source]
build_wb97x_2lp_superfunctional(name, npoints, deriv)[source]
build_wb97x_2tqz_superfunctional(name, npoints, deriv)[source]
build_wb97x_superfunctional(name, npoints, deriv)[source]
build_wb97xd_superfunctional(name, npoints, deriv)[source]
build_wblyp_superfunctional(name, npoints, deriv)[source]
build_wpbe0_superfunctional(name, npoints, deriv)[source]
build_wpbe2_superfunctional(name, npoints, deriv)[source]
build_wpbe_c_superfunctional(name, npoints, deriv)[source]
build_wpbe_superfunctional(name, npoints, deriv)[source]
build_wpbe_x_functional(name)[source]
build_wpbe_x_superfunctional(name, npoints, deriv)[source]
build_wpbed3bj_superfunctional(name, npoints, deriv)[source]
build_wpbed3mbj_superfunctional(name, npoints, deriv)[source]
build_wpbed3mzero_superfunctional(name, npoints, deriv)[source]
build_wpbed3zero_superfunctional(name, npoints, deriv)[source]
build_wpbesol0_superfunctional(name, npoints, deriv)[source]
build_wpbesol_superfunctional(name, npoints, deriv)[source]
build_wpbesol_x_functional(name)[source]
build_wpbesol_x_superfunctional(name, npoints, deriv)[source]
build_wpw92_c_superfunctional(name, npoints, deriv)[source]
build_ws_x_functional(name)[source]
build_ws_x_superfunctional(name, npoints, deriv)[source]
build_wsvwn_superfunctional(name, npoints, deriv)[source]
functional_list()[source]
superfunctional_list()[source]
test_ccl_functional(functional, ccl_functional)[source]

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_list()[source]

Form list of Cfour energy() arguments.

cfour_psivar_list()[source]

Form dictionary of PSI Variables set by Cfour methods.

run_cfour(name, **kwargs)[source]

Function that prepares environment and input files for a calculation calling Stanton and Gauss’s CFOUR code. Also processes results back into Psi4 format.

This function is not called directly but is instead called by energy() or optimize() when a Cfour method is requested (through name argument). In order to function correctly, the Cfour executable xcfour must be present in PATH or PSIPATH.

  • Many PSI Variables extracted from the Cfour output
  • Python dictionary of associated file constants accessible as P4C4_INFO['zmat'], P4C4_INFO['output'], P4C4_INFO['grd'], etc.
Parameters:
  • name (string) –

    'c4-scf' || 'c4-ccsd(t)' || 'cfour' || etc.

    First argument, usually unlabeled. Indicates the computational method to be applied to the system.

  • keep (boolean) –

    'on' || \Rightarrow 'off' \Leftarrow

    Indicates whether to delete the Cfour scratch directory upon completion of the Cfour job.

  • path (string) –

    Indicates path to Cfour scratch directory (with respect to Psi4 scratch directory). Otherwise, the default is a subdirectory within the Psi4 scratch directory.

    If specified, GENBAS and/or ZMAT within will be used.

  • genbas (string) – Indicates that contents should be used for GENBAS file.

GENBAS is a complicated topic. It is quite unnecessary if the molecule is from a molecule {...} block and basis is set through Psi4‘s BASIS keyword. In that case, a GENBAS is written from LibMints and all is well. Otherwise, a GENBAS is looked for in the usual places: PSIPATH, PATH, PSIDATADIR/basis. If path kwarg is specified, also looks there preferentially for a GENBAS. Can also specify GENBAS within an input file through a string and setting the genbas kwarg. Note that due to the input parser’s aggression, blank lines need to be replaced by the text blankline.

write_zmat(name, dertype)[source]

Returns string with contents of Cfour ZMAT file as gathered from active molecule, current keyword settings, and cfour {...} block.

Module with functions that encode the sequence of PSI module calls for each of the name values of the energy(), optimize(), response(), and frequency() function. name can be assumed lowercase by here.

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_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_ccenergy_gradient(name, **kwargs)[source]

Function encoding sequence of PSI module calls for a CCSD and CCSD(T) gradient calculation.

run_cepa(name, **kwargs)[source]

Function encoding sequence of PSI module calls for a cepa-like calculation.

>>> energy('cepa(1)')
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_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_dfocc(name, **kwargs)[source]

Function encoding sequence of PSI module calls for a density-fitted or Cholesky-decomposed (non-)orbital-optimized MPN or CC computation.

run_dfocc_gradient(name, **kwargs)[source]

Function encoding sequence of PSI module calls for a density-fitted (non-)orbital-optimized MPN or CC computation.

run_dfocc_property(name, **kwargs)[source]

Function encoding sequence of PSI module calls for a density-fitted (non-)orbital-optimized MPN or CC 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_dft_property(name, **kwargs)[source]

Function encoding sequence of PSI module calls for DFT calculations. This is a simple alias to run_scf() since DFT properties all handled through oeprop.

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.

>>> set cc_type df
>>> energy('fno-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_mcscf(name, **kwargs)[source]

Function encoding sequence of PSI module calls for a multiconfigurational self-consistent-field calculation.

run_mrcc(name, **kwargs)[source]

Function that prepares environment and input files for a calculation calling Kallay’s MRCC code.

run_occ(name, **kwargs)[source]

Function encoding sequence of PSI module calls for a conventional integral (O)MPN computation

run_occ_gradient(name, **kwargs)[source]

Function encoding sequence of PSI module calls for a conventional integral (O)MPN computation

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_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.

scf_helper(name, **kwargs)[source]

Function serving as helper to SCF, choosing whether to cast up or just run SCF with a standard guess. This preserves previous SCF options set by other procedures (e.g., SAPT output file types for SCF).

select_ccsd(name, **kwargs)[source]

Function selecting the algorithm for a CCSD energy call and directing to specified or best-performance default modules.

select_ccsd_at_(name, **kwargs)[source]

Function selecting the algorithm for a CCSD(AT) energy call and directing to specified or best-performance default modules.

select_ccsd_gradient(name, **kwargs)[source]

Function selecting the algorithm for a CCSD gradient call and directing to specified or best-performance default modules.

select_ccsd_t_(name, **kwargs)[source]

Function selecting the algorithm for a CCSD(T) energy call and directing to specified or best-performance default modules.

select_ccsd_t__gradient(name, **kwargs)[source]

Function selecting the algorithm for a CCSD(T) gradient call and directing to specified or best-performance default modules.

select_cisd(name, **kwargs)[source]

Function selecting the algorithm for a CISD energy call and directing to specified or best-performance default modules.

select_fnoccsd(name, **kwargs)[source]

Function selecting the algorithm for a FNO-CCSD energy call and directing to specified or best-performance default modules.

select_fnoccsd_t_(name, **kwargs)[source]

Function selecting the algorithm for a FNO-CCSD(T) energy call and directing to specified or best-performance default modules.

select_lccd(name, **kwargs)[source]

Function selecting the algorithm for a LCCD energy call and directing to specified or best-performance default modules.

select_lccd_gradient(name, **kwargs)[source]

Function selecting the algorithm for a LCCD gradient call and directing to specified or best-performance default modules.

select_mp2(name, **kwargs)[source]

Function selecting the algorithm for a MP2 energy call and directing to specified or best-performance default modules.

select_mp2_gradient(name, **kwargs)[source]

Function selecting the algorithm for a MP2 gradient call and directing to specified or best-performance default modules.

select_mp2_property(name, **kwargs)[source]

Function selecting the algorithm for a MP2 property call and directing to specified or best-performance default modules.

select_mp2p5(name, **kwargs)[source]

Function selecting the algorithm for a MP2.5 energy call and directing to specified or best-performance default modules.

select_mp2p5_gradient(name, **kwargs)[source]

Function selecting the algorithm for a MP2.5 gradient call and directing to specified or best-performance default modules.

select_mp3(name, **kwargs)[source]

Function selecting the algorithm for a MP3 energy call and directing to specified or best-performance default modules.

select_mp3_gradient(name, **kwargs)[source]

Function selecting the algorithm for a MP3 gradient call and directing to specified or best-performance default modules.

select_mp4(name, **kwargs)[source]

Function selecting the algorithm for a MP4 energy call and directing to specified or best-performance default modules.

select_olccd(name, **kwargs)[source]

Function selecting the algorithm for an OLCCD energy call and directing to specified or best-performance default modules.

select_olccd_gradient(name, **kwargs)[source]

Function selecting the algorithm for an OLCCD gradient call and directing to specified or best-performance default modules.

select_omp2(name, **kwargs)[source]

Function selecting the algorithm for an OMP2 energy call and directing to specified or best-performance default modules.

select_omp2_gradient(name, **kwargs)[source]

Function selecting the algorithm for an OMP2 gradient call and directing to specified or best-performance default modules.

select_omp2_property(name, **kwargs)[source]

Function selecting the algorithm for an OMP2 property call and directing to specified or best-performance default modules.

select_omp2p5(name, **kwargs)[source]

Function selecting the algorithm for an OMP2.5 energy call and directing to specified or best-performance default modules.

select_omp2p5_gradient(name, **kwargs)[source]

Function selecting the algorithm for an OMP2.5 gradient call and directing to specified or best-performance default modules.

select_omp3(name, **kwargs)[source]

Function selecting the algorithm for an OMP3 energy call and directing to specified or best-performance default modules.

select_omp3_gradient(name, **kwargs)[source]

Function selecting the algorithm for an OMP3 gradient call and directing to specified or best-performance default modules.

check_iwl_file_from_scf_type(scf_type, wfn)[source]

Ensures that a IWL file has been written based on input SCF type.

check_non_symmetric_jk_density(name)[source]

Ensure non-symmetric density matrices are supported for the selected JK routine.

dft_set_reference_local(name)[source]

Figures out the correct DFT reference to set locally

oeprop_validator(prop_list)[source]

Validations a list of OEProp computations. Throws if not found

scf_set_reference_local(name)[source]

Figures out the correct SCF reference to set locally

run_roa(name, **kwargs)[source]

Main driver for managing Raman Optical activity computations with CC response theory.

Uses distributed finite differences approach –>
  1. Sets up a database to keep track of running/finished/waiting

    computations.

  2. Generates separate input files for displaced geometries.

  3. When all displacements are run, collects the necessary information

    from each displaced computation, and computes final result.