Query to get vasp input

Suppose I have name and space group number, I can query to get cif of the material, for example:

from pymatgen import MPRester
m = MPRester(‘xxxxxxxx’)
c = m.query(criteria={‘pretty_formula’: ‘LiZnN’,
‘spacegroup.number’:216},
properties=[‘cif’])

Then how can I get the vasp input for this record? Or, at least, transform the gif to POSCAR?

You can use pymatgen to translate among structure formats. You can also request inputs directly.

from pymatgen import MPRester
from pymatgen import Structure

mpr = MPRester()

docs = mpr.query(
    criteria={"pretty_formula": "LiZnN", "spacegroup.number": 216},
    properties=["cif", "input.incar", "input.kpoints"])

poscar = Structure.from_str(docs[0]["cif"], fmt="cif").to(fmt="poscar")
incar = docs[0]["input.incar"]
kpoints = docs[0]["input.kpoints"]
1 Like