def test_geometric_center(self):
        """
        Test the geometric center calculation.

        Reference coordinates were calculated with g_traj. The output of the
        program is available in test_resources/center.xvg.
        """
        reference = (0.000216667, 0.00045, 5.00003e-05)
        resnames = ["C60"]
        path = os.path.join(REFDIR, "center.gro")
        lines = open(path).readlines()
        center = grw.geometric_center(lines, resnames)
        for ref, value in zip(reference, center):
            self.assertAlmostEqual(ref, value, PRECISION,
                                   ("Geometric center is wrong: "
                                    "{0} instead of {1}")
                                   .format(center, reference))
    def test_geometric_center(self):
        """
        Test the geometric center calculation.

        Reference coordinates were calculated with g_traj. The output of the
        program is available in test_resources/center.xvg.
        """
        reference = (0.000216667, 0.00045, 5.00003e-05)
        resnames = ["C60"]
        path = os.path.join(REFDIR, "center.gro")
        lines = open(path).readlines()
        center = grw.geometric_center(lines, resnames)
        for ref, value in zip(reference, center):
            self.assertAlmostEqual(ref, value, PRECISION,
                                   ("Geometric center is wrong: "
                                    "{0} instead of {1}").format(
                                        center, reference))
    def test_geometric_center(self):
        """
        Test the geometric center calculation.

        Reference coordinates were calculated with g_traj. The output of the
        program is available in test_resources/center.xvg.
        """
        reference = {"x": 0.000216667, "y": 0.00045, "z": 5.00003e-05}
        resids = [1]
        path = os.path.join(REFDIR, "center.gro")
        title, atoms, box = groIO.parse_file(path)

        center = grw.geometric_center(atoms, resids)

        for ref, value in zip(reference.values(), center[resids[0]].values()):
            self.assertAlmostEqual(ref, value, PRECISION,
                                   ("Geometric center is wrong: "
                                    "{0} instead of {1}").format(
                                        center, reference))
    def test_geometric_center(self):
        """
        Test the geometric center calculation.

        Reference coordinates were calculated with g_traj. The output of the
        program is available in test_resources/center.xvg.
        """
        reference = {"x": 0.000216667, "y": 0.00045, "z": 5.00003e-05}
        resids = [1]
        path = os.path.join(REFDIR, "center.gro")
        title, atoms, box = groIO.parse_file(path)

        center = grw.geometric_center(atoms, resids)

        for ref, value in zip(reference.values(), center[resids[0]].values()):
            self.assertAlmostEqual(ref, value, PRECISION,
                                   ("Geometric center is wrong: "
                                    "{0} instead of {1}")
                                   .format(center, reference))