Esempio n. 1
0
    def test_abicomp(self):
        """Testing abicomp"""
        env = self.get_env()

        cif_paths = abidata.cif_files("al.cif", "gan.cif", "gan2.cif")
        r = env.run(self.script, "structure", cif_paths[0], cif_paths[1], cif_paths[2], self.loglevel, self.verbose,
                    expect_stderr=self.expect_stderr)
        r = env.run(self.script, "structure", cif_paths[0], cif_paths[1], cif_paths[2], self.loglevel, self.verbose,
                    "--group", expect_stderr=self.expect_stderr)

        r = env.run(self.script, "spg", cif_paths[0], cif_paths[1], cif_paths[2], self.loglevel, self.verbose,
                    expect_stderr=self.expect_stderr)

        r = env.run(self.script, "mp_structure", cif_paths[0], cif_paths[1], self.loglevel, self.verbose,
                    expect_stderr=self.expect_stderr)

        dirpath = os.path.join(abidata.dirpath, "refs", "si_ebands")
        args = [os.path.join(dirpath, p) for p in ("si_nscf_GSR.nc", "si_scf_WFK.nc")]
        r = env.run(self.script, "ebands", args[0], args[1], self.loglevel, self.verbose,
                    expect_stderr=self.expect_stderr)

        args = [os.path.join(dirpath, p) for p in ("si_scf_GSR.nc", "si_scf_WFK.nc")]
        r = env.run(self.script, "edos", args[0], args[1], self.loglevel, self.verbose,
                    expect_stderr=self.expect_stderr)

        dirpath = os.path.join(abidata.dirpath, "refs", "znse_phonons")
        args = [os.path.join(dirpath, p) for p in ("ZnSe_hex_886.out_PHBST.nc", "ZnSe_hex_886.out_PHBST.nc")]
        r = env.run(self.script, "phbands", args[0], args[1], self.loglevel, self.verbose,
                    expect_stderr=self.expect_stderr)

        #dirpath = os.path.join(abidata.dirpath, "refs", "znse_phonons")
        args = abidata.ref_files("ZnSe_hex_886.out_PHDOS.nc", "trf2_5.out_PHDOS.nc")
        r = env.run(self.script, "phdos", args[0], args[1], self.loglevel, self.verbose,
                    expect_stderr=self.expect_stderr)

        #r = env.run(self.script, "attr", "energy", args[0], args[1], self.loglevel, self.verbose,
        #            expect_stderr=self.expect_stderr)

        paths = [p.filepath for p in abidata.pseudos("14si.pspnc", "B.psp8", "Al.GGA_PBE-JTH.xml")]
        r = env.run(self.script, "pseudos", paths[0], paths[1], paths[2], self.loglevel, self.verbose,
                    expect_stderr=self.expect_stderr)

        test_dir = os.path.join(os.path.dirname(__file__),  "..", 'test_files')
        args = [
            os.path.join(abidata.dirpath, "refs", "znse_phonons","ZnSe_hex_qpt_DDB"),
            os.path.join(test_dir, "AlAs_444_nobecs_DDB"),
        ]

        r = env.run(self.script, "ddb", args[0], args[1], self.loglevel, self.verbose,
                    expect_stderr=self.expect_stderr)

        args = abidata.ref_files("si_g0w0ppm_nband10_SIGRES.nc",
                                 "si_g0w0ppm_nband20_SIGRES.nc",
                                 "si_g0w0ppm_nband30_SIGRES.nc")
        r = env.run(self.script, "sigres", args[0], args[1], args[2], self.loglevel, self.verbose,
                    expect_stderr=self.expect_stderr)

        args = abidata.ref_files("si_444_MDF.nc", "si_666_MDF.nc", "si_888_MDF.nc")
        r = env.run(self.script, "mdf", args[0], args[1], args[2], self.loglevel, self.verbose,
                    expect_stderr=self.expect_stderr)
