├── Hamiltonian └── OHhamiltonian.txt ├── Hamiltonian_to_Pennylane.py ├── LICENSE ├── NoiseModel ├── fakecairo.pkl ├── fakekolkata.pkl └── fakemontreal.pkl ├── NoiseModel_and_SystemModel.ipynb ├── README.md ├── algorithm_seeds └── requiredseeds.txt └── examplecode.ipynb /Hamiltonian/OHhamiltonian.txt: -------------------------------------------------------------------------------- 1 | -51.1139071673799 * IIIIIIIIIIII 2 | + 12.41620827390893 * IIIIIIIIIIIZ 3 | + 0.12057948842535543 * IIIIIIIIIIYY 4 | + 0.12057948842535543 * IIIIIIIIIIXX 5 | + 0.0327578387990602 * IIIIIIIIIYZY 6 | + 0.0327578387990602 * IIIIIIIIIXZX 7 | - 0.04610075485943312 * IIIIIIYZZZZY 8 | - 0.04610075485943312 * IIIIIIXZZZZX 9 | + 1.6634978319040625 * IIIIIIIIIIZI 10 | - 0.08213155786108899 * IIIIIIIIIYYI 11 | - 0.08213155786108899 * IIIIIIIIIXXI 12 | + 0.18236945859977163 * IIIIIIYZZZYI 13 | + 0.18236945859977163 * IIIIIIXZZZXI 14 | + 1.3217797467594474 * IIIIIIIIIZII 15 | - 0.21924192058114042 * IIIIIIYZZYII 16 | - 0.21924192058114042 * IIIIIIXZZXII 17 | + 1.3515015013829494 * IIIIIIIIZIII 18 | + 1.3515015013829512 * IIIIIIIZIIII 19 | + 0.6981885597575744 * IIIIIIZIIIII 20 | + 12.416208273908929 * IIIIIZIIIIII 21 | + 0.12057948842535543 * IIIIYYIIIIII 22 | + 0.12057948842535543 * IIIIXXIIIIII 23 | + 0.03275783879906031 * IIIYZYIIIIII 24 | + 0.03275783879906031 * IIIXZXIIIIII 25 | - 0.046100754859433164 * YZZZZYIIIIII 26 | - 0.046100754859433164 * XZZZZXIIIIII 27 | + 1.663497831904062 * IIIIZIIIIIII 28 | - 0.08213155786108896 * IIIYYIIIIIII 29 | - 0.08213155786108896 * IIIXXIIIIIII 30 | + 0.1823694585997717 * YZZZYIIIIIII 31 | + 0.1823694585997717 * XZZZXIIIIIII 32 | + 1.3217797467594465 * IIIZIIIIIIII 33 | - 0.2192419205811405 * YZZYIIIIIIII 34 | - 0.2192419205811405 * XZZXIIIIIIII 35 | + 1.3515015013829506 * IIZIIIIIIIII 36 | + 1.3515015013829514 * IZIIIIIIIIII 37 | + 0.6981885597575748 * ZIIIIIIIIIII 38 | + 0.24974036168481817 * IIIIIIIIIIZZ 39 | - 0.01734850035372025 * IIIIIIIIIYYZ 40 | - 0.01734850035372025 * IIIIIIIIIXXZ 41 | + 0.05385802397481705 * IIIIIIYZZZYZ 42 | + 0.05385802397481705 * IIIIIIXZZZXZ 43 | + 0.0019682136944003748 * IIIIIIIIIYIY 44 | + 0.0019682136944003748 * IIIIIIIIIXIX 45 | + 0.001808492977723844 * IIIIIIYZZZIY 46 | + 0.001808492977723844 * IIIIIIXZZZIX 47 | - 0.0009559454125376033 * IIIIIIYZZXXY 48 | - 0.006429897335078852 * IIIIIIYZZYYY 49 | - 0.005473951922541248 * IIIIIIXZZXYY 50 | - 0.005473951922541248 * IIIIIIYZZYXX 51 | - 0.006429897335078852 * IIIIIIXZZXXX 52 | - 0.0009559454125376033 * IIIIIIXZZYYX 53 | + 0.2415888126737023 * IIIIIIIIIZIZ 54 | - 0.06485953217641371 * IIIIIIYZZYIZ 55 | - 0.06485953217641371 * IIIIIIXZZXIZ 56 | + 0.008703297941162638 * IIIIIIIIIZYY 57 | + 0.008703297941162638 * IIIIIIIIIZXX 58 | - 0.0030233591888304866 * IIIIIIYZZIZY 59 | - 0.0030233591888304866 * IIIIIIXZZIZX 60 | + 0.2723855556776968 * IIIIIIIIZIIZ 61 | + 0.01152667828410398 * IIIIIIIIZIYY 62 | + 0.01152667828410398 * IIIIIIIIZIXX 63 | + 0.003872965380821736 * IIIIIIIIZYZY 64 | + 0.003872965380821736 * IIIIIIIIZXZX 65 | - 0.003618572047998899 * IIIIIIYZIZZY 66 | - 0.003618572047998899 * IIIIIIXZIZZX 67 | + 0.272385555677697 * IIIIIIIZIIIZ 68 | + 0.011526678284103996 * IIIIIIIZIIYY 69 | + 0.011526678284103996 * IIIIIIIZIIXX 70 | + 0.0038729653808217447 * IIIIIIIZIYZY 71 | + 0.0038729653808217447 * IIIIIIIZIXZX 72 | - 0.003618572047998911 * IIIIIIYIZZZY 73 | - 0.003618572047998911 * IIIIIIXIZZZX 74 | + 0.17832763324247464 * IIIIIIZIIIIZ 75 | + 0.0034897420446373074 * IIIIIIZIIIYY 76 | + 0.0034897420446373074 * IIIIIIZIIIXX 77 | + 0.005202619054859435 * IIIIIIZIIYZY 78 | + 0.005202619054859435 * IIIIIIZIIXZX 79 | + 1.1874426099868411 * IIIIIZIIIIIZ 80 | + 0.1096164227655236 * IIIIIZIIIIYY 81 | + 0.1096164227655236 * IIIIIZIIIIXX 82 | + 0.03785919012073294 * IIIIIZIIIYZY 83 | + 0.03785919012073294 * IIIIIZIIIXZX 84 | - 0.03994774599854015 * IIIIIZYZZZZY 85 | - 0.03994774599854015 * IIIIIZXZZZZX 86 | + 0.10961642276552361 * IIIIYYIIIIIZ 87 | + 0.10961642276552361 * IIIIXXIIIIIZ 88 | + 0.016180101112792555 * IIIIYYIIIIYY 89 | + 0.016180101112792555 * IIIIXXIIIIYY 90 | + 0.016180101112792555 * IIIIYYIIIIXX 91 | + 0.016180101112792555 * IIIIXXIIIIXX 92 | + 0.004610737646952412 * IIIIYYIIIYZY 93 | + 0.004610737646952412 * IIIIXXIIIYZY 94 | + 0.004610737646952412 * IIIIYYIIIXZX 95 | + 0.004610737646952412 * IIIIXXIIIXZX 96 | - 0.006671632560015674 * IIIIYYYZZZZY 97 | - 0.006671632560015674 * IIIIXXYZZZZY 98 | - 0.006671632560015674 * IIIIYYXZZZZX 99 | - 0.006671632560015674 * IIIIXXXZZZZX 100 | + 0.03785919012073293 * IIIYZYIIIIIZ 101 | + 0.03785919012073293 * IIIXZXIIIIIZ 102 | + 0.004610737646952412 * IIIYZYIIIIYY 103 | + 0.004610737646952412 * IIIXZXIIIIYY 104 | + 0.004610737646952412 * IIIYZYIIIIXX 105 | + 0.004610737646952412 * IIIXZXIIIIXX 106 | + 0.006154748483964814 * IIIYZYIIIYZY 107 | + 0.006154748483964814 * IIIXZXIIIYZY 108 | + 0.006154748483964814 * IIIYZYIIIXZX 109 | + 0.006154748483964814 * IIIXZXIIIXZX 110 | + 0.0016012814039877306 * IIIYZYYZZZZY 111 | + 0.0016012814039877306 * IIIXZXYZZZZY 112 | + 0.0016012814039877306 * IIIYZYXZZZZX 113 | + 0.0016012814039877306 * IIIXZXXZZZZX 114 | + 0.006463423045538638 * IIYZZYIIYZZY 115 | + 0.006463423045538638 * IIXZZXIIYZZY 116 | + 0.006463423045538638 * IIYZZYIIXZZX 117 | + 0.006463423045538638 * IIXZZXIIXZZX 118 | + 0.006463423045538645 * IYZZZYIYZZZY 119 | + 0.006463423045538645 * IXZZZXIYZZZY 120 | + 0.006463423045538645 * IYZZZYIXZZZX 121 | + 0.006463423045538645 * IXZZZXIXZZZX 122 | - 0.03994774599854015 * YZZZZYIIIIIZ 123 | - 0.03994774599854015 * XZZZZXIIIIIZ 124 | - 0.006671632560015674 * YZZZZYIIIIYY 125 | - 0.006671632560015674 * XZZZZXIIIIYY 126 | - 0.006671632560015674 * YZZZZYIIIIXX 127 | - 0.006671632560015674 * XZZZZXIIIIXX 128 | + 0.0016012814039877306 * YZZZZYIIIYZY 129 | + 0.0016012814039877306 * XZZZZXIIIYZY 130 | + 0.0016012814039877306 * YZZZZYIIIXZX 131 | + 0.0016012814039877306 * XZZZZXIIIXZX 132 | + 0.005292701347809455 * YZZZZYYZZZZY 133 | + 0.005292701347809455 * XZZZZXYZZZZY 134 | + 0.005292701347809455 * YZZZZYXZZZZX 135 | + 0.005292701347809455 * XZZZZXXZZZZX 136 | + 0.2659204627976107 * IIIIZIIIIIIZ 137 | + 0.0037617467246662084 * IIIIZIIIIIYY 138 | + 0.0037617467246662084 * IIIIZIIIIIXX 139 | + 0.004308265667888925 * IIIIZIIIIYZY 140 | + 0.004308265667888925 * IIIIZIIIIXZX 141 | + 0.0006732399864086777 * IIIIZIYZZZZY 142 | + 0.0006732399864086777 * IIIIZIXZZZZX 143 | - 0.021959238000672662 * IIIYYIIIIIIZ 144 | - 0.021959238000672662 * IIIXXIIIIIIZ 145 | - 0.0023400519734885494 * IIIYYIIIIIYY 146 | - 0.0023400519734885494 * IIIXXIIIIIYY 147 | - 0.0023400519734885494 * IIIYYIIIIIXX 148 | - 0.0023400519734885494 * IIIXXIIIIIXX 149 | + 0.005411302855394715 * IIIYYIIIIYZY 150 | + 0.005411302855394715 * IIIXXIIIIYZY 151 | + 0.005411302855394715 * IIIYYIIIIXZX 152 | + 0.005411302855394715 * IIIXXIIIIXZX 153 | + 0.005093678706295895 * IIIYYIYZZZZY 154 | + 0.005093678706295895 * IIIXXIYZZZZY 155 | + 0.005093678706295895 * IIIYYIXZZZZX 156 | + 0.005093678706295895 * IIIXXIXZZZZX 157 | + 0.008452043966135244 * IIYZYIIIYZZY 158 | + 0.008452043966135244 * IIXZXIIIYZZY 159 | + 0.008452043966135244 * IIYZYIIIXZZX 160 | + 0.008452043966135244 * IIXZXIIIXZZX 161 | + 0.008452043966135254 * IYZZYIIYZZZY 162 | + 0.008452043966135254 * IXZZXIIYZZZY 163 | + 0.008452043966135254 * IYZZYIIXZZZX 164 | + 0.008452043966135254 * IXZZXIIXZZZX 165 | + 0.060529656534832735 * YZZZYIIIIIIZ 166 | + 0.060529656534832735 * XZZZXIIIIIIZ 167 | + 0.001135252991315167 * YZZZYIIIIIYY 168 | + 0.001135252991315167 * XZZZXIIIIIYY 169 | + 0.001135252991315167 * YZZZYIIIIIXX 170 | + 0.001135252991315167 * XZZZXIIIIIXX 171 | + 0.0041377332937582905 * YZZZYIIIIYZY 172 | + 0.0041377332937582905 * XZZZXIIIIYZY 173 | + 0.0041377332937582905 * YZZZYIIIIXZX 174 | + 0.0041377332937582905 * XZZZXIIIIXZX 175 | + 0.0021855100038679375 * YZZZYIYZZZZY 176 | + 0.0021855100038679375 * XZZZXIYZZZZY 177 | + 0.0021855100038679375 * YZZZYIXZZZZX 178 | + 0.0021855100038679375 * XZZZXIXZZZZX 179 | + 0.2477435611576671 * IIIZIIIIIIIZ 180 | + 0.003291995085767924 * IIIZIIIIIIYY 181 | + 0.003291995085767924 * IIIZIIIIIIXX 182 | - 0.0021752258828568525 * IIIZIIIIIYZY 183 | - 0.0021752258828568525 * IIIZIIIIIXZX 184 | - 0.003541288974489844 * IIIZIIYZZZZY 185 | - 0.003541288974489844 * IIIZIIXZZZZX 186 | + 0.0028020799368202254 * IIYYIIIIYZZY 187 | + 0.0028020799368202254 * IIXXIIIIYZZY 188 | + 0.0028020799368202254 * IIYYIIIIXZZX 189 | + 0.0028020799368202254 * IIXXIIIIXZZX 190 | + 0.002802079936820229 * IYZYIIIYZZZY 191 | + 0.002802079936820229 * IXZXIIIYZZZY 192 | + 0.002802079936820229 * IYZYIIIXZZZX 193 | + 0.002802079936820229 * IXZXIIIXZZZX 194 | - 0.06646081358040146 * YZZYIIIIIIIZ 195 | - 0.06646081358040146 * XZZXIIIIIIIZ 196 | - 0.0013362186287829577 * YZZYIIIIIIYY 197 | - 0.0013362186287829577 * XZZXIIIIIIYY 198 | - 0.0013362186287829577 * YZZYIIIIIIXX 199 | - 0.0013362186287829577 * XZZXIIIIIIXX 200 | + 0.000517929785659357 * YZZYIIIIIYZY 201 | + 0.000517929785659357 * XZZXIIIIIYZY 202 | + 0.000517929785659357 * YZZYIIIIIXZX 203 | + 0.000517929785659357 * XZZXIIIIIXZX 204 | + 0.0012026333132401498 * YZZYIIYZZZZY 205 | + 0.0012026333132401498 * XZZXIIYZZZZY 206 | + 0.0012026333132401498 * YZZYIIXZZZZX 207 | + 0.0012026333132401498 * XZZXIIXZZZZX 208 | + 0.27884897872323544 * IIZIIIIIIIIZ 209 | + 0.0030746343179687374 * IIZIIIIIIIYY 210 | + 0.0030746343179687374 * IIZIIIIIIIXX 211 | + 0.001070885444001511 * IIZIIIIIIYZY 212 | + 0.001070885444001511 * IIZIIIIIIXZX 213 | - 0.0010263780294593131 * IIZIIIYZZZZY 214 | - 0.0010263780294593131 * IIZIIIXZZZZX 215 | - 0.002592194018539586 * YZYIIIIIYZZY 216 | - 0.002592194018539586 * XZXIIIIIYZZY 217 | - 0.002592194018539586 * YZYIIIIIXZZX 218 | - 0.002592194018539586 * XZXIIIIIXZZX 219 | + 0.27884897872323566 * IZIIIIIIIIIZ 220 | + 0.003074634317968743 * IZIIIIIIIIYY 221 | + 0.003074634317968743 * IZIIIIIIIIXX 222 | + 0.0010708854440015158 * IZIIIIIIIYZY 223 | + 0.0010708854440015158 * IZIIIIIIIXZX 224 | - 0.0010263780294593216 * IZIIIIYZZZZY 225 | - 0.0010263780294593216 * IZIIIIXZZZZX 226 | - 0.0025921940185395904 * YYIIIIIYZZZY 227 | - 0.0025921940185395904 * XXIIIIIYZZZY 228 | - 0.0025921940185395904 * YYIIIIIXZZZX 229 | - 0.0025921940185395904 * XXIIIIIXZZZX 230 | + 0.1836203345902841 * ZIIIIIIIIIIZ 231 | + 0.00130423204076937 * ZIIIIIIIIIYY 232 | + 0.00130423204076937 * ZIIIIIIIIIXX 233 | + 0.003999985741619284 * ZIIIIIIIIYZY 234 | + 0.003999985741619284 * ZIIIIIIIIXZX 235 | + 0.0020700936624165403 * ZIIIIIYZZZZY 236 | + 0.0020700936624165403 * ZIIIIIXZZZZX 237 | + 0.1424249012901058 * IIIIIIIIIZZI 238 | - 0.02015097458711327 * IIIIIIYZZYZI 239 | - 0.02015097458711327 * IIIIIIXZZXZI 240 | + 0.029913828134930636 * IIIIIIYZZIYI 241 | + 0.029913828134930636 * IIIIIIXZZIXI 242 | + 0.15522161860469502 * IIIIIIIIZIZI 243 | - 0.0018786641092916317 * IIIIIIIIZYYI 244 | - 0.0018786641092916317 * IIIIIIIIZXXI 245 | + 0.02006853286830247 * IIIIIIYZIZYI 246 | + 0.02006853286830247 * IIIIIIXZIZXI 247 | + 0.15522161860469513 * IIIIIIIZIIZI 248 | - 0.0018786641092916338 * IIIIIIIZIYYI 249 | - 0.0018786641092916338 * IIIIIIIZIXXI 250 | + 0.020068532868302513 * IIIIIIYIZZYI 251 | + 0.020068532868302513 * IIIIIIXIZZXI 252 | + 0.13272766793836765 * IIIIIIZIIIZI 253 | + 0.009602550315799726 * IIIIIIZIIYYI 254 | + 0.009602550315799726 * IIIIIIZIIXXI 255 | + 0.2659204627976107 * IIIIIZIIIIZI 256 | - 0.02195923800067266 * IIIIIZIIIYYI 257 | - 0.02195923800067266 * IIIIIZIIIXXI 258 | + 0.060529656534832735 * IIIIIZYZZZYI 259 | + 0.060529656534832735 * IIIIIZXZZZXI 260 | + 0.003761746724666208 * IIIIYYIIIIZI 261 | + 0.003761746724666208 * IIIIXXIIIIZI 262 | - 0.00234005197348855 * IIIIYYIIIYYI 263 | - 0.00234005197348855 * IIIIXXIIIYYI 264 | - 0.00234005197348855 * IIIIYYIIIXXI 265 | - 0.00234005197348855 * IIIIXXIIIXXI 266 | + 0.001135252991315167 * IIIIYYYZZZYI 267 | + 0.001135252991315167 * IIIIXXYZZZYI 268 | + 0.001135252991315167 * IIIIYYXZZZXI 269 | + 0.001135252991315167 * IIIIXXXZZZXI 270 | + 0.004308265667888924 * IIIYZYIIIIZI 271 | + 0.004308265667888924 * IIIXZXIIIIZI 272 | + 0.005411302855394715 * IIIYZYIIIYYI 273 | + 0.005411302855394715 * IIIXZXIIIYYI 274 | + 0.005411302855394715 * IIIYZYIIIXXI 275 | + 0.005411302855394715 * IIIXZXIIIXXI 276 | + 0.0041377332937582905 * IIIYZYYZZZYI 277 | + 0.0041377332937582905 * IIIXZXYZZZYI 278 | + 0.0041377332937582905 * IIIYZYXZZZXI 279 | + 0.0041377332937582905 * IIIXZXXZZZXI 280 | + 0.008452043966135244 * IIYZZYIIYZYI 281 | + 0.008452043966135244 * IIXZZXIIYZYI 282 | + 0.008452043966135244 * IIYZZYIIXZXI 283 | + 0.008452043966135244 * IIXZZXIIXZXI 284 | + 0.008452043966135254 * IYZZZYIYZZYI 285 | + 0.008452043966135254 * IXZZZXIYZZYI 286 | + 0.008452043966135254 * IYZZZYIXZZXI 287 | + 0.008452043966135254 * IXZZZXIXZZXI 288 | + 0.0006732399864086778 * YZZZZYIIIIZI 289 | + 0.0006732399864086778 * XZZZZXIIIIZI 290 | + 0.005093678706295895 * YZZZZYIIIYYI 291 | + 0.005093678706295895 * XZZZZXIIIYYI 292 | + 0.005093678706295895 * YZZZZYIIIXXI 293 | + 0.005093678706295895 * XZZZZXIIIXXI 294 | + 0.0021855100038679384 * YZZZZYYZZZYI 295 | + 0.0021855100038679384 * XZZZZXYZZZYI 296 | + 0.0021855100038679384 * YZZZZYXZZZXI 297 | + 0.0021855100038679384 * XZZZZXXZZZXI 298 | + 0.19556153695062642 * IIIIZIIIIIZI 299 | + 0.007068408596227355 * IIIIZIIIIYYI 300 | + 0.007068408596227355 * IIIIZIIIIXXI 301 | + 0.030215603509396297 * IIIIZIYZZZYI 302 | + 0.030215603509396297 * IIIIZIXZZZXI 303 | + 0.007068408596227355 * IIIYYIIIIIZI 304 | + 0.007068408596227355 * IIIXXIIIIIZI 305 | + 0.03461532759902769 * IIIYYIIIIYYI 306 | + 0.03461532759902769 * IIIXXIIIIYYI 307 | + 0.03461532759902769 * IIIYYIIIIXXI 308 | + 0.03461532759902769 * IIIXXIIIIXXI 309 | + 0.005294765531270142 * IIIYYIYZZZYI 310 | + 0.005294765531270142 * IIIXXIYZZZYI 311 | + 0.005294765531270142 * IIIYYIXZZZXI 312 | + 0.005294765531270142 * IIIXXIXZZZXI 313 | + 0.03923565568385519 * IIYZYIIIYZYI 314 | + 0.03923565568385519 * IIXZXIIIYZYI 315 | + 0.03923565568385519 * IIYZYIIIXZXI 316 | + 0.03923565568385519 * IIXZXIIIXZXI 317 | + 0.03923565568385523 * IYZZYIIYZZYI 318 | + 0.03923565568385523 * IXZZXIIYZZYI 319 | + 0.03923565568385523 * IYZZYIIXZZXI 320 | + 0.03923565568385523 * IXZZXIIXZZXI 321 | + 0.030215603509396297 * YZZZYIIIIIZI 322 | + 0.030215603509396297 * XZZZXIIIIIZI 323 | + 0.0052947655312701415 * YZZZYIIIIYYI 324 | + 0.0052947655312701415 * XZZZXIIIIYYI 325 | + 0.0052947655312701415 * YZZZYIIIIXXI 326 | + 0.0052947655312701415 * XZZZXIIIIXXI 327 | + 0.02049327783662766 * YZZZYIYZZZYI 328 | + 0.02049327783662766 * XZZZXIYZZZYI 329 | + 0.02049327783662766 * YZZZYIXZZZXI 330 | + 0.02049327783662766 * XZZZXIXZZZXI 331 | + 0.1770402288891335 * IIIZIIIIIIZI 332 | - 0.015515621514157266 * IIIZIIIIIYYI 333 | - 0.015515621514157266 * IIIZIIIIIXXI 334 | + 0.012739797582007797 * IIIZIIYZZZYI 335 | + 0.012739797582007797 * IIIZIIXZZZXI 336 | + 0.010075879017917287 * IIYYIIIIYZYI 337 | + 0.010075879017917287 * IIXXIIIIYZYI 338 | + 0.010075879017917287 * IIYYIIIIXZXI 339 | + 0.010075879017917287 * IIXXIIIIXZXI 340 | + 0.010075879017917302 * IYZYIIIYZZYI 341 | + 0.010075879017917302 * IXZXIIIYZZYI 342 | + 0.010075879017917302 * IYZYIIIXZZXI 343 | + 0.010075879017917302 * IXZXIIIXZZXI 344 | - 0.025445740118383412 * YZZYIIIIIIZI 345 | - 0.025445740118383412 * XZZXIIIIIIZI 346 | + 0.017174030552922832 * YZZYIIIIIYYI 347 | + 0.017174030552922832 * XZZXIIIIIYYI 348 | + 0.017174030552922832 * YZZYIIIIIXXI 349 | + 0.017174030552922832 * XZZXIIIIIXXI 350 | - 0.015171505981391524 * YZZYIIYZZZYI 351 | - 0.015171505981391524 * XZZXIIYZZZYI 352 | - 0.015171505981391524 * YZZYIIXZZZXI 353 | - 0.015171505981391524 * XZZXIIXZZZXI 354 | + 0.1944572742885502 * IIZIIIIIIIZI 355 | - 0.011954543127208919 * IIZIIIIIIYYI 356 | - 0.011954543127208919 * IIZIIIIIIXXI 357 | + 0.030481236881455594 * IIZIIIYZZZYI 358 | + 0.030481236881455594 * IIZIIIXZZZXI 359 | - 0.010412704013153124 * YZYIIIIIYZYI 360 | - 0.010412704013153124 * XZXIIIIIYZYI 361 | - 0.010412704013153124 * YZYIIIIIXZXI 362 | - 0.010412704013153124 * XZXIIIIIXZXI 363 | + 0.19445727428855036 * IZIIIIIIIIZI 364 | - 0.011954543127208936 * IZIIIIIIIYYI 365 | - 0.011954543127208936 * IZIIIIIIIXXI 366 | + 0.030481236881455646 * IZIIIIYZZZYI 367 | + 0.030481236881455646 * IZIIIIXZZZXI 368 | - 0.010412704013153131 * YYIIIIIYZZYI 369 | - 0.010412704013153131 * XXIIIIIYZZYI 370 | - 0.010412704013153131 * YYIIIIIXZZXI 371 | - 0.010412704013153131 * XXIIIIIXZZXI 372 | + 0.15322094577499534 * ZIIIIIIIIIZI 373 | + 0.024774056297191253 * ZIIIIIIIIYYI 374 | + 0.024774056297191253 * ZIIIIIIIIXXI 375 | + 0.004887451160076558 * ZIIIIIYZZZYI 376 | + 0.004887451160076558 * ZIIIIIXZZZXI 377 | + 0.16854612751797537 * IIIIIIIIZZII 378 | - 0.032185080703565454 * IIIIIIYZIYII 379 | - 0.032185080703565454 * IIIIIIXZIXII 380 | + 0.16854612751797557 * IIIIIIIZIZII 381 | - 0.03218508070356551 * IIIIIIYIZYII 382 | - 0.03218508070356551 * IIIIIIXIZXII 383 | + 0.11474769335906368 * IIIIIIZIIZII 384 | + 0.2477435611576671 * IIIIIZIIIZII 385 | - 0.06646081358040146 * IIIIIZYZZYII 386 | - 0.06646081358040146 * IIIIIZXZZXII 387 | + 0.003291995085767924 * IIIIYYIIIZII 388 | + 0.003291995085767924 * IIIIXXIIIZII 389 | - 0.0013362186287829577 * IIIIYYYZZYII 390 | - 0.0013362186287829577 * IIIIXXYZZYII 391 | - 0.0013362186287829577 * IIIIYYXZZXII 392 | - 0.0013362186287829577 * IIIIXXXZZXII 393 | - 0.0021752258828568525 * IIIYZYIIIZII 394 | - 0.0021752258828568525 * IIIXZXIIIZII 395 | + 0.0005179297856593569 * IIIYZYYZZYII 396 | + 0.0005179297856593569 * IIIXZXYZZYII 397 | + 0.0005179297856593569 * IIIYZYXZZXII 398 | + 0.0005179297856593569 * IIIXZXXZZXII 399 | + 0.0028020799368202254 * IIYZZYIIYYII 400 | + 0.0028020799368202254 * IIXZZXIIYYII 401 | + 0.0028020799368202254 * IIYZZYIIXXII 402 | + 0.0028020799368202254 * IIXZZXIIXXII 403 | + 0.002802079936820229 * IYZZZYIYZYII 404 | + 0.002802079936820229 * IXZZZXIYZYII 405 | + 0.002802079936820229 * IYZZZYIXZXII 406 | + 0.002802079936820229 * IXZZZXIXZXII 407 | - 0.0035412889744898444 * YZZZZYIIIZII 408 | - 0.0035412889744898444 * XZZZZXIIIZII 409 | + 0.0012026333132401498 * YZZZZYYZZYII 410 | + 0.0012026333132401498 * XZZZZXYZZYII 411 | + 0.0012026333132401498 * YZZZZYXZZXII 412 | + 0.0012026333132401498 * XZZZZXXZZXII 413 | + 0.1770402288891335 * IIIIZIIIIZII 414 | - 0.025445740118383412 * IIIIZIYZZYII 415 | - 0.025445740118383412 * IIIIZIXZZXII 416 | - 0.015515621514157266 * IIIYYIIIIZII 417 | - 0.015515621514157266 * IIIXXIIIIZII 418 | + 0.017174030552922836 * IIIYYIYZZYII 419 | + 0.017174030552922836 * IIIXXIYZZYII 420 | + 0.017174030552922836 * IIIYYIXZZXII 421 | + 0.017174030552922836 * IIIXXIXZZXII 422 | + 0.010075879017917287 * IIYZYIIIYYII 423 | + 0.010075879017917287 * IIXZXIIIYYII 424 | + 0.010075879017917287 * IIYZYIIIXXII 425 | + 0.010075879017917287 * IIXZXIIIXXII 426 | + 0.010075879017917302 * IYZZYIIYZYII 427 | + 0.010075879017917302 * IXZZXIIYZYII 428 | + 0.010075879017917302 * IYZZYIIXZXII 429 | + 0.010075879017917302 * IXZZXIIXZXII 430 | + 0.012739797582007797 * YZZZYIIIIZII 431 | + 0.012739797582007797 * XZZZXIIIIZII 432 | - 0.015171505981391525 * YZZZYIYZZYII 433 | - 0.015171505981391525 * XZZZXIYZZYII 434 | - 0.015171505981391525 * YZZZYIXZZXII 435 | - 0.015171505981391525 * XZZZXIXZZXII 436 | + 0.19419751099368573 * IIIZIIIIIZII 437 | - 0.031133270870748075 * IIIZIIYZZYII 438 | - 0.031133270870748075 * IIIZIIXZZXII 439 | + 0.012889297437763654 * IIYYIIIIYYII 440 | + 0.012889297437763654 * IIXXIIIIYYII 441 | + 0.012889297437763654 * IIYYIIIIXXII 442 | + 0.012889297437763654 * IIXXIIIIXXII 443 | + 0.012889297437763642 * IYZYIIIYZYII 444 | + 0.012889297437763642 * IXZXIIIYZYII 445 | + 0.012889297437763642 * IYZYIIIXZXII 446 | + 0.012889297437763642 * IXZXIIIXZXII 447 | - 0.031133270870748075 * YZZYIIIIIZII 448 | - 0.031133270870748075 * XZZXIIIIIZII 449 | + 0.030742343234052494 * YZZYIIYZZYII 450 | + 0.030742343234052494 * XZZXIIYZZYII 451 | + 0.030742343234052494 * YZZYIIXZZXII 452 | + 0.030742343234052494 * XZZXIIXZZXII 453 | + 0.18143542495573906 * IIZIIIIIIZII 454 | - 0.03408157142259996 * IIZIIIYZZYII 455 | - 0.03408157142259996 * IIZIIIXZZXII 456 | + 0.0018964907190345147 * YZYIIIIIYYII 457 | + 0.0018964907190345147 * XZXIIIIIYYII 458 | + 0.0018964907190345147 * YZYIIIIIXXII 459 | + 0.0018964907190345147 * XZXIIIIIXXII 460 | + 0.18143542495573922 * IZIIIIIIIZII 461 | - 0.0340815714226 * IZIIIIYZZYII 462 | - 0.0340815714226 * IZIIIIXZZXII 463 | + 0.0018964907190344904 * YYIIIIIYZYII 464 | + 0.0018964907190344904 * XXIIIIIYZYII 465 | + 0.0018964907190344904 * YYIIIIIXZXII 466 | + 0.0018964907190344904 * XXIIIIIXZXII 467 | + 0.14549003659311618 * ZIIIIIIIIZII 468 | + 0.011191589237488975 * ZIIIIIYZZYII 469 | + 0.011191589237488975 * ZIIIIIXZZXII 470 | + 0.18445643950497334 * IIIIIIIZZIII 471 | + 0.13259264116744926 * IIIIIIZIZIII 472 | + 0.27884897872323544 * IIIIIZIIZIII 473 | + 0.003074634317968737 * IIIIYYIIZIII 474 | + 0.003074634317968737 * IIIIXXIIZIII 475 | + 0.001070885444001511 * IIIYZYIIZIII 476 | + 0.001070885444001511 * IIIXZXIIZIII 477 | - 0.0025921940185395865 * IIYZZYYZYIII 478 | - 0.0025921940185395865 * IIXZZXYZYIII 479 | - 0.0025921940185395865 * IIYZZYXZXIII 480 | - 0.0025921940185395865 * IIXZZXXZXIII 481 | - 0.0010263780294593131 * YZZZZYIIZIII 482 | - 0.0010263780294593131 * XZZZZXIIZIII 483 | + 0.1944572742885502 * IIIIZIIIZIII 484 | - 0.011954543127208919 * IIIYYIIIZIII 485 | - 0.011954543127208919 * IIIXXIIIZIII 486 | - 0.010412704013153124 * IIYZYIYZYIII 487 | - 0.010412704013153124 * IIXZXIYZYIII 488 | - 0.010412704013153124 * IIYZYIXZXIII 489 | - 0.010412704013153124 * IIXZXIXZXIII 490 | + 0.030481236881455594 * YZZZYIIIZIII 491 | + 0.030481236881455594 * XZZZXIIIZIII 492 | + 0.18143542495573906 * IIIZIIIIZIII 493 | + 0.0018964907190345147 * IIYYIIYZYIII 494 | + 0.0018964907190345147 * IIXXIIYZYIII 495 | + 0.0018964907190345147 * IIYYIIXZXIII 496 | + 0.0018964907190345147 * IIXXIIXZXIII 497 | - 0.03408157142259997 * YZZYIIIIZIII 498 | - 0.03408157142259997 * XZZXIIIIZIII 499 | + 0.22003977334376115 * IIZIIIIIZIII 500 | + 0.011861111279596038 * IYYIIIIYYIII 501 | + 0.011861111279596038 * IXXIIIIYYIII 502 | + 0.011861111279596038 * IYYIIIIXXIII 503 | + 0.011861111279596038 * IXXIIIIXXIII 504 | + 0.006035198006558757 * YZYIIIYZYIII 505 | + 0.006035198006558757 * XZXIIIYZYIII 506 | + 0.006035198006558757 * YZYIIIXZXIII 507 | + 0.006035198006558757 * XZXIIIXZXIII 508 | + 0.19631755078456936 * IZIIIIIIZIII 509 | + 0.13862783917400803 * ZIIIIIIIZIII 510 | + 0.13259264116744937 * IIIIIIZZIIII 511 | + 0.27884897872323566 * IIIIIZIZIIII 512 | + 0.003074634317968743 * IIIIYYIZIIII 513 | + 0.003074634317968743 * IIIIXXIZIIII 514 | + 0.0010708854440015158 * IIIYZYIZIIII 515 | + 0.0010708854440015158 * IIIXZXIZIIII 516 | - 0.0025921940185395904 * IYZZZYYYIIII 517 | - 0.0025921940185395904 * IXZZZXYYIIII 518 | - 0.0025921940185395904 * IYZZZYXXIIII 519 | - 0.0025921940185395904 * IXZZZXXXIIII 520 | - 0.0010263780294593216 * YZZZZYIZIIII 521 | - 0.0010263780294593216 * XZZZZXIZIIII 522 | + 0.19445727428855036 * IIIIZIIZIIII 523 | - 0.011954543127208936 * IIIYYIIZIIII 524 | - 0.011954543127208936 * IIIXXIIZIIII 525 | - 0.010412704013153131 * IYZZYIYYIIII 526 | - 0.010412704013153131 * IXZZXIYYIIII 527 | - 0.010412704013153131 * IYZZYIXXIIII 528 | - 0.010412704013153131 * IXZZXIXXIIII 529 | + 0.030481236881455646 * YZZZYIIZIIII 530 | + 0.030481236881455646 * XZZZXIIZIIII 531 | + 0.18143542495573922 * IIIZIIIZIIII 532 | + 0.0018964907190344904 * IYZYIIYYIIII 533 | + 0.0018964907190344904 * IXZXIIYYIIII 534 | + 0.0018964907190344904 * IYZYIIXXIIII 535 | + 0.0018964907190344904 * IXZXIIXXIIII 536 | - 0.0340815714226 * YZZYIIIZIIII 537 | - 0.0340815714226 * XZZXIIIZIIII 538 | + 0.19631755078456936 * IIZIIIIZIIII 539 | + 0.2200397733437616 * IZIIIIIZIIII 540 | + 0.006035198006558759 * YYIIIIYYIIII 541 | + 0.006035198006558759 * XXIIIIYYIIII 542 | + 0.006035198006558759 * YYIIIIXXIIII 543 | + 0.006035198006558759 * XXIIIIXXIIII 544 | + 0.13862783917400812 * ZIIIIIIZIIII 545 | + 0.1836203345902841 * IIIIIZZIIIII 546 | + 0.0013042320407693699 * IIIIYYZIIIII 547 | + 0.0013042320407693699 * IIIIXXZIIIII 548 | + 0.0039999857416192835 * IIIYZYZIIIII 549 | + 0.0039999857416192835 * IIIXZXZIIIII 550 | + 0.0020700936624165403 * YZZZZYZIIIII 551 | + 0.0020700936624165403 * XZZZZXZIIIII 552 | + 0.15322094577499534 * IIIIZIZIIIII 553 | + 0.02477405629719125 * IIIYYIZIIIII 554 | + 0.02477405629719125 * IIIXXIZIIIII 555 | + 0.004887451160076558 * YZZZYIZIIIII 556 | + 0.004887451160076558 * XZZZXIZIIIII 557 | + 0.14549003659311618 * IIIZIIZIIIII 558 | + 0.011191589237488973 * YZZYIIZIIIII 559 | + 0.011191589237488973 * XZZXIIZIIIII 560 | + 0.13862783917400803 * IIZIIIZIIIII 561 | + 0.13862783917400812 * IZIIIIZIIIII 562 | + 0.17607603157017307 * ZIIIIIZIIIII 563 | + 0.24974036168481817 * IIIIZZIIIIII 564 | - 0.01734850035372025 * IIIYYZIIIIII 565 | - 0.01734850035372025 * IIIXXZIIIIII 566 | + 0.05385802397481705 * YZZZYZIIIIII 567 | + 0.05385802397481705 * XZZZXZIIIIII 568 | + 0.0019682136944003748 * IIIYIYIIIIII 569 | + 0.0019682136944003748 * IIIXIXIIIIII 570 | + 0.001808492977723844 * YZZZIYIIIIII 571 | + 0.001808492977723844 * XZZZIXIIIIII 572 | - 0.0009559454125376033 * YZZXXYIIIIII 573 | - 0.006429897335078852 * YZZYYYIIIIII 574 | - 0.005473951922541248 * XZZXYYIIIIII 575 | - 0.005473951922541248 * YZZYXXIIIIII 576 | - 0.006429897335078852 * XZZXXXIIIIII 577 | - 0.0009559454125376033 * XZZYYXIIIIII 578 | + 0.2415888126737023 * IIIZIZIIIIII 579 | - 0.06485953217641371 * YZZYIZIIIIII 580 | - 0.06485953217641371 * XZZXIZIIIIII 581 | + 0.008703297941162638 * IIIZYYIIIIII 582 | + 0.008703297941162638 * IIIZXXIIIIII 583 | - 0.0030233591888304866 * YZZIZYIIIIII 584 | - 0.0030233591888304866 * XZZIZXIIIIII 585 | + 0.2723855556776968 * IIZIIZIIIIII 586 | + 0.01152667828410398 * IIZIYYIIIIII 587 | + 0.01152667828410398 * IIZIXXIIIIII 588 | + 0.003872965380821736 * IIZYZYIIIIII 589 | + 0.003872965380821736 * IIZXZXIIIIII 590 | - 0.003618572047998899 * YZIZZYIIIIII 591 | - 0.003618572047998899 * XZIZZXIIIIII 592 | + 0.272385555677697 * IZIIIZIIIIII 593 | + 0.011526678284103996 * IZIIYYIIIIII 594 | + 0.011526678284103996 * IZIIXXIIIIII 595 | + 0.0038729653808217447 * IZIYZYIIIIII 596 | + 0.0038729653808217447 * IZIXZXIIIIII 597 | - 0.003618572047998911 * YIZZZYIIIIII 598 | - 0.003618572047998911 * XIZZZXIIIIII 599 | + 0.17832763324247464 * ZIIIIZIIIIII 600 | + 0.0034897420446373074 * ZIIIYYIIIIII 601 | + 0.0034897420446373074 * ZIIIXXIIIIII 602 | + 0.005202619054859435 * ZIIYZYIIIIII 603 | + 0.005202619054859435 * ZIIXZXIIIIII 604 | + 0.1424249012901058 * IIIZZIIIIIII 605 | - 0.02015097458711327 * YZZYZIIIIIII 606 | - 0.02015097458711327 * XZZXZIIIIIII 607 | + 0.029913828134930636 * YZZIYIIIIIII 608 | + 0.029913828134930636 * XZZIXIIIIIII 609 | + 0.15522161860469502 * IIZIZIIIIIII 610 | - 0.0018786641092916317 * IIZYYIIIIIII 611 | - 0.0018786641092916317 * IIZXXIIIIIII 612 | + 0.02006853286830247 * YZIZYIIIIIII 613 | + 0.02006853286830247 * XZIZXIIIIIII 614 | + 0.15522161860469513 * IZIIZIIIIIII 615 | - 0.0018786641092916338 * IZIYYIIIIIII 616 | - 0.0018786641092916338 * IZIXXIIIIIII 617 | + 0.020068532868302513 * YIZZYIIIIIII 618 | + 0.020068532868302513 * XIZZXIIIIIII 619 | + 0.13272766793836765 * ZIIIZIIIIIII 620 | + 0.009602550315799726 * ZIIYYIIIIIII 621 | + 0.009602550315799726 * ZIIXXIIIIIII 622 | + 0.16854612751797537 * IIZZIIIIIIII 623 | - 0.032185080703565454 * YZIYIIIIIIII 624 | - 0.032185080703565454 * XZIXIIIIIIII 625 | + 0.16854612751797557 * IZIZIIIIIIII 626 | - 0.03218508070356551 * YIZYIIIIIIII 627 | - 0.03218508070356551 * XIZXIIIIIIII 628 | + 0.11474769335906368 * ZIIZIIIIIIII 629 | + 0.18445643950497334 * IZZIIIIIIIII 630 | + 0.13259264116744926 * ZIZIIIIIIIII 631 | + 0.13259264116744937 * ZZIIIIIIIIII -------------------------------------------------------------------------------- /Hamiltonian_to_Pennylane.py: -------------------------------------------------------------------------------- 1 | import re 2 | def parse_hamiltonian_string(hamiltonian_str): 3 | """ 4 | Parse the input Hamiltonian string into a list of tuples. 5 | """ 6 | term_pattern = re.compile(r'([\+\-]?\s{0,}\d+\.\d+)\s*\*\s*([IXYZ]+)') 7 | terms = term_pattern.findall(hamiltonian_str) 8 | 9 | parsed_terms = [(term[1], float(term[0].replace(" ", ""))) for term in terms] 10 | return parsed_terms 11 | 12 | def convert_to_pennylane_format(term_str, coefficient): 13 | """ 14 | Convert a term from the parsed format to PennyLane's Hamiltonian format. 15 | """ 16 | operators = list(term_str) 17 | terms = [] 18 | for i, op in enumerate(operators): 19 | if op != 'I': 20 | terms.append(f"{op}{i}") 21 | term_in_pennylane = ' '.join(terms) 22 | if not term_in_pennylane: 23 | term_in_pennylane = "I0" # This ensures we're correctly representing identity terms 24 | return f"({coefficient}) [{term_in_pennylane}]" 25 | 26 | # Input Hamiltonian string 27 | input_str = """ 28 | -51.1139071673799 * IIIIIIIIIIII 29 | + 12.41620827390893 * IIIIIIIIIIIZ 30 | + 0.12057948842535543 * IIIIIIIIIIYY 31 | + 0.12057948842535543 * IIIIIIIIIIXX 32 | + 0.0327578387990602 * IIIIIIIIIYZY 33 | + 0.0327578387990602 * IIIIIIIIIXZX 34 | """ 35 | 36 | # Parse the Hamiltonian 37 | parsed_hamiltonian = parse_hamiltonian_string(input_str) 38 | 39 | # Convert to PennyLane format 40 | converted_hamiltonian = [] 41 | for term_str, coeff in parsed_hamiltonian: 42 | converted_term = convert_to_pennylane_format(term_str, coeff) 43 | converted_hamiltonian.append(converted_term) 44 | 45 | # Join the terms with '+' to get the final Hamiltonian 46 | final_hamiltonian = '\n+ '.join(converted_hamiltonian) 47 | print(final_hamiltonian) 48 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | GNU GENERAL PUBLIC LICENSE 2 | Version 2, June 1991 3 | 4 | Copyright (C) 1989, 1991 Free Software Foundation, Inc., 5 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 6 | Everyone is permitted to copy and distribute verbatim copies 7 | of this license document, but changing it is not allowed. 8 | 9 | Preamble 10 | 11 | The licenses for most software are designed to take away your 12 | freedom to share and change it. By contrast, the GNU General Public 13 | License is intended to guarantee your freedom to share and change free 14 | software--to make sure the software is free for all its users. This 15 | General Public License applies to most of the Free Software 16 | Foundation's software and to any other program whose authors commit to 17 | using it. (Some other Free Software Foundation software is covered by 18 | the GNU Lesser General Public License instead.) You can apply it to 19 | your programs, too. 20 | 21 | When we speak of free software, we are referring to freedom, not 22 | price. Our General Public Licenses are designed to make sure that you 23 | have the freedom to distribute copies of free software (and charge for 24 | this service if you wish), that you receive source code or can get it 25 | if you want it, that you can change the software or use pieces of it 26 | in new free programs; and that you know you can do these things. 27 | 28 | To protect your rights, we need to make restrictions that forbid 29 | anyone to deny you these rights or to ask you to surrender the rights. 30 | These restrictions translate to certain responsibilities for you if you 31 | distribute copies of the software, or if you modify it. 32 | 33 | For example, if you distribute copies of such a program, whether 34 | gratis or for a fee, you must give the recipients all the rights that 35 | you have. You must make sure that they, too, receive or can get the 36 | source code. And you must show them these terms so they know their 37 | rights. 38 | 39 | We protect your rights with two steps: (1) copyright the software, and 40 | (2) offer you this license which gives you legal permission to copy, 41 | distribute and/or modify the software. 42 | 43 | Also, for each author's protection and ours, we want to make certain 44 | that everyone understands that there is no warranty for this free 45 | software. If the software is modified by someone else and passed on, we 46 | want its recipients to know that what they have is not the original, so 47 | that any problems introduced by others will not reflect on the original 48 | authors' reputations. 49 | 50 | Finally, any free program is threatened constantly by software 51 | patents. We wish to avoid the danger that redistributors of a free 52 | program will individually obtain patent licenses, in effect making the 53 | program proprietary. To prevent this, we have made it clear that any 54 | patent must be licensed for everyone's free use or not licensed at all. 55 | 56 | The precise terms and conditions for copying, distribution and 57 | modification follow. 58 | 59 | GNU GENERAL PUBLIC LICENSE 60 | TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 61 | 62 | 0. This License applies to any program or other work which contains 63 | a notice placed by the copyright holder saying it may be distributed 64 | under the terms of this General Public License. The "Program", below, 65 | refers to any such program or work, and a "work based on the Program" 66 | means either the Program or any derivative work under copyright law: 67 | that is to say, a work containing the Program or a portion of it, 68 | either verbatim or with modifications and/or translated into another 69 | language. (Hereinafter, translation is included without limitation in 70 | the term "modification".) Each licensee is addressed as "you". 71 | 72 | Activities other than copying, distribution and modification are not 73 | covered by this License; they are outside its scope. The act of 74 | running the Program is not restricted, and the output from the Program 75 | is covered only if its contents constitute a work based on the 76 | Program (independent of having been made by running the Program). 77 | Whether that is true depends on what the Program does. 78 | 79 | 1. You may copy and distribute verbatim copies of the Program's 80 | source code as you receive it, in any medium, provided that you 81 | conspicuously and appropriately publish on each copy an appropriate 82 | copyright notice and disclaimer of warranty; keep intact all the 83 | notices that refer to this License and to the absence of any warranty; 84 | and give any other recipients of the Program a copy of this License 85 | along with the Program. 86 | 87 | You may charge a fee for the physical act of transferring a copy, and 88 | you may at your option offer warranty protection in exchange for a fee. 89 | 90 | 2. You may modify your copy or copies of the Program or any portion 91 | of it, thus forming a work based on the Program, and copy and 92 | distribute such modifications or work under the terms of Section 1 93 | above, provided that you also meet all of these conditions: 94 | 95 | a) You must cause the modified files to carry prominent notices 96 | stating that you changed the files and the date of any change. 97 | 98 | b) You must cause any work that you distribute or publish, that in 99 | whole or in part contains or is derived from the Program or any 100 | part thereof, to be licensed as a whole at no charge to all third 101 | parties under the terms of this License. 102 | 103 | c) If the modified program normally reads commands interactively 104 | when run, you must cause it, when started running for such 105 | interactive use in the most ordinary way, to print or display an 106 | announcement including an appropriate copyright notice and a 107 | notice that there is no warranty (or else, saying that you provide 108 | a warranty) and that users may redistribute the program under 109 | these conditions, and telling the user how to view a copy of this 110 | License. (Exception: if the Program itself is interactive but 111 | does not normally print such an announcement, your work based on 112 | the Program is not required to print an announcement.) 113 | 114 | These requirements apply to the modified work as a whole. If 115 | identifiable sections of that work are not derived from the Program, 116 | and can be reasonably considered independent and separate works in 117 | themselves, then this License, and its terms, do not apply to those 118 | sections when you distribute them as separate works. But when you 119 | distribute the same sections as part of a whole which is a work based 120 | on the Program, the distribution of the whole must be on the terms of 121 | this License, whose permissions for other licensees extend to the 122 | entire whole, and thus to each and every part regardless of who wrote it. 123 | 124 | Thus, it is not the intent of this section to claim rights or contest 125 | your rights to work written entirely by you; rather, the intent is to 126 | exercise the right to control the distribution of derivative or 127 | collective works based on the Program. 128 | 129 | In addition, mere aggregation of another work not based on the Program 130 | with the Program (or with a work based on the Program) on a volume of 131 | a storage or distribution medium does not bring the other work under 132 | the scope of this License. 133 | 134 | 3. You may copy and distribute the Program (or a work based on it, 135 | under Section 2) in object code or executable form under the terms of 136 | Sections 1 and 2 above provided that you also do one of the following: 137 | 138 | a) Accompany it with the complete corresponding machine-readable 139 | source code, which must be distributed under the terms of Sections 140 | 1 and 2 above on a medium customarily used for software interchange; or, 141 | 142 | b) Accompany it with a written offer, valid for at least three 143 | years, to give any third party, for a charge no more than your 144 | cost of physically performing source distribution, a complete 145 | machine-readable copy of the corresponding source code, to be 146 | distributed under the terms of Sections 1 and 2 above on a medium 147 | customarily used for software interchange; or, 148 | 149 | c) Accompany it with the information you received as to the offer 150 | to distribute corresponding source code. (This alternative is 151 | allowed only for noncommercial distribution and only if you 152 | received the program in object code or executable form with such 153 | an offer, in accord with Subsection b above.) 154 | 155 | The source code for a work means the preferred form of the work for 156 | making modifications to it. For an executable work, complete source 157 | code means all the source code for all modules it contains, plus any 158 | associated interface definition files, plus the scripts used to 159 | control compilation and installation of the executable. However, as a 160 | special exception, the source code distributed need not include 161 | anything that is normally distributed (in either source or binary 162 | form) with the major components (compiler, kernel, and so on) of the 163 | operating system on which the executable runs, unless that component 164 | itself accompanies the executable. 165 | 166 | If distribution of executable or object code is made by offering 167 | access to copy from a designated place, then offering equivalent 168 | access to copy the source code from the same place counts as 169 | distribution of the source code, even though third parties are not 170 | compelled to copy the source along with the object code. 171 | 172 | 4. You may not copy, modify, sublicense, or distribute the Program 173 | except as expressly provided under this License. Any attempt 174 | otherwise to copy, modify, sublicense or distribute the Program is 175 | void, and will automatically terminate your rights under this License. 176 | However, parties who have received copies, or rights, from you under 177 | this License will not have their licenses terminated so long as such 178 | parties remain in full compliance. 179 | 180 | 5. You are not required to accept this License, since you have not 181 | signed it. However, nothing else grants you permission to modify or 182 | distribute the Program or its derivative works. These actions are 183 | prohibited by law if you do not accept this License. Therefore, by 184 | modifying or distributing the Program (or any work based on the 185 | Program), you indicate your acceptance of this License to do so, and 186 | all its terms and conditions for copying, distributing or modifying 187 | the Program or works based on it. 188 | 189 | 6. Each time you redistribute the Program (or any work based on the 190 | Program), the recipient automatically receives a license from the 191 | original licensor to copy, distribute or modify the Program subject to 192 | these terms and conditions. You may not impose any further 193 | restrictions on the recipients' exercise of the rights granted herein. 194 | You are not responsible for enforcing compliance by third parties to 195 | this License. 196 | 197 | 7. If, as a consequence of a court judgment or allegation of patent 198 | infringement or for any other reason (not limited to patent issues), 199 | conditions are imposed on you (whether by court order, agreement or 200 | otherwise) that contradict the conditions of this License, they do not 201 | excuse you from the conditions of this License. If you cannot 202 | distribute so as to satisfy simultaneously your obligations under this 203 | License and any other pertinent obligations, then as a consequence you 204 | may not distribute the Program at all. For example, if a patent 205 | license would not permit royalty-free redistribution of the Program by 206 | all those who receive copies directly or indirectly through you, then 207 | the only way you could satisfy both it and this License would be to 208 | refrain entirely from distribution of the Program. 209 | 210 | If any portion of this section is held invalid or unenforceable under 211 | any particular circumstance, the balance of the section is intended to 212 | apply and the section as a whole is intended to apply in other 213 | circumstances. 214 | 215 | It is not the purpose of this section to induce you to infringe any 216 | patents or other property right claims or to contest validity of any 217 | such claims; this section has the sole purpose of protecting the 218 | integrity of the free software distribution system, which is 219 | implemented by public license practices. Many people have made 220 | generous contributions to the wide range of software distributed 221 | through that system in reliance on consistent application of that 222 | system; it is up to the author/donor to decide if he or she is willing 223 | to distribute software through any other system and a licensee cannot 224 | impose that choice. 225 | 226 | This section is intended to make thoroughly clear what is believed to 227 | be a consequence of the rest of this License. 228 | 229 | 8. If the distribution and/or use of the Program is restricted in 230 | certain countries either by patents or by copyrighted interfaces, the 231 | original copyright holder who places the Program under this License 232 | may add an explicit geographical distribution limitation excluding 233 | those countries, so that distribution is permitted only in or among 234 | countries not thus excluded. In such case, this License incorporates 235 | the limitation as if written in the body of this License. 236 | 237 | 9. The Free Software Foundation may publish revised and/or new versions 238 | of the General Public License from time to time. Such new versions will 239 | be similar in spirit to the present version, but may differ in detail to 240 | address new problems or concerns. 241 | 242 | Each version is given a distinguishing version number. If the Program 243 | specifies a version number of this License which applies to it and "any 244 | later version", you have the option of following the terms and conditions 245 | either of that version or of any later version published by the Free 246 | Software Foundation. If the Program does not specify a version number of 247 | this License, you may choose any version ever published by the Free Software 248 | Foundation. 249 | 250 | 10. If you wish to incorporate parts of the Program into other free 251 | programs whose distribution conditions are different, write to the author 252 | to ask for permission. For software which is copyrighted by the Free 253 | Software Foundation, write to the Free Software Foundation; we sometimes 254 | make exceptions for this. Our decision will be guided by the two goals 255 | of preserving the free status of all derivatives of our free software and 256 | of promoting the sharing and reuse of software generally. 257 | 258 | NO WARRANTY 259 | 260 | 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY 261 | FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN 262 | OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES 263 | PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED 264 | OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 265 | MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS 266 | TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE 267 | PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, 268 | REPAIR OR CORRECTION. 269 | 270 | 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING 271 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR 272 | REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, 273 | INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING 274 | OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED 275 | TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY 276 | YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER 277 | PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE 278 | POSSIBILITY OF SUCH DAMAGES. 279 | 280 | END OF TERMS AND CONDITIONS 281 | 282 | How to Apply These Terms to Your New Programs 283 | 284 | If you develop a new program, and you want it to be of the greatest 285 | possible use to the public, the best way to achieve this is to make it 286 | free software which everyone can redistribute and change under these terms. 287 | 288 | To do so, attach the following notices to the program. It is safest 289 | to attach them to the start of each source file to most effectively 290 | convey the exclusion of warranty; and each file should have at least 291 | the "copyright" line and a pointer to where the full notice is found. 292 | 293 | 294 | Copyright (C) 295 | 296 | This program is free software; you can redistribute it and/or modify 297 | it under the terms of the GNU General Public License as published by 298 | the Free Software Foundation; either version 2 of the License, or 299 | (at your option) any later version. 300 | 301 | This program is distributed in the hope that it will be useful, 302 | but WITHOUT ANY WARRANTY; without even the implied warranty of 303 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 304 | GNU General Public License for more details. 305 | 306 | You should have received a copy of the GNU General Public License along 307 | with this program; if not, write to the Free Software Foundation, Inc., 308 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 309 | 310 | Also add information on how to contact you by electronic and paper mail. 311 | 312 | If the program is interactive, make it output a short notice like this 313 | when it starts in an interactive mode: 314 | 315 | Gnomovision version 69, Copyright (C) year name of author 316 | Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. 317 | This is free software, and you are welcome to redistribute it 318 | under certain conditions; type `show c' for details. 319 | 320 | The hypothetical commands `show w' and `show c' should show the appropriate 321 | parts of the General Public License. Of course, the commands you use may 322 | be called something other than `show w' and `show c'; they could even be 323 | mouse-clicks or menu items--whatever suits your program. 324 | 325 | You should also get your employer (if you work as a programmer) or your 326 | school, if any, to sign a "copyright disclaimer" for the program, if 327 | necessary. Here is a sample; alter the names: 328 | 329 | Yoyodyne, Inc., hereby disclaims all copyright interest in the program 330 | `Gnomovision' (which makes passes at compilers) written by James Hacker. 331 | 332 | , 1 April 1989 333 | Ty Coon, President of Vice 334 | 335 | This General Public License does not permit incorporating your program into 336 | proprietary programs. If your program is a subroutine library, you may 337 | consider it more useful to permit linking proprietary applications with the 338 | library. If this is what you want to do, use the GNU Lesser General 339 | Public License instead of this License. 340 | -------------------------------------------------------------------------------- /NoiseModel/fakecairo.pkl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qccontest/QC-Contest-Demo/68987d80f4380eec50ba2c73b52b99371a1d1726/NoiseModel/fakecairo.pkl -------------------------------------------------------------------------------- /NoiseModel/fakekolkata.pkl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qccontest/QC-Contest-Demo/68987d80f4380eec50ba2c73b52b99371a1d1726/NoiseModel/fakekolkata.pkl -------------------------------------------------------------------------------- /NoiseModel/fakemontreal.pkl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qccontest/QC-Contest-Demo/68987d80f4380eec50ba2c73b52b99371a1d1726/NoiseModel/fakemontreal.pkl -------------------------------------------------------------------------------- /NoiseModel_and_SystemModel.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "markdown", 5 | "metadata": { 6 | "id": "gj3jZbCBSn71" 7 | }, 8 | "source": [ 9 | "# Example Code for Implement the Noise Model" 10 | ] 11 | }, 12 | { 13 | "cell_type": "markdown", 14 | "metadata": { 15 | "id": "54NH9S1vHrq8" 16 | }, 17 | "source": [ 18 | "## Basic Installation" 19 | ] 20 | }, 21 | { 22 | "cell_type": "markdown", 23 | "metadata": { 24 | "id": "R0OZ3HZZS9Me" 25 | }, 26 | "source": [ 27 | "Install required package, we highly recommend participant to use qiskit platform, or at least participants can finish preprocessing at other platform and transfer the circuit to qiskit format, since our noise model is from IBM real machine backend and we restricted some algorithmic seeds which could be varied from different platform." 28 | ] 29 | }, 30 | { 31 | "cell_type": "code", 32 | "execution_count": null, 33 | "metadata": { 34 | "colab": { 35 | "base_uri": "https://localhost:8080/" 36 | }, 37 | "id": "Pi-oJxidjBSw", 38 | "outputId": "57ac6166-c0fb-4d2d-b511-03212ca47f0b" 39 | }, 40 | "outputs": [ 41 | { 42 | "name": "stdout", 43 | "output_type": "stream", 44 | "text": [ 45 | "Collecting qiskit\n", 46 | " Downloading qiskit-0.44.1-py3-none-any.whl (8.2 kB)\n", 47 | "Collecting qiskit-terra==0.25.1 (from qiskit)\n", 48 | " Downloading qiskit_terra-0.25.1-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (6.1 MB)\n", 49 | "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m6.1/6.1 MB\u001b[0m \u001b[31m21.0 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n", 50 | "\u001b[?25hCollecting rustworkx>=0.13.0 (from qiskit-terra==0.25.1->qiskit)\n", 51 | " Downloading rustworkx-0.13.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (2.0 MB)\n", 52 | "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m2.0/2.0 MB\u001b[0m \u001b[31m31.0 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n", 53 | "\u001b[?25hRequirement already satisfied: numpy>=1.17 in /usr/local/lib/python3.10/dist-packages (from qiskit-terra==0.25.1->qiskit) (1.23.5)\n", 54 | "Collecting ply>=3.10 (from qiskit-terra==0.25.1->qiskit)\n", 55 | " Downloading ply-3.11-py2.py3-none-any.whl (49 kB)\n", 56 | "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m49.6/49.6 kB\u001b[0m \u001b[31m3.9 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n", 57 | "\u001b[?25hRequirement already satisfied: psutil>=5 in /usr/local/lib/python3.10/dist-packages (from qiskit-terra==0.25.1->qiskit) (5.9.5)\n", 58 | "Requirement already satisfied: scipy>=1.5 in /usr/local/lib/python3.10/dist-packages (from qiskit-terra==0.25.1->qiskit) (1.10.1)\n", 59 | "Requirement already satisfied: sympy>=1.3 in /usr/local/lib/python3.10/dist-packages (from qiskit-terra==0.25.1->qiskit) (1.12)\n", 60 | "Collecting dill>=0.3 (from qiskit-terra==0.25.1->qiskit)\n", 61 | " Downloading dill-0.3.7-py3-none-any.whl (115 kB)\n", 62 | "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m115.3/115.3 kB\u001b[0m \u001b[31m9.9 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n", 63 | "\u001b[?25hRequirement already satisfied: python-dateutil>=2.8.0 in /usr/local/lib/python3.10/dist-packages (from qiskit-terra==0.25.1->qiskit) (2.8.2)\n", 64 | "Collecting stevedore>=3.0.0 (from qiskit-terra==0.25.1->qiskit)\n", 65 | " Downloading stevedore-5.1.0-py3-none-any.whl (49 kB)\n", 66 | "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m49.6/49.6 kB\u001b[0m \u001b[31m4.6 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n", 67 | "\u001b[?25hCollecting symengine<0.10,>=0.9 (from qiskit-terra==0.25.1->qiskit)\n", 68 | " Downloading symengine-0.9.2-cp310-cp310-manylinux2010_x86_64.whl (37.5 MB)\n", 69 | "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m37.5/37.5 MB\u001b[0m \u001b[31m14.5 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n", 70 | "\u001b[?25hRequirement already satisfied: typing-extensions in /usr/local/lib/python3.10/dist-packages (from qiskit-terra==0.25.1->qiskit) (4.5.0)\n", 71 | "Requirement already satisfied: six>=1.5 in /usr/local/lib/python3.10/dist-packages (from python-dateutil>=2.8.0->qiskit-terra==0.25.1->qiskit) (1.16.0)\n", 72 | "Collecting pbr!=2.1.0,>=2.0.0 (from stevedore>=3.0.0->qiskit-terra==0.25.1->qiskit)\n", 73 | " Downloading pbr-5.11.1-py2.py3-none-any.whl (112 kB)\n", 74 | "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m112.7/112.7 kB\u001b[0m \u001b[31m6.9 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n", 75 | "\u001b[?25hRequirement already satisfied: mpmath>=0.19 in /usr/local/lib/python3.10/dist-packages (from sympy>=1.3->qiskit-terra==0.25.1->qiskit) (1.3.0)\n", 76 | "Installing collected packages: ply, symengine, rustworkx, pbr, dill, stevedore, qiskit-terra, qiskit\n", 77 | "Successfully installed dill-0.3.7 pbr-5.11.1 ply-3.11 qiskit-0.44.1 qiskit-terra-0.25.1 rustworkx-0.13.1 stevedore-5.1.0 symengine-0.9.2\n" 78 | ] 79 | } 80 | ], 81 | "source": [ 82 | "!pip install qiskit" 83 | ] 84 | }, 85 | { 86 | "cell_type": "code", 87 | "execution_count": null, 88 | "metadata": { 89 | "colab": { 90 | "base_uri": "https://localhost:8080/" 91 | }, 92 | "id": "FigIfjs1bYGa", 93 | "outputId": "5a2fb4db-8bfb-43d6-d672-73c6a0a5c7f8" 94 | }, 95 | "outputs": [ 96 | { 97 | "name": "stdout", 98 | "output_type": "stream", 99 | "text": [ 100 | "Collecting qiskit_aer\n", 101 | " Downloading qiskit_aer-0.12.2-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (12.8 MB)\n", 102 | "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m12.8/12.8 MB\u001b[0m \u001b[31m21.5 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n", 103 | "\u001b[?25hRequirement already satisfied: qiskit-terra>=0.21.0 in /usr/local/lib/python3.10/dist-packages (from qiskit_aer) (0.25.1)\n", 104 | "Requirement already satisfied: numpy>=1.16.3 in /usr/local/lib/python3.10/dist-packages (from qiskit_aer) (1.23.5)\n", 105 | "Requirement already satisfied: scipy>=1.0 in /usr/local/lib/python3.10/dist-packages (from qiskit_aer) (1.10.1)\n", 106 | "Requirement already satisfied: rustworkx>=0.13.0 in /usr/local/lib/python3.10/dist-packages (from qiskit-terra>=0.21.0->qiskit_aer) (0.13.1)\n", 107 | "Requirement already satisfied: ply>=3.10 in /usr/local/lib/python3.10/dist-packages (from qiskit-terra>=0.21.0->qiskit_aer) (3.11)\n", 108 | "Requirement already satisfied: psutil>=5 in /usr/local/lib/python3.10/dist-packages (from qiskit-terra>=0.21.0->qiskit_aer) (5.9.5)\n", 109 | "Requirement already satisfied: sympy>=1.3 in /usr/local/lib/python3.10/dist-packages (from qiskit-terra>=0.21.0->qiskit_aer) (1.12)\n", 110 | "Requirement already satisfied: dill>=0.3 in /usr/local/lib/python3.10/dist-packages (from qiskit-terra>=0.21.0->qiskit_aer) (0.3.7)\n", 111 | "Requirement already satisfied: python-dateutil>=2.8.0 in /usr/local/lib/python3.10/dist-packages (from qiskit-terra>=0.21.0->qiskit_aer) (2.8.2)\n", 112 | "Requirement already satisfied: stevedore>=3.0.0 in /usr/local/lib/python3.10/dist-packages (from qiskit-terra>=0.21.0->qiskit_aer) (5.1.0)\n", 113 | "Requirement already satisfied: symengine<0.10,>=0.9 in /usr/local/lib/python3.10/dist-packages (from qiskit-terra>=0.21.0->qiskit_aer) (0.9.2)\n", 114 | "Requirement already satisfied: typing-extensions in /usr/local/lib/python3.10/dist-packages (from qiskit-terra>=0.21.0->qiskit_aer) (4.5.0)\n", 115 | "Requirement already satisfied: six>=1.5 in /usr/local/lib/python3.10/dist-packages (from python-dateutil>=2.8.0->qiskit-terra>=0.21.0->qiskit_aer) (1.16.0)\n", 116 | "Requirement already satisfied: pbr!=2.1.0,>=2.0.0 in /usr/local/lib/python3.10/dist-packages (from stevedore>=3.0.0->qiskit-terra>=0.21.0->qiskit_aer) (5.11.1)\n", 117 | "Requirement already satisfied: mpmath>=0.19 in /usr/local/lib/python3.10/dist-packages (from sympy>=1.3->qiskit-terra>=0.21.0->qiskit_aer) (1.3.0)\n", 118 | "Installing collected packages: qiskit_aer\n", 119 | "Successfully installed qiskit_aer-0.12.2\n" 120 | ] 121 | } 122 | ], 123 | "source": [ 124 | "!pip install qiskit_aer" 125 | ] 126 | }, 127 | { 128 | "cell_type": "markdown", 129 | "metadata": { 130 | "id": "V30Z6_4G_Sto" 131 | }, 132 | "source": [ 133 | "# Implement Noise Model" 134 | ] 135 | }, 136 | { 137 | "cell_type": "code", 138 | "execution_count": 43, 139 | "metadata": { 140 | "id": "6yqcs2Aejtv7" 141 | }, 142 | "outputs": [], 143 | "source": [ 144 | "import numpy as np\n", 145 | "from qiskit import QuantumCircuit, transpile\n", 146 | "from qiskit.quantum_info import Kraus, SuperOp\n", 147 | "from qiskit_aer import AerSimulator\n", 148 | "from qiskit.tools.visualization import plot_histogram\n", 149 | "from qiskit_aer.noise import (NoiseModel, QuantumError, ReadoutError,\n", 150 | " pauli_error, depolarizing_error, thermal_relaxation_error)\n", 151 | "import numpy as np\n", 152 | "from qiskit.tools.jupyter import *\n", 153 | "import warnings\n", 154 | "warnings.filterwarnings('ignore')\n", 155 | "from qiskit import *\n", 156 | "import time\n", 157 | "from qiskit.providers.aer.noise import NoiseModel\n", 158 | "import qiskit.providers.aer.noise as noise\n", 159 | "from qiskit.utils import QuantumInstance, algorithm_globals" 160 | ] 161 | }, 162 | { 163 | "cell_type": "code", 164 | "execution_count": null, 165 | "metadata": { 166 | "id": "BBENV0zBoJZG" 167 | }, 168 | "outputs": [], 169 | "source": [ 170 | "from qiskit.providers.fake_provider import *" 171 | ] 172 | }, 173 | { 174 | "cell_type": "code", 175 | "execution_count": 65, 176 | "metadata": { 177 | "id": "2CHRkoGUxv9D" 178 | }, 179 | "outputs": [], 180 | "source": [ 181 | "import pickle" 182 | ] 183 | }, 184 | { 185 | "cell_type": "code", 186 | "execution_count": 124, 187 | "metadata": { 188 | "id": "kHk6FZU1ypz2" 189 | }, 190 | "outputs": [], 191 | "source": [ 192 | "with open('NoiseModel/fakekolkata.pkl', 'rb') as file:\n", 193 | " noise_model = pickle.load(file)" 194 | ] 195 | }, 196 | { 197 | "cell_type": "code", 198 | "execution_count": 125, 199 | "metadata": { 200 | "id": "S21Wr7j2y9q4" 201 | }, 202 | "outputs": [], 203 | "source": [ 204 | "noise_model1 = noise.NoiseModel()" 205 | ] 206 | }, 207 | { 208 | "cell_type": "code", 209 | "execution_count": 126, 210 | "metadata": { 211 | "id": "16x2_Y4_yybr" 212 | }, 213 | "outputs": [], 214 | "source": [ 215 | "noise_modelreal = noise_model1.from_dict(noise_model)" 216 | ] 217 | }, 218 | { 219 | "cell_type": "code", 220 | "execution_count": 127, 221 | "metadata": { 222 | "colab": { 223 | "base_uri": "https://localhost:8080/" 224 | }, 225 | "id": "VZXQhYfsz8tU", 226 | "outputId": "a125cd9f-e6f6-44e8-fe0f-2cf61b96f936" 227 | }, 228 | "outputs": [ 229 | { 230 | "data": { 231 | "text/plain": [ 232 | "" 233 | ] 234 | }, 235 | "execution_count": 127, 236 | "metadata": {}, 237 | "output_type": "execute_result" 238 | } 239 | ], 240 | "source": [ 241 | "noise_modelreal" 242 | ] 243 | }, 244 | { 245 | "cell_type": "markdown", 246 | "metadata": { 247 | "id": "ZggP0wgpBwrD" 248 | }, 249 | "source": [ 250 | "Transfer the noise model to Pennylane: https://pennylane.ai/blog/2021/05/how-to-simulate-noise-with-pennylane/" 251 | ] 252 | }, 253 | { 254 | "cell_type": "markdown", 255 | "metadata": { 256 | "id": "QRxsKX9zTc9g" 257 | }, 258 | "source": [ 259 | "Here we require paticipants to fix the algorithm seed in qiskit. *MUST* translate other format circuit to qiskit before any place need algorithm seed. And we give 20, 21, 30, 33, 36, 42, 43, 55, 67, 170 as set of seeds to test results on your side, and the result will be calculated as the average of results from some of those seeds with some hidden seeds. And please use shots as 6000." 260 | ] 261 | }, 262 | { 263 | "cell_type": "code", 264 | "execution_count": null, 265 | "metadata": { 266 | "id": "_z5kT9vNSWus" 267 | }, 268 | "outputs": [], 269 | "source": [ 270 | "seeds = 170\n", 271 | "algorithm_globals.random_seed = seeds\n", 272 | "seed_transpiler = seeds\n", 273 | "shot = 6000" 274 | ] 275 | }, 276 | { 277 | "cell_type": "markdown", 278 | "metadata": { 279 | "id": "vPEQx7yh_dDE" 280 | }, 281 | "source": [ 282 | "# Circuit Transpile and Execution" 283 | ] 284 | }, 285 | { 286 | "cell_type": "code", 287 | "execution_count": null, 288 | "metadata": { 289 | "colab": { 290 | "base_uri": "https://localhost:8080/", 291 | "height": 171 292 | }, 293 | "id": "lJ8S2H4F2uUl", 294 | "outputId": "efd7a7dd-cc85-4fc8-9fdc-9680c15ba8a7" 295 | }, 296 | "outputs": [ 297 | { 298 | "data": { 299 | "text/html": [ 300 | "
       ┌──────────┐  ┌────┐┌─────────┐     ┌─────────────┐      ┌──────────┐»\n",
