# Gross-Pitaevskii equation with magnetism¶

We solve the 2D Gross-Pitaevskii equation with a magnetic field. This is similar to the previous example (Gross-Pitaevskii equation in one dimension), but with an extra term for the magnetic field. We reproduce here the results of https://arxiv.org/pdf/1611.02045.pdf Fig. 10

In [1]:
using DFTK
using StaticArrays
using Plots


Unit cell. Having one of the lattice vectors as zero means a 2D system

In [2]:
a = 15
lattice = a .* [[1 0 0.]; [0 1 0]; [0 0 0]];


Confining scalar potential, and magnetic vector potential

In [3]:
pot(x, y, z) = ((x - a/2)^2 + (y - a/2)^2)/2
ω = .6
Apot(x, y, z) = ω * @SVector [y - a/2, -(x - a/2), 0]
Apot(X) = Apot(X...);


Parameters

In [4]:
Ecut = 20  # Increase this for production
η = 500
C = η/2
α = 2
n_electrons = 1;  # Increase this for fun


Collect all the terms, build and run the model

In [5]:
terms = [Kinetic(),
ExternalFromReal(X -> pot(X...)),
PowerNonlinearity(C, α),
Magnetic(Apot),
]
model = Model(lattice; n_electrons=n_electrons,
terms=terms, spin_polarization=:spinless)  # "spinless electrons"
basis = PlaneWaveBasis(model, Ecut, kgrid=(1, 1, 1))
scfres = direct_minimization(basis, tol=1e-5)  # Reduce tol for production
heatmap(scfres.ρ[:, :, 1, 1], c=:blues)

