Esempio n. 1
0
def study_consts_proximity(in_file, acc = 3):
    
    print 'studying consts proximity..'
    
    try:
        params, asurf =   read_bender_output(in_file)[:2] # + 'params.txt')
    except IOError as e:
        print 'there, is no file for this input... got ' + e 
    
    #print params[("consts")]
                
    phi_period  =   params[("phiperiod")]
    hangle      =   params[("height")] / 2 / pi
    system      =   params[("system")]
    
    ue          =   u(hangle, phi_period, asurf, system = system, consts = params[("consts")])
    energies    =   deform_energies(ue)
    
    delx        =   abs(params[("consts")][0]) / 10.
    delA        =   abs(params[("consts")][1]) / 2.
    x, A        =   params[("consts")][:2]

    if delA     ==   0.:
        Amin    =   0
        Amax    =   params[("height")]/70.
    else:
        Amin, Amax =   A - 2*delA, A + delA
    
    x_set       =   np.linspace(x - delx, x + delx, acc)        
    A_set       =   np.linspace(Amin, Amax, acc)  
    curve_start =   params[("consts")][2]
    mid         =   params[("consts")][3]
    n_wave      =   params[("consts")][4]
    
    mesh_x, mesh_A \
                =   meshgrid(x_set, A_set)  
    
    E_b_mat     =   np.zeros(mesh_x.shape)
    E_s_mat     =   np.zeros(mesh_x.shape)
    
    for index, x in np.ndenumerate(mesh_x):
        A       =   mesh_A[index]
        consts  =   [x, A, curve_start, mid, n_wave]
        E_b_mat[index], E_s_mat[index] \
                =   energies.calc_energies(consts)[:2]
        
    #print E_s_mat
    #print E_b_mat
    
    folder = parse_path(params, params[("moldy_opm")]) + 'opm_consts_proxm/'
    
    if not exists(folder):
        makedirs(folder)   
    
    np.save(folder + 'mesh_x'   , mesh_x) 
    np.save(folder + 'mesh_A'   , mesh_A) 
    np.save(folder + 'E_b_mat_consts_proxm', E_b_mat) 
    np.save(folder + 'E_s_mat_consts_proxm', E_s_mat) 
    
    plot_consts_proxm(mesh_x, mesh_A, E_b_mat, E_s_mat, folder, from_file = False, acc = acc)
Esempio n. 2
0
def study_consts_proximity_from_file():
    
    in_file = '/space/tohekorh/Spiral/bender_input/calc/consts/in_8-16_H=73.0.txt'
    
    params  =   read_bender_output(in_file)[0] # + 'params.txt')
    folder  =   parse_path(params, params[("moldy_opm")]) + 'opm_consts_proxm/'
    
    mesh_x  =   np.load(folder + 'mesh_x.npy') 
    mesh_A  =   np.load(folder + 'mesh_A.npy') 
    E_b_mat =   np.load(folder + 'E_b_mat_consts_proxm.npy') 
    E_s_mat =   np.load(folder + 'E_s_mat_consts_proxm.npy') 
    
    #print params[("consts")][0]
    
    plot_consts_proxm(mesh_x, mesh_A, E_b_mat, E_s_mat, folder, from_file = True)

#study_height_synopsis()  
#study_consts_proximity_from_file()
#study_consts_proximity('/space/tohekorh/Spiral/bender_input/calc/consts/in_8-16_H=73.0.txt')