Exemplo n.º 1
0
def test_inputs():
    p = Poscar.from_file(pos)
    print(p)
    td = p.to_dict()
    print("td is:", td)
    fd = Poscar.from_dict(td)
    new_file, filename = tempfile.mkstemp()
    p.write_file(filename)
    i = Incar.from_file(inc)
    i.update({"ENCUT": 1000})
    assert (round(p.atoms.density, 2), i.to_dict()["ISIF"]) == (2.25, "3")
    f = open(pos, "r")
    lines = f.read()
    f.close()
    p = Poscar.from_string(lines)
    assert (round(p.atoms.density, 2), i.to_dict()["ISIF"]) == (2.25, "3")
    d = i.to_dict()
    ii = Incar.from_dict(d)
    pot = os.path.join(
        os.path.dirname(__file__), "POT_GGA_PAW_PBE", "Xe", "POTCAR",
    )
    potc = IndividualPotcarData.from_file(pot)
    print(potc)
    os.environ["JARVIS_VASP_PSP_DIR"] = os.path.join(os.path.dirname(__file__))
    new_file, filename = tempfile.mkstemp()
    pot = Potcar(elements=["Xe"])
    td = pot.to_dict()
    fd = Potcar.from_dict(td)
    print(pot)
    pot.write_file(filename)
Exemplo n.º 2
0
 def from_dict(self, d={}):
     """Load from dictionary."""
     job = JobFactory(
         use_incar_dict=d["use_incar_dict"],
         pot_type=d["pot_type"],
         vasp_cmd=d["vasp_cmd"],
         copy_files=d["copy_files"],
         attempts=d["attempts"],
         stderr_file=d["stderr_file"],
         output_file=d["output_file"],
         poscar=Poscar.from_dict(d["poscar"]),
     )
     return job
Exemplo n.º 3
0
 def from_dict(self, info={}):
     """Load the class from a dictionary."""
     return VaspJob(
         poscar=Poscar.from_dict(info["poscar"]),
         kpoints=Kpoints.from_dict(info["kpoints"]),
         incar=Incar.from_dict(info["incar"]),
         potcar=Potcar.from_dict(info["potcar"]),
         vasp_cmd=info["vasp_cmd"],
         copy_files=info["copy_files"],
         attempts=info["attempts"],
         output_file=info["output_file"],
         stderr_file=info["stderr_file"],
         jobname=info["jobname"],
     )