forked from MatthewRHermes/mrh
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'dev' of https://github.com/MatthewRHermes/mrh into gpudev
- Loading branch information
Showing
4 changed files
with
97 additions
and
45 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,36 +1,48 @@ | ||
import sys | ||
from pyscf import gto, scf, tools, dft, lib | ||
from mrh.my_pyscf.mcscf.lasscf_o0 import LASSCF | ||
from mrh.my_dmet import localintegrals, dmet, fragments | ||
from mrh.my_pyscf import mcpdft | ||
import unittest | ||
from pyscf import lib, gto, scf | ||
from mrh.my_pyscf.mcscf.lasscf_o0 import LASSCF | ||
from mrh.my_pyscf.lassi import LASSI | ||
from mrh.my_pyscf.lassi.states import all_single_excitations | ||
from mrh.my_pyscf.mcscf.lasci import get_space_info | ||
|
||
class KnownValues(unittest.TestCase): | ||
def test_ethene (self): | ||
mol = gto.M() | ||
mol.atom = '''C -0.662958 0.000000 0.000000; | ||
C 0.662958 0.000000 0.000000; | ||
H -1.256559 -0.924026 0.000000; | ||
H 1.256559 -0.924026 0.000000; | ||
H -1.256559 0.924026 0.000000; | ||
H 1.256559 0.924026 0.000000''' | ||
mol.basis='sto3g' | ||
mol.verbose = 0 | ||
mol.output = '/dev/null' | ||
mol.build() | ||
mf = scf.ROHF(mol).newton().run() | ||
mc = mcpdft.LASSI(mf, 'tPBE', (2, ), (2, ), grid_level=1).state_average( | ||
[1, 0], spins=[[0,], [2, ]], smults=[[1, ], [3, ]], charges=[[0, ],[0, ]]) | ||
mo0 = mc.localize_init_guess(([0, 1],), mc.sort_mo([8, 9])) | ||
mc.kernel(mo0) | ||
elassi = mc.e_mcscf[0] | ||
epdft = mc.e_tot[0] | ||
self.assertAlmostEqual (elassi , -77.1154672717181, 7) # Reference values of CASSCF and CAS-PDFT | ||
self.assertAlmostEqual (epdft , -77.49805221093968, 7) | ||
xyz='''H 0 0 0 | ||
H 1 0 0 | ||
H 3 0 0 | ||
H 4 0 0''' | ||
|
||
mol = gto.M (atom=xyz, basis='sto3g', symmetry=False, verbose=0, output='/dev/null') | ||
mf = scf.RHF (mol).run () | ||
|
||
# LASSCF and LASSI | ||
las = LASSCF (mf, (2,2), (2,2), spin_sub=(1,1)) | ||
las.lasci () | ||
las1 = las | ||
for i in range (2): las1 = all_single_excitations (las1) | ||
charges, spins, smults, wfnsyms = get_space_info (las1) | ||
lroots = 4 - smults | ||
idx = (charges!=0) & (lroots==3) | ||
lroots[idx] = 1 | ||
las1.conv_tol_grad = las.conv_tol_self = 9e99 | ||
las1.lasci (lroots=lroots.T) | ||
las1.dump_spaces () | ||
lsi = LASSI (las1) | ||
lsi.kernel (opt=0) | ||
|
||
from mrh.my_pyscf import mcpdft | ||
lsipdft = mcpdft.LASSI(lsi, 'tPBE', (2,2), (2,2)) | ||
lsipdft.kernel() | ||
|
||
# CASCI limit | ||
from pyscf import mcpdft | ||
mc = mcpdft.CASCI (mf, 'tPBE', 4, 4).run () | ||
|
||
self.assertAlmostEqual (lsi.e_roots[0], mc.e_mcscf, 7) | ||
self.assertAlmostEqual (lsipdft.e_tot[0], mc.e_tot, 7) | ||
|
||
if __name__ == "__main__": | ||
print("Full Tests for LASSI-PDFT") | ||
unittest.main() | ||
|
||
|
||
|