Skip to content

Commit

Permalink
add momenta to Frame (#295)
Browse files Browse the repository at this point in the history
* add momenta

* add forces - what is going on here?

* Bugfix for additional info from ase

---------

Co-authored-by: Paul Hohenberger <[email protected]>
  • Loading branch information
PythonFZ and phohenberger authored Dec 21, 2023
1 parent 900fed1 commit 4a2bb33
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion zndraw/frame.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,8 @@ class Frame:
numbers: np.ndarray = None
colors: np.ndarray = None
radii: np.ndarray = None
momenta: np.ndarray = None
forces: np.ndarray = None
pbc: bool = False
connectivity: nx.Graph() = nx.empty_graph()
calc: dict = None
Expand All @@ -80,7 +82,9 @@ def from_atoms(cls, atoms: ase.Atoms):
"""
Creates an instance of the frame class from an ase.Atoms object
"""
frame = cls(**atoms.arrays)
data = atoms.arrays

frame = cls(positions=data["positions"], numbers=data["numbers"])

frame.cell = np.array(atoms.cell)
frame.pbc = atoms.pbc
Expand Down

0 comments on commit 4a2bb33

Please sign in to comment.