-
Notifications
You must be signed in to change notification settings - Fork 864
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update FermiDos.get_doping()
to be more robust
#3879
Conversation
Thanks @kavanase, happy to merge this once the tests are updated. Really appreciate the detailed issue description. |
If I understand correctly, this does not fix the issue of the inaccurate CBM itself however? |
Hi @mkhorton, yes this doesn't fix the issue of the inaccurate CBM, but just makes the calculation of doping concentrations essentially independent of any inaccuracies in the CBM/VBM from the DOS. I've dug into this a bit more to see where this comes from. The main issue seems to be that the default occupation tolerance in the DOS methods of 1e-3 (c.f. 1e-8 for I would suggest updating the default tolerance for this to 1e-4 in that case, as it should be more accurate and also is closer to the behaviour of the Also just to note this currently passes all tests, there were just one or two random failures due to issues with the API key for Materials Project tests |
…n` DOS parsing docstrings
Just to note, this rounding to 4 decimal places by VASP is also why |
…htly faster, cleaner and no masking required to avoid overflow warnings
…matgen#3879) so `pymatgen` version constraint not required
…n` DOS parsing docstrings
…htly faster, cleaner and no masking required to avoid overflow warnings
e3fbc67
to
41e6d99
Compare
Signed-off-by: Seán Kavanagh <[email protected]>
Just bumping so it doesn't get lost, I think this PR is all ready to go. |
All tests passing, but I'm not sure why the |
sorry for keeping you waiting and repeatedly addressing merge conflicts @kavanase! could you resolve the conflict one more time and then i'll merge? |
Merge conflict resolved! Just to note about this point I mentioned above:
I looked into this, and it seems to be an issue with the line endings. On the current
So in this PR, those 3
|
FermiDos.get_doping
performs an integral over the density of states with the Fermi Dirac occupations to determine the carrier concentrations. However, it starts the conduction band integral (cb_integral
) fromself.idx_cbm
and vice versa withself.idx_vbm
for the valence band integral.But, these attributes are determined upon initialisation with
self.get_cbm_vbm()
(https://github.com/materialsproject/pymatgen/blob/master/pymatgen/electronic_structure/dos.py#L427), where (1) the user cannot control the occupation tolerance settings forget_cbm_vbm()
(as they can when otherwise calling this function), and (2) even when tuning these settings the VBM/CBM/gap is often not correct. E.g. for CdTe with a band gap of 1.497 eV (as given by the VASPEIGENVAL
andvasprun.xml
outputs, andVasprun.eigenvalue_band_properties
), this gives a different result of 1.58 eV, mainly due to the disperse CBM and the way this is estimated from the DOS inget_cbm_vbm()
:In this PR, the integrals are adjusted to start from the mid-gap position (intermediate between
idx_vbm
andidx_cbm
). This means that the result now is essentially independent of the calculated VBM/CBM positions and indices, as it's just integrating the DOS with the Fermi-Dirac distribution, and the DOS is zero in the gap until it reaches the (true) CBM/VBM, now giving the correct result.Notebook with this test code and example files attached.
Uploading pymatgen_get_doping_PR.zip…