defectpl.io.vasp¶
All VASP-specific I/O lives in defectpl.io.vasp.
Eigenvalue parsing¶
read_eigenval_file
¶
Parse a VASP EIGENVAL file and return spin-resolved eigenvalues at one k-point.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
filename
|
str or Path
|
|
required |
k_idx
|
int
|
Zero-based k-point index (default 0, i.e. Γ-point). |
0
|
Returns:
| Type | Description |
|---|---|
dict — see :func:`defectpl.vasp.read_eigenval_file` for full key list.
|
|
Raises:
| Type | Description |
|---|---|
ValueError
|
If the calculation is not spin-polarised (ISPIN ≠ 2). |
Source code in defectpl/io/vasp.py
get_spin_multiplicity
¶
Calculate the spin multiplicity (2S+1) from HOMO level indices.
OUTCAR parsing¶
OutcarParser
¶
Lightweight VASP OUTCAR parser (no pymatgen import at construction time).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
filename
|
str or Path
|
Path to the VASP OUTCAR file. |
required |
Source code in defectpl/io/vasp.py
get_structures_and_forces
¶
Extract all ionic-step structures and forces from a VASP OUTCAR.
Lattice matrices are updated per ionic step from the OUTCAR itself. Species are read natively from POTCAR entries unless poscar_path is given.
Returns:
| Type | Description |
|---|---|
(structures, forces)
|
structures : list of pymatgen.core.Structure forces : list of numpy.ndarray, shape (NIONS, 3), in eV/Å |
Source code in defectpl/io/vasp.py
217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 | |
get_final_structure_and_forces_from_outcar
¶
Return only the last structure and forces from an OUTCAR.
Source code in defectpl/io/vasp.py
get_first_structure_and_forces_from_outcar
¶
Return only the first structure and forces from an OUTCAR.
Source code in defectpl/io/vasp.py
check_outcar_convergence
¶
Check electronic and structural convergence from a VASP OUTCAR file.
Returns:
| Type | Description |
|---|---|
dict with keys ``structural_converged``, ``electronic_converged``,
|
|
``finished_cleanly``.
|
|
Source code in defectpl/io/vasp.py
get_nions
¶
Extract the NIONS count from a VASP OUTCAR file.
Source code in defectpl/io/vasp.py
get_species_and_index_map
¶
Build a flat per-atom element list from OUTCAR POTCAR entries.
Handles multi-occurrence POTCAR definitions (e.g. N, C, N, C) by aligning to the 'ions per type' array.
Source code in defectpl/io/vasp.py
Displacement helpers¶
calc_dR
¶
Compute PBC-safe Cartesian displacement vectors ΔR = R(excited) − R(ground).
Returns:
| Type | Description |
|---|---|
np.ndarray, shape (natoms, 3) — displacements in Å.
|
|
Source code in defectpl/io/vasp.py
calc_delta_Q
¶
Mass-weighted configuration coordinate displacement ΔQ between two structures.
Returns:
| Type | Description |
|---|---|
float — ΔQ in amu^(1/2) · Å.
|
|
Source code in defectpl/io/vasp.py
get_q_from_structure
¶
Project a displaced structure onto the ground→excited configuration coordinate.
Returns:
| Type | Description |
|---|---|
float — Q in amu^(1/2) · Å.
|
|
Source code in defectpl/io/vasp.py
Force-difference helpers¶
calc_dF
¶
Compute the force difference dF = F_excited − F_ground at the same geometry.
Both dicts must have keys "structure" (pymatgen Structure) and
"forces" (numpy array, shape (NIONS, 3)).
Source code in defectpl/io/vasp.py
prepare_dF_files
¶
Extract dF = F_excited − F_ground from two VASP OUTCAR files.
Uses the final structure/forces from each OUTCAR.
Source code in defectpl/io/vasp.py
VASP Protocol reader¶
VaspReader
¶
VASP-specific implementation of the :class:~defectpl.io.base.PhononReader
and :class:~defectpl.io.base.ElectronicReader protocols.
All DFT-code-specific logic lives here; the physics layer only sees
the generic :class:~defectpl.core.structures.PhononData /
:class:~defectpl.core.structures.EigenvalData containers.