Sub-package containing the functional.
Bases: pylada.tools.input.block.AttrBlock
Interface to VASP code.
This interface makes it a bit easier to call VASP both for high-throughput calculations and for complex calculations involving more that one actual call to the program.
The main way to use the code is as follows.
First, one creates the actual functional:
>>> from pylada.vasp import Vasp
>>> functional = Vasp()
The one sets it up, taking care that all the required pseudo-potentials are defined:
>>> vasp.add_specie = 'H', '$HOME/pseudos/PAWGGA/H'
>>> vasp.add_specie = 'C', '$HOME/pseudos/PAWGGA/C'
>>> vasp.sigma = 0.2
>>> vasp.prec = 'accurate'
>>> vasp.lcharg = True
The parameters of the functional have the same name as the tags in the INCAR. The syntax is also the same, except that integers, floats, and booleans can be used wherever it makes sense.
Although a fair number of parameters already exist, some are missing. It is possible to add them with:
>>> vasp.add_keyword('tagname', value)
The tagname needs not be given in capital letters. The value can be a string, in which case it will be printed in the INCAR as is, basic types, such as integers, floats, and booleans, or list of such types. It is then possible to access the new parameter as with any other:
>>> vasp.tagname = 5
>>> vasp.tagname
5
There are few special parameters with enhanced behaviors, such as magmom, encut, or ediff_per_atom. Any parameter can be completely disabled with:
>>> vasp.sigma = None
In this case, SIGMA will simply not appear in the INCAR.
The functional is then called with two or more arguments:
>>> result = vasp(structure, 'this/directory', sigma=-1)
The first argument is a pylada.crystal.Structure instance on which to perform the calculation. The species in the structure should all have a pseudo-potential declared vias add_specie. The second argument is the directory where the calculations should take place. Other arguments, such as sigma above will change the appropriate parameter for the duration of the call (the call is stateless).
The result is an extraction object capable of grepping different properties from the OUTCAR. The major property is success. For more, please see Extract.
The best way to use this functional is in conjunction with the high-throughput interface pylada.jobfolder.
Allows asynchronous vasp calculations
This is a generator which yields two types of objects:
- ProgramProcess: once started, this process will run an actual VASP calculation.
- Extract: once the program has been runned, and extraction object is yielded, in order that the results of the run can be analyzed.
In a new calculation, an instance of each type will be yielded, in the order of their description above. It is expected that program is runned first, using the first object, before looping to the second object. Thie generator function makes it possible to run different instances of VASP simultaneously. It also makes it possible to create more complex calculations which necessitate more than one actual call to VASP (see iter_relax), while retaining the ability to run multiple VASP programs simultaneously.
If successful results (see Extract.success) already exist in outdir, Pylada defaults to not repeating the calculations. In that case, the first object described above is skipped and only an extraction object is yielded.
The __call__() method loops over this generator and makes actual VASP calls. Looking at its code is a good place to start, if you want to understand this looping business. The benefit of this approach can be seen in iter_relax (more complex calculations) and pylada.process.jobfolder.JobFolderProcess.
Parameters: |
|
---|---|
Yields : | A process and/or an extraction object, as described above. |
Raises: |
|
Note
This function is stateless. It expects that self and structure can be deepcopied correctly.
Warning
This will never overwrite successfull VASP calculation, even if the parameters to the call are different.
Calls vasp program and waits until completion.
This function makes a blocking call to the VASP external program. It will return only once the calculation is complete. To make asynchronous calls to VASP, please consider using iter().
For a description of the parameters, please see iter().
Returns: | An extraction object of type Extract. |
---|
Adds/Sets input keyword.
Extraction class.
This extraction class is used to grep output from an OUTCAR file. This attribute merely describes the type of the extraction object as Extract.
Adds additional support grid for augmentation charge evaluation.
Can be only True or False (or None for VASP default).
See also
Electronic minimization.
If is_vasp_4 is an existing configuration variable of pylada the parameters marked as vasp 5 will fail.
Warning
The string None is not allowed, as it would lead to confusion with the python object None. Please use “Nothing” instead. The python object None will simply not print the ALGO keyword to the INCAR file.
Note
By special request, “fast” is the default algorithm.
See also
Sets the absolute energy convergence criteria for electronic minimization.
EDIFF is set to this value in the INCAR.
Disables ediff_per_atom if set to anything but None. These two properties are mutually exclusive. If negative or null, defaults to zero.
See also
Sets the relative energy convergence criteria for electronic minimization.
EDIFF is set to this value times the number of atoms in the structure. This approach is more sensible than straight-off ediff when doing high-throughput over many structures.
Disables ediff if set to anything but None. These two properties are mutually exclusive. If negative or null, defaults to zero.
Sets the absolute energy convergence criteria for ionic relaxation.
EDIFFG is set to this value in the INCAR.
Disables ediffg_per_atom if set to anything but None. These two properties are mutually exclusive.
See also
Sets the relative energy convergence criteria for ionic relaxation.
This approach is more sensible than straight-off ediffg when doing high-throughput over many structures. Disables ediffg if set to anything but None. These two properties are mutually exclusive.
Defines cutoff factor for calculation.
There are three ways to set this parameter:
See also
Defines cutoff factor for GW calculation.
There are three ways to set this parameter:
See also
Number of electrons relative to neutral system.
Gets the number of electrons in the (neutral) system. Then adds value to it and computes with the resulting number of electrons.
>>> vasp.extraelectron = 0 # charge neutral system
>>> vasp.extraelectron = 1 # charge -1 (1 extra electron)
>>> vasp.extraelectron = -1 # charge +1 (1 extra hole)
Disables nelect if set to anything but None: these two properties are mutually exclusive.
Occupancy of the down-spin states for ISMEAR=-2.
List of floating points.
Occupancy of the states for ISMEAR=-2.
List of floating points.
Ions/cell-shape/volume optimization method.
Can only take a restricted set of values: -1 | 0 | 1 | 2 | 3 | 5 | 6 | 7 | 8 | 44.
See also
IBRION, relaxation, isif, nsw
Charge from which to start.
This tag decides whether to restart from a previously calculated charge density, or not. It is best to keep this attribute set to -1, in which case, Pylada takes care of copying the relevant files.
- -1: (Default) Automatically determined by Pylada. Depends on the
value of restart and the existence of the relevant files. Also takes care of non-scf bit.
- 2: Superimposition of atomic charge densities. Sets
nonscf to False.
- 10, 11, 12: Same as 0, 1, 2 above, but also sets nonscf
to True. This is a shortcut. The value is actually kept to 0, 1, or 2:
>>> vasp.icharg = 10 >>> vasp.nonscf, vasp.icharg (True, 0)
Note
Files are copied right before the calculation takes place, not before.
Degree of librerty to optimize during geometry optimization
See also
ISIF, relaxation, ibrion, nsw
Smearing function
Vasp allows a number of options:
Whether to perform spin-polarized or spin-unpolarized calculations.
Can be only 1 or 2 (or None for VASP default).
See also
Starting wavefunctions.
This tag is about which wavefunction (WAVECAR) file to read from, if any. It is best to keep this attribute set to -1, in which case, Pylada takes care of copying the relevant files.
- -1, ‘auto’: (Default) Automatically determined by Pylada. Depends on the value of restart and the existence of the relevant files. If a WAVECAR file exists, then ISTART will be set to 1 (constant cutoff).
- 0, ‘scratch’: Start from scratch.
- 1, ‘cutoff’: Restart with constant cutoff.
- 2, ‘basis’: Restart with constant basis.
- 3, ‘full’: Full restart, including TMPCAR.
This attribute can be set equivalently using an integer or a string, as shown above. In practice, the integers will be converted to strings within the python interface:
>>> vasp.istart = 0
>>> vasp.istart
'scratch'
Note
Files are copied right before the calculation takes place, not when the attribute is set.
Initial structure.
Determines which structure is written to the POSCAR. In practice, it makes it possible to restart a crashed job from the latest contcar. There are two possible options:
- auto: Pylada determines automatically what to use. If a CONTCAR
exists in either the current directory or in the restart directory (if any), then uses the latest. Otherwise, uses input structure.
scratch: Always uses input structure.
contcar: Always use CONTCAR structure unless overwrite == True.
input: Always use input structure, never restart or CONTCAR structure.
If the run was given the overwrite option, then always uses the input structure.
Note
There is no VASP equivalent to this option.
kpoints for which to perform calculations.
Whether or not to write the charge density to the CHGCAR.
Must be a boolean. Defaults to True.
See also
Sets U, nlep, and enlep parameters.
The U, nlep, and enlep parameters of the atomic species are set at the same time as the pseudo-potentials. This object merely sets up the INCAR with right input.
However, it does accept one parameter, which can be “off”, “on”, “occ” or “all”, and defines the level of verbosity of VASP (with respect to U and nlep).
Whether to compute the frequency dependent dielectic matrix.
Must be a boolean or None (leaves default to VASP).
See also
Decides whether PROOUT and PROOCAR are writtent to disk.
Can be one of 0|1|2|5|10|11|12|None.
See also
Compute the finite-difference k-derivative of the wavefunctions.
Must be a boolean or None (leaves default to VASP).
See also
Whether to include local field effects at the Hartree level only.
Must be a boolean or None (leaves default to VASP).
See also
Run calculation with spin-orbit coupling.
Accepts None, True, or False. If True, then sets nonscf to True and ispin to 2.
Whether or not to write the local potential to the LOCPOT file.
Must be a boolean. Defaults to False.
See also
Whether or not to write the wavefunctions to the WAVECAR.
Must be a boolean. Defaults to False (unlike VASP).
See also
Sets the initial magnetic moments on each atom.
There are three types of usage:
If the calculation is not spin-polarized, then the magnetic moment tag is not set.
Note
Please set by hand for non-collinear calculations
See also
Sets the absolute number of electrons.
Disables extraelectron if set to something other than None.
See also
Maximum number of self-consistent electronic minimization steps.
Must be an integer or None (leaves default to VASP).
See also
Number of non-selfconsistent steps at the beginning.
Must be an integer or None (leaves default to VASP).
See also
Minimum number of self-consistent electronic minimization steps.
Must be an integer or None (leaves default to VASP).
See also
number of grid points in the FFT-grid along the first lattice vector.
Must be an integer or None (leaves default to VASP).
number of grid points in the FFT-grid along the second lattice vector.
Must be an integer or None (leaves default to VASP).
number of grid points in the FFT-grid along the third lattice vector.
Must be an integer or None (leaves default to VASP).
If True, performs a non-self consistent calculation.
The value of this keyword is checked by icharg and used appropriately. The attribute lsorbit also acts and checks on it. It is False by default.
Parallelization over bands.
Npar defines how many nodes work on one band. It can be set to a particular number:
>>> vasp.npar = 2
Or it can be deduced automatically. Different schemes are available:
power of two: npar is set to the largest power of 2 which divides the number of processors.
>>> vasp.npar = "power of two"If the number of processors is not a power of two, prints nothing.
square root: npar is set to the square root of the number of processors.
>>> vasp.npar = "sqrt"
Sets up FFT grid in hartree-fock related routines.
Allowable options are:
See also
Path to vasp program.
Can be one of the following:
- None: defaults to vasp_program. vasp_program can take the same values as described here, except for None.
- string: Should be the path to the vasp executable. It can be either a full path, or an executable within the environment’s $PATH variable.
- callable: The callable is called with a Vasp as sole argument. It should return a string, as described above. In other words, different vasp executables can be used depending on the parameters.
Short-cut for setting up relaxation.
It accepts two parameters:
- static: for calculation without geometric relaxation.
- combination of ionic, volume, cellshape: for the type of relaxation requested.
It makes sure that isif, ibrion, and nsw take the right value for the kind of relaxation.
Calculation from which to restart.
Depending on the values of istart, icharg, and istruc, this calculation will copy the charge density, wavefunctions, and structure from this object. It should be either None, or an extraction object returned by a previous calculation (e.g. Extract):
calc1 = vasp(structure)
calc2 = vasp(structure, restart=calc2, nonscf=True)
The snippet above performs a non-self-consistent calculation using the first calculation. In this example, it is expected that istart, icharg, and istruc are all set to ‘auto’, in which case Pylada knows to do the right thing, e.g. copy whatever is available, and nothing is vasp.restart is None.
Note
The calculation from which to restart needs be successful, otherwise it is not considered.
Width of the smearing function.
Accepts floating points which may be signed with an energy unit using the quantities package:
from quantities import eV, hartree vasp.smearing = 0.2 # Defaults to eV. vasp.smearing = 0.2 * eV # Same as above, but more explicit. vasp.smearing = 0.5 * hartree # if you are so inclined.
See also
Smearing steps for ISMEAR=-3.
List of floating points. Does not accept quantities.
Species in the system.
Defines both POTCAR, U, and/or NLEP parameters. This is generally done using the method add_specie().
System title to use for calculation.
See also