File: test_run.py

package info (click to toggle)
python-ase 3.26.0-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 15,484 kB
  • sloc: python: 148,112; xml: 2,728; makefile: 110; javascript: 47
file content (24 lines) | stat: -rw-r--r-- 576 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
# fmt: off
import pytest

from ase.build import bulk
from ase.io import write


@pytest.fixture()
def fname(testdir):
    atoms = bulk('Au')
    filename = 'file.traj'
    write(filename, atoms)
    return filename


def test_run_eos(cli, fname):
    output = cli.ase('run', 'emt', fname, '--equation-of-state=4,2.0')
    print(output)
    for line in output.splitlines():
        if line.startswith('fitted volume'):
            vol = float(line.split()[-1])
            assert vol == pytest.approx(16.7, abs=0.05)
            return
    raise ValueError('Volume not found')