示例#1
0
 def extract(self, name="mz"):
     """Extract somethign from the Hamiltonian"""
     if self.has_eh: raise  # not implemented
     if name == "density":
         return extract.onsite(self.intra, has_spin=self.has_spin)
     elif name == "mx" and self.has_spin:
         return extract.mx(self.intra)
     elif name == "my" and self.has_spin:
         return extract.my(self.intra)
     elif name == "mz" and self.has_spin:
         return extract.mz(self.intra)
     else:
         raise
示例#2
0
def magnetization(h):
    """Write all the magnetizations"""
    if h.has_eh: raise
    if h.has_spin:
        mx = extract.mx(h.intra)
        my = extract.my(h.intra)
        mz = extract.mz(h.intra)
    else:
        raise
    np.savetxt("MAGNETIZATION_X.OUT",
               np.matrix([h.geometry.x, h.geometry.y, mx]).T)
    np.savetxt("MAGNETIZATION_Y.OUT",
               np.matrix([h.geometry.x, h.geometry.y, my]).T)
    np.savetxt("MAGNETIZATION_Z.OUT",
               np.matrix([h.geometry.x, h.geometry.y, mz]).T)
示例#3
0
 def write_magnetization(self):
     """Extract the magnetization and write in in a file"""
     if not self.has_eh:  # without electron hole
         if self.has_spin:  # for spinful
             mx = extract.mx(self.intra)
             my = extract.my(self.intra)
             mz = extract.mz(self.intra)
             g = self.geometry
             np.savetxt("MX.OUT", np.matrix([g.x, g.y, g.z, mx]).T)
             np.savetxt("MY.OUT", np.matrix([g.x, g.y, g.z, my]).T)
             np.savetxt("MZ.OUT", np.matrix([g.x, g.y, g.z, mz]).T)
             np.savetxt("MAGNETISM.OUT",
                        np.matrix([g.x, g.y, g.z, mx, my, mz]).T)
             return np.array([mx, my, mz])
     return 0.0
示例#4
0
def mz(h, name="MZ.OUT"):
    if h.has_eh: raise
    if h.has_spin: ms = extract.mz(h.intra)
    else: raise
    np.savetxt(name, np.matrix([range(len(ms)), ms]).T)