def excludedPairs(self, subset1, subset2, global_data): if 'excluded_pairs' not in global_data.get('initialized'): excluded_pairs = set(global_data.get('excluded_pairs')) if subset1 is not None: set1 = set(a.index for a in subset1.atomList()) set2 = set(a.index for a in subset2.atomList()) excluded_pairs |= set(Utility.orderedPairs(list(set1-set2))) excluded_pairs |= set(Utility.orderedPairs(list(set2-set1))) atom_subset = list(set1 | set2) atom_subset.sort() else: atom_subset = None global_data.set('atom_subset', atom_subset) global_data.set('excluded_pairs', list(excluded_pairs)) one_four_pairs = set(global_data.get('1_4_pairs')) \ - excluded_pairs global_data.set('1_4_pairs', list(one_four_pairs)) global_data.add('initialized', 'excluded_pairs') return global_data.get('excluded_pairs'), \ global_data.get('1_4_pairs'), \ global_data.get('atom_subset')
def excludedPairs(self, subset1, subset2, global_data): if 'excluded_pairs' not in global_data.get('initialized'): excluded_pairs = set(global_data.get('excluded_pairs')) if subset1 is not None: set1 = set(a.index for a in subset1.atomList()) set2 = set(a.index for a in subset2.atomList()) excluded_pairs |= set(Utility.orderedPairs(list(set1 - set2))) excluded_pairs |= set(Utility.orderedPairs(list(set2 - set1))) atom_subset = list(set1 | set2) atom_subset.sort() else: atom_subset = None global_data.set('atom_subset', atom_subset) global_data.set('excluded_pairs', list(excluded_pairs)) one_four_pairs = set(global_data.get('1_4_pairs')) \ - excluded_pairs global_data.set('1_4_pairs', list(one_four_pairs)) global_data.add('initialized', 'excluded_pairs') return global_data.get('excluded_pairs'), \ global_data.get('1_4_pairs'), \ global_data.get('atom_subset')
def evaluatorTerms(self, universe, subset1, subset2, global_data): nothing = N.zeros((0, 2), N.Int) if subset1 is not None: set1 = set(a.index for a in subset1.atomList()) set2 = set(a.index for a in subset2.atomList()) excluded_pairs = set(Utility.orderedPairs(list(set1-set2))) \ | set(Utility.orderedPairs(list(set2-set1))) excluded_pairs = N.array(list(excluded_pairs)) atom_subset = list(set1 | set2) atom_subset.sort() atom_subset = N.array(atom_subset) else: atom_subset = N.array([], N.Int) excluded_pairs = nothing nbl = NonbondedList(excluded_pairs, nothing, atom_subset, universe._spec, self.cutoff) update = NonbondedListTerm(nbl) cutoff = self.cutoff if cutoff is None: cutoff = 0. ev = ANTerm(universe._spec, nbl, cutoff, self.scale_factor) return [update, ev]