Relaxation methods

Relaxation Methods

An accurately strain-relaxed VASP calculation requires multiple restarts. The reasons for this lies in that the plane-wave basis is determined at the start of any particular VASP run. Hence, the basis is incorrect if the cell-shape changes during the run. The same can be said of real-space pseudo-potential grids when relaxing ionic positions.

This module contains methods to chain together VASP calculations until a fully relaxed structure is obtained.

pylada.vasp.relax.relax(vasp, structure, outdir=None, first_trial=None, maxcalls=10, keepsteps=True, nofail=False, convergence=None, minrelsteps=-1, comm=None, **kwargs)

Iterator over calls to VASP during relaxation.

This function is created automagically from pylada.vasp.relax.iter_relax. Please see that function for the description of its parameters.
Parameters:comm (Communicator) – Additional keyword argument defining how call external programs.

Contains an Extract attribute which can be used to instantiate the relevant extraction object.

pylada.vasp.relax.iter_relax(vasp, structure, outdir=None, first_trial=None, maxcalls=10, keepsteps=True, nofail=False, convergence=None, minrelsteps=-1, **kwargs)[source]

Iterator over calls to VASP during relaxation.

This generator iterates over successive VASP calculations until a fully relaxed structure is obtained. Its last calculation is static, ensuring that the final electronic structure accurately represents the relaxed structure.

The full process is to first relax the cell-shape (and internal degrees of freedom upon request) until convergence is achieved, as determined by the difference in total energies (see the keyword argument convergence) within the current VASP run. Subsequent runs keep the cell-shape constant while allowing ionic degrees of freedom to relax, until the same convergence criteria is achieved. Finally, a static calculation is performed.

It is possible to bypass cell-shape relaxations and perform only ionic-relaxations.

Parameters:
  • vaspVasp object with which to perform the relaxation.
  • structureStructure object for which to perform the relaxation.
  • outdir – Directory where to perform the calculations. Defaults to current working directory. The actual calculations are stored within the relax subdirectory.
  • first_trial (dict) – Holds parameters which are used only for the very first VASP calculation. It can be used to accelerate the first step of the relaxation if starting far from the optimum. Defaults to empty dictionary.
  • maxcalls (int) – Maximum number of calls to VASP before aborting. Defaults to 10.
  • keepsteps (bool) – If true, intermediate steps are kept. If False, intermediate steps are erased.
  • nofail (bool) – If True, will not fail if convergence is not achieved. Just keeps going. Defaults to False.
  • convergence

    Convergence criteria. If minrelsteps is positive, it is only checked after minrelsteps have been performed. Convergence is checked according to last VASP run, not from one VASP run to another. Eg. If a positive real number, convergence is achieved when the difference between the last two total-energies of the current run fall below that real number (times structure size), not when the total energies of the last two runs fall below that number. Faster, but possibly less safe.

    • None: defaults to vasp.ediff * 1e1
    • positive real number: energy convergence criteria in eV per atom.
    • negative real number: force convergence criteria in eV/angstrom.
    • callable: Takes an extraction object as input. Should return True if convergence is achieved and False otherwise.
  • minrelsteps (int) –

    Fine tunes how convergence criteria is applied.

    • positive: at least minrelsteps calls to VASP are performed before checking for convergence. If relaxation contains “cellshape”, then these calls occur during cellshape relaxation. If it does not, then the calls occur during the ionic relaxations. The calls do count towards maxcalls.
    • negative (default): argument is ignored.
  • kwargs – Other parameters are applied to the input Vasp object.
Returns:

At each step, yields an extraction object if the relevant VASP calculation already exists. Otherwise, it yields a ProgramProcess object detailing the call to the external VASP program.

Contains an Extract attribute which can be used to instantiate the relevant extraction object.

class pylada.vasp.relax.Relax(first_trial=None, maxcalls=10, keepsteps=True, nofail=False, convergence=None, minrelsteps=-1, copy=None, **kwargs)

Bases: pylada.vasp.functional.Vasp

Functional form of the pylada.vasp.relax.iter_relax method.

This class was automagically generated by pylada.tools.makeclass().

first_trial

Holds parameters which are used only for the very first VASP calculation. It can be used to accelerate the first step of the relaxation if starting far from the optimum. Defaults to empty dictionary.

maxcalls

Maximum number of calls to VASP before aborting. Defaults to 10.

keepsteps

If True, intermediate steps are kept. If False, intermediate steps are erased.

nofail

If True, will not fail if convergence is not achieved. Just keeps going. Defaults to False.

