jarvis.core package¶
Submodules¶
jarvis.core.atoms module¶
This module provides classes to specify atomic structure.
-
class
jarvis.core.atoms.Atoms(lattice_mat=None, coords=None, elements=None, props=None, cartesian=False, show_props=False)[source]¶ Bases:
objectGenerate Atoms python object.
-
atomic_numbers¶ Get list of atomic numbers of atoms in the atoms object.
-
center(axis=2, vacuum=18.0, about=None)[source]¶ Center structure with vacuum padding.
- Args:
vacuum:vacuum size
axis: direction
-
check_polar¶ Check if the surface structure is polar.
Comparing atom types at top and bottom. Applicable for sufcae with vaccums only.
Args:
file:atoms object (surface with vacuum)- Returns:
- polar:True/False
-
composition¶ Get composition of the atoms object.
-
density¶ Get density in g/cm3 of the atoms object.
-
classmethod
from_poscar(filename='POSCAR')[source]¶ Read POSCAR/CONTCAR file from to make Atoms object.
-
classmethod
from_xyz(filename='dsgdb9nsd_057387.xyz', box_size=40)[source]¶ Read XYZ file from to make Atoms object.
-
get_primitive_atoms¶ Get primitive Atoms using spacegroup information.
-
get_string(cart=True, sort_order='X')[source]¶ Convert Atoms to string.
Optional arguments below.
- Args:
cart:True/False for cartesian/fractional coords.
- sort_order: sort by chemical properties of
- elements. Default electronegativity.
-
get_xyz_string¶ Get xyz string for atoms.
-
lattice_points_in_supercell(supercell_matrix)[source]¶ Adapted from Pymatgen.
Returns the list of points on the original lattice contained in the supercell in fractional coordinates (with the supercell basis). e.g. [[2,0,0],[0,1,0],[0,0,1]] returns [[0,0,0],[0.5,0,0]]
Args:
supercell_matrix: 3x3 matrix describing the supercell- Returns:
- numpy array of the fractional coordinates
-
make_supercell_matrix(scaling_matrix)[source]¶ Adapted from Pymatgen.
Makes a supercell. Allowing to have sites outside the unit cell.
- Args:
scaling_matrix: A scaling matrix for transforming the lattice vectors. Has to be all integers. Several options are possible: a. A full 3x3 scaling matrix defining the linear combination
the old lattice vectors. E.g., [[2,1,0],[0,3,0],[0,0, 1]] generates a new structure with lattice vectors a’ = 2a + b, b’ = 3b, c’ = c where a, b, and c are the lattice vectors of the original structure.- An sequence of three scaling factors. E.g., [2, 1, 1]
specifies that the supercell should have dimensions 2a x b x c.- A number, which simply scales all lattice vectors by the
same factor.- Returns:
- Supercell structure. Note that a Structure is always returned, even if the input structure is a subclass of Structure. This is to avoid different arguments signatures from causing problems. If you prefer a subclass to return its own type, you need to override this method in the subclass.
-
num_atoms¶ Get number of atoms.
-
packing_fraction¶ Get packing fraction of the atoms object.
-
raw_angle_matrix¶ Provide distance matrix.
-
raw_distance_matrix¶ Provide distance matrix.
-
uniq_species¶ Get unique elements.
-
volume¶ Get volume of the atoms object.
-
-
class
jarvis.core.atoms.VacuumPadding(atoms, vacuum=20.0)[source]¶ Bases:
objectAdds vaccum padding to make 2D structure or making molecules.
-
jarvis.core.atoms.add_atoms(top, bottom, distance=[0, 0, 1], apply_strain=False)[source]¶ Add top and bottom Atoms with a distance array.
Bottom Atoms lattice-matrix is chosen as final lattice.
jarvis.core.composition module¶
Modules handling chemical composition.
jarvis.core.graphs module¶
Module to generate networkx graphs.
-
class
jarvis.core.graphs.Graph(nodes=[], node_attributes=[], edges=[], edge_attributes=[], color_map=None, labels=None)[source]¶ Bases:
objectGenerate a graph object.
-
adjacency_matrix¶ Provide adjacency_matrix of graph.
-
static
from_atoms(atoms=None, lengthscale=0.5, variance=1.0, get_prim=False, zero_diag=False, node_atomwise_angle_dist=False, node_atomwise_rdf=False, features='basic', enforce_c_size=10.0, max_n=100, max_cut=5.0, verbose=False, make_colormap=True)[source]¶ Get Networkx graph. Requires Networkx installation.
- Args:
atoms: jarvis.core.Atoms object.
- rcut: cut-off after which distance will be set to zero
- in the adjacency matrix.
- features: Node features.
- ‘atomic_number’: graph with atomic numbers only. ‘cfid’: 438 chemical descriptors from CFID. ‘basic’:10 features array: array with CFID chemical descriptor names. See: jarvis/core/specie.py
enforce_c_size: minimum size of the simulation cell in Angst.
-
num_edges¶ Return number of edges in the graph.
-
num_nodes¶ Return number of nodes in the graph.
-
jarvis.core.image module¶
Module for processing image files.
jarvis.core.kpoints module¶
Module for k-points used n various calculations.
-
class
jarvis.core.kpoints.HighSymmetryKpoint3DFactory(kpoints=[], path=[], name=None)[source]¶ Bases:
objectHigh-symmetry k-points for different crystal-systems.
-
class
jarvis.core.kpoints.Kpoints3D(kpoints=[[1, 1, 1]], labels=[], kpoints_weights=[], kpoint_mode='automatic', header='Gamma')[source]¶ Bases:
objectHandle k-points python object.
-
automatic_length_mesh(lattice_mat=[], length=20, header='Gamma')[source]¶ Length based automatic k-points.
-
interpolated_points(atoms, line_density=20, coords_are_cartesian=False)[source]¶ Provide bandstructure k-points, controlled by the line_density.
-
kpath(atoms, line_density=20, weights=[], unique_kp_only=False, coords_are_cartesian=False)[source]¶ Get k-path for bandstructure calculations.
-
kpoints_per_atom(atoms=None, kppa=1000)[source]¶ Return Kpoints object for kpoints per atom for a cell.
-
kpts¶ Return k-points arrays.
-
labels¶ Return k-points labels, used for high BZ points.
-
jarvis.core.lattice module¶
Modules for handing crystallographic lattice-parameters.
-
class
jarvis.core.lattice.Lattice(lattice_mat=None, round_off=5)[source]¶ Bases:
objectConstruct Lattice parameter object.
-
a¶ Return a lattice vector length.
-
abc¶ Return lattice vector lengths.
-
alpha¶ Return alpha lattice vector angle.
-
angles¶ Return lattice vector angles.
-
b¶ Return b lattice vector length.
-
beta¶ Return beta lattice vector angle.
-
c¶ Return c lattice vector length.
-
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.
-
static
from_parameters(a, b, c, alpha, beta, gamma)[source]¶ Construct Lattice from lattice parameter information.
-
gamma¶ Return gamma lattice vector angle.
-
get_lll_reduced_lattice(delta=0.75)[source]¶ Get LLL reduced lattice.
Adpted from pymatgen. Args:
delta: Delta parameter.- Returns:
- LLL reduced Lattice.
-
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.
-
inv_matrix¶ Return inverse lattice matrix.
-
matrix¶ Return lattice matrix.
-
static
monoclinic(a, b, c, beta)[source]¶ Construct monoclinic Lattice from lattice parameter information.
-
parameters¶ Return lattice vector angles in radians or degree.
-
volume¶ Return volume given a lattice object.
-
-
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.
jarvis.core.pdb_atoms module¶
Modules for handling PDB Protein Data Bank files.
jarvis.core.specie module¶
Modules related to chemistry of periodic-table elements.
-
class
jarvis.core.specie.Specie(symbol='')[source]¶ Bases:
objectSpecie object for chemistry information.
Used in defining chemistry of a material.
>>> el = Specie('Al') >>> el.Z 13 >>> round(el.atomic_mass,2) 26.98 >>> el.symbol 'Al' >>> round(el.get_chgdescrp_arr[1],2) 12.17 >>> round(el.get_descrp_arr[1],2) 2792.11 >>> el = Specie('asdfg') >>> el.element_property("asdfg") nan
-
Z¶ Get atomic number.
-
atomic_mass¶ Get atomic mass.
-
atomic_rad¶ Get atomic radii.
-
element_property(key='')[source]¶ Get element property from the list of keys.
These 84 keys are: keys = [
“is_halogen”, “row”, “GV”, “nfunfill”, “C-9”, “C-8”, “C-7”, “C-6”, “C-5”, “C-4”, “C-3”, “C-2”, “C-1”, “C-0”, “me1”, “me3”, “me2”, “max_oxid_s”, “npvalence”, “mp”, “first_ion_en”, “ndunfill”, “op_eg”, “jv_enp”, “nfvalence”, “polzbl”, “oq_bg”, “atom_rad”, “atom_mass”, “is_alkali”, “C-13”, “C-12”, “C-11”, “C-10”, “C-17”, “C-16”, “C-15”, “C-14”, “C-19”, “C-18”, “voro_coord”, “is_noble_gas”, “e1”, “e3”, “e2”, “is_lanthanoid”, “ndvalence”, “KV”, “min_oxid_s”, “nsunfill”, “C-26”, “X”, “is_actinoid”, “C-28”, “C-29”, “C-27”, “C-24”, “C-25”, “C-22”, “C-23”, “C-20”, “C-21”, “avg_ion_rad”, “nsvalence”, “is_metalloid”, “elec_aff”, “coulmn”, “mol_vol”, “bp”, “C-31”, “C-30”, “C-33”, “C-32”, “C-35”, “C-34”, “is_transition_metal”, “block”, “therm_cond”, “Z”, “is_alkaline”, “npunfill”, “oq_enp”, “mop_eg”, “hfus”,]
-
get_chgdescrp_arr¶ Get charge descriptors for an element.
Gives 378 array data.
Args:
elm: element name- Returns:
- arr: array value
-
get_descrp_arr¶ Get chemical descriptors for an element.
Gives 438 array data.
Args:
elm: element name- Returns:
- arr: array value
-
jarvis.core.spectrum module¶
Module to process spectrum like data.
-
class
jarvis.core.spectrum.Spectrum(x=[], y=[], linewidth=5.0, resolution=0.1)[source]¶ Bases:
objectModule for spectrum like data, e.g. IR, Raman, DOS, epsilon.
-
get_interpolated_values(new_dist=array([ 0., 0.05, 0.1, 0.15, 0.2, 0.25, 0.3, 0.35, 0.4, 0.45, 0.5, 0.55, 0.6, 0.65, 0.7, 0.75, 0.8, 0.85, 0.9, 0.95, 1., 1.05, 1.1, 1.15, 1.2, 1.25, 1.3, 1.35, 1.4, 1.45, 1.5, 1.55, 1.6, 1.65, 1.7, 1.75, 1.8, 1.85, 1.9, 1.95, 2., 2.05, 2.1, 2.15, 2.2, 2.25, 2.3, 2.35, 2.4, 2.45, 2.5, 2.55, 2.6, 2.65, 2.7, 2.75, 2.8, 2.85, 2.9, 2.95, 3., 3.05, 3.1, 3.15, 3.2, 3.25, 3.3, 3.35, 3.4, 3.45, 3.5, 3.55, 3.6, 3.65, 3.7, 3.75, 3.8, 3.85, 3.9, 3.95, 4., 4.05, 4.1, 4.15, 4.2, 4.25, 4.3, 4.35, 4.4, 4.45, 4.5, 4.55, 4.6, 4.65, 4.7, 4.75, 4.8, 4.85, 4.9, 4.95, 5., 5.05, 5.1, 5.15, 5.2, 5.25, 5.3, 5.35, 5.4, 5.45, 5.5, 5.55, 5.6, 5.65, 5.7, 5.75, 5.8, 5.85, 5.9, 5.95, 6., 6.05, 6.1, 6.15, 6.2, 6.25, 6.3, 6.35, 6.4, 6.45, 6.5, 6.55, 6.6, 6.65, 6.7, 6.75, 6.8, 6.85, 6.9, 6.95, 7., 7.05, 7.1, 7.15, 7.2, 7.25, 7.3, 7.35, 7.4, 7.45, 7.5, 7.55, 7.6, 7.65, 7.7, 7.75, 7.8, 7.85, 7.9, 7.95, 8., 8.05, 8.1, 8.15, 8.2, 8.25, 8.3, 8.35, 8.4, 8.45, 8.5, 8.55, 8.6, 8.65, 8.7, 8.75, 8.8, 8.85, 8.9, 8.95, 9., 9.05, 9.1, 9.15, 9.2, 9.25, 9.3, 9.35, 9.4, 9.45, 9.5, 9.55, 9.6, 9.65, 9.7, 9.75, 9.8, 9.85, 9.9, 9.95, 10., 10.05, 10.1, 10.15, 10.2, 10.25, 10.3, 10.35, 10.4, 10.45, 10.5, 10.55, 10.6, 10.65, 10.7, 10.75, 10.8, 10.85, 10.9, 10.95, 11., 11.05, 11.1, 11.15, 11.2, 11.25, 11.3, 11.35, 11.4, 11.45, 11.5, 11.55, 11.6, 11.65, 11.7, 11.75, 11.8, 11.85, 11.9, 11.95, 12., 12.05, 12.1, 12.15, 12.2, 12.25, 12.3, 12.35, 12.4, 12.45, 12.5, 12.55, 12.6, 12.65, 12.7, 12.75, 12.8, 12.85, 12.9, 12.95, 13., 13.05, 13.1, 13.15, 13.2, 13.25, 13.3, 13.35, 13.4, 13.45, 13.5, 13.55, 13.6, 13.65, 13.7, 13.75, 13.8, 13.85, 13.9, 13.95, 14., 14.05, 14.1, 14.15, 14.2, 14.25, 14.3, 14.35, 14.4, 14.45, 14.5, 14.55, 14.6, 14.65, 14.7, 14.75, 14.8, 14.85, 14.9, 14.95]))[source]¶ Get interpolated grid on a fixed grid.
-
get_peak_indices(window=array([1, 2, 3, 4, 5, 6, 7, 8, 9]))[source]¶ Get peak indices for non-zero peaks.
-
max_x¶ Get maximum mode frequency.
-
min_x¶ Get minimum mode frequency.
-
num_modes¶ Get number of modes.
-
jarvis.core.utils module¶
Set of useful utility functions.
-
jarvis.core.utils.check_duplicate_coords(coords=[], coord=[])[source]¶ Check if a coordinate exists.
-
jarvis.core.utils.check_match(a, b, tol=1e-08)[source]¶ Check if a and b are the same, taking into account PBCs.
-
jarvis.core.utils.gcd(a, b)[source]¶ Calculate the Greatest Common Divisor of a and b.
Unless b==0, the result will have the same sign as b (so that when b is divided by it, the result comes out positive).
-
jarvis.core.utils.get_angle(a=array([1, 2, 3]), b=array([4, 5, 6]), c=array([7, 8, 9]))[source]¶ Get angle between three vectors.
-
jarvis.core.utils.get_counts(array=['W', 'W', 'Mo', 'Mo', 'S', 'S'])[source]¶ Get number of unique elements and their counts.
Uses OrderedDict.
- Args:
- array of elements
- Returns:
- ordereddict, e.g.OrderedDict([(‘W’, 2), (‘Mo’, 2), (‘S’, 2)])
-
jarvis.core.utils.get_new_coord_for_xyz_sym(frac_coord=[], xyz_string='')[source]¶ Obtain new coord from xyz string.
-
jarvis.core.utils.parse_xyz_string(xyz_string)[source]¶ Convert xyz info to translation and rotation vectors.
Adapted from pymatgen. Args:
- xyz_string: string of the form ‘x, y, z’, ‘-x, -y, z’,
- ‘-2y+1/2, 3x+1/2, z-y+1/2’, etc.
- Returns:
- translation and rotation vectors.
-
jarvis.core.utils.random_colors(number_of_colors=110)[source]¶ Generate random colors for atom coloring.
-
jarvis.core.utils.recast_array_on_uniq_array_elements(uniq=['Si', 'Al', 'O'], arr=['Si', 'Si', 'Al', 'Al', 'Si', 'O', 'O', 'O', 'O'])[source]¶ Recast array on uniq array elements.
Module contents¶
Some of the core modules for JARVIS-Tools.