External API Objects

class psi4.driver.qcdb.Molecule(molinit=None, dtype=None, geom=None, elea=None, elez=None, elem=None, mass=None, real=None, elbl=None, name=None, units='Angstrom', input_units_to_au=None, fix_com=None, fix_orientation=None, fix_symmetry=None, fragment_separators=None, fragment_charges=None, fragment_multiplicities=None, molecular_charge=None, molecular_multiplicity=None, comment=None, provenance=None, connectivity=None, enable_qm=True, enable_efp=True, missing_enabled_return_qm='none', missing_enabled_return_efp='none', missing_enabled_return='error', tooclose=0.1, zero_ghost_fragments=False, nonphysical=False, mtol=0.001, verbose=1)[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

This class extends qcdb.LibmintsMolecule and occasionally psi4.core.Molecule itself.

class psi4.driver.ipi_broker.IPIBroker(LOT, options=None, serverdata=False, molecule=None)[source]

Interface implementation between i-PI (https://ipi-code.org/) and PSI4.

psi4.driver.wrapper_autofrag.auto_fragments(molecule=None, seed_atoms=None)[source]

Detects fragments in unfragmented molecule using BFS algorithm. Currently only used for the WebMO implementation of SAPT.

Parameters:
  • molecule (molecule, optional) – The target molecule, if not the last molecule defined.

  • seed_atoms (Optional[List[List[int]]]) – List of lists of atoms (0-indexed) belonging to independent fragments. Useful to prompt algorithm or to define intramolecular fragments through border atoms. Example: [[1, 0], [2]]

Return type:

Molecule

Returns:

  • Molecule – fragmented molecule in

  • Cartesian, fixed-geom (no variable values), no dummy-atom format.

Examples

>>> # [1] prepare unfragmented (and non-adjacent-atom) HHFF into (HF)_2 molecule ready for SAPT
>>> 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
psi4.driver.inputparser.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.

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.

Parameters:
  • raw_input (str) – Input in a mixture of Python and PSIthon syntax.

  • print_level (int) – raw_input is printed to the output file unless print_level =0.

Return type:

str

psi4.driver.frac.ip_fitting(name, omega_l=0.05, omega_r=2.5, omega_convergence=0.001, maxiter=20, **kwargs)[source]

Optimize DFT omega parameter for molecular system.

Parameters:
  • name (Union[str, Callable]) – DFT functional string name or function defining functional whose omega is to be optimized.

  • omega_l (float) – Minimum omega to be considered during fitting.

  • omega_r (float) – Maximum omega to be considered during fitting.

  • molecule (molecule, optional) – Target molecule (neutral) for which omega is to be tuned, if not last defined.

  • omega_convergence (float) – Threshold below which to consider omega converged. (formerly omega_tolerance)

  • maxiter (int) – Maximum number of iterations towards omega convergence.

Returns:

Optimal omega parameter.

Return type:

float

psi4.driver.frac.frac_traverse(name, **kwargs)[source]

Scan electron occupancy from +1 electron to -1.

Parameters:
  • name (Union[str, Callable]) – DFT functional string name or function defining functional whose omega is to be optimized.

  • molecule (molecule, optional) – Target molecule (neutral) for which omega is to be tuned, if not last defined.

  • cation_mult (Optional[int]) – Multiplicity of cation, if not neutral multiplicity + 1.

  • anion_mult (Optional[int]) – Multiplicity of anion, if not neutral multiplicity + 1.

  • frac_start (Optional[int]) – Iteration at which to start frac procedure when not reading previous guess. Defaults to 25.

  • HOMO_occs (Optional[List]) – Occupations to step through for cation, by default [1 - 0.1 * x for x in range(11)].

  • LUMO_occs (Optional[List]) – Occupations to step through for anion, by default [1 - 0.1 * x for x in range(11)].

  • HOMO (Optional[int]) – Index of HOMO.

  • LUMO (Optional[int]) – Index of LUMO.

  • frac_diis (Optional[bool]) – Do use DIIS for non-1.0-occupied points?

  • neutral_guess (Optional[bool]) – Do use neutral orbitals as guess for the anion?

  • hf_guess (Optional[bool]) – Do use UHF guess before UKS?

  • continuous_guess (Optional[bool]) – Do carry along guess rather than reguessing at each occupation?

  • filename (Optional[str]) – Result filename, if not name of molecule.

Returns:

Dictionary associating SCF energies with occupations.

Return type:

Dict[float, float]

psi4.driver.frac.frac_nuke(name, **kwargs)[source]

Pull all the electrons out, one at a time

Return type:

Dict[float, float]

Parameters:

name (Union[str, Callable]) –

psi4.set_output_file(ofile, append=False, *, loglevel=20, execute=True)[source]

Set the name for output and logging files.

Parameters:
  • ofile (str) – Name of ASCII output file including extension. The logging file is set from this string with a .log extension.

  • append (bool) – Do append to the output and logging files rather than (the default) truncating them?

  • loglevel (int) – The criticality level at which to log. 30 for WARN (Python default), 20 for INFO, 10 for DEBUG

  • execute (bool) – Do set ofile via psi4.core.set_output_file() and add the logger, rather than just returning ofile path.

Returns:

Path(ofile)

Return type:

Path

Notes

This psi4.set_output_file() command calls psi4.core.set_output_file() and should be used in preference to it as this additionally sets up logging.

pydantic model psi4.driver.task_base.BaseComputer[source]

Base class for “computers” that plan, run, and process QC tasks.

Show JSON schema
{
   "title": "BaseComputer",
   "description": "Base class for \"computers\" that plan, run, and process QC tasks.",
   "type": "object",
   "properties": {}
}

abstract compute()[source]
abstract plan()[source]
psi4.driver.task_planner.TaskComputers

alias of Union[AtomicComputer, CompositeComputer, FiniteDifferenceComputer, ManyBodyComputer]

psi4.driver.driver_nbody.SubTaskComputers

alias of Union[AtomicComputer, CompositeComputer, FiniteDifferenceComputer]

psi4.driver.task_planner.expand_cbs_methods(method, basis, driver, **kwargs)[source]

Sort out the user input method string into recognized fields. Handles cases like:

  1. "mp2" – passes through;

  2. "mp2/cc-pvdz" – broken into method and basis fields;

  3. "mp2/cc-pv[d,t]z" – processed into method=”cbs” & CBSMetadata spec;

  4. method="cbs", cbsmeta=CBSMetadata – passes through.

Parameters:
  • method (str) – User first argument to driver function. A string hint of the method – see cases above.

  • basis (str) – User basis hint.

  • driver (DriverEnum) – The calling driver function. Note for finite difference that this is the target driver, not the means driver.

Return type:

Tuple[str, str, Dict]

psi4.driver.task_planner.task_planner(driver, method, molecule, **kwargs)[source]

Plans a task graph of a complex computation.

Canonical Task layering:
  • ManyBody - BSSE treatment, many-body expansion

  • FiniteDifference - derivatives through stencils

  • Composite - basis set extrapolation, focal-point methods

  • Atomic - analytic single-points

Parameters:
  • driver (DriverEnum) – The resulting type of computation: e/g/h. Note for finite difference that this should be the target driver, not the means driver.

  • method (str) – A string representation of the method such as “HF” or “B3LYP”. Special cases are: “cbs”.

  • molecule (Molecule) – A Psi4 base molecule to use.

  • kwargs – User keyword arguments, often used to configure task computers.

Returns:

A simple (AtomicComputer) or layered (CompositeComputer, FiniteDifferenceComputer, ManyBodyComputer) task object. Layered objects contain many and multiple types of computers in a graph.

Return type:

Union[AtomicComputer, CompositeComputer, FiniteDifferenceComputer, ManyBodyComputer]