Exemplo n.º 1
0
    def test_visualizers(self):
        print("Available visualizers:")
        for vclass in Visualizer.get_available():
            print(vclass)

        assert Xcrysden.support_ext("xsf") and Xcrysden.support_ext(".xsf")

        assert Vesta is Visualizer.from_name("vesta")
        assert Vesta.support_ext(
            "xsf") and "xsf" in Vesta.supported_extensions()
        #assert Vesta.from_file("foo.xsf")
        with self.assertRaises(Visualizer.Error):
            Visualizer.from_name("foobar")

        assert len(Visualizer.all_visunames())

        assert V_Sim.support_ext("xsf")

        for cls in [Xcrysden, V_Sim, Vesta, Ovito, Avogadro]:
            visu = cls("foo.xsf")
            assert callable(visu)
            repr(visu)
            str(visu)
            # cmdarg is a string?
            assert visu.cmdarg + " "
            assert visu.is_available in (True, False)
Exemplo n.º 2
0
    def test_visualizers(self):
        print("Available visualizers:")
        for vclass in Visualizer.get_available():
            print(vclass)

        assert Xcrysden.support_ext("xsf") and Xcrysden.support_ext(".xsf")

        assert Vesta is Visualizer.from_name("vesta")
        assert Vesta.support_ext(
            "xsf") and "xsf" in Vesta.supported_extensions()
        #assert Vesta.from_file("foo.xsf")

        assert V_Sim.support_ext("xsf")
Exemplo n.º 3
0
    def visualize_structure_with(self, visu_name):
        """
        Visualize the crystalline structure with the specified visualizer.

        See :class:`Visualizer` for the list of applications and formats supported.
        """
        visu = Visualizer.from_name(visu_name)

        for ext in visu.supported_extensions():
            ext = "." + ext
            try:
                return self.export_structure(ext)
            except visu.Error:
                pass
        else:
            raise visu.Error("Don't know how to export data for visu_name %s" % visu_name)
Exemplo n.º 4
0
Arquivo: mixins.py Projeto: w6ye/abipy
    def visualize_structure_with(self, appname):
        """
        Visualize the crystalline structure with the specified visualizer.

        See |Visualizer| for the list of applications and formats supported.
        """
        from abipy.iotools.visualizer import Visualizer
        visu = Visualizer.from_name(appname)

        for ext in visu.supported_extensions():
            ext = "." + ext
            try:
                return self.export_structure(ext)
            except visu.Error:
                pass
        else:
            raise visu.Error("Don't know how to export data for appname %s" % appname)