ramannoodle.io

Functions for interacting with files used and produced by DFT codes.

Subpackages

Submodules

ramannoodle.io.generic module

Generic IO functions.

Generic IO functions are somewhat inflexible but are necessary for certain functionality. Users are strongly encouraged to use IO functions contained in the code-specific subpackages. For example, IO for VASP POSCAR and OUTCAR files can be accomplished using ramannoodle.io.vasp.poscar and ramannoodle.io.vasp.outcar respectively.

ramannoodle.io.generic.read_phonons(filepath, file_format)

Read phonons from a file.

Parameters:
Raises:
Return type:

Phonons

ramannoodle.io.generic.read_polarizability_dataset(filepaths, file_format)

Read polarizability dataset from files.

Parameters:
Raises:
Return type:

PolarizabilityDataset

ramannoodle.io.generic.read_positions(filepath, file_format)

Read fractional positions from a file.

Parameters:
Return type:

ndarray[Any, dtype[float64]]

Returns:

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

Raises:
ramannoodle.io.generic.read_positions_and_polarizability(filepath, file_format)

Read fractional positions and polarizability from a file.

Parameters:
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.generic.read_ref_structure(filepath, file_format)

Read reference structure from a file.

Parameters:
Raises:
Return type:

ReferenceStructure

ramannoodle.io.generic.read_structure_and_polarizability(filepath, file_format)

Read lattice, atomic numbers, fractional positions, polarizability from a file.

Parameters:
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.generic.read_trajectory(filepath, file_format)

Read molecular dynamics trajectory from a file.

Parameters:
Raises:
Return type:

Trajectory

ramannoodle.io.generic.write_structure(lattice, atomic_numbers, positions, filepath, file_format, overwrite=False)

Write structure to 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)

  • file_format (str) – Supports "poscar" (see Supported file formats).

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

  • label – POSCAR label (first line).

Raises:

FileExistsError – File exists and overwrite == False.

Return type:

None

ramannoodle.io.generic.write_trajectory(lattice, atomic_numbers, positions_ts, filepath, file_format, overwrite=False)

Write trajectory to 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)

  • file_format (str) – Supports "xdatcar" (see Supported file formats).

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

Raises:

FileExistsError – File exists and overwrite == False.

Return type:

None

ramannoodle.io.pymatgen module

Functions for interacting with pymatgen.

ramannoodle.io.pymatgen.construct_polarizability_dataset(pymatgen_structures, polarizabilities)

Create a PolarizabilityDataset from of pymatgen Structures and polarizabilities.

Parameters:
Return type:

PolarizabilityDataset

ramannoodle.io.pymatgen.construct_ref_structure(pymatgen_structure)

Create a ReferenceStructure from a pymatgen Structure.

Parameters:

pymatgen_structure (Structure)

Return type:

ReferenceStructure

ramannoodle.io.pymatgen.construct_trajectory(pymatgen_trajectory, timestep)

Create a Trajectory from a pymatgen Trajectory.

Parameters:
Return type:

Trajectory

ramannoodle.io.pymatgen.get_positions(pymatgen_structure)

Read fractional positions from a pymatgen Structure.

Parameters:

pymatgen_structure (Structure)

Return type:

ndarray[Any, dtype[float64]]

Returns:

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

ramannoodle.io.pymatgen.get_structure(pymatgen_structure)

Get lattice, positions, and atomic numbers from a pymatgen Structure.

Parameters:

pymatgen_structure (Structure)

Return type:

tuple[ndarray[Any, dtype[float64]], list[int], 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.