当前位置: 首页>>代码示例>>Python>>正文


Python Atom.cg_coef方法代码示例

本文整理汇总了Python中atom.Atom.cg_coef方法的典型用法代码示例。如果您正苦于以下问题:Python Atom.cg_coef方法的具体用法?Python Atom.cg_coef怎么用?Python Atom.cg_coef使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在atom.Atom的用法示例。


在下文中一共展示了Atom.cg_coef方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: decoherence

# 需要导入模块: from atom import Atom [as 别名]
# 或者: from atom.Atom import cg_coef [as 别名]
    def decoherence(self):
        gamma = self.gamma
        if self.d1 == 1:
            j2 = 1.0/2.0
            #Gamma = 2*np.pi*4.575e6 #Decay Rate/Natural Line Width (rad)
        else:
            j2 = 3.0/2.0
            #Gamma = 2*np.pi*5.234e6 #Decay Rate/Natural Line Width (rad)
            #Gamma = 2*np.pi*750.0e6
        Gamma = 2*np.pi*9e7
        n=self.parameter['n']
        self.parameter['decoherence_matrix'] = [[[] for i in range(n)] for j in range(n)]
        cs = Atom()
        #gamma
        for i in range(n):
            for j in range(i,n):
                d1 = self.index2lfm(i)
                d2 = self.index2lfm(j)
                if d1[0:2] == (0,4) and d2[0:2] == (0,3): #ground state
                    #if np.abs(d1[2]-d2[2]) <= 2: #no selection rule
                    self.parameter['decoherence_matrix'][i][i].append([i,i,-1.0*gamma])
                    self.parameter['decoherence_matrix'][i][i].append([j,j,gamma])
                    self.parameter['decoherence_matrix'][j][j].append([j,j,-1.0*gamma])
                    self.parameter['decoherence_matrix'][j][j].append([i,i,gamma])
                    self.parameter['decoherence_matrix'][i][j].append([i,j,-1.0*gamma])
#                            self.graph.add_edge(pydot.Edge(self.l0subn[4][int(d1[2]+q+4)],self.l0subn[3][int(d1[2]+3)],label = 'gamma/9'))

                if d2[0:2] == (0,3):
                    for q in range(-4,5):
                        allow_state = []
                        allow_state.append(self.lfm2index(0,4,q))
#                    print allow_state ,self.index2lfm(i),self.index2lfm(j)
                    if  i in allow_state:
#                        print('allowed non diagonal states')
                        self.parameter['decoherence_matrix'][i][j].append([i,j,-1.0*gamma/9.0])
        #Gamma
        for pair in self.egpair:
            for i in range(n):
                for j in range(i,n):
                    d1 = self.index2lfm(i)
                    d2 = self.index2lfm(j)
                    if d1[0:2] == pair[0] and d2[0:2] == pair[0] and i != j: #both are excited
                          self.parameter['decoherence_matrix'][i][j].append([i,j,-1.0*Gamma])
                    elif d1[0:2] == pair[0] and d2[0:2] == pair[1]:#d1 is excited d2 is ground
                        self.parameter['decoherence_matrix'][i][j].append([i,j,-1.0*Gamma/2.0])
                    elif d1[0:2] == pair[1] and d2[0:2] == pair[0]:# d2 is excited d1 is ground
                        self.parameter['decoherence_matrix'][i][j].append([i,j,-1.0*Gamma/2.0])
                    elif d1[0:2] == pair[1] and d2[0:2] == pair[1]:# both ground
                        for q in (-1.0,0.0,1.0):
                            f1 = pair[0][1]
                            if (d1[2]+q <= f1 and d1[2]+q >= -1*f1) and (d2[2]+q <= f1 and d2[2]+q >= -1*f1):
                                coef1 = {'q':q,
                                         'L1':0,
                                         'L2':1,
                                         'F1':pair[1][1],
                                         'F2':pair[0][1],
                                         'mf1':d1[2],
                                         'mf2':d1[2]+q,
                                         'J1':1.0/2.0,
                                         'J2':j2,
                                         'I':7.0/2.0}
                                coef2 = {'q':q,
                                         'L1':0,
                                         'L2':1,
                                         'F1':pair[1][1],
                                         'F2':pair[0][1],
                                         'mf1':d2[2],
                                         'mf2':d2[2]+q,
                                         'J1':1.0/2.0,
                                         'J2':j2,
                                         'I':7.0/2.0}
                                #this correction coefficient (see equation 54) should be written to atom.py later
                                rev = (-1)**(pair[0][1]-pair[1][1]+q)*math.sqrt((2*pair[0][1]+1)/(2*pair[1][1]+1))
                                rev = rev**2 #-1's power doesn't matter now, but still need to be checked
                                tmp = Gamma*cs.cg_coef(**coef1)*cs.cg_coef(**coef2)*rev
                                if tmp != 0.0:
                                    ii = self.lfm2index(pair[0][0],pair[0][1],d1[2]+q)
                                    jj = self.lfm2index(pair[0][0],pair[0][1],d2[2]+q)
                                    self.parameter['decoherence_matrix'][i][j].append([ii,jj,tmp])
                                    if ii == jj:
                                        self.parameter['decoherence_matrix'][int(ii)][int(jj)].append([ii,jj,-1*tmp])
