FermionHamiltonianProblem
Defines an electronic-structure problem using a Fermionic operator and electron count. Can also be constructed from aMolecularData object using the from_molecule
method.
Methods:
Attributes:
fermion_hamiltonian
fermion_hamiltonian = fermion_hamiltonian
n_particles
n_particles = n_particles
n_orbitals
n_orbitals = min_n_orbitals
occupied_alpha
occupied_alpha: list[int]
virtual_alpha
virtual_alpha: list[int]
occupied_beta
occupied_beta: list[int]
virtual_beta
virtual_beta: list[int]
occupied
occupied: list[int]
virtual
virtual: list[int]
from_molecule
from_molecule(
cls: ,
molecule: MolecularData,
first_active_index: int = 0,
remove_orbitals: Sequence[int] | None = None,
op_compression_tol: float = 1e-13
) -> FermionHamiltonianProblem
Constructs a FermionHamiltonianProblem from a molecule data.
Parameters:
Returns:
- Type:
FermionHamiltonianProblem - The fermion hamiltonian problem. Members:
FermionHamiltonianProblem
Defines an electronic-structure problem using a Fermionic operator and electron count. Can also be constructed from aMolecularData object using the from_molecule
method.
Methods:
Attributes:
fermion_hamiltonian
fermion_hamiltonian = fermion_hamiltonian
n_particles
n_particles = n_particles
n_orbitals
n_orbitals = min_n_orbitals
occupied_alpha
occupied_alpha: list[int]
virtual_alpha
virtual_alpha: list[int]
occupied_beta
occupied_beta: list[int]
virtual_beta
virtual_beta: list[int]
occupied
occupied: list[int]
virtual
virtual: list[int]
from_molecule
from_molecule(
cls: ,
molecule: MolecularData,
first_active_index: int = 0,
remove_orbitals: Sequence[int] | None = None,
op_compression_tol: float = 1e-13
) -> FermionHamiltonianProblem
Constructs a FermionHamiltonianProblem from a molecule data.
Parameters:
Returns:
- Type:
FermionHamiltonianProblem - The fermion hamiltonian problem.
MappingMethod
Mapping methods from fermionic operators to qubits operators. Attributes:JORDAN_WIGNER
BRAVYI_KITAEV
FermionToQubitMapper
Mapper between fermionic operators to qubits operators, using one of the supported mapping methods (seeMappingMethod).
Methods:
Attributes:
method
method = method
map
map(
self: ,
fermion_op: FermionOperator,
args: Any = (),
kwargs: Any =
) -> QubitOperator
Maps the given fermionic operator to a qubits operator using the mapper’s
configuration.
Parameters:
Returns:
- Type:
QubitOperator - The mapped qubits operator.
get_num_qubits
get_num_qubits(
self: ,
problem: FermionHamiltonianProblem
) -> int
Gets the number of qubits after mapping the given problem into qubits space.
Parameters:
Returns:
- Type:
int - The number of qubits. Members:
FermionToQubitMapper
Mapper between fermionic operators to qubits operators, using one of the supported mapping methods (seeMappingMethod).
Methods:
Attributes:
method
method = method
map
map(
self: ,
fermion_op: FermionOperator,
args: Any = (),
kwargs: Any =
) -> QubitOperator
Maps the given fermionic operator to a qubits operator using the mapper’s
configuration.
Parameters:
Returns:
- Type:
QubitOperator - The mapped qubits operator.
get_num_qubits
get_num_qubits(
self: ,
problem: FermionHamiltonianProblem
) -> int
Gets the number of qubits after mapping the given problem into qubits space.
Parameters:
Returns:
- Type:
int - The number of qubits.
MappingMethod
Mapping methods from fermionic operators to qubits operators. Attributes:JORDAN_WIGNER
BRAVYI_KITAEV
FermionHamiltonianProblem
Defines an electronic-structure problem using a Fermionic operator and electron count. Can also be constructed from aMolecularData object using the from_molecule
method.
Methods:
Attributes:
fermion_hamiltonian
fermion_hamiltonian = fermion_hamiltonian
n_particles
n_particles = n_particles
n_orbitals
n_orbitals = min_n_orbitals
occupied_alpha
occupied_alpha: list[int]
virtual_alpha
virtual_alpha: list[int]
occupied_beta
occupied_beta: list[int]
virtual_beta
virtual_beta: list[int]
occupied
occupied: list[int]
virtual
virtual: list[int]
from_molecule
from_molecule(
cls: ,
molecule: MolecularData,
first_active_index: int = 0,
remove_orbitals: Sequence[int] | None = None,
op_compression_tol: float = 1e-13
) -> FermionHamiltonianProblem
Constructs a FermionHamiltonianProblem from a molecule data.
Parameters:
Returns:
- Type:
FermionHamiltonianProblem - The fermion hamiltonian problem.
Z2SymTaperMapper
Mapper between fermionic operators to qubits operators, using one of the supported mapping methods (seeMappingMethod), and taking advantage of Z2 symmetries in
order to taper off qubits.
Methods:
Attributes:
generators
generators: tuple[QubitOperator, ...]
x_ops
x_ops: tuple[QubitOperator, ...]
set_sector
set_sector(
self: ,
sector: Sequence[int]
) -> None
Sets the symmetry sector coefficients.
Parameters:
map
map(
self: ,
fermion_op: FermionOperator,
args: Any = (),
is_invariant: bool = False,
kwargs: Any =
) -> QubitOperator
Maps the given fermionic operator to qubits operator by using the
mapper’s method, and subsequently by tapering off qubits according to Z2
symmetries.
Parameters:
Returns:
- Type:
QubitOperator - The mapped qubits operator.
get_num_qubits
get_num_qubits(
self: ,
problem: FermionHamiltonianProblem
) -> int
Gets the number of qubits after mapping the given problem into qubits space.
Parameters:
Returns:
- Type:
int - The number of qubits.
from_problem
from_problem(
cls: ,
problem: FermionHamiltonianProblem,
method: MappingMethod = MappingMethod.JORDAN_WIGNER,
sector_from_hartree_fock: bool = True,
tol: float = 1e-14
) -> Z2SymTaperMapper
Initializes a Z2SymTaperMapper object from a fermion problem (i.e. computing
the Z2 symmetries from the problem definition).
Parameters:
Returns:
- Type:
Z2SymTaperMapper - The Z2 symmetries taper mapper. Members:
FermionToQubitMapper
Mapper between fermionic operators to qubits operators, using one of the supported mapping methods (seeMappingMethod).
Methods:
Attributes:
method
method = method
map
map(
self: ,
fermion_op: FermionOperator,
args: Any = (),
kwargs: Any =
) -> QubitOperator
Maps the given fermionic operator to a qubits operator using the mapper’s
configuration.
Parameters:
Returns:
- Type:
QubitOperator - The mapped qubits operator.
get_num_qubits
get_num_qubits(
self: ,
problem: FermionHamiltonianProblem
) -> int
Gets the number of qubits after mapping the given problem into qubits space.
Parameters:
Returns:
- Type:
int - The number of qubits.
FermionHamiltonianProblem
Defines an electronic-structure problem using a Fermionic operator and electron count. Can also be constructed from aMolecularData object using the from_molecule
method.
Methods:
Attributes:
fermion_hamiltonian
fermion_hamiltonian = fermion_hamiltonian
n_particles
n_particles = n_particles
n_orbitals
n_orbitals = min_n_orbitals
occupied_alpha
occupied_alpha: list[int]
virtual_alpha
virtual_alpha: list[int]
occupied_beta
occupied_beta: list[int]
virtual_beta
virtual_beta: list[int]
occupied
occupied: list[int]
virtual
virtual: list[int]
from_molecule
from_molecule(
cls: ,
molecule: MolecularData,
first_active_index: int = 0,
remove_orbitals: Sequence[int] | None = None,
op_compression_tol: float = 1e-13
) -> FermionHamiltonianProblem
Constructs a FermionHamiltonianProblem from a molecule data.
Parameters:
Returns:
- Type:
FermionHamiltonianProblem - The fermion hamiltonian problem.
get_hf_fermion_op
get_hf_fermion_op(
problem: FermionHamiltonianProblem
) -> FermionOperator
Constructs a fermion operator that creates the Hartree-Fock reference state in
block-spin ordering.
Parameters:
Returns:
- Type:
FermionOperator - The Hartree-Fock fermion operator.
get_hf_state
get_hf_state(
problem: FermionHamiltonianProblem,
mapper: FermionToQubitMapper
) -> list[bool]
Computes the qubits state after applying the Hartree-Fock operator defined by the
given problem and mapper.
The Qmod function prepare_basis_state can be used on the returned value to
allocate and initialize the qubits array.
Parameters:
Returns:
- Type:
list[bool] - The qubits state, given as a list of boolean values for each qubit. Members:
FermionToQubitMapper
Mapper between fermionic operators to qubits operators, using one of the supported mapping methods (seeMappingMethod).
Methods:
Attributes:
method
method = method
map
map(
self: ,
fermion_op: FermionOperator,
args: Any = (),
kwargs: Any =
) -> QubitOperator
Maps the given fermionic operator to a qubits operator using the mapper’s
configuration.
Parameters:
Returns:
- Type:
QubitOperator - The mapped qubits operator.
get_num_qubits
get_num_qubits(
self: ,
problem: FermionHamiltonianProblem
) -> int
Gets the number of qubits after mapping the given problem into qubits space.
Parameters:
Returns:
- Type:
int - The number of qubits.
FermionHamiltonianProblem
Defines an electronic-structure problem using a Fermionic operator and electron count. Can also be constructed from aMolecularData object using the from_molecule
method.
Methods:
Attributes:
fermion_hamiltonian
fermion_hamiltonian = fermion_hamiltonian
n_particles
n_particles = n_particles
n_orbitals
n_orbitals = min_n_orbitals
occupied_alpha
occupied_alpha: list[int]
virtual_alpha
virtual_alpha: list[int]
occupied_beta
occupied_beta: list[int]
virtual_beta
virtual_beta: list[int]
occupied
occupied: list[int]
virtual
virtual: list[int]
from_molecule
from_molecule(
cls: ,
molecule: MolecularData,
first_active_index: int = 0,
remove_orbitals: Sequence[int] | None = None,
op_compression_tol: float = 1e-13
) -> FermionHamiltonianProblem
Constructs a FermionHamiltonianProblem from a molecule data.
Parameters:
Returns:
- Type:
FermionHamiltonianProblem - The fermion hamiltonian problem.
SparsePauliOp
Represents a collection of sparse Pauli operators. Methods:
Attributes:
terms
terms: list[SparsePauliTerm]
num_qubits
num_qubits: int
get_ucc_hamiltonians
get_ucc_hamiltonians(
problem: FermionHamiltonianProblem,
mapper: FermionToQubitMapper,
excitations: int | Sequence[int]
) -> list[SparsePauliOp]
Computes the UCC hamiltonians of the given problem in the desired excitations,
using the given mapper.
Parameters:
Returns:
- Type:
list[SparsePauliOp] - The UCC hamiltonians.
get_excitations
get_excitations(
problem: FermionHamiltonianProblem,
num_excitations: int
) -> set[tuple[tuple[int, …], tuple[int, …]]]
Gets all the possible excitations of the given problem according to the
given number of excitations, preserving the particles spin.
Parameters:
Returns:
- Type:
set[tuple[tuple[int, ...], tuple[int, ...]]] - A set of all possible excitations, specified as a pair of source and target indices. Members:
DFTState
Post-DFT handle returned to the user, recording the resolved spin mode, functional, and method. Threaded back into later stages.spin_mode
spin_mode: SpinMode
xc_functional
xc_functional: str
method
method: CalculationMethod = CalculationMethod.DFT
EmbeddingCalculator
User-facing embedding driver, backed by queued backend jobs. Methods:spec
spec = spec
spin_mode
spin_mode = spin_mode
auto_validations
auto_validations: tuple[ValidationCheck, ...] = tuple(auto_validations)
validation_results
validation_results: ValidationResults = {}
config
config: EmbeddingConfig | None = None
effective_spin_mode
effective_spin_mode: SpinMode
run_dft
run_dft(
self: ,
xc_functional: str = ‘B3LYP’,
method: CalculationMethod = CalculationMethod.DFT
) -> DFTState
Run the full-system mean field and cache the result.
Blocks until the backend job finishes. For a long run prefer
:meth:submit_dft, which returns a handle you can poll later.
method selects DFT (default, using xc_functional) or Hartree-Fock
(xc_functional is then ignored).
Parameters:
submit_dft
submit_dft(
self: ,
xc_functional: str = ‘B3LYP’,
method: CalculationMethod = CalculationMethod.DFT
) -> ChemistryJob[DFTState]
Enqueue the full-system mean field and return a job handle.
The non-blocking counterpart to :meth:run_dft: the DFT runs
server-side (it can take hours) while the client is free to exit. Call
.result() on the returned handle to fetch the :class:DFTState once
ready — doing so also caches the state for :meth:run_dft_embedding,
exactly as :meth:run_dft does.
Parameters:
run_dft_embedding
run_dft_embedding(
self: ,
config: EmbeddingConfig
) -> tuple[MeanFieldData, QuantumData]
Run the full embedding pipeline in one backend call.
Blocks until the backend job finishes. For a long run prefer
:meth:submit_dft_embedding, which returns a handle you can poll later.
Reuses the cached DFTState from a prior run_dft call if present;
otherwise the backend runs the full-system DFT first using
config.xc_functional. Auto-validations registered at construction are
computed in the same call and stored on self.validation_results.
Parameters:
submit_dft_embedding
submit_dft_embedding(
self: ,
config: EmbeddingConfig
) -> ChemistryJob[tuple[MeanFieldData, QuantumData]]
Enqueue the full embedding pipeline and return a job handle.
The non-blocking counterpart to :meth:run_dft_embedding. Call
.result() on the returned handle to fetch the
(MeanFieldData, QuantumData) tuple once ready; doing so caches the
embedding state for subsequent :meth:run_validations calls and emits
any n_active_virtuals warning, exactly as the blocking method does.
Parameters:
run_validations
run_validations(
self: ,
checks: Sequence[ValidationCheck]
) -> ValidationResults
Run a batch of post-hoc validations in a single backend call.
Parameters:
EmbeddingConfig
Embedding-method parameters.fragment_atoms
fragment_atoms: tuple[int, ...]
method
method: CalculationMethod = CalculationMethod.DFT
xc_functional
xc_functional: str = 'B3LYP'
mu
mu: float = 1000000.0
w_cut
w_cut: float = 0.3
sv_tol
sv_tol: float = 0.001
n_active_virtuals
n_active_virtuals: int | None = None
freeze_core
freeze_core: bool = False
MeanFieldData
Fragment / environment densities, electron counts, and active-MO basis. Attributes:atom_indices
atom_indices: tuple[int, ...]
n_electrons_A
n_electrons_A: int
C_active
C_active: np.ndarray | tuple[np.ndarray, np.ndarray]
E_DFT_fragment
E_DFT_fragment: float
n_electrons_B
n_electrons_B: int
D_A
D_A: np.ndarray
D_B
D_B: np.ndarray
MoleculeSpec
User-facing molecular description. Methods:atom
atom: str
basis
basis: str = 'cc-pVDZ'
charge
charge: int = 0
spin
spin: int = 0
unit
unit: str = 'Angstrom'
from_pdb_file
from_pdb_file(
cls: ,
path: str | Path,
basis: str = ‘cc-pVDZ’,
charge: int = 0,
spin: int = 0,
unit: str = ‘Angstrom’
) -> MoleculeSpec
Build a spec from a local .pdb file.
The file is read on the client; only its contents are sent to the
backend (the backend never opens paths). The remaining arguments mirror
the MoleculeSpec fields.
Parameters:
from_xyz_file
from_xyz_file(
cls: ,
path: str | Path,
basis: str = ‘cc-pVDZ’,
charge: int = 0,
spin: int = 0,
unit: str = ‘Angstrom’
) -> MoleculeSpec
Build a spec from a local .xyz file.
The file is read on the client; only its contents are sent to the
backend (the backend never opens paths). The remaining arguments mirror
the MoleculeSpec fields.
Parameters:
QuantumData
Solver-facing bundle: embedded + physical Hamiltonians and scalars.hamiltonian_emb
hamiltonian_emb: FermionOperator
hamiltonian_phys
hamiltonian_phys: FermionOperator
n_particles
n_particles: tuple[int, int]
env_correction
env_correction: float
SpinMode
Which mean-field treatment the backend should use. Attributes:AUTO
RESTRICTED
UNRESTRICTED
ValidationCheck
Validation diagnostics the embedding pipeline can run. Attributes:DFT_IN_DFT
FCI_ACTIVE_SPACE
PROBABILITY_LEAK
TRACE_CONSERVATION
GEOMETRY_PERTURBATION
chemistry_job
Detached handle for a long-running chemistry backend job.EmbeddingCalculator.submit_* returns one of these instead of blocking: a
chemistry DFT run can take hours, so the SDK hands the user a job id and lets
them fetch the result later (result) — the job keeps running server-side
even if the client process exits. from_id reconnects to a job submitted by
an earlier process.
The handle is generic over the user-facing return type ResultT: a
transform callback maps the parsed wire output (result_type) to that type
(and, for the calculator, threads the freshly computed state back into the
calculator so a later stage can reuse it). Without a transform the parsed wire
model is returned as-is, which is what from_id does.
Methods:
JSONObject
JSONObject = dict[str, Any]
WireT
WireT = TypeVar('WireT')
ResultT
ResultT = TypeVar('ResultT')
embedding_calculator
User-facing API for projection-based WF-in-DFT embedding. Mirrors the local prototype: users build a :class:MoleculeSpec and an
:class:EmbeddingConfig, then drive the pipeline through
:class:EmbeddingCalculator. Under the hood every stage is a queued backend job
(the heavy pyscf / openfermion chemistry runs server-side and never ships to the
client). The calculator exchanges the serializable wire models defined in
classiq.interface.applications.chemistry.embedding with the backend and
rehydrates the results into the dataclasses below.
The embedded / physical Hamiltonians come back as real
openfermion.FermionOperator objects, ready to feed into a quantum solver.
Methods:
ValidationResults
ValidationResults = dict[ValidationCheck, tuple[bool, dict]]