This notebook demonstrates how to perform structure enumeration using Python Materials Genomics (pymatgen). These notebooks are described in detail in
Deng, Z.; Zhu, Z.; Chu, I.-H.; Ong, S. P. Data-Driven First-Principles Methods for the Study and Design of
Alkali Superionic Conductors. Chem. Mater. 2017, 29 (1), 281–288 DOI: 10.1021/acs.chemmater.6b02648.
If you find these notebooks useful and use the functionality demonstrated, please consider citing the above work.
Let's start by importing some modules and classes that we will be using.
In [1]:
from pymatgen import Structure
from pymatgen.symmetry.analyzer import SpacegroupAnalyzer
from pymatgen.transformations.advanced_transformations import EnumerateStructureTransformation
from pymatgen.io.vasp.sets import batch_write_input, MPRelaxSet
In [2]:
structure = Structure.from_file("aimd_data/EntryWithCollCode418490.cif")
print(structure)
From the above, we see that the reported experimental structure has Li disorder. The occupancy of Li is higher than what would be expected for a Li6PS5Cl nominal composition. We will first adjust the composition by setting the Li occupancies to 0.5 to obtain stoichiometric charge-balanced Li6PS5Cl.
In [3]:
# loop over all sites in the structure
for i, site in enumerate(structure):
# change the occupancy of Li+ disordered sites to 0.5
if not site.is_ordered:
structure[i] = {"Li+": 0.5}
print("The composition after adjustments is %s." % structure.composition.reduced_formula)
To keep the number of orderings manageable, we will perform enumeration only on the primitive cell. The primitive cell can be obtained using the SpacegroupAnalyzer.
In [4]:
analyzer = SpacegroupAnalyzer(structure)
prim_cell = analyzer.find_primitive()
print(prim_cell)
In [5]:
enum = EnumerateStructureTransformation()
enumerated = enum.apply_transformation(prim_cell, 100) # return no more than 100 structures
structures = [d["structure"] for d in enumerated]
print("%d structures returned." % len(structures))
Pymatgen has useful classes for batch generating VASP input files that use parameters that are compatible with those used in the Materials Project. These parameters have been well-tested over a large database of structures in different chemistries. Using the same parameters also allow the energies computed to be compared with those in the Materials Project database for phase stability and other analyses.
In [6]:
batch_write_input(structures, vasp_input_set=MPRelaxSet, output_dir="Li6PS5Cl_orderings")