FreezeCoreTransformer#
- class FreezeCoreTransformer(freeze_core=True, remove_orbitals=None)[source]#
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 theActiveSpaceTransformer
.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:
When
freeze_core
is enabled (the default), the "core" orbitals will be determined automatically according tocount_core_orbitals
. These will then be made inactive and removed in the same fashion as in theActiveSpaceTransformer
.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.
Methods
- prepare_active_space(molecule, 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.
- প্যারামিটার:
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.
- transform(problem)[source]#
Transforms one
BaseProblem
into another.- প্যারামিটার:
problem (BaseProblem) -- the problem to be transformed.
- রেইজেস:
NotImplementedError -- when an unsupported problem type is provided.
NotImplementedError -- when the
ElectronicStructureProblem
is not in theqiskit_nature.second_q.problems.ElectronicBasis.MO
basis.QiskitNatureError -- If the provided
ElectronicStructureProblem
does not contain amolecule
,num_particles
ornum_spatial_orbitals
attribute.
- রিটার্নস:
A new
BaseProblem
instance.- রিটার্ন টাইপ:
- transform_hamiltonian(hamiltonian)[source]#
Transforms one
Hamiltonian
into another.- প্যারামিটার:
hamiltonian (Hamiltonian) -- the hamiltonian to be transformed.
- রেইজেস:
NotImplementedError -- when an unsupported hamiltonian type is provided.
QiskitNatureError -- when
prepare_active_space()
was not called prior to calling this method.
- রিটার্নস:
A new
Hamiltonian
instance.- রিটার্ন টাইপ:
Hamiltonian