def test_translate(self): atom1 = Atom(2, 'C', '', 'A', 'ALA', x=2., y=2., z=2.) atom2 = Atom(2, 'C', '', 'A', 'ALA', x=0., y=0., z=0.) residue = Residue('ALA', 1, [atom1, atom2]) chains = [Chain('A', [residue])] protein = Complex(chains) com = protein.center_of_mass() protein.translate([c * -1 for c in com]) expected_coordinates = np.array([[1, 1, 1], [-1, -1, -1]]) assert (expected_coordinates == protein.atom_coordinates).all()
def test_translate(self): atom1 = Atom(2, 'C', '', 'A', 'ALA', x=2., y=2., z=2.) atom2 = Atom(2, 'C', '', 'A', 'ALA', x=0., y=0., z=0.) residue = Residue('ALA',1, [atom1, atom2]) chains = [Chain('A',[residue])] protein = Complex(chains) com = protein.center_of_mass() protein.translate([c*-1 for c in com]) expected_coordinates = np.array([[1,1,1],[-1,-1,-1]]) assert (expected_coordinates == protein.atom_coordinates).all()
def test_center_of_mass(self): protein = Complex(chains=self.chains) com = protein.center_of_mass() assert_almost_equals(1.8037228011238935, com[0]) assert_almost_equals(1.7998854581864723, com[1]) assert_almost_equals(1.7960481152490517, com[2])
def test_center_of_mass_empty_complex(self): protein = Complex([]) com = protein.center_of_mass() assert_almost_equals(0., com[0]) assert_almost_equals(0., com[1]) assert_almost_equals(0., com[2])
def test_center_of_mass_empty_complex(self): protein = Complex([]) com = protein.center_of_mass() assert_almost_equals(0., com[0]) assert_almost_equals(0., com[1]) assert_almost_equals(0., com[2])
def test_center_of_mass(self): protein = Complex(chains=self.chains) com = protein.center_of_mass() assert_almost_equals(1.8037228011238935, com[0]) assert_almost_equals(1.7998854581864723, com[1]) assert_almost_equals(1.7960481152490517, com[2])