Skip to content

Commit

Permalink
Cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
kavanase committed Jun 9, 2024
1 parent 6322bae commit 2202d84
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 146 deletions.
4 changes: 0 additions & 4 deletions doped/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -171,10 +171,6 @@ def __post_init__(self):
f"{name_wout_charge}_{'+' if self.charge_state > 0 else ''}{self.charge_state}"
)

self._bulk_entry = self.bulk_entry # for backwards compatibility
self._sc_entry = self.sc_entry # for backwards compatibility
self._defect = self.defect # for backwards compatibility

def to_json(self, filename: Optional[str] = None):
"""
Save the ``DefectEntry`` object to a json file, which can be reloaded
Expand Down
142 changes: 0 additions & 142 deletions examples/thermodynamics_tutorial.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -1584,148 +1584,6 @@
"We can then run this loop to calculate our defect/carrier concentrations over a range of temperatures and chemical potentials, and save the data to file to prevent having to re-run this parsing: "
]
},
{
"metadata": {
"ExecuteTime": {
"end_time": "2024-06-09T18:53:38.221087Z",
"start_time": "2024-06-09T18:53:38.208563Z"
}
},
"cell_type": "code",
"source": "from doped.thermodynamics import scissor_dos",
"id": "7d4a4779bc1a7618",
"outputs": [],
"execution_count": 6
},
{
"metadata": {
"ExecuteTime": {
"end_time": "2024-06-09T18:55:53.032257Z",
"start_time": "2024-06-09T18:54:44.254896Z"
}
},
"cell_type": "code",
"source": [
"from tqdm import tqdm\n",
"from monty.serialization import dumpfn\n",
"\n",
"from cProfile import Profile\n",
"from pstats import Stats\n",
"\n",
"with Profile() as pr:\n",
"\n",
" anneal_temperatures = np.linspace(300, 1400, 100) # 100 temperature datapoints from 300K to 1400K\n",
" chempot_x = np.linspace(0, 1, 100) # 100 chemical potential datapoints from X-poor to X-rich\n",
" \n",
" dict_list = []\n",
" \n",
" for x in tqdm(chempot_x):\n",
" relative_chempots = chempots_at_x(x)\n",
" for anneal_temp in anneal_temperatures:\n",
" band_gap_shift = band_gap_linear_fit(anneal_temp) - 1.5 # 1.5 eV is our DFT (and room temp) gap\n",
" fermi_level, e_conc, h_conc, conc_df = CdTe_thermo.get_quenched_fermi_level_and_concentrations(\n",
" bulk_dos_vr=fermi_dos, chempots=relative_chempots, \n",
" annealing_temperature=anneal_temp, delta_gap=band_gap_shift,\n",
" ) # Note that we now specify `chempots` rather than `limit` here!\n",
" scissored_dos = scissor_dos(delta_gap=band_gap_shift, dos=fermi_dos, verbose=False) # symmetrically-renormalised DOS -> to get the Fermi level & e/h concentrations at the annealing temperature:\n",
" annealing_fermi_level, annealing_e_conc, annealing_h_conc = CdTe_thermo.get_equilibrium_fermi_level(\n",
" bulk_dos_vr=scissored_dos, chempots=relative_chempots, temperature=anneal_temp, return_concs=True,\n",
" )\n",
" \n",
" conc_dict = {\n",
" \"annealing_fermi_level\": annealing_fermi_level,\n",
" \"annealing_e_conc\": annealing_e_conc,\n",
" \"annealing_h_conc\": annealing_h_conc,\n",
" \"fermi_level\": fermi_level,\n",
" \"e_conc\": e_conc,\n",
" \"h_conc\": h_conc,\n",
" \"conc_df\": conc_df\n",
" }\n",
" dict_list.append((x, anneal_temp, conc_dict))\n",
"\n",
"# dumpfn(dict_list, fn=\"CdTe/CdTe_2D_defect_carrier_concentrations.json\")"
],
"id": "f750dd04ea1d277a",
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
" 3%|▎ | 3/100 [01:08<36:57, 22.86s/it]\n",
"\n",
"KeyboardInterrupt\n",
"\n"
]
}
],
"execution_count": 8
},
{
"metadata": {
"ExecuteTime": {
"end_time": "2024-06-09T18:55:54.408733Z",
"start_time": "2024-06-09T18:55:54.376462Z"
}
},
"cell_type": "code",
"source": "Stats(pr).sort_stats(\"cumulative\").print_stats(20)",
"id": "837f9174928133f8",
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
" 107578078 function calls (103751126 primitive calls) in 68.515 seconds\n",
"\n",
" Ordered by: cumulative time\n",
" List reduced from 796 to 20 due to restriction <20>\n",
"\n",
" ncalls tottime percall cumtime percall filename:lineno(function)\n",
" 1110 0.006 0.000 61.463 0.055 /Users/kavanase/miniconda3/lib/python3.10/site-packages/scipy/optimize/_zeros_py.py:679(brentq)\n",
" 1110 0.026 0.000 61.455 0.055 {built-in method scipy.optimize._zeros._brentq}\n",
" 22103 0.200 0.000 61.429 0.003 /Users/kavanase/miniconda3/lib/python3.10/site-packages/scipy/optimize/_zeros_py.py:93(f_raise)\n",
" 370 0.069 0.000 49.585 0.134 /Users/kavanase/Packages/doped/doped/thermodynamics.py:1481(get_quenched_fermi_level_and_concentrations)\n",
" 22843 1.703 0.000 42.447 0.002 /Users/kavanase/Packages/doped/doped/thermodynamics.py:1147(get_equilibrium_concentrations)\n",
" 740 0.008 0.000 33.458 0.045 /Users/kavanase/Packages/doped/doped/thermodynamics.py:1344(get_equilibrium_fermi_level)\n",
" 15015 0.124 0.000 33.233 0.002 /Users/kavanase/Packages/doped/doped/thermodynamics.py:1454(_get_total_q)\n",
" 7088 0.044 0.000 27.997 0.004 /Users/kavanase/Packages/doped/doped/thermodynamics.py:1752(_get_constrained_total_q)\n",
" 7458 0.145 0.000 26.717 0.004 /Users/kavanase/Packages/doped/doped/thermodynamics.py:1690(_get_constrained_concentrations)\n",
" 662437 0.941 0.000 19.803 0.000 /Users/kavanase/Packages/doped/doped/core.py:869(formation_energy)\n",
" 662437 3.657 0.000 12.665 0.000 /Users/kavanase/Packages/doped/doped/core.py:1034(equilibrium_concentration)\n",
" 662437 1.224 0.000 9.460 0.000 /Users/kavanase/Packages/doped/doped/core.py:812(_get_chempot_term)\n",
" 22842 0.264 0.000 7.161 0.000 /Users/kavanase/miniconda3/lib/python3.10/site-packages/pandas/core/frame.py:683(__init__)\n",
" 662437 0.539 0.000 5.378 0.000 /Users/kavanase/Packages/doped/doped/core.py:822(get_ediff)\n",
" 37018 0.047 0.000 4.246 0.000 /Users/kavanase/miniconda3/lib/python3.10/site-packages/pandas/core/ops/common.py:62(new_method)\n",
" 740 0.196 0.000 4.172 0.006 /Users/kavanase/Packages/doped/doped/thermodynamics.py:3039(scissor_dos)\n",
" 37018 0.055 0.000 4.151 0.000 /Users/kavanase/miniconda3/lib/python3.10/site-packages/pandas/core/series.py:6124(_arith_method)\n",
" 662437 1.920 0.000 4.024 0.000 /Users/kavanase/Packages/doped/doped/core.py:1371(_get_dft_chempots)\n",
" 37018 0.263 0.000 4.022 0.000 /Users/kavanase/miniconda3/lib/python3.10/site-packages/pandas/core/base.py:1371(_arith_method)\n",
"67590/60132 0.597 0.000 3.958 0.000 /Users/kavanase/miniconda3/lib/python3.10/site-packages/pandas/core/series.py:389(__init__)\n",
"\n",
"\n"
]
},
{
"data": {
"text/plain": [
"<pstats.Stats at 0x30cc72650>"
]
},
"execution_count": 9,
"metadata": {},
"output_type": "execute_result"
}
],
"execution_count": 9
},
{
"metadata": {},
"cell_type": "code",
"outputs": [],
"execution_count": null,
"source": "",
"id": "e03f6a6b6d5eede3"
},
{
"metadata": {},
"cell_type": "code",
Expand Down

0 comments on commit 2202d84

Please sign in to comment.