Exemplo 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)
Exemplo n.º 2
0
     
     if ida == n or n == None:
     
         H                       =   data[0]
         consts                  =   data[1]
         [nr, rmin, rmax]        =   data[3]
         [nphi, phimin, phimax]  =   data[4]
         
         hangle                  =   H/2/pi
         
         rs                      =   np.linspace(rmin, rmax, nr)
         phis                    =   np.linspace(phimin, phimax, nphi)  
         asurf                   =   surf(rs, phis)
         
         print consts, H
         ue                      =   u(opt, hangle, asurf.get_all_surf(), \
                                       phimax - phimin, 'roto_trans', consts)
         
         print ir
         umat                    =   read_umat(ir, opt, H)
 
         ue.set_u(umat) 
         energies                =   deform_energies(ue)
     
         if opt[1] == 3:
             print 'testing phi map..' 
             test_prime_maps(ue)
         
         print 'E_s'
         E_s_surf, E_s           =   energies.F_s()
     
         print 'E_b'