Configuration¶
- class dopyqo.DopyqoConfig(base_folder: str, prefix: str, active_electrons: int, active_orbitals: int, kpoint_idx: int | str | None = None, logging_flag: bool | None = None, n_threads: int | None = None, use_gpu: bool | None = None, wannier_transform: bool | None = None, wannier_umat: str | None = None, wannier_input_file: str | None = None, occupations: list[int] | ndarray | None = None, run_vqe: bool | None = None, run_fci: bool | None = None, n_fci_energies: int | None = None, use_qiskit: bool | None = None, unit: Unit | None = None, atom_positions: ndarray | None = None, lattice_vectors: ndarray | None = None, vqe_parameters: ndarray | None = None, vqe_initial_parameters: ndarray | None = None, vqe_optimizer: VQEOptimizers | None = None, vqe_maxiter: int | None = None, vqe_adapt: bool | None = None, vqe_adapt_drain_pool: bool | None = None, vqe_excitations: list[tuple[int, ...]] | ExcitationPools | None = None, uccsd_reps: int | None = None, qe_ewald: bool | None = None, run_hf: bool | None = None)[source]¶
Bases:
objectConfig for running a Dopyqo calculation
Objects of this class are immutable (frozen instances) and variables of an object cannot be set manually after creation. Therefore, copying a object and changing values does not work. For this, use the dataclasses.replace function to create a new object from an existing one and simultaneously changing values.
Noneis the default of all optional entries, as they are parsed asNonefrom a TOML input file.- Parameters:
base_folder (str) – Path to the folder in which the prefix.save folder is. For setting the prefix see argument prefix.
prefix (str) – Prefix of the Quantum ESPRESSO calculation. See also argument base_folder.
active_electrons (int) – Number of electrons in the active space.
active_orbitals (int) – Number of orbitals in the active space.
kpoint_idx (int | str | None) – Specify the k-point(s) that are calculated (integer or string). If integer than it specifies the index of the k-point in the k-point list used in Quantum ESPRESSO. If string than only “all” is allowed and all k-points are calculated. Set to 0, if None. Defaults to None.
logging_flag (bool | None) – If set to true, logging information will be shown. If None or False, no logging information will be shown. Defaults to None.
n_threads (int | None) – Number of threads used to calculate the pseudopotential when using the kohn-sham-matrix-elements-rs package. Set to 1 if None. Defaults to None.
use_gpu (bool | None) – If set to True, the GPU is used for ERI and frozen core matrix elements, if the cupy package is available. If set to True and cupy package is not available, numpy will be used instead. Set to True if None. Defaults to None.
wannier_transform (bool | None) – If True, the orbitals in the active space are transformed into Wannier functions. See also wannier_umat and wannier_input_file. Set to False if None. Defaults to None.
wannier_umat (str | None) – Path to file holding the Wannier transformation matrix in Wannier90 format. Used only if wannier_transform is True. If None and wannier_transform is True will be set to base_folder/prefix_u.mat. Defaults to None.
wannier_input_file (str | None) – Path to the Wannier90 input file used to generate the u.mat file for argument wannier_umat. Used to validate if active space matches the transformed orbitals. Ignored if None. Defaults to None.
occupations (list[int] | np.ndarray | None) – NOT FULLY IMPLEMENTED, YET. List or numpy array of occupations used as the initial state in the VQE ansatz. Only values of 0 and 1 are allowed. Defaults to None.
run_vqe (bool | None) – If set to True, a VQE calculation will be performed. Set to False if None. Defaults to None.
run_fci (bool | None) – If set to True, a FCI calculation will be performed. Set to False if None. Defaults to None.
n_fci_energies (int | None) – Number of energies calculated by the FCI solver. Set to 1 if None. Defaults to None.
use_qiskit (bool | None) – If set to True, qiskit is used to perform the VQE calculation. Set to False if None. Defaults to None.
unit (units.Unit | None) – Defines the unit used for the atom positions (see atom_positions) and lattice vectors (see lattice_vectors). Must not be None if either atom_positions or lattice_vectors are set. Defaults to None.
atom_positions (np.ndarray | None) – Set the atom positions with numpy array of shape (N, 3) where N is the number of atoms. Atoms are in the same order as in the output-xml file from Quantum ESPRESSO. Defaults to None.
lattice_vectors (np.ndarray | None) – Set lattice vectors with numpy array of shape (3, 3). Each line defines one lattice vector. Defaults to None.
vqe_parameters (np.ndarray | None) – Calculate energy of the VQE ansatz using fixed parameters. If given, no VQE optimization is performed. VQE optimization is performed if None. Defaults to None.
vqe_initial_parameters (np.ndarray | None) – Initial parameters of the VQE optimization. Set to zeros if None. Defaults to None.
vqe_optimizer (VQEOptimizers | None) – Optimizer used for the VQE optimization. Needs to be set if run_vqe is set to True. Defaults to None.
vqe_maxiter (int | None) – Number of VQE optimization steps before stopping the optimization. Set to large default values depending on the optimizer if None. Defaults to None.
vqe_adapt (bool | None) – If set to True, a APAPT-VQE calculation will be performed. If False, a VQE calculation will be performed. Set to False if None. Defaults to None.
vqe_adapt_drain_pool (bool | None) – If set to True the operator pool is drained when a operator is appended to the ansatz. If False, an operator can be appended to the ansatz multiple times. Set to True if None. Defaults to None.
vqe_excitations (list[tuple[int, ...]] | ExcitationPools | None) – Excitations used in the VQE ansatz our ADAPT-VQE pool. If given as list of tuples, each tuple represents one excitation. The tuples follow the notation used in TenCirChem: - An excitation operator is represented by a tuple of integers. Each integer corresponds to one spin-orbital. - The integers start from zero and denote first all up-spin orbitals then all down-spin orbitals - The first half of the tuple contains the indices for creation operator and the second half is for annilation operator. - Hermitian conjugation is handled internally. - For example,
(6, 2, 0, 4)corresponds to \(a^\dagger_6 a^\dagger_2 a_0 a_4 - a^\dagger_4 a^\dagger_0 a_2 a_6\) Set to dopyqo.ExcitationPools.SINGLES_DOUBLES if None. Defaults to None.uccsd_reps (int | None) – Number of repetitions of the UCCSD ansatz used in VQE. Set to 1 if None. Defaults to None.
qe_ewald (bool | None) – If True, the nuclear-repulsion (Ewald) energy is not calculated but read from the xml-file outputted by Quantum ESPRESSO. Set to False if None. Defaults to None.
run_hf (bool | None) – If True, a Hartree-Fock (HF) calculation is performed with PySCF and the Hamiltonian is transformed into the HF basis for the VQE/FCI. Set to False if None. Defaults to None.
- vqe_optimizer: VQEOptimizers | None = None¶