301 |               "q_0: ──┤ Rz(-π/2) ├──┤ √X ├┤ Rz(π/2) ├──■──┤ Ry(0.84756) ├───■──┤ Rz(-π/2) ├»\n",
302 |               "     ┌─┴──────────┴─┐├───┬┘└─────────┘┌─┴─┐├─────────────┴┐┌─┴─┐└─┬─────┬──┘»\n",
303 |               "q_1: ┤ Rz(-0.25744) ├┤ S ├────────────┤ X ├┤ Ry(-0.84756) ├┤ X ├──┤ Sdg ├───»\n",
304 |               "     └──────────────┘└───┘            └───┘└──────────────┘└───┘  └─────┘   »\n",
305 |               "«         ┌──────┐   ┌─────────┐┌────────────┐\n",
306 |               "«q_0: ────┤ √Xdg ├───┤ Rz(π/2) ├┤ R(5.735,0) ├\n",
307 |               "«     ┌───┴──────┴──┐└──┬───┬──┘└────────────┘\n",
308 |               "«q_1: ┤ Rz(0.25744) ├───┤ I ├─────────────────\n",
309 |               "«     └─────────────┘   └───┘                 
" 310 | ], 311 | "text/plain": [ 312 | " ┌──────────┐ ┌────┐┌─────────┐ ┌─────────────┐ ┌──────────┐»\n", 313 | "q_0: ──┤ Rz(-π/2) ├──┤ √X ├┤ Rz(π/2) ├──■──┤ Ry(0.84756) ├───■──┤ Rz(-π/2) ├»\n", 314 | " ┌─┴──────────┴─┐├───┬┘└─────────┘┌─┴─┐├─────────────┴┐┌─┴─┐└─┬─────┬──┘»\n", 315 | "q_1: ┤ Rz(-0.25744) ├┤ S ├────────────┤ X ├┤ Ry(-0.84756) ├┤ X ├──┤ Sdg ├───»\n", 316 | " └──────────────┘└───┘ └───┘└──────────────┘└───┘ └─────┘ »\n", 317 | "« ┌──────┐ ┌─────────┐┌────────────┐\n", 318 | "«q_0: ────┤ √Xdg ├───┤ Rz(π/2) ├┤ R(5.735,0) ├\n", 319 | "« ┌───┴──────┴──┐└──┬───┬──┘└────────────┘\n", 320 | "«q_1: ┤ Rz(0.25744) ├───┤ I ├─────────────────\n", 321 | "« └─────────────┘ └───┘ " 322 | ] 323 | }, 324 | "execution_count": 18, 325 | "metadata": {}, 326 | "output_type": "execute_result" 327 | } 328 | ], 329 | "source": [ 330 | "from qiskit.circuit.random import random_circuit\n", 331 | "from qiskit_aer.primitives import Estimator\n", 332 | "circuit = random_circuit(2, 2, seed=0).decompose(reps=1)\n", 333 | "circuit.draw()" 334 | ] 335 | }, 336 | { 337 | "cell_type": "markdown", 338 | "metadata": { 339 | "id": "ailYlmao_jBV" 340 | }, 341 | "source": [ 342 | "Transpile the circuit based on given system model from IBMQ_Montreal." 343 | ] 344 | }, 345 | { 346 | "cell_type": "code", 347 | "execution_count": null, 348 | "metadata": { 349 | "id": "SI275sum_rFg" 350 | }, 351 | "outputs": [], 352 | "source": [ 353 | "system_model = FakeMontreal()" 354 | ] 355 | }, 356 | { 357 | "cell_type": "code", 358 | "execution_count": null, 359 | "metadata": { 360 | "id": "65IYl_7U_zOh" 361 | }, 362 | "outputs": [], 363 | "source": [ 364 | "transpiled_circuit = transpile(circuit, backend=system_model)" 365 | ] 366 | }, 367 | { 368 | "cell_type": "code", 369 | "execution_count": null, 370 | "metadata": { 371 | "colab": { 372 | "base_uri": "https://localhost:8080/" 373 | }, 374 | "id": "Ld6bpObI-l0n", 375 | "outputId": "18744ccd-0234-425a-e3cf-741452d8cad5" 376 | }, 377 | "outputs": [ 378 | { 379 | "name": "stdout", 380 | "output_type": "stream", 381 | "text": [ 382 | ">>> Observable: ['IIIIIIIIIIIIIIIIIIIIIIIIIXZ']\n" 383 | ] 384 | } 385 | ], 386 | "source": [ 387 | "from qiskit.quantum_info import SparsePauliOp\n", 388 | "\n", 389 | "observable = SparsePauliOp(\"IIIIIIIIIIIIIIIIIIIIIIIIIXZ\")\n", 390 | "print(f\">>> Observable: {observable.paulis}\")" 391 | ] 392 | }, 393 | { 394 | "cell_type": "markdown", 395 | "metadata": { 396 | "id": "1UmOoQMZ_42L" 397 | }, 398 | "source": [ 399 | "Evaluate on the qiskit Estimator." 400 | ] 401 | }, 402 | { 403 | "cell_type": "code", 404 | "execution_count": 128, 405 | "metadata": { 406 | "id": "M6ACRPs4_GRi" 407 | }, 408 | "outputs": [], 409 | "source": [ 410 | "estimator = Estimator(\n", 411 | " backend_options = {\n", 412 | " 'method': 'statevector',\n", 413 | " 'device': 'CPU',\n", 414 | " 'noise_model': noise_modelreal\n", 415 | " },\n", 416 | " run_options = {\n", 417 | " 'shots': shot,\n", 418 | " 'seed': seeds,\n", 419 | " },\n", 420 | " skip_transpilation=True\n", 421 | ")" 422 | ] 423 | }, 424 | { 425 | "cell_type": "code", 426 | "execution_count": 129, 427 | "metadata": { 428 | "colab": { 429 | "base_uri": "https://localhost:8080/" 430 | }, 431 | "id": "2GFiw5SC-ouq", 432 | "outputId": "dcf84b52-9a53-4cb8-a7ea-b31aa9ed8630" 433 | }, 434 | "outputs": [ 435 | { 436 | "name": "stdout", 437 | "output_type": "stream", 438 | "text": [ 439 | ">>> EstimatorResult(values=array([0.44766667]), metadata=[{'shots': 6000, 'variance': 0.7995945555555556, 'simulator_metadata': [{'noise': 'kraus', 'batched_shots_optimization': False, 'measure_sampling': False, 'parallel_shots': 2, 'remapped_qubits': False, 'active_input_qubits': [0, 1], 'num_clbits': 2, 'parallel_state_update': 1, 'num_qubits': 2, 'device': 'CPU', 'input_qubit_map': [[1, 1], [0, 0]], 'method': 'statevector', 'fusion': {'applied': False, 'max_fused_qubits': 2, 'threshold': 14, 'enabled': True}}]}])\n" 440 | ] 441 | } 442 | ], 443 | "source": [ 444 | "job = estimator.run(transpiled_circuit,observable)\n", 445 | "result = job.result()\n", 446 | "print(f\">>> {result}\")" 447 | ] 448 | }, 449 | { 450 | "cell_type": "markdown", 451 | "metadata": { 452 | "id": "hw8SxNyclYyT" 453 | }, 454 | "source": [ 455 | "## Obtain the Duration of Quantum Circuit" 456 | ] 457 | }, 458 | { 459 | "cell_type": "code", 460 | "execution_count": null, 461 | "metadata": { 462 | "id": "F-djGu7_BGiY" 463 | }, 464 | "outputs": [], 465 | "source": [ 466 | "from qiskit import pulse" 467 | ] 468 | }, 469 | { 470 | "cell_type": "markdown", 471 | "metadata": { 472 | "id": "rvKZMDXUBLfA" 473 | }, 474 | "source": [ 475 | "Do remember to set the optimization_level to 0 if your circuit is already transpiled!!!" 476 | ] 477 | }, 478 | { 479 | "cell_type": "code", 480 | "execution_count": null, 481 | "metadata": { 482 | "id": "_julUiabi5iI" 483 | }, 484 | "outputs": [], 485 | "source": [ 486 | "with pulse.build(system_model) as my_program1:\n", 487 | " with pulse.transpiler_settings(optimization_level=0):\n", 488 | " pulse.call(transpiled_circuit)" 489 | ] 490 | }, 491 | { 492 | "cell_type": "code", 493 | "execution_count": null, 494 | "metadata": { 495 | "colab": { 496 | "base_uri": "https://localhost:8080/" 497 | }, 498 | "id": "E3jGzVpNkT00", 499 | "outputId": "4cf0d4da-f938-49c0-a382-7d5253ba6152" 500 | }, 501 | "outputs": [ 502 | { 503 | "data": { 504 | "text/plain": [ 505 | "4096" 506 | ] 507 | }, 508 | "execution_count": 41, 509 | "metadata": {}, 510 | "output_type": "execute_result" 511 | } 512 | ], 513 | "source": [ 514 | "my_program1.duration" 515 | ] 516 | }, 517 | { 518 | "cell_type": "markdown", 519 | "metadata": { 520 | "id": "wWbOzBXbBT_Y" 521 | }, 522 | "source": [ 523 | "# Save the Circuit in QASM Format" 524 | ] 525 | }, 526 | { 527 | "cell_type": "code", 528 | "execution_count": null, 529 | "metadata": { 530 | "colab": { 531 | "base_uri": "https://localhost:8080/", 532 | "height": 55 533 | }, 534 | "id": "0_4SdcY1BYMe", 535 | "outputId": "c1f652a2-7da4-4f2a-e616-a6ec1d5b2990" 536 | }, 537 | "outputs": [ 538 | { 539 | "data": { 540 | "application/vnd.google.colaboratory.intrinsic+json": { 541 | "type": "string" 542 | }, 543 | "text/plain": [ 544 | "'OPENQASM 2.0;\\ninclude \"qelib1.inc\";\\nqreg q[27];\\nrz(-pi/2) q[0];\\nsx q[0];\\nrz(pi/2) q[0];\\nrz(1.3133520832156265) q[1];\\ncx q[0],q[1];\\nrz(-pi) q[0];\\nsx q[0];\\nrz(2.2940326955930868) q[0];\\nsx q[0];\\nsx q[1];\\nrz(2.294032695593086) q[1];\\nsx q[1];\\nrz(-pi) q[1];\\ncx q[0],q[1];\\nrz(2.1189692017768795) q[0];\\nsx q[0];\\nrz(-pi/2) q[0];\\nrz(-1.313352083215627) q[1];\\n'" 545 | ] 546 | }, 547 | "execution_count": 42, 548 | "metadata": {}, 549 | "output_type": "execute_result" 550 | } 551 | ], 552 | "source": [ 553 | "transpiled_circuit.qasm()" 554 | ] 555 | } 556 | ], 557 | "metadata": { 558 | "colab": { 559 | "provenance": [] 560 | }, 561 | "kernelspec": { 562 | "display_name": "Python 3 (ipykernel)", 563 | "language": "python", 564 | "name": "python3" 565 | }, 566 | "language_info": { 567 | "codemirror_mode": { 568 | "name": "ipython", 569 | "version": 3 570 | }, 571 | "file_extension": ".py", 572 | "mimetype": "text/x-python", 573 | "name": "python", 574 | "nbconvert_exporter": "python", 575 | "pygments_lexer": "ipython3", 576 | "version": "3.10.9" 577 | } 578 | }, 579 | "nbformat": 4, 580 | "nbformat_minor": 0 581 | } 582 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Python example code for the ACM/IEEE Quantum Computing for Drug Discovery Challenge at ICCAD 2023 2 | 3 | ## What's in this repository? 4 | 5 | This repository contains a simple example to illustrate how to train the variational quantum eigensolver on the Qiskit platform and evaluate the comprehensive performances in terms of accuracy, quantum resource cost, and classical computation resource cost. 6 | 7 | For this example, we implemented a UCCSD ansatz with a Hartree-fork initial state. You can use different techniques to construct the ansatz and find the initial state for your implementation. We required all participants to read the [Example_Code](https://github.com/qccontest/QC-Contest-Demo/blob/main/examplecode.ipynb), as we describe details in the .ipynb file, with examples of implementation, how to calculate the accuracy, and how to obtain the circuit duration. 8 | 9 | And we release the noise model and system model, we require participant to follow the topology map from FakeMontreal. And we provide three noise models extracted from FakeCairo, FakeMontreal, and FakeKolkata. Please refer to the [NoiseModel and SystemModel](https://github.com/qccontest/QC-Contest-Demo/blob/main/NoiseModel_and_SystemModel.ipynb). 10 | 11 | 12 | ## How do I find the dataset? 13 | 14 | You can find the Hamiltonian for the target molecule at [Hamiltonian](https://github.com/qccontest/QC-Contest-Demo/tree/main/Hamiltonian). And we also recommend participants some seeds for algorithmic, transpiling, and measurement in Qiskit; the final results should be the average of 10 different seeds: 5 in [Seeds](https://github.com/qccontest/QC-Contest-Demo/blob/main/algorithm_seeds/requiredseeds.txt), and other 5 will be selected from hidden test seeds set. You can find the noise models at [NoiseModel](https://github.com/qccontest/QC-Contest-Demo/tree/main/NoiseModel). 15 | 16 | ## Convert given Hamiltonian to compatible with pennylane: 17 | 18 | You can find the example code to convert the given Hamiltonian to compatible with pennylane at [converter](https://github.com/qccontest/QC-Contest-Demo/blob/main/Hamiltonian_to_pennylane.py). -------------------------------------------------------------------------------- /algorithm_seeds/requiredseeds.txt: -------------------------------------------------------------------------------- 1 | 20, 2 | 21, 3 | 30, 4 | 33, 5 | 36, 6 | 42, 7 | 43, 8 | 55, 9 | 67, 10 | 170 -------------------------------------------------------------------------------- /examplecode.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "markdown", 5 | "metadata": { 6 | "id": "gj3jZbCBSn71" 7 | }, 8 | "source": [ 9 | "# Example Code for Estimating the Ground State Energy of Hydroxyl (·OH)" 10 | ] 11 | }, 12 | { 13 | "cell_type": "markdown", 14 | "metadata": { 15 | "id": "54NH9S1vHrq8" 16 | }, 17 | "source": [ 18 | "## Basic Installation" 19 | ] 20 | }, 21 | { 22 | "cell_type": "markdown", 23 | "metadata": { 24 | "id": "R0OZ3HZZS9Me" 25 | }, 26 | "source": [ 27 | "Install required package, we highly recommend participant to use qiskit platform, or at least participants can finish preprocessing at other platform and transfer the circuit to qiskit format, since our noise model is from IBM real machine backend and we restricted some algorithmic seeds which could be varied from different platform." 28 | ] 29 | }, 30 | { 31 | "cell_type": "code", 32 | "execution_count": null, 33 | "metadata": { 34 | "colab": { 35 | "base_uri": "https://localhost:8080/" 36 | }, 37 | "id": "Pi-oJxidjBSw", 38 | "outputId": "d23754fa-04a2-4afc-fce2-cc4d90db62d4" 39 | }, 40 | "outputs": [ 41 | { 42 | "name": "stdout", 43 | "output_type": "stream", 44 | "text": [ 45 | "Collecting qiskit\n", 46 | " Downloading qiskit-0.44.1-py3-none-any.whl (8.2 kB)\n", 47 | "Collecting qiskit-terra==0.25.1 (from qiskit)\n", 48 | " Downloading qiskit_terra-0.25.1-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (6.1 MB)\n", 49 | "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m6.1/6.1 MB\u001b[0m \u001b[31m12.8 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n", 50 | "\u001b[?25hCollecting rustworkx>=0.13.0 (from qiskit-terra==0.25.1->qiskit)\n", 51 | " Downloading rustworkx-0.13.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (2.0 MB)\n", 52 | "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m2.0/2.0 MB\u001b[0m \u001b[31m26.9 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n", 53 | "\u001b[?25hRequirement already satisfied: numpy>=1.17 in /usr/local/lib/python3.10/dist-packages (from qiskit-terra==0.25.1->qiskit) (1.23.5)\n", 54 | "Collecting ply>=3.10 (from qiskit-terra==0.25.1->qiskit)\n", 55 | " Downloading ply-3.11-py2.py3-none-any.whl (49 kB)\n", 56 | "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m49.6/49.6 kB\u001b[0m \u001b[31m5.4 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n", 57 | "\u001b[?25hRequirement already satisfied: psutil>=5 in /usr/local/lib/python3.10/dist-packages (from qiskit-terra==0.25.1->qiskit) (5.9.5)\n", 58 | "Requirement already satisfied: scipy>=1.5 in /usr/local/lib/python3.10/dist-packages (from qiskit-terra==0.25.1->qiskit) (1.10.1)\n", 59 | "Requirement already satisfied: sympy>=1.3 in /usr/local/lib/python3.10/dist-packages (from qiskit-terra==0.25.1->qiskit) (1.12)\n", 60 | "Collecting dill>=0.3 (from qiskit-terra==0.25.1->qiskit)\n", 61 | " Downloading dill-0.3.7-py3-none-any.whl (115 kB)\n", 62 | "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m115.3/115.3 kB\u001b[0m \u001b[31m12.6 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n", 63 | "\u001b[?25hRequirement already satisfied: python-dateutil>=2.8.0 in /usr/local/lib/python3.10/dist-packages (from qiskit-terra==0.25.1->qiskit) (2.8.2)\n", 64 | "Collecting stevedore>=3.0.0 (from qiskit-terra==0.25.1->qiskit)\n", 65 | " Downloading stevedore-5.1.0-py3-none-any.whl (49 kB)\n", 66 | "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m49.6/49.6 kB\u001b[0m \u001b[31m4.7 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n", 67 | "\u001b[?25hCollecting symengine<0.10,>=0.9 (from qiskit-terra==0.25.1->qiskit)\n", 68 | " Downloading symengine-0.9.2-cp310-cp310-manylinux2010_x86_64.whl (37.5 MB)\n", 69 | "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m37.5/37.5 MB\u001b[0m \u001b[31m40.6 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n", 70 | "\u001b[?25hRequirement already satisfied: typing-extensions in /usr/local/lib/python3.10/dist-packages (from qiskit-terra==0.25.1->qiskit) (4.7.1)\n", 71 | "Requirement already satisfied: six>=1.5 in /usr/local/lib/python3.10/dist-packages (from python-dateutil>=2.8.0->qiskit-terra==0.25.1->qiskit) (1.16.0)\n", 72 | "Collecting pbr!=2.1.0,>=2.0.0 (from stevedore>=3.0.0->qiskit-terra==0.25.1->qiskit)\n", 73 | " Downloading pbr-5.11.1-py2.py3-none-any.whl (112 kB)\n", 74 | "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m112.7/112.7 kB\u001b[0m \u001b[31m12.2 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n", 75 | "\u001b[?25hRequirement already satisfied: mpmath>=0.19 in /usr/local/lib/python3.10/dist-packages (from sympy>=1.3->qiskit-terra==0.25.1->qiskit) (1.3.0)\n", 76 | "Installing collected packages: ply, symengine, rustworkx, pbr, dill, stevedore, qiskit-terra, qiskit\n", 77 | "Successfully installed dill-0.3.7 pbr-5.11.1 ply-3.11 qiskit-0.44.1 qiskit-terra-0.25.1 rustworkx-0.13.1 stevedore-5.1.0 symengine-0.9.2\n", 78 | "Collecting qiskit-nature[pyscf]\n", 79 | " Downloading qiskit_nature-0.6.2-py3-none-any.whl (4.1 MB)\n", 80 | "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m4.1/4.1 MB\u001b[0m \u001b[31m12.1 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n", 81 | "\u001b[?25hRequirement already satisfied: qiskit-terra>=0.24 in /usr/local/lib/python3.10/dist-packages (from qiskit-nature[pyscf]) (0.25.1)\n", 82 | "Requirement already satisfied: scipy>=1.4 in /usr/local/lib/python3.10/dist-packages (from qiskit-nature[pyscf]) (1.10.1)\n", 83 | "Requirement already satisfied: numpy>=1.17 in /usr/local/lib/python3.10/dist-packages (from qiskit-nature[pyscf]) (1.23.5)\n", 84 | "Requirement already satisfied: psutil>=5 in /usr/local/lib/python3.10/dist-packages (from qiskit-nature[pyscf]) (5.9.5)\n", 85 | "Requirement already satisfied: scikit-learn>=0.20.0 in /usr/local/lib/python3.10/dist-packages (from qiskit-nature[pyscf]) (1.2.2)\n", 86 | "Requirement already satisfied: setuptools>=40.1.0 in /usr/local/lib/python3.10/dist-packages (from qiskit-nature[pyscf]) (67.7.2)\n", 87 | "Requirement already satisfied: typing-extensions in /usr/local/lib/python3.10/dist-packages (from qiskit-nature[pyscf]) (4.7.1)\n", 88 | "Requirement already satisfied: h5py in /usr/local/lib/python3.10/dist-packages (from qiskit-nature[pyscf]) (3.9.0)\n", 89 | "Requirement already satisfied: rustworkx in /usr/local/lib/python3.10/dist-packages (from qiskit-nature[pyscf]) (0.13.1)\n", 90 | "Collecting pyscf (from qiskit-nature[pyscf])\n", 91 | " Downloading pyscf-2.3.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (47.2 MB)\n", 92 | "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m47.2/47.2 MB\u001b[0m \u001b[31m10.1 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n", 93 | "\u001b[?25hRequirement already satisfied: ply>=3.10 in /usr/local/lib/python3.10/dist-packages (from qiskit-terra>=0.24->qiskit-nature[pyscf]) (3.11)\n", 94 | "Requirement already satisfied: sympy>=1.3 in /usr/local/lib/python3.10/dist-packages (from qiskit-terra>=0.24->qiskit-nature[pyscf]) (1.12)\n", 95 | "Requirement already satisfied: dill>=0.3 in /usr/local/lib/python3.10/dist-packages (from qiskit-terra>=0.24->qiskit-nature[pyscf]) (0.3.7)\n", 96 | "Requirement already satisfied: python-dateutil>=2.8.0 in /usr/local/lib/python3.10/dist-packages (from qiskit-terra>=0.24->qiskit-nature[pyscf]) (2.8.2)\n", 97 | "Requirement already satisfied: stevedore>=3.0.0 in /usr/local/lib/python3.10/dist-packages (from qiskit-terra>=0.24->qiskit-nature[pyscf]) (5.1.0)\n", 98 | "Requirement already satisfied: symengine<0.10,>=0.9 in /usr/local/lib/python3.10/dist-packages (from qiskit-terra>=0.24->qiskit-nature[pyscf]) (0.9.2)\n", 99 | "Requirement already satisfied: joblib>=1.1.1 in /usr/local/lib/python3.10/dist-packages (from scikit-learn>=0.20.0->qiskit-nature[pyscf]) (1.3.2)\n", 100 | "Requirement already satisfied: threadpoolctl>=2.0.0 in /usr/local/lib/python3.10/dist-packages (from scikit-learn>=0.20.0->qiskit-nature[pyscf]) (3.2.0)\n", 101 | "Requirement already satisfied: six>=1.5 in /usr/local/lib/python3.10/dist-packages (from python-dateutil>=2.8.0->qiskit-terra>=0.24->qiskit-nature[pyscf]) (1.16.0)\n", 102 | "Requirement already satisfied: pbr!=2.1.0,>=2.0.0 in /usr/local/lib/python3.10/dist-packages (from stevedore>=3.0.0->qiskit-terra>=0.24->qiskit-nature[pyscf]) (5.11.1)\n", 103 | "Requirement already satisfied: mpmath>=0.19 in /usr/local/lib/python3.10/dist-packages (from sympy>=1.3->qiskit-terra>=0.24->qiskit-nature[pyscf]) (1.3.0)\n", 104 | "Installing collected packages: pyscf, qiskit-nature\n", 105 | "Successfully installed pyscf-2.3.0 qiskit-nature-0.6.2\n" 106 | ] 107 | } 108 | ], 109 | "source": [ 110 | "!pip install qiskit\n", 111 | "!pip install qiskit-nature[pyscf] -U" 112 | ] 113 | }, 114 | { 115 | "cell_type": "code", 116 | "execution_count": null, 117 | "metadata": { 118 | "colab": { 119 | "base_uri": "https://localhost:8080/" 120 | }, 121 | "id": "-kyJUxyJzk_k", 122 | "outputId": "153f1581-81d4-43b0-d14e-40f75cd99e39" 123 | }, 124 | "outputs": [ 125 | { 126 | "name": "stdout", 127 | "output_type": "stream", 128 | "text": [ 129 | "Collecting qiskit_aer\n", 130 | " Downloading qiskit_aer-0.12.2-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (12.8 MB)\n", 131 | "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m12.8/12.8 MB\u001b[0m \u001b[31m6.8 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n", 132 | "\u001b[?25hRequirement already satisfied: qiskit-terra>=0.21.0 in /usr/local/lib/python3.10/dist-packages (from qiskit_aer) (0.25.1)\n", 133 | "Requirement already satisfied: numpy>=1.16.3 in /usr/local/lib/python3.10/dist-packages (from qiskit_aer) (1.23.5)\n", 134 | "Requirement already satisfied: scipy>=1.0 in /usr/local/lib/python3.10/dist-packages (from qiskit_aer) (1.10.1)\n", 135 | "Requirement already satisfied: rustworkx>=0.13.0 in /usr/local/lib/python3.10/dist-packages (from qiskit-terra>=0.21.0->qiskit_aer) (0.13.1)\n", 136 | "Requirement already satisfied: ply>=3.10 in /usr/local/lib/python3.10/dist-packages (from qiskit-terra>=0.21.0->qiskit_aer) (3.11)\n", 137 | "Requirement already satisfied: psutil>=5 in /usr/local/lib/python3.10/dist-packages (from qiskit-terra>=0.21.0->qiskit_aer) (5.9.5)\n", 138 | "Requirement already satisfied: sympy>=1.3 in /usr/local/lib/python3.10/dist-packages (from qiskit-terra>=0.21.0->qiskit_aer) (1.12)\n", 139 | "Requirement already satisfied: dill>=0.3 in /usr/local/lib/python3.10/dist-packages (from qiskit-terra>=0.21.0->qiskit_aer) (0.3.7)\n", 140 | "Requirement already satisfied: python-dateutil>=2.8.0 in /usr/local/lib/python3.10/dist-packages (from qiskit-terra>=0.21.0->qiskit_aer) (2.8.2)\n", 141 | "Requirement already satisfied: stevedore>=3.0.0 in /usr/local/lib/python3.10/dist-packages (from qiskit-terra>=0.21.0->qiskit_aer) (5.1.0)\n", 142 | "Requirement already satisfied: symengine<0.10,>=0.9 in /usr/local/lib/python3.10/dist-packages (from qiskit-terra>=0.21.0->qiskit_aer) (0.9.2)\n", 143 | "Requirement already satisfied: typing-extensions in /usr/local/lib/python3.10/dist-packages (from qiskit-terra>=0.21.0->qiskit_aer) (4.7.1)\n", 144 | "Requirement already satisfied: six>=1.5 in /usr/local/lib/python3.10/dist-packages (from python-dateutil>=2.8.0->qiskit-terra>=0.21.0->qiskit_aer) (1.16.0)\n", 145 | "Requirement already satisfied: pbr!=2.1.0,>=2.0.0 in /usr/local/lib/python3.10/dist-packages (from stevedore>=3.0.0->qiskit-terra>=0.21.0->qiskit_aer) (5.11.1)\n", 146 | "Requirement already satisfied: mpmath>=0.19 in /usr/local/lib/python3.10/dist-packages (from sympy>=1.3->qiskit-terra>=0.21.0->qiskit_aer) (1.3.0)\n", 147 | "Installing collected packages: qiskit_aer\n", 148 | "Successfully installed qiskit_aer-0.12.2\n" 149 | ] 150 | } 151 | ], 152 | "source": [ 153 | "!pip install qiskit_aer" 154 | ] 155 | }, 156 | { 157 | "cell_type": "code", 158 | "execution_count": null, 159 | "metadata": { 160 | "id": "Ib7BjPjxvJNk" 161 | }, 162 | "outputs": [], 163 | "source": [ 164 | "from qiskit_nature.units import DistanceUnit\n", 165 | "from qiskit_nature.second_q.drivers import PySCFDriver\n", 166 | "from qiskit_nature.second_q.mappers import JordanWignerMapper,ParityMapper,QubitConverter\n", 167 | "from qiskit.algorithms.minimum_eigensolvers import VQE\n", 168 | "from qiskit.algorithms.optimizers import SLSQP\n", 169 | "from qiskit_aer.primitives import Estimator\n", 170 | "from qiskit_nature.second_q.circuit.library import HartreeFock, UCCSD\n", 171 | "import numpy as np\n", 172 | "import pylab\n", 173 | "import qiskit.providers\n", 174 | "from qiskit import Aer,pulse, QuantumCircuit\n", 175 | "from qiskit.utils import QuantumInstance, algorithm_globals\n", 176 | "import time" 177 | ] 178 | }, 179 | { 180 | "cell_type": "markdown", 181 | "metadata": { 182 | "id": "QRxsKX9zTc9g" 183 | }, 184 | "source": [ 185 | "Here we require paticipants to fix the algorithm seed in qiskit. MUST translate other format circuit to qiskit before any place need algorithm seed. And we give 20, 21, 30, 33, 36, 42, 43, 55, 67, 170 as set of seeds to test results on your side, and the result will be calculated as the average of results from some of those seeds with some hidden seeds. And please use shots as 6000." 186 | ] 187 | }, 188 | { 189 | "cell_type": "code", 190 | "execution_count": null, 191 | "metadata": { 192 | "id": "_z5kT9vNSWus" 193 | }, 194 | "outputs": [], 195 | "source": [ 196 | "seeds = 170\n", 197 | "algorithm_globals.random_seed = seeds\n", 198 | "seed_transpiler = seeds\n", 199 | "iterations = 125\n", 200 | "shot = 6000" 201 | ] 202 | }, 203 | { 204 | "cell_type": "markdown", 205 | "metadata": { 206 | "id": "67IPjEJPJAWk" 207 | }, 208 | "source": [ 209 | "## Generate Hamiltonian and Pauli String" 210 | ] 211 | }, 212 | { 213 | "cell_type": "markdown", 214 | "metadata": { 215 | "id": "7TljW2BrJKHC" 216 | }, 217 | "source": [ 218 | "At this step, the example code uses PySCF to generate the hamiltonian of hydroxyl with basis function as 'sto3g' to fit the spin orbital, then uses JordanWignerMapper to map the fermionic terms to pauli strings. To be noticed, other chemistry tool also allowed to be used at this step, but keep in mind to use 'sto-3g' and Jordan Wigner Mapper which should gives 12 qubits and 631 paulil terms." 219 | ] 220 | }, 221 | { 222 | "cell_type": "code", 223 | "execution_count": null, 224 | "metadata": { 225 | "id": "kXSoiGtopCRX" 226 | }, 227 | "outputs": [], 228 | "source": [ 229 | "ultra_simplified_ala_string = \"\"\"\n", 230 | "O 0.0 0.0 0.0\n", 231 | "H 0.45 -0.1525 -0.8454\n", 232 | "\"\"\"\n", 233 | "\n", 234 | "driver = PySCFDriver(\n", 235 | " atom=ultra_simplified_ala_string.strip(),\n", 236 | " basis='sto3g',\n", 237 | " charge=1,\n", 238 | " spin=0,\n", 239 | " unit=DistanceUnit.ANGSTROM\n", 240 | ")\n", 241 | "qmolecule = driver.run()" 242 | ] 243 | }, 244 | { 245 | "cell_type": "code", 246 | "execution_count": null, 247 | "metadata": { 248 | "colab": { 249 | "base_uri": "https://localhost:8080/" 250 | }, 251 | "id": "ojwVkSeRwTH4", 252 | "outputId": "127b9320-1734-4c77-e753-677181892158" 253 | }, 254 | "outputs": [ 255 | { 256 | "name": "stdout", 257 | "output_type": "stream", 258 | "text": [ 259 | "Polynomial Tensor\n", 260 | " \"+-\":\n", 261 | "[[-3.21461222e+01 5.59899100e-01 1.87617178e-01 -8.82935672e-16\n", 262 | " 5.24041109e-16 -1.94702445e-01]\n", 263 | " [ 5.59899100e-01 -7.35898345e+00 -2.46352634e-01 1.62827403e-15\n", 264 | " -6.24537640e-16 9.51226718e-01]\n", 265 | " [ 1.87617178e-01 -2.46352634e-01 -6.56995119e+00 -2.60483168e-15\n", 266 | " 3.30435485e-15 -1.09726793e+00]\n", 267 | " [-8.81884087e-16 1.65690925e-15 -2.62384089e-15 -6.94886145e+00\n", 268 | " -5.91762610e-16 6.31170002e-15]\n", 269 | " [ 5.24315261e-16 -8.02073589e-16 2.84157066e-15 -6.38131808e-16\n", 270 | " -6.94886145e+00 -2.17814296e-15]\n", 271 | " [-1.94702445e-01 9.51226718e-01 -1.09726793e+00 6.25309946e-15\n", 272 | " -1.88022334e-15 -4.64967973e+00]]\n", 273 | " \"++--\":\n", 274 | "[[[[ 4.74977044e+00 -4.38465691e-01 -1.51436760e-01 7.24476990e-16\n", 275 | " -3.88796601e-16 1.59790984e-01]\n", 276 | " [-4.38465691e-01 6.47204045e-02 1.84429506e-02 -9.30841809e-17\n", 277 | " 5.68926263e-17 -2.66865302e-02]\n", 278 | " [-1.51436760e-01 1.84429506e-02 2.46189939e-02 1.21320840e-17\n", 279 | " -1.54173925e-17 6.40512562e-03]\n", 280 | " [ 7.24430816e-16 -9.31221507e-17 1.19056319e-17 2.58536922e-02\n", 281 | " 2.21988241e-18 -3.64428746e-17]\n", 282 | " [-3.88404794e-16 5.67051397e-17 -1.82724467e-17 2.27176144e-18\n", 283 | " 2.58536922e-02 1.05122911e-17]\n", 284 | " [ 1.59790984e-01 -2.66865302e-02 6.40512562e-03 -3.57499158e-17\n", 285 | " 1.09506345e-17 2.11708054e-02]]\n", 286 | "\n", 287 | " [[-4.38465691e-01 6.47204045e-02 1.84429506e-02 -9.31504069e-17\n", 288 | " 5.66192888e-17 -2.66865302e-02]\n", 289 | " [ 1.06368185e+00 -1.50469869e-02 -1.72330627e-02 7.02052427e-17\n", 290 | " -1.73646258e-17 -2.69295995e-03]\n", 291 | " [ 8.78369520e-02 -9.36020789e-03 2.16452114e-02 6.34579252e-17\n", 292 | " -4.90114501e-17 2.03747148e-02]\n", 293 | " [-5.48150348e-16 4.23608673e-17 6.28083358e-17 3.38081759e-02\n", 294 | " 2.88216658e-18 -1.09069051e-16]\n", 295 | " [ 3.66496402e-16 -1.78748680e-17 -4.33447936e-17 2.90305637e-18\n", 296 | " 3.38081759e-02 5.47633575e-17]\n", 297 | " [-2.42118626e-01 4.54101197e-03 1.65509332e-02 -8.74434055e-17\n", 298 | " 4.82372795e-17 8.74204002e-03]]\n", 299 | "\n", 300 | " [[-1.51436760e-01 1.84429506e-02 2.46189939e-02 1.23773822e-17\n", 301 | " -1.42337373e-17 6.40512562e-03]\n", 302 | " [ 8.78369520e-02 -9.36020789e-03 2.16452114e-02 6.37202600e-17\n", 303 | " -4.92278725e-17 2.03747148e-02]\n", 304 | " [ 9.90974245e-01 -1.31679803e-02 8.70090353e-03 6.90528257e-17\n", 305 | " -4.35665755e-17 1.41651559e-02]\n", 306 | " [ 7.92260256e-16 -3.35131299e-18 -4.70973204e-18 1.12083197e-02\n", 307 | " 7.42438741e-19 -4.81922837e-17]\n", 308 | " [-8.27130721e-16 1.60787927e-17 -5.70933205e-18 1.21020955e-18\n", 309 | " 1.12083197e-02 2.98183089e-17]\n", 310 | " [ 2.65843254e-01 -5.34487452e-03 2.07171914e-03 -6.37236038e-17\n", 311 | " 3.05883726e-17 4.81053325e-03]]\n", 312 | "\n", 313 | " [[ 7.24571403e-16 -9.30202783e-17 1.18272195e-17 2.58536922e-02\n", 314 | " 1.69759213e-18 -3.65737995e-17]\n", 315 | " [-5.39239603e-16 4.31393160e-17 6.37130672e-17 3.38081759e-02\n", 316 | " 2.18338891e-18 -1.09303631e-16]\n", 317 | " [ 7.49903648e-16 -5.47339587e-18 -5.20374258e-18 1.12083197e-02\n", 318 | " 7.03021251e-19 -4.72079797e-17]\n", 319 | " [ 1.11539591e+00 -1.22985373e-02 -4.28354178e-03 -8.57663554e-17\n", 320 | " -1.11141380e-17 4.10551212e-03]\n", 321 | " [ 1.00123594e-16 -8.18581456e-19 2.00060773e-19 2.58840313e-17\n", 322 | " -5.32182436e-17 -3.40435851e-18]\n", 323 | " [-1.50218446e-15 3.48005682e-17 -5.76914755e-17 -1.03687761e-02\n", 324 | " -8.21145299e-19 -2.70275201e-17]]\n", 325 | "\n", 326 | " [[-3.88323261e-16 5.66984311e-17 -1.59943942e-17 1.84578444e-18\n", 327 | " 2.58536922e-02 1.09406915e-17]\n", 328 | " [ 3.52870110e-16 -1.68689532e-17 -4.16289093e-17 3.13557961e-18\n", 329 | " 3.38081759e-02 5.32781046e-17]\n", 330 | " [-7.23164203e-16 1.06974064e-17 -8.71646015e-18 1.20575403e-18\n", 331 | " 1.12083197e-02 3.21839715e-17]\n", 332 | " [ 9.40581232e-17 -1.23339810e-18 9.44441752e-20 2.58851111e-17\n", 333 | " -5.32163381e-17 -3.37840333e-18]\n", 334 | " [ 1.11539591e+00 -1.22985373e-02 -4.28354178e-03 2.01360261e-17\n", 335 | " 4.04697185e-17 4.10551212e-03]\n", 336 | " [ 4.11197955e-16 -4.53951805e-18 3.75183956e-17 -1.50278168e-18\n", 337 | " -1.03687761e-02 2.56340630e-17]]\n", 338 | "\n", 339 | " [[ 1.59790984e-01 -2.66865302e-02 6.40512562e-03 -3.59120826e-17\n", 340 | " 1.24559962e-17 2.11708054e-02]\n", 341 | " [-2.42118626e-01 4.54101197e-03 1.65509332e-02 -8.74066404e-17\n", 342 | " 4.73584059e-17 8.74204002e-03]\n", 343 | " [ 2.65843254e-01 -5.34487452e-03 2.07171914e-03 -6.27020064e-17\n", 344 | " 2.67155371e-17 4.81053325e-03]\n", 345 | " [-1.48775154e-15 2.90575085e-17 -5.97666678e-17 -1.03687761e-02\n", 346 | " -7.57781926e-19 -2.38508163e-17]\n", 347 | " [ 4.06961607e-16 -2.14231200e-17 2.81168681e-17 -1.41381198e-18\n", 348 | " -1.03687761e-02 3.27017641e-17]\n", 349 | " [ 7.34481338e-01 -5.21692816e-03 -1.59999430e-02 8.16176132e-17\n", 350 | " -3.39730589e-17 -8.28037465e-03]]]\n", 351 | "\n", 352 | "\n", 353 | " [[[-4.38465691e-01 1.06368185e+00 8.78369520e-02 -5.35910453e-16\n", 354 | " 3.43872131e-16 -2.42118626e-01]\n", 355 | " [ 6.47204045e-02 -1.50469869e-02 -9.36020789e-03 4.28369574e-17\n", 356 | " -1.43660655e-17 4.54101197e-03]\n", 357 | " [ 1.84429506e-02 -1.72330627e-02 2.16452114e-02 6.44342499e-17\n", 358 | " -4.19486399e-17 1.65509332e-02]\n", 359 | " [-9.29058247e-17 6.98668380e-17 6.31475005e-17 3.38081759e-02\n", 360 | " 3.31790528e-18 -8.75405678e-17]\n", 361 | " [ 5.67277859e-17 -1.53215091e-17 -4.85621115e-17 2.44672925e-18\n", 362 | " 3.38081759e-02 4.60827489e-17]\n", 363 | " [-2.66865302e-02 -2.69295995e-03 2.03747148e-02 -1.08128859e-16\n", 364 | " 5.08621033e-17 8.74204002e-03]]\n", 365 | "\n", 366 | " [[ 6.47204045e-02 -1.50469869e-02 -9.36020789e-03 4.35448404e-17\n", 367 | " -1.79984331e-17 4.54101197e-03]\n", 368 | " [-1.50469869e-02 7.82246148e-01 -2.82736344e-02 3.39353123e-17\n", 369 | " 2.20405365e-17 -1.20862414e-01]\n", 370 | " [-9.36020789e-03 -2.82736344e-02 1.38461310e-01 8.60434409e-17\n", 371 | " -6.25764749e-17 2.11790621e-02]\n", 372 | " [ 4.13902300e-17 3.00566002e-17 8.79577253e-17 1.56942623e-01\n", 373 | " 1.38225127e-17 -1.20741051e-16]\n", 374 | " [-1.76676497e-17 3.65177125e-17 -6.64746742e-17 1.02655892e-17\n", 375 | " 1.56942623e-01 1.12548069e-16]\n", 376 | " [ 4.54101197e-03 -1.20862414e-01 2.11790621e-02 -1.15892170e-16\n", 377 | " 7.05562194e-17 8.19731113e-02]]\n", 378 | "\n", 379 | " [[ 1.84429506e-02 -1.72330627e-02 2.16452114e-02 6.45625642e-17\n", 380 | " -4.24615059e-17 1.65509332e-02]\n", 381 | " [-9.36020789e-03 -2.82736344e-02 1.38461310e-01 8.88800264e-17\n", 382 | " -5.92794260e-17 2.11790621e-02]\n", 383 | " [-1.31679803e-02 7.08160916e-01 6.20624861e-02 4.88276296e-17\n", 384 | " -4.34734101e-17 -5.09591903e-02]\n", 385 | " [-9.87675418e-19 4.05327840e-16 1.57619048e-16 4.03035161e-02\n", 386 | " 8.25647277e-20 -3.98039270e-16]\n", 387 | " [ 1.09584032e-17 -3.55268600e-16 -1.24140785e-16 -1.98663844e-19\n", 388 | " 4.03035161e-02 2.16461227e-16]\n", 389 | " [-5.34487452e-03 1.01782960e-01 6.86961222e-02 -5.78121451e-16\n", 390 | " 2.77198720e-16 -6.06860239e-02]]\n", 391 | "\n", 392 | " [[-9.28776972e-17 6.99681176e-17 6.37296043e-17 3.38081759e-02\n", 393 | " 2.71079825e-18 -8.64492136e-17]\n", 394 | " [ 4.23244955e-17 3.23924272e-17 9.13590214e-17 1.56942623e-01\n", 395 | " 1.33234998e-17 -1.20900809e-16]\n", 396 | " [-3.07253557e-18 3.86868712e-16 1.58661120e-16 4.03035161e-02\n", 397 | " -4.00000394e-18 -3.84586644e-16]\n", 398 | " [-1.22985373e-02 7.77829097e-01 4.78181725e-02 -6.77175431e-16\n", 399 | " 1.21910042e-16 -1.21924948e-01]\n", 400 | " [-9.02654405e-19 6.56741872e-17 -7.14025665e-18 9.67825232e-17\n", 401 | " -1.98919454e-16 3.34086186e-18]\n", 402 | " [ 3.78240995e-17 -5.69887843e-16 -5.79114830e-16 -4.16508161e-02\n", 403 | " -1.04841052e-19 3.30857934e-16]]\n", 404 | "\n", 405 | " [[ 5.63209591e-17 -1.65136428e-17 -4.59433017e-17 2.66345601e-18\n", 406 | " 3.38081759e-02 4.61370440e-17]\n", 407 | " [-1.60509292e-17 4.28619721e-17 -6.59536990e-17 1.07989333e-17\n", 408 | " 1.56942623e-01 1.04627263e-16]\n", 409 | " [ 6.98774235e-18 -2.84684378e-16 -1.18414691e-16 -1.67273510e-18\n", 410 | " 4.03035161e-02 2.14740584e-16]\n", 411 | " [-1.03302030e-18 6.01148233e-17 -8.79616741e-18 9.68652597e-17\n", 412 | " -1.99007290e-16 4.09343394e-18]\n", 413 | " [-1.22985373e-02 7.77829097e-01 4.78181725e-02 -2.93616935e-16\n", 414 | " 3.18588225e-16 -1.21924948e-01]\n", 415 | " [-7.25902671e-18 7.63531205e-17 4.18745697e-16 -2.69827020e-18\n", 416 | " -4.16508161e-02 -3.26965977e-16]]\n", 417 | "\n", 418 | " [[-2.66865302e-02 -2.69295995e-03 2.03747148e-02 -1.09074335e-16\n", 419 | " 5.29549700e-17 8.74204002e-03]\n", 420 | " [ 4.54101197e-03 -1.20862414e-01 2.11790621e-02 -1.27669563e-16\n", 421 | " 8.42130505e-17 8.19731113e-02]\n", 422 | " [-5.34487452e-03 1.01782960e-01 6.86961222e-02 -5.73001239e-16\n", 423 | " 3.29943651e-16 -6.06860239e-02]\n", 424 | " [ 3.10891974e-17 -5.72139020e-16 -5.77027032e-16 -4.16508161e-02\n", 425 | " -1.21923342e-17 3.62230683e-16]\n", 426 | " [-1.93102143e-17 7.76700134e-17 4.24052734e-16 -8.09144058e-18\n", 427 | " -4.16508161e-02 -3.25314295e-16]\n", 428 | " [-5.21692816e-03 6.12883783e-01 -9.90962252e-02 4.84790294e-16\n", 429 | " -2.85955856e-16 -1.95498046e-02]]]\n", 430 | "\n", 431 | "\n", 432 | " [[[-1.51436760e-01 8.78369520e-02 9.90974245e-01 7.38970583e-16\n", 433 | " -5.50416065e-16 2.65843254e-01]\n", 434 | " [ 1.84429506e-02 -9.36020789e-03 -1.31679803e-02 -7.16785738e-18\n", 435 | " -1.70018886e-17 -5.34487452e-03]\n", 436 | " [ 2.46189939e-02 2.16452114e-02 8.70090353e-03 -7.60223159e-18\n", 437 | " -1.73638175e-17 2.07171914e-03]\n", 438 | " [ 1.06045893e-17 6.31516161e-17 6.93132294e-17 1.12083197e-02\n", 439 | " 5.36401908e-19 -6.24519954e-17]\n", 440 | " [-1.65377232e-17 -4.35391111e-17 -4.03188552e-17 5.44671107e-19\n", 441 | " 1.12083197e-02 2.59803830e-17]\n", 442 | " [ 6.40512562e-03 2.03747148e-02 1.41651559e-02 -4.77118497e-17\n", 443 | " 4.45946429e-17 4.81053325e-03]]\n", 444 | "\n", 445 | " [[ 1.84429506e-02 -9.36020789e-03 -1.31679803e-02 -7.00325155e-18\n", 446 | " -1.71569887e-17 -5.34487452e-03]\n", 447 | " [-1.72330627e-02 -2.82736344e-02 7.08160916e-01 3.92718519e-16\n", 448 | " -2.62930241e-16 1.01782960e-01]\n", 449 | " [ 2.16452114e-02 1.38461310e-01 6.20624861e-02 1.56683619e-16\n", 450 | " -1.42692749e-16 6.86961222e-02]\n", 451 | " [ 6.28083358e-17 9.14271723e-17 5.48165483e-17 4.03035161e-02\n", 452 | " 2.21804381e-18 -5.84375100e-16]\n", 453 | " [-4.16100701e-17 -3.87190986e-17 -4.78886701e-17 -9.10686851e-20\n", 454 | " 4.03035161e-02 3.28884158e-16]\n", 455 | " [ 1.65509332e-02 2.11790621e-02 -5.09591903e-02 -3.86124719e-16\n", 456 | " 2.25780293e-16 -6.06860239e-02]]\n", 457 | "\n", 458 | " [[ 2.46189939e-02 2.16452114e-02 8.70090353e-03 -7.69268693e-18\n", 459 | " -1.73381153e-17 2.07171914e-03]\n", 460 | " [ 2.16452114e-02 1.38461310e-01 6.20624861e-02 1.52032141e-16\n", 461 | " -1.36832106e-16 6.86961222e-02]\n", 462 | " [ 8.70090353e-03 6.20624861e-02 7.76790044e-01 3.58453331e-16\n", 463 | " -3.78158704e-16 1.24533083e-01]\n", 464 | " [-5.74666927e-18 1.51539285e-16 3.30697521e-16 5.15571898e-02\n", 465 | " 1.26305866e-17 1.64433354e-16]\n", 466 | " [-3.66888414e-18 -1.37656233e-16 -3.74065012e-16 1.86281933e-17\n", 467 | " 5.15571898e-02 -2.64611408e-16]\n", 468 | " [ 2.07171914e-03 6.86961222e-02 1.24533083e-01 1.39987226e-16\n", 469 | " -2.37270313e-16 1.22969373e-01]]\n", 470 | "\n", 471 | " [[ 1.09378157e-17 6.37267922e-17 6.96705071e-17 1.12083197e-02\n", 472 | " 7.86224323e-19 -6.34977229e-17]\n", 473 | " [ 6.29176851e-17 9.34432656e-17 4.58916588e-17 4.03035161e-02\n", 474 | " 6.15329727e-19 -5.81776032e-16]\n", 475 | " [-6.41110209e-18 1.50202531e-16 3.48946405e-16 5.15571898e-02\n", 476 | " 1.34855237e-17 1.64103518e-16]\n", 477 | " [-4.28354178e-03 4.78181725e-02 7.25741700e-01 3.03308905e-16\n", 478 | " -3.59885921e-16 1.36326286e-01]\n", 479 | " [-2.36025624e-19 -2.46655254e-19 7.62539435e-17 -1.39198663e-17\n", 480 | " 1.10947810e-17 1.93435845e-17]\n", 481 | " [-5.70771606e-17 -5.79516394e-16 -5.96490421e-16 7.58596288e-03\n", 482 | " 1.12904801e-17 -5.48426903e-16]]\n", 483 | "\n", 484 | " [[-1.60895429e-17 -4.57644574e-17 -4.09584211e-17 5.04510494e-19\n", 485 | " 1.12083197e-02 2.46502030e-17]\n", 486 | " [-4.25044827e-17 -6.32142324e-17 -3.71395061e-17 -1.21787130e-18\n", 487 | " 4.03035161e-02 3.22322730e-16]\n", 488 | " [-6.01748664e-18 -1.36513698e-16 -3.95240946e-16 1.70449848e-17\n", 489 | " 5.15571898e-02 -2.54364688e-16]\n", 490 | " [-3.44124037e-19 -1.42976612e-18 7.31435902e-17 -1.93597891e-17\n", 491 | " 1.08968764e-17 1.93896444e-17]\n", 492 | " [-4.28354178e-03 4.78181725e-02 7.25741700e-01 3.85681937e-16\n", 493 | " -3.31686842e-16 1.36326286e-01]\n", 494 | " [ 3.78853210e-17 3.82071201e-16 1.59936272e-17 2.04007295e-17\n", 495 | " 7.58596288e-03 3.51136501e-16]]\n", 496 | "\n", 497 | " [[ 6.40512562e-03 2.03747148e-02 1.41651559e-02 -4.60113353e-17\n", 498 | " 4.00279025e-17 4.81053325e-03]\n", 499 | " [ 1.65509332e-02 2.11790621e-02 -5.09591903e-02 -3.70006558e-16\n", 500 | " 2.36072871e-16 -6.06860239e-02]\n", 501 | " [ 2.07171914e-03 6.86961222e-02 1.24533083e-01 1.45390381e-16\n", 502 | " -2.48960215e-16 1.22969373e-01]\n", 503 | " [-5.98812615e-17 -5.84841519e-16 -5.77016480e-16 7.58596288e-03\n", 504 | " 1.23841504e-17 -5.43835630e-16]\n", 505 | " [ 3.22917510e-17 3.77577540e-16 2.19281014e-17 1.60348913e-17\n", 506 | " 7.58596288e-03 4.20161122e-16]\n", 507 | " [-1.59999430e-02 -9.90962252e-02 5.81960146e-01 -5.62833487e-17\n", 508 | " -8.75384574e-17 -4.47663569e-02]]]\n", 509 | "\n", 510 | "\n", 511 | " [[[ 7.24475862e-16 -5.35265241e-16 7.41078058e-16 1.11539591e+00\n", 512 | " 8.34603647e-17 -1.49442502e-15]\n", 513 | " [-9.29516294e-17 4.20103213e-17 -3.45086350e-18 -1.22985373e-02\n", 514 | " -1.56950602e-18 3.51430540e-17]\n", 515 | " [ 1.15143121e-17 6.36520659e-17 -5.04434616e-18 -4.28354178e-03\n", 516 | " 1.95927089e-19 -5.91974119e-17]\n", 517 | " [ 2.58536922e-02 3.38081759e-02 1.12083197e-02 -8.58042392e-17\n", 518 | " 2.58958240e-17 -1.03687761e-02]\n", 519 | " [ 1.86072683e-18 2.05834089e-18 6.58752888e-19 -1.11612335e-17\n", 520 | " -5.32209955e-17 -5.44482693e-19]\n", 521 | " [-3.66957602e-17 -1.07918652e-16 -5.06388803e-17 4.10551212e-03\n", 522 | " -2.11554431e-18 -2.61415475e-17]]\n", 523 | "\n", 524 | " [[-9.28990976e-17 4.19616222e-17 -3.18653490e-18 -1.22985373e-02\n", 525 | " -1.52825484e-18 3.53025331e-17]\n", 526 | " [ 7.02636125e-17 3.45958364e-17 3.82481017e-16 7.77829097e-01\n", 527 | " 5.60348158e-17 -5.76081635e-16]\n", 528 | " [ 6.28423300e-17 8.65834970e-17 1.52507841e-16 4.78181725e-02\n", 529 | " 2.41684037e-18 -5.77716219e-16]\n", 530 | " [ 3.38081759e-02 1.56942623e-01 4.03035161e-02 -6.72283252e-16\n", 531 | " 9.39618191e-17 -4.16508161e-02]\n", 532 | " [ 2.44672925e-18 1.20003127e-17 -1.34681878e-18 1.54023838e-16\n", 533 | " -1.99355746e-16 -3.78971831e-18]\n", 534 | " [-8.84610036e-17 -1.19452093e-16 -3.81998706e-16 -1.21924948e-01\n", 535 | " -1.77498652e-17 3.53036082e-16]]\n", 536 | "\n", 537 | " [[ 1.10231426e-17 6.34469908e-17 -5.63557339e-18 -4.28354178e-03\n", 538 | " 9.74539644e-20 -5.93719809e-17]\n", 539 | " [ 6.35493366e-17 8.38524128e-17 1.46681763e-16 4.78181725e-02\n", 540 | " 2.30603505e-18 -5.83417256e-16]\n", 541 | " [ 6.85974454e-17 4.67167947e-17 3.58440649e-16 7.25741700e-01\n", 542 | " 7.02533307e-17 -5.85187162e-16]\n", 543 | " [ 1.12083197e-02 4.03035161e-02 5.15571898e-02 3.19321188e-16\n", 544 | " -1.02484976e-17 7.58596288e-03]\n", 545 | " [ 6.56785337e-19 1.51341338e-18 2.32854515e-17 -3.30146328e-16\n", 546 | " 9.76853407e-18 7.17762804e-18]\n", 547 | " [-6.27166816e-17 -5.79844033e-16 1.46838120e-16 1.36326286e-01\n", 548 | " 1.36742933e-17 -5.42577443e-16]]\n", 549 | "\n", 550 | " [[ 2.58536922e-02 3.38081759e-02 1.12083197e-02 -8.58601376e-17\n", 551 | " 2.59044877e-17 -1.03687761e-02]\n", 552 | " [ 3.38081759e-02 1.56942623e-01 4.03035161e-02 -6.75276028e-16\n", 553 | " 9.31642334e-17 -4.16508161e-02]\n", 554 | " [ 1.12083197e-02 4.03035161e-02 5.15571898e-02 3.23522274e-16\n", 555 | " -1.02897745e-17 7.58596288e-03]\n", 556 | " [-8.58205414e-17 -6.75009085e-16 3.12854000e-16 8.80159093e-01\n", 557 | " 8.42291016e-17 -9.27091982e-16]\n", 558 | " [ 2.58829698e-17 9.42710230e-17 -1.41010364e-17 8.53823739e-17\n", 559 | " 4.74444451e-02 3.38496549e-17]\n", 560 | " [-1.03687761e-02 -4.16508161e-02 7.58596288e-03 -9.07169515e-16\n", 561 | " 3.42335299e-17 2.41407920e-02]]\n", 562 | "\n", 563 | " [[ 2.08241613e-18 2.56250307e-18 6.15119958e-19 -1.10549859e-17\n", 564 | " -5.31856276e-17 -7.48307767e-19]\n", 565 | " [ 2.77800469e-18 1.35424709e-17 -1.09181164e-18 1.50389710e-16\n", 566 | " -2.00170036e-16 -1.48681169e-18]\n", 567 | " [ 7.80494642e-19 1.13257232e-18 2.08589133e-17 -3.55267056e-16\n", 568 | " 1.17540970e-17 6.41055966e-18]\n", 569 | " [ 2.58866624e-17 9.47652487e-17 -1.69825817e-17 8.21472731e-17\n", 570 | " 4.74444451e-02 3.63894616e-17]\n", 571 | " [ 2.01561056e-17 -2.93118299e-16 3.77927986e-16 7.85270203e-01\n", 572 | " 5.18800060e-17 -7.60522335e-16]\n", 573 | " [-4.78337660e-19 -1.01461376e-17 2.36977206e-17 2.39363292e-16\n", 574 | " -3.71429634e-17 -6.84286041e-18]]\n", 575 | "\n", 576 | " [[-3.71748528e-17 -1.08621484e-16 -4.91836804e-17 4.10551212e-03\n", 577 | " -1.62676099e-18 -2.71327645e-17]\n", 578 | " [-8.74808004e-17 -1.29571907e-16 -3.69475554e-16 -1.21924948e-01\n", 579 | " -2.04867605e-17 3.82797863e-16]\n", 580 | " [-6.30385715e-17 -5.75563143e-16 1.40621257e-16 1.36326286e-01\n", 581 | " 2.25859893e-17 -5.43623274e-16]\n", 582 | " [-1.03687761e-02 -4.16508161e-02 7.58596288e-03 -9.27546967e-16\n", 583 | " 3.51423788e-17 2.41407920e-02]\n", 584 | " [-1.07107811e-19 -8.09144058e-18 1.80345785e-17 2.74003495e-16\n", 585 | " -3.04026029e-17 -1.09362852e-17]\n", 586 | " [ 8.19554995e-17 4.90786286e-16 -5.42114829e-17 5.54511357e-01\n", 587 | " 6.94557809e-17 2.26305674e-16]]]\n", 588 | "\n", 589 | "\n", 590 | " [[[-3.88795062e-16 3.45664726e-16 -6.62705861e-16 7.74099525e-17\n", 591 | " 1.11539591e+00 5.05031143e-16]\n", 592 | " [ 5.72941872e-17 -1.93662279e-17 -5.13400802e-18 3.19364933e-18\n", 593 | " -1.22985373e-02 -1.85646071e-17]\n", 594 | " [-1.76934438e-17 -4.08646248e-17 -1.39402411e-17 1.89909584e-18\n", 595 | " -4.28354178e-03 2.65875262e-17]\n", 596 | " [ 2.43775176e-18 2.88628224e-18 4.28496148e-19 2.59123818e-17\n", 597 | " 2.01557202e-17 -9.13124488e-20]\n", 598 | " [ 2.58536922e-02 3.38081759e-02 1.12083197e-02 -5.32355705e-17\n", 599 | " 4.02777935e-17 -1.03687761e-02]\n", 600 | " [ 8.64796110e-18 5.34705436e-17 3.91538782e-17 -4.02345687e-18\n", 601 | " 4.10551212e-03 2.54922801e-17]]\n", 602 | "\n", 603 | " [[ 5.68334214e-17 -1.92170895e-17 -5.32576584e-18 3.27726878e-18\n", 604 | " -1.22985373e-02 -1.93954792e-17]\n", 605 | " [-1.60125232e-17 3.31266296e-17 -2.34589169e-16 5.34409789e-17\n", 606 | " 7.77829097e-01 1.36691689e-16]\n", 607 | " [-5.18481641e-17 -6.88754837e-17 -1.33302042e-16 -3.42752947e-18\n", 608 | " 4.78181725e-02 4.15904076e-16]\n", 609 | " [ 3.74541266e-18 1.38225127e-17 2.65584034e-18 9.44605038e-17\n", 610 | " -2.94146459e-16 -7.37863019e-18]\n", 611 | " [ 3.38081759e-02 1.56942623e-01 4.03035161e-02 -2.01209972e-16\n", 612 | " 3.22006652e-16 -4.16508161e-02]\n", 613 | " [ 4.46217295e-17 8.49057634e-17 2.35065739e-16 -1.30310904e-17\n", 614 | " -1.21924948e-01 -2.38181109e-16]]\n", 615 | "\n", 616 | " [[-1.54476228e-17 -4.26584721e-17 -1.44448025e-17 1.74553761e-18\n", 617 | " -4.28354178e-03 2.85737500e-17]\n", 618 | " [-5.24436864e-17 -6.05786138e-17 -1.23797605e-16 -4.81172175e-18\n", 619 | " 4.78181725e-02 4.23896285e-16]\n", 620 | " [-4.58998027e-17 -4.11143814e-17 -4.23112641e-16 7.98465212e-17\n", 621 | " 7.25741700e-01 -7.51453852e-17]\n", 622 | " [ 1.28248200e-18 9.51984295e-19 1.86774248e-17 -1.41460768e-17\n", 623 | " 4.02851317e-16 1.40249887e-17]\n", 624 | " [ 1.12083197e-02 4.03035161e-02 5.15571898e-02 1.82239463e-17\n", 625 | " -2.86230059e-16 7.58596288e-03]\n", 626 | " [ 2.77445050e-17 3.13485460e-16 -2.40532470e-16 2.87371282e-17\n", 627 | " 1.36326286e-01 2.99776198e-16]]\n", 628 | "\n", 629 | " [[ 2.15608302e-18 2.73102373e-18 7.85659519e-19 2.59268106e-17\n", 630 | " 2.02062083e-17 1.01364825e-19]\n", 631 | " [ 3.38130870e-18 1.22573477e-17 6.20816682e-19 9.50015298e-17\n", 632 | " -2.96326987e-16 -3.25795780e-18]\n", 633 | " [ 9.53868053e-19 -3.09937720e-19 1.77899037e-17 -1.45113768e-17\n", 634 | " 3.96356120e-16 1.73727281e-17]\n", 635 | " [-1.08729226e-17 1.48634095e-16 -3.64203140e-16 9.68037890e-17\n", 636 | " 7.85270203e-01 1.31637405e-16]\n", 637 | " [-5.32188838e-17 -1.99048728e-16 1.33048747e-17 4.74444451e-02\n", 638 | " 5.23383920e-17 -3.06610756e-17]\n", 639 | " [-8.28398597e-19 -3.90222552e-18 1.50208563e-17 2.87687967e-17\n", 640 | " -7.80207325e-16 -9.92969176e-18]]\n", 641 | "\n", 642 | " [[ 2.58536922e-02 3.38081759e-02 1.12083197e-02 -5.32228211e-17\n", 643 | " 4.03517584e-17 -1.03687761e-02]\n", 644 | " [ 3.38081759e-02 1.56942623e-01 4.03035161e-02 -2.01718798e-16\n", 645 | " 3.17876585e-16 -4.16508161e-02]\n", 646 | " [ 1.12083197e-02 4.03035161e-02 5.15571898e-02 1.96423502e-17\n", 647 | " -3.15002488e-16 7.58596288e-03]\n", 648 | " [-5.32178875e-17 -1.99221044e-16 1.34907303e-17 4.74444451e-02\n", 649 | " 4.43627029e-17 -3.15924331e-17]\n", 650 | " [ 4.09038064e-17 3.32330136e-16 -3.41732843e-16 5.68124213e-17\n", 651 | " 8.80159093e-01 2.46015821e-16]\n", 652 | " [-1.03687761e-02 -4.16508161e-02 7.58596288e-03 -2.88035592e-17\n", 653 | " 3.65658022e-16 2.41407920e-02]]\n", 654 | "\n", 655 | " [[ 1.14842058e-17 5.29927789e-17 3.58342004e-17 -3.42725602e-18\n", 656 | " 4.10551212e-03 2.03369360e-17]\n", 657 | " [ 4.15665940e-17 8.49275311e-17 2.27815319e-16 -9.92789810e-18\n", 658 | " -1.21924948e-01 -3.10743814e-16]\n", 659 | " [ 2.92299580e-17 3.23815862e-16 -2.63045587e-16 3.36246499e-17\n", 660 | " 1.36326286e-01 2.58863667e-16]\n", 661 | " [-1.18786159e-18 -6.55242503e-18 1.61166738e-17 3.42755747e-17\n", 662 | " -7.47036950e-16 -1.55101703e-18]\n", 663 | " [-1.03687761e-02 -4.16508161e-02 7.58596288e-03 -2.71587433e-17\n", 664 | " 4.08433292e-16 2.41407920e-02]\n", 665 | " [-3.42615966e-17 -3.06293651e-16 -1.01248680e-16 6.40743067e-17\n", 666 | " 5.54511357e-01 -4.68497042e-16]]]\n", 667 | "\n", 668 | "\n", 669 | " [[[ 1.59790984e-01 -2.42118626e-01 2.65843254e-01 -1.48686529e-15\n", 670 | " 5.20904810e-16 7.34481338e-01]\n", 671 | " [-2.66865302e-02 4.54101197e-03 -5.34487452e-03 3.40261798e-17\n", 672 | " -6.02251637e-18 -5.21692816e-03]\n", 673 | " [ 6.40512562e-03 1.65509332e-02 2.07171914e-03 -5.86350711e-17\n", 674 | " 3.23960261e-17 -1.59999430e-02]\n", 675 | " [-3.70913381e-17 -8.71058580e-17 -6.23934124e-17 -1.03687761e-02\n", 676 | " -1.98189294e-19 8.12701986e-17]\n", 677 | " [ 1.12890678e-17 4.95069033e-17 2.57878898e-17 -2.07898914e-19\n", 678 | " -1.03687761e-02 -3.94212962e-17]\n", 679 | " [ 2.11708054e-02 8.74204002e-03 4.81053325e-03 -2.67510170e-17\n", 680 | " 1.70428255e-17 -8.28037465e-03]]\n", 681 | "\n", 682 | " [[-2.66865302e-02 4.54101197e-03 -5.34487452e-03 3.58459140e-17\n", 683 | " -1.28374354e-17 -5.21692816e-03]\n", 684 | " [-2.69295995e-03 -1.20862414e-01 1.01782960e-01 -5.87566509e-16\n", 685 | " 1.13943274e-16 6.12883783e-01]\n", 686 | " [ 2.03747148e-02 2.11790621e-02 6.86961222e-02 -5.75977636e-16\n", 687 | " 3.91491020e-16 -9.90962252e-02]\n", 688 | " [-1.09508905e-16 -1.28547307e-16 -5.77033393e-16 -4.16508161e-02\n", 689 | " -7.39097716e-18 5.00200703e-16]\n", 690 | " [ 5.50351126e-17 7.78535993e-17 3.02487357e-16 -3.78971831e-18\n", 691 | " -4.16508161e-02 -2.77881015e-16]\n", 692 | " [ 8.74204002e-03 8.19731113e-02 -6.06860239e-02 3.40040612e-16\n", 693 | " -2.52832920e-16 -1.95498046e-02]]\n", 694 | "\n", 695 | " [[ 6.40512562e-03 1.65509332e-02 2.07171914e-03 -5.84913792e-17\n", 696 | " 3.13781839e-17 -1.59999430e-02]\n", 697 | " [ 2.03747148e-02 2.11790621e-02 6.86961222e-02 -5.86491116e-16\n", 698 | " 3.95341123e-16 -9.90962252e-02]\n", 699 | " [ 1.41651559e-02 -5.09591903e-02 1.24533083e-01 -5.79867327e-16\n", 700 | " -2.26023462e-17 5.81960146e-01]\n", 701 | " [-5.01315007e-17 -3.75491981e-16 1.47176664e-16 7.58596288e-03\n", 702 | " 1.01131802e-17 -6.92595244e-17]\n", 703 | " [ 2.06011814e-17 2.37459079e-16 -2.06147104e-16 3.93478963e-18\n", 704 | " 7.58596288e-03 -7.05959579e-17]\n", 705 | " [ 4.81053325e-03 -6.06860239e-02 1.22969373e-01 -5.35940100e-16\n", 706 | " 4.18866785e-16 -4.47663569e-02]]\n", 707 | "\n", 708 | " [[-3.63531909e-17 -8.66132640e-17 -6.33530617e-17 -1.03687761e-02\n", 709 | " -2.58995681e-19 8.22187942e-17]\n", 710 | " [-1.08938314e-16 -1.28760431e-16 -5.78190369e-16 -4.16508161e-02\n", 711 | " -1.62892236e-18 4.87160546e-16]\n", 712 | " [-4.90432803e-17 -3.65424365e-16 1.48221026e-16 7.58596288e-03\n", 713 | " 1.22987764e-17 -9.93756737e-17]\n", 714 | " [ 4.10551212e-03 -1.21924948e-01 1.36326286e-01 -9.34464557e-16\n", 715 | " 2.02644474e-16 5.54511357e-01]\n", 716 | " [-5.10629769e-19 -7.11277150e-18 9.47875378e-18 3.73191019e-17\n", 717 | " -2.92824762e-17 8.25926222e-17]\n", 718 | " [-2.77764952e-17 3.52475159e-16 -5.57150035e-16 2.41407920e-02\n", 719 | " -2.99917387e-18 2.57969368e-16]]\n", 720 | "\n", 721 | " [[ 1.00444442e-17 4.67272269e-17 2.52523223e-17 -3.63067255e-19\n", 722 | " -1.03687761e-02 -3.59568419e-17]\n", 723 | " [ 5.28651187e-17 9.49657800e-17 3.02638221e-16 8.96476866e-19\n", 724 | " -4.16508161e-02 -3.14608810e-16]\n", 725 | " [ 2.43490888e-17 2.40546102e-16 -1.97596648e-16 1.94276737e-18\n", 726 | " 7.58596288e-03 -8.70338454e-17]\n", 727 | " [-4.96521805e-19 -8.04963039e-18 9.03892277e-18 3.88423191e-17\n", 728 | " -2.89656540e-17 7.22640274e-17]\n", 729 | " [ 4.10551212e-03 -1.21924948e-01 1.36326286e-01 -7.47555315e-16\n", 730 | " 3.52481656e-16 5.54511357e-01]\n", 731 | " [ 6.57928849e-18 -2.85680996e-16 4.27031208e-16 2.47161660e-18\n", 732 | " 2.41407920e-02 -5.40232450e-16]]\n", 733 | "\n", 734 | " [[ 2.11708054e-02 8.74204002e-03 4.81053325e-03 -2.78100192e-17\n", 735 | " 2.18003028e-17 -8.28037465e-03]\n", 736 | " [ 8.74204002e-03 8.19731113e-02 -6.06860239e-02 3.59343363e-16\n", 737 | " -2.94523526e-16 -1.95498046e-02]\n", 738 | " [ 4.81053325e-03 -6.06860239e-02 1.22969373e-01 -5.65511256e-16\n", 739 | " 3.25606375e-16 -4.47663569e-02]\n", 740 | " [-2.38230680e-17 3.72655487e-16 -5.61117015e-16 2.41407920e-02\n", 741 | " 1.05312602e-18 2.45325519e-16]\n", 742 | " [ 1.77382953e-17 -3.05222293e-16 4.51956871e-16 -8.35854727e-18\n", 743 | " 2.41407920e-02 -7.19829152e-16]\n", 744 | " [-8.28037465e-03 -1.95498046e-02 -4.47663569e-02 2.48789063e-16\n", 745 | " -6.32392778e-16 7.04304126e-01]]]]\n" 746 | ] 747 | } 748 | ], 749 | "source": [ 750 | "hamiltonian = qmolecule.hamiltonian\n", 751 | "coefficients = hamiltonian.electronic_integrals\n", 752 | "print(coefficients.alpha)\n", 753 | "second_q_op = hamiltonian.second_q_op()" 754 | ] 755 | }, 756 | { 757 | "cell_type": "code", 758 | "execution_count": null, 759 | "metadata": { 760 | "id": "zLhtOziW8xCC" 761 | }, 762 | "outputs": [], 763 | "source": [ 764 | "mapper = JordanWignerMapper()\n", 765 | "converter = QubitConverter(mapper=mapper, two_qubit_reduction=False)\n", 766 | "qubit_op = converter.convert(second_q_op)" 767 | ] 768 | }, 769 | { 770 | "cell_type": "markdown", 771 | "metadata": { 772 | "id": "rAQ3oSvbKFIU" 773 | }, 774 | "source": [ 775 | "We recommend to use classical minimum eigensolver to obtain a reference energy at this step. In case some of the classical minimum eigensolver donot directly gives nuclear repulsion energy, we give reference energies below: *Comupted Energy*: -78.75252123, *Nuclear Repulsion_energy*: 4.36537496654537. *Obtained Reference Ground State Energy*: -74.38714627." 776 | ] 777 | }, 778 | { 779 | "cell_type": "code", 780 | "execution_count": null, 781 | "metadata": { 782 | "id": "gZQaJ8T441s7" 783 | }, 784 | "outputs": [], 785 | "source": [ 786 | "from qiskit.algorithms.minimum_eigensolvers import NumPyMinimumEigensolver\n", 787 | "from qiskit_nature.second_q.algorithms import GroundStateEigensolver\n", 788 | "\n", 789 | "solver = GroundStateEigensolver(\n", 790 | " JordanWignerMapper(),\n", 791 | " NumPyMinimumEigensolver(),\n", 792 | ")" 793 | ] 794 | }, 795 | { 796 | "cell_type": "code", 797 | "execution_count": null, 798 | "metadata": { 799 | "colab": { 800 | "base_uri": "https://localhost:8080/" 801 | }, 802 | "id": "CzsPX9Fg42zY", 803 | "outputId": "57ff628a-9fb8-479d-af26-fb644d807202" 804 | }, 805 | "outputs": [ 806 | { 807 | "name": "stdout", 808 | "output_type": "stream", 809 | "text": [ 810 | "[-78.75252123]\n" 811 | ] 812 | } 813 | ], 814 | "source": [ 815 | "result = solver.solve(qmolecule)\n", 816 | "print(result.computed_energies)" 817 | ] 818 | }, 819 | { 820 | "cell_type": "code", 821 | "execution_count": null, 822 | "metadata": { 823 | "colab": { 824 | "base_uri": "https://localhost:8080/" 825 | }, 826 | "id": "zP_A04usULdu", 827 | "outputId": "b09f2d22-4a51-4f60-a4f5-5d83b0b9477a" 828 | }, 829 | "outputs": [ 830 | { 831 | "name": "stdout", 832 | "output_type": "stream", 833 | "text": [ 834 | "4.36537496654537\n" 835 | ] 836 | } 837 | ], 838 | "source": [ 839 | "print(result.nuclear_repulsion_energy)" 840 | ] 841 | }, 842 | { 843 | "cell_type": "code", 844 | "execution_count": null, 845 | "metadata": { 846 | "colab": { 847 | "base_uri": "https://localhost:8080/" 848 | }, 849 | "id": "CjUk5SkJUQkn", 850 | "outputId": "925ff152-1a4f-4cb0-f3f2-cbe3798562be" 851 | }, 852 | "outputs": [ 853 | { 854 | "name": "stdout", 855 | "output_type": "stream", 856 | "text": [ 857 | "[-74.38714627]\n" 858 | ] 859 | } 860 | ], 861 | "source": [ 862 | "ref_value = result.computed_energies + result.nuclear_repulsion_energy\n", 863 | "print(ref_value)" 864 | ] 865 | }, 866 | { 867 | "cell_type": "markdown", 868 | "metadata": { 869 | "id": "7FoppB2vK3Pb" 870 | }, 871 | "source": [ 872 | "## Construct Ansatz" 873 | ] 874 | }, 875 | { 876 | "cell_type": "markdown", 877 | "metadata": { 878 | "id": "FXhkX--4LLjy" 879 | }, 880 | "source": [ 881 | "At this stage, you can implement various techniques to search good ansatz architecture which is important for variational quantum algorihms. Moreover, how to obtain a good initial state is a good topic to do research, we require participant to self-reflection there techniques (include the techniques for preprocessing ansatz or initial states) with maximum 10 points, and submit a short description for used techniques, we will have three graders to evaluate the techniques." 882 | ] 883 | }, 884 | { 885 | "cell_type": "code", 886 | "execution_count": null, 887 | "metadata": { 888 | "id": "TR3cvipPWCQ5" 889 | }, 890 | "outputs": [], 891 | "source": [ 892 | "ansatz = UCCSD(\n", 893 | " qmolecule.num_spatial_orbitals,\n", 894 | " qmolecule.num_particles,\n", 895 | " mapper,\n", 896 | " initial_state=HartreeFock(\n", 897 | " qmolecule.num_spatial_orbitals,\n", 898 | " qmolecule.num_particles,\n", 899 | " mapper,\n", 900 | " ),\n", 901 | ")\n" 902 | ] 903 | }, 904 | { 905 | "cell_type": "code", 906 | "execution_count": null, 907 | "metadata": { 908 | "id": "HAepMEuOyygR" 909 | }, 910 | "outputs": [], 911 | "source": [ 912 | "from qiskit_nature.second_q.algorithms import GroundStateEigensolver" 913 | ] 914 | }, 915 | { 916 | "cell_type": "code", 917 | "execution_count": null, 918 | "metadata": { 919 | "id": "vzVDjGNVfWA8" 920 | }, 921 | "outputs": [], 922 | "source": [ 923 | "estimator = Estimator(\n", 924 | " backend_options = {\n", 925 | " 'method': 'statevector',\n", 926 | " 'device': 'CPU'\n", 927 | " # 'noise_model': noise_model\n", 928 | " },\n", 929 | " run_options = {\n", 930 | " 'shots': shot,\n", 931 | " 'seed': seeds,\n", 932 | " },\n", 933 | " transpile_options = {\n", 934 | " 'seed_transpiler':seed_transpiler\n", 935 | " }\n", 936 | ")" 937 | ] 938 | }, 939 | { 940 | "cell_type": "code", 941 | "execution_count": null, 942 | "metadata": { 943 | "id": "37uQ745tydW3" 944 | }, 945 | "outputs": [], 946 | "source": [ 947 | "vqe_solver = VQE(estimator, ansatz, SLSQP())\n", 948 | "vqe_solver.initial_point = [0.0] * ansatz.num_parameters" 949 | ] 950 | }, 951 | { 952 | "cell_type": "code", 953 | "execution_count": null, 954 | "metadata": { 955 | "colab": { 956 | "base_uri": "https://localhost:8080/" 957 | }, 958 | "id": "HiJ4ojaDy38R", 959 | "outputId": "5cdb012c-8e39-4112-9605-ae60821e7ca2" 960 | }, 961 | "outputs": [ 962 | { 963 | "name": "stdout", 964 | "output_type": "stream", 965 | "text": [ 966 | "=== GROUND STATE ENERGY ===\n", 967 | " \n", 968 | "* Electronic ground state energy (Hartree): -57.121081083643\n", 969 | " - computed part: -57.121081083643\n", 970 | "~ Nuclear repulsion energy (Hartree): 4.365374966545\n", 971 | "> Total ground state energy (Hartree): -52.755706117097\n", 972 | " \n", 973 | "=== MEASURED OBSERVABLES ===\n", 974 | " \n", 975 | " 0: # Particles: 8.008 S: 0.334 S^2: 0.445 M: -0.005\n", 976 | " \n", 977 | "=== DIPOLE MOMENTS ===\n", 978 | " \n", 979 | "~ Nuclear dipole moment (a.u.): [0.85037676 -0.28818323 -1.59757447]\n", 980 | " \n", 981 | " 0: \n", 982 | " * Electronic dipole moment (a.u.): [1.104033287945 -0.383250343741 -2.067354598683]\n", 983 | " - computed part: [1.104033287945 -0.383250343741 -2.067354598683]\n", 984 | " > Dipole moment (a.u.): [-0.253656527945 0.095067113741 0.469780128683] Total: 0.542284758765\n", 985 | " (debye): [-0.644730523886 0.24163647805 1.194061871504] Total: 1.378350241751\n", 986 | " \n" 987 | ] 988 | } 989 | ], 990 | "source": [ 991 | "start_time = time.time()\n", 992 | "calc = GroundStateEigensolver(mapper, vqe_solver)\n", 993 | "res = calc.solve(qmolecule)\n", 994 | "end_time = time.time()\n", 995 | "print(res)" 996 | ] 997 | }, 998 | { 999 | "cell_type": "markdown", 1000 | "metadata": { 1001 | "id": "vNP5HcDxlq-d" 1002 | }, 1003 | "source": [ 1004 | "## Calculate the Accuracy (Most Important Metric)" 1005 | ] 1006 | }, 1007 | { 1008 | "cell_type": "code", 1009 | "execution_count": null, 1010 | "metadata": { 1011 | "colab": { 1012 | "base_uri": "https://localhost:8080/" 1013 | }, 1014 | "id": "qbP7CkZxlh8X", 1015 | "outputId": "0d85b95a-4eba-4830-e98c-283a86f9f683" 1016 | }, 1017 | "outputs": [ 1018 | { 1019 | "name": "stdout", 1020 | "output_type": "stream", 1021 | "text": [ 1022 | "Error rate: 29.079540%\n" 1023 | ] 1024 | } 1025 | ], 1026 | "source": [ 1027 | "result = res.computed_energies + res.nuclear_repulsion_energy\n", 1028 | "error_rate = abs(abs(ref_value - result) / ref_value * 100)\n", 1029 | "print(\"Error rate: %f%%\" % (error_rate))" 1030 | ] 1031 | }, 1032 | { 1033 | "cell_type": "markdown", 1034 | "metadata": { 1035 | "id": "hw8SxNyclYyT" 1036 | }, 1037 | "source": [ 1038 | "## Obtain the Duration of Quantum Circuit" 1039 | ] 1040 | }, 1041 | { 1042 | "cell_type": "code", 1043 | "execution_count": null, 1044 | "metadata": { 1045 | "id": "3TBtAF24iuFD" 1046 | }, 1047 | "outputs": [], 1048 | "source": [ 1049 | "from qiskit.providers.fake_provider import *\n", 1050 | "backend = FakeMontreal()" 1051 | ] 1052 | }, 1053 | { 1054 | "cell_type": "code", 1055 | "execution_count": null, 1056 | "metadata": { 1057 | "id": "_julUiabi5iI" 1058 | }, 1059 | "outputs": [], 1060 | "source": [ 1061 | "with pulse.build(backend) as my_program1:\n", 1062 | " pulse.call(ansatz)" 1063 | ] 1064 | }, 1065 | { 1066 | "cell_type": "code", 1067 | "execution_count": null, 1068 | "metadata": { 1069 | "colab": { 1070 | "base_uri": "https://localhost:8080/" 1071 | }, 1072 | "id": "E3jGzVpNkT00", 1073 | "outputId": "01595668-7f90-44de-d2b5-cbac21f44497" 1074 | }, 1075 | "outputs": [ 1076 | { 1077 | "data": { 1078 | "text/plain": [ 1079 | "20048096" 1080 | ] 1081 | }, 1082 | "execution_count": 42, 1083 | "metadata": {}, 1084 | "output_type": "execute_result" 1085 | } 1086 | ], 1087 | "source": [ 1088 | "my_program1.duration" 1089 | ] 1090 | } 1091 | ], 1092 | "metadata": { 1093 | "colab": { 1094 | "provenance": [] 1095 | }, 1096 | "kernelspec": { 1097 | "display_name": "Python 3 (ipykernel)", 1098 | "language": "python", 1099 | "name": "python3" 1100 | }, 1101 | "language_info": { 1102 | "codemirror_mode": { 1103 | "name": "ipython", 1104 | "version": 3 1105 | }, 1106 | "file_extension": ".py", 1107 | "mimetype": "text/x-python", 1108 | "name": "python", 1109 | "nbconvert_exporter": "python", 1110 | "pygments_lexer": "ipython3", 1111 | "version": "3.9.7" 1112 | } 1113 | }, 1114 | "nbformat": 4, 1115 | "nbformat_minor": 0 1116 | } 1117 | --------------------------------------------------------------------------------