Skip to content

Commit

Permalink
add fill_sphere to check input test
Browse files Browse the repository at this point in the history
  • Loading branch information
chrisjonesBSU committed Feb 14, 2025
1 parent 79e8296 commit 26db1c5
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions mbuild/tests/test_packing.py
Original file line number Diff line number Diff line change
Expand Up @@ -369,33 +369,36 @@ def test_packmol_error(self, h2o):
with pytest.raises(MBuildError, match=r"co\-linear"):
mb.fill_box(h2o, n_compounds=10, box=[0, 0, 0])

def test_save_packmol_input(self, h2o):
def test_save_packmol_input(self, h2o, methane):
cwd = os.getcwd() # Must keep track of the temp dir that pytest creates
filled = mb.fill_box(
mb.fill_box(
h2o, n_compounds=10, box=Box([4, 4, 4]), packmol_file="fill_box.inp"
)
assert os.path.isfile(os.path.join(cwd, "fill_box.inp"))
os.remove(os.path.join(cwd, "fill_box.inp"))

mb.fill_region(
h2o,
10,
[[2, 2, 2, 4, 4, 4]],
temp_file="temp_file2.pdb",
bounds=[[2, 2, 2, 4, 4, 4]],
packmol_file="region.inp",
)
assert os.path.isfile(os.path.join(cwd, "region.inp"))
os.remove(os.path.join(cwd, "region.inp"))

mb.solvate(
filled,
methane,
h2o,
10,
box=[4, 4, 4],
temp_file="temp_file3.pdb",
packmol_file="solvate.inp",
)
assert os.path.isfile(os.path.join(cwd, "solvate.inp"))

mb.fill_sphere(
h2o, sphere=[3, 3, 3, 1.5], n_compounds=50, packmol_file="sphere.inp"
)
assert os.path.isfile(os.path.join(cwd, "sphere.inp"))

def test_packmol_args(self, h2o):
with pytest.raises(RuntimeError):
mb.fill_box(
Expand Down

0 comments on commit 26db1c5

Please sign in to comment.