INSTRUCTION
stringlengths
1
46.3k
RESPONSE
stringlengths
75
80.2k
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...
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 :param coordination_geometry: The coordination geometry...
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 sy...
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 sy...
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 :param coordination_geometry: The coordination geometry to be investigated :para...
def coordination_geometry_symmetry_measures_fallback_random(self, coordination_geometry, NRANDOM=10, points_perfect=None): ...
Plot the Fermi surface at specific energy value. Args: data: energy values in a 3D grid from a CUBE file via read_cube_file function, or from a BoltztrapAnalyzer.fermi_surface_data structure: structure object of the material energy_levels: list of 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 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'. Color defaults to black and linewidth to ...
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 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...
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 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'. Color defaults to green and linewidth to 3. Ret...
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 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...
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. 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...
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 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...
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. 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...
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 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...
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 obje...
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. 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. dos: Dos object """ energies = dos.energies - dos.efermi if self.zero_at_efermi \ else dos.energies ...
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: 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 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...
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. 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...
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. 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 ...
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. 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): """ 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 Args: ...
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. 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 ...
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 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...
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...
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 ...
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. Returns: ...
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:...
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 Returns:
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...
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...
def plot_seebeck_eff_mass_mu(self, temps=[300], output='average', Lambda=0.5): """ 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...
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...
def plot_complexity_factor_mu(self, temps=[300], output='average', Lambda=0.5): """ 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 compl...
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', xlim=None): """ 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: ...
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...
def plot_conductivity_mu(self, temp=600, output='eig', relaxation_time=1e-14, xlim=None): """ 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, ...
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...
def plot_power_factor_mu(self, temp=600, output='eig', relaxation_time=1e-14, xlim=None): """ 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, ...
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:...
def plot_zt_mu(self, temp=600, output='eig', relaxation_time=1e-14, xlim=None): """ 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) ta...
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 ...
def plot_seebeck_temp(self, doping='all', output='average'): """ 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 ...
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...
def plot_zt_dop(self, temps='all', output='average', relaxation_time=1e-14): """ 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 ...
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) plotter.add_dos("t", self._bz.dos) return plotter.get_plot()
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 Returns: a matplotlib object """ import matplotlib.pyplot as plt plt.semilogy(self._bz.mu_steps, ...
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: the temperature Returns: a matplotlib object """ import matplotlib.pyplot as plt hall_carriers = [abs(i) for i in ...
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. """ energies = cohp.energies - cohp.efermi if self.zero_at_efermi \ else cohp.energies populations = co...
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 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. """ if...
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...
def get_plot(self, xlim=None, ylim=None, plot_negative=None, integrated=False, invert_axes=True): """ Get a matplotlib plot showing the COHP. Args: xlim: Specifies the x-axis limits. Defaults to None for automatic determination. ylim: Sp...
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...
def get_dopants_from_substitution_probabilities(structure, num_dopants=5, threshold=0.001, match_oxi_sign=False): """ Get dopant suggestions based on substitution probabilities. Args: structure (Structur...
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...
def get_dopants_from_shannon_radii(bonded_structure, num_dopants=5, match_oxi_sign=False): """ Get dopant suggestions based on Shannon radii differences. Args: bonded_structure (StructureGraph): A pymatgen structure graph decorated with oxidation state...
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_state > pred['original_species'].oxi_state and ...
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, number) = divmod(number, arabic) result.append(roman * factor) ...
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 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. """ ...
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: ...
def vol_tetra(vt1, vt2, vt3, vt4): """ 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 (arra...
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...
def get_okeeffe_params(el_symbol): """ 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'Ke...
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...
def get_okeeffe_distance_prediction(el1, el2): """ 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 v...
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 ...
def get_neighbors_of_site_with_index(struct, n, approach="min_dist", delta=0.1, \ cutoff=10.0): """ Returns the neighbors of a given site using a specific neighbor-finding method. Args: struct (Structure): input structure. n (int): index of site in S...
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...
def site_is_of_motif_type(struct, n, approach="min_dist", delta=0.1, \ cutoff=10.0, thresh=None): """ 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 "sq...
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 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 """ vin_...
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 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 """ minimum_bond = min(bonds) ...
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 return radii_dict
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_dict
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 = [] vnn = VoronoiNN() def nearest_key(sorted_vals, key): i = bisect_left(sorted_vals, key) ...
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( self._structure) valences = bv.get_valences(self._struct...
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...
def get_cn(self, structure, n, use_weights=False): """ 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 w...
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...
def get_cn_dict(self, structure, n, use_weights=False): """ 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 (b...
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, structure, n): """ 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 ...
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_weights_of_nn_sites(self, structure, n): """ 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: ...
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...
def get_nn_images(self, structure, n): """ 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 neigh...
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 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...
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 ...
def get_nn_shell_info(self, structure, site_idx, shell): """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 h...
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. ...
def _get_nn_shell_info(self, structure, all_nn_info, site_idx, shell, _previous_steps=frozenset(), _cur_image=(0, 0, 0)): """Private method for computing the neighbor shell information Args: structure (Structure) - Structure being assessed all_nn_info ...
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...
def _get_image(structure, site): """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,...
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): if site.is_periodic_image(s): return i raise Exception('Site not found!')
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...
def get_bonded_structure(self, structure, decorate=False): """ Obtain a StructureGraph object using this NearNeighbor class. Requires the optional dependency networkx (pip install networkx). Args: structure: Structure object. decorate (bool): whether to a...
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...
def get_local_order_parameters(self, structure, n): """ 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-lik...
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)...
def get_voronoi_polyhedra(self, structure, n): """ 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 th...
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...
def get_all_voronoi_polyhedra(self, structure): """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...
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: [Element]: List of elements """ try: if isinstance(site.specie, Element): return [site.specie] ...
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): """ 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 ...
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...
def _extract_cell_info(self, structure, site_idx, sites, targets, voro, compute_adj_neighbors=False): """Get the information about a certain atom from the results of a tessellation Args: structure (Structure) - Structure being assessed site_idx (int) -...
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 ...
def get_nn_info(self, structure, n): """" 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...
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_nn_info(self, structure, nns): """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 t...
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 length from atomic parameters Args: el1_sym: (str) symbol of atom 1 el2_sym: (str) symbol of atom 2 Returns: (float) max bond length """ return sqrt( ...
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 ...
def get_nn_info(self, structure, n): """ 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 (i...
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 ...
def get_nn_info(self, structure, n): """ 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)...
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...
def get_nn_info(self, structure, n): """ 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 ty...
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...
def get_bonded_structure(self, structure, decorate=False): """ Obtain a MoleculeGraph object using this NearNeighbor class. Requires the optional dependency networkx (pip install networkx). Args: structure: Molecule object. decorate (bool): whether to ann...
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 ...
def get_nn_shell_info(self, structure, site_idx, shell): """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 h...
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...
def get_nn_info(self, structure, n): """ 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 t...
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...
def get_nn_info(self, structure, n): """ 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 ...
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...
def get_nn_info(self, structure, n): """ 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): in...
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...
def compute_trigonometric_terms(self, thetas, phis): """" 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 ([f...
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 ...
def get_q2(self, thetas=None, phis=None): """ 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 ...
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 ...
def get_q4(self, thetas=None, phis=None): """ 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 ...
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 ...
def get_q6(self, thetas=None, phis=None): """ 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 ...
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 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. """ ...
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...
def get_parameters(self, index): """ 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 ...
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...
def get_order_parameters(self, structure, n, indices_neighs=None, \ tol=0.0, target_spec=None): """ Compute all order parameters of site n. Args: structure (Structure): input structure. n (int): index of site in input structure, ...
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...
def get_nn_info(self, structure, n): """ 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...
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...
def get_cn(self, structure, n, use_weights=False): """ 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 w...
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...
def _semicircle_integral(dist_bins, idx): """ 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 startin...