Esempio n. 2
0
    def test_abicomp(self):
        """Testing abicomp"""
        env = self.get_env()

        cif_paths = abidata.cif_files("al.cif", "gan.cif", "gan2.cif")
        r = env.run(self.script, "structure", cif_paths[0], cif_paths[1], cif_paths[2], self.loglevel, self.verbose,
                    expect_stderr=self.expect_stderr)
        r = env.run(self.script, "structure", cif_paths[0], cif_paths[1], cif_paths[2], self.loglevel, self.verbose,
                    "--group", expect_stderr=self.expect_stderr)

        r = env.run(self.script, "spg", cif_paths[0], cif_paths[1], cif_paths[2], self.loglevel, self.verbose,
                    expect_stderr=self.expect_stderr)

        r = env.run(self.script, "mp_structure", cif_paths[0], cif_paths[1], self.loglevel, self.verbose,
                    expect_stderr=self.expect_stderr)

        dirpath = os.path.join(abidata.dirpath, "refs", "si_ebands")
        args = [os.path.join(dirpath, p) for p in ("si_nscf_GSR.nc", "si_scf_WFK.nc")]
        r = env.run(self.script, "ebands", args[0], args[1], self.loglevel, self.verbose,
                    expect_stderr=self.expect_stderr)

        args = [os.path.join(dirpath, p) for p in ("si_scf_GSR.nc", "si_scf_WFK.nc")]
        r = env.run(self.script, "edos", args[0], args[1], self.loglevel, self.verbose,
                    expect_stderr=self.expect_stderr)

        dirpath = os.path.join(abidata.dirpath, "refs", "znse_phonons")
        args = [os.path.join(dirpath, p) for p in ("ZnSe_hex_886.out_PHBST.nc", "ZnSe_hex_886.out_PHBST.nc")]
        r = env.run(self.script, "phbands", args[0], args[1], self.loglevel, self.verbose,
                    expect_stderr=self.expect_stderr)

        #dirpath = os.path.join(abidata.dirpath, "refs", "znse_phonons")
        args = abidata.ref_files("ZnSe_hex_886.out_PHDOS.nc", "trf2_5.out_PHDOS.nc")
        r = env.run(self.script, "phdos", args[0], args[1], self.loglevel, self.verbose,
                    expect_stderr=self.expect_stderr)

        #r = env.run(self.script, "attr", "energy", args[0], args[1], self.loglevel, self.verbose,
        #            expect_stderr=self.expect_stderr)

        paths = [p.filepath for p in abidata.pseudos("14si.pspnc", "B.psp8", "Al.GGA_PBE-JTH.xml")]
        r = env.run(self.script, "pseudos", paths[0], paths[1], paths[2], self.loglevel, self.verbose,
                    expect_stderr=self.expect_stderr)

        test_dir = os.path.join(os.path.dirname(__file__),  "..", 'test_files')
        args = [
            os.path.join(abidata.dirpath, "refs", "znse_phonons","ZnSe_hex_qpt_DDB"),
            os.path.join(test_dir, "AlAs_444_nobecs_DDB"),
        ]

        r = env.run(self.script, "ddb", args[0], args[1], self.loglevel, self.verbose,
                    expect_stderr=self.expect_stderr)

        args = abidata.ref_files("si_g0w0ppm_nband10_SIGRES.nc",
                                 "si_g0w0ppm_nband20_SIGRES.nc",
                                 "si_g0w0ppm_nband30_SIGRES.nc")
        r = env.run(self.script, "sigres", args[0], args[1], args[2], self.loglevel, self.verbose,
                    expect_stderr=self.expect_stderr)

        args = abidata.ref_files("si_444_MDF.nc", "si_666_MDF.nc", "si_888_MDF.nc")
        r = env.run(self.script, "mdf", args[0], args[1], args[2], self.loglevel, self.verbose,
                    expect_stderr=self.expect_stderr)
Esempio n. 3
0
    def test_htmldiff(self):
        """Testing HtmlDiff."""
        filepaths = abidata.cif_files("si.cif", "al.cif", "gan.cif")
        diff = HtmlDiff(filepaths)

        # patch _launch_browser
        def _launch_browser(*args, **kwargs): return "patched"
        diff._launch_browser = _launch_browser
        assert diff.open_browser() == "patched"
        # This requires pygmentize package.
        retcode = diff.open_browser(diffmode="pygmentize")
Esempio n. 4
0
    def test_htmldiff(self):
        """Testing HtmlDiff."""
        filepaths = abidata.cif_files("si.cif", "al.cif", "gan.cif")
        diff = HtmlDiff(filepaths)

        # patch _launch_browser
        def _launch_browser(*args, **kwargs): return "patched"
        diff._launch_browser = _launch_browser
        assert diff.open_browser() == "patched"
        # This requires pygmentize package.
        retcode = diff.open_browser(diffmode="pygmentize")