Beispiel #1
0
 def _read_selection(self, el):
     universe = self._read_universe(el.find('universe'))
     ptype = el.tag[:-10]   # strip off '_selection'
     klass = {"atom": im.AtomSelection,
              "site": im.SiteSelection,
              "template_atom": im.TemplateAtomSelection,
              "template_site": im.TemplateSiteSelection}[ptype]
     el_d = el.find('indices')
     indices = [int(s) for s in el_d.text.split()]
     indices = IN.array(indices, uint_for_max_value(max(indices)))
     return klass(universe, indices)
 def __init__(self, universe, indices):
     api.validate_type(universe, Universe, "universe")
     self._universe = universe
     indices = N.array(indices, uint_for_max_value(max(indices)))
     api.validate_indices(indices, self._max_index(), "indices")
     self._indices = indices