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

Liveshare edits #14

Merged
merged 4 commits into from
Oct 31, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 2 additions & 30 deletions src/pymatgen/core/periodic_table.py
Original file line number Diff line number Diff line change
Expand Up @@ -362,8 +362,7 @@ def electronic_structure(self) -> str:
June 3]. National Institute of Standards and Technology, Gaithersburg,
MD. DOI: https://doi.org/10.18434/T4W30F
"""
return Species(self.symbol, 0).electronic_structure
# return re.sub("</*sup>", "", self._data["Electronic structure"]["0"])
return re.sub("</*sup>", "", self._data["Electronic structure"]["0"])

@property
def average_ionic_radius(self) -> FloatWithUnit:
Expand Down Expand Up @@ -483,7 +482,6 @@ def valences(self) -> list[tuple[int | np.nan, int]]:
obtained from full electron config, where L=0, 1, 2, or 3 for s, p, d,
and f orbitals, respectively.
"""
# return Species(self.symbol, 0).valences
if self.group == 18:
return [(np.nan, 0)] # The number of valence of noble gas is 0

Expand Down Expand Up @@ -1205,8 +1203,6 @@ def valences(self) -> list[tuple[int | np.nan, int]]:
"""List of valence subshell angular moment (L) and number of valence e- (v_e),
obtained from full electron config, where L=0, 1, 2, or 3 for s, p, d,
and f orbitals, respectively.


"""
if self.group == 18:
return [(np.nan, 0)] # The number of valence of noble gas is 0
Expand All @@ -1222,20 +1218,6 @@ def valences(self) -> list[tuple[int | np.nan, int]]:
): # check for full last shell (e.g. column 2)
valences.append((idx, ne))
return valences
# if self.group == 18:
# return [(np.nan, 0)] # The number of valence of noble gas is 0

# L_symbols = "SPDFGHIKLMNOQRTUVWXYZ"
# valences: list[tuple[int, int]] = []
# full_electron_config = self.full_electronic_structure
# last_orbital = full_electron_config[-1]
# for n, l_symbol, ne in full_electron_config:
# idx = L_symbols.lower().index(l_symbol)
# if ne < (2 * idx + 1) * 2 or (
# (n, l_symbol, ne) == last_orbital and ne == (2 * idx + 1) * 2 and len(valences) == 0
# ): # check for full last shell (e.g. column 2)
# valences.append((idx, ne))
# return valences

@property
def valence(self) -> tuple[int | np.nan, int]:
Expand All @@ -1246,9 +1228,6 @@ def valence(self) -> tuple[int | np.nan, int]:
if len(self.valences) > 1:
raise ValueError(f"{self} has ambiguous valence")
return self.valences[0]
# if len(self.valences) > 1:
# raise ValueError(f"{self} has ambiguous valence")
# return self.valences[0]

@property
def ionic_radius(self) -> float | None:
Expand Down Expand Up @@ -1677,9 +1656,7 @@ def get_el_sp(obj: int | SpeciesLike) -> Element | Species | DummySpecies:
of properties that can be determined.
"""
# If obj is already an Element or Species, return as is
# Note: the below three if statements are functionally equivalent to the commented out
# code. They only exist due to a bug in mypy that doesn't allow the commented out code.
# This should be fixed once mypy fixes this
# TODO: Why do we need to check "_is_named_isotope"?
if isinstance(obj, Element):
if getattr(obj, "_is_named_isotope", None):
return Element(obj.name)
Expand All @@ -1692,11 +1669,6 @@ def get_el_sp(obj: int | SpeciesLike) -> Element | Species | DummySpecies:
if getattr(obj, "_is_named_isotope", None):
return Species(str(obj))
return obj
# if isinstance(obj, Element | Species | DummySpecies):
# if type(obj) in [Element, Species, DummySpecies]:
# if getattr(obj, "_is_named_isotope", None):
# return Element(obj.name) if isinstance(obj, Element) else Species(str(obj))
# return obj

# If obj is an integer, return the Element with atomic number obj
try:
Expand Down
17 changes: 10 additions & 7 deletions src/pymatgen/io/jdftx/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,16 @@

This includes:

- JDFTXInfile:
- Initializable from pre-existing JDFTx in files or dictionaries
- Modifiable (acts as dictionary)
- Writes new in files
- JDFTXInfile in jdfxinfile.py:
- Mutable, sub-classes dictionary
- Initializable from pre-existing JDFTx "in" files or dictionaries
- Writes new "in" files
- Extracts Structure objects
- JDFTXOutfile:
- Parses JDFTx out file
- Depends on:
- jdftxinfile_master_format.py which contains information on allowed keys
- jdftxinfile_ref_options.py which contains lists of valid options
- JDFTXOutfile in jdftxoutfile.py:
- Parses JDFTx "out" file
- Contains all typically relevant output variables from a JDFTx geometric optimization or single-point calculation.
- Contains hierarchy of class objects (each contained by the former) for storing data at the following
call frequencies.
Expand All @@ -27,7 +30,7 @@
- JElSteps: Per geometric optimization update (same frequency as parent)
- List of JElStep as well as convergence data relevant to electronic optimization.
- JElStep: Per SCF update
- Contains all electronic data logged in out file at SCF update frequency.
- Contains all electronic data logged in out file at SCF update frequency.

This folder is currently missing:

Expand Down
7 changes: 2 additions & 5 deletions src/pymatgen/io/jdftx/jdftxoutfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -347,9 +347,7 @@ def from_file(cls, file_path: str | Path) -> JDFTXOutfile:
"""
texts = read_outfile_slices(file_path)
slices = [JDFTXOutfileSlice.from_out_slice(text) for text in texts]
instance = cls()
instance.slices = slices
return instance
return cls(slices=slices)

###########################################################################
# Properties inherited from most recent JDFTXOutfileSlice
Expand All @@ -358,7 +356,7 @@ def from_file(cls, file_path: str | Path) -> JDFTXOutfile:
@property
def prefix(self) -> str:
"""
Return prefix from most recent JOutStructure.
The prefix of the most recent JDFTx call.

Return prefix from most recent JOutStructure.
"""
Expand All @@ -369,7 +367,6 @@ def prefix(self) -> str:
@property
def jstrucs(self) -> JOutStructures:
"""
Return jstrucs from most recent JOutStructure.

Return jstrucs from most recent JOutStructure.
"""
Expand Down
48 changes: 0 additions & 48 deletions tests/io/jdftx/example_files/CO.in

This file was deleted.

Loading