-
Notifications
You must be signed in to change notification settings - Fork 0
/
AtomSensor.py
2199 lines (1790 loc) · 111 KB
/
AtomSensor.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
from pylab import *
from scipy.integrate import odeint
import time as tmstamp
import numpy as np
import pandas as pd
import sys
from copy import copy, deepcopy
import itertools
class FundamentalPhysicalConstants(object):
""" definion for Fundamental Physical Constants per (2006 CODATA recommended values:
P. J. Mohr, B. N. Taylor, and D. B. Newell, “The 2006 CODATA Recommended Values of the Fundamental
Physical Constants, Web Version 5.1,” available at http://physics.nist.gov/constants
(National Institute of Standards and Technology, Gaithersburg, MD 20899, 31 December 2007).)
"""
def __init__(self):
# general format: self.constant = dict(Value = , Units=' ' , Name = ' ')
self.c = dict(Value = 2.99792458e8, Units='m/s', Name = 'Speed of Light')
self.mu0 = dict(Value = 4*np.pi * 1.0e-7, Units=' N/A^2 ' , Name = ' Permeability of Vacuum ')
self.epsilon0 = dict(Value = 8.854187817e-12, Units=' F/m ' , Name = ' Permittivity of Vacuum ')
self.h = dict(Value = 6.62606896e-34, Units=' J*s ' , Name = ' Planck’s Constant ')
self.hbar = dict(Value = self.h['Value'], Units= self.h['Units'], Name = self.h['Name'])
self.u = dict(Value = 1.660538782e-27 , Units=' kg ' , Name = ' Atomic Mass Unit ')
self.kB = dict(Value = 1.3806504e-23, Units=' J/K ' , Name = ' Boltzmann’s Constant ')
class AtomicElement(object):
def __init__(self, Name = 'Rubidium', Mass= (1.443160648e-25, 'kg'), AtomicNumber = 37,
NuclearSpin = '3/2', TotalNucleons = 87, RelativeNaturalAbundance = 0.2783,
D2LineWaveLength =(780.241209686, 'nm'), RecoilVelocity = (5.8845, 'mm/s'),
RecoilFrequency_Omegar = (2*pi*3.7710, 'kHz') ):
self.Name = Name
self.Mass = Mass
self.AtomicNumber = AtomicNumber
self.NuclearSpin = NuclearSpin
self.TotalNucleons = TotalNucleons
self.RelativeNaturalAbundance = RelativeNaturalAbundance
self.D2LineWaveLength = D2LineWaveLength
self.RecoilVelocity = RecoilVelocity
self.RecoilFrequency_Omegar = RecoilFrequency_Omegar
self.TwoPhotonWaveVector_keff = (2.0 * 2.0 * pi / self.D2LineWaveLength[0] * 1.0e9, 'm^-1')
class CommonElementList(object):
Rb87 = AtomicElement()
Cs133 = AtomicElement(Name='Cesium', Mass = (2.20694650e-25, 'kg'), AtomicNumber = 55, NuclearSpin= '7/2',
TotalNucleons = 133, RelativeNaturalAbundance = 1.0,
D2LineWaveLength =(852.347, 'nm'), RecoilVelocity = (3.5225, 'mm/s'),
RecoilFrequency_Omegar = (2*pi*2.0663, 'kHz') )
Na23 = AtomicElement(Name='Cesium', Mass = (2.20694650e-25, 'kg'), AtomicNumber = 55, NuclearSpin= '7/2',
TotalNucleons = 133, RelativeNaturalAbundance = 1.0,
D2LineWaveLength =(852.347, 'nm'), RecoilVelocity = (3.5225, 'mm/s'),
RecoilFrequency_Omegar = (2*pi*2.0663, 'kHz') )
K39 = AtomicElement(Name='Cesium', Mass = (2.20694650e-25, 'kg'), AtomicNumber = 55, NuclearSpin= '7/2',
TotalNucleons = 133, RelativeNaturalAbundance = 1.0,
D2LineWaveLength =(852.347, 'nm'), RecoilVelocity = (3.5225, 'mm/s'),
RecoilFrequency_Omegar = (2*pi*2.0663, 'kHz') )
Li = AtomicElement(Name='Cesium', Mass = (2.20694650e-25, 'kg'), AtomicNumber = 55, NuclearSpin= '7/2',
TotalNucleons = 133, RelativeNaturalAbundance = 1.0,
D2LineWaveLength =(852.347, 'nm'), RecoilVelocity = (3.5225, 'mm/s'),
RecoilFrequency_Omegar = (2*pi*2.0663, 'kHz') )
Fr = AtomicElement(Name='Cesium', Mass = (2.20694650e-25, 'kg'), AtomicNumber = 55, NuclearSpin= '7/2',
TotalNucleons = 133, RelativeNaturalAbundance = 1.0,
D2LineWaveLength =(852.347, 'nm'), RecoilVelocity = (3.5225, 'mm/s'),
RecoilFrequency_Omegar = (2*pi*2.0663, 'kHz') )
class NumberMismatchingException(Exception):
"""Generating NumberMismathingException
Application example:
source:
raise NumberMismatchingException(message ='\nError: Invalid internal state initialization:
number of internal states do not match the number of internal state name definition.')
tryandcatch:
try:
newstates= QuantumAtomicInternalStates(ProbAmps = np.array([1.0+0j, 0.0+0j, 0.0]), Names = ['|1>','|2>', '|3>'])
except NumberMismatchingException, e:
print e.message
"""
def __init__(self, value =-1, message='Number mistaching is found!'):
self.value = value
print message
def __str__(self):
return self.value
class GeneralQuantumStates(object):
"""include NumberMismathingException
Application example:
try:
newstates= GeneralQuantumStates(ProbAmps = np.array([1.0+0j, 0.0+0j, 1.0]), Names = ['|1>','|2>', '|3>'])
except NumberMismatchingException, e:
print e.message
"""
def __init__(self, ProbAmps = np.array([1.0+0j, 0.0+1.0j]), Names = ['|1>','|2>'], EigenValues = np.array([0.0, 0.0])):
if len(ProbAmps) != len(Names) or len(Names) != len(EigenValues) :
raise NumberMismatchingException(message ='\nError: Invalid internal state initialization: number of internal states do not match the number of internal state name definition.')
self.StatesAmplitude = pd.Series(ProbAmps, index = Names, name='ProbabilityAmplitudes')
self.EigenValues = pd.Series(EigenValues, index = Names, name='EigenValues')
self.TotalProbability()
pass
def TotalProbability(self):
self.TotalProbability = np.linalg.norm(self.States.values)**2
def Normalization(self):
SqRootTotalProbability = np.linalg.norm(self.States.values)
normlizationfunction = lambda x: x/SqRootTotalProbability
self.States = pd.DataFrame(self.States.map(normlizationfunction))
self.TotalProbability = 1.0
return self.States
def Normalize(self, InputStates):
# better add a type judgement and error exception if the type is not pandas.Seriers type
# this function is supposed to return a normalized state probability amplitude
pass
def GenerateArbitraryNumberOfStates(self):
"""input integer indices for the internal states and then probability amplitudes"""
pass
class QuantumAtomicInternalStates(object):
"""include NumberMismathingException
Application example:
try:
newstates= QuantumAtomicInternalStates(ProbAmps = np.array([1.0+0j, 0.0+0j, 1.0]), Names = ['|1>','|2>', '|3>'])
except NumberMismatchingException, e:
print e.message
"""
def __init__(self, ProbAmps = np.array([1.0+0j, 0.0+1.0j]), Names = ['|1>','|2>']):
if len(ProbAmps) != len(Names):
raise NumberMismatchingException(message ='\nError: Invalid internal state initialization: number of internal states do not match the number of internal state name definition.')
self.States = pd.Series(ProbAmps, index = Names, name='Probability Amplitudes')
self.TotalProbability()
pass
def TotalProbability(self):
self.TotalProbability = np.linalg.norm(self.States.values)**2
def Normalization(self):
SqRootTotalProbability = np.linalg.norm(self.States.values)
normlizationfunction = lambda x: x/SqRootTotalProbability
self.States = pd.DataFrame(self.States.map(normlizationfunction))
self.TotalProbability = 1.0
return self.States
def Normalize(self, InputStates):
# better add a type judgement and error exception if the type is not pandas.Seriers type
# this function is supposed to return a normalized state probability amplitude
pass
def GenerateAtomicInternalStates(self):
"""input integer indices for the internal states and then probability amplitudes"""
pass
class Velocity(object):
def __init__(self, vec_v = np.array([0.0, 0.0, 0.0]) ):
self._x, self._y, self._z = vec_v
self._vec = vec_v
@property
def x(self):
return self._x
@x.setter
def x(self, value):
self._x = value
#self._r = np.array([value, self._y, self._z])
self._vec[0] =self._x
@property
def y(self):
return self._y
@y.setter
def y(self, value):
self._vec[1] = value
self._y = value
@property
def z(self):
return self._z
@z.setter
def z(self, value):
self._vec[2] = value
self._z = value
@property
def vec(self):
return self._vec
@vec.setter
def vec(self, value):
self._vec = value
self._x = value[0]
self._y = value[1]
self._z = value[2]
class SpatialCoordinates(object):
def __init__(self, vec_r = np.array([0.0, 0.0, 0.0]) ):
self._x, self._y, self._z = vec_r
self._vec = vec_r
@property
def x(self):
return self._x
@x.setter
def x(self, value):
self._x = value
#self._r = np.array([value, self._y, self._z])
self._vec[0] =self._x
@property
def y(self):
return self._y
@y.setter
def y(self, value):
self._vec[1] = value
self._y = value
@property
def z(self):
return self._z
@z.setter
def z(self, value):
self._vec[2] = value
self._z = value
@property
def vec(self):
return self._vec
@vec.setter
def vec(self, value):
self._vec = value
self._x = value[0]
self._y = value[1]
self._z = value[2]
def UpdateDueTo(self, Velocity = Velocity(), timeduration=0.0):
self._vec = self._vec + Velocity.vec * timeduration
self._x, self._y, self._z = self._vec
class QuantumAtomicExternalMomentumStates(GeneralQuantumStates):
def __init__(self):
pass
class QuantumAtomicInter_ExternalCoupledStates(object):
"""include NumberMismathingException
Application example:
try:
newstates= GeneralQuantumStates(ProbAmps = np.array([1.0+0j, 0.0+0j, 1.0]), Names = ['|1>','|2>', '|3>'])
except NumberMismatchingException, e:
print e.message
"""
def __init__(self,
Labels = list( ['|2,+3hbarkeff>','|1,+2hbarkeff>','|2, +1hbarkeff>','|1, 0hbarkeff>', '|2,-1hbarkeff>','|1,-2hbarkeff>','|2,-3hbarkeff>']),
StateValues = np.array([[1.0, 0.0, 1.0, 0.0, 1.0, 0.0, 1.0],
[9.0, 4.0, 1.0, 0.0, 1.0, 4.0, 9.0],
[3.0, 2.0, 1.0, 0.0, -1.0, -2.0, -3.0],
[0.0+0j, 0.0+0j, .0+0j, 1.0+0j, 0.0+0j, 0.0+0j, 0+0.0j]]),
Names=list(['Einternal', 'Ekinetic', 'Momentum', 'ProbAmp'])):
if StateValues.shape != (len(Names), len(Labels)) :
raise NumberMismatchingException(message ='\nError: Invalid state initialization: Dimension of labels do not match the number of states.')
self.States = pd.DataFrame(StateValues.T, index = Labels, columns= Names)
self.States[['Einternal', 'Ekinetic', 'Momentum']] = self.States[['Einternal', 'Ekinetic', 'Momentum']].astype('float64')
self.States[['Einternal', 'Ekinetic', 'Momentum', 'ProbAmp']] = self.States[['Einternal', 'Ekinetic', 'Momentum', 'ProbAmp']].astype('object')
self.GetTotalProbability()
self.StateVec = np.concatenate([StateValues[3,:].real, StateValues[3,:].imag])
self.StateDimension = len(Labels)
def InCaseOf2hbark(self):
Labels = list( ['|2, +1hbarkeff>','|1, 0hbarkeff>', '|2,-1hbarkeff>'])
StateValues = np.array([[1.0, 0.0, 1.0],
[1.0, 0.0, 1.0],
[1.0, 0.0, -1.0],
[0.0+0j, 1.0+0j, 0.0+0j]])
Names=list(['Einternal', 'Ekinetic', 'Momentum', 'ProbAmp'])
self.States = pd.DataFrame(StateValues.T, index = Labels, columns= Names)
self.States[['Einternal', 'Ekinetic', 'Momentum']] = self.States[['Einternal', 'Ekinetic', 'Momentum']].astype('float64')
self.States[['Einternal', 'Ekinetic', 'Momentum', 'ProbAmp']] = self.States[['Einternal', 'Ekinetic', 'Momentum', 'ProbAmp']].astype('object')
self.GetTotalProbability()
self.StateVec = np.concatenate([StateValues[3,:].real, StateValues[3,:].imag])
self.StateDimension = len(Labels)
def InCaseOf12hbark(self):
Labels = list( ['|1,+6hbarkeff>','|2, +5hbarkeff>','|1,+4hbarkeff>', '|2,+3hbarkeff>','|1,+2hbarkeff>','|2, +1hbarkeff>','|1, 0hbarkeff>', '|2,-1hbarkeff>','|1,-2hbarkeff>','|2,-3hbarkeff>'])
StateValues = np.array([[0.0, 1.0, 0.0, 1.0, 0.0, 1.0, 0.0, 1.0, 0.0, 1.0],
[36.0, 25.0, 16.0, 9.0, 4.0, 1.0, 0.0, 1.0, 4.0, 9.0],
[6.0, 5.0, 4.0, 3.0, 2.0, 1.0, 0.0, -1.0, -2.0, -3.0],
[0.0+0j, 0.0+0j, 0.0+0j, 0.0+0j, 0.0+0j, 0.0+0j, 1.0+0j, 0.0+0j, 0.0+0j, 0+0.0j]])
Names=list(['Einternal', 'Ekinetic', 'Momentum', 'ProbAmp'])
self.States = pd.DataFrame(StateValues.T, index = Labels, columns= Names)
self.States[['Einternal', 'Ekinetic', 'Momentum']] = self.States[['Einternal', 'Ekinetic', 'Momentum']].astype('float64')
self.States[['Einternal', 'Ekinetic', 'Momentum', 'ProbAmp']] = self.States[['Einternal', 'Ekinetic', 'Momentum', 'ProbAmp']].astype('object')
self.GetTotalProbability()
self.StateVec = np.concatenate([StateValues[3,:].real, StateValues[3,:].imag])
self.StateDimension = len(Labels)
def InCaseOf8hbark(self):
Labels = list( ['|1,+4hbarkeff>', '|2,+3hbarkeff>','|1,+2hbarkeff>','|2, +1hbarkeff>','|1, 0hbarkeff>', '|2,-1hbarkeff>','|1,-2hbarkeff>','|2,-3hbarkeff>'])
StateValues = np.array([[0.0, 1.0, 0.0, 1.0, 0.0, 1.0, 0.0, 1.0],
[16.0, 9.0, 4.0, 1.0, 0.0, 1.0, 4.0, 9.0],
[4.0, 3.0, 2.0, 1.0, 0.0, -1.0, -2.0, -3.0],
[0.0+0j, 0.0+0j, 0.0+0j, 0.0+0j, 1.0+0j, 0.0+0j, 0.0+0j, 0+0.0j]])
Names=list(['Einternal', 'Ekinetic', 'Momentum', 'ProbAmp'])
self.States = pd.DataFrame(StateValues.T, index = Labels, columns= Names)
self.States[['Einternal', 'Ekinetic', 'Momentum']] = self.States[['Einternal', 'Ekinetic', 'Momentum']].astype('float64')
self.States[['Einternal', 'Ekinetic', 'Momentum', 'ProbAmp']] = self.States[['Einternal', 'Ekinetic', 'Momentum', 'ProbAmp']].astype('object')
self.GetTotalProbability()
self.StateVec = np.concatenate([StateValues[3,:].real, StateValues[3,:].imag])
self.StateDimension = len(Labels)
def GetTotalProbability(self):
self.TotalProbability = np.abs(np.linalg.norm(self.States['ProbAmp'].values)**2)
return self.TotalProbability
def ProbNormalization(self):
SqRootTotalProbability = np.sqrt(self.GetTotalProbability())
normlizationfunction = lambda x: x/SqRootTotalProbability
self.States[['ProbAmp']] = normlizationfunction(self.States[['ProbAmp']])
self.TotalProbability = 1.0
return self.States
def Normalize(self, InputStates):
# better add a type judgement and error exception if the type is not pandas.Seriers type
# this function is supposed to return a normalized state probability amplitude
pass
def GenerateArbitraryNumberOfStates(self):
"""input integer indices for the internal states and then probability amplitudes"""
pass
def ComplexVecConvertedFromStateVec(self, InputStateVec):
ComplexVec= InputStateVec[0:(len(InputStateVec)/2)]+1.0j*InputStateVec[(len(InputStateVec)/2):len(InputStateVec)]
return ComplexVec
def StateVecConvertedFromComplexVec(self, ComplexVec):
StateVec = np.array(list(ComplexVec.real) + list(ComplexVec.imag))
return StateVec
class SingleAtom(object):
def __init__(self, Time=0.0, QuatumStates=QuantumAtomicInter_ExternalCoupledStates(),
Position = SpatialCoordinates(),
Velocity = Velocity(),
R0 = SpatialCoordinates(),
V0 = Velocity(),
AtomDefinition=CommonElementList().Rb87):
# THSE: add R0 and V0
self.FPC = FundamentalPhysicalConstants()
self.Time = Time
self.Definition = AtomDefinition
self.Quantum = QuatumStates
self.Position = Position
self.Velocity = Velocity
self.R0 = R0 # THSE: add initial offset, assuming already normalized by length unit
self.V0 = V0 # THSE: add initial offset, assuming already normalized by velocity unit
self.units =['mass', 'velocity', 'position']
#univeral units in this calculation
self.LengthUnit = (2.0 / self.Definition.TwoPhotonWaveVector_keff[0], 'm')
self.KeffUnit = (self.Definition.TwoPhotonWaveVector_keff[0], 'm^-1')
self.TimeUnit = (1.0/ (4.0 * self.Definition.RecoilFrequency_Omegar[0] *10**3), 's')
self.AngularFrequencyUnit = (4 * self.Definition.RecoilFrequency_Omegar[0] *10**3, 's^-1')
self.EnergyUnit = (self.FPC.hbar['Value'] * 4 * self.Definition.RecoilFrequency_Omegar[0]*1.0e3, 'J*s*Hz')
#some convenient units derived from the above univeral units
self.OneCentimeter = (1.0e-2/self.LengthUnit[0], 'LengthUnit')
self.kbTk3nK = self.FPC.kB['Value'] * 3.0e-9/ self.EnergyUnit[0] # in units of 'J/K*3nK/(J*s*Hz) = 3x10^-9',
# Usage example, for an arbitrary temperature, say, 5 nK in SI units, and we should assigne a value of
# 5/3 * self.kbTk3nK to the temperature variable T used for simulation. When we want to convert the number of T
# back to SI units, we should use T * self.kbTk3nK * self.EnergyUnit to get value in SI units.
###print '----kbTk3nK corresponds to Tk=3 nK and kbTk is in unites of (kb * 3nK/( hbar* 4 recoil freqeuncy)):', kbTk3nK
self.hbar = 1.0
self.Mass = 1.0/2
#self.Delta = 1000000.0
#self.pipulse = 0.785 * 2 /17.197 * 21 /20.2287880384 *61
self.Delta = -500.0e6 * 2 * np.pi / self.AngularFrequencyUnit[0] # THSE: change to 500MHz blue
print 'Delta: ', self.Delta
self.pipulse = 6.0e-6 / self.TimeUnit[0] # THSE: change to 6.0 mus
print 'pipulse ', self.pipulse
##print '------------------pi pulse duration', self.pipulse *(self.TimeUnit[0])*10**6, 'micro-seconds'
self.interpulse = self.pipulse * 1.0 #3.0 * 10 * 3 / 16.266 * 14.0
self.keff = 1.0
self.RabiFreqmax = sqrt(np.pi*np.abs(self.Delta)/2.0/self.pipulse) #in unites of (hbar*keff)^2/(2*M*habar) = 4 * recoil frequency = 4* 2π • 3.6325 kHz
##print '--------------effective two photo Rabi frequency 2*Omega^2/Delta/2pi is', 2*self.RabiFreqmax**2/self.Delta*(self.AngularFrequencyUnit[0])/2.0/np.pi/10**3, 'KHz'
## THSE: correct the expression for RabiFreqmax
self.BeamWaistAt1OverESquared = 3.5/10 * self.OneCentimeter[0] # THSE: change to 7mm in diameter
self.CloudRadiusAt1OverESquared = 0.5 * self.OneCentimeter[0] /10 #previous value was 3.0, the name should be fullwidth instead of radius, because it is divided by 2
###print '-----BeamWaistAt1OverESquared = 3.0 * OneCentimeter[0]:',BeamWaistAt1OverESquared
###print '-----CloudRadiusAt1OverESquared = 3.0 * OneCentimeter[0] /10:', CloudRadiusAt1OverESquared
# THSE: changed to Cloud Radius to 0.5mm
self.kbTk = self.kbTk3nK /3.0 * 8.0 # assuming we want to get 8 nK temperature atom cloud
self.Omega10=0.0
self.Omega20=0.0
self.Transitions = [(3,2), (2,1), (1,0), (0,1), (1,2), (2,3)] + [ (2,1), (1,0), (0,1), (1,2), (2,3)]
self.keffsign = [+1, -1, +1, +1, -1, +1 ] + [ -1, +1, +1, -1, +1 ]
self.pulsetiming = np.array([0, 1.0, 2.0, 13.5, 15.0, 16.5, 18.0, 19.5, 31.0, 32.0, 33.0])* self.interpulse
##print '---------------------interrogation time:', self.pulsetiming[-1]/2.0*(self.TimeUnit[0]), 'seconds'
self.pulseduration=np.array([0.5, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 0.5]) * self.pipulse
#pulsetiming = array([0, interpulse, 2.0*interpulse, 13.5*interpulse, 15.0*interpulse, 16.5*interpulse,
# 18.0*interpulse, 19.5*interpulse, 31.0*interpulse, 32.0*interpulse, 33.0*interpulse ])
self.StatesFilterUpperArm = np.array([self.StateFilterFunction([0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0], ShiftIndex = SF)
for SF in [0, -1, -2, -3, -2, -1, 0, 0, 0, 0, 0] ])
self.StatesFilterLowerArm = np.array([self.StateFilterFunction([0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0], ShiftIndex = SF)
for SF in [0, 0, 0, 0, 0, 0, -1, -2, -2, -1, 0] ])
def InCaseOf6hbark(self):
self.RabiFreqmax = sqrt(np.pi*np.abs(self.Delta)/2.0/self.pipulse) #in unites of (hbar*keff)^2/(2*M*habar) = 4 * recoil frequency = 4* 2π
# THSE: correct the RabiFreqmax expression
self.Transitions = [(3,2), (2,1), (1,0), (0,1), (1,2), (2,3)] + [ (2,1), (1,0), (0,1), (1,2), (2,3)]
self.keffsign = [+1, -1, +1, +1, -1, +1 ] + [ -1, +1, +1, -1, +1 ]
self.pulsetiming = np.array([0, 1.0, 2.0, 13.5, 15.0, 16.5, 18.0, 19.5, 31.0, 32.0, 33.0])* self.interpulse
##print '---------------------interrogation time:', self.pulsetiming[-1]/2.0*(self.TimeUnit[0]), 'seconds'
self.pulseduration=np.array([0.5, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 0.5]) * self.pipulse
#pulsetiming = array([0, interpulse, 2.0*interpulse, 13.5*interpulse, 15.0*interpulse, 16.5*interpulse,
# 18.0*interpulse, 19.5*interpulse, 31.0*interpulse, 32.0*interpulse, 33.0*interpulse ])
self.StatesFilterUpperArm = np.array([self.StateFilterFunction([0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0], ShiftIndex = SF)
for SF in [0, -1, -2, -3, -2, -1, 0, 0, 0, 0, 0] ])
self.StatesFilterLowerArm = np.array([self.StateFilterFunction([0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0], ShiftIndex = SF)
for SF in [0, 0, 0, 0, 0, 0, -1, -2, -2, -1, 0] ])
"""
def InCaseOf2hbark(self):
self.RabiFreqmax = sqrt(np.pi*self.Delta/2.0/self.pipulse) #in unites of (hbar*keff)^2/(2*M*habar) = 4 * recoil frequency = 4* 2π
self.Transitions = [(3,2), (2,3), (2,3)]
self.keffsign = [+1, +1, +1 ]
self.pulsetiming = np.array([0, 16.5, 33.0])* self.interpulse
##print '---------------------interrogation time:', self.pulsetiming[-1]/2.0*(self.TimeUnit[0]), 'seconds'
self.pulseduration=np.array([0.5, 1.0, 0.5]) * self.pipulse
#pulsetiming = array([0, interpulse, 2.0*interpulse, 13.5*interpulse, 15.0*interpulse, 16.5*interpulse,
# 18.0*interpulse, 19.5*interpulse, 31.0*interpulse, 32.0*interpulse, 33.0*interpulse ])
self.StatesFilterUpperArm = np.array([self.StateFilterFunction([0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0], ShiftIndex = SF)
for SF in [0, -1, 0] ])
self.StatesFilterLowerArm = np.array([self.StateFilterFunction([0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0], ShiftIndex = SF)
for SF in [0, -1, 0] ])
self.StatesFilterUpperArm = np.array([[0, 0, 1, 1, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0], [0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0], [0, 0, 1, 1, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0]])
self.StatesFilterLowerArm = np.array([[0, 0, 1, 1, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0], [0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0], [0, 0, 1, 1, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0]])
print 'upperfilter', self.StatesFilterUpperArm
print 'lowerfilter', self.StatesFilterLowerArm
"""
def InCaseOf2hbark(self):
self.RabiFreqmax = sqrt(np.pi*np.abs(self.Delta)/2.0/self.pipulse) #in unites of (hbar*keff)^2/(2*M*habar) = 4 * recoil frequency = 4* 2π
# THSE: correct RabiFreqmax expression
self.Transitions = [(1,0), (0,1), (0,1)]
self.keffsign = [+1, +1, +1 ]
self.pulsetiming = np.array([0, 16.5, 33.0])* self.interpulse
##print '---------------------interrogation time:', self.pulsetiming[-1]/2.0*(self.TimeUnit[0]), 'seconds'
self.pulseduration=np.array([0.5, 1.0, 0.5]) * self.pipulse
#pulsetiming = array([0, interpulse, 2.0*interpulse, 13.5*interpulse, 15.0*interpulse, 16.5*interpulse,
# 18.0*interpulse, 19.5*interpulse, 31.0*interpulse, 32.0*interpulse, 33.0*interpulse ])
self.StatesFilterUpperArm = np.array([self.StateFilterFunction([0, 1, 0, 0, 1, 0], ShiftIndex = SF)
for SF in [0, -1, 0] ])
self.StatesFilterLowerArm = np.array([self.StateFilterFunction([0, 1, 0, 0, 1, 0], ShiftIndex = SF)
for SF in [0, -1, 0] ])
self.StatesFilterUpperArm = np.array([[1, 1, 0, 1, 1, 0], [1, 0, 0, 1, 0, 0], [1, 1, 0, 1, 1, 0]])
self.StatesFilterLowerArm = np.array([[1, 1, 0, 1, 1, 0], [0, 1, 0, 0, 1, 0], [1, 1, 0, 1, 1, 0]])
def InCaseOf2hbarkWithInitialDelay(self):
# THSE: fix RabiFreqmax to the case of pi pulse = 6 mus
self.RabiFreqmax = sqrt(np.pi*np.abs(self.Delta)/2.0/(6.0e-6 / self.TimeUnit[0])) #in unites of (hbar*keff)^2/(2*M*habar) = 4 * recoil frequency = 4* 2π
# THSE: correct RabiFreqmax expression
self.Transitions = [(1,0), (1,0), (0,1), (0,1)]
self.keffsign = [+1, +1, +1, +1 ]
self.pulsetiming = np.array([-2.93, 0, 5.0, 10.0])* self.interpulse
##print '---------------------interrogation time:', self.pulsetiming[-1]/2.0*(self.TimeUnit[0]), 'seconds'
self.pulseduration=np.array([1.0e-6, 0.5, 1.0, 0.5]) * self.pipulse
#pulsetiming = array([0, interpulse, 2.0*interpulse, 13.5*interpulse, 15.0*interpulse, 16.5*interpulse,
# 18.0*interpulse, 19.5*interpulse, 31.0*interpulse, 32.0*interpulse, 33.0*interpulse ])
self.StatesFilterUpperArm = np.array([self.StateFilterFunction([0, 1, 0, 0, 1, 0], ShiftIndex = SF)
for SF in [0, 0, -1, 0] ])
self.StatesFilterLowerArm = np.array([self.StateFilterFunction([0, 1, 0, 0, 1, 0], ShiftIndex = SF)
for SF in [0, 0, -1, 0] ])
self.StatesFilterUpperArm = np.array([[1, 1, 1, 1, 1, 1], [1, 1, 0, 1, 1, 0], [1, 0, 0, 1, 0, 0], [1, 1, 0, 1, 1, 0]])
self.StatesFilterLowerArm = np.array([[1, 1, 1, 1, 1, 1], [1, 1, 0, 1, 1, 0], [0, 1, 0, 0, 1, 0], [1, 1, 0, 1, 1, 0]])
def InCaseOf12hbark(self):
self.RabiFreqmax = sqrt(np.pi*np.abs(self.Delta)/2.0/self.pipulse) #in unites of (hbar*keff)^2/(2*M*habar) = 4 * recoil frequency = 4* 2π
# THSE: correct RabiFreqmax expression
self.Transitions = [(6,5), (5,4), (4,3), (3,2), (2,1), (1,0), (0,1), (1,2), (2,3), (3,4), (4,5), (5,6)] + [(5,4), (4,3), (3,2), (2,1), (1,0), (0,1), (1,2), (2,3), (3,4), (4,5), (5,6)]
self.keffsign = [+1, -1, +1, -1, +1, -1, -1, +1, -1, +1, -1, +1 ] + [ -1, +1, -1, +1, -1, -1, +1, -1, +1, -1, +1 ]
self.pulsetiming = np.array([0, 1.0, 2.0, 3.0, 4.0, 5.0, 9.0, 10.5, 12.0, 13.5, 15.0, 16.5, 18.0, 19.5, 21.0, 22.5, 24.0, 28.0, 29.0, 30.0, 31.0, 32.0, 33.0])* self.interpulse
##print '---------------------interrogation time:', self.pulsetiming[-1]/2.0*(self.TimeUnit[0]), 'seconds'
self.pulseduration=np.array([0.5, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 0.5]) * self.pipulse
#pulsetiming = array([0, interpulse, 2.0*interpulse, 13.5*interpulse, 15.0*interpulse, 16.5*interpulse,
# 18.0*interpulse, 19.5*interpulse, 31.0*interpulse, 32.0*interpulse, 33.0*interpulse ])
self.StatesFilterUpperArm = np.array([self.StateFilterFunction([0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0], ShiftIndex = SF)
for SF in [0, -1, -2, -3, -4, -5, -5, -4, -3, -2, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] ])
self.StatesFilterLowerArm = np.array([self.StateFilterFunction([0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0], ShiftIndex = SF)
for SF in [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, -2, -3, -4, -5, -5, -4, -3, -2, -1, 0] ])
def InCaseOf8hbark(self):
self.RabiFreqmax = sqrt(np.pi*np.abs(self.Delta)/2.0/self.pipulse) #in unites of (hbar*keff)^2/(2*M*habar) = 4 * recoil frequency = 4* 2π
# THSE: correct RabiFreqmax expression
self.Transitions = [(4,3), (3,2), (2,1), (1,0), (0,1), (1,2), (2,3), (3,4)] + [(3,2), (2,1), (1,0), (0,1), (1,2), (2,3), (3,4)]
self.keffsign = [+1, -1, +1, -1, -1, +1, -1, +1 ] + [ -1, +1, -1, -1, +1, -1, +1 ]
self.pulsetiming = np.array([0, 1.0, 2.0, 3.0, 12.0, 13.5, 15.0, 16.5, 18.0, 19.5, 21.0, 30.0, 31.0, 32.0, 33.0])* self.interpulse
##print '---------------------interrogation time:', self.pulsetiming[-1]/2.0*(self.TimeUnit[0]), 'seconds'
self.pulseduration=np.array([0.5, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 0.5]) * self.pipulse
#pulsetiming = array([0, interpulse, 2.0*interpulse, 13.5*interpulse, 15.0*interpulse, 16.5*interpulse,
# 18.0*interpulse, 19.5*interpulse, 31.0*interpulse, 32.0*interpulse, 33.0*interpulse ])
self.StatesFilterUpperArm = np.array([self.StateFilterFunction([0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0], ShiftIndex = SF)
for SF in [0, -1, -2, -3, -3, -2, -1, 0, 0, 0, 0, 0, 0, 0, 0] ])
self.StatesFilterLowerArm = np.array([self.StateFilterFunction([0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0], ShiftIndex = SF)
for SF in [0, 0, 0, 0, 0, 0, 0, 0, -1, -2, -3, -3, -2, -1, 0] ])
def StateFilterFunction(self, state0 = [0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0], ShiftIndex=0):
state0 = [0] + state0
stateL=self.movetoleft(copy(state0))
stateR=self.movetoright(copy(state0))
statesum = list(np.array(state0) + np.array(stateL) + np.array(stateR))
if ShiftIndex == 0:
statesum.pop(0)
return np.array(statesum)
elif ShiftIndex >0:
for ii in np.arange(ShiftIndex):
statesum = self.movetoright(statesum)
statesum.pop(0)
return np.array(statesum)
else:
for ii in np.arange(abs(ShiftIndex)):
statesum = self.movetoleft(statesum)
statesum.pop(0)
return np.array(statesum)
def movetoleft(self, inputlist=list([1, 2, 3, 4])):
inputlist.append(inputlist.pop(0))
return inputlist
def movetoright(self, inputlist=list([1, 2, 3, 4])):
inputlist.insert(0, inputlist.pop(len(inputlist)-1))
return inputlist
def FreePropagationOverTime(self, PropagationTime = 0):
self.Position.UpdateDueTo(self.Velocity, PropagationTime)
self.Time += PropagationTime
def RadomizePositionAndMomentumAccordingToTempAndCloudSize(self):
# THSE: needs modification to take into account of initial velocity and position offsets
psigma=sqrt(self.kbTk/2.0)
rsigma= self.CloudRadiusAt1OverESquared/2.0
self.Velocity.vec=self.V0.vec + np.random.normal(0,psigma,3)/self.Mass
self.Position.vec=self.R0.vec + np.random.normal(0,rsigma,3)
class LaserPulse(object):
def __init__(self, InteractingAtom=SingleAtom()):
pass
def AmplitudeNormalizedPulse(self, time, timestart, timeend):
return self.rectpulse(time, timestart, timeend)
def LaserBeamShape(self):
pass
def rectpulse(self, time,time0,time1):
if (time-time0< 0) or (time-time1 >0):
return 0.0
else:
return 1.0
class LaserAtomInteraction(object):
def __init__(self, InputAtom=SingleAtom(), InputLaserPulse=LaserPulse(), InteractionPeriodIndex = 0, ArmFilterIndex = 'upper', Laser2PhoDetuningFactor=1.0):
self.Atom = InputAtom
self.Laser = InputLaserPulse
self.IntDex = InteractionPeriodIndex
self.PulseTimeStart = self.Atom.pulsetiming[self.IntDex]
self.PulseTimeEnd = self.PulseTimeStart + self.Atom.pulseduration[self.IntDex]
self.FlightDuration = 0.0 if self.IntDex == 0 else self.Atom.pulsetiming[self.IntDex]-self.Atom.pulsetiming[self.IntDex-1]
self.TwoPhotonDetuning = self.TwoPhotonResonanceFrequency(TransitionPair = self.Atom.Transitions[self.IntDex]) # this is the 2 photon resonance frequency of the two momentum states that we want to select
self.delta2Laser = Laser2PhoDetuningFactor * self.Atom.keffsign[self.IntDex] * self.TwoPhotonDetuning #This is the laser frequency we want to set in order to enhance the transition pair we attompt to enhance and suppress others
#THSE: EEEE
#print self.delta2Laser
self.Delta = self.Atom.Delta
self.StateFilter = self.Atom.StatesFilterUpperArm if ArmFilterIndex == 'upper' else self.Atom.StatesFilterLowerArm
self.N = 500 # number of points to descritize the integration
# THSE: add beam distance
self.intrabeamDistance = 23.0/10 * self.Atom.OneCentimeter[0] # 23 mm
def LaserPulse(self, time):
return self.Laser.AmplitudeNormalizedPulse(time, self.PulseTimeStart, self.PulseTimeEnd)
# Raman laser field configuration and time sequence definition:
def Omega1(self, time, Omega10):
Omega1t = Omega10 * self.LaserPulse(time)
return Omega1t #in unites of (hbar*keff)^2/(2*M*habar) = 4 * recoil frequency = 4* 2π • 3.6325 kHz
def Omega2(self, time, Omega20):
Omega2t = Omega20 * self.LaserPulse(time)
return Omega2t #in unites of (hbar*keff)^2/(2*M*habar) = 4 * recoil frequency = 4* 2π • 3.6325 kHz
def TwoPhotonResonanceFrequency(self, TransitionPair =(3,2)):
p0, p1 = (self.Atom.Quantum.States['Momentum'][TransitionPair[0]], self.Atom.Quantum.States['Momentum'][TransitionPair[1]])
DetuningDueToKineticEnergyDifference = np.abs(p0**2 - p1**2)/(2.0*self.Atom.Mass*self.Atom.hbar)
return DetuningDueToKineticEnergyDifference
# AC Stark Shifts + Effective 2-photon Rabi Frequency + 2-photon deturning with 2-k Doppler effect
def ACStarkShift1(self, Omega1):
return 1.0j*abs(Omega1)**2/self.Delta
def ACStarkShift2(self, Omega2):
return 1.0j*abs(Omega2)**2/self.Delta
def Omegaeff(self, Omega1, Omega2):
return 1.0j*Omega1*conjugate(Omega2)/self.Delta
# this is the laser detuning in regarding to a transition from arbitrary momentum state pi to pj
def delta(self, pi, pj):
M=self.Atom.Mass
hbar=self.Atom.hbar
return abs(pi)**2/(2*M*hbar)-abs(pj)**2/(2*M*hbar) + self.delta2Laser
# Raman coupling and Hamiltonian
def RamanCoupling(self, pi,pj,time, Omega10, Omega20):
return self.Omegaeff(self.Omega1(time, Omega10), self.Omega2(time, Omega20))*np.exp(1.0j*self.delta(pi,pj)*time)
def Hamiltonian12HbarK(self, time, Omega10, Omega20):
"""This 12HbarK means expendable, the dimension of H depends on the self.Atom.Quantum.StateDemension
"""
hbar=self.Atom.hbar
p = self.Atom.Velocity.z * self.Atom.Mass
H= 1.0j*zeros([self.Atom.Quantum.StateDimension,self.Atom.Quantum.StateDimension])
# Off-diagonal terms of the Hamiltonian
keff= self.Atom.keffsign[self.IntDex]
SD = self.Atom.Quantum.StateDimension
if SD % 2 == 0:
SD1 = np.arange(2, SD, 2)
SD2 = np.arange(2, SD + 1, 2) - 1
if keff > 0:
for Hindex in SD1:
n_left = self.Atom.Quantum.States['Momentum'][Hindex]
n_right = self.Atom.Quantum.States['Momentum'][Hindex-1]
H[Hindex,Hindex-1] = self.RamanCoupling(p+n_left*hbar*keff, p+n_right*hbar*keff, time, Omega10, Omega20)
else:
keff = abs(keff)# There should be no sign in the keff used below
for Hindex in SD2:
n_left = self.Atom.Quantum.States['Momentum'][Hindex-1]
#print self.Atom.Quantum.States['Momentum']
#print 'hindex', Hindex
n_right = self.Atom.Quantum.States['Momentum'][Hindex]
H[Hindex-1,Hindex] = self.RamanCoupling(p+n_left*hbar*keff, p+n_right*hbar*keff, time, Omega10, Omega20)
else:
SD1 = np.arange(1, SD, 2)
SD2 = np.arange(1, SD, 2) + 1
if keff > 0:
for Hindex in SD1:
n_left = self.Atom.Quantum.States['Momentum'][Hindex]
n_right = self.Atom.Quantum.States['Momentum'][Hindex-1]
H[Hindex,Hindex-1] = self.RamanCoupling(p+n_left*hbar*keff, p+n_right*hbar*keff, time, Omega10, Omega20)
else:
keff = abs(keff)# There should be no sign in the keff used below
for Hindex in SD2:
n_left = self.Atom.Quantum.States['Momentum'][Hindex-1]
#print self.Atom.Quantum.States['Momentum']
#print 'hindex', Hindex
n_right = self.Atom.Quantum.States['Momentum'][Hindex]
H[Hindex-1,Hindex] = self.RamanCoupling(p+n_left*hbar*keff, p+n_right*hbar*keff, time, Omega10, Omega20)
"""
if keff > 0:
for Hindex in np.arange(1, self.Atom.Quantum.StateDimension, 2):
n_left = self.Atom.Quantum.States['Momentum'][Hindex]
n_right = self.Atom.Quantum.States['Momentum'][Hindex-1]
H[Hindex,Hindex-1] = self.RamanCoupling(p+n_left*hbar*keff, p+n_right*hbar*keff, time, Omega10, Omega20)
else:
keff = abs(keff)# There should be no sign in the keff used below
for Hindex in np.arange(1, self.Atom.Quantum.StateDimension, 2):
n_left = self.Atom.Quantum.States['Momentum'][Hindex]
#print self.Atom.Quantum.States['Momentum']
#print 'hindex', Hindex
n_right = self.Atom.Quantum.States['Momentum'][Hindex+1]
H[Hindex,Hindex+1] = self.RamanCoupling(p+n_left*hbar*keff, p+n_right*hbar*keff, time, Omega10, Omega20)
"""
H = H - transpose(conjugate(H)) # because the imaginary factor in the coupling equation already included in the H so we must use a negative sign at here.
# Diagonal terms of the Hamiltonian
for Hindex in np.arange(self.Atom.Quantum.StateDimension):
H[Hindex,Hindex] = self.ACStarkShift2(self.Omega2(time, Omega20)) if self.Atom.Quantum.States['Einternal'][Hindex] == 1.0 else self.ACStarkShift1(self.Omega1(time, Omega10))
return H
#RHS defintion for Schrodinger Equation, called by the ODE solver
def RHS_SchrodingerEq2(self, StateVector, time, Omega10, Omega20):
#assuming the atom movement during pulse interaction is neglegible small
#so Omega10 and Omega20 remain as constant
dStateVector_dt=array(zeros([self.Atom.Quantum.StateDimension*2]))
#the input argument StateVector must be an array, not a list.
ComplexProbAmp = StateVector[0:self.Atom.Quantum.StateDimension] + 1.0j*StateVector[self.Atom.Quantum.StateDimension:(self.Atom.Quantum.StateDimension*2)]
dComplexProbAmp_dt = dot(self.Hamiltonian12HbarK(time, Omega10, Omega20), ComplexProbAmp)
dStateVector_dt[0: self.Atom.Quantum.StateDimension] = dComplexProbAmp_dt.real
dStateVector_dt[self.Atom.Quantum.StateDimension:(self.Atom.Quantum.StateDimension*2)] = dComplexProbAmp_dt.imag
return dStateVector_dt
def TimeEvolution(self):
# assign values for initial states with filtering and create time period for integration,
StateVector0 = self.Atom.Quantum.StateVec * self.StateFilter[self.IntDex,:]
time = np.array(linspace(self.PulseTimeStart, self.PulseTimeEnd, self.N))
# add calculation for Rabi Frequencies before atom-laser-pulse interaction start by odeint
self.AtomPosition_LocalRabiFrequencyUpdateAfterFlightOf(self.FlightDuration)
StateVector = odeint(self.RHS_SchrodingerEq2, StateVector0, time, (self.Atom.Omega10, self.Atom.Omega20))
self.Atom.Quantum.StateVec = StateVector[-1,:]
#self.Atom.Quantum.StateVec[0:7]
return (StateVector,time, self.Atom)
def AtomPosition_LocalRabiFrequencyUpdateAfterFlightOf(self, FlightDuration):
self.Atom.Position.UpdateDueTo(self.Atom.Velocity, FlightDuration)
self.Atom.Time += FlightDuration
# THSE: change the input arguments for RFspatialprofile
Omega10 = self.RabiFrequencySpatialProfile(self.Atom.Position)
#print 'CCC Omega10, x, y, RabiF:', Omega10, self.Atom.Position.x*self.Atom.LengthUnit[0]*1000, self.Atom.Position.y*self.Atom.LengthUnit[0]*1000, self.Atom.RabiFreqmax
self.Atom.Omega10 = Omega10
self.Atom.Omega20 = Omega10
"""
def RabiFrequencySpatialProfile(self, radius):
#the profile is determined by the laser beam profile
return self.Atom.RabiFreqmax*np.exp(-(radius/self.Atom.BeamWaistAt1OverESquared)**2/2.0)
"""
def RabiFrequencySpatialProfile(self, Position):
#the profile is determined by the laser beam profile
# THSE: add 2 more beams
radius = sqrt(Position.x**2 + Position.y**2)
if self.intrabeamDistance > 0.0:
radius1 = sqrt(Position.x**2 + (Position.y - self.intrabeamDistance)**2)
radius2 = sqrt(Position.x**2 + (Position.y - 2 * self.intrabeamDistance)**2)
RFS = self.Atom.RabiFreqmax*(np.exp(-(radius/self.Atom.BeamWaistAt1OverESquared)**2/2.0)+ \
np.exp(-(radius1/self.Atom.BeamWaistAt1OverESquared)**2/2.0) + \
np.exp(-(radius2/self.Atom.BeamWaistAt1OverESquared)**2/2.0))
else:
RFS = self.Atom.RabiFreqmax*(np.exp(-(radius/self.Atom.BeamWaistAt1OverESquared)**2/2.0))
return RFS
class AtomInterferometer(object):
def __init__(self, Atom = SingleAtom(Velocity=Velocity(vec_v = np.array([0.0, 0.0, 0.0]))) , Laser2PhoDetuningFactor = 1.0):
self.SingleAtom = Atom
self.TrajectoryRecorderInitialization()
# THSE: add this factor parameter
self.Laser2PhoDetuningFactor = Laser2PhoDetuningFactor
#self.intraLaserBeamDistance = 0.0
def AtomSourceRandomization(self):
self.SingleAtom.RadomizePositionAndMomentumAccordingToTempAndCloudSize()
def ShowAtomPositionAndMomentum(self):
print self.SingleAtom.Position.vec#*self.LengthUnit[0]
print self.SingleAtom.Velocity.vec#*self.LengthUnit[0]/self.TimeUnit[0]
def TrajectoryRecorderInitialization(self):
self.time = np.zeros(len(self.SingleAtom.Transitions))
self.v = np.zeros(len(self.SingleAtom.Transitions))
def UpperArmTransition(self):
SingleAtom = deepcopy(self.SingleAtom)
StateStack = np.array([SingleAtom.Quantum.StateVec])
TimeStack = np.array([[SingleAtom.Time]])
for InteractionIndex in np.arange(len(SingleAtom.Transitions)):
# THSE: add factor parameter
LaserAtomInt = LaserAtomInteraction(InputAtom = SingleAtom, \
InteractionPeriodIndex = InteractionIndex, ArmFilterIndex = 'upper', Laser2PhoDetuningFactor=self.Laser2PhoDetuningFactor)
StateVector, Time, SingleAtom = LaserAtomInt.TimeEvolution()
StateStack = concatenate((StateStack, StateVector), axis=0)
TimeStack = concatenate((TimeStack, np.transpose(array([Time]))), axis=0)
self.UpperArmStateStack = StateStack
self.UpperArmTimeStack = TimeStack
self.UpperArmPartialSingleAtom = SingleAtom
self.intraLaserBeamDistance = LaserAtomInt.intrabeamDistance
"""
print 'line 714'
print 'check if upperstate stack last state is consistent with SingleAtom state vector'
print self.UpperArmStateStack[-1,:]
print 'uppperarmpartialSingleatom'
print self.UpperArmPartialSingleAtom.Quantum.StateVec
"""
return SingleAtom
def LowerArmTransition(self):
SingleAtom = deepcopy(self.SingleAtom)
StateStack = np.array([SingleAtom.Quantum.StateVec])
TimeStack = np.array([[SingleAtom.Time]])
for InteractionIndex in np.arange(len(SingleAtom.Transitions)):
# THSE: add factor parameter
LaserAtomInt = LaserAtomInteraction(InputAtom = SingleAtom, \
InteractionPeriodIndex = InteractionIndex, ArmFilterIndex = 'lower', Laser2PhoDetuningFactor=self.Laser2PhoDetuningFactor)
StateVector, Time, SingleAtom = LaserAtomInt.TimeEvolution()
StateStack = concatenate((StateStack, StateVector), axis=0)
TimeStack = concatenate((TimeStack, np.transpose(array([Time]))), axis=0)
self.LowerArmStateStack = StateStack
self.LowerArmTimeStack = TimeStack
self.LowerArmPartialSingleAtom = SingleAtom
self.intraLaserBeamDistance = LaserAtomInt.intrabeamDistance
"""
print 'line 735'
print 'check if lowerstate stack last state is consistent with SingleAtom state vector'
print self.LowerArmStateStack[-1,:]
print 'lowerarmpartialSingleatom'
print self.LowerArmPartialSingleAtom.Quantum.StateVec
"""
return SingleAtom
def ShowUpperArmTransitionSequence(self):
StateStack = self.UpperArmStateStack
TimeStack = self.UpperArmTimeStack
Probability = np.abs(StateStack[:,0:self.SingleAtom.Quantum.StateDimension])**2 + np.abs(StateStack[:,self.SingleAtom.Quantum.StateDimension:(self.SingleAtom.Quantum.StateDimension*2)])**2
Plot7Figs(TimeStack, Probability, 'title', 'xlabel', 'ylabel')
return self.SingleAtom
def ShowLowerArmTransitionSequence(self):
StateStack = self.LowerArmStateStack
TimeStack = self.LowerArmTimeStack
Probability = np.abs(StateStack[:,0:self.SingleAtom.Quantum.StateDimension])**2 + np.abs(StateStack[:,self.SingleAtom.Quantum.StateDimension:(self.SingleAtom.Quantum.StateDimension*2)])**2
Plot7Figs(TimeStack, Probability, 'title', 'xlabel', 'ylabel')
return self.SingleAtom
def SeparatedStateInterference(self):
self.AtomSourceRandomization()
#print 'line 761, ensable the atomsource randomization() above'
#print 'atom poistion after randomization'
#self.ShowAtomPositionAndMomentum()
self.UpperArmTransition()
#print 'atom position after upper interference'
#self.ShowAtomPositionAndMomentum()
self.LowerArmTransition()
#print 'atom position after lower intereference'
#self.ShowAtomPositionAndMomentum()
"""
print 'atom position and velocity of lower arm'
print 'positioin',self.LowerArmPartialSingleAtom.Position.vec
print 'velcity', self.LowerArmPartialSingleAtom.Velocity.vec
print 'atom position and velocity of upper arm'
print 'positioin',self.UpperArmPartialSingleAtom.Position.vec
print 'velcity', self.UpperArmPartialSingleAtom.Velocity.vec
"""
"""
lowervec = self.LowerArmPartialSingleAtom.Quantum.StateVec
uppervec = self.UpperArmPartialSingleAtom.Quantum.StateVec
Clower=self.SingleAtom.Quantum.ComplexVecConvertedFromStateVec(lowervec)
Cupper=self.SingleAtom.Quantum.ComplexVecConvertedFromStateVec(uppervec)
print 'line 784, total atom probability lower:', np.sum(np.abs(Clower)**2)
print 'line 784, total atom probability upper:', np.sum(np.abs(Cupper)**2)
print '\n'
"""
return (self.LowerArmPartialSingleAtom.Quantum.StateVec, self.UpperArmPartialSingleAtom.Quantum.StateVec)
def AtomSplitting(self):
pass
def AtomOutput(self):
pass
def Plot10Figs(x, yarray, title, xlabel, ylabel):
#show 7 figures in a row
#close('all')
f, (ax1, ax2, ax3, ax4, ax5, ax6, ax7, ax8, ax9, ax10) = plt.subplots(10, sharex=True, sharey=True)
ax1.plot(x, yarray[:,0], 'k-' )
ax1.grid(True)
ax1.set_title(title)
ax2.plot(x, yarray[:,1], 'g-' )
ax2.grid(True)
ax3.plot(x, yarray[:,2], 'b-' )
ax3.grid(True)
ax4.plot(x, yarray[:,3], 'r-' )
ax4.grid(True)
ax5.plot(x, yarray[:,4], 'm-' )
ax5.grid(True)
ax6.plot(x, yarray[:,5], 'y-' )
ax6.grid(True)
ax7.plot(x, yarray[:,6], 'c-' )
ax8.plot(x, yarray[:,7], 'm-' )
ax9.plot(x, yarray[:,8], 'y-' )
ax10.plot(x, yarray[:,9], 'c-' )
# Fine-tune figure; make subplots close to each other and hide x ticks for
# all but bottom plot.
f.subplots_adjust(hspace=0)
plt.setp([a.get_xticklabels() for a in f.axes[:-1]], visible=False)
show()
def Plot7Figs(x, yarray, title, xlabel, ylabel):
#show 7 figures in a row
#close('all')
f, (ax1, ax2, ax3, ax4, ax5, ax6, ax7) = plt.subplots(7, sharex=True, sharey=True)
ax1.plot(x, yarray[:,0], 'k-' )
ax1.grid(True)
ax1.set_title(title)
ax2.plot(x, yarray[:,1], 'g-' )
ax2.grid(True)
ax3.plot(x, yarray[:,2], 'b-' )
ax3.grid(True)
ax4.plot(x, yarray[:,3], 'r-' )
ax4.grid(True)
ax5.plot(x, yarray[:,4], 'm-' )
ax5.grid(True)
ax6.plot(x, yarray[:,5], 'y-' )
ax6.grid(True)
ax7.plot(x, yarray[:,6], 'c-' )
# Fine-tune figure; make subplots close to each other and hide x ticks for
# all but bottom plot.
f.subplots_adjust(hspace=0)
plt.setp([a.get_xticklabels() for a in f.axes[:-1]], visible=False)
show()
def TestPlot7Figs():
x=linspace(1,10,100)
y=np.random.rand(100,7)
for ii in range(10):
print y[ii,:]