dscribe.core.lattice module¶
Copyright 2019 DScribe developers
Licensed under the Apache License, Version 2.0 (the “License”); you may not use this file except in compliance with the License. You may obtain a copy of the License at
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an “AS IS” BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
- class dscribe.core.lattice.Lattice(matrix)[source]¶
Bases:
object
A lattice object. Essentially a matrix with conversion matrices. In general, it is assumed that length units are in Angstroms and angles are in degrees unless otherwise stated.
Create a lattice from any sequence of 9 numbers. Note that the sequence is assumed to be read one row at a time. Each row represents one lattice vector.
- Parameters
matrix – Sequence of numbers in any form. Examples of acceptable input. i) An actual numpy array. ii) [[1, 0, 0], [0, 1, 0], [0, 0, 1]] iii) [1, 0, 0 , 0, 1, 0, 0, 0, 1] iv) (1, 0, 0, 0, 1, 0, 0, 0, 1) Each row should correspond to a lattice vector. E.g., [[10, 0, 0], [20, 10, 0], [0, 0, 30]] specifies a lattice with lattice vectors [10, 0, 0], [20, 10, 0] and [0, 0, 30].
- property abc¶
Lengths of the lattice vectors, i.e. (a, b, c)
- get_cartesian_coords(fractional_coords)[source]¶
Returns the cartesian coordinates given fractional coordinates.
- Parameters
fractional_coords (3x1 array) – Fractional coords.
- Returns
Cartesian coordinates
- get_fractional_coords(cart_coords)[source]¶
Returns the fractional coordinates given cartesian coordinates.
- Parameters
cart_coords (3x1 array) – Cartesian coords.
- Returns
Fractional coordinates.
- get_points_in_sphere(frac_points, center, r, zip_results=True)[source]¶
Find all points within a sphere from the point taking into account periodic boundary conditions. This includes sites in other periodic images.
Algorithm:
place sphere of radius r in crystal and determine minimum supercell (parallelpiped) which would contain a sphere of radius r. for this we need the projection of a_1 on a unit vector perpendicular to a_2 & a_3 (i.e. the unit vector in the direction b_1) to determine how many a_1”s it will take to contain the sphere.
Nxmax = r * length_of_b_1 / (2 Pi)
keep points falling within r.
- Parameters
frac_points – All points in the lattice in fractional coordinates.
center – Cartesian coordinates of center of sphere.
r – radius of sphere.
zip_results (bool) – Whether to zip the results together to group by point, or return the raw fcoord, dist, index arrays
- Returns
- [(fcoord, dist, index) …] since most of the time, subsequent
processing requires the distance.
- else:
fcoords, dists, inds
- Return type
if zip_results
- property inv_matrix¶
Inverse of lattice matrix.
- property lengths¶
- property matrix¶
Copy of matrix representing the Lattice
- property reciprocal_lattice¶
Return the reciprocal lattice. Note that this is the standard reciprocal lattice used for solid state physics with a factor of 2 * pi. If you are looking for the crystallographic reciprocal lattice, use the reciprocal_lattice_crystallographic property. The property is lazily generated for efficiency.
- property reciprocal_lattice_crystallographic¶
Returns the crystallographic reciprocal lattice, i.e., no factor of 2 * pi.