Skip to content

Commit

Permalink
fix positional argument
Browse files Browse the repository at this point in the history
  • Loading branch information
m-julian committed Jun 11, 2024
1 parent 18015d1 commit 730b6fa
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions ichor_core/ichor/core/files/xyz/trajectory.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ class Trajectory(ReadFile, WriteFile, ListOfAtoms):

_filetype = ".xyz"

def __init__(self, path: Union[Path, str], read_geometries=True, *args, **kwargs):
def __init__(self, path: Union[Path, str], *args, read_geometries=True, **kwargs):
ListOfAtoms.__init__(self, *args, **kwargs)
super(ReadFile, self).__init__(path)

Expand Down Expand Up @@ -608,9 +608,10 @@ def __getitem__(self, item) -> Atoms:
# if PointsDirectory is indexed by a slice e.g. [:50], [20:40], etc.
elif isinstance(item, slice):

new_traj = Trajectory(self.path, list.__getitem__(self, item))
# need to set the filestate to read otherwise the file will be read again
new_traj.state = FileState.Read
# setting read_geometries to false will not read the file again
new_traj = Trajectory(
self.path, list.__getitem__(self, item), read_geometries=False
)

return new_traj

Expand Down

0 comments on commit 730b6fa

Please sign in to comment.