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

preserve meta when converting block to molecule #245

Merged
merged 6 commits into from
Apr 17, 2020
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
PEP8
  • Loading branch information
fgrunewald committed Apr 16, 2020
commit 896b2b0c8241ed93aac20f14f4a65735c18f7eb7
19 changes: 9 additions & 10 deletions vermouth/tests/test_molecule.py
Original file line number Diff line number Diff line change
Expand Up @@ -1250,9 +1250,8 @@ def test_to_molecule():
Test if the to molecule function gives
expected results.
"""
force_field = vermouth.forcefield.ForceField("test")
test_block = vermouth.molecule.Block()
test_block.add_edges_from([('A','B'), ('B','C')])
test_block.add_edges_from([('A', 'B'), ('B', 'C')])
test_block.interactions["bonds"] = [
Interaction(atoms=('A', 'B'),
parameters=['a', '0.2', '200'],
Expand All @@ -1261,12 +1260,12 @@ def test_to_molecule():
parameters=['a', '0.1', '300'],
meta={'b': 1}),]

molecule = test_block.to_molecule()
test_molecule = test_block.to_molecule()

ref_bonds = [ Interaction(atoms=(0, 1),
parameters=['a', '0.2', '200'],
meta={'a': 0}),
Interaction(atoms=(1, 2),
parameters=['a', '0.1', '300'],
meta={'b': 1}),]
assert ref_bonds == molecule.interactions['bonds']
ref_bonds = [Interaction(atoms=(0, 1),
parameters=['a', '0.2', '200'],
meta={'a': 0}),
Interaction(atoms=(1, 2),
parameters=['a', '0.1', '300'],
meta={'b': 1}),]
assert ref_bonds == test_molecule.interactions['bonds']