PySCFDriver#

class PySCFDriver(atom='H 0.0 0.0 0.0; H 0.0 0.0 0.735', *, unit=DistanceUnit.ANGSTROM, charge=0, spin=0, basis='sto3g', method=MethodType.RHF, xc_functional='lda,vwn', xcf_library='libxc', conv_tol=1e-09, max_cycle=50, init_guess=InitialGuess.MINAO, max_memory=None, chkfile=None)[source]#

Bases: ElectronicStructureDriver

A Second-Quantization driver for Qiskit Nature using the PySCF library.

References

https://pyscf.org/

Parameters:
  • atom (str | list[str]) – A string (or a list thereof) denoting the elements and coordinates of all atoms in the system. Two formats are allowed; first, the PySCF-style XYZ format which is a list of strings formatted as {element symbol} {x_coord} {y_coord} {z_coord}. If a single string is given, the list entries should be joined by ; as in the example: H 0.0 0.0 0.0; H 0.0 0.0 0.735. Second, the Z-Matrix format which is explained at 1. The previous example would be written as H; H 3 0.735. See also 2 for more details on geometry specifications supported by PySCF.

  • unit (DistanceUnit) – Denotes the unit of coordinates. Valid values are given by the UnitsType enum.

  • charge (int) – The charge of the molecule.

  • spin (int) – The spin of the molecule. In accordance with PySCF’s definition, the spin equals \(2*S\), where \(S\) is the total spin number of the molecule.

  • basis (str) – A basis set name as recognized by PySCF (3), e.g. sto3g (the default), 321g, etc. Note, that more advanced configuration options like a Dictionary or custom basis sets are not allowed for the moment. Refer to 4 for an extensive list of PySCF’s valid basis set names.

  • method (MethodType) – The SCF method type to be used for the PySCF calculation. While the name refers to HF methods, the PySCFDriver also supports KS methods. Refer to the MethodType for a list of the supported methods.

  • xc_functional (str) – One of the predefined Exchange-Correlation functional names as recognized by PySCF (5). Defaults to PySCF’s default: ‘lda,vwn’. __Note: this setting only has an effect when a KS method is chosen for method.__

  • xcf_library (str) – The Exchange-Correlation functional library to be used. This can be either ‘libxc’ (the default) or ‘xcfun’. Depending on this value, a different set of values for xc_functional will be available. Refer to 5 for more details.

  • conv_tol (float) – The SCF convergence tolerance. See 6 for more details.

  • max_cycle (int) – The maximum number of SCF iterations. See 6 for more details.

  • init_guess (InitialGuess) – The method to make the initial guess for the SCF starting point. Valid values are given by the InitialGuess enum. See 6 for more details.

  • max_memory (int | None) – The maximum memory that PySCF should use. See 6 for more details.

  • chkfile (str | None) – The path to a PySCF checkpoint file from which to load a previously run calculation. The data stored in this file is assumed to be already converged. Refer to 6 and 7 for more details.

Raises:

QiskitNatureError – An invalid input was supplied.

Attributes

atom#

Returns the atom.

basis#

return basis

charge#

Returns the charge.

chkfile#

Returns the path to the PySCF checkpoint file.

conv_tol#

Returns the SCF convergence tolerance.

init_guess#

Returns the method for the initial guess.

max_cycle#

Returns the maximum number of SCF iterations.

max_memory#

Returns the maximum memory allowance for the calculation.

method#

Returns Hartree-Fock/Kohn-Sham method

spin#

Returns the spin.

unit#

Returns the unit.

xc_functional#

Returns the Exchange-Correlation functional.

xcf_library#

Returns the Exchange-Correlation functional library.

Methods

static check_method_supported(method)[source]#

Checks that PySCF supports this method.

Parameters:

method (MethodType) – the SCF method type.

Raises:

UnsupportMethodError – If the method is not supported.

static from_molecule(molecule, *, basis='sto3g', method=MethodType.RHF, driver_kwargs=None)[source]#

Creates a driver from a molecule.

Parameters:
  • molecule (MoleculeInfo) – the molecular information.

  • basis (str) – the basis set.

  • method (MethodType) – the SCF method type.

  • driver_kwargs (dict[str, Any] | None) – keyword arguments to be passed to driver.

Returns:

The constructed driver instance.

Return type:

PySCFDriver

run()[source]#

Runs the driver to produce a result.

Returns:

ElectronicStructureProblem produced by the run driver.

Raises:

QiskitNatureError – if an error during the PySCF setup or calculation occurred.

Return type:

ElectronicStructureProblem

run_pyscf()[source]#

Runs the PySCF calculation.

This method is part of the public interface to allow the user to easily overwrite it in a subclass to further tailor the behavior to some specific use case.

Raises:

QiskitNatureError – If an invalid HF method type was supplied.

static to_driver_basis(basis)[source]#

Converts basis to a driver acceptable basis.

Parameters:

basis (str) – The basis set to be used.

Returns:

A driver acceptable basis.

Return type:

str

to_problem(*, basis=ElectronicBasis.MO, include_dipole=True)[source]#

Extends the to_qcschema() method and translates the QCSchema object to an ElectronicStructureProblem.

Parameters:
Returns:

An ElectronicStructureProblem.

Return type:

ElectronicStructureProblem

to_qcschema(*, include_dipole=True)[source]#

Extracts all available information after the driver was run into a QCSchema object.

Parameters:

include_dipole (bool) – whether or not to include the custom dipole integrals in the QCSchema.

Returns:

A QCSchema storing all extracted system data computed by the driver.

Return type:

QCSchema