Skip to content

Commit

Permalink
improved unit test
Browse files Browse the repository at this point in the history
  • Loading branch information
wxj6000 committed Nov 19, 2023
1 parent 796b5a6 commit a719966
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
3 changes: 2 additions & 1 deletion gpu4pyscf/solvent/grad/pcm.py
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,8 @@ def grad_qv(pcmobj, dm):
# rebuild with aosym
intopt.build(1e-14, diag_block_with_triu=True, aosym=False)
coeff = intopt.coeff
dm_cart = cupy.einsum('pi,ij,qj->pq', coeff, dm, coeff)
dm_cart = coeff @ dm @ coeff.T
#dm_cart = cupy.einsum('pi,ij,qj->pq', coeff, dm, coeff)

dvj, _ = int3c2e.get_int3c2e_ip_jk(intopt, 0, 'ip1', q_sym, None, dm_cart)
dq, _ = int3c2e.get_int3c2e_ip_jk(intopt, 0, 'ip2', q_sym, None, dm_cart)
Expand Down
3 changes: 2 additions & 1 deletion gpu4pyscf/solvent/hessian/pcm.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,8 @@ def hess_qv(pcmobj, dm, verbose=None):
# rebuild with aosym
intopt.build(1e-14, diag_block_with_triu=True, aosym=False)
coeff = intopt.coeff
dm_cart = cupy.einsum('pi,ij,qj->pq', coeff, dm, coeff)
dm_cart = coeff @ dm @ coeff.T
#dm_cart = cupy.einsum('pi,ij,qj->pq', coeff, dm, coeff)

dvj, _ = int3c2e.get_int3c2e_ipip1_hjk(intopt, q_sym, None, dm_cart, with_k=False)
dq, _ = int3c2e.get_int3c2e_ipvip1_hjk(intopt, q_sym, None, dm_cart, with_k=False)
Expand Down
4 changes: 2 additions & 2 deletions gpu4pyscf/solvent/tests/test_pcm_hessian.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,14 +74,13 @@ def _check_hessian(mf, h, ix=0, iy=0):
_, g1 = g_scanner(pmol)

h_fd = (g0 - g1)/2.0/eps
pmol.set_geom_(coords, unit='Bohr')
pmol.build()

print(f'Norm of H({ix},{iy}) diff, {np.linalg.norm(h[ix,:,iy,:] - h_fd)}')
assert(np.linalg.norm(h[ix,:,iy,:] - h_fd) < tol)

class KnownValues(unittest.TestCase):
def test_hess_cpcm(self):
print('testing C-PCM Hessian')
mf = _make_mf(method='C-PCM')
hobj = mf.Hessian()
hobj.set(auxbasis_response=2)
Expand All @@ -90,6 +89,7 @@ def test_hess_cpcm(self):
_check_hessian(mf, h, ix=0, iy=1)

def test_hess_iefpcm(self):
print("testing IEF-PCM hessian")
mf = _make_mf(method='IEF-PCM')
hobj = mf.Hessian()
hobj.set(auxbasis_response=2)
Expand Down

0 comments on commit a719966

Please sign in to comment.