From 8a4afbb8ac8efb2e8cb7af5811dde76b891bba79 Mon Sep 17 00:00:00 2001 From: Yannick Calvino Alonso Date: Fri, 6 Dec 2024 15:20:39 +0100 Subject: [PATCH] add closed-shell rep test and fixed `test_ecp` --- tests/data/H2O_spahm_b.npy | Bin 0 -> 13424 bytes tests/test_spahm_b.py | 18 ++++++++++++++++-- 2 files changed, 16 insertions(+), 2 deletions(-) create mode 100644 tests/data/H2O_spahm_b.npy diff --git a/tests/data/H2O_spahm_b.npy b/tests/data/H2O_spahm_b.npy new file mode 100644 index 0000000000000000000000000000000000000000..aeec4ac9d9856322e3e4e25c76320aade6931624 GIT binary patch literal 13424 zcmeI3d036zyT_X-sZ=VdXdW~VTf<&Y&u*SnLQ*M`2BJBX3`vH(Lgh^*BpOI4qV`(a zR45ceq5(xhsL-V0yzOW0&UKvY_s{w3{PFgmeeG+l`?F}UVGO_fFW{(6n;bA4N*06DyEaDrvcWTI)xHpO+CLLYyQUdIpkM6bfiM8&UICPRd&C`w`=+)=t+sE(j@;dslMgf`BV1* z@(4JSZr58{b&|ys>@Mv_#2Qljw1;XaJFv`9x+S&GnS5$p9`k2C+Psbg38{5uGL-Ii zz9$Kbi`2Sf7FCj+Gik(RKDBO|XO7RaTq(2;KX0VgjUy+xRx#F$(ZuUKb}}~1aR?f7 z3t(M%R$0utu$kpO=d6d=NjsL?Sf3i2yNWf&p!SzI+7P~E#0ovVbvIyvp(sP>P~QvS zy@n9E9aOF|%MUfyCZ4)&qsV%)cTbR~o(1CFoN`=@ho6-+yE3OC##_vg9i6->-UmJ#*4V$_!;$Q2U55mwdl7lSH2@seMfFx?^Hq?_aFcBdSBF zbrbj&E}PtFLtMb?mY0+sv*1}v95kiY?YpkHQQe&jeZ~5E}R4*FE+E1?(Ms57`~G==lF9cnSmOz>YzMdUj{ef&6n1F#Q8C) zFsvE+{Q?)_?aL7J+5Nam@JsO1&2ol>ozveuw$j(C_#A@s7hHEC@~>o`S-;nS_`878 zEk@t2>aLywVSt~q4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?d00001 diff --git a/tests/test_spahm_b.py b/tests/test_spahm_b.py index 7399bff..482394c 100755 --- a/tests/test_spahm_b.py +++ b/tests/test_spahm_b.py @@ -15,6 +15,19 @@ def test_water(): 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_water_closed(): + path = os.path.dirname(os.path.realpath(__file__)) + xyz_in = path+'/data/H2O.xyz' + mols = utils.load_mols([xyz_in], [None], [0], 'minao') + dms = utils.mols_guess(mols, [xyz_in], 'LB', spin=[None]) + X = bond.get_repr(mols, [xyz_in], 'LB', spin=[None], with_symbols=False, same_basis=False) + true_file = path+'/data/H2O_spahm_b.npy' + X_true = np.load(true_file) + print(X_true.shape) + assert(X_true.shape == X.shape) + 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_water_O_only(): path = os.path.dirname(os.path.realpath(__file__)) xyz_in = path+'/data/H2O.xyz' @@ -47,8 +60,8 @@ def test_water_same_basis(): def test_ecp(): path = os.path.dirname(os.path.realpath(__file__)) xyz_in = path+'/data/I2.xyz' - mols = utils.load_mols([xyz_in], [0], [None], 'minao', ecp='def2-svp') - dms = utils.mols_guess(mols, [xyz_in], 'LB', spin=[None]) + mols = utils.load_mols([xyz_in], [0], [0], 'minao', ecp='def2-svp') + dms = utils.mols_guess(mols, [xyz_in], 'LB', spin=[0]) X = bond.bond(mols, dms, same_basis=True) X = np.squeeze(X) #contains a single elements but has shape (1,Nfeat) 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(): if __name__ == '__main__': test_water() test_from_list() + test_water_closed()