From ef1c5dba3752f9308685e2ce57cb017e54e719e1 Mon Sep 17 00:00:00 2001 From: Jakob Gamper <97gamjak@gmail.com> Date: Wed, 5 Jun 2024 01:16:32 +0200 Subject: [PATCH] fix: read_trajectory with constant topology did actually not use a constant topology approach --- PQAnalysis/io/traj_file/frame_reader.py | 4 +++- PQAnalysis/io/traj_file/trajectory_reader.py | 4 ++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/PQAnalysis/io/traj_file/frame_reader.py b/PQAnalysis/io/traj_file/frame_reader.py index 1a615ce7..ebdb00d3 100644 --- a/PQAnalysis/io/traj_file/frame_reader.py +++ b/PQAnalysis/io/traj_file/frame_reader.py @@ -251,7 +251,9 @@ def _check_qmcfc( return value, atoms def _get_topology( - self, atoms: List[str], topology: Topology | None + self, + atoms: List[str], + topology: Topology | None, ) -> Topology: """ Returns the topology of the frame. diff --git a/PQAnalysis/io/traj_file/trajectory_reader.py b/PQAnalysis/io/traj_file/trajectory_reader.py index bc3ddb83..e35d7615 100644 --- a/PQAnalysis/io/traj_file/trajectory_reader.py +++ b/PQAnalysis/io/traj_file/trajectory_reader.py @@ -251,7 +251,7 @@ def frame_generator( # then increment the frame index frame_index += 1 - if self.constant_topology and self.topology is not None: + if self.constant_topology and self.topology is None: self.topology = frame.topology frame_lines = [line] @@ -278,7 +278,7 @@ def frame_generator( # then increment the frame index frame_index += 1 - if self.constant_topology and self.topology is not None: + if self.constant_topology and self.topology is None: self.topology = frame.topology @runtime_type_checking