Iter     Function value   Gradient norm
0     3.067763e+01     8.144237e+00
* time: 0.001901865005493164
1     2.287284e+01     4.031038e+00
* time: 0.00860285758972168
2     1.603796e+01     3.810949e+00
* time: 0.014346837997436523
3     1.176708e+01     2.048021e+00
* time: 0.018249988555908203
4     9.845149e+00     1.509777e+00
* time: 0.02226400375366211
5     9.298430e+00     1.586762e+00
* time: 0.025421857833862305
6     8.951632e+00     7.527145e-01
* time: 0.028947830200195312
7     8.728261e+00     6.490648e-01
* time: 0.03245878219604492
8     8.523520e+00     7.172486e-01
* time: 0.03638887405395508
9     8.325071e+00     4.616136e-01
* time: 0.040390968322753906
10     8.223614e+00     4.459931e-01
* time: 0.044174909591674805
11     8.140842e+00     3.460492e-01
* time: 0.08905196189880371
12     8.117604e+00     6.704982e-01
* time: 0.09198999404907227
13     8.078690e+00     6.168289e-01
* time: 0.09460997581481934
14     8.048015e+00     5.007913e-01
* time: 0.09722781181335449
15     8.025201e+00     6.291057e-01
* time: 0.09972977638244629
16     7.964722e+00     4.012559e-01
* time: 0.102935791015625
17     7.946485e+00     7.036019e-01
* time: 0.10555100440979004
18     7.896823e+00     5.000649e-01
* time: 0.10815691947937012
19     7.857545e+00     5.312369e-01
* time: 0.11090993881225586
20     7.819183e+00     3.722608e-01
* time: 0.11350893974304199
21     7.815436e+00     5.901599e-01
* time: 0.11594080924987793
22     7.784831e+00     4.471065e-01
* time: 0.1190798282623291
23     7.753742e+00     3.391313e-01
* time: 0.12236499786376953
24     7.729238e+00     3.185656e-01
* time: 0.12483787536621094
25     7.723656e+00     5.285786e-01
* time: 0.12730884552001953
26     7.706413e+00     2.849959e-01
* time: 0.13060688972473145
27     7.696576e+00     3.588888e-01
* time: 0.13454699516296387
28     7.695533e+00     3.656795e-01
* time: 0.13738584518432617
29     7.687370e+00     2.819450e-01
* time: 0.14051485061645508
30     7.678839e+00     2.867153e-01
* time: 0.14397597312927246
31     7.673153e+00     2.894578e-01
* time: 0.14703679084777832
32     7.671417e+00     2.561779e-01
* time: 0.1507108211517334
33     7.663997e+00     1.967374e-01
* time: 0.15460777282714844
34     7.659219e+00     2.753159e-01
* time: 0.15850281715393066
35     7.657626e+00     2.810287e-01
* time: 0.1622908115386963
36     7.649913e+00     2.093605e-01
* time: 0.16711091995239258
37     7.646358e+00     1.872233e-01
* time: 0.17059087753295898
38     7.644971e+00     2.535843e-01
* time: 0.17325186729431152
39     7.639046e+00     1.356052e-01
* time: 0.17644691467285156
40     7.637764e+00     1.694389e-01
* time: 0.17927289009094238
41     7.636912e+00     1.713900e-01
* time: 0.1828138828277588
42     7.634924e+00     1.362879e-01
* time: 0.18677878379821777
43     7.632691e+00     6.653321e-02
* time: 0.19138288497924805
44     7.631874e+00     1.324745e-01
* time: 0.19516587257385254
45     7.631862e+00     1.321908e-01
* time: 0.19875097274780273
46     7.630641e+00     7.483434e-02
* time: 0.20266985893249512
47     7.629195e+00     6.948935e-02
* time: 0.2300269603729248
48     7.628776e+00     1.298703e-01
* time: 0.23297977447509766
49     7.627560e+00     8.030285e-02
* time: 0.23631691932678223
50     7.627159e+00     7.912940e-02
* time: 0.23898983001708984
51     7.627149e+00     8.516281e-02
* time: 0.24165797233581543
52     7.626326e+00     5.652772e-02
* time: 0.2449169158935547
53     7.625784e+00     7.533065e-02
* time: 0.24759793281555176
54     7.625593e+00     7.264850e-02
* time: 0.25032496452331543
55     7.625061e+00     9.728055e-02
* time: 0.25295495986938477
56     7.624381e+00     5.604104e-02
* time: 0.25612688064575195
57     7.624179e+00     6.381166e-02
* time: 0.2585029602050781
58     7.623875e+00     6.513670e-02
* time: 0.2608809471130371
59     7.623455e+00     5.759971e-02
* time: 0.26357388496398926
60     7.623016e+00     5.202802e-02
* time: 0.2660038471221924
61     7.622655e+00     5.194102e-02
* time: 0.2690269947052002
62     7.622159e+00     2.598533e-02
* time: 0.27213382720947266
63     7.621800e+00     3.634237e-02
* time: 0.2746858596801758
64     7.621432e+00     3.576771e-02
* time: 0.277756929397583
65     7.621412e+00     7.768333e-02
* time: 0.28020691871643066
66     7.621029e+00     5.179030e-02
* time: 0.2833437919616699
67     7.620756e+00     4.827403e-02
* time: 0.28603386878967285
68     7.620316e+00     5.649359e-02
* time: 0.2888457775115967
69     7.620153e+00     6.224495e-02
* time: 0.2922549247741699
70     7.619887e+00     5.549768e-02
* time: 0.2952549457550049
71     7.619399e+00     4.022220e-02
* time: 0.297717809677124
72     7.618829e+00     3.201794e-02
* time: 0.3001408576965332
73     7.618355e+00     3.894010e-02
* time: 0.30257081985473633
74     7.618283e+00     7.700909e-02
* time: 0.3054847717285156
75     7.617987e+00     5.298024e-02
* time: 0.3080928325653076
76     7.617617e+00     3.367163e-02
* time: 0.31144094467163086
77     7.617232e+00     3.865301e-02
* time: 0.31439900398254395
78     7.616895e+00     4.133729e-02
* time: 0.3172109127044678
79     7.616612e+00     4.986174e-02
* time: 0.3195679187774658
80     7.616185e+00     3.454561e-02
* time: 0.3226017951965332
81     7.615866e+00     3.516066e-02
* time: 0.3259298801422119
82     7.615545e+00     4.958953e-02
* time: 0.32828187942504883
83     7.615268e+00     4.656365e-02
* time: 0.34993886947631836
84     7.614801e+00     4.113635e-02
* time: 0.3532547950744629
85     7.614400e+00     3.849660e-02
* time: 0.3565859794616699
86     7.614014e+00     3.704992e-02
* time: 0.35906481742858887
87     7.613803e+00     2.896344e-02
* time: 0.36218690872192383
88     7.613575e+00     4.191638e-02
* time: 0.3645648956298828
89     7.613491e+00     4.177907e-02
* time: 0.3671407699584961
90     7.613347e+00     3.362270e-02
* time: 0.36943697929382324
91     7.613033e+00     4.187288e-02
* time: 0.37195396423339844
92     7.612599e+00     2.552502e-02
* time: 0.3743247985839844
93     7.612522e+00     4.448100e-02
* time: 0.3768479824066162
94     7.612387e+00     5.459840e-02
* time: 0.37909388542175293
95     7.612135e+00     3.287490e-02
* time: 0.3814258575439453
96     7.612087e+00     5.973921e-02
* time: 0.3838319778442383
97     7.611761e+00     4.355610e-02
* time: 0.3863668441772461
98     7.611580e+00     5.974710e-02
* time: 0.3890349864959717
99     7.611465e+00     6.540600e-02
* time: 0.3918299674987793
100     7.611429e+00     6.440547e-02
* time: 0.3944997787475586
101     7.611285e+00     4.426346e-02
* time: 0.3970217704772949
102     7.610642e+00     4.521453e-02
* time: 0.3992428779602051
103     7.610025e+00     4.111165e-02
* time: 0.40167880058288574
104     7.609973e+00     7.365035e-02
* time: 0.4042818546295166
105     7.609553e+00     6.901144e-02
* time: 0.407545804977417
106     7.609164e+00     6.285885e-02
* time: 0.41046977043151855
107     7.608498e+00     4.422418e-02
* time: 0.41350889205932617
108     7.608269e+00     5.037694e-02
* time: 0.41600489616394043
109     7.607915e+00     4.155158e-02
* time: 0.4183638095855713
110     7.607426e+00     3.903233e-02
* time: 0.4213228225708008
111     7.606866e+00     4.575831e-02
* time: 0.4241619110107422
112     7.606402e+00     2.962163e-02
* time: 0.42737793922424316
113     7.606116e+00     4.680080e-02
* time: 0.4299488067626953
114     7.605850e+00     3.527297e-02
* time: 0.4324378967285156
115     7.605515e+00     3.454307e-02
* time: 0.43575286865234375
116     7.605474e+00     5.755433e-02
* time: 0.438248872756958
117     7.605230e+00     4.833934e-02
* time: 0.44130778312683105
118     7.604845e+00     3.795360e-02
* time: 0.44377899169921875
119     7.604423e+00     4.214736e-02
* time: 0.45621585845947266
120     7.604027e+00     2.221301e-02
* time: 0.4593048095703125
121     7.603896e+00     3.160028e-02
* time: 0.462418794631958
122     7.603777e+00     2.915129e-02
* time: 0.4657328128814697
123     7.603640e+00     2.559170e-02
* time: 0.4681859016418457
124     7.603364e+00     2.669765e-02
* time: 0.47061991691589355
125     7.603295e+00     4.728357e-02
* time: 0.47290992736816406
126     7.603024e+00     3.880838e-02
* time: 0.4752328395843506
127     7.602842e+00     4.172378e-02
* time: 0.47774291038513184
128     7.602566e+00     2.890858e-02
* time: 0.4801309108734131
129     7.602439e+00     3.134936e-02
* time: 0.4829139709472656
130     7.602352e+00     4.204783e-02
* time: 0.4854309558868408
131     7.602172e+00     2.292169e-02
* time: 0.4887399673461914
132     7.601990e+00     2.910049e-02
* time: 0.4917449951171875
133     7.601850e+00     2.607451e-02
* time: 0.49470090866088867
134     7.601698e+00     1.742428e-02
* time: 0.4979228973388672
135     7.601577e+00     1.695471e-02
* time: 0.50034499168396
136     7.601425e+00     2.045234e-02
* time: 0.5033168792724609
137     7.601328e+00     2.611383e-02
* time: 0.5056037902832031
138     7.601285e+00     2.968405e-02
* time: 0.508098840713501
139     7.601124e+00     2.467935e-02
* time: 0.510443925857544
140     7.601012e+00     3.938963e-02
* time: 0.5130748748779297
141     7.600776e+00     3.027014e-02
* time: 0.5163068771362305
142     7.600601e+00     2.897843e-02
* time: 0.5188829898834229
143     7.600397e+00     3.137727e-02
* time: 0.5213987827301025
144     7.600136e+00     3.038042e-02
* time: 0.5239458084106445
145     7.599967e+00     3.371919e-02
* time: 0.5263597965240479
146     7.599791e+00     2.702583e-02
* time: 0.5296289920806885
147     7.599635e+00     4.410893e-02
* time: 0.5320949554443359
148     7.599393e+00     4.075306e-02
* time: 0.5344879627227783
149     7.599187e+00     2.784275e-02
* time: 0.5376598834991455
150     7.598965e+00     4.152346e-02
* time: 0.5399749279022217
151     7.598713e+00     2.567408e-02
* time: 0.543043851852417
152     7.598576e+00     3.212217e-02
* time: 0.54634690284729
153     7.598365e+00     3.044514e-02
* time: 0.5490419864654541
154     7.598183e+00     3.555632e-02
* time: 0.5607059001922607
155     7.598126e+00     4.400682e-02
* time: 0.5631988048553467
156     7.598011e+00     3.943702e-02
* time: 0.5655598640441895
157     7.597839e+00     3.540376e-02
* time: 0.5687530040740967
158     7.597809e+00     4.601814e-02
* time: 0.571185827255249
159     7.597690e+00     5.088074e-02
* time: 0.5735127925872803
160     7.597633e+00     4.164509e-02
* time: 0.5761728286743164
161     7.597455e+00     3.571227e-02
* time: 0.578794002532959
162     7.597127e+00     4.702159e-02
* time: 0.5814568996429443
163     7.596931e+00     3.487333e-02
* time: 0.5845398902893066
164     7.596748e+00     2.446034e-02
* time: 0.5876338481903076
165     7.596640e+00     2.543524e-02
* time: 0.5910069942474365
166     7.596492e+00     2.621509e-02
* time: 0.5940818786621094
167     7.596381e+00     1.696287e-02
* time: 0.5972537994384766
168     7.596361e+00     2.498926e-02
* time: 0.5998148918151855
169     7.596295e+00     2.635063e-02
* time: 0.6021938323974609
170     7.596173e+00     3.476277e-02
* time: 0.6046187877655029
171     7.596069e+00     2.036438e-02
* time: 0.6072909832000732
172     7.595988e+00     2.223213e-02
* time: 0.6099109649658203
173     7.595917e+00     2.234743e-02
* time: 0.6124968528747559
174     7.595870e+00     2.140020e-02
* time: 0.6149289608001709
175     7.595782e+00     1.839593e-02
* time: 0.617332935333252
176     7.595744e+00     2.692023e-02
* time: 0.6199169158935547
177     7.595642e+00     1.907693e-02
* time: 0.6225857734680176
178     7.595620e+00     2.718274e-02
* time: 0.625046968460083
179     7.595538e+00     2.102899e-02
* time: 0.628032922744751
180     7.595499e+00     2.451351e-02
* time: 0.6304810047149658
181     7.595436e+00     1.456763e-02
* time: 0.6335108280181885
182     7.595404e+00     1.809301e-02
* time: 0.6359138488769531
183     7.595365e+00     1.957576e-02
* time: 0.6386229991912842
184     7.595355e+00     2.311020e-02
* time: 0.6412348747253418
185     7.595311e+00     1.582853e-02
* time: 0.6439089775085449
186     7.595279e+00     2.242754e-02
* time: 0.646324872970581
187     7.595245e+00     2.687960e-02
* time: 0.6486937999725342
188     7.595183e+00     2.977368e-02
* time: 0.651216983795166
189     7.595122e+00     1.152638e-02
* time: 0.65447998046875
190     7.595051e+00     1.536301e-02
* time: 0.6568648815155029
191     7.595041e+00     2.949297e-02
* time: 0.6706159114837646
192     7.595012e+00     2.119658e-02
* time: 0.6731629371643066
193     7.594958e+00     1.859068e-02
* time: 0.6763548851013184
194     7.594919e+00     2.468166e-02
* time: 0.6788008213043213
195     7.594913e+00     2.772726e-02
* time: 0.6813747882843018
196     7.594889e+00     2.146895e-02
* time: 0.6839478015899658
197     7.594863e+00     2.730361e-02
* time: 0.6865818500518799
198     7.594765e+00     1.701501e-02
* time: 0.6899259090423584
199     7.594754e+00     2.343203e-02
* time: 0.6924128532409668
200     7.594737e+00     3.746665e-02
* time: 0.6950387954711914
201     7.594644e+00     2.529188e-02
* time: 0.6974599361419678
202     7.594544e+00     1.955139e-02
* time: 0.7008159160614014
203     7.594526e+00     1.874374e-02
* time: 0.7034108638763428
204     7.594488e+00     1.694141e-02
* time: 0.7058849334716797
205     7.594449e+00     2.442378e-02
* time: 0.7083139419555664
206     7.594391e+00     1.454128e-02
* time: 0.711662769317627
207     7.594372e+00     1.895088e-02
* time: 0.7140798568725586
208     7.594332e+00     1.555393e-02
* time: 0.7171669006347656
209     7.594293e+00     1.901975e-02
* time: 0.7196347713470459
210     7.594238e+00     1.131925e-02
* time: 0.7228307723999023
211     7.594235e+00     3.536011e-02
* time: 0.7251858711242676
212     7.594188e+00     2.253183e-02
* time: 0.7281348705291748
213     7.594130e+00     1.987868e-02
* time: 0.7307047843933105
214     7.594082e+00     2.665462e-02
* time: 0.7333259582519531
215     7.594076e+00     2.656760e-02
* time: 0.7359127998352051
216     7.594027e+00     1.936305e-02
* time: 0.7383430004119873
217     7.594005e+00     2.480574e-02
* time: 0.7409279346466064
218     7.593953e+00     2.252069e-02
* time: 0.7433679103851318
219     7.593897e+00     2.050910e-02
* time: 0.7458188533782959
220     7.593827e+00     2.734979e-02
* time: 0.7483639717102051
221     7.593757e+00     2.226880e-02
* time: 0.7516357898712158
222     7.593669e+00     1.506634e-02
* time: 0.7547898292541504
223     7.593608e+00     1.328277e-02
* time: 0.7571549415588379
224     7.593564e+00     1.316807e-02
* time: 0.7595698833465576
225     7.593546e+00     2.496415e-02
* time: 0.7622778415679932
226     7.593500e+00     1.520001e-02
* time: 0.7656300067901611
227     7.593473e+00     2.605241e-02
* time: 0.7772548198699951
228     7.593384e+00     2.246848e-02
* time: 0.7804567813873291
229     7.593352e+00     2.616741e-02
* time: 0.7830219268798828
230     7.593337e+00     2.864554e-02
* time: 0.7853248119354248
231     7.593269e+00     1.990963e-02
* time: 0.7886068820953369
232     7.593237e+00     1.898553e-02
* time: 0.7918248176574707
233     7.593203e+00     1.460558e-02
* time: 0.7951548099517822
234     7.593129e+00     1.435555e-02
* time: 0.7978308200836182
235     7.593102e+00     1.951166e-02
* time: 0.800346851348877
236     7.593063e+00     1.322142e-02
* time: 0.8029718399047852
237     7.593001e+00     1.416707e-02
* time: 0.8054089546203613
238     7.592965e+00     2.218428e-02
* time: 0.8079299926757812
239     7.592942e+00     1.923089e-02
* time: 0.8104817867279053
240     7.592916e+00     2.079912e-02
* time: 0.8131678104400635
241     7.592869e+00     9.805682e-03
* time: 0.8162808418273926
242     7.592848e+00     1.981839e-02
* time: 0.8186089992523193
243     7.592814e+00     1.489162e-02
* time: 0.8217148780822754
244     7.592795e+00     1.490983e-02
* time: 0.8241989612579346
245     7.592785e+00     1.626049e-02
* time: 0.8268008232116699
246     7.592754e+00     9.752971e-03
* time: 0.8299667835235596
247     7.592731e+00     1.180202e-02
* time: 0.8326098918914795
248     7.592712e+00     1.121823e-02
* time: 0.8351578712463379
249     7.592698e+00     1.260765e-02
* time: 0.8376598358154297
250     7.592690e+00     1.513517e-02
* time: 0.8402888774871826
251     7.592687e+00     1.351365e-02
* time: 0.8430249691009521
252     7.592666e+00     8.551384e-03
* time: 0.8456358909606934
253     7.592652e+00     1.686142e-02
* time: 0.84822678565979
254     7.592636e+00     1.267012e-02
* time: 0.8514058589935303
255     7.592617e+00     9.786229e-03
* time: 0.8548238277435303
256     7.592603e+00     7.931017e-03
* time: 0.858083963394165
257     7.592591e+00     1.229219e-02
* time: 0.860602855682373
258     7.592577e+00     6.796671e-03
* time: 0.8632488250732422
259     7.592576e+00     9.343390e-03
* time: 0.8657398223876953
260     7.592565e+00     7.824296e-03
* time: 0.8688910007476807
261     7.592560e+00     1.142490e-02
* time: 0.8716399669647217
262     7.592548e+00     9.157460e-03
* time: 0.875018835067749
263     7.592543e+00     1.340009e-02
* time: 0.8865737915039062
264     7.592523e+00     6.841634e-03
* time: 0.8891348838806152
265     7.592513e+00     5.221147e-03
* time: 0.891610860824585
266     7.592504e+00     7.088835e-03
* time: 0.894157886505127
267     7.592488e+00     6.182064e-03
* time: 0.8966028690338135
268     7.592479e+00     4.713031e-03
* time: 0.8997588157653809
269     7.592470e+00     7.536784e-03
* time: 0.9023418426513672
270     7.592461e+00     5.231406e-03
* time: 0.9057228565216064
271     7.592454e+00     7.192080e-03
* time: 0.9081449508666992
272     7.592446e+00     4.140670e-03
* time: 0.9112060070037842
273     7.592438e+00     3.600858e-03
* time: 0.9137539863586426
274     7.592436e+00     1.052354e-02
* time: 0.9161958694458008
275     7.592436e+00     1.198767e-02
* time: 0.9188249111175537
276     7.592427e+00     8.700869e-03
* time: 0.9213368892669678
277     7.592416e+00     4.473528e-03
* time: 0.9248099327087402
278     7.592412e+00     8.534495e-03
* time: 0.9275779724121094
279     7.592404e+00     7.526134e-03
* time: 0.9303128719329834
280     7.592395e+00     5.093154e-03
* time: 0.9330518245697021
281     7.592392e+00     6.235660e-03
* time: 0.9358479976654053
282     7.592386e+00     3.727131e-03
* time: 0.9385569095611572
283     7.592382e+00     5.605892e-03
* time: 0.9413278102874756
284     7.592376e+00     4.651668e-03
* time: 0.9440457820892334
285     7.592376e+00     8.162461e-03
* time: 0.9466519355773926
286     7.592373e+00     6.275861e-03
* time: 0.9500339031219482
287     7.592369e+00     4.804376e-03
* time: 0.9525549411773682
288     7.592366e+00     5.786316e-03
* time: 0.9553179740905762
289     7.592362e+00     3.915151e-03
* time: 0.9585859775543213
290     7.592361e+00     5.634307e-03
* time: 0.9611508846282959
291     7.592360e+00     6.211663e-03
* time: 0.9637429714202881
292     7.592359e+00     4.800895e-03
* time: 0.9663670063018799
293     7.592357e+00     4.770276e-03
* time: 0.9690608978271484
294     7.592354e+00     5.638350e-03
* time: 0.9718098640441895
295     7.592350e+00     4.915538e-03
* time: 0.9744629859924316
296     7.592346e+00     1.849816e-03
* time: 0.9778599739074707
297     7.592344e+00     2.754115e-03
* time: 0.9806079864501953
298     7.592342e+00     2.449487e-03
* time: 0.9841129779815674
299     7.592341e+00     2.950127e-03
* time: 0.9868228435516357
300     7.592341e+00     3.846278e-03
* time: 0.9985628128051758
301     7.592341e+00     4.028598e-03
* time: 1.0012669563293457
302     7.592339e+00     2.635743e-03
* time: 1.0047459602355957
303     7.592339e+00     2.552064e-03
* time: 1.0075929164886475
304     7.592338e+00     2.793417e-03
* time: 1.0102519989013672
305     7.592337e+00     2.849134e-03
* time: 1.013098955154419
306     7.592336e+00     1.854823e-03
* time: 1.0158967971801758
307     7.592336e+00     3.314985e-03
* time: 1.0185039043426514
308     7.592334e+00     2.661619e-03
* time: 1.021054983139038
309     7.592334e+00     2.680790e-03
* time: 1.0237388610839844
310     7.592333e+00     1.738584e-03
* time: 1.0272438526153564
311     7.592332e+00     2.445682e-03
* time: 1.0307888984680176
312     7.592331e+00     1.242644e-03
* time: 1.0340969562530518
313     7.592331e+00     2.125968e-03
* time: 1.0369298458099365
314     7.592331e+00     3.130519e-03
* time: 1.039517879486084
315     7.592330e+00     3.233080e-03
* time: 1.0421009063720703
316     7.592329e+00     1.753850e-03
* time: 1.0456249713897705
317     7.592329e+00     3.167646e-03
* time: 1.048125982284546
318     7.592328e+00     2.063645e-03
* time: 1.0512619018554688
319     7.592327e+00     4.163326e-03
* time: 1.0536909103393555
320     7.592326e+00     1.563029e-03
* time: 1.0570249557495117
321     7.592325e+00     1.379533e-03
* time: 1.059647798538208
322     7.592324e+00     1.410176e-03
* time: 1.0622048377990723
323     7.592323e+00     1.823771e-03
* time: 1.0647389888763428
324     7.592323e+00     1.177161e-03
* time: 1.0681838989257812
325     7.592323e+00     1.179922e-03
* time: 1.071307897567749
326     7.592322e+00     1.131004e-03
* time: 1.0745949745178223
327     7.592322e+00     1.506670e-03
* time: 1.0772638320922852
328     7.592322e+00     1.628216e-03
* time: 1.0798778533935547
329     7.592321e+00     1.226743e-03
* time: 1.0823447704315186
330     7.592321e+00     1.948119e-03
* time: 1.0849289894104004
331     7.592320e+00     8.252834e-04
* time: 1.0881879329681396
332     7.592320e+00     1.053235e-03
* time: 1.090885877609253
333     7.592320e+00     1.675472e-03
* time: 1.093505859375
334     7.592319e+00     1.494136e-03
* time: 1.0962698459625244
335     7.592319e+00     1.239507e-03
* time: 1.0989139080047607
336     7.592319e+00     1.263796e-03
* time: 1.110588788986206
337     7.592319e+00     9.315878e-04
* time: 1.1137518882751465
338     7.592318e+00     1.999311e-03
* time: 1.1164758205413818
339     7.592318e+00     1.731856e-03
* time: 1.119088888168335
340     7.592318e+00     1.039321e-03
* time: 1.1217539310455322
341     7.592318e+00     1.059967e-03
* time: 1.124443769454956
342     7.592318e+00     9.378579e-04
* time: 1.1270689964294434
343     7.592318e+00     1.264153e-03
* time: 1.1295549869537354
344     7.592317e+00     1.017209e-03
* time: 1.1326768398284912
345     7.592317e+00     6.572608e-04
* time: 1.13588285446167
346     7.592317e+00     1.073410e-03
* time: 1.1385948657989502
347     7.592317e+00     5.553025e-04
* time: 1.1416068077087402
348     7.592316e+00     1.065493e-03
* time: 1.1441400051116943
349     7.592316e+00     1.075461e-03
* time: 1.147411823272705
350     7.592316e+00     1.936420e-03
* time: 1.149871826171875
351     7.592316e+00     1.122269e-03
* time: 1.1523699760437012
352     7.592316e+00     1.321804e-03
* time: 1.1549139022827148
353     7.592316e+00     8.935921e-04
* time: 1.157627820968628
354     7.592315e+00     9.556845e-04
* time: 1.1602609157562256
355     7.592315e+00     2.613717e-03
* time: 1.1629199981689453
356     7.592315e+00     2.332139e-03
* time: 1.1653738021850586
357     7.592315e+00     1.754591e-03
* time: 1.1680188179016113
358     7.592314e+00     1.695540e-03
* time: 1.1707777976989746
359     7.592314e+00     1.502039e-03
* time: 1.1735317707061768
360     7.592313e+00     1.903984e-03
* time: 1.1762847900390625
361     7.592313e+00     1.678619e-03
* time: 1.1795809268951416
362     7.592313e+00     1.841403e-03
* time: 1.181933879852295
363     7.592313e+00     1.461709e-03
* time: 1.1845879554748535
364     7.592313e+00     1.102954e-03
* time: 1.187351942062378
365     7.592313e+00     1.157727e-03
* time: 1.189842939376831
366     7.592312e+00     2.223984e-03
* time: 1.1922698020935059
367     7.592312e+00     1.822452e-03
* time: 1.1953258514404297
368     7.592312e+00     1.197294e-03
* time: 1.1984808444976807
369     7.592311e+00     1.309286e-03
* time: 1.2011008262634277
370     7.592311e+00     1.029848e-03
* time: 1.2035529613494873
371     7.592311e+00     1.447842e-03
* time: 1.2059669494628906
372     7.592311e+00     1.486943e-03
* time: 1.2175369262695312
373     7.592311e+00     2.519090e-03
* time: 1.2201528549194336
374     7.592311e+00     1.594672e-03
* time: 1.2227997779846191
375     7.592311e+00     1.699910e-03
* time: 1.225334882736206
376     7.592311e+00     2.036032e-03
* time: 1.2278988361358643
377     7.592311e+00     1.506573e-03
* time: 1.2304458618164062
378     7.592310e+00     1.321277e-03
* time: 1.2330098152160645
379     7.592310e+00     1.407925e-03
* time: 1.2354199886322021
380     7.592310e+00     1.438663e-03
* time: 1.2379930019378662
381     7.592310e+00     1.232574e-03
* time: 1.2404558658599854
382     7.592310e+00     1.415276e-03
* time: 1.242891788482666
383     7.592310e+00     8.134965e-04
* time: 1.2458958625793457
384     7.592310e+00     1.016345e-03
* time: 1.2491378784179688
385     7.592310e+00     1.064748e-03
* time: 1.2516529560089111
386     7.592310e+00     1.154886e-03
* time: 1.2541120052337646
387     7.592310e+00     1.313267e-03
* time: 1.2566189765930176
388     7.592309e+00     7.302549e-04
* time: 1.2598509788513184
389     7.592309e+00     5.461278e-04
* time: 1.2631068229675293
390     7.592309e+00     8.340493e-04
* time: 1.2654688358306885
391     7.592309e+00     9.832412e-04
* time: 1.2679460048675537
392     7.592309e+00     8.204434e-04
* time: 1.2702598571777344
393     7.592309e+00     6.442766e-04
* time: 1.2725639343261719
394     7.592309e+00     4.839952e-04
* time: 1.274810791015625
395     7.592309e+00     8.464539e-04
* time: 1.2772698402404785
396     7.592309e+00     6.082938e-04
* time: 1.2806158065795898
397     7.592309e+00     4.664214e-04
* time: 1.2837419509887695
398     7.592309e+00     2.662652e-04
* time: 1.286991834640503
399     7.592308e+00     3.458169e-04
* time: 1.2895159721374512
400     7.592308e+00     4.863763e-04
* time: 1.2918648719787598
401     7.592308e+00     1.117760e-03
* time: 1.2943367958068848
402     7.592308e+00     8.617900e-04
* time: 1.297494888305664
403     7.592308e+00     1.024279e-03
* time: 1.3000028133392334
404     7.592308e+00     9.874215e-04
* time: 1.302428960800171
405     7.592308e+00     5.817627e-04
* time: 1.3048739433288574
406     7.592308e+00     6.055964e-04
* time: 1.307271957397461
407     7.592308e+00     1.053149e-03
* time: 1.3099019527435303
408     7.592308e+00     9.368486e-04
* time: 1.3125758171081543
409     7.592308e+00     9.873287e-04
* time: 1.3244388103485107
410     7.592308e+00     6.935671e-04
* time: 1.3271098136901855
411     7.592308e+00     4.952730e-04
* time: 1.3302278518676758
412     7.592308e+00     4.143542e-04
* time: 1.3332099914550781
413     7.592308e+00     6.334586e-04
* time: 1.335615873336792
414     7.592307e+00     4.259338e-04
* time: 1.338864803314209
415     7.592307e+00     2.816649e-04
* time: 1.342073917388916
416     7.592307e+00     4.685299e-04
* time: 1.34452486038208
417     7.592307e+00     3.837354e-04
* time: 1.3470900058746338
418     7.592307e+00     3.429392e-04
* time: 1.3502509593963623
419     7.592307e+00     5.737475e-04
* time: 1.3526318073272705
420     7.592307e+00     8.320658e-04
* time: 1.3550279140472412
421     7.592307e+00     3.334717e-04
* time: 1.3576560020446777
422     7.592307e+00     3.583135e-04
* time: 1.360205888748169
423     7.592307e+00     3.975628e-04
* time: 1.3626768589019775
424     7.592307e+00     4.230307e-04
* time: 1.3650238513946533
425     7.592307e+00     2.494954e-04
* time: 1.3680667877197266
426     7.592307e+00     3.822805e-04
* time: 1.3704619407653809
427     7.592307e+00     3.418602e-04
* time: 1.373870849609375
428     7.592307e+00     2.926039e-04
* time: 1.3762707710266113
429     7.592307e+00     3.205836e-04
* time: 1.37892484664917
430     7.592307e+00     3.545470e-04
* time: 1.3820250034332275
431     7.592307e+00     3.420934e-04
* time: 1.385105848312378
432     7.592307e+00     2.729333e-04
* time: 1.3883519172668457
433     7.592307e+00     4.165962e-04
* time: 1.3907558917999268
434     7.592307e+00     4.880829e-04
* time: 1.393035888671875
435     7.592307e+00     2.975666e-04
* time: 1.396101951599121
436     7.592307e+00     2.641004e-04
* time: 1.398535966873169
437     7.592307e+00     3.704279e-04
* time: 1.4016509056091309
438     7.592307e+00     2.991355e-04
* time: 1.4044098854064941
439     7.592307e+00     5.690144e-04
* time: 1.4070768356323242
440     7.592307e+00     3.214750e-04
* time: 1.4104089736938477
441     7.592307e+00     3.809355e-04
* time: 1.4127638339996338
442     7.592307e+00     6.306832e-04
* time: 1.4150347709655762
443     7.592307e+00     4.370237e-04
* time: 1.417320966720581
444     7.592307e+00     4.345237e-04
* time: 1.42972993850708
445     7.592306e+00     2.828413e-04
* time: 1.432785987854004
446     7.592306e+00     4.009328e-04
* time: 1.4354569911956787
447     7.592306e+00     4.837373e-04
* time: 1.4381518363952637
448     7.592306e+00     3.873067e-04
* time: 1.4407658576965332
449     7.592306e+00     5.792502e-04
* time: 1.4430639743804932
450     7.592306e+00     7.636628e-04
* time: 1.4453668594360352
451     7.592306e+00     7.816296e-04
* time: 1.4475159645080566
452     7.592306e+00     6.046736e-04
* time: 1.450138807296753
453     7.592306e+00     9.082536e-04
* time: 1.4525728225708008
454     7.592306e+00     5.546273e-04
* time: 1.4548499584197998
455     7.592306e+00     6.379962e-04
* time: 1.4572029113769531
456     7.592306e+00     7.595961e-04
* time: 1.4596748352050781
457     7.592306e+00     4.899307e-04
* time: 1.4626529216766357
458     7.592306e+00     4.263258e-04
* time: 1.465782880783081
459     7.592306e+00     5.581667e-04
* time: 1.4683539867401123
460     7.592306e+00     5.022827e-04
* time: 1.471620798110962
461     7.592306e+00     4.518564e-04
* time: 1.4745798110961914
462     7.592306e+00     6.865463e-04
* time: 1.476874828338623
463     7.592306e+00     6.710867e-04
* time: 1.4790408611297607
464     7.592306e+00     7.032508e-04
* time: 1.4815638065338135
465     7.592306e+00     5.384508e-04
* time: 1.4836368560791016
466     7.592306e+00     6.588171e-04
* time: 1.4857559204101562
467     7.592306e+00     2.730252e-04
* time: 1.4886119365692139
468     7.592306e+00     3.731566e-04
* time: 1.4909389019012451
469     7.592306e+00     6.765148e-04
* time: 1.493170976638794
470     7.592306e+00     5.830241e-04
* time: 1.4955778121948242
471     7.592305e+00     4.486911e-04
* time: 1.4982588291168213
472     7.592305e+00     5.427240e-04
* time: 1.5009119510650635
473     7.592305e+00     8.853552e-04
* time: 1.503213882446289
474     7.592305e+00     7.112933e-04
* time: 1.5054869651794434
475     7.592305e+00     9.174949e-04
* time: 1.5077109336853027
476     7.592305e+00     7.470015e-04
* time: 1.510206937789917
477     7.592305e+00     5.235795e-04
* time: 1.5127739906311035
478     7.592305e+00     5.885167e-04
* time: 1.5151619911193848
479     7.592305e+00     9.677640e-04
* time: 1.517547845840454
480     7.592305e+00     8.560861e-04
* time: 1.5207409858703613
481     7.592305e+00     5.473018e-04
* time: 1.5327467918395996
482     7.592305e+00     5.821945e-04
* time: 1.5350158214569092
483     7.592305e+00     7.764054e-04
* time: 1.5373759269714355
484     7.592305e+00     5.628818e-04
* time: 1.5404648780822754
485     7.592305e+00     5.309357e-04
* time: 1.5436480045318604
486     7.592305e+00     6.010744e-04
* time: 1.546679973602295
487     7.592304e+00     3.622600e-04
* time: 1.5496327877044678
488     7.592304e+00     5.966884e-04
* time: 1.552196979522705
489     7.592304e+00     4.616022e-04
* time: 1.554508924484253
490     7.592304e+00     4.071990e-04
* time: 1.5567419528961182
491     7.592304e+00     3.548468e-04
* time: 1.5592777729034424
492     7.592304e+00     6.604265e-04
* time: 1.5619828701019287
493     7.592304e+00     4.782169e-04
* time: 1.5651459693908691
494     7.592304e+00     4.125490e-04
* time: 1.5683138370513916
495     7.592304e+00     6.303310e-04
* time: 1.5709598064422607
496     7.592304e+00     3.365423e-04
* time: 1.5741939544677734
497     7.592304e+00     3.745687e-04
* time: 1.5768258571624756
498     7.592304e+00     3.033580e-04
* time: 1.5800189971923828
499     7.592304e+00     2.435009e-04
* time: 1.583263874053955
500     7.592304e+00     4.336209e-04
* time: 1.58565092086792
501     7.592304e+00     3.557960e-04
* time: 1.5880749225616455
502     7.592304e+00     4.038429e-04
* time: 1.5907118320465088
503     7.592304e+00     4.138992e-04
* time: 1.5933640003204346
504     7.592304e+00     4.794434e-04
* time: 1.5958709716796875
505     7.592303e+00     6.520744e-04
* time: 1.5982568264007568
506     7.592303e+00     4.277159e-04
* time: 1.601477861404419
507     7.592303e+00     5.013607e-04
* time: 1.6038978099822998
508     7.592303e+00     6.881726e-04
* time: 1.6064717769622803
509     7.592303e+00     7.796738e-04
* time: 1.6089489459991455
510     7.592303e+00     5.106087e-04
* time: 1.612156867980957
511     7.592303e+00     5.256140e-04
* time: 1.615177869796753
512     7.592303e+00     3.669168e-04
* time: 1.6182208061218262
513     7.592303e+00     4.960626e-04
* time: 1.6207599639892578
514     7.592303e+00     5.361230e-04
* time: 1.6234209537506104
515     7.592303e+00     7.625916e-04
* time: 1.6258459091186523
516     7.592303e+00     4.451652e-04
* time: 1.63816499710083
517     7.592303e+00     4.559554e-04
* time: 1.6406447887420654
518     7.592303e+00     5.140653e-04
* time: 1.6432387828826904
519     7.592303e+00     7.357301e-04
* time: 1.645570993423462
520     7.592302e+00     3.227881e-04
* time: 1.6486477851867676
521     7.592302e+00     3.580358e-04
* time: 1.6511809825897217
522     7.592302e+00     6.331546e-04
* time: 1.6538128852844238
523     7.592302e+00     5.641945e-04
* time: 1.6563968658447266
524     7.592302e+00     3.642244e-04
* time: 1.6595408916473389
525     7.592302e+00     6.233789e-04
* time: 1.6621229648590088
526     7.592302e+00     5.610611e-04
* time: 1.6645338535308838
527     7.592302e+00     2.580268e-04
* time: 1.6669199466705322
528     7.592302e+00     4.516068e-04
* time: 1.6693668365478516
529     7.592302e+00     4.874450e-04
* time: 1.6718108654022217
530     7.592302e+00     3.421181e-04
* time: 1.674088954925537
531     7.592302e+00     3.340188e-04
* time: 1.6764709949493408
532     7.592302e+00     3.441384e-04
* time: 1.6788969039916992
533     7.592302e+00     3.002574e-04
* time: 1.6821978092193604
534     7.592302e+00     4.284654e-04
* time: 1.684863805770874
535     7.592302e+00     3.421393e-04
* time: 1.6874449253082275
536     7.592302e+00     6.056169e-04
* time: 1.6899127960205078
537     7.592302e+00     3.584120e-04
* time: 1.6932079792022705
538     7.592302e+00     3.320361e-04
* time: 1.6955819129943848
539     7.592302e+00     5.590616e-04
* time: 1.6978437900543213
540     7.592302e+00     3.251125e-04
* time: 1.7009758949279785
541     7.592302e+00     5.443723e-04
* time: 1.7034919261932373
542     7.592302e+00     3.154704e-04
* time: 1.7064669132232666
543     7.592302e+00     4.647965e-04
* time: 1.7087857723236084
544     7.592302e+00     5.472226e-04
* time: 1.711195945739746
545     7.592302e+00     4.643305e-04
* time: 1.7143428325653076
546     7.592302e+00     5.706129e-04
* time: 1.7170178890228271
547     7.592302e+00     4.326270e-04
* time: 1.7201778888702393
548     7.592302e+00     5.661495e-04
* time: 1.7227578163146973
549     7.592302e+00     5.275718e-04
* time: 1.725205898284912
550     7.592302e+00     5.883946e-04
* time: 1.727477788925171
551     7.592302e+00     5.834204e-04
* time: 1.7298529148101807
552     7.592302e+00     6.975595e-04
* time: 1.7326579093933105
553     7.592302e+00     5.353581e-04
* time: 1.7443978786468506
554     7.592302e+00     3.996571e-04
* time: 1.747567892074585
555     7.592302e+00     4.382076e-04
* time: 1.7500529289245605
556     7.592302e+00     6.796417e-04
* time: 1.7525858879089355
557     7.592302e+00     4.547090e-04
* time: 1.755741834640503
558     7.592301e+00     2.853777e-04
* time: 1.7581079006195068
559     7.592301e+00     3.611581e-04
* time: 1.760462999343872
560     7.592301e+00     5.295812e-04
* time: 1.7630829811096191
561     7.592301e+00     3.256891e-04
* time: 1.7661488056182861
562     7.592301e+00     4.329877e-04
* time: 1.7689778804779053
563     7.592301e+00     7.653774e-04
* time: 1.7712857723236084
564     7.592301e+00     5.859349e-04
* time: 1.7737979888916016
565     7.592301e+00     5.248306e-04
* time: 1.776181936264038
566     7.592301e+00     4.807983e-04
* time: 1.7788469791412354
567     7.592301e+00     3.380190e-04
* time: 1.7813889980316162
568     7.592301e+00     4.704763e-04
* time: 1.7839908599853516
569     7.592301e+00     5.645478e-04
* time: 1.7864508628845215
570     7.592301e+00     4.023313e-04
* time: 1.7888169288635254
571     7.592301e+00     3.615251e-04
* time: 1.791260004043579
572     7.592301e+00     3.375503e-04
* time: 1.7938590049743652
573     7.592301e+00     5.170033e-04
* time: 1.796217918395996
574     7.592301e+00     3.685198e-04
* time: 1.7991089820861816
575     7.592301e+00     2.927069e-04
* time: 1.8022339344024658
576     7.592301e+00     5.387997e-04
* time: 1.804722785949707
577     7.592301e+00     3.434530e-04
* time: 1.8078007698059082
578     7.592301e+00     3.807300e-04
* time: 1.8104639053344727
579     7.592301e+00     5.843065e-04
* time: 1.8129518032073975
580     7.592301e+00     6.015453e-04
* time: 1.8153479099273682
581     7.592301e+00     6.338658e-04
* time: 1.817662000656128
582     7.592301e+00     4.101868e-04
* time: 1.8199667930603027
583     7.592301e+00     5.038364e-04
* time: 1.8223748207092285
584     7.592301e+00     3.430156e-04
* time: 1.8257558345794678
585     7.592301e+00     5.986699e-04
* time: 1.8282208442687988
586     7.592301e+00     5.430883e-04
* time: 1.8306138515472412
587     7.592301e+00     3.311195e-04
* time: 1.8338627815246582
588     7.592301e+00     5.939975e-04
* time: 1.83632493019104
589     7.592301e+00     3.313858e-04
* time: 1.8484618663787842
590     7.592301e+00     4.015924e-04
* time: 1.8515279293060303
591     7.592300e+00     2.345263e-04
* time: 1.8546128273010254
592     7.592300e+00     6.640379e-04
* time: 1.857226848602295
593     7.592300e+00     4.032662e-04
* time: 1.8597359657287598
594     7.592300e+00     2.939071e-04
* time: 1.8621389865875244
595     7.592300e+00     3.146926e-04
* time: 1.8647658824920654
596     7.592300e+00     4.159135e-04
* time: 1.8671848773956299
597     7.592300e+00     2.947005e-04
* time: 1.8700928688049316
598     7.592300e+00     3.040398e-04
* time: 1.8733928203582764
599     7.592300e+00     2.007122e-04
* time: 1.8765559196472168

Out[5]: