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:
DopedDictSetExtension to
pymatgenVaspInputSetobject forVASPdefect calculations.- Parameters:
structure (Structure) –
pymatgenStructureobject of the defect supercellcharge_state (int) – Charge of the defect structure
user_incar_settings (dict) – Dictionary of user
INCARsettings (AEXX, NCORE etc.) to override default settings. Highly recommended to look at outputINCARs or theRelaxSet.yamlandDefectSet.yamlfiles in thedoped/VASP_setsfolder, to see what the defaultINCARsettings are. Note that any flags that aren’t numbers orTrue/Falseneed to be input as strings with quotation marks (e.g.{"ALGO": "All"}). (default: None)user_kpoints_settings (dict or Kpoints) – Dictionary of user
KPOINTSsettings (inpymatgenVaspInputSetformat) e.g.,{"reciprocal_density": 123}, or aKpointsobject. Default is Gamma-centred, reciprocal_density = 100 [Å⁻³].user_potcar_functional (str) –
POTCARfunctional 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"}. Seedoped/VASP_sets/PotcarSet.yamlfor the defaultPOTCARset.poscar_comment (str) – Comment line to use for
POSCARfiles. Default is defect name, fractional coordinates of initial site and charge state.**kwargs – Additional kwargs to pass to
VaspInputSet.
- property incar
Returns the
Incarobject generated fromDopedDictSet, withNELECTandNUPDOWNset accordingly.See https://doped.readthedocs.io/en/latest/Tips.html#spin-polarisation for discussion about appropriate
NUPDOWN/MAGMOMsettings.
- property nelect
Number of electrons (
NELECT) for the given structure and charge state.This is equal to the sum of valence electrons (
ZVAL) of thePOTCARs 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
pymatgenVaspInputSet.write_input()to allow checking of userPOTCARsetup.- 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:
MSONableAn object for generating input files for VASP defect relaxation calculations from pymatgen
DefectEntry(recommended) orStructureobjects.The supercell structure and charge state are taken from the
DefectEntryattributes, or if aStructureis provided, then from thedefect_supercellandcharge_stateinput parameters.Creates attributes:
DefectRelaxSet.vasp_gam:DefectDictSetfor 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:DefectDictSetfor relaxation with a kpoint mesh and usingNKRED. Not generated for GGA calculations (ifLHFCALCis set toFalsein user_incar_settings) or if only Gamma k-point sampling is required.
DefectRelaxSet.vasp_std:DefectDictSetfor relaxation with a kpoint mesh, not usingNKRED. Not generated if only Gamma kpoint sampling is required.
DefectRelaxSet.vasp_ncl:DefectDictSetfor singlepoint (static) energy calculation with SOC included. Generated ifsoc=True. Ifsocis 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
DefectDictSetis an extension ofpymatgen’sVaspInputSetclass for defect calculations, withincar,poscar,kpointsandpotcarattributes 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.yamlandDefectSet.yamlfiles in thedoped/VASP_setsfolder for the defaultINCARandKPOINTsettings, andPotcarSet.yamlfor the defaultPOTCARsettings. 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/POTCARsettings 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
DefectDictSets for.charge_state (int) – Charge state of the defect. Overrides
DefectEntry.charge_stateifDefectEntryis input.soc (bool) – Whether to generate
vasp_nclDefectDictSet 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.yamlandDefectSet.yamlfiles in thedoped/VASP_setsfolder, 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
pymatgenVaspInputSetformat) e.g. {“reciprocal_density”: 123}, or a Kpoints object, to use for thevasp_std,vasp_nkred_stdandvasp_nclDefectDictSets (Γ-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.yamlfor the defaultPOTCARset.**kwargs – Additional kwargs to pass to
DefectDictSet.
- vasp_gam
DefectDictSetfor 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
DefectDictSetfor 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 (ifLHFCALCis set toFalsein user_incar_settings) or if only Gamma kpoint sampling is required.- Type:
- vasp_std
DefectDictSetfor relaxation with a non-Γ-only kpoint mesh, not usingNKRED. Not generated if only Gamma kpoint sampling is required.- Type:
- vasp_ncl
DefectDictSetfor singlepoint (static) energy calculation with SOC included. Generated ifsoc=True. Ifsocis 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
DefectDictSetfor 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_stdorvasp_ncl.- Type:
- bulk_vasp_nkred_std
DefectDictSetfor a singlepoint (static) bulkvasp_stdsupercell 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 (ifLHFCALCis set toFalsein user_incar_settings) or if only Gamma kpoint sampling is required.- Type:
- bulk_vasp_std
DefectDictSetfor a singlepoint (static) bulkvasp_stdsupercell calculation with a non-Γ-only kpoint mesh, not usingNKRED. Not generated if only Gamma kpoint sampling is required.- Type:
- bulk_vasp_ncl
DefectDictSetfor singlepoint (static) energy calculation of the bulk supercell with SOC included. Generated ifsoc=True. Ifsocis 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
DefectDictSetobject 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_stdif we have a non-Γ-only final k-point mesh, orvasp_nclif SOC effects are being included. If the final converged k-point mesh is Γ-only, thenbulk_vasp_gamshould 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.yamlandDefectSet.yamlfiles in thedoped/VASP_setsfolder for the defaultINCARandKPOINTsettings, andPotcarSet.yamlfor the defaultPOTCARsettings. 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/POTCARsettings should be consistent with those used for all defect and competing phase ( chemical potential) calculations.
- property bulk_vasp_ncl: DefectDictSet | None
Returns a
DefectDictSetobject for VASP bulk supercell singlepoint calculations with spin-orbit coupling (SOC) included (LSORBIT = True), usingvasp_ncl. IfDefectRelaxSet.socis False, then this returns None and a warning. If thesocparameter 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.yamlandDefectSet.yamlfiles in thedoped/VASP_setsfolder for the defaultINCARandKPOINTsettings, andPotcarSet.yamlfor the defaultPOTCARsettings. 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/POTCARsettings should be consistent with those used for all defect and competing phase ( chemical potential) calculations.
- property bulk_vasp_nkred_std: DefectDictSet | None
Returns a
DefectDictSetobject for a singlepoint (static) bulkvasp_stdsupercell 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_gamshould be used) or for GGA calculations (ifLHFCALCis set toFalsein user_incar_settings, in which case(bulk_)vasp_stdshould be used).The bulk supercell only needs to be calculated once with the same settings as the final defect calculations, which is
vasp_stdif we have a non-Γ-only final k-point mesh,vasp_nclif SOC effects are being included (in which casebulk_vasp_nclshould be used for the singlepoint bulk supercell reference calculation), orvasp_gamif the final converged k-point mesh is Γ-only (in which casebulk_vasp_gamshould 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.yamlandDefectSet.yamlfiles in thedoped/VASP_setsfolder for the defaultINCARandKPOINTsettings, andPotcarSet.yamlfor the defaultPOTCARsettings. 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/POTCARsettings should be consistent with those used for all defect and competing phase ( chemical potential) calculations.
- property bulk_vasp_std: DefectDictSet | None
Returns a
DefectDictSetobject for a singlepoint (static) bulkvasp_stdsupercell calculation. Returns None and a warning if the input kpoint settings correspond to a Γ-only kpoint mesh (in which case(bulk_)vasp_gamshould be used).The bulk supercell only needs to be calculated once with the same settings as the final defect calculations, which is
vasp_stdif we have a non-Γ-only final k-point mesh,vasp_nclif SOC effects are being included (in which casebulk_vasp_nclshould be used for the singlepoint bulk supercell reference calculation), orvasp_gamif the final converged k-point mesh is Γ-only (in which casebulk_vasp_gamshould 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.yamlandDefectSet.yamlfiles in thedoped/VASP_setsfolder for the defaultINCARandKPOINTsettings, andPotcarSet.yamlfor the defaultPOTCARsettings. 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/POTCARsettings should be consistent with those used for all defect and competing phase ( chemical potential) calculations.
- property vasp_gam: DefectDictSet
Returns a
DefectDictSetobject 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.yamlandDefectSet.yamlfiles in thedoped/VASP_setsfolder for the defaultINCARandKPOINTsettings, andPotcarSet.yamlfor the defaultPOTCARsettings. 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/POTCARsettings should be consistent with those used for all defect and competing phase ( chemical potential) calculations.
- property vasp_ncl: DefectDictSet | None
Returns a
DefectDictSetobject for a VASP defect supercell singlepoint calculation with spin-orbit coupling (SOC) included (LSORBIT = True), usingvasp_ncl. IfDefectRelaxSet.socis False, then this returns None and a warning. If thesocparameter 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.yamlandDefectSet.yamlfiles in thedoped/VASP_setsfolder for the defaultINCARandKPOINTsettings, andPotcarSet.yamlfor the defaultPOTCARsettings. 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/POTCARsettings should be consistent with those used for all defect and competing phase ( chemical potential) calculations.
- property vasp_nkred_std: DefectDictSet | None
Returns a
DefectDictSetobject 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_gamshould be used) or for GGA calculations (ifLHFCALCis set toFalsein user_incar_settings, in which casevasp_stdshould be used).See the
RelaxSet.yamlandDefectSet.yamlfiles in thedoped/VASP_setsfolder for the defaultINCARandKPOINTsettings, andPotcarSet.yamlfor the defaultPOTCARsettings. 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/POTCARsettings should be consistent with those used for all defect and competing phase ( chemical potential) calculations.
- property vasp_std: DefectDictSet | None
Returns a
DefectDictSetobject 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_gamshould be used).See the
RelaxSet.yamlandDefectSet.yamlfiles in thedoped/VASP_setsfolder for the defaultINCARandKPOINTsettings, andPotcarSet.yamlfor the defaultPOTCARsettings. 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/POTCARsettings 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_dirfolder.The following subfolders are generated:
vasp_nkred_std:Defect relaxation with a kpoint mesh and using
NKRED. Not generated for GGA calculations (ifLHFCALCis set toFalseinuser_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. Ifsocis 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_gamfolder unlessself.vasp_stdis None (i.e. only Γ-point sampling required for this system), asvasp_gamcalculations should be performed usingShakeNBreakfor defect structure-searching and initial relaxations. Ifvasp_gamfiles are desired, setvasp_gam=True.By default,
POSCARfiles are not generated for thevasp_(nkred_)std(andvasp_nclifself.socis True) folders, as these should be taken fromShakeNBreakcalculations (viasnb-groundstate -d vasp_nkred_std) or, if not following the recommended structure-searching workflow, from theCONTCARs ofvasp_gamcalculations. If including SOC effects (self.soc = True), then thevasp_stdCONTCARs should be used as thevasp_nclPOSCARs. If unperturbedPOSCARfiles 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
bulkis True (False by default), wheresubfoldercorresponds to the final (highest accuracy) VASP calculation in the workflow (i.e.vasp_nclifself.soc=True, otherwisevasp_stdorvasp_gamif 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.yamlandDefectSet.yamlfiles in thedoped/VASP_setsfolder for the defaultINCARandKPOINTsettings, andPotcarSet.yamlfor the defaultPOTCARsettings. 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/POTCARsettings should be consistent with those used for all defect and competing phase ( chemical potential) calculations.The
DefectEntryobject is also written to ajsonfile indefect_dirto 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>wheresubfolderis 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_gamground-state structure searching using ShakeNBreak (https://shakenbreak.readthedocs.io), then continue thevasp(_nkred)_stdrelaxations from the ground-state structures (e.g. using-d vasp_nkred_stdwith 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_stdCONTCARs as the input structures for the finalvasp_nclsinglepoint calculations. (default: False)vasp_gam (bool) – If True, write the
vasp_gaminput files, with unperturbed defect POSCAR. Not recommended, as the recommended workflow is to initially performvasp_gamground-state structure searching using ShakeNBreak (https://shakenbreak.readthedocs.io), then continue thevasp_stdrelaxations 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
subfoldercorresponds to the final (highest accuracy) VASP calculation in the workflow (i.e.vasp_nclifself.soc=True, otherwisevasp_stdorvasp_gamif 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_gamcalculations usingShakeNBreakfor defect structure-searching and initial relaxations, but should be used if the final, converged k-point mesh is Γ-point- only. Ifbulkis True, the input files for a singlepoint calculation of the bulk supercell are also written to “{formula}_bulk/{subfolder}”.See the
RelaxSet.yamlandDefectSet.yamlfiles in thedoped/VASP_setsfolder for the defaultINCARandKPOINTsettings, andPotcarSet.yamlfor the defaultPOTCARsettings. 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/POTCARsettings should be consistent with those used for all defect and competing phase ( chemical potential) calculations.The
DefectEntryobject is also written to ajsonfile indefect_dirto 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. SettingsubfoldertoNonewill write thevasp_gaminput 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_gamground-state structure searching using ShakeNBreak (https://shakenbreak.readthedocs.io), then continue thevasp(_nkred)_stdrelaxations from the ground-state structures (e.g. using-d vasp_nkred_stdwith 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 theCONTCARs ofvasp_stdrelaxations (originally fromShakeNBreakstructure- searching relaxations), or directly fromShakeNBreakcalculations (viasnb-groundstate -d vasp_ncl) if only Γ-point reciprocal space sampling is required. If unperturbedPOSCARfiles are desired, setunperturbed_poscar=True.If
DefectRelaxSet.socis False, then this returns None and a warning. If thesocparameter 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.yamlandDefectSet.yamlfiles in thedoped/VASP_setsfolder for the defaultINCARandKPOINTsettings, andPotcarSet.yamlfor the defaultPOTCARsettings. 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/POTCARsettings should be consistent with those used for all defect and competing phase ( chemical potential) calculations.The
DefectEntryobject is also written to ajsonfile indefect_dirto 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. SettingsubfoldertoNonewill write thevasp_nclinput 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_gamground-state structure searching using ShakeNBreak (https://shakenbreak.readthedocs.io), then continue thevasp(_nkred)_stdrelaxations from the ground-state structures (e.g. using-d vasp_nkred_stdwith 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_stdCONTCARs as the input structures for the finalvasp_nclsinglepoint 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 theCONTCARs ofShakeNBreakcalculations (viasnb-groundstate -d vasp_nkred_std) or, if not following the recommended structure-searching workflow, from theCONTCARs ofvasp_gamcalculations. If unperturbedPOSCARfiles 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_gamshould be used) or for GGA calculations (ifLHFCALCis set toFalsein user_incar_settings, in which casevasp_stdshould be used).See the
RelaxSet.yamlandDefectSet.yamlfiles in thedoped/VASP_setsfolder for the defaultINCARandKPOINTsettings, andPotcarSet.yamlfor the defaultPOTCARsettings. 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/POTCARsettings should be consistent with those used for all defect and competing phase ( chemical potential) calculations.The
DefectEntryobject is also written to ajsonfile indefect_dirto 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. SettingsubfoldertoNonewill write thevasp_nkred_stdinput 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_gamground-state structure searching using ShakeNBreak (https://shakenbreak.readthedocs.io), then continue thevasp(_nkred)_stdrelaxations from the ground-state structures (e.g. using-d vasp_nkred_stdwith 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 theCONTCARs ofvasp_stdrelaxations usingNKRED(X,Y,Z)(originally fromShakeNBreakrelaxations) if using.hybrid DFT, or from
ShakeNBreakcalculations (viasnb-groundstate -d vasp_std) if using GGA, or, if not following the recommended structure-searching workflow, from theCONTCARs ofvasp_gamcalculations. If unperturbedPOSCARfiles 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_gamshould be used).See the
RelaxSet.yamlandDefectSet.yamlfiles in thedoped/VASP_setsfolder for the defaultINCARandKPOINTsettings, andPotcarSet.yamlfor the defaultPOTCARsettings. 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/POTCARsettings should be consistent with those used for all defect and competing phase ( chemical potential) calculations.The
DefectEntryobject is also written to ajsonfile indefect_dirto 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. SettingsubfoldertoNonewill write thevasp_stdinput 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_gamground-state structure searching using ShakeNBreak (https://shakenbreak.readthedocs.io), then continue thevasp(_nkred)_stdrelaxations from the ground-state structures (e.g. using-d vasp_nkred_stdwith 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:
MSONableAn object for generating input files for VASP defect calculations from doped/pymatgen
DefectEntryobjects.Creates a dictionary of: {defect_species: DefectRelaxSet}.
DefectRelaxSet has the attributes:
DefectRelaxSet.vasp_gam:DefectDictSetfor 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:DefectDictSetfor relaxation with a kpoint mesh and usingNKRED. Not generated for GGA calculations (ifLHFCALCis set toFalseinuser_incar_settings) or if only Gamma kpoint sampling is required.
DefectRelaxSet.vasp_std:DefectDictSetfor relaxation with a kpoint mesh, not usingNKRED. Not generated if only Gamma kpoint sampling is required.
DefectRelaxSet.vasp_ncl:DefectDictSetfor singlepoint (static) energy calculation with SOC included. Generated ifsoc=True. Ifsocis 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
DefectDictSetis an extension ofpymatgen’sVaspInputSetclass for defect calculations, withincar,poscar,kpointsandpotcarattributes 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.yamlandDefectSet.yamlfiles in thedoped/VASP_setsfolder for the defaultINCARsettings, andPotcarSet.yamlfor the defaultPOTCARsettings.Note that any changes to the default
INCAR/POTCARsettings should be consistent with those used for all defect and competing phase (chemical potential) calculations.- Parameters:
defect_entries (
DefectsGenerator, dict/list ofDefectEntrys, orDefectEntry) – Either aDefectsGeneratorobject, or a dictionary/list ofDefectEntrys, or a singleDefectEntryobject, for which to generate VASP input files. If aDefectsGeneratorobject or a dictionary (-> {defect_species: DefectEntry}), the defect folder names will be set equal todefect_species. If a list or singleDefectEntryobject is provided, the defect folder names will be set equal toDefectEntry.nameif thenameattribute is set, otherwise generated according to thedopedconvention (seedoped.generation). Defect charge states are taken fromDefectEntry.charge_state.soc (bool) – Whether to generate
vasp_nclDefectDictSetattribute 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.yamlandDefectSet.yamlfiles in thedoped/VASP_setsfolder, 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
pymatgenVaspInputSetformat) e.g. {“reciprocal_density”: 123}, or a Kpoints object, to use for thevasp_std,vasp_nkred_stdandvasp_nclDefectVaspInputSets (Γ-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.yamlfor the defaultPOTCARset.**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
DefectDictSetfor 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_stdorvasp_ncl.- Type:
- bulk_vasp_nkred_std
DefectDictSetfor a singlepoint (static) bulkvasp_stdsupercell 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 (ifLHFCALCis set toFalsein user_incar_settings) or if only Gamma kpoint sampling is required.- Type:
- bulk_vasp_std
DefectDictSetfor a singlepoint (static) bulkvasp_stdsupercell calculation with a non-Γ-only kpoint mesh, not usingNKRED. Not generated if only Gamma kpoint sampling is required.- Type:
- bulk_vasp_ncl
DefectDictSetfor singlepoint (static) energy calculation of the bulk supercell with SOC included. Generated ifsoc=True. Ifsocis 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
DefectsGeneratorobject if inputdefect_entriesis aDefectsGeneratorobject, otherwise thedefect_entriesdictionary, 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_objto.- 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, seeDefectsSetdocstring).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 (ifLHFCALCis set toFalseinuser_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. Ifsocis 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_gamfolder unlessDefectRelaxSet.vasp_stdis None (i.e. only Γ-point sampling required for this system), asvasp_gamcalculations should be performed usingShakeNBreakfor defect structure-searching and initial relaxations. Ifvasp_gamfiles are desired, setvasp_gam=True.By default,
POSCARfiles are not generated for thevasp_(nkred_)std(andvasp_nclifself.socis True) folders, as these should be taken fromvasp_gamShakeNBreakcalculations (viasnb-groundstate -d vasp_nkred_std), some other structure-searching approach or, if not following the recommended structure-searching workflow, from theCONTCARs ofvasp_gamcalculations. If including SOC effects (self.soc = True), then thevasp_stdCONTCARs should be used as thevasp_nclPOSCARs. If unperturbedPOSCARfiles 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
bulkisTrue(default), wheresubfoldercorresponds to the final (highest accuracy) VASP calculation in the workflow (i.e.vasp_nclifself.soc=True, otherwisevasp_stdorvasp_gamif 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
DefectEntryobjects are also written tojsonfiles in the defect folders, as well asself.defect_entries(self.json_obj) in the top folder, to aid calculation provenance.See the
RelaxSet.yamlandDefectSet.yamlfiles in thedoped/VASP_setsfolder for the defaultINCARandKPOINTsettings, andPotcarSet.yamlfor the defaultPOTCARsettings. 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/POTCARsettings 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_speciesis the key of the DefectRelaxSet inself.defect_sets(same asself.defect_entrieskeys, seeDefectsSetdocstring) andsubfolderis 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_gamground-state structure searching using ShakeNBreak (https://shakenbreak.readthedocs.io), then continue thevasp(_nkred)_stdrelaxations from the ground-state structures (e.g. using-d vasp_nkred_stdwith 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_stdCONTCARs as the input structures for the finalvasp_nclsinglepoint calculations. (default: False)vasp_gam (bool) – If True, write the
vasp_gaminput files, with unperturbed defect POSCARs. Not recommended, as the recommended workflow is to initially performvasp_gamground-state structure searching using ShakeNBreak (https://shakenbreak.readthedocs.io), then continue thevasp_stdrelaxations 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
subfoldercorresponds to the final (highest accuracy) VASP calculation in the workflow (i.e.vasp_nclifself.soc=True, otherwisevasp_stdorvasp_gamif 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:
VaspInputSetModified version of
pymatgenVaspInputSet, to have more robustPOTCARhandling, expedited I/O (particularly forPOTCARgeneration, which can be slow when generating many folders), ensurePOSCARatom sorting, avoid encoding issues withKPOINTScomments etc.- Parameters:
structure (Structure) –
pymatgenStructureobjectuser_incar_settings (dict) – Dictionary of user INCAR settings (AEXX, NCORE etc.) to override default
INCARsettings. Note that any flags that aren’t numbers orTrue/Falseneed to be input as strings with quotation marks (e.g.{"ALGO": "All"}). (default: None)user_kpoints_settings (dict or Kpoints) – Dictionary of user
KPOINTSsettings (inpymatgenVaspInputSetformat) e.g.,{"reciprocal_density": 123}, or aKpointsobject. Default is Gamma-only.user_potcar_functional (str) –
POTCARfunctional 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”}. Seedoped/VASP_sets/PotcarSet.yamlfor the defaultPOTCARset.auto_kpar (bool) – If
True, andKPARis not set inuser_incar_settings, attempts to setKPARto a reasonable value based on the k-point grid. Specifically, setsKPARto 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
POSCARfile. Default is structure formula.**kwargs – Additional kwargs to pass to
VaspInputSet.
- property incar
Returns the
Incarobject generated from theVaspInputSetconfig, with a warning ifKPAR > 1and only one k-point.
- property kpoints
Return
kpointsobject with comment.
- property poscar: Poscar
Return
Poscarobject with comment, ensuring atom sorting.
- property potcar: Potcar
Potcarobject.Redefined to intelligently handle
pymatgenPOTCARissues.
- 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:
KpointsCustom implementation of
Kpointsto 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
KPOINTScomment.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.