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:
file_format (
str) – Supports"outcar","vasprun.xml"(see Supported file formats).
- Raises:
FileNotFoundError – File not found.
InvalidFileException – Invalid file.
- Return type:
- ramannoodle.io.generic.read_polarizability_dataset(filepaths, file_format)¶
Read polarizability dataset from files.
- Parameters:
- Raises:
FileNotFoundError – File not found.
InvalidFileException – Invalid file.
IncompatibleFileException – File is incompatible with the dataset.
- Return type:
- ramannoodle.io.generic.read_positions(filepath, file_format)¶
Read fractional positions from a file.
- Parameters:
file_format (
str) – Supports"outcar","poscar","xdatcar","vasprun.xml"(see Supported file formats).
- Return type:
- Returns:
(fractional) Array with shape (N,3) where N is the number of atoms.
- Raises:
FileNotFoundError – File not found.
InvalidFileException – Invalid file.
- ramannoodle.io.generic.read_positions_and_polarizability(filepath, file_format)¶
Read fractional positions and polarizability from a file.
- Parameters:
file_format (
str) – Supports"outcar","vasprun.xml"(see Supported file formats).
- Return type:
tuple[ndarray[Any,dtype[float64]],ndarray[Any,dtype[float64]]]- Returns:
positions – (fractional) Array with shape (N,3) where N is the number of atoms.
polarizability – Array with shape (3,3).
- Raises:
FileNotFoundError – File not found.
InvalidFileException – Invalid file.
- ramannoodle.io.generic.read_ref_structure(filepath, file_format)¶
Read reference structure from a file.
- Parameters:
file_format (
str) – Supports"outcar","poscar","xdatcar","vasprun.xml"(see Supported file formats).
- Raises:
FileNotFoundError – File not found.
InvalidFileException – Invalid file.
SymmetryException – Structural symmetry determination failed.
- Return type:
- ramannoodle.io.generic.read_structure_and_polarizability(filepath, file_format)¶
Read lattice, atomic numbers, fractional positions, polarizability from a file.
- Parameters:
file_format (
str) – Supports"outcar","vasprun.xml"(see Supported file formats)
- Return type:
tuple[ndarray[Any,dtype[float64]],list[int],ndarray[Any,dtype[float64]],ndarray[Any,dtype[float64]]]- Returns:
lattice – (Å) Array with shape (3,3).
atomic_numbers – List of length N where N is the number of atoms.
positions – (fractional) Array with shape (N,3) where N is the number of atoms.
polarizability – Array with shape (3,3).
- Raises:
FileNotFoundError – File not found.
InvalidFileException – Invalid file.
- ramannoodle.io.generic.read_trajectory(filepath, file_format)¶
Read molecular dynamics trajectory from a file.
- Parameters:
file_format (
str) – Supports"outcar","vasprun.xml", (see Supported file formats). Usevasp.xdatcar.read_trajectory()to read a trajectory from an XDATCAR.
- Raises:
FileNotFoundError – File not found.
InvalidFileException – Invalid file.
- Return type:
- 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).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:
- 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.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:
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.
- ramannoodle.io.pymatgen.construct_ref_structure(pymatgen_structure)¶
Create a ReferenceStructure from a pymatgen Structure.
- Parameters:
pymatgen_structure (
Structure)- Return type:
- ramannoodle.io.pymatgen.construct_trajectory(pymatgen_trajectory, timestep)¶
Create a Trajectory from a pymatgen Trajectory.
- Parameters:
pymatgen_trajectory (
Trajectory)timestep (
float) – (fs)
- Return type:
- ramannoodle.io.pymatgen.get_positions(pymatgen_structure)¶
Read fractional positions from a pymatgen Structure.
- 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:
lattice – (Å) Array with shape (3,3).
atomic numbers – List of length N where N is the number of atoms.
positions – (fractional) Array with shape (N,3) where N is the number of atoms.