Created
August 4, 2022 13:50
-
-
Save henriquemiranda/e4a1b616693aac339ef011af6484f890 to your computer and use it in GitHub Desktop.
Read a POSCAR file and write both primitive and conventional symmetrized POSCAR
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#read structure from file | |
from pymatgen.core import Structure | |
struct = Structure.from_file("POSCAR") | |
#get symmetrized primitive and conventional cell | |
from pymatgen.symmetry.analyzer import SpacegroupAnalyzer | |
sga = SpacegroupAnalyzer(struct,symprec=1e-5) | |
struct_symm_conv = sga.get_refined_structure() | |
struct_symm_prim = sga.find_primitive() | |
#write primitive and conventional cells | |
from pymatgen.io.vasp import Poscar | |
poscar = Poscar(struct_symm_conv) | |
poscar.write_file(filename="POSCAR-conv",significant_figures=16) | |
poscar = Poscar(struct_symm_prim) | |
poscar.write_file(filename="POSCAR-prim",significant_figures=16) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment