Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mixing scheme fails to mix entries from the same material id even when their structures match #4261

Open
PutuB opened this issue Jan 24, 2025 · 0 comments
Labels

Comments

@PutuB
Copy link

PutuB commented Jan 24, 2025

Python version

Python 3.11.11

Pymatgen version

2025.1.23

Operating system version

No response

Current behavior

Hello, I recently tried using the MaterialsProjectDFTMixingScheme() to construct a GGA/GGA+U/R2SCAN phase diagram for Fe-O by following the code on the materials project documentation. However, I noticed that the constructed phase diagram used the mp-13-GGA entry even though mp-13-r2SCAN exists. It seems that the mixing function did not attempt to combine entries for mp-13 because its GGA and R2SCAN calculations employ different numbers of atoms in the cell:

Full Formula (Fe1)
Reduced Formula: Fe
abc   :   2.459206   2.459352   2.459570
angles: 109.469122 109.467063 109.459583
pbc   :       True       True       True
Sites (1)
  #  SP      a    b    c
---  ----  ---  ---  ---
  0  Fe      0    0    0 

Full Formula (Fe2)
Reduced Formula: Fe
abc   :   2.477813   2.477809   4.054295
angles:  90.000038  90.000320 109.469837
pbc   :       True       True       True
Sites (2)
  #  SP      a    b    c
---  ----  ---  ---  ---
  0  Fe    0.5  0.5  0.5
  1  Fe    1    1    0 

Expected Behavior

The ground state at composition Fe (mp-13) has both GGA/GGA+U and R2SCAN entries, so I expected the R2SCAN entry to replace the GGA one. I have also checked that their structures matched using StructureMatcher().fit().

Minimal example

from mp_api.client import MPRester
from pymatgen.analysis.phase_diagram import PhaseDiagram, PDPlotter
from pymatgen.entries.mixing_scheme import MaterialsProjectDFTMixingScheme

with MPRester(my_key) as mpr:

    # Obtain GGA, GGA+U, and r2SCAN ComputedStructureEntry objects
    entries = mpr.get_entries_in_chemsys(elements=["Fe", "O"], 
                                         additional_criteria={"thermo_types": ["GGA_GGA+U", "R2SCAN"]}) 
    
    # Apply corrections locally with the mixing scheme
    scheme = MaterialsProjectDFTMixingScheme()
    corrected_entries = scheme.process_entries(entries, verbose=True)
    
# Construct phase diagram
pd = PhaseDiagram(corrected_entries)
    
# Plot phase diagram
PDPlotter(pd).get_plot()

Relevant files to reproduce this bug

No response

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant