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 BandGap output #53

Merged
merged 12 commits into from
Apr 18, 2024
Merged

Add BandGap output #53

merged 12 commits into from
Apr 18, 2024

Conversation

JosePizarro3
Copy link
Collaborator

@JosePizarro3 JosePizarro3 commented Apr 11, 2024

Closes #31

@JosePizarro3 JosePizarro3 self-assigned this Apr 11, 2024
@JosePizarro3 JosePizarro3 linked an issue Apr 11, 2024 that may be closed by this pull request
@coveralls
Copy link

coveralls commented Apr 11, 2024

Pull Request Test Coverage Report for Build 8734344240

Details

  • 63 of 63 (100.0%) changed or added relevant lines in 4 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage increased (+2.6%) to 95.652%

Totals Coverage Status
Change from base Build 8645961087: 2.6%
Covered Lines: 154
Relevant Lines: 161

💛 - Coveralls

@JosePizarro3
Copy link
Collaborator Author

@JFRudzinski what do you think about creating a sub-folder with the specific physical properties modules? Like I did here for the ElectronicBandGap.

@JFRudzinski
Copy link
Collaborator

@JFRudzinski what do you think about creating a sub-folder with the specific physical properties modules? Like I did here for the ElectronicBandGap.

Not sure if there are any best practices in this direction, but personally, yeah, I think that is quite nice. I like separating out related properties a bit so none of the files become too too large to manage, and then in that case it definitely helps organizationally to have the subfolder 🙌

Fix __setattr__ in PhysicalProperty
@JosePizarro3
Copy link
Collaborator Author

@ndaelman-hu being a band gap, would you mind reviewing this quickly? I think it is very easy, I just had to fix a bit the logic of the setattr in PhysicalProperty.

I'd like to merge this today, if there are not too many changes.

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.

Hey, some nice implementations, but I would be careful with some pitfalls.
Regarding the schema, there are some points that I'd like clarified or where I offer an alternative.

Added Nathan comments
@ndaelman-hu
Copy link
Collaborator

Okay, I replied to unresolved (and some resolved) threads. Let's just work through those points, the rest is fine.

@JosePizarro3 JosePizarro3 force-pushed the 31-add-bandgap-output branch from 1643440 to ae7c744 Compare April 15, 2024 09:32
@JosePizarro3
Copy link
Collaborator Author

@ndaelman-hu

Ok, I added a new method in Outputs for returning the two spin channels of a property if present (otherwise it returns an empty list).

My reasoning for this is that the data.outputs can be a list connected with some model_system evolution, and hence we will be mixing concepts. Then, we would end up having an issue anyways of users needing to handle such situations manually. In any case, let's see what happens along the line, we can implement something better in a near future, no problem.

I also changed the negative value to be None, and I had to improve on the __setattr__ for PhysicalProperty.

Comment on lines +67 to +86
def extract_spin_polarized_property(self, property_name: str) -> list:
"""
Extracts the spin-polarized properties if present from the property name and returns them as a list of two elements in
which each element refers to each `spin_channel`. If the return list is empty, it means that the simulation is not
spin-polarized (i.e., `spin_channel` is not defined).

Args:
property_name (str): The name of the property to be extracted.

Returns:
(list): The list of spin-polarized properties.
"""
spin_polarized_properties = []
properties = getattr(self, property_name)
for prop in properties:
if prop.spin_channel is None:
continue
spin_polarized_properties.append(prop)
return spin_polarized_properties

Copy link
Collaborator

Choose a reason for hiding this comment

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

This is fine, but note that there's a distinction between a calculation that allowed for spin-relaxation and one where the properties differ between spin-channel.
I think that the former is already covered well enough in model_system.py.
I would use the latter definition here, though: if the DOS up / down are the same, I don't consider it polarized (magnetic).

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Still, both spin-channels are reported. This distinction into the specific magnetic state should come from another property. If the proper occupation per spin channel is not defined, how can you ensure one or another type of magnetic state?

Change variables.Energy to Energy2 to avoid bugs with Normalizers (to be fixed)
@JosePizarro3
Copy link
Collaborator Author

Ok, I am merging this, but @ndaelman-hu: would you mind if we move this discussion of the magnetic state to #22? I think there we can keep talking + we can eventually invite Hongbin and the postdoc responsible for data to join the discussion 🙂

@ndaelman-hu ndaelman-hu added the new feature New feature or request label Apr 18, 2024
@ndaelman-hu ndaelman-hu self-requested a review April 18, 2024 07:59
@JosePizarro3 JosePizarro3 merged commit 95286c4 into develop Apr 18, 2024
4 checks passed
@JosePizarro3 JosePizarro3 deleted the 31-add-bandgap-output branch April 18, 2024 08:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
new feature New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add BandGap output
4 participants