Dear Doped developers.
Hello.
I have been trying to graph the defect formation energy of intrinsic interstitial defects of CsPbI3 with Doped (I generated the POSCAR files with Doped as well). However, even though all of the defect calculations are in one folder, the graph does not show them all, and also shows a wrong legend for some of the defects.
this is the code :
`from doped.analysis import DefectsParser
from doped.chemical_potentials import CompetingPhasesAnalyzer
from doped.chemical_potentials import CompetingPhases
from monty.serialization import dumpfn, loadfn
import matplotlib.colors as mcolors
from matplotlib.patches import Rectangle
import matplotlib.pyplot as plt
%matplotlib inline
''' Parsing the defects '''
dielectric = 6.4
dp = DefectsParser("./doped_intrinsic_scf/interstitial",bulk_path="./doped_pvk_vasp_largerkpts_scf/pristine",dielectric=dielectric)
''' Save the parsed defect entery to a json file '''
dumpfn(dp.defect_dict, fn=f"intrinsic_defect_dict.json")
''' Calculating the chemical potentials, and saving the competing phase energies as CSV '''
cpa = CompetingPhasesAnalyzer("CsPbI3")
cpa.from_vaspruns(path='./doped_intrinsic_competing_phases/')
cpa.from_vaspruns(path='./doped_intrinsic_competing_phases/',csv_path="./chemical_potentials/intrinsic_interstitial_competing_phase_energies.csv")
chempots = cpa.chempots
''' Saving the chemical potentials as json file '''
dumpfn(cpa.chempots, fn=f"./chemical_potentials/intrinsic_interstitial_chempots.json")
''' Calculating defect formation enrgies, transition levels and plots '''
''' Plot '''
cspbi3_thermo= dp.get_defect_thermodynamics(chempots=chempots)
plot = cspbi3_thermo.plot(limit="Pb-poor",xlim=(-1, 2.5), ylim=(-10.0, 2.0),chempot_table=False)
ax = plt.gca()
ax.set_title("")
plot.suptitle(f"Intrinsic interstitial defects of CsPbIโ",fontsize=8)
ax.set_xlabel("Fermi Level (eV)", fontsize=8)
ax.set_ylabel("Formation Energy (eV)", fontsize=8)
for spine in ax.spines.values():
spine.set_linewidth(0.5) # Set the desired line width
plot.savefig ("plots/intrinsic_interstitial_cspbi3.png", bbox_inches = 'tight')
'''Defect formation energies '''
formation_energy=cspbi3_thermo.get_formation_energies(limit="Pb-poor")
print (formation_energy)
formation_energy.to_csv("formation_energy_tables/intrinsic_interstitial_Formation_Energies_Pb_poor.csv", index=False,encoding='utf-8-sig')
''' Transition levels '''
transition_levels = cspbi3_thermo.get_transition_levels(all=True)
transition_levels.to_csv("transition_level_tables/intrinsic_interstitial_transition_levels_Pb_poor.csv", index=False,encoding='utf-8-sig')`
and these are the folders that are parsed after the code runs:
0 ./doped_intrinsic_scf/interstitial/Cs_i_C3v_+1/.
1 ./doped_intrinsic_scf/interstitial/Cs_i_C3v_0/.
2 ./doped_intrinsic_scf/interstitial/Cs_i_D4h_+1/.
3 ./doped_intrinsic_scf/interstitial/Cs_i_D4h_0/.
4 ./doped_intrinsic_scf/interstitial/Pb_i_C3v_+2/.
5 ./doped_intrinsic_scf/interstitial/Pb_i_C3v_+1/.
6 ./doped_intrinsic_scf/interstitial/Pb_i_C3v/.
7 ./doped_intrinsic_scf/interstitial/Pb_i_D4h_+2/.
8 ./doped_intrinsic_scf/interstitial/Pb_i_D4h_+1/.
9 ./doped_intrinsic_scf/interstitial/Pb_i_D4h_0/.
10 ./doped_intrinsic_scf/interstitial/I_i_C3v_+1/.
11 ./doped_intrinsic_scf/interstitial/I_i_C3v/.
12 ./doped_intrinsic_scf/interstitial/I_i_C3v_-1/.
13 ./doped_intrinsic_scf/interstitial/I_i_D4h_+1/.
14 ./doped_intrinsic_scf/interstitial/I_i_D4h/.
15 ./doped_intrinsic_scf/interstitial/I_i_D4h_-1/.
0 ./doped_intrinsic_scf/interstitial/Cs_i_C3v_+1/.
1 ./doped_intrinsic_scf/interstitial/Cs_i_C3v_0/.
2 ./doped_intrinsic_scf/interstitial/Cs_i_D4h_+1/.
3 ./doped_intrinsic_scf/interstitial/Cs_i_D4h_0/.
4 ./doped_intrinsic_scf/interstitial/Pb_i_C3v_+2/.
5 ./doped_intrinsic_scf/interstitial/Pb_i_C3v_+1/.
6 ./doped_intrinsic_scf/interstitial/Pb_i_C3v/.
7 ./doped_intrinsic_scf/interstitial/Pb_i_D4h_+2/.
8 ./doped_intrinsic_scf/interstitial/Pb_i_D4h_+1/.
9 ./doped_intrinsic_scf/interstitial/Pb_i_D4h_0/.
10 ./doped_intrinsic_scf/interstitial/I_i_C3v_+1/.
11 ./doped_intrinsic_scf/interstitial/I_i_C3v/.
12 ./doped_intrinsic_scf/interstitial/I_i_C3v_-1/.
13 ./doped_intrinsic_scf/interstitial/I_i_D4h_+1/.
14 ./doped_intrinsic_scf/interstitial/I_i_D4h/.
15 ./doped_intrinsic_scf/interstitial/I_i_D4h_-1/.
however, the final graphs lacks some of the defects or shows wrong legends. This problem does not occur if the defects are graphed separately.
![intrinsic_interstitial_cspbi3](https://private-user-images.githubusercontent.com/141133743/339286666-4736c255-67f4-422c-8b2a-59d95e3717e5.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjQxMTIwMTAsIm5iZiI6MTcyNDExMTcxMCwicGF0aCI6Ii8xNDExMzM3NDMvMzM5Mjg2NjY2LTQ3MzZjMjU1LTY3ZjQtNDIyYy04YjJhLTU5ZDk1ZTM3MTdlNS5wbmc_WC1BbXotQWxnb3JpdGhtPUFXUzQtSE1BQy1TSEEyNTYmWC1BbXotQ3JlZGVudGlhbD1BS0lBVkNPRFlMU0E1M1BRSzRaQSUyRjIwMjQwODE5JTJGdXMtZWFzdC0xJTJGczMlMkZhd3M0X3JlcXVlc3QmWC1BbXotRGF0ZT0yMDI0MDgxOVQyMzU1MTBaJlgtQW16LUV4cGlyZXM9MzAwJlgtQW16LVNpZ25hdHVyZT0yOGY5NjBiNmVmZmQyZWFhMGU4Y2ZlMGZmNmZlZmM0ZjE3MjUwMTZiNTg2ZGNiNTViMWI5MzQ2ZjVhNGExZjEwJlgtQW16LVNpZ25lZEhlYWRlcnM9aG9zdCZhY3Rvcl9pZD0wJmtleV9pZD0wJnJlcG9faWQ9MCJ9.dk-_EDrsoPL_s8gz_HACAjH0FU4ouTi1NGqv5iFwQrk)