Skip to main contentIBM Quantum Documentation
This page is from an old version of Qiskit SDK and does not exist in the latest version. We recommend you migrate to the latest version. See the release notes for more information.

qiskit.chemistry.algorithms.QEomVQE

class QEomVQE(operator, var_form, optimizer, num_orbitals, num_particles, initial_point=None, max_evals_grouped=1, callback=None, qubit_mapping='parity', two_qubit_reduction=True, is_eom_matrix_symmetric=True, active_occupied=None, active_unoccupied=None, se_list=None, de_list=None, z2_symmetries=None, untapered_op=None, aux_operators=None, quantum_instance=None)

GitHub

QEomVQE algorithm

Parameters

  • operator (LegacyBaseOperator) – qubit operator
  • var_form (Union[QuantumCircuit, VariationalForm]) – parameterized variational form.
  • optimizer (Optimizer) – the classical optimization algorithm.
  • num_orbitals (int) – total number of spin orbitals, has a min. value of 1.
  • num_particles (Union[List[int], int]) – number of particles, if it is a list, the first number is alpha and the second number if beta.
  • initial_point (Optional[ndarray]) – optimizer initial point, 1-D vector
  • max_evals_grouped (int) – max number of evaluations performed simultaneously
  • callback (Optional[Callable[[int, ndarray, float, float], None]]) – a callback that can access the intermediate data during the optimization. Internally, four arguments are provided as follows the index of evaluation, parameters of variational form, evaluated mean, evaluated standard deviation.
  • qubit_mapping (str) – qubit mapping type
  • two_qubit_reduction (bool) – two qubit reduction is applied or not
  • is_eom_matrix_symmetric (bool) – is EoM matrix symmetric
  • active_occupied (Optional[List[int]]) – list of occupied orbitals to include, indices are 0 to n where n is num particles // 2
  • active_unoccupied (Optional[List[int]]) – list of unoccupied orbitals to include, indices are 0 to m where m is (num_orbitals - num particles) // 2
  • se_list (Optional[List[List[int]]]) – single excitation list, overwrite the setting in active space
  • de_list (Optional[List[List[int]]]) – double excitation list, overwrite the setting in active space
  • z2_symmetries (Optional[Z2Symmetries]) – represent the Z2 symmetries
  • untapered_op (Optional[LegacyBaseOperator]) – if the operator is tapered, we need untapered operator during building element of EoM matrix
  • aux_operators (Optional[List[LegacyBaseOperator]]) – Auxiliary operators to be evaluated at each eigenvalue
  • quantum_instance (Union[QuantumInstance, Backend, BaseBackend, None]) – Quantum Instance or Backend

Raises

ValueError – invalid parameter

__init__

__init__(operator, var_form, optimizer, num_orbitals, num_particles, initial_point=None, max_evals_grouped=1, callback=None, qubit_mapping='parity', two_qubit_reduction=True, is_eom_matrix_symmetric=True, active_occupied=None, active_unoccupied=None, se_list=None, de_list=None, z2_symmetries=None, untapered_op=None, aux_operators=None, quantum_instance=None)

Parameters

  • operator (LegacyBaseOperator) – qubit operator
  • var_form (Union[QuantumCircuit, VariationalForm]) – parameterized variational form.
  • optimizer (Optimizer) – the classical optimization algorithm.
  • num_orbitals (int) – total number of spin orbitals, has a min. value of 1.
  • num_particles (Union[List[int], int]) – number of particles, if it is a list, the first number is alpha and the second number if beta.
  • initial_point (Optional[ndarray]) – optimizer initial point, 1-D vector
  • max_evals_grouped (int) – max number of evaluations performed simultaneously
  • callback (Optional[Callable[[int, ndarray, float, float], None]]) – a callback that can access the intermediate data during the optimization. Internally, four arguments are provided as follows the index of evaluation, parameters of variational form, evaluated mean, evaluated standard deviation.
  • qubit_mapping (str) – qubit mapping type
  • two_qubit_reduction (bool) – two qubit reduction is applied or not
  • is_eom_matrix_symmetric (bool) – is EoM matrix symmetric
  • active_occupied (Optional[List[int]]) – list of occupied orbitals to include, indices are 0 to n where n is num particles // 2
  • active_unoccupied (Optional[List[int]]) – list of unoccupied orbitals to include, indices are 0 to m where m is (num_orbitals - num particles) // 2
  • se_list (Optional[List[List[int]]]) – single excitation list, overwrite the setting in active space
  • de_list (Optional[List[List[int]]]) – double excitation list, overwrite the setting in active space
  • z2_symmetries (Optional[Z2Symmetries]) – represent the Z2 symmetries
  • untapered_op (Optional[LegacyBaseOperator]) – if the operator is tapered, we need untapered operator during building element of EoM matrix
  • aux_operators (Optional[List[LegacyBaseOperator]]) – Auxiliary operators to be evaluated at each eigenvalue
  • quantum_instance (Union[QuantumInstance, Backend, BaseBackend, None]) – Quantum Instance or Backend

Raises

ValueError – invalid parameter


Methods

__init__(operator, var_form, optimizer, …)type operatorLegacyBaseOperator
cleanup_parameterized_circuits()set parameterized circuits to None
compute_minimum_eigenvalue([operator, …])Computes minimum eigenvalue.
construct_circuit(parameter)Return the circuits used to compute the expectation value.
construct_expectation(parameter)Generate the ansatz circuit and expectation value measurement, and return their runnable composition.
find_minimum([initial_point, var_form, …])Optimize to find the minimum cost value.
get_optimal_circuit()Get the circuit with the optimal parameters.
get_optimal_cost()Get the minimal cost or energy found by the VQE.
get_optimal_vector()Get the simulation outcome of the optimal circuit.
get_prob_vector_for_params(…[, …])Helper function to get probability vectors for a set of params
get_probabilities_for_counts(counts)get probabilities for counts
print_settings()Preparing the setting of VQE into a string.
run([quantum_instance])Execute the algorithm with selected backend.
set_backend(backend, **kwargs)Sets backend with configuration.
supports_aux_operators()Whether computing the expectation value of auxiliary operators is supported.

