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 supercell_maker is None:
         spm = SupercellMaker(sc_matrix=sc_matrix)
     else:
         spm = supercell_maker
     sc_ref_atoms = spm.sc_atoms(self.ref_atoms)
     print("maker supercell for ifc")
     sc_ifc = self.total_ifc.make_supercell(scmaker=spm)
     return Lattice(ifc=sc_ifc, ref_atoms=sc_ref_atoms)
Beispiel #3
0
 def make_supercell(self, sc_maker=None, sc_matrix=None):
     from minimulti.utils.supercell import SupercellMaker
     if sc_maker is None:
         sc_maker = SupercellMaker(sc_matrix)
     if self.atoms is not None:
         sc_atoms = sc_maker.sc_atoms(self.atoms)
     #print(self.HwannR.shape)
     sc_Rlist, sc_HR = sc_maker.sc_Rlist_HR(self.Rlist,
                                            self.HwannR,
                                            n_basis=self.nwann)
     return sc_atoms, sc_Rlist, sc_HR
Beispiel #4
0
def lwf_to_atoms(mylwf: LWF, scmat, amplist):
    patoms = mylwf.atoms
    scmaker = SupercellMaker(scmat)
    scatoms = scmaker.sc_atoms(patoms)
    positions = scatoms.get_positions()
    nR, natom3, nlwf = mylwf.wannR.shape
    scnatom = len(scatoms)

    print(mylwf.wannR[mylwf.Rdict[(0, 0, 0)], :, 0].real)

    displacement = np.zeros_like(positions.flatten())
    for (R, iwann, ampwann) in amplist:
        for Rwann, iRwann in mylwf.Rdict.items():
            for j in range(natom3):
                sc_j, sc_R = scmaker.sc_jR_to_scjR(j, Rwann, R, natom3)
                #print(f"{mylwf.wannR[iRwann, iwann, j].real: .2f}")
                amp = ampwann * mylwf.wannR[iRwann, j, iwann]
                #print(f"{amp:.2f}")
                displacement[sc_j] += amp.real
    sc_pos = positions + displacement.reshape((scnatom, 3))
    #print(displacement.reshape((scnatom, 3))[:6])
    scatoms.set_positions(sc_pos)
    return scatoms