vaspparser.vasp.output.get_final_structure_from_file

vaspparser.vasp.output.get_final_structure_from_file#

vaspparser.vasp.output.get_final_structure_from_file(working_directory: str, filename: str = 'CONTCAR', structure: ~ase.atoms.Atoms | None = None, sorted_indices: ~typing.Sequence[int] | ~numpy.ndarray | None = None, read_atoms_funct: ~typing.Callable = <function read_atoms>) Atoms[source]#

Read the final structure from a POSCAR-format file (typically CONTCAR).

The CONTCAR file written by VASP at the end of a relaxation or MD run contains the final ionic positions, cell vectors, and optionally predictor-corrector velocities. If structure is provided, its atom ordering is preserved and only the cell and positions are updated; otherwise the structure is read entirely from the file.

Parameters:
  • working_directory (str) – Path to the directory containing the structure file

  • filename (str) – Name of the structure file to read (default: "CONTCAR")

  • structure (Atoms) – Reference input structure used to set the species list and atom ordering. If None, species are read directly from the file.

  • sorted_indices (list/numpy.ndarray) – Permutation indices mapping the VASP atom order to the order in structure. Computed from structure if None.

  • read_atoms_funct (callable) – Function for parsing POSCAR-format files

Returns:

The final structure with updated positions and cell

Return type:

ase.atoms.Atoms

Raises:

OSError – If the file cannot be read or the positions are inconsistent