Skip to content

Instantly share code, notes, and snippets.

View henriquemiranda's full-sized avatar

Henrique Miranda henriquemiranda

View GitHub Profile
@henriquemiranda
henriquemiranda / pymatgen_symmetrize_poscar.py
Created August 4, 2022 13:50
Read a POSCAR file and write both primitive and conventional symmetrized POSCAR
#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()