Ejemplo n.º 1
0
    def get_size(self, cell):
        '''
        Returns the diameter of a wire structure, defined as the maximum
        distance between atoms projected to the x-y plane.

        Precondition: the cell has already been put into wire format (c
            lattice vector is parallel to z-axis and a and b lattice vectors in
            the x-y plane), and all sites are located inside the cell (i.e.,
            have fractional coordinates between 0 and 1).

        Args:
            cell: the Cell whose size to get
        '''

        max_distance = 0
        for site_i in cell.sites:
            # make Site versions of each PeriodicSite so that the computed
            # distance won't include periodic images
            non_periodic_site_i = Site(
                site_i.species_and_occu,
                [site_i.coords[0], site_i.coords[1], 0.0])
            for site_j in cell.sites:
                non_periodic_site_j = Site(
                    site_j.species_and_occu,
                    [site_j.coords[0], site_j.coords[1], 0.0])
                distance = non_periodic_site_i.distance(non_periodic_site_j)
                if distance > max_distance:
                    max_distance = distance
        return max_distance
Ejemplo n.º 2
0
    def get_size(self, cell):
        '''
        Returns the diameter of a cluster structure, defined as the maximum
        distance between atoms in the cell.

        Precondition: all sites are located inside the cell (i.e., have
            fractional coordinates between 0 and 1)

        Args:
            cell: the Cell whose size to get
        '''

        max_distance = 0
        for site_i in cell.sites:
            # make Site versions of each PeriodicSite so that the computed
            # distance won't include periodic images
            non_periodic_site_i = Site(site_i.species_and_occu, site_i.coords)
            for site_j in cell.sites:
                non_periodic_site_j = Site(site_j.species_and_occu,
                                           site_j.coords)
                distance = non_periodic_site_i.distance(non_periodic_site_j)
                if distance > max_distance:
                    max_distance = distance
        return max_distance