Beispiel #1
0
    def pourbaix_plot_data(self, limits=None):
        """
        Get data required to plot Pourbaix diagram.

        Args:
            limits: 2D list containing limits of the Pourbaix diagram
                of the form [[xlo, xhi], [ylo, yhi]]

        Returns:
            stable_entries, unstable_entries
            stable_entries: dict of lines. The keys are Pourbaix Entries, and
            lines are in the form of a list
            unstable_entries: list of unstable entries
        """

        analyzer = PourbaixAnalyzer(self._pd)
        self._analyzer = analyzer
        if limits:
            analyzer.chempot_limits = limits
        chempot_ranges = analyzer.get_chempot_range_map(limits)
        self.chempot_ranges = chempot_ranges
        stable_entries_list = collections.defaultdict(list)

        for entry in chempot_ranges:
            for line in chempot_ranges[entry]:
                x = [line.coords[0][0], line.coords[1][0]]
                y = [line.coords[0][1], line.coords[1][1]]
                coords = [x, y]
                stable_entries_list[entry].append(coords)

        unstable_entries_list = [entry for entry in self._pd.all_entries
                                 if entry not in self._pd.stable_entries]

        return stable_entries_list, unstable_entries_list
Beispiel #2
0
    def pourbaix_plot_data(self, limits=None):
        """
        Get data required to plot Pourbaix diagram.

        Args:
            limits: 2D list containing limits of the Pourbaix diagram
                of the form [[xlo, xhi], [ylo, yhi]]

        Returns:
            stable_entries, unstable_entries
            stable_entries: dict of lines. The keys are Pourbaix Entries, and
            lines are in the form of a list
            unstable_entries: list of unstable entries
        """

        analyzer = PourbaixAnalyzer(self._pd)
        self._analyzer = analyzer
        if limits:
            analyzer.chempot_limits = limits
        chempot_ranges = analyzer.get_chempot_range_map(limits)
        self.chempot_ranges = chempot_ranges
        stable_entries_list = collections.defaultdict(list)

        for entry in chempot_ranges:
            for line in chempot_ranges[entry]:
                x = [line.coords[0][0], line.coords[1][0]]
                y = [line.coords[0][1], line.coords[1][1]]
                coords = [x, y]
                stable_entries_list[entry].append(coords)

        unstable_entries_list = [entry for entry in self._pd.all_entries
                                 if entry not in self._pd.stable_entries]

        return stable_entries_list, unstable_entries_list
def pourbaix_plot_data(element1,element2,mat_co_1,limits=None):
    """
    Get stable/unstable species required to plot Pourbaix diagram.

    Args:
        limits: 2D list containing limits of the Pourbaix diagram
            of the form [[xlo, xhi], [ylo, yhi]]

    Returns:
        stable_entries, unstable_entries
        stable_entries: dict of lines. The keys are Pourbaix Entries, and
        lines are in the form of a list
        unstable_entries: list of unstable entries
    """
    entries= pd_entries(element1,element2)
    pourbaix = PourbaixDiagram(entries, {element1: mat_co_1, element2: 1- mat_co_1})
    pd = pourbaix
    analyzer = PourbaixAnalyzer(pd)
#     self._analyzer = analyzer
    if limits:
        analyzer.chempot_limits = limits
    chempot_ranges = analyzer.get_chempot_range_map(limits)
#     self.chempot_ranges = chempot_ranges
    stable_entries_list = collections.defaultdict(list)

    for entry in chempot_ranges:
        for line in chempot_ranges[entry]:
            x = [line.coords[0][0], line.coords[1][0]]
            y = [line.coords[0][1], line.coords[1][1]]
            coords = [x, y]
            stable_entries_list[entry].append(coords)

    unstable_entries_list = [entry for entry in pd.all_entries
                             if entry not in pd.stable_entries]
    stable_entries_aq = []
    stable_entries_solid = []
    for entry in entries:
    	entry_kj_per_mol = entry.energy * 96.4853
    	if entry.phase_type == "Ion":
    		stable_entries_aq.append([entry.name,entry_kj_per_mol])
    	else:
    		stable_entries_solid.append([entry.name,entry_kj_per_mol])

    return stable_entries_list, unstable_entries_list, stable_entries_aq, stable_entries_solid