写一个脚本,循环运行壳模型程序 bigstick.x,收集结果
BigStickPublick 可以从 github 上下载:https://github.com/cwjsdsu/BigstickPublick
在 BigStickPulick 路径下,准备好 usdb.sp 和 usdbpn.int (upn格式),编写脚本跑遍 sd 壳所有偶偶核的能谱:
#!/bin/bash
# calculate spectrum and wavefunctions
# generate proper input file, and run bigstick
rm ../input/p* # delete input files, as initialization
echo -n "Start running. "
echo $(date)
for(( pN=0; pN<=6; pN++ ))
do
for(( nN=$pN; nN<=6; nN++ ))
do
Np=$(($pN*2))
Nn=$(($nN*2))
echo "Np=$Np, Nn=$Nn"
filename="../input/p"$Np"n"$Nn"_cin_bigstick.txt" # input file
rm $filename
touch $filename # 准备一个 bigstick 的 std 输入文件
echo "e">>$filename # calculate spectrum
echo "../output/p"$Np"n"$Nn>>$filename # output file name
echo "usdbpn">>$filename # usdbpn.sp
echo $Np" "$Nn>>$filename # Np Nn values
echo "0">>$filename # M=0
echo "upn">>$filename # format of interaction file
echo "usdbpn">>$filename # interaction file
echo "1 18 $(($Np+$Nn+16)) 0.3">>$filename # scaling
echo "1 1 1 1 1">>$filename # scaling
echo "end">>$filename # no more interactions
echo "ld">>$filename # lanczos default
echo "5 2000">>$filename # keep 5 states, at most 2000 iterations
time ./bigstick.x < $filename # run bigstick
done
done
这个脚本自动生成一个 ../input/pxnx_cin_bigstick.txt 的输入文件,然后执行 time ./bigstick.x < $filename
这一句,跑 bigstick 程序,输出能谱到 ../output/pxnx.res,文件中的内容是如下格式的:
BIGSTICK Version 7.8.4 Apr 2018
single-particle file = usdbpn
4 4
0 +
120 iterations
State E Ex J T
1 -87.10445 0.00000 -0.000 0.000
2 -85.60215 1.50230 2.000 0.000
3 -82.98830 4.11615 2.000 0.000
4 -82.73201 4.37243 4.000 0.000
5 -82.03408 5.07037 3.000 0.000
下面的函数遍历 sd 壳偶偶核的 ../output/pxnx.res 文件,进行基态能量提取。因为壳模型相互作用具有同位旋对称性,所以只需要计算 \(N >= Z\) 的核,然后提取两个镜像对称核的(相同的)基态能量即可。
void GetSMEgs( double ** SMEgs ){
double Egs;
string reshead = "../p", restail=".res", res;
for(int Np = 0; Np <=12; Np +=2 ){
for(int Nn = Np; Nn <= 12; Nn +=2 ){
res = reshead;
if( Np < 10 ) res += (char)(48+Np);
else res = res + (char)(48 + Np/10) + (char)(48 + Np%10);
res += "n";
if( Nn < 10 ) res += (char)(48+Nn);
else res = res + (char)(48 + Nn/10) + (char)(48 + Nn%10);
res += restail;
cout<<"Np = "<<Np<<", Nn = "<<Nn<<", res = "<<res<<endl;
double Egs;
ifstream fin(res);
stringstream strm; string line, headword;
while( !fin.eof() && headword != "State" ){
getline(fin, line); strm.clear(); strm.str(line); strm>>headword;
}
getline(fin, line); strm.clear(); strm.str(line); strm>>headword >> Egs;
fin.close();
cout<<"Egs = "<<Egs<<endl;
SMEgs[ Np/2 ][ Nn/2 ] = Egs;
SMEgs[ Nn/2 ][ Np/2 ] = Egs;
}
}
}
这样就得到了壳模型 usdb sd 壳所有偶偶核基态能量,都储存在 SMEgs[ Np/2 ][ Nn/2 ]
里面。