vasp.parameters module#

VASP parameter presets and validation.

Provides convenient parameter sets for common calculation types: - Van der Waals corrections (DFT-D2, DFT-D3, TS, VdW-DF) - DFT+U for strongly correlated systems - Hybrid functionals (HSE06, PBE0, B3LYP) - Spin-orbit coupling - Machine learning force fields (MLFF) - Molecular dynamics - Phonon calculations

vasp.parameters.get_vdw_params(method)[source]#

Get VASP parameters for van der Waals correction method.

Parameters:

method (str) – Name of vdW method (e.g., ‘d3’, ‘d3bj’, ‘ts’, ‘vdw-df2’)

Returns:

Dict of VASP parameters for the vdW correction.

Raises:

ValueError – If method is not recognized.

Return type:

dict[str, Any]

Example

>>> params = get_vdw_params('d3bj')
>>> calc = Vasp(..., **params)
class vasp.parameters.HubbardU(u, j=0.0, l_angular=2)[source]#

Bases: object

Hubbard U parameters for DFT+U calculations.

Parameters:
u#

Coulomb U parameter in eV.

Type:

float

j#

Exchange J parameter in eV.

Type:

float

l_angular#

Angular momentum (0=s, 1=p, 2=d, 3=f).

Type:

int

u: float#
j: float = 0.0#
l_angular: int = 2#
vasp.parameters.get_ldau_params(symbols, u_values=None, ldautype=2, ldauprint=1, lmaxmix=4)[source]#

Generate DFT+U parameters for given atomic symbols.

Uses the Dudarev (rotationally invariant) approach by default.

Parameters:
  • symbols (list[str]) – List of unique atomic symbols in POTCAR order.

  • u_values (dict[str, float | HubbardU] | None) – Dict mapping symbol to U value or HubbardU object. If None, uses COMMON_U_VALUES for known elements.

  • ldautype (int) – 1 = Liechtenstein, 2 = Dudarev (simplified).

  • ldauprint (int) – Verbosity (0, 1, or 2).

  • lmaxmix (int) – Max l for on-site density matrix mixing.

Returns:

Dict of VASP parameters for DFT+U.

Return type:

dict[str, Any]

Example

>>> params = get_ldau_params(['Fe', 'O'], {'Fe': 4.0})
>>> calc = Vasp(..., **params)
vasp.parameters.get_hybrid_params(functional, nkpts_factor=1)[source]#

Get VASP parameters for hybrid functional calculation.

Parameters:
  • functional (str) – Name of hybrid functional (e.g., ‘hse06’, ‘pbe0’).

  • nkpts_factor (int) – Reduce k-points by this factor for HF part (useful for large cells).

Returns:

Dict of VASP parameters for hybrid calculation.

Return type:

dict[str, Any]

Example

>>> params = get_hybrid_params('hse06')
>>> calc = Vasp(..., xc='PBE', **params)
vasp.parameters.get_soc_params(saxis=(0, 0, 1), lorbmom=True, gga_compat=True)[source]#

Get parameters for spin-orbit coupling calculation.

Note: Requires vasp_ncl binary compiled without -DNGZhalf.

Parameters:
  • saxis (tuple[float, float, float]) – Spin quantization axis (default: z-axis).

  • lorbmom (bool) – Calculate orbital moments.

  • gga_compat (bool) – Use GGA_COMPAT for gradient correction.

Returns:

Dict of VASP parameters for SOC.

Return type:

dict[str, Any]

Example

>>> params = get_soc_params()
>>> calc = Vasp(..., **params)  # Use vasp_ncl!
class vasp.parameters.MLFFConfig(mode='train', rcut1=8.0, rcut2=4.0, mb=8000, mb3=8000, wtifor=10.0, wtoten=1.0, wtsif=1.0, lmlff=True)[source]#

Bases: object

Configuration for machine learning force field.

Parameters:
mode#

MLFF mode (train, select, run, refit).

Type:

str

rcut1#

Cutoff for 2-body descriptors (Å).

