Skip to content

Addition of "valences" property to ElementBase and Species for mixed-valence ions#4187

Closed
benrich37 wants to merge 4 commits intomaterialsproject:masterfrom
benrich37:feature-ptable
Closed

Addition of "valences" property to ElementBase and Species for mixed-valence ions#4187
benrich37 wants to merge 4 commits intomaterialsproject:masterfrom
benrich37:feature-ptable

Conversation

@benrich37
Copy link
Copy Markdown
Contributor

@benrich37 benrich37 commented Nov 21, 2024

Summary

Note: This code change is no longer required for #4078 and the valences property does not return (idx, ne) for every valence subshell but only every partially filled valence subshell (unless all subshells are filled, which causes only the last subshell to be returned). I don't see a use for this criteria, so I will fix this to behave as intended. I am also okay with letting this PR be closed and abandoned since it is no longer needed for #4078.

Major changes:

  • feature 1: For both ElementBase and Species class, the code within the "valence" property was copy-pasted into a new "valences" property, with the error raised for ambiguous valence (more than one valence subshell) removed
    (if len(valence) > 1: raise ValueError(f"{self} has ambiguous valence"))
    and return signature changed from tuple[int | np.nan, int] to list[tuple[int | np.nan, int]] (return valence instead of return valence[0])
  • fix 1: To remove redundancy, the "valence" property for ElementBase and Species was re-written to raise the ambiguous valence ValueError if len(self.valences) > 1, and otherwise return self.valences[0]

TODO

  • Loosen return criteria for valences to return all valence subshells while maintaining selectivity of valence

…valence ions. Changing "valence" property to refer return only element of "valences" property (if len > 1, raise same "ambiguous valence" ValueError as before)
…valence ions. Changing "valence" property to refer return only element of "valences" property (if len > 1, raise same "ambiguous valence" ValueError as before)
@benrich37 benrich37 mentioned this pull request Nov 22, 2024
@benrich37
Copy link
Copy Markdown
Contributor Author

closing this until I make those fixes

@benrich37 benrich37 closed this Nov 26, 2024
@benrich37 benrich37 deleted the feature-ptable branch December 12, 2024 22:47
@benrich37 benrich37 restored the feature-ptable branch December 12, 2024 22:47
@benrich37 benrich37 deleted the feature-ptable branch May 8, 2025 20:17
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.

1 participant