Beispiel #1
0
def run():
    # # configure logging
    logging.basicConfig(format='%(asctime)s %(message)s', datefmt='%m/%d/%Y %I:%M:%S %p', level=0)

    # # initialize a project
    project = Project('https://github.com/imodels/simgen/res/binary_lj_sim/online_project.yaml')

    generated_code = project.render('binary_lj_sim_prg', output_dir='./generated_code')

    print("Generated code:\n {}".format(generated_code))
    print("Additional files have been saved to: ./generated_code")
def run():
    res_dir = os.path.join(dirname(__file__), '..', '..', 'res', 'binary_lj_sim')

    manifest = {
        'title': 'Binary LJ Simulation',
        'code_path': [os.path.join(res_dir, 'code')],
        'concept_path': [os.path.join(res_dir, 'concepts')],
        'template_path': [os.path.join(res_dir, 'templates')]
    }

    project = Project(manifest)

    generated_code = project.render('binary_lj_sim_prg', output_dir='generated_code')

    print("Generated code:\n {}".format(generated_code))
    print("Additional files have been saved to: ./generated_code")
def run():
    # # configure logging
    # logging.basicConfig(format='%(asctime)s %(message)s', datefmt='%m/%d/%Y %I:%M:%S %p', level=0)

    # create a simulated online loader with explicit github url to local directory association
    loader = Loader()
    local_repo_dir = os.path.join(os.path.dirname(__file__),'..','..')
    loader.add_repo("https://github.com/imodels/simgen.git", local_repo_dir)

    # # initialize a project
    project = Project('https://github.com/imodels/simgen/res/binary_lj_sim/online_project.yaml', loader)

    generated_code = project.render('binary_lj_sim_prg', output_dir='./generated_code')

    print("Generated code:\n {}".format(generated_code))
    print("Additional files have been saved to: ./generated_code")
Beispiel #4
0
def run():

    res_dir = os.path.join(dirname(__file__), '..', '..', 'res', 'mbuild_test')

    manifest = {
        'title': 'mBuild example',
        'code_path': [os.path.join(res_dir, 'code')],
        'concept_path': [os.path.join(res_dir, 'concepts')],
        'template_path': [os.path.join(res_dir, 'templates')]
    }

    project = Project(manifest)

    ethane_box = build_ethane_box(n_molecules=200, box= [3, 3, 3])

    generated_code = project.render('prg', output_dir='./generated_code', inject_dict={'ethane_box': ethane_box})

    print("Generated code:\n {}".format(generated_code))
    print("Additional files have been saved to: ./generated_code")
Beispiel #5
0
def run():
    # # configure logging
    # logging.basicConfig(format='%(asctime)s %(message)s', datefmt='%m/%d/%Y %I:%M:%S %p', level=0)

    # create a simulated online loader with explicit github url to local directory association
    loader = Loader()
    local_repo_dir = os.path.join(os.path.dirname(__file__), '..', '..')
    loader.add_repo("https://github.com/imodels/simgen.git", local_repo_dir)

    # # initialize a project
    project = Project(
        'https://github.com/imodels/simgen/res/binary_lj_sim/online_project.yaml',
        loader)

    generated_code = project.render('binary_lj_sim_prg',
                                    output_dir='./generated_code')

    print("Generated code:\n {}".format(generated_code))
    print("Additional files have been saved to: ./generated_code")
Beispiel #6
0
def generate_code(**parameters):
    # import pdb; pdb.set_trace()

    if OFFLINE:
        # load simgen files from local folders
        res_dir = os.path.join(os.path.dirname(__file__), 'simgen_project')

        manifest = {
            'title': 'Monolayer example',
            'code_path': [os.path.join(res_dir, 'code')],
            'concept_path': [os.path.join(res_dir, 'concepts')],
            'template_path': [os.path.join(res_dir, 'templates')]
        }

        project = Project(manifest)
    else:
        # load sigmen files from GitHub
        project = Project(os.path.join(os.path.dirname(__file__), 'simgen_project', 'online_project.yaml'))

    return project.render_tasks('prg', output_dir='./', inject_dict=parameters)
Beispiel #7
0
def generate_code(**parameters):
    # import pdb; pdb.set_trace()

    if OFFLINE:
        # load simgen files from local folders
        res_dir = os.path.join(os.path.dirname(__file__), 'binary_lj_sim')

        manifest = {
            'title': 'Binary LJ Simulation Test Project with mBuild',
            'code_path': [os.path.join(res_dir, 'code')],
            'concept_path': [os.path.join(res_dir, 'concepts')],
            'template_path': [os.path.join(res_dir, 'templates')]
        }

        project = Project(manifest)
    else:
        # load sigmen files from GitHub
        project = Project(os.path.join(os.path.dirname(__file__), 'binary_lj_sim', 'online_project.yaml'))

    return project.render_tasks('prg', output_dir='./', inject_dict=parameters)
Beispiel #8
0
def run():

    res_dir = os.path.join(dirname(__file__), '..', '..', 'res', 'mbuild_test')

    manifest = {
        'title': 'mBuild example',
        'code_path': [os.path.join(res_dir, 'code')],
        'concept_path': [os.path.join(res_dir, 'concepts')],
        'template_path': [os.path.join(res_dir, 'templates')]
    }

    project = Project(manifest)

    ethane_box = build_ethane_box(n_molecules=200, box=[3, 3, 3])

    generated_code = project.render('prg',
                                    output_dir='./generated_code',
                                    inject_dict={'ethane_box': ethane_box})

    print("Generated code:\n {}".format(generated_code))
    print("Additional files have been saved to: ./generated_code")