INSTRUCTION
stringlengths
1
8.43k
RESPONSE
stringlengths
75
104k
Perform Voronoi analysis on a list of Structures. Note that this might take a significant amount of time depending on the size and number of structures.
def analyze_structures(self, structures, step_freq=10, most_frequent_polyhedra=15): """ Perform Voronoi analysis on a list of Structures. Note that this might take a significant amount of time depending on the size and number of structures. Args: ...
Returns the percentage volume change.
def get_percentage_volume_change(self): """ Returns the percentage volume change. Returns: Volume change in percentage, e.g., 0.055 implies a 5.5% increase. """ initial_vol = self.initial.lattice.volume final_vol = self.final.lattice.volume return fin...
Returns the percentage lattice parameter changes.
def get_percentage_lattice_parameter_changes(self): """ Returns the percentage lattice parameter changes. Returns: A dict of the percentage change in lattice parameter, e.g., {'a': 0.012, 'b': 0.021, 'c': -0.031} implies a change of 1.2%, 2.1% and -3.1% in th...
Returns the percentage bond distance changes for each site up to a maximum radius for nearest neighbors.
def get_percentage_bond_dist_changes(self, max_radius=3.0): """ Returns the percentage bond distance changes for each site up to a maximum radius for nearest neighbors. Args: max_radius (float): Maximum radius to search for nearest neighbors. This radius is ap...
Provides connectivity array.
def connectivity_array(self): """ Provides connectivity array. Returns: connectivity: An array of shape [atomi, atomj, imagej]. atomi is the index of the atom in the input structure. Since the second atom can be outside of the unit cell, it must be described ...
Returns a list of site pairs that are Voronoi Neighbors along with their real - space distances.
def get_connections(self): """ Returns a list of site pairs that are Voronoi Neighbors, along with their real-space distances. """ con = [] maxconn = self.max_connectivity for ii in range(0, maxconn.shape[0]): for jj in range(0, maxconn.shape[1]): ...
Assuming there is some value in the connectivity array at indices ( 1 3 12 ). sitei can be obtained directly from the input structure ( structure [ 1 ] ). sitej can be obtained by passing 3 12 to this function
def get_sitej(self, site_index, image_index): """ Assuming there is some value in the connectivity array at indices (1, 3, 12). sitei can be obtained directly from the input structure (structure[1]). sitej can be obtained by passing 3, 12 to this function Args: site_...
Determines if an oxide is a peroxide/ superoxide/ ozonide/ normal oxide.
def parse_oxide(self): """ Determines if an oxide is a peroxide/superoxide/ozonide/normal oxide. Returns: oxide_type (str): Type of oxide ozonide/peroxide/superoxide/hydroxide/None. nbonds (int): Number of peroxide/superoxide/hydroxide bonds in st...
Identify non - H non - C atoms in the MoleculeGraph returning a list of their node indices.
def get_heteroatoms(self, elements=None): """ Identify non-H, non-C atoms in the MoleculeGraph, returning a list of their node indices. :param elements: List of elements to identify (if only certain functional groups are of interest). :return: set of ints representin...
Identify Carbon atoms in the MoleculeGraph that fit the characteristics defined Ertl ( 2017 ) returning a list of their node indices.
def get_special_carbon(self, elements=None): """ Identify Carbon atoms in the MoleculeGraph that fit the characteristics defined Ertl (2017), returning a list of their node indices. The conditions for marking carbon atoms are (quoted from Ertl): "- atoms connected by non-aro...
Take a list of marked interesting atoms ( heteroatoms special carbons ) and attempt to connect them returning a list of disjoint groups of special atoms ( and their connected hydrogens ).
def link_marked_atoms(self, atoms): """ Take a list of marked "interesting" atoms (heteroatoms, special carbons) and attempt to connect them, returning a list of disjoint groups of special atoms (and their connected hydrogens). :param atoms: set of marked "interesting" atoms, pr...
Identify functional groups that cannot be identified by the Ertl method of get_special_carbon and get_heteroatoms such as benzene rings methyl groups and ethyl groups.
def get_basic_functional_groups(self, func_groups=None): """ Identify functional groups that cannot be identified by the Ertl method of get_special_carbon and get_heteroatoms, such as benzene rings, methyl groups, and ethyl groups. TODO: Think of other functional groups that are...
Identify all functional groups ( or all within a certain subset ) in the molecule combining the methods described above.
def get_all_functional_groups(self, elements=None, func_groups=None, catch_basic=True): """ Identify all functional groups (or all within a certain subset) in the molecule, combining the methods described above. :param elements: List of elements that wi...
Determine classes of functional groups present in a set.
def categorize_functional_groups(self, groups): """ Determine classes of functional groups present in a set. :param groups: Set of functional groups. :return: dict containing representations of the groups, the indices of where the group occurs in the MoleculeGraph, and how m...
Wrapper for functions or properties that should raise an error if tensor is unphysical.
def raise_error_if_unphysical(f): """ Wrapper for functions or properties that should raise an error if tensor is unphysical. """ def wrapper(self, *args, **kwargs): if self.k_vrh < 0 or self.g_vrh < 0: raise ValueError("Bulk or shear modulus is negative, property " ...
nth order elastic constant fitting function based on central - difference derivatives with respect to distinct strain states. The algorithm is summarized as follows:
def diff_fit(strains, stresses, eq_stress=None, order=2, tol=1e-10): """ nth order elastic constant fitting function based on central-difference derivatives with respect to distinct strain states. The algorithm is summarized as follows: 1. Identify distinct strain states as sets of indices ...
Finds stress corresponding to zero strain state in stress - strain list
def find_eq_stress(strains, stresses, tol=1e-10): """ Finds stress corresponding to zero strain state in stress-strain list Args: strains (Nx3x3 array-like): array corresponding to strains stresses (Nx3x3 array-like): array corresponding to stresses tol (float): tolerance to find ze...
Creates a dictionary of voigt - notation stress - strain sets keyed by strain state i. e. a tuple corresponding to the non - zero entries in ratios to the lowest nonzero value e. g. [ 0 0. 1 0 0. 2 0 0 ] - > ( 0 1 0 2 0 0 ) This allows strains to be collected in stencils as to evaluate parameterized finite difference d...
def get_strain_state_dict(strains, stresses, eq_stress=None, tol=1e-10, add_eq=True, sort=True): """ Creates a dictionary of voigt-notation stress-strain sets keyed by "strain state", i. e. a tuple corresponding to the non-zero entries in ratios to the lowest nonzero value, ...
Generates the pseudoinverse for a given set of strains.
def generate_pseudo(strain_states, order=3): """ Generates the pseudoinverse for a given set of strains. Args: strain_states (6xN array like): a list of voigt-notation "strain-states", i. e. perturbed indices of the strain as a function of the smallest strain e. g. (0, 1, 0,...
Returns a symbolic representation of the voigt - notation tensor that places identical symbols for entries related by index transposition i. e. C_1121 = C_1211 etc.
def get_symbol_list(rank, dim=6): """ Returns a symbolic representation of the voigt-notation tensor that places identical symbols for entries related by index transposition, i. e. C_1121 = C_1211 etc. Args: dim (int): dimension of matrix/tensor, e. g. 6 for voigt notation and 3...
Helper function to find difference coefficients of an derivative on an arbitrary mesh.
def get_diff_coeff(hvec, n=1): """ Helper function to find difference coefficients of an derivative on an arbitrary mesh. Args: hvec (1D array-like): sampling stencil n (int): degree of derivative to find """ hvec = np.array(hvec, dtype=np.float) acc = len(hvec) exp = np...
Calculate s a given elastic tensor s contribution to the stress using Einstein summation
def calculate_stress(self, strain): """ Calculate's a given elastic tensor's contribution to the stress using Einstein summation Args: strain (3x3 array-like): matrix corresponding to strain """ strain = np.array(strain) if strain.shape == (6,): ...
Calculates the elastic energy density due to a strain
def energy_density(self, strain, convert_GPa_to_eV=True): """ Calculates the elastic energy density due to a strain """ e_density = np.sum(self.calculate_stress(strain)*strain) / self.order if convert_GPa_to_eV: e_density *= self.GPa_to_eV_A3 # Conversion factor for ...
returns the Voigt - notation compliance tensor which is the matrix inverse of the Voigt - notation elastic tensor
def compliance_tensor(self): """ returns the Voigt-notation compliance tensor, which is the matrix inverse of the Voigt-notation elastic tensor """ s_voigt = np.linalg.inv(self.voigt) return ComplianceTensor.from_voigt(s_voigt)
returns the G_v shear modulus
def g_voigt(self): """ returns the G_v shear modulus """ return (2. * self.voigt[:3, :3].trace() - np.triu(self.voigt[:3, :3]).sum() + 3 * self.voigt[3:, 3:].trace()) / 15.
returns the G_r shear modulus
def g_reuss(self): """ returns the G_r shear modulus """ return 15. / (8. * self.compliance_tensor.voigt[:3, :3].trace() - 4. * np.triu(self.compliance_tensor.voigt[:3, :3]).sum() + 3. * self.compliance_tensor.voigt[3:, 3:].trace())
Calculates Young s modulus ( in SI units ) using the Voigt - Reuss - Hill averages of bulk and shear moduli
def y_mod(self): """ Calculates Young's modulus (in SI units) using the Voigt-Reuss-Hill averages of bulk and shear moduli """ return 9.e9 * self.k_vrh * self.g_vrh / (3. * self.k_vrh + self.g_vrh)
Calculates the poisson ratio for a specific direction relative to a second orthogonal direction
def directional_poisson_ratio(self, n, m, tol=1e-8): """ Calculates the poisson ratio for a specific direction relative to a second, orthogonal direction Args: n (3-d vector): principal direction m (3-d vector): secondary direction orthogonal to n tol...
Calculates transverse sound velocity ( in SI units ) using the Voigt - Reuss - Hill average bulk modulus
def trans_v(self, structure): """ Calculates transverse sound velocity (in SI units) using the Voigt-Reuss-Hill average bulk modulus Args: structure: pymatgen structure object Returns: transverse sound velocity (in SI units) """ nsites = structure.n...
Calculates Snyder s acoustic sound velocity ( in SI units )
def snyder_ac(self, structure): """ Calculates Snyder's acoustic sound velocity (in SI units) Args: structure: pymatgen structure object Returns: Snyder's acoustic sound velocity (in SI units) """ nsites = structure.num_sites volume = structure.volu...
Calculates Snyder s optical sound velocity ( in SI units )
def snyder_opt(self, structure): """ Calculates Snyder's optical sound velocity (in SI units) Args: structure: pymatgen structure object Returns: Snyder's optical sound velocity (in SI units) """ nsites = structure.num_sites volume = structure.volum...
Calculates Clarke s thermal conductivity ( in SI units )
def clarke_thermalcond(self, structure): """ Calculates Clarke's thermal conductivity (in SI units) Args: structure: pymatgen structure object Returns: Clarke's thermal conductivity (in SI units) """ nsites = structure.num_sites volume = structure.v...
Estimates the debye temperature from longitudinal and transverse sound velocities
def debye_temperature(self, structure): """ Estimates the debye temperature from longitudinal and transverse sound velocities Args: structure: pymatgen structure object Returns: debye temperature (in SI units) """ v0 = (structure.volume * 1e-30 / st...
returns the universal anisotropy value
def universal_anisotropy(self): """ returns the universal anisotropy value """ return 5. * self.g_voigt / self.g_reuss + \ self.k_voigt / self.k_reuss - 6.
returns the homogeneous poisson ratio
def homogeneous_poisson(self): """ returns the homogeneous poisson ratio """ return (1. - 2. / 3. * self.g_vrh / self.k_vrh) / \ (2. + 2. / 3. * self.g_vrh / self.k_vrh)
returns a dictionary of properties derived from the elastic tensor and an associated structure
def get_structure_property_dict(self, structure, include_base_props=True, ignore_errors=False): """ returns a dictionary of properties derived from the elastic tensor and an associated structure Args: structure (Structure): structure objec...
Class method to fit an elastic tensor from stress/ strain data. Method uses Moore - Penrose pseudoinverse to invert the s = C * e equation with elastic tensor stress and strain in voigt notation
def from_pseudoinverse(cls, strains, stresses): """ Class method to fit an elastic tensor from stress/strain data. Method uses Moore-Penrose pseudoinverse to invert the s = C*e equation with elastic tensor, stress, and strain in voigt notation Args: stresses...
Constructs the elastic tensor least - squares fit of independent strains Args: strains ( list of Strains ): list of strain objects to fit stresses ( list of Stresses ): list of stress objects to use in fit corresponding to the list of strains eq_stress ( Stress ): equilibrium stress to use in fitting vasp ( boolean ): ...
def from_independent_strains(cls, strains, stresses, eq_stress=None, vasp=False, tol=1e-10): """ Constructs the elastic tensor least-squares fit of independent strains Args: strains (list of Strains): list of strain objects to fit stresses...
Generates an elastic tensor expansion via the fitting function defined below in diff_fit
def from_diff_fit(cls, strains, stresses, eq_stress=None, tol=1e-10, order=3): """ Generates an elastic tensor expansion via the fitting function defined below in diff_fit """ c_list = diff_fit(strains, stresses, eq_stress, order, tol) return cls(c_l...
Calculates the elastic energy density due to a strain
def energy_density(self, strain, convert_GPa_to_eV=True): """ Calculates the elastic energy density due to a strain """ return sum([c.energy_density(strain, convert_GPa_to_eV) for c in self])
Gets the Generalized Gruneisen tensor for a given third - order elastic tensor expansion.
def get_ggt(self, n, u): """ Gets the Generalized Gruneisen tensor for a given third-order elastic tensor expansion. Args: n (3x1 array-like): normal mode direction u (3x1 array-like): polarization direction """ gk = self[0].einsum_sequence([n, u,...
Gets the thermodynamic Gruneisen tensor ( TGT ) by via an integration of the GGT weighted by the directional heat capacity.
def get_tgt(self, temperature=None, structure=None, quad=None): """ Gets the thermodynamic Gruneisen tensor (TGT) by via an integration of the GGT weighted by the directional heat capacity. See refs: R. N. Thurston and K. Brugger, Phys. Rev. 113, A1604 (1964). ...
Gets the single average gruneisen parameter from the TGT.
def get_gruneisen_parameter(self, temperature=None, structure=None, quad=None): """ Gets the single average gruneisen parameter from the TGT. Args: temperature (float): Temperature in kelvin, if not specified will return non-cv-normali...
Gets the directional heat capacity for a higher order tensor expansion as a function of direction and polarization.
def get_heat_capacity(self, temperature, structure, n, u, cutoff=1e2): """ Gets the directional heat capacity for a higher order tensor expansion as a function of direction and polarization. Args: temperature (float): Temperature in kelvin structure (float): Stru...
Finds directional frequency contribution to the heat capacity from direction and polarization
def omega(self, structure, n, u): """ Finds directional frequency contribution to the heat capacity from direction and polarization Args: structure (Structure): Structure to be used in directional heat capacity determination n (3x1 array-like): di...
Gets thermal expansion coefficient from third - order constants.
def thermal_expansion_coeff(self, structure, temperature, mode="debye"): """ Gets thermal expansion coefficient from third-order constants. Args: temperature (float): Temperature in kelvin, if not specified will return non-cv-normalized value structure (S...
Gets a compliance tensor expansion from the elastic tensor expansion.
def get_compliance_expansion(self): """ Gets a compliance tensor expansion from the elastic tensor expansion. """ # TODO: this might have a general form if not self.order <= 4: raise ValueError("Compliance tensor expansion only " "...
Gets the strain from a stress state according to the compliance expansion corresponding to the tensor expansion.
def get_strain_from_stress(self, stress): """ Gets the strain from a stress state according to the compliance expansion corresponding to the tensor expansion. """ compl_exp = self.get_compliance_expansion() strain = 0 for n, compl in enumerate(compl_exp): ...
Returns the effective elastic constants from the elastic tensor expansion.
def get_effective_ecs(self, strain, order=2): """ Returns the effective elastic constants from the elastic tensor expansion. Args: strain (Strain or 3x3 array-like): strain condition under which to calculate the effective constants order (int): or...
Gets the Wallace Tensor for determining yield strength criteria.
def get_wallace_tensor(self, tau): """ Gets the Wallace Tensor for determining yield strength criteria. Args: tau (3x3 array-like): stress at which to evaluate the wallace tensor """ b = 0.5 * (np.einsum("ml,kn->klmn", tau, np.eye(3)) + ...
Gets the symmetrized wallace tensor for determining yield strength criteria.
def get_symmetric_wallace_tensor(self, tau): """ Gets the symmetrized wallace tensor for determining yield strength criteria. Args: tau (3x3 array-like): stress at which to evaluate the wallace tensor. """ wallace = self.get_wallace_tensor(tau...
Gets the stability criteria from the symmetric Wallace tensor from an input vector and stress value.
def get_stability_criteria(self, s, n): """ Gets the stability criteria from the symmetric Wallace tensor from an input vector and stress value. Args: s (float): Stress value at which to evaluate the stability criteria n (3x1 array-like): ...
Gets the yield stress for a given direction
def get_yield_stress(self, n): """ Gets the yield stress for a given direction Args: n (3x1 array-like): direction for which to find the yield stress """ # TODO: root finding could be more robust comp = root(self.get_stability_criteria, -1, ar...
Computes the continuous symmetry measure of the ( distorted ) set of points points_distorted with respect to the ( perfect ) set of points points_perfect.: param points_distorted: List of points describing a given ( distorted ) polyhedron for which the symmetry measure has to be computed with respect to the model polyh...
def symmetry_measure(points_distorted, points_perfect): """ Computes the continuous symmetry measure of the (distorted) set of points "points_distorted" with respect to the (perfect) set of points "points_perfect". :param points_distorted: List of points describing a given (distorted) polyhedron for whi...
This finds the rotation matrix that aligns the ( distorted ) set of points points_distorted with respect to the ( perfect ) set of points points_perfect in a least - square sense.: param points_distorted: List of points describing a given ( distorted ) polyhedron for which the rotation that aligns these points in a lea...
def find_rotation(points_distorted, points_perfect): """ This finds the rotation matrix that aligns the (distorted) set of points "points_distorted" with respect to the (perfect) set of points "points_perfect" in a least-square sense. :param points_distorted: List of points describing a given (distorted...
This finds the scaling factor between the ( distorted ) set of points points_distorted and the ( perfect ) set of points points_perfect in a least - square sense.: param points_distorted: List of points describing a given ( distorted ) polyhedron for which the scaling factor has to be obtained.: param points_perfect: L...
def find_scaling_factor(points_distorted, points_perfect, rot): """ This finds the scaling factor between the (distorted) set of points "points_distorted" and the (perfect) set of points "points_perfect" in a least-square sense. :param points_distorted: List of points describing a given (distorted) poly...
Setup of the parameters for the coordination geometry finder. A reference point for the geometries has to be chosen. This can be the centroid of the structure ( including or excluding the atom for which the coordination geometry is looked for ) or the atom itself. In the standard centering_type the reference point is t...
def setup_parameters(self, centering_type='standard', include_central_site_in_centroid=False, bva_distance_scale_factor=None, structure_refinement=STRUCTURE_REFINEMENT_REFINED, spg_analyzer_options=None): """ ...
Sets up the structure for which the coordination geometries have to be identified. The structure is analyzed with the space group analyzer and a refined structure is used: param structure: A pymatgen Structure: param
def setup_structure(self, structure): """ Sets up the structure for which the coordination geometries have to be identified. The structure is analyzed with the space group analyzer and a refined structure is used :param structure: A pymatgen Structure :param """ s...
Sets up the pymatgen structure for which the coordination geometries have to be identified starting from the lattice the species and the coordinates: param lattice: The lattice of the structure: param species: The species on the sites: param coords: The coordinates of the sites: param coords_are_cartesian: If set to Tr...
def set_structure(self, lattice, species, coords, coords_are_cartesian): """ Sets up the pymatgen structure for which the coordination geometries have to be identified starting from the lattice, the species and the coordinates :param lattice: The lattice of the structure :param s...
Computes and returns the StructureEnvironments object containing all the information about the coordination environments in the structure: param excluded_atoms: Atoms for which the coordination geometries does not have to be identified: param only_atoms: If not set to None atoms for which the coordination geometries ha...
def compute_structure_environments(self, excluded_atoms=None, only_atoms=None, only_cations=True, only_indices=None, maximum_...
Sets up the AbstractGeometry for the local geometry of site with index isite.: param isite: Index of the site for which the local geometry has to be set up: param coords: The coordinates of the ( local ) neighbors
def setup_local_geometry(self, isite, coords, optimization=None): """ Sets up the AbstractGeometry for the local geometry of site with index isite. :param isite: Index of the site for which the local geometry has to be set up :param coords: The coordinates of the (local) neighbors ...
Sets up a purely random structure with a given coordination.: param coordination: coordination number for the random structure
def setup_random_structure(self, coordination): """ Sets up a purely random structure with a given coordination. :param coordination: coordination number for the random structure """ aa = 0.4 bb = -0.2 coords = list() for ii in range(coordination + 1): ...
Sets up random indices for the local geometry for testing purposes: param coordination: coordination of the local geometry
def setup_random_indices_local_geometry(self, coordination): """ Sets up random indices for the local geometry, for testing purposes :param coordination: coordination of the local geometry """ self.icentral_site = 0 self.indices = list(range(1, coordination + 1)) ...
Sets up ordered indices for the local geometry for testing purposes: param coordination: coordination of the local geometry
def setup_ordered_indices_local_geometry(self, coordination): """ Sets up ordered indices for the local geometry, for testing purposes :param coordination: coordination of the local geometry """ self.icentral_site = 0 self.indices = list(range(1, coordination + 1))
Sets up explicit indices for the local geometry for testing purposes: param explicit_indices: explicit indices for the neighbors ( set of numbers from 0 to CN - 1 in a given order )
def setup_explicit_indices_local_geometry(self, explicit_indices): """ Sets up explicit indices for the local geometry, for testing purposes :param explicit_indices: explicit indices for the neighbors (set of numbers from 0 to CN-1 in a given order) """ self.icentral_site...
Returns the continuous symmetry measures of the current local geometry in a dictionary.: return: the continuous symmetry measures of the current local geometry in a dictionary.
def get_coordination_symmetry_measures(self, only_minimum=True, all_csms=True, optimization=None): """ Returns the continuous symmetry measures of the current local geometry in a dictionary. :return: the continuous symmetry measures of the current local...
Returns the continuous symmetry measures of the current local geometry in a dictionary.: return: the continuous symmetry measures of the current local geometry in a dictionary.
def get_coordination_symmetry_measures_optim(self, only_minimum=True, all_csms=True, nb_set=None, optimization=None): """ Returns the continuous symmetry measures of the current local geometry in a dictionary. :return: the continuous symmetry meas...
Returns the symmetry measures of a given coordination_geometry for a set of permutations depending on the permutation setup. Depending on the parameters of the LocalGeometryFinder and on the coordination geometry different methods are called.: param coordination_geometry: Coordination geometry for which the symmetry me...
def coordination_geometry_symmetry_measures(self, coordination_geometry, tested_permutations=False, points_perfect=None, optimization=None): """ Returns the sym...
Returns the symmetry measures of a given coordination_geometry for a set of permutations depending on the permutation setup. Depending on the parameters of the LocalGeometryFinder and on the coordination geometry different methods are called.: param coordination_geometry: Coordination geometry for which the symmetry me...
def coordination_geometry_symmetry_measures_sepplane_optim(self, coordination_geometry, points_perfect=None, nb_set=None, optimization=None): """ Returns the symmetry measures of...
Returns the symmetry measures for a set of permutations ( whose setup depends on the coordination geometry ) for the coordination geometry coordination_geometry. Standard implementation looking for the symmetry measures of each permutation
def coordination_geometry_symmetry_measures_standard(self, coordination_geometry, algo, points_perfect=None, ...
Returns the symmetry measures of the given coordination geometry coordination_geometry using separation facets to reduce the complexity of the system. Caller to the refined 2POINTS 3POINTS and other...: param coordination_geometry: The coordination geometry to be investigated: return: The symmetry measures for the give...
def coordination_geometry_symmetry_measures_separation_plane(self, coordination_geometry, separation_plane_algo, testing=Fals...
Returns the symmetry measures of the given coordination geometry coordination_geometry using separation facets to reduce the complexity of the system. Caller to the refined 2POINTS 3POINTS and other...: param coordination_geometry: The coordination geometry to be investigated: return: The symmetry measures for the give...
def coordination_geometry_symmetry_measures_separation_plane_optim(self, coordination_geometry, separation_plane_algo, ...
Returns the symmetry measures for a random set of permutations for the coordination geometry coordination_geometry. Fallback implementation for the plane separation algorithms measures of each permutation
def coordination_geometry_symmetry_measures_fallback_random(self, coordination_geometry, NRANDOM=10, points_perfect=None): ...
Plot the Fermi surface at specific energy value.
def plot_fermi_surface(data, structure, cbm, energy_levels=[], multiple_figure=True, mlab_figure=None, kpoints_dict={}, color=(0, 0, 1), transparency_factor=[], labels_scale_factor=0.05, points_scale_factor=0.02, interative=True...
Adds the skeleton of the Wigner - Seitz cell of the lattice to a matplotlib Axes
def plot_wigner_seitz(lattice, ax=None, **kwargs): """ Adds the skeleton of the Wigner-Seitz cell of the lattice to a matplotlib Axes Args: lattice: Lattice object ax: matplotlib :class:`Axes` or None if a new figure should be created. kwargs: kwargs passed to the matplotlib functio...
Adds the basis vectors of the lattice provided to a matplotlib Axes
def plot_lattice_vectors(lattice, ax=None, **kwargs): """ Adds the basis vectors of the lattice provided to a matplotlib Axes Args: lattice: Lattice object ax: matplotlib :class:`Axes` or None if a new figure should be created. kwargs: kwargs passed to the matplotlib function 'plot'...
Adds a line passing through the coordinates listed in line to a matplotlib Axes
def plot_path(line, lattice=None, coords_are_cartesian=False, ax=None, **kwargs): """ Adds a line passing through the coordinates listed in 'line' to a matplotlib Axes Args: line: list of coordinates. lattice: Lattice object used to convert from reciprocal to cartesian coordin...
Adds labels to a matplotlib Axes
def plot_labels(labels, lattice=None, coords_are_cartesian=False, ax=None, **kwargs): """ Adds labels to a matplotlib Axes Args: labels: dict containing the label as a key and the coordinates as value. lattice: Lattice object used to convert from reciprocal to cartesian coor...
Folds a point with coordinates p inside the first Brillouin zone of the lattice.
def fold_point(p, lattice, coords_are_cartesian=False): """ Folds a point with coordinates p inside the first Brillouin zone of the lattice. Args: p: coordinates of one point lattice: Lattice object used to convert from reciprocal to cartesian coordinates coords_are_cartesian: Set t...
Adds Points to a matplotlib Axes
def plot_points(points, lattice=None, coords_are_cartesian=False, fold=False, ax=None, **kwargs): """ Adds Points to a matplotlib Axes Args: points: list of coordinates lattice: Lattice object used to convert from reciprocal to cartesian coordinates coords_are_cartes...
Gives the plot ( as a matplotlib object ) of the symmetry line path in the Brillouin Zone.
def plot_brillouin_zone_from_kpath(kpath, ax=None, **kwargs): """ Gives the plot (as a matplotlib object) of the symmetry line path in the Brillouin Zone. Args: kpath (HighSymmKpath): a HighSymmKPath object ax: matplotlib :class:`Axes` or None if a new figure should be created. ...
Plots a 3D representation of the Brillouin zone of the structure. Can add to the plot paths labels and kpoints
def plot_brillouin_zone(bz_lattice, lines=None, labels=None, kpoints=None, fold=False, coords_are_cartesian=False, ax=None, **kwargs): """ Plots a 3D representation of the Brillouin zone of the structure. Can add to the plot paths, labels and kpoints Args...
Plots a 3D ellipsoid rappresenting the Hessian matrix in input. Useful to get a graphical visualization of the effective mass of a band in a single k - point. Args: hessian: the Hessian matrix center: the center of the ellipsoid in reciprocal coords ( Default ) lattice: Lattice object of the Brillouin zone rescale: fac...
def plot_ellipsoid(hessian, center, lattice=None, rescale=1.0, ax=None, coords_are_cartesian=False, arrows=False, **kwargs): """ Plots a 3D ellipsoid rappresenting the Hessian matrix in input. Useful to get a graphical visualization of the effective mass of a band in a single k-point....
Adds a dos for plotting.
def add_dos(self, label, dos): """ Adds a dos for plotting. Args: label: label for the DOS. Must be unique. dos: Dos object """ energies = dos.energies - dos.efermi if self.zero_at_efermi \ else dos.energies ...
Get a matplotlib plot showing the DOS.
def get_plot(self, xlim=None, ylim=None): """ Get a matplotlib plot showing the DOS. Args: xlim: Specifies the x-axis limits. Set to None for automatic determination. ylim: Specifies the y-axis limits. """ ncolors = max(3, len(self._doses...
Get the data nicely formatted for a plot
def bs_plot_data(self, zero_to_efermi=True): """ Get the data nicely formatted for a plot Args: zero_to_efermi: Automatically subtract off the Fermi energy from the eigenvalues and plot. Returns: dict: A dictionary of the following format: ...
Get a matplotlib object for the bandstructure plot. Blue lines are up spin red lines are down spin.
def get_plot(self, zero_to_efermi=True, ylim=None, smooth=False, vbm_cbm_marker=False, smooth_tol=None): """ Get a matplotlib object for the bandstructure plot. Blue lines are up spin, red lines are down spin. Args: zero_to_efermi: Automatically subt...
Show the plot using matplotlib.
def show(self, zero_to_efermi=True, ylim=None, smooth=False, smooth_tol=None): """ Show the plot using matplotlib. Args: zero_to_efermi: Automatically subtract off the Fermi energy from the eigenvalues and plot (E-Ef). ylim: Specify the y-axi...
Save matplotlib plot to a file.
def save_plot(self, filename, img_format="eps", ylim=None, zero_to_efermi=True, smooth=False): """ Save matplotlib plot to a file. Args: filename: Filename to write to. img_format: Image format to use. Defaults to EPS. ylim: Specifies the y-...
plot two band structure for comparison. One is in red the other in blue ( no difference in spins ). The two band structures need to be defined on the same symmetry lines! and the distance between symmetry lines is the one of the band structure used to build the BSPlotter
def plot_compare(self, other_plotter, legend=True): """ plot two band structure for comparison. One is in red the other in blue (no difference in spins). The two band structures need to be defined on the same symmetry lines! and the distance between symmetry lines is the one of t...
plot the Brillouin zone
def plot_brillouin(self): """ plot the Brillouin zone """ # get labels and lines labels = {} for k in self._bs.kpoints: if k.label: labels[k.label] = k.frac_coords lines = [] for b in self._bs.branches: lines.appen...
Method returning a plot composed of subplots along different elements and orbitals.
def get_projected_plots_dots(self, dictio, zero_to_efermi=True, ylim=None, vbm_cbm_marker=False): """ Method returning a plot composed of subplots along different elements and orbitals. Args: dictio: The element and orbitals you want a projec...
Method returning a plot composed of subplots along different elements
def get_elt_projected_plots(self, zero_to_efermi=True, ylim=None, vbm_cbm_marker=False): """ Method returning a plot composed of subplots along different elements Returns: a pylab object with different subfigures for each projection The bl...
returns a pylab plot object with one plot where the band structure line color depends on the character of the band ( along different elements ). Each element is associated with red green or blue and the corresponding rgb color depending on the character of the band is used. The method can only deal with binary and tern...
def get_elt_projected_plots_color(self, zero_to_efermi=True, elt_ordered=None): """ returns a pylab plot object with one plot where the band structure line color depends on the character of the band (along different elements). Each element is associa...
Method returns a plot composed of subplots for different atoms and orbitals ( subshell orbitals such as s p d and f defined by azimuthal quantum numbers l = 0 1 2 and 3 respectively or individual orbitals like px py and pz defined by magnetic quantum numbers m = - 1 1 and 0 respectively ). This is an extension of get_p...
def get_projected_plots_dots_patom_pmorb(self, dictio, dictpa, sum_atoms=None, sum_morbs=None, zero_to_efermi=True, ylim=None, vbm_cbm_marker=False, ...
utility private method to add ticks to a band structure with selected branches
def _maketicks_selected(self, plt, branches): """ utility private method to add ticks to a band structure with selected branches """ ticks = self.get_ticks() distance = [] label = [] rm_elems = [] for i in range(1, len(ticks['distance'])): if t...
Get a matplotlib plot object. Args: bs ( BandStructureSymmLine ): the bandstructure to plot. Projection data must exist for projected plots. dos ( Dos ): the Dos to plot. Projection data must exist ( i. e. CompleteDos ) for projected plots.
def get_plot(self, bs, dos=None): """ Get a matplotlib plot object. Args: bs (BandStructureSymmLine): the bandstructure to plot. Projection data must exist for projected plots. dos (Dos): the Dos to plot. Projection data must exist (i.e., ...
An RGB colored line for plotting. creation of segments based on: http:// nbviewer. ipython. org/ urls/ raw. github. com/ dpsanders/ matplotlib - examples/ master/ colorline. ipynb Args: ax: matplotlib axis k: x - axis data ( k - points ) e: y - axis data ( energies ) red: red data green: green data blue: blue data alph...
def _rgbline(ax, k, e, red, green, blue, alpha=1, linestyles="solid"): """ An RGB colored line for plotting. creation of segments based on: http://nbviewer.ipython.org/urls/raw.github.com/dpsanders/matplotlib-examples/master/colorline.ipynb Args: ax: matplotlib axis ...
Get color data including projected band structures Args: bs: Bandstructure object elements: elements ( in desired order ) for setting to blue red green bs_projection: None for no projection elements for element projection
def _get_colordata(bs, elements, bs_projection): """ Get color data, including projected band structures Args: bs: Bandstructure object elements: elements (in desired order) for setting to blue, red, green bs_projection: None for no projection, "elements" for ...
Draw an RGB triangle legend on the desired axis
def _rgb_triangle(ax, r_label, g_label, b_label, loc): """ Draw an RGB triangle legend on the desired axis """ if not loc in range(1, 11): loc = 2 from mpl_toolkits.axes_grid1.inset_locator import inset_axes inset_ax = inset_axes(ax, width=1, height=1, loc=lo...