convergence

Convergence criteria. If minrelsteps is positive, it is only checked after minrelsteps have been performed.

  • None: defaults to vasp.ediff * 1e1
  • positive real number: energy convergence criteria in eV.
  • negative real number: force convergence criteria in eV/angstrom.
  • callable: Takes an extraction object as input. Should return True if convergence is achieved and False otherwise.
minrelsteps

Fine tunes how convergence criteria is applied.

  • positive: at least minrelsteps calls to VASP are performed before checking for convergence. If relaxation contains “cellshape”, then these calls occur during cellshape relaxation. If it does not, then the calls occur during the ionic relaxations. The calls do count towards maxcalls.
  • negative (default): argument is ignored.
__call__(structure, outdir=None, comm=None, **kwargs)

Iterator over calls to VASP during relaxation.

This function is created automagically from pylada.vasp.relax.iter_relax(). Please see that function for the description of its parameters.

Parameters:comm (Communicator) – Additional keyword argument defining how call external programs.
iter(structure, outdir=None, comm=None, **kwargs)

Iterator over calls to VASP during relaxation.

This function is created automagically from iter_relax. Please see that function for the description of its parameters.

Extract

Class RelaxExtract. When called, it creates the appropriate relaxation object.

pylada.vasp.relax.epitaxial(vasp, structure, outdir=None, direction=[0, 0, 1], epiconv=0.0001, initstep=0.05, comm=None, **kwargs)

Performs epitaxial relaxation in given direction.

This function is created automagically from pylada.vasp.relax.iter_epitaxial. Please see that function for the description of its parameters.
Parameters:comm (Communicator) – Additional keyword argument defining how call external programs.

Contains an Extract attribute which can be used to instantiate the relevant extraction object.

pylada.vasp.relax.iter_epitaxial(vasp, structure, outdir=None, direction=[0, 0, 1], epiconv=0.0001, initstep=0.05, **kwargs)[source]

Performs epitaxial relaxation in given direction.

This generator iterates over successive VASP calculations until an epitaxially relaxed structure is obtained. The external (cell) coordinates of the structure can only relax in the growth/epitaxial direction. Internal coordinates (ions), however, are allowed to relax in whatever direction.

Since VASP does not intrinsically allow for such a relaxation, it is performed by chaining different vasp calculations together. The minimization procedure itself is the secant method, enhanced by the knowledge of the stress tensor. The last calculation is static, for maximum accuracy.

Parameters:
  • vaspVasp functional with wich to perform the relaxation.
  • structureStructure for which to perform the relaxation.
  • outdir (str) – Directory where to perform calculations. If None, defaults to current working directory. The intermediate calculations are stored in the relax_ions subdirectory.
  • direction – Epitaxial direction. Defaults to [0, 0, 1].
  • epiconv (float) – Convergence criteria of the total energy.
Returns:

At each step, yields an extraction object if the relevant VASP calculation already exists. Otherwise, it yields a ProgramProcess object detailing the call to the external VASP program.

Contains an Extract attribute which can be used to instantiate the relevant extraction object.

class pylada.vasp.relax.Epitaxial(direction=[0, 0, 1], epiconv=0.0001, initstep=0.05, copy=None, **kwargs)

Bases: pylada.vasp.functional.Vasp

Functional form of the pylada.vasp.relax.iter_epitaxial method.

This class was automagically generated by pylada.tools.makeclass().

__call__(structure, outdir=None, comm=None, **kwargs)

Performs epitaxial relaxation in given direction.

This function is created automagically from pylada.vasp.relax.iter_epitaxial(). Please see that function for the description of its parameters.

Parameters:comm (Communicator) – Additional keyword argument defining how call external programs.
iter(structure, outdir=None, comm=None, **kwargs)

Performs epitaxial relaxation in given direction.

This function is created automagically from iter_epitaxial. Please see that function for the description of its parameters.

direction

Epitaxial direction. Defaults to [0, 0, 1].

epiconv

Convergence criteria of the total energy.

Extract

Class RelaxExtract. When called, it creates the appropriate relaxation object.

class pylada.vasp.relax.RelaxExtract(directory=None, **kwargs)[source]

Bases: pylada.vasp.extract.Extract

Extractor class for vasp relaxations.

details[source]

Intermediate steps.

MassExtract instance which maps extraction objects for intermediate steps in the ‘relax_cellshape’ and ‘relax_ions’ subdirectories.

Previous topic

Vasp class

Next topic

Extraction classes

This Page