本文整理匯總了Python中MMTK.Utility.orderedPairs方法的典型用法代碼示例。如果您正苦於以下問題:Python Utility.orderedPairs方法的具體用法?Python Utility.orderedPairs怎麽用?Python Utility.orderedPairs使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類MMTK.Utility
的用法示例。
在下文中一共展示了Utility.orderedPairs方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: excludedPairs
# 需要導入模塊: from MMTK import Utility [as 別名]
# 或者: from MMTK.Utility import orderedPairs [as 別名]
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')
示例2: evaluatorTerms
# 需要導入模塊: from MMTK import Utility [as 別名]
# 或者: from MMTK.Utility import orderedPairs [as 別名]
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]