コード例 #1
0
def single_E_calc(gamma, scan, scan_dir, fwd_ic, bwd_ic):

    loadsuf = ["K_{33}", "k_{24}", "\\Lambda", "\\omega", "\\gamma_s"]
    savesuf = ["K_{33}", "k_{24}", "\\Lambda", "\\omega"]

    scan['\\gamma_s'] = str(gamma)

    ic_dict = {}

    if scan_dir == "scanforward":

        ic_dict = fwd_ic

    elif scan_dir == "scanbackward":

        ic_dict = bwd_ic

    scan['Rguess'] = str(ic_dict['Rguess0'])
    scan['Rupper'] = str(ic_dict['Rupper0'])
    scan['Rlower'] = str(ic_dict['Rlower0'])

    scan['etaguess'] = str(ic_dict['etaguess0'])
    scan['etaupper'] = str(ic_dict['etaupper0'])
    scan['etalower'] = str(ic_dict['etalower0'])

    scan['deltaguess'] = str(ic_dict['deltaguess0'])
    scan['deltaupper'] = str(ic_dict['deltaupper0'])
    scan['deltalower'] = str(ic_dict['deltalower0'])

    # read in file name info
    rp = ReadParams(scan=scan, loadsuf=loadsuf, savesuf=savesuf)

    # create a class to do calculations with current parameters in scan.
    run = SingleRun(rp, scan_dir=scan_dir)

    # run C executable.
    run.run_exe()

    # move file written by C executable from temporary data path to true data path
    run.mv_file('observables')

    # load the final values of E, R, eta, delta, and surface twist.
    Ei, Ri, etai, deltai, surftwisti = run.get_all_observables('observables',
                                                               str2float=True)

    run.concatenate_observables(["\\gamma_s"])

    return Ei, Ri, etai, deltai
コード例 #2
0
        user_input = input("input string of a gamma,k24,Lambda,omega values, "
                           "using comma as delimiter: ")
        gamma, k24, Lambda, omega = user_input.split(',')

    else:
        gamma, k24, Lambda, omega = sys.argv[1], sys.argv[2], sys.argv[
            3], sys.argv[4]

    scan = {}
    scan['k_{24}'] = k24
    scan['\\gamma_s'] = gamma
    scan['\\Lambda'] = Lambda
    scan['\\omega'] = omega

    loadsuf = ["K_{33}", "k_{24}", "\\Lambda", "\\omega", "\\gamma_s"]

    # read in file name info
    rp = ReadParams(scan=scan, loadsuf=loadsuf, savesuf=loadsuf)

    # create a class to do calculations with current parameters in scan.
    run = SingleRun(rp,
                    executable="../../../bin/full4var_psivsr",
                    valgrind=True)
    # run C executable.
    run.run_exe()

    # move file written by C executable from temporary data path to true data path
    run.mv_file('observables')
    run.mv_file('psivsr')
コード例 #3
0
        Lambda = Lambdas[i]

        scan['\\Lambda'] = str(Lambda)

        # read in file name info
        rp = ReadParams(scan=scan, loadsuf=loadsuf, savesuf=savesuf)

        # create a class to do calculations with current parameters in scan.
        run = SingleRun(rp, scan_dir=scan_dir)

        # run C executable.
        run.run_exe()

        # move file written by C executable from temporary data path to true data path
        run.mv_file('observables')

        # load the final values of E, R, eta, delta, and surface twist.
        Ei, Ri, etai, deltai, surftwisti = run.get_all_observables(
            'observables', str2float=True)

        if (Ei > 0.1 * FAILED_E):

            # if the energy calculation fails, this will be true.
            print('hi')
            # remove current file with observables for the current Lambda value that are higher than
            # the delta = 0 energy.
            print(Ei)
            run.remove_file("observables")

            for j, Lambda in enumerate(Lambdas[i:]):
コード例 #4
0
            strain = str(u)

        # read in file name info
        rp = ReadParams(scan=scan, loadsuf=loadsuf, savesuf=savesuf)

        # create a class to do calculations with current parameters in scan.
        run = SingleRun(rp,
                        scan_dir=scan_dir,
                        executable=executable,
                        strain=strain)

        # run C executable.
        run.run_exe()

        # move file written by C executable from temporary data path to true data path
        run.mv_file(f'observables')

        run.mv_file('psivsr', strain=strain)

        psistuff = PsiData(scan=scan,
                           loadsuf=loadsuf,
                           savesuf=savesuf,
                           name=f"psivsr",
                           strain=strain)

        rs = psistuff.r()
        psis = psistuff.psi()

        psiav = simps(integrand(rs, psis), rs)

        run.remove_file(fname="psivsr", strain=strain)
