1#!/usr/bin/env python
2#
3# Author: Qiming Sun <osirpt.sun@gmail.com>
4#
5
6'''
7A simple example to run TDDFT with background charges.
8'''
9
10import numpy
11from pyscf import gto, scf, tddft, qmmm
12
13mol = gto.M(atom='''
14C       1.1879  -0.3829 0.0000
15C       0.0000  0.5526  0.0000
16O       -1.1867 -0.2472 0.0000
17H       -1.9237 0.3850  0.0000
18H       2.0985  0.2306  0.0000
19H       1.1184  -1.0093 0.8869
20H       1.1184  -1.0093 -0.8869
21H       -0.0227 1.1812  0.8852
22H       -0.0227 1.1812  -0.8852
23            ''',
24            basis='3-21g',
25            verbose=4)
26
27numpy.random.seed(1)
28coords = numpy.random.random((5,3)) * 10
29charges = (numpy.arange(5) + 1.) * -.1
30
31#
32# Background charges have to be patched to the underlying SCF calculaitons.
33#
34mf = scf.RHF(mol)
35mf = qmmm.mm_charge(mf, coords, charges).run()
36
37tddft.TDA(mf).run()
38
39tddft.TDHF(mf).run()
40
41