QCANT.qrte#
- QCANT.qrte(symbols: Sequence[str], geometry, *, delta_t: float, n_steps: int, active_electrons: int, active_orbitals: int, basis: str = 'sto-3g', charge: int = 0, spin: int = 0, method: str = 'pyscf', device_name: str | None = None, trotter_steps: int = 1, overlap_tol: float = 1e-10, use_sparse: bool = False, basis_threshold: float = 0.0, return_min_energy_history: bool = False, print_hamiltonian: bool = False) Tuple[object, object, object] | Tuple[object, object, object, object][source]#
Run a quantum real-time evolution loop and return energies from the generated basis.
At each step the current state is evolved by
delta_tunder the molecular Hamiltonian, producing a new state which is appended to the basis.Once the basis is generated, the molecular Hamiltonian is projected into this (generally non-orthogonal) basis and diagonalized to obtain approximate energies.
- Parameters:
symbols – Atomic symbols.
geometry – Nuclear coordinates, array-like with shape
(n_atoms, 3)in Angstrom.delta_t – Time step for each real-time evolution application.
n_steps – Number of time-evolution steps. The returned basis contains
n_steps + 1vectors (including the initial HF state).active_electrons – Number of active electrons.
active_orbitals – Number of active orbitals.
basis – Basis set name understood by PennyLane/PySCF (e.g.
"sto-3g").charge – Total molecular charge.
spin – Spin parameter used by PySCF as
2S(e.g. 0 for singlet).method – Backend used by PennyLane quantum chemistry tooling (default:
"pyscf").device_name – PennyLane device name (e.g.
"default.qubit"). If not provided, the function will prefer"lightning.qubit"if available.trotter_steps – Number of Trotter steps used internally by
pennylane.ApproxTimeEvolution.overlap_tol – Threshold for discarding near-linearly dependent basis vectors when orthonormalizing the basis via the overlap matrix eigen-decomposition.
use_sparse – If True, use a sparse Hamiltonian representation for projections.
basis_threshold – Drop amplitudes with absolute value below this threshold after each basis update. The thresholded state is re-normalized. Use 0.0 to disable thresholding.
return_min_energy_history – If True, also return an array containing the minimum energy after each iteration as the basis grows from 1 to
n_steps + 1vectors.print_hamiltonian – If True, print the full dense Hamiltonian matrix used for evolution.
- Returns:
(energies, basis_states, times)where:energiesis a real-valued array of eigenvalues obtained by diagonalizingthe Hamiltonian projected into the generated basis
basis_statesis a complex-valued array with shape(n_steps+1, 2**n_qubits)timesis a float array with shape(n_steps+1,)giving the time associated with each basis vectorIf
return_min_energy_history=True, the function returns(energies, basis_states, times, min_energy_history)wheremin_energy_historyhas shape(n_steps,)and contains the minimum energy after each iteration (using the basis withk+1vectors).
- Return type:
tuple
- Raises:
ValueError – If inputs are invalid (e.g.
delta_t <= 0orn_steps < 0).ImportError – If required scientific dependencies are not installed.
Notes
This implementation enforces a real-valued Hamiltonian by dropping tiny imaginary parts in the coefficients. This keeps simulator backends like lightning.qubit stable when numerical noise introduces complex terms. This routine requires analytic execution (statevector access). It uses a statevector device and returns the full wavefunction after each step.
The Hamiltonian projection uses a dense matrix by default, which scales as
O(4**n_qubits)in memory. Setuse_sparse=Trueto request a sparse representation when available.