Fermionic tweezer
This simulates the hopping of fermions in a fermionic tweezer. It can be used in qiskit-cold-atom
as described in this tutorial. Below you can find the API of the simulator.
Config
In this module we define all the configuration parameters for the fermions package.
No simulation is performed here. The entire logic is implemented in the spooler.py
module.
BarrierInstruction
Bases: BaseModel
The barrier instruction. As each instruction it requires the
Attributes:
Name | Type | Description |
---|---|---|
name |
Literal['barrier']
|
The string to identify the instruction |
wires |
Annotated[List[Annotated[int, Field(ge=0, le=NUM_WIRES - 1)]], Field(min_length=0, max_length=NUM_WIRES)]
|
The wires on which the instruction should be applied so the indices should be between 0 and NUM_WIRES-1 |
params |
Annotated[List[float], Field(max_length=0)]
|
has to be empty |
Source code in fermions/config.py
26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 |
|
FermionExperiment
Bases: BaseModel
The class that defines the fermion experiments
Source code in fermions/config.py
149 150 151 152 153 154 155 156 157 158 159 |
|
HopInstruction
Bases: GateInstruction
The instruction that applies the hopping gate.
Attributes:
Name | Type | Description |
---|---|---|
name |
Literal['fhop']
|
How to identify the instruction |
wires |
Annotated[List[Annotated[int, Field(ge=0, le=NUM_WIRES - 1)]], Field(min_length=4, max_length=4)]
|
Exactly four wires have to be given. |
params |
Annotated[List[Annotated[float, Field(ge=0, le=2 * pi)]], Field(max_length=1)]
|
between 0 and 2 pi |
coupling_map |
List
|
contains all the allowed configurations. Currently not used |
Source code in fermions/config.py
63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 |
|
IntInstruction
Bases: GateInstruction
The instruction that applies the interaction gate.
Attributes:
Name | Type | Description |
---|---|---|
name |
Literal['fint']
|
How to identify the instruction |
wires |
Annotated[List[Annotated[int, Field(ge=0, le=NUM_WIRES - 1)]], Field(min_length=2, max_length=NUM_WIRES)]
|
Exactly one wire has to be given. |
params |
Annotated[List[Annotated[float, Field(ge=0, le=2 * pi)]], Field(max_length=1)]
|
Has to be empty |
Source code in fermions/config.py
95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 |
|
LoadMeasureInstruction
Bases: BaseModel
The load or measure instruction.
Attributes:
Name | Type | Description |
---|---|---|
name |
Literal['load', 'measure']
|
How to identify the instruction |
wires |
Annotated[List[Annotated[int, Field(ge=0, le=NUM_WIRES - 1)]], Field(min_length=1, max_length=1)]
|
Exactly one wire has to be given. |
params |
Annotated[List[float], Field(max_length=0)]
|
Has to be empty |
Source code in fermions/config.py
45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 |
|
PhaseInstruction
Bases: GateInstruction
The instruction that applies the interaction gate.
Attributes:
Name | Type | Description |
---|---|---|
name |
Literal['fphase']
|
How to identify the instruction |
wires |
Annotated[List[Annotated[int, Field(ge=0, le=NUM_WIRES - 1)]], Field(min_length=2, max_length=2)]
|
Exactly one wire has to be given. |
params |
Annotated[List[Annotated[float, Field(ge=0, le=2 * pi)]], Field(max_length=1)]
|
Has to be empty |
Source code in fermions/config.py
121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 |
|
Simulation code
The module that contains all the necessary logic for the fermions.
gen_circuit(exp_name, json_dict)
The function the creates the instructions for the circuit.
json_dict: The list of instructions for the specific run.
Source code in fermions/spooler.py
54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 |
|
jordan_wigner_transform(j, lattice_length)
Builds up the fermionic operators in a 1D lattice. For details see : https://arxiv.org/abs/0705.1928
Parameters:
Name | Type | Description | Default |
---|---|---|---|
j |
site index |
required | |
lattice_length |
how many sites does the lattice have ? |
required |
Returns:
Name | Type | Description |
---|---|---|
psi_x |
ndarray
|
the field operator of creating a fermion on size j |
Source code in fermions/spooler.py
30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 |
|
nested_kronecker_product(a)
putting together a large operator from a list of matrices.
Provide an example here.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
a |
list
|
A list of matrices that can connected. |
required |
Returns:
Name | Type | Description |
---|---|---|
array |
ndarray
|
An matrix that operates on the connected Hilbert space. |
Source code in fermions/spooler.py
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
|