class FreezeCoreTransformer(freeze_core=True, remove_orbitals=None)[fuente]#

Bases: BaseTransformer

The Freeze-Core reduction.

This transformation is mathematically identical to the ActiveSpaceTransformer. The difference arises in the user interface: while you configure the _active_ components in the other transformer, here you configure the _inactive_ components. For more information on the configuration options please refer to the input argument description further below and for more information on the mathematical transformation refer to the documentation of the ActiveSpaceTransformer.

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 molecular system information which your Hamiltonian corresponds to 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 apply the freeze-core reduction
transformer = FreezeCoreTransformer()

# since the FreezeCoreTransformer requires molecular system information,
# you need to create that data structure like so:
molecule = MoleculeInfo(
    symbols=["Li", "H"],
    coords=[(0.0, 0.0, 0.0), (0.0, 0.0, 1.6)],
# and since the system size depends on the basis set, you need to provide
# the total number of spatial orbitals separately:
total_num_spatial_orbitals = 11  # e.g. the 6-31g basis

# this allows you to prepare the active space correctly like so:
transformer.prepare_active_space(molecule, total_num_spatial_orbitals)

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

Initializes a transformer which can reduce an ElectronicStructureProblem to a configured active space.

The orbitals to be removed are specified in two ways:

  1. When freeze_core is enabled (the default), the «core» orbitals will be determined automatically according to count_core_orbitals. These will then be made inactive and removed in the same fashion as in the ActiveSpaceTransformer.

  2. Additionally, unoccupied spatial orbitals can be removed via a list of indices passed to remove_orbitals. It is the user’s responsibility to ensure that these are indeed unoccupied orbitals, as no checks are performed.

If you want to remove additional occupied orbitals, please use the ActiveSpaceTransformer instead.

  • freeze_core (bool) – A boolean indicating whether to remove the «core» orbitals.

  • remove_orbitals (list[int] | None) – A list of indices specifying spatial orbitals which are removed. No checks are performed on the nature of these orbitals, so the user must make sure that these are _unoccupied_ orbitals, which can be removed without taking any energy shifts into account.



Atomic Number (Z) of an atom.


atom (str) – the atom kind (symbol) whose atomic number to return.


The atomic number of the queried atom kind.

Tipo del valor devuelto:



Counts the number of core orbitals in a list of atoms.


atoms (Sequence[str]) – the list of atoms.


The number of core orbitals.

Tipo del valor devuelto:


prepare_active_space(molecule, total_num_spatial_orbitals, *, occupation_alpha=None, occupation_beta=None)[fuente]#

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.

  • molecule (MoleculeInfo) – the molecular system information to which the hamiltonian belongs. From this, the involved atomic species and number of electrons will be extracted.

  • 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] | ndarray | None) – the occupation of the alpha-spin orbitals. If omitted, this information is inferred from the required arguments.

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


Transforms one BaseProblem into another.


problem (BaseProblem) – the problem to be transformed.


A new BaseProblem instance.

Tipo del valor devuelto:



Transforms one Hamiltonian into another.


hamiltonian (Hamiltonian) – the hamiltonian to be transformed.


A new Hamiltonian instance.

Tipo del valor devuelto: