Skip to content

Commit 8a4afbb

Browse files
committed
add closed-shell rep test and fixed test_ecp
1 parent e3a951d commit 8a4afbb

File tree

2 files changed

+16
-2
lines changed

2 files changed

+16
-2
lines changed

tests/data/H2O_spahm_b.npy

13.1 KB
Binary file not shown.

tests/test_spahm_b.py

+16-2
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,19 @@ def test_water():
1515
for Xa, Xa_true in zip(X, X_true):
1616
assert(np.linalg.norm(Xa-Xa_true) < 1e-8) # evaluating representation diff as norm (threshold = 1e-8)
1717

18+
def test_water_closed():
19+
path = os.path.dirname(os.path.realpath(__file__))
20+
xyz_in = path+'/data/H2O.xyz'
21+
mols = utils.load_mols([xyz_in], [None], [0], 'minao')
22+
dms = utils.mols_guess(mols, [xyz_in], 'LB', spin=[None])
23+
X = bond.get_repr(mols, [xyz_in], 'LB', spin=[None], with_symbols=False, same_basis=False)
24+
true_file = path+'/data/H2O_spahm_b.npy'
25+
X_true = np.load(true_file)
26+
print(X_true.shape)
27+
assert(X_true.shape == X.shape)
28+
for Xa, Xa_true in zip(X, X_true):
29+
assert(np.linalg.norm(Xa-Xa_true) < 1e-8) # evaluating representation diff as norm (threshold = 1e-8)
30+
1831
def test_water_O_only():
1932
path = os.path.dirname(os.path.realpath(__file__))
2033
xyz_in = path+'/data/H2O.xyz'
@@ -47,8 +60,8 @@ def test_water_same_basis():
4760
def test_ecp():
4861
path = os.path.dirname(os.path.realpath(__file__))
4962
xyz_in = path+'/data/I2.xyz'
50-
mols = utils.load_mols([xyz_in], [0], [None], 'minao', ecp='def2-svp')
51-
dms = utils.mols_guess(mols, [xyz_in], 'LB', spin=[None])
63+
mols = utils.load_mols([xyz_in], [0], [0], 'minao', ecp='def2-svp')
64+
dms = utils.mols_guess(mols, [xyz_in], 'LB', spin=[0])
5265
X = bond.bond(mols, dms, same_basis=True)
5366
X = np.squeeze(X) #contains a single elements but has shape (1,Nfeat)
5467
X = np.hstack(X) # merging alpha-beta components for spin unrestricted representation #TODO: should be included into function not in main
@@ -75,4 +88,5 @@ def test_from_list():
7588
if __name__ == '__main__':
7689
test_water()
7790
test_from_list()
91+
test_water_closed()
7892

0 commit comments

Comments
 (0)