Example #1
0
def plot():
    
    system                          =   'spiral_w_wave_sqr'
    nr, nphi, phiperiod             =   20, 40, pi/3
    
    from os import listdir
    
    input_file_folder_consts        =   '/space/tohekorh/Spiral/bender_input/calc/consts/' \
                                           + '%s/phiper=%.2f/nr-nphi=%i-%i/'  \
                                            %(system, phiperiod, nr, nphi)
        #input_file_folder_moldy     =   '/space/tohekorh/Spiral/bender_input/calc/moldy/'

    
    for input_folder in listdir(input_file_folder_consts):
        input_file_folder   = input_file_folder_consts + input_folder + '/'
        
        if input_folder != 'store':
            for input_file in listdir(input_file_folder):
                if input_file[-3:] == 'txt':
                    if has_been_calculated(input_file_folder + input_file, 'read'):
                        in_file =  input_file_folder + input_file
                        if query_yes_no("plot this " + input_file, 'no'):
                            #study_height_synopsis(in_file)
                            #plot_e_surfaces(in_file, show = True)
                            #study_height_synopsis(in_file)
                            study_consts_proximity(in_file, acc = 30)
                        #ue              =   parse_u_from_file(input_file_folder +  input_file)
                        #params          =   read_bender_output(input_file_folder +  input_file)[0]
                        #ue.set_const(params[("consts")])
                        #energies        =   deform_energies(ue)
                        #E_b, E_s, E_b_surf, E_s_surf, normals  = energies.calc_energies()
                        
    write_total_synopsis(nr, nphi, phiperiod, system, input_file_folder_consts)
    
    study_total_synopsis(nr, nphi, phiperiod, system)
Example #2
0
def run_bender(param_set, in_file):

    system              =   param_set["system"]
    ir                  =   param_set["ir"]
    rmin, rmax          =   param_set["rmin"],  param_set["rmax"]
    height              =   param_set["height"]
    moldy_opm           =   param_set["moldy_opm"]
    
    print 'running system: ' + system + ', ir = ' + str(ir) 
    print 'height     = ' + str(height)
    print 'rmin, rmax = %.2f, %.2f' %(rmin, rmax)
    
    ue                  =   parse_u_from_file(in_file)
    optimize_c          =   optimize(ue, 'l_bfgs')
        
    if not moldy_opm:
            
        [E_b_surf, E_s_surf], [E_b, E_s], ue, normals   \
                        =   optimize_c.optimize_consts()
        
        write_bender(E_b_surf, E_s_surf, normals, E_b, E_s, \
                    ue, param_set, in_file)
        
        plot_e_surfaces(in_file)
        
        write_synopsis(in_file)
        
        if system != 'spiral':
            study_height_synopsis(in_file)
            try:
                study_consts_proximity(in_file, 20)
            except ValueError:
                print 'voi hoh'
        
        
        
    elif moldy_opm:
        
        #optimize_c  =   optimize(ue, 'l_bfgs')
        
        try:
            params      =   read_bender_output(in_file, read_for_moldy = True)[0]   
            ue.set_const(params[("consts")])
            ue.set_moldy(True)  
        
        except IOError:
            print 'got io error from trying to import constants for moldy opm!!'
            ue          =   optimize_c.optimize_consts()[2]
            
        
        [E_s_surf, E_b_surf], [E_b, E_s], ue    \
                    =   optimize_c.optimize_moldy()[:4]

        write_bender(E_b_surf, E_s_surf, E_b, E_s, ue, param_set)