File: test_packmol.py

package info (click to toggle)
packmol 1%3A21.2.1-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 3,504 kB
  • sloc: tcl: 7,504; f90: 5,290; fortran: 1,879; sh: 299; makefile: 167; python: 121; lisp: 101
file content (37 lines) | stat: -rw-r--r-- 747 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
"""Integration test for the packmol package."""

import subprocess

WATER_XYZ = """\
3
water molecule
O   0.000   0.000   0.000
H   0.957   0.000   0.000
H  -0.240   0.927   0.000
"""


def test_pack_water_box(tmp_path):
    """Test that packmol can pack water molecules into a box."""
    (tmp_path / "water.xyz").write_text(WATER_XYZ)

    (tmp_path / "input.inp").write_text("""\
tolerance 2.0
filetype xyz
output output.xyz

structure water.xyz
  number 10
  inside box 0. 0. 0. 20. 20. 20.
end structure
""")

    result = subprocess.run(
        ["packmol"],
        stdin=open(tmp_path / "input.inp"),
        capture_output=True,
        cwd=tmp_path,
    )

    assert result.returncode == 0
    assert (tmp_path / "output.xyz").exists()