perturbopy.postproc.dbs.recip_pt_db.RecipPtDB

class perturbopy.postproc.dbs.recip_pt_db.RecipPtDB(points_cart, points_cryst, units='crystal', path=None, path_units='arbitrary', labels={})

Bases: object

This is a class representation of a set of points in reciprocal space.

points_cart

Array of reciprocal space points in cartesian coordinates, in units of 2pi/a.

Type:

array_like

points_cryst

Array of reciprocal space points in crystal coordinates.

Type:

array_like

units

The units that calculations will be performed in (crystal or cartesian). If units = ‘crystal’, then points_cryst will be used instead of points_cart when a method such as “distances” is called on the RecipPtDB object.

Type:

str

points

Array of reciprocal space points in crystal or cartesian coordinates, depending on the value of “units”.

Type:

array_like

path

Array of floats corresponding to each reciprocal space point, for plotting purposes.

Type:

array_like

path_units

Units of path, typically arbitrary

Type:

str

labels

Dictionary of reciprocal space point labels example: {“Gamma”: [0, 0, 0], ‘L’: [.5,.5,.5]}

Type:

dict

Methods

add_labels

Method to add labels associated with a reciprocal space point.

convert_units

Method to convert the assumed units between crystal and cartesian coordinates.

distances

Method to compute the distances between each reciprocal space point in the points property and an inputted reciprocal space point

find

Method to find the index or indices of a particular point

from_lattice

Class method to create a RecipPtDB from one set of reciprocal space points and the lattice information.

path2point

Method to find the reciprocal space point corresponding to a path coordinate

point2path

Method to find the path coordinate corresponding to a reciprocal space point coordinate

remove_labels

Method to remove a label associated with a reciprocal space point.

scale_path

Method to scale the arbitrary k path plotting coordinates to a certain range.

add_labels(labels_dict_input)

Method to add labels associated with a reciprocal space point. For example, point = [0,0,0] and label = ‘gamma’

Parameters:
  • points (list) – A list of reciprocal space points

  • labels_dict_input (dict) – A dictionary with the keys corresponding to reciprocal space point names, and values corresponding tolerance reciprocal space points

convert_units(new_units, in_place=True)

Method to convert the assumed units between crystal and cartesian coordinates.

new_unitsstr

The new units to use, either crystal or cartesian (or some valid variation of those names)

in_placebool, optional

If true, the new units will be assumed in all future calls to the RecipPtDB.

Returns:

points – The stored points in the new units

Return type:

array

distances(point)

Method to compute the distances between each reciprocal space point in the points property and an inputted reciprocal space point

Parameters:

point (array) – The reciprocal space point that distances will be computed from

Returns:

distances – an array of distances between each reciprocal space point in the database and the inputted point

Return type:

array

find(point, max_dist=0.025, nearest=True)

Method to find the index or indices of a particular point

Parameters:
  • point (array) – The reciprocal space point to be searched

  • max_dist (float, optional) – The maximum distance between the point to locate and the points identified as matches

  • nearest (bool, optional) – If True, only the nearest match, or matches in the case of duplicate points, are returned (even if other points are within the max_dist)

Returns:

points_indices – The indices of the matching reciprocal space point in the points array

Return type:

list

classmethod from_lattice(points, units, lat, recip_lat, path=None, path_units='arbitrary', labels={})

Class method to create a RecipPtDB from one set of reciprocal space points and the lattice information.

Parameters:
  • points (array_like) – Array of column-oriented reciprocal space points in cartesian or crystal coordinates. If clearly not column-oriented (i.e. the number of columns, but not rows, is 3), points will be reshaped.

  • units (str) – The units points are given in

  • lat (array) – 3x3 array of lattice vectors [v1, v2, v3] in units of alat

  • recip_lat (array) – 3x3 array of reciprocal lattice vectors [v1, v2, v3] in units of 2pi/a

  • path (array, optional) – Array of values corresponding to each reciprocal space point, for plotting purposes

  • path_units (str, optional) – Units of the path points, typically arbitrary

  • labels (dict, optional) – Dictionary of reciprocal space point labels example: {“Gamma”: [0, 0, 0], ‘L’: [.5,.5,.5]}

Returns:

points_db – The RecipPtDB created from the lattice information and reciprocal space points

Return type:

RecipPtDB

path2point(path_coord, atol=1e-05, rtol=0.01, nearest=True)

Method to find the reciprocal space point corresponding to a path coordinate

Parameters:
  • path_coord (float) – The path coordinate to be converted to a point

  • atol (float, optional)

  • coordinates (The absolute tolerance between the path coordinate to locate and the matching path)

  • rtol (float, optional) – The relative tolerance between the path coordinate to locate and the matching path coordinates

  • nearest (bool, optional) – If True, only the nearest path coordinate, or coordinates in the case of repeats, are returned (even if other points are within the absolute and relative tolerance)

Returns:

point – The reciprocal space point(s) of the corresponding path coordinate

Return type:

array

point2path(point, max_dist=0.025, nearest=True)

Method to find the path coordinate corresponding to a reciprocal space point coordinate

Parameters:
  • point (array_like) – The reciprocal space point to be searched

  • max_dist (float, optional) – The maximum distance between the point to locate and the points identified as matches

  • nearest (bool, optional) – If True, only the nearest match, or matches in the case of duplicate points, are returned (even if other points are within the max_dist)

Returns:

path_coord – The path coordinates of the corresponding reciprocal space point(s)

Return type:

array

remove_labels(labels_list)

Method to remove a label associated with a reciprocal space point. For example, point = [0,0,0] and label = ‘gamma’

Parameters:

labels_list (array_like) – The set of labels (keys in self.labels) to remove

scale_path(range_min, range_max)

Method to scale the arbitrary k path plotting coordinates to a certain range.

Parameters:
  • range_min (float) – Lower limit of the range to which the k path coordinates will be scaled.

  • range_max (float) – Upper limit of the range to which the k path coordinates will be scaled.

Return type:

None