コード例 #5
0
def single_E_calc(gamma, scan, loadsuf, savesuf, scan_dir):

    scan['\\gamma_s'] = str(gamma)

    if scan_dir == "scanforward":

        Rguess0 = 0.044
        Rlower0 = 0.04
        Rupper0 = 0.05

        etaguess0 = 6.29
        etalower0 = 6.3
        etaupper0 = 6.287

        deltaguess0 = 0.74
        deltalower0 = 0.72
        deltaupper0 = 0.8

    else:

        Rguess0 = 1.5
        Rlower0 = 1.0
        Rupper0 = 2.0

        etaguess0 = 6.4
        etalower0 = 6.38
        etaupper0 = 6.42

        deltaguess0 = 0.815
        deltalower0 = 0.813
        deltaupper0 = 0.816

    scan['Rguess'] = str(Rguess0)
    scan['Rupper'] = str(Rupper0)
    scan['Rlower'] = str(Rlower0)

    scan['etaguess'] = str(etaguess0)
    scan['etaupper'] = str(etaupper0)
    scan['etalower'] = str(etalower0)

    scan['deltaguess'] = str(deltaguess0)
    scan['deltaupper'] = str(deltaupper0)
    scan['deltalower'] = str(deltalower0)

    # read in file name info
    rp = ReadParams(scan=scan, loadsuf=loadsuf, savesuf=savesuf)

    # create a class to do calculations with current parameters in scan.
    run = SingleRun(rp, scan_dir=scan_dir)

    # run C executable.
    run.run_exe()

    # move file written by C executable from temporary data path to true data path
    run.mv_file('observables')

    # load the final values of E, R, eta, delta, and surface twist.
    Ei, Ri, etai, deltai, surftwisti = run.get_all_observables('observables',
                                                               str2float=True)

    run.concatenate_observables(["\\gamma_s"])

    return Ei, Ri
コード例 #6
0
            executable = "../../../bin/delta1var_psivsr"
            scan['etaguess'] = str(eta_eq / (1 + u))
            scan['Rguess'] = str(R_eq / np.sqrt(1 + u))
            strain = str(u)

        # read in file name info
        rp = ReadParams(scan=scan, loadsuf=loadsuf, savesuf=savesuf)

        # create a class to do calculations with current parameters in scan.
        run = SingleRun(rp, executable=executable, strain=strain)

        # run C executable.
        run.run_exe()

        # move file written by C executable from temporary data path to true data path
        run.mv_file(f'observables', newname=newobsname)

        run.mv_file('psivsr', newname=newpsiname, strain=strain)

        psistuff = PsiData(scan=scan,
                           loadsuf=loadsuf,
                           savesuf=savesuf,
                           name=newpsiname,
                           strain=strain)

        rs = psistuff.r()
        psis = psistuff.psi()

        psiav = simps(integrand(rs, psis), rs)

        # load the final values of E, R, eta, delta, and surface twist.
コード例 #7
0
import numpy as np
import subprocess
import sys
sys.path.append('../../modules_gammak24/')
from singlerun import SingleRun
from readparams import ReadParams

if __name__ == "__main__":

    gamma, k24 = sys.argv[1], sys.argv[2]

    loadsuf = ["K_{33}", "k_{24}", "\\Lambda", "d_0", "\\omega", "\\gamma_s"]
    savesuf = ["K_{33}", "k_{24}", "d_0", "\\omega", "\\gamma_s"]

    scan = {}
    scan['k_{24}'] = k24
    scan['\\gamma_s'] = gamma
    scan['\\omega'] = '0'
    scan['\\Lambda'] = '0'

    # find minimum for delta = 0 case, so you know the upper bound for
    # the energy minimum.

    rp = ReadParams(scan=scan, loadsuf=loadsuf, savesuf=savesuf)

    run = SingleRun(rp)

    run.run_exe()

    run.mv_file('observables', newname='observables_Emin')
コード例 #8
0
    scan['k_{24}'] = k24
    scan['\\gamma_s'] = gamma
    scan['\\Lambda']=Lambda
    scan['\\omega']= omega
    
    loadsuf=["K_{33}","k_{24}","\\Lambda","\\omega","\\gamma_s"]


    # read in file name info
    rp = ReadParams(scan=scan,loadsuf=loadsuf,savesuf=loadsuf)
        
    # create a class to do calculations with current parameters in scan.
    run = SingleRun(rp,executable="../../../bin/samplecalc_testEvspsip_s")
    # run C executable.
    run.run_exe()
    dataname = run.mv_file('Evspsip_s')

    data = np.loadtxt(dataname)


    psip_ss = data[:,0]
    Es = data[:,1]
    dEdpsip_ss = data[:,2]

    # determine where the min of Es occurs
    i_min = np.argmin(Es)

    # determine where the zero of dEdpsip_ss occur (should be at the same spot
    # as where the min above occurs according to calculus).
    j_zero1 = np.argmin(np.abs(dEdpsip_ss))
       
