CASMcode icon indicating copy to clipboard operation
CASMcode copied to clipboard

1) Pure states are not in the hull data. 2) how can i get the ECI/multiplicity plot?

Open darjaved opened this issue 1 year ago • 5 comments

from casm.project import Project, Selection, write_eci from casm.learn import open_halloffame, open_input, checkhull, to_json import pandas import matplotlib.pyplot as plt

casm_learn_input = 'fit.json' selection = 'train'

input = open_input(casm_learn_input)

hall = open_halloffame(input["halloffame_filename"])

indiv_i = 0 checkhull(input, hall, indices=[indiv_i])

proj = Project()

indiv = hall[indiv_i] write_eci(proj, hall[0].eci, to_json(indiv_i, hall[indiv_i]))

sel = Selection(proj, selection, all=False)

comp_a = 'comp(a)' is_calculated = 'is_calculated' dft_Ef = 'formation_energy' clex_Ef = 'clex(formation_energy)' sel.query([comp_a, is_calculated, dft_Ef, clex_Ef])

df = sel.data df_calc = df[df.loc[:,is_calculated] == 1].apply(pandas.to_numeric, errors='ignore') h0 = plt.scatter(df_calc[comp_a], df_calc[dft_Ef], facecolors='none', edgecolors='b', label='dft') h0_hull = plt.plot(indiv.dft_gs[comp_a], indiv.dft_gs[dft_Ef], 'bo-', label='nolegend') h1 = plt.scatter(df_calc[comp_a], df_calc[clex_Ef], color='r', marker='.', label='clex') h1_hull = plt.plot(indiv.clex_gs[comp_a], indiv.clex_gs[clex_Ef], 'r.-', label='nolegend')

plt.xlabel(comp_a) plt.ylabel('Formation energy (eV/unit cell)')

plt.legend() plt.show() plt.savefig("hull.pdf")

darjaved avatar Oct 16 '23 11:10 darjaved

It could be that the pure states are not selected in the "train" file or not calculated.

Multiplicities can read from the "basis.json" file.

bpuchala avatar Oct 16 '23 12:10 bpuchala

I thought setting the references will add the pure states. I have done calculations not within the CASM, So, i have to calculate for the supercell of the pure states also? If i have a supercell of pure state, will that match with my prim file which has two kinds of atoms?

darjaved avatar Oct 16 '23 13:10 darjaved

Maybe I misunderstood what you mean by "pure states". I expected you meant a configuration that is an extreme composition, like if you had a binary A-B FCC prim and it was pure A or pure B. If the "pure states" that you want to use as a reference are not configurations of the prim, then you would have to add them manually in the script if you want them included in the plot.

bpuchala avatar Oct 16 '23 14:10 bpuchala

you understood right, i mean the pure A and pure B. i have given the references as casm ref --set [x,y]. but when i try to construct the convex hull, its not considering the reference states (which are pure states here).

darjaved avatar Oct 17 '23 13:10 darjaved

The reference states are not required to be a particular configuration. They can be any composition-energy pair, and so they are not included in the "train" file which that script is plotting the hull of.

You can include the reference states manually if you want, by adding them as additional data in the pandas dataframe "df_calc".

bpuchala avatar Oct 17 '23 19:10 bpuchala