def rotate(self,R): """Performs rotation operation by the rotation matrix R.""" from BioNanoLEGO.DenseMatrix import dot # FIXME: this assignment is ugly in my opinion new_coords = dot(R,self.coords) self.coords = array([new_coords[0,0],new_coords[0,1],new_coords[0,2]]) return
def getDistance(self,other): """Calculates the distance between two atoms.""" from math import sqrt from BioNanoLEGO.DenseMatrix import dot # Displacement between two atoms disp_atoms = self.coords-other.coords return sqrt(dot(disp_atoms,disp_atoms))
def getSquareDist(self,other): """Calculates the square distance between two atoms.""" from BioNanoLEGO.DenseMatrix import dot # Displacement between two atoms disp_atoms = self.coords-other.coords return dot(disp_atoms,disp_atoms)