Single qudit
This simulates the operation of a single qudit, i.e. collective spin or angular momentum operator. 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 singlequdit package.
No simulation is performed here. The entire logic is implemented in the spooler.py
module.
LoadInstruction
Bases: BaseModel
The load instruction. As each instruction it requires the
Attributes:
Name | Type | Description |
---|---|---|
name |
Literal['load']
|
The string to identify the instruction |
wires |
Annotated[List[Annotated[int, Field(ge=0, le=0)]], Field(min_length=0, max_length=1)]
|
The wire on which the instruction should be applied so the indices should be between 0 and N_MAX_WIRES-1 |
params |
Annotated[List[Annotated[int, Field(ge=1, le=N_MAX_ATOMS)]], Field(min_length=1, max_length=1)]
|
has to be empty |
Source code in singlequdit/config.py
136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 |
|
LocalSqueezingInstruction
Bases: GateInstruction
The rlz2 instruction. As each instruction it requires the
Attributes:
Name | Type | Description |
---|---|---|
name |
Literal['rlz2']
|
The string to identify the instruction |
wires |
Annotated[List[Annotated[int, Field(ge=0, le=0)]], Field(min_length=0, max_length=1)]
|
The wire on which the instruction should be applied so the indices should be between 0 and N_MAX_WIRES-1 |
params |
Annotated[List[Annotated[float, Field(ge=0, le=10 * 2 * pi)]], Field(min_length=1, max_length=1)]
|
has to be empty |
Source code in singlequdit/config.py
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 |
|
MeasureBarrierInstruction
Bases: BaseModel
The measure and barrier instruction. As each instruction it requires the
Attributes:
Name | Type | Description |
---|---|---|
name |
Literal['measure', 'barrier']
|
The string to identify the instruction |
wires |
Annotated[List[Annotated[int, Field(ge=0, le=0)]], Field(min_length=0, max_length=1)]
|
The wire on which the instruction should be applied so the index should be 0 |
params |
Annotated[List[float], Field(min_length=0, max_length=0)]
|
has to be empty |
Source code in singlequdit/config.py
157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 |
|
RlxInstruction
Bases: GateInstruction
The rlx instruction. As each instruction it requires the
Attributes:
Name | Type | Description |
---|---|---|
name |
Literal['rlx']
|
The string to identify the instruction |
wires |
Annotated[List[Annotated[int, Field(ge=0, le=0)]], Field(min_length=0, max_length=1)]
|
The wire on which the instruction should be applied so the indices should be between 0 and N_MAX_WIRES-1 |
params |
Annotated[List[Annotated[float, Field(ge=0, le=2 * pi)]], Field(min_length=1, max_length=1)]
|
has to be empty |
Source code in singlequdit/config.py
24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 |
|
RlzInstruction
Bases: GateInstruction
The rlz instruction. As each instruction it requires the
Attributes:
Name | Type | Description |
---|---|---|
name |
Literal['rlz']
|
The string to identify the instruction |
wires |
Annotated[List[Annotated[int, Field(ge=0, le=0)]], Field(min_length=0, max_length=1)]
|
The wire on which the instruction should be applied so the indices should be between 0 and N_MAX_WIRES-1 |
params |
Annotated[List[Annotated[float, Field(ge=0, le=2 * pi)]], Field(min_length=1, max_length=1)]
|
has to be empty |
Source code in singlequdit/config.py
52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 |
|
SingleQuditExperiment
Bases: BaseModel
The class that defines the single qudit experiments
Source code in singlequdit/config.py
175 176 177 178 179 180 181 182 183 184 185 186 187 |
|
SinglequditFullInstruction
Bases: GateInstruction
The evolution under the full Hamiltonian. As each instruction it requires the
Attributes:
Name | Type | Description |
---|---|---|
name |
Literal['sq_full']
|
The string to identify the instruction |
wires |
Annotated[List[Annotated[int, Field(ge=0, le=0)]], Field(min_length=0, max_length=1)]
|
The wire on which the instruction should be applied so the indices should be between 0 and N_MAX_WIRES-1 |
params |
Annotated[List[Annotated[float, Field(ge=0, le=5000000.0 * pi)]], Field(min_length=3, max_length=3)]
|
Define the parameter for |
Source code in singlequdit/config.py
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 |
|
Simulation code
The module that contains all the necessary logic to simulate the singlequdit.
It has to implement the code that is executed for all the instructions that we defined
in the conf.py
file.
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 singlequdit/spooler.py
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 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 |
|