-
Notifications
You must be signed in to change notification settings - Fork 16
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
add a new fermi level calculation method in band.py and its example #176
Conversation
@@ -290,7 +255,7 @@ def estimate_E_fermi(cls, eigenvalues: np.array, total_electrons: int, spindeg: | |||
EF=(sorteigs[numek] + sorteigs[numek-1])/2 | |||
|
|||
return EF | |||
|
|||
|
|||
def band_plot( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the plot function should be able to use the inputed E_fermi to plot that band, but now it prioritize the estimated E_fermi.
self.use_gui = use_gui | ||
class Band(ElecStruCal): | ||
|
||
def __init__(self, model: Eigenvalues, results_path: str=None, use_gui: bool=False, device: str='cpu'): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
model should inherit a torch.nn.Module class, ratherthan Eigenvalues class
spindeg = 2 | ||
estimated_E_fermi = self.estimate_E_fermi(data[AtomicDataDict.ENERGY_EIGENVALUE_KEY][0].detach().cpu().numpy(), total_nel, spindeg) | ||
log.info(f'Estimated E_fermi: {estimated_E_fermi} based on the valence electrons setting nel_atom : {nel_atom} .') | ||
_,estimated_E_fermi = self.get_fermi_level(data=structase, nel_atom=nel_atom, \ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The eigenvalue seems computed twice here. In the second time, it should be possible to pass the eigenvalues from the first time and estimate without diagonalization again?
Considering the fermi level estimation method in band.py is not very accurate and might fail in the case of metal (like Au primitive cell), I add an another fermi level calculation method, which gets fermi level iteratively by sampling kpoints in Brillouinzone with or without time-reversal-symmetry.