Skip to content

Commit dccbd42

Browse files
Sathya-S3Copilot
andcommitted
fix tests and fucntional references
Co-authored-by: Copilot <copilot@github.com>
1 parent 1b1bfb5 commit dccbd42

2 files changed

Lines changed: 8 additions & 16 deletions

File tree

src/nomad_parser_magres/parsers/parser.py

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -544,7 +544,7 @@ def parse_xc_functional(
544544
xc_functional_labels = self._xc_functional_map.get(xc_functional, [])
545545
xc_sections = []
546546
for xc in xc_functional_labels:
547-
functional = XCFunctional(libxc_name=xc)
547+
functional = XCFunctional(functional_key=xc)
548548
if '_X_' in xc:
549549
functional.name = 'exchange'
550550
elif '_C_' in xc:
@@ -1182,15 +1182,11 @@ def parse_outputs(
11821182
model_method_ref=simulation.model_method[-1],
11831183
model_system_ref=simulation.model_system[-1],
11841184
)
1185-
if (
1186-
not simulation.model_system[-1].cell
1187-
or not simulation.model_system[-1].particle_states
1188-
):
1185+
if not simulation.model_system[-1].particle_states:
11891186
logger.warning(
1190-
'Could not find the `cell` sub-section or the `MagresParser.atom_state_class` list under particle states.'
1187+
'Could not find the `MagresParser.atom_state_class` list under particle states.'
11911188
)
11921189
return None
1193-
cell = simulation.model_system[-1].cell[-1]
11941190

11951191
# Check if [magres][/magres] was correctly parsed
11961192
magres_data = self.magres_file_parser.get('magres')

tests/test_parser.py

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -49,22 +49,18 @@ def test_single_point_ethanol(parser):
4949
for index, label in enumerate(labels):
5050
assert model_system.particle_states[index].label == label
5151

52-
# Cell
53-
assert len(model_system.cell) == 1
54-
atomic_cell = model_system.cell[0]
55-
56-
# Lattice vectors: atomic_cell.lattice_vectors is a numpy array (or Quantity) of shape (3, 3)
52+
# Lattice vectors: model_system.lattice_vectors is a numpy array (or Quantity) of shape (3, 3)
5753
expected_lattice = np.array(
5854
[
5955
[6.0, 0.0, 0.0],
6056
[0.0, 6.0, 0.0],
6157
[0.0, 0.0, 6.0],
6258
]
6359
)
64-
lattice_vectors = atomic_cell.lattice_vectors.to('angstrom').magnitude
60+
lattice_vectors = model_system.lattice_vectors.to('angstrom').magnitude
6561
assert np.allclose(lattice_vectors, expected_lattice, atol=1e-8)
6662

67-
assert atomic_cell.periodic_boundary_conditions == [True, True, True]
63+
assert model_system.periodic_boundary_conditions == [True, True, True]
6864

6965
# ModelMethod
7066
assert len(simulation.model_method) == 1
@@ -75,9 +71,9 @@ def test_single_point_ethanol(parser):
7571
assert len(dft.xc_functionals) == 2
7672
# Order is correlation then exchange for PBE in the parser map
7773
assert dft.xc_functionals[0].name == 'correlation'
78-
assert dft.xc_functionals[0].libxc_name == 'GGA_C_PBE'
74+
assert dft.xc_functionals[0].functional_key == 'GGA_C_PBE'
7975
assert dft.xc_functionals[1].name == 'exchange'
80-
assert dft.xc_functionals[1].libxc_name == 'GGA_X_PBE'
76+
assert dft.xc_functionals[1].functional_key == 'GGA_X_PBE'
8177
# NumericalSettings
8278
assert len(dft.numerical_settings) == 1
8379
k_space = dft.numerical_settings[0]

0 commit comments

Comments
 (0)