Beispiel #1
0
    def make_supercell(self, sc_matrix=None, smaker=None):
        """
        make supercell
        sc_matrix: supercell matrix.
        """
        if self.atoms is not None:
            natoms = len(self.atoms)
        else:
            natoms = set(e.site for e in self)

        if smaker is None:
            smaker = SupercellMaker(sc_matrix)

        if self.atoms is not None:
            sc_atoms = smaker.sc_atoms(self.atoms)

        sc_sites = smaker.sc_index(self.get_sites(), n_ind=natoms)
        sc_labels = smaker.sc_trans_invariant(self.get_labels())
        sc_spins = smaker.sc_trans_invariant(self.get_spins())
        sc_indices = smaker.sc_index(self.get_indices())

        sc_bset = BasisSet()
        sc_bset.set_atoms(sc_atoms)
        for site, label, spin, ind in zip(sc_sites, sc_labels, sc_spins,
                                          sc_indices):
            sc_bset.append(Basis(site, label, spin, ind))
        sc_bset.set_nspin(self.nspin)
        return sc_bset
 def make_supercell(self, sc_matrix=None, supercell_maker=None):
     if sc_matrix is None and supercell_maker is None:
         raise ValueError(
             "One of sc_matrix or supercell_maker should be inputed.")
     elif sc_matrix is not None:
         supercell_maker = SupercellMaker(sc_matrix)
     sc_nspin = self.nspin * supercell_maker.ncell
     sc_natom = self.natom * supercell_maker.ncell
     sc_ilist = supercell_maker.sc_index(self.ilist, self.nspin)
     sc_jlist, sc_Rjlist = supercell_maker.sc_jR(self.jlist, self.Rjlist,
                                                 self.nspin)
     sc_ulist, sc_Rulist = supercell_maker.sc_jR(self.ulist, self.Rulist,
                                                 self.natom * 3)
     sc_vallist = supercell_maker.sc_trans_invariant(self.vallist)
     sc_Oiju = OijuTerm(
         nspin=sc_nspin,
         natom=sc_natom,
         ndata=len(sc_ilist),
         ilist=sc_ilist,
         jlist=sc_jlist,
         ulist=sc_ulist,
         Rjlist=sc_Rjlist,
         Rulist=sc_Rulist,
         vallist=sc_vallist)
     return sc_Oiju