コード例 #9
0
    scan['\\Lambda']=Lambda
    scan['\\omega']= omega
    
    loadsuf=["K_{33}","k_{24}","\\Lambda","\\omega","\\gamma_s"]


    # read in file name info
    rp = ReadParams(scan=scan,loadsuf=loadsuf,savesuf=loadsuf)
        
    # create a class to do calculations with current parameters in scan.
    run = SingleRun(rp,executable="../../../bin/samplecalc_testenergy")
    # run C executable.
    run.run_exe()

    # move file written by C executable from temporary data path to true data path
    run.mv_file('psivsr_discrete')



    c_data = np.loadtxt("data/_psivsr_3.0000e+01_1.0000e-01_1.0000e+03_5.0000e+00_4.0000e-02.txt")
    d_data = np.loadtxt("data/_psivsr_discrete_3.0000e+01_1.0000e-01_1.0000e+03_5.0000e+00_4.0000e-02.txt")



    c_rs = c_data[:,0]
    c_psis = c_data[:,1]
    c_rfs = c_data[:,3]

    c_dx = c_rs[1]-c_rs[0]

    d_rs = d_data[:,0]
コード例 #10
0
    scan['\\Lambda']=Lambda
    scan['\\omega']= omega
    scan['mpt'] = str(2**power2)
    
    loadsuf=["K_{33}","k_{24}","\\Lambda","\\omega","\\gamma_s"]


    # read in file name info
    rp = ReadParams(scan=scan,loadsuf=loadsuf,savesuf=loadsuf)
        
    # create a class to do calculations with current parameters in scan.
    run = SingleRun(rp,executable="../../../bin/EvsR_c-different-grid-sizes",valgrind=False)
    # run C executable.

    start = time.time()
    
    run.run_exe()

    totaltime = time.time()-start



    with open("data/timings.txt","a") as myfile:
        myfile.write(f"{scan['mpt']}\t{totaltime:e}\n")

    # move file written by C executable from temporary data path to true data path
    run.mv_file(f"EvsR_c-{scan['mpt']}")



コード例 #11
0
    scan['k_{24}'] = k24
    scan['\\gamma_s'] = gamma
    scan['\\Lambda']=Lambda
    scan['\\omega']= omega
    
    loadsuf=["K_{33}","k_{24}","\\Lambda","\\omega","\\gamma_s"]


    # read in file name info
    rp = ReadParams(scan=scan,loadsuf=loadsuf,savesuf=loadsuf)
        
    # create a class to do calculations with current parameters in scan.
    run = SingleRun(rp,executable="../../../bin/f2_func")
    # run C executable.
    run.run_exe()
    dataname = run.mv_file('f2_func')

    data = np.loadtxt(dataname)


    zetas = data[:,0]
    f2s = data[:,1]
    df2dxis = data[:,2]
    df2dzetas = data[:,3]
        

    # plot Es vs psip_Rs and dEdpsip_Rs vs psip_Rs

    fig,axarr = plt.subplots(3,sharex=True)

    fig.set_size_inches(6,14)
コード例 #12
0
import numpy as np
import subprocess
import sys
sys.path.append('../../modules_gammak24/')
from singlerun import SingleRun

if __name__ == "__main__":

    datfile = "data/input.dat"
    executable = "../../../bin/gamma_k24_space"

    scan = {'\Lambda': sys.argv[1], '\omega': sys.argv[2]}
    run = SingleRun(datfile,
                    executable=executable,
                    scan=scan,
                    suffixlist=["K_{33}", "\\Lambda", "d_0", "\\omega"])

    run.run_exe()

    run.mv_file('energy')
    run.mv_file('surfacetwist')
    run.mv_file('radius')
    run.mv_file('eta')
    run.mv_file('delta')
