ActiveSpaceTransformer#

class ActiveSpaceTransformer(num_electrons, num_spatial_orbitals, active_orbitals=None)[source]#

Bases: BaseTransformer

The Active-Space reduction.

The reduction is done by computing the inactive Fock operator which is defined as \(F^I_{pq} = h_{pq} + \sum_i 2 g_{iipq} - g_{iqpi}\) and the inactive energy which is given by \(E^I = \sum_j h_{jj} + F ^I_{jj}\), where \(i\) and \(j\) iterate over the inactive orbitals. By using the inactive Fock operator in place of the one-electron integrals the description of the active space contains an effective potential generated by the inactive electrons. Therefore, this method permits the exclusion of non-core electrons while retaining a high-quality description of the system.

For more details on the computation of the inactive Fock operator refer to https://arxiv.org/abs/2009.01872.

The active space can be configured in one of the following ways through the initializer:

  • when only num_electrons and num_spatial_orbitals are specified, these integers indicate the number of active electrons and orbitals, respectively. The active space will then be chosen around the Fermi level resulting in a unique choice for any pair of numbers. Nonetheless, the following criteria must be met:

    1. the remaining number of inactive electrons must be a positive, even number

    2. the number of active orbitals must not exceed the total number of orbitals minus the number of orbitals occupied by the inactive electrons

  • when, num_electrons is a tuple, this must indicate the number of alpha- and beta-spin electrons, respectively. The same requirements as listed before must be met.

  • finally, it is possible to select a custom set of active orbitals via their indices using active_orbitals. This allows selecting an active space which is not placed around the Fermi level as described in the first case, above. When using this keyword argument, the following criteria must be met in addition to the ones listed above:

    1. the length of active_orbitals must be equal to num_spatial_orbitals. Note, that we do not infer the number of active orbitals from this list of indices!

    2. when using a tuple of lists to indicate the alpha- and beta-spin orbital indices separately, both lists must fulfill the previous criterion.

    3. the largest orbital index may not exceed the available num_spatial_orbitals.

If you want to apply this transformer to a Hamiltonian outside of a Problem instance, you need to prepare the active space by providing the total system size information which would normally be extracted from the Problem object. You can do this like so:

# assuming you have the total Hamiltonian of your system available:
total_hamiltonian = ElectronicEnergy(...)

# now you want to reduce it to an active space of 2 electrons in 2 orbitals
transformer = ActiveSpaceTransformer(2, 2)

# assuming that your total system size is 10 electrons in 10 orbitals:
transformer.prepare_active_space(10, 10)

# after preparation, you can now transform only your Hamiltonian like so
reduced_hamiltonian = transformer.transform_hamiltonian(total_hamiltonian)

References

  • M. Rossmannek, P. Barkoutsos, P. Ollitrault, and I. Tavernelli, arXiv:2009.01872 (2020).

reference_inactive_fock#

the inactive Fock operator. Setting this attribute allows you to enforce a custom reference operator to be used during transform_hamiltonian().

reference_inactive_energy#

the inactive energy. Setting this attribute allows you to enforce a custom reference energy to be used during transform_hamiltonian().

Parameters:
  • num_electrons (int | tuple[int, int]) – The number of active electrons. If this is a tuple, it represents the number of alpha- and beta-spin electrons, respectively. If this is a number, it is interpreted as the total number of active electrons, should be even, and implies that the number of alpha and beta electrons equals half of this value, respectively.

  • num_spatial_orbitals (int) – The number of active orbitals.

  • active_orbitals (list[int] | tuple[list[int], list[int]] | None) – A single or pair of lists of indices specifying the spatial orbitals of the active space. This argument must match with the remaining arguments and should only be used to enforce an active space that is not chosen purely around the Fermi level.

Raises:

QiskitNatureError – if an invalid configuration is provided.

Attributes

active_basis#

Returns the BasisTransformer mapping from the total to the active space.

active_density#

Returns the active electronic density.

Methods

get_active_density_component(total_density)[source]#

Gets the active space density-component of the provided ElectronicIntegrals.

Parameters:

total_density (ElectronicIntegrals) – the density in the total orbital space.

Returns:

The active space component density obtained via active_space.

Return type:

ElectronicIntegrals

prepare_active_space(total_num_electrons, total_num_spatial_orbitals, *, occupation_alpha=None, occupation_beta=None)[source]#

Prepares the active space.

This method must be called manually when using this transformer on a hamiltonian outside of a problem instance. In all other cases, the information required here is extracted from the problem automatically.

Parameters:
  • total_num_electrons (int | tuple[int, int]) – the total number of electrons in the system represented by the hamiltonian which is to be transformed. If this is a tuple of integers, it encodes the number of alpha- and beta-spin electrons separately. Otherwise the integer value is assumed to indicate the sum of these two numbers.

  • total_num_spatial_orbitals (int) – the total number of spatial orbitals in the system represented by the hamiltonian which is to be transformed.

  • occupation_alpha (list[float] | np.ndarray | None) – the occupation of the alpha-spin orbitals. If omitted, this information is inferred from the required arguments.

  • occupation_beta (list[float] | np.ndarray | None) – the occupation of the beta-spin orbitals. If omitted, this information is inferred from the required arguments.

Raises:

QiskitNatureError – if any of the requirements for a valid active space configuration (documented in the class docstring) are not met.

transform(problem)[source]#

Transforms one BaseProblem into another.

Parameters:

problem (BaseProblem) – the problem to be transformed.

Raises:
Returns:

A new BaseProblem instance.

Return type:

BaseProblem

transform_hamiltonian(hamiltonian)[source]#

Transforms one Hamiltonian into another.

Parameters:

hamiltonian (Hamiltonian) – the hamiltonian to be transformed.

Raises:
Returns:

A new Hamiltonian instance.

Return type:

Hamiltonian