Ejemplo n.º 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
Ejemplo n.º 2
0
    loadsuf = ["K_{33}", "k_{24}", "\\Lambda", "d_0", "\\omega", "\\gamma_s"]
    savesuf = ["K_{33}", "k_{24}", "d_0", "\\omega", "\\gamma_s"]
    scan_dir = "scanforward"

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

    scan['\\Lambda'] = '0'
    scan['\\omega'] = '0'

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

    run = SingleRun(rp)

    E0, R0, eta0, delta0, surftwist0 = run.get_all_observables(
        'observables_Emin', str2float=True)

    scan['\\omega'] = omega

    scan['Rguess'] = str(R0)
    scan['Rupper'] = str(1.5 * R0)
    scan['Rlower'] = str(0.75 * R0)

    i = 0
    while (i < len(Lambdas)):

        Lambda = Lambdas[i]

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

        # read in file name info
Ejemplo n.º 3
0
        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:]):

                # write the remaining values of observables as those corresponding to the delta = 0
                # case, as non-zero d-band produces a higher energy fibril.
                scan['\\Lambda'] = str(Lambda)
Ejemplo n.º 4
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
Ejemplo n.º 5
0
        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.
        Ei, Ri, etai, deltai, surftwisti = run.get_all_observables(
            newobsname, str2float=True)

        if i == 0:

            # again, if the strain is zero, then I have just determined the equilibrium
            # inverse d band spacing, which I now need to set (and do so below).

            eta_eq = etai
            R_eq = Ri

        # now just adjust my guess for delta

        deltaguess = str(deltai)

        if np.abs(deltai) < 1e-5:
            break
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