vaspparser.vasp.parser.outcar.Outcar#
- class vaspparser.vasp.parser.outcar.Outcar[source]#
Bases:
objectThis 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
Methods
__init__()from_file([filename])Parse and store relevant quantities from the OUTCAR file into parse_dict.
get_all_total_energies([filename, lines])Gets the energy at every electronic step
get_band_properties([filename, lines])Extract the Fermi level, valence band maximum (VBM) and conduction band minimum (CBM) at every ionic step from the OUTCAR file.
get_broyden_mixing_mesh([filename, lines])Gets the Broyden mixing mesh size
get_cells([filename, lines])Gets the cell size and shape for every ionic step from the OUTCAR file
get_cpu_time([filename, lines])Returns the total CPU time in seconds
get_dipole_moments([filename, lines])Get the electric dipole moment at every electronic step
get_ediel_sol([filename, lines])Gets the dielectric solvation energy (Ediel_sol) for every ionic step from the OUTCAR file.
get_elapsed_time([filename, lines])Returns the elapsed time in seconds
get_elastic_constants([filename, lines])Read the elastic stiffness tensor from the OUTCAR file.
get_energy_components([filename, lines])Gets the individual components of the free energy energy for every electronic step from the OUTCAR file
get_energy_sigma_0([filename, lines])Gets the energy extrapolated to sigma->0 for every ionic step from the OUTCAR file.
get_energy_without_entropy([filename, lines])Gets the energy without entropy (E_wo_entrp) for every ionic step from the OUTCAR file.
get_fermi_level([filename, lines])Getting the Fermi-level (Kohn_Sham) from the OUTCAR file
get_forces([filename, lines, n_atoms])Gets the forces for every ionic step from the OUTCAR file
get_irreducible_kpoints([filename, ...])Function to extract the irreducible kpoints from the OUTCAR file
get_kinetic_energy_error([filename, lines])Get the kinetic energy error
get_magnetization([filename, lines])Gets the magnetization
get_memory_used([filename, lines])Returns the maximum memory used during the simulation in kB
get_nelect([filename, lines])Returns the number of electrons in the simulation
get_number_of_atoms([filename, lines])Returns the number of ions in the simulation
get_positions([filename, lines, n_atoms])Gets the positions for every ionic step from the OUTCAR file
get_positions_and_forces([filename, lines, ...])Gets the forces and positions for every ionic step from the OUTCAR file
get_steps([filename, lines])- param filename:
Filename of the OUTCAR file to parse
get_stresses([filename, lines, si_unit])- param filename:
Input filename
get_system_time([filename, lines])Returns the system time in seconds
get_temperatures([filename, lines])Gets the temperature at each ionic step (applicable for MD)
get_time([filename, lines])Time after each simulation step (for MD)
get_total_energies([filename, lines])Gets the total energy for every ionic step from the OUTCAR file
get_user_time([filename, lines])Returns the User time in seconds
get_vasp_version([filename, lines])Read the VASP version string from the first line of the OUTCAR file.
Return a dictionary containing only the OUTCAR-specific quantities not available from vasprun.xml.
- from_file(filename: str = 'OUTCAR')[source]#
Parse and store relevant quantities from the OUTCAR file into parse_dict.
- Parameters:
filename (str) – Filename of the OUTCAR file to parse
- static get_all_total_energies(filename: str = 'OUTCAR', lines: list[str] | None = None) list[ndarray][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_band_properties(filename: str = 'OUTCAR', lines: list[str] | None = None)[source]#
Extract the Fermi level, valence band maximum (VBM) and conduction band minimum (CBM) at every ionic step from the OUTCAR file.
The values are derived from the
band No. band energies occupationtables printed in the OUTCAR after each self-consistent cycle.- Parameters:
filename (str) – Filename of the OUTCAR file to parse
lines (list/None) – Lines already read from the file
- Returns:
numpy.ndarray: Fermi levels (eV) for each ionic step numpy.ndarray: VBM values (eV), shape (n_spins, n_ionic_steps) numpy.ndarray: CBM values (eV), shape (n_spins, n_ionic_steps)
- Return type:
tuple
- static get_broyden_mixing_mesh(filename: str = 'OUTCAR', lines: list[str] | None = 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: str = 'OUTCAR', lines: list[str] | None = 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_cpu_time(filename: str = 'OUTCAR', lines: list[str] | None = None)[source]#
Returns the total CPU time in seconds
- Parameters:
filename (str) – OUTCAR filename
lines (list/None) – lines read from the file
- Returns:
CPU time in seconds
- Return type:
float
- static get_dipole_moments(filename: str = 'OUTCAR', lines: list[str] | None = 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_ediel_sol(filename: str = 'OUTCAR', lines: list[str] | None = None) ndarray[source]#
Gets the dielectric solvation energy (Ediel_sol) for every ionic step from the OUTCAR file.
This energy is only present when an implicit solvation model is used (e.g. with the VASPsol or VASP built-in solvation via
LSOL = .TRUE.). It represents the electrostatic interaction energy between the solute and the implicit solvent.- Parameters:
filename (str) – Filename of the OUTCAR file to parse
lines (list/None) – lines read from the file
- Returns:
A 1xM array of the solvation energies in eV, where M is the number of ionic steps
- Return type:
numpy.ndarray
- static get_elapsed_time(filename: str = 'OUTCAR', lines: list[str] | None = None)[source]#
Returns the elapsed time in seconds
- Parameters:
filename (str) – OUTCAR filename
lines (list/None) – lines read from the file
- Returns:
elapsed time in seconds
- Return type:
float
- static get_elastic_constants(filename: str = 'OUTCAR', lines: list[str] | None = None)[source]#
Read the elastic stiffness tensor from the OUTCAR file.
The elastic constants are computed by VASP when
IBRION=6is set in the INCAR. VASP prints the full 6x6 Voigt-notation elastic moduli matrix under the headingTOTAL ELASTIC MODULI (kBar); this method converts those values to GPa.- Parameters:
filename (str) – Filename of the OUTCAR file to parse
lines (list/None) – Lines already read from the file
- Returns:
A 6x6 array of elastic constants in GPa in Voigt notation (order: xx, yy, zz, xy, yz, xz), or None if no elastic constants are found.
- Return type:
numpy.ndarray or None
- static get_energy_components(filename: str = 'OUTCAR', lines: list[str] | None = None)[source]#
Gets the individual components of the free energy energy for every electronic step from the OUTCAR file
alpha Z PSCENC = -0.19957337 Ewald energy TEWEN = -73.03212173 -Hartree energ DENC = -0.10933240 -exchange EXHF = 0.00000000 -V(xc)+E(xc) XCENC = -26.17018410 PAW double counting = 168.82497547 -136.88269783 entropy T*S EENTRO = -0.00827174 eigenvalues EBANDS = 10.35379785 atomic energy EATOM = 53.53616173 Solvation Ediel_sol = 0.00000000
- 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_sigma_0(filename: str = 'OUTCAR', lines: list[str] | None = None) ndarray[source]#
Gets the energy extrapolated to sigma->0 for every ionic step from the OUTCAR file.
VASP prints an extrapolated energy
energy(sigma->0)which removes the broadening-dependent entropy contribution. This is useful for comparing energies computed with finite electronic temperature (ISMEAR, SIGMA) as it approximates the T=0 energy. Corresponds toe_0_energyin vasprun.xml.- Parameters:
filename (str) – Filename of the OUTCAR file to parse
lines (list/None) – lines read from the file
- Returns:
A 1xM array of the sigma->0 extrapolated energies in eV, where M is the number of ionic steps
- Return type:
numpy.ndarray
- static get_energy_without_entropy(filename: str = 'OUTCAR', lines: list[str] | None = None) ndarray[source]#
Gets the energy without entropy (E_wo_entrp) for every ionic step from the OUTCAR file.
This corresponds to the
energy without entropyvalue printed by VASP in theFREE ENERGIE OF THE ION-ELECTRON SYSTEMblock and is equivalent to thee_wo_entrptag in vasprun.xml. It equals E_free + T*S, i.e. the total energy before subtracting the electronic entropy contribution.- Parameters:
filename (str) – Filename of the OUTCAR file to parse
lines (list/None) – lines read from the file
- Returns:
A 1xM array of the energies without entropy in eV, where M is the number of ionic steps
- Return type:
numpy.ndarray
- static get_fermi_level(filename: str = 'OUTCAR', lines: list[str] | None = None) float | 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: str = 'OUTCAR', lines: list[str] | None = None, n_atoms: int | None = 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: str = 'OUTCAR', reciprocal: bool = True, weight: bool = True, planewaves: bool = True, lines: list[str] | None = 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: str = 'OUTCAR', lines: list[str] | None = None) float[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: str = 'OUTCAR', lines: list[str] | None = 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_memory_used(filename: str = 'OUTCAR', lines: list[str] | None = None)[source]#
Returns the maximum memory used during the simulation in kB
- Parameters:
filename (str) – OUTCAR filename
lines (list/None) – lines read from the file
- Returns:
Maximum memory used in kB
- Return type:
float
- static get_nelect(filename: str = 'OUTCAR', lines: list[str] | None = None) float | 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: str = 'OUTCAR', lines: list[str] | None = None) int[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: str = 'OUTCAR', lines: list[str] | None = None, n_atoms: int | None = 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: str = 'OUTCAR', lines: list[str] | None = None, n_atoms: int | None = 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: str = 'OUTCAR', lines: list[str] | None = 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: str = 'OUTCAR', lines: list[str] | None = None, si_unit: bool = 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_system_time(filename: str = 'OUTCAR', lines: list[str] | None = None)[source]#
Returns the system time in seconds
- Parameters:
filename (str) – OUTCAR filename
lines (list/None) – lines read from the file
- Returns:
system time in seconds
- Return type:
float
- static get_temperatures(filename: str = 'OUTCAR', lines: list[str] | None = 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: str = 'OUTCAR', lines: list[str] | None = 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: str = 'OUTCAR', lines: list[str] | None = None) ndarray[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_user_time(filename: str = 'OUTCAR', lines: list[str] | None = None)[source]#
Returns the User time in seconds
- Parameters:
filename (str) – OUTCAR filename
lines (list/None) – lines read from the file
- Returns:
User time in seconds
- Return type:
float
- get_vasp_version(filename: str = 'OUTCAR', lines: list[str] | None = None) str[source]#
Read the VASP version string from the first line of the OUTCAR file.
- Parameters:
filename (str) – Filename of the OUTCAR file to parse
lines (list/None) – Lines already read from the file
- Returns:
VASP version string (e.g.
"vasp.6.3.2"or"vasp.5.4.4")- Return type:
str
- to_dict_minimal() dict[source]#
Return a dictionary containing only the OUTCAR-specific quantities not available from vasprun.xml. This is used when both output files are present to avoid duplication.
- Returns:
- Dictionary with keys:
kin_energy_error,broyden_mixing, stresses,irreducible_kpoints,irreducible_kpoint_weights,number_plane_waves,energy_components,resources.
- Dictionary with keys:
- Return type:
dict