Type:

float

rcut2#

Cutoff for 3-body descriptors (Å).

Type:

float

mb#

Max 2-body basis functions.

Type:

int

mb3#

Max 3-body basis functions.

Type:

int

wtifor#

Weight for forces in training.

Type:

float

wtoten#

Weight for energy in training.

Type:

float

wtsif#

Weight for stress in training.

Type:

float

lmlff#

Enable MLFF.

Type:

bool

mode: str = 'train'#
rcut1: float = 8.0#
rcut2: float = 4.0#
mb: int = 8000#
mb3: int = 8000#
wtifor: float = 10.0#
wtoten: float = 1.0#
wtsif: float = 1.0#
lmlff: bool = True#
vasp.parameters.get_mlff_params(mode='train', rcut1=8.0, rcut2=4.0, **kwargs)[source]#

Get parameters for machine learning force field.

Requires VASP 6.3+ with MLFF support.

Parameters:
  • mode (str) – ‘train’ (on-the-fly), ‘run’ (prediction), ‘refit’ (optimize).

  • rcut1 (float) – Two-body cutoff radius in Å.

  • rcut2 (float) – Three-body cutoff radius in Å.

  • **kwargs – Additional ML_ parameters.

Returns:

Dict of VASP MLFF parameters.

Return type:

dict[str, Any]

Example

>>> # On-the-fly training during MD
>>> params = get_mlff_params('train')
>>> calc = Vasp(..., ibrion=0, **params)
vasp.parameters.get_md_params(ensemble='nvt-nose', temperature=300.0, timestep=1.0, nsteps=1000, temperature_final=None)[source]#

Get parameters for molecular dynamics.

Parameters:
  • ensemble (str) – ‘nve’, ‘nvt-nose’, ‘nvt-langevin’, ‘npt-parrinello’.

  • temperature (float) – Temperature in K.

  • timestep (float) – Time step in fs.

  • nsteps (int) – Number of MD steps.

  • temperature_final (float | None) – Final temperature for temperature ramp.

Returns:

Dict of VASP MD parameters.

Return type:

dict[str, Any]

Example

>>> params = get_md_params('nvt-nose', temperature=500, nsteps=5000)
>>> calc = Vasp(..., **params)
vasp.parameters.get_phonon_params(method='dfpt', supercell=None)[source]#

Get parameters for phonon calculations.

Parameters:
  • method (str) – ‘dfpt’ (IBRION=8), ‘finite-diff’ (IBRION=5/6), or ‘phonopy’.

  • supercell (tuple[int, int, int] | None) – Supercell size for finite differences (ignored for DFPT).

Returns:

Dict of VASP phonon parameters.

Return type:

dict[str, Any]

Example

>>> params = get_phonon_params('dfpt')
>>> calc = Vasp(..., **params)
vasp.parameters.get_optical_params(nbands=None, nedos=2000)[source]#

Get parameters for optical properties (frequency-dependent dielectric).

Parameters:
  • nbands (int | None) – Number of bands (increase for accurate optics).

  • nedos (int) – DOS grid points.

Returns:

Dict of VASP parameters for optical calculation.

Return type:

dict[str, Any]

vasp.parameters.get_gw_params(algo='gw0', nbands=None, nomega=50, encutgw=None)[source]#

Get parameters for GW quasiparticle calculation.

Parameters:
  • algo (str) – ‘gw0’, ‘gw’, ‘scgw0’, ‘scgw’.

  • nbands (int | None) – Number of bands for GW.

  • nomega (int) – Frequency grid points.

  • encutgw (float | None) – Response function cutoff.

Returns:

Dict of VASP GW parameters.

Return type:

dict[str, Any]

Example

>>> params = get_gw_params('gw0', nbands=200)
>>> calc = Vasp(..., **params)
vasp.parameters.get_bse_params(nbands=None, nbandso=None, nbandsv=None)[source]#

Get parameters for BSE optical calculation.

