Пример #1
0
def test_idempotence1(caplog):
    """Confirm that a work graph can be run repeatedly, even after completed.

    Use gmx.run and avoid extra references held by user code.
    """
    md = gmx.workflow.from_tpr(tpr_filename, threads_per_rank=1)
    gmx.run(md)
    gmx.run(md)
    gmx.run(md)
    md = gmx.workflow.from_tpr(tpr_filename, threads_per_rank=1)
    gmx.run(md)
    md = gmx.workflow.from_tpr(tpr_filename, threads_per_rank=1)
    gmx.run(md)
Пример #2
0
def test_modifiedInput(caplog):
    """Load a work specification with a single TPR file and updated params."""
    md = gmx.workflow.from_tpr(tpr_filename,
                               threads_per_rank=1,
                               end_time='0.02')
    context = gmx.get_context(md)
    with context as session:
        session.run()
    md = gmx.workflow.from_tpr(tpr_filename,
                               threads_per_rank=1,
                               end_time='0.03')
    context.work = md
    with context as session:
        session.run()
    md = gmx.workflow.from_tpr(tpr_filename,
                               threads_per_rank=1,
                               end_time='0.04')
    gmx.run(md)
Пример #3
0
converge = gmx.subgraph(variables={
    'conformation': initial_input,
})

with converge:
    modified_input = gmx.modify_input(input=initial_input,
                                      structure=converge.conformation)
    myplugin.converge_restraint(label='converging_potential',
                                params=train_loop.training_potential.output)
    brer_tools.converge_analyzer(
        converge.converging_potential.output.distances,
        label='is_converged',
    )
    md = gmx.mdrun(input=modified_input,
                   potential=converge.converging_potential)

conv_loop = gmx.while_loop(operation=converge,
                           condition=gmx.logical_not(converge.is_converged))

production_input = gmx.modify_input(input=initial_input,
                                    structure=converge.conformation)
prod_potential = myplugin.production_restraint(
    params=converge.converging_potential.output)
prod_md = gmx.mdrun(input=production_input, potential=prod_potential)

gmx.run()

print('Final alpha value was {}'.format(
    train_loop.training_potential.output.alpha.result()))
# also can extract conformation filenames, etc.
Пример #4
0
 def run(self):
     gmx.run(work=self.workflow)
Пример #5
0
    # Compare the distribution from the current iteration to the experimental
    # data and look for a threshold of low J-S divergence
    # We perform the calculation using all of the ensemble data.
    js_1 = calculate_js(
        input={
            'params': restraint1_params,
            'simulation_distances': gmx.gather(potential1.output.pair_distance)
        })
    js_2 = calculate_js(
        input={
            'params': restraint2_params,
            'simulation_distances': gmx.gather(potential2.output.pair_distance)
        })
    gmx.logical_and(js_1.is_converged, js_2.is_converged, label='is_converged')

    converge.pair_distance1 = potential1.output.pair_distance
    converge.pair_distance2 = potential2.output.pair_distance

work = gmx.while_loop(operation=converge,
                      condition=gmx.logical_not(converge.is_converged))

# Command-line arguments for mdrun can be added to gmx run as below.
# Settings for a 20 core HPC node. Use 18 threads for domain decomposition for pair potentials
# and the remaining 2 threads for PME electrostatics.
gmx.run(work,
        tmpi=20,
        grid=gmx.NDArray([3, 3, 2]),
        ntomp_pme=1,
        npme=2,
        ntomp=1)
Пример #6
0
def test_simpleSimulation(caplog):
    """Load a work specification with a single TPR file and run."""
    # use case 1: simple high-level
    md = gmx.workflow.from_tpr(tpr_filename, threads_per_rank=1)
    gmx.run(md)