Skip to content

Commit

Permalink
Update reference frame handling
Browse files Browse the repository at this point in the history
  • Loading branch information
bylehn committed Sep 18, 2024
1 parent cb00d90 commit 5563705
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions atomicstrain/analysis.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand All @@ -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:
Expand Down

0 comments on commit 5563705

Please sign in to comment.