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

add a new fermi level calculation method in band.py and its example #176

Merged
merged 22 commits into from
Jun 19, 2024

Conversation

AsymmetryChou
Copy link
Collaborator

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.

@floatingCatty floatingCatty self-requested a review June 19, 2024 03:26
floatingCatty
floatingCatty previously approved these changes Jun 19, 2024
@@ -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(
Copy link
Member

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'):
Copy link
Member

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, \
Copy link
Member

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?

@QG-phy QG-phy merged commit 1f26508 into deepmodeling:main Jun 19, 2024
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants