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

Makebonds molecule #234

Closed
wants to merge 11 commits into from
Prev Previous commit
Next Next commit
Added a test for multiprocessing
  • Loading branch information
Matthijs Tadema authored and Matthijs Tadema committed Mar 4, 2020
commit 08c6a7e36eeeb560c8db505dc41482dd35eb36b9
12 changes: 12 additions & 0 deletions vermouth/tests/test_make_bonds.py
Original file line number Diff line number Diff line change
Expand Up @@ -181,9 +181,21 @@ def test_make_bonds(nodes, edges, expected_edges):
mol.add_nodes_from(enumerate(node_set))
mol.add_edges_from(edge_set)
system.add_molecule(mol)
system_mp = system.copy()

MakeBonds().run_system(system)
# Make sure number of connected components is the same
assert len(system.molecules) == len(expected_edges)
# Make sure that for every molecule found, the edges are correct
for found_mol, ref_edges in zip(system.molecules, expected_edges):
assert dict(found_mol.edges) == ref_edges

# Also test making bonds with multiprocessing
mb = MakeBonds()
mb.nproc = 2
mb.run_system(system)
# Make sure number of connected components is the same
assert len(system.molecules) == len(expected_edges)
# Make sure that for every molecule found, the edges are correct
for found_mol, ref_edges in zip(system.molecules, expected_edges):
assert dict(found_mol.edges) == ref_edges