How to use the mdanalysis.AccumulatedContact function in MDAnalysis

To help you get started, we’ve selected a few MDAnalysis examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github maxscheurer / pycontact / mdanalysis.py View on Github external
for key in allkeys:
            accumulatedContactsDict[key] = []
            for frame_dict in frame_contacts_accumulated:
                if not key in frame_dict:  # puts empty score TempContactAccumulate in dict
                    key1, key2 = self.makeKeyArraysFromKey(key)
                    emptyCont = TempContactAccumulate(key1, key2)
                    emptyCont.fscore = 0
                    frame_dict[key] = emptyCont
                accumulatedContactsDict[key].append(frame_dict[key])

                # make a list of AccumulatedContacts from accumulatedContactsDict
        # probably, there is a much easier way to do that, but I am too tired at the moment and it works, though... (M)
        finalAccumulatedContacts = []  # list of AccumulatedContacts
        for key in accumulatedContactsDict:
            key1, key2 = self.makeKeyArraysFromKey(key)
            acc = AccumulatedContact(key1, key2)
            for tempContact in accumulatedContactsDict[key]:
                acc.addScore(tempContact.fscore)
                acc.addContributingAtoms(tempContact.contributingAtomContacts)
                acc.bb1 += tempContact.bb1score
                acc.bb2 += tempContact.bb2score
                acc.sc1 += tempContact.sc1score
                acc.sc2 += tempContact.sc2score
            finalAccumulatedContacts.append(acc)
            print(key, acc.bb1, acc.bb2, acc.sc1, acc.sc2)
            print(len(acc.scoreArray))
        stop = time.time()
        print(stop - start)
        return finalAccumulatedContacts
github maxscheurer / pycontact / mdanalysis.py View on Github external
def __init__(self, key1, key2):
        super(AccumulatedContact, self).__init__()
        self.scoreArray = []  # score for every frame, summed by settings given in key1,key2
        self.contributingAtoms = []  # list of list of AtomContacts, contributing to the contact
        self.key1 = key1  # list of properties of sel1, cf. AccumulationMapIndex
        self.key2 = key2  # list of properties of sel2, cf. AccumulationMapIndex
        # TODO:  human readable implementation of key/title
        # self.title = makeKeyFromKeyArrays(key1, key2)
        self.title = self.human_readable_title()
        self.bb1 = 0
        self.sc1 = 0
        self.bb2 = 0
        self.sc2 = 0