You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Option to prevent in-place changes in rms.RMSD class #5532
rms.RMSD class makes in-place changes to the timestep positions when group selections exist as seen here:
# Transform each atom in the trajectory (use inplace ops to# avoid copying arrays) (Marginally (~3%) faster than# "ts.positions[:] = (ts.positions - x_com) * R + ref_com".)self._ts.positions[:] -=mobile_com# R acts to the left & is broadcasted N times.self._ts.positions[:] =np.dot(self._ts.positions, self._R)
self._ts.positions+=self._ref_com
The reason for this is already well documented in the code above. This is fine for normal trajectory iteration because the timestep object will get replaced as the the trajectory is iterated. However, in the streaming case, we only get one shot at reading in a given timestep instance and hence have to re-use this across different analyses. It is thus not ideal to have analyses classes modify values like positions etc of the timestep in-place.
Describe the solution you'd like
Maybe add an inplace option to this class, defaulting to True so as to not change any existing behavior, but allow this to be controlled?
Describe alternatives you've considered
Provide a copy of the timestep to sidestep this behavior.
Additional context
mdadash has a Group RMSD widget that uses rms.RMSD. It works around this problem by returning a copy of the timestep from it's buffer for this particular analysis so as to not impact other analyses that take place on the same data.
Activity