コード例 #1
0
ファイル: test_rhf.py プロジェクト: changsuc/pyscf
    def test_giao_vs_nmr(self):
        mol = gto.Mole()
        mol.verbose = 7
        mol.output = '/dev/null'
        mol.atom = '''h  ,  0.   0.   0.917
                      f  ,  0.   0.   0.
                      '''
        mol.basis = 'dzp'
        mol.build()
        mf = scf.RHF(mol).run()
        m = rhf.NSR(mf).kernel()

        im, mass_center = rhf.inertia_tensor(mol)
        unit_ppm = nist.ALPHA**2 * 1e6
        unit = rhf._atom_gyro_list(mol) * nist.ALPHA**2
        m_nuc = rhf.nuc(mol, [0, 1])

        atm_id = 0
        atom_coords = mol.atom_coords()
        m1 = nmr.RHF(mf).kernel()[atm_id] / unit_ppm
        m2 = nmr.RHF(mf).dia(gauge_orig=atom_coords[atm_id])[atm_id]
        m3 = rhf._safe_solve(im, m1 - m2) * 2 * unit[atm_id]
        m_ref = (m3 + m_nuc[atm_id]) * rhf.AU2KHZ
        self.assertAlmostEqual(abs(m[atm_id] - m_ref).max(), 0, 9)

        atm_id = 1
        atom_coords = mol.atom_coords()
        m1 = nmr.RHF(mf).kernel()[atm_id] / unit_ppm
        m2 = nmr.RHF(mf).dia(gauge_orig=atom_coords[atm_id])[atm_id]
        m3 = rhf._safe_solve(im, m1 - m2) * 2 * unit[atm_id]
        m_ref = (m3 + m_nuc[atm_id]) * rhf.AU2KHZ
        self.assertAlmostEqual(abs(m[atm_id] - m_ref).max(), 0, 9)
コード例 #2
0
 def test_nr_giao_cpscf(self):
     m = nmr.RHF(nrhf)
     m.cphf = True
     m.gauge_orig = None
     msc = m.shielding()
     self.assertAlmostEqual(finger(msc), 1358.9826064972372, 5)
コード例 #3
0
 def test_nr_giao_ucpscf(self):
     m = nmr.RHF(nrhf)
     m.cphf = False
     m.gauge_orig = None
     msc = m.shielding()
     self.assertAlmostEqual(finger(msc), 1488.0948832784416, 5)
コード例 #4
0
 def test_nr_common_gauge_cpscf(self):
     m = nmr.RHF(nrhf)
     m.cphf = True
     m.gauge_orig = (1, 1, 1)
     msc = m.shielding()
     self.assertAlmostEqual(finger(msc), 1562.3859473764551, 5)
コード例 #5
0
 def test_nr_common_gauge_ucpscf(self):
     m = nmr.RHF(nrhf)
     m.cphf = False
     m.gauge_orig = (1, 1, 1)
     msc = m.shielding()
     self.assertAlmostEqual(finger(msc), 1636.7413165636394, 5)