Package: pymatgen-analysis-defects
title: pymatgen-analysis-defects📄Full
DocumentationThis package is an extension topymatgenfor performing defect
analysis. The package is designed to work with VASP inputs and output
files and is meant to be used as a namespace package extension to the
mainpymatgenlibrary. The new module has been redesigned to work
closely withatomate2.While theatomate2automation framework is not required for this code
to be useful, users are strongly encouraged to to adopt theatomate2framework as it contains codified "best practices" for running defect
calculations as well as orchestrating the running of calculations and
storing the results.The package serves as an object-oriented interface to defect physics and
is capable of generating a list of non-equivalent defect objects
directly from the Materials Project API.frompymatgen.analysis.defects.generatorsimportChargeInterstitialGenerator,generate_all_native_defectsfrompymatgen.ext.matprojimportMPResterwithMPRester()asmpr:chgcar=mpr.get_charge_density_from_material_id("mp-804")fordefectingenerate_all_native_defects(chgcar):print(defect)Non-exhaustive list of features:Reproducible definition of defectsDefects are defined based on the physical concept they represent,
independent of the calculation details such as simulation cell size. As
an example, a Vacancy defect is defined by the primitive cell of the
pristine material plus a single site that represents the vacancy site in
the unit cell.Formation energy calculationsThe formation energy diagram is a powerful tool for understanding the
thermodynamics of defects. This package provides a simple interface for
calculating the formation energy diagram from first-principles results.
This package handles the energy accounting of the chemical species for
the chemical potential calculations, which determines the y-offset of
the formation energy. This package also performs finite-size corrections
for the formation energy which is required when studying charged defects
in periodic simulation cells.Defect PositionIdentification of the defect positions in a simulation cell after atomic
relaxation is not trivial since the many atoms can collectively shift in
response to the creation of the defect. Yet the exact location of the
defect is required for the calculation of finite-size corrections as
well as other physical properties. We devised a method based on
calculating a SOAP-based distortion field that can be used to identify
the defect position in a simulation cell. Note, this method only
requires the reference pristine supercell and does not need prior
knowledge of how the defect was created.Defect ComplexesMultiple defects can be composed into defect complexes. The complex is
can be treated as a normal defect object for subsequent analysis.Defect InteractionsSimulation of defect-photon and defect-phonon interactions under the
independent particle approximation.Previous versions of the defects codeThis package replaces the olderpymatgen.analysis.defectsmodules. The
previous module was used bypyCDTcode which will continue to work
with version2022.7.8ofpymatgen.ContributingThe source code can be downloaded from the GitHub repository at$gitclonehttps://github.com/materialsproject/pymatgen-analysis-defects.gitAll code contributions are welcome. Please submit a pull request on
GitHub. To make maintenance easier, please use a workflow similar to the
automated CIworkflow.Specifically, please make sure to run the following commands for
linting:$pipinstall-e.[strict]$pipinstall-e.[dev]$pre-commitinstall
$pre-commitrun--all-filesAnd run these commands for testing:$pipinstall-e.[strict]$pipinstall-e.[tests]$pytest--cov=pymatgen
$pytest--nbmake./docs/source/contentFor more details about what is actually installed with each of thepip install .[arg]commands, please inspect thepyproject.tomlfile.ContributorsLead developer: Dr. Jimmy-Xuan ShenThis code contains contributions from the original defects analysis
module ofpymatgenfrom Dr. Danny Broberg and Dr. Shyam
Dwaraknath.