Esempio n. 1
0
 def __init__(self, chg_name="PARCHG", min_size=50.0, skew=True, zcut=None):
     """Initialize class with pathe of PARCHG and other input params."""
     chgcar = Chgcar(filename=chg_name)
     self.atoms = chgcar.atoms
     self.dim = chgcar.dim
     self.zmaxp = self.atoms.cart_coords[:, 2].max()
     self.nz = self.dim[2]
     volume = self.atoms.volume
     tmp = chgcar.chg[-1] * volume
     chg = tmp.reshape(self.dim[::-1]).T
     self.chg = chg
     self.a = self.atoms.lattice.a
     self.b = self.atoms.lattice.b
     self.c = self.atoms.lattice.c
     self.skew = skew
     self.zcut = zcut
     z_frac_coords = self.atoms.frac_coords[:, 2]
     z_frac_coords_moved = []
     for i in z_frac_coords:
         if i > 0.5:
             i = i - 1
         elif i < -0.5:
             i = i + 1
         z_frac_coords_moved.append(i)
     self.zmaxp = max(np.array(z_frac_coords_moved) * self.c)
     rep_x = int(min_size / self.a) + 1
     rep_y = int(min_size / self.b) + 1
     self.repeat = [rep_x, rep_y]
     self.scell = self.atoms.make_supercell_matrix([rep_x, rep_y, 1])
Esempio n. 2
0
def test_chgcar():
    # print (chg.is_spin_polarized(), chg.is_spin_orbit(), np.array(chg.chg).shape)
    assert (
        chg.is_spin_polarized(),
        chg.is_spin_orbit(),
        np.array(chg.chg).shape,
    ) == (True, False, (4, 56, 56, 56),)
    td = chg.to_dict()
    fd = Chgcar.from_dict(td)
Esempio n. 3
0
        "SiOptb88",
        "SiOptb88",
        "MAIN-RELAX-bulk@mp_149",
        "LOCPOT",
    )
)


chg = Chgcar(
    filename=os.path.join(
        os.path.dirname(__file__),
        "..",
        "..",
        "..",
        "..",
        "examples",
        "vasp",
        "SiOptb88",
        "SiOptb88",
        "MAIN-RELAX-bulk@mp_149",
        "CHGCAR",
    )
)
osz = Oszicar(
    filename=os.path.join(
        os.path.dirname(__file__),
        "..",
        "..",
        "..",
        "..",
        "examples",