ramannoodle.structure¶
Classes and functions for atomic structures and structural symmetries.
- class ramannoodle.structure.ReferenceStructure(atomic_numbers, lattice, positions, symprec=1e-05, angle_tolerance=-1.0)¶
Bases:
objectReference crystal structure, typically used by polarizability models.
- Parameters:
atomic_numbers (
list[int]) – List of length N where N is the number of atoms.lattice (
ndarray[Any,dtype[float64]]) – (Å) Array with shape (3,3).positions (
ndarray[Any,dtype[float64]]) – (fractional) Array with shape (N,3).symprec (
float) – (Å) Distance tolerance for symmetry search (spglib).angle_tolerance (
float) – (°) Angle tolerance for symmetry search (spglib).
- Raises:
SymmetryException – Structural symmetry determination failed.
- get_atom_indexes(atom_symbols)¶
Return atom indexes with matching symbols.
- get_cart_direction(direction)¶
Convert a (fractional) direction into cartesian coordinates.
- get_cart_displacement(displacement)¶
Convert a (fractional) displacement into Cartesian coordinates.
- get_equivalent_atom_dict()¶
Get dictionary of equivalent atoms indexes.
- get_equivalent_displacements(displacement)¶
Calculate symmetrically equivalent displacements.
- Parameters:
displacement (
ndarray[Any,dtype[float64]]) – (fractional) Array with shape (N,3) where N is the number of atoms.- Return type:
- Returns:
List of dictionaries containing displacements and transformations, accessed using the ‘displacements’ and ‘transformations’ keys. Displacements within each dictionary will be collinear, corresponding to the same degree of freedom. The provided transformations are those that transform
displacementinto that degree of freedom. Displacements are in fractional coordinates.
- get_frac_direction(cart_direction)¶
Convert a Cartesian direction into fractional coordinates.
- get_frac_displacement(cart_displacement)¶
Convert a Cartesian displacement into fractional coordinates.
- ramannoodle.structure.get_ast_displaced_positions(ref_structure, atom_index, cart_direction, amplitudes)¶
Return displaced positions with a single atom displaced along a direction.
- Parameters:
ref_structure (
ReferenceStructure) – Reference structure containing N atoms.atom_index (
int)cart_direction (
ndarray[Any,dtype[float64]]) – (Å) Array with shape (3,). The magnitude of the direction vector is ignored, only the direction is used.amplitudes (
ndarray[Any,dtype[float64]]) – (Å) Array with shape (M,).
- Return type:
- Returns:
(fractional) List of length M containing arrays with shape (N,3).
- ramannoodle.structure.get_displaced_positions(ref_structure, cart_displacement, amplitudes)¶
Return positions displaced along a certain displacement.
- Parameters:
ref_structure (
ReferenceStructure) – Reference structure containing N atoms.cart_displacement (
ndarray[Any,dtype[float64]]) – (Å) Array with shape (N,3). The magnitude of the displacement is ignored, only the direction is used.amplitudes (
ndarray[Any,dtype[float64]]) – (Å) Array with shape (M,).
- Return type:
- Returns:
(fractional) List of length M containing arrays with shape (N,3).
- ramannoodle.structure.write_ast_displaced_structures(ref_structure, atom_index, cart_direction, amplitudes, filepaths, file_format, overwrite=False)¶
Write displaced structures with a single atom displaced along a direction.
- Parameters:
ref_structure (
ReferenceStructure) – Reference structure containing N atoms.atom_index (
int)cart_direction (
ndarray[Any,dtype[float64]]) – (Å) Array with shape (3,). The magnitude of the direction vector is ignored, only the direction is used.amplitudes (
ndarray[Any,dtype[float64]]) – (Å) Array with shape (M,).file_format (
str) – Supports"poscar"(see Supported file formats).overwrite (
bool) – Overwrite the file if it exists.
- Return type:
- ramannoodle.structure.write_displaced_structures(ref_structure, cart_displacement, amplitudes, filepaths, file_format, overwrite=False)¶
Write displaced structures to files.
- Parameters:
ref_structure (
ReferenceStructure) – Reference structure containing N atomscart_displacement (
ndarray[Any,dtype[float64]]) – (Å) Array with shape (N,3). The magnitude of the displacement is ignored, only the direction is used.amplitudes (
ndarray[Any,dtype[float64]]) – (Å) Array with shape (M,).file_format (
str) – Supports"poscar"(see Supported file formats).overwrite (
bool) – IfTrue, overwrite the file if it exists.
- Return type:
Submodules¶
ramannoodle.structure.utils module¶
Utility functions for structures.
- ramannoodle.structure.utils.apply_pbc(positions)¶
Return fractional positions such that all coordinates are between 0 and 1.
- ramannoodle.structure.utils.apply_pbc_displacement(displacement)¶
Return fractional displacement such as all coordinates are between -0.5 and 0.5.
- ramannoodle.structure.utils.calc_displacement(positions_1, positions_2)¶
Calculate minimum displacement between two fractional positions.
Displacement is from
positions_1topositions_2. Respects periodic boundary conditions.
- ramannoodle.structure.utils.displace_positions(positions, displacement)¶
Displace positions, respecting periodic boundary conditions.
- ramannoodle.structure.utils.transform_positions(positions, rotation, translation)¶
Transform positions.
Respects periodic boundary conditions.
- Parameters:
- Return type:
- Returns:
(fractional) Array with shape (N,3).