Skip to content

Commit

Permalink
Update trmsfkit.py
Browse files Browse the repository at this point in the history
Fix the RMSF equation.
  • Loading branch information
pablo-arantes authored Jun 26, 2024
1 parent 71d9981 commit 0969e55
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions tRMSF/trmsfkit.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,14 +85,14 @@ def _single_frame(self):
self.seg_length = 0

# Accumulate coordinates for averaging
self.avg_coordinates += self.atomgroup.positions
self.avg_coordinates += (self.atomgroup.positions - self.reference_positions)**2
self.seg_length += 1

# At the end of a segment, calculate the RMSF
if (frame_index + 1) == self.skip or self._frame_index == (len(self._trajectory) - 1):
avg_coordinates = self.avg_coordinates / self.seg_length
diff = self.reference_positions - avg_coordinates
rmsf = np.sqrt(np.sum(diff**2, axis=1))
# diff = self.reference_positions - avg_coordinates
rmsf = np.sqrt(np.sum(avg_coordinates, axis=1))
self.results.trmsf[seg_num] = rmsf

def _conclude(self):
Expand Down

0 comments on commit 0969e55

Please sign in to comment.