import numpy as np import matplotlib.pyplot as plt from ase.phasediagram import PhaseDiagram from ase.db import connect from ase.io import write db = connect('hull.db') # Select the evaluated candidates and retrieve the chemical formula and mixing # energy for the phase diagram refs = [] dcts = list(db.select('relaxed=1')) for dct in dcts: refs.append((dct.formula, -dct.raw_score)) pd = PhaseDiagram(refs) ax = pd.plot( show=not True, # set to True to show plot only_label_simplices=True) plt.savefig('hull.png') # View the simplices of the convex hull simplices = [] toview = sorted(np.array(dcts)[pd.hull], key=lambda x: x.mass) for dct in toview: simplices.append(dct.toatoms()) write('hull.traj', simplices)
# creates: ktao-2d.png, ktao-3d.png import matplotlib.pyplot as plt from ase.phasediagram import PhaseDiagram references = [('K', 0), ('Ta', 0), ('O2', 0), ('K3TaO8', -16.167), ('KO2', -2.288), ('KO3', -2.239), ('Ta2O5', -19.801), ('TaO3', -8.556), ('TaO', -1.967), ('K2O', -3.076), ('K2O2', -4.257), ('KTaO3', -13.439)] pd = PhaseDiagram(references) for d in [2, 3]: pd.plot(dims=d, show=False) plt.savefig('ktao-{}d.png'.format(d))
import numpy as np from ase.phasediagram import PhaseDiagram from ase.db import connect from ase.io import write db = connect('hull.db') # Select the evaluated candidates and retrieve the chemical formula and mixing # energy for the phase diagram refs = [] dcts = list(db.select('relaxed=1')) for dct in dcts: refs.append((dct.formula, -dct.raw_score)) pd = PhaseDiagram(refs) pd.plot(only_label_simplices=True) # View the simplices of the convex hull simplices = [] toview = sorted(np.array(dcts)[pd.hull], key=lambda x: x.mass) for dct in toview: simplices.append(dct.toatoms()) write('hull.traj', simplices)
# creates: cuau.png import matplotlib.pyplot as plt from ase.phasediagram import PhaseDiagram refs = [('Cu', 0.0), ('Au', 0.0), ('CuAu2', -0.2), ('CuAu', -0.5), ('Cu2Au', -0.7)] pd = PhaseDiagram(refs) pd.plot(show=False) plt.savefig('cuau.png') print(pd.decompose('Cu3Au'))
# creates: cuau.png import matplotlib.pyplot as plt from ase.phasediagram import PhaseDiagram refs = [('Cu', 0.0), ('Au', 0.0), ('CuAu2', -0.2), ('CuAu', -0.5), ('Cu2Au', -0.7)] pd = PhaseDiagram(refs) pd.plot() plt.savefig('cuau.png') print(pd.decompose('Cu3Au'))
# creates: ktao-2d.png, ktao-3d.png import matplotlib.pyplot as plt from ase.phasediagram import PhaseDiagram references = [('K', 0), ('Ta', 0), ('O2', 0), ('K3TaO8', -16.167), ('KO2', -2.288), ('KO3', -2.239), ('Ta2O5', -19.801), ('TaO3', -8.556), ('TaO', -1.967), ('K2O', -3.076), ('K2O2', -4.257), ('KTaO3', -13.439)] pd = PhaseDiagram(references) for d in [2, 3]: pd.plot(dims=d, show=False) plt.savefig('ktao-{}d.png'.format(d))