From f07ae16e963d69c51c88f22f9450b1aba7ce39de Mon Sep 17 00:00:00 2001 From: chrisjonesBSU Date: Thu, 8 Aug 2024 13:10:44 -0600 Subject: [PATCH 1/4] test against both SMILES versions --- mbuild/tests/test_compound.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/mbuild/tests/test_compound.py b/mbuild/tests/test_compound.py index 3de82bba9..6099f87af 100644 --- a/mbuild/tests/test_compound.py +++ b/mbuild/tests/test_compound.py @@ -2479,7 +2479,13 @@ def test_get_smiles(self): test_strings = ["CCO", "CCCCCCCC", "c1ccccc1", "CC(=O)Oc1ccccc1C(=O)O"] for test_string in test_strings: my_cmp = mb.load(test_string, smiles=True, backend="pybel") - assert my_cmp.get_smiles() == test_string + if test_string == "CC(=O)Oc1ccccc1C(=O)O": + try: + assert my_cmp.get_smiles() == test_string + except AssertionError: + assert my_cmp.get_smiles() == "CC(=O)OC1=C([CH][CH][CH][CH]1)C(=O)O" + else: + assert my_cmp.get_smiles() == test_string def test_sdf(self, methane): methane.save("methane.sdf") From 74032c9d7a660ecf60e833e0e425100c9aff1211 Mon Sep 17 00:00:00 2001 From: chrisjonesBSU Date: Mon, 12 Aug 2024 08:22:46 -0600 Subject: [PATCH 2/4] add cap hyrogens to head and tail monomers --- mbuild/lib/recipes/polymer.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mbuild/lib/recipes/polymer.py b/mbuild/lib/recipes/polymer.py index 19340fffa..9209a532d 100644 --- a/mbuild/lib/recipes/polymer.py +++ b/mbuild/lib/recipes/polymer.py @@ -211,7 +211,7 @@ def build(self, n, sequence="A", add_hydrogens=True): # Defaut to 1/2 H-C bond len head_tail[i].update_separation(0.0547) hydrogen["up"].update_separation(0.0547) - self.add(hydrogen) + head_tail[i].parent.add(hydrogen) force_overlap(hydrogen, hydrogen["up"], head_tail[i]) head_tail[i] = None else: From 443ebd0a31fafcc4eddb154b0a0b647bdb349926 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 12 Aug 2024 14:50:43 +0000 Subject: [PATCH 3/4] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- mbuild/tests/test_compound.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/mbuild/tests/test_compound.py b/mbuild/tests/test_compound.py index 6099f87af..e94f74ebe 100644 --- a/mbuild/tests/test_compound.py +++ b/mbuild/tests/test_compound.py @@ -2483,7 +2483,10 @@ def test_get_smiles(self): try: assert my_cmp.get_smiles() == test_string except AssertionError: - assert my_cmp.get_smiles() == "CC(=O)OC1=C([CH][CH][CH][CH]1)C(=O)O" + assert ( + my_cmp.get_smiles() + == "CC(=O)OC1=C([CH][CH][CH][CH]1)C(=O)O" + ) else: assert my_cmp.get_smiles() == test_string From 8a041110467a597490dd36d977b3045dbec4c2f6 Mon Sep 17 00:00:00 2001 From: chrisjonesBSU Date: Mon, 12 Aug 2024 08:58:51 -0600 Subject: [PATCH 4/4] test that polymer.children is same length as n monomers --- mbuild/tests/test_polymer.py | 1 + 1 file changed, 1 insertion(+) diff --git a/mbuild/tests/test_polymer.py b/mbuild/tests/test_polymer.py index f4ec75dd0..0bf67161d 100644 --- a/mbuild/tests/test_polymer.py +++ b/mbuild/tests/test_polymer.py @@ -18,6 +18,7 @@ def test_polymer_from_smiles(self): assert len([p for p in chain.particles() if p.name == "C"]) == 10 assert len([p for p in chain.particles() if p.name == "H"]) == 22 assert len(chain.available_ports()) == 0 + assert len(chain.children) == 5 def test_add_end_groups(self, ch2, ester): n = 6