jarvis.core.lattice

Modules for handing crystallographic lattice-parameters.

Module Contents

Classes

Lattice

Construct Lattice parameter object.

Functions

abs_cap(val, max_abs_val=1)

Return the value with its absolute value capped at max_abs_val.

lattice_coords_transformer(old_lattice_mat=[], new_lattice_mat=[], cart_coords=[])

Transform coords to a new lattice.

get_2d_lattice(atoms={}, round_digits=2)

Get 2D lattice type.

jarvis.core.lattice.abs_cap(val, max_abs_val=1)[source]

Return the value with its absolute value capped at max_abs_val.

Particularly useful in passing values to trignometric functions where numerical errors may result in an argument > 1 being passed in.

Args:

val (float): Input value.

max_abs_val (float): The maximum absolute value for val. Defaults to 1.

Returns:

val if abs(val) < 1 else sign of val * max_abs_val.

class jarvis.core.lattice.Lattice(lattice_mat=None, round_off=5)[source]

Bases: object

Construct Lattice parameter object.

lat_lengths(self)[source]

Return lattice vectors’ lengths.

property volume(self)

Return volume given a lattice object.

property a(self)

Return a lattice vector length.

property b(self)

Return b lattice vector length.

property c(self)

Return c lattice vector length.

property alpha(self)

Return alpha lattice vector angle.

property beta(self)

Return beta lattice vector angle.

property gamma(self)

Return gamma lattice vector angle.

property abc(self)

Return lattice vector lengths.

property angles(self)

Return lattice vector angles.

lat_angles(self, tol=0.01, radians=False)[source]

Return lattice vector angles in radians or degree.

property parameters(self)

Return lattice vector angles in radians or degree.

static from_parameters(a, b, c, alpha, beta, gamma)[source]

Construct Lattice from lattice parameter information.

static cubic(a)[source]

Construct cubic Lattice from lattice parameter information.

static tetragonal(a, c)[source]

Construct tetragonal Lattice from lattice parameter information.

static orthorhombic(a, b, c)[source]

Construct orthorhombic Lattice.

static monoclinic(a, b, c, beta)[source]

Construct monoclinic Lattice from lattice parameter information.

static hexagonal(a, c)[source]

Construct hexagonal Lattice from lattice parameter information.

static rhombohedral(a, alpha)[source]

Construct rhombohedral Lattice.

to_dict(self)[source]

Return lattice parameter information as a dictionary.

classmethod from_dict(self, d)[source]

Construct Lattice from lattice matrix dictionary.

property matrix(self)

Return lattice matrix.

property inv_matrix(self)

Return inverse lattice matrix.

lattice(self)[source]

Return lattice matrix.

inv_lattice(self)[source]

Return inverse lattice matrix.

cart_coords(self, frac_coords)[source]

Return cartesian coords from fractional coords using Lattice.

frac_coords(self, cart_coords)[source]

Return fractional coords from cartesian coords using Lattice.

reciprocal_lattice(self)[source]

Return reciprocal Lattice.

reciprocal_lattice_crystallographic(self)[source]

Return reciprocal Lattice without 2 * pi.

get_points_in_sphere(self, frac_points, center, r)[source]

Find all points within a sphere from the point.

Takes into account periodic boundary conditions. This includes sites in other periodic images. Adapted from pymatgen.

find_all_matches(self, other_lattice, ltol=1e-05, atol=1)[source]

Find all lattice mappings, adapted from pymatgen.

find_matches(self, other_lattice, ltol=1e-05, atol=1)[source]

Find matches with length and angle tolerances.

_calculate_lll(self, delta=0.75)[source]

Perform a Lenstra-Lenstra-Lovasz lattice basis reduction.

Obtain a c-reduced basis. This method returns a basis which is as “good” as possible, with “good” defined by orthongonality of the lattice vectors. This basis is used for all the periodic boundary condition calcs. Adapted from pymatgen.

Args:

delta (float): Reduction parameter.

Default of 0.75 is usually fine.

Returns:

Reduced lattice matrix, mapping to get to that lattice.

get_lll_reduced_lattice(self, delta=0.75)[source]

Get LLL reduced lattice.

Adpted from pymatgen. Args:

delta: Delta parameter.

Returns:

LLL reduced Lattice.

jarvis.core.lattice.lattice_coords_transformer(old_lattice_mat=[], new_lattice_mat=[], cart_coords=[])[source]

Transform coords to a new lattice.

jarvis.core.lattice.get_2d_lattice(atoms={}, round_digits=2)[source]

Get 2D lattice type.