Modules for handing crystallographic lattice-parameters.

Module Contents



Construct Lattice parameter object.


abs_cap(val[, max_abs_val])

Return the value with its absolute value capped at max_abs_val.

lattice_coords_transformer([old_lattice_mat, ...])

Transform coords to a new lattice.

get_2d_lattice([atoms, round_digits])

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.


val (float): Input value.

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


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.

property volume

Return volume given a lattice object.

property a

Return a lattice vector length.

property b

Return b lattice vector length.

property c

Return c lattice vector length.

property alpha

Return alpha lattice vector angle.

property beta

Return beta lattice vector angle.

property gamma

Return gamma lattice vector angle.

property abc

Return lattice vector lengths.

property angles

Return lattice vector angles.

property parameters

Return lattice vector angles in radians or degree.

property matrix

Return lattice matrix.

property inv_matrix

Return inverse lattice matrix.


Return lattice vectors’ lengths.

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

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.


Return lattice parameter information as a dictionary.

classmethod from_dict(d)[source]

Construct Lattice from lattice matrix dictionary.


Return lattice matrix.


Return inverse lattice matrix.


Return cartesian coords from fractional coords using Lattice.


Return fractional coords from cartesian coords using Lattice.


Return reciprocal Lattice.


Return reciprocal Lattice without 2 * pi.

get_points_in_sphere(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(other_lattice, ltol=1e-05, atol=1)[source]

Find all lattice mappings, adapted from pymatgen.

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

Find matches with length and angle tolerances.


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.


delta (float): Reduction parameter.

Default of 0.75 is usually fine.


Reduced lattice matrix, mapping to get to that lattice.


Get LLL reduced lattice.

Adpted from pymatgen. Args:

delta: Delta parameter.


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.