-
Notifications
You must be signed in to change notification settings - Fork 5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
small-fixes #72
base: master
Are you sure you want to change the base?
small-fixes #72
Changes from 3 commits
a5c60c5
f30deb8
94d2d43
5e2e26f
74f729a
9bb37c2
5d46fa2
ead08aa
ca8b08b
80b18b4
049ddb1
69f67f7
96f05f2
e3a951d
8a4afbb
878ef50
ccee36e
2d65da9
f12b9aa
b7da960
e1c9cca
8e9ee0e
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,19 +9,31 @@ def test_water(): | |
mols = utils.load_mols([xyz_in], [0], [0], 'minao') | ||
dms = utils.mols_guess(mols, [xyz_in], 'LB', spin=[0]) | ||
X = bond.get_repr(mols, [xyz_in], 'LB', spin=[0], with_symbols=False, same_basis=False) | ||
#X = np.hstack(X) # merging alpha-beta components for spin unrestricted representation #TODO: should be included into function not in main | ||
true_file = path+'/data/H2O_spahm_b.npy_alpha_beta.npy' | ||
X_true = np.load(true_file) | ||
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_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' | ||
mols = utils.load_mols([xyz_in], [0], [0], 'minao') | ||
dms = utils.mols_guess(mols, [xyz_in], 'LB', spin=[0]) | ||
X = bond.bond(mols, dms, spin=[0], only_z=['O']) | ||
X = bond.bond(mols, dms, only_z=['O']) | ||
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 | ||
true_file = path+'/data/H2O_spahm_b.npy_alpha_beta.npy' | ||
|
@@ -36,7 +48,7 @@ def test_water_same_basis(): | |
xyz_in = path+'/data/H2O.xyz' | ||
mols = utils.load_mols([xyz_in], [0], [0], 'minao') | ||
dms = utils.mols_guess(mols, [xyz_in], 'LB', spin=[0]) | ||
X = bond.bond(mols, dms, spin=[0], same_basis=True) | ||
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 | ||
true_file = path+'/data/H2O_spahm_b_CCbas.npy_alpha_beta.npy' | ||
|
@@ -48,9 +60,9 @@ 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]) | ||
Comment on lines
-51
to
-52
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this was actually weird ! because even specifying But it made me realized that it's a bit dangerous now too, because if you only use the |
||
X = bond.bond(mols, dms, spin=[None], same_basis=True) | ||
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 | ||
true_file = path+'/data/I2_spahm-b_minao-def2-svp_alpha-beta.npy' | ||
|
@@ -76,4 +88,5 @@ def test_from_list(): | |
if __name__ == '__main__': | ||
test_water() | ||
test_from_list() | ||
test_water_closed() | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
a pity that it has to be done twice when calling the
main()
script, but couldn't find any work around !