File tree Expand file tree Collapse file tree
package/MDAnalysis/analysis Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -295,9 +295,8 @@ def _prepare(self):
295295 )
296296 n_dim = self ._n_atoms * 3
297297 self .cov = np .zeros ((n_dim , n_dim ))
298- # Batch frames into BLAS matmul for covariance updates.
299- # Peak memory: 2 * n_dim^2 * 8 (cov + matmul temporary)
300- # + batch_size * n_dim * 8 (frame buffer).
298+ # Batch frames into BLAS matmul for covariance updates
299+ # while keeping memory usage reasonable.
301300 self ._batch_size = min (self .n_frames , 500 )
302301 self ._frame_data = np .empty ((self ._batch_size , n_dim ))
303302 self ._batch_idx = 0 # tracks when to update self.cov
@@ -350,8 +349,8 @@ def _conclude(self):
350349 if self ._batch_idx > 0 :
351350 # Accumulate remaining frames from the final batch
352351 self .cov += (
353- self ._frame_data [:self ._batch_idx ].T
354- @ self ._frame_data [:self ._batch_idx ]
352+ self ._frame_data [: self ._batch_idx ].T
353+ @ self ._frame_data [: self ._batch_idx ]
355354 )
356355 self .cov /= self .n_frames - 1
357356 del self ._frame_data
You can’t perform that action at this time.
0 commit comments