开发者ID:lucasp0927,项目名称:Cscalc,代码行数:83,代码来源:parameter_common.py

示例2: decoherence

# 需要导入模块: from atom import Atom [as 别名]
# 或者: from atom.Atom import cg_coef [as 别名]
    def decoherence(self):
        gamma = self.gamma
        if self.d1 == 1:
            j2 = 1.0/2.0
            Gamma = 2*np.pi*4.575e6 #this is parameter for D1 line
        else:
            j2 = 3.0/2.0
            Gamma = 2*np.pi*5.234e6
            #Gamma = 2*np.pi*750.0e6
        n=self.parameter['n']
        self.parameter['decoherence_matrix'] = [[[] for i in range(n)] for j in range(n)]
        cs = Atom()
        #gamma
        for i in range(n):
            for j in range(i,n):
                d1 = self.index2lfm(i)
                d2 = self.index2lfm(j)
                if d1[0:2] == (0,3) and d2[0:2] == (0,3): #ground state
                    if i == j: # diagonal
                        for q in range(-4,5):
                            ii = int(self.lfm2index(0,4,q))
                            self.parameter['decoherence_matrix'][ii][ii].append([ii,ii,-1*gamma/9.0])
                            self.parameter['decoherence_matrix'][ii][ii].append([i,j,gamma/9.0])
                            self.parameter['decoherence_matrix'][i][j].append([ii,ii,gamma/9.0])
                            self.parameter['decoherence_matrix'][i][j].append([i,j,-1*gamma/9.0])
#                            self.graph.add_edge(pydot.Edge(self.l0subn[4][int(d1[2]+q+4)],self.l0subn[3][int(d1[2]+3)],label = 'gamma/9'))
                if d2[0:2] == (0,3):
                    for q in range(-4,5):
                        allow_state = []
                        allow_state.append(self.lfm2index(0,4,q))
#                    print allow_state ,self.index2lfm(i),self.index2lfm(j)
                    if  i in allow_state:
#                        print('allowed non diagonal states')
                        self.parameter['decoherence_matrix'][i][j].append([i,j,-1.0*gamma/9.0])
        #Gamma
        for pair in self.egpair:
            for i in range(n):
                for j in range(i,n):
                    d1 = self.index2lfm(i)
                    d2 = self.index2lfm(j)
                    if d1[0:2] == pair[0] and d2[0:2] == pair[0] and i != j:
                          self.parameter['decoherence_matrix'][i][j].append([i,j,-1.0*Gamma])
                    elif d1[0:2] == pair[0] and d2[0:2] == pair[1]:
                        self.parameter['decoherence_matrix'][i][j].append([i,j,-1.0*Gamma/2.0])
                    elif d1[0:2] == pair[1] and d2[0:2] == pair[0]:
                        self.parameter['decoherence_matrix'][i][j].append([i,j,-1.0*Gamma/2.0])
                    elif d1[0:2] == pair[1] and d2[0:2] == pair[1]:
                        for q in (-1.0,0.0,1.0):
                            f1 = pair[0][1]
                            if (d1[2]+q <= f1 and d1[2]+q >= -1*f1) and (d2[2]+q <= f1 and d2[2]+q >= -1*f1):
                                coef1 = {'q':q,
                                         'L1':0,
                                         'L2':1,
                                         'F1':pair[1][1],
                                         'F2':pair[0][1],
                                         'mf1':d1[2],
                                         'mf2':d1[2]+q,
                                         'J1':1.0/2.0,
                                         'J2':j2,
                                         'I':7.0/2.0}
                                coef2 = {'q':q,
                                         'L1':0,
                                         'L2':1,
                                         'F1':pair[1][1],
                                         'F2':pair[0][1],
                                         'mf1':d2[2],
                                         'mf2':d2[2]+q,
                                         'J1':1.0/2.0,
                                         'J2':j2,
                                         'I':7.0/2.0}
                                #this correction coefficient (see equation 54) should be written to atom.py later
                                rev = (-1)**(pair[0][1]-pair[1][1]+q)*math.sqrt((2*pair[0][1]+1)/(2*pair[1][1]+1))
                                rev = rev**2
                                tmp = Gamma*cs.cg_coef(**coef1)*cs.cg_coef(**coef2)*rev
                                if tmp != 0.0:
                                    ii = self.lfm2index(pair[0][0],pair[0][1],d1[2]+q)
                                    jj = self.lfm2index(pair[0][0],pair[0][1],d2[2]+q)
                                    self.parameter['decoherence_matrix'][i][j].append([ii,jj,tmp])
                                    if ii == jj:
                                        self.parameter['decoherence_matrix'][int(ii)][int(jj)].append([ii,jj,-1*tmp])
                                        #add to graph
                                        f1 = int(pair[0][1])
                                        f2 = int(pair[1][1])
                                        label = '%.2e'%tmp
                                        self.graph.add_edge(pydot.Edge(self.l1subn[f1][int(d1[2]+q+f1)],self.l0subn[f2][int(d1[2]+f2)],label = label))
