def linearize(self): """ Using self.base_idxs, separate out bases relative to one another """ new_coords = self.atom_group._getCoords() bidxs = self.base_idxs sidxs = self.start_idxs start = 0 lim = len(sidxs) - 1 for i in range(lim+1): if i < lim: next = sidxs[i+1] else: next = len(new_coords) base_idx = bidxs[i] m = matrix.makeTranslation(base_idx*DELTA_X, 0, 0) new_coords[start:next] = matrix.applyTransform(new_coords[start:next], m) start = next # end for self.atom_group.setCoords(new_coords)
def applyTwist(self): """ Using self.base_idxs, twist bases relative to one another """ new_coords = self.atom_group._getCoords() tidxs = self.twists sidxs = self.start_idxs # print("checker", len(tidxs), len(sidxs)) assert(len(tidxs) == len(sidxs)) start = 0 lim = len(sidxs) - 1 for i in range(lim+1): if i < lim: next = sidxs[i+1] else: next = len(new_coords) # print("twists", i, len(tidxs)) theta = tidxs[i] m = matrix.makeRotationX(theta) new_coords[start:next] = matrix.applyTransform(new_coords[start:next], m) start = next # end for self.atom_group.setCoords(new_coords)
def applyTransformQueue(self): new_coords = self.atom_group._getCoords() for item in self.transform_queue: m, start, end = item new_coords[start:end] = matrix.applyTransform(new_coords[start:end], m) self.transform_queue = []