Attributes

aux_operatorsReturns aux operators
backendReturns backend.
expectationThe expectation value algorithm used to construct the expectation measurement from the observable.
initial_pointReturns initial point
operatorReturns operator
optimal_paramsThe optimal parameters for the variational form.
optimizerReturns optimizer
quantum_instanceReturns quantum instance.
randomReturn a numpy random.
settingPrepare the setting of VQE as a string.
var_formReturns variational form

aux_operators

Returns aux operators

Return type

Optional[List[Optional[OperatorBase]]]

backend

Returns backend.

Return type

Union[Backend, BaseBackend]

cleanup_parameterized_circuits

cleanup_parameterized_circuits()

set parameterized circuits to None

compute_minimum_eigenvalue

compute_minimum_eigenvalue(operator=None, aux_operators=None)

Computes minimum eigenvalue. Operator and aux_operators can be supplied here and if not None will override any already set into algorithm so it can be reused with different operators. While an operator is required by algorithms, aux_operators are optional. To ‘remove’ a previous aux_operators array use an empty list here.

Parameters

  • operator (Union[OperatorBase, LegacyBaseOperator, None]) – If not None replaces operator in algorithm
  • aux_operators (Optional[List[Union[OperatorBase, LegacyBaseOperator, None]]]) – If not None replaces aux_operators in algorithm

Return type

MinimumEigensolverResult

Returns

MinimumEigensolverResult

construct_circuit

construct_circuit(parameter)

Return the circuits used to compute the expectation value.

Parameters

parameter (Union[List[float], List[Parameter], ndarray]) – Parameters for the ansatz circuit.

Return type

List[QuantumCircuit]

Returns

A list of the circuits used to compute the expectation value.

construct_expectation

construct_expectation(parameter)

Generate the ansatz circuit and expectation value measurement, and return their runnable composition.

Parameters

parameter (Union[List[float], List[Parameter], ndarray]) – Parameters for the ansatz circuit.

Return type

OperatorBase

Returns

The Operator equalling the measurement of the ansatz StateFn by the Observable’s expectation StateFn.

Raises

AquaError – If no operator has been provided.

expectation

The expectation value algorithm used to construct the expectation measurement from the observable.

Return type

ExpectationBase

find_minimum

find_minimum(initial_point=None, var_form=None, cost_fn=None, optimizer=None, gradient_fn=None)

Optimize to find the minimum cost value.

Parameters

  • initial_point (Optional[ndarray]) – If not None will be used instead of any initial point supplied via constructor. If None and None was supplied to constructor then a random point will be used if the optimizer requires an initial point.
  • var_form (Union[QuantumCircuit, VariationalForm, None]) – If not None will be used instead of any variational form supplied via constructor.
  • cost_fn (Optional[Callable]) – If not None will be used instead of any cost_fn supplied via constructor.
  • optimizer (Optional[Optimizer]) – If not None will be used instead of any optimizer supplied via constructor.
  • gradient_fn (Optional[Callable]) – Optional gradient function for optimizer

Returns

Optimized variational parameters, and corresponding minimum cost value.

Return type

dict

Raises

ValueError – invalid input

get_optimal_circuit

get_optimal_circuit()

Get the circuit with the optimal parameters.

Return type

QuantumCircuit

get_optimal_cost

get_optimal_cost()

Get the minimal cost or energy found by the VQE.

Return type

float

get_optimal_vector

get_optimal_vector()

Get the simulation outcome of the optimal circuit.

Return type

Union[List[float], Dict[str, int]]

get_prob_vector_for_params

get_prob_vector_for_params(construct_circuit_fn, params_s, quantum_instance, construct_circuit_args=None)

Helper function to get probability vectors for a set of params

get_probabilities_for_counts

get_probabilities_for_counts(counts)

get probabilities for counts

initial_point

Returns initial point

Return type

Optional[ndarray]

operator

Returns operator

Return type

Optional[OperatorBase]

optimal_params

The optimal parameters for the variational form.

Return type

List[float]

optimizer

Returns optimizer

Return type

Optional[Optimizer]

print_settings()

Preparing the setting of VQE into a string.

Returns

the formatted setting of VQE

Return type

str

quantum_instance

Returns quantum instance.

Return type

Optional[QuantumInstance]

random

Return a numpy random.

run

run(quantum_instance=None, **kwargs)

Execute the algorithm with selected backend.

Parameters

  • quantum_instance (Union[QuantumInstance, Backend, BaseBackend, None]) – the experimental setting.
  • kwargs (dict) – kwargs

Returns

results of an algorithm.

Return type

dict

Raises

AquaError – If a quantum instance or backend has not been provided

set_backend

set_backend(backend, **kwargs)

Sets backend with configuration.

Return type

None

setting

Prepare the setting of VQE as a string.

supports_aux_operators

classmethod supports_aux_operators()

Whether computing the expectation value of auxiliary operators is supported.

If the minimum eigensolver computes an eigenstate of the main operator then it can compute the expectation value of the aux_operators for that state. Otherwise they will be ignored.

Return type

bool

Returns

True if aux_operator expectations can be evaluated, False otherwise

var_form

Returns variational form

Return type

Union[QuantumCircuit, VariationalForm, None]

Was this page helpful?
Report a bug or request content on GitHub.