GithubHelp home page GithubHelp logo

smtg-bham / doped Goto Github PK

View Code? Open in Web Editor NEW
124.0 15.0 32.0 1.91 GB

doped is a Python software for the generation, pre-/post-processing and analysis of defect supercell calculations, implementing the defect simulation workflow in an efficient, reproducible, user-friendly yet powerful and fully-customisable manner.

Home Page: https://doped.readthedocs.io

License: MIT License

Python 98.68% Jupyter Notebook 1.30% Ruby 0.02%
ab-initio computational-chemistry computational-materials-science defect-formation-energy defects dft doping fermi-level point-defects pymatgen

doped's People

Contributors

adair-nicolson avatar aronwalsh avatar brlec avatar ireaml avatar kavanase avatar sabrine-28 avatar savya10 avatar zhubonan avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

doped's Issues

JOSS review issues #1

I will ad a number of issues seen from Review by tomorrow. There are just minor issues.

In this issue, I used doped to parse my old calculations (trying to use doped to get degeneracy factors for defect densities):
CaO_bulk v_Ca_0 v_Ca_+1 v_Ca_-1 v_Ca_-2

The jupyter-notebook is found: https://github.com/yuan-gist/doped_review/blob/main/doped.ipynb

The calculations are found: the file sizes are too large, can I put on Google drive and share via email?

The issue is that it seems v_Ca_+1 is not parsed. I also tested other cases. it seems only one type charge states can be parsed.

How to generate a specific type of defect?

Hi everyone,

I'm a new user of doping. I want to generate a specific type of defect. For example, my system is a silicon crystal, and I only want to create silicon vacancy defects. I used commands like this:

from pymatgen.core.structure import Structure
from doped.generation import DefectsGenerator
from shakenbreak.input import Distortions

bulk = Structure.from_file("POSCAR")
defect_gen = DefectsGenerator(bulk)
defect_gen.defects = ({'defect_type': ['v_Si']})
Dist = Distortions(defect_gen)
defects_dict, distortion_metadata = Dist.write_vasp_files({"EDIFF": "1e-06", "ENCUT": "500", "NELM": "200", "NSW" : "1000", "LHFCALC": "False", "NUPDOWN": "-1", "LASPH": "False"})

strangely, the line "defect_gen.defects = ({'defect_type': ['v_Si']})" seems not work and it generated interstitial defects at the same time. Can you help me to solve this problem? Thanks.

standard pip installation does not work....

~/miniconda3/envs/aiida-1.0-py3/lib/python3.8/site-packages/monty/io.py in zopen(filename, *args, **kwargs)
     41     if ext in (".GZ", ".Z"):
     42         return gzip.open(filename, *args, **kwargs)
---> 43     return io.open(filename, *args, **kwargs)  # pylint: disable=R1732
     44 
     45 

FileNotFoundError: [Errno 2] No such file or directory: '/home/bonan/miniconda3/envs/aiida-1.0-py3/lib/python3.8/site-packages/doped/default_POTCARs.yaml'

I think it is because default_POTCARs.yaml is not included in the python package....

Error massage during making csv file with CompetingPhasesAnalyzer

I got this error message when using CompetingPhasesAnalyzer to generate a csv file, although the file seems to be generated successfully. In addition, it says "parsing 33 vaspruns,", but only 28 phases are listed in the csv file.

