Skip to content

Commit

Permalink
Merge pull request #284 from SCM-NV/parser2
Browse files Browse the repository at this point in the history
BUG: Ensure that basis set coefficients are transposed
  • Loading branch information
BvB93 committed Feb 4, 2022
2 parents e168ba9 + d8a6cf8 commit 3f6741c
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/qmflows/parsers/_cp2k_basis_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ def _read_basis(f: _BasisFileIter) -> _Basis2Tuple:
basis_fmt = [int(j) for j in next(f).split()]
n_exp = basis_fmt[3]
basis_data = np.array([j.split() for j in islice(f, 0, n_exp)], dtype=np.float64)
exp, coef = basis_data[:, 0], basis_data[:, 1:]
exp, coef = basis_data[:, 0], basis_data[:, 1:].T

# Two things happen whenever an basis set alias is encountered (i.e. `is_alias > 0`):
# 1. The `alias` field is set for the keys
Expand Down
4 changes: 2 additions & 2 deletions test/test_cp2k_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@ def test_pass(self) -> None:
group = f[key]
alias = group["alias"][...].astype(str)

np.testing.assert_allclose(value_tup.exponents, group["exponents"], err_msg=key)
np.testing.assert_allclose(value_tup.coefficients, group["coefficients"], err_msg=key)
np.testing.assert_allclose(value_tup.exponents, group["exponents"][...].T, err_msg=key)
np.testing.assert_allclose(value_tup.coefficients, group["coefficients"][...].T, err_msg=key)
if key_tup.alias is not None:
assertion.eq(self.get_key(key_tup.alias), alias, message=key)

Expand Down

0 comments on commit 3f6741c

Please sign in to comment.