ramannoodle.io.vasp

Functions for interacting with VASP files.

Submodules

ramannoodle.io.vasp.outcar module

Functions for interacting with VASP OUTCAR files.

ramannoodle.io.vasp.outcar.read_phonons(filepath)

Read phonons from a VASP OUTCAR file.

Parameters:

filepath (str | Path)

Raises:
Return type:

Phonons

ramannoodle.io.vasp.outcar.read_polarizability_dataset(filepaths)

Read polarizability dataset from OUTCAR files.

Parameters:

filepaths (str | Path | list[str] | list[Path])

Raises:
Return type:

PolarizabilityDataset

ramannoodle.io.vasp.outcar.read_positions(filepath)

Read fractional positions from a VASP OUTCAR file.

Parameters:

filepath (str | Path)

Return type:

ndarray[Any, dtype[float64]]

Returns:

(fractional) Array with shape (N,3) where N is the number of atoms.

Raises:
ramannoodle.io.vasp.outcar.read_positions_and_polarizability(filepath)

Read fractional positions and polarizability from a VASP OUTCAR file.

The polarizability returned by VASP is, in fact, a dielectric tensor. However, this is inconsequential to the calculation of Raman spectra.

Parameters:

filepath (str | Path)

Return type:

tuple[ndarray[Any, dtype[float64]], ndarray[Any, dtype[float64]]]

Returns:

  1. positions – (fractional) Array with shape (N,3) where N is the number of atoms.

  2. polarizability – Array with shape (3,3).

Raises:
ramannoodle.io.vasp.outcar.read_ref_structure(filepath)

Read reference structure from a VASP OUTCAR file.

If the file contains multiple structures (such as those generated by a molecular dynamics run), the initial structure will be considered the reference structure.

Parameters:

filepath (str | Path)

Raises:
Return type:

ReferenceStructure

ramannoodle.io.vasp.outcar.read_structure_and_polarizability(filepath)

Read lattice, fractional positions, atomic numbers, polarizability from OUTCAR.

The polarizability returned by VASP is, in fact, a dielectric tensor. However, this is inconsequential to the calculation of Raman spectra.

Parameters:

filepath (str | Path)

Return type:

tuple[ndarray[Any, dtype[float64]], list[int], ndarray[Any, dtype[float64]], ndarray[Any, dtype[float64]]]

Returns:

  1. lattice – (Å) Array with shape (3,3).

  2. atomic_numbers – List of length N where N is the number of atoms.

  3. positions – (fractional) Array with shape (N,3) where N is the number of atoms.

  4. polarizability – Array with shape (3,3).

Raises:
ramannoodle.io.vasp.outcar.read_trajectory(filepath)

Read molecular dynamics trajectory from a VASP OUTCAR file.

Parameters:

filepath (str | Path)

Raises:
Return type:

Trajectory

ramannoodle.io.vasp.poscar module

Functions for interacting with VASP POSCAR files.

ramannoodle.io.vasp.poscar.read_positions(filepath)

Read fractional positions from a VASP POSCAR file.

Parameters:

filepath (str | Path)

Return type:

ndarray[Any, dtype[float64]]

Returns:

(fractional) Array with shape (N,3) where N is the number of atoms.

Raises:
ramannoodle.io.vasp.poscar.read_ref_structure(filepath)

Read reference structure from a VASP POSCAR file.

Parameters:

filepath (str | Path)

Raises:
Return type:

ReferenceStructure

ramannoodle.io.vasp.poscar.read_structure(filepath)

Read lattice, atomic numbers, and fractional positions from a VASP POSCAR file.

Parameters:

filepath (str | Path)

Raises:
Return type:

tuple[ndarray[Any, dtype[float64]], list[int], ndarray[Any, dtype[float64]]]

ramannoodle.io.vasp.poscar.write_structure(lattice, atomic_numbers, positions, filepath, overwrite=False, label='POSCAR written by ramannoodle')

Write structure to a VASP POSCAR file.

Parameters:
  • lattice (ndarray[Any, dtype[float64]]) – (Å) Array with shape (3,3).

  • atomic_numbers (list[int]) – List of length N where N is the number of atoms.

  • positions (ndarray[Any, dtype[float64]]) – (fractional) Array with shape (N,3).

  • filepath (str | Path)

  • overwrite (bool) – Overwrite the file if it exists.

  • label (str) – POSCAR label (first line).

