Beispiel #1
0
def get_results(arc):

    if arc == 'gpu':
        try:
            import pycuda
            if sys.stdout != sys.__stdout__:
                atexit.register(report_g)
        except ImportError:
            if sys.stdout != sys.__stdout__:
                atexit.register(report_e)
    elif arc == 'cpu':
        if sys.stdout != sys.__stdout__:
            atexit.register(report_c)

    print('Generating results for lysozyme example...')
    if os.getcwd().rsplit('/', 1)[1] == 'tests':
        results = main(['', '../examples/lys'],
                       log_output=False,
                       return_results_dict=True)
    elif os.getcwd().rsplit('/', 1)[1] == 'pygbe':
        results = main(['', './examples/lys'],
                       log_output=False,
                       return_results_dict=True)
    else:
        print(
            "Run tests from either the main repo directory or the tests directory"
        )

    return results
Beispiel #2
0
def get_results():
    print('Generating results for lysozyme example...')
    if os.getcwd().rsplit('/', 1)[1] == 'tests':
        results = main(['','../examples/lys'],
                        log_output=False,
                        return_results_dict=True)
    elif os.getcwd().rsplit('/', 1)[1] == 'pygbe':
        results = main(['','./examples/lys'],
                        log_output=False,
                        return_results_dict=True)
    else:
        print("Run tests from either the main repo directory or the tests directory")

    return results
Beispiel #3
0
def get_results():
    print('Generating results for two spheres example...')
    if os.getcwd().rsplit('/', 1)[1] == 'tests':
        results = main(['','../examples/two_spheres'],
                        log_output=False,
                        return_results_dict=True)
    elif os.getcwd().rsplit('/', 1)[1] == 'pygbe':
        results = main(['','./examples/two_spheres'],
                        log_output=False,
                        return_results_dict=True)
    else:
        print("Run tests from either the main repo directory or the tests directory")

    return results
    folder_path = in_files_path + 'prism_reg_SE'
    full_path = os.path.abspath(folder_path) + '/'
    os.environ['PYGBE_PROBLEM_FOLDER'] = full_path

    #Creating dictionary field. We will modify the 'E' key in the for loop.
    field_dict_pillars = read_fields(full_path + 'prism_reg_38K.config')

    #Calculate Cext(lambda) for pillars' surface
    tic_ss = time.time()
    e_field = -1.
    wave, Cext_pillars = Cext_wave_scan(e_field, wave_s, diel_list,
                                        field_dict_pillars, full_path)
    toc_ss = time.time()

    numpy.savetxt('../results_data/prism_regular_SE_LE_res/' +
                  'prism_reg_38K_short_edge' + '10-20microns.txt',
                  list(zip(wave, Cext_pillars)),
                  fmt='%.9f %.9f',
                  header='lambda [Ang], Cext [nm^2]')

    time_simulation = (toc_ss - tic_ss)

    with open(
            '../results_data/prism_regular_SE_LE_res/Time_' +
            'prism_reg_38K_short_edge' + '.txt', 'w') as f:
        print('time_total: {} s'.format(time_simulation), file=f)


if __name__ == "__main__":
    main(sys.argv)