/
test_hardcoded.py
53 lines (50 loc) · 2.14 KB
/
test_hardcoded.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
#!/usr/bin/env python3
## vi: tabstop=4 shiftwidth=4 softtabstop=4 expandtab
## ---------------------------------------------------------------------
##
## Copyright (C) 2020 by the adcc authors
##
## This file is part of adcc.
##
## adcc is free software: you can redistribute it and/or modify
## it under the terms of the GNU General Public License as published
## by the Free Software Foundation, either version 3 of the License, or
## (at your option) any later version.
##
## adcc is distributed in the hope that it will be useful,
## but WITHOUT ANY WARRANTY; without even the implied warranty of
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
## GNU General Public License for more details.
##
## You should have received a copy of the GNU General Public License
## along with adcc. If not, see <http://www.gnu.org/licenses/>.
##
## ---------------------------------------------------------------------
import adcc
import unittest
import numpy as np
from adcc.testdata.cache import cache
class TestHardCodedCisResults(unittest.TestCase):
def test_methox_sto3g_singlet(self):
vlx_result = {
'excitation_energies': np.array(
[0.37722854, 0.42890135, 0.50227467, 0.52006496,
0.55583901, 0.59846662]
),
'rotatory_strengths': np.array(
[-0.00170464, 0.00191897, 0.02054426, -0.00429405,
0.04966345, 0.03289564]
),
'oscillator_strengths': np.array(
[1.93724710e-04, 1.29809765e-03, 3.28195555e-01,
2.55565534e-02, 3.10309645e-01, 1.43808081e-02]
)
}
hf = cache.hfdata["methox_sto3g"]
state = adcc.cis(hf, n_singlets=6, conv_tol=1e-8)
np.testing.assert_allclose(vlx_result['excitation_energies'],
state.excitation_energy, atol=1e-6)
np.testing.assert_allclose(vlx_result['rotatory_strengths'],
state.rotatory_strength, atol=1e-4)
np.testing.assert_allclose(vlx_result['oscillator_strengths'],
state.oscillator_strength, atol=1e-4)