Pular para o conteúdo principal
Este projeto está em fase beta. Encontrou um bug? Abra uma issue no GitHub. Tem uma pergunta ou ideia? Pergunte no Discussions — adoraríamos receber seu feedback!
Como está a qualidade da tradução nesta página?

Adicione transições fermiônicas ao conjunto de configurações

Aqui demonstramos as funcionalidades para aumentar o conjunto de configurações eletrônicas obtidas pela ação de operadores de transição sobre cada configuração eletrônica.

Demonstramos como adicionar saltos de um único elétron do tipo:

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

para p,q=1,...,Norbp, q = 1, ..., N_\textrm{orb} e σ∈{↑,↓}\sigma \in \{ \uparrow, \downarrow\}, e para todo ∣x⟩|\textbf{x} \rangle no lote de configurações eletrônicas. Começamos gerando um lote de configurações eletrônicas aleatórias:

# Added by doQumentation — installs the packages this notebook needs if they are missing
import importlib.util

_needed = {"numpy": "numpy", "qiskit_addon_sqd": "qiskit-addon-sqd"}
_missing = [pip for module, pip in _needed.items()
if importlib.util.find_spec(module) is None]
# One at a time, so a package that fails to install does not block the others
for _pip in _missing:
%pip install -q {_pip}
if not _missing:
print("\u2713 All required packages are installed")
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)

Os operadores de excitação são especificados dentro de um array do numpy cujo comprimento é igual ao número de nós fermiônicos (ou qubits). Cada elemento do array deve ser uma string que pode assumir os valores:

  • 'I': Identity

  • '+': Operador de criação

  • '-': Operador de aniquilação

Geramos todas as transições possíveis de um único elétron (entre espécies de mesmo spin).

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)
[['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' '-' '+']]

Agora aplicamos os operadores de transição às configurações em 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)
(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]]