Exemplo n.º 1
0
 def nonbondedList(self, universe, subset1, subset2, global_data):
     try:
         from MMTK_forcefield import NonbondedList, NonbondedListTerm
     except ImportError:
         return None, None
     nbl = None
     update = None
     if 'nonbondedlist' in global_data.get('initialized'):
         nbl, update, cutoff = global_data.get('nonbondedlist')
     if nbl is None:
         excluded_pairs, one_four_pairs, atom_subset = \
                         self.excludedPairs(subset1, subset2, global_data)
         excluded_pairs = N.array(excluded_pairs)
         one_four_pairs = N.array(one_four_pairs)
         if atom_subset is not None:
             atom_subset = N.array(atom_subset)
         else:
             atom_subset = N.array([], N.Int)
         nbl = NonbondedList(excluded_pairs, one_four_pairs, atom_subset,
                             universe._spec, self.cutoff)
         update = NonbondedListTerm(nbl)
         update.info = 0
         global_data.set('nonbondedlist', (nbl, update, self.cutoff))
         global_data.add('initialized', 'nonbondedlist')
     else:
         if cutoff is not None and \
                    (self.cutoff is None or self.cutoff > cutoff):
             nbl.setCutoff(self.cutoff)
     return nbl, update
Exemplo n.º 2
0
 def evaluatorTerms(self, universe, subset1, subset2, global_data):
     if subset1 is not None:
         for s1, s2 in [(subset1, subset2), (subset2, subset1)]:
             set = {}
             for a in s1.atomList():
                 set[a.index] = None
             for a in s2.atomList():
                 try:
                     del set[a.index]
                 except KeyError: pass
         set = {}
         for a in subset1.atomList():
             set[a.index] = None
         for a in subset2.atomList():
             set[a.index] = None
         atom_subset = set.keys()
         atom_subset.sort()
         atom_subset = Numeric.array(atom_subset)
     else:
         atom_subset = Numeric.array([], Numeric.Int)
     nothing = Numeric.zeros((0,2), Numeric.Int)
     nbl = NonbondedList(nothing, nothing, atom_subset, universe._spec,
                         self.cutoff)
     update = NonbondedListTerm(nbl)
     cutoff = self.cutoff
     if cutoff is None:
         cutoff = 0.
     ev = CalphaTerm(universe._spec, nbl, cutoff,
                     self.scale_factor, self.version)
     return [update, ev]
Exemplo n.º 3
0
 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]