3
3
from forte import det
4
4
5
5
6
- def test_determinant_hilber_space ():
6
+ def test_determinant_hilbert_space ():
7
7
dets = forte .hilbert_space (2 , 1 , 1 )
8
8
# compare with the expected result of the determinant
9
9
expected = [det ("20" ), det ("+-" ), det ("-+" ), det ("02" )]
10
10
assert len (dets ) == 4
11
11
assert sorted (dets ) == sorted (expected )
12
12
13
+ # non-aufbau case
14
+ ref = det ("002" )
15
+ dets = forte .hilbert_space (3 , 1 , 1 , ref , truncation = 2 )
16
+ expected = [
17
+ det ("002" ),
18
+ det ("0+-" ),
19
+ det ("0-+" ),
20
+ det ("+0-" ),
21
+ det ("-0+" ),
22
+ det ("020" ),
23
+ det ("200" ),
24
+ det ("+-0" ),
25
+ det ("-+0" ),
26
+ ]
27
+ assert len (dets ) == 9
28
+ assert sorted (dets ) == sorted (expected )
29
+
30
+ ref = det ("0+-" )
31
+ dets = forte .hilbert_space (3 , 1 , 1 , ref , truncation = 1 )
32
+ expected = [det ("0+-" ), det ("-+0" ), det ("+0-" ), det ("002" ), det ("020" )]
33
+ assert len (dets ) == 5
34
+ assert sorted (dets ) == sorted (expected )
35
+
36
+ ref = det ("20" )
37
+ dets = forte .hilbert_space (2 , 1 , 1 , ref , truncation = 1 )
38
+ # compare with the expected result of the determinant
39
+ expected = [det ("20" ), det ("+-" ), det ("-+" )]
40
+ assert len (dets ) == 3 , dets
41
+ assert sorted (dets ) == sorted (expected )
42
+
13
43
dets = forte .hilbert_space (2 , 1 , 1 , nirrep = 2 , mo_symmetry = [0 , 1 ], symmetry = 0 )
14
44
# compare with the expected result of the determinant
15
45
expected = [det ("20" ), det ("02" )]
@@ -22,12 +52,29 @@ def test_determinant_hilber_space():
22
52
assert len (dets ) == 2
23
53
assert sorted (dets ) == sorted (expected )
24
54
55
+ ref = det ("22000" )
56
+ dets = forte .hilbert_space (5 , 2 , 2 , ref , truncation = 1 , nirrep = 4 , mo_symmetry = [0 , 1 , 2 , 3 , 0 ], symmetry = 2 )
57
+ # compare with the expected result of the determinant
58
+ expected = [det ("2+0-0" ), det ("2-0+0" ), det ("+2-00" ), det ("-2+00" )]
59
+ assert len (dets ) == 4
60
+ assert sorted (dets ) == sorted (expected )
61
+
25
62
# test with the case of 6 electrons and 6 orbitals
26
63
dets = forte .hilbert_space (6 , 3 , 3 , 8 , [0 , 2 , 3 , 5 , 6 , 7 ], 0 )
27
64
assert len (dets ) == 56
28
65
66
+ # test with the case of 6 electrons and 7 orbitals, truncated to 2 excitations
67
+ ref = det ("2220000" )
68
+ dets = forte .hilbert_space (7 , 3 , 3 , ref , truncation = 2 )
69
+ assert len (dets ) == 205
70
+
71
+ # test with the case of 16 electrons and 18 orbitals, truncated to 3 excitations
72
+ ref = det ("2" * 8 + "0" * 10 )
73
+ dets = forte .hilbert_space (18 , 8 , 8 , ref , truncation = 3 )
74
+ assert len (dets ) == 224121
29
75
30
- def test_determinant_hilber_space_edge_cases ():
76
+
77
+ def test_determinant_hilbert_space_edge_cases ():
31
78
dets = forte .hilbert_space (1 , 1 , 1 )
32
79
# compare with the expected result of the determinant
33
80
expected = [det ("2" )]
@@ -57,7 +104,14 @@ def test_determinant_hilber_space_edge_cases():
57
104
assert len (dets ) == 6
58
105
assert sorted (dets ) == sorted (expected )
59
106
107
+ ref = det ("++00" )
108
+ dets = forte .hilbert_space (4 , 2 , 0 , ref , truncation = 1 )
109
+ # compare with the expected result of the determinant
110
+ expected = [det ("++00" ), det ("+0+0" ), det ("+00+" ), det ("0++0" ), det ("0+0+" )]
111
+ assert len (dets ) == 5
112
+ assert sorted (dets ) == sorted (expected )
113
+
60
114
61
115
if __name__ == "__main__" :
62
- test_determinant_hilber_space ()
63
- test_determinant_hilber_space_edge_cases ()
116
+ test_determinant_hilbert_space ()
117
+ test_determinant_hilbert_space_edge_cases ()
0 commit comments