示例#1
0
# To help us fund GROMACS development, we humbly ask that you cite
# the research papers on the package. Check out http://www.gromacs.org.

"""Test gmxapi functionality described in roadmap.rst."""

import os
import shutil
import stat
import tempfile

import gmxapi as gmx
import pytest
from gmxapi.version import has_feature


@pytest.mark.skipif(not has_feature('fr3'),
                    reason="Feature level not met.")
def test_fr3():
    """FR3: Output proxy can be used as input."""
    with tempfile.TemporaryDirectory() as directory:
        file1 = os.path.join(directory, 'input')
        file2 = os.path.join(directory, 'output')

        # Make a shell script that acts like the type of tool we are wrapping.
        scriptname = os.path.join(directory, 'clicommand.sh')
        with open(scriptname, 'w') as fh:
            fh.write('\n'.join(['#!' + shutil.which('bash'),
                                '# Concatenate an input file and a string argument to an output file.',
                                '# Mock a utility with the tested syntax.',
                                '#     clicommand.sh "some words" -i inputfile -o outputfile',
                                'echo $1 | cat $3 - > $5\n']))
示例#2
0
# consider code for inclusion in the official distribution, but
# derived work must not be called official GROMACS. Details are found
# in the README & COPYING files - if they are missing, get the
# official version at http://www.gromacs.org.
#
# To help us fund GROMACS development, we humbly ask that you cite
# the research papers on the package. Check out http://www.gromacs.org.
"""Test gmxapi functionality described in roadmap.rst."""

import pytest

import gmxapi as gmx
from gmxapi.version import has_feature


@pytest.mark.skipif(not has_feature('fr15'), reason="Feature level not met.")
def test_fr15():
    """FR15: Simulation input modification.

    * *gmx.modify_input produces new (tpr) simulation input in data flow operation*
      (requires interaction with library development)
    * gmx.make_input dispatches appropriate preprocessing for file or in-memory simulation input.
    """
    initial_input = gmx.read_tpr([tpr_filename for _ in range(10)])
    tau_t = list([i / 10. for i in range(10)])
    param_sweep = gmx.modify_input(input=initial_input,
                                   parameters={'tau_t': tau_t})
    md = gmx.mdrun(param_sweep)
    for tau_expected, tau_actual in zip(tau_t,
                                        md.output.params['tau_t'].extract()):
        assert tau_expected == tau_actual
示例#3
0
#
# If you want to redistribute modifications to GROMACS, please
# consider that scientific software is very special. Version
# control is crucial - bugs must be traceable. We will be happy to
# consider code for inclusion in the official distribution, but
# derived work must not be called official GROMACS. Details are found
# in the README & COPYING files - if they are missing, get the
# official version at http://www.gromacs.org.
#
# To help us fund GROMACS development, we humbly ask that you cite
# the research papers on the package. Check out http://www.gromacs.org.

"""Test gmxapi functionality described in roadmap.rst."""

import pytest

import gmxapi as gmx
from gmxapi.version import has_feature

@pytest.mark.skipif(not has_feature('fr20'),
                   reason="Feature level not met.")
def test_fr20():
    """FR20: Python bindings use C++ API for expressing user interface

    gmx.tool operations are migrated to updated Options infrastructure
    (requires interaction with library development)
    """
    analysis = gmx.rmsf(trajectory=md.output.trajectory,
                        topology=initial_input)
    file_list = gmx.fileio.write_xvg(analysis.output).result()