pyiron.vasp package

Submodules

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

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

load_default()[source]

Loads the default file content

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

write(structure, modified_elements, directory=None)[source]

Writes all the input files to a specified directory

Parameters
  • structure (atomistics.structure.atoms.Atoms instance) – Structure to be written

  • directory (str) – The working directory for the VASP run

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

load_default()[source]

Loads the default file content

set(method=None, size_of_mesh=None, shift=None)[source]

Sets appropriate tags and values in the KPOINTS file :param method: Type of meshing scheme (Gamma Point, 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

set_kmesh_by_density(structure)[source]
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/travis/build/pyiron/pyiron/docs')[source]

Collects output from the working directory

Parameters

directory (str) – Path to the directory

from_hdf(hdf)[source]

Reads the attributes and reconstructs the object from a hdf file :param hdf: The hdf5 instance

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.Potcar(input_file_name=None, table_name='potcar')[source]

Bases: pyiron.base.generic.parameters.GenericParameters

load_default()[source]

Load defaults resets the dataset in the background to be empty

modify(**modify)[source]

Modify values for existing parameters. The command is called as modify(param1=val1, param2=val2, …)

Parameters
  • separator (str) – needed if the parameter name contains special characters such as par: use then as input: modify(separator=”:”, par=val) - optional

  • append_if_not_present (bool) – do not raise an exception but append the parameter in practice use set(par=val) - default=False

  • **modify_dict (dict) – dictionary of parameter names and values

pot_path_dict = {'GGA': 'paw-gga-pbe', 'LDA': 'paw-lda', 'PBE': 'paw-gga-pbe'}
potcar_set_structure(structure, modified_elements)[source]
write_file(file_name, cwd=None)[source]
Parameters
  • file_name

  • cwd

Returns:

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(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.
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)

collect_errors()[source]

Collects errors from the VASP run

collect_logfiles()[source]

Collect errors and warnings.

collect_output()[source]

Collects the outputs and stores them to the hdf file

collect_warnings()[source]

Collects warnings from the VASP run

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_chgcar(old_vasp_job)[source]

Copy CHGCAR from previous VASP calcualtion to the new VASP job. (Sets ICHARG = 1)

Parameters

old_vasp_job (pyiron.vasp.vasp.Vasp) – Finished Vasp job instance

copy_file(old_vasp_job, filename='CHGCAR')[source]

Copy a file from a previous vasp job

Parameters
  • old_vasp_job (pyiron.vasp.vasp.Vasp) – Finished Vasp job instance

  • filename (str) – Destination to copy the file

copy_wavecar(old_vasp_job)[source]

Copy WAVECAR from previous VASP calculation to the new VASP job. (Sets ICHARG = 1)

Parameters

(pyiron.vasp.vasp.Vasp) – Finished Vasp job instance

exchange_correlation_functional

The exchange correlation functional used (LDA or GGA)

fix_spin_constraint

Tells if the type of constraints the spins have for this calculation

Type

bool

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
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

pyiron.atomistics.structure.atoms.Atoms

get_nelect()[source]

Returns the number of electrons in the systems

Returns

Number of electrons in the system

Return type

float

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

plane_wave_cutoff

Plane wave energy cutoff in eV

potential
potential_available
potential_list
potential_view
publication
reset_output()[source]

Resets the output instance

restart(snapshot=-1, job_name=None, job_type=None)[source]

Restart a new job created from an existing Vasp calculation.

Parameters
  • snapshot (int) – Snapshot of the calculations which would be the initial structure of the new job

  • 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_from_charge_density(snapshot=-1, job_name=None, job_type=None, icharg=None, self_consistent_calc=False)[source]

Restart a new job created from an existing Vasp calculation by reading the charge density.

Parameters
  • snapshot (int) – Snapshot of the calculations which would be the initial structure of the new job

  • job_name (str) – Job name

  • job_type (str) – Job type. If not specified a Vasp job type is assumed

  • icharg (int) – Vasp ICHARG tag

  • self_consistent_calc (boolean) – Tells if the new calculation is self consistent

Returns

New job

Return type

new_ham (vasp.vasp.Vasp instance)

restart_from_wave_functions(snapshot=-1, 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
  • snapshot (int) – Snapshot of the calculations which would be the initial structure of the new job

  • job_name (str) – Job name

  • job_type (str) – 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_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_kpoints(mesh=None, scheme='MP', center_shift=None, symmetry_reduction=True, manual_kpoints=None, weights=None, reciprocal=True, kmesh_density=None)[source]

Function to setup the k-points for the VASP job

Parameters
  • mesh (list) – Size of the mesh (in the MP scheme)

  • scheme (str) – Type of k-point generation scheme (MP/GP(gamma point)/Manual/Line)

  • center_shift (list) – Shifts the center of the mesh from the gamma point by the given vector

  • symmetry_reduction (boolean) – Tells if the symmetry reduction is to be applied to the k-points

  • manual_kpoints (list/numpy.ndarray) – Manual list of k-points

  • weights (list/numpy.ndarray) – Manually supplied weights to each k-point in case of the manual mode

  • reciprocal (bool) – Tells if the supplied values are in reciprocal (direct) or cartesian coordinates (in

  • space) (reciprocal) –

  • kmesh_density (float) – Value of the required density

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_spin_constraint(direction=False, norm=False)[source]

Setting thr spin constraints

Parameters
  • direction

  • norm

Returns:

sorted_indices

How the original atom indices are ordered in the vasp format (species by species)

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

structure

Returns:

to_hdf(hdf=None, group_name=None)[source]

Stores the instance attributes into the hdf5 file

Parameters
validate_ready_to_run()[source]

Returns:

write_charge_density

True if the charge density file CHGCAR file is/should be written

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

write_magmoms()[source]

Write the magnetic moments in INCAR from that assigned to the species

write_resolved_dos

True if the resolved DOS should be written (in the vasprun.xml file)

write_wave_funct

True if the wave function file WAVECAR file is/should be written

exception pyiron.vasp.base.VaspCollectError[source]

Bases: ValueError

pyiron.vasp.base.get_k_mesh_by_cell(cell, kspace_per_in_ang=0.1)[source]
Parameters
  • cell

  • kspace_per_in_ang

Returns:

pyiron.vasp.interactive module

class pyiron.vasp.interactive.DFTOutput[source]

Bases: pyiron.vasp.base.DFTOutput

This class stores the DFT specific output

log_dict

A dictionary of all tags and values of DFT data

Type

dict

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.interactive.GenericOutput[source]

Bases: pyiron.vasp.base.GenericOutput

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

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.interactive.Output[source]

Bases: pyiron.vasp.base.Output

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

class pyiron.vasp.interactive.VaspInteractive(project, job_name)[source]

Bases: pyiron.vasp.base.VaspBase, pyiron.atomistics.job.interactive.GenericInteractive

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

get_structure(iteration_step=-1)[source]

Gets the structure from a given iteration step of the simulation (MD/ionic relaxation). For static calculations there is only one ionic iteration step :param iteration_step: Step for which the structure is requested :type iteration_step: int

Returns

atomistics.structure.atoms.Atoms object

interactive_close()[source]

Returns:

interactive_energy_pot_getter()[source]
interactive_energy_tot_getter()[source]
interactive_enforce_structure_reset
interactive_fetch()[source]
interactive_forces_getter()[source]
interactive_initialize_interface()[source]
interactive_positions_setter(positions)[source]
run_if_interactive()[source]

For jobs which executables are available as Python library, those can also be executed with a library call instead of calling an external executable. This is usually faster than a single core python job.

run_if_interactive_non_modal()[source]

For jobs which executables are available as Python library, those can also be executed with a library call instead of calling an external executable. This is usually faster than a single core python job.

structure

Returns:

validate_ready_to_run()[source]

Returns:

pyiron.vasp.outcar module

class pyiron.vasp.outcar.Outcar[source]

Bases: object

This module is used to parse VASP OUTCAR files.

parse_dict

A dictionary with all the useful quantities parsed from an OUTCAR file after from_file() is executed

Type

dict

from_file(filename='OUTCAR')[source]

Parse and store relevant quantities from the OUTCAR file into parse_dict.

Parameters

filename (str) – Filename of the OUTCAR file to parse

from_hdf(hdf, group_name='outcar')[source]

Load output from an HDF5 file

Parameters
static get_all_total_energies(filename='OUTCAR', lines=None)[source]

Gets the energy at every electronic step

Parameters
  • filename (str) – Filename of the OUTCAR file to parse

  • lines (list/None) – lines read from the file

Returns

A list of energie for every electronic step at every ionic step

Return type

list

static get_broyden_mixing_mesh(filename='OUTCAR', lines=None)[source]

Gets the Broyden mixing mesh size

Parameters
  • filename (str) – Filename of the OUTCAR file to parse

  • lines (list/None) – lines read from the file

Returns

Mesh size

Return type

int

get_cells(filename='OUTCAR', lines=None)[source]

Gets the cell size and shape for every ionic step from the OUTCAR file

Parameters
  • filename (str) – Filename of the OUTCAR file to parse

  • lines (list/None) – lines read from the file

Returns

A 3x3xM array of the cell shape in $AA$

where M is the number of time steps

Return type

numpy.ndarray

static get_dipole_moments(filename='OUTCAR', lines=None)[source]

Get the electric dipole moment at every electronic step

Parameters
  • filename (str) – Filename of the OUTCAR file to parse

  • lines (list/None) – lines read from the file

Returns

A list of dipole moments in (eA) for each electronic step

Return type

list

static get_energy_sigma_0(filename='OUTCAR', lines=None)[source]

Gets the total energy for every ionic step from the OUTCAR file

Parameters
  • filename (str) – Filename of the OUTCAR file to parse

  • lines (list/None) – lines read from the file

Returns

A 1xM array of the total energies in $eV$

where M is the number of time steps

Return type

numpy.ndarray

static get_energy_without_entropy(filename='OUTCAR', lines=None)[source]

Gets the total energy for every ionic step from the OUTCAR file

Parameters
  • filename (str) – Filename of the OUTCAR file to parse

  • lines (list/None) – lines read from the file

Returns

A 1xM array of the total energies in $eV$

where M is the number of time steps

Return type

numpy.ndarray

static get_fermi_level(filename='OUTCAR', lines=None)[source]

Getting the Fermi-level (Kohn_Sham) from the OUTCAR file

Parameters
  • filename (str) – Filename of the OUTCAR file to parse

  • lines (list/None) – lines read from the file

Returns

The Kohn-Sham Fermi level in eV

Return type

float

get_forces(filename='OUTCAR', lines=None, n_atoms=None)[source]

Gets the forces for every ionic step from the OUTCAR file

Parameters
  • filename (str) – Filename of the OUTCAR file to parse

  • lines (list/None) – lines read from the file

  • n_atoms (int/None) – number of ions in OUTCAR

Returns

A Nx3xM array of forces in $eV / AA$

where N is the number of atoms and M is the number of time steps

Return type

numpy.ndarray

static get_irreducible_kpoints(filename='OUTCAR', reciprocal=True, weight=True, planewaves=True, lines=None)[source]

Function to extract the irreducible kpoints from the OUTCAR file

Parameters
  • filename (str) – Filename of the OUTCAR file to parse

  • reciprocal (bool) – Get either the reciprocal or the cartesian coordinates

  • weight (bool) – Get the weight assigned to the irreducible kpoints

  • planewaves (bool) – Get the planewaves assigned to the irreducible kpoints

  • lines (list/None) – lines read from the file

Returns

An array of k-points

Return type

numpy.ndarray

static get_kinetic_energy_error(filename='OUTCAR', lines=None)[source]

Get the kinetic energy error

Parameters
  • filename (str) – Filename of the OUTCAR file to parse

  • lines (list/None) – lines read from the file

Returns

The kinetic energy error in eV

Return type

float

static get_magnetization(filename='OUTCAR', lines=None)[source]

Gets the magnetization

Parameters
  • filename (str) – Filename of the OUTCAR file to parse

  • lines (list/None) – lines read from the file

Returns

A list with the mgnetization values

Return type

list

static get_nelect(filename='OUTCAR', lines=None)[source]

Returns the number of electrons in the simulation

Parameters
  • filename (str) – OUTCAR filename

  • lines (list/None) – lines read from the file

Returns

The number of electrons in the simulation

Return type

float

static get_number_of_atoms(filename='OUTCAR', lines=None)[source]

Returns the number of ions in the simulation

Parameters
  • filename (str) – OUTCAR filename

  • lines (list/None) – lines read from the file

Returns

The number of ions in the simulation

Return type

int

get_positions(filename='OUTCAR', lines=None, n_atoms=None)[source]

Gets the positions for every ionic step from the OUTCAR file

Parameters
  • filename (str) – Filename of the OUTCAR file to parse

  • lines (list/None) – lines read from the file

  • n_atoms (int/None) – number of ions in OUTCAR

Returns

A Nx3xM array of positions in $AA$

where N is the number of atoms and M is the number of time steps

Return type

numpy.ndarray

get_positions_and_forces(filename='OUTCAR', lines=None, n_atoms=None)[source]

Gets the forces and positions for every ionic step from the OUTCAR file

Parameters
  • filename (str) – Filename of the OUTCAR file to parse

  • lines (list/None) – lines read from the file

  • n_atoms (int/None) – number of ions in OUTCAR

Returns

[positions, forces] (sequence) numpy.ndarray: A Nx3xM array of positions in $AA$ numpy.ndarray: A Nx3xM array of forces in $eV / AA$

where N is the number of atoms and M is the number of time steps

static get_steps(filename='OUTCAR', lines=None)[source]
Parameters
  • filename (str) – Filename of the OUTCAR file to parse

  • lines (list/None) – lines read from the file

Returns

Steps during the simulation

Return type

numpy.ndarray

static get_stresses(filename='OUTCAR', lines=None, si_unit=True)[source]
Parameters
  • filename (str) – Input filename

  • lines (list/None) – lines read from the file

  • si_unit (bool) – True SI units are used

Returns

An array of stress values

Return type

numpy.ndarray

static get_temperatures(filename='OUTCAR', lines=None)[source]

Gets the temperature at each ionic step (applicable for MD)

Parameters
  • filename (str) – Filename of the OUTCAR file to parse

  • lines (list/None) – lines read from the file

Returns

An array of temperatures in Kelvin

Return type

numpy.ndarray

get_time(filename='OUTCAR', lines=None)[source]

Time after each simulation step (for MD)

Parameters
  • filename (str) – Filename of the OUTCAR file to parse

  • lines (list/None) – lines read from the file

Returns

An array of time values in fs

Return type

numpy.ndarray

static get_total_energies(filename='OUTCAR', lines=None)[source]

Gets the total energy for every ionic step from the OUTCAR file

Parameters
  • filename (str) – Filename of the OUTCAR file to parse

  • lines (list/None) – lines read from the file

Returns

A 1xM array of the total energies in $eV$

where M is the number of time steps

Return type

numpy.ndarray

to_hdf(hdf, group_name='outcar')[source]

Store output in an HDF5 file

Parameters
to_hdf_minimal(hdf, group_name='outcar')[source]

Store minimal output in an HDF5 file (output unique to OUTCAR)

Parameters

pyiron.vasp.potential module

class pyiron.vasp.potential.VaspPotential(selected_atoms=None)[source]

Bases: object

The Potential class is derived from the PotentialAbstract class, but instead of loading the potentials from a list, the potentials are loaded from a file.

Parameters

path (str) – path to the potential list

class pyiron.vasp.potential.VaspPotentialAbstract(potential_df=None, default_df=None, selected_atoms=None)[source]

Bases: pyiron.atomistics.job.potentials.PotentialAbstract

Parameters
  • potential_df

  • default_df

  • selected_atoms

default()[source]
find(element)[source]

Find the potentials

Parameters

element (set, str) – element or set of elements for which you want the possible LAMMPS potentials

Returns

of possible potentials for the element or the combination of elements

Return type

list

find_default(element)[source]
list()[source]

List the available potentials

Returns

of possible potentials for the element or the combination of elements

Return type

list

list_potential_names()[source]
class pyiron.vasp.potential.VaspPotentialFile(xc=None, selected_atoms=None)[source]

Bases: pyiron.vasp.potential.VaspPotentialAbstract

The Potential class is derived from the PotentialAbstract class, but instead of loading the potentials from a list, the potentials are loaded from a file.

Parameters

xc (str) – Exchange correlation functional [‘PBE’, ‘LDA’]

add_new_element(parent_element, new_element)[source]

Adding a new user defined element with a different POTCAR file. It is assumed that the file exists

Parameters
  • parent_element (str) – Parent element

  • new_element (str) – Name of the new element (the name of the folder where the new POTCAR file exists

class pyiron.vasp.potential.VaspPotentialSetter(element_lst)[source]

Bases: object

to_dict()[source]

pyiron.vasp.procar module

class pyiron.vasp.procar.Procar[source]

Bases: object

This module contains routines to parse VASP PROCAR files.

from_file(filename)[source]

pyiron.vasp.structure module

pyiron.vasp.structure.atoms_from_string(string, read_velocities=False, species_list=None)[source]

Routine to convert a string list read from a input/output structure file and convert into Atoms instance

Parameters
  • string (list) – A list of strings (lines) read from the POSCAR/CONTCAR/CHGCAR/LOCPOT file

  • read_velocities (bool) – True if the velocities from a CONTCAR file should be read (predictor corrector)

  • species_list (list/numpy.ndarray) – A list of species of the atoms

Returns

The required structure object

Return type

pyiron.atomistics.structure.atoms.Atoms

pyiron.vasp.structure.get_species_list_from_potcar(filename='POTCAR')[source]

Generates the species list from a POTCAR type file

Parameters

filename (str) – Input filename

Returns

A list of species symbols

Return type

list

pyiron.vasp.structure.read_atoms(filename='CONTCAR', return_velocities=False, species_list=None, species_from_potcar=False)[source]

Routine to read structural static from a POSCAR type file

Parameters
  • filename (str) – Input filename

  • return_velocities (bool) – True if the predictor corrector velocities are read (only from MD output)

  • species_list (list/numpy.ndarray) – A list of the species (if not present in the POSCAR file or a POTCAR in the

  • directory) (same) –

  • species_from_potcar (bool) – True if the species list should be read from the POTCAR file in the same directory

Returns

The generated structure object

Return type

pyiron.atomistics.structure.atoms.Atoms

pyiron.vasp.structure.vasp_sorter(structure)[source]

Routine to sort the indices of a structure as it would be when written to a POSCAR file

Parameters

structure (pyiron.atomistics.structure.atoms.Atoms) – The structure whose indices need to be sorted

Returns

A list of indices which is sorted by the corresponding species for writing to POSCAR

Return type

list

pyiron.vasp.structure.write_poscar(structure, filename='POSCAR', write_species=True, cartesian=True)[source]

Writes a POSCAR type file from a structure object

Parameters
  • structure (pyiron.atomistics.structure.atoms.Atoms) – The structure instance to be written to the POSCAR format

  • filename (str) – Output filename

  • write_species (bool) – True if the species should be written to the file

  • cartesian (bool) – True if the positions are written in Cartesian coordinates

pyiron.vasp.vasp module

class pyiron.vasp.vasp.Vasp(project, job_name)[source]

Bases: pyiron.vasp.interactive.VaspInteractive

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

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 = Vasp(job_name="trial_job")
>>> ham.input.incar.set(IBRION=-1)
>>> ham.input.incar.set(ISMEAR=0)
>>> ham.input.kpoints.set(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 = Vasp(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.
class pyiron.vasp.vasp.VaspInt(project, job_name)[source]

Bases: pyiron.vasp.vasp.Vasp

class pyiron.vasp.vasp.VaspInt2(project, job_name)[source]

Bases: pyiron.vasp.vasp.Vasp

pyiron.vasp.vasprun module

class pyiron.vasp.vasprun.Vasprun[source]

Bases: object

This module is used to parse vasprun.xml files and store the data consistent with the pyiron input/output storage formats.

vasprun_dict
Dictionary containing all information from the calculation parsed from the vasprun.xml

file. If you consider a simulation with N atoms and M ionic steps

‘positions’ (numpy.ndarray): MxNx3 array containing all the relative positions ‘cell’ (numpy.ndarray): Mx3x3 array containing all the size and shape of cells at every iteration point ‘forces’ (numpy.ndarray): MxNx3 array containing all the forces in eV/A ‘total_energies’ (numpy.ndarray): 1xM array containing all the total energies in eV

Type

dict

from_file(filename='vasprun.xml')[source]

Parsing vasprun.xml from the working directory

Parameters

filename (str) – Path to the vasprun file

get_electronic_structure()[source]

Get’s the electronic structure from the VASP calculation

Returns

The electronic structure object

Return type

pyiron.atomistics.waves.electronic.ElectronicStructure

get_final_structure()[source]

Gets the final structure from the simulation

Returns

The final structure

Return type

pyiron.atomistics.structure.atoms.Atoms

get_initial_structure()[source]

Gets the initial structure from the simulation

Returns

The initial structure

Return type

pyiron.atomistics.structure.atoms.Atoms

parse_atom_information_to_dict(node, d)[source]

Parses atom information from a node to a dictionary

Parameters
  • node (xml.etree.Element instance) – The node to parse

  • d (dict) – The dictionary to which data is to be parsed

parse_calc_to_dict(node, d)[source]

Parses ionic step data from a node to a dictionary

Parameters
  • node (xml.etree.Element instance) – The node to parse

  • d (dict) – The dictionary to which data is to be parsed

parse_eigenvalues_to_dict(node, d)[source]

Parses eigenvalue and occupancy data from a node to a dictionary

Parameters
  • node (xml.etree.Element instance) – The node to parse

  • d (dict) – The dictionary to which data is to be parsed

parse_fermi_level_to_dict(node, d)[source]

Parses fermi level from a node to a dictionary

Parameters
  • node (xml.etree.Element instance) – The node to parse

  • d (dict) – The dictionary to which data is to be parsed

static parse_item_to_dict(node, d)[source]

Parses values from an item to a dictionary

Parameters
  • node (etree.Element instance) – Node to be parsed

  • d (dict) – The dictionary to which data is to be parsed

Returns

d (dictionary)

parse_kpoints_to_dict(node, d)[source]

Parses k-points data from a node to a dictionary

Parameters
  • node (xml.etree.Element instance) – The node to parse

  • d (dict) – The dictionary to which data is to be parsed

parse_parameters(node, d)[source]

Parses parameter data from a node to a dictionary

Parameters
  • node (xml.etree.Element instance) – The node to parse

  • d (dict) – The dictionary to which data is to be parsed

parse_partial_dos_to_dict(node, d)[source]

Parses partial dos data from a node to a dictionary

Parameters
  • node (xml.etree.Element instance) – The node to parse

  • d (dict) – The dictionary to which data is to be parsed

parse_projected_dos_to_dict(node, d)[source]

Parses partial dos data from a node to a dictionary

Parameters
  • node (xml.etree.Element instance) – The node to parse

  • d (dict) – The dictionary to which data is to be parsed

parse_recursively(node, d, key_name=None)[source]

Parses recursively from a node to a dictionary

Parameters
  • node (xml.etree.Element instance) – The node to parse

  • d (dict) – The dictionary to which data is to be parsed

  • key_name (str) – Forcefully assign a key name in case it is not present in the xml file

parse_root_to_dict()[source]

Parses from the main xml root.

parse_scf(node)[source]

Parses the total energy and dipole moments for a VASP calculation

Parameters

node – (xml.etree.Element instance): The node to parse

Returns

Dictionary to containing parsed data

Return type

d (dict)

parse_structure_to_dict(node, d)[source]

Parses structure from a node to a dictionary

Parameters
  • node (xml.etree.Element instance) – The node to parse

  • d (dict) – The dictionary to which data is to be parsed

parse_total_dos_to_dict(node, d)[source]

Parses total dos data from a node to a dictionary

Parameters
  • node (xml.etree.Element instance) – The node to parse

  • d (dict) – The dictionary to which data is to be parsed

exception pyiron.vasp.vasprun.VasprunError[source]

Bases: ValueError

pyiron.vasp.vasprun.clean_character(a, remove_char=' ')[source]
Parameters
  • a (str) – String to be cleaned

  • remove_char (str) – Character to be replaced

Returns

The clean string

Return type

str

pyiron.vasp.vasprun.clean_key(a, remove_char=' ')[source]

Replaces blanck spaces from a string for a dictionary key with “_”

Parameters
  • a (str) – String to be cleaned

  • remove_char (str) – Character to be replaced

Returns

The clean string

Return type

str

pyiron.vasp.volumetric_data module

class pyiron.vasp.volumetric_data.VaspVolumetricData[source]

Bases: pyiron.atomistics.volumetric.generic.VolumetricData

General class for parsing and manipulating volumetric static within VASP. The basic idea of the Base class is adapted from the pymatgen vasp VolumtricData class

http://pymatgen.org/_modules/pymatgen/io/vasp/outputs.html#VolumetricData

diff_data

Volumtric difference data (3D)

Type

numpy.ndarray

from_file(filename, normalize=True)[source]

Parsing the contents of from a file

Parameters
  • filename (str) – Path of file to parse

  • normalize (boolean) – Flag to normalize by the volume of the cell

from_hdf(hdf5, group_name='volumetric_data')[source]

Recreating the VolumetricData instance by reading data from the HDF5 files

Parameters
Returns

The VolumetricData instance

Return type

pyiron.atomistics.volumetric.generic.VolumetricData

to_hdf(hdf5, group_name='volumetric_data')[source]

Writes the data as a group to a HDF5 file

Parameters
total_data

Total volumtric data (3D)

Type

numpy.ndarray

Module contents