Skip to main content
IBM Quantum Platform

Añadir transiciones fermiónicas al conjunto de configuraciones

Aquí mostramos las funcionalidades que permiten ampliar el conjunto de configuraciones electrónicas obtenidas mediante la acción de los operadores de transición sobre cada configuración electrónica .

Mostramos cómo añadir saltos de un solo electrón del tipo:

cpσ†cqσ∣x⟩c^\dagger_{p\sigma} c_{q\sigma} |\textbf{x} \rangle

para p,q=1,...,Norbp, q = 1, ..., N_\textrm{orb} y σ∈{↑,↓}\sigma \in \{ \uparrow, \downarrow\}, y para todos los ∣x⟩|\textbf{x} \rangle del lote de configuraciones electrónicas.

Empezamos generando un conjunto de configuraciones electrónicas aleatorias:

import numpy as np

n_qubits = 8
n_orb = n_qubits // 2

rand_seed = 22
np.random.seed(rand_seed)


# Generate some random bitstrings for testing
def random_bitstrings(n_samples, n_qubits):
    return (
        np.round(np.random.rand(n_samples, n_qubits))
        .astype("int")
        .astype("bool")
    )


bitstring_matrix = random_bitstrings(100, n_qubits)

Los operadores de excitación se especifican dentro de una matriz de NumPy cuya longitud es igual al número de nodos fermiónicos (o qubits). Cada elemento del array debe ser una cadena que pueda tomar los siguientes valores:

  • 'I': Identidad
  • '+': Operador de creación
  • '-': Operador de aniquilación

Generamos todas las transiciones de un solo electrón posibles (entre especies del mismo espín ).

transitions_single = np.array(
    [
        ["I" for i in range(2 * n_orb)]
        for j in range(4 * (n_orb**2 - n_orb) // 2 + 1)
    ]
)
count = 1
for i in range(n_orb):
    for j in range(i + 1, n_orb):
        # spin up
        transitions_single[count, i] = "+"
        transitions_single[count, j] = "-"
        count += 1
        transitions_single[count, i] = "-"
        transitions_single[count, j] = "+"
        count += 1

        # spin down
        transitions_single[count, i + n_orb] = "+"
        transitions_single[count, j + n_orb] = "-"
        count += 1
        transitions_single[count, i + n_orb] = "-"
        transitions_single[count, j + n_orb] = "+"
        count += 1

print(transitions_single)

Output:

[['I' 'I' 'I' 'I' 'I' 'I' 'I' 'I']
 ['+' '-' 'I' 'I' 'I' 'I' 'I' 'I']
 ['-' '+' 'I' 'I' 'I' 'I' 'I' 'I']
 ['I' 'I' 'I' 'I' '+' '-' 'I' 'I']
 ['I' 'I' 'I' 'I' '-' '+' 'I' 'I']
 ['+' 'I' '-' 'I' 'I' 'I' 'I' 'I']
 ['-' 'I' '+' 'I' 'I' 'I' 'I' 'I']
 ['I' 'I' 'I' 'I' '+' 'I' '-' 'I']
 ['I' 'I' 'I' 'I' '-' 'I' '+' 'I']
 ['+' 'I' 'I' '-' 'I' 'I' 'I' 'I']
 ['-' 'I' 'I' '+' 'I' 'I' 'I' 'I']
 ['I' 'I' 'I' 'I' '+' 'I' 'I' '-']
 ['I' 'I' 'I' 'I' '-' 'I' 'I' '+']
 ['I' '+' '-' 'I' 'I' 'I' 'I' 'I']
 ['I' '-' '+' 'I' 'I' 'I' 'I' 'I']
 ['I' 'I' 'I' 'I' 'I' '+' '-' 'I']
 ['I' 'I' 'I' 'I' 'I' '-' '+' 'I']
 ['I' '+' 'I' '-' 'I' 'I' 'I' 'I']
 ['I' '-' 'I' '+' 'I' 'I' 'I' 'I']
 ['I' 'I' 'I' 'I' 'I' '+' 'I' '-']
 ['I' 'I' 'I' 'I' 'I' '-' 'I' '+']
 ['I' 'I' '+' '-' 'I' 'I' 'I' 'I']
 ['I' 'I' '-' '+' 'I' 'I' 'I' 'I']
 ['I' 'I' 'I' 'I' 'I' 'I' '+' '-']
 ['I' 'I' 'I' 'I' 'I' 'I' '-' '+']]

Ahora aplicamos los operadores de transición a las configuraciones de bitstring_matrix:

from qiskit_addon_sqd.fermion import enlarge_batch_from_transitions

bitstring_matrix_aug = enlarge_batch_from_transitions(
    bitstring_matrix, transitions_single
)

print(bitstring_matrix_aug.shape)
print(bitstring_matrix_aug)

Output:

(723, 8)
[[False False False ... False False  True]
 [False  True False ...  True False False]
 [ True  True  True ...  True False  True]
 ...
 [ True False  True ... False False  True]
 [ True  True  True ...  True False  True]
 [False False False ... False False  True]]
¿Le ha resultado útil esta página?
Informe de un error, de una errata o solicite contenido en GitHub.