Пример #1
0
    def test_props(self):
        gau = self.gauout
        self.assertEqual(len(gau.energies), 3)
        self.assertAlmostEqual(gau.energies[-1], -39.9768775602)
        self.assertEqual(len(gau.structures), 4)
        for mol in gau.structures:
            self.assertEqual(mol.formula, "H4 C1")
        self.assertIn("opt", gau.route_parameters)
        self.assertEqual("Minimum", gau.stationary_type)
        self.assertEqual("hf", gau.functional)
        self.assertEqual("3-21G", gau.basis_set)
        self.assertEqual(17, gau.num_basis_func)
        d = gau.as_dict()
        self.assertEqual(d["input"]["functional"], "hf")
        self.assertAlmostEqual(d["output"]["final_energy"], -39.9768775602)
        self.assertEqual(len(gau.cart_forces), 3)
        self.assertEqual(gau.cart_forces[0][5], 0.009791094)
        self.assertEqual(gau.cart_forces[0][-1], -0.003263698)
        self.assertEqual(gau.cart_forces[2][-1], -0.000000032)
        self.assertEqual(gau.eigenvalues[Spin.up][-1], 1.95586)
        self.assertEqual(gau.num_basis_func, 17)
        self.assertEqual(gau.is_spin, False)

        ch2o_co2 = GaussianOutput(os.path.join(test_dir, "CH2O_CO2.log"))
        self.assertEqual(len(ch2o_co2.frequencies), 2)
        self.assertEqual(len(ch2o_co2.frequencies[0]), 6)
        self.assertEqual(len(ch2o_co2.frequencies[1]), 4)
        self.assertEqual(ch2o_co2.frequencies[0][0]["frequency"], 1203.1940)
        self.assertEqual(ch2o_co2.frequencies[0][0]["symmetry"], 'A"')
        self.assertEqual(ch2o_co2.frequencies[0][3]["IR_intensity"], 60.9575)
        self.assertEqual(ch2o_co2.frequencies[0][3]["r_mass"], 3.7543)
        self.assertEqual(ch2o_co2.frequencies[0][4]["f_constant"], 5.4175)
        self.assertListEqual(
            ch2o_co2.frequencies[0][1]["mode"],
            [
                0.15,
                0.00,
                0.00,
                -0.26,
                0.65,
                0.00,
                -0.26,
                -0.65,
                0.00,
                -0.08,
                0.00,
                0.00,
            ],
        )
        self.assertListEqual(
            ch2o_co2.frequencies[1][3]["mode"],
            [0.00, 0.00, 0.88, 0.00, 0.00, -0.33, 0.00, 0.00, -0.33],
        )
        self.assertEqual(ch2o_co2.frequencies[1][3]["symmetry"], "SGU")
        self.assertEqual(ch2o_co2.eigenvalues[Spin.up][3], -1.18394)

        h2o = GaussianOutput(os.path.join(test_dir, "H2O_gau_vib.out"))
        self.assertEqual(len(h2o.frequencies[0]), 3)
        self.assertEqual(h2o.frequencies[0][0]["frequency"], 1662.8033)
        self.assertEqual(h2o.frequencies[0][1]["symmetry"], "A'")
        self.assertEqual(h2o.hessian[0, 0], 0.356872)
        self.assertEqual(h2o.hessian.shape, (9, 9))
        self.assertEqual(
            h2o.hessian[8, :].tolist(),
            [
                -0.143692e-01,
                0.780136e-01,
                -0.362637e-01,
                -0.176193e-01,
                0.277304e-01,
                -0.583237e-02,
                0.319885e-01,
                -0.105744e00,
                0.420960e-01,
            ],
        )
Пример #2
0
 def test_td(self):
     gau = GaussianOutput(os.path.join(test_dir, "so2_td.log"))
     transitions = gau.read_excitation_energies()
     self.assertEqual(len(transitions), 4)
     self.assertAlmostEqual(transitions[0], (3.9281, 315.64, 0.0054))
Пример #3
0
 def setUp(self):
     self.gauout = GaussianOutput(os.path.join(test_dir, "methane.log"))