Skip to content

Commit

Permalink
add back benzene fixture loading form SMILES
Browse files Browse the repository at this point in the history
  • Loading branch information
chrisjonesBSU committed Oct 28, 2024
1 parent 4c26a60 commit a4c41c5
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 5 deletions.
6 changes: 6 additions & 0 deletions mbuild/tests/base_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,12 @@ def benzene(self):
compound.name = "Benzene"
return compound

@pytest.fixture
def benzene_from_SMILES(self):
compound = mb.load("c1ccccc1", smiles=True)
compound.name = "Benzene"
return compound

@pytest.fixture
def benzene_from_parts(self):
ch = mb.load(get_fn("ch.mol2"))
Expand Down
14 changes: 9 additions & 5 deletions mbuild/tests/test_compound.py
Original file line number Diff line number Diff line change
Expand Up @@ -1452,7 +1452,7 @@ def test_resnames_parmed(self, h2o, ethane):
struct.atoms
)

def test_resnames_parmed_cg(self, benzene, hexane, propyl):
def test_resnames_parmed_cg(self, benzene_from_SMILES, hexane, propyl):
particles = [propyl.__class__]
cg = mb.coarse_grain(hexane, particle_classes=particles)

Expand Down Expand Up @@ -1507,7 +1507,11 @@ def test_resnames_parmed_cg(self, benzene, hexane, propyl):

# test mixed cg atomistic systems
mixed_molecules_box = mb.Compound(
[mb.clone(bonded_beads), mb.clone(bonded_beads), benzene]
[
mb.clone(bonded_beads),
mb.clone(bonded_beads),
benzene_from_SMILES,
]
)
struct = mixed_molecules_box.to_parmed(
infer_residues=True,
Expand All @@ -1520,8 +1524,8 @@ def test_resnames_parmed_cg(self, benzene, hexane, propyl):
[
mb.clone(two_bonded_beads),
mb.clone(two_bonded_beads),
mb.clone(benzene),
mb.clone(benzene),
mb.clone(benzene_from_SMILES),
mb.clone(benzene_from_SMILES),
mb.fill_box(hexane, 2, box=mb.Box([5, 5, 5])),
]
)
Expand Down Expand Up @@ -1551,7 +1555,7 @@ def test_resnames_parmed_cg(self, benzene, hexane, propyl):
# hexane is goes from polymer down to monomer level. Made from two propyl groups which gives two monomers (4 total)
assert len(
struct.residues
) == 2 * two_bonded_beads.n_particles + 2 * benzene.n_particles + 2 * len(
) == 2 * two_bonded_beads.n_particles + 2 * benzene_from_SMILES.n_particles + 2 * len(
hexane.children
)

Expand Down

0 comments on commit a4c41c5

Please sign in to comment.