Skip to content

Commit

Permalink
move energystruct
Browse files Browse the repository at this point in the history
  • Loading branch information
samwaseda committed Nov 28, 2023
1 parent fc63960 commit 46aa2cf
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 5 deletions.
12 changes: 7 additions & 5 deletions pyiron_atomistics/sphinx/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
collect_residue_dat,
collect_spins_dat,
collect_relaxed_hist,
collect_energy_struct,
)
from pyiron_atomistics.sphinx.potential import (
find_potential_file as find_potential_file_jth,
Expand Down Expand Up @@ -2224,11 +2225,12 @@ def collect_energy_struct(self, file_name="energy-structOpt.dat", cwd=None):
Returns:
"""
file_name = posixpath.join(cwd, file_name)
if os.path.isfile(file_name):
self.generic.dft.energy_free = (
np.loadtxt(file_name).reshape(-1, 2)[:, 1] * HARTREE_TO_EV
)
try:
results = collect_energy_struct(file_name=file_name, cwd=cwd)
except FileNotFoundError:
return
for k, v in results.items():
self.generic.dft[k] = v

def collect_sphinx_log(self, file_name="sphinx.log", cwd="."):
"""
Expand Down
21 changes: 21 additions & 0 deletions pyiron_atomistics/sphinx/output_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,27 @@ def collect_residue_dat(file_name="residue.dat", cwd="."):
return {"scf_residue": splitter(residue[:, 1:].squeeze(), residue[:, 0])}



def collect_energy_struct(file_name="energy-structOpt.dat", cwd="."):
"""
Args:
file_name (str): file name
cwd (str): directory path
Returns:
(dict): results
"""
if cwd is None:
cwd = "."
return {
"energy_free": np.loadtxt(
str(Path(cwd) / Path(file_name))
).reshape(-1, 2)[:, 1] * HARTREE_TO_EV
}


def check_permutation(index_permutation):
if index_permutation is None:
return
Expand Down

0 comments on commit 46aa2cf

Please sign in to comment.