Skip to content

Commit

Permalink
convert lists to np.array (#101)
Browse files Browse the repository at this point in the history
* convert lists to np.array

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
  • Loading branch information
PythonFZ and pre-commit-ci[bot] authored Jul 24, 2024
1 parent 487c340 commit 7d0c4aa
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion znh5md/format.py
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,9 @@ def extract_atoms_data(atoms: ase.Atoms) -> ASEData:
for key, result in atoms.calc.results.items():
if key not in all_properties:
uses_calc.append(key)
value = np.array(result) if isinstance(result, (int, float)) else result
value = (
np.array(result) if isinstance(result, (int, float, list)) else result
)
if value.ndim > 1 and value.shape[0] == len(atomic_numbers):
particles[key if key != "forces" else "force"] = value
else:
Expand Down

0 comments on commit 7d0c4aa

Please sign in to comment.