pmda icon indicating copy to clipboard operation
pmda copied to clipboard

allow using updating atomgroups

Open kain88-de opened this issue 7 years ago • 3 comments

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 avatar Oct 12 '17 13:10 kain88-de

@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]

richardjgowers avatar Oct 12 '17 14:10 richardjgowers

oh awesome. I didn't know we could pickle atomgroups

kain88-de avatar Oct 12 '17 14:10 kain88-de

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.

richardjgowers avatar Oct 12 '17 14:10 richardjgowers