Ejemplo n.º 1
0
    def cons_max_volume(self, sites, max_volume, min_volume=1, dimension=3, symprec=1e-5):
        """
        parameters:

        pcell: Cell object, The primitive cell to be extended
        sites: disorderd sites infomation.

        yield:

        Cell object, a list of non-redundant configurations to max volume supercells.

        """
        # 该函数产生所有构型用于确定基态相图
        for volume in range(min_volume, max_volume + 1):
            hnfs = non_dup_hnfs(self._pcell, volume, dimension, symprec)
            dict_trans = {}  # 记录已经产生过的snf,相同snf的平移操作相同。
            for h in hnfs:
                hfpg = PermutationGroup(self._pcell, h)
                # 此处的平移操作不必每次重新计算,因为相同snf平移操作相同
                # 可以用字典来标记查询。若没有这样的操作,那么就没有snf带来的效率提升。
                # quotient = hfpg.get_quotient()
                # if not quotient in dict_trans:
                #     dict_trans[quotient] = hfpg.get_pure_translations(symprec)
                # trans = dict_trans[quotient]
                # rots = hfpg.get_pure_rotations(symprec)
                perms = hfpg.get_symmetry_perms(symprec)

                supercell = self._pcell.extend(h)
                _sites = numpy.repeat(sites, volume, axis=0)

                for mol, _ in remove_redundant(supercell.positions, _sites, perms):
                    c = Cell(supercell.lattice, mol[0], mol[1])
                    if c.is_primitive(symprec):
                        yield c
Ejemplo n.º 2
0
 def test_is_primitive(self):
     bcc_latt = [0.5, 0.5, -0.5,
                 -0.5, 0.5, 0.5,
                 0.5, -0.5, 0.5]
     bcc_pos = [(0, 0, 0)]
     bcc_atoms = [0]
     bcc_pcell = Cell(bcc_latt, bcc_pos, bcc_atoms)
     self.assertTrue(bcc_pcell.is_primitive())
Ejemplo n.º 3
0
def get_max_volume(pcell, sites, max_volume, min_volume=1, dimension=3, symprec=1e-5):
    for volume in range(min_volume, max_volume + 1):
        hnfs = non_dup_hnfs(pcell, volume, dimension, symprec)
        dict_trans = {}  # 记录已经产生过的snf,相同snf的平移操作相同。
        for h in hnfs:
            hfpg = PG(pcell, h)
            perms = hfpg.get_symmetry_perms(symprec)
            if dimension == 2:
                supercell = pcell.extend(h)._get_niggli_2D()
            else:
                supercell = pcell.extend(h)._get_niggli_3D()
            _sites = np.repeat(sites, volume, axis=0)
            for mol, _ in remove_redundant(supercell.positions, _sites, perms):
                c = Cell(supercell.lattice, mol[0], mol[1])
                if c.is_primitive(symprec):
                    yield c