def single_E_calc(gamma,scan,loadsuf,savesuf,scan_dir):

    scan['\\gamma_s'] = str(gamma)

    k240 = 0.33

    k24 = float(scan['k_{24}'])

    t = (k24-k240)/k240

    if scan_dir == "scanforward":

        #Rguess0 = 0.045
        #Rupper0 = 0.6
        #Rlower0 = 0.4

        Rguess0 = lower_Rguess(t)
        Rupper0 = Rguess0*1.1
        Rlower0 = Rguess0*0.9

        etaguess0 = 6.295
        etalower0 = 6.29
        etaupper0 = 6.3

        deltaguess0 = 0.8
        deltalower0 = 0.799
        deltaupper0 = 0.805

    else:

        #Rguess0 = 0.7
        #Rupper0 = 0.9
        #Rlower0 = 0.6

        Rguess0 = upper_Rguess(t)
        Rupper0 = Rguess0*1.1
        Rlower0 = Rguess0*0.9

        etaguess0 = 6.34
        etalower0 = 6.32
        etaupper0 = 6.36

        deltaguess0 = 0.813
        deltalower0 = 0.808
        deltaupper0 = 0.816


    scan['Rguess'] = str(Rguess0)
    scan['Rupper'] = str(Rupper0)
    scan['Rlower'] = str(Rlower0)

    scan['etaguess'] = str(etaguess0)
    scan['etaupper'] = str(etaupper0)
    scan['etalower'] = str(etalower0)

    scan['deltaguess'] = str(deltaguess0)
    scan['deltaupper'] = str(deltaupper0)
    scan['deltalower'] = str(deltalower0)


    # read in file name info
    rp = ReadParams(scan=scan,loadsuf=loadsuf,savesuf=savesuf)

    # create a class to do calculations with current parameters in scan.
    run = SingleRun(rp,scan_dir=scan_dir)

    # run C executable.
    run.run_exe()

    # move file written by C executable from temporary data path to true data path
    run.mv_file('observables')

    # load the final values of E, R, eta, delta, and surface twist.
    Ei,Ri,etai,deltai,surftwisti = run.get_all_observables('observables',str2float=True)

    run.concatenate_observables(["\\gamma_s"])

    return Ei,Ri
コード例 #14
0
    scan['k_{24}'] = k24
    scan['\\gamma_s'] = gamma
    scan['\\Lambda']=Lambda
    scan['\\omega']= omega
    
    loadsuf=["K_{33}","k_{24}","\\Lambda","\\omega","\\gamma_s"]


    # read in file name info
    rp = ReadParams(scan=scan,loadsuf=loadsuf,savesuf=loadsuf)
        
    # create a class to do calculations with current parameters in scan.
    run = SingleRun(rp,executable="../../../bin/g1_func")
    # run C executable.
    run.run_exe()
    dataname = run.mv_file('g1_func')

    data = np.loadtxt(dataname)


    zetas = data[:,0]
    g1s = data[:,1]
    dg1dxis = data[:,2]
    dg1dzetas = data[:,3]
        

    # plot Es vs psip_Rs and dEdpsip_Rs vs psip_Rs

    fig,axarr = plt.subplots(3,sharex=True)

    fig.set_size_inches(6,14)
コード例 #15
0
    scan = {}
    scan['k_{24}'] = k24
    scan['\\gamma_s'] = gamma
    scan['\\Lambda'] = Lambda
    scan['\\omega'] = omega

    loadsuf = ["K_{33}", "k_{24}", "\\Lambda", "\\omega", "\\gamma_s"]

    # read in file name info
    rp = ReadParams(scan=scan, loadsuf=loadsuf, savesuf=loadsuf)

    # create a class to do calculations with current parameters in scan.
    run = SingleRun(rp, executable="../../../bin/EvsR_s")
    # run C executable.
    run.run_exe()
    dataname = run.mv_file('EvsR_s')

    data = np.loadtxt(dataname)

    R_ss = data[:, 0]
    Es = data[:, 1]
    dEdR_ss = data[:, 2]

    # determine where the min of Es occurs
    i_min = np.argmin(Es)

    # determine where the zero of dEdR_ss occur (should be at the same spot
    # as where the min above occurs according to calculus).
    j_zero1 = np.argmin(np.abs(dEdR_ss))

    dEs = np.gradient(Es, R_ss)
コード例 #16
0
from readparams import ReadParams

if __name__ == "__main__":

    gamma = str(0.04)
    k24 = str(0.5)
    Lambda = str(600.0)
    omega = str(20.0)

    scan = {}
    scan['k_{24}'] = k24
    scan['\\gamma_s'] = gamma
    scan['\\Lambda'] = Lambda
    scan['\\omega'] = omega

    loadsuf = ["K_{33}", "k_{24}", "\\Lambda", "\\omega", "\\gamma_s"]

    # read in file name info
    rp = ReadParams(scan=scan, loadsuf=loadsuf, savesuf=loadsuf)

    # create a class to do calculations with current parameters in scan.
    run = SingleRun(rp,
                    executable="../../../bin/psi-with-hermite-fit",
                    valgrind=False)
    # run C executable.
    run.run_exe()

    # move file written by C executable from temporary data path to true data path
    run.mv_file('psivsr')
    run.mv_file('hermite-psivsr')