Debian Codegraph @

test/bridge/testbiopython.py

raw
1 # -*- coding: utf-8 -*-
2 #
3 # Copyright (c) 2018, the cclib development team
4 #
5 # This file is part of cclib (http://cclib.github.io) and is distributed under
6 # the terms of the BSD 3-Clause License.
7
8 import unittest
9
10 import numpy
11
12 from cclib.bridge import cclib2biopython
13
14
15 class BiopythonTest(unittest.TestCase):
16 """Tests for the cclib2biopython bridge in cclib."""
17
18 def test_makebiopython(self):
19 from Bio.PDB.Superimposer import Superimposer
20 atomnos = numpy.array([1, 8, 1], "i")
21 a = numpy.array([[-1, 1, 0], [0, 0, 0], [1, 1, 0]], "f")
22 b = numpy.array([[1.1, 2, 0], [1, 1, 0], [2, 1, 0]], "f")
23 si = Superimposer()
24 si.set_atoms(cclib2biopython.makebiopython(a, atomnos),
25 cclib2biopython.makebiopython(b, atomnos))
26 ref = 0.29337859596
27 assert abs(si.rms - ref) < 1.0e-6
28
29
30 if __name__ == "__main__":
31 unittest.main()