pmda
pmda copied to clipboard
allow using updating atomgroups
It's currently not possible to use updating atomgroups because we use the indices of an atomgroup to rebuild it for a thread. We don't even show a warning right now that updating atomgroups are not supported.
@kain88-de maybe you don't want to complicate this library (yet) but it should be possible to allow UAGs by using the pickling functionality we added a while ago.
Something like:
class ParallelAnalysisBase(object):
def __init__(self, stuff):
self._pickles = [pickle.dumps(ag) for ag in atomgroups]
def dask_helper(self):
u = mda.Universe() # must load Universe first
agroups = [pickle.loads(ag) for ag in self._pickles]
oh awesome. I didn't know we could pickle atomgroups
Yeah, it's a little quirky though. Making a Universe adds it to MDAnalysis._ANCHOR_UNIVERSES
, then when AGs try and unpickle, they search for a matching Universe in that dict. So you have to have an (appropriate) existing Universe for the AG to unpickle onto else it'll fail.