def scale_bounds(self,bounds): if bounds is None: return None else: boundsnew = np.empty(np.shape(bounds)) for i in range(3): # dimensions boundsnew[i,:] = Mmath.rescale_coords(bounds[i,:],self.boxdims[i,:],[0,1]) return boundsnew
def dilate_points(self,pts): colother = self.colother coordsold = pts[:,colother] linelimsold = min(coordsold), max(coordsold) linelimsnew = self.linelims coordsnew = Mmath.rescale_coords(coordsold,linelimsold,linelimsnew) ptsnew = np.copy(pts) ptsnew[:,colother] = coordsnew return ptsnew
def getArrayOut(xyarray, typesarray, boxbounds): natoms = xyarray.shape[0] xyscaled = np.empty((natoms, 3)) xyarraynew = np.zeros((natoms, 3)) xyarraynew[:, :2] = xyarray[:, :2] for i in range(3): vec = xyarraynew[:, i] bounds = boxbounds[i, :] xyscaled[:, i] = Mmath.rescale_coords(vec, bounds, [0, 1]) atomvec = np.arange(1, natoms + 1, 1) return np.column_stack((atomvec, typesarray[:, 0], xyscaled))
def getArrayOut(xyarray,typesarray,boxbounds): natoms = xyarray.shape[0] xyscaled = np.empty((natoms,3)) xyarraynew = np.zeros((natoms,3)) xyarraynew[:,:2] = xyarray[:,:2] for i in range(3): vec = xyarraynew[:,i] bounds = boxbounds[i,:] xyscaled[:,i] = Mmath.rescale_coords(vec,bounds,[0,1]) atomvec = np.arange(1,natoms+1,1) return np.column_stack((atomvec,typesarray[:,0],xyscaled))
def unscale_coords(self,dumparray,indexstart=2): for i in range(3): dumparray[:,i+indexstart] = Mmath.rescale_coords(dumparray[:,i+indexstart],[0,1],self.boxdims[i,:]) return dumparray