Beispiel #1
0
 def test_r_rhf_dipole(self):
     scf_eng = scf.RHF(self.mol).run()
     diph = DipoleSCF({"scf_eng": scf_eng})
     formchk = FormchkInterface(
         resource_filename("pyxdh", "Validation/gaussian/NH3-HF-freq.fchk"))
     # ASSERT: dipole - Gaussian
     assert np.allclose(diph.E_1, formchk.dipole(), atol=1e-6, rtol=1e-4)
Beispiel #2
0
 def valid_assert(config, resource_path):
     from pkg_resources import resource_filename
     from pyxdh.Utilities import FormchkInterface
     helper = DipoleSCF(config)
     assert (np.allclose(helper.E_1, helper.scf_eng.dip_moment(unit="A.U."), atol=1e-6, rtol=1e-4))
     formchk = FormchkInterface(resource_filename("pyxdh", resource_path))
     assert (np.allclose(helper.E_1, formchk.dipole(), atol=1e-6, rtol=1e-4))
Beispiel #3
0
 def test_r_b3lyp_dipole(self):
     scf_eng = dft.RKS(self.mol, xc="B3LYPg")
     scf_eng.grids = self.grids
     scf_eng.run()
     diph = DipoleSCF({"scf_eng": scf_eng})
     formchk = FormchkInterface(
         resource_filename("pyxdh",
                           "Validation/gaussian/NH3-B3LYP-freq.fchk"))
     # ASSERT: dipole - Gaussian
     assert np.allclose(diph.E_1, formchk.dipole(), atol=1e-6, rtol=1e-4)
Beispiel #4
0
 def test_u_uhf_dipole(self):
     scf_eng = scf.UHF(self.mol)
     scf_eng.conv_tol_grad = 1e-10
     scf_eng.max_cycle = 128
     scf_eng.run()
     diph = DipoleUSCF({"scf_eng": scf_eng})
     formchk = FormchkInterface(
         resource_filename("pyxdh", "Validation/gaussian/CH3-HF-freq.fchk"))
     # ASSERT: dipole - Gaussian
     assert np.allclose(diph.E_1, formchk.dipole(), atol=1e-6, rtol=1e-4)
Beispiel #5
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)
Beispiel #6
0
    def test_B2PLYP_dipole(self):

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

        H2O2 = Mol_H2O2(xc="0.53*HF + 0.47*B88, 0.73*LYP")
        config = {"scf_eng": H2O2.gga_eng, "cc": 0.27}
        helper = DipoleMP2(config)

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

        assert (np.allclose(helper.E_1, formchk.dipole(), atol=1e-6,
                            rtol=1e-4))
Beispiel #7
0
    def test_MP2_dipole(self):

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

        H2O2 = Mol_H2O2()
        config = {"scf_eng": H2O2.hf_eng}
        helper = DipoleMP2(config)

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

        assert (np.allclose(helper.E_1, formchk.dipole(), atol=1e-6,
                            rtol=1e-4))
Beispiel #8
0
 def test_r_xyg3_dipole(self):
     scf_eng = dft.RKS(self.mol, xc="B3LYPg")
     scf_eng.grids = self.grids
     scf_eng.run()
     nc_eng = dft.RKS(self.mol,
                      xc="0.8033*HF - 0.0140*LDA + 0.2107*B88, 0.6789*LYP")
     nc_eng.grids = self.grids
     config = {
         "scf_eng": scf_eng,
         "nc_eng": nc_eng,
         "cc": 0.3211,
         "cphf_grids": self.grids_cphf
     }
     diph = DipoleXDH(config)
     formchk = FormchkInterface(
         resource_filename("pyxdh",
                           "Validation/gaussian/NH3-XYG3-freq.fchk"))
     # ASSERT: grad - Gaussian
     assert np.allclose(diph.E_1, formchk.dipole(), atol=1e-6, rtol=1e-4)
Beispiel #9
0
 def test_r_xygjos_dipole(self):
     scf_eng = dft.RKS(self.mol, xc="B3LYPg")
     scf_eng.grids = self.grids
     scf_eng.run()
     nc_eng = dft.RKS(self.mol,
                      xc="0.7731*HF + 0.2269*LDA, 0.2309*VWN3 + 0.2754*LYP")
     nc_eng.grids = self.grids
     config = {
         "scf_eng": scf_eng,
         "nc_eng": nc_eng,
         "cc": 0.4364,
         "ss": 0.,
         "cphf_grids": self.grids_cphf
     }
     diph = DipoleXDH(config)
     formchk = FormchkInterface(
         resource_filename("pyxdh",
                           "Validation/gaussian/NH3-XYGJOS-freq.fchk"))
     # ASSERT: grad - Gaussian
     assert np.allclose(diph.E_1, formchk.dipole(), atol=1e-6, rtol=1e-4)
Beispiel #10
0
    def test_XYG3_dipole(self):

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

        H2O2_sc = Mol_H2O2(xc="B3LYPg")
        H2O2_nc = Mol_H2O2(
            xc="0.8033*HF - 0.0140*LDA + 0.2107*B88, 0.6789*LYP")

        config = {
            "scf_eng": H2O2_sc.gga_eng,
            "nc_eng": H2O2_nc.gga_eng,
            "cc": 0.3211
        }

        dmh = DipoleXDH(config)

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

        assert (np.allclose(dmh.E_1, formchk.dipole(), atol=1e-6, rtol=1e-4))
Beispiel #11
0
 def valid_assert(helper, resource_path):
     from pkg_resources import resource_filename
     from pyxdh.Utilities import FormchkInterface
     formchk = FormchkInterface(resource_filename("pyxdh", resource_path))
     assert (np.allclose(helper.E_1, formchk.dipole(), atol=1e-6,
                         rtol=1e-4))