doped.vasp module
Code to generate VASP defect calculation input files.
- class doped.vasp.DefectDictSet(structure: Structure, charge_state: int = 0, user_incar_settings: dict | None = None, user_kpoints_settings: dict | Kpoints | None = None, user_potcar_functional: str = 'PBE', user_potcar_settings: dict | None = None, poscar_comment: str | None = None, **kwargs)[source]
Bases:
DopedDictSet
Extension to
pymatgen
VaspInputSet
object forVASP
defect calculations.- Parameters:
structure (Structure) –
pymatgen
Structure
object of the defect supercellcharge_state (int) – Charge of the defect structure
user_incar_settings (dict) – Dictionary of user
INCAR
settings (AEXX, NCORE etc.) to override default settings. Highly recommended to look at outputINCAR
s or theRelaxSet.yaml
andDefectSet.yaml
files in thedoped/VASP_sets
folder, to see what the defaultINCAR
settings are. Note that any flags that aren’t numbers orTrue/False
need to be input as strings with quotation marks (e.g.{"ALGO": "All"}
). (default: None)user_kpoints_settings (dict or Kpoints) – Dictionary of user
KPOINTS
settings (inpymatgen
VaspInputSet
format) e.g.,{"reciprocal_density": 123}
, or aKpoints
object. Default is Gamma-centred, reciprocal_density = 100 [Å⁻³].user_potcar_functional (str) –
POTCAR
functional to use. Default is “PBE” and if this fails, tries “PBE_52”, then “PBE_54”.user_potcar_settings (dict) – Override the default
POTCAR
s, e.g.{"Li": "Li_sv"}
. Seedoped/VASP_sets/PotcarSet.yaml
for the defaultPOTCAR
set.poscar_comment (str) – Comment line to use for
POSCAR
files. Default is defect name, fractional coordinates of initial site and charge state.**kwargs – Additional kwargs to pass to
VaspInputSet
.
- property incar
Returns the
Incar
object generated fromDopedDictSet
, withNELECT
andNUPDOWN
set accordingly.See https://doped.readthedocs.io/en/latest/Tips.html#spin-polarisation for discussion about appropriate
NUPDOWN
/MAGMOM
settings.
- property nelect
Number of electrons (
NELECT
) for the given structure and charge state.This is equal to the sum of valence electrons (
ZVAL
) of thePOTCAR
s for each atom in the structure (supercell), minus the charge state.
- write_input(output_path: str, unperturbed_poscar: bool = True, make_dir_if_not_present: bool = True, include_cif: bool = False, potcar_spec: bool = False, zip_output: bool = False, snb: bool = False)[source]
Writes out all input to a directory. Refactored slightly from
pymatgen
VaspInputSet.write_input()
to allow checking of userPOTCAR
setup.- Parameters:
output_path (str) – Directory to output the VASP input files.
unperturbed_poscar (bool) – If True, write the unperturbed defect POSCAR to the generated folder as well. (default: True)
make_dir_if_not_present (bool) – Set to True if you want the directory (and the whole path) to be created if it is not present. (default: True)
include_cif (bool) – Whether to write a CIF file in the output directory for easier opening by VESTA. (default: False)
potcar_spec (bool) – Instead of writing the POTCAR, write a “POTCAR.spec”. This is intended to help sharing an input set with people who might not have a license to specific Potcar files. Given a “POTCAR.spec”, the specific POTCAR file can be re-generated using pymatgen with the “generate_potcar” function in the pymatgen CLI. (default: False)
zip_output (bool) – Whether to zip each VASP input file written to the output directory. (default: False)
snb (bool) – If input structures are from ShakeNBreak (so POSCARs aren’t ‘unperturbed’). (default: False)
- class doped.vasp.DefectRelaxSet(defect_entry: DefectEntry | Structure, charge_state: int | None = None, soc: bool | None = None, user_incar_settings: dict | None = None, user_kpoints_settings: dict | Kpoints | None = None, user_potcar_functional: str = 'PBE', user_potcar_settings: dict | None = None, **kwargs)[source]
Bases:
MSONable
An object for generating input files for VASP defect relaxation calculations from pymatgen
DefectEntry
(recommended) orStructure
objects.The supercell structure and charge state are taken from the
DefectEntry
attributes, or if aStructure
is provided, then from thedefect_supercell
andcharge_state
input parameters.Creates attributes:
DefectRelaxSet.vasp_gam
:DefectDictSet
for Gamma-point only relaxation. Usually not needed if ShakeNBreak structure searching has been performed (recommended), unless only Γ-point k-point sampling is required (converged) for your system, and no vasp_std calculations with multiple k-points are required (determined from kpoints settings).
DefectRelaxSet.vasp_nkred_std
:DefectDictSet
for relaxation with a kpoint mesh and usingNKRED
. Not generated for GGA calculations (ifLHFCALC
is set toFalse
in user_incar_settings) or if only Gamma k-point sampling is required.
DefectRelaxSet.vasp_std
:DefectDictSet
for relaxation with a kpoint mesh, not usingNKRED
. Not generated if only Gamma kpoint sampling is required.
DefectRelaxSet.vasp_ncl
:DefectDictSet
for singlepoint (static) energy calculation with SOC included. Generated ifsoc=True
. Ifsoc
is not set, then by default is only generated for systems with a max atomic number (Z) >= 31 (i.e. further down the periodic table than Zn).
where
DefectDictSet
is an extension ofpymatgen
’sVaspInputSet
class for defect calculations, withincar
,poscar
,kpoints
andpotcar
attributes for the corresponding VASP defect calculations (see docstring). Also creates the correspondingbulk_vasp_...
attributes for singlepoint (static) energy calculations of the bulk (pristine, defect-free) supercell. This needs to be calculated once with the same settings as the defect calculations, for the later calculation of defect formation energies.See the
RelaxSet.yaml
andDefectSet.yaml
files in thedoped/VASP_sets
folder for the defaultINCAR
andKPOINT
settings, andPotcarSet.yaml
for the defaultPOTCAR
settings. These are reasonable defaults that _roughly_ match the typical values needed for accurate defect calculations, but usually will need to be modified for your specific system, such as converged ENCUT and KPOINTS, and NCORE / KPAR matching your HPC setup.Note that any changes to the default
INCAR
/POTCAR
settings should be consistent with those used for all defect and competing phase (chemical potential) calculations.- Parameters:
defect_entry (DefectEntry, Structure) – doped/pymatgen DefectEntry or Structure (defect supercell) for which to generate
DefectDictSet
s for.charge_state (int) – Charge state of the defect. Overrides
DefectEntry.charge_state
ifDefectEntry
is input.soc (bool) – Whether to generate
vasp_ncl
DefectDictSet attribute for spin-orbit coupling singlepoint (static) energy calculations. If not set, then by default is set to True if the max atomic number (Z) in the structure is >= 31 (i.e. further down the periodic table than Zn), otherwise False.user_incar_settings (dict) – Dictionary of user INCAR settings (AEXX, NCORE etc.) to override default settings. Highly recommended to look at output INCARs or the
RelaxSet.yaml
andDefectSet.yaml
files in thedoped/VASP_sets
folder, to see what the default INCAR settings are. Note that any flags that aren’t numbers or True/False need to be input as strings with quotation marks (e.g.{"ALGO": "All"}
). (default: None)user_kpoints_settings (dict or Kpoints) – Dictionary of user KPOINTS settings (in
pymatgen
VaspInputSet
format) e.g. {“reciprocal_density”: 123}, or a Kpoints object, to use for thevasp_std
,vasp_nkred_std
andvasp_ncl
DefectDictSet
s (Γ-only forvasp_gam
). Default is Gamma-centred, reciprocal_density = 100 [Å⁻³].user_potcar_functional (str) – POTCAR functional to use. Default is “PBE” and if this fails, tries “PBE_52”, then “PBE_54”.
user_potcar_settings (dict) – Override the default POTCARs, e.g. {“Li”: “Li_sv”}. See
doped/VASP_sets/PotcarSet.yaml
for the defaultPOTCAR
set.**kwargs – Additional kwargs to pass to
DefectDictSet
.
- vasp_gam
DefectDictSet
for Gamma-point only relaxation. Usually not needed if ShakeNBreak structure searching has been performed (recommended), unless only Γ-point k-point sampling is required (converged) for your system, and no vasp_std calculations with multiple k-points are required (determined from kpoints settings).- Type:
- vasp_nkred_std
DefectDictSet
for relaxation with a non-Γ-only kpoint mesh, usingNKRED(X,Y,Z)
INCAR tag(s) to downsample kpoints for the HF exchange part of the hybrid DFT calculation. Not generated for GGA calculations (ifLHFCALC
is set toFalse
in user_incar_settings) or if only Gamma kpoint sampling is required.- Type:
- vasp_std
DefectDictSet
for relaxation with a non-Γ-only kpoint mesh, not usingNKRED
. Not generated if only Gamma kpoint sampling is required.- Type:
- vasp_ncl
DefectDictSet
for singlepoint (static) energy calculation with SOC included. Generated ifsoc=True
. Ifsoc
is not set, then by default is only generated for systems with a max atomic number (Z) >= 31 (i.e. further down the periodic table than Zn).- Type:
- defect_supercell
Supercell structure for defect calculations, taken from defect_entry.defect_supercell (if defined), otherwise from defect_entry.sc_entry.structure if inputting a DefectEntry object, or the input structure if inputting a Structure object.
- Type:
Structure
- bulk_supercell
Supercell structure of the bulk (pristine, defect-free) material, taken from defect_entry.bulk_supercell (if defined), otherwise from defect_entry.bulk_entry.structure if inputting a DefectEntry object, or None if inputting a Structure object.
- Type:
Structure
- poscar_comment
Comment to write at the top of the POSCAR files. Default is the defect entry name, defect frac coords and charge state (if inputting a DefectEntry object), or the formula of the input structure and charge state (if inputting a Structure object), for defects. For the bulk supercell, it’s “{formula} - Bulk”.
- Type:
str
- bulk_vasp_gam
DefectDictSet
for a bulk Γ-point-only singlepoint (static) supercell calculation. Often not used, as the bulk supercell only needs to be calculated once with the same settings as the final defect calculations, which may be withvasp_std
orvasp_ncl
.- Type:
- bulk_vasp_nkred_std
DefectDictSet
for a singlepoint (static) bulkvasp_std
supercell calculation (i.e. with a non-Γ-only kpoint mesh) andNKRED(X,Y,Z)
INCAR tag(s) to downsample kpoints for the HF exchange part of the hybrid DFT calculation. Not generated for GGA calculations (ifLHFCALC
is set toFalse
in user_incar_settings) or if only Gamma kpoint sampling is required.- Type:
- bulk_vasp_std
DefectDictSet
for a singlepoint (static) bulkvasp_std
supercell calculation with a non-Γ-only kpoint mesh, not usingNKRED
. Not generated if only Gamma kpoint sampling is required.- Type:
- bulk_vasp_ncl
DefectDictSet
for singlepoint (static) energy calculation of the bulk supercell with SOC included. Generated ifsoc=True
. Ifsoc
is not set, then by default is only generated for systems with a max atomic number (Z) >= 31 (i.e. further down the periodic table than Zn).- Type:
- Input parameters are also set as attributes.
- property bulk_vasp_gam: DefectDictSet | None
Returns a
DefectDictSet
object for a VASP bulk Γ-point-only (vasp_gam
) singlepoint (static) supercell calculation. Often not used, as the bulk supercell only needs to be calculated once with the same settings as the final defect calculations, which isvasp_std
if we have a non-Γ-only final k-point mesh, orvasp_ncl
if SOC effects are being included. If the final converged k-point mesh is Γ-only, thenbulk_vasp_gam
should be used to calculate the singlepoint (static) bulk supercell reference energy. Can also sometimes be useful for the purpose of calculating defect formation energies at early stages of the typicalvasp_gam
->vasp_nkred_std
(if hybrid & non-Γ-only k-points) ->vasp_std
(if non-Γ-only k-points) ->vasp_ncl
(if SOC included) workflow, to obtain rough formation energy estimates and flag any potential issues with defect calculations early on.See the
RelaxSet.yaml
andDefectSet.yaml
files in thedoped/VASP_sets
folder for the defaultINCAR
andKPOINT
settings, andPotcarSet.yaml
for the defaultPOTCAR
settings. These are reasonable defaults that _roughly_ match the typical values needed for accurate defect calculations, but usually will need to be modified for your specific system, such as converged ENCUT and KPOINTS, and NCORE / KPAR matching your HPC setup.Note that any changes to the default
INCAR
/POTCAR
settings should be consistent with those used for all defect and competing phase ( chemical potential) calculations.
- property bulk_vasp_ncl: DefectDictSet | None
Returns a
DefectDictSet
object for VASP bulk supercell singlepoint calculations with spin-orbit coupling (SOC) included (LSORBIT = True), usingvasp_ncl
. IfDefectRelaxSet.soc
is False, then this returns None and a warning. If thesoc
parameter is not set when initializingDefectRelaxSet
, then this is set to True for systems with a max atomic number (Z) >= 31 (i.e. further down the periodic table than Zn), otherwise False.See the
RelaxSet.yaml
andDefectSet.yaml
files in thedoped/VASP_sets
folder for the defaultINCAR
andKPOINT
settings, andPotcarSet.yaml
for the defaultPOTCAR
settings. These are reasonable defaults that _roughly_ match the typical values needed for accurate defect calculations, but usually will need to be modified for your specific system, such as converged ENCUT and KPOINTS, and NCORE / KPAR matching your HPC setup.Note that any changes to the default
INCAR
/POTCAR
settings should be consistent with those used for all defect and competing phase ( chemical potential) calculations.
- property bulk_vasp_nkred_std: DefectDictSet | None
Returns a
DefectDictSet
object for a singlepoint (static) bulkvasp_std
supercell calculation (i.e. with a non-Γ-only kpoint mesh) andNKRED(X,Y,Z)
INCAR tag(s) to downsample kpoints for the HF exchange part of the hybrid DFT calculation. By default, setsNKRED(X,Y,Z)
to 2 or 3 in the directions for which the k-point grid is divisible by this factor. Returns None and a warning if the input kpoint settings correspond to a Γ-only kpoint mesh (in which case(bulk_)vasp_gam
should be used) or for GGA calculations (ifLHFCALC
is set toFalse
in user_incar_settings, in which case(bulk_)vasp_std
should be used).The bulk supercell only needs to be calculated once with the same settings as the final defect calculations, which is
vasp_std
if we have a non-Γ-only final k-point mesh,vasp_ncl
if SOC effects are being included (in which casebulk_vasp_ncl
should be used for the singlepoint bulk supercell reference calculation), orvasp_gam
if the final converged k-point mesh is Γ-only (in which casebulk_vasp_gam
should be used for the singlepoint bulk supercell reference calculation). Can also sometimes be useful for the purpose of calculating defect formation energies at midway stages of the typicalvasp_gam
->vasp_nkred_std
(if hybrid & non-Γ-only k-points) ->vasp_std
(if non-Γ-only k-points) ->vasp_ncl
(if SOC included) workflow, to obtain rough formation energy estimates and flag any potential issues with defect calculations early on.See the
RelaxSet.yaml
andDefectSet.yaml
files in thedoped/VASP_sets
folder for the defaultINCAR
andKPOINT
settings, andPotcarSet.yaml
for the defaultPOTCAR
settings. These are reasonable defaults that _roughly_ match the typical values needed for accurate defect calculations, but usually will need to be modified for your specific system, such as converged ENCUT and KPOINTS, and NCORE / KPAR matching your HPC setup.Note that any changes to the default
INCAR
/POTCAR
settings should be consistent with those used for all defect and competing phase ( chemical potential) calculations.
- property bulk_vasp_std: DefectDictSet | None
Returns a
DefectDictSet
object for a singlepoint (static) bulkvasp_std
supercell calculation. Returns None and a warning if the input kpoint settings correspond to a Γ-only kpoint mesh (in which case(bulk_)vasp_gam
should be used).The bulk supercell only needs to be calculated once with the same settings as the final defect calculations, which is
vasp_std
if we have a non-Γ-only final k-point mesh,vasp_ncl
if SOC effects are being included (in which casebulk_vasp_ncl
should be used for the singlepoint bulk supercell reference calculation), orvasp_gam
if the final converged k-point mesh is Γ-only (in which casebulk_vasp_gam
should be used for the singlepoint bulk supercell reference calculation). Can also sometimes be useful for the purpose of calculating defect formation energies at midway stages of the typicalvasp_gam
->vasp_nkred_std
(if hybrid & non-Γ-only k-points) ->vasp_std
(if non-Γ-only k-points) ->vasp_ncl
(if SOC included) workflow, to obtain rough formation energy estimates and flag any potential issues with defect calculations early on.See the
RelaxSet.yaml
andDefectSet.yaml
files in thedoped/VASP_sets
folder for the defaultINCAR
andKPOINT
settings, andPotcarSet.yaml
for the defaultPOTCAR
settings. These are reasonable defaults that _roughly_ match the typical values needed for accurate defect calculations, but usually will need to be modified for your specific system, such as converged ENCUT and KPOINTS, and NCORE / KPAR matching your HPC setup.Note that any changes to the default
INCAR
/POTCAR
settings should be consistent with those used for all defect and competing phase ( chemical potential) calculations.
- property vasp_gam: DefectDictSet
Returns a
DefectDictSet
object for a VASP Γ-point-only (vasp_gam
) defect supercell relaxation. Typically not needed if ShakeNBreak structure searching has been performed (recommended), unless only Γ-point k-point sampling is required (converged) for your system, and no vasp_std calculations with multiple k-points are required (determined from kpoints settings).See the
RelaxSet.yaml
andDefectSet.yaml
files in thedoped/VASP_sets
folder for the defaultINCAR
andKPOINT
settings, andPotcarSet.yaml
for the defaultPOTCAR
settings. These are reasonable defaults that _roughly_ match the typical values needed for accurate defect calculations, but usually will need to be modified for your specific system, such as converged ENCUT and KPOINTS, and NCORE / KPAR matching your HPC setup.Note that any changes to the default
INCAR
/POTCAR
settings should be consistent with those used for all defect and competing phase ( chemical potential) calculations.
- property vasp_ncl: DefectDictSet | None
Returns a
DefectDictSet
object for a VASP defect supercell singlepoint calculation with spin-orbit coupling (SOC) included (LSORBIT = True), usingvasp_ncl
. IfDefectRelaxSet.soc
is False, then this returns None and a warning. If thesoc
parameter is not set when initializingDefectRelaxSet
, then this is set to True for systems with a max atomic number (Z) >= 31 (i.e. further down the periodic table than Zn), otherwise False.See the
RelaxSet.yaml
andDefectSet.yaml
files in thedoped/VASP_sets
folder for the defaultINCAR
andKPOINT
settings, andPotcarSet.yaml
for the defaultPOTCAR
settings. These are reasonable defaults that _roughly_ match the typical values needed for accurate defect calculations, but usually will need to be modified for your specific system, such as converged ENCUT and KPOINTS, and NCORE / KPAR matching your HPC setup.Note that any changes to the default
INCAR
/POTCAR
settings should be consistent with those used for all defect and competing phase ( chemical potential) calculations.
- property vasp_nkred_std: DefectDictSet | None
Returns a
DefectDictSet
object for a VASP defect supercell relaxation usingvasp_std
(i.e. with a non-Γ-only kpoint mesh) andNKRED(X,Y,Z)
INCAR tag(s) to downsample kpoints for the HF exchange part of hybrid DFT calculations, following the doped recommended defect calculation workflow (see docs). By default, setsNKRED(X,Y,Z)
to 2 or 3 in the directions for which the k-point grid is divisible by this factor. Returns None and a warning if the input kpoint settings correspond to a Γ-only kpoint mesh (in which casevasp_gam
should be used) or for GGA calculations (ifLHFCALC
is set toFalse
in user_incar_settings, in which casevasp_std
should be used).See the
RelaxSet.yaml
andDefectSet.yaml
files in thedoped/VASP_sets
folder for the defaultINCAR
andKPOINT
settings, andPotcarSet.yaml
for the defaultPOTCAR
settings. These are reasonable defaults that _roughly_ match the typical values needed for accurate defect calculations, but usually will need to be modified for your specific system, such as converged ENCUT and KPOINTS, and NCORE / KPAR matching your HPC setup.Note that any changes to the default
INCAR
/POTCAR
settings should be consistent with those used for all defect and competing phase ( chemical potential) calculations.
- property vasp_std: DefectDictSet | None
Returns a
DefectDictSet
object for a VASP defect supercell relaxation usingvasp_std
(i.e. with a non-Γ-only kpoint mesh). Returns None and a warning if the input kpoint settings correspond to a Γ-only kpoint mesh (in which casevasp_gam
should be used).See the
RelaxSet.yaml
andDefectSet.yaml
files in thedoped/VASP_sets
folder for the defaultINCAR
andKPOINT
settings, andPotcarSet.yaml
for the defaultPOTCAR
settings. These are reasonable defaults that _roughly_ match the typical values needed for accurate defect calculations, but usually will need to be modified for your specific system, such as converged ENCUT and KPOINTS, and NCORE / KPAR matching your HPC setup.Note that any changes to the default
INCAR
/POTCAR
settings should be consistent with those used for all defect and competing phase ( chemical potential) calculations.
- write_all(defect_dir: str | None = None, unperturbed_poscar: bool = False, vasp_gam: bool = False, bulk: bool | str = False, **kwargs)[source]
Write all VASP input files to subfolders in the
defect_dir
folder.The following subfolders are generated:
vasp_nkred_std
:Defect relaxation with a kpoint mesh and using
NKRED
. Not generated for GGA calculations (ifLHFCALC
is set toFalse
inuser_incar_settings
) or if only Γ-point sampling required.
vasp_std
:Defect relaxation with a kpoint mesh, not using
NKRED
. Not generated if only Γ-point sampling required.
vasp_ncl
:Singlepoint (static) energy calculation with SOC included. Generated if
soc=True
. Ifsoc
is not set, then by default is only generated for systems with a max atomic number (Z) >= 31 (i.e. further down the periodic table than Zn).
If vasp_gam=True (not recommended) or self.vasp_std = None (i.e. Γ-only k-point sampling converged for the kpoints settings used), then also outputs:
vasp_gam
:Γ-point only defect relaxation. Usually not needed if ShakeNBreak structure searching has been performed (recommended).
By default, does not generate a
vasp_gam
folder unlessself.vasp_std
is None (i.e. only Γ-point sampling required for this system), asvasp_gam
calculations should be performed usingShakeNBreak
for defect structure-searching and initial relaxations. Ifvasp_gam
files are desired, setvasp_gam=True
.By default,
POSCAR
files are not generated for thevasp_(nkred_)std
(andvasp_ncl
ifself.soc
is True) folders, as these should be taken fromShakeNBreak
calculations (viasnb-groundstate -d vasp_nkred_std
) or, if not following the recommended structure-searching workflow, from theCONTCAR
s ofvasp_gam
calculations. If including SOC effects (self.soc = True
), then thevasp_std
CONTCAR
s should be used as thevasp_ncl
POSCAR
s. If unperturbedPOSCAR
files are desired for thevasp_(nkred_)std
(andvasp_ncl
) folders, setunperturbed_poscar=True
.Input files for the singlepoint (static) bulk supercell reference calculation are also written to “{formula}_bulk/{subfolder}” if
bulk
is True (False by default), wheresubfolder
corresponds to the final (highest accuracy) VASP calculation in the workflow (i.e.vasp_ncl
ifself.soc=True
, otherwisevasp_std
orvasp_gam
if only Γ-point reciprocal space sampling is required). Ifbulk = "all"
, then the input files for all VASP calculations in the workflow are written to the bulk supercell folder.See the
RelaxSet.yaml
andDefectSet.yaml
files in thedoped/VASP_sets
folder for the defaultINCAR
andKPOINT
settings, andPotcarSet.yaml
for the defaultPOTCAR
settings. These are reasonable defaults that _roughly_ match the typical values needed for accurate defect calculations, but usually will need to be modified for your specific system, such as converged ENCUT and KPOINTS, and NCORE / KPAR matching your HPC setup.Note that any changes to the default
INCAR
/POTCAR
settings should be consistent with those used for all defect and competing phase ( chemical potential) calculations.The
DefectEntry
object is also written to ajson
file indefect_dir
to aid calculation provenance.- Parameters:
defect_dir (str) – Folder in which to create the VASP defect calculation inputs. Default is to use the DefectEntry name (e.g. “Y_i_C4v_O1.92_+2” etc.), from
self.defect_entry.name
. If this attribute is not set, it is automatically generated according to the doped convention (usingget_defect_name_from_entry()
). Output folder structure is<defect_dir>/<subfolder>
wheresubfolder
is the name of the corresponding VASP program to run (e.g.vasp_std
).unperturbed_poscar (bool) – If True, write the unperturbed defect POSCARs to the generated folders as well. Not recommended, as the recommended workflow is to initially perform
vasp_gam
ground-state structure searching using ShakeNBreak (https://shakenbreak.readthedocs.io), then continue thevasp(_nkred)_std
relaxations from the ground-state structures (e.g. using-d vasp_nkred_std
with snb-groundstate (CLI) orgroundstate_folder="vasp_nkred_std"
withwrite_groundstate_structure
(Python API)) first with NKRED if using hybrid DFT, then without, then use thevasp_std
CONTCAR
s as the input structures for the finalvasp_ncl
singlepoint calculations. (default: False)vasp_gam (bool) – If True, write the
vasp_gam
input files, with unperturbed defect POSCAR. Not recommended, as the recommended workflow is to initially performvasp_gam
ground-state structure searching using ShakeNBreak (https://shakenbreak.readthedocs.io), then continue thevasp_std
relaxations from the SnB ground-state structures. (default: False)bulk (bool, str) – If True, the input files for a singlepoint calculation of the bulk supercell are also written to “{formula}_bulk/{subfolder}”, where
subfolder
corresponds to the final (highest accuracy) VASP calculation in the workflow (i.e.vasp_ncl
ifself.soc=True
, otherwisevasp_std
orvasp_gam
if only Γ-point reciprocal space sampling is required). Ifbulk = "all"
then the input files for all VASP calculations in the workflow (vasp_gam
,vasp_nkred_std
,vasp_std
,vasp_ncl
(if applicable)) are written to the bulk supercell folder. (Default: False)**kwargs – Keyword arguments to pass to
DefectDictSet.write_input()
.
- write_gam(defect_dir: str | None = None, subfolder: str | None = 'vasp_gam', unperturbed_poscar: bool = True, bulk: bool = False, **kwargs)[source]
Write the input files for VASP Γ-point-only (
vasp_gam
) defect supercell relaxation. Typically not recommended for use, as the recommended workflow is to performvasp_gam
calculations usingShakeNBreak
for defect structure-searching and initial relaxations, but should be used if the final, converged k-point mesh is Γ-point- only. Ifbulk
is True, the input files for a singlepoint calculation of the bulk supercell are also written to “{formula}_bulk/{subfolder}”.See the
RelaxSet.yaml
andDefectSet.yaml
files in thedoped/VASP_sets
folder for the defaultINCAR
andKPOINT
settings, andPotcarSet.yaml
for the defaultPOTCAR
settings. These are reasonable defaults that _roughly_ match the typical values needed for accurate defect calculations, but usually will need to be modified for your specific system, such as converged ENCUT and KPOINTS, and NCORE / KPAR matching your HPC setup.Note that any changes to the default
INCAR
/POTCAR
settings should be consistent with those used for all defect and competing phase ( chemical potential) calculations.The
DefectEntry
object is also written to ajson
file indefect_dir
to aid calculation provenance.- Parameters:
defect_dir (str) – Folder in which to create the VASP defect calculation inputs. Default is to use the DefectEntry name (e.g. “Y_i_C4v_O1.92_+2” etc.), from
self.defect_entry.name
. If this attribute is not set, it is automatically generated according to the doped convention (usingget_defect_name_from_entry()
).subfolder (str) – Output folder structure is
<defect_dir>/<subfolder>
wheresubfolder
= ‘vasp_gam’ by default. Settingsubfolder
toNone
will write thevasp_gam
input files directly to the<defect_dir>
folder, with no subfolders created.unperturbed_poscar (bool) – If True (default), write the unperturbed defect POSCAR to the generated folder as well. Typically not recommended for use, as the recommended workflow is to initially perform
vasp_gam
ground-state structure searching using ShakeNBreak (https://shakenbreak.readthedocs.io), then continue thevasp(_nkred)_std
relaxations from the ground-state structures (e.g. using-d vasp_nkred_std
with snb-groundstate (CLI) orgroundstate_folder="vasp_nkred_std"
withwrite_groundstate_structure
(Python API)). (default: True)bulk (bool) – If True, the input files for a singlepoint calculation of the bulk supercell are also written to “{formula}_bulk/{subfolder}”. (Default: False)
**kwargs – Keyword arguments to pass to
DefectDictSet.write_input()
.
- write_ncl(defect_dir: str | None = None, subfolder: str | None = 'vasp_ncl', unperturbed_poscar: bool = False, bulk: bool = False, **kwargs)[source]
Write the input files for VASP defect supercell singlepoint calculations with spin-orbit coupling (SOC) included (LSORBIT = True), using
vasp_ncl
. By default, does not generatePOSCAR
(input structure) files, as these should be taken from theCONTCAR
s ofvasp_std
relaxations (originally fromShakeNBreak
structure- searching relaxations), or directly fromShakeNBreak
calculations (viasnb-groundstate -d vasp_ncl
) if only Γ-point reciprocal space sampling is required. If unperturbedPOSCAR
files are desired, setunperturbed_poscar=True
.If
DefectRelaxSet.soc
is False, then this returns None and a warning. If thesoc
parameter is not set when initializingDefectRelaxSet
, then it is set to True for systems with a max atomic number (Z) >= 31 (i.e. further down the periodic table than Zn), otherwise False. If bulk is True, the input files for a singlepoint calculation of the bulk supercell are also written to “{formula}_bulk/{subfolder}”.See the
RelaxSet.yaml
andDefectSet.yaml
files in thedoped/VASP_sets
folder for the defaultINCAR
andKPOINT
settings, andPotcarSet.yaml
for the defaultPOTCAR
settings. These are reasonable defaults that _roughly_ match the typical values needed for accurate defect calculations, but usually will need to be modified for your specific system, such as converged ENCUT and KPOINTS, and NCORE / KPAR matching your HPC setup.Note that any changes to the default
INCAR
/POTCAR
settings should be consistent with those used for all defect and competing phase ( chemical potential) calculations.The
DefectEntry
object is also written to ajson
file indefect_dir
to aid calculation provenance.- Parameters:
defect_dir (str) – Folder in which to create the VASP defect calculation inputs. Default is to use the DefectEntry name (e.g. “Y_i_C4v_O1.92_+2” etc.), from
self.defect_entry.name
. If this attribute is not set, it is automatically generated according to the doped convention (usingget_defect_name_from_entry()
).subfolder (str) – Output folder structure is
<defect_dir>/<subfolder>
wheresubfolder
= ‘vasp_ncl’ by default. Settingsubfolder
toNone
will write thevasp_ncl
input files directly to the<defect_dir>
folder, with no subfolders created.unperturbed_poscar (bool) – If True, write the unperturbed defect POSCAR to the generated folder as well. Not recommended, as the recommended workflow is to initially perform
vasp_gam
ground-state structure searching using ShakeNBreak (https://shakenbreak.readthedocs.io), then continue thevasp(_nkred)_std
relaxations from the ground-state structures (e.g. using-d vasp_nkred_std
with snb-groundstate (CLI) orgroundstate_folder="vasp_nkred_std"
withwrite_groundstate_structure
(Python API)), first with NKRED if using hybrid DFT, then without, then use thevasp_std
CONTCAR
s as the input structures for the finalvasp_ncl
singlepoint calculations. (default: False)bulk (bool) – If True, the input files for a singlepoint calculation of the bulk supercell are also written to “{formula}_bulk/{subfolder}”. (Default: False)
**kwargs – Keyword arguments to pass to
DefectDictSet.write_input()
.
- write_nkred_std(defect_dir: str | None = None, subfolder: str | None = 'vasp_nkred_std', unperturbed_poscar: bool = False, bulk: bool = False, **kwargs)[source]
Write the input files for defect calculations using
vasp_std
(i.e. with a non-Γ-only kpoint mesh) andNKRED(X,Y,Z)
INCAR tag(s) to downsample kpoints for the HF exchange part of hybrid DFT calculations, following the doped recommended defect calculation workflow (see docs). By default, setsNKRED(X,Y,Z)
to 2 or 3 in the directions for which the k-point grid is divisible by this factor.By default, does not generate
POSCAR
(input structure) files, as these should be taken from theCONTCAR
s ofShakeNBreak
calculations (viasnb-groundstate -d vasp_nkred_std
) or, if not following the recommended structure-searching workflow, from theCONTCAR
s ofvasp_gam
calculations. If unperturbedPOSCAR
files are desired, setunperturbed_poscar=True
. If bulk is True, the input files for a singlepoint calculation of the bulk supercell are also written to “{formula}_bulk/{subfolder}”.Returns None and a warning if the input kpoint settings correspond to a Γ-only kpoint mesh (in which case
vasp_gam
should be used) or for GGA calculations (ifLHFCALC
is set toFalse
in user_incar_settings, in which casevasp_std
should be used).See the
RelaxSet.yaml
andDefectSet.yaml
files in thedoped/VASP_sets
folder for the defaultINCAR
andKPOINT
settings, andPotcarSet.yaml
for the defaultPOTCAR
settings. These are reasonable defaults that _roughly_ match the typical values needed for accurate defect calculations, but usually will need to be modified for your specific system, such as converged ENCUT and KPOINTS, and NCORE / KPAR matching your HPC setup.Note that any changes to the default
INCAR
/POTCAR
settings should be consistent with those used for all defect and competing phase ( chemical potential) calculations.The
DefectEntry
object is also written to ajson
file indefect_dir
to aid calculation provenance.- Parameters:
defect_dir (str) – Folder in which to create the VASP defect calculation inputs. Default is to use the DefectEntry name (e.g. “Y_i_C4v_O1.92_+2” etc.), from
self.defect_entry.name
. If this attribute is not set, it is automatically generated according to the doped convention (usingget_defect_name_from_entry()
).subfolder (str) – Output folder structure is
<defect_dir>/<subfolder>
wheresubfolder
= ‘vasp_nkred_std’ by default. Settingsubfolder
toNone
will write thevasp_nkred_std
input files directly to the<defect_dir>
folder, with no subfolders created.unperturbed_poscar (bool) – If True, write the unperturbed defect POSCAR to the generated folder as well. Not recommended, as the recommended workflow is to initially perform
vasp_gam
ground-state structure searching using ShakeNBreak (https://shakenbreak.readthedocs.io), then continue thevasp(_nkred)_std
relaxations from the ground-state structures (e.g. using-d vasp_nkred_std
with snb-groundstate (CLI) orgroundstate_folder="vasp_nkred_std"
withwrite_groundstate_structure
(Python API)). (default: False)bulk (bool) – If True, the input files for a singlepoint calculation of the bulk supercell are also written to “{formula}_bulk/{subfolder}”. (Default: False)
**kwargs – Keyword arguments to pass to
DefectDictSet.write_input()
.
- write_std(defect_dir: str | None = None, subfolder: str | None = 'vasp_std', unperturbed_poscar: bool = False, bulk: bool = False, **kwargs)[source]
Write the input files for a VASP defect supercell calculation using
vasp_std
(i.e. with a non-Γ-only kpoint mesh). By default, does not generatePOSCAR
(input structure) files, as these should be taken from theCONTCAR
s ofvasp_std
relaxations usingNKRED(X,Y,Z)
(originally fromShakeNBreak
relaxations) if using.hybrid DFT, or from
ShakeNBreak
calculations (viasnb-groundstate -d vasp_std
) if using GGA, or, if not following the recommended structure-searching workflow, from theCONTCAR
s ofvasp_gam
calculations. If unperturbedPOSCAR
files are desired, setunperturbed_poscar=True
. If bulk is True, the input files for a singlepoint calculation of the bulk supercell are also written to “{formula}_bulk/{subfolder}”.Returns None and a warning if the input kpoint settings correspond to a Γ-only kpoint mesh (in which case
vasp_gam
should be used).See the
RelaxSet.yaml
andDefectSet.yaml
files in thedoped/VASP_sets
folder for the defaultINCAR
andKPOINT
settings, andPotcarSet.yaml
for the defaultPOTCAR
settings. These are reasonable defaults that _roughly_ match the typical values needed for accurate defect calculations, but usually will need to be modified for your specific system, such as converged ENCUT and KPOINTS, and NCORE / KPAR matching your HPC setup.Note that any changes to the default
INCAR
/POTCAR
settings should be consistent with those used for all defect and competing phase ( chemical potential) calculations.The
DefectEntry
object is also written to ajson
file indefect_dir
to aid calculation provenance.- Parameters:
defect_dir (str) – Folder in which to create the VASP defect calculation inputs. Default is to use the DefectEntry name (e.g. “Y_i_C4v_O1.92_+2” etc.), from
self.defect_entry.name
. If this attribute is not set, it is automatically generated according to the doped convention (usingget_defect_name_from_entry()
).subfolder (str) – Output folder structure is
<defect_dir>/<subfolder>
wheresubfolder
= ‘vasp_std’ by default. Settingsubfolder
toNone
will write thevasp_std
input files directly to the<defect_dir>
folder, with no subfolders created.unperturbed_poscar (bool) – If True, write the unperturbed defect POSCAR to the generated folder as well. Not recommended, as the recommended workflow is to initially perform
vasp_gam
ground-state structure searching using ShakeNBreak (https://shakenbreak.readthedocs.io), then continue thevasp(_nkred)_std
relaxations from the ground-state structures (e.g. using-d vasp_nkred_std
with snb-groundstate (CLI) orgroundstate_folder="vasp_nkred_std"
withwrite_groundstate_structure
(Python API)), first with NKRED if using hybrid DFT, then without NKRED. (default: False)bulk (bool) – If True, the input files for a singlepoint calculation of the bulk supercell are also written to “{formula}_bulk/{subfolder}”. (Default: False)
**kwargs – Keyword arguments to pass to
DefectDictSet.write_input()
.
- class doped.vasp.DefectsSet(defect_entries: DefectsGenerator | dict[str, DefectEntry] | list[DefectEntry] | DefectEntry, soc: bool | None = None, user_incar_settings: dict | None = None, user_kpoints_settings: dict | Kpoints | None = None, user_potcar_functional: str = 'PBE', user_potcar_settings: dict | None = None, **kwargs)[source]
Bases:
MSONable
An object for generating input files for VASP defect calculations from doped/pymatgen
DefectEntry
objects.Creates a dictionary of: {defect_species: DefectRelaxSet}.
DefectRelaxSet has the attributes:
DefectRelaxSet.vasp_gam
:DefectDictSet
for Gamma-point only relaxation. Usually not needed if ShakeNBreak structure searching has been performed (recommended), unless only Γ-point k-point sampling is required (converged) for your system, and no vasp_std calculations with multiple k-points are required (determined from kpoints settings).
DefectRelaxSet.vasp_nkred_std
:DefectDictSet
for relaxation with a kpoint mesh and usingNKRED
. Not generated for GGA calculations (ifLHFCALC
is set toFalse
inuser_incar_settings
) or if only Gamma kpoint sampling is required.
DefectRelaxSet.vasp_std
:DefectDictSet
for relaxation with a kpoint mesh, not usingNKRED
. Not generated if only Gamma kpoint sampling is required.
DefectRelaxSet.vasp_ncl
:DefectDictSet
for singlepoint (static) energy calculation with SOC included. Generated ifsoc=True
. Ifsoc
is not set, then by default is only generated for systems with a max atomic number (Z) >= 31 (i.e. further down the periodic table than Zn).
where
DefectDictSet
is an extension ofpymatgen
’sVaspInputSet
class for defect calculations, withincar
,poscar
,kpoints
andpotcar
attributes for the corresponding VASP defect calculations (see docstring). Also creates the correspondingbulk_vasp_...
attributes for singlepoint (static) energy calculations of the bulk (pristine, defect-free) supercell. This needs to be calculated once with the same settings as the final defect calculations, for the later calculation of defect formation energies.See the
RelaxSet.yaml
andDefectSet.yaml
files in thedoped/VASP_sets
folder for the defaultINCAR
settings, andPotcarSet.yaml
for the defaultPOTCAR
settings.Note that any changes to the default
INCAR
/POTCAR
settings should be consistent with those used for all defect and competing phase (chemical potential) calculations.- Parameters:
defect_entries (
DefectsGenerator
, dict/list ofDefectEntry
s, orDefectEntry
) – Either aDefectsGenerator
object, or a dictionary/list ofDefectEntry
s, or a singleDefectEntry
object, for which to generate VASP input files. If aDefectsGenerator
object or a dictionary (-> {defect_species: DefectEntry}), the defect folder names will be set equal todefect_species
. If a list or singleDefectEntry
object is provided, the defect folder names will be set equal toDefectEntry.name
if thename
attribute is set, otherwise generated according to thedoped
convention (seedoped.generation
). Defect charge states are taken fromDefectEntry.charge_state
.soc (bool) – Whether to generate
vasp_ncl
DefectDictSet
attribute for spin-orbit coupling singlepoint (static) energy calculations. If not set, then by default is set to True if the max atomic number (Z) in the structure is >= 31 (i.e. further down the periodic table than Zn).user_incar_settings (dict) – Dictionary of user INCAR settings (AEXX, NCORE etc.) to override default settings. Highly recommended to look at output INCARs or the
RelaxSet.yaml
andDefectSet.yaml
files in thedoped/VASP_sets
folder, to see what the default INCAR settings are. Note that any flags that aren’t numbers or True/False need to be input as strings with quotation marks (e.g.{"ALGO": "All"}
). (default: None)user_kpoints_settings (dict or Kpoints) – Dictionary of user KPOINTS settings (in
pymatgen
VaspInputSet
format) e.g. {“reciprocal_density”: 123}, or a Kpoints object, to use for thevasp_std
,vasp_nkred_std
andvasp_ncl
DefectVaspInputSet
s (Γ-only forvasp_gam
). Default is Gamma-centred, reciprocal_density = 100 [Å⁻³].user_potcar_functional (str) – POTCAR functional to use. Default is “PBE” and if this fails, tries “PBE_52”, then “PBE_54”.
user_potcar_settings (dict) – Override the default POTCARs, e.g. {“Li”: “Li_sv”}. See
doped/VASP_setsPotcarSet.yaml
for the defaultPOTCAR
set.**kwargs – Additional kwargs to pass to each
DefectRelaxSet()
.
- defect_sets
Dictionary of {defect_species:
DefectRelaxSet
}.- Type:
Dict
- defect_entries
Dictionary of {defect_species: DefectEntry} for the input defect species, for which to generate VASP input files.
- Type:
Dict
- bulk_vasp_gam
DefectDictSet
for a bulk Γ-point-only singlepoint (static) supercell calculation. Often not used, as the bulk supercell only needs to be calculated once with the same settings as the final defect calculations, which may be withvasp_std
orvasp_ncl
.- Type:
- bulk_vasp_nkred_std
DefectDictSet
for a singlepoint (static) bulkvasp_std
supercell calculation (i.e. with a non-Γ-only kpoint mesh) andNKRED(X,Y,Z)
INCAR tag(s) to downsample kpoints for the HF exchange part of the hybrid DFT calculation. Not generated for GGA calculations (ifLHFCALC
is set toFalse
in user_incar_settings) or if only Gamma kpoint sampling is required.- Type:
- bulk_vasp_std
DefectDictSet
for a singlepoint (static) bulkvasp_std
supercell calculation with a non-Γ-only kpoint mesh, not usingNKRED
. Not generated if only Gamma kpoint sampling is required.- Type:
- bulk_vasp_ncl
DefectDictSet
for singlepoint (static) energy calculation of the bulk supercell with SOC included. Generated ifsoc=True
. Ifsoc
is not set, then by default is only generated for systems with a max atomic number (Z) >= 31 (i.e. further down the periodic table than Zn).- Type:
- json_obj
Either the
DefectsGenerator
object if inputdefect_entries
is aDefectsGenerator
object, otherwise thedefect_entries
dictionary, which will be written to file whenwrite_files()
is called, to aid calculation provenance.- Type:
Union[Dict, DefectsGenerator]
- json_name
Name of the JSON file to save the
json_obj
to.- Type:
str
- Input parameters are also set as attributes.
- write_files(output_path: str = '.', unperturbed_poscar: bool = False, vasp_gam: bool = False, bulk: bool | str = True, processes: int | None = None, **kwargs)[source]
Write VASP input files to folders for all defects in
self.defect_entries
. Folder names are set to the key of the DefectRelaxSet inself.defect_sets
(same as self.defect_entries keys, seeDefectsSet
docstring).For each defect folder, the following subfolders are generated:
vasp_nkred_std
:Defect relaxation with a kpoint mesh and using
NKRED
. Not generated for GGA calculations (ifLHFCALC
is set toFalse
inuser_incar_settings
) or if only Γ-point sampling required.
vasp_std
:Defect relaxation with a kpoint mesh, not using
NKRED
. Not generated if only Γ-point sampling required.
vasp_ncl
:Singlepoint (static) energy calculation with SOC included. Generated if
soc=True
. Ifsoc
is not set, then by default is only generated for systems with a max atomic number (Z) >= 31 (i.e. further down the periodic table than Zn).
If
vasp_gam=True
(not recommended) orself.vasp_std = None
(i.e. Γ-only k-point sampling converged for the kpoints settings used), then also outputs:vasp_gam
:Γ-point only defect relaxation. Usually not needed if ShakeNBreak structure searching has been performed (recommended).
By default, does not generate a
vasp_gam
folder unlessDefectRelaxSet.vasp_std
is None (i.e. only Γ-point sampling required for this system), asvasp_gam
calculations should be performed usingShakeNBreak
for defect structure-searching and initial relaxations. Ifvasp_gam
files are desired, setvasp_gam=True
.By default,
POSCAR
files are not generated for thevasp_(nkred_)std
(andvasp_ncl
ifself.soc
is True) folders, as these should be taken fromvasp_gam
ShakeNBreak
calculations (viasnb-groundstate -d vasp_nkred_std
), some other structure-searching approach or, if not following the recommended structure-searching workflow, from theCONTCAR
s ofvasp_gam
calculations. If including SOC effects (self.soc = True
), then thevasp_std
CONTCAR
s should be used as thevasp_ncl
POSCAR
s. If unperturbedPOSCAR
files are desired for thevasp_(nkred_)std
(andvasp_ncl
) folders, setunperturbed_poscar=True
.Input files for the singlepoint (static) bulk supercell reference calculation are also written to “{formula}_bulk/{subfolder}” if
bulk
isTrue
(default), wheresubfolder
corresponds to the final (highest accuracy) VASP calculation in the workflow (i.e.vasp_ncl
ifself.soc=True
, otherwisevasp_std
orvasp_gam
if only Γ-point reciprocal space sampling is required). Ifbulk = "all"
, then the input files for all VASP calculations (gam/std/ncl) are written to the bulk supercell folder, or ifbulk = False
, then no bulk folder is created.The
DefectEntry
objects are also written tojson
files in the defect folders, as well asself.defect_entries
(self.json_obj
) in the top folder, to aid calculation provenance.See the
RelaxSet.yaml
andDefectSet.yaml
files in thedoped/VASP_sets
folder for the defaultINCAR
andKPOINT
settings, andPotcarSet.yaml
for the defaultPOTCAR
settings. These are reasonable defaults that _roughly_ match the typical values needed for accurate defect calculations, but usually will need to be modified for your specific system, such as converged ENCUT and KPOINTS, and NCORE / KPAR matching your HPC setup.Note that any changes to the default
INCAR
/POTCAR
settings should be consistent with those used for all defect and competing phase ( chemical potential) calculations.- Parameters:
output_path (str) – Folder in which to create the VASP defect calculation folders. Default is the current directory (“.”). Output folder structure is
<output_path>/<defect_species>/<subfolder>
wheredefect_species
is the key of the DefectRelaxSet inself.defect_sets
(same asself.defect_entries
keys, seeDefectsSet
docstring) andsubfolder
is the name of the corresponding VASP program to run (e.g.vasp_std
).unperturbed_poscar (bool) – If True, write the unperturbed defect POSCARs to the generated folders as well. Not recommended, as the recommended workflow is to initially perform
vasp_gam
ground-state structure searching using ShakeNBreak (https://shakenbreak.readthedocs.io), then continue thevasp(_nkred)_std
relaxations from the ground-state structures (e.g. using-d vasp_nkred_std
with snb-groundstate (CLI) orgroundstate_folder="vasp_nkred_std"
withwrite_groundstate_structure
(Python API)) first with NKRED if using hybrid DFT, then without, then use thevasp_std
CONTCAR
s as the input structures for the finalvasp_ncl
singlepoint calculations. (default: False)vasp_gam (bool) – If True, write the
vasp_gam
input files, with unperturbed defect POSCARs. Not recommended, as the recommended workflow is to initially performvasp_gam
ground-state structure searching using ShakeNBreak (https://shakenbreak.readthedocs.io), then continue thevasp_std
relaxations from the SnB ground-state structures. (default: False)bulk (bool, str) – If True, the input files for a singlepoint calculation of the bulk supercell are also written to “{formula}_bulk/{subfolder}”, where
subfolder
corresponds to the final (highest accuracy) VASP calculation in the workflow (i.e.vasp_ncl
ifself.soc=True
, otherwisevasp_std
orvasp_gam
if only Γ-point reciprocal space sampling is required). Ifbulk = "all"
then the input files for all VASP calculations in the workflow (vasp_gam
,vasp_nkred_std
,vasp_std
,vasp_ncl
(if applicable)) are written to the bulk supercell folder. (Default: False)processes (int) – Number of processes to use for multiprocessing for file writing. If not specified (default), then is dynamically set to the optimal value for the number of folders to write. (Default: None)
**kwargs – Keyword arguments to pass to
DefectDictSet.write_input()
.
- class doped.vasp.DopedDictSet(structure: Structure, user_incar_settings: dict | None = None, user_kpoints_settings: dict | Kpoints | None = None, user_potcar_functional: str = 'PBE', user_potcar_settings: dict | None = None, auto_kpar: bool = True, poscar_comment: str | None = None, **kwargs)[source]
Bases:
VaspInputSet
Modified version of
pymatgen
VaspInputSet
, to have more robustPOTCAR
handling, expedited I/O (particularly forPOTCAR
generation, which can be slow when generating many folders), ensurePOSCAR
atom sorting, avoid encoding issues withKPOINTS
comments etc.- Parameters:
structure (Structure) –
pymatgen
Structure
objectuser_incar_settings (dict) – Dictionary of user INCAR settings (AEXX, NCORE etc.) to override default
INCAR
settings. Note that any flags that aren’t numbers orTrue/False
need to be input as strings with quotation marks (e.g.{"ALGO": "All"}
). (default: None)user_kpoints_settings (dict or Kpoints) – Dictionary of user
KPOINTS
settings (inpymatgen
VaspInputSet
format) e.g.,{"reciprocal_density": 123}
, or aKpoints
object. Default is Gamma-only.user_potcar_functional (str) –
POTCAR
functional to use. Default is “PBE” and if this fails, tries “PBE_52”, then “PBE_54”.user_potcar_settings (dict) – Override the default
POTCAR
s, e.g. {“Li”: “Li_sv”}. Seedoped/VASP_sets/PotcarSet.yaml
for the defaultPOTCAR
set.auto_kpar (bool) – If
True
, andKPAR
is not set inuser_incar_settings
, attempts to setKPAR
to a reasonable value based on the k-point grid. Specifically, setsKPAR
to 2 if there are 2 or >=4 k-points in any direction, or 4 if there are at least 2 directions with 2 or >=4 k-points (otherwise remains as the default of1
). Default isTrue
.poscar_comment (str) – Comment line to use for
POSCAR
file. Default is structure formula.**kwargs – Additional kwargs to pass to
VaspInputSet
.
- property incar
Returns the
Incar
object generated from theVaspInputSet
config, with a warning ifKPAR > 1
and only one k-point.
- property kpoints
Return
kpoints
object with comment.
- property poscar: Poscar
Return
Poscar
object with comment, ensuring atom sorting.
- property potcar: Potcar
Potcar
object.Redefined to intelligently handle
pymatgen
POTCAR
issues.
- class doped.vasp.DopedKpoints(comment: str = 'Default gamma', num_kpts: int = 0, style: KpointsSupportedModes = KpointsSupportedModes.Gamma, kpts: Sequence[Kpoint] = ((1, 1, 1),), kpts_shift: Vector3D = (0, 0, 0), kpts_weights: list[float] | None = None, coord_type: Literal['Reciprocal', 'Cartesian'] | None = None, labels: list[str] | None = None, tet_number: int = 0, tet_weight: float = 0, tet_connections: list[tuple] | None = None)[source]
Bases:
Kpoints
Custom implementation of
Kpoints
to handle encoding errors that can happen on some old HPCs/Linux systems.If an encoding error occurs upon file writing, then changes Γ to Gamma and Å to Angstrom in the
KPOINTS
comment.Highly flexible constructor for Kpoints object. The flexibility comes at the cost of usability and in general, it is recommended that you use the default constructor only if you know exactly what you are doing and requires the flexibility. For most usage cases, the three automatic schemes can be constructed far more easily using the convenience static constructors (automatic, gamma_automatic, monkhorst_automatic) and it is recommended that you use those.
- Parameters:
comment (str) – String comment for Kpoints. Defaults to “Default gamma”.
num_kpts – Following VASP method of defining the KPOINTS file, this parameter is the number of kpoints specified. If set to 0 (or negative), VASP automatically generates the KPOINTS.
style – Style for generating KPOINTS. Use one of the Kpoints.supported_modes enum types.
kpts (2D array) – Array of kpoints. Even when only a single specification is required, e.g. in the automatic scheme, the kpts should still be specified as a 2D array. e.g. [(20,),] or [(2, 2, 2),].
kpts_shift (3x1 array) – Shift for kpoints.
kpts_weights (list[float]) – Optional weights for explicit kpoints.
coord_type – In line-mode, this variable specifies whether the Kpoints were given in Cartesian or Reciprocal coordinates.
labels – In line-mode, this should provide a list of labels for each kpt. It is optional in explicit kpoint mode as comments for k-points.
tet_number – For explicit kpoints, specifies the number of tetrahedrons for the tetrahedron method.
tet_weight – For explicit kpoints, specifies the weight for each tetrahedron for the tetrahedron method.
tet_connections – For explicit kpoints, specifies the connections of the tetrahedrons for the tetrahedron method. Format is a list of tuples, [ (sym_weight, [tet_vertices]), …]
The default behavior of the constructor is for a Gamma centered, 1x1x1 KPOINTS with no shift.