Geometry Optimization, optimize()
and gradient()
¶
 Psi4 Native Gradient Methods
 Psi4 Native DFT Gradient Methods (excepting doublehybrids)
 CFOUR Interfaced Gradient Methods
For further discussion of geometry optimization, see Sec. Geometry Optimization.
optimize()
is the only command most users will ever
need to access directly to perform geometry optimizations. Behind
the scenes, optimize()
is a wrapper that repeatedly
calls gradient()
that computes the gradient then adds a
call to the geometry projection module.

optimize
(name[, molecule, return_wfn, func, mode, dertype, hessian_with])[source]¶ Function to perform a geometry optimization.
Aliases: opt() Returns: float – Total electronic energy of optimized structure in Hartrees. Returns: (float, Wavefunction) – energy and wavefunction when return_wfn specified. PSI variables: Parameters:  name (string) –
'scf'
'mp2'
'ci5'
 etc.First argument, usually unlabeled. Indicates the computational method to be applied to the database. May be any valid argument to
energy()
.  molecule (molecule) –
h2o
 etc.The target molecule, if not the last molecule defined.
 return_wfn (boolean) –
'on'
'off'
Indicate to additionally return the Wavefunction calculation result as the second element (after float energy) of a tuple.
 func (function) –
gradient
energy
cbs
Indicates the type of calculation to be performed on the molecule. The default dertype accesses
'gradient'
or'energy'
, while'cbs'
performs a multistage finite difference calculation. If a nested series of python functions is intended (see Function Intercalls), use keywordopt_func
instead offunc
.  mode (string) –
'continuous'
'sow'
'reap'
For a finite difference of energies optimization, indicates whether the calculations required to complete the optimization are to be run in one file (
'continuous'
) or are to be farmed out in an embarrassingly parallel fashion ('sow'
/'reap'
). For the latter, run an initial job with'sow'
and follow instructions in its output file. For maximum flexibility,return_wfn
is always on in'reap'
mode.  dertype (dertype) –
'gradient'
'energy'
Indicates whether analytic (if available) or finite difference optimization is to be performed.
 hessian_with (string) –
'scf'
'mp2'
 etc.Indicates the computational method with which to perform a hessian analysis to guide the geometry optimization.
