1#!/usr/bin/env python 2# Copyright 2014-2020 The PySCF Developers. All Rights Reserved. 3# 4# Licensed under the Apache License, Version 2.0 (the "License"); 5# you may not use this file except in compliance with the License. 6# You may obtain a copy of the License at 7# 8# http://www.apache.org/licenses/LICENSE-2.0 9# 10# Unless required by applicable law or agreed to in writing, software 11# distributed under the License is distributed on an "AS IS" BASIS, 12# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13# See the License for the specific language governing permissions and 14# limitations under the License. 15# 16# Author: Qiming Sun <osirpt.sun@gmail.com> 17# 18 19from pyscf.tdscf import rks 20from pyscf.pbc.tdscf.rhf import TDA 21from pyscf.pbc.tdscf.rhf import TDHF as TDDFT 22from pyscf import lib 23 24RPA = TDRKS = TDDFT 25 26class TDDFTNoHybrid(rks.TDDFTNoHybrid): 27 def gen_vind(self, mf): 28 vind, hdiag = rks.TDDFTNoHybrid.gen_vind(self, mf) 29 def vindp(x): 30 with lib.temporary_env(mf, exxdiv=None): 31 return vind(x) 32 return vindp, hdiag 33 34 def nuc_grad_method(self): 35 raise NotImplementedError 36 37def tddft(mf): 38 '''Driver to create TDDFT or TDDFTNoHybrid object''' 39 if mf._numint.libxc.is_hybrid_xc(mf.xc): 40 return TDDFT(mf) 41 else: 42 return TDDFTNoHybrid(mf) 43 44from pyscf.pbc import dft 45dft.rks.RKS.TDA = lib.class_as_method(TDA) 46dft.rks.RKS.TDHF = None 47dft.rks.RKS.TDDFT = tddft 48#dft.rks.RKS.dTDA = lib.class_as_method(dTDA) 49#dft.rks.RKS.dRPA = lib.class_as_method(dRPA) 50 51