Skip to content

Commit 9ca47e9

Browse files
committed
Add test for TwoCenterIntegrator for pyabacus.
1 parent 1d923b8 commit 9ca47e9

File tree

1 file changed

+29
-0
lines changed

1 file changed

+29
-0
lines changed

python/pyabacus/tests/test_m_nao.py

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,36 @@ def test_rc():
7373
assert orb(0,1,1).l == 1
7474
assert orb(0,2,0).l == 2
7575

76+
def test_twocenterintegrator():
77+
orb_dir = '../../../tests/PP_ORB/'
78+
file_list = ["C_gga_8au_100Ry_2s2p1d.orb", "O_gga_10au_100Ry_2s2p1d.orb"]
79+
file_list = [orb_dir + orbfile for orbfile in file_list]
80+
81+
orb = nao.RadialCollection()
82+
orb.build(2, file_list, 'o')
83+
84+
alpha = nao.RadialCollection()
85+
alpha.build(1, [file_list[0]])
86+
87+
dr = 0.01 # R spacing
88+
rmax = max(orb.rcut_max, alpha.rcut_max)
89+
cutoff = 2.0 * rmax
90+
nr = int(rmax / dr) + 1
91+
92+
orb.set_uniform_grid(True, nr, cutoff, 'i', True)
93+
alpha.set_uniform_grid(True, nr, cutoff, 'i', True)
94+
95+
sbt = base.SphericalBesselTransformer()
96+
orb.set_transformer(sbt)
97+
alpha.set_transformer(sbt)
98+
99+
integrator = nao.TwoCenterIntegrator()
100+
integrator.tabulate(orb, alpha, 'S', nr, cutoff)
76101

102+
overlap = integrator.snap(0, 0, 0, 0, 0, np.array([0.0, 0.0, 0.0]), False)
103+
assert 1 - overlap[0][0] < 1e-10
104+
overlap = integrator.snap(1, 0, 0, 0, 0, np.array([3.0, 3.0, 3.0]), False)
105+
assert abs(overlap[0][0] - 0.031136758774787342) < 1e-10
77106

78107

79108

0 commit comments

Comments
 (0)