Skip to content
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

FermiSolver and ChemicalPotentialGrid #46

Merged
merged 215 commits into from
Jan 19, 2025
Merged

FermiSolver and ChemicalPotentialGrid #46

merged 215 commits into from
Jan 19, 2025

Conversation

alexsquires
Copy link
Member

@alexsquires alexsquires commented Jan 10, 2024

  • rename bulk_vasprun, not clear that this needs to be for a high quality dos
  • use _format_defect_name() in examples (is this still a private function? If it's externally useful, should it be changed?).
  • remove ..._and_save() from FermiSolver methods
  • defect_levels argument when annealing becomes a boolean
  • docstrings
  • multiprocessings
  • tests
  • suppress noisy warnings
  • tutorials
  • grid-searching
  • effective dopant response
  • "exceptions" for FermiSolverPyScFermi

@kavanase
Copy link
Member

Looking good @alexsquires. I like the mix-in/abstract class approach.

The _interpolate_chempots() function is quite nice, and I think will likely be one of the mostly-used features from these additions. From what we were discussing before in the #doped Slack, would it be possible to also integrate a grid-scanning approach too? As in, the current function linearly interpolates between two points (chem pot limits), which is nice and v useful in many cases, but if for instance we have a 3D chemical potential space, our min/max of the property of interest could also lie somewhere in the middle of this space, rather than along any linear path between two vertices/limits.

Ofc the user could iterate over all possible vertex/limit combinations if they knew what they were doing, which would be a good stab at this and get you most of the way there I imagine (kind of like a 'band structure path' approach), but still is only covering certain 'high-symmetry' paths in chem pot space. So if a grid approach was also possible (where e.g. the user can just set the chempot spacing in eV, or total number of grid points), that would also be v nice I think – should be doable with some of the scipy grid space interpolation functions I think? And/or pymatgen chemical potential diagram methods maybe?
If it was possible to implement relatively painlessly, could we add these two options? ☝️ 🙏

Sorry to be piling on the requests, but I guess the other main use case I'd imagine for this part of the code would be for the more complex defect thermodynamics analysis that py-sc-fermi allows, where you want to fix certain defect/species etc concentrations and perform some constrained solutions. Is it possible to integrate this to the fermi_solver code?

Also just fyi, about your earlier _format_defect_name() question, yes it is actually quite externally useful and I'll make it a public function in the next (minor) release.

@alexsquires
Copy link
Member Author

alexsquires commented Feb 15, 2024 via email

@alexsquires
Copy link
Member Author

@adair-nicolson , could you re-parse your Cu2SiSe3 data now that everything is relatively final and I can add the grid searching stuff back in?

@alexsquires
Copy link
Member Author

@kavanase proposing this as the full functionality - do you want to take a look at the example ipynb while I finish off the tests before I get to comfortable?

@alexsquires alexsquires marked this pull request as ready for review February 27, 2024 17:17
# Conflicts:
#	examples/CdTe/CdTe_example_thermo.json
@kavanase
Copy link
Member

@alexsquires I'm aiming to merge this and release this weekend / early this week.

I renamed the min_max_X method to optimise as I think this might be a bit more intuitive / obvious as a user-facing function. For the tutorial, I think we can probably remove the doped/py-sc-fermi comparisons; useful to have for testing (I have added some TODO notes to the tests to use these as handy integration tests, by generating these plots and testing with pytest-mpl), but I think it's not needed in the tutorials and will just confuse users. Any thoughts on this or all other changes lmk!

Some notes/thoughts just for reference:

  • Per-charge outputs are currently not supported for FermiSolver, but are for DefectThermodynamics, and so only total defect concentrations are accessible. This is useful information to users in a lot of cases, so would be good to include in future. I think this is possible with py-sc-fermi, just needs to use the decomposed option with concentration_dict?
  • I think I'm still not sure how metastable defects (two defects of the same type and charge state) are handled in py-sc-fermi's functions. They're handled natively in doped with the appropriate Boltzmann summation (from what I remember before). Anyway I guess this is unlikely to matter significantly in most cases.
  • Future TODO: Should also allow just specifying an extrinsic element for fixed_defects, to allow the user to specify the known concentration of a dopant / over/under-stoichiometry of a given element (but with unknown relative populations of different possible defects) -- realistically the most commonly desired option (but would require a bit of refactoring from the current py-sc-fermi implementation).
    • The DefectThermodynamics JSONs in the repo for extrinsic-doped Selenium (link) would be a good test case for this.
  • Future TODO: In future the fixed_defects, free_defects and fix_charge_states options may be added to the doped backend (in theory very simple to add)
  • Future TODO: Add per-site option like in doped DefectThermodynamics, should be quick to add
  • Currently the fixed_defects, free_defects and fix_charge_states options aren't really tested, I've added a TODO note for this.
  • I have some examples now in the tests where the extremum position for a defect/carrier concentration doesn't occur at a limiting chemical potential (e.g. CdTe from my thesis, V_S in Sb2S3 just about (https://pubs.acs.org/doi/10.1021/acsenergylett.4c02722)), which I think will be good to show in the tutorial as this is the main case where this function is particularly powerful.
  • It will also be good to use the scan_X functions now in the main thermodynamics tutorial as this should now be the most convenient and recommended way of doing this, unless extra control is needed e.g. to do the bandgap scissoring I showed for CdTe.

I'll try get to these when I can find some time (lol), but if you had a chance at any point to try tackle some of these would be much appreciated!

@alexsquires
Copy link
Member Author

alexsquires commented Jan 18, 2025 via email

@kavanase
Copy link
Member

Ok cool. All FermiSolver tests passing now, merging this to develop (and hopefully releasing soon!).
Thanks again for this addition @alexsquires!

@kavanase kavanase merged commit 5d85f5d into develop Jan 19, 2025
1 of 8 checks passed
@kavanase kavanase deleted the dopey_fermi branch January 19, 2025 17:03
@kavanase kavanase changed the title remake dopedxpy-sc-fermi FermiSolver and ChemicalPotentialGrid Jan 21, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants