-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
45 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
import os | ||
|
||
import pytest | ||
|
||
from mdagent.tools.base_tools.preprocess_tools.packing import Molecule, PackmolBox | ||
from mdagent.utils import PathRegistry | ||
|
||
|
||
@pytest.fixture | ||
def get_registry(): | ||
return PathRegistry() | ||
|
||
|
||
@pytest.fixture | ||
def packmolbox(get_registry): | ||
return PackmolBox(get_registry) | ||
|
||
|
||
@pytest.fixture | ||
def dummy_molecule(): | ||
return Molecule( | ||
filename="water", file_id=100, number_of_molecules=2, instructions=None | ||
) | ||
|
||
|
||
def test_add_molecule(packmolbox, dummy_molecule): | ||
initial_length = len(packmolbox.molecules) | ||
packmolbox.add_molecule(dummy_molecule) | ||
assert len(packmolbox.molecules) == initial_length + 1 | ||
|
||
|
||
def test_generate_input_header(packmolbox): | ||
packmolbox.generate_input_header() | ||
# assert file packmol.inp exists | ||
assert os.path.isfile("packmol.inp") | ||
os.remove("packmol.inp") | ||
|
||
|
||
def test_generate_input(packmolbox, dummy_molecule): | ||
packmolbox.add_molecule(dummy_molecule) | ||
output = packmolbox.generate_input() | ||
assert "structure water" in output | ||
assert "number 2" in output | ||
assert "end structure" in output |