- 以下脚本使用可执行程序:
bigstick.x, tropic1b.x, genstrength.x
- 使用 sd 壳相关文件:
sd.sps, usdb.int
- 结果文件:
pxnx.res, pxnx.e2.str
- 使用了 awk 语句:
awk 'BEGIN{print "'$A'"^0.16666666666666666666
这个语句的值就是'''$A'''^0.166666
这个式子的值,awk语句中使用shell变量需要加上三引号。
使用 awk 语句的值只需在 shell 语句中加上 $()
#!/bin/bash
Np=$1
Nn=$2
nucleus=p${Np}n${Nn}
Acore=16
A=$(( $Np + $Nn + $Acore ))
HOlength=$(awk 'BEGIN{print "'$A'"^0.16666666666666666666 }')
nkeep=50
echo ' '
echo ' Sample script to compute B(E2) using usdb interaction '
echo ' '
echo ' running tropic1b to generate E2 operator '
echo ' '
./tropic1b.x << input
sd ! BIGSTICK-format .sps file needed for code
2 ! menu option 2: E2
2 ! proton-neutron
y ! include cross-shell (irrelevant here)
$HOlength ! value of osc length = (A)^1/6 fm
1.5 0.5 ! effective charge for proton, neutron
usdb ! output file name
n ! in single-column xpn format? n = double column pns format
input
echo ' '
echo ' * * * * * * * * * * * * * * * * '
echo ' * * * * * * * * * * * * * * * * '
echo ' creating density matrices '
echo ' * * * * * * * * * * * * * * * *'
echo ' * * * * * * * * * * * * * * * * '
./bigstick.x << INPUT
dp ! menu choice -- proton neutron densities
$nucleus
sd ! name of .sp file (in this case, NuShell format)
$Np $Nn ! # of valence protons, neutrons
0 ! 2 x Jz of systems
usdb ! signal to read NuShell-format unnormalized interaction
1 $(( $Acore + 2 )) $A 0.3
end
ld ! Lanczos menu option
$nkeep 3000 ! # states to keep, max # iterations
INPUT
echo ' * * * * * * * '
echo ' * * * * * * * * * * * * * * * * '
echo ' * * * * * * * * * * * * * * * * '
echo 'finished with run '
echo ' * * * * * * * * * * * * * * * * '
echo ' * * * * * * * * * * * * * * * * '
echo ' * * * * * * * * '
./genstrength.x << input
usdb ! name of .opme
1 ! no additional scaling
$nucleus ! name of reference parent state file
$nkeep ! # of parent states
$nucleus ! name of reference daughter state file
$nkeep ! # of daughter states
$nucleus ! name of density file
n ! do not read in additional density files
$nucleus.e2 ! name of output
input
echo ' '
echo " B(E2)s written to "$nucleus".e2.str"
echo ' '