From 730b6faa17186d5428768420126b15c4137a5168 Mon Sep 17 00:00:00 2001 From: m-julian <52214154+m-julian@users.noreply.github.com> Date: Tue, 11 Jun 2024 15:58:37 +0100 Subject: [PATCH] fix positional argument --- ichor_core/ichor/core/files/xyz/trajectory.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/ichor_core/ichor/core/files/xyz/trajectory.py b/ichor_core/ichor/core/files/xyz/trajectory.py index 87403e4d..82b847c7 100644 --- a/ichor_core/ichor/core/files/xyz/trajectory.py +++ b/ichor_core/ichor/core/files/xyz/trajectory.py @@ -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) @@ -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