Return type:

None

ramannoodle.io.vasp.vasprun module

Functions for interacting with vasprun.xml files.

ramannoodle.io.vasp.vasprun.read_phonons(filepath)

Read phonons from a vasprun.xml file.

Parameters:

filepath (str | Path)

Raises:
Return type:

Phonons

ramannoodle.io.vasp.vasprun.read_polarizability_dataset(filepaths)

Read polarizability dataset from OUTCAR files.

Parameters:

filepaths (str | Path | list[str] | list[Path])

Raises:
Return type:

PolarizabilityDataset

ramannoodle.io.vasp.vasprun.read_positions(filepath)

Read fractional positions from a vasprun.xml file.

Parameters:

filepath (str | Path)

Return type:

ndarray[Any, dtype[float64]]

Returns:

(fractional) Array with shape (N,3) where N is the number of atoms.

Raises:
ramannoodle.io.vasp.vasprun.read_positions_and_polarizability(filepath)

Read fractional positions and polarizability from a vasprun.xml file.

The polarizability returned by VASP is, in fact, a dielectric tensor. However, this is inconsequential to the calculation of Raman spectra.

Parameters:

filepath (str | Path)

Return type:

tuple[ndarray[Any, dtype[float64]], ndarray[Any, dtype[float64]]]

Returns:

  1. positions – (fractional) Array with shape (N,3) where N is the number of atoms.

  2. polarizability – Array with shape (3,3).

Raises:
ramannoodle.io.vasp.vasprun.read_ref_structure(filepath)

Read reference structure from a vasprun.xml file.

If the file contains multiple structures (such as those generated by a molecular dynamics run), the initial structure will be considered the reference structure.

Parameters:

filepath (str | Path)

Raises:
Return type:

ReferenceStructure

ramannoodle.io.vasp.vasprun.read_structure_and_polarizability(filepath)

Read lattice, positions, atomic numbers, and polarizability from a vasprun.xml.

The polarizability returned by VASP is, in fact, a dielectric tensor. However, this is inconsequential to the calculation of Raman spectra.

Parameters:

filepath (str | Path)

Return type:

tuple[ndarray[Any, dtype[float64]], list[int], ndarray[Any, dtype[float64]], ndarray[Any, dtype[float64]]]

Returns:

  1. lattice – (Å) Array with shape (3,3).

  2. atomic numbers – List of length N where N is the number of atoms.

  3. positions – (fractional) Array with shape (N,3) where N is the number of atoms.

  4. polarizability – Array with shape (3,3).

Raises:
ramannoodle.io.vasp.vasprun.read_trajectory(filepath)

Read molecular dynamics trajectory from a vasprun.xml file.

Parameters:

filepath (str | Path)

Raises:
Return type:

Trajectory

ramannoodle.io.vasp.xdatcar module

Functions for interacting with VASP XDATCAR files.

ramannoodle.io.vasp.xdatcar.read_positions_ts(filepath)

Read fractional positions time series from a VASP XDATCAR file.

Parameters:

filepath (str | Path)

Return type:

ndarray[Any, dtype[float64]]

Returns:

(fractional) Array with shape (S,N,3) where S is the number of configurations and N is the number of atoms.

Raises:
ramannoodle.io.vasp.xdatcar.read_trajectory(filepath, timestep)

Read trajectory from a VASP XDATCAR file.

Timestep must be manually specified, as XDATCAR’s do not contain the timestep.

Parameters:
Raises:
Return type:

Trajectory

ramannoodle.io.vasp.xdatcar.write_trajectory(lattice, atomic_numbers, positions_ts, filepath, overwrite=False, label='XDATCAR written by ramannoodle')

Write trajectory to a VASP XDATCAR file.

Parameters:
  • lattice (ndarray[Any, dtype[float64]]) – (Å) Array with shape (3,3).

  • atomic_numbers (list[int]) – List of length N where N is the number of atoms.

  • positions_ts (ndarray[Any, dtype[float64]]) – (fractional) Array with shape (S,N,3) where S is the number of configurations.

  • filepath (str | Path)

  • overwrite (bool) – Overwrite the file if it exists.

  • label (str) – XDATCAR label (first line).

Return type:

None