pyiron.vasp.base module¶
-
class
pyiron.vasp.base.
DFTOutput
[source]¶ Bases:
object
This class stores the DFT specific output
-
log_dict
¶ A dictionary of all tags and values of DFT data
- Type
dict
-
from_hdf
(hdf)[source]¶ Reads the attributes and reconstructs the object from a hdf file :param hdf: The hdf5 instance
-
to_hdf
(hdf)[source]¶ Save the object in a HDF5 file
- Parameters
hdf (pyiron.base.generic.hdfio.ProjectHDFio) – HDF path to which the object is to be saved
-
-
class
pyiron.vasp.base.
GenericOutput
[source]¶ Bases:
object
This class stores the generic output like different structures, energies and forces from a simulation in a highly generic format. Usually the user does not have to access this class.
-
log_dict
¶ A dictionary of all tags and values of generic data (positions, forces, etc)
- Type
dict
-
property
bands
¶
-
from_hdf
(hdf)[source]¶ Reads the attributes and reconstructs the object from a hdf file :param hdf: The hdf5 instance
-
to_hdf
(hdf)[source]¶ Save the object in a HDF5 file
- Parameters
hdf (pyiron.base.generic.hdfio.ProjectHDFio) – HDF path to which the object is to be saved
-
-
class
pyiron.vasp.base.
Incar
(input_file_name=None, table_name='incar')[source]¶ Bases:
pyiron.base.generic.parameters.GenericParameters
Class to control the INCAR file of a vasp simulation
-
class
pyiron.vasp.base.
Input
[source]¶ Bases:
object
Handles setting the input parameters for a VASP job.
-
incar
¶ .vasp.vasp.Incar instance to handle the INCAR file inputs in VASP
-
kpoints
¶ vasp.vasp.Kpoints instance to handle the KPOINTS file inputs in VASP
-
potcar
¶ vasp.vasp.Potcar instance to set the appropriate POTCAR files for the simulation
Ideally, the user would not have to access the Input instance unless the user wants to set an extremely specific VASP tag which can’t se set using functions in Vasp().
Examples
>>> atoms = CrystalStructure("Pt", BravaisBasis="fcc", a=3.98) >>> ham = VaspBase("trial") >>> ham.structure = atoms >>> ham.calc_static() >>> assert(atoms==ham.structure) >>> assert(ham.input.incar["ISIF"]==-1)
-
from_hdf
(hdf)[source]¶ Reads the attributes and reconstructs the object from a hdf file
- Parameters
hdf – The hdf5 instance
-
to_hdf
(hdf)[source]¶ Save the object in a HDF5 file
- Parameters
hdf (pyiron.base.generic.hdfio.ProjectHDFio) – HDF path to which the object is to be saved
-
-
class
pyiron.vasp.base.
Kpoints
(input_file_name=None, table_name='kpoints')[source]¶ Bases:
pyiron.base.generic.parameters.GenericParameters
Class to control the KPOINTS file of a vasp simulation
-
from_hdf
(hdf, group_name=None)[source]¶ Restore the GenericParameters from an HDF5 file
- Parameters
hdf (ProjectHDFio) – HDF5 group object
group_name (str) – HDF5 subgroup name - optional
-
set_kpoints_file
(method=None, size_of_mesh=None, shift=None, n_path=None, path=None)[source]¶ Sets appropriate tags and values in the KPOINTS file :param method: Type of meshing scheme (Gamma, MP, Manual or Line) :type method: str :param size_of_mesh: List of size 1x3 specifying the required mesh size :type size_of_mesh: list/numpy.ndarray :param shift: List of size 1x3 specifying the user defined shift from the Gamma point :type shift: list :param n_path: Number of points per trace for line mode :type n_path: int :param path: List of tuples including path coorinate and name. :type path: list
-
to_hdf
(hdf, group_name=None)[source]¶ Store the GenericParameters in an HDF5 file
- Parameters
hdf (ProjectHDFio) – HDF5 group object
group_name (str) – HDF5 subgroup name - optional
-
-
class
pyiron.vasp.base.
Output
[source]¶ Bases:
object
Handles the output from a VASP simulation.
-
electronic_structure
¶ Gives the electronic structure of the system
-
electrostatic_potential
¶ Gives the electrostatic/local potential of the system
-
charge_density
¶ Gives the charge density of the system
-
collect
(directory='/home/docs/checkouts/readthedocs.org/user_builds/pyiron/checkouts/pyiron-0.2.17/docs', sorted_indices=None)[source]¶ Collects output from the working directory
- Parameters
directory (str) – Path to the directory
sorted_indices (np.array/None) –
-
from_hdf
(hdf)[source]¶ Reads the attributes and reconstructs the object from a hdf file :param hdf: The hdf5 instance
-
property
structure
¶ Getter for the output structure
-
to_hdf
(hdf)[source]¶ Save the object in a HDF5 file
- Parameters
hdf (pyiron.base.generic.hdfio.ProjectHDFio) – HDF path to which the object is to be saved
-
-
class
pyiron.vasp.base.
VaspBase
(project, job_name)[source]¶ Bases:
pyiron.dft.job.generic.GenericDFTJob
Class to setup and run and analyze VASP simulations which is a derivative of pyiron.objects.job.generic.GenericJob. The functions in these modules are written in such the function names and attributes are very generic (get_structure(), molecular_dynamics(), version) but the functions are written to handle VASP specific input/output.
- Parameters
project (pyiron.project.Project instance) – Specifies the project path among other attributes
job_name (str) – Name of the job
-
input
¶ Instance which handles the input
- Type
pyiron.vasp.vasp.Input
Examples
Let’s say you need to run a vasp simulation where you would like to control the input parameters manually. To set up a static dft run with Gaussian smearing and a k-point MP mesh of [6, 6, 6]. You would have to set it up as shown below:
>>> ham = VaspBase(job_name="trial_job") >>> ham.input.incar[IBRION] = -1 >>> ham.input.incar[ISMEAR] = 0 >>> ham.input.kpoints.set_kpoints_file(size_of_mesh=[6, 6, 6])
However, the according to pyiron’s philosophy, it is recommended to avoid using code specific tags like IBRION, ISMEAR etc. Therefore the recommended way to set this calculation is as follows:
>>> ham = VaspBase(job_name="trial_job") >>> ham.calc_static() >>> ham.set_occupancy_smearing(smearing="gaussian") >>> ham.set_kpoints(mesh=[6, 6, 6]) The exact same tags as in the first examples are set automatically.
-
append_charge_density
(job_specifier=None, path=None)[source]¶ Append charge density file (CHGCAR)
- Parameters
job_specifier (str/int) – name of the job or job ID
path (str) – path to CHGCAR file
-
append_wave_function
(job_specifier=None, path=None)[source]¶ Append wave function file (WAVECAR)
- Parameters
job_specifier (str/int) – name of the job or job ID
path (str) – path to WAVECAR file
-
calc_md
(temperature=None, n_ionic_steps=1000, n_print=1, time_step=1.0, retain_charge_density=False, retain_electrostatic_potential=False, **kwargs)[source]¶ Sets appropriate tags for molecular dynamics in VASP
- Parameters
temperature (int/float/list) – Temperature/ range of temperatures in Kelvin
n_ionic_steps (int) – Maximum number of ionic steps
n_print (int) – Prints outputs every n_print steps
time_step (float) – time step (fs)
retain_charge_density (bool) – True id the charge density should be written
retain_electrostatic_potential (bool) – True if the electrostatic potential should be written
-
calc_minimize
(electronic_steps=400, ionic_steps=100, max_iter=None, pressure=None, algorithm=None, retain_charge_density=False, retain_electrostatic_potential=False, ionic_energy=None, ionic_forces=None, volume_only=False)[source]¶ Function to setup the hamiltonian to perform ionic relaxations using DFT. The ISIF tag has to be supplied separately.
- Parameters
electronic_steps (int) – Maximum number of electronic steps
ionic_steps (int) – Maximum number of ionic
max_iter (int) – Maximum number of iterations
pressure (float) – External pressure to be applied
algorithm (str) – Type of VASP algorithm to be used “Fast”/”Accurate”
retain_charge_density (bool) – True if the charge density should be written
retain_electrostatic_potential (boolean) – True if the electrostatic potential should be written
ionic_energy (float) – Ionic energy convergence criteria (eV)
ionic_forces (float) – Ionic forces convergence criteria (overwrites ionic energy) (ev/A)
volume_only (bool) – Option to relax only the volume (keeping the relative coordinates fixed
-
calc_static
(electronic_steps=400, algorithm=None, retain_charge_density=False, retain_electrostatic_potential=False)[source]¶ Function to setup the hamiltonian to perform static SCF DFT runs.
- Parameters
electronic_steps (int) – Maximum number of electronic steps
algorithm (str) – Type of VASP algorithm to be used “Fast”/”Accurate”
retain_charge_density (bool) – True if
retain_electrostatic_potential (bool) – True/False
-
cleanup
(files_to_remove='WAVECAR', 'CHGCAR', 'CHG', 'vasprun.xml')[source]¶ Removes excess files (by default: WAVECAR, CHGCAR, CHG)
-
compress
(files_to_compress=None)[source]¶ Compress the output files of a job object.
- Parameters
files_to_compress (list) – A list of files to compress (optional)
-
convergence_check
()[source]¶ Validate the convergence of the calculation.
- Returns
If the calculation is converged
- Return type
(bool)
-
copy_hamiltonian
(job_name)[source]¶ Copies a job to new one with a different name.
- Parameters
job_name (str) – Job name
- Returns
New job
- Return type
-
property
exchange_correlation_functional
¶ The exchange correlation functional used (LDA or GGA)
-
property
fix_spin_constraint
¶ Tells if the type of constraints the spins have for this calculation
- Type
bool
-
property
fix_symmetry
¶
-
from_directory
(directory)[source]¶ The Vasp instance is created by parsing the input and output from the specified directory
- Parameters
directory (str) – Path to the directory
-
from_hdf
(hdf=None, group_name=None)[source]¶ Recreates instance from the hdf5 file
- Parameters
hdf (pyiron.base.generic.hdfio.ProjectHDFio) – The HDF file/path to read the data from
group_name (str) – The name of the group under which the data must be stored as
-
get_charge_density
()[source]¶ Gets the charge density from the hdf5 file. This value is normalized by the volume
- Returns
atomistics.volumetric.generic.VolumetricData instance
-
get_electronic_structure
()[source]¶ Gets the electronic structure instance from the hdf5 file
- Returns
pyiron.atomistics.waves.electronic.ElectronicStructure instance
-
get_electrostatic_potential
()[source]¶ Gets the electrostatic potential from the hdf5 file.
- Returns
atomistics.volumetric.generic.VolumetricData instance
-
get_final_structure_from_file
(filename='CONTCAR')[source]¶ Get the final structure of the simulation usually from the CONTCAR file
- Parameters
filename (str) – Path to the CONTCAR file in VASP
- Returns
The final structure
- Return type
-
get_icharg_value
(icharg=None, self_consistent_calc=None)[source]¶ Gives the correct ICHARG value for the restart calculation.
- Parameters
icharg (int/None) – If given, this value will be checked for validity and returned.
self_consistent_calc (bool/None) – If ‘True’ returns 1, if ‘False’ returns 11, if ‘None’ returns based on the job either 1 or 11.
- Returns
the icharg tag
- Return type
int
-
get_magnetic_moments
(iteration_step=- 1)[source]¶ Gives the magnetic moments of a calculation for each iteration step.
- Parameters
iteration_step (int) – Step for which the structure is requested
- Returns
array of final magmetic moments or None if no magnetic moment is given
- Return type
numpy.ndarray/None
-
get_nelect
()[source]¶ Returns the number of electrons in the systems
- Returns
Number of electrons in the system
- Return type
float
-
get_rwigs
()[source]¶ Gets the radii of Wigner-Seitz cell. (RWIGS tag)
- Returns
dictionary of radii
- Return type
dict
-
list_potentials
()[source]¶ Lists all the possible POTCAR files for the elements in the structure depending on the XC functional
- Returns
a list of available potentials
- Return type
list
-
property
plane_wave_cutoff
¶ Plane wave energy cutoff in eV
-
property
potential
¶
-
property
potential_available
¶
-
property
potential_list
¶
-
property
potential_view
¶
-
property
publication
¶
-
restart
(job_name=None, job_type=None)[source]¶ Restart a new job created from an existing Vasp calculation.
- Parameters
job_name (str) – Job name
job_type (str) – Job type. If not specified a Vasp job type is assumed
- Returns
New job
- Return type
new_ham (vasp.vasp.Vasp instance)
-
restart_for_band_structure_calculations
(job_name=None)[source]¶ Restart a new job created from an existing Vasp calculation by reading the charge density for band structure calculations.
- Parameters
job_name (str/None) – Job name
- Returns
New job
- Return type
new_ham (vasp.vasp.Vasp instance)
-
restart_from_charge_density
(job_name=None, job_type=None, icharg=None, self_consistent_calc=None)[source]¶ Restart a new job created from an existing Vasp calculation by reading the charge density.
- Parameters
job_name (str/None) – Job name
job_type (str/None) – Job type. If not specified a Vasp job type is assumed
icharg (int/None) – If given, this value will be checked for validity and returned.
self_consistent_calc (bool/None) – If ‘True’ returns 1, if ‘False’ returns 11, if ‘None’ returns based on the job either 1 or 11.
- Returns
New job
- Return type
new_ham (vasp.vasp.Vasp instance)
-
restart_from_wave_and_charge
(job_name=None, job_type=None, icharg=None, self_consistent_calc=None, istart=1)[source]¶ Restart a new job created from an existing Vasp calculation by reading the charge density and the wave function.
- Parameters
job_name (str/None) – Job name
job_type (str/None) – Job type. If not specified a Vasp job type is assumed
icharg (int/None) – If given, this value will be checked for validity and returned.
self_consistent_calc (bool/None) – If ‘True’ returns 1, if ‘False’ returns 11, if ‘None’ returns based on the job either 1 or 11.
istart (int) – Vasp ISTART tag
- Returns
New job
- Return type
new_ham (vasp.vasp.Vasp instance)
-
restart_from_wave_functions
(job_name=None, job_type=None, istart=1)[source]¶ Restart a new job created from an existing Vasp calculation by reading the wave functions.
- Parameters
job_name (str/None) – Job name
job_type (str/None) – Job type. If not specified a Vasp job type is assumed
istart (int) – Vasp ISTART tag
- Returns
New job
- Return type
new_ham (vasp.vasp.Vasp instance)
-
set_algorithm
(algorithm='Fast', ialgo=None)[source]¶ Sets the type of electronic minimization algorithm
- Parameters
algorithm (str) – Algorithm defined by VASP (Fast, Normal etc.)
ialgo (int) – Sets the IALGO tag in VASP. If not none, this overwrites algorithm
-
set_convergence_precision
(ionic_energy=0.001, electronic_energy=1e-07, ionic_forces=0.01)[source]¶ Sets the electronic and ionic convergence precision. For ionic convergence either the energy or the force precision is required
- Parameters
ionic_energy (float) – Ionic energy convergence precision (eV)
electronic_energy (float) – Electronic energy convergence precision (eV)
ionic_forces (float) – Ionic force convergence precision (eV/A)
-
set_coulomb_interactions
(interaction_type=2, ldau_print=True)[source]¶ Write the on-site Coulomb interactions in the INCAR file
- Parameters
interaction_type (int) – Type of Coulombic interaction 1 - Asimov method 2 - Dudarev method
ldau_print (boolean) – True/False
-
set_dipole_correction
(direction=2, dipole_center=None)[source]¶ Apply a dipole correction using the dipole layer method proposed by Neugebauer & Scheffler
- Parameters
direction (int) – Direction along which the field has to be applied (0, 1, or 2)
dipole_center (list/numpy.ndarray) – Position of the center of the dipole (not the center of the vacuum) in relative coordinates
-
set_eddrmm_handling
(status='warn')[source]¶ Sets the way, how EDDRMM warning is handled.
- Parameters
status (str) – new status of EDDRMM handling (can be ‘warn’, ‘ignore’, or ‘restart’)
-
set_electric_field
(e_field=0.1, direction=2, dipole_center=None)[source]¶ Set an external electric field using the dipole layer method proposed by Neugebauer & Scheffler
- Parameters
e_field (float) – Magnitude of the external electric field (eV/A)
direction (int) – Direction along which the field has to be applied (0, 1, or 2)
dipole_center (list/numpy.ndarray) – Position of the center of the dipole (not the center of the vacuum) in relative coordinates
-
set_empty_states
(n_empty_states=None)[source]¶ Sets the number of empty states in the calculation :param n_empty_states: Required number of empty states :type n_empty_states: int
-
set_fft_mesh
(nx=None, ny=None, nz=None)[source]¶ Set the number of points in the respective directions for the 3D FFT mesh used for computing the charge density or electrostatic potentials. In VASP, using PAW potentials, this refers to the “finer fft mesh”. If no values are set, the default settings from Vasp are used to set the number of grid points.
- Parameters
nx (int) – Number of points on the x-grid
ny (int) – Number of points on the y-grid
nz (int) – Number of points on the z-grid
-
set_for_band_structure_calc
(num_points, structure=None, read_charge_density=True)[source]¶ Sets up the input for a non self-consistent bandstructure calculation
- Parameters
num_points (int) – Number of k-points along the total BZ path
structure (atomistics.structure.atoms.Atoms instance) – Structure for which the bandstructure is to be generated. (default is the input structure)
read_charge_density (boolean) – If True, a charge density from a previous SCF run is used (recommended)
-
set_input_to_read_only
()[source]¶ This function enforces read-only mode for the input classes, but it has to be implement in the individual classes.
-
set_mixing_parameters
(method=None, n_pulay_steps=None, density_mixing_parameter=None, spin_mixing_parameter=None)[source]¶ - Parameters
method (str) –
n_pulay_steps (int) –
density_mixing_parameter (float) –
spin_mixing_parameter (float) –
-
set_occupancy_smearing
(smearing='fermi', width=0.2, ismear=None)[source]¶ Set how the finite temperature smearing is applied in determining partial occupancies
- Parameters
smearing (str) – Type of smearing (fermi/gaussian etc.)
width (float) – Smearing width (eV)
ismear (int) – Directly sets the ISMEAR tag. Overwrites the smearing tag
-
set_rwigs
(rwigs_dict)[source]¶ Sets the radii of Wigner-Seitz cell. (RWIGS tag)
- Parameters
rwigs_dict (dict) – Dictionary of species and corresponding radii. (structure has to be defined before)
-
set_spin_constraint
(lamb, rwigs_dict, direction=False, norm=False)[source]¶ Sets spin constrains including ‘LAMBDA’ and ‘RWIGS’.
- Parameters
lamb (float) – LAMBDA tag
rwigs_dict (dict) – Dictionary of species and corresponding radii. (structure has to be defined before)
direction (bool) – (True/False) constrain spin direction.
norm (bool) – (True/False) constrain spin norm (magnitude).
-
property
sorted_indices
¶ How the original atom indices are ordered in the vasp format (species by species)
-
property
spin_constraints
¶ Returns True if the calculation is spin polarized
-
stop_calculation
(next_electronic_step=False)[source]¶ Call to stop the VASP calculation
- Parameters
next_electronic_step (bool) – True if the next electronic step should be calculated
-
property
structure
¶ Returns:
-
to_hdf
(hdf=None, group_name=None)[source]¶ Stores the instance attributes into the hdf5 file
- Parameters
hdf (pyiron.base.generic.hdfio.ProjectHDFio) – The HDF file/path to write the data to
group_name (str) – The name of the group under which the data must be stored as
-
property
write_charge_density
¶ True if the charge density file CHGCAR file is/should be written
-
property
write_electrostatic_potential
¶ True if the local potential or electrostatic potential LOCPOT file is/should be written
-
write_input
()[source]¶ Call routines that generate the INCAR, POTCAR, KPOINTS and POSCAR input files
-
property
write_resolved_dos
¶ True if the resolved DOS should be written (in the vasprun.xml file)
-
property
write_wave_funct
¶ True if the wave function file WAVECAR file is/should be written