Parameters:
  • nbands (int | None) – Total number of bands.

  • nbandso (int | None) – Number of occupied bands in BSE.

  • nbandsv (int | None) – Number of unoccupied bands in BSE.

Returns:

Dict of VASP BSE parameters.

Return type:

dict[str, Any]

vasp.parameters.get_preset(name)[source]#

Get parameter preset for common calculation types.

Parameters:

name (str) – Preset name (‘static’, ‘relax’, ‘relax-cell’, ‘band-structure’, ‘dos’).

Returns:

Dict of VASP parameters.

Return type:

dict[str, Any]

Preset Functions#

vasp.parameters.get_preset(name)[source]#

Get parameter preset for common calculation types.

Parameters:

name (str) – Preset name (‘static’, ‘relax’, ‘relax-cell’, ‘band-structure’, ‘dos’).

Returns:

Dict of VASP parameters.

Return type:

dict[str, Any]

vasp.parameters.get_vdw_params(method)[source]#

Get VASP parameters for van der Waals correction method.

Parameters:

method (str) – Name of vdW method (e.g., ‘d3’, ‘d3bj’, ‘ts’, ‘vdw-df2’)

Returns:

Dict of VASP parameters for the vdW correction.

Raises:

ValueError – If method is not recognized.

Return type:

dict[str, Any]

Example

>>> params = get_vdw_params('d3bj')
>>> calc = Vasp(..., **params)
vasp.parameters.get_ldau_params(symbols, u_values=None, ldautype=2, ldauprint=1, lmaxmix=4)[source]#

Generate DFT+U parameters for given atomic symbols.

Uses the Dudarev (rotationally invariant) approach by default.

Parameters:
  • symbols (list[str]) – List of unique atomic symbols in POTCAR order.

  • u_values (dict[str, float | HubbardU] | None) – Dict mapping symbol to U value or HubbardU object. If None, uses COMMON_U_VALUES for known elements.

  • ldautype (int) – 1 = Liechtenstein, 2 = Dudarev (simplified).

  • ldauprint (int) – Verbosity (0, 1, or 2).

  • lmaxmix (int) – Max l for on-site density matrix mixing.

Returns:

Dict of VASP parameters for DFT+U.

Return type:

dict[str, Any]

Example

>>> params = get_ldau_params(['Fe', 'O'], {'Fe': 4.0})
>>> calc = Vasp(..., **params)
vasp.parameters.get_hybrid_params(functional, nkpts_factor=1)[source]#

Get VASP parameters for hybrid functional calculation.

Parameters:
  • functional (str) – Name of hybrid functional (e.g., ‘hse06’, ‘pbe0’).

  • nkpts_factor (int) – Reduce k-points by this factor for HF part (useful for large cells).

Returns:

Dict of VASP parameters for hybrid calculation.

Return type:

dict[str, Any]

Example

>>> params = get_hybrid_params('hse06')
>>> calc = Vasp(..., xc='PBE', **params)
vasp.parameters.get_soc_params(saxis=(0, 0, 1), lorbmom=True, gga_compat=True)[source]#

Get parameters for spin-orbit coupling calculation.

Note: Requires vasp_ncl binary compiled without -DNGZhalf.

Parameters:
  • saxis (tuple[float, float, float]) – Spin quantization axis (default: z-axis).

  • lorbmom (bool) – Calculate orbital moments.

  • gga_compat (bool) – Use GGA_COMPAT for gradient correction.

Returns:

Dict of VASP parameters for SOC.

Return type:

dict[str, Any]

Example

>>> params = get_soc_params()
>>> calc = Vasp(..., **params)  # Use vasp_ncl!

Data Classes#

class vasp.parameters.HubbardU(u, j=0.0, l_angular=2)[source]#

Hubbard U parameters for DFT+U calculations.

Parameters:
u#

Coulomb U parameter in eV.

Type:

float

j#

Exchange J parameter in eV.

Type:

float

l_angular#

Angular momentum (0=s, 1=p, 2=d, 3=f).

Type:

int

u: float#
j: float = 0.0#
l_angular: int = 2#