Skip to content
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

Dye: add tests #106

Open
BvB93 opened this issue Apr 23, 2020 · 1 comment
Open

Dye: add tests #106

BvB93 opened this issue Apr 23, 2020 · 1 comment
Assignees
Labels
Tests Updated the unit-tests

Comments

@BvB93
Copy link
Member

BvB93 commented Apr 23, 2020

There are a number of examples of pre-existing tests already in CAT (ref).

@BvB93 BvB93 changed the title Add tests. Add tests Apr 23, 2020
@BvB93 BvB93 added the enhancement New feature or request label May 8, 2020
@BvB93 BvB93 added Tests Updated the unit-tests and removed enhancement New feature or request labels Jun 3, 2020
@BvB93 BvB93 changed the title Add tests Dye: add tests Jun 8, 2020
@BvB93
Copy link
Member Author

BvB93 commented Jul 17, 2020

A quick test to see if two molecules are equivalent:

import numpy as np
from scm.plams import Molecule

mol1 = Molecule(...)
mol2 = Molecule(...)

def _get_atnum(mol: Molecule) -> np.ndarray:
    iterator = (at.atnum for at in mol)
    return np.fromiter(iterator, int, count=len(mol))

# check if the coords are the same
np.testing.assert_allclose(mol1, mol2)  

# check if atomic symbols/numbers are the same
np.testing.assert_array_equal(_get_atnum(mol1), _get_atnum(mol2))  

# Check if the bonds are the same
np.testing.assert_allclose(mol1.bond_matrix(), mol2.bond_matrix())  

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Tests Updated the unit-tests
Projects
None yet
Development

No branches or pull requests

2 participants