materialsproject / pymatgen

Python Materials Genomics (pymatgen) is a robust materials analysis code that defines classes for structures and molecules with support for many electronic structure codes. It powers the Materials Project.
https://pymatgen.org
Other
1.53k stars 867 forks source link

Pourbaix diagram for big supercells #2090

Closed hitarth64 closed 3 years ago

hitarth64 commented 3 years ago

Describe the bug I am trying to model an alloy with three elements (Co11-Fe11-Ru10-O64) in it. I am working with a 96 atoms supercell. Calculating the Pourbaix diagram only yields that particular compound as the stable entity across the whole pH range which doesn't make sense.

To Reproduce Steps to reproduce the behavior:

from pymatgen import MPRester
mpr = MPRester()
entries = mpr.get_pourbaix_entries(['Co','Fe','Ru'])
from pymatgen.entries.computed_entries import ComputedEntry
from pymatgen.core.composition import Composition
from pymatgen.analysis.pourbaix_diagram import PourbaixEntry
from pymatgen.analysis.pourbaix_diagram import PourbaixDiagram, PourbaixPlotter

# Energy is obtained from by performing DFT in consistency with MPRelaxSet parameters
centry = ComputedEntry(Composition('Fe11 Co11 O64 Ru10'), -606.313)
entry = PourbaixEntry(centry)
entries.append(entry)
pbx = PourbaixDiagram(entries,comp_dict={'Fe':11/32,'Co':11/32,'Ru':10/32})
print('Decomposition energy: ',pbx.get_decomposition_energy(entry,pH=0,V=1.23))
plotter = PourbaixPlotter(pbx)
plotter.get_pourbaix_plot().show()

Expected behavior Expected behavior would be to see other competing phases too. I guess there is some problem or inconsistency within pymatgen when dealing with bigger supercells. Could you help me figure out if there is a specific parameter to be taken into account?

Screenshots image

Desktop (please complete the following information):

rkingsbury commented 3 years ago

Hi @hitarth64 , make sure that the energy you use to create your extra ComputedEntry in this line

centry = ComputedEntry(Composition('Fe11 Co11 O64 Ru10'), -606.313)

is a formation energy and not a raw DFT energy. All energies supplied to PourbaixDiagram need to be free energies of formation with respect to elements. I suspect that's what is causing this material to be overstabilized relative to the others.

hitarth64 commented 3 years ago

Thanks. This helps!