Exemplo n.º 1
0
    def test_B2PLYP_polar(self):

        from pkg_resources import resource_filename
        from pyxdh.Utilities.test_molecules import Mol_H2O2
        from pyxdh.Utilities import FormchkInterface
        from pyxdh.DerivOnce import DipoleMP2

        H2O2 = Mol_H2O2(xc="0.53*HF + 0.47*B88, 0.73*LYP")
        grids_cphf = H2O2.gen_grids(50, 194)
        config = {
            "scf_eng": H2O2.gga_eng,
            "cc": 0.27,
            "cphf_grids": grids_cphf
        }
        dip_helper = DipoleMP2(config)
        config = {"deriv_A": dip_helper, "deriv_B": dip_helper}
        helper = PolarMP2(config)
        E_2 = helper.E_2

        formchk = FormchkInterface(
            resource_filename("pyxdh",
                              "Validation/gaussian/H2O2-B2PLYP-freq.fchk"))
        assert (np.allclose(-E_2,
                            formchk.polarizability(),
                            atol=1e-6,
                            rtol=1e-4))
Exemplo n.º 2
0
    def test_MP2_polar(self):

        from pkg_resources import resource_filename
        from pyxdh.Utilities.test_molecules import Mol_H2O2
        from pyxdh.Utilities import FormchkInterface
        from pyxdh.DerivOnce import DipoleMP2

        H2O2 = Mol_H2O2()
        config = {"scf_eng": H2O2.hf_eng}
        dip_helper = DipoleMP2(config)
        config = {
            "deriv_A": dip_helper,
            "deriv_B": dip_helper,
        }

        helper = PolarMP2(config)
        E_2 = helper.E_2

        formchk = FormchkInterface(
            resource_filename("pyxdh",
                              "Validation/gaussian/H2O2-MP2-freq.fchk"))

        assert (np.allclose(-E_2,
                            formchk.polarizability(),
                            atol=1e-6,
                            rtol=1e-4))
Exemplo n.º 3
0
 def test_r_mp2_dipole(self):
     scf_eng = scf.RHF(self.mol).run()
     diph = DipoleMP2({"scf_eng": scf_eng})
     formchk = FormchkInterface(
         resource_filename("pyxdh",
                           "Validation/gaussian/NH3-MP2-freq.fchk"))
     # ASSERT: dipole - Gaussian
     assert np.allclose(diph.E_1, formchk.dipole(), atol=1e-6, rtol=1e-4)
Exemplo n.º 4
0
 def test_r_mp2_polar(self):
     scf_eng = scf.RHF(self.mol).run()
     diph = DipoleMP2({"scf_eng": scf_eng})
     polh = PolarMP2({"deriv_A": diph})
     formchk = FormchkInterface(
         resource_filename("pyxdh",
                           "Validation/gaussian/NH3-MP2-freq.fchk"))
     # ASSERT: polar - Gaussian
     assert np.allclose(-polh.E_2,
                        formchk.polarizability(),
                        atol=1e-6,
                        rtol=1e-4)
Exemplo n.º 5
0
 def test_r_mp2_dipderiv(self):
     scf_eng = scf.RHF(self.mol).run()
     gradh = GradMP2({"scf_eng": scf_eng})
     diph = DipoleMP2({"scf_eng": scf_eng})
     ddh = DipDerivMP2({"deriv_A": diph, "deriv_B": gradh})
     formchk = FormchkInterface(
         resource_filename("pyxdh",
                           "Validation/gaussian/NH3-MP2-freq.fchk"))
     # ASSERT: hessian - Gaussian
     assert np.allclose(ddh.E_2.T,
                        formchk.dipolederiv(),
                        atol=5e-6,
                        rtol=2e-4)
Exemplo n.º 6
0
 def test_r_b2plyp_dipole(self):
     scf_eng = dft.RKS(self.mol, xc="0.53*HF + 0.47*B88, 0.73*LYP")
     scf_eng.grids = self.grids
     scf_eng.run()
     diph = DipoleMP2({
         "scf_eng": scf_eng,
         "cc": 0.27,
         "cphf_grids": self.grids_cphf
     })
     formchk = FormchkInterface(
         resource_filename("pyxdh",
                           "Validation/gaussian/NH3-B2PLYP-freq.fchk"))
     # ASSERT: dipole - Gaussian
     assert np.allclose(diph.E_1, formchk.dipole(), atol=1e-6, rtol=1e-4)
Exemplo n.º 7
0
    def test_MP2_dipderiv(self):

        from pkg_resources import resource_filename
        from pyxdh.Utilities.test_molecules import Mol_H2O2
        from pyxdh.Utilities import FormchkInterface
        from pyxdh.DerivOnce import DipoleMP2, GradMP2

        H2O2 = Mol_H2O2()
        config = {"scf_eng": H2O2.hf_eng, "cphf_tol": 1e-10}
        dip_helper = DipoleMP2(config)
        grad_helper = GradMP2(config)
        config = {"deriv_A": dip_helper, "deriv_B": grad_helper}
        helper = DipDerivMP2(config)
        E_2 = helper.E_2

        formchk = FormchkInterface(resource_filename("pyxdh", "Validation/gaussian/H2O2-MP2-freq.fchk"))
        assert(np.allclose(E_2.T, formchk.dipolederiv(), atol=1e-6, rtol=1e-4))