Skip to content

Commit

Permalink
add test for when volume but no template is provided
Browse files Browse the repository at this point in the history
  • Loading branch information
fgrunewald committed Jul 26, 2024
1 parent 8bb37f0 commit d8d3b66
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion polyply/tests/test_generate_templates.py
Original file line number Diff line number Diff line change
Expand Up @@ -153,14 +153,22 @@ def test_extract_block():
len(ff.blocks["GLY"].interactions[inter_type]) == len(new_block.interactions[inter_type])

@staticmethod
def test_run_molecule():
@pytest.mark.parametrize('volumes', (
None,
{"PMMA": 0.55},
))
def test_run_molecule(volumes):
top = polyply.src.topology.Topology.from_gmx_topfile(TEST_DATA / "topology_test" / "system.top", "test")
top.gen_pairs()
if volumes:
top.volumes = volumes
top.convert_nonbond_to_sig_eps()
GenerateTemplates(topology=top, skip_filter=False, max_opt=10).run_molecule(top.molecules[0])
graph = top.molecules[0].nodes[0]['graph']
graph_hash = nx.algorithms.graph_hashing.weisfeiler_lehman_graph_hash(graph, node_attr='atomname')
assert graph_hash in top.volumes
if volumes:
assert top.volumes[graph_hash] == volumes['PMMA']
assert graph_hash in top.molecules[0].templates

@staticmethod
Expand Down

0 comments on commit d8d3b66

Please sign in to comment.