Geometry#
- class quadrupole.geometry.Atom(element: ElementLike, xyz: ArrayLike)#
Bases:
objectClass containing the information of a single atom.
- Parameters:
- elementElementLike
A member of the Element enum, or the atomic symbol/number.
- xyzArrayLike of float with length 3
The x-, y-, and z-coordinates of the atom in Ångstrom.
- Attributes:
- elementElement
A member of the Element enum.
- xyzNDArray of float with size 3
The x-, y-, and z-coordinates of the atom in Ångstrom.
- class quadrupole.geometry.Geometry(atoms: list[Atom], lat_vec: ndarray[tuple[Any, ...], dtype[float64]] | None = None)#
Bases:
objectClass storing the geometric parameters of a molecular geometry or crystal structure.
All quantities should be in Ångstrom.
- Parameters:
- atomslist[Atom]
The atoms in the geometry.
- lat_vecArrayLike of float with shape (3,3), optional
The lattice vectors of the geometry.
- Attributes:
- atomslist[Atom]
The atoms in the geometry.
- lat_vecNDArray of float with shape (3,3), optional
The primitive lattice vectors of the geometry,
Methods
Calculate the principal inertial axes for a given geometry.
from_cjson(file)Read in atoms and potentially crystallographic information from a
.cjsonfile.from_cube(file)Read in and interpret crystallographic information from a CUBE file.
from_list(elements, xyzs[, lat_vec])Create a
Geometryfrom a list of elements and an array of coordinates.from_orca(file)Read in the geometry information from an ORCA output file.
from_qe_pp(file)Read in only the crystallographic information from a Quantum ESPRESSO post-processing file.
from_xsf(file)Read in the crystallographic information from an XSF file.
from_xyz(file)Read in the geometry information from an XYZ file.
generate_lattice(bravais_index, cell_params)Generate a 3x3 unit cell matrix from a Bravais lattice index and a set of cell parameters.
- calc_principal_moments()#
Calculate the principal inertial axes for a given geometry.
- Returns:
- eigenvaluesNDArray
First output of numpy.linalg.eig(inertia_tensor)
- eigenvectorsNDArray
Second output of numpy.linalg.eig(inertia_tensor)
- property coordinates: ndarray[tuple[Any, ...], dtype[_ScalarT]]#
Get an array of the coordinates with shape (
N,3) where N is the number of atoms (len(self)).
- classmethod from_cjson(file: PathLike) Self#
Read in atoms and potentially crystallographic information from a
.cjsonfile.
- classmethod from_cube(file: PathLike) Self#
Read in and interpret crystallographic information from a CUBE file.
Notes
This function calculates the dimensions of the unit cell by taking the number of grid points and muliplying it by the spacing of the grid points. Due to rounding errors when an external program prints a CUBE file, the cell dimensions can have inaccuracies of +/- 5e-05 angstrom.
- classmethod from_list(elements: list[ElementLike], xyzs: ArrayLike, lat_vec: ArrayLike | None = None) Self#
Create a
Geometryfrom a list of elements and an array of coordinates. Coordinates should be in Ångstrom.- Parameters:
- elementslist of ElementLike
A list of either
Elementmembers, atomic symbols, or atomic numbers.- xyzsArrayLike of floats with shape (N,3)
An N-length sequence of [x, y, z] coordinates.
Examples
>>> elements = [ ... Element.Hydrogen, ... Element.Ruthenium, ... Element.Bromine, ... ] >>> xyzs = np.array([ ... [1.0, 2.0, 3.0], ... [4.0, 5.0, 6.0], ... [7.0, 8.0, 9.0], ... ], dtype=np.float64) >>> geom = Geometry.from_list() >>> print(geom) Element X Y Z H 1.000000 2.000000 3.000000 Ru 4.000000 5.000000 6.000000 Br 7.000000 8.000000 9.000000
- classmethod from_orca(file: PathLike) Self#
Read in the geometry information from an ORCA output file.
- classmethod from_qe_pp(file: PathLike) Self#
Read in only the crystallographic information from a Quantum ESPRESSO post-processing file. (e.g. leaving the
&PLOTblank and readingfilplot)
- classmethod from_xsf(file: PathLike) Self#
Read in the crystallographic information from an XSF file.
- classmethod from_xyz(file: PathLike) Self#
Read in the geometry information from an XYZ file.
- static generate_lattice(bravais_index: int, cell_params: ArrayLike, primitive: bool = False, espresso_like: bool = False) ndarray[tuple[Any, ...], dtype[float64]]#
Generate a 3x3 unit cell matrix from a Bravais lattice index and a set of cell parameters.
- Parameters:
- bravais_index{1, 2, 3, -3, 4, 5, -5, 6, 7, 8, 9, -9, 91, 10, 11, 12, -12, 13, -13, 14}
Integer corresponding to the type of Bravais lattice. Described in
Bravais Indices.- cell_paramsArrayLike of float with size 6
ArrayLike of cell parameters, in order: (a, b, c, α, β, γ)
- primitivebool, default=False
Denote whether supplied cell parameters are for a primitive or a conventional unit cell.
- espresso_likebool, default=False
If
cell_paramsare provided in Quantum ESPRESSO format, this should be set toTrue. Automatically setsprimitivetoTrueas well.
Notes
Quantum ESPRESSO format is as follows:
cell_params = (a, b/a, c/a, cos(α), cos(β), cos(γ))
This function will cross-check all Bravais types against the provided cell parameters.
Bravais Indices#
1Simple Cubic, cP
2Face-Centered Cubic, cF
3Body-Centered Cubic, cI
-3Body-Centered Cubic, cI, Higher Symmetry
4Simple Hexagonal, hP
5Rhombohedral, hR, 3-fold symmetry axis c
-5Rhombohedral, hR, 3-fold symmetry axis <111>
6Simple Tetragonal, tP
7Body-Centered Tetragonal, tI
8Simple Orthorhombic, oP
9Base-Centered Orthorhombic, oS, c-face
-9Base-Centered Orthorhombic, oS, alternate alignment
91Base-Centered Orthorhombic, oS, a-face
10Face-Centered Orthorhombic, oF
11Body-Centered Orthorhombic, oI
12Simple Monoclinic, mP, unique axis c
13Base-Centered Monoclinic, mS
-13Base-Centered Monoclinic, mS, unique axis b
14Simple Triclinic, aP
- exception quadrupole.geometry.FileFormatError(message: str)#
Exception raised when a file is improperly formatted.
- exception quadrupole.geometry.LatticeError(bravais_index: int, cell_params: ndarray[tuple[Any, ...], dtype[float64]])#
Exception raised when trying to generate lattices with incompatible lattice type and cell parameters.