Warning
Optimizations where the molecule is specified in Zmatrix format with dummy atoms will result in the geometry being converted to a Cartesian representation.
Note
Analytic gradients area available for all methods in the table below. Optimizations with other methods in the energy table proceed by finite differences.
name calls method efp efponly optimizations scf Hartree–Fock (HF) or density functional theory (DFT) [manual] hf HF self consistent field (SCF) [manual] dcft density cumulant functional theory [manual] mp2 2ndorder MollerPlesset perturbation theory (MP2) [manual] [details] mp3 3rdorder MollerPlesset perturbation theory (MP3) [manual] [details] mp2.5 average of MP2 and MP3 [manual] [details] omp2 orbitaloptimized secondorder MP perturbation theory [manual] omp3 orbitaloptimized thirdorder MP perturbation theory [manual] omp2.5 orbitaloptimized MP2.5 [manual] lccd Linear CCD [manual] [details] olccd orbital optimized LCCD [manual] ccd coupled cluster doubles (CCD) [manual] ccsd coupled cluster singles and doubles (CCSD) [manual] [details] ccsd(t) CCSD with perturbative triples (CCSD(T)) [manual] [details] eomccsd equation of motion (EOM) CCSD [manual] name calls method DFT [manual] b3lyp B3LYP HybridGGA ExchangeCorrelation Functional (VWN1RPA) b3lypchg B3LYP HybridGGA ExchangeCorrelation Functional (VWN1RPA) w/ Chai and HeadGordon Dispersion Correction b3lypd B3LYP HybridGGA ExchangeCorrelation Functional (VWN1RPA) w/ Grimme’s D2 Dispersion Correction b3lypd1 B3LYP HybridGGA ExchangeCorrelation Functional (VWN1RPA) w/ Grimme’s D1 Dispersion Correction b3lypd3 B3LYP HybridGGA ExchangeCorrelation Functional (VWN1RPA) w/ Grimme’s D3 (zerodamping) Dispersion Correction b3lypd3bj B3LYP HybridGGA ExchangeCorrelation Functional (VWN1RPA) w/ Grimme’s D3 (BJdamping) Dispersion Correction b3lypd3m B3LYP HybridGGA ExchangeCorrelation Functional (VWN1RPA) w/ Grimme’s D3 (zerodamping, shortrange refitted) Dispersion Correction b3lypd3mbj B3LYP HybridGGA ExchangeCorrelation Functional (VWN1RPA) w/ Grimme’s D3 (BJdamping, shortrange refitted) Dispersion Correction b3lyp5 B3LYP5 HybridGGA ExchangeCorrelation Functional (VWN5) b3lyp5d B3LYP5 HybridGGA ExchangeCorrelation Functional (VWN5) w/ Grimme’s D2 Dispersion Correction b3lyp5d3 B3LYP5 HybridGGA ExchangeCorrelation Functional (VWN5) w/ Grimme’s D3 (zerodamping) Dispersion Correction b3lyp5d3bj B3LYP5 HybridGGA ExchangeCorrelation Functional (VWN5) w/ Grimme’s D3 (BJdamping) Dispersion Correction b3lyp5d3m B3LYP5 HybridGGA ExchangeCorrelation Functional (VWN5) w/ Grimme’s D3 (zerodamping, shortrange refitted) Dispersion Correction b3lyp5d3mbj B3LYP5 HybridGGA ExchangeCorrelation Functional (VWN5) w/ Grimme’s D3 (BJdamping, shortrange refitted) Dispersion Correction b3_x Becke88 GGA Exchange (B3LYP weighting) b88_x Becke88 GGA Exchange b970 B970 HybridGGA ExchangeCorrelation Functional b971 B971 HybridGGA ExchangeCorrelation Functional b972 B972 HybridGGA ExchangeCorrelation Functional b97d B97D PureGGA ExchangeCorrelation Functional w/ Grimme’s D2 Dispersion Correction b97d3 B97D PureGGA ExchangeCorrelation Functional w/ Grimme’s D3 (zerodamping) Dispersion Correction b97d3bj B97D PureGGA ExchangeCorrelation Functional w/ Grimme’s D3 (BJdamping) Dispersion Correction b97d3m B97D PureGGA ExchangeCorrelation Functional w/ Grimme’s D3 (zerodamping, shortrange refitted) Dispersion Correction b97d3mbj B97D PureGGA ExchangeCorrelation Functional w/ Grimme’s D3 (BJdamping, shortrange refitted) Dispersion Correction blyp BLYP GGA ExchangeCorrelation Functional blypd BLYP GGA ExchangeCorrelation Functional w/ Grimme’s D2 Dispersion Correction blypd1 B3LYP HybridGGA ExchangeCorrelation Functional (VWN1RPA) w/ Grimme’s D1 Dispersion Correction blypd3 BLYP GGA ExchangeCorrelation Functional w/ Grimme’s D3 (zerodamping) Dispersion Correction blypd3bj BLYP GGA ExchangeCorrelation Functional w/ Grimme’s D3 (BJdamping) Dispersion Correction blypd3m BLYP GGA ExchangeCorrelation Functional w/ Grimme’s D3 (zerodamping, shortrange refitted) Dispersion Correction blypd3mbj BLYP GGA ExchangeCorrelation Functional w/ Grimme’s D3 (BJdamping, shortrange refitted) Dispersion Correction bp86 BP86 GGA ExchangeCorrelation Functional bp86d BP86 GGA ExchangeCorrelation Functional w/ Grimme’s D2 Dispersion Correction bp86d1 BP86 GGA ExchangeCorrelation Functional w/ Grimme’s D1 Dispersion Correction bp86d3 BP86 GGA ExchangeCorrelation Functional w/ Grimme’s D3 (zerodamping) Dispersion Correction bp86d3bj BP86 GGA ExchangeCorrelation Functional w/ Grimme’s D3 (BJdamping) Dispersion Correction bp86d3m BP86 GGA ExchangeCorrelation Functional w/ Grimme’s D3 (zerodamping, shortrange refitted) Dispersion Correction bp86d3mbj BP86 GGA ExchangeCorrelation Functional w/ Grimme’s D3 (BJdamping, shortrange refitted) Dispersion Correction ft97 FT97 GGA ExchangeCorrelation Functional ft97b_x Filitov and Theil 1997 Exchange ft97_c FT97 Correlation (Involves Ei functions) hcth HCTH PureGGA ExchangeCorrelation Functional hcth120 HCTH120 PureGGA ExchangeCorrelation Functional hcth120d3 HCTH120 PureGGA ExchangeCorrelation Functional w/ Grimme’s D3 (zerodamping) Dispersion Correction hcth120d3bj HCTH120 PureGGA ExchangeCorrelation Functional w/ Grimme’s D3 (BJdamping) Dispersion Correction hcth147 HCTH147 PureGGA ExchangeCorrelation Functional hcth407 HCTH407 PureGGA ExchangeCorrelation Functional hf+d w/ Podeszwa and Szalewicz Dispersion Correction hf_x HartreeFock Exchange Functional lyp_c LYP Correlation m05 Heavily Parameterized Hybrid MetaGGA XC Functional m052x Heavily Parameterized Hybrid MetaGGA XC Functional m052xd3 Heavily Parameterized Hybrid MetaGGA XC Functional w/ Grimme’s D3 (zerodamping) Dispersion Correction m05d3 Heavily Parameterized Hybrid MetaGGA XC Functional w/ Grimme’s D3 (zerodamping) Dispersion Correction p86_c P86 Correlation (PZ81 LSDA + P86 GGA) pbe PBE GGA ExchangeCorrelation Functional pbed PBE GGA ExchangeCorrelation Functional w/ Grimme’s D2 Dispersion Correction pbed1 PBE GGA ExchangeCorrelation Functional w/ Grimme’s D1 Dispersion Correction pbed3 PBE GGA ExchangeCorrelation Functional w/ Grimme’s D3 (zerodamping) Dispersion Correction pbed3bj PBE GGA ExchangeCorrelation Functional w/ Grimme’s D3 (BJdamping) Dispersion Correction pbed3m PBE GGA ExchangeCorrelation Functional w/ Grimme’s D3 (zerodamping, shortrange refitted) Dispersion Correction pbed3mbj PBE GGA ExchangeCorrelation Functional w/ Grimme’s D3 (BJdamping, shortrange refitted) Dispersion Correction pbe0 PBE0 Hybrid GGA ExchangeCorrelation Functional pbe0d PBE0 Hybrid GGA ExchangeCorrelation Functional w/ Grimme’s D2 Dispersion Correction pbe0d3 PBE0 Hybrid GGA ExchangeCorrelation Functional w/ Grimme’s D3 (zerodamping) Dispersion Correction pbe0d3bj PBE0 Hybrid GGA ExchangeCorrelation Functional w/ Grimme’s D3 (BJdamping) Dispersion Correction pbe0d3m PBE0 Hybrid GGA ExchangeCorrelation Functional w/ Grimme’s D3 (zerodamping, shortrange refitted) Dispersion Correction pbe0d3mbj PBE0 Hybrid GGA ExchangeCorrelation Functional w/ Grimme’s D3 (BJdamping, shortrange refitted) Dispersion Correction pbea_c New Implementation of PBEC in wPBEcsr. pbesol_x PBEsol GGA Exchange Hole (Parameter Free) pbe_c PBE Correlation pbe_x PBE GGA Exchange Hole (Parameter Free) pw91 PW91 GGA ExchangeCorrelation Functional pw91_c PW91 Correlation pw91_x PW91 Parameterized GGA Exchange pw92a_c New Implementation of PW92C in wPBEcsr. pw92_c pz81_c PZ81 Correlation rpbe_x RPBE GGA Exchange Hole (Parameter Free) sogga Second Order GGA ExchangeCorrelation Functional sogga_x Second Order GGA Exchange Hole (Parameter Free) svwn SVWN3 (RPA) LSDA Functional s_x Slater LSDA Exchange vwn3rpa_c VWN3 LSDA Correlation, RPA Parameters, VWN1 Spin Polarization vwn3_c VWN3 LSDA Correlation, QMC Parameters, VWN1 Spin Polarization vwn5rpa_c VWN5 LSDA Correlation, RPA Parameters, VWN5 Spin Polarization vwn5_c VWN5 LSDA Correlation, QMC Parameters, VWN5 Spin Polarization dldf Dispersionless Hybrid MetaGGA XC Functional dldf+d Dispersionless Hybrid MetaGGA XC Functional w/ Podeszwa and Szalewicz Dispersion Correction dldf+d09 Dispersionless Hybrid MetaGGA XC Functional w/ Podeszwa and Szalewicz Dispersion Correction name calls method in Stanton and Gauss’s CFOUR program [manual] c4scf Hartree–Fock (HF) c4mp2 2ndorder MollerPlesset perturbation theory (nondensityfitting) (MP2) c4mp3 3rdorder MollerPlesset perturbation theory (MP3) c4mp4(sdq) 4thorder MP perturbation theory (MP4) less triples c4mp4 full MP4 c4cc2 approximate coupled cluster singles and doubles (CC2) c4ccsd coupled cluster singles and doubles (CCSD) c4cc3 approximate CC singles, doubles, and triples (CC3) c4ccsd(t) CCSD with perturbative triples (CCSD(T)) c4ccsdt coupled cluster singles, doubles, and triples (CCSDT) cfour expert full control over cfour program Examples: >>> # [1] Analytic hf optimization >>> optimize('hf')
>>> # [2] Finite difference mp5 optimization with gradient >>> # printed to output file >>> e, wfn = opt('mp5', return_wfn='yes') >>> wfn.gradient().print_out()
>>> # [3] Forced finite difference hf optimization run in >>> # embarrassingly parallel fashion >>> optimize('hf', dertype='energy', mode='sow')
 name (string) –

gradient
(name[, molecule, return_wfn, func, dertype])[source]¶ Function complementary to :py:func:~driver.optimize(). Carries out one gradient pass, deciding analytic or finite difference.
Returns: Matrix – Total electronic gradient in Hartrees/Bohr. Returns: (Matrix, Wavefunction) – gradient and wavefunction when return_wfn specified. Examples: >>> # [1] Singlepoint dft gradient getting the gradient >>> # in file, psi4.Matrix, and np.array forms >>> set gradient_write on >>> G, wfn = gradient('b3lypd', return_wfn=True) >>> wfn.gradient().print_out() >>> np.array(G)