vaspparser.vasp.vasprun.Vasprun#
- class vaspparser.vasp.vasprun.Vasprun[source]#
Bases:
objectThis 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
Methods
__init__()from_file([filename])Parsing vasprun.xml from the working directory
get_electronic_structure([es_class])Construct an ElectronicStructure object from the parsed vasprun.xml data.
Gets the final structure from the simulation
Gets the initial structure from the simulation
Gets the input from the vasp potentiostat output and stores it using intuitive names
Gets the number of valence electrons for each atom in the final structure
parse_atom_information_to_dict(node, d)Parses atom information from a node to a dictionary
parse_calc_to_dict(node, d)Parses ionic step data from a node to a dictionary
parse_cce_to_dict(node, d)Parse constrained-charge-equilibration (CCE) output from a vasprun.xml node.
parse_eigenvalues_to_dict(node, d)Parses eigenvalue and occupancy data from a node to a dictionary
parse_fermi_level_to_dict(node, d)Parses fermi level from a node to a dictionary
parse_item_to_dict(node, d)Parses values from an item to a dictionary
parse_kpoints_to_dict(node, d)Parses k-points data from a node to a dictionary
parse_parameters(node, d)Parses parameter data from a node to a dictionary
parse_partial_dos_to_dict(node, d)Parses partial dos data from a node to a dictionary
parse_projected_dos_to_dict(node, d)Parses partial dos data from a node to a dictionary
parse_recursively(node, d[, key_name])Parses recursively from a node to a dictionary
parse_root_to_dict(filename)Parse the vasprun.xml file and populate
vasprun_dictwith all data.parse_scf(node)Parses the total energy and dipole moments for a VASP calculation
parse_structure_to_dict(node, d)Parses structure from a node to a dictionary
parse_total_dos_to_dict(node, d)Parses total dos data from a node to a dictionary
- from_file(filename: str = 'vasprun.xml')[source]#
Parsing vasprun.xml from the working directory
- Parameters:
filename (str) – Path to the vasprun file
- get_electronic_structure(es_class=<class 'vaspparser.dft.waves.electronic.ElectronicStructure'>)[source]#
Construct an ElectronicStructure object from the parsed vasprun.xml data.
Transfers k-point list, k-point weights, eigenvalue matrix, occupancy matrix, Fermi level, total DOS (if available), atom-resolved DOS (if LORBIT >= 10), and projected DOS (if LORBIT = 11) into the returned object.
- Parameters:
es_class – Class to instantiate for the electronic structure; defaults to
ElectronicStructure.- Returns:
Populated electronic structure object
- Return type:
- 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
- get_potentiostat_output()[source]#
Gets the input from the vasp potentiostat output and stores it using intuitive names
- Returns:
Dictionary with potentiostat output
- Return type:
dict/None
- get_valence_electrons_per_atom()[source]#
Gets the number of valence electrons for each atom in the final structure
- Returns:
Array of valence charges
- Return type:
numpy.ndarray
- 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
- static parse_cce_to_dict(node, d: dict)[source]#
Parse constrained-charge-equilibration (CCE) output from a vasprun.xml node.
- Parameters:
node (xml.etree.Element) – The CCE node to parse
d (dict) – Dictionary to which the parsed values are appended
- 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: dict)[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(filename: str)[source]#
Parse the vasprun.xml file and populate
vasprun_dictwith all data.This method iterates over the XML tree using
iterparseand dispatches each recognized top-level element (generator, incar, kpoints, atominfo, structure, calculation, parameters) to the appropriate sub-parser. After parsing, positions are converted to fractional coordinates if they appear to be in Cartesian, and all lists are converted to numpy arrays.- Parameters:
filename (str) – Path to the vasprun.xml file
- 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)