ARC代码计算三

文章介绍了使用Python编程实现的原子态相互作用计算函数,处理Cs和Rb82D态的C6系数,通过`PairStateInteractions`函数进行C6系数的perturbatively计算,给出了不同角度下的C6值。
摘要由CSDN通过智能技术生成

前面输入以及提取部分同前两个代码相同,带入后面的计算函数。

计算函数:

calc = PairStateInteractions(atom, n0, l, j, n0, l, j, j1, j2)

calc.getC6perturbatively (角度(弧度制).,0,5,3.000000e+10)

import sys, os
from arc import *
from arc.web_functionality import *

def transitTime (beam_waist,mean_speed):
    # in s
    beam_fwhm = beam_waist / 0.8493218
    return sqrt(pi)*beam_fwhm/(2.*mean_speed)

import re

# 输入字符串 
input_str = input("请输入: ")
#Rb 82 D_{3/2} 3/2 3/2 C6

# 定义匹配模式
pattern = r"([A-Za-z]+) (\d+) ([A-Za-z]+)_{(\d+)/(\d+)} (\d+)/(\d+) (\d+)/(\d+) C6"

# 使用 re.search 匹配模式
match = re.search(pattern, input_str)

if match:
    # 提取匹配的信息
    element = match.group(1)
    n0 = int(match.group(2))
    l = match.group(3)
    j = float(match.group(4))/float(match.group(5))
    j1 = float(match.group(6))/float(match.group(7))
    j2 = float(match.group(8))/float(match.group(9))
    
    # 打印提取的信息
    print("Element:", element)
    print("N0:", n0)
    print("L:", l)
    print("J:", j)
    print("J1:", j1)
    print("J2:", j2)
    
    if element=='Cs':    
        atom = Caesium()
    else:
        atom = Rubidium()
    
    # 判断子能级字母并转换为相应的数值
    if l == "S":
        l = 0
    elif l == "P":
        l = 1
    elif l == "D":
        l = 2
    elif l == "F":
        l = 3
    
    l = int(l)
    j = float(j)
    j1 = float(j1)
    j2 = float(j2)
else:
    print("No match found.")







if __name__ == '__main__':
    #calculation = PairStateInteractions(Rubidium(), n0, l0, j0, n0, l0, j0, mj0, mj0)
    calc = PairStateInteractions(atom, n0, l, j, n0, l, j, j1, j2)
    #C6 = calculation.getC6perturbatively(theta, phi, dn, deltaMax)
    print('c6(0) = ',calc.getC6perturbatively(0,0,5,3.000000e+10),'GHz (mu m)^6')
    print('c6(30) = ', calc.getC6perturbatively(pi/6.,0,5,3.000000e+10),'GHz (mu m)^6')
    print('c6(45) = ', calc.getC6perturbatively(pi/4.,0,5,3.000000e+10),'GHz (mu m)^6')
    print('c6(60) = ', calc.getC6perturbatively(pi/3.,0,5,3.000000e+10),'GHz (mu m)^6')
    print('c6(90) = ', calc.getC6perturbatively(pi/2.,0,5,3.000000e+10),'GHz (mu m)^6')

  • 13
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值