开发者ID:double1010x2,项目名称:cesium,代码行数:87,代码来源:parameter_common.py

示例3: decoherence

# 需要导入模块: from atom import Atom [as 别名]
# 或者: from atom.Atom import cg_coef [as 别名]
def decoherence(parameter):
    Gamma = 2 * np.pi * 4.575e6  # this is parameter for D1 line
    n = parameter["n"]
    parameter["decoherence_matrix"] = [[[] for i in range(n)] for j in range(n)]
    cs = Atom()
    """
    e l=1 f=3 g l=0 f=4
    e l=1 f=3 g l=0 f=3
    """
    # for f in (3.0,4.0):
    #     for m in range(-1*f,f+1):
    #         for m2 in range(-3,4)
    #             for q in (-1.0,0.0,1.0):
    #                   coef1 = {'q':q,
    #                            'L1':0,
    #                            'L2':1,
    #                            'F1':f,
    #                            'F2':3,
    #                            'mf1':m,
    #                            'mf2':m2,
    #                            'J1':1.0/2.0,
    #                            'J2':1.0/2.0,
    #                            'I':7.0/2.0}
    #                   tmp = Gamma * pow(cs.cg_coef(**coef1),2)
    #                   parameter['decoherence_matrix'][i][j].append([lfm2index(pair[0][0],pair[0][1],d1[2]+q),lfm2index(pair[0][0],pair[0][1],d2[2]+q),tmp])
    # egpair=(((1,3),(0,4)),((1,3),(0,3)))
    egpair = (((1, 3), (0, 4)),)
    for pair in egpair:
        for i in range(n):
            for j in range(i, n):
                d1 = index2lfm(i)
                d2 = index2lfm(j)
                if d1[0:2] == pair[0] and d2[0:2] == pair[0]:
                    parameter["decoherence_matrix"][i][j].append([i, j, -1.0 * Gamma])
                elif d1[0:2] == pair[0] and d2[0:2] == pair[1]:
                    parameter["decoherence_matrix"][i][j].append([i, j, -1.0 * Gamma / 2.0])
                elif d1[0:2] == pair[1] and d2[0:2] == pair[0]:
                    parameter["decoherence_matrix"][i][j].append([i, j, -1.0 * Gamma / 2.0])
                elif d1[0:2] == pair[1] and d2[0:2] == pair[1]:
                    for q in (-1.0, 0.0, 1.0):
                        f1 = pair[0][1]
                        if (d1[2] + q <= f1 and d1[2] + q >= -1 * f1) and (d2[2] + q <= f1 and d2[2] + q >= -1 * f1):
                            coef1 = {
                                "q": q,
                                "L1": 0,
                                "L2": 1,
                                "F1": pair[1][1],
                                "F2": pair[0][1],
                                "mf1": d1[2],
                                "mf2": d1[2] + q,
                                "J1": 1.0 / 2.0,
                                "J2": 1.0 / 2.0,
                                "I": 7.0 / 2.0,
                            }
                            coef2 = {
                                "q": q,
                                "L1": 0,
                                "L2": 1,
                                "F1": pair[1][1],
                                "F2": pair[0][1],
                                "mf1": d2[2],
                                "mf2": d2[2] + q,
                                "J1": 1.0 / 2.0,
                                "J2": 1.0 / 2.0,
                                "I": 7.0 / 2.0,
                            }
                            tmp = Gamma * cs.cg_coef(**coef1) * cs.cg_coef(**coef2)
                            if tmp != 0.0:
                                parameter["decoherence_matrix"][i][j].append(
                                    [
                                        lfm2index(pair[0][0], pair[0][1], d1[2] + q),
                                        lfm2index(pair[0][0], pair[0][1], d2[2] + q),
                                        tmp,
                                    ]
                                )
    return parameter
开发者ID:lucasp0927,项目名称:cesium,代码行数:78,代码来源:parameter_d1_3.py


注:本文中的atom.Atom.cg_coef方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。