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 ElectronicDOS and XASSpectra properties #54

Merged
merged 43 commits into from
Apr 29, 2024
Merged

Conversation

JosePizarro3
Copy link
Collaborator

@JosePizarro3 JosePizarro3 commented Apr 12, 2024

@ndaelman-hu

@JFRudzinski @Bernadette-Mohr only for you: I added properties/energies.py and a couple of properties, FermiLevel and ChemicalPotential. You can disregard the rest of the message.

I just finished this initial version. Mainly, you have to check properties/spectral_profile.py and properties/energies.py. I added some tests, but I have the issue that I would need some other sections in order to properly test the functionalities in ElectronicDensityOfStates, namely, I need ElectronicEigenvalues containing the info of the highest_occupied_energy and lowest_occupied_energy.

Besides these, I changed OrbitalsState and AtomsState to inherit from Entity. Do you mind giving your thoughts in here? I wanted to give an entity_ref that can be used to reference if a property is atomic or orbitally resolved, e.g., the projected DOS (but there might be others).

@JosePizarro3 JosePizarro3 self-assigned this Apr 12, 2024
@JosePizarro3 JosePizarro3 changed the title Add DOS output Add ElectronicDOS and XASSpectra properties Apr 15, 2024
@JosePizarro3 JosePizarro3 changed the title Add ElectronicDOS and XASSpectra properties Add ElectronicDOS and XASSpectra properties Apr 15, 2024
@JosePizarro3 JosePizarro3 force-pushed the 32-add-dos-output branch 2 times, most recently from b7f7d57 to 33a1871 Compare April 16, 2024 07:52
@coveralls
Copy link

coveralls commented Apr 16, 2024

Pull Request Test Coverage Report for Build 8875188200

Details

  • 196 of 200 (98.0%) changed or added relevant lines in 4 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage increased (+1.4%) to 97.101%

Changes Missing Coverage Covered Lines Changed/Added Lines %
tests/conftest.py 54 58 93.1%
Totals Coverage Status
Change from base Build 8753733270: 1.4%
Covered Lines: 335
Relevant Lines: 345

💛 - Coveralls

@JosePizarro3 JosePizarro3 force-pushed the 32-add-dos-output branch 2 times, most recently from 163e0cc to f8a8426 Compare April 18, 2024 07:41
Base automatically changed from 31-add-bandgap-output to develop April 18, 2024 08:46
@JosePizarro3 JosePizarro3 linked an issue Apr 18, 2024 that may be closed by this pull request
Added iri to quantity in PhysicalProperty
Fix __setattr__ in PhysicalProperty
Added Nathan comments
Added raise ValueError in PhysicalProperty when value is None
Added SpectralProfile, ElectronicSpectralProfile

Added basic ElectronicDensityOfStates
Added ElectronicDOS and XASSpectra
Added SpectralProfile, ElectronicDensityOfStates, XASSpectra in spectral_profile.py

Check iri assignement in __init__ in PhysicalProperty

Fixed ElectronicBandGap
@JFRudzinski
Copy link
Collaborator

regard the rest of the messa

Thanks @JosePizarro3, I did see this. I will eventually use this as a basis and combine with the other energies that I had written down

Copy link
Collaborator

@ndaelman-hu ndaelman-hu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here's a 1st set of feedback. Revising the tests comes later.

# TODO (cont'd) and `entity_ref` is set)


class ElectronicDensityOfStates(DOSProfile):
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Given the complexity of the normalizers in this class, I think it is best to develop an electronic structure post-analysis suite, similar to MatID for symmetries. There already exist PyProcar and ASH, but they're fairly limited and code specific.

@JFRudzinski where would this fit into our planning? Note that a proper package would be worthy of a publication!

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it is best to develop an electronic structure post-analysis suite, similar to MatID for symmetries.

