• PVPC运行脚本


    PAVPC,就是 projection after variation of pair condensate,是最近我和师兄写的代码,托管在:https://gitee.com/luyi07/pvpc.git

    1. run.sh

    现在给这个代码写一个脚本 run.sh,可以用来计算 (sd) 壳和 (pf) 壳的任意偶偶核的投影能谱和B(E2)值,只需给脚本传递 4 个参数即可:

    #!/bin/bash
    # ./run.sh x y sd nmini
    # variation + LAP + B(E2) for x proton pairs and y neutron pairs in sd shell
    
    pN=$1
    nN=$2
    shell=$3
    nmini=$4
    nucleus=p${pN}n${nN}
    
    jsp="example/$shell/$shell.jsp"
    int="example/$shell/$shell.pn"
    pjpair="output/best-proton.pair"
    njpair="output/best-neutron.pair"
    
    echo "======================================================================="
    echo "             variation starts "
    echo "-----------------------------------------------------------------------"
    ./pvpc.x << input
    v-wo-Pandya               # mode: optimize
    $nucleus        # nucleus
    $pN             # number of proton pairs
    $nN             # number of neutron pairs
    $jsp            # file for j-scheme single particle orbits
    xpn             # format of interactions: J-scheme P+Q interactions
    $int            # file for interactions
    y               # scaling
    y               # start from random pairs
    $nmini                # number of optimized pair condensates
    input
    echo "-----------------------------------------------------------------------"
    echo "             variation ends "
    echo "======================================================================="
    
    echo "======================================================================="
    echo "             LAP starts "
    echo "-----------------------------------------------------------------------"
    ./pvpc.x << Input
    LAP-wo-Pandya                     // mode
    $nucleus                    // nucleus
    $pN                       // # of proton pairs
    $nN                       // # of neutron pairs
    $jsp                       // file for j-scheme single particle space
    xpn                     // format of interactions
    $int                       // file for interactions
    y                       // scale or not
    1                       // number of pair condensates
    $pjpair   $njpair
    16                      // Jmax to be projected, not doubled
    Input
    echo "-----------------------------------------------------------------------"
    echo "              LAP ends "
    echo "======================================================================="
    
    echo "copy the lowest pairs into sdpairs/ or pfpairs/"
    cp $pjpair ${shell}pairs/$nucleus-best-proton.pair
    cp $njpair ${shell}pairs/$nucleus-best-neutron.pair
    
    pjpair=${shell}pairs/$nucleus-best-proton.pair
    njpair=${shell}pairs/$nucleus-best-neutron.pair
    unitchoice=1            # 1/2 for e2fm4 / W.u., 3 for e2fm4 with BAB's hbar omega
    
    echo " ----------------------------------------------- "
    echo "         Calculate B(E2) values    "
    echo " ----------------------------------------------- "
    ./pvpc.x << Input
    EMtrans                 # mode: E&M transition
    $nucleus                # nucleus name
    $pN                     # number of proton pairs
    $nN                     # number of neutron pairs
    $jsp                    # j-scheme single particle info
    xpn                     # interaction format
    $int                     # interaction file name
    y                       # scale or not
    1                       # number of pair condensates
    $pjpair  $njpair
    output/${shell}e2.jQt         # filejQt for transition operator
    e                       # electric
    2                       # quadrapole
    1.5  0.5                # ep, en
    $unitchoice                     # choice of unit, 1/2 for e2fm4/W.u.
    output/$nucleus.eig         # file for wavefunctions
    Input
    
    echo cp output/$nucleus.trans sdpairs/
    cp output/$nucleus.trans sdpairs/
    

    赋予脚本可执行权限,然后:

    ./run.sh 1 1 sd 5
    

    即对 Ne20 求 5 个低能的 pair condensate,然后取能量最低的,进行 LAP 投影,最后把最优的对命名为 pxnx-best-proton.pair, pxnx-best-neutron.pair,拷贝到 sdpairs/ 中,跃迁值命名为 pxnx.trans 也拷贝到 sdpairs/ 中。
    如果需要一次算好几个核,可以使用下面的代码:

    #!/bin/bash
    
    sleep 30
    date
    
    for(( pN = 3; pN <= 3; pN ++ ))
    do
            for(( nN = 1; nN <=5; nN ++ ))
            do
                    time ./run.sh $pN $nN sd 5
            done
    done
    date
    

    其中,sleep后面的参数是等待的秒数,设置适当的秒数,可以让办公室电脑等到晚上十点再启动,就不会打扰加班的同事。

    2. crank-linear.sh

    使用线性约束的crank-pvpc,即最小化 (langle H angle - omega langle J_z angle)
    似乎 crank 相比简单的 variation 会有更多的 minimum。

    #!/bin/bash
    #   example:  Mg24, omega = 1, optimize for 5 times
    #   ./crank-linear.sh 2 2 sd 1 5
    
    pN=$1
    nN=$2
    shell=$3
    omega=$4
    nPC=$5
    nucleus=p${pN}n${nN}
    jsp="example/$shell/$shell.jsp"
    int="example/$shell/$shell.pn"
    echo "======================================================================="
    echo    cranked  variation starts, omega = $omega
    echo "-----------------------------------------------------------------------"
    ./pvpc.x << input
    CrankLinear               # mode: optimize
    $nucleus          # nucleus
    $pN               # number of proton pairs
    $nN               # number of neutron pairs
    $jsp            # file for j-scheme single particle orbits
    xpn             # format of interactions: J-scheme P+Q interactions
    $int            # file for interactions
    y               # scaling
    y               # start from random pairs
    $omega          # omega
    $nPC            # number of pair condensates
    input
    echo "-----------------------------------------------------------------------"
    echo "  cranked variation ends "
    echo "======================================================================="
    
    echo "copy output/best-proton.pair and output/best-neutron.pair into ${shell}pairs/"
    cp output/best-proton.pair ${shell}pairs/$nucleus.omega=$omega.proton.pair
    cp output/best-neutron.pair ${shell}pairs/$nucleus.omega=$omega.neutron.pair
    
    bash ../sendEmail.sh
    

    sendEmail.sh 是另一个脚本,用来给自己发邮件,通知一声代码跑完了。

    #!/bin/bash
    
    LuYi="xx@126.com" #发件人邮箱
    pswd="xxx" # stmp password of my email account
    
    
    sendEmail -o message-charset='utf-8' -xu $LuYi -xp $pswd -t "luyi@qfnu.edu.cn" -u "swagger任务跑完了" -m " " -s smtp.126.com -f luyi19881007@126.com -a
    # -o message-charset='utf-8'    encoding of email contents
    # -xu/xp                        email account/passwd
    # -t                            destination
    # -u                            主题
    # -m                            正文
    # -s                            smtp服务器
    # -f                            来自xx的邮件
    # -a                            attachment
    

    3. LAP.sh

    用线性代数投影方法对sdpairs/, pfpairs/ 中的集体对凝聚进行角动量投影:

    #!/bin/bash
    # example: Ne20
    # ./LAP.sh 1 1 sd
    
    nucleus=test
    pN=$1
    nN=$2
    shell=$3
    nucleus=p${pN}n${nN}
    jsp="example/$shell/$shell.jsp"
    int="example/$shell/$shell.pn"
    pjpair=${shell}pairs/$nucleus-best-proton.pair
    njpair=${shell}pairs/$nucleus-best-neutron.pair
    
    ./pvpc.x << Input
    LAP-wo-Pandya                     // mode
    $nucleus                // nucleus
    $pN                     // # of proton pairs
    $nN                     // # of neutron pairs
    $jsp                    // file for j-scheme single particle space
    xpn                     // format of interactions
    $int                    // file for interactions
    y                       // scale or not
    1                       // number of pair condensates
    $pjpair   $njpair
    16                      // Jmax to be projected, not doubled
    Input
    

    4. e2.sh

    使用 sdpairs/ pfpairs/ 中的对,以及 output/pxnx.eig,进行 B(E2) 的计算。

    #!/bin/bash
    # e.g. B(E2) of Ne20 with pairs from sdpairs/:
    #./e2.sh 1 1 sd
    
    pN=$1
    nN=$2
    shell=$3
    nucleus=p${pN}n${nN}
    jsp=example/$shell/$shell.jsp
    int=example/$shell/$shell.pn
    pjpair=${shell}pairs/$nucleus-best-proton.pair
    njpair=${shell}pairs/$nucleus-best-neutron.pair
    unitchoice=1            # 1/2 for e2fm4 / W.u., 3 for e2fm4 with BAB's hbar omega
    
    echo " ----------------------------------------------- "
    echo "         Calculate B(E2) "
    echo " ----------------------------------------------- "
    ./pvpc.x << Input
    EMtrans                 # mode: E&M transition
    $nucleus                # nucleus name
    $pN                     # number of proton pairs
    $nN                     # number of neutron pairs
    $jsp                    # j-scheme single particle info
    xpn                     # interaction format
    $int                     # interaction file name
    y                       # scale or not
    1                       # number of pair condensates
    $pjpair  $njpair
    output/${shell}e2.jQt         # filejQt for transition operator
    e                       # electric
    2                       # quadrapole
    1.5  0.5                # ep, en
    $unitchoice                     # choice of unit, 1/2 for e2fm4/W.u.
    output/$nucleus.eig         # file for wavefunctions
    Input
    
    echo cp output/$nucleus.trans sdpairs/
    cp output/$nucleus.trans sdpairs/
    
    
  • 相关阅读:
    postgresql postgres.Jsonb
    gorm jsonb
    json
    postgresql重置序列和自增主键
    go build x509: certificate has expired or is not yet valid
    权限修饰符
    交换两个变量的值
    Java编译报错:编码GBK的不可映射字符
    原码反码补码的理解
    Scanner类中hasNext()方法的解析
  • 原文地址:https://www.cnblogs.com/luyi07/p/15404123.html
Copyright © 2020-2023  润新知