Exemplo n.º 1
0
 def valid_assert(dip_helper, grad_helper, resource_path):
     from pkg_resources import resource_filename
     from pyxdh.Utilities import FormchkInterface
     dipderiv_config = {"deriv_A": dip_helper, "deriv_B": grad_helper}
     helper = DipDerivSCF(dipderiv_config)
     E_2 = helper.E_2
     formchk = FormchkInterface(resource_filename("pyxdh", resource_path))
     assert (np.allclose(E_2.T, formchk.dipolederiv(), atol=1e-6,
                         rtol=1e-4))
Exemplo n.º 2
0
 def test_r_rhf_dipderiv(self):
     scf_eng = scf.RHF(self.mol).run()
     gradh = GradSCF({"scf_eng": scf_eng})
     diph = DipoleSCF({"scf_eng": scf_eng})
     ddh = DipDerivSCF({"deriv_A": diph, "deriv_B": gradh})
     formchk = FormchkInterface(
         resource_filename("pyxdh", "Validation/gaussian/NH3-HF-freq.fchk"))
     # ASSERT: hessian - Gaussian
     assert np.allclose(ddh.E_2.T,
                        formchk.dipolederiv(),
                        atol=5e-6,
                        rtol=2e-4)
Exemplo n.º 3
0
 def test_r_b3lyp_dipderiv(self):
     scf_eng = dft.RKS(self.mol, xc="B3LYPg")
     scf_eng.grids = self.grids
     scf_eng.run()
     gradh = GradSCF({"scf_eng": scf_eng, "cphf_grids": self.grids_cphf})
     diph = DipoleSCF({"scf_eng": scf_eng, "cphf_grids": self.grids_cphf})
     ddh = DipDerivSCF({"deriv_A": diph, "deriv_B": gradh})
     formchk = FormchkInterface(
         resource_filename("pyxdh",
                           "Validation/gaussian/NH3-B3LYP-freq.fchk"))
     # ASSERT: hessian - Gaussian
     assert np.allclose(ddh.E_2.T,
                        formchk.dipolederiv(),
                        atol=5e-6,
                        rtol=2e-4)
Exemplo n.º 4
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))
Exemplo n.º 5
0
    def test_B2PLYP_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(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)
        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-B2PLYP-freq.fchk"))
        assert(np.allclose(E_2.T, formchk.dipolederiv(), atol=1e-6, rtol=1e-4))
Exemplo n.º 6
0
 def test_r_xyg3_dipderiv(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
     }
     gradh = GradXDH(config)
     diph = DipoleXDH(config)
     ddh = DipDerivXDH({"deriv_A": diph, "deriv_B": gradh})
     formchk = FormchkInterface(
         resource_filename("pyxdh",
                           "Validation/gaussian/NH3-XYG3-freq.fchk"))
     # ASSERT: hessian - Gaussian
     np.allclose(ddh.E_2.T, formchk.dipolederiv(), atol=5e-6, rtol=2e-4)
Exemplo n.º 7
0
 def test_r_xygjos_dipderiv(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
     }
     gradh = GradXDH(config)
     diph = DipoleXDH(config)
     ddh = DipDerivXDH({"deriv_A": diph, "deriv_B": gradh})
     formchk = FormchkInterface(
         resource_filename("pyxdh",
                           "Validation/gaussian/NH3-XYGJOS-freq.fchk"))
     # ASSERT: hessian - Gaussian
     np.allclose(ddh.E_2.T, formchk.dipolederiv(), atol=5e-6, rtol=2e-4)