def test_tda_b88(self):
     mf = dft.RKS(mol)
     mf.xc = 'b88'
     mf.grids.prune = False
     mf.scf()
     td = tddft.TDA(mf).run(nstates=3)
     tdg = rks_grad.Gradients(td)
     g1 = tdg.kernel(state=2)
     self.assertAlmostEqual(g1[0,2], -9.32506535e-02, 8)
Exemple #2
0
 def test_tda_lda(self):
     mf = dft.RKS(mol)
     mf.xc = 'LDA'
     mf.grids.prune = False
     mf.scf()
     td = tddft.TDA(mf).run(nstates=3)
     tdg = rks_grad.Gradients(td)
     g1 = tdg.kernel(state=2)
     self.assertAlmostEqual(g1[0,2], -9.23916667e-02, 9)
Exemple #3
0
    # [[ 0  0  -1.31315477e-01]
    #  [ 0  0   1.31319442e-01]]
    td_solver = td.as_scanner()
    e1 = td_solver(mol.set_geom_('H 0 0 1.805; F 0 0 0', unit='B'))
    e2 = td_solver(mol.set_geom_('H 0 0 1.803; F 0 0 0', unit='B'))
    print(abs((e1[2] - e2[2]) / .002 - g1[0, 2]).max())

    mol.set_geom_('H 0 0 1.804; F 0 0 0', unit='B')
    mf = dft.RKS(mol)
    mf.xc = 'b3lyp'
    mf._numint.libxc = dft.xcfun
    mf.grids.prune = False
    mf.conv_tol = 1e-14
    mf.scf()

    td = tddft.TDA(mf)
    td.nstates = 3
    e, z = td.kernel()
    tdg = Gradients(td)
    g1 = tdg.kernel(state=3)
    print(g1)
    # [[ 0  0  -1.21504524e-01]
    #  [ 0  0   1.21505341e-01]]
    td_solver = td.as_scanner()
    e1 = td_solver(mol.set_geom_('H 0 0 1.805; F 0 0 0', unit='B'))
    e2 = td_solver(mol.set_geom_('H 0 0 1.803; F 0 0 0', unit='B'))
    print(abs((e1[2] - e2[2]) / .002 - g1[0, 2]).max())

    mol.set_geom_('H 0 0 1.804; F 0 0 0', unit='B')
    mf = dft.RKS(mol)
    mf.xc = 'lda,'
Exemple #4
0
import numpy
from pyscf import gto, scf, ci, mcscf, tddft, qmmm

mol = gto.M(atom='''
C       1.1879  -0.3829 0.0000
C       0.0000  0.5526  0.0000
O       -1.1867 -0.2472 0.0000
H       -1.9237 0.3850  0.0000
H       2.0985  0.2306  0.0000
H       1.1184  -1.0093 0.8869
H       1.1184  -1.0093 -0.8869
H       -0.0227 1.1812  0.8852
H       -0.0227 1.1812  -0.8852
            ''',
            basis='3-21g')

numpy.random.seed(1)
coords = numpy.random.random((5, 3)) * 10
charges = (numpy.arange(5) + 1.) * -.1

mf = qmmm.mm_charge(scf.RHF(mol), coords, charges).run()

mf.nuc_grad_method().run()

ci.CISD(mf).run().nuc_grad_method().run()

mc = mcscf.CASCI(mf, 6, 6).run()
mc.nuc_grad_method().run()

tddft.TDA(mf).run().nuc_grad_method().run(state=2)
Exemple #5
0
import numpy
from pyscf import gto, scf, tddft, qmmm

mol = gto.M(atom='''
C       1.1879  -0.3829 0.0000
C       0.0000  0.5526  0.0000
O       -1.1867 -0.2472 0.0000
H       -1.9237 0.3850  0.0000
H       2.0985  0.2306  0.0000
H       1.1184  -1.0093 0.8869
H       1.1184  -1.0093 -0.8869
H       -0.0227 1.1812  0.8852
H       -0.0227 1.1812  -0.8852
            ''',
            basis='3-21g',
            verbose=4)

numpy.random.seed(1)
coords = numpy.random.random((5, 3)) * 10
charges = (numpy.arange(5) + 1.) * -.1

#
# Background charges have to be patched to the underlying SCF calculaitons.
#
mf = scf.RHF(mol)
mf = qmmm.mm_charge(mf, coords, charges).run()

tddft.TDA(mf).run()

tddft.TDHF(mf).run()