@@ -15,6 +15,19 @@ def test_water():
15
15
for Xa , Xa_true in zip (X , X_true ):
16
16
assert (np .linalg .norm (Xa - Xa_true ) < 1e-8 ) # evaluating representation diff as norm (threshold = 1e-8)
17
17
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
+
18
31
def test_water_O_only ():
19
32
path = os .path .dirname (os .path .realpath (__file__ ))
20
33
xyz_in = path + '/data/H2O.xyz'
@@ -47,8 +60,8 @@ def test_water_same_basis():
47
60
def test_ecp ():
48
61
path = os .path .dirname (os .path .realpath (__file__ ))
49
62
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 ])
52
65
X = bond .bond (mols , dms , same_basis = True )
53
66
X = np .squeeze (X ) #contains a single elements but has shape (1,Nfeat)
54
67
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():
75
88
if __name__ == '__main__' :
76
89
test_water ()
77
90
test_from_list ()
91
+ test_water_closed ()
78
92
0 commit comments