Skip to content

Commit

Permalink
Address PR issues
Browse files Browse the repository at this point in the history
- delete unnecessary files from TiN-corehole test suite
- add logger for missing inc file
- add dscf state to CoreHole() and test it
  • Loading branch information
jfrodlova authored and ondracka committed Nov 7, 2024
1 parent f36c5be commit 2f0278e
Show file tree
Hide file tree
Showing 7 changed files with 18 additions and 47,513 deletions.
21 changes: 13 additions & 8 deletions electronicparsers/wien2k/parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -691,6 +691,7 @@ def __init__(self):
def init_parser(self):
self.out_parser.mainfile = self.filepath
self.out_parser.logger = self.logger
self.inc_parser.logger = self.logger

def get_wien2k_file(self, ext, multiple=False):
paths = [p for p in os.listdir(self.maindir) if re.match(rf'.*{ext}$', p)]
Expand Down Expand Up @@ -1118,22 +1119,26 @@ def parse_method(self):
j_quantum_number = (
-kappas[orbital] / spin_quantum_number - 1 / 2
)
j_quantum_number = np.array([j_quantum_number])
l_quantum_number = j_quantum_number - (spin_quantum_number / 2)
electrons_excited = max_occupancy - occupancy
n_quantum_number = n_quantum_numbers[orbital]
atom_par = sec_method.atom_parameters
atom_obj = AtomParameters()
atom_obj.atom_index = atom_index
core_hole = CoreHole()
atom_obj.core_hole = core_hole
j_quantum_number = np.array([j_quantum_number])
core_hole.j_quantum_number = j_quantum_number
core_hole.l_quantum_number = l_quantum_number
core_hole.n_quantum_number = n_quantum_number
core_hole.n_electrons_excited = electrons_excited
core_hole.occupation = occupancy
atom_obj.core_hole = CoreHole(
j_quantum_number = j_quantum_number,
l_quantum_number = l_quantum_number,
n_quantum_number = n_quantum_number,
n_electrons_excited = electrons_excited,
occupation = occupancy,
dscf_state = 'final',
)
atom_par.append(atom_obj)
break
else:
self.logger.warning("inc file is missing, no corehole information "
"will be parsed if corehole present.")
# basis
if self.in1_parser.mainfile:
self.in1_parser.parse()
Expand Down
1,667 changes: 0 additions & 1,667 deletions tests/data/wien2k/TiN-corehole/TiN-corehole.clmcor

This file was deleted.

18,257 changes: 0 additions & 18,257 deletions tests/data/wien2k/TiN-corehole/TiN-corehole.clmsum

This file was deleted.

18,257 changes: 0 additions & 18,257 deletions tests/data/wien2k/TiN-corehole/TiN-corehole.clmval

This file was deleted.

7,376 changes: 0 additions & 7,376 deletions tests/data/wien2k/TiN-corehole/TiN-corehole.lcorepot

This file was deleted.

1,944 changes: 0 additions & 1,944 deletions tests/data/wien2k/TiN-corehole/TiN-corehole.rsplcore

This file was deleted.

9 changes: 5 additions & 4 deletions tests/test_wien2kparser.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,8 @@ def test_eigenvalues(parser, caplog):
archive = EntryArchive()
parser.parse('tests/data/wien2k/eigenvalues/64k_8Rk_mBJkol.scf', archive, None)

assert len(caplog.records) == 1
assert 'Different number of eigenvalues' in caplog.records[0].msg
assert len(caplog.records) == 2
assert 'Different number of eigenvalues' in caplog.records[1].msg

sec_eigenvalues = archive.run[0].calculation[0].eigenvalues[0]
assert np.shape(sec_eigenvalues.energies[0][7]) == (314,)
Expand All @@ -95,8 +95,8 @@ def test_dos(parser, caplog):
archive = EntryArchive()
parser.parse('tests/data/wien2k/dos/CrO2-sp.scf', archive, None)

assert len(caplog.records) == 1
assert 'Different number of eigenvalues' in caplog.records[0].msg
assert len(caplog.records) == 2
assert 'Different number of eigenvalues' in caplog.records[1].msg

sec_scc = archive.run[0].calculation[0]

Expand Down Expand Up @@ -137,3 +137,4 @@ def test_core_hole(parser, caplog):
assert atom_par.core_hole.j_quantum_number == 1.5
assert atom_par.core_hole.n_quantum_number == 2
assert atom_par.core_hole.occupation == 3
assert atom_par.core_hole.dscf_state == 'final'

0 comments on commit 2f0278e

Please sign in to comment.