Yeah it might be, but we need the whole picture first. IMO, we could publish this repo as it is, and later think of some post-processing analysis tools which could be generalized. As of now, it is true that I am trying to keep as much as possible from the former normalization, but improving the schema.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay, the standalone module is more an idea for down the line (@JFRudzinski would also like your feedback) and a way to get an easy paper. I'm not suggesting this for now! Still, it feels a bit out of place compared to the simpler, and more to-the-point checks that make up most of the other normalizers.

What is relevant at the moment, though, is stress testing these algos. We have numerous cases in our repo, where the band structure or DOS extraction fail, and it's painful to see. This has always been a very tricky issue.
Since this PR focuses on migrating and extending the schema, I implore you to open a new issue where we tackle this aspect. In the meantime, I'll think up more test cases.

@JosePizarro3
Copy link
Collaborator Author

@ndaelman-hu thanks for the comments

Would you mind checking again? I can also discuss the details on implementation is something is unclear.

@ndaelman-hu
Copy link
Collaborator

@ndaelman-hu thanks for the comments

Would you mind checking again? I can also discuss the details on implementation is something is unclear.

Okay, will take a look somewhere this evening.

Copy link
Collaborator

@ndaelman-hu ndaelman-hu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Almost there. Mostly small stuff, and a bit of reshuffling of where code belongs.

I still need to take a look at larger tests in test_spectral_profile, but I'll do that after a break.

# TODO (cont'd) and `entity_ref` is set)


class ElectronicDensityOfStates(DOSProfile):
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay, the standalone module is more an idea for down the line (@JFRudzinski would also like your feedback) and a way to get an easy paper. I'm not suggesting this for now! Still, it feels a bit out of place compared to the simpler, and more to-the-point checks that make up most of the other normalizers.

What is relevant at the moment, though, is stress testing these algos. We have numerous cases in our repo, where the band structure or DOS extraction fail, and it's painful to see. This has always been a very tricky issue.
Since this PR focuses on migrating and extending the schema, I implore you to open a new issue where we tackle this aspect. In the meantime, I'll think up more test cases.

@ndaelman-hu ndaelman-hu self-requested a review April 24, 2024 19:19
Copy link
Collaborator

@ndaelman-hu ndaelman-hu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So, I brought up some additional edge cases to test for.
The failing tests are what worry me most, though. Since it is all related to the pDOS, it could be tackled in a separate issue, but that has to be high on the priority list.

Regarding DOS in general, it really doesn't merit a fundamentally different treatment from other spectra. I think we can have a single class where name is used to specify the profile type.

@JosePizarro3
Copy link
Collaborator Author

So, I brought up some additional edge cases to test for. The failing tests are what worry me most, though. Since it is all related to the pDOS, it could be tackled in a separate issue, but that has to be high on the priority list.

Regarding DOS in general, it really doesn't merit a fundamentally different treatment from other spectra. I think we can have a single class where name is used to specify the profile type.

Ok, tricky error in the conftest for fixing the testing for pDOS: I need to create a full Simulation object, and not simply let ModelSystem hang around. I will push something today so you can check the new generate_simulation_electronic_dos conftests (which returns the full Simulation, and not the ElectronicDensityOfStates section).

@JosePizarro3
Copy link
Collaborator Author

Ok, finished. @ndaelman-hu do you mind checking before going on holidays? Thanks!

Copy link
Collaborator

@ndaelman-hu ndaelman-hu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All good, thank you very much!!

self.m_cache['lowest_occupied_energy'] = lowest_occupied_energy

# Set thresholds for the energies and values
energy_threshold = config.normalize.band_structure_energy_tolerance
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My IDE is telling me that config has no member normalize. Are you using a different branch then develop for your base nomad installation?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am using a branch where I added this repo as a submodule. I saw the config and models/config + check locally and I can use the normalize no problem.

@JosePizarro3
Copy link
Collaborator Author

Thanks @ndaelman-hu !

I am merging this and continue working on #52

@JosePizarro3 JosePizarro3 merged commit b159b0c into develop Apr 29, 2024
4 checks passed
@JosePizarro3 JosePizarro3 deleted the 32-add-dos-output branch April 29, 2024 08:20
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.

Add ElectronicDOS and XASSpectra properties
4 participants