Exemple #1
0
    def rotate(self, frame, axis, theta):
        '''
        Simple rotation about the x, y, or z axis.

        right-handed rotation 
        Note that calcuations are in radians
        Rotation is done in right-handed coordinate system

        '''

        cs = numpy.cos(theta)
        si = numpy.sin(theta)
        if(axis == 'x'):
            mat = numpy.array([[1.0, 0.0, 0.0], [0.0, cs, -si], [0.0, si, cs]])
        elif(axis == 'y'):
            mat = numpy.array([[cs, 0.0, si], [0.0, 1.0, 0.0], [-si, 0.0, cs]])
        elif(axis == 'z'):
            mat = numpy.array([[cs, -si, 0.0], [si, cs, 0.0], [0.0, 0.0, 1.0]])

        coordt = self._coor[frame, :].T
        error, matrix_product = sasmath.matrix_multiply(mat, coordt)
        ncoord = matrix_product.T
        self._coor[frame, :] = ncoord

        return
Exemple #2
0
	def rotate(self,frame,axis,theta):
			
		'''
		Simple rotation about the x, y, or z axis.
		
		Note that calcuations are in radians

		'''

		cs=numpy.cos(theta) ; si=numpy.sin(theta)
		if(axis=='x'):
			mat=numpy.array([[1.0,0.0,0.0],[0.0,cs,-si],[0.0,si,cs]])
		elif(axis=='y'):
			mat=numpy.array([[cs,0.0,si],[0.0,1.0,0.0],[-si,0.0,cs]])
		elif(axis=='z'):
			mat=numpy.array([[cs,-si,0.0],[si,cs,0.0],[0.0,0.0,1.0]])

		coordt=self._coor[frame,:].T	
		error,matrix_product = sasmath.matrix_multiply(mat,coordt)
		ncoord = matrix_product.T	
		self._coor[frame,:]=ncoord 
	
		return
Exemple #3
0
    def align(self, frame, coor_sub_2, com_sub_2, coor_sub_1, com_sub_1):
        '''
		Alignment of one object on top of another
		"self" is aligned onto "other" using the basis
		of molecule 2 to align onto the basis of molecule 1
		and the transformation is then done to all the atoms of
		molecule 2

		'''
        self.masscheck(frame)
        self.calccom(frame)

        u = sasmath.find_u(coor_sub_1, coor_sub_2)

        tao = numpy.transpose(self.coor()[frame] - com_sub_2)

        error, nat2 = sasmath.matrix_multiply(u, tao)

        ncoor = numpy.transpose(nat2) + com_sub_1

        self._coor[frame, :] = ncoor

        return
Exemple #4
0
	def align(self,frame,coor_sub_2,com_sub_2,coor_sub_1,com_sub_1):

		'''
		Alignment of one object on top of another
		"self" is aligned onto "other" using the basis
		of molecule 2 to align onto the basis of molecule 1
		and the transformation is then done to all the atoms of
		molecule 2

		'''
		self.masscheck(frame)
		self.calccom(frame)
	
		u = sasmath.find_u(coor_sub_1, coor_sub_2)

		tao = numpy.transpose(self.coor()[frame] - com_sub_2)

		error,nat2 = sasmath.matrix_multiply(u,tao)

		ncoor = numpy.transpose(nat2) + com_sub_1

		self._coor[frame,:] = ncoor
 
		return