Skip to content

Commit

Permalink
Add test for list of xyz-files and add test-data
Browse files Browse the repository at this point in the history
  • Loading branch information
YAY-C committed Jul 2, 2024
1 parent 5e2e26f commit 74f729a
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 0 deletions.
Binary file not shown.
3 changes: 3 additions & 0 deletions tests/data/list_water.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
H2O_dist.xyz
H2O.xyz
rotated_H2O.xyz
12 changes: 12 additions & 0 deletions tests/test_spahm_b.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,19 @@ def test_ecp():
for Xa, Xa_true in zip(X, X_true):
assert(np.linalg.norm(Xa-Xa_true) < 1e-8) # evaluating representation diff as norm (threshold = 1e-8)

def test_from_list():
path = os.path.dirname(os.path.realpath(__file__))
path2list = path+'/data/list_water.txt'
xyzlist = utils.get_xyzlist(path2list)
spins = utils.get_chsp(None, len(xyzlist))
charges = utils.get_chsp(None, len(xyzlist))
mols = utils.load_mols(xyzlist, charges, spins, 'minao', srcdir=path+'/data/')
spahm_b = bond.get_repr(mols, xyzlist, 'LB', spin=spins, same_basis=True)
Xtrue = np.load(path+'/data/list_H2O_spahm-b_minao_LB_alpha-beta.npy')
assert(np.allclose(Xtrue, spahm_b))


if __name__ == '__main__':
test_water()
test_from_list()

0 comments on commit 74f729a

Please sign in to comment.