Beispiel #1
0
    def test_qha(self):
        """Base tests for QHA3PF"""

        qha = QHA3PF.from_files(self.gsr_paths,
                                self.dos_paths[1:4],
                                ind_doses=[1, 2, 3])

        self.assertEqual(qha.nvols, len(self.strains))
        self.assertEqual(qha.natoms, 2)

        f = qha.fit_energies(tstart=0, tstop=300, num=3)
        self.assertArrayEqual(f.tot_en.shape, (len(self.strains), 3))
        self.assertAlmostEqual(f.min_en[0], -230.15433223031306, places=6)

        self.assertEqual(qha.eos._eos_name, "vinet")
        qha.set_eos("murnaghan")
        self.assertEqual(qha.eos._eos_name, "murnaghan")

        te = qha.get_thermal_expansion_coeff(num=4)
        self.assertAlmostEqual(te.values[1], 1.2773693323408941e-05)

        self.assertAlmostEqual(qha.get_vol_at_t(200),
                               41.10212044734946,
                               places=4)

        tmpdir = self.mkdtemp()
        qha.write_phonopy_qha_inputs(num=3, path=tmpdir)

        if self.has_matplotlib():
            assert qha.plot_energies(num=6, show=False)
            assert qha.plot_thermal_expansion_coeff(num=6, show=False)
            assert qha.plot_vol_vs_t(num=6, show=False)
Beispiel #2
0
    def test_qha(self):
        """Base tests for QHA3PF"""

        qha = QHA3PF.from_files(self.gsr_paths, self.dos_paths[1:4], ind_doses=[1, 2, 3])

        self.assertEqual(qha.nvols, len(self.strains))
        self.assertEqual(qha.natoms, 2)

        f = qha.fit_energies(tstart=0, tstop=300, num=3)
        self.assertArrayEqual(f.tot_en.shape, (len(self.strains), 3))
        self.assertAlmostEqual(f.min_en[0], -230.15433223031306, places=6)

        self.assertEqual(qha.eos._eos_name, "vinet")
        qha.set_eos("murnaghan")
        self.assertEqual(qha.eos._eos_name, "murnaghan")

        te = qha.get_thermal_expansion_coeff(num=4)
        self.assertAlmostEqual(te.values[1], 1.2773693323408941e-05)

        self.assertAlmostEqual(qha.get_vol_at_t(200), 41.10212044734946, places=4)

        tmpdir = self.mkdtemp()
        qha.write_phonopy_qha_inputs(num=3, path=tmpdir)

        if self.has_matplotlib():
            assert qha.plot_energies(num=6, show=False)
            assert qha.plot_thermal_expansion_coeff(num=6, show=False)
            assert qha.plot_vol_vs_t(num=6, show=False)
Beispiel #3
0
    def test_phonopy_object(self):
        self.skip_if_not_phonopy()

        qha = QHA3PF.from_files(self.gsr_paths, self.dos_paths[1:4], ind_doses=[1, 2, 3])

        from phonopy.qha import QHA as QHA_phonopy
        qha_ph = qha.get_phonopy_qha(tstop=500, num=11)
        self.assertIsInstance(qha_ph, QHA_phonopy)
        qha_ph.run()
        if self.has_matplotlib():
            qha_ph.plot_thermal_expansion()
Beispiel #4
0
    def test_phonopy_object(self):
        self.skip_if_not_phonopy()

        qha = QHA3PF.from_files(self.gsr_paths, self.dos_paths[1:4], ind_doses=[1, 2, 3])

        from phonopy.qha import QHA as QHA_phonopy
        qha_ph = qha.get_phonopy_qha(tstop=500, num=11)
        self.assertIsInstance(qha_ph, QHA_phonopy)
        qha_ph.run()
        if self.has_matplotlib():
            qha_ph.plot_thermal_expansion()