text
stringlengths
81
112k
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 coordinates coords_are_cartesian: Set to True if you are providing coordinates in cartesian coo...
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 coordinates coords_are_cartesian: Set to True if you are providing. coordinates in cartesian coord...
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 to True if you are providing coordinates in cartesian coo...
Adds Points to a matplotlib Axes Args: points: list of coordinates lattice: Lattice object used to convert from reciprocal to cartesian coordinates coords_are_cartesian: Set to True if you are providing coordinates in cartesian coordinates. Defaults to False. Require...
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. **kwargs: provided by add_fig_kwargs decorator Returns: m...
Plots a 3D representation of the Brillouin zone of the structure. Can add to the plot paths, labels and kpoints Args: bz_lattice: Lattice object of the Brillouin zone lines: list of lists of coordinates. Each list represent a different path labels: dict containing the label as a key and...
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 obje...
Adds a dos for plotting. Args: label: label for the DOS. Must be unique. dos: Dos object def add_dos(self, label, dos): """ Adds a dos for plotting. Args: label: label for the DOS. Must be unique. ...
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. def get_plot(self, xlim=None, ylim=None): """ Get a matplotlib plot showing the DOS. Args...
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: ticks: A dict with the 'distances' at which there is a kpoi...
Get a matplotlib object for the bandstructure plot. Blue lines are up spin, red lines are down spin. Args: zero_to_efermi: Automatically subtract off the Fermi energy from the eigenvalues and plot (E-Ef). ylim: Specify the y-axis (energy) limits; by defau...
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-axis (energy) limits; by default None let the code choose. It is vbm-4 and cbm+4 if insulator ...
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-axis limits. def save_plot(self, filename, img_format="eps", ylim=None, zero_to_efermi=True, smooth=False): ...
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 Args: ...
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...
Method returning a plot composed of subplots along different elements and orbitals. Args: dictio: The element and orbitals you want a projection on. The format is {Element:[Orbitals]} for instance {'Cu':['d','s'],'O':['p']} will give projections for Cu on ...
Method returning a plot composed of subplots along different elements Returns: a pylab object with different subfigures for each projection The blue and red colors are for spin up and spin down The bigger the red or blue dot in the band structure the higher chara...
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...
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 ...
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 = [] r...
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. Returns: ...
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:...
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 Returns: def _get_colordata(bs, elements...
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 in...
Plot respect to the chemical potential of the Seebeck effective mass calculated as explained in Ref. Gibbs, Z. M. et al., Effective mass and fermi surface complexity factor from ab initio band structure calculations. npj Computational Materials 3, 8 (2017). Args: o...
Plot respect to the chemical potential of the Fermi surface complexity factor calculated as explained in Ref. Gibbs, Z. M. et al., Effective mass and fermi surface complexity factor from ab initio band structure calculations. npj Computational Materials 3, 8 (2017). A...
Plot the seebeck coefficient in function of Fermi level Args: temp: the temperature xlim: a list of min and max fermi energy by default (0, and band gap) Returns: a matplotlib object def plot_seebeck_mu(self, temp=600, output='eig', x...
Plot the conductivity in function of Fermi level. Semi-log plot Args: temp: the temperature xlim: a list of min and max fermi energy by default (0, and band gap) tau: A relaxation time in s. By default none and the plot is by units of relaxatio...
Plot the power factor in function of Fermi level. Semi-log plot Args: temp: the temperature xlim: a list of min and max fermi energy by default (0, and band gap) tau: A relaxation time in s. By default none and the plot is by units of relaxatio...
Plot the ZT in function of Fermi level. Args: temp: the temperature xlim: a list of min and max fermi energy by default (0, and band gap) tau: A relaxation time in s. By default none and the plot is by units of relaxation time Returns:...
Plot the Seebeck coefficient in function of temperature for different doping levels. Args: dopings: the default 'all' plots all the doping levels in the analyzer. Specify a list of doping levels if you want to plot only some. output: with 'average' you get ...
Plot the Power Factor in function of doping levels for different temperatures. Args: temps: the default 'all' plots all the temperatures in the analyzer. Specify a list of temperatures if you want to plot only some. output: with 'average' you get an average of the thr...
Plot the figure of merit zT in function of doping levels for different temperatures. Args: temps: the default 'all' plots all the temperatures in the analyzer. Specify a list of temperatures if you want to plot only some. output: with 'average' you get an aver...
plot dos Args: sigma: a smearing Returns: a matplotlib object def plot_dos(self, sigma=0.05): """ plot dos Args: sigma: a smearing Returns: a matplotlib object """ plotter = DosPlotter(sigma=sigma) ...
Plot the carrier concentration in function of Fermi level Args: temp: the temperature Returns: a matplotlib object def plot_carriers(self, temp=300): """ Plot the carrier concentration in function of Fermi level Args: temp: the temperature ...
Plot the Hall carrier concentration in function of Fermi level Args: temp: the temperature Returns: a matplotlib object def plot_hall_carriers(self, temp=300): """ Plot the Hall carrier concentration in function of Fermi level Args: temp: t...
Adds a COHP for plotting. Args: label: Label for the COHP. Must be unique. cohp: COHP object. def add_cohp(self, label, cohp): """ Adds a COHP for plotting. Args: label: Label for the COHP. Must be unique. cohp: COHP object. ""...
Adds a dictionary of COHPs with an optional sorting function for the keys. Args: cohp_dict: dict of the form {label: Cohp} key_sort_func: function used to sort the cohp_dict keys. def add_cohp_dict(self, cohp_dict, key_sort_func=None): """ Adds a dictionary of ...
Get a matplotlib plot showing the COHP. Args: xlim: Specifies the x-axis limits. Defaults to None for automatic determination. ylim: Specifies the y-axis limits. Defaults to None for automatic determination. plot_negative: It is common to pl...
Get dopant suggestions based on substitution probabilities. Args: structure (Structure): A pymatgen structure decorated with oxidation states. num_dopants (int): The number of suggestions to return for n- and p-type dopants. threshold (float): Probability threshold f...
Get dopant suggestions based on Shannon radii differences. Args: bonded_structure (StructureGraph): A pymatgen structure graph decorated with oxidation states. For example, generated using the CrystalNN.get_bonded_structure() method. num_dopants (int): The nummber of suggest...
Utility method to get n- and p-type dopants from a list of substitutions. def _get_dopants(substitutions, num_dopants, match_oxi_sign): """ Utility method to get n- and p-type dopants from a list of substitutions. """ n_type = [pred for pred in substitutions if pred['dopant_species'].oxi_...
Utility func to get Shannon radii for a particular coordination number. As the Shannon radii depends on charge state and coordination number, species without an entry for a particular coordination number will be skipped. Args: species_list (list): A list of Species to get the Shannon radii for...
Utility method to convert an int (less than 20) to a roman numeral. def _int_to_roman(number): """Utility method to convert an int (less than 20) to a roman numeral.""" roman_conv = [(10, "X"), (9, "IX"), (5, "V"), (4, "IV"), (1, "I")] result = [] for (arabic, roman) in roman_conv: (factor, nu...
Helper method to calculate the solid angle of a set of coords from the center. Args: center (3x1 array): Center to measure solid angle from. coords (Nx3 array): List of coords to determine solid angle. Returns: The solid angle. def solid_angle(center, coords): """ Helper m...
Calculate the volume of a tetrahedron, given the four vertices of vt1, vt2, vt3 and vt4. Args: vt1 (array-like): coordinates of vertex 1. vt2 (array-like): coordinates of vertex 2. vt3 (array-like): coordinates of vertex 3. vt4 (array-like): coordinates of vertex 4. Returns: ...
Returns the elemental parameters related to atom size and electronegativity which are used for estimating bond-valence parameters (bond length) of pairs of atoms on the basis of data provided in 'Atoms Sizes and Bond Lengths in Molecules and Crystals' (O'Keeffe & Brese, 1991). Args: el_symb...
Returns an estimate of the bond valence parameter (bond length) using the derived parameters from 'Atoms Sizes and Bond Lengths in Molecules and Crystals' (O'Keeffe & Brese, 1991). The estimate is based on two experimental parameters: r and c. The value for r is based off radius, while c is (usually) t...
Returns the neighbors of a given site using a specific neighbor-finding method. Args: struct (Structure): input structure. n (int): index of site in Structure object for which motif type is to be determined. approach (str): type of neighbor-finding approach, where ...
Returns the motif type of the site with index n in structure struct; currently featuring "tetrahedral", "octahedral", "bcc", and "cp" (close-packed: fcc and hcp) as well as "square pyramidal" and "trigonal bipyramidal". If the site is not recognized, "unrecognized" is returned. If a site should be ass...
Returns that part of the first input vector that is orthogonal to the second input vector. The output vector is not normalized. Args: vin (numpy array): first input vector uin (numpy array): second input vector def gramschmidt(vin, uin): """ Returns that par...
Returns the weighted average bond length given by Hoppe's effective coordination number formula. Args: bonds (list): list of floats that are the bond distances between a cation and its peripheral ions def calculate_weighted_avg(bonds): """ Returns the weighted average bond leng...
List of ionic radii of elements in the order of sites. def radii(self): """ List of ionic radii of elements in the order of sites. """ el = [site.species_string for site in self._structure.sites] radii_dict = dict(zip(el, self._ionic_radii)) # print radii_dict re...
List of oxidation states of elements in the order of sites. def valences(self): """ List of oxidation states of elements in the order of sites. """ el = [site.species_string for site in self._structure.sites] valence_dict = dict(zip(el, self._valences)) return valence_di...
Computes ionic radii of elements for all sites in the structure. If valence is zero, atomic radius is used. def _get_ionic_radii(self): """ Computes ionic radii of elements for all sites in the structure. If valence is zero, atomic radius is used. """ radii = [] ...
Computes ionic valences of elements for all sites in the structure. def _get_valences(self): """ Computes ionic valences of elements for all sites in the structure. """ try: bv = BVAnalyzer() self._structure = bv.get_oxi_state_decorated_structure( ...
Get coordination number, CN, of site with index n in structure. Args: structure (Structure): input structure. n (integer): index of site for which to determine CN. use_weights (boolean): flag indicating whether (True) to use weights for computing the coordina...
Get coordination number, CN, of each element bonded to site with index n in structure Args: structure (Structure): input structure n (integer): index of site for which to determine CN. use_weights (boolean): flag indicating whether (True) to use weights for c...
Get near neighbors of site with index n in structure. Args: structure (Structure): input structure. n (integer): index of site in structure for which to determine neighbors. Returns: sites (list of Site objects): near neighbors. def get_nn(self, ...
Get weight associated with each near neighbor of site with index n in structure. Args: structure (Structure): input structure. n (integer): index of site for which to determine the weights. Returns: weights (list of floats): near-neighbor weights. def get_we...
Get image location of all near neighbors of site with index n in structure. Args: structure (Structure): input structure. n (integer): index of site for which to determine the image location of near neighbors. Returns: images (list of 3D integ...
Get a listing of all neighbors for all sites in a structure Args: structure (Structure): Input structure Return: List of NN site information for each site in the structure. Each entry has the same format as `get_nn_info` def get_all_nn_info(self, structure): ...
Get a certain nearest neighbor shell for a certain site. Determines all non-backtracking paths through the neighbor network computed by `get_nn_info`. The weight is determined by multiplying the weight of the neighbor at each hop through the network. For example, a 2nd-nearest-neighbor ...
Private method for computing the neighbor shell information Args: structure (Structure) - Structure being assessed all_nn_info ([[dict]]) - Results from `get_all_nn_info` site_idx (int) - index of site for which to determine neighbor information. ...
Private convenience method for get_nn_info, gives lattice image from provided PeriodicSite and Structure. Image is defined as displacement from original site in structure to a given site. i.e. if structure has a site at (-0.1, 1.0, 0.3), then (0.9, 0, 2.3) -> jimage = (1, -1, 2). Note t...
Private convenience method for get_nn_info, gives original site index from ProvidedPeriodicSite. def _get_original_site(structure, site): """Private convenience method for get_nn_info, gives original site index from ProvidedPeriodicSite.""" for i, s in enumerate(structure): ...
Obtain a StructureGraph object using this NearNeighbor class. Requires the optional dependency networkx (pip install networkx). Args: structure: Structure object. decorate (bool): whether to annotate site properties with order parameters using neighbors deter...
Calculate those local structure order parameters for the given site whose ideal CN corresponds to the underlying motif (e.g., CN=4, then calculate the square planar, tetrahedral, see-saw-like, rectangular see-saw-like order paramters). Args: structure: Structure obje...
Gives a weighted polyhedra around a site. See ref: A Proposed Rigorous Definition of Coordination Number, M. O'Keeffe, Acta Cryst. (1979). A35, 772-775 Args: structure (Structure): structure for which to evaluate the coordination environment. n (integer)...
Get the Voronoi polyhedra for all site in a simulation cell Args: structure (Structure): Structure to be evaluated Returns: A dict of sites sharing a common Voronoi facet with the site n mapped to a directory containing statistics about the facet: - s...
Get the list of elements for a Site Args: site (Site): Site to assess Returns: [Element]: List of elements def _get_elements(self, site): """ Get the list of elements for a Site Args: site (Site): Site to assess Returns: ...
Test whether a site contains elements in the target list Args: site (Site): Site to assess targets ([Element]) List of elements Returns: (boolean) Whether this site contains a certain list of elements def _is_in_targets(self, site, targets): """ Tes...
Get the information about a certain atom from the results of a tessellation Args: structure (Structure) - Structure being assessed site_idx (int) - Index of the atom in question sites ([Site]) - List of all sites in the tessellation targets ([Element]) - Target e...
Get all near-neighbor sites as well as the associated image locations and weights of the site with index n in structure using Voronoi decomposition. Args: structure (Structure): input structure. n (integer): index of site for which to determine near-neighbor ...
Given Voronoi NNs, extract the NN info in the form needed by NearestNeighbors Args: structure (Structure): Structure being evaluated nns ([dicts]): Nearest neighbor information for a structure Returns: (list of tuples (Site, array, float)): See nn_info def _extract_...
Use Jmol algorithm to determine bond length from atomic parameters Args: el1_sym: (str) symbol of atom 1 el2_sym: (str) symbol of atom 2 Returns: (float) max bond length def get_max_bond_distance(self, el1_sym, el2_sym): """ Use Jmol algorithm to determine bond ...
Get all near-neighbor sites as well as the associated image locations and weights of the site with index n using the bond identification algorithm underlying Jmol. Args: structure (Structure): input structure. n (integer): index of site for which to determine near ...
Get all near-neighbor sites as well as the associated image locations and weights of the site with index n using the closest neighbor distance-based method. Args: structure (Structure): input structure. n (integer): index of site for which to determine near ...
Get all near-neighbor sites and weights (orders) of bonds for a given atom. :param molecule: input Molecule. :param n: index of site for which to determine near neighbors. :return: [dict] representing a neighboring site and the type of bond present between site n and the neighbo...
Obtain a MoleculeGraph object using this NearNeighbor class. Requires the optional dependency networkx (pip install networkx). Args: structure: Molecule object. decorate (bool): whether to annotate site properties with order parameters using neighbors determi...
Get a certain nearest neighbor shell for a certain site. Determines all non-backtracking paths through the neighbor network computed by `get_nn_info`. The weight is determined by multiplying the weight of the neighbor at each hop through the network. For example, a 2nd-nearest-neighbor ...
Get all near-neighbor sites and weights (orders) of bonds for a given atom. :param structure: input Molecule. :param n: index of site for which to determine near neighbors. :return: [dict] representing a neighboring site and the type of bond present between site n and the neighb...
Get all near-neighbor sites as well as the associated image locations and weights of the site with index n using the closest relative neighbor distance-based method with O'Keeffe parameters. Args: structure (Structure): input structure. n (integer): index of site for whi...
Get all near-neighbor sites as well as the associated image locations and weights of the site with index n using the closest relative neighbor distance-based method with VIRE atomic/ionic radii. Args: structure (Structure): input structure. n (integer): index of site for...
Computes trigonometric terms that are required to calculate bond orientational order parameters using internal variables. Args: thetas ([float]): polar angles of all neighbors in radians. phis ([float]): azimuth angles of all neighbors in radians. The lis...
Calculates the value of the bond orientational order parameter of weight l=2. If the function is called with non-empty lists of polar and azimuthal angles the corresponding trigonometric terms are computed afresh. Otherwise, it is expected that the compute_trigonometric_terms function ...
Calculates the value of the bond orientational order parameter of weight l=4. If the function is called with non-empty lists of polar and azimuthal angles the corresponding trigonometric terms are computed afresh. Otherwise, it is expected that the compute_trigonometric_terms function ...
Calculates the value of the bond orientational order parameter of weight l=6. If the function is called with non-empty lists of polar and azimuthal angles the corresponding trigonometric terms are computed afresh. Otherwise, it is expected that the compute_trigonometric_terms function ...
Return type of order parameter at the index provided and represented by a short string. Args: index (int): index of order parameter for which type is to be returned. Returns: str: OP type. def get_type(self, index): """ Return type of or...
Returns list of floats that represents the parameters associated with calculation of the order parameter that was defined at the index provided. Attention: the parameters do not need to equal those originally inputted because of processing out of efficiency reasons. Args...
Compute all order parameters of site n. Args: structure (Structure): input structure. n (int): index of site in input structure, for which OPs are to be calculated. Note that we do not use the sites iterator here, but directly access site...
Get all near-neighbor information. Args: structure: (Structure) pymatgen Structure n: (int) index of target site Returns: siw (list of dicts): each dictionary provides information about a single near neighbor, where key 'site' gives ac...
The main logic of the method to compute near neighbor. Args: structure: (Structure) enclosing structure object n: (int) index of target site to get NN info for length: (int) if set, will return a fixed range of CN numbers Returns: a namedtuple (NNData) o...
Get coordination number, CN, of site with index n in structure. Args: structure (Structure): input structure. n (integer): index of site for which to determine CN. use_weights (boolean): flag indicating whether (True) to use weights for computing the coordina...
An internal method to get an integral between two bounds of a unit semicircle. Used in algorithm to determine bond probabilities. Args: dist_bins: (float) list of all possible bond weights idx: (float) index of starting bond weight Returns: (float) integral o...
An internal method to get a "default" covalent/element radius Args: site: (Site) Returns: Covalent radius of element on site, or Atomic radius if unavailable def _get_default_radius(site): """ An internal method to get a "default" covalent/element radius ...
An internal method to get the expected radius for a site with oxidation state. Args: site: (Site) Returns: Oxidation-state dependent radius: ionic, covalent, or atomic. Returns 0 if no oxidation state or appropriate radius is found. def _get_radius(site): ...
Given NNData, transforms data to the specified fingerprint length Args: nndata: (NNData) length: (int) desired length of NNData def transform_to_length(nndata, length): """ Given NNData, transforms data to the specified fingerprint length Args: nndata...
Initialise a CutOffDictNN according to a preset set of cut-offs. Args: preset (str): A preset name. The list of supported presets are: - "vesta_2019": The distance cut-offs used by the VESTA visualisation program. Returns: A CutOffDictNN using...
Returns a structure in mcsqs rndstr.in format. :return (str): def to_string(self): """ Returns a structure in mcsqs rndstr.in format. :return (str): """ # define coord system, use Cartesian output = ["1.0 0.0 0.0", "0.0 1.0 0.0", ...