cpa.from_vaspruns(path="./PhadeDiagram/", folder="", csv_fname="STO_competing_Phase.csv"

Can't find a vasprun.xml(.gz) file for PhadeDiagram/SrAl4O7_EaH=0, proceed with caution
Can't find a vasprun.xml(.gz) file for PhadeDiagram/home, proceed with caution
Can't find a vasprun.xml(.gz) file for PhadeDiagram/Sr2Ti6O13_EaH=0, proceed with caution
Can't find a vasprun.xml(.gz) file for PhadeDiagram/Al_EaH=0.011, proceed with caution
Can't find a vasprun.xml(.gz) file for PhadeDiagram/Ti2O_EaH=0, proceed with caution
Can't find a vasprun.xml(.gz) file for PhadeDiagram/SrAl2O4_EaH=0.012, proceed with caution
Can't find a vasprun.xml(.gz) file for PhadeDiagram/Sr_EaH=0.013, proceed with caution
Can't find a vasprun.xml(.gz) file for PhadeDiagram/TiO2_EaH=0.0081, proceed with caution
Can't find a vasprun.xml(.gz) file for PhadeDiagram/.DS_Store, proceed with caution
Can't find a vasprun.xml(.gz) file for PhadeDiagram/Sr_EaH=0.0056, proceed with caution
Can't find a vasprun.xml(.gz) file for PhadeDiagram/SrO2_EaH=0.0096, proceed with caution
Can't find a vasprun.xml(.gz) file for PhadeDiagram/O2_EaH=0.0017, proceed with caution
Can't find a vasprun.xml(.gz) file for PhadeDiagram/Ti_EaH=0, proceed with caution
Can't find a vasprun.xml(.gz) file for PhadeDiagram/Ti_EaH=0.004, proceed with caution
Can't find a vasprun.xml(.gz) file for PhadeDiagram/SrO2_EaH=0, proceed with caution
Can't find a vasprun.xml(.gz) file for PhadeDiagram/SrAl2O4_EaH=0.006, proceed with caution
Can't find a vasprun.xml(.gz) file for PhadeDiagram/TiO_EaH=0, proceed with caution
Can't find a vasprun.xml(.gz) file for PhadeDiagram/SrTi11O20_EaH=0, proceed with caution
Can't find a vasprun.xml(.gz) file for PhadeDiagram/Sr_EaH=0, proceed with caution
Can't find a vasprun.xml(.gz) file for PhadeDiagram/SrAl2O4_EaH=0.019, proceed with caution
Can't find a vasprun.xml(.gz) file for PhadeDiagram/Sr_EaH=0.0064, proceed with caution
Can't find a vasprun.xml(.gz) file for PhadeDiagram/O2_EaH=0.01, proceed with caution
Can't find a vasprun.xml(.gz) file for PhadeDiagram/SrTiO3_EaH=0.00057, proceed with caution
Can't find a vasprun.xml(.gz) file for PhadeDiagram/Al_EaH=0, proceed with caution
Can't find a vasprun.xml(.gz) file for PhadeDiagram/TiO2_EaH=0, proceed with caution
Can't find a vasprun.xml(.gz) file for PhadeDiagram/SrTiO3_EaH=0.00088, proceed with caution
Can't find a vasprun.xml(.gz) file for PhadeDiagram/TiO2_EaH=0.0064, proceed with caution
Can't find a vasprun.xml(.gz) file for PhadeDiagram/Sr_EaH=0.0079, proceed with caution
Can't find a vasprun.xml(.gz) file for PhadeDiagram/O2_EaH=0, proceed with caution
Can't find a vasprun.xml(.gz) file for PhadeDiagram/SrTi3Al8O19_EaH=0, proceed with caution
Can't find a vasprun.xml(.gz) file for PhadeDiagram/SrTiO3_EaH=0, proceed with caution
Can't find a vasprun.xml(.gz) file for PhadeDiagram/SrAl2O4_EaH=0, proceed with caution
Can't find a vasprun.xml(.gz) file for PhadeDiagram/Ti2O3_EaH=0, proceed with caution
Can't find a vasprun.xml(.gz) file for PhadeDiagram/Sr3Ti2O7_EaH=0, proceed with caution
Can't find a vasprun.xml(.gz) file for PhadeDiagram/O2_EaH=0.012, proceed with caution
parsing 33 vaspruns, this may take a while

Regarding selecting a supercell

I recently used dope to generate defects for a system and noticed that it didn't use the same supercell the second time around for the same system and the exact same input structure.

Do you know why this can happen since this would restrict the reproducibility of results?

non-default POTCAR causing total NELECT to be incorrect

Recent change to select which POTCAR is generated for each element when writing vasp_gam, vasp_std files using the argument:

potcar_settings={"POTCAR": {"Sn": "Sn"}}

when the default POTCAR for Sn is Sn_d. However, the total NELECT generated in the INCAR is calculated from the valence electrons from the default POTCAR, while the updated POTCAR is copied to POTCAR file. So I think the POTCAR implementation needs to come before the determination of NELECT.

I confirmed this by running a simple bash script to calculate the number of electrons in the system from POSCAR and POTCAR:

species+=($(head -6 POSCAR | tail -1))
numbers+=($(head -7 POSCAR | tail -1))
electrons+=($(grep ZVAL POTCAR | awk '{print $6/1}'))
list=$(echo ${#numbers[@]} -1 | bc)

for i in $(seq 0 $list); do
       sum[$i]+=$(echo "${numbers[$i]} * ${electrons[$i]}" | bc)
done

for j in ${sum[@]}; do
       let tot+=$j
done
echo "electrons = ${tot}"

which returns a different value (by a couple hundred electrons...) to the value of NELECT that doped writes to the INCAR.

I noticed this was an issue because all of my calculations (at gamma point) were returning hugely positive energies!!

Cheers

How to generate a specific type of defect?

Hi everyone,

I'm a new user of doped. I want to generate a specific type of defect. For example, my system is a silicon crystal, and I only want to create silicon vacancy defects. I used commands like this:

from pymatgen.core.structure import Structure
from doped.generation import DefectsGenerator
from shakenbreak.input import Distortions

bulk = Structure.from_file("POSCAR")
defect_gen = DefectsGenerator(bulk)
defect_gen.defects = ({'defect_type': ['v_Si']})
Dist = Distortions(defect_gen)
defects_dict, distortion_metadata = Dist.write_vasp_files({"EDIFF": "1e-06", "ENCUT": "500", "NELM": "200", "NSW" : "1000", "LHFCALC": "False", "NUPDOWN": "-1", "LASPH": "False"})

strangely, the line "defect_gen.defects = ({'defect_type': ['v_Si']})" seems not work and it generated interstitial defects at the same time. Can you help me to solve this problem? Thanks.

`DOPED` doesn't set `NBANDS` (?)

RE: my post in the #defects channel on the SMTG slack, I noticed a significant performance drop between calculations of the same defect in different charge state. This was due to different values of NBANDS being used, which in turn affects the parallelisation, in this case quite significantly (LOOP times roughly an order of magnitude larger).

Is there anyway of implementing into the input file generation step a check for choosing a sensible number for NBANDS? Or at least flash up a big warning or something ๐Ÿ˜ฌ Even in the comment line at the top of the INCAR, NBANDS isn't specified as a variable parameter, i.e. something you should check for each system.

Hope this is helpful!

Joe

Point defect generation in ternary alloy

I am currently trying to generate point defects in a Zn_108Se_27Te_81 alloy using a 3x3x3 supercell configuration of the zinc blende crystal structure, which comprises a total of 216 atoms. However, the output from the doped has been unexpected and appears to deviate from anticipated results.

Based on the output data, it seems there may be a considerable number of non-equivalent defect sites within the structure, which could be influencing the behavior of the DefectGeneration class, triggering unexpected results. This observation suggests potential issues in the symmetry or initial configuration of the supercell that may need to be addressed.

Could you please review the attached file and provide your insights on whether the presence of these non-equivalent defect sites might be affecting the doped outcomes? Your expertise in this area would be invaluable in diagnosing and resolving this issue.

Also, I would suggest

  1. Refactoring respective Class capable of adaptively placing defects based on the local atomic environment, rather than a uniform approach. This would allow the class to manage non-equivalent sites more effectively by adjusting the defect characteristics to match the unique aspects of each site.

  2. Consider implementing machine learning (https://github.com/materialsvirtuallab/matgl) techniques to quickly identify the equivalent sites and high energy defects

Thank you for your assistance.

Best regards,
Habibur

POSCAR.zip
file.zip

pymatgen compatibiilty issue

When I tried to get phase diagram using
cpa.calculate_chempots()

I am getting error:

ValueError Traceback (most recent call last)
/tmp/ipykernel_623835/2503364578.py in
----> 1 cpa.calculate_chempots()

~/Downloads/cplap/doped/doped/competing_phases.py in calculate_chempots(self, csv_fname)
393 # presumably checks if the phase is intrinsic
394 if set(Composition(d['formula']).elements).issubset(self.bulk_composition.elements):
--> 395 pd_entries_intrinsic.append(e)
396 if e.composition == self.bulk_composition:
397 self.bulk_pde = e

~/Downloads/anaconda3/lib/python3.9/site-packages/pymatgen/analysis/phase_diagram.py in init(self, entries, elements, computed_data)
357 self.entries = entries
358 if computed_data is None:
--> 359 computed_data = self._compute()
360 else:
361 computed_data = MontyDecoder().process_decoded(computed_data)

~/Downloads/anaconda3/lib/python3.9/site-packages/pymatgen/analysis/phase_diagram.py in _compute(self)
421 if len(el_refs) != dim:
422 missing = set(elements).difference(el_refs.keys())
--> 423 raise ValueError(f"There are no entries for the terminal elements: {missing}")
424
425 data = np.array(

ValueError: There are no entries for the terminal elements: {Element O, Element La, Element Mn}

Feature request: Support versions of spglib above 2.0.2

Right now, I can't install the most recent versions of doped and phonopy due to an incompatibility with spglib:

pip install doped==2.4.2 phonopy==2.33.1
ERROR: Cannot install doped==2.4.2 and phonopy==2.23.1 because these package versions have conflicting dependencies.

The conflict is caused by:
    doped 2.4.2 depends on spglib<=2.0.2
    phonopy 2.23.1 depends on spglib>=2.3

To fix this you could try to:
1. loosen the range of package versions you've specified
2. remove package versions to allow pip attempt to solve the dependency conflict

So, this issue report is simply a feature request to support newer versions of spglib. I actually got this error when trying to install shakenbreak==3.3.3 and phonopy==2.33.1, which then downgraded doped to such a degree that much of my code was not working anymore.

Extrinsic Competing Phases error

Why am I getting error while generating competing phase diagram with external impurity?
In material project there is an entry Cs2CuBiI6

x_cp = ExtrinsicCompetingPhases(composition="Cs3Cu3I5", extrinsic_species="Bi", e_above_hull=0.03)
You are using the legacy MPRester. This version of the MPRester will no longer be updated. To access the latest data with the new MPRester, obtain a new API key from https://materialsproject.org/api and consult the docs at https://docs.materialsproject.org/ for more information.
Traceback (most recent call last):
File "", line 1, in
File "/scratch/aaa/miniconda3/lib/python3.12/site-packages/doped/chemical_potentials.py", line 810, in init
super().init(composition, e_above_hull, api_key)
File "/scratch/aaa/miniconda3/lib/python3.12/site-packages/doped/chemical_potentials.py", line 444, in init
bulk_ce = bulk_entries[0] # lowest energy entry for bulk composition (after sorting)
~~~~~~~~~~~~^^^
IndexError: list index out of range

Seeking Assistance with Errors in Example Run

Hello,

I seem to have encountered some errors while running an example. Could you please advise on how to proceed?

Traceback (most recent call last):
File "/public/home/jyan/test.py", line 8, in
cp = CompetingPhases("ZrO2")
^^^^^^^^^^^^^^^^^^^^^^^
File "/public/home/jyan/anaconda3/lib/python3.11/site-packages/doped/chemical_potentials.py", line 395, in init
self.MP_full_pd_entries = mpr.get_entries_in_chemsys(
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/public/home/jyan/anaconda3/lib/python3.11/site-packages/mp_api/client/mprester.py", line 1192, in get_entries_in_chemsys
self.get_entries(
File "/public/home/jyan/anaconda3/lib/python3.11/site-packages/mp_api/client/mprester.py", line 759, in get_entries
doc.model_dump()[property] # type: ignore
~~~~~~~~~~~~~~~~^^^^^^^^^^
KeyError: 'pretty_formula'

Thank you for your time and assistance.

Repository size seems to be very large?

I tried to clone the repository for development but it takes a long time with git reporting receiving over 1GB worth of objects and du -sh reports a directory size of 1.6 GB.

This is probably due to the large files? I had the impression that the size of the repo is not easy to reduce retrospectively without messing up the commit history. But it may be worth keeping it growing further? It may be useful to move large examples files into dedicated repositories.

Multiprocessing slows defect input writing on M1 Mac

The default multiprocessing options actually slow down input set writing on my M1 Max Mac.

Setup

from pymatgen.core import Structure
from doped.generation import DefectsGenerator
from doped.vasp import DefectsSet

prim = Structure.from_file("prim.vasp")
defect_gen = DefectsGenerator(prim)
defect_set = DefectsSet(defect_gen, soc=False)

Writing with multiprocessing

defect_set.write_files("defects", unperturbed_poscar=True)

Time taken: 5 minutes 1 second

Writing without multiprocessing

# same as before...
defect_set.write_files("defects", unperturbed_poscar=True, processes=1)

Time taken: 14 seconds

Fix

Using multiple threads instead of multiple processes seems to fix the issue.

from multiprocessing.pool import ThreadPool as Pool

Time taken: 13 seconds

However, the timing doesn't substantially improve on no multiprocessing.

unable to calculate the chemical potential ranges for extrinsic dopant

Hello.
I have been trying to dope CsPbI3 with Sn at the B-site. I have generated the competing phases with doped using e_above_hull = 0, which resulted in ['Sn', 'SnI4', 'Cs2SnI6']. After relaxing the structures, and trying to parse the data if I put only Cs2SnI6_EaH_0, Sn_EaH_0 and SnI4_EaH_0 in the competing_phases folder, the code asks for the relaxation data of the parent bulk phase as:
"Could not find bulk phase for CsPbI3 in the supplied data. Found phases: []"
However, if i put the vasp relaxtion result of CsPbI3_bulk into the competing_phases folder, this error occurs:

``---------------------------------------------------------------------------
KeyError Traceback (most recent call last)
Cell In[2], line 2
1 cpa = CompetingPhasesAnalyzer("CsPbI3", extrinsic_species = "Sn")
----> 2 cpa.from_vaspruns(path='./competing_phases/',
3 folder = "vasp_std",
4 csv_fname = "./competing_phases/cspbi3_Sn_doped_energies.csv")
5 df= cpa.calculate_chempots (csv_fname = "./competing_phases/cspbi3_Sn_chempots.csv")

File ~/miniconda3/lib/python3.11/site-packages/doped/chemical_potentials.py:1199, in CompetingPhasesAnalyzer.from_vaspruns(self, path, folder, csv_fname)
1190 d = {
1191 "formula": v["pretty_formula"],
1192 "kpoints": kpoints,
(...)
1195 "energy": final_energy,
1196 }
1197 temp_data.append(d)
-> 1199 formation_energy_df = _calculate_formation_energies(temp_data, self.elemental_energies)
1200 if csv_fname is not None:
1201 formation_energy_df.to_csv(csv_fname, index=False)

File ~/miniconda3/lib/python3.11/site-packages/doped/chemical_potentials.py:181, in _calculate_formation_energies(data, elemental)
179 for d in data:
180 for e in elemental:
--> 181 d[e] = Composition(d["formula"]).as_dict()[e]
183 formation_energy_df = pd.DataFrame(data)
184 formation_energy_df["formation_energy"] = formation_energy_df["energy_per_fu"]

KeyError: 'Sn'

I would like to ask how to solve this issue.
Thank you.

Add support for dumbbell/split interstitials

Are there any plans to support split interstitial generation? Maybe this is already supported with some advanced configuration but it was not obvious to me from the defect generation tutorial.

Degeneracy factor for organic-inorganic systems

Copying this email exchange for reference.

Dear prof. Sean Kavanagh,
Could you please tell me if the doped program can be used for organic-inorganic hybrid systems, for instance, the hybrid CH3NH3PbI3? Recently, I want to use doped to calculate the impact of hydrogen vacanciescarrier non-radiative recombination. The hydrogen vacancy was created by removing the hydrogen atom on nitrogen atom VH(N). I tried to use doped to generate the defective configuration with VH(N) and obtained the degeneracy factor, but I'm not sure if the output is correct (g=8).
Looking forward for you replying. Wish you have a nice day!!!

Sincerely
Wencai Zhou

(Not sure if this is @WencaiZhou)

image

Hi Wencai,
Yes doped can be used for organic-inorganic hybrid systems and yes there is no reason the degeneracy factor would not be correct in this case (we have tested this functionality extensively) โ€“ for the given, static, host supercell.
However, in the organic-inorganic hybrid systems at room temperature you also have molecular rotations I believe (Iโ€™m not so familiar with these systems), and so this would affect the effective symmetry and thus degeneracy at elevated temperatures.

If you have questions about doped, please post on the GitHub Issues page rather than emailing directly.

Best,
Seรกn

pymatgen API update breaks DefectsGenerator

Hello,

I am using Python 3.11, doped 2.4.1, and pymatgen 2024.5.1.

I was following the Defects Generation tutorial, but instantiating a DefectsGenerator object fails.
This occurs due to a breaking change in pymatgen's API (not sure when it was introduced), which updated the Lattice.get_points_in_sphere() function to return a Tuple instead of a List. When the doped.utils.supercells.get_min_image_distance() function is called, the .sort() called in Line 80 of supercells.py fails because Tuple has no sort() function.

Potentials fixes:

  1. Update doped.utils.supercells.get_min_image_distance() to use Lattice.get_points_in_sphere_old(), but there's no guarantee for how long pymatgen will retain the old version of the function.
  2. Change the .sort() in line 80 of supercells.py to use sorted() instead.
  3. Change the tuple returned by Lattice.get_points_in_sphere() to a list using list().

Thanks!

Issue in graphing Intrinsic interstitial defects

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

Mismatched atomic order causing incorrect kumagai corrections

l have been trying to track down a change of results after upgrading doped from an older version (Apil 2022). The results from the kumagai correction are different from before, and I have found this is due to the incorrect site_maching_indices extract.

The problem is down to the fact that the bulk structure and the defect structure appears to have different ordering of the species. In particular, the bulk structure has Al O Sb while the defects generated has Al Sb O. This change is due to the use of MPRelaxSet when preparing the input structure, which includes a standardisation step that may change the ordering of species.

In the old version, the initial_defect_structure was used for the kumagai and I had it as the "unrelaxed defect structure". However, in the more recent version the unrelaxed_defect_structure takes the precedence. It is generated from the bulk structure, but as I mentioned above, it can have a different ordering of the atoms compared to that used in the actual calculation. Hence, this generates an incorrect site_maching_indices needed for kumagai. More confusingly, the kumagai_loader saves this structure as initial_defect_structure.

A few solutions to this issue:

  1. Do we really need to use the MPRelaxSet? It reorders the structure, which is OK for database building but perhaps not so for defect calculations. My suggestion is to get rid of it or at least have our own implementation that does a similar thing.
  2. A warning should be printed if the bulk and the defect have different species orderings.
  3. The site matching for kumagai (matching between the bulk and the defect) should be performed using the actual defect structure used in the calculation initial_defect_structure, rather than the unrelaxed_defect_structure. But this should be really be resolved by guaranteeing the defect structure calculated is really the one that is generated with the same ordering (solving 1).

Parsing issues

Hi, thank you for developing such tool. When I wanted to parse the output, it was throwing out this error messages
Screenshot 2024-04-19 at 4 32 18 PM
This is my script to parse the output....

from doped.analysis import DefectsParser

dielectric = 8.99 # dielectric constant (this can be a single number (isotropic), or a 3x1 array or 3x3 matrix (anisotropic))
bulk_path='/depot/amannodi/data/Benji_Sabria_Calculations_Folder/Sabria/CdTe/Ground_State_POSCAR/bulk/vasp_std'
dp = DefectsParser('/depot/amannodi/data/Benji_Sabria_Calculations_Folder/Sabria/CdTe/Ground_State_POSCAR/', dielectric=dielectric) # dielectric needed for charge corrections

Under '/depot/amannodi/data/Benji_Sabria_Calculations_Folder/Sabria/CdTe/Ground_State_POSCAR/', I have bunch of defect folders
Screenshot 2024-04-19 at 4 35 52 PM

Pymatgen PR: Fix DefectPhaseDiagram entries setup

Easier to put this here rather than on ToDo.md, so I can attach a screenshot of the problem. Noticed this issue before but forgot.

The setup of the stable_entries, entries etc properties for DefectPhaseDiagram objects is incorrect, and also unnecessarily inconsistent (some are sets, some are lists, some are dicts?).

For example, with this defect there are 4 stable charge states:
image

But also many (7) metastable states:
image

As shown in the example screenshot below, some of the 'entries' properties are just wrong. Likely a relatively simple processing issue in the pymatgen DefectPhaseDiagram code.
image

error in ExtrinsicCompetingPhases module

Dear Team,
I get below error when running an example calculation:
Do you know how to resolve this error?

from doped.chemical_potentials import ExtrinsicCompetingPhases
ex_cp = ExtrinsicCompetingPhases(composition="ZrO2", extrinsic_species="La", e_above_hull=0.03)

The 'inc_structure' argument is deprecated as structure data is now always included in all returned entry objects.
Retrieving ThermoDoc documents: 100%|โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆ| 59/59 [00:00<00:00, 558609.34it/s]
Traceback (most recent call last):
File "", line 1, in
File "/home/aaa/Downloads/miniconda3/lib/python3.11/site-packages/doped/chemical_potentials.py", line 810, in init
super().init(composition, e_above_hull, api_key)
File "/home/aaa/Downloads/miniconda3/lib/python3.11/site-packages/doped/chemical_potentials.py", line 399, in init
self.MP_full_pd_entries = mpr.get_entries_in_chemsys(
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/aaa/Downloads/miniconda3/lib/python3.11/site-packages/mp_api/client/mprester.py", line 1192, in get_entries_in_chemsys
self.get_entries(
File "/home/aaa/Downloads/miniconda3/lib/python3.11/site-packages/mp_api/client/mprester.py", line 759, in get_entries
doc.model_dump()[property] # type: ignore
~~~~~~~~~~~~~~~~^^^^^^^^^^
KeyError: 'pretty_formula'

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.