INSTRUCTION
stringlengths
1
46.3k
RESPONSE
stringlengths
75
80.2k
The phase diagram is generated in a reduced dimensional space (n_elements - 1). This function returns the coordinates in that space. These coordinates are compatible with the stored simplex objects.
def pd_coords(self, comp): """ The phase diagram is generated in a reduced dimensional space (n_elements - 1). This function returns the coordinates in that space. These coordinates are compatible with the stored simplex objects. """ if set(comp.elements).difference(self....
Returns the formation energy for an entry (NOT normalized) from the elemental references. Args: entry: A PDEntry-like object. Returns: Formation energy from the elemental references.
def get_form_energy(self, entry): """ Returns the formation energy for an entry (NOT normalized) from the elemental references. Args: entry: A PDEntry-like object. Returns: Formation energy from the elemental references. """ c = entry.com...
Get any facet that a composition falls into. Cached so successive calls at same composition are fast.
def _get_facet_and_simplex(self, comp): """ Get any facet that a composition falls into. Cached so successive calls at same composition are fast. """ c = self.pd_coords(comp) for f, s in zip(self.facets, self.simplexes): if s.in_simplex(c, PhaseDiagram.numeric...
Calculates the chemical potentials for each element within a facet. Args: facet: Facet of the phase diagram. Returns: { element: chempot } for all elements in the phase diagram.
def _get_facet_chempots(self, facet): """ Calculates the chemical potentials for each element within a facet. Args: facet: Facet of the phase diagram. Returns: { element: chempot } for all elements in the phase diagram. """ complist = [self.qhull...
Provides the decomposition at a particular composition. Args: comp: A composition Returns: Decomposition as a dict of {Entry: amount}
def get_decomposition(self, comp): """ Provides the decomposition at a particular composition. Args: comp: A composition Returns: Decomposition as a dict of {Entry: amount} """ facet, simplex = self._get_facet_and_simplex(comp) decomp_amt...
Args: comp (Composition): Input composition Returns: Energy of lowest energy equilibrium at desired composition. Not normalized by atoms, i.e. E(Li4O2) = 2 * E(Li2O)
def get_hull_energy(self, comp): """ Args: comp (Composition): Input composition Returns: Energy of lowest energy equilibrium at desired composition. Not normalized by atoms, i.e. E(Li4O2) = 2 * E(Li2O) """ e = 0 for k, v in self.get_d...
Provides the decomposition and energy above convex hull for an entry. Due to caching, can be much faster if entries with the same composition are processed together. Args: entry: A PDEntry like object allow_negative: Whether to allow negative e_above_hulls. Used to ...
def get_decomp_and_e_above_hull(self, entry, allow_negative=False): """ Provides the decomposition and energy above convex hull for an entry. Due to caching, can be much faster if entries with the same composition are processed together. Args: entry: A PDEntry like o...
Provides the reaction energy of a stable entry from the neighboring equilibrium stable entries (also known as the inverse distance to hull). Args: entry: A PDEntry like object Returns: Equilibrium reaction energy of entry. Stable entries should have ...
def get_equilibrium_reaction_energy(self, entry): """ Provides the reaction energy of a stable entry from the neighboring equilibrium stable entries (also known as the inverse distance to hull). Args: entry: A PDEntry like object Returns: Equilib...
Get the critical chemical potentials for an element in the Phase Diagram. Args: element: An element. Has to be in the PD in the first place. Returns: A sorted sequence of critical chemical potentials, from less negative to more negative.
def get_transition_chempots(self, element): """ Get the critical chemical potentials for an element in the Phase Diagram. Args: element: An element. Has to be in the PD in the first place. Returns: A sorted sequence of critical chemical potentials, from ...
Get the critical compositions along the tieline between two compositions. I.e. where the decomposition products change. The endpoints are also returned. Args: comp1, comp2 (Composition): compositions that define the tieline Returns: [(Composition)]: list of critic...
def get_critical_compositions(self, comp1, comp2): """ Get the critical compositions along the tieline between two compositions. I.e. where the decomposition products change. The endpoints are also returned. Args: comp1, comp2 (Composition): compositions that define t...
Provides the element evolution data for a composition. For example, can be used to analyze Li conversion voltages by varying uLi and looking at the phases formed. Also can be used to analyze O2 evolution by varying uO2. Args: element: An element. Must be in the phase diagram...
def get_element_profile(self, element, comp, comp_tol=1e-5): """ Provides the element evolution data for a composition. For example, can be used to analyze Li conversion voltages by varying uLi and looking at the phases formed. Also can be used to analyze O2 evolution by varying ...
Returns a chemical potential range map for each stable entry. Args: elements: Sequence of elements to be considered as independent variables. E.g., if you want to show the stability ranges of all Li-Co-O phases wrt to uLi and uO, you will supply [Elem...
def get_chempot_range_map(self, elements, referenced=True, joggle=True): """ Returns a chemical potential range map for each stable entry. Args: elements: Sequence of elements to be considered as independent variables. E.g., if you want to show the stability ranges ...
returns a set of chemical potentials corresponding to the vertices of the simplex in the chemical potential phase diagram. The simplex is built using all elements in the target_composition except dep_elt. The chemical potential of dep_elt is computed from the target composition e...
def getmu_vertices_stability_phase(self, target_comp, dep_elt, tol_en=1e-2): """ returns a set of chemical potentials corresponding to the vertices of the simplex in the chemical potential phase diagram. The simplex is built using all elements in the target_composition except dep...
returns a set of chemical potentials corresponding to the max and min chemical potential of the open element for a given composition. It is quite common to have for instance a ternary oxide (e.g., ABO3) for which you want to know what are the A and B chemical potential leading to the hig...
def get_chempot_range_stability_phase(self, target_comp, open_elt): """ returns a set of chemical potentials corresponding to the max and min chemical potential of the open element for a given composition. It is quite common to have for instance a ternary oxide (e.g., ABO3) for w...
Method to transform all entries to the composition coordinate in the terminal compositions. If the entry does not fall within the space defined by the terminal compositions, they are excluded. For example, Li3PO4 is mapped into a Li2O:1.5, P2O5:0.5 composition. The terminal compositions ...
def transform_entries(self, entries, terminal_compositions): """ Method to transform all entries to the composition coordinate in the terminal compositions. If the entry does not fall within the space defined by the terminal compositions, they are excluded. For example, Li3PO4 is...
Plot data for phase diagram. 2-comp - Full hull with energies 3/4-comp - Projection into 2D or 3D Gibbs triangle. Returns: (lines, stable_entries, unstable_entries): - lines is a list of list of coordinates for lines in the PD. - stable_entries is a {coordina...
def pd_plot_data(self): """ Plot data for phase diagram. 2-comp - Full hull with energies 3/4-comp - Projection into 2D or 3D Gibbs triangle. Returns: (lines, stable_entries, unstable_entries): - lines is a list of list of coordinates for lines in the PD....
Get the CompoundPhaseDiagram object, which can then be used for plotting. Returns: (CompoundPhaseDiagram)
def get_compound_pd(self): """ Get the CompoundPhaseDiagram object, which can then be used for plotting. Returns: (CompoundPhaseDiagram) """ # For this plot, since the reactions are reported in formation # energies, we need to set the energies of the ...
Draw the element profile plot for a composition varying different chemical potential of an element. X value is the negative value of the chemical potential reference to elemental chemical potential. For example, if choose Element("Li"), X= -(µLi-µLi0), which corresponds to the voltage ve...
def plot_element_profile(self, element, comp, show_label_index=None, xlim=5): """ Draw the element profile plot for a composition varying different chemical potential of an element. X value is the negative value of the chemical potential reference to ...
Shows the plot using pylab. Usually I won't do imports in methods, but since plotting is a fairly expensive library to load and not all machines have matplotlib installed, I have done it this way.
def _get_2d_plot(self, label_stable=True, label_unstable=True, ordering=None, energy_colormap=None, vmin_mev=-60.0, vmax_mev=60.0, show_colorbar=True, process_attributes=False, plt=None): """ Shows the plot using pylab. Usually I won't do i...
Shows the plot using pylab. Usually I won"t do imports in methods, but since plotting is a fairly expensive library to load and not all machines have matplotlib installed, I have done it this way.
def _get_3d_plot(self, label_stable=True): """ Shows the plot using pylab. Usually I won"t do imports in methods, but since plotting is a fairly expensive library to load and not all machines have matplotlib installed, I have done it this way. """ import matplotlib.pyplo...
Writes the phase diagram to an image in a stream. Args: stream: stream to write to. Can be a file stream or a StringIO stream. image_format format for image. Can be any of matplotlib supported formats. Defaults to svg for best results for ...
def write_image(self, stream, image_format="svg", **kwargs): """ Writes the phase diagram to an image in a stream. Args: stream: stream to write to. Can be a file stream or a StringIO stream. image_format format for image. Can be any of ma...
Plot the chemical potential range _map. Currently works only for 3-component PDs. Args: elements: Sequence of elements to be considered as independent variables. E.g., if you want to show the stability ranges of all Li-Co-O phases wrt to uLi and uO, you will ...
def plot_chempot_range_map(self, elements, referenced=True): """ Plot the chemical potential range _map. Currently works only for 3-component PDs. Args: elements: Sequence of elements to be considered as independent variables. E.g., if you want to show the st...
Returns a plot of the chemical potential range _map. Currently works only for 3-component PDs. Args: elements: Sequence of elements to be considered as independent variables. E.g., if you want to show the stability ranges of all Li-Co-O phases wrt to uLi and ...
def get_chempot_range_map_plot(self, elements, referenced=True): """ Returns a plot of the chemical potential range _map. Currently works only for 3-component PDs. Args: elements: Sequence of elements to be considered as independent variables. E.g., if you wa...
Plot a contour phase diagram plot, where phase triangles are colored according to degree of instability by interpolation. Currently only works for 3-component phase diagrams. Returns: A matplotlib plot object.
def get_contour_pd_plot(self): """ Plot a contour phase diagram plot, where phase triangles are colored according to degree of instability by interpolation. Currently only works for 3-component phase diagrams. Returns: A matplotlib plot object. """ fr...
Returns all input files as a dict of {filename: feffio object}
def all_input(self): """ Returns all input files as a dict of {filename: feffio object} """ d = {"HEADER": self.header(), "PARAMETERS": self.tags} if "RECIPROCAL" not in self.tags: d.update({"POTENTIALS": self.potential, "ATOMS": self.atoms}) return d
Writes a set of FEFF input to a directory. Args: output_dir: Directory to output the FEFF input files make_dir_if_not_present: Set to True if you want the directory ( and the whole path) to be created if it is not present.
def write_input(self, output_dir=".", make_dir_if_not_present=True): """ Writes a set of FEFF input to a directory. Args: output_dir: Directory to output the FEFF input files make_dir_if_not_present: Set to True if you want the directory ( and the whole p...
Read in a set of FEFF input files from a directory, which is useful when existing FEFF input needs some adjustment.
def from_directory(input_dir): """ Read in a set of FEFF input files from a directory, which is useful when existing FEFF input needs some adjustment. """ sub_d = {} for fname, ftype in [("HEADER", Header), ("PARAMETERS", Tags)]: fullzpath = zpath(os.path.join...
FEFF job parameters. Returns: Tags
def tags(self): """ FEFF job parameters. Returns: Tags """ if "RECIPROCAL" in self.config_dict: if self.small_system: self.config_dict["CIF"] = "{}.cif".format( self.structure.formula.replace(" ", "")) s...
Method that compares two functions Args: f1: First function to compare f2: Second function to compare x1: Lower bound of the interval to compare x2: Upper bound of the interval to compare numpoints_check: Number of points used to compare the functions...
def function_comparison(f1, f2, x1, x2, numpoints_check=500): """ Method that compares two functions Args: f1: First function to compare f2: Second function to compare x1: Lower bound of the interval to compare x2: Upper bound of the interval to compa...
Method that creates two quarter-ellipse functions based on points xx and yy. The ellipsis is supposed to be aligned with the axes. The two ellipsis pass through the two points xx and yy. Args: xx: First point yy: Second point Returns: A dictionary with the l...
def quarter_ellipsis_functions(xx, yy): """ Method that creates two quarter-ellipse functions based on points xx and yy. The ellipsis is supposed to be aligned with the axes. The two ellipsis pass through the two points xx and yy. Args: xx: First point yy: Second...
Method that creates two (upper and lower) spline functions based on points lower_points and upper_points. Args: lower_points: Points defining the lower function. upper_points: Points defining the upper function. degree: Degree for the spline function ...
def spline_functions(lower_points, upper_points, degree=3): """ Method that creates two (upper and lower) spline functions based on points lower_points and upper_points. Args: lower_points: Points defining the lower function. upper_points: Points defining the upper f...
Method that creates two upper and lower functions based on points xx and yy as well as intercepts defined by y_x0 and x_y0. The resulting functions form kind of a distorted diamond-like structure aligned from point xx to point yy. Schematically : xx is symbolized by x, yy is symbolized by y, y_x0 ...
def diamond_functions(xx, yy, y_x0, x_y0): """ Method that creates two upper and lower functions based on points xx and yy as well as intercepts defined by y_x0 and x_y0. The resulting functions form kind of a distorted diamond-like structure aligned from point xx to point yy. Schematically : ...
Method to calculate the surface of the intersection of a rectangle (aligned with axes) and another surface defined by two functions f_lower and f_upper. Args: rectangle: Rectangle defined as : ((x1, x2), (y1, y2)). f_lower: Function defining the lower bound of the surfac...
def rectangle_surface_intersection(rectangle, f_lower, f_upper, bounds_lower=None, bounds_upper=None, check=True, numpoints_check=500): """ Method to calculate the surface of the intersection of a rectangle (aligned with axes) and another sur...
Helper method to calculate the solid angle of a set of coords from the center. Args: center: Center to measure solid angle from. coords: List of coords to determine solid angle. Returns: The solid angle.
def my_solid_angle(center, coords): """ Helper method to calculate the solid angle of a set of coords from the center. Args: center: Center to measure solid angle from. coords: List of coords to determine solid angle. Returns: The solid angle. ""...
Performs the vector multiplication of the elements of two vectors, constructing the 3x3 matrix. :param aa: One vector of size 3 :param bb: Another vector of size 3 :return: A 3x3 matrix M composed of the products of the elements of aa and bb : M_ij = aa_i * bb_j
def vectorsToMatrix(aa, bb): """ Performs the vector multiplication of the elements of two vectors, constructing the 3x3 matrix. :param aa: One vector of size 3 :param bb: Another vector of size 3 :return: A 3x3 matrix M composed of the products of the elements of aa and bb : M_ij = aa_i * bb_j...
Rotate the list of points using rotation matrix R :param coords: List of points to be rotated :param R: Rotation matrix :return: List of rotated points
def rotateCoords(coords, R): """ Rotate the list of points using rotation matrix R :param coords: List of points to be rotated :param R: Rotation matrix :return: List of rotated points """ newlist = list() for pp in coords: rpp = matrixTimesVector(R, pp) newlist.append(rp...
For a list of points given in standard coordinates (in terms of e1, e2 and e3), returns the same list expressed in the basis (uu, vv, nn), which is supposed to be orthonormal. :param uu: First vector of the basis :param vv: Second vector of the basis :param nn: Third vector of the bais :param pps: L...
def changebasis(uu, vv, nn, pps): """ For a list of points given in standard coordinates (in terms of e1, e2 and e3), returns the same list expressed in the basis (uu, vv, nn), which is supposed to be orthonormal. :param uu: First vector of the basis :param vv: Second vector of the basis :param ...
Checks if the three points p1, p2 and p3 are collinear or not within a given tolerance. The collinearity is checked by computing the area of the triangle defined by the three points p1, p2 and p3. If the area of this triangle is less than (tolerance x largest_triangle), then the three points are considered coll...
def collinear(p1, p2, p3=None, tolerance=0.25): """ Checks if the three points p1, p2 and p3 are collinear or not within a given tolerance. The collinearity is checked by computing the area of the triangle defined by the three points p1, p2 and p3. If the area of this triangle is less than (tolerance x ...
Sort a list of 2D points in anticlockwise order :param pps: List of points to be sorted :return: Sorted list of points
def anticlockwise_sort(pps): """ Sort a list of 2D points in anticlockwise order :param pps: List of points to be sorted :return: Sorted list of points """ newpps = list() angles = np.zeros(len(pps), np.float) for ipp, pp in enumerate(pps): angles[ipp] = np.arctan2(pp[1], pp[0]) ...
Returns the indices that would sort a list of 2D points in anticlockwise order :param pps: List of points to be sorted :return: Indices of the sorted list of points
def anticlockwise_sort_indices(pps): """ Returns the indices that would sort a list of 2D points in anticlockwise order :param pps: List of points to be sorted :return: Indices of the sorted list of points """ angles = np.zeros(len(pps), np.float) for ipp, pp in enumerate(pps): angle...
Checks if the separation indices of a plane are already in the list :param separation_indices: list of separation indices (three arrays of integers) :param separation_indices_list: list of the list of separation indices to be compared to :return: True if the separation indices are already in the list, False...
def separation_in_list(separation_indices, separation_indices_list): """ Checks if the separation indices of a plane are already in the list :param separation_indices: list of separation indices (three arrays of integers) :param separation_indices_list: list of the list of separation indices to be compa...
Checks if two given sites are an anion and a cation. :param valences: list of site valences :param ii: index of a site :param jj: index of another site :return: True if one site is an anion and the other is a cation (from the valences)
def is_anion_cation_bond(valences, ii, jj): """ Checks if two given sites are an anion and a cation. :param valences: list of site valences :param ii: index of a site :param jj: index of another site :return: True if one site is an anion and the other is a cation (from the valences) """ ...
Determines if point pp is in the plane within the tolerance dist_tolerance :param pp: point to be tested :param dist_tolerance: tolerance on the distance to the plane within which point pp is considered in the plane :return: True if pp is in the plane, False otherwise
def is_in_plane(self, pp, dist_tolerance): """ Determines if point pp is in the plane within the tolerance dist_tolerance :param pp: point to be tested :param dist_tolerance: tolerance on the distance to the plane within which point pp is considered in the plane :return: True if ...
Checks whether the plane is identical to one of the Planes in the plane_list list of Planes :param plane_list: List of Planes to be compared to :return: True if the plane is in the list, False otherwise
def is_in_list(self, plane_list): """ Checks whether the plane is identical to one of the Planes in the plane_list list of Planes :param plane_list: List of Planes to be compared to :return: True if the plane is in the list, False otherwise """ for plane in plane_list: ...
Returns three lists containing the indices of the points lying on one side of the plane, on the plane and on the other side of the plane. The dist_tolerance parameter controls the tolerance to which a point is considered to lie on the plane or not (distance to the plane) :param points: list of p...
def indices_separate(self, points, dist_tolerance): """ Returns three lists containing the indices of the points lying on one side of the plane, on the plane and on the other side of the plane. The dist_tolerance parameter controls the tolerance to which a point is considered to lie on t...
Computes the absolute distance from the plane to the point :param point: Point for which distance is computed :return: Distance between the plane and the point
def distance_to_point(self, point): """ Computes the absolute distance from the plane to the point :param point: Point for which distance is computed :return: Distance between the plane and the point """ return np.abs(np.dot(self.normal_vector, point) + self.d)
Computes the distances from the plane to each of the points. Positive distances are on the side of the normal of the plane while negative distances are on the other side :param points: Points for which distances are computed :return: Distances from the plane to the points (positive values on the...
def distances(self, points): """ Computes the distances from the plane to each of the points. Positive distances are on the side of the normal of the plane while negative distances are on the other side :param points: Points for which distances are computed :return: Distances fro...
Computes the distances from the plane to each of the points. Positive distances are on the side of the normal of the plane while negative distances are on the other side. Indices sorting the points from closest to furthest is also computed. :param points: Points for which distances are computed ...
def distances_indices_sorted(self, points, sign=False): """ Computes the distances from the plane to each of the points. Positive distances are on the side of the normal of the plane while negative distances are on the other side. Indices sorting the points from closest to furthest is al...
Computes the distances from the plane to each of the points. Positive distances are on the side of the normal of the plane while negative distances are on the other side. Indices sorting the points from closest to furthest is also computed. Grouped indices are also given, for which indices of the distan...
def distances_indices_groups(self, points, delta=None, delta_factor=0.05, sign=False): """ Computes the distances from the plane to each of the points. Positive distances are on the side of the normal of the plane while negative distances are on the other side. Indices sorting the points from cl...
Projects each points in the point list pps on plane and returns the list of projected points :param pps: List of points to project on plane :return: List of projected point on plane
def projectionpoints(self, pps): """ Projects each points in the point list pps on plane and returns the list of projected points :param pps: List of points to project on plane :return: List of projected point on plane """ return [pp - np.dot(pp - self.p1, self.normal_vec...
Returns a list of three orthogonal vectors, the two first being parallel to the plane and the third one is the normal vector of the plane :return: List of orthogonal vectors :raise: ValueError if all the coefficients are zero or if there is some other strange error
def orthonormal_vectors(self): """ Returns a list of three orthogonal vectors, the two first being parallel to the plane and the third one is the normal vector of the plane :return: List of orthogonal vectors :raise: ValueError if all the coefficients are zero or if there is some...
Returns a list of three orthogonal vectors, the two first being parallel to the plane and the third one is the normal vector of the plane :return: List of orthogonal vectors :raise: ValueError if all the coefficients are zero or if there is some other strange error
def orthonormal_vectors_old(self): """ Returns a list of three orthogonal vectors, the two first being parallel to the plane and the third one is the normal vector of the plane :return: List of orthogonal vectors :raise: ValueError if all the coefficients are zero or if there is ...
Projects each points in the point list pps on plane and returns the indices that would sort the list of projected points in anticlockwise order :param pps: List of points to project on plane :return: List of indices that would sort the list of projected points
def project_and_to2dim_ordered_indices(self, pps, plane_center='mean'): """ Projects each points in the point list pps on plane and returns the indices that would sort the list of projected points in anticlockwise order :param pps: List of points to project on plane :return: List...
Projects the list of points pps to the plane and changes the basis from 3D to the 2D basis of the plane :param pps: List of points to be projected :return: :raise:
def project_and_to2dim(self, pps, plane_center): """ Projects the list of points pps to the plane and changes the basis from 3D to the 2D basis of the plane :param pps: List of points to be projected :return: :raise: """ proj = self.projectionpoints(pps) [u1, u2, ...
Function to actually open a ring using OpenBabel's local opt. Given a molecule graph and a bond, convert the molecule graph into an OpenBabel molecule, remove the given bond, perform the local opt with the number of steps determined by self.steps, and then convert the resulting structure back into a molecul...
def open_ring(mol_graph, bond, opt_steps): """ Function to actually open a ring using OpenBabel's local opt. Given a molecule graph and a bond, convert the molecule graph into an OpenBabel molecule, remove the given bond, perform the local opt with the number of steps determined by self.steps, and t...
Perform one step of iterative fragmentation on a list of molecule graphs. Loop through the graphs, then loop through each graph's edges and attempt to remove that edge in order to obtain two disconnected subgraphs, aka two new fragments. If successful, check to see if the new fragments are alrea...
def _fragment_one_level(self, mol_graphs): """ Perform one step of iterative fragmentation on a list of molecule graphs. Loop through the graphs, then loop through each graph's edges and attempt to remove that edge in order to obtain two disconnected subgraphs, aka two new fragments. If ...
Having already generated all unique fragments that did not require ring opening, now we want to also obtain fragments that do require opening. We achieve this by looping through all unique fragments and opening each bond present in any ring we find. We also temporarily add the principle molecule...
def _open_all_rings(self): """ Having already generated all unique fragments that did not require ring opening, now we want to also obtain fragments that do require opening. We achieve this by looping through all unique fragments and opening each bond present in any ring we find....
Json-serializable dict representation of COHP.
def as_dict(self): """ Json-serializable dict representation of COHP. """ d = {"@module": self.__class__.__module__, "@class": self.__class__.__name__, "are_coops": self.are_coops, "efermi": self.efermi, "energies": self.energies.tolist...
Returns the COHP or ICOHP for a particular spin. Args: spin: Spin. Can be parsed as spin object, integer (-1/1) or str ("up"/"down") integrated: Return COHP (False) or ICOHP (True) Returns: Returns the CHOP or ICOHP for the input spin. If Spin is ...
def get_cohp(self, spin=None, integrated=False): """ Returns the COHP or ICOHP for a particular spin. Args: spin: Spin. Can be parsed as spin object, integer (-1/1) or str ("up"/"down") integrated: Return COHP (False) or ICOHP (True) Returns: ...
Returns the COHP for a particular energy. Args: energy: Energy to return the COHP value for.
def get_interpolated_value(self, energy, integrated=False): """ Returns the COHP for a particular energy. Args: energy: Energy to return the COHP value for. """ inter = {} for spin in self.cohp: if not integrated: inter[spin] = get...
Returns dict indicating if there are antibonding states below the Fermi level depending on the spin spin: Spin limit: -COHP smaller -limit will be considered.
def has_antibnd_states_below_efermi(self, spin=None, limit=0.01): """ Returns dict indicating if there are antibonding states below the Fermi level depending on the spin spin: Spin limit: -COHP smaller -limit will be considered. """ warnings.warn("This method has...
Returns a COHP object from a dict representation of the COHP.
def from_dict(cls, d): """ Returns a COHP object from a dict representation of the COHP. """ if "ICOHP" in d: icohp = {Spin(int(key)): np.array(val) for key, val in d["ICOHP"].items()} else: icohp = None return Cohp(d["efermi"...
Json-serializable dict representation of CompleteCohp.
def as_dict(self): """ Json-serializable dict representation of CompleteCohp. """ d = {"@module": self.__class__.__module__, "@class": self.__class__.__name__, "are_coops": self.are_coops, "efermi": self.efermi, "structure": self.struct...
Get specific COHP object. Args: label: string (for newer Lobster versions: a number) Returns: Returns the COHP object to simplify plotting
def get_cohp_by_label(self, label): """ Get specific COHP object. Args: label: string (for newer Lobster versions: a number) Returns: Returns the COHP object to simplify plotting """ if label.lower() == "average": return Cohp(efermi=s...
Returns a COHP object that includes a summed COHP divided by divisor Args: label_list: list of labels for the COHP that should be included in the summed cohp divisor: float/int, the summed cohp will be divided by this divisor Returns: Returns a COHP object including ...
def get_summed_cohp_by_label_list(self, label_list, divisor=1): """ Returns a COHP object that includes a summed COHP divided by divisor Args: label_list: list of labels for the COHP that should be included in the summed cohp divisor: float/int, the summed cohp will be d...
Returns a COHP object that includes a summed COHP divided by divisor Args: label_list: list of labels for the COHP that should be included in the summed cohp orbital_list: list of orbitals for the COHPs that should be included in the summed cohp (same order as label_list) di...
def get_summed_cohp_by_label_and_orbital_list(self, label_list, orbital_list, divisor=1): """ Returns a COHP object that includes a summed COHP divided by divisor Args: label_list: list of labels for the COHP that should be included in the summed cohp orbital_list: list ...
Get orbital-resolved COHP. Args: label: bond label (Lobster: labels as in ICOHPLIST/ICOOPLIST.lobster). orbitals: The orbitals as a label, or list or tuple of the form [(n1, orbital1), (n2, orbital2)]. Orbitals can either be str, int, or Orbital. ...
def get_orbital_resolved_cohp(self, label, orbitals): """ Get orbital-resolved COHP. Args: label: bond label (Lobster: labels as in ICOHPLIST/ICOOPLIST.lobster). orbitals: The orbitals as a label, or list or tuple of the form [(n1, orbital1), (n2, orbita...
Returns CompleteCohp object from dict representation.
def from_dict(cls, d): """ Returns CompleteCohp object from dict representation. """ cohp_dict = {} efermi = d["efermi"] energies = d["energies"] structure = Structure.from_dict(d["structure"]) if "bonds" in d.keys(): bonds = {bond: {"length": ...
Creates a CompleteCohp object from an output file of a COHP calculation. Valid formats are either LMTO (for the Stuttgart LMTO-ASA code) or LOBSTER (for the LOBSTER code). Args: cohp_file: Name of the COHP output file. Defaults to COPL for LMTO and COHPCAR.lobster/CO...
def from_file(cls, fmt, filename=None, structure_file=None, are_coops=False): """ Creates a CompleteCohp object from an output file of a COHP calculation. Valid formats are either LMTO (for the Stuttgart LMTO-ASA code) or LOBSTER (for the LOBSTER code). Args: ...
Args: spin: Spin.up or Spin.down Returns: icohpvalue (float) corresponding to chosen spin
def icohpvalue(self, spin=Spin.up): """ Args: spin: Spin.up or Spin.down Returns: icohpvalue (float) corresponding to chosen spin """ if not self.is_spin_polarized and spin == Spin.down: raise ValueError("The calculation was not performed with ...
Adds ICOHPs of both spin channels for spin polarized compounds Returns: icohp value in eV
def summed_icohp(self): """ Adds ICOHPs of both spin channels for spin polarized compounds Returns: icohp value in eV """ if self._is_spin_polarized: sum_icohp = self._icohp[Spin.down] + self._icohp[Spin.up] else: sum_icohp = self._ico...
get an icohp value for a certain bond as indicated by the label (bond labels starting by "1" as in ICOHPLIST/ICOOPLIST) Args: label: label in str format (usually the bond number in Icohplist.lobster/Icooplist.lobster summed_spin_channels: Boolean to indicate whether the ICOHPs/ICOOPs of ...
def get_icohp_by_label(self, label, summed_spin_channels=True, spin=Spin.up): """ get an icohp value for a certain bond as indicated by the label (bond labels starting by "1" as in ICOHPLIST/ICOOPLIST) Args: label: label in str format (usually the bond number in Icohplist.lobster/Ico...
get the sum of several ICOHP values that are indicated by a list of labels (labels of the bonds are the same as in ICOHPLIST/ICOOPLIST) Args: label_list: list of labels of the ICOHPs/ICOOPs that should be summed divisor: is used to divide the sum summed_spin_channels: Boolean...
def get_summed_icohp_by_label_list(self, label_list, divisor=1.0, summed_spin_channels=True, spin=Spin.up): """ get the sum of several ICOHP values that are indicated by a list of labels (labels of the bonds are the same as in ICOHPLIST/ICOOPLIST) Args: label_list: list of labels of ...
get a dict of IcohpValues corresponding to certaind bond lengths Args: minbondlength: defines the minimum of the bond lengths of the bonds maxbondlength: defines the maximum of the bond lengths of the bonds Returns: dict of IcohpValues, the keys correspond to the val...
def get_icohp_dict_by_bondlengths(self, minbondlength=0.0, maxbondlength=8.0): """ get a dict of IcohpValues corresponding to certaind bond lengths Args: minbondlength: defines the minimum of the bond lengths of the bonds maxbondlength: defines the maximum of the bond len...
get a dict of IcohpValue for a certain site (indicated by integer) Args: site: integer describing the site of interest, order as in Icohplist.lobster/Icooplist.lobster, starts at 0 minsummedicohp: float, minimal icohp/icoop of the bonds that are considered. It is the summed ICOHP value f...
def get_icohp_dict_of_site(self, site, minsummedicohp=None, maxsummedicohp=None, minbondlength=0.0, maxbondlength=8.0, only_bonds_to=None): """ get a dict of IcohpValue for a certain site (indicated by integer) Args: site: integer describing the site of...
get ICOHP/ICOOP of strongest bond Args: summed_spin_channels: Boolean to indicate whether the ICOHPs/ICOOPs of both spin channels should be summed spin: if summed_spin_channels is equal to False, this spin indicates which spin channel should be returned Returns: lowe...
def extremum_icohpvalue(self, summed_spin_channels=True, spin=Spin.up): """ get ICOHP/ICOOP of strongest bond Args: summed_spin_channels: Boolean to indicate whether the ICOHPs/ICOOPs of both spin channels should be summed spin: if summed_spin_channels is equal to False,...
Get distance between two sites. Args: other: Other site. Returns: Distance (float)
def distance(self, other): """ Get distance between two sites. Args: other: Other site. Returns: Distance (float) """ return np.linalg.norm(other.coords - self.coords)
Returns distance between the site and a point in space. Args: pt: Cartesian coordinates of point. Returns: Distance (float)
def distance_from_point(self, pt): """ Returns distance between the site and a point in space. Args: pt: Cartesian coordinates of point. Returns: Distance (float) """ return np.linalg.norm(np.array(pt) - self.coords)
String representation of species on the site.
def species_string(self): """ String representation of species on the site. """ if self.is_ordered: return list(self.species.keys())[0].__str__() else: sorted_species = sorted(self.species.keys()) return ", ".join(["{}:{:.3f}".format(sp, self.s...
True if site is an ordered site, i.e., with a single species with occupancy 1.
def is_ordered(self): """ True if site is an ordered site, i.e., with a single species with occupancy 1. """ totaloccu = self.species.num_atoms return totaloccu == 1 and len(self.species) == 1
Json-serializable dict representation for Site.
def as_dict(self): """ Json-serializable dict representation for Site. """ species_list = [] for spec, occu in self.species.items(): d = spec.as_dict() del d["@module"] del d["@class"] d["occu"] = occu species_list.appen...
Sets Lattice associated with PeriodicSite
def lattice(self, lattice): """ Sets Lattice associated with PeriodicSite """ self._lattice = lattice self._coords = self._lattice.get_cartesian_coords(self._frac_coords)
Fractional a coordinate
def coords(self, coords): """ Fractional a coordinate """ self._coords = np.array(coords) self._frac_coords = self._lattice.get_fractional_coords(self._coords)
Create Site from dict representation
def from_dict(cls, d): """ Create Site from dict representation """ atoms_n_occu = {} for sp_occu in d["species"]: if "oxidation_state" in sp_occu and Element.is_valid_symbol( sp_occu["element"]): sp = Specie.from_dict(sp_occu) ...
Fractional a coordinate
def frac_coords(self, frac_coords): """ Fractional a coordinate """ self._frac_coords = np.array(frac_coords) self._coords = self._lattice.get_cartesian_coords(self._frac_coords)
Move frac coords to within the unit cell cell.
def to_unit_cell(self, in_place=False): """ Move frac coords to within the unit cell cell. """ frac_coords = np.mod(self.frac_coords, 1) if in_place: self.frac_coords = frac_coords else: return PeriodicSite(self.species, frac_coords, self.lattice, ...
Returns True if sites are periodic images of each other. Args: other (PeriodicSite): Other site tolerance (float): Tolerance to compare fractional coordinates check_lattice (bool): Whether to check if the two sites have the same lattice. Returns: ...
def is_periodic_image(self, other, tolerance=1e-8, check_lattice=True): """ Returns True if sites are periodic images of each other. Args: other (PeriodicSite): Other site tolerance (float): Tolerance to compare fractional coordinates check_lattice (bool): Wh...
Gets distance between site and a fractional coordinate assuming periodic boundary conditions. If the index jimage of two sites atom j is not specified it selects the j image nearest to the i atom and returns the distance and jimage indices in terms of lattice vector translations. If the ...
def distance_and_image_from_frac_coords(self, fcoords, jimage=None): """ Gets distance between site and a fractional coordinate assuming periodic boundary conditions. If the index jimage of two sites atom j is not specified it selects the j image nearest to the i atom and returns...
Json-serializable dict representation of PeriodicSite. Args: verbosity (int): Verbosity level. Default of 0 only includes the matrix representation. Set to 1 for more details such as cartesian coordinates, etc.
def as_dict(self, verbosity=0): """ Json-serializable dict representation of PeriodicSite. Args: verbosity (int): Verbosity level. Default of 0 only includes the matrix representation. Set to 1 for more details such as cartesian coordinates, etc. ...
Doc string.
def get_energies(rootdir, reanalyze, verbose, detailed, sort, fmt): """ Doc string. """ if verbose: logformat = "%(relativeCreated)d msecs : %(message)s" logging.basicConfig(level=logging.INFO, format=logformat) if not detailed: drone = SimpleVaspToComputedEntryDrone(inc_str...
Calculates the powder neutron diffraction pattern for a structure. Args: structure (Structure): Input structure scaled (bool): Whether to return scaled intensities. The maximum peak is set to a value of 100. Defaults to True. Use False if you need the abs...
def get_pattern(self, structure, scaled=True, two_theta_range=(0, 90)): """ Calculates the powder neutron diffraction pattern for a structure. Args: structure (Structure): Input structure scaled (bool): Whether to return scaled intensities. The maximum pe...
Finds all symmetrically equivalent sites for a particular site Args: site (PeriodicSite): A site in the structure Returns: ([PeriodicSite]): List of all symmetrically equivalent sites.
def find_equivalent_sites(self, site): """ Finds all symmetrically equivalent sites for a particular site Args: site (PeriodicSite): A site in the structure Returns: ([PeriodicSite]): List of all symmetrically equivalent sites. """ for sites in s...
Performs actual NWCHEM2FIESTA run
def run(self): """ Performs actual NWCHEM2FIESTA run """ init_folder = os.getcwd() os.chdir(self.folder) with zopen(self.log_file, 'w') as fout: subprocess.call([self._NWCHEM2FIESTA_cmd, self._nwcheminput_fn, self._nwchemoutput_f...
Performs FIESTA (gw) run
def gw_run(self): """ Performs FIESTA (gw) run """ if self.folder != os.getcwd(): init_folder = os.getcwd() os.chdir(self.folder) with zopen(self.log_file, 'w') as fout: subprocess.call(["mpirun", "-n", str(self.mpi_procs), "fiesta", ...
:return: the number of nlm orbitals for the basis set
def set_n_nlmo(self): """ :return: the number of nlm orbitals for the basis set """ nnlmo = 0 data_tmp = self.data data_tmp.pop('lmax') data_tmp.pop('n_nlo') data_tmp.pop('preamble') for l_zeta_ng in data_tmp: l = l_zeta_ng.s...
infos on the basis set as in Fiesta log
def infos_on_basis_set(self): """ infos on the basis set as in Fiesta log """ o = [] o.append("=========================================") o.append("Reading basis set:") o.append("") o.append(" Basis set for {} atom ".format(str(self.filename))) o....
copy in the desired folder the needed auxiliary basis set "X2.ion" where X is a specie. :param auxiliary_folder: folder where the auxiliary basis sets are stored :param auxiliary_basis_set_type: type of basis set (string to be found in the extension of the file name; must be in lower case) ...
def set_auxiliary_basis_set(self, folder, auxiliary_folder, auxiliary_basis_set_type="aug_cc_pvtz"): """ copy in the desired folder the needed auxiliary basis set "X2.ion" where X is a specie. :param auxiliary_folder: folder where the auxiliary basis sets are stor...
Set parameters in cell.in for a GW computation :param nv__band: number of valence bands to correct with GW :param nc_band: number of conduction bands to correct with GW :param n_iteration: number of iteration :param n_grid and dE_grid:: number of points and spacing in eV for correlation ...
def set_GW_options(self, nv_band=10, nc_band=10, n_iteration=5, n_grid=6, dE_grid=0.5): """ Set parameters in cell.in for a GW computation :param nv__band: number of valence bands to correct with GW :param nc_band: number of conduction bands to correct with GW ...
mkdir "FULL_BSE_Densities" folder (needed for bse run) in the desired folder
def make_FULL_BSE_Densities_folder(self, folder): """ mkdir "FULL_BSE_Densities" folder (needed for bse run) in the desired folder """ if os.path.exists(folder + "/FULL_BSE_Densities"): return "FULL_BSE_Densities folder already exists" else: os.makedirs(f...
Set parameters in cell.in for a BSE computation :param nv_bse: number of valence bands :param nc_bse: number of conduction bands :param n_excitations: number of excitations :param nit_bse: number of iterations
def set_BSE_options(self, n_excitations=10, nit_bse=200): """ Set parameters in cell.in for a BSE computation :param nv_bse: number of valence bands :param nc_bse: number of conduction bands :param n_excitations: number of excitations :param nit_bse: number of iterations ...