@@ -783,17 +783,22 @@ def get_entries(
783
783
784
784
def get_pourbaix_entries (
785
785
self ,
786
- chemsys : str | list ,
786
+ chemsys : str | list [ str ] | list [ ComputedEntry | ComputedStructureEntry ] ,
787
787
solid_compat = "MaterialsProject2020Compatibility" ,
788
788
use_gibbs : Literal [300 ] | None = None ,
789
789
):
790
790
"""A helper function to get all entries necessary to generate
791
791
a Pourbaix diagram from the rest interface.
792
792
793
793
Args:
794
- chemsys (str or [str]): Chemical system string comprising element
794
+ chemsys (str or [str] or Computed(Structure)Entry):
795
+ Chemical system string comprising element
795
796
symbols separated by dashes, e.g., "Li-Fe-O" or List of element
796
797
symbols, e.g., ["Li", "Fe", "O"].
798
+
799
+ Can also be a list of Computed(Structure)Entry objects to allow
800
+ for adding extra calculation data to the Pourbaix Diagram.
801
+ If this is set, the chemsys will be inferred from the entries.
797
802
solid_compat: Compatibility scheme used to pre-process solid DFT energies prior
798
803
to applying aqueous energy adjustments. May be passed as a class (e.g.
799
804
MaterialsProject2020Compatibility) or an instance
@@ -816,6 +821,27 @@ def get_pourbaix_entries(
816
821
)
817
822
from pymatgen .entries .computed_entries import ComputedEntry
818
823
824
+ thermo_types = ["GGA_GGA+U" ]
825
+ user_entries : list [ComputedEntry | ComputedStructureEntry ] = []
826
+ if isinstance (chemsys , list ) and all (
827
+ isinstance (v , ComputedEntry | ComputedStructureEntry ) for v in chemsys
828
+ ):
829
+ user_entries = [ce .copy () for ce in chemsys ]
830
+
831
+ elements = set ()
832
+ for entry in user_entries :
833
+ elements .update (entry .elements )
834
+ chemsys = [ele .name for ele in elements ]
835
+
836
+ user_run_types = set (
837
+ [
838
+ entry .parameters .get ("run_type" , "unknown" ).lower ()
839
+ for entry in user_entries
840
+ ]
841
+ )
842
+ if any ("r2scan" in rt for rt in user_run_types ):
843
+ thermo_types = ["GGA_GGA+U_R2SCAN" ]
844
+
819
845
if solid_compat == "MaterialsProjectCompatibility" :
820
846
solid_compat = MaterialsProjectCompatibility ()
821
847
elif solid_compat == "MaterialsProject2020Compatibility" :
@@ -851,9 +877,13 @@ def get_pourbaix_entries(
851
877
# TODO - would be great if the commented line below would work
852
878
# However for some reason you cannot process GibbsComputedStructureEntry with
853
879
# MaterialsProjectAqueousCompatibility
854
- ion_ref_entries = self .get_entries_in_chemsys (
855
- list ([str (e ) for e in ion_ref_elts ] + ["O" , "H" ]),
856
- # use_gibbs=use_gibbs
880
+ ion_ref_entries = (
881
+ self .get_entries_in_chemsys (
882
+ list ([str (e ) for e in ion_ref_elts ] + ["O" , "H" ]),
883
+ additional_criteria = {"thermo_types" : thermo_types }
884
+ # use_gibbs=use_gibbs
885
+ )
886
+ + user_entries
857
887
)
858
888
859
889
# suppress the warning about supplying the required energies; they will be calculated from the
0 commit comments