示例#1
0
文件: Intervor.py 项目: tybiot/biskit
    def __mapfacets2Atoms(self, raw_table):
        """
        Create an atom profile 'facets' that contains the facet
        dictionaries each atom is involved in ( empty list if the atom is not
        part of the interface).
        The entries of the profile are Biskit.DictList objects that function
        like normal lists but have additional functions to directly extract 
        values of the dictionaries in the list.
        """
        facet_profile = [B.DictList() for i in self.model.atomRange()]

        for facet in raw_table.iterDicts():
            a1 = facet['serial_1']
            a2 = facet['serial_2']

            facet_profile[a1] += [facet]
            facet_profile[a2] += [facet]

        self.model.atoms.set('facets', facet_profile, comment=\
                             'intervor facets this atom is involved in' )

        self.model['n_facets'] = [len(f or []) for f in facet_profile]
        self.model['n_facets', 'comment'] = 'number of interface facets'

        self.model['so_min'] = [
            min(f.valuesOf('so') or [0]) for f in facet_profile
        ]
        self.model['so_max'] = [
            max(f.valuesOf('so') or [0]) for f in facet_profile
        ]
        self.model['facet_area'] = [
            N.sum(f.valuesOf('area') or [0]) for f in facet_profile
        ]

        self.model['so_min','comment'] = 'smallest Intervor shelling order of '\
                                         + 'any facet this atom is involved in'

        self.model['so_max','comment'] = 'highest Intervor shelling order of '\
                                         +'any facet this atom is involved in'

        self.model['facet_area','comment']='sum of area of all intervor facets'\
                                            + ' this atom is involved in'
示例#2
0
文件: Intervor.py 项目: tybiot/biskit
    def __parseFacets(self, fname):
        """
        -> Biskit.DictList
        """
        result = []

        try:
            r = f = None
            f = open(fname)

            lines = f.readlines()
            lines = ''.join(lines)

            records = lines.split('FBIeg')
            records = [r for r in records if len(r) > 10]

            result = B.DictList([self.__parseFacetRecord(r) for r in records])

        except IOError, why:
            raise IntervorError( 'Error accessing intervor output file %r: %r'\
                      % (fname, why))