From 55637058c2ffa3e47f746d43e9e3548d0414a354 Mon Sep 17 00:00:00 2001 From: Fabian Bylehn Date: Wed, 18 Sep 2024 15:09:30 -0500 Subject: [PATCH] Update reference frame handling --- atomicstrain/analysis.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/atomicstrain/analysis.py b/atomicstrain/analysis.py index 4182dbb..25a3cb0 100644 --- a/atomicstrain/analysis.py +++ b/atomicstrain/analysis.py @@ -15,6 +15,7 @@ def __init__(self, reference, deformed, residue_numbers, output_dir, min_neighbo self.selections = create_selections(self.ref, self.defm, residue_numbers, min_neighbors, use_all_heavy) self.output_dir = output_dir self.n_frames = n_frames + self.has_ref_trajectory = hasattr(self.ref, 'trajectory') and len(self.ref.trajectory) > 1 super().__init__(self.defm.trajectory, n_frames=n_frames, **kwargs) def _prepare(self): @@ -27,8 +28,8 @@ def _single_frame(self): frame_principal = [] frame_atom_info = [] - # Ensure reference and deformed are at the same frame - if hasattr(self.ref, 'trajectory'): + # Update reference frame only if it has a trajectory + if self.has_ref_trajectory: self.ref.trajectory[self._frame_index] for ((ref_sel, ref_center), (defm_sel, defm_center)) in self.selections: