vasppy.cell module¶
- class Cell(matrix)[source]¶
Bases:
object
Initialise a Cell object.
- Parameters:
matrix (np.array) – 3x3 numpy array containing the cell matrix.
- Returns:
None
- angles()[source]¶
The cell angles (in degrees).
- Parameters:
None –
- Returns:
The cell angles.
- Return type:
(list(alpha,beta,gamma))
- cartesian_to_fractional_coordinates(coordinates)[source]¶
Convert a set of Cartesian coordinates to fractional coordinates in the cell.
- Parameters:
coordinates (np.array(dim(N,3))) – The set of Cartesian coordinates.
- Returns:
The corresponding set of fractional coordinates.
- Return type:
(np.array(dim(N,3)))
- dr(r1, r2, cutoff=None)[source]¶
Calculate the distance between two fractional coordinates in the cell.
- Parameters:
r1 (np.array) – fractional coordinates for position 1.
r2 (np.array) – fractional coordinates for position 2.
(optional (cutoff) – Bool): If set, returns None for distances greater than the cutoff. Default None (unset).
- Returns:
the distance between r1 and r2.
- Return type:
(float)
- fractional_to_cartesian_coordinates(coordinates)[source]¶
Convert a set of fractional coordinates in the cell to Cartesian coordinates.
- Parameters:
coordinates (np.array(dim(N,3))) – The set of fractional coordinates.
- Returns:
The corresponding set of Cartesian coordinates.
- Return type:
(np.array(dim(N,3)))
- inside_cell(r)[source]¶
Given a fractional-coordinate, if this lies outside the cell return the equivalent point inside the cell.
- Parameters:
r (np.array) – Fractional coordinates of a point (this may be outside the cell boundaries).
- Returns:
Fractional coordinates of an equivalent point, inside the cell boundaries.
- Return type:
(np.array)
- lengths()[source]¶
The cell lengths.
- Parameters:
None –
- Returns:
The cell lengths.
- Return type:
(np.array(a,b,c))
- minimum_image(r1, r2)[source]¶
Find the minimum image vector from point r1 to point r2.
- Parameters:
r1 (np.array) – fractional coordinates of point r1.
r2 (np.array) – fractional coordinates of point r2.
- Returns:
the fractional coordinate vector from r1 to the nearest image of r2.
- Return type:
(np.array)
- minimum_image_dr(r1, r2, cutoff=None)[source]¶
Calculate the shortest distance between two points in the cell, accounting for periodic boundary conditions.
- Parameters:
r1 (np.array) – fractional coordinates of point r1.
r2 (np.array) – fractional coordinates of point r2.
( (cutoff) – obj: float, optional): if set, return zero if the minimum distance is greater than cutoff. Defaults to None.
- Returns:
The distance between r1 and r2.
- Return type:
(float)
- nearest_image(origin, point)[source]¶
Find the fractional_coordinates of the nearest periodic image to a point of origin.
- Parameters:
origin (np.array) – fractional coordinates of the point of origin.
point (np.array) – fractional coordinates of the other point.
- Returns:
the fractional coordinates of the nearest image of point to origin.
- Return type:
(np.array)
- angle(x, y)[source]¶
Calculate the angle between two vectors, in degrees.
- Parameters:
x (np.array) – one vector.
y (np.array) – the other vector.
- Returns:
the angle between x and y in degrees.
- Return type:
(float)
- rotation_matrix(axis, theta)[source]¶
Return the 3D rotation matrix associated with counterclockwise rotation about the given axis by theta radians.
- Parameters:
axis (np.array) – length 3 numpy array defining the axis of rotation.
theta (float) – rotation angle in radians.
- Returns:
the corredponding rotation matrix.
- Return type:
(np.array)