BasisTransformer#

class BasisTransformer(initial_basis, final_basis, coefficients)[fuente]#

Bases: BaseTransformer

A transformer to map from one basis to another.

Since problems have a basis associated with them (e.g. the qiskit_nature.second_q.problems.ElectronicBasis in the case of the qiskit_nature.second_q.problems.ElectronicStructureProblem), this transformer can be used to map from one initial_basis to another final_basis.

For example, this is how you can create an AO-to-MO transformer for an qiskit_nature.second_q.problems.ElectronicStructureProblem:

# assuming you have the transformation coefficients from somewhere
ao2mo_coeff, ao2mo_coeff_b = ...

from qiskit_nature.second_q.operators import ElectronicIntegrals
from qiskit_nature.second_q.problems import ElectronicBasis
from qiskit_nature.second_q.transformers import BasisTransformer

transformer = BasisTransformer(
    ElectronicBasis.AO,
    ElectronicBasis.MO,
    ElectronicIntegrals.from_raw_integrals(ao2mo_coeff, h1_b=ao2mo_coeff_b),
)

problem_MO = transformer.transform(problem_AO)
initial_basis#

the initial basis from which to map away from.

final_basis#

the final basis into which to map into.

coefficients#

the coefficients which transform from the initial to the final basis.

Parámetros:

Methods

invert()[fuente]#

Invert the transformer to do the reversed transformation.

Devuelve:

A new BasisTransformer mapping from final_basis to initial_basis.

Tipo del valor devuelto:

BasisTransformer

transform(problem)[fuente]#

Transforms one BaseProblem into another. This may affect the size of the Hilbert space.

Parámetros:

problem (BaseProblem) – the problem to be transformed.

Muestra:

NotImplementedError – when an unsupported problem type is provided.

Devuelve:

A new BaseProblem instance.

Tipo del valor devuelto:

BaseProblem

transform_electronic_integrals(integrals)[fuente]#

Transforms an qiskit_nature.second_q.operators.ElectronicIntegrals instance.

Parámetros:

integrals (ElectronicIntegrals) – the ElectronicIntegrals to transform.

Muestra:

QiskitNatureError – when using this method on a BasisTransformer that does not store its coefficients as ElectronicIntegrals, too.

Devuelve:

The transformed ElectronicIntegrals.

Tipo del valor devuelto:

ElectronicIntegrals

transform_hamiltonian(hamiltonian)[fuente]#

Transforms one Hamiltonian into another. This may affect the size of the Hilbert space.

Parámetros:

hamiltonian (Hamiltonian) – the hamiltonian to be transformed.

Muestra:

NotImplementedError – when an unsupported hamiltonian type is provided.

Devuelve:

A new Hamiltonian instance.

Tipo del valor devuelto:

Hamiltonian