def test_ensemble_potential_withmpi(tpr_filename): import os from mpi4py import MPI rank = MPI.COMM_WORLD.Get_rank() rank_dir = os.path.join(os.getcwd(), str(rank)) os.mkdir(rank_dir) logger.info("Testing plugin potential with input file {}".format(os.path.abspath(tpr_filename))) assert gmx_version.api_is_at_least(0, 0, 5) md = from_tpr([tpr_filename, tpr_filename], append_output=False) # Create a WorkElement for the potential params = {'sites': [1, 4], 'nbins': 10, 'binWidth': 0.1, 'min_dist': 0., 'max_dist': 10., 'experimental': [0.5] * 10, 'nsamples': 1, 'sample_period': 0.001, 'nwindows': 4, 'k': 10000., 'sigma': 1.} potential = WorkElement(namespace="myplugin", operation="ensemble_restraint", params=params) # Note that we could flexibly capture accessor methods as workflow elements, too. Maybe we can # hide the extra Python bindings by letting myplugin.HarmonicRestraint automatically convert # to a WorkElement when add_dependency is called on it. potential.name = "ensemble_restraint" md.add_dependency(potential) context = ParallelArrayContext(md) with context as session: session.run()
def test_ensemble_potential_withmpi(spc_water_box): tpr_filename = spc_water_box logger.info("Testing plugin potential with input file {}".format( os.path.abspath(tpr_filename))) assert gmx_version.api_is_at_least(0, 0, 5) # Note that *threads* argument causes errors for MPI-enabled GROMACS. # Ref #3563 and #3573 md = from_tpr([tpr_filename, tpr_filename], append_output=False, threads=2) # Create a WorkElement for the potential params = { 'sites': [1, 4], 'nbins': 10, 'binWidth': 0.1, 'min_dist': 0., 'max_dist': 10., 'experimental': [0.5] * 10, 'nsamples': 1, 'sample_period': 0.001, 'nwindows': 4, 'k': 10000., 'sigma': 1. } potential = WorkElement(namespace="myplugin", operation="ensemble_restraint", params=params) # Note that we could flexibly capture accessor methods as workflow elements, too. Maybe we can # hide the extra Python bindings by letting myplugin.HarmonicRestraint automatically convert # to a WorkElement when add_dependency is called on it. potential.name = "ensemble_restraint" md.add_dependency(potential) context = Context(md) with context as session: session.run()
def test_ensemble_potential_nompi(spc_water_box): """Test ensemble potential without an ensemble. """ tpr_filename = spc_water_box print("Testing plugin potential with input file {}".format( os.path.abspath(tpr_filename))) assert api_is_at_least(0, 0, 5) md = from_tpr([tpr_filename], append_output=False) # Create a WorkElement for the potential params = { 'sites': [1, 4], 'nbins': 10, 'binWidth': 0.1, 'min_dist': 0., 'max_dist': 10., 'experimental': [1.] * 10, 'nsamples': 1, 'sample_period': 0.001, 'nwindows': 4, 'k': 10000., 'sigma': 1. } potential = WorkElement(namespace="myplugin", operation="ensemble_restraint", params=params) # Note that we could flexibly capture accessor methods as workflow elements, too. Maybe we can # hide the extra Python bindings by letting myplugin.HarmonicRestraint automatically convert # to a WorkElement when add_dependency is called on it. potential.name = "ensemble_restraint" md.add_dependency(potential) context = _context(md) with context as session: session.run()