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

Fix failing tests with latest version of packmol #1189

Merged
merged 2 commits into from
Jun 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
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
6 changes: 4 additions & 2 deletions mbuild/tests/test_compound.py
Original file line number Diff line number Diff line change
Expand Up @@ -634,7 +634,9 @@ def test_mass_property(self, h2o):

assert np.allclose(h2o.mass, 18.015, atol=1e-5)

system = mb.fill_box(compound=h2o, n_compounds=5, box=[0.5, 0.5, 0.5])
system = mb.fill_box(
compound=h2o, n_compounds=5, box=[0.5, 0.5, 0.5], overlap=0.01
)
assert np.allclose(system.mass, 5 * h2o.mass, atol=1e-5)

def test_mass_setter(self, ethane):
Expand Down Expand Up @@ -1471,7 +1473,7 @@ def test_fillbox_then_parmed(self):
box = Box.from_mins_maxs_angles(
mins=(2, 2, 2), maxs=(3, 3, 3), angles=(90.0, 90.0, 90.0)
)
bead_box = mb.fill_box(bead, 100, box=[2, 2, 2, 3, 3, 3])
bead_box = mb.fill_box(bead, 100, box=[2, 2, 2, 3, 3, 3], overlap=0.01)
bead_box_in_pmd = bead_box.to_parmed(box=box)

assert isinstance(bead_box_in_pmd, pmd.Structure)
Expand Down
12 changes: 10 additions & 2 deletions mbuild/tests/test_packing.py
Original file line number Diff line number Diff line change
Expand Up @@ -302,8 +302,16 @@ def test_packmol_error(self, h2o):
mb.fill_box(h2o, n_compounds=10, box=[0, 0, 0])

def test_packmol_warning(self, h2o):
with pytest.warns(UserWarning):
mb.fill_box(h2o, n_compounds=10, box=[1, 1, 1], overlap=10)
import sys

if (
"win" in sys.platform and not sys.platform == "darwin"
): # windows uses old 20.0.4 of packmol, which raises a warning
with pytest.warns(UserWarning):
mb.fill_box(h2o, n_compounds=10, box=[1, 1, 1], overlap=10)
else:
with pytest.raises(RuntimeError):
mb.fill_box(h2o, n_compounds=10, box=[1, 1, 1], overlap=10)

def test_rotate(self, h2o):
filled = mb.fill_box(h2o, 2, box=[1, 1, 1], fix_orientation=True)
Expand Down
Loading