Achieve gmxapi fr15.
authorM. Eric Irrgang <ericirrgang@gmail.com>
Fri, 1 Nov 2019 10:16:30 +0000 (13:16 +0300)
committerPaul Bauer <paul.bauer.q@gmail.com>
Mon, 11 Nov 2019 15:54:31 +0000 (16:54 +0100)
gmxapi.mdrun was missing the described 'parameters' output,
but fr15 was essentially met by the addition of modify_input.

Change-Id: I9e698a046a2717e69af3076c80fabc8ccb85ee12

python_packaging/src/gmxapi/simulation/mdrun.py
python_packaging/src/gmxapi/version.py

index 642bdaa369184b6229ed95d352124ce43abb66d9..066d40c4c09744f90b244b2226576446d700335c 100644 (file)
@@ -71,7 +71,8 @@ logger.info('Importing {}'.format(__name__))
 #  attributes of the data proxies.
 _output_descriptors = (
     _op.OutputDataDescriptor('_work_dir', str),
-    _op.OutputDataDescriptor('trajectory', str)
+    _op.OutputDataDescriptor('trajectory', str),
+    _op.OutputDataDescriptor('parameters', dict)
 )
 _publishing_descriptors = {desc._name: gmxapi.operation.Publisher(desc._name, desc._dtype) for desc in
                            _output_descriptors}
@@ -176,6 +177,7 @@ class LegacyImplementationSubscription(object):
         workdir_list = ['{node}_{member}'.format(node=resource_manager.operation_id,
                                                  member=member)
                         for member in range(ensemble_width)]
+        parameters_dict_list = [{}] * ensemble_width
 
         # This is a reasonable place to start using MPI ensemble implementation details.
         # We will want better abstraction in the future, but it is best if related filesystem
@@ -240,15 +242,18 @@ class LegacyImplementationSubscription(object):
                         fileio.write_tpr_file(output=tprfile, input=sim_input)
                     logger.info('Created {} on rank {}'.format(tprfile, context_rank))
 
-                    # Gather the actual working directories from the ensemble members.
+                    # Gather the actual outputs from the ensemble members.
                     if hasattr(ensemble_comm, 'allgather'):
                         # We should not assume that abspath expands the same on different MPI ranks.
                         workdir_list = ensemble_comm.allgather(self.workdir)
                         tpr_filenames = ensemble_comm.allgather(tprfile)
+                        parameters = fileio.read_tpr(tprfile).parameters.extract()
+                        parameters_dict_list = ensemble_comm.allgather(parameters)
                     else:
                         workdir_list = [os.path.abspath(workdir) for workdir in workdir_list]
                         # TODO: If we use better input file names, they need to be updated in multiple places.
                         tpr_filenames = [os.path.join(workdir, 'topol.tpr') for workdir in workdir_list]
+                        parameters_dict_list = [fileio.read_tpr(tprfile).parameters.extract() for tprfile in tpr_filenames]
 
                     logger.debug('Context rank {} acknowledges working directories {}'.format(context_rank,
                                                                                              workdir_list))
@@ -274,6 +279,7 @@ class LegacyImplementationSubscription(object):
             # end scoped_communicator: context_comm
 
         self.workdir = workdir_list
+        self.parameters = parameters_dict_list
 
 
 class SubscriptionSessionResources(object):
@@ -294,6 +300,7 @@ class SubscriptionSessionResources(object):
         # if member_id is None:
         #     member_id = 0
         self.workdir = input.workdir[member_id]
+        self.parameters = input.parameters[member_id]
 
 
 class SubscriptionPublishingRunner(object):
@@ -309,6 +316,7 @@ class SubscriptionPublishingRunner(object):
         """Operation implementation in the gmxapi.operation module context."""
         publisher = self.resources.output
         publisher._work_dir = self.resources.workdir
+        publisher.parameters = self.resources.parameters
         # TODO: Make the return value a trajectory handle rather than a file path.
         # TODO: Decide how to handle append vs. noappend output.
         # TODO: More rigorous handling of the trajectory file(s)
index c9d70acfcce2997ff4f6a1d4253dedfd54c90ab3..f4161966c6e77473944eefe9b39ce7c6090b715b 100644 (file)
@@ -62,7 +62,7 @@ patch = 0
 release = False
 
 # Features added since the initial gmxapi prototype, targeted for version 0.1.
-_named_features_0_0 = ['fr1', 'fr3', 'fr7']
+_named_features_0_0 = ['fr1', 'fr3', 'fr7', 'fr15']
 # Features named since the finalization of the 0.1 specification with GROMACS 2020.
 _named_features_0_1 = []
 # Named